summaryrefslogtreecommitdiff
path: root/vp8/decoder
diff options
context:
space:
mode:
Diffstat (limited to 'vp8/decoder')
-rw-r--r--vp8/decoder/asm_dec_offsets.c1
-rw-r--r--vp8/decoder/decodemv.c173
-rw-r--r--vp8/decoder/decodemv.h10
-rw-r--r--vp8/decoder/decodframe.c364
-rw-r--r--vp8/decoder/detokenize.c89
-rw-r--r--vp8/decoder/detokenize.h11
-rw-r--r--vp8/decoder/onyxd_if.c2
-rw-r--r--vp8/decoder/onyxd_int.h5
8 files changed, 254 insertions, 401 deletions
diff --git a/vp8/decoder/asm_dec_offsets.c b/vp8/decoder/asm_dec_offsets.c
index 1a6090b2b..8551bab10 100644
--- a/vp8/decoder/asm_dec_offsets.c
+++ b/vp8/decoder/asm_dec_offsets.c
@@ -24,7 +24,6 @@ DEFINE(detok_A, offsetof(DETOK, A));
DEFINE(detok_L, offsetof(DETOK, L));
DEFINE(detok_qcoeff_start_ptr, offsetof(DETOK, qcoeff_start_ptr));
-DEFINE(detok_current_bc, offsetof(DETOK, current_bc));
DEFINE(detok_coef_probs, offsetof(DETOK, coef_probs));
DEFINE(detok_eob, offsetof(DETOK, eob));
diff --git a/vp8/decoder/decodemv.c b/vp8/decoder/decodemv.c
index fa15af9e9..72ff126f2 100644
--- a/vp8/decoder/decodemv.c
+++ b/vp8/decoder/decodemv.c
@@ -18,7 +18,7 @@
#include "vp8/common/seg_common.h"
#include "vp8/common/pred_common.h"
#include "vp8/common/entropy.h"
-
+#include "vp8/decoder/decodemv.h"
#if CONFIG_DEBUG
#include <assert.h>
#endif
@@ -73,12 +73,12 @@ static void vp8_read_mb_segid(vp8_reader *r, MB_MODE_INFO *mi,
}
extern const int vp8_i8x8_block[4];
-static void vp8_kfread_modes(VP8D_COMP *pbi,
- MODE_INFO *m,
- int mb_row,
- int mb_col) {
- VP8_COMMON *const cm = & pbi->common;
- vp8_reader *const bc = & pbi->bc;
+static void kfread_modes(VP8D_COMP *pbi,
+ MODE_INFO *m,
+ int mb_row,
+ int mb_col,
+ BOOL_DECODER* const bc) {
+ VP8_COMMON *const cm = &pbi->common;
const int mis = pbi->common.mode_info_stride;
int map_index = mb_row * pbi->common.mb_cols + mb_col;
MB_PREDICTION_MODE y_mode;
@@ -97,7 +97,7 @@ static void vp8_kfread_modes(VP8D_COMP *pbi,
m->mbmi.segment_id, SEG_LVL_EOB) ||
(get_segdata(&pbi->mb,
m->mbmi.segment_id, SEG_LVL_EOB) != 0))) {
- MACROBLOCKD *const xd = & pbi->mb;
+ MACROBLOCKD *const xd = &pbi->mb;
m->mbmi.mb_skip_coeff = vp8_read(bc, get_pred_prob(cm, xd, PRED_MBSKIP));
} else {
if (segfeature_active(&pbi->mb,
@@ -458,7 +458,7 @@ static MV_REFERENCE_FRAME read_ref_frame(VP8D_COMP *pbi,
int seg_ref_active;
int seg_ref_count = 0;
- VP8_COMMON *const cm = & pbi->common;
+ VP8_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
seg_ref_active = segfeature_active(xd,
@@ -597,9 +597,9 @@ static const unsigned char mbsplit_fill_offset[4][16] = {
};
#if CONFIG_SWITCHABLE_INTERP
-static void read_switchable_interp_probs(VP8D_COMP *pbi) {
- VP8_COMMON *const cm = & pbi->common;
- vp8_reader *const bc = & pbi->bc;
+static void read_switchable_interp_probs(VP8D_COMP* const pbi,
+ BOOL_DECODER* const bc) {
+ VP8_COMMON *const cm = &pbi->common;
int i, j;
for (j = 0; j <= VP8_SWITCHABLE_FILTERS; ++j) {
//for (j = 0; j <= 0; ++j) {
@@ -612,25 +612,20 @@ static void read_switchable_interp_probs(VP8D_COMP *pbi) {
}
#endif
-static void mb_mode_mv_init(VP8D_COMP *pbi) {
- VP8_COMMON *const cm = & pbi->common;
- vp8_reader *const bc = & pbi->bc;
+static void mb_mode_mv_init(VP8D_COMP *pbi, vp8_reader *bc) {
+ VP8_COMMON *const cm = &pbi->common;
#if CONFIG_NEWMVENTROPY
nmv_context *const nmvc = &pbi->common.fc.nmvc;
#else
MV_CONTEXT *const mvc = pbi->common.fc.mvc;
MV_CONTEXT_HP *const mvc_hp = pbi->common.fc.mvc_hp;
#endif
- MACROBLOCKD *const xd = & pbi->mb;
-
- vpx_memset(cm->mbskip_pred_probs, 0, sizeof(cm->mbskip_pred_probs));
- if (pbi->common.mb_no_coeff_skip) {
- int k;
- for (k = 0; k < MBSKIP_CONTEXTS; ++k)
- cm->mbskip_pred_probs[k] = (vp8_prob)vp8_read_literal(bc, 8);
- }
+ MACROBLOCKD *const xd = &pbi->mb;
- if (cm->frame_type != KEY_FRAME) {
+ if (cm->frame_type == KEY_FRAME) {
+ if (!cm->kf_ymode_probs_update)
+ cm->kf_ymode_probs_index = vp8_read_literal(bc, 3);
+ } else {
#if CONFIG_PRED_FILTER
cm->pred_filter_mode = (vp8_prob)vp8_read_literal(bc, 2);
@@ -639,7 +634,7 @@ static void mb_mode_mv_init(VP8D_COMP *pbi) {
#endif
#if CONFIG_SWITCHABLE_INTERP
if (cm->mcomp_filter_type == SWITCHABLE)
- read_switchable_interp_probs(pbi);
+ read_switchable_interp_probs(pbi, bc);
#endif
// Decode the baseline probabilities for decoding reference frame
cm->prob_intra_coded = (vp8_prob)vp8_read_literal(bc, 8);
@@ -681,10 +676,10 @@ static void mb_mode_mv_init(VP8D_COMP *pbi) {
// the bitstream or if the value is temporally predicted asserts the predicted
// value
static void read_mb_segment_id(VP8D_COMP *pbi,
- int mb_row, int mb_col) {
- vp8_reader *const bc = & pbi->bc;
- VP8_COMMON *const cm = & pbi->common;
- MACROBLOCKD *const xd = & pbi->mb;
+ int mb_row, int mb_col,
+ BOOL_DECODER* const bc) {
+ VP8_COMMON *const cm = &pbi->common;
+ MACROBLOCKD *const xd = &pbi->mb;
MODE_INFO *mi = xd->mode_info_context;
MB_MODE_INFO *mbmi = &mi->mbmi;
int index = mb_row * pbi->common.mb_cols + mb_col;
@@ -753,9 +748,9 @@ static void read_mb_segment_id(VP8D_COMP *pbi,
static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
MODE_INFO *prev_mi,
- int mb_row, int mb_col) {
- VP8_COMMON *const cm = & pbi->common;
- vp8_reader *const bc = & pbi->bc;
+ int mb_row, int mb_col,
+ BOOL_DECODER* const bc) {
+ VP8_COMMON *const cm = &pbi->common;
#if CONFIG_NEWMVENTROPY
nmv_context *const nmvc = &pbi->common.fc.nmvc;
#else
@@ -763,9 +758,9 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
MV_CONTEXT_HP *const mvc_hp = pbi->common.fc.mvc_hp;
#endif
const int mis = pbi->common.mode_info_stride;
- MACROBLOCKD *const xd = & pbi->mb;
+ MACROBLOCKD *const xd = &pbi->mb;
- int_mv *const mv = & mbmi->mv;
+ int_mv *const mv = &mbmi->mv;
int mb_to_left_edge;
int mb_to_right_edge;
int mb_to_top_edge;
@@ -795,7 +790,7 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
xd->prev_mode_info_context = prev_mi;
// Read the macroblock segment id.
- read_mb_segment_id(pbi, mb_row, mb_col);
+ read_mb_segment_id(pbi, mb_row, mb_col, bc);
if (pbi->common.mb_no_coeff_skip &&
(!segfeature_active(xd,
@@ -1239,6 +1234,14 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
#endif
do {
mi->bmi[j].as_mode.first = (B_PREDICTION_MODE)vp8_read_bmode(bc, pbi->common.fc.bmode_prob);
+ /*
+ {
+ int p;
+ for (p = 0; p < VP8_BINTRAMODES - 1; ++p)
+ printf(" %d", pbi->common.fc.bmode_prob[p]);
+ printf("\nbmode[%d][%d]: %d\n", pbi->common.current_video_frame, j, mi->bmi[j].as_mode.first);
+ }
+ */
pbi->common.fc.bmode_counts[mi->bmi[j].as_mode.first]++;
#if CONFIG_COMP_INTRA_PRED
if (use_comp_pred) {
@@ -1302,106 +1305,28 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
}
}
-void vp8_decode_mode_mvs(VP8D_COMP *pbi) {
- int i;
+void vpx_decode_mode_mvs_init(VP8D_COMP *pbi, BOOL_DECODER* const bc) {
VP8_COMMON *cm = &pbi->common;
- MODE_INFO *mi = cm->mi;
- MACROBLOCKD *const xd = &pbi->mb;
- int sb_row, sb_col;
- int sb_rows = (cm->mb_rows + 1) >> 1;
- int sb_cols = (cm->mb_cols + 1) >> 1;
- int row_delta[4] = { 0, +1, 0, -1};
- int col_delta[4] = { +1, -1, +1, +1};
-
- MODE_INFO *prev_mi = cm->prev_mi;
-
- mb_mode_mv_init(pbi);
- if (cm->frame_type == KEY_FRAME && !cm->kf_ymode_probs_update) {
- cm->kf_ymode_probs_index = vp8_read_literal(&pbi->bc, 3);
- }
-
- for (sb_row = 0; sb_row < sb_rows; sb_row++) {
- int mb_col = 0;
- int mb_row = (sb_row << 1);
-
- for (sb_col = 0; sb_col < sb_cols; sb_col++) {
-#if CONFIG_SUPERBLOCKS
- mi->mbmi.encoded_as_sb = vp8_read(&pbi->bc, cm->sb_coded);
-#endif
- for (i = 0; i < 4; i++) {
-
- int dy = row_delta[i];
- int dx = col_delta[i];
- int offset_extended = dy * cm->mode_info_stride + dx;
-
- if ((mb_row >= cm->mb_rows) || (mb_col >= cm->mb_cols)) {
- /* next macroblock */
- mb_row += dy;
- mb_col += dx;
- mi += offset_extended;
- prev_mi += offset_extended;
- continue;
- }
-#if CONFIG_SUPERBLOCKS
- if (i)
- mi->mbmi.encoded_as_sb = 0;
-#endif
-
- // Make sure the MacroBlockD mode info pointer is set correctly
- xd->mode_info_context = mi;
- xd->prev_mode_info_context = prev_mi;
-
- pbi->mb.mb_to_top_edge = -((mb_row * 16)) << 3;
- pbi->mb.mb_to_bottom_edge =
- ((pbi->common.mb_rows - 1 - mb_row) * 16) << 3;
-
- if (cm->frame_type == KEY_FRAME)
- vp8_kfread_modes(pbi, mi, mb_row, mb_col);
- else
- read_mb_modes_mv(pbi, mi, &mi->mbmi, prev_mi, mb_row,
- mb_col);
-
-#if CONFIG_SUPERBLOCKS
- if (mi->mbmi.encoded_as_sb) {
- assert(!i);
- mb_col += 2;
- mi[1] = mi[cm->mode_info_stride] =
- mi[cm->mode_info_stride + 1] = mi[0];
- mi += 2;
- prev_mi += 2;
- break;
- }
-#endif
-
- /* next macroblock */
- mb_row += dy;
- mb_col += dx;
- mi += offset_extended;
- prev_mi += offset_extended;
- }
- }
-
- mi += cm->mode_info_stride + (1 - (cm->mb_cols & 0x1));
- prev_mi += cm->mode_info_stride + (1 - (cm->mb_cols & 0x1));
+ vpx_memset(cm->mbskip_pred_probs, 0, sizeof(cm->mbskip_pred_probs));
+ if (pbi->common.mb_no_coeff_skip) {
+ int k;
+ for (k = 0; k < MBSKIP_CONTEXTS; ++k)
+ cm->mbskip_pred_probs[k] = (vp8_prob)vp8_read_literal(bc, 8);
}
-}
-void vpx_decode_mode_mvs_init(VP8D_COMP *pbi){
- VP8_COMMON *cm = &pbi->common;
- mb_mode_mv_init(pbi);
- if (cm->frame_type == KEY_FRAME && !cm->kf_ymode_probs_update)
- cm->kf_ymode_probs_index = vp8_read_literal(&pbi->bc, 3);
+ mb_mode_mv_init(pbi, bc);
}
void vpx_decode_mb_mode_mv(VP8D_COMP *pbi,
MACROBLOCKD *xd,
int mb_row,
- int mb_col){
+ int mb_col,
+ BOOL_DECODER* const bc) {
MODE_INFO *mi = xd->mode_info_context;
MODE_INFO *prev_mi = xd->prev_mode_info_context;
if (pbi->common.frame_type == KEY_FRAME)
- vp8_kfread_modes(pbi, mi, mb_row, mb_col);
+ kfread_modes(pbi, mi, mb_row, mb_col, bc);
else
- read_mb_modes_mv(pbi, mi, &mi->mbmi, prev_mi, mb_row, mb_col);
+ read_mb_modes_mv(pbi, mi, &mi->mbmi, prev_mi, mb_row, mb_col, bc);
}
diff --git a/vp8/decoder/decodemv.h b/vp8/decoder/decodemv.h
index 17bbb5b67..bfb815f6f 100644
--- a/vp8/decoder/decodemv.h
+++ b/vp8/decoder/decodemv.h
@@ -11,9 +11,9 @@
#include "onyxd_int.h"
-void vp8_decode_mode_mvs(VP8D_COMP *);
-void vpx_decode_mb_mode_mv(VP8D_COMP *pbi,
- MACROBLOCKD *xd,
+void vpx_decode_mb_mode_mv(VP8D_COMP* const pbi,
+ MACROBLOCKD* const xd,
int mb_row,
- int mb_col);
-void vpx_decode_mode_mvs_init(VP8D_COMP *pbi);
+ int mb_col,
+ BOOL_DECODER* const bc);
+void vpx_decode_mode_mvs_init(VP8D_COMP* const pbi, BOOL_DECODER* const bc);
diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c
index cd9b7d247..01739c0db 100644
--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -77,7 +77,7 @@ static vp8_prob read_prob_diff_update(vp8_reader *const bc, int oldp) {
void vp8cx_init_de_quantizer(VP8D_COMP *pbi) {
int i;
int Q;
- VP8_COMMON *const pc = & pbi->common;
+ VP8_COMMON *const pc = &pbi->common;
for (Q = 0; Q < QINDEX_RANGE; Q++) {
pc->Y1dequant[Q][0] = (short)vp8_dc_quant(Q, pc->y1dc_delta_q);
@@ -98,7 +98,7 @@ void vp8cx_init_de_quantizer(VP8D_COMP *pbi) {
void mb_init_dequantizer(VP8D_COMP *pbi, MACROBLOCKD *xd) {
int i;
int QIndex;
- VP8_COMMON *const pc = & pbi->common;
+ VP8_COMMON *const pc = &pbi->common;
int segment_id = xd->mode_info_context->mbmi.segment_id;
// Set the Q baseline allowing for any segment level adjustment
@@ -115,17 +115,13 @@ void mb_init_dequantizer(VP8D_COMP *pbi, MACROBLOCKD *xd) {
}
} else
QIndex = pc->base_qindex;
+ xd->q_index = QIndex;
/* Set up the block level dequant pointers */
for (i = 0; i < 16; i++) {
xd->block[i].dequant = pc->Y1dequant[QIndex];
}
-#if CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM16X16
- xd->q_index = QIndex;
-#endif
-
-
#if CONFIG_LOSSLESS
if (!QIndex) {
pbi->common.rtcd.idct.idct1 = vp8_short_inv_walsh4x4_1_x8_c;
@@ -206,25 +202,21 @@ static void skip_recon_mb(VP8D_COMP *pbi, MACROBLOCKD *xd) {
}
static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
- unsigned int mb_col) {
+ unsigned int mb_col,
+ BOOL_DECODER* const bc) {
int eobtotal = 0;
MB_PREDICTION_MODE mode;
int i;
- int tx_type;
+ int tx_size;
+#if CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM8X8 || \
+ CONFIG_HYBRIDTRANSFORM16X16
+ TX_TYPE tx_type;
+#endif
#if CONFIG_SUPERBLOCKS
VP8_COMMON *pc = &pbi->common;
int orig_skip_flag = xd->mode_info_context->mbmi.mb_skip_coeff;
#endif
-#if CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
- int QIndex;
- int active_ht;
-#endif
-
-#if CONFIG_HYBRIDTRANSFORM16X16
- int active_ht16;
-#endif
-
// re-initialize macroblock dequantizer before detokenization
if (xd->segmentation_enabled)
mb_init_dequantizer(pbi, xd);
@@ -235,43 +227,9 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
}
#endif
- tx_type = xd->mode_info_context->mbmi.txfm_size;
+ tx_size = xd->mode_info_context->mbmi.txfm_size;
mode = xd->mode_info_context->mbmi.mode;
-#if CONFIG_HYBRIDTRANSFORM
- // parse transform types for intra 4x4 mode
- QIndex = xd->q_index;
- active_ht = (QIndex < ACTIVE_HT);
- if (mode == B_PRED) {
- for (i = 0; i < 16; i++) {
- BLOCKD *b = &xd->block[i];
- int b_mode = xd->mode_info_context->bmi[i].as_mode.first;
- if(active_ht)
- txfm_map(b, b_mode);
- } // loop over 4x4 blocks
- }
-#endif
-
-#if CONFIG_HYBRIDTRANSFORM8X8
- if (mode == I8X8_PRED) {
- for (i = 0; i < 4; i++) {
- int ib = vp8_i8x8_block[i];
- BLOCKD *b = &xd->block[ib];
- int i8x8mode = b->bmi.as_mode.first;
- txfm_map(b, pred_mode_conv(i8x8mode));
- }
- }
-#endif
-
-#if CONFIG_HYBRIDTRANSFORM16X16
- active_ht16 = (QIndex < ACTIVE_HT16);
- if (mode < I8X8_PRED) {
- BLOCKD *b = &xd->block[0];
- if(active_ht16)
- txfm_map(b, pred_mode_conv(mode));
- }
-#endif
-
if (xd->mode_info_context->mbmi.mb_skip_coeff) {
vp8_reset_mb_tokens_context(xd);
#if CONFIG_SUPERBLOCKS
@@ -283,17 +241,18 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
xd->left_context--;
}
#endif
- } else if (!vp8dx_bool_error(xd->current_bc)) {
+ } else if (!vp8dx_bool_error(bc)) {
for (i = 0; i < 25; i++) {
xd->block[i].eob = 0;
xd->eobs[i] = 0;
}
- if (tx_type == TX_16X16)
- eobtotal = vp8_decode_mb_tokens_16x16(pbi, xd);
- else if (tx_type == TX_8X8)
- eobtotal = vp8_decode_mb_tokens_8x8(pbi, xd);
- else
- eobtotal = vp8_decode_mb_tokens(pbi, xd);
+ if (tx_size == TX_16X16) {
+ eobtotal = vp8_decode_mb_tokens_16x16(pbi, xd, bc);
+ } else if (tx_size == TX_8X8) {
+ eobtotal = vp8_decode_mb_tokens_8x8(pbi, xd, bc);
+ } else {
+ eobtotal = vp8_decode_mb_tokens(pbi, xd, bc);
+ }
}
//mode = xd->mode_info_context->mbmi.mode;
@@ -305,8 +264,7 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
if (eobtotal == 0 && mode != B_PRED && mode != SPLITMV
&& mode != I8X8_PRED
- && !vp8dx_bool_error(xd->current_bc)
- ) {
+ && !vp8dx_bool_error(bc)) {
/* Special case: Force the loopfilter to skip when eobtotal and
* mb_skip_coeff are zero.
* */
@@ -338,13 +296,6 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
if (mode != B_PRED) {
vp8_build_intra_predictors_mby(xd);
}
-#if 0
- // Intra-modes requiring recon data from top-right
- // MB have been temporarily disabled.
- else {
- vp8_intra_prediction_down_copy(xd);
- }
-#endif
}
} else {
#if CONFIG_SUPERBLOCKS
@@ -380,13 +331,17 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
if (xd->mode_info_context->mbmi.txfm_size == TX_8X8) {
#if CONFIG_HYBRIDTRANSFORM8X8
- vp8_ht_dequant_idct_add_8x8_c(b->bmi.as_mode.tx_type,
- q, dq, pre, dst, 16, stride);
- q += 64;
+ tx_type = get_tx_type(xd, &xd->block[idx]);
+ if (tx_type != DCT_DCT) {
+ vp8_ht_dequant_idct_add_8x8_c(tx_type,
+ q, dq, pre, dst, 16, stride);
+ } else {
+ vp8_dequant_idct_add_8x8_c(q, dq, pre, dst, 16, stride);
+ }
#else
vp8_dequant_idct_add_8x8_c(q, dq, pre, dst, 16, stride);
- q += 64;
#endif
+ q += 64;
} else {
for (j = 0; j < 4; j++) {
b = &xd->block[ib + iblock[j]];
@@ -396,7 +351,7 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
}
b = &xd->block[16 + i];
- vp8_intra_uv4x4_predict(b, i8x8mode, b->predictor);
+ vp8_intra_uv4x4_predict(b, i8x8mode, b->predictor);
DEQUANT_INVOKE(&pbi->dequant, idct_add)(b->qcoeff, b->dequant,
b->predictor,
*(b->base_dst) + b->dst, 8,
@@ -409,6 +364,7 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
b->dst_stride);
}
} else if (mode == B_PRED) {
+ vp8_intra_prediction_down_copy(xd);
for (i = 0; i < 16; i++) {
BLOCKD *b = &xd->block[i];
int b_mode = xd->mode_info_context->bmi[i].as_mode.first;
@@ -425,16 +381,17 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
#endif
#if CONFIG_HYBRIDTRANSFORM
- if(active_ht)
- vp8_ht_dequant_idct_add_c( (TX_TYPE)b->bmi.as_mode.tx_type, b->qcoeff,
- b->dequant, b->predictor,
- *(b->base_dst) + b->dst, 16, b->dst_stride);
- else
+ tx_type = get_tx_type(xd, b);
+ if (tx_type != DCT_DCT) {
+ vp8_ht_dequant_idct_add_c(tx_type, b->qcoeff,
+ b->dequant, b->predictor,
+ *(b->base_dst) + b->dst, 16, b->dst_stride);
+ } else {
vp8_dequant_idct_add_c(b->qcoeff, b->dequant, b->predictor,
*(b->base_dst) + b->dst, 16, b->dst_stride);
+ }
#else
- if (xd->eobs[i] > 1)
- {
+ if (xd->eobs[i] > 1) {
DEQUANT_INVOKE(&pbi->dequant, idct_add)
(b->qcoeff, b->dequant, b->predictor,
*(b->base_dst) + b->dst, 16, b->dst_stride);
@@ -454,15 +411,12 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
} else {
BLOCKD *b = &xd->block[24];
- if (tx_type == TX_16X16) {
+ if (tx_size == TX_16X16) {
#if CONFIG_HYBRIDTRANSFORM16X16
- if (mode < I8X8_PRED && active_ht16) {
- BLOCKD *bd = &xd->block[0];
- TX_TYPE txfm;
- txfm_map(bd, pred_mode_conv(mode));
- txfm = bd->bmi.as_mode.tx_type;
-
- vp8_ht_dequant_idct_add_16x16_c(txfm, xd->qcoeff,
+ BLOCKD *bd = &xd->block[0];
+ tx_type = get_tx_type(xd, bd);
+ if (tx_type != DCT_DCT) {
+ vp8_ht_dequant_idct_add_16x16_c(tx_type, xd->qcoeff,
xd->block[0].dequant, xd->predictor,
xd->dst.y_buffer, 16, xd->dst.y_stride);
} else {
@@ -475,8 +429,7 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
xd->predictor, xd->dst.y_buffer,
16, xd->dst.y_stride);
#endif
- }
- else if (tx_type == TX_8X8) {
+ } else if (tx_size == TX_8X8) {
#if CONFIG_SUPERBLOCKS
void *orig = xd->mode_info_context;
int n, num = xd->mode_info_context->mbmi.encoded_as_sb ? 4 : 1;
@@ -492,7 +445,7 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
xd->mode_info_context += (n & 1);
xd->mode_info_context += (n >> 1) * pc->mode_info_stride;
if (!orig_skip_flag) {
- eobtotal = vp8_decode_mb_tokens_8x8(pbi, xd);
+ eobtotal = vp8_decode_mb_tokens_8x8(pbi, xd, bc);
if (eobtotal == 0) // skip loopfilter
xd->mode_info_context->mbmi.mb_skip_coeff = 1;
} else {
@@ -561,10 +514,9 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
#if CONFIG_SUPERBLOCKS
if (!xd->mode_info_context->mbmi.encoded_as_sb) {
#endif
- if ((tx_type == TX_8X8 &&
+ if ((tx_size == TX_8X8 &&
xd->mode_info_context->mbmi.mode != I8X8_PRED)
- || tx_type == TX_16X16
- )
+ || tx_size == TX_16X16)
DEQUANT_INVOKE(&pbi->dequant, idct_add_uv_block_8x8) //
(xd->qcoeff + 16 * 16, xd->block[16].dequant,
xd->predictor + 16 * 16, xd->dst.u_buffer, xd->dst.v_buffer,
@@ -604,7 +556,8 @@ FILE *vpxlog = 0;
/* Decode a row of Superblocks (2x2 region of MBs) */
static void
-decode_sb_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mbrow, MACROBLOCKD *xd) {
+decode_sb_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mbrow, MACROBLOCKD *xd,
+ BOOL_DECODER* const bc) {
int i;
int sb_col;
int mb_row, mb_col;
@@ -627,8 +580,7 @@ decode_sb_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mbrow, MACROBLOCKD *xd) {
MODE_INFO *mi = xd->mode_info_context;
#if CONFIG_SUPERBLOCKS
- if (pbi->interleaved_decoding)
- mi->mbmi.encoded_as_sb = vp8_read(&pbi->bc, pc->sb_coded);
+ mi->mbmi.encoded_as_sb = vp8_read(bc, pc->sb_coded);
#endif
// Process the 4 MBs within the SB in the order:
@@ -638,6 +590,8 @@ decode_sb_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mbrow, MACROBLOCKD *xd) {
int dx = col_delta[i];
int offset_extended = dy * xd->mode_info_stride + dx;
+ xd->mb_index = i;
+
mi = xd->mode_info_context;
if ((mb_row >= pc->mb_rows) || (mb_col >= pc->mb_cols)) {
// MB lies outside frame, skip on to next
@@ -677,8 +631,7 @@ decode_sb_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mbrow, MACROBLOCKD *xd) {
if (i)
mi->mbmi.encoded_as_sb = 0;
#endif
- if(pbi->interleaved_decoding)
- vpx_decode_mb_mode_mv(pbi, xd, mb_row, mb_col);
+ vpx_decode_mb_mode_mv(pbi, xd, mb_row, mb_col, bc);
update_blockd_bmi(xd);
@@ -726,7 +679,7 @@ decode_sb_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mbrow, MACROBLOCKD *xd) {
mi[pc->mode_info_stride + 1] = mi[0];
}
#endif
- decode_macroblock(pbi, xd, mb_col);
+ decode_macroblock(pbi, xd, mb_col, bc);
#if CONFIG_SUPERBLOCKS
if (xd->mode_info_context->mbmi.encoded_as_sb) {
mi[1].mbmi.txfm_size = mi[0].mbmi.txfm_size;
@@ -736,7 +689,7 @@ decode_sb_row(VP8D_COMP *pbi, VP8_COMMON *pc, int mbrow, MACROBLOCKD *xd) {
#endif
/* check if the boolean decoder has suffered an error */
- xd->corrupted |= vp8dx_bool_error(xd->current_bc);
+ xd->corrupted |= vp8dx_bool_error(bc);
#if CONFIG_SUPERBLOCKS
if (mi->mbmi.encoded_as_sb) {
@@ -775,21 +728,17 @@ static int read_is_valid(const unsigned char *start,
static void setup_token_decoder(VP8D_COMP *pbi,
- const unsigned char *cx_data) {
+ const unsigned char *cx_data,
+ BOOL_DECODER* const bool_decoder) {
VP8_COMMON *pc = &pbi->common;
const unsigned char *user_data_end = pbi->Source + pbi->source_sz;
- vp8_reader *bool_decoder;
const unsigned char *partition;
ptrdiff_t partition_size;
ptrdiff_t bytes_left;
- // Dummy read for now
- vp8_read_literal(&pbi->bc, 2);
-
// Set up pointers to token partition
partition = cx_data;
- bool_decoder = &pbi->bc2;
bytes_left = user_data_end - partition;
partition_size = bytes_left;
@@ -809,8 +758,8 @@ static void setup_token_decoder(VP8D_COMP *pbi,
}
static void init_frame(VP8D_COMP *pbi) {
- VP8_COMMON *const pc = & pbi->common;
- MACROBLOCKD *const xd = & pbi->mb;
+ VP8_COMMON *const pc = &pbi->common;
+ MACROBLOCKD *const xd = &pbi->mb;
if (pc->frame_type == KEY_FRAME) {
/* Various keyframe initializations */
@@ -887,8 +836,8 @@ static void init_frame(VP8D_COMP *pbi) {
static void read_coef_probs2(VP8D_COMP *pbi) {
const vp8_prob grpupd = 192;
int i, j, k, l;
- vp8_reader *const bc = & pbi->bc;
- VP8_COMMON *const pc = & pbi->common;
+ vp8_reader *const bc = &pbi->bc;
+ VP8_COMMON *const pc = &pbi->common;
for (l = 0; l < ENTROPY_NODES; l++) {
if (vp8_read(bc, grpupd)) {
// printf("Decoding %d\n", l);
@@ -928,10 +877,9 @@ static void read_coef_probs2(VP8D_COMP *pbi) {
}
#endif
-static void read_coef_probs(VP8D_COMP *pbi) {
+static void read_coef_probs(VP8D_COMP *pbi, BOOL_DECODER* const bc) {
int i, j, k, l;
- vp8_reader *const bc = & pbi->bc;
- VP8_COMMON *const pc = & pbi->common;
+ VP8_COMMON *const pc = &pbi->common;
{
if (vp8_read_bit(bc)) {
@@ -1055,9 +1003,9 @@ static void read_coef_probs(VP8D_COMP *pbi) {
}
int vp8_decode_frame(VP8D_COMP *pbi) {
- vp8_reader *const bc = & pbi->bc;
- VP8_COMMON *const pc = & pbi->common;
- MACROBLOCKD *const xd = & pbi->mb;
+ BOOL_DECODER header_bc, residual_bc;
+ VP8_COMMON *const pc = &pbi->common;
+ MACROBLOCKD *const xd = &pbi->mb;
const unsigned char *data = (const unsigned char *)pbi->Source;
const unsigned char *data_end = data + pbi->source_sz;
ptrdiff_t first_partition_length_in_bytes = 0;
@@ -1143,33 +1091,51 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
init_frame(pbi);
- if (vp8dx_start_decode(bc, data, data_end - data))
+ if (vp8dx_start_decode(&header_bc, data, first_partition_length_in_bytes))
vpx_internal_error(&pc->error, VPX_CODEC_MEM_ERROR,
"Failed to allocate bool decoder 0");
if (pc->frame_type == KEY_FRAME) {
- pc->clr_type = (YUV_TYPE)vp8_read_bit(bc);
- pc->clamp_type = (CLAMP_TYPE)vp8_read_bit(bc);
+ pc->clr_type = (YUV_TYPE)vp8_read_bit(&header_bc);
+ pc->clamp_type = (CLAMP_TYPE)vp8_read_bit(&header_bc);
}
/* Is segmentation enabled */
- xd->segmentation_enabled = (unsigned char)vp8_read_bit(bc);
+ xd->segmentation_enabled = (unsigned char)vp8_read_bit(&header_bc);
if (xd->segmentation_enabled) {
// Read whether or not the segmentation map is being explicitly
// updated this frame.
- xd->update_mb_segmentation_map = (unsigned char)vp8_read_bit(bc);
+ xd->update_mb_segmentation_map = (unsigned char)vp8_read_bit(&header_bc);
// If so what method will be used.
- if (xd->update_mb_segmentation_map)
- pc->temporal_update = (unsigned char)vp8_read_bit(bc);
+ if (xd->update_mb_segmentation_map) {
+ // Which macro block level features are enabled
+ // Read the probs used to decode the segment id for each macro
+ // block.
+ for (i = 0; i < MB_FEATURE_TREE_PROBS; i++) {
+ xd->mb_segment_tree_probs[i] = vp8_read_bit(&header_bc) ?
+ (vp8_prob)vp8_read_literal(&header_bc, 8) : 255;
+ }
+
+ // Read the prediction probs needed to decode the segment id
+ pc->temporal_update = (unsigned char)vp8_read_bit(&header_bc);
+ for (i = 0; i < PREDICTION_PROBS; i++) {
+ if (pc->temporal_update) {
+ pc->segment_pred_probs[i] = vp8_read_bit(&header_bc) ?
+ (vp8_prob)vp8_read_literal(&header_bc, 8) : 255;
+ } else {
+ pc->segment_pred_probs[i] = 255;
+ }
+ }
+ }
// Is the segment data being updated
- xd->update_mb_segmentation_data = (unsigned char)vp8_read_bit(bc);
+ xd->update_mb_segmentation_data = (unsigned char)vp8_read_bit(&header_bc);
if (xd->update_mb_segmentation_data) {
int data;
- xd->mb_segment_abs_delta = (unsigned char)vp8_read_bit(bc);
+ xd->mb_segment_abs_delta = (unsigned char)vp8_read_bit(&header_bc);
clearall_segfeatures(xd);
@@ -1180,11 +1146,11 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
#if CONFIG_FEATUREUPDATES
// feature updated?
- if (vp8_read_bit(bc)) {
+ if (vp8_read_bit(&header_bc)) {
int active = 1;
if (segfeature_active(xd, i, j))
- active = vp8_read_bit(bc);
+ active = vp8_read_bit(&header_bc);
// Is the feature enabled
if (active) {
@@ -1192,11 +1158,11 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
enable_segfeature(xd, i, j);
data = (signed char)vp8_read_literal(
- bc, seg_feature_data_bits(j));
+ &header_bc, seg_feature_data_bits(j));
// Is the segment data signed..
if (is_segfeature_signed(j)) {
- if (vp8_read_bit(bc))
+ if (vp8_read_bit(&header_bc))
data = - data;
}
} else
@@ -1207,16 +1173,16 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
#else
// Is the feature enabled
- if (vp8_read_bit(bc)) {
+ if (vp8_read_bit(&header_bc)) {
// Update the feature data and mask
enable_segfeature(xd, i, j);
data = (signed char)vp8_read_literal(
- bc, seg_feature_data_bits(j));
+ &header_bc, seg_feature_data_bits(j));
// Is the segment data signed..
if (is_segfeature_signed(j)) {
- if (vp8_read_bit(bc))
+ if (vp8_read_bit(&header_bc))
data = - data;
}
} else
@@ -1227,38 +1193,6 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
}
}
}
-
- if (xd->update_mb_segmentation_map) {
- // Which macro block level features are enabled
- vpx_memset(xd->mb_segment_tree_probs, 255,
- sizeof(xd->mb_segment_tree_probs));
- vpx_memset(pc->segment_pred_probs, 255,
- sizeof(pc->segment_pred_probs));
-
- // Read the probs used to decode the segment id for each macro
- // block.
- for (i = 0; i < MB_FEATURE_TREE_PROBS; i++) {
- // If not explicitly set value is defaulted to 255 by
- // memset above
- if (vp8_read_bit(bc))
- xd->mb_segment_tree_probs[i] =
- (vp8_prob)vp8_read_literal(bc, 8);
- }
-
- // If predictive coding of segment map is enabled read the
- // prediction probabilities.
- if (pc->temporal_update) {
- // Read the prediction probs needed to decode the segment id
- // when predictive coding enabled
- for (i = 0; i < PREDICTION_PROBS; i++) {
- // If not explicitly set value is defaulted to 255 by
- // memset above
- if (vp8_read_bit(bc))
- pc->segment_pred_probs[i] =
- (vp8_prob)vp8_read_literal(bc, 8);
- }
- }
- }
}
// Read common prediction model status flag probability updates for the
@@ -1270,81 +1204,84 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
pc->ref_pred_probs[2] = 40;
} else {
for (i = 0; i < PREDICTION_PROBS; i++) {
- if (vp8_read_bit(bc))
- pc->ref_pred_probs[i] = (vp8_prob)vp8_read_literal(bc, 8);
+ if (vp8_read_bit(&header_bc))
+ pc->ref_pred_probs[i] = (vp8_prob)vp8_read_literal(&header_bc, 8);
}
}
#if CONFIG_SUPERBLOCKS
- pc->sb_coded = vp8_read_literal(bc, 8);
+ pc->sb_coded = vp8_read_literal(&header_bc, 8);
#endif
/* Read the loop filter level and type */
#if CONFIG_TX_SELECT
- pc->txfm_mode = vp8_read_literal(bc, 2);
+ pc->txfm_mode = vp8_read_literal(&header_bc, 2);
if (pc->txfm_mode == TX_MODE_SELECT) {
- pc->prob_tx[0] = vp8_read_literal(bc, 8);
- pc->prob_tx[1] = vp8_read_literal(bc, 8);
+ pc->prob_tx[0] = vp8_read_literal(&header_bc, 8);
+ pc->prob_tx[1] = vp8_read_literal(&header_bc, 8);
}
#else
- pc->txfm_mode = (TXFM_MODE) vp8_read_bit(bc);
+ pc->txfm_mode = (TXFM_MODE) vp8_read_bit(&header_bc);
if (pc->txfm_mode == ALLOW_8X8)
pc->txfm_mode = ALLOW_16X16;
#endif
- pc->filter_type = (LOOPFILTERTYPE) vp8_read_bit(bc);
- pc->filter_level = vp8_read_literal(bc, 6);
- pc->sharpness_level = vp8_read_literal(bc, 3);
+ pc->filter_type = (LOOPFILTERTYPE) vp8_read_bit(&header_bc);
+ pc->filter_level = vp8_read_literal(&header_bc, 6);
+ pc->sharpness_level = vp8_read_literal(&header_bc, 3);
/* Read in loop filter deltas applied at the MB level based on mode or ref frame. */
xd->mode_ref_lf_delta_update = 0;
- xd->mode_ref_lf_delta_enabled = (unsigned char)vp8_read_bit(bc);
+ xd->mode_ref_lf_delta_enabled = (unsigned char)vp8_read_bit(&header_bc);
if (xd->mode_ref_lf_delta_enabled) {
/* Do the deltas need to be updated */
- xd->mode_ref_lf_delta_update = (unsigned char)vp8_read_bit(bc);
+ xd->mode_ref_lf_delta_update = (unsigned char)vp8_read_bit(&header_bc);
if (xd->mode_ref_lf_delta_update) {
/* Send update */
for (i = 0; i < MAX_REF_LF_DELTAS; i++) {
- if (vp8_read_bit(bc)) {
- /*sign = vp8_read_bit( bc );*/
- xd->ref_lf_deltas[i] = (signed char)vp8_read_literal(bc, 6);
+ if (vp8_read_bit(&header_bc)) {
+ /*sign = vp8_read_bit( &header_bc );*/
+ xd->ref_lf_deltas[i] = (signed char)vp8_read_literal(&header_bc, 6);
- if (vp8_read_bit(bc)) /* Apply sign */
+ if (vp8_read_bit(&header_bc)) /* Apply sign */
xd->ref_lf_deltas[i] = xd->ref_lf_deltas[i] * -1;
}
}
/* Send update */
for (i = 0; i < MAX_MODE_LF_DELTAS; i++) {
- if (vp8_read_bit(bc)) {
- /*sign = vp8_read_bit( bc );*/
- xd->mode_lf_deltas[i] = (signed char)vp8_read_literal(bc, 6);
+ if (vp8_read_bit(&header_bc)) {
+ /*sign = vp8_read_bit( &header_bc );*/
+ xd->mode_lf_deltas[i] = (signed char)vp8_read_literal(&header_bc, 6);
- if (vp8_read_bit(bc)) /* Apply sign */
+ if (vp8_read_bit(&header_bc)) /* Apply sign */
xd->mode_lf_deltas[i] = xd->mode_lf_deltas[i] * -1;
}
}
}
}
- setup_token_decoder(pbi, data + first_partition_length_in_bytes);
+ // Dummy read for now
+ vp8_read_literal(&header_bc, 2);
- xd->current_bc = &pbi->bc2;
+ setup_token_decoder(pbi, data + first_partition_length_in_bytes,
+ &residual_bc);
/* Read the default quantizers. */
{
int Q, q_update;
- Q = vp8_read_literal(bc, QINDEX_BITS); /* AC 1st order Q = default */
+ Q = vp8_read_literal(&header_bc, QINDEX_BITS);
pc->base_qindex = Q;
q_update = 0;
- pc->y1dc_delta_q = get_delta_q(bc, pc->y1dc_delta_q, &q_update);
- pc->y2dc_delta_q = get_delta_q(bc, pc->y2dc_delta_q, &q_update);
- pc->y2ac_delta_q = get_delta_q(bc, pc->y2ac_delta_q, &q_update);
- pc->uvdc_delta_q = get_delta_q(bc, pc->uvdc_delta_q, &q_update);
- pc->uvac_delta_q = get_delta_q(bc, pc->uvac_delta_q, &q_update);
+ /* AC 1st order Q = default */
+ pc->y1dc_delta_q = get_delta_q(&header_bc, pc->y1dc_delta_q, &q_update);
+ pc->y2dc_delta_q = get_delta_q(&header_bc, pc->y2dc_delta_q, &q_update);
+ pc->y2ac_delta_q = get_delta_q(&header_bc, pc->y2ac_delta_q, &q_update);
+ pc->uvdc_delta_q = get_delta_q(&header_bc, pc->uvdc_delta_q, &q_update);
+ pc->uvac_delta_q = get_delta_q(&header_bc, pc->uvac_delta_q, &q_update);
if (q_update)
vp8cx_init_de_quantizer(pbi);
@@ -1359,8 +1296,8 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
*/
if (pc->frame_type != KEY_FRAME) {
/* Should the GF or ARF be updated from the current frame */
- pc->refresh_golden_frame = vp8_read_bit(bc);
- pc->refresh_alt_ref_frame = vp8_read_bit(bc);
+ pc->refresh_golden_frame = vp8_read_bit(&header_bc);
+ pc->refresh_alt_ref_frame = vp8_read_bit(&header_bc);
if (pc->refresh_alt_ref_frame) {
vpx_memcpy(&pc->fc, &pc->lfc_a, sizeof(pc->fc));
@@ -1378,37 +1315,38 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
pc->copy_buffer_to_gf = 0;
if (!pc->refresh_golden_frame)
- pc->copy_buffer_to_gf = vp8_read_literal(bc, 2);
+ pc->copy_buffer_to_gf = vp8_read_literal(&header_bc, 2);
pc->copy_buffer_to_arf = 0;
if (!pc->refresh_alt_ref_frame)
- pc->copy_buffer_to_arf = vp8_read_literal(bc, 2);
+ pc->copy_buffer_to_arf = vp8_read_literal(&header_bc, 2);
- pc->ref_frame_sign_bias[GOLDEN_FRAME] = vp8_read_bit(bc);
- pc->ref_frame_sign_bias[ALTREF_FRAME] = vp8_read_bit(bc);
+ pc->ref_frame_sign_bias[GOLDEN_FRAME] = vp8_read_bit(&header_bc);
+ pc->ref_frame_sign_bias[ALTREF_FRAME] = vp8_read_bit(&header_bc);
/* Is high precision mv allowed */
- xd->allow_high_precision_mv = (unsigned char)vp8_read_bit(bc);
+ xd->allow_high_precision_mv = (unsigned char)vp8_read_bit(&header_bc);
// Read the type of subpel filter to use
#if CONFIG_SWITCHABLE_INTERP
- if (vp8_read_bit(bc)) {
+ if (vp8_read_bit(&header_bc)) {
pc->mcomp_filter_type = SWITCHABLE;
} else
#endif
{
- pc->mcomp_filter_type = vp8_read_literal(bc, 2);
+ pc->mcomp_filter_type = vp8_read_literal(&header_bc, 2);
}
/* To enable choice of different interploation filters */
vp8_setup_interp_filters(xd, pc->mcomp_filter_type, pc);
}
- pc->refresh_entropy_probs = vp8_read_bit(bc);
+ pc->refresh_entropy_probs = vp8_read_bit(&header_bc);
if (pc->refresh_entropy_probs == 0) {
vpx_memcpy(&pc->lfc, &pc->fc, sizeof(pc->fc));
}
- pc->refresh_last_frame = pc->frame_type == KEY_FRAME || vp8_read_bit(bc);
+ pc->refresh_last_frame = (pc->frame_type == KEY_FRAME)
+ || vp8_read_bit(&header_bc);
if (0) {
FILE *z = fopen("decodestats.stt", "a");
@@ -1479,7 +1417,7 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
vp8_zero(pbi->common.fc.mv_ref_ct);
vp8_zero(pbi->common.fc.mv_ref_ct_a);
- read_coef_probs(pbi);
+ read_coef_probs(pbi, &header_bc);
vpx_memcpy(&xd->pre, &pc->yv12_fb[pc->lst_fb_idx], sizeof(YV12_BUFFER_CONFIG));
vpx_memcpy(&xd->dst, &pc->yv12_fb[pc->new_fb_idx], sizeof(YV12_BUFFER_CONFIG));
@@ -1500,12 +1438,9 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
vpx_memset(xd->qcoeff, 0, sizeof(xd->qcoeff));
/* Read the mb_no_coeff_skip flag */
- pc->mb_no_coeff_skip = (int)vp8_read_bit(bc);
+ pc->mb_no_coeff_skip = (int)vp8_read_bit(&header_bc);
- if(pbi->interleaved_decoding)
- vpx_decode_mode_mvs_init(pbi);
- else
- vp8_decode_mode_mvs(pbi);
+ vpx_decode_mode_mvs_init(pbi, &header_bc);
vpx_memset(pc->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) * pc->mb_cols);
@@ -1515,13 +1450,13 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
/* Decode a row of superblocks */
for (mb_row = 0; mb_row < pc->mb_rows; mb_row += 2) {
- decode_sb_row(pbi, pc, mb_row, xd);
+ decode_sb_row(pbi, pc, mb_row, xd, &residual_bc);
}
corrupt_tokens |= xd->corrupted;
/* Collect information about decoder corruption. */
/* 1. Check first boolean decoder for errors. */
- pc->yv12_fb[pc->new_fb_idx].corrupted = vp8dx_bool_error(bc);
+ pc->yv12_fb[pc->new_fb_idx].corrupted = vp8dx_bool_error(&header_bc);
/* 2. Check the macroblock information */
pc->yv12_fb[pc->new_fb_idx].corrupted |= corrupt_tokens;
@@ -1534,7 +1469,6 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
"A stream must start with a complete key frame");
}
- /* vpx_log("Decoder: Frame Decoded, Size Roughly:%d bytes \n",bc->pos+pbi->bc2.pos); */
vp8_adapt_coef_probs(pc);
if (pc->frame_type != KEY_FRAME) {
vp8_adapt_mode_probs(pc);
@@ -1561,7 +1495,7 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
#ifdef PACKET_TESTING
{
FILE *f = fopen("decompressor.VP8", "ab");
- unsigned int size = pbi->bc2.pos + pbi->bc.pos + 8;
+ unsigned int size = residual_bc.pos + header_bc.pos + 8;
fwrite((void *) &size, 4, 1, f);
fwrite((void *) pbi->Source, size, 1, f);
fclose(f);
diff --git a/vp8/decoder/detokenize.c b/vp8/decoder/detokenize.c
index 5b5ec7e2a..85f213470 100644
--- a/vp8/decoder/detokenize.c
+++ b/vp8/decoder/detokenize.c
@@ -302,17 +302,17 @@ static int vp8_get_signed(BOOL_DECODER *br, int value_to_sign) {
val += (UINT16)(1 << bits_count);\
} while (0);
-static int vp8_decode_coefs(VP8D_COMP *dx, const MACROBLOCKD *xd,
- ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
- PLANE_TYPE type,
+static int decode_coefs(VP8D_COMP *dx, const MACROBLOCKD *xd,
+ BOOL_DECODER* const br,
+ ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
+ PLANE_TYPE type,
#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
- TX_TYPE tx_type,
+ TX_TYPE tx_type,
#endif
- int seg_eob, INT16 *qcoeff_ptr, int i,
- const int *const scan, int block_type,
- const int *coef_bands) {
+ int seg_eob, INT16 *qcoeff_ptr, int i,
+ const int *const scan, int block_type,
+ const int *coef_bands) {
FRAME_CONTEXT *const fc = &dx->common.fc;
- BOOL_DECODER *br = xd->current_bc;
int tmp, c = (type == PLANE_TYPE_Y_NO_DC);
const vp8_prob *prob, *coef_probs;
@@ -446,7 +446,8 @@ SKIP_START:
return c;
}
-int vp8_decode_mb_tokens_16x16(VP8D_COMP *pbi, MACROBLOCKD *xd) {
+int vp8_decode_mb_tokens_16x16(VP8D_COMP *pbi, MACROBLOCKD *xd,
+ BOOL_DECODER* const bc) {
ENTROPY_CONTEXT* const A = (ENTROPY_CONTEXT *)xd->above_context;
ENTROPY_CONTEXT* const L = (ENTROPY_CONTEXT *)xd->left_context;
@@ -473,12 +474,12 @@ int vp8_decode_mb_tokens_16x16(VP8D_COMP *pbi, MACROBLOCKD *xd) {
// Luma block
{
const int* const scan = vp8_default_zig_zag1d_16x16;
- c = vp8_decode_coefs(pbi, xd, A, L, type,
+ c = decode_coefs(pbi, xd, bc, A, L, type,
#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
- tx_type,
+ tx_type,
#endif
- seg_eob, qcoeff_ptr,
- 0, scan, TX_16X16, coef_bands_x_16x16);
+ seg_eob, qcoeff_ptr,
+ 0, scan, TX_16X16, coef_bands_x_16x16);
eobs[0] = c;
*A = *L = (c != !type);
for (i = 1; i < 16; i++) {
@@ -503,12 +504,12 @@ int vp8_decode_mb_tokens_16x16(VP8D_COMP *pbi, MACROBLOCKD *xd) {
ENTROPY_CONTEXT* const l = L + vp8_block2left_8x8[i];
const int* const scan = vp8_default_zig_zag1d_8x8;
- c = vp8_decode_coefs(pbi, xd, a, l, type,
+ c = decode_coefs(pbi, xd, bc, a, l, type,
#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
- tx_type,
+ tx_type,
#endif
- seg_eob, qcoeff_ptr,
- i, scan, TX_8X8, coef_bands_x_8x8);
+ seg_eob, qcoeff_ptr,
+ i, scan, TX_8X8, coef_bands_x_8x8);
a[0] = l[0] = ((eobs[i] = c) != !type);
a[1] = a[0];
l[1] = l[0];
@@ -521,7 +522,8 @@ int vp8_decode_mb_tokens_16x16(VP8D_COMP *pbi, MACROBLOCKD *xd) {
return eobtotal;
}
-int vp8_decode_mb_tokens_8x8(VP8D_COMP *pbi, MACROBLOCKD *xd) {
+int vp8_decode_mb_tokens_8x8(VP8D_COMP *pbi, MACROBLOCKD *xd,
+ BOOL_DECODER* const bc) {
ENTROPY_CONTEXT *const A = (ENTROPY_CONTEXT *)xd->above_context;
ENTROPY_CONTEXT *const L = (ENTROPY_CONTEXT *)xd->left_context;
@@ -548,12 +550,12 @@ int vp8_decode_mb_tokens_8x8(VP8D_COMP *pbi, MACROBLOCKD *xd) {
seg_eob = get_segdata(xd, segment_id, SEG_LVL_EOB);
else
seg_eob = 4;
- c = vp8_decode_coefs(pbi, xd, a, l, type,
+ c = decode_coefs(pbi, xd, bc, a, l, type,
#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
- tx_type,
+ tx_type,
#endif
- seg_eob, qcoeff_ptr + 24 * 16,
- 24, scan, TX_8X8, coef_bands_x);
+ seg_eob, qcoeff_ptr + 24 * 16,
+ 24, scan, TX_8X8, coef_bands_x);
a[0] = l[0] = ((eobs[24] = c) != !type);
eobtotal += c - 4;
@@ -578,18 +580,17 @@ int vp8_decode_mb_tokens_8x8(VP8D_COMP *pbi, MACROBLOCKD *xd) {
if (i == 16)
type = PLANE_TYPE_UV;
#if CONFIG_HYBRIDTRANSFORM8X8
- if (type == PLANE_TYPE_Y_WITH_DC &&
- xd->mode_info_context->mbmi.mode == I8X8_PRED) {
+ if (type == PLANE_TYPE_Y_WITH_DC) {
tx_type = get_tx_type(xd, xd->block + i);
}
#endif
- c = vp8_decode_coefs(pbi, xd, a, l, type,
+ c = decode_coefs(pbi, xd, bc, a, l, type,
#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
- tx_type,
+ tx_type,
#endif
- seg_eob, qcoeff_ptr,
- i, scan, TX_8X8, coef_bands_x_8x8);
+ seg_eob, qcoeff_ptr,
+ i, scan, TX_8X8, coef_bands_x_8x8);
a[0] = l[0] = ((eobs[i] = c) != !type);
a[1] = a[0];
l[1] = l[0];
@@ -611,12 +612,12 @@ int vp8_decode_mb_tokens_8x8(VP8D_COMP *pbi, MACROBLOCKD *xd) {
ENTROPY_CONTEXT *const l = L + vp8_block2left[i];
const int *scan = vp8_default_zig_zag1d;
- c = vp8_decode_coefs(pbi, xd, a, l, type,
+ c = decode_coefs(pbi, xd, bc, a, l, type,
#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
- tx_type,
+ tx_type,
#endif
- seg_eob, qcoeff_ptr,
- i, scan, TX_4X4, coef_bands_x);
+ seg_eob, qcoeff_ptr,
+ i, scan, TX_4X4, coef_bands_x);
a[0] = l[0] = ((eobs[i] = c) != !type);
eobtotal += c;
@@ -628,7 +629,8 @@ int vp8_decode_mb_tokens_8x8(VP8D_COMP *pbi, MACROBLOCKD *xd) {
}
-int vp8_decode_mb_tokens(VP8D_COMP *dx, MACROBLOCKD *xd) {
+int vp8_decode_mb_tokens(VP8D_COMP *dx, MACROBLOCKD *xd,
+ BOOL_DECODER* const bc) {
ENTROPY_CONTEXT *const A = (ENTROPY_CONTEXT *)xd->above_context;
ENTROPY_CONTEXT *const L = (ENTROPY_CONTEXT *)xd->left_context;
@@ -649,12 +651,12 @@ int vp8_decode_mb_tokens(VP8D_COMP *dx, MACROBLOCKD *xd) {
ENTROPY_CONTEXT *const l = L + vp8_block2left[24];
type = PLANE_TYPE_Y2;
- c = vp8_decode_coefs(dx, xd, a, l, type,
+ c = decode_coefs(dx, xd, bc, a, l, type,
#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
- DCT_DCT,
+ DCT_DCT,
#endif
- seg_eob, qcoeff_ptr + 24 * 16, 24,
- scan, TX_4X4, coef_bands_x);
+ seg_eob, qcoeff_ptr + 24 * 16, 24,
+ scan, TX_4X4, coef_bands_x);
a[0] = l[0] = ((eobs[24] = c) != !type);
eobtotal += c - 16;
@@ -673,10 +675,7 @@ int vp8_decode_mb_tokens(VP8D_COMP *dx, MACROBLOCKD *xd) {
type = PLANE_TYPE_UV;
#if CONFIG_HYBRIDTRANSFORM
- if (type == PLANE_TYPE_Y_WITH_DC)
- tx_type = get_tx_type(xd, &xd->block[i]);
-#endif
-#if CONFIG_HYBRIDTRANSFORM
+ tx_type = get_tx_type(xd, &xd->block[i]);
switch(tx_type) {
case ADST_DCT :
scan = vp8_row_scan;
@@ -692,12 +691,12 @@ int vp8_decode_mb_tokens(VP8D_COMP *dx, MACROBLOCKD *xd) {
}
#endif
- c = vp8_decode_coefs(dx, xd, a, l, type,
+ c = decode_coefs(dx, xd, bc, a, l, type,
#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
- tx_type,
+ tx_type,
#endif
- seg_eob, qcoeff_ptr,
- i, scan, TX_4X4, coef_bands_x);
+ seg_eob, qcoeff_ptr,
+ i, scan, TX_4X4, coef_bands_x);
a[0] = l[0] = ((eobs[i] = c) != !type);
eobtotal += c;
diff --git a/vp8/decoder/detokenize.h b/vp8/decoder/detokenize.h
index d02d4cae1..df36efed5 100644
--- a/vp8/decoder/detokenize.h
+++ b/vp8/decoder/detokenize.h
@@ -14,9 +14,12 @@
#include "onyxd_int.h"
-void vp8_reset_mb_tokens_context(MACROBLOCKD *xd);
-int vp8_decode_mb_tokens(VP8D_COMP *, MACROBLOCKD *);
-int vp8_decode_mb_tokens_8x8(VP8D_COMP *, MACROBLOCKD *);
-int vp8_decode_mb_tokens_16x16(VP8D_COMP *, MACROBLOCKD *);
+void vp8_reset_mb_tokens_context(MACROBLOCKD* const);
+int vp8_decode_mb_tokens(VP8D_COMP* const, MACROBLOCKD* const,
+ BOOL_DECODER* const);
+int vp8_decode_mb_tokens_8x8(VP8D_COMP* const, MACROBLOCKD* const,
+ BOOL_DECODER* const);
+int vp8_decode_mb_tokens_16x16(VP8D_COMP* const, MACROBLOCKD* const,
+ BOOL_DECODER* const);
#endif /* DETOKENIZE_H */
diff --git a/vp8/decoder/onyxd_if.c b/vp8/decoder/onyxd_if.c
index aa3ef81b3..2e7751325 100644
--- a/vp8/decoder/onyxd_if.c
+++ b/vp8/decoder/onyxd_if.c
@@ -149,8 +149,6 @@ VP8D_PTR vp8dx_create_decompressor(VP8D_CONFIG *oxcf) {
pbi->decoded_key_frame = 0;
- pbi->interleaved_decoding = CONFIG_NEWBESTREFMV || CONFIG_SUPERBLOCKS;
-
return (VP8D_PTR) pbi;
}
diff --git a/vp8/decoder/onyxd_int.h b/vp8/decoder/onyxd_int.h
index 53350b819..0a84256e2 100644
--- a/vp8/decoder/onyxd_int.h
+++ b/vp8/decoder/onyxd_int.h
@@ -45,7 +45,6 @@ typedef struct {
ENTROPY_CONTEXT_PLANES *L;
INT16 *qcoeff_start_ptr;
- BOOL_DECODER *current_bc;
vp8_prob const *coef_probs[BLOCK_TYPES];
vp8_prob const *coef_probs_8x8[BLOCK_TYPES_8X8];
@@ -60,8 +59,6 @@ typedef struct VP8Decompressor {
DECLARE_ALIGNED(16, VP8_COMMON, common);
- vp8_reader bc, bc2;
-
VP8D_CONFIG oxcf;
@@ -82,8 +79,6 @@ typedef struct VP8Decompressor {
int decoded_key_frame;
- int interleaved_decoding;
-
} VP8D_COMP;
int vp8_decode_frame(VP8D_COMP *cpi);