1/* 2 * Copyright (c) 2020 Martin Storsjo 3 * 4 * This file is part of FFmpeg. 5 * 6 * FFmpeg is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * FFmpeg is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with FFmpeg; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 */ 20 21#include "libavutil/aarch64/asm.S" 22 23// void ff_interleave_bytes_neon(const uint8_t *src1, const uint8_t *src2, 24// uint8_t *dest, int width, int height, 25// int src1Stride, int src2Stride, int dstStride); 26function ff_interleave_bytes_neon, export=1 27 sub w5, w5, w3 28 sub w6, w6, w3 29 sub w7, w7, w3, lsl #1 301: 31 ands w8, w3, #0xfffffff0 // & ~15 32 b.eq 3f 332: 34 ld1 {v0.16b}, [x0], #16 35 ld1 {v1.16b}, [x1], #16 36 subs w8, w8, #16 37 st2 {v0.16b, v1.16b}, [x2], #32 38 b.gt 2b 39 40 tst w3, #15 41 b.eq 9f 42 433: 44 tst w3, #8 45 b.eq 4f 46 ld1 {v0.8b}, [x0], #8 47 ld1 {v1.8b}, [x1], #8 48 st2 {v0.8b, v1.8b}, [x2], #16 494: 50 tst w3, #4 51 b.eq 5f 52 53 ld1 {v0.s}[0], [x0], #4 54 ld1 {v1.s}[0], [x1], #4 55 zip1 v0.8b, v0.8b, v1.8b 56 st1 {v0.8b}, [x2], #8 57 585: 59 ands w8, w3, #3 60 b.eq 9f 616: 62 ldrb w9, [x0], #1 63 ldrb w10, [x1], #1 64 subs w8, w8, #1 65 bfi w9, w10, #8, #8 66 strh w9, [x2], #2 67 b.gt 6b 68 699: 70 subs w4, w4, #1 71 b.eq 0f 72 add x0, x0, w5, sxtw 73 add x1, x1, w6, sxtw 74 add x2, x2, w7, sxtw 75 b 1b 76 770: 78 ret 79endfunc 80