| OLD | NEW |
| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 encoded_frame_->_buffer = frame_buffer_.get(); | 69 encoded_frame_->_buffer = frame_buffer_.get(); |
| 70 encoded_frame_->_size = encoded_frame._length; | 70 encoded_frame_->_size = encoded_frame._length; |
| 71 } | 71 } |
| 72 memcpy(encoded_frame_->_buffer, encoded_frame._buffer, encoded_frame._length); | 72 memcpy(encoded_frame_->_buffer, encoded_frame._buffer, encoded_frame._length); |
| 73 encoded_frame_->_length = encoded_frame._length; | 73 encoded_frame_->_length = encoded_frame._length; |
| 74 encoded_frame_->_encodedWidth = encoded_frame._encodedWidth; | 74 encoded_frame_->_encodedWidth = encoded_frame._encodedWidth; |
| 75 encoded_frame_->_encodedHeight = encoded_frame._encodedHeight; | 75 encoded_frame_->_encodedHeight = encoded_frame._encodedHeight; |
| 76 encoded_frame_->_timeStamp = encoded_frame._timeStamp; | 76 encoded_frame_->_timeStamp = encoded_frame._timeStamp; |
| 77 encoded_frame_->_frameType = encoded_frame._frameType; | 77 encoded_frame_->_frameType = encoded_frame._frameType; |
| 78 encoded_frame_->_completeFrame = encoded_frame._completeFrame; | 78 encoded_frame_->_completeFrame = encoded_frame._completeFrame; |
| 79 encoded_frame_->rotation_ = encoded_frame.rotation_; | |
| 80 encoded_frame_->qp_ = encoded_frame.qp_; | 79 encoded_frame_->qp_ = encoded_frame.qp_; |
| 81 encode_complete_ = true; | 80 encode_complete_ = true; |
| 82 return Result(Result::OK, 0); | 81 return Result(Result::OK, 0); |
| 83 } | 82 } |
| 84 | 83 |
| 85 bool Vp8UnitTestEncodeCompleteCallback::EncodeComplete() { | 84 bool Vp8UnitTestEncodeCompleteCallback::EncodeComplete() { |
| 86 if (encode_complete_) { | 85 if (encode_complete_) { |
| 87 encode_complete_ = false; | 86 encode_complete_ = false; |
| 88 return true; | 87 return true; |
| 89 } | 88 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 codec_inst_.maxFramerate)); | 245 codec_inst_.maxFramerate)); |
| 247 | 246 |
| 248 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->InitEncode(&codec_inst_, 1, 1440)); | 247 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->InitEncode(&codec_inst_, 1, 1440)); |
| 249 | 248 |
| 250 // Decoder parameter tests. | 249 // Decoder parameter tests. |
| 251 // Calls before InitDecode(). | 250 // Calls before InitDecode(). |
| 252 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->Release()); | 251 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->Release()); |
| 253 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->InitDecode(&codec_inst_, 1)); | 252 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->InitDecode(&codec_inst_, 1)); |
| 254 } | 253 } |
| 255 | 254 |
| 256 // We only test the encoder here, since the decoded frame rotation is set based | |
| 257 // on the CVO RTP header extension in VCMDecodedFrameCallback::Decoded. | |
| 258 // TODO(brandtr): Consider passing through the rotation flag through the decoder | |
| 259 // in the same way as done in the encoder. | |
| 260 TEST_F(TestVp8Impl, EncodedRotationEqualsInputRotation) { | |
| 261 SetUpEncodeDecode(); | |
| 262 | |
| 263 input_frame_->set_rotation(kVideoRotation_0); | |
| 264 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, | |
| 265 encoder_->Encode(*input_frame_, nullptr, nullptr)); | |
| 266 WaitForEncodedFrame(); | |
| 267 EXPECT_EQ(kVideoRotation_0, encoded_frame_.rotation_); | |
| 268 | |
| 269 input_frame_->set_rotation(kVideoRotation_90); | |
| 270 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, | |
| 271 encoder_->Encode(*input_frame_, nullptr, nullptr)); | |
| 272 WaitForEncodedFrame(); | |
| 273 EXPECT_EQ(kVideoRotation_90, encoded_frame_.rotation_); | |
| 274 } | |
| 275 | |
| 276 TEST_F(TestVp8Impl, DecodedQpEqualsEncodedQp) { | 255 TEST_F(TestVp8Impl, DecodedQpEqualsEncodedQp) { |
| 277 SetUpEncodeDecode(); | 256 SetUpEncodeDecode(); |
| 278 encoder_->Encode(*input_frame_, nullptr, nullptr); | 257 encoder_->Encode(*input_frame_, nullptr, nullptr); |
| 279 EXPECT_GT(WaitForEncodedFrame(), 0u); | 258 EXPECT_GT(WaitForEncodedFrame(), 0u); |
| 280 // First frame should be a key frame. | 259 // First frame should be a key frame. |
| 281 encoded_frame_._frameType = kVideoFrameKey; | 260 encoded_frame_._frameType = kVideoFrameKey; |
| 282 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, | 261 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
| 283 decoder_->Decode(encoded_frame_, false, nullptr)); | 262 decoder_->Decode(encoded_frame_, false, nullptr)); |
| 284 EXPECT_GT(WaitForDecodedFrame(), 0u); | 263 EXPECT_GT(WaitForDecodedFrame(), 0u); |
| 285 ASSERT_TRUE(decoded_frame_); | 264 ASSERT_TRUE(decoded_frame_); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 decoder_->Decode(encoded_frame_, false, NULL)); | 309 decoder_->Decode(encoded_frame_, false, NULL)); |
| 331 // Now setting a key frame. | 310 // Now setting a key frame. |
| 332 encoded_frame_._frameType = kVideoFrameKey; | 311 encoded_frame_._frameType = kVideoFrameKey; |
| 333 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, | 312 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
| 334 decoder_->Decode(encoded_frame_, false, NULL)); | 313 decoder_->Decode(encoded_frame_, false, NULL)); |
| 335 ASSERT_TRUE(decoded_frame_); | 314 ASSERT_TRUE(decoded_frame_); |
| 336 EXPECT_GT(I420PSNR(input_frame_.get(), &*decoded_frame_), 36); | 315 EXPECT_GT(I420PSNR(input_frame_.get(), &*decoded_frame_), 36); |
| 337 } | 316 } |
| 338 | 317 |
| 339 } // namespace webrtc | 318 } // namespace webrtc |
| OLD | NEW |