mirror of https://github.com/FFmpeg/FFmpeg.git
A55 A76 pix_norm1_c: 478.2 234.2 pix_norm1_neon: 188.2 ( 2.54x) 41.2 ( 5.68x) pix_sum_c: 304.2 244.0 pix_sum_neon: 77.2 ( 3.94x) 21.5 (11.35x)release/7.1
parent
834964ce1a
commit
9f68a3712e
5 changed files with 114 additions and 1 deletions
@ -0,0 +1,39 @@ |
||||
/*
|
||||
* 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 <stddef.h> |
||||
#include <stdint.h> |
||||
|
||||
#include "libavutil/attributes.h" |
||||
#include "libavutil/aarch64/cpu.h" |
||||
#include "libavcodec/mpegvideoencdsp.h" |
||||
#include "config.h" |
||||
|
||||
int ff_pix_sum16_neon(const uint8_t *pix, int line_size); |
||||
int ff_pix_norm1_neon(const uint8_t *pix, int line_size); |
||||
|
||||
av_cold void ff_mpegvideoencdsp_init_aarch64(MpegvideoEncDSPContext *c, |
||||
AVCodecContext *avctx) |
||||
{ |
||||
int cpu_flags = av_get_cpu_flags(); |
||||
|
||||
if (have_neon(cpu_flags)) { |
||||
c->pix_sum = ff_pix_sum16_neon; |
||||
c->pix_norm1 = ff_pix_norm1_neon; |
||||
} |
||||
} |
@ -0,0 +1,68 @@ |
||||
/* |
||||
* 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" |
||||
|
||||
function ff_pix_sum16_neon, export=1 |
||||
// x0 const uint8_t *pix |
||||
// x1 int line_size |
||||
|
||||
sxtw x1, w1 |
||||
add x2, x0, x1 |
||||
lsl x1, x1, #1 |
||||
movi v0.16b, #0 |
||||
mov w3, #16 |
||||
|
||||
1: |
||||
ld1 {v1.16b}, [x0], x1 |
||||
ld1 {v2.16b}, [x2], x1 |
||||
subs w3, w3, #2 |
||||
uadalp v0.8h, v1.16b |
||||
uadalp v0.8h, v2.16b |
||||
b.ne 1b |
||||
|
||||
uaddlv s0, v0.8h |
||||
fmov w0, s0 |
||||
|
||||
ret |
||||
endfunc |
||||
|
||||
function ff_pix_norm1_neon, export=1 |
||||
// x0 const uint8_t *pix |
||||
// x1 int line_size |
||||
|
||||
sxtw x1, w1 |
||||
movi v0.16b, #0 |
||||
mov w2, #16 |
||||
|
||||
1: |
||||
ld1 {v1.16b}, [x0], x1 |
||||
subs w2, w2, #1 |
||||
umull v2.8h, v1.8b, v1.8b |
||||
umull2 v3.8h, v1.16b, v1.16b |
||||
uadalp v0.4s, v2.8h |
||||
uadalp v0.4s, v3.8h |
||||
b.ne 1b |
||||
|
||||
uaddlv d0, v0.4s |
||||
fmov w0, s0 |
||||
|
||||
ret |
||||
endfunc |
Loading…
Reference in new issue