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

Unified Diff: source/libvpx/test/svc_test.cc

Issue 668403002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/libvpx/test/sad_test.cc ('k') | source/libvpx/test/test.mk » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/libvpx/test/svc_test.cc
===================================================================
--- source/libvpx/test/svc_test.cc (revision 292608)
+++ source/libvpx/test/svc_test.cc (working copy)
@@ -225,10 +225,9 @@
EXPECT_EQ(received_frames, n);
}
- void DropLayersAndMakeItVP9Comaptible(struct vpx_fixed_buf *const inputs,
- const int num_super_frames,
- const int remained_spatial_layers,
- const bool is_multiple_frame_contexts) {
+ void DropEnhancementLayers(struct vpx_fixed_buf *const inputs,
+ const int num_super_frames,
+ const int remained_spatial_layers) {
ASSERT_TRUE(inputs != NULL);
ASSERT_GT(num_super_frames, 0);
ASSERT_GT(remained_spatial_layers, 0);
@@ -250,45 +249,6 @@
if (frame_count == 0) {
// There's no super frame but only a single frame.
ASSERT_EQ(1, remained_spatial_layers);
- if (is_multiple_frame_contexts) {
- // Make a new super frame.
- uint8_t marker = 0xc1;
- unsigned int mask;
- int mag;
-
- // Choose the magnitude.
- for (mag = 0, mask = 0xff; mag < 4; ++mag) {
- if (inputs[i].sz < mask)
- break;
- mask <<= 8;
- mask |= 0xff;
- }
- marker |= mag << 3;
- int index_sz = 2 + (mag + 1) * 2;
-
- inputs[i].buf = realloc(inputs[i].buf, inputs[i].sz + index_sz + 16);
- ASSERT_TRUE(inputs[i].buf != NULL);
- uint8_t *frame_data = static_cast<uint8_t*>(inputs[i].buf);
- frame_data[0] &= ~2; // Set the show_frame flag to 0.
- frame_data += inputs[i].sz;
- // Add an one byte frame with show_existing_frame.
- *frame_data++ = 0x88;
-
- // Write the super frame index.
- *frame_data++ = marker;
-
- frame_sizes[0] = inputs[i].sz;
- frame_sizes[1] = 1;
- for (int j = 0; j < 2; ++j) {
- unsigned int this_sz = frame_sizes[j];
- for (int k = 0; k <= mag; k++) {
- *frame_data++ = this_sz & 0xff;
- this_sz >>= 8;
- }
- }
- *frame_data++ = marker;
- inputs[i].sz += index_sz + 1;
- }
} else {
// Found a super frame.
uint8_t *frame_data = static_cast<uint8_t*>(inputs[i].buf);
@@ -304,16 +264,13 @@
}
ASSERT_LT(frame, frame_count) << "Couldn't find a visible frame. "
<< "remained_spatial_layers: " << remained_spatial_layers
- << " super_frame: " << i
- << " is_multiple_frame_context: " << is_multiple_frame_contexts;
- if (frame == frame_count - 1 && !is_multiple_frame_contexts)
+ << " super_frame: " << i;
+ if (frame == frame_count - 1)
continue;
frame_data += frame_sizes[frame];
// We need to add one more frame for multiple frame contexts.
- if (is_multiple_frame_contexts)
- ++frame;
uint8_t marker =
static_cast<const uint8_t*>(inputs[i].buf)[inputs[i].sz - 1];
const uint32_t mag = ((marker >> 3) & 0x3) + 1;
@@ -323,35 +280,14 @@
marker |= frame;
// Copy existing frame sizes.
- memmove(frame_data + (is_multiple_frame_contexts ? 2 : 1),
- frame_start + inputs[i].sz - index_sz + 1, new_index_sz - 2);
- if (is_multiple_frame_contexts) {
- // Add a one byte frame with flag show_existing_frame.
- *frame_data++ = 0x88 | (remained_spatial_layers - 1);
- }
+ memmove(frame_data + 1, frame_start + inputs[i].sz - index_sz + 1,
+ new_index_sz - 2);
// New marker.
frame_data[0] = marker;
frame_data += (mag * (frame + 1) + 1);
- if (is_multiple_frame_contexts) {
- // Write the frame size for the one byte frame.
- frame_data -= mag;
- *frame_data++ = 1;
- for (uint32_t j = 1; j < mag; ++j) {
- *frame_data++ = 0;
- }
- }
-
*frame_data++ = marker;
inputs[i].sz = frame_data - frame_start;
-
- if (is_multiple_frame_contexts) {
- // Change the show frame flag to 0 for all frames.
- for (int j = 0; j < frame; ++j) {
- frame_start[0] &= ~2;
- frame_start += frame_sizes[j];
- }
- }
}
}
}
@@ -555,7 +491,7 @@
vpx_fixed_buf outputs[10];
memset(&outputs[0], 0, sizeof(outputs));
Pass2EncodeNFrames(&stats_buf, 10, 2, &outputs[0]);
- DropLayersAndMakeItVP9Comaptible(&outputs[0], 10, 1, false);
+ DropEnhancementLayers(&outputs[0], 10, 1);
DecodeNFrames(&outputs[0], 10);
FreeBitstreamBuffers(&outputs[0], 10);
}
@@ -573,13 +509,13 @@
Pass2EncodeNFrames(&stats_buf, 10, 5, &outputs[0]);
DecodeNFrames(&outputs[0], 10);
- DropLayersAndMakeItVP9Comaptible(&outputs[0], 10, 4, false);
+ DropEnhancementLayers(&outputs[0], 10, 4);
DecodeNFrames(&outputs[0], 10);
- DropLayersAndMakeItVP9Comaptible(&outputs[0], 10, 3, false);
+ DropEnhancementLayers(&outputs[0], 10, 3);
DecodeNFrames(&outputs[0], 10);
- DropLayersAndMakeItVP9Comaptible(&outputs[0], 10, 2, false);
+ DropEnhancementLayers(&outputs[0], 10, 2);
DecodeNFrames(&outputs[0], 10);
- DropLayersAndMakeItVP9Comaptible(&outputs[0], 10, 1, false);
+ DropEnhancementLayers(&outputs[0], 10, 1);
DecodeNFrames(&outputs[0], 10);
FreeBitstreamBuffers(&outputs[0], 10);
@@ -616,9 +552,9 @@
memset(&outputs[0], 0, sizeof(outputs));
Pass2EncodeNFrames(&stats_buf, 20, 3, &outputs[0]);
DecodeNFrames(&outputs[0], 20);
- DropLayersAndMakeItVP9Comaptible(&outputs[0], 20, 2, false);
+ DropEnhancementLayers(&outputs[0], 20, 2);
DecodeNFrames(&outputs[0], 20);
- DropLayersAndMakeItVP9Comaptible(&outputs[0], 20, 1, false);
+ DropEnhancementLayers(&outputs[0], 20, 1);
DecodeNFrames(&outputs[0], 20);
FreeBitstreamBuffers(&outputs[0], 20);
@@ -649,7 +585,6 @@
vpx_fixed_buf outputs[10];
memset(&outputs[0], 0, sizeof(outputs));
Pass2EncodeNFrames(&stats_buf, 10, 2, &outputs[0]);
- DropLayersAndMakeItVP9Comaptible(&outputs[0], 10, 2, true);
DecodeNFrames(&outputs[0], 10);
FreeBitstreamBuffers(&outputs[0], 10);
}
@@ -667,7 +602,7 @@
vpx_fixed_buf outputs[10];
memset(&outputs[0], 0, sizeof(outputs));
Pass2EncodeNFrames(&stats_buf, 10, 2, &outputs[0]);
- DropLayersAndMakeItVP9Comaptible(&outputs[0], 10, 1, true);
+ DropEnhancementLayers(&outputs[0], 10, 1);
DecodeNFrames(&outputs[0], 10);
FreeBitstreamBuffers(&outputs[0], 10);
}
@@ -686,7 +621,6 @@
vpx_fixed_buf outputs[10];
memset(&outputs[0], 0, sizeof(outputs));
Pass2EncodeNFrames(&stats_buf, 10, 2, &outputs[0]);
- DropLayersAndMakeItVP9Comaptible(&outputs[0], 10, 2, true);
DecodeNFrames(&outputs[0], 10);
FreeBitstreamBuffers(&outputs[0], 10);
}
@@ -707,32 +641,13 @@
memset(&outputs[0], 0, sizeof(outputs));
Pass2EncodeNFrames(&stats_buf, 10, 3, &outputs[0]);
- vpx_fixed_buf outputs_new[10];
- for (int i = 0; i < 10; ++i) {
- outputs_new[i].buf = malloc(outputs[i].sz + 16);
- ASSERT_TRUE(outputs_new[i].buf != NULL);
- memcpy(outputs_new[i].buf, outputs[i].buf, outputs[i].sz);
- outputs_new[i].sz = outputs[i].sz;
- }
- DropLayersAndMakeItVP9Comaptible(&outputs_new[0], 10, 3, true);
- DecodeNFrames(&outputs_new[0], 10);
+ DecodeNFrames(&outputs[0], 10);
+ DropEnhancementLayers(&outputs[0], 10, 2);
+ DecodeNFrames(&outputs[0], 10);
+ DropEnhancementLayers(&outputs[0], 10, 1);
+ DecodeNFrames(&outputs[0], 10);
- for (int i = 0; i < 10; ++i) {
- memcpy(outputs_new[i].buf, outputs[i].buf, outputs[i].sz);
- outputs_new[i].sz = outputs[i].sz;
- }
- DropLayersAndMakeItVP9Comaptible(&outputs_new[0], 10, 2, true);
- DecodeNFrames(&outputs_new[0], 10);
-
- for (int i = 0; i < 10; ++i) {
- memcpy(outputs_new[i].buf, outputs[i].buf, outputs[i].sz);
- outputs_new[i].sz = outputs[i].sz;
- }
- DropLayersAndMakeItVP9Comaptible(&outputs_new[0], 10, 1, true);
- DecodeNFrames(&outputs_new[0], 10);
-
FreeBitstreamBuffers(&outputs[0], 10);
- FreeBitstreamBuffers(&outputs_new[0], 10);
}
TEST_F(SvcTest, TwoPassEncode2TemporalLayers) {
@@ -769,7 +684,6 @@
vpx_fixed_buf outputs[10];
memset(&outputs[0], 0, sizeof(outputs));
Pass2EncodeNFrames(&stats_buf, 10, 1, &outputs[0]);
- DropLayersAndMakeItVP9Comaptible(&outputs[0], 10, 1, true);
DecodeNFrames(&outputs[0], 10);
FreeBitstreamBuffers(&outputs[0], 10);
}
@@ -814,7 +728,6 @@
vpx_fixed_buf outputs[10];
memset(&outputs[0], 0, sizeof(outputs));
Pass2EncodeNFrames(&stats_buf, 10, 1, &outputs[0]);
- DropLayersAndMakeItVP9Comaptible(&outputs[0], 10, 1, true);
vpx_fixed_buf base_layer[5];
for (int i = 0; i < 5; ++i)
« no previous file with comments | « source/libvpx/test/sad_test.cc ('k') | source/libvpx/test/test.mk » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698