diff options
author | Scott LaVarnway <slavarnway@google.com> | 2012-03-23 16:55:22 -0400 |
---|---|---|
committer | Scott LaVarnway <slavarnway@google.com> | 2012-03-29 16:30:14 -0400 |
commit | 31322c5faac5e8ad9e73fe705b863ec5f8c28323 (patch) | |
tree | 82b1221f53e72fad28e993706dd2bb718c71396c | |
parent | a337725625207758e56c1820c3a06bc00ca22b1a (diff) | |
download | libvpx-31322c5faac5e8ad9e73fe705b863ec5f8c28323.tar libvpx-31322c5faac5e8ad9e73fe705b863ec5f8c28323.tar.gz libvpx-31322c5faac5e8ad9e73fe705b863ec5f8c28323.tar.bz2 libvpx-31322c5faac5e8ad9e73fe705b863ec5f8c28323.zip |
MB_MODE_INFO size reduction
Reduced the size of the struct by 8 bytes, which would be
a memory savings of 64800 bytes for 1080 resolutions. Had
an extra byte, so created an is_4x4 for B_PRED or SPLITMV
modes. This simplified the mode checks in
vp8_reset_mb_tokens_context and vp8_decode_mb_tokens.
Change-Id: Ibec27784139abdc34d4d01f73c09f43e9e10e0f5
-rw-r--r-- | vp8/common/blockd.h | 13 | ||||
-rw-r--r-- | vp8/decoder/decodemv.c | 4 | ||||
-rw-r--r-- | vp8/decoder/detokenize.c | 20 |
3 files changed, 20 insertions, 17 deletions
diff --git a/vp8/common/blockd.h b/vp8/common/blockd.h index 692f0ebd2..a4c1d920c 100644 --- a/vp8/common/blockd.h +++ b/vp8/common/blockd.h @@ -150,14 +150,15 @@ typedef enum typedef struct { - MB_PREDICTION_MODE mode, uv_mode; - MV_REFERENCE_FRAME ref_frame; + uint8_t mode, uv_mode; + uint8_t ref_frame; + uint8_t is_4x4; int_mv mv; - unsigned char partitioning; - unsigned char mb_skip_coeff; /* does this mb has coefficients at all, 1=no coefficients, 0=need decode tokens */ - unsigned char need_to_clamp_mvs; - unsigned char segment_id; /* Which set of segmentation parameters should be used for this MB */ + uint8_t partitioning; + uint8_t mb_skip_coeff; /* does this mb has coefficients at all, 1=no coefficients, 0=need decode tokens */ + uint8_t need_to_clamp_mvs; + uint8_t segment_id; /* Which set of segmentation parameters should be used for this MB */ } MB_MODE_INFO; typedef struct diff --git a/vp8/decoder/decodemv.c b/vp8/decoder/decodemv.c index 4ade1c09e..b0e37e108 100644 --- a/vp8/decoder/decodemv.c +++ b/vp8/decoder/decodemv.c @@ -57,6 +57,7 @@ static void read_kf_modes(VP8D_COMP *pbi, MODE_INFO *mi) if (mi->mbmi.mode == B_PRED) { int i = 0; + mi->mbmi.is_4x4 = 1; do { @@ -485,6 +486,7 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi) mb_to_bottom_edge); mbmi->mv.as_int = mi->bmi[15].mv.as_int; mbmi->mode = SPLITMV; + mbmi->is_4x4 = 1; } else { @@ -557,6 +559,7 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi) if ((mbmi->mode = read_ymode(bc, pbi->common.fc.ymode_prob)) == B_PRED) { int j = 0; + mbmi->is_4x4 = 1; do { mi->bmi[j].as_mode = read_bmode(bc, pbi->common.fc.bmode_prob); @@ -603,6 +606,7 @@ static void decode_mb_mode_mvs(VP8D_COMP *pbi, MODE_INFO *mi, else mi->mbmi.mb_skip_coeff = 0; + mi->mbmi.is_4x4 = 0; if(pbi->common.frame_type == KEY_FRAME) read_kf_modes(pbi, mi); else diff --git a/vp8/decoder/detokenize.c b/vp8/decoder/detokenize.c index c5752ee0b..0c39848b8 100644 --- a/vp8/decoder/detokenize.c +++ b/vp8/decoder/detokenize.c @@ -17,17 +17,16 @@ void vp8_reset_mb_tokens_context(MACROBLOCKD *x) { + ENTROPY_CONTEXT *a_ctx = ((ENTROPY_CONTEXT *)x->above_context); + ENTROPY_CONTEXT *l_ctx = ((ENTROPY_CONTEXT *)x->left_context); + + vpx_memset(a_ctx, 0, sizeof(ENTROPY_CONTEXT_PLANES)-1); + vpx_memset(l_ctx, 0, sizeof(ENTROPY_CONTEXT_PLANES)-1); + /* Clear entropy contexts for Y2 blocks */ - if (x->mode_info_context->mbmi.mode != B_PRED && - x->mode_info_context->mbmi.mode != SPLITMV) - { - vpx_memset(x->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES)); - vpx_memset(x->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES)); - } - else + if (!x->mode_info_context->mbmi.is_4x4) { - vpx_memset(x->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES)-1); - vpx_memset(x->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES)-1); + a_ctx[8] = l_ctx[8] = 0; } } @@ -187,8 +186,7 @@ int vp8_decode_mb_tokens(VP8D_COMP *dx, MACROBLOCKD *x) qcoeff_ptr = &x->qcoeff[0]; - if (x->mode_info_context->mbmi.mode != B_PRED && - x->mode_info_context->mbmi.mode != SPLITMV) + if (!x->mode_info_context->mbmi.is_4x4) { a = a_ctx + 8; l = l_ctx + 8; |