mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 19:24:06 +00:00
Clean up entropy tables and some unused code / comments
This commit is contained in:
parent
9e9a8058c5
commit
dee8a167e4
12
src/search.c
12
src/search.c
|
@ -253,17 +253,6 @@ double kvz_cu_rd_cost_luma(const encoder_state_t *const state,
|
||||||
|
|
||||||
const uint8_t tr_depth = tr_cu->tr_depth - depth;
|
const uint8_t tr_depth = tr_cu->tr_depth - depth;
|
||||||
|
|
||||||
// Add transform_tree split_transform_flag bit cost.
|
|
||||||
bool intra_split_flag = pred_cu->type == CU_INTRA && pred_cu->part_size == SIZE_NxN && depth == 3;
|
|
||||||
if (width <= TR_MAX_WIDTH
|
|
||||||
&& width > TR_MIN_WIDTH
|
|
||||||
&& !intra_split_flag)
|
|
||||||
{
|
|
||||||
// ToDo: check cost
|
|
||||||
//const cabac_ctx_t *ctx = &(state->cabac.ctx.trans_subdiv_model[5 - (6 - depth)]);
|
|
||||||
//tr_tree_bits += CTX_ENTROPY_FBITS(ctx, tr_depth > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tr_depth > 0) {
|
if (tr_depth > 0) {
|
||||||
int offset = width / 2;
|
int offset = width / 2;
|
||||||
double sum = 0;
|
double sum = 0;
|
||||||
|
@ -330,7 +319,6 @@ double kvz_cu_rd_cost_chroma(const encoder_state_t *const state,
|
||||||
|
|
||||||
if (depth < MAX_PU_DEPTH) {
|
if (depth < MAX_PU_DEPTH) {
|
||||||
const int tr_depth = depth - pred_cu->depth;
|
const int tr_depth = depth - pred_cu->depth;
|
||||||
// ToDo: Update for VVC contexts
|
|
||||||
const cabac_ctx_t *ctx = &(state->cabac.ctx.qt_cbf_model_cb[0]);
|
const cabac_ctx_t *ctx = &(state->cabac.ctx.qt_cbf_model_cb[0]);
|
||||||
if (tr_depth == 0 || cbf_is_set(pred_cu->cbf, depth - 1, COLOR_U)) {
|
if (tr_depth == 0 || cbf_is_set(pred_cu->cbf, depth - 1, COLOR_U)) {
|
||||||
tr_tree_bits += CTX_ENTROPY_FBITS(ctx, cbf_is_set(pred_cu->cbf, depth, COLOR_U));
|
tr_tree_bits += CTX_ENTROPY_FBITS(ctx, cbf_is_set(pred_cu->cbf, depth, COLOR_U));
|
||||||
|
|
|
@ -382,19 +382,8 @@ static double search_intra_trdepth(encoder_state_t * const state,
|
||||||
split_cost += search_intra_trdepth(state, x_px + offset, y_px + offset, depth + 1, max_depth, intra_mode, nosplit_cost, pred_cu, lcu, -1);
|
split_cost += search_intra_trdepth(state, x_px + offset, y_px + offset, depth + 1, max_depth, intra_mode, nosplit_cost, pred_cu, lcu, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
double tr_split_bit = 0.0;
|
|
||||||
double cbf_bits = 0.0;
|
double cbf_bits = 0.0;
|
||||||
|
|
||||||
// Add bits for split_transform_flag = 1, because transform depth search bypasses
|
|
||||||
// the normal recursion in the cost functions.
|
|
||||||
/*
|
|
||||||
// ToDo: check costs
|
|
||||||
if (depth >= 1 && depth <= 3) {
|
|
||||||
const cabac_ctx_t *ctx = &(state->cabac.ctx.trans_subdiv_model[5 - (6 - depth)]);
|
|
||||||
tr_split_bit += CTX_ENTROPY_FBITS(ctx, 1);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Add cost of cbf chroma bits on transform tree.
|
// Add cost of cbf chroma bits on transform tree.
|
||||||
// All cbf bits are accumulated to pred_cu.cbf and cbf_is_set returns true
|
// All cbf bits are accumulated to pred_cu.cbf and cbf_is_set returns true
|
||||||
// if cbf is set at any level >= depth, so cbf chroma is assumed to be 0
|
// if cbf is set at any level >= depth, so cbf chroma is assumed to be 0
|
||||||
|
@ -404,7 +393,6 @@ static double search_intra_trdepth(encoder_state_t * const state,
|
||||||
if (state->encoder_control->chroma_format != KVZ_CSP_400) {
|
if (state->encoder_control->chroma_format != KVZ_CSP_400) {
|
||||||
const uint8_t tr_depth = depth - pred_cu->depth;
|
const uint8_t tr_depth = depth - pred_cu->depth;
|
||||||
|
|
||||||
// ToDo: update for VVC contexts
|
|
||||||
const cabac_ctx_t* ctx = &(state->cabac.ctx.qt_cbf_model_cb[0]);
|
const cabac_ctx_t* ctx = &(state->cabac.ctx.qt_cbf_model_cb[0]);
|
||||||
if (tr_depth == 0 || cbf_is_set(pred_cu->cbf, depth - 1, COLOR_U)) {
|
if (tr_depth == 0 || cbf_is_set(pred_cu->cbf, depth - 1, COLOR_U)) {
|
||||||
cbf_bits += CTX_ENTROPY_FBITS(ctx, cbf_is_set(pred_cu->cbf, depth, COLOR_U));
|
cbf_bits += CTX_ENTROPY_FBITS(ctx, cbf_is_set(pred_cu->cbf, depth, COLOR_U));
|
||||||
|
@ -415,7 +403,7 @@ static double search_intra_trdepth(encoder_state_t * const state,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double bits = tr_split_bit + cbf_bits;
|
double bits = cbf_bits;
|
||||||
split_cost += bits * state->lambda;
|
split_cost += bits * state->lambda;
|
||||||
} else {
|
} else {
|
||||||
assert(width <= TR_MAX_WIDTH);
|
assert(width <= TR_MAX_WIDTH);
|
||||||
|
|
Loading…
Reference in a new issue