Commit c0b569a5 authored by Yaowu Xu's avatar Yaowu Xu

misc-fix: reference mode to uncompressed header

This commit merge the fix that moves coding of reference mode into
uncompressed header.

Related tracking isse:
https://bugs.chromium.org/p/webm/issues/detail?id=1041
point #2
Original libvpx commit:
8979e9e3

Change-Id: Ic2c3e05b6b53e3f1cd37657777f796b835edd586
parent bbc258cb
......@@ -168,7 +168,6 @@ static void read_inter_mode_probs(FRAME_CONTEXT *fc, aom_reader *r) {
#endif
}
#if CONFIG_MISC_FIXES
static REFERENCE_MODE read_frame_reference_mode(
const AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
if (is_compound_reference_allowed(cm)) {
......@@ -179,19 +178,6 @@ static REFERENCE_MODE read_frame_reference_mode(
return SINGLE_REFERENCE;
}
}
#else
static REFERENCE_MODE read_frame_reference_mode(const AV1_COMMON *cm,
aom_reader *r) {
if (is_compound_reference_allowed(cm)) {
return aom_read_bit(r, ACCT_STR)
? (aom_read_bit(r, ACCT_STR) ? REFERENCE_MODE_SELECT
: COMPOUND_REFERENCE)
: SINGLE_REFERENCE;
} else {
return SINGLE_REFERENCE;
}
}
#endif
static void read_frame_reference_mode_probs(AV1_COMMON *cm, aom_reader *r) {
FRAME_CONTEXT *const fc = cm->fc;
......@@ -1982,9 +1968,7 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
setup_segmentation_dequant(cm);
cm->tx_mode =
(!cm->seg.enabled && xd->lossless[0]) ? ONLY_4X4 : read_tx_mode(rb);
#if CONFIG_MISC_FIXES
cm->reference_mode = read_frame_reference_mode(cm, rb);
#endif
setup_tile_info(pbi, rb);
sz = aom_rb_read_literal(rb, 16);
......@@ -2110,9 +2094,6 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
for (i = 0; i < INTRA_INTER_CONTEXTS; i++)
av1_diff_update_prob(&r, &fc->intra_inter_prob[i], ACCT_STR);
#if !CONFIG_MISC_FIXES
cm->reference_mode = read_frame_reference_mode(cm, &r);
#endif
if (cm->reference_mode != SINGLE_REFERENCE)
setup_compound_reference_mode(cm);
read_frame_reference_mode_probs(cm, &r);
......
......@@ -2128,7 +2128,6 @@ static void write_uncompressed_header(AV1_COMP *cpi,
cm->tx_mode = TX_4X4;
else
write_txfm_mode(cm->tx_mode, wb);
#if CONFIG_MISC_FIXES
if (cpi->allow_comp_inter_inter) {
const int use_hybrid_pred = cm->reference_mode == REFERENCE_MODE_SELECT;
const int use_compound_pred = cm->reference_mode != SINGLE_REFERENCE;
......@@ -2136,7 +2135,6 @@ static void write_uncompressed_header(AV1_COMP *cpi,
aom_wb_write_bit(wb, use_hybrid_pred);
if (!use_hybrid_pred) aom_wb_write_bit(wb, use_compound_pred);
}
#endif
write_tile_info(cm, wb);
}
......@@ -2236,23 +2234,10 @@ static size_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
if (cpi->allow_comp_inter_inter) {
const int use_hybrid_pred = cm->reference_mode == REFERENCE_MODE_SELECT;
#if !CONFIG_MISC_FIXES
const int use_compound_pred = cm->reference_mode != SINGLE_REFERENCE;
aom_write_bit(header_bc, use_compound_pred);
if (use_compound_pred) {
aom_write_bit(header_bc, use_hybrid_pred);
if (use_hybrid_pred)
for (i = 0; i < COMP_INTER_CONTEXTS; i++)
av1_cond_prob_diff_update(header_bc, &fc->comp_inter_prob[i],
counts->comp_inter[i], probwt);
}
#else
if (use_hybrid_pred)
for (i = 0; i < COMP_INTER_CONTEXTS; i++)
av1_cond_prob_diff_update(header_bc, &fc->comp_inter_prob[i],
counts->comp_inter[i], probwt);
#endif
}
if (cm->reference_mode != COMPOUND_REFERENCE)
......
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