Cleaning up vp9_detokenize.c file.
Using consistent names (block_idx => block, dqcoeff_ptr => dqcoeff, pt => ctx), inlining get_tx_eob() call. Change-Id: I05208e57df81bbb8f25b8274684a48192e9de464
This commit is contained in:
@@ -13,11 +13,8 @@
|
|||||||
|
|
||||||
#include "vp9/common/vp9_blockd.h"
|
#include "vp9/common/vp9_blockd.h"
|
||||||
#include "vp9/common/vp9_common.h"
|
#include "vp9/common/vp9_common.h"
|
||||||
#include "vp9/common/vp9_seg_common.h"
|
|
||||||
|
|
||||||
#include "vp9/decoder/vp9_dboolhuff.h"
|
|
||||||
#include "vp9/decoder/vp9_detokenize.h"
|
#include "vp9/decoder/vp9_detokenize.h"
|
||||||
#include "vp9/decoder/vp9_onyxd_int.h"
|
|
||||||
|
|
||||||
#define EOB_CONTEXT_NODE 0
|
#define EOB_CONTEXT_NODE 0
|
||||||
#define ZERO_CONTEXT_NODE 1
|
#define ZERO_CONTEXT_NODE 1
|
||||||
@@ -63,31 +60,29 @@ static const vp9_prob cat6_prob[15] = {
|
|||||||
#define INCREMENT_COUNT(token) \
|
#define INCREMENT_COUNT(token) \
|
||||||
do { \
|
do { \
|
||||||
if (!cm->frame_parallel_decoding_mode) \
|
if (!cm->frame_parallel_decoding_mode) \
|
||||||
++coef_counts[band][pt][token]; \
|
++coef_counts[band][ctx][token]; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
#define WRITE_COEF_CONTINUE(val, token) \
|
#define WRITE_COEF_CONTINUE(val, token) \
|
||||||
{ \
|
{ \
|
||||||
v = (val * dqv) >> dq_shift; \
|
v = (val * dqv) >> dq_shift; \
|
||||||
dqcoeff_ptr[scan[c]] = (vp9_read_bit(r) ? -v : v); \
|
dqcoeff[scan[c]] = vp9_read_bit(r) ? -v : v; \
|
||||||
token_cache[scan[c]] = vp9_pt_energy_class[token]; \
|
token_cache[scan[c]] = vp9_pt_energy_class[token]; \
|
||||||
++c; \
|
++c; \
|
||||||
pt = get_coef_context(nb, token_cache, c); \
|
ctx = get_coef_context(nb, token_cache, c); \
|
||||||
dqv = dq[1]; \
|
dqv = dq[1]; \
|
||||||
continue; \
|
continue; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define ADJUST_COEF(prob, bits_count) \
|
#define ADJUST_COEF(prob, bits_count) \
|
||||||
do { \
|
do { \
|
||||||
val += (vp9_read(r, prob) << bits_count); \
|
val += (vp9_read(r, prob) << bits_count); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
|
static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd, int block,
|
||||||
vp9_reader *r, int block_idx,
|
PLANE_TYPE type, int16_t *dqcoeff, TX_SIZE tx_size,
|
||||||
PLANE_TYPE type, int max_eob, int16_t *dqcoeff_ptr,
|
const int16_t *dq, int ctx, vp9_reader *r) {
|
||||||
TX_SIZE tx_size, const int16_t *dq, int pt) {
|
const int max_eob = 16 << (tx_size << 1);
|
||||||
const FRAME_CONTEXT *const fc = &cm->fc;
|
const FRAME_CONTEXT *const fc = &cm->fc;
|
||||||
FRAME_COUNTS *const counts = &cm->counts;
|
FRAME_COUNTS *const counts = &cm->counts;
|
||||||
const int ref = is_inter_block(&xd->mi_8x8[0]->mbmi);
|
const int ref = is_inter_block(&xd->mi_8x8[0]->mbmi);
|
||||||
@@ -103,7 +98,7 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
|
|||||||
const uint8_t *cat6;
|
const uint8_t *cat6;
|
||||||
const uint8_t *band_translate = get_band_translate(tx_size);
|
const uint8_t *band_translate = get_band_translate(tx_size);
|
||||||
const int dq_shift = (tx_size == TX_32X32);
|
const int dq_shift = (tx_size == TX_32X32);
|
||||||
const scan_order *so = get_scan(xd, tx_size, type, block_idx);
|
const scan_order *so = get_scan(xd, tx_size, type, block);
|
||||||
const int16_t *scan = so->scan;
|
const int16_t *scan = so->scan;
|
||||||
const int16_t *nb = so->neighbors;
|
const int16_t *nb = so->neighbors;
|
||||||
int v;
|
int v;
|
||||||
@@ -112,9 +107,9 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
|
|||||||
while (c < max_eob) {
|
while (c < max_eob) {
|
||||||
int val;
|
int val;
|
||||||
band = *band_translate++;
|
band = *band_translate++;
|
||||||
prob = coef_probs[band][pt];
|
prob = coef_probs[band][ctx];
|
||||||
if (!cm->frame_parallel_decoding_mode)
|
if (!cm->frame_parallel_decoding_mode)
|
||||||
++eob_branch_count[band][pt];
|
++eob_branch_count[band][ctx];
|
||||||
if (!vp9_read(r, prob[EOB_CONTEXT_NODE])) {
|
if (!vp9_read(r, prob[EOB_CONTEXT_NODE])) {
|
||||||
INCREMENT_COUNT(EOB_MODEL_TOKEN);
|
INCREMENT_COUNT(EOB_MODEL_TOKEN);
|
||||||
break;
|
break;
|
||||||
@@ -127,9 +122,9 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
|
|||||||
++c;
|
++c;
|
||||||
if (c >= max_eob)
|
if (c >= max_eob)
|
||||||
return c; // zero tokens at the end (no eob token)
|
return c; // zero tokens at the end (no eob token)
|
||||||
pt = get_coef_context(nb, token_cache, c);
|
ctx = get_coef_context(nb, token_cache, c);
|
||||||
band = *band_translate++;
|
band = *band_translate++;
|
||||||
prob = coef_probs[band][pt];
|
prob = coef_probs[band][ctx];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ONE_CONTEXT_NODE_0_
|
// ONE_CONTEXT_NODE_0_
|
||||||
@@ -205,13 +200,11 @@ int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd,
|
|||||||
int plane, int block, BLOCK_SIZE plane_bsize,
|
int plane, int block, BLOCK_SIZE plane_bsize,
|
||||||
int x, int y, TX_SIZE tx_size, vp9_reader *r) {
|
int x, int y, TX_SIZE tx_size, vp9_reader *r) {
|
||||||
struct macroblockd_plane *const pd = &xd->plane[plane];
|
struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||||
const int seg_eob = get_tx_eob(&cm->seg, xd->mi_8x8[0]->mbmi.segment_id,
|
const int ctx = get_entropy_context(tx_size, pd->above_context + x,
|
||||||
tx_size);
|
pd->left_context + y);
|
||||||
const int pt = get_entropy_context(tx_size, pd->above_context + x,
|
const int eob = decode_coefs(cm, xd, block, pd->plane_type,
|
||||||
pd->left_context + y);
|
|
||||||
const int eob = decode_coefs(cm, xd, r, block, pd->plane_type, seg_eob,
|
|
||||||
BLOCK_OFFSET(pd->dqcoeff, block), tx_size,
|
BLOCK_OFFSET(pd->dqcoeff, block), tx_size,
|
||||||
pd->dequant, pt);
|
pd->dequant, ctx, r);
|
||||||
set_contexts(xd, pd, plane_bsize, tx_size, eob > 0, x, y);
|
set_contexts(xd, pd, plane_bsize, tx_size, eob > 0, x, y);
|
||||||
return eob;
|
return eob;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user