[FFmpeg-cvslog] swscale/swscale: Pass slice location into unscaled code also for dst scaling

Michael Niedermayer git at videolan.org
Sun Oct 3 21:38:51 EEST 2021


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Thu Sep 30 18:21:47 2021 +0200| [f80120756879293b66b5ff3d74b2d3fcb052693a] | committer: Michael Niedermayer

swscale/swscale: Pass slice location into unscaled code also for dst scaling

Fixes: alphablend=checkerboard

Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f80120756879293b66b5ff3d74b2d3fcb052693a
---

 libswscale/swscale.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index c7069ae7b2..75cde31f4f 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -1020,7 +1020,7 @@ static int scale_internal(SwsContext *c,
         int offset  = srcSliceY_internal;
         int slice_h = srcSliceH;
 
-        // for dst slice scaling, offset the src pointers to match the dst slice
+        // for dst slice scaling, offset the pointers to match the unscaled API
         if (scale_dst) {
             av_assert0(offset == 0);
             for (i = 0; i < 4 && src2[i]; i++) {
@@ -1028,12 +1028,20 @@ static int scale_internal(SwsContext *c,
                     break;
                 src2[i] += (dstSliceY >> ((i == 1 || i == 2) ? c->chrSrcVSubSample : 0)) * srcStride2[i];
             }
-            offset  = 0;
+
+            for (i = 0; i < 4 && dst2[i]; i++) {
+                if (!dst2[i] || (i > 0 && usePal(c->dstFormat)))
+                    break;
+                dst2[i] -= (dstSliceY >> ((i == 1 || i == 2) ? c->chrDstVSubSample : 0)) * dstStride2[i];
+            }
+            offset  = dstSliceY;
             slice_h = dstSliceH;
         }
 
         ret = c->convert_unscaled(c, src2, srcStride2, offset, slice_h,
                                   dst2, dstStride2);
+        if (scale_dst)
+            dst2[0] += dstSliceY * dstStride2[0];
     } else {
         ret = swscale(c, src2, srcStride2, srcSliceY_internal, srcSliceH,
                       dst2, dstStride2, dstSliceY, dstSliceH);



More information about the ffmpeg-cvslog mailing list