From: Niklas Haas <g...@haasn.dev> This fixes multiple bugs with semiplanar formats like NV12. Not only do these false positive the grayscale format checks (because dst[2] in NULL), but they also copied an incorrect number of pixels.
Fixes conversions such as nv12 -> nv12, gray8 -> nv12, nv20le -> nv20be, etc. Fixes: ticket #11239 Signed-off-by: Niklas Haas <g...@haasn.dev> Sponsored-by: Sovereign Tech Fund --- libswscale/swscale_unscaled.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 434206996b..ebc0fe33d2 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -2215,10 +2215,12 @@ static int planarCopyWrapper(SwsInternal *c, const uint8_t *const src[], const uint8_t *srcPtr = src[plane]; uint8_t *dstPtr = dst[plane] + dstStride[plane] * y; int shiftonly = plane == 1 || plane == 2 || (!c->opts.src_range && plane == 0); + if (plane == 1 && isSemiPlanarYUV(c->opts.dst_format)) + length *= 2; // ignore palette for GRAY8 - if (plane == 1 && !dst[2]) continue; - if (!src[plane] || (plane == 1 && !src[2])) { + if (plane == 1 && desc_dst->nb_components < 3) continue; + if (!src[plane] || (plane == 1 && desc_src->nb_components < 3)) { if (is16BPS(c->opts.dst_format) || isNBPS(c->opts.dst_format)) { fillPlane16(dst[plane], dstStride[plane], length, height, y, plane == 3, desc_dst->comp[plane].depth, -- 2.47.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".