Add macros for adjusting weight of distortion between luma and chroma.

- Everything needs to have a short name because windows has a maximum path
  length limitation that is breaking my testing framework.
This commit is contained in:
Ari Koivula 2014-10-06 21:46:12 +03:00
parent 49ad845c33
commit cbb2aa75b7
2 changed files with 17 additions and 5 deletions

View file

@ -43,6 +43,9 @@
#include "sao.h"
#include "rdo.h"
#ifndef LMBD
# define LMBD 1.0
#endif
/*!
\brief Initializes lambda-value for current QP
@ -70,6 +73,8 @@ void encoder_state_init_lambda(encoder_state * const encoder_state)
lambda *= 0.95;
}
lambda *= LMBD;
encoder_state->global->cur_lambda_cost = lambda;
encoder_state->global->cur_lambda_cost_sqrt = sqrt(lambda);
}

View file

@ -47,13 +47,20 @@
&& (x) + (block_width) <= (width) \
&& (y) + (block_height) <= (height))
#ifndef CU_SPLIT_COST
# define CU_SPLIT_COST 9
#ifndef CUSPL
# define CUSPL 9
#endif
#ifndef FULL_CU_SPLIT_SEARCH
# define FULL_CU_SPLIT_SEARCH false
#endif
#ifndef LMUL
# define LMUL 1.0
#endif
#ifndef CMUL
# define CMUL 1.0
#endif
/**
* This is used in the hexagon_search to select 3 points to search.
*
@ -831,7 +838,7 @@ static double cu_rd_cost_luma(const encoder_state *const encoder_state,
}
double bits = tr_tree_bits + coeff_bits;
return ssd + bits * encoder_state->global->cur_lambda_cost;
return (double)ssd * LMUL + bits * encoder_state->global->cur_lambda_cost;
}
@ -921,7 +928,7 @@ static double cu_rd_cost_chroma(const encoder_state *const encoder_state,
}
double bits = tr_tree_bits + coeff_bits;
return ssd + bits * encoder_state->global->cur_lambda_cost;
return (double)ssd * CMUL + bits * encoder_state->global->cur_lambda_cost;
}
@ -1507,7 +1514,7 @@ static double search_cu(encoder_state * const encoder_state, int x, int y, int d
if (depth < MAX_INTRA_SEARCH_DEPTH || (depth < MAX_INTER_SEARCH_DEPTH && encoder_state->global->slicetype != SLICE_I)) {
int half_cu = cu_width / 2;
// Using Cost = lambda * 9 to compensate on the price of the split
double split_cost = encoder_state->global->cur_lambda_cost * CU_SPLIT_COST;
double split_cost = encoder_state->global->cur_lambda_cost * CUSPL;
int cbf = cbf_is_set(cur_cu->cbf.y, depth) || cbf_is_set(cur_cu->cbf.u, depth) || cbf_is_set(cur_cu->cbf.v, depth);
if (depth < MAX_DEPTH) {