From eb32f40bd95e1dc33a80be2b53717674094c500b Mon Sep 17 00:00:00 2001 From: siivonek Date: Wed, 13 Oct 2021 14:17:17 +0200 Subject: [PATCH] Another fix for reference building. --- src/intra.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/intra.c b/src/intra.c index 1b7c0de4..f32bf985 100644 --- a/src/intra.c +++ b/src/intra.c @@ -713,10 +713,15 @@ void kvz_intra_build_reference_any( if (px.x == 0) { // On left border, no need for multi ref index out_left_ref[0] = out_left_ref[1]; - // Fill top reference top left pixels with nearest - kvz_pixel nearest = top_border[0]; - for (int i = 0; i <= multi_ref_index; ++i) { - out_top_ref[i] = nearest; + if (px.y == 0) { + out_top_ref[0] = out_left_ref[1]; + } + else { + // Fill top reference top left pixels with nearest + kvz_pixel nearest = top_border[0]; + for (int i = 0; i <= multi_ref_index; ++i) { + out_top_ref[i] = nearest; + } } } else { // Copy reference clockwise.