mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
lsws/rgb2rgb: Add unscaled 48bit to 64bit rgb conversion.
Based onb4befca2
and6b7849e6
by Paul B Mahol. Fixes ticket #6608.
This commit is contained in:
parent
351e28f9a7
commit
cb1a3eecac
@ -391,3 +391,41 @@ void rgb64to48_ ## need_bswap(const uint8_t *src, \
|
||||
|
||||
DEFINE_RGB64TO48(nobswap, 0)
|
||||
DEFINE_RGB64TO48(bswap, 1)
|
||||
|
||||
#define DEFINE_RGB48TOBGR64(need_bswap, swap) \
|
||||
void rgb48tobgr64_ ## need_bswap(const uint8_t *src, \
|
||||
uint8_t *dst, int src_size) \
|
||||
{ \
|
||||
uint16_t *d = (uint16_t *)dst; \
|
||||
uint16_t *s = (uint16_t *)src; \
|
||||
int i, num_pixels = src_size / 6; \
|
||||
\
|
||||
for (i = 0; i < num_pixels; i++) { \
|
||||
d[4 * i ] = swap ? av_bswap16(s[3 * i + 2]) : s[3 * i + 2]; \
|
||||
d[4 * i + 1] = swap ? av_bswap16(s[3 * i + 1]) : s[3 * i + 1]; \
|
||||
d[4 * i + 2] = swap ? av_bswap16(s[3 * i ]) : s[3 * i ]; \
|
||||
d[4 * i + 3] = 0xFFFF; \
|
||||
} \
|
||||
}
|
||||
|
||||
DEFINE_RGB48TOBGR64(nobswap, 0)
|
||||
DEFINE_RGB48TOBGR64(bswap, 1)
|
||||
|
||||
#define DEFINE_RGB48TO64(need_bswap, swap) \
|
||||
void rgb48to64_ ## need_bswap(const uint8_t *src, \
|
||||
uint8_t *dst, int src_size) \
|
||||
{ \
|
||||
uint16_t *d = (uint16_t *)dst; \
|
||||
uint16_t *s = (uint16_t *)src; \
|
||||
int i, num_pixels = src_size / 6; \
|
||||
\
|
||||
for (i = 0; i < num_pixels; i++) { \
|
||||
d[4 * i ] = swap ? av_bswap16(s[3 * i ]) : s[3 * i ]; \
|
||||
d[4 * i + 1] = swap ? av_bswap16(s[3 * i + 1]) : s[3 * i + 1]; \
|
||||
d[4 * i + 2] = swap ? av_bswap16(s[3 * i + 2]) : s[3 * i + 2]; \
|
||||
d[4 * i + 3] = 0xFFFF; \
|
||||
} \
|
||||
}
|
||||
|
||||
DEFINE_RGB48TO64(nobswap, 0)
|
||||
DEFINE_RGB48TO64(bswap, 1)
|
||||
|
@ -59,6 +59,10 @@ void rgb48tobgr48_nobswap(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
void rgb48tobgr48_bswap(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
void rgb64to48_nobswap(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
void rgb64to48_bswap(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
void rgb48tobgr64_nobswap(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
void rgb48tobgr64_bswap(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
void rgb48to64_nobswap(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
void rgb48to64_bswap(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
void rgb24to32(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
void rgb32to24(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
void rgb16tobgr32(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
|
@ -1292,6 +1292,23 @@ static rgbConvFn findRgbConvFn(SwsContext *c)
|
||||
|| CONV_IS(BGR48LE, RGB48BE)
|
||||
|| CONV_IS(RGB48BE, BGR48LE)
|
||||
|| CONV_IS(BGR48BE, RGB48LE)) conv = rgb48tobgr48_bswap;
|
||||
} else if (isRGB48(srcFormat) && isRGBA64(dstFormat)) {
|
||||
if (CONV_IS(RGB48LE, BGRA64LE)
|
||||
|| CONV_IS(BGR48LE, RGBA64LE)
|
||||
|| CONV_IS(RGB48BE, BGRA64BE)
|
||||
|| CONV_IS(BGR48BE, RGBA64BE)) conv = rgb48tobgr64_nobswap;
|
||||
else if (CONV_IS(RGB48LE, BGRA64BE)
|
||||
|| CONV_IS(BGR48LE, RGBA64BE)
|
||||
|| CONV_IS(RGB48BE, BGRA64LE)
|
||||
|| CONV_IS(BGR48BE, RGBA64LE)) conv = rgb48tobgr64_bswap;
|
||||
if (CONV_IS(RGB48LE, RGBA64LE)
|
||||
|| CONV_IS(BGR48LE, BGRA64LE)
|
||||
|| CONV_IS(RGB48BE, RGBA64BE)
|
||||
|| CONV_IS(BGR48BE, BGRA64BE)) conv = rgb48to64_nobswap;
|
||||
else if (CONV_IS(RGB48LE, RGBA64BE)
|
||||
|| CONV_IS(BGR48LE, BGRA64BE)
|
||||
|| CONV_IS(RGB48BE, RGBA64LE)
|
||||
|| CONV_IS(BGR48BE, BGRA64LE)) conv = rgb48to64_bswap;
|
||||
} else if (isRGBA64(srcFormat) && isRGB48(dstFormat)) {
|
||||
if (CONV_IS(RGBA64LE, BGR48LE)
|
||||
|| CONV_IS(BGRA64LE, RGB48LE)
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#define LIBSWSCALE_VERSION_MAJOR 4
|
||||
#define LIBSWSCALE_VERSION_MINOR 7
|
||||
#define LIBSWSCALE_VERSION_MICRO 102
|
||||
#define LIBSWSCALE_VERSION_MICRO 103
|
||||
|
||||
#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
|
||||
LIBSWSCALE_VERSION_MINOR, \
|
||||
|
Loading…
Reference in New Issue
Block a user