PR #26345 opened by sjpotter
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26345
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26345.patch

32-bit ARM has had NEON versions of `put_vc1_mspel_pixels_tab` for a long time, 
but `avg_vc1_mspel_pixels_tab` was still C only. The avg functions do the 
backward half of interpolated (bidirectional) prediction in B pictures, 
including the 8x8 blocks of interlaced 4-MV MBs. On arm32 they were the last 
hot C-only DSP function when decoding interlaced or B-heavy VC-1.

This change reuses the existing put macros instead of adding a second copy: 
each one takes the operation as an argument, and the avg variant loads the 
destination row and does `vrhadd.u8` before the store, which is exactly 
`op_avg` in `vc1dsp.c`. The put code paths assemble to the same instructions as 
before. 16x16 is still four 8x8 calls, as for put. The full-pel mode 0 also 
gets NEON avg copies for 8x8 and 16x16 (put 16x16 mode 0 stays C, as before).

The assembly was written with AI assistance, modeled on the existing arm32 put 
functions, to fill in the missing avg half. I reviewed it and tested it as 
described below. (aarch64 has no mspel NEON at all, put or avg; that would be a 
separate patch.)

### checkasm

Sony BRAVIA X940E (MediaTek MT5891, 4x Cortex-A53 @ 1.0 GHz, 32-bit Android 9), 
NDK clang, `--cpu=armv7-a --enable-neon`. `checkasm --test=vc1dsp --bench`, 
gettime timing (the ccnt cycle counter is not accessible there), nsecs per call:

| function | C | NEON | speedup |
|---|---:|---:|---:|
| mc00 8x8 / 16x16 | 101 / 470 | 49 / 173 | 2.1x / 2.7x |
| mc01 8x8 / 16x16 | 1232 / 4436 | 141 / 594 | 8.7x / 7.4x |
| mc02 8x8 / 16x16 | 1026 / 4200 | 147 / 616 | 6.9x / 6.8x |
| mc10 8x8 / 16x16 | 993 / 5132 | 181 / 748 | 5.5x / 6.9x |
| mc20 8x8 / 16x16 | 917 / 4415 | 192 / 772 | 4.8x / 5.7x |
| mc11 8x8 / 16x16 | 1402 / 6916 | 498 / 2028 | 2.8x / 3.4x |
| mc22 8x8 / 16x16 | 1093 / 6007 | 471 / 1924 | 2.3x / 3.1x |
| mc33 8x8 / 16x16 | 1403 / 7021 | 498 / 2029 | 2.7x / 3.5x |

Across all 32 avg functions: 4.7-8.7x for the 1D modes, 2.3-3.5x for the 2D 
modes.

### Decode impact

Decode-only benchmark on the same TV (VC-1 Blu-ray clips, `-f null`, median of 
5 runs, 3 frame threads):

| content | fps | CPU time |
|---|---|---|
| interlaced 1080i | +7.6% to +12.4% | -4.5% to -8.2% |
| progressive 1080p24 film | unchanged (within ±1%) | unchanged |

The progressive film clips I have rarely hits avg MC, so no change there is 
expected. These numbers were measured with the frame threading from #26273 and 
other local changes applied, not on plain master. I did not measure 
single-threaded decode for this change; the checkasm numbers above show the 
per-function gain, which does not depend on threading. The clips are commercial 
and can't be shared.

### Testing

- `checkasm --test=vc1dsp` on the Cortex-A53 with 7 fixed seeds and 
`--repeat=30`, all passing.
- Full `checkasm` on the same device: all 1173 tests pass.
- Decoded a 1080i VC-1 clip (2696 frames) on the TV with `-threads 1 -f 
framemd5` using an armv7 build of this branch: bit-exact against a reference 
decode.
- macOS (aarch64) build of the branch still compiles; the arm32 code isn't 
built there.



From a01998edfb7c06196276de7b4e72ac3d16b22afb Mon Sep 17 00:00:00 2001
From: Shaya Potter <[email protected]>
Date: Wed, 25 Nov 2026 08:54:30 +0200
Subject: [PATCH] avcodec/arm/vc1dsp: add NEON avg_vc1_mspel functions

32-bit ARM had NEON versions of put_vc1_mspel_pixels_tab, but
avg_vc1_mspel_pixels_tab was C only. The avg functions do the backward
prediction of interpolated (bidirectional) blocks in B pictures, both
16x16 and the 8x8 blocks of interlaced 4-MV MBs, so on arm32 they were
the remaining hot C-only DSP path for B-heavy and interlaced content.

Parametrize the existing put mspel macros with the operation and
instantiate avg versions that round-average the filtered result with
the destination (vrhadd.u8, matching op_avg in vc1dsp.c). As for put,
16x16 is done as four 8x8 calls. Also add NEON versions of the
full-pel avg copies (mode 0) for both block sizes.

checkasm --bench on a Cortex-A53 (armv7 userspace), C vs NEON:
  1D modes (mc01..mc03, mc10..mc30):  4.7-8.7x
  2D modes (mc11..mc33):              2.3-3.5x
  full-pel copy (mc00):               2.1x (8x8), 2.7x (16x16)

Signed-off-by: Shaya Potter <[email protected]>
---
 libavcodec/arm/vc1dsp_init_neon.c |  60 ++++++-----
 libavcodec/arm/vc1dsp_neon.S      | 171 +++++++++++++++++++++++-------
 2 files changed, 169 insertions(+), 62 deletions(-)

diff --git a/libavcodec/arm/vc1dsp_init_neon.c 
b/libavcodec/arm/vc1dsp_init_neon.c
index b5615624d5f..c7605c3230f 100644
--- a/libavcodec/arm/vc1dsp_init_neon.c
+++ b/libavcodec/arm/vc1dsp_init_neon.c
@@ -42,39 +42,45 @@ void ff_vc1_h_loop_filter16_neon(uint8_t *src, ptrdiff_t 
stride, int pq);
 
 void ff_put_pixels8x8_neon(uint8_t *block, const uint8_t *pixels,
                            ptrdiff_t line_size, int rnd);
+void ff_avg_pixels8x8_neon(uint8_t *block, const uint8_t *pixels,
+                           ptrdiff_t line_size, int rnd);
+void ff_avg_pixels16x16_neon(uint8_t *block, const uint8_t *pixels,
+                             ptrdiff_t line_size, int rnd);
 
-#define DECL_PUT(X, Y) \
-void ff_put_vc1_mspel_mc##X##Y##_neon(uint8_t *dst, const uint8_t *src, \
-                                      ptrdiff_t stride, int rnd); \
-static void ff_put_vc1_mspel_mc##X##Y##_16_neon(uint8_t *dst, const uint8_t 
*src, \
-                                         ptrdiff_t stride, int rnd) \
+#define DECL_OP(OP, X, Y) \
+void ff_##OP##_vc1_mspel_mc##X##Y##_neon(uint8_t *dst, const uint8_t *src, \
+                                         ptrdiff_t stride, int rnd); \
+static void ff_##OP##_vc1_mspel_mc##X##Y##_16_neon(uint8_t *dst, const uint8_t 
*src, \
+                                                   ptrdiff_t stride, int rnd) \
 { \
-  ff_put_vc1_mspel_mc##X##Y##_neon(dst+0, src+0, stride, rnd); \
-  ff_put_vc1_mspel_mc##X##Y##_neon(dst+8, src+8, stride, rnd); \
+  ff_##OP##_vc1_mspel_mc##X##Y##_neon(dst+0, src+0, stride, rnd); \
+  ff_##OP##_vc1_mspel_mc##X##Y##_neon(dst+8, src+8, stride, rnd); \
   dst += 8*stride; src += 8*stride; \
-  ff_put_vc1_mspel_mc##X##Y##_neon(dst+0, src+0, stride, rnd); \
-  ff_put_vc1_mspel_mc##X##Y##_neon(dst+8, src+8, stride, rnd); \
+  ff_##OP##_vc1_mspel_mc##X##Y##_neon(dst+0, src+0, stride, rnd); \
+  ff_##OP##_vc1_mspel_mc##X##Y##_neon(dst+8, src+8, stride, rnd); \
 }
 
-DECL_PUT(1, 0)
-DECL_PUT(2, 0)
-DECL_PUT(3, 0)
+#define DECL_MC(X, Y) DECL_OP(put, X, Y) DECL_OP(avg, X, Y)
 
-DECL_PUT(0, 1)
-DECL_PUT(0, 2)
-DECL_PUT(0, 3)
+DECL_MC(1, 0)
+DECL_MC(2, 0)
+DECL_MC(3, 0)
 
-DECL_PUT(1, 1)
-DECL_PUT(1, 2)
-DECL_PUT(1, 3)
+DECL_MC(0, 1)
+DECL_MC(0, 2)
+DECL_MC(0, 3)
 
-DECL_PUT(2, 1)
-DECL_PUT(2, 2)
-DECL_PUT(2, 3)
+DECL_MC(1, 1)
+DECL_MC(1, 2)
+DECL_MC(1, 3)
 
-DECL_PUT(3, 1)
-DECL_PUT(3, 2)
-DECL_PUT(3, 3)
+DECL_MC(2, 1)
+DECL_MC(2, 2)
+DECL_MC(2, 3)
+
+DECL_MC(3, 1)
+DECL_MC(3, 2)
+DECL_MC(3, 3)
 
 void ff_put_vc1_chroma_mc8_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t 
stride,
                                 int h, int x, int y);
@@ -145,7 +151,9 @@ static int vc1_unescape_buffer_neon(const uint8_t *src, int 
size, uint8_t *dst)
 
 #define FN_ASSIGN(X, Y) \
     dsp->put_vc1_mspel_pixels_tab[0][X+4*Y] = 
ff_put_vc1_mspel_mc##X##Y##_16_neon; \
-    dsp->put_vc1_mspel_pixels_tab[1][X+4*Y] = ff_put_vc1_mspel_mc##X##Y##_neon
+    dsp->put_vc1_mspel_pixels_tab[1][X+4*Y] = 
ff_put_vc1_mspel_mc##X##Y##_neon; \
+    dsp->avg_vc1_mspel_pixels_tab[0][X+4*Y] = 
ff_avg_vc1_mspel_mc##X##Y##_16_neon; \
+    dsp->avg_vc1_mspel_pixels_tab[1][X+4*Y] = ff_avg_vc1_mspel_mc##X##Y##_neon
 
 av_cold void ff_vc1dsp_init_neon(VC1DSPContext *dsp)
 {
@@ -166,6 +174,8 @@ av_cold void ff_vc1dsp_init_neon(VC1DSPContext *dsp)
     dsp->vc1_h_loop_filter16 = ff_vc1_h_loop_filter16_neon;
 
     dsp->put_vc1_mspel_pixels_tab[1][ 0] = ff_put_pixels8x8_neon;
+    dsp->avg_vc1_mspel_pixels_tab[0][ 0] = ff_avg_pixels16x16_neon;
+    dsp->avg_vc1_mspel_pixels_tab[1][ 0] = ff_avg_pixels8x8_neon;
     FN_ASSIGN(1, 0);
     FN_ASSIGN(2, 0);
     FN_ASSIGN(3, 0);
diff --git a/libavcodec/arm/vc1dsp_neon.S b/libavcodec/arm/vc1dsp_neon.S
index 8094dcd13ed..c44e9471a16 100644
--- a/libavcodec/arm/vc1dsp_neon.S
+++ b/libavcodec/arm/vc1dsp_neon.S
@@ -773,7 +773,22 @@ endfunc
         vqmovn.u16      \dest,  \acc0                       @ Narrow with 
saturation from u16 to u8
 .endm
 
-@ Register usage for put_vc1_mspel_mc functions. Registers marked 'hv' are 
only used in put_vc1_mspel_mc_hv.
+@ For avg, load the destination row that the next mspel_store will average 
with.
+.macro mspel_load_dst op
+  .ifc \op,avg
+        vld1.64         {d20}, [r0,:64]
+  .endif
+.endm
+
+@ Store one 8-byte row and advance dst; for avg, round-average with the row 
loaded by mspel_load_dst.
+.macro mspel_store op dreg
+  .ifc \op,avg
+        vrhadd.u8       \dreg, \dreg, d20                   @ (dst + res + 1) 
>> 1
+  .endif
+        vst1.64         {\dreg}, [r0,:64], r2
+.endm
+
+@ Register usage for put/avg_vc1_mspel_mc functions. Registers marked 'hv' are 
only used in vc1_mspel_mc_hv.
 @
 @   r0        adjusted dst
 @   r1        adjusted src
@@ -790,6 +805,7 @@ endfunc
 @   q1 [hv]   src[0]
 @   q2 [hv]   src[stride]
 @   q3 [hv]   src[stride * 2]
+@   d20       dst row (avg only)
 @   d21       often result from mspel_filter
 @   q11       accumulator 0
 @   q12 [hv]  accumulator 1
@@ -800,8 +816,8 @@ endfunc
 @   d31       filter_d
 
 @ (uint8_t *dst [r0], const uint8_t *src [r1], ptrdiff_t stride [r2], int rnd 
[r3])
-.macro put_vc1_mspel_mc_hv hmode vmode filter_h_a filter_h_b filter_h_c 
filter_h_d filter_v_a filter_v_b filter_v_c filter_v_d filter_add filter_shift
-function ff_put_vc1_mspel_mc\hmode\()\vmode\()_neon, export=1
+.macro vc1_mspel_mc_hv op hmode vmode filter_h_a filter_h_b filter_h_c 
filter_h_d filter_v_a filter_v_b filter_v_c filter_v_d filter_add filter_shift
+function ff_\op\()_vc1_mspel_mc\hmode\()\vmode\()_neon, export=1
         push            {r4, r11, lr}
         mov             r11, sp                 @ r11 = stack pointer before 
realignmnet
 A       bic             sp,  sp,  #15           @ sp = round down to multiple 
of 16 bytes
@@ -860,13 +876,14 @@ T       mov             sp,  r4
         subs            r12,  r12,  #1
 
         vld1.64         {q0,q1}, [r4,:128]!     @ read one line of tmp
+        mspel_load_dst  \op
         vext.16         q2,   q0,   q1,  #2
         vext.16         q3,   q0,   q1,  #3
         vext.16         q1,   q0,   q1,  #1     @ do last because it writes to 
q1 which is read by the other vext instructions
 
         mspel_filter.16 q11, q12, d22, d23, d21, d0, d1, d2, d3, d4, d5, d6, 
d7, \filter_h_a, \filter_h_b, \filter_h_c, \filter_h_d, d28, d29, d30, d31, 
q13, 7
 
-        vst1.64         {d21}, [r0,:64], r2     @ store and increment dst
+        mspel_store     \op, d21                @ store and increment dst
 
         bne             2b
 
@@ -876,26 +893,35 @@ endfunc
 .endm
 
 @ Use C preprocessor and assembler macros to expand to functions for 
horizontal and vertical filtering.
-#define PUT_VC1_MSPEL_MC_HV(hmode, vmode)   \
-    put_vc1_mspel_mc_hv hmode, vmode, \
+#define VC1_MSPEL_MC_HV(op, hmode, vmode)   \
+    vc1_mspel_mc_hv op, hmode, vmode, \
         MSPEL_MODE_ ## hmode ## _MUL_CONSTANTS, \
         MSPEL_MODE_ ## vmode ## _MUL_CONSTANTS, \
         MSPEL_MODES_ ## hmode ## vmode ## _ADDSHIFT_CONSTANTS
 
-PUT_VC1_MSPEL_MC_HV(1, 1)
-PUT_VC1_MSPEL_MC_HV(1, 2)
-PUT_VC1_MSPEL_MC_HV(1, 3)
-PUT_VC1_MSPEL_MC_HV(2, 1)
-PUT_VC1_MSPEL_MC_HV(2, 2)
-PUT_VC1_MSPEL_MC_HV(2, 3)
-PUT_VC1_MSPEL_MC_HV(3, 1)
-PUT_VC1_MSPEL_MC_HV(3, 2)
-PUT_VC1_MSPEL_MC_HV(3, 3)
+VC1_MSPEL_MC_HV(put, 1, 1)
+VC1_MSPEL_MC_HV(put, 1, 2)
+VC1_MSPEL_MC_HV(put, 1, 3)
+VC1_MSPEL_MC_HV(put, 2, 1)
+VC1_MSPEL_MC_HV(put, 2, 2)
+VC1_MSPEL_MC_HV(put, 2, 3)
+VC1_MSPEL_MC_HV(put, 3, 1)
+VC1_MSPEL_MC_HV(put, 3, 2)
+VC1_MSPEL_MC_HV(put, 3, 3)
+VC1_MSPEL_MC_HV(avg, 1, 1)
+VC1_MSPEL_MC_HV(avg, 1, 2)
+VC1_MSPEL_MC_HV(avg, 1, 3)
+VC1_MSPEL_MC_HV(avg, 2, 1)
+VC1_MSPEL_MC_HV(avg, 2, 2)
+VC1_MSPEL_MC_HV(avg, 2, 3)
+VC1_MSPEL_MC_HV(avg, 3, 1)
+VC1_MSPEL_MC_HV(avg, 3, 2)
+VC1_MSPEL_MC_HV(avg, 3, 3)
 
-#undef PUT_VC1_MSPEL_MC_HV
+#undef VC1_MSPEL_MC_HV
 
-.macro  put_vc1_mspel_mc_h_only hmode filter_a filter_b filter_c filter_d 
filter_add filter_shift
-function ff_put_vc1_mspel_mc\hmode\()0_neon, export=1
+.macro  vc1_mspel_mc_h_only op hmode filter_a filter_b filter_c filter_d 
filter_add filter_shift
+function ff_\op\()_vc1_mspel_mc\hmode\()0_neon, export=1
         rsb             r3,   r3,   #\filter_add        @ r3 = filter_add - r 
= filter_add - rnd
         mov             r12,  #8                        @ loop counter
         sub             r1,   r1,   #1                  @ slide back, using 
immediate
@@ -906,13 +932,14 @@ function ff_put_vc1_mspel_mc\hmode\()0_neon, export=1
         subs            r12,  r12,  #1
 
         vld1.64         {d0,d1}, [r1], r2               @ read 16 bytes even 
though we only need 11, also src += stride
+        mspel_load_dst  \op
         vext.8          d2,   d0,   d1,  #2
         vext.8          d3,   d0,   d1,  #3
         vext.8          d1,   d0,   d1,  #1             @ do last because it 
writes to d1 which is read by the other vext instructions
 
         mspel_filter    q11, d21, d0, d1, d2, d3, \filter_a, \filter_b, 
\filter_c, \filter_d, d28, d29, d30, d31, q13, \filter_shift
 
-        vst1.64         {d21}, [r0,:64], r2             @ store and increment 
dst
+        mspel_store     \op, d21                        @ store and increment 
dst
 
         bne             1b
 
@@ -921,18 +948,21 @@ endfunc
 .endm
 
 @ Use C preprocessor and assembler macros to expand to functions for 
horizontal only filtering.
-#define PUT_VC1_MSPEL_MC_H_ONLY(hmode) \
-        put_vc1_mspel_mc_h_only hmode, MSPEL_MODE_ ## hmode ## _MUL_CONSTANTS, 
MSPEL_MODE_ ## hmode ## _ADDSHIFT_CONSTANTS
+#define VC1_MSPEL_MC_H_ONLY(op, hmode) \
+        vc1_mspel_mc_h_only op, hmode, MSPEL_MODE_ ## hmode ## _MUL_CONSTANTS, 
MSPEL_MODE_ ## hmode ## _ADDSHIFT_CONSTANTS
 
-PUT_VC1_MSPEL_MC_H_ONLY(1)
-PUT_VC1_MSPEL_MC_H_ONLY(2)
-PUT_VC1_MSPEL_MC_H_ONLY(3)
+VC1_MSPEL_MC_H_ONLY(put, 1)
+VC1_MSPEL_MC_H_ONLY(put, 2)
+VC1_MSPEL_MC_H_ONLY(put, 3)
+VC1_MSPEL_MC_H_ONLY(avg, 1)
+VC1_MSPEL_MC_H_ONLY(avg, 2)
+VC1_MSPEL_MC_H_ONLY(avg, 3)
 
-#undef PUT_VC1_MSPEL_MC_H_ONLY
+#undef VC1_MSPEL_MC_H_ONLY
 
 @ (uint8_t *dst [r0], const uint8_t *src [r1], ptrdiff_t stride [r2], int rnd 
[r3])
-.macro put_vc1_mspel_mc_v_only vmode filter_a filter_b filter_c filter_d 
filter_add filter_shift
-function ff_put_vc1_mspel_mc0\vmode\()_neon, export=1
+.macro vc1_mspel_mc_v_only op vmode filter_a filter_b filter_c filter_d 
filter_add filter_shift
+function ff_\op\()_vc1_mspel_mc0\vmode\()_neon, export=1
         add             r3,   r3,   #\filter_add - 1    @ r3 = filter_add - r 
= filter_add - (1 - rnd) = filter_add - 1 + rnd
         mov             r12,  #8                        @ loop counter
         sub             r1,   r1,   r2                  @ r1 = &src[-stride]   
   @ slide back
@@ -947,20 +977,24 @@ function ff_put_vc1_mspel_mc0\vmode\()_neon, export=1
         subs            r12,  r12,  #4
 
         vld1.64         {d3},  [r1], r2                 @ d3 = src[stride * 2]
+        mspel_load_dst  \op
         mspel_filter    q11, d21, d0, d1, d2, d3, \filter_a, \filter_b, 
\filter_c, \filter_d, d28, d29, d30, d31, q13, \filter_shift
-        vst1.64         {d21}, [r0,:64], r2             @ store and increment 
dst
+        mspel_store     \op, d21                        @ store and increment 
dst
 
         vld1.64         {d0},  [r1], r2                 @ d0 = next line
+        mspel_load_dst  \op
         mspel_filter    q11, d21, d1, d2, d3, d0, \filter_a, \filter_b, 
\filter_c, \filter_d, d28, d29, d30, d31, q13, \filter_shift
-        vst1.64         {d21}, [r0,:64], r2             @ store and increment 
dst
+        mspel_store     \op, d21                        @ store and increment 
dst
 
         vld1.64         {d1},  [r1], r2                 @ d1 = next line
+        mspel_load_dst  \op
         mspel_filter    q11, d21, d2, d3, d0, d1, \filter_a, \filter_b, 
\filter_c, \filter_d, d28, d29, d30, d31, q13, \filter_shift
-        vst1.64         {d21}, [r0,:64], r2             @ store and increment 
dst
+        mspel_store     \op, d21                        @ store and increment 
dst
 
         vld1.64         {d2},  [r1], r2                 @ d2 = next line
+        mspel_load_dst  \op
         mspel_filter    q11, d21, d3, d0, d1, d2, \filter_a, \filter_b, 
\filter_c, \filter_d, d28, d29, d30, d31, q13, \filter_shift
-        vst1.64         {d21}, [r0,:64], r2             @ store and increment 
dst
+        mspel_store     \op, d21                        @ store and increment 
dst
 
         bne             1b
 
@@ -969,14 +1003,17 @@ endfunc
 .endm
 
 @ Use C preprocessor and assembler macros to expand to functions for vertical 
only filtering.
-#define PUT_VC1_MSPEL_MC_V_ONLY(vmode) \
-        put_vc1_mspel_mc_v_only vmode, MSPEL_MODE_ ## vmode ## _MUL_CONSTANTS, 
MSPEL_MODE_ ## vmode ## _ADDSHIFT_CONSTANTS
+#define VC1_MSPEL_MC_V_ONLY(op, vmode) \
+        vc1_mspel_mc_v_only op, vmode, MSPEL_MODE_ ## vmode ## _MUL_CONSTANTS, 
MSPEL_MODE_ ## vmode ## _ADDSHIFT_CONSTANTS
 
-PUT_VC1_MSPEL_MC_V_ONLY(1)
-PUT_VC1_MSPEL_MC_V_ONLY(2)
-PUT_VC1_MSPEL_MC_V_ONLY(3)
+VC1_MSPEL_MC_V_ONLY(put, 1)
+VC1_MSPEL_MC_V_ONLY(put, 2)
+VC1_MSPEL_MC_V_ONLY(put, 3)
+VC1_MSPEL_MC_V_ONLY(avg, 1)
+VC1_MSPEL_MC_V_ONLY(avg, 2)
+VC1_MSPEL_MC_V_ONLY(avg, 3)
 
-#undef PUT_VC1_MSPEL_MC_V_ONLY
+#undef VC1_MSPEL_MC_V_ONLY
 
 function ff_put_pixels8x8_neon, export=1
         vld1.64         {d0}, [r1], r2
@@ -998,6 +1035,66 @@ function ff_put_pixels8x8_neon, export=1
         bx              lr
 endfunc
 
+@ (uint8_t *dst [r0], const uint8_t *src [r1], ptrdiff_t stride [r2], int rnd 
[r3])
+function ff_avg_pixels8x8_neon, export=1
+        mov             r3,  r0
+        vld1.64         {d0}, [r1], r2
+        vld1.64         {d1}, [r1], r2
+        vld1.64         {d2}, [r1], r2
+        vld1.64         {d3}, [r1], r2
+        vld1.64         {d4}, [r1], r2
+        vld1.64         {d5}, [r1], r2
+        vld1.64         {d6}, [r1], r2
+        vld1.64         {d7}, [r1]
+        vld1.64         {d16}, [r3,:64], r2
+        vld1.64         {d17}, [r3,:64], r2
+        vld1.64         {d18}, [r3,:64], r2
+        vld1.64         {d19}, [r3,:64], r2
+        vld1.64         {d20}, [r3,:64], r2
+        vld1.64         {d21}, [r3,:64], r2
+        vld1.64         {d22}, [r3,:64], r2
+        vld1.64         {d23}, [r3,:64]
+        vrhadd.u8       q0,  q0,  q8
+        vrhadd.u8       q1,  q1,  q9
+        vrhadd.u8       q2,  q2,  q10
+        vrhadd.u8       q3,  q3,  q11
+        vst1.64         {d0}, [r0,:64], r2
+        vst1.64         {d1}, [r0,:64], r2
+        vst1.64         {d2}, [r0,:64], r2
+        vst1.64         {d3}, [r0,:64], r2
+        vst1.64         {d4}, [r0,:64], r2
+        vst1.64         {d5}, [r0,:64], r2
+        vst1.64         {d6}, [r0,:64], r2
+        vst1.64         {d7}, [r0,:64]
+        bx              lr
+endfunc
+
+@ (uint8_t *dst [r0], const uint8_t *src [r1], ptrdiff_t stride [r2], int rnd 
[r3])
+function ff_avg_pixels16x16_neon, export=1
+        mov             r3,  r0
+        mov             r12, #4
+1:
+        subs            r12, r12, #1
+        vld1.64          {q0}, [r1], r2
+        vld1.64          {q1}, [r1], r2
+        vld1.64          {q2}, [r1], r2
+        vld1.64          {q3}, [r1], r2
+        vld1.64         {q8},  [r3,:64], r2
+        vld1.64         {q9},  [r3,:64], r2
+        vld1.64         {q10}, [r3,:64], r2
+        vld1.64         {q11}, [r3,:64], r2
+        vrhadd.u8       q0,  q0,  q8
+        vrhadd.u8       q1,  q1,  q9
+        vrhadd.u8       q2,  q2,  q10
+        vrhadd.u8       q3,  q3,  q11
+        vst1.64         {q0}, [r0,:64], r2
+        vst1.64         {q1}, [r0,:64], r2
+        vst1.64         {q2}, [r0,:64], r2
+        vst1.64         {q3}, [r0,:64], r2
+        bne             1b
+        bx              lr
+endfunc
+
 function ff_vc1_inv_trans_8x8_dc_neon, export=1
         ldrsh           r2, [r2]              @ int dc = block[0];
 
-- 
2.54.1

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to