1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-12 19:18:44 +02:00
FFmpeg/libswscale/aarch64/range_convert_neon.S
Ramiro Polla 75f1a8e071 swscale/aarch64: add neon {lum,chr}ConvertRange
chrRangeFromJpeg_8_c: 29.2
chrRangeFromJpeg_8_neon: 19.5
chrRangeFromJpeg_24_c: 80.5
chrRangeFromJpeg_24_neon: 34.0
chrRangeFromJpeg_128_c: 413.7
chrRangeFromJpeg_128_neon: 156.0
chrRangeFromJpeg_144_c: 471.0
chrRangeFromJpeg_144_neon: 174.2
chrRangeFromJpeg_256_c: 842.0
chrRangeFromJpeg_256_neon: 305.5
chrRangeFromJpeg_512_c: 1699.0
chrRangeFromJpeg_512_neon: 608.0
chrRangeToJpeg_8_c: 51.7
chrRangeToJpeg_8_neon: 22.7
chrRangeToJpeg_24_c: 149.7
chrRangeToJpeg_24_neon: 38.0
chrRangeToJpeg_128_c: 761.7
chrRangeToJpeg_128_neon: 176.7
chrRangeToJpeg_144_c: 866.2
chrRangeToJpeg_144_neon: 198.7
chrRangeToJpeg_256_c: 1516.5
chrRangeToJpeg_256_neon: 348.7
chrRangeToJpeg_512_c: 3067.2
chrRangeToJpeg_512_neon: 692.7
lumRangeFromJpeg_8_c: 24.0
lumRangeFromJpeg_8_neon: 17.0
lumRangeFromJpeg_24_c: 56.7
lumRangeFromJpeg_24_neon: 21.0
lumRangeFromJpeg_128_c: 294.5
lumRangeFromJpeg_128_neon: 76.7
lumRangeFromJpeg_144_c: 332.5
lumRangeFromJpeg_144_neon: 86.7
lumRangeFromJpeg_256_c: 586.0
lumRangeFromJpeg_256_neon: 152.2
lumRangeFromJpeg_512_c: 1190.0
lumRangeFromJpeg_512_neon: 298.0
lumRangeToJpeg_8_c: 31.7
lumRangeToJpeg_8_neon: 19.5
lumRangeToJpeg_24_c: 83.5
lumRangeToJpeg_24_neon: 24.2
lumRangeToJpeg_128_c: 440.5
lumRangeToJpeg_128_neon: 91.0
lumRangeToJpeg_144_c: 504.2
lumRangeToJpeg_144_neon: 101.0
lumRangeToJpeg_256_c: 879.7
lumRangeToJpeg_256_neon: 177.2
lumRangeToJpeg_512_c: 1794.2
lumRangeToJpeg_512_neon: 354.0
2024-06-18 23:12:41 +02:00

100 lines
3.4 KiB
ArmAsm

/*
* Copyright (c) 2024 Ramiro Polla
*
* 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 "libavutil/aarch64/asm.S"
.macro lumConvertRange name, max, mult, offset, shift
function ff_\name, export=1
.if \max != 0
mov w3, #\max
dup v24.8h, w3
.endif
mov w3, #\mult
dup v25.4s, w3
movz w3, #(\offset & 0xffff)
movk w3, #((\offset >> 16) & 0xffff), lsl #16
dup v26.4s, w3
1:
ld1 {v0.8h}, [x0]
.if \max != 0
smin v0.8h, v0.8h, v24.8h
.endif
mov v16.16b, v26.16b
mov v18.16b, v26.16b
sxtl v20.4s, v0.4h
sxtl2 v22.4s, v0.8h
mla v16.4s, v20.4s, v25.4s
mla v18.4s, v22.4s, v25.4s
shrn v0.4h, v16.4s, #\shift
shrn2 v0.8h, v18.4s, #\shift
subs w1, w1, #8
st1 {v0.8h}, [x0], #16
b.gt 1b
ret
endfunc
.endm
.macro chrConvertRange name, max, mult, offset, shift
function ff_\name, export=1
.if \max != 0
mov w3, #\max
dup v24.8h, w3
.endif
mov w3, #\mult
dup v25.4s, w3
movz w3, #(\offset & 0xffff)
movk w3, #((\offset >> 16) & 0xffff), lsl #16
dup v26.4s, w3
1:
ld1 {v0.8h}, [x0]
ld1 {v1.8h}, [x1]
.if \max != 0
smin v0.8h, v0.8h, v24.8h
smin v1.8h, v1.8h, v24.8h
.endif
mov v16.16b, v26.16b
mov v17.16b, v26.16b
mov v18.16b, v26.16b
mov v19.16b, v26.16b
sxtl v20.4s, v0.4h
sxtl v21.4s, v1.4h
sxtl2 v22.4s, v0.8h
sxtl2 v23.4s, v1.8h
mla v16.4s, v20.4s, v25.4s
mla v17.4s, v21.4s, v25.4s
mla v18.4s, v22.4s, v25.4s
mla v19.4s, v23.4s, v25.4s
shrn v0.4h, v16.4s, #\shift
shrn v1.4h, v17.4s, #\shift
shrn2 v0.8h, v18.4s, #\shift
shrn2 v1.8h, v19.4s, #\shift
subs w2, w2, #8
st1 {v0.8h}, [x0], #16
st1 {v1.8h}, [x1], #16
b.gt 1b
ret
endfunc
.endm
lumConvertRange lumRangeToJpeg_neon, 30189, 19077, -39057361, 14
chrConvertRange chrRangeToJpeg_neon, 30775, 4663, -9289992, 12
lumConvertRange lumRangeFromJpeg_neon, 0, 14071, 33561947, 14
chrConvertRange chrRangeFromJpeg_neon, 0, 1799, 4081085, 11