From d7eea782f28265968b469b5f24657291269fec27 Mon Sep 17 00:00:00 2001 From: Adrian Grange Date: Thu, 2 May 2013 16:41:19 -0700 Subject: [PATCH] Extend number of reference buffers to 8. The number of reference buffers is extended to 8 and a reference sign-bias added for the LAST_FRAME. Whilst the number of reference buffers used by an individual frame remains unchanged at 3, these may now be selected from 8 possible buffers. Change-Id: I2d247b9c1c2b3a339d6c9fac125e81ba373f75a7 --- vp9/common/vp9_entropymode.c | 3 +-- vp9/common/vp9_onyxc_int.h | 6 +----- vp9/decoder/vp9_decodframe.c | 7 +++++-- vp9/encoder/vp9_bitstream.c | 7 ++++--- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/vp9/common/vp9_entropymode.c b/vp9/common/vp9_entropymode.c index ed5441cc1..f0a5d97a9 100644 --- a/vp9/common/vp9_entropymode.c +++ b/vp9/common/vp9_entropymode.c @@ -771,8 +771,7 @@ void vp9_setup_past_independence(VP9_COMMON *cm, MACROBLOCKD *xd) { vp9_update_mode_info_border(cm, cm->prev_mip); vp9_update_mode_info_in_image(cm, cm->prev_mi); - cm->ref_frame_sign_bias[GOLDEN_FRAME] = 0; - cm->ref_frame_sign_bias[ALTREF_FRAME] = 0; + vpx_memset(cm->ref_frame_sign_bias, 0, sizeof(cm->ref_frame_sign_bias)); cm->frame_context_idx = 0; } diff --git a/vp9/common/vp9_onyxc_int.h b/vp9/common/vp9_onyxc_int.h index bb873c185..7ffd74c28 100644 --- a/vp9/common/vp9_onyxc_int.h +++ b/vp9/common/vp9_onyxc_int.h @@ -32,13 +32,9 @@ void vp9_initialize_common(void); -#if CONFIG_MULTIPLE_ARF +// Define the number of candidate reference buffers. #define NUM_REF_FRAMES 8 #define NUM_REF_FRAMES_LG2 3 -#else -#define NUM_REF_FRAMES 3 -#define NUM_REF_FRAMES_LG2 2 -#endif #define ALLOWED_REFS_PER_FRAME 3 diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c index f0948ba3e..edb9a9d44 100644 --- a/vp9/decoder/vp9_decodframe.c +++ b/vp9/decoder/vp9_decodframe.c @@ -1278,8 +1278,11 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) { vp9_setup_scale_factors_for_frame(sf, fb, pc->width, pc->height); } - pc->ref_frame_sign_bias[GOLDEN_FRAME] = vp9_read_bit(&header_bc); - pc->ref_frame_sign_bias[ALTREF_FRAME] = vp9_read_bit(&header_bc); + // Read the sign bias for each reference frame buffer. + for (i = 0; i < ALLOWED_REFS_PER_FRAME; ++i) { + pc->ref_frame_sign_bias[i + 1] = vp9_read_bit(&header_bc); + } + xd->allow_high_precision_mv = vp9_read_bit(&header_bc); pc->mcomp_filter_type = read_mcomp_filter_type(&header_bc); diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c index 8574ab866..6e527e5c7 100644 --- a/vp9/encoder/vp9_bitstream.c +++ b/vp9/encoder/vp9_bitstream.c @@ -1985,9 +1985,10 @@ void vp9_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, unsigned long *size) { vp9_write_literal(&header_bc, cpi->gld_fb_idx, NUM_REF_FRAMES_LG2); vp9_write_literal(&header_bc, cpi->alt_fb_idx, NUM_REF_FRAMES_LG2); - // Indicate reference frame sign bias for Golden and ARF frames (always 0 for last frame buffer) - vp9_write_bit(&header_bc, pc->ref_frame_sign_bias[GOLDEN_FRAME]); - vp9_write_bit(&header_bc, pc->ref_frame_sign_bias[ALTREF_FRAME]); + // Indicate the sign bias for each reference frame buffer. + for (i = 0; i < ALLOWED_REFS_PER_FRAME; ++i) { + vp9_write_bit(&header_bc, pc->ref_frame_sign_bias[LAST_FRAME + i]); + } // Signal whether to allow high MV precision vp9_write_bit(&header_bc, (xd->allow_high_precision_mv) ? 1 : 0); -- 2.40.0