]> git.sesse.net Git - ffmpeg/blob - libavcodec/x86/exrdsp.asm
Merge commit 'bcaedef1189a3531aa4dfb020627eb0133ffa89c'
[ffmpeg] / libavcodec / x86 / exrdsp.asm
1 ;******************************************************************************
2 ;* X86 Optimized functions for Open Exr Decoder
3 ;* Copyright (c) 2006 Industrial Light & Magic, a division of Lucas Digital Ltd. LLC
4 ;*
5 ;* reorder_pixels based on patch by John Loy
6 ;* port to ASM by Jokyo Images support by CNC - French National Center for Cinema
7 ;*
8 ;* This file is part of FFmpeg.
9 ;*
10 ;* FFmpeg is free software; you can redistribute it and/or
11 ;* modify it under the terms of the GNU Lesser General Public
12 ;* License as published by the Free Software Foundation; either
13 ;* version 2.1 of the License, or (at your option) any later version.
14 ;*
15 ;* FFmpeg is distributed in the hope that it will be useful,
16 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 ;* Lesser General Public License for more details.
19 ;*
20 ;* You should have received a copy of the GNU Lesser General Public
21 ;* License along with FFmpeg; if not, write to the Free Software
22 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 ;******************************************************************************
24
25 %include "libavutil/x86/x86util.asm"
26
27 SECTION .text
28
29 ;------------------------------------------------------------------------------
30 ; void ff_reorder_pixels(uint8_t *dst, const uint8_t *src, ptrdiff_t size);
31 ;------------------------------------------------------------------------------
32
33 %macro REORDER_PIXELS 0
34 cglobal reorder_pixels, 3,4,3, dst, src1, size, src2
35     lea                              src2q, [src1q+sizeq] ; src2 = src + 2 * half_size
36     add                               dstq, sizeq         ; dst offset by size
37     shr                              sizeq, 1             ; half_size
38     add                              src1q, sizeq         ; offset src by half_size
39     neg                              sizeq                ; size = offset for dst, src1, src2
40 .loop:
41
42     mova                                m0, [src1q+sizeq]        ; load first part
43     movu                                m1, [src2q+sizeq]        ; load second part
44     SBUTTERFLY bw, 0, 1, 2                                       ; interleaved
45     mova                 [dstq+2*sizeq   ], xm0                  ; copy to dst
46     mova                 [dstq+2*sizeq+16], xm1
47 %if cpuflag(avx2)
48     vperm2i128                          m0, m0, m1, q0301
49     mova                 [dstq+2*sizeq+32], m0
50 %endif
51     add     sizeq, mmsize
52     jl .loop
53     RET
54 %endmacro
55
56 INIT_XMM sse2
57 REORDER_PIXELS
58
59 %if HAVE_AVX2_EXTERNAL
60 INIT_YMM avx2
61 REORDER_PIXELS
62 %endif