[FFmpeg-devel] libavcodec/exr : add SIMD for reorder pixels (SSE and AVX2) v3 (WIP)
Henrik Gramner
henrik at gramner.com
Sun Sep 10 20:40:42 EEST 2017
On Sun, Sep 10, 2017 at 5:17 PM, Martin Vignali
<martin.vignali at gmail.com> wrote:
> + void (*reorder_pixels)(uint8_t *src, uint8_t *dst, int size);
size should be ptrdiff_t instead of int since it's used as a 64-bit
operand in the asm on x86-64 and the upper 32 bits are undefined
otherwise.
> +++ b/libavcodec/x86/exrdsp.asm
Couldn't this be simplified to something like:
%macro REORDER_PIXELS 0
cglobal reorder_pixels, 3,4,3, src1, dst, size, src2
lea src2q, [src1q+sizeq]
add dstq, sizeq
shr sizeq, 1
add src1q, sizeq
neg sizeq
.loop:
mova m0, [src1q+sizeq]
movu m1, [src2q+sizeq]
SBUTTERFLY bw, 0, 1, 2
mova [dstq+2*sizeq ], xm0
mova [dstq+2*sizeq+16], xm1
%if mmsize == 32
vperm2i128 m0, m0, m1, 0x31
mova [dstq+2*sizeq+32], m0
%endif
add sizeq, mmsize
jl .loop
RET
%endmacro
(completely untested)
More information about the ffmpeg-devel
mailing list