diff options
Diffstat (limited to 'vp8/encoder/bitstream.c')
-rw-r--r-- | vp8/encoder/bitstream.c | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c index e468f40f0..412542d10 100644 --- a/vp8/encoder/bitstream.c +++ b/vp8/encoder/bitstream.c @@ -1,10 +1,11 @@ /* - * Copyright (c) 2010 The VP8 project authors. All Rights Reserved. + * Copyright (c) 2010 The WebM project authors. All Rights Reserved. * - * Use of this source code is governed by a BSD-style license and patent - * grant that can be found in the LICENSE file in the root of the source - * tree. All contributing project authors may be found in the AUTHORS - * file in the root of the source tree. + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. */ @@ -791,7 +792,8 @@ static void write_mv_ref assert(NEARESTMV <= m && m <= SPLITMV); - vp8_write_token(w, vp8_mv_ref_tree, p, VP8_MVREFENCODINGS + m); + vp8_write_token(w, vp8_mv_ref_tree, p, + vp8_mv_ref_encoding_array - NEARESTMV + m); } static void write_sub_mv_ref @@ -801,7 +803,8 @@ static void write_sub_mv_ref { assert(LEFT4X4 <= m && m <= NEW4X4); - vp8_write_token(w, vp8_sub_mv_ref_tree, p, VP8_SUBMVREFENCODINGS + m); + vp8_write_token(w, vp8_sub_mv_ref_tree, p, + vp8_sub_mv_ref_encoding_array - LEFT4X4 + m); } static void write_mv @@ -869,6 +872,8 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi) int prob_skip_false = 0; ms = pc->mi - 1; + cpi->mb.partition_info = cpi->mb.pi; + // Calculate the probabilities to be used to code the reference frame based on actual useage this frame if (!(cpi->prob_intra_coded = rf_intra * 255 / (rf_intra + rf_inter))) cpi->prob_intra_coded = 1; @@ -1017,7 +1022,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi) do { - const B_MODE_INFO *const b = mi->partition_bmi + j; + const B_MODE_INFO *const b = cpi->mb.partition_info->bmi + j; const int *const L = vp8_mbsplits [mi->partitioning]; int k = -1; /* first block in subset j */ int mv_contz; @@ -1039,7 +1044,7 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi) write_mv(w, &b->mv.as_mv, &best_mv, (const MV_CONTEXT *) mvc); } } - while (++j < mi->partition_count); + while (++j < cpi->mb.partition_info->count); } break; default: @@ -1048,9 +1053,11 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi) } ++m; + cpi->mb.partition_info++; } ++m; /* skip L prediction border */ + cpi->mb.partition_info++; } } @@ -1483,9 +1490,11 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size) if (xd->mode_ref_lf_delta_enabled) { // Do the deltas need to be updated - vp8_write_bit(bc, (xd->mode_ref_lf_delta_update) ? 1 : 0); + int send_update = xd->mode_ref_lf_delta_update + || cpi->oxcf.error_resilient_mode; - if (xd->mode_ref_lf_delta_update) + vp8_write_bit(bc, send_update); + if (send_update) { int Data; @@ -1495,8 +1504,10 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size) Data = xd->ref_lf_deltas[i]; // Frame level data - if (Data) + if (xd->ref_lf_deltas[i] != xd->last_ref_lf_deltas[i] + || cpi->oxcf.error_resilient_mode) { + xd->last_ref_lf_deltas[i] = xd->ref_lf_deltas[i]; vp8_write_bit(bc, 1); if (Data > 0) @@ -1520,8 +1531,10 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size) { Data = xd->mode_lf_deltas[i]; - if (Data) + if (xd->mode_lf_deltas[i] != xd->last_mode_lf_deltas[i] + || cpi->oxcf.error_resilient_mode) { + xd->last_mode_lf_deltas[i] = xd->mode_lf_deltas[i]; vp8_write_bit(bc, 1); if (Data > 0) |