Set the new layer sync bit in the VP8 info struct.

Review URL: http://webrtc-codereview.appspot.com/324010

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1185 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pwestin@webrtc.org 2011-12-14 15:13:04 +00:00
parent 667eca6290
commit 9fe3d51372
2 changed files with 32 additions and 0 deletions

View File

@ -194,6 +194,18 @@ void TemporalLayers::PopulateCodecSpecific(bool key_frame,
} else {
vp8_info->temporalIdx = temporal_ids_[pattern_idx_ % temporal_ids_length_];
}
TemporalReferences temporal_reference =
temporal_pattern_[pattern_idx_ % temporal_pattern_length_];
if (temporal_reference == kTemporalUpdateAltrefWithoutDependency ||
temporal_reference == kTemporalUpdateGoldenWithoutDependency ||
(temporal_reference == kTemporalUpdateNone &&
number_of_temporal_layers_ == 4)) {
vp8_info->layerSync = true;
} else {
vp8_info->layerSync = false;
}
if (vp8_info->temporalIdx == 0) {
tl0_pic_idx_++;
}

View File

@ -67,10 +67,15 @@ TEST(TemporalLayersTest, 2Layers) {
int expected_temporal_idx[16] =
{ 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 };
bool expected_layer_sync[16] =
{ false, true, false, false, false, false, false, false,
false, true, false, false, false, false, false, false };
for (int i = 0; i < 16; ++i) {
EXPECT_EQ(expected_flags[i], tl.EncodeFlags());
tl.PopulateCodecSpecific(false, &vp8_info);
EXPECT_EQ(expected_temporal_idx[i], vp8_info.temporalIdx);
EXPECT_EQ(expected_layer_sync[i], vp8_info.layerSync);
}
}
@ -100,10 +105,15 @@ TEST(TemporalLayersTest, 3Layers) {
int expected_temporal_idx[16] =
{ 0, 2, 1, 2, 0, 2, 1, 2, 0, 2, 1, 2, 0, 2, 1, 2 };
bool expected_layer_sync[16] =
{ false, true, true, false, false, false, false, false,
false, true, true, false, false, false, false, false };
for (int i = 0; i < 16; ++i) {
EXPECT_EQ(expected_flags[i], tl.EncodeFlags());
tl.PopulateCodecSpecific(false, &vp8_info);
EXPECT_EQ(expected_temporal_idx[i], vp8_info.temporalIdx);
EXPECT_EQ(expected_layer_sync[i], vp8_info.layerSync);
}
}
@ -133,10 +143,15 @@ TEST(TemporalLayersTest, 4Layers) {
int expected_temporal_idx[16] =
{ 0, 3, 2, 3, 1, 3, 2, 3, 0, 3, 2, 3, 1, 3, 2, 3 };
bool expected_layer_sync[16] =
{ false, true, true, true, true, true, false, true,
false, true, false, true, false, true, false, true };
for (int i = 0; i < 16; ++i) {
EXPECT_EQ(expected_flags[i], tl.EncodeFlags());
tl.PopulateCodecSpecific(false, &vp8_info);
EXPECT_EQ(expected_temporal_idx[i], vp8_info.temporalIdx);
EXPECT_EQ(expected_layer_sync[i], vp8_info.layerSync);
}
}
@ -159,13 +174,18 @@ TEST(TemporalLayersTest, KeyFrame) {
int expected_temporal_idx[8] =
{ 0, 0, 0, 0, 0, 0, 0, 2};
bool expected_layer_sync[8] =
{ false, true, true, false, false, false, false, false };
for (int i = 0; i < 7; ++i) {
EXPECT_EQ(expected_flags[i], tl.EncodeFlags());
tl.PopulateCodecSpecific(true, &vp8_info);
EXPECT_EQ(expected_temporal_idx[i], vp8_info.temporalIdx);
EXPECT_EQ(expected_layer_sync[i], vp8_info.layerSync);
}
EXPECT_EQ(expected_flags[7], tl.EncodeFlags());
tl.PopulateCodecSpecific(false, &vp8_info);
EXPECT_EQ(expected_temporal_idx[7], vp8_info.temporalIdx);
EXPECT_EQ(expected_layer_sync[7], vp8_info.layerSync);
}
} // namespace webrtc