Commit 2f5bf2f7 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'f84a1b59'

* commit 'f84a1b59':
  swscale: support AV_PIX_FMT_YA16 as input

Conflicts:
	libswscale/swscale_unscaled.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 6017c980 f84a1b59
...@@ -565,6 +565,38 @@ static void bswap16UV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, ...@@ -565,6 +565,38 @@ static void bswap16UV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0,
} }
} }
static void read_ya16le_gray_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
uint32_t *unused)
{
int i;
for (i = 0; i < width; i++)
AV_WN16(dst + i * 2, AV_RL16(src + i * 4));
}
static void read_ya16le_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
uint32_t *unused)
{
int i;
for (i = 0; i < width; i++)
AV_WN16(dst + i * 2, AV_RL16(src + i * 4 + 2));
}
static void read_ya16be_gray_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
uint32_t *unused)
{
int i;
for (i = 0; i < width; i++)
AV_WN16(dst + i * 2, AV_RB16(src + i * 4));
}
static void read_ya16be_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
uint32_t *unused)
{
int i;
for (i = 0; i < width; i++)
AV_WN16(dst + i * 2, AV_RB16(src + i * 4 + 2));
}
/* This is almost identical to the previous, end exists only because /* This is almost identical to the previous, end exists only because
* yuy2ToY/UV)(dst, src + 1, ...) would have 100% unaligned accesses. */ * yuy2ToY/UV)(dst, src + 1, ...) would have 100% unaligned accesses. */
static void uyvyToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, static void uyvyToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
...@@ -1215,6 +1247,14 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) ...@@ -1215,6 +1247,14 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
c->alpToYV12 = bswap16Y_c; c->alpToYV12 = bswap16Y_c;
break; break;
#endif #endif
case AV_PIX_FMT_YA16LE:
c->lumToYV12 = read_ya16le_gray_c;
c->alpToYV12 = read_ya16le_alpha_c;
break;
case AV_PIX_FMT_YA16BE:
c->lumToYV12 = read_ya16be_gray_c;
c->alpToYV12 = read_ya16be_alpha_c;
break;
case AV_PIX_FMT_YUYV422: case AV_PIX_FMT_YUYV422:
case AV_PIX_FMT_YVYU422: case AV_PIX_FMT_YVYU422:
case AV_PIX_FMT_YA8: case AV_PIX_FMT_YA8:
......
...@@ -39,7 +39,9 @@ ...@@ -39,7 +39,9 @@
((x) == AV_PIX_FMT_GRAY8 || \ ((x) == AV_PIX_FMT_GRAY8 || \
(x) == AV_PIX_FMT_YA8 || \ (x) == AV_PIX_FMT_YA8 || \
(x) == AV_PIX_FMT_GRAY16BE || \ (x) == AV_PIX_FMT_GRAY16BE || \
(x) == AV_PIX_FMT_GRAY16LE) (x) == AV_PIX_FMT_GRAY16LE || \
(x) == AV_PIX_FMT_YA16BE || \
(x) == AV_PIX_FMT_YA16LE)
#define hasChroma(x) \ #define hasChroma(x) \
(!(isGray(x) || \ (!(isGray(x) || \
(x) == AV_PIX_FMT_MONOBLACK || \ (x) == AV_PIX_FMT_MONOBLACK || \
......
...@@ -672,7 +672,9 @@ static av_always_inline int isRGB(enum AVPixelFormat pix_fmt) ...@@ -672,7 +672,9 @@ static av_always_inline int isRGB(enum AVPixelFormat pix_fmt)
((x) == AV_PIX_FMT_GRAY8 || \ ((x) == AV_PIX_FMT_GRAY8 || \
(x) == AV_PIX_FMT_YA8 || \ (x) == AV_PIX_FMT_YA8 || \
(x) == AV_PIX_FMT_GRAY16BE || \ (x) == AV_PIX_FMT_GRAY16BE || \
(x) == AV_PIX_FMT_GRAY16LE) (x) == AV_PIX_FMT_GRAY16LE || \
(x) == AV_PIX_FMT_YA16BE || \
(x) == AV_PIX_FMT_YA16LE)
#endif #endif
#define isRGBinInt(x) \ #define isRGBinInt(x) \
......
...@@ -1668,6 +1668,7 @@ void ff_get_unscaled_swscale(SwsContext *c) ...@@ -1668,6 +1668,7 @@ void ff_get_unscaled_swscale(SwsContext *c)
IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR565) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR565) ||
IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGRA64) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGRA64) ||
IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY16) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY16) ||
IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YA16) ||
IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP9) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP9) ||
IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP10) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP10) ||
IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP12) || IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP12) ||
......
...@@ -162,6 +162,8 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = { ...@@ -162,6 +162,8 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = {
[AV_PIX_FMT_BGR444LE] = { 1, 1 }, [AV_PIX_FMT_BGR444LE] = { 1, 1 },
[AV_PIX_FMT_BGR444BE] = { 1, 1 }, [AV_PIX_FMT_BGR444BE] = { 1, 1 },
[AV_PIX_FMT_YA8] = { 1, 0 }, [AV_PIX_FMT_YA8] = { 1, 0 },
[AV_PIX_FMT_YA16BE] = { 1, 0 },
[AV_PIX_FMT_YA16LE] = { 1, 0 },
[AV_PIX_FMT_BGR48BE] = { 1, 1 }, [AV_PIX_FMT_BGR48BE] = { 1, 1 },
[AV_PIX_FMT_BGR48LE] = { 1, 1 }, [AV_PIX_FMT_BGR48LE] = { 1, 1 },
[AV_PIX_FMT_BGRA64BE] = { 1, 1, 1 }, [AV_PIX_FMT_BGRA64BE] = { 1, 1, 1 },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment