You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
swscale/input: add support for YAF16 and YAF32
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
@@ -1283,6 +1283,28 @@ static av_always_inline void grayf32ToY16_c(uint8_t *_dst, const uint8_t *_src,
|
||||
}
|
||||
}
|
||||
|
||||
static av_always_inline void read_yaf32_gray_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
|
||||
const uint8_t *unused2, int width, int is_be, uint32_t *unused)
|
||||
{
|
||||
int i;
|
||||
const float *src = (const float *)_src;
|
||||
uint16_t *dst = (uint16_t *)_dst;
|
||||
|
||||
for (i = 0; i < width; ++i)
|
||||
dst[i] = lrintf(av_clipf(65535.0f * rdpx(src + i*2), 0.0f, 65535.0f));
|
||||
}
|
||||
|
||||
static av_always_inline void read_yaf32_alpha_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
|
||||
const uint8_t *unused2, int width, int is_be, uint32_t *unused)
|
||||
{
|
||||
int i;
|
||||
const float *src = (const float *)_src;
|
||||
uint16_t *dst = (uint16_t *)_dst;
|
||||
|
||||
for (i = 0; i < width; ++i)
|
||||
dst[i] = lrintf(av_clipf(65535.0f * rdpx(src + i*2 + 1), 0.0f, 65535.0f));
|
||||
}
|
||||
|
||||
#undef rdpx
|
||||
|
||||
#define rgb9plus_planar_funcs_endian(nbits, endian_name, endian) \
|
||||
@@ -1363,6 +1385,18 @@ static void grayf32##endian_name##ToY16_c(uint8_t *dst, const uint8_t *src,
|
||||
int width, uint32_t *unused, void *opq) \
|
||||
{ \
|
||||
grayf32ToY16_c(dst, src, unused1, unused2, width, endian, unused); \
|
||||
} \
|
||||
static void read_yaf32##endian_name##_gray_c(uint8_t *dst, const uint8_t *src, \
|
||||
const uint8_t *unused1, const uint8_t *unused2, \
|
||||
int width, uint32_t *unused, void *opq) \
|
||||
{ \
|
||||
read_yaf32_gray_c(dst, src, unused1, unused2, width, endian, unused); \
|
||||
} \
|
||||
static void read_yaf32##endian_name##_alpha_c(uint8_t *dst, const uint8_t *src, \
|
||||
const uint8_t *unused1, const uint8_t *unused2, \
|
||||
int width, uint32_t *unused, void *opq) \
|
||||
{ \
|
||||
read_yaf32_alpha_c(dst, src, unused1, unused2, width, endian, unused); \
|
||||
}
|
||||
|
||||
rgbf32_funcs_endian(le, 0)
|
||||
@@ -1421,6 +1455,24 @@ static av_always_inline void grayf16ToY16_c(uint8_t *dst, const uint8_t *src, co
|
||||
}
|
||||
}
|
||||
|
||||
static av_always_inline void read_yaf16_gray_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
|
||||
const uint8_t *unused2, int width, int is_be, uint32_t *unused, Half2FloatTables *h2f_tbl)
|
||||
{
|
||||
uint16_t *dst = (uint16_t *)_dst;
|
||||
|
||||
for (int i = 0; i < width; i++)
|
||||
dst[i] = lrintf(av_clipf(65535.0f * rdpx2(src + 4*i), 0.0f, 65535.0f));
|
||||
}
|
||||
|
||||
static av_always_inline void read_yaf16_alpha_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
|
||||
const uint8_t *unused2, int width, int is_be, uint32_t *unused, Half2FloatTables *h2f_tbl)
|
||||
{
|
||||
uint16_t *dst = (uint16_t *)_dst;
|
||||
|
||||
for (int i = 0; i < width; i++)
|
||||
dst[i] = lrintf(av_clipf(65535.0f * rdpx2(src + 4*i + 2), 0.0f, 65535.0f));
|
||||
}
|
||||
|
||||
static av_always_inline void rgbaf16ToUV_half_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
|
||||
const uint16_t *src, int width,
|
||||
int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
|
||||
@@ -1557,6 +1609,19 @@ static void grayf16##endian_name##ToY16_c(uint8_t *dst, const uint8_t *src,
|
||||
{ \
|
||||
grayf16ToY16_c(dst, src, unused1, unused2, width, endian, unused, opq); \
|
||||
} \
|
||||
static void read_yaf16##endian_name##_gray_c(uint8_t *dst, const uint8_t *src, \
|
||||
const uint8_t *unused1, const uint8_t *unused2, \
|
||||
int width, uint32_t *unused, void *opq) \
|
||||
{ \
|
||||
read_yaf16_gray_c(dst, src, unused1, unused2, width, endian, unused, opq); \
|
||||
} \
|
||||
static void read_yaf16##endian_name##_alpha_c(uint8_t *dst, const uint8_t *src, \
|
||||
const uint8_t *unused1, const uint8_t *unused2, \
|
||||
int width, uint32_t *unused, void *opq) \
|
||||
{ \
|
||||
read_yaf16_alpha_c(dst, src, unused1, unused2, width, endian, unused, opq); \
|
||||
} \
|
||||
\
|
||||
static void rgbaf16##endian_name##ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
|
||||
const uint8_t *src1, const uint8_t *src2, \
|
||||
int width, uint32_t *_rgb2yuv, void *opq) \
|
||||
@@ -2244,6 +2309,12 @@ av_cold void ff_sws_init_input_funcs(SwsInternal *c,
|
||||
case AV_PIX_FMT_YA16BE:
|
||||
*lumToYV12 = read_ya16be_gray_c;
|
||||
break;
|
||||
case AV_PIX_FMT_YAF16LE:
|
||||
*lumToYV12 = read_yaf16le_gray_c;
|
||||
break;
|
||||
case AV_PIX_FMT_YAF16BE:
|
||||
*lumToYV12 = read_yaf16be_gray_c;
|
||||
break;
|
||||
case AV_PIX_FMT_VUYA:
|
||||
case AV_PIX_FMT_VUYX:
|
||||
*lumToYV12 = read_vuyx_Y_c;
|
||||
@@ -2400,6 +2471,12 @@ av_cold void ff_sws_init_input_funcs(SwsInternal *c,
|
||||
case AV_PIX_FMT_GRAYF32BE:
|
||||
*lumToYV12 = grayf32beToY16_c;
|
||||
break;
|
||||
case AV_PIX_FMT_YAF32LE:
|
||||
*lumToYV12 = read_yaf32le_gray_c;
|
||||
break;
|
||||
case AV_PIX_FMT_YAF32BE:
|
||||
*lumToYV12 = read_yaf32be_gray_c;
|
||||
break;
|
||||
case AV_PIX_FMT_GRAYF16LE:
|
||||
*lumToYV12 = grayf16leToY16_c;
|
||||
break;
|
||||
@@ -2473,6 +2550,18 @@ av_cold void ff_sws_init_input_funcs(SwsInternal *c,
|
||||
case AV_PIX_FMT_YA16BE:
|
||||
*alpToYV12 = read_ya16be_alpha_c;
|
||||
break;
|
||||
case AV_PIX_FMT_YAF16LE:
|
||||
*alpToYV12 = read_yaf16le_alpha_c;
|
||||
break;
|
||||
case AV_PIX_FMT_YAF16BE:
|
||||
*alpToYV12 = read_yaf16be_alpha_c;
|
||||
break;
|
||||
case AV_PIX_FMT_YAF32LE:
|
||||
*alpToYV12 = read_yaf32le_alpha_c;
|
||||
break;
|
||||
case AV_PIX_FMT_YAF32BE:
|
||||
*alpToYV12 = read_yaf32be_alpha_c;
|
||||
break;
|
||||
case AV_PIX_FMT_VUYA:
|
||||
case AV_PIX_FMT_UYVA:
|
||||
*alpToYV12 = read_vuya_A_c;
|
||||
|
@@ -252,6 +252,10 @@ static const FormatEntry format_entries[] = {
|
||||
[AV_PIX_FMT_GRAYF32BE] = { 1, 1 },
|
||||
[AV_PIX_FMT_GRAYF16LE] = { 1, 0 },
|
||||
[AV_PIX_FMT_GRAYF16BE] = { 1, 0 },
|
||||
[AV_PIX_FMT_YAF32LE] = { 1, 0 },
|
||||
[AV_PIX_FMT_YAF32BE] = { 1, 0 },
|
||||
[AV_PIX_FMT_YAF16LE] = { 1, 0 },
|
||||
[AV_PIX_FMT_YAF16BE] = { 1, 0 },
|
||||
[AV_PIX_FMT_YUVA422P12BE] = { 1, 1 },
|
||||
[AV_PIX_FMT_YUVA422P12LE] = { 1, 1 },
|
||||
[AV_PIX_FMT_YUVA444P12BE] = { 1, 1 },
|
||||
|
@@ -29,7 +29,7 @@
|
||||
#include "version_major.h"
|
||||
|
||||
#define LIBSWSCALE_VERSION_MINOR 13
|
||||
#define LIBSWSCALE_VERSION_MICRO 100
|
||||
#define LIBSWSCALE_VERSION_MICRO 101
|
||||
|
||||
#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
|
||||
LIBSWSCALE_VERSION_MINOR, \
|
||||
|
Reference in New Issue
Block a user