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

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

Issue 2489843002: Revert of Extract bitrate allocation of spatial/temporal layers out of codec impl. (Closed)
Patch Set: Created 4 years, 1 month 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 kTemporalUpdateLastRefAltRef = 46 kTemporalUpdateLastRefAltRef =
47 VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_REF_GF, 47 VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_REF_GF,
48 kTemporalUpdateLastAndGoldenRefAltRef = 48 kTemporalUpdateLastAndGoldenRefAltRef =
49 VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_REF_GF, 49 VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_REF_GF,
50 }; 50 };
51 51
52 TEST(TemporalLayersTest, 2Layers) { 52 TEST(TemporalLayersTest, 2Layers) {
53 DefaultTemporalLayers tl(2, 0); 53 DefaultTemporalLayers tl(2, 0);
54 vpx_codec_enc_cfg_t cfg; 54 vpx_codec_enc_cfg_t cfg;
55 CodecSpecificInfoVP8 vp8_info; 55 CodecSpecificInfoVP8 vp8_info;
56 tl.OnRatesUpdated(500, 500, 30); 56 tl.ConfigureBitrates(500, 500, 30, &cfg);
57 tl.UpdateConfiguration(&cfg);
58 57
59 int expected_flags[16] = { 58 int expected_flags[16] = {
60 kTemporalUpdateLastAndGoldenRefAltRef, 59 kTemporalUpdateLastAndGoldenRefAltRef,
61 kTemporalUpdateGoldenWithoutDependencyRefAltRef, 60 kTemporalUpdateGoldenWithoutDependencyRefAltRef,
62 kTemporalUpdateLastRefAltRef, 61 kTemporalUpdateLastRefAltRef,
63 kTemporalUpdateGoldenRefAltRef, 62 kTemporalUpdateGoldenRefAltRef,
64 kTemporalUpdateLastRefAltRef, 63 kTemporalUpdateLastRefAltRef,
65 kTemporalUpdateGoldenRefAltRef, 64 kTemporalUpdateGoldenRefAltRef,
66 kTemporalUpdateLastRefAltRef, 65 kTemporalUpdateLastRefAltRef,
67 kTemporalUpdateNone, 66 kTemporalUpdateNone,
(...skipping 20 matching lines...) Expand all
88 EXPECT_EQ(expected_temporal_idx[i], vp8_info.temporalIdx); 87 EXPECT_EQ(expected_temporal_idx[i], vp8_info.temporalIdx);
89 EXPECT_EQ(expected_layer_sync[i], vp8_info.layerSync); 88 EXPECT_EQ(expected_layer_sync[i], vp8_info.layerSync);
90 timestamp += 3000; 89 timestamp += 3000;
91 } 90 }
92 } 91 }
93 92
94 TEST(TemporalLayersTest, 3Layers) { 93 TEST(TemporalLayersTest, 3Layers) {
95 DefaultTemporalLayers tl(3, 0); 94 DefaultTemporalLayers tl(3, 0);
96 vpx_codec_enc_cfg_t cfg; 95 vpx_codec_enc_cfg_t cfg;
97 CodecSpecificInfoVP8 vp8_info; 96 CodecSpecificInfoVP8 vp8_info;
98 tl.OnRatesUpdated(500, 500, 30); 97 tl.ConfigureBitrates(500, 500, 30, &cfg);
99 tl.UpdateConfiguration(&cfg);
100 98
101 int expected_flags[16] = { 99 int expected_flags[16] = {
102 kTemporalUpdateLastAndGoldenRefAltRef, 100 kTemporalUpdateLastAndGoldenRefAltRef,
103 kTemporalUpdateNoneNoRefGolden, 101 kTemporalUpdateNoneNoRefGolden,
104 kTemporalUpdateGoldenWithoutDependencyRefAltRef, 102 kTemporalUpdateGoldenWithoutDependencyRefAltRef,
105 kTemporalUpdateNone, 103 kTemporalUpdateNone,
106 kTemporalUpdateLastRefAltRef, 104 kTemporalUpdateLastRefAltRef,
107 kTemporalUpdateNone, 105 kTemporalUpdateNone,
108 kTemporalUpdateGoldenRefAltRef, 106 kTemporalUpdateGoldenRefAltRef,
109 kTemporalUpdateNone, 107 kTemporalUpdateNone,
(...skipping 20 matching lines...) Expand all
130 EXPECT_EQ(expected_temporal_idx[i], vp8_info.temporalIdx); 128 EXPECT_EQ(expected_temporal_idx[i], vp8_info.temporalIdx);
131 EXPECT_EQ(expected_layer_sync[i], vp8_info.layerSync); 129 EXPECT_EQ(expected_layer_sync[i], vp8_info.layerSync);
132 timestamp += 3000; 130 timestamp += 3000;
133 } 131 }
134 } 132 }
135 133
136 TEST(TemporalLayersTest, 4Layers) { 134 TEST(TemporalLayersTest, 4Layers) {
137 DefaultTemporalLayers tl(4, 0); 135 DefaultTemporalLayers tl(4, 0);
138 vpx_codec_enc_cfg_t cfg; 136 vpx_codec_enc_cfg_t cfg;
139 CodecSpecificInfoVP8 vp8_info; 137 CodecSpecificInfoVP8 vp8_info;
140 tl.OnRatesUpdated(500, 500, 30); 138 tl.ConfigureBitrates(500, 500, 30, &cfg);
141 tl.UpdateConfiguration(&cfg);
142 int expected_flags[16] = { 139 int expected_flags[16] = {
143 kTemporalUpdateLast, 140 kTemporalUpdateLast,
144 kTemporalUpdateNone, 141 kTemporalUpdateNone,
145 kTemporalUpdateAltrefWithoutDependency, 142 kTemporalUpdateAltrefWithoutDependency,
146 kTemporalUpdateNone, 143 kTemporalUpdateNone,
147 kTemporalUpdateGoldenWithoutDependency, 144 kTemporalUpdateGoldenWithoutDependency,
148 kTemporalUpdateNone, 145 kTemporalUpdateNone,
149 kTemporalUpdateAltref, 146 kTemporalUpdateAltref,
150 kTemporalUpdateNone, 147 kTemporalUpdateNone,
151 kTemporalUpdateLast, 148 kTemporalUpdateLast,
(...skipping 19 matching lines...) Expand all
171 EXPECT_EQ(expected_temporal_idx[i], vp8_info.temporalIdx); 168 EXPECT_EQ(expected_temporal_idx[i], vp8_info.temporalIdx);
172 EXPECT_EQ(expected_layer_sync[i], vp8_info.layerSync); 169 EXPECT_EQ(expected_layer_sync[i], vp8_info.layerSync);
173 timestamp += 3000; 170 timestamp += 3000;
174 } 171 }
175 } 172 }
176 173
177 TEST(TemporalLayersTest, KeyFrame) { 174 TEST(TemporalLayersTest, KeyFrame) {
178 DefaultTemporalLayers tl(3, 0); 175 DefaultTemporalLayers tl(3, 0);
179 vpx_codec_enc_cfg_t cfg; 176 vpx_codec_enc_cfg_t cfg;
180 CodecSpecificInfoVP8 vp8_info; 177 CodecSpecificInfoVP8 vp8_info;
181 tl.OnRatesUpdated(500, 500, 30); 178 tl.ConfigureBitrates(500, 500, 30, &cfg);
182 tl.UpdateConfiguration(&cfg);
183 179
184 int expected_flags[8] = { 180 int expected_flags[8] = {
185 kTemporalUpdateLastAndGoldenRefAltRef, 181 kTemporalUpdateLastAndGoldenRefAltRef,
186 kTemporalUpdateNoneNoRefGolden, 182 kTemporalUpdateNoneNoRefGolden,
187 kTemporalUpdateGoldenWithoutDependencyRefAltRef, 183 kTemporalUpdateGoldenWithoutDependencyRefAltRef,
188 kTemporalUpdateNone, 184 kTemporalUpdateNone,
189 kTemporalUpdateLastRefAltRef, 185 kTemporalUpdateLastRefAltRef,
190 kTemporalUpdateNone, 186 kTemporalUpdateNone,
191 kTemporalUpdateGoldenRefAltRef, 187 kTemporalUpdateGoldenRefAltRef,
192 kTemporalUpdateNone, 188 kTemporalUpdateNone,
193 }; 189 };
194 int expected_temporal_idx[8] = {0, 0, 0, 0, 0, 0, 0, 2}; 190 int expected_temporal_idx[8] = {0, 0, 0, 0, 0, 0, 0, 2};
195 191
196 uint32_t timestamp = 0; 192 uint32_t timestamp = 0;
197 for (int i = 0; i < 7; ++i) { 193 for (int i = 0; i < 7; ++i) {
198 EXPECT_EQ(expected_flags[i], tl.EncodeFlags(timestamp)); 194 EXPECT_EQ(expected_flags[i], tl.EncodeFlags(timestamp));
199 tl.PopulateCodecSpecific(true, &vp8_info, 0); 195 tl.PopulateCodecSpecific(true, &vp8_info, 0);
200 EXPECT_EQ(expected_temporal_idx[i], vp8_info.temporalIdx); 196 EXPECT_EQ(expected_temporal_idx[i], vp8_info.temporalIdx);
201 EXPECT_EQ(true, vp8_info.layerSync); 197 EXPECT_EQ(true, vp8_info.layerSync);
202 timestamp += 3000; 198 timestamp += 3000;
203 } 199 }
204 EXPECT_EQ(expected_flags[7], tl.EncodeFlags(timestamp)); 200 EXPECT_EQ(expected_flags[7], tl.EncodeFlags(timestamp));
205 tl.PopulateCodecSpecific(false, &vp8_info, 0); 201 tl.PopulateCodecSpecific(false, &vp8_info, 0);
206 EXPECT_EQ(expected_temporal_idx[7], vp8_info.temporalIdx); 202 EXPECT_EQ(expected_temporal_idx[7], vp8_info.temporalIdx);
207 EXPECT_EQ(true, vp8_info.layerSync); 203 EXPECT_EQ(true, vp8_info.layerSync);
208 } 204 }
209 } // namespace webrtc 205 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698