mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
swscale: add unscaled packed 16 bit per component endianess conversion
This commit is contained in:
parent
d3b8bde2f1
commit
72cb904453
@ -252,6 +252,27 @@ static void gray8aToPacked24(const uint8_t *src, uint8_t *dst, int num_pixels, c
|
||||
}
|
||||
}
|
||||
|
||||
static int packed_16bpc_bswap(SwsContext *c, const uint8_t* src[],
|
||||
int srcStride[], int srcSliceY, int srcSliceH,
|
||||
uint8_t* dst[], int dstStride[])
|
||||
{
|
||||
int i, j;
|
||||
int srcstr = srcStride[0] >> 1;
|
||||
int dststr = dstStride[0] >> 1;
|
||||
uint16_t *dstPtr = (uint16_t *)dst[0];
|
||||
const uint16_t *srcPtr = (const uint16_t *)src[0];
|
||||
|
||||
for (i = 0; i < srcSliceH; i++) {
|
||||
for (j = 0; j < srcstr; j++) {
|
||||
dstPtr[j] = av_bswap16(srcPtr[j]);
|
||||
}
|
||||
srcPtr += srcstr;
|
||||
dstPtr += dststr;
|
||||
}
|
||||
|
||||
return srcSliceH;
|
||||
}
|
||||
|
||||
static int palToRgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
|
||||
int srcSliceH, uint8_t* dst[], int dstStride[])
|
||||
{
|
||||
@ -697,6 +718,15 @@ void ff_get_unscaled_swscale(SwsContext *c)
|
||||
if (srcFormat==PIX_FMT_BGR24 && (dstFormat==PIX_FMT_YUV420P || dstFormat==PIX_FMT_YUVA420P) && !(flags & SWS_ACCURATE_RND))
|
||||
c->swScale= bgr24ToYv12Wrapper;
|
||||
|
||||
/* bswap 16 bits per component packed formats */
|
||||
if ((srcFormat == PIX_FMT_RGB48LE && dstFormat == PIX_FMT_RGB48BE) ||
|
||||
(srcFormat == PIX_FMT_RGB48BE && dstFormat == PIX_FMT_RGB48LE) ||
|
||||
(srcFormat == PIX_FMT_BGR48LE && dstFormat == PIX_FMT_BGR48BE) ||
|
||||
(srcFormat == PIX_FMT_BGR48BE && dstFormat == PIX_FMT_BGR48LE) ||
|
||||
(srcFormat == PIX_FMT_GRAY16LE && dstFormat == PIX_FMT_GRAY16BE) ||
|
||||
(srcFormat == PIX_FMT_GRAY16BE && dstFormat == PIX_FMT_GRAY16LE))
|
||||
c->swScale = packed_16bpc_bswap;
|
||||
|
||||
/* RGB/BGR -> RGB/BGR (no dither needed forms) */
|
||||
if ( isAnyRGB(srcFormat)
|
||||
&& isAnyRGB(dstFormat)
|
||||
|
Loading…
Reference in New Issue
Block a user