[FFmpeg-devel] [PATCH 2/2] swscale/swscale_unscaled: avoid nv12 <-> nv21 bug

Niklas Haas ffmpeg at haasn.xyz
Sun Mar 16 14:52:24 EET 2025


From: Niklas Haas <git at haasn.dev>

This is not handled by the planar copy wrapper, so exclude it.
---
 libswscale/swscale_unscaled.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index 1df160daaa..4959963b18 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -2660,7 +2660,8 @@ void ff_get_unscaled_swscale(SwsInternal *c)
         (isPlanarYUV(srcFormat) && isPlanarYUV(dstFormat) &&
          c->chrDstHSubSample == c->chrSrcHSubSample &&
          c->chrDstVSubSample == c->chrSrcVSubSample &&
-         isSemiPlanarYUV(srcFormat) == isSemiPlanarYUV(dstFormat))))
+         isSemiPlanarYUV(srcFormat) == isSemiPlanarYUV(dstFormat) &&
+         isSwappedChroma(srcFormat) == isSwappedChroma(dstFormat))))
     {
         if (isPacked(c->opts.src_format))
             c->convert_unscaled = packedCopyWrapper;
-- 
2.48.1



More information about the ffmpeg-devel mailing list