TUT HEVC Encoder
Data Structures | Macros | Functions | Variables
rdo.h File Reference

Rate-Distortion Optimization related functionality. More...

#include "cabac.h"
#include "cu.h"
#include "encoderstate.h"
#include "global.h"
#include "search_inter.h"
Include dependency graph for rdo.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  kvz_sh_rates_t
 

Macros

#define CTX_FRAC_BITS   15
 
#define CTX_FRAC_ONE_BIT   (1 << CTX_FRAC_BITS)
 
#define CTX_FRAC_HALF_BIT   (1 << (CTX_FRAC_BITS - 1))
 
#define CTX_ENTROPY_BITS(ctx, val)   kvz_entropy_bits[(ctx)->uc_state ^ (val)]
 

Functions

int kvz_init_rdcost_outfiles (const char *fn_template)
 
void kvz_close_rdcost_outfiles (void)
 
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)
 RDOQ with CABAC. More...
 
double kvz_get_coeff_cost (const encoder_state_t *const state, const coeff_t *coeff, int32_t width, int32_t type, int8_t scan_mode)
 Estimate bitcost for coding coefficients. More...
 
int32_t kvz_get_ic_rate (encoder_state_t *state, 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)
 Calculates the cost for specific absolute transform level. More...
 
uint32_t kvz_get_coded_level (encoder_state_t *state, 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, uint32_t c1_idx, uint32_t c2_idx, int32_t q_bits, double temp, int8_t last, int8_t type)
 Get the best level in RD sense. More...
 
double kvz_get_mvd_coding_cost_cabac (const encoder_state_t *state, const cabac_data_t *cabac, int32_t mvd_hor, int32_t mvd_ver)
 Calculate cost of actual motion vectors using CABAC coding. More...
 

Variables

const uint32_t kvz_g_go_rice_range [5]
 
const uint32_t kvz_g_go_rice_prefix_len [5]
 
kvz_mvd_cost_func kvz_calc_mvd_cost_cabac
 
const uint32_t kvz_entropy_bits [128]
 Entropy bits to estimate coded bits in RDO / RDOQ (From HM 12.0) More...
 

Macro Definition Documentation

◆ CTX_ENTROPY_BITS

#define CTX_ENTROPY_BITS (   ctx,
  val 
)    kvz_entropy_bits[(ctx)->uc_state ^ (val)]

◆ CTX_FRAC_BITS

#define CTX_FRAC_BITS   15

◆ CTX_FRAC_HALF_BIT

#define CTX_FRAC_HALF_BIT   (1 << (CTX_FRAC_BITS - 1))

◆ CTX_FRAC_ONE_BIT

#define CTX_FRAC_ONE_BIT   (1 << CTX_FRAC_BITS)

Function Documentation

◆ kvz_close_rdcost_outfiles()

void kvz_close_rdcost_outfiles ( void  )
Here is the caller graph for this function:

◆ kvz_get_coded_level()

uint32_t kvz_get_coded_level ( encoder_state_t *const  state,
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,
uint32_t  c1_idx,
uint32_t  c2_idx,
int32_t  q_bits,
double  temp,
int8_t  last,
int8_t  type 
)
inline
Parameters
coded_costreference to coded cost
coded_cost0reference to cost when coefficient is 0
coded_cost_sigreference to cost of significant coefficient
level_doublereference to unscaled quantized level
max_abs_levelscaled quantized level
ctx_num_sigcurrent ctxInc for coeff_abs_significant_flag
ctx_num_onecurrent ctxInc for coeff_abs_level_greater1 (1st bin of coeff_abs_level_minus1 in AVC)
ctx_num_abscurrent ctxInc for coeff_abs_level_greater2 (remaining bins of coeff_abs_level_minus1 in AVC)
abs_go_ricecurrent Rice parameter for coeff_abs_level_minus3
q_bitsquantization step size
tempcorrection factor
lastindicates if the coefficient is the last significant
Returns
best quantized transform level for given scan position This method calculates the best quantized transform level for a given scan position. From HM 12.0
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_get_coeff_cost()

double kvz_get_coeff_cost ( const encoder_state_t *const  state,
const coeff_t coeff,
int32_t  width,
int32_t  type,
int8_t  scan_mode 
)
Parameters
coeffcoefficient array
widthcoeff block width
typedata type (0 == luma)
Returns
number of bits needed to code coefficients
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_get_ic_rate()

int32_t kvz_get_ic_rate ( encoder_state_t *const  state,
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 
)
inline
Parameters
abs_levelscaled quantized level
ctx_num_onecurrent ctxInc for coeff_abs_level_greater1 (1st bin of coeff_abs_level_minus1 in AVC)
ctx_num_abscurrent ctxInc for coeff_abs_level_greater2 (remaining bins of coeff_abs_level_minus1 in AVC)
abs_go_riceRice parameter for coeff_abs_level_minus3
Returns
cost of given absolute transform level From HM 12.0
Here is the caller graph for this function:

◆ kvz_get_mvd_coding_cost_cabac()

double kvz_get_mvd_coding_cost_cabac ( const encoder_state_t state,
const cabac_data_t cabac,
int32_t  mvd_hor,
int32_t  mvd_ver 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_init_rdcost_outfiles()

int kvz_init_rdcost_outfiles ( const char *  fn_template)
Here is the caller graph for this function:

◆ kvz_rdoq()

void kvz_rdoq ( encoder_state_t *const  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 
)
Returns
void Rate distortion optimized quantization for entropy coding engines using probability models like CABAC From HM 12.0
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ kvz_calc_mvd_cost_cabac

kvz_mvd_cost_func kvz_calc_mvd_cost_cabac

◆ kvz_entropy_bits

const uint32_t kvz_entropy_bits[128]
extern

◆ kvz_g_go_rice_prefix_len

const uint32_t kvz_g_go_rice_prefix_len[5]
extern

◆ kvz_g_go_rice_range

const uint32_t kvz_g_go_rice_range[5]
extern