Use new buffers for search

This commit is contained in:
Laurent Fasnacht 2014-05-14 09:05:21 +02:00
parent c257c4b863
commit 6607c9f563
2 changed files with 13 additions and 14 deletions

View file

@ -1249,7 +1249,7 @@ static void encoder_state_encode_leaf(encoder_state * const encoder_state) {
1, lcu->size.y / 2, cur_pic->width / 2, 1);
}
search_lcu(encoder_state, lcu->position_px.x, lcu->position_px.y, &hor_buf, ver_buf);
search_lcu(encoder_state, lcu->position_px.x, lcu->position_px.y, hor_buf_search, ver_buf_search);
encoder_state_recdata_to_bufs(encoder_state, lcu, hor_buf_search, ver_buf_search);

View file

@ -1021,32 +1021,31 @@ static void init_lcu_t(const encoder_state * const encoder_state, const int x, c
// Copy reference pixels.
{
const int pic_width = cur_pic->width;
// Copy top reference pixels.
if (y > 0) {
// hor_buf is of size pic_width so there might not be LCU_REF_PX_WIDTH
// number of allocated pixels left.
int x_max = MIN(LCU_REF_PX_WIDTH, pic_width - x);
memcpy(&lcu->top_ref.y[1], &hor_buf->y[x], x_max);
memcpy(&lcu->top_ref.u[1], &hor_buf->u[x / 2], x_max / 2);
memcpy(&lcu->top_ref.v[1], &hor_buf->v[x / 2], x_max / 2);
memcpy(&lcu->top_ref.y[1], &hor_buf->y[OFFSET_HOR_BUF(x, y, cur_pic, 0)], x_max);
memcpy(&lcu->top_ref.u[1], &hor_buf->u[OFFSET_HOR_BUF_C(x, y, cur_pic, 0)], x_max / 2);
memcpy(&lcu->top_ref.v[1], &hor_buf->v[OFFSET_HOR_BUF_C(x, y, cur_pic, 0)], x_max / 2);
}
// Copy left reference pixels.
if (x > 0) {
memcpy(&lcu->left_ref.y[1], &ver_buf->y[1], LCU_WIDTH);
memcpy(&lcu->left_ref.u[1], &ver_buf->u[1], LCU_WIDTH / 2);
memcpy(&lcu->left_ref.v[1], &ver_buf->v[1], LCU_WIDTH / 2);
memcpy(&lcu->left_ref.y[1], &ver_buf->y[OFFSET_VER_BUF(x, y, cur_pic, 0)], LCU_WIDTH);
memcpy(&lcu->left_ref.u[1], &ver_buf->u[OFFSET_VER_BUF_C(x, y, cur_pic, 0)], LCU_WIDTH / 2);
memcpy(&lcu->left_ref.v[1], &ver_buf->v[OFFSET_VER_BUF_C(x, y, cur_pic, 0)], LCU_WIDTH / 2);
}
// Copy top-left reference pixel.
if (x > 0 && y > 0) {
lcu->top_ref.y[0] = ver_buf->y[0];
lcu->left_ref.y[0] = ver_buf->y[0];
lcu->top_ref.y[0] = ver_buf->y[OFFSET_VER_BUF(x, y, cur_pic, -1)];
lcu->left_ref.y[0] = ver_buf->y[OFFSET_VER_BUF(x, y, cur_pic, -1)];
lcu->top_ref.u[0] = ver_buf->u[0];
lcu->left_ref.u[0] = ver_buf->u[0];
lcu->top_ref.u[0] = ver_buf->u[OFFSET_VER_BUF(x, y, cur_pic, -1)];
lcu->left_ref.u[0] = ver_buf->u[OFFSET_VER_BUF(x, y, cur_pic, -1)];
lcu->top_ref.v[0] = ver_buf->v[0];
lcu->left_ref.v[0] = ver_buf->v[0];
lcu->top_ref.v[0] = ver_buf->v[OFFSET_VER_BUF(x, y, cur_pic, -1)];
lcu->left_ref.v[0] = ver_buf->v[OFFSET_VER_BUF(x, y, cur_pic, -1)];
}
}