diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2015-09-07 14:32:28 -0400 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2015-09-14 16:13:59 -0400 |
commit | 1e9e9ce2dcef43677887292df115e5160809ed62 (patch) | |
tree | a962d16c17896a4c3602068ed611bbd988163ecd | |
parent | 48f0168e955f8f79c99a02681b45ccab122721c4 (diff) | |
download | libvpx-1e9e9ce2dcef43677887292df115e5160809ed62.tar libvpx-1e9e9ce2dcef43677887292df115e5160809ed62.tar.gz libvpx-1e9e9ce2dcef43677887292df115e5160809ed62.tar.bz2 libvpx-1e9e9ce2dcef43677887292df115e5160809ed62.zip |
vp10: fix entropy counts for the hp bit.
The counts didn't take usehp into account, which means that if the
scope of the refmv is too large for the hp bit to be coded, the value
(always 1) is still included in the stats. Therefore, the final
counts will not reflect the entropy of the coded bits, but rather the
entropy of the combination of coded bits and the implied value (which
is always 1). Fix that by only including counts if the hp bit is
actually coded.
See issue 1060.
Change-Id: I19a3adda4a8662a05f08a9e58d7e56ff979be11e
-rw-r--r-- | vp10/common/entropymv.c | 8 | ||||
-rw-r--r-- | vp10/common/entropymv.h | 2 | ||||
-rw-r--r-- | vp10/decoder/decodemv.c | 2 | ||||
-rw-r--r-- | vp10/encoder/encodemv.c | 2 |
4 files changed, 8 insertions, 6 deletions
diff --git a/vp10/common/entropymv.c b/vp10/common/entropymv.c index ebf7a079b..6b99606ff 100644 --- a/vp10/common/entropymv.c +++ b/vp10/common/entropymv.c @@ -161,17 +161,19 @@ static void inc_mv_component(int v, nmv_component_counts *comp_counts, } } -void vp10_inc_mv(const MV *mv, nmv_context_counts *counts) { +void vp10_inc_mv(const MV *mv, nmv_context_counts *counts, const int usehp) { if (counts != NULL) { const MV_JOINT_TYPE j = vp10_get_mv_joint(mv); ++counts->joints[j]; if (mv_joint_vertical(j)) { - inc_mv_component(mv->row, &counts->comps[0], 1, 1); + inc_mv_component(mv->row, &counts->comps[0], 1, + !CONFIG_MISC_FIXES || usehp); } if (mv_joint_horizontal(j)) { - inc_mv_component(mv->col, &counts->comps[1], 1, 1); + inc_mv_component(mv->col, &counts->comps[1], 1, + !CONFIG_MISC_FIXES || usehp); } } } diff --git a/vp10/common/entropymv.h b/vp10/common/entropymv.h index fd9f1c0ce..d1eb95c57 100644 --- a/vp10/common/entropymv.h +++ b/vp10/common/entropymv.h @@ -124,7 +124,7 @@ typedef struct { nmv_component_counts comps[2]; } nmv_context_counts; -void vp10_inc_mv(const MV *mv, nmv_context_counts *mvctx); +void vp10_inc_mv(const MV *mv, nmv_context_counts *mvctx, const int usehp); #ifdef __cplusplus } // extern "C" diff --git a/vp10/decoder/decodemv.c b/vp10/decoder/decodemv.c index b190f734c..f157ada20 100644 --- a/vp10/decoder/decodemv.c +++ b/vp10/decoder/decodemv.c @@ -294,7 +294,7 @@ static INLINE void read_mv(vpx_reader *r, MV *mv, const MV *ref, if (mv_joint_horizontal(joint_type)) diff.col = read_mv_component(r, &ctx->comps[1], use_hp); - vp10_inc_mv(&diff, counts); + vp10_inc_mv(&diff, counts, use_hp); mv->row = ref->row + diff.row; mv->col = ref->col + diff.col; diff --git a/vp10/encoder/encodemv.c b/vp10/encoder/encodemv.c index f1fe5a78f..ca2de1fba 100644 --- a/vp10/encoder/encodemv.c +++ b/vp10/encoder/encodemv.c @@ -239,7 +239,7 @@ static void inc_mvs(const MB_MODE_INFO *mbmi, const MB_MODE_INFO_EXT *mbmi_ext, const MV *ref = &mbmi_ext->ref_mvs[mbmi->ref_frame[i]][0].as_mv; const MV diff = {mvs[i].as_mv.row - ref->row, mvs[i].as_mv.col - ref->col}; - vp10_inc_mv(&diff, counts); + vp10_inc_mv(&diff, counts, vp10_use_mv_hp(ref)); } } |