1 ;******************************************************************************
2 ;* X86 Optimized functions for Open Exr Decoder
3 ;* Copyright (c) 2006 Industrial Light & Magic, a division of Lucas Digital Ltd. LLC
5 ;* reorder_pixels based on patch by John Loy
6 ;* port to ASM by Jokyo Images support by CNC - French National Center for Cinema
8 ;* This file is part of FFmpeg.
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.
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.
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 ;******************************************************************************
25 %include "libavutil/x86/x86util.asm"
29 ;------------------------------------------------------------------------------
30 ; void ff_reorder_pixels(uint8_t *dst, const uint8_t *src, ptrdiff_t size);
31 ;------------------------------------------------------------------------------
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
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
48 vperm2i128 m0, m0, m1, q0301
49 mova [dstq+2*sizeq+32], m0
59 %if HAVE_AVX2_EXTERNAL