vp10: code reference_mode in uncompressed header.

See issue 1041 point 2.

Change-Id: I6fc6427b1a0edff828e39d43428e3271491f8ac5
This commit is contained in:
Ronald S. Bultje 2015-09-25 20:32:14 -04:00
Родитель 034c28b0a4
Коммит 8979e9e387
2 изменённых файлов: 32 добавлений и 1 удалений

Просмотреть файл

@ -124,6 +124,18 @@ static void read_inter_mode_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
vp10_diff_update_prob(r, &fc->inter_mode_probs[i][j]);
}
#if CONFIG_MISC_FIXES
static REFERENCE_MODE read_frame_reference_mode(const VP10_COMMON *cm,
struct vpx_read_bit_buffer *rb) {
if (is_compound_reference_allowed(cm)) {
return vpx_rb_read_bit(rb) ? REFERENCE_MODE_SELECT
: (vpx_rb_read_bit(rb) ? COMPOUND_REFERENCE
: SINGLE_REFERENCE);
} else {
return SINGLE_REFERENCE;
}
}
#else
static REFERENCE_MODE read_frame_reference_mode(const VP10_COMMON *cm,
vpx_reader *r) {
if (is_compound_reference_allowed(cm)) {
@ -134,6 +146,7 @@ static REFERENCE_MODE read_frame_reference_mode(const VP10_COMMON *cm,
return SINGLE_REFERENCE;
}
}
#endif
static void read_frame_reference_mode_probs(VP10_COMMON *cm, vpx_reader *r) {
FRAME_CONTEXT *const fc = cm->fc;
@ -2023,6 +2036,7 @@ static size_t read_uncompressed_header(VP10Decoder *pbi,
setup_segmentation_dequant(cm);
#if CONFIG_MISC_FIXES
cm->tx_mode = xd->lossless ? ONLY_4X4 : read_tx_mode(rb);
cm->reference_mode = read_frame_reference_mode(cm, rb);
#endif
setup_tile_info(cm, rb);
@ -2072,7 +2086,9 @@ static int read_compressed_header(VP10Decoder *pbi, const uint8_t *data,
for (i = 0; i < INTRA_INTER_CONTEXTS; i++)
vp10_diff_update_prob(&r, &fc->intra_inter_prob[i]);
#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);

Просмотреть файл

@ -1169,6 +1169,14 @@ static void write_uncompressed_header(VP10_COMP *cpi,
cm->tx_mode = TX_4X4;
else
write_txfm_mode(cm->tx_mode, wb);
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;
vpx_wb_write_bit(wb, use_hybrid_pred);
if (!use_hybrid_pred)
vpx_wb_write_bit(wb, use_compound_pred);
}
#endif
write_tile_info(cm, wb);
@ -1208,8 +1216,9 @@ static size_t write_compressed_header(VP10_COMP *cpi, uint8_t *data) {
counts->intra_inter[i]);
if (cpi->allow_comp_inter_inter) {
const int use_compound_pred = cm->reference_mode != SINGLE_REFERENCE;
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;
vpx_write_bit(&header_bc, use_compound_pred);
if (use_compound_pred) {
@ -1219,6 +1228,12 @@ static size_t write_compressed_header(VP10_COMP *cpi, uint8_t *data) {
vp10_cond_prob_diff_update(&header_bc, &fc->comp_inter_prob[i],
counts->comp_inter[i]);
}
#else
if (use_hybrid_pred)
for (i = 0; i < COMP_INTER_CONTEXTS; i++)
vp10_cond_prob_diff_update(&header_bc, &fc->comp_inter_prob[i],
counts->comp_inter[i]);
#endif
}
if (cm->reference_mode != COMPOUND_REFERENCE) {