[FFmpeg-devel] [PATCH 12/12] swscale/input: parametrize ff_sws_init_input_funcs() pointers
Niklas Haas
ffmpeg at haasn.xyz
Sat Oct 5 22:24:03 EEST 2024
From: Niklas Haas <git at haasn.dev>
Following the precedent set by ff_sws_init_output_funcs().
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git at haasn.dev>
---
libswscale/input.c | 388 +++++++++++++++++-----------------
libswscale/swscale.c | 3 +-
libswscale/swscale_internal.h | 8 +-
3 files changed, 206 insertions(+), 193 deletions(-)
diff --git a/libswscale/input.c b/libswscale/input.c
index d171394bb2..2a7a6c91dd 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -1285,86 +1285,92 @@ static void rgbaf16##endian_name##ToA_c(uint8_t *_dst, const uint8_t *_src, cons
rgbaf16_funcs_endian(le, 0)
rgbaf16_funcs_endian(be, 1)
-av_cold void ff_sws_init_input_funcs(SwsContext *c)
+av_cold void ff_sws_init_input_funcs(SwsContext *c,
+ planar1_YV12_fn *lumToYV12,
+ planar1_YV12_fn *alpToYV12,
+ planar2_YV12_fn *chrToYV12,
+ planarX_YV12_fn *readLumPlanar,
+ planarX_YV12_fn *readAlpPlanar,
+ planarX2_YV12_fn *readChrPlanar)
{
enum AVPixelFormat srcFormat = c->srcFormat;
- c->chrToYV12 = NULL;
+ *chrToYV12 = NULL;
switch (srcFormat) {
case AV_PIX_FMT_YUYV422:
- c->chrToYV12 = yuy2ToUV_c;
+ *chrToYV12 = yuy2ToUV_c;
break;
case AV_PIX_FMT_YVYU422:
- c->chrToYV12 = yvy2ToUV_c;
+ *chrToYV12 = yvy2ToUV_c;
break;
case AV_PIX_FMT_UYVY422:
- c->chrToYV12 = uyvyToUV_c;
+ *chrToYV12 = uyvyToUV_c;
break;
case AV_PIX_FMT_NV12:
case AV_PIX_FMT_NV16:
case AV_PIX_FMT_NV24:
- c->chrToYV12 = nv12ToUV_c;
+ *chrToYV12 = nv12ToUV_c;
break;
case AV_PIX_FMT_NV21:
case AV_PIX_FMT_NV42:
- c->chrToYV12 = nv21ToUV_c;
+ *chrToYV12 = nv21ToUV_c;
break;
case AV_PIX_FMT_RGB8:
case AV_PIX_FMT_BGR8:
case AV_PIX_FMT_PAL8:
case AV_PIX_FMT_BGR4_BYTE:
case AV_PIX_FMT_RGB4_BYTE:
- c->chrToYV12 = palToUV_c;
+ *chrToYV12 = palToUV_c;
break;
case AV_PIX_FMT_GBRP9LE:
- c->readChrPlanar = planar_rgb9le_to_uv;
+ *readChrPlanar = planar_rgb9le_to_uv;
break;
case AV_PIX_FMT_GBRAP10LE:
case AV_PIX_FMT_GBRP10LE:
- c->readChrPlanar = planar_rgb10le_to_uv;
+ *readChrPlanar = planar_rgb10le_to_uv;
break;
case AV_PIX_FMT_GBRAP12LE:
case AV_PIX_FMT_GBRP12LE:
- c->readChrPlanar = planar_rgb12le_to_uv;
+ *readChrPlanar = planar_rgb12le_to_uv;
break;
case AV_PIX_FMT_GBRAP14LE:
case AV_PIX_FMT_GBRP14LE:
- c->readChrPlanar = planar_rgb14le_to_uv;
+ *readChrPlanar = planar_rgb14le_to_uv;
break;
case AV_PIX_FMT_GBRAP16LE:
case AV_PIX_FMT_GBRP16LE:
- c->readChrPlanar = planar_rgb16le_to_uv;
+ *readChrPlanar = planar_rgb16le_to_uv;
break;
case AV_PIX_FMT_GBRAPF32LE:
case AV_PIX_FMT_GBRPF32LE:
- c->readChrPlanar = planar_rgbf32le_to_uv;
+ *readChrPlanar = planar_rgbf32le_to_uv;
break;
case AV_PIX_FMT_GBRP9BE:
- c->readChrPlanar = planar_rgb9be_to_uv;
+ *readChrPlanar = planar_rgb9be_to_uv;
break;
case AV_PIX_FMT_GBRAP10BE:
case AV_PIX_FMT_GBRP10BE:
- c->readChrPlanar = planar_rgb10be_to_uv;
+ *readChrPlanar = planar_rgb10be_to_uv;
break;
case AV_PIX_FMT_GBRAP12BE:
case AV_PIX_FMT_GBRP12BE:
- c->readChrPlanar = planar_rgb12be_to_uv;
+ *readChrPlanar = planar_rgb12be_to_uv;
break;
case AV_PIX_FMT_GBRAP14BE:
case AV_PIX_FMT_GBRP14BE:
- c->readChrPlanar = planar_rgb14be_to_uv;
+ *readChrPlanar = planar_rgb14be_to_uv;
break;
case AV_PIX_FMT_GBRAP16BE:
case AV_PIX_FMT_GBRP16BE:
- c->readChrPlanar = planar_rgb16be_to_uv;
+ *readChrPlanar = planar_rgb16be_to_uv;
break;
case AV_PIX_FMT_GBRAPF32BE:
case AV_PIX_FMT_GBRPF32BE:
- c->readChrPlanar = planar_rgbf32be_to_uv;
+ *readChrPlanar = planar_rgbf32be_to_uv;
break;
case AV_PIX_FMT_GBRAP:
case AV_PIX_FMT_GBRP:
- c->readChrPlanar = planar_rgb_to_uv;
+ *readChrPlanar = planar_rgb_to_uv;
break;
#if HAVE_BIGENDIAN
case AV_PIX_FMT_YUV420P9LE:
@@ -1396,7 +1402,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
case AV_PIX_FMT_YUVA420P16LE:
case AV_PIX_FMT_YUVA422P16LE:
case AV_PIX_FMT_YUVA444P16LE:
- c->chrToYV12 = bswap16UV_c;
+ *chrToYV12 = bswap16UV_c;
break;
#else
case AV_PIX_FMT_YUV420P9BE:
@@ -1428,314 +1434,314 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
case AV_PIX_FMT_YUVA420P16BE:
case AV_PIX_FMT_YUVA422P16BE:
case AV_PIX_FMT_YUVA444P16BE:
- c->chrToYV12 = bswap16UV_c;
+ *chrToYV12 = bswap16UV_c;
break;
#endif
case AV_PIX_FMT_VUYA:
case AV_PIX_FMT_VUYX:
- c->chrToYV12 = read_vuyx_UV_c;
+ *chrToYV12 = read_vuyx_UV_c;
break;
case AV_PIX_FMT_XV30LE:
- c->chrToYV12 = read_xv30le_UV_c;
+ *chrToYV12 = read_xv30le_UV_c;
break;
case AV_PIX_FMT_AYUV64LE:
- c->chrToYV12 = read_ayuv64le_UV_c;
+ *chrToYV12 = read_ayuv64le_UV_c;
break;
case AV_PIX_FMT_XV36LE:
- c->chrToYV12 = read_xv36le_UV_c;
+ *chrToYV12 = read_xv36le_UV_c;
break;
case AV_PIX_FMT_P010LE:
case AV_PIX_FMT_P210LE:
case AV_PIX_FMT_P410LE:
- c->chrToYV12 = p010LEToUV_c;
+ *chrToYV12 = p010LEToUV_c;
break;
case AV_PIX_FMT_P010BE:
case AV_PIX_FMT_P210BE:
case AV_PIX_FMT_P410BE:
- c->chrToYV12 = p010BEToUV_c;
+ *chrToYV12 = p010BEToUV_c;
break;
case AV_PIX_FMT_P012LE:
case AV_PIX_FMT_P212LE:
case AV_PIX_FMT_P412LE:
- c->chrToYV12 = p012LEToUV_c;
+ *chrToYV12 = p012LEToUV_c;
break;
case AV_PIX_FMT_P012BE:
case AV_PIX_FMT_P212BE:
case AV_PIX_FMT_P412BE:
- c->chrToYV12 = p012BEToUV_c;
+ *chrToYV12 = p012BEToUV_c;
break;
case AV_PIX_FMT_P016LE:
case AV_PIX_FMT_P216LE:
case AV_PIX_FMT_P416LE:
- c->chrToYV12 = p016LEToUV_c;
+ *chrToYV12 = p016LEToUV_c;
break;
case AV_PIX_FMT_P016BE:
case AV_PIX_FMT_P216BE:
case AV_PIX_FMT_P416BE:
- c->chrToYV12 = p016BEToUV_c;
+ *chrToYV12 = p016BEToUV_c;
break;
case AV_PIX_FMT_Y210LE:
- c->chrToYV12 = y210le_UV_c;
+ *chrToYV12 = y210le_UV_c;
break;
case AV_PIX_FMT_Y212LE:
- c->chrToYV12 = y212le_UV_c;
+ *chrToYV12 = y212le_UV_c;
break;
}
if (c->chrSrcHSubSample) {
switch (srcFormat) {
case AV_PIX_FMT_RGBA64BE:
- c->chrToYV12 = rgb64BEToUV_half_c;
+ *chrToYV12 = rgb64BEToUV_half_c;
break;
case AV_PIX_FMT_RGBA64LE:
- c->chrToYV12 = rgb64LEToUV_half_c;
+ *chrToYV12 = rgb64LEToUV_half_c;
break;
case AV_PIX_FMT_BGRA64BE:
- c->chrToYV12 = bgr64BEToUV_half_c;
+ *chrToYV12 = bgr64BEToUV_half_c;
break;
case AV_PIX_FMT_BGRA64LE:
- c->chrToYV12 = bgr64LEToUV_half_c;
+ *chrToYV12 = bgr64LEToUV_half_c;
break;
case AV_PIX_FMT_RGB48BE:
- c->chrToYV12 = rgb48BEToUV_half_c;
+ *chrToYV12 = rgb48BEToUV_half_c;
break;
case AV_PIX_FMT_RGB48LE:
- c->chrToYV12 = rgb48LEToUV_half_c;
+ *chrToYV12 = rgb48LEToUV_half_c;
break;
case AV_PIX_FMT_BGR48BE:
- c->chrToYV12 = bgr48BEToUV_half_c;
+ *chrToYV12 = bgr48BEToUV_half_c;
break;
case AV_PIX_FMT_BGR48LE:
- c->chrToYV12 = bgr48LEToUV_half_c;
+ *chrToYV12 = bgr48LEToUV_half_c;
break;
case AV_PIX_FMT_RGB32:
- c->chrToYV12 = bgr32ToUV_half_c;
+ *chrToYV12 = bgr32ToUV_half_c;
break;
case AV_PIX_FMT_RGB32_1:
- c->chrToYV12 = bgr321ToUV_half_c;
+ *chrToYV12 = bgr321ToUV_half_c;
break;
case AV_PIX_FMT_BGR24:
- c->chrToYV12 = bgr24ToUV_half_c;
+ *chrToYV12 = bgr24ToUV_half_c;
break;
case AV_PIX_FMT_BGR565LE:
- c->chrToYV12 = bgr16leToUV_half_c;
+ *chrToYV12 = bgr16leToUV_half_c;
break;
case AV_PIX_FMT_BGR565BE:
- c->chrToYV12 = bgr16beToUV_half_c;
+ *chrToYV12 = bgr16beToUV_half_c;
break;
case AV_PIX_FMT_BGR555LE:
- c->chrToYV12 = bgr15leToUV_half_c;
+ *chrToYV12 = bgr15leToUV_half_c;
break;
case AV_PIX_FMT_BGR555BE:
- c->chrToYV12 = bgr15beToUV_half_c;
+ *chrToYV12 = bgr15beToUV_half_c;
break;
case AV_PIX_FMT_GBRAP:
case AV_PIX_FMT_GBRP:
- c->chrToYV12 = gbr24pToUV_half_c;
+ *chrToYV12 = gbr24pToUV_half_c;
break;
case AV_PIX_FMT_BGR444LE:
- c->chrToYV12 = bgr12leToUV_half_c;
+ *chrToYV12 = bgr12leToUV_half_c;
break;
case AV_PIX_FMT_BGR444BE:
- c->chrToYV12 = bgr12beToUV_half_c;
+ *chrToYV12 = bgr12beToUV_half_c;
break;
case AV_PIX_FMT_BGR32:
- c->chrToYV12 = rgb32ToUV_half_c;
+ *chrToYV12 = rgb32ToUV_half_c;
break;
case AV_PIX_FMT_BGR32_1:
- c->chrToYV12 = rgb321ToUV_half_c;
+ *chrToYV12 = rgb321ToUV_half_c;
break;
case AV_PIX_FMT_RGB24:
- c->chrToYV12 = rgb24ToUV_half_c;
+ *chrToYV12 = rgb24ToUV_half_c;
break;
case AV_PIX_FMT_RGB565LE:
- c->chrToYV12 = rgb16leToUV_half_c;
+ *chrToYV12 = rgb16leToUV_half_c;
break;
case AV_PIX_FMT_RGB565BE:
- c->chrToYV12 = rgb16beToUV_half_c;
+ *chrToYV12 = rgb16beToUV_half_c;
break;
case AV_PIX_FMT_RGB555LE:
- c->chrToYV12 = rgb15leToUV_half_c;
+ *chrToYV12 = rgb15leToUV_half_c;
break;
case AV_PIX_FMT_RGB555BE:
- c->chrToYV12 = rgb15beToUV_half_c;
+ *chrToYV12 = rgb15beToUV_half_c;
break;
case AV_PIX_FMT_RGB444LE:
- c->chrToYV12 = rgb12leToUV_half_c;
+ *chrToYV12 = rgb12leToUV_half_c;
break;
case AV_PIX_FMT_RGB444BE:
- c->chrToYV12 = rgb12beToUV_half_c;
+ *chrToYV12 = rgb12beToUV_half_c;
break;
case AV_PIX_FMT_X2RGB10LE:
- c->chrToYV12 = rgb30leToUV_half_c;
+ *chrToYV12 = rgb30leToUV_half_c;
break;
case AV_PIX_FMT_X2BGR10LE:
- c->chrToYV12 = bgr30leToUV_half_c;
+ *chrToYV12 = bgr30leToUV_half_c;
break;
case AV_PIX_FMT_RGBAF16BE:
- c->chrToYV12 = rgbaf16beToUV_half_c;
+ *chrToYV12 = rgbaf16beToUV_half_c;
break;
case AV_PIX_FMT_RGBAF16LE:
- c->chrToYV12 = rgbaf16leToUV_half_c;
+ *chrToYV12 = rgbaf16leToUV_half_c;
break;
}
} else {
switch (srcFormat) {
case AV_PIX_FMT_RGBA64BE:
- c->chrToYV12 = rgb64BEToUV_c;
+ *chrToYV12 = rgb64BEToUV_c;
break;
case AV_PIX_FMT_RGBA64LE:
- c->chrToYV12 = rgb64LEToUV_c;
+ *chrToYV12 = rgb64LEToUV_c;
break;
case AV_PIX_FMT_BGRA64BE:
- c->chrToYV12 = bgr64BEToUV_c;
+ *chrToYV12 = bgr64BEToUV_c;
break;
case AV_PIX_FMT_BGRA64LE:
- c->chrToYV12 = bgr64LEToUV_c;
+ *chrToYV12 = bgr64LEToUV_c;
break;
case AV_PIX_FMT_RGB48BE:
- c->chrToYV12 = rgb48BEToUV_c;
+ *chrToYV12 = rgb48BEToUV_c;
break;
case AV_PIX_FMT_RGB48LE:
- c->chrToYV12 = rgb48LEToUV_c;
+ *chrToYV12 = rgb48LEToUV_c;
break;
case AV_PIX_FMT_BGR48BE:
- c->chrToYV12 = bgr48BEToUV_c;
+ *chrToYV12 = bgr48BEToUV_c;
break;
case AV_PIX_FMT_BGR48LE:
- c->chrToYV12 = bgr48LEToUV_c;
+ *chrToYV12 = bgr48LEToUV_c;
break;
case AV_PIX_FMT_RGB32:
- c->chrToYV12 = bgr32ToUV_c;
+ *chrToYV12 = bgr32ToUV_c;
break;
case AV_PIX_FMT_RGB32_1:
- c->chrToYV12 = bgr321ToUV_c;
+ *chrToYV12 = bgr321ToUV_c;
break;
case AV_PIX_FMT_BGR24:
- c->chrToYV12 = bgr24ToUV_c;
+ *chrToYV12 = bgr24ToUV_c;
break;
case AV_PIX_FMT_BGR565LE:
- c->chrToYV12 = bgr16leToUV_c;
+ *chrToYV12 = bgr16leToUV_c;
break;
case AV_PIX_FMT_BGR565BE:
- c->chrToYV12 = bgr16beToUV_c;
+ *chrToYV12 = bgr16beToUV_c;
break;
case AV_PIX_FMT_BGR555LE:
- c->chrToYV12 = bgr15leToUV_c;
+ *chrToYV12 = bgr15leToUV_c;
break;
case AV_PIX_FMT_BGR555BE:
- c->chrToYV12 = bgr15beToUV_c;
+ *chrToYV12 = bgr15beToUV_c;
break;
case AV_PIX_FMT_BGR444LE:
- c->chrToYV12 = bgr12leToUV_c;
+ *chrToYV12 = bgr12leToUV_c;
break;
case AV_PIX_FMT_BGR444BE:
- c->chrToYV12 = bgr12beToUV_c;
+ *chrToYV12 = bgr12beToUV_c;
break;
case AV_PIX_FMT_BGR32:
- c->chrToYV12 = rgb32ToUV_c;
+ *chrToYV12 = rgb32ToUV_c;
break;
case AV_PIX_FMT_BGR32_1:
- c->chrToYV12 = rgb321ToUV_c;
+ *chrToYV12 = rgb321ToUV_c;
break;
case AV_PIX_FMT_RGB24:
- c->chrToYV12 = rgb24ToUV_c;
+ *chrToYV12 = rgb24ToUV_c;
break;
case AV_PIX_FMT_RGB565LE:
- c->chrToYV12 = rgb16leToUV_c;
+ *chrToYV12 = rgb16leToUV_c;
break;
case AV_PIX_FMT_RGB565BE:
- c->chrToYV12 = rgb16beToUV_c;
+ *chrToYV12 = rgb16beToUV_c;
break;
case AV_PIX_FMT_RGB555LE:
- c->chrToYV12 = rgb15leToUV_c;
+ *chrToYV12 = rgb15leToUV_c;
break;
case AV_PIX_FMT_RGB555BE:
- c->chrToYV12 = rgb15beToUV_c;
+ *chrToYV12 = rgb15beToUV_c;
break;
case AV_PIX_FMT_RGB444LE:
- c->chrToYV12 = rgb12leToUV_c;
+ *chrToYV12 = rgb12leToUV_c;
break;
case AV_PIX_FMT_RGB444BE:
- c->chrToYV12 = rgb12beToUV_c;
+ *chrToYV12 = rgb12beToUV_c;
break;
case AV_PIX_FMT_X2RGB10LE:
- c->chrToYV12 = rgb30leToUV_c;
+ *chrToYV12 = rgb30leToUV_c;
break;
case AV_PIX_FMT_X2BGR10LE:
- c->chrToYV12 = bgr30leToUV_c;
+ *chrToYV12 = bgr30leToUV_c;
break;
case AV_PIX_FMT_RGBAF16BE:
- c->chrToYV12 = rgbaf16beToUV_c;
+ *chrToYV12 = rgbaf16beToUV_c;
break;
case AV_PIX_FMT_RGBAF16LE:
- c->chrToYV12 = rgbaf16leToUV_c;
+ *chrToYV12 = rgbaf16leToUV_c;
break;
}
}
- c->lumToYV12 = NULL;
- c->alpToYV12 = NULL;
+ *lumToYV12 = NULL;
+ *alpToYV12 = NULL;
switch (srcFormat) {
case AV_PIX_FMT_GBRP9LE:
- c->readLumPlanar = planar_rgb9le_to_y;
+ *readLumPlanar = planar_rgb9le_to_y;
break;
case AV_PIX_FMT_GBRAP10LE:
- c->readAlpPlanar = planar_rgb10le_to_a;
+ *readAlpPlanar = planar_rgb10le_to_a;
case AV_PIX_FMT_GBRP10LE:
- c->readLumPlanar = planar_rgb10le_to_y;
+ *readLumPlanar = planar_rgb10le_to_y;
break;
case AV_PIX_FMT_GBRAP12LE:
- c->readAlpPlanar = planar_rgb12le_to_a;
+ *readAlpPlanar = planar_rgb12le_to_a;
case AV_PIX_FMT_GBRP12LE:
- c->readLumPlanar = planar_rgb12le_to_y;
+ *readLumPlanar = planar_rgb12le_to_y;
break;
case AV_PIX_FMT_GBRAP14LE:
- c->readAlpPlanar = planar_rgb14le_to_a;
+ *readAlpPlanar = planar_rgb14le_to_a;
case AV_PIX_FMT_GBRP14LE:
- c->readLumPlanar = planar_rgb14le_to_y;
+ *readLumPlanar = planar_rgb14le_to_y;
break;
case AV_PIX_FMT_GBRAP16LE:
- c->readAlpPlanar = planar_rgb16le_to_a;
+ *readAlpPlanar = planar_rgb16le_to_a;
case AV_PIX_FMT_GBRP16LE:
- c->readLumPlanar = planar_rgb16le_to_y;
+ *readLumPlanar = planar_rgb16le_to_y;
break;
case AV_PIX_FMT_GBRAPF32LE:
- c->readAlpPlanar = planar_rgbf32le_to_a;
+ *readAlpPlanar = planar_rgbf32le_to_a;
case AV_PIX_FMT_GBRPF32LE:
- c->readLumPlanar = planar_rgbf32le_to_y;
+ *readLumPlanar = planar_rgbf32le_to_y;
break;
case AV_PIX_FMT_GBRP9BE:
- c->readLumPlanar = planar_rgb9be_to_y;
+ *readLumPlanar = planar_rgb9be_to_y;
break;
case AV_PIX_FMT_GBRAP10BE:
- c->readAlpPlanar = planar_rgb10be_to_a;
+ *readAlpPlanar = planar_rgb10be_to_a;
case AV_PIX_FMT_GBRP10BE:
- c->readLumPlanar = planar_rgb10be_to_y;
+ *readLumPlanar = planar_rgb10be_to_y;
break;
case AV_PIX_FMT_GBRAP12BE:
- c->readAlpPlanar = planar_rgb12be_to_a;
+ *readAlpPlanar = planar_rgb12be_to_a;
case AV_PIX_FMT_GBRP12BE:
- c->readLumPlanar = planar_rgb12be_to_y;
+ *readLumPlanar = planar_rgb12be_to_y;
break;
case AV_PIX_FMT_GBRAP14BE:
- c->readAlpPlanar = planar_rgb14be_to_a;
+ *readAlpPlanar = planar_rgb14be_to_a;
case AV_PIX_FMT_GBRP14BE:
- c->readLumPlanar = planar_rgb14be_to_y;
+ *readLumPlanar = planar_rgb14be_to_y;
break;
case AV_PIX_FMT_GBRAP16BE:
- c->readAlpPlanar = planar_rgb16be_to_a;
+ *readAlpPlanar = planar_rgb16be_to_a;
case AV_PIX_FMT_GBRP16BE:
- c->readLumPlanar = planar_rgb16be_to_y;
+ *readLumPlanar = planar_rgb16be_to_y;
break;
case AV_PIX_FMT_GBRAPF32BE:
- c->readAlpPlanar = planar_rgbf32be_to_a;
+ *readAlpPlanar = planar_rgbf32be_to_a;
case AV_PIX_FMT_GBRPF32BE:
- c->readLumPlanar = planar_rgbf32be_to_y;
+ *readLumPlanar = planar_rgbf32be_to_y;
break;
case AV_PIX_FMT_GBRAP:
- c->readAlpPlanar = planar_rgb_to_a;
+ *readAlpPlanar = planar_rgb_to_a;
case AV_PIX_FMT_GBRP:
- c->readLumPlanar = planar_rgb_to_y;
+ *readLumPlanar = planar_rgb_to_y;
break;
#if HAVE_BIGENDIAN
case AV_PIX_FMT_YUV420P9LE:
@@ -1765,7 +1771,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
case AV_PIX_FMT_P016LE:
case AV_PIX_FMT_P216LE:
case AV_PIX_FMT_P416LE:
- c->lumToYV12 = bswap16Y_c;
+ *lumToYV12 = bswap16Y_c;
break;
case AV_PIX_FMT_YUVA420P9LE:
case AV_PIX_FMT_YUVA422P9LE:
@@ -1778,8 +1784,8 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
case AV_PIX_FMT_YUVA420P16LE:
case AV_PIX_FMT_YUVA422P16LE:
case AV_PIX_FMT_YUVA444P16LE:
- c->lumToYV12 = bswap16Y_c;
- c->alpToYV12 = bswap16Y_c;
+ *lumToYV12 = bswap16Y_c;
+ *alpToYV12 = bswap16Y_c;
break;
#else
case AV_PIX_FMT_YUV420P9BE:
@@ -1809,7 +1815,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
case AV_PIX_FMT_P016BE:
case AV_PIX_FMT_P216BE:
case AV_PIX_FMT_P416BE:
- c->lumToYV12 = bswap16Y_c;
+ *lumToYV12 = bswap16Y_c;
break;
case AV_PIX_FMT_YUVA420P9BE:
case AV_PIX_FMT_YUVA422P9BE:
@@ -1822,214 +1828,214 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
case AV_PIX_FMT_YUVA420P16BE:
case AV_PIX_FMT_YUVA422P16BE:
case AV_PIX_FMT_YUVA444P16BE:
- c->lumToYV12 = bswap16Y_c;
- c->alpToYV12 = bswap16Y_c;
+ *lumToYV12 = bswap16Y_c;
+ *alpToYV12 = bswap16Y_c;
break;
#endif
case AV_PIX_FMT_YA16LE:
- c->lumToYV12 = read_ya16le_gray_c;
+ *lumToYV12 = read_ya16le_gray_c;
break;
case AV_PIX_FMT_YA16BE:
- c->lumToYV12 = read_ya16be_gray_c;
+ *lumToYV12 = read_ya16be_gray_c;
break;
case AV_PIX_FMT_VUYA:
case AV_PIX_FMT_VUYX:
- c->lumToYV12 = read_vuyx_Y_c;
+ *lumToYV12 = read_vuyx_Y_c;
break;
case AV_PIX_FMT_XV30LE:
- c->lumToYV12 = read_xv30le_Y_c;
+ *lumToYV12 = read_xv30le_Y_c;
break;
case AV_PIX_FMT_AYUV64LE:
- c->lumToYV12 = read_ayuv64le_Y_c;
+ *lumToYV12 = read_ayuv64le_Y_c;
break;
case AV_PIX_FMT_XV36LE:
- c->lumToYV12 = read_xv36le_Y_c;
+ *lumToYV12 = read_xv36le_Y_c;
break;
case AV_PIX_FMT_YUYV422:
case AV_PIX_FMT_YVYU422:
case AV_PIX_FMT_YA8:
- c->lumToYV12 = yuy2ToY_c;
+ *lumToYV12 = yuy2ToY_c;
break;
case AV_PIX_FMT_UYVY422:
- c->lumToYV12 = uyvyToY_c;
+ *lumToYV12 = uyvyToY_c;
break;
case AV_PIX_FMT_BGR24:
- c->lumToYV12 = bgr24ToY_c;
+ *lumToYV12 = bgr24ToY_c;
break;
case AV_PIX_FMT_BGR565LE:
- c->lumToYV12 = bgr16leToY_c;
+ *lumToYV12 = bgr16leToY_c;
break;
case AV_PIX_FMT_BGR565BE:
- c->lumToYV12 = bgr16beToY_c;
+ *lumToYV12 = bgr16beToY_c;
break;
case AV_PIX_FMT_BGR555LE:
- c->lumToYV12 = bgr15leToY_c;
+ *lumToYV12 = bgr15leToY_c;
break;
case AV_PIX_FMT_BGR555BE:
- c->lumToYV12 = bgr15beToY_c;
+ *lumToYV12 = bgr15beToY_c;
break;
case AV_PIX_FMT_BGR444LE:
- c->lumToYV12 = bgr12leToY_c;
+ *lumToYV12 = bgr12leToY_c;
break;
case AV_PIX_FMT_BGR444BE:
- c->lumToYV12 = bgr12beToY_c;
+ *lumToYV12 = bgr12beToY_c;
break;
case AV_PIX_FMT_RGB24:
- c->lumToYV12 = rgb24ToY_c;
+ *lumToYV12 = rgb24ToY_c;
break;
case AV_PIX_FMT_RGB565LE:
- c->lumToYV12 = rgb16leToY_c;
+ *lumToYV12 = rgb16leToY_c;
break;
case AV_PIX_FMT_RGB565BE:
- c->lumToYV12 = rgb16beToY_c;
+ *lumToYV12 = rgb16beToY_c;
break;
case AV_PIX_FMT_RGB555LE:
- c->lumToYV12 = rgb15leToY_c;
+ *lumToYV12 = rgb15leToY_c;
break;
case AV_PIX_FMT_RGB555BE:
- c->lumToYV12 = rgb15beToY_c;
+ *lumToYV12 = rgb15beToY_c;
break;
case AV_PIX_FMT_RGB444LE:
- c->lumToYV12 = rgb12leToY_c;
+ *lumToYV12 = rgb12leToY_c;
break;
case AV_PIX_FMT_RGB444BE:
- c->lumToYV12 = rgb12beToY_c;
+ *lumToYV12 = rgb12beToY_c;
break;
case AV_PIX_FMT_RGB8:
case AV_PIX_FMT_BGR8:
case AV_PIX_FMT_PAL8:
case AV_PIX_FMT_BGR4_BYTE:
case AV_PIX_FMT_RGB4_BYTE:
- c->lumToYV12 = palToY_c;
+ *lumToYV12 = palToY_c;
break;
case AV_PIX_FMT_MONOBLACK:
- c->lumToYV12 = monoblack2Y_c;
+ *lumToYV12 = monoblack2Y_c;
break;
case AV_PIX_FMT_MONOWHITE:
- c->lumToYV12 = monowhite2Y_c;
+ *lumToYV12 = monowhite2Y_c;
break;
case AV_PIX_FMT_RGB32:
- c->lumToYV12 = bgr32ToY_c;
+ *lumToYV12 = bgr32ToY_c;
break;
case AV_PIX_FMT_RGB32_1:
- c->lumToYV12 = bgr321ToY_c;
+ *lumToYV12 = bgr321ToY_c;
break;
case AV_PIX_FMT_BGR32:
- c->lumToYV12 = rgb32ToY_c;
+ *lumToYV12 = rgb32ToY_c;
break;
case AV_PIX_FMT_BGR32_1:
- c->lumToYV12 = rgb321ToY_c;
+ *lumToYV12 = rgb321ToY_c;
break;
case AV_PIX_FMT_RGB48BE:
- c->lumToYV12 = rgb48BEToY_c;
+ *lumToYV12 = rgb48BEToY_c;
break;
case AV_PIX_FMT_RGB48LE:
- c->lumToYV12 = rgb48LEToY_c;
+ *lumToYV12 = rgb48LEToY_c;
break;
case AV_PIX_FMT_BGR48BE:
- c->lumToYV12 = bgr48BEToY_c;
+ *lumToYV12 = bgr48BEToY_c;
break;
case AV_PIX_FMT_BGR48LE:
- c->lumToYV12 = bgr48LEToY_c;
+ *lumToYV12 = bgr48LEToY_c;
break;
case AV_PIX_FMT_RGBA64BE:
- c->lumToYV12 = rgb64BEToY_c;
+ *lumToYV12 = rgb64BEToY_c;
break;
case AV_PIX_FMT_RGBA64LE:
- c->lumToYV12 = rgb64LEToY_c;
+ *lumToYV12 = rgb64LEToY_c;
break;
case AV_PIX_FMT_BGRA64BE:
- c->lumToYV12 = bgr64BEToY_c;
+ *lumToYV12 = bgr64BEToY_c;
break;
case AV_PIX_FMT_BGRA64LE:
- c->lumToYV12 = bgr64LEToY_c;
+ *lumToYV12 = bgr64LEToY_c;
break;
case AV_PIX_FMT_P010LE:
case AV_PIX_FMT_P210LE:
case AV_PIX_FMT_P410LE:
- c->lumToYV12 = p010LEToY_c;
+ *lumToYV12 = p010LEToY_c;
break;
case AV_PIX_FMT_P010BE:
case AV_PIX_FMT_P210BE:
case AV_PIX_FMT_P410BE:
- c->lumToYV12 = p010BEToY_c;
+ *lumToYV12 = p010BEToY_c;
break;
case AV_PIX_FMT_P012LE:
case AV_PIX_FMT_P212LE:
case AV_PIX_FMT_P412LE:
- c->lumToYV12 = p012LEToY_c;
+ *lumToYV12 = p012LEToY_c;
break;
case AV_PIX_FMT_P012BE:
case AV_PIX_FMT_P212BE:
case AV_PIX_FMT_P412BE:
- c->lumToYV12 = p012BEToY_c;
+ *lumToYV12 = p012BEToY_c;
break;
case AV_PIX_FMT_GRAYF32LE:
- c->lumToYV12 = grayf32leToY16_c;
+ *lumToYV12 = grayf32leToY16_c;
break;
case AV_PIX_FMT_GRAYF32BE:
- c->lumToYV12 = grayf32beToY16_c;
+ *lumToYV12 = grayf32beToY16_c;
break;
case AV_PIX_FMT_Y210LE:
- c->lumToYV12 = y210le_Y_c;
+ *lumToYV12 = y210le_Y_c;
break;
case AV_PIX_FMT_Y212LE:
- c->lumToYV12 = y212le_Y_c;
+ *lumToYV12 = y212le_Y_c;
break;
case AV_PIX_FMT_X2RGB10LE:
- c->lumToYV12 = rgb30leToY_c;
+ *lumToYV12 = rgb30leToY_c;
break;
case AV_PIX_FMT_X2BGR10LE:
- c->lumToYV12 = bgr30leToY_c;
+ *lumToYV12 = bgr30leToY_c;
break;
case AV_PIX_FMT_RGBAF16BE:
- c->lumToYV12 = rgbaf16beToY_c;
+ *lumToYV12 = rgbaf16beToY_c;
break;
case AV_PIX_FMT_RGBAF16LE:
- c->lumToYV12 = rgbaf16leToY_c;
+ *lumToYV12 = rgbaf16leToY_c;
break;
}
if (c->needAlpha) {
if (is16BPS(srcFormat) || isNBPS(srcFormat)) {
- if (HAVE_BIGENDIAN == !isBE(srcFormat) && !c->readAlpPlanar)
- c->alpToYV12 = bswap16Y_c;
+ if (HAVE_BIGENDIAN == !isBE(srcFormat) && !*readAlpPlanar)
+ *alpToYV12 = bswap16Y_c;
}
switch (srcFormat) {
case AV_PIX_FMT_BGRA64LE:
- case AV_PIX_FMT_RGBA64LE: c->alpToYV12 = rgba64leToA_c; break;
+ case AV_PIX_FMT_RGBA64LE: *alpToYV12 = rgba64leToA_c; break;
case AV_PIX_FMT_BGRA64BE:
- case AV_PIX_FMT_RGBA64BE: c->alpToYV12 = rgba64beToA_c; break;
+ case AV_PIX_FMT_RGBA64BE: *alpToYV12 = rgba64beToA_c; break;
case AV_PIX_FMT_BGRA:
case AV_PIX_FMT_RGBA:
- c->alpToYV12 = rgbaToA_c;
+ *alpToYV12 = rgbaToA_c;
break;
case AV_PIX_FMT_ABGR:
case AV_PIX_FMT_ARGB:
- c->alpToYV12 = abgrToA_c;
+ *alpToYV12 = abgrToA_c;
break;
case AV_PIX_FMT_RGBAF16BE:
- c->alpToYV12 = rgbaf16beToA_c;
+ *alpToYV12 = rgbaf16beToA_c;
break;
case AV_PIX_FMT_RGBAF16LE:
- c->alpToYV12 = rgbaf16leToA_c;
+ *alpToYV12 = rgbaf16leToA_c;
break;
case AV_PIX_FMT_YA8:
- c->alpToYV12 = uyvyToY_c;
+ *alpToYV12 = uyvyToY_c;
break;
case AV_PIX_FMT_YA16LE:
- c->alpToYV12 = read_ya16le_alpha_c;
+ *alpToYV12 = read_ya16le_alpha_c;
break;
case AV_PIX_FMT_YA16BE:
- c->alpToYV12 = read_ya16be_alpha_c;
+ *alpToYV12 = read_ya16be_alpha_c;
break;
case AV_PIX_FMT_VUYA:
- c->alpToYV12 = read_vuya_A_c;
+ *alpToYV12 = read_vuya_A_c;
break;
case AV_PIX_FMT_AYUV64LE:
- c->alpToYV12 = read_ayuv64le_A_c;
+ *alpToYV12 = read_ayuv64le_A_c;
break;
case AV_PIX_FMT_PAL8 :
- c->alpToYV12 = palToA_c;
+ *alpToYV12 = palToA_c;
break;
}
}
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index fa7f220f0b..f4dcbc192e 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -563,7 +563,8 @@ static av_cold void sws_init_swscale(SwsContext *c)
&c->yuv2nv12cX, &c->yuv2packed1,
&c->yuv2packed2, &c->yuv2packedX, &c->yuv2anyX);
- ff_sws_init_input_funcs(c);
+ ff_sws_init_input_funcs(c, &c->lumToYV12, &c->alpToYV12, &c->chrToYV12,
+ &c->readLumPlanar, &c->readAlpPlanar, &c->readChrPlanar);
if (c->srcBpc == 8) {
if (c->dstBpc <= 14) {
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index e87b073d57..6ba78bca39 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -988,7 +988,13 @@ void ff_get_unscaled_swscale_aarch64(SwsContext *c);
void ff_sws_init_scale(SwsContext *c);
-void ff_sws_init_input_funcs(SwsContext *c);
+void ff_sws_init_input_funcs(SwsContext *c,
+ planar1_YV12_fn *lumToYV12,
+ planar1_YV12_fn *alpToYV12,
+ planar2_YV12_fn *chrToYV12,
+ planarX_YV12_fn *readLumPlanar,
+ planarX_YV12_fn *readAlpPlanar,
+ planarX2_YV12_fn *readChrPlanar);
void ff_sws_init_output_funcs(SwsContext *c,
yuv2planar1_fn *yuv2plane1,
yuv2planarX_fn *yuv2planeX,
--
2.46.1
More information about the ffmpeg-devel
mailing list