aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale/aarch64/swscale.c
diff options
context:
space:
mode:
authorZhao Zhili <zhilizhao@tencent.com>2024-06-24 21:02:11 +0800
committerZhao Zhili <zhilizhao@tencent.com>2024-07-05 16:32:31 +0800
commitb8b71be07a7969e9c450bc7f61b7d6135f60e61c (patch)
treeb3b8f45ce2b055ed9732362299c2d2d63e597954 /libswscale/aarch64/swscale.c
parentbef77c6c9c389e51d4b5619648af7e6bbf0d285c (diff)
downloadffmpeg-b8b71be07a7969e9c450bc7f61b7d6135f60e61c.tar.gz
swscale/aarch64: Add bgr24 to yuv
Test on Apple M1 with kperf : -O3 : -O3 -fno-vectorize bgr24_to_uv_8_c : 28.5 : 52.5 bgr24_to_uv_8_neon : 54.5 : 59.7 bgr24_to_uv_128_c : 294.0 : 830.7 bgr24_to_uv_128_neon : 99.7 : 112.0 bgr24_to_uv_1080_c : 965.0 : 6624.0 bgr24_to_uv_1080_neon : 751.5 : 754.7 bgr24_to_uv_1920_c : 1693.2 : 11554.5 bgr24_to_uv_1920_neon : 1292.5 : 1307.5 bgr24_to_uv_half_8_c : 54.2 : 37.0 bgr24_to_uv_half_8_neon : 27.2 : 22.5 bgr24_to_uv_half_128_c : 127.2 : 392.5 bgr24_to_uv_half_128_neon : 63.0 : 52.0 bgr24_to_uv_half_1080_c : 880.2 : 3329.0 bgr24_to_uv_half_1080_neon : 401.5 : 390.7 bgr24_to_uv_half_1920_c : 1585.7 : 6390.7 bgr24_to_uv_half_1920_neon : 694.7 : 698.7 bgr24_to_y_8_c : 21.7 : 22.5 bgr24_to_y_8_neon : 797.2 : 25.5 bgr24_to_y_128_c : 88.0 : 280.5 bgr24_to_y_128_neon : 63.7 : 55.0 bgr24_to_y_1080_c : 616.7 : 2208.7 bgr24_to_y_1080_neon : 900.0 : 452.0 bgr24_to_y_1920_c : 1093.2 : 3894.7 bgr24_to_y_1920_neon : 777.2 : 767.5 Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Diffstat (limited to 'libswscale/aarch64/swscale.c')
-rw-r--r--libswscale/aarch64/swscale.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/libswscale/aarch64/swscale.c b/libswscale/aarch64/swscale.c
index e4ea3309ba..c6594944c3 100644
--- a/libswscale/aarch64/swscale.c
+++ b/libswscale/aarch64/swscale.c
@@ -201,19 +201,18 @@ void ff_yuv2plane1_8_neon(
default: break; \
}
-void ff_rgb24ToY_neon(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
- const uint8_t *unused2, int width,
- uint32_t *rgb2yuv, void *opq);
-
-void ff_rgb24ToUV_neon(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0,
- const uint8_t *src1,
- const uint8_t *src2, int width, uint32_t *rgb2yuv,
- void *opq);
-
-void ff_rgb24ToUV_half_neon(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0,
- const uint8_t *src1,
- const uint8_t *src2, int width, uint32_t *rgb2yuv,
- void *opq);
+#define NEON_INPUT(name) \
+void ff_##name##ToY_neon(uint8_t *dst, const uint8_t *src, const uint8_t *, \
+ const uint8_t *, int w, uint32_t *coeffs, void *); \
+void ff_##name##ToUV_neon(uint8_t *, uint8_t *, const uint8_t *, \
+ const uint8_t *, const uint8_t *, int w, \
+ uint32_t *coeffs, void *); \
+void ff_##name##ToUV_half_neon(uint8_t *, uint8_t *, const uint8_t *, \
+ const uint8_t *, const uint8_t *, int w, \
+ uint32_t *coeffs, void *)
+
+NEON_INPUT(bgr24);
+NEON_INPUT(rgb24);
void ff_lumRangeFromJpeg_neon(int16_t *dst, int width);
void ff_chrRangeFromJpeg_neon(int16_t *dstU, int16_t *dstV, int width);
@@ -247,6 +246,13 @@ av_cold void ff_sws_init_swscale_aarch64(SwsContext *c)
c->yuv2planeX = ff_yuv2planeX_8_neon;
}
switch (c->srcFormat) {
+ case AV_PIX_FMT_BGR24:
+ c->lumToYV12 = ff_bgr24ToY_neon;
+ if (c->chrSrcHSubSample)
+ c->chrToYV12 = ff_bgr24ToUV_half_neon;
+ else
+ c->chrToYV12 = ff_bgr24ToUV_neon;
+ break;
case AV_PIX_FMT_RGB24:
c->lumToYV12 = ff_rgb24ToY_neon;
if (c->chrSrcHSubSample)