From d94d2b75eaf607e9d8d8f19204b2c375e2da2b00 Mon Sep 17 00:00:00 2001 From: John Koleszar Date: Tue, 9 Oct 2012 15:35:57 -0700 Subject: [PATCH] write_kfmodes: use update_skip_probs() Use the common update_skip_probs() function rather than duplicating its logic in write_kf_modes(). Change-Id: I2890a28f6907cb79ffe0fb21d20f0ef98b85cdd9 --- vp8/encoder/bitstream.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c index 2f748015f..4920739bc 100644 --- a/vp8/encoder/bitstream.c +++ b/vp8/encoder/bitstream.c @@ -1322,6 +1322,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi) { } } + static void write_kfmodes(VP8_COMP *cpi) { vp8_writer *const bc = & cpi->bc; VP8_COMMON *const c = & cpi->common; @@ -1331,30 +1332,13 @@ static void write_kfmodes(VP8_COMP *cpi) { int i; int row, col; int mb_row, mb_col; - int prob_skip_false[3] = {0, 0, 0}; int row_delta[4] = { 0, +1, 0, -1}; int col_delta[4] = { +1, -1, +1, +1}; - // printf("write_kfmodes\n"); if (c->mb_no_coeff_skip) { - // Divide by 0 check. 0 case possible with segment features - int k; - for (k = 0; k < MBSKIP_CONTEXTS; ++k) { - if ((cpi->skip_false_count[k] + cpi->skip_true_count[k])) { - prob_skip_false[k] = cpi->skip_false_count[k] * 256 / - (cpi->skip_false_count[k] + cpi->skip_true_count[k]); - - if (prob_skip_false[k] <= 1) - prob_skip_false[k] = 1; - - if (prob_skip_false[k] > 255) - prob_skip_false[k] = 255; - } else - prob_skip_false[k] = 255; - - c->mbskip_pred_probs[k] = prob_skip_false[k]; - vp8_write_literal(bc, prob_skip_false[k], 8); - } + update_skip_probs(cpi); + for (i = 0; i < MBSKIP_CONTEXTS; ++i) + vp8_write_literal(bc, c->mbskip_pred_probs[i], 8); } if (!c->kf_ymode_probs_update) {