mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-24 02:24:07 +00:00
Drop unused functions.
Removes functions kvz_coefficients_calc_abs, kvz_intra_rdo_cost_compare and kvz_rdo_cost_intra which are no longer used.
This commit is contained in:
parent
e4b5840f56
commit
7836ff6ec9
16
src/cu.c
16
src/cu.c
|
@ -105,22 +105,6 @@ void kvz_coefficients_blit(const coeff_t * const orig, coeff_t * const dst,
|
|||
}
|
||||
}
|
||||
|
||||
unsigned kvz_coefficients_calc_abs(const coeff_t *const buf, const int buf_stride,
|
||||
const int width)
|
||||
{
|
||||
int sum = 0;
|
||||
int y, x;
|
||||
|
||||
for (y = 0; y < width; ++y) {
|
||||
for (x = 0; x < width; ++x) {
|
||||
sum += abs(buf[x + y * buf_stride]);
|
||||
}
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
cu_info_t* kvz_cu_array_at(cu_array_t *cua, unsigned x_px, unsigned y_px)
|
||||
{
|
||||
return (cu_info_t*) kvz_cu_array_at_const(cua, x_px, y_px);
|
||||
|
|
3
src/cu.h
3
src/cu.h
|
@ -370,9 +370,6 @@ void kvz_coefficients_blit(const coeff_t *orig, coeff_t *dst,
|
|||
unsigned width, unsigned height,
|
||||
unsigned orig_stride, unsigned dst_stride);
|
||||
|
||||
unsigned kvz_coefficients_calc_abs(const coeff_t *const buf, const int buf_stride,
|
||||
const int width);
|
||||
|
||||
#define NUM_CBF_DEPTHS 5
|
||||
static const uint16_t cbf_masks[NUM_CBF_DEPTHS] = { 0x1f, 0x0f, 0x07, 0x03, 0x1 };
|
||||
|
||||
|
|
91
src/rdo.c
91
src/rdo.c
|
@ -129,97 +129,6 @@ const float kvz_f_entropy_bits[128] =
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Function to compare RDO costs
|
||||
* \param rdo_costs array of current costs
|
||||
* \param cost new cost to check
|
||||
* \returns -1 if cost is worse than the one in the array or array position for worst cost
|
||||
|
||||
This function derives the prediction samples for planar mode (intra coding).
|
||||
*/
|
||||
int kvz_intra_rdo_cost_compare(uint32_t *rdo_costs,int8_t rdo_modes_to_check, uint32_t cost)
|
||||
{
|
||||
int i;
|
||||
int found = 0;
|
||||
|
||||
for(i = 0; i < rdo_modes_to_check; i++) {
|
||||
if(rdo_costs[i] > cost) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Search for worst cost
|
||||
if(found) {
|
||||
uint32_t worst_cost = 0;
|
||||
int worst_mode = -1;
|
||||
for(i = 0; i < rdo_modes_to_check; i++) {
|
||||
if(rdo_costs[i] > worst_cost) {
|
||||
worst_cost = rdo_costs[i];
|
||||
worst_mode = i;
|
||||
}
|
||||
}
|
||||
return worst_mode;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief RDO function to calculate cost for intra
|
||||
* \returns cost to code pred block
|
||||
|
||||
** Only for luma
|
||||
*/
|
||||
uint32_t kvz_rdo_cost_intra(encoder_state_t * const state, kvz_pixel *pred, kvz_pixel *orig_block, int width, int8_t mode, int tr_depth)
|
||||
{
|
||||
const encoder_control_t * const encoder = state->encoder_control;
|
||||
coeff_t pre_quant_coeff[LCU_WIDTH*LCU_WIDTH>>2];
|
||||
int16_t block[LCU_WIDTH*LCU_WIDTH>>2];
|
||||
int16_t temp_block[LCU_WIDTH*LCU_WIDTH>>2];
|
||||
coeff_t temp_coeff[LCU_WIDTH*LCU_WIDTH>>2];
|
||||
int8_t luma_scan_mode = SCAN_DIAG;
|
||||
|
||||
int i = 0,x,y;
|
||||
for (y = 0; y < width; y++) {
|
||||
for (x = 0; x < width; x++) {
|
||||
block[i++] = orig_block[x + y*width]- pred[x + y*width];
|
||||
}
|
||||
}
|
||||
// Scan mode is diagonal, except for 4x4 and 8x8, where:
|
||||
// - angular 6-14 = vertical
|
||||
// - angular 22-30 = horizontal
|
||||
if (width <= 8) {
|
||||
if (mode >= 6 && mode <= 14) {
|
||||
luma_scan_mode = SCAN_VER;
|
||||
} else if (mode >= 22 && mode <= 30) {
|
||||
luma_scan_mode = SCAN_HOR;
|
||||
}
|
||||
}
|
||||
kvz_transform2d(encoder, block,pre_quant_coeff,width,0);
|
||||
if(encoder->rdoq_enable) {
|
||||
kvz_rdoq(state, pre_quant_coeff, temp_coeff, width, width, 0, luma_scan_mode, CU_INTRA, tr_depth);
|
||||
} else {
|
||||
kvz_quant(state, pre_quant_coeff, temp_coeff, width, width, 0, luma_scan_mode, CU_INTRA);
|
||||
}
|
||||
kvz_dequant(state, temp_coeff, pre_quant_coeff, width, width, 0, CU_INTRA);
|
||||
kvz_itransform2d(encoder, temp_block,pre_quant_coeff,width,0);
|
||||
|
||||
unsigned ssd = 0;
|
||||
// SSD between original and reconstructed
|
||||
for (i = 0; i < width*width; i++) {
|
||||
//int diff = temp_block[i]-block[i];
|
||||
int diff = orig_block[i] - CLIP(0, PIXEL_MAX, pred[i] + temp_block[i]);
|
||||
|
||||
ssd += diff*diff;
|
||||
}
|
||||
|
||||
double coeff_bits = kvz_get_coeff_cost(state, temp_coeff, width, 0, luma_scan_mode);
|
||||
|
||||
return (uint32_t)(0.5 + ssd + coeff_bits * state->global->cur_lambda_cost);
|
||||
}
|
||||
|
||||
|
||||
/** Calculate actual (or really close to actual) bitcost for coding coefficients
|
||||
* \param coeff coefficient array
|
||||
* \param width coeff block width
|
||||
|
|
|
@ -38,13 +38,9 @@
|
|||
extern const uint32_t kvz_g_go_rice_range[5];
|
||||
extern const uint32_t kvz_g_go_rice_prefix_len[5];
|
||||
|
||||
int kvz_intra_rdo_cost_compare(uint32_t *rdo_costs,int8_t rdo_modes_to_check, uint32_t cost);
|
||||
|
||||
void kvz_rdoq(encoder_state_t *state, coeff_t *coef, coeff_t *dest_coeff, int32_t width,
|
||||
int32_t height, int8_t type, int8_t scan_mode, int8_t block_type, int8_t tr_depth);
|
||||
|
||||
uint32_t kvz_rdo_cost_intra(encoder_state_t *state, kvz_pixel* pred, kvz_pixel* orig_block, int width, int8_t mode, int tr_depth);
|
||||
|
||||
int32_t kvz_get_coeff_cost(const encoder_state_t *state, coeff_t *coeff, int32_t width, int32_t type, int8_t scan_mode);
|
||||
|
||||
int32_t kvz_get_ic_rate(encoder_state_t *state, uint32_t abs_level, uint16_t ctx_num_one, uint16_t ctx_num_abs,
|
||||
|
|
Loading…
Reference in a new issue