mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-30 12:44:07 +00:00
encoder_control should be const in nearly all the code
This commit is contained in:
parent
0e7a5057d1
commit
78c579053a
|
@ -49,9 +49,9 @@ int8_t g_convert_to_bit[LCU_WIDTH + 1];
|
|||
int8_t g_bitdepth = 8;
|
||||
|
||||
/* Local functions. */
|
||||
static void add_checksum(encoder_control* encoder);
|
||||
static void encode_VUI(encoder_control* encoder);
|
||||
static void encode_sao(encoder_control *encoder,
|
||||
static void add_checksum(const encoder_control * const encoder);
|
||||
static void encode_VUI(const encoder_control * const encoder);
|
||||
static void encode_sao(const encoder_control * const encoder,
|
||||
cabac_data *cabac,
|
||||
unsigned x_lcu, uint16_t y_lcu,
|
||||
sao_info *sao_luma, sao_info *sao_chroma);
|
||||
|
@ -214,7 +214,7 @@ void init_tables(void)
|
|||
Implementation closer to HM (Used HM12 as reference)
|
||||
- Still missing functionality when GOP and B-pictures are used
|
||||
*/
|
||||
void init_lambda(encoder_control *encoder)
|
||||
void init_lambda(const encoder_control * const encoder)
|
||||
{
|
||||
double qp = encoder->QP;
|
||||
double lambda_scale = 1.0;
|
||||
|
@ -375,7 +375,7 @@ void init_encoder_input(encoder_input *input, FILE *inputfile,
|
|||
#endif
|
||||
}
|
||||
|
||||
static void write_aud(encoder_control* encoder)
|
||||
static void write_aud(const encoder_control * const encoder)
|
||||
{
|
||||
encode_access_unit_delimiter(encoder);
|
||||
nal_write(encoder->output, AUD_NUT, 0, 1);
|
||||
|
@ -615,9 +615,9 @@ static int read_and_fill_frame_data(FILE *file,
|
|||
return 1;
|
||||
}
|
||||
|
||||
int read_one_frame(FILE* file, encoder_control* encoder)
|
||||
int read_one_frame(FILE* file, const encoder_control * const encoder)
|
||||
{
|
||||
encoder_input* in = &encoder->in;
|
||||
const encoder_input* const in = &encoder->in;
|
||||
unsigned width = in->real_width;
|
||||
unsigned height = in->real_height;
|
||||
unsigned array_width = in->cur_pic->width;
|
||||
|
@ -661,7 +661,7 @@ int read_one_frame(FILE* file, encoder_control* encoder)
|
|||
* \param encoder The encoder.
|
||||
* \returns Void
|
||||
*/
|
||||
static void add_checksum(encoder_control* encoder)
|
||||
static void add_checksum(const encoder_control * const encoder)
|
||||
{
|
||||
unsigned char checksum[3][SEI_HASH_MAX_LENGTH];
|
||||
uint32_t checksum_val;
|
||||
|
@ -686,7 +686,7 @@ static void add_checksum(encoder_control* encoder)
|
|||
bitstream_align(encoder->stream);
|
||||
}
|
||||
|
||||
void encode_access_unit_delimiter(encoder_control* encoder)
|
||||
void encode_access_unit_delimiter(const encoder_control * const encoder)
|
||||
{
|
||||
uint8_t pic_type = encoder->in.cur_pic->slicetype == SLICE_I ? 0
|
||||
: encoder->in.cur_pic->slicetype == SLICE_P ? 1
|
||||
|
@ -694,7 +694,7 @@ void encode_access_unit_delimiter(encoder_control* encoder)
|
|||
WRITE_U(encoder->stream, pic_type, 3, "pic_type");
|
||||
}
|
||||
|
||||
void encode_prefix_sei_version(encoder_control* encoder)
|
||||
void encode_prefix_sei_version(const encoder_control * const encoder)
|
||||
{
|
||||
#define STR_BUF_LEN 1000
|
||||
|
||||
|
@ -741,7 +741,7 @@ void encode_prefix_sei_version(encoder_control* encoder)
|
|||
#undef STR_BUF_LEN
|
||||
}
|
||||
|
||||
void encode_pic_parameter_set(encoder_control* encoder)
|
||||
void encode_pic_parameter_set(const encoder_control * const encoder)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
printf("=========== Picture Parameter Set ID: 0 ===========\n");
|
||||
|
@ -801,7 +801,7 @@ void encode_pic_parameter_set(encoder_control* encoder)
|
|||
WRITE_U(encoder->stream, 0, 1, "pps_extension_flag");
|
||||
}
|
||||
|
||||
static void encode_PTL(encoder_control *encoder)
|
||||
static void encode_PTL(const encoder_control * const encoder)
|
||||
{
|
||||
int i;
|
||||
// PTL
|
||||
|
@ -840,7 +840,7 @@ static void encode_PTL(encoder_control *encoder)
|
|||
// end PTL
|
||||
}
|
||||
|
||||
static void encode_scaling_list(encoder_control* encoder)
|
||||
static void encode_scaling_list(const encoder_control * const encoder)
|
||||
{
|
||||
uint32_t size_id;
|
||||
for (size_id = 0; size_id < SCALING_LIST_SIZE_NUM; size_id++) {
|
||||
|
@ -895,9 +895,9 @@ static void encode_scaling_list(encoder_control* encoder)
|
|||
}
|
||||
}
|
||||
|
||||
void encode_seq_parameter_set(encoder_control* encoder)
|
||||
void encode_seq_parameter_set(const encoder_control * const encoder)
|
||||
{
|
||||
encoder_input* const in = &encoder->in;
|
||||
const encoder_input* const in = &encoder->in;
|
||||
|
||||
#ifdef _DEBUG
|
||||
printf("=========== Sequence Parameter Set ID: 0 ===========\n");
|
||||
|
@ -998,7 +998,7 @@ void encode_seq_parameter_set(encoder_control* encoder)
|
|||
WRITE_U(encoder->stream, 0, 1, "sps_extension_flag");
|
||||
}
|
||||
|
||||
void encode_vid_parameter_set(encoder_control* encoder)
|
||||
void encode_vid_parameter_set(const encoder_control * const encoder)
|
||||
{
|
||||
int i;
|
||||
#ifdef _DEBUG
|
||||
|
@ -1033,7 +1033,7 @@ void encode_vid_parameter_set(encoder_control* encoder)
|
|||
WRITE_U(encoder->stream, 0, 1, "vps_extension_flag");
|
||||
}
|
||||
|
||||
static void encode_VUI(encoder_control* encoder)
|
||||
static void encode_VUI(const encoder_control * const encoder)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
printf("=========== VUI Set ID: 0 ===========\n");
|
||||
|
@ -1132,7 +1132,7 @@ static void encode_VUI(encoder_control* encoder)
|
|||
//ENDIF
|
||||
}
|
||||
|
||||
void encode_slice_header(encoder_control* encoder)
|
||||
void encode_slice_header(const encoder_control * const encoder)
|
||||
{
|
||||
picture *cur_pic = encoder->in.cur_pic;
|
||||
|
||||
|
@ -1202,7 +1202,7 @@ void encode_slice_header(encoder_control* encoder)
|
|||
}
|
||||
|
||||
|
||||
static void encode_sao_color(encoder_control *encoder, cabac_data *cabac, sao_info *sao,
|
||||
static void encode_sao_color(const encoder_control * const encoder, cabac_data *cabac, sao_info *sao,
|
||||
color_index color_i)
|
||||
{
|
||||
picture *pic = encoder->in.cur_pic;
|
||||
|
@ -1269,7 +1269,7 @@ static void encode_sao_merge_flags(sao_info *sao, cabac_data *cabac,
|
|||
/**
|
||||
* \brief Encode SAO information.
|
||||
*/
|
||||
static void encode_sao(encoder_control *encoder,
|
||||
static void encode_sao(const encoder_control * const encoder,
|
||||
cabac_data *cabac,
|
||||
unsigned x_lcu, uint16_t y_lcu,
|
||||
sao_info *sao_luma, sao_info *sao_chroma)
|
||||
|
@ -1286,7 +1286,7 @@ static void encode_sao(encoder_control *encoder,
|
|||
}
|
||||
|
||||
|
||||
void encode_coding_tree(encoder_control *encoder, cabac_data *cabac,
|
||||
void encode_coding_tree(const encoder_control * const encoder, cabac_data *cabac,
|
||||
uint16_t x_ctb, uint16_t y_ctb, uint8_t depth)
|
||||
{
|
||||
cu_info *cur_cu = &encoder->in.cur_pic->cu_array[MAX_DEPTH][x_ctb + y_ctb * (encoder->in.width_in_lcu << MAX_DEPTH)];
|
||||
|
@ -1704,7 +1704,7 @@ void encode_coding_tree(encoder_control *encoder, cabac_data *cabac,
|
|||
/* end coding_unit */
|
||||
}
|
||||
|
||||
static void transform_chroma(encoder_control *encoder, cabac_data *cabac, cu_info *cur_cu,
|
||||
static void transform_chroma(const encoder_control * const encoder, cabac_data *cabac, cu_info *cur_cu,
|
||||
int depth, pixel *base_u, pixel *pred_u,
|
||||
coefficient *coeff_u, int8_t scan_idx_chroma,
|
||||
coefficient *pre_quant_coeff, coefficient *block)
|
||||
|
@ -1737,7 +1737,7 @@ static void transform_chroma(encoder_control *encoder, cabac_data *cabac, cu_inf
|
|||
}
|
||||
}
|
||||
|
||||
static void reconstruct_chroma(encoder_control *encoder, cu_info *cur_cu,
|
||||
static void reconstruct_chroma(const encoder_control * const encoder, cu_info *cur_cu,
|
||||
int depth, int has_coeffs, coefficient *coeff_u,
|
||||
pixel *recbase_u, pixel *pred_u, int color_type,
|
||||
coefficient *pre_quant_coeff, coefficient *block)
|
||||
|
@ -1774,7 +1774,7 @@ static void reconstruct_chroma(encoder_control *encoder, cu_info *cur_cu,
|
|||
}
|
||||
}
|
||||
|
||||
void encode_transform_tree(encoder_control* encoder, cabac_data *cabac, int32_t x, int32_t y, uint8_t depth, lcu_t *lcu)
|
||||
void encode_transform_tree(const encoder_control * const encoder, cabac_data* cabac, int32_t x, int32_t y, uint8_t depth, lcu_t* lcu)
|
||||
{
|
||||
// we have 64>>depth transform size
|
||||
int x_local = (x&0x3f), y_local = (y&0x3f);
|
||||
|
@ -2117,7 +2117,7 @@ void encode_transform_tree(encoder_control* encoder, cabac_data *cabac, int32_t
|
|||
// end Residual Coding
|
||||
}
|
||||
|
||||
static void encode_transform_unit(encoder_control *encoder, cabac_data *cabac,
|
||||
static void encode_transform_unit(const encoder_control * const encoder, cabac_data *cabac,
|
||||
int x_pu, int y_pu, int depth, int tr_depth)
|
||||
{
|
||||
uint8_t width = LCU_WIDTH >> depth;
|
||||
|
@ -2267,7 +2267,7 @@ static void encode_transform_unit(encoder_control *encoder, cabac_data *cabac,
|
|||
* \param parent_coeff_u What was signaled at previous level for cbf_cb.
|
||||
* \param parent_coeff_v What was signlaed at previous level for cbf_cr.
|
||||
*/
|
||||
void encode_transform_coeff(encoder_control *encoder, cabac_data *cabac, int32_t x_pu,int32_t y_pu,
|
||||
void encode_transform_coeff(const encoder_control * const encoder, cabac_data *cabac, int32_t x_pu,int32_t y_pu,
|
||||
int8_t depth, int8_t tr_depth, uint8_t parent_coeff_u, uint8_t parent_coeff_v)
|
||||
{
|
||||
int32_t x_cu = x_pu / 2;
|
||||
|
@ -2347,7 +2347,7 @@ void encode_transform_coeff(encoder_control *encoder, cabac_data *cabac, int32_t
|
|||
}
|
||||
}
|
||||
|
||||
void encode_coeff_nxn(encoder_control *encoder, cabac_data *cabac, coefficient *coeff, uint8_t width,
|
||||
void encode_coeff_nxn(const encoder_control * const encoder, cabac_data *cabac, coefficient *coeff, uint8_t width,
|
||||
uint8_t type, int8_t scan_mode, int8_t tr_skip)
|
||||
{
|
||||
int c1 = 1;
|
||||
|
|
|
@ -101,33 +101,33 @@ typedef struct
|
|||
} encoder_control;
|
||||
|
||||
void init_tables(void);
|
||||
void init_lambda(encoder_control* encoder);
|
||||
void init_lambda(const encoder_control * const encoder);
|
||||
void free_tables(void);
|
||||
encoder_control *init_encoder_control(config *cfg);
|
||||
void init_encoder_input(encoder_input *input, FILE* inputfile,
|
||||
int32_t width, int32_t height);
|
||||
void encode_one_frame(encoder_control *encoder);
|
||||
int read_one_frame(FILE *file, encoder_control *encoder);
|
||||
int read_one_frame(FILE *file, const encoder_control * const encoder);
|
||||
|
||||
void encode_seq_parameter_set(encoder_control *encoder);
|
||||
void encode_pic_parameter_set(encoder_control *encoder);
|
||||
void encode_vid_parameter_set(encoder_control *encoder);
|
||||
void encode_slice_header(encoder_control *encoder);
|
||||
void encode_access_unit_delimiter(encoder_control* encoder);
|
||||
void encode_prefix_sei_version(encoder_control* encoder);
|
||||
void encode_coding_tree(encoder_control *encoder, cabac_data *cabac, uint16_t x_ctb,
|
||||
void encode_seq_parameter_set(const encoder_control * const encoder);
|
||||
void encode_pic_parameter_set(const encoder_control * const encoder);
|
||||
void encode_vid_parameter_set(const encoder_control * const encoder);
|
||||
void encode_slice_header(const encoder_control * const encoder);
|
||||
void encode_access_unit_delimiter(const encoder_control * const encoder);
|
||||
void encode_prefix_sei_version(const encoder_control * const encoder);
|
||||
void encode_coding_tree(const encoder_control * const encoder, cabac_data *cabac, uint16_t x_ctb,
|
||||
uint16_t y_ctb, uint8_t depth);
|
||||
|
||||
void encode_last_significant_xy(cabac_data *cabac,
|
||||
uint8_t lastpos_x, uint8_t lastpos_y,
|
||||
uint8_t width, uint8_t height,
|
||||
uint8_t type, uint8_t scan);
|
||||
void encode_coeff_nxn(encoder_control *encoder, cabac_data *cabac, int16_t *coeff, uint8_t width,
|
||||
void encode_coeff_nxn(const encoder_control * const encoder, cabac_data *cabac, int16_t *coeff, uint8_t width,
|
||||
uint8_t type, int8_t scan_mode, int8_t tr_skip);
|
||||
void encode_transform_tree( encoder_control* encoder, cabac_data* cabac, int32_t x, int32_t y, uint8_t depth, lcu_t* lcu );
|
||||
void encode_transform_coeff(encoder_control *encoder, cabac_data *cabac, int32_t x_cu, int32_t y_cu,
|
||||
void encode_transform_tree(const encoder_control * const encoder, cabac_data* cabac, int32_t x, int32_t y, uint8_t depth, lcu_t* lcu );
|
||||
void encode_transform_coeff(const encoder_control * const encoder, cabac_data *cabac, int32_t x_cu, int32_t y_cu,
|
||||
int8_t depth, int8_t tr_depth, uint8_t parent_coeff_u, uint8_t parent_coeff_v);
|
||||
void encode_block_residual(encoder_control *encoder,
|
||||
void encode_block_residual(const encoder_control * const encoder,
|
||||
uint16_t x_ctb, uint16_t y_ctb, uint8_t depth);
|
||||
|
||||
extern double g_lambda_cost[55];
|
||||
|
|
10
src/filter.c
10
src/filter.c
|
@ -162,7 +162,7 @@ INLINE void filter_deblock_chroma(pixel *src, int32_t offset, int32_t tc,
|
|||
/**
|
||||
* \brief
|
||||
*/
|
||||
void filter_deblock_edge_luma(encoder_control *encoder,
|
||||
void filter_deblock_edge_luma(const encoder_control * const encoder,
|
||||
int32_t xpos, int32_t ypos,
|
||||
int8_t depth, int8_t dir)
|
||||
{
|
||||
|
@ -286,7 +286,7 @@ void filter_deblock_edge_luma(encoder_control *encoder,
|
|||
/**
|
||||
* \brief
|
||||
*/
|
||||
void filter_deblock_edge_chroma(encoder_control *encoder,
|
||||
void filter_deblock_edge_chroma(const encoder_control * const encoder,
|
||||
int32_t x, int32_t y,
|
||||
int8_t depth, int8_t dir)
|
||||
{
|
||||
|
@ -381,7 +381,7 @@ void filter_deblock_edge_chroma(encoder_control *encoder,
|
|||
* until the coded block size has been achived. Calls luma and chroma filtering
|
||||
* functions for each coded CU size.
|
||||
*/
|
||||
void filter_deblock_cu(encoder_control *encoder, int32_t x, int32_t y, int8_t depth, int32_t edge)
|
||||
void filter_deblock_cu(const encoder_control * const encoder, int32_t x, int32_t y, int8_t depth, int32_t edge)
|
||||
{
|
||||
cu_info *cur_cu = &encoder->in.cur_pic->cu_array[MAX_DEPTH][x + y*(encoder->in.width_in_lcu << MAX_DEPTH)];
|
||||
uint8_t split_flag = (cur_cu->depth > depth) ? 1 : 0;
|
||||
|
@ -425,7 +425,7 @@ void filter_deblock_cu(encoder_control *encoder, int32_t x, int32_t y, int8_t de
|
|||
* the Largest Coding Units (LCU) and call filter_deblock_cu with absolute
|
||||
* X and Y coordinates of the LCU.
|
||||
*/
|
||||
void filter_deblock(encoder_control* encoder)
|
||||
void filter_deblock(const encoder_control * const encoder)
|
||||
{
|
||||
int16_t x, y;
|
||||
|
||||
|
@ -460,7 +460,7 @@ void filter_deblock(encoder_control* encoder)
|
|||
* - After vertical filtering the left edge, filter the last 4 pixels of
|
||||
* horizontal edges in the LCU to the left.
|
||||
*/
|
||||
void filter_deblock_lcu(encoder_control *encoder, int x_px, int y_px)
|
||||
void filter_deblock_lcu(const encoder_control * const encoder, int x_px, int y_px)
|
||||
{
|
||||
const vector2d lcu = { x_px / LCU_WIDTH, y_px / LCU_WIDTH };
|
||||
|
||||
|
|
10
src/filter.h
10
src/filter.h
|
@ -32,16 +32,16 @@
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
// FUNCTIONS
|
||||
// Deblocking
|
||||
void filter_deblock_cu(encoder_control *encoder, int32_t x_px, int32_t y_px,
|
||||
void filter_deblock_cu(const encoder_control * const encoder, int32_t x_px, int32_t y_px,
|
||||
int8_t depth, int32_t edge);
|
||||
void filter_deblock_edge_luma(encoder_control *encoder,
|
||||
void filter_deblock_edge_luma(const encoder_control * const encoder,
|
||||
int32_t x_pos, int32_t y_pos,
|
||||
int8_t depth, int8_t dir);
|
||||
void filter_deblock_edge_chroma(encoder_control *encoder,
|
||||
void filter_deblock_edge_chroma(const encoder_control * const encoder,
|
||||
int32_t xpos, int32_t ypos,
|
||||
int8_t depth, int8_t dir);
|
||||
void filter_deblock(encoder_control *encoder);
|
||||
void filter_deblock_lcu(encoder_control *encoder, int x_px, int y_px);
|
||||
void filter_deblock(const encoder_control * const encoder);
|
||||
void filter_deblock_lcu(const encoder_control * const encoder, int x_px, int y_px);
|
||||
void filter_deblock_luma(pixel *src, int32_t offset, int32_t tc , int8_t sw,
|
||||
int8_t part_p_nofilter, int8_t part_q_nofilter,
|
||||
int32_t thr_cut,
|
||||
|
|
|
@ -322,7 +322,7 @@ void inter_get_spatial_merge_candidates(int32_t x, int32_t y, int8_t depth, cu_i
|
|||
* \param depth current block depth
|
||||
* \param mv_pred[2][2] 2x motion vector prediction
|
||||
*/
|
||||
void inter_get_mv_cand(encoder_control *encoder, int32_t x, int32_t y, int8_t depth, int16_t mv_cand[2][2], cu_info* cur_cu, lcu_t *lcu)
|
||||
void inter_get_mv_cand(const encoder_control * const encoder, int32_t x, int32_t y, int8_t depth, int16_t mv_cand[2][2], cu_info* cur_cu, lcu_t *lcu)
|
||||
{
|
||||
uint8_t candidates = 0;
|
||||
uint8_t b_candidates = 0;
|
||||
|
|
|
@ -35,6 +35,6 @@ void inter_recon_lcu(picture* ref,int32_t xpos, int32_t ypos,int32_t width, cons
|
|||
|
||||
void inter_get_spatial_merge_candidates(int32_t x, int32_t y, int8_t depth, cu_info **b0, cu_info **b1,
|
||||
cu_info **b2,cu_info **a0,cu_info **a1, lcu_t *lcu);
|
||||
void inter_get_mv_cand(encoder_control *encoder, int32_t x, int32_t y, int8_t depth, int16_t mv_cand[2][2], cu_info* cur_cu, lcu_t *lcu);
|
||||
void inter_get_mv_cand(const encoder_control * const encoder, int32_t x, int32_t y, int8_t depth, int16_t mv_cand[2][2], cu_info* cur_cu, lcu_t *lcu);
|
||||
uint8_t inter_get_merge_cand(int32_t x, int32_t y, int8_t depth, int16_t mv_cand[MRG_MAX_NUM_CANDS][3], lcu_t *lcu);
|
||||
#endif
|
||||
|
|
|
@ -326,7 +326,7 @@ static void intra_get_pred(pixel *rec[2], int recstride, pixel *dst, int width,
|
|||
* \param sad_out sad value of best mode
|
||||
* \returns best intra mode
|
||||
*/
|
||||
int16_t intra_prediction(encoder_control *encoder, pixel *orig, int32_t origstride, pixel *rec, int16_t recstride,
|
||||
int16_t intra_prediction(const encoder_control * const encoder, pixel *orig, int32_t origstride, pixel *rec, int16_t recstride,
|
||||
uint8_t width, uint32_t *sad_out,
|
||||
int8_t *intra_preds, uint32_t *bitcost_out, cabac_data *cabac)
|
||||
{
|
||||
|
@ -828,7 +828,7 @@ void intra_get_planar_pred(pixel* src, int32_t srcstride, uint32_t width, pixel*
|
|||
}
|
||||
}
|
||||
|
||||
void intra_recon_lcu(encoder_control* encoder, cabac_data *cabac, int x, int y, int depth, lcu_t *lcu, uint32_t pic_width, uint32_t pic_height)
|
||||
void intra_recon_lcu(const encoder_control * const encoder, cabac_data *cabac, int x, int y, int depth, lcu_t *lcu, uint32_t pic_width, uint32_t pic_height)
|
||||
{
|
||||
int x_local = (x&0x3f), y_local = (y&0x3f);
|
||||
cu_info *cur_cu = &lcu->cu[LCU_CU_OFFSET + (x_local>>3) + (y_local>>3)*LCU_T_CU_WIDTH];
|
||||
|
|
|
@ -39,7 +39,7 @@ void intra_build_reference_border(int32_t x_luma, int32_t y_luma, int16_t out_wi
|
|||
void intra_filter(pixel* ref, int32_t stride, int32_t width, int8_t mode);
|
||||
|
||||
/* Predictions */
|
||||
int16_t intra_prediction(encoder_control *encoder, pixel *orig, int32_t origstride, pixel *rec, int16_t recstride,
|
||||
int16_t intra_prediction(const encoder_control * const encoder, pixel *orig, int32_t origstride, pixel *rec, int16_t recstride,
|
||||
uint8_t width, uint32_t *sad_out,
|
||||
int8_t *intra_preds, uint32_t *bitcost_out, cabac_data *cabac);
|
||||
|
||||
|
@ -49,6 +49,6 @@ void intra_get_angular_pred(pixel* src, int32_t src_stride, pixel* p_dst, int32_
|
|||
|
||||
void intra_recon(pixel* rec, int32_t rec_stride, uint32_t width, pixel* dst, int32_t dst_stride, int8_t mode, int8_t chroma);
|
||||
|
||||
void intra_recon_lcu(encoder_control* encoder, cabac_data *cabac, int x, int y, int depth, lcu_t *lcu, uint32_t pic_width, uint32_t pic_height);
|
||||
void intra_recon_lcu(const encoder_control * const encoder, cabac_data *cabac, int x, int y, int depth, lcu_t *lcu, uint32_t pic_width, uint32_t pic_height);
|
||||
|
||||
#endif
|
||||
|
|
10
src/rdo.c
10
src/rdo.c
|
@ -64,7 +64,7 @@ const uint32_t entropy_bits[128] =
|
|||
|
||||
** Only for luma
|
||||
*/
|
||||
uint32_t rdo_cost_intra(encoder_control *encoder, pixel *pred, pixel *orig_block, int width, cabac_data *cabac, int8_t mode)
|
||||
uint32_t rdo_cost_intra(const encoder_control * const encoder, pixel *pred, pixel *orig_block, int width, cabac_data *cabac, int8_t mode)
|
||||
{
|
||||
coefficient pre_quant_coeff[LCU_WIDTH*LCU_WIDTH>>2];
|
||||
int16_t block[LCU_WIDTH*LCU_WIDTH>>2];
|
||||
|
@ -128,7 +128,7 @@ uint32_t rdo_cost_intra(encoder_control *encoder, pixel *pred, pixel *orig_block
|
|||
* \param type data type (0 == luma)
|
||||
* \returns bits needed to code input coefficients
|
||||
*/
|
||||
int32_t get_coeff_cost(encoder_control *encoder, cabac_data *cabac, coefficient *coeff, int32_t width, int32_t type, int8_t scan_mode)
|
||||
int32_t get_coeff_cost(const encoder_control * const encoder, cabac_data *cabac, coefficient *coeff, int32_t width, int32_t type, int8_t scan_mode)
|
||||
{
|
||||
cabac_data temp_cabac;
|
||||
int32_t cost = 0;
|
||||
|
@ -285,7 +285,7 @@ int32_t get_ic_rate( cabac_data *cabac, uint32_t abs_level, uint16_t ctx_num_one
|
|||
* This method calculates the best quantized transform level for a given scan position.
|
||||
* From HM 12.0
|
||||
*/
|
||||
uint32_t get_coded_level ( encoder_control* encoder, cabac_data *cabac, double *coded_cost, double *coded_cost0, double *coded_cost_sig,
|
||||
uint32_t get_coded_level ( const encoder_control * const encoder, cabac_data *cabac, double *coded_cost, double *coded_cost0, double *coded_cost_sig,
|
||||
int32_t level_double, uint32_t max_abs_level,
|
||||
uint16_t ctx_num_sig, uint16_t ctx_num_one, uint16_t ctx_num_abs,
|
||||
uint16_t abs_go_rice,
|
||||
|
@ -337,7 +337,7 @@ uint32_t get_coded_level ( encoder_control* encoder, cabac_data *cabac, double *
|
|||
*
|
||||
* From HM 12.0
|
||||
*/
|
||||
static double get_rate_last(encoder_control* encoder,
|
||||
static double get_rate_last(const encoder_control * const encoder,
|
||||
const uint32_t pos_x, const uint32_t pos_y,
|
||||
int32_t* last_x_bits, int32_t* last_y_bits)
|
||||
{
|
||||
|
@ -389,7 +389,7 @@ static void calc_last_bits(cabac_data *cabac, int32_t width, int32_t height, int
|
|||
* coding engines using probability models like CABAC
|
||||
* From HM 12.0
|
||||
*/
|
||||
void rdoq(encoder_control *encoder, cabac_data *cabac, coefficient *coef, coefficient *dest_coeff, int32_t width,
|
||||
void rdoq(const encoder_control * const encoder, cabac_data *cabac, coefficient *coef, coefficient *dest_coeff, int32_t width,
|
||||
int32_t height, uint32_t *abs_sum, int8_t type, int8_t scan_mode, int8_t block_type, int8_t tr_depth)
|
||||
{
|
||||
uint32_t log2_tr_size = g_convert_to_bit[ width ] + 2;
|
||||
|
|
|
@ -42,18 +42,18 @@ extern const uint32_t g_go_rice_range[5];
|
|||
extern const uint32_t g_go_rice_prefix_len[5];
|
||||
|
||||
|
||||
void rdoq(encoder_control *encoder, cabac_data *cabac, coefficient *coef, coefficient *dest_coeff, int32_t width,
|
||||
void rdoq(const encoder_control * const encoder, cabac_data *cabac, coefficient *coef, coefficient *dest_coeff, int32_t width,
|
||||
int32_t height, uint32_t *abs_sum, int8_t type, int8_t scan_mode, int8_t block_type, int8_t tr_depth);
|
||||
|
||||
uint32_t rdo_cost_intra(encoder_control *encoder, pixel *pred, pixel *orig_block, int width, cabac_data *cabac, int8_t mode);
|
||||
uint32_t rdo_cost_intra(const encoder_control * const encoder, pixel* pred, pixel* orig_block, int width, cabac_data* cabac, int8_t mode);
|
||||
|
||||
int32_t get_coeff_cost(encoder_control *encoder, cabac_data *cabac, coefficient *coeff, int32_t width, int32_t type, int8_t scan_mode);
|
||||
int32_t get_coeff_cost(const encoder_control * const encoder, cabac_data *cabac, coefficient *coeff, int32_t width, int32_t type, int8_t scan_mode);
|
||||
|
||||
int32_t get_ic_rate(cabac_data *cabac, uint32_t abs_level, uint16_t ctx_num_one,uint16_t ctx_num_abs,
|
||||
uint16_t abs_go_rice, uint32_t c1_idx, uint32_t c2_idx, int8_t type);
|
||||
double get_ic_rate_cost (cabac_data *cabac, uint32_t abs_level, uint16_t ctx_num_one, uint16_t ctx_num_abs,
|
||||
uint16_t abs_go_rice, uint32_t c1_idx, uint32_t c2_idx, int8_t type);
|
||||
uint32_t get_coded_level ( encoder_control* encoder, cabac_data *cabac, double* coded_cost, double* coded_cost0, double* coded_cost_sig,
|
||||
uint32_t get_coded_level ( const encoder_control * const encoder, cabac_data *cabac, double* coded_cost, double* coded_cost0, double* coded_cost_sig,
|
||||
int32_t level_double, uint32_t max_abs_level,
|
||||
uint16_t ctx_num_sig, uint16_t ctx_num_one, uint16_t ctx_num_abs,
|
||||
uint16_t abs_go_rice,
|
||||
|
|
|
@ -634,7 +634,7 @@ void sao_search_luma(const picture *pic, unsigned x_ctb, unsigned y_ctb, sao_inf
|
|||
sao_search_best_mode(orig_list, rec_list, block_width, block_height, 1, sao, sao_top, sao_left);
|
||||
}
|
||||
|
||||
void sao_reconstruct_frame(encoder_control *encoder)
|
||||
void sao_reconstruct_frame(const encoder_control * const encoder)
|
||||
{
|
||||
vector2d lcu;
|
||||
picture *pic = encoder->in.cur_pic;
|
||||
|
|
|
@ -51,6 +51,6 @@ void sao_search_luma(const picture *pic, unsigned x_ctb, unsigned y_ctb, sao_inf
|
|||
void sao_reconstruct(picture *pic, const pixel *old_rec,
|
||||
unsigned x_ctb, unsigned y_ctb,
|
||||
const sao_info *sao, color_index color_i);
|
||||
void sao_reconstruct_frame(encoder_control *encoder);
|
||||
void sao_reconstruct_frame(const encoder_control * const encoder);
|
||||
|
||||
#endif
|
||||
|
|
14
src/search.c
14
src/search.c
|
@ -370,7 +370,7 @@ static unsigned search_mv_full(unsigned depth,
|
|||
* Update lcu to have best modes at this depth.
|
||||
* \return Cost of best mode.
|
||||
*/
|
||||
static int search_cu_inter(encoder_control *encoder, int x, int y, int depth, lcu_t *lcu)
|
||||
static int search_cu_inter(const encoder_control * const encoder, int x, int y, int depth, lcu_t *lcu)
|
||||
{
|
||||
picture *cur_pic = encoder->in.cur_pic;
|
||||
uint32_t ref_idx = 0;
|
||||
|
@ -659,7 +659,7 @@ static void lcu_set_coeff(lcu_t *lcu, int x_px, int y_px, int depth, cu_info *cu
|
|||
* Update lcu to have best modes at this depth.
|
||||
* \return Cost of best mode.
|
||||
*/
|
||||
static int search_cu_intra(encoder_control *encoder,
|
||||
static int search_cu_intra(const encoder_control * const encoder,
|
||||
const int x_px, const int y_px,
|
||||
const int depth, lcu_t *lcu, cabac_data *cabac)
|
||||
{
|
||||
|
@ -722,7 +722,7 @@ static int search_cu_intra(encoder_control *encoder,
|
|||
* coding (bitcost * lambda) and cost for coding coefficients (estimated
|
||||
* here as (coefficient_sum * 1.5) * lambda)
|
||||
*/
|
||||
static int lcu_get_final_cost(encoder_control *encoder,
|
||||
static int lcu_get_final_cost(const encoder_control * const encoder,
|
||||
cabac_data *cabac,
|
||||
const int x_px, const int y_px,
|
||||
const int depth, lcu_t *lcu)
|
||||
|
@ -849,7 +849,7 @@ static int lcu_get_final_cost(encoder_control *encoder,
|
|||
* - All the final data for the LCU gets eventually copied to depth 0, which
|
||||
* will be the final output of the recursion.
|
||||
*/
|
||||
static int search_cu(encoder_control *encoder, cabac_data *cabac, int x, int y, int depth, lcu_t work_tree[MAX_PU_DEPTH])
|
||||
static int search_cu(const encoder_control * const encoder, cabac_data *cabac, int x, int y, int depth, lcu_t work_tree[MAX_PU_DEPTH])
|
||||
{
|
||||
int cu_width = LCU_WIDTH >> depth;
|
||||
int cost = MAX_INT;
|
||||
|
@ -957,7 +957,7 @@ static int search_cu(encoder_control *encoder, cabac_data *cabac, int x, int y,
|
|||
* - Copy reference pixels from neighbouring LCUs.
|
||||
* - Copy reference pixels from this LCU.
|
||||
*/
|
||||
static void init_lcu_t(encoder_control *encoder, const int x, const int y, lcu_t *lcu, const yuv_t *hor_buf, const yuv_t *ver_buf)
|
||||
static void init_lcu_t(const encoder_control * const encoder, const int x, const int y, lcu_t *lcu, const yuv_t *hor_buf, const yuv_t *ver_buf)
|
||||
{
|
||||
// Copy reference cu_info structs from neighbouring LCUs.
|
||||
{
|
||||
|
@ -1061,7 +1061,7 @@ static void init_lcu_t(encoder_control *encoder, const int x, const int y, lcu_t
|
|||
/**
|
||||
* Copy CU and pixel data to it's place in picture datastructure.
|
||||
*/
|
||||
static void copy_lcu_to_cu_data(encoder_control *encoder, int x_px, int y_px, const lcu_t *lcu)
|
||||
static void copy_lcu_to_cu_data(const encoder_control * const encoder, int x_px, int y_px, const lcu_t *lcu)
|
||||
{
|
||||
// Copy non-reference CUs to picture.
|
||||
{
|
||||
|
@ -1114,7 +1114,7 @@ static void copy_lcu_to_cu_data(encoder_control *encoder, int x_px, int y_px, co
|
|||
* Search LCU for modes.
|
||||
* - Best mode gets copied to current picture.
|
||||
*/
|
||||
void search_lcu(encoder_control *encoder, cabac_data *cabac, int x, int y, yuv_t *hor_buf, yuv_t *ver_buf)
|
||||
void search_lcu(const encoder_control * const encoder, cabac_data *cabac, int x, int y, yuv_t* hor_buf, yuv_t* ver_buf)
|
||||
{
|
||||
lcu_t work_tree[MAX_PU_DEPTH + 1];
|
||||
int depth;
|
||||
|
|
|
@ -30,6 +30,6 @@
|
|||
#include "picture.h"
|
||||
|
||||
|
||||
void search_lcu(encoder_control *encoder, cabac_data *cabac, int x, int y, yuv_t *hor_buf, yuv_t *ver_buf);
|
||||
void search_lcu(const encoder_control * const encoder, cabac_data *cabac, int x, int y, yuv_t *hor_buf, yuv_t *ver_buf);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -854,7 +854,7 @@ void itransform2d(int16_t *block,int16_t *coeff, int8_t block_size, int32_t mode
|
|||
* \brief quantize transformed coefficents
|
||||
*
|
||||
*/
|
||||
void quant(encoder_control *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 )
|
||||
{
|
||||
uint32_t log2_block_size = g_convert_to_bit[ width ] + 2;
|
||||
|
@ -985,7 +985,7 @@ void quant(encoder_control *encoder, int16_t *coef, int16_t *q_coef, int32_t wid
|
|||
* \brief inverse quantize transformed and quantized coefficents
|
||||
*
|
||||
*/
|
||||
void dequant(encoder_control *encoder, int16_t *q_coef, int16_t *coef, int32_t width, int32_t height,int8_t type, int8_t block_type)
|
||||
void dequant(const encoder_control * const encoder, int16_t *q_coef, int16_t *coef, int32_t width, int32_t height,int8_t type, int8_t block_type)
|
||||
{
|
||||
int32_t shift,add,coeff_q,clip_q_coef;
|
||||
int32_t n;
|
||||
|
|
|
@ -50,9 +50,9 @@ extern const uint8_t g_chroma_scale[58];
|
|||
extern const int16_t g_inv_quant_scales[6];
|
||||
|
||||
|
||||
void quant(encoder_control *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);
|
||||
void dequant(encoder_control *encoder, int16_t *q_coef, int16_t *coef, int32_t width, int32_t height,int8_t type, int8_t block_type);
|
||||
void dequant(const encoder_control * const encoder, int16_t *q_coef, int16_t *coef, int32_t width, int32_t height,int8_t type, int8_t block_type);
|
||||
|
||||
void transformskip(int16_t *block,int16_t *coeff, int8_t block_size);
|
||||
void itransformskip(int16_t *block,int16_t *coeff, int8_t block_size);
|
||||
|
|
Loading…
Reference in a new issue