OLD | NEW |
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 encoded_frame._frameType = kVideoFrameKey; | 59 encoded_frame._frameType = kVideoFrameKey; |
60 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, | 60 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
61 decoder_->Decode(encoded_frame, false, nullptr)); | 61 decoder_->Decode(encoded_frame, false, nullptr)); |
62 std::unique_ptr<VideoFrame> decoded_frame; | 62 std::unique_ptr<VideoFrame> decoded_frame; |
63 rtc::Optional<uint8_t> decoded_qp; | 63 rtc::Optional<uint8_t> decoded_qp; |
64 ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp)); | 64 ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp)); |
65 ASSERT_TRUE(decoded_frame); | 65 ASSERT_TRUE(decoded_frame); |
66 EXPECT_GT(I420PSNR(input_frame_.get(), decoded_frame.get()), 36); | 66 EXPECT_GT(I420PSNR(input_frame_.get(), decoded_frame.get()), 36); |
67 } | 67 } |
68 | 68 |
| 69 // We only test the encoder here, since the decoded frame rotation is set based |
| 70 // on the CVO RTP header extension in VCMDecodedFrameCallback::Decoded. |
| 71 // TODO(brandtr): Consider passing through the rotation flag through the decoder |
| 72 // in the same way as done in the encoder. |
| 73 TEST_F(TestVp9Impl, EncodedRotationEqualsInputRotation) { |
| 74 input_frame_->set_rotation(kVideoRotation_0); |
| 75 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
| 76 encoder_->Encode(*input_frame_, nullptr, nullptr)); |
| 77 EncodedImage encoded_frame; |
| 78 CodecSpecificInfo codec_specific_info; |
| 79 ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_specific_info)); |
| 80 EXPECT_EQ(kVideoRotation_0, encoded_frame.rotation_); |
| 81 |
| 82 input_frame_->set_rotation(kVideoRotation_90); |
| 83 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
| 84 encoder_->Encode(*input_frame_, nullptr, nullptr)); |
| 85 ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_specific_info)); |
| 86 EXPECT_EQ(kVideoRotation_90, encoded_frame.rotation_); |
| 87 } |
| 88 |
69 TEST_F(TestVp9Impl, DecodedQpEqualsEncodedQp) { | 89 TEST_F(TestVp9Impl, DecodedQpEqualsEncodedQp) { |
70 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, | 90 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
71 encoder_->Encode(*input_frame_, nullptr, nullptr)); | 91 encoder_->Encode(*input_frame_, nullptr, nullptr)); |
72 EncodedImage encoded_frame; | 92 EncodedImage encoded_frame; |
73 CodecSpecificInfo codec_specific_info; | 93 CodecSpecificInfo codec_specific_info; |
74 ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_specific_info)); | 94 ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_specific_info)); |
75 // First frame should be a key frame. | 95 // First frame should be a key frame. |
76 encoded_frame._frameType = kVideoFrameKey; | 96 encoded_frame._frameType = kVideoFrameKey; |
77 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, | 97 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
78 decoder_->Decode(encoded_frame, false, nullptr)); | 98 decoder_->Decode(encoded_frame, false, nullptr)); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // Temporal layer 1. | 179 // Temporal layer 1. |
160 input_frame_->set_timestamp(input_frame_->timestamp() + | 180 input_frame_->set_timestamp(input_frame_->timestamp() + |
161 kTimestampIncrementPerFrame); | 181 kTimestampIncrementPerFrame); |
162 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, | 182 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
163 encoder_->Encode(*input_frame_, nullptr, nullptr)); | 183 encoder_->Encode(*input_frame_, nullptr, nullptr)); |
164 ExpectFrameWith((picture_id + 7) % (1 << 15), (tl0_pic_idx + 3) % (1 << 8), | 184 ExpectFrameWith((picture_id + 7) % (1 << 15), (tl0_pic_idx + 3) % (1 << 8), |
165 1); | 185 1); |
166 } | 186 } |
167 | 187 |
168 } // namespace webrtc | 188 } // namespace webrtc |
OLD | NEW |