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

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

Issue 2656603002: Add QP for libvpx VP8 decoder. (Closed)
Patch Set: Fix more tests. Created 3 years, 10 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) 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 encode_complete_ = false; 85 encode_complete_ = false;
86 return true; 86 return true;
87 } 87 }
88 return false; 88 return false;
89 } 89 }
90 90
91 class Vp8UnitTestDecodeCompleteCallback : public webrtc::DecodedImageCallback { 91 class Vp8UnitTestDecodeCompleteCallback : public webrtc::DecodedImageCallback {
92 public: 92 public:
93 explicit Vp8UnitTestDecodeCompleteCallback(rtc::Optional<VideoFrame>* frame) 93 explicit Vp8UnitTestDecodeCompleteCallback(rtc::Optional<VideoFrame>* frame)
94 : decoded_frame_(frame), decode_complete(false) {} 94 : decoded_frame_(frame), decode_complete(false) {}
95 int32_t Decoded(VideoFrame& frame) override; 95 int32_t Decoded(VideoFrame& frame) override {
96 RTC_NOTREACHED();
97 return -1;
98 }
96 int32_t Decoded(VideoFrame& frame, int64_t decode_time_ms) override { 99 int32_t Decoded(VideoFrame& frame, int64_t decode_time_ms) override {
97 RTC_NOTREACHED(); 100 RTC_NOTREACHED();
98 return -1; 101 return -1;
99 } 102 }
100 void Decoded(VideoFrame& frame, 103 void Decoded(VideoFrame& frame,
101 rtc::Optional<int32_t> decode_time_ms, 104 rtc::Optional<int32_t> decode_time_ms,
102 rtc::Optional<uint8_t> qp) override { 105 rtc::Optional<uint8_t> qp) override;
103 RTC_NOTREACHED();
104 }
105 bool DecodeComplete(); 106 bool DecodeComplete();
106 107
107 private: 108 private:
108 rtc::Optional<VideoFrame>* decoded_frame_; 109 rtc::Optional<VideoFrame>* decoded_frame_;
109 bool decode_complete; 110 bool decode_complete;
110 }; 111 };
111 112
112 bool Vp8UnitTestDecodeCompleteCallback::DecodeComplete() { 113 bool Vp8UnitTestDecodeCompleteCallback::DecodeComplete() {
113 if (decode_complete) { 114 if (decode_complete) {
114 decode_complete = false; 115 decode_complete = false;
115 return true; 116 return true;
116 } 117 }
117 return false; 118 return false;
118 } 119 }
119 120
120 int Vp8UnitTestDecodeCompleteCallback::Decoded(VideoFrame& image) { 121 void Vp8UnitTestDecodeCompleteCallback::Decoded(
121 *decoded_frame_ = rtc::Optional<VideoFrame>(image); 122 VideoFrame& frame,
123 rtc::Optional<int32_t> decode_time_ms,
124 rtc::Optional<uint8_t> qp) {
125 *decoded_frame_ = rtc::Optional<VideoFrame>(frame);
122 decode_complete = true; 126 decode_complete = true;
123 return 0;
124 } 127 }
125 128
126 class TestVp8Impl : public ::testing::Test { 129 class TestVp8Impl : public ::testing::Test {
127 protected: 130 protected:
128 virtual void SetUp() { 131 virtual void SetUp() {
129 encoder_.reset(VP8Encoder::Create()); 132 encoder_.reset(VP8Encoder::Create());
130 decoder_.reset(VP8Decoder::Create()); 133 decoder_.reset(VP8Decoder::Create());
131 memset(&codec_inst_, 0, sizeof(codec_inst_)); 134 memset(&codec_inst_, 0, sizeof(codec_inst_));
132 encode_complete_callback_.reset( 135 encode_complete_callback_.reset(
133 new Vp8UnitTestEncodeCompleteCallback(&encoded_frame_, 0, NULL)); 136 new Vp8UnitTestEncodeCompleteCallback(&encoded_frame_, 0, NULL));
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 decoder_->Decode(encoded_frame_, false, NULL)); 289 decoder_->Decode(encoded_frame_, false, NULL));
287 // Now setting a key frame. 290 // Now setting a key frame.
288 encoded_frame_._frameType = kVideoFrameKey; 291 encoded_frame_._frameType = kVideoFrameKey;
289 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, 292 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
290 decoder_->Decode(encoded_frame_, false, NULL)); 293 decoder_->Decode(encoded_frame_, false, NULL));
291 ASSERT_TRUE(decoded_frame_); 294 ASSERT_TRUE(decoded_frame_);
292 EXPECT_GT(I420PSNR(input_frame_.get(), &*decoded_frame_), 36); 295 EXPECT_GT(I420PSNR(input_frame_.get(), &*decoded_frame_), 36);
293 } 296 }
294 297
295 } // namespace webrtc 298 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698