ref: 12da793d001b0be5855c7a5741909f08fe387fa0
parent: fcccbcbb395ce4cf31b54ce1245cc28e5e3ef4c1
author: Yaowu Xu <yaowu@google.com>
date: Tue Nov 27 07:41:59 EST 2012
removed redundant mode_context data structures This commit removed a couple of redundant data structures in frame coding contextsm, mode_context and mode_context_a, and changed to use vp9_mode_contexts only. The switch of the context for different frame type now relies on the switch of frame coding context between lfc and lfc_a. This commit also removed a number of memcpy among these redundant data structure. Change-Id: I42e8174bd60f466b0860afc44c1263896471b0f3
--- a/vp9/common/vp9_entropymode.c
+++ b/vp9/common/vp9_entropymode.c
@@ -448,14 +448,6 @@
void vp9_init_mode_contexts(VP9_COMMON *pc) {
vpx_memset(pc->fc.mv_ref_ct, 0, sizeof(pc->fc.mv_ref_ct));
-
- vpx_memcpy(pc->fc.mode_context,
- vp9_default_mode_contexts,
- sizeof(pc->fc.mode_context));
- vpx_memcpy(pc->fc.mode_context_a,
- vp9_default_mode_contexts_a,
- sizeof(pc->fc.mode_context_a));
-
}
void vp9_accum_mv_refs(VP9_COMMON *pc,
@@ -494,11 +486,8 @@
int (*mv_ref_ct)[4][2];
int (*mode_context)[4];
- if (pc->refresh_alt_ref_frame) {
- mode_context = pc->fc.mode_context_a;
- } else {
- mode_context = pc->fc.mode_context;
- }
+ mode_context = pc->fc.vp9_mode_contexts;
+
mv_ref_ct = pc->fc.mv_ref_ct;
for (j = 0; j < INTER_MODE_CONTEXTS; j++) {
--- a/vp9/common/vp9_onyxc_int.h
+++ b/vp9/common/vp9_onyxc_int.h
@@ -119,8 +119,6 @@
vp9_prob pre_interintra_prob;
#endif
- int mode_context[INTER_MODE_CONTEXTS][4];
- int mode_context_a[INTER_MODE_CONTEXTS][4];
int vp9_mode_contexts[INTER_MODE_CONTEXTS][4];
int mv_ref_ct[INTER_MODE_CONTEXTS][4][2];
} FRAME_CONTEXT;
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -861,12 +861,17 @@
pc->ref_frame_sign_bias[ALTREF_FRAME] = 0;
vp9_init_mode_contexts(&pbi->common);
+ vpx_memcpy(pbi->common.fc.vp9_mode_contexts,
+ vp9_default_mode_contexts,
+ sizeof(vp9_default_mode_contexts));
+
vpx_memcpy(&pc->lfc, &pc->fc, sizeof(pc->fc));
vpx_memcpy(&pc->lfc_a, &pc->fc, sizeof(pc->fc));
- vpx_memcpy(pbi->common.fc.vp9_mode_contexts,
- pbi->common.fc.mode_context,
- sizeof(pbi->common.fc.mode_context));
+ vpx_memcpy(pbi->common.lfc.vp9_mode_contexts,
+ vp9_default_mode_contexts_a,
+ sizeof(vp9_default_mode_contexts_a));
+
vpx_memset(pc->prev_mip, 0,
(pc->mb_cols + 1) * (pc->mb_rows + 1)* sizeof(MODE_INFO));
vpx_memset(pc->mip, 0,
@@ -1251,14 +1256,8 @@
if (pc->refresh_alt_ref_frame) {
vpx_memcpy(&pc->fc, &pc->lfc_a, sizeof(pc->fc));
- vpx_memcpy(pc->fc.vp9_mode_contexts,
- pc->fc.mode_context_a,
- sizeof(pc->fc.vp9_mode_contexts));
} else {
vpx_memcpy(&pc->fc, &pc->lfc, sizeof(pc->fc));
- vpx_memcpy(pc->fc.vp9_mode_contexts,
- pc->fc.mode_context,
- sizeof(pc->fc.vp9_mode_contexts));
}
/* Buffer to buffer copy flags. */
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -3748,7 +3748,6 @@
cpi->NMVcount.joints[2], cpi->NMVcount.joints[3]);
*/
vp9_adapt_nmv_probs(&cpi->common, cpi->mb.e_mbd.allow_high_precision_mv);
- vp9_update_mode_context(&cpi->common);
}
#if CONFIG_COMP_INTERINTRA_PRED
if (cm->frame_type != KEY_FRAME)
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -127,8 +127,7 @@
#endif
int mv_ref_ct[INTER_MODE_CONTEXTS][4][2];
- int mode_context[INTER_MODE_CONTEXTS][4];
- int mode_context_a[INTER_MODE_CONTEXTS][4];
+ int vp9_mode_contexts[INTER_MODE_CONTEXTS][4];
} CODING_CONTEXT;
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -17,6 +17,7 @@
#include "math.h"
#include "vp9/common/vp9_alloccommon.h"
+#include "vp9/common/vp9_modecont.h"
#include "vp9/common/vp9_common.h"
#include "vp9_ratectrl.h"
#include "vp9/common/vp9_entropymode.h"
@@ -135,8 +136,7 @@
vp9_copy(cc->nmvcosts, cpi->mb.nmvcosts);
vp9_copy(cc->nmvcosts_hp, cpi->mb.nmvcosts_hp);
- vp9_copy(cc->mode_context, cm->fc.mode_context);
- vp9_copy(cc->mode_context_a, cm->fc.mode_context_a);
+ vp9_copy(cc->vp9_mode_contexts, cm->fc.vp9_mode_contexts);
vp9_copy(cc->ymode_prob, cm->fc.ymode_prob);
#if CONFIG_SUPERBLOCKS
@@ -194,8 +194,7 @@
vp9_copy(cpi->mb.nmvcosts, cc->nmvcosts);
vp9_copy(cpi->mb.nmvcosts_hp, cc->nmvcosts_hp);
- vp9_copy(cm->fc.mode_context, cc->mode_context);
- vp9_copy(cm->fc.mode_context_a, cc->mode_context_a);
+ vp9_copy(cm->fc.vp9_mode_contexts, cc->vp9_mode_contexts);
vp9_copy(cm->fc.ymode_prob, cc->ymode_prob);
#if CONFIG_SUPERBLOCKS
@@ -262,9 +261,16 @@
cpi->common.refresh_alt_ref_frame = TRUE;
vp9_init_mode_contexts(&cpi->common);
+ vpx_memcpy(cpi->common.fc.vp9_mode_contexts,
+ vp9_default_mode_contexts,
+ sizeof(vp9_default_mode_contexts));
vpx_memcpy(&cpi->common.lfc, &cpi->common.fc, sizeof(cpi->common.fc));
vpx_memcpy(&cpi->common.lfc_a, &cpi->common.fc, sizeof(cpi->common.fc));
+ vpx_memcpy(cpi->common.lfc.vp9_mode_contexts,
+ vp9_default_mode_contexts_a,
+ sizeof(vp9_default_mode_contexts_a));
+
vpx_memset(cm->prev_mip, 0,
(cm->mb_cols + 1) * (cm->mb_rows + 1)* sizeof(MODE_INFO));
vpx_memset(cm->mip, 0,
@@ -279,16 +285,10 @@
vpx_memcpy(&cpi->common.fc,
&cpi->common.lfc_a,
sizeof(cpi->common.fc));
- vpx_memcpy(cpi->common.fc.vp9_mode_contexts,
- cpi->common.fc.mode_context_a,
- sizeof(cpi->common.fc.vp9_mode_contexts));
} else {
vpx_memcpy(&cpi->common.fc,
&cpi->common.lfc,
sizeof(cpi->common.fc));
- vpx_memcpy(cpi->common.fc.vp9_mode_contexts,
- cpi->common.fc.mode_context,
- sizeof(cpi->common.fc.vp9_mode_contexts));
}
}