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

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

Issue 2853073004: Derive current layer from TL frame config. (Closed)
Patch Set: rebase Created 3 years, 7 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) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 }; 77 };
78 int expected_temporal_idx[16] = {0, 1, 0, 1, 0, 1, 0, 1, 78 int expected_temporal_idx[16] = {0, 1, 0, 1, 0, 1, 0, 1,
79 0, 1, 0, 1, 0, 1, 0, 1}; 79 0, 1, 0, 1, 0, 1, 0, 1};
80 80
81 bool expected_layer_sync[16] = {false, true, false, false, false, false, 81 bool expected_layer_sync[16] = {false, true, false, false, false, false,
82 false, false, false, true, false, false, 82 false, false, false, true, false, false,
83 false, false, false, false}; 83 false, false, false, false};
84 84
85 uint32_t timestamp = 0; 85 uint32_t timestamp = 0;
86 for (int i = 0; i < 16; ++i) { 86 for (int i = 0; i < 16; ++i) {
87 TemporalReferences tl_config = tl.UpdateLayerConfig(timestamp); 87 TemporalLayers::FrameConfig tl_config = tl.UpdateLayerConfig(timestamp);
88 EXPECT_EQ(expected_flags[i], VP8EncoderImpl::EncodeFlags(tl_config)); 88 EXPECT_EQ(expected_flags[i], VP8EncoderImpl::EncodeFlags(tl_config));
89 tl.PopulateCodecSpecific(false, &vp8_info, 0); 89 tl.PopulateCodecSpecific(false, tl_config, &vp8_info, 0);
90 EXPECT_EQ(expected_temporal_idx[i], vp8_info.temporalIdx); 90 EXPECT_EQ(expected_temporal_idx[i], vp8_info.temporalIdx);
91 EXPECT_EQ(expected_layer_sync[i], vp8_info.layerSync); 91 EXPECT_EQ(expected_layer_sync[i], vp8_info.layerSync);
92 timestamp += 3000; 92 timestamp += 3000;
93 } 93 }
94 } 94 }
95 95
96 TEST(TemporalLayersTest, 3Layers) { 96 TEST(TemporalLayersTest, 3Layers) {
97 DefaultTemporalLayers tl(3, 0); 97 DefaultTemporalLayers tl(3, 0);
98 vpx_codec_enc_cfg_t cfg; 98 vpx_codec_enc_cfg_t cfg;
99 CodecSpecificInfoVP8 vp8_info; 99 CodecSpecificInfoVP8 vp8_info;
(...skipping 20 matching lines...) Expand all
120 }; 120 };
121 int expected_temporal_idx[16] = {0, 2, 1, 2, 0, 2, 1, 2, 121 int expected_temporal_idx[16] = {0, 2, 1, 2, 0, 2, 1, 2,
122 0, 2, 1, 2, 0, 2, 1, 2}; 122 0, 2, 1, 2, 0, 2, 1, 2};
123 123
124 bool expected_layer_sync[16] = {false, true, true, false, false, false, 124 bool expected_layer_sync[16] = {false, true, true, false, false, false,
125 false, false, false, true, true, false, 125 false, false, false, true, true, false,
126 false, false, false, false}; 126 false, false, false, false};
127 127
128 unsigned int timestamp = 0; 128 unsigned int timestamp = 0;
129 for (int i = 0; i < 16; ++i) { 129 for (int i = 0; i < 16; ++i) {
130 TemporalReferences tl_config = tl.UpdateLayerConfig(timestamp); 130 TemporalLayers::FrameConfig tl_config = tl.UpdateLayerConfig(timestamp);
131 EXPECT_EQ(expected_flags[i], VP8EncoderImpl::EncodeFlags(tl_config)); 131 EXPECT_EQ(expected_flags[i], VP8EncoderImpl::EncodeFlags(tl_config));
132 tl.PopulateCodecSpecific(false, &vp8_info, 0); 132 tl.PopulateCodecSpecific(false, tl_config, &vp8_info, 0);
133 EXPECT_EQ(expected_temporal_idx[i], vp8_info.temporalIdx); 133 EXPECT_EQ(expected_temporal_idx[i], vp8_info.temporalIdx);
134 EXPECT_EQ(expected_layer_sync[i], vp8_info.layerSync); 134 EXPECT_EQ(expected_layer_sync[i], vp8_info.layerSync);
135 timestamp += 3000; 135 timestamp += 3000;
136 } 136 }
137 } 137 }
138 138
139 TEST(TemporalLayersTest, 4Layers) { 139 TEST(TemporalLayersTest, 4Layers) {
140 DefaultTemporalLayers tl(4, 0); 140 DefaultTemporalLayers tl(4, 0);
141 vpx_codec_enc_cfg_t cfg; 141 vpx_codec_enc_cfg_t cfg;
142 CodecSpecificInfoVP8 vp8_info; 142 CodecSpecificInfoVP8 vp8_info;
(...skipping 19 matching lines...) Expand all
162 }; 162 };
163 int expected_temporal_idx[16] = {0, 3, 2, 3, 1, 3, 2, 3, 163 int expected_temporal_idx[16] = {0, 3, 2, 3, 1, 3, 2, 3,
164 0, 3, 2, 3, 1, 3, 2, 3}; 164 0, 3, 2, 3, 1, 3, 2, 3};
165 165
166 bool expected_layer_sync[16] = {false, true, true, true, true, true, 166 bool expected_layer_sync[16] = {false, true, true, true, true, true,
167 false, true, false, true, false, true, 167 false, true, false, true, false, true,
168 false, true, false, true}; 168 false, true, false, true};
169 169
170 uint32_t timestamp = 0; 170 uint32_t timestamp = 0;
171 for (int i = 0; i < 16; ++i) { 171 for (int i = 0; i < 16; ++i) {
172 TemporalReferences tl_config = tl.UpdateLayerConfig(timestamp); 172 TemporalLayers::FrameConfig tl_config = tl.UpdateLayerConfig(timestamp);
173 EXPECT_EQ(expected_flags[i], VP8EncoderImpl::EncodeFlags(tl_config)); 173 EXPECT_EQ(expected_flags[i], VP8EncoderImpl::EncodeFlags(tl_config));
174 tl.PopulateCodecSpecific(false, &vp8_info, 0); 174 tl.PopulateCodecSpecific(false, tl_config, &vp8_info, 0);
175 EXPECT_EQ(expected_temporal_idx[i], vp8_info.temporalIdx); 175 EXPECT_EQ(expected_temporal_idx[i], vp8_info.temporalIdx);
176 EXPECT_EQ(expected_layer_sync[i], vp8_info.layerSync); 176 EXPECT_EQ(expected_layer_sync[i], vp8_info.layerSync);
177 timestamp += 3000; 177 timestamp += 3000;
178 } 178 }
179 } 179 }
180 180
181 TEST(TemporalLayersTest, KeyFrame) { 181 TEST(TemporalLayersTest, KeyFrame) {
182 DefaultTemporalLayers tl(3, 0); 182 DefaultTemporalLayers tl(3, 0);
183 vpx_codec_enc_cfg_t cfg; 183 vpx_codec_enc_cfg_t cfg;
184 CodecSpecificInfoVP8 vp8_info; 184 CodecSpecificInfoVP8 vp8_info;
185 tl.OnRatesUpdated(500, 500, 30); 185 tl.OnRatesUpdated(500, 500, 30);
186 tl.UpdateConfiguration(&cfg); 186 tl.UpdateConfiguration(&cfg);
187 187
188 int expected_flags[8] = { 188 int expected_flags[8] = {
189 kTemporalUpdateLastAndGoldenRefAltRef, 189 kTemporalUpdateLastAndGoldenRefAltRef,
190 kTemporalUpdateNoneNoRefGolden, 190 kTemporalUpdateNoneNoRefGolden,
191 kTemporalUpdateGoldenWithoutDependencyRefAltRef, 191 kTemporalUpdateGoldenWithoutDependencyRefAltRef,
192 kTemporalUpdateNone, 192 kTemporalUpdateNone,
193 kTemporalUpdateLastRefAltRef, 193 kTemporalUpdateLastRefAltRef,
194 kTemporalUpdateNone, 194 kTemporalUpdateNone,
195 kTemporalUpdateGoldenRefAltRef, 195 kTemporalUpdateGoldenRefAltRef,
196 kTemporalUpdateNone, 196 kTemporalUpdateNone,
197 }; 197 };
198 int expected_temporal_idx[8] = {0, 0, 0, 0, 0, 0, 0, 2}; 198 int expected_temporal_idx[8] = {0, 0, 0, 0, 0, 0, 0, 2};
199 199
200 uint32_t timestamp = 0; 200 uint32_t timestamp = 0;
201 for (int i = 0; i < 7; ++i) { 201 for (int i = 0; i < 7; ++i) {
202 TemporalReferences tl_config = tl.UpdateLayerConfig(timestamp); 202 TemporalLayers::FrameConfig tl_config = tl.UpdateLayerConfig(timestamp);
203 EXPECT_EQ(expected_flags[i], VP8EncoderImpl::EncodeFlags(tl_config)); 203 EXPECT_EQ(expected_flags[i], VP8EncoderImpl::EncodeFlags(tl_config));
204 tl.PopulateCodecSpecific(true, &vp8_info, 0); 204 tl.PopulateCodecSpecific(true, tl_config, &vp8_info, 0);
205 EXPECT_EQ(expected_temporal_idx[i], vp8_info.temporalIdx); 205 EXPECT_EQ(expected_temporal_idx[i], vp8_info.temporalIdx);
206 EXPECT_EQ(true, vp8_info.layerSync); 206 EXPECT_EQ(true, vp8_info.layerSync);
207 timestamp += 3000; 207 timestamp += 3000;
208 } 208 }
209 TemporalReferences tl_config = tl.UpdateLayerConfig(timestamp); 209 TemporalLayers::FrameConfig tl_config = tl.UpdateLayerConfig(timestamp);
210 EXPECT_EQ(expected_flags[7], VP8EncoderImpl::EncodeFlags(tl_config)); 210 EXPECT_EQ(expected_flags[7], VP8EncoderImpl::EncodeFlags(tl_config));
211 tl.PopulateCodecSpecific(false, &vp8_info, 0); 211 tl.PopulateCodecSpecific(false, tl_config, &vp8_info, 0);
212 EXPECT_EQ(expected_temporal_idx[7], vp8_info.temporalIdx); 212 EXPECT_EQ(expected_temporal_idx[7], vp8_info.temporalIdx);
213 EXPECT_EQ(true, vp8_info.layerSync); 213 EXPECT_EQ(true, vp8_info.layerSync);
214 } 214 }
215 } // namespace webrtc 215 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698