TUT HEVC Encoder
Loading...
Searching...
No Matches
transform.c File Reference
#include "transform.h"
#include "image.h"
#include "kvazaar.h"
#include "rdo.h"
#include "strategies/strategies-dct.h"
#include "strategies/strategies-quant.h"
#include "strategies/strategies-picture.h"
#include "tables.h"
Include dependency graph for transform.c:

Typedefs

typedef enum rdpcm_dir rdpcm_dir
 RDPCM direction.
 

Enumerations

enum  rdpcm_dir { RDPCM_VER = 0 , RDPCM_HOR = 1 }
 RDPCM direction. More...
 

Functions

static bool bypass_transquant (const int width, const int in_stride, const int out_stride, const kvz_pixel *const ref_in, const kvz_pixel *const pred_in, kvz_pixel *rec_out, coeff_t *coeff_out)
 Bypass transform and quantization.
 
static void rdpcm (const int width, const rdpcm_dir dir, coeff_t *coeff)
 Apply DPCM to residual.
 
int32_t kvz_get_scaled_qp (int8_t type, int8_t qp, int8_t qp_offset)
 Get scaled QP used in quantization.
 
void kvz_transformskip (const encoder_control_t *const encoder, int16_t *block, int16_t *coeff, int8_t block_size)
 NxN inverse transform (2D)
 
void kvz_itransformskip (const encoder_control_t *const encoder, int16_t *block, int16_t *coeff, int8_t block_size)
 inverse transform skip
 
void kvz_transform2d (const encoder_control_t *const encoder, int16_t *block, int16_t *coeff, int8_t block_size, color_t color, cu_type_t type)
 forward transform (2D)
 
void kvz_itransform2d (const encoder_control_t *const encoder, int16_t *block, int16_t *coeff, int8_t block_size, color_t color, cu_type_t type)
 
int kvz_quantize_residual_trskip (encoder_state_t *const state, const cu_info_t *const cur_cu, const int width, const color_t color, const coeff_scan_order_t scan_order, int8_t *trskip_out, const int in_stride, const int out_stride, const kvz_pixel *const ref_in, const kvz_pixel *const pred_in, kvz_pixel *rec_out, coeff_t *coeff_out)
 Like kvz_quantize_residual except that this uses trskip if that is better.
 
static void quantize_tr_residual (encoder_state_t *const state, const color_t color, const int32_t x, const int32_t y, const uint8_t depth, cu_info_t *cur_pu, lcu_t *lcu, bool early_skip)
 Calculate the residual coefficients for a single TU.
 
void kvz_quantize_lcu_residual (encoder_state_t *const state, const bool luma, const bool chroma, const int32_t x, const int32_t y, const uint8_t depth, cu_info_t *cur_pu, lcu_t *lcu, bool early_skip)
 This function calculates the residual coefficients for a region of the LCU (defined by x, y and depth) and updates the reconstruction with the kvantized residual.
 

Variables

const uint8_t kvz_g_chroma_scale [58]
 

Typedef Documentation

◆ rdpcm_dir

typedef enum rdpcm_dir rdpcm_dir

Enumeration Type Documentation

◆ rdpcm_dir

enum rdpcm_dir
Enumerator
RDPCM_VER 
RDPCM_HOR 

Function Documentation

◆ bypass_transquant()

static bool bypass_transquant ( const int width,
const int in_stride,
const int out_stride,
const kvz_pixel *const ref_in,
const kvz_pixel *const pred_in,
kvz_pixel * rec_out,
coeff_t * coeff_out )
static

Copies the reference pixels directly to reconstruction and the residual directly to coefficients. Used when cu_transquant_bypass_flag is set. Parameters pred_in and rec_out may be aliased.

Parameters
widthTransform width.
in_strideStride for ref_in and pred_in
out_strideStride for rec_out.
ref_inReference pixels.
pred_inPredicted pixels.
rec_outReturns the reconstructed pixels.
coeff_outReturns the coefficients used for reconstruction of rec_out.
Returns
Whether coeff_out contains any non-zero coefficients.
Here is the caller graph for this function:

◆ kvz_get_scaled_qp()

int32_t kvz_get_scaled_qp ( int8_t type,
int8_t qp,
int8_t qp_offset )
Here is the caller graph for this function:

◆ kvz_itransform2d()

void kvz_itransform2d ( const encoder_control_t *const encoder,
int16_t * block,
int16_t * coeff,
int8_t block_size,
color_t color,
cu_type_t type )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_itransformskip()

void kvz_itransformskip ( const encoder_control_t *const encoder,
int16_t * block,
int16_t * coeff,
int8_t block_size )
Parameters
coeffinput data (transform coefficients)
blockoutput data (residual)
block_sizewidth of transform
Here is the caller graph for this function:

◆ kvz_quantize_lcu_residual()

void kvz_quantize_lcu_residual ( encoder_state_t *const state,
const bool luma,
const bool chroma,
const int32_t x,
const int32_t y,
const uint8_t depth,
cu_info_t * cur_pu,
lcu_t * lcu,
bool early_skip )

Processes the TU tree recursively.

Inputs are:

  • lcu->rec pixels after prediction for the area
  • lcu->ref reference pixels for the area
  • lcu->cu for the area
  • early_skip if this is used for early skip, bypass IT and IQ

Outputs are:

  • lcu->rec reconstruction after quantized residual
  • lcu->coeff quantized coefficients for the area
  • lcu->cbf coded block flags for the area
  • lcu->cu.intra.tr_skip tr skip flags for the area (in case of luma)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_quantize_residual_trskip()

int kvz_quantize_residual_trskip ( encoder_state_t *const state,
const cu_info_t *const cur_cu,
const int width,
const color_t color,
const coeff_scan_order_t scan_order,
int8_t * trskip_out,
const int in_stride,
const int out_stride,
const kvz_pixel *const ref_in,
const kvz_pixel *const pred_in,
kvz_pixel * rec_out,
coeff_t * coeff_out )

Using this function saves one step of quantization and inverse quantization compared to doing the decision separately from the actual operation.

Parameters
widthTransform width.
colorColor.
scan_orderCoefficient scan order.
trskip_outWhether transform skip is used.
strideStride for ref_in, pred_in and rec_out.
ref_inReference pixels.
pred_inPredicted pixels.
rec_outReconstructed pixels.
coeff_outCoefficients used for reconstruction of rec_out.
Returns
Whether coeff_out contains any non-zero coefficients.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_transform2d()

void kvz_transform2d ( const encoder_control_t *const encoder,
int16_t * block,
int16_t * coeff,
int8_t block_size,
color_t color,
cu_type_t type )
Parameters
blockinput residual
coefftransform coefficients
block_sizewidth of transform
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvz_transformskip()

void kvz_transformskip ( const encoder_control_t *const encoder,
int16_t * block,
int16_t * coeff,
int8_t block_size )
Parameters
coeffinput data (transform coefficients)
blockoutput data (residual)
block_sizeinput data (width of transform)
Here is the caller graph for this function:

◆ quantize_tr_residual()

static void quantize_tr_residual ( encoder_state_t *const state,
const color_t color,
const int32_t x,
const int32_t y,
const uint8_t depth,
cu_info_t * cur_pu,
lcu_t * lcu,
bool early_skip )
static
Parameters
early_skipif this is used for early skip, bypass IT and IQ
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdpcm()

static void rdpcm ( const int width,
const rdpcm_dir dir,
coeff_t * coeff )
static
Parameters
widthwidth of the block
dirRDPCM direction
coeffcoefficients (residual) to filter
Here is the caller graph for this function:

Variable Documentation

◆ kvz_g_chroma_scale

const uint8_t kvz_g_chroma_scale[58]
Initial value:
=
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,
17,18,19,20,21,22,23,24,25,26,27,28,29,29,30,31,32,
33,33,34,34,35,35,36,36,37,37,38,39,40,41,42,43,44,
45,46,47,48,49,50,51
}