Commit 5cab8b7a authored by Ronald S. Bultje's avatar Ronald S. Bultje Committed by Gerrit Code Review
Browse files

Merge "Give 4x4 scan and coef_band tables a _4x4 suffix." into experimental

parents 58961c74 8986eb5c
......@@ -47,7 +47,7 @@ DECLARE_ALIGNED(16, const unsigned char, vp9_norm[256]) = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
DECLARE_ALIGNED(16, const int, vp9_coef_bands[16]) = {
DECLARE_ALIGNED(16, const int, vp9_coef_bands_4x4[16]) = {
0, 1, 2, 3, 6, 4, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7
};
......@@ -55,20 +55,20 @@ DECLARE_ALIGNED(16, cuchar, vp9_prev_token_class[MAX_ENTROPY_TOKENS]) = {
0, 1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 0
};
DECLARE_ALIGNED(16, const int, vp9_default_zig_zag1d[16]) = {
DECLARE_ALIGNED(16, const int, vp9_default_zig_zag1d_4x4[16]) = {
0, 1, 4, 8,
5, 2, 3, 6,
9, 12, 13, 10,
7, 11, 14, 15,
};
DECLARE_ALIGNED(16, const int, vp9_col_scan[16]) = {
DECLARE_ALIGNED(16, const int, vp9_col_scan_4x4[16]) = {
0, 4, 8, 12,
1, 5, 9, 13,
2, 6, 10, 14,
3, 7, 11, 15
};
DECLARE_ALIGNED(16, const int, vp9_row_scan[16]) = {
DECLARE_ALIGNED(16, const int, vp9_row_scan_4x4[16]) = {
0, 1, 2, 3,
4, 5, 6, 7,
8, 9, 10, 11,
......
......@@ -74,7 +74,7 @@ extern vp9_extra_bit_struct vp9_extra_bits[12]; /* indexed by token value */
position within the 4x4 DCT. */
#define COEF_BANDS 8
extern DECLARE_ALIGNED(16, const int, vp9_coef_bands[16]);
extern DECLARE_ALIGNED(16, const int, vp9_coef_bands_4x4[16]);
extern DECLARE_ALIGNED(64, const int, vp9_coef_bands_8x8[64]);
extern DECLARE_ALIGNED(16, const int, vp9_coef_bands_16x16[256]);
#if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS
......@@ -114,10 +114,10 @@ extern DECLARE_ALIGNED(16, const unsigned char, vp9_prev_token_class[MAX_ENTROPY
struct VP9Common;
void vp9_default_coef_probs(struct VP9Common *);
extern DECLARE_ALIGNED(16, const int, vp9_default_zig_zag1d[16]);
extern DECLARE_ALIGNED(16, const int, vp9_default_zig_zag1d_4x4[16]);
extern DECLARE_ALIGNED(16, const int, vp9_col_scan[16]);
extern DECLARE_ALIGNED(16, const int, vp9_row_scan[16]);
extern DECLARE_ALIGNED(16, const int, vp9_col_scan_4x4[16]);
extern DECLARE_ALIGNED(16, const int, vp9_row_scan_4x4[16]);
extern DECLARE_ALIGNED(64, const int, vp9_default_zig_zag1d_8x8[64]);
extern DECLARE_ALIGNED(16, const int, vp9_default_zig_zag1d_16x16[256]);
......
......@@ -88,7 +88,7 @@ void vp9_init_de_quantizer(VP9D_COMP *pbi) {
/* all the ac values =; */
for (i = 1; i < 16; i++) {
int rc = vp9_default_zig_zag1d[i];
int rc = vp9_default_zig_zag1d_4x4[i];
pc->Y1dequant[Q][rc] = (short)vp9_ac_yquant(Q);
pc->Y2dequant[Q][rc] = (short)vp9_ac2quant(Q, pc->y2ac_delta_q);
......
......@@ -368,7 +368,8 @@ static int vp9_decode_mb_tokens_8x8(VP9D_COMP* const pbi,
eobs[24] = c = decode_coefs(pbi, xd, bc, a, l, PLANE_TYPE_Y2,
DCT_DCT, get_eob(xd, segment_id, 4),
xd->block[24].qcoeff,
vp9_default_zig_zag1d, TX_8X8, vp9_coef_bands);
vp9_default_zig_zag1d_4x4, TX_8X8,
vp9_coef_bands_4x4);
eobtotal += c - 4;
type = PLANE_TYPE_Y_NO_DC;
} else {
......@@ -412,7 +413,8 @@ static int vp9_decode_mb_tokens_8x8(VP9D_COMP* const pbi,
eobs[i] = c = decode_coefs(pbi, xd, bc, a, l, PLANE_TYPE_UV,
DCT_DCT, seg_eob, xd->block[i].qcoeff,
vp9_default_zig_zag1d, TX_4X4, vp9_coef_bands);
vp9_default_zig_zag1d_4x4, TX_4X4,
vp9_coef_bands_4x4);
eobtotal += c;
}
} else {
......@@ -453,7 +455,7 @@ static int decode_coefs_4x4(VP9D_COMP *dx, MACROBLOCKD *xd,
int c;
c = decode_coefs(dx, xd, bc, a, l, type, tx_type, seg_eob,
xd->block[i].qcoeff, scan, TX_4X4, vp9_coef_bands);
xd->block[i].qcoeff, scan, TX_4X4, vp9_coef_bands_4x4);
eobs[i] = c;
return c;
......@@ -468,13 +470,13 @@ static int decode_coefs_4x4_y(VP9D_COMP *dx, MACROBLOCKD *xd,
switch (tx_type) {
case ADST_DCT:
scan = vp9_row_scan;
scan = vp9_row_scan_4x4;
break;
case DCT_ADST:
scan = vp9_col_scan;
scan = vp9_col_scan_4x4;
break;
default:
scan = vp9_default_zig_zag1d;
scan = vp9_default_zig_zag1d_4x4;
break;
}
......@@ -499,7 +501,7 @@ static int decode_mb_tokens_4x4_uv(VP9D_COMP* const dx,
// chroma blocks
for (i = 16; i < 24; i++) {
eobtotal += decode_coefs_4x4(dx, xd, bc, PLANE_TYPE_UV, i, seg_eob,
DCT_DCT, vp9_default_zig_zag1d);
DCT_DCT, vp9_default_zig_zag1d_4x4);
}
return eobtotal;
......@@ -526,7 +528,7 @@ static int vp9_decode_mb_tokens_4x4(VP9D_COMP* const dx,
// 2nd order DC block
if (has_2nd_order) {
eobtotal += decode_coefs_4x4(dx, xd, bc, PLANE_TYPE_Y2, 24, seg_eob,
DCT_DCT, vp9_default_zig_zag1d) - 16;
DCT_DCT, vp9_default_zig_zag1d_4x4) - 16;
type = PLANE_TYPE_Y_NO_DC;
} else {
xd->above_context->y2 = 0;
......
......@@ -384,8 +384,8 @@ static void optimize_b(MACROBLOCK *mb, int i, PLANE_TYPE type,
switch (tx_size) {
default:
case TX_4X4:
scan = vp9_default_zig_zag1d;
bands = vp9_coef_bands;
scan = vp9_default_zig_zag1d_4x4;
bands = vp9_coef_bands_4x4;
default_eob = 16;
// TODO: this isn't called (for intra4x4 modes), but will be left in
// since it could be used later
......@@ -394,19 +394,19 @@ static void optimize_b(MACROBLOCK *mb, int i, PLANE_TYPE type,
if (tx_type != DCT_DCT) {
switch (tx_type) {
case ADST_DCT:
scan = vp9_row_scan;
scan = vp9_row_scan_4x4;
break;
case DCT_ADST:
scan = vp9_col_scan;
scan = vp9_col_scan_4x4;
break;
default:
scan = vp9_default_zig_zag1d;
scan = vp9_default_zig_zag1d_4x4;
break;
}
} else {
scan = vp9_default_zig_zag1d;
scan = vp9_default_zig_zag1d_4x4;
}
}
break;
......@@ -601,7 +601,7 @@ static void check_reset_2nd_coeffs(MACROBLOCKD *xd,
return;
for (i = 0; i < bd->eob; i++) {
int coef = bd->dqcoeff[vp9_default_zig_zag1d[i]];
int coef = bd->dqcoeff[vp9_default_zig_zag1d_4x4[i]];
sum += (coef >= 0) ? coef : -coef;
if (sum >= SUM_2ND_COEFF_THRESH)
return;
......@@ -609,7 +609,7 @@ static void check_reset_2nd_coeffs(MACROBLOCKD *xd,
if (sum < SUM_2ND_COEFF_THRESH) {
for (i = 0; i < bd->eob; i++) {
int rc = vp9_default_zig_zag1d[i];
int rc = vp9_default_zig_zag1d_4x4[i];
bd->qcoeff[rc] = 0;
bd->dqcoeff[rc] = 0;
}
......
......@@ -40,15 +40,15 @@ void vp9_ht_quantize_b_4x4(BLOCK *b, BLOCKD *d, TX_TYPE tx_type) {
switch (tx_type) {
case ADST_DCT :
pt_scan = vp9_row_scan;
pt_scan = vp9_row_scan_4x4;
break;
case DCT_ADST :
pt_scan = vp9_col_scan;
pt_scan = vp9_col_scan_4x4;
break;
default :
pt_scan = vp9_default_zig_zag1d;
pt_scan = vp9_default_zig_zag1d_4x4;
break;
}
......@@ -106,7 +106,7 @@ void vp9_regular_quantize_b_4x4(BLOCK *b, BLOCKD *d) {
eob = -1;
for (i = 0; i < b->eob_max_offset; i++) {
rc = vp9_default_zig_zag1d[i];
rc = vp9_default_zig_zag1d_4x4[i];
z = coeff_ptr[rc];
zbin = zbin_ptr[rc] + *zbin_boost_ptr + zbin_oq_value;
......@@ -192,7 +192,7 @@ void vp9_regular_quantize_b_2x2(BLOCK *b, BLOCKD *d) {
eob = -1;
for (i = 0; i < b->eob_max_offset_8x8; i++) {
rc = vp9_default_zig_zag1d[i];
rc = vp9_default_zig_zag1d_4x4[i];
z = coeff_ptr[rc];
zbin_boost_ptr = &b->zrun_zbin_boost[zbin_zrun_index];
......@@ -606,7 +606,7 @@ void vp9_init_quantizer(VP9_COMP *cpi) {
// all the 4x4 ac values =;
for (i = 1; i < 16; i++) {
int rc = vp9_default_zig_zag1d[i];
int rc = vp9_default_zig_zag1d_4x4[i];
quant_val = vp9_ac_yquant(Q);
invert_quant(cpi->Y1quant[Q] + rc,
......
......@@ -526,15 +526,15 @@ static int cost_coeffs_2x2(MACROBLOCK *mb,
assert(eob <= 4);
for (; c < eob; c++) {
int v = qcoeff_ptr[vp9_default_zig_zag1d[c]];
int v = qcoeff_ptr[vp9_default_zig_zag1d_4x4[c]];
int t = vp9_dct_value_tokens_ptr[v].Token;
cost += mb->token_costs[TX_8X8][type][vp9_coef_bands[c]][pt][t];
cost += mb->token_costs[TX_8X8][type][vp9_coef_bands_4x4[c]][pt][t];
cost += vp9_dct_value_cost_ptr[v];
pt = vp9_prev_token_class[t];
}
if (c < 4)
cost += mb->token_costs[TX_8X8][type][vp9_coef_bands[c]]
cost += mb->token_costs[TX_8X8][type][vp9_coef_bands_4x4[c]]
[pt] [DCT_EOB_TOKEN];
// is eob first coefficient;
pt = (c > !type);
......@@ -555,8 +555,8 @@ static int cost_coeffs(MACROBLOCK *mb, BLOCKD *b, PLANE_TYPE type,
MB_MODE_INFO *mbmi = &mb->e_mbd.mode_info_context->mbmi;
TX_TYPE tx_type = DCT_DCT;
int segment_id = mbmi->segment_id;
scan = vp9_default_zig_zag1d;
band = vp9_coef_bands;
scan = vp9_default_zig_zag1d_4x4;
band = vp9_coef_bands_4x4;
default_eob = 16;
switch (tx_size) {
......@@ -566,15 +566,15 @@ static int cost_coeffs(MACROBLOCK *mb, BLOCKD *b, PLANE_TYPE type,
if (tx_type != DCT_DCT) {
switch (tx_type) {
case ADST_DCT:
scan = vp9_row_scan;
scan = vp9_row_scan_4x4;
break;
case DCT_ADST:
scan = vp9_col_scan;
scan = vp9_col_scan_4x4;
break;
default:
scan = vp9_default_zig_zag1d;
scan = vp9_default_zig_zag1d_4x4;
break;
}
}
......
......@@ -134,15 +134,15 @@ static void tokenize_b(VP9_COMP *cpi,
default:
case TX_4X4:
seg_eob = 16;
bands = vp9_coef_bands;
scan = vp9_default_zig_zag1d;
bands = vp9_coef_bands_4x4;
scan = vp9_default_zig_zag1d_4x4;
if (tx_type != DCT_DCT) {
counts = cpi->hybrid_coef_counts_4x4;
probs = cpi->common.fc.hybrid_coef_probs_4x4;
if (tx_type == ADST_DCT) {
scan = vp9_row_scan;
scan = vp9_row_scan_4x4;
} else if (tx_type == DCT_ADST) {
scan = vp9_col_scan;
scan = vp9_col_scan_4x4;
}
} else {
counts = cpi->coef_counts_4x4;
......@@ -152,8 +152,8 @@ static void tokenize_b(VP9_COMP *cpi,
case TX_8X8:
if (type == PLANE_TYPE_Y2) {
seg_eob = 4;
bands = vp9_coef_bands;
scan = vp9_default_zig_zag1d;
bands = vp9_coef_bands_4x4;
scan = vp9_default_zig_zag1d_4x4;
} else {
#if CONFIG_CNVCONTEXT
a_ec = (a[0] + a[1]) != 0;
......@@ -729,7 +729,7 @@ static __inline void stuff_b(VP9_COMP *cpi,
switch (tx_size) {
default:
case TX_4X4:
bands = vp9_coef_bands;
bands = vp9_coef_bands_4x4;
if (tx_type != DCT_DCT) {
counts = cpi->hybrid_coef_counts_4x4;
probs = cpi->common.fc.hybrid_coef_probs_4x4;
......
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