Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Michael Niedermayer via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Michael Niedermayer <michael@niedermayer.cc>
Subject: [FFmpeg-devel] Re: [FFmpeg-cvslog] [ffmpeg] 09/09: swscale/unscaled: fix rgbToRgbWrapper for YUVX
Date: Thu, 26 Feb 2026 19:49:44 +0100
Message-ID: <aaCVyD17MSmB3uia@neo> (raw)
In-Reply-To: <20260226101608.82F5269120F@ffbox0-bg.ffmpeg.org>


[-- Attachment #1.1: Type: text/plain, Size: 3444 bytes --]

Hi

this breaks brender

./ffmpeg -y -i 5-0-TESTMAP.PIX -vframes 1 /tmp/brender.tga

colors look very wrong

https://samples.ffmpeg.org/game-formats/brender/brender_pix.tar.gz

thx

On Thu, Feb 26, 2026 at 12:16:16PM +0200, Niklas Haas via ffmpeg-cvslog wrote:
> This is an automated email from the git hooks/post-receive script.
> 
> Git pushed a commit to branch master
> in repository ffmpeg.
> 
> commit 5fa2a65c110a942acba211ac3e6690ef244c8e9e
> Author:     Niklas Haas <git@haasn.dev>
> AuthorDate: Tue Feb 24 19:01:05 2026 +0100
> Commit:     Niklas Haas <ffmpeg@haasn.dev>
> CommitDate: Thu Feb 26 10:15:52 2026 +0000
> 
>     swscale/unscaled: fix rgbToRgbWrapper for YUVX
>     
>     This code calculates the pixel step using c->dstFormatBpp, which is wrong;
>     should use the pixdesc step instead. (dstFormatBpp is 3 for YUVX, but
>     the actual pixel step is 4 bytes)
>     
>     This bug was mostly hidden by the fact that the same bug actually disabled
>     the fast path for the (common) case of strStride == dstStride. Uncovered while
>     making changes to the swscale.c allocation code.
>     
>     Reproduced by modifying libswscale in such a way that the dst buffer stride
>     happened to be exactly 4/3 larger than the src buffer stride, e.g. by adding
>     extra padding to each dst buffer line, but reproducible in principle by any
>     API user.
>     
>     Signed-off-by: Niklas Haas <git@haasn.dev>
> ---
>  libswscale/swscale_unscaled.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
> index 38a9b467d4..f612f88c4d 100644
> --- a/libswscale/swscale_unscaled.c
> +++ b/libswscale/swscale_unscaled.c
> @@ -1994,8 +1994,8 @@ static int rgbToRgbWrapper(SwsInternal *c, const uint8_t *const src[], const int
>      const enum AVPixelFormat dstFormat = c->opts.dst_format;
>      const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(c->opts.src_format);
>      const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(c->opts.dst_format);
> -    const int srcBpp = (c->srcFormatBpp + 7) >> 3;
> -    const int dstBpp = (c->dstFormatBpp + 7) >> 3;
> +    const int srcBpp = desc_src->comp[0].step;
> +    const int dstBpp = desc_dst->comp[0].step;
>      rgbConvFn conv = findRgbConvFn(c);
>  
>      if (!conv) {
> @@ -2004,8 +2004,8 @@ static int rgbToRgbWrapper(SwsInternal *c, const uint8_t *const src[], const int
>      } else {
>          const uint8_t *srcPtr = src[0];
>                uint8_t *dstPtr = dst[0];
> -        int src_bswap = IS_NOT_NE(c->srcFormatBpp, desc_src);
> -        int dst_bswap = IS_NOT_NE(c->dstFormatBpp, desc_dst);
> +        int src_bswap = IS_NOT_NE(srcBpp, desc_src);
> +        int dst_bswap = IS_NOT_NE(dstBpp, desc_dst);
>  
>          if ((srcFormat == AV_PIX_FMT_RGB32_1 || srcFormat == AV_PIX_FMT_BGR32_1) &&
>              !isRGBA32(dstFormat))
> 
> _______________________________________________
> ffmpeg-cvslog mailing list -- ffmpeg-cvslog@ffmpeg.org
> To unsubscribe send an email to ffmpeg-cvslog-leave@ffmpeg.org
> 

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Whats the most studid thing your enemy could do ? Blow himself up
Whats the most studid thing you could do ? Give up your rights and
freedom because your enemy blew himself up.


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 163 bytes --]

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

           reply	other threads:[~2026-02-26 18:50 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20260226101608.82F5269120F@ffbox0-bg.ffmpeg.org>]

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=aaCVyD17MSmB3uia@neo \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=michael@niedermayer.cc \
    /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