Moved vp9_get_coef_band to header file
allowing the compiler to inline. Change-Id: I66e5caf5e7fefa68a223ff0603aa3f9e11e35dbb
This commit is contained in:
parent
45712dc8c8
commit
ae886d6bff
@ -244,13 +244,6 @@ int vp9_get_coef_context(int * recent_energy, int token) {
|
|||||||
return vp9_prev_token_class[token];
|
return vp9_prev_token_class[token];
|
||||||
};
|
};
|
||||||
|
|
||||||
int vp9_get_coef_band(int coef_index) {
|
|
||||||
if (coef_index < 32)
|
|
||||||
return vp9_coef_bands[coef_index];
|
|
||||||
else
|
|
||||||
return 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
void vp9_default_coef_probs(VP9_COMMON *pc) {
|
void vp9_default_coef_probs(VP9_COMMON *pc) {
|
||||||
vpx_memcpy(pc->fc.coef_probs_4x4, default_coef_probs_4x4,
|
vpx_memcpy(pc->fc.coef_probs_4x4, default_coef_probs_4x4,
|
||||||
sizeof(pc->fc.coef_probs_4x4));
|
sizeof(pc->fc.coef_probs_4x4));
|
||||||
|
@ -122,6 +122,12 @@ static void vp9_reset_mb_tokens_context(MACROBLOCKD* const xd) {
|
|||||||
vpx_memset(xd->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES));
|
vpx_memset(xd->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern const int vp9_coef_bands[32];
|
||||||
|
static int get_coef_band(int coef_index) {
|
||||||
|
if (coef_index < 32)
|
||||||
|
return vp9_coef_bands[coef_index];
|
||||||
|
else
|
||||||
|
return 7;
|
||||||
|
}
|
||||||
extern int vp9_get_coef_context(int * recent_energy, int token);
|
extern int vp9_get_coef_context(int * recent_energy, int token);
|
||||||
extern int vp9_get_coef_band(int coef_index);
|
|
||||||
#endif // VP9_COMMON_VP9_ENTROPY_H_
|
#endif // VP9_COMMON_VP9_ENTROPY_H_
|
||||||
|
@ -65,7 +65,7 @@ static int get_signed(BOOL_DECODER *br, int value_to_sign) {
|
|||||||
|
|
||||||
#define INCREMENT_COUNT(token) \
|
#define INCREMENT_COUNT(token) \
|
||||||
do { \
|
do { \
|
||||||
coef_counts[type][vp9_get_coef_band(c)][pt][token]++; \
|
coef_counts[type][get_coef_band(c)][pt][token]++; \
|
||||||
pt = vp9_get_coef_context(&recent_energy, token); \
|
pt = vp9_get_coef_context(&recent_energy, token); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -179,7 +179,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
|
|||||||
int val;
|
int val;
|
||||||
const uint8_t *cat6 = cat6_prob;
|
const uint8_t *cat6 = cat6_prob;
|
||||||
if (c >= seg_eob) break;
|
if (c >= seg_eob) break;
|
||||||
prob = coef_probs[type][vp9_get_coef_band(c)][pt];
|
prob = coef_probs[type][get_coef_band(c)][pt];
|
||||||
if (!vp9_read(br, prob[EOB_CONTEXT_NODE]))
|
if (!vp9_read(br, prob[EOB_CONTEXT_NODE]))
|
||||||
break;
|
break;
|
||||||
SKIP_START:
|
SKIP_START:
|
||||||
@ -187,7 +187,7 @@ SKIP_START:
|
|||||||
if (!vp9_read(br, prob[ZERO_CONTEXT_NODE])) {
|
if (!vp9_read(br, prob[ZERO_CONTEXT_NODE])) {
|
||||||
INCREMENT_COUNT(ZERO_TOKEN);
|
INCREMENT_COUNT(ZERO_TOKEN);
|
||||||
++c;
|
++c;
|
||||||
prob = coef_probs[type][vp9_get_coef_band(c)][pt];
|
prob = coef_probs[type][get_coef_band(c)][pt];
|
||||||
goto SKIP_START;
|
goto SKIP_START;
|
||||||
}
|
}
|
||||||
// ONE_CONTEXT_NODE_0_
|
// ONE_CONTEXT_NODE_0_
|
||||||
@ -251,7 +251,7 @@ SKIP_START:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (c < seg_eob)
|
if (c < seg_eob)
|
||||||
coef_counts[type][vp9_get_coef_band(c)][pt][DCT_EOB_TOKEN]++;
|
coef_counts[type][get_coef_band(c)][pt][DCT_EOB_TOKEN]++;
|
||||||
|
|
||||||
A0[aidx] = L0[lidx] = (c > !type);
|
A0[aidx] = L0[lidx] = (c > !type);
|
||||||
if (txfm_size >= TX_8X8 && type != PLANE_TYPE_Y2) {
|
if (txfm_size >= TX_8X8 && type != PLANE_TYPE_Y2) {
|
||||||
|
@ -456,7 +456,7 @@ static void optimize_b(MACROBLOCK *mb, int i, PLANE_TYPE type,
|
|||||||
t0 = (vp9_dct_value_tokens_ptr + x)->Token;
|
t0 = (vp9_dct_value_tokens_ptr + x)->Token;
|
||||||
/* Consider both possible successor states. */
|
/* Consider both possible successor states. */
|
||||||
if (next < default_eob) {
|
if (next < default_eob) {
|
||||||
band = vp9_get_coef_band(i + 1);
|
band = get_coef_band(i + 1);
|
||||||
pt = trellis_get_coeff_context(t0);
|
pt = trellis_get_coeff_context(t0);
|
||||||
rate0 +=
|
rate0 +=
|
||||||
mb->token_costs[tx_size][type][band][pt][tokens[next][0].token];
|
mb->token_costs[tx_size][type][band][pt][tokens[next][0].token];
|
||||||
@ -503,7 +503,7 @@ static void optimize_b(MACROBLOCK *mb, int i, PLANE_TYPE type,
|
|||||||
t0 = t1 = (vp9_dct_value_tokens_ptr + x)->Token;
|
t0 = t1 = (vp9_dct_value_tokens_ptr + x)->Token;
|
||||||
}
|
}
|
||||||
if (next < default_eob) {
|
if (next < default_eob) {
|
||||||
band = vp9_get_coef_band(i + 1);
|
band = get_coef_band(i + 1);
|
||||||
if (t0 != DCT_EOB_TOKEN) {
|
if (t0 != DCT_EOB_TOKEN) {
|
||||||
pt = trellis_get_coeff_context(t0);
|
pt = trellis_get_coeff_context(t0);
|
||||||
rate0 += mb->token_costs[tx_size][type][band][pt][
|
rate0 += mb->token_costs[tx_size][type][band][pt][
|
||||||
@ -538,7 +538,7 @@ static void optimize_b(MACROBLOCK *mb, int i, PLANE_TYPE type,
|
|||||||
* add a new trellis node, but we do need to update the costs.
|
* add a new trellis node, but we do need to update the costs.
|
||||||
*/
|
*/
|
||||||
else {
|
else {
|
||||||
band = vp9_get_coef_band(i + 1);
|
band = get_coef_band(i + 1);
|
||||||
t0 = tokens[next][0].token;
|
t0 = tokens[next][0].token;
|
||||||
t1 = tokens[next][1].token;
|
t1 = tokens[next][1].token;
|
||||||
/* Update the cost of each path if we're past the EOB token. */
|
/* Update the cost of each path if we're past the EOB token. */
|
||||||
@ -555,7 +555,7 @@ static void optimize_b(MACROBLOCK *mb, int i, PLANE_TYPE type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Now pick the best path through the whole trellis. */
|
/* Now pick the best path through the whole trellis. */
|
||||||
band = vp9_get_coef_band(i + 1);
|
band = get_coef_band(i + 1);
|
||||||
VP9_COMBINEENTROPYCONTEXTS(pt, *a, *l);
|
VP9_COMBINEENTROPYCONTEXTS(pt, *a, *l);
|
||||||
rate0 = tokens[next][0].rate;
|
rate0 = tokens[next][0].rate;
|
||||||
rate1 = tokens[next][1].rate;
|
rate1 = tokens[next][1].rate;
|
||||||
|
@ -489,24 +489,24 @@ static INLINE int cost_coeffs(MACROBLOCK *mb,
|
|||||||
for (; c < eob; c++) {
|
for (; c < eob; c++) {
|
||||||
int v = qcoeff_ptr[scan[c]];
|
int v = qcoeff_ptr[scan[c]];
|
||||||
int t = vp9_dct_value_tokens_ptr[v].Token;
|
int t = vp9_dct_value_tokens_ptr[v].Token;
|
||||||
cost += token_costs[vp9_get_coef_band(c)][pt][t];
|
cost += token_costs[get_coef_band(c)][pt][t];
|
||||||
cost += vp9_dct_value_cost_ptr[v];
|
cost += vp9_dct_value_cost_ptr[v];
|
||||||
pt = vp9_get_coef_context(&recent_energy, t);
|
pt = vp9_get_coef_context(&recent_energy, t);
|
||||||
}
|
}
|
||||||
if (c < seg_eob)
|
if (c < seg_eob)
|
||||||
cost += mb->hybrid_token_costs[tx_size][type][vp9_get_coef_band(c)]
|
cost += mb->hybrid_token_costs[tx_size][type][get_coef_band(c)]
|
||||||
[pt][DCT_EOB_TOKEN];
|
[pt][DCT_EOB_TOKEN];
|
||||||
} else {
|
} else {
|
||||||
int recent_energy = 0;
|
int recent_energy = 0;
|
||||||
for (; c < eob; c++) {
|
for (; c < eob; c++) {
|
||||||
int v = qcoeff_ptr[scan[c]];
|
int v = qcoeff_ptr[scan[c]];
|
||||||
int t = vp9_dct_value_tokens_ptr[v].Token;
|
int t = vp9_dct_value_tokens_ptr[v].Token;
|
||||||
cost += token_costs[vp9_get_coef_band(c)][pt][t];
|
cost += token_costs[get_coef_band(c)][pt][t];
|
||||||
cost += vp9_dct_value_cost_ptr[v];
|
cost += vp9_dct_value_cost_ptr[v];
|
||||||
pt = vp9_get_coef_context(&recent_energy, t);
|
pt = vp9_get_coef_context(&recent_energy, t);
|
||||||
}
|
}
|
||||||
if (c < seg_eob)
|
if (c < seg_eob)
|
||||||
cost += mb->token_costs[tx_size][type][vp9_get_coef_band(c)]
|
cost += mb->token_costs[tx_size][type][get_coef_band(c)]
|
||||||
[pt][DCT_EOB_TOKEN];
|
[pt][DCT_EOB_TOKEN];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ static void tokenize_b(VP9_COMP *cpi,
|
|||||||
seg_eob = 0;
|
seg_eob = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const int band = vp9_get_coef_band(c);
|
const int band = get_coef_band(c);
|
||||||
int token;
|
int token;
|
||||||
|
|
||||||
if (c < eob) {
|
if (c < eob) {
|
||||||
@ -774,7 +774,7 @@ static INLINE void stuff_b(VP9_COMP *cpi,
|
|||||||
|
|
||||||
VP9_COMBINEENTROPYCONTEXTS(pt, a_ec, l_ec);
|
VP9_COMBINEENTROPYCONTEXTS(pt, a_ec, l_ec);
|
||||||
|
|
||||||
band = vp9_get_coef_band((type == PLANE_TYPE_Y_NO_DC) ? 1 : 0);
|
band = get_coef_band((type == PLANE_TYPE_Y_NO_DC) ? 1 : 0);
|
||||||
t->Token = DCT_EOB_TOKEN;
|
t->Token = DCT_EOB_TOKEN;
|
||||||
t->context_tree = probs[type][band][pt];
|
t->context_tree = probs[type][band][pt];
|
||||||
t->skip_eob_node = 0;
|
t->skip_eob_node = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user