| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | |
| 72 TEST_F(TestVp9Impl, DecodedQpEqualsEncodedQp) { | 53 TEST_F(TestVp9Impl, DecodedQpEqualsEncodedQp) { |
| 73 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, | 54 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
| 74 encoder_->Encode(*input_frame_, nullptr, nullptr)); | 55 encoder_->Encode(*input_frame_, nullptr, nullptr)); |
| 75 EncodedImage encoded_frame; | 56 EncodedImage encoded_frame; |
| 76 ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame)); | 57 ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame)); |
| 77 // First frame should be a key frame. | 58 // First frame should be a key frame. |
| 78 encoded_frame._frameType = kVideoFrameKey; | 59 encoded_frame._frameType = kVideoFrameKey; |
| 79 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, | 60 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
| 80 decoder_->Decode(encoded_frame, false, nullptr)); | 61 decoder_->Decode(encoded_frame, false, nullptr)); |
| 81 std::unique_ptr<VideoFrame> decoded_frame; | 62 std::unique_ptr<VideoFrame> decoded_frame; |
| 82 rtc::Optional<uint8_t> decoded_qp; | 63 rtc::Optional<uint8_t> decoded_qp; |
| 83 ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp)); | 64 ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp)); |
| 84 ASSERT_TRUE(decoded_frame); | 65 ASSERT_TRUE(decoded_frame); |
| 85 ASSERT_TRUE(decoded_qp); | 66 ASSERT_TRUE(decoded_qp); |
| 86 EXPECT_EQ(encoded_frame.qp_, *decoded_qp); | 67 EXPECT_EQ(encoded_frame.qp_, *decoded_qp); |
| 87 } | 68 } |
| 88 | 69 |
| 89 } // namespace webrtc | 70 } // namespace webrtc |
| OLD | NEW |