]> granicus.if.org Git - libvpx/commitdiff
Separate frame context index for different frame types
authorJingning Han <jingning@google.com>
Wed, 27 Jul 2016 16:12:53 +0000 (09:12 -0700)
committerJingning Han <jingning@google.com>
Wed, 27 Jul 2016 22:35:15 +0000 (15:35 -0700)
This commit makes the encoder to use different frame context index
for different frame types. In the baseline setting, it sets the
frame context index of the overlay frame to be different from other
regular inter frames. In the ext-refs setting, it further allows
the backward reference frame to use a different index.

It improves the compression performance for both settings.

Baseline
lowres  0.12%

ext-refs
lowres  0.50%
midres  0.56%

Change-Id: I7c63ddec9fc296c56a86353cf2c661a740b97a97

vp10/common/onyxc_int.h
vp10/encoder/encoder.c
vp10/encoder/encoder.h

index 37f7631c7ed963180dbf7aeefb0e99930e14c7aa..1225540f4546b5459084e3e12f6f762751fa5df1 100644 (file)
@@ -47,7 +47,12 @@ extern "C" {
 // normal reference pool.
 #define FRAME_BUFFERS (REF_FRAMES + 7)
 
+#if CONFIG_EXT_REFS
+#define FRAME_CONTEXTS_LOG2 3
+#else
 #define FRAME_CONTEXTS_LOG2 2
+#endif
+
 #define FRAME_CONTEXTS (1 << FRAME_CONTEXTS_LOG2)
 
 #define NUM_PING_PONG_BUFFERS 2
index 0620b885c095a52ba4d66434ca8795fbd59b6e9e..76ddea2de5f30ebab9875db92ed3e67977f49b40 100644 (file)
@@ -285,7 +285,18 @@ static void setup_frame(VP10_COMP *cpi) {
   if (frame_is_intra_only(cm) || cm->error_resilient_mode) {
     vp10_setup_past_independence(cm);
   } else {
-    cm->frame_context_idx = cpi->refresh_alt_ref_frame;
+    if (cpi->refresh_alt_ref_frame)
+      cm->frame_context_idx = ARF_FRAME;
+    else if (cpi->rc.is_src_frame_alt_ref)
+      cm->frame_context_idx = OVERLAY_FRAME;
+    else if (cpi->refresh_golden_frame)
+      cm->frame_context_idx = GLD_FRAME;
+#if CONFIG_EXT_REFS
+    else if (cpi->refresh_bwd_ref_frame)
+      cm->frame_context_idx = BRF_FRAME;
+#endif
+    else
+      cm->frame_context_idx = REGULAR_FRAME;
   }
 
   if (cm->frame_type == KEY_FRAME) {
index 63a1669f80e0afc39f3bed8dae701cb648b4695b..e1a155e7603c7bd0da895887d5f2fc26937deb53 100644 (file)
@@ -75,6 +75,21 @@ typedef struct {
   FRAME_CONTEXT fc;
 } CODING_CONTEXT;
 
+typedef enum {
+  // regular inter frame
+  REGULAR_FRAME = 0,
+  // alternate reference frame
+  ARF_FRAME = 1,
+  // overlay frame
+  OVERLAY_FRAME = 2,
+  // golden frame
+  GLD_FRAME = 3,
+#if CONFIG_EXT_REFS
+  // backward reference frame
+  BRF_FRAME = 4,
+#endif
+} FRAME_CONTEXT_INDEX;
+
 typedef enum {
   // encode_breakout is disabled.
   ENCODE_BREAKOUT_DISABLED = 0,