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