Commit 0d65cae6 authored by Jingning Han's avatar Jingning Han
Browse files

Allow precise classification for refmv mode context

Combine the nearest ref mv count and the total ref mv count for
mode context.

Change-Id: I342a2b126bf7d2d30c344911260d9769a923026b
parent 1dc18077
......@@ -173,7 +173,7 @@ static const vpx_prob default_partition_probs[PARTITION_CONTEXTS]
#if CONFIG_REF_MV
static const vpx_prob default_newmv_prob[NEWMV_MODE_CONTEXTS] = {
230, 190, 150, 110, 70, 30,
200, 180, 150, 150, 110, 70, 60,
};
static const vpx_prob default_zeromv_prob[ZEROMV_MODE_CONTEXTS] = {
......@@ -181,7 +181,7 @@ static const vpx_prob default_zeromv_prob[ZEROMV_MODE_CONTEXTS] = {
};
static const vpx_prob default_refmv_prob[REFMV_MODE_CONTEXTS] = {
180, 230, 128
220, 220, 200, 200, 180, 128,
};
#endif
......
......@@ -204,9 +204,9 @@ typedef enum {
#define SKIP_CONTEXTS 3
#if CONFIG_REF_MV
#define NEWMV_MODE_CONTEXTS 6
#define NEWMV_MODE_CONTEXTS 7
#define ZEROMV_MODE_CONTEXTS 2
#define REFMV_MODE_CONTEXTS 3
#define REFMV_MODE_CONTEXTS 6
#define ZEROMV_OFFSET 3
#define REFMV_OFFSET 4
......
......@@ -242,7 +242,7 @@ static void setup_ref_mv_list(const VP10_COMMON *cm, const MACROBLOCKD *xd,
int bs = VPXMAX(xd->n8_w, xd->n8_h);
int has_tr = has_top_right(xd, mi_row, mi_col, bs);
mode_context[ref_frame] = 0;
*refmv_count = 0;
// Scan the first above row mode info.
......@@ -259,29 +259,6 @@ static void setup_ref_mv_list(const VP10_COMMON *cm, const MACROBLOCKD *xd,
nearest_refmv_count = *refmv_count;
mode_context[ref_frame] = 0;
switch (nearest_refmv_count) {
case 0:
mode_context[ref_frame] = 0;
break;
case 1:
mode_context[ref_frame] = (newmv_count > 0) ? 1 : 2;
mode_context[ref_frame] += (1 << REFMV_OFFSET);
break;
case 2:
default:
if (newmv_count >= 2)
mode_context[ref_frame] = 3;
else if (newmv_count == 1)
mode_context[ref_frame] = 4;
else
mode_context[ref_frame] = 5;
mode_context[ref_frame] += (2 << REFMV_OFFSET);
break;
}
if (prev_frame_mvs_base && cm->show_frame && cm->last_show_frame) {
int ref;
int blk_row, blk_col;
......@@ -350,6 +327,39 @@ static void setup_ref_mv_list(const VP10_COMMON *cm, const MACROBLOCKD *xd,
scan_col_mbmi(cm, xd, mi_row, mi_col, block, ref_frame,
-4, ref_mv_stack, refmv_count);
switch (nearest_refmv_count) {
case 0:
mode_context[ref_frame] |= 0;
if (*refmv_count >= 1)
mode_context[ref_frame] |= 1;
if (*refmv_count == 1)
mode_context[ref_frame] |= (1 << REFMV_OFFSET);
else if (*refmv_count >= 2)
mode_context[ref_frame] |= (2 << REFMV_OFFSET);
break;
case 1:
mode_context[ref_frame] |= (newmv_count > 0) ? 2 : 3;
if (*refmv_count == 1)
mode_context[ref_frame] |= (3 << REFMV_OFFSET);
else if (*refmv_count >= 2)
mode_context[ref_frame] |= (4 << REFMV_OFFSET);
break;
case 2:
default:
if (newmv_count >= 2)
mode_context[ref_frame] |= 4;
else if (newmv_count == 1)
mode_context[ref_frame] |= 5;
else
mode_context[ref_frame] |= 6;
mode_context[ref_frame] |= (5 << REFMV_OFFSET);
break;
}
// Rank the likelihood and assign nearest and near mvs.
len = nearest_refmv_count;
while (len > 0) {
......
Supports Markdown
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