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

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

Issue 2903163002: Add unit tests for qp parser. (Closed)
Patch Set: Refactor. Created 3 years, 6 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
« no previous file with comments | « webrtc/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, 97 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
98 decoder_->Decode(encoded_frame, false, nullptr)); 98 decoder_->Decode(encoded_frame, false, nullptr));
99 std::unique_ptr<VideoFrame> decoded_frame; 99 std::unique_ptr<VideoFrame> decoded_frame;
100 rtc::Optional<uint8_t> decoded_qp; 100 rtc::Optional<uint8_t> decoded_qp;
101 ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp)); 101 ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp));
102 ASSERT_TRUE(decoded_frame); 102 ASSERT_TRUE(decoded_frame);
103 ASSERT_TRUE(decoded_qp); 103 ASSERT_TRUE(decoded_qp);
104 EXPECT_EQ(encoded_frame.qp_, *decoded_qp); 104 EXPECT_EQ(encoded_frame.qp_, *decoded_qp);
105 } 105 }
106 106
107 TEST_F(TestVp9Impl, ParserQpEqualsEncodedQp) {
108 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
109 encoder_->Encode(*input_frame_, nullptr, nullptr));
110 EncodedImage encoded_frame;
111 CodecSpecificInfo codec_specific_info;
112 ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_specific_info));
113
114 int qp = 0;
115 ASSERT_TRUE(vp9::GetQp(encoded_frame._buffer, encoded_frame._length, &qp));
116
117 EXPECT_EQ(encoded_frame.qp_, qp);
118 }
119
107 TEST_F(TestVp9Impl, EncoderRetainsRtpStateAfterRelease) { 120 TEST_F(TestVp9Impl, EncoderRetainsRtpStateAfterRelease) {
108 // Override default settings. 121 // Override default settings.
109 codec_settings_.VP9()->numberOfTemporalLayers = 2; 122 codec_settings_.VP9()->numberOfTemporalLayers = 2;
110 // Tl0PidIdx is only used in non-flexible mode. 123 // Tl0PidIdx is only used in non-flexible mode.
111 codec_settings_.VP9()->flexibleMode = false; 124 codec_settings_.VP9()->flexibleMode = false;
112 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, 125 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
113 encoder_->InitEncode(&codec_settings_, 1 /* number of cores */, 126 encoder_->InitEncode(&codec_settings_, 1 /* number of cores */,
114 0 /* max payload size (unused) */)); 127 0 /* max payload size (unused) */));
115 128
116 // Temporal layer 0. 129 // Temporal layer 0.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // Temporal layer 1. 192 // Temporal layer 1.
180 input_frame_->set_timestamp(input_frame_->timestamp() + 193 input_frame_->set_timestamp(input_frame_->timestamp() +
181 kTimestampIncrementPerFrame); 194 kTimestampIncrementPerFrame);
182 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, 195 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
183 encoder_->Encode(*input_frame_, nullptr, nullptr)); 196 encoder_->Encode(*input_frame_, nullptr, nullptr));
184 ExpectFrameWith((picture_id + 7) % (1 << 15), (tl0_pic_idx + 3) % (1 << 8), 197 ExpectFrameWith((picture_id + 7) % (1 << 15), (tl0_pic_idx + 3) % (1 << 8),
185 1); 198 1);
186 } 199 }
187 200
188 } // namespace webrtc 201 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698