Commit 8915eb8e authored by Jingning Han's avatar Jingning Han

Separate frame context index for different frame types

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
parent b124b243
......@@ -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
......
......@@ -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) {
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment