mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-30 12:44:07 +00:00
Refactoring: residual related variable renaming and code styling
This commit is contained in:
parent
ef0bea32e1
commit
bcd29cba5c
|
@ -1058,11 +1058,11 @@ void encode_coding_tree(encoder_control *encoder, uint16_t x_ctb,
|
|||
}
|
||||
|
||||
cabac.ctx = &g_cu_qt_root_cbf_model;
|
||||
CABAC_BIN(&cabac, 1, "rqt_root_cbf");
|
||||
if (1) {
|
||||
uint8_t *base = &encoder->in.cur_pic->y_data[x_ctb*(LCU_WIDTH>>(MAX_DEPTH)) + (y_ctb*(LCU_WIDTH>>(MAX_DEPTH))) *encoder->in.width];
|
||||
uint8_t *baseU = &encoder->in.cur_pic->u_data[x_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)) + (y_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)))*(encoder->in.width>>1)];
|
||||
uint8_t *baseV = &encoder->in.cur_pic->v_data[x_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)) + (y_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)))*(encoder->in.width>>1)];
|
||||
CABAC_BIN(&cabac, 0, "rqt_root_cbf");
|
||||
if (0) {
|
||||
uint8_t *base_y = &encoder->in.cur_pic->y_data[x_ctb*(LCU_WIDTH>>(MAX_DEPTH)) + (y_ctb*(LCU_WIDTH>>(MAX_DEPTH))) *encoder->in.width];
|
||||
uint8_t *base_u = &encoder->in.cur_pic->u_data[x_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)) + (y_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)))*(encoder->in.width>>1)];
|
||||
uint8_t *base_v = &encoder->in.cur_pic->v_data[x_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)) + (y_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)))*(encoder->in.width>>1)];
|
||||
uint32_t width = LCU_WIDTH>>depth;
|
||||
|
||||
/* INTRAPREDICTION VARIABLES */
|
||||
|
@ -1070,14 +1070,14 @@ void encode_coding_tree(encoder_control *encoder, uint16_t x_ctb,
|
|||
int16_t predU[LCU_WIDTH*LCU_WIDTH>>2];
|
||||
int16_t predV[LCU_WIDTH*LCU_WIDTH>>2];
|
||||
|
||||
uint8_t *recbase = &encoder->in.cur_pic->y_recdata[x_ctb*(LCU_WIDTH>>(MAX_DEPTH)) + (y_ctb*(LCU_WIDTH>>(MAX_DEPTH))) *encoder->in.width];
|
||||
uint8_t *recbaseU = &encoder->in.cur_pic->u_recdata[x_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)) + (y_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)))*(encoder->in.width>>1)];
|
||||
uint8_t *recbaseV = &encoder->in.cur_pic->v_recdata[x_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)) + (y_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)))*(encoder->in.width>>1)];
|
||||
uint8_t *recbase_y = &encoder->in.cur_pic->y_recdata[x_ctb*(LCU_WIDTH>>(MAX_DEPTH)) + (y_ctb*(LCU_WIDTH>>(MAX_DEPTH))) *encoder->in.width];
|
||||
uint8_t *recbase_u = &encoder->in.cur_pic->u_recdata[x_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)) + (y_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)))*(encoder->in.width>>1)];
|
||||
uint8_t *recbase_v = &encoder->in.cur_pic->v_recdata[x_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)) + (y_ctb*(LCU_WIDTH>>(MAX_DEPTH+1)))*(encoder->in.width>>1)];
|
||||
|
||||
/* TODO: dynamic memory allocation */
|
||||
int16_t coeff[LCU_WIDTH*LCU_WIDTH*2];
|
||||
int16_t coeffU[LCU_WIDTH*LCU_WIDTH>>1];
|
||||
int16_t coeffV[LCU_WIDTH*LCU_WIDTH>>1];
|
||||
int16_t coeff_y[LCU_WIDTH*LCU_WIDTH*2];
|
||||
int16_t coeff_u[LCU_WIDTH*LCU_WIDTH>>1];
|
||||
int16_t coeff_v[LCU_WIDTH*LCU_WIDTH>>1];
|
||||
|
||||
/* Initialize helper structure for transform */
|
||||
transform_info ti;
|
||||
|
@ -1086,7 +1086,7 @@ void encode_coding_tree(encoder_control *encoder, uint16_t x_ctb,
|
|||
ti.x_ctb = x_ctb; ti.y_ctb = y_ctb;
|
||||
|
||||
/* Base pointers */
|
||||
ti.base = base; ti.base_u = baseU; ti.base_v = baseV;
|
||||
ti.base = base_y; ti.base_u = base_u; ti.base_v = base_v;
|
||||
ti.base_stride = encoder->in.width;
|
||||
|
||||
// Prediction pointers
|
||||
|
@ -1094,11 +1094,11 @@ void encode_coding_tree(encoder_control *encoder, uint16_t x_ctb,
|
|||
ti.pred_stride = (LCU_WIDTH>>depth);
|
||||
|
||||
// Reconstruction pointers
|
||||
ti.recbase = recbase; ti.recbase_u = recbaseU; ti.recbase_v = recbaseV;
|
||||
ti.recbase = recbase_y; ti.recbase_u = recbase_u; ti.recbase_v = recbase_v;
|
||||
ti.recbase_stride = encoder->in.width;
|
||||
|
||||
// Coeff pointers
|
||||
ti.coeff[0] = coeff; ti.coeff[1] = coeffU; ti.coeff[2] = coeffV;
|
||||
ti.coeff[0] = coeff_y; ti.coeff[1] = coeff_u; ti.coeff[2] = coeff_v;
|
||||
ti.block_type = CU_INTER;
|
||||
|
||||
// Handle transforms, quant and reconstruction
|
||||
|
@ -1728,6 +1728,7 @@ void encode_transform_coeff(encoder_control *encoder, transform_info *ti,
|
|||
case 2:
|
||||
ctx_idx = 6;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
ctx_idx = 5;
|
||||
break;
|
||||
|
@ -1764,14 +1765,13 @@ void encode_transform_coeff(encoder_control *encoder, transform_info *ti,
|
|||
// Luma (Intra) scanmode
|
||||
dir_mode = ti->intra_pred_mode;
|
||||
|
||||
if (ctx_idx > 3
|
||||
&& ctx_idx < 6) { //if multiple scans supported for transform size
|
||||
//if multiple scans supported for transform size
|
||||
if (ctx_idx > 3 && ctx_idx < 6) {
|
||||
scan_idx = abs((int32_t) dir_mode - 26) < 5 ? 1 : (abs((int32_t)dir_mode - 10) < 5 ? 2 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
encode_coeff_nxn(encoder, &ti->coeff[0][ti->idx * coeff_fourth],
|
||||
width, 0, scan_idx);
|
||||
encode_coeff_nxn(encoder, &ti->coeff[0][ti->idx * coeff_fourth], width, 0, scan_idx);
|
||||
}
|
||||
|
||||
if (cb_u || cb_v) {
|
||||
|
|
Loading…
Reference in a new issue