summaryrefslogtreecommitdiff
path: root/vp8/encoder/bitstream.c
diff options
context:
space:
mode:
authorPaul Wilkins <paulwilkins@google.com>2012-02-02 17:30:27 +0000
committerPaul Wilkins <paulwilkins@google.com>2012-02-06 16:38:41 +0000
commit82b865da9475586341949664d5468a93237867a8 (patch)
treea53286ec45c0ed4ae2332512b70f83df50a5805a /vp8/encoder/bitstream.c
parentc98e9d2882b4dcfe70d1a7136eb8bcb4b2eb5292 (diff)
downloadlibvpx-82b865da9475586341949664d5468a93237867a8.tar
libvpx-82b865da9475586341949664d5468a93237867a8.tar.gz
libvpx-82b865da9475586341949664d5468a93237867a8.tar.bz2
libvpx-82b865da9475586341949664d5468a93237867a8.zip
Coding the hybrid dual prediction signal.
Initial modifications to make limited use of common prediction functions. The only functional change thus far is that updates to the probabilities are no longer "damped". This was a testing convenience but in fact seems to help by a little over 0.1% over the derf set. Change-Id: I8b82907d9d6b6a4a075728b60b31ce93392a5f2e
Diffstat (limited to 'vp8/encoder/bitstream.c')
-rw-r--r--vp8/encoder/bitstream.c97
1 files changed, 69 insertions, 28 deletions
diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c
index 99f3df9dc..e7028da9e 100644
--- a/vp8/encoder/bitstream.c
+++ b/vp8/encoder/bitstream.c
@@ -1109,21 +1109,26 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
{
vp8_write(w, 1, 128);
vp8_write(w, 1, 128);
- for (i = 0; i < 3; i++) {
- if (cpi->single_pred_count[i] + cpi->dual_pred_count[i])
+ for (i = 0; i < 3; i++)
{
- prob_dual_pred[i] = cpi->single_pred_count[i] * 256 /
- (cpi->single_pred_count[i] + cpi->dual_pred_count[i]);
- if (prob_dual_pred[i] < 1)
- prob_dual_pred[i] = 1;
- else if (prob_dual_pred[i] > 255)
- prob_dual_pred[i] = 255;
- }
- else
- {
- prob_dual_pred[i] = 128;
- }
- vp8_write_literal(w, prob_dual_pred[i], 8);
+ if (cpi->single_pred_count[i] + cpi->dual_pred_count[i])
+ {
+ prob_dual_pred[i] = cpi->single_pred_count[i] * 256 /
+ (cpi->single_pred_count[i] + cpi->dual_pred_count[i]);
+ if (prob_dual_pred[i] < 1)
+ prob_dual_pred[i] = 1;
+ else if (prob_dual_pred[i] > 255)
+ prob_dual_pred[i] = 255;
+ }
+ else
+ {
+ prob_dual_pred[i] = 128;
+ }
+ vp8_write_literal(w, prob_dual_pred[i], 8);
+
+#if CONFIG_COMPRED
+ pc->prob_dualpred[i] = prob_dual_pred[i];
+#endif
}
}
else if (cpi->common.dual_pred_mode == SINGLE_PREDICTION_ONLY)
@@ -1315,10 +1320,17 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
#if CONFIG_DUALPRED
if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
{
+#if CONFIG_COMPRED
+ vp8_write(w,
+ mi->second_ref_frame != INTRA_FRAME,
+ get_pred_prob( pc, xd, PRED_DUAL ) );
+#else
+
int t = m[-mis].mbmi.second_ref_frame != INTRA_FRAME;
int l = m[-1 ].mbmi.second_ref_frame != INTRA_FRAME;
vp8_write(w, mi->second_ref_frame != INTRA_FRAME,
prob_dual_pred[t + l]);
+#endif
}
if (mi->second_ref_frame)
{
@@ -1386,10 +1398,17 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
#if CONFIG_DUALPRED
if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
{
+#if CONFIG_COMPRED
+
+ vp8_write(w,
+ mi->second_ref_frame != INTRA_FRAME,
+ get_pred_prob( pc, xd, PRED_DUAL ) );
+#else
int t = m[-mis].mbmi.second_ref_frame != INTRA_FRAME;
int l = m[-1 ].mbmi.second_ref_frame != INTRA_FRAME;
vp8_write(w, mi->second_ref_frame != INTRA_FRAME,
prob_dual_pred[t + l]);
+#endif
}
#endif /* CONFIG_DUALPRED */
break;
@@ -1416,6 +1435,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
cpi->mb.partition_info += mis + (1- (pc->mb_cols & 0x1));
}
+#if !CONFIG_COMPRED
#if CONFIG_DUALPRED
if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
{
@@ -1424,6 +1444,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
pc->prob_dualpred[2] = (prob_dual_pred[2] + pc->prob_dualpred[2] + 1) >> 1;
}
#endif /* CONFIG_DUALPRED */
+#endif
}
#else
static void pack_inter_mode_mvs(VP8_COMP *const cpi)
@@ -1448,6 +1469,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
int mb_row = -1;
int prob_skip_false = 0;
+
#if CONFIG_DUALPRED
int prob_dual_pred[3];
#endif /* CONFIG_DUALPRED */
@@ -1495,21 +1517,26 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
{
vp8_write(w, 1, 128);
vp8_write(w, 1, 128);
- for (i = 0; i < 3; i++) {
- if (cpi->single_pred_count[i] + cpi->dual_pred_count[i])
+ for (i = 0; i < 3; i++)
{
- prob_dual_pred[i] = cpi->single_pred_count[i] * 256 /
- (cpi->single_pred_count[i] + cpi->dual_pred_count[i]);
- if (prob_dual_pred[i] < 1)
- prob_dual_pred[i] = 1;
- else if (prob_dual_pred[i] > 255)
- prob_dual_pred[i] = 255;
- }
- else
- {
- prob_dual_pred[i] = 128;
- }
- vp8_write_literal(w, prob_dual_pred[i], 8);
+ if (cpi->single_pred_count[i] + cpi->dual_pred_count[i])
+ {
+ prob_dual_pred[i] = cpi->single_pred_count[i] * 256 /
+ (cpi->single_pred_count[i] + cpi->dual_pred_count[i]);
+ if (prob_dual_pred[i] < 1)
+ prob_dual_pred[i] = 1;
+ else if (prob_dual_pred[i] > 255)
+ prob_dual_pred[i] = 255;
+ }
+ else
+ {
+ prob_dual_pred[i] = 128;
+ }
+ vp8_write_literal(w, prob_dual_pred[i], 8);
+
+#if CONFIG_COMPRED
+ pc->prob_dualpred[i] = prob_dual_pred[i];
+#endif
}
}
else if (cpi->common.dual_pred_mode == SINGLE_PREDICTION_ONLY)
@@ -1681,10 +1708,16 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
#if CONFIG_DUALPRED
if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
{
+#if CONFIG_COMPRED
+
+ vp8_write(w, mi->second_ref_frame != INTRA_FRAME,
+ get_pred_prob( pc, xd, PRED_DUAL ) );
+#else
int t = m[-mis].mbmi.second_ref_frame != INTRA_FRAME;
int l = m[-1 ].mbmi.second_ref_frame != INTRA_FRAME;
vp8_write(w, mi->second_ref_frame != INTRA_FRAME,
prob_dual_pred[t + l]);
+#endif
}
if (mi->second_ref_frame)
{
@@ -1751,10 +1784,16 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
#if CONFIG_DUALPRED
if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
{
+#if CONFIG_COMPRED
+
+ vp8_write(w, mi->second_ref_frame != INTRA_FRAME,
+ get_pred_prob( pc, xd, PRED_DUAL ) );
+#else
int t = m[-mis].mbmi.second_ref_frame != INTRA_FRAME;
int l = m[-1 ].mbmi.second_ref_frame != INTRA_FRAME;
vp8_write(w, mi->second_ref_frame != INTRA_FRAME,
prob_dual_pred[t + l]);
+#endif
}
#endif /* CONFIG_DUALPRED */
break;
@@ -1779,6 +1818,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
cpi->mb.partition_info++;
}
+#if !CONFIG_COMPRED
#if CONFIG_DUALPRED
if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
{
@@ -1787,6 +1827,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
pc->prob_dualpred[2] = (prob_dual_pred[2] + pc->prob_dualpred[2] + 1) >> 1;
}
#endif /* CONFIG_DUALPRED */
+#endif
}
#endif // CONFIG_SUPERBLOCKS