vp10: move coding of tx_mode element to the non-arithcoded header.
See issue 1040 point 3. Change-Id: If051b92c24a34d6a39861fb7d7180c5ca32f3d82
This commit is contained in:
parent
a3df343cda
commit
00a203b7bc
@ -81,12 +81,18 @@ static int decode_unsigned_max(struct vpx_read_bit_buffer *rb, int max) {
|
||||
return data > max ? max : data;
|
||||
}
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
static TX_MODE read_tx_mode(struct vpx_read_bit_buffer *rb) {
|
||||
return vpx_rb_read_bit(rb) ? TX_MODE_SELECT : vpx_rb_read_literal(rb, 2);
|
||||
}
|
||||
#else
|
||||
static TX_MODE read_tx_mode(vpx_reader *r) {
|
||||
TX_MODE tx_mode = vpx_read_literal(r, 2);
|
||||
if (tx_mode == ALLOW_32X32)
|
||||
tx_mode += vpx_read_bit(r);
|
||||
return tx_mode;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void read_tx_mode_probs(struct tx_probs *tx_probs, vpx_reader *r) {
|
||||
int i, j;
|
||||
@ -1787,6 +1793,9 @@ static void read_bitdepth_colorspace_sampling(
|
||||
static size_t read_uncompressed_header(VP10Decoder *pbi,
|
||||
struct vpx_read_bit_buffer *rb) {
|
||||
VP10_COMMON *const cm = &pbi->common;
|
||||
#if CONFIG_MISC_FIXES
|
||||
MACROBLOCKD *const xd = &pbi->mb;
|
||||
#endif
|
||||
BufferPool *const pool = cm->buffer_pool;
|
||||
RefCntBuffer *const frame_bufs = pool->frame_bufs;
|
||||
int i, mask, ref_index = 0;
|
||||
@ -2011,6 +2020,9 @@ static size_t read_uncompressed_header(VP10Decoder *pbi,
|
||||
setup_quantization(cm, &pbi->mb, rb);
|
||||
setup_segmentation(cm, rb);
|
||||
setup_segmentation_dequant(cm);
|
||||
#if CONFIG_MISC_FIXES
|
||||
cm->tx_mode = xd->lossless ? ONLY_4X4 : read_tx_mode(rb);
|
||||
#endif
|
||||
|
||||
setup_tile_info(cm, rb);
|
||||
sz = vpx_rb_read_literal(rb, 16);
|
||||
@ -2025,7 +2037,9 @@ static size_t read_uncompressed_header(VP10Decoder *pbi,
|
||||
static int read_compressed_header(VP10Decoder *pbi, const uint8_t *data,
|
||||
size_t partition_size) {
|
||||
VP10_COMMON *const cm = &pbi->common;
|
||||
#if !CONFIG_MISC_FIXES
|
||||
MACROBLOCKD *const xd = &pbi->mb;
|
||||
#endif
|
||||
FRAME_CONTEXT *const fc = cm->fc;
|
||||
vpx_reader r;
|
||||
int k;
|
||||
@ -2035,7 +2049,9 @@ static int read_compressed_header(VP10Decoder *pbi, const uint8_t *data,
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
|
||||
"Failed to allocate bool decoder 0");
|
||||
|
||||
#if !CONFIG_MISC_FIXES
|
||||
cm->tx_mode = xd->lossless ? 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);
|
||||
|
@ -818,14 +818,25 @@ static void encode_segmentation(VP10_COMMON *cm, MACROBLOCKD *xd,
|
||||
}
|
||||
}
|
||||
|
||||
static void encode_txfm_probs(VP10_COMMON *cm, vpx_writer *w,
|
||||
#if CONFIG_MISC_FIXES
|
||||
static void write_txfm_mode(TX_MODE mode, struct vpx_write_bit_buffer *wb) {
|
||||
vpx_wb_write_bit(wb, mode == TX_MODE_SELECT);
|
||||
if (mode != TX_MODE_SELECT)
|
||||
vpx_wb_write_literal(wb, mode, 2);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void update_txfm_probs(VP10_COMMON *cm, vpx_writer *w,
|
||||
FRAME_COUNTS *counts) {
|
||||
#if !CONFIG_MISC_FIXES
|
||||
// Mode
|
||||
vpx_write_literal(w, VPXMIN(cm->tx_mode, ALLOW_32X32), 2);
|
||||
if (cm->tx_mode >= ALLOW_32X32)
|
||||
vpx_write_bit(w, cm->tx_mode == TX_MODE_SELECT);
|
||||
|
||||
// Probabilities
|
||||
#endif
|
||||
|
||||
if (cm->tx_mode == TX_MODE_SELECT) {
|
||||
int i, j;
|
||||
unsigned int ct_8x8p[TX_SIZES - 3][2];
|
||||
@ -1154,24 +1165,32 @@ static void write_uncompressed_header(VP10_COMP *cpi,
|
||||
encode_loopfilter(&cm->lf, wb);
|
||||
encode_quantization(cm, wb);
|
||||
encode_segmentation(cm, xd, wb);
|
||||
#if CONFIG_MISC_FIXES
|
||||
if (xd->lossless)
|
||||
cm->tx_mode = TX_4X4;
|
||||
else
|
||||
write_txfm_mode(cm->tx_mode, wb);
|
||||
#endif
|
||||
|
||||
write_tile_info(cm, wb);
|
||||
}
|
||||
|
||||
static size_t write_compressed_header(VP10_COMP *cpi, uint8_t *data) {
|
||||
VP10_COMMON *const cm = &cpi->common;
|
||||
MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
|
||||
FRAME_CONTEXT *const fc = cm->fc;
|
||||
FRAME_COUNTS *counts = cpi->td.counts;
|
||||
vpx_writer header_bc;
|
||||
|
||||
vpx_start_encode(&header_bc, data);
|
||||
|
||||
if (xd->lossless)
|
||||
cm->tx_mode = ONLY_4X4;
|
||||
#if !CONFIG_MISC_FIXES
|
||||
if (cpi->td.mb.e_mbd.lossless)
|
||||
cm->tx_mode = TX_4X4;
|
||||
else
|
||||
encode_txfm_probs(cm, &header_bc, counts);
|
||||
|
||||
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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user