mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-24 02:24:07 +00:00
Rename struct cabac_data to cabac_data_t.
This commit is contained in:
parent
727fefacc4
commit
1a62fee300
24
src/cabac.c
24
src/cabac.c
|
@ -80,7 +80,7 @@ const uint8_t g_auc_renorm_table[32] =
|
|||
/**
|
||||
* \brief Initialize struct cabac_data.
|
||||
*/
|
||||
void cabac_start(cabac_data * const data)
|
||||
void cabac_start(cabac_data_t * const data)
|
||||
{
|
||||
data->low = 0;
|
||||
data->range = 510;
|
||||
|
@ -93,7 +93,7 @@ void cabac_start(cabac_data * const data)
|
|||
/**
|
||||
* \brief
|
||||
*/
|
||||
void cabac_encode_bin(cabac_data * const data, const uint32_t bin_value)
|
||||
void cabac_encode_bin(cabac_data_t * const data, const uint32_t bin_value)
|
||||
{
|
||||
uint32_t lps;
|
||||
|
||||
|
@ -127,7 +127,7 @@ void cabac_encode_bin(cabac_data * const data, const uint32_t bin_value)
|
|||
/**
|
||||
* \brief
|
||||
*/
|
||||
void cabac_write(cabac_data * const data)
|
||||
void cabac_write(cabac_data_t * const data)
|
||||
{
|
||||
uint32_t lead_byte = data->low >> (24 - data->bits_left);
|
||||
data->bits_left += 8;
|
||||
|
@ -163,7 +163,7 @@ void cabac_write(cabac_data * const data)
|
|||
/**
|
||||
* \brief
|
||||
*/
|
||||
void cabac_finish(cabac_data * const data)
|
||||
void cabac_finish(cabac_data_t * const data)
|
||||
{
|
||||
assert(data->bits_left <= 32);
|
||||
|
||||
|
@ -194,7 +194,7 @@ void cabac_finish(cabac_data * const data)
|
|||
\brief Encode terminating bin
|
||||
\param binValue bin value
|
||||
*/
|
||||
void cabac_encode_bin_trm(cabac_data * const data, const uint8_t bin_value)
|
||||
void cabac_encode_bin_trm(cabac_data_t * const data, const uint8_t bin_value)
|
||||
{
|
||||
data->range -= 2;
|
||||
if(bin_value) {
|
||||
|
@ -218,7 +218,7 @@ void cabac_encode_bin_trm(cabac_data * const data, const uint8_t bin_value)
|
|||
/**
|
||||
* \brief
|
||||
*/
|
||||
void cabac_flush(cabac_data * const data)
|
||||
void cabac_flush(cabac_data_t * const data)
|
||||
{
|
||||
cabac_finish(data);
|
||||
bitstream_put(data->stream, 1, 1);
|
||||
|
@ -229,7 +229,7 @@ void cabac_flush(cabac_data * const data)
|
|||
/**
|
||||
* \brief
|
||||
*/
|
||||
void cabac_encode_bin_ep(cabac_data * const data, const uint32_t bin_value)
|
||||
void cabac_encode_bin_ep(cabac_data_t * const data, const uint32_t bin_value)
|
||||
{
|
||||
data->low <<= 1;
|
||||
if (bin_value) {
|
||||
|
@ -245,7 +245,7 @@ void cabac_encode_bin_ep(cabac_data * const data, const uint32_t bin_value)
|
|||
/**
|
||||
* \brief
|
||||
*/
|
||||
void cabac_encode_bins_ep(cabac_data * const data, uint32_t bin_values, int num_bins)
|
||||
void cabac_encode_bins_ep(cabac_data_t * const data, uint32_t bin_values, int num_bins)
|
||||
{
|
||||
uint32_t pattern;
|
||||
|
||||
|
@ -276,7 +276,7 @@ void cabac_encode_bins_ep(cabac_data * const data, uint32_t bin_values, int num_
|
|||
* \param symbol Value of coeff_abs_level_minus3.
|
||||
* \param r_param Reference to Rice parameter.
|
||||
*/
|
||||
void cabac_write_coeff_remain(cabac_data * const cabac, const uint32_t symbol, const uint32_t r_param)
|
||||
void cabac_write_coeff_remain(cabac_data_t * const cabac, const uint32_t symbol, const uint32_t r_param)
|
||||
{
|
||||
int32_t code_number = symbol;
|
||||
uint32_t length;
|
||||
|
@ -299,7 +299,7 @@ void cabac_write_coeff_remain(cabac_data * const cabac, const uint32_t symbol, c
|
|||
/**
|
||||
* \brief
|
||||
*/
|
||||
void cabac_write_unary_max_symbol(cabac_data * const data, cabac_ctx_t * const ctx, uint32_t symbol, const int32_t offset, const uint32_t max_symbol)
|
||||
void cabac_write_unary_max_symbol(cabac_data_t * const data, cabac_ctx_t * const ctx, uint32_t symbol, const int32_t offset, const uint32_t max_symbol)
|
||||
{
|
||||
int8_t code_last = max_symbol > symbol;
|
||||
|
||||
|
@ -325,7 +325,7 @@ void cabac_write_unary_max_symbol(cabac_data * const data, cabac_ctx_t * const c
|
|||
/**
|
||||
* This can be used for Truncated Rice binarization with cRiceParam=0.
|
||||
*/
|
||||
void cabac_write_unary_max_symbol_ep(cabac_data * const data, unsigned int symbol, const unsigned int max_symbol)
|
||||
void cabac_write_unary_max_symbol_ep(cabac_data_t * const data, unsigned int symbol, const unsigned int max_symbol)
|
||||
{
|
||||
/*if (symbol == 0) {
|
||||
CABAC_BIN_EP(data, 0, "ums_ep");
|
||||
|
@ -355,7 +355,7 @@ void cabac_write_unary_max_symbol_ep(cabac_data * const data, unsigned int symbo
|
|||
/**
|
||||
* \brief
|
||||
*/
|
||||
void cabac_write_ep_ex_golomb(cabac_data * const data, uint32_t symbol, uint32_t count)
|
||||
void cabac_write_ep_ex_golomb(cabac_data_t * const data, uint32_t symbol, uint32_t count)
|
||||
{
|
||||
uint32_t bins = 0;
|
||||
int32_t num_bins = 0;
|
||||
|
|
26
src/cabac.h
26
src/cabac.h
|
@ -80,7 +80,7 @@ typedef struct
|
|||
cabac_ctx_t transform_skip_model_luma;
|
||||
cabac_ctx_t transform_skip_model_chroma;
|
||||
} ctx;
|
||||
} cabac_data;
|
||||
} cabac_data_t;
|
||||
|
||||
|
||||
// Globals
|
||||
|
@ -91,22 +91,22 @@ extern const uint8_t g_auc_renorm_table[32];
|
|||
|
||||
|
||||
// Functions
|
||||
void cabac_start(cabac_data *data);
|
||||
void cabac_encode_bin(cabac_data *data, uint32_t bin_value);
|
||||
void cabac_encode_bin_ep(cabac_data *data, uint32_t bin_value);
|
||||
void cabac_encode_bins_ep(cabac_data *data, uint32_t bin_values, int num_bins);
|
||||
void cabac_encode_bin_trm(cabac_data *data, uint8_t bin_value);
|
||||
void cabac_write(cabac_data *data);
|
||||
void cabac_finish(cabac_data *data);
|
||||
void cabac_flush(cabac_data *data);
|
||||
void cabac_write_coeff_remain(cabac_data *cabac, uint32_t symbol,
|
||||
void cabac_start(cabac_data_t *data);
|
||||
void cabac_encode_bin(cabac_data_t *data, uint32_t bin_value);
|
||||
void cabac_encode_bin_ep(cabac_data_t *data, uint32_t bin_value);
|
||||
void cabac_encode_bins_ep(cabac_data_t *data, uint32_t bin_values, int num_bins);
|
||||
void cabac_encode_bin_trm(cabac_data_t *data, uint8_t bin_value);
|
||||
void cabac_write(cabac_data_t *data);
|
||||
void cabac_finish(cabac_data_t *data);
|
||||
void cabac_flush(cabac_data_t *data);
|
||||
void cabac_write_coeff_remain(cabac_data_t *cabac, uint32_t symbol,
|
||||
uint32_t r_param);
|
||||
void cabac_write_ep_ex_golomb(cabac_data *data, uint32_t symbol,
|
||||
void cabac_write_ep_ex_golomb(cabac_data_t *data, uint32_t symbol,
|
||||
uint32_t count);
|
||||
void cabac_write_unary_max_symbol(cabac_data *data, cabac_ctx_t *ctx,
|
||||
void cabac_write_unary_max_symbol(cabac_data_t *data, cabac_ctx_t *ctx,
|
||||
uint32_t symbol, int32_t offset,
|
||||
uint32_t max_symbol);
|
||||
void cabac_write_unary_max_symbol_ep(cabac_data *data, unsigned int symbol, unsigned int max_symbol);
|
||||
void cabac_write_unary_max_symbol_ep(cabac_data_t *data, unsigned int symbol, unsigned int max_symbol);
|
||||
|
||||
|
||||
// Macros
|
||||
|
|
|
@ -202,7 +202,7 @@ void ctx_init(cabac_ctx_t *ctx, uint32_t qp, uint32_t init_value)
|
|||
|
||||
void init_contexts(encoder_state_t *encoder_state, int8_t QP, int8_t slice)
|
||||
{
|
||||
cabac_data * const cabac = &encoder_state->cabac;
|
||||
cabac_data_t * const cabac = &encoder_state->cabac;
|
||||
uint16_t i;
|
||||
|
||||
// Initialize contexts
|
||||
|
@ -277,8 +277,8 @@ void init_contexts(encoder_state_t *encoder_state, int8_t QP, int8_t slice)
|
|||
}
|
||||
|
||||
void context_copy(encoder_state_t * const target_encoder_state, const encoder_state_t * const source_encoder_state) {
|
||||
cabac_data * const target_cabac = &target_encoder_state->cabac;
|
||||
const cabac_data * const source_cabac = &source_encoder_state->cabac;
|
||||
cabac_data_t * const target_cabac = &target_encoder_state->cabac;
|
||||
const cabac_data_t * const source_cabac = &source_encoder_state->cabac;
|
||||
|
||||
if (target_cabac == source_cabac) return;
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ static void encoder_state_recdata_to_bufs(encoder_state_t * const encoder_state,
|
|||
static void encode_sao_color(encoder_state_t * const encoder_state, sao_info *sao,
|
||||
color_index color_i)
|
||||
{
|
||||
cabac_data * const cabac = &encoder_state->cabac;
|
||||
cabac_data_t * const cabac = &encoder_state->cabac;
|
||||
sao_eo_cat i;
|
||||
int offset_index = (color_i == COLOR_V) ? 5 : 0;
|
||||
|
||||
|
@ -186,7 +186,7 @@ static void encode_sao_color(encoder_state_t * const encoder_state, sao_info *sa
|
|||
|
||||
static void encode_sao_merge_flags(encoder_state_t * const encoder_state, sao_info *sao, unsigned x_ctb, unsigned y_ctb)
|
||||
{
|
||||
cabac_data * const cabac = &encoder_state->cabac;
|
||||
cabac_data_t * const cabac = &encoder_state->cabac;
|
||||
// SAO merge flags are not present for the first row and column.
|
||||
if (x_ctb > 0) {
|
||||
cabac->cur_ctx = &(cabac->ctx.sao_merge_flag_model);
|
||||
|
@ -945,7 +945,7 @@ void encoder_next_frame(encoder_state_t *encoder_state) {
|
|||
void encode_coding_tree(encoder_state_t * const encoder_state,
|
||||
uint16_t x_ctb, uint16_t y_ctb, uint8_t depth)
|
||||
{
|
||||
cabac_data * const cabac = &encoder_state->cabac;
|
||||
cabac_data_t * const cabac = &encoder_state->cabac;
|
||||
const videoframe_t * const frame = encoder_state->tile->frame;
|
||||
const cu_info_t *cur_cu = videoframe_get_cu_const(frame, x_ctb, y_ctb);
|
||||
uint8_t split_flag = GET_SPLITDATA(cur_cu, depth);
|
||||
|
@ -1484,7 +1484,7 @@ static void encode_transform_unit(encoder_state_t * const encoder_state,
|
|||
void encode_transform_coeff(encoder_state_t * const encoder_state, 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)
|
||||
{
|
||||
cabac_data * const cabac = &encoder_state->cabac;
|
||||
cabac_data_t * const cabac = &encoder_state->cabac;
|
||||
int32_t x_cu = x_pu / 2;
|
||||
int32_t y_cu = y_pu / 2;
|
||||
const videoframe_t * const frame = encoder_state->tile->frame;
|
||||
|
@ -1562,7 +1562,7 @@ void encode_coeff_nxn(encoder_state_t * const encoder_state, coefficient *coeff,
|
|||
uint8_t type, int8_t scan_mode, int8_t tr_skip)
|
||||
{
|
||||
const encoder_control_t * const encoder = encoder_state->encoder_control;
|
||||
cabac_data * const cabac = &encoder_state->cabac;
|
||||
cabac_data_t * const cabac = &encoder_state->cabac;
|
||||
int c1 = 1;
|
||||
uint8_t last_coeff_x = 0;
|
||||
uint8_t last_coeff_y = 0;
|
||||
|
@ -1791,7 +1791,7 @@ void encode_last_significant_xy(encoder_state_t * const encoder_state,
|
|||
uint8_t width, uint8_t height,
|
||||
uint8_t type, uint8_t scan)
|
||||
{
|
||||
cabac_data * const cabac = &encoder_state->cabac;
|
||||
cabac_data_t * const cabac = &encoder_state->cabac;
|
||||
uint8_t offset_x = type?0:((TOBITS(width)*3) + ((TOBITS(width)+1)>>2)),offset_y = offset_x;
|
||||
uint8_t shift_x = type?(TOBITS(width)):((TOBITS(width)+3)>>2), shift_y = shift_x;
|
||||
int group_idx_x;
|
||||
|
|
|
@ -162,7 +162,7 @@ typedef struct encoder_state_t {
|
|||
uint32_t lcu_order_count;
|
||||
|
||||
bitstream_t stream;
|
||||
cabac_data cabac;
|
||||
cabac_data_t cabac;
|
||||
|
||||
int stats_done;
|
||||
uint32_t stats_bitstream_length; //Bitstream length written in bytes
|
||||
|
|
|
@ -280,7 +280,7 @@ int32_t get_ic_rate (encoder_state_t * const encoder_state,
|
|||
int8_t type
|
||||
)
|
||||
{
|
||||
cabac_data * const cabac = &encoder_state->cabac;
|
||||
cabac_data_t * const cabac = &encoder_state->cabac;
|
||||
int32_t rate = 32768;
|
||||
uint32_t base_level = (c1_idx < C1FLAG_NUMBER)? (2 + (c2_idx < C2FLAG_NUMBER)) : 1;
|
||||
cabac_ctx_t *base_one_ctx = (type == 0) ? &(cabac->ctx.cu_one_model_luma[0]) : &(cabac->ctx.cu_one_model_chroma[0]);
|
||||
|
@ -342,7 +342,7 @@ uint32_t get_coded_level ( encoder_state_t * const encoder_state, double *coded_
|
|||
uint32_t c1_idx, uint32_t c2_idx,
|
||||
int32_t q_bits,double temp, int8_t last, int8_t type)
|
||||
{
|
||||
cabac_data * const cabac = &encoder_state->cabac;
|
||||
cabac_data_t * const cabac = &encoder_state->cabac;
|
||||
double cur_cost_sig = 0;
|
||||
uint32_t best_abs_level = 0;
|
||||
int32_t abs_level;
|
||||
|
@ -407,7 +407,7 @@ static double get_rate_last(const encoder_state_t * const encoder_state,
|
|||
static void calc_last_bits(encoder_state_t * const encoder_state, int32_t width, int32_t height, int8_t type,
|
||||
int32_t* last_x_bits, int32_t* last_y_bits)
|
||||
{
|
||||
cabac_data * const cabac = &encoder_state->cabac;
|
||||
cabac_data_t * const cabac = &encoder_state->cabac;
|
||||
int32_t bits_x = 0, bits_y = 0;
|
||||
int32_t blk_size_offset_x, blk_size_offset_y, shiftX, shiftY;
|
||||
int32_t ctx;
|
||||
|
@ -552,7 +552,7 @@ void rdoq(encoder_state_t * const encoder_state, coefficient *coef, coefficient
|
|||
int32_t height, int8_t type, int8_t scan_mode, int8_t block_type, int8_t tr_depth)
|
||||
{
|
||||
const encoder_control_t * const encoder = encoder_state->encoder_control;
|
||||
cabac_data * const cabac = &encoder_state->cabac;
|
||||
cabac_data_t * const cabac = &encoder_state->cabac;
|
||||
uint32_t log2_tr_size = g_convert_to_bit[ width ] + 2;
|
||||
int32_t transform_shift = MAX_TR_DYNAMIC_RANGE - encoder->bitdepth - log2_tr_size; // Represents scaling through forward transform
|
||||
uint16_t go_rice_param = 0;
|
||||
|
|
|
@ -122,7 +122,7 @@ void init_sao_info(sao_info *sao) {
|
|||
static float sao_mode_bits_none(const encoder_state_t * const encoder_state, sao_info *sao_top, sao_info *sao_left)
|
||||
{
|
||||
float mode_bits = 0.0;
|
||||
const cabac_data * const cabac = &encoder_state->cabac;
|
||||
const cabac_data_t * const cabac = &encoder_state->cabac;
|
||||
const cabac_ctx_t *ctx = NULL;
|
||||
// FL coded merges.
|
||||
if (sao_left != NULL) {
|
||||
|
@ -144,7 +144,7 @@ static float sao_mode_bits_none(const encoder_state_t * const encoder_state, sao
|
|||
static float sao_mode_bits_merge(const encoder_state_t * const encoder_state,
|
||||
int8_t merge_cand) {
|
||||
float mode_bits = 0.0;
|
||||
const cabac_data * const cabac = &encoder_state->cabac;
|
||||
const cabac_data_t * const cabac = &encoder_state->cabac;
|
||||
const cabac_ctx_t *ctx = NULL;
|
||||
// FL coded merges.
|
||||
ctx = &(cabac->ctx.sao_merge_flag_model);
|
||||
|
@ -161,7 +161,7 @@ static float sao_mode_bits_edge(const encoder_state_t * const encoder_state,
|
|||
sao_info *sao_top, sao_info *sao_left, unsigned buf_cnt)
|
||||
{
|
||||
float mode_bits = 0.0;
|
||||
const cabac_data * const cabac = &encoder_state->cabac;
|
||||
const cabac_data_t * const cabac = &encoder_state->cabac;
|
||||
const cabac_ctx_t *ctx = NULL;
|
||||
// FL coded merges.
|
||||
if (sao_left != NULL) {
|
||||
|
@ -201,7 +201,7 @@ static float sao_mode_bits_band(const encoder_state_t * const encoder_state,
|
|||
sao_info *sao_top, sao_info *sao_left, unsigned buf_cnt)
|
||||
{
|
||||
float mode_bits = 0.0;
|
||||
const cabac_data * const cabac = &encoder_state->cabac;
|
||||
const cabac_data_t * const cabac = &encoder_state->cabac;
|
||||
const cabac_ctx_t *ctx = NULL;
|
||||
// FL coded merges.
|
||||
if (sao_left != NULL) {
|
||||
|
|
Loading…
Reference in a new issue