Clean up search initialization

Copy lcu explicitly instead of initializing with the same parameters.
This commit is contained in:
Ari Koivula 2016-02-17 14:52:42 +02:00
parent e5c84c361c
commit eeafe14946

View file

@ -778,6 +778,8 @@ static void init_lcu_t(const encoder_state_t * const state, const int x, const i
{ {
const videoframe_t * const frame = state->tile->frame; const videoframe_t * const frame = state->tile->frame;
FILL(*lcu, 0);
// Copy reference cu_info structs from neighbouring LCUs. // Copy reference cu_info structs from neighbouring LCUs.
{ {
const int x_cu = x >> MAX_DEPTH; const int x_cu = x >> MAX_DEPTH;
@ -912,16 +914,20 @@ static void copy_lcu_to_cu_data(const encoder_state_t * const state, int x_px, i
*/ */
void kvz_search_lcu(encoder_state_t * const state, const int x, const int y, const yuv_t * const hor_buf, const yuv_t * const ver_buf) void kvz_search_lcu(encoder_state_t * const state, const int x, const int y, const yuv_t * const hor_buf, const yuv_t * const ver_buf)
{ {
// Initialize the same starting state to every depth. The search process
// will use these as temporary storage for predictions before making
// a decision on which to use, and they get updated during the search
// process.
lcu_t work_tree[MAX_PU_DEPTH + 1]; lcu_t work_tree[MAX_PU_DEPTH + 1];
int depth; init_lcu_t(state, x, y, &work_tree[0], hor_buf, ver_buf);
// Initialize work tree. for (int depth = 1; depth <= MAX_PU_DEPTH; ++depth) {
for (depth = 0; depth <= MAX_PU_DEPTH; ++depth) { work_tree[depth] = work_tree[0];
FILL(work_tree[depth], 0);
init_lcu_t(state, x, y, &work_tree[depth], hor_buf, ver_buf);
} }
// Start search from depth 0. // Start search from depth 0.
search_cu(state, x, y, 0, work_tree); search_cu(state, x, y, 0, work_tree);
// The best decisions through out the LCU got propagated back to depth 0,
// so copy those back to the frame.
copy_lcu_to_cu_data(state, x, y, &work_tree[0]); copy_lcu_to_cu_data(state, x, y, &work_tree[0]);
} }