Skip to content

Commit d028cf0

Browse files
committed
swscale/swscale_unscaled: fix planarRgbToplanarRgbWrapper() for formats with bpc between 9-14 bits
Currently, planarRgbToplanarRgbWrapper() always sets the alpha value to 255, without taking the bit depth into consideration. This commit restricts the alpha value to the bit depth.
1 parent 748e960 commit d028cf0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

libswscale/swscale_unscaled.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,8 +1378,15 @@ static int planarRgbToplanarRgbWrapper(SwsInternal *c,
13781378
dst[1], dstStride[1]);
13791379
ff_copyPlane(src[2], srcStride[2], srcSliceY, srcSliceH, c->opts.src_w,
13801380
dst[2], dstStride[2]);
1381-
if (dst[3])
1382-
fillPlane(dst[3], dstStride[3], c->opts.src_w, srcSliceH, srcSliceY, 255);
1381+
if (dst[3]) {
1382+
if (is16BPS(c->opts.dst_format) || isNBPS(c->opts.dst_format)) {
1383+
const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(c->opts.dst_format);
1384+
fillPlane16(dst[3], dstStride[3], c->opts.src_w, srcSliceH, srcSliceY, 1,
1385+
desc_dst->comp[3].depth, isBE(c->opts.dst_format));
1386+
} else {
1387+
fillPlane(dst[3], dstStride[3], c->opts.src_w, srcSliceH, srcSliceY, 255);
1388+
}
1389+
}
13831390

13841391
return srcSliceH;
13851392
}

0 commit comments

Comments
 (0)