1 ;******************************************************************************
4 ;* Copyright (c) 2014 James Darnley <james.darnley@gmail.com>
6 ;* This file is part of FFmpeg.
8 ;* FFmpeg is free software; you can redistribute it and/or modify
9 ;* it under the terms of the GNU General Public License as published by
10 ;* the Free Software Foundation; either version 2 of the License, or
11 ;* (at your option) any later version.
13 ;* FFmpeg is distributed in the hope that it will be useful,
14 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;* GNU General Public License for more details.
18 ;* You should have received a copy of the GNU General Public License along
19 ;* with FFmpeg; if not, write to the Free Software Foundation, Inc.,
20 ;* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 ;******************************************************************************
23 %include "libavutil/x86/x86util.asm"
29 cglobal flac_enc_lpc_16, 5, 7, 8, 0, res, smp, len, order, coefs
35 cglobal flac_enc_lpc_16, 5, 6, 8, 0, res, smp, len, order, coefs
40 ; Here we assume that the maximum order value is 32. This means that we only
41 ; need to copy a maximum of 32 samples. Therefore we let the preprocessor
42 ; unroll this loop and copy all 32.
47 %assign iter iter+mmsize
50 lea resq, [resq+orderq*4]
51 lea smpq, [smpq+orderq*4]
52 lea coefsq, [coefsq+orderq*4]
68 movd m2, [coefsq+posj*4] ; c = coefs[j]
70 movu m1, [smpq+negj*4-4] ; s = smp[i-j-1]
71 movu m5, [smpq+negj*4-4+mmsize]
72 movu m7, [smpq+negj*4-4+mmsize*2]
76 paddd m0, m1 ; p += c * s
84 psrad m0, m3 ; p >>= shift
88 movu m5, [smpq+mmsize]
89 movu m7, [smpq+mmsize*2]
90 psubd m1, m0 ; smp[i] - p
93 movu [resq], m1 ; res[i] = smp[i] - (p >> shift)
94 movu [resq+mmsize], m5
95 movu [resq+mmsize*2], m7
99 sub length, (3*mmsize)/4