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.
Unified · Split
| @@ -1378,8 +1378,15 @@ static int planarRgbToplanarRgbWrapper(SwsInternal *c, · 1377 unmodified lines | |||
| 1378 | dst[1], dstStride[1]); | 1378 | dst[1], dstStride[1]); |
| 1379 | ff_copyPlane(src[2], srcStride[2], srcSliceY, srcSliceH, c->opts.src_w, | 1379 | ff_copyPlane(src[2], srcStride[2], srcSliceY, srcSliceH, c->opts.src_w, |
| 1380 | dst[2], dstStride[2]); | 1380 | dst[2], dstStride[2]); |
| 1381 | if (dst[3]) | 1381 | if (dst[3]) { |
| 1382 | fillPlane(dst[3], dstStride[3], c->opts.src_w, srcSliceH, srcSliceY, 255); | 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 | } | ||
| 1383 | 1390 | ||
| 1384 | return srcSliceH; | 1391 | return srcSliceH; |
| 1385 | } | 1392 | } |