TUT HEVC Encoder
Loading...
Searching...
No Matches
rdo.h
Go to the documentation of this file.
1#ifndef RDO_H_
2#define RDO_H_
3/*****************************************************************************
4 * This file is part of Kvazaar HEVC encoder.
5 *
6 * Copyright (c) 2021, Tampere University, ITU/ISO/IEC, project contributors
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without modification,
10 * are permitted provided that the following conditions are met:
11 *
12 * * Redistributions of source code must retain the above copyright notice, this
13 * list of conditions and the following disclaimer.
14 *
15 * * Redistributions in binary form must reproduce the above copyright notice, this
16 * list of conditions and the following disclaimer in the documentation and/or
17 * other materials provided with the distribution.
18 *
19 * * Neither the name of the Tampere University or ITU/ISO/IEC nor the names of its
20 * contributors may be used to endorse or promote products derived from
21 * this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
27 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON
30 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 * INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
33 ****************************************************************************/
34
41#include "cabac.h"
42#include "cu.h"
43#include "encoderstate.h"
44#include "global.h" // IWYU pragma: keep
45#include "search_inter.h"
46
47
48// This struct is for passing data to kvz_rdoq_sign_hiding
50 // Bit cost of increasing rate by one.
51 int32_t inc[32 * 32];
52 // Bit cost of decreasing rate by one.
53 int32_t dec[32 * 32];
54 // Bit cost of going from zero to one.
56 // Coeff minus quantized coeff.
58};
59
60
61extern const uint32_t kvz_g_go_rice_range[5];
63
66
68 int32_t height, int8_t type, int8_t scan_mode, int8_t block_type, int8_t tr_depth);
69
70double kvz_get_coeff_cost(const encoder_state_t * const state,
71 const coeff_t *coeff,
72 int32_t width,
73 int32_t type,
75
83 int32_t q_bits,double temp, int8_t last, int8_t type);
84
86
88 const cabac_data_t* cabac,
91
92// Number of fixed point fractional bits used in the fractional bit table.
93#define CTX_FRAC_BITS 15
94#define CTX_FRAC_ONE_BIT (1 << CTX_FRAC_BITS)
95#define CTX_FRAC_HALF_BIT (1 << (CTX_FRAC_BITS - 1))
96
97extern const uint32_t kvz_entropy_bits[128];
98#define CTX_ENTROPY_BITS(ctx, val) kvz_entropy_bits[(ctx)->uc_state ^ (val)]
99
100// Floating point fractional bits, derived from kvz_entropy_bits
101
102#endif
Coding bins using CABAC.
Coding Unit data structure and related functions.
Top level of the encoder implementation.
Header that is included in every other header.
#define MAX_TILES_PER_DIM
Definition global.h:232
int16_t coeff_t
Definition global.h:115
const uint32_t kvz_g_go_rice_prefix_len[5]
Definition rdo.c:65
int kvz_init_rdcost_outfiles(const char *fn_template)
Definition rdo.c:151
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.
Definition rdo.c:661
void kvz_close_rdcost_outfiles(void)
Definition rdo.c:1144
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.
Definition rdo.c:302
kvz_mvd_cost_func kvz_calc_mvd_cost_cabac
Definition rdo.h:85
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.
Definition rdo.c:979
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.
Definition rdo.c:346
const uint32_t kvz_entropy_bits[128]
Entropy bits to estimate coded bits in RDO / RDOQ (From HM 12.0)
Definition rdo.c:70
const uint32_t kvz_g_go_rice_range[5]
Definition rdo.c:64
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.
Definition rdo.c:410
Inter prediction parameter search.
double kvz_mvd_cost_func(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)
Definition search_inter.h:67
Definition cabac.h:54
Definition encoderstate.h:274
Definition rdo.h:49
int32_t inc[32 *32]
Definition rdo.h:51
int32_t sig_coeff_inc[32 *32]
Definition rdo.h:55
int32_t quant_delta[32 *32]
Definition rdo.h:57
int32_t dec[32 *32]
Definition rdo.h:53