diff mbox series

[FFmpeg-devel,v2] swscale/swscale_unscaled: don't use the optimized bgr24toYV12 unscaled conversion when width%2

Message ID 1622789023-9782-1-git-send-email-lance.lmwang@gmail.com
State Accepted
Commit 43295ae6a9245d8b58c15e5053994c87d95a9689
Headers show
Series [FFmpeg-devel,v2] swscale/swscale_unscaled: don't use the optimized bgr24toYV12 unscaled conversion when width%2 | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Lance Wang June 4, 2021, 6:43 a.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libswscale/swscale_unscaled.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer June 5, 2021, 2:07 p.m. UTC | #1
On Fri, Jun 04, 2021 at 02:43:43PM +0800, lance.lmwang@gmail.com wrote:
> From: Limin Wang <lance.lmwang@gmail.com>
> 
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
>  libswscale/swscale_unscaled.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

LGTM

thx

[...]
diff mbox series

Patch

diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index c4dd8a4..e8e2975 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -1978,6 +1978,7 @@  void ff_get_unscaled_swscale(SwsContext *c)
     const enum AVPixelFormat dstFormat = c->dstFormat;
     const int flags = c->flags;
     const int dstH = c->dstH;
+    const int dstW = c->dstW;
     int needsDither;
 
     needsDither = isAnyRGB(dstFormat) &&
@@ -2033,7 +2034,7 @@  void ff_get_unscaled_swscale(SwsContext *c)
     /* bgr24toYV12 */
     if (srcFormat == AV_PIX_FMT_BGR24 &&
         (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P) &&
-        !(flags & SWS_ACCURATE_RND))
+        !(flags & SWS_ACCURATE_RND) && !(dstW&1))
         c->swscale = bgr24ToYv12Wrapper;
 
     /* RGB/BGR -> RGB/BGR (no dither needed forms) */