swscale/swscale_unscaled: don't use the optimized bgr24toYV12 unscaled conversion when width%2

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
This commit is contained in:
Limin Wang 2021-06-04 19:46:39 +08:00
parent 29b244ffc1
commit 43295ae6a9
1 changed files with 2 additions and 1 deletions

View File

@ -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) */