g_sig_last_scan -> const uint32_t*

This commit is contained in:
Laurent Fasnacht 2014-04-15 16:08:01 +02:00
parent 288a4537ba
commit 960f2cb4b0
4 changed files with 19 additions and 14 deletions

View file

@ -44,7 +44,7 @@
double g_lambda_cost[55]; double g_lambda_cost[55];
double g_cur_lambda_cost; double g_cur_lambda_cost;
uint32_t* g_sig_last_scan[3][5]; const uint32_t* g_sig_last_scan[3][5];
int8_t g_convert_to_bit[LCU_WIDTH + 1]; int8_t g_convert_to_bit[LCU_WIDTH + 1];
int8_t g_bitdepth = 8; int8_t g_bitdepth = 8;
@ -198,12 +198,17 @@ void init_tables(void)
c = 2; c = 2;
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
g_sig_last_scan[0][i] = (uint32_t*)malloc(c*c*sizeof(uint32_t)); uint32_t *sls0, *sls1, *sls2;
g_sig_last_scan[1][i] = (uint32_t*)malloc(c*c*sizeof(uint32_t)); sls0 = (uint32_t*)malloc(c*c*sizeof(uint32_t));
g_sig_last_scan[2][i] = (uint32_t*)malloc(c*c*sizeof(uint32_t)); sls1 = (uint32_t*)malloc(c*c*sizeof(uint32_t));
sls2 = (uint32_t*)malloc(c*c*sizeof(uint32_t));
init_sig_last_scan(sls0, sls1, sls2, c, c);
g_sig_last_scan[0][i] = sls0;
g_sig_last_scan[1][i] = sls1;
g_sig_last_scan[2][i] = sls2;
init_sig_last_scan(g_sig_last_scan[0][i], g_sig_last_scan[1][i],
g_sig_last_scan[2][i], c, c);
c <<= 1; c <<= 1;
} }
} }
@ -242,9 +247,9 @@ void free_tables(void)
{ {
int i; int i;
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
free(g_sig_last_scan[0][i]); FREE_POINTER(g_sig_last_scan[0][i]);
free(g_sig_last_scan[1][i]); FREE_POINTER(g_sig_last_scan[1][i]);
free(g_sig_last_scan[2][i]); FREE_POINTER(g_sig_last_scan[2][i]);
} }
} }
encoder_control *init_encoder_control(config *cfg) encoder_control *init_encoder_control(config *cfg)

View file

@ -161,7 +161,7 @@ static const uint8_t g_min_in_group[10] = {
* First index: scan pattern 0 = diagonal, 1 = horizontal, 2 = vertical * First index: scan pattern 0 = diagonal, 1 = horizontal, 2 = vertical
* Second index: (log2 - 1) size of transform block. 2x2 .. 32x32 * Second index: (log2 - 1) size of transform block. 2x2 .. 32x32
*/ */
extern uint32_t* g_sig_last_scan[3][5]; extern const uint32_t* g_sig_last_scan[3][5];
/*** /***
* List of indices for 4x4 coefficient groups within 8x8 transform block. * List of indices for 4x4 coefficient groups within 8x8 transform block.

View file

@ -438,7 +438,7 @@ void rdoq(const encoder_control * const encoder, cabac_data *cabac, coefficient
uint32_t c2_idx = 0; uint32_t c2_idx = 0;
int32_t base_level; int32_t base_level;
uint32_t *scan = g_sig_last_scan[ scan_mode ][ log2_block_size - 1 ]; const uint32_t *scan = g_sig_last_scan[ scan_mode ][ log2_block_size - 1 ];
uint32_t cg_num = width * height >> 4; uint32_t cg_num = width * height >> 4;

View file

@ -857,8 +857,8 @@ void itransform2d(int16_t *block,int16_t *coeff, int8_t block_size, int32_t mode
void quant(const encoder_control * const encoder, int16_t *coef, int16_t *q_coef, int32_t width, void quant(const encoder_control * const encoder, int16_t *coef, int16_t *q_coef, int32_t width,
int32_t height, uint32_t *ac_sum, int8_t type, int8_t scan_idx, int8_t block_type ) int32_t height, uint32_t *ac_sum, int8_t type, int8_t scan_idx, int8_t block_type )
{ {
uint32_t log2_block_size = g_convert_to_bit[ width ] + 2; const uint32_t log2_block_size = g_convert_to_bit[ width ] + 2;
uint32_t *scan = g_sig_last_scan[ scan_idx ][ log2_block_size - 1 ]; const uint32_t * const scan = g_sig_last_scan[ scan_idx ][ log2_block_size - 1 ];
#if ENABLE_SIGN_HIDING == 1 #if ENABLE_SIGN_HIDING == 1
int32_t delta_u[LCU_WIDTH*LCU_WIDTH>>2]; int32_t delta_u[LCU_WIDTH*LCU_WIDTH>>2];
@ -1103,7 +1103,7 @@ int scalinglist_parse(encoder_control * const encoder, FILE *fp)
for (size_id = 0; size_id < SCALING_LIST_SIZE_NUM; size_id++) { for (size_id = 0; size_id < SCALING_LIST_SIZE_NUM; size_id++) {
uint32_t list_id; uint32_t list_id;
uint32_t size = MIN(MAX_MATRIX_COEF_NUM, (int32_t)g_scaling_list_size[size_id]); uint32_t size = MIN(MAX_MATRIX_COEF_NUM, (int32_t)g_scaling_list_size[size_id]);
//uint32_t *scan = (size_id == 0) ? g_sig_last_scan[SCAN_DIAG][1] : g_sig_last_scan_32x32; //const uint32_t * const scan = (size_id == 0) ? g_sig_last_scan[SCAN_DIAG][1] : g_sig_last_scan_32x32;
for (list_id = 0; list_id < g_scaling_list_num[size_id]; list_id++) { for (list_id = 0; list_id < g_scaling_list_num[size_id]; list_id++) {
int found; int found;