Commit 59c4c101 authored by Yaowu Xu's avatar Yaowu Xu

misc-fix: move tx_mode out of arithmetic coding

This commit merges the fix that move coding of tx_mode out of
arithmetic coding.

Related tracking issue:
https://bugs.chromium.org/p/webm/issues/detail?id=1040
point #3
Original libvpx commit:
00a203b7

Change-Id: I4902e79a2c07bd4c6853257123dc92abd13922c7
parent cf9d7c99
......@@ -112,17 +112,9 @@ static int decode_unsigned_max(struct aom_read_bit_buffer *rb, int max) {
return data > max ? max : data;
}
#if CONFIG_MISC_FIXES
static TX_MODE read_tx_mode(struct aom_read_bit_buffer *rb) {
return aom_rb_read_bit(rb) ? TX_MODE_SELECT : aom_rb_read_literal(rb, 2);
}
#else
static TX_MODE read_tx_mode(aom_reader *r) {
TX_MODE tx_mode = aom_read_literal(r, 2, ACCT_STR);
if (tx_mode == ALLOW_32X32) tx_mode += aom_read_bit(r, ACCT_STR);
return tx_mode;
}
#endif
static void read_tx_mode_probs(struct tx_probs *tx_probs, aom_reader *r) {
int i, j;
......@@ -1988,9 +1980,9 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
}
setup_segmentation_dequant(cm);
#if CONFIG_MISC_FIXES
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
......@@ -2032,9 +2024,6 @@ static void read_ext_tx_probs(FRAME_CONTEXT *fc, aom_reader *r) {
static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
size_t partition_size) {
AV1_COMMON *const cm = &pbi->common;
#if !CONFIG_MISC_FIXES
MACROBLOCKD *const xd = &pbi->mb;
#endif
FRAME_CONTEXT *const fc = cm->fc;
aom_reader r;
int k, i, j;
......@@ -2044,9 +2033,6 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
aom_internal_error(&cm->error, AOM_CODEC_MEM_ERROR,
"Failed to allocate bool decoder 0");
#if !CONFIG_MISC_FIXES
cm->tx_mode = xd->lossless[0] ? ONLY_4X4 : read_tx_mode(&r);
#endif
if (cm->tx_mode == TX_MODE_SELECT) read_tx_mode_probs(&fc->tx_probs, &r);
read_coef_probs(fc, cm->tx_mode, &r);
......
......@@ -1589,17 +1589,10 @@ static void update_seg_probs(AV1_COMP *cpi, aom_writer *w) {
#endif
}
#if CONFIG_MISC_FIXES
static void write_txfm_mode(TX_MODE mode, struct aom_write_bit_buffer *wb) {
aom_wb_write_bit(wb, mode == TX_MODE_SELECT);
if (mode != TX_MODE_SELECT) aom_wb_write_literal(wb, mode, 2);
}
#else
static void write_txfm_mode(TX_MODE mode, aom_writer *wb) {
aom_write_literal(wb, AOMMIN(mode, ALLOW_32X32), 2);
if (mode >= ALLOW_32X32) aom_write_bit(wb, mode == TX_MODE_SELECT);
}
#endif
static void update_txfm_probs(AV1_COMMON *cm, aom_writer *w,
FRAME_COUNTS *counts) {
......@@ -2131,11 +2124,11 @@ static void write_uncompressed_header(AV1_COMP *cpi,
}
#endif
#if CONFIG_MISC_FIXES
if (!cm->seg.enabled && xd->lossless[0])
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;
......@@ -2171,16 +2164,7 @@ static size_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
aom_start_encode(header_bc, data);
#endif
#if !CONFIG_MISC_FIXES
if (cpi->td.mb.e_mbd.lossless[0]) {
cm->tx_mode = TX_4X4;
} else {
write_txfm_mode(cm->tx_mode, header_bc);
update_txfm_probs(cm, header_bc, counts);
}
#else
update_txfm_probs(cm, header_bc, counts);
#endif
update_coef_probs(cpi, header_bc);
update_skip_probs(cm, header_bc, counts);
#if CONFIG_DELTA_Q
......
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