]> granicus.if.org Git - libvpx/commitdiff
Separate frame context index for GOP layers
authorJingning Han <jingning@google.com>
Fri, 7 Sep 2018 23:37:42 +0000 (16:37 -0700)
committerJingning Han <jingning@google.com>
Mon, 10 Sep 2018 16:19:46 +0000 (09:19 -0700)
Use separate frame context index to code frames at different layers.
The maximum index cap is set as 3. This improves the compression
performance of multi-layer ARF by 0.15% across the test sets.

The overall coding gains from multi-layer ARF are

         avg PSNR       ovarall PSNR        SSIM
lowres   -3.9%            -3.7%            -3.2%
midres   -3.5%            -3.2%            -2.3%
nflx2k   -4.3%            -4.6%            -3.0%

Change-Id: I8a0b345fdd47823c018544a6b4748753faf89dc1

vp9/encoder/vp9_encoder.c
vp9/encoder/vp9_firstpass.c

index 6cece62b48d02667110b71b634a2b249a9794a5b..69ab0445c9d7ad1ced5c70f896c1ca17ef1a53a0 100644 (file)
@@ -780,6 +780,7 @@ void vp9_set_high_precision_mv(VP9_COMP *cpi, int allow_high_precision_mv) {
 
 static void setup_frame(VP9_COMP *cpi) {
   VP9_COMMON *const cm = &cpi->common;
+  GF_GROUP *const gf_group = &cpi->twopass.gf_group;
   // Set up entropy context depending on frame type. The decoder mandates
   // the use of the default context, index 0, for keyframes and inter
   // frames where the error_resilient_mode or intra_only flag is set. For
@@ -791,6 +792,13 @@ static void setup_frame(VP9_COMP *cpi) {
     if (!cpi->use_svc) cm->frame_context_idx = cpi->refresh_alt_ref_frame;
   }
 
+  // TODO(jingning): Overwrite the frame_context_idx index in multi-layer ARF
+  // case. Need some further investigation on if we could apply this to single
+  // layer ARF case as well.
+  if (cpi->multi_layer_arf && !cpi->use_svc)
+    cm->frame_context_idx = clamp(gf_group->layer_depth[gf_group->index] - 1, 0,
+                                  FRAME_CONTEXTS - 1);
+
   if (cm->frame_type == KEY_FRAME) {
     cpi->refresh_golden_frame = 1;
     cpi->refresh_alt_ref_frame = 1;
index 1f95bc6d5c05d7294d58b63eeac2dcb37256099c..87ab8eb844d37571aec84e485e3d10d32c6a9677 100644 (file)
@@ -2413,6 +2413,7 @@ static int define_gf_group_structure(VP9_COMP *cpi) {
     }
     gf_group->arf_update_idx[frame_index] = arf_buffer_indices[0];
     gf_group->arf_ref_idx[frame_index] = arf_buffer_indices[0];
+    gf_group->layer_depth[frame_index] = MAX_ARF_LAYERS - 1;
   }
 
   ++frame_index;