TUT HEVC Encoder
|
#include "rdo.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include "cabac.h"
#include "context.h"
#include "encode_coding_tree.h"
#include "encoder.h"
#include "imagelist.h"
#include "inter.h"
#include "scalinglist.h"
#include "strategyselector.h"
#include "tables.h"
#include "transform.h"
#include "strategies/strategies-quant.h"
Macros | |
#define | QUANT_SHIFT 14 |
#define | SCAN_SET_SIZE 16 |
#define | LOG2_SCAN_SET_SIZE 4 |
#define | SBH_THRESHOLD 4 |
#define | RD_SAMPLING_MAX_LAST_QP 50 |
#define | RD_SAMPLING_MAX_FN_LENGTH 4095 |
#define | COEF_REMAIN_BIN_REDUCTION 3 |
#define | PRECISION_INC (15 - CTX_FRAC_BITS) |
Variables | |
static FILE * | fastrd_learning_outfile [50+1] = {NULL} |
static pthread_mutex_t | outfile_mutex [50+1] |
const uint32_t | kvz_g_go_rice_range [5] = { 7, 14, 26, 46, 78 } |
const uint32_t | kvz_g_go_rice_prefix_len [5] = { 8, 7, 6, 5, 4 } |
const uint32_t | kvz_entropy_bits [128] |
Entropy bits to estimate coded bits in RDO / RDOQ (From HM 12.0) | |
const float | kvz_f_entropy_bits [128] |
#define COEF_REMAIN_BIN_REDUCTION 3 |
#define LOG2_SCAN_SET_SIZE 4 |
#define PRECISION_INC (15 - CTX_FRAC_BITS) |
#define QUANT_SHIFT 14 |
#define RD_SAMPLING_MAX_FN_LENGTH 4095 |
#define RD_SAMPLING_MAX_LAST_QP 50 |
#define SBH_THRESHOLD 4 |
#define SCAN_SET_SIZE 16 |
|
static |
|
inlinestatic |
coeff | coefficient array |
width | coeff block width |
type | data type (0 == luma) |
|
static |
pos_x | X coordinate of the last significant coefficient |
pos_y | Y coordinate of the last significant coefficient |
uiWidth | width of the transform unit (TU) |
From HM 12.0
double kvz_calc_mvd_cost_cabac | ( | const encoder_state_t * | state, |
int | x, | ||
int | y, | ||
int | mv_shift, | ||
int16_t | mv_cand[2][2], | ||
inter_merge_cand_t | merge_cand[5], | ||
int16_t | num_cand, | ||
int32_t | ref_idx, | ||
double * | bitcost | ||
) |
|
inline |
coded_cost | reference to coded cost |
coded_cost0 | reference to cost when coefficient is 0 |
coded_cost_sig | reference to cost of significant coefficient |
level_double | reference to unscaled quantized level |
max_abs_level | scaled quantized level |
ctx_num_sig | current ctxInc for coeff_abs_significant_flag |
ctx_num_one | current ctxInc for coeff_abs_level_greater1 (1st bin of coeff_abs_level_minus1 in AVC) |
ctx_num_abs | current ctxInc for coeff_abs_level_greater2 (remaining bins of coeff_abs_level_minus1 in AVC) |
abs_go_rice | current Rice parameter for coeff_abs_level_minus3 |
q_bits | quantization step size |
temp | correction factor |
last | indicates if the coefficient is the last significant |
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 | ||
) |
coeff | coefficient array |
width | coeff block width |
type | data type (0 == luma) |
|
inline |
abs_level | scaled quantized level |
ctx_num_one | current ctxInc for coeff_abs_level_greater1 (1st bin of coeff_abs_level_minus1 in AVC) |
ctx_num_abs | current ctxInc for coeff_abs_level_greater2 (remaining bins of coeff_abs_level_minus1 in AVC) |
abs_go_rice | Rice parameter for coeff_abs_level_minus3 |
double kvz_get_mvd_coding_cost_cabac | ( | const encoder_state_t * | state, |
const cabac_data_t * | cabac, | ||
const int32_t | mvd_hor, | ||
const int32_t | mvd_ver | ||
) |
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 | ||
) |
void kvz_rdoq_sign_hiding | ( | const encoder_state_t *const | state, |
const int32_t | qp_scaled, | ||
const uint32_t *const | scan2raster, | ||
const struct kvz_sh_rates_t *const | sh_rates, | ||
const int32_t | last_pos, | ||
const coeff_t *const | coeffs, | ||
coeff_t *const | quant_coeffs | ||
) |
When sign hiding is enabled, the last sign bit of the last coefficient is calculated from the parity of the other coefficients. If the parity is not correct, one coefficient has to be changed by one. This function uses tables generated during RDOQ to select the best coefficient to change.
|
static |