[FFmpeg-cvslog] sws: make checking for the start of a new frame more explicit

Anton Khirnov git at videolan.org
Sat Jul 3 17:20:26 EEST 2021


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu May 20 16:57:52 2021 +0200| [1b11a324feb56ec70161f856c5fb103363cff0af] | committer: Anton Khirnov

sws: make checking for the start of a new frame more explicit

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

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

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index dbbb930f9a..0f05ba01f6 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -866,6 +866,7 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
                                   int srcSliceH, uint8_t *const dst[],
                                   const int dstStride[])
 {
+    const int frame_start = !c->sliceDir;
     int i, ret;
     const uint8_t *src2[4];
     uint8_t *dst2[4];
@@ -911,11 +912,11 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
     if (srcSliceH == 0)
         return 0;
 
-    if (c->sliceDir == 0 && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) {
+    if (frame_start && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) {
         av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n");
         return 0;
     }
-    if (c->sliceDir == 0) {
+    if (frame_start) {
         if (srcSliceY == 0) c->sliceDir = 1; else c->sliceDir = -1;
     }
 



More information about the ffmpeg-cvslog mailing list