Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: David Christle via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: David Christle <dev@christle.is>
Subject: [FFmpeg-devel] [PATCH v2 1/3] swscale/loongarch: fix LASX YUV2RGB residual for multi-row slices
Date: Sun, 08 Feb 2026 21:16:03 +0000
Message-ID: <20260208211537.91515-2-dev@christle.is> (raw)
In-Reply-To: <20260208211537.91515-1-dev@christle.is>

The res variable (pixel residual count for widths not divisible by 16)
is computed once before the row loop, but DEALYUV2RGBLINERES and
DEALYUV2RGBLINERES32 destructively subtract 8 from it inside the loop
body. When srcSliceH > 2, subsequent row pairs get an incorrect
residual count, producing wrong output for the tail pixels.

Fix by recomputing res from the constant c->opts.dst_w at the top of
each row-pair iteration.

Signed-off-by: David Christle <dev@christle.is>
---
 libswscale/loongarch/yuv2rgb_lasx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libswscale/loongarch/yuv2rgb_lasx.c b/libswscale/loongarch/yuv2rgb_lasx.c
index 9032887ff8..d08cf10d4b 100644
--- a/libswscale/loongarch/yuv2rgb_lasx.c
+++ b/libswscale/loongarch/yuv2rgb_lasx.c
@@ -185,6 +185,7 @@
         const uint8_t *py_2 = py_1   +                   srcStride[0];              \
         const uint8_t *pu   = src[1] +   (y >> vshift) * srcStride[1];              \
         const uint8_t *pv   = src[2] +   (y >> vshift) * srcStride[2];              \
+        res = c->opts.dst_w & 15;                                                   \
         for(x = 0; x < h_size; x++) {                                               \
 
 #define YUV2RGBFUNC32(func_name, dst_type, alpha)                                   \
@@ -213,6 +214,7 @@
         const uint8_t *py_2 = py_1   +                   srcStride[0];              \
         const uint8_t *pu   = src[1] +   (y >> vshift) * srcStride[1];              \
         const uint8_t *pv   = src[2] +   (y >> vshift) * srcStride[2];              \
+        res = c->opts.dst_w & 15;                                                   \
         for(x = 0; x < h_size; x++) {                                               \
 
 #define DEALYUV2RGBLINE                                                             \
-- 
2.52.0


_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

  reply	other threads:[~2026-02-08 21:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-06  6:45 [FFmpeg-devel] [PATCH 1/2] swscale/aarch64: add NEON YUV420P/YUV422P/YUVA420P to RGB conversion David Christle via ffmpeg-devel
2026-02-06  6:46 ` [FFmpeg-devel] [PATCH 2/2] tests/checkasm/sw_yuv2rgb: test multi-row conversion with padded strides David Christle via ffmpeg-devel
2026-02-08 21:15 ` [FFmpeg-devel] [PATCH v2 0/3] swscale: NEON YUV2RGB + LoongArch LASX multi-row fix David Christle via ffmpeg-devel
2026-02-08 21:16   ` David Christle via ffmpeg-devel [this message]
2026-02-08 21:16   ` [FFmpeg-devel] [PATCH v2 2/3] swscale/aarch64: add NEON YUV420P/YUV422P/YUVA420P to RGB conversion David Christle via ffmpeg-devel
2026-02-08 21:16   ` [FFmpeg-devel] [PATCH v2 3/3] tests/checkasm/sw_yuv2rgb: test multi-row conversion with padded strides David Christle via ffmpeg-devel
2026-02-08 21:35   ` [FFmpeg-devel] Re: [PATCH v2 0/3] swscale: NEON YUV2RGB + LoongArch LASX multi-row fix Martin Storsjö via ffmpeg-devel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260208211537.91515-2-dev@christle.is \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=dev@christle.is \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git