mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-30 12:44:07 +00:00
Fix wrong strides in SAO reconstruction
Functions kvz_sao_reconstruct and encoder_sao_reconstruct used frame->width as the stride instead of frame->rec->stride when accessing frame->rec->data. This caused errors when using tiles and SAO.
This commit is contained in:
parent
242c11d379
commit
24ecddd2a5
|
@ -351,29 +351,29 @@ static void encoder_sao_reconstruct(const encoder_state_t *const state,
|
|||
// Copy pixels that will be filtered and bordering pixels from right and
|
||||
// below.
|
||||
const int from_index = (lcu->position_px.x + x_offsets[0]) +
|
||||
(lcu->position_px.y + y_offsets[0]) * frame->width;
|
||||
(lcu->position_px.y + y_offsets[0]) * frame->rec->stride;
|
||||
const int to_index = x_offsets[0] + y_offsets[0] * SAO_BUF_WIDTH;
|
||||
kvz_pixels_blit(&frame->rec->y[from_index],
|
||||
&sao_buf_y[to_index],
|
||||
width + border_right,
|
||||
height + border_below,
|
||||
frame->width,
|
||||
frame->rec->stride,
|
||||
SAO_BUF_WIDTH);
|
||||
if (state->encoder_control->chroma_format != KVZ_CSP_400) {
|
||||
const int from_index_c = (lcu->position_px.x + x_offsets[0])/2 +
|
||||
(lcu->position_px.y + y_offsets[0])/2 * frame->width/2;
|
||||
(lcu->position_px.y + y_offsets[0])/2 * frame->rec->stride/2;
|
||||
const int to_index_c = x_offsets[0]/2 + y_offsets[0]/2 * SAO_BUF_WIDTH_C;
|
||||
kvz_pixels_blit(&frame->rec->u[from_index_c],
|
||||
&sao_buf_u[to_index_c],
|
||||
width/2 + border_right,
|
||||
height/2 + border_below,
|
||||
frame->width/2,
|
||||
frame->rec->stride/2,
|
||||
SAO_BUF_WIDTH_C);
|
||||
kvz_pixels_blit(&frame->rec->v[from_index_c],
|
||||
&sao_buf_v[to_index_c],
|
||||
width/2 + border_right,
|
||||
height/2 + border_below,
|
||||
frame->width/2,
|
||||
frame->rec->stride/2,
|
||||
SAO_BUF_WIDTH_C);
|
||||
}
|
||||
|
||||
|
|
|
@ -291,7 +291,8 @@ void kvz_sao_reconstruct(const encoder_state_t *state,
|
|||
|
||||
const int frame_width = frame->width >> shift;
|
||||
const int frame_height = frame->height >> shift;
|
||||
kvz_pixel *output = &frame->rec->data[color][frame_x + frame_y * frame_width];
|
||||
const int frame_stride = frame->rec->stride >> shift;
|
||||
kvz_pixel *output = &frame->rec->data[color][frame_x + frame_y * frame_stride];
|
||||
|
||||
if (sao->type == SAO_TYPE_EDGE) {
|
||||
const vector2d_t *offset = g_sao_edge_offsets[sao->eo_class];
|
||||
|
@ -317,7 +318,7 @@ void kvz_sao_reconstruct(const encoder_state_t *state,
|
|||
if (frame_y + offset[0].y < 0 || frame_y + offset[1].y < 0) {
|
||||
// Nothing to do for the topmost row.
|
||||
buffer += stride;
|
||||
output += frame_width;
|
||||
output += frame_stride;
|
||||
height -= 1;
|
||||
}
|
||||
}
|
||||
|
@ -328,7 +329,7 @@ void kvz_sao_reconstruct(const encoder_state_t *state,
|
|||
output,
|
||||
sao,
|
||||
stride,
|
||||
frame_width,
|
||||
frame_stride,
|
||||
width,
|
||||
height,
|
||||
color);
|
||||
|
|
Loading…
Reference in a new issue