Commit 02f3aaf7 authored by Daniel Kang's avatar Daniel Kang
Browse files

Minor refactoring of RD cost functions.

Change-Id: I876955b1d577321b5cd3f71e3fb2c4083ad5111b
parent 82edabce
...@@ -576,15 +576,15 @@ static int cost_coeffs(MACROBLOCK *mb, BLOCKD *b, int type, ENTROPY_CONTEXT *a, ...@@ -576,15 +576,15 @@ static int cost_coeffs(MACROBLOCK *mb, BLOCKD *b, int type, ENTROPY_CONTEXT *a,
if((type == PLANE_TYPE_Y_WITH_DC) && active_ht) { if((type == PLANE_TYPE_Y_WITH_DC) && active_ht) {
switch (b->bmi.as_mode.tx_type) { switch (b->bmi.as_mode.tx_type) {
case ADST_DCT : case ADST_DCT:
pt_scan = vp8_row_scan; pt_scan = vp8_row_scan;
break; break;
case DCT_ADST : case DCT_ADST:
pt_scan = vp8_col_scan; pt_scan = vp8_col_scan;
break; break;
default : default:
pt_scan = vp8_default_zig_zag1d; pt_scan = vp8_default_zig_zag1d;
break; break;
} }
...@@ -592,13 +592,12 @@ static int cost_coeffs(MACROBLOCK *mb, BLOCKD *b, int type, ENTROPY_CONTEXT *a, ...@@ -592,13 +592,12 @@ static int cost_coeffs(MACROBLOCK *mb, BLOCKD *b, int type, ENTROPY_CONTEXT *a,
} else { } else {
pt_scan = vp8_default_zig_zag1d; pt_scan = vp8_default_zig_zag1d;
} }
#define QC(I) ( qcoeff_ptr [pt_scan[I]] ) #define QC(I) ( qcoeff_ptr [pt_scan[I]] )
#else #else
#define QC(I) ( qcoeff_ptr [vp8_default_zig_zag1d[I]] ) #define QC(I) ( qcoeff_ptr [vp8_default_zig_zag1d[I]] )
#endif #endif
VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l); VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
for (; c < eob; c++) { for (; c < eob; c++) {
int v = QC(c); int v = QC(c);
...@@ -607,7 +606,6 @@ static int cost_coeffs(MACROBLOCK *mb, BLOCKD *b, int type, ENTROPY_CONTEXT *a, ...@@ -607,7 +606,6 @@ static int cost_coeffs(MACROBLOCK *mb, BLOCKD *b, int type, ENTROPY_CONTEXT *a,
cost += vp8_dct_value_cost_ptr[v]; cost += vp8_dct_value_cost_ptr[v];
pt = vp8_prev_token_class[t]; pt = vp8_prev_token_class[t];
} }
# undef QC # undef QC
if (c < 16) if (c < 16)
...@@ -702,8 +700,7 @@ static int cost_coeffs_2x2(MACROBLOCK *mb, ...@@ -702,8 +700,7 @@ static int cost_coeffs_2x2(MACROBLOCK *mb,
VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l); VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
assert(eob <= 4); assert(eob <= 4);
# define QC2X2( I) ( qcoeff_ptr [vp8_default_zig_zag1d[I]] ) #define QC2X2(I) ( qcoeff_ptr [vp8_default_zig_zag1d[I]] )
for (; c < eob; c++) { for (; c < eob; c++) {
int v = QC2X2(c); int v = QC2X2(c);
int t = vp8_dct_value_tokens_ptr[v].Token; int t = vp8_dct_value_tokens_ptr[v].Token;
...@@ -711,8 +708,8 @@ static int cost_coeffs_2x2(MACROBLOCK *mb, ...@@ -711,8 +708,8 @@ static int cost_coeffs_2x2(MACROBLOCK *mb,
cost += vp8_dct_value_cost_ptr[v]; cost += vp8_dct_value_cost_ptr[v];
pt = vp8_prev_token_class[t]; pt = vp8_prev_token_class[t];
} }
#undef QC2X2
# undef QC2X2
if (c < 4) if (c < 4)
cost += mb->token_costs_8x8 [type][vp8_coef_bands[c]] cost += mb->token_costs_8x8 [type][vp8_coef_bands[c]]
[pt] [DCT_EOB_TOKEN]; [pt] [DCT_EOB_TOKEN];
...@@ -734,8 +731,7 @@ static int cost_coeffs_8x8(MACROBLOCK *mb, ...@@ -734,8 +731,7 @@ static int cost_coeffs_8x8(MACROBLOCK *mb,
VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l); VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
# define QC8X8( I) ( qcoeff_ptr [vp8_default_zig_zag1d_8x8[I]] ) #define QC8X8(I) ( qcoeff_ptr [vp8_default_zig_zag1d_8x8[I]] )
for (; c < eob; c++) { for (; c < eob; c++) {
int v = QC8X8(c); int v = QC8X8(c);
int t = vp8_dct_value_tokens_ptr[v].Token; int t = vp8_dct_value_tokens_ptr[v].Token;
...@@ -743,8 +739,8 @@ static int cost_coeffs_8x8(MACROBLOCK *mb, ...@@ -743,8 +739,8 @@ static int cost_coeffs_8x8(MACROBLOCK *mb,
cost += vp8_dct_value_cost_ptr[v]; cost += vp8_dct_value_cost_ptr[v];
pt = vp8_prev_token_class[t]; pt = vp8_prev_token_class[t];
} }
#undef QC8X8
# undef QC8X8
if (c < 64) if (c < 64)
cost += mb->token_costs_8x8 [type][vp8_coef_bands_8x8[c]] cost += mb->token_costs_8x8 [type][vp8_coef_bands_8x8[c]]
[pt] [DCT_EOB_TOKEN]; [pt] [DCT_EOB_TOKEN];
...@@ -823,7 +819,6 @@ static int cost_coeffs_16x16(MACROBLOCK *mb, BLOCKD *b, int type, ...@@ -823,7 +819,6 @@ static int cost_coeffs_16x16(MACROBLOCK *mb, BLOCKD *b, int type,
VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l); VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
# define QC16X16(I) ( qcoeff_ptr [vp8_default_zig_zag1d_16x16[I]] ) # define QC16X16(I) ( qcoeff_ptr [vp8_default_zig_zag1d_16x16[I]] )
for (; c < eob; c++) { for (; c < eob; c++) {
int v = QC16X16(c); int v = QC16X16(c);
int t = vp8_dct_value_tokens_ptr[v].Token; int t = vp8_dct_value_tokens_ptr[v].Token;
...@@ -831,8 +826,8 @@ static int cost_coeffs_16x16(MACROBLOCK *mb, BLOCKD *b, int type, ...@@ -831,8 +826,8 @@ static int cost_coeffs_16x16(MACROBLOCK *mb, BLOCKD *b, int type,
cost += vp8_dct_value_cost_ptr[v]; cost += vp8_dct_value_cost_ptr[v];
pt = vp8_prev_token_class[t]; pt = vp8_prev_token_class[t];
} }
# undef QC16X16 # undef QC16X16
if (c < 256) if (c < 256)
cost += mb->token_costs_16x16[type][vp8_coef_bands_16x16[c]] cost += mb->token_costs_16x16[type][vp8_coef_bands_16x16[c]]
[pt][DCT_EOB_TOKEN]; [pt][DCT_EOB_TOKEN];
......
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