2020-05-15 07:54:10 +00:00
|
|
|
/*
|
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "libavutil/attributes.h"
|
|
|
|
#include "libavutil/aarch64/cpu.h"
|
|
|
|
#include "libavutil/cpu.h"
|
|
|
|
#include "libavutil/bswap.h"
|
|
|
|
#include "libswscale/rgb2rgb.h"
|
|
|
|
#include "libswscale/swscale.h"
|
|
|
|
#include "libswscale/swscale_internal.h"
|
|
|
|
|
2024-09-18 13:11:44 +00:00
|
|
|
// Only handle width aligned to 16
|
2024-08-27 22:52:09 +00:00
|
|
|
void ff_rgb24toyv12_neon(const uint8_t *src, uint8_t *ydst, uint8_t *udst,
|
|
|
|
uint8_t *vdst, int width, int height, int lumStride,
|
swscale: Fix aarch64 and i386 compilation failures
This unbreaks builds after c1a0e657638f7007dcc807a2d985c22631fcd6d3,
which broke with errors like
src/libswscale/aarch64/rgb2rgb.c:66:25: error: incompatible function pointer types assigning to 'void (*)(const uint8_t *, uint8_t *, uint8_t *, uint8_t *, int, int, int, int, int, const int32_t *)' (aka 'void (*)(const unsigned char *, unsigned char *, unsigned char *, unsigned char *, int, int, int, int, int, const int *)') from 'void (const uint8_t *, uint8_t *, uint8_t *, uint8_t *, int, int, int, int, int, int32_t *)' (aka 'void (const unsigned char *, unsigned char *, unsigned char *, unsigned char *, int, int, int, int, int, int *)') [-Wincompatible-function-pointer-types]
66 | ff_rgb24toyv12 = rgb24toyv12;
| ^ ~~~~~~~~~~~
and
src/libswscale/aarch64/swscale_unscaled.c:213:29: error: incompatible function pointer types assigning to 'SwsFunc' (aka 'int (*)(struct SwsContext *, const unsigned char *const *, const int *, int, int, unsigned char *const *, const int *)') from 'int (SwsContext *, const uint8_t *const *, const int *, int, int, const uint8_t **, const int *)' (aka 'int (struct SwsContext *, const unsigned char *const *, const int *, int, int, const unsigned char **, const int *)') [-Wincompatible-function-pointer-types]
213 | c->convert_unscaled = nv24_to_yuv420p_neon_wrapper;
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-10-08 06:27:17 +00:00
|
|
|
int chromStride, int srcStride, const int32_t *rgb2yuv);
|
2024-09-18 13:11:44 +00:00
|
|
|
|
|
|
|
static void rgb24toyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst,
|
|
|
|
uint8_t *vdst, int width, int height, int lumStride,
|
swscale: Fix aarch64 and i386 compilation failures
This unbreaks builds after c1a0e657638f7007dcc807a2d985c22631fcd6d3,
which broke with errors like
src/libswscale/aarch64/rgb2rgb.c:66:25: error: incompatible function pointer types assigning to 'void (*)(const uint8_t *, uint8_t *, uint8_t *, uint8_t *, int, int, int, int, int, const int32_t *)' (aka 'void (*)(const unsigned char *, unsigned char *, unsigned char *, unsigned char *, int, int, int, int, int, const int *)') from 'void (const uint8_t *, uint8_t *, uint8_t *, uint8_t *, int, int, int, int, int, int32_t *)' (aka 'void (const unsigned char *, unsigned char *, unsigned char *, unsigned char *, int, int, int, int, int, int *)') [-Wincompatible-function-pointer-types]
66 | ff_rgb24toyv12 = rgb24toyv12;
| ^ ~~~~~~~~~~~
and
src/libswscale/aarch64/swscale_unscaled.c:213:29: error: incompatible function pointer types assigning to 'SwsFunc' (aka 'int (*)(struct SwsContext *, const unsigned char *const *, const int *, int, int, unsigned char *const *, const int *)') from 'int (SwsContext *, const uint8_t *const *, const int *, int, int, const uint8_t **, const int *)' (aka 'int (struct SwsContext *, const unsigned char *const *, const int *, int, int, const unsigned char **, const int *)') [-Wincompatible-function-pointer-types]
213 | c->convert_unscaled = nv24_to_yuv420p_neon_wrapper;
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-10-08 06:27:17 +00:00
|
|
|
int chromStride, int srcStride, const int32_t *rgb2yuv)
|
2024-09-18 13:11:44 +00:00
|
|
|
{
|
|
|
|
int width_align = width & (~15);
|
|
|
|
|
|
|
|
if (width_align > 0)
|
|
|
|
ff_rgb24toyv12_neon(src, ydst, udst, vdst, width_align, height,
|
|
|
|
lumStride, chromStride, srcStride, rgb2yuv);
|
|
|
|
if (width_align < width) {
|
|
|
|
src += width_align * 3;
|
|
|
|
ydst += width_align;
|
|
|
|
udst += width_align / 2;
|
|
|
|
vdst += width_align / 2;
|
|
|
|
ff_rgb24toyv12_c(src, ydst, udst, vdst, width - width_align, height,
|
|
|
|
lumStride, chromStride, srcStride, rgb2yuv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 07:54:10 +00:00
|
|
|
void ff_interleave_bytes_neon(const uint8_t *src1, const uint8_t *src2,
|
|
|
|
uint8_t *dest, int width, int height,
|
|
|
|
int src1Stride, int src2Stride, int dstStride);
|
2024-08-30 18:30:22 +00:00
|
|
|
void ff_deinterleave_bytes_neon(const uint8_t *src, uint8_t *dst1, uint8_t *dst2,
|
|
|
|
int width, int height, int srcStride,
|
|
|
|
int dst1Stride, int dst2Stride);
|
2020-05-15 07:54:10 +00:00
|
|
|
|
|
|
|
av_cold void rgb2rgb_init_aarch64(void)
|
|
|
|
{
|
|
|
|
int cpu_flags = av_get_cpu_flags();
|
|
|
|
|
|
|
|
if (have_neon(cpu_flags)) {
|
2024-09-18 13:11:44 +00:00
|
|
|
ff_rgb24toyv12 = rgb24toyv12;
|
2020-05-15 07:54:10 +00:00
|
|
|
interleaveBytes = ff_interleave_bytes_neon;
|
2024-08-30 18:30:22 +00:00
|
|
|
deinterleaveBytes = ff_deinterleave_bytes_neon;
|
2020-05-15 07:54:10 +00:00
|
|
|
}
|
|
|
|
}
|