From da588af2baaff56f3d8bdaf4d7c130ff0e83dd91 Mon Sep 17 00:00:00 2001 From: Laurent Fasnacht Date: Thu, 8 May 2014 14:05:49 +0200 Subject: [PATCH] Partial support for wavefront --- src/encoder.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/encoder.c b/src/encoder.c index 95ddfe50..a74e6e08 100644 --- a/src/encoder.c +++ b/src/encoder.c @@ -1171,6 +1171,39 @@ static void encoder_state_encode_leaf(encoder_state * const encoder_state) { int i = 0; assert(encoder_state->is_leaf); + assert(encoder_state->lcu_order_count > 0); + + //For wavefronts, we need to get initial data from the row above + if (encoder_state->type == ENCODER_STATE_TYPE_WAVEFRONT_ROW && !encoder_state->lcu_order[0].first_row) { + const lcu_order_element * const lcu = &encoder_state->lcu_order[0]; + + picture_blit_pixels(&cur_pic->y_recdata[(lcu->position_px.y - 1) * cur_pic->width + lcu->position_px.x], + &hor_buf->y[lcu->position_px.x], + lcu->size.x, 1, cur_pic->width, cur_pic->width); + + picture_blit_pixels(&cur_pic->u_recdata[(lcu->position_px.y / 2 - 1) * cur_pic->width / 2 + lcu->position_px.x / 2], + &hor_buf->u[lcu->position_px.x / 2], + lcu->size.x / 2, 1, cur_pic->width / 2, cur_pic->width / 2); + + picture_blit_pixels(&cur_pic->v_recdata[(lcu->position_px.y / 2 - 1) * cur_pic->width / 2 + lcu->position_px.x / 2], + &hor_buf->v[lcu->position_px.x / 2], + lcu->size.x / 2, 1, cur_pic->width / 2, cur_pic->width / 2); + + ver_buf->y[0] = hor_buf->y[lcu->position_next_px.x - 1]; + ver_buf->u[0] = hor_buf->u[lcu->position_next_px.x / 2 - 1]; + ver_buf->v[0] = hor_buf->v[lcu->position_next_px.x / 2 - 1]; + + /*picture_blit_pixels(&cur_pic->y_recdata[lcu->position_px.y * cur_pic->width + lcu->position_next_px.x - 1], + &ver_buf->y[1], + 1, lcu->size.y, cur_pic->width, 1); + picture_blit_pixels(&cur_pic->u_recdata[lcu->position_px.y * cur_pic->width / 4 + (lcu->position_next_px.x / 2) - 1], + &ver_buf->u[1], + 1, lcu->size.y / 2, cur_pic->width / 2, 1); + picture_blit_pixels(&cur_pic->v_recdata[lcu->position_px.y * cur_pic->width / 4 + (lcu->position_next_px.x / 2) - 1], + &ver_buf->v[1], + 1, lcu->size.y / 2, cur_pic->width / 2, 1);*/ + + } for (i = 0; i < encoder_state->lcu_order_count; ++i) { const lcu_order_element * const lcu = &encoder_state->lcu_order[i];