mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-12 10:29:39 +00:00
sws: Fix unscaled >8bit planar chroma handling.
Fixes Ticket840 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
378b7beff5
commit
234405315f
@ -56,6 +56,20 @@ static void fillPlane(uint8_t *plane, int stride, int width, int height, int y,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void fillPlane16(uint8_t *plane, int stride, int width, int height, int y,
|
||||||
|
int alpha, int bits)
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
|
uint8_t *ptr = plane + stride * y;
|
||||||
|
int v = alpha ? -1 : (1<<bits);
|
||||||
|
for (i = 0; i < height; i++) {
|
||||||
|
for (j = 0; j < width; j++) {
|
||||||
|
AV_WN16(ptr+2*j, v);
|
||||||
|
}
|
||||||
|
ptr += stride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void copyPlane(const uint8_t *src, int srcStride,
|
static void copyPlane(const uint8_t *src, int srcStride,
|
||||||
int srcSliceY, int srcSliceH, int width,
|
int srcSliceY, int srcSliceH, int width,
|
||||||
uint8_t *dst, int dstStride)
|
uint8_t *dst, int dstStride)
|
||||||
@ -615,10 +629,13 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t *src[],
|
|||||||
// ignore palette for GRAY8
|
// ignore palette for GRAY8
|
||||||
if (plane == 1 && !dst[2]) continue;
|
if (plane == 1 && !dst[2]) continue;
|
||||||
if (!src[plane] || (plane == 1 && !src[2])) {
|
if (!src[plane] || (plane == 1 && !src[2])) {
|
||||||
if (is16BPS(c->dstFormat))
|
if (is16BPS(c->dstFormat) || isNBPS(c->dstFormat)) {
|
||||||
length *= 2;
|
fillPlane16(dst[plane], dstStride[plane], length, height, y,
|
||||||
fillPlane(dst[plane], dstStride[plane], length, height, y,
|
plane == 3, av_pix_fmt_descriptors[c->dstFormat].comp[plane].depth_minus1);
|
||||||
(plane == 3) ? 255 : 128);
|
} else {
|
||||||
|
fillPlane(dst[plane], dstStride[plane], length, height, y,
|
||||||
|
(plane == 3) ? 255 : 128);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if(isNBPS(c->srcFormat) || isNBPS(c->dstFormat)
|
if(isNBPS(c->srcFormat) || isNBPS(c->dstFormat)
|
||||||
|| (is16BPS(c->srcFormat) != is16BPS(c->dstFormat))
|
|| (is16BPS(c->srcFormat) != is16BPS(c->dstFormat))
|
||||||
|
Loading…
Reference in New Issue
Block a user