Commit 91441112 authored by Dmitry Kovalev's avatar Dmitry Kovalev
Browse files

Cleaning up decode_coefs() function.

Removing goto and using while loop instead, renaming seg_eob to max_eob,
moving eob token counter increment.

Change-Id: Idcc4b3a45e4f313596a71776aef56691a6647e5f
parent 862c22cf
...@@ -93,7 +93,7 @@ static const int token_to_counttoken[MAX_ENTROPY_TOKENS] = { ...@@ -93,7 +93,7 @@ static const int token_to_counttoken[MAX_ENTROPY_TOKENS] = {
static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd, static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
vp9_reader *r, int block_idx, vp9_reader *r, int block_idx,
PLANE_TYPE type, int seg_eob, int16_t *dqcoeff_ptr, PLANE_TYPE type, int max_eob, int16_t *dqcoeff_ptr,
TX_SIZE tx_size, const int16_t *dq, int pt, TX_SIZE tx_size, const int16_t *dq, int pt,
uint8_t *token_cache) { uint8_t *token_cache) {
const FRAME_CONTEXT *const fc = &cm->fc; const FRAME_CONTEXT *const fc = &cm->fc;
...@@ -116,28 +116,27 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd, ...@@ -116,28 +116,27 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
int v; int v;
int16_t dqv = dq[0]; int16_t dqv = dq[0];
while (c < max_eob) {
while (c < seg_eob) {
int val; int val;
band = *band_translate++; band = *band_translate++;
prob = coef_probs[band][pt]; prob = coef_probs[band][pt];
if (!cm->frame_parallel_decoding_mode) if (!cm->frame_parallel_decoding_mode)
++eob_branch_count[band][pt]; ++eob_branch_count[band][pt];
if (!vp9_read(r, prob[EOB_CONTEXT_NODE])) if (!vp9_read(r, prob[EOB_CONTEXT_NODE])) {
if (!cm->frame_parallel_decoding_mode)
++coef_counts[band][pt][DCT_EOB_MODEL_TOKEN];
break; break;
}
DECODE_ZERO: while (!vp9_read(r, prob[ZERO_CONTEXT_NODE])) {
if (!vp9_read(r, prob[ZERO_CONTEXT_NODE])) {
INCREMENT_COUNT(ZERO_TOKEN); INCREMENT_COUNT(ZERO_TOKEN);
dqv = dq[1]; dqv = dq[1];
++c; ++c;
if (c >= seg_eob) if (c >= max_eob)
break; return c; // zero tokens at the end (no eob token)
pt = get_coef_context(nb, token_cache, c); pt = get_coef_context(nb, token_cache, c);
band = *band_translate++; band = *band_translate++;
prob = coef_probs[band][pt]; prob = coef_probs[band][pt];
goto DECODE_ZERO;
} }
// ONE_CONTEXT_NODE_0_ // ONE_CONTEXT_NODE_0_
...@@ -145,7 +144,7 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd, ...@@ -145,7 +144,7 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
WRITE_COEF_CONTINUE(1, ONE_TOKEN); WRITE_COEF_CONTINUE(1, ONE_TOKEN);
} }
prob = vp9_pareto8_full[coef_probs[band][pt][PIVOT_NODE]-1]; prob = vp9_pareto8_full[prob[PIVOT_NODE] - 1];
// LOW_VAL_CONTEXT_NODE_0_ // LOW_VAL_CONTEXT_NODE_0_
if (!vp9_read(r, prob[LOW_VAL_CONTEXT_NODE])) { if (!vp9_read(r, prob[LOW_VAL_CONTEXT_NODE])) {
...@@ -204,11 +203,6 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd, ...@@ -204,11 +203,6 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
WRITE_COEF_CONTINUE(val, DCT_VAL_CATEGORY6); WRITE_COEF_CONTINUE(val, DCT_VAL_CATEGORY6);
} }
if (c < seg_eob) {
if (!cm->frame_parallel_decoding_mode)
++coef_counts[band][pt][DCT_EOB_MODEL_TOKEN];
}
return c; return c;
} }
......
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