Commit 69fd030d authored by Dmitry Kovalev's avatar Dmitry Kovalev

Consistent names for reference_mode functions.

Change-Id: I48c9e5e4ca21e11740c750ca2eabf7e8a51c52d2
parent 35bd8868
...@@ -46,13 +46,13 @@ static int read_be32(const uint8_t *p) { ...@@ -46,13 +46,13 @@ static int read_be32(const uint8_t *p) {
static int is_compound_reference_allowed(const VP9_COMMON *cm) { static int is_compound_reference_allowed(const VP9_COMMON *cm) {
int i; int i;
for (i = 1; i < REFS_PER_FRAME; ++i) for (i = 1; i < REFS_PER_FRAME; ++i)
if (cm->ref_frame_sign_bias[i + 1] != cm->ref_frame_sign_bias[1]) if (cm->ref_frame_sign_bias[i + 1] != cm->ref_frame_sign_bias[1])
return 1; return 1;
return 0; return 0;
} }
static void setup_compound_reference(VP9_COMMON *cm) { static void setup_compound_reference_mode(VP9_COMMON *cm) {
if (cm->ref_frame_sign_bias[LAST_FRAME] == if (cm->ref_frame_sign_bias[LAST_FRAME] ==
cm->ref_frame_sign_bias[GOLDEN_FRAME]) { cm->ref_frame_sign_bias[GOLDEN_FRAME]) {
cm->comp_fixed_ref = ALTREF_FRAME; cm->comp_fixed_ref = ALTREF_FRAME;
...@@ -116,33 +116,34 @@ static void read_inter_mode_probs(FRAME_CONTEXT *fc, vp9_reader *r) { ...@@ -116,33 +116,34 @@ static void read_inter_mode_probs(FRAME_CONTEXT *fc, vp9_reader *r) {
vp9_diff_update_prob(r, &fc->inter_mode_probs[i][j]); vp9_diff_update_prob(r, &fc->inter_mode_probs[i][j]);
} }
static REFERENCE_MODE read_reference_mode(VP9_COMMON *cm, vp9_reader *r) { static REFERENCE_MODE read_frame_reference_mode(const VP9_COMMON *cm,
vp9_reader *r) {
if (is_compound_reference_allowed(cm)) { if (is_compound_reference_allowed(cm)) {
REFERENCE_MODE mode = vp9_read_bit(r); return vp9_read_bit(r) ? (vp9_read_bit(r) ? REFERENCE_MODE_SELECT
if (mode) : COMPOUND_REFERENCE)
mode += vp9_read_bit(r); : SINGLE_REFERENCE;
setup_compound_reference(cm);
return mode;
} else { } else {
return SINGLE_REFERENCE; return SINGLE_REFERENCE;
} }
} }
static void read_reference_mode_probs(VP9_COMMON *cm, vp9_reader *r) { static void read_frame_reference_mode_probs(VP9_COMMON *cm, vp9_reader *r) {
FRAME_CONTEXT *const fc = &cm->fc;
int i; int i;
if (cm->reference_mode == REFERENCE_MODE_SELECT) if (cm->reference_mode == REFERENCE_MODE_SELECT)
for (i = 0; i < COMP_INTER_CONTEXTS; i++) for (i = 0; i < COMP_INTER_CONTEXTS; ++i)
vp9_diff_update_prob(r, &cm->fc.comp_inter_prob[i]); vp9_diff_update_prob(r, &fc->comp_inter_prob[i]);
if (cm->reference_mode != COMPOUND_REFERENCE) if (cm->reference_mode != COMPOUND_REFERENCE)
for (i = 0; i < REF_CONTEXTS; i++) { for (i = 0; i < REF_CONTEXTS; ++i) {
vp9_diff_update_prob(r, &cm->fc.single_ref_prob[i][0]); vp9_diff_update_prob(r, &fc->single_ref_prob[i][0]);
vp9_diff_update_prob(r, &cm->fc.single_ref_prob[i][1]); vp9_diff_update_prob(r, &fc->single_ref_prob[i][1]);
} }
if (cm->reference_mode != SINGLE_REFERENCE) if (cm->reference_mode != SINGLE_REFERENCE)
for (i = 0; i < REF_CONTEXTS; i++) for (i = 0; i < REF_CONTEXTS; ++i)
vp9_diff_update_prob(r, &cm->fc.comp_ref_prob[i]); vp9_diff_update_prob(r, &fc->comp_ref_prob[i]);
} }
static void update_mv_probs(vp9_prob *p, int n, vp9_reader *r) { static void update_mv_probs(vp9_prob *p, int n, vp9_reader *r) {
...@@ -1265,8 +1266,10 @@ static int read_compressed_header(VP9D_COMP *pbi, const uint8_t *data, ...@@ -1265,8 +1266,10 @@ static int read_compressed_header(VP9D_COMP *pbi, const uint8_t *data,
for (i = 0; i < INTRA_INTER_CONTEXTS; i++) for (i = 0; i < INTRA_INTER_CONTEXTS; i++)
vp9_diff_update_prob(&r, &fc->intra_inter_prob[i]); vp9_diff_update_prob(&r, &fc->intra_inter_prob[i]);
cm->reference_mode = read_reference_mode(cm, &r); cm->reference_mode = read_frame_reference_mode(cm, &r);
read_reference_mode_probs(cm, &r); if (cm->reference_mode != SINGLE_REFERENCE)
setup_compound_reference_mode(cm);
read_frame_reference_mode_probs(cm, &r);
for (j = 0; j < BLOCK_SIZE_GROUPS; j++) for (j = 0; j < BLOCK_SIZE_GROUPS; j++)
for (i = 0; i < INTRA_MODES - 1; ++i) for (i = 0; i < INTRA_MODES - 1; ++i)
......
...@@ -257,13 +257,18 @@ static INLINE void read_mv(vp9_reader *r, MV *mv, const MV *ref, ...@@ -257,13 +257,18 @@ static INLINE void read_mv(vp9_reader *r, MV *mv, const MV *ref,
mv->col = ref->col + diff.col; mv->col = ref->col + diff.col;
} }
static REFERENCE_MODE read_reference_mode(VP9_COMMON *cm, const MACROBLOCKD *xd, static REFERENCE_MODE read_block_reference_mode(VP9_COMMON *cm,
vp9_reader *r) { const MACROBLOCKD *xd,
const int ctx = vp9_get_reference_mode_context(cm, xd); vp9_reader *r) {
const int mode = vp9_read(r, cm->fc.comp_inter_prob[ctx]); if (cm->reference_mode == REFERENCE_MODE_SELECT) {
if (!cm->frame_parallel_decoding_mode) const int ctx = vp9_get_reference_mode_context(cm, xd);
++cm->counts.comp_inter[ctx][mode]; const int mode = vp9_read(r, cm->fc.comp_inter_prob[ctx]);
return mode; // SINGLE_REFERENCE or COMPOUND_REFERENCE if (!cm->frame_parallel_decoding_mode)
++cm->counts.comp_inter[ctx][mode];
return mode; // SINGLE_REFERENCE or COMPOUND_REFERENCE
} else {
return cm->reference_mode;
}
} }
// Read the referncence frame // Read the referncence frame
...@@ -277,10 +282,7 @@ static void read_ref_frames(VP9_COMMON *const cm, MACROBLOCKD *const xd, ...@@ -277,10 +282,7 @@ static void read_ref_frames(VP9_COMMON *const cm, MACROBLOCKD *const xd,
ref_frame[0] = vp9_get_segdata(&cm->seg, segment_id, SEG_LVL_REF_FRAME); ref_frame[0] = vp9_get_segdata(&cm->seg, segment_id, SEG_LVL_REF_FRAME);
ref_frame[1] = NONE; ref_frame[1] = NONE;
} else { } else {
const REFERENCE_MODE mode = (cm->reference_mode == REFERENCE_MODE_SELECT) const REFERENCE_MODE mode = read_block_reference_mode(cm, xd, r);
? read_reference_mode(cm, xd, r)
: cm->reference_mode;
// FIXME(rbultje) I'm pretty sure this breaks segmentation ref frame coding // FIXME(rbultje) I'm pretty sure this breaks segmentation ref frame coding
if (mode == COMPOUND_REFERENCE) { if (mode == COMPOUND_REFERENCE) {
const int idx = cm->ref_frame_sign_bias[cm->comp_fixed_ref]; const int idx = cm->ref_frame_sign_bias[cm->comp_fixed_ref];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment