From 06532292fc961a93a1b8072e768aa5552b28e7d7 Mon Sep 17 00:00:00 2001 From: Laurent Fasnacht Date: Tue, 20 May 2014 09:13:10 +0200 Subject: [PATCH] Wavefront are in tile coordinates --- src/encoder.c | 8 +++++--- src/encoder.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/encoder.c b/src/encoder.c index 8a72bd7d..04c96033 100644 --- a/src/encoder.c +++ b/src/encoder.c @@ -1002,7 +1002,7 @@ int encoder_state_init(encoder_state * const child_state, encoder_state * const new_child->slice = child_state->slice; new_child->wfrow = MALLOC(encoder_state_config_wfrow, 1); - if (!new_child->wfrow || !encoder_state_config_wfrow_init(new_child, i + first_row)) { + if (!new_child->wfrow || !encoder_state_config_wfrow_init(new_child, i)) { fprintf(stderr, "Could not initialize encoder_state->wfrow!\n"); return 0; } @@ -1033,17 +1033,19 @@ int encoder_state_init(encoder_state * const child_state, encoder_state * const //Restrict to the current wavefront row if needed if (child_state->type == ENCODER_STATE_TYPE_WAVEFRONT_ROW) { - lcu_start = MAX(lcu_start, (child_state->wfrow->lcu_offset_y - child_state->tile->lcu_offset_y) * child_state->tile->cur_pic->width_in_lcu); - lcu_end = MIN(lcu_end, (child_state->wfrow->lcu_offset_y - child_state->tile->lcu_offset_y + 1) * child_state->tile->cur_pic->width_in_lcu); + lcu_start = MAX(lcu_start, (child_state->wfrow->lcu_offset_y) * child_state->tile->cur_pic->width_in_lcu); + lcu_end = MIN(lcu_end, (child_state->wfrow->lcu_offset_y + 1) * child_state->tile->cur_pic->width_in_lcu); } child_state->lcu_order_count = lcu_end - lcu_start; child_state->lcu_order = MALLOC(lcu_order_element, child_state->lcu_order_count); + assert(child_state->lcu_order); for (i = 0; i < child_state->lcu_order_count; ++i) { lcu_id = lcu_start + i; child_state->lcu_order[i].encoder_state = child_state; child_state->lcu_order[i].id = lcu_id; + child_state->lcu_order[i].index = i; child_state->lcu_order[i].position.x = lcu_id % child_state->tile->cur_pic->width_in_lcu; child_state->lcu_order[i].position.y = lcu_id / child_state->tile->cur_pic->width_in_lcu; child_state->lcu_order[i].position_px.x = child_state->lcu_order[i].position.x * LCU_WIDTH; diff --git a/src/encoder.h b/src/encoder.h index bea64dbf..68e4bcc9 100644 --- a/src/encoder.h +++ b/src/encoder.h @@ -197,7 +197,7 @@ typedef struct { } encoder_state_config_slice; typedef struct { - //Row in image coordinates of the wavefront + //Row in tile coordinates of the wavefront int32_t lcu_offset_y; } encoder_state_config_wfrow;