Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Side by Side Diff: webrtc/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc

Issue 2861443004: Reland of Don't reinit encoder when rotation changes. (Closed)
Patch Set: Fix compile. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/modules/video_coding/codecs/vp9/test/vp9_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 encoded_frame_->_buffer = frame_buffer_.get(); 76 encoded_frame_->_buffer = frame_buffer_.get();
77 encoded_frame_->_size = encoded_frame._length; 77 encoded_frame_->_size = encoded_frame._length;
78 } 78 }
79 memcpy(encoded_frame_->_buffer, encoded_frame._buffer, encoded_frame._length); 79 memcpy(encoded_frame_->_buffer, encoded_frame._buffer, encoded_frame._length);
80 encoded_frame_->_length = encoded_frame._length; 80 encoded_frame_->_length = encoded_frame._length;
81 encoded_frame_->_encodedWidth = encoded_frame._encodedWidth; 81 encoded_frame_->_encodedWidth = encoded_frame._encodedWidth;
82 encoded_frame_->_encodedHeight = encoded_frame._encodedHeight; 82 encoded_frame_->_encodedHeight = encoded_frame._encodedHeight;
83 encoded_frame_->_timeStamp = encoded_frame._timeStamp; 83 encoded_frame_->_timeStamp = encoded_frame._timeStamp;
84 encoded_frame_->_frameType = encoded_frame._frameType; 84 encoded_frame_->_frameType = encoded_frame._frameType;
85 encoded_frame_->_completeFrame = encoded_frame._completeFrame; 85 encoded_frame_->_completeFrame = encoded_frame._completeFrame;
86 encoded_frame_->rotation_ = encoded_frame.rotation_;
86 encoded_frame_->qp_ = encoded_frame.qp_; 87 encoded_frame_->qp_ = encoded_frame.qp_;
87 codec_specific_info_->codecType = codec_specific_info->codecType; 88 codec_specific_info_->codecType = codec_specific_info->codecType;
88 // Skip |codec_name|, to avoid allocating. 89 // Skip |codec_name|, to avoid allocating.
89 codec_specific_info_->codecSpecific = codec_specific_info->codecSpecific; 90 codec_specific_info_->codecSpecific = codec_specific_info->codecSpecific;
90 encode_complete_ = true; 91 encode_complete_ = true;
91 return Result(Result::OK, 0); 92 return Result(Result::OK, 0);
92 } 93 }
93 94
94 bool Vp8UnitTestEncodeCompleteCallback::EncodeComplete() { 95 bool Vp8UnitTestEncodeCompleteCallback::EncodeComplete() {
95 if (encode_complete_) { 96 if (encode_complete_) {
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 267
267 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, 268 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
268 encoder_->InitEncode(&codec_settings_, 1, 1440)); 269 encoder_->InitEncode(&codec_settings_, 1, 1440));
269 270
270 // Decoder parameter tests. 271 // Decoder parameter tests.
271 // Calls before InitDecode(). 272 // Calls before InitDecode().
272 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->Release()); 273 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->Release());
273 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->InitDecode(&codec_settings_, 1)); 274 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->InitDecode(&codec_settings_, 1));
274 } 275 }
275 276
277 // We only test the encoder here, since the decoded frame rotation is set based
278 // on the CVO RTP header extension in VCMDecodedFrameCallback::Decoded.
279 // TODO(brandtr): Consider passing through the rotation flag through the decoder
280 // in the same way as done in the encoder.
281 TEST_F(TestVp8Impl, EncodedRotationEqualsInputRotation) {
282 SetUpEncodeDecode();
283
284 input_frame_->set_rotation(kVideoRotation_0);
285 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
286 encoder_->Encode(*input_frame_, nullptr, nullptr));
287 WaitForEncodedFrame();
288 EXPECT_EQ(kVideoRotation_0, encoded_frame_.rotation_);
289
290 input_frame_->set_rotation(kVideoRotation_90);
291 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
292 encoder_->Encode(*input_frame_, nullptr, nullptr));
293 WaitForEncodedFrame();
294 EXPECT_EQ(kVideoRotation_90, encoded_frame_.rotation_);
295 }
296
276 TEST_F(TestVp8Impl, DecodedQpEqualsEncodedQp) { 297 TEST_F(TestVp8Impl, DecodedQpEqualsEncodedQp) {
277 SetUpEncodeDecode(); 298 SetUpEncodeDecode();
278 encoder_->Encode(*input_frame_, nullptr, nullptr); 299 encoder_->Encode(*input_frame_, nullptr, nullptr);
279 EXPECT_GT(WaitForEncodedFrame(), 0u); 300 EXPECT_GT(WaitForEncodedFrame(), 0u);
280 // First frame should be a key frame. 301 // First frame should be a key frame.
281 encoded_frame_._frameType = kVideoFrameKey; 302 encoded_frame_._frameType = kVideoFrameKey;
282 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, 303 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
283 decoder_->Decode(encoded_frame_, false, nullptr)); 304 decoder_->Decode(encoded_frame_, false, nullptr));
284 EXPECT_GT(WaitForDecodedFrame(), 0u); 305 EXPECT_GT(WaitForDecodedFrame(), 0u);
285 ASSERT_TRUE(decoded_frame_); 306 ASSERT_TRUE(decoded_frame_);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 // Temporal layer 1. 427 // Temporal layer 1.
407 input_frame_->set_timestamp(input_frame_->timestamp() + 428 input_frame_->set_timestamp(input_frame_->timestamp() +
408 kTimestampIncrementPerFrame); 429 kTimestampIncrementPerFrame);
409 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, 430 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
410 encoder_->Encode(*input_frame_, nullptr, nullptr)); 431 encoder_->Encode(*input_frame_, nullptr, nullptr));
411 ExpectFrameWith((picture_id + 7) % (1 << 15), (tl0_pic_idx + 3) % (1 << 8), 432 ExpectFrameWith((picture_id + 7) % (1 << 15), (tl0_pic_idx + 3) % (1 << 8),
412 1); 433 1);
413 } 434 }
414 435
415 } // namespace webrtc 436 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/video_coding/codecs/vp9/test/vp9_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698