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

Side by Side Diff: webrtc/modules/video_coding/codecs/vp9/test/vp9_impl_unittest.cc

Issue 2853463004: Don't reinit encoder when rotation changes. (Closed)
Patch Set: Add trivial unit tests. 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2017 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 encoded_frame._frameType = kVideoFrameKey; 43 encoded_frame._frameType = kVideoFrameKey;
44 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, 44 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
45 decoder_->Decode(encoded_frame, false, nullptr)); 45 decoder_->Decode(encoded_frame, false, nullptr));
46 std::unique_ptr<VideoFrame> decoded_frame; 46 std::unique_ptr<VideoFrame> decoded_frame;
47 rtc::Optional<uint8_t> decoded_qp; 47 rtc::Optional<uint8_t> decoded_qp;
48 ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp)); 48 ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp));
49 ASSERT_TRUE(decoded_frame); 49 ASSERT_TRUE(decoded_frame);
50 EXPECT_GT(I420PSNR(input_frame_.get(), decoded_frame.get()), 36); 50 EXPECT_GT(I420PSNR(input_frame_.get(), decoded_frame.get()), 36);
51 } 51 }
52 52
53 // We only test the encoder here, since the decoded frame rotation is set based
54 // on the CVO RTP header extension in VCMDecodedFrameCallback::Decoded.
55 // TODO(brandtr): Consider passing through the rotation flag through the decoder
56 // in the same way as done in the encoder.
57 TEST_F(TestVp9Impl, EncodedRotationEqualsInputRotation) {
58 input_frame_->set_rotation(kVideoRotation_0);
59 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
60 encoder_->Encode(*input_frame_, nullptr, nullptr));
61 EncodedImage encoded_frame;
62 ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame));
63 EXPECT_EQ(kVideoRotation_0, encoded_frame.rotation_);
64
65 input_frame_->set_rotation(kVideoRotation_90);
66 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
67 encoder_->Encode(*input_frame_, nullptr, nullptr));
68 ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame));
69 EXPECT_EQ(kVideoRotation_90, encoded_frame.rotation_);
70 }
71
53 TEST_F(TestVp9Impl, DecodedQpEqualsEncodedQp) { 72 TEST_F(TestVp9Impl, DecodedQpEqualsEncodedQp) {
54 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, 73 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
55 encoder_->Encode(*input_frame_, nullptr, nullptr)); 74 encoder_->Encode(*input_frame_, nullptr, nullptr));
56 EncodedImage encoded_frame; 75 EncodedImage encoded_frame;
57 ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame)); 76 ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame));
58 // First frame should be a key frame. 77 // First frame should be a key frame.
59 encoded_frame._frameType = kVideoFrameKey; 78 encoded_frame._frameType = kVideoFrameKey;
60 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, 79 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
61 decoder_->Decode(encoded_frame, false, nullptr)); 80 decoder_->Decode(encoded_frame, false, nullptr));
62 std::unique_ptr<VideoFrame> decoded_frame; 81 std::unique_ptr<VideoFrame> decoded_frame;
63 rtc::Optional<uint8_t> decoded_qp; 82 rtc::Optional<uint8_t> decoded_qp;
64 ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp)); 83 ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp));
65 ASSERT_TRUE(decoded_frame); 84 ASSERT_TRUE(decoded_frame);
66 ASSERT_TRUE(decoded_qp); 85 ASSERT_TRUE(decoded_qp);
67 EXPECT_EQ(encoded_frame.qp_, *decoded_qp); 86 EXPECT_EQ(encoded_frame.qp_, *decoded_qp);
68 } 87 }
69 88
70 } // namespace webrtc 89 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc ('k') | webrtc/video/vie_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698