diff options
Diffstat (limited to 'media')
180 files changed, 6422 insertions, 14361 deletions
diff --git a/media/ffvpx/config_override.h b/media/ffvpx/config_override.h index 5408abdd1a..20e80bb169 100644 --- a/media/ffvpx/config_override.h +++ b/media/ffvpx/config_override.h @@ -1,11 +1,9 @@ // This file contains overrides for config.h, that can be platform-specific. -#ifdef MOZ_LIBAV_FFT #undef CONFIG_FFT #undef CONFIG_RDFT #define CONFIG_FFT 1 #define CONFIG_RDFT 1 -#endif // override '#define EXTERN_ASM _' in config_generic.h to allow building with // gcc on arm diff --git a/media/ffvpx/libavcodec/avcodec.symbols b/media/ffvpx/libavcodec/avcodec.symbols index 6a9131322e..43d24bf39b 100644 --- a/media/ffvpx/libavcodec/avcodec.symbols +++ b/media/ffvpx/libavcodec/avcodec.symbols @@ -30,11 +30,9 @@ av_packet_free av_parser_close av_parser_init av_parser_parse2 -#ifdef MOZ_LIBAV_FFT av_rdft_calc av_rdft_end av_rdft_init -#endif av_shrink_packet av_vorbis_parse_frame av_vorbis_parse_frame_flags diff --git a/media/ffvpx/libavcodec/moz.build b/media/ffvpx/libavcodec/moz.build index 420ed702b6..0ba603d172 100644 --- a/media/ffvpx/libavcodec/moz.build +++ b/media/ffvpx/libavcodec/moz.build @@ -22,6 +22,7 @@ SOURCES += [ 'allcodecs.c', 'avcodec.c', 'avdct.c', + 'avfft.c', 'avpacket.c', 'bitstream.c', 'bitstream_filters.c', @@ -145,11 +146,6 @@ else: CXXFLAGS += CONFIG["MOZ_LIBVPX_CFLAGS"] OS_LIBS += CONFIG["MOZ_LIBVPX_LIBS"] -if CONFIG['MOZ_LIBAV_FFT']: - SOURCES += [ - 'avfft.c', - ] - SYMBOLS_FILE = 'avcodec.symbols' NoVisibilityFlags() diff --git a/media/ffvpx/libavutil/moz.build b/media/ffvpx/libavutil/moz.build index f498eb677e..4839375c10 100644 --- a/media/ffvpx/libavutil/moz.build +++ b/media/ffvpx/libavutil/moz.build @@ -75,6 +75,10 @@ if not CONFIG['MOZ_FFVPX_AUDIOONLY']: ] USE_LIBS += ['mozva'] +EXPORTS.ffvpx = [ + "tx.h" +] + SYMBOLS_FILE = 'avutil.symbols' NoVisibilityFlags() diff --git a/media/kiss_fft/CHANGELOG b/media/kiss_fft/CHANGELOG deleted file mode 100644 index 2dd3603755..0000000000 --- a/media/kiss_fft/CHANGELOG +++ /dev/null @@ -1,123 +0,0 @@ -1.3.0 2012-07-18 - removed non-standard malloc.h from kiss_fft.h - - moved -lm to end of link line - - checked various return values - - converted python Numeric code to NumPy - - fixed test of int32_t on 64 bit OS - - added padding in a couple of places to allow SIMD alignment of structs - -1.2.9 2010-05-27 - threadsafe ( including OpenMP ) - - first edition of kissfft.hh the C++ template fft engine - -1.2.8 - Changed memory.h to string.h -- apparently more standard - - Added openmp extensions. This can have fairly linear speedups for larger FFT sizes. - -1.2.7 - Shrank the real-fft memory footprint. Thanks to Galen Seitz. - -1.2.6 (Nov 14, 2006) The "thanks to GenArts" release. - Added multi-dimensional real-optimized FFT, see tools/kiss_fftndr - Thanks go to GenArts, Inc. for sponsoring the development. - -1.2.5 (June 27, 2006) The "release for no good reason" release. - Changed some harmless code to make some compilers' warnings go away. - Added some more digits to pi -- why not. - Added kiss_fft_next_fast_size() function to help people decide how much to pad. - Changed multidimensional test from 8 dimensions to only 3 to avoid testing - problems with fixed point (sorry Buckaroo Banzai). - -1.2.4 (Oct 27, 2005) The "oops, inverse fixed point real fft was borked" release. - Fixed scaling bug for inverse fixed point real fft -- also fixed test code that should've been failing. - Thanks to Jean-Marc Valin for bug report. - - Use sys/types.h for more portable types than short,int,long => int16_t,int32_t,int64_t - If your system does not have these, you may need to define them -- but at least it breaks in a - loud and easily fixable way -- unlike silently using the wrong size type. - - Hopefully tools/psdpng.c is fixed -- thanks to Steve Kellog for pointing out the weirdness. - -1.2.3 (June 25, 2005) The "you want to use WHAT as a sample" release. - Added ability to use 32 bit fixed point samples -- requires a 64 bit intermediate result, a la 'long long' - - Added ability to do 4 FFTs in parallel by using SSE SIMD instructions. This is accomplished by - using the __m128 (vector of 4 floats) as kiss_fft_scalar. Define USE_SIMD to use this. - - I know, I know ... this is drifting a bit from the "kiss" principle, but the speed advantages - make it worth it for some. Also recent gcc makes it SOO easy to use vectors of 4 floats like a POD type. - -1.2.2 (May 6, 2005) The Matthew release - Replaced fixed point division with multiply&shift. Thanks to Jean-Marc Valin for - discussions regarding. Considerable speedup for fixed-point. - - Corrected overflow protection in real fft routines when using fixed point. - Finder's Credit goes to Robert Oschler of robodance for pointing me at the bug. - This also led to the CHECK_OVERFLOW_OP macro. - -1.2.1 (April 4, 2004) - compiles cleanly with just about every -W warning flag under the sun - - reorganized kiss_fft_state so it could be read-only/const. This may be useful for embedded systems - that are willing to predeclare twiddle factors, factorization. - - Fixed C_MUL,S_MUL on 16-bit platforms. - - tmpbuf will only be allocated if input & output buffers are same - scratchbuf will only be allocated for ffts that are not multiples of 2,3,5 - - NOTE: The tmpbuf,scratchbuf changes may require synchronization code for multi-threaded apps. - - -1.2 (Feb 23, 2004) - interface change -- cfg object is forward declaration of struct instead of void* - This maintains type saftey and lets the compiler warn/error about stupid mistakes. - (prompted by suggestion from Erik de Castro Lopo) - - small speed improvements - - added psdpng.c -- sample utility that will create png spectrum "waterfalls" from an input file - ( not terribly useful yet) - -1.1.1 (Feb 1, 2004 ) - minor bug fix -- only affects odd rank, in-place, multi-dimensional FFTs - -1.1 : (Jan 30,2004) - split sample_code/ into test/ and tools/ - - Removed 2-D fft and added N-D fft (arbitrary) - - modified fftutil.c to allow multi-d FFTs - - Modified core fft routine to allow an input stride via kiss_fft_stride() - (eased support of multi-D ffts) - - Added fast convolution filtering (FIR filtering using overlap-scrap method, with tail scrap) - - Add kfc.[ch]: the KISS FFT Cache. It takes care of allocs for you ( suggested by Oscar Lesta ). - -1.0.1 (Dec 15, 2003) - fixed bug that occurred when nfft==1. Thanks to Steven Johnson. - -1.0 : (Dec 14, 2003) - changed kiss_fft function from using a single buffer, to two buffers. - If the same buffer pointer is supplied for both in and out, kiss will - manage the buffer copies. - - added kiss_fft2d and kiss_fftr as separate source files (declarations in kiss_fft.h ) - -0.4 :(Nov 4,2003) optimized for radix 2,3,4,5 - -0.3 :(Oct 28, 2003) woops, version 2 didn't actually factor out any radices other than 2. - Thanks to Steven Johnson for finding this one. - -0.2 :(Oct 27, 2003) added mixed radix, only radix 2,4 optimized versions - -0.1 :(May 19 2003) initial release, radix 2 only diff --git a/media/kiss_fft/COPYING b/media/kiss_fft/COPYING deleted file mode 100644 index 2fc6685a6d..0000000000 --- a/media/kiss_fft/COPYING +++ /dev/null @@ -1,11 +0,0 @@ -Copyright (c) 2003-2010 Mark Borgerding - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/media/kiss_fft/README b/media/kiss_fft/README deleted file mode 100644 index 03b2e7a9c1..0000000000 --- a/media/kiss_fft/README +++ /dev/null @@ -1,134 +0,0 @@ -KISS FFT - A mixed-radix Fast Fourier Transform based up on the principle, -"Keep It Simple, Stupid." - - There are many great fft libraries already around. Kiss FFT is not trying -to be better than any of them. It only attempts to be a reasonably efficient, -moderately useful FFT that can use fixed or floating data types and can be -incorporated into someone's C program in a few minutes with trivial licensing. - -USAGE: - - The basic usage for 1-d complex FFT is: - - #include "kiss_fft.h" - - kiss_fft_cfg cfg = kiss_fft_alloc( nfft ,is_inverse_fft ,0,0 ); - - while ... - - ... // put kth sample in cx_in[k].r and cx_in[k].i - - kiss_fft( cfg , cx_in , cx_out ); - - ... // transformed. DC is in cx_out[0].r and cx_out[0].i - - free(cfg); - - Note: frequency-domain data is stored from dc up to 2pi. - so cx_out[0] is the dc bin of the FFT - and cx_out[nfft/2] is the Nyquist bin (if exists) - - Declarations are in "kiss_fft.h", along with a brief description of the -functions you'll need to use. - -Code definitions for 1d complex FFTs are in kiss_fft.c. - -You can do other cool stuff with the extras you'll find in tools/ - - * multi-dimensional FFTs - * real-optimized FFTs (returns the positive half-spectrum: (nfft/2+1) complex frequency bins) - * fast convolution FIR filtering (not available for fixed point) - * spectrum image creation - -The core fft and most tools/ code can be compiled to use float, double, - Q15 short or Q31 samples. The default is float. - - -BACKGROUND: - - I started coding this because I couldn't find a fixed point FFT that didn't -use assembly code. I started with floating point numbers so I could get the -theory straight before working on fixed point issues. In the end, I had a -little bit of code that could be recompiled easily to do ffts with short, float -or double (other types should be easy too). - - Once I got my FFT working, I was curious about the speed compared to -a well respected and highly optimized fft library. I don't want to criticize -this great library, so let's call it FFT_BRANDX. -During this process, I learned: - - 1. FFT_BRANDX has more than 100K lines of code. The core of kiss_fft is about 500 lines (cpx 1-d). - 2. It took me an embarrassingly long time to get FFT_BRANDX working. - 3. A simple program using FFT_BRANDX is 522KB. A similar program using kiss_fft is 18KB (without optimizing for size). - 4. FFT_BRANDX is roughly twice as fast as KISS FFT in default mode. - - It is wonderful that free, highly optimized libraries like FFT_BRANDX exist. -But such libraries carry a huge burden of complexity necessary to extract every -last bit of performance. - - Sometimes simpler is better, even if it's not better. - -FREQUENTLY ASKED QUESTIONS: - Q: Can I use kissfft in a project with a ___ license? - A: Yes. See LICENSE below. - - Q: Why don't I get the output I expect? - A: The two most common causes of this are - 1) scaling : is there a constant multiplier between what you got and what you want? - 2) mixed build environment -- all code must be compiled with same preprocessor - definitions for FIXED_POINT and kiss_fft_scalar - - Q: Will you write/debug my code for me? - A: Probably not unless you pay me. I am happy to answer pointed and topical questions, but - I may refer you to a book, a forum, or some other resource. - - -PERFORMANCE: - (on Athlon XP 2100+, with gcc 2.96, float data type) - - Kiss performed 10000 1024-pt cpx ffts in .63 s of cpu time. - For comparison, it took md5sum twice as long to process the same amount of data. - - Transforming 5 minutes of CD quality audio takes less than a second (nfft=1024). - -DO NOT: - ... use Kiss if you need the Fastest Fourier Transform in the World - ... ask me to add features that will bloat the code - -UNDER THE HOOD: - - Kiss FFT uses a time decimation, mixed-radix, out-of-place FFT. If you give it an input buffer - and output buffer that are the same, a temporary buffer will be created to hold the data. - - No static data is used. The core routines of kiss_fft are thread-safe (but not all of the tools directory). - - No scaling is done for the floating point version (for speed). - Scaling is done both ways for the fixed-point version (for overflow prevention). - - Optimized butterflies are used for factors 2,3,4, and 5. - - The real (i.e. not complex) optimization code only works for even length ffts. It does two half-length - FFTs in parallel (packed into real&imag), and then combines them via twiddling. The result is - nfft/2+1 complex frequency bins from DC to Nyquist. If you don't know what this means, search the web. - - The fast convolution filtering uses the overlap-scrap method, slightly - modified to put the scrap at the tail. - -LICENSE: - Revised BSD License, see COPYING for verbiage. - Basically, "free to use&change, give credit where due, no guarantees" - Note this license is compatible with GPL at one end of the spectrum and closed, commercial software at - the other end. See http://www.fsf.org/licensing/licenses - - A commercial license is available which removes the requirement for attribution. Contact me for details. - - -TODO: - *) Add real optimization for odd length FFTs - *) Document/revisit the input/output fft scaling - *) Make doc describing the overlap (tail) scrap fast convolution filtering in kiss_fastfir.c - *) Test all the ./tools/ code with fixed point (kiss_fastfir.c doesn't work, maybe others) - -AUTHOR: - Mark Borgerding - Mark@Borgerding.net diff --git a/media/kiss_fft/README.simd b/media/kiss_fft/README.simd deleted file mode 100644 index b0fdac5506..0000000000 --- a/media/kiss_fft/README.simd +++ /dev/null @@ -1,78 +0,0 @@ -If you are reading this, it means you think you may be interested in using the SIMD extensions in kissfft -to do 4 *separate* FFTs at once. - -Beware! Beyond here there be dragons! - -This API is not easy to use, is not well documented, and breaks the KISS principle. - - -Still reading? Okay, you may get rewarded for your patience with a considerable speedup -(2-3x) on intel x86 machines with SSE if you are willing to jump through some hoops. - -The basic idea is to use the packed 4 float __m128 data type as a scalar element. -This means that the format is pretty convoluted. It performs 4 FFTs per fft call on signals A,B,C,D. - -For complex data, the data is interlaced as follows: -rA0,rB0,rC0,rD0, iA0,iB0,iC0,iD0, rA1,rB1,rC1,rD1, iA1,iB1,iC1,iD1 ... -where "rA0" is the real part of the zeroth sample for signal A - -Real-only data is laid out: -rA0,rB0,rC0,rD0, rA1,rB1,rC1,rD1, ... - -Compile with gcc flags something like --O3 -mpreferred-stack-boundary=4 -DUSE_SIMD=1 -msse - -Be aware of SIMD alignment. This is the most likely cause of segfaults. -The code within kissfft uses scratch variables on the stack. -With SIMD, these must have addresses on 16 byte boundaries. -Search on "SIMD alignment" for more info. - - - -Robin at Divide Concept was kind enough to share his code for formatting to/from the SIMD kissfft. -I have not run it -- use it at your own risk. It appears to do 4xN and Nx4 transpositions -(out of place). - -void SSETools::pack128(float* target, float* source, unsigned long size128) -{ - __m128* pDest = (__m128*)target; - __m128* pDestEnd = pDest+size128; - float* source0=source; - float* source1=source0+size128; - float* source2=source1+size128; - float* source3=source2+size128; - - while(pDest<pDestEnd) - { - *pDest=_mm_set_ps(*source3,*source2,*source1,*source0); - source0++; - source1++; - source2++; - source3++; - pDest++; - } -} - -void SSETools::unpack128(float* target, float* source, unsigned long size128) -{ - - float* pSrc = source; - float* pSrcEnd = pSrc+size128*4; - float* target0=target; - float* target1=target0+size128; - float* target2=target1+size128; - float* target3=target2+size128; - - while(pSrc<pSrcEnd) - { - *target0=pSrc[0]; - *target1=pSrc[1]; - *target2=pSrc[2]; - *target3=pSrc[3]; - target0++; - target1++; - target2++; - target3++; - pSrc+=4; - } -} diff --git a/media/kiss_fft/_kiss_fft_guts.h b/media/kiss_fft/_kiss_fft_guts.h deleted file mode 100644 index ba66144403..0000000000 --- a/media/kiss_fft/_kiss_fft_guts.h +++ /dev/null @@ -1,164 +0,0 @@ -/* -Copyright (c) 2003-2010, Mark Borgerding - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* kiss_fft.h - defines kiss_fft_scalar as either short or a float type - and defines - typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; */ -#include "kiss_fft.h" -#include <limits.h> - -#define MAXFACTORS 32 -/* e.g. an fft of length 128 has 4 factors - as far as kissfft is concerned - 4*4*4*2 - */ - -struct kiss_fft_state{ - int nfft; - int inverse; - int factors[2*MAXFACTORS]; - kiss_fft_cpx twiddles[1]; -}; - -/* - Explanation of macros dealing with complex math: - - C_MUL(m,a,b) : m = a*b - C_FIXDIV( c , div ) : if a fixed point impl., c /= div. noop otherwise - C_SUB( res, a,b) : res = a - b - C_SUBFROM( res , a) : res -= a - C_ADDTO( res , a) : res += a - * */ -#ifdef FIXED_POINT -#if (FIXED_POINT==32) -# define FRACBITS 31 -# define SAMPPROD int64_t -#define SAMP_MAX 2147483647 -#else -# define FRACBITS 15 -# define SAMPPROD int32_t -#define SAMP_MAX 32767 -#endif - -#define SAMP_MIN -SAMP_MAX - -#if defined(CHECK_OVERFLOW) -# define CHECK_OVERFLOW_OP(a,op,b) \ - if ( (SAMPPROD)(a) op (SAMPPROD)(b) > SAMP_MAX || (SAMPPROD)(a) op (SAMPPROD)(b) < SAMP_MIN ) { \ - fprintf(stderr,"WARNING:overflow @ " __FILE__ "(%d): (%d " #op" %d) = %ld\n",__LINE__,(a),(b),(SAMPPROD)(a) op (SAMPPROD)(b) ); } -#endif - - -# define smul(a,b) ( (SAMPPROD)(a)*(b) ) -# define sround( x ) (kiss_fft_scalar)( ( (x) + (1<<(FRACBITS-1)) ) >> FRACBITS ) - -# define S_MUL(a,b) sround( smul(a,b) ) - -# define C_MUL(m,a,b) \ - do{ (m).r = sround( smul((a).r,(b).r) - smul((a).i,(b).i) ); \ - (m).i = sround( smul((a).r,(b).i) + smul((a).i,(b).r) ); }while(0) - -# define DIVSCALAR(x,k) \ - (x) = sround( smul( x, SAMP_MAX/k ) ) - -# define C_FIXDIV(c,div) \ - do { DIVSCALAR( (c).r , div); \ - DIVSCALAR( (c).i , div); }while (0) - -# define C_MULBYSCALAR( c, s ) \ - do{ (c).r = sround( smul( (c).r , s ) ) ;\ - (c).i = sround( smul( (c).i , s ) ) ; }while(0) - -#else /* not FIXED_POINT*/ - -# define S_MUL(a,b) ( (a)*(b) ) -#define C_MUL(m,a,b) \ - do{ (m).r = (a).r*(b).r - (a).i*(b).i;\ - (m).i = (a).r*(b).i + (a).i*(b).r; }while(0) -# define C_FIXDIV(c,div) /* NOOP */ -# define C_MULBYSCALAR( c, s ) \ - do{ (c).r *= (s);\ - (c).i *= (s); }while(0) -#endif - -#ifndef CHECK_OVERFLOW_OP -# define CHECK_OVERFLOW_OP(a,op,b) /* noop */ -#endif - -#define C_ADD( res, a,b)\ - do { \ - CHECK_OVERFLOW_OP((a).r,+,(b).r)\ - CHECK_OVERFLOW_OP((a).i,+,(b).i)\ - (res).r=(a).r+(b).r; (res).i=(a).i+(b).i; \ - }while(0) -#define C_SUB( res, a,b)\ - do { \ - CHECK_OVERFLOW_OP((a).r,-,(b).r)\ - CHECK_OVERFLOW_OP((a).i,-,(b).i)\ - (res).r=(a).r-(b).r; (res).i=(a).i-(b).i; \ - }while(0) -#define C_ADDTO( res , a)\ - do { \ - CHECK_OVERFLOW_OP((res).r,+,(a).r)\ - CHECK_OVERFLOW_OP((res).i,+,(a).i)\ - (res).r += (a).r; (res).i += (a).i;\ - }while(0) - -#define C_SUBFROM( res , a)\ - do {\ - CHECK_OVERFLOW_OP((res).r,-,(a).r)\ - CHECK_OVERFLOW_OP((res).i,-,(a).i)\ - (res).r -= (a).r; (res).i -= (a).i; \ - }while(0) - - -#ifdef FIXED_POINT -# define KISS_FFT_COS(phase) floor(.5+SAMP_MAX * cos (phase)) -# define KISS_FFT_SIN(phase) floor(.5+SAMP_MAX * sin (phase)) -# define HALF_OF(x) ((x)>>1) -#elif defined(USE_SIMD) -# define KISS_FFT_COS(phase) _mm_set1_ps( cos(phase) ) -# define KISS_FFT_SIN(phase) _mm_set1_ps( sin(phase) ) -# define HALF_OF(x) ((x)*_mm_set1_ps(.5)) -#else -# define KISS_FFT_COS(phase) (kiss_fft_scalar) cos(phase) -# define KISS_FFT_SIN(phase) (kiss_fft_scalar) sin(phase) -# define HALF_OF(x) ((x)*.5) -#endif - -#define kf_cexp(x,phase) \ - do{ \ - (x)->r = KISS_FFT_COS(phase);\ - (x)->i = KISS_FFT_SIN(phase);\ - }while(0) - - -/* a debugging function */ -#define pcpx(c)\ - fprintf(stderr,"%g + %gi\n",(double)((c)->r),(double)((c)->i) ) - - -#ifdef KISS_FFT_USE_ALLOCA -// define this to allow use of alloca instead of malloc for temporary buffers -// Temporary buffers are used in two case: -// 1. FFT sizes that have "bad" factors. i.e. not 2,3 and 5 -// 2. "in-place" FFTs. Notice the quotes, since kissfft does not really do an in-place transform. -#include <alloca.h> -#define KISS_FFT_TMP_ALLOC(nbytes) alloca(nbytes) -#define KISS_FFT_TMP_FREE(ptr) -#else -#define KISS_FFT_TMP_ALLOC(nbytes) KISS_FFT_MALLOC(nbytes) -#define KISS_FFT_TMP_FREE(ptr) KISS_FFT_FREE(ptr) -#endif diff --git a/media/kiss_fft/kiss_fft.c b/media/kiss_fft/kiss_fft.c deleted file mode 100644 index 465d6c97a0..0000000000 --- a/media/kiss_fft/kiss_fft.c +++ /dev/null @@ -1,408 +0,0 @@ -/* -Copyright (c) 2003-2010, Mark Borgerding - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#include "_kiss_fft_guts.h" -/* The guts header contains all the multiplication and addition macros that are defined for - fixed or floating point complex numbers. It also delares the kf_ internal functions. - */ - -static void kf_bfly2( - kiss_fft_cpx * Fout, - const size_t fstride, - const kiss_fft_cfg st, - int m - ) -{ - kiss_fft_cpx * Fout2; - kiss_fft_cpx * tw1 = st->twiddles; - kiss_fft_cpx t; - Fout2 = Fout + m; - do{ - C_FIXDIV(*Fout,2); C_FIXDIV(*Fout2,2); - - C_MUL (t, *Fout2 , *tw1); - tw1 += fstride; - C_SUB( *Fout2 , *Fout , t ); - C_ADDTO( *Fout , t ); - ++Fout2; - ++Fout; - }while (--m); -} - -static void kf_bfly4( - kiss_fft_cpx * Fout, - const size_t fstride, - const kiss_fft_cfg st, - const size_t m - ) -{ - kiss_fft_cpx *tw1,*tw2,*tw3; - kiss_fft_cpx scratch[6]; - size_t k=m; - const size_t m2=2*m; - const size_t m3=3*m; - - - tw3 = tw2 = tw1 = st->twiddles; - - do { - C_FIXDIV(*Fout,4); C_FIXDIV(Fout[m],4); C_FIXDIV(Fout[m2],4); C_FIXDIV(Fout[m3],4); - - C_MUL(scratch[0],Fout[m] , *tw1 ); - C_MUL(scratch[1],Fout[m2] , *tw2 ); - C_MUL(scratch[2],Fout[m3] , *tw3 ); - - C_SUB( scratch[5] , *Fout, scratch[1] ); - C_ADDTO(*Fout, scratch[1]); - C_ADD( scratch[3] , scratch[0] , scratch[2] ); - C_SUB( scratch[4] , scratch[0] , scratch[2] ); - C_SUB( Fout[m2], *Fout, scratch[3] ); - tw1 += fstride; - tw2 += fstride*2; - tw3 += fstride*3; - C_ADDTO( *Fout , scratch[3] ); - - if(st->inverse) { - Fout[m].r = scratch[5].r - scratch[4].i; - Fout[m].i = scratch[5].i + scratch[4].r; - Fout[m3].r = scratch[5].r + scratch[4].i; - Fout[m3].i = scratch[5].i - scratch[4].r; - }else{ - Fout[m].r = scratch[5].r + scratch[4].i; - Fout[m].i = scratch[5].i - scratch[4].r; - Fout[m3].r = scratch[5].r - scratch[4].i; - Fout[m3].i = scratch[5].i + scratch[4].r; - } - ++Fout; - }while(--k); -} - -static void kf_bfly3( - kiss_fft_cpx * Fout, - const size_t fstride, - const kiss_fft_cfg st, - size_t m - ) -{ - size_t k=m; - const size_t m2 = 2*m; - kiss_fft_cpx *tw1,*tw2; - kiss_fft_cpx scratch[5]; - kiss_fft_cpx epi3; - epi3 = st->twiddles[fstride*m]; - - tw1=tw2=st->twiddles; - - do{ - C_FIXDIV(*Fout,3); C_FIXDIV(Fout[m],3); C_FIXDIV(Fout[m2],3); - - C_MUL(scratch[1],Fout[m] , *tw1); - C_MUL(scratch[2],Fout[m2] , *tw2); - - C_ADD(scratch[3],scratch[1],scratch[2]); - C_SUB(scratch[0],scratch[1],scratch[2]); - tw1 += fstride; - tw2 += fstride*2; - - Fout[m].r = Fout->r - HALF_OF(scratch[3].r); - Fout[m].i = Fout->i - HALF_OF(scratch[3].i); - - C_MULBYSCALAR( scratch[0] , epi3.i ); - - C_ADDTO(*Fout,scratch[3]); - - Fout[m2].r = Fout[m].r + scratch[0].i; - Fout[m2].i = Fout[m].i - scratch[0].r; - - Fout[m].r -= scratch[0].i; - Fout[m].i += scratch[0].r; - - ++Fout; - }while(--k); -} - -static void kf_bfly5( - kiss_fft_cpx * Fout, - const size_t fstride, - const kiss_fft_cfg st, - int m - ) -{ - kiss_fft_cpx *Fout0,*Fout1,*Fout2,*Fout3,*Fout4; - int u; - kiss_fft_cpx scratch[13]; - kiss_fft_cpx * twiddles = st->twiddles; - kiss_fft_cpx *tw; - kiss_fft_cpx ya,yb; - ya = twiddles[fstride*m]; - yb = twiddles[fstride*2*m]; - - Fout0=Fout; - Fout1=Fout0+m; - Fout2=Fout0+2*m; - Fout3=Fout0+3*m; - Fout4=Fout0+4*m; - - tw=st->twiddles; - for ( u=0; u<m; ++u ) { - C_FIXDIV( *Fout0,5); C_FIXDIV( *Fout1,5); C_FIXDIV( *Fout2,5); C_FIXDIV( *Fout3,5); C_FIXDIV( *Fout4,5); - scratch[0] = *Fout0; - - C_MUL(scratch[1] ,*Fout1, tw[u*fstride]); - C_MUL(scratch[2] ,*Fout2, tw[2*u*fstride]); - C_MUL(scratch[3] ,*Fout3, tw[3*u*fstride]); - C_MUL(scratch[4] ,*Fout4, tw[4*u*fstride]); - - C_ADD( scratch[7],scratch[1],scratch[4]); - C_SUB( scratch[10],scratch[1],scratch[4]); - C_ADD( scratch[8],scratch[2],scratch[3]); - C_SUB( scratch[9],scratch[2],scratch[3]); - - Fout0->r += scratch[7].r + scratch[8].r; - Fout0->i += scratch[7].i + scratch[8].i; - - scratch[5].r = scratch[0].r + S_MUL(scratch[7].r,ya.r) + S_MUL(scratch[8].r,yb.r); - scratch[5].i = scratch[0].i + S_MUL(scratch[7].i,ya.r) + S_MUL(scratch[8].i,yb.r); - - scratch[6].r = S_MUL(scratch[10].i,ya.i) + S_MUL(scratch[9].i,yb.i); - scratch[6].i = -S_MUL(scratch[10].r,ya.i) - S_MUL(scratch[9].r,yb.i); - - C_SUB(*Fout1,scratch[5],scratch[6]); - C_ADD(*Fout4,scratch[5],scratch[6]); - - scratch[11].r = scratch[0].r + S_MUL(scratch[7].r,yb.r) + S_MUL(scratch[8].r,ya.r); - scratch[11].i = scratch[0].i + S_MUL(scratch[7].i,yb.r) + S_MUL(scratch[8].i,ya.r); - scratch[12].r = - S_MUL(scratch[10].i,yb.i) + S_MUL(scratch[9].i,ya.i); - scratch[12].i = S_MUL(scratch[10].r,yb.i) - S_MUL(scratch[9].r,ya.i); - - C_ADD(*Fout2,scratch[11],scratch[12]); - C_SUB(*Fout3,scratch[11],scratch[12]); - - ++Fout0;++Fout1;++Fout2;++Fout3;++Fout4; - } -} - -/* perform the butterfly for one stage of a mixed radix FFT */ -static void kf_bfly_generic( - kiss_fft_cpx * Fout, - const size_t fstride, - const kiss_fft_cfg st, - int m, - int p - ) -{ - int u,k,q1,q; - kiss_fft_cpx * twiddles = st->twiddles; - kiss_fft_cpx t; - int Norig = st->nfft; - - kiss_fft_cpx * scratch = (kiss_fft_cpx*)KISS_FFT_TMP_ALLOC(sizeof(kiss_fft_cpx)*p); - - for ( u=0; u<m; ++u ) { - k=u; - for ( q1=0 ; q1<p ; ++q1 ) { - scratch[q1] = Fout[ k ]; - C_FIXDIV(scratch[q1],p); - k += m; - } - - k=u; - for ( q1=0 ; q1<p ; ++q1 ) { - int twidx=0; - Fout[ k ] = scratch[0]; - for (q=1;q<p;++q ) { - twidx += fstride * k; - if (twidx>=Norig) twidx-=Norig; - C_MUL(t,scratch[q] , twiddles[twidx] ); - C_ADDTO( Fout[ k ] ,t); - } - k += m; - } - } - KISS_FFT_TMP_FREE(scratch); -} - -static -void kf_work( - kiss_fft_cpx * Fout, - const kiss_fft_cpx * f, - const size_t fstride, - int in_stride, - int * factors, - const kiss_fft_cfg st - ) -{ - kiss_fft_cpx * Fout_beg=Fout; - const int p=*factors++; /* the radix */ - const int m=*factors++; /* stage's fft length/p */ - const kiss_fft_cpx * Fout_end = Fout + p*m; - -#ifdef _OPENMP - // use openmp extensions at the - // top-level (not recursive) - if (fstride==1 && p<=5) - { - int k; - - // execute the p different work units in different threads -# pragma omp parallel for - for (k=0;k<p;++k) - kf_work( Fout +k*m, f+ fstride*in_stride*k,fstride*p,in_stride,factors,st); - // all threads have joined by this point - - switch (p) { - case 2: kf_bfly2(Fout,fstride,st,m); break; - case 3: kf_bfly3(Fout,fstride,st,m); break; - case 4: kf_bfly4(Fout,fstride,st,m); break; - case 5: kf_bfly5(Fout,fstride,st,m); break; - default: kf_bfly_generic(Fout,fstride,st,m,p); break; - } - return; - } -#endif - - if (m==1) { - do{ - *Fout = *f; - f += fstride*in_stride; - }while(++Fout != Fout_end ); - }else{ - do{ - // recursive call: - // DFT of size m*p performed by doing - // p instances of smaller DFTs of size m, - // each one takes a decimated version of the input - kf_work( Fout , f, fstride*p, in_stride, factors,st); - f += fstride*in_stride; - }while( (Fout += m) != Fout_end ); - } - - Fout=Fout_beg; - - // recombine the p smaller DFTs - switch (p) { - case 2: kf_bfly2(Fout,fstride,st,m); break; - case 3: kf_bfly3(Fout,fstride,st,m); break; - case 4: kf_bfly4(Fout,fstride,st,m); break; - case 5: kf_bfly5(Fout,fstride,st,m); break; - default: kf_bfly_generic(Fout,fstride,st,m,p); break; - } -} - -/* facbuf is populated by p1,m1,p2,m2, ... - where - p[i] * m[i] = m[i-1] - m0 = n */ -static -void kf_factor(int n,int * facbuf) -{ - int p=4; - double floor_sqrt; - floor_sqrt = floor( sqrt((double)n) ); - - /*factor out powers of 4, powers of 2, then any remaining primes */ - do { - while (n % p) { - switch (p) { - case 4: p = 2; break; - case 2: p = 3; break; - default: p += 2; break; - } - if (p > floor_sqrt) - p = n; /* no more factors, skip to end */ - } - n /= p; - *facbuf++ = p; - *facbuf++ = n; - } while (n > 1); -} - -/* - * - * User-callable function to allocate all necessary storage space for the fft. - * - * The return value is a contiguous block of memory, allocated with malloc. As such, - * It can be freed with free(), rather than a kiss_fft-specific function. - * */ -kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem ) -{ - kiss_fft_cfg st=NULL; - size_t memneeded = sizeof(struct kiss_fft_state) - + sizeof(kiss_fft_cpx)*(nfft-1); /* twiddle factors*/ - - if ( lenmem==NULL ) { - st = ( kiss_fft_cfg)KISS_FFT_MALLOC( memneeded ); - }else{ - if (mem != NULL && *lenmem >= memneeded) - st = (kiss_fft_cfg)mem; - *lenmem = memneeded; - } - if (st) { - int i; - st->nfft=nfft; - st->inverse = inverse_fft; - - for (i=0;i<nfft;++i) { - const double pi=3.141592653589793238462643383279502884197169399375105820974944; - double phase = -2*pi*i / nfft; - if (st->inverse) - phase *= -1; - kf_cexp(st->twiddles+i, phase ); - } - - kf_factor(nfft,st->factors); - } - return st; -} - - -void kiss_fft_stride(kiss_fft_cfg st,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int in_stride) -{ - if (fin == fout) { - //NOTE: this is not really an in-place FFT algorithm. - //It just performs an out-of-place FFT into a temp buffer - kiss_fft_cpx * tmpbuf = (kiss_fft_cpx*)KISS_FFT_TMP_ALLOC( sizeof(kiss_fft_cpx)*st->nfft); - kf_work(tmpbuf,fin,1,in_stride, st->factors,st); - memcpy(fout,tmpbuf,sizeof(kiss_fft_cpx)*st->nfft); - KISS_FFT_TMP_FREE(tmpbuf); - }else{ - kf_work( fout, fin, 1,in_stride, st->factors,st ); - } -} - -void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout) -{ - kiss_fft_stride(cfg,fin,fout,1); -} - - -void kiss_fft_cleanup(void) -{ - // nothing needed any more -} - -int kiss_fft_next_fast_size(int n) -{ - while(1) { - int m=n; - while ( (m%2) == 0 ) m/=2; - while ( (m%3) == 0 ) m/=3; - while ( (m%5) == 0 ) m/=5; - if (m<=1) - break; /* n is completely factorable by twos, threes, and fives */ - n++; - } - return n; -} diff --git a/media/kiss_fft/kiss_fft.h b/media/kiss_fft/kiss_fft.h deleted file mode 100644 index 64c50f4aae..0000000000 --- a/media/kiss_fft/kiss_fft.h +++ /dev/null @@ -1,124 +0,0 @@ -#ifndef KISS_FFT_H -#define KISS_FFT_H - -#include <stdlib.h> -#include <stdio.h> -#include <math.h> -#include <string.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* - ATTENTION! - If you would like a : - -- a utility that will handle the caching of fft objects - -- real-only (no imaginary time component ) FFT - -- a multi-dimensional FFT - -- a command-line utility to perform ffts - -- a command-line utility to perform fast-convolution filtering - - Then see kfc.h kiss_fftr.h kiss_fftnd.h fftutil.c kiss_fastfir.c - in the tools/ directory. -*/ - -#ifdef USE_SIMD -# include <xmmintrin.h> -# define kiss_fft_scalar __m128 -#define KISS_FFT_MALLOC(nbytes) _mm_malloc(nbytes,16) -#define KISS_FFT_FREE _mm_free -#else -#define KISS_FFT_MALLOC malloc -#define KISS_FFT_FREE free -#endif - - -#ifdef FIXED_POINT -#include <sys/types.h> -# if (FIXED_POINT == 32) -# define kiss_fft_scalar int32_t -# else -# define kiss_fft_scalar int16_t -# endif -#else -# ifndef kiss_fft_scalar -/* default is float */ -# define kiss_fft_scalar float -# endif -#endif - -typedef struct { - kiss_fft_scalar r; - kiss_fft_scalar i; -}kiss_fft_cpx; - -typedef struct kiss_fft_state* kiss_fft_cfg; - -/* - * kiss_fft_alloc - * - * Initialize a FFT (or IFFT) algorithm's cfg/state buffer. - * - * typical usage: kiss_fft_cfg mycfg=kiss_fft_alloc(1024,0,NULL,NULL); - * - * The return value from fft_alloc is a cfg buffer used internally - * by the fft routine or NULL. - * - * If lenmem is NULL, then kiss_fft_alloc will allocate a cfg buffer using malloc. - * The returned value should be free()d when done to avoid memory leaks. - * - * The state can be placed in a user supplied buffer 'mem': - * If lenmem is not NULL and mem is not NULL and *lenmem is large enough, - * then the function places the cfg in mem and the size used in *lenmem - * and returns mem. - * - * If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough), - * then the function returns NULL and places the minimum cfg - * buffer size in *lenmem. - * */ - -kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem); - -/* - * kiss_fft(cfg,in_out_buf) - * - * Perform an FFT on a complex input buffer. - * for a forward FFT, - * fin should be f[0] , f[1] , ... ,f[nfft-1] - * fout will be F[0] , F[1] , ... ,F[nfft-1] - * Note that each element is complex and can be accessed like - f[k].r and f[k].i - * */ -void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout); - -/* - A more generic version of the above function. It reads its input from every Nth sample. - * */ -void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride); - -/* If kiss_fft_alloc allocated a buffer, it is one contiguous - buffer and can be simply free()d when no longer needed*/ -#define kiss_fft_free free - -/* - Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up - your compiler output to call this before you exit. -*/ -void kiss_fft_cleanup(void); - - -/* - * Returns the smallest integer k, such that k>=n and k has only "fast" factors (2,3,5) - */ -int kiss_fft_next_fast_size(int n); - -/* for real ffts, we need an even size */ -#define kiss_fftr_next_fast_size_real(n) \ - (kiss_fft_next_fast_size( ((n)+1)>>1)<<1) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/media/kiss_fft/kiss_fftr.c b/media/kiss_fft/kiss_fftr.c deleted file mode 100644 index b8e238b1e2..0000000000 --- a/media/kiss_fft/kiss_fftr.c +++ /dev/null @@ -1,159 +0,0 @@ -/* -Copyright (c) 2003-2004, Mark Borgerding - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "kiss_fftr.h" -#include "_kiss_fft_guts.h" - -struct kiss_fftr_state{ - kiss_fft_cfg substate; - kiss_fft_cpx * tmpbuf; - kiss_fft_cpx * super_twiddles; -#ifdef USE_SIMD - void * pad; -#endif -}; - -kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem) -{ - int i; - kiss_fftr_cfg st = NULL; - size_t subsize, memneeded; - - if (nfft & 1) { - fprintf(stderr,"Real FFT optimization must be even.\n"); - return NULL; - } - nfft >>= 1; - - kiss_fft_alloc (nfft, inverse_fft, NULL, &subsize); - memneeded = sizeof(struct kiss_fftr_state) + subsize + sizeof(kiss_fft_cpx) * ( nfft * 3 / 2); - - if (lenmem == NULL) { - st = (kiss_fftr_cfg) KISS_FFT_MALLOC (memneeded); - } else { - if (*lenmem >= memneeded) - st = (kiss_fftr_cfg) mem; - *lenmem = memneeded; - } - if (!st) - return NULL; - - st->substate = (kiss_fft_cfg) (st + 1); /*just beyond kiss_fftr_state struct */ - st->tmpbuf = (kiss_fft_cpx *) (((char *) st->substate) + subsize); - st->super_twiddles = st->tmpbuf + nfft; - kiss_fft_alloc(nfft, inverse_fft, st->substate, &subsize); - - for (i = 0; i < nfft/2; ++i) { - double phase = - -3.14159265358979323846264338327 * ((double) (i+1) / nfft + .5); - if (inverse_fft) - phase *= -1; - kf_cexp (st->super_twiddles+i,phase); - } - return st; -} - -void kiss_fftr(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_cpx *freqdata) -{ - /* input buffer timedata is stored row-wise */ - int k,ncfft; - kiss_fft_cpx fpnk,fpk,f1k,f2k,tw,tdc; - - if ( st->substate->inverse) { - fprintf(stderr,"kiss fft usage error: improper alloc\n"); - exit(1); - } - - ncfft = st->substate->nfft; - - /*perform the parallel fft of two real signals packed in real,imag*/ - kiss_fft( st->substate , (const kiss_fft_cpx*)timedata, st->tmpbuf ); - /* The real part of the DC element of the frequency spectrum in st->tmpbuf - * contains the sum of the even-numbered elements of the input time sequence - * The imag part is the sum of the odd-numbered elements - * - * The sum of tdc.r and tdc.i is the sum of the input time sequence. - * yielding DC of input time sequence - * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1... - * yielding Nyquist bin of input time sequence - */ - - tdc.r = st->tmpbuf[0].r; - tdc.i = st->tmpbuf[0].i; - C_FIXDIV(tdc,2); - CHECK_OVERFLOW_OP(tdc.r ,+, tdc.i); - CHECK_OVERFLOW_OP(tdc.r ,-, tdc.i); - freqdata[0].r = tdc.r + tdc.i; - freqdata[ncfft].r = tdc.r - tdc.i; -#ifdef USE_SIMD - freqdata[ncfft].i = freqdata[0].i = _mm_set1_ps(0); -#else - freqdata[ncfft].i = freqdata[0].i = 0; -#endif - - for ( k=1;k <= ncfft/2 ; ++k ) { - fpk = st->tmpbuf[k]; - fpnk.r = st->tmpbuf[ncfft-k].r; - fpnk.i = - st->tmpbuf[ncfft-k].i; - C_FIXDIV(fpk,2); - C_FIXDIV(fpnk,2); - - C_ADD( f1k, fpk , fpnk ); - C_SUB( f2k, fpk , fpnk ); - C_MUL( tw , f2k , st->super_twiddles[k-1]); - - freqdata[k].r = HALF_OF(f1k.r + tw.r); - freqdata[k].i = HALF_OF(f1k.i + tw.i); - freqdata[ncfft-k].r = HALF_OF(f1k.r - tw.r); - freqdata[ncfft-k].i = HALF_OF(tw.i - f1k.i); - } -} - -void kiss_fftri(kiss_fftr_cfg st,const kiss_fft_cpx *freqdata,kiss_fft_scalar *timedata) -{ - /* input buffer timedata is stored row-wise */ - int k, ncfft; - - if (st->substate->inverse == 0) { - fprintf (stderr, "kiss fft usage error: improper alloc\n"); - exit (1); - } - - ncfft = st->substate->nfft; - - st->tmpbuf[0].r = freqdata[0].r + freqdata[ncfft].r; - st->tmpbuf[0].i = freqdata[0].r - freqdata[ncfft].r; - C_FIXDIV(st->tmpbuf[0],2); - - for (k = 1; k <= ncfft / 2; ++k) { - kiss_fft_cpx fk, fnkc, fek, fok, tmp; - fk = freqdata[k]; - fnkc.r = freqdata[ncfft - k].r; - fnkc.i = -freqdata[ncfft - k].i; - C_FIXDIV( fk , 2 ); - C_FIXDIV( fnkc , 2 ); - - C_ADD (fek, fk, fnkc); - C_SUB (tmp, fk, fnkc); - C_MUL (fok, tmp, st->super_twiddles[k-1]); - C_ADD (st->tmpbuf[k], fek, fok); - C_SUB (st->tmpbuf[ncfft - k], fek, fok); -#ifdef USE_SIMD - st->tmpbuf[ncfft - k].i *= _mm_set1_ps(-1.0); -#else - st->tmpbuf[ncfft - k].i *= -1; -#endif - } - kiss_fft (st->substate, st->tmpbuf, (kiss_fft_cpx *) timedata); -} diff --git a/media/kiss_fft/kiss_fftr.h b/media/kiss_fft/kiss_fftr.h deleted file mode 100644 index 72e5a57714..0000000000 --- a/media/kiss_fft/kiss_fftr.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef KISS_FTR_H -#define KISS_FTR_H - -#include "kiss_fft.h" -#ifdef __cplusplus -extern "C" { -#endif - - -/* - - Real optimized version can save about 45% cpu time vs. complex fft of a real seq. - - - - */ - -typedef struct kiss_fftr_state *kiss_fftr_cfg; - - -kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem); -/* - nfft must be even - - If you don't care to allocate space, use mem = lenmem = NULL -*/ - - -void kiss_fftr(kiss_fftr_cfg cfg,const kiss_fft_scalar *timedata,kiss_fft_cpx *freqdata); -/* - input timedata has nfft scalar points - output freqdata has nfft/2+1 complex points -*/ - -void kiss_fftri(kiss_fftr_cfg cfg,const kiss_fft_cpx *freqdata,kiss_fft_scalar *timedata); -/* - input freqdata has nfft/2+1 complex points - output timedata has nfft scalar points -*/ - -#define kiss_fftr_free free - -#ifdef __cplusplus -} -#endif -#endif diff --git a/media/kiss_fft/moz.build b/media/kiss_fft/moz.build deleted file mode 100644 index c3574c091d..0000000000 --- a/media/kiss_fft/moz.build +++ /dev/null @@ -1,20 +0,0 @@ -# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -with Files("**"): - BUG_COMPONENT = ("Core", "Web Audio") - -EXPORTS.kiss_fft += [ - 'kiss_fft.h', - 'kiss_fftr.h', -] - -SOURCES += [ - 'kiss_fft.c', - 'kiss_fftr.c', -] - -FINAL_LIBRARY = 'xul' diff --git a/media/kiss_fft/moz.yaml b/media/kiss_fft/moz.yaml deleted file mode 100644 index c18228774a..0000000000 --- a/media/kiss_fft/moz.yaml +++ /dev/null @@ -1,49 +0,0 @@ -schema: 1 - -bugzilla: - product: Core - component: "Web Audio" - -origin: - name: kiss_fft - description: A mixed-radix Fast Fourier Transform - - url: https://github.com/mborgerding/kissfft - - release: 1c3d6f5aa9eb2bf2f18641f0a7e3e6f5e523a156 (2017-10-25T13:50:40Z). - revision: 1c3d6f5aa9eb2bf2f18641f0a7e3e6f5e523a156 - - license: BSD-3-Clause - license-file: COPYING - -vendoring: - url: https://github.com/mborgerding/kissfft - source-hosting: github - tracking: commit - - exclude: - - ".*" - - test - - tools/fftutil.c - - tools/psdpng.c - - "tools/kiss_fftnd*" - - tools/kiss_fastfir.c - - "tools/kfc.*" - - "tools/.*" - - TIPS - - kissfft.hh - - tools/Makefile - - Makefile - - keep: - - COPYING - - _kiss_fft_guts.h - - kiss_fft.c - - kiss_fft.h - - tools/kiss_fftr.c - - tools/kiss_fftr.h - - update-actions: - - action: move-dir - from: '{vendor_dir}/tools' - to: '{vendor_dir}' diff --git a/media/libaom/cmakeparser.py b/media/libaom/cmakeparser.py index b93a313bce..261f05fb17 100644 --- a/media/libaom/cmakeparser.py +++ b/media/libaom/cmakeparser.py @@ -83,7 +83,7 @@ def substs(variables, values): # Safe substitute leaves unrecognized variables in place. # We replace them with the empty string. - new_values.append(re.sub('\$\{\w+\}', '', new_value)) + new_values.append(re.sub(r'\$\{\w+\}', '', new_value)) return new_values @@ -240,7 +240,7 @@ def evaluate_boolean(variables, arguments): # If statements can have old-style variables which are not demarcated # like ${VARIABLE}. Attempt to look up the variable both ways. try: - if re.search('\$\{\w+\}', argument): + if re.search(r'\$\{\w+\}', argument): try: t = Template(argument) value = t.substitute(variables) diff --git a/media/libaom/moz.yaml b/media/libaom/moz.yaml index cc01efbd27..b06ee5115a 100644 --- a/media/libaom/moz.yaml +++ b/media/libaom/moz.yaml @@ -20,11 +20,11 @@ origin: # Human-readable identifier for this version/release # Generally "version NNN", "tag SSS", "bookmark SSS" - release: 8cb8ebb5a1b4f8c361baf4cde9a55733ade3e723 (Thu Jan 11 17:13:41 2024 -0800). + release: 11631186b36e96afce18808ebebb17cc23a010ef (Fri Jan 19 23:29:34 2024 +0000). # Revision to pull in # Must be a long or short commit SHA (long preferred) - revision: 8cb8ebb5a1b4f8c361baf4cde9a55733ade3e723 + revision: 11631186b36e96afce18808ebebb17cc23a010ef # The package's license, where possible using the mnemonic from # https://spdx.org/licenses/ diff --git a/media/libcubeb/0003-Only-build-duplex_collection_change_no_unregister-wh.patch b/media/libcubeb/0003-Only-build-duplex_collection_change_no_unregister-wh.patch new file mode 100644 index 0000000000..5d5a954853 --- /dev/null +++ b/media/libcubeb/0003-Only-build-duplex_collection_change_no_unregister-wh.patch @@ -0,0 +1,33 @@ +From 68ef0eb5691aa7b9d634b4d1af85f9d66fdfc06e Mon Sep 17 00:00:00 2001 +From: Mike Hommey <mh@glandium.org> +Date: Thu, 7 Mar 2024 08:01:32 +0900 +Subject: [PATCH] Only build duplex_collection_change_no_unregister when death + tests are supported + +--- + test/test_duplex.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/test/test_duplex.cpp b/test/test_duplex.cpp +index 518f44f..98a6701 100644 +--- a/test/test_duplex.cpp ++++ b/test/test_duplex.cpp +@@ -201,6 +201,7 @@ TEST(cubeb, duplex_collection_change) + ASSERT_EQ(r, CUBEB_OK); + } + ++#ifdef GTEST_HAS_DEATH_TEST + TEST(cubeb, duplex_collection_change_no_unregister) + { + cubeb * ctx; +@@ -221,6 +222,7 @@ TEST(cubeb, duplex_collection_change_no_unregister) + + duplex_collection_change_impl(ctx); + } ++#endif + + long + data_cb_input(cubeb_stream * stream, void * user, const void * inputbuffer, +-- +2.44.0.1.g9765aa7075 + diff --git a/media/libcubeb/moz.yaml b/media/libcubeb/moz.yaml index b81e81dcac..d79e64b5eb 100644 --- a/media/libcubeb/moz.yaml +++ b/media/libcubeb/moz.yaml @@ -19,6 +19,7 @@ vendoring: patches: - 0001-disable-aaudio-before-android-31.patch - 0002-disable-crash-reporter-death-test.patch + - 0003-Only-build-duplex_collection_change_no_unregister-wh.patch skip-vendoring-steps: - update-moz-build exclude: diff --git a/media/libcubeb/test/test_duplex.cpp b/media/libcubeb/test/test_duplex.cpp index 6a7ca98b1f..27d578f8c2 100644 --- a/media/libcubeb/test/test_duplex.cpp +++ b/media/libcubeb/test/test_duplex.cpp @@ -203,6 +203,7 @@ TEST(cubeb, duplex_collection_change) ASSERT_EQ(r, CUBEB_OK); } +#ifdef GTEST_HAS_DEATH_TEST TEST(cubeb, duplex_collection_change_no_unregister) { cubeb * ctx; @@ -225,6 +226,7 @@ TEST(cubeb, duplex_collection_change_no_unregister) duplex_collection_change_impl(ctx); } +#endif long data_cb_input(cubeb_stream * stream, void * user, const void * inputbuffer, diff --git a/media/libdav1d/moz.yaml b/media/libdav1d/moz.yaml index 7814d096dd..22994fc7bf 100644 --- a/media/libdav1d/moz.yaml +++ b/media/libdav1d/moz.yaml @@ -20,11 +20,11 @@ origin: # Human-readable identifier for this version/release # Generally "version NNN", "tag SSS", "bookmark SSS" - release: a6878be7e07114f5a2915ad46300700f0db55197 (2024-01-31T06:04:21.000-05:00). + release: 4796b59fc0a459588183dc2ea199ba1074befc67 (2024-02-18T15:37:04.000+01:00). # Revision to pull in # Must be a long or short commit SHA (long preferred) - revision: a6878be7e07114f5a2915ad46300700f0db55197 + revision: 4796b59fc0a459588183dc2ea199ba1074befc67 # The package's license, where possible using the mnemonic from # https://spdx.org/licenses/ diff --git a/media/libdav1d/vcs_version.h b/media/libdav1d/vcs_version.h index 8667ed8fb2..1ac3f3ded3 100644 --- a/media/libdav1d/vcs_version.h +++ b/media/libdav1d/vcs_version.h @@ -1,2 +1,2 @@ /* auto-generated, do not edit */ -#define DAV1D_VERSION "a6878be7e07114f5a2915ad46300700f0db55197" +#define DAV1D_VERSION "4796b59fc0a459588183dc2ea199ba1074befc67" diff --git a/media/libjxl/moz.build b/media/libjxl/moz.build index a34f7627a6..11469995e7 100644 --- a/media/libjxl/moz.build +++ b/media/libjxl/moz.build @@ -40,7 +40,6 @@ SOURCES += [ "/third_party/jpeg-xl/lib/jxl/decode.cc", "/third_party/jpeg-xl/lib/jxl/entropy_coder.cc", "/third_party/jpeg-xl/lib/jxl/epf.cc", - "/third_party/jpeg-xl/lib/jxl/fast_dct.cc", "/third_party/jpeg-xl/lib/jxl/fields.cc", "/third_party/jpeg-xl/lib/jxl/frame_header.cc", "/third_party/jpeg-xl/lib/jxl/headers.cc", @@ -50,6 +49,7 @@ SOURCES += [ "/third_party/jpeg-xl/lib/jxl/image.cc", "/third_party/jpeg-xl/lib/jxl/image_bundle.cc", "/third_party/jpeg-xl/lib/jxl/image_metadata.cc", + "/third_party/jpeg-xl/lib/jxl/image_ops.cc", "/third_party/jpeg-xl/lib/jxl/loop_filter.cc", "/third_party/jpeg-xl/lib/jxl/luminance.cc", "/third_party/jpeg-xl/lib/jxl/memory_manager_internal.cc", diff --git a/media/libjxl/moz.yaml b/media/libjxl/moz.yaml index e860ac63a4..7b8d187ff4 100644 --- a/media/libjxl/moz.yaml +++ b/media/libjxl/moz.yaml @@ -10,9 +10,9 @@ origin: url: https://github.com/libjxl/libjxl - release: 07203da045f6b41f9b3b5b86023fd70b075137f6 (2024-01-29T17:41:05Z). + release: f06a34c77b1bd11bafbe82989241e68c756ccca2 (2024-03-11T15:14:53Z). - revision: 07203da045f6b41f9b3b5b86023fd70b075137f6 + revision: f06a34c77b1bd11bafbe82989241e68c756ccca2 license: Apache-2.0 diff --git a/media/libopus/COPYING b/media/libopus/COPYING index 9c739c34a3..75711467a3 100644 --- a/media/libopus/COPYING +++ b/media/libopus/COPYING @@ -1,7 +1,7 @@ -Copyright 2001-2011 Xiph.Org, Skype Limited, Octasic, +Copyright 2001-2023 Xiph.Org, Skype Limited, Octasic, Jean-Marc Valin, Timothy B. Terriberry, CSIRO, Gregory Maxwell, Mark Borgerding, - Erik de Castro Lopo + Erik de Castro Lopo, Mozilla, Amazon Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/media/libopus/celt/arm/arm_celt_map.c b/media/libopus/celt/arm/arm_celt_map.c index ca988b66f5..cbaea49579 100644 --- a/media/libopus/celt/arm/arm_celt_map.c +++ b/media/libopus/celt/arm/arm_celt_map.c @@ -40,7 +40,8 @@ opus_val32 (*const CELT_INNER_PROD_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *x, c celt_inner_prod_c, /* ARMv4 */ celt_inner_prod_c, /* EDSP */ celt_inner_prod_c, /* Media */ - celt_inner_prod_neon /* NEON */ + celt_inner_prod_neon,/* NEON */ + celt_inner_prod_neon /* DOTPROD */ }; void (*const DUAL_INNER_PROD_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *x, const opus_val16 *y01, const opus_val16 *y02, @@ -48,7 +49,8 @@ void (*const DUAL_INNER_PROD_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *x, const o dual_inner_prod_c, /* ARMv4 */ dual_inner_prod_c, /* EDSP */ dual_inner_prod_c, /* Media */ - dual_inner_prod_neon /* NEON */ + dual_inner_prod_neon,/* NEON */ + dual_inner_prod_neon /* DOTPROD */ }; # endif @@ -61,7 +63,8 @@ opus_val32 (*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *, celt_pitch_xcorr_c, /* ARMv4 */ MAY_HAVE_EDSP(celt_pitch_xcorr), /* EDSP */ MAY_HAVE_MEDIA(celt_pitch_xcorr), /* Media */ - MAY_HAVE_NEON(celt_pitch_xcorr) /* NEON */ + MAY_HAVE_NEON(celt_pitch_xcorr), /* NEON */ + MAY_HAVE_NEON(celt_pitch_xcorr) /* DOTPROD */ }; # endif @@ -72,7 +75,8 @@ void (*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *, celt_pitch_xcorr_c, /* ARMv4 */ celt_pitch_xcorr_c, /* EDSP */ celt_pitch_xcorr_c, /* Media */ - celt_pitch_xcorr_float_neon /* Neon */ + celt_pitch_xcorr_float_neon, /* Neon */ + celt_pitch_xcorr_float_neon /* DOTPROD */ }; # endif # endif /* FIXED_POINT */ @@ -90,6 +94,7 @@ void (*const XCORR_KERNEL_IMPL[OPUS_ARCHMASK + 1])( xcorr_kernel_c, /* EDSP */ xcorr_kernel_c, /* Media */ xcorr_kernel_neon_fixed, /* Neon */ + xcorr_kernel_neon_fixed /* DOTPROD */ }; #endif @@ -101,14 +106,16 @@ int (*const OPUS_FFT_ALLOC_ARCH_IMPL[OPUS_ARCHMASK+1])(kiss_fft_state *st) = { opus_fft_alloc_arch_c, /* ARMv4 */ opus_fft_alloc_arch_c, /* EDSP */ opus_fft_alloc_arch_c, /* Media */ - opus_fft_alloc_arm_neon /* Neon with NE10 library support */ + opus_fft_alloc_arm_neon, /* Neon with NE10 library support */ + opus_fft_alloc_arm_neon /* DOTPROD with NE10 library support */ }; void (*const OPUS_FFT_FREE_ARCH_IMPL[OPUS_ARCHMASK+1])(kiss_fft_state *st) = { opus_fft_free_arch_c, /* ARMv4 */ opus_fft_free_arch_c, /* EDSP */ opus_fft_free_arch_c, /* Media */ - opus_fft_free_arm_neon /* Neon with NE10 */ + opus_fft_free_arm_neon, /* Neon with NE10 */ + opus_fft_free_arm_neon /* DOTPROD with NE10 */ }; # endif /* CUSTOM_MODES */ @@ -118,7 +125,8 @@ void (*const OPUS_FFT[OPUS_ARCHMASK+1])(const kiss_fft_state *cfg, opus_fft_c, /* ARMv4 */ opus_fft_c, /* EDSP */ opus_fft_c, /* Media */ - opus_fft_neon /* Neon with NE10 */ + opus_fft_neon, /* Neon with NE10 */ + opus_fft_neon /* DOTPROD with NE10 */ }; void (*const OPUS_IFFT[OPUS_ARCHMASK+1])(const kiss_fft_state *cfg, @@ -127,7 +135,8 @@ void (*const OPUS_IFFT[OPUS_ARCHMASK+1])(const kiss_fft_state *cfg, opus_ifft_c, /* ARMv4 */ opus_ifft_c, /* EDSP */ opus_ifft_c, /* Media */ - opus_ifft_neon /* Neon with NE10 */ + opus_ifft_neon, /* Neon with NE10 */ + opus_ifft_neon /* DOTPROD with NE10 */ }; void (*const CLT_MDCT_FORWARD_IMPL[OPUS_ARCHMASK+1])(const mdct_lookup *l, @@ -139,7 +148,8 @@ void (*const CLT_MDCT_FORWARD_IMPL[OPUS_ARCHMASK+1])(const mdct_lookup *l, clt_mdct_forward_c, /* ARMv4 */ clt_mdct_forward_c, /* EDSP */ clt_mdct_forward_c, /* Media */ - clt_mdct_forward_neon /* Neon with NE10 */ + clt_mdct_forward_neon, /* Neon with NE10 */ + clt_mdct_forward_neon /* DOTPROD with NE10 */ }; void (*const CLT_MDCT_BACKWARD_IMPL[OPUS_ARCHMASK+1])(const mdct_lookup *l, @@ -151,7 +161,8 @@ void (*const CLT_MDCT_BACKWARD_IMPL[OPUS_ARCHMASK+1])(const mdct_lookup *l, clt_mdct_backward_c, /* ARMv4 */ clt_mdct_backward_c, /* EDSP */ clt_mdct_backward_c, /* Media */ - clt_mdct_backward_neon /* Neon with NE10 */ + clt_mdct_backward_neon, /* Neon with NE10 */ + clt_mdct_backward_neon /* DOTPROD with NE10 */ }; # endif /* HAVE_ARM_NE10 */ diff --git a/media/libopus/celt/arm/armcpu.c b/media/libopus/celt/arm/armcpu.c index c7d16e6d61..06a53435b8 100644 --- a/media/libopus/celt/arm/armcpu.c +++ b/media/libopus/celt/arm/armcpu.c @@ -43,6 +43,7 @@ #define OPUS_CPU_ARM_EDSP_FLAG (1<<OPUS_ARCH_ARM_EDSP) #define OPUS_CPU_ARM_MEDIA_FLAG (1<<OPUS_ARCH_ARM_MEDIA) #define OPUS_CPU_ARM_NEON_FLAG (1<<OPUS_ARCH_ARM_NEON) +#define OPUS_CPU_ARM_DOTPROD_FLAG (1<<OPUS_ARCH_ARM_DOTPROD) #if defined(_MSC_VER) /*For GetExceptionCode() and EXCEPTION_ILLEGAL_INSTRUCTION.*/ @@ -126,6 +127,14 @@ opus_uint32 opus_cpu_capabilities(void) p = strstr(buf, " neon"); if(p != NULL && (p[5] == ' ' || p[5] == '\n')) flags |= OPUS_CPU_ARM_NEON_FLAG; + p = strstr(buf, " asimd"); + if(p != NULL && (p[6] == ' ' || p[6] == '\n')) + flags |= OPUS_CPU_ARM_NEON_FLAG | OPUS_CPU_ARM_MEDIA_FLAG | OPUS_CPU_ARM_EDSP_FLAG; +# endif +# if defined(OPUS_ARM_MAY_HAVE_DOTPROD) + p = strstr(buf, " asimddp"); + if(p != NULL && (p[8] == ' ' || p[8] == '\n')) + flags |= OPUS_CPU_ARM_DOTPROD_FLAG; # endif } # endif @@ -144,10 +153,44 @@ opus_uint32 opus_cpu_capabilities(void) # endif } +#if defined(OPUS_ARM_PRESUME_AARCH64_NEON_INTR) + flags |= OPUS_CPU_ARM_EDSP_FLAG | OPUS_CPU_ARM_MEDIA_FLAG | OPUS_CPU_ARM_NEON_FLAG; +# if defined(OPUS_ARM_PRESUME_DOTPROD) + flags |= OPUS_CPU_ARM_DOTPROD_FLAG; +# endif +#endif + fclose(cpuinfo); } return flags; } + +#elif defined(__APPLE__) +#include <sys/types.h> +#include <sys/sysctl.h> + +opus_uint32 opus_cpu_capabilities(void) +{ + opus_uint32 flags = 0; + +#if defined(OPUS_ARM_MAY_HAVE_DOTPROD) + size_t size = sizeof(uint32_t); + uint32_t value = 0; + if (!sysctlbyname("hw.optional.arm.FEAT_DotProd", &value, &size, NULL, 0) && value) + { + flags |= OPUS_CPU_ARM_DOTPROD_FLAG; + } +#endif + +#if defined(OPUS_ARM_PRESUME_AARCH64_NEON_INTR) + flags |= OPUS_CPU_ARM_EDSP_FLAG | OPUS_CPU_ARM_MEDIA_FLAG | OPUS_CPU_ARM_NEON_FLAG; +# if defined(OPUS_ARM_PRESUME_DOTPROD) + flags |= OPUS_CPU_ARM_DOTPROD_FLAG; +# endif +#endif + return flags; +} + #else /* The feature registers which can tell us what the processor supports are * accessible in priveleged modes only, so we can't have a general user-space @@ -180,7 +223,13 @@ static int opus_select_arch_impl(void) } arch++; - celt_assert(arch == OPUS_ARCH_ARM_NEON); + if(!(flags & OPUS_CPU_ARM_DOTPROD_FLAG)) { + celt_assert(arch == OPUS_ARCH_ARM_NEON); + return arch; + } + arch++; + + celt_assert(arch == OPUS_ARCH_ARM_DOTPROD); return arch; } diff --git a/media/libopus/celt/arm/armcpu.h b/media/libopus/celt/arm/armcpu.h index 820262ff5f..6d5803d81a 100644 --- a/media/libopus/celt/arm/armcpu.h +++ b/media/libopus/celt/arm/armcpu.h @@ -46,6 +46,12 @@ # define MAY_HAVE_NEON(name) MAY_HAVE_MEDIA(name) # endif +# if defined(OPUS_ARM_MAY_HAVE_DOTPROD) +# define MAY_HAVE_DOTPROD(name) name ## _dotprod +# else +# define MAY_HAVE_DOTPROD(name) MAY_HAVE_NEON(name) +# endif + # if defined(OPUS_ARM_PRESUME_EDSP) # define PRESUME_EDSP(name) name ## _edsp # else @@ -64,6 +70,12 @@ # define PRESUME_NEON(name) PRESUME_MEDIA(name) # endif +# if defined(OPUS_ARM_PRESUME_DOTPROD) +# define PRESUME_DOTPROD(name) name ## _dotprod +# else +# define PRESUME_DOTPROD(name) PRESUME_NEON(name) +# endif + # if defined(OPUS_HAVE_RTCD) int opus_select_arch(void); @@ -71,6 +83,7 @@ int opus_select_arch(void); #define OPUS_ARCH_ARM_EDSP (1) #define OPUS_ARCH_ARM_MEDIA (2) #define OPUS_ARCH_ARM_NEON (3) +#define OPUS_ARCH_ARM_DOTPROD (4) # endif diff --git a/media/libopus/celt/arm/celt_neon_intr.c b/media/libopus/celt/arm/celt_neon_intr.c index effda769d0..250f836218 100644 --- a/media/libopus/celt/arm/celt_neon_intr.c +++ b/media/libopus/celt/arm/celt_neon_intr.c @@ -38,6 +38,8 @@ #include "../pitch.h" #if defined(FIXED_POINT) +#include <string.h> + void xcorr_kernel_neon_fixed(const opus_val16 * x, const opus_val16 * y, opus_val32 sum[4], int len) { int j; @@ -47,7 +49,10 @@ void xcorr_kernel_neon_fixed(const opus_val16 * x, const opus_val16 * y, opus_va int16x4_t y0 = vld1_s16(y); y += 4; - for (j = 0; j + 8 <= len; j += 8) + /* This loop loads one y value more than we actually need. + Therefore we have to stop as soon as there are 8 or fewer samples left + (instead of 7), to avoid reading past the end of the array. */ + for (j = 0; j + 8 < len; j += 8) { /* Load x[0...7] */ int16x8_t xx = vld1q_s16(x); @@ -80,23 +85,79 @@ void xcorr_kernel_neon_fixed(const opus_val16 * x, const opus_val16 * y, opus_va x += 8; y += 8; } - - for (; j < len; j++) - { - int16x4_t x0 = vld1_dup_s16(x); /* load next x */ + if (j + 4 < len) { + /* Load x[0...3] */ + int16x4_t x0 = vld1_s16(x); + /* Load y[4...7] */ + int16x4_t y4 = vld1_s16(y); + int32x4_t a0 = vmlal_lane_s16(a, y0, x0, 0); + int16x4_t y1 = vext_s16(y0, y4, 1); + int32x4_t a1 = vmlal_lane_s16(a0, y1, x0, 1); + int16x4_t y2 = vext_s16(y0, y4, 2); + int32x4_t a2 = vmlal_lane_s16(a1, y2, x0, 2); + int16x4_t y3 = vext_s16(y0, y4, 3); + int32x4_t a3 = vmlal_lane_s16(a2, y3, x0, 3); + y0 = y4; + a = a3; + x += 4; + y += 4; + j += 4; + } + if (j + 2 < len) { + /* Load x[0...1] */ + int16x4x2_t xx = vld2_dup_s16(x); + int16x4_t x0 = xx.val[0]; + int16x4_t x1 = xx.val[1]; + /* Load y[4...5]. + We would like to use vld1_dup_s32(), but casting the pointer would + break strict aliasing rules and potentially have alignment issues. + Fortunately the compiler seems capable of translating this memcpy() + and vdup_n_s32() into the equivalent vld1_dup_s32().*/ + int32_t yy; + memcpy(&yy, y, sizeof(yy)); + int16x4_t y4 = vreinterpret_s16_s32(vdup_n_s32(yy)); int32x4_t a0 = vmlal_s16(a, y0, x0); - - int16x4_t y4 = vld1_dup_s16(y); /* load next y */ - y0 = vext_s16(y0, y4, 1); + int16x4_t y1 = vext_s16(y0, y4, 1); + /* Replace bottom copy of {y[5], y[4]} in y4 with {y[3], y[2]} from y0, + using VSRI instead of VEXT, since it's a data-processing + instruction. */ + y0 = vreinterpret_s16_s64(vsri_n_s64(vreinterpret_s64_s16(y4), + vreinterpret_s64_s16(y0), 32)); + int32x4_t a1 = vmlal_s16(a0, y1, x1); + a = a1; + x += 2; + y += 2; + j += 2; + } + if (j + 1 < len) { + /* Load next x. */ + int16x4_t x0 = vld1_dup_s16(x); + int32x4_t a0 = vmlal_s16(a, y0, x0); + /* Load last y. */ + int16x4_t y4 = vld1_dup_s16(y); + y0 = vreinterpret_s16_s64(vsri_n_s64(vreinterpret_s64_s16(y4), + vreinterpret_s64_s16(y0), 16)); a = a0; x++; - y++; } - - vst1q_s32(sum, a); + /* Load last x. */ + int16x4_t x0 = vld1_dup_s16(x); + int32x4_t a0 = vmlal_s16(a, y0, x0); + vst1q_s32(sum, a0); } #else + +#if defined(__ARM_FEATURE_FMA) && defined(__ARM_ARCH_ISA_A64) +/* If we can, force the compiler to use an FMA instruction rather than break + * vmlaq_f32() into fmul/fadd. */ +#ifdef vmlaq_lane_f32 +#undef vmlaq_lane_f32 +#endif +#define vmlaq_lane_f32(a,b,c,lane) vfmaq_lane_f32(a,b,c,lane) +#endif + + /* * Function: xcorr_kernel_neon_float * --------------------------------- diff --git a/media/libopus/celt/arm/pitch_neon_intr.c b/media/libopus/celt/arm/pitch_neon_intr.c index 35cc46e2c2..43885f528c 100644 --- a/media/libopus/celt/arm/pitch_neon_intr.c +++ b/media/libopus/celt/arm/pitch_neon_intr.c @@ -130,6 +130,13 @@ void dual_inner_prod_neon(const opus_val16 *x, const opus_val16 *y01, const opus /* ========================================================================== */ +#ifdef __ARM_FEATURE_FMA +/* If we can, force the compiler to use an FMA instruction rather than break + vmlaq_f32() into fmul/fadd. */ +#define vmlaq_f32(a,b,c) vfmaq_f32(a,b,c) +#endif + + #ifdef OPUS_CHECK_ASM /* This part of code simulates floating-point NEON operations. */ diff --git a/media/libopus/celt/celt.h b/media/libopus/celt/celt.h index 24b6b2b520..2f501951d5 100644 --- a/media/libopus/celt/celt.h +++ b/media/libopus/celt/celt.h @@ -42,6 +42,10 @@ #include "entdec.h" #include "arch.h" +#ifdef ENABLE_DEEP_PLC +#include "lpcnet.h" +#endif + #ifdef __cplusplus extern "C" { #endif @@ -149,6 +153,13 @@ int celt_decoder_get_size(int channels); int celt_decoder_init(CELTDecoder *st, opus_int32 sampling_rate, int channels); +int celt_decode_with_ec_dred(CELTDecoder * OPUS_RESTRICT st, const unsigned char *data, + int len, opus_val16 * OPUS_RESTRICT pcm, int frame_size, ec_dec *dec, int accum +#ifdef ENABLE_DEEP_PLC + ,LPCNetPLCState *lpcnet +#endif + ); + int celt_decode_with_ec(OpusCustomDecoder * OPUS_RESTRICT st, const unsigned char *data, int len, opus_val16 * OPUS_RESTRICT pcm, int frame_size, ec_dec *dec, int accum); @@ -225,23 +236,13 @@ void comb_filter(opus_val32 *y, opus_val32 *x, int T0, int T1, int N, opus_val16 g0, opus_val16 g1, int tapset0, int tapset1, const opus_val16 *window, int overlap, int arch); -#ifdef NON_STATIC_COMB_FILTER_CONST_C -void comb_filter_const_c(opus_val32 *y, opus_val32 *x, int T, int N, - opus_val16 g10, opus_val16 g11, opus_val16 g12); -#endif - -#ifndef OVERRIDE_COMB_FILTER_CONST -# define comb_filter_const(y, x, T, N, g10, g11, g12, arch) \ - ((void)(arch),comb_filter_const_c(y, x, T, N, g10, g11, g12)) -#endif - void init_caps(const CELTMode *m,int *cap,int LM,int C); #ifdef RESYNTH -void deemphasis(celt_sig *in[], opus_val16 *pcm, int N, int C, int downsample, const opus_val16 *coef, celt_sig *mem); +void deemphasis(celt_sig *in[], opus_val16 *pcm, int N, int C, int downsample, const opus_val16 *coef, celt_sig *mem, int accum); void celt_synthesis(const CELTMode *mode, celt_norm *X, celt_sig * out_syn[], opus_val16 *oldBandE, int start, int effEnd, int C, int CC, int isTransient, - int LM, int downsample, int silence); + int LM, int downsample, int silence, int arch); #endif #ifdef __cplusplus diff --git a/media/libopus/celt/celt_decoder.c b/media/libopus/celt/celt_decoder.c index 883dae15d2..743c2031bc 100644 --- a/media/libopus/celt/celt_decoder.c +++ b/media/libopus/celt/celt_decoder.c @@ -51,6 +51,11 @@ #include "celt_lpc.h" #include "vq.h" +#ifdef ENABLE_DEEP_PLC +#include "lpcnet.h" +#include "lpcnet_private.h" +#endif + /* The maximum pitch lag to allow in the pitch-based PLC. It's possible to save CPU time in the PLC pitch search by making this smaller than MAX_PERIOD. The current value corresponds to a pitch of 66.67 Hz. */ @@ -59,9 +64,6 @@ pitch of 480 Hz. */ #define PLC_PITCH_LAG_MIN (100) -#if defined(SMALL_FOOTPRINT) && defined(FIXED_POINT) -#define NORM_ALIASING_HACK -#endif /**********************************************************************/ /* */ /* DECODER */ @@ -69,6 +71,9 @@ /**********************************************************************/ #define DECODE_BUFFER_SIZE 2048 +#define PLC_UPDATE_FRAMES 4 +#define PLC_UPDATE_SAMPLES (PLC_UPDATE_FRAMES*FRAME_SIZE) + /** Decoder state @brief Decoder state */ @@ -82,6 +87,7 @@ struct OpusCustomDecoder { int start, end; int signalling; int disable_inv; + int complexity; int arch; /* Everything beyond this point gets cleared on a reset */ @@ -98,11 +104,18 @@ struct OpusCustomDecoder { opus_val16 postfilter_gain_old; int postfilter_tapset; int postfilter_tapset_old; + int prefilter_and_fold; celt_sig preemph_memD[2]; +#ifdef ENABLE_DEEP_PLC + opus_int16 plc_pcm[PLC_UPDATE_SAMPLES]; + int plc_fill; + float plc_preemphasis_mem; +#endif + celt_sig _decode_mem[1]; /* Size = channels*(DECODE_BUFFER_SIZE+mode->overlap) */ - /* opus_val16 lpc[], Size = channels*LPC_ORDER */ + /* opus_val16 lpc[], Size = channels*CELT_LPC_ORDER */ /* opus_val16 oldEBands[], Size = 2*mode->nbEBands */ /* opus_val16 oldLogE[], Size = 2*mode->nbEBands */ /* opus_val16 oldLogE2[], Size = 2*mode->nbEBands */ @@ -157,7 +170,7 @@ OPUS_CUSTOM_NOSTATIC int opus_custom_decoder_get_size(const CELTMode *mode, int { int size = sizeof(struct CELTDecoder) + (channels*(DECODE_BUFFER_SIZE+mode->overlap)-1)*sizeof(celt_sig) - + channels*LPC_ORDER*sizeof(opus_val16) + + channels*CELT_LPC_ORDER*sizeof(opus_val16) + 4*2*mode->nbEBands*sizeof(opus_val16); return size; } @@ -499,7 +512,100 @@ static int celt_plc_pitch_search(celt_sig *decode_mem[2], int C, int arch) return pitch_index; } -static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM) +static void prefilter_and_fold(CELTDecoder * OPUS_RESTRICT st, int N) +{ + int c; + int CC; + int i; + int overlap; + celt_sig *decode_mem[2]; + const OpusCustomMode *mode; + VARDECL(opus_val32, etmp); + mode = st->mode; + overlap = st->overlap; + CC = st->channels; + ALLOC(etmp, overlap, opus_val32); + c=0; do { + decode_mem[c] = st->_decode_mem + c*(DECODE_BUFFER_SIZE+overlap); + } while (++c<CC); + + c=0; do { + /* Apply the pre-filter to the MDCT overlap for the next frame because + the post-filter will be re-applied in the decoder after the MDCT + overlap. */ + comb_filter(etmp, decode_mem[c]+DECODE_BUFFER_SIZE-N, + st->postfilter_period_old, st->postfilter_period, overlap, + -st->postfilter_gain_old, -st->postfilter_gain, + st->postfilter_tapset_old, st->postfilter_tapset, NULL, 0, st->arch); + + /* Simulate TDAC on the concealed audio so that it blends with the + MDCT of the next frame. */ + for (i=0;i<overlap/2;i++) + { + decode_mem[c][DECODE_BUFFER_SIZE-N+i] = + MULT16_32_Q15(mode->window[i], etmp[overlap-1-i]) + + MULT16_32_Q15(mode->window[overlap-i-1], etmp[i]); + } + } while (++c<CC); +} + +#ifdef ENABLE_DEEP_PLC + +#define SINC_ORDER 48 +/* h=cos(pi/2*abs(sin([-24:24]/48*pi*23./24)).^2); + b=sinc([-24:24]/3*1.02).*h; + b=b/sum(b); */ +static const float sinc_filter[SINC_ORDER+1] = { + 4.2931e-05f, -0.000190293f, -0.000816132f, -0.000637162f, 0.00141662f, 0.00354764f, 0.00184368f, -0.00428274f, + -0.00856105f, -0.0034003f, 0.00930201f, 0.0159616f, 0.00489785f, -0.0169649f, -0.0259484f, -0.00596856f, + 0.0286551f, 0.0405872f, 0.00649994f, -0.0509284f, -0.0716655f, -0.00665212f, 0.134336f, 0.278927f, + 0.339995f, 0.278927f, 0.134336f, -0.00665212f, -0.0716655f, -0.0509284f, 0.00649994f, 0.0405872f, + 0.0286551f, -0.00596856f, -0.0259484f, -0.0169649f, 0.00489785f, 0.0159616f, 0.00930201f, -0.0034003f, + -0.00856105f, -0.00428274f, 0.00184368f, 0.00354764f, 0.00141662f, -0.000637162f, -0.000816132f, -0.000190293f, + 4.2931e-05f +}; + +void update_plc_state(LPCNetPLCState *lpcnet, celt_sig *decode_mem[2], float *plc_preemphasis_mem, int CC) +{ + int i; + int tmp_read_post, tmp_fec_skip; + int offset; + celt_sig buf48k[DECODE_BUFFER_SIZE]; + opus_int16 buf16k[PLC_UPDATE_SAMPLES]; + if (CC == 1) OPUS_COPY(buf48k, decode_mem[0], DECODE_BUFFER_SIZE); + else { + for (i=0;i<DECODE_BUFFER_SIZE;i++) { + buf48k[i] = .5*(decode_mem[0][i] + decode_mem[1][i]); + } + } + /* Down-sample the last 40 ms. */ + for (i=1;i<DECODE_BUFFER_SIZE;i++) buf48k[i] += PREEMPHASIS*buf48k[i-1]; + *plc_preemphasis_mem = buf48k[DECODE_BUFFER_SIZE-1]; + offset = DECODE_BUFFER_SIZE-SINC_ORDER-1 - 3*(PLC_UPDATE_SAMPLES-1); + celt_assert(3*(PLC_UPDATE_SAMPLES-1) + SINC_ORDER + offset == DECODE_BUFFER_SIZE-1); + for (i=0;i<PLC_UPDATE_SAMPLES;i++) { + int j; + float sum = 0; + for (j=0;j<SINC_ORDER+1;j++) { + sum += buf48k[3*i + j + offset]*sinc_filter[j]; + } + buf16k[i] = float2int(MIN32(32767.f, MAX32(-32767.f, sum))); + } + tmp_read_post = lpcnet->fec_read_pos; + tmp_fec_skip = lpcnet->fec_skip; + for (i=0;i<PLC_UPDATE_FRAMES;i++) { + lpcnet_plc_update(lpcnet, &buf16k[FRAME_SIZE*i]); + } + lpcnet->fec_read_pos = tmp_read_post; + lpcnet->fec_skip = tmp_fec_skip; +} +#endif + +static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM +#ifdef ENABLE_DEEP_PLC + ,LPCNetPLCState *lpcnet +#endif + ) { int c; int i; @@ -527,22 +633,22 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM) out_syn[c] = decode_mem[c]+DECODE_BUFFER_SIZE-N; } while (++c<C); lpc = (opus_val16*)(st->_decode_mem+(DECODE_BUFFER_SIZE+overlap)*C); - oldBandE = lpc+C*LPC_ORDER; + oldBandE = lpc+C*CELT_LPC_ORDER; oldLogE = oldBandE + 2*nbEBands; oldLogE2 = oldLogE + 2*nbEBands; backgroundLogE = oldLogE2 + 2*nbEBands; loss_duration = st->loss_duration; start = st->start; +#ifdef ENABLE_DEEP_PLC + noise_based = start != 0 || (lpcnet->fec_fill_pos == 0 && (st->skip_plc || loss_duration >= 80)); +#else noise_based = loss_duration >= 40 || start != 0 || st->skip_plc; +#endif if (noise_based) { /* Noise-based PLC/CNG */ -#ifdef NORM_ALIASING_HACK - celt_norm *X; -#else VARDECL(celt_norm, X); -#endif opus_uint32 seed; int end; int effEnd; @@ -550,18 +656,16 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM) end = st->end; effEnd = IMAX(start, IMIN(end, mode->effEBands)); -#ifdef NORM_ALIASING_HACK - /* This is an ugly hack that breaks aliasing rules and would be easily broken, - but it saves almost 4kB of stack. */ - X = (celt_norm*)(out_syn[C-1]+overlap/2); -#else ALLOC(X, C*N, celt_norm); /**< Interleaved normalised MDCTs */ -#endif c=0; do { OPUS_MOVE(decode_mem[c], decode_mem[c]+N, - DECODE_BUFFER_SIZE-N+(overlap>>1)); + DECODE_BUFFER_SIZE-N+overlap); } while (++c<C); + if (st->prefilter_and_fold) { + prefilter_and_fold(st, N); + } + /* Energy decay */ decay = loss_duration==0 ? QCONST16(1.5f, DB_SHIFT) : QCONST16(.5f, DB_SHIFT); c=0; do @@ -590,6 +694,9 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM) st->rng = seed; celt_synthesis(mode, X, out_syn, oldBandE, start, effEnd, C, C, 0, LM, st->downsample, 0, st->arch); + st->prefilter_and_fold = 0; + /* Skip regular PLC until we get two consecutive packets. */ + st->skip_plc = 1; } else { int exc_length; /* Pitch-based PLC */ @@ -597,12 +704,14 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM) opus_val16 *exc; opus_val16 fade = Q15ONE; int pitch_index; - VARDECL(opus_val32, etmp); VARDECL(opus_val16, _exc); VARDECL(opus_val16, fir_tmp); if (loss_duration == 0) { +#ifdef ENABLE_DEEP_PLC + if (lpcnet->loaded) update_plc_state(lpcnet, decode_mem, &st->plc_preemphasis_mem, C); +#endif st->last_pitch_index = pitch_index = celt_plc_pitch_search(decode_mem, C, st->arch); } else { pitch_index = st->last_pitch_index; @@ -613,10 +722,9 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM) decaying signal, but we can't get more than MAX_PERIOD. */ exc_length = IMIN(2*pitch_index, MAX_PERIOD); - ALLOC(etmp, overlap, opus_val32); - ALLOC(_exc, MAX_PERIOD+LPC_ORDER, opus_val16); + ALLOC(_exc, MAX_PERIOD+CELT_LPC_ORDER, opus_val16); ALLOC(fir_tmp, exc_length, opus_val16); - exc = _exc+LPC_ORDER; + exc = _exc+CELT_LPC_ORDER; window = mode->window; c=0; do { opus_val16 decay; @@ -628,16 +736,16 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM) int j; buf = decode_mem[c]; - for (i=0;i<MAX_PERIOD+LPC_ORDER;i++) - exc[i-LPC_ORDER] = SROUND16(buf[DECODE_BUFFER_SIZE-MAX_PERIOD-LPC_ORDER+i], SIG_SHIFT); + for (i=0;i<MAX_PERIOD+CELT_LPC_ORDER;i++) + exc[i-CELT_LPC_ORDER] = SROUND16(buf[DECODE_BUFFER_SIZE-MAX_PERIOD-CELT_LPC_ORDER+i], SIG_SHIFT); if (loss_duration == 0) { - opus_val32 ac[LPC_ORDER+1]; + opus_val32 ac[CELT_LPC_ORDER+1]; /* Compute LPC coefficients for the last MAX_PERIOD samples before the first loss so we can work in the excitation-filter domain. */ _celt_autocorr(exc, ac, window, overlap, - LPC_ORDER, MAX_PERIOD, st->arch); + CELT_LPC_ORDER, MAX_PERIOD, st->arch); /* Add a noise floor of -40 dB. */ #ifdef FIXED_POINT ac[0] += SHR32(ac[0],13); @@ -645,7 +753,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM) ac[0] *= 1.0001f; #endif /* Use lag windowing to stabilize the Levinson-Durbin recursion. */ - for (i=1;i<=LPC_ORDER;i++) + for (i=1;i<=CELT_LPC_ORDER;i++) { /*ac[i] *= exp(-.5*(2*M_PI*.002*i)*(2*M_PI*.002*i));*/ #ifdef FIXED_POINT @@ -654,7 +762,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM) ac[i] -= ac[i]*(0.008f*0.008f)*i*i; #endif } - _celt_lpc(lpc+c*LPC_ORDER, ac, LPC_ORDER); + _celt_lpc(lpc+c*CELT_LPC_ORDER, ac, CELT_LPC_ORDER); #ifdef FIXED_POINT /* For fixed-point, apply bandwidth expansion until we can guarantee that no overflow can happen in the IIR filter. This means: @@ -662,13 +770,13 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM) while (1) { opus_val16 tmp=Q15ONE; opus_val32 sum=QCONST16(1., SIG_SHIFT); - for (i=0;i<LPC_ORDER;i++) - sum += ABS16(lpc[c*LPC_ORDER+i]); + for (i=0;i<CELT_LPC_ORDER;i++) + sum += ABS16(lpc[c*CELT_LPC_ORDER+i]); if (sum < 65535) break; - for (i=0;i<LPC_ORDER;i++) + for (i=0;i<CELT_LPC_ORDER;i++) { tmp = MULT16_16_Q15(QCONST16(.99f,15), tmp); - lpc[c*LPC_ORDER+i] = MULT16_16_Q15(lpc[c*LPC_ORDER+i], tmp); + lpc[c*CELT_LPC_ORDER+i] = MULT16_16_Q15(lpc[c*CELT_LPC_ORDER+i], tmp); } } #endif @@ -678,8 +786,8 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM) { /* Compute the excitation for exc_length samples before the loss. We need the copy because celt_fir() cannot filter in-place. */ - celt_fir(exc+MAX_PERIOD-exc_length, lpc+c*LPC_ORDER, - fir_tmp, exc_length, LPC_ORDER, st->arch); + celt_fir(exc+MAX_PERIOD-exc_length, lpc+c*CELT_LPC_ORDER, + fir_tmp, exc_length, CELT_LPC_ORDER, st->arch); OPUS_COPY(exc+MAX_PERIOD-exc_length, fir_tmp, exc_length); } @@ -737,15 +845,15 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM) S1 += SHR32(MULT16_16(tmp, tmp), 10); } { - opus_val16 lpc_mem[LPC_ORDER]; + opus_val16 lpc_mem[CELT_LPC_ORDER]; /* Copy the last decoded samples (prior to the overlap region) to synthesis filter memory so we can have a continuous signal. */ - for (i=0;i<LPC_ORDER;i++) + for (i=0;i<CELT_LPC_ORDER;i++) lpc_mem[i] = SROUND16(buf[DECODE_BUFFER_SIZE-N-1-i], SIG_SHIFT); /* Apply the synthesis filter to convert the excitation back into the signal domain. */ - celt_iir(buf+DECODE_BUFFER_SIZE-N, lpc+c*LPC_ORDER, - buf+DECODE_BUFFER_SIZE-N, extrapolation_len, LPC_ORDER, + celt_iir(buf+DECODE_BUFFER_SIZE-N, lpc+c*CELT_LPC_ORDER, + buf+DECODE_BUFFER_SIZE-N, extrapolation_len, CELT_LPC_ORDER, lpc_mem, st->arch); #ifdef FIXED_POINT for (i=0; i < extrapolation_len; i++) @@ -792,23 +900,65 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM) } } - /* Apply the pre-filter to the MDCT overlap for the next frame because - the post-filter will be re-applied in the decoder after the MDCT - overlap. */ - comb_filter(etmp, buf+DECODE_BUFFER_SIZE, - st->postfilter_period, st->postfilter_period, overlap, - -st->postfilter_gain, -st->postfilter_gain, - st->postfilter_tapset, st->postfilter_tapset, NULL, 0, st->arch); - - /* Simulate TDAC on the concealed audio so that it blends with the - MDCT of the next frame. */ - for (i=0;i<overlap/2;i++) - { - buf[DECODE_BUFFER_SIZE+i] = - MULT16_32_Q15(window[i], etmp[overlap-1-i]) - + MULT16_32_Q15(window[overlap-i-1], etmp[i]); - } } while (++c<C); + +#ifdef ENABLE_DEEP_PLC + if (lpcnet->loaded && (st->complexity >= 5 || lpcnet->fec_fill_pos > 0)) { + float overlap_mem; + int samples_needed16k; + celt_sig *buf; + VARDECL(float, buf_copy); + buf = decode_mem[0]; + ALLOC(buf_copy, C*overlap, float); + c=0; do { + OPUS_COPY(buf_copy+c*overlap, &decode_mem[c][DECODE_BUFFER_SIZE-N], overlap); + } while (++c<C); + + /* Need enough samples from the PLC to cover the frame size, resampling delay, + and the overlap at the end. */ + samples_needed16k = (N+SINC_ORDER+overlap)/3; + if (loss_duration == 0) { + st->plc_fill = 0; + } + while (st->plc_fill < samples_needed16k) { + lpcnet_plc_conceal(lpcnet, &st->plc_pcm[st->plc_fill]); + st->plc_fill += FRAME_SIZE; + } + /* Resample to 48 kHz. */ + for (i=0;i<(N+overlap)/3;i++) { + int j; + float sum; + for (sum=0, j=0;j<17;j++) sum += 3*st->plc_pcm[i+j]*sinc_filter[3*j]; + buf[DECODE_BUFFER_SIZE-N+3*i] = sum; + for (sum=0, j=0;j<16;j++) sum += 3*st->plc_pcm[i+j+1]*sinc_filter[3*j+2]; + buf[DECODE_BUFFER_SIZE-N+3*i+1] = sum; + for (sum=0, j=0;j<16;j++) sum += 3*st->plc_pcm[i+j+1]*sinc_filter[3*j+1]; + buf[DECODE_BUFFER_SIZE-N+3*i+2] = sum; + } + OPUS_MOVE(st->plc_pcm, &st->plc_pcm[N/3], st->plc_fill-N/3); + st->plc_fill -= N/3; + for (i=0;i<N;i++) { + float tmp = buf[DECODE_BUFFER_SIZE-N+i]; + buf[DECODE_BUFFER_SIZE-N+i] -= PREEMPHASIS*st->plc_preemphasis_mem; + st->plc_preemphasis_mem = tmp; + } + overlap_mem = st->plc_preemphasis_mem; + for (i=0;i<overlap;i++) { + float tmp = buf[DECODE_BUFFER_SIZE+i]; + buf[DECODE_BUFFER_SIZE+i] -= PREEMPHASIS*overlap_mem; + overlap_mem = tmp; + } + /* For now, we just do mono PLC. */ + if (C==2) OPUS_COPY(decode_mem[1], decode_mem[0], DECODE_BUFFER_SIZE+overlap); + c=0; do { + /* Cross-fade with 48-kHz non-neural PLC for the first 2.5 ms to avoid a discontinuity. */ + if (loss_duration == 0) { + for (i=0;i<overlap;i++) decode_mem[c][DECODE_BUFFER_SIZE-N+i] = (1-window[i])*buf_copy[c*overlap+i] + (window[i])*decode_mem[c][DECODE_BUFFER_SIZE-N+i]; + } + } while (++c<C); + } +#endif + st->prefilter_and_fold = 1; } /* Saturate to soemthing large to avoid wrap-around. */ @@ -817,18 +967,18 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM) RESTORE_STACK; } -int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *data, - int len, opus_val16 * OPUS_RESTRICT pcm, int frame_size, ec_dec *dec, int accum) +int celt_decode_with_ec_dred(CELTDecoder * OPUS_RESTRICT st, const unsigned char *data, + int len, opus_val16 * OPUS_RESTRICT pcm, int frame_size, ec_dec *dec, int accum +#ifdef ENABLE_DEEP_PLC + ,LPCNetPLCState *lpcnet +#endif + ) { int c, i, N; int spread_decision; opus_int32 bits; ec_dec _dec; -#ifdef NORM_ALIASING_HACK - celt_norm *X; -#else VARDECL(celt_norm, X); -#endif VARDECL(int, fine_quant); VARDECL(int, pulses); VARDECL(int, cap); @@ -881,7 +1031,7 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat frame_size *= st->downsample; lpc = (opus_val16*)(st->_decode_mem+(DECODE_BUFFER_SIZE+overlap)*CC); - oldBandE = lpc+CC*LPC_ORDER; + oldBandE = lpc+CC*CELT_LPC_ORDER; oldLogE = oldBandE + 2*nbEBands; oldLogE2 = oldLogE + 2*nbEBands; backgroundLogE = oldLogE2 + 2*nbEBands; @@ -935,15 +1085,25 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat if (data == NULL || len<=1) { - celt_decode_lost(st, N, LM); + celt_decode_lost(st, N, LM +#ifdef ENABLE_DEEP_PLC + , lpcnet +#endif + ); deemphasis(out_syn, pcm, N, CC, st->downsample, mode->preemph, st->preemph_memD, accum); RESTORE_STACK; return frame_size/st->downsample; } +#ifdef ENABLE_DEEP_PLC + else { + /* FIXME: This is a bit of a hack just to make sure opus_decode_native() knows we're no longer in PLC. */ + if (lpcnet) lpcnet->blend = 0; + } +#endif /* Check if there are at least two packets received consecutively before * turning on the pitch-based PLC */ - st->skip_plc = st->loss_duration != 0; + if (st->loss_duration == 0) st->skip_plc = 0; if (dec == NULL) { @@ -1006,6 +1166,36 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat /* Decode the global flags (first symbols in the stream) */ intra_ener = tell+3<=total_bits ? ec_dec_bit_logp(dec, 3) : 0; + /* If recovering from packet loss, make sure we make the energy prediction safe to reduce the + risk of getting loud artifacts. */ + if (!intra_ener && st->loss_duration != 0) { + c=0; do + { + opus_val16 safety = 0; + int missing = IMIN(10, st->loss_duration>>LM); + if (LM==0) safety = QCONST16(1.5f,DB_SHIFT); + else if (LM==1) safety = QCONST16(.5f,DB_SHIFT); + for (i=start;i<end;i++) + { + if (oldBandE[c*nbEBands+i] < MAX16(oldLogE[c*nbEBands+i], oldLogE2[c*nbEBands+i])) { + /* If energy is going down already, continue the trend. */ + opus_val32 slope; + opus_val32 E0, E1, E2; + E0 = oldBandE[c*nbEBands+i]; + E1 = oldLogE[c*nbEBands+i]; + E2 = oldLogE2[c*nbEBands+i]; + slope = MAX32(E1 - E0, HALF32(E2 - E0)); + E0 -= MAX32(0, (1+missing)*slope); + oldBandE[c*nbEBands+i] = MAX32(-QCONST16(20.f,DB_SHIFT), E0); + } else { + /* Otherwise take the min of the last frames. */ + oldBandE[c*nbEBands+i] = MIN16(MIN16(oldBandE[c*nbEBands+i], oldLogE[c*nbEBands+i]), oldLogE2[c*nbEBands+i]); + } + /* Shorter frames have more natural fluctuations -- play it safe. */ + oldBandE[c*nbEBands+i] -= safety; + } + } while (++c<2); + } /* Get band energies */ unquant_coarse_energy(mode, start, end, oldBandE, intra_ener, dec, C, LM); @@ -1073,19 +1263,13 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat unquant_fine_energy(mode, start, end, oldBandE, fine_quant, dec, C); c=0; do { - OPUS_MOVE(decode_mem[c], decode_mem[c]+N, DECODE_BUFFER_SIZE-N+overlap/2); + OPUS_MOVE(decode_mem[c], decode_mem[c]+N, DECODE_BUFFER_SIZE-N+overlap); } while (++c<CC); /* Decode fixed codebook */ ALLOC(collapse_masks, C*nbEBands, unsigned char); -#ifdef NORM_ALIASING_HACK - /* This is an ugly hack that breaks aliasing rules and would be easily broken, - but it saves almost 4kB of stack. */ - X = (celt_norm*)(out_syn[CC-1]+overlap/2); -#else ALLOC(X, C*N, celt_norm); /**< Interleaved normalised MDCTs */ -#endif quant_all_bands(0, mode, start, end, X, C==2 ? X+N : NULL, collapse_masks, NULL, pulses, shortBlocks, spread_decision, dual_stereo, intensity, tf_res, @@ -1109,7 +1293,9 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat for (i=0;i<C*nbEBands;i++) oldBandE[i] = -QCONST16(28.f,DB_SHIFT); } - + if (st->prefilter_and_fold) { + prefilter_and_fold(st, N); + } celt_synthesis(mode, X, out_syn, oldBandE, start, effEnd, C, CC, isTransient, LM, st->downsample, silence, st->arch); @@ -1173,6 +1359,7 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat deemphasis(out_syn, pcm, N, CC, st->downsample, mode->preemph, st->preemph_memD, accum); st->loss_duration = 0; + st->prefilter_and_fold = 0; RESTORE_STACK; if (ec_tell(dec) > 8*len) return OPUS_INTERNAL_ERROR; @@ -1181,6 +1368,15 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat return frame_size/st->downsample; } +int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *data, + int len, opus_val16 * OPUS_RESTRICT pcm, int frame_size, ec_dec *dec, int accum) +{ + return celt_decode_with_ec_dred(st, data, len, pcm, frame_size, dec, accum +#ifdef ENABLE_DEEP_PLC + , NULL +#endif + ); +} #ifdef CUSTOM_MODES @@ -1254,6 +1450,26 @@ int opus_custom_decoder_ctl(CELTDecoder * OPUS_RESTRICT st, int request, ...) va_start(ap, request); switch (request) { + case OPUS_SET_COMPLEXITY_REQUEST: + { + opus_int32 value = va_arg(ap, opus_int32); + if(value<0 || value>10) + { + goto bad_arg; + } + st->complexity = value; + } + break; + case OPUS_GET_COMPLEXITY_REQUEST: + { + opus_int32 *value = va_arg(ap, opus_int32*); + if (!value) + { + goto bad_arg; + } + *value = st->complexity; + } + break; case CELT_SET_START_BAND_REQUEST: { opus_int32 value = va_arg(ap, opus_int32); @@ -1300,7 +1516,7 @@ int opus_custom_decoder_ctl(CELTDecoder * OPUS_RESTRICT st, int request, ...) int i; opus_val16 *lpc, *oldBandE, *oldLogE, *oldLogE2; lpc = (opus_val16*)(st->_decode_mem+(DECODE_BUFFER_SIZE+st->overlap)*st->channels); - oldBandE = lpc+st->channels*LPC_ORDER; + oldBandE = lpc+st->channels*CELT_LPC_ORDER; oldLogE = oldBandE + 2*st->mode->nbEBands; oldLogE2 = oldLogE + 2*st->mode->nbEBands; OPUS_CLEAR((char*)&st->DECODER_RESET_START, diff --git a/media/libopus/celt/celt_encoder.c b/media/libopus/celt/celt_encoder.c index 637d442cf7..7f32a801c6 100644 --- a/media/libopus/celt/celt_encoder.c +++ b/media/libopus/celt/celt_encoder.c @@ -281,6 +281,9 @@ static int transient_analysis(const opus_val32 * OPUS_RESTRICT in, int len, int /* High-pass filter: (1 - 2*z^-1 + z^-2) / (1 - z^-1 + .5*z^-2) */ for (i=0;i<len;i++) { +#ifndef FIXED_POINT + float mem00; +#endif opus_val32 x,y; x = SHR32(in[i+c*len],SIG_SHIFT); y = ADD32(mem0, x); @@ -288,8 +291,13 @@ static int transient_analysis(const opus_val32 * OPUS_RESTRICT in, int len, int mem0 = mem1 + y - SHL32(x,1); mem1 = x - SHR32(y,1); #else + /* Original code: mem0 = mem1 + y - 2*x; mem1 = x - .5f*y; + Modified code to shorten dependency chains: */ + mem00=mem0; + mem0 = mem0 - x + .5f*mem1; + mem1 = x - mem00; #endif tmp[i] = SROUND16(y, 2); /*printf("%f ", tmp[i]);*/ @@ -322,10 +330,11 @@ static int transient_analysis(const opus_val32 * OPUS_RESTRICT in, int len, int #ifdef FIXED_POINT /* FIXME: Use PSHR16() instead */ tmp[i] = mem0 + PSHR32(x2-mem0,forward_shift); + mem0 = tmp[i]; #else - tmp[i] = mem0 + MULT16_16_P15(forward_decay,x2-mem0); + mem0 = x2 + (1.f-forward_decay)*mem0; + tmp[i] = forward_decay*mem0; #endif - mem0 = tmp[i]; } mem0=0; @@ -337,11 +346,13 @@ static int transient_analysis(const opus_val32 * OPUS_RESTRICT in, int len, int #ifdef FIXED_POINT /* FIXME: Use PSHR16() instead */ tmp[i] = mem0 + PSHR32(tmp[i]-mem0,3); -#else - tmp[i] = mem0 + MULT16_16_P15(QCONST16(0.125f,15),tmp[i]-mem0); -#endif mem0 = tmp[i]; maxE = MAX16(maxE, mem0); +#else + mem0 = tmp[i] + 0.875f*mem0; + tmp[i] = 0.125f*mem0; + maxE = MAX16(maxE, 0.125f*mem0); +#endif } /*for (i=0;i<len2;i++)printf("%f ", tmp[i]/mean);printf("\n");*/ @@ -967,7 +978,7 @@ static opus_val16 median_of_3(const opus_val16 *x) return t0; } -static opus_val16 dynalloc_analysis(const opus_val16 *bandLogE, const opus_val16 *bandLogE2, +static opus_val16 dynalloc_analysis(const opus_val16 *bandLogE, const opus_val16 *bandLogE2, const opus_val16 *oldBandE, int nbEBands, int start, int end, int C, int *offsets, int lsb_depth, const opus_int16 *logN, int isTransient, int vbr, int constrained_vbr, const opus_int16 *eBands, int LM, int effectiveBytes, opus_int32 *tot_boost_, int lfe, opus_val16 *surround_dynalloc, @@ -978,9 +989,11 @@ static opus_val16 dynalloc_analysis(const opus_val16 *bandLogE, const opus_val16 opus_val16 maxDepth; VARDECL(opus_val16, follower); VARDECL(opus_val16, noise_floor); + VARDECL(opus_val16, bandLogE3); SAVE_STACK; ALLOC(follower, C*nbEBands, opus_val16); ALLOC(noise_floor, C*nbEBands, opus_val16); + ALLOC(bandLogE3, nbEBands, opus_val16); OPUS_CLEAR(offsets, nbEBands); /* Dynamic allocation code */ maxDepth=-QCONST16(31.9f, DB_SHIFT); @@ -1033,8 +1046,10 @@ static opus_val16 dynalloc_analysis(const opus_val16 *bandLogE, const opus_val16 printf("%d ", spread_weight[i]); printf("\n");*/ } - /* Make sure that dynamic allocation can't make us bust the budget */ - if (effectiveBytes > 50 && LM>=1 && !lfe) + /* Make sure that dynamic allocation can't make us bust the budget. + We enable the feature starting at 24 kb/s for 20-ms frames + and 96 kb/s for 2.5 ms frames. */ + if (effectiveBytes >= (30 + 5*LM) && !lfe) { int last=0; c=0;do @@ -1042,30 +1057,38 @@ static opus_val16 dynalloc_analysis(const opus_val16 *bandLogE, const opus_val16 opus_val16 offset; opus_val16 tmp; opus_val16 *f; + OPUS_COPY(bandLogE3, &bandLogE2[c*nbEBands], end); + if (LM==0) { + /* For 2.5 ms frames, the first 8 bands have just one bin, so the + energy is highly unreliable (high variance). For that reason, + we take the max with the previous energy so that at least 2 bins + are getting used. */ + for (i=0;i<IMIN(8,end);i++) bandLogE3[i] = MAX16(bandLogE2[c*nbEBands+i], oldBandE[c*nbEBands+i]); + } f = &follower[c*nbEBands]; - f[0] = bandLogE2[c*nbEBands]; + f[0] = bandLogE3[0]; for (i=1;i<end;i++) { /* The last band to be at least 3 dB higher than the previous one is the last we'll consider. Otherwise, we run into problems on bandlimited signals. */ - if (bandLogE2[c*nbEBands+i] > bandLogE2[c*nbEBands+i-1]+QCONST16(.5f,DB_SHIFT)) + if (bandLogE3[i] > bandLogE3[i-1]+QCONST16(.5f,DB_SHIFT)) last=i; - f[i] = MIN16(f[i-1]+QCONST16(1.5f,DB_SHIFT), bandLogE2[c*nbEBands+i]); + f[i] = MIN16(f[i-1]+QCONST16(1.5f,DB_SHIFT), bandLogE3[i]); } for (i=last-1;i>=0;i--) - f[i] = MIN16(f[i], MIN16(f[i+1]+QCONST16(2.f,DB_SHIFT), bandLogE2[c*nbEBands+i])); + f[i] = MIN16(f[i], MIN16(f[i+1]+QCONST16(2.f,DB_SHIFT), bandLogE3[i])); /* Combine with a median filter to avoid dynalloc triggering unnecessarily. The "offset" value controls how conservative we are -- a higher offset reduces the impact of the median filter and makes dynalloc use more bits. */ offset = QCONST16(1.f, DB_SHIFT); for (i=2;i<end-2;i++) - f[i] = MAX16(f[i], median_of_5(&bandLogE2[c*nbEBands+i-2])-offset); - tmp = median_of_3(&bandLogE2[c*nbEBands])-offset; + f[i] = MAX16(f[i], median_of_5(&bandLogE3[i-2])-offset); + tmp = median_of_3(&bandLogE3[0])-offset; f[0] = MAX16(f[0], tmp); f[1] = MAX16(f[1], tmp); - tmp = median_of_3(&bandLogE2[c*nbEBands+end-3])-offset; + tmp = median_of_3(&bandLogE3[end-3])-offset; f[end-2] = MAX16(f[end-2], tmp); f[end-1] = MAX16(f[end-1], tmp); @@ -1565,10 +1588,13 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm, vbr_rate = 0; tmp = st->bitrate*frame_size; if (tell>1) - tmp += tell; + tmp += tell*mode->Fs; if (st->bitrate!=OPUS_BITRATE_MAX) + { nbCompressedBytes = IMAX(2, IMIN(nbCompressedBytes, (tmp+4*mode->Fs)/(8*mode->Fs)-!!st->signalling)); + ec_enc_shrink(enc, nbCompressedBytes); + } effectiveBytes = nbCompressedBytes - nbFilledBytes; } equiv_rate = ((opus_int32)nbCompressedBytes*8*50 << (3-LM)) - (40*C+20)*((400>>LM) - 50); @@ -1882,7 +1908,7 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm, ALLOC(importance, nbEBands, int); ALLOC(spread_weight, nbEBands, int); - maxDepth = dynalloc_analysis(bandLogE, bandLogE2, nbEBands, start, end, C, offsets, + maxDepth = dynalloc_analysis(bandLogE, bandLogE2, oldBandE, nbEBands, start, end, C, offsets, st->lsb_depth, mode->logN, isTransient, st->vbr, st->constrained_vbr, eBands, LM, effectiveBytes, &tot_boost, st->lfe, surround_dynalloc, &st->analysis, importance, spread_weight); @@ -2246,7 +2272,7 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm, if (anti_collapse_on) { anti_collapse(mode, X, collapse_masks, LM, C, N, - start, end, oldBandE, oldLogE, oldLogE2, pulses, st->rng); + start, end, oldBandE, oldLogE, oldLogE2, pulses, st->rng, st->arch); } c=0; do { @@ -2265,15 +2291,15 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm, st->prefilter_period_old=IMAX(st->prefilter_period_old, COMBFILTER_MINPERIOD); comb_filter(out_mem[c], out_mem[c], st->prefilter_period_old, st->prefilter_period, mode->shortMdctSize, st->prefilter_gain_old, st->prefilter_gain, st->prefilter_tapset_old, st->prefilter_tapset, - mode->window, overlap); + mode->window, overlap, st->arch); if (LM!=0) comb_filter(out_mem[c]+mode->shortMdctSize, out_mem[c]+mode->shortMdctSize, st->prefilter_period, pitch_index, N-mode->shortMdctSize, st->prefilter_gain, gain1, st->prefilter_tapset, prefilter_tapset, - mode->window, overlap); + mode->window, overlap, st->arch); } while (++c<CC); /* We reuse freq[] as scratch space for the de-emphasis */ - deemphasis(out_mem, (opus_val16*)pcm, N, CC, st->upsample, mode->preemph, st->preemph_memD); + deemphasis(out_mem, (opus_val16*)pcm, N, CC, st->upsample, mode->preemph, st->preemph_memD, 0); st->prefilter_period_old = st->prefilter_period; st->prefilter_gain_old = st->prefilter_gain; st->prefilter_tapset_old = st->prefilter_tapset; diff --git a/media/libopus/celt/celt_lpc.c b/media/libopus/celt/celt_lpc.c index f91721bcab..fabca65cb3 100644 --- a/media/libopus/celt/celt_lpc.c +++ b/media/libopus/celt/celt_lpc.c @@ -44,7 +44,7 @@ int p opus_val32 r; opus_val32 error = ac[0]; #ifdef FIXED_POINT - opus_val32 lpc[LPC_ORDER]; + opus_val32 lpc[CELT_LPC_ORDER]; #else float *lpc = _lpc; #endif @@ -158,7 +158,17 @@ void celt_fir_c( sum[1] = SHL32(EXTEND32(x[i+1]), SIG_SHIFT); sum[2] = SHL32(EXTEND32(x[i+2]), SIG_SHIFT); sum[3] = SHL32(EXTEND32(x[i+3]), SIG_SHIFT); - xcorr_kernel(rnum, x+i-ord, sum, ord, arch); +#if defined(OPUS_CHECK_ASM) && defined(FIXED_POINT) + { + opus_val32 sum_c[4]; + memcpy(sum_c, sum, sizeof(sum_c)); + xcorr_kernel_c(rnum, x+i-ord, sum_c, ord); +#endif + xcorr_kernel(rnum, x+i-ord, sum, ord, arch); +#if defined(OPUS_CHECK_ASM) && defined(FIXED_POINT) + celt_assert(memcmp(sum, sum_c, sizeof(sum)) == 0); + } +#endif y[i ] = SROUND16(sum[0], SIG_SHIFT); y[i+1] = SROUND16(sum[1], SIG_SHIFT); y[i+2] = SROUND16(sum[2], SIG_SHIFT); @@ -222,8 +232,17 @@ void celt_iir(const opus_val32 *_x, sum[1]=_x[i+1]; sum[2]=_x[i+2]; sum[3]=_x[i+3]; - xcorr_kernel(rden, y+i, sum, ord, arch); - +#if defined(OPUS_CHECK_ASM) && defined(FIXED_POINT) + { + opus_val32 sum_c[4]; + memcpy(sum_c, sum, sizeof(sum_c)); + xcorr_kernel_c(rden, y+i, sum_c, ord); +#endif + xcorr_kernel(rden, y+i, sum, ord, arch); +#if defined(OPUS_CHECK_ASM) && defined(FIXED_POINT) + celt_assert(memcmp(sum, sum_c, sizeof(sum)) == 0); + } +#endif /* Patch up the result to compensate for the fact that this is an IIR */ y[i+ord ] = -SROUND16(sum[0],SIG_SHIFT); _y[i ] = sum[0]; diff --git a/media/libopus/celt/celt_lpc.h b/media/libopus/celt/celt_lpc.h index a4c5fd6ea5..97dee82f02 100644 --- a/media/libopus/celt/celt_lpc.h +++ b/media/libopus/celt/celt_lpc.h @@ -35,7 +35,7 @@ #include "x86/celt_lpc_sse.h" #endif -#define LPC_ORDER 24 +#define CELT_LPC_ORDER 24 void _celt_lpc(opus_val16 *_lpc, const opus_val32 *ac, int p); diff --git a/media/libopus/celt/cpu_support.h b/media/libopus/celt/cpu_support.h index 7b5c56ca90..9f13d8aecf 100644 --- a/media/libopus/celt/cpu_support.h +++ b/media/libopus/celt/cpu_support.h @@ -35,19 +35,20 @@ (defined(OPUS_ARM_ASM) || defined(OPUS_ARM_MAY_HAVE_NEON_INTR)) #include "arm/armcpu.h" -/* We currently support 4 ARM variants: +/* We currently support 5 ARM variants: * arch[0] -> ARMv4 * arch[1] -> ARMv5E * arch[2] -> ARMv6 * arch[3] -> NEON + * arch[4] -> NEON+DOTPROD */ -#define OPUS_ARCHMASK 3 +#define OPUS_ARCHMASK 7 #elif defined(OPUS_HAVE_RTCD) && \ ((defined(OPUS_X86_MAY_HAVE_SSE) && !defined(OPUS_X86_PRESUME_SSE)) || \ (defined(OPUS_X86_MAY_HAVE_SSE2) && !defined(OPUS_X86_PRESUME_SSE2)) || \ (defined(OPUS_X86_MAY_HAVE_SSE4_1) && !defined(OPUS_X86_PRESUME_SSE4_1)) || \ - (defined(OPUS_X86_MAY_HAVE_AVX) && !defined(OPUS_X86_PRESUME_AVX))) + (defined(OPUS_X86_MAY_HAVE_AVX2) && !defined(OPUS_X86_PRESUME_AVX2))) #include "x86/x86cpu.h" /* We currently support 5 x86 variants: diff --git a/media/libopus/celt/entdec.c b/media/libopus/celt/entdec.c index 0b3433ed8b..027aa24bca 100644 --- a/media/libopus/celt/entdec.c +++ b/media/libopus/celt/entdec.c @@ -195,6 +195,27 @@ int ec_dec_icdf(ec_dec *_this,const unsigned char *_icdf,unsigned _ftb){ return ret; } +int ec_dec_icdf16(ec_dec *_this,const opus_uint16 *_icdf,unsigned _ftb){ + opus_uint32 r; + opus_uint32 d; + opus_uint32 s; + opus_uint32 t; + int ret; + s=_this->rng; + d=_this->val; + r=s>>_ftb; + ret=-1; + do{ + t=s; + s=IMUL32(r,_icdf[++ret]); + } + while(d<s); + _this->val=d-s; + _this->rng=t-s; + ec_dec_normalize(_this); + return ret; +} + opus_uint32 ec_dec_uint(ec_dec *_this,opus_uint32 _ft){ unsigned ft; unsigned s; diff --git a/media/libopus/celt/entdec.h b/media/libopus/celt/entdec.h index 025fc1870d..c81f26fdb2 100644 --- a/media/libopus/celt/entdec.h +++ b/media/libopus/celt/entdec.h @@ -81,6 +81,16 @@ int ec_dec_bit_logp(ec_dec *_this,unsigned _logp); Return: The decoded symbol s.*/ int ec_dec_icdf(ec_dec *_this,const unsigned char *_icdf,unsigned _ftb); +/*Decodes a symbol given an "inverse" CDF table. + No call to ec_dec_update() is necessary after this call. + _icdf: The "inverse" CDF, such that symbol s falls in the range + [s>0?ft-_icdf[s-1]:0,ft-_icdf[s]), where ft=1<<_ftb. + The values must be monotonically non-increasing, and the last value + must be 0. + _ftb: The number of bits of precision in the cumulative distribution. + Return: The decoded symbol s.*/ +int ec_dec_icdf16(ec_dec *_this,const opus_uint16 *_icdf,unsigned _ftb); + /*Extracts a raw unsigned integer with a non-power-of-2 range from the stream. The bits must have been encoded with ec_enc_uint(). No call to ec_dec_update() is necessary after this call. diff --git a/media/libopus/celt/entenc.c b/media/libopus/celt/entenc.c index f1750d25b8..69c6f835d0 100644 --- a/media/libopus/celt/entenc.c +++ b/media/libopus/celt/entenc.c @@ -172,6 +172,17 @@ void ec_enc_icdf(ec_enc *_this,int _s,const unsigned char *_icdf,unsigned _ftb){ ec_enc_normalize(_this); } +void ec_enc_icdf16(ec_enc *_this,int _s,const opus_uint16 *_icdf,unsigned _ftb){ + opus_uint32 r; + r=_this->rng>>_ftb; + if(_s>0){ + _this->val+=_this->rng-IMUL32(r,_icdf[_s-1]); + _this->rng=IMUL32(r,_icdf[_s-1]-_icdf[_s]); + } + else _this->rng-=IMUL32(r,_icdf[_s]); + ec_enc_normalize(_this); +} + void ec_enc_uint(ec_enc *_this,opus_uint32 _fl,opus_uint32 _ft){ unsigned ft; unsigned fl; diff --git a/media/libopus/celt/entenc.h b/media/libopus/celt/entenc.h index f502eaf662..010874bbc1 100644 --- a/media/libopus/celt/entenc.h +++ b/media/libopus/celt/entenc.h @@ -64,6 +64,15 @@ void ec_enc_bit_logp(ec_enc *_this,int _val,unsigned _logp); _ftb: The number of bits of precision in the cumulative distribution.*/ void ec_enc_icdf(ec_enc *_this,int _s,const unsigned char *_icdf,unsigned _ftb); +/*Encodes a symbol given an "inverse" CDF table. + _s: The index of the symbol to encode. + _icdf: The "inverse" CDF, such that symbol _s falls in the range + [_s>0?ft-_icdf[_s-1]:0,ft-_icdf[_s]), where ft=1<<_ftb. + The values must be monotonically non-increasing, and the last value + must be 0. + _ftb: The number of bits of precision in the cumulative distribution.*/ +void ec_enc_icdf16(ec_enc *_this,int _s,const opus_uint16 *_icdf,unsigned _ftb); + /*Encodes a raw unsigned integer in the stream. _fl: The integer to encode. _ft: The number of integers that can be encoded (one more than the max). diff --git a/media/libopus/celt/laplace.c b/media/libopus/celt/laplace.c index a7bca874b6..2180966662 100644 --- a/media/libopus/celt/laplace.c +++ b/media/libopus/celt/laplace.c @@ -132,3 +132,104 @@ int ec_laplace_decode(ec_dec *dec, unsigned fs, int decay) ec_dec_update(dec, fl, IMIN(fl+fs,32768), 32768); return val; } + +void ec_laplace_encode_p0(ec_enc *enc, int value, opus_uint16 p0, opus_uint16 decay) +{ + int s; + opus_uint16 sign_icdf[3]; + sign_icdf[0] = 32768-p0; + sign_icdf[1] = sign_icdf[0]/2; + sign_icdf[2] = 0; + s = value == 0 ? 0 : (value > 0 ? 1 : 2); + ec_enc_icdf16(enc, s, sign_icdf, 15); + value = abs(value); + if (value) + { + int i; + opus_uint16 icdf[8]; + icdf[0] = IMAX(7, decay); + for (i=1;i<7;i++) + { + icdf[i] = IMAX(7-i, (icdf[i-1] * (opus_int32)decay) >> 15); + } + icdf[7] = 0; + value--; + do { + ec_enc_icdf16(enc, IMIN(value, 7), icdf, 15); + value -= 7; + } while (value >= 0); + } +} + +int ec_laplace_decode_p0(ec_dec *dec, opus_uint16 p0, opus_uint16 decay) +{ + int s; + int value; + opus_uint16 sign_icdf[3]; + sign_icdf[0] = 32768-p0; + sign_icdf[1] = sign_icdf[0]/2; + sign_icdf[2] = 0; + s = ec_dec_icdf16(dec, sign_icdf, 15); + if (s==2) s = -1; + if (s != 0) + { + int i; + int v; + opus_uint16 icdf[8]; + icdf[0] = IMAX(7, decay); + for (i=1;i<7;i++) + { + icdf[i] = IMAX(7-i, (icdf[i-1] * (opus_int32)decay) >> 15); + } + icdf[7] = 0; + value = 1; + do { + v = ec_dec_icdf16(dec, icdf, 15); + value += v; + } while (v == 7); + return s*value; + } else return 0; +} + +#if 0 + +#include <stdio.h> +#define NB_VALS 10 +#define DATA_SIZE 10000 +int main() { + ec_enc enc; + ec_dec dec; + unsigned char *ptr; + int i; + int decay, p0; + int val[NB_VALS] = {6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; + /*for (i=0;i<NB_VALS;i++) { + val[i] = -log(rand()/(float)RAND_MAX); + if (rand()%2) val[i] = -val[i]; + }*/ + p0 = 16000; + decay = 16000; + ptr = (unsigned char *)malloc(DATA_SIZE); + ec_enc_init(&enc,ptr,DATA_SIZE); + for (i=0;i<NB_VALS;i++) { + printf("%d ", val[i]); + } + printf("\n"); + for (i=0;i<NB_VALS;i++) { + ec_laplace_encode_p0(&enc, val[i], p0, decay); + } + + ec_enc_done(&enc); + + ec_dec_init(&dec,ec_get_buffer(&enc),ec_range_bytes(&enc)); + + for (i=0;i<NB_VALS;i++) { + val[i] = ec_laplace_decode_p0(&dec, p0, decay); + } + for (i=0;i<NB_VALS;i++) { + printf("%d ", val[i]); + } + printf("\n"); +} + +#endif diff --git a/media/libopus/celt/laplace.h b/media/libopus/celt/laplace.h index 46c14b5da5..8010ad9755 100644 --- a/media/libopus/celt/laplace.h +++ b/media/libopus/celt/laplace.h @@ -26,6 +26,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifndef LAPLACE_H +#define LAPLACE_H + #include "entenc.h" #include "entdec.h" @@ -46,3 +49,9 @@ void ec_laplace_encode(ec_enc *enc, int *value, unsigned fs, int decay); @return Value decoded */ int ec_laplace_decode(ec_dec *dec, unsigned fs, int decay); + + +int ec_laplace_decode_p0(ec_dec *dec, opus_uint16 p0, opus_uint16 decay); +void ec_laplace_encode_p0(ec_enc *enc, int value, opus_uint16 p0, opus_uint16 decay); + +#endif diff --git a/media/libopus/celt/mathops.h b/media/libopus/celt/mathops.h index 478ac9187c..e2eece2937 100644 --- a/media/libopus/celt/mathops.h +++ b/media/libopus/celt/mathops.h @@ -230,6 +230,12 @@ static OPUS_INLINE opus_val32 celt_exp2_frac(opus_val16 x) frac = SHL16(x, 4); return ADD16(D0, MULT16_16_Q15(frac, ADD16(D1, MULT16_16_Q15(frac, ADD16(D2 , MULT16_16_Q15(D3,frac)))))); } + +#undef D0 +#undef D1 +#undef D2 +#undef D3 + /** Base-2 exponential approximation (2^x). (Q10 input, Q16 output) */ static OPUS_INLINE opus_val32 celt_exp2(opus_val16 x) { diff --git a/media/libopus/celt/mips/celt_mipsr1.h b/media/libopus/celt/mips/celt_mipsr1.h index c332fe0471..d1b25c204d 100644 --- a/media/libopus/celt/mips/celt_mipsr1.h +++ b/media/libopus/celt/mips/celt_mipsr1.h @@ -27,8 +27,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef __CELT_MIPSR1_H__ -#define __CELT_MIPSR1_H__ +#ifndef CELT_MIPSR1_H__ +#define CELT_MIPSR1_H__ #ifdef HAVE_CONFIG_H #include "config.h" @@ -149,4 +149,4 @@ void comb_filter(opus_val32 *y, opus_val32 *x, int T0, int T1, int N, } } -#endif /* __CELT_MIPSR1_H__ */ +#endif /* CELT_MIPSR1_H__ */ diff --git a/media/libopus/celt/mips/mdct_mipsr1.h b/media/libopus/celt/mips/mdct_mipsr1.h index 2934dab776..7456c181a5 100644 --- a/media/libopus/celt/mips/mdct_mipsr1.h +++ b/media/libopus/celt/mips/mdct_mipsr1.h @@ -38,8 +38,8 @@ MDCT implementation in FFMPEG, but has differences in signs, ordering and scaling in many places. */ -#ifndef __MDCT_MIPSR1_H__ -#define __MDCT_MIPSR1_H__ +#ifndef MDCT_MIPSR1_H__ +#define MDCT_MIPSR1_H__ #ifndef SKIP_CONFIG_H #ifdef HAVE_CONFIG_H @@ -285,4 +285,4 @@ void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scala } } } -#endif /* __MDCT_MIPSR1_H__ */ +#endif /* MDCT_MIPSR1_H__ */ diff --git a/media/libopus/celt/mips/vq_mipsr1.h b/media/libopus/celt/mips/vq_mipsr1.h index f26a33e755..1621c5624f 100644 --- a/media/libopus/celt/mips/vq_mipsr1.h +++ b/media/libopus/celt/mips/vq_mipsr1.h @@ -26,8 +26,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef __VQ_MIPSR1_H__ -#define __VQ_MIPSR1_H__ +#ifndef VQ_MIPSR1_H__ +#define VQ_MIPSR1_H__ #ifdef HAVE_CONFIG_H #include "config.h" @@ -113,4 +113,4 @@ void renormalise_vector(celt_norm *X, int N, opus_val16 gain, int arch) /*return celt_sqrt(E);*/ } -#endif /* __VQ_MIPSR1_H__ */ +#endif /* VQ_MIPSR1_H__ */ diff --git a/media/libopus/celt/os_support.h b/media/libopus/celt/os_support.h index 009bf861da..7d2d378116 100644 --- a/media/libopus/celt/os_support.h +++ b/media/libopus/celt/os_support.h @@ -41,7 +41,7 @@ #include <string.h> #include <stdlib.h> -/** Opus wrapper for malloc(). To do your own dynamic allocation, all you need to do is replace this function and opus_free */ +/** Opus wrapper for malloc(). To do your own dynamic allocation replace this function, opus_realloc, and opus_free */ #ifndef OVERRIDE_OPUS_ALLOC static OPUS_INLINE void *opus_alloc (size_t size) { @@ -49,7 +49,15 @@ static OPUS_INLINE void *opus_alloc (size_t size) } #endif -/** Same as celt_alloc(), except that the area is only needed inside a CELT call (might cause problem with wideband though) */ +#ifndef OVERRIDE_OPUS_REALLOC +static OPUS_INLINE void *opus_realloc (void *ptr, size_t size) +{ + return realloc(ptr, size); +} +#endif + +/** Used only for non-threadsafe pseudostack. + If desired, this can always return the same area of memory rather than allocating a new one every time. */ #ifndef OVERRIDE_OPUS_ALLOC_SCRATCH static OPUS_INLINE void *opus_alloc_scratch (size_t size) { @@ -58,7 +66,7 @@ static OPUS_INLINE void *opus_alloc_scratch (size_t size) } #endif -/** Opus wrapper for free(). To do your own dynamic allocation, all you need to do is replace this function and opus_alloc */ +/** Opus wrapper for free(). To do your own dynamic allocation replace this function, opus_realloc, and opus_free */ #ifndef OVERRIDE_OPUS_FREE static OPUS_INLINE void opus_free (void *ptr) { diff --git a/media/libopus/celt/pitch.c b/media/libopus/celt/pitch.c index 7998db4164..e33c60a3bf 100644 --- a/media/libopus/celt/pitch.c +++ b/media/libopus/celt/pitch.c @@ -262,7 +262,16 @@ celt_pitch_xcorr_c(const opus_val16 *_x, const opus_val16 *_y, for (i=0;i<max_pitch-3;i+=4) { opus_val32 sum[4]={0,0,0,0}; - xcorr_kernel(_x, _y+i, sum, len, arch); +#if defined(OPUS_CHECK_ASM) && defined(FIXED_POINT) + { + opus_val32 sum_c[4]={0,0,0,0}; + xcorr_kernel_c(_x, _y+i, sum_c, len); +#endif + xcorr_kernel(_x, _y+i, sum, len, arch); +#if defined(OPUS_CHECK_ASM) && defined(FIXED_POINT) + celt_assert(memcmp(sum, sum_c, sizeof(sum)) == 0); + } +#endif xcorr[i]=sum[0]; xcorr[i+1]=sum[1]; xcorr[i+2]=sum[2]; diff --git a/media/libopus/celt/pitch.h b/media/libopus/celt/pitch.h index e425f56aea..dd0e2bebd2 100644 --- a/media/libopus/celt/pitch.h +++ b/media/libopus/celt/pitch.h @@ -189,4 +189,15 @@ celt_pitch_xcorr_c(const opus_val16 *_x, const opus_val16 *_y, # define celt_pitch_xcorr celt_pitch_xcorr_c #endif +#ifdef NON_STATIC_COMB_FILTER_CONST_C +void comb_filter_const_c(opus_val32 *y, opus_val32 *x, int T, int N, + opus_val16 g10, opus_val16 g11, opus_val16 g12); +#endif + +#ifndef OVERRIDE_COMB_FILTER_CONST +# define comb_filter_const(y, x, T, N, g10, g11, g12, arch) \ + ((void)(arch),comb_filter_const_c(y, x, T, N, g10, g11, g12)) +#endif + + #endif diff --git a/media/libopus/celt/stack_alloc.h b/media/libopus/celt/stack_alloc.h index ae40e2a165..e2739bdf66 100644 --- a/media/libopus/celt/stack_alloc.h +++ b/media/libopus/celt/stack_alloc.h @@ -141,7 +141,7 @@ extern char *global_stack_top; #else #define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1)) -#define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)/sizeof(char)),(stack)+=(size)*(sizeof(type)/sizeof(char)),(type*)((stack)-(size)*(sizeof(type)/sizeof(char)))) +#define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)/(sizeof(char))),(stack)+=(size)*(sizeof(type)/(sizeof(char))),(type*)((stack)-(size)*(sizeof(type)/(sizeof(char))))) #if 0 /* Set this to 1 to instrument pseudostack usage */ #define RESTORE_STACK (printf("%ld %s:%d\n", global_stack-scratch_ptr, __FILE__, __LINE__),global_stack = _saved_stack) #else diff --git a/media/libopus/celt/x86/celt_lpc_sse4_1.c b/media/libopus/celt/x86/celt_lpc_sse4_1.c index 5478568849..daf59d245a 100644 --- a/media/libopus/celt/x86/celt_lpc_sse4_1.c +++ b/media/libopus/celt/x86/celt_lpc_sse4_1.c @@ -64,9 +64,16 @@ void celt_fir_sse4_1(const opus_val16 *x, { opus_val32 sums[4] = {0}; __m128i vecSum, vecX; - - xcorr_kernel(rnum, x+i-ord, sums, ord, arch); - +#if defined(OPUS_CHECK_ASM) + { + opus_val32 sums_c[4] = {0}; + xcorr_kernel_c(rnum, x+i-ord, sums_c, ord); +#endif + xcorr_kernel(rnum, x+i-ord, sums, ord, arch); +#if defined(OPUS_CHECK_ASM) + celt_assert(memcmp(sums, sums_c, sizeof(sums)) == 0); + } +#endif vecSum = _mm_loadu_si128((__m128i *)sums); vecSum = _mm_add_epi32(vecSum, vecNoA); vecSum = _mm_srai_epi32(vecSum, SIG_SHIFT); diff --git a/media/libopus/celt/x86/pitch_avx.c b/media/libopus/celt/x86/pitch_avx.c new file mode 100644 index 0000000000..f731762d84 --- /dev/null +++ b/media/libopus/celt/x86/pitch_avx.c @@ -0,0 +1,101 @@ +/* Copyright (c) 2023 Amazon */ +/* + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + + +#include <immintrin.h> +#include "x86cpu.h" +#include "pitch.h" + +#if defined(OPUS_X86_MAY_HAVE_AVX2) && !defined(FIXED_POINT) + +/* Like the "regular" xcorr_kernel(), but computes 8 results at a time. */ +static void xcorr_kernel_avx(const float *x, const float *y, float sum[8], int len) +{ + __m256 xsum0, xsum1, xsum2, xsum3, xsum4, xsum5, xsum6, xsum7; + xsum7 = xsum6 = xsum5 = xsum4 = xsum3 = xsum2 = xsum1 = xsum0 = _mm256_setzero_ps(); + int i; + __m256 x0; + /* Compute 8 inner products using partial sums. */ + for (i=0;i<len-7;i+=8) + { + x0 = _mm256_loadu_ps(x+i); + xsum0 = _mm256_fmadd_ps(x0, _mm256_loadu_ps(y+i ), xsum0); + xsum1 = _mm256_fmadd_ps(x0, _mm256_loadu_ps(y+i+1), xsum1); + xsum2 = _mm256_fmadd_ps(x0, _mm256_loadu_ps(y+i+2), xsum2); + xsum3 = _mm256_fmadd_ps(x0, _mm256_loadu_ps(y+i+3), xsum3); + xsum4 = _mm256_fmadd_ps(x0, _mm256_loadu_ps(y+i+4), xsum4); + xsum5 = _mm256_fmadd_ps(x0, _mm256_loadu_ps(y+i+5), xsum5); + xsum6 = _mm256_fmadd_ps(x0, _mm256_loadu_ps(y+i+6), xsum6); + xsum7 = _mm256_fmadd_ps(x0, _mm256_loadu_ps(y+i+7), xsum7); + } + if (i != len) { + static const int mask[15] = {-1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0}; + __m256i m; + m = _mm256_loadu_si256((__m256i*)(void*)(mask + 7+i-len)); + x0 = _mm256_maskload_ps(x+i, m); + xsum0 = _mm256_fmadd_ps(x0, _mm256_maskload_ps(y+i , m), xsum0); + xsum1 = _mm256_fmadd_ps(x0, _mm256_maskload_ps(y+i+1, m), xsum1); + xsum2 = _mm256_fmadd_ps(x0, _mm256_maskload_ps(y+i+2, m), xsum2); + xsum3 = _mm256_fmadd_ps(x0, _mm256_maskload_ps(y+i+3, m), xsum3); + xsum4 = _mm256_fmadd_ps(x0, _mm256_maskload_ps(y+i+4, m), xsum4); + xsum5 = _mm256_fmadd_ps(x0, _mm256_maskload_ps(y+i+5, m), xsum5); + xsum6 = _mm256_fmadd_ps(x0, _mm256_maskload_ps(y+i+6, m), xsum6); + xsum7 = _mm256_fmadd_ps(x0, _mm256_maskload_ps(y+i+7, m), xsum7); + } + /* 8 horizontal adds. */ + /* Compute [0 4] [1 5] [2 6] [3 7] */ + xsum0 = _mm256_add_ps(_mm256_permute2f128_ps(xsum0, xsum4, 2<<4), _mm256_permute2f128_ps(xsum0, xsum4, 1 | (3<<4))); + xsum1 = _mm256_add_ps(_mm256_permute2f128_ps(xsum1, xsum5, 2<<4), _mm256_permute2f128_ps(xsum1, xsum5, 1 | (3<<4))); + xsum2 = _mm256_add_ps(_mm256_permute2f128_ps(xsum2, xsum6, 2<<4), _mm256_permute2f128_ps(xsum2, xsum6, 1 | (3<<4))); + xsum3 = _mm256_add_ps(_mm256_permute2f128_ps(xsum3, xsum7, 2<<4), _mm256_permute2f128_ps(xsum3, xsum7, 1 | (3<<4))); + /* Compute [0 1 4 5] [2 3 6 7] */ + xsum0 = _mm256_hadd_ps(xsum0, xsum1); + xsum1 = _mm256_hadd_ps(xsum2, xsum3); + /* Compute [0 1 2 3 4 5 6 7] */ + xsum0 = _mm256_hadd_ps(xsum0, xsum1); + _mm256_storeu_ps(sum, xsum0); +} + +void celt_pitch_xcorr_avx2(const float *_x, const float *_y, float *xcorr, int len, int max_pitch, int arch) +{ + int i; + celt_assert(max_pitch>0); + (void)arch; + for (i=0;i<max_pitch-7;i+=8) + { + xcorr_kernel_avx(_x, _y+i, &xcorr[i], len); + } + for (;i<max_pitch;i++) + { + xcorr[i] = celt_inner_prod(_x, _y+i, len, arch); + } +} + +#endif diff --git a/media/libopus/celt/x86/pitch_sse.h b/media/libopus/celt/x86/pitch_sse.h index 964aef50db..127581f3e1 100644 --- a/media/libopus/celt/x86/pitch_sse.h +++ b/media/libopus/celt/x86/pitch_sse.h @@ -131,12 +131,6 @@ extern opus_val32 (*const CELT_INNER_PROD_IMPL[OPUS_ARCHMASK + 1])( #if defined(OPUS_X86_MAY_HAVE_SSE) && !defined(FIXED_POINT) -#define OVERRIDE_DUAL_INNER_PROD -#define OVERRIDE_COMB_FILTER_CONST - -#undef dual_inner_prod -#undef comb_filter_const - void dual_inner_prod_sse(const opus_val16 *x, const opus_val16 *y01, const opus_val16 *y02, @@ -154,13 +148,17 @@ void comb_filter_const_sse(opus_val32 *y, #if defined(OPUS_X86_PRESUME_SSE) +#define OVERRIDE_DUAL_INNER_PROD +#define OVERRIDE_COMB_FILTER_CONST # define dual_inner_prod(x, y01, y02, N, xy1, xy2, arch) \ ((void)(arch),dual_inner_prod_sse(x, y01, y02, N, xy1, xy2)) # define comb_filter_const(y, x, T, N, g10, g11, g12, arch) \ ((void)(arch),comb_filter_const_sse(y, x, T, N, g10, g11, g12)) -#else +#elif defined(OPUS_HAVE_RTCD) +#define OVERRIDE_DUAL_INNER_PROD +#define OVERRIDE_COMB_FILTER_CONST extern void (*const DUAL_INNER_PROD_IMPL[OPUS_ARCHMASK + 1])( const opus_val16 *x, const opus_val16 *y01, @@ -187,6 +185,32 @@ extern void (*const COMB_FILTER_CONST_IMPL[OPUS_ARCHMASK + 1])( #define NON_STATIC_COMB_FILTER_CONST_C #endif -#endif + +void celt_pitch_xcorr_avx2(const float *_x, const float *_y, float *xcorr, int len, int max_pitch, int arch); + +#if defined(OPUS_X86_PRESUME_AVX2) + +#define OVERRIDE_PITCH_XCORR +# define celt_pitch_xcorr celt_pitch_xcorr_avx2 + +#elif defined(OPUS_HAVE_RTCD) && defined(OPUS_X86_MAY_HAVE_AVX2) + +#define OVERRIDE_PITCH_XCORR +extern void (*const PITCH_XCORR_IMPL[OPUS_ARCHMASK + 1])( + const float *_x, + const float *_y, + float *xcorr, + int len, + int max_pitch, + int arch + ); + +#define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \ + ((*PITCH_XCORR_IMPL[(arch) & OPUS_ARCHMASK])(_x, _y, xcorr, len, max_pitch, arch)) + + +#endif /* OPUS_X86_PRESUME_AVX2 && !OPUS_HAVE_RTCD */ + +#endif /* OPUS_X86_MAY_HAVE_SSE && !FIXED_POINT */ #endif diff --git a/media/libopus/celt/x86/vq_sse.h b/media/libopus/celt/x86/vq_sse.h index b4efe8f249..444503b630 100644 --- a/media/libopus/celt/x86/vq_sse.h +++ b/media/libopus/celt/x86/vq_sse.h @@ -28,16 +28,18 @@ #define VQ_SSE_H #if defined(OPUS_X86_MAY_HAVE_SSE2) && !defined(FIXED_POINT) -#define OVERRIDE_OP_PVQ_SEARCH opus_val16 op_pvq_search_sse2(celt_norm *_X, int *iy, int K, int N, int arch); #if defined(OPUS_X86_PRESUME_SSE2) + +#define OVERRIDE_OP_PVQ_SEARCH #define op_pvq_search(x, iy, K, N, arch) \ (op_pvq_search_sse2(x, iy, K, N, arch)) -#else +#elif defined(OPUS_HAVE_RTCD) +#define OVERRIDE_OP_PVQ_SEARCH extern opus_val16 (*const OP_PVQ_SEARCH_IMPL[OPUS_ARCHMASK + 1])( celt_norm *_X, int *iy, int K, int N, int arch); diff --git a/media/libopus/celt/x86/vq_sse2.c b/media/libopus/celt/x86/vq_sse2.c index 775042860d..4c4ebf8e2d 100644 --- a/media/libopus/celt/x86/vq_sse2.c +++ b/media/libopus/celt/x86/vq_sse2.c @@ -75,7 +75,7 @@ opus_val16 op_pvq_search_sse2(celt_norm *_X, int *iy, int K, int N, int arch) sums = _mm_add_ps(sums, x4); /* Clear y and iy in case we don't do the projection. */ _mm_storeu_ps(&y[j], _mm_setzero_ps()); - _mm_storeu_si128((__m128i*)&iy[j], _mm_setzero_si128()); + _mm_storeu_si128((__m128i*)(void*)&iy[j], _mm_setzero_si128()); _mm_storeu_ps(&X[j], x4); _mm_storeu_ps(&signy[j], s4); } @@ -116,7 +116,7 @@ opus_val16 op_pvq_search_sse2(celt_norm *_X, int *iy, int K, int N, int arch) rx4 = _mm_mul_ps(x4, rcp4); iy4 = _mm_cvttps_epi32(rx4); pulses_sum = _mm_add_epi32(pulses_sum, iy4); - _mm_storeu_si128((__m128i*)&iy[j], iy4); + _mm_storeu_si128((__m128i*)(void*)&iy[j], iy4); y4 = _mm_cvtepi32_ps(iy4); xy4 = _mm_add_ps(xy4, _mm_mul_ps(x4, y4)); yy4 = _mm_add_ps(yy4, _mm_mul_ps(y4, y4)); @@ -205,10 +205,10 @@ opus_val16 op_pvq_search_sse2(celt_norm *_X, int *iy, int K, int N, int arch) { __m128i y4; __m128i s4; - y4 = _mm_loadu_si128((__m128i*)&iy[j]); + y4 = _mm_loadu_si128((__m128i*)(void*)&iy[j]); s4 = _mm_castps_si128(_mm_loadu_ps(&signy[j])); y4 = _mm_xor_si128(_mm_add_epi32(y4, s4), s4); - _mm_storeu_si128((__m128i*)&iy[j], y4); + _mm_storeu_si128((__m128i*)(void*)&iy[j], y4); } RESTORE_STACK; return yy; diff --git a/media/libopus/celt/x86/x86_arch_macros.h b/media/libopus/celt/x86/x86_arch_macros.h new file mode 100644 index 0000000000..975b443e93 --- /dev/null +++ b/media/libopus/celt/x86/x86_arch_macros.h @@ -0,0 +1,47 @@ +/* Copyright (c) 2023 Amazon */ +/* + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifdef _MSC_VER + +# ifdef OPUS_X86_MAY_HAVE_SSE +# ifndef __SSE__ +# define __SSE__ +# endif +# endif + +# ifdef OPUS_X86_MAY_HAVE_SSE2 +# ifndef __SSE2__ +# define __SSE2__ +# endif +# endif + +# ifdef OPUS_X86_MAY_HAVE_SSE4_1 +# ifndef __SSE4_1__ +# define __SSE4_1__ +# endif +# endif + +#endif diff --git a/media/libopus/celt/x86/x86_celt_map.c b/media/libopus/celt/x86/x86_celt_map.c index d39d88edec..ba8eafe6ad 100644 --- a/media/libopus/celt/x86/x86_celt_map.c +++ b/media/libopus/celt/x86/x86_celt_map.c @@ -90,6 +90,26 @@ opus_val32 (*const CELT_INNER_PROD_IMPL[OPUS_ARCHMASK + 1])( # else +#if defined(OPUS_X86_MAY_HAVE_AVX2) && !defined(OPUS_X86_PRESUME_AVX2) + +void (*const PITCH_XCORR_IMPL[OPUS_ARCHMASK + 1])( + const float *_x, + const float *_y, + float *xcorr, + int len, + int max_pitch, + int arch +) = { + celt_pitch_xcorr_c, /* non-sse */ + celt_pitch_xcorr_c, + celt_pitch_xcorr_c, + celt_pitch_xcorr_c, + MAY_HAVE_AVX2(celt_pitch_xcorr) +}; + +#endif + + #if defined(OPUS_X86_MAY_HAVE_SSE) && !defined(OPUS_X86_PRESUME_SSE) void (*const XCORR_KERNEL_IMPL[OPUS_ARCHMASK + 1])( diff --git a/media/libopus/celt/x86/x86cpu.c b/media/libopus/celt/x86/x86cpu.c index 6a1914dee7..2e7c32aeec 100644 --- a/media/libopus/celt/x86/x86cpu.c +++ b/media/libopus/celt/x86/x86cpu.c @@ -39,7 +39,7 @@ ((defined(OPUS_X86_MAY_HAVE_SSE) && !defined(OPUS_X86_PRESUME_SSE)) || \ (defined(OPUS_X86_MAY_HAVE_SSE2) && !defined(OPUS_X86_PRESUME_SSE2)) || \ (defined(OPUS_X86_MAY_HAVE_SSE4_1) && !defined(OPUS_X86_PRESUME_SSE4_1)) || \ - (defined(OPUS_X86_MAY_HAVE_AVX) && !defined(OPUS_X86_PRESUME_AVX))) + (defined(OPUS_X86_MAY_HAVE_AVX2) && !defined(OPUS_X86_PRESUME_AVX2))) #if defined(_MSC_VER) @@ -105,7 +105,7 @@ typedef struct CPU_Feature{ int HW_SSE2; int HW_SSE41; /* SIMD: 256-bit */ - int HW_AVX; + int HW_AVX2; } CPU_Feature; static void opus_cpu_feature_check(CPU_Feature *cpu_feature) @@ -121,13 +121,19 @@ static void opus_cpu_feature_check(CPU_Feature *cpu_feature) cpu_feature->HW_SSE = (info[3] & (1 << 25)) != 0; cpu_feature->HW_SSE2 = (info[3] & (1 << 26)) != 0; cpu_feature->HW_SSE41 = (info[2] & (1 << 19)) != 0; - cpu_feature->HW_AVX = (info[2] & (1 << 28)) != 0; + cpu_feature->HW_AVX2 = (info[2] & (1 << 28)) != 0 && (info[2] & (1 << 12)) != 0; + if (cpu_feature->HW_AVX2 && nIds >= 7) { + cpuid(info, 7); + cpu_feature->HW_AVX2 = cpu_feature->HW_AVX2 && (info[1] & (1 << 5)) != 0; + } else { + cpu_feature->HW_AVX2 = 0; + } } else { cpu_feature->HW_SSE = 0; cpu_feature->HW_SSE2 = 0; cpu_feature->HW_SSE41 = 0; - cpu_feature->HW_AVX = 0; + cpu_feature->HW_AVX2 = 0; } } @@ -157,7 +163,7 @@ static int opus_select_arch_impl(void) } arch++; - if (!cpu_feature.HW_AVX) + if (!cpu_feature.HW_AVX2) { return arch; } diff --git a/media/libopus/celt/x86/x86cpu.h b/media/libopus/celt/x86/x86cpu.h index 04e80489b1..8ae9be8d8f 100644 --- a/media/libopus/celt/x86/x86cpu.h +++ b/media/libopus/celt/x86/x86cpu.h @@ -46,28 +46,53 @@ # define MAY_HAVE_SSE4_1(name) name ## _c # endif -# if defined(OPUS_X86_MAY_HAVE_AVX) -# define MAY_HAVE_AVX(name) name ## _avx +# if defined(OPUS_X86_MAY_HAVE_AVX2) +# define MAY_HAVE_AVX2(name) name ## _avx2 # else -# define MAY_HAVE_AVX(name) name ## _c +# define MAY_HAVE_AVX2(name) name ## _c # endif -# if defined(OPUS_HAVE_RTCD) +# if defined(OPUS_HAVE_RTCD) && \ + ((defined(OPUS_X86_MAY_HAVE_SSE) && !defined(OPUS_X86_PRESUME_SSE)) || \ + (defined(OPUS_X86_MAY_HAVE_SSE2) && !defined(OPUS_X86_PRESUME_SSE2)) || \ + (defined(OPUS_X86_MAY_HAVE_SSE4_1) && !defined(OPUS_X86_PRESUME_SSE4_1)) || \ + (defined(OPUS_X86_MAY_HAVE_AVX2) && !defined(OPUS_X86_PRESUME_AVX2))) int opus_select_arch(void); # endif +# if defined(OPUS_X86_MAY_HAVE_SSE2) +# include "opus_defines.h" + /*MOVD should not impose any alignment restrictions, but the C standard does, and UBSan will report errors if we actually make unaligned accesses. Use this to work around those restrictions (which should hopefully all get - optimized to a single MOVD instruction).*/ -#define OP_LOADU_EPI32(x) \ - (int)((*(unsigned char *)(x) | *((unsigned char *)(x) + 1) << 8U |\ - *((unsigned char *)(x) + 2) << 16U | (opus_uint32)*((unsigned char *)(x) + 3) << 24U)) + optimized to a single MOVD instruction). + GCC implemented _mm_loadu_si32() since GCC 11; HOWEVER, there is a bug! + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99754 */ +# if !defined(_MSC_VER) && !OPUS_GNUC_PREREQ(11,3) && !(defined(__clang__) && (__clang_major__ >= 8)) +# include <string.h> +# include <emmintrin.h> + +# ifdef _mm_loadu_si32 +# undef _mm_loadu_si32 +# endif +# define _mm_loadu_si32 WORKAROUND_mm_loadu_si32 +static inline __m128i WORKAROUND_mm_loadu_si32(void const* mem_addr) { + int val; + memcpy(&val, mem_addr, sizeof(val)); + return _mm_cvtsi32_si128(val); +} +# elif defined(_MSC_VER) + /* MSVC needs this for _mm_loadu_si32 */ +# include <immintrin.h> +# endif -#define OP_CVTEPI8_EPI32_M32(x) \ - (_mm_cvtepi8_epi32(_mm_cvtsi32_si128(OP_LOADU_EPI32(x)))) +# define OP_CVTEPI8_EPI32_M32(x) \ + (_mm_cvtepi8_epi32(_mm_loadu_si32(x))) -#define OP_CVTEPI16_EPI32_M64(x) \ - (_mm_cvtepi16_epi32(_mm_loadl_epi64((__m128i *)(x)))) +# define OP_CVTEPI16_EPI32_M64(x) \ + (_mm_cvtepi16_epi32(_mm_loadl_epi64((__m128i *)(void*)(x)))) + +# endif #endif diff --git a/media/libopus/include/opus.h b/media/libopus/include/opus.h index 0c69c627d9..eadeda75a0 100644 --- a/media/libopus/include/opus.h +++ b/media/libopus/include/opus.h @@ -103,7 +103,7 @@ extern "C" { * @endcode * * where opus_encoder_get_size() returns the required size for the encoder state. Note that - * future versions of this code may change the size, so no assuptions should be made about it. + * future versions of this code may change the size, so no assumptions should be made about it. * * The encoder state is always continuous in memory and only a shallow copy is sufficient * to copy it (e.g. memcpy()) @@ -357,7 +357,7 @@ OPUS_EXPORT int opus_encoder_ctl(OpusEncoder *st, int request, ...) OPUS_ARG_NON * error = opus_decoder_init(dec, Fs, channels); * @endcode * where opus_decoder_get_size() returns the required size for the decoder state. Note that - * future versions of this code may change the size, so no assuptions should be made about it. + * future versions of this code may change the size, so no assumptions should be made about it. * * The decoder state is always continuous in memory and only a shallow copy is sufficient * to copy it (e.g. memcpy()) @@ -398,6 +398,21 @@ OPUS_EXPORT int opus_encoder_ctl(OpusEncoder *st, int request, ...) OPUS_ARG_NON */ typedef struct OpusDecoder OpusDecoder; +/** Opus DRED decoder. + * This contains the complete state of an Opus DRED decoder. + * It is position independent and can be freely copied. + * @see opus_dred_decoder_create,opus_dred_decoder_init + */ +typedef struct OpusDREDDecoder OpusDREDDecoder; + + +/** Opus DRED state. + * This contains the complete state of an Opus DRED packet. + * It is position independent and can be freely copied. + * @see opus_dred_create,opus_dred_init + */ +typedef struct OpusDRED OpusDRED; + /** Gets the size of an <code>OpusDecoder</code> structure. * @param [in] channels <tt>int</tt>: Number of channels. * This must be 1 or 2. @@ -511,6 +526,101 @@ OPUS_EXPORT int opus_decoder_ctl(OpusDecoder *st, int request, ...) OPUS_ARG_NON */ OPUS_EXPORT void opus_decoder_destroy(OpusDecoder *st); +/** Gets the size of an <code>OpusDREDDecoder</code> structure. + * @returns The size in bytes. + */ +OPUS_EXPORT int opus_dred_decoder_get_size(void); + +/** Allocates and initializes an OpusDREDDecoder state. + * @param [out] error <tt>int*</tt>: #OPUS_OK Success or @ref opus_errorcodes + */ +OPUS_EXPORT OpusDREDDecoder *opus_dred_decoder_create(int *error); + +/** Initializes an <code>OpusDREDDecoder</code> state. + * @param[in] dec <tt>OpusDREDDecoder*</tt>: State to be initialized. + */ +OPUS_EXPORT int opus_dred_decoder_init(OpusDREDDecoder *dec); + +/** Frees an <code>OpusDREDDecoder</code> allocated by opus_dred_decoder_create(). + * @param[in] dec <tt>OpusDREDDecoder*</tt>: State to be freed. + */ +OPUS_EXPORT void opus_dred_decoder_destroy(OpusDREDDecoder *dec); + +/** Perform a CTL function on an Opus DRED decoder. + * + * Generally the request and subsequent arguments are generated + * by a convenience macro. + * @param dred_dec <tt>OpusDREDDecoder*</tt>: DRED Decoder state. + * @param request This and all remaining parameters should be replaced by one + * of the convenience macros in @ref opus_genericctls or + * @ref opus_decoderctls. + * @see opus_genericctls + * @see opus_decoderctls + */ +OPUS_EXPORT int opus_dred_decoder_ctl(OpusDREDDecoder *dred_dec, int request, ...); + +/** Gets the size of an <code>OpusDRED</code> structure. + * @returns The size in bytes. + */ +OPUS_EXPORT int opus_dred_get_size(void); + +/** Allocates and initializes a DRED state. + * @param [out] error <tt>int*</tt>: #OPUS_OK Success or @ref opus_errorcodes + */ +OPUS_EXPORT OpusDRED *opus_dred_alloc(int *error); + +/** Frees an <code>OpusDRED</code> allocated by opus_dred_create(). + * @param[in] dec <tt>OpusDRED*</tt>: State to be freed. + */ +OPUS_EXPORT void opus_dred_free(OpusDRED *dec); + +/** Decode an Opus DRED packet. + * @param [in] dred_dec <tt>OpusDRED*</tt>: DRED Decoder state + * @param [in] dred <tt>OpusDRED*</tt>: DRED state + * @param [in] data <tt>char*</tt>: Input payload + * @param [in] len <tt>opus_int32</tt>: Number of bytes in payload + * @param [in] max_dred_samples <tt>opus_int32</tt>: Maximum number of DRED samples that may be needed (if available in the packet). + * @param [in] sampling_rate <tt>opus_int32</tt>: Sampling rate used for max_dred_samples argument. Needs not match the actual sampling rate of the decoder. + * @param [out] dred_end <tt>opus_int32*</tt>: Number of non-encoded (silence) samples between the DRED timestamp and the last DRED sample. + * @param [in] defer_processing <tt>int</tt>: Flag (0 or 1). If set to one, the CPU-intensive part of the DRED decoding is deferred until opus_dred_process() is called. + * @returns Offset (positive) of the first decoded DRED samples, zero if no DRED is present, or @ref opus_errorcodes + */ +OPUS_EXPORT int opus_dred_parse(OpusDREDDecoder *dred_dec, OpusDRED *dred, const unsigned char *data, opus_int32 len, opus_int32 max_dred_samples, opus_int32 sampling_rate, int *dred_end, int defer_processing) OPUS_ARG_NONNULL(1); + +/** Finish decoding an Opus DRED packet. The function only needs to be called if opus_dred_parse() was called with defer_processing=1. + * The source and destination will often be the same DRED state. + * @param [in] dred_dec <tt>OpusDRED*</tt>: DRED Decoder state + * @param [in] src <tt>OpusDRED*</tt>: Source DRED state to start the processing from. + * @param [out] dst <tt>OpusDRED*</tt>: Destination DRED state to store the updated state after processing. + * @returns @ref opus_errorcodes + */ +OPUS_EXPORT int opus_dred_process(OpusDREDDecoder *dred_dec, const OpusDRED *src, OpusDRED *dst); + +/** Decode audio from an Opus DRED packet with floating point output. + * @param [in] st <tt>OpusDecoder*</tt>: Decoder state + * @param [in] dred <tt>OpusDRED*</tt>: DRED state + * @param [in] dred_offset <tt>opus_int32</tt>: position of the redundancy to decode (in samples before the beginning of the real audio data in the packet). + * @param [out] pcm <tt>opus_int16*</tt>: Output signal (interleaved if 2 channels). length + * is frame_size*channels*sizeof(opus_int16) + * @param [in] frame_size Number of samples per channel to decode in \a pcm. + * frame_size <b>must</b> be a multiple of 2.5 ms. + * @returns Number of decoded samples or @ref opus_errorcodes + */ +OPUS_EXPORT int opus_decoder_dred_decode(OpusDecoder *st, const OpusDRED *dred, opus_int32 dred_offset, opus_int16 *pcm, opus_int32 frame_size); + +/** Decode audio from an Opus DRED packet with floating point output. + * @param [in] st <tt>OpusDecoder*</tt>: Decoder state + * @param [in] dred <tt>OpusDRED*</tt>: DRED state + * @param [in] dred_offset <tt>opus_int32</tt>: position of the redundancy to decode (in samples before the beginning of the real audio data in the packet). + * @param [out] pcm <tt>float*</tt>: Output signal (interleaved if 2 channels). length + * is frame_size*channels*sizeof(float) + * @param [in] frame_size Number of samples per channel to decode in \a pcm. + * frame_size <b>must</b> be a multiple of 2.5 ms. + * @returns Number of decoded samples or @ref opus_errorcodes + */ +OPUS_EXPORT int opus_decoder_dred_decode_float(OpusDecoder *st, const OpusDRED *dred, opus_int32 dred_offset, float *pcm, opus_int32 frame_size); + + /** Parse an opus packet into one or more frames. * Opus_decode will perform this operation internally so most applications do * not need to use this function. @@ -583,6 +693,14 @@ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_packet_get_nb_frames(const unsigned */ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_packet_get_nb_samples(const unsigned char packet[], opus_int32 len, opus_int32 Fs) OPUS_ARG_NONNULL(1); +/** Checks whether an Opus packet has LBRR. + * @param [in] packet <tt>char*</tt>: Opus packet + * @param [in] len <tt>opus_int32</tt>: Length of packet + * @returns 1 is LBRR is present, 0 otherwise + * @retval OPUS_INVALID_PACKET The compressed data passed is corrupted or of an unsupported type + */ +OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_packet_has_lbrr(const unsigned char packet[], opus_int32 len); + /** Gets the number of samples of an Opus packet. * @param [in] dec <tt>OpusDecoder*</tt>: Decoder state * @param [in] packet <tt>char*</tt>: Opus packet diff --git a/media/libopus/include/opus_defines.h b/media/libopus/include/opus_defines.h index 94b9e0d9fc..cd8f4dde86 100644 --- a/media/libopus/include/opus_defines.h +++ b/media/libopus/include/opus_defines.h @@ -169,15 +169,32 @@ extern "C" { #define OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST 4046 #define OPUS_GET_PHASE_INVERSION_DISABLED_REQUEST 4047 #define OPUS_GET_IN_DTX_REQUEST 4049 +#define OPUS_SET_DRED_DURATION_REQUEST 4050 +#define OPUS_GET_DRED_DURATION_REQUEST 4051 +#define OPUS_SET_DNN_BLOB_REQUEST 4052 +/*#define OPUS_GET_DNN_BLOB_REQUEST 4053 */ /** Defines for the presence of extended APIs. */ #define OPUS_HAVE_OPUS_PROJECTION_H /* Macros to trigger compilation errors when the wrong types are provided to a CTL */ #define __opus_check_int(x) (((void)((x) == (opus_int32)0)), (opus_int32)(x)) + +#ifdef DISABLE_PTR_CHECK +/* Disable checks to prevent ubsan from complaining about NULL checks + in test_opus_api. */ +#define __opus_check_int_ptr(ptr) (ptr) +#define __opus_check_uint_ptr(ptr) (ptr) +#define __opus_check_uint8_ptr(ptr) (ptr) +#define __opus_check_val16_ptr(ptr) (ptr) +#define __opus_check_void_ptr(ptr) (ptr) +#else #define __opus_check_int_ptr(ptr) ((ptr) + ((ptr) - (opus_int32*)(ptr))) #define __opus_check_uint_ptr(ptr) ((ptr) + ((ptr) - (opus_uint32*)(ptr))) +#define __opus_check_uint8_ptr(ptr) ((ptr) + ((ptr) - (opus_uint8*)(ptr))) #define __opus_check_val16_ptr(ptr) ((ptr) + ((ptr) - (opus_val16*)(ptr))) +#define __opus_check_void_ptr(x) ((void)((void *)0 == (x)), (x)) +#endif /** @endcond */ /** @defgroup opus_ctlvalues Pre-defined values for CTL interface @@ -620,6 +637,18 @@ extern "C" { * @hideinitializer */ #define OPUS_GET_PREDICTION_DISABLED(x) OPUS_GET_PREDICTION_DISABLED_REQUEST, __opus_check_int_ptr(x) +/** If non-zero, enables Deep Redundancy (DRED) and use the specified maximum number of 10-ms redundant frames + * @hideinitializer */ +#define OPUS_SET_DRED_DURATION(x) OPUS_SET_DRED_DURATION_REQUEST, __opus_check_int(x) +/** Gets the encoder's configured Deep Redundancy (DRED) maximum number of frames. + * @hideinitializer */ +#define OPUS_GET_DRED_DURATION(x) OPUS_GET_DRED_DURATION_REQUEST, __opus_check_int_ptr(x) + +/** Provide external DNN weights from binary object (only when explicitly built without the weights) + * @hideinitializer */ +#define OPUS_SET_DNN_BLOB(data, len) OPUS_SET_DNN_BLOB_REQUEST, __opus_check_void_ptr(data), __opus_check_int(len) + + /**@}*/ /** @defgroup opus_genericctls Generic CTLs diff --git a/media/libopus/include/opus_multistream.h b/media/libopus/include/opus_multistream.h index babcee6905..824cc55ac5 100644 --- a/media/libopus/include/opus_multistream.h +++ b/media/libopus/include/opus_multistream.h @@ -143,7 +143,7 @@ extern "C" { * <a href="https://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-810004.3.9">Vorbis * channel ordering</a>. A decoder may wish to apply an additional permutation * to the mapping the encoder used to achieve a different output channel - * order (e.g. for outputing in WAV order). + * order (e.g. for outputting in WAV order). * * Each multistream packet contains an Opus packet for each stream, and all of * the Opus packets in a single multistream packet must have the same diff --git a/media/libopus/moz.build b/media/libopus/moz.build index 6acb9b7e27..44c0ab7c90 100644 --- a/media/libopus/moz.build +++ b/media/libopus/moz.build @@ -21,7 +21,7 @@ FINAL_LIBRARY = "gkcodecs" NoVisibilityFlags() DEFINES["OPUS_BUILD"] = True -DEFINES["OPUS_VERSION"] = "c85499757c148fede8604cffa12454206b6138ba" +DEFINES["OPUS_VERSION"] = "ab4e83598e7fc8b2ce82dc633a0fc0c452b629aa" DEFINES["USE_ALLOCA"] = True DEFINES["ENABLE_HARDENING"] = True diff --git a/media/libopus/moz.yaml b/media/libopus/moz.yaml index 1b1ae14ec2..ed76d36d1f 100644 --- a/media/libopus/moz.yaml +++ b/media/libopus/moz.yaml @@ -20,11 +20,11 @@ origin: # Human-readable identifier for this version/release # Generally "version NNN", "tag SSS", "bookmark SSS" - release: c85499757c148fede8604cffa12454206b6138ba (2023-11-03T15:07:54.000-07:00). + release: ab4e83598e7fc8b2ce82dc633a0fc0c452b629aa (2024-03-04T11:53:07.000-05:00). # Revision to pull in # Must be a long or short commit SHA (long preferred) - revision: c85499757c148fede8604cffa12454206b6138ba + revision: ab4e83598e7fc8b2ce82dc633a0fc0c452b629aa # The package's license, where possible using the mnemonic from # https://spdx.org/licenses/ diff --git a/media/libopus/silk/API.h b/media/libopus/silk/API.h index 4d90ff9aa3..878965c73a 100644 --- a/media/libopus/silk/API.h +++ b/media/libopus/silk/API.h @@ -34,6 +34,10 @@ POSSIBILITY OF SUCH DAMAGE. #include "entenc.h" #include "entdec.h" +#ifdef ENABLE_DEEP_PLC +#include "lpcnet_private.h" +#endif + #ifdef __cplusplus extern "C" { @@ -88,6 +92,16 @@ opus_int silk_Encode( /* O Returns error co /* Decoder functions */ /****************************************/ + +/***********************************************/ +/* Load OSCE models from external data pointer */ +/***********************************************/ +opus_int silk_LoadOSCEModels( + void *decState, /* O I/O State */ + const unsigned char *data, /* I pointer to binary blob */ + int len /* I length of binary blob data */ +); + /***********************************************/ /* Get size in bytes of the Silk decoder state */ /***********************************************/ @@ -96,8 +110,12 @@ opus_int silk_Get_Decoder_Size( /* O Returns error co ); /*************************/ -/* Init or Reset decoder */ +/* Init and Reset decoder */ /*************************/ +opus_int silk_ResetDecoder( /* O Returns error code */ + void *decState /* I/O State */ +); + opus_int silk_InitDecoder( /* O Returns error code */ void *decState /* I/O State */ ); @@ -113,6 +131,9 @@ opus_int silk_Decode( /* O Returns error co ec_dec *psRangeDec, /* I/O Compressor data structure */ opus_int16 *samplesOut, /* O Decoded output speech vector */ opus_int32 *nSamplesOut, /* O Number of samples decoded */ +#ifdef ENABLE_DEEP_PLC + LPCNetPLCState *lpcnet, +#endif int arch /* I Run-time architecture */ ); diff --git a/media/libopus/silk/NSQ.c b/media/libopus/silk/NSQ.c index c99ec5bce5..1caa829bbe 100644 --- a/media/libopus/silk/NSQ.c +++ b/media/libopus/silk/NSQ.c @@ -80,7 +80,7 @@ void silk_NSQ_c SideInfoIndices *psIndices, /* I/O Quantization Indices */ const opus_int16 x16[], /* I Input */ opus_int8 pulses[], /* O Quantized pulse signal */ - const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefs */ + const opus_int16 *PredCoef_Q12, /* I Short term prediction coefs */ const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefs */ const opus_int16 AR_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs */ const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I Long term shaping coefs */ diff --git a/media/libopus/silk/NSQ_del_dec.c b/media/libopus/silk/NSQ_del_dec.c index 77f72cec3a..e8dadf1591 100644 --- a/media/libopus/silk/NSQ_del_dec.c +++ b/media/libopus/silk/NSQ_del_dec.c @@ -120,7 +120,7 @@ void silk_NSQ_del_dec_c( SideInfoIndices *psIndices, /* I/O Quantization Indices */ const opus_int16 x16[], /* I Input */ opus_int8 pulses[], /* O Quantized pulse signal */ - const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefs */ + const opus_int16 *PredCoef_Q12, /* I Short term prediction coefs */ const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefs */ const opus_int16 AR_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs */ const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I Long term shaping coefs */ diff --git a/media/libopus/silk/PLC.c b/media/libopus/silk/PLC.c index 4667440db2..b35bf750a0 100644 --- a/media/libopus/silk/PLC.c +++ b/media/libopus/silk/PLC.c @@ -33,6 +33,10 @@ POSSIBILITY OF SUCH DAMAGE. #include "stack_alloc.h" #include "PLC.h" +#ifdef ENABLE_DEEP_PLC +#include "lpcnet.h" +#endif + #define NB_ATT 2 static const opus_int16 HARM_ATT_Q15[NB_ATT] = { 32440, 31130 }; /* 0.99, 0.95 */ static const opus_int16 PLC_RAND_ATTENUATE_V_Q15[NB_ATT] = { 31130, 26214 }; /* 0.95, 0.8 */ @@ -47,6 +51,9 @@ static OPUS_INLINE void silk_PLC_conceal( silk_decoder_state *psDec, /* I/O Decoder state */ silk_decoder_control *psDecCtrl, /* I/O Decoder control */ opus_int16 frame[], /* O LPC residual signal */ +#ifdef ENABLE_DEEP_PLC + LPCNetPLCState *lpcnet, +#endif int arch /* I Run-time architecture */ ); @@ -67,6 +74,9 @@ void silk_PLC( silk_decoder_control *psDecCtrl, /* I/O Decoder control */ opus_int16 frame[], /* I/O signal */ opus_int lost, /* I Loss flag */ +#ifdef ENABLE_DEEP_PLC + LPCNetPLCState *lpcnet, +#endif int arch /* I Run-time architecture */ ) { @@ -80,7 +90,11 @@ void silk_PLC( /****************************/ /* Generate Signal */ /****************************/ - silk_PLC_conceal( psDec, psDecCtrl, frame, arch ); + silk_PLC_conceal( psDec, psDecCtrl, frame, +#ifdef ENABLE_DEEP_PLC + lpcnet, +#endif + arch ); psDec->lossCnt++; } else { @@ -88,6 +102,14 @@ void silk_PLC( /* Update state */ /****************************/ silk_PLC_update( psDec, psDecCtrl ); +#ifdef ENABLE_DEEP_PLC + if ( lpcnet != NULL && psDec->sPLC.fs_kHz == 16 ) { + int k; + for( k = 0; k < psDec->nb_subfr; k += 2 ) { + lpcnet_plc_update( lpcnet, frame + k * psDec->subfr_length ); + } + } +#endif } } @@ -195,6 +217,9 @@ static OPUS_INLINE void silk_PLC_conceal( silk_decoder_state *psDec, /* I/O Decoder state */ silk_decoder_control *psDecCtrl, /* I/O Decoder control */ opus_int16 frame[], /* O LPC residual signal */ +#ifdef ENABLE_DEEP_PLC + LPCNetPLCState *lpcnet, +#endif int arch /* I Run-time architecture */ ) { @@ -371,6 +396,24 @@ static OPUS_INLINE void silk_PLC_conceal( /* Scale with Gain */ frame[ i ] = (opus_int16)silk_SAT16( silk_SAT16( silk_RSHIFT_ROUND( silk_SMULWW( sLPC_Q14_ptr[ MAX_LPC_ORDER + i ], prevGain_Q10[ 1 ] ), 8 ) ) ); } +#ifdef ENABLE_DEEP_PLC + if ( lpcnet != NULL && lpcnet->loaded && psDec->sPLC.fs_kHz == 16 ) { + int run_deep_plc = psDec->sPLC.enable_deep_plc || lpcnet->fec_fill_pos != 0; + if( run_deep_plc ) { + for( k = 0; k < psDec->nb_subfr; k += 2 ) { + lpcnet_plc_conceal( lpcnet, frame + k * psDec->subfr_length ); + } + /* We *should* be able to copy only from psDec->frame_length-MAX_LPC_ORDER, i.e. the last MAX_LPC_ORDER samples. */ + for( i = 0; i < psDec->frame_length; i++ ) { + sLPC_Q14_ptr[ MAX_LPC_ORDER + i ] = (int)floor(.5 + frame[ i ] * (float)(1 << 24) / prevGain_Q10[ 1 ] ); + } + } else { + for( k = 0; k < psDec->nb_subfr; k += 2 ) { + lpcnet_plc_update( lpcnet, frame + k * psDec->subfr_length ); + } + } + } +#endif /* Save LPC state */ silk_memcpy( psDec->sLPC_Q14_buf, &sLPC_Q14_ptr[ psDec->frame_length ], MAX_LPC_ORDER * sizeof( opus_int32 ) ); @@ -431,12 +474,16 @@ void silk_PLC_glue_frames( slope_Q16 = silk_DIV32_16( ( (opus_int32)1 << 16 ) - gain_Q16, length ); /* Make slope 4x steeper to avoid missing onsets after DTX */ slope_Q16 = silk_LSHIFT( slope_Q16, 2 ); - - for( i = 0; i < length; i++ ) { - frame[ i ] = silk_SMULWB( gain_Q16, frame[ i ] ); - gain_Q16 += slope_Q16; - if( gain_Q16 > (opus_int32)1 << 16 ) { - break; +#ifdef ENABLE_DEEP_PLC + if ( psDec->sPLC.fs_kHz != 16 ) +#endif + { + for( i = 0; i < length; i++ ) { + frame[ i ] = silk_SMULWB( gain_Q16, frame[ i ] ); + gain_Q16 += slope_Q16; + if( gain_Q16 > (opus_int32)1 << 16 ) { + break; + } } } } diff --git a/media/libopus/silk/PLC.h b/media/libopus/silk/PLC.h index 6438f51633..1bebb78638 100644 --- a/media/libopus/silk/PLC.h +++ b/media/libopus/silk/PLC.h @@ -49,6 +49,9 @@ void silk_PLC( silk_decoder_control *psDecCtrl, /* I/O Decoder control */ opus_int16 frame[], /* I/O signal */ opus_int lost, /* I Loss flag */ +#ifdef ENABLE_DEEP_PLC + LPCNetPLCState *lpcnet, +#endif int arch /* I Run-time architecture */ ); diff --git a/media/libopus/silk/arm/NSQ_del_dec_arm.h b/media/libopus/silk/arm/NSQ_del_dec_arm.h index 9e76e16927..0c4fcfccb4 100644 --- a/media/libopus/silk/arm/NSQ_del_dec_arm.h +++ b/media/libopus/silk/arm/NSQ_del_dec_arm.h @@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE. void silk_NSQ_del_dec_neon( const silk_encoder_state *psEncC, silk_nsq_state *NSQ, SideInfoIndices *psIndices, const opus_int16 x16[], opus_int8 pulses[], - const opus_int16 PredCoef_Q12[2 * MAX_LPC_ORDER], + const opus_int16 *PredCoef_Q12, const opus_int16 LTPCoef_Q14[LTP_ORDER * MAX_NB_SUBFR], const opus_int16 AR_Q13[MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER], const opus_int HarmShapeGain_Q14[MAX_NB_SUBFR], @@ -65,7 +65,7 @@ void silk_NSQ_del_dec_neon( extern void (*const SILK_NSQ_DEL_DEC_IMPL[OPUS_ARCHMASK + 1])( const silk_encoder_state *psEncC, silk_nsq_state *NSQ, SideInfoIndices *psIndices, const opus_int16 x16[], opus_int8 pulses[], - const opus_int16 PredCoef_Q12[2 * MAX_LPC_ORDER], + const opus_int16 *PredCoef_Q12, const opus_int16 LTPCoef_Q14[LTP_ORDER * MAX_NB_SUBFR], const opus_int16 AR_Q13[MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER], const opus_int HarmShapeGain_Q14[MAX_NB_SUBFR], diff --git a/media/libopus/silk/arm/NSQ_del_dec_neon_intr.c b/media/libopus/silk/arm/NSQ_del_dec_neon_intr.c index 212410f362..668dde6dc4 100644 --- a/media/libopus/silk/arm/NSQ_del_dec_neon_intr.c +++ b/media/libopus/silk/arm/NSQ_del_dec_neon_intr.c @@ -35,6 +35,7 @@ POSSIBILITY OF SUCH DAMAGE. #endif #include "main.h" #include "stack_alloc.h" +#include "os_support.h" /* NEON intrinsics optimization now can only parallelize up to 4 delay decision states. */ /* If there are more states, C function is called, and this optimization must be expanded. */ @@ -220,7 +221,7 @@ void silk_NSQ_del_dec_neon( SideInfoIndices *psIndices, /* I/O Quantization Indices */ const opus_int16 x16[], /* I Input */ opus_int8 pulses[], /* O Quantized pulse signal */ - const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefs */ + const opus_int16 *PredCoef_Q12, /* I Short term prediction coefs */ const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefs */ const opus_int16 AR_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs */ const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I Long term shaping coefs */ @@ -279,6 +280,7 @@ void silk_NSQ_del_dec_neon( /* Initialize delayed decision states */ ALLOC( psDelDec, 1, NSQ_del_decs_struct ); + OPUS_CLEAR(psDelDec, 1); /* Only RandState and RD_Q10 need to be initialized to 0. */ silk_memset( psDelDec->RandState, 0, sizeof( psDelDec->RandState ) ); vst1q_s32( psDelDec->RD_Q10, vdupq_n_s32( 0 ) ); @@ -587,6 +589,7 @@ static OPUS_INLINE void silk_noise_shape_quantizer_del_dec_neon( silk_assert( nStatesDelayedDecision > 0 ); silk_assert( ( shapingLPCOrder & 1 ) == 0 ); /* check that order is even */ ALLOC( psSampleState, 2, NSQ_samples_struct ); + OPUS_CLEAR(psSampleState, 2); shp_lag_ptr = &NSQ->sLTP_shp_Q14[ NSQ->sLTP_shp_buf_idx - lag + HARM_SHAPE_FIR_TAPS / 2 ]; pred_lag_ptr = &sLTP_Q15[ NSQ->sLTP_buf_idx - lag + LTP_ORDER / 2 ]; @@ -711,23 +714,26 @@ static OPUS_INLINE void silk_noise_shape_quantizer_del_dec_neon( const int rdo_offset = Lambda_Q10/2 - 512; const uint16x4_t greaterThanRdo = vcgt_s16( q1_Q10_s16x4, vdup_n_s16( rdo_offset ) ); const uint16x4_t lessThanMinusRdo = vclt_s16( q1_Q10_s16x4, vdup_n_s16( -rdo_offset ) ); + int16x4_t signed_offset = vbsl_s16( greaterThanRdo, vdup_n_s16( -rdo_offset ), vdup_n_s16( 0 ) ); + signed_offset = vbsl_s16( lessThanMinusRdo, vdup_n_s16( rdo_offset ), signed_offset ); /* If Lambda_Q10 > 32767, then q1_Q0, q1_Q10 and q2_Q10 must change to 32-bit. */ silk_assert( Lambda_Q10 <= 32767 ); q1_Q0_s16x4 = vreinterpret_s16_u16( vclt_s16( q1_Q10_s16x4, vdup_n_s16( 0 ) ) ); - q1_Q0_s16x4 = vbsl_s16( greaterThanRdo, vsub_s16( q1_Q10_s16x4, vdup_n_s16( rdo_offset ) ), q1_Q0_s16x4 ); - q1_Q0_s16x4 = vbsl_s16( lessThanMinusRdo, vadd_s16( q1_Q10_s16x4, vdup_n_s16( rdo_offset ) ), q1_Q0_s16x4 ); + q1_Q0_s16x4 = vbsl_s16(vorr_u16(greaterThanRdo, lessThanMinusRdo), vadd_s16( q1_Q10_s16x4 , signed_offset), q1_Q0_s16x4); q1_Q0_s16x4 = vshr_n_s16( q1_Q0_s16x4, 10 ); } { const uint16x4_t equal0_u16x4 = vceq_s16( q1_Q0_s16x4, vdup_n_s16( 0 ) ); const uint16x4_t equalMinus1_u16x4 = vceq_s16( q1_Q0_s16x4, vdup_n_s16( -1 ) ); const uint16x4_t lessThanMinus1_u16x4 = vclt_s16( q1_Q0_s16x4, vdup_n_s16( -1 ) ); - int16x4_t tmp1_s16x4, tmp2_s16x4; + int16x4_t tmp1_s16x4, tmp2_s16x4, tmp_summand_s16x4; q1_Q10_s16x4 = vshl_n_s16( q1_Q0_s16x4, 10 ); - tmp1_s16x4 = vadd_s16( q1_Q10_s16x4, vdup_n_s16( offset_Q10 - QUANT_LEVEL_ADJUST_Q10 ) ); - q1_Q10_s16x4 = vadd_s16( q1_Q10_s16x4, vdup_n_s16( offset_Q10 + QUANT_LEVEL_ADJUST_Q10 ) ); + tmp_summand_s16x4 = vand_s16( vreinterpret_s16_u16(vcge_s16(q1_Q0_s16x4, vdup_n_s16(0))), vdup_n_s16( offset_Q10 - QUANT_LEVEL_ADJUST_Q10 ) ); + tmp1_s16x4 = vadd_s16( q1_Q10_s16x4, tmp_summand_s16x4 ); + tmp_summand_s16x4 = vbsl_s16( lessThanMinus1_u16x4, vdup_n_s16( offset_Q10 + QUANT_LEVEL_ADJUST_Q10 ), vdup_n_s16(0) ); + q1_Q10_s16x4 = vadd_s16( q1_Q10_s16x4, tmp_summand_s16x4); q1_Q10_s16x4 = vbsl_s16( lessThanMinus1_u16x4, q1_Q10_s16x4, tmp1_s16x4 ); q1_Q10_s16x4 = vbsl_s16( equal0_u16x4, vdup_n_s16( offset_Q10 ), q1_Q10_s16x4 ); q1_Q10_s16x4 = vbsl_s16( equalMinus1_u16x4, vdup_n_s16( offset_Q10 - ( 1024 - QUANT_LEVEL_ADJUST_Q10 ) ), q1_Q10_s16x4 ); @@ -818,6 +824,13 @@ static OPUS_INLINE void silk_noise_shape_quantizer_del_dec_neon( } } + /* clear unused part of RD_Q10 to avoid overflows */ + if( nStatesDelayedDecision < NEON_MAX_DEL_DEC_STATES ) + { + OPUS_CLEAR(psSampleState[0].RD_Q10 + nStatesDelayedDecision, NEON_MAX_DEL_DEC_STATES - nStatesDelayedDecision); + OPUS_CLEAR(psSampleState[1].RD_Q10 + nStatesDelayedDecision, NEON_MAX_DEL_DEC_STATES - nStatesDelayedDecision); + } + /* Increase RD values of expired states */ { uint32x4_t t_u32x4; @@ -896,7 +909,8 @@ static OPUS_INLINE void silk_noise_shape_quantizer_del_dec_neon( vst1q_s32( psDelDec->Pred_Q15[ *smpl_buf_idx ], vshlq_n_s32( vld1q_s32( psSampleState[ 0 ].LPC_exc_Q14 ), 1 ) ); vst1q_s32( psDelDec->Shape_Q14[ *smpl_buf_idx ], vld1q_s32( psSampleState[ 0 ].sLTP_shp_Q14 ) ); tmp1_s32x4 = vrshrq_n_s32( tmp1_s32x4, 10 ); - tmp1_s32x4 = vaddq_s32( vld1q_s32( psDelDec->Seed ), tmp1_s32x4 ); + tmp1_s32x4 = vreinterpretq_s32_u32( vaddq_u32( vreinterpretq_u32_s32( + vld1q_s32( psDelDec->Seed ) ), vreinterpretq_u32_s32( tmp1_s32x4 ) ) ); vst1q_s32( psDelDec->Seed, tmp1_s32x4 ); vst1q_s32( psDelDec->RandState[ *smpl_buf_idx ], tmp1_s32x4 ); vst1q_s32( psDelDec->RD_Q10, vld1q_s32( psSampleState[ 0 ].RD_Q10 ) ); diff --git a/media/libopus/silk/arm/NSQ_neon.h b/media/libopus/silk/arm/NSQ_neon.h index b31d9442d6..f03d8ddd98 100644 --- a/media/libopus/silk/arm/NSQ_neon.h +++ b/media/libopus/silk/arm/NSQ_neon.h @@ -73,7 +73,7 @@ static OPUS_INLINE void silk_short_prediction_create_arch_coef_neon(opus_int32 * #elif defined(OPUS_HAVE_RTCD) && defined(OPUS_ARM_MAY_HAVE_NEON_INTR) #define silk_short_prediction_create_arch_coef(out, in, order) \ - do { if (arch == OPUS_ARCH_ARM_NEON) { silk_short_prediction_create_arch_coef_neon(out, in, order); } } while (0) + do { if (arch >= OPUS_ARCH_ARM_NEON) { silk_short_prediction_create_arch_coef_neon(out, in, order); } } while (0) #endif @@ -95,7 +95,7 @@ opus_int32 silk_NSQ_noise_shape_feedback_loop_neon(const opus_int32 *data0, opus (coef vs. coefRev) so can't use the usual IMPL table implementation */ #undef silk_noise_shape_quantizer_short_prediction #define silk_noise_shape_quantizer_short_prediction(in, coef, coefRev, order, arch) \ - (arch == OPUS_ARCH_ARM_NEON ? \ + (arch >= OPUS_ARCH_ARM_NEON ? \ silk_noise_shape_quantizer_short_prediction_neon(in, coefRev, order) : \ silk_noise_shape_quantizer_short_prediction_c(in, coef, order)) diff --git a/media/libopus/silk/arm/arm_silk_map.c b/media/libopus/silk/arm/arm_silk_map.c index 0b9bfec2ca..a91f79b59f 100644 --- a/media/libopus/silk/arm/arm_silk_map.c +++ b/media/libopus/silk/arm/arm_silk_map.c @@ -49,6 +49,7 @@ void (*const SILK_BIQUAD_ALT_STRIDE2_IMPL[OPUS_ARCHMASK + 1])( silk_biquad_alt_stride2_c, /* EDSP */ silk_biquad_alt_stride2_c, /* Media */ silk_biquad_alt_stride2_neon, /* Neon */ + silk_biquad_alt_stride2_neon, /* dotprod */ }; opus_int32 (*const SILK_LPC_INVERSE_PRED_GAIN_IMPL[OPUS_ARCHMASK + 1])( /* O Returns inverse prediction gain in energy domain, Q30 */ @@ -59,6 +60,7 @@ opus_int32 (*const SILK_LPC_INVERSE_PRED_GAIN_IMPL[OPUS_ARCHMASK + 1])( /* O R silk_LPC_inverse_pred_gain_c, /* EDSP */ silk_LPC_inverse_pred_gain_c, /* Media */ silk_LPC_inverse_pred_gain_neon, /* Neon */ + silk_LPC_inverse_pred_gain_neon, /* dotprod */ }; void (*const SILK_NSQ_DEL_DEC_IMPL[OPUS_ARCHMASK + 1])( @@ -67,7 +69,7 @@ void (*const SILK_NSQ_DEL_DEC_IMPL[OPUS_ARCHMASK + 1])( SideInfoIndices *psIndices, /* I/O Quantization Indices */ const opus_int16 x16[], /* I Input */ opus_int8 pulses[], /* O Quantized pulse signal */ - const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefs */ + const opus_int16 *PredCoef_Q12, /* I Short term prediction coefs */ const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefs */ const opus_int16 AR_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs */ const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I Long term shaping coefs */ @@ -82,6 +84,7 @@ void (*const SILK_NSQ_DEL_DEC_IMPL[OPUS_ARCHMASK + 1])( silk_NSQ_del_dec_c, /* EDSP */ silk_NSQ_del_dec_c, /* Media */ silk_NSQ_del_dec_neon, /* Neon */ + silk_NSQ_del_dec_neon, /* dotprod */ }; /*There is no table for silk_noise_shape_quantizer_short_prediction because the @@ -97,6 +100,7 @@ opus_int32 silk_NSQ_noise_shape_feedback_loop_c, /* EDSP */ silk_NSQ_noise_shape_feedback_loop_c, /* Media */ silk_NSQ_noise_shape_feedback_loop_neon, /* NEON */ + silk_NSQ_noise_shape_feedback_loop_neon, /* dotprod */ }; # endif @@ -116,6 +120,7 @@ void (*const SILK_WARPED_AUTOCORRELATION_FIX_IMPL[OPUS_ARCHMASK + 1])( silk_warped_autocorrelation_FIX_c, /* EDSP */ silk_warped_autocorrelation_FIX_c, /* Media */ silk_warped_autocorrelation_FIX_neon, /* Neon */ + silk_warped_autocorrelation_FIX_neon, /* dotprod */ }; # endif diff --git a/media/libopus/silk/control.h b/media/libopus/silk/control.h index b76ec33cd6..f5633e624e 100644 --- a/media/libopus/silk/control.h +++ b/media/libopus/silk/control.h @@ -77,6 +77,9 @@ typedef struct { /* I: Flag to enable in-band Forward Error Correction (FEC); 0/1 */ opus_int useInBandFEC; + /* I: Flag to enable in-band Deep REDundancy (DRED); 0/1 */ + opus_int useDRED; + /* I: Flag to actually code in-band Forward Error Correction (FEC) in the current packet; 0/1 */ opus_int LBRR_coded; @@ -141,6 +144,14 @@ typedef struct { /* O: Pitch lag of previous frame (0 if unvoiced), measured in samples at 48 kHz */ opus_int prevPitchLag; + + /* I: Enable Deep PLC */ + opus_int enable_deep_plc; + +#ifdef ENABLE_OSCE + /* I: OSCE method */ + opus_int osce_method; +#endif } silk_DecControlStruct; #ifdef __cplusplus diff --git a/media/libopus/silk/dec_API.c b/media/libopus/silk/dec_API.c index 7d5ca7fb9f..c1091d13ed 100644 --- a/media/libopus/silk/dec_API.c +++ b/media/libopus/silk/dec_API.c @@ -33,6 +33,11 @@ POSSIBILITY OF SUCH DAMAGE. #include "stack_alloc.h" #include "os_support.h" +#ifdef ENABLE_OSCE +#include "osce.h" +#include "osce_structs.h" +#endif + /************************/ /* Decoder Super Struct */ /************************/ @@ -42,12 +47,33 @@ typedef struct { opus_int nChannelsAPI; opus_int nChannelsInternal; opus_int prev_decode_only_middle; +#ifdef ENABLE_OSCE + OSCEModel osce_model; +#endif } silk_decoder; /*********************/ /* Decoder functions */ /*********************/ + + +opus_int silk_LoadOSCEModels(void *decState, const unsigned char *data, int len) +{ +#ifdef ENABLE_OSCE + opus_int ret = SILK_NO_ERROR; + + ret = osce_load_models(&((silk_decoder *)decState)->osce_model, data, len); + ((silk_decoder *)decState)->osce_model.loaded = (ret == 0); + return ret; +#else + (void) decState; + (void) data; + (void) len; + return SILK_NO_ERROR; +#endif +} + opus_int silk_Get_Decoder_Size( /* O Returns error code */ opus_int *decSizeBytes /* O Number of bytes in SILK decoder state */ ) @@ -60,12 +86,37 @@ opus_int silk_Get_Decoder_Size( /* O Returns error co } /* Reset decoder state */ +opus_int silk_ResetDecoder( /* O Returns error code */ + void *decState /* I/O State */ +) +{ + opus_int n, ret = SILK_NO_ERROR; + silk_decoder_state *channel_state = ((silk_decoder *)decState)->channel_state; + + for( n = 0; n < DECODER_NUM_CHANNELS; n++ ) { + ret = silk_reset_decoder( &channel_state[ n ] ); + } + silk_memset(&((silk_decoder *)decState)->sStereo, 0, sizeof(((silk_decoder *)decState)->sStereo)); + /* Not strictly needed, but it's cleaner that way */ + ((silk_decoder *)decState)->prev_decode_only_middle = 0; + + return ret; +} + + opus_int silk_InitDecoder( /* O Returns error code */ void *decState /* I/O State */ ) { opus_int n, ret = SILK_NO_ERROR; silk_decoder_state *channel_state = ((silk_decoder *)decState)->channel_state; +#ifdef ENABLE_OSCE + ((silk_decoder *)decState)->osce_model.loaded = 0; +#endif +#ifndef USE_WEIGHTS_FILE + /* load osce models */ + silk_LoadOSCEModels(decState, NULL, 0); +#endif for( n = 0; n < DECODER_NUM_CHANNELS; n++ ) { ret = silk_init_decoder( &channel_state[ n ] ); @@ -86,6 +137,9 @@ opus_int silk_Decode( /* O Returns error co ec_dec *psRangeDec, /* I/O Compressor data structure */ opus_int16 *samplesOut, /* O Decoded output speech vector */ opus_int32 *nSamplesOut, /* O Number of samples decoded */ +#ifdef ENABLE_DEEP_PLC + LPCNetPLCState *lpcnet, +#endif int arch /* I Run-time architecture */ ) { @@ -278,6 +332,7 @@ opus_int silk_Decode( /* O Returns error co has_side = !psDec->prev_decode_only_middle || (decControl->nChannelsInternal == 2 && lostFlag == FLAG_DECODE_LBRR && channel_state[1].LBRR_flags[ channel_state[1].nFramesDecoded ] == 1 ); } + channel_state[ 0 ].sPLC.enable_deep_plc = decControl->enable_deep_plc; /* Call decoder for one frame */ for( n = 0; n < decControl->nChannelsInternal; n++ ) { if( n == 0 || has_side ) { @@ -297,7 +352,19 @@ opus_int silk_Decode( /* O Returns error co } else { condCoding = CODE_CONDITIONALLY; } - ret += silk_decode_frame( &channel_state[ n ], psRangeDec, &samplesOut1_tmp[ n ][ 2 ], &nSamplesOutDec, lostFlag, condCoding, arch); +#ifdef ENABLE_OSCE + if ( channel_state[n].osce.method != decControl->osce_method ) { + osce_reset( &channel_state[n].osce, decControl->osce_method ); + } +#endif + ret += silk_decode_frame( &channel_state[ n ], psRangeDec, &samplesOut1_tmp[ n ][ 2 ], &nSamplesOutDec, lostFlag, condCoding, +#ifdef ENABLE_DEEP_PLC + n == 0 ? lpcnet : NULL, +#endif +#ifdef ENABLE_OSCE + &psDec->osce_model, +#endif + arch); } else { silk_memset( &samplesOut1_tmp[ n ][ 2 ], 0, nSamplesOutDec * sizeof( opus_int16 ) ); } diff --git a/media/libopus/silk/decode_frame.c b/media/libopus/silk/decode_frame.c index 4f36f854c2..9bc4ca2b0e 100644 --- a/media/libopus/silk/decode_frame.c +++ b/media/libopus/silk/decode_frame.c @@ -33,6 +33,10 @@ POSSIBILITY OF SUCH DAMAGE. #include "stack_alloc.h" #include "PLC.h" +#ifdef ENABLE_OSCE +#include "osce.h" +#endif + /****************/ /* Decode frame */ /****************/ @@ -43,6 +47,12 @@ opus_int silk_decode_frame( opus_int32 *pN, /* O Pointer to size of output frame */ opus_int lostFlag, /* I 0: no loss, 1 loss, 2 decode fec */ opus_int condCoding, /* I The type of conditional coding to use */ +#ifdef ENABLE_DEEP_PLC + LPCNetPLCState *lpcnet, +#endif +#ifdef ENABLE_OSCE + OSCEModel *osce_model, +#endif int arch /* I Run-time architecture */ ) { @@ -61,6 +71,10 @@ opus_int silk_decode_frame( ( lostFlag == FLAG_DECODE_LBRR && psDec->LBRR_flags[ psDec->nFramesDecoded ] == 1 ) ) { VARDECL( opus_int16, pulses ); +#ifdef ENABLE_OSCE + opus_int32 ec_start; + ec_start = ec_tell(psRangeDec); +#endif ALLOC( pulses, (L + SHELL_CODEC_FRAME_LENGTH - 1) & ~(SHELL_CODEC_FRAME_LENGTH - 1), opus_int16 ); /*********************************************/ @@ -84,10 +98,29 @@ opus_int silk_decode_frame( /********************************************************/ silk_decode_core( psDec, psDecCtrl, pOut, pulses, arch ); + /*************************/ + /* Update output buffer. */ + /*************************/ + celt_assert( psDec->ltp_mem_length >= psDec->frame_length ); + mv_len = psDec->ltp_mem_length - psDec->frame_length; + silk_memmove( psDec->outBuf, &psDec->outBuf[ psDec->frame_length ], mv_len * sizeof(opus_int16) ); + silk_memcpy( &psDec->outBuf[ mv_len ], pOut, psDec->frame_length * sizeof( opus_int16 ) ); + +#ifdef ENABLE_OSCE + /********************************************************/ + /* Run SILK enhancer */ + /********************************************************/ + osce_enhance_frame( osce_model, psDec, psDecCtrl, pOut, ec_tell(psRangeDec) - ec_start, arch ); +#endif + /********************************************************/ /* Update PLC state */ /********************************************************/ - silk_PLC( psDec, psDecCtrl, pOut, 0, arch ); + silk_PLC( psDec, psDecCtrl, pOut, 0, +#ifdef ENABLE_DEEP_PLC + lpcnet, +#endif + arch ); psDec->lossCnt = 0; psDec->prevSignalType = psDec->indices.signalType; @@ -97,16 +130,23 @@ opus_int silk_decode_frame( psDec->first_frame_after_reset = 0; } else { /* Handle packet loss by extrapolation */ - silk_PLC( psDec, psDecCtrl, pOut, 1, arch ); - } + silk_PLC( psDec, psDecCtrl, pOut, 1, +#ifdef ENABLE_DEEP_PLC + lpcnet, +#endif + arch ); - /*************************/ - /* Update output buffer. */ - /*************************/ - celt_assert( psDec->ltp_mem_length >= psDec->frame_length ); - mv_len = psDec->ltp_mem_length - psDec->frame_length; - silk_memmove( psDec->outBuf, &psDec->outBuf[ psDec->frame_length ], mv_len * sizeof(opus_int16) ); - silk_memcpy( &psDec->outBuf[ mv_len ], pOut, psDec->frame_length * sizeof( opus_int16 ) ); +#ifdef ENABLE_OSCE + osce_reset( &psDec->osce, psDec->osce.method ); +#endif + /*************************/ + /* Update output buffer. */ + /*************************/ + celt_assert( psDec->ltp_mem_length >= psDec->frame_length ); + mv_len = psDec->ltp_mem_length - psDec->frame_length; + silk_memmove( psDec->outBuf, &psDec->outBuf[ psDec->frame_length ], mv_len * sizeof(opus_int16) ); + silk_memcpy( &psDec->outBuf[ mv_len ], pOut, psDec->frame_length * sizeof( opus_int16 ) ); + } /************************************************/ /* Comfort noise generation / estimation */ diff --git a/media/libopus/silk/enc_API.c b/media/libopus/silk/enc_API.c index 548e07364d..369caddd98 100644 --- a/media/libopus/silk/enc_API.c +++ b/media/libopus/silk/enc_API.c @@ -41,6 +41,10 @@ POSSIBILITY OF SUCH DAMAGE. #include "main_FLP.h" #endif +#ifdef ENABLE_DRED +#include "dred_encoder.h" +#endif + /***************************************/ /* Read control structure from encoder */ /***************************************/ diff --git a/media/libopus/silk/fixed/encode_frame_FIX.c b/media/libopus/silk/fixed/encode_frame_FIX.c index a02bf87dbb..7c83360ba3 100644 --- a/media/libopus/silk/fixed/encode_frame_FIX.c +++ b/media/libopus/silk/fixed/encode_frame_FIX.c @@ -105,8 +105,11 @@ opus_int silk_encode_frame_FIX( opus_int gain_lock[ MAX_NB_SUBFR ] = {0}; opus_int16 best_gain_mult[ MAX_NB_SUBFR ]; opus_int best_sum[ MAX_NB_SUBFR ]; + opus_int bits_margin; SAVE_STACK; + /* For CBR, 5 bits below budget is close enough. For VBR, allow up to 25% below the cap if we initially busted the budget. */ + bits_margin = useCBR ? 5 : maxBits/4; /* This is totally unnecessary but many compilers (including gcc) are too dumb to realise it */ LastGainIndex_copy2 = nBits_lower = nBits_upper = gainMult_lower = gainMult_upper = 0; @@ -282,7 +285,7 @@ opus_int silk_encode_frame_FIX( gainMult_upper = gainMult_Q8; gainsID_upper = gainsID; } - } else if( nBits < maxBits - 5 ) { + } else if( nBits < maxBits - bits_margin ) { found_lower = 1; nBits_lower = nBits; gainMult_lower = gainMult_Q8; @@ -296,7 +299,7 @@ opus_int silk_encode_frame_FIX( LastGainIndex_copy2 = psEnc->sShape.LastGainIndex; } } else { - /* Within 5 bits of budget: close enough */ + /* Close enough */ break; } @@ -318,17 +321,10 @@ opus_int silk_encode_frame_FIX( if( ( found_lower & found_upper ) == 0 ) { /* Adjust gain according to high-rate rate/distortion curve */ if( nBits > maxBits ) { - if (gainMult_Q8 < 16384) { - gainMult_Q8 *= 2; - } else { - gainMult_Q8 = 32767; - } + gainMult_Q8 = silk_min_32( 1024, gainMult_Q8*3/2 ); } else { - opus_int32 gain_factor_Q16; - gain_factor_Q16 = silk_log2lin( silk_LSHIFT( nBits - maxBits, 7 ) / psEnc->sCmn.frame_length + SILK_FIX_CONST( 16, 7 ) ); - gainMult_Q8 = silk_SMULWB( gain_factor_Q16, gainMult_Q8 ); + gainMult_Q8 = silk_max_32( 64, gainMult_Q8*4/5 ); } - } else { /* Adjust gain by interpolating */ gainMult_Q8 = gainMult_lower + silk_DIV32_16( silk_MUL( gainMult_upper - gainMult_lower, maxBits - nBits_lower ), nBits_upper - nBits_lower ); diff --git a/media/libopus/silk/float/SigProc_FLP.h b/media/libopus/silk/float/SigProc_FLP.h index 953de8b09e..ff9281b852 100644 --- a/media/libopus/silk/float/SigProc_FLP.h +++ b/media/libopus/silk/float/SigProc_FLP.h @@ -30,6 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "SigProc_FIX.h" #include "float_cast.h" +#include "main.h" #include <math.h> #ifdef __cplusplus @@ -73,7 +74,8 @@ void silk_autocorrelation_FLP( silk_float *results, /* O result (length correlationCount) */ const silk_float *inputData, /* I input data to correlate */ opus_int inputDataSize, /* I length of input */ - opus_int correlationCount /* I number of correlation taps to compute */ + opus_int correlationCount, /* I number of correlation taps to compute */ + int arch ); opus_int silk_pitch_analysis_core_FLP( /* O Voicing estimate: 0 voiced, 1 unvoiced */ @@ -105,7 +107,8 @@ silk_float silk_burg_modified_FLP( /* O returns residual energy const silk_float minInvGain, /* I minimum inverse prediction gain */ const opus_int subfr_length, /* I input signal subframe length (incl. D preceding samples) */ const opus_int nb_subfr, /* I number of subframes stacked in x */ - const opus_int D /* I order */ + const opus_int D, /* I order */ + int arch ); /* multiply a vector by a constant */ @@ -124,12 +127,17 @@ void silk_scale_copy_vector_FLP( ); /* inner product of two silk_float arrays, with result as double */ -double silk_inner_product_FLP( +double silk_inner_product_FLP_c( const silk_float *data1, const silk_float *data2, opus_int dataSize ); +#ifndef OVERRIDE_inner_product_FLP +#define silk_inner_product_FLP(data1, data2, dataSize, arch) ((void)arch,silk_inner_product_FLP_c(data1, data2, dataSize)) +#endif + + /* sum of squares of a silk_float array, with result as double */ double silk_energy_FLP( const silk_float *data, diff --git a/media/libopus/silk/float/autocorrelation_FLP.c b/media/libopus/silk/float/autocorrelation_FLP.c index 8b8a9e659a..4253b26ebc 100644 --- a/media/libopus/silk/float/autocorrelation_FLP.c +++ b/media/libopus/silk/float/autocorrelation_FLP.c @@ -37,7 +37,8 @@ void silk_autocorrelation_FLP( silk_float *results, /* O result (length correlationCount) */ const silk_float *inputData, /* I input data to correlate */ opus_int inputDataSize, /* I length of input */ - opus_int correlationCount /* I number of correlation taps to compute */ + opus_int correlationCount, /* I number of correlation taps to compute */ + int arch ) { opus_int i; @@ -47,6 +48,6 @@ void silk_autocorrelation_FLP( } for( i = 0; i < correlationCount; i++ ) { - results[ i ] = (silk_float)silk_inner_product_FLP( inputData, inputData + i, inputDataSize - i ); + results[ i ] = (silk_float)silk_inner_product_FLP( inputData, inputData + i, inputDataSize - i, arch ); } } diff --git a/media/libopus/silk/float/burg_modified_FLP.c b/media/libopus/silk/float/burg_modified_FLP.c index 756b76a35b..f5bef5ddbe 100644 --- a/media/libopus/silk/float/burg_modified_FLP.c +++ b/media/libopus/silk/float/burg_modified_FLP.c @@ -42,7 +42,8 @@ silk_float silk_burg_modified_FLP( /* O returns residual energy const silk_float minInvGain, /* I minimum inverse prediction gain */ const opus_int subfr_length, /* I input signal subframe length (incl. D preceding samples) */ const opus_int nb_subfr, /* I number of subframes stacked in x */ - const opus_int D /* I order */ + const opus_int D, /* I order */ + int arch ) { opus_int k, n, s, reached_max_gain; @@ -60,7 +61,7 @@ silk_float silk_burg_modified_FLP( /* O returns residual energy for( s = 0; s < nb_subfr; s++ ) { x_ptr = x + s * subfr_length; for( n = 1; n < D + 1; n++ ) { - C_first_row[ n - 1 ] += silk_inner_product_FLP( x_ptr, x_ptr + n, subfr_length - n ); + C_first_row[ n - 1 ] += silk_inner_product_FLP( x_ptr, x_ptr + n, subfr_length - n, arch ); } } silk_memcpy( C_last_row, C_first_row, SILK_MAX_ORDER_LPC * sizeof( double ) ); diff --git a/media/libopus/silk/float/corrMatrix_FLP.c b/media/libopus/silk/float/corrMatrix_FLP.c index eae6a1cfca..eef6e8aa79 100644 --- a/media/libopus/silk/float/corrMatrix_FLP.c +++ b/media/libopus/silk/float/corrMatrix_FLP.c @@ -41,7 +41,8 @@ void silk_corrVector_FLP( const silk_float *t, /* I Target vector [L] */ const opus_int L, /* I Length of vecors */ const opus_int Order, /* I Max lag for correlation */ - silk_float *Xt /* O X'*t correlation vector [order] */ + silk_float *Xt, /* O X'*t correlation vector [order] */ + int arch ) { opus_int lag; @@ -50,7 +51,7 @@ void silk_corrVector_FLP( ptr1 = &x[ Order - 1 ]; /* Points to first sample of column 0 of X: X[:,0] */ for( lag = 0; lag < Order; lag++ ) { /* Calculate X[:,lag]'*t */ - Xt[ lag ] = (silk_float)silk_inner_product_FLP( ptr1, t, L ); + Xt[ lag ] = (silk_float)silk_inner_product_FLP( ptr1, t, L, arch ); ptr1--; /* Next column of X */ } } @@ -60,7 +61,8 @@ void silk_corrMatrix_FLP( const silk_float *x, /* I x vector [ L+order-1 ] used to create X */ const opus_int L, /* I Length of vectors */ const opus_int Order, /* I Max lag for correlation */ - silk_float *XX /* O X'*X correlation matrix [order x order] */ + silk_float *XX, /* O X'*X correlation matrix [order x order] */ + int arch ) { opus_int j, lag; @@ -79,7 +81,7 @@ void silk_corrMatrix_FLP( ptr2 = &x[ Order - 2 ]; /* First sample of column 1 of X */ for( lag = 1; lag < Order; lag++ ) { /* Calculate X[:,0]'*X[:,lag] */ - energy = silk_inner_product_FLP( ptr1, ptr2, L ); + energy = silk_inner_product_FLP( ptr1, ptr2, L, arch ); matrix_ptr( XX, lag, 0, Order ) = ( silk_float )energy; matrix_ptr( XX, 0, lag, Order ) = ( silk_float )energy; /* Calculate X[:,j]'*X[:,j + lag] */ diff --git a/media/libopus/silk/float/encode_frame_FLP.c b/media/libopus/silk/float/encode_frame_FLP.c index b029c3f5ca..8a327c5626 100644 --- a/media/libopus/silk/float/encode_frame_FLP.c +++ b/media/libopus/silk/float/encode_frame_FLP.c @@ -107,7 +107,10 @@ opus_int silk_encode_frame_FLP( opus_int gain_lock[ MAX_NB_SUBFR ] = {0}; opus_int16 best_gain_mult[ MAX_NB_SUBFR ]; opus_int best_sum[ MAX_NB_SUBFR ]; + opus_int bits_margin; + /* For CBR, 5 bits below budget is close enough. For VBR, allow up to 25% below the cap if we initially busted the budget. */ + bits_margin = useCBR ? 5 : maxBits/4; /* This is totally unnecessary but many compilers (including gcc) are too dumb to realise it */ LastGainIndex_copy2 = nBits_lower = nBits_upper = gainMult_lower = gainMult_upper = 0; @@ -270,7 +273,7 @@ opus_int silk_encode_frame_FLP( gainMult_upper = gainMult_Q8; gainsID_upper = gainsID; } - } else if( nBits < maxBits - 5 ) { + } else if( nBits < maxBits - bits_margin ) { found_lower = 1; nBits_lower = nBits; gainMult_lower = gainMult_Q8; @@ -284,7 +287,7 @@ opus_int silk_encode_frame_FLP( LastGainIndex_copy2 = psEnc->sShape.LastGainIndex; } } else { - /* Within 5 bits of budget: close enough */ + /* Close enough */ break; } @@ -306,15 +309,9 @@ opus_int silk_encode_frame_FLP( if( ( found_lower & found_upper ) == 0 ) { /* Adjust gain according to high-rate rate/distortion curve */ if( nBits > maxBits ) { - if (gainMult_Q8 < 16384) { - gainMult_Q8 *= 2; - } else { - gainMult_Q8 = 32767; - } + gainMult_Q8 = silk_min_32( 1024, gainMult_Q8*3/2 ); } else { - opus_int32 gain_factor_Q16; - gain_factor_Q16 = silk_log2lin( silk_LSHIFT( nBits - maxBits, 7 ) / psEnc->sCmn.frame_length + SILK_FIX_CONST( 16, 7 ) ); - gainMult_Q8 = silk_SMULWB( gain_factor_Q16, gainMult_Q8 ); + gainMult_Q8 = silk_max_32( 64, gainMult_Q8*4/5 ); } } else { /* Adjust gain by interpolating */ diff --git a/media/libopus/silk/float/find_LPC_FLP.c b/media/libopus/silk/float/find_LPC_FLP.c index fa3ffe7f8b..6ccd711dc3 100644 --- a/media/libopus/silk/float/find_LPC_FLP.c +++ b/media/libopus/silk/float/find_LPC_FLP.c @@ -38,7 +38,8 @@ void silk_find_LPC_FLP( silk_encoder_state *psEncC, /* I/O Encoder state */ opus_int16 NLSF_Q15[], /* O NLSFs */ const silk_float x[], /* I Input signal */ - const silk_float minInvGain /* I Inverse of max prediction gain */ + const silk_float minInvGain, /* I Inverse of max prediction gain */ + int arch ) { opus_int k, subfr_length; @@ -56,12 +57,12 @@ void silk_find_LPC_FLP( psEncC->indices.NLSFInterpCoef_Q2 = 4; /* Burg AR analysis for the full frame */ - res_nrg = silk_burg_modified_FLP( a, x, minInvGain, subfr_length, psEncC->nb_subfr, psEncC->predictLPCOrder ); + res_nrg = silk_burg_modified_FLP( a, x, minInvGain, subfr_length, psEncC->nb_subfr, psEncC->predictLPCOrder, arch ); if( psEncC->useInterpolatedNLSFs && !psEncC->first_frame_after_reset && psEncC->nb_subfr == MAX_NB_SUBFR ) { /* Optimal solution for last 10 ms; subtract residual energy here, as that's easier than */ /* adding it to the residual energy of the first 10 ms in each iteration of the search below */ - res_nrg -= silk_burg_modified_FLP( a_tmp, x + ( MAX_NB_SUBFR / 2 ) * subfr_length, minInvGain, subfr_length, MAX_NB_SUBFR / 2, psEncC->predictLPCOrder ); + res_nrg -= silk_burg_modified_FLP( a_tmp, x + ( MAX_NB_SUBFR / 2 ) * subfr_length, minInvGain, subfr_length, MAX_NB_SUBFR / 2, psEncC->predictLPCOrder, arch ); /* Convert to NLSFs */ silk_A2NLSF_FLP( NLSF_Q15, a_tmp, psEncC->predictLPCOrder ); diff --git a/media/libopus/silk/float/find_LTP_FLP.c b/media/libopus/silk/float/find_LTP_FLP.c index f97064930e..90aeeac0b7 100644 --- a/media/libopus/silk/float/find_LTP_FLP.c +++ b/media/libopus/silk/float/find_LTP_FLP.c @@ -38,7 +38,8 @@ void silk_find_LTP_FLP( const silk_float r_ptr[], /* I LPC residual */ const opus_int lag[ MAX_NB_SUBFR ], /* I LTP lags */ const opus_int subfr_length, /* I Subframe length */ - const opus_int nb_subfr /* I number of subframes */ + const opus_int nb_subfr, /* I number of subframes */ + int arch ) { opus_int k; @@ -50,8 +51,8 @@ void silk_find_LTP_FLP( XX_ptr = XX; for( k = 0; k < nb_subfr; k++ ) { lag_ptr = r_ptr - ( lag[ k ] + LTP_ORDER / 2 ); - silk_corrMatrix_FLP( lag_ptr, subfr_length, LTP_ORDER, XX_ptr ); - silk_corrVector_FLP( lag_ptr, r_ptr, subfr_length, LTP_ORDER, xX_ptr ); + silk_corrMatrix_FLP( lag_ptr, subfr_length, LTP_ORDER, XX_ptr, arch ); + silk_corrVector_FLP( lag_ptr, r_ptr, subfr_length, LTP_ORDER, xX_ptr, arch ); xx = ( silk_float )silk_energy_FLP( r_ptr, subfr_length + LTP_ORDER ); temp = 1.0f / silk_max( xx, LTP_CORR_INV_MAX * 0.5f * ( XX_ptr[ 0 ] + XX_ptr[ 24 ] ) + 1.0f ); silk_scale_vector_FLP( XX_ptr, temp, LTP_ORDER * LTP_ORDER ); diff --git a/media/libopus/silk/float/find_pitch_lags_FLP.c b/media/libopus/silk/float/find_pitch_lags_FLP.c index dedbcd2836..1f6bd5991c 100644 --- a/media/libopus/silk/float/find_pitch_lags_FLP.c +++ b/media/libopus/silk/float/find_pitch_lags_FLP.c @@ -82,7 +82,7 @@ void silk_find_pitch_lags_FLP( silk_apply_sine_window_FLP( Wsig_ptr, x_buf_ptr, 2, psEnc->sCmn.la_pitch ); /* Calculate autocorrelation sequence */ - silk_autocorrelation_FLP( auto_corr, Wsig, psEnc->sCmn.pitch_LPC_win_length, psEnc->sCmn.pitchEstimationLPCOrder + 1 ); + silk_autocorrelation_FLP( auto_corr, Wsig, psEnc->sCmn.pitch_LPC_win_length, psEnc->sCmn.pitchEstimationLPCOrder + 1, arch ); /* Add white noise, as a fraction of the energy */ auto_corr[ 0 ] += auto_corr[ 0 ] * FIND_PITCH_WHITE_NOISE_FRACTION + 1; diff --git a/media/libopus/silk/float/find_pred_coefs_FLP.c b/media/libopus/silk/float/find_pred_coefs_FLP.c index 6f79078893..f3c54cf474 100644 --- a/media/libopus/silk/float/find_pred_coefs_FLP.c +++ b/media/libopus/silk/float/find_pred_coefs_FLP.c @@ -63,7 +63,7 @@ void silk_find_pred_coefs_FLP( celt_assert( psEnc->sCmn.ltp_mem_length - psEnc->sCmn.predictLPCOrder >= psEncCtrl->pitchL[ 0 ] + LTP_ORDER / 2 ); /* LTP analysis */ - silk_find_LTP_FLP( XXLTP, xXLTP, res_pitch, psEncCtrl->pitchL, psEnc->sCmn.subfr_length, psEnc->sCmn.nb_subfr ); + silk_find_LTP_FLP( XXLTP, xXLTP, res_pitch, psEncCtrl->pitchL, psEnc->sCmn.subfr_length, psEnc->sCmn.nb_subfr, psEnc->sCmn.arch ); /* Quantize LTP gain parameters */ silk_quant_LTP_gains_FLP( psEncCtrl->LTPCoef, psEnc->sCmn.indices.LTPIndex, &psEnc->sCmn.indices.PERIndex, @@ -102,7 +102,7 @@ void silk_find_pred_coefs_FLP( } /* LPC_in_pre contains the LTP-filtered input for voiced, and the unfiltered input for unvoiced */ - silk_find_LPC_FLP( &psEnc->sCmn, NLSF_Q15, LPC_in_pre, minInvGain ); + silk_find_LPC_FLP( &psEnc->sCmn, NLSF_Q15, LPC_in_pre, minInvGain, psEnc->sCmn.arch ); /* Quantize LSFs */ silk_process_NLSFs_FLP( &psEnc->sCmn, psEncCtrl->PredCoef, NLSF_Q15, psEnc->sCmn.prev_NLSFq_Q15 ); diff --git a/media/libopus/silk/float/inner_product_FLP.c b/media/libopus/silk/float/inner_product_FLP.c index cdd39d24ce..88b160ab40 100644 --- a/media/libopus/silk/float/inner_product_FLP.c +++ b/media/libopus/silk/float/inner_product_FLP.c @@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "SigProc_FLP.h" /* inner product of two silk_float arrays, with result as double */ -double silk_inner_product_FLP( +double silk_inner_product_FLP_c( const silk_float *data1, const silk_float *data2, opus_int dataSize diff --git a/media/libopus/silk/float/main_FLP.h b/media/libopus/silk/float/main_FLP.h index 5dc0ccf4a4..2e4435cc68 100644 --- a/media/libopus/silk/float/main_FLP.h +++ b/media/libopus/silk/float/main_FLP.h @@ -138,7 +138,8 @@ void silk_find_LPC_FLP( silk_encoder_state *psEncC, /* I/O Encoder state */ opus_int16 NLSF_Q15[], /* O NLSFs */ const silk_float x[], /* I Input signal */ - const silk_float minInvGain /* I Prediction gain from LTP (dB) */ + const silk_float minInvGain, /* I Prediction gain from LTP (dB) */ + int arch ); /* LTP analysis */ @@ -148,7 +149,8 @@ void silk_find_LTP_FLP( const silk_float r_ptr[], /* I LPC residual */ const opus_int lag[ MAX_NB_SUBFR ], /* I LTP lags */ const opus_int subfr_length, /* I Subframe length */ - const opus_int nb_subfr /* I number of subframes */ + const opus_int nb_subfr, /* I number of subframes */ + int arch ); void silk_LTP_analysis_filter_FLP( @@ -221,7 +223,8 @@ void silk_corrMatrix_FLP( const silk_float *x, /* I x vector [ L+order-1 ] used to create X */ const opus_int L, /* I Length of vectors */ const opus_int Order, /* I Max lag for correlation */ - silk_float *XX /* O X'*X correlation matrix [order x order] */ + silk_float *XX, /* O X'*X correlation matrix [order x order] */ + int arch ); /* Calculates correlation vector X'*t */ @@ -230,7 +233,8 @@ void silk_corrVector_FLP( const silk_float *t, /* I Target vector [L] */ const opus_int L, /* I Length of vecors */ const opus_int Order, /* I Max lag for correlation */ - silk_float *Xt /* O X'*t correlation vector [order] */ + silk_float *Xt, /* O X'*t correlation vector [order] */ + int arch ); /* Apply sine window to signal vector. */ diff --git a/media/libopus/silk/float/noise_shape_analysis_FLP.c b/media/libopus/silk/float/noise_shape_analysis_FLP.c index cb3d8a50b7..0b5ea95218 100644 --- a/media/libopus/silk/float/noise_shape_analysis_FLP.c +++ b/media/libopus/silk/float/noise_shape_analysis_FLP.c @@ -255,7 +255,7 @@ void silk_noise_shape_analysis_FLP( psEnc->sCmn.shapeWinLength, psEnc->sCmn.shapingLPCOrder ); } else { /* Calculate regular auto correlation */ - silk_autocorrelation_FLP( auto_corr, x_windowed, psEnc->sCmn.shapeWinLength, psEnc->sCmn.shapingLPCOrder + 1 ); + silk_autocorrelation_FLP( auto_corr, x_windowed, psEnc->sCmn.shapeWinLength, psEnc->sCmn.shapingLPCOrder + 1, psEnc->sCmn.arch ); } /* Add white noise, as a fraction of energy */ diff --git a/media/libopus/silk/float/pitch_analysis_core_FLP.c b/media/libopus/silk/float/pitch_analysis_core_FLP.c index f351bc3718..0530a8831a 100644 --- a/media/libopus/silk/float/pitch_analysis_core_FLP.c +++ b/media/libopus/silk/float/pitch_analysis_core_FLP.c @@ -291,7 +291,7 @@ opus_int silk_pitch_analysis_core_FLP( /* O Voicing estimate: 0 voiced, for( j = 0; j < length_d_comp; j++ ) { d = d_comp[ j ]; basis_ptr = target_ptr - d; - cross_corr = silk_inner_product_FLP( basis_ptr, target_ptr, sf_length_8kHz ); + cross_corr = silk_inner_product_FLP( basis_ptr, target_ptr, sf_length_8kHz, arch ); if( cross_corr > 0.0f ) { energy = silk_energy_FLP( basis_ptr, sf_length_8kHz ); C[ k ][ d ] = (silk_float)( 2 * cross_corr / ( energy + energy_tmp ) ); diff --git a/media/libopus/silk/float/warped_autocorrelation_FLP.c b/media/libopus/silk/float/warped_autocorrelation_FLP.c index 09186e73d4..116dab923f 100644 --- a/media/libopus/silk/float/warped_autocorrelation_FLP.c +++ b/media/libopus/silk/float/warped_autocorrelation_FLP.c @@ -54,11 +54,13 @@ void silk_warped_autocorrelation_FLP( /* Loop over allpass sections */ for( i = 0; i < order; i += 2 ) { /* Output of allpass section */ - tmp2 = state[ i ] + warping * ( state[ i + 1 ] - tmp1 ); + /* We voluntarily use two multiples instead of factoring the expression to + reduce the length of the dependency chain (tmp1->tmp2->tmp1... ). */ + tmp2 = state[ i ] + warping * state[ i + 1 ] - warping * tmp1; state[ i ] = tmp1; C[ i ] += state[ 0 ] * tmp1; /* Output of allpass section */ - tmp1 = state[ i + 1 ] + warping * ( state[ i + 2 ] - tmp2 ); + tmp1 = state[ i + 1 ] + warping * state[ i + 2 ] - warping * tmp2; state[ i + 1 ] = tmp2; C[ i + 1 ] += state[ 0 ] * tmp2; } diff --git a/media/libopus/silk/float/x86/inner_product_FLP_avx2.c b/media/libopus/silk/float/x86/inner_product_FLP_avx2.c new file mode 100644 index 0000000000..4a2daaf595 --- /dev/null +++ b/media/libopus/silk/float/x86/inner_product_FLP_avx2.c @@ -0,0 +1,85 @@ +/*********************************************************************** +Copyright (c) 2006-2011, Skype Limited. All rights reserved. + 2023 Amazon +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +- Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. +- Neither the name of Internet Society, IETF or IETF Trust, nor the +names of specific contributors, may be used to endorse or promote +products derived from this software without specific prior written +permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +***********************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "SigProc_FLP.h" +#include <immintrin.h> + + +/* inner product of two silk_float arrays, with result as double */ +double silk_inner_product_FLP_avx2( + const silk_float *data1, + const silk_float *data2, + opus_int dataSize +) +{ + opus_int i; + __m256d accum1, accum2; + double result; + + /* 4x unrolled loop */ + result = 0.0; + accum1 = accum2 = _mm256_setzero_pd(); + for( i = 0; i < dataSize - 7; i += 8 ) { + __m128 x1f, x2f; + __m256d x1d, x2d; + x1f = _mm_loadu_ps( &data1[ i ] ); + x2f = _mm_loadu_ps( &data2[ i ] ); + x1d = _mm256_cvtps_pd( x1f ); + x2d = _mm256_cvtps_pd( x2f ); + accum1 = _mm256_fmadd_pd( x1d, x2d, accum1 ); + x1f = _mm_loadu_ps( &data1[ i + 4 ] ); + x2f = _mm_loadu_ps( &data2[ i + 4 ] ); + x1d = _mm256_cvtps_pd( x1f ); + x2d = _mm256_cvtps_pd( x2f ); + accum2 = _mm256_fmadd_pd( x1d, x2d, accum2 ); + } + for( ; i < dataSize - 3; i += 4 ) { + __m128 x1f, x2f; + __m256d x1d, x2d; + x1f = _mm_loadu_ps( &data1[ i ] ); + x2f = _mm_loadu_ps( &data2[ i ] ); + x1d = _mm256_cvtps_pd( x1f ); + x2d = _mm256_cvtps_pd( x2f ); + accum1 = _mm256_fmadd_pd( x1d, x2d, accum1 ); + } + accum1 = _mm256_add_pd(accum1, accum2); + accum1 = _mm256_add_pd(accum1, _mm256_permute2f128_pd(accum1, accum1, 1)); + accum1 = _mm256_hadd_pd(accum1,accum1); + result = _mm256_cvtsd_f64(accum1); + + /* add any remaining products */ + for( ; i < dataSize; i++ ) { + result += data1[ i ] * (double)data2[ i ]; + } + + return result; +} diff --git a/media/libopus/silk/init_decoder.c b/media/libopus/silk/init_decoder.c index 16c03dcd1c..01bc4b7a12 100644 --- a/media/libopus/silk/init_decoder.c +++ b/media/libopus/silk/init_decoder.c @@ -31,15 +31,21 @@ POSSIBILITY OF SUCH DAMAGE. #include "main.h" +#ifdef ENABLE_OSCE +#include "osce.h" +#endif + +#include "structs.h" + /************************/ -/* Init Decoder State */ +/* Reset Decoder State */ /************************/ -opus_int silk_init_decoder( +opus_int silk_reset_decoder( silk_decoder_state *psDec /* I/O Decoder state pointer */ ) { /* Clear the entire encoder state, except anything copied */ - silk_memset( psDec, 0, sizeof( silk_decoder_state ) ); + silk_memset( &psDec->SILK_DECODER_STATE_RESET_START, 0, sizeof( silk_decoder_state ) - ((char*) &psDec->SILK_DECODER_STATE_RESET_START - (char*)psDec) ); /* Used to deactivate LSF interpolation */ psDec->first_frame_after_reset = 1; @@ -52,6 +58,27 @@ opus_int silk_init_decoder( /* Reset PLC state */ silk_PLC_Reset( psDec ); +#ifdef ENABLE_OSCE + /* Reset OSCE state and method */ + osce_reset(&psDec->osce, OSCE_DEFAULT_METHOD); +#endif + + return 0; +} + + +/************************/ +/* Init Decoder State */ +/************************/ +opus_int silk_init_decoder( + silk_decoder_state *psDec /* I/O Decoder state pointer */ +) +{ + /* Clear the entire encoder state, except anything copied */ + silk_memset( psDec, 0, sizeof( silk_decoder_state ) ); + + silk_reset_decoder( psDec ); + return(0); } diff --git a/media/libopus/silk/init_encoder.c b/media/libopus/silk/init_encoder.c index 65995c33fa..10d41287fe 100644 --- a/media/libopus/silk/init_encoder.c +++ b/media/libopus/silk/init_encoder.c @@ -36,6 +36,10 @@ POSSIBILITY OF SUCH DAMAGE. #include "tuning_parameters.h" #include "cpu_support.h" +#ifdef ENABLE_DRED +#include "dred_encoder.h" +#endif + /*********************************/ /* Initialize Silk Encoder state */ /*********************************/ diff --git a/media/libopus/silk/main.h b/media/libopus/silk/main.h index a5f568758f..cd576d8cc1 100644 --- a/media/libopus/silk/main.h +++ b/media/libopus/silk/main.h @@ -252,7 +252,7 @@ void silk_NSQ_c( SideInfoIndices *psIndices, /* I/O Quantization Indices */ const opus_int16 x16[], /* I Input */ opus_int8 pulses[], /* O Quantized pulse signal */ - const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefs */ + const opus_int16 *PredCoef_Q12, /* I Short term prediction coefs */ const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefs */ const opus_int16 AR_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs */ const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I Long term shaping coefs */ @@ -278,7 +278,7 @@ void silk_NSQ_del_dec_c( SideInfoIndices *psIndices, /* I/O Quantization Indices */ const opus_int16 x16[], /* I Input */ opus_int8 pulses[], /* O Quantized pulse signal */ - const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefs */ + const opus_int16 *PredCoef_Q12, /* I Short term prediction coefs */ const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefs */ const opus_int16 AR_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs */ const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I Long term shaping coefs */ @@ -389,6 +389,10 @@ void silk_NLSF_decode( /****************************************************/ /* Decoder Functions */ /****************************************************/ +opus_int silk_reset_decoder( + silk_decoder_state *psDec /* I/O Decoder state pointer */ +); + opus_int silk_init_decoder( silk_decoder_state *psDec /* I/O Decoder state pointer */ ); @@ -410,6 +414,12 @@ opus_int silk_decode_frame( opus_int32 *pN, /* O Pointer to size of output frame */ opus_int lostFlag, /* I 0: no loss, 1 loss, 2 decode fec */ opus_int condCoding, /* I The type of conditional coding to use */ +#ifdef ENABLE_DEEP_PLC + LPCNetPLCState *lpcnet, +#endif +#ifdef ENABLE_OSCE + OSCEModel *osce_model, +#endif int arch /* I Run-time architecture */ ); diff --git a/media/libopus/silk/mips/NSQ_del_dec_mipsr1.h b/media/libopus/silk/mips/NSQ_del_dec_mipsr1.h index cd70713a8f..85bfb637ef 100644 --- a/media/libopus/silk/mips/NSQ_del_dec_mipsr1.h +++ b/media/libopus/silk/mips/NSQ_del_dec_mipsr1.h @@ -25,8 +25,8 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***********************************************************************/ -#ifndef __NSQ_DEL_DEC_MIPSR1_H__ -#define __NSQ_DEL_DEC_MIPSR1_H__ +#ifndef NSQ_DEL_DEC_MIPSR1_H__ +#define NSQ_DEL_DEC_MIPSR1_H__ #ifdef HAVE_CONFIG_H #include "config.h" @@ -407,4 +407,4 @@ static inline void silk_noise_shape_quantizer_del_dec( } } -#endif /* __NSQ_DEL_DEC_MIPSR1_H__ */ +#endif /* NSQ_DEL_DEC_MIPSR1_H__ */ diff --git a/media/libopus/silk/mips/macros_mipsr1.h b/media/libopus/silk/mips/macros_mipsr1.h index 12ed981a6e..af408802c3 100644 --- a/media/libopus/silk/mips/macros_mipsr1.h +++ b/media/libopus/silk/mips/macros_mipsr1.h @@ -26,8 +26,8 @@ POSSIBILITY OF SUCH DAMAGE. ***********************************************************************/ -#ifndef __SILK_MACROS_MIPSR1_H__ -#define __SILK_MACROS_MIPSR1_H__ +#ifndef SILK_MACROS_MIPSR1_H__ +#define SILK_MACROS_MIPSR1_H__ #define mips_clz(x) __builtin_clz(x) @@ -89,4 +89,4 @@ static inline opus_int32 silk_CLZ32(opus_int32 in32) return re32; } -#endif /* __SILK_MACROS_MIPSR1_H__ */ +#endif /* SILK_MACROS_MIPSR1_H__ */ diff --git a/media/libopus/silk/structs.h b/media/libopus/silk/structs.h index 3380c757b2..38243be1ea 100644 --- a/media/libopus/silk/structs.h +++ b/media/libopus/silk/structs.h @@ -34,6 +34,21 @@ POSSIBILITY OF SUCH DAMAGE. #include "entenc.h" #include "entdec.h" +#ifdef ENABLE_DEEP_PLC +#include "lpcnet.h" +#include "lpcnet_private.h" +#endif + +#ifdef ENABLE_DRED +#include "dred_encoder.h" +#include "dred_decoder.h" +#endif + +#ifdef ENABLE_OSCE +#include "osce_config.h" +#include "osce_structs.h" +#endif + #ifdef __cplusplus extern "C" { @@ -228,6 +243,14 @@ typedef struct { } silk_encoder_state; +#ifdef ENABLE_OSCE +typedef struct { + OSCEFeatureState features; + OSCEState state; + int method; +} silk_OSCE_struct; +#endif + /* Struct for Packet Loss Concealment */ typedef struct { opus_int32 pitchL_Q8; /* Pitch lag to use for voiced concealment */ @@ -243,6 +266,7 @@ typedef struct { opus_int fs_kHz; opus_int nb_subfr; opus_int subfr_length; + opus_int enable_deep_plc; } silk_PLC_struct; /* Struct for CNG */ @@ -259,6 +283,10 @@ typedef struct { /* Decoder state */ /********************************/ typedef struct { +#ifdef ENABLE_OSCE + silk_OSCE_struct osce; +#endif +#define SILK_DECODER_STATE_RESET_START prev_gain_Q16 opus_int32 prev_gain_Q16; opus_int32 exc_Q14[ MAX_FRAME_LENGTH ]; opus_int32 sLPC_Q14_buf[ MAX_LPC_ORDER ]; diff --git a/media/libopus/silk/x86/NSQ_del_dec_avx2.c b/media/libopus/silk/x86/NSQ_del_dec_avx2.c new file mode 100644 index 0000000000..43485871a4 --- /dev/null +++ b/media/libopus/silk/x86/NSQ_del_dec_avx2.c @@ -0,0 +1,1075 @@ +/*********************************************************************** +Copyright (c) 2021 Google Inc. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +- Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. +- Neither the name of Internet Society, IETF or IETF Trust, nor the +names of specific contributors, may be used to endorse or promote +products derived from this software without specific prior written +permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +***********************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef OPUS_CHECK_ASM +#include <string.h> +#endif + +#include "opus_defines.h" +#include <immintrin.h> + +#include "main.h" +#include "stack_alloc.h" +#include "NSQ.h" +#include "celt/x86/x86cpu.h" + +/* Returns TRUE if all assumptions met */ +static OPUS_INLINE int verify_assumptions(const silk_encoder_state *psEncC) +{ + /* This optimization is based on these assumptions */ + /* These assumptions are fundamental and hence assert are */ + /* used. Should any assert triggers, we have to re-visit */ + /* all related code to make sure it still functions the */ + /* same as the C implementation. */ + silk_assert(MAX_DEL_DEC_STATES <= 4 && + MAX_FRAME_LENGTH % 4 == 0 && + MAX_SUB_FRAME_LENGTH % 4 == 0 && + LTP_MEM_LENGTH_MS % 4 == 0 ); + silk_assert(psEncC->fs_kHz == 8 || + psEncC->fs_kHz == 12 || + psEncC->fs_kHz == 16 ); + silk_assert(psEncC->nb_subfr <= MAX_NB_SUBFR && + psEncC->nb_subfr > 0 ); + silk_assert(psEncC->nStatesDelayedDecision <= MAX_DEL_DEC_STATES && + psEncC->nStatesDelayedDecision > 0 ); + silk_assert(psEncC->ltp_mem_length == psEncC->fs_kHz * LTP_MEM_LENGTH_MS); + + /* Regressions were observed on certain AMD Zen CPUs when */ + /* nStatesDelayedDecision is 1 or 2. Ideally we should detect */ + /* these CPUs and enable this optimization on others; however, */ + /* there is no good way to do so under current OPUS framework. */ + return psEncC->nStatesDelayedDecision == 3 || + psEncC->nStatesDelayedDecision == 4; +} + +/* Intrinsics not defined on MSVC */ +#ifdef _MSC_VER +#include <Intsafe.h> +#define __m128i_u __m128i +static inline int __builtin_sadd_overflow(opus_int32 a, opus_int32 b, opus_int32* res) +{ + *res = a+b; + return (*res ^ a) & (*res ^ b) & 0x80000000; +} +static inline int __builtin_ctz(unsigned int x) +{ + DWORD res = 0; + return _BitScanForward(&res, x) ? res : 32; +} +#endif + +static OPUS_INLINE __m128i silk_cvtepi64_epi32_high(__m256i num) +{ + return _mm256_castsi256_si128(_mm256_permutevar8x32_epi32(num, _mm256_set_epi32(0, 0, 0, 0, 7, 5, 3, 1))); +} + +static OPUS_INLINE opus_int16 silk_sat16(opus_int32 num) +{ + num = num > silk_int16_MAX ? silk_int16_MAX : num; + num = num < silk_int16_MIN ? silk_int16_MIN : num; + return num; +} + +static OPUS_INLINE opus_int32 silk_sar_round_32(opus_int32 a, int bits) +{ + silk_assert(bits > 0 && bits < 31); + a += 1 << (bits-1); + return a >> bits; +} + +static OPUS_INLINE opus_int64 silk_sar_round_smulww(opus_int32 a, opus_int32 b, int bits) +{ + silk_assert(bits > 0 && bits < 63); +#ifdef OPUS_CHECK_ASM + return silk_RSHIFT_ROUND(silk_SMULWW(a, b), bits); +#else + /* This code is more correct, but it won't overflow like the C code in some rare cases. */ + silk_assert(bits > 0 && bits < 63); + opus_int64 t = ((opus_int64)a) * ((opus_int64)b); + bits += 16; + t += 1ull << (bits-1); + return t >> bits; +#endif +} + +static OPUS_INLINE opus_int32 silk_add_sat32(opus_int32 a, opus_int32 b) +{ + opus_int32 sum; + if (__builtin_sadd_overflow(a, b, &sum)) + { + return a >= 0 ? silk_int32_MAX : silk_int32_MIN; + } + return sum; +} + +static OPUS_INLINE __m128i silk_mm_srai_round_epi32(__m128i a, int bits) +{ + silk_assert(bits > 0 && bits < 31); + return _mm_srai_epi32(_mm_add_epi32(a, _mm_set1_epi32(1 << (bits - 1))), bits); +} + +/* add/subtract with output saturated */ +static OPUS_INLINE __m128i silk_mm_add_sat_epi32(__m128i a, __m128i b) +{ + __m128i r = _mm_add_epi32(a, b); + __m128i OF = _mm_and_si128(_mm_xor_si128(a, r), _mm_xor_si128(b, r)); /* OF = (sum ^ a) & (sum ^ b) */ + __m128i SAT = _mm_add_epi32(_mm_srli_epi32(a, 31), _mm_set1_epi32(0x7FFFFFFF)); /* SAT = (a >> 31) + 0x7FFFFFFF */ + return _mm_blendv_epi8(r, SAT, _mm_srai_epi32(OF, 31)); +} +static OPUS_INLINE __m128i silk_mm_sub_sat_epi32(__m128i a, __m128i b) +{ + __m128i r = _mm_sub_epi32(a, b); + __m128i OF = _mm_andnot_si128(_mm_xor_si128(b, r), _mm_xor_si128(a, r)); /* OF = (sum ^ a) & (sum ^ ~b) = (sum ^ a) & ~(sum ^ b) */ + __m128i SAT = _mm_add_epi32(_mm_srli_epi32(a, 31), _mm_set1_epi32(0x7FFFFFFF)); /* SAT = (a >> 31) + 0x7FFFFFFF */ + return _mm_blendv_epi8(r, SAT, _mm_srai_epi32(OF, 31)); +} +static OPUS_INLINE __m256i silk_mm256_sub_sat_epi32(__m256i a, __m256i b) +{ + __m256i r = _mm256_sub_epi32(a, b); + __m256i OF = _mm256_andnot_si256(_mm256_xor_si256(b, r), _mm256_xor_si256(a, r)); /* OF = (sum ^ a) & (sum ^ ~b) = (sum ^ a) & ~(sum ^ b) */ + __m256i SAT = _mm256_add_epi32(_mm256_srli_epi32(a, 31), _mm256_set1_epi32(0x7FFFFFFF)); /* SAT = (a >> 31) + 0x7FFFFFFF */ + return _mm256_blendv_epi8(r, SAT, _mm256_srai_epi32(OF, 31)); +} + +static OPUS_INLINE __m128i silk_mm_limit_epi32(__m128i num, opus_int32 limit1, opus_int32 limit2) +{ + opus_int32 lo = limit1 < limit2 ? limit1 : limit2; + opus_int32 hi = limit1 > limit2 ? limit1 : limit2; + + num = _mm_min_epi32(num, _mm_set1_epi32(hi)); + num = _mm_max_epi32(num, _mm_set1_epi32(lo)); + return num; +} + +/* cond < 0 ? -num : num */ +static OPUS_INLINE __m128i silk_mm_sign_epi32(__m128i num, __m128i cond) +{ + return _mm_sign_epi32(num, _mm_or_si128(cond, _mm_set1_epi32(1))); +} +static OPUS_INLINE __m256i silk_mm256_sign_epi32(__m256i num, __m256i cond) +{ + return _mm256_sign_epi32(num, _mm256_or_si256(cond, _mm256_set1_epi32(1))); +} + +/* (a32 * b32) >> 16 */ +static OPUS_INLINE __m128i silk_mm_smulww_epi32(__m128i a, opus_int32 b) +{ + return silk_cvtepi64_epi32_high(_mm256_slli_epi64(_mm256_mul_epi32(_mm256_cvtepi32_epi64(a), _mm256_set1_epi32(b)), 16)); +} + +/* (a32 * (opus_int32)((opus_int16)(b32))) >> 16 output have to be 32bit int */ +static OPUS_INLINE __m128i silk_mm_smulwb_epi32(__m128i a, opus_int32 b) +{ + return silk_cvtepi64_epi32_high(_mm256_mul_epi32(_mm256_cvtepi32_epi64(a), _mm256_set1_epi32(silk_LSHIFT(b, 16)))); +} + +/* (opus_int32)((opus_int16)(a3))) * (opus_int32)((opus_int16)(b32)) output have to be 32bit int */ +static OPUS_INLINE __m256i silk_mm256_smulbb_epi32(__m256i a, __m256i b) +{ + const char FF = (char)0xFF; + __m256i msk = _mm256_set_epi8( + FF, FF, FF, FF, FF, FF, FF, FF, 13, 12, 9, 8, 5, 4, 1, 0, + FF, FF, FF, FF, FF, FF, FF, FF, 13, 12, 9, 8, 5, 4, 1, 0); + __m256i lo = _mm256_mullo_epi16(a, b); + __m256i hi = _mm256_mulhi_epi16(a, b); + lo = _mm256_shuffle_epi8(lo, msk); + hi = _mm256_shuffle_epi8(hi, msk); + return _mm256_unpacklo_epi16(lo, hi); +} + +static OPUS_INLINE __m256i silk_mm256_reverse_epi32(__m256i v) +{ + v = _mm256_shuffle_epi32(v, 0x1B); + v = _mm256_permute4x64_epi64(v, 0x4E); + return v; +} + +static OPUS_INLINE opus_int32 silk_mm256_hsum_epi32(__m256i v) +{ + __m128i sum = _mm_add_epi32(_mm256_extracti128_si256(v, 1), _mm256_extracti128_si256(v, 0)); + sum = _mm_add_epi32(sum, _mm_shuffle_epi32(sum, 0x4E)); + sum = _mm_add_epi32(sum, _mm_shuffle_epi32(sum, 0xB1)); + return _mm_cvtsi128_si32(sum); +} + +static OPUS_INLINE __m128i silk_mm_hmin_epi32(__m128i num) +{ + num = _mm_min_epi32(num, _mm_shuffle_epi32(num, 0x4E)); /* 0123 -> 2301 */ + num = _mm_min_epi32(num, _mm_shuffle_epi32(num, 0xB1)); /* 0123 -> 1032 */ + return num; +} + +static OPUS_INLINE __m128i silk_mm_hmax_epi32(__m128i num) +{ + num = _mm_max_epi32(num, _mm_shuffle_epi32(num, 0x4E)); /* 0123 -> 2310 */ + num = _mm_max_epi32(num, _mm_shuffle_epi32(num, 0xB1)); /* 0123 -> 1032 */ + return num; +} + +static OPUS_INLINE __m128i silk_mm_mask_hmin_epi32(__m128i num, __m128i mask) +{ + num = _mm_blendv_epi8(num, _mm_set1_epi32(silk_int32_MAX), mask); + return silk_mm_hmin_epi32(num); +} + +static OPUS_INLINE __m128i silk_mm_mask_hmax_epi32(__m128i num, __m128i mask) +{ + num = _mm_blendv_epi8(num, _mm_set1_epi32(silk_int32_MIN), mask); + return silk_mm_hmax_epi32(num); +} + +static OPUS_INLINE __m128i silk_mm256_rand_epi32(__m128i seed) +{ + seed = _mm_mullo_epi32(seed, _mm_set1_epi32(RAND_MULTIPLIER)); + seed = _mm_add_epi32(seed, _mm_set1_epi32(RAND_INCREMENT)); + return seed; +} + +static OPUS_INLINE opus_int32 silk_index_of_first_equal_epi32(__m128i a, __m128i b) +{ + unsigned int mask = _mm_movemask_epi8(_mm_cmpeq_epi32(a, b)) & 0x1111; + silk_assert(mask != 0); + return __builtin_ctz(mask) >> 2; +} + +static __m128i silk_index_to_selector(opus_int32 index) +{ + silk_assert(index < 4); + index <<= 2; + return _mm_set_epi8( + index + 3, index + 2, index + 1, index + 0, + index + 3, index + 2, index + 1, index + 0, + index + 3, index + 2, index + 1, index + 0, + index + 3, index + 2, index + 1, index + 0); +} + +static opus_int32 silk_select_winner(__m128i num, __m128i selector) +{ + return _mm_cvtsi128_si32(_mm_shuffle_epi8(num, selector)); +} + +typedef struct +{ + __m128i RandState; + __m128i Q_Q10; + __m128i Xq_Q14; + __m128i Pred_Q15; + __m128i Shape_Q14; +} NSQ_del_dec_sample_struct; + +typedef struct +{ + __m128i sLPC_Q14[MAX_SUB_FRAME_LENGTH + NSQ_LPC_BUF_LENGTH]; + __m128i LF_AR_Q14; + __m128i Seed; + __m128i SeedInit; + __m128i RD_Q10; + __m128i Diff_Q14; + __m128i sAR2_Q14[MAX_SHAPE_LPC_ORDER]; + NSQ_del_dec_sample_struct Samples[DECISION_DELAY]; +} NSQ_del_dec_struct; + +static OPUS_INLINE void silk_nsq_del_dec_scale_states_avx2( + const silk_encoder_state *psEncC, /* I Encoder State */ + silk_nsq_state *NSQ, /* I/O NSQ state */ + NSQ_del_dec_struct *psDelDec, /* I/O Delayed decision states */ + const opus_int16 x16[], /* I Input */ + opus_int32 x_sc_Q10[MAX_SUB_FRAME_LENGTH], /* O Input scaled with 1/Gain in Q10 */ + const opus_int16 sLTP[], /* I Re-whitened LTP state in Q0 */ + opus_int32 sLTP_Q15[], /* O LTP state matching scaled input */ + opus_int subfr, /* I Subframe number */ + const opus_int LTP_scale_Q14, /* I LTP state scaling */ + const opus_int32 Gains_Q16[MAX_NB_SUBFR], /* I */ + const opus_int pitchL[MAX_NB_SUBFR], /* I Pitch lag */ + const opus_int signal_type, /* I Signal type */ + const opus_int decisionDelay /* I Decision delay */ +); + +/*******************************************/ +/* LPC analysis filter */ +/* NB! State is kept internally and the */ +/* filter always starts with zero state */ +/* first d output samples are set to zero */ +/*******************************************/ +static OPUS_INLINE void silk_LPC_analysis_filter_avx2( + opus_int16 *out, /* O Output signal */ + const opus_int16 *in, /* I Input signal */ + const opus_int16 *B, /* I MA prediction coefficients, Q12 [order] */ + const opus_int32 len, /* I Signal length */ + const opus_int32 order /* I Filter order */ +); + +/******************************************/ +/* Noise shape quantizer for one subframe */ +/******************************************/ +static OPUS_INLINE void silk_noise_shape_quantizer_del_dec_avx2( + silk_nsq_state *NSQ, /* I/O NSQ state */ + NSQ_del_dec_struct psDelDec[], /* I/O Delayed decision states */ + opus_int signalType, /* I Signal type */ + const opus_int32 x_Q10[], /* I */ + opus_int8 pulses[], /* O */ + opus_int16 xq[], /* O */ + opus_int32 sLTP_Q15[], /* I/O LTP filter state */ + opus_int32 delayedGain_Q10[DECISION_DELAY], /* I/O Gain delay buffer */ + const opus_int16 a_Q12[], /* I Short term prediction coefs */ + const opus_int16 b_Q14[], /* I Long term prediction coefs */ + const opus_int16 AR_shp_Q13[], /* I Noise shaping coefs */ + opus_int lag, /* I Pitch lag */ + opus_int32 HarmShapeFIRPacked_Q14, /* I */ + opus_int Tilt_Q14, /* I Spectral tilt */ + opus_int32 LF_shp_Q14, /* I */ + opus_int32 Gain_Q16, /* I */ + opus_int Lambda_Q10, /* I */ + opus_int offset_Q10, /* I */ + opus_int length, /* I Input length */ + opus_int subfr, /* I Subframe number */ + opus_int shapingLPCOrder, /* I Shaping LPC filter order */ + opus_int predictLPCOrder, /* I Prediction filter order */ + opus_int warping_Q16, /* I */ + __m128i MaskDelDec, /* I Mask of states in decision tree */ + opus_int *smpl_buf_idx, /* I/O Index to newest samples in buffers */ + opus_int decisionDelay /* I */ +); + +void silk_NSQ_del_dec_avx2( + const silk_encoder_state *psEncC, /* I Encoder State */ + silk_nsq_state *NSQ, /* I/O NSQ state */ + SideInfoIndices *psIndices, /* I/O Quantization Indices */ + const opus_int16 x16[], /* I Input */ + opus_int8 pulses[], /* O Quantized pulse signal */ + const opus_int16 *PredCoef_Q12, /* I Short term prediction coefs */ + const opus_int16 LTPCoef_Q14[LTP_ORDER * MAX_NB_SUBFR], /* I Long term prediction coefs */ + const opus_int16 AR_Q13[MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER], /* I Noise shaping coefs */ + const opus_int HarmShapeGain_Q14[MAX_NB_SUBFR], /* I Long term shaping coefs */ + const opus_int Tilt_Q14[MAX_NB_SUBFR], /* I Spectral tilt */ + const opus_int32 LF_shp_Q14[MAX_NB_SUBFR], /* I Low frequency shaping coefs */ + const opus_int32 Gains_Q16[MAX_NB_SUBFR], /* I Quantization step sizes */ + const opus_int32 pitchL[MAX_NB_SUBFR], /* I Pitch lags */ + const opus_int Lambda_Q10, /* I Rate/distortion tradeoff */ + const opus_int LTP_scale_Q14 /* I LTP state scaling */ +) +{ +#ifdef OPUS_CHECK_ASM + silk_nsq_state NSQ_c; + SideInfoIndices psIndices_c; + opus_int8 pulses_c[MAX_FRAME_LENGTH]; + const opus_int8 *const pulses_a = pulses; + + silk_memcpy(&NSQ_c, NSQ, sizeof(NSQ_c)); + silk_memcpy(&psIndices_c, psIndices, sizeof(psIndices_c)); + silk_memcpy(pulses_c, pulses, sizeof(pulses_c)); + silk_NSQ_del_dec_c(psEncC, &NSQ_c, &psIndices_c, x16, pulses_c, PredCoef_Q12, LTPCoef_Q14, AR_Q13, HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, + pitchL, Lambda_Q10, LTP_scale_Q14); +#endif + + if (!verify_assumptions(psEncC)) + { + silk_NSQ_del_dec_c(psEncC, NSQ, psIndices, x16, pulses, PredCoef_Q12, LTPCoef_Q14, AR_Q13, HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, pitchL, Lambda_Q10, LTP_scale_Q14); + return; + } + + opus_int i, k, lag, start_idx, LSF_interpolation_flag, Winner_ind, subfr; + opus_int last_smple_idx, smpl_buf_idx, decisionDelay; + const opus_int16 *A_Q12, *B_Q14, *AR_shp_Q13; + opus_int16 *pxq; + VARDECL(opus_int32, sLTP_Q15); + VARDECL(opus_int16, sLTP); + opus_int32 HarmShapeFIRPacked_Q14; + opus_int offset_Q10; + opus_int32 Gain_Q10; + opus_int32 x_sc_Q10[MAX_SUB_FRAME_LENGTH]; + opus_int32 delayedGain_Q10[DECISION_DELAY]; + NSQ_del_dec_struct psDelDec = {0}; + NSQ_del_dec_sample_struct *psSample; + __m128i RDmin_Q10, MaskDelDec, Winner_selector; + SAVE_STACK; + + MaskDelDec = _mm_cvtepi8_epi32(_mm_cvtsi32_si128(0xFFFFFF00ul << ((psEncC->nStatesDelayedDecision - 1) << 3))); + + /* Set unvoiced lag to the previous one, overwrite later for voiced */ + lag = NSQ->lagPrev; + + silk_assert(NSQ->prev_gain_Q16 != 0); + psDelDec.Seed = _mm_and_si128( + _mm_add_epi32(_mm_set_epi32(3, 2, 1, 0), _mm_set1_epi32(psIndices->Seed)), + _mm_set1_epi32(3)); + psDelDec.SeedInit = psDelDec.Seed; + psDelDec.RD_Q10 = _mm_setzero_si128(); + psDelDec.LF_AR_Q14 = _mm_set1_epi32(NSQ->sLF_AR_shp_Q14); + psDelDec.Diff_Q14 = _mm_set1_epi32(NSQ->sDiff_shp_Q14); + psDelDec.Samples[0].Shape_Q14 = _mm_set1_epi32(NSQ->sLTP_shp_Q14[psEncC->ltp_mem_length - 1]); + for (i = 0; i < NSQ_LPC_BUF_LENGTH; i++) + { + psDelDec.sLPC_Q14[i] = _mm_set1_epi32(NSQ->sLPC_Q14[i]); + } + for (i = 0; i < MAX_SHAPE_LPC_ORDER; i++) + { + psDelDec.sAR2_Q14[i] = _mm_set1_epi32(NSQ->sAR2_Q14[i]); + } + + offset_Q10 = silk_Quantization_Offsets_Q10[psIndices->signalType >> 1][psIndices->quantOffsetType]; + smpl_buf_idx = 0; /* index of oldest samples */ + + decisionDelay = silk_min_int(DECISION_DELAY, psEncC->subfr_length); + + /* For voiced frames limit the decision delay to lower than the pitch lag */ + if (psIndices->signalType == TYPE_VOICED) + { + for (k = 0; k < psEncC->nb_subfr; k++) + { + decisionDelay = silk_min_int(decisionDelay, pitchL[k] - LTP_ORDER / 2 - 1); + } + } + else + { + if (lag > 0) + { + decisionDelay = silk_min_int(decisionDelay, lag - LTP_ORDER / 2 - 1); + } + } + + if (psIndices->NLSFInterpCoef_Q2 == 4) + { + LSF_interpolation_flag = 0; + } + else + { + LSF_interpolation_flag = 1; + } + + ALLOC(sLTP_Q15, psEncC->ltp_mem_length + psEncC->frame_length, opus_int32); + ALLOC(sLTP, psEncC->ltp_mem_length + psEncC->frame_length, opus_int16); + /* Set up pointers to start of sub frame */ + pxq = &NSQ->xq[psEncC->ltp_mem_length]; + NSQ->sLTP_shp_buf_idx = psEncC->ltp_mem_length; + NSQ->sLTP_buf_idx = psEncC->ltp_mem_length; + subfr = 0; + for (k = 0; k < psEncC->nb_subfr; k++) + { + A_Q12 = &PredCoef_Q12[((k >> 1) | (1 ^ LSF_interpolation_flag)) * MAX_LPC_ORDER]; + B_Q14 = <PCoef_Q14[k * LTP_ORDER]; + AR_shp_Q13 = &AR_Q13[k * MAX_SHAPE_LPC_ORDER]; + + /* Noise shape parameters */ + silk_assert(HarmShapeGain_Q14[k] >= 0); + HarmShapeFIRPacked_Q14 = silk_RSHIFT( HarmShapeGain_Q14[ k ], 2 ); + HarmShapeFIRPacked_Q14 |= silk_LSHIFT( (opus_int32)silk_RSHIFT( HarmShapeGain_Q14[ k ], 1 ), 16 ); + + NSQ->rewhite_flag = 0; + if (psIndices->signalType == TYPE_VOICED) + { + /* Voiced */ + lag = pitchL[k]; + + /* Re-whitening */ + if ((k & (3 ^ (LSF_interpolation_flag << 1))) == 0) + { + if (k == 2) + { + /* RESET DELAYED DECISIONS */ + /* Find winner */ + RDmin_Q10 = silk_mm_mask_hmin_epi32(psDelDec.RD_Q10, MaskDelDec); + Winner_ind = silk_index_of_first_equal_epi32(RDmin_Q10, psDelDec.RD_Q10); + Winner_selector = silk_index_to_selector(Winner_ind); + psDelDec.RD_Q10 = _mm_add_epi32( + psDelDec.RD_Q10, + _mm_blendv_epi8( + _mm_set1_epi32(silk_int32_MAX >> 4), + _mm_setzero_si128(), + _mm_cvtepi8_epi32(_mm_cvtsi32_si128(0xFFU << (unsigned)(Winner_ind << 3))))); + + /* Copy final part of signals from winner state to output and long-term filter states */ + last_smple_idx = smpl_buf_idx + decisionDelay; + for (i = 0; i < decisionDelay; i++) + { + last_smple_idx = (last_smple_idx + DECISION_DELAY - 1) % DECISION_DELAY; + psSample = &psDelDec.Samples[last_smple_idx]; + pulses[i - decisionDelay] = + (opus_int8)silk_sar_round_32(silk_select_winner(psSample->Q_Q10, Winner_selector), 10); + pxq[i - decisionDelay] = + silk_sat16((opus_int32)silk_sar_round_smulww(silk_select_winner(psSample->Xq_Q14, Winner_selector), Gains_Q16[1], 14)); + NSQ->sLTP_shp_Q14[NSQ->sLTP_shp_buf_idx - decisionDelay + i] = + silk_select_winner(psSample->Shape_Q14, Winner_selector); + } + + subfr = 0; + } + + /* Rewhiten with new A coefs */ + start_idx = psEncC->ltp_mem_length - lag - psEncC->predictLPCOrder - LTP_ORDER / 2; + silk_assert(start_idx > 0); + + silk_LPC_analysis_filter_avx2(&sLTP[start_idx], &NSQ->xq[start_idx + k * psEncC->subfr_length], + A_Q12, psEncC->ltp_mem_length - start_idx, psEncC->predictLPCOrder); + + NSQ->sLTP_buf_idx = psEncC->ltp_mem_length; + NSQ->rewhite_flag = 1; + } + } + + silk_nsq_del_dec_scale_states_avx2(psEncC, NSQ, &psDelDec, x16, x_sc_Q10, sLTP, sLTP_Q15, k, + LTP_scale_Q14, Gains_Q16, pitchL, psIndices->signalType, decisionDelay); + + silk_noise_shape_quantizer_del_dec_avx2(NSQ, &psDelDec, psIndices->signalType, x_sc_Q10, pulses, pxq, sLTP_Q15, + delayedGain_Q10, A_Q12, B_Q14, AR_shp_Q13, lag, HarmShapeFIRPacked_Q14, Tilt_Q14[k], LF_shp_Q14[k], + Gains_Q16[k], Lambda_Q10, offset_Q10, psEncC->subfr_length, subfr++, psEncC->shapingLPCOrder, + psEncC->predictLPCOrder, psEncC->warping_Q16, MaskDelDec, &smpl_buf_idx, decisionDelay); + + x16 += psEncC->subfr_length; + pulses += psEncC->subfr_length; + pxq += psEncC->subfr_length; + } + + /* Find winner */ + RDmin_Q10 = silk_mm_mask_hmin_epi32(psDelDec.RD_Q10, MaskDelDec); + Winner_selector = silk_index_to_selector(silk_index_of_first_equal_epi32(RDmin_Q10, psDelDec.RD_Q10)); + + /* Copy final part of signals from winner state to output and long-term filter states */ + psIndices->Seed = silk_select_winner(psDelDec.SeedInit, Winner_selector); + last_smple_idx = smpl_buf_idx + decisionDelay; + Gain_Q10 = Gains_Q16[psEncC->nb_subfr - 1] >> 6; + for (i = 0; i < decisionDelay; i++) + { + last_smple_idx = (last_smple_idx + DECISION_DELAY - 1) % DECISION_DELAY; + psSample = &psDelDec.Samples[last_smple_idx]; + + pulses[i - decisionDelay] = + (opus_int8)silk_sar_round_32(silk_select_winner(psSample->Q_Q10, Winner_selector), 10); + pxq[i - decisionDelay] = + silk_sat16((opus_int32)silk_sar_round_smulww(silk_select_winner(psSample->Xq_Q14, Winner_selector), Gain_Q10, 8)); + NSQ->sLTP_shp_Q14[NSQ->sLTP_shp_buf_idx - decisionDelay + i] = + silk_select_winner(psSample->Shape_Q14, Winner_selector); + } + for (i = 0; i < NSQ_LPC_BUF_LENGTH; i++) + { + NSQ->sLPC_Q14[i] = silk_select_winner(psDelDec.sLPC_Q14[i], Winner_selector); + } + for (i = 0; i < MAX_SHAPE_LPC_ORDER; i++) + { + NSQ->sAR2_Q14[i] = silk_select_winner(psDelDec.sAR2_Q14[i], Winner_selector); + } + + /* Update states */ + NSQ->sLF_AR_shp_Q14 = silk_select_winner(psDelDec.LF_AR_Q14, Winner_selector); + NSQ->sDiff_shp_Q14 = silk_select_winner(psDelDec.Diff_Q14, Winner_selector); + NSQ->lagPrev = pitchL[psEncC->nb_subfr - 1]; + + /* Save quantized speech signal */ + silk_memmove(NSQ->xq, &NSQ->xq[psEncC->frame_length], psEncC->ltp_mem_length * sizeof(opus_int16)); + silk_memmove(NSQ->sLTP_shp_Q14, &NSQ->sLTP_shp_Q14[psEncC->frame_length], psEncC->ltp_mem_length * sizeof(opus_int32)); + +#ifdef OPUS_CHECK_ASM + silk_assert(!memcmp(&NSQ_c, NSQ, sizeof(NSQ_c))); + silk_assert(!memcmp(&psIndices_c, psIndices, sizeof(psIndices_c))); + silk_assert(!memcmp(pulses_c, pulses_a, sizeof(pulses_c))); +#endif + + RESTORE_STACK; +} + +static OPUS_INLINE __m128i silk_noise_shape_quantizer_short_prediction_x4(const __m128i *buf32, const opus_int16 *coef16, opus_int order) +{ + __m256i out; + silk_assert(order == 10 || order == 16); + + /* Avoids introducing a bias because silk_SMLAWB() always rounds to -inf */ + out = _mm256_set1_epi32(order >> 1); + out = _mm256_add_epi32(out, _mm256_mul_epi32(_mm256_cvtepi32_epi64(buf32[-0]), _mm256_set1_epi32(silk_LSHIFT(coef16[0], 16)))); /* High DWORD */ + out = _mm256_add_epi32(out, _mm256_mul_epi32(_mm256_cvtepi32_epi64(buf32[-1]), _mm256_set1_epi32(silk_LSHIFT(coef16[1], 16)))); /* High DWORD */ + out = _mm256_add_epi32(out, _mm256_mul_epi32(_mm256_cvtepi32_epi64(buf32[-2]), _mm256_set1_epi32(silk_LSHIFT(coef16[2], 16)))); /* High DWORD */ + out = _mm256_add_epi32(out, _mm256_mul_epi32(_mm256_cvtepi32_epi64(buf32[-3]), _mm256_set1_epi32(silk_LSHIFT(coef16[3], 16)))); /* High DWORD */ + out = _mm256_add_epi32(out, _mm256_mul_epi32(_mm256_cvtepi32_epi64(buf32[-4]), _mm256_set1_epi32(silk_LSHIFT(coef16[4], 16)))); /* High DWORD */ + out = _mm256_add_epi32(out, _mm256_mul_epi32(_mm256_cvtepi32_epi64(buf32[-5]), _mm256_set1_epi32(silk_LSHIFT(coef16[5], 16)))); /* High DWORD */ + out = _mm256_add_epi32(out, _mm256_mul_epi32(_mm256_cvtepi32_epi64(buf32[-6]), _mm256_set1_epi32(silk_LSHIFT(coef16[6], 16)))); /* High DWORD */ + out = _mm256_add_epi32(out, _mm256_mul_epi32(_mm256_cvtepi32_epi64(buf32[-7]), _mm256_set1_epi32(silk_LSHIFT(coef16[7], 16)))); /* High DWORD */ + out = _mm256_add_epi32(out, _mm256_mul_epi32(_mm256_cvtepi32_epi64(buf32[-8]), _mm256_set1_epi32(silk_LSHIFT(coef16[8], 16)))); /* High DWORD */ + out = _mm256_add_epi32(out, _mm256_mul_epi32(_mm256_cvtepi32_epi64(buf32[-9]), _mm256_set1_epi32(silk_LSHIFT(coef16[9], 16)))); /* High DWORD */ + + if (order == 16) + { + out = _mm256_add_epi32(out, _mm256_mul_epi32(_mm256_cvtepi32_epi64(buf32[-10]), _mm256_set1_epi32(silk_LSHIFT(coef16[10], 16)))); /* High DWORD */ + out = _mm256_add_epi32(out, _mm256_mul_epi32(_mm256_cvtepi32_epi64(buf32[-11]), _mm256_set1_epi32(silk_LSHIFT(coef16[11], 16)))); /* High DWORD */ + out = _mm256_add_epi32(out, _mm256_mul_epi32(_mm256_cvtepi32_epi64(buf32[-12]), _mm256_set1_epi32(silk_LSHIFT(coef16[12], 16)))); /* High DWORD */ + out = _mm256_add_epi32(out, _mm256_mul_epi32(_mm256_cvtepi32_epi64(buf32[-13]), _mm256_set1_epi32(silk_LSHIFT(coef16[13], 16)))); /* High DWORD */ + out = _mm256_add_epi32(out, _mm256_mul_epi32(_mm256_cvtepi32_epi64(buf32[-14]), _mm256_set1_epi32(silk_LSHIFT(coef16[14], 16)))); /* High DWORD */ + out = _mm256_add_epi32(out, _mm256_mul_epi32(_mm256_cvtepi32_epi64(buf32[-15]), _mm256_set1_epi32(silk_LSHIFT(coef16[15], 16)))); /* High DWORD */ + } + return silk_cvtepi64_epi32_high(out); +} + +/******************************************/ +/* Noise shape quantizer for one subframe */ +/******************************************/ +static OPUS_INLINE void silk_noise_shape_quantizer_del_dec_avx2( + silk_nsq_state *NSQ, /* I/O NSQ state */ + NSQ_del_dec_struct *psDelDec, /* I/O Delayed decision states */ + opus_int signalType, /* I Signal type */ + const opus_int32 x_Q10[], /* I */ + opus_int8 pulses[], /* O */ + opus_int16 xq[], /* O */ + opus_int32 sLTP_Q15[], /* I/O LTP filter state */ + opus_int32 delayedGain_Q10[DECISION_DELAY], /* I/O Gain delay buffer */ + const opus_int16 a_Q12[], /* I Short term prediction coefs */ + const opus_int16 b_Q14[], /* I Long term prediction coefs */ + const opus_int16 AR_shp_Q13[], /* I Noise shaping coefs */ + opus_int lag, /* I Pitch lag */ + opus_int32 HarmShapeFIRPacked_Q14, /* I */ + opus_int Tilt_Q14, /* I Spectral tilt */ + opus_int32 LF_shp_Q14, /* I */ + opus_int32 Gain_Q16, /* I */ + opus_int Lambda_Q10, /* I */ + opus_int offset_Q10, /* I */ + opus_int length, /* I Input length */ + opus_int subfr, /* I Subframe number */ + opus_int shapingLPCOrder, /* I Shaping LPC filter order */ + opus_int predictLPCOrder, /* I Prediction filter order */ + opus_int warping_Q16, /* I */ + __m128i MaskDelDec, /* I Mask of states in decision tree */ + opus_int *smpl_buf_idx, /* I/O Index to newest samples in buffers */ + opus_int decisionDelay /* I */ +) +{ + int i; + opus_int32 *shp_lag_ptr = &NSQ->sLTP_shp_Q14[NSQ->sLTP_shp_buf_idx - lag + HARM_SHAPE_FIR_TAPS / 2]; + opus_int32 *pred_lag_ptr = &sLTP_Q15[NSQ->sLTP_buf_idx - lag + LTP_ORDER / 2]; + opus_int32 Gain_Q10 = Gain_Q16 >> 6; + + for (i = 0; i < length; i++) + { + /* Perform common calculations used in all states */ + /* NSQ_sample_struct */ + /* Low 128 bits => 1st set */ + /* High 128 bits => 2nd set */ + int j; + __m256i SS_Q_Q10; + __m256i SS_RD_Q10; + __m256i SS_xq_Q14; + __m256i SS_LF_AR_Q14; + __m256i SS_Diff_Q14; + __m256i SS_sLTP_shp_Q14; + __m256i SS_LPC_exc_Q14; + __m256i exc_Q14; + __m256i q_Q10, rr_Q10, rd_Q10; + __m256i mask; + __m128i LPC_pred_Q14, n_AR_Q14; + __m128i RDmin_Q10, RDmax_Q10; + __m128i n_LF_Q14; + __m128i r_Q10, q1_Q0, q1_Q10, q2_Q10; + __m128i Winner_rand_state, Winner_selector; + __m128i tmp0, tmp1; + NSQ_del_dec_sample_struct *psLastSample, *psSample; + opus_int32 RDmin_ind, RDmax_ind, last_smple_idx; + opus_int32 LTP_pred_Q14, n_LTP_Q14; + + /* Long-term prediction */ + if (signalType == TYPE_VOICED) + { + /* Unrolled loop */ + /* Avoids introducing a bias because silk_SMLAWB() always rounds to -inf */ + LTP_pred_Q14 = 2; + LTP_pred_Q14 += silk_SMULWB(pred_lag_ptr[-0], b_Q14[0]); + LTP_pred_Q14 += silk_SMULWB(pred_lag_ptr[-1], b_Q14[1]); + LTP_pred_Q14 += silk_SMULWB(pred_lag_ptr[-2], b_Q14[2]); + LTP_pred_Q14 += silk_SMULWB(pred_lag_ptr[-3], b_Q14[3]); + LTP_pred_Q14 += silk_SMULWB(pred_lag_ptr[-4], b_Q14[4]); + LTP_pred_Q14 = silk_LSHIFT(LTP_pred_Q14, 1); /* Q13 -> Q14 */ + pred_lag_ptr++; + } + else + { + LTP_pred_Q14 = 0; + } + + /* Long-term shaping */ + if (lag > 0) + { + /* Symmetric, packed FIR coefficients */ + n_LTP_Q14 = silk_add_sat32(shp_lag_ptr[0], shp_lag_ptr[-2]); + n_LTP_Q14 = silk_SMULWB(n_LTP_Q14, HarmShapeFIRPacked_Q14); + n_LTP_Q14 = n_LTP_Q14 + silk_SMULWT(shp_lag_ptr[-1], HarmShapeFIRPacked_Q14); + n_LTP_Q14 = LTP_pred_Q14 - (silk_LSHIFT(n_LTP_Q14, 2)); /* Q12 -> Q14 */ + shp_lag_ptr++; + } + else + { + n_LTP_Q14 = 0; + } + + /* BEGIN Updating Delayed Decision States */ + + /* Generate dither */ + psDelDec->Seed = silk_mm256_rand_epi32(psDelDec->Seed); + + /* Short-term prediction */ + LPC_pred_Q14 = silk_noise_shape_quantizer_short_prediction_x4(&psDelDec->sLPC_Q14[NSQ_LPC_BUF_LENGTH - 1 + i], a_Q12, predictLPCOrder); + LPC_pred_Q14 = _mm_slli_epi32(LPC_pred_Q14, 4); /* Q10 -> Q14 */ + + /* Noise shape feedback */ + silk_assert(shapingLPCOrder > 0); + silk_assert((shapingLPCOrder & 1) == 0); /* check that order is even */ + /* Output of lowpass section */ + tmp0 = _mm_add_epi32(psDelDec->Diff_Q14, silk_mm_smulwb_epi32(psDelDec->sAR2_Q14[0], warping_Q16)); + n_AR_Q14 = _mm_set1_epi32(shapingLPCOrder >> 1); + for (j = 0; j < shapingLPCOrder - 1; j++) + { + /* Output of allpass section */ + tmp1 = psDelDec->sAR2_Q14[j]; + psDelDec->sAR2_Q14[j] = tmp0; + n_AR_Q14 = _mm_add_epi32(n_AR_Q14, silk_mm_smulwb_epi32(tmp0, AR_shp_Q13[j])); + tmp0 = _mm_add_epi32(tmp1, silk_mm_smulwb_epi32(_mm_sub_epi32(psDelDec->sAR2_Q14[j + 1], tmp0), warping_Q16)); + } + psDelDec->sAR2_Q14[shapingLPCOrder - 1] = tmp0; + n_AR_Q14 = _mm_add_epi32(n_AR_Q14, silk_mm_smulwb_epi32(tmp0, AR_shp_Q13[shapingLPCOrder - 1])); + + n_AR_Q14 = _mm_slli_epi32(n_AR_Q14, 1); /* Q11 -> Q12 */ + n_AR_Q14 = _mm_add_epi32(n_AR_Q14, silk_mm_smulwb_epi32(psDelDec->LF_AR_Q14, Tilt_Q14)); /* Q12 */ + n_AR_Q14 = _mm_slli_epi32(n_AR_Q14, 2); /* Q12 -> Q14 */ + + tmp0 = silk_mm_smulwb_epi32(psDelDec->Samples[*smpl_buf_idx].Shape_Q14, LF_shp_Q14); /* Q12 */ + tmp1 = silk_mm_smulwb_epi32(psDelDec->LF_AR_Q14, LF_shp_Q14 >> 16); /* Q12 */ + n_LF_Q14 = _mm_add_epi32(tmp0, tmp1); /* Q12 */ + n_LF_Q14 = _mm_slli_epi32(n_LF_Q14, 2); /* Q12 -> Q14 */ + + /* Input minus prediction plus noise feedback */ + /* r = x[ i ] - LTP_pred - LPC_pred + n_AR + n_Tilt + n_LF + n_LTP */ + tmp0 = silk_mm_add_sat_epi32(n_AR_Q14, n_LF_Q14); /* Q14 */ + tmp1 = _mm_add_epi32(_mm_set1_epi32(n_LTP_Q14), LPC_pred_Q14); /* Q13 */ + tmp0 = silk_mm_sub_sat_epi32(tmp1, tmp0); /* Q13 */ + tmp0 = silk_mm_srai_round_epi32(tmp0, 4); /* Q10 */ + + r_Q10 = _mm_sub_epi32(_mm_set1_epi32(x_Q10[i]), tmp0); /* residual error Q10 */ + + /* Flip sign depending on dither */ + r_Q10 = silk_mm_sign_epi32(r_Q10, psDelDec->Seed); + r_Q10 = silk_mm_limit_epi32(r_Q10, -(31 << 10), 30 << 10); + + /* Find two quantization level candidates and measure their rate-distortion */ + q1_Q10 = _mm_sub_epi32(r_Q10, _mm_set1_epi32(offset_Q10)); + q1_Q0 = _mm_srai_epi32(q1_Q10, 10); + if (Lambda_Q10 > 2048) + { + /* For aggressive RDO, the bias becomes more than one pulse. */ + tmp0 = _mm_sub_epi32(_mm_abs_epi32(q1_Q10), _mm_set1_epi32(Lambda_Q10 / 2 - 512)); /* rdo_offset */ + q1_Q0 = _mm_srai_epi32(q1_Q10, 31); + tmp1 = _mm_cmpgt_epi32(tmp0, _mm_setzero_si128()); + tmp0 = _mm_srai_epi32(silk_mm_sign_epi32(tmp0, q1_Q10), 10); + q1_Q0 = _mm_blendv_epi8(q1_Q0, tmp0, tmp1); + } + + tmp0 = _mm_sign_epi32(_mm_set1_epi32(QUANT_LEVEL_ADJUST_Q10), q1_Q0); + q1_Q10 = _mm_sub_epi32(_mm_slli_epi32(q1_Q0, 10), tmp0); + q1_Q10 = _mm_add_epi32(q1_Q10, _mm_set1_epi32(offset_Q10)); + + /* check if q1_Q0 is 0 or -1 */ + tmp0 = _mm_add_epi32(_mm_srli_epi32(q1_Q0, 31), q1_Q0); + tmp1 = _mm_cmpeq_epi32(tmp0, _mm_setzero_si128()); + tmp0 = _mm_blendv_epi8(_mm_set1_epi32(1024), _mm_set1_epi32(1024 - QUANT_LEVEL_ADJUST_Q10), tmp1); + q2_Q10 = _mm_add_epi32(q1_Q10, tmp0); + q_Q10 = _mm256_set_m128i(q2_Q10, q1_Q10); + + rr_Q10 = _mm256_sub_epi32(_mm256_broadcastsi128_si256(r_Q10), q_Q10); + rd_Q10 = _mm256_abs_epi32(q_Q10); + rr_Q10 = silk_mm256_smulbb_epi32(rr_Q10, rr_Q10); + rd_Q10 = silk_mm256_smulbb_epi32(rd_Q10, _mm256_set1_epi32(Lambda_Q10)); + rd_Q10 = _mm256_add_epi32(rd_Q10, rr_Q10); + rd_Q10 = _mm256_srai_epi32(rd_Q10, 10); + + mask = _mm256_broadcastsi128_si256(_mm_cmplt_epi32(_mm256_extracti128_si256(rd_Q10, 0), _mm256_extracti128_si256(rd_Q10, 1))); + SS_RD_Q10 = _mm256_add_epi32( + _mm256_broadcastsi128_si256(psDelDec->RD_Q10), + _mm256_blendv_epi8( + _mm256_permute2x128_si256(rd_Q10, rd_Q10, 0x1), + rd_Q10, + mask)); + SS_Q_Q10 = _mm256_blendv_epi8( + _mm256_permute2x128_si256(q_Q10, q_Q10, 0x1), + q_Q10, + mask); + + /* Update states for best and second best quantization */ + + /* Quantized excitation */ + exc_Q14 = silk_mm256_sign_epi32(_mm256_slli_epi32(SS_Q_Q10, 4), _mm256_broadcastsi128_si256(psDelDec->Seed)); + + /* Add predictions */ + exc_Q14 = _mm256_add_epi32(exc_Q14, _mm256_set1_epi32(LTP_pred_Q14)); + SS_LPC_exc_Q14 = _mm256_slli_epi32(exc_Q14, 1); + SS_xq_Q14 = _mm256_add_epi32(exc_Q14, _mm256_broadcastsi128_si256(LPC_pred_Q14)); + + /* Update states */ + SS_Diff_Q14 = _mm256_sub_epi32(SS_xq_Q14, _mm256_set1_epi32(silk_LSHIFT(x_Q10[i], 4))); + SS_LF_AR_Q14 = _mm256_sub_epi32(SS_Diff_Q14, _mm256_broadcastsi128_si256(n_AR_Q14)); + SS_sLTP_shp_Q14 = silk_mm256_sub_sat_epi32(SS_LF_AR_Q14, _mm256_broadcastsi128_si256(n_LF_Q14)); + + /* END Updating Delayed Decision States */ + + *smpl_buf_idx = (*smpl_buf_idx + DECISION_DELAY - 1) % DECISION_DELAY; + last_smple_idx = (*smpl_buf_idx + decisionDelay) % DECISION_DELAY; + psLastSample = &psDelDec->Samples[last_smple_idx]; + + /* Find winner */ + RDmin_Q10 = silk_mm_mask_hmin_epi32(_mm256_castsi256_si128(SS_RD_Q10), MaskDelDec); + Winner_selector = silk_index_to_selector(silk_index_of_first_equal_epi32(RDmin_Q10, _mm256_castsi256_si128(SS_RD_Q10))); + + /* Increase RD values of expired states */ + Winner_rand_state = _mm_shuffle_epi8(psLastSample->RandState, Winner_selector); + + SS_RD_Q10 = _mm256_blendv_epi8( + _mm256_add_epi32(SS_RD_Q10, _mm256_set1_epi32(silk_int32_MAX >> 4)), + SS_RD_Q10, + _mm256_broadcastsi128_si256(_mm_cmpeq_epi32(psLastSample->RandState, Winner_rand_state))); + + /* find worst in first set */ + RDmax_Q10 = silk_mm_mask_hmax_epi32(_mm256_extracti128_si256(SS_RD_Q10, 0), MaskDelDec); + /* find best in second set */ + RDmin_Q10 = silk_mm_mask_hmin_epi32(_mm256_extracti128_si256(SS_RD_Q10, 1), MaskDelDec); + + /* Replace a state if best from second set outperforms worst in first set */ + tmp0 = _mm_cmplt_epi32(RDmin_Q10, RDmax_Q10); + if (!_mm_test_all_zeros(tmp0, tmp0)) + { + int t; + RDmax_ind = silk_index_of_first_equal_epi32(RDmax_Q10, _mm256_extracti128_si256(SS_RD_Q10, 0)); + RDmin_ind = silk_index_of_first_equal_epi32(RDmin_Q10, _mm256_extracti128_si256(SS_RD_Q10, 1)); + tmp1 = _mm_cvtepi8_epi32(_mm_cvtsi32_si128(0xFFU << (unsigned)(RDmax_ind << 3))); + tmp0 = _mm_blendv_epi8( + _mm_set_epi8(0xF, 0xE, 0xD, 0xC, 0xB, 0xA, 0x9, 0x8, 0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1, 0x0), + silk_index_to_selector(RDmin_ind), + tmp1); + for (t = i; t < MAX_SUB_FRAME_LENGTH + NSQ_LPC_BUF_LENGTH; t++) + { + psDelDec->sLPC_Q14[t] = _mm_shuffle_epi8(psDelDec->sLPC_Q14[t], tmp0); + } + psDelDec->Seed = _mm_shuffle_epi8(psDelDec->Seed, tmp0); + psDelDec->SeedInit = _mm_shuffle_epi8(psDelDec->SeedInit, tmp0); + for (t = 0; t < MAX_SHAPE_LPC_ORDER; t++) + { + psDelDec->sAR2_Q14[t] = _mm_shuffle_epi8(psDelDec->sAR2_Q14[t], tmp0); + } + for (t = 0; t < DECISION_DELAY; t++) + { + psDelDec->Samples[t].RandState = _mm_shuffle_epi8(psDelDec->Samples[t].RandState, tmp0); + psDelDec->Samples[t].Q_Q10 = _mm_shuffle_epi8(psDelDec->Samples[t].Q_Q10, tmp0); + psDelDec->Samples[t].Xq_Q14 = _mm_shuffle_epi8(psDelDec->Samples[t].Xq_Q14, tmp0); + psDelDec->Samples[t].Pred_Q15 = _mm_shuffle_epi8(psDelDec->Samples[t].Pred_Q15, tmp0); + psDelDec->Samples[t].Shape_Q14 = _mm_shuffle_epi8(psDelDec->Samples[t].Shape_Q14, tmp0); + } + mask = _mm256_castsi128_si256(_mm_blendv_epi8(_mm_set_epi32(0x3, 0x2, 0x1, 0x0), _mm_set1_epi32(RDmin_ind + 4), tmp1)); + SS_Q_Q10 = _mm256_permutevar8x32_epi32(SS_Q_Q10, mask); + SS_RD_Q10 = _mm256_permutevar8x32_epi32(SS_RD_Q10, mask); + SS_xq_Q14 = _mm256_permutevar8x32_epi32(SS_xq_Q14, mask); + SS_LF_AR_Q14 = _mm256_permutevar8x32_epi32(SS_LF_AR_Q14, mask); + SS_Diff_Q14 = _mm256_permutevar8x32_epi32(SS_Diff_Q14, mask); + SS_sLTP_shp_Q14 = _mm256_permutevar8x32_epi32(SS_sLTP_shp_Q14, mask); + SS_LPC_exc_Q14 = _mm256_permutevar8x32_epi32(SS_LPC_exc_Q14, mask); + } + + /* Write samples from winner to output and long-term filter states */ + if (subfr > 0 || i >= decisionDelay) + { + pulses[i - decisionDelay] = + (opus_int8)silk_sar_round_32(silk_select_winner(psLastSample->Q_Q10, Winner_selector), 10); + xq[i - decisionDelay] = + silk_sat16((opus_int32)silk_sar_round_smulww(silk_select_winner(psLastSample->Xq_Q14, Winner_selector), delayedGain_Q10[last_smple_idx], 8)); + NSQ->sLTP_shp_Q14[NSQ->sLTP_shp_buf_idx - decisionDelay] = + silk_select_winner(psLastSample->Shape_Q14, Winner_selector); + sLTP_Q15[NSQ->sLTP_buf_idx - decisionDelay] = + silk_select_winner(psLastSample->Pred_Q15, Winner_selector); + } + NSQ->sLTP_shp_buf_idx++; + NSQ->sLTP_buf_idx++; + + /* Update states */ + psSample = &psDelDec->Samples[*smpl_buf_idx]; + psDelDec->Seed = _mm_add_epi32(psDelDec->Seed, silk_mm_srai_round_epi32(_mm256_castsi256_si128(SS_Q_Q10), 10)); + psDelDec->LF_AR_Q14 = _mm256_castsi256_si128(SS_LF_AR_Q14); + psDelDec->Diff_Q14 = _mm256_castsi256_si128(SS_Diff_Q14); + psDelDec->sLPC_Q14[i + NSQ_LPC_BUF_LENGTH] = _mm256_castsi256_si128(SS_xq_Q14); + psDelDec->RD_Q10 = _mm256_castsi256_si128(SS_RD_Q10); + psSample->Xq_Q14 = _mm256_castsi256_si128(SS_xq_Q14); + psSample->Q_Q10 = _mm256_castsi256_si128(SS_Q_Q10); + psSample->Pred_Q15 = _mm256_castsi256_si128(SS_LPC_exc_Q14); + psSample->Shape_Q14 = _mm256_castsi256_si128(SS_sLTP_shp_Q14); + psSample->RandState = psDelDec->Seed; + delayedGain_Q10[*smpl_buf_idx] = Gain_Q10; + } + /* Update LPC states */ + for (i = 0; i < NSQ_LPC_BUF_LENGTH; i++) + { + psDelDec->sLPC_Q14[i] = (&psDelDec->sLPC_Q14[length])[i]; + } +} + +static OPUS_INLINE void silk_nsq_del_dec_scale_states_avx2( + const silk_encoder_state *psEncC, /* I Encoder State */ + silk_nsq_state *NSQ, /* I/O NSQ state */ + NSQ_del_dec_struct *psDelDec, /* I/O Delayed decision states */ + const opus_int16 x16[], /* I Input */ + opus_int32 x_sc_Q10[MAX_SUB_FRAME_LENGTH], /* O Input scaled with 1/Gain in Q10 */ + const opus_int16 sLTP[], /* I Re-whitened LTP state in Q0 */ + opus_int32 sLTP_Q15[], /* O LTP state matching scaled input */ + opus_int subfr, /* I Subframe number */ + const opus_int LTP_scale_Q14, /* I LTP state scaling */ + const opus_int32 Gains_Q16[MAX_NB_SUBFR], /* I */ + const opus_int pitchL[MAX_NB_SUBFR], /* I Pitch lag */ + const opus_int signal_type, /* I Signal type */ + const opus_int decisionDelay /* I Decision delay */ +) +{ + int i; + opus_int lag; + opus_int32 gain_adj_Q16, inv_gain_Q31, inv_gain_Q26; + NSQ_del_dec_sample_struct *psSample; + + lag = pitchL[subfr]; + inv_gain_Q31 = silk_INVERSE32_varQ(silk_max(Gains_Q16[subfr], 1), 47); + silk_assert(inv_gain_Q31 != 0); + + /* Scale input */ + inv_gain_Q26 = silk_sar_round_32(inv_gain_Q31, 5); + for (i = 0; i < psEncC->subfr_length; i+=4) + { + __m256i x = _mm256_cvtepi16_epi64(_mm_loadu_si64(&x16[i])); + x = _mm256_slli_epi64(_mm256_mul_epi32(x, _mm256_set1_epi32(inv_gain_Q26)), 16); + _mm_storeu_si128((__m128i_u*)&x_sc_Q10[i], silk_cvtepi64_epi32_high(x)); + } + + /* After rewhitening the LTP state is un-scaled, so scale with inv_gain_Q16 */ + if (NSQ->rewhite_flag) + { + if (subfr == 0) + { + /* Do LTP downscaling */ + inv_gain_Q31 = silk_LSHIFT(silk_SMULWB(inv_gain_Q31, LTP_scale_Q14), 2); + } + for (i = NSQ->sLTP_buf_idx - lag - LTP_ORDER / 2; i < NSQ->sLTP_buf_idx; i++) + { + silk_assert(i < MAX_FRAME_LENGTH); + sLTP_Q15[i] = silk_SMULWB(inv_gain_Q31, sLTP[i]); + } + } + + /* Adjust for changing gain */ + if (Gains_Q16[subfr] != NSQ->prev_gain_Q16) + { + gain_adj_Q16 = silk_DIV32_varQ(NSQ->prev_gain_Q16, Gains_Q16[subfr], 16); + + /* Scale long-term shaping state */ + for (i = NSQ->sLTP_shp_buf_idx - psEncC->ltp_mem_length; i < NSQ->sLTP_shp_buf_idx; i+=4) + { + __m128i_u* p = (__m128i_u*)&NSQ->sLTP_shp_Q14[i]; + *p = silk_mm_smulww_epi32(*p, gain_adj_Q16); + } + + /* Scale long-term prediction state */ + if (signal_type == TYPE_VOICED && NSQ->rewhite_flag == 0) + { + for (i = NSQ->sLTP_buf_idx - lag - LTP_ORDER / 2; i < NSQ->sLTP_buf_idx - decisionDelay; i++) + { + sLTP_Q15[i] = ((opus_int64)sLTP_Q15[i]) * ((opus_int64)gain_adj_Q16) >> 16; + } + } + + /* Scale scalar states */ + psDelDec->LF_AR_Q14 = silk_mm_smulww_epi32(psDelDec->LF_AR_Q14, gain_adj_Q16); + psDelDec->Diff_Q14 = silk_mm_smulww_epi32(psDelDec->Diff_Q14, gain_adj_Q16); + + /* Scale short-term prediction and shaping states */ + for (i = 0; i < NSQ_LPC_BUF_LENGTH; i++) + { + psDelDec->sLPC_Q14[i] = silk_mm_smulww_epi32(psDelDec->sLPC_Q14[i], gain_adj_Q16); + } + for (i = 0; i < DECISION_DELAY; i++) + { + psSample = &psDelDec->Samples[i]; + psSample->Pred_Q15 = silk_mm_smulww_epi32(psSample->Pred_Q15, gain_adj_Q16); + psSample->Shape_Q14 = silk_mm_smulww_epi32(psSample->Shape_Q14, gain_adj_Q16); + } + for (i = 0; i < MAX_SHAPE_LPC_ORDER; i++) + { + psDelDec->sAR2_Q14[i] = silk_mm_smulww_epi32(psDelDec->sAR2_Q14[i], gain_adj_Q16); + } + + /* Save inverse gain */ + NSQ->prev_gain_Q16 = Gains_Q16[subfr]; + } +} + +static OPUS_INLINE void silk_LPC_analysis_filter_avx2( + opus_int16 *out, /* O Output signal */ + const opus_int16 *in, /* I Input signal */ + const opus_int16 *B, /* I MA prediction coefficients, Q12 [order] */ + const opus_int32 len, /* I Signal length */ + const opus_int32 order /* I Filter order */ +) +{ + int i; + opus_int32 out32_Q12, out32; + silk_assert(order == 10 || order == 16); + + for(i = order; i < len; i++ ) + { + const opus_int16 *in_ptr = &in[ i ]; + /* Allowing wrap around so that two wraps can cancel each other. The rare + cases where the result wraps around can only be triggered by invalid streams*/ + + __m256i in_v = _mm256_cvtepi16_epi32(_mm_loadu_si128((__m128i_u*)&in_ptr[-8])); + __m256i B_v = _mm256_cvtepi16_epi32(_mm_loadu_si128((__m128i_u*)& B[0])); + __m256i sum = _mm256_mullo_epi32(in_v, silk_mm256_reverse_epi32(B_v)); + if (order > 10) + { + in_v = _mm256_cvtepi16_epi32(_mm_loadu_si128((__m128i_u*)&in_ptr[-16])); + B_v = _mm256_cvtepi16_epi32(_mm_loadu_si128((__m128i_u*)&B [8])); + B_v = silk_mm256_reverse_epi32(B_v); + } + else + { + in_v = _mm256_cvtepi16_epi32(_mm_loadu_si32(&in_ptr[-10])); + B_v = _mm256_cvtepi16_epi32(_mm_loadu_si32(&B [8])); + B_v = _mm256_shuffle_epi32(B_v, 0x01); + } + sum = _mm256_add_epi32(sum, _mm256_mullo_epi32(in_v, B_v)); + + out32_Q12 = silk_mm256_hsum_epi32(sum); + + /* Subtract prediction */ + out32_Q12 = silk_SUB32_ovflw( silk_LSHIFT( (opus_int32)*in_ptr, 12 ), out32_Q12 ); + + /* Scale to Q0 */ + out32 = silk_sar_round_32(out32_Q12, 12); + + /* Saturate output */ + out[ i ] = silk_sat16(out32); + } + + /* Set first d output samples to zero */ + silk_memset( out, 0, order * sizeof( opus_int16 ) ); +} diff --git a/media/libopus/silk/x86/NSQ_del_dec_sse4_1.c b/media/libopus/silk/x86/NSQ_del_dec_sse4_1.c index 3521cae703..5937682d2a 100644 --- a/media/libopus/silk/x86/NSQ_del_dec_sse4_1.c +++ b/media/libopus/silk/x86/NSQ_del_dec_sse4_1.c @@ -119,7 +119,7 @@ void silk_NSQ_del_dec_sse4_1( SideInfoIndices *psIndices, /* I/O Quantization Indices */ const opus_int16 x16[], /* I Input */ opus_int8 pulses[], /* O Quantized pulse signal */ - const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefs */ + const opus_int16 *PredCoef_Q12, /* I Short term prediction coefs */ const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefs */ const opus_int16 AR_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs */ const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I Long term shaping coefs */ @@ -428,7 +428,7 @@ static OPUS_INLINE void silk_noise_shape_quantizer_del_dec_sse4_1( LTP_pred_Q14 = 2; { __m128i tmpa, tmpb, pred_lag_ptr_tmp; - pred_lag_ptr_tmp = _mm_loadu_si128( (__m128i *)(&pred_lag_ptr[ -3 ] ) ); + pred_lag_ptr_tmp = _mm_loadu_si128( (__m128i *)(void*)(&pred_lag_ptr[ -3 ] ) ); pred_lag_ptr_tmp = _mm_shuffle_epi32( pred_lag_ptr_tmp, 0x1B ); tmpa = _mm_mul_epi32( pred_lag_ptr_tmp, b_Q12_0123 ); tmpa = _mm_srli_si128( tmpa, 2 ); @@ -483,7 +483,7 @@ static OPUS_INLINE void silk_noise_shape_quantizer_del_dec_sse4_1( tmpb = _mm_setzero_si128(); /* step 1 */ - psLPC_Q14_tmp = _mm_loadu_si128( (__m128i *)(&psLPC_Q14[ -3 ] ) ); /* -3, -2 , -1, 0 */ + psLPC_Q14_tmp = _mm_loadu_si128( (__m128i *)(void*)(&psLPC_Q14[ -3 ] ) ); /* -3, -2 , -1, 0 */ psLPC_Q14_tmp = _mm_shuffle_epi32( psLPC_Q14_tmp, 0x1B ); /* 0, -1, -2, -3 */ tmpa = _mm_mul_epi32( psLPC_Q14_tmp, a_Q12_0123 ); /* 0, -1, -2, -3 * 0123 -> 0*0, 2*-2 */ @@ -497,7 +497,7 @@ static OPUS_INLINE void silk_noise_shape_quantizer_del_dec_sse4_1( tmpb = _mm_add_epi32( tmpb, psLPC_Q14_tmp ); /* step 2 */ - psLPC_Q14_tmp = _mm_loadu_si128( (__m128i *)(&psLPC_Q14[ -7 ] ) ); + psLPC_Q14_tmp = _mm_loadu_si128( (__m128i *)(void*)(&psLPC_Q14[ -7 ] ) ); psLPC_Q14_tmp = _mm_shuffle_epi32( psLPC_Q14_tmp, 0x1B ); tmpa = _mm_mul_epi32( psLPC_Q14_tmp, a_Q12_4567 ); tmpa = _mm_srli_epi64( tmpa, 16 ); @@ -512,7 +512,7 @@ static OPUS_INLINE void silk_noise_shape_quantizer_del_dec_sse4_1( if ( opus_likely( predictLPCOrder == 16 ) ) { /* step 3 */ - psLPC_Q14_tmp = _mm_loadu_si128( (__m128i *)(&psLPC_Q14[ -11 ] ) ); + psLPC_Q14_tmp = _mm_loadu_si128( (__m128i *)(void*)(&psLPC_Q14[ -11 ] ) ); psLPC_Q14_tmp = _mm_shuffle_epi32( psLPC_Q14_tmp, 0x1B ); tmpa = _mm_mul_epi32( psLPC_Q14_tmp, a_Q12_89AB ); tmpa = _mm_srli_epi64( tmpa, 16 ); @@ -525,7 +525,7 @@ static OPUS_INLINE void silk_noise_shape_quantizer_del_dec_sse4_1( tmpb = _mm_add_epi32( tmpb, psLPC_Q14_tmp ); /* step 4 */ - psLPC_Q14_tmp = _mm_loadu_si128( (__m128i *)(&psLPC_Q14[ -15 ] ) ); + psLPC_Q14_tmp = _mm_loadu_si128( (__m128i *)(void*)(&psLPC_Q14[ -15 ] ) ); psLPC_Q14_tmp = _mm_shuffle_epi32( psLPC_Q14_tmp, 0x1B ); tmpa = _mm_mul_epi32( psLPC_Q14_tmp, a_Q12_CDEF ); tmpa = _mm_srli_epi64( tmpa, 16 ); @@ -830,7 +830,7 @@ static OPUS_INLINE void silk_nsq_del_dec_scale_states_sse4_1( xmm_x16_x2x0 = _mm_blend_epi16( xmm_x16_x2x0, xmm_x16_x3x1, 0xCC ); - _mm_storeu_si128( (__m128i *)(&(x_sc_Q10[ i ] ) ), xmm_x16_x2x0 ); + _mm_storeu_si128( (__m128i *)(void*)(&(x_sc_Q10[ i ] ) ), xmm_x16_x2x0 ); } for( ; i < psEncC->subfr_length; i++ ) { @@ -862,7 +862,7 @@ static OPUS_INLINE void silk_nsq_del_dec_scale_states_sse4_1( for( i = NSQ->sLTP_shp_buf_idx - psEncC->ltp_mem_length; i < NSQ->sLTP_shp_buf_idx - 3; i += 4 ) { - xmm_sLTP_shp_Q14_x2x0 = _mm_loadu_si128( (__m128i *)(&(NSQ->sLTP_shp_Q14[ i ] ) ) ); + xmm_sLTP_shp_Q14_x2x0 = _mm_loadu_si128( (__m128i *)(void*)(&(NSQ->sLTP_shp_Q14[ i ] ) ) ); /* equal shift right 4 bytes*/ xmm_sLTP_shp_Q14_x3x1 = _mm_shuffle_epi32( xmm_sLTP_shp_Q14_x2x0, _MM_SHUFFLE( 0, 3, 2, 1 ) ); @@ -874,7 +874,7 @@ static OPUS_INLINE void silk_nsq_del_dec_scale_states_sse4_1( xmm_sLTP_shp_Q14_x2x0 = _mm_blend_epi16( xmm_sLTP_shp_Q14_x2x0, xmm_sLTP_shp_Q14_x3x1, 0xCC ); - _mm_storeu_si128( (__m128i *)(&(NSQ->sLTP_shp_Q14[ i ] ) ), xmm_sLTP_shp_Q14_x2x0 ); + _mm_storeu_si128( (__m128i *)(void*)(&(NSQ->sLTP_shp_Q14[ i ] ) ), xmm_sLTP_shp_Q14_x2x0 ); } for( ; i < NSQ->sLTP_shp_buf_idx; i++ ) { diff --git a/media/libopus/silk/x86/NSQ_sse4_1.c b/media/libopus/silk/x86/NSQ_sse4_1.c index d5ae1d3b1c..3c9aca7ba1 100644 --- a/media/libopus/silk/x86/NSQ_sse4_1.c +++ b/media/libopus/silk/x86/NSQ_sse4_1.c @@ -77,7 +77,7 @@ void silk_NSQ_sse4_1( SideInfoIndices *psIndices, /* I/O Quantization Indices */ const opus_int16 x16[], /* I Input */ opus_int8 pulses[], /* O Quantized pulse signal */ - const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefs */ + const opus_int16 *PredCoef_Q12, /* I Short term prediction coefs */ const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefs */ const opus_int16 AR_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs */ const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I Long term shaping coefs */ @@ -338,21 +338,21 @@ static OPUS_INLINE void silk_noise_shape_quantizer_10_16_sse4_1( xmm_one = _mm_set_epi8( 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 ); /* load a_Q12[0] - a_Q12[7] */ - a_Q12_01234567 = _mm_loadu_si128( (__m128i *)(&a_Q12[ 0 ] ) ); + a_Q12_01234567 = _mm_loadu_si128( (__m128i *)(void*)(&a_Q12[ 0 ] ) ); /* load a_Q12[ 8 ] - a_Q12[ 15 ] */ - a_Q12_89ABCDEF = _mm_loadu_si128( (__m128i *)(&a_Q12[ 8 ] ) ); + a_Q12_89ABCDEF = _mm_loadu_si128( (__m128i *)(void*)(&a_Q12[ 8 ] ) ); a_Q12_01234567 = _mm_shuffle_epi8( a_Q12_01234567, xmm_one ); a_Q12_89ABCDEF = _mm_shuffle_epi8( a_Q12_89ABCDEF, xmm_one ); /* load AR_shp_Q13 */ - AR_shp_Q13_76543210 = _mm_loadu_si128( (__m128i *)(&AR_shp_Q13[0] ) ); + AR_shp_Q13_76543210 = _mm_loadu_si128( (__m128i *)(void*)(&AR_shp_Q13[0] ) ); /* load psLPC_Q14 */ xmm_one = _mm_set_epi8(15, 14, 11, 10, 7, 6, 3, 2, 13, 12, 9, 8, 5, 4, 1, 0 ); - xmm_tempa = _mm_loadu_si128( (__m128i *)(&psLPC_Q14[-16]) ); - xmm_tempb = _mm_loadu_si128( (__m128i *)(&psLPC_Q14[-12]) ); + xmm_tempa = _mm_loadu_si128( (__m128i *)(void*)(&psLPC_Q14[-16]) ); + xmm_tempb = _mm_loadu_si128( (__m128i *)(void*)(&psLPC_Q14[-12]) ); xmm_tempa = _mm_shuffle_epi8( xmm_tempa, xmm_one ); xmm_tempb = _mm_shuffle_epi8( xmm_tempb, xmm_one ); @@ -360,8 +360,8 @@ static OPUS_INLINE void silk_noise_shape_quantizer_10_16_sse4_1( psLPC_Q14_hi_89ABCDEF = _mm_unpackhi_epi64( xmm_tempa, xmm_tempb ); psLPC_Q14_lo_89ABCDEF = _mm_unpacklo_epi64( xmm_tempa, xmm_tempb ); - xmm_tempa = _mm_loadu_si128( (__m128i *)(&psLPC_Q14[ -8 ]) ); - xmm_tempb = _mm_loadu_si128( (__m128i *)(&psLPC_Q14[ -4 ]) ); + xmm_tempa = _mm_loadu_si128( (__m128i *)(void*)(&psLPC_Q14[ -8 ]) ); + xmm_tempb = _mm_loadu_si128( (__m128i *)(void*)(&psLPC_Q14[ -4 ]) ); xmm_tempa = _mm_shuffle_epi8( xmm_tempa, xmm_one ); xmm_tempb = _mm_shuffle_epi8( xmm_tempb, xmm_one ); @@ -370,8 +370,8 @@ static OPUS_INLINE void silk_noise_shape_quantizer_10_16_sse4_1( psLPC_Q14_lo_01234567 = _mm_unpacklo_epi64( xmm_tempa, xmm_tempb ); /* load sAR2_Q14 */ - xmm_tempa = _mm_loadu_si128( (__m128i *)(&(NSQ->sAR2_Q14[ 0 ]) ) ); - xmm_tempb = _mm_loadu_si128( (__m128i *)(&(NSQ->sAR2_Q14[ 4 ]) ) ); + xmm_tempa = _mm_loadu_si128( (__m128i *)(void*)(&(NSQ->sAR2_Q14[ 0 ]) ) ); + xmm_tempb = _mm_loadu_si128( (__m128i *)(void*)(&(NSQ->sAR2_Q14[ 4 ]) ) ); xmm_tempa = _mm_shuffle_epi8( xmm_tempa, xmm_one ); xmm_tempb = _mm_shuffle_epi8( xmm_tempb, xmm_one ); @@ -443,7 +443,7 @@ static OPUS_INLINE void silk_noise_shape_quantizer_10_16_sse4_1( b_Q14_0123 = _mm_shuffle_epi32( b_Q14_3210, 0x1B ); /* loaded: [0] [-1] [-2] [-3] */ - pred_lag_ptr_0123 = _mm_loadu_si128( (__m128i *)(&pred_lag_ptr[ -3 ] ) ); + pred_lag_ptr_0123 = _mm_loadu_si128( (__m128i *)(void*)(&pred_lag_ptr[ -3 ] ) ); /* shuffle to [-3] [-2] [-1] [0] and to new xmm */ xmm_tempa = _mm_shuffle_epi32( pred_lag_ptr_0123, 0x1B ); /*64-bit multiply, a[2] * b[-2], a[0] * b[0] */ @@ -595,8 +595,8 @@ static OPUS_INLINE void silk_noise_shape_quantizer_10_16_sse4_1( /* write back sAR2_Q14 */ xmm_tempa = _mm_unpackhi_epi16( sAR2_Q14_lo_76543210, sAR2_Q14_hi_76543210 ); xmm_tempb = _mm_unpacklo_epi16( sAR2_Q14_lo_76543210, sAR2_Q14_hi_76543210 ); - _mm_storeu_si128( (__m128i *)(&NSQ->sAR2_Q14[ 4 ]), xmm_tempa ); - _mm_storeu_si128( (__m128i *)(&NSQ->sAR2_Q14[ 0 ]), xmm_tempb ); + _mm_storeu_si128( (__m128i *)(void*)(&NSQ->sAR2_Q14[ 4 ]), xmm_tempa ); + _mm_storeu_si128( (__m128i *)(void*)(&NSQ->sAR2_Q14[ 0 ]), xmm_tempb ); /* xq[ i ] = (opus_int16)silk_SAT16( silk_RSHIFT_ROUND( silk_SMULWW( psLPC_Q14[ i ], Gain_Q10 ), 8 ) ); */ { @@ -612,8 +612,8 @@ static OPUS_INLINE void silk_noise_shape_quantizer_10_16_sse4_1( /* process xq */ for (i = 0; i < length - 7; i += 8) { - xmm_xq_Q14_3210 = _mm_loadu_si128( (__m128i *)(&(psLPC_Q14[ i + 0 ] ) ) ); - xmm_xq_Q14_7654 = _mm_loadu_si128( (__m128i *)(&(psLPC_Q14[ i + 4 ] ) ) ); + xmm_xq_Q14_3210 = _mm_loadu_si128( (__m128i *)(void*)(&(psLPC_Q14[ i + 0 ] ) ) ); + xmm_xq_Q14_7654 = _mm_loadu_si128( (__m128i *)(void*)(&(psLPC_Q14[ i + 4 ] ) ) ); /* equal shift right 4 bytes*/ xmm_xq_Q14_x3x1 = _mm_shuffle_epi32( xmm_xq_Q14_3210, _MM_SHUFFLE( 0, 3, 2, 1 ) ); @@ -644,7 +644,7 @@ static OPUS_INLINE void silk_noise_shape_quantizer_10_16_sse4_1( xmm_xq_Q14_3210 = _mm_packs_epi32( xmm_xq_Q14_3210, xmm_xq_Q14_7654 ); /* save to xq */ - _mm_storeu_si128( (__m128i *)(&xq[ i ] ), xmm_xq_Q14_3210 ); + _mm_storeu_si128( (__m128i *)(void*)(&xq[ i ] ), xmm_xq_Q14_3210 ); } } for ( ; i < length; i++) @@ -698,7 +698,7 @@ static OPUS_INLINE void silk_nsq_scale_states_sse4_1( xmm_x16_x2x0 = _mm_blend_epi16( xmm_x16_x2x0, xmm_x16_x3x1, 0xCC ); - _mm_storeu_si128( (__m128i *)(&(x_sc_Q10[ i ] ) ), xmm_x16_x2x0 ); + _mm_storeu_si128( (__m128i *)(void*)(&(x_sc_Q10[ i ] ) ), xmm_x16_x2x0 ); } for( ; i < psEncC->subfr_length; i++ ) { @@ -729,7 +729,7 @@ static OPUS_INLINE void silk_nsq_scale_states_sse4_1( for( i = NSQ->sLTP_shp_buf_idx - psEncC->ltp_mem_length; i < NSQ->sLTP_shp_buf_idx - 3; i += 4 ) { - xmm_sLTP_shp_Q14_x2x0 = _mm_loadu_si128( (__m128i *)(&(NSQ->sLTP_shp_Q14[ i ] ) ) ); + xmm_sLTP_shp_Q14_x2x0 = _mm_loadu_si128( (__m128i *)(void*)(&(NSQ->sLTP_shp_Q14[ i ] ) ) ); /* equal shift right 4 bytes*/ xmm_sLTP_shp_Q14_x3x1 = _mm_shuffle_epi32( xmm_sLTP_shp_Q14_x2x0, _MM_SHUFFLE( 0, 3, 2, 1 ) ); @@ -741,7 +741,7 @@ static OPUS_INLINE void silk_nsq_scale_states_sse4_1( xmm_sLTP_shp_Q14_x2x0 = _mm_blend_epi16( xmm_sLTP_shp_Q14_x2x0, xmm_sLTP_shp_Q14_x3x1, 0xCC ); - _mm_storeu_si128( (__m128i *)(&(NSQ->sLTP_shp_Q14[ i ] ) ), xmm_sLTP_shp_Q14_x2x0 ); + _mm_storeu_si128( (__m128i *)(void*)(&(NSQ->sLTP_shp_Q14[ i ] ) ), xmm_sLTP_shp_Q14_x2x0 ); } for( ; i < NSQ->sLTP_shp_buf_idx; i++ ) { diff --git a/media/libopus/silk/x86/VAD_sse4_1.c b/media/libopus/silk/x86/VAD_sse4_1.c index e7eaf9714a..9e06bc79d0 100644 --- a/media/libopus/silk/x86/VAD_sse4_1.c +++ b/media/libopus/silk/x86/VAD_sse4_1.c @@ -144,7 +144,7 @@ opus_int silk_VAD_GetSA_Q8_sse4_1( /* O Return value, 0 if s for( i = 0; i < dec_subframe_length - 7; i += 8 ) { - xmm_X = _mm_loadu_si128( (__m128i *)&(X[ X_offset[ b ] + i + dec_subframe_offset ] ) ); + xmm_X = _mm_loadu_si128( (__m128i *)(void*)&(X[ X_offset[ b ] + i + dec_subframe_offset ] ) ); xmm_X = _mm_srai_epi16( xmm_X, 3 ); xmm_X = _mm_madd_epi16( xmm_X, xmm_X ); xmm_acc = _mm_add_epi32( xmm_acc, xmm_X ); diff --git a/media/libopus/silk/x86/VQ_WMat_EC_sse4_1.c b/media/libopus/silk/x86/VQ_WMat_EC_sse4_1.c index 2c7d18d05e..df4626b60a 100644 --- a/media/libopus/silk/x86/VQ_WMat_EC_sse4_1.c +++ b/media/libopus/silk/x86/VQ_WMat_EC_sse4_1.c @@ -65,7 +65,7 @@ void silk_VQ_WMat_EC_sse4_1( neg_xX_Q24[ 3 ] = -silk_LSHIFT32( xX_Q17[ 3 ], 7 ); neg_xX_Q24[ 4 ] = -silk_LSHIFT32( xX_Q17[ 4 ], 7 ); - v_XX_31_Q17 = _mm_loadu_si128( (__m128i *)(&XX_Q17[ 1 ] ) ); + v_XX_31_Q17 = _mm_loadu_si128( (__m128i *)(void*)(&XX_Q17[ 1 ] ) ); v_XX_42_Q17 = _mm_shuffle_epi32( v_XX_31_Q17, _MM_SHUFFLE( 0, 3, 2, 1 ) ); /* Loop over codebook */ diff --git a/media/libopus/silk/x86/main_sse.h b/media/libopus/silk/x86/main_sse.h index a01d7f6c75..b254d53e7a 100644 --- a/media/libopus/silk/x86/main_sse.h +++ b/media/libopus/silk/x86/main_sse.h @@ -88,7 +88,7 @@ void silk_NSQ_sse4_1( SideInfoIndices *psIndices, /* I/O Quantization Indices */ const opus_int16 x16[], /* I Input */ opus_int8 pulses[], /* O Quantized pulse signal */ - const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefs */ + const opus_int16 *PredCoef_Q12, /* I Short term prediction coefs */ const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefs */ const opus_int16 AR_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs */ const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I Long term shaping coefs */ @@ -116,7 +116,7 @@ extern void (*const SILK_NSQ_IMPL[OPUS_ARCHMASK + 1])( SideInfoIndices *psIndices, /* I/O Quantization Indices */ const opus_int16 x16[], /* I Input */ opus_int8 pulses[], /* O Quantized pulse signal */ - const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefs */ + const opus_int16 *PredCoef_Q12, /* I Short term prediction coefs */ const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefs */ const opus_int16 AR_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs */ const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I Long term shaping coefs */ @@ -142,7 +142,7 @@ void silk_NSQ_del_dec_sse4_1( SideInfoIndices *psIndices, /* I/O Quantization Indices */ const opus_int16 x16[], /* I Input */ opus_int8 pulses[], /* O Quantized pulse signal */ - const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefs */ + const opus_int16 *PredCoef_Q12, /* I Short term prediction coefs */ const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefs */ const opus_int16 AR_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs */ const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I Long term shaping coefs */ @@ -154,7 +154,33 @@ void silk_NSQ_del_dec_sse4_1( const opus_int LTP_scale_Q14 /* I LTP state scaling */ ); -# if defined OPUS_X86_PRESUME_SSE4_1 +void silk_NSQ_del_dec_avx2( + const silk_encoder_state *psEncC, /* I Encoder State */ + silk_nsq_state *NSQ, /* I/O NSQ state */ + SideInfoIndices *psIndices, /* I/O Quantization Indices */ + const opus_int16 x16[], /* I Input */ + opus_int8 pulses[], /* O Quantized pulse signal */ + const opus_int16 *PredCoef_Q12, /* I Short term prediction coefs */ + const opus_int16 LTPCoef_Q14[LTP_ORDER * MAX_NB_SUBFR], /* I Long term prediction coefs */ + const opus_int16 AR_Q13[MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER], /* I Noise shaping coefs */ + const opus_int HarmShapeGain_Q14[MAX_NB_SUBFR], /* I Long term shaping coefs */ + const opus_int Tilt_Q14[MAX_NB_SUBFR], /* I Spectral tilt */ + const opus_int32 LF_shp_Q14[MAX_NB_SUBFR], /* I Low frequency shaping coefs */ + const opus_int32 Gains_Q16[MAX_NB_SUBFR], /* I Quantization step sizes */ + const opus_int32 pitchL[MAX_NB_SUBFR], /* I Pitch lags */ + const opus_int Lambda_Q10, /* I Rate/distortion tradeoff */ + const opus_int LTP_scale_Q14 /* I LTP state scaling */ +); + +# if defined (OPUS_X86_PRESUME_AVX2) + +# define OVERRIDE_silk_NSQ_del_dec +# define silk_NSQ_del_dec(psEncC, NSQ, psIndices, x16, pulses, PredCoef_Q12, LTPCoef_Q14, AR_Q13, \ + HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, pitchL, Lambda_Q10, LTP_scale_Q14, arch) \ + ((void)(arch),silk_NSQ_del_dec_avx2(psEncC, NSQ, psIndices, x16, pulses, PredCoef_Q12, LTPCoef_Q14, AR_Q13, \ + HarmShapeGain_Q14, Tilt_Q14, LF_shp_Q14, Gains_Q16, pitchL, Lambda_Q10, LTP_scale_Q14)) + +# elif defined (OPUS_X86_PRESUME_SSE4_1) && !defined(OPUS_X86_MAY_HAVE_AVX2) # define OVERRIDE_silk_NSQ_del_dec # define silk_NSQ_del_dec(psEncC, NSQ, psIndices, x16, pulses, PredCoef_Q12, LTPCoef_Q14, AR_Q13, \ @@ -170,7 +196,7 @@ extern void (*const SILK_NSQ_DEL_DEC_IMPL[OPUS_ARCHMASK + 1])( SideInfoIndices *psIndices, /* I/O Quantization Indices */ const opus_int16 x16[], /* I Input */ opus_int8 pulses[], /* O Quantized pulse signal */ - const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefs */ + const opus_int16 *PredCoef_Q12, /* I Short term prediction coefs */ const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefs */ const opus_int16 AR_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs */ const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I Long term shaping coefs */ @@ -243,5 +269,31 @@ extern opus_int (*const SILK_VAD_GETSA_Q8_IMPL[OPUS_ARCHMASK + 1])( # endif +#ifndef FIXED_POINT +double silk_inner_product_FLP_avx2( + const silk_float *data1, + const silk_float *data2, + opus_int dataSize +); + +#if defined (OPUS_X86_PRESUME_AVX2) + +#define OVERRIDE_inner_product_FLP +#define silk_inner_product_FLP(data1, data2, dataSize, arch) ((void)arch,silk_inner_product_FLP_avx2(data1, data2, dataSize)) + +#elif defined(OPUS_HAVE_RTCD) && defined(OPUS_X86_MAY_HAVE_AVX2) + +#define OVERRIDE_inner_product_FLP +extern double (*const SILK_INNER_PRODUCT_FLP_IMPL[OPUS_ARCHMASK + 1])( + const silk_float *data1, + const silk_float *data2, + opus_int dataSize +); + +#define silk_inner_product_FLP(data1, data2, dataSize, arch) ((void)arch,(*SILK_INNER_PRODUCT_FLP_IMPL[(arch) & OPUS_ARCHMASK])(data1, data2, dataSize)) + +#endif +#endif + # endif #endif diff --git a/media/libopus/silk/x86/x86_silk_map.c b/media/libopus/silk/x86/x86_silk_map.c index 70f60078cf..39ad75276c 100644 --- a/media/libopus/silk/x86/x86_silk_map.c +++ b/media/libopus/silk/x86/x86_silk_map.c @@ -32,10 +32,13 @@ #include "celt/x86/x86cpu.h" #include "structs.h" #include "SigProc_FIX.h" +#ifndef FIXED_POINT +#include "SigProc_FLP.h" +#endif #include "pitch.h" #include "main.h" -#if defined(OPUS_HAVE_RTCD) && !defined(OPUS_X86_PRESUME_SSE4_1) +#if defined(OPUS_HAVE_RTCD) && !defined(OPUS_X86_PRESUME_AVX2) #if defined(FIXED_POINT) @@ -72,7 +75,7 @@ void (*const SILK_NSQ_IMPL[ OPUS_ARCHMASK + 1 ] )( SideInfoIndices *psIndices, /* I/O Quantization Indices */ const opus_int16 x16[], /* I Input */ opus_int8 pulses[], /* O Quantized pulse signal */ - const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefs */ + const opus_int16 *PredCoef_Q12, /* I Short term prediction coefs */ const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefs */ const opus_int16 AR_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs */ const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I Long term shaping coefs */ @@ -117,7 +120,7 @@ void (*const SILK_NSQ_DEL_DEC_IMPL[ OPUS_ARCHMASK + 1 ] )( SideInfoIndices *psIndices, /* I/O Quantization Indices */ const opus_int16 x16[], /* I Input */ opus_int8 pulses[], /* O Quantized pulse signal */ - const opus_int16 PredCoef_Q12[ 2 * MAX_LPC_ORDER ], /* I Short term prediction coefs */ + const opus_int16 *PredCoef_Q12, /* I Short term prediction coefs */ const opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ], /* I Long term prediction coefs */ const opus_int16 AR_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ], /* I Noise shaping coefs */ const opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ], /* I Long term shaping coefs */ @@ -132,7 +135,7 @@ void (*const SILK_NSQ_DEL_DEC_IMPL[ OPUS_ARCHMASK + 1 ] )( silk_NSQ_del_dec_c, silk_NSQ_del_dec_c, MAY_HAVE_SSE4_1( silk_NSQ_del_dec ), /* sse4.1 */ - MAY_HAVE_SSE4_1( silk_NSQ_del_dec ) /* avx */ + MAY_HAVE_AVX2( silk_NSQ_del_dec ) /* avx */ }; #if defined(FIXED_POINT) @@ -156,4 +159,21 @@ void (*const SILK_BURG_MODIFIED_IMPL[ OPUS_ARCHMASK + 1 ] )( }; #endif + +#ifndef FIXED_POINT + +double (*const SILK_INNER_PRODUCT_FLP_IMPL[ OPUS_ARCHMASK + 1 ] )( + const silk_float *data1, + const silk_float *data2, + opus_int dataSize +) = { + silk_inner_product_FLP_c, /* non-sse */ + silk_inner_product_FLP_c, + silk_inner_product_FLP_c, + silk_inner_product_FLP_c, /* sse4.1 */ + MAY_HAVE_AVX2( silk_inner_product_FLP ) /* avx */ +}; + +#endif + #endif diff --git a/media/libopus/sources.mozbuild b/media/libopus/sources.mozbuild index 891f5b32ae..1a480a0783 100644 --- a/media/libopus/sources.mozbuild +++ b/media/libopus/sources.mozbuild @@ -47,6 +47,10 @@ celt_sources_sse4_1 = [ 'celt/x86/pitch_sse4_1.c', ] +celt_sources_avx2 = [ + 'celt/x86/pitch_avx.c', +] + celt_sources_arm_rtcd = [ 'celt/arm/arm_celt_map.c', 'celt/arm/armcpu.c', @@ -71,6 +75,7 @@ celt_sources_arm_ne10 = [ ] opus_sources = [ + 'src/extensions.c', 'src/opus.c', 'src/opus_decoder.c', 'src/opus_encoder.c', @@ -174,6 +179,10 @@ silk_sources_sse4_1 = [ 'silk/x86/VQ_WMat_EC_sse4_1.c', ] +silk_sources_avx2 = [ + 'silk/x86/NSQ_del_dec_avx2.c', +] + silk_sources_arm_rtcd = [ 'silk/arm/arm_silk_map.c', ] @@ -249,3 +258,7 @@ silk_sources_float = [ 'silk/float/wrappers_FLP.c', ] +silk_sources_float_avx2 = [ + 'silk/float/x86/inner_product_FLP_avx2.c', +] + diff --git a/media/libopus/src/analysis.c b/media/libopus/src/analysis.c index 058328f0fd..1f58013812 100644 --- a/media/libopus/src/analysis.c +++ b/media/libopus/src/analysis.c @@ -929,9 +929,9 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt features[23] = info->tonality_slope + 0.069216f; features[24] = tonal->lowECount - 0.067930f; - compute_dense(&layer0, layer_out, features); - compute_gru(&layer1, tonal->rnn_state, layer_out); - compute_dense(&layer2, frame_probs, tonal->rnn_state); + analysis_compute_dense(&layer0, layer_out, features); + analysis_compute_gru(&layer1, tonal->rnn_state, layer_out); + analysis_compute_dense(&layer2, frame_probs, tonal->rnn_state); /* Probability of speech or music vs noise */ info->activity_probability = frame_probs[1]; diff --git a/media/libopus/src/extensions.c b/media/libopus/src/extensions.c new file mode 100644 index 0000000000..bb6c0b0268 --- /dev/null +++ b/media/libopus/src/extensions.c @@ -0,0 +1,315 @@ +/* Copyright (c) 2022 Amazon */ +/* + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + + +#include "opus_types.h" +#include "opus_defines.h" +#include "arch.h" +#include "os_support.h" +#include "opus_private.h" + + +/* Given an extension payload, advance data to the next extension and return the + length of the remaining extensions. */ +opus_int32 skip_extension(const unsigned char **data, opus_int32 len, opus_int32 *header_size) +{ + int id, L; + if (len==0) + return 0; + id = **data>>1; + L = **data&1; + if (id == 0 && L == 1) + { + *header_size = 1; + if (len < 1) + return -1; + (*data)++; + len--; + return len; + } else if (id > 0 && id < 32) + { + if (len < 1+L) + return -1; + *data += 1+L; + len -= 1+L; + *header_size = 1; + return len; + } else { + if (L==0) + { + *data += len; + *header_size = 1; + return 0; + } else { + opus_int32 bytes=0; + *header_size = 1; + do { + (*data)++; + len--; + if (len == 0) + return -1; + bytes += **data; + (*header_size)++; + } while (**data == 255); + (*data)++; + len--; + if (bytes <= len) + { + len -= bytes; + *data += bytes; + } else { + return -1; + } + return len; + } + } +} + +/* Count the number of extensions, excluding real padding and separators. */ +opus_int32 opus_packet_extensions_count(const unsigned char *data, opus_int32 len) +{ + opus_int32 curr_len; + opus_int32 count=0; + const unsigned char *curr_data = data; + + celt_assert(len >= 0); + celt_assert(data != NULL || len == 0); + + curr_len = len; + while (curr_len > 0) + { + int id; + opus_int32 header_size; + id = *curr_data>>1; + curr_len = skip_extension(&curr_data, curr_len, &header_size); + if (curr_len < 0) + return OPUS_INVALID_PACKET; + if (id > 1) + count++; + } + return count; +} + +/* Extract extensions from Opus padding (excluding real padding and separators) */ +opus_int32 opus_packet_extensions_parse(const unsigned char *data, opus_int32 len, opus_extension_data *extensions, opus_int32 *nb_extensions) +{ + const unsigned char *curr_data; + opus_int32 curr_len; + int curr_frame=0; + opus_int32 count=0; + + celt_assert(len >= 0); + celt_assert(data != NULL || len == 0); + celt_assert(nb_extensions != NULL); + celt_assert(extensions != NULL || *nb_extensions == 0); + + curr_data = data; + curr_len = len; + while (curr_len > 0) + { + int id; + opus_int32 header_size; + opus_extension_data curr_ext; + id = *curr_data>>1; + if (id > 1) + { + curr_ext.id = id; + curr_ext.frame = curr_frame; + curr_ext.data = curr_data; + } else if (id == 1) + { + int L = *curr_data&1; + if (L==0) + curr_frame++; + else { + if (curr_len >= 2) + curr_frame += curr_data[1]; + /* Else we're at the end and it doesn't matter. */ + } + if (curr_frame >= 48) + { + *nb_extensions = count; + return OPUS_INVALID_PACKET; + } + } + curr_len = skip_extension(&curr_data, curr_len, &header_size); + /* printf("curr_len = %d, header_size = %d\n", curr_len, header_size); */ + if (curr_len < 0) + { + *nb_extensions = count; + return OPUS_INVALID_PACKET; + } + celt_assert(curr_data - data == len - curr_len); + if (id > 1) + { + if (count == *nb_extensions) + { + return OPUS_BUFFER_TOO_SMALL; + } + curr_ext.len = curr_data - curr_ext.data - header_size; + curr_ext.data += header_size; + extensions[count++] = curr_ext; + } + } + celt_assert(curr_len == 0); + *nb_extensions = count; + return OPUS_OK; +} + +opus_int32 opus_packet_extensions_generate(unsigned char *data, opus_int32 len, const opus_extension_data *extensions, opus_int32 nb_extensions, int pad) +{ + int max_frame=0; + opus_int32 i; + int frame; + int curr_frame = 0; + opus_int32 pos = 0; + opus_int32 written = 0; + + celt_assert(len >= 0); + + for (i=0;i<nb_extensions;i++) + { + max_frame = IMAX(max_frame, extensions[i].frame); + if (extensions[i].id < 2 || extensions[i].id > 127) + return OPUS_BAD_ARG; + } + if (max_frame >= 48) return OPUS_BAD_ARG; + for (frame=0;frame<=max_frame;frame++) + { + for (i=0;i<nb_extensions;i++) + { + if (extensions[i].frame == frame) + { + /* Insert separator when needed. */ + if (frame != curr_frame) { + int diff = frame - curr_frame; + if (len-pos < 2) + return OPUS_BUFFER_TOO_SMALL; + if (diff == 1) { + if (data) data[pos] = 0x02; + pos++; + } else { + if (data) data[pos] = 0x03; + pos++; + if (data) data[pos] = diff; + pos++; + } + curr_frame = frame; + } + if (extensions[i].id < 32) + { + if (extensions[i].len < 0 || extensions[i].len > 1) + return OPUS_BAD_ARG; + if (len-pos < extensions[i].len+1) + return OPUS_BUFFER_TOO_SMALL; + if (data) data[pos] = (extensions[i].id<<1) + extensions[i].len; + pos++; + if (extensions[i].len > 0) { + if (data) data[pos] = extensions[i].data[0]; + pos++; + } + } else { + int last; + opus_int32 length_bytes; + if (extensions[i].len < 0) + return OPUS_BAD_ARG; + last = (written == nb_extensions - 1); + length_bytes = 1 + extensions[i].len/255; + if (last) + length_bytes = 0; + if (len-pos < 1 + length_bytes + extensions[i].len) + return OPUS_BUFFER_TOO_SMALL; + if (data) data[pos] = (extensions[i].id<<1) + !last; + pos++; + if (!last) + { + opus_int32 j; + for (j=0;j<extensions[i].len/255;j++) { + if (data) data[pos] = 255; + pos++; + } + if (data) data[pos] = extensions[i].len % 255; + pos++; + } + if (data) OPUS_COPY(&data[pos], extensions[i].data, extensions[i].len); + pos += extensions[i].len; + } + written++; + } + } + } + /* If we need to pad, just prepend 0x01 bytes. Even better would be to fill the + end with zeros, but that requires checking that turning the last extesion into + an L=1 case still fits. */ + if (pad && pos < len) + { + opus_int32 padding = len - pos; + if (data) { + OPUS_MOVE(data+padding, data, pos); + for (i=0;i<padding;i++) + data[i] = 0x01; + } + pos += padding; + } + return pos; +} + +#if 0 +#include <stdio.h> +int main() +{ + opus_extension_data ext[] = {{2, 0, (const unsigned char *)"a", 1}, + {32, 10, (const unsigned char *)"DRED", 4}, + {33, 1, (const unsigned char *)"NOT DRED", 8}, + {3, 4, (const unsigned char *)NULL, 0} + }; + opus_extension_data ext2[10]; + int i, len; + int nb_ext = 10; + unsigned char packet[10000]; + len = opus_packet_extensions_generate(packet, 32, ext, 4, 1); + for (i=0;i<len;i++) + { + printf("%#04x ", packet[i]); + if (i%16 == 15) + printf("\n"); + } + printf("\n"); + printf("count = %d\n", opus_packet_extensions_count(packet, len)); + opus_packet_extensions_parse(packet, len, ext2, &nb_ext); + for (i=0;i<nb_ext;i++) + { + int j; + printf("%d %d {", ext2[i].id, ext2[i].frame); + for (j=0;j<ext2[i].len;j++) printf("%#04x ", ext2[i].data[j]); + printf("} %d\n", ext2[i].len); + } +} +#endif diff --git a/media/libopus/src/mapping_matrix.c b/media/libopus/src/mapping_matrix.c index 31298af057..3f78ab5990 100644 --- a/media/libopus/src/mapping_matrix.c +++ b/media/libopus/src/mapping_matrix.c @@ -302,6 +302,287 @@ const opus_int16 mapping_matrix_toa_mixing_data[324] = { 0, 0, 0, 32767 }; +const MappingMatrix mapping_matrix_fourthoa_mixing = { 27, 27, 0 }; +const opus_int16 mapping_matrix_fourthoa_mixing_data[729] = { + 9243, 0, 16010, 0, 0, 0, 20669, 0, + 0, 0, 0, 0, 24456, 0, 0, 0, + 0, 0, 0, 0, 27731, 0, 0, 0, + 0, 0, 0, 9243, 0, 10884, 11741, 0, + 0, 3995, 17849, 9626, 0, 0, 0, -5727, + 14399, 17315, 7625, 0, 0, 0, 0, -11747, + 2574, 18637, 15552, 5930, 0, 0, 9243, -14302, + -2682, -6677, 13337, 5357, -9464, 2501, -11170, 4770, + -5911, 11501, 5858, 5369, 4951, 17901, -19071, -2397, + -9281, -9198, 7576, -4294, 7773, -8997, -3399, 0, + 0, 9243, 9940, 11991, -3705, -5144, 16647, 7057, + -6206, -5941, -2698, -10194, 16781, -1788, -6256, -11772, + 4935, 3912, -6062, -13039, 9446, -9758, -3521, -15058, + 11089, 565, 0, 0, 9243, -15376, 3720, 2461, + -5285, -7989, -8660, 1278, -16087, 15811, -3249, 10500, + -7757, -1680, -9890, -8153, 10884, 11022, 2847, 12828, + 5137, -2053, 8666, -5684, 14776, 0, 0, 9243, + -10577, 10304, -6186, 9139, -15222, 2507, -8902, -5140, + -145, 15562, -10596, -7311, -6197, -8753, 8667, -6014, + -281, 15033, 938, -11859, 548, -8456, 16735, -3654, + 0, 0, 9243, 8974, 4839, -12343, -15472, 6066, + -7501, -8343, 5015, 15920, -12374, -4559, -9400, 6271, + 4011, 5191, -9932, 14438, 4828, -8768, 1909, 12059, + -1565, 4707, -13711, 0, 0, 9243, 15799, 2085, + -1534, -3386, 4602, -9808, -447, -17267, -18054, -1167, + -13525, -4644, 1313, -5951, 5397, 7485, -7056, 2584, + -8120, 8669, 788, 13177, 2109, 18349, 0, 0, + 9243, 12371, -10036, 1597, 2760, -17341, 1848, -2239, + -10509, -8474, -4577, 11164, 7935, 1441, 17430, -3436, + -3713, 15936, 4184, 2647, -11730, 341, -15934, 6462, + 6581, 0, 0, 9243, -8963, 2184, 13084, -16381, + -2734, -9757, 3991, 6345, -18297, -5912, 7604, -4849, + -11100, 2290, -4304, -13305, -7488, 12338, 4805, 8505, + -7014, -4779, -1761, -14597, 0, 0, 9243, 1301, + -15498, 3799, 690, -2816, 18718, -8223, 889, 255, + -1768, 4485, -19951, 13097, -2278, 167, 78, -740, + 3324, -6139, 19488, -17925, 4283, -486, 20, 0, + 0, 9243, -13470, -6719, 5452, -10257, 12641, -4873, + -5116, -10595, 5856, 11389, 1502, 10876, -608, 11765, + -13218, 13911, -7373, -2070, -13679, -4154, 5536, -2138, + 16643, 451, 0, 0, 9243, 2455, -3679, -15387, + -5277, -1261, -8697, 7906, 16112, 8147, 3208, -1690, + 7687, 10593, -9796, -15852, -10884, -5616, 2881, 2032, + 5246, -12735, -8796, 10928, 14833, 0, 0, 9243, + -6849, 2775, -14202, 13586, -2655, -9402, -5505, 10809, + -18013, 6231, 5444, -6041, 11288, 4958, -4078, 18799, + -9368, -9291, 4535, 7383, 9405, -7391, -2121, -4336, + 0, 0, 9243, 6423, -9040, 11548, 10359, -8109, + -450, -14580, 6431, 10857, -15475, 3569, 9707, 6416, + -9607, 521, 8528, -18391, 11049, 3815, -10423, 6860, + 6860, -883, -4221, 0, 0, 9243, 11932, -5968, + -8850, -14749, -9946, -6026, 7377, -4472, 5206, 14547, + -3406, 10508, 2526, 4411, 14543, 8444, -5822, 347, + 12347, -1709, -9158, 105, -16265, -12642, 0, 0, + 9243, 13044, -150, 9282, 16910, -274, -10332, -194, + -5864, 5428, -420, -12196, 344, -8679, 145, -18554, + -12695, -152, -14635, 503, 10389, 358, 5076, 522, + -16100, 0, 0, 9243, -8374, -13590, -1221, 1428, + 15896, 12005, 2318, -4793, 2590, -3209, -20390, -6256, + -2974, 10766, 1202, -876, -6597, 5004, 19896, -1541, + 2902, -16788, -3062, 1340, 0, 0, 9243, 9879, + 10267, 7300, 10073, 14167, 2416, 10469, -3094, 2899, + 17092, 9762, -7400, 7214, -5250, -8238, -3989, 5578, + 16392, -1050, -11848, -776, -5034, -15850, -5882, 0, + 0, 9243, -4974, -9068, 12221, -8490, 6299, -388, + -15478, 8702, -9920, 12723, -2810, 9668, 6905, -13040, + 4325, -9456, 16856, -9159, -2909, -10476, 7149, 9387, + -7350, 233, 0, 0, 9243, 3627, -13823, -7218, + -3656, -7002, 12776, 13935, 2719, 2446, 8352, 9252, + -7676, -18413, -6212, -429, -1272, -6335, -13356, -9510, + 295, 18926, 9934, 1112, -382, 0, 0, 9243, + -6383, -9343, -11326, 10097, 8329, 223, 14780, 6114, + -10348, -15590, -4195, 9257, -7445, -9439, -323, 7902, + 18117, 12101, -3142, -10944, -5577, 7327, 566, -4133, + 0, 0, 9243, 2626, 865, 15769, 5783, 317, + -10244, 1905, 16884, 9144, 826, -2420, -1972, -14536, + 2413, 16939, 12500, 1482, -4906, -578, 10096, -3476, + -14323, 2745, 16105, 0, 0, 9243, -8975, 12086, + 5450, -6832, -15149, 7333, 9200, -3550, -362, -13645, + -15525, -1391, 9428, -7091, -5442, 3105, -820, -17685, + -9175, -9462, 5572, -9191, -12325, -2180, 0, 0, + 9243, -114, 11576, -11058, 177, -185, 5875, -17880, + 8539, -198, 339, -173, -3411, -16698, 16336, -6369, + 193, -430, 408, -75, -10806, -7225, 19670, -13817, + 4665, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 32767, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 32767 +}; + +const MappingMatrix mapping_matrix_fifthoa_mixing = { 38, 38, 0 }; +const opus_int16 mapping_matrix_fifthoa_mixing_data[1444] = { + 9243, 0, 16010, 0, 0, 0, 20669, 0, + 0, 0, 0, 0, 24456, 0, 0, 0, + 0, 0, 0, 0, 27731, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 30657, 0, + 0, 0, 0, 0, 0, 0, 9243, 0, + -7023, 14387, 0, 0, -4369, -14112, 14455, 0, + 0, 0, 10931, -510, -16777, 14031, 0, 0, + 0, 0, -5118, 14286, 4343, -18465, 13374, 0, + 0, 0, 0, 0, -6494, -12221, 11761, 8513, + -19458, 12605, 0, 0, 9243, -14128, 5093, 5547, + -10946, -10050, -7197, 3945, -11790, 7142, -9213, 6529, + -9701, -2563, -9923, -14846, 16521, 6816, 2764, 14103, + 1118, -5537, 2977, -14168, 1228, 4866, 17430, -528, + 10639, 2641, 10437, -1037, 11460, 1098, 1296, 15737, + 0, 0, 9243, 1128, -14775, 6062, 955, -2329, + 16069, -12511, 2477, 579, -2333, 3440, -14197, 18478, + -6050, 940, 303, -1604, 4106, -4223, 9829, -22688, + 10647, -2604, 334, 145, -927, 3203, -6017, 4507, + -3812, 24212, -15600, 5198, -1023, 110, 0, 0, + 9243, 1158, 12997, 9277, 1501, 2103, 10097, 16840, + 5916, 1402, 3225, 2488, 2929, 19916, 12706, 3585, + 1137, 3415, 4698, 2078, -5442, 16634, 18511, 8731, + 2095, 850, 3061, 5733, 5225, 960, -11728, 7689, + 20588, 14659, 5642, 1187, 0, 0, 9243, -4663, + -3081, -15003, 9771, 2007, -9185, 6457, 14199, -14357, + -4976, 3554, 6625, 11434, -7231, -11297, 17760, 8291, + -6267, -3368, 6712, -10837, -9107, 6524, 6793, -19531, + -11338, 7934, 7335, -2205, -9215, -7094, 10659, 6243, + -4337, -1250, 0, 0, 9243, -13515, 7679, -3831, + 7232, -14496, -3201, -4109, -11731, 8828, 9178, -1901, + -10848, -539, -14888, 9626, -10860, 12703, 3824, 12334, + -7104, 3496, -6203, 13852, 5461, -2109, -17277, 7837, + -4714, 13901, 4097, 3940, 7647, 8546, 8688, -10986, + 0, 0, 9243, 8113, -9860, 9657, 10943, -11174, + 1426, -13300, 1915, 8178, -17833, 6805, 8309, 8100, + -3121, -4742, 2683, -15111, 15688, 2358, -11590, 2807, + 2746, 8762, -7430, -2251, -5481, 16370, -4081, -9694, + 5872, -11539, -714, -9492, 15177, -6126, 0, 0, + 9243, 9933, -9215, -8528, -11831, -12785, -62, 10976, + -1811, 5593, 18018, 6100, 9455, -5237, 2758, 8971, + 2743, -9659, -13517, 5330, -10737, -4576, -2069, -15491, + -8749, -7226, -5237, 9191, -181, -12277, 2815, 10540, + -27, 14741, 16703, 3103, 0, 0, 9243, -10067, + -8881, -8723, 12265, 12487, -793, 10821, -1762, -6021, + -18002, -5072, 9912, -4395, 2587, 9368, -2767, 10021, + 12259, -6468, -10113, -5605, -1761, -15590, -9430, 7800, + 5092, -8835, 2293, 12314, 1222, 10671, -329, 13745, + 17349, 3563, 0, 0, 9243, -6485, 12991, -6743, + 6108, -11768, 10080, -12236, 238, -2883, 13115, -13907, + 2900, -14460, 511, 2564, 186, -7019, 19094, -11597, + -5472, -12058, 744, 6243, -2384, 930, 501, -11778, + 21214, -5330, -11746, -5542, 827, 10475, -6418, 1132, + 0, 0, 9243, 3862, 5238, -14627, -7891, 2826, + -7015, -10701, 13900, 11410, -6831, -1679, -9861, 6359, + 12032, -11660, -14041, 11199, 1713, -3895, 657, 14749, + -3017, -11445, 8380, 15575, -15236, -346, 7690, -923, + 10317, 3498, -13545, 354, 9093, -4476, 0, 0, + 9243, -8417, 13183, 3418, -4018, -15498, 10685, 6294, + -4132, 1419, -8755, -18818, 3926, 7642, -9001, -3235, + 2125, 3506, -13037, -16570, -4337, 6729, -13404, -7991, + 59, 443, 5804, 6005, -15011, -9060, -11044, 3679, + -15434, -13685, 161, 1185, 0, 0, 9243, -5288, + 6773, -13508, 9977, -5002, -4784, -12780, 10790, -12942, + 11168, 519, -10890, 1326, 12078, -6274, 13780, -16427, + 2186, 5352, -4328, 13671, 2364, -7963, 1080, -12568, + 19336, -6557, -8574, 4084, 7277, 10433, -9273, -3178, + 1516, 3817, 0, 0, 9243, 9660, 7817, 10093, + 13619, 10548, -2942, 11021, 597, 9663, 17594, 1736, + -10794, 1814, 771, -8469, 1041, 14155, 7891, -8597, + -7498, -8982, 346, -12407, -11848, -6809, 1686, 9181, + -8306, -10247, 3538, -10706, -364, -8047, -19188, -8493, + 0, 0, 9243, -7163, -1020, 14282, -14289, 1021, + -10208, -2036, 10660, -18919, 2410, 6564, 2323, -13088, + -1798, 3365, -19498, 3619, 12022, -1858, 9978, 3705, + -8969, -643, -5794, -15523, 4123, 15113, -3949, -6265, + -3596, 12490, 2946, -2688, 1225, -14570, 0, 0, + 9243, -12187, 772, -10354, 17623, -1314, -10262, -1117, + -2885, -9937, 2249, 11267, -1763, 9572, -368, 16506, + -6510, -1438, -15014, 2402, 10157, 2041, 2458, 2389, + -19346, 19860, -1041, 8067, -3704, -10931, 2743, -9286, + 606, -13399, -3095, 7924, 0, 0, 9243, 15545, + -2367, -3011, -6538, -5139, -9657, 995, -16242, -15706, + 2557, -12952, 5226, 2508, 6353, 10156, 13593, 6966, + 4795, 8960, 8183, -1735, 11914, -4504, 14149, 11727, + -6665, 10460, -3962, 10145, -7648, -1965, -9845, -6764, + -6938, -16633, 0, 0, 9243, 3098, 12983, -8841, + -3826, 5618, 10053, -16031, 4787, 3283, -8209, 6632, + 2856, -18922, 10272, -2055, -2344, 7987, -11939, 5516, + -5520, -15739, 14940, -5001, 530, 1465, -6306, 13388, + -13243, 2513, -11772, -7170, 16572, -8384, 1426, 168, + 0, 0, 9243, -15767, -2008, -1916, 4220, 4422, + -9846, 537, -17105, 17650, -1400, 13589, 4481, 1651, + 5677, 6701, -9241, -6642, -3252, -7827, 8792, -951, + 13182, -2522, 17586, -17005, 3845, -12562, 2213, -11472, + -6688, -1394, -8970, -4769, -7316, -11753, 0, 0, + 9243, -13344, -3829, 7975, -14863, 7136, -8561, -4265, + -7992, -801, 9405, 8912, 7937, -5326, 5057, -17681, + 15207, 575, 7717, -11360, 4847, 6789, 4150, 12686, + -10050, 16730, -12063, 322, -12920, -3313, -10267, 1980, + -6948, 7112, 7972, 8042, 0, 0, 9243, 7791, + -1021, 13949, 15180, -1111, -10208, -1989, 9348, 19199, + -2561, -7140, 2323, -12782, -1577, 817, 18164, -3673, + -12771, 2022, 9978, 3620, -7865, -156, -9155, 11924, + -3842, -15336, 4196, 6814, -3596, 12199, 2583, -652, + 1936, -17637, 0, 0, 9243, -4810, -15144, -1958, + 1315, 10175, 17406, 4142, -1348, 263, -3292, -15632, + -17046, -6363, 3374, 605, -227, -748, 5997, 20334, + 14481, 8277, -6146, -1717, 5, 27, 712, 1542, + -9197, -23572, -10163, -9595, 9425, 3539, -17, -72, + 0, 0, 9243, -7366, 8261, 11568, -11901, -8499, + -2079, 13347, 5556, -12049, -16247, -2282, -10529, 3584, + 7585, -1577, -8464, -18652, -8902, 5913, -8688, -9287, + 4156, -2442, -7089, -2993, -14485, -13949, 5422, 8459, + 1638, -13285, -2531, -1826, -12132, -9456, 0, 0, + 9243, 11716, 698, -10889, -17818, 1143, -10275, -1062, + -1305, 12057, -2057, -10855, -1595, 10088, -150, 15043, + 2978, 1578, 15225, -2090, 10201, 1943, 1115, 1969, + -20211, -17636, 430, -9826, 3391, 10572, 2485, -9826, + 248, -12259, -2924, 12131, 0, 0, 9243, 4361, + -4594, -14703, -8956, -2798, -7781, 9434, 13769, 12936, + 6800, -2400, 9082, 8091, -10453, -11023, -15786, -11136, + 3285, 4153, 2658, -14002, -5051, 9489, 7000, 17206, + 15024, -2777, -8491, -42, -10626, 141, 13053, 2366, + -6662, -2231, 0, 0, 9243, -752, -11933, -10646, + 1119, 1254, 6890, 17745, 7875, -1203, -2207, -1251, + 2024, -17706, -15532, -5600, 1128, 2691, 2800, 683, + -9927, 9661, 19706, 12522, 3889, -978, -2789, -3992, + -2440, 206, 12695, 2921, -17173, -18575, -9616, -2657, + 0, 0, 9243, 4791, -15001, -2887, -1931, -10037, + 16885, 6048, -1020, 46, 4789, 15191, -15922, -9154, + 2530, 823, 252, -130, -8608, -19335, 12613, 11651, + -4549, -2314, -172, -101, -784, 265, 12975, 21741, + -7551, -13101, 6856, 4710, 535, -46, 0, 0, + 9243, -12153, -10395, 754, -1281, 17644, 2735, -1095, + -10274, 8359, 2200, -12593, 7083, 782, 17650, -1573, + 1685, -16282, -2164, -530, -11878, 32, -17359, 3065, + 6651, -5212, -3628, 19365, 965, 13180, 8243, -818, + 7746, -3645, -14323, 1670, 0, 0, 9243, -6961, + -11198, 9081, -8829, 10887, 4833, -14202, 2374, -6524, + 16339, -9417, 4737, 12284, -4394, -2691, -2683, 13690, + -18539, 2830, -11438, -3692, 4985, 5648, -4628, 514, + 6225, -18409, 12672, 5311, 11170, -6928, -3407, -7595, + 10737, -3977, 0, 0, 9243, 12099, -10405, 1294, + 2187, -17582, 2760, -1880, -10105, -8058, -3760, 12583, + 7058, 1346, 17376, -2667, -2829, 15710, 3705, 468, + -11880, 50, -17123, 5201, 6230, 4698, 6098, -18716, + -1665, -13088, 8285, -1400, 7696, -6196, -13429, 2770, + 0, 0, 9243, 8602, 13392, 1722, 2070, 16090, + 11359, 3222, -4960, -2638, 4581, 20106, 5099, 4026, + -10978, -1778, -1314, -6620, 6988, 18701, -2965, 3745, + -16745, -4461, 1300, 584, -3646, -11588, 8350, 11847, + -10050, 2372, -20010, -7809, 3608, 887, 0, 0, + 9243, 14252, -1958, 7026, 13986, -3899, -9870, -1922, + -10736, -3693, -4527, -12333, 4376, -6080, 3475, -18537, + -19222, 1355, -10843, 6913, 8869, 3408, 8323, 6804, + -5141, -13648, 7800, 2649, 7171, 10505, -6548, 5179, + -5505, 13299, 2086, 15579, 0, 0, 9243, 11323, + 9021, -6835, -10810, 14267, -489, -8613, -5689, 639, + -16117, 6224, -9731, -3757, -8482, 10882, 7873, 1080, + -11447, -6791, -10388, 4099, -6025, 18396, -5407, -7536, + 14714, 984, 1267, -13940, -1889, 8416, 666, 16762, + -10106, -3418, 0, 0, 9243, 871, 4833, 15238, + 1855, 588, -7508, 10287, 16162, 2857, 1481, -443, + -9392, -7758, 12910, 16506, 3837, 2588, -581, -851, + 1928, -14879, -5066, 14950, 16498, 4773, 3842, -425, + -1785, -82, 10578, -1435, -15554, -2459, 16520, 16250, + 0, 0, 9243, 14762, 5967, 1673, 3450, 12303, + -6027, 1394, -15022, -14571, 3402, -4217, -10507, -478, + -14813, -5131, -6634, -16293, -82, -15276, -1705, -1731, + 358, -5738, 13681, 12503, -8200, -3023, -3290, -7384, + 9272, -837, 14328, -1064, 16913, 7915, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 32767, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 32767 +}; + const MappingMatrix mapping_matrix_foa_demixing = { 6, 6, 0 }; const opus_int16 mapping_matrix_foa_demixing_data[36] = { 16384, 16384, 16384, 16384, 0, 0, 0, 23170, @@ -376,3 +657,283 @@ const opus_int16 mapping_matrix_toa_demixing_data[324] = { 0, 0, 0, 32767 }; +const MappingMatrix mapping_matrix_fourthoa_demixing = { 27, 27, 0 }; +const opus_int16 mapping_matrix_fourthoa_demixing_data[729] = { + 4870, 4484, 4870, 4347, 4440, 4726, 4683, 4821, + 4883, 4842, 4603, 4484, 4683, 4698, 4234, 4368, + 4603, 4783, 4783, 4820, 4821, 4347, 4820, 4440, + 4698, 0, 0, 101, 84, -7818, 4640, -7178, + -5492, 4629, 8384, 6547, -4966, 617, -6345, 1061, + -3241, 2939, 5549, 6390, -4434, 4994, -2610, 1993, + -2873, 1547, -4356, -164, 0, 0, 8797, 5074, + -1553, 5383, 1906, 5297, 2722, 1158, -5226, 1311, + -7760, -3327, -1940, 1586, -4093, -2951, -214, -6873, + 5450, -4875, -7193, -4438, 558, 5593, 5607, 0, + 0, -26, 5761, -3723, -1460, 1195, -3065, -6357, + -1175, 608, 6965, 2310, 2759, -8023, -7138, 5162, + -3624, 5006, -809, 3592, 6209, -4159, -4968, 8150, + 2513, -5702, 0, 0, 301, 109, 7161, -2462, + -2443, 5044, -7125, -2256, 1967, -9107, 259, -4928, + -2592, 6514, 4111, -7236, 8695, 635, 5009, -4025, + -1937, 4794, 3420, -3507, -400, 0, 0, -134, + 85, 2771, 7842, -3649, -8225, 2866, 2586, -9200, + -1945, -1563, 6155, -720, -1061, -3494, -4513, -487, + 8389, 7317, 3348, -3721, 3806, 371, -6896, 70, + 0, 0, 10919, 2072, -4867, 3472, -4429, 1721, + -4066, -5193, 1032, -5253, 9501, -2017, -3971, -5261, + -306, -2737, -5137, 5713, 1237, -8, 6387, 364, + -5423, 3364, 2888, 0, 0, -48, 8946, 1048, + -2691, 602, -4332, -4302, -514, -1730, 2459, -4328, + -2156, 3335, -2748, -6029, 4023, 155, 897, 5268, + -8380, 7625, 7395, 508, 3945, -8951, 0, 0, + 39, 4151, -5965, -3398, -7006, -3534, 2697, -8989, + -5237, 2913, 46, -5540, 8196, 5766, 2711, -2520, + -3043, -2146, -948, 4965, 1806, 2472, 8988, -1266, + 4840, 0, 0, -407, -189, 2179, -1627, 6516, + 259, 7196, -9449, -4905, -9766, 561, 4021, 3371, + -8650, 5032, 3329, 2534, 641, 2224, -5747, 1047, + -4074, 5252, -24, 674, 0, 0, 664, 237, + -2837, -4072, -1205, 8252, -5875, -1670, -2743, -3984, + 381, 5059, 1765, 2666, -8295, 7403, 1154, -2086, + 7622, 7105, 3677, -6943, 1050, -6632, -694, 0, + 0, 382, -133, 5699, 7650, 5154, -5713, -1645, + -6902, 6181, 4450, 1151, 410, -993, 3829, 2444, + -2405, -6618, -9514, 5366, -1896, 5844, -2886, -1524, + -7321, -1007, 0, 0, 12767, -2530, 3183, -1409, + -4015, -2894, -5155, -1710, 3841, -2107, -10274, 5119, + 3979, -4010, 5550, 4822, -746, -2507, -3080, 4289, + -3675, 4333, -1416, -1230, -1122, 0, 0, 17, + 8048, 2398, -2167, -73, -3606, 3125, 398, 731, + -5973, 5705, -1032, 4679, 7305, 3134, 1301, -3858, + -89, 2938, 4359, -9155, -4805, -8407, 3673, -8645, + 0, 0, 187, 7355, 3145, -6719, -4432, -5939, + 2541, -2810, 9723, 778, -1105, 5687, -4174, 2534, + -4461, 1017, -244, 5481, -1655, -6765, -3350, -4894, + 1592, -2318, 8827, 0, 0, 196, 3588, 9631, + 3063, -4564, 6043, 2683, 2595, -2488, -2186, 173, + -6059, -8270, -2386, 409, 7441, -8608, 376, -4364, + 2321, -280, 97, 8331, -3022, -4721, 0, 0, + 117, -748, -10833, 1533, 4200, -2875, -997, -109, + -3661, -6119, 4454, 8808, -9189, 8294, 1521, 7265, + -2348, -5094, -948, -5400, -3193, 8914, 5763, 1716, + -1070, 0, 0, 2497, 399, -5201, -2038, 7843, + -376, 7567, -5073, 7616, -5537, 2086, -3453, -5544, + -56, -11648, -1314, 3546, -3432, -117, 8694, -4245, + 9621, 3098, -2582, -2351, 0, 0, 4386, -3104, + -3132, -10512, 566, 5217, 5128, 4967, 1348, 7035, + -1470, 91, -125, -3548, 8244, -3029, -10033, 2186, + 9745, -6440, -2074, 3638, -1477, -7045, -562, 0, + 0, 2154, 8116, -6102, 6570, 12998, -712, -4126, + -4996, 30, 1571, -6393, -12794, 425, 5036, 1190, + 5763, 5653, 12933, -6671, 5197, -2964, -3316, -6354, + -10554, -2652, 0, 0, 12618, -3737, 93, -5901, + 4262, -3364, 4444, 3103, -2767, 3403, 4925, -2584, + -989, 4977, -3714, -1965, 3076, 326, -2946, -2568, + 1026, -2980, 3362, -6132, -5966, 0, 0, 6001, + 48, -1979, -7275, 3476, -2096, 10591, 3793, 2629, + -447, -14747, -3689, -5525, 8358, 6883, -9703, -4556, + 7471, 2965, 4056, 13221, -7327, -3073, -2353, -6720, + 0, 0, 621, 11034, -44, -2828, 5978, -1850, + -1772, 3894, -7471, -1397, 945, -2028, -2928, -2240, + 3172, 2222, 4544, -4243, -5645, 3745, 2573, 3511, + -8206, -7286, 5700, 0, 0, 321, 10818, -4982, + 7813, -749, 9907, 1360, -1443, 568, -1103, 2305, + 6045, 2270, -1063, -1920, -3073, 5893, -3476, -11346, + -1657, -588, 2957, -2287, -8527, -8041, 0, 0, + 119, -268, 2372, -3040, 4979, -3789, -5630, 10619, + 5900, -5109, -4585, -3862, 10467, -3527, -385, -10034, + -9991, 4860, 984, 2362, 2311, -6804, 6324, 433, + 5291, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 32767, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 32767 +}; + +const MappingMatrix mapping_matrix_fifthoa_demixing = { 38, 38, 0 }; +const opus_int16 mapping_matrix_fifthoa_demixing_data[1444] = { + 3188, 3247, 3268, 3368, 3368, 3138, 3268, 3099, + 3211, 3368, 3099, 3247, 3211, 3368, 3368, 3368, + 3149, 3268, 3247, 3211, 3099, 3188, 3138, 3149, + 3099, 3188, 3368, 3149, 3188, 3247, 3268, 3138, + 3211, 3368, 3138, 3149, 0, 0, 118, -47, + -5011, 282, 333, -1497, -4584, 2908, 3388, -3647, + -2493, 1139, -2882, -1719, 3604, -2543, -4328, 5443, + 1286, -5498, -4583, 2510, -1743, -2556, 4168, 1446, + -290, 1812, -4074, -2377, 4152, 2847, 4991, 3980, + 393, 5072, 0, 0, 5489, -2235, 1507, -5326, + 4609, -1096, 2926, -3427, -3301, -3078, 4226, 1730, + 4627, 2561, 2966, -592, 143, -677, 4617, -755, + -956, -433, -5138, 3037, 157, -1394, -4498, -4984, + -3661, -4112, -3756, 4628, -570, 3356, 1605, 1803, + 0, 0, -162, 5162, 2132, 2392, 3556, -5141, + -1536, 2975, -3001, -3350, -2231, -5230, 1294, -4965, + 3494, 5230, -3292, -1359, -2945, -773, 2670, 4867, + -660, 3720, -3415, -5112, -3700, -1211, 407, 3013, + 763, 591, 2481, -2657, 5210, 784, 0, 0, + -156, 338, -4246, 510, 462, 3296, 2846, 3333, + -4292, 4574, 1940, -2986, -1275, 3701, 5022, -5250, + 5780, -2676, -1180, 1516, -4852, 4877, 342, -3923, + -5703, -2920, 379, -657, -361, -3346, 1044, 795, + 5257, -4004, 698, 1115, 0, 0, 47, -140, + -3292, -1097, 652, 855, -5260, -3691, -4470, 4521, + -3863, 1093, -5552, -2016, 3831, 334, -456, -1532, + 2068, 1788, 2054, -295, 3668, -2820, 328, -994, + 295, -3301, 5770, 4282, -6353, 5632, -1371, 5005, + 238, 4041, 0, 0, 6764, -1659, -2730, 5726, + 3715, -3216, -933, 531, -52, -345, 3022, -2818, + 4005, -1617, -1189, -3748, -3403, -3592, 4040, -3553, + -2806, -3444, 6023, -711, -3298, -2503, 2548, 5564, + 940, 1848, 1207, 4010, -3488, -358, -2511, -1966, + 0, 0, -64, -5039, 1403, -4455, 6240, 2189, + -1716, -4348, 4183, 3951, -4042, -3606, 2399, -4563, + 4050, -612, -395, 348, -5791, 391, -1440, -735, + 1398, 4359, -518, 2969, 6556, 1951, -518, -4993, + -925, 998, -569, -2934, 3460, 420, 0, 0, + 16, 5482, -4122, 770, 2082, 5020, -3961, 485, + -584, -793, 3, 5222, -1416, 3673, 78, 3549, + -937, -5723, 1673, -6162, -2540, 3082, -355, 1838, + -615, 4601, 2832, -359, -3346, 668, -3393, -1583, + -3774, -2206, 5754, -4961, 0, 0, -328, 299, + 2470, 317, 525, -4494, 2805, 2617, 2383, -2363, + -1037, 4085, 895, -4622, 3218, -6607, -3381, -5933, + 1397, 6394, -446, 5694, 14, -4510, 4329, 3690, + -334, 0, 2932, -2478, -2944, -577, -599, -230, + 1553, -4736, 0, 0, -324, 142, -3252, -867, + 1111, -1882, 3378, -6055, 6502, -6840, 4280, -2694, + -2876, 4190, 6454, 655, 1061, 626, -2669, -798, + 3192, -985, -898, -5482, -548, 2315, -558, 1302, + 900, 5747, -1325, 1599, -1384, -5749, 624, 1110, + 0, 0, 321, 312, 2188, 1322, 237, 708, + -304, 2463, 1500, -1094, -5112, -1010, -6799, 646, + 992, 1969, 3423, -3996, 2628, 4451, 3432, -2833, + -6101, -330, -3768, -3, -707, 5961, -4037, -3736, + 4080, 7254, -4113, 2151, 54, -2150, 0, 0, + 7735, 4064, -3884, -5240, 577, 2229, -3947, 2914, + 3555, 4011, 774, -3519, 1985, -3701, -3824, 330, + -905, 2085, 1155, 2176, 3006, 340, -5533, -3264, + -902, 3114, 344, -5060, 1524, 1805, 1926, 2350, + 1905, -3203, -2762, -4162, 0, 0, 193, -151, + -1434, 6289, 7354, 4234, 169, 2868, -1977, -1375, + -4987, 2345, 2742, 599, 939, -4837, 2688, 991, + -6907, 716, -1542, -4346, -1833, 1493, 3134, 2903, + -7019, -2835, 93, 4395, 621, 870, -2357, -975, + -2933, -127, 0, 0, -616, -5968, -3479, -1651, + 4932, -2445, -5512, -1451, 691, 739, 479, 4227, + -2886, 3853, 8, -501, 188, 1990, 3842, 2270, + 1662, -174, 1290, 2456, 67, -3267, -5535, 483, + 5721, -1642, 6501, -3432, 1184, -3246, 4101, -4880, + 0, 0, -465, 5264, -4812, 682, 1683, -4539, + 2916, -1985, 2899, 3324, 1060, -4398, -745, -2137, + -3827, 1044, 6225, 3609, -532, 1980, -6001, 564, + -209, -1299, 5336, -3605, -1484, 37, 19, -1295, + -665, -385, -6773, 3651, 6153, -1291, 0, 0, + 193, -415, 5166, -110, 626, 6743, -2860, 1425, + 1101, -1341, 80, -4533, 249, 4231, -119, -6009, + -2970, 5170, -822, -2610, 4527, 5948, 182, -2589, + 837, -5471, 371, -43, 373, -665, -1233, -626, + -7353, 2606, 1339, -1398, 0, 0, -533, 147, + 2075, -672, 1043, 3503, 4402, -4971, -3287, 3731, + -2606, 3817, 1972, -5603, 5114, 1185, -1318, 1906, + 3018, -1999, 343, -1943, 207, -6744, 913, -4060, + 645, -349, -5667, 4766, 5575, -1733, 1116, 160, + 1534, -5690, 0, 0, -137, -36, 1556, 1325, + 1553, -2230, 1188, 5296, -5104, 4673, 6295, 498, + -4723, 933, 2994, 4067, -4700, 1758, -4116, -1252, + 2444, -4092, 1653, -2802, 5069, 1133, 790, -2355, + -934, -6304, 1642, 2045, -4259, -3873, -213, 215, + 0, 0, -364, 423, 4888, -1316, 118, -950, + 4027, 114, 2961, -3136, -3012, -883, -6192, 1340, + -3210, -1193, 1376, 3128, 1596, -2994, -3194, 533, + 8502, 2487, -1485, 1032, 301, -8007, -577, 887, + 297, 7778, 3121, -1901, -94, -6401, 0, 0, + 9260, -1845, 668, 2787, -2255, 2699, -2512, -3737, + -3675, -3601, -1803, 210, -1701, -1442, -2700, 3457, + 2868, 2079, -2113, 3178, 1277, 3578, 5240, -2482, + 3324, 1020, -4027, 3835, -3758, -3633, -3170, -1310, + 2509, -3110, 713, 174, 0, 0, -399, 4969, + -2321, -7744, 6494, -3776, 1478, 758, -1794, -2233, + -4059, 4932, 2770, 4761, -3475, 1243, 829, -651, + -5358, -436, 2381, 1360, 2561, -3118, 858, -4366, + 3933, 3646, -43, -1310, -16, 924, 1197, 1415, + -5036, -376, 0, 0, 100, 1410, 1290, 3199, + 7091, -3638, -2641, 1118, 45, -441, 794, -974, + -5033, 889, 438, -3102, 895, 3555, 4672, 4795, + 1129, -2408, -2153, 1742, 159, -2040, 7578, -2006, + -5737, 1986, -5568, -6413, 2428, -1387, -2441, 667, + 0, 0, -37, -6031, -4434, -904, 3290, 1806, + 4736, 2516, -5905, -5927, 1754, -4300, -2468, -2203, + -4836, -672, 1444, -1591, -1631, -1789, 4311, -153, + -688, -1222, 1058, 3139, 4659, -353, 1543, 1838, + 2180, -1448, 2432, 6277, 5304, -1692, 0, 0, + -280, 4506, 807, -477, 823, 3550, 1427, -1856, + -3003, -3501, -1203, 2679, 933, 778, -4954, -1977, + -7458, 4687, 435, 7045, -4053, -3130, 257, -3917, + -6165, 1889, 927, 235, 1889, -1097, 1985, 630, + -2172, -2130, 7080, 4810, 0, 0, -300, 496, + 2808, 279, 667, -7179, -2661, -526, -2832, 1751, + 2849, 4829, -906, -4151, -1124, -3062, 8166, 5361, + -1656, -6017, 3265, 2551, -864, -432, -6966, 6295, + -168, 901, 442, -582, 269, 236, -3574, 799, + 472, 565, 0, 0, 805, -2466, 6208, -4592, + -170, -6701, -5610, 3678, -4242, 4561, -724, -5534, + 2415, 7354, 2761, 2699, -349, 3822, -2372, 1756, + -5523, -3445, -588, -5749, -3986, 9804, -3871, 5375, + -2308, 5504, -2766, -1651, 1472, 6832, 2705, -5104, + 0, 0, -700, -1179, 4402, 400, 1383, 939, + -1342, 6013, 2577, -3472, 472, 2883, 1450, -3917, + 2849, 5084, 4990, 5392, 342, -4925, -3329, -5372, + -2674, -6035, -5072, -836, 179, 2506, 7987, -3647, + -8202, -1437, 1891, 2400, 1607, -3611, 0, 0, + -4706, -4003, 9928, -379, 5557, 3738, -8789, 685, + 1937, -5157, 13388, 7995, -4119, -9909, -5079, 4804, + 5586, 774, -5430, 299, -9943, 3264, -3690, -3901, + -1133, -6199, 3182, 1544, 5467, 3686, -2639, 4068, + 1163, -185, -1299, -506, 0, 0, 843, 1005, + -1059, 467, -1279, -2259, 6057, -1694, -5885, 5342, + -5160, -3748, -1382, 4420, -697, -2000, -3808, 3100, + 2685, -4073, 531, 318, -7822, 2414, 2901, 3399, + -1340, 8449, 3685, 463, -3341, 2423, 2304, -2723, + 84, -2622, 0, 0, 12088, -265, 2562, -435, + -4348, -2426, 3538, 1552, 1279, 883, -4166, 2634, + -6130, 2994, 3729, -1570, -601, -1753, -5124, -2788, + -2096, -1920, -2649, 2793, -1079, -1952, 2983, -1530, + 2499, 1769, 1492, -6757, -2108, 2841, 1466, 2597, + 0, 0, -3830, -4093, 2448, 12720, 7737, -665, + -832, -9257, 2971, -2400, 791, 1873, 1072, -587, + -7440, 8055, 1531, -4736, 616, -1782, -2982, 9663, + -5057, -5926, 1610, -4489, 7033, -8658, 6010, -5673, + 5648, 812, -271, -1802, -4500, 4392, 0, 0, + -888, -327, 3373, -1084, 7959, 2430, 1898, -2360, + -1820, -1377, -1090, -4436, -3422, -1106, -3230, 3876, + -41, -5128, 6375, -1848, -3824, 5844, 617, -1957, + 4232, 1345, -1439, -83, 3046, -214, 5458, -5566, + -4387, -3738, -5740, 8657, 0, 0, 6978, 6239, + -3686, -981, -2854, 78, 5859, -357, 4618, 7391, + -138, 971, -5799, 2135, 4478, -7004, -5949, 1668, + -6933, -1163, 7010, -5624, 2990, 6192, -8075, 3567, + -8308, 2236, -5098, -2120, -4355, -4238, 4955, 10230, + 692, -5606, 0, 0, -1348, -7069, -12, -4927, + 1211, 651, 1360, 7744, 3404, 5069, -2438, -105, + 2332, 1494, -4686, 1336, -3628, -881, 2474, 1736, + -26, -257, 2135, -4452, 446, -641, -4704, 2605, + -6436, 6662, -4939, 990, -1100, -3782, 5028, 4753, + 0, 0, -2875, 6410, 3518, 3950, 1271, 869, + -2842, -5837, 1532, -2899, 1140, -597, 1712, -1988, + -4819, -4783, 4773, -8796, 2240, -4596, 3565, -4853, + -556, -3974, 7366, -4370, 3113, -3548, 3552, -5450, + 3869, 2514, 6736, -4570, 6074, 3151, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 32767, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 32767 +}; diff --git a/media/libopus/src/mapping_matrix.h b/media/libopus/src/mapping_matrix.h index 98bc82df3e..53646cb19f 100644 --- a/media/libopus/src/mapping_matrix.h +++ b/media/libopus/src/mapping_matrix.h @@ -117,6 +117,12 @@ extern const opus_int16 mapping_matrix_soa_mixing_data[121]; extern const MappingMatrix mapping_matrix_toa_mixing; extern const opus_int16 mapping_matrix_toa_mixing_data[324]; +extern const MappingMatrix mapping_matrix_fourthoa_mixing; +extern const opus_int16 mapping_matrix_fourthoa_mixing_data[729]; + +extern const MappingMatrix mapping_matrix_fifthoa_mixing; +extern const opus_int16 mapping_matrix_fifthoa_mixing_data[1444]; + extern const MappingMatrix mapping_matrix_foa_demixing; extern const opus_int16 mapping_matrix_foa_demixing_data[36]; @@ -126,6 +132,12 @@ extern const opus_int16 mapping_matrix_soa_demixing_data[121]; extern const MappingMatrix mapping_matrix_toa_demixing; extern const opus_int16 mapping_matrix_toa_demixing_data[324]; +extern const MappingMatrix mapping_matrix_fourthoa_demixing; +extern const opus_int16 mapping_matrix_fourthoa_demixing_data[729]; + +extern const MappingMatrix mapping_matrix_fifthoa_demixing; +extern const opus_int16 mapping_matrix_fifthoa_demixing_data[1444]; + #ifdef __cplusplus } #endif diff --git a/media/libopus/src/mlp.c b/media/libopus/src/mlp.c index 964c6a98f6..e658ccde0d 100644 --- a/media/libopus/src/mlp.c +++ b/media/libopus/src/mlp.c @@ -33,35 +33,23 @@ #include "opus_types.h" #include "opus_defines.h" #include "arch.h" -#include "tansig_table.h" #include "mlp.h" +#define fmadd(a, b, c) ((a)*(b)+(c)) static OPUS_INLINE float tansig_approx(float x) { - int i; - float y, dy; - float sign=1; - /* Tests are reversed to catch NaNs */ - if (!(x<8)) - return 1; - if (!(x>-8)) - return -1; -#ifndef FIXED_POINT - /* Another check in case of -ffast-math */ - if (celt_isnan(x)) - return 0; -#endif - if (x<0) - { - x=-x; - sign=-1; - } - i = (int)floor(.5f+25*x); - x -= .04f*i; - y = tansig_table[i]; - dy = 1-y*y; - y = y + x*dy*(1 - y*x); - return sign*y; + const float N0 = 952.52801514f; + const float N1 = 96.39235687f; + const float N2 = 0.60863042f; + const float D0 = 952.72399902f; + const float D1 = 413.36801147f; + const float D2 = 11.88600922f; + float X2, num, den; + X2 = x*x; + num = fmadd(fmadd(N2, X2, N1), X2, N0); + den = fmadd(fmadd(D2, X2, D1), X2, D0); + num = num*x/den; + return MAX32(-1.f, MIN32(1.f, num)); } static OPUS_INLINE float sigmoid_approx(float x) @@ -79,7 +67,7 @@ static void gemm_accum(float *out, const opus_int8 *weights, int rows, int cols, } } -void compute_dense(const DenseLayer *layer, float *output, const float *input) +void analysis_compute_dense(const AnalysisDenseLayer *layer, float *output, const float *input) { int i; int N, M; @@ -101,7 +89,7 @@ void compute_dense(const DenseLayer *layer, float *output, const float *input) } } -void compute_gru(const GRULayer *gru, float *state, const float *input) +void analysis_compute_gru(const AnalysisGRULayer *gru, float *state, const float *input) { int i; int N, M; diff --git a/media/libopus/src/mlp.h b/media/libopus/src/mlp.h index d7670550fd..e6b1a8f76c 100644 --- a/media/libopus/src/mlp.h +++ b/media/libopus/src/mlp.h @@ -24,8 +24,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _MLP_H_ -#define _MLP_H_ +#ifndef MLP_H_ +#define MLP_H_ #include "opus_types.h" @@ -39,7 +39,7 @@ typedef struct { int nb_inputs; int nb_neurons; int sigmoid; -} DenseLayer; +} AnalysisDenseLayer; typedef struct { const opus_int8 *bias; @@ -47,14 +47,14 @@ typedef struct { const opus_int8 *recurrent_weights; int nb_inputs; int nb_neurons; -} GRULayer; +} AnalysisGRULayer; -extern const DenseLayer layer0; -extern const GRULayer layer1; -extern const DenseLayer layer2; +extern const AnalysisDenseLayer layer0; +extern const AnalysisGRULayer layer1; +extern const AnalysisDenseLayer layer2; -void compute_dense(const DenseLayer *layer, float *output, const float *input); +void analysis_compute_dense(const AnalysisDenseLayer *layer, float *output, const float *input); -void compute_gru(const GRULayer *gru, float *state, const float *input); +void analysis_compute_gru(const AnalysisGRULayer *gru, float *state, const float *input); -#endif /* _MLP_H_ */ +#endif /* MLP_H_ */ diff --git a/media/libopus/src/mlp_data.c b/media/libopus/src/mlp_data.c index ae4178df76..65f7448ea0 100644 --- a/media/libopus/src/mlp_data.c +++ b/media/libopus/src/mlp_data.c @@ -651,20 +651,20 @@ static const opus_int8 layer2_bias[2] = { 14, 117 }; -const DenseLayer layer0 = { +const AnalysisDenseLayer layer0 = { layer0_bias, layer0_weights, 25, 32, 0 }; -const GRULayer layer1 = { +const AnalysisGRULayer layer1 = { layer1_bias, layer1_weights, layer1_recur_weights, 32, 24 }; -const DenseLayer layer2 = { +const AnalysisDenseLayer layer2 = { layer2_bias, layer2_weights, 24, 2, 1 diff --git a/media/libopus/src/opus.c b/media/libopus/src/opus.c index 538b5ea74e..816a4dd5fa 100644 --- a/media/libopus/src/opus.c +++ b/media/libopus/src/opus.c @@ -194,7 +194,8 @@ int opus_packet_get_samples_per_frame(const unsigned char *data, int opus_packet_parse_impl(const unsigned char *data, opus_int32 len, int self_delimited, unsigned char *out_toc, const unsigned char *frames[48], opus_int16 size[48], - int *payload_offset, opus_int32 *packet_offset) + int *payload_offset, opus_int32 *packet_offset, + const unsigned char **padding, opus_int32 *padding_len) { int i, bytes; int count; @@ -337,6 +338,11 @@ int opus_packet_parse_impl(const unsigned char *data, opus_int32 len, data += size[i]; } + if (padding != NULL) + { + *padding = data; + *padding_len = pad; + } if (packet_offset) *packet_offset = pad+(opus_int32)(data-data0); @@ -351,6 +357,6 @@ int opus_packet_parse(const unsigned char *data, opus_int32 len, opus_int16 size[48], int *payload_offset) { return opus_packet_parse_impl(data, len, 0, out_toc, - frames, size, payload_offset, NULL); + frames, size, payload_offset, NULL, NULL, NULL); } diff --git a/media/libopus/src/opus_decoder.c b/media/libopus/src/opus_decoder.c index 6520e748ea..b57c809434 100644 --- a/media/libopus/src/opus_decoder.c +++ b/media/libopus/src/opus_decoder.c @@ -52,6 +52,15 @@ #include "mathops.h" #include "cpu_support.h" +#ifdef ENABLE_DEEP_PLC +#include "dred_rdovae_dec_data.h" +#include "dred_rdovae_dec.h" +#endif + +#ifdef ENABLE_OSCE +#include "osce.h" +#endif + struct OpusDecoder { int celt_dec_offset; int silk_dec_offset; @@ -59,7 +68,11 @@ struct OpusDecoder { opus_int32 Fs; /** Sampling rate (at the API level) */ silk_DecControlStruct DecControl; int decode_gain; + int complexity; int arch; +#ifdef ENABLE_DEEP_PLC + LPCNetPLCState lpcnet; +#endif /* Everything beyond this point gets cleared on a reset */ #define OPUS_DECODER_RESET_START stream_channels @@ -135,6 +148,7 @@ int opus_decoder_init(OpusDecoder *st, opus_int32 Fs, int channels) silk_dec = (char*)st+st->silk_dec_offset; celt_dec = (CELTDecoder*)((char*)st+st->celt_dec_offset); st->stream_channels = st->channels = channels; + st->complexity = 0; st->Fs = Fs; st->DecControl.API_sampleRate = st->Fs; @@ -152,6 +166,9 @@ int opus_decoder_init(OpusDecoder *st, opus_int32 Fs, int channels) st->prev_mode = 0; st->frame_size = Fs/400; +#ifdef ENABLE_DEEP_PLC + lpcnet_plc_init( &st->lpcnet); +#endif st->arch = opus_select_arch(); return OPUS_OK; } @@ -370,7 +387,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data, pcm_ptr = pcm_silk; if (st->prev_mode==MODE_CELT_ONLY) - silk_InitDecoder( silk_dec ); + silk_ResetDecoder( silk_dec ); /* The SILK PLC cannot produce frames of less than 10 ms */ st->DecControl.payloadSize_ms = IMAX(10, 1000 * audiosize / st->Fs); @@ -394,14 +411,28 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data, st->DecControl.internalSampleRate = 16000; } } + st->DecControl.enable_deep_plc = st->complexity >= 5; +#ifdef ENABLE_OSCE + st->DecControl.osce_method = OSCE_METHOD_NONE; +#ifndef DISABLE_LACE + if (st->complexity >= 6) {st->DecControl.osce_method = OSCE_METHOD_LACE;} +#endif +#ifndef DISABLE_NOLACE + if (st->complexity >= 7) {st->DecControl.osce_method = OSCE_METHOD_NOLACE;} +#endif +#endif - lost_flag = data == NULL ? 1 : 2 * decode_fec; + lost_flag = data == NULL ? 1 : 2 * !!decode_fec; decoded_samples = 0; do { /* Call SILK decoder */ int first_frame = decoded_samples == 0; silk_ret = silk_Decode( silk_dec, &st->DecControl, - lost_flag, first_frame, &dec, pcm_ptr, &silk_frame_size, st->arch ); + lost_flag, first_frame, &dec, pcm_ptr, &silk_frame_size, +#ifdef ENABLE_DEEP_PLC + &st->lpcnet, +#endif + st->arch ); if( silk_ret ) { if (lost_flag) { /* PLC failure should not be fatal */ @@ -521,8 +552,12 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data, if (mode != st->prev_mode && st->prev_mode > 0 && !st->prev_redundancy) MUST_SUCCEED(celt_decoder_ctl(celt_dec, OPUS_RESET_STATE)); /* Decode CELT */ - celt_ret = celt_decode_with_ec(celt_dec, decode_fec ? NULL : data, - len, pcm, celt_frame_size, &dec, celt_accum); + celt_ret = celt_decode_with_ec_dred(celt_dec, decode_fec ? NULL : data, + len, pcm, celt_frame_size, &dec, celt_accum +#ifdef ENABLE_DEEP_PLC + , &st->lpcnet +#endif + ); } else { unsigned char silence[2] = {0xFF, 0xFF}; if (!celt_accum) @@ -634,7 +669,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data, int opus_decode_native(OpusDecoder *st, const unsigned char *data, opus_int32 len, opus_val16 *pcm, int frame_size, int decode_fec, - int self_delimited, opus_int32 *packet_offset, int soft_clip) + int self_delimited, opus_int32 *packet_offset, int soft_clip, const OpusDRED *dred, opus_int32 dred_offset) { int i, nb_samples; int count, offset; @@ -648,6 +683,35 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data, /* For FEC/PLC, frame_size has to be to have a multiple of 2.5 ms */ if ((decode_fec || len==0 || data==NULL) && frame_size%(st->Fs/400)!=0) return OPUS_BAD_ARG; +#ifdef ENABLE_DRED + if (dred != NULL && dred->process_stage == 2) { + int F10; + int features_per_frame; + int needed_feature_frames; + int init_frames; + lpcnet_plc_fec_clear(&st->lpcnet); + F10 = st->Fs/100; + /* if blend==0, the last PLC call was "update" and we need to feed two extra 10-ms frames. */ + init_frames = (st->lpcnet.blend == 0) ? 2 : 0; + features_per_frame = IMAX(1, frame_size/F10); + needed_feature_frames = init_frames + features_per_frame; + lpcnet_plc_fec_clear(&st->lpcnet); + for (i=0;i<needed_feature_frames;i++) { + int feature_offset; + /* We floor instead of rounding because 5-ms overlap compensates for the missing 0.5 rounding offset. */ + feature_offset = init_frames - i - 2 + (int)floor(((float)dred_offset + dred->dred_offset*F10/4)/F10); + if (feature_offset <= 4*dred->nb_latents-1 && feature_offset >= 0) { + lpcnet_plc_fec_add(&st->lpcnet, dred->fec_features+feature_offset*DRED_NUM_FEATURES); + } else { + if (feature_offset >= 0) lpcnet_plc_fec_add(&st->lpcnet, NULL); + } + + } + } +#else + (void)dred; + (void)dred_offset; +#endif if (len==0 || data==NULL) { int pcm_count=0; @@ -672,7 +736,7 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data, packet_stream_channels = opus_packet_get_nb_channels(data); count = opus_packet_parse_impl(data, len, self_delimited, &toc, NULL, - size, &offset, packet_offset); + size, &offset, packet_offset, NULL, NULL); if (count<0) return count; @@ -684,12 +748,12 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data, int ret; /* If no FEC can be present, run the PLC (recursive call) */ if (frame_size < packet_frame_size || packet_mode == MODE_CELT_ONLY || st->mode == MODE_CELT_ONLY) - return opus_decode_native(st, NULL, 0, pcm, frame_size, 0, 0, NULL, soft_clip); + return opus_decode_native(st, NULL, 0, pcm, frame_size, 0, 0, NULL, soft_clip, NULL, 0); /* Otherwise, run the PLC on everything except the size for which we might have FEC */ duration_copy = st->last_packet_duration; if (frame_size-packet_frame_size!=0) { - ret = opus_decode_native(st, NULL, 0, pcm, frame_size-packet_frame_size, 0, 0, NULL, soft_clip); + ret = opus_decode_native(st, NULL, 0, pcm, frame_size-packet_frame_size, 0, 0, NULL, soft_clip, NULL, 0); if (ret<0) { st->last_packet_duration = duration_copy; @@ -753,7 +817,7 @@ int opus_decode(OpusDecoder *st, const unsigned char *data, { if(frame_size<=0) return OPUS_BAD_ARG; - return opus_decode_native(st, data, len, pcm, frame_size, decode_fec, 0, NULL, 0); + return opus_decode_native(st, data, len, pcm, frame_size, decode_fec, 0, NULL, 0, NULL, 0); } #ifndef DISABLE_FLOAT_API @@ -781,7 +845,7 @@ int opus_decode_float(OpusDecoder *st, const unsigned char *data, celt_assert(st->channels == 1 || st->channels == 2); ALLOC(out, frame_size*st->channels, opus_int16); - ret = opus_decode_native(st, data, len, out, frame_size, decode_fec, 0, NULL, 0); + ret = opus_decode_native(st, data, len, out, frame_size, decode_fec, 0, NULL, 0, NULL, 0); if (ret > 0) { for (i=0;i<ret*st->channels;i++) @@ -819,7 +883,7 @@ int opus_decode(OpusDecoder *st, const unsigned char *data, celt_assert(st->channels == 1 || st->channels == 2); ALLOC(out, frame_size*st->channels, float); - ret = opus_decode_native(st, data, len, out, frame_size, decode_fec, 0, NULL, 1); + ret = opus_decode_native(st, data, len, out, frame_size, decode_fec, 0, NULL, 1, NULL, 0); if (ret > 0) { for (i=0;i<ret*st->channels;i++) @@ -834,7 +898,7 @@ int opus_decode_float(OpusDecoder *st, const unsigned char *data, { if(frame_size<=0) return OPUS_BAD_ARG; - return opus_decode_native(st, data, len, pcm, frame_size, decode_fec, 0, NULL, 0); + return opus_decode_native(st, data, len, pcm, frame_size, decode_fec, 0, NULL, 0, NULL, 0); } #endif @@ -864,6 +928,27 @@ int opus_decoder_ctl(OpusDecoder *st, int request, ...) *value = st->bandwidth; } break; + case OPUS_SET_COMPLEXITY_REQUEST: + { + opus_int32 value = va_arg(ap, opus_int32); + if(value<0 || value>10) + { + goto bad_arg; + } + st->complexity = value; + celt_decoder_ctl(celt_dec, OPUS_SET_COMPLEXITY(value)); + } + break; + case OPUS_GET_COMPLEXITY_REQUEST: + { + opus_int32 *value = va_arg(ap, opus_int32*); + if (!value) + { + goto bad_arg; + } + *value = st->complexity; + } + break; case OPUS_GET_FINAL_RANGE_REQUEST: { opus_uint32 *value = va_arg(ap, opus_uint32*); @@ -881,9 +966,12 @@ int opus_decoder_ctl(OpusDecoder *st, int request, ...) ((char*)&st->OPUS_DECODER_RESET_START - (char*)st)); celt_decoder_ctl(celt_dec, OPUS_RESET_STATE); - silk_InitDecoder( silk_dec ); + silk_ResetDecoder( silk_dec ); st->stream_channels = st->channels; st->frame_size = st->Fs/400; +#ifdef ENABLE_DEEP_PLC + lpcnet_plc_reset( &st->lpcnet ); +#endif } break; case OPUS_GET_SAMPLE_RATE_REQUEST: @@ -959,6 +1047,20 @@ int opus_decoder_ctl(OpusDecoder *st, int request, ...) ret = celt_decoder_ctl(celt_dec, OPUS_GET_PHASE_INVERSION_DISABLED(value)); } break; +#ifdef USE_WEIGHTS_FILE + case OPUS_SET_DNN_BLOB_REQUEST: + { + const unsigned char *data = va_arg(ap, const unsigned char *); + opus_int32 len = va_arg(ap, opus_int32); + if(len<0 || data == NULL) + { + goto bad_arg; + } + ret = lpcnet_plc_load_model(&st->lpcnet, data, len); + ret = silk_LoadOSCEModels(silk_dec, data, len) || ret; + } + break; +#endif default: /*fprintf(stderr, "unknown opus_decoder_ctl() request: %d", request);*/ ret = OPUS_UNIMPLEMENTED; @@ -1034,8 +1136,373 @@ int opus_packet_get_nb_samples(const unsigned char packet[], opus_int32 len, return samples; } +int opus_packet_has_lbrr(const unsigned char packet[], opus_int32 len) +{ + int ret; + const unsigned char *frames[48]; + opus_int16 size[48]; + int packet_mode, packet_frame_size, packet_stream_channels; + int nb_frames=1; + int lbrr; + + packet_mode = opus_packet_get_mode(packet); + if (packet_mode == MODE_CELT_ONLY) + return 0; + packet_frame_size = opus_packet_get_samples_per_frame(packet, 48000); + if (packet_frame_size > 960) + nb_frames = packet_frame_size/960; + packet_stream_channels = opus_packet_get_nb_channels(packet); + ret = opus_packet_parse(packet, len, NULL, frames, size, NULL); + if (ret <= 0) + return ret; + lbrr = (frames[0][0] >> (7-nb_frames)) & 0x1; + if (packet_stream_channels == 2) + lbrr = lbrr || ((frames[0][0] >> (6-2*nb_frames)) & 0x1); + return lbrr; +} + int opus_decoder_get_nb_samples(const OpusDecoder *dec, const unsigned char packet[], opus_int32 len) { return opus_packet_get_nb_samples(packet, len, dec->Fs); } + +struct OpusDREDDecoder { +#ifdef ENABLE_DRED + RDOVAEDec model; +#endif + int loaded; + int arch; + opus_uint32 magic; +}; + +#if defined(ENABLE_DRED) && (defined(ENABLE_HARDENING) || defined(ENABLE_ASSERTIONS)) +static void validate_dred_decoder(OpusDREDDecoder *st) +{ + celt_assert(st->magic == 0xD8EDDEC0); +#ifdef OPUS_ARCHMASK + celt_assert(st->arch >= 0); + celt_assert(st->arch <= OPUS_ARCHMASK); +#endif +} +#define VALIDATE_DRED_DECODER(st) validate_dred_decoder(st) +#else +#define VALIDATE_DRED_DECODER(st) +#endif + + +int opus_dred_decoder_get_size(void) +{ + return sizeof(OpusDREDDecoder); +} + +#ifdef ENABLE_DRED +int dred_decoder_load_model(OpusDREDDecoder *dec, const unsigned char *data, int len) +{ + WeightArray *list; + int ret; + parse_weights(&list, data, len); + ret = init_rdovaedec(&dec->model, list); + opus_free(list); + if (ret == 0) dec->loaded = 1; + return (ret == 0) ? OPUS_OK : OPUS_BAD_ARG; +} +#endif + +int opus_dred_decoder_init(OpusDREDDecoder *dec) +{ + int ret = 0; + dec->loaded = 0; +#if defined(ENABLE_DRED) && !defined(USE_WEIGHTS_FILE) + ret = init_rdovaedec(&dec->model, rdovaedec_arrays); + if (ret == 0) dec->loaded = 1; +#endif + dec->arch = opus_select_arch(); + /* To make sure nobody forgets to init, use a magic number. */ + dec->magic = 0xD8EDDEC0; + return (ret == 0) ? OPUS_OK : OPUS_UNIMPLEMENTED; +} + +OpusDREDDecoder *opus_dred_decoder_create(int *error) +{ + int ret; + OpusDREDDecoder *dec; + dec = (OpusDREDDecoder *)opus_alloc(opus_dred_decoder_get_size()); + if (dec == NULL) + { + if (error) + *error = OPUS_ALLOC_FAIL; + return NULL; + } + ret = opus_dred_decoder_init(dec); + if (error) + *error = ret; + if (ret != OPUS_OK) + { + opus_free(dec); + dec = NULL; + } + return dec; +} + +void opus_dred_decoder_destroy(OpusDREDDecoder *dec) +{ + if (dec) dec->magic = 0xDE57801D; + opus_free(dec); +} + +int opus_dred_decoder_ctl(OpusDREDDecoder *dred_dec, int request, ...) +{ +#ifdef ENABLE_DRED + int ret = OPUS_OK; + va_list ap; + + va_start(ap, request); + (void)dred_dec; + switch (request) + { +# ifdef USE_WEIGHTS_FILE + case OPUS_SET_DNN_BLOB_REQUEST: + { + const unsigned char *data = va_arg(ap, const unsigned char *); + opus_int32 len = va_arg(ap, opus_int32); + if(len<0 || data == NULL) + { + goto bad_arg; + } + return dred_decoder_load_model(dred_dec, data, len); + } + break; +# endif + default: + /*fprintf(stderr, "unknown opus_decoder_ctl() request: %d", request);*/ + ret = OPUS_UNIMPLEMENTED; + break; + } + va_end(ap); + return ret; +# ifdef USE_WEIGHTS_FILE +bad_arg: + va_end(ap); + return OPUS_BAD_ARG; +# endif +#else + (void)dred_dec; + (void)request; + return OPUS_UNIMPLEMENTED; +#endif +} + +#ifdef ENABLE_DRED +static int dred_find_payload(const unsigned char *data, opus_int32 len, const unsigned char **payload, int *dred_frame_offset) +{ + const unsigned char *data0; + int len0; + int frame = 0; + int ret; + const unsigned char *frames[48]; + opus_int16 size[48]; + int frame_size; + + *payload = NULL; + /* Get the padding section of the packet. */ + ret = opus_packet_parse_impl(data, len, 0, NULL, frames, size, NULL, NULL, &data0, &len0); + if (ret < 0) + return ret; + frame_size = opus_packet_get_samples_per_frame(data, 48000); + data = data0; + len = len0; + /* Scan extensions in order until we find the earliest frame with DRED data. */ + while (len > 0) + { + opus_int32 header_size; + int id, L; + len0 = len; + data0 = data; + id = *data0 >> 1; + L = *data0 & 0x1; + len = skip_extension(&data, len, &header_size); + if (len < 0) + break; + if (id == 1) + { + if (L==0) + { + frame++; + } else { + frame += data0[1]; + } + } else if (id == DRED_EXTENSION_ID) + { + const unsigned char *curr_payload; + opus_int32 curr_payload_len; + curr_payload = data0+header_size; + curr_payload_len = (data-data0)-header_size; + /* DRED position in the packet, in units of 2.5 ms like for the signaled DRED offset. */ + *dred_frame_offset = frame*frame_size/120; +#ifdef DRED_EXPERIMENTAL_VERSION + /* Check that temporary extension type and version match. + This check will be removed once extension is finalized. */ + if (curr_payload_len > DRED_EXPERIMENTAL_BYTES && curr_payload[0] == 'D' && curr_payload[1] == DRED_EXPERIMENTAL_VERSION) { + *payload = curr_payload+2; + return curr_payload_len-2; + } +#else + if (curr_payload_len > 0) { + *payload = curr_payload; + return curr_payload_len; + } +#endif + } + } + return 0; +} +#endif + +int opus_dred_get_size(void) +{ +#ifdef ENABLE_DRED + return sizeof(OpusDRED); +#else + return 0; +#endif +} + +OpusDRED *opus_dred_alloc(int *error) +{ +#ifdef ENABLE_DRED + OpusDRED *dec; + dec = (OpusDRED *)opus_alloc(opus_dred_get_size()); + if (dec == NULL) + { + if (error) + *error = OPUS_ALLOC_FAIL; + return NULL; + } + return dec; +#else + if (error) + *error = OPUS_UNIMPLEMENTED; + return NULL; +#endif +} + +void opus_dred_free(OpusDRED *dec) +{ +#ifdef ENABLE_DRED + opus_free(dec); +#else + (void)dec; +#endif +} + +int opus_dred_parse(OpusDREDDecoder *dred_dec, OpusDRED *dred, const unsigned char *data, opus_int32 len, opus_int32 max_dred_samples, opus_int32 sampling_rate, int *dred_end, int defer_processing) +{ +#ifdef ENABLE_DRED + const unsigned char *payload; + opus_int32 payload_len; + int dred_frame_offset=0; + VALIDATE_DRED_DECODER(dred_dec); + if (!dred_dec->loaded) return OPUS_UNIMPLEMENTED; + dred->process_stage = -1; + payload_len = dred_find_payload(data, len, &payload, &dred_frame_offset); + if (payload_len < 0) + return payload_len; + if (payload != NULL) + { + int offset; + int min_feature_frames; + offset = 100*max_dred_samples/sampling_rate; + min_feature_frames = IMIN(2 + offset, 2*DRED_NUM_REDUNDANCY_FRAMES); + dred_ec_decode(dred, payload, payload_len, min_feature_frames, dred_frame_offset); + if (!defer_processing) + opus_dred_process(dred_dec, dred, dred); + if (dred_end) *dred_end = IMAX(0, -dred->dred_offset*sampling_rate/400); + return IMAX(0, dred->nb_latents*sampling_rate/25 - dred->dred_offset* sampling_rate/400); + } + if (dred_end) *dred_end = 0; + return 0; +#else + (void)dred_dec; + (void)dred; + (void)data; + (void)len; + (void)max_dred_samples; + (void)sampling_rate; + (void)defer_processing; + (void)dred_end; + return OPUS_UNIMPLEMENTED; +#endif +} + +int opus_dred_process(OpusDREDDecoder *dred_dec, const OpusDRED *src, OpusDRED *dst) +{ +#ifdef ENABLE_DRED + if (dred_dec == NULL || src == NULL || dst == NULL || (src->process_stage != 1 && src->process_stage != 2)) + return OPUS_BAD_ARG; + VALIDATE_DRED_DECODER(dred_dec); + if (!dred_dec->loaded) return OPUS_UNIMPLEMENTED; + if (src != dst) + OPUS_COPY(dst, src, 1); + if (dst->process_stage == 2) + return OPUS_OK; + DRED_rdovae_decode_all(&dred_dec->model, dst->fec_features, dst->state, dst->latents, dst->nb_latents, dred_dec->arch); + dst->process_stage = 2; + return OPUS_OK; +#else + (void)dred_dec; + (void)src; + (void)dst; + return OPUS_UNIMPLEMENTED; +#endif +} + +int opus_decoder_dred_decode(OpusDecoder *st, const OpusDRED *dred, opus_int32 dred_offset, opus_int16 *pcm, opus_int32 frame_size) +{ +#ifdef ENABLE_DRED + VARDECL(float, out); + int ret, i; + ALLOC_STACK; + + if(frame_size<=0) + { + RESTORE_STACK; + return OPUS_BAD_ARG; + } + + celt_assert(st->channels == 1 || st->channels == 2); + ALLOC(out, frame_size*st->channels, float); + + ret = opus_decode_native(st, NULL, 0, out, frame_size, 0, 0, NULL, 1, dred, dred_offset); + if (ret > 0) + { + for (i=0;i<ret*st->channels;i++) + pcm[i] = FLOAT2INT16(out[i]); + } + RESTORE_STACK; + return ret; +#else + (void)st; + (void)dred; + (void)dred_offset; + (void)pcm; + (void)frame_size; + return OPUS_UNIMPLEMENTED; +#endif +} + +int opus_decoder_dred_decode_float(OpusDecoder *st, const OpusDRED *dred, opus_int32 dred_offset, float *pcm, opus_int32 frame_size) +{ +#ifdef ENABLE_DRED + if(frame_size<=0) + return OPUS_BAD_ARG; + return opus_decode_native(st, NULL, 0, pcm, frame_size, 0, 0, NULL, 0, dred, dred_offset); +#else + (void)st; + (void)dred; + (void)dred_offset; + (void)pcm; + (void)frame_size; + return OPUS_UNIMPLEMENTED; +#endif +} diff --git a/media/libopus/src/opus_encoder.c b/media/libopus/src/opus_encoder.c index 8c8db5a546..d18d582f03 100644 --- a/media/libopus/src/opus_encoder.c +++ b/media/libopus/src/opus_encoder.c @@ -45,11 +45,19 @@ #include "analysis.h" #include "mathops.h" #include "tuning_parameters.h" + +#ifdef ENABLE_DRED +#include "dred_coding.h" +#endif + #ifdef FIXED_POINT #include "fixed/structs_FIX.h" #else #include "float/structs_FLP.h" #endif +#ifdef ENABLE_OSCE_TRAINING_DATA +#include <stdio.h> +#endif #define MAX_ENCODER_BUFFER 480 @@ -67,6 +75,9 @@ struct OpusEncoder { int celt_enc_offset; int silk_enc_offset; silk_EncControlStruct silk_mode; +#ifdef ENABLE_DRED + DREDEnc dred_encoder; +#endif int application; int channels; int delay_compensation; @@ -116,6 +127,14 @@ struct OpusEncoder { int nb_no_activity_ms_Q1; opus_val32 peak_signal_energy; #endif +#ifdef ENABLE_DRED + int dred_duration; + int dred_q0; + int dred_dQ; + int dred_qmax; + int dred_target_chunks; + unsigned char activity_mem[DRED_MAX_FRAMES*4]; /* 2.5ms resolution*/ +#endif int nonfinal_frame; /* current frame is not the final in a packet */ opus_uint32 rangeFinal; }; @@ -224,6 +243,7 @@ int opus_encoder_init(OpusEncoder* st, opus_int32 Fs, int channels, int applicat st->silk_mode.packetLossPercentage = 0; st->silk_mode.complexity = 9; st->silk_mode.useInBandFEC = 0; + st->silk_mode.useDRED = 0; st->silk_mode.useDTX = 0; st->silk_mode.useCBR = 0; st->silk_mode.reducedDependency = 0; @@ -236,6 +256,11 @@ int opus_encoder_init(OpusEncoder* st, opus_int32 Fs, int channels, int applicat celt_encoder_ctl(celt_enc, CELT_SET_SIGNALLING(0)); celt_encoder_ctl(celt_enc, OPUS_SET_COMPLEXITY(st->silk_mode.complexity)); +#ifdef ENABLE_DRED + /* Initialize DRED Encoder */ + dred_encoder_init( &st->dred_encoder, Fs, channels ); +#endif + st->use_vbr = 1; /* Makes constrained VBR the default (safer for real-time use) */ st->vbr_constraint = 1; @@ -544,6 +569,73 @@ OpusEncoder *opus_encoder_create(opus_int32 Fs, int channels, int application, i return st; } +#ifdef ENABLE_DRED + +static const float dred_bits_table[16] = {73.2f, 68.1f, 62.5f, 57.0f, 51.5f, 45.7f, 39.9f, 32.4f, 26.4f, 20.4f, 16.3f, 13.f, 9.3f, 8.2f, 7.2f, 6.4f}; +static int estimate_dred_bitrate(int q0, int dQ, int qmax, int duration, opus_int32 target_bits, int *target_chunks) { + int dred_chunks; + int i; + float bits; + /* Signaling DRED costs 3 bytes. */ + bits = 8*(3+DRED_EXPERIMENTAL_BYTES); + /* Approximation for the size of the IS. */ + bits += 50.f+dred_bits_table[q0]; + dred_chunks = IMIN((duration+5)/4, DRED_NUM_REDUNDANCY_FRAMES/2); + if (target_chunks != NULL) *target_chunks = 0; + for (i=0;i<dred_chunks;i++) { + int q = compute_quantizer(q0, dQ, qmax, i); + bits += dred_bits_table[q]; + if (target_chunks != NULL && bits < target_bits) *target_chunks = i+1; + } + return (int)floor(.5f+bits); +} + +static opus_int32 compute_dred_bitrate(OpusEncoder *st, opus_int32 bitrate_bps, int frame_size) +{ + float dred_frac; + int bitrate_offset; + opus_int32 dred_bitrate; + opus_int32 target_dred_bitrate; + int target_chunks; + opus_int32 max_dred_bits; + int q0, dQ, qmax; + if (st->silk_mode.useInBandFEC) { + dred_frac = MIN16(.7f, 3.f*st->silk_mode.packetLossPercentage/100.f); + bitrate_offset = 20000; + } else { + if (st->silk_mode.packetLossPercentage > 5) { + dred_frac = MIN16(.8f, .55f + st->silk_mode.packetLossPercentage/100.f); + } else { + dred_frac = 12*st->silk_mode.packetLossPercentage/100.f; + } + bitrate_offset = 12000; + } + /* Account for the fact that longer packets require less redundancy. */ + dred_frac = dred_frac/(dred_frac + (1-dred_frac)*(frame_size*50.f)/st->Fs); + /* Approximate fit based on a few experiments. Could probably be improved. */ + q0 = IMIN(15, IMAX(4, 51 - 3*EC_ILOG(IMAX(1, bitrate_bps-bitrate_offset)))); + dQ = bitrate_bps-bitrate_offset > 36000 ? 3 : 5; + qmax = 15; + target_dred_bitrate = IMAX(0, (int)(dred_frac*(bitrate_bps-bitrate_offset))); + if (st->dred_duration > 0) { + opus_int32 target_bits = target_dred_bitrate*frame_size/st->Fs; + max_dred_bits = estimate_dred_bitrate(q0, dQ, qmax, st->dred_duration, target_bits, &target_chunks); + } else { + max_dred_bits = 0; + target_chunks=0; + } + dred_bitrate = IMIN(target_dred_bitrate, max_dred_bits*st->Fs/frame_size); + /* If we can't afford enough bits, don't bother with DRED at all. */ + if (target_chunks < 2) + dred_bitrate = 0; + st->dred_q0 = q0; + st->dred_dQ = dQ; + st->dred_qmax = qmax; + st->dred_target_chunks = target_chunks; + return dred_bitrate; +} +#endif + static opus_int32 user_bitrate_to_bitrate(OpusEncoder *st, int frame_size, int max_data_bytes) { if(!frame_size)frame_size=st->Fs/400; @@ -872,7 +964,7 @@ static opus_val32 compute_frame_energy(const opus_val16 *pcm, int frame_size, in /* Compute the right shift required in the MAC to avoid an overflow */ max_shift = celt_ilog2(len); - shift = IMAX(0, (celt_ilog2(sample_max) << 1) + max_shift - 28); + shift = IMAX(0, (celt_ilog2(1+sample_max) << 1) + max_shift - 28); /* Compute the energy */ for (i=0; i<len; i++) @@ -922,105 +1014,6 @@ static int decide_dtx_mode(opus_int activity, /* indicates if this fr #endif -static opus_int32 encode_multiframe_packet(OpusEncoder *st, - const opus_val16 *pcm, - int nb_frames, - int frame_size, - unsigned char *data, - opus_int32 out_data_bytes, - int to_celt, - int lsb_depth, - int float_api) -{ - int i; - int ret = 0; - VARDECL(unsigned char, tmp_data); - int bak_mode, bak_bandwidth, bak_channels, bak_to_mono; - VARDECL(OpusRepacketizer, rp); - int max_header_bytes; - opus_int32 bytes_per_frame; - opus_int32 cbr_bytes; - opus_int32 repacketize_len; - int tmp_len; - ALLOC_STACK; - - /* Worst cases: - * 2 frames: Code 2 with different compressed sizes - * >2 frames: Code 3 VBR */ - max_header_bytes = nb_frames == 2 ? 3 : (2+(nb_frames-1)*2); - - if (st->use_vbr || st->user_bitrate_bps==OPUS_BITRATE_MAX) - repacketize_len = out_data_bytes; - else { - cbr_bytes = 3*st->bitrate_bps/(3*8*st->Fs/(frame_size*nb_frames)); - repacketize_len = IMIN(cbr_bytes, out_data_bytes); - } - bytes_per_frame = IMIN(1276, 1+(repacketize_len-max_header_bytes)/nb_frames); - - ALLOC(tmp_data, nb_frames*bytes_per_frame, unsigned char); - ALLOC(rp, 1, OpusRepacketizer); - opus_repacketizer_init(rp); - - bak_mode = st->user_forced_mode; - bak_bandwidth = st->user_bandwidth; - bak_channels = st->force_channels; - - st->user_forced_mode = st->mode; - st->user_bandwidth = st->bandwidth; - st->force_channels = st->stream_channels; - - bak_to_mono = st->silk_mode.toMono; - if (bak_to_mono) - st->force_channels = 1; - else - st->prev_channels = st->stream_channels; - - for (i=0;i<nb_frames;i++) - { - st->silk_mode.toMono = 0; - st->nonfinal_frame = i<(nb_frames-1); - - /* When switching from SILK/Hybrid to CELT, only ask for a switch at the last frame */ - if (to_celt && i==nb_frames-1) - st->user_forced_mode = MODE_CELT_ONLY; - - tmp_len = opus_encode_native(st, pcm+i*(st->channels*frame_size), frame_size, - tmp_data+i*bytes_per_frame, bytes_per_frame, lsb_depth, NULL, 0, 0, 0, 0, - NULL, float_api); - - if (tmp_len<0) - { - RESTORE_STACK; - return OPUS_INTERNAL_ERROR; - } - - ret = opus_repacketizer_cat(rp, tmp_data+i*bytes_per_frame, tmp_len); - - if (ret<0) - { - RESTORE_STACK; - return OPUS_INTERNAL_ERROR; - } - } - - ret = opus_repacketizer_out_range_impl(rp, 0, nb_frames, data, repacketize_len, 0, !st->use_vbr); - - if (ret<0) - { - RESTORE_STACK; - return OPUS_INTERNAL_ERROR; - } - - /* Discard configs that were forced locally for the purpose of repacketization */ - st->user_forced_mode = bak_mode; - st->user_bandwidth = bak_bandwidth; - st->force_channels = bak_channels; - st->silk_mode.toMono = bak_to_mono; - - RESTORE_STACK; - return ret; -} - static int compute_redundancy_bytes(opus_int32 max_data_bytes, opus_int32 bitrate_bps, int frame_rate, int channels) { int redundancy_bytes_cap; @@ -1049,6 +1042,18 @@ static int compute_redundancy_bytes(opus_int32 max_data_bytes, opus_int32 bitrat return redundancy_bytes; } +static opus_int32 opus_encode_frame_native(OpusEncoder *st, const opus_val16 *pcm, int frame_size, + unsigned char *data, opus_int32 max_data_bytes, + int float_api, int first_frame, +#ifdef ENABLE_DRED + opus_int32 dred_bitrate_bps, +#endif +#ifndef DISABLE_FLOAT_API + AnalysisInfo *analysis_info, int is_silence, +#endif + int redundancy, int celt_to_silk, int prefill, + opus_int32 equiv_rate, int to_celt); + opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_size, unsigned char *data, opus_int32 out_data_bytes, int lsb_depth, const void *analysis_pcm, opus_int32 analysis_size, int c1, int c2, @@ -1058,28 +1063,17 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ CELTEncoder *celt_enc; int i; int ret=0; - opus_int32 nBytes; - ec_enc enc; - int bytes_target; int prefill=0; - int start_band = 0; int redundancy = 0; - int redundancy_bytes = 0; /* Number of bytes to use for redundancy frame */ int celt_to_silk = 0; - VARDECL(opus_val16, pcm_buf); - int nb_compr_bytes; int to_celt = 0; - opus_uint32 redundant_rng = 0; - int cutoff_Hz, hp_freq_smth1; int voice_est; /* Probability of voice in Q7 */ opus_int32 equiv_rate; - int delay_compensation; int frame_rate; opus_int32 max_rate; /* Max bitrate we're allowed to use */ int curr_bandwidth; - opus_val16 HB_gain; opus_int32 max_data_bytes; /* Max number of bytes we're allowed to use */ - int total_buffer; + opus_int32 cbr_bytes=-1; opus_val16 stereo_width; const CELTMode *celt_mode; #ifndef DISABLE_FLOAT_API @@ -1088,10 +1082,9 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ int analysis_read_subframe_bak=-1; int is_silence = 0; #endif - opus_int activity = VAD_NO_DECISION; - - VARDECL(opus_val16, tmp_prefill); - +#ifdef ENABLE_DRED + opus_int32 dred_bitrate_bps; +#endif ALLOC_STACK; max_data_bytes = IMIN(1276, out_data_bytes); @@ -1112,10 +1105,6 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ silk_enc = (char*)st+st->silk_enc_offset; celt_enc = (CELTEncoder*)((char*)st+st->celt_enc_offset); - if (st->application == OPUS_APPLICATION_RESTRICTED_LOWDELAY) - delay_compensation = 0; - else - delay_compensation = st->delay_compensation; lsb_depth = IMIN(lsb_depth, st->lsb_depth); @@ -1157,20 +1146,6 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ if (!is_silence) st->voice_ratio = -1; - if (is_silence) - { - activity = !is_silence; - } else if (analysis_info.valid) - { - activity = analysis_info.activity_probability >= DTX_ACTIVITY_THRESHOLD; - if (!activity) - { - /* Mark as active if this noise frame is sufficiently loud */ - opus_val32 noise_energy = compute_frame_energy(pcm, frame_size, st->channels, st->arch); - activity = st->peak_signal_energy < (PSEUDO_SNR_THRESHOLD * noise_energy); - } - } - st->detected_bandwidth = 0; if (analysis_info.valid) { @@ -1207,21 +1182,24 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ stereo_width = compute_stereo_width(pcm, frame_size, st->Fs, &st->width_mem); else stereo_width = 0; - total_buffer = delay_compensation; st->bitrate_bps = user_bitrate_to_bitrate(st, frame_size, max_data_bytes); frame_rate = st->Fs/frame_size; if (!st->use_vbr) { - int cbrBytes; /* Multiply by 12 to make sure the division is exact. */ int frame_rate12 = 12*st->Fs/frame_size; /* We need to make sure that "int" values always fit in 16 bits. */ - cbrBytes = IMIN( (12*st->bitrate_bps/8 + frame_rate12/2)/frame_rate12, max_data_bytes); - st->bitrate_bps = cbrBytes*(opus_int32)frame_rate12*8/12; + cbr_bytes = IMIN( (12*st->bitrate_bps/8 + frame_rate12/2)/frame_rate12, max_data_bytes); + st->bitrate_bps = cbr_bytes*(opus_int32)frame_rate12*8/12; /* Make sure we provide at least one byte to avoid failing. */ - max_data_bytes = IMAX(1, cbrBytes); + max_data_bytes = IMAX(1, cbr_bytes); } +#ifdef ENABLE_DRED + /* Allocate some of the bits to DRED if needed. */ + dred_bitrate_bps = compute_dred_bitrate(st, st->bitrate_bps, frame_size); + st->bitrate_bps -= dred_bitrate_bps; +#endif if (max_data_bytes<3 || st->bitrate_bps < 3*frame_rate*8 || (frame_rate<50 && (max_data_bytes*frame_rate<300 || st->bitrate_bps < 2400))) { @@ -1575,6 +1553,15 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ { int enc_frame_size; int nb_frames; + VARDECL(unsigned char, tmp_data); + VARDECL(OpusRepacketizer, rp); + int max_header_bytes; + opus_int32 repacketize_len; + opus_int32 max_len_sum; + opus_int32 tot_size=0; + unsigned char *curr_data; + int tmp_len; + int dtx_count = 0; if (st->mode == MODE_SILK_ONLY) { @@ -1593,17 +1580,186 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ #ifndef DISABLE_FLOAT_API if (analysis_read_pos_bak!= -1) { + /* Reset analysis position to the beginning of the first frame so we + can use it one frame at a time. */ st->analysis.read_pos = analysis_read_pos_bak; st->analysis.read_subframe = analysis_read_subframe_bak; } #endif - ret = encode_multiframe_packet(st, pcm, nb_frames, enc_frame_size, data, - out_data_bytes, to_celt, lsb_depth, float_api); + /* Worst cases: + * 2 frames: Code 2 with different compressed sizes + * >2 frames: Code 3 VBR */ + max_header_bytes = nb_frames == 2 ? 3 : (2+(nb_frames-1)*2); + + if (st->use_vbr || st->user_bitrate_bps==OPUS_BITRATE_MAX) + repacketize_len = out_data_bytes; + else { + celt_assert(cbr_bytes>=0); + repacketize_len = IMIN(cbr_bytes, out_data_bytes); + } + max_len_sum = nb_frames + repacketize_len - max_header_bytes; + + ALLOC(tmp_data, max_len_sum, unsigned char); + curr_data = tmp_data; + ALLOC(rp, 1, OpusRepacketizer); + opus_repacketizer_init(rp); + + int bak_to_mono = st->silk_mode.toMono; + if (bak_to_mono) + st->force_channels = 1; + else + st->prev_channels = st->stream_channels; + + for (i=0;i<nb_frames;i++) + { + int first_frame; + int frame_to_celt; + int frame_redundancy; + opus_int32 curr_max; + /* Attempt DRED encoding until we have a non-DTX frame. In case of DTX refresh, + that allows for DRED not to be in the first frame. */ + first_frame = (i == 0) || (i == dtx_count); + st->silk_mode.toMono = 0; + st->nonfinal_frame = i<(nb_frames-1); + + /* When switching from SILK/Hybrid to CELT, only ask for a switch at the last frame */ + frame_to_celt = to_celt && i==nb_frames-1; + frame_redundancy = redundancy && (frame_to_celt || (!to_celt && i==0)); + + curr_max = IMIN(3*st->bitrate_bps/(3*8*st->Fs/enc_frame_size), max_len_sum/nb_frames); +#ifdef ENABLE_DRED + curr_max = IMIN(curr_max, (max_len_sum-3*dred_bitrate_bps/(3*8*st->Fs/frame_size))/nb_frames); + if (first_frame) curr_max += 3*dred_bitrate_bps/(3*8*st->Fs/frame_size); +#endif + curr_max = IMIN(max_len_sum-tot_size, curr_max); +#ifndef DISABLE_FLOAT_API + if (analysis_read_pos_bak != -1) { + is_silence = is_digital_silence(pcm, frame_size, st->channels, lsb_depth); + /* Get analysis for current frame. */ + tonality_get_info(&st->analysis, &analysis_info, enc_frame_size); + } +#endif + + tmp_len = opus_encode_frame_native(st, pcm+i*(st->channels*enc_frame_size), enc_frame_size, curr_data, curr_max, float_api, first_frame, +#ifdef ENABLE_DRED + dred_bitrate_bps, +#endif +#ifndef DISABLE_FLOAT_API + &analysis_info, + is_silence, +#endif + frame_redundancy, celt_to_silk, prefill, + equiv_rate, frame_to_celt + ); + if (tmp_len<0) + { + RESTORE_STACK; + return OPUS_INTERNAL_ERROR; + } else if (tmp_len==1) { + dtx_count++; + } + ret = opus_repacketizer_cat(rp, curr_data, tmp_len); + + if (ret<0) + { + RESTORE_STACK; + return OPUS_INTERNAL_ERROR; + } + tot_size += tmp_len; + curr_data += tmp_len; + } + ret = opus_repacketizer_out_range_impl(rp, 0, nb_frames, data, repacketize_len, 0, !st->use_vbr && (dtx_count != nb_frames), NULL, 0); + if (ret<0) + { + ret = OPUS_INTERNAL_ERROR; + } + st->silk_mode.toMono = bak_to_mono; RESTORE_STACK; return ret; + } else { + ret = opus_encode_frame_native(st, pcm, frame_size, data, max_data_bytes, float_api, 1, +#ifdef ENABLE_DRED + dred_bitrate_bps, +#endif +#ifndef DISABLE_FLOAT_API + &analysis_info, + is_silence, +#endif + redundancy, celt_to_silk, prefill, + equiv_rate, to_celt + ); + RESTORE_STACK; + return ret; } +} + +static opus_int32 opus_encode_frame_native(OpusEncoder *st, const opus_val16 *pcm, int frame_size, + unsigned char *data, opus_int32 max_data_bytes, + int float_api, int first_frame, +#ifdef ENABLE_DRED + opus_int32 dred_bitrate_bps, +#endif +#ifndef DISABLE_FLOAT_API + AnalysisInfo *analysis_info, int is_silence, +#endif + int redundancy, int celt_to_silk, int prefill, + opus_int32 equiv_rate, int to_celt) +{ + void *silk_enc; + CELTEncoder *celt_enc; + const CELTMode *celt_mode; + int i; + int ret=0; + opus_int32 nBytes; + ec_enc enc; + int bytes_target; + int start_band = 0; + int redundancy_bytes = 0; /* Number of bytes to use for redundancy frame */ + int nb_compr_bytes; + opus_uint32 redundant_rng = 0; + int cutoff_Hz; + int hp_freq_smth1; + opus_val16 HB_gain; + int apply_padding; + int frame_rate; + int curr_bandwidth; + int delay_compensation; + int total_buffer; + opus_int activity = VAD_NO_DECISION; + VARDECL(opus_val16, pcm_buf); + VARDECL(opus_val16, tmp_prefill); + SAVE_STACK; + + st->rangeFinal = 0; + silk_enc = (char*)st+st->silk_enc_offset; + celt_enc = (CELTEncoder*)((char*)st+st->celt_enc_offset); + celt_encoder_ctl(celt_enc, CELT_GET_MODE(&celt_mode)); + curr_bandwidth = st->bandwidth; + if (st->application == OPUS_APPLICATION_RESTRICTED_LOWDELAY) + delay_compensation = 0; + else + delay_compensation = st->delay_compensation; + total_buffer = delay_compensation; + + frame_rate = st->Fs/frame_size; + +#ifndef DISABLE_FLOAT_API + if (is_silence) + { + activity = !is_silence; + } else if (analysis_info->valid) + { + activity = analysis_info->activity_probability >= DTX_ACTIVITY_THRESHOLD; + if (!activity) + { + /* Mark as active if this noise frame is sufficiently loud */ + opus_val32 noise_energy = compute_frame_energy(pcm, frame_size, st->channels, st->arch); + activity = st->peak_signal_energy < (PSEUDO_SNR_THRESHOLD * noise_energy); + } + } +#endif /* For the first frame at a new SILK bandwidth */ if (st->silk_bw_switch) @@ -1611,7 +1767,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ redundancy = 1; celt_to_silk = 1; st->silk_bw_switch = 0; - /* Do a prefill without reseting the sampling rate control. */ + /* Do a prefill without resetting the sampling rate control. */ prefill=2; } @@ -1651,6 +1807,25 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ if (st->application == OPUS_APPLICATION_VOIP) { hp_cutoff(pcm, cutoff_Hz, &pcm_buf[total_buffer*st->channels], st->hp_mem, frame_size, st->channels, st->Fs, st->arch); + +#ifdef ENABLE_OSCE_TRAINING_DATA + /* write out high pass filtered clean signal*/ + static FILE *fout =NULL; + if (fout == NULL) + { + fout = fopen("clean_hp.s16", "wb"); + } + + { + int idx; + opus_int16 tmp; + for (idx = 0; idx < frame_size; idx++) + { + tmp = (opus_int16) (32768 * pcm_buf[total_buffer + idx] + 0.5f); + fwrite(&tmp, sizeof(tmp), 1, fout); + } + } +#endif } else { dc_reject(pcm, 3, &pcm_buf[total_buffer*st->channels], st->hp_mem, frame_size, st->channels, st->Fs); } @@ -1667,8 +1842,24 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ st->hp_mem[0] = st->hp_mem[1] = st->hp_mem[2] = st->hp_mem[3] = 0; } } +#else + (void)float_api; #endif +#ifdef ENABLE_DRED + if ( st->dred_duration > 0 && st->dred_encoder.loaded ) { + int frame_size_400Hz; + /* DRED Encoder */ + dred_compute_latents( &st->dred_encoder, &pcm_buf[total_buffer*st->channels], frame_size, total_buffer, st->arch ); + frame_size_400Hz = frame_size*400/st->Fs; + OPUS_MOVE(&st->activity_mem[frame_size_400Hz], st->activity_mem, 4*DRED_MAX_FRAMES-frame_size_400Hz); + for (i=0;i<frame_size_400Hz;i++) + st->activity_mem[i] = activity; + } else { + st->dred_encoder.latents_buffer_fill = 0; + OPUS_CLEAR(st->activity_mem, DRED_MAX_FRAMES); + } +#endif /* SILK processing */ HB_gain = Q15ONE; @@ -1763,7 +1954,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ st->silk_mode.maxInternalSampleRate = 16000; if (st->mode == MODE_SILK_ONLY) { - opus_int32 effective_max_rate = max_rate; + opus_int32 effective_max_rate = frame_rate*max_data_bytes*8; if (frame_rate > 50) effective_max_rate = effective_max_rate*2/3; if (effective_max_rate < 8000) @@ -1793,9 +1984,19 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ } if (st->silk_mode.useCBR) { + /* When we're in CBR mode, but we have non-SILK data to encode, switch SILK to VBR with cap to + save on complexity. Any variations will be absorbed by CELT and/or DRED and we can still + produce a constant bitrate without wasting bits. */ +#ifdef ENABLE_DRED + if (st->mode == MODE_HYBRID || dred_bitrate_bps > 0) +#else if (st->mode == MODE_HYBRID) +#endif { - st->silk_mode.maxBits = IMIN(st->silk_mode.maxBits, st->silk_mode.bitRate * frame_size / st->Fs); + /* Allow SILK to steal up to 25% of the remaining bits */ + opus_int16 other_bits = IMAX(0, st->silk_mode.maxBits - st->silk_mode.bitRate * frame_size / st->Fs); + st->silk_mode.maxBits = IMAX(0, st->silk_mode.maxBits - other_bits*3/4); + st->silk_mode.useCBR = 0; } } else { /* Constrained VBR. */ @@ -1908,26 +2109,10 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ if (st->mode != MODE_SILK_ONLY) { opus_val32 celt_pred=2; - celt_encoder_ctl(celt_enc, OPUS_SET_VBR(0)); /* We may still decide to disable prediction later */ if (st->silk_mode.reducedDependency) celt_pred = 0; celt_encoder_ctl(celt_enc, CELT_SET_PREDICTION(celt_pred)); - - if (st->mode == MODE_HYBRID) - { - if( st->use_vbr ) { - celt_encoder_ctl(celt_enc, OPUS_SET_BITRATE(st->bitrate_bps-st->silk_mode.bitRate)); - celt_encoder_ctl(celt_enc, OPUS_SET_VBR_CONSTRAINT(0)); - } - } else { - if (st->use_vbr) - { - celt_encoder_ctl(celt_enc, OPUS_SET_VBR(1)); - celt_encoder_ctl(celt_enc, OPUS_SET_VBR_CONSTRAINT(st->vbr_constraint)); - celt_encoder_ctl(celt_enc, OPUS_SET_BITRATE(st->bitrate_bps)); - } - } } ALLOC(tmp_prefill, st->channels*st->Fs/400, opus_val16); @@ -2021,13 +2206,27 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ ec_enc_done(&enc); nb_compr_bytes = ret; } else { - nb_compr_bytes = (max_data_bytes-1)-redundancy_bytes; - ec_enc_shrink(&enc, nb_compr_bytes); + nb_compr_bytes = (max_data_bytes-1)-redundancy_bytes; +#ifdef ENABLE_DRED + if (st->dred_duration > 0) + { + int max_celt_bytes; + opus_int32 dred_bytes = dred_bitrate_bps/(frame_rate*8); + /* Allow CELT to steal up to 25% of the remaining bits. */ + max_celt_bytes = nb_compr_bytes - dred_bytes*3/4; + /* But try to give CELT at least 5 bytes to prevent a mismatch with + the redundancy signaling. */ + max_celt_bytes = IMAX((ec_tell(&enc)+7)/8 + 5, max_celt_bytes); + /* Subject to the original max. */ + nb_compr_bytes = IMIN(nb_compr_bytes, max_celt_bytes); + } +#endif + ec_enc_shrink(&enc, nb_compr_bytes); } #ifndef DISABLE_FLOAT_API if (redundancy || st->mode != MODE_SILK_ONLY) - celt_encoder_ctl(celt_enc, CELT_SET_ANALYSIS(&analysis_info)); + celt_encoder_ctl(celt_enc, CELT_SET_ANALYSIS(analysis_info)); #endif if (st->mode == MODE_HYBRID) { SILKInfo info; @@ -2057,6 +2256,34 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ if (st->mode != MODE_SILK_ONLY) { + celt_encoder_ctl(celt_enc, OPUS_SET_VBR(st->use_vbr)); + if (st->mode == MODE_HYBRID) + { + if( st->use_vbr ) { + celt_encoder_ctl(celt_enc, OPUS_SET_BITRATE(st->bitrate_bps-st->silk_mode.bitRate)); + celt_encoder_ctl(celt_enc, OPUS_SET_VBR_CONSTRAINT(0)); + } + } else { + if (st->use_vbr) + { + celt_encoder_ctl(celt_enc, OPUS_SET_VBR(1)); + celt_encoder_ctl(celt_enc, OPUS_SET_VBR_CONSTRAINT(st->vbr_constraint)); + celt_encoder_ctl(celt_enc, OPUS_SET_BITRATE(st->bitrate_bps)); + } + } +#ifdef ENABLE_DRED + /* When Using DRED CBR, we can actually make the CELT part VBR and have DRED pick up the slack. */ + if (!st->use_vbr && st->dred_duration > 0) + { + opus_int32 celt_bitrate = st->bitrate_bps; + celt_encoder_ctl(celt_enc, OPUS_SET_VBR(1)); + celt_encoder_ctl(celt_enc, OPUS_SET_VBR_CONSTRAINT(0)); + if (st->mode == MODE_HYBRID) { + celt_bitrate -= st->silk_mode.bitRate; + } + celt_encoder_ctl(celt_enc, OPUS_SET_BITRATE(celt_bitrate)); + } +#endif if (st->mode != st->prev_mode && st->prev_mode > 0) { unsigned char dummy[2]; @@ -2069,10 +2296,6 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ /* If false, we already busted the budget and we'll end up with a "PLC frame" */ if (ec_tell(&enc) <= 8*nb_compr_bytes) { - /* Set the bitrate again if it was overridden in the redundancy code above*/ - if (redundancy && celt_to_silk && st->mode==MODE_HYBRID && st->use_vbr) - celt_encoder_ctl(celt_enc, OPUS_SET_BITRATE(st->bitrate_bps-st->silk_mode.bitRate)); - celt_encoder_ctl(celt_enc, OPUS_SET_VBR(st->use_vbr)); ret = celt_encode_with_ec(celt_enc, pcm_buf, frame_size, NULL, nb_compr_bytes, &enc); if (ret < 0) { @@ -2080,10 +2303,10 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ return OPUS_INTERNAL_ERROR; } /* Put CELT->SILK redundancy data in the right place. */ - if (redundancy && celt_to_silk && st->mode==MODE_HYBRID && st->use_vbr) + if (redundancy && celt_to_silk && st->mode==MODE_HYBRID && nb_compr_bytes != ret) { OPUS_MOVE(data+ret, data+nb_compr_bytes, redundancy_bytes); - nb_compr_bytes = nb_compr_bytes+redundancy_bytes; + nb_compr_bytes = ret+redundancy_bytes; } } } @@ -2140,7 +2363,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ /* DTX decision */ #ifndef DISABLE_FLOAT_API - if (st->use_dtx && (analysis_info.valid || is_silence)) + if (st->use_dtx && (analysis_info->valid || is_silence)) { if (decide_dtx_mode(activity, &st->nb_no_activity_ms_Q1, 2*1000*frame_size/st->Fs)) { @@ -2178,7 +2401,51 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ } /* Count ToC and redundancy */ ret += 1+redundancy_bytes; - if (!st->use_vbr) + apply_padding = !st->use_vbr; +#ifdef ENABLE_DRED + if (st->dred_duration > 0 && st->dred_encoder.loaded && first_frame) { + opus_extension_data extension; + unsigned char buf[DRED_MAX_DATA_SIZE]; + int dred_chunks; + int dred_bytes_left; + dred_chunks = IMIN((st->dred_duration+5)/4, DRED_NUM_REDUNDANCY_FRAMES/2); + if (st->use_vbr) dred_chunks = IMIN(dred_chunks, st->dred_target_chunks); + /* Remaining space for DRED, accounting for cost the 3 extra bytes for code 3, padding length, and extension number. */ + dred_bytes_left = IMIN(DRED_MAX_DATA_SIZE, max_data_bytes-ret-3); + /* Account for the extra bytes required to signal large padding length. */ + dred_bytes_left -= (dred_bytes_left+1+DRED_EXPERIMENTAL_BYTES)/255; + /* Check whether we actually have something to encode. */ + if (dred_chunks >= 1 && dred_bytes_left >= DRED_MIN_BYTES+DRED_EXPERIMENTAL_BYTES) { + int dred_bytes; +#ifdef DRED_EXPERIMENTAL_VERSION + /* Add temporary extension type and version. + These bytes will be removed once extension is finalized. */ + buf[0] = 'D'; + buf[1] = DRED_EXPERIMENTAL_VERSION; +#endif + dred_bytes = dred_encode_silk_frame(&st->dred_encoder, buf+DRED_EXPERIMENTAL_BYTES, dred_chunks, dred_bytes_left-DRED_EXPERIMENTAL_BYTES, + st->dred_q0, st->dred_dQ, st->dred_qmax, st->activity_mem, st->arch); + if (dred_bytes > 0) { + dred_bytes += DRED_EXPERIMENTAL_BYTES; + celt_assert(dred_bytes <= dred_bytes_left); + extension.id = DRED_EXTENSION_ID; + extension.frame = 0; + extension.data = buf; + extension.len = dred_bytes; + ret = opus_packet_pad_impl(data, ret, max_data_bytes, !st->use_vbr, &extension, 1); + if (ret < 0) + { + RESTORE_STACK; + return OPUS_INTERNAL_ERROR; + } + apply_padding = 0; + } + } + } +#else + (void)first_frame; /* Avoids a warning about first_frame being unused. */ +#endif + if (apply_padding) { if (opus_packet_pad(data, ret, max_data_bytes) != OPUS_OK) { @@ -2677,6 +2944,29 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) celt_encoder_ctl(celt_enc, OPUS_GET_PHASE_INVERSION_DISABLED(value)); } break; +#ifdef ENABLE_DRED + case OPUS_SET_DRED_DURATION_REQUEST: + { + opus_int32 value = va_arg(ap, opus_int32); + if(value<0 || value>DRED_MAX_FRAMES) + { + goto bad_arg; + } + st->dred_duration = value; + st->silk_mode.useDRED = !!value; + } + break; + case OPUS_GET_DRED_DURATION_REQUEST: + { + opus_int32 *value = va_arg(ap, opus_int32*); + if (!value) + { + goto bad_arg; + } + *value = st->dred_duration; + } + break; +#endif case OPUS_RESET_STATE: { void *silk_enc; @@ -2692,6 +2982,10 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) celt_encoder_ctl(celt_enc, OPUS_RESET_STATE); silk_InitEncoder( silk_enc, st->arch, &dummy ); +#ifdef ENABLE_DRED + /* Initialize DRED Encoder */ + dred_encoder_reset( &st->dred_encoder ); +#endif st->stream_channels = st->channels; st->hybrid_stereo_width_Q14 = 1 << 14; st->prev_HB_gain = Q15ONE; @@ -2752,6 +3046,21 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) } } break; +#ifdef USE_WEIGHTS_FILE + case OPUS_SET_DNN_BLOB_REQUEST: + { + const unsigned char *data = va_arg(ap, const unsigned char *); + opus_int32 len = va_arg(ap, opus_int32); + if(len<0 || data == NULL) + { + goto bad_arg; + } +#ifdef ENABLE_DRED + ret = dred_encoder_load_model(&st->dred_encoder, data, len); +#endif + } + break; +#endif case CELT_GET_MODE_REQUEST: { const CELTMode ** value = va_arg(ap, const CELTMode**); diff --git a/media/libopus/src/opus_multistream_decoder.c b/media/libopus/src/opus_multistream_decoder.c index a2837c3549..4ae877a759 100644 --- a/media/libopus/src/opus_multistream_decoder.c +++ b/media/libopus/src/opus_multistream_decoder.c @@ -162,7 +162,7 @@ static int opus_multistream_packet_validate(const unsigned char *data, if (len<=0) return OPUS_INVALID_PACKET; count = opus_packet_parse_impl(data, len, s!=nb_streams-1, &toc, NULL, - size, NULL, &packet_offset); + size, NULL, &packet_offset, NULL, NULL); if (count<0) return count; tmp_samples = opus_packet_get_nb_samples(data, packet_offset, Fs); @@ -250,7 +250,7 @@ int opus_multistream_decode_native( return OPUS_INTERNAL_ERROR; } packet_offset = 0; - ret = opus_decode_native(dec, data, len, buf, frame_size, decode_fec, s!=st->layout.nb_streams-1, &packet_offset, soft_clip); + ret = opus_decode_native(dec, data, len, buf, frame_size, decode_fec, s!=st->layout.nb_streams-1, &packet_offset, soft_clip, NULL, 0); if (!do_plc) { data += packet_offset; diff --git a/media/libopus/src/opus_multistream_encoder.c b/media/libopus/src/opus_multistream_encoder.c index 213e3eb2c2..1725ade75a 100644 --- a/media/libopus/src/opus_multistream_encoder.c +++ b/media/libopus/src/opus_multistream_encoder.c @@ -1003,7 +1003,7 @@ int opus_multistream_encode_native return OPUS_INTERNAL_ERROR; } len = opus_repacketizer_out_range_impl(&rp, 0, opus_repacketizer_get_nb_frames(&rp), - data, max_data_bytes-tot_size, s != st->layout.nb_streams-1, !vbr && s == st->layout.nb_streams-1); + data, max_data_bytes-tot_size, s != st->layout.nb_streams-1, !vbr && s == st->layout.nb_streams-1, NULL, 0); data += len; tot_size += len; } diff --git a/media/libopus/src/opus_private.h b/media/libopus/src/opus_private.h index 5e2463f546..364c21cebc 100644 --- a/media/libopus/src/opus_private.h +++ b/media/libopus/src/opus_private.h @@ -42,8 +42,17 @@ struct OpusRepacketizer { const unsigned char *frames[48]; opus_int16 len[48]; int framesize; + const unsigned char *paddings[48]; + opus_int32 padding_len[48]; }; +typedef struct { + int id; + int frame; + const unsigned char *data; + opus_int32 len; +} opus_extension_data; + typedef struct ChannelLayout { int nb_channels; int nb_streams; @@ -148,7 +157,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ int opus_decode_native(OpusDecoder *st, const unsigned char *data, opus_int32 len, opus_val16 *pcm, int frame_size, int decode_fec, int self_delimited, - opus_int32 *packet_offset, int soft_clip); + opus_int32 *packet_offset, int soft_clip, const OpusDRED *dred, opus_int32 dred_offset); /* Make sure everything is properly aligned. */ static OPUS_INLINE int align(int i) @@ -162,13 +171,18 @@ static OPUS_INLINE int align(int i) return ((i + alignment - 1) / alignment) * alignment; } +/* More than that is ridiculous for now (3 * max frames per packet)*/ +opus_int32 skip_extension(const unsigned char **data, opus_int32 len, opus_int32 *header_size); + int opus_packet_parse_impl(const unsigned char *data, opus_int32 len, int self_delimited, unsigned char *out_toc, const unsigned char *frames[48], opus_int16 size[48], - int *payload_offset, opus_int32 *packet_offset); + int *payload_offset, opus_int32 *packet_offset, + const unsigned char **padding, opus_int32 *padding_len); opus_int32 opus_repacketizer_out_range_impl(OpusRepacketizer *rp, int begin, int end, - unsigned char *data, opus_int32 maxlen, int self_delimited, int pad); + unsigned char *data, opus_int32 maxlen, int self_delimited, int pad, + const opus_extension_data *extensions, int nb_extensions); int pad_frame(unsigned char *data, opus_int32 len, opus_int32 new_len); @@ -198,4 +212,12 @@ int opus_multistream_decode_native( void *user_data ); +opus_int32 opus_packet_extensions_parse(const unsigned char *data, opus_int32 len, opus_extension_data *extensions, opus_int32 *nb_extensions); + +opus_int32 opus_packet_extensions_generate(unsigned char *data, opus_int32 len, const opus_extension_data *extensions, int nb_extensions, int pad); + +opus_int32 opus_packet_extensions_count(const unsigned char *data, opus_int32 len); + +opus_int32 opus_packet_pad_impl(unsigned char *data, opus_int32 len, opus_int32 new_len, int pad, const opus_extension_data *extensions, int nb_extensions); + #endif /* OPUS_PRIVATE_H */ diff --git a/media/libopus/src/opus_projection_encoder.c b/media/libopus/src/opus_projection_encoder.c index 06fb2d2526..92813ad01f 100644 --- a/media/libopus/src/opus_projection_encoder.c +++ b/media/libopus/src/opus_projection_encoder.c @@ -177,6 +177,20 @@ opus_int32 opus_projection_ambisonics_encoder_get_size(int channels, demixing_matrix_rows = mapping_matrix_toa_demixing.rows; demixing_matrix_cols = mapping_matrix_toa_demixing.cols; } + else if (order_plus_one == 5) + { + mixing_matrix_rows = mapping_matrix_fourthoa_mixing.rows; + mixing_matrix_cols = mapping_matrix_fourthoa_mixing.cols; + demixing_matrix_rows = mapping_matrix_fourthoa_demixing.rows; + demixing_matrix_cols = mapping_matrix_fourthoa_demixing.cols; + } + else if (order_plus_one == 6) + { + mixing_matrix_rows = mapping_matrix_fifthoa_mixing.rows; + mixing_matrix_cols = mapping_matrix_fifthoa_mixing.cols; + demixing_matrix_rows = mapping_matrix_fifthoa_demixing.rows; + demixing_matrix_cols = mapping_matrix_fifthoa_demixing.cols; + } else return 0; @@ -245,6 +259,20 @@ int opus_projection_ambisonics_encoder_init(OpusProjectionEncoder *st, opus_int3 mapping_matrix_toa_mixing_data, sizeof(mapping_matrix_toa_mixing_data)); } + else if (order_plus_one == 5) + { + mapping_matrix_init(mixing_matrix, mapping_matrix_fourthoa_mixing.rows, + mapping_matrix_fourthoa_mixing.cols, mapping_matrix_fourthoa_mixing.gain, + mapping_matrix_fourthoa_mixing_data, + sizeof(mapping_matrix_fourthoa_mixing_data)); + } + else if (order_plus_one == 6) + { + mapping_matrix_init(mixing_matrix, mapping_matrix_fifthoa_mixing.rows, + mapping_matrix_fifthoa_mixing.cols, mapping_matrix_fifthoa_mixing.gain, + mapping_matrix_fifthoa_mixing_data, + sizeof(mapping_matrix_fifthoa_mixing_data)); + } else return OPUS_BAD_ARG; @@ -276,6 +304,20 @@ int opus_projection_ambisonics_encoder_init(OpusProjectionEncoder *st, opus_int3 mapping_matrix_toa_demixing_data, sizeof(mapping_matrix_toa_demixing_data)); } + else if (order_plus_one == 5) + { + mapping_matrix_init(demixing_matrix, mapping_matrix_fourthoa_demixing.rows, + mapping_matrix_fourthoa_demixing.cols, mapping_matrix_fourthoa_demixing.gain, + mapping_matrix_fourthoa_demixing_data, + sizeof(mapping_matrix_fourthoa_demixing_data)); + } + else if (order_plus_one == 6) + { + mapping_matrix_init(demixing_matrix, mapping_matrix_fifthoa_demixing.rows, + mapping_matrix_fifthoa_demixing.cols, mapping_matrix_fifthoa_demixing.gain, + mapping_matrix_fifthoa_demixing_data, + sizeof(mapping_matrix_fifthoa_demixing_data)); + } else return OPUS_BAD_ARG; diff --git a/media/libopus/src/repacketizer.c b/media/libopus/src/repacketizer.c index bda44a148a..6a7a8b3d8e 100644 --- a/media/libopus/src/repacketizer.c +++ b/media/libopus/src/repacketizer.c @@ -32,6 +32,7 @@ #include "opus.h" #include "opus_private.h" #include "os_support.h" +#include "stack_alloc.h" int opus_repacketizer_get_size(void) @@ -82,10 +83,19 @@ static int opus_repacketizer_cat_impl(OpusRepacketizer *rp, const unsigned char return OPUS_INVALID_PACKET; } - ret=opus_packet_parse_impl(data, len, self_delimited, &tmp_toc, &rp->frames[rp->nb_frames], &rp->len[rp->nb_frames], NULL, NULL); + ret=opus_packet_parse_impl(data, len, self_delimited, &tmp_toc, &rp->frames[rp->nb_frames], &rp->len[rp->nb_frames], + NULL, NULL, &rp->paddings[rp->nb_frames], &rp->padding_len[rp->nb_frames]); if(ret<1)return ret; - rp->nb_frames += curr_nb_frames; + /* set padding length to zero for all but the first frame */ + while (curr_nb_frames > 1) + { + rp->nb_frames++; + rp->padding_len[rp->nb_frames] = 0; + rp->paddings[rp->nb_frames] = NULL; + curr_nb_frames--; + } + rp->nb_frames++; return OPUS_OK; } @@ -100,17 +110,23 @@ int opus_repacketizer_get_nb_frames(OpusRepacketizer *rp) } opus_int32 opus_repacketizer_out_range_impl(OpusRepacketizer *rp, int begin, int end, - unsigned char *data, opus_int32 maxlen, int self_delimited, int pad) + unsigned char *data, opus_int32 maxlen, int self_delimited, int pad, const opus_extension_data *extensions, int nb_extensions) { int i, count; opus_int32 tot_size; opus_int16 *len; const unsigned char **frames; unsigned char * ptr; + int ones_begin=0, ones_end=0; + int ext_begin=0, ext_len=0; + int ext_count, total_ext_count; + VARDECL(opus_extension_data, all_extensions); + SAVE_STACK; if (begin<0 || begin>=end || end>rp->nb_frames) { /*fprintf(stderr, "%d %d %d\n", begin, end, rp->nb_frames);*/ + RESTORE_STACK; return OPUS_BAD_ARG; } count = end-begin; @@ -122,13 +138,50 @@ opus_int32 opus_repacketizer_out_range_impl(OpusRepacketizer *rp, int begin, int else tot_size = 0; + /* figure out total number of extensions */ + total_ext_count = nb_extensions; + for (i=begin;i<end;i++) + { + int n = opus_packet_extensions_count(rp->paddings[i], rp->padding_len[i]); + if (n > 0) total_ext_count += n; + } + ALLOC(all_extensions, total_ext_count ? total_ext_count : ALLOC_NONE, opus_extension_data); + /* copy over any extensions that were passed in */ + for (ext_count=0;ext_count<nb_extensions;ext_count++) + { + all_extensions[ext_count] = extensions[ext_count]; + } + + /* incorporate any extensions from the repacketizer padding */ + for (i=begin;i<end;i++) + { + int frame_ext_count, j; + frame_ext_count = total_ext_count - ext_count; + int ret = opus_packet_extensions_parse(rp->paddings[i], rp->padding_len[i], + &all_extensions[ext_count], &frame_ext_count); + if (ret<0) + { + RESTORE_STACK; + return OPUS_INTERNAL_ERROR; + } + /* renumber the extension frame numbers */ + for (j=0;j<frame_ext_count;j++) + { + all_extensions[ext_count+j].frame += i-begin; + } + ext_count += frame_ext_count; + } + ptr = data; if (count==1) { /* Code 0 */ tot_size += len[0]+1; if (tot_size > maxlen) + { + RESTORE_STACK; return OPUS_BUFFER_TOO_SMALL; + } *ptr++ = rp->toc&0xFC; } else if (count==2) { @@ -137,18 +190,24 @@ opus_int32 opus_repacketizer_out_range_impl(OpusRepacketizer *rp, int begin, int /* Code 1 */ tot_size += 2*len[0]+1; if (tot_size > maxlen) + { + RESTORE_STACK; return OPUS_BUFFER_TOO_SMALL; + } *ptr++ = (rp->toc&0xFC) | 0x1; } else { /* Code 2 */ tot_size += len[0]+len[1]+2+(len[0]>=252); if (tot_size > maxlen) + { + RESTORE_STACK; return OPUS_BUFFER_TOO_SMALL; + } *ptr++ = (rp->toc&0xFC) | 0x2; ptr += encode_size(len[0], ptr); } } - if (count > 2 || (pad && tot_size < maxlen)) + if (count > 2 || (pad && tot_size < maxlen) || ext_count > 0) { /* Code 3 */ int vbr; @@ -177,22 +236,45 @@ opus_int32 opus_repacketizer_out_range_impl(OpusRepacketizer *rp, int begin, int tot_size += len[count-1]; if (tot_size > maxlen) + { + RESTORE_STACK; return OPUS_BUFFER_TOO_SMALL; + } *ptr++ = (rp->toc&0xFC) | 0x3; *ptr++ = count | 0x80; } else { tot_size += count*len[0]+2; if (tot_size > maxlen) + { + RESTORE_STACK; return OPUS_BUFFER_TOO_SMALL; + } *ptr++ = (rp->toc&0xFC) | 0x3; *ptr++ = count; } pad_amount = pad ? (maxlen-tot_size) : 0; + if (ext_count>0) + { + /* figure out how much space we need for the extensions */ + ext_len = opus_packet_extensions_generate(NULL, maxlen-tot_size, all_extensions, ext_count, 0); + if (ext_len < 0) return ext_len; + if (!pad) + pad_amount = ext_len + ext_len/254 + 1; + } if (pad_amount != 0) { int nb_255s; data[1] |= 0x40; nb_255s = (pad_amount-1)/255; + if (tot_size + ext_len + nb_255s + 1 > maxlen) + { + RESTORE_STACK; + return OPUS_BUFFER_TOO_SMALL; + } + ext_begin = tot_size+pad_amount-ext_len; + /* Prepend 0x01 padding */ + ones_begin = tot_size+nb_255s+1; + ones_end = tot_size+pad_amount-ext_len; for (i=0;i<nb_255s;i++) *ptr++ = 255; *ptr++ = pad_amount-255*nb_255s-1; @@ -218,42 +300,62 @@ opus_int32 opus_repacketizer_out_range_impl(OpusRepacketizer *rp, int begin, int OPUS_MOVE(ptr, frames[i], len[i]); ptr += len[i]; } - if (pad) + if (ext_len > 0) { + int ret = opus_packet_extensions_generate(&data[ext_begin], ext_len, all_extensions, ext_count, 0); + celt_assert(ret == ext_len); + } + for (i=ones_begin;i<ones_end;i++) + data[i] = 0x01; + if (pad && ext_count==0) { /* Fill padding with zeros. */ while (ptr<data+maxlen) *ptr++=0; } + RESTORE_STACK; return tot_size; } opus_int32 opus_repacketizer_out_range(OpusRepacketizer *rp, int begin, int end, unsigned char *data, opus_int32 maxlen) { - return opus_repacketizer_out_range_impl(rp, begin, end, data, maxlen, 0, 0); + return opus_repacketizer_out_range_impl(rp, begin, end, data, maxlen, 0, 0, NULL, 0); } opus_int32 opus_repacketizer_out(OpusRepacketizer *rp, unsigned char *data, opus_int32 maxlen) { - return opus_repacketizer_out_range_impl(rp, 0, rp->nb_frames, data, maxlen, 0, 0); + return opus_repacketizer_out_range_impl(rp, 0, rp->nb_frames, data, maxlen, 0, 0, NULL, 0); } -int opus_packet_pad(unsigned char *data, opus_int32 len, opus_int32 new_len) +opus_int32 opus_packet_pad_impl(unsigned char *data, opus_int32 len, opus_int32 new_len, int pad, const opus_extension_data *extensions, int nb_extensions) { OpusRepacketizer rp; opus_int32 ret; + VARDECL(unsigned char, copy); + SAVE_STACK; if (len < 1) return OPUS_BAD_ARG; if (len==new_len) return OPUS_OK; else if (len > new_len) return OPUS_BAD_ARG; + ALLOC(copy, len, unsigned char); opus_repacketizer_init(&rp); /* Moving payload to the end of the packet so we can do in-place padding */ - OPUS_MOVE(data+new_len-len, data, len); - ret = opus_repacketizer_cat(&rp, data+new_len-len, len); + OPUS_COPY(copy, data, len); + ret = opus_repacketizer_cat(&rp, copy, len); if (ret != OPUS_OK) return ret; - ret = opus_repacketizer_out_range_impl(&rp, 0, rp.nb_frames, data, new_len, 0, 1); + ret = opus_repacketizer_out_range_impl(&rp, 0, rp.nb_frames, data, new_len, 0, pad, extensions, nb_extensions); + RESTORE_STACK; + return ret; +} + +int opus_packet_pad(unsigned char *data, opus_int32 len, opus_int32 new_len) +{ + opus_int32 ret; + ALLOC_STACK; + ret = opus_packet_pad_impl(data, len, new_len, 1, NULL, 0); + RESTORE_STACK; if (ret > 0) return OPUS_OK; else @@ -264,13 +366,19 @@ opus_int32 opus_packet_unpad(unsigned char *data, opus_int32 len) { OpusRepacketizer rp; opus_int32 ret; + int i; if (len < 1) return OPUS_BAD_ARG; opus_repacketizer_init(&rp); ret = opus_repacketizer_cat(&rp, data, len); if (ret < 0) return ret; - ret = opus_repacketizer_out_range_impl(&rp, 0, rp.nb_frames, data, len, 0, 0); + /* Discard all padding and extensions. */ + for (i=0;i<rp.nb_frames;i++) { + rp.padding_len[i] = 0; + rp.paddings[i] = NULL; + } + ret = opus_repacketizer_out_range_impl(&rp, 0, rp.nb_frames, data, len, 0, 0, NULL, 0); celt_assert(ret > 0 && ret <= len); return ret; } @@ -297,7 +405,7 @@ int opus_multistream_packet_pad(unsigned char *data, opus_int32 len, opus_int32 if (len<=0) return OPUS_INVALID_PACKET; count = opus_packet_parse_impl(data, len, 1, &toc, NULL, - size, NULL, &packet_offset); + size, NULL, &packet_offset, NULL, NULL); if (count<0) return count; data += packet_offset; @@ -324,18 +432,24 @@ opus_int32 opus_multistream_packet_unpad(unsigned char *data, opus_int32 len, in for (s=0;s<nb_streams;s++) { opus_int32 ret; + int i; int self_delimited = s!=nb_streams-1; if (len<=0) return OPUS_INVALID_PACKET; opus_repacketizer_init(&rp); ret = opus_packet_parse_impl(data, len, self_delimited, &toc, NULL, - size, NULL, &packet_offset); + size, NULL, &packet_offset, NULL, NULL); if (ret<0) return ret; ret = opus_repacketizer_cat_impl(&rp, data, packet_offset, self_delimited); if (ret < 0) return ret; - ret = opus_repacketizer_out_range_impl(&rp, 0, rp.nb_frames, dst, len, self_delimited, 0); + /* Discard all padding and extensions. */ + for (i=0;i<rp.nb_frames;i++) { + rp.padding_len[i] = 0; + rp.paddings[i] = NULL; + } + ret = opus_repacketizer_out_range_impl(&rp, 0, rp.nb_frames, dst, len, self_delimited, 0, NULL, 0); if (ret < 0) return ret; else diff --git a/media/libopus/src/tansig_table.h b/media/libopus/src/tansig_table.h deleted file mode 100644 index c76f844a72..0000000000 --- a/media/libopus/src/tansig_table.h +++ /dev/null @@ -1,45 +0,0 @@ -/* This file is auto-generated by gen_tables */ - -static const float tansig_table[201] = { -0.000000f, 0.039979f, 0.079830f, 0.119427f, 0.158649f, -0.197375f, 0.235496f, 0.272905f, 0.309507f, 0.345214f, -0.379949f, 0.413644f, 0.446244f, 0.477700f, 0.507977f, -0.537050f, 0.564900f, 0.591519f, 0.616909f, 0.641077f, -0.664037f, 0.685809f, 0.706419f, 0.725897f, 0.744277f, -0.761594f, 0.777888f, 0.793199f, 0.807569f, 0.821040f, -0.833655f, 0.845456f, 0.856485f, 0.866784f, 0.876393f, -0.885352f, 0.893698f, 0.901468f, 0.908698f, 0.915420f, -0.921669f, 0.927473f, 0.932862f, 0.937863f, 0.942503f, -0.946806f, 0.950795f, 0.954492f, 0.957917f, 0.961090f, -0.964028f, 0.966747f, 0.969265f, 0.971594f, 0.973749f, -0.975743f, 0.977587f, 0.979293f, 0.980869f, 0.982327f, -0.983675f, 0.984921f, 0.986072f, 0.987136f, 0.988119f, -0.989027f, 0.989867f, 0.990642f, 0.991359f, 0.992020f, -0.992631f, 0.993196f, 0.993718f, 0.994199f, 0.994644f, -0.995055f, 0.995434f, 0.995784f, 0.996108f, 0.996407f, -0.996682f, 0.996937f, 0.997172f, 0.997389f, 0.997590f, -0.997775f, 0.997946f, 0.998104f, 0.998249f, 0.998384f, -0.998508f, 0.998623f, 0.998728f, 0.998826f, 0.998916f, -0.999000f, 0.999076f, 0.999147f, 0.999213f, 0.999273f, -0.999329f, 0.999381f, 0.999428f, 0.999472f, 0.999513f, -0.999550f, 0.999585f, 0.999617f, 0.999646f, 0.999673f, -0.999699f, 0.999722f, 0.999743f, 0.999763f, 0.999781f, -0.999798f, 0.999813f, 0.999828f, 0.999841f, 0.999853f, -0.999865f, 0.999875f, 0.999885f, 0.999893f, 0.999902f, -0.999909f, 0.999916f, 0.999923f, 0.999929f, 0.999934f, -0.999939f, 0.999944f, 0.999948f, 0.999952f, 0.999956f, -0.999959f, 0.999962f, 0.999965f, 0.999968f, 0.999970f, -0.999973f, 0.999975f, 0.999977f, 0.999978f, 0.999980f, -0.999982f, 0.999983f, 0.999984f, 0.999986f, 0.999987f, -0.999988f, 0.999989f, 0.999990f, 0.999990f, 0.999991f, -0.999992f, 0.999992f, 0.999993f, 0.999994f, 0.999994f, -0.999994f, 0.999995f, 0.999995f, 0.999996f, 0.999996f, -0.999996f, 0.999997f, 0.999997f, 0.999997f, 0.999997f, -0.999997f, 0.999998f, 0.999998f, 0.999998f, 0.999998f, -0.999998f, 0.999998f, 0.999999f, 0.999999f, 0.999999f, -0.999999f, 0.999999f, 0.999999f, 0.999999f, 0.999999f, -0.999999f, 0.999999f, 0.999999f, 0.999999f, 0.999999f, -1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, -1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, -1.000000f, -}; diff --git a/media/libpng/1737038.patch b/media/libpng/1737038.patch index 10d6129a6e..ef6835c3ab 100644 --- a/media/libpng/1737038.patch +++ b/media/libpng/1737038.patch @@ -1,7 +1,7 @@ diff --git a/pngwutil.c b/pngwutil.c --- a/pngwutil.c +++ b/pngwutil.c -@@ -336,8 +336,10 @@ png_deflate_claim(png_structrp png_ptr, +@@ -336,8 +336,10 @@ png_deflate_claim(png_structrp png_ptr, if ((png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_STRATEGY) != 0) strategy = png_ptr->zlib_strategy; @@ -12,7 +12,7 @@ diff --git a/pngwutil.c b/pngwutil.c else strategy = PNG_Z_DEFAULT_NOFILTER_STRATEGY; -@@ -828,12 +830,16 @@ png_write_IHDR(png_structrp png_ptr, png +@@ -823,12 +825,16 @@ png_write_IHDR(png_structrp png_ptr, png if ((png_ptr->do_filter) == PNG_NO_FILTERS) { diff --git a/media/libpng/ANNOUNCE b/media/libpng/ANNOUNCE index 5675b973ab..bc147adb78 100644 --- a/media/libpng/ANNOUNCE +++ b/media/libpng/ANNOUNCE @@ -1,4 +1,4 @@ -libpng 1.6.39 - November 20, 2022 +libpng 1.6.43 - February 23, 2024 ================================= This is a public release of libpng, intended for use in production code. @@ -9,13 +9,13 @@ Files available for download Source files with LF line endings (for Unix/Linux): - * libpng-1.6.39.tar.xz (LZMA-compressed, recommended) - * libpng-1.6.39.tar.gz + * libpng-1.6.43.tar.xz (LZMA-compressed, recommended) + * libpng-1.6.43.tar.gz (deflate-compressed) Source files with CRLF line endings (for Windows): - * lpng1639.7z (LZMA-compressed, recommended) - * lpng1639.zip + * lpng1643.7z (LZMA-compressed, recommended) + * lpng1643.zip (deflate-compressed) Other information: @@ -25,19 +25,36 @@ Other information: * TRADEMARK.md -Changes from version 1.6.38 to version 1.6.39 +Changes from version 1.6.42 to version 1.6.43 --------------------------------------------- - * Changed the error handler of oversized chunks (i.e. larger than - PNG_USER_CHUNK_MALLOC_MAX) from png_chunk_error to png_benign_error. - * Fixed a buffer overflow error in contrib/tools/pngfix. - * Fixed a memory leak (CVE-2019-6129) in contrib/tools/pngcp. - * Disabled the ARM Neon optimizations by default in the CMake file, - following the default behavior of the configure script. - * Allowed configure.ac to work with the trunk version of autoconf. - * Removed the support for "install" targets from the legacy makefiles; - removed the obsolete makefile.cegcc. - * Cleaned up the code and updated the internal documentation. + * Fixed the row width check in png_check_IHDR(). + This corrected a bug that was specific to the 16-bit platforms, + and removed a spurious compiler warning from the 64-bit builds. + (Reported by Jacek Caban; fixed by John Bowler) + * Added eXIf chunk support to the push-mode reader in pngpread.c. + (Contributed by Chris Blume) + * Added contrib/pngexif for the benefit of the users who would like + to inspect the content of eXIf chunks. + * Added contrib/conftest/basic.dfa, a basic build-time configuration. + (Contributed by John Bowler) + * Fixed a preprocessor condition in pngread.c that broke build-time + configurations like contrib/conftest/pngcp.dfa. + (Contributed by John Bowler) + * Added CMake build support for LoongArch LSX. + (Contributed by GuXiWei) + * Fixed a CMake build error that occurred under a peculiar state of the + dependency tree. This was a regression introduced in libpng-1.6.41. + (Contributed by Dan Rosser) + * Marked the installed libpng headers as system headers in CMake. + (Contributed by Benjamin Buch) + * Updated the build support for RISCOS. + (Contributed by Cameron Cawley) + * Updated the makefiles to allow cross-platform builds to initialize + conventional make variables like AR and ARFLAGS. + * Added various improvements to the CI scripts in areas like version + consistency verification and text linting. + * Added version consistency verification to pngtest.c also. Send comments/corrections/commendations to png-mng-implement at lists.sf.net. diff --git a/media/libpng/AUTHORS b/media/libpng/AUTHORS index 9a8e3869ec..544341694a 100644 --- a/media/libpng/AUTHORS +++ b/media/libpng/AUTHORS @@ -4,7 +4,9 @@ PNG REFERENCE LIBRARY AUTHORS This is the list of PNG Reference Library ("libpng") Contributing Authors, for copyright and licensing purposes. + * Adam Richter * Andreas Dilger + * Chris Blume * Cosmin Truta * Dave Martindale * Eric S. Raymond @@ -22,6 +24,7 @@ Authors, for copyright and licensing purposes. * Mike Klein * Pascal Massimino * Paul Schmidt + * Philippe Antoine * Qiang Zhou * Sam Bushell * Samuel Williams @@ -32,19 +35,27 @@ Authors, for copyright and licensing purposes. * Vadim Barkov * Willem van Schaik * Zhijie Liang + * Apple Inc. + - Zixu Wang (王子旭) * Arm Holdings - - Richard Townsend + - Richard Townsend * Google Inc. - - Dan Field - - Leon Scroggins III - - Matt Sarett - - Mike Klein - - Sami Boukortt + - Dan Field + - Leon Scroggins III + - Matt Sarett + - Mike Klein + - Sami Boukortt + - Wan-Teh Chang + * Loongson Technology Corporation Ltd. + - GuXiWei (顾希伟) + - JinBo (金波) + - ZhangLixia (张利霞) The build projects, the build scripts, the test scripts, and other -files in the "ci", "projects", "scripts" and "tests" directories, have +files in the "projects", "scripts" and "tests" directories, have other copyright owners, but are released under the libpng license. -Some files in the "contrib" directory, and some tools-generated files -that are distributed with libpng, have other copyright owners, and are -released under other open source licenses. +Some files in the "ci" and "contrib" directories, as well as some +of the tools-generated files that are distributed with libpng, have +other copyright owners, and are released under other open source +licenses. diff --git a/media/libpng/CHANGES b/media/libpng/CHANGES index 366e0f6a7b..441b57ecf1 100644 --- a/media/libpng/CHANGES +++ b/media/libpng/CHANGES @@ -204,7 +204,7 @@ Version 0.97 [January, 1998] Added simple sRGB support (Glenn R-P) Easier conditional compiling, e.g., define PNG_READ/WRITE_NOT_FULLY_SUPPORTED; - all configurable options can be selected from command-line instead + all configurable options can be selected from command line instead of having to edit pngconf.h (Glenn R-P) Fixed memory leak in pngwrite.c (free info_ptr->text) (Glenn R-P) Added more conditions for png_do_background, to avoid changing @@ -942,7 +942,7 @@ Version 1.0.8 [July 24, 2000] Version 1.0.9beta1 [November 10, 2000] Fixed typo in scripts/makefile.hpux Updated makevms.com in scripts and contrib/* and contrib/* (Martin Zinser) - Fixed seqence-point bug in contrib/pngminus/png2pnm (Martin Zinser) + Fixed sequence-point bug in contrib/pngminus/png2pnm (Martin Zinser) Changed "cdrom.com" in documentation to "libpng.org" Revised pnggccrd.c to get it all working, and updated makefile.gcmmx (Greg). Changed type of "params" from voidp to png_voidp in png_read|write_png(). @@ -2295,7 +2295,7 @@ Version 1.4.0beta58 [May 14, 2009] Clarified usage of sig_bit versus sig_bit_p in example.c (Vincent Torri) Version 1.4.0beta59 [May 15, 2009] - Reformated sources in libpng style (3-space indentation, comment format) + Reformatted sources in libpng style (3-space indentation, comment format) Fixed typo in libpng docs (PNG_FILTER_AVE should be PNG_FILTER_AVG) Added sections about the git repository and our coding style to the documentation @@ -2661,7 +2661,7 @@ Version 1.4.1beta06 [January 28, 2010] Version 1.4.1beta07 [February 6, 2010] Folded some long lines in the source files. - Added defineable PNG_USER_CHUNK_CACHE_MAX, PNG_USER_CHUNK_MALLOC_MAX, + Added definable PNG_USER_CHUNK_CACHE_MAX, PNG_USER_CHUNK_MALLOC_MAX, and a PNG_USER_LIMITS_SUPPORTED flag. Eliminated use of png_ptr->irowbytes and reused the slot in png_ptr as png_ptr->png_user_chunk_malloc_max. @@ -3919,7 +3919,7 @@ Version 1.6.0beta08 [February 1, 2012] version checking to configure.ac Improved pngstest speed by not doing redundant tests and add const to the background parameter of png_image_finish_read. The --background - option is now done automagically only when required, so that commandline + option is now done automagically only when required, so that command-line option no longer exists. Cleaned up pngpriv.h to consistently declare all functions and data. Also eliminated PNG_CONST_DATA, which is apparently not needed but we @@ -5927,7 +5927,7 @@ Version 1.6.32beta03 [August 2, 2017] (Bug report from the OSS-fuzz project). Version 1.6.32beta04 [August 2, 2017] - Replaced local eXIf_buf with info_ptr-eXIf_buf in png_handle_eXIf(). + Replaced local eXIf_buf with info_ptr->eXIf_buf in png_handle_eXIf(). Update libpng.3 and libpng-manual.txt about eXIf functions. Version 1.6.32beta05 [August 2, 2017] @@ -6121,6 +6121,81 @@ Version 1.6.39 [November 20, 2022] removed the obsolete makefile.cegcc. Cleaned up the code and updated the internal documentation. +Version 1.6.40 [June 21, 2023] + Fixed the eXIf chunk multiplicity checks. + Fixed a memory leak in pCAL processing. + Corrected the validity report about tRNS inside png_get_valid(). + Fixed various build issues on *BSD, Mac and Windows. + Updated the configurations and the scripts for continuous integration. + Cleaned up the code, the build scripts, and the documentation. + +Version 1.6.41 [January 24, 2024] + Added SIMD-optimized code for the LoongArch LSX hardware. + (Contributed by GuXiWei, JinBo and ZhangLixia) + Fixed the run-time discovery of MIPS MSA hardware. + (Contributed by Sui Jingfeng) + Fixed an off-by-one error in the function png_do_check_palette_indexes(), + which failed to recognize errors that might have existed in the first + column of a broken palette-encoded image. This was a benign regression + accidentally introduced in libpng-1.6.33. No pixel was harmed. + (Contributed by Adam Richter; reviewed by John Bowler) + Fixed, improved and modernized the contrib/pngminus programs, i.e., + png2pnm.c and pnm2png.c + Removed old and peculiar portability hacks that were meant to silence + warnings issued by gcc version 7.1 alone. + (Contributed by John Bowler) + Fixed and modernized the CMake file, and raised the minimum required + CMake version from 3.1 to 3.6. + (Contributed by Clinton Ingram, Timothy Lyanguzov, Tyler Kropp, et al.) + Allowed the configure script to disable the building of auxiliary tools + and tests, thus catching up with the CMake file. + (Contributed by Carlo Bramini) + Fixed a build issue on Mac. + (Contributed by Zixu Wang) + Moved the Autoconf macro files to scripts/autoconf. + Moved the CMake files (except for the main CMakeLists.txt) to + scripts/cmake and moved the list of their contributing authors to + scripts/cmake/AUTHORS.md + Updated the CI configurations and scripts. + Relicensed the CI scripts to the MIT License. + Improved the test coverage. + (Contributed by John Bowler) + +Version 1.6.42 [January 29, 2024] + Fixed the implementation of the macro function png_check_sig(). + This was an API regression, introduced in libpng-1.6.41. + (Reported by Matthieu Darbois) + Fixed and updated the libpng manual. + +Version 1.6.43 [February 23, 2024] + Fixed the row width check in png_check_IHDR(). + This corrected a bug that was specific to the 16-bit platforms, + and removed a spurious compiler warning from the 64-bit builds. + (Reported by Jacek Caban; fixed by John Bowler) + Added eXIf chunk support to the push-mode reader in pngpread.c. + (Contributed by Chris Blume) + Added contrib/pngexif for the benefit of the users who would like + to inspect the content of eXIf chunks. + Added contrib/conftest/basic.dfa, a basic build-time configuration. + (Contributed by John Bowler) + Fixed a preprocessor condition in pngread.c that broke build-time + configurations like contrib/conftest/pngcp.dfa. + (Contributed by John Bowler) + Added CMake build support for LoongArch LSX. + (Contributed by GuXiWei) + Fixed a CMake build error that occurred under a peculiar state of the + dependency tree. This was a regression introduced in libpng-1.6.41. + (Contributed by Dan Rosser) + Marked the installed libpng headers as system headers in CMake. + (Contributed by Benjamin Buch) + Updated the build support for RISCOS. + (Contributed by Cameron Cawley) + Updated the makefiles to allow cross-platform builds to initialize + conventional make variables like AR and ARFLAGS. + Added various improvements to the CI scripts in areas like version + consistency verification and text linting. + Added version consistency verification to pngtest.c also. + Send comments/corrections/commendations to png-mng-implement at lists.sf.net. Subscription is required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-implement diff --git a/media/libpng/LICENSE b/media/libpng/LICENSE index c8ad24eecf..25f298f0fc 100644 --- a/media/libpng/LICENSE +++ b/media/libpng/LICENSE @@ -4,8 +4,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE PNG Reference Library License version 2 --------------------------------------- - * Copyright (c) 1995-2022 The PNG Reference Library Authors. - * Copyright (c) 2018-2022 Cosmin Truta. + * Copyright (c) 1995-2024 The PNG Reference Library Authors. + * Copyright (c) 2018-2024 Cosmin Truta. * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson. * Copyright (c) 1996-1997 Andreas Dilger. * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. diff --git a/media/libpng/README b/media/libpng/README index 097a3c2184..a6ca3ae9f9 100644 --- a/media/libpng/README +++ b/media/libpng/README @@ -1,110 +1,108 @@ -README for libpng version 1.6.39 +README for libpng version 1.6.43 ================================ -See the note about version numbers near the top of png.h. -See INSTALL for instructions on how to install libpng. +See the note about version numbers near the top of `png.h`. +See `INSTALL` for instructions on how to install libpng. -Libpng comes in several distribution formats. Get libpng-*.tar.gz or -libpng-*.tar.xz if you want UNIX-style line endings in the text files, -or lpng*.7z or lpng*.zip if you want DOS-style line endings. +Libpng comes in several distribution formats. Get `libpng-*.tar.gz` +or `libpng-*.tar.xz` if you want UNIX-style line endings in the text +files, or `lpng*.7z` or `lpng*.zip` if you want DOS-style line endings. -Version 0.89 was the first official release of libpng. Don't let the -fact that it's the first release fool you. The libpng library has been -in extensive use and testing since mid-1995. By late 1997 it had -finally gotten to the stage where there hadn't been significant -changes to the API in some time, and people have a bad feeling about -libraries with versions < 1.0. Version 1.0.0 was released in -March 1998. +For a detailed description on using libpng, read `libpng-manual.txt`. +For examples of libpng in a program, see `example.c` and `pngtest.c`. +For usage information and restrictions (what little they are) on libpng, +see `png.h`. For a description on using zlib (the compression library +used by libpng) and zlib's restrictions, see `zlib.h`. -**** -Note that some of the changes to the png_info structure render this -version of the library binary incompatible with libpng-0.89 or -earlier versions if you are using a shared library. The type of the -"filler" parameter for png_set_filler() has changed from png_byte to -png_uint_32, which will affect shared-library applications that use -this function. - -To avoid problems with changes to the internals of the png info_struct, -new APIs have been made available in 0.95 to avoid direct application -access to info_ptr. These functions are the png_set_<chunk> and -png_get_<chunk> functions. These functions should be used when -accessing/storing the info_struct data, rather than manipulating it -directly, to avoid such problems in the future. - -It is important to note that the APIs did not make current programs -that access the info struct directly incompatible with the new -library, through libpng-1.2.x. In libpng-1.4.x, which was meant to -be a transitional release, members of the png_struct and the -info_struct can still be accessed, but the compiler will issue a -warning about deprecated usage. Since libpng-1.5.0, direct access -to these structs is not allowed, and the definitions of the structs -reside in private pngstruct.h and pnginfo.h header files that are not -accessible to applications. It is strongly suggested that new -programs use the new APIs (as shown in example.c and pngtest.c), and -older programs be converted to the new format, to facilitate upgrades -in the future. -**** - -Additions since 0.90 include the ability to compile libpng as a -Windows DLL, and new APIs for accessing data in the info struct. -Experimental functions include the ability to set weighting and cost -factors for row filter selection, direct reads of integers from buffers -on big-endian processors that support misaligned data access, faster -methods of doing alpha composition, and more accurate 16->8 bit color -conversion. - -The additions since 0.89 include the ability to read from a PNG stream -which has had some (or all) of the signature bytes read by the calling -application. This also allows the reading of embedded PNG streams that -do not have the PNG file signature. As well, it is now possible to set -the library action on the detection of chunk CRC errors. It is possible -to set different actions based on whether the CRC error occurred in a -critical or an ancillary chunk. - -For a detailed description on using libpng, read libpng-manual.txt. -For examples of libpng in a program, see example.c and pngtest.c. For -usage information and restrictions (what little they are) on libpng, -see png.h. For a description on using zlib (the compression library -used by libpng) and zlib's restrictions, see zlib.h - -I have included a general makefile, as well as several machine and -compiler specific ones, but you may have to modify one for your own -needs. - -You should use zlib 1.0.4 or later to run this, but it MAY work with +You should use zlib 1.0.4 or later to run this, but it _may_ work with versions as old as zlib 0.95. Even so, there are bugs in older zlib versions which can cause the output of invalid compression streams for some images. You should also note that zlib is a compression library that is useful for more things than just PNG files. You can use zlib as a drop-in -replacement for fread() and fwrite(), if you are so inclined. +replacement for `fread()` and `fwrite()`, if you are so inclined. zlib should be available at the same place that libpng is, or at -https://zlib.net. +https://zlib.net . You may also want a copy of the PNG specification. It is available as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find these at http://www.libpng.org/pub/png/pngdocs.html . -This code is currently being archived at libpng.sourceforge.io in the -[DOWNLOAD] area, and at http://libpng.download/src . +This code is currently being archived at https://libpng.sourceforge.io +in the download area, and at http://libpng.download/src . This release, based in a large way on Glenn's, Guy's and Andreas' earlier work, was created and will be supported by myself and the PNG development group. -Send comments/corrections/commendations to png-mng-implement at -lists.sourceforge.net (subscription required; visit +Send comments, corrections and commendations to `png-mng-implement` +at `lists.sourceforge.net`. (Subscription is required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-implement -to subscribe). +to subscribe.) + +Send general questions about the PNG specification to `png-mng-misc` +at `lists.sourceforge.net`. (Subscription is required; visit +https://lists.sourceforge.net/lists/listinfo/png-mng-misc +to subscribe.) -Send general questions about the PNG specification to png-mng-misc -at lists.sourceforge.net (subscription required; visit -https://lists.sourceforge.net/lists/listinfo/png-mng-misc to -subscribe). +Historical notes +---------------- + +The libpng library has been in extensive use and testing since mid-1995. +Version 0.89, published a year later, was the first official release. +By late 1997, it had finally gotten to the stage where there hadn't +been significant changes to the API in some time, and people have a bad +feeling about libraries with versions below 1.0. Version 1.0.0 was +released in March 1998. + +Note that some of the changes to the `png_info` structure render this +version of the library binary incompatible with libpng-0.89 or +earlier versions if you are using a shared library. The type of the +`filler` parameter for `png_set_filler()` has changed from `png_byte` +to `png_uint_32`, which will affect shared-library applications that +use this function. + +To avoid problems with changes to the internals of the `info_struct`, +new APIs have been made available in 0.95 to avoid direct application +access to `info_ptr`. These functions are the `png_set_<chunk>` and +`png_get_<chunk>` functions. These functions should be used when +accessing/storing the `info_struct` data, rather than manipulating it +directly, to avoid such problems in the future. + +It is important to note that the APIs did not make current programs +that access the info struct directly incompatible with the new +library, through libpng-1.2.x. In libpng-1.4.x, which was meant to +be a transitional release, members of the `png_struct` and the +`info_struct` can still be accessed, but the compiler will issue a +warning about deprecated usage. Since libpng-1.5.0, direct access +to these structs is not allowed, and the definitions of the structs +reside in private `pngstruct.h` and `pnginfo.h` header files that are +not accessible to applications. It is strongly suggested that new +programs use the new APIs (as shown in `example.c` and `pngtest.c`), +and older programs be converted to the new format, to facilitate +upgrades in the future. + +The additions since 0.89 include the ability to read from a PNG stream +which has had some (or all) of the signature bytes read by the calling +application. This also allows the reading of embedded PNG streams that +do not have the PNG file signature. As well, it is now possible to set +the library action on the detection of chunk CRC errors. It is possible +to set different actions based on whether the CRC error occurred in a +critical or an ancillary chunk. + +The additions since 0.90 include the ability to compile libpng as a +Windows DLL, and new APIs for accessing data in the `info_struct`. +Experimental functions included the ability to set weighting and cost +factors for row filter selection, direct reads of integers from buffers +on big-endian processors that support misaligned data access, faster +methods of doing alpha composition, and more accurate 16-to-8 bit color +conversion. Some of these experimental functions, such as the weighted +filter heuristics, have since been removed. -Files in this distribution: +Files included in this distribution +----------------------------------- ANNOUNCE => Announcement of this version, with recent changes AUTHORS => List of contributing authors @@ -144,22 +142,24 @@ Files in this distribution: pngwrite.c => High-level write functions pngwtran.c => Write data transformations pngwutil.c => Write utility functions - arm/ => Optimized code for the ARM platform - intel/ => Optimized code for the INTEL-SSE2 platform - mips/ => Optimized code for the MIPS platform - powerpc/ => Optimized code for the PowerPC platform + arm/ => Optimized code for ARM Neon + intel/ => Optimized code for INTEL SSE2 + loongarch/ => Optimized code for LoongArch LSX + mips/ => Optimized code for MIPS MSA and MIPS MMI + powerpc/ => Optimized code for PowerPC VSX ci/ => Scripts for continuous integration contrib/ => External contributions arm-neon/ => Optimized code for the ARM-NEON platform mips-msa/ => Optimized code for the MIPS-MSA platform powerpc-vsx/ => Optimized code for the POWERPC-VSX platform - examples/ => Example programs + examples/ => Examples of libpng usage gregbook/ => Source code for PNG reading and writing, from "PNG: The Definitive Guide" by Greg Roelofs, O'Reilly, 1999 libtests/ => Test programs oss-fuzz/ => Files used by the OSS-Fuzz project for fuzz-testing libpng + pngexif/ => Program to inspect the EXIF information in PNG files pngminim/ => Minimal decoder, encoder, and progressive decoder programs demonstrating the use of pngusr.dfa pngminus/ => Simple pnm2png and png2pnm programs diff --git a/media/libpng/apng.patch b/media/libpng/apng.patch index ab4ca59567..1cb3d35019 100644 --- a/media/libpng/apng.patch +++ b/media/libpng/apng.patch @@ -1,8 +1,7 @@ diff --git a/png.h b/png.h --- a/png.h +++ b/png.h -@@ -329,8 +329,12 @@ - */ +@@ -329,6 +329,10 @@ # include "pnglibconf.h" #endif @@ -13,9 +12,7 @@ diff --git a/png.h b/png.h #ifndef PNG_VERSION_INFO_ONLY /* Machine specific configuration. */ # include "pngconf.h" - #endif -@@ -424,8 +428,19 @@ extern "C" { - * constants. +@@ -424,6 +428,17 @@ extern "C" { * See pngconf.h for base types that vary by machine/system */ @@ -33,9 +30,7 @@ diff --git a/png.h b/png.h /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ - typedef char* png_libpng_version_1_6_37; -@@ -745,8 +760,12 @@ typedef png_unknown_chunk * * png_unknow - #define PNG_INFO_sPLT 0x2000U /* ESR, 1.0.6 */ +@@ -745,6 +760,10 @@ typedef png_unknown_chunk * * png_unknow #define PNG_INFO_sCAL 0x4000U /* ESR, 1.0.6 */ #define PNG_INFO_IDAT 0x8000U /* ESR, 1.0.6 */ #define PNG_INFO_eXIf 0x10000U /* GR-P, 1.6.31 */ @@ -46,9 +41,7 @@ diff --git a/png.h b/png.h /* This is used for the transformation routines, as some of them * change these values for the row. It also should enable using - * the routines for other purposes. -@@ -782,8 +801,12 @@ typedef PNG_CALLBACK(void, *png_write_st - +@@ -782,6 +801,10 @@ typedef PNG_CALLBACK(void, *png_write_st #ifdef PNG_PROGRESSIVE_READ_SUPPORTED typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop)); typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop)); @@ -59,9 +52,7 @@ diff --git a/png.h b/png.h /* The following callback receives png_uint_32 row_number, int pass for the * png_bytep data of the row. When transforming an interlaced image the - * row number is the row number within the sub-image of the interlace pass, so -@@ -3226,17 +3249,90 @@ PNG_EXPORT(244, int, png_set_option, (pn - /******************************************************************************* +@@ -3230,6 +3253,75 @@ PNG_EXPORT(244, int, png_set_option, (pn * END OF HARDWARE AND SOFTWARE OPTIONS ******************************************************************************/ @@ -137,8 +128,7 @@ diff --git a/png.h b/png.h /* Maintainer: Put new public prototypes here ^, in libpng.3, in project * defs, and in scripts/symbols.def. */ - - /* The last ordinal number (this is the *last* one already used; the next +@@ -3238,7 +3330,11 @@ PNG_EXPORT(244, int, png_set_option, (pn * one to use is one more than this.) */ #ifdef PNG_EXPORT_LAST_ORDINAL @@ -150,12 +140,10 @@ diff --git a/png.h b/png.h #endif #ifdef __cplusplus - } diff --git a/pngget.c b/pngget.c --- a/pngget.c +++ b/pngget.c -@@ -1245,5 +1245,167 @@ png_get_palette_max(png_const_structp pn - } +@@ -1264,4 +1264,166 @@ png_get_palette_max(png_const_structp pn # endif #endif @@ -325,8 +313,7 @@ diff --git a/pngget.c b/pngget.c diff --git a/pnginfo.h b/pnginfo.h --- a/pnginfo.h +++ b/pnginfo.h -@@ -262,6 +262,19 @@ defined(PNG_READ_BACKGROUND_SUPPORTED) - /* Data valid if (valid & PNG_INFO_IDAT) non-zero */ +@@ -263,5 +263,18 @@ defined(PNG_READ_BACKGROUND_SUPPORTED) png_bytepp row_pointers; /* the image bits */ #endif @@ -348,8 +335,7 @@ diff --git a/pnginfo.h b/pnginfo.h diff --git a/pngpread.c b/pngpread.c --- a/pngpread.c +++ b/pngpread.c -@@ -194,8 +194,91 @@ png_push_read_chunk(png_structrp png_ptr - } +@@ -195,6 +195,89 @@ png_push_read_chunk(png_structrp png_ptr chunk_name = png_ptr->chunk_name; @@ -439,9 +425,7 @@ diff --git a/pngpread.c b/pngpread.c if (chunk_name == png_IDAT) { if ((png_ptr->mode & PNG_AFTER_IDAT) != 0) - png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT; -@@ -260,8 +343,11 @@ png_push_read_chunk(png_structrp png_ptr - } +@@ -261,6 +344,9 @@ png_push_read_chunk(png_structrp png_ptr else if (chunk_name == png_IDAT) { @@ -451,9 +435,7 @@ diff --git a/pngpread.c b/pngpread.c png_ptr->idat_size = png_ptr->push_length; png_ptr->process_mode = PNG_READ_IDAT_MODE; png_push_have_info(png_ptr, info_ptr); - png_ptr->zstream.avail_out = -@@ -406,8 +492,22 @@ png_push_read_chunk(png_structrp png_ptr - png_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length); +@@ -415,6 +501,20 @@ png_push_read_chunk(png_structrp png_ptr } #endif @@ -474,9 +456,7 @@ diff --git a/pngpread.c b/pngpread.c else { PNG_PUSH_SAVE_BUFFER_IF_FULL - png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length, -@@ -538,27 +638,74 @@ png_push_read_IDAT(png_structrp png_ptr) - png_byte chunk_length[4]; +@@ -547,7 +647,11 @@ png_push_read_IDAT(png_structrp png_ptr) png_byte chunk_tag[4]; /* TODO: this code can be commoned up with the same code in push_read */ @@ -488,7 +468,7 @@ diff --git a/pngpread.c b/pngpread.c png_push_fill_buffer(png_ptr, chunk_length, 4); png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length); png_reset_crc(png_ptr); - png_crc_read(png_ptr, chunk_tag, 4); +@@ -555,17 +659,60 @@ png_push_read_IDAT(png_structrp png_ptr) png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag); png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; @@ -549,9 +529,7 @@ diff --git a/pngpread.c b/pngpread.c } if (png_ptr->idat_size != 0 && png_ptr->save_buffer_size != 0) - { -@@ -630,8 +777,18 @@ png_process_IDAT_data(png_structrp png_p - /* The caller checks for a non-zero buffer length. */ +@@ -639,6 +786,16 @@ png_process_IDAT_data(png_structrp png_p if (!(buffer_length > 0) || buffer == NULL) png_error(png_ptr, "No IDAT data (internal error)"); @@ -568,9 +546,7 @@ diff --git a/pngpread.c b/pngpread.c /* This routine must process all the data it has been given * before returning, calling the row callback as required to * handle the uncompressed results. - */ -@@ -1084,8 +1241,20 @@ png_set_progressive_read_fn(png_structrp - +@@ -1093,6 +1250,18 @@ png_set_progressive_read_fn(png_structrp png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer); } @@ -589,14 +565,12 @@ diff --git a/pngpread.c b/pngpread.c png_voidp PNGAPI png_get_progressive_ptr(png_const_structrp png_ptr) { - if (png_ptr == NULL) diff --git a/pngpriv.h b/pngpriv.h --- a/pngpriv.h +++ b/pngpriv.h -@@ -636,8 +636,12 @@ - #define PNG_HAVE_PNG_SIGNATURE 0x1000U +@@ -662,6 +662,10 @@ #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U /* Have another chunk after IDAT */ - /* 0x4000U (unused) */ + #define PNG_WROTE_eXIf 0x4000U #define PNG_IS_READ_STRUCT 0x8000U /* Else is a write struct */ +#ifdef PNG_APNG_SUPPORTED +#define PNG_HAVE_acTL 0x10000U @@ -605,9 +579,7 @@ diff --git a/pngpriv.h b/pngpriv.h /* Flags for the transformations the PNG library does on the image data */ #define PNG_BGR 0x0001U - #define PNG_INTERLACE 0x0002U -@@ -872,8 +876,18 @@ - #define png_tIME PNG_U32(116, 73, 77, 69) +@@ -898,6 +902,16 @@ #define png_tRNS PNG_U32(116, 82, 78, 83) #define png_zTXt PNG_U32(122, 84, 88, 116) @@ -624,9 +596,7 @@ diff --git a/pngpriv.h b/pngpriv.h /* The following will work on (signed char*) strings, whereas the get_uint_32 * macro will fail on top-bit-set values because of the sign extension. */ - #define PNG_CHUNK_FROM_STRING(s)\ -@@ -1623,8 +1637,51 @@ PNG_INTERNAL_FUNCTION(void,png_push_read - # endif +@@ -1683,6 +1697,49 @@ PNG_INTERNAL_FUNCTION(void,png_push_read #endif /* PROGRESSIVE_READ */ @@ -676,12 +646,10 @@ diff --git a/pngpriv.h b/pngpriv.h /* Added at libpng version 1.6.0 */ #ifdef PNG_GAMMA_SUPPORTED PNG_INTERNAL_FUNCTION(void,png_colorspace_set_gamma,(png_const_structrp png_ptr, - png_colorspacerp colorspace, png_fixed_point gAMA), PNG_EMPTY); diff --git a/pngread.c b/pngread.c --- a/pngread.c +++ b/pngread.c -@@ -160,8 +160,11 @@ png_read_info(png_structrp png_ptr, png_ - png_handle_PLTE(png_ptr, info_ptr, length); +@@ -161,6 +161,9 @@ png_read_info(png_structrp png_ptr, png_ else if (chunk_name == png_IDAT) { @@ -691,9 +659,7 @@ diff --git a/pngread.c b/pngread.c png_ptr->idat_size = length; break; } - -@@ -254,15 +257,92 @@ png_read_info(png_structrp png_ptr, png_ - else if (chunk_name == png_iTXt) +@@ -255,6 +258,17 @@ png_read_info(png_structrp png_ptr, png_ png_handle_iTXt(png_ptr, info_ptr, length); #endif @@ -711,7 +677,7 @@ diff --git a/pngread.c b/pngread.c else png_handle_unknown(png_ptr, info_ptr, length, PNG_HANDLE_CHUNK_AS_DEFAULT); - } +@@ -262,6 +276,72 @@ png_read_info(png_structrp png_ptr, png_ } #endif /* SEQUENTIAL_READ */ @@ -784,12 +750,10 @@ diff --git a/pngread.c b/pngread.c /* Optional call to update the users info_ptr structure */ void PNGAPI png_read_update_info(png_structrp png_ptr, png_inforp info_ptr) - { diff --git a/pngrutil.c b/pngrutil.c --- a/pngrutil.c +++ b/pngrutil.c -@@ -864,8 +864,13 @@ png_handle_IHDR(png_structrp png_ptr, pn - compression_type = buf[10]; +@@ -863,6 +863,11 @@ png_handle_IHDR(png_structrp png_ptr, pn filter_type = buf[11]; interlace_type = buf[12]; @@ -801,9 +765,7 @@ diff --git a/pngrutil.c b/pngrutil.c /* Set internal variables */ png_ptr->width = width; png_ptr->height = height; - png_ptr->bit_depth = (png_byte)bit_depth; -@@ -2856,8 +2861,182 @@ png_handle_iTXt(png_structrp png_ptr, pn - png_chunk_benign_error(png_ptr, errmsg); +@@ -2857,6 +2862,180 @@ png_handle_iTXt(png_structrp png_ptr, pn } #endif @@ -984,9 +946,7 @@ diff --git a/pngrutil.c b/pngrutil.c #ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED /* Utility function for png_handle_unknown; set up png_ptr::unknown_chunk */ static int - png_cache_unknown_chunk(png_structrp png_ptr, png_uint_32 length) -@@ -3161,9 +3340,13 @@ png_check_chunk_length(png_const_structr - # elif PNG_USER_CHUNK_MALLOC_MAX > 0 +@@ -3162,7 +3341,11 @@ png_check_chunk_length(png_const_structr if (PNG_USER_CHUNK_MALLOC_MAX < limit) limit = PNG_USER_CHUNK_MALLOC_MAX; # endif @@ -998,9 +958,7 @@ diff --git a/pngrutil.c b/pngrutil.c { png_alloc_size_t idat_limit = PNG_UINT_31_MAX; size_t row_factor = - (size_t)png_ptr->width -@@ -4165,8 +4348,40 @@ png_read_IDAT_data(png_structrp png_ptr, - { +@@ -4166,6 +4349,38 @@ png_read_IDAT_data(png_structrp png_ptr, uInt avail_in; png_bytep buffer; @@ -1039,9 +997,7 @@ diff --git a/pngrutil.c b/pngrutil.c while (png_ptr->idat_size == 0) { png_crc_finish(png_ptr, 0); - -@@ -4176,8 +4391,9 @@ png_read_IDAT_data(png_structrp png_ptr, - */ +@@ -4177,6 +4392,7 @@ png_read_IDAT_data(png_structrp png_ptr, if (png_ptr->chunk_name != png_IDAT) png_error(png_ptr, "Not enough image data"); } @@ -1049,9 +1005,7 @@ diff --git a/pngrutil.c b/pngrutil.c avail_in = png_ptr->IDAT_read_size; - if (avail_in > png_ptr->idat_size) -@@ -4239,8 +4455,11 @@ png_read_IDAT_data(png_structrp png_ptr, - png_ptr->zstream.next_out = NULL; +@@ -4240,6 +4456,9 @@ png_read_IDAT_data(png_structrp png_ptr, png_ptr->mode |= PNG_AFTER_IDAT; png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED; @@ -1061,9 +1015,7 @@ diff --git a/pngrutil.c b/pngrutil.c if (png_ptr->zstream.avail_in > 0 || png_ptr->idat_size > 0) png_chunk_benign_error(png_ptr, "Extra compressed data"); - break; -@@ -4677,5 +4896,81 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED - png_error(png_ptr, png_ptr->zstream.msg); +@@ -4677,4 +4896,80 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED png_ptr->flags |= PNG_FLAG_ROW_INIT; } @@ -1147,8 +1099,7 @@ diff --git a/pngrutil.c b/pngrutil.c diff --git a/pngset.c b/pngset.c --- a/pngset.c +++ b/pngset.c -@@ -287,8 +287,13 @@ png_set_IHDR(png_const_structrp png_ptr, - +@@ -280,6 +280,11 @@ png_set_IHDR(png_const_structrp png_ptr, info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth); info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width); @@ -1160,9 +1111,7 @@ diff --git a/pngset.c b/pngset.c } #ifdef PNG_oFFs_SUPPORTED - void PNGAPI -@@ -1157,8 +1162,148 @@ png_set_sPLT(png_const_structrp png_ptr, - png_chunk_report(png_ptr, "sPLT out of memory", PNG_CHUNK_WRITE_ERROR); +@@ -1151,6 +1156,146 @@ png_set_sPLT(png_const_structrp png_ptr, } #endif /* sPLT */ @@ -1309,12 +1258,10 @@ diff --git a/pngset.c b/pngset.c #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED static png_byte check_location(png_const_structrp png_ptr, int location) - { diff --git a/pngstruct.h b/pngstruct.h --- a/pngstruct.h +++ b/pngstruct.h -@@ -408,8 +408,29 @@ struct png_struct_def - #ifdef PNG_MNG_FEATURES_SUPPORTED +@@ -399,6 +399,27 @@ struct png_struct_def png_byte filter_type; #endif @@ -1342,12 +1289,10 @@ diff --git a/pngstruct.h b/pngstruct.h /* New members added in libpng-1.2.0 */ /* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */ - #ifdef PNG_USER_MEM_SUPPORTED diff --git a/pngwrite.c b/pngwrite.c --- a/pngwrite.c +++ b/pngwrite.c -@@ -127,8 +127,12 @@ png_write_info_before_PLTE(png_structrp - * an error and calls png_error while the color space is being set, yet +@@ -128,6 +128,10 @@ png_write_info_before_PLTE(png_structrp * the application continues writing the PNG. So check the 'invalid' * flag here too. */ @@ -1358,9 +1303,7 @@ diff --git a/pngwrite.c b/pngwrite.c #ifdef PNG_GAMMA_SUPPORTED # ifdef PNG_WRITE_gAMA_SUPPORTED if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 && - (info_ptr->colorspace.flags & PNG_COLORSPACE_FROM_gAMA) != 0 && -@@ -364,8 +368,13 @@ png_write_end(png_structrp png_ptr, png_ - +@@ -368,6 +372,11 @@ png_write_end(png_structrp png_ptr, png_ if ((png_ptr->mode & PNG_HAVE_IDAT) == 0) png_error(png_ptr, "No IDATs written into file"); @@ -1370,11 +1313,9 @@ diff --git a/pngwrite.c b/pngwrite.c +#endif + #ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED - if (png_ptr->num_palette_max > png_ptr->num_palette) - png_benign_error(png_ptr, "Wrote palette index exceeding num_palette"); - #endif -@@ -2391,5 +2400,43 @@ png_image_write_to_file(png_imagep image - return 0; + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && + png_ptr->num_palette_max >= png_ptr->num_palette) +@@ -2415,4 +2424,42 @@ png_image_write_to_file(png_imagep image } #endif /* SIMPLIFIED_WRITE_STDIO */ #endif /* SIMPLIFIED_WRITE */ @@ -1420,8 +1361,7 @@ diff --git a/pngwrite.c b/pngwrite.c diff --git a/pngwutil.c b/pngwutil.c --- a/pngwutil.c +++ b/pngwutil.c -@@ -820,8 +820,13 @@ png_write_IHDR(png_structrp png_ptr, png - +@@ -823,6 +823,11 @@ png_write_IHDR(png_structrp png_ptr, png /* Write the chunk */ png_write_complete_chunk(png_ptr, png_IHDR, buf, 13); @@ -1432,10 +1372,8 @@ diff --git a/pngwutil.c b/pngwutil.c + if ((png_ptr->do_filter) == PNG_NO_FILTERS) { - if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE || - png_ptr->bit_depth < 8) -@@ -1002,9 +1007,19 @@ png_compress_IDAT(png_structrp png_ptr, - optimize_cmf(data, png_image_size(png_ptr)); + #ifdef PNG_WRITE_FILTER_SUPPORTED +@@ -1009,7 +1014,17 @@ png_compress_IDAT(png_structrp png_ptr, #endif if (size > 0) @@ -1453,9 +1391,7 @@ diff --git a/pngwutil.c b/pngwutil.c png_ptr->mode |= PNG_HAVE_IDAT; png_ptr->zstream.next_out = data; - png_ptr->zstream.avail_out = size; -@@ -1049,9 +1064,19 @@ png_compress_IDAT(png_structrp png_ptr, - optimize_cmf(data, png_image_size(png_ptr)); +@@ -1056,7 +1071,17 @@ png_compress_IDAT(png_structrp png_ptr, #endif if (size > 0) @@ -1473,9 +1409,7 @@ diff --git a/pngwutil.c b/pngwutil.c png_ptr->zstream.avail_out = 0; png_ptr->zstream.next_out = NULL; png_ptr->mode |= PNG_HAVE_IDAT | PNG_AFTER_IDAT; - -@@ -1884,8 +1909,84 @@ png_write_tIME(png_structrp png_ptr, png - png_write_complete_chunk(png_ptr, png_tIME, buf, 7); +@@ -1891,6 +1916,82 @@ png_write_tIME(png_structrp png_ptr, png } #endif @@ -1558,9 +1492,7 @@ diff --git a/pngwutil.c b/pngwutil.c /* Initializes the row writing capability of libpng */ void /* PRIVATE */ png_write_start_row(png_structrp png_ptr) - { -@@ -2777,5 +2878,40 @@ png_write_filtered_row(png_structrp png_ - png_write_flush(png_ptr); +@@ -2784,4 +2885,39 @@ png_write_filtered_row(png_structrp png_ } #endif /* WRITE_FLUSH */ } diff --git a/media/libpng/arm/linux.c b/media/libpng/arm/linux.c index a9bc360dd5..b5429d0c34 100644 --- a/media/libpng/arm/linux.c +++ b/media/libpng/arm/linux.c @@ -1,6 +1,5 @@ /* contrib/arm-neon/linux.c * - * Last changed in libpng 1.6.31 [July 27, 2017] * Copyright (c) 2014, 2017 Glenn Randers-Pehrson * Written by John Bowler, 2014, 2017. * @@ -19,6 +18,7 @@ * This code is strict ANSI-C and is probably moderately portable; it does * however use <stdio.h> and it assumes that /proc/cpuinfo is never localized. */ + #include <stdio.h> static int diff --git a/media/libpng/libpng-manual.txt b/media/libpng/libpng-manual.txt index d856796169..7988057599 100644 --- a/media/libpng/libpng-manual.txt +++ b/media/libpng/libpng-manual.txt @@ -1,6 +1,6 @@ libpng-manual.txt - A description on how to use and modify libpng - Copyright (c) 2018-2022 Cosmin Truta + Copyright (c) 2018-2024 Cosmin Truta Copyright (c) 1998-2018 Glenn Randers-Pehrson This document is released under the libpng license. @@ -9,9 +9,9 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: - libpng version 1.6.36, December 2018, through 1.6.39 - November 2022 + libpng version 1.6.36, December 2018, through 1.6.43 - February 2024 Updated and distributed by Cosmin Truta - Copyright (c) 2018-2022 Cosmin Truta + Copyright (c) 2018-2024 Cosmin Truta libpng versions 0.97, January 1998, through 1.6.35 - July 2018 Updated and distributed by Glenn Randers-Pehrson @@ -357,7 +357,7 @@ Customizing libpng. return ERROR; } - is_png = !png_sig_cmp(header, 0, number); + is_png = (png_sig_cmp(header, 0, number) == 0); if (!is_png) { return NOT_PNG; @@ -385,8 +385,7 @@ create the structure, so your application should check for that. if (!info_ptr) { - png_destroy_read_struct(&png_ptr, - (png_infopp)NULL, (png_infopp)NULL); + png_destroy_read_struct(&png_ptr, NULL, NULL); return ERROR; } @@ -419,14 +418,13 @@ free any memory. if (setjmp(png_jmpbuf(png_ptr))) { - png_destroy_read_struct(&png_ptr, &info_ptr, - &end_info); + png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); fclose(fp); return ERROR; } -Pass (png_infopp)NULL instead of &end_info if you didn't create -an end_info structure. +Pass NULL instead of &end_info if you didn't create an end_info +structure. If you would rather avoid the complexity of setjmp/longjmp issues, you can compile libpng with PNG_NO_SETJMP, in which case @@ -496,7 +494,7 @@ You can set up a callback function to handle any unknown chunks in the input stream. You must supply the function read_chunk_callback(png_structp png_ptr, - png_unknown_chunkp chunk); + png_unknown_chunkp chunk) { /* The unknown chunk structure contains your chunk data, along with similar data for any other @@ -547,9 +545,9 @@ a progress meter or the like. It's demonstrated in pngtest.c. You must supply a function void read_row_callback(png_structp png_ptr, - png_uint_32 row, int pass); + png_uint_32 row, int pass) { - /* put your code here */ + /* put your code here */ } (You can give it another name that you like instead of "read_row_callback") @@ -1180,22 +1178,22 @@ where row_pointers is an array of pointers to the pixel data for each row: If you know your image size and pixel size ahead of time, you can allocate row_pointers prior to calling png_read_png() with - if (height > PNG_UINT_32_MAX/(sizeof (png_byte))) - png_error (png_ptr, + if (height > PNG_UINT_32_MAX / (sizeof (png_bytep))) + png_error(png_ptr, "Image is too tall to process in memory"); - if (width > PNG_UINT_32_MAX/pixel_size) - png_error (png_ptr, + if (width > PNG_UINT_32_MAX / pixel_size) + png_error(png_ptr, "Image is too wide to process in memory"); row_pointers = png_malloc(png_ptr, height*(sizeof (png_bytep))); - for (int i=0; i<height, i++) - row_pointers[i]=NULL; /* security precaution */ + for (int i = 0; i < height, i++) + row_pointers[i] = NULL; /* security precaution */ - for (int i=0; i<height, i++) - row_pointers[i]=png_malloc(png_ptr, + for (int i = 0; i < height, i++) + row_pointers[i] = png_malloc(png_ptr, width*pixel_size); png_set_rows(png_ptr, info_ptr, &row_pointers); @@ -1205,14 +1203,14 @@ row_pointers[i] to point into the proper places in your block, but first be sure that your platform is able to allocate such a large buffer: /* Guard against integer overflow */ - if (height > PNG_SIZE_MAX/(width*pixel_size)) { - png_error(png_ptr,"image_data buffer would be too large"); - } + if (height > PNG_SIZE_MAX/(width*pixel_size)) + png_error(png_ptr, "image_data buffer would be too large"); - png_bytep buffer=png_malloc(png_ptr,height*width*pixel_size); + png_bytep buffer = png_malloc(png_ptr, + height*width*pixel_size); - for (int i=0; i<height, i++) - row_pointers[i]=buffer+i*width*pixel_size; + for (int i = 0; i < height, i++) + row_pointers[i] = buffer + i*width*pixel_size; png_set_rows(png_ptr, info_ptr, &row_pointers); @@ -1465,25 +1463,24 @@ png_set_rgb_to_gray()). non-paletted images (PNG_INFO_tRNS) png_get_eXIf_1(png_ptr, info_ptr, &num_exif, &exif); - (PNG_INFO_eXIf) exif - Exif profile (array of png_byte) + (PNG_INFO_eXIf) png_get_hIST(png_ptr, info_ptr, &hist); - (PNG_INFO_hIST) hist - histogram of palette (array of - png_uint_16) + png_uint_16) (PNG_INFO_hIST) png_get_tIME(png_ptr, info_ptr, &mod_time); mod_time - time image was last modified - (PNG_VALID_tIME) + (PNG_INFO_tIME) png_get_bKGD(png_ptr, info_ptr, &background); background - background color (of type - png_color_16p) (PNG_VALID_bKGD) + png_color_16p) (PNG_INFO_bKGD) valid 16-bit red, green and blue values, regardless of color_type @@ -1743,13 +1740,13 @@ grayscale images with bit depths of 2 or 4 or if there is a multiple-image viewing application that wishes to treat all images in the same way. if (color_type == PNG_COLOR_TYPE_PALETTE) - png_set_palette_to_rgb(png_ptr); + png_set_palette_to_rgb(png_ptr); - if (png_get_valid(png_ptr, info_ptr, - PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr); + if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) + png_set_tRNS_to_alpha(png_ptr); - if (color_type == PNG_COLOR_TYPE_GRAY && - bit_depth < 8) png_set_expand_gray_1_2_4_to_8(png_ptr); + if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) + png_set_expand_gray_1_2_4_to_8(png_ptr); The first two functions are actually aliases for png_set_expand(), added in libpng version 1.0.4, with the function names expanded to improve code @@ -1764,18 +1761,20 @@ png_set_expand(); however, the resultant channels have 16 bits rather than 8. Use this when the output color or gray channels are made linear to avoid fairly severe accuracy loss. - if (bit_depth < 16) - png_set_expand_16(png_ptr); + if (bit_depth < 16) + png_set_expand_16(png_ptr); PNG can have files with 16 bits per channel. If you only can handle 8 bits per channel, this will strip the pixels down to 8-bit. if (bit_depth == 16) + { #if PNG_LIBPNG_VER >= 10504 png_set_scale_16(png_ptr); #else png_set_strip_16(png_ptr); #endif + } (The more accurate "png_set_scale_16()" API became available in libpng version 1.5.4). @@ -1901,7 +1900,7 @@ Note that png_set_filler() does not change the color type. If you want to do that, you can add a true alpha channel with if (color_type == PNG_COLOR_TYPE_RGB || - color_type == PNG_COLOR_TYPE_GRAY) + color_type == PNG_COLOR_TYPE_GRAY) png_set_add_alpha(png_ptr, filler, PNG_FILLER_AFTER); where "filler" contains the alpha value to assign to each pixel. @@ -1926,7 +1925,7 @@ with alpha. if (color_type == PNG_COLOR_TYPE_RGB || color_type == PNG_COLOR_TYPE_RGB_ALPHA) png_set_rgb_to_gray(png_ptr, error_action, - double red_weight, double green_weight); + (double)red_weight, (double)green_weight); error_action = 1: silently do the conversion @@ -1949,8 +1948,8 @@ In the corresponding fixed point API the red_weight and green_weight values are simply scaled by 100,000: png_set_rgb_to_gray(png_ptr, error_action, - png_fixed_point red_weight, - png_fixed_point green_weight); + (png_fixed_point)red_weight, + (png_fixed_point)green_weight); If you have set error_action = 1 or 2, you can later check whether the image really was gray, after processing @@ -2186,9 +2185,8 @@ do your own check for number_of_rows*width*pixel_size if you are using a multiple-row buffer: /* Guard against integer overflow */ - if (number_of_rows > PNG_SIZE_MAX/(width*pixel_size)) { - png_error(png_ptr,"image_data buffer would be too large"); - } + if (number_of_rows > PNG_SIZE_MAX/(width*pixel_size)) + png_error(png_ptr, "image_data buffer would be too large"); Remember: Before you call png_read_update_info(), the png_get_*() functions return the values corresponding to the original PNG image. @@ -2408,12 +2406,11 @@ separate. if (!end_info) { - png_destroy_read_struct(&png_ptr, &info_ptr, - (png_infopp)NULL); + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); return ERROR; } - png_read_end(png_ptr, end_info); + png_read_end(png_ptr, end_info); If you are not interested, you should still call png_read_end() but you can pass NULL, avoiding the need to create an end_info structure. @@ -2421,7 +2418,7 @@ If you do this, libpng will not process any chunks after IDAT other than skipping over them and perhaps (depending on whether you have called png_set_crc_action) checking their CRCs while looking for the IEND chunk. - png_read_end(png_ptr, (png_infop)NULL); + png_read_end(png_ptr, NULL); If you don't call png_read_end(), then your file pointer will be left pointing to the first chunk after the last IDAT, which is probably @@ -2430,13 +2427,11 @@ the PNG datastream. When you are done, you can free all memory allocated by libpng like this: - png_destroy_read_struct(&png_ptr, &info_ptr, - &end_info); + png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); or, if you didn't create an end_info structure, - png_destroy_read_struct(&png_ptr, &info_ptr, - (png_infopp)NULL); + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); It is also possible to individually free the info_ptr members that point to libpng-allocated storage with the following function: @@ -2556,15 +2551,13 @@ png_infop info_ptr; if (!info_ptr) { - png_destroy_read_struct(&png_ptr, - (png_infopp)NULL, (png_infopp)NULL); + png_destroy_read_struct(&png_ptr, NULL, NULL); return ERROR; } if (setjmp(png_jmpbuf(png_ptr))) { - png_destroy_read_struct(&png_ptr, &info_ptr, - (png_infopp)NULL); + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); return ERROR; } @@ -2597,8 +2590,7 @@ png_infop info_ptr; { if (setjmp(png_jmpbuf(png_ptr))) { - png_destroy_read_struct(&png_ptr, &info_ptr, - (png_infopp)NULL); + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); return ERROR; } @@ -2763,8 +2755,7 @@ both "png_ptr"; you can call them anything you like, such as png_infop info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { - png_destroy_write_struct(&png_ptr, - (png_infopp)NULL); + png_destroy_write_struct(&png_ptr, NULL); return ERROR; } @@ -2790,7 +2781,7 @@ section below for more information on the libpng error handling. if (setjmp(png_jmpbuf(png_ptr))) { - png_destroy_write_struct(&png_ptr, &info_ptr); + png_destroy_write_struct(&png_ptr, &info_ptr); fclose(fp); return ERROR; } @@ -2844,9 +2835,9 @@ a progress meter or the like. It's demonstrated in pngtest.c. You must supply a function void write_row_callback(png_structp png_ptr, png_uint_32 row, - int pass); + int pass) { - /* put your code here */ + /* put your code here */ } (You can give it another name that you like instead of "write_row_callback") @@ -3116,8 +3107,8 @@ width, height, bit_depth, and color_type must be the same in each call. png_set_eXIf_1(png_ptr, info_ptr, num_exif, exif); - exif - Exif profile (array of - png_byte) (PNG_INFO_eXIf) + exif - Exif profile (array of png_byte) + (PNG_INFO_eXIf) png_set_hIST(png_ptr, info_ptr, hist); @@ -3127,12 +3118,12 @@ width, height, bit_depth, and color_type must be the same in each call. png_set_tIME(png_ptr, info_ptr, mod_time); mod_time - time image was last modified - (PNG_VALID_tIME) + (PNG_INFO_tIME) png_set_bKGD(png_ptr, info_ptr, background); background - background color (of type - png_color_16p) (PNG_VALID_bKGD) + png_color_16p) (PNG_INFO_bKGD) png_set_text(png_ptr, info_ptr, text_ptr, num_text); @@ -4218,7 +4209,7 @@ png_create_read_struct_2() or png_create_write_struct_2() to register your own functions as described above. These functions also provide a void pointer that can be retrieved via - mem_ptr=png_get_mem_ptr(png_ptr); + mem_ptr = png_get_mem_ptr(png_ptr); Your replacement memory functions must have prototypes as follows: @@ -4515,7 +4506,7 @@ When PNG_DEBUG is defined but is zero, the macros aren't defined, but you can still use PNG_DEBUG to control your own debugging: #ifdef PNG_DEBUG - fprintf(stderr, ... + fprintf(stderr, ...); #endif When PNG_DEBUG = 1, the macros are defined, but only png_debug statements @@ -4692,7 +4683,7 @@ deprecated since libpng-1.0.16 and libpng-1.2.6. The function png_check_sig(sig, num) was replaced with - !png_sig_cmp(sig, 0, num) + png_sig_cmp(sig, 0, num) == 0 It has been deprecated since libpng-0.90. The function @@ -4756,8 +4747,8 @@ png_get_mmx_bitdepth_threshold(), png_get_mmx_rowbytes_threshold(), png_set_asm_flags(), and png_mmx_supported() We removed the obsolete png_check_sig(), png_memcpy_check(), and -png_memset_check() functions. Instead use !png_sig_cmp(), memcpy(), -and memset(), respectively. +png_memset_check() functions. Instead use png_sig_cmp() == 0, +memcpy(), and memset(), respectively. The function png_set_gray_1_2_4_to_8() was removed. It has been deprecated since libpng-1.0.18 and 1.2.9, when it was replaced with @@ -5239,7 +5230,7 @@ changed, and is unaffected by conditional compilation macros. It is the best choice for use in configure scripts for detecting the presence of any libpng version since 0.88. In an autoconf "configure.in" you could use - AC_CHECK_LIB(png, png_get_io_ptr, ... + AC_CHECK_LIB(png, png_get_io_ptr, ...) XV. Source code repository @@ -5248,12 +5239,12 @@ control. The git repository was built from old libpng-x.y.z.tar.gz files going back to version 0.70. You can access the git repository (read only) at - https://github.com/glennrp/libpng or + https://github.com/pnggroup/libpng or https://git.code.sf.net/p/libpng/code.git or you can browse it with a web browser at - https://github.com/glennrp/libpng or + https://github.com/pnggroup/libpng or https://sourceforge.net/p/libpng/code/ci/libpng16/tree/ Patches can be sent to png-mng-implement at lists.sourceforge.net or @@ -5263,7 +5254,7 @@ uploaded to the libpng bug tracker at or as a "pull request" to - https://github.com/glennrp/libpng/pulls + https://github.com/pnggroup/libpng/pulls We also accept patches built from the tar or zip distributions, and simple verbal descriptions of bug fixes, reported either to the diff --git a/media/libpng/mips/filter_mmi_inline_assembly.c b/media/libpng/mips/filter_mmi_inline_assembly.c new file mode 100644 index 0000000000..b330a46538 --- /dev/null +++ b/media/libpng/mips/filter_mmi_inline_assembly.c @@ -0,0 +1,525 @@ +/* filter_mmi_intrinsics.c - MMI optimized filter functions + * + * Copyright (c) 2024 Cosmin Truta + * Written by zhanglixia and guxiwei, 2023 + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + */ + +#include "../pngpriv.h" + +#ifdef PNG_READ_SUPPORTED + +#if PNG_MIPS_MMI_IMPLEMENTATION == 2 /* Inline Assembly */ + +/* Functions in this file look at most 3 pixels (a,b,c) to predict the 4th (d). + * They're positioned like this: + * prev: c b + * row: a d + * The Sub filter predicts d=a, Avg d=(a+b)/2, and Paeth predicts d to be + * whichever of a, b, or c is closest to p=a+b-c. + */ + +void png_read_filter_row_up_mmi(png_row_infop row_info, png_bytep row, + png_const_bytep prev_row) +{ + int istop = row_info->rowbytes; + double rp,pp; + __asm__ volatile ( + "1: \n\t" + "ldc1 %[rp], 0x00(%[row]) \n\t" + "ldc1 %[pp], 0x00(%[prev_row]) \n\t" + "paddb %[rp], %[rp], %[pp] \n\t" + "sdc1 %[rp], 0x00(%[row]) \n\t" + + "daddiu %[row], %[row], 0x08 \n\t" + "daddiu %[prev_row], %[prev_row], 0x08 \n\t" + "daddiu %[istop], %[istop], -0x08 \n\t" + "bgtz %[istop], 1b \n\t" + : [rp]"=&f"(rp), [pp]"=&f"(pp) + : [row]"r"(row), [prev_row]"r"(prev_row), + [istop]"r"(istop) + : "memory" + ); +} + +void png_read_filter_row_sub3_mmi(png_row_infop row_info, png_bytep row, + png_const_bytep prev) +{ + int istop = row_info->rowbytes; + double rp, pp, dest; + double eight, sixteen, twenty_four, forty_eight; + double tmp0; + double ftmp[2]; + + __asm__ volatile ( + "li %[tmp0], 0x08 \n\t" + "dmtc1 %[tmp0], %[eight] \n\t" + "li %[tmp0], 0x10 \n\t" + "dmtc1 %[tmp0], %[sixteen] \n\t" + "li %[tmp0], 0x18 \n\t" + "dmtc1 %[tmp0], %[twenty_four] \n\t" + "li %[tmp0], 0x30 \n\t" + "dmtc1 %[tmp0], %[forty_eight] \n\t" + "xor %[dest], %[dest], %[dest] \n\t" + + "1: \n\t" + "gsldrc1 %[rp], 0x00(%[row]) \n\t" + "gsldlc1 %[rp], 0x07(%[row]) \n\t" + "gsldrc1 %[pp], 0x08(%[row]) \n\t" + "gsldlc1 %[pp], 0x0f(%[row]) \n\t" + + "paddb %[ftmp0], %[dest], %[rp] \n\t" + "swc1 %[ftmp0], 0x00(%[row]) \n\t" + + "dsrl %[ftmp1], %[rp], %[twenty_four] \n\t" + "paddb %[dest], %[ftmp1], %[ftmp0] \n\t" + "gsswrc1 %[dest], 0x03(%[row]) \n\t" + "gsswlc1 %[dest], 0x06(%[row]) \n\t" + + "dsrl %[ftmp0], %[rp], %[forty_eight] \n\t" + "dsll %[ftmp1], %[pp], %[sixteen] \n\t" + "or %[ftmp0], %[ftmp0], %[ftmp1] \n\t" + "paddb %[dest], %[dest], %[ftmp0] \n\t" + "gsswrc1 %[dest], 0x06(%[row]) \n\t" + "gsswlc1 %[dest], 0x09(%[row]) \n\t" + + "dsrl %[ftmp0], %[pp], %[eight] \n\t" + "paddb %[dest], %[dest], %[ftmp0] \n\t" + "gsswrc1 %[dest], 0x09(%[row]) \n\t" + "daddiu %[row], %[row], 0x0c \n\t" + "daddiu %[istop], %[istop], -0x0c \n\t" + "bgtz %[istop], 1b \n\t" + : [rp]"=&f"(rp), [pp]"=&f"(pp), [dest]"=&f"(dest), + [tmp0]"=&r"(tmp0), [ftmp0]"=&f"(ftmp[0]), + [ftmp1]"=&f"(ftmp[1]), [eight]"=&f"(eight), + [sixteen]"=&f"(sixteen), [twenty_four]"=&f"(twenty_four), + [forty_eight]"=&f"(forty_eight) + : [row]"r"(row), [istop]"r"(istop) + : "memory" + ); + + PNG_UNUSED(prev) +} + +void png_read_filter_row_sub4_mmi(png_row_infop row_info, png_bytep row, + png_const_bytep prev) +{ + /* The Sub filter predicts each pixel as the previous pixel, a. + * There is no pixel to the left of the first pixel. It's encoded directly. + * That works with our main loop if we just say that left pixel was zero. + */ + int istop = row_info->rowbytes; + double rp,pp; + + __asm__ volatile ( + "1: \n\t" + "lwc1 %[pp], 0x00(%[row]) \n\t" + "lwc1 %[rp], 0x04(%[row]) \n\t" + "paddb %[rp], %[rp], %[pp] \n\t" + "swc1 %[rp], 0x04(%[row]) \n\t" + + "daddiu %[row], %[row], 0x04 \n\t" + "daddiu %[istop], %[istop], -0x04 \n\t" + "bgtz %[istop], 1b \n\t" + : [rp]"=&f"(rp), [pp]"=&f"(pp) + : [row]"r"(row), [istop]"r"(istop) + : "memory" + ); + + PNG_UNUSED(prev) +} + +void png_read_filter_row_avg3_mmi(png_row_infop row_info, png_bytep row, + png_const_bytep prev) +{ + int istop = row_info->rowbytes; + double rp, pp, rp1, pp1; + double tmp0; + double ftmp[3]; + double one, dest; + double eight, sixteen, twenty_four, forty_eight; + + __asm__ volatile ( + "li %[tmp0], 0x08 \n\t" + "dmtc1 %[tmp0], %[eight] \n\t" + "li %[tmp0], 0x10 \n\t" + "dmtc1 %[tmp0], %[sixteen] \n\t" + "li %[tmp0], 0x18 \n\t" + "dmtc1 %[tmp0], %[twenty_four] \n\t" + "li %[tmp0], 0x30 \n\t" + "dmtc1 %[tmp0], %[forty_eight] \n\t" + "xor %[dest], %[dest], %[dest] \n\t" + + "li %[tmp0], 0x01 \n\t" + "ins %[tmp0], %[tmp0], 8, 8 \n\t" + "dmtc1 %[tmp0], %[one] \n\t" + "pshufh %[one], %[one], %[dest] \n\t" + + "1: \n\t" + "gsldrc1 %[rp], 0x00(%[row]) \n\t" + "gsldlc1 %[rp], 0x07(%[row]) \n\t" + "gsldrc1 %[pp], 0x00(%[prev]) \n\t" + "gsldlc1 %[pp], 0x07(%[prev]) \n\t" + "gsldrc1 %[rp1], 0x08(%[row]) \n\t" + "gsldlc1 %[rp1], 0x0f(%[row]) \n\t" + "gsldrc1 %[pp1], 0x08(%[prev]) \n\t" + "gsldlc1 %[pp1], 0x0f(%[prev]) \n\t" + + "xor %[ftmp0], %[pp], %[dest] \n\t" + "pavgb %[ftmp1], %[pp], %[dest] \n\t" + "and %[ftmp0], %[ftmp0], %[one] \n\t" + "psubb %[ftmp1], %[ftmp1], %[ftmp0] \n\t" + "paddb %[dest], %[rp], %[ftmp1] \n\t" + "swc1 %[dest], 0x00(%[row]) \n\t" + + "dsrl %[ftmp0], %[rp], %[twenty_four] \n\t" + "dsrl %[ftmp1], %[pp], %[twenty_four] \n\t" + + "xor %[ftmp2], %[ftmp1], %[dest] \n\t" + "pavgb %[ftmp1], %[ftmp1], %[dest] \n\t" + "and %[ftmp2], %[ftmp2], %[one] \n\t" + "psubb %[ftmp1], %[ftmp1], %[ftmp2] \n\t" + "paddb %[dest], %[ftmp0], %[ftmp1] \n\t" + "gsswrc1 %[dest], 0x03(%[row]) \n\t" + "gsswlc1 %[dest], 0x06(%[row]) \n\t" + + "dsrl %[ftmp0], %[rp], %[forty_eight] \n\t" + "dsll %[ftmp1], %[rp1], %[sixteen] \n\t" + "or %[ftmp0], %[ftmp0], %[ftmp1] \n\t" + "dsrl %[ftmp2], %[pp], %[forty_eight] \n\t" + "dsll %[ftmp1], %[pp1], %[sixteen] \n\t" + "or %[ftmp1], %[ftmp2], %[ftmp1] \n\t" + + "xor %[ftmp2], %[ftmp1], %[dest] \n\t" + "pavgb %[ftmp1], %[ftmp1], %[dest] \n\t" + "and %[ftmp2], %[ftmp2], %[one] \n\t" + "psubb %[ftmp1], %[ftmp1], %[ftmp2] \n\t" + "paddb %[dest], %[ftmp0], %[ftmp1] \n\t" + "gsswrc1 %[dest], 0x06(%[row]) \n\t" + "gsswlc1 %[dest], 0x09(%[row]) \n\t" + + "dsrl %[ftmp0], %[rp1], %[eight] \n\t" + "dsrl %[ftmp1], %[pp1], %[eight] \n\t" + + "xor %[ftmp2], %[ftmp1], %[dest] \n\t" + "pavgb %[ftmp1], %[ftmp1], %[dest] \n\t" + "and %[ftmp2], %[ftmp2], %[one] \n\t" + "psubb %[ftmp1], %[ftmp1], %[ftmp2] \n\t" + "paddb %[dest], %[ftmp0], %[ftmp1] \n\t" + "gsswrc1 %[dest], 0x09(%[row]) \n\t" + "daddiu %[row], %[row], 0x0c \n\t" + "daddiu %[prev], %[prev], 0x0c \n\t" + "daddiu %[istop], %[istop], -0x0c \n\t" + "bgtz %[istop], 1b \n\t" + : [rp]"=&f"(rp), [pp]"=&f"(pp), [rp1]"=&f"(rp1), + [pp1]"=&f"(pp1), [tmp0]"=&r"(tmp0), [ftmp0]"=&f"(ftmp[0]), + [ftmp1]"=&f"(ftmp[1]), [ftmp2]"=&f"(ftmp[2]), [one]"=&f"(one), + [dest]"=&f"(dest), [eight]"=&f"(eight), [sixteen]"=&f"(sixteen), + [twenty_four]"=&f"(twenty_four), [forty_eight]"=&f"(forty_eight) + : [row]"r"(row), [prev]"r"(prev), [istop]"r"(istop) + : "memory" + ); +} + +void png_read_filter_row_avg4_mmi(png_row_infop row_info, png_bytep row, + png_const_bytep prev) +{ + int istop = row_info->rowbytes; + double rp,pp; + double dest; + double ftmp[2]; + double tmp; + + __asm__ volatile ( + "xor %[dest], %[dest], %[dest] \n\t" + "li %[tmp], 0x01 \n\t" + "ins %[tmp], %[tmp], 8, 8 \n\t" + "dmtc1 %[tmp], %[ftmp1] \n\t" + "pshufh %[ftmp1], %[ftmp1], %[dest] \n\t" + + "1: \n\t" + "lwc1 %[rp], 0x00(%[row]) \n\t" + "lwc1 %[pp], 0x00(%[prev]) \n\t" + "xor %[ftmp0], %[pp], %[dest] \n\t" + "pavgb %[pp], %[pp], %[dest] \n\t" + "and %[ftmp0], %[ftmp0], %[ftmp1] \n\t" + "psubb %[pp], %[pp], %[ftmp0] \n\t" + "paddb %[dest], %[rp], %[pp] \n\t" + "swc1 %[dest], 0x00(%[row]) \n\t" + "daddiu %[row], %[row], 0x04 \n\t" + "daddiu %[prev], %[prev], 0x04 \n\t" + "daddiu %[istop], %[istop], -0x04 \n\t" + "bgtz %[istop], 1b \n\t" + : [rp]"=&f"(rp), [pp]"=&f"(pp), [ftmp0]"=&f"(ftmp[0]), + [ftmp1]"=&f"(ftmp[1]), [dest]"=&f"(dest), [tmp]"=&r"(tmp) + : [row]"r"(row), [prev]"r"(prev), [istop]"r"(istop) + : "memory" + ); +} + +void png_read_filter_row_paeth3_mmi(png_row_infop row_info, png_bytep row, + png_const_bytep prev) +{ + /* Paeth tries to predict pixel d using the pixel to the left of it, a, + * and two pixels from the previous row, b and c: + * prev: c b + * row: a d + * The Paeth function predicts d to be whichever of a, b, or c is nearest to + * p=a+b-c. + * + * The first pixel has no left context, and so uses an Up filter, p = b. + * This works naturally with our main loop's p = a+b-c if we force a and c + * to zero. + * Here we zero b and d, which become c and a respectively at the start of + * the loop. + */ + int istop = row_info->rowbytes; + double rp, pp, rp1, pp1, zero; + double a, b, c, d, pa, pb, pc; + double tmp0; + double ftmp[3]; + double eight, sixteen, twenty_four, forty_eight; + + __asm__ volatile ( + "xor %[a], %[a], %[a] \n\t" + "xor %[c], %[c], %[c] \n\t" + "xor %[zero], %[zero], %[zero] \n\t" + "li %[tmp0], 0x08 \n\t" + "dmtc1 %[tmp0], %[eight] \n\t" + "li %[tmp0], 0x10 \n\t" + "dmtc1 %[tmp0], %[sixteen] \n\t" + "li %[tmp0], 0x18 \n\t" + "dmtc1 %[tmp0], %[twenty_four] \n\t" + "li %[tmp0], 0x30 \n\t" + "dmtc1 %[tmp0], %[forty_eight] \n\t" + + "1: \n\t" + "gsldrc1 %[rp], 0x00(%[row]) \n\t" + "gsldlc1 %[rp], 0x07(%[row]) \n\t" + "gsldrc1 %[pp], 0x00(%[prev]) \n\t" + "gsldlc1 %[pp], 0x07(%[prev]) \n\t" + "gsldrc1 %[rp1], 0x08(%[row]) \n\t" + "gsldlc1 %[rp1], 0x0f(%[row]) \n\t" + "gsldrc1 %[pp1], 0x08(%[prev]) \n\t" + "gsldlc1 %[pp1], 0x0f(%[prev]) \n\t" + + "punpcklbh %[b], %[pp], %[zero] \n\t" + "punpcklbh %[d], %[rp], %[zero] \n\t" + "packushb %[ftmp0], %[c], %[c] \n\t" + "packushb %[ftmp1], %[a], %[a] \n\t" + "pasubub %[pa], %[pp], %[ftmp0] \n\t" + "pasubub %[pb], %[ftmp1], %[ftmp0] \n\t" + "psubh %[ftmp0], %[b], %[c] \n\t" + "psubh %[ftmp1], %[a], %[c] \n\t" + "paddh %[pc], %[ftmp0], %[ftmp1] \n\t" + "pcmpgth %[ftmp0], %[zero], %[pc] \n\t" + "xor %[pc], %[pc], %[ftmp0] \n\t" + "psubh %[pc], %[pc], %[ftmp0] \n\t" + "punpcklbh %[pa], %[pa], %[zero] \n\t" + "punpcklbh %[pb], %[pb], %[zero] \n\t" + "pcmpgth %[ftmp0], %[pa], %[pb] \n\t" + "and %[ftmp1], %[b], %[ftmp0] \n\t" + "pandn %[a], %[ftmp0], %[a] \n\t" + "or %[a], %[a], %[ftmp1] \n\t" + "pminsh %[pa], %[pa], %[pb] \n\t" + "pcmpgth %[ftmp0], %[pa], %[pc] \n\t" + "and %[ftmp1], %[c], %[ftmp0] \n\t" + "pandn %[a], %[ftmp0], %[a] \n\t" + "or %[a], %[a], %[ftmp1] \n\t" + "paddb %[a], %[a], %[d] \n\t" + "packushb %[d], %[a], %[a] \n\t" + "punpcklbh %[c], %[pp], %[zero] \n\t" + "swc1 %[d], 0x00(%[row]) \n\t" + + "dsrl %[ftmp0], %[rp], %[twenty_four] \n\t" + "dsrl %[ftmp2], %[pp], %[twenty_four] \n\t" + + "punpcklbh %[b], %[ftmp2], %[zero] \n\t" + "punpcklbh %[d], %[ftmp0], %[zero] \n\t" + "packushb %[ftmp0], %[c], %[c] \n\t" + "packushb %[ftmp1], %[a], %[a] \n\t" + "pasubub %[pa], %[ftmp2], %[ftmp0] \n\t" + "pasubub %[pb], %[ftmp1], %[ftmp0] \n\t" + "psubh %[ftmp0], %[b], %[c] \n\t" + "psubh %[ftmp1], %[a], %[c] \n\t" + "paddh %[pc], %[ftmp0], %[ftmp1] \n\t" + "pcmpgth %[ftmp0], %[zero], %[pc] \n\t" + "xor %[pc], %[pc], %[ftmp0] \n\t" + "psubh %[pc], %[pc], %[ftmp0] \n\t" + "punpcklbh %[pa], %[pa], %[zero] \n\t" + "punpcklbh %[pb], %[pb], %[zero] \n\t" + "pcmpgth %[ftmp0], %[pa], %[pb] \n\t" + "and %[ftmp1], %[b], %[ftmp0] \n\t" + "pandn %[a], %[ftmp0], %[a] \n\t" + "or %[a], %[a], %[ftmp1] \n\t" + "pminsh %[pa], %[pa], %[pb] \n\t" + "pcmpgth %[ftmp0], %[pa], %[pc] \n\t" + "and %[ftmp1], %[c], %[ftmp0] \n\t" + "pandn %[a], %[ftmp0], %[a] \n\t" + "or %[a], %[a], %[ftmp1] \n\t" + "paddb %[a], %[a], %[d] \n\t" + "packushb %[d], %[a], %[a] \n\t" + "punpcklbh %[c], %[ftmp2], %[zero] \n\t" + "gsswrc1 %[d], 0x03(%[row]) \n\t" + "gsswlc1 %[d], 0x06(%[row]) \n\t" + + "dsrl %[ftmp0], %[rp], %[forty_eight] \n\t" + "dsll %[ftmp1], %[rp1], %[sixteen] \n\t" + "or %[ftmp0], %[ftmp0], %[ftmp1] \n\t" + "dsrl %[ftmp2], %[pp], %[forty_eight] \n\t" + "dsll %[ftmp1], %[pp1], %[sixteen] \n\t" + "or %[ftmp2], %[ftmp2], %[ftmp1] \n\t" + + "punpcklbh %[b], %[ftmp2], %[zero] \n\t" + "punpcklbh %[d], %[ftmp0], %[zero] \n\t" + "packushb %[ftmp0], %[c], %[c] \n\t" + "packushb %[ftmp1], %[a], %[a] \n\t" + "pasubub %[pa], %[ftmp2], %[ftmp0] \n\t" + "pasubub %[pb], %[ftmp1], %[ftmp0] \n\t" + "psubh %[ftmp0], %[b], %[c] \n\t" + "psubh %[ftmp1], %[a], %[c] \n\t" + "paddh %[pc], %[ftmp0], %[ftmp1] \n\t" + "pcmpgth %[ftmp0], %[zero], %[pc] \n\t" + "xor %[pc], %[pc], %[ftmp0] \n\t" + "psubh %[pc], %[pc], %[ftmp0] \n\t" + "punpcklbh %[pa], %[pa], %[zero] \n\t" + "punpcklbh %[pb], %[pb], %[zero] \n\t" + "pcmpgth %[ftmp0], %[pa], %[pb] \n\t" + "and %[ftmp1], %[b], %[ftmp0] \n\t" + "pandn %[a], %[ftmp0], %[a] \n\t" + "or %[a], %[a], %[ftmp1] \n\t" + "pminsh %[pa], %[pa], %[pb] \n\t" + "pcmpgth %[ftmp0], %[pa], %[pc] \n\t" + "and %[ftmp1], %[c], %[ftmp0] \n\t" + "pandn %[a], %[ftmp0], %[a] \n\t" + "or %[a], %[a], %[ftmp1] \n\t" + "paddb %[a], %[a], %[d] \n\t" + "packushb %[d], %[a], %[a] \n\t" + "punpcklbh %[c], %[ftmp2], %[zero] \n\t" + "gsswrc1 %[d], 0x06(%[row]) \n\t" + "gsswlc1 %[d], 0x09(%[row]) \n\t" + + "dsrl %[ftmp0], %[rp1], %[eight] \n\t" + "dsrl %[ftmp2], %[pp1], %[eight] \n\t" + + "punpcklbh %[b], %[ftmp2], %[zero] \n\t" + "punpcklbh %[d], %[ftmp0], %[zero] \n\t" + "packushb %[ftmp0], %[c], %[c] \n\t" + "packushb %[ftmp1], %[a], %[a] \n\t" + "pasubub %[pa], %[ftmp2], %[ftmp0] \n\t" + "pasubub %[pb], %[ftmp1], %[ftmp0] \n\t" + "psubh %[ftmp0], %[b], %[c] \n\t" + "psubh %[ftmp1], %[a], %[c] \n\t" + "paddh %[pc], %[ftmp0], %[ftmp1] \n\t" + "pcmpgth %[ftmp0], %[zero], %[pc] \n\t" + "xor %[pc], %[pc], %[ftmp0] \n\t" + "psubh %[pc], %[pc], %[ftmp0] \n\t" + "punpcklbh %[pa], %[pa], %[zero] \n\t" + "punpcklbh %[pb], %[pb], %[zero] \n\t" + "pcmpgth %[ftmp0], %[pa], %[pb] \n\t" + "and %[ftmp1], %[b], %[ftmp0] \n\t" + "pandn %[a], %[ftmp0], %[a] \n\t" + "or %[a], %[a], %[ftmp1] \n\t" + "pminsh %[pa], %[pa], %[pb] \n\t" + "pcmpgth %[ftmp0], %[pa], %[pc] \n\t" + "and %[ftmp1], %[c], %[ftmp0] \n\t" + "pandn %[a], %[ftmp0], %[a] \n\t" + "or %[a], %[a], %[ftmp1] \n\t" + "paddb %[a], %[a], %[d] \n\t" + "packushb %[d], %[a], %[a] \n\t" + "punpcklbh %[c], %[ftmp2], %[zero] \n\t" + "gsswrc1 %[d], 0x09(%[row]) \n\t" + + "daddiu %[row], %[row], 0x0c \n\t" + "daddiu %[prev], %[prev], 0x0c \n\t" + "daddiu %[istop], %[istop], -0x0c \n\t" + "bgtz %[istop], 1b \n\t" + : [rp]"=&f"(rp), [pp]"=&f"(pp), [rp1]"=&f"(rp1), [pp1]"=&f"(pp1), + [zero]"=&f"(zero), [a]"=&f"(a),[b]"=&f"(b), [c]"=&f"(c), + [d]"=&f"(d), [pa]"=&f"(pa), [pb]"=&f"(pb), [pc]"=&f"(pc), + [tmp0]"=&r"(tmp0), [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]), + [ftmp2]"=&f"(ftmp[2]), [eight]"=&f"(eight), [sixteen]"=&f"(sixteen), + [twenty_four]"=&f"(twenty_four), [forty_eight]"=&f"(forty_eight) + : [row]"r"(row), [prev]"r"(prev), [istop]"r"(istop) + : "memory" + ); +} + +void png_read_filter_row_paeth4_mmi(png_row_infop row_info, png_bytep row, + png_const_bytep prev) +{ + /* Paeth tries to predict pixel d using the pixel to the left of it, a, + * and two pixels from the previous row, b and c: + * prev: c b + * row: a d + * The Paeth function predicts d to be whichever of a, b, or c is nearest to + * p=a+b-c. + * + * The first pixel has no left context, and so uses an Up filter, p = b. + * This works naturally with our main loop's p = a+b-c if we force a and c + * to zero. + * Here we zero b and d, which become c and a respectively at the start of + * the loop. + */ + int istop = row_info->rowbytes; + double rp, pp, zero; + double a, b, c, d, pa, pb, pc; + double ftmp[2]; + + __asm__ volatile ( + "xor %[a], %[a], %[a] \n\t" + "xor %[c], %[c], %[c] \n\t" + "xor %[zero], %[zero], %[zero] \n\t" + + "1: \n\t" + "lwc1 %[rp], 0x00(%[row]) \n\t" + "lwc1 %[pp], 0x00(%[prev]) \n\t" + "punpcklbh %[b], %[pp], %[zero] \n\t" + "punpcklbh %[d], %[rp], %[zero] \n\t" + + "packushb %[ftmp0], %[c], %[c] \n\t" + "packushb %[ftmp1], %[a], %[a] \n\t" + "pasubub %[pa], %[pp], %[ftmp0] \n\t" + "pasubub %[pb], %[ftmp1], %[ftmp0] \n\t" + "psubh %[ftmp0], %[b], %[c] \n\t" + "psubh %[ftmp1], %[a], %[c] \n\t" + "paddh %[pc], %[ftmp0], %[ftmp1] \n\t" + "pcmpgth %[ftmp0], %[zero], %[pc] \n\t" + "xor %[pc], %[pc], %[ftmp0] \n\t" + "psubh %[pc], %[pc], %[ftmp0] \n\t" + + "punpcklbh %[pa], %[pa], %[zero] \n\t" + "punpcklbh %[pb], %[pb], %[zero] \n\t" + + "pcmpgth %[ftmp0], %[pa], %[pb] \n\t" + "and %[ftmp1], %[b], %[ftmp0] \n\t" + "pandn %[a], %[ftmp0], %[a] \n\t" + "or %[a], %[a], %[ftmp1] \n\t" + "pminsh %[pa], %[pa], %[pb] \n\t" + + "pcmpgth %[ftmp0], %[pa], %[pc] \n\t" + "and %[ftmp1], %[c], %[ftmp0] \n\t" + "pandn %[a], %[ftmp0], %[a] \n\t" + "or %[a], %[a], %[ftmp1] \n\t" + "paddb %[a], %[a], %[d] \n\t" + "packushb %[d], %[a], %[a] \n\t" + "swc1 %[d], 0x00(%[row]) \n\t" + "punpcklbh %[c], %[pp], %[zero] \n\t" + "daddiu %[row], %[row], 0x04 \n\t" + "daddiu %[prev], %[prev], 0x04 \n\t" + "daddiu %[istop], %[istop], -0x04 \n\t" + "bgtz %[istop], 1b \n\t" + : [rp]"=&f"(rp), [pp]"=&f"(pp), [zero]"=&f"(zero), + [a]"=&f"(a), [b]"=&f"(b), [c]"=&f"(c), [d]"=&f"(d), + [pa]"=&f"(pa), [pb]"=&f"(pb), [pc]"=&f"(pc), + [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]) + : [row]"r"(row), [prev]"r"(prev), [istop]"r"(istop) + : "memory" + ); +} + +#endif /* PNG_MIPS_MMI_IMPLEMENTATION > 0 */ +#endif /* READ */ diff --git a/media/libpng/mips/filter_msa_intrinsics.c b/media/libpng/mips/filter_msa_intrinsics.c index a579179421..1b734f4d9a 100644 --- a/media/libpng/mips/filter_msa_intrinsics.c +++ b/media/libpng/mips/filter_msa_intrinsics.c @@ -1,9 +1,9 @@ /* filter_msa_intrinsics.c - MSA optimised filter functions * - * Copyright (c) 2018 Cosmin Truta + * Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 2016 Glenn Randers-Pehrson - * Written by Mandar Sahastrabuddhe, August 2016. + * Written by Mandar Sahastrabuddhe, August 2016 * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -11,7 +11,6 @@ */ #include <stdio.h> -#include <stdint.h> #include "../pngpriv.h" #ifdef PNG_READ_SUPPORTED @@ -20,6 +19,7 @@ #if PNG_MIPS_MSA_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */ #include <msa.h> +#include <stdint.h> /* libpng row pointers are not necessarily aligned to any particular boundary, * however this code will only work with appropriate alignment. mips/mips_init.c @@ -379,8 +379,8 @@ void png_read_filter_row_up_msa(png_row_infop row_info, png_bytep row, LD_UB4(pp, 16, src4, src5, src6, src7); pp += 64; - ADD4(src0, src4, src1, src5, src2, src6, src3, src7, - src0, src1, src2, src3); + ADD4(src0, src4, src1, src5, src2, src6, src3, src7, + src0, src1, src2, src3); ST_UB4(src0, src1, src2, src3, rp, 16); rp += 64; @@ -400,7 +400,7 @@ void png_read_filter_row_up_msa(png_row_infop row_info, png_bytep row, LD_UB4(pp, 16, src4, src5, src6, src7); ADD4(src0, src4, src1, src5, src2, src6, src3, src7, - src0, src1, src2, src3); + src0, src1, src2, src3); ST_UB4(src0, src1, src2, src3, rp, 16); rp += 64; @@ -425,7 +425,7 @@ void png_read_filter_row_up_msa(png_row_infop row_info, png_bytep row, LD_UB2(rp, 16, src0, src1); LD_UB2(pp, 16, src4, src5); - ADD2(src0, src4, src1, src5, src0, src1); + ADD2(src0, src4, src1, src5, src0, src1); ST_UB2(src0, src1, rp, 16); rp += 32; diff --git a/media/libpng/mips/mips_init.c b/media/libpng/mips/mips_init.c index 8dd283deef..5c6fa1dbf1 100644 --- a/media/libpng/mips/mips_init.c +++ b/media/libpng/mips/mips_init.c @@ -1,9 +1,10 @@ /* mips_init.c - MSA optimised filter functions * - * Copyright (c) 2018 Cosmin Truta + * Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 2016 Glenn Randers-Pehrson - * Written by Mandar Sahastrabuddhe, 2016. + * Written by Mandar Sahastrabuddhe, 2016 + * Updated by guxiwei, 2023 * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -20,8 +21,9 @@ #ifdef PNG_READ_SUPPORTED -#if PNG_MIPS_MSA_OPT > 0 -#ifdef PNG_MIPS_MSA_CHECK_SUPPORTED /* Do run-time checks */ +#if PNG_MIPS_MSA_IMPLEMENTATION == 1 || PNG_MIPS_MMI_IMPLEMENTATION > 0 + +#ifdef PNG_MIPS_MSA_CHECK_SUPPORTED /* Do MIPS MSA run-time checks */ /* WARNING: it is strongly recommended that you do not build libpng with * run-time checks for CPU features if at all possible. In the case of the MIPS * MSA instructions there is no processor-specific way of detecting the @@ -51,13 +53,83 @@ static int png_have_msa(png_structp png_ptr); #endif /* PNG_MIPS_MSA_FILE */ #endif /* PNG_MIPS_MSA_CHECK_SUPPORTED */ +#ifdef PNG_MIPS_MMI_CHECK_SUPPORTED /* Do MIPS MMI run-times checks */ +#ifndef PNG_MIPS_MMI_FILE +# ifdef __linux__ +# define PNG_MIPS_MMI_FILE "contrib/mips-mmi/linux.c" +# endif +#endif + +#ifdef PNG_MIPS_MMI_FILE + +#include <signal.h> /* for sig_atomic_t */ +static int png_have_mmi(); +#include PNG_MIPS_MMI_FILE + +#else /* PNG_MIPS_MMI_FILE */ +# error "PNG_MIPS_MMI_FILE undefined: no support for run-time MIPS MMI checks" +#endif /* PNG_MIPS_MMI_FILE */ +#endif /* PNG_MIPS_MMI_CHECK_SUPPORTED*/ + #ifndef PNG_ALIGNED_MEMORY_SUPPORTED # error "ALIGNED_MEMORY is required; set: -DPNG_ALIGNED_MEMORY_SUPPORTED" #endif +/* MIPS supports two optimizations: MMI and MSA. The appropriate + * optimization is chosen at runtime + */ void -png_init_filter_functions_msa(png_structp pp, unsigned int bpp) +png_init_filter_functions_mips(png_structp pp, unsigned int bpp) { +#if PNG_MIPS_MMI_IMPLEMENTATION > 0 +#ifdef PNG_MIPS_MMI_API_SUPPORTED + switch ((pp->options >> PNG_MIPS_MMI) & 3) + { + case PNG_OPTION_UNSET: +#endif /* PNG_MIPS_MMI_API_SUPPORTED */ +#ifdef PNG_MIPS_MMI_CHECK_SUPPORTED + { + static volatile sig_atomic_t no_mmi = -1; /* not checked */ + + if (no_mmi < 0) + no_mmi = !png_have_mmi(); + + if (no_mmi) + goto MIPS_MSA_INIT; + } +#ifdef PNG_MIPS_MMI_API_SUPPORTED + break; +#endif +#endif /* PNG_MIPS_MMI_CHECK_SUPPORTED */ + +#ifdef PNG_MIPS_MMI_API_SUPPORTED + default: /* OFF or INVALID */ + goto MIPS_MSA_INIT; + + case PNG_OPTION_ON: + /* Option turned on */ + break; + } +#endif + pp->read_filter[PNG_FILTER_VALUE_UP-1] = png_read_filter_row_up_mmi; + if (bpp == 3) + { + pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub3_mmi; + pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_mmi; + pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = + png_read_filter_row_paeth3_mmi; + } + else if (bpp == 4) + { + pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub4_mmi; + pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg4_mmi; + pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = + png_read_filter_row_paeth4_mmi; + } +#endif /* PNG_MIPS_MMI_IMPLEMENTATION > 0 */ + +MIPS_MSA_INIT: +#if PNG_MIPS_MSA_IMPLEMENTATION == 1 /* The switch statement is compiled in for MIPS_MSA_API, the call to * png_have_msa is compiled in for MIPS_MSA_CHECK. If both are defined * the check is only performed if the API has not set the MSA option on @@ -125,6 +197,8 @@ png_init_filter_functions_msa(png_structp pp, unsigned int bpp) pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg4_msa; pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth4_msa; } +#endif /* PNG_MIPS_MSA_IMPLEMENTATION == 1 */ + return; } -#endif /* PNG_MIPS_MSA_OPT > 0 */ +#endif /* PNG_MIPS_MSA_IMPLEMENTATION == 1 || PNG_MIPS_MMI_IMPLEMENTATION > 0 */ #endif /* READ */ diff --git a/media/libpng/moz.build b/media/libpng/moz.build index 4d308d2905..35e34d2873 100644 --- a/media/libpng/moz.build +++ b/media/libpng/moz.build @@ -53,6 +53,7 @@ if CONFIG['INTEL_ARCHITECTURE']: if CONFIG['TARGET_CPU'] in ('mips32', 'mips64'): DEFINES['MOZ_PNG_USE_MIPS_MSA'] = True UNIFIED_SOURCES += [ + 'mips/filter_mmi_inline_assembly.c', 'mips/filter_msa_intrinsics.c', 'mips/mips_init.c' ] diff --git a/media/libpng/moz.yaml b/media/libpng/moz.yaml index 11e0eefc7b..4d193089ac 100644 --- a/media/libpng/moz.yaml +++ b/media/libpng/moz.yaml @@ -11,9 +11,9 @@ origin: url: "http://www.libpng.org/pub/png/libpng.html" license: libpng - release: commit v1.6.39 (2022-11-20T23:53:23+02:00). + release: v1.6.43 (2024-02-23T11:51:40+02:00). - revision: "v1.6.39" + revision: "v1.6.43" license-file: LICENSE @@ -31,6 +31,7 @@ vendoring: exclude: - "**" + - "*/.editorconfig" include: - arm diff --git a/media/libpng/png.c b/media/libpng/png.c index 4f3e8bbd31..9ed3157009 100644 --- a/media/libpng/png.c +++ b/media/libpng/png.c @@ -1,7 +1,7 @@ /* png.c - location for general purpose libpng functions * - * Copyright (c) 2018-2022 Cosmin Truta + * Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -14,27 +14,7 @@ #include "pngpriv.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_6_39 Your_png_h_is_not_version_1_6_39; - -#ifdef __GNUC__ -/* The version tests may need to be added to, but the problem warning has - * consistently been fixed in GCC versions which obtain wide-spread release. - * The problem is that many versions of GCC rearrange comparison expressions in - * the optimizer in such a way that the results of the comparison will change - * if signed integer overflow occurs. Such comparisons are not permitted in - * ANSI C90, however GCC isn't clever enough to work out that that do not occur - * below in png_ascii_from_fp and png_muldiv, so it produces a warning with - * -Wextra. Unfortunately this is highly dependent on the optimizer and the - * machine architecture so the warning comes and goes unpredictably and is - * impossible to "fix", even were that a good idea. - */ -#if __GNUC__ == 7 && __GNUC_MINOR__ == 1 -#define GCC_STRICT_OVERFLOW 1 -#endif /* GNU 7.1.x */ -#endif /* GNU */ -#ifndef GCC_STRICT_OVERFLOW -#define GCC_STRICT_OVERFLOW 0 -#endif +typedef png_libpng_version_1_6_43 Your_png_h_is_not_version_1_6_43; /* Tells libpng that we have already handled the first "num_bytes" bytes * of the PNG file signature. If the PNG data is embedded into another @@ -73,21 +53,21 @@ png_set_sig_bytes(png_structrp png_ptr, int num_bytes) int PNGAPI png_sig_cmp(png_const_bytep sig, size_t start, size_t num_to_check) { - png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10}; + static const png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10}; if (num_to_check > 8) num_to_check = 8; else if (num_to_check < 1) - return (-1); + return -1; if (start > 7) - return (-1); + return -1; if (start + num_to_check > 8) num_to_check = 8 - start; - return ((int)(memcmp(&sig[start], &png_signature[start], num_to_check))); + return memcmp(&sig[start], &png_signature[start], num_to_check); } #endif /* READ */ @@ -447,7 +427,6 @@ png_info_init_3,(png_infopp ptr_ptr, size_t png_info_struct_size), memset(info_ptr, 0, (sizeof *info_ptr)); } -/* The following API is not called internally */ void PNGAPI png_data_freer(png_const_structrp png_ptr, png_inforp info_ptr, int freer, png_uint_32 mask) @@ -686,9 +665,9 @@ png_voidp PNGAPI png_get_io_ptr(png_const_structrp png_ptr) { if (png_ptr == NULL) - return (NULL); + return NULL; - return (png_ptr->io_ptr); + return png_ptr->io_ptr; } #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) @@ -752,7 +731,7 @@ png_convert_to_rfc1123_buffer(char out[29], png_const_timep ptime) { size_t pos = 0; - char number_buf[5]; /* enough for a four-digit year */ + char number_buf[5] = {0, 0, 0, 0, 0}; /* enough for a four-digit year */ # define APPEND_STRING(string) pos = png_safecat(out, 29, pos, (string)) # define APPEND_NUMBER(format, value)\ @@ -815,8 +794,8 @@ png_get_copyright(png_const_structrp png_ptr) return PNG_STRING_COPYRIGHT #else return PNG_STRING_NEWLINE \ - "libpng version 1.6.39" PNG_STRING_NEWLINE \ - "Copyright (c) 2018-2022 Cosmin Truta" PNG_STRING_NEWLINE \ + "libpng version 1.6.43" PNG_STRING_NEWLINE \ + "Copyright (c) 2018-2024 Cosmin Truta" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \ PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ @@ -977,7 +956,7 @@ png_reset_zstream(png_structrp png_ptr) return Z_STREAM_ERROR; /* WARNING: this resets the window bits to the maximum! */ - return (inflateReset(&png_ptr->zstream)); + return inflateReset(&png_ptr->zstream); } #endif /* READ */ @@ -986,7 +965,7 @@ png_uint_32 PNGAPI png_access_version_number(void) { /* Version of *.c files used when building libpng */ - return((png_uint_32)PNG_LIBPNG_VER); + return (png_uint_32)PNG_LIBPNG_VER; } #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) @@ -1842,14 +1821,14 @@ png_icc_profile_error(png_const_structrp png_ptr, png_colorspacerp colorspace, } # ifdef PNG_WARNINGS_SUPPORTED else - { - char number[PNG_NUMBER_BUFFER_SIZE]; /* +24 = 114 */ + { + char number[PNG_NUMBER_BUFFER_SIZE]; /* +24 = 114 */ - pos = png_safecat(message, (sizeof message), pos, - png_format_number(number, number+(sizeof number), - PNG_NUMBER_FORMAT_x, value)); - pos = png_safecat(message, (sizeof message), pos, "h: "); /* +2 = 116 */ - } + pos = png_safecat(message, (sizeof message), pos, + png_format_number(number, number+(sizeof number), + PNG_NUMBER_FORMAT_x, value)); + pos = png_safecat(message, (sizeof message), pos, "h: "); /* +2 = 116 */ + } # endif /* The 'reason' is an arbitrary message, allow +79 maximum 195 */ pos = png_safecat(message, (sizeof message), pos, reason); @@ -2532,17 +2511,6 @@ png_colorspace_set_rgb_coefficients(png_structrp png_ptr) #endif /* COLORSPACE */ -#ifdef __GNUC__ -/* This exists solely to work round a warning from GNU C. */ -static int /* PRIVATE */ -png_gt(size_t a, size_t b) -{ - return a > b; -} -#else -# define png_gt(a,b) ((a) > (b)) -#endif - void /* PRIVATE */ png_check_IHDR(png_const_structrp png_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, @@ -2564,8 +2532,16 @@ png_check_IHDR(png_const_structrp png_ptr, error = 1; } - if (png_gt(((width + 7) & (~7U)), - ((PNG_SIZE_MAX + /* The bit mask on the first line below must be at least as big as a + * png_uint_32. "~7U" is not adequate on 16-bit systems because it will + * be an unsigned 16-bit value. Casting to (png_alloc_size_t) makes the + * type of the result at least as bit (in bits) as the RHS of the > operator + * which also avoids a common warning on 64-bit systems that the comparison + * of (png_uint_32) against the constant value on the RHS will always be + * false. + */ + if (((width + 7) & ~(png_alloc_size_t)7) > + (((PNG_SIZE_MAX - 48 /* big_row_buf hack */ - 1) /* filter byte */ / 8) /* 8-byte RGBA pixels */ @@ -2891,14 +2867,6 @@ png_pow10(int power) /* Function to format a floating point value in ASCII with a given * precision. */ -#if GCC_STRICT_OVERFLOW -#pragma GCC diagnostic push -/* The problem arises below with exp_b10, which can never overflow because it - * comes, originally, from frexp and is therefore limited to a range which is - * typically +/-710 (log2(DBL_MAX)/log2(DBL_MIN)). - */ -#pragma GCC diagnostic warning "-Wstrict-overflow=2" -#endif /* GCC_STRICT_OVERFLOW */ void /* PRIVATE */ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, size_t size, double fp, unsigned int precision) @@ -3220,10 +3188,6 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, size_t size, /* Here on buffer too small. */ png_error(png_ptr, "ASCII conversion buffer too small"); } -#if GCC_STRICT_OVERFLOW -#pragma GCC diagnostic pop -#endif /* GCC_STRICT_OVERFLOW */ - # endif /* FLOATING_POINT */ # ifdef PNG_FIXED_POINT_SUPPORTED @@ -3251,7 +3215,7 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii, if (num <= 0x80000000) /* else overflowed */ { unsigned int ndigits = 0, first = 16 /* flag value */; - char digits[10]; + char digits[10] = {0}; while (num) { @@ -3336,15 +3300,6 @@ png_fixed(png_const_structrp png_ptr, double fp, png_const_charp text) * the nearest .00001). Overflow and divide by zero are signalled in * the result, a boolean - true on success, false on overflow. */ -#if GCC_STRICT_OVERFLOW /* from above */ -/* It is not obvious which comparison below gets optimized in such a way that - * signed overflow would change the result; looking through the code does not - * reveal any tests which have the form GCC complains about, so presumably the - * optimizer is moving an add or subtract into the 'if' somewhere. - */ -#pragma GCC diagnostic push -#pragma GCC diagnostic warning "-Wstrict-overflow=2" -#endif /* GCC_STRICT_OVERFLOW */ int png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times, png_int_32 divisor) @@ -3459,9 +3414,6 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times, return 0; } -#if GCC_STRICT_OVERFLOW -#pragma GCC diagnostic pop -#endif /* GCC_STRICT_OVERFLOW */ #endif /* READ_GAMMA || INCH_CONVERSIONS */ #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED) diff --git a/media/libpng/png.h b/media/libpng/png.h index 21f3529ee1..88d41585f5 100644 --- a/media/libpng/png.h +++ b/media/libpng/png.h @@ -1,9 +1,9 @@ /* png.h - header file for PNG reference library * - * libpng version 1.6.39 - November 20, 2022 + * libpng version 1.6.43 * - * Copyright (c) 2018-2022 Cosmin Truta + * Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -15,7 +15,7 @@ * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger * libpng versions 0.97, January 1998, through 1.6.35, July 2018: * Glenn Randers-Pehrson - * libpng versions 1.6.36, December 2018, through 1.6.39, November 2022: + * libpng versions 1.6.36, December 2018, through 1.6.43, February 2024: * Cosmin Truta * See also "Contributing Authors", below. */ @@ -27,8 +27,8 @@ * PNG Reference Library License version 2 * --------------------------------------- * - * * Copyright (c) 1995-2022 The PNG Reference Library Authors. - * * Copyright (c) 2018-2022 Cosmin Truta. + * * Copyright (c) 1995-2024 The PNG Reference Library Authors. + * * Copyright (c) 2018-2024 Cosmin Truta. * * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson. * * Copyright (c) 1996-1997 Andreas Dilger. * * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -239,7 +239,7 @@ * ... * 1.5.30 15 10530 15.so.15.30[.0] * ... - * 1.6.39 16 10639 16.so.16.39[.0] + * 1.6.43 16 10643 16.so.16.43[.0] * * Henceforth the source version will match the shared-library major and * minor numbers; the shared-library major version number will be used for @@ -255,9 +255,6 @@ * to the info_ptr or png_ptr members through png.h, and the compiled * application is loaded with a different version of the library. * - * DLLNUM will change each time there are forward or backward changes - * in binary compatibility (e.g., when a new feature is added). - * * See libpng.txt or libpng.3 for more information. The PNG specification * is available as a W3C Recommendation and as an ISO/IEC Standard; see * <https://www.w3.org/TR/2003/REC-PNG-20031110/> @@ -278,19 +275,21 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.6.39" -#define PNG_HEADER_VERSION_STRING " libpng version 1.6.39 - November 20, 2022\n" +#define PNG_LIBPNG_VER_STRING "1.6.43" +#define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n" -#define PNG_LIBPNG_VER_SONUM 16 -#define PNG_LIBPNG_VER_DLLNUM 16 +/* The versions of shared library builds should stay in sync, going forward */ +#define PNG_LIBPNG_VER_SHAREDLIB 16 +#define PNG_LIBPNG_VER_SONUM PNG_LIBPNG_VER_SHAREDLIB /* [Deprecated] */ +#define PNG_LIBPNG_VER_DLLNUM PNG_LIBPNG_VER_SHAREDLIB /* [Deprecated] */ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 6 -#define PNG_LIBPNG_VER_RELEASE 39 +#define PNG_LIBPNG_VER_RELEASE 43 /* This should be zero for a public release, or non-zero for a - * development version. [Deprecated] + * development version. */ #define PNG_LIBPNG_VER_BUILD 0 @@ -318,7 +317,7 @@ * From version 1.0.1 it is: * XXYYZZ, where XX=major, YY=minor, ZZ=release */ -#define PNG_LIBPNG_VER 10639 /* 1.6.39 */ +#define PNG_LIBPNG_VER 10643 /* 1.6.43 */ /* Library configuration: these options cannot be changed after * the library has been built. @@ -443,7 +442,7 @@ extern "C" { /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ -typedef char* png_libpng_version_1_6_39; +typedef char* png_libpng_version_1_6_43; /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. * @@ -872,7 +871,7 @@ PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), PNGARG((jmp_buf, int)), typedef); #define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 /* read only */ /* Added to libpng-1.5.4 */ #define PNG_TRANSFORM_EXPAND_16 0x4000 /* read only */ -#if INT_MAX >= 0x8000 /* else this might break */ +#if ~0U > 0xffffU /* or else this might break on a 16-bit machine */ #define PNG_TRANSFORM_SCALE_16 0x8000 /* read only */ #endif @@ -931,15 +930,15 @@ PNG_EXPORT(2, void, png_set_sig_bytes, (png_structrp png_ptr, int num_bytes)); /* Check sig[start] through sig[start + num_to_check - 1] to see if it's a * PNG file. Returns zero if the supplied bytes match the 8-byte PNG * signature, and non-zero otherwise. Having num_to_check == 0 or - * start > 7 will always fail (ie return non-zero). + * start > 7 will always fail (i.e. return non-zero). */ PNG_EXPORT(3, int, png_sig_cmp, (png_const_bytep sig, size_t start, size_t num_to_check)); /* Simple signature checking function. This is the same as calling - * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n). + * png_check_sig(sig, n) := (png_sig_cmp(sig, 0, n) == 0). */ -#define png_check_sig(sig, n) !png_sig_cmp((sig), 0, (n)) +#define png_check_sig(sig, n) (png_sig_cmp((sig), 0, (n)) == 0) /* DEPRECATED */ /* Allocate and initialize png_ptr struct for reading, and any other memory. */ PNG_EXPORTA(4, png_structp, png_create_read_struct, @@ -1753,12 +1752,9 @@ PNG_EXPORT(97, void, png_free, (png_const_structrp png_ptr, png_voidp ptr)); PNG_EXPORT(98, void, png_free_data, (png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 free_me, int num)); -/* Reassign responsibility for freeing existing data, whether allocated +/* Reassign the responsibility for freeing existing data, whether allocated * by libpng or by the application; this works on the png_info structure passed - * in, it does not change the state for other png_info structures. - * - * It is unlikely that this function works correctly as of 1.6.0 and using it - * may result either in memory leaks or double free of allocated data. + * in, without changing the state for other png_info structures. */ PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr, png_inforp info_ptr, int freer, png_uint_32 mask)); @@ -3230,11 +3226,18 @@ PNG_EXPORT(245, int, png_image_write_to_memory, (png_imagep image, void *memory, #ifdef PNG_MIPS_MSA_API_SUPPORTED # define PNG_MIPS_MSA 6 /* HARDWARE: MIPS Msa SIMD instructions supported */ #endif -#define PNG_IGNORE_ADLER32 8 +#ifdef PNG_DISABLE_ADLER32_CHECK_SUPPORTED +# define PNG_IGNORE_ADLER32 8 /* SOFTWARE: disable Adler32 check on IDAT */ +#endif #ifdef PNG_POWERPC_VSX_API_SUPPORTED -# define PNG_POWERPC_VSX 10 /* HARDWARE: PowerPC VSX SIMD instructions supported */ +# define PNG_POWERPC_VSX 10 /* HARDWARE: PowerPC VSX SIMD instructions + * supported */ #endif -#define PNG_OPTION_NEXT 12 /* Next option - numbers must be even */ +#ifdef PNG_MIPS_MMI_API_SUPPORTED +# define PNG_MIPS_MMI 12 /* HARDWARE: MIPS MMI SIMD instructions supported */ +#endif + +#define PNG_OPTION_NEXT 14 /* Next option - numbers must be even */ /* Return values: NOTE: there are four values and 'off' is *not* zero */ #define PNG_OPTION_UNSET 0 /* Unset - defaults to off */ diff --git a/media/libpng/pngconf.h b/media/libpng/pngconf.h index fcb4b43069..000d7b1a8a 100644 --- a/media/libpng/pngconf.h +++ b/media/libpng/pngconf.h @@ -1,9 +1,9 @@ /* pngconf.h - machine-configurable file for libpng * - * libpng version 1.6.39 + * libpng version 1.6.43 * - * Copyright (c) 2018-2022 Cosmin Truta + * Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. diff --git a/media/libpng/pngerror.c b/media/libpng/pngerror.c index ec3a709b9d..29ebda7943 100644 --- a/media/libpng/pngerror.c +++ b/media/libpng/pngerror.c @@ -1,7 +1,7 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * Copyright (c) 2018 Cosmin Truta + * Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -255,7 +255,7 @@ void png_warning_parameter_unsigned(png_warning_parameters p, int number, int format, png_alloc_size_t value) { - char buffer[PNG_NUMBER_BUFFER_SIZE]; + char buffer[PNG_NUMBER_BUFFER_SIZE] = {0}; png_warning_parameter(p, number, PNG_FORMAT_NUMBER(buffer, format, value)); } @@ -265,7 +265,7 @@ png_warning_parameter_signed(png_warning_parameters p, int number, int format, { png_alloc_size_t u; png_charp str; - char buffer[PNG_NUMBER_BUFFER_SIZE]; + char buffer[PNG_NUMBER_BUFFER_SIZE] = {0}; /* Avoid overflow by doing the negate in a png_alloc_size_t: */ u = (png_alloc_size_t)value; @@ -858,7 +858,7 @@ png_get_error_ptr(png_const_structrp png_ptr) if (png_ptr == NULL) return NULL; - return ((png_voidp)png_ptr->error_ptr); + return (png_voidp)png_ptr->error_ptr; } @@ -933,31 +933,25 @@ png_safe_warning(png_structp png_nonconst_ptr, png_const_charp warning_message) #endif int /* PRIVATE */ -png_safe_execute(png_imagep image_in, int (*function)(png_voidp), png_voidp arg) +png_safe_execute(png_imagep image, int (*function)(png_voidp), png_voidp arg) { - volatile png_imagep image = image_in; - volatile int result; - volatile png_voidp saved_error_buf; + png_voidp saved_error_buf = image->opaque->error_buf; jmp_buf safe_jmpbuf; + int result; - /* Safely execute function(arg) with png_error returning to this function. */ - saved_error_buf = image->opaque->error_buf; - result = setjmp(safe_jmpbuf) == 0; - - if (result != 0) + /* Safely execute function(arg), with png_error returning back here. */ + if (setjmp(safe_jmpbuf) == 0) { - image->opaque->error_buf = safe_jmpbuf; result = function(arg); + image->opaque->error_buf = saved_error_buf; + return result; } + /* On png_error, return via longjmp, pop the jmpbuf, and free the image. */ image->opaque->error_buf = saved_error_buf; - - /* And do the cleanup prior to any failure return. */ - if (result == 0) - png_image_free(image); - - return result; + png_image_free(image); + return 0; } #endif /* SIMPLIFIED READ || SIMPLIFIED_WRITE */ #endif /* READ || WRITE */ diff --git a/media/libpng/pngget.c b/media/libpng/pngget.c index 9fccc61792..9c7977b287 100644 --- a/media/libpng/pngget.c +++ b/media/libpng/pngget.c @@ -1,7 +1,7 @@ /* pngget.c - retrieval of values from info struct * - * Copyright (c) 2018 Cosmin Truta + * Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -21,18 +21,29 @@ png_get_valid(png_const_structrp png_ptr, png_const_inforp info_ptr, png_uint_32 flag) { if (png_ptr != NULL && info_ptr != NULL) - return(info_ptr->valid & flag); + { +#ifdef PNG_READ_tRNS_SUPPORTED + /* png_handle_PLTE() may have canceled a valid tRNS chunk but left the + * 'valid' flag for the detection of duplicate chunks. Do not report a + * valid tRNS chunk in this case. + */ + if (flag == PNG_INFO_tRNS && png_ptr->num_trans == 0) + return 0; +#endif - return(0); + return info_ptr->valid & flag; + } + + return 0; } size_t PNGAPI png_get_rowbytes(png_const_structrp png_ptr, png_const_inforp info_ptr) { if (png_ptr != NULL && info_ptr != NULL) - return(info_ptr->rowbytes); + return info_ptr->rowbytes; - return(0); + return 0; } #ifdef PNG_INFO_IMAGE_SUPPORTED @@ -40,9 +51,9 @@ png_bytepp PNGAPI png_get_rows(png_const_structrp png_ptr, png_const_inforp info_ptr) { if (png_ptr != NULL && info_ptr != NULL) - return(info_ptr->row_pointers); + return info_ptr->row_pointers; - return(0); + return 0; } #endif @@ -54,7 +65,7 @@ png_get_image_width(png_const_structrp png_ptr, png_const_inforp info_ptr) if (png_ptr != NULL && info_ptr != NULL) return info_ptr->width; - return (0); + return 0; } png_uint_32 PNGAPI @@ -63,7 +74,7 @@ png_get_image_height(png_const_structrp png_ptr, png_const_inforp info_ptr) if (png_ptr != NULL && info_ptr != NULL) return info_ptr->height; - return (0); + return 0; } png_byte PNGAPI @@ -72,7 +83,7 @@ png_get_bit_depth(png_const_structrp png_ptr, png_const_inforp info_ptr) if (png_ptr != NULL && info_ptr != NULL) return info_ptr->bit_depth; - return (0); + return 0; } png_byte PNGAPI @@ -81,7 +92,7 @@ png_get_color_type(png_const_structrp png_ptr, png_const_inforp info_ptr) if (png_ptr != NULL && info_ptr != NULL) return info_ptr->color_type; - return (0); + return 0; } png_byte PNGAPI @@ -90,7 +101,7 @@ png_get_filter_type(png_const_structrp png_ptr, png_const_inforp info_ptr) if (png_ptr != NULL && info_ptr != NULL) return info_ptr->filter_type; - return (0); + return 0; } png_byte PNGAPI @@ -99,7 +110,7 @@ png_get_interlace_type(png_const_structrp png_ptr, png_const_inforp info_ptr) if (png_ptr != NULL && info_ptr != NULL) return info_ptr->interlace_type; - return (0); + return 0; } png_byte PNGAPI @@ -108,7 +119,7 @@ png_get_compression_type(png_const_structrp png_ptr, png_const_inforp info_ptr) if (png_ptr != NULL && info_ptr != NULL) return info_ptr->compression_type; - return (0); + return 0; } png_uint_32 PNGAPI @@ -116,21 +127,20 @@ png_get_x_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr) { #ifdef PNG_pHYs_SUPPORTED + png_debug(1, "in png_get_x_pixels_per_meter"); + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs) != 0) - { - png_debug1(1, "in %s retrieval function", - "png_get_x_pixels_per_meter"); - - if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER) - return (info_ptr->x_pixels_per_unit); - } + { + if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER) + return info_ptr->x_pixels_per_unit; + } #else PNG_UNUSED(png_ptr) PNG_UNUSED(info_ptr) #endif - return (0); + return 0; } png_uint_32 PNGAPI @@ -138,42 +148,41 @@ png_get_y_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr) { #ifdef PNG_pHYs_SUPPORTED + png_debug(1, "in png_get_y_pixels_per_meter"); + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs) != 0) { - png_debug1(1, "in %s retrieval function", - "png_get_y_pixels_per_meter"); - if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER) - return (info_ptr->y_pixels_per_unit); + return info_ptr->y_pixels_per_unit; } #else PNG_UNUSED(png_ptr) PNG_UNUSED(info_ptr) #endif - return (0); + return 0; } png_uint_32 PNGAPI png_get_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr) { #ifdef PNG_pHYs_SUPPORTED + png_debug(1, "in png_get_pixels_per_meter"); + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs) != 0) { - png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter"); - if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER && info_ptr->x_pixels_per_unit == info_ptr->y_pixels_per_unit) - return (info_ptr->x_pixels_per_unit); + return info_ptr->x_pixels_per_unit; } #else PNG_UNUSED(png_ptr) PNG_UNUSED(info_ptr) #endif - return (0); + return 0; } #ifdef PNG_FLOATING_POINT_SUPPORTED @@ -182,21 +191,21 @@ png_get_pixel_aspect_ratio(png_const_structrp png_ptr, png_const_inforp info_ptr) { #ifdef PNG_READ_pHYs_SUPPORTED + png_debug(1, "in png_get_pixel_aspect_ratio"); + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs) != 0) { - png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio"); - if (info_ptr->x_pixels_per_unit != 0) - return ((float)((float)info_ptr->y_pixels_per_unit - /(float)info_ptr->x_pixels_per_unit)); + return (float)info_ptr->y_pixels_per_unit + / (float)info_ptr->x_pixels_per_unit; } #else PNG_UNUSED(png_ptr) PNG_UNUSED(info_ptr) #endif - return ((float)0.0); + return (float)0.0; } #endif @@ -206,6 +215,8 @@ png_get_pixel_aspect_ratio_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr) { #ifdef PNG_READ_pHYs_SUPPORTED + png_debug(1, "in png_get_pixel_aspect_ratio_fixed"); + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs) != 0 && info_ptr->x_pixels_per_unit > 0 && info_ptr->y_pixels_per_unit > 0 && @@ -214,8 +225,6 @@ png_get_pixel_aspect_ratio_fixed(png_const_structrp png_ptr, { png_fixed_point res; - png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio_fixed"); - /* The following casts work because a PNG 4 byte integer only has a valid * range of 0..2^31-1; otherwise the cast might overflow. */ @@ -236,80 +245,80 @@ png_int_32 PNGAPI png_get_x_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr) { #ifdef PNG_oFFs_SUPPORTED + png_debug(1, "in png_get_x_offset_microns"); + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs) != 0) { - png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns"); - if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER) - return (info_ptr->x_offset); + return info_ptr->x_offset; } #else PNG_UNUSED(png_ptr) PNG_UNUSED(info_ptr) #endif - return (0); + return 0; } png_int_32 PNGAPI png_get_y_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr) { #ifdef PNG_oFFs_SUPPORTED + png_debug(1, "in png_get_y_offset_microns"); + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs) != 0) { - png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns"); - if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER) - return (info_ptr->y_offset); + return info_ptr->y_offset; } #else PNG_UNUSED(png_ptr) PNG_UNUSED(info_ptr) #endif - return (0); + return 0; } png_int_32 PNGAPI png_get_x_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr) { #ifdef PNG_oFFs_SUPPORTED + png_debug(1, "in png_get_x_offset_pixels"); + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs) != 0) { - png_debug1(1, "in %s retrieval function", "png_get_x_offset_pixels"); - if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL) - return (info_ptr->x_offset); + return info_ptr->x_offset; } #else PNG_UNUSED(png_ptr) PNG_UNUSED(info_ptr) #endif - return (0); + return 0; } png_int_32 PNGAPI png_get_y_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr) { #ifdef PNG_oFFs_SUPPORTED + png_debug(1, "in png_get_y_offset_pixels"); + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs) != 0) { - png_debug1(1, "in %s retrieval function", "png_get_y_offset_pixels"); - if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL) - return (info_ptr->y_offset); + return info_ptr->y_offset; } #else PNG_UNUSED(png_ptr) PNG_UNUSED(info_ptr) #endif - return (0); + return 0; } #ifdef PNG_INCH_CONVERSIONS_SUPPORTED @@ -423,11 +432,11 @@ png_get_pHYs_dpi(png_const_structrp png_ptr, png_const_inforp info_ptr, { png_uint_32 retval = 0; + png_debug1(1, "in %s retrieval function", "pHYs"); + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs) != 0) { - png_debug1(1, "in %s retrieval function", "pHYs"); - if (res_x != NULL) { *res_x = info_ptr->x_pixels_per_unit; @@ -453,7 +462,7 @@ png_get_pHYs_dpi(png_const_structrp png_ptr, png_const_inforp info_ptr, } } - return (retval); + return retval; } #endif /* pHYs */ #endif /* INCH_CONVERSIONS */ @@ -467,9 +476,9 @@ png_byte PNGAPI png_get_channels(png_const_structrp png_ptr, png_const_inforp info_ptr) { if (png_ptr != NULL && info_ptr != NULL) - return(info_ptr->channels); + return info_ptr->channels; - return (0); + return 0; } #ifdef PNG_READ_SUPPORTED @@ -477,9 +486,9 @@ png_const_bytep PNGAPI png_get_signature(png_const_structrp png_ptr, png_const_inforp info_ptr) { if (png_ptr != NULL && info_ptr != NULL) - return(info_ptr->signature); + return info_ptr->signature; - return (NULL); + return NULL; } #endif @@ -488,17 +497,17 @@ png_uint_32 PNGAPI png_get_bKGD(png_const_structrp png_ptr, png_inforp info_ptr, png_color_16p *background) { + png_debug1(1, "in %s retrieval function", "bKGD"); + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD) != 0 && background != NULL) { - png_debug1(1, "in %s retrieval function", "bKGD"); - *background = &(info_ptr->background); - return (PNG_INFO_bKGD); + return PNG_INFO_bKGD; } - return (0); + return 0; } #endif @@ -513,6 +522,8 @@ png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr, double *white_x, double *white_y, double *red_x, double *red_y, double *green_x, double *green_y, double *blue_x, double *blue_y) { + png_debug1(1, "in %s retrieval function", "cHRM"); + /* Quiet API change: this code used to only return the end points if a cHRM * chunk was present, but the end points can also come from iCCP or sRGB * chunks, so in 1.6.0 the png_get_ APIs return the end points regardless and @@ -522,8 +533,6 @@ png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr, if (png_ptr != NULL && info_ptr != NULL && (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0) { - png_debug1(1, "in %s retrieval function", "cHRM"); - if (white_x != NULL) *white_x = png_float(png_ptr, info_ptr->colorspace.end_points_xy.whitex, "cHRM white X"); @@ -548,10 +557,10 @@ png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr, if (blue_y != NULL) *blue_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluey, "cHRM blue Y"); - return (PNG_INFO_cHRM); + return PNG_INFO_cHRM; } - return (0); + return 0; } png_uint_32 PNGAPI @@ -560,11 +569,11 @@ png_get_cHRM_XYZ(png_const_structrp png_ptr, png_const_inforp info_ptr, double *green_Y, double *green_Z, double *blue_X, double *blue_Y, double *blue_Z) { + png_debug1(1, "in %s retrieval function", "cHRM_XYZ(float)"); + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0) { - png_debug1(1, "in %s retrieval function", "cHRM_XYZ(float)"); - if (red_X != NULL) *red_X = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_X, "cHRM red X"); @@ -592,10 +601,10 @@ png_get_cHRM_XYZ(png_const_structrp png_ptr, png_const_inforp info_ptr, if (blue_Z != NULL) *blue_Z = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.blue_Z, "cHRM blue Z"); - return (PNG_INFO_cHRM); + return PNG_INFO_cHRM; } - return (0); + return 0; } # endif @@ -608,11 +617,11 @@ png_get_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr, png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y, png_fixed_point *int_blue_Z) { + png_debug1(1, "in %s retrieval function", "cHRM_XYZ"); + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0) { - png_debug1(1, "in %s retrieval function", "cHRM_XYZ"); - if (int_red_X != NULL) *int_red_X = info_ptr->colorspace.end_points_XYZ.red_X; if (int_red_Y != NULL) @@ -631,10 +640,10 @@ png_get_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr, *int_blue_Y = info_ptr->colorspace.end_points_XYZ.blue_Y; if (int_blue_Z != NULL) *int_blue_Z = info_ptr->colorspace.end_points_XYZ.blue_Z; - return (PNG_INFO_cHRM); + return PNG_INFO_cHRM; } - return (0); + return 0; } png_uint_32 PNGAPI @@ -664,10 +673,10 @@ png_get_cHRM_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr, *blue_x = info_ptr->colorspace.end_points_xy.bluex; if (blue_y != NULL) *blue_y = info_ptr->colorspace.end_points_xy.bluey; - return (PNG_INFO_cHRM); + return PNG_INFO_cHRM; } - return (0); + return 0; } # endif #endif @@ -685,10 +694,10 @@ png_get_gAMA_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr, file_gamma != NULL) { *file_gamma = info_ptr->colorspace.gamma; - return (PNG_INFO_gAMA); + return PNG_INFO_gAMA; } - return (0); + return 0; } # endif @@ -705,10 +714,10 @@ png_get_gAMA(png_const_structrp png_ptr, png_const_inforp info_ptr, { *file_gamma = png_float(png_ptr, info_ptr->colorspace.gamma, "png_get_gAMA"); - return (PNG_INFO_gAMA); + return PNG_INFO_gAMA; } - return (0); + return 0; } # endif #endif @@ -724,10 +733,10 @@ png_get_sRGB(png_const_structrp png_ptr, png_const_inforp info_ptr, (info_ptr->valid & PNG_INFO_sRGB) != 0 && file_srgb_intent != NULL) { *file_srgb_intent = info_ptr->colorspace.rendering_intent; - return (PNG_INFO_sRGB); + return PNG_INFO_sRGB; } - return (0); + return 0; } #endif @@ -751,10 +760,10 @@ png_get_iCCP(png_const_structrp png_ptr, png_inforp info_ptr, */ if (compression_type != NULL) *compression_type = PNG_COMPRESSION_TYPE_BASE; - return (PNG_INFO_iCCP); + return PNG_INFO_iCCP; } - return (0); + return 0; } #endif @@ -764,13 +773,15 @@ int PNGAPI png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr, png_sPLT_tpp spalettes) { + png_debug1(1, "in %s retrieval function", "sPLT"); + if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL) { *spalettes = info_ptr->splt_palettes; return info_ptr->splt_palettes_num; } - return (0); + return 0; } #endif @@ -796,10 +807,10 @@ png_get_eXIf_1(png_const_structrp png_ptr, png_const_inforp info_ptr, { *num_exif = info_ptr->num_exif; *exif = info_ptr->exif; - return (PNG_INFO_eXIf); + return PNG_INFO_eXIf; } - return (0); + return 0; } #endif @@ -814,10 +825,10 @@ png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr, (info_ptr->valid & PNG_INFO_hIST) != 0 && hist != NULL) { *hist = info_ptr->hist; - return (PNG_INFO_hIST); + return PNG_INFO_hIST; } - return (0); + return 0; } #endif @@ -830,7 +841,7 @@ png_get_IHDR(png_const_structrp png_ptr, png_const_inforp info_ptr, png_debug1(1, "in %s retrieval function", "IHDR"); if (png_ptr == NULL || info_ptr == NULL) - return (0); + return 0; if (width != NULL) *width = info_ptr->width; @@ -862,7 +873,7 @@ png_get_IHDR(png_const_structrp png_ptr, png_const_inforp info_ptr, info_ptr->bit_depth, info_ptr->color_type, info_ptr->interlace_type, info_ptr->compression_type, info_ptr->filter_type); - return (1); + return 1; } #ifdef PNG_oFFs_SUPPORTED @@ -879,10 +890,10 @@ png_get_oFFs(png_const_structrp png_ptr, png_const_inforp info_ptr, *offset_x = info_ptr->x_offset; *offset_y = info_ptr->y_offset; *unit_type = (int)info_ptr->offset_unit_type; - return (PNG_INFO_oFFs); + return PNG_INFO_oFFs; } - return (0); + return 0; } #endif @@ -906,10 +917,10 @@ png_get_pCAL(png_const_structrp png_ptr, png_inforp info_ptr, *nparams = (int)info_ptr->pcal_nparams; *units = info_ptr->pcal_units; *params = info_ptr->pcal_params; - return (PNG_INFO_pCAL); + return PNG_INFO_pCAL; } - return (0); + return 0; } #endif @@ -921,6 +932,8 @@ png_uint_32 PNGAPI png_get_sCAL_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr, int *unit, png_fixed_point *width, png_fixed_point *height) { + png_debug1(1, "in %s retrieval function", "sCAL"); + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sCAL) != 0) { @@ -932,10 +945,10 @@ png_get_sCAL_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr, *width = png_fixed(png_ptr, atof(info_ptr->scal_s_width), "sCAL width"); *height = png_fixed(png_ptr, atof(info_ptr->scal_s_height), "sCAL height"); - return (PNG_INFO_sCAL); + return PNG_INFO_sCAL; } - return(0); + return 0; } # endif /* FLOATING_ARITHMETIC */ # endif /* FIXED_POINT */ @@ -944,32 +957,36 @@ png_uint_32 PNGAPI png_get_sCAL(png_const_structrp png_ptr, png_const_inforp info_ptr, int *unit, double *width, double *height) { + png_debug1(1, "in %s retrieval function", "sCAL(float)"); + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sCAL) != 0) { *unit = info_ptr->scal_unit; *width = atof(info_ptr->scal_s_width); *height = atof(info_ptr->scal_s_height); - return (PNG_INFO_sCAL); + return PNG_INFO_sCAL; } - return(0); + return 0; } # endif /* FLOATING POINT */ png_uint_32 PNGAPI png_get_sCAL_s(png_const_structrp png_ptr, png_const_inforp info_ptr, int *unit, png_charpp width, png_charpp height) { + png_debug1(1, "in %s retrieval function", "sCAL(str)"); + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sCAL) != 0) { *unit = info_ptr->scal_unit; *width = info_ptr->scal_s_width; *height = info_ptr->scal_s_height; - return (PNG_INFO_sCAL); + return PNG_INFO_sCAL; } - return(0); + return 0; } #endif /* sCAL */ @@ -1004,7 +1021,7 @@ png_get_pHYs(png_const_structrp png_ptr, png_const_inforp info_ptr, } } - return (retval); + return retval; } #endif /* pHYs */ @@ -1020,10 +1037,10 @@ png_get_PLTE(png_const_structrp png_ptr, png_inforp info_ptr, *palette = info_ptr->palette; *num_palette = info_ptr->num_palette; png_debug1(3, "num_palette = %d", *num_palette); - return (PNG_INFO_PLTE); + return PNG_INFO_PLTE; } - return (0); + return 0; } #ifdef PNG_sBIT_SUPPORTED @@ -1037,10 +1054,10 @@ png_get_sBIT(png_const_structrp png_ptr, png_inforp info_ptr, (info_ptr->valid & PNG_INFO_sBIT) != 0 && sig_bit != NULL) { *sig_bit = &(info_ptr->sig_bit); - return (PNG_INFO_sBIT); + return PNG_INFO_sBIT; } - return (0); + return 0; } #endif @@ -1051,7 +1068,7 @@ png_get_text(png_const_structrp png_ptr, png_inforp info_ptr, { if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0) { - png_debug1(1, "in 0x%lx retrieval function", + png_debug1(1, "in text retrieval function, chunk typeid = 0x%lx", (unsigned long)png_ptr->chunk_name); if (text_ptr != NULL) @@ -1066,7 +1083,7 @@ png_get_text(png_const_structrp png_ptr, png_inforp info_ptr, if (num_text != NULL) *num_text = 0; - return(0); + return 0; } #endif @@ -1081,10 +1098,10 @@ png_get_tIME(png_const_structrp png_ptr, png_inforp info_ptr, (info_ptr->valid & PNG_INFO_tIME) != 0 && mod_time != NULL) { *mod_time = &(info_ptr->mod_time); - return (PNG_INFO_tIME); + return PNG_INFO_tIME; } - return (0); + return 0; } #endif @@ -1094,11 +1111,12 @@ png_get_tRNS(png_const_structrp png_ptr, png_inforp info_ptr, png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color) { png_uint_32 retval = 0; + + png_debug1(1, "in %s retrieval function", "tRNS"); + if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS) != 0) { - png_debug1(1, "in %s retrieval function", "tRNS"); - if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) { if (trans_alpha != NULL) @@ -1130,7 +1148,7 @@ png_get_tRNS(png_const_structrp png_ptr, png_inforp info_ptr, } } - return (retval); + return retval; } #endif @@ -1145,7 +1163,7 @@ png_get_unknown_chunks(png_const_structrp png_ptr, png_inforp info_ptr, return info_ptr->unknown_chunks_num; } - return (0); + return 0; } #endif @@ -1241,7 +1259,7 @@ png_get_palette_max(png_const_structp png_ptr, png_const_infop info_ptr) if (png_ptr != NULL && info_ptr != NULL) return png_ptr->num_palette_max; - return (-1); + return -1; } # endif #endif diff --git a/media/libpng/pngpread.c b/media/libpng/pngpread.c index 7d452a76f2..826d879cb2 100644 --- a/media/libpng/pngpread.c +++ b/media/libpng/pngpread.c @@ -1,7 +1,7 @@ /* pngpread.c - read a png file in push mode * - * Copyright (c) 2018 Cosmin Truta + * Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -145,10 +145,10 @@ png_push_read_sig(png_structrp png_ptr, png_inforp info_ptr) num_to_check); png_ptr->sig_bytes = (png_byte)(png_ptr->sig_bytes + num_to_check); - if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check)) + if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check) != 0) { if (num_checked < 4 && - png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4)) + png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4) != 0) png_error(png_ptr, "Not a PNG file"); else @@ -381,6 +381,14 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) } #endif +#ifdef PNG_READ_eXIf_SUPPORTED + else if (png_ptr->chunk_name == png_eXIf) + { + PNG_PUSH_SAVE_BUFFER_IF_FULL + png_handle_eXIf(png_ptr, info_ptr, png_ptr->push_length); + } + +#endif #ifdef PNG_READ_sRGB_SUPPORTED else if (chunk_name == png_sRGB) { @@ -1258,7 +1266,7 @@ png_voidp PNGAPI png_get_progressive_ptr(png_const_structrp png_ptr) { if (png_ptr == NULL) - return (NULL); + return NULL; return png_ptr->io_ptr; } diff --git a/media/libpng/pngpriv.h b/media/libpng/pngpriv.h index d7c74f9bf5..5868c7e162 100644 --- a/media/libpng/pngpriv.h +++ b/media/libpng/pngpriv.h @@ -1,7 +1,7 @@ /* pngpriv.h - private declarations for use inside libpng * - * Copyright (c) 2018-2022 Cosmin Truta + * Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -36,7 +36,7 @@ * still required (as of 2011-05-02.) */ #ifndef _POSIX_SOURCE -# define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */ +# define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */ #endif #ifndef PNG_VERSION_INFO_ONLY @@ -190,13 +190,27 @@ #endif /* PNG_ARM_NEON_OPT > 0 */ #ifndef PNG_MIPS_MSA_OPT -# if defined(__mips_msa) && (__mips_isa_rev >= 5) && defined(PNG_ALIGNED_MEMORY_SUPPORTED) +# if defined(__mips_msa) && (__mips_isa_rev >= 5) && \ + defined(PNG_ALIGNED_MEMORY_SUPPORTED) # define PNG_MIPS_MSA_OPT 2 # else # define PNG_MIPS_MSA_OPT 0 # endif #endif +#ifndef PNG_MIPS_MMI_OPT +# ifdef PNG_MIPS_MMI +# if defined(__mips_loongson_mmi) && (_MIPS_SIM == _ABI64) && \ + defined(PNG_ALIGNED_MEMORY_SUPPORTED) +# define PNG_MIPS_MMI_OPT 1 +# else +# define PNG_MIPS_MMI_OPT 0 +# endif +# else +# define PNG_MIPS_MMI_OPT 0 +# endif +#endif + #ifndef PNG_POWERPC_VSX_OPT # if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__) # define PNG_POWERPC_VSX_OPT 2 @@ -205,13 +219,21 @@ # endif #endif +#ifndef PNG_LOONGARCH_LSX_OPT +# if defined(__loongarch_sx) +# define PNG_LOONGARCH_LSX_OPT 1 +# else +# define PNG_LOONGARCH_LSX_OPT 0 +# endif +#endif + #ifndef PNG_INTEL_SSE_OPT # ifdef PNG_INTEL_SSE /* Only check for SSE if the build configuration has been modified to * enable SSE optimizations. This means that these optimizations will * be off by default. See contrib/intel for more details. */ -# if defined(__SSE4_1__) || defined(__AVX__) || defined(__SSSE3__) || \ +# if defined(__SSE4_1__) || defined(__AVX__) || defined(__SSSE3__) || \ defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \ (defined(_M_IX86_FP) && _M_IX86_FP >= 2) # define PNG_INTEL_SSE_OPT 1 @@ -248,7 +270,6 @@ #endif #if PNG_MIPS_MSA_OPT > 0 -# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_msa # ifndef PNG_MIPS_MSA_IMPLEMENTATION # if defined(__mips_msa) # if defined(__clang__) @@ -264,11 +285,28 @@ # ifndef PNG_MIPS_MSA_IMPLEMENTATION # define PNG_MIPS_MSA_IMPLEMENTATION 1 +# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_mips # endif #else # define PNG_MIPS_MSA_IMPLEMENTATION 0 #endif /* PNG_MIPS_MSA_OPT > 0 */ +#if PNG_MIPS_MMI_OPT > 0 +# ifndef PNG_MIPS_MMI_IMPLEMENTATION +# if defined(__mips_loongson_mmi) && (_MIPS_SIM == _ABI64) +# define PNG_MIPS_MMI_IMPLEMENTATION 2 +# else /* !defined __mips_loongson_mmi || _MIPS_SIM != _ABI64 */ +# define PNG_MIPS_MMI_IMPLEMENTATION 0 +# endif /* __mips_loongson_mmi && _MIPS_SIM == _ABI64 */ +# endif /* !PNG_MIPS_MMI_IMPLEMENTATION */ + +# if PNG_MIPS_MMI_IMPLEMENTATION > 0 +# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_mips +# endif +#else +# define PNG_MIPS_MMI_IMPLEMENTATION 0 +#endif /* PNG_MIPS_MMI_OPT > 0 */ + #if PNG_POWERPC_VSX_OPT > 0 # define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_vsx # define PNG_POWERPC_VSX_IMPLEMENTATION 1 @@ -276,6 +314,12 @@ # define PNG_POWERPC_VSX_IMPLEMENTATION 0 #endif +#if PNG_LOONGARCH_LSX_OPT > 0 +# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_lsx +# define PNG_LOONGARCH_LSX_IMPLEMENTATION 1 +#else +# define PNG_LOONGARCH_LSX_IMPLEMENTATION 0 +#endif /* Is this a build of a DLL where compilation of the object modules requires * different preprocessor settings to those required for a simple library? If @@ -514,18 +558,8 @@ */ # include <float.h> -# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \ - defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC) - /* We need to check that <math.h> hasn't already been included earlier - * as it seems it doesn't agree with <fp.h>, yet we should really use - * <fp.h> if possible. - */ -# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__) -# include <fp.h> -# endif -# else -# include <math.h> -# endif +# include <math.h> + # if defined(_AMIGA) && defined(__SASC) && defined(_M68881) /* Amiga SAS/C: We must include builtin FPU functions when compiling using * MATH=68881 @@ -626,7 +660,7 @@ #define PNG_BACKGROUND_IS_GRAY 0x800U #define PNG_HAVE_PNG_SIGNATURE 0x1000U #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U /* Have another chunk after IDAT */ - /* 0x4000U (unused) */ +#define PNG_WROTE_eXIf 0x4000U #define PNG_IS_READ_STRUCT 0x8000U /* Else is a write struct */ #ifdef PNG_APNG_SUPPORTED #define PNG_HAVE_acTL 0x10000U @@ -1320,7 +1354,7 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_neon,(png_row_infop row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); #endif -#if PNG_MIPS_MSA_OPT > 0 +#if PNG_MIPS_MSA_IMPLEMENTATION == 1 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_msa,(png_row_infop row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_msa,(png_row_infop @@ -1337,6 +1371,23 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_msa,(png_row_infop row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); #endif +#if PNG_MIPS_MMI_IMPLEMENTATION > 0 +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_mmi,(png_row_infop row_info, + png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_mmi,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_mmi,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_mmi,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_mmi,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_mmi,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_mmi,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +#endif + #if PNG_POWERPC_VSX_OPT > 0 PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_vsx,(png_row_infop row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); @@ -1369,6 +1420,23 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_sse2,(png_row_infop row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); #endif +#if PNG_LOONGARCH_LSX_IMPLEMENTATION == 1 +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_lsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_lsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_lsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_lsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_lsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_lsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_lsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +#endif + /* Choose the best filter to use and filter the row data */ PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr, png_row_infop row_info),PNG_EMPTY); @@ -1967,7 +2035,7 @@ PNG_INTERNAL_FUNCTION(void,png_ascii_from_fixed,(png_const_structrp png_ptr, */ #define PNG_FP_INVALID 512 /* Available for callers as a distinct value */ -/* Result codes for the parser (boolean - true meants ok, false means +/* Result codes for the parser (boolean - true means ok, false means * not ok yet.) */ #define PNG_FP_MAYBE 0 /* The number may be valid in the future */ @@ -2151,17 +2219,27 @@ PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon, (png_structp png_ptr, unsigned int bpp), PNG_EMPTY); #endif -#if PNG_MIPS_MSA_OPT > 0 -PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_msa, +#if PNG_MIPS_MSA_IMPLEMENTATION == 1 +PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_mips, (png_structp png_ptr, unsigned int bpp), PNG_EMPTY); #endif +# if PNG_MIPS_MMI_IMPLEMENTATION > 0 +PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_mips, + (png_structp png_ptr, unsigned int bpp), PNG_EMPTY); +# endif + # if PNG_INTEL_SSE_IMPLEMENTATION > 0 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2, (png_structp png_ptr, unsigned int bpp), PNG_EMPTY); # endif #endif +#if PNG_LOONGARCH_LSX_OPT > 0 +PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_lsx, + (png_structp png_ptr, unsigned int bpp), PNG_EMPTY); +#endif + PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr, png_const_charp key, png_bytep new_key), PNG_EMPTY); diff --git a/media/libpng/pngread.c b/media/libpng/pngread.c index 9061dfbc43..26c8d00ecc 100644 --- a/media/libpng/pngread.c +++ b/media/libpng/pngread.c @@ -1,7 +1,7 @@ /* pngread.c - read a PNG file * - * Copyright (c) 2018-2019 Cosmin Truta + * Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -648,7 +648,11 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row) #endif #ifdef PNG_READ_TRANSFORMS_SUPPORTED - if (png_ptr->transformations) + if (png_ptr->transformations +# ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED + || png_ptr->num_palette_max >= 0 +# endif + ) png_do_read_transformations(png_ptr, &row_info); #endif @@ -865,7 +869,7 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr) #ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED /* Report invalid palette index; added at libng-1.5.10 */ if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && - png_ptr->num_palette_max > png_ptr->num_palette) + png_ptr->num_palette_max >= png_ptr->num_palette) png_benign_error(png_ptr, "Read palette index exceeding num_palette"); #endif @@ -1129,6 +1133,8 @@ void PNGAPI png_read_png(png_structrp png_ptr, png_inforp info_ptr, int transforms, voidp params) { + png_debug(1, "in png_read_png"); + if (png_ptr == NULL || info_ptr == NULL) return; diff --git a/media/libpng/pngrtran.c b/media/libpng/pngrtran.c index 238f5afe7e..1526123e02 100644 --- a/media/libpng/pngrtran.c +++ b/media/libpng/pngrtran.c @@ -1,7 +1,7 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Copyright (c) 2018-2019 Cosmin Truta + * Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -290,21 +290,20 @@ png_set_alpha_mode_fixed(png_structrp png_ptr, int mode, int compose = 0; png_fixed_point file_gamma; - png_debug(1, "in png_set_alpha_mode"); + png_debug(1, "in png_set_alpha_mode_fixed"); if (png_rtran_ok(png_ptr, 0) == 0) return; output_gamma = translate_gamma_flags(png_ptr, output_gamma, 1/*screen*/); - /* Validate the value to ensure it is in a reasonable range. The value + /* Validate the value to ensure it is in a reasonable range. The value * is expected to be 1 or greater, but this range test allows for some - * viewing correction values. The intent is to weed out users of this API - * who use the inverse of the gamma value accidentally! Since some of these - * values are reasonable this may have to be changed: + * viewing correction values. The intent is to weed out the API users + * who might use the inverse of the gamma value accidentally! * - * 1.6.x: changed from 0.07..3 to 0.01..100 (to accommodate the optimal 16-bit - * gamma of 36, and its reciprocal.) + * In libpng 1.6.0, we changed from 0.07..3 to 0.01..100, to accommodate + * the optimal 16-bit gamma of 36 and its reciprocal. */ if (output_gamma < 1000 || output_gamma > 10000000) png_error(png_ptr, "output gamma out of expected range"); @@ -441,7 +440,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, int i; png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr, - (png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte)))); + (png_alloc_size_t)num_palette); for (i = 0; i < num_palette; i++) png_ptr->quantize_index[i] = (png_byte)i; } @@ -458,7 +457,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, /* Initialize an array to sort colors */ png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr, - (png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte)))); + (png_alloc_size_t)num_palette); /* Initialize the quantize_sort array */ for (i = 0; i < num_palette; i++) @@ -592,11 +591,9 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, /* Initialize palette index arrays */ png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr, - (png_alloc_size_t)((png_uint_32)num_palette * - (sizeof (png_byte)))); + (png_alloc_size_t)num_palette); png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr, - (png_alloc_size_t)((png_uint_32)num_palette * - (sizeof (png_byte)))); + (png_alloc_size_t)num_palette); /* Initialize the sort array */ for (i = 0; i < num_palette; i++) @@ -761,12 +758,11 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, size_t num_entries = ((size_t)1 << total_bits); png_ptr->palette_lookup = (png_bytep)png_calloc(png_ptr, - (png_alloc_size_t)(num_entries * (sizeof (png_byte)))); + (png_alloc_size_t)(num_entries)); - distance = (png_bytep)png_malloc(png_ptr, (png_alloc_size_t)(num_entries * - (sizeof (png_byte)))); + distance = (png_bytep)png_malloc(png_ptr, (png_alloc_size_t)num_entries); - memset(distance, 0xff, num_entries * (sizeof (png_byte))); + memset(distance, 0xff, num_entries); for (i = 0; i < num_palette; i++) { @@ -970,7 +966,7 @@ void PNGFAPI png_set_rgb_to_gray_fixed(png_structrp png_ptr, int error_action, png_fixed_point red, png_fixed_point green) { - png_debug(1, "in png_set_rgb_to_gray"); + png_debug(1, "in png_set_rgb_to_gray_fixed"); /* Need the IHDR here because of the check on color_type below. */ /* TODO: fix this */ diff --git a/media/libpng/pngrutil.c b/media/libpng/pngrutil.c index 51e2204000..7372a98219 100644 --- a/media/libpng/pngrutil.c +++ b/media/libpng/pngrutil.c @@ -1,7 +1,7 @@ /* pngrutil.c - utilities to read a PNG file * - * Copyright (c) 2018-2022 Cosmin Truta + * Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -26,7 +26,7 @@ png_get_uint_31(png_const_structrp png_ptr, png_const_bytep buf) if (uval > PNG_UINT_31_MAX) png_error(png_ptr, "PNG unsigned integer out of range"); - return (uval); + return uval; } #if defined(PNG_READ_gAMA_SUPPORTED) || defined(PNG_READ_cHRM_SUPPORTED) @@ -140,7 +140,7 @@ png_read_sig(png_structrp png_ptr, png_inforp info_ptr) if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check) != 0) { if (num_checked < 4 && - png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4)) + png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4) != 0) png_error(png_ptr, "Not a PNG file"); else png_error(png_ptr, "PNG file corrupted by ASCII conversion"); @@ -171,7 +171,7 @@ png_read_chunk_header(png_structrp png_ptr) /* Put the chunk name into png_ptr->chunk_name. */ png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(buf+4); - png_debug2(0, "Reading %lx chunk, length = %lu", + png_debug2(0, "Reading chunk typeid = 0x%lx, length = %lu", (unsigned long)png_ptr->chunk_name, (unsigned long)length); /* Reset the crc and run it over the chunk name. */ @@ -238,10 +238,10 @@ png_crc_finish(png_structrp png_ptr, png_uint_32 skip) else png_chunk_error(png_ptr, "CRC error"); - return (1); + return 1; } - return (0); + return 0; } /* Compare the CRC stored in the PNG file with that calculated by libpng from @@ -277,11 +277,11 @@ png_crc_error(png_structrp png_ptr) if (need_crc != 0) { crc = png_get_uint_32(crc_bytes); - return ((int)(crc != png_ptr->crc)); + return crc != png_ptr->crc; } else - return (0); + return 0; } #if defined(PNG_READ_iCCP_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) ||\ @@ -421,8 +421,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner) png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED; } -#if ZLIB_VERNUM >= 0x1290 && \ - defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_IGNORE_ADLER32) +#ifdef PNG_DISABLE_ADLER32_CHECK_SUPPORTED if (((png_ptr->options >> PNG_IGNORE_ADLER32) & 3) == PNG_OPTION_ON) /* Turn off validation of the ADLER32 checksum in IDAT chunks */ ret = inflateValidate(&png_ptr->zstream, 0); diff --git a/media/libpng/pngset.c b/media/libpng/pngset.c index 17336eea08..b29cd6181d 100644 --- a/media/libpng/pngset.c +++ b/media/libpng/pngset.c @@ -1,7 +1,7 @@ /* pngset.c - storage of image information into info struct * - * Copyright (c) 2018-2022 Cosmin Truta + * Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 1998-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -137,46 +137,40 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X, #ifdef PNG_eXIf_SUPPORTED void PNGAPI png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr, - png_bytep eXIf_buf) + png_bytep exif) { png_warning(png_ptr, "png_set_eXIf does not work; use png_set_eXIf_1"); PNG_UNUSED(info_ptr) - PNG_UNUSED(eXIf_buf) + PNG_UNUSED(exif) } void PNGAPI png_set_eXIf_1(png_const_structrp png_ptr, png_inforp info_ptr, - png_uint_32 num_exif, png_bytep eXIf_buf) + png_uint_32 num_exif, png_bytep exif) { - int i; + png_bytep new_exif; png_debug1(1, "in %s storage function", "eXIf"); - if (png_ptr == NULL || info_ptr == NULL) + if (png_ptr == NULL || info_ptr == NULL || + (png_ptr->mode & PNG_WROTE_eXIf) != 0) return; - if (info_ptr->exif) - { - png_free(png_ptr, info_ptr->exif); - info_ptr->exif = NULL; - } - - info_ptr->num_exif = num_exif; - - info_ptr->exif = png_voidcast(png_bytep, png_malloc_warn(png_ptr, - info_ptr->num_exif)); + new_exif = png_voidcast(png_bytep, png_malloc_warn(png_ptr, num_exif)); - if (info_ptr->exif == NULL) + if (new_exif == NULL) { png_warning(png_ptr, "Insufficient memory for eXIf chunk data"); return; } - info_ptr->free_me |= PNG_FREE_EXIF; + memcpy(new_exif, exif, (size_t)num_exif); - for (i = 0; i < (int) info_ptr->num_exif; i++) - info_ptr->exif[i] = eXIf_buf[i]; + png_free_data(png_ptr, info_ptr, PNG_FREE_EXIF, 0); + info_ptr->num_exif = num_exif; + info_ptr->exif = new_exif; + info_ptr->free_me |= PNG_FREE_EXIF; info_ptr->valid |= PNG_INFO_eXIf; } #endif /* eXIf */ @@ -237,15 +231,13 @@ png_set_hIST(png_const_structrp png_ptr, png_inforp info_ptr, if (info_ptr->hist == NULL) { png_warning(png_ptr, "Insufficient memory for hIST chunk data"); - return; } - info_ptr->free_me |= PNG_FREE_HIST; - for (i = 0; i < info_ptr->num_palette; i++) info_ptr->hist[i] = hist[i]; + info_ptr->free_me |= PNG_FREE_HIST; info_ptr->valid |= PNG_INFO_hIST; } #endif @@ -372,6 +364,8 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr, memcpy(info_ptr->pcal_purpose, purpose, length); + info_ptr->free_me |= PNG_FREE_PCAL; + png_debug(3, "storing X0, X1, type, and nparams in info"); info_ptr->pcal_X0 = X0; info_ptr->pcal_X1 = X1; @@ -388,7 +382,6 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr, if (info_ptr->pcal_units == NULL) { png_warning(png_ptr, "Insufficient memory for pCAL units"); - return; } @@ -400,7 +393,6 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr, if (info_ptr->pcal_params == NULL) { png_warning(png_ptr, "Insufficient memory for pCAL params"); - return; } @@ -418,7 +410,6 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr, if (info_ptr->pcal_params[i] == NULL) { png_warning(png_ptr, "Insufficient memory for pCAL parameter"); - return; } @@ -426,7 +417,6 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr, } info_ptr->valid |= PNG_INFO_pCAL; - info_ptr->free_me |= PNG_FREE_PCAL; } #endif @@ -483,18 +473,17 @@ png_set_sCAL_s(png_const_structrp png_ptr, png_inforp info_ptr, if (info_ptr->scal_s_height == NULL) { - png_free (png_ptr, info_ptr->scal_s_width); + png_free(png_ptr, info_ptr->scal_s_width); info_ptr->scal_s_width = NULL; png_warning(png_ptr, "Memory allocation failed while processing sCAL"); - return; } memcpy(info_ptr->scal_s_height, sheight, lengthh); - info_ptr->valid |= PNG_INFO_sCAL; info_ptr->free_me |= PNG_FREE_SCAL; + info_ptr->valid |= PNG_INFO_sCAL; } # ifdef PNG_FLOATING_POINT_SUPPORTED @@ -630,11 +619,10 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr, if (num_palette > 0) memcpy(png_ptr->palette, palette, (unsigned int)num_palette * (sizeof (png_color))); + info_ptr->palette = png_ptr->palette; info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette; - info_ptr->free_me |= PNG_FREE_PLTE; - info_ptr->valid |= PNG_INFO_PLTE; } @@ -780,11 +768,11 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr, { int i; - png_debug1(1, "in %lx storage function", png_ptr == NULL ? 0xabadca11U : - (unsigned long)png_ptr->chunk_name); + png_debug1(1, "in text storage function, chunk typeid = 0x%lx", + png_ptr == NULL ? 0xabadca11UL : (unsigned long)png_ptr->chunk_name); if (png_ptr == NULL || info_ptr == NULL || num_text <= 0 || text_ptr == NULL) - return(0); + return 0; /* Make sure we have enough space in the "text" array in info_struct * to hold all of the incoming text_ptr objects. This compare can't overflow @@ -964,7 +952,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr, png_debug1(3, "transferred text chunk %d", info_ptr->num_text); } - return(0); + return 0; } #endif @@ -1025,8 +1013,8 @@ png_set_tRNS(png_structrp png_ptr, png_inforp info_ptr, png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH)); memcpy(info_ptr->trans_alpha, trans_alpha, (size_t)num_trans); - info_ptr->valid |= PNG_INFO_tRNS; info_ptr->free_me |= PNG_FREE_TRNS; + info_ptr->valid |= PNG_INFO_tRNS; } png_ptr->trans_alpha = info_ptr->trans_alpha; } @@ -1059,8 +1047,8 @@ png_set_tRNS(png_structrp png_ptr, png_inforp info_ptr, if (num_trans != 0) { - info_ptr->valid |= PNG_INFO_tRNS; info_ptr->free_me |= PNG_FREE_TRNS; + info_ptr->valid |= PNG_INFO_tRNS; } } #endif @@ -1080,6 +1068,8 @@ png_set_sPLT(png_const_structrp png_ptr, { png_sPLT_tp np; + png_debug1(1, "in %s storage function", "sPLT"); + if (png_ptr == NULL || info_ptr == NULL || nentries <= 0 || entries == NULL) return; @@ -1094,11 +1084,11 @@ png_set_sPLT(png_const_structrp png_ptr, { /* Out of memory or too many chunks */ png_chunk_report(png_ptr, "too many sPLT chunks", PNG_CHUNK_WRITE_ERROR); - return; } png_free(png_ptr, info_ptr->splt_palettes); + info_ptr->splt_palettes = np; info_ptr->free_me |= PNG_FREE_SPLT; @@ -1392,11 +1382,11 @@ png_set_unknown_chunks(png_const_structrp png_ptr, { png_chunk_report(png_ptr, "too many unknown chunks", PNG_CHUNK_WRITE_ERROR); - return; } png_free(png_ptr, info_ptr->unknown_chunks); + info_ptr->unknown_chunks = np; /* safe because it is initialized */ info_ptr->free_me |= PNG_FREE_UNKN; @@ -1694,7 +1684,7 @@ void PNGAPI png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr, png_bytepp row_pointers) { - png_debug1(1, "in %s storage function", "rows"); + png_debug(1, "in png_set_rows"); if (png_ptr == NULL || info_ptr == NULL) return; @@ -1713,6 +1703,8 @@ png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr, void PNGAPI png_set_compression_buffer_size(png_structrp png_ptr, size_t size) { + png_debug(1, "in png_set_compression_buffer_size"); + if (png_ptr == NULL) return; @@ -1784,6 +1776,8 @@ void PNGAPI png_set_user_limits(png_structrp png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max) { + png_debug(1, "in png_set_user_limits"); + /* Images with dimensions larger than these limits will be * rejected by png_set_IHDR(). To accept any PNG datastream * regardless of dimensions, set both limits to 0x7fffffff. @@ -1799,6 +1793,8 @@ png_set_user_limits(png_structrp png_ptr, png_uint_32 user_width_max, void PNGAPI png_set_chunk_cache_max(png_structrp png_ptr, png_uint_32 user_chunk_cache_max) { + png_debug(1, "in png_set_chunk_cache_max"); + if (png_ptr != NULL) png_ptr->user_chunk_cache_max = user_chunk_cache_max; } @@ -1808,6 +1804,8 @@ void PNGAPI png_set_chunk_malloc_max(png_structrp png_ptr, png_alloc_size_t user_chunk_malloc_max) { + png_debug(1, "in png_set_chunk_malloc_max"); + if (png_ptr != NULL) png_ptr->user_chunk_malloc_max = user_chunk_malloc_max; } diff --git a/media/libpng/pngtrans.c b/media/libpng/pngtrans.c index 1100f46ebe..62cb21edf1 100644 --- a/media/libpng/pngtrans.c +++ b/media/libpng/pngtrans.c @@ -1,7 +1,7 @@ /* pngtrans.c - transforms the data in a row (used by both readers and writers) * - * Copyright (c) 2018 Cosmin Truta + * Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -103,10 +103,10 @@ png_set_interlace_handling(png_structrp png_ptr) if (png_ptr != 0 && png_ptr->interlaced != 0) { png_ptr->transformations |= PNG_INTERLACE; - return (7); + return 7; } - return (1); + return 1; } #endif @@ -498,6 +498,8 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start) png_bytep dp = row; /* destination pointer */ png_bytep ep = row + row_info->rowbytes; /* One beyond end of row */ + png_debug(1, "in png_do_strip_channel"); + /* At the start sp will point to the first byte to copy and dp to where * it is copied to. ep always points just beyond the end of the row, so * the loop simply copies (channels-1) channels until sp reaches ep. @@ -698,6 +700,8 @@ png_do_bgr(png_row_infop row_info, png_bytep row) void /* PRIVATE */ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info) { + png_debug(1, "in png_do_check_palette_indexes"); + if (png_ptr->num_palette < (1 << row_info->bit_depth) && png_ptr->num_palette > 0) /* num_palette can be 0 in MNG files */ { @@ -708,7 +712,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info) * forms produced on either GCC or MSVC. */ int padding = PNG_PADBITS(row_info->pixel_depth, row_info->width); - png_bytep rp = png_ptr->row_buf + row_info->rowbytes - 1; + png_bytep rp = png_ptr->row_buf + row_info->rowbytes; switch (row_info->bit_depth) { @@ -833,7 +837,7 @@ png_voidp PNGAPI png_get_user_transform_ptr(png_const_structrp png_ptr) { if (png_ptr == NULL) - return (NULL); + return NULL; return png_ptr->user_transform_ptr; } diff --git a/media/libpng/pngwrite.c b/media/libpng/pngwrite.c index 1652eba001..9f3743bf58 100644 --- a/media/libpng/pngwrite.c +++ b/media/libpng/pngwrite.c @@ -1,7 +1,7 @@ /* pngwrite.c - general routines to write a PNG file * - * Copyright (c) 2018-2022 Cosmin Truta + * Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -243,7 +243,10 @@ png_write_info(png_structrp png_ptr, png_const_inforp info_ptr) #ifdef PNG_WRITE_eXIf_SUPPORTED if ((info_ptr->valid & PNG_INFO_eXIf) != 0) + { png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif); + png_ptr->mode |= PNG_WROTE_eXIf; + } #endif #ifdef PNG_WRITE_hIST_SUPPORTED @@ -375,7 +378,8 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr) #endif #ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED - if (png_ptr->num_palette_max > png_ptr->num_palette) + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && + png_ptr->num_palette_max >= png_ptr->num_palette) png_benign_error(png_ptr, "Wrote palette index exceeding num_palette"); #endif @@ -448,8 +452,9 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr) #endif #ifdef PNG_WRITE_eXIf_SUPPORTED - if ((info_ptr->valid & PNG_INFO_eXIf) != 0) - png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif); + if ((info_ptr->valid & PNG_INFO_eXIf) != 0 && + (png_ptr->mode & PNG_WROTE_eXIf) == 0) + png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif); #endif #ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED @@ -719,12 +724,12 @@ png_write_row(png_structrp png_ptr, png_const_bytep row) /* 1.5.6: moved from png_struct to be a local structure: */ png_row_info row_info; - if (png_ptr == NULL) - return; - png_debug2(1, "in png_write_row (row %u, pass %d)", png_ptr->row_number, png_ptr->pass); + if (png_ptr == NULL) + return; + /* Initialize transformations and other stuff if first time */ if (png_ptr->row_number == 0 && png_ptr->pass == 0) { @@ -1215,6 +1220,8 @@ png_set_compression_strategy(png_structrp png_ptr, int strategy) void PNGAPI png_set_compression_window_bits(png_structrp png_ptr, int window_bits) { + png_debug(1, "in png_set_compression_window_bits"); + if (png_ptr == NULL) return; @@ -1298,6 +1305,8 @@ png_set_text_compression_strategy(png_structrp png_ptr, int strategy) void PNGAPI png_set_text_compression_window_bits(png_structrp png_ptr, int window_bits) { + png_debug(1, "in png_set_text_compression_window_bits"); + if (png_ptr == NULL) return; @@ -1335,6 +1344,8 @@ png_set_text_compression_method(png_structrp png_ptr, int method) void PNGAPI png_set_write_status_fn(png_structrp png_ptr, png_write_status_ptr write_row_fn) { + png_debug(1, "in png_set_write_status_fn"); + if (png_ptr == NULL) return; @@ -1362,6 +1373,8 @@ void PNGAPI png_write_png(png_structrp png_ptr, png_inforp info_ptr, int transforms, voidp params) { + png_debug(1, "in png_write_png"); + if (png_ptr == NULL || info_ptr == NULL) return; diff --git a/media/libpng/pngwutil.c b/media/libpng/pngwutil.c index 9935a710dc..ee354070cc 100644 --- a/media/libpng/pngwutil.c +++ b/media/libpng/pngwutil.c @@ -1,7 +1,7 @@ /* pngwutil.c - utilities to write a PNG file * - * Copyright (c) 2018-2022 Cosmin Truta + * Copyright (c) 2018-2024 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -2418,7 +2418,7 @@ png_setup_sub_row(png_structrp png_ptr, png_uint_32 bpp, break; } - return (sum); + return sum; } static void /* PRIVATE */ @@ -2468,7 +2468,7 @@ png_setup_up_row(png_structrp png_ptr, size_t row_bytes, size_t lmins) break; } - return (sum); + return sum; } static void /* PRIVATE */ png_setup_up_row_only(png_structrp png_ptr, size_t row_bytes) @@ -2524,7 +2524,7 @@ png_setup_avg_row(png_structrp png_ptr, png_uint_32 bpp, break; } - return (sum); + return sum; } static void /* PRIVATE */ png_setup_avg_row_only(png_structrp png_ptr, png_uint_32 bpp, @@ -2607,7 +2607,7 @@ png_setup_paeth_row(png_structrp png_ptr, png_uint_32 bpp, break; } - return (sum); + return sum; } static void /* PRIVATE */ png_setup_paeth_row_only(png_structrp png_ptr, png_uint_32 bpp, diff --git a/media/libsoundtouch/src/RLBoxSoundTouch.cpp b/media/libsoundtouch/src/RLBoxSoundTouch.cpp index a3ec3e6163..2c5fca2bad 100644 --- a/media/libsoundtouch/src/RLBoxSoundTouch.cpp +++ b/media/libsoundtouch/src/RLBoxSoundTouch.cpp @@ -12,7 +12,7 @@ using namespace soundtouch; RLBoxSoundTouch::RLBoxSoundTouch() { #ifdef MOZ_WASM_SANDBOXING_SOUNDTOUCH - mSandbox.create_sandbox(false /* infallible */); + mSandbox.create_sandbox(true /* infallible */); #else mSandbox.create_sandbox(); #endif diff --git a/media/openmax_dl/LICENSE b/media/openmax_dl/LICENSE deleted file mode 100644 index 845a9342eb..0000000000 --- a/media/openmax_dl/LICENSE +++ /dev/null @@ -1,39 +0,0 @@ -Use of this source code is governed by a BSD-style license that can be -found in the LICENSE file in the root of the source tree. All -contributing project authors may be found in the AUTHORS file in the -root of the source tree. - -The files were originally licensed by ARM Limited. - -The following files: - - * dl/api/omxtypes.h - * dl/sp/api/omxSP.h - -are licensed by Khronos: - -Copyright (c) 2005-2008,2015 The Khronos Group Inc. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and/or associated documentation files (the -"Materials"), to deal in the Materials without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Materials, and to -permit persons to whom the Materials are furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Materials. - -MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS -KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS -SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT - https://www.khronos.org/registry/ - -THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. diff --git a/media/openmax_dl/OWNERS b/media/openmax_dl/OWNERS deleted file mode 100644 index 34fc598f0b..0000000000 --- a/media/openmax_dl/OWNERS +++ /dev/null @@ -1,3 +0,0 @@ -ajm@google.com -kma@google.com -rtoy@google.com diff --git a/media/openmax_dl/README.chromium b/media/openmax_dl/README.chromium deleted file mode 100644 index 3dbc3ffe29..0000000000 --- a/media/openmax_dl/README.chromium +++ /dev/null @@ -1,19 +0,0 @@ -Name: OpenMAX DL -Short Name: OpenMax DL -URL: https://silver.arm.com/download/Software/Graphics/OX000-BU-00010-r1p0-00bet0/OX000-BU-00010-r1p0-00bet0.tgz -Version: 1.0.2 -License: BSD -License File: LICENSE -Security Critical: yes - -Description: -Implementation of OpenMAX DL spec from ARM. This is used to support -WebAudio for Chromium on Android. - -Local Modifications: -Only the FFT routines from the OpenMAX DL package are included. The -code was modified to work with gcc and a new implementation for a -floating-point FFT was added. - -The original ARM license is unclear, but Google has obtained -permission to relicense this code under a BSD license. diff --git a/media/openmax_dl/README.mozilla b/media/openmax_dl/README.mozilla deleted file mode 100644 index 1dbf41b605..0000000000 --- a/media/openmax_dl/README.mozilla +++ /dev/null @@ -1,9 +0,0 @@ -Bug 1158741 added an omxSP_FFTInv_CCSToR_F32_Sfs_unscaled function as an -optimization which performs the same operation as -omxSP_FFTInv_CCSToR_F32_Sfs except it doesn't scale the results by the -length of the FFT. For consistency with other FFT routines used, it does -multiply the results by two. - -The affected files are: -media/openmax_dl/dl/sp/api/omxSP.h -media/openmax_dl/dl/sp/src/omxSP_FFTInv_CCSToR_F32_Sfs_unscaled_s.S diff --git a/media/openmax_dl/dl/api/armCOMM_s.h b/media/openmax_dl/dl/api/armCOMM_s.h deleted file mode 100644 index 203e8ceaf0..0000000000 --- a/media/openmax_dl/dl/api/armCOMM_s.h +++ /dev/null @@ -1,417 +0,0 @@ -@// -*- Mode: asm; -*- -@// -@// Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. -@// -@// Use of this source code is governed by a BSD-style license -@// that can be found in the LICENSE file in the root of the source -@// tree. An additional intellectual property rights grant can be found -@// in the file PATENTS. All contributing project authors may -@// be found in the AUTHORS file in the root of the source tree. -@// -@// This file was originally licensed as follows. It has been -@// relicensed with permission from the copyright holders. -@// - -@// -@// File Name: armCOMM_s.h -@// OpenMAX DL: v1.0.2 -@// Last Modified Revision: 13871 -@// Last Modified Date: Fri, 09 May 2008 -@// -@// (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. -@// -@// -@// -@// ARM optimized OpenMAX common header file -@// - - .set _SBytes, 0 @ Number of scratch bytes on stack - .set _Workspace, 0 @ Stack offset of scratch workspace - - .set _RRegList, 0 @ R saved register list (last register number) - .set _DRegList, 0 @ D saved register list (last register number) - - @// Work out a list of R saved registers, and how much stack space is needed. - @// gas doesn't support setting a variable to a string, so we set _RRegList to - @// the register number. - .macro _M_GETRREGLIST rreg - .ifeqs "\rreg", "" - @ Nothing needs to be saved - .exitm - .endif - @ If rreg is lr or r4, save lr and r4 - .ifeqs "\rreg", "lr" - .set _RRegList, 4 - .exitm - .endif - - .ifeqs "\rreg", "r4" - .set _RRegList, 4 - .exitm - .endif - - @ If rreg = r5 or r6, save up to register r6 - .ifeqs "\rreg", "r5" - .set _RRegList, 6 - .exitm - .endif - .ifeqs "\rreg", "r6" - .set _RRegList, 6 - .exitm - .endif - - @ If rreg = r7 or r8, save up to register r8 - .ifeqs "\rreg", "r7" - .set _RRegList, 8 - .exitm - .endif - .ifeqs "\rreg", "r8" - .set _RRegList, 8 - .exitm - .endif - - @ If rreg = r9 or r10, save up to register r10 - .ifeqs "\rreg", "r9" - .set _RRegList, 10 - .exitm - .endif - .ifeqs "\rreg", "r10" - .set _RRegList, 10 - .exitm - .endif - - @ If rreg = r11 or r12, save up to register r12 - .ifeqs "\rreg", "r11" - .set _RRegList, 12 - .exitm - .endif - .ifeqs "\rreg", "r12" - .set _RRegList, 12 - .exitm - .endif - - .warning "Unrecognized saved r register limit: \rreg" - .endm - - @ Work out list of D saved registers, like for R registers. - .macro _M_GETDREGLIST dreg - .ifeqs "\dreg", "" - .set _DRegList, 0 - .exitm - .endif - - .ifeqs "\dreg", "d8" - .set _DRegList, 8 - .exitm - .endif - - .ifeqs "\dreg", "d9" - .set _DRegList, 9 - .exitm - .endif - - .ifeqs "\dreg", "d10" - .set _DRegList, 10 - .exitm - .endif - - .ifeqs "\dreg", "d11" - .set _DRegList, 11 - .exitm - .endif - - .ifeqs "\dreg", "d12" - .set _DRegList, 12 - .exitm - .endif - - .ifeqs "\dreg", "d13" - .set _DRegList, 13 - .exitm - .endif - - .ifeqs "\dreg", "d14" - .set _DRegList, 14 - .exitm - .endif - - .ifeqs "\dreg", "d15" - .set _DRegList, 15 - .exitm - .endif - - .warning "Unrecognized saved d register limit: \rreg" - .endm - -@////////////////////////////////////////////////////////// -@// Function header and footer macros -@////////////////////////////////////////////////////////// - - @ Function Header Macro - @ Generates the function prologue - @ Note that functions should all be "stack-moves-once" - @ The FNSTART and FNEND macros should be the only places - @ where the stack moves. - @ - @ name = function name - @ rreg = "" don't stack any registers - @ "lr" stack "lr" only - @ "rN" stack registers "r4-rN,lr" - @ dreg = "" don't stack any D registers - @ "dN" stack registers "d8-dN" - @ - @ Note: ARM Archicture procedure call standard AAPCS - @ states that r4-r11, sp, d8-d15 must be preserved by - @ a compliant function. - .macro M_START name, rreg, dreg - .set _Workspace, 0 - - @ Define the function and make it external. - .global \name -#ifndef __clang__ - .func \name -#endif - .section .text.\name,"ax",%progbits - .arch armv7-a - .fpu neon - .syntax unified - .object_arch armv4 - .align 2 -\name : -.fnstart - @ Save specified R registers - _M_GETRREGLIST \rreg - _M_PUSH_RREG - - @ Save specified D registers - _M_GETDREGLIST \dreg - _M_PUSH_DREG - - @ Ensure size claimed on stack is 8-byte aligned - .if (_SBytes & 7) != 0 - .set _SBytes, _SBytes + (8 - (_SBytes & 7)) - .endif - .if _SBytes != 0 - sub sp, sp, #_SBytes - .endif - .endm - - @ Function Footer Macro - @ Generates the function epilogue - .macro M_END - @ Restore the stack pointer to its original value on function entry - .if _SBytes != 0 - add sp, sp, #_SBytes - .endif - @ Restore any saved R or D registers. - _M_RET - .fnend -#ifndef __clang__ - .endfunc -#endif - @ Reset the global stack tracking variables back to their - @ initial values. - .set _SBytes, 0 - .endm - - @// Based on the value of _DRegList, push the specified set of registers - @// to the stack. Is there a better way? - .macro _M_PUSH_DREG - .if _DRegList == 8 - vpush {d8} - .exitm - .endif - - .if _DRegList == 9 - vpush {d8-d9} - .exitm - .endif - - .if _DRegList == 10 - vpush {d8-d10} - .exitm - .endif - - .if _DRegList == 11 - vpush {d8-d11} - .exitm - .endif - - .if _DRegList == 12 - vpush {d8-d12} - .exitm - .endif - - .if _DRegList == 13 - vpush {d8-d13} - .exitm - .endif - - .if _DRegList == 14 - vpush {d8-d14} - .exitm - .endif - - .if _DRegList == 15 - vpush {d8-d15} - .exitm - .endif - .endm - - @// Based on the value of _RRegList, push the specified set of registers - @// to the stack. Is there a better way? - .macro _M_PUSH_RREG - .if _RRegList == 4 - stmfd sp!, {r4, lr} - .exitm - .endif - - .if _RRegList == 6 - stmfd sp!, {r4-r6, lr} - .exitm - .endif - - .if _RRegList == 8 - stmfd sp!, {r4-r8, lr} - .exitm - .endif - - .if _RRegList == 10 - stmfd sp!, {r4-r10, lr} - .exitm - .endif - - .if _RRegList == 12 - stmfd sp!, {r4-r12, lr} - .exitm - .endif - .endm - - @// The opposite of _M_PUSH_DREG - .macro _M_POP_DREG - .if _DRegList == 8 - vpop {d8} - .exitm - .endif - - .if _DRegList == 9 - vpop {d8-d9} - .exitm - .endif - - .if _DRegList == 10 - vpop {d8-d10} - .exitm - .endif - - .if _DRegList == 11 - vpop {d8-d11} - .exitm - .endif - - .if _DRegList == 12 - vpop {d8-d12} - .exitm - .endif - - .if _DRegList == 13 - vpop {d8-d13} - .exitm - .endif - - .if _DRegList == 14 - vpop {d8-d14} - .exitm - .endif - - .if _DRegList == 15 - vpop {d8-d15} - .exitm - .endif - .endm - - @// The opposite of _M_PUSH_RREG - .macro _M_POP_RREG cc - .if _RRegList == 0 - bx\cc lr - .exitm - .endif - .if _RRegList == 4 - ldm\cc\()fd sp!, {r4, pc} - .exitm - .endif - - .if _RRegList == 6 - ldm\cc\()fd sp!, {r4-r6, pc} - .exitm - .endif - - .if _RRegList == 8 - ldm\cc\()fd sp!, {r4-r8, pc} - .exitm - .endif - - .if _RRegList == 10 - ldm\cc\()fd sp!, {r4-r10, pc} - .exitm - .endif - - .if _RRegList == 12 - ldm\cc\()fd sp!, {r4-r12, pc} - .exitm - .endif - .endm - - @ Produce function return instructions - .macro _M_RET cc - _M_POP_DREG \cc - _M_POP_RREG \cc - .endm - - @// Allocate 4-byte aligned area of name - @// |name| and size |size| bytes. - .macro M_ALLOC4 name, size - .if (_SBytes & 3) != 0 - .set _SBytes, _SBytes + (4 - (_SBytes & 3)) - .endif - .set \name\()_F, _SBytes - .set _SBytes, _SBytes + \size - - .endm - - @ Load word from stack - .macro M_LDR r, a0, a1, a2, a3 - _M_DATA "ldr", 4, \r, \a0, \a1, \a2, \a3 - .endm - - @ Store word to stack - .macro M_STR r, a0, a1, a2, a3 - _M_DATA "str", 4, \r, \a0, \a1, \a2, \a3 - .endm - - @ Macro to perform a data access operation - @ Such as LDR or STR - @ The addressing mode is modified such that - @ 1. If no address is given then the name is taken - @ as a stack offset - @ 2. If the addressing mode is not available for the - @ state being assembled for (eg Thumb) then a suitable - @ addressing mode is substituted. - @ - @ On Entry: - @ $i = Instruction to perform (eg "LDRB") - @ $a = Required byte alignment - @ $r = Register(s) to transfer (eg "r1") - @ $a0,$a1,$a2. Addressing mode and condition. One of: - @ label {,cc} - @ [base] {,,,cc} - @ [base, offset]{!} {,,cc} - @ [base, offset, shift]{!} {,cc} - @ [base], offset {,,cc} - @ [base], offset, shift {,cc} - @ - @ WARNING: Most of the above are not supported, except the first case. - .macro _M_DATA i, a, r, a0, a1, a2, a3 - .set _Offset, _Workspace + \a0\()_F - \i\a1 \r, [sp, #_Offset] - .endm diff --git a/media/openmax_dl/dl/api/armOMX.h b/media/openmax_dl/dl/api/armOMX.h deleted file mode 100644 index 0ad21c42ce..0000000000 --- a/media/openmax_dl/dl/api/armOMX.h +++ /dev/null @@ -1,289 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - * - * This file was originally licensed as follows. It has been - * relicensed with permission from the copyright holders. - */ - -/* - * - * File Name: armOMX_ReleaseVersion.h - * OpenMAX DL: v1.0.2 - * Last Modified Revision: 15322 - * Last Modified Date: Wed, 15 Oct 2008 - * - * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. - * - * - * - * This file allows a version of the OMX DL libraries to be built where some or - * all of the function names can be given a user specified suffix. - * - * You might want to use it where: - * - * - you want to rename a function "out of the way" so that you could replace - * a function with a different version (the original version would still be - * in the library just with a different name - so you could debug the new - * version by comparing it to the output of the old) - * - * - you want to rename all the functions to versions with a suffix so that - * you can include two versions of the library and choose between functions - * at runtime. - * - * e.g. omxIPBM_Copy_U8_C1R could be renamed omxIPBM_Copy_U8_C1R_CortexA8 - * - */ - - -#ifndef _armOMX_H_ -#define _armOMX_H_ - -#define ARMOMX_ENABLE_RENAMING 0 -#if ARMOMX_ENABLE_RENAMING - -/* We need to define these two macros in order to expand and concatenate the names */ -#define OMXCAT2BAR(A, B) omx ## A ## B -#define OMXCATBAR(A, B) OMXCAT2BAR(A, B) - -/* Define the suffix to add to all functions - the default is no suffix */ -#define BARE_SUFFIX - - - -/* Define what happens to the bare suffix-less functions, down to the sub-domain accuracy */ -#define OMXACAAC_SUFFIX BARE_SUFFIX -#define OMXACMP3_SUFFIX BARE_SUFFIX -#define OMXICJP_SUFFIX BARE_SUFFIX -#define OMXIPBM_SUFFIX BARE_SUFFIX -#define OMXIPCS_SUFFIX BARE_SUFFIX -#define OMXIPPP_SUFFIX BARE_SUFFIX -#define OMXSP_SUFFIX BARE_SUFFIX -#define OMXVCCOMM_SUFFIX BARE_SUFFIX -#define OMXVCM4P10_SUFFIX BARE_SUFFIX -#define OMXVCM4P2_SUFFIX BARE_SUFFIX - - - - -/* Define what the each bare, un-suffixed OpenMAX API function names is to be renamed */ -#define omxACAAC_DecodeChanPairElt OMXCATBAR(ACAAC_DecodeChanPairElt, OMXACAAC_SUFFIX) -#define omxACAAC_DecodeDatStrElt OMXCATBAR(ACAAC_DecodeDatStrElt, OMXACAAC_SUFFIX) -#define omxACAAC_DecodeFillElt OMXCATBAR(ACAAC_DecodeFillElt, OMXACAAC_SUFFIX) -#define omxACAAC_DecodeIsStereo_S32 OMXCATBAR(ACAAC_DecodeIsStereo_S32, OMXACAAC_SUFFIX) -#define omxACAAC_DecodeMsPNS_S32_I OMXCATBAR(ACAAC_DecodeMsPNS_S32_I, OMXACAAC_SUFFIX) -#define omxACAAC_DecodeMsStereo_S32_I OMXCATBAR(ACAAC_DecodeMsStereo_S32_I, OMXACAAC_SUFFIX) -#define omxACAAC_DecodePrgCfgElt OMXCATBAR(ACAAC_DecodePrgCfgElt, OMXACAAC_SUFFIX) -#define omxACAAC_DecodeTNS_S32_I OMXCATBAR(ACAAC_DecodeTNS_S32_I, OMXACAAC_SUFFIX) -#define omxACAAC_DeinterleaveSpectrum_S32 OMXCATBAR(ACAAC_DeinterleaveSpectrum_S32, OMXACAAC_SUFFIX) -#define omxACAAC_EncodeTNS_S32_I OMXCATBAR(ACAAC_EncodeTNS_S32_I, OMXACAAC_SUFFIX) -#define omxACAAC_LongTermPredict_S32 OMXCATBAR(ACAAC_LongTermPredict_S32, OMXACAAC_SUFFIX) -#define omxACAAC_LongTermReconstruct_S32_I OMXCATBAR(ACAAC_LongTermReconstruct_S32_I, OMXACAAC_SUFFIX) -#define omxACAAC_MDCTFwd_S32 OMXCATBAR(ACAAC_MDCTFwd_S32, OMXACAAC_SUFFIX) -#define omxACAAC_MDCTInv_S32_S16 OMXCATBAR(ACAAC_MDCTInv_S32_S16, OMXACAAC_SUFFIX) -#define omxACAAC_NoiselessDecode OMXCATBAR(ACAAC_NoiselessDecode, OMXACAAC_SUFFIX) -#define omxACAAC_QuantInv_S32_I OMXCATBAR(ACAAC_QuantInv_S32_I, OMXACAAC_SUFFIX) -#define omxACAAC_UnpackADIFHeader OMXCATBAR(ACAAC_UnpackADIFHeader, OMXACAAC_SUFFIX) -#define omxACAAC_UnpackADTSFrameHeader OMXCATBAR(ACAAC_UnpackADTSFrameHeader, OMXACAAC_SUFFIX) - - -#define omxACMP3_HuffmanDecode_S32 OMXCATBAR(ACMP3_HuffmanDecode_S32, OMXACMP3_SUFFIX) -#define omxACMP3_HuffmanDecodeSfb_S32 OMXCATBAR(ACMP3_HuffmanDecodeSfb_S32, OMXACMP3_SUFFIX) -#define omxACMP3_HuffmanDecodeSfbMbp_S32 OMXCATBAR(ACMP3_HuffmanDecodeSfbMbp_S32, OMXACMP3_SUFFIX) -#define omxACMP3_MDCTInv_S32 OMXCATBAR(ACMP3_MDCTInv_S32, OMXACMP3_SUFFIX) -#define omxACMP3_ReQuantize_S32_I OMXCATBAR(ACMP3_ReQuantize_S32_I, OMXACMP3_SUFFIX) -#define omxACMP3_ReQuantizeSfb_S32_I OMXCATBAR(ACMP3_ReQuantizeSfb_S32_I, OMXACMP3_SUFFIX) -#define omxACMP3_SynthPQMF_S32_S16 OMXCATBAR(ACMP3_SynthPQMF_S32_S16, OMXACMP3_SUFFIX) -#define omxACMP3_UnpackFrameHeader OMXCATBAR(ACMP3_UnpackFrameHeader, OMXACMP3_SUFFIX) -#define omxACMP3_UnpackScaleFactors_S8 OMXCATBAR(ACMP3_UnpackScaleFactors_S8, OMXACMP3_SUFFIX) -#define omxACMP3_UnpackSideInfo OMXCATBAR(ACMP3_UnpackSideInfo, OMXACMP3_SUFFIX) - -#define omxICJP_CopyExpand_U8_C3 OMXCATBAR(ICJP_CopyExpand_U8_C3, OMXICJP_SUFFIX) -#define omxICJP_DCTFwd_S16 OMXCATBAR(ICJP_DCTFwd_S16, OMXICJP_SUFFIX) -#define omxICJP_DCTFwd_S16_I OMXCATBAR(ICJP_DCTFwd_S16_I, OMXICJP_SUFFIX) -#define omxICJP_DCTInv_S16 OMXCATBAR(ICJP_DCTInv_S16, OMXICJP_SUFFIX) -#define omxICJP_DCTInv_S16_I OMXCATBAR(ICJP_DCTInv_S16_I, OMXICJP_SUFFIX) -#define omxICJP_DCTQuantFwd_Multiple_S16 OMXCATBAR(ICJP_DCTQuantFwd_Multiple_S16, OMXICJP_SUFFIX) -#define omxICJP_DCTQuantFwd_S16 OMXCATBAR(ICJP_DCTQuantFwd_S16, OMXICJP_SUFFIX) -#define omxICJP_DCTQuantFwd_S16_I OMXCATBAR(ICJP_DCTQuantFwd_S16_I, OMXICJP_SUFFIX) -#define omxICJP_DCTQuantFwdTableInit OMXCATBAR(ICJP_DCTQuantFwdTableInit, OMXICJP_SUFFIX) -#define omxICJP_DCTQuantInv_Multiple_S16 OMXCATBAR(ICJP_DCTQuantInv_Multiple_S16, OMXICJP_SUFFIX) -#define omxICJP_DCTQuantInv_S16 OMXCATBAR(ICJP_DCTQuantInv_S16, OMXICJP_SUFFIX) -#define omxICJP_DCTQuantInv_S16_I OMXCATBAR(ICJP_DCTQuantInv_S16_I, OMXICJP_SUFFIX) -#define omxICJP_DCTQuantInvTableInit OMXCATBAR(ICJP_DCTQuantInvTableInit, OMXICJP_SUFFIX) -#define omxICJP_DecodeHuffman8x8_Direct_S16_C1 OMXCATBAR(ICJP_DecodeHuffman8x8_Direct_S16_C1, OMXICJP_SUFFIX) -#define omxICJP_DecodeHuffmanSpecGetBufSize_U8 OMXCATBAR(ICJP_DecodeHuffmanSpecGetBufSize_U8, OMXICJP_SUFFIX) -#define omxICJP_DecodeHuffmanSpecInit_U8 OMXCATBAR(ICJP_DecodeHuffmanSpecInit_U8, OMXICJP_SUFFIX) -#define omxICJP_EncodeHuffman8x8_Direct_S16_U1_C1 OMXCATBAR(ICJP_EncodeHuffman8x8_Direct_S16_U1_C1, OMXICJP_SUFFIX) -#define omxICJP_EncodeHuffmanSpecGetBufSize_U8 OMXCATBAR(ICJP_EncodeHuffmanSpecGetBufSize_U8, OMXICJP_SUFFIX) -#define omxICJP_EncodeHuffmanSpecInit_U8 OMXCATBAR(ICJP_EncodeHuffmanSpecInit_U8, OMXICJP_SUFFIX) - -#define omxIPBM_AddC_U8_C1R_Sfs OMXCATBAR(IPBM_AddC_U8_C1R_Sfs, OMXIPBM_SUFFIX) -#define omxIPBM_Copy_U8_C1R OMXCATBAR(IPBM_Copy_U8_C1R, OMXIPBM_SUFFIX) -#define omxIPBM_Copy_U8_C3R OMXCATBAR(IPBM_Copy_U8_C3R, OMXIPBM_SUFFIX) -#define omxIPBM_Mirror_U8_C1R OMXCATBAR(IPBM_Mirror_U8_C1R, OMXIPBM_SUFFIX) -#define omxIPBM_MulC_U8_C1R_Sfs OMXCATBAR(IPBM_MulC_U8_C1R_Sfs, OMXIPBM_SUFFIX) - -#define omxIPCS_ColorTwistQ14_U8_C3R OMXCATBAR(IPCS_ColorTwistQ14_U8_C3R, OMXIPCS_SUFFIX) -#define omxIPCS_BGR565ToYCbCr420LS_MCU_U16_S16_C3P3R OMXCATBAR(IPCS_BGR565ToYCbCr420LS_MCU_U16_S16_C3P3R, OMXIPCS_SUFFIX) -#define omxIPCS_BGR565ToYCbCr422LS_MCU_U16_S16_C3P3R OMXCATBAR(IPCS_BGR565ToYCbCr422LS_MCU_U16_S16_C3P3R, OMXIPCS_SUFFIX) -#define omxIPCS_BGR565ToYCbCr444LS_MCU_U16_S16_C3P3R OMXCATBAR(IPCS_BGR565ToYCbCr444LS_MCU_U16_S16_C3P3R, OMXIPCS_SUFFIX) -#define omxIPCS_BGR888ToYCbCr420LS_MCU_U8_S16_C3P3R OMXCATBAR(IPCS_BGR888ToYCbCr420LS_MCU_U8_S16_C3P3R, OMXIPCS_SUFFIX) -#define omxIPCS_BGR888ToYCbCr422LS_MCU_U8_S16_C3P3R OMXCATBAR(IPCS_BGR888ToYCbCr422LS_MCU_U8_S16_C3P3R, OMXIPCS_SUFFIX) -#define omxIPCS_BGR888ToYCbCr444LS_MCU_U8_S16_C3P3R OMXCATBAR(IPCS_BGR888ToYCbCr444LS_MCU_U8_S16_C3P3R, OMXIPCS_SUFFIX) -#define omxIPCS_YCbCr420RszCscRotBGR_U8_P3C3R OMXCATBAR(IPCS_YCbCr420RszCscRotBGR_U8_P3C3R, OMXIPCS_SUFFIX) -#define omxIPCS_YCbCr420RszRot_U8_P3R OMXCATBAR(IPCS_YCbCr420RszRot_U8_P3R, OMXIPCS_SUFFIX) -#define omxIPCS_YCbCr420ToBGR565_U8_U16_P3C3R OMXCATBAR(IPCS_YCbCr420ToBGR565_U8_U16_P3C3R, OMXIPCS_SUFFIX) -#define omxIPCS_YCbCr420ToBGR565LS_MCU_S16_U16_P3C3R OMXCATBAR(IPCS_YCbCr420ToBGR565LS_MCU_S16_U16_P3C3R, OMXIPCS_SUFFIX) -#define omxIPCS_YCbCr420ToBGR888LS_MCU_S16_U8_P3C3R OMXCATBAR(IPCS_YCbCr420ToBGR888LS_MCU_S16_U8_P3C3R, OMXIPCS_SUFFIX) -#define omxIPCS_YCbCr422RszCscRotBGR_U8_P3C3R OMXCATBAR(IPCS_YCbCr422RszCscRotBGR_U8_P3C3R, OMXIPCS_SUFFIX) -#define omxIPCS_CbYCrY422RszCscRotBGR_U8_U16_C2R OMXCATBAR(IPCS_CbYCrY422RszCscRotBGR_U8_U16_C2R, OMXIPCS_SUFFIX) -#define omxIPCS_YCbCr422RszRot_U8_P3R OMXCATBAR(IPCS_YCbCr422RszRot_U8_P3R, OMXIPCS_SUFFIX) -#define omxIPCS_YCbYCr422ToBGR565_U8_U16_C2C3R OMXCATBAR(IPCS_YCbYCr422ToBGR565_U8_U16_C2C3R, OMXIPCS_SUFFIX) -#define omxIPCS_YCbCr422ToBGR565LS_MCU_S16_U16_P3C3R OMXCATBAR(IPCS_YCbCr422ToBGR565LS_MCU_S16_U16_P3C3R, OMXIPCS_SUFFIX) -#define omxIPCS_YCbYCr422ToBGR888_U8_C2C3R OMXCATBAR(IPCS_YCbYCr422ToBGR888_U8_C2C3R, OMXIPCS_SUFFIX) -#define omxIPCS_YCbCr422ToBGR888LS_MCU_S16_U8_P3C3R OMXCATBAR(IPCS_YCbCr422ToBGR888LS_MCU_S16_U8_P3C3R, OMXIPCS_SUFFIX) -#define omxIPCS_YCbCr422ToBGR888LS_MCU_S16_U8_P3C3R OMXCATBAR(IPCS_YCbCr422ToBGR888LS_MCU_S16_U8_P3C3R, OMXIPCS_SUFFIX) -#define omxIPCS_CbYCrY422ToYCbCr420Rotate_U8_C2P3R OMXCATBAR(IPCS_CbYCrY422ToYCbCr420Rotate_U8_C2P3R, OMXIPCS_SUFFIX) -#define omxIPCS_YCbCr422ToYCbCr420Rotate_U8_P3R OMXCATBAR(IPCS_YCbCr422ToYCbCr420Rotate_U8_P3R, OMXIPCS_SUFFIX) -#define omxIPCS_YCbCr444ToBGR565_U8_U16_C3R OMXCATBAR(IPCS_YCbCr444ToBGR565_U8_U16_C3R, OMXIPCS_SUFFIX) -#define omxIPCS_YCbCr444ToBGR565_U8_U16_P3C3R OMXCATBAR(IPCS_YCbCr444ToBGR565_U8_U16_P3C3R, OMXIPCS_SUFFIX) -#define omxIPCS_YCbCr444ToBGR565LS_MCU_S16_U16_P3C3R OMXCATBAR(IPCS_YCbCr444ToBGR565LS_MCU_S16_U16_P3C3R, OMXIPCS_SUFFIX) -#define omxIPCS_YCbCr444ToBGR888_U8_C3R OMXCATBAR(IPCS_YCbCr444ToBGR888_U8_C3R, OMXIPCS_SUFFIX) - -#define omxIPPP_Deblock_HorEdge_U8_I OMXCATBAR(IPPP_Deblock_HorEdge_U8_I, OMXIPPP_SUFFIX) -#define omxIPPP_Deblock_VerEdge_U8_I OMXCATBAR(IPPP_Deblock_VerEdge_U8_I, OMXIPPP_SUFFIX) -#define omxIPPP_FilterFIR_U8_C1R OMXCATBAR(IPPP_FilterFIR_U8_C1R, OMXIPPP_SUFFIX) -#define omxIPPP_FilterMedian_U8_C1R OMXCATBAR(IPPP_FilterMedian_U8_C1R, OMXIPPP_SUFFIX) -#define omxIPPP_GetCentralMoment_S64 OMXCATBAR(IPPP_GetCentralMoment_S64, OMXIPPP_SUFFIX) -#define omxIPPP_GetSpatialMoment_S64 OMXCATBAR(IPPP_GetSpatialMoment_S64, OMXIPPP_SUFFIX) -#define omxIPPP_MomentGetStateSize OMXCATBAR(IPPP_MomentGetStateSize, OMXIPPP_SUFFIX) -#define omxIPPP_MomentInit OMXCATBAR(IPPP_MomentInit, OMXIPPP_SUFFIX) -#define omxIPPP_Moments_U8_C1R OMXCATBAR(IPPP_Moments_U8_C1R, OMXIPPP_SUFFIX) -#define omxIPPP_Moments_U8_C3R OMXCATBAR(IPPP_Moments_U8_C3R, OMXIPPP_SUFFIX) - -#define omxSP_BlockExp_S16 OMXCATBAR(SP_BlockExp_S16, OMXSP_SUFFIX) -#define omxSP_BlockExp_S32 OMXCATBAR(SP_BlockExp_S32, OMXSP_SUFFIX) -#define omxSP_Copy_S16 OMXCATBAR(SP_Copy_S16, OMXSP_SUFFIX) -#define omxSP_DotProd_S16 OMXCATBAR(SP_DotProd_S16, OMXSP_SUFFIX) -#define omxSP_DotProd_S16_Sfs OMXCATBAR(SP_DotProd_S16_Sfs, OMXSP_SUFFIX) -#define omxSP_FFTFwd_CToC_SC16_Sfs OMXCATBAR(SP_FFTFwd_CToC_SC16_Sfs, OMXSP_SUFFIX) -#define omxSP_FFTFwd_CToC_SC32_Sfs OMXCATBAR(SP_FFTFwd_CToC_SC32_Sfs, OMXSP_SUFFIX) -#define omxSP_FFTFwd_RToCCS_S16S32_Sfs OMXCATBAR(SP_FFTFwd_RToCCS_S16S32_Sfs, OMXSP_SUFFIX) -#define omxSP_FFTFwd_RToCCS_S32_Sfs OMXCATBAR(SP_FFTFwd_RToCCS_S32_Sfs, OMXSP_SUFFIX) -#define omxSP_FFTGetBufSize_C_SC16 OMXCATBAR(SP_FFTGetBufSize_C_SC16, OMXSP_SUFFIX) -#define omxSP_FFTGetBufSize_C_SC32 OMXCATBAR(SP_FFTGetBufSize_C_SC32, OMXSP_SUFFIX) -#define omxSP_FFTGetBufSize_R_S16S32 OMXCATBAR(SP_FFTGetBufSize_R_S16S32, OMXSP_SUFFIX) -#define omxSP_FFTGetBufSize_R_S32 OMXCATBAR(SP_FFTGetBufSize_R_S32, OMXSP_SUFFIX) -#define omxSP_FFTInit_C_SC16 OMXCATBAR(SP_FFTInit_C_SC16, OMXSP_SUFFIX) -#define omxSP_FFTInit_C_SC32 OMXCATBAR(SP_FFTInit_C_SC32, OMXSP_SUFFIX) -#define omxSP_FFTInit_R_S16S32 OMXCATBAR(SP_FFTInit_R_S16S32, OMXSP_SUFFIX) -#define omxSP_FFTInit_R_S32 OMXCATBAR(SP_FFTInit_R_S32, OMXSP_SUFFIX) -#define omxSP_FFTInv_CCSToR_S32_Sfs OMXCATBAR(SP_FFTInv_CCSToR_S32_Sfs, OMXSP_SUFFIX) -#define omxSP_FFTInv_CCSToR_S32S16_Sfs OMXCATBAR(SP_FFTInv_CCSToR_S32S16_Sfs, OMXSP_SUFFIX) -#define omxSP_FFTInv_CToC_SC16_Sfs OMXCATBAR(SP_FFTInv_CToC_SC16_Sfs, OMXSP_SUFFIX) -#define omxSP_FFTInv_CToC_SC32_Sfs OMXCATBAR(SP_FFTInv_CToC_SC32_Sfs, OMXSP_SUFFIX) -#define omxSP_FilterMedian_S32 OMXCATBAR(SP_FilterMedian_S32, OMXSP_SUFFIX) -#define omxSP_FilterMedian_S32_I OMXCATBAR(SP_FilterMedian_S32_I, OMXSP_SUFFIX) -#define omxSP_FIR_Direct_S16 OMXCATBAR(SP_FIR_Direct_S16, OMXSP_SUFFIX) -#define omxSP_FIR_Direct_S16_I OMXCATBAR(SP_FIR_Direct_S16_I, OMXSP_SUFFIX) -#define omxSP_FIR_Direct_S16_ISfs OMXCATBAR(SP_FIR_Direct_S16_ISfs, OMXSP_SUFFIX) -#define omxSP_FIR_Direct_S16_Sfs OMXCATBAR(SP_FIR_Direct_S16_Sfs, OMXSP_SUFFIX) -#define omxSP_FIROne_Direct_S16 OMXCATBAR(SP_FIROne_Direct_S16, OMXSP_SUFFIX) -#define omxSP_FIROne_Direct_S16_I OMXCATBAR(SP_FIROne_Direct_S16_I, OMXSP_SUFFIX) -#define omxSP_FIROne_Direct_S16_ISfs OMXCATBAR(SP_FIROne_Direct_S16_ISfs, OMXSP_SUFFIX) -#define omxSP_FIROne_Direct_S16_Sfs OMXCATBAR(SP_FIROne_Direct_S16_Sfs, OMXSP_SUFFIX) -#define omxSP_IIR_BiQuadDirect_S16 OMXCATBAR(SP_IIR_BiQuadDirect_S16, OMXSP_SUFFIX) -#define omxSP_IIR_BiQuadDirect_S16_I OMXCATBAR(SP_IIR_BiQuadDirect_S16_I, OMXSP_SUFFIX) -#define omxSP_IIR_Direct_S16 OMXCATBAR(SP_IIR_Direct_S16, OMXSP_SUFFIX) -#define omxSP_IIR_Direct_S16_I OMXCATBAR(SP_IIR_Direct_S16_I, OMXSP_SUFFIX) -#define omxSP_IIROne_BiQuadDirect_S16 OMXCATBAR(SP_IIROne_BiQuadDirect_S16, OMXSP_SUFFIX) -#define omxSP_IIROne_BiQuadDirect_S16_I OMXCATBAR(SP_IIROne_BiQuadDirect_S16_I, OMXSP_SUFFIX) -#define omxSP_IIROne_Direct_S16 OMXCATBAR(SP_IIROne_Direct_S16, OMXSP_SUFFIX) -#define omxSP_IIROne_Direct_S16_I OMXCATBAR(SP_IIROne_Direct_S16_I, OMXSP_SUFFIX) - -#define omxVCCOMM_Average_16x OMXCATBAR(VCCOMM_Average_16x, OMXVCCOMM_SUFFIX) -#define omxVCCOMM_Average_8x OMXCATBAR(VCCOMM_Average_8x, OMXVCCOMM_SUFFIX) -#define omxVCCOMM_ComputeTextureErrorBlock OMXCATBAR(VCCOMM_ComputeTextureErrorBlock, OMXVCCOMM_SUFFIX) -#define omxVCCOMM_ComputeTextureErrorBlock_SAD OMXCATBAR(VCCOMM_ComputeTextureErrorBlock_SAD, OMXVCCOMM_SUFFIX) -#define omxVCCOMM_Copy16x16 OMXCATBAR(VCCOMM_Copy16x16, OMXVCCOMM_SUFFIX) -#define omxVCCOMM_Copy8x8 OMXCATBAR(VCCOMM_Copy8x8, OMXVCCOMM_SUFFIX) -#define omxVCCOMM_ExpandFrame_I OMXCATBAR(VCCOMM_ExpandFrame_I, OMXVCCOMM_SUFFIX) -#define omxVCCOMM_LimitMVToRect OMXCATBAR(VCCOMM_LimitMVToRect, OMXVCCOMM_SUFFIX) -#define omxVCCOMM_SAD_16x OMXCATBAR(VCCOMM_SAD_16x, OMXVCCOMM_SUFFIX) -#define omxVCCOMM_SAD_8x OMXCATBAR(VCCOMM_SAD_8x, OMXVCCOMM_SUFFIX) - -#define omxVCM4P10_Average_4x OMXCATBAR(VCM4P10_Average_4x, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_BlockMatch_Half OMXCATBAR(VCM4P10_BlockMatch_Half, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_BlockMatch_Integer OMXCATBAR(VCM4P10_BlockMatch_Integer, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_BlockMatch_Quarter OMXCATBAR(VCM4P10_BlockMatch_Quarter, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_DeblockChroma_I OMXCATBAR(VCM4P10_DeblockChroma_I, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_DeblockLuma_I OMXCATBAR(VCM4P10_DeblockLuma_I, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC OMXCATBAR(VCM4P10_DecodeChromaDcCoeffsToPairCAVLC, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_DecodeCoeffsToPairCAVLC OMXCATBAR(VCM4P10_DecodeCoeffsToPairCAVLC, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_DequantTransformResidualFromPairAndAdd OMXCATBAR(VCM4P10_DequantTransformResidualFromPairAndAdd, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_FilterDeblockingChroma_HorEdge_I OMXCATBAR(VCM4P10_FilterDeblockingChroma_HorEdge_I, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_FilterDeblockingChroma_VerEdge_I OMXCATBAR(VCM4P10_FilterDeblockingChroma_VerEdge_I, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_FilterDeblockingLuma_HorEdge_I OMXCATBAR(VCM4P10_FilterDeblockingLuma_HorEdge_I, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_FilterDeblockingLuma_VerEdge_I OMXCATBAR(VCM4P10_FilterDeblockingLuma_VerEdge_I, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_GetVLCInfo OMXCATBAR(VCM4P10_GetVLCInfo, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_InterpolateChroma OMXCATBAR(VCM4P10_InterpolateChroma, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_InterpolateHalfHor_Luma OMXCATBAR(VCM4P10_InterpolateHalfHor_Luma, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_InterpolateHalfVer_Luma OMXCATBAR(VCM4P10_InterpolateHalfVer_Luma, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_InterpolateLuma OMXCATBAR(VCM4P10_InterpolateLuma, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_InvTransformDequant_ChromaDC OMXCATBAR(VCM4P10_InvTransformDequant_ChromaDC, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_InvTransformDequant_LumaDC OMXCATBAR(VCM4P10_InvTransformDequant_LumaDC, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_InvTransformResidualAndAdd OMXCATBAR(VCM4P10_InvTransformResidualAndAdd, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_MEGetBufSize OMXCATBAR(VCM4P10_MEGetBufSize, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_MEInit OMXCATBAR(VCM4P10_MEInit, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_MotionEstimationMB OMXCATBAR(VCM4P10_MotionEstimationMB, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_PredictIntra_16x16 OMXCATBAR(VCM4P10_PredictIntra_16x16, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_PredictIntra_4x4 OMXCATBAR(VCM4P10_PredictIntra_4x4, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_PredictIntraChroma_8x8 OMXCATBAR(VCM4P10_PredictIntraChroma_8x8, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_SAD_4x OMXCATBAR(VCM4P10_SAD_4x, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_SADQuar_16x OMXCATBAR(VCM4P10_SADQuar_16x, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_SADQuar_4x OMXCATBAR(VCM4P10_SADQuar_4x, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_SADQuar_8x OMXCATBAR(VCM4P10_SADQuar_8x, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_SATD_4x4 OMXCATBAR(VCM4P10_SATD_4x4, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_SubAndTransformQDQResidual OMXCATBAR(VCM4P10_SubAndTransformQDQResidual, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_TransformDequantChromaDCFromPair OMXCATBAR(VCM4P10_TransformDequantChromaDCFromPair, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_TransformDequantLumaDCFromPair OMXCATBAR(VCM4P10_TransformDequantLumaDCFromPair, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_TransformQuant_ChromaDC OMXCATBAR(VCM4P10_TransformQuant_ChromaDC, OMXVCM4P10_SUFFIX) -#define omxVCM4P10_TransformQuant_LumaDC OMXCATBAR(VCM4P10_TransformQuant_LumaDC, OMXVCM4P10_SUFFIX) - -#define omxVCM4P2_BlockMatch_Half_16x16 OMXCATBAR(VCM4P2_BlockMatch_Half_16x16, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_BlockMatch_Half_8x8 OMXCATBAR(VCM4P2_BlockMatch_Half_8x8, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_BlockMatch_Integer_16x16 OMXCATBAR(VCM4P2_BlockMatch_Integer_16x16, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_BlockMatch_Integer_8x8 OMXCATBAR(VCM4P2_BlockMatch_Integer_8x8, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_DCT8x8blk OMXCATBAR(VCM4P2_DCT8x8blk, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_DecodeBlockCoef_Inter OMXCATBAR(VCM4P2_DecodeBlockCoef_Inter, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_DecodeBlockCoef_Intra OMXCATBAR(VCM4P2_DecodeBlockCoef_Intra, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_DecodePadMV_PVOP OMXCATBAR(VCM4P2_DecodePadMV_PVOP, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_DecodeVLCZigzag_Inter OMXCATBAR(VCM4P2_DecodeVLCZigzag_Inter, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_DecodeVLCZigzag_IntraACVLC OMXCATBAR(VCM4P2_DecodeVLCZigzag_IntraACVLC, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_DecodeVLCZigzag_IntraDCVLC OMXCATBAR(VCM4P2_DecodeVLCZigzag_IntraDCVLC, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_EncodeMV OMXCATBAR(VCM4P2_EncodeMV, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_EncodeVLCZigzag_Inter OMXCATBAR(VCM4P2_EncodeVLCZigzag_Inter, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_EncodeVLCZigzag_IntraACVLC OMXCATBAR(VCM4P2_EncodeVLCZigzag_IntraACVLC, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_EncodeVLCZigzag_IntraDCVLC OMXCATBAR(VCM4P2_EncodeVLCZigzag_IntraDCVLC, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_FindMVpred OMXCATBAR(VCM4P2_FindMVpred, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_IDCT8x8blk OMXCATBAR(VCM4P2_IDCT8x8blk, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_MCReconBlock OMXCATBAR(VCM4P2_MCReconBlock, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_MEGetBufSize OMXCATBAR(VCM4P2_MEGetBufSize, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_MEInit OMXCATBAR(VCM4P2_MEInit, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_MotionEstimationMB OMXCATBAR(VCM4P2_MotionEstimationMB, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_PredictReconCoefIntra OMXCATBAR(VCM4P2_PredictReconCoefIntra, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_QuantInter_I OMXCATBAR(VCM4P2_QuantInter_I, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_QuantIntra_I OMXCATBAR(VCM4P2_QuantIntra_I, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_QuantInvInter_I OMXCATBAR(VCM4P2_QuantInvInter_I, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_QuantInvIntra_I OMXCATBAR(VCM4P2_QuantInvIntra_I, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_TransRecBlockCoef_inter OMXCATBAR(VCM4P2_TransRecBlockCoef_inter, OMXVCM4P2_SUFFIX) -#define omxVCM4P2_TransRecBlockCoef_intra OMXCATBAR(VCM4P2_TransRecBlockCoef_intra, OMXVCM4P2_SUFFIX) - -#endif /* endif ARMOMX_ENABLE_RENAMING */ -#endif /* _armOMX_h_ */ diff --git a/media/openmax_dl/dl/api/omxtypes.h b/media/openmax_dl/dl/api/omxtypes.h deleted file mode 100644 index 97718eac22..0000000000 --- a/media/openmax_dl/dl/api/omxtypes.h +++ /dev/null @@ -1,286 +0,0 @@ -/** - * File: omxtypes.h - * Brief: Defines basic Data types used in OpenMAX v1.0.2 header files. - * - * Copyright (c) 2005-2008,2015 The Khronos Group Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and/or associated documentation files (the - * "Materials"), to deal in the Materials without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Materials, and to - * permit persons to whom the Materials are furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Materials. - * - * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS - * KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS - * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT - * https://www.khronos.org/registry/ - * - * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. - * - */ - -#ifndef _OMXTYPES_H_ -#define _OMXTYPES_H_ - -#include <limits.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Maximum FFT order supported by the twiddle table. Only used by the - * float FFT routines. Must be consistent with the table in - * armSP_FFT_F32TwiddleTable.c. - */ -#ifdef BIG_FFT_TABLE -#define TWIDDLE_TABLE_ORDER 15 -#else -#define TWIDDLE_TABLE_ORDER 12 -#endif - -#define OMX_IN -#define OMX_OUT -#define OMX_INOUT - - -typedef enum { - - /* Mandatory return codes - use cases are explicitly described for each function */ - OMX_Sts_NoErr = 0, /* No error, the function completed successfully */ - OMX_Sts_Err = -2, /* Unknown/unspecified error */ - OMX_Sts_InvalidBitstreamValErr = -182, /* Invalid value detected during bitstream processing */ - OMX_Sts_MemAllocErr = -9, /* Not enough memory allocated for the operation */ - OMX_StsACAAC_GainCtrErr = -159, /* AAC: Unsupported gain control data detected */ - OMX_StsACAAC_PrgNumErr = -167, /* AAC: Invalid number of elements for one program */ - OMX_StsACAAC_CoefValErr = -163, /* AAC: Invalid quantized coefficient value */ - OMX_StsACAAC_MaxSfbErr = -162, /* AAC: Invalid maxSfb value in relation to numSwb */ - OMX_StsACAAC_PlsDataErr = -160, /* AAC: pulse escape sequence data error */ - - /* Optional return codes - use cases are explicitly described for each function*/ - OMX_Sts_BadArgErr = -5, /* Bad Arguments */ - - OMX_StsACAAC_TnsNumFiltErr = -157, /* AAC: Invalid number of TNS filters */ - OMX_StsACAAC_TnsLenErr = -156, /* AAC: Invalid TNS region length */ - OMX_StsACAAC_TnsOrderErr = -155, /* AAC: Invalid order of TNS filter */ - OMX_StsACAAC_TnsCoefResErr = -154, /* AAC: Invalid bit-resolution for TNS filter coefficients */ - OMX_StsACAAC_TnsCoefErr = -153, /* AAC: Invalid TNS filter coefficients */ - OMX_StsACAAC_TnsDirectErr = -152, /* AAC: Invalid TNS filter direction */ - - OMX_StsICJP_JPEGMarkerErr = -183, /* JPEG marker encountered within an entropy-coded block; */ - /* Huffman decoding operation terminated early. */ - OMX_StsICJP_JPEGMarker = -181, /* JPEG marker encountered; Huffman decoding */ - /* operation terminated early. */ - OMX_StsIPPP_ContextMatchErr = -17, /* Context parameter doesn't match to the operation */ - - OMX_StsSP_EvenMedianMaskSizeErr = -180, /* Even size of the Median Filter mask was replaced by the odd one */ - - OMX_Sts_MaximumEnumeration = INT_MAX /*Placeholder, forces enum of size OMX_INT*/ - - } OMXResult; /** Return value or error value returned from a function. Identical to OMX_INT */ - - -/* OMX_U8 */ -#if UCHAR_MAX == 0xff -typedef unsigned char OMX_U8; -#elif USHRT_MAX == 0xff -typedef unsigned short int OMX_U8; -#else -#error OMX_U8 undefined -#endif - - -/* OMX_S8 */ -#if SCHAR_MAX == 0x7f -typedef signed char OMX_S8; -#elif SHRT_MAX == 0x7f -typedef signed short int OMX_S8; -#else -#error OMX_S8 undefined -#endif - - -/* OMX_U16 */ -#if USHRT_MAX == 0xffff -typedef unsigned short int OMX_U16; -#elif UINT_MAX == 0xffff -typedef unsigned int OMX_U16; -#else -#error OMX_U16 undefined -#endif - - -/* OMX_S16 */ -#if SHRT_MAX == 0x7fff -typedef signed short int OMX_S16; -#elif INT_MAX == 0x7fff -typedef signed int OMX_S16; -#else -#error OMX_S16 undefined -#endif - - -/* OMX_U32 */ -#if UINT_MAX == 0xffffffff -typedef unsigned int OMX_U32; -#elif LONG_MAX == 0xffffffff -typedef unsigned long int OMX_U32; -#else -#error OMX_U32 undefined -#endif - - -/* OMX_S32 */ -#if INT_MAX == 0x7fffffff -typedef signed int OMX_S32; -#elif LONG_MAX == 0x7fffffff -typedef long signed int OMX_S32; -#else -#error OMX_S32 undefined -#endif - - -/* OMX_U64 & OMX_S64 */ -#if defined( _WIN32 ) || defined ( _WIN64 ) - typedef __int64 OMX_S64; /** Signed 64-bit integer */ - typedef unsigned __int64 OMX_U64; /** Unsigned 64-bit integer */ - #define OMX_MIN_S64 (0x8000000000000000i64) - #define OMX_MIN_U64 (0x0000000000000000i64) - #define OMX_MAX_S64 (0x7FFFFFFFFFFFFFFFi64) - #define OMX_MAX_U64 (0xFFFFFFFFFFFFFFFFi64) -#else - typedef long long OMX_S64; /** Signed 64-bit integer */ - typedef unsigned long long OMX_U64; /** Unsigned 64-bit integer */ - #define OMX_MIN_S64 (0x8000000000000000LL) - #define OMX_MIN_U64 (0x0000000000000000LL) - #define OMX_MAX_S64 (0x7FFFFFFFFFFFFFFFLL) - #define OMX_MAX_U64 (0xFFFFFFFFFFFFFFFFLL) -#endif - - -/* OMX_SC8 */ -typedef struct -{ - OMX_S8 Re; /** Real part */ - OMX_S8 Im; /** Imaginary part */ - -} OMX_SC8; /** Signed 8-bit complex number */ - - -/* OMX_SC16 */ -typedef struct -{ - OMX_S16 Re; /** Real part */ - OMX_S16 Im; /** Imaginary part */ - -} OMX_SC16; /** Signed 16-bit complex number */ - - -/* OMX_SC32 */ -typedef struct -{ - OMX_S32 Re; /** Real part */ - OMX_S32 Im; /** Imaginary part */ - -} OMX_SC32; /** Signed 32-bit complex number */ - - -/* OMX_SC64 */ -typedef struct -{ - OMX_S64 Re; /** Real part */ - OMX_S64 Im; /** Imaginary part */ - -} OMX_SC64; /** Signed 64-bit complex number */ - - -/* OMX_F32 */ -typedef float OMX_F32; /** Single precision floating point,IEEE 754 */ - -/* OMX_F64 */ -typedef double OMX_F64; /** Double precision floating point,IEEE 754 */ - -/* OMX_FC32 */ -typedef struct -{ - OMX_F32 Re; /** Real part */ - OMX_F32 Im; /** Imaginary part */ - -} OMX_FC32; /** single precision floating point complex number */ - -/* OMX_FC64 */ -typedef struct -{ - OMX_F64 Re; /** Real part */ - OMX_F64 Im; /** Imaginary part */ - -} OMX_FC64; /** double precision floating point complex number */ - -/* OMX_INT */ -typedef int OMX_INT; /** signed integer corresponding to machine word length, has maximum signed value INT_MAX*/ - - -#define OMX_MIN_S8 (-128) -#define OMX_MIN_U8 0 -#define OMX_MIN_S16 (-32768) -#define OMX_MIN_U16 0 -#define OMX_MIN_S32 (-2147483647-1) -#define OMX_MIN_U32 0 - -#define OMX_MAX_S8 (127) -#define OMX_MAX_U8 (255) -#define OMX_MAX_S16 (32767) -#define OMX_MAX_U16 (0xFFFF) -#define OMX_MAX_S32 (2147483647) -#define OMX_MAX_U32 (0xFFFFFFFF) - -typedef void OMXVoid; - -#ifndef NULL -#define NULL ((void*)0) -#endif - -/** Defines the geometric position and size of a rectangle, - * where x,y defines the coordinates of the top left corner - * of the rectangle, with dimensions width in the x-direction - * and height in the y-direction */ -typedef struct { - OMX_INT x; /** x-coordinate of top left corner of rectangle */ - OMX_INT y; /** y-coordinate of top left corner of rectangle */ - OMX_INT width; /** Width in the x-direction. */ - OMX_INT height; /** Height in the y-direction. */ -}OMXRect; - - -/** Defines the geometric position of a point, */ -typedef struct -{ - OMX_INT x; /** x-coordinate */ - OMX_INT y; /** y-coordinate */ - -} OMXPoint; - - -/** Defines the dimensions of a rectangle, or region of interest in an image */ -typedef struct -{ - OMX_INT width; /** Width of the rectangle, in the x-direction */ - OMX_INT height; /** Height of the rectangle, in the y-direction */ - -} OMXSize; - -#ifdef __cplusplus -} -#endif -#endif /* _OMXTYPES_H_ */ diff --git a/media/openmax_dl/dl/api/omxtypes_s.h b/media/openmax_dl/dl/api/omxtypes_s.h deleted file mode 100644 index d880d351fd..0000000000 --- a/media/openmax_dl/dl/api/omxtypes_s.h +++ /dev/null @@ -1,76 +0,0 @@ -@// -@// Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. -@// -@// Use of this source code is governed by a BSD-style license -@// that can be found in the LICENSE file in the root of the source -@// tree. An additional intellectual property rights grant can be found -@// in the file PATENTS. All contributing project authors may -@// be found in the AUTHORS file in the root of the source tree. -@// -@// This file was originally licensed as follows. It has been -@// relicensed with permission from the copyright holders. -@// - -@// -@// File Name: omxtypes_s.h -@// OpenMAX DL: v1.0.2 -@// Last Modified Revision: 9622 -@// Last Modified Date: Wed, 06 Feb 2008 -@// -@// (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. -@// -@// - -@// Mandatory return codes - use cases are explicitly described for each function - .equ OMX_Sts_NoErr, 0 @// No error the function completed successfully - .equ OMX_Sts_Err, -2 @// Unknown/unspecified error - .equ OMX_Sts_InvalidBitstreamValErr, -182 @// Invalid value detected during bitstream processing - .equ OMX_Sts_MemAllocErr, -9 @// Not enough memory allocated for the operation - .equ OMX_StsACAAC_GainCtrErr, -159 @// AAC: Unsupported gain control data detected - .equ OMX_StsACAAC_PrgNumErr, -167 @// AAC: Invalid number of elements for one program - .equ OMX_StsACAAC_CoefValErr, -163 @// AAC: Invalid quantized coefficient value - .equ OMX_StsACAAC_MaxSfbErr, -162 @// AAC: Invalid maxSfb value in relation to numSwb - .equ OMX_StsACAAC_PlsDataErr, -160 @// AAC: pulse escape sequence data error - -@// Optional return codes - use cases are explicitly described for each function - .equ OMX_Sts_BadArgErr, -5 @// Bad Arguments - - .equ OMX_StsACAAC_TnsNumFiltErr, -157 @// AAC: Invalid number of TNS filters - .equ OMX_StsACAAC_TnsLenErr, -156 @// AAC: Invalid TNS region length - .equ OMX_StsACAAC_TnsOrderErr, -155 @// AAC: Invalid order of TNS filter - .equ OMX_StsACAAC_TnsCoefResErr, -154 @// AAC: Invalid bit-resolution for TNS filter coefficients - .equ OMX_StsACAAC_TnsCoefErr, -153 @// AAC: Invalid TNS filter coefficients - .equ OMX_StsACAAC_TnsDirectErr, -152 @// AAC: Invalid TNS filter direction - .equ OMX_StsICJP_JPEGMarkerErr, -183 @// JPEG marker encountered within an entropy-coded block; - @// Huffman decoding operation terminated early. - .equ OMX_StsICJP_JPEGMarker, -181 @// JPEG marker encountered; Huffman decoding - @// operation terminated early. - .equ OMX_StsIPPP_ContextMatchErr, -17 @// Context parameter doesn't match to the operation - - .equ OMX_StsSP_EvenMedianMaskSizeErr, -180 @// Even size of the Median Filter mask was replaced by the odd one - - .equ OMX_Sts_MaximumEnumeration, 0x7FFFFFFF - - - - .equ OMX_MIN_S8, (-128) - .equ OMX_MIN_U8, 0 - .equ OMX_MIN_S16, (-32768) - .equ OMX_MIN_U16, 0 - - - .equ OMX_MIN_S32, (-2147483647-1) - .equ OMX_MIN_U32, 0 - - .equ OMX_MAX_S8, (127) - .equ OMX_MAX_U8, (255) - .equ OMX_MAX_S16, (32767) - .equ OMX_MAX_U16, (0xFFFF) - .equ OMX_MAX_S32, (2147483647) - .equ OMX_MAX_U32, (0xFFFFFFFF) - - .equ OMX_VC_UPPER, 0x1 @// Used by the PredictIntra functions - .equ OMX_VC_LEFT, 0x2 @// Used by the PredictIntra functions - .equ OMX_VC_UPPER_RIGHT, 0x40 @// Used by the PredictIntra functions - - .equ NULL, 0 diff --git a/media/openmax_dl/dl/moz.build b/media/openmax_dl/dl/moz.build deleted file mode 100644 index 9a091c69ed..0000000000 --- a/media/openmax_dl/dl/moz.build +++ /dev/null @@ -1,49 +0,0 @@ -# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -if CONFIG['TARGET_CPU'] == 'arm' and CONFIG['BUILD_ARM_NEON']: - Library('openmax_dl') - - EXPORTS.dl.api += [ - 'api/armCOMM_s.h', - 'api/armOMX.h', - 'api/omxtypes.h', - 'api/omxtypes_s.h', - ] - - EXPORTS.dl.sp.api += [ - 'sp/api/armSP.h', - 'sp/api/omxSP.h', - ] - - SOURCES += [ - 'sp/src/armSP_FFT_F32TwiddleTable.c', - 'sp/src/omxSP_FFTGetBufSize_R_F32.c', - 'sp/src/omxSP_FFTGetBufSize_R_S32.c', - 'sp/src/omxSP_FFTInit_R_F32.c', - ] - - SOURCES += [ - 'sp/src/armSP_FFT_CToC_FC32_Radix2_fs_unsafe_s.S', - 'sp/src/armSP_FFT_CToC_FC32_Radix2_ls_unsafe_s.S', - 'sp/src/armSP_FFT_CToC_FC32_Radix2_unsafe_s.S', - 'sp/src/armSP_FFT_CToC_FC32_Radix4_fs_unsafe_s.S', - 'sp/src/armSP_FFT_CToC_FC32_Radix4_ls_unsafe_s.S', - 'sp/src/armSP_FFT_CToC_FC32_Radix4_unsafe_s.S', - 'sp/src/armSP_FFT_CToC_FC32_Radix8_fs_unsafe_s.S', - 'sp/src/armSP_FFTInv_CCSToR_F32_preTwiddleRadix2_unsafe_s.S', - 'sp/src/omxSP_FFTFwd_RToCCS_F32_Sfs_s.S', - 'sp/src/omxSP_FFTInv_CCSToR_F32_Sfs_unscaled_s.S', - ] - - LOCAL_INCLUDES += [ - '..', - 'api' - ] - - DEFINES['BIG_FFT_TABLE'] = True - - FINAL_LIBRARY = 'xul' diff --git a/media/openmax_dl/dl/sp/api/armSP.h b/media/openmax_dl/dl/sp/api/armSP.h deleted file mode 100644 index f615a87c7a..0000000000 --- a/media/openmax_dl/dl/sp/api/armSP.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - * - * This file was originally licensed as follows. It has been - * relicensed with permission from the copyright holders. - */ - -/** - * - * File Name: armSP.h - * OpenMAX DL: v1.0.2 - * Last Modified Revision: 7014 - * Last Modified Date: Wed, 01 Aug 2007 - * - * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. - * - * - * - * File: armSP.h - * Brief: Declares API's/Basic Data types used across the OpenMAX Signal Processing domain - * - */ -#ifndef _armSP_H_ -#define _armSP_H_ - -#include "dl/api/omxtypes.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** FFT Specific declarations */ -extern OMX_S32 armSP_FFT_S32TwiddleTable[1026]; -extern OMX_F32 armSP_FFT_F32TwiddleTable[]; - -typedef struct ARMsFFTSpec_SC32_Tag -{ - OMX_U32 N; - OMX_U16 *pBitRev; - OMX_SC32 *pTwiddle; - OMX_SC32 *pBuf; -}ARMsFFTSpec_SC32; - - -typedef struct ARMsFFTSpec_SC16_Tag -{ - OMX_U32 N; - OMX_U16 *pBitRev; - OMX_SC16 *pTwiddle; - OMX_SC16 *pBuf; -}ARMsFFTSpec_SC16; - -typedef struct ARMsFFTSpec_R_SC32_Tag -{ - OMX_U32 N; - OMX_U16 *pBitRev; - OMX_SC32 *pTwiddle; - OMX_S32 *pBuf; -}ARMsFFTSpec_R_SC32; - -typedef struct ARMsFFTSpec_R_FC32_Tag -{ - OMX_U32 N; - OMX_U16* pBitRev; - OMX_FC32* pTwiddle; - OMX_F32* pBuf; -} ARMsFFTSpec_R_FC32; - -typedef struct ARMsFFTSpec_FC32_Tag -{ - OMX_U32 N; - OMX_U16* pBitRev; - OMX_FC32* pTwiddle; - OMX_FC32* pBuf; -} ARMsFFTSpec_FC32; - -#ifdef __cplusplus -} -#endif - -#endif - -/*End of File*/ - - - diff --git a/media/openmax_dl/dl/sp/api/omxSP.h b/media/openmax_dl/dl/sp/api/omxSP.h deleted file mode 100644 index f2a3f5db67..0000000000 --- a/media/openmax_dl/dl/sp/api/omxSP.h +++ /dev/null @@ -1,2620 +0,0 @@ -/** - * File: omxSP.h - * Brief: OpenMAX DL v1.0.2 - Signal Processing library - * - * Copyright (c) 2005-2008,2015 The Khronos Group Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and/or associated documentation files (the - * "Materials"), to deal in the Materials without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Materials, and to - * permit persons to whom the Materials are furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Materials. - * - * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS - * KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS - * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT - * https://www.khronos.org/registry/ - * - * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. - * - */ - -/* *****************************************************************************************/ - -#ifndef _OMXSP_H_ -#define _OMXSP_H_ - -#include "dl/api/omxtypes.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -/* 2.1 Vendor-Specific FFT Data Structures */ - typedef void OMXFFTSpec_C_SC16; - typedef void OMXFFTSpec_C_SC32; - typedef void OMXFFTSpec_R_S16S32; - typedef void OMXFFTSpec_R_S16; - typedef void OMXFFTSpec_R_S32; - typedef void OMXFFTSpec_R_F32; - typedef void OMXFFTSpec_C_FC32; - -/** - * Function: omxSP_Copy_S16 (2.2.1.1.1) - * - * Description: - * Copies the len elements of the vector pointed to by pSrcinto the len - * elements of the vector pointed to by pDst. That is: - * pDst[i] = pSrc[i], for (i=0, 1, ..., len-1) - * - * Input Arguments: - * - * pSrc - pointer to the source vector - * len - number of elements contained in the source and destination vectors - * - * Output Arguments: - * - * pDst - pointer to the destination vector - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments detected; returned if one or more of - * the following is true: - * - pSrc or pDst is NULL - * - len < 0 - * - */ -OMXResult omxSP_Copy_S16 ( - const OMX_S16 *pSrc, - OMX_S16 *pDst, - OMX_INT len -); - - - -/** - * Function: omxSP_DotProd_S16 (2.2.2.1.1) - * - * Description: - * Calculates the dot product of the two input vectors. This function does - * not perform scaling. The internal accumulator width must be at least 32 - * bits. If any of the partially accumulated values exceeds the range of a - * signed 32-bit integer then the result is undefined. - * - * Input Arguments: - * - * pSrc1 - pointer to the first input vector; must be aligned on an 8-byte - * boundary. - * pSrc2 - pointer to the second input vector; must be aligned on an 8-byte - * boundary. - * len - length of the vectors in pSrc1 and pSrc2 - * - * Output Arguments: - * - * Return Value: - * - * The dot product result Note: this function returns the actual result - * rather than the standard OMXError. - * - */ -OMX_S32 omxSP_DotProd_S16 ( - const OMX_S16 *pSrc1, - const OMX_S16 *pSrc2, - OMX_INT len -); - - - -/** - * Function: omxSP_DotProd_S16_Sfs (2.2.2.1.2) - * - * Description: - * Calculates the dot product of the two input signals with output scaling - * and saturation, i.e., the result is multiplied by two to the power of the - * negative (-)scalefactor (scaled) prior to return. The result is saturated - * with rounding if the scaling operation produces a value outside the range - * of a signed 32-bit integer. Rounding behavior is defined in section 1.6.7 - * Integer Scaling and Rounding Conventions. The internal accumulator width - * must be at least 32 bits. The result is undefined if any of the partially - * accumulated values exceeds the range of a signed 32-bit integer. - * - * Input Arguments: - * - * pSrc1 - pointer to the first input vector; must be aligned on an 8-byte - * boundary. - * pSrc2 - pointer to the second input vector; must be aligned on an 8-byte - * boundary. - * len - length of the vectors in pSrc1 and pSrc2 - * scaleFactor - integer scalefactor - * - * Output Arguments: - * - * Return Value: - * - * The dot product result Note: This function returns the actual result - * rather than the standard OMXError. - * - */ -OMX_S32 omxSP_DotProd_S16_Sfs ( - const OMX_S16 *pSrc1, - const OMX_S16 *pSrc2, - OMX_INT len, - OMX_INT scaleFactor -); - - - -/** - * Function: omxSP_BlockExp_S16 (2.2.2.2.2) - * - * Description: - * Block exponent calculation for 16-bit and 32-bit signals (count leading - * sign bits). These functions compute the number of extra sign bits of all - * values in the 16-bit and 32-bit input vector pSrc and return the minimum - * sign bit count. This is also the maximum shift value that could be used in - * scaling the block of data. The functions BlockExp_S16 and - * BlockExp_S32 return the values 15 and 31, respectively, for input vectors in - * which all entries are equal to zero. - * - * Note: These functions differ from other DL functions by not returning the - * standard OMXError but the actual result. - * - * Input Arguments: - * - * pSrc - pointer to the input vector - * len - number of elements contained in the input and output - * vectors (0 < len < 65536) - * - * Output Arguments: - * - * none - * - * Return Value: - * - * Maximum exponent that may be used in scaling - * - */ -OMX_INT omxSP_BlockExp_S16 ( - const OMX_S16 *pSrc, - OMX_INT len -); - - - -/** - * Function: omxSP_BlockExp_S32 (2.2.2.2.2) - * - * Description: - * Block exponent calculation for 16-bit and 32-bit signals (count leading - * sign bits). These functions compute the number of extra sign bits of all - * values in the 16-bit and 32-bit input vector pSrc and return the minimum - * sign bit count. This is also the maximum shift value that could be used in - * scaling the block of data. The functions BlockExp_S16 and - * BlockExp_S32 return the values 15 and 31, respectively, for input vectors in - * which all entries are equal to zero. - * - * Note: These functions differ from other DL functions by not returning the - * standard OMXError but the actual result. - * - * Input Arguments: - * - * pSrc - pointer to the input vector - * len - number of elements contained in the input and output - * vectors (0 < len < 65536) - * - * Output Arguments: - * - * none - * - * Return Value: - * - * Maximum exponent that may be used in scaling - * - */ -OMX_INT omxSP_BlockExp_S32 ( - const OMX_S32 *pSrc, - OMX_INT len -); - - - -/** - * Function: omxSP_FIR_Direct_S16 (2.2.3.1.1) - * - * Description: - * Block FIR filtering for 16-bit data type. This function applies the - * FIR filter defined by the coefficient vector pTapsQ15 to a vector of - * input data. The result is saturated with rounding if the operation - * produces a value outside the range of a signed 16-bit integer. - * Rounding behavior is defined in: - * section 1.6.7 "Integer Scaling and Rounding Conventions". - * The internal accumulator width must be at least 32 bits. The result - * is undefined if any of the partially accumulated values exceeds the - * range of a signed 32-bit integer. - * - * - * Input Arguments: - * - * pSrc - pointer to the vector of input samples to which the - * filter is applied - * sampLen - the number of samples contained in the input and output - * vectors - * pTapsQ15 - pointer to the vector that contains the filter coefficients, - * represented in Q0.15 format (defined in section 1.6.5). Given - * that: - * -32768 = pTapsQ15(k) < 32768, - * 0 = k <tapsLen, - * the range on the actual filter coefficients is -1 = bK <1, and - * therefore coefficient normalization may be required during the - * filter design process. - * tapsLen - the number of taps, or, equivalently, the filter order + 1 - * pDelayLine - pointer to the 2.tapsLen -element filter memory buffer - * (state). The user is responsible for allocation, initialization, - * and de-allocation. The filter memory elements are initialized to - * zero in most applications. - * pDelayLineIndex - pointer to the filter memory index that is maintained - * internally by the function. The user should initialize the value - * of this index to zero. - * - * Output Arguments: - * - * pDst - pointer to the vector of filtered output samples - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - One or more of the following pointers is NULL: - * - pSrc, - * - pDst, - * - pSrcDst, - * - pTapsQ15, - * - pDelayLine, or - * - pDelayLineIndex - * - samplen < 0 - * - tapslen < 1 - * - *pDelayLineIndex < 0 or *pDelayLineIndex >= (2 * tapslen). - * - */ -OMXResult omxSP_FIR_Direct_S16 ( - const OMX_S16 *pSrc, - OMX_S16 *pDst, - OMX_INT sampLen, - const OMX_S16 *pTapsQ15, - OMX_INT tapsLen, - OMX_S16 *pDelayLine, - OMX_INT *pDelayLineIndex -); - - - -/** - * Function: omxSP_FIR_Direct_S16_I (2.2.3.1.1) - * - * Description: - * Block FIR filtering for 16-bit data type. This function applies the - * FIR filter defined by the coefficient vector pTapsQ15 to a vector of - * input data. The result is saturated with rounding if the operation - * produces a value outside the range of a signed 16-bit integer. - * Rounding behavior is defined in: - * section 1.6.7 "Integer Scaling and Rounding Conventions". - * The internal accumulator width must be at least 32 bits. The result - * is undefined if any of the partially accumulated values exceeds the - * range of a signed 32-bit integer. - * - * Input Arguments: - * - * pSrcDst - pointer to the vector of input samples to which the - * filter is applied - * sampLen - the number of samples contained in the input and output - * vectors - * pTapsQ15 - pointer to the vector that contains the filter coefficients, - * represented in Q0.15 format (defined in section 1.6.5). Given - * that: - * -32768 = pTapsQ15(k) < 32768, - * 0 = k <tapsLen, - * the range on the actual filter coefficients is -1 = bK <1, and - * therefore coefficient normalization may be required during the - * filter design process. - * tapsLen - the number of taps, or, equivalently, the filter order + 1 - * pDelayLine - pointer to the 2.tapsLen -element filter memory buffer - * (state). The user is responsible for allocation, initialization, - * and de-allocation. The filter memory elements are initialized to - * zero in most applications. - * pDelayLineIndex - pointer to the filter memory index that is maintained - * internally by the function. The user should initialize the value - * of this index to zero. - * - * Output Arguments: - * - * pSrcDst - pointer to the vector of filtered output samples - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - One or more of the following pointers is NULL: - * - pSrc, - * - pDst, - * - pSrcDst, - * - pTapsQ15, - * - pDelayLine, or - * - pDelayLineIndex - * - samplen < 0 - * - tapslen < 1 - * - *pDelayLineIndex < 0 or *pDelayLineIndex >= (2 * tapslen). - * - */ -OMXResult omxSP_FIR_Direct_S16_I ( - OMX_S16 *pSrcDst, - OMX_INT sampLen, - const OMX_S16 *pTapsQ15, - OMX_INT tapsLen, - OMX_S16 *pDelayLine, - OMX_INT *pDelayLineIndex -); - - - -/** - * Function: omxSP_FIR_Direct_S16_Sfs (2.2.3.1.1) - * - * Description: - * Block FIR filtering for 16-bit data type. This function applies - * the FIR filter defined by the coefficient vector pTapsQ15 to a - * vector of input data. The output is multiplied by 2 to the negative - * power of scalefactor (i.e., 2^-scalefactor) before returning to the caller. - * Scaling and rounding conventions are defined in section 1.6.7. - * The internal accumulator width must be at least 32 bits. - * The result is undefined if any of the partially accumulated - * values exceeds the range of a signed 32-bit integer. - * - * Input Arguments: - * - * pSrc - pointer to the vector of input samples to which the - * filter is applied - * sampLen - the number of samples contained in the input and output - * vectors - * pTapsQ15 - pointer to the vector that contains the filter coefficients, - * represented in Q0.15 format (defined in section 1.6.5). Given - * that: - * -32768 = pTapsQ15(k) < 32768, - * 0 = k <tapsLen, - * the range on the actual filter coefficients is -1 = bK <1, and - * therefore coefficient normalization may be required during the - * filter design process. - * tapsLen - the number of taps, or, equivalently, the filter order + 1 - * pDelayLine - pointer to the 2.tapsLen -element filter memory buffer - * (state). The user is responsible for allocation, initialization, - * and de-allocation. The filter memory elements are initialized to - * zero in most applications. - * pDelayLineIndex - pointer to the filter memory index that is maintained - * internally by the function. The user should initialize the value - * of this index to zero. - * scaleFactor - saturation fixed scalefactor - * - * Output Arguments: - * - * pDst - pointer to the vector of filtered output samples - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - One or more of the following pointers is NULL: - * - pSrc, - * - pDst, - * - pSrcDst, - * - pTapsQ15, - * - pDelayLine, or - * - pDelayLineIndex - * - samplen < 0 - * - tapslen < 1 - * - scaleFactor < 0 - * - *pDelayLineIndex < 0 or *pDelayLineIndex >= (2 * tapslen). - * - */ -OMXResult omxSP_FIR_Direct_S16_Sfs ( - const OMX_S16 *pSrc, - OMX_S16 *pDst, - OMX_INT sampLen, - const OMX_S16 *pTapsQ15, - OMX_INT tapsLen, - OMX_S16 *pDelayLine, - OMX_INT *pDelayLineIndex, - OMX_INT scaleFactor -); - - - -/** - * Function: omxSP_FIR_Direct_S16_ISfs (2.2.3.1.1) - * - * Description: - * Block FIR filtering for 16-bit data type. This function applies - * the FIR filter defined by the coefficient vector pTapsQ15 to a - * vector of input data. The output is multiplied by 2 to the negative - * power of scalefactor (i.e., 2^-scalefactor) before returning to the caller. - * Scaling and rounding conventions are defined in section 1.6.7. - * The internal accumulator width must be at least 32 bits. - * The result is undefined if any of the partially accumulated - * values exceeds the range of a signed 32-bit integer. - * - * Input Arguments: - * - * pSrcDst - pointer to the vector of input samples to which the - * filter is applied - * sampLen - the number of samples contained in the input and output - * vectors - * pTapsQ15 - pointer to the vector that contains the filter coefficients, - * represented in Q0.15 format (defined in section 1.6.5). Given - * that: - * -32768 = pTapsQ15(k) < 32768, - * 0 = k <tapsLen, - * the range on the actual filter coefficients is -1 = bK <1, and - * therefore coefficient normalization may be required during the - * filter design process. - * tapsLen - the number of taps, or, equivalently, the filter order + 1 - * pDelayLine - pointer to the 2.tapsLen -element filter memory buffer - * (state). The user is responsible for allocation, initialization, - * and de-allocation. The filter memory elements are initialized to - * zero in most applications. - * pDelayLineIndex - pointer to the filter memory index that is maintained - * internally by the function. The user should initialize the value - * of this index to zero. - * scaleFactor - saturation fixed scalefactor - * - * Output Arguments: - * - * pSrcDst - pointer to the vector of filtered output samples - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - One or more of the following pointers is NULL: - * - pSrc, - * - pDst, - * - pSrcDst, - * - pTapsQ15, - * - pDelayLine, or - * - pDelayLineIndex - * - samplen < 0 - * - tapslen < 1 - * - scaleFactor < 0 - * - *pDelayLineIndex < 0 or *pDelayLineIndex >= (2 * tapslen). - * - */ -OMXResult omxSP_FIR_Direct_S16_ISfs ( - OMX_S16 *pSrcDst, - OMX_INT sampLen, - const OMX_S16 *pTapsQ15, - OMX_INT tapsLen, - OMX_S16 *pDelayLine, - OMX_INT *pDelayLineIndex, - OMX_INT scaleFactor -); - - - -/** - * Function: omxSP_FIROne_Direct_S16 (2.2.3.1.2) - * - * Description: - * Single-sample FIR filtering for 16-bit data type. These functions apply - * the FIR filter defined by the coefficient vector pTapsQ15 to a single - * sample of input data. The result is saturated with rounding if the - * operation produces a value outside the range of a signed 16-bit integer. - * Rounding behavior is defined in: - * section 1.6.7 "Integer Scaling and Rounding Conventions". - * The internal accumulator width must be at least 32 bits. The result is - * undefined if any of the partially accumulated values exceeds the range of a - * signed 32-bit integer. - * - * Input Arguments: - * - * val - the single input sample to which the filter is - * applied. - * pTapsQ15 - pointer to the vector that contains the filter coefficients, - * represented in Q0.15 format (as defined in section 1.6.5). Given - * that: - * -32768 = pTapsQ15(k) < 32768, - * 0 = k < tapsLen, - * the range on the actual filter coefficients is -1 = bK <1, and - * therefore coefficient normalization may be required during the - * filter design process. - * tapsLen - the number of taps, or, equivalently, the filter order + 1 - * pDelayLine - pointer to the 2.tapsLen -element filter memory buffer - * (state). The user is responsible for allocation, initialization, - * and de-allocation. The filter memory elements are initialized to - * zero in most applications. - * pDelayLineIndex - pointer to the filter memory index that is maintained - * internally by the function. The user should initialize the value - * of this index to zero. - * - * Output Arguments: - * - * pResult - pointer to the filtered output sample - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - One or more of the following pointers is NULL: - * - pResult, - * - pTapsQ15, - * - pDelayLine, or - * - pDelayLineIndex - * - tapslen < 1 - * - *pDelayLineIndex < 0 or *pDelayLineIndex >= (2 * tapslen) - * - */ -OMXResult omxSP_FIROne_Direct_S16 ( - OMX_S16 val, - OMX_S16 *pResult, - const OMX_S16 *pTapsQ15, - OMX_INT tapsLen, - OMX_S16 *pDelayLine, - OMX_INT *pDelayLineIndex -); - - - -/** - * Function: omxSP_FIROne_Direct_S16_I (2.2.3.1.2) - * - * Description: - * Single-sample FIR filtering for 16-bit data type. These functions apply - * the FIR filter defined by the coefficient vector pTapsQ15 to a single - * sample of input data. The result is saturated with rounding if the - * operation produces a value outside the range of a signed 16-bit integer. - * Rounding behavior is defined in: - * section 1.6.7 "Integer Scaling and Rounding Conventions". - * The internal accumulator width must be at least 32 bits. The result is - * undefined if any of the partially accumulated values exceeds the range of a - * signed 32-bit integer. - * - * Input Arguments: - * - * pValResult - pointer to the single input sample to which the filter is - * applied. - * pTapsQ15 - pointer to the vector that contains the filter coefficients, - * represented in Q0.15 format (as defined in section 1.6.5). Given - * that: - * -32768 = pTapsQ15(k) < 32768, - * 0 = k < tapsLen, - * the range on the actual filter coefficients is -1 = bK <1, and - * therefore coefficient normalization may be required during the - * filter design process. - * tapsLen - the number of taps, or, equivalently, the filter order + 1 - * pDelayLine - pointer to the 2.tapsLen -element filter memory buffer - * (state). The user is responsible for allocation, initialization, - * and de-allocation. The filter memory elements are initialized to - * zero in most applications. - * pDelayLineIndex - pointer to the filter memory index that is maintained - * internally by the function. The user should initialize the value - * of this index to zero. - * - * Output Arguments: - * - * pValResult - pointer to the filtered output sample - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - One or more of the following pointers is NULL: - * - pValResult, - * - pTapsQ15, - * - pDelayLine, or - * - pDelayLineIndex - * - tapslen < 1 - * - *pDelayLineIndex < 0 or *pDelayLineIndex >= (2 * tapslen) - * - */ -OMXResult omxSP_FIROne_Direct_S16_I ( - OMX_S16 *pValResult, - const OMX_S16 *pTapsQ15, - OMX_INT tapsLen, - OMX_S16 *pDelayLine, - OMX_INT *pDelayLineIndex -); - - - -/** - * Function: omxSP_FIROne_Direct_S16_Sfs (2.2.3.1.2) - * - * Description: - * Single-sample FIR filtering for 16-bit data type. These functions apply - * the FIR filter defined by the coefficient vector pTapsQ15 to a single - * sample of input data. The output is multiplied by 2 to the negative power - * of scalefactor (i.e., 2^-scalefactor) before returning to the user. - * Scaling and rounding conventions are defined in section 1.6.7. - * The internal accumulator width must be at least 32 bits. - * The result is undefined if any of the partially accumulated values exceeds - * the range of a signed 32-bit integer. - * - * Input Arguments: - * - * val - the single input sample to which the filter is - * applied. - * pTapsQ15 - pointer to the vector that contains the filter coefficients, - * represented in Q0.15 format (as defined in section 1.6.5). Given - * that: - * -32768 = pTapsQ15(k) < 32768, - * 0 = k < tapsLen, - * the range on the actual filter coefficients is -1 = bK <1, and - * therefore coefficient normalization may be required during the - * filter design process. - * tapsLen - the number of taps, or, equivalently, the filter order + 1 - * pDelayLine - pointer to the 2.tapsLen -element filter memory buffer - * (state). The user is responsible for allocation, initialization, - * and de-allocation. The filter memory elements are initialized to - * zero in most applications. - * pDelayLineIndex - pointer to the filter memory index that is maintained - * internally by the function. The user should initialize the value - * of this index to zero. - * scaleFactor - saturation fixed scaleFactor - * - * Output Arguments: - * - * pResult - pointer to the filtered output sample - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - One or more of the following pointers is NULL: - * - pResult, - * - pTapsQ15, - * - pDelayLine, or - * - pDelayLineIndex - * - tapslen < 1 - * - scaleFactor < 0 - * - *pDelayLineIndex < 0 or *pDelayLineIndex >= (2 * tapslen) - * - */ -OMXResult omxSP_FIROne_Direct_S16_Sfs ( - OMX_S16 val, - OMX_S16 *pResult, - const OMX_S16 *pTapsQ15, - OMX_INT tapsLen, - OMX_S16 *pDelayLine, - OMX_INT *pDelayLineIndex, - OMX_INT scaleFactor -); - - - -/** - * Function: omxSP_FIROne_Direct_S16_ISfs (2.2.3.1.2) - * - * Description: - * Single-sample FIR filtering for 16-bit data type. These functions apply - * the FIR filter defined by the coefficient vector pTapsQ15 to a single - * sample of input data. The output is multiplied by 2 to the negative power - * of scalefactor (i.e., 2^-scalefactor) before returning to the user. - * Scaling and rounding conventions are defined in section 1.6.7. - * The internal accumulator width must be at least 32 bits. - * The result is undefined if any of the partially accumulated values exceeds - * the range of a signed 32-bit integer. - * - * Input Arguments: - * - * pValResult - the pointer to a single input sample to which the filter is - * applied. - * pTapsQ15 - pointer to the vector that contains the filter coefficients, - * represented in Q0.15 format (as defined in section 1.6.5). Given - * that: - * -32768 = pTapsQ15(k) < 32768, - * 0 = k < tapsLen, - * the range on the actual filter coefficients is -1 = bK <1, and - * therefore coefficient normalization may be required during the - * filter design process. - * tapsLen - the number of taps, or, equivalently, the filter order + 1 - * pDelayLine - pointer to the 2.tapsLen -element filter memory buffer - * (state). The user is responsible for allocation, initialization, - * and de-allocation. The filter memory elements are initialized to - * zero in most applications. - * pDelayLineIndex - pointer to the filter memory index that is maintained - * internally by the function. The user should initialize the value - * of this index to zero. - * scaleFactor - saturation fixed scaleFactor - * - * Output Arguments: - * - * pValResult - pointer to the filtered output sample - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - One or more of the following pointers is NULL: - * - pValResult, - * - pTapsQ15, - * - pDelayLine, or - * - pDelayLineIndex - * - tapslen < 1 - * - scaleFactor < 0 - * - *pDelayLineIndex < 0 or *pDelayLineIndex >= (2 * tapslen) - * - */ -OMXResult omxSP_FIROne_Direct_S16_ISfs ( - OMX_S16 *pValResult, - const OMX_S16 *pTapsQ15, - OMX_INT tapsLen, - OMX_S16 *pDelayLine, - OMX_INT *pDelayLineIndex, - OMX_INT scaleFactor -); - - - -/** - * Function: omxSP_IIR_Direct_S16 (2.2.3.2.1) - * - * Description: - * Block IIR filtering for 16-bit data. This function applies the direct form - * II IIR filter defined by the coefficient vector pTaps to a vector of input - * data. The internal accumulator width must be at least 32 bits, and the - * result is saturated if the operation produces a value outside the range of - * a signed 16-bit integer, i.e., the output will saturate to 0x8000 (-32768) - * for a negative overflow or 0x7fff (32767) for a positive overflow. The - * result is undefined if any of the partially accumulated values exceeds the - * range of a signed 32-bit integer. - * - * Input Arguments: - * - * pSrc - pointer to the vector of input samples to which the - * filter is applied - * len - the number of samples contained in both the input and output - * vectors - * pTaps - pointer to the 2L+2-element vector that contains the combined - * numerator and denominator filter coefficients from the system - * transfer function, H(z). Coefficient scaling and coefficient - * vector organization should follow the conventions described - * above. The value of the coefficient scaleFactor exponent must be - * non-negative (sf=0). - * order - the maximum of the degrees of the numerator and denominator - * coefficient polynomials from the system transfer function, H(z). - * In the notation of section 2.2.3.2, the parameter - * order=max(K,M)=L gives the maximum delay, in samples, used to - * compute each output sample. - * pDelayLine - pointer to the L-element filter memory buffer (state). The - * user is responsible for allocation, initialization, and - * deallocation. The filter memory elements are initialized to zero - * in most applications. - * - * Output Arguments: - * - * pDst - pointer to the vector of filtered output samples - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - one or more of the following pointers is NULL: - * - pSrc, - * - pDst, - * - pTaps, or - * - pDelayLine. - * - len < 0 - * - pTaps[order+1] < 0 (negative scaling) - * - order < 1 - * - */ -OMXResult omxSP_IIR_Direct_S16 ( - const OMX_S16 *pSrc, - OMX_S16 *pDst, - OMX_INT len, - const OMX_S16 *pTaps, - OMX_INT order, - OMX_S32 *pDelayLine -); - - - -/** - * Function: omxSP_IIR_Direct_S16_I (2.2.3.2.1) - * - * Description: - * Block IIR filtering for 16-bit data. This function applies the direct form - * II IIR filter defined by the coefficient vector pTaps to a vector of input - * data. The internal accumulator width must be at least 32 bits, and the - * result is saturated if the operation produces a value outside the range of - * a signed 16-bit integer, i.e., the output will saturate to 0x8000 (-32768) - * for a negative overflow or 0x7fff (32767) for a positive overflow. The - * result is undefined if any of the partially accumulated values exceeds the - * range of a signed 32-bit integer. - * - * Input Arguments: - * - * pSrcDst - pointer to the vector of input samples to which the - * filter is applied - * len - the number of samples contained in both the input and output - * vectors - * pTaps - pointer to the 2L+2-element vector that contains the combined - * numerator and denominator filter coefficients from the system - * transfer function, H(z). Coefficient scaling and coefficient - * vector organization should follow the conventions described - * above. The value of the coefficient scaleFactor exponent must be - * non-negative (sf>=0). - * order - the maximum of the degrees of the numerator and denominator - * coefficient polynomials from the system transfer function, H(z). - * In the notation of section 2.2.3.2, the parameter - * order=max(K,M)=L gives the maximum delay, in samples, used to - * compute each output sample. - * pDelayLine - pointer to the L-element filter memory buffer (state). The - * user is responsible for allocation, initialization, and - * deallocation. The filter memory elements are initialized to zero - * in most applications. - * - * Output Arguments: - * - * pSrcDst - pointer to the vector of filtered output samples - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - one or more of the following pointers is NULL: - * - pSrcDst, - * - pTaps, or - * - pDelayLine. - * - len < 0 - * - pTaps[order+1] < 0 (negative scaling) - * - order < 1 - * - */ -OMXResult omxSP_IIR_Direct_S16_I ( - OMX_S16 *pSrcDst, - OMX_INT len, - const OMX_S16 *pTaps, - OMX_INT order, - OMX_S32 *pDelayLine -); - - - -/** - * Function: omxSP_IIROne_Direct_S16 (2.2.3.2.2) - * - * Description: - * Single sample IIR filtering for 16-bit data. This function applies the - * direct form II IIR filter defined by the coefficient vector pTaps to a - * single sample of input data. The internal accumulator width must be at - * least 32 bits, and the result is saturated if the operation produces a - * value outside the range of a signed 16-bit integer, i.e., the output will - * saturate to 0x8000 (-32768) for a negative overflow or 0x7fff (32767) for a - * positive overflow. The result is undefined if any of the partially - * accumulated values exceeds the range of a signed 32-bit integer. - * - * Input Arguments: - * - * val - the single input sample to which the filter is - * applied. - * pTaps - pointer to the 2L+2 -element vector that contains the combined - * numerator and denominator filter coefficients from the system - * transfer function, H(z). Coefficient scaling and coefficient - * vector organization should follow the conventions described - * above. The value of the coefficient scaleFactor exponent must be - * non-negative (sf>=0). - * order - the maximum of the degrees of the numerator and denominator - * coefficient polynomials from the system transfer function, H(z). - * In the notation of section 2.2.3.2, the parameter - * order=max(K,M)=L gives the maximum delay, in samples, used to - * compute each output sample. - * pDelayLine - pointer to the L-element filter memory buffer (state). The - * user is responsible for allocation, initialization, and - * deallocation. The filter memory elements are initialized to zero - * in most applications. - * - * Output Arguments: - * - * pResult - pointer to the filtered output sample - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - one or more of the following pointers is NULL: pResult, - * pTaps, or pDelayLine. - * - order < 1 - * - pTaps[order+1] < 0 (negative scaling) - * - */ -OMXResult omxSP_IIROne_Direct_S16 ( - OMX_S16 val, - OMX_S16 *pResult, - const OMX_S16 *pTaps, - OMX_INT order, - OMX_S32 *pDelayLine -); - - - -/** - * Function: omxSP_IIROne_Direct_S16_I (2.2.3.2.2) - * - * Description: - * Single sample IIR filtering for 16-bit data. This function applies the - * direct form II IIR filter defined by the coefficient vector pTaps to a - * single sample of input data. The internal accumulator width must be at - * least 32 bits, and the result is saturated if the operation produces a - * value outside the range of a signed 16-bit integer, i.e., the output will - * saturate to 0x8000 (-32768) for a negative overflow or 0x7fff (32767) for a - * positive overflow. The result is undefined if any of the partially - * accumulated values exceeds the range of a signed 32-bit integer. - * - * Input Arguments: - * - * pValResult - pointer to the single input sample to which the filter is - * applied. - * pTaps - pointer to the 2L+2 -element vector that contains the combined - * numerator and denominator filter coefficients from the system - * transfer function, H(z). Coefficient scaling and coefficient - * vector organization should follow the conventions described - * above. The value of the coefficient scaleFactor exponent must be - * non-negative (sf>=0). - * order - the maximum of the degrees of the numerator and denominator - * coefficient polynomials from the system transfer function, H(z). - * In the notation of section 2.2.3.2, the parameter - * order=max(K,M)=L gives the maximum delay, in samples, used to - * compute each output sample. - * pDelayLine - pointer to the L-element filter memory buffer (state). The - * user is responsible for allocation, initialization, and - * deallocation. The filter memory elements are initialized to zero - * in most applications. - * - * Output Arguments: - * - * pValResult - pointer to the filtered output sample - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - one or more of the following pointers is NULL: - * pValResult, pTaps, or pDelayLine. - * - order < 1 - * - pTaps[order+1] < 0 (negative scaling) - * - */ -OMXResult omxSP_IIROne_Direct_S16_I ( - OMX_S16 *pValResult, - const OMX_S16 *pTaps, - OMX_INT order, - OMX_S32 *pDelayLine -); - - - -/** - * Function: omxSP_IIR_BiQuadDirect_S16 (2.2.3.3.1) - * - * Description: - * Block biquad IIR filtering for 16-bit data type. This function applies the - * direct form II biquad IIR cascade defined by the coefficient vector pTaps - * to a vector of input data. The internal accumulator width must be at least - * 32 bits, and the result is saturated if the operation produces a value - * outside the range of a signed 16-bit integer, i.e., the output will - * saturate to 0x8000 (-32768) for a negative overflow or 0x7fff (32767) for a - * positive overflow. The result is undefined if any of the partially - * accumulated values exceeds the range of a signed 32-bit integer. - * - * Input Arguments: - * - * pSrc - pointer to the vector of input samples to which the - * filter is applied - * len - the number of samples contained in both the input and output - * vectors - * pTaps - pointer to the 6P -element vector that contains the combined - * numerator and denominator filter coefficients from the biquad - * cascade. Coefficient scaling and coefficient vector organization - * should follow the conventions described above. The value of the - * coefficient scaleFactor exponent must be non-negative. (sfp>=0). - * numBiquad - the number of biquads contained in the IIR filter cascade: - * (P) - * pDelayLine - pointer to the 2P -element filter memory buffer (state). - * The user is responsible for allocation, initialization, and - * de-allocation. The filter memory elements are initialized to - * zero in most applications. - * - * Output Arguments: - * - * pDst - pointer to the vector of filtered output samples - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - one or more of the following pointers is NULL: pSrc, pDst, - * pTaps, or pDelayLine. - * - len < 0 - * - numBiquad < 1 - * - pTaps[3+n*6] < 0, for 0 <= n < numBiquad (negative scaling) - * - */ -OMXResult omxSP_IIR_BiQuadDirect_S16 ( - const OMX_S16 *pSrc, - OMX_S16 *pDst, - OMX_INT len, - const OMX_S16 *pTaps, - OMX_INT numBiquad, - OMX_S32 *pDelayLine -); - - - -/** - * Function: omxSP_IIR_BiQuadDirect_S16_I (2.2.3.3.1) - * - * Description: - * Block biquad IIR filtering for 16-bit data type. This function applies the - * direct form II biquad IIR cascade defined by the coefficient vector pTaps - * to a vector of input data. The internal accumulator width must be at least - * 32 bits, and the result is saturated if the operation produces a value - * outside the range of a signed 16-bit integer, i.e., the output will - * saturate to 0x8000 (-32768) for a negative overflow or 0x7fff (32767) for a - * positive overflow. The result is undefined if any of the partially - * accumulated values exceeds the range of a signed 32-bit integer. - * - * Input Arguments: - * - * pSrcDst - pointer to the vector of input samples to which the - * filter is applied - * len - the number of samples contained in both the input and output - * vectors - * pTaps - pointer to the 6P -element vector that contains the combined - * numerator and denominator filter coefficients from the biquad - * cascade. Coefficient scaling and coefficient vector organization - * should follow the conventions described above. The value of the - * coefficient scaleFactor exponent must be non-negative. (sfp>=0). - * numBiquad - the number of biquads contained in the IIR filter cascade: - * (P) - * pDelayLine - pointer to the 2P -element filter memory buffer (state). - * The user is responsible for allocation, initialization, and - * de-allocation. The filter memory elements are initialized to - * zero in most applications. - * - * Output Arguments: - * - * pSrcDst - pointer to the vector of filtered output samples - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - one or more of the following pointers is NULL: - * pSrcDst, pTaps, or pDelayLine. - * - len < 0 - * - numBiquad < 1 - * - pTaps[3+n*6] < 0, for 0 <= n < numBiquad (negative scaling) - * - */ -OMXResult omxSP_IIR_BiQuadDirect_S16_I ( - OMX_S16 *pSrcDst, - OMX_INT len, - const OMX_S16 *pTaps, - OMX_INT numBiquad, - OMX_S32 *pDelayLine -); - - - -/** - * Function: omxSP_IIROne_BiQuadDirect_S16 (2.2.3.3.2) - * - * Description: - * Single-sample biquad IIR filtering for 16-bit data type. This function - * applies the direct form II biquad IIR cascade defined by the coefficient - * vector pTaps to a single sample of input data. The internal accumulator - * width must be at least 32 bits, and the result is saturated if the - * operation produces a value outside the range of a signed 16-bit integer, - * i.e., the output will saturate to 0x8000 (-32768) for a negative overflow - * or 0x7fff (32767) for a positive overflow. The result is undefined if any - * of the partially accumulated values exceeds the range of a signed 32-bit - * integer. - * - * Input Arguments: - * - * val - the single input sample to which the filter is - * applied. - * pTaps - pointer to the 6P-element vector that contains the combined - * numerator and denominator filter coefficients from the biquad - * cascade. Coefficient scaling and coefficient vector organization - * should follow the conventions described above. The value of the - * coefficient scalefactor exponent must be non-negative: (sfp>=0). - * numBiquad - the number of biquads contained in the IIR filter cascade: - * (P) - * pDelayLine - pointer to the 2p-element filter memory buffer (state). The - * user is responsible for allocation, initialization, and - * deallocation. The filter memory elements are initialized to zero - * in most applications. - * - * Output Arguments: - * - * pResult - pointer to the filtered output sample - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - one or more of the following pointers is NULL: pResult, - * pValResult, pTaps, or pDelayLine. - * - numBiquad < 1 - * - pTaps[3+n*6] < 0, for 0 <= n < numBiquad (negative scaling) - * - */ -OMXResult omxSP_IIROne_BiQuadDirect_S16 ( - OMX_S16 val, - OMX_S16 *pResult, - const OMX_S16 *pTaps, - OMX_INT numBiquad, - OMX_S32 *pDelayLine -); - - - -/** - * Function: omxSP_IIROne_BiQuadDirect_S16_I (2.2.3.3.2) - * - * Description: - * Single-sample biquad IIR filtering for 16-bit data type. This function - * applies the direct form II biquad IIR cascade defined by the coefficient - * vector pTaps to a single sample of input data. The internal accumulator - * width must be at least 32 bits, and the result is saturated if the - * operation produces a value outside the range of a signed 16-bit integer, - * i.e., the output will saturate to 0x8000 (-32768) for a negative overflow - * or 0x7fff (32767) for a positive overflow. The result is undefined if any - * of the partially accumulated values exceeds the range of a signed 32-bit - * integer. - * - * Input Arguments: - * - * pValResult - pointer to the single input sample to which the filter is - * applied. - * pTaps - pointer to the 6P-element vector that contains the combined - * numerator and denominator filter coefficients from the biquad - * cascade. Coefficient scaling and coefficient vector organization - * should follow the conventions described above. The value of the - * coefficient scalefactor exponent must be non-negative: (sfp>=0). - * numBiquad - the number of biquads contained in the IIR filter cascade: - * (P) - * pDelayLine - pointer to the 2p-element filter memory buffer (state). The - * user is responsible for allocation, initialization, and - * deallocation. The filter memory elements are initialized to zero - * in most applications. - * - * Output Arguments: - * - * pValResult - pointer to the filtered output sample - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - one or more of the following pointers is NULL: - * pValResult, pTaps, or pDelayLine. - * - numBiquad < 1 - * - pTaps[3+n*6] < 0, for 0 <= n < numBiquad (negative scaling) - * - */ -OMXResult omxSP_IIROne_BiQuadDirect_S16_I ( - OMX_S16 *pValResult, - const OMX_S16 *pTaps, - OMX_INT numBiquad, - OMX_S32 *pDelayLine -); - - - -/** - * Function: omxSP_FilterMedian_S32 (2.2.3.4.1) - * - * Description: - * This function computes the median over the region specified by the median - * mask for the every element of the input array. The median outputs are - * stored in the corresponding elements of the output vector. - * - * Input Arguments: - * - * pSrc - pointer to the input vector - * len - number of elements contained in the input and output vectors (0 < - * len < 65536) - * maskSize - median mask size; if an even value is specified, the function - * subtracts 1 and uses the odd value of the filter mask for median - * filtering (0 < maskSize < 256) - * - * Output Arguments: - * - * pDst - pointer to the median-filtered output vector - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - one or more of the following pointers is NULL: pSrc, pDst. - * - len < 0 - * - maskSize < 1 or maskSize> 255 - * OMX_StsSP_EvenMedianMaskSizeErr - even mask size replaced by odd mask - * size - * - */ -OMXResult omxSP_FilterMedian_S32 ( - const OMX_S32 *pSrc, - OMX_S32 *pDst, - OMX_INT len, - OMX_INT maskSize -); - - - -/** - * Function: omxSP_FilterMedian_S32_I (2.2.3.4.1) - * - * Description: - * This function computes the median over the region specified by the median - * mask for the every element of the input array. The median outputs are - * stored in the corresponding elements of the output vector. - * - * Input Arguments: - * - * pSrcDst - pointer to the input vector - * len - number of elements contained in the input and output vectors (0 < - * len < 65536) - * maskSize - median mask size; if an even value is specified, the function - * subtracts 1 and uses the odd value of the filter mask for median - * filtering (0 < maskSize < 256) - * - * Output Arguments: - * - * pSrcDst - pointer to the median-filtered output vector - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - pSrcDst is NULL. - * - len < 0 - * - maskSize < 1 or maskSize> 255 - * OMX_StsSP_EvenMedianMaskSizeErr - even mask size replaced by odd mask - * size - * - */ -OMXResult omxSP_FilterMedian_S32_I ( - OMX_S32 *pSrcDst, - OMX_INT len, - OMX_INT maskSize -); - - - -/** - * Function: omxSP_FFTInit_C_SC16 (2.2.4.1.2) - * - * Description: - * These functions initialize the specification structures required for the - * complex FFT and IFFT functions. Desired block length is specified as an - * input. The function <FFTInit_C_SC16> is used to initialize the - * specification structures for functions <FFTFwd_CToC_SC16_Sfs> and - * <FFTInv_CToC_SC16_Sfs>. - * - * Memory for the specification structure *pFFTSpec - * must be allocated prior to calling these functions and should be 4-byte - * aligned for omxSP_FFTInit_C_SC16. - * - * The space required for *pFFTSpec, in bytes, can be - * determined using <FFTGetBufSize_C_SC16>. - * - * Input Arguments: - * - * order - base-2 logarithm of the desired block length; - * valid in the range [0,12] - * - * Output Arguments: - * - * pFFTSpec - pointer to initialized specification structure - * - * Return Value: - * - * OMX_Sts_NoErr -no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - pFFTSpec is either NULL or violates the 4-byte alignment - * restrictions - * - order < 0 or order > 12 - * - */ -OMXResult omxSP_FFTInit_C_SC16 ( - OMXFFTSpec_C_SC16 *pFFTSpec, - OMX_INT order -); - - - -/** - * Function: omxSP_FFTInit_C_SC32 (2.2.4.1.2) - * - * Description: - * These functions initialize the specification structures required for the - * complex FFT and IFFT functions. Desired block length is specified as an - * input. The function <FFTInit_C_SC32> is used to initialize - * the specification structures for the functions <FFTFwd_CToC_SC32_Sfs> and - * <FFTInv_CToC_SC32_Sfs>. - * - * Memory for the specification structure *pFFTSpec must be allocated prior - * to calling these functions and should be 8-byte aligned for - * omxSP_FFTInit_C_SC32. - * - * The space required for *pFFTSpec, in bytes, can be - * determined using <FFTGetBufSize_C_SC32>. - * - * Input Arguments: - * - * order - base-2 logarithm of the desired block length; valid in the range - * [0,12] - * - * Output Arguments: - * - * pFFTSpec - pointer to initialized specification structure - * - * Return Value: - * - * OMX_Sts_NoErr -no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - pFFTSpec is either NULL or violates the 8-byte alignment - * restrictions - * - order < 0 or order > 12 - * - */ -OMXResult omxSP_FFTInit_C_SC32 ( - OMXFFTSpec_C_SC32 *pFFTSpec, - OMX_INT order -); - -/** - * Function: omxSP_FFTInit_C_FC32 (2.2.4.1.2) - * - * Description: - * These functions initialize the specification structures required for the - * complex FFT and IFFT functions. Desired block length is specified as an - * input. The function <FFTInit_C_FC32> is used to initialize - * the specification structures for the functions <FFTFwd_CToC_FC32_Sfs> and - * <FFTInv_CToC_FC32_Sfs>. - * - * Memory for the specification structure *pFFTSpec must be allocated prior - * to calling these functions and should be 8-byte aligned for - * omxSP_FFTInit_C_FC32. - * - * The space required for *pFFTSpec, in bytes, can be - * determined using <FFTGetBufSize_C_FC32>. - * - * Input Arguments: - * - * order - base-2 logarithm of the desired block length; valid in the range - * [1,15] - * - * Output Arguments: - * - * pFFTSpec - pointer to initialized specification structure - * - * Return Value: - * - * OMX_Sts_NoErr -no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - pFFTSpec is either NULL or violates the 8-byte alignment - * restrictions - * - order < 1 or order > 15 - * - */ -OMXResult omxSP_FFTInit_C_FC32( - OMXFFTSpec_C_FC32* pFFTSpec, - OMX_INT order -); - - - -/** - * Function: omxSP_FFTInit_R_S16S32 (2.2.4.1.4) - * - * Description: - * These functions initialize specification structures required for the real - * FFT and IFFT functions. The function <FFTInit_R_S16S32> is used to - * initialize the specification structures for functions - * <FFTFwd_RToCCS_S16S32_Sfs> and <FFTInv_CCSToR_S32S16_Sfs>. - * - * Memory for - * *pFFTFwdSpec must be allocated before calling these functions and should be - * 8-byte aligned. The number of bytes required for *pFFTFwdSpec can be - * determined using <FFTGetBufSize_R_S16S32>. - * - * Input Arguments: - * - * order - base-2 logarithm of the desired block length; valid in the range - * [0,12] - * - * Output Arguments: - * - * pFFTFwdSpec - pointer to the initialized specification structure - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - pFFTFwdSpec is either NULL or violates the 8-byte alignment - * restrictions - * - order < 0 or order > 12 - * - */ -OMXResult omxSP_FFTInit_R_S16S32( - OMXFFTSpec_R_S16S32* pFFTFwdSpec, - OMX_INT order -); - - - -/** - * Function: omxSP_FFTInit_R_S16 - * - * Description: - * These functions initialize specification structures required for the real - * FFT and IFFT functions. The function <FFTInit_R_S16> is used - * to initialize the specification structures for functions - * <FFTFwd_RToCCS_S16_Sfs> and <FFTInv_CCSToR_S16_Sfs>. - * - * Memory for *pFFTFwdSpec must be allocated before calling these functions - * and should be 8-byte aligned. - * - * The number of bytes required for *pFFTFwdSpec can be - * determined using <FFTGetBufSize_R_S16>. - * - * Input Arguments: - * - * order - base-2 logarithm of the desired block length; valid in the range - * [1,12] - * - * Output Arguments: - * - * pFFTFwdSpec - pointer to the initialized specification structure - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - pFFTFwdSpec is either NULL or violates the 8-byte alignment - * restrictions - * - order < 1 or order > 12 - * - */ -OMXResult omxSP_FFTInit_R_S16 ( - OMXFFTSpec_R_S32*pFFTFwdSpec, - OMX_INT order -); - -/** - * Function: omxSP_FFTInit_R_S32 (2.2.4.1.4) - * - * Description: - * These functions initialize specification structures required for the real - * FFT and IFFT functions. The function <FFTInit_R_S32> is used to initialize - * the specification structures for functions <FFTFwd_RToCCS_S32_Sfs> - * and <FFTInv_CCSToR_S32_Sfs>. - * - * Memory for *pFFTFwdSpec must be allocated before calling these functions - * and should be 8-byte aligned. - * - * The number of bytes required for *pFFTFwdSpec can be - * determined using <FFTGetBufSize_R_S32>. - * - * Input Arguments: - * - * order - base-2 logarithm of the desired block length; valid in the range - * [0,12] - * - * Output Arguments: - * - * pFFTFwdSpec - pointer to the initialized specification structure - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - pFFTFwdSpec is either NULL or violates the 8-byte alignment - * restrictions - * - order < 0 or order > 12 - * - */ -OMXResult omxSP_FFTInit_R_S32 ( - OMXFFTSpec_R_S32*pFFTFwdSpec, - OMX_INT order -); - -/** - * Function: omxSP_FFTInit_R_F32 - * - * Description: - * These functions initialize specification structures required for the real - * FFT and IFFT functions. The function <FFTInit_R_F32> is used to initialize - * the specification structures for functions <FFTFwd_RToCCS_F32_Sfs> - * and <FFTInv_CCSToR_F32_Sfs>. - * - * Memory for *pFFTFwdSpec must be allocated before calling these functions - * and should be 8-byte aligned. - * - * The number of bytes required for *pFFTFwdSpec can be - * determined using <FFTGetBufSize_R_F32>. - * - * Input Arguments: - * - * order - base-2 logarithm of the desired block length; valid in the range - * [1,15] - * - * Output Arguments: - * - * pFFTFwdSpec - pointer to the initialized specification structure - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - pFFTFwdSpec is either NULL or violates the 8-byte alignment - * restrictions - * - order < 1 or order > 15 - * - */ -OMXResult omxSP_FFTInit_R_F32( - OMXFFTSpec_R_F32* pFFTFwdSpec, - OMX_INT order -); - -/** - * Function: omxSP_FFTGetBufSize_C_SC16 (2.2.4.1.6) - * - * Description: - * These functions compute the size of the specification structure - * required for the length 2^order complex FFT and IFFT functions. The function - * <FFTGetBufSize_C_SC16> is used in conjunction with the 16-bit functions - * <FFTFwd_CToC_SC16_Sfs> and <FFTInv_CToC_SC16_Sfs>. - * - * Input Arguments: - * - * order - base-2 logarithm of the desired block length; valid in the range - * [0,12] - * - * Output Arguments: - * - * pSize - pointer to the number of bytes required for the specification - * structure - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - pSize is NULL - * - order < 0 or order > 12 - * - */ -OMXResult omxSP_FFTGetBufSize_C_SC16 ( - OMX_INT order, - OMX_INT *pSize -); - - - -/** - * Function: omxSP_FFTGetBufSize_C_SC32 (2.2.4.1.6) - * - * Description: - * These functions compute the size of the specification structure - * required for the length 2^order complex FFT and IFFT functions. The function - * <FFTGetBufSize_C_SC32> is used in conjunction with the 32-bit functions - * <FFTFwd_CToC_SC32_Sfs> and <FFTInv_CToC_SC32_Sfs>. - * - * Input Arguments: - * - * order - base-2 logarithm of the desired block length; valid in the range - * [0,12] - * - * Output Arguments: - * - * pSize - pointer to the number of bytes required for the specification - * structure - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - pSize is NULL - * - order < 0 or order > 12 - * - */ -OMXResult omxSP_FFTGetBufSize_C_SC32 ( - OMX_INT order, - OMX_INT *pSize -); - -/** - * Function: omxSP_FFTGetBufSize_C_FC32 - * - * Description: - * These functions compute the size of the specification structure - * required for the length 2^order complex FFT and IFFT functions. The function - * <FFTGetBufSize_C_FC32> is used in conjunction with the 32-bit functions - * <FFTFwd_CToC_FC32_Sfs> and <FFTInv_CToC_FC32_Sfs>. - * - * Input Arguments: - * - * order - base-2 logarithm of the desired block length; valid in the range - * [1,15] - * - * Output Arguments: - * - * pSize - pointer to the number of bytes required for the specification - * structure - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments; returned if one or more of the - * following is true: - * - pSize is NULL - * - order < 1 or order > 15 - * - */ -OMXResult omxSP_FFTGetBufSize_C_FC32( - OMX_INT order, - OMX_INT* pSize -); - - -/** - * Function: omxSP_FFTGetBufSize_R_S16S32 (2.2.4.1.8) - * - * Description: - * order These functions compute the size of the specification structure - * required for the length 2^order real FFT and IFFT functions. The function - * <FFTGetBufSize_R_S16S32> is used in conjunction with the 16-bit functions - * <FFTFwd_RToCCS_S16S32_Sfs> and <FFTInv_CCSToR_S32S16_Sfs>. - * - * Input Arguments: - * - * order - base-2 logarithm of the length; valid in the range [0,12] - * - * Output Arguments: - * - * pSize - pointer to the number of bytes required for the specification - * structure - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments The function returns - * OMX_Sts_BadArgErr if one or more of the following is true: - * pSize is NULL - * order < 0 or order > 12 - * - */ -OMXResult omxSP_FFTGetBufSize_R_S16S32( - OMX_INT order, - OMX_INT* pSize -); - - -/** - * Function: omxSP_FFTGetBufSize_R_S16 - * - * Description: - * These functions compute the size of the specification structure - * required for the length 2^order real FFT and IFFT functions. The function - * <FFTGetBufSize_R_S16> is used in conjunction with the 16-bit - * functions <FFTFwd_RToCCS_S16_Sfs> and <FFTInv_CCSToR_S16_Sfs>. - * - * Input Arguments: - * - * order - base-2 logarithm of the length; valid in the range - * [1,12] - * - * Output Arguments: - * - * pSize - pointer to the number of bytes required for the specification - * structure - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments The function returns - * OMX_Sts_BadArgErr if one or more of the following is true: - * pSize is NULL - * order < 1 or order > 12 - * - */ -OMXResult omxSP_FFTGetBufSize_R_S16 ( - OMX_INT order, - OMX_INT *pSize -); - -/** - * Function: omxSP_FFTGetBufSize_R_S32 (2.2.4.1.8) - * - * Description: - * These functions compute the size of the specification structure - * required for the length 2^order real FFT and IFFT functions. The function - * <FFTGetBufSize_R_S32> is used in conjunction with the 32-bit functions - * <FFTFwd_RToCCS_S32_Sfs> and <FFTInv_CCSToR_S32_Sfs>. - * - * Input Arguments: - * - * order - base-2 logarithm of the length; valid in the range [0,12] - * - * Output Arguments: - * - * pSize - pointer to the number of bytes required for the specification - * structure - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments The function returns - * OMX_Sts_BadArgErr if one or more of the following is true: - * pSize is NULL - * order < 0 or order > 12 - * - */ -OMXResult omxSP_FFTGetBufSize_R_S32 ( - OMX_INT order, - OMX_INT *pSize -); - -/** - * Function: omxSP_FFTGetBufSize_R_F32 - * - * Description: - * These functions compute the size of the specification structure - * required for the length 2^order real FFT and IFFT functions. The function - * <FFTGetBufSize_R_F32> is used in conjunction with the 32-bit functions - * <FFTFwd_RToCCS_F32_Sfs> and <FFTInv_CCSToR_F32_Sfs>. - * - * Input Arguments: - * - * order - base-2 logarithm of the length; valid in the range [1,15] - * - * Output Arguments: - * - * pSize - pointer to the number of bytes required for the specification - * structure - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments The function returns - * OMX_Sts_BadArgErr if one or more of the following is true: - * pSize is NULL - * order < 1 or order > 15 - * - */ -OMXResult omxSP_FFTGetBufSize_R_F32( - OMX_INT order, - OMX_INT* pSize -); - - - -/** - * Function: omxSP_FFTFwd_CToC_SC16_Sfs (2.2.4.2.2) - * - * Description: - * Compute an FFT for a complex signal of length of 2^order, - * where 0 <= order <= 12. - * Transform length is determined by the specification structure, which - * must be initialized prior to calling the FFT function using the appropriate - * helper, i.e., <FFTInit_C_sc32> or <FFTInit_C_SC16>. The relationship - * between the input and output sequences can be expressed in terms of the - * DFT, i.e., - * - * X[k] = 2^(-scaleFactor) . SUM[n=0...N-1]x[n].e^(-jnk.2.pi/N) - * k = 0,1,2,..., N-1 - * N = 2^order - * - * Input Arguments: - * pSrc - pointer to the input signal, a complex-valued vector of length 2^order; - * must be aligned on a 32 byte boundary. - * pFFTSpec - pointer to the preallocated and initialized specification - * structure - * scaleFactor - output scale factor; the range for is [0,16] - * - * Output Arguments: - * pDst - pointer to the complex-valued output vector, of length 2^order; - * must be aligned on an 32-byte boundary. - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - returned if one or more of the following conditions - * is true: - * - one or more of the following pointers is NULL: pSrc, pDst, or - * pFFTSpec. - * - pSrc or pDst is not 32-byte aligned - * - scaleFactor<0 or scaleFactor>16 - * - */ - -OMXResult omxSP_FFTFwd_CToC_SC16_Sfs ( - const OMX_SC16 *pSrc, - OMX_SC16 *pDst, - const OMXFFTSpec_C_SC16 *pFFTSpec, - OMX_INT scaleFactor -); - -OMXResult omxSP_FFTFwd_CToC_SC16_Sfs_neon ( - const OMX_SC16 *pSrc, - OMX_SC16 *pDst, - const OMXFFTSpec_C_SC16 *pFFTSpec, - OMX_INT scaleFactor -); - -/** - * Function: omxSP_FFTFwd_CToC_SC32_Sfs (2.2.4.2.2) - * - * Description: - * Compute an FFT for a complex signal of length of 2^order, - * where 0 <= order <= 12. - * Transform length is determined by the specification structure, which - * must be initialized prior to calling the FFT function using the appropriate - * helper, i.e., <FFTInit_C_sc32> or <FFTInit_C_SC16>. The relationship - * between the input and output sequences can be expressed in terms of the - * DFT, i.e., - * - * X[k] = 2^(-scaleFactor) . SUM[n=0...N-1]x[n].e^(-jnk.2.pi/N) - * k = 0,1,2,..., N-1 - * N = 2^order - * - * Input Arguments: - * pSrc - pointer to the input signal, a complex-valued vector of length 2^order; - * must be aligned on a 32 byte boundary. - * pFFTSpec - pointer to the preallocated and initialized specification - * structure - * scaleFactor - output scale factor; the range is [0,32] - * - * Output Arguments: - * pDst - pointer to the complex-valued output vector, of length 2^order; must be - * aligned on an 32-byte boundary. - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - returned if one or more of the following conditions - * is true: - * - one or more of the following pointers is NULL: pSrc, pDst, or - * pFFTSpec. - * - pSrc or pDst is not 32-byte aligned - * - scaleFactor<0 or scaleFactor >32 - * - */ -OMXResult omxSP_FFTFwd_CToC_SC32_Sfs ( - const OMX_SC32 *pSrc, - OMX_SC32 *pDst, - const OMXFFTSpec_C_SC32 *pFFTSpec, - OMX_INT scaleFactor -); - - - -/** - * Function: omxSP_FFTInv_CToC_SC16_Sfs (2.2.4.2.4) - * - * Description: - * These functions compute an inverse FFT for a complex signal of length - * of 2^order, where 0 <= order <= 12. Transform length is determined by the - * specification structure, which must be initialized prior to calling the FFT - * function using the appropriate helper, i.e., <FFTInit_C_sc32> or - * <FFTInit_C_SC16>. The relationship between the input and output sequences - * can be expressed in terms of the IDFT, i.e.: - * - * x[n] = (2^(-scalefactor)/N) . SUM[k=0,...,N-1] X[k].e^(jnk.2.pi/N) - * n=0,1,2,...N-1 - * N=2^order. - * - * Input Arguments: - * pSrc - pointer to the complex-valued input signal, of length 2^order ; - * must be aligned on a 32-byte boundary. - * pFFTSpec - pointer to the preallocated and initialized specification - * structure - * scaleFactor - scale factor of the output. Valid range is [0,16]. - * - * Output Arguments: - * order - * pDst - pointer to the complex-valued output signal, of length 2^order; - * must be aligned on a 32-byte boundary. - * - * Return Value: - * - * Positive value - the shift scale that was performed inside - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - returned if one or more of the following conditions - * is true: - * - one or more of the following pointers is NULL: pSrc, pDst, or - * pFFTSpec. - * - pSrc or pDst is not 32-byte aligned - * - scaleFactor<0 or scaleFactor>16 - * - */ -OMXResult omxSP_FFTInv_CToC_SC16_Sfs ( - const OMX_SC16 *pSrc, - OMX_SC16 *pDst, - const OMXFFTSpec_C_SC16 *pFFTSpec, - OMX_INT scaleFactor -); - -OMXResult omxSP_FFTInv_CToC_SC16_Sfs_neon ( - const OMX_SC16 *pSrc, - OMX_SC16 *pDst, - const OMXFFTSpec_C_SC16 *pFFTSpec, - OMX_INT scaleFactor -); - - - - -/** - * Function: omxSP_FFTInv_CToC_SC32_Sfs (2.2.4.2.4) - * - * Description: - * These functions compute an inverse FFT for a complex signal of length - * of 2^order, where 0 <= order <= 12. Transform length is determined by the - * specification structure, which must be initialized prior to calling the FFT - * function using the appropriate helper, i.e., <FFTInit_C_sc32> or - * <FFTInit_C_SC16>. The relationship between the input and output sequences - * can be expressed in terms of the IDFT, i.e.: - * - * x[n] = (2^(-scalefactor)/N) . SUM[k=0,...,N-1] X[k].e^(jnk.2.pi/N) - * n=0,1,2,...N-1 - * N=2^order. - * - * Input Arguments: - * pSrc - pointer to the complex-valued input signal, of length 2^order ; - * must be aligned on a 32-byte boundary. - * pFFTSpec - pointer to the preallocated and initialized specification - * structure - * scaleFactor - scale factor of the output. Valid range is [0,32]. - * - * Output Arguments: - * order - * pDst - pointer to the complex-valued output signal, of length 2^order; - * must be aligned on a 32-byte boundary. - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - returned if one or more of the following conditions - * is true: - * - one or more of the following pointers is NULL: pSrc, pDst, or - * pFFTSpec. - * - pSrc or pDst is not 32-byte aligned - * - scaleFactor<0 or scaleFactor>32 - * - */ -OMXResult omxSP_FFTInv_CToC_SC32_Sfs ( - const OMX_SC32 *pSrc, - OMX_SC32 *pDst, - const OMXFFTSpec_C_SC32 *pFFTSpec, - OMX_INT scaleFactor -); - - - -/** - * Function: omxSP_FFTFwd_RToCCS_S16S32_Sfs (2.2.4.4.2) - * - * Description: - * These functions compute an FFT for a real-valued signal of length of 2^order, - * where 0 <= order <= 12. Transform length is determined by the - * specification structure, which must be initialized prior to calling the FFT - * function using the appropriate helper, i.e., <FFTInit_R_S16S32>. - * The relationship between the input and output sequences - * can be expressed in terms of the DFT, i.e.: - * - * x[n] = (2^(-scalefactor)/N) . SUM[k=0,...,N-1] X[k].e^(jnk.2.pi/N) - * n=0,1,2,...N-1 - * N=2^order. - * - * The conjugate-symmetric output sequence is represented using a CCS vector, - * which is of length N+2, and is organized as follows: - * - * Index: 0 1 2 3 4 5 . . . N-2 N-1 N N+1 - * Component: R0 0 R1 I1 R2 I2 . . . R[N/2-1] I[N/2-1] R[N/2] 0 - * - * where R[n] and I[n], respectively, denote the real and imaginary components - * for FFT bin 'n'. Bins are numbered from 0 to N/2, where N is the FFT length. - * Bin index 0 corresponds to the DC component, and bin index N/2 corresponds to the - * foldover frequency. - * - * Input Arguments: - * pSrc - pointer to the real-valued input sequence, of length 2^order; - * must be aligned on a 32-byte boundary. - * pFFTSpec - pointer to the preallocated and initialized specification - * structure - * scaleFactor - output scale factor; valid range is [0, 32] - * - * Output Arguments: - * pDst - pointer to output sequence, represented using CCS format, of - * length (2^order)+2; must be aligned on a 32-byte boundary. - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments, if one or more of the following is true: - * - one of the pointers pSrc, pDst, or pFFTSpec is NULL - * - pSrc or pDst is not aligned on a 32-byte boundary - * - scaleFactor<0 or scaleFactor >32 - * - */ -OMXResult omxSP_FFTFwd_RToCCS_S16S32_Sfs ( - const OMX_S16 *pSrc, - OMX_S32 *pDst, - const OMXFFTSpec_R_S16S32 *pFFTSpec, - OMX_INT scaleFactor -); - - -/** - * Function: omxSP_FFTFwd_RToCCS_S16_Sfs - * - * Description: - * These functions compute an FFT for a real-valued signal of length of 2^order, - * where 0 < order <= 12. Transform length is determined by the - * specification structure, which must be initialized prior to calling the FFT - * function using the appropriate helper, i.e., <FFTInit_R_S16>. - * The relationship between the input and output sequences can - * be expressed in terms of the DFT, i.e.: - * - * x[n] = (2^(-scalefactor)/N) . SUM[k=0,...,N-1] X[k].e^(jnk.2.pi/N) - * n=0,1,2,...N-1 - * N=2^order. - * - * The conjugate-symmetric output sequence is represented using a CCS vector, - * which is of length N+2, and is organized as follows: - * - * Index: 0 1 2 3 4 5 . . . N-2 N-1 N N+1 - * Component: R0 0 R1 I1 R2 I2 . . . R[N/2-1] I[N/2-1] R[N/2] 0 - * - * where R[n] and I[n], respectively, denote the real and imaginary components - * for FFT bin 'n'. Bins are numbered from 0 to N/2, where N is the FFT length. - * Bin index 0 corresponds to the DC component, and bin index N/2 corresponds to - * the foldover frequency. - * - * Input Arguments: - * pSrc - pointer to the real-valued input sequence, of length 2^order; - * must be aligned on a 32-byte boundary. - * pFFTSpec - pointer to the preallocated and initialized specification - * structure - * scaleFactor - output scale factor; valid range is [0, 16] - * - * Output Arguments: - * pDst - pointer to output sequence, represented using CCS format, of - * length (2^order)+2; must be aligned on a 32-byte boundary. - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments, if one or more of followings is true: - * - one of the pointers pSrc, pDst, or pFFTSpec is NULL - * - pSrc or pDst is not aligned on a 32-byte boundary - * - scaleFactor<0 or scaleFactor >16 - * - */ -OMXResult omxSP_FFTFwd_RToCCS_S16_Sfs ( - const OMX_S16* pSrc, - OMX_S16* pDst, - const OMXFFTSpec_R_S16* pFFTSpec, - OMX_INT scaleFactor -); - - -/** - * Function: omxSP_FFTFwd_RToCCS_S32_Sfs (2.2.4.4.2) - * - * Description: - * These functions compute an FFT for a real-valued signal of length of 2^order, - * where 0 <= order <= 12. Transform length is determined by the - * specification structure, which must be initialized prior to calling the FFT - * function using the appropriate helper, i.e., <FFTInit_R_S32>. - * The relationship between the input and output sequences - * can be expressed in terms of the DFT, i.e.: - * - * x[n] = (2^(-scalefactor)/N) . SUM[k=0,...,N-1] X[k].e^(jnk.2.pi/N) - * n=0,1,2,...N-1 - * N=2^order. - * - * The conjugate-symmetric output sequence is represented using a CCS vector, - * which is of length N+2, and is organized as follows: - * - * Index: 0 1 2 3 4 5 . . . N-2 N-1 N N+1 - * Component: R0 0 R1 I1 R2 I2 . . . R[N/2-1] I[N/2-1] R[N/2] 0 - * - * where R[n] and I[n], respectively, denote the real and imaginary components - * for FFT bin 'n'. Bins are numbered from 0 to N/2, where N is the FFT length. - * Bin index 0 corresponds to the DC component, and bin index N/2 corresponds to the - * foldover frequency. - * - * Input Arguments: - * pSrc - pointer to the real-valued input sequence, of length 2^order; - * must be aligned on a 32-byte boundary. - * pFFTSpec - pointer to the preallocated and initialized specification - * structure - * scaleFactor - output scale factor; valid range is [0, 32] - * - * Output Arguments: - * pDst - pointer to output sequence, represented using CCS format, of - * length (2^order)+2; must be aligned on a 32-byte boundary. - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments, if one or more of the following is true: - * - one of the pointers pSrc, pDst, or pFFTSpec is NULL - * - pSrc or pDst is not aligned on a 32-byte boundary - * - scaleFactor<0 or scaleFactor >32 - * - */ -OMXResult omxSP_FFTFwd_RToCCS_S32_Sfs ( - const OMX_S32 *pSrc, - OMX_S32 *pDst, - const OMXFFTSpec_R_S32 *pFFTSpec, - OMX_INT scaleFactor -); - -/** - * Function: omxSP_FFTFwd_CToC_FC32_Sfs (2.2.4.2.2) - * - * Description: - * Compute an FFT for a complex signal of length of 2^order, - * where 0 <= order <= 15. - * Transform length is determined by the specification structure, which - * must be initialized prior to calling the FFT function using the appropriate - * helper, i.e., <FFTInit_C_sc32> or <FFTInit_C_SC16>. The relationship - * between the input and output sequences can be expressed in terms of the - * DFT, i.e., - * - * X[k] = SUM[n=0...N-1]x[n].e^(-jnk.2.pi/N) - * k = 0,1,2,..., N-1 - * N = 2^order - * - * Input Arguments: - * pSrc - pointer to the input signal, a complex-valued vector of length - * 2^order; must be aligned on a 32 byte boundary. - * pFFTSpec - pointer to the preallocated and initialized specification - * structure - * - * Output Arguments: - * pDst - pointer to the complex-valued output vector, of length 2^order; - * must be aligned on an 32-byte boundary. - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - returned if one or more of the following conditions - * is true: - * - one or more of the following pointers is NULL: pSrc, pDst, or - * pFFTSpec. - * - pSrc or pDst is not 32-byte aligned - * - scaleFactor<0 or scaleFactor >32 - * - */ -OMXResult omxSP_FFTFwd_CToC_FC32_Sfs ( - const OMX_FC32 *pSrc, - OMX_FC32 *pDst, - const OMXFFTSpec_C_FC32 *pFFTSpec -); -#ifdef __arm__ -/* - * Non-NEON version - */ -OMXResult omxSP_FFTFwd_CToC_FC32_Sfs_vfp ( - const OMX_FC32 *pSrc, - OMX_FC32 *pDst, - const OMXFFTSpec_C_FC32 *pFFTSpec -); -#endif - -/** - * Function: omxSP_FFTFwd_RToCCS_F32_Sfs - * - * Description: - * These functions compute an FFT for a real-valued signal of length - * of 2^order, where 0 <= order <= 12. Transform length is determined - * by the specification structure, which must be initialized prior to - * calling the FFT function using the appropriate helper, i.e., - * <FFTInit_R_F32>. The relationship between the input and output - * sequences can be expressed in terms of the DFT, i.e.: - * - * x[n] = (2^(-scalefactor)/N) . SUM[k=0,...,N-1] X[k].e^(jnk.2.pi/N) - * n=0,1,2,...N-1 - * N=2^order. - * - * The conjugate-symmetric output sequence is represented using a CCS vector, - * which is of length N+2, and is organized as follows: - * - * Index: 0 1 2 3 4 5 . . . N-2 N-1 N N+1 - * Component: R0 0 R1 I1 R2 I2 . . . R[N/2-1] I[N/2-1] R[N/2] 0 - * - * where R[n] and I[n], respectively, denote the real and imaginary - * components for FFT bin 'n'. Bins are numbered from 0 to N/2, where - * N is the FFT length. Bin index 0 corresponds to the DC component, - * and bin index N/2 corresponds to the foldover frequency. - * - * Input Arguments: - * pSrc - pointer to the real-valued input sequence, of length 2^order; - * must be aligned on a 32-byte boundary. - * pFFTSpec - pointer to the preallocated and initialized specification - * structure - * - * Output Arguments: - * pDst - pointer to output sequence, represented using CCS format, of - * length (2^order)+2; must be aligned on a 32-byte boundary. - * - * Return Value: - * - * OMX_Sts_NoErr - no error - - * OMX_Sts_BadArgErr - bad arguments, if one or more of the - * following is true: - one of the pointers pSrc, pDst, or pFFTSpec - * is NULL - pSrc or pDst is not aligned on a 32-byte boundary - * - */ -OMXResult omxSP_FFTFwd_RToCCS_F32_Sfs( - const OMX_F32* pSrc, - OMX_F32* pDst, - const OMXFFTSpec_R_F32* pFFTSpec -); - -#ifdef __arm__ -/* - * Non-NEON version of omxSP_FFTFwd_RToCCS_F32_Sfs - */ -OMXResult omxSP_FFTFwd_RToCCS_F32_Sfs_vfp( - const OMX_F32* pSrc, - OMX_F32* pDst, - const OMXFFTSpec_R_F32* pFFTSpec -); - -/* - * Just like omxSP_FFTFwd_RToCCS_F32_Sfs, but automatically detects - * whether NEON is available or not and chooses the appropriate - * routine. - */ -extern OMXResult (*omxSP_FFTFwd_RToCCS_F32)( - const OMX_F32* pSrc, - OMX_F32* pDst, - const OMXFFTSpec_R_F32* pFFTSpec -); -#else -#define omxSP_FFTFwd_RToCCS_F32 omxSP_FFTFwd_RToCCS_F32_Sfs -#endif - -/** - * Function: omxSP_FFTInv_CCSToR_S32S16_Sfs (2.2.4.4.4) - * - * Description: - * These functions compute the inverse FFT for a conjugate-symmetric input - * sequence. Transform length is determined by the specification structure, - * which must be initialized prior to calling the FFT function using - * <FFTInit_R_S16S32>. For a transform of length M, the input sequence is - * represented using a packed CCS vector of length M+2, and is organized - * as follows: - * - * Index: 0 1 2 3 4 5 . . . M-2 M-1 M M+1 - * Component R[0] 0 R[1] I[1] R[2] I[2] . . . R[M/2-1] I[M/2-1] R[M/2] 0 - * - * where R[n] and I[n], respectively, denote the real and imaginary components for FFT bin n. - * Bins are numbered from 0 to M/2, where M is the FFT length. Bin index 0 - * corresponds to the DC component, and bin index M/2 corresponds to the - * foldover frequency. - * - * Input Arguments: - * pSrc - pointer to the complex-valued input sequence represented using - * CCS format, of length (2^order) + 2; must be aligned on a 32-byte - * boundary. - * pFFTSpec - pointer to the preallocated and initialized specification - * structure - * scaleFactor - output scalefactor; range is [0,16] - * - * Output Arguments: - * pDst - pointer to the real-valued output sequence, of length 2^order ; must be - * aligned on a 32-byte boundary. - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments if one or more of the following is true: - * - pSrc, pDst, or pFFTSpec is NULL - * - pSrc or pDst is not aligned on a 32-byte boundary - * - scaleFactor<0 or scaleFactor >16 - * - */ -OMXResult omxSP_FFTInv_CCSToR_S32S16_Sfs ( - const OMX_S32 *pSrc, - OMX_S16 *pDst, - const OMXFFTSpec_R_S16S32 *pFFTSpec, - OMX_INT scaleFactor -); - - -/** - * Function: omxSP_FFTInv_CCSToR_S16_Sfs - * - * Description: - * These functions compute the inverse FFT for a conjugate-symmetric input - * sequence. Transform length is determined by the specification structure, - * which must be initialized prior to calling the FFT function using - * <FFTInit_R_S16>. For a transform of length M, the input - * sequence is represented using a packed CCS vector of length - * M+2, and is organized as follows: - * - * Index: 0 1 2 3 4 5 . . . M-2 M-1 M M+1 - * Component R[0] 0 R[1] I[1] R[2] I[2] . . . R[M/2-1] I[M/2-1] R[M/2] 0 - * - * where R[n] and I[n], respectively, denote the real and imaginary components - * for FFT bin n. - * Bins are numbered from 0 to M/2, where M is the FFT length. Bin index 0 - * corresponds to the DC component, and bin index M/2 corresponds to the - * foldover frequency. - * - * Input Arguments: - * pSrc - pointer to the complex-valued input sequence represented using - * CCS format, of length (2^order) + 2; must be aligned on a 32-byte - * boundary. - * pFFTSpec - pointer to the preallocated and initialized specification - * structure - * scaleFactor - output scalefactor; range is [0,16] - * - * Output Arguments: - * pDst - pointer to the real-valued output sequence, of length 2^order ; must - * be aligned on a 32-byte boundary. - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments if one or more of the following is true: - * - pSrc, pDst, or pFFTSpec is NULL - * - pSrc or pDst is not aligned on a 32-byte boundary - * - scaleFactor<0 or scaleFactor >16 - * - */ -OMXResult omxSP_FFTInv_CCSToR_S16_Sfs ( - const OMX_S16* pSrc, - OMX_S16* pDst, - const OMXFFTSpec_R_S16* pFFTSpec, - OMX_INT scaleFactor -); - -/** - * Function: omxSP_FFTInv_CCSToR_S32_Sfs (2.2.4.4.4) - * - * Description: - * These functions compute the inverse FFT for a conjugate-symmetric input - * sequence. Transform length is determined by the specification structure, - * which must be initialized prior to calling the FFT function using - * <FFTInit_R_S32>. For a transform of length M, the input sequence is - * represented using a packed CCS vector of length M+2, and is organized - * as follows: - * - * Index: 0 1 2 3 4 5 . . . M-2 M-1 M M+1 - * Component R[0] 0 R[1] I[1] R[2] I[2] . . . R[M/2-1] I[M/2-1] R[M/2] 0 - * - * where R[n] and I[n], respectively, denote the real and imaginary components for FFT bin n. - * Bins are numbered from 0 to M/2, where M is the FFT length. Bin index 0 - * corresponds to the DC component, and bin index M/2 corresponds to the - * foldover frequency. - * - * Input Arguments: - * pSrc - pointer to the complex-valued input sequence represented using - * CCS format, of length (2^order) + 2; must be aligned on a 32-byte - * boundary. - * pFFTSpec - pointer to the preallocated and initialized specification - * structure - * scaleFactor - output scalefactor; range is [0,32] - * - * Output Arguments: - * pDst - pointer to the real-valued output sequence, of length 2^order ; must be - * aligned on a 32-byte boundary. - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - bad arguments if one or more of the following is true: - * - pSrc, pDst, or pFFTSpec is NULL - * - pSrc or pDst is not aligned on a 32-byte boundary - * - scaleFactor<0 or scaleFactor >32 - * - */ -OMXResult omxSP_FFTInv_CCSToR_S32_Sfs ( - const OMX_S32 *pSrc, - OMX_S32 *pDst, - const OMXFFTSpec_R_S32 *pFFTSpec, - OMX_INT scaleFactor -); - -/** - * Function: omxSP_FFTInv_CToC_FC32_Sfs (2.2.4.2.4) - * - * Description: - * These functions compute an inverse FFT for a complex signal of - * length of 2^order, where 0 <= order <= 15. Transform length is - * determined by the specification structure, which must be - * initialized prior to calling the FFT function using the appropriate - * helper, i.e., <FFTInit_C_FC32>. The relationship between the input - * and output sequences can be expressed in terms of the IDFT, i.e.: - * - * x[n] = SUM[k=0,...,N-1] X[k].e^(jnk.2.pi/N) - * n=0,1,2,...N-1 - * N=2^order. - * - * Input Arguments: - * pSrc - pointer to the complex-valued input signal, of length 2^order ; - * must be aligned on a 32-byte boundary. - * pFFTSpec - pointer to the preallocated and initialized specification - * structure - * - * Output Arguments: - * order - * pDst - pointer to the complex-valued output signal, of length 2^order; - * must be aligned on a 32-byte boundary. - * - * Return Value: - * - * OMX_Sts_NoErr - no error - * OMX_Sts_BadArgErr - returned if one or more of the following conditions - * is true: - * - one or more of the following pointers is NULL: pSrc, pDst, or - * pFFTSpec. - * - pSrc or pDst is not 32-byte aligned - * - scaleFactor<0 or scaleFactor>32 - * - */ -OMXResult omxSP_FFTInv_CToC_FC32_Sfs ( - const OMX_FC32 *pSrc, - OMX_FC32 *pDst, - const OMXFFTSpec_C_FC32 *pFFTSpec -); -#ifdef __arm__ -/* - * Non-NEON version - */ -OMXResult omxSP_FFTInv_CToC_FC32_Sfs_vfp ( - const OMX_FC32 *pSrc, - OMX_FC32 *pDst, - const OMXFFTSpec_C_FC32 *pFFTSpec -); -#endif - -/** - * Function: omxSP_FFTInv_CCSToR_F32_Sfs - * - * Description: - * These functions compute the inverse FFT for a conjugate-symmetric input - * sequence. Transform length is determined by the specification structure, - * which must be initialized prior to calling the FFT function using - * <FFTInit_R_F32>. For a transform of length M, the input sequence is - * represented using a packed CCS vector of length M+2, and is organized - * as follows: - * - * Index: 0 1 2 3 4 5 . . . M-2 M-1 M M+1 - * Comp: R[0] 0 R[1] I[1] R[2] I[2] . . . R[M/2-1] I[M/2-1] R[M/2] 0 - * - * where R[n] and I[n], respectively, denote the real and imaginary - * components for FFT bin n. Bins are numbered from 0 to M/2, where M - * is the FFT length. Bin index 0 corresponds to the DC component, - * and bin index M/2 corresponds to the foldover frequency. - * - * Input Arguments: - * pSrc - pointer to the complex-valued input sequence represented - * using CCS format, of length (2^order) + 2; must be aligned on a - * 32-byte boundary. - * pFFTSpec - pointer to the preallocated and initialized - * specification structure - * - * Output Arguments: - * pDst - pointer to the real-valued output sequence, of length - * 2^order ; must be aligned on a 32-byte boundary. - * - * Return Value: - * - * OMX_Sts_NoErr - no error - - * OMX_Sts_BadArgErr - bad arguments if one or more of the - * following is true: - * - pSrc, pDst, or pFFTSpec is NULL - * - pSrc or pDst is not aligned on a 32-byte boundary - * - scaleFactor<0 or scaleFactor >32 - * - */ -OMXResult omxSP_FFTInv_CCSToR_F32_Sfs( - const OMX_F32* pSrc, - OMX_F32* pDst, - const OMXFFTSpec_R_F32* pFFTSpec -); - -#ifdef __arm__ -/* - * Non-NEON version of omxSP_FFTInv_CCSToR_F32_Sfs - */ -OMXResult omxSP_FFTInv_CCSToR_F32_Sfs_vfp( - const OMX_F32* pSrc, - OMX_F32* pDst, - const OMXFFTSpec_R_F32* pFFTSpec -); - -/* - * Just like omxSP_FFTInv_CCSToR_F32_Sfs, but automatically detects - * whether NEON is available or not and chooses the appropriate - * routine. - */ -extern OMXResult (*omxSP_FFTInv_CCSToR_F32)( - const OMX_F32* pSrc, - OMX_F32* pDst, - const OMXFFTSpec_R_F32* pFFTSpec); -#else -#define omxSP_FFTInv_CCSToR_F32 omxSP_FFTInv_CCSToR_F32_Sfs -#endif - -/* - * Just like omxSP_FFTInv_CCSToR_F32_Sfs, but does not scale the result. - * (Actually, we multiple by two for consistency with other FFT routines in - * use.) - */ -OMXResult omxSP_FFTInv_CCSToR_F32_Sfs_unscaled( - const OMX_F32* pSrc, - OMX_F32* pDst, - const OMXFFTSpec_R_F32* pFFTSpec -); - - -#ifdef __cplusplus -} -#endif - -#endif /** end of #define _OMXSP_H_ */ - -/** EOF */ - diff --git a/media/openmax_dl/dl/sp/src/armSP_FFTInv_CCSToR_F32_preTwiddleRadix2_unsafe_s.S b/media/openmax_dl/dl/sp/src/armSP_FFTInv_CCSToR_F32_preTwiddleRadix2_unsafe_s.S deleted file mode 100644 index e1656118b6..0000000000 --- a/media/openmax_dl/dl/sp/src/armSP_FFTInv_CCSToR_F32_preTwiddleRadix2_unsafe_s.S +++ /dev/null @@ -1,294 +0,0 @@ -@// -@// Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. -@// -@// Use of this source code is governed by a BSD-style license -@// that can be found in the LICENSE file in the root of the source -@// tree. An additional intellectual property rights grant can be found -@// in the file PATENTS. All contributing project authors may -@// be found in the AUTHORS file in the root of the source tree. -@// -@// This is a modification of -@// armSP_FFTInv_CCSToR_S32_preTwiddleRadix2_unsafe_s.s to support float -@// instead of SC32. -@// - -@// -@// Description: -@// Compute the "preTwiddleRadix2" stage prior to the call to the complexFFT -@// It does a Z(k) = Feven(k) + jW^(-k) FOdd(k); k=0,1,2,...N/2-1 computation -@// -@// - - -@// Include standard headers - -#include "dl/api/armCOMM_s.h" -#include "dl/api/omxtypes_s.h" - - -@// Import symbols required from other files -@// (For example tables) - - -@// Set debugging level -@//DEBUG_ON SETL {TRUE} - - - -@// Guarding implementation by the processor name - - - - @// Guarding implementation by the processor name - - - -@//Input Registers - -#define pSrc r0 -#define pDst r1 -#define pFFTSpec r2 -#define scale r3 - - -@// Output registers -#define result r0 - -@//Local Scratch Registers - -#define argTwiddle r1 -#define argDst r2 -#define argScale r4 -#define tmpOrder r4 -#define pTwiddle r4 -#define pOut r5 -#define subFFTSize r7 -#define subFFTNum r6 -#define N r6 -#define order r14 -#define diff r9 -@// Total num of radix stages required to complete the FFT -#define count r8 -#define x0r r4 -#define x0i r5 -#define diffMinusOne r2 -#define round r3 - -#define pOut1 r2 -#define size r7 -#define step r8 -#define step1 r9 -#define twStep r10 -#define pTwiddleTmp r11 -#define argTwiddle1 r12 -#define zero r14 - -@// Neon registers - -#define dX0 D0 -#define dShift D1 -#define dX1 D1 -#define dY0 D2 -#define dY1 D3 -#define dX0r D0 -#define dX0i D1 -#define dX1r D2 -#define dX1i D3 -#define dW0r D4 -#define dW0i D5 -#define dW1r D6 -#define dW1i D7 -#define dT0 D8 -#define dT1 D9 -#define dT2 D10 -#define dT3 D11 -#define qT0 D12 -#define qT1 D14 -#define qT2 D16 -#define qT3 D18 -#define dY0r D4 -#define dY0i D5 -#define dY1r D6 -#define dY1i D7 - -#define dY2 D4 -#define dY3 D5 -#define dW0 D6 -#define dW1 D7 -#define dW0Tmp D10 -#define dW1Neg D11 - -#define half D13 - -@ Structure offsets for the FFTSpec - .set ARMsFFTSpec_N, 0 - .set ARMsFFTSpec_pBitRev, 4 - .set ARMsFFTSpec_pTwiddle, 8 - .set ARMsFFTSpec_pBuf, 12 - - .MACRO FFTSTAGE scaled, inverse, name - - @// Read the size from structure and take log - LDR N, [pFFTSpec, #ARMsFFTSpec_N] - - @// Read other structure parameters - LDR pTwiddle, [pFFTSpec, #ARMsFFTSpec_pTwiddle] - LDR pOut, [pFFTSpec, #ARMsFFTSpec_pBuf] - - VMOV.F32 half, #0.5 - - - MOV size,N,ASR #1 @// preserve the contents of N - MOV step,N,LSL #2 @// step = N/2 * 8 bytes - - - @// Z(k) = 1/2 {[F(k) + F'(N/2-k)] +j*W^(-k) [F(k) - F'(N/2-k)]} - @// Note: W^(k) is stored as negated value and also need to - @// conjugate the values from the table - - @// Z(0) : no need of twiddle multiply - @// Z(0) = 1/2 { [F(0) + F'(N/2)] +j [F(0) - F'(N/2)] } - - VLD1.F32 dX0,[pSrc],step - ADD pOut1,pOut,step @// pOut1 = pOut+ N/2*8 bytes - - VLD1.F32 dX1,[pSrc]! - @// twStep = 3N/8 * 8 bytes pointing to W^1 - SUB twStep,step,size,LSL #1 - - MOV step1,size,LSL #2 @// step1 = N/4 * 8 = N/2*4 bytes - SUB step1,step1,#8 @// (N/4-1)*8 bytes - - VADD.F32 dY0,dX0,dX1 @// [b+d | a+c] - VSUB.F32 dY1,dX0,dX1 @// [b-d | a-c] - VMUL.F32 dY0, dY0, half[0] - VMUL.F32 dY1, dY1, half[0] - - @// dY0= [a-c | a+c] ;dY1= [b-d | b+d] - VZIP.F32 dY0,dY1 - - VSUB.F32 dX0,dY0,dY1 - SUBS size,size,#2 - VADD.F32 dX1,dY0,dY1 - - SUB pSrc,pSrc,step - - VST1.F32 dX0[0],[pOut1]! - ADD pTwiddleTmp,pTwiddle,#8 @// W^2 - VST1.F32 dX1[1],[pOut1]! - ADD argTwiddle1,pTwiddle,twStep @// W^1 - - - BLT decrementScale\name - BEQ lastElement\name - - - @// Z(k) = 1/2[F(k) + F'(N/2-k)] +j*W^(-k) [F(k) - F'(N/2-k)] - @// Note: W^k is stored as negative values in the table and also - @// need to conjugate the values from the table. - @// - @// Process 4 elements at a time. E.g: Z(1),Z(2) and Z(N/2-2),Z(N/2-1) - @// since both of them require F(1),F(2) and F(N/2-2),F(N/2-1) - - - SUB step,step,#24 -evenOddButterflyLoop\name : - - - VLD1.F32 dW0r,[argTwiddle1],step1 - VLD1.F32 dW1r,[argTwiddle1]! - - VLD2.F32 {dX0r,dX0i},[pSrc],step - SUB argTwiddle1,argTwiddle1,step1 - VLD2.F32 {dX1r,dX1i},[pSrc]! - - SUB step1,step1,#8 @// (N/4-2)*8 bytes - VLD1.F32 dW0i,[pTwiddleTmp],step1 - VLD1.F32 dW1i,[pTwiddleTmp]! - SUB pSrc,pSrc,step - - SUB pTwiddleTmp,pTwiddleTmp,step1 - VREV64.F32 dX1r,dX1r - VREV64.F32 dX1i,dX1i - SUBS size,size,#4 - - - VSUB.F32 dT2,dX0r,dX1r @// a-c - VADD.F32 dT3,dX0i,dX1i @// b+d - VADD.F32 dT0,dX0r,dX1r @// a+c - VSUB.F32 dT1,dX0i,dX1i @// b-d - SUB step1,step1,#8 - - VMUL.F32 dT2, dT2, half[0] - VMUL.F32 dT3, dT3, half[0] - - VMUL.F32 dT0, dT0, half[0] - VMUL.F32 dT1, dT1, half[0] - - VZIP.F32 dW1r,dW1i - VZIP.F32 dW0r,dW0i - - - VMUL.F32 dX1r,dW1r,dT2 - VMUL.F32 dX1i,dW1r,dT3 - VMUL.F32 dX0r,dW0r,dT2 - VMUL.F32 dX0i,dW0r,dT3 - - VMLS.F32 dX1r,dW1i,dT3 - VMLA.F32 dX1i,dW1i,dT2 - - VMLA.F32 dX0r,dW0i,dT3 - VMLS.F32 dX0i,dW0i,dT2 - - - VADD.F32 dY1r,dT0,dX1i @// F(N/2 -1) - VSUB.F32 dY1i,dX1r,dT1 - - VREV64.F32 dY1r,dY1r - VREV64.F32 dY1i,dY1i - - - VADD.F32 dY0r,dT0,dX0i @// F(1) - VSUB.F32 dY0i,dT1,dX0r - - - VST2.F32 {dY0r,dY0i},[pOut1],step - VST2.F32 {dY1r,dY1i},[pOut1]! - SUB pOut1,pOut1,step - SUB step,step,#32 @// (N/2-4)*8 bytes - - - BGT evenOddButterflyLoop\name - - - @// set both the ptrs to the last element - SUB pSrc,pSrc,#8 - SUB pOut1,pOut1,#8 - - @// Last element can be expanded as follows - @// 1/2[Z(k) + Z'(k)] - j w^-k [Z(k) - Z'(k)] (since W^k is stored as - @// -ve) - @// 1/2[(a+jb) + (a-jb)] - j w^-k [(a+jb) - (a-jb)] - @// 1/2[2a+j0] - j (c-jd) [0+j2b] - @// (a+bc, -bd) - @// Since (c,d) = (0,1) for the last element, result is just (a,-b) - -lastElement\name : - VLD1.F32 dX0r,[pSrc] - - VST1.F32 dX0r[0],[pOut1]! - VNEG.F32 dX0r,dX0r - VST1.F32 dX0r[1],[pOut1] - - - -decrementScale\name : - - .endm - - M_START armSP_FFTInv_CCSToR_F32_preTwiddleRadix2_unsafe,r4 - - FFTSTAGE "FALSE","TRUE",Inv - M_END - - .end diff --git a/media/openmax_dl/dl/sp/src/armSP_FFT_CToC_FC32_Radix2_fs_unsafe_s.S b/media/openmax_dl/dl/sp/src/armSP_FFT_CToC_FC32_Radix2_fs_unsafe_s.S deleted file mode 100644 index 770848c623..0000000000 --- a/media/openmax_dl/dl/sp/src/armSP_FFT_CToC_FC32_Radix2_fs_unsafe_s.S +++ /dev/null @@ -1,134 +0,0 @@ -@// -@// Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. -@// -@// Use of this source code is governed by a BSD-style license -@// that can be found in the LICENSE file in the root of the source -@// tree. An additional intellectual property rights grant can be found -@// in the file PATENTS. All contributing project authors may -@// be found in the AUTHORS file in the root of the source tree. -@// -@// This is a modification of armSP_FFT_CToC_SC32_Radix2_fs_unsafe_s.S -@// to support float instead of SC32. -@// - -@// -@// Description: -@// Compute the first stage of a Radix 2 DIT in-order out-of-place FFT -@// stage for a N point complex signal. -@// -@// - - -@// Include standard headers - -#include "dl/api/armCOMM_s.h" -#include "dl/api/omxtypes_s.h" - - -@// Import symbols required from other files -@// (For example tables) - - - - -@// Set debugging level -@//DEBUG_ON SETL {TRUE} - - - -@// Guarding implementation by the processor name - - - -@// Guarding implementation by the processor name - - -@//Input Registers - -#define pSrc r0 -#define pDst r2 -#define pTwiddle r1 -#define pPingPongBuf r5 -#define subFFTNum r6 -#define subFFTSize r7 - - -@//Output Registers - - -@//Local Scratch Registers - -#define pointStep r3 -#define outPointStep r3 -#define grpSize r4 -#define setCount r4 -#define step r8 -#define dstStep r8 - -@// Neon Registers - -#define dX0 D0 -#define dX1 D1 -#define dY0 D2 -#define dY1 D3 - - - .MACRO FFTSTAGE scaled, inverse, name - - @// Define stack arguments - - - @// update subFFTSize and subFFTNum into RN6 and RN7 for the next stage - - - MOV subFFTSize,#2 - LSR grpSize,subFFTNum,#1 - MOV subFFTNum,grpSize - - - @// pT0+1 increments pT0 by 8 bytes - @// pT0+pointStep = increment of 8*pointStep bytes = 4*grpSize bytes - @// Note: outPointStep = pointStep for firststage - @// Note: setCount = grpSize/2 (reuse the updated grpSize for setCount) - - MOV pointStep,grpSize,LSL #3 - RSB step,pointStep,#8 - - - @// Loop on the sets for grp zero - -grpZeroSetLoop\name : - - VLD1.F32 dX0,[pSrc],pointStep - VLD1.F32 dX1,[pSrc],step @// step = -pointStep + 8 - SUBS setCount,setCount,#1 - - VADD.F32 dY0,dX0,dX1 - VSUB.F32 dY1,dX0,dX1 - - VST1.F32 dY0,[pDst],outPointStep - @// dstStep = step = -pointStep + 8 - VST1.F32 dY1,[pDst],dstStep - - BGT grpZeroSetLoop\name - - - @// reset pSrc to pDst for the next stage - SUB pSrc,pDst,pointStep @// pDst -= 2*grpSize - MOV pDst,pPingPongBuf - - .endm - - - - M_START armSP_FFTFwd_CToC_FC32_Radix2_fs_OutOfPlace_unsafe,r4 - FFTSTAGE "FALSE","FALSE",fwd - M_END - - - - M_START armSP_FFTInv_CToC_FC32_Radix2_fs_OutOfPlace_unsafe,r4 - FFTSTAGE "FALSE","TRUE",inv - M_END - - .end diff --git a/media/openmax_dl/dl/sp/src/armSP_FFT_CToC_FC32_Radix2_ls_unsafe_s.S b/media/openmax_dl/dl/sp/src/armSP_FFT_CToC_FC32_Radix2_ls_unsafe_s.S deleted file mode 100644 index ac8d982200..0000000000 --- a/media/openmax_dl/dl/sp/src/armSP_FFT_CToC_FC32_Radix2_ls_unsafe_s.S +++ /dev/null @@ -1,153 +0,0 @@ -@// -@// Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. -@// -@// Use of this source code is governed by a BSD-style license -@// that can be found in the LICENSE file in the root of the source -@// tree. An additional intellectual property rights grant can be found -@// in the file PATENTS. All contributing project authors may -@// be found in the AUTHORS file in the root of the source tree. -@// -@// This is a modification of armSP_FFT_CToC_SC32_Radix2_ls_unsafe_s.S -@// to support float instead of SC32. -@// - -@// -@// Description: -@// Compute the last stage of a Radix 2 DIT in-order out-of-place FFT -@// stage for a N point complex signal. -@// -@// - - -@// Include standard headers - -#include "dl/api/armCOMM_s.h" -#include "dl/api/omxtypes_s.h" - - -@// Import symbols required from other files -@// (For example tables) - - - - -@// Set debugging level -@//DEBUG_ON SETL {TRUE} - - -@// Guarding implementation by the processor name - - -@//Input Registers - -#define pSrc r0 -#define pDst r2 -#define pTwiddle r1 -#define subFFTNum r6 -#define subFFTSize r7 - - -@//Output Registers - - -@//Local Scratch Registers - - -#define outPointStep r3 -#define grpCount r4 -#define dstStep r5 -#define pTmp r4 - -@// Neon Registers - -#define dWr d0 -#define dWi d1 -#define dXr0 d2 -#define dXi0 d3 -#define dXr1 d4 -#define dXi1 d5 -#define dYr0 d6 -#define dYi0 d7 -#define dYr1 d8 -#define dYi1 d9 -#define qT0 d10 -#define qT1 d12 - - .MACRO FFTSTAGE scaled, inverse, name - - - MOV outPointStep,subFFTSize,LSL #3 - @// Update grpCount and grpSize rightaway - - MOV subFFTNum,#1 @//after the last stage - LSL grpCount,subFFTSize,#1 - - @// update subFFTSize for the next stage - MOV subFFTSize,grpCount - - RSB dstStep,outPointStep,#16 - - - @// Loop on 2 grps at a time for the last stage - -radix2lsGrpLoop\name : - @ dWr = [pTwiddle[0].Re, pTwiddle[1].Re] - @ dWi = [pTwiddle[0].Im, pTwiddle[1].Im] - VLD2.F32 {dWr,dWi},[pTwiddle, :64]! - - @ dXr0 = [pSrc[0].Re, pSrc[2].Re] - @ dXi0 = [pSrc[0].Im, pSrc[2].Im] - @ dXr1 = [pSrc[1].Re, pSrc[3].Re] - @ dXi1 = [pSrc[1].Im, pSrc[3].Im] - VLD4.F32 {dXr0,dXi0,dXr1,dXi1},[pSrc, :128]! - SUBS grpCount,grpCount,#4 @// grpCount is multiplied by 2 - - .ifeqs "\inverse", "TRUE" - VMUL.F32 qT0,dWr,dXr1 - VMLA.F32 qT0,dWi,dXi1 @// real part - VMUL.F32 qT1,dWr,dXi1 - VMLS.F32 qT1,dWi,dXr1 @// imag part - - .else - - VMUL.F32 qT0,dWr,dXr1 - VMLS.F32 qT0,dWi,dXi1 @// real part - VMUL.F32 qT1,dWr,dXi1 - VMLA.F32 qT1,dWi,dXr1 @// imag part - - .endif - - VSUB.F32 dYr0,dXr0,qT0 - VSUB.F32 dYi0,dXi0,qT1 - VADD.F32 dYr1,dXr0,qT0 - VADD.F32 dYi1,dXi0,qT1 - - VST2.F32 {dYr0,dYi0},[pDst],outPointStep - VST2.F32 {dYr1,dYi1},[pDst],dstStep @// dstStep = step = -outPointStep + 16 - - BGT radix2lsGrpLoop\name - - - @// Reset and Swap pSrc and pDst for the next stage - MOV pTmp,pDst - SUB pDst,pSrc,outPointStep,LSL #1 @// pDst -= 4*size; pSrc -= 8*size bytes - SUB pSrc,pTmp,outPointStep - - @// Reset pTwiddle for the next stage - SUB pTwiddle,pTwiddle,outPointStep @// pTwiddle -= 4*size bytes - - .endm - - - - M_START armSP_FFTFwd_CToC_FC32_Radix2_ls_OutOfPlace_unsafe,r4,"" - FFTSTAGE "FALSE","FALSE",fwd - M_END - - - - M_START armSP_FFTInv_CToC_FC32_Radix2_ls_OutOfPlace_unsafe,r4 - FFTSTAGE "FALSE","TRUE",inv - M_END - - .end diff --git a/media/openmax_dl/dl/sp/src/armSP_FFT_CToC_FC32_Radix2_unsafe_s.S b/media/openmax_dl/dl/sp/src/armSP_FFT_CToC_FC32_Radix2_unsafe_s.S deleted file mode 100644 index f04e9b84ff..0000000000 --- a/media/openmax_dl/dl/sp/src/armSP_FFT_CToC_FC32_Radix2_unsafe_s.S +++ /dev/null @@ -1,191 +0,0 @@ -@// -@// Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. -@// -@// Use of this source code is governed by a BSD-style license -@// that can be found in the LICENSE file in the root of the source -@// tree. An additional intellectual property rights grant can be found -@// in the file PATENTS. All contributing project authors may -@// be found in the AUTHORS file in the root of the source tree. -@// -@// This is a modification of armSP_FFT_CToC_SC32_Radix2_unsafe_s.s -@// to support float instead of SC32. -@// - -@// Description: -@// Compute a Radix 2 DIT in-order out-of-place FFT stage for an N point -@// complex signal. This handles the general stage, not the first or last -@// stage. -@// -@// - - -@// Include standard headers - -#include "dl/api/armCOMM_s.h" -#include "dl/api/omxtypes_s.h" - - -@// Import symbols required from other files -@// (For example tables) - - - -@// Set debugging level -@//DEBUG_ON SETL {TRUE} - - - -@// Guarding implementation by the processor name - - - - -@// Guarding implementation by the processor name - - -@//Input Registers - -#define pSrc r0 -#define pDst r2 -#define pTwiddle r1 -#define subFFTNum r6 -#define subFFTSize r7 - - -@//Output Registers - - -@//Local Scratch Registers - -#define outPointStep r3 -#define pointStep r4 -#define grpCount r5 -#define setCount r8 -@//const RN 9 -#define step r10 -#define dstStep r11 -#define pTable r9 -#define pTmp r9 - -@// Neon Registers - -#define dW D0 -#define dX0 D2 -#define dX1 D3 -#define dX2 D4 -#define dX3 D5 -#define dY0 D6 -#define dY1 D7 -#define dY2 D8 -#define dY3 D9 -#define qT0 D10 -#define qT1 D11 - - - .MACRO FFTSTAGE scaled, inverse, name - - @// Define stack arguments - - - @// Update grpCount and grpSize rightaway inorder to reuse pGrpCount - @// and pGrpSize regs - - LSR subFFTNum,subFFTNum,#1 @//grpSize - LSL grpCount,subFFTSize,#1 - - - @// pT0+1 increments pT0 by 8 bytes - @// pT0+pointStep = increment of 8*pointStep bytes = 4*grpSize bytes - MOV pointStep,subFFTNum,LSL #2 - - @// update subFFTSize for the next stage - MOV subFFTSize,grpCount - - @// pOut0+1 increments pOut0 by 8 bytes - @// pOut0+outPointStep == increment of 8*outPointStep bytes = - @// 4*size bytes - SMULBB outPointStep,grpCount,pointStep - LSL pointStep,pointStep,#1 - - - RSB step,pointStep,#16 - RSB dstStep,outPointStep,#16 - - @// Loop on the groups - -radix2GrpLoop\name : - MOV setCount,pointStep,LSR #3 - VLD1.F32 dW,[pTwiddle],pointStep @//[wi | wr] - - - @// Loop on the sets - - -radix2SetLoop\name : - - - @// point0: dX0-real part dX1-img part - VLD2.F32 {dX0,dX1},[pSrc],pointStep - @// point1: dX2-real part dX3-img part - VLD2.F32 {dX2,dX3},[pSrc],step - - SUBS setCount,setCount,#2 - - .ifeqs "\inverse", "TRUE" - VMUL.F32 qT0,dX2,dW[0] - VMLA.F32 qT0,dX3,dW[1] @// real part - VMUL.F32 qT1,dX3,dW[0] - VMLS.F32 qT1,dX2,dW[1] @// imag part - - .else - - VMUL.F32 qT0,dX2,dW[0] - VMLS.F32 qT0,dX3,dW[1] @// real part - VMUL.F32 qT1,dX3,dW[0] - VMLA.F32 qT1,dX2,dW[1] @// imag part - - .endif - - VSUB.F32 dY0,dX0,qT0 - VSUB.F32 dY1,dX1,qT1 - VADD.F32 dY2,dX0,qT0 - VADD.F32 dY3,dX1,qT1 - - VST2.F32 {dY0,dY1},[pDst],outPointStep - @// dstStep = -outPointStep + 16 - VST2.F32 {dY2,dY3},[pDst],dstStep - - BGT radix2SetLoop\name - - SUBS grpCount,grpCount,#2 - ADD pSrc,pSrc,pointStep - BGT radix2GrpLoop\name - - - @// Reset and Swap pSrc and pDst for the next stage - MOV pTmp,pDst - @// pDst -= 4*size; pSrc -= 8*size bytes - SUB pDst,pSrc,outPointStep,LSL #1 - SUB pSrc,pTmp,outPointStep - - @// Reset pTwiddle for the next stage - @// pTwiddle -= 4*size bytes - SUB pTwiddle,pTwiddle,outPointStep - - - .endm - - - - M_START armSP_FFTFwd_CToC_FC32_Radix2_OutOfPlace_unsafe,r4 - FFTSTAGE "FALSE","FALSE",FWD - M_END - - - - M_START armSP_FFTInv_CToC_FC32_Radix2_OutOfPlace_unsafe,r4 - FFTSTAGE "FALSE","TRUE",INV - M_END - - - .end diff --git a/media/openmax_dl/dl/sp/src/armSP_FFT_CToC_FC32_Radix4_fs_unsafe_s.S b/media/openmax_dl/dl/sp/src/armSP_FFT_CToC_FC32_Radix4_fs_unsafe_s.S deleted file mode 100644 index 6a3c835338..0000000000 --- a/media/openmax_dl/dl/sp/src/armSP_FFT_CToC_FC32_Radix4_fs_unsafe_s.S +++ /dev/null @@ -1,251 +0,0 @@ -@// -@// Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. -@// -@// Use of this source code is governed by a BSD-style license -@// that can be found in the LICENSE file in the root of the source -@// tree. An additional intellectual property rights grant can be found -@// in the file PATENTS. All contributing project authors may -@// be found in the AUTHORS file in the root of the source tree. -@// -@// -@// This is a modification of armSP_FFT_CToC_SC32_Radix4_fs_unsafe_s.s -@// to support float instead of SC32. -@// - -@// -@// Description: -@// Compute a first stage Radix 4 FFT stage for a N point complex signal -@// -@// - - -@// Include standard headers - -#include "dl/api/armCOMM_s.h" -#include "dl/api/omxtypes_s.h" - -@// Import symbols required from other files -@// (For example tables) - - - - -@// Set debugging level -@//DEBUG_ON SETL {TRUE} - - - -@// Guarding implementation by the processor name - - - -@// Guarding implementation by the processor name - - -@//Input Registers - -#define pSrc r0 -#define pDst r2 -#define pTwiddle r1 -#define pPingPongBuf r5 -#define subFFTNum r6 -#define subFFTSize r7 - - -@//Output Registers - - -@//Local Scratch Registers - -#define grpSize r3 -@// Reuse grpSize as setCount -#define setCount r3 -#define pointStep r4 -#define outPointStep r4 -#define setStep r8 -#define step1 r9 -#define step3 r10 - -@// Neon Registers - -#define dXr0 D0 -#define dXi0 D1 -#define dXr1 D2 -#define dXi1 D3 -#define dXr2 D4 -#define dXi2 D5 -#define dXr3 D6 -#define dXi3 D7 -#define dYr0 D8 -#define dYi0 D9 -#define dYr1 D10 -#define dYi1 D11 -#define dYr2 D12 -#define dYi2 D13 -#define dYr3 D14 -#define dYi3 D15 -#define qX0 Q0 -#define qX1 Q1 -#define qX2 Q2 -#define qX3 Q3 -#define qY0 Q4 -#define qY1 Q5 -#define qY2 Q6 -#define qY3 Q7 -#define dZr0 D16 -#define dZi0 D17 -#define dZr1 D18 -#define dZi1 D19 -#define dZr2 D20 -#define dZi2 D21 -#define dZr3 D22 -#define dZi3 D23 -#define qZ0 Q8 -#define qZ1 Q9 -#define qZ2 Q10 -#define qZ3 Q11 - - - .MACRO FFTSTAGE scaled, inverse, name - - @// Define stack arguments - - @// pT0+1 increments pT0 by 8 bytes - @// pT0+pointStep = increment of 8*pointStep bytes = 2*grpSize bytes - @// Note: outPointStep = pointStep for firststage - - MOV pointStep,subFFTNum,LSL #1 - - - @// Update pSubFFTSize and pSubFFTNum regs - VLD2.F32 {dXr0,dXi0},[pSrc, :128],pointStep @// data[0] - @// subFFTSize = 1 for the first stage - MOV subFFTSize,#4 - - @// Note: setCount = subFFTNum/4 (reuse the grpSize reg for setCount) - LSR grpSize,subFFTNum,#2 - VLD2.F32 {dXr1,dXi1},[pSrc, :128],pointStep @// data[1] - MOV subFFTNum,grpSize - - - @// Calculate the step of input data for the next set - @//MOV setStep,pointStep,LSL #1 - MOV setStep,grpSize,LSL #4 - VLD2.F32 {dXr2,dXi2},[pSrc, :128],pointStep @// data[2] - @// setStep = 3*pointStep - ADD setStep,setStep,pointStep - @// setStep = - 3*pointStep+16 - RSB setStep,setStep,#16 - - @// data[3] & update pSrc for the next set - VLD2.F32 {dXr3,dXi3},[pSrc, :128],setStep - @// step1 = 2*pointStep - MOV step1,pointStep,LSL #1 - - VADD.F32 qY0,qX0,qX2 - - @// step3 = -pointStep - RSB step3,pointStep,#0 - - @// grp = 0 a special case since all the twiddle factors are 1 - @// Loop on the sets : 2 sets at a time - -radix4fsGrpZeroSetLoop\name : - - - - @// Decrement setcount - SUBS setCount,setCount,#2 - - - @// finish first stage of 4 point FFT - - - VSUB.F32 qY2,qX0,qX2 - - VLD2.F32 {dXr0,dXi0},[pSrc, :128],step1 @// data[0] - VADD.F32 qY1,qX1,qX3 - VLD2.F32 {dXr2,dXi2},[pSrc, :128],step3 @// data[2] - VSUB.F32 qY3,qX1,qX3 - - - @// finish second stage of 4 point FFT - - .ifeqs "\inverse", "TRUE" - - VLD2.F32 {dXr1,dXi1},[pSrc, :128],step1 @// data[1] - VADD.F32 qZ0,qY0,qY1 - - @// data[3] & update pSrc for the next set, but not if it's the - @// last iteration so that we don't read past the end of the - @// input array. - BEQ radix4SkipLastUpdateInv\name - VLD2.F32 {dXr3,dXi3},[pSrc, :128],setStep -radix4SkipLastUpdateInv\name: - VSUB.F32 dZr3,dYr2,dYi3 - - VST2.F32 {dZr0,dZi0},[pDst, :128],outPointStep - VADD.F32 dZi3,dYi2,dYr3 - - VSUB.F32 qZ1,qY0,qY1 - VST2.F32 {dZr3,dZi3},[pDst, :128],outPointStep - - VADD.F32 dZr2,dYr2,dYi3 - VST2.F32 {dZr1,dZi1},[pDst, :128],outPointStep - VSUB.F32 dZi2,dYi2,dYr3 - - VADD.F32 qY0,qX0,qX2 @// u0 for next iteration - VST2.F32 {dZr2,dZi2},[pDst, :128],setStep - - - .else - - VLD2.F32 {dXr1,dXi1},[pSrc, :128],step1 @// data[1] - VADD.F32 qZ0,qY0,qY1 - - @// data[3] & update pSrc for the next set, but not if it's the - @// last iteration so that we don't read past the end of the - @// input array. - BEQ radix4SkipLastUpdateFwd\name - VLD2.F32 {dXr3,dXi3},[pSrc, :128],setStep -radix4SkipLastUpdateFwd\name: - VADD.F32 dZr2,dYr2,dYi3 - - VST2.F32 {dZr0,dZi0},[pDst, :128],outPointStep - VSUB.F32 dZi2,dYi2,dYr3 - - VSUB.F32 qZ1,qY0,qY1 - VST2.F32 {dZr2,dZi2},[pDst, :128],outPointStep - - VSUB.F32 dZr3,dYr2,dYi3 - VST2.F32 {dZr1,dZi1},[pDst, :128],outPointStep - VADD.F32 dZi3,dYi2,dYr3 - - VADD.F32 qY0,qX0,qX2 @// u0 for next iteration - VST2.F32 {dZr3,dZi3},[pDst, :128],setStep - - .endif - - BGT radix4fsGrpZeroSetLoop\name - - @// reset pSrc to pDst for the next stage - SUB pSrc,pDst,pointStep @// pDst -= 2*grpSize - MOV pDst,pPingPongBuf - - - .endm - - - - M_START armSP_FFTFwd_CToC_FC32_Radix4_fs_OutOfPlace_unsafe,r4 - FFTSTAGE "FALSE","FALSE",fwd - M_END - - - - M_START armSP_FFTInv_CToC_FC32_Radix4_fs_OutOfPlace_unsafe,r4 - FFTSTAGE "FALSE","TRUE",inv - M_END - - - .end diff --git a/media/openmax_dl/dl/sp/src/armSP_FFT_CToC_FC32_Radix4_ls_unsafe_s.S b/media/openmax_dl/dl/sp/src/armSP_FFT_CToC_FC32_Radix4_ls_unsafe_s.S deleted file mode 100644 index c2e798874b..0000000000 --- a/media/openmax_dl/dl/sp/src/armSP_FFT_CToC_FC32_Radix4_ls_unsafe_s.S +++ /dev/null @@ -1,339 +0,0 @@ -@// -@// Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. -@// -@// Use of this source code is governed by a BSD-style license -@// that can be found in the LICENSE file in the root of the source -@// tree. An additional intellectual property rights grant can be found -@// in the file PATENTS. All contributing project authors may -@// be found in the AUTHORS file in the root of the source tree. -@// -@// This is a modification of armSP_FFT_CToC_SC32_Radix4_ls_unsafe_s.s -@// to support float instead of SC32. -@// - -@// -@// Description: -@// Compute a Radix 4 FFT stage for a N point complex signal -@// -@// - - -@// Include standard headers - -#include "dl/api/armCOMM_s.h" -#include "dl/api/omxtypes_s.h" - -@// Import symbols required from other files -@// (For example tables) - - - - -@// Set debugging level -@//DEBUG_ON SETL {TRUE} - - -@// Guarding implementation by the processor name - - -@// Import symbols required from other files -@// (For example tables) - @//IMPORT armAAC_constTable - -@//Input Registers - -#define pSrc r0 -#define pDst r2 -#define pTwiddle r1 -#define subFFTNum r6 -#define subFFTSize r7 - - - -@//Output Registers - - -@//Local Scratch Registers - -#define outPointStep r3 -#define grpCount r4 -#define dstStep r5 -#define grpTwStep r8 -#define stepTwiddle r9 -#define twStep r10 -#define pTmp r4 -#define step16 r11 -#define step24 r12 - - -@// Neon Registers - -#define dButterfly1Real02 D0 -#define dButterfly1Imag02 D1 -#define dButterfly1Real13 D2 -#define dButterfly1Imag13 D3 -#define dButterfly2Real02 D4 -#define dButterfly2Imag02 D5 -#define dButterfly2Real13 D6 -#define dButterfly2Imag13 D7 -#define dXr0 D0 -#define dXi0 D1 -#define dXr1 D2 -#define dXi1 D3 -#define dXr2 D4 -#define dXi2 D5 -#define dXr3 D6 -#define dXi3 D7 - -#define dYr0 D16 -#define dYi0 D17 -#define dYr1 D18 -#define dYi1 D19 -#define dYr2 D20 -#define dYi2 D21 -#define dYr3 D22 -#define dYi3 D23 - -#define dW1r D8 -#define dW1i D9 -#define dW2r D10 -#define dW2i D11 -#define dW3r D12 -#define dW3i D13 -#define qT0 d14 -#define qT1 d16 -#define qT2 d18 -#define qT3 d20 -#define qT4 d22 -#define qT5 d24 - -#define dZr0 D14 -#define dZi0 D15 -#define dZr1 D26 -#define dZi1 D27 -#define dZr2 D28 -#define dZi2 D29 -#define dZr3 D30 -#define dZi3 D31 - -#define qX0 Q0 -#define qY0 Q8 -#define qY1 Q9 -#define qY2 Q10 -#define qY3 Q11 -#define qZ0 Q7 -#define qZ1 Q13 -#define qZ2 Q14 -#define qZ3 Q15 - - - - .MACRO FFTSTAGE scaled, inverse , name - - @// Define stack arguments - - - @// pOut0+1 increments pOut0 by 8 bytes - @// pOut0+outPointStep == increment of 8*outPointStep bytes - MOV outPointStep,subFFTSize,LSL #3 - - @// Update grpCount and grpSize rightaway - - VLD2.F32 {dW1r,dW1i},[pTwiddle, :128] @// [wi|wr] - MOV step16,#16 - LSL grpCount,subFFTSize,#2 - - VLD1.F32 dW2r,[pTwiddle, :64] @// [wi|wr] - MOV subFFTNum,#1 @//after the last stage - - VLD1.F32 dW3r,[pTwiddle, :64],step16 @// [wi|wr] - MOV stepTwiddle,#0 - - VLD1.F32 dW2i,[pTwiddle, :64]! @// [wi|wr] - SUB grpTwStep,stepTwiddle,#8 @// grpTwStep = -8 to start with - - @// update subFFTSize for the next stage - MOV subFFTSize,grpCount - VLD1.F32 dW3i,[pTwiddle, :64],grpTwStep @// [wi|wr] - MOV dstStep,outPointStep,LSL #1 - - @// AC.r AC.i BD.r BD.i - VLD4.F32 {dButterfly1Real02,dButterfly1Imag02,dButterfly1Real13,dButterfly1Imag13},[pSrc, :256]! - ADD dstStep,dstStep,outPointStep @// dstStep = 3*outPointStep - RSB dstStep,dstStep,#16 @// dstStep = - 3*outPointStep+16 - MOV step24,#24 - - @// AC.r AC.i BD.r BD.i - VLD4.F32 {dButterfly2Real02,dButterfly2Imag02,dButterfly2Real13,dButterfly2Imag13},[pSrc, :256]! - - - @// Process two groups at a time - -radix4lsGrpLoop\name : - - VZIP.F32 dW2r,dW2i - ADD stepTwiddle,stepTwiddle,#16 - VZIP.F32 dW3r,dW3i - ADD grpTwStep,stepTwiddle,#4 - VUZP.F32 dButterfly1Real13, dButterfly2Real13 @// B.r D.r - SUB twStep,stepTwiddle,#16 @// -16+stepTwiddle - VUZP.F32 dButterfly1Imag13, dButterfly2Imag13 @// B.i D.i - MOV grpTwStep,grpTwStep,LSL #1 - VUZP.F32 dButterfly1Real02, dButterfly2Real02 @// A.r C.r - RSB grpTwStep,grpTwStep,#0 @// -8-2*stepTwiddle - - - VUZP.F32 dButterfly1Imag02, dButterfly2Imag02 @// A.i C.i - - - @// grpCount is multiplied by 4 - SUBS grpCount,grpCount,#8 - - .ifeqs "\inverse", "TRUE" - VMUL.F32 dZr1,dW1r,dXr1 - VMLA.F32 dZr1,dW1i,dXi1 @// real part - VMUL.F32 dZi1,dW1r,dXi1 - VMLS.F32 dZi1,dW1i,dXr1 @// imag part - - .else - - VMUL.F32 dZr1,dW1r,dXr1 - VMLS.F32 dZr1,dW1i,dXi1 @// real part - VMUL.F32 dZi1,dW1r,dXi1 - VMLA.F32 dZi1,dW1i,dXr1 @// imag part - - .endif - - VLD2.F32 {dW1r,dW1i},[pTwiddle, :128],stepTwiddle @// [wi|wr] - - .ifeqs "\inverse", "TRUE" - VMUL.F32 dZr2,dW2r,dXr2 - VMLA.F32 dZr2,dW2i,dXi2 @// real part - VMUL.F32 dZi2,dW2r,dXi2 - VLD1.F32 dW2r,[pTwiddle, :64],step16 @// [wi|wr] - VMLS.F32 dZi2,dW2i,dXr2 @// imag part - - .else - - VMUL.F32 dZr2,dW2r,dXr2 - VMLS.F32 dZr2,dW2i,dXi2 @// real part - VMUL.F32 dZi2,dW2r,dXi2 - VLD1.F32 dW2r,[pTwiddle, :64],step16 @// [wi|wr] - VMLA.F32 dZi2,dW2i,dXr2 @// imag part - - .endif - - - VLD1.F32 dW2i,[pTwiddle, :64],twStep @// [wi|wr] - - @// move qX0 so as to load for the next iteration - VMOV qZ0,qX0 - - .ifeqs "\inverse", "TRUE" - VMUL.F32 dZr3,dW3r,dXr3 - VMLA.F32 dZr3,dW3i,dXi3 @// real part - VMUL.F32 dZi3,dW3r,dXi3 - VLD1.F32 dW3r,[pTwiddle, :64],step24 - VMLS.F32 dZi3,dW3i,dXr3 @// imag part - - .else - - VMUL.F32 dZr3,dW3r,dXr3 - VMLS.F32 dZr3,dW3i,dXi3 @// real part - VMUL.F32 dZi3,dW3r,dXi3 - VLD1.F32 dW3r,[pTwiddle, :64],step24 - VMLA.F32 dZi3,dW3i,dXr3 @// imag part - - .endif - - VLD1.F32 dW3i,[pTwiddle, :64],grpTwStep @// [wi|wr] - - @// Don't do the load on the last iteration so we don't read past the end - @// of pSrc. - addeq pSrc, pSrc, #64 - beq radix4lsSkipRead\name - @// AC.r AC.i BD.r BD.i - VLD4.F32 {dButterfly1Real02,dButterfly1Imag02,dButterfly1Real13,dButterfly1Imag13},[pSrc, :256]! - - @// AC.r AC.i BD.r BD.i - VLD4.F32 {dButterfly2Real02,dButterfly2Imag02,dButterfly2Real13,dButterfly2Imag13},[pSrc, :256]! -radix4lsSkipRead\name: - - @// finish first stage of 4 point FFT - - VADD.F32 qY0,qZ0,qZ2 - VSUB.F32 qY2,qZ0,qZ2 - VADD.F32 qY1,qZ1,qZ3 - VSUB.F32 qY3,qZ1,qZ3 - - - @// finish second stage of 4 point FFT - - .ifeqs "\inverse", "TRUE" - - VSUB.F32 qZ0,qY2,qY1 - - VADD.F32 dZr3,dYr0,dYi3 - VST2.F32 {dZr0,dZi0},[pDst, :128],outPointStep - VSUB.F32 dZi3,dYi0,dYr3 - - VADD.F32 qZ2,qY2,qY1 - VST2.F32 {dZr3,dZi3},[pDst, :128],outPointStep - - VSUB.F32 dZr1,dYr0,dYi3 - VST2.F32 {dZr2,dZi2},[pDst, :128],outPointStep - VADD.F32 dZi1,dYi0,dYr3 - - @// dstStep = -outPointStep + 16 - VST2.F32 {dZr1,dZi1},[pDst, :128],dstStep - - - .else - - VSUB.F32 qZ0,qY2,qY1 - - VSUB.F32 dZr1,dYr0,dYi3 - VST2.F32 {dZr0,dZi0},[pDst, :128],outPointStep - VADD.F32 dZi1,dYi0,dYr3 - - VADD.F32 qZ2,qY2,qY1 - VST2.F32 {dZr1,dZi1},[pDst, :128],outPointStep - - VADD.F32 dZr3,dYr0,dYi3 - VST2.F32 {dZr2,dZi2},[pDst, :128],outPointStep - VSUB.F32 dZi3,dYi0,dYr3 - - @// dstStep = -outPointStep + 16 - VST2.F32 {dZr3,dZi3},[pDst, :128],dstStep - - - .endif - - BGT radix4lsGrpLoop\name - - - @// Reset and Swap pSrc and pDst for the next stage - MOV pTmp,pDst - @// Extra increment done in final iteration of the loop - SUB pSrc,pSrc,#64 - @// pDst -= 4*size; pSrc -= 8*size bytes - SUB pDst,pSrc,outPointStep,LSL #2 - SUB pSrc,pTmp,outPointStep - SUB pTwiddle,pTwiddle,subFFTSize,LSL #1 - @// Extra increment done in final iteration of the loop - SUB pTwiddle,pTwiddle,#16 - - .endm - - - M_START armSP_FFTFwd_CToC_FC32_Radix4_ls_OutOfPlace_unsafe,r4 - FFTSTAGE "FALSE","FALSE",fwd - M_END - - - M_START armSP_FFTInv_CToC_FC32_Radix4_ls_OutOfPlace_unsafe,r4 - FFTSTAGE "FALSE","TRUE",inv - M_END - - - .end diff --git a/media/openmax_dl/dl/sp/src/armSP_FFT_CToC_FC32_Radix4_unsafe_s.S b/media/openmax_dl/dl/sp/src/armSP_FFT_CToC_FC32_Radix4_unsafe_s.S deleted file mode 100644 index dc71eff63c..0000000000 --- a/media/openmax_dl/dl/sp/src/armSP_FFT_CToC_FC32_Radix4_unsafe_s.S +++ /dev/null @@ -1,331 +0,0 @@ -@// -@// Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. -@// -@// Use of this source code is governed by a BSD-style license -@// that can be found in the LICENSE file in the root of the source -@// tree. An additional intellectual property rights grant can be found -@// in the file PATENTS. All contributing project authors may -@// be found in the AUTHORS file in the root of the source tree. -@// -@// -@// This is a modification of armSP_FFT_CToC_SC32_Radix4_unsafe_s.s -@// to support float instead of SC32. -@// - -@// -@// Description: -@// Compute a Radix 4 FFT stage for a N point complex signal -@// -@// - - -@// Include standard headers - -#include "dl/api/armCOMM_s.h" -#include "dl/api/omxtypes_s.h" - - -@// Import symbols required from other files -@// (For example tables) - - - - -@// Set debugging level -@//DEBUG_ON SETL {TRUE} - - - -@// Guarding implementation by the processor name - - - - -@// Guarding implementation by the processor name - - -@// Import symbols required from other files -@// (For example tables) - - -@//Input Registers - -#define pSrc r0 -#define pDst r2 -#define pTwiddle r1 -#define subFFTNum r6 -#define subFFTSize r7 - - - -@//Output Registers - - -@//Local Scratch Registers - -#define grpCount r3 -#define pointStep r4 -#define outPointStep r5 -#define stepTwiddle r12 -#define setCount r14 -#define srcStep r8 -#define setStep r9 -#define dstStep r10 -#define twStep r11 -#define t1 r3 - -@// Neon Registers - -#define dW1 D0 -#define dW2 D1 -#define dW3 D2 - -#define dXr0 D4 -#define dXi0 D5 -#define dXr1 D6 -#define dXi1 D7 -#define dXr2 D8 -#define dXi2 D9 -#define dXr3 D10 -#define dXi3 D11 -#define dYr0 D12 -#define dYi0 D13 -#define dYr1 D14 -#define dYi1 D15 -#define dYr2 D16 -#define dYi2 D17 -#define dYr3 D18 -#define dYi3 D19 -#define qT0 d16 -#define qT1 d18 -#define qT2 d12 -#define qT3 d14 -#define dZr0 D20 -#define dZi0 D21 -#define dZr1 D22 -#define dZi1 D23 -#define dZr2 D24 -#define dZi2 D25 -#define dZr3 D26 -#define dZi3 D27 - -#define qY0 Q6 -#define qY1 Q7 -#define qY2 Q8 -#define qY3 Q9 -#define qX0 Q2 -#define qZ0 Q10 -#define qZ1 Q11 -#define qZ2 Q12 -#define qZ3 Q13 - - .MACRO FFTSTAGE scaled, inverse , name - - @// Define stack arguments - - - @// Update grpCount and grpSize rightaway inorder to reuse - @// pGrpCount and pGrpSize regs - - LSL grpCount,subFFTSize,#2 - LSR subFFTNum,subFFTNum,#2 - MOV subFFTSize,grpCount - - VLD1.F32 dW1,[pTwiddle] @//[wi | wr] - @// pT0+1 increments pT0 by 8 bytes - @// pT0+pointStep = increment of 8*pointStep bytes = 2*grpSize bytes - MOV pointStep,subFFTNum,LSL #1 - - - @// pOut0+1 increments pOut0 by 8 bytes - @// pOut0+outPointStep == increment of 8*outPointStep bytes - @// = 2*size bytes - - MOV stepTwiddle,#0 - VLD1.F32 dW2,[pTwiddle] @//[wi | wr] - SMULBB outPointStep,grpCount,pointStep - LSL pointStep,pointStep,#2 @// 2*grpSize - - VLD1.F32 dW3,[pTwiddle] @//[wi | wr] - MOV srcStep,pointStep,LSL #1 @// srcStep = 2*pointStep - ADD setStep,srcStep,pointStep @// setStep = 3*pointStep - - RSB setStep,setStep,#0 @// setStep = - 3*pointStep - SUB srcStep,srcStep,#16 @// srcStep = 2*pointStep-16 - - MOV dstStep,outPointStep,LSL #1 - ADD dstStep,dstStep,outPointStep @// dstStep = 3*outPointStep - @// dstStep = - 3*outPointStep+16 - RSB dstStep,dstStep,#16 - - - -radix4GrpLoop\name : - - VLD2.F32 {dXr0,dXi0},[pSrc],pointStep @// data[0] - ADD stepTwiddle,stepTwiddle,pointStep - VLD2.F32 {dXr1,dXi1},[pSrc],pointStep @// data[1] - @// set pTwiddle to the first point - ADD pTwiddle,pTwiddle,stepTwiddle - VLD2.F32 {dXr2,dXi2},[pSrc],pointStep @// data[2] - MOV twStep,stepTwiddle,LSL #2 - - @// data[3] & update pSrc for the next set - VLD2.F32 {dXr3,dXi3},[pSrc],setStep - SUB twStep,stepTwiddle,twStep @// twStep = -3*stepTwiddle - - MOV setCount,pointStep,LSR #3 - @// set pSrc to data[0] of the next set - ADD pSrc,pSrc,#16 - @// increment to data[1] of the next set - ADD pSrc,pSrc,pointStep - - - @// Loop on the sets - -radix4SetLoop\name : - - - - .ifeqs "\inverse", "TRUE" - VMUL.F32 dZr1,dXr1,dW1[0] - VMUL.F32 dZi1,dXi1,dW1[0] - VMUL.F32 dZr2,dXr2,dW2[0] - VMUL.F32 dZi2,dXi2,dW2[0] - VMUL.F32 dZr3,dXr3,dW3[0] - VMUL.F32 dZi3,dXi3,dW3[0] - - VMLA.F32 dZr1,dXi1,dW1[1] @// real part - VMLS.F32 dZi1,dXr1,dW1[1] @// imag part - - @// data[1] for next iteration - VLD2.F32 {dXr1,dXi1},[pSrc],pointStep - - VMLA.F32 dZr2,dXi2,dW2[1] @// real part - VMLS.F32 dZi2,dXr2,dW2[1] @// imag part - - @// data[2] for next iteration - VLD2.F32 {dXr2,dXi2},[pSrc],pointStep - - VMLA.F32 dZr3,dXi3,dW3[1] @// real part - VMLS.F32 dZi3,dXr3,dW3[1] @// imag part - .else - VMUL.F32 dZr1,dXr1,dW1[0] - VMUL.F32 dZi1,dXi1,dW1[0] - VMUL.F32 dZr2,dXr2,dW2[0] - VMUL.F32 dZi2,dXi2,dW2[0] - VMUL.F32 dZr3,dXr3,dW3[0] - VMUL.F32 dZi3,dXi3,dW3[0] - - VMLS.F32 dZr1,dXi1,dW1[1] @// real part - VMLA.F32 dZi1,dXr1,dW1[1] @// imag part - - @// data[1] for next iteration - VLD2.F32 {dXr1,dXi1},[pSrc],pointStep - - VMLS.F32 dZr2,dXi2,dW2[1] @// real part - VMLA.F32 dZi2,dXr2,dW2[1] @// imag part - - @// data[2] for next iteration - VLD2.F32 {dXr2,dXi2},[pSrc],pointStep - - VMLS.F32 dZr3,dXi3,dW3[1] @// real part - VMLA.F32 dZi3,dXr3,dW3[1] @// imag part - .endif - - @// data[3] & update pSrc to data[0] - @// But don't read on the very last iteration because that reads past - @// the end of pSrc. The last iteration is grpCount = 4, setCount = 2. - cmp grpCount, #4 - cmpeq setCount, #2 @// Test setCount if grpCount = 4 - @// These are executed only if both grpCount = 4 and setCount = 2 - addeq pSrc, pSrc, setStep - beq radix4SkipRead\name - VLD2.F32 {dXr3,dXi3},[pSrc],setStep -radix4SkipRead\name: - SUBS setCount,setCount,#2 - - @// finish first stage of 4 point FFT - VADD.F32 qY0,qX0,qZ2 - VSUB.F32 qY2,qX0,qZ2 - - @// data[0] for next iteration - VLD2.F32 {dXr0,dXi0},[pSrc, :128]! - VADD.F32 qY1,qZ1,qZ3 - VSUB.F32 qY3,qZ1,qZ3 - - @// finish second stage of 4 point FFT - - VSUB.F32 qZ0,qY2,qY1 - - - .ifeqs "\inverse", "TRUE" - - VADD.F32 dZr3,dYr0,dYi3 - VST2.F32 {dZr0,dZi0},[pDst, :128],outPointStep - VSUB.F32 dZi3,dYi0,dYr3 - - VADD.F32 qZ2,qY2,qY1 - VST2.F32 {dZr3,dZi3},[pDst, :128],outPointStep - - VSUB.F32 dZr1,dYr0,dYi3 - VST2.F32 {dZr2,dZi2},[pDst, :128],outPointStep - VADD.F32 dZi1,dYi0,dYr3 - - VST2.F32 {dZr1,dZi1},[pDst, :128],dstStep - - - .else - - VSUB.F32 dZr1,dYr0,dYi3 - VST2.F32 {dZr0,dZi0},[pDst, :128],outPointStep - VADD.F32 dZi1,dYi0,dYr3 - - VADD.F32 qZ2,qY2,qY1 - VST2.F32 {dZr1,dZi1},[pDst, :128],outPointStep - - VADD.F32 dZr3,dYr0,dYi3 - VST2.F32 {dZr2,dZi2},[pDst, :128],outPointStep - VSUB.F32 dZi3,dYi0,dYr3 - - VST2.F32 {dZr3,dZi3},[pDst, :128],dstStep - - - .endif - - @// increment to data[1] of the next set - ADD pSrc,pSrc,pointStep - BGT radix4SetLoop\name - - - VLD1.F32 dW1,[pTwiddle, :64],stepTwiddle @//[wi | wr] - @// subtract 4 since grpCount multiplied by 4 - SUBS grpCount,grpCount,#4 - VLD1.F32 dW2,[pTwiddle, :64],stepTwiddle @//[wi | wr] - @// increment pSrc for the next grp - ADD pSrc,pSrc,srcStep - VLD1.F32 dW3,[pTwiddle, :64],twStep @//[wi | wr] - BGT radix4GrpLoop\name - - - @// Reset and Swap pSrc and pDst for the next stage - MOV t1,pDst - @// pDst -= 2*size; pSrc -= 8*size bytes - SUB pDst,pSrc,outPointStep,LSL #2 - SUB pSrc,t1,outPointStep - - - .endm - - - M_START armSP_FFTFwd_CToC_FC32_Radix4_OutOfPlace_unsafe,r4 - FFTSTAGE "FALSE","FALSE",FWD - M_END - - - M_START armSP_FFTInv_CToC_FC32_Radix4_OutOfPlace_unsafe,r4 - FFTSTAGE "FALSE","TRUE",INV - M_END - - - .end diff --git a/media/openmax_dl/dl/sp/src/armSP_FFT_CToC_FC32_Radix8_fs_unsafe_s.S b/media/openmax_dl/dl/sp/src/armSP_FFT_CToC_FC32_Radix8_fs_unsafe_s.S deleted file mode 100644 index 569818c5c3..0000000000 --- a/media/openmax_dl/dl/sp/src/armSP_FFT_CToC_FC32_Radix8_fs_unsafe_s.S +++ /dev/null @@ -1,422 +0,0 @@ -@// -@// Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. -@// -@// Use of this source code is governed by a BSD-style license -@// that can be found in the LICENSE file in the root of the source -@// tree. An additional intellectual property rights grant can be found -@// in the file PATENTS. All contributing project authors may -@// be found in the AUTHORS file in the root of the source tree. -@// -@// This is a modification of armSP_FFT_CToC_FC32_Radix8_fs_unsafe_s.s -@// to support float instead of SC32. -@// - -@// -@// Description: -@// Compute a first stage Radix 8 FFT stage for a N point complex signal -@// -@// - - -@// Include standard headers - -#include "dl/api/armCOMM_s.h" -#include "dl/api/omxtypes_s.h" - -@// Import symbols required from other files -@// (For example tables) - - -@// Set debugging level -@//DEBUG_ON SETL {TRUE} - - - -@// Guarding implementation by the processor name - - - - -@// Guarding implementation by the processor name - -@//Input Registers - -#define pSrc r0 -#define pDst r2 -#define pTwiddle r1 -#define subFFTNum r6 -#define subFFTSize r7 -@// dest buffer for the next stage (not pSrc for first stage) -#define pPingPongBuf r5 - - -@//Output Registers - - -@//Local Scratch Registers - -#define grpSize r3 -@// Reuse grpSize as setCount -#define setCount r3 -#define pointStep r4 -#define outPointStep r4 -#define setStep r8 -#define step1 r9 -#define step2 r10 -#define t0 r11 - - -@// Neon Registers - -#define dXr0 D0 -#define dXi0 D1 -#define dXr1 D2 -#define dXi1 D3 -#define dXr2 D4 -#define dXi2 D5 -#define dXr3 D6 -#define dXi3 D7 -#define dXr4 D8 -#define dXi4 D9 -#define dXr5 D10 -#define dXi5 D11 -#define dXr6 D12 -#define dXi6 D13 -#define dXr7 D14 -#define dXi7 D15 -#define qX0 Q0 -#define qX1 Q1 -#define qX2 Q2 -#define qX3 Q3 -#define qX4 Q4 -#define qX5 Q5 -#define qX6 Q6 -#define qX7 Q7 - -#define dUr0 D16 -#define dUi0 D17 -#define dUr2 D18 -#define dUi2 D19 -#define dUr4 D20 -#define dUi4 D21 -#define dUr6 D22 -#define dUi6 D23 -#define dUr1 D24 -#define dUi1 D25 -#define dUr3 D26 -#define dUi3 D27 -#define dUr5 D28 -#define dUi5 D29 -@// reuse dXr7 and dXi7 -#define dUr7 D30 -#define dUi7 D31 -#define qU0 Q8 -#define qU1 Q12 -#define qU2 Q9 -#define qU3 Q13 -#define qU4 Q10 -#define qU5 Q14 -#define qU6 Q11 -#define qU7 Q15 - - -#define dVr0 D24 -#define dVi0 D25 -#define dVr2 D26 -#define dVi2 D27 -#define dVr4 D28 -#define dVi4 D29 -#define dVr6 D30 -#define dVi6 D31 -#define dVr1 D16 -#define dVi1 D17 -#define dVr3 D18 -#define dVi3 D19 -#define dVr5 D20 -#define dVi5 D21 -#define dVr7 D22 -#define dVi7 D23 -#define qV0 Q12 -#define qV1 Q8 -#define qV2 Q13 -#define qV3 Q9 -#define qV4 Q14 -#define qV5 Q10 -#define qV6 Q15 -#define qV7 Q11 - -#define dYr0 D16 -#define dYi0 D17 -#define dYr2 D18 -#define dYi2 D19 -#define dYr4 D20 -#define dYi4 D21 -#define dYr6 D22 -#define dYi6 D23 -#define dYr1 D24 -#define dYi1 D25 -#define dYr3 D26 -#define dYi3 D27 -#define dYr5 D28 -#define dYi5 D29 -#define dYr7 D30 -#define dYi7 D31 -#define qY0 Q8 -#define qY1 Q12 -#define qY2 Q9 -#define qY3 Q13 -#define qY4 Q10 -#define qY5 Q14 -#define qY6 Q11 -#define qY7 Q15 - -#define dT0 D14 -#define dT1 D15 - - - .MACRO FFTSTAGE scaled, inverse, name - - @// Define stack arguments - - @// Update pSubFFTSize and pSubFFTNum regs - @// subFFTSize = 1 for the first stage - MOV subFFTSize,#8 - ADR t0,ONEBYSQRT2\name - - @// Note: setCount = subFFTNum/8 (reuse the grpSize reg for setCount) - LSR grpSize,subFFTNum,#3 - MOV subFFTNum,grpSize - - - @// pT0+1 increments pT0 by 8 bytes - @// pT0+pointStep = increment of 8*pointStep bytes = grpSize bytes - @// Note: outPointStep = pointStep for firststage - - MOV pointStep,grpSize,LSL #3 - - - @// Calculate the step of input data for the next set - @//MOV step1,pointStep,LSL #1 @// step1 = 2*pointStep - VLD2.F32 {dXr0,dXi0},[pSrc, :128],pointStep @// data[0] - MOV step1,grpSize,LSL #4 - - MOV step2,pointStep,LSL #3 - VLD2.F32 {dXr1,dXi1},[pSrc, :128],pointStep @// data[1] - SUB step2,step2,pointStep @// step2 = 7*pointStep - @// setStep = - 7*pointStep+16 - RSB setStep,step2,#16 - - VLD2.F32 {dXr2,dXi2},[pSrc, :128],pointStep @// data[2] - VLD2.F32 {dXr3,dXi3},[pSrc, :128],pointStep @// data[3] - VLD2.F32 {dXr4,dXi4},[pSrc, :128],pointStep @// data[4] - VLD2.F32 {dXr5,dXi5},[pSrc, :128],pointStep @// data[5] - VLD2.F32 {dXr6,dXi6},[pSrc, :128],pointStep @// data[6] - @// data[7] & update pSrc for the next set - @// setStep = -7*pointStep + 16 - VLD2.F32 {dXr7,dXi7},[pSrc, :128],setStep - @// grp = 0 a special case since all the twiddle factors are 1 - @// Loop on the sets - -radix8fsGrpZeroSetLoop\name : - - @// Decrement setcount - SUBS setCount,setCount,#2 - - - @// finish first stage of 8 point FFT - - VADD.F32 qU0,qX0,qX4 - VADD.F32 qU2,qX1,qX5 - VADD.F32 qU4,qX2,qX6 - VADD.F32 qU6,qX3,qX7 - - @// finish second stage of 8 point FFT - - VADD.F32 qV0,qU0,qU4 - VSUB.F32 qV2,qU0,qU4 - VADD.F32 qV4,qU2,qU6 - VSUB.F32 qV6,qU2,qU6 - - @// finish third stage of 8 point FFT - - VADD.F32 qY0,qV0,qV4 - VSUB.F32 qY4,qV0,qV4 - VST2.F32 {dYr0,dYi0},[pDst, :128],step1 @// store y0 - - .ifeqs "\inverse", "TRUE" - - VSUB.F32 dYr2,dVr2,dVi6 - VADD.F32 dYi2,dVi2,dVr6 - - VADD.F32 dYr6,dVr2,dVi6 - VST2.F32 {dYr2,dYi2},[pDst, :128],step1 @// store y2 - VSUB.F32 dYi6,dVi2,dVr6 - - VSUB.F32 qU1,qX0,qX4 - VST2.F32 {dYr4,dYi4},[pDst, :128],step1 @// store y4 - - VSUB.F32 qU3,qX1,qX5 - VSUB.F32 qU5,qX2,qX6 - VST2.F32 {dYr6,dYi6},[pDst, :128],step1 @// store y6 - - .ELSE - - VADD.F32 dYr6,dVr2,dVi6 - VSUB.F32 dYi6,dVi2,dVr6 - - VSUB.F32 dYr2,dVr2,dVi6 - VST2.F32 {dYr6,dYi6},[pDst, :128],step1 @// store y2 - VADD.F32 dYi2,dVi2,dVr6 - - - VSUB.F32 qU1,qX0,qX4 - VST2.F32 {dYr4,dYi4},[pDst, :128],step1 @// store y4 - VSUB.F32 qU3,qX1,qX5 - VSUB.F32 qU5,qX2,qX6 - VST2.F32 {dYr2,dYi2},[pDst, :128],step1 @// store y6 - - - .ENDIF - - @// finish first stage of 8 point FFT - - VSUB.F32 qU7,qX3,qX7 - VLD1.F32 dT0[0], [t0] - - @// finish second stage of 8 point FFT - - VSUB.F32 dVr1,dUr1,dUi5 - @// data[0] for next iteration - VLD2.F32 {dXr0,dXi0},[pSrc, :128],pointStep - VADD.F32 dVi1,dUi1,dUr5 - VADD.F32 dVr3,dUr1,dUi5 - VLD2.F32 {dXr1,dXi1},[pSrc, :128],pointStep @// data[1] - VSUB.F32 dVi3,dUi1,dUr5 - - VSUB.F32 dVr5,dUr3,dUi7 - VLD2.F32 {dXr2,dXi2},[pSrc, :128],pointStep @// data[2] - VADD.F32 dVi5,dUi3,dUr7 - VADD.F32 dVr7,dUr3,dUi7 - VLD2.F32 {dXr3,dXi3},[pSrc, :128],pointStep @// data[3] - VSUB.F32 dVi7,dUi3,dUr7 - - @// finish third stage of 8 point FFT - - .ifeqs "\inverse", "TRUE" - - @// calculate a*v5 - VMUL.F32 dT1,dVr5,dT0[0] @// use dVi0 for dT1 - - VLD2.F32 {dXr4,dXi4},[pSrc, :128],pointStep @// data[4] - VMUL.F32 dVi5,dVi5,dT0[0] - - VLD2.F32 {dXr5,dXi5},[pSrc, :128],pointStep @// data[5] - VSUB.F32 dVr5,dT1,dVi5 @// a * V5 - VADD.F32 dVi5,dT1,dVi5 - - VLD2.F32 {dXr6,dXi6},[pSrc, :128],pointStep @// data[6] - - @// calculate b*v7 - VMUL.F32 dT1,dVr7,dT0[0] - VMUL.F32 dVi7,dVi7,dT0[0] - - VADD.F32 qY1,qV1,qV5 - VSUB.F32 qY5,qV1,qV5 - - - VADD.F32 dVr7,dT1,dVi7 @// b * V7 - VSUB.F32 dVi7,dVi7,dT1 - SUB pDst, pDst, step2 @// set pDst to y1 - - @// On the last iteration, this will read past the end of pSrc, - @// so skip this read. - BEQ radix8SkipLastUpdateInv\name - VLD2.F32 {dXr7,dXi7},[pSrc, :128],setStep @// data[7] -radix8SkipLastUpdateInv\name: - - VSUB.F32 dYr3,dVr3,dVr7 - VSUB.F32 dYi3,dVi3,dVi7 - VST2.F32 {dYr1,dYi1},[pDst, :128],step1 @// store y1 - VADD.F32 dYr7,dVr3,dVr7 - VADD.F32 dYi7,dVi3,dVi7 - - - VST2.F32 {dYr3,dYi3},[pDst, :128],step1 @// store y3 - VST2.F32 {dYr5,dYi5},[pDst, :128],step1 @// store y5 - VST2.F32 {dYr7,dYi7},[pDst, :128] @// store y7 - ADD pDst, pDst, #16 - - .ELSE - - @// calculate b*v7 - VMUL.F32 dT1,dVr7,dT0[0] - VLD2.F32 {dXr4,dXi4},[pSrc, :128],pointStep @// data[4] - VMUL.F32 dVi7,dVi7,dT0[0] - - VLD2.F32 {dXr5,dXi5},[pSrc, :128],pointStep @// data[5] - VADD.F32 dVr7,dT1,dVi7 @// b * V7 - VSUB.F32 dVi7,dVi7,dT1 - - VLD2.F32 {dXr6,dXi6},[pSrc, :128],pointStep @// data[6] - - @// calculate a*v5 - VMUL.F32 dT1,dVr5,dT0[0] @// use dVi0 for dT1 - VMUL.F32 dVi5,dVi5,dT0[0] - - VADD.F32 dYr7,dVr3,dVr7 - VADD.F32 dYi7,dVi3,dVi7 - SUB pDst, pDst, step2 @// set pDst to y1 - - VSUB.F32 dVr5,dT1,dVi5 @// a * V5 - VADD.F32 dVi5,dT1,dVi5 - - @// On the last iteration, this will read past the end of pSrc, - @// so skip this read. - BEQ radix8SkipLastUpdateFwd\name - VLD2.F32 {dXr7,dXi7},[pSrc, :128],setStep @// data[7] -radix8SkipLastUpdateFwd\name: - - VSUB.F32 qY5,qV1,qV5 - - VSUB.F32 dYr3,dVr3,dVr7 - VST2.F32 {dYr7,dYi7},[pDst, :128],step1 @// store y1 - VSUB.F32 dYi3,dVi3,dVi7 - VADD.F32 qY1,qV1,qV5 - - - VST2.F32 {dYr5,dYi5},[pDst, :128],step1 @// store y3 - VST2.F32 {dYr3,dYi3},[pDst, :128],step1 @// store y5 - VST2.F32 {dYr1,dYi1},[pDst, :128]! @// store y7 - - .ENDIF - - - @// update pDst for the next set - SUB pDst, pDst, step2 - BGT radix8fsGrpZeroSetLoop\name - - - @// reset pSrc to pDst for the next stage - SUB pSrc,pDst,pointStep @// pDst -= 2*grpSize - MOV pDst,pPingPongBuf - - - - .endm - - - @// Allocate stack memory required by the function - - - M_START armSP_FFTFwd_CToC_FC32_Radix8_fs_OutOfPlace_unsafe,r4 - FFTSTAGE "FALSE","FALSE",FWD - M_END -ONEBYSQRT2FWD: .float 0.7071067811865476e0 - - M_START armSP_FFTInv_CToC_FC32_Radix8_fs_OutOfPlace_unsafe,r4 - FFTSTAGE "FALSE","TRUE",INV - M_END -ONEBYSQRT2INV: .float 0.7071067811865476e0 - - - .end diff --git a/media/openmax_dl/dl/sp/src/armSP_FFT_F32TwiddleTable.c b/media/openmax_dl/dl/sp/src/armSP_FFT_F32TwiddleTable.c deleted file mode 100644 index 87d98614fa..0000000000 --- a/media/openmax_dl/dl/sp/src/armSP_FFT_F32TwiddleTable.c +++ /dev/null @@ -1,4643 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - * - */ - -/* - * Description: - * Twiddle table for Forward FFT in float format. - * It contains complex pairs [-cos (W * i), -sin (W * i)] where W = -2*PI/N - * and 0<= i<= N/8. N is the max size of the FFT. Here N = 2^12 - * Values for N/8 < i < N are generated in the FFTInit function using the - * symmetries of cos and sine. - * - * We use the negative to be consistent with the S32 version. -**/ - -#include "dl/api/omxtypes.h" - -#define TWIDDLE_TABLE_ENTRIES ((1 << TWIDDLE_TABLE_ORDER) / 8) - -const OMX_F32 armSP_FFT_F32TwiddleTable[2 * TWIDDLE_TABLE_ENTRIES + 2] = { -#if TWIDDLE_TABLE_ORDER == 15 - -1.000000000000000e+00, 0.000000000000000e+00, - -9.999999816164293e-01, 1.917475973107033e-04, - -9.999999264657179e-01, 3.834951875713956e-04, - -9.999998345478677e-01, 5.752427637320661e-04, - -9.999997058628822e-01, 7.669903187427045e-04, - -9.999995404107661e-01, 9.587378455533014e-04, - -9.999993381915255e-01, 1.150485337113848e-03, - -9.999990992051678e-01, 1.342232786374338e-03, - -9.999988234517019e-01, 1.533980186284766e-03, - -9.999985109311378e-01, 1.725727529795126e-03, - -9.999981616434870e-01, 1.917474809855419e-03, - -9.999977755887623e-01, 2.109222019415644e-03, - -9.999973527669782e-01, 2.300969151425805e-03, - -9.999968931781499e-01, 2.492716198835908e-03, - -9.999963968222944e-01, 2.684463154595962e-03, - -9.999958636994299e-01, 2.876210011655979e-03, - -9.999952938095762e-01, 3.067956762965976e-03, - -9.999946871527541e-01, 3.259703401475973e-03, - -9.999940437289858e-01, 3.451449920135994e-03, - -9.999933635382952e-01, 3.643196311896068e-03, - -9.999926465807072e-01, 3.834942569706228e-03, - -9.999918928562480e-01, 4.026688686516512e-03, - -9.999911023649456e-01, 4.218434655276963e-03, - -9.999902751068289e-01, 4.410180468937631e-03, - -9.999894110819284e-01, 4.601926120448570e-03, - -9.999885102902757e-01, 4.793671602759841e-03, - -9.999875727319041e-01, 4.985416908821511e-03, - -9.999865984068480e-01, 5.177162031583651e-03, - -9.999855873151432e-01, 5.368906963996342e-03, - -9.999845394568270e-01, 5.560651699009674e-03, - -9.999834548319377e-01, 5.752396229573736e-03, - -9.999823334405153e-01, 5.944140548638633e-03, - -9.999811752826011e-01, 6.135884649154475e-03, - -9.999799803582377e-01, 6.327628524071378e-03, - -9.999787486674688e-01, 6.519372166339468e-03, - -9.999774802103399e-01, 6.711115568908879e-03, - -9.999761749868976e-01, 6.902858724729756e-03, - -9.999748329971898e-01, 7.094601626752250e-03, - -9.999734542412659e-01, 7.286344267926521e-03, - -9.999720387191767e-01, 7.478086641202744e-03, - -9.999705864309741e-01, 7.669828739531097e-03, - -9.999690973767116e-01, 7.861570555861772e-03, - -9.999675715564438e-01, 8.053312083144972e-03, - -9.999660089702269e-01, 8.245053314330906e-03, - -9.999644096181183e-01, 8.436794242369799e-03, - -9.999627735001769e-01, 8.628534860211886e-03, - -9.999611006164628e-01, 8.820275160807411e-03, - -9.999593909670375e-01, 9.012015137106633e-03, - -9.999576445519639e-01, 9.203754782059820e-03, - -9.999558613713061e-01, 9.395494088617251e-03, - -9.999540414251298e-01, 9.587233049729225e-03, - -9.999521847135018e-01, 9.778971658346043e-03, - -9.999502912364905e-01, 9.970709907418030e-03, - -9.999483609941654e-01, 1.016244778989551e-02, - -9.999463939865975e-01, 1.035418529872884e-02, - -9.999443902138591e-01, 1.054592242686838e-02, - -9.999423496760239e-01, 1.073765916726449e-02, - -9.999402723731670e-01, 1.092939551286757e-02, - -9.999381583053646e-01, 1.112113145662802e-02, - -9.999360074726946e-01, 1.131286699149626e-02, - -9.999338198752360e-01, 1.150460211042271e-02, - -9.999315955130692e-01, 1.169633680635784e-02, - -9.999293343862761e-01, 1.188807107225209e-02, - -9.999270364949396e-01, 1.207980490105596e-02, - -9.999247018391445e-01, 1.227153828571993e-02, - -9.999223304189765e-01, 1.246327121919451e-02, - -9.999199222345228e-01, 1.265500369443024e-02, - -9.999174772858718e-01, 1.284673570437766e-02, - -9.999149955731135e-01, 1.303846724198733e-02, - -9.999124770963392e-01, 1.323019830020983e-02, - -9.999099218556415e-01, 1.342192887199577e-02, - -9.999073298511143e-01, 1.361365895029574e-02, - -9.999047010828529e-01, 1.380538852806039e-02, - -9.999020355509539e-01, 1.399711759824037e-02, - -9.998993332555154e-01, 1.418884615378634e-02, - -9.998965941966367e-01, 1.438057418764901e-02, - -9.998938183744185e-01, 1.457230169277906e-02, - -9.998910057889630e-01, 1.476402866212725e-02, - -9.998881564403733e-01, 1.495575508864430e-02, - -9.998852703287545e-01, 1.514748096528099e-02, - -9.998823474542126e-01, 1.533920628498810e-02, - -9.998793878168549e-01, 1.553093104071645e-02, - -9.998763914167904e-01, 1.572265522541686e-02, - -9.998733582541293e-01, 1.591437883204018e-02, - -9.998702883289830e-01, 1.610610185353729e-02, - -9.998671816414644e-01, 1.629782428285906e-02, - -9.998640381916877e-01, 1.648954611295644e-02, - -9.998608579797685e-01, 1.668126733678033e-02, - -9.998576410058239e-01, 1.687298794728171e-02, - -9.998543872699719e-01, 1.706470793741156e-02, - -9.998510967723322e-01, 1.725642730012088e-02, - -9.998477695130259e-01, 1.744814602836069e-02, - -9.998444054921752e-01, 1.763986411508205e-02, - -9.998410047099040e-01, 1.783158155323604e-02, - -9.998375671663371e-01, 1.802329833577375e-02, - -9.998340928616010e-01, 1.821501445564629e-02, - -9.998305817958234e-01, 1.840672990580482e-02, - -9.998270339691334e-01, 1.859844467920051e-02, - -9.998234493816616e-01, 1.879015876878455e-02, - -9.998198280335394e-01, 1.898187216750818e-02, - -9.998161699249004e-01, 1.917358486832262e-02, - -9.998124750558788e-01, 1.936529686417916e-02, - -9.998087434266105e-01, 1.955700814802908e-02, - -9.998049750372329e-01, 1.974871871282373e-02, - -9.998011698878843e-01, 1.994042855151444e-02, - -9.997973279787047e-01, 2.013213765705259e-02, - -9.997934493098353e-01, 2.032384602238959e-02, - -9.997895338814188e-01, 2.051555364047688e-02, - -9.997855816935992e-01, 2.070726050426589e-02, - -9.997815927465217e-01, 2.089896660670814e-02, - -9.997775670403329e-01, 2.109067194075512e-02, - -9.997735045751810e-01, 2.128237649935839e-02, - -9.997694053512153e-01, 2.147408027546951e-02, - -9.997652693685865e-01, 2.166578326204008e-02, - -9.997610966274466e-01, 2.185748545202174e-02, - -9.997568871279491e-01, 2.204918683836614e-02, - -9.997526408702488e-01, 2.224088741402496e-02, - -9.997483578545018e-01, 2.243258717194993e-02, - -9.997440380808654e-01, 2.262428610509280e-02, - -9.997396815494987e-01, 2.281598420640535e-02, - -9.997352882605617e-01, 2.300768146883937e-02, - -9.997308582142160e-01, 2.319937788534672e-02, - -9.997263914106245e-01, 2.339107344887926e-02, - -9.997218878499513e-01, 2.358276815238889e-02, - -9.997173475323622e-01, 2.377446198882755e-02, - -9.997127704580239e-01, 2.396615495114721e-02, - -9.997081566271049e-01, 2.415784703229986e-02, - -9.997035060397746e-01, 2.434953822523753e-02, - -9.996988186962042e-01, 2.454122852291229e-02, - -9.996940945965660e-01, 2.473291791827622e-02, - -9.996893337410336e-01, 2.492460640428147e-02, - -9.996845361297821e-01, 2.511629397388019e-02, - -9.996797017629879e-01, 2.530798062002457e-02, - -9.996748306408287e-01, 2.549966633566685e-02, - -9.996699227634838e-01, 2.569135111375929e-02, - -9.996649781311333e-01, 2.588303494725420e-02, - -9.996599967439592e-01, 2.607471782910390e-02, - -9.996549786021447e-01, 2.626639975226076e-02, - -9.996499237058742e-01, 2.645808070967719e-02, - -9.996448320553336e-01, 2.664976069430562e-02, - -9.996397036507102e-01, 2.684143969909853e-02, - -9.996345384921923e-01, 2.703311771700843e-02, - -9.996293365799701e-01, 2.722479474098788e-02, - -9.996240979142346e-01, 2.741647076398944e-02, - -9.996188224951786e-01, 2.760814577896574e-02, - -9.996135103229960e-01, 2.779981977886944e-02, - -9.996081613978821e-01, 2.799149275665324e-02, - -9.996027757200335e-01, 2.818316470526987e-02, - -9.995973532896484e-01, 2.837483561767210e-02, - -9.995918941069260e-01, 2.856650548681273e-02, - -9.995863981720671e-01, 2.875817430564461e-02, - -9.995808654852737e-01, 2.894984206712064e-02, - -9.995752960467492e-01, 2.914150876419372e-02, - -9.995696898566986e-01, 2.933317438981684e-02, - -9.995640469153277e-01, 2.952483893694298e-02, - -9.995583672228443e-01, 2.971650239852519e-02, - -9.995526507794570e-01, 2.990816476751655e-02, - -9.995468975853760e-01, 3.009982603687020e-02, - -9.995411076408129e-01, 3.029148619953928e-02, - -9.995352809459805e-01, 3.048314524847701e-02, - -9.995294175010931e-01, 3.067480317663663e-02, - -9.995235173063663e-01, 3.086645997697141e-02, - -9.995175803620170e-01, 3.105811564243470e-02, - -9.995116066682634e-01, 3.124977016597986e-02, - -9.995055962253253e-01, 3.144142354056030e-02, - -9.994995490334236e-01, 3.163307575912948e-02, - -9.994934650927806e-01, 3.182472681464089e-02, - -9.994873444036201e-01, 3.201637670004806e-02, - -9.994811869661670e-01, 3.220802540830459e-02, - -9.994749927806478e-01, 3.239967293236409e-02, - -9.994687618472900e-01, 3.259131926518023e-02, - -9.994624941663232e-01, 3.278296439970672e-02, - -9.994561897379773e-01, 3.297460832889734e-02, - -9.994498485624845e-01, 3.316625104570586e-02, - -9.994434706400778e-01, 3.335789254308614e-02, - -9.994370559709915e-01, 3.354953281399207e-02, - -9.994306045554617e-01, 3.374117185137758e-02, - -9.994241163937256e-01, 3.393280964819666e-02, - -9.994175914860217e-01, 3.412444619740333e-02, - -9.994110298325898e-01, 3.431608149195165e-02, - -9.994044314336713e-01, 3.450771552479575e-02, - -9.993977962895086e-01, 3.469934828888980e-02, - -9.993911244003460e-01, 3.489097977718800e-02, - -9.993844157664286e-01, 3.508260998264462e-02, - -9.993776703880028e-01, 3.527423889821395e-02, - -9.993708882653172e-01, 3.546586651685035e-02, - -9.993640693986205e-01, 3.565749283150822e-02, - -9.993572137881640e-01, 3.584911783514202e-02, - -9.993503214341994e-01, 3.604074152070623e-02, - -9.993433923369802e-01, 3.623236388115540e-02, - -9.993364264967612e-01, 3.642398490944411e-02, - -9.993294239137984e-01, 3.661560459852703e-02, - -9.993223845883495e-01, 3.680722294135883e-02, - -9.993153085206731e-01, 3.699883993089426e-02, - -9.993081957110295e-01, 3.719045556008812e-02, - -9.993010461596801e-01, 3.738206982189523e-02, - -9.992938598668878e-01, 3.757368270927049e-02, - -9.992866368329167e-01, 3.776529421516886e-02, - -9.992793770580327e-01, 3.795690433254531e-02, - -9.992720805425026e-01, 3.814851305435489e-02, - -9.992647472865944e-01, 3.834012037355269e-02, - -9.992573772905781e-01, 3.853172628309387e-02, - -9.992499705547244e-01, 3.872333077593362e-02, - -9.992425270793058e-01, 3.891493384502719e-02, - -9.992350468645959e-01, 3.910653548332989e-02, - -9.992275299108696e-01, 3.929813568379706e-02, - -9.992199762184035e-01, 3.948973443938412e-02, - -9.992123857874753e-01, 3.968133174304653e-02, - -9.992047586183639e-01, 3.987292758773981e-02, - -9.991970947113499e-01, 4.006452196641952e-02, - -9.991893940667149e-01, 4.025611487204128e-02, - -9.991816566847423e-01, 4.044770629756078e-02, - -9.991738825657164e-01, 4.063929623593374e-02, - -9.991660717099230e-01, 4.083088468011595e-02, - -9.991582241176494e-01, 4.102247162306324e-02, - -9.991503397891841e-01, 4.121405705773152e-02, - -9.991424187248169e-01, 4.140564097707674e-02, - -9.991344609248392e-01, 4.159722337405489e-02, - -9.991264663895434e-01, 4.178880424162206e-02, - -9.991184351192235e-01, 4.198038357273436e-02, - -9.991103671141749e-01, 4.217196136034795e-02, - -9.991022623746941e-01, 4.236353759741907e-02, - -9.990941209010791e-01, 4.255511227690402e-02, - -9.990859426936293e-01, 4.274668539175913e-02, - -9.990777277526454e-01, 4.293825693494082e-02, - -9.990694760784293e-01, 4.312982689940555e-02, - -9.990611876712846e-01, 4.332139527810983e-02, - -9.990528625315159e-01, 4.351296206401024e-02, - -9.990445006594293e-01, 4.370452725006342e-02, - -9.990361020553323e-01, 4.389609082922607e-02, - -9.990276667195337e-01, 4.408765279445494e-02, - -9.990191946523435e-01, 4.427921313870685e-02, - -9.990106858540734e-01, 4.447077185493867e-02, - -9.990021403250360e-01, 4.466232893610732e-02, - -9.989935580655457e-01, 4.485388437516982e-02, - -9.989849390759180e-01, 4.504543816508320e-02, - -9.989762833564698e-01, 4.523699029880459e-02, - -9.989675909075193e-01, 4.542854076929115e-02, - -9.989588617293861e-01, 4.562008956950014e-02, - -9.989500958223912e-01, 4.581163669238884e-02, - -9.989412931868569e-01, 4.600318213091462e-02, - -9.989324538231067e-01, 4.619472587803491e-02, - -9.989235777314658e-01, 4.638626792670716e-02, - -9.989146649122604e-01, 4.657780826988894e-02, - -9.989057153658183e-01, 4.676934690053786e-02, - -9.988967290924684e-01, 4.696088381161159e-02, - -9.988877060925413e-01, 4.715241899606787e-02, - -9.988786463663687e-01, 4.734395244686448e-02, - -9.988695499142836e-01, 4.753548415695930e-02, - -9.988604167366205e-01, 4.772701411931025e-02, - -9.988512468337152e-01, 4.791854232687533e-02, - -9.988420402059048e-01, 4.811006877261259e-02, - -9.988327968535280e-01, 4.830159344948014e-02, - -9.988235167769245e-01, 4.849311635043618e-02, - -9.988141999764354e-01, 4.868463746843894e-02, - -9.988048464524034e-01, 4.887615679644676e-02, - -9.987954562051724e-01, 4.906767432741801e-02, - -9.987860292350876e-01, 4.925919005431114e-02, - -9.987765655424956e-01, 4.945070397008466e-02, - -9.987670651277444e-01, 4.964221606769716e-02, - -9.987575279911833e-01, 4.983372634010728e-02, - -9.987479541331629e-01, 5.002523478027373e-02, - -9.987383435540352e-01, 5.021674138115531e-02, - -9.987286962541537e-01, 5.040824613571086e-02, - -9.987190122338729e-01, 5.059974903689928e-02, - -9.987092914935490e-01, 5.079125007767958e-02, - -9.986995340335393e-01, 5.098274925101080e-02, - -9.986897398542026e-01, 5.117424654985208e-02, - -9.986799089558991e-01, 5.136574196716259e-02, - -9.986700413389901e-01, 5.155723549590161e-02, - -9.986601370038385e-01, 5.174872712902846e-02, - -9.986501959508083e-01, 5.194021685950254e-02, - -9.986402181802653e-01, 5.213170468028332e-02, - -9.986302036925760e-01, 5.232319058433035e-02, - -9.986201524881089e-01, 5.251467456460322e-02, - -9.986100645672333e-01, 5.270615661406163e-02, - -9.985999399303204e-01, 5.289763672566532e-02, - -9.985897785777422e-01, 5.308911489237413e-02, - -9.985795805098725e-01, 5.328059110714795e-02, - -9.985693457270861e-01, 5.347206536294673e-02, - -9.985590742297593e-01, 5.366353765273052e-02, - -9.985487660182699e-01, 5.385500796945944e-02, - -9.985384210929967e-01, 5.404647630609366e-02, - -9.985280394543202e-01, 5.423794265559345e-02, - -9.985176211026222e-01, 5.442940701091913e-02, - -9.985071660382855e-01, 5.462086936503111e-02, - -9.984966742616946e-01, 5.481232971088985e-02, - -9.984861457732354e-01, 5.500378804145592e-02, - -9.984755805732948e-01, 5.519524434968993e-02, - -9.984649786622612e-01, 5.538669862855260e-02, - -9.984543400405248e-01, 5.557815087100468e-02, - -9.984436647084763e-01, 5.576960107000703e-02, - -9.984329526665084e-01, 5.596104921852057e-02, - -9.984222039150150e-01, 5.615249530950629e-02, - -9.984114184543913e-01, 5.634393933592529e-02, - -9.984005962850336e-01, 5.653538129073870e-02, - -9.983897374073402e-01, 5.672682116690775e-02, - -9.983788418217100e-01, 5.691825895739374e-02, - -9.983679095285438e-01, 5.710969465515806e-02, - -9.983569405282434e-01, 5.730112825316216e-02, - -9.983459348212124e-01, 5.749255974436757e-02, - -9.983348924078550e-01, 5.768398912173590e-02, - -9.983238132885776e-01, 5.787541637822886e-02, - -9.983126974637873e-01, 5.806684150680819e-02, - -9.983015449338929e-01, 5.825826450043575e-02, - -9.982903556993044e-01, 5.844968535207348e-02, - -9.982791297604332e-01, 5.864110405468334e-02, - -9.982678671176921e-01, 5.883252060122744e-02, - -9.982565677714952e-01, 5.902393498466793e-02, - -9.982452317222579e-01, 5.921534719796706e-02, - -9.982338589703968e-01, 5.940675723408715e-02, - -9.982224495163305e-01, 5.959816508599059e-02, - -9.982110033604782e-01, 5.978957074663987e-02, - -9.981995205032607e-01, 5.998097420899755e-02, - -9.981880009451003e-01, 6.017237546602626e-02, - -9.981764446864205e-01, 6.036377451068874e-02, - -9.981648517276462e-01, 6.055517133594779e-02, - -9.981532220692038e-01, 6.074656593476629e-02, - -9.981415557115205e-01, 6.093795830010720e-02, - -9.981298526550256e-01, 6.112934842493359e-02, - -9.981181129001492e-01, 6.132073630220858e-02, - -9.981063364473230e-01, 6.151212192489538e-02, - -9.980945232969800e-01, 6.170350528595730e-02, - -9.980826734495546e-01, 6.189488637835772e-02, - -9.980707869054823e-01, 6.208626519506009e-02, - -9.980588636652002e-01, 6.227764172902797e-02, - -9.980469037291468e-01, 6.246901597322500e-02, - -9.980349070977618e-01, 6.266038792061487e-02, - -9.980228737714862e-01, 6.285175756416140e-02, - -9.980108037507625e-01, 6.304312489682849e-02, - -9.979986970360344e-01, 6.323448991158007e-02, - -9.979865536277470e-01, 6.342585260138023e-02, - -9.979743735263470e-01, 6.361721295919310e-02, - -9.979621567322820e-01, 6.380857097798290e-02, - -9.979499032460012e-01, 6.399992665071394e-02, - -9.979376130679553e-01, 6.419127997035064e-02, - -9.979252861985960e-01, 6.438263092985747e-02, - -9.979129226383766e-01, 6.457397952219898e-02, - -9.979005223877516e-01, 6.476532574033989e-02, - -9.978880854471771e-01, 6.495666957724487e-02, - -9.978756118171102e-01, 6.514801102587883e-02, - -9.978631014980095e-01, 6.533935007920663e-02, - -9.978505544903351e-01, 6.553068673019333e-02, - -9.978379707945483e-01, 6.572202097180399e-02, - -9.978253504111116e-01, 6.591335279700380e-02, - -9.978126933404893e-01, 6.610468219875808e-02, - -9.977999995831465e-01, 6.629600917003213e-02, - -9.977872691395500e-01, 6.648733370379145e-02, - -9.977745020101678e-01, 6.667865579300156e-02, - -9.977616981954696e-01, 6.686997543062811e-02, - -9.977488576959257e-01, 6.706129260963682e-02, - -9.977359805120086e-01, 6.725260732299350e-02, - -9.977230666441916e-01, 6.744391956366405e-02, - -9.977101160929496e-01, 6.763522932461448e-02, - -9.976971288587585e-01, 6.782653659881087e-02, - -9.976841049420960e-01, 6.801784137921939e-02, - -9.976710443434410e-01, 6.820914365880633e-02, - -9.976579470632737e-01, 6.840044343053801e-02, - -9.976448131020754e-01, 6.859174068738094e-02, - -9.976316424603293e-01, 6.878303542230163e-02, - -9.976184351385196e-01, 6.897432762826675e-02, - -9.976051911371316e-01, 6.916561729824298e-02, - -9.975919104566526e-01, 6.935690442519721e-02, - -9.975785930975708e-01, 6.954818900209630e-02, - -9.975652390603758e-01, 6.973947102190730e-02, - -9.975518483455584e-01, 6.993075047759731e-02, - -9.975384209536113e-01, 7.012202736213352e-02, - -9.975249568850280e-01, 7.031330166848325e-02, - -9.975114561403035e-01, 7.050457338961386e-02, - -9.974979187199342e-01, 7.069584251849285e-02, - -9.974843446244179e-01, 7.088710904808780e-02, - -9.974707338542537e-01, 7.107837297136640e-02, - -9.974570864099419e-01, 7.126963428129640e-02, - -9.974434022919844e-01, 7.146089297084568e-02, - -9.974296815008842e-01, 7.165214903298221e-02, - -9.974159240371460e-01, 7.184340246067403e-02, - -9.974021299012753e-01, 7.203465324688933e-02, - -9.973882990937795e-01, 7.222590138459632e-02, - -9.973744316151671e-01, 7.241714686676341e-02, - -9.973605274659479e-01, 7.260838968635899e-02, - -9.973465866466332e-01, 7.279962983635167e-02, - -9.973326091577355e-01, 7.299086730971004e-02, - -9.973185949997686e-01, 7.318210209940289e-02, - -9.973045441732480e-01, 7.337333419839903e-02, - -9.972904566786902e-01, 7.356456359966743e-02, - -9.972763325166132e-01, 7.375579029617710e-02, - -9.972621716875362e-01, 7.394701428089720e-02, - -9.972479741919799e-01, 7.413823554679698e-02, - -9.972337400304663e-01, 7.432945408684576e-02, - -9.972194692035187e-01, 7.452066989401300e-02, - -9.972051617116618e-01, 7.471188296126821e-02, - -9.971908175554219e-01, 7.490309328158108e-02, - -9.971764367353262e-01, 7.509430084792130e-02, - -9.971620192519033e-01, 7.528550565325877e-02, - -9.971475651056835e-01, 7.547670769056339e-02, - -9.971330742971981e-01, 7.566790695280523e-02, - -9.971185468269800e-01, 7.585910343295445e-02, - -9.971039826955633e-01, 7.605029712398126e-02, - -9.970893819034834e-01, 7.624148801885607e-02, - -9.970747444512773e-01, 7.643267611054928e-02, - -9.970600703394830e-01, 7.662386139203149e-02, - -9.970453595686400e-01, 7.681504385627334e-02, - -9.970306121392895e-01, 7.700622349624564e-02, - -9.970158280519733e-01, 7.719740030491920e-02, - -9.970010073072353e-01, 7.738857427526505e-02, - -9.969861499056202e-01, 7.757974540025422e-02, - -9.969712558476743e-01, 7.777091367285795e-02, - -9.969563251339453e-01, 7.796207908604749e-02, - -9.969413577649822e-01, 7.815324163279423e-02, - -9.969263537413351e-01, 7.834440130606970e-02, - -9.969113130635557e-01, 7.853555809884548e-02, - -9.968962357321972e-01, 7.872671200409330e-02, - -9.968811217478138e-01, 7.891786301478494e-02, - -9.968659711109613e-01, 7.910901112389238e-02, - -9.968507838221966e-01, 7.930015632438760e-02, - -9.968355598820782e-01, 7.949129860924277e-02, - -9.968202992911657e-01, 7.968243797143013e-02, - -9.968050020500204e-01, 7.987357440392200e-02, - -9.967896681592046e-01, 8.006470789969089e-02, - -9.967742976192820e-01, 8.025583845170932e-02, - -9.967588904308180e-01, 8.044696605295001e-02, - -9.967434465943789e-01, 8.063809069638571e-02, - -9.967279661105325e-01, 8.082921237498933e-02, - -9.967124489798480e-01, 8.102033108173386e-02, - -9.966968952028961e-01, 8.121144680959244e-02, - -9.966813047802483e-01, 8.140255955153824e-02, - -9.966656777124782e-01, 8.159366930054465e-02, - -9.966500140001601e-01, 8.178477604958508e-02, - -9.966343136438699e-01, 8.197587979163307e-02, - -9.966185766441851e-01, 8.216698051966231e-02, - -9.966028030016841e-01, 8.235807822664654e-02, - -9.965869927169470e-01, 8.254917290555967e-02, - -9.965711457905548e-01, 8.274026454937569e-02, - -9.965552622230905e-01, 8.293135315106870e-02, - -9.965393420151379e-01, 8.312243870361291e-02, - -9.965233851672824e-01, 8.331352119998268e-02, - -9.965073916801108e-01, 8.350460063315243e-02, - -9.964913615542109e-01, 8.369567699609672e-02, - -9.964752947901722e-01, 8.388675028179023e-02, - -9.964591913885854e-01, 8.407782048320770e-02, - -9.964430513500426e-01, 8.426888759332407e-02, - -9.964268746751372e-01, 8.445995160511433e-02, - -9.964106613644641e-01, 8.465101251155362e-02, - -9.963944114186193e-01, 8.484207030561713e-02, - -9.963781248382002e-01, 8.503312498028028e-02, - -9.963618016238057e-01, 8.522417652851848e-02, - -9.963454417760359e-01, 8.541522494330733e-02, - -9.963290452954924e-01, 8.560627021762253e-02, - -9.963126121827780e-01, 8.579731234443990e-02, - -9.962961424384968e-01, 8.598835131673534e-02, - -9.962796360632546e-01, 8.617938712748490e-02, - -9.962630930576581e-01, 8.637041976966475e-02, - -9.962465134223155e-01, 8.656144923625117e-02, - -9.962298971578365e-01, 8.675247552022054e-02, - -9.962132442648320e-01, 8.694349861454938e-02, - -9.961965547439142e-01, 8.713451851221430e-02, - -9.961798285956970e-01, 8.732553520619206e-02, - -9.961630658207950e-01, 8.751654868945953e-02, - -9.961462664198246e-01, 8.770755895499366e-02, - -9.961294303934037e-01, 8.789856599577159e-02, - -9.961125577421511e-01, 8.808956980477050e-02, - -9.960956484666873e-01, 8.828057037496774e-02, - -9.960787025676340e-01, 8.847156769934077e-02, - -9.960617200456140e-01, 8.866256177086715e-02, - -9.960447009012520e-01, 8.885355258252460e-02, - -9.960276451351736e-01, 8.904454012729089e-02, - -9.960105527480059e-01, 8.923552439814401e-02, - -9.959934237403774e-01, 8.942650538806196e-02, - -9.959762581129178e-01, 8.961748309002296e-02, - -9.959590558662583e-01, 8.980845749700528e-02, - -9.959418170010313e-01, 8.999942860198734e-02, - -9.959245415178708e-01, 9.019039639794770e-02, - -9.959072294174117e-01, 9.038136087786498e-02, - -9.958898807002907e-01, 9.057232203471799e-02, - -9.958724953671457e-01, 9.076327986148562e-02, - -9.958550734186158e-01, 9.095423435114693e-02, - -9.958376148553416e-01, 9.114518549668100e-02, - -9.958201196779649e-01, 9.133613329106718e-02, - -9.958025878871292e-01, 9.152707772728483e-02, - -9.957850194834788e-01, 9.171801879831346e-02, - -9.957674144676598e-01, 9.190895649713272e-02, - -9.957497728403195e-01, 9.209989081672239e-02, - -9.957320946021064e-01, 9.229082175006235e-02, - -9.957143797536706e-01, 9.248174929013260e-02, - -9.956966282956635e-01, 9.267267342991331e-02, - -9.956788402287375e-01, 9.286359416238472e-02, - -9.956610155535469e-01, 9.305451148052725e-02, - -9.956431542707469e-01, 9.324542537732138e-02, - -9.956252563809943e-01, 9.343633584574779e-02, - -9.956073218849470e-01, 9.362724287878720e-02, - -9.955893507832646e-01, 9.381814646942055e-02, - -9.955713430766078e-01, 9.400904661062884e-02, - -9.955532987656385e-01, 9.419994329539320e-02, - -9.955352178510204e-01, 9.439083651669494e-02, - -9.955171003334181e-01, 9.458172626751545e-02, - -9.954989462134978e-01, 9.477261254083624e-02, - -9.954807554919269e-01, 9.496349532963899e-02, - -9.954625281693744e-01, 9.515437462690549e-02, - -9.954442642465103e-01, 9.534525042561762e-02, - -9.954259637240062e-01, 9.553612271875747e-02, - -9.954076266025349e-01, 9.572699149930716e-02, - -9.953892528827707e-01, 9.591785676024904e-02, - -9.953708425653890e-01, 9.610871849456551e-02, - -9.953523956510668e-01, 9.629957669523913e-02, - -9.953339121404823e-01, 9.649043135525259e-02, - -9.953153920343151e-01, 9.668128246758873e-02, - -9.952968353332461e-01, 9.687213002523047e-02, - -9.952782420379577e-01, 9.706297402116092e-02, - -9.952596121491334e-01, 9.725381444836327e-02, - -9.952409456674581e-01, 9.744465129982087e-02, - -9.952222425936184e-01, 9.763548456851720e-02, - -9.952035029283015e-01, 9.782631424743586e-02, - -9.951847266721969e-01, 9.801714032956060e-02, - -9.951659138259946e-01, 9.820796280787528e-02, - -9.951470643903865e-01, 9.839878167536388e-02, - -9.951281783660655e-01, 9.858959692501058e-02, - -9.951092557537261e-01, 9.878040854979962e-02, - -9.950902965540640e-01, 9.897121654271543e-02, - -9.950713007677762e-01, 9.916202089674250e-02, - -9.950522683955610e-01, 9.935282160486554e-02, - -9.950331994381186e-01, 9.954361866006932e-02, - -9.950140938961497e-01, 9.973441205533883e-02, - -9.949949517703570e-01, 9.992520178365907e-02, - -9.949757730614441e-01, 1.001159878380153e-01, - -9.949565577701164e-01, 1.003067702113929e-01, - -9.949373058970801e-01, 1.004975488967772e-01, - -9.949180174430432e-01, 1.006883238871540e-01, - -9.948986924087149e-01, 1.008790951755089e-01, - -9.948793307948056e-01, 1.010698627548278e-01, - -9.948599326020273e-01, 1.012606266180968e-01, - -9.948404978310932e-01, 1.014513867583021e-01, - -9.948210264827179e-01, 1.016421431684298e-01, - -9.948015185576171e-01, 1.018328958414665e-01, - -9.947819740565083e-01, 1.020236447703987e-01, - -9.947623929801099e-01, 1.022143899482132e-01, - -9.947427753291420e-01, 1.024051313678967e-01, - -9.947231211043257e-01, 1.025958690224363e-01, - -9.947034303063839e-01, 1.027866029048190e-01, - -9.946837029360402e-01, 1.029773330080322e-01, - -9.946639389940204e-01, 1.031680593250632e-01, - -9.946441384810507e-01, 1.033587818488996e-01, - -9.946243013978594e-01, 1.035495005725291e-01, - -9.946044277451757e-01, 1.037402154889394e-01, - -9.945845175237303e-01, 1.039309265911185e-01, - -9.945645707342554e-01, 1.041216338720546e-01, - -9.945445873774843e-01, 1.043123373247358e-01, - -9.945245674541517e-01, 1.045030369421506e-01, - -9.945045109649937e-01, 1.046937327172874e-01, - -9.944844179107476e-01, 1.048844246431350e-01, - -9.944642882921524e-01, 1.050751127126820e-01, - -9.944441221099480e-01, 1.052657969189176e-01, - -9.944239193648760e-01, 1.054564772548307e-01, - -9.944036800576791e-01, 1.056471537134106e-01, - -9.943834041891014e-01, 1.058378262876467e-01, - -9.943630917598886e-01, 1.060284949705284e-01, - -9.943427427707873e-01, 1.062191597550455e-01, - -9.943223572225458e-01, 1.064098206341877e-01, - -9.943019351159136e-01, 1.066004776009450e-01, - -9.942814764516416e-01, 1.067911306483074e-01, - -9.942609812304818e-01, 1.069817797692652e-01, - -9.942404494531879e-01, 1.071724249568088e-01, - -9.942198811205150e-01, 1.073630662039288e-01, - -9.941992762332189e-01, 1.075537035036156e-01, - -9.941786347920576e-01, 1.077443368488603e-01, - -9.941579567977897e-01, 1.079349662326537e-01, - -9.941372422511757e-01, 1.081255916479869e-01, - -9.941164911529771e-01, 1.083162130878512e-01, - -9.940957035039569e-01, 1.085068305452379e-01, - -9.940748793048794e-01, 1.086974440131387e-01, - -9.940540185565102e-01, 1.088880534845452e-01, - -9.940331212596164e-01, 1.090786589524492e-01, - -9.940121874149662e-01, 1.092692604098428e-01, - -9.939912170233294e-01, 1.094598578497180e-01, - -9.939702100854769e-01, 1.096504512650671e-01, - -9.939491666021811e-01, 1.098410406488826e-01, - -9.939280865742158e-01, 1.100316259941570e-01, - -9.939069700023561e-01, 1.102222072938831e-01, - -9.938858168873781e-01, 1.104127845410536e-01, - -9.938646272300597e-01, 1.106033577286617e-01, - -9.938434010311802e-01, 1.107939268497006e-01, - -9.938221382915197e-01, 1.109844918971634e-01, - -9.938008390118601e-01, 1.111750528640437e-01, - -9.937795031929846e-01, 1.113656097433352e-01, - -9.937581308356774e-01, 1.115561625280315e-01, - -9.937367219407246e-01, 1.117467112111266e-01, - -9.937152765089132e-01, 1.119372557856146e-01, - -9.936937945410318e-01, 1.121277962444896e-01, - -9.936722760378700e-01, 1.123183325807462e-01, - -9.936507210002191e-01, 1.125088647873787e-01, - -9.936291294288717e-01, 1.126993928573819e-01, - -9.936075013246216e-01, 1.128899167837505e-01, - -9.935858366882640e-01, 1.130804365594796e-01, - -9.935641355205953e-01, 1.132709521775643e-01, - -9.935423978224136e-01, 1.134614636309999e-01, - -9.935206235945181e-01, 1.136519709127819e-01, - -9.934988128377094e-01, 1.138424740159057e-01, - -9.934769655527892e-01, 1.140329729333672e-01, - -9.934550817405610e-01, 1.142234676581623e-01, - -9.934331614018294e-01, 1.144139581832869e-01, - -9.934112045374001e-01, 1.146044445017374e-01, - -9.933892111480807e-01, 1.147949266065101e-01, - -9.933671812346796e-01, 1.149854044906015e-01, - -9.933451147980069e-01, 1.151758781470082e-01, - -9.933230118388740e-01, 1.153663475687271e-01, - -9.933008723580933e-01, 1.155568127487553e-01, - -9.932786963564790e-01, 1.157472736800897e-01, - -9.932564838348464e-01, 1.159377303557278e-01, - -9.932342347940123e-01, 1.161281827686669e-01, - -9.932119492347945e-01, 1.163186309119048e-01, - -9.931896271580126e-01, 1.165090747784390e-01, - -9.931672685644872e-01, 1.166995143612677e-01, - -9.931448734550404e-01, 1.168899496533888e-01, - -9.931224418304956e-01, 1.170803806478006e-01, - -9.930999736916776e-01, 1.172708073375015e-01, - -9.930774690394123e-01, 1.174612297154900e-01, - -9.930549278745273e-01, 1.176516477747649e-01, - -9.930323501978514e-01, 1.178420615083250e-01, - -9.930097360102146e-01, 1.180324709091693e-01, - -9.929870853124484e-01, 1.182228759702972e-01, - -9.929643981053856e-01, 1.184132766847078e-01, - -9.929416743898605e-01, 1.186036730454007e-01, - -9.929189141667083e-01, 1.187940650453756e-01, - -9.928961174367660e-01, 1.189844526776323e-01, - -9.928732842008717e-01, 1.191748359351709e-01, - -9.928504144598651e-01, 1.193652148109914e-01, - -9.928275082145868e-01, 1.195555892980941e-01, - -9.928045654658791e-01, 1.197459593894796e-01, - -9.927815862145856e-01, 1.199363250781485e-01, - -9.927585704615511e-01, 1.201266863571015e-01, - -9.927355182076218e-01, 1.203170432193397e-01, - -9.927124294536455e-01, 1.205073956578641e-01, - -9.926893042004707e-01, 1.206977436656761e-01, - -9.926661424489480e-01, 1.208880872357771e-01, - -9.926429441999288e-01, 1.210784263611686e-01, - -9.926197094542661e-01, 1.212687610348526e-01, - -9.925964382128143e-01, 1.214590912498308e-01, - -9.925731304764288e-01, 1.216494169991055e-01, - -9.925497862459667e-01, 1.218397382756789e-01, - -9.925264055222861e-01, 1.220300550725534e-01, - -9.925029883062470e-01, 1.222203673827315e-01, - -9.924795345987100e-01, 1.224106751992162e-01, - -9.924560444005377e-01, 1.226009785150102e-01, - -9.924325177125937e-01, 1.227912773231168e-01, - -9.924089545357428e-01, 1.229815716165391e-01, - -9.923853548708517e-01, 1.231718613882805e-01, - -9.923617187187879e-01, 1.233621466313447e-01, - -9.923380460804204e-01, 1.235524273387354e-01, - -9.923143369566196e-01, 1.237427035034565e-01, - -9.922905913482574e-01, 1.239329751185122e-01, - -9.922668092562066e-01, 1.241232421769066e-01, - -9.922429906813417e-01, 1.243135046716442e-01, - -9.922191356245385e-01, 1.245037625957297e-01, - -9.921952440866739e-01, 1.246940159421676e-01, - -9.921713160686265e-01, 1.248842647039631e-01, - -9.921473515712761e-01, 1.250745088741212e-01, - -9.921233505955037e-01, 1.252647484456471e-01, - -9.920993131421918e-01, 1.254549834115462e-01, - -9.920752392122241e-01, 1.256452137648243e-01, - -9.920511288064857e-01, 1.258354394984870e-01, - -9.920269819258634e-01, 1.260256606055403e-01, - -9.920027985712445e-01, 1.262158770789903e-01, - -9.919785787435186e-01, 1.264060889118434e-01, - -9.919543224435760e-01, 1.265962960971058e-01, - -9.919300296723085e-01, 1.267864986277844e-01, - -9.919057004306093e-01, 1.269766964968859e-01, - -9.918813347193730e-01, 1.271668896974172e-01, - -9.918569325394955e-01, 1.273570782223854e-01, - -9.918324938918738e-01, 1.275472620647980e-01, - -9.918080187774064e-01, 1.277374412176623e-01, - -9.917835071969935e-01, 1.279276156739861e-01, - -9.917589591515361e-01, 1.281177854267771e-01, - -9.917343746419368e-01, 1.283079504690434e-01, - -9.917097536690995e-01, 1.284981107937932e-01, - -9.916850962339294e-01, 1.286882663940347e-01, - -9.916604023373332e-01, 1.288784172627765e-01, - -9.916356719802187e-01, 1.290685633930274e-01, - -9.916109051634954e-01, 1.292587047777961e-01, - -9.915861018880735e-01, 1.294488414100918e-01, - -9.915612621548653e-01, 1.296389732829236e-01, - -9.915363859647839e-01, 1.298291003893009e-01, - -9.915114733187439e-01, 1.300192227222333e-01, - -9.914865242176615e-01, 1.302093402747306e-01, - -9.914615386624538e-01, 1.303994530398027e-01, - -9.914365166540394e-01, 1.305895610104597e-01, - -9.914114581933385e-01, 1.307796641797117e-01, - -9.913863632812723e-01, 1.309697625405694e-01, - -9.913612319187635e-01, 1.311598560860433e-01, - -9.913360641067361e-01, 1.313499448091442e-01, - -9.913108598461154e-01, 1.315400287028831e-01, - -9.912856191378282e-01, 1.317301077602712e-01, - -9.912603419828024e-01, 1.319201819743198e-01, - -9.912350283819674e-01, 1.321102513380404e-01, - -9.912096783362541e-01, 1.323003158444447e-01, - -9.911842918465942e-01, 1.324903754865445e-01, - -9.911588689139214e-01, 1.326804302573521e-01, - -9.911334095391702e-01, 1.328704801498794e-01, - -9.911079137232769e-01, 1.330605251571391e-01, - -9.910823814671786e-01, 1.332505652721436e-01, - -9.910568127718143e-01, 1.334406004879057e-01, - -9.910312076381241e-01, 1.336306307974383e-01, - -9.910055660670494e-01, 1.338206561937547e-01, - -9.909798880595327e-01, 1.340106766698681e-01, - -9.909541736165185e-01, 1.342006922187920e-01, - -9.909284227389520e-01, 1.343907028335401e-01, - -9.909026354277800e-01, 1.345807085071262e-01, - -9.908768116839507e-01, 1.347707092325643e-01, - -9.908509515084136e-01, 1.349607050028687e-01, - -9.908250549021195e-01, 1.351506958110539e-01, - -9.907991218660204e-01, 1.353406816501342e-01, - -9.907731524010698e-01, 1.355306625131246e-01, - -9.907471465082227e-01, 1.357206383930399e-01, - -9.907211041884352e-01, 1.359106092828953e-01, - -9.906950254426646e-01, 1.361005751757062e-01, - -9.906689102718701e-01, 1.362905360644880e-01, - -9.906427586770116e-01, 1.364804919422563e-01, - -9.906165706590506e-01, 1.366704428020271e-01, - -9.905903462189501e-01, 1.368603886368164e-01, - -9.905640853576744e-01, 1.370503294396404e-01, - -9.905377880761888e-01, 1.372402652035156e-01, - -9.905114543754603e-01, 1.374301959214586e-01, - -9.904850842564571e-01, 1.376201215864860e-01, - -9.904586777201486e-01, 1.378100421916151e-01, - -9.904322347675060e-01, 1.379999577298628e-01, - -9.904057553995013e-01, 1.381898681942466e-01, - -9.903792396171082e-01, 1.383797735777839e-01, - -9.903526874213014e-01, 1.385696738734925e-01, - -9.903260988130573e-01, 1.387595690743904e-01, - -9.902994737933536e-01, 1.389494591734955e-01, - -9.902728123631691e-01, 1.391393441638262e-01, - -9.902461145234840e-01, 1.393292240384010e-01, - -9.902193802752800e-01, 1.395190987902385e-01, - -9.901926096195400e-01, 1.397089684123576e-01, - -9.901658025572484e-01, 1.398988328977772e-01, - -9.901389590893906e-01, 1.400886922395167e-01, - -9.901120792169538e-01, 1.402785464305954e-01, - -9.900851629409260e-01, 1.404683954640330e-01, - -9.900582102622971e-01, 1.406582393328492e-01, - -9.900312211820580e-01, 1.408480780300641e-01, - -9.900041957012009e-01, 1.410379115486977e-01, - -9.899771338207196e-01, 1.412277398817705e-01, - -9.899500355416090e-01, 1.414175630223030e-01, - -9.899229008648655e-01, 1.416073809633160e-01, - -9.898957297914867e-01, 1.417971936978304e-01, - -9.898685223224716e-01, 1.419870012188673e-01, - -9.898412784588205e-01, 1.421768035194480e-01, - -9.898139982015353e-01, 1.423666005925942e-01, - -9.897866815516186e-01, 1.425563924313273e-01, - -9.897593285100752e-01, 1.427461790286695e-01, - -9.897319390779106e-01, 1.429359603776427e-01, - -9.897045132561318e-01, 1.431257364712692e-01, - -9.896770510457472e-01, 1.433155073025715e-01, - -9.896495524477665e-01, 1.435052728645723e-01, - -9.896220174632009e-01, 1.436950331502945e-01, - -9.895944460930625e-01, 1.438847881527610e-01, - -9.895668383383651e-01, 1.440745378649952e-01, - -9.895391942001239e-01, 1.442642822800204e-01, - -9.895115136793552e-01, 1.444540213908605e-01, - -9.894837967770768e-01, 1.446437551905390e-01, - -9.894560434943077e-01, 1.448334836720802e-01, - -9.894282538320682e-01, 1.450232068285082e-01, - -9.894004277913804e-01, 1.452129246528475e-01, - -9.893725653732670e-01, 1.454026371381226e-01, - -9.893446665787526e-01, 1.455923442773583e-01, - -9.893167314088630e-01, 1.457820460635799e-01, - -9.892887598646252e-01, 1.459717424898122e-01, - -9.892607519470676e-01, 1.461614335490809e-01, - -9.892327076572200e-01, 1.463511192344115e-01, - -9.892046269961138e-01, 1.465407995388298e-01, - -9.891765099647810e-01, 1.467304744553617e-01, - -9.891483565642556e-01, 1.469201439770336e-01, - -9.891201667955727e-01, 1.471098080968718e-01, - -9.890919406597688e-01, 1.472994668079028e-01, - -9.890636781578815e-01, 1.474891201031536e-01, - -9.890353792909503e-01, 1.476787679756510e-01, - -9.890070440600153e-01, 1.478684104184222e-01, - -9.889786724661185e-01, 1.480580474244947e-01, - -9.889502645103030e-01, 1.482476789868960e-01, - -9.889218201936132e-01, 1.484373050986540e-01, - -9.888933395170951e-01, 1.486269257527965e-01, - -9.888648224817956e-01, 1.488165409423519e-01, - -9.888362690887635e-01, 1.490061506603484e-01, - -9.888076793390485e-01, 1.491957548998148e-01, - -9.887790532337015e-01, 1.493853536537797e-01, - -9.887503907737754e-01, 1.495749469152722e-01, - -9.887216919603238e-01, 1.497645346773215e-01, - -9.886929567944020e-01, 1.499541169329570e-01, - -9.886641852770662e-01, 1.501436936752082e-01, - -9.886353774093748e-01, 1.503332648971050e-01, - -9.886065331923864e-01, 1.505228305916774e-01, - -9.885776526271620e-01, 1.507123907519556e-01, - -9.885487357147632e-01, 1.509019453709700e-01, - -9.885197824562533e-01, 1.510914944417513e-01, - -9.884907928526966e-01, 1.512810379573302e-01, - -9.884617669051593e-01, 1.514705759107378e-01, - -9.884327046147083e-01, 1.516601082950053e-01, - -9.884036059824124e-01, 1.518496351031642e-01, - -9.883744710093413e-01, 1.520391563282461e-01, - -9.883452996965661e-01, 1.522286719632827e-01, - -9.883160920451597e-01, 1.524181820013063e-01, - -9.882868480561958e-01, 1.526076864353491e-01, - -9.882575677307495e-01, 1.527971852584434e-01, - -9.882282510698974e-01, 1.529866784636220e-01, - -9.881988980747176e-01, 1.531761660439178e-01, - -9.881695087462891e-01, 1.533656479923639e-01, - -9.881400830856926e-01, 1.535551243019934e-01, - -9.881106210940098e-01, 1.537445949658400e-01, - -9.880811227723241e-01, 1.539340599769373e-01, - -9.880515881217201e-01, 1.541235193283194e-01, - -9.880220171432835e-01, 1.543129730130201e-01, - -9.879924098381019e-01, 1.545024210240739e-01, - -9.879627662072634e-01, 1.546918633545154e-01, - -9.879330862518584e-01, 1.548812999973793e-01, - -9.879033699729778e-01, 1.550707309457005e-01, - -9.878736173717142e-01, 1.552601561925142e-01, - -9.878438284491617e-01, 1.554495757308559e-01, - -9.878140032064155e-01, 1.556389895537609e-01, - -9.877841416445722e-01, 1.558283976542652e-01, - -9.877542437647295e-01, 1.560178000254048e-01, - -9.877243095679870e-01, 1.562071966602159e-01, - -9.876943390554451e-01, 1.563965875517349e-01, - -9.876643322282057e-01, 1.565859726929984e-01, - -9.876342890873722e-01, 1.567753520770434e-01, - -9.876042096340492e-01, 1.569647256969068e-01, - -9.875740938693424e-01, 1.571540935456259e-01, - -9.875439417943592e-01, 1.573434556162382e-01, - -9.875137534102084e-01, 1.575328119017815e-01, - -9.874835287179997e-01, 1.577221623952936e-01, - -9.874532677188446e-01, 1.579115070898127e-01, - -9.874229704138554e-01, 1.581008459783770e-01, - -9.873926368041462e-01, 1.582901790540252e-01, - -9.873622668908324e-01, 1.584795063097960e-01, - -9.873318606750304e-01, 1.586688277387283e-01, - -9.873014181578584e-01, 1.588581433338614e-01, - -9.872709393404354e-01, 1.590474530882348e-01, - -9.872404242238823e-01, 1.592367569948878e-01, - -9.872098728093208e-01, 1.594260550468606e-01, - -9.871792850978743e-01, 1.596153472371931e-01, - -9.871486610906676e-01, 1.598046335589254e-01, - -9.871180007888263e-01, 1.599939140050983e-01, - -9.870873041934779e-01, 1.601831885687522e-01, - -9.870565713057510e-01, 1.603724572429283e-01, - -9.870258021267756e-01, 1.605617200206675e-01, - -9.869949966576830e-01, 1.607509768950112e-01, - -9.869641548996057e-01, 1.609402278590011e-01, - -9.869332768536777e-01, 1.611294729056788e-01, - -9.869023625210345e-01, 1.613187120280864e-01, - -9.868714119028125e-01, 1.615079452192661e-01, - -9.868404250001497e-01, 1.616971724722604e-01, - -9.868094018141855e-01, 1.618863937801118e-01, - -9.867783423460604e-01, 1.620756091358633e-01, - -9.867472465969166e-01, 1.622648185325580e-01, - -9.867161145678971e-01, 1.624540219632392e-01, - -9.866849462601467e-01, 1.626432194209503e-01, - -9.866537416748113e-01, 1.628324108987352e-01, - -9.866225008130385e-01, 1.630215963896378e-01, - -9.865912236759764e-01, 1.632107758867024e-01, - -9.865599102647754e-01, 1.633999493829732e-01, - -9.865285605805867e-01, 1.635891168714950e-01, - -9.864971746245629e-01, 1.637782783453127e-01, - -9.864657523978579e-01, 1.639674337974712e-01, - -9.864342939016272e-01, 1.641565832210158e-01, - -9.864027991370272e-01, 1.643457266089922e-01, - -9.863712681052160e-01, 1.645348639544460e-01, - -9.863397008073530e-01, 1.647239952504232e-01, - -9.863080972445987e-01, 1.649131204899699e-01, - -9.862764574181151e-01, 1.651022396661327e-01, - -9.862447813290655e-01, 1.652913527719580e-01, - -9.862130689786145e-01, 1.654804598004928e-01, - -9.861813203679283e-01, 1.656695607447841e-01, - -9.861495354981739e-01, 1.658586555978793e-01, - -9.861177143705201e-01, 1.660477443528258e-01, - -9.860858569861368e-01, 1.662368270026714e-01, - -9.860539633461954e-01, 1.664259035404641e-01, - -9.860220334518686e-01, 1.666149739592521e-01, - -9.859900673043301e-01, 1.668040382520837e-01, - -9.859580649047555e-01, 1.669930964120077e-01, - -9.859260262543211e-01, 1.671821484320729e-01, - -9.858939513542052e-01, 1.673711943053284e-01, - -9.858618402055870e-01, 1.675602340248236e-01, - -9.858296928096470e-01, 1.677492675836079e-01, - -9.857975091675675e-01, 1.679382949747312e-01, - -9.857652892805313e-01, 1.681273161912434e-01, - -9.857330331497235e-01, 1.683163312261948e-01, - -9.857007407763299e-01, 1.685053400726359e-01, - -9.856684121615376e-01, 1.686943427236173e-01, - -9.856360473065354e-01, 1.688833391721900e-01, - -9.856036462125134e-01, 1.690723294114050e-01, - -9.855712088806627e-01, 1.692613134343138e-01, - -9.855387353121761e-01, 1.694502912339680e-01, - -9.855062255082473e-01, 1.696392628034193e-01, - -9.854736794700718e-01, 1.698282281357198e-01, - -9.854410971988462e-01, 1.700171872239220e-01, - -9.854084786957684e-01, 1.702061400610781e-01, - -9.853758239620377e-01, 1.703950866402409e-01, - -9.853431329988548e-01, 1.705840269544636e-01, - -9.853104058074216e-01, 1.707729609967992e-01, - -9.852776423889412e-01, 1.709618887603012e-01, - -9.852448427446185e-01, 1.711508102380233e-01, - -9.852120068756594e-01, 1.713397254230193e-01, - -9.851791347832711e-01, 1.715286343083434e-01, - -9.851462264686622e-01, 1.717175368870500e-01, - -9.851132819330427e-01, 1.719064331521935e-01, - -9.850803011776238e-01, 1.720953230968290e-01, - -9.850472842036182e-01, 1.722842067140114e-01, - -9.850142310122398e-01, 1.724730839967960e-01, - -9.849811416047040e-01, 1.726619549382383e-01, - -9.849480159822270e-01, 1.728508195313941e-01, - -9.849148541460272e-01, 1.730396777693194e-01, - -9.848816560973237e-01, 1.732285296450703e-01, - -9.848484218373370e-01, 1.734173751517035e-01, - -9.848151513672891e-01, 1.736062142822754e-01, - -9.847818446884034e-01, 1.737950470298432e-01, - -9.847485018019042e-01, 1.739838733874638e-01, - -9.847151227090176e-01, 1.741726933481948e-01, - -9.846817074109709e-01, 1.743615069050937e-01, - -9.846482559089926e-01, 1.745503140512185e-01, - -9.846147682043126e-01, 1.747391147796272e-01, - -9.845812442981622e-01, 1.749279090833782e-01, - -9.845476841917740e-01, 1.751166969555299e-01, - -9.845140878863818e-01, 1.753054783891413e-01, - -9.844804553832209e-01, 1.754942533772714e-01, - -9.844467866835279e-01, 1.756830219129795e-01, - -9.844130817885407e-01, 1.758717839893250e-01, - -9.843793406994985e-01, 1.760605395993678e-01, - -9.843455634176419e-01, 1.762492887361679e-01, - -9.843117499442128e-01, 1.764380313927854e-01, - -9.842779002804544e-01, 1.766267675622809e-01, - -9.842440144276111e-01, 1.768154972377150e-01, - -9.842100923869290e-01, 1.770042204121487e-01, - -9.841761341596553e-01, 1.771929370786433e-01, - -9.841421397470386e-01, 1.773816472302600e-01, - -9.841081091503285e-01, 1.775703508600607e-01, - -9.840740423707764e-01, 1.777590479611072e-01, - -9.840399394096350e-01, 1.779477385264616e-01, - -9.840058002681579e-01, 1.781364225491863e-01, - -9.839716249476003e-01, 1.783251000223440e-01, - -9.839374134492189e-01, 1.785137709389975e-01, - -9.839031657742715e-01, 1.787024352922100e-01, - -9.838688819240172e-01, 1.788910930750447e-01, - -9.838345618997166e-01, 1.790797442805654e-01, - -9.838002057026316e-01, 1.792683889018357e-01, - -9.837658133340252e-01, 1.794570269319199e-01, - -9.837313847951621e-01, 1.796456583638822e-01, - -9.836969200873081e-01, 1.798342831907871e-01, - -9.836624192117303e-01, 1.800229014056995e-01, - -9.836278821696972e-01, 1.802115130016844e-01, - -9.835933089624787e-01, 1.804001179718072e-01, - -9.835586995913459e-01, 1.805887163091333e-01, - -9.835240540575713e-01, 1.807773080067286e-01, - -9.834893723624287e-01, 1.809658930576590e-01, - -9.834546545071933e-01, 1.811544714549908e-01, - -9.834199004931415e-01, 1.813430431917905e-01, - -9.833851103215512e-01, 1.815316082611250e-01, - -9.833502839937015e-01, 1.817201666560611e-01, - -9.833154215108728e-01, 1.819087183696662e-01, - -9.832805228743470e-01, 1.820972633950076e-01, - -9.832455880854071e-01, 1.822858017251533e-01, - -9.832106171453376e-01, 1.824743333531711e-01, - -9.831756100554244e-01, 1.826628582721293e-01, - -9.831405668169545e-01, 1.828513764750963e-01, - -9.831054874312163e-01, 1.830398879551410e-01, - -9.830703718994996e-01, 1.832283927053321e-01, - -9.830352202230956e-01, 1.834168907187391e-01, - -9.830000324032966e-01, 1.836053819884313e-01, - -9.829648084413964e-01, 1.837938665074784e-01, - -9.829295483386902e-01, 1.839823442689505e-01, - -9.828942520964741e-01, 1.841708152659177e-01, - -9.828589197160461e-01, 1.843592794914505e-01, - -9.828235511987052e-01, 1.845477369386196e-01, - -9.827881465457520e-01, 1.847361876004960e-01, - -9.827527057584878e-01, 1.849246314701508e-01, - -9.827172288382160e-01, 1.851130685406555e-01, - -9.826817157862409e-01, 1.853014988050819e-01, - -9.826461666038680e-01, 1.854899222565019e-01, - -9.826105812924048e-01, 1.856783388879876e-01, - -9.825749598531592e-01, 1.858667486926117e-01, - -9.825393022874412e-01, 1.860551516634466e-01, - -9.825036085965618e-01, 1.862435477935656e-01, - -9.824678787818332e-01, 1.864319370760416e-01, - -9.824321128445691e-01, 1.866203195039483e-01, - -9.823963107860847e-01, 1.868086950703593e-01, - -9.823604726076962e-01, 1.869970637683485e-01, - -9.823245983107213e-01, 1.871854255909903e-01, - -9.822886878964788e-01, 1.873737805313591e-01, - -9.822527413662894e-01, 1.875621285825296e-01, - -9.822167587214745e-01, 1.877504697375768e-01, - -9.821807399633571e-01, 1.879388039895759e-01, - -9.821446850932616e-01, 1.881271313316024e-01, - -9.821085941125136e-01, 1.883154517567321e-01, - -9.820724670224400e-01, 1.885037652580409e-01, - -9.820363038243690e-01, 1.886920718286052e-01, - -9.820001045196305e-01, 1.888803714615014e-01, - -9.819638691095552e-01, 1.890686641498062e-01, - -9.819275975954755e-01, 1.892569498865967e-01, - -9.818912899787251e-01, 1.894452286649502e-01, - -9.818549462606386e-01, 1.896335004779442e-01, - -9.818185664425525e-01, 1.898217653186564e-01, - -9.817821505258043e-01, 1.900100231801650e-01, - -9.817456985117330e-01, 1.901982740555481e-01, - -9.817092104016788e-01, 1.903865179378845e-01, - -9.816726861969831e-01, 1.905747548202527e-01, - -9.816361258989891e-01, 1.907629846957321e-01, - -9.815995295090407e-01, 1.909512075574018e-01, - -9.815628970284836e-01, 1.911394233983414e-01, - -9.815262284586648e-01, 1.913276322116309e-01, - -9.814895238009321e-01, 1.915158339903502e-01, - -9.814527830566355e-01, 1.917040287275798e-01, - -9.814160062271255e-01, 1.918922164164002e-01, - -9.813791933137546e-01, 1.920803970498924e-01, - -9.813423443178760e-01, 1.922685706211375e-01, - -9.813054592408447e-01, 1.924567371232168e-01, - -9.812685380840167e-01, 1.926448965492121e-01, - -9.812315808487497e-01, 1.928330488922052e-01, - -9.811945875364023e-01, 1.930211941452784e-01, - -9.811575581483348e-01, 1.932093323015140e-01, - -9.811204926859087e-01, 1.933974633539947e-01, - -9.810833911504867e-01, 1.935855872958036e-01, - -9.810462535434328e-01, 1.937737041200238e-01, - -9.810090798661126e-01, 1.939618138197388e-01, - -9.809718701198928e-01, 1.941499163880324e-01, - -9.809346243061416e-01, 1.943380118179886e-01, - -9.808973424262284e-01, 1.945261001026916e-01, - -9.808600244815239e-01, 1.947141812352260e-01, - -9.808226704734001e-01, 1.949022552086765e-01, - -9.807852804032304e-01, 1.950903220161282e-01, - -9.807478542723898e-01, 1.952783816506665e-01, - -9.807103920822540e-01, 1.954664341053770e-01, - -9.806728938342005e-01, 1.956544793733454e-01, - -9.806353595296081e-01, 1.958425174476578e-01, - -9.805977891698568e-01, 1.960305483214008e-01, - -9.805601827563278e-01, 1.962185719876609e-01, - -9.805225402904041e-01, 1.964065884395250e-01, - -9.804848617734694e-01, 1.965945976700802e-01, - -9.804471472069091e-01, 1.967825996724141e-01, - -9.804093965921099e-01, 1.969705944396143e-01, - -9.803716099304598e-01, 1.971585819647689e-01, - -9.803337872233480e-01, 1.973465622409659e-01, - -9.802959284721653e-01, 1.975345352612940e-01, - -9.802580336783036e-01, 1.977225010188419e-01, - -9.802201028431561e-01, 1.979104595066987e-01, - -9.801821359681174e-01, 1.980984107179536e-01, - -9.801441330545836e-01, 1.982863546456962e-01, - -9.801060941039518e-01, 1.984742912830164e-01, - -9.800680191176206e-01, 1.986622206230042e-01, - -9.800299080969901e-01, 1.988501426587501e-01, - -9.799917610434612e-01, 1.990380573833447e-01, - -9.799535779584367e-01, 1.992259647898788e-01, - -9.799153588433205e-01, 1.994138648714438e-01, - -9.798771036995176e-01, 1.996017576211310e-01, - -9.798388125284347e-01, 1.997896430320321e-01, - -9.798004853314798e-01, 1.999775210972392e-01, - -9.797621221100618e-01, 2.001653918098444e-01, - -9.797237228655912e-01, 2.003532551629404e-01, - -9.796852875994799e-01, 2.005411111496200e-01, - -9.796468163131412e-01, 2.007289597629761e-01, - -9.796083090079895e-01, 2.009168009961022e-01, - -9.795697656854405e-01, 2.011046348420919e-01, - -9.795311863469115e-01, 2.012924612940390e-01, - -9.794925709938208e-01, 2.014802803450377e-01, - -9.794539196275882e-01, 2.016680919881825e-01, - -9.794152322496348e-01, 2.018558962165680e-01, - -9.793765088613832e-01, 2.020436930232893e-01, - -9.793377494642568e-01, 2.022314824014415e-01, - -9.792989540596810e-01, 2.024192643441202e-01, - -9.792601226490820e-01, 2.026070388444211e-01, - -9.792212552338877e-01, 2.027948058954404e-01, - -9.791823518155269e-01, 2.029825654902744e-01, - -9.791434123954302e-01, 2.031703176220198e-01, - -9.791044369750292e-01, 2.033580622837733e-01, - -9.790654255557569e-01, 2.035457994686322e-01, - -9.790263781390476e-01, 2.037335291696939e-01, - -9.789872947263370e-01, 2.039212513800561e-01, - -9.789481753190622e-01, 2.041089660928169e-01, - -9.789090199186613e-01, 2.042966733010744e-01, - -9.788698285265741e-01, 2.044843729979272e-01, - -9.788306011442415e-01, 2.046720651764742e-01, - -9.787913377731057e-01, 2.048597498298144e-01, - -9.787520384146103e-01, 2.050474269510472e-01, - -9.787127030702004e-01, 2.052350965332723e-01, - -9.786733317413222e-01, 2.054227585695896e-01, - -9.786339244294232e-01, 2.056104130530992e-01, - -9.785944811359523e-01, 2.057980599769018e-01, - -9.785550018623596e-01, 2.059856993340979e-01, - -9.785154866100969e-01, 2.061733311177887e-01, - -9.784759353806168e-01, 2.063609553210755e-01, - -9.784363481753737e-01, 2.065485719370599e-01, - -9.783967249958231e-01, 2.067361809588437e-01, - -9.783570658434216e-01, 2.069237823795291e-01, - -9.783173707196277e-01, 2.071113761922186e-01, - -9.782776396259005e-01, 2.072989623900147e-01, - -9.782378725637011e-01, 2.074865409660206e-01, - -9.781980695344914e-01, 2.076741119133396e-01, - -9.781582305397350e-01, 2.078616752250751e-01, - -9.781183555808967e-01, 2.080492308943309e-01, - -9.780784446594424e-01, 2.082367789142113e-01, - -9.780384977768396e-01, 2.084243192778206e-01, - -9.779985149345571e-01, 2.086118519782635e-01, - -9.779584961340648e-01, 2.087993770086449e-01, - -9.779184413768344e-01, 2.089868943620701e-01, - -9.778783506643381e-01, 2.091744040316446e-01, - -9.778382239980504e-01, 2.093619060104742e-01, - -9.777980613794464e-01, 2.095494002916649e-01, - -9.777578628100028e-01, 2.097368868683233e-01, - -9.777176282911975e-01, 2.099243657335559e-01, - -9.776773578245099e-01, 2.101118368804696e-01, - -9.776370514114208e-01, 2.102993003021717e-01, - -9.775967090534119e-01, 2.104867559917697e-01, - -9.775563307519665e-01, 2.106742039423714e-01, - -9.775159165085693e-01, 2.108616441470849e-01, - -9.774754663247062e-01, 2.110490765990184e-01, - -9.774349802018643e-01, 2.112365012912807e-01, - -9.773944581415323e-01, 2.114239182169807e-01, - -9.773539001452000e-01, 2.116113273692276e-01, - -9.773133062143587e-01, 2.117987287411308e-01, - -9.772726763505009e-01, 2.119861223258003e-01, - -9.772320105551203e-01, 2.121735081163461e-01, - -9.771913088297123e-01, 2.123608861058784e-01, - -9.771505711757732e-01, 2.125482562875081e-01, - -9.771097975948009e-01, 2.127356186543459e-01, - -9.770689880882945e-01, 2.129229731995032e-01, - -9.770281426577544e-01, 2.131103199160914e-01, - -9.769872613046824e-01, 2.132976587972223e-01, - -9.769463440305817e-01, 2.134849898360081e-01, - -9.769053908369565e-01, 2.136723130255610e-01, - -9.768644017253126e-01, 2.138596283589937e-01, - -9.768233766971572e-01, 2.140469358294194e-01, - -9.767823157539987e-01, 2.142342354299510e-01, - -9.767412188973466e-01, 2.144215271537022e-01, - -9.767000861287118e-01, 2.146088109937868e-01, - -9.766589174496070e-01, 2.147960869433189e-01, - -9.766177128615456e-01, 2.149833549954128e-01, - -9.765764723660426e-01, 2.151706151431834e-01, - -9.765351959646145e-01, 2.153578673797455e-01, - -9.764938836587786e-01, 2.155451116982145e-01, - -9.764525354500541e-01, 2.157323480917059e-01, - -9.764111513399610e-01, 2.159195765533355e-01, - -9.763697313300211e-01, 2.161067970762195e-01, - -9.763282754217573e-01, 2.162940096534743e-01, - -9.762867836166936e-01, 2.164812142782167e-01, - -9.762452559163558e-01, 2.166684109435637e-01, - -9.762036923222706e-01, 2.168555996426326e-01, - -9.761620928359661e-01, 2.170427803685410e-01, - -9.761204574589719e-01, 2.172299531144068e-01, - -9.760787861928188e-01, 2.174171178733482e-01, - -9.760370790390390e-01, 2.176042746384836e-01, - -9.759953359991660e-01, 2.177914234029319e-01, - -9.759535570747343e-01, 2.179785641598122e-01, - -9.759117422672802e-01, 2.181656969022438e-01, - -9.758698915783410e-01, 2.183528216233463e-01, - -9.758280050094557e-01, 2.185399383162398e-01, - -9.757860825621639e-01, 2.187270469740444e-01, - -9.757441242380073e-01, 2.189141475898808e-01, - -9.757021300385286e-01, 2.191012401568698e-01, - -9.756600999652716e-01, 2.192883246681325e-01, - -9.756180340197818e-01, 2.194754011167903e-01, - -9.755759322036057e-01, 2.196624694959650e-01, - -9.755337945182914e-01, 2.198495297987787e-01, - -9.754916209653881e-01, 2.200365820183536e-01, - -9.754494115464464e-01, 2.202236261478124e-01, - -9.754071662630183e-01, 2.204106621802779e-01, - -9.753648851166570e-01, 2.205976901088735e-01, - -9.753225681089169e-01, 2.207847099267226e-01, - -9.752802152413542e-01, 2.209717216269491e-01, - -9.752378265155258e-01, 2.211587252026770e-01, - -9.751954019329904e-01, 2.213457206470308e-01, - -9.751529414953076e-01, 2.215327079531352e-01, - -9.751104452040389e-01, 2.217196871141152e-01, - -9.750679130607465e-01, 2.219066581230961e-01, - -9.750253450669941e-01, 2.220936209732035e-01, - -9.749827412243471e-01, 2.222805756575634e-01, - -9.749401015343718e-01, 2.224675221693019e-01, - -9.748974259986358e-01, 2.226544605015455e-01, - -9.748547146187084e-01, 2.228413906474211e-01, - -9.748119673961598e-01, 2.230283126000558e-01, - -9.747691843325618e-01, 2.232152263525770e-01, - -9.747263654294873e-01, 2.234021318981124e-01, - -9.746835106885107e-01, 2.235890292297900e-01, - -9.746406201112076e-01, 2.237759183407382e-01, - -9.745976936991550e-01, 2.239627992240855e-01, - -9.745547314539312e-01, 2.241496718729609e-01, - -9.745117333771157e-01, 2.243365362804936e-01, - -9.744686994702896e-01, 2.245233924398132e-01, - -9.744256297350350e-01, 2.247102403440494e-01, - -9.743825241729355e-01, 2.248970799863325e-01, - -9.743393827855759e-01, 2.250839113597928e-01, - -9.742962055745424e-01, 2.252707344575612e-01, - -9.742529925414225e-01, 2.254575492727685e-01, - -9.742097436878052e-01, 2.256443557985463e-01, - -9.741664590152803e-01, 2.258311540280262e-01, - -9.741231385254396e-01, 2.260179439543400e-01, - -9.740797822198757e-01, 2.262047255706202e-01, - -9.740363901001826e-01, 2.263914988699992e-01, - -9.739929621679558e-01, 2.265782638456100e-01, - -9.739494984247922e-01, 2.267650204905857e-01, - -9.739059988722896e-01, 2.269517687980598e-01, - -9.738624635120473e-01, 2.271385087611662e-01, - -9.738188923456661e-01, 2.273252403730389e-01, - -9.737752853747481e-01, 2.275119636268123e-01, - -9.737316426008964e-01, 2.276986785156212e-01, - -9.736879640257157e-01, 2.278853850326005e-01, - -9.736442496508120e-01, 2.280720831708857e-01, - -9.736004994777924e-01, 2.282587729236124e-01, - -9.735567135082656e-01, 2.284454542839165e-01, - -9.735128917438414e-01, 2.286321272449342e-01, - -9.734690341861311e-01, 2.288187917998022e-01, - -9.734251408367470e-01, 2.290054479416573e-01, - -9.733812116973033e-01, 2.291920956636368e-01, - -9.733372467694149e-01, 2.293787349588780e-01, - -9.732932460546982e-01, 2.295653658205189e-01, - -9.732492095547712e-01, 2.297519882416975e-01, - -9.732051372712528e-01, 2.299386022155522e-01, - -9.731610292057635e-01, 2.301252077352219e-01, - -9.731168853599251e-01, 2.303118047938454e-01, - -9.730727057353605e-01, 2.304983933845624e-01, - -9.730284903336942e-01, 2.306849735005122e-01, - -9.729842391565517e-01, 2.308715451348350e-01, - -9.729399522055602e-01, 2.310581082806711e-01, - -9.728956294823478e-01, 2.312446629311611e-01, - -9.728512709885442e-01, 2.314312090794458e-01, - -9.728068767257804e-01, 2.316177467186665e-01, - -9.727624466956886e-01, 2.318042758419648e-01, - -9.727179808999022e-01, 2.319907964424824e-01, - -9.726734793400564e-01, 2.321773085133617e-01, - -9.726289420177873e-01, 2.323638120477450e-01, - -9.725843689347322e-01, 2.325503070387752e-01, - -9.725397600925302e-01, 2.327367934795954e-01, - -9.724951154928212e-01, 2.329232713633490e-01, - -9.724504351372468e-01, 2.331097406831797e-01, - -9.724057190274498e-01, 2.332962014322316e-01, - -9.723609671650741e-01, 2.334826536036491e-01, - -9.723161795517653e-01, 2.336690971905768e-01, - -9.722713561891700e-01, 2.338555321861598e-01, - -9.722264970789363e-01, 2.340419585835434e-01, - -9.721816022227134e-01, 2.342283763758732e-01, - -9.721366716221522e-01, 2.344147855562952e-01, - -9.720917052789044e-01, 2.346011861179556e-01, - -9.720467031946235e-01, 2.347875780540010e-01, - -9.720016653709639e-01, 2.349739613575783e-01, - -9.719565918095817e-01, 2.351603360218347e-01, - -9.719114825121340e-01, 2.353467020399178e-01, - -9.718663374802794e-01, 2.355330594049755e-01, - -9.718211567156777e-01, 2.357194081101558e-01, - -9.717759402199901e-01, 2.359057481486074e-01, - -9.717306879948792e-01, 2.360920795134789e-01, - -9.716854000420085e-01, 2.362784021979196e-01, - -9.716400763630434e-01, 2.364647161950788e-01, - -9.715947169596502e-01, 2.366510214981064e-01, - -9.715493218334966e-01, 2.368373181001524e-01, - -9.715038909862518e-01, 2.370236059943672e-01, - -9.714584244195860e-01, 2.372098851739016e-01, - -9.714129221351709e-01, 2.373961556319066e-01, - -9.713673841346795e-01, 2.375824173615336e-01, - -9.713218104197862e-01, 2.377686703559342e-01, - -9.712762009921665e-01, 2.379549146082605e-01, - -9.712305558534974e-01, 2.381411501116648e-01, - -9.711848750054570e-01, 2.383273768592998e-01, - -9.711391584497251e-01, 2.385135948443184e-01, - -9.710934061879825e-01, 2.386998040598740e-01, - -9.710476182219111e-01, 2.388860044991200e-01, - -9.710017945531947e-01, 2.390721961552106e-01, - -9.709559351835180e-01, 2.392583790213000e-01, - -9.709100401145670e-01, 2.394445530905426e-01, - -9.708641093480295e-01, 2.396307183560936e-01, - -9.708181428855939e-01, 2.398168748111080e-01, - -9.707721407289504e-01, 2.400030224487415e-01, - -9.707261028797901e-01, 2.401891612621499e-01, - -9.706800293398061e-01, 2.403752912444894e-01, - -9.706339201106922e-01, 2.405614123889167e-01, - -9.705877751941436e-01, 2.407475246885884e-01, - -9.705415945918571e-01, 2.409336281366619e-01, - -9.704953783055306e-01, 2.411197227262946e-01, - -9.704491263368631e-01, 2.413058084506444e-01, - -9.704028386875555e-01, 2.414918853028693e-01, - -9.703565153593094e-01, 2.416779532761280e-01, - -9.703101563538281e-01, 2.418640123635792e-01, - -9.702637616728161e-01, 2.420500625583821e-01, - -9.702173313179792e-01, 2.422361038536960e-01, - -9.701708652910245e-01, 2.424221362426809e-01, - -9.701243635936603e-01, 2.426081597184968e-01, - -9.700778262275964e-01, 2.427941742743042e-01, - -9.700312531945440e-01, 2.429801799032639e-01, - -9.699846444962152e-01, 2.431661765985369e-01, - -9.699380001343240e-01, 2.433521643532847e-01, - -9.698913201105851e-01, 2.435381431606691e-01, - -9.698446044267148e-01, 2.437241130138522e-01, - -9.697978530844309e-01, 2.439100739059963e-01, - -9.697510660854521e-01, 2.440960258302642e-01, - -9.697042434314989e-01, 2.442819687798190e-01, - -9.696573851242924e-01, 2.444679027478242e-01, - -9.696104911655559e-01, 2.446538277274433e-01, - -9.695635615570132e-01, 2.448397437118407e-01, - -9.695165963003900e-01, 2.450256506941805e-01, - -9.694695953974131e-01, 2.452115486676275e-01, - -9.694225588498103e-01, 2.453974376253470e-01, - -9.693754866593113e-01, 2.455833175605041e-01, - -9.693283788276467e-01, 2.457691884662646e-01, - -9.692812353565485e-01, 2.459550503357946e-01, - -9.692340562477500e-01, 2.461409031622605e-01, - -9.691868415029860e-01, 2.463267469388290e-01, - -9.691395911239923e-01, 2.465125816586672e-01, - -9.690923051125062e-01, 2.466984073149424e-01, - -9.690449834702662e-01, 2.468842239008224e-01, - -9.689976261990124e-01, 2.470700314094753e-01, - -9.689502333004858e-01, 2.472558298340693e-01, - -9.689028047764289e-01, 2.474416191677733e-01, - -9.688553406285856e-01, 2.476273994037563e-01, - -9.688078408587010e-01, 2.478131705351877e-01, - -9.687603054685214e-01, 2.479989325552371e-01, - -9.687127344597948e-01, 2.481846854570748e-01, - -9.686651278342701e-01, 2.483704292338710e-01, - -9.686174855936975e-01, 2.485561638787966e-01, - -9.685698077398289e-01, 2.487418893850225e-01, - -9.685220942744174e-01, 2.489276057457201e-01, - -9.684743451992168e-01, 2.491133129540614e-01, - -9.684265605159832e-01, 2.492990110032182e-01, - -9.683787402264733e-01, 2.494846998863630e-01, - -9.683308843324452e-01, 2.496703795966686e-01, - -9.682829928356587e-01, 2.498560501273080e-01, - -9.682350657378743e-01, 2.500417114714547e-01, - -9.681871030408544e-01, 2.502273636222824e-01, - -9.681391047463624e-01, 2.504130065729652e-01, - -9.680910708561630e-01, 2.505986403166777e-01, - -9.680430013720223e-01, 2.507842648465945e-01, - -9.679948962957077e-01, 2.509698801558907e-01, - -9.679467556289878e-01, 2.511554862377419e-01, - -9.678985793736327e-01, 2.513410830853239e-01, - -9.678503675314136e-01, 2.515266706918126e-01, - -9.678021201041033e-01, 2.517122490503847e-01, - -9.677538370934755e-01, 2.518978181542170e-01, - -9.677055185013055e-01, 2.520833779964864e-01, - -9.676571643293699e-01, 2.522689285703708e-01, - -9.676087745794465e-01, 2.524544698690477e-01, - -9.675603492533144e-01, 2.526400018856955e-01, - -9.675118883527541e-01, 2.528255246134926e-01, - -9.674633918795476e-01, 2.530110380456179e-01, - -9.674148598354775e-01, 2.531965421752506e-01, - -9.673662922223285e-01, 2.533820369955702e-01, - -9.673176890418863e-01, 2.535675224997566e-01, - -9.672690502959378e-01, 2.537529986809900e-01, - -9.672203759862714e-01, 2.539384655324511e-01, - -9.671716661146766e-01, 2.541239230473206e-01, - -9.671229206829444e-01, 2.543093712187800e-01, - -9.670741396928670e-01, 2.544948100400107e-01, - -9.670253231462380e-01, 2.546802395041948e-01, - -9.669764710448521e-01, 2.548656596045146e-01, - -9.669275833905057e-01, 2.550510703341525e-01, - -9.668786601849959e-01, 2.552364716862917e-01, - -9.668297014301218e-01, 2.554218636541155e-01, - -9.667807071276833e-01, 2.556072462308074e-01, - -9.667316772794818e-01, 2.557926194095516e-01, - -9.666826118873201e-01, 2.559779831835324e-01, - -9.666335109530021e-01, 2.561633375459345e-01, - -9.665843744783331e-01, 2.563486824899429e-01, - -9.665352024651197e-01, 2.565340180087430e-01, - -9.664859949151698e-01, 2.567193440955207e-01, - -9.664367518302927e-01, 2.569046607434619e-01, - -9.663874732122989e-01, 2.570899679457531e-01, - -9.663381590630001e-01, 2.572752656955811e-01, - -9.662888093842097e-01, 2.574605539861331e-01, - -9.662394241777419e-01, 2.576458328105964e-01, - -9.661900034454125e-01, 2.578311021621590e-01, - -9.661405471890387e-01, 2.580163620340090e-01, - -9.660910554104388e-01, 2.582016124193349e-01, - -9.660415281114324e-01, 2.583868533113256e-01, - -9.659919652938406e-01, 2.585720847031703e-01, - -9.659423669594855e-01, 2.587573065880587e-01, - -9.658927331101909e-01, 2.589425189591805e-01, - -9.658430637477815e-01, 2.591277218097262e-01, - -9.657933588740837e-01, 2.593129151328862e-01, - -9.657436184909248e-01, 2.594980989218517e-01, - -9.656938426001337e-01, 2.596832731698138e-01, - -9.656440312035406e-01, 2.598684378699643e-01, - -9.655941843029768e-01, 2.600535930154952e-01, - -9.655443019002752e-01, 2.602387385995988e-01, - -9.654943839972695e-01, 2.604238746154680e-01, - -9.654444305957954e-01, 2.606090010562958e-01, - -9.653944416976894e-01, 2.607941179152755e-01, - -9.653444173047894e-01, 2.609792251856011e-01, - -9.652943574189347e-01, 2.611643228604665e-01, - -9.652442620419658e-01, 2.613494109330664e-01, - -9.651941311757247e-01, 2.615344893965955e-01, - -9.651439648220544e-01, 2.617195582442490e-01, - -9.650937629827996e-01, 2.619046174692226e-01, - -9.650435256598059e-01, 2.620896670647120e-01, - -9.649932528549203e-01, 2.622747070239136e-01, - -9.649429445699914e-01, 2.624597373400240e-01, - -9.648926008068689e-01, 2.626447580062400e-01, - -9.648422215674036e-01, 2.628297690157592e-01, - -9.647918068534479e-01, 2.630147703617790e-01, - -9.647413566668553e-01, 2.631997620374976e-01, - -9.646908710094810e-01, 2.633847440361133e-01, - -9.646403498831809e-01, 2.635697163508249e-01, - -9.645897932898128e-01, 2.637546789748313e-01, - -9.645392012312352e-01, 2.639396319013323e-01, - -9.644885737093084e-01, 2.641245751235275e-01, - -9.644379107258939e-01, 2.643095086346171e-01, - -9.643872122828543e-01, 2.644944324278016e-01, - -9.643364783820537e-01, 2.646793464962819e-01, - -9.642857090253575e-01, 2.648642508332593e-01, - -9.642349042146322e-01, 2.650491454319353e-01, - -9.641840639517458e-01, 2.652340302855118e-01, - -9.641331882385676e-01, 2.654189053871913e-01, - -9.640822770769681e-01, 2.656037707301763e-01, - -9.640313304688193e-01, 2.657886263076699e-01, - -9.639803484159941e-01, 2.659734721128756e-01, - -9.639293309203671e-01, 2.661583081389970e-01, - -9.638782779838142e-01, 2.663431343792382e-01, - -9.638271896082123e-01, 2.665279508268037e-01, - -9.637760657954398e-01, 2.667127574748984e-01, - -9.637249065473765e-01, 2.668975543167273e-01, - -9.636737118659032e-01, 2.670823413454962e-01, - -9.636224817529022e-01, 2.672671185544109e-01, - -9.635712162102573e-01, 2.674518859366776e-01, - -9.635199152398531e-01, 2.676366434855031e-01, - -9.634685788435760e-01, 2.678213911940941e-01, - -9.634172070233133e-01, 2.680061290556583e-01, - -9.633657997809540e-01, 2.681908570634032e-01, - -9.633143571183882e-01, 2.683755752105369e-01, - -9.632628790375071e-01, 2.685602834902679e-01, - -9.632113655402035e-01, 2.687449818958050e-01, - -9.631598166283714e-01, 2.689296704203573e-01, - -9.631082323039062e-01, 2.691143490571344e-01, - -9.630566125687043e-01, 2.692990177993461e-01, - -9.630049574246639e-01, 2.694836766402028e-01, - -9.629532668736839e-01, 2.696683255729151e-01, - -9.629015409176650e-01, 2.698529645906939e-01, - -9.628497795585090e-01, 2.700375936867506e-01, - -9.627979827981190e-01, 2.702222128542969e-01, - -9.627461506383994e-01, 2.704068220865448e-01, - -9.626942830812559e-01, 2.705914213767069e-01, - -9.626423801285957e-01, 2.707760107179960e-01, - -9.625904417823269e-01, 2.709605901036252e-01, - -9.625384680443592e-01, 2.711451595268080e-01, - -9.624864589166034e-01, 2.713297189807584e-01, - -9.624344144009721e-01, 2.715142684586907e-01, - -9.623823344993784e-01, 2.716988079538195e-01, - -9.623302192137374e-01, 2.718833374593597e-01, - -9.622780685459651e-01, 2.720678569685269e-01, - -9.622258824979790e-01, 2.722523664745367e-01, - -9.621736610716979e-01, 2.724368659706052e-01, - -9.621214042690416e-01, 2.726213554499490e-01, - -9.620691120919316e-01, 2.728058349057848e-01, - -9.620167845422906e-01, 2.729903043313299e-01, - -9.619644216220423e-01, 2.731747637198019e-01, - -9.619120233331122e-01, 2.733592130644187e-01, - -9.618595896774266e-01, 2.735436523583987e-01, - -9.618071206569135e-01, 2.737280815949605e-01, - -9.617546162735020e-01, 2.739125007673233e-01, - -9.617020765291225e-01, 2.740969098687064e-01, - -9.616495014257068e-01, 2.742813088923297e-01, - -9.615968909651879e-01, 2.744656978314132e-01, - -9.615442451495000e-01, 2.746500766791777e-01, - -9.614915639805790e-01, 2.748344454288439e-01, - -9.614388474603617e-01, 2.750188040736332e-01, - -9.613860955907862e-01, 2.752031526067673e-01, - -9.613333083737923e-01, 2.753874910214681e-01, - -9.612804858113206e-01, 2.755718193109581e-01, - -9.612276279053135e-01, 2.757561374684601e-01, - -9.611747346577141e-01, 2.759404454871972e-01, - -9.611218060704674e-01, 2.761247433603928e-01, - -9.610688421455194e-01, 2.763090310812711e-01, - -9.610158428848172e-01, 2.764933086430560e-01, - -9.609628082903098e-01, 2.766775760389724e-01, - -9.609097383639468e-01, 2.768618332622453e-01, - -9.608566331076797e-01, 2.770460803060999e-01, - -9.608034925234608e-01, 2.772303171637622e-01, - -9.607503166132440e-01, 2.774145438284581e-01, - -9.606971053789845e-01, 2.775987602934143e-01, - -9.606438588226386e-01, 2.777829665518577e-01, - -9.605905769461641e-01, 2.779671625970154e-01, - -9.605372597515200e-01, 2.781513484221151e-01, - -9.604839072406668e-01, 2.783355240203849e-01, - -9.604305194155658e-01, 2.785196893850531e-01, - -9.603770962781801e-01, 2.787038445093485e-01, - -9.603236378304739e-01, 2.788879893865003e-01, - -9.602701440744128e-01, 2.790721240097378e-01, - -9.602166150119634e-01, 2.792562483722912e-01, - -9.601630506450940e-01, 2.794403624673905e-01, - -9.601094509757739e-01, 2.796244662882666e-01, - -9.600558160059739e-01, 2.798085598281504e-01, - -9.600021457376660e-01, 2.799926430802732e-01, - -9.599484401728232e-01, 2.801767160378670e-01, - -9.598946993134205e-01, 2.803607786941638e-01, - -9.598409231614338e-01, 2.805448310423962e-01, - -9.597871117188399e-01, 2.807288730757972e-01, - -9.597332649876177e-01, 2.809129047876000e-01, - -9.596793829697468e-01, 2.810969261710383e-01, - -9.596254656672082e-01, 2.812809372193461e-01, - -9.595715130819845e-01, 2.814649379257579e-01, - -9.595175252160593e-01, 2.816489282835086e-01, - -9.594635020714175e-01, 2.818329082858334e-01, - -9.594094436500455e-01, 2.820168779259676e-01, - -9.593553499539308e-01, 2.822008371971476e-01, - -9.593012209850622e-01, 2.823847860926094e-01, - -9.592470567454301e-01, 2.825687246055897e-01, - -9.591928572370257e-01, 2.827526527293259e-01, - -9.591386224618419e-01, 2.829365704570554e-01, - -9.590843524218727e-01, 2.831204777820158e-01, - -9.590300471191137e-01, 2.833043746974457e-01, - -9.589757065555611e-01, 2.834882611965835e-01, - -9.589213307332132e-01, 2.836721372726684e-01, - -9.588669196540690e-01, 2.838560029189398e-01, - -9.588124733201293e-01, 2.840398581286372e-01, - -9.587579917333957e-01, 2.842237028950010e-01, - -9.587034748958716e-01, 2.844075372112719e-01, - -9.586489228095612e-01, 2.845913610706904e-01, - -9.585943354764702e-01, 2.847751744664983e-01, - -9.585397128986057e-01, 2.849589773919370e-01, - -9.584850550779761e-01, 2.851427698402487e-01, - -9.584303620165909e-01, 2.853265518046759e-01, - -9.583756337164612e-01, 2.855103232784613e-01, - -9.583208701795989e-01, 2.856940842548483e-01, - -9.582660714080177e-01, 2.858778347270806e-01, - -9.582112374037323e-01, 2.860615746884020e-01, - -9.581563681687588e-01, 2.862453041320571e-01, - -9.581014637051147e-01, 2.864290230512907e-01, - -9.580465240148186e-01, 2.866127314393478e-01, - -9.579915490998904e-01, 2.867964292894741e-01, - -9.579365389623514e-01, 2.869801165949156e-01, - -9.578814936042244e-01, 2.871637933489184e-01, - -9.578264130275329e-01, 2.873474595447295e-01, - -9.577712972343023e-01, 2.875311151755959e-01, - -9.577161462265589e-01, 2.877147602347652e-01, - -9.576609600063306e-01, 2.878983947154852e-01, - -9.576057385756463e-01, 2.880820186110041e-01, - -9.575504819365365e-01, 2.882656319145708e-01, - -9.574951900910326e-01, 2.884492346194342e-01, - -9.574398630411677e-01, 2.886328267188438e-01, - -9.573845007889759e-01, 2.888164082060495e-01, - -9.573291033364928e-01, 2.889999790743014e-01, - -9.572736706857552e-01, 2.891835393168502e-01, - -9.572182028388012e-01, 2.893670889269470e-01, - -9.571626997976702e-01, 2.895506278978430e-01, - -9.571071615644028e-01, 2.897341562227903e-01, - -9.570515881410410e-01, 2.899176738950408e-01, - -9.569959795296282e-01, 2.901011809078471e-01, - -9.569403357322088e-01, 2.902846772544623e-01, - -9.568846567508289e-01, 2.904681629281398e-01, - -9.568289425875354e-01, 2.906516379221332e-01, - -9.567731932443769e-01, 2.908351022296968e-01, - -9.567174087234030e-01, 2.910185558440851e-01, - -9.566615890266651e-01, 2.912019987585529e-01, - -9.566057341562151e-01, 2.913854309663557e-01, - -9.565498441141068e-01, 2.915688524607490e-01, - -9.564939189023951e-01, 2.917522632349893e-01, - -9.564379585231362e-01, 2.919356632823328e-01, - -9.563819629783877e-01, 2.921190525960364e-01, - -9.563259322702082e-01, 2.923024311693576e-01, - -9.562698664006580e-01, 2.924857989955539e-01, - -9.562137653717985e-01, 2.926691560678835e-01, - -9.561576291856921e-01, 2.928525023796048e-01, - -9.561014578444030e-01, 2.930358379239768e-01, - -9.560452513499964e-01, 2.932191626942586e-01, - -9.559890097045389e-01, 2.934024766837101e-01, - -9.559327329100983e-01, 2.935857798855912e-01, - -9.558764209687436e-01, 2.937690722931624e-01, - -9.558200738825454e-01, 2.939523538996847e-01, - -9.557636916535754e-01, 2.941356246984190e-01, - -9.557072742839066e-01, 2.943188846826274e-01, - -9.556508217756133e-01, 2.945021338455717e-01, - -9.555943341307711e-01, 2.946853721805143e-01, - -9.555378113514569e-01, 2.948685996807183e-01, - -9.554812534397488e-01, 2.950518163394467e-01, - -9.554246603977263e-01, 2.952350221499632e-01, - -9.553680322274704e-01, 2.954182171055320e-01, - -9.553113689310627e-01, 2.956014011994174e-01, - -9.552546705105870e-01, 2.957845744248843e-01, - -9.551979369681277e-01, 2.959677367751979e-01, - -9.551411683057708e-01, 2.961508882436238e-01, - -9.550843645256034e-01, 2.963340288234282e-01, - -9.550275256297142e-01, 2.965171585078775e-01, - -9.549706516201928e-01, 2.967002772902383e-01, - -9.549137424991305e-01, 2.968833851637783e-01, - -9.548567982686196e-01, 2.970664821217647e-01, - -9.547998189307537e-01, 2.972495681574658e-01, - -9.547428044876279e-01, 2.974326432641500e-01, - -9.546857549413383e-01, 2.976157074350862e-01, - -9.546286702939827e-01, 2.977987606635435e-01, - -9.545715505476596e-01, 2.979818029427918e-01, - -9.545143957044695e-01, 2.981648342661009e-01, - -9.544572057665135e-01, 2.983478546267414e-01, - -9.543999807358945e-01, 2.985308640179841e-01, - -9.543427206147165e-01, 2.987138624331003e-01, - -9.542854254050847e-01, 2.988968498653618e-01, - -9.542280951091057e-01, 2.990798263080405e-01, - -9.541707297288873e-01, 2.992627917544088e-01, - -9.541133292665388e-01, 2.994457461977399e-01, - -9.540558937241707e-01, 2.996286896313068e-01, - -9.539984231038945e-01, 2.998116220483834e-01, - -9.539409174078235e-01, 2.999945434422436e-01, - -9.538833766380718e-01, 3.001774538061620e-01, - -9.538258007967550e-01, 3.003603531334135e-01, - -9.537681898859903e-01, 3.005432414172735e-01, - -9.537105439078957e-01, 3.007261186510175e-01, - -9.536528628645905e-01, 3.009089848279219e-01, - -9.535951467581957e-01, 3.010918399412631e-01, - -9.535373955908333e-01, 3.012746839843179e-01, - -9.534796093646266e-01, 3.014575169503639e-01, - -9.534217880817003e-01, 3.016403388326788e-01, - -9.533639317441803e-01, 3.018231496245407e-01, - -9.533060403541939e-01, 3.020059493192281e-01, - -9.532481139138693e-01, 3.021887379100200e-01, - -9.531901524253367e-01, 3.023715153901960e-01, - -9.531321558907268e-01, 3.025542817530356e-01, - -9.530741243121722e-01, 3.027370369918191e-01, - -9.530160576918065e-01, 3.029197810998273e-01, - -9.529579560317647e-01, 3.031025140703411e-01, - -9.528998193341829e-01, 3.032852358966417e-01, - -9.528416476011987e-01, 3.034679465720113e-01, - -9.527834408349509e-01, 3.036506460897319e-01, - -9.527251990375796e-01, 3.038333344430864e-01, - -9.526669222112262e-01, 3.040160116253576e-01, - -9.526086103580333e-01, 3.041986776298291e-01, - -9.525502634801449e-01, 3.043813324497849e-01, - -9.524918815797063e-01, 3.045639760785091e-01, - -9.524334646588640e-01, 3.047466085092865e-01, - -9.523750127197659e-01, 3.049292297354024e-01, - -9.523165257645609e-01, 3.051118397501421e-01, - -9.522580037953996e-01, 3.052944385467917e-01, - -9.521994468144336e-01, 3.054770261186374e-01, - -9.521408548238158e-01, 3.056596024589661e-01, - -9.520822278257006e-01, 3.058421675610651e-01, - -9.520235658222436e-01, 3.060247214182218e-01, - -9.519648688156014e-01, 3.062072640237242e-01, - -9.519061368079323e-01, 3.063897953708609e-01, - -9.518473698013956e-01, 3.065723154529207e-01, - -9.517885677981521e-01, 3.067548242631928e-01, - -9.517297308003638e-01, 3.069373217949669e-01, - -9.516708588101939e-01, 3.071198080415331e-01, - -9.516119518298068e-01, 3.073022829961818e-01, - -9.515530098613686e-01, 3.074847466522041e-01, - -9.514940329070464e-01, 3.076671990028912e-01, - -9.514350209690083e-01, 3.078496400415349e-01, - -9.513759740494244e-01, 3.080320697614273e-01, - -9.513168921504656e-01, 3.082144881558611e-01, - -9.512577752743040e-01, 3.083968952181292e-01, - -9.511986234231132e-01, 3.085792909415251e-01, - -9.511394365990682e-01, 3.087616753193425e-01, - -9.510802148043450e-01, 3.089440483448757e-01, - -9.510209580411211e-01, 3.091264100114194e-01, - -9.509616663115751e-01, 3.093087603122687e-01, - -9.509023396178871e-01, 3.094910992407191e-01, - -9.508429779622382e-01, 3.096734267900664e-01, - -9.507835813468111e-01, 3.098557429536071e-01, - -9.507241497737896e-01, 3.100380477246379e-01, - -9.506646832453589e-01, 3.102203410964559e-01, - -9.506051817637053e-01, 3.104026230623587e-01, - -9.505456453310166e-01, 3.105848936156445e-01, - -9.504860739494817e-01, 3.107671527496115e-01, - -9.504264676212909e-01, 3.109494004575586e-01, - -9.503668263486358e-01, 3.111316367327853e-01, - -9.503071501337093e-01, 3.113138615685909e-01, - -9.502474389787052e-01, 3.114960749582759e-01, - -9.501876928858193e-01, 3.116782768951405e-01, - -9.501279118572481e-01, 3.118604673724860e-01, - -9.500680958951896e-01, 3.120426463836135e-01, - -9.500082450018430e-01, 3.122248139218249e-01, - -9.499483591794090e-01, 3.124069699804224e-01, - -9.498884384300893e-01, 3.125891145527087e-01, - -9.498284827560871e-01, 3.127712476319868e-01, - -9.497684921596067e-01, 3.129533692115602e-01, - -9.497084666428538e-01, 3.131354792847328e-01, - -9.496484062080355e-01, 3.133175778448090e-01, - -9.495883108573600e-01, 3.134996648850935e-01, - -9.495281805930367e-01, 3.136817403988915e-01, - -9.494680154172765e-01, 3.138638043795085e-01, - -9.494078153322916e-01, 3.140458568202507e-01, - -9.493475803402952e-01, 3.142278977144244e-01, - -9.492873104435021e-01, 3.144099270553367e-01, - -9.492270056441282e-01, 3.145919448362947e-01, - -9.491666659443907e-01, 3.147739510506061e-01, - -9.491062913465083e-01, 3.149559456915791e-01, - -9.490458818527006e-01, 3.151379287525224e-01, - -9.489854374651887e-01, 3.153199002267449e-01, - -9.489249581861952e-01, 3.155018601075560e-01, - -9.488644440179433e-01, 3.156838083882657e-01, - -9.488038949626585e-01, 3.158657450621840e-01, - -9.487433110225665e-01, 3.160476701226219e-01, - -9.486826921998951e-01, 3.162295835628903e-01, - -9.486220384968730e-01, 3.164114853763010e-01, - -9.485613499157303e-01, 3.165933755561658e-01, - -9.485006264586983e-01, 3.167752540957973e-01, - -9.484398681280096e-01, 3.169571209885081e-01, - -9.483790749258981e-01, 3.171389762276118e-01, - -9.483182468545991e-01, 3.173208198064217e-01, - -9.482573839163491e-01, 3.175026517182523e-01, - -9.481964861133856e-01, 3.176844719564180e-01, - -9.481355534479480e-01, 3.178662805142337e-01, - -9.480745859222762e-01, 3.180480773850149e-01, - -9.480135835386122e-01, 3.182298625620775e-01, - -9.479525462991987e-01, 3.184116360387378e-01, - -9.478914742062798e-01, 3.185933978083124e-01, - -9.478303672621010e-01, 3.187751478641185e-01, - -9.477692254689092e-01, 3.189568861994737e-01, - -9.477080488289521e-01, 3.191386128076959e-01, - -9.476468373444793e-01, 3.193203276821036e-01, - -9.475855910177411e-01, 3.195020308160157e-01, - -9.475243098509896e-01, 3.196837222027514e-01, - -9.474629938464777e-01, 3.198654018356305e-01, - -9.474016430064599e-01, 3.200470697079731e-01, - -9.473402573331920e-01, 3.202287258130999e-01, - -9.472788368289309e-01, 3.204103701443318e-01, - -9.472173814959348e-01, 3.205920026949903e-01, - -9.471558913364633e-01, 3.207736234583973e-01, - -9.470943663527772e-01, 3.209552324278752e-01, - -9.470328065471386e-01, 3.211368295967467e-01, - -9.469712119218109e-01, 3.213184149583349e-01, - -9.469095824790588e-01, 3.214999885059635e-01, - -9.468479182211480e-01, 3.216815502329566e-01, - -9.467862191503460e-01, 3.218631001326386e-01, - -9.467244852689212e-01, 3.220446381983345e-01, - -9.466627165791434e-01, 3.222261644233696e-01, - -9.466009130832835e-01, 3.224076788010699e-01, - -9.465390747836141e-01, 3.225891813247613e-01, - -9.464772016824087e-01, 3.227706719877707e-01, - -9.464152937819421e-01, 3.229521507834253e-01, - -9.463533510844906e-01, 3.231336177050523e-01, - -9.462913735923316e-01, 3.233150727459800e-01, - -9.462293613077438e-01, 3.234965158995367e-01, - -9.461673142330074e-01, 3.236779471590512e-01, - -9.461052323704034e-01, 3.238593665178529e-01, - -9.460431157222146e-01, 3.240407739692714e-01, - -9.459809642907248e-01, 3.242221695066370e-01, - -9.459187780782191e-01, 3.244035531232802e-01, - -9.458565570869839e-01, 3.245849248125321e-01, - -9.457943013193070e-01, 3.247662845677242e-01, - -9.457320107774772e-01, 3.249476323821884e-01, - -9.456696854637847e-01, 3.251289682492571e-01, - -9.456073253805213e-01, 3.253102921622629e-01, - -9.455449305299797e-01, 3.254916041145393e-01, - -9.454825009144537e-01, 3.256729040994198e-01, - -9.454200365362391e-01, 3.258541921102386e-01, - -9.453575373976323e-01, 3.260354681403302e-01, - -9.452950035009312e-01, 3.262167321830297e-01, - -9.452324348484350e-01, 3.263979842316725e-01, - -9.451698314424442e-01, 3.265792242795944e-01, - -9.451071932852606e-01, 3.267604523201317e-01, - -9.450445203791871e-01, 3.269416683466214e-01, - -9.449818127265281e-01, 3.271228723524005e-01, - -9.449190703295892e-01, 3.273040643308067e-01, - -9.448562931906772e-01, 3.274852442751780e-01, - -9.447934813121003e-01, 3.276664121788531e-01, - -9.447306346961678e-01, 3.278475680351708e-01, - -9.446677533451905e-01, 3.280287118374707e-01, - -9.446048372614803e-01, 3.282098435790925e-01, - -9.445418864473505e-01, 3.283909632533766e-01, - -9.444789009051155e-01, 3.285720708536637e-01, - -9.444158806370913e-01, 3.287531663732950e-01, - -9.443528256455948e-01, 3.289342498056122e-01, - -9.442897359329444e-01, 3.291153211439573e-01, - -9.442266115014598e-01, 3.292963803816727e-01, - -9.441634523534618e-01, 3.294774275121017e-01, - -9.441002584912727e-01, 3.296584625285875e-01, - -9.440370299172158e-01, 3.298394854244739e-01, - -9.439737666336160e-01, 3.300204961931054e-01, - -9.439104686427991e-01, 3.302014948278266e-01, - -9.438471359470927e-01, 3.303824813219828e-01, - -9.437837685488251e-01, 3.305634556689195e-01, - -9.437203664503262e-01, 3.307444178619829e-01, - -9.436569296539272e-01, 3.309253678945195e-01, - -9.435934581619604e-01, 3.311063057598764e-01, - -9.435299519767595e-01, 3.312872314514008e-01, - -9.434664111006593e-01, 3.314681449624409e-01, - -9.434028355359962e-01, 3.316490462863447e-01, - -9.433392252851077e-01, 3.318299354164611e-01, - -9.432755803503325e-01, 3.320108123461394e-01, - -9.432119007340106e-01, 3.321916770687292e-01, - -9.431481864384834e-01, 3.323725295775806e-01, - -9.430844374660935e-01, 3.325533698660442e-01, - -9.430206538191847e-01, 3.327341979274711e-01, - -9.429568355001021e-01, 3.329150137552127e-01, - -9.428929825111922e-01, 3.330958173426208e-01, - -9.428290948548027e-01, 3.332766086830479e-01, - -9.427651725332825e-01, 3.334573877698468e-01, - -9.427012155489819e-01, 3.336381545963709e-01, - -9.426372239042525e-01, 3.338189091559736e-01, - -9.425731976014469e-01, 3.339996514420094e-01, - -9.425091366429192e-01, 3.341803814478327e-01, - -9.424450410310249e-01, 3.343610991667987e-01, - -9.423809107681205e-01, 3.345418045922629e-01, - -9.423167458565638e-01, 3.347224977175812e-01, - -9.422525462987140e-01, 3.349031785361102e-01, - -9.421883120969318e-01, 3.350838470412066e-01, - -9.421240432535786e-01, 3.352645032262278e-01, - -9.420597397710173e-01, 3.354451470845316e-01, - -9.419954016516126e-01, 3.356257786094763e-01, - -9.419310288977296e-01, 3.358063977944205e-01, - -9.418666215117353e-01, 3.359870046327234e-01, - -9.418021794959976e-01, 3.361675991177445e-01, - -9.417377028528862e-01, 3.363481812428440e-01, - -9.416731915847714e-01, 3.365287510013824e-01, - -9.416086456940252e-01, 3.367093083867206e-01, - -9.415440651830208e-01, 3.368898533922201e-01, - -9.414794500541326e-01, 3.370703860112426e-01, - -9.414148003097363e-01, 3.372509062371506e-01, - -9.413501159522090e-01, 3.374314140633068e-01, - -9.412853969839287e-01, 3.376119094830746e-01, - -9.412206434072752e-01, 3.377923924898175e-01, - -9.411558552246292e-01, 3.379728630768997e-01, - -9.410910324383728e-01, 3.381533212376859e-01, - -9.410261750508893e-01, 3.383337669655411e-01, - -9.409612830645633e-01, 3.385142002538309e-01, - -9.408963564817808e-01, 3.386946210959212e-01, - -9.408313953049289e-01, 3.388750294851784e-01, - -9.407663995363961e-01, 3.390554254149696e-01, - -9.407013691785719e-01, 3.392358088786619e-01, - -9.406363042338476e-01, 3.394161798696234e-01, - -9.405712047046152e-01, 3.395965383812221e-01, - -9.405060705932683e-01, 3.397768844068269e-01, - -9.404409019022018e-01, 3.399572179398069e-01, - -9.403756986338115e-01, 3.401375389735317e-01, - -9.403104607904951e-01, 3.403178475013717e-01, - -9.402451883746509e-01, 3.404981435166972e-01, - -9.401798813886789e-01, 3.406784270128792e-01, - -9.401145398349803e-01, 3.408586979832894e-01, - -9.400491637159574e-01, 3.410389564212997e-01, - -9.399837530340140e-01, 3.412192023202824e-01, - -9.399183077915550e-01, 3.413994356736104e-01, - -9.398528279909867e-01, 3.415796564746572e-01, - -9.397873136347166e-01, 3.417598647167963e-01, - -9.397217647251533e-01, 3.419400603934022e-01, - -9.396561812647072e-01, 3.421202434978495e-01, - -9.395905632557893e-01, 3.423004140235135e-01, - -9.395249107008122e-01, 3.424805719637698e-01, - -9.394592236021899e-01, 3.426607173119944e-01, - -9.393935019623375e-01, 3.428408500615640e-01, - -9.393277457836714e-01, 3.430209702058555e-01, - -9.392619550686092e-01, 3.432010777382465e-01, - -9.391961298195699e-01, 3.433811726521150e-01, - -9.391302700389736e-01, 3.435612549408394e-01, - -9.390643757292420e-01, 3.437413245977985e-01, - -9.389984468927975e-01, 3.439213816163717e-01, - -9.389324835320646e-01, 3.441014259899388e-01, - -9.388664856494681e-01, 3.442814577118802e-01, - -9.388004532474348e-01, 3.444614767755765e-01, - -9.387343863283925e-01, 3.446414831744090e-01, - -9.386682848947702e-01, 3.448214769017593e-01, - -9.386021489489984e-01, 3.450014579510097e-01, - -9.385359784935086e-01, 3.451814263155425e-01, - -9.384697735307338e-01, 3.453613819887412e-01, - -9.384035340631081e-01, 3.455413249639891e-01, - -9.383372600930670e-01, 3.457212552346701e-01, - -9.382709516230472e-01, 3.459011727941690e-01, - -9.382046086554865e-01, 3.460810776358704e-01, - -9.381382311928244e-01, 3.462609697531600e-01, - -9.380718192375013e-01, 3.464408491394235e-01, - -9.380053727919588e-01, 3.466207157880473e-01, - -9.379388918586403e-01, 3.468005696924183e-01, - -9.378723764399899e-01, 3.469804108459237e-01, - -9.378058265384531e-01, 3.471602392419512e-01, - -9.377392421564770e-01, 3.473400548738891e-01, - -9.376726232965095e-01, 3.475198577351261e-01, - -9.376059699610000e-01, 3.476996478190514e-01, - -9.375392821523992e-01, 3.478794251190545e-01, - -9.374725598731593e-01, 3.480591896285256e-01, - -9.374058031257330e-01, 3.482389413408553e-01, - -9.373390119125750e-01, 3.484186802494346e-01, - -9.372721862361410e-01, 3.485984063476549e-01, - -9.372053260988880e-01, 3.487781196289084e-01, - -9.371384315032741e-01, 3.489578200865875e-01, - -9.370715024517592e-01, 3.491375077140850e-01, - -9.370045389468037e-01, 3.493171825047944e-01, - -9.369375409908699e-01, 3.494968444521095e-01, - -9.368705085864210e-01, 3.496764935494248e-01, - -9.368034417359216e-01, 3.498561297901349e-01, - -9.367363404418376e-01, 3.500357531676352e-01, - -9.366692047066362e-01, 3.502153636753216e-01, - -9.366020345327856e-01, 3.503949613065901e-01, - -9.365348299227555e-01, 3.505745460548375e-01, - -9.364675908790170e-01, 3.507541179134611e-01, - -9.364003174040421e-01, 3.509336768758584e-01, - -9.363330095003042e-01, 3.511132229354275e-01, - -9.362656671702783e-01, 3.512927560855671e-01, - -9.361982904164401e-01, 3.514722763196763e-01, - -9.361308792412670e-01, 3.516517836311546e-01, - -9.360634336472375e-01, 3.518312780134020e-01, - -9.359959536368314e-01, 3.520107594598191e-01, - -9.359284392125297e-01, 3.521902279638068e-01, - -9.358608903768146e-01, 3.523696835187666e-01, - -9.357933071321699e-01, 3.525491261181005e-01, - -9.357256894810804e-01, 3.527285557552107e-01, - -9.356580374260320e-01, 3.529079724235002e-01, - -9.355903509695124e-01, 3.530873761163725e-01, - -9.355226301140099e-01, 3.532667668272312e-01, - -9.354548748620146e-01, 3.534461445494808e-01, - -9.353870852160178e-01, 3.536255092765260e-01, - -9.353192611785116e-01, 3.538048610017721e-01, - -9.352514027519899e-01, 3.539841997186248e-01, - -9.351835099389476e-01, 3.541635254204903e-01, - -9.351155827418809e-01, 3.543428381007755e-01, - -9.350476211632874e-01, 3.545221377528874e-01, - -9.349796252056658e-01, 3.547014243702338e-01, - -9.349115948715161e-01, 3.548806979462228e-01, - -9.348435301633395e-01, 3.550599584742629e-01, - -9.347754310836387e-01, 3.552392059477633e-01, - -9.347072976349174e-01, 3.554184403601336e-01, - -9.346391298196808e-01, 3.555976617047839e-01, - -9.345709276404350e-01, 3.557768699751246e-01, - -9.345026910996879e-01, 3.559560651645668e-01, - -9.344344201999480e-01, 3.561352472665221e-01, - -9.343661149437258e-01, 3.563144162744024e-01, - -9.342977753335325e-01, 3.564935721816201e-01, - -9.342294013718808e-01, 3.566727149815883e-01, - -9.341609930612845e-01, 3.568518446677203e-01, - -9.340925504042590e-01, 3.570309612334300e-01, - -9.340240734033204e-01, 3.572100646721320e-01, - -9.339555620609867e-01, 3.573891549772409e-01, - -9.338870163797769e-01, 3.575682321421723e-01, - -9.338184363622110e-01, 3.577472961603419e-01, - -9.337498220108106e-01, 3.579263470251660e-01, - -9.336811733280984e-01, 3.581053847300616e-01, - -9.336124903165985e-01, 3.582844092684458e-01, - -9.335437729788362e-01, 3.584634206337365e-01, - -9.334750213173380e-01, 3.586424188193520e-01, - -9.334062353346315e-01, 3.588214038187109e-01, - -9.333374150332462e-01, 3.590003756252325e-01, - -9.332685604157120e-01, 3.591793342323365e-01, - -9.331996714845607e-01, 3.593582796334431e-01, - -9.331307482423252e-01, 3.595372118219731e-01, - -9.330617906915394e-01, 3.597161307913476e-01, - -9.329927988347390e-01, 3.598950365349881e-01, - -9.329237726744601e-01, 3.600739290463170e-01, - -9.328547122132411e-01, 3.602528083187569e-01, - -9.327856174536211e-01, 3.604316743457307e-01, - -9.327164883981403e-01, 3.606105271206623e-01, - -9.326473250493404e-01, 3.607893666369756e-01, - -9.325781274097644e-01, 3.609681928880952e-01, - -9.325088954819566e-01, 3.611470058674462e-01, - -9.324396292684624e-01, 3.613258055684543e-01, - -9.323703287718285e-01, 3.615045919845453e-01, - -9.323009939946028e-01, 3.616833651091458e-01, - -9.322316249393345e-01, 3.618621249356830e-01, - -9.321622216085744e-01, 3.620408714575842e-01, - -9.320927840048740e-01, 3.622196046682775e-01, - -9.320233121307865e-01, 3.623983245611913e-01, - -9.319538059888660e-01, 3.625770311297548e-01, - -9.318842655816681e-01, 3.627557243673972e-01, - -9.318146909117497e-01, 3.629344042675486e-01, - -9.317450819816687e-01, 3.631130708236395e-01, - -9.316754387939846e-01, 3.632917240291008e-01, - -9.316057613512578e-01, 3.634703638773638e-01, - -9.315360496560503e-01, 3.636489903618605e-01, - -9.314663037109251e-01, 3.638276034760235e-01, - -9.313965235184466e-01, 3.640062032132855e-01, - -9.313267090811804e-01, 3.641847895670799e-01, - -9.312568604016934e-01, 3.643633625308406e-01, - -9.311869774825537e-01, 3.645419220980021e-01, - -9.311170603263308e-01, 3.647204682619993e-01, - -9.310471089355953e-01, 3.648990010162673e-01, - -9.309771233129189e-01, 3.650775203542422e-01, - -9.309071034608751e-01, 3.652560262693603e-01, - -9.308370493820382e-01, 3.654345187550584e-01, - -9.307669610789837e-01, 3.656129978047739e-01, - -9.306968385542889e-01, 3.657914634119446e-01, - -9.306266818105318e-01, 3.659699155700087e-01, - -9.305564908502918e-01, 3.661483542724053e-01, - -9.304862656761498e-01, 3.663267795125736e-01, - -9.304160062906875e-01, 3.665051912839534e-01, - -9.303457126964885e-01, 3.666835895799849e-01, - -9.302753848961371e-01, 3.668619743941091e-01, - -9.302050228922191e-01, 3.670403457197672e-01, - -9.301346266873214e-01, 3.672187035504010e-01, - -9.300641962840324e-01, 3.673970478794527e-01, - -9.299937316849415e-01, 3.675753787003653e-01, - -9.299232328926397e-01, 3.677536960065820e-01, - -9.298526999097187e-01, 3.679319997915464e-01, - -9.297821327387722e-01, 3.681102900487030e-01, - -9.297115313823944e-01, 3.682885667714966e-01, - -9.296408958431813e-01, 3.684668299533723e-01, - -9.295702261237299e-01, 3.686450795877760e-01, - -9.294995222266386e-01, 3.688233156681539e-01, - -9.294287841545068e-01, 3.690015381879528e-01, - -9.293580119099355e-01, 3.691797471406200e-01, - -9.292872054955268e-01, 3.693579425196031e-01, - -9.292163649138840e-01, 3.695361243183506e-01, - -9.291454901676117e-01, 3.697142925303112e-01, - -9.290745812593159e-01, 3.698924471489341e-01, - -9.290036381916034e-01, 3.700705881676691e-01, - -9.289326609670828e-01, 3.702487155799664e-01, - -9.288616495883637e-01, 3.704268293792768e-01, - -9.287906040580570e-01, 3.706049295590517e-01, - -9.287195243787748e-01, 3.707830161127426e-01, - -9.286484105531305e-01, 3.709610890338020e-01, - -9.285772625837388e-01, 3.711391483156826e-01, - -9.285060804732156e-01, 3.713171939518375e-01, - -9.284348642241780e-01, 3.714952259357208e-01, - -9.283636138392444e-01, 3.716732442607865e-01, - -9.282923293210347e-01, 3.718512489204895e-01, - -9.282210106721694e-01, 3.720292399082850e-01, - -9.281496578952712e-01, 3.722072172176288e-01, - -9.280782709929631e-01, 3.723851808419774e-01, - -9.280068499678700e-01, 3.725631307747873e-01, - -9.279353948226179e-01, 3.727410670095158e-01, - -9.278639055598338e-01, 3.729189895396208e-01, - -9.277923821821463e-01, 3.730968983585606e-01, - -9.277208246921852e-01, 3.732747934597940e-01, - -9.276492330925812e-01, 3.734526748367803e-01, - -9.275776073859667e-01, 3.736305424829793e-01, - -9.275059475749752e-01, 3.738083963918512e-01, - -9.274342536622413e-01, 3.739862365568570e-01, - -9.273625256504011e-01, 3.741640629714579e-01, - -9.272907635420917e-01, 3.743418756291159e-01, - -9.272189673399518e-01, 3.745196745232932e-01, - -9.271471370466209e-01, 3.746974596474526e-01, - -9.270752726647401e-01, 3.748752309950575e-01, - -9.270033741969517e-01, 3.750529885595719e-01, - -9.269314416458991e-01, 3.752307323344599e-01, - -9.268594750142272e-01, 3.754084623131866e-01, - -9.267874743045817e-01, 3.755861784892172e-01, - -9.267154395196103e-01, 3.757638808560177e-01, - -9.266433706619612e-01, 3.759415694070544e-01, - -9.265712677342843e-01, 3.761192441357943e-01, - -9.264991307392305e-01, 3.762969050357048e-01, - -9.264269596794522e-01, 3.764745521002538e-01, - -9.263547545576029e-01, 3.766521853229096e-01, - -9.262825153763372e-01, 3.768298046971413e-01, - -9.262102421383114e-01, 3.770074102164183e-01, - -9.261379348461826e-01, 3.771850018742104e-01, - -9.260655935026093e-01, 3.773625796639883e-01, - -9.259932181102515e-01, 3.775401435792229e-01, - -9.259208086717701e-01, 3.777176936133856e-01, - -9.258483651898273e-01, 3.778952297599485e-01, - -9.257758876670867e-01, 3.780727520123840e-01, - -9.257033761062132e-01, 3.782502603641652e-01, - -9.256308305098727e-01, 3.784277548087656e-01, - -9.255582508807327e-01, 3.786052353396591e-01, - -9.254856372214615e-01, 3.787827019503205e-01, - -9.254129895347291e-01, 3.789601546342247e-01, - -9.253403078232063e-01, 3.791375933848473e-01, - -9.252675920895657e-01, 3.793150181956644e-01, - -9.251948423364805e-01, 3.794924290601526e-01, - -9.251220585666259e-01, 3.796698259717889e-01, - -9.250492407826776e-01, 3.798472089240512e-01, - -9.249763889873132e-01, 3.800245779104173e-01, - -9.249035031832109e-01, 3.802019329243660e-01, - -9.248305833730508e-01, 3.803792739593766e-01, - -9.247576295595139e-01, 3.805566010089285e-01, - -9.246846417452824e-01, 3.807339140665021e-01, - -9.246116199330400e-01, 3.809112131255781e-01, - -9.245385641254714e-01, 3.810884981796375e-01, - -9.244654743252626e-01, 3.812657692221624e-01, - -9.243923505351010e-01, 3.814430262466347e-01, - -9.243191927576752e-01, 3.816202692465374e-01, - -9.242460009956749e-01, 3.817974982153536e-01, - -9.241727752517912e-01, 3.819747131465672e-01, - -9.240995155287163e-01, 3.821519140336626e-01, - -9.240262218291438e-01, 3.823291008701245e-01, - -9.239528941557686e-01, 3.825062736494382e-01, - -9.238795325112867e-01, 3.826834323650898e-01, - -9.238061368983954e-01, 3.828605770105654e-01, - -9.237327073197933e-01, 3.830377075793520e-01, - -9.236592437781800e-01, 3.832148240649372e-01, - -9.235857462762567e-01, 3.833919264608087e-01, - -9.235122148167256e-01, 3.835690147604549e-01, - -9.234386494022904e-01, 3.837460889573650e-01, - -9.233650500356557e-01, 3.839231490450284e-01, - -9.232914167195276e-01, 3.841001950169350e-01, - -9.232177494566135e-01, 3.842772268665755e-01, - -9.231440482496219e-01, 3.844542445874408e-01, - -9.230703131012624e-01, 3.846312481730226e-01, - -9.229965440142462e-01, 3.848082376168129e-01, - -9.229227409912857e-01, 3.849852129123042e-01, - -9.228489040350941e-01, 3.851621740529899e-01, - -9.227750331483864e-01, 3.853391210323633e-01, - -9.227011283338786e-01, 3.855160538439188e-01, - -9.226271895942879e-01, 3.856929724811511e-01, - -9.225532169323328e-01, 3.858698769375553e-01, - -9.224792103507332e-01, 3.860467672066272e-01, - -9.224051698522099e-01, 3.862236432818630e-01, - -9.223310954394854e-01, 3.864005051567594e-01, - -9.222569871152830e-01, 3.865773528248139e-01, - -9.221828448823276e-01, 3.867541862795242e-01, - -9.221086687433452e-01, 3.869310055143886e-01, - -9.220344587010628e-01, 3.871078105229060e-01, - -9.219602147582092e-01, 3.872846012985758e-01, - -9.218859369175140e-01, 3.874613778348979e-01, - -9.218116251817081e-01, 3.876381401253727e-01, - -9.217372795535239e-01, 3.878148881635012e-01, - -9.216629000356947e-01, 3.879916219427849e-01, - -9.215884866309555e-01, 3.881683414567257e-01, - -9.215140393420420e-01, 3.883450466988262e-01, - -9.214395581716914e-01, 3.885217376625896e-01, - -9.213650431226423e-01, 3.886984143415192e-01, - -9.212904941976345e-01, 3.888750767291193e-01, - -9.212159113994087e-01, 3.890517248188944e-01, - -9.211412947307073e-01, 3.892283586043497e-01, - -9.210666441942736e-01, 3.894049780789909e-01, - -9.209919597928523e-01, 3.895815832363243e-01, - -9.209172415291895e-01, 3.897581740698564e-01, - -9.208424894060322e-01, 3.899347505730947e-01, - -9.207677034261288e-01, 3.901113127395469e-01, - -9.206928835922291e-01, 3.902878605627212e-01, - -9.206180299070840e-01, 3.904643940361266e-01, - -9.205431423734455e-01, 3.906409131532724e-01, - -9.204682209940671e-01, 3.908174179076685e-01, - -9.203932657717036e-01, 3.909939082928254e-01, - -9.203182767091106e-01, 3.911703843022539e-01, - -9.202432538090454e-01, 3.913468459294656e-01, - -9.201681970742663e-01, 3.915232931679724e-01, - -9.200931065075332e-01, 3.916997260112869e-01, - -9.200179821116066e-01, 3.918761444529223e-01, - -9.199428238892486e-01, 3.920525484863921e-01, - -9.198676318432230e-01, 3.922289381052103e-01, - -9.197924059762939e-01, 3.924053133028917e-01, - -9.197171462912274e-01, 3.925816740729515e-01, - -9.196418527907905e-01, 3.927580204089053e-01, - -9.195665254777515e-01, 3.929343523042695e-01, - -9.194911643548801e-01, 3.931106697525608e-01, - -9.194157694249471e-01, 3.932869727472964e-01, - -9.193403406907243e-01, 3.934632612819943e-01, - -9.192648781549854e-01, 3.936395353501729e-01, - -9.191893818205045e-01, 3.938157949453510e-01, - -9.191138516900578e-01, 3.939920400610481e-01, - -9.190382877664220e-01, 3.941682706907841e-01, - -9.189626900523756e-01, 3.943444868280796e-01, - -9.188870585506980e-01, 3.945206884664556e-01, - -9.188113932641700e-01, 3.946968755994336e-01, - -9.187356941955735e-01, 3.948730482205358e-01, - -9.186599613476919e-01, 3.950492063232848e-01, - -9.185841947233095e-01, 3.952253499012037e-01, - -9.185083943252123e-01, 3.954014789478164e-01, - -9.184325601561869e-01, 3.955775934566468e-01, - -9.183566922190217e-01, 3.957536934212201e-01, - -9.182807905165061e-01, 3.959297788350613e-01, - -9.182048550514309e-01, 3.961058496916963e-01, - -9.181288858265880e-01, 3.962819059846515e-01, - -9.180528828447704e-01, 3.964579477074539e-01, - -9.179768461087727e-01, 3.966339748536308e-01, - -9.179007756213905e-01, 3.968099874167103e-01, - -9.178246713854206e-01, 3.969859853902209e-01, - -9.177485334036612e-01, 3.971619687676916e-01, - -9.176723616789119e-01, 3.973379375426521e-01, - -9.175961562139730e-01, 3.975138917086323e-01, - -9.175199170116463e-01, 3.976898312591632e-01, - -9.174436440747352e-01, 3.978657561877758e-01, - -9.173673374060439e-01, 3.980416664880018e-01, - -9.172909970083779e-01, 3.982175621533736e-01, - -9.172146228845443e-01, 3.983934431774240e-01, - -9.171382150373507e-01, 3.985693095536863e-01, - -9.170617734696068e-01, 3.987451612756944e-01, - -9.169852981841230e-01, 3.989209983369829e-01, - -9.169087891837110e-01, 3.990968207310865e-01, - -9.168322464711839e-01, 3.992726284515410e-01, - -9.167556700493560e-01, 3.994484214918821e-01, - -9.166790599210427e-01, 3.996241998456468e-01, - -9.166024160890608e-01, 3.997999635063720e-01, - -9.165257385562282e-01, 3.999757124675953e-01, - -9.164490273253642e-01, 4.001514467228551e-01, - -9.163722823992891e-01, 4.003271662656901e-01, - -9.162955037808248e-01, 4.005028710896395e-01, - -9.162186914727942e-01, 4.006785611882432e-01, - -9.161418454780214e-01, 4.008542365550417e-01, - -9.160649657993317e-01, 4.010298971835756e-01, - -9.159880524395520e-01, 4.012055430673867e-01, - -9.159111054015099e-01, 4.013811742000168e-01, - -9.158341246880347e-01, 4.015567905750085e-01, - -9.157571103019567e-01, 4.017323921859050e-01, - -9.156800622461077e-01, 4.019079790262497e-01, - -9.156029805233202e-01, 4.020835510895870e-01, - -9.155258651364285e-01, 4.022591083694615e-01, - -9.154487160882678e-01, 4.024346508594184e-01, - -9.153715333816748e-01, 4.026101785530037e-01, - -9.152943170194870e-01, 4.027856914437635e-01, - -9.152170670045439e-01, 4.029611895252449e-01, - -9.151397833396853e-01, 4.031366727909953e-01, - -9.150624660277529e-01, 4.033121412345625e-01, - -9.149851150715893e-01, 4.034875948494953e-01, - -9.149077304740387e-01, 4.036630336293426e-01, - -9.148303122379462e-01, 4.038384575676541e-01, - -9.147528603661582e-01, 4.040138666579799e-01, - -9.146753748615224e-01, 4.041892608938707e-01, - -9.145978557268878e-01, 4.043646402688778e-01, - -9.145203029651044e-01, 4.045400047765530e-01, - -9.144427165790239e-01, 4.047153544104486e-01, - -9.143650965714986e-01, 4.048906891641176e-01, - -9.142874429453824e-01, 4.050660090311133e-01, - -9.142097557035307e-01, 4.052413140049899e-01, - -9.141320348487995e-01, 4.054166040793016e-01, - -9.140542803840466e-01, 4.055918792476039e-01, - -9.139764923121306e-01, 4.057671395034521e-01, - -9.138986706359117e-01, 4.059423848404025e-01, - -9.138208153582511e-01, 4.061176152520118e-01, - -9.137429264820114e-01, 4.062928307318374e-01, - -9.136650040100563e-01, 4.064680312734370e-01, - -9.135870479452508e-01, 4.066432168703690e-01, - -9.135090582904611e-01, 4.068183875161923e-01, - -9.134310350485547e-01, 4.069935432044665e-01, - -9.133529782224002e-01, 4.071686839287516e-01, - -9.132748878148678e-01, 4.073438096826080e-01, - -9.131967638288282e-01, 4.075189204595969e-01, - -9.131186062671542e-01, 4.076940162532801e-01, - -9.130404151327192e-01, 4.078690970572198e-01, - -9.129621904283982e-01, 4.080441628649787e-01, - -9.128839321570672e-01, 4.082192136701201e-01, - -9.128056403216035e-01, 4.083942494662080e-01, - -9.127273149248859e-01, 4.085692702468068e-01, - -9.126489559697939e-01, 4.087442760054814e-01, - -9.125705634592087e-01, 4.089192667357974e-01, - -9.124921373960126e-01, 4.090942424313210e-01, - -9.124136777830890e-01, 4.092692030856186e-01, - -9.123351846233227e-01, 4.094441486922576e-01, - -9.122566579195998e-01, 4.096190792448057e-01, - -9.121780976748072e-01, 4.097939947368311e-01, - -9.120995038918335e-01, 4.099688951619029e-01, - -9.120208765735683e-01, 4.101437805135902e-01, - -9.119422157229026e-01, 4.103186507854633e-01, - -9.118635213427285e-01, 4.104935059710924e-01, - -9.117847934359394e-01, 4.106683460640487e-01, - -9.117060320054299e-01, 4.108431710579039e-01, - -9.116272370540957e-01, 4.110179809462302e-01, - -9.115484085848340e-01, 4.111927757226002e-01, - -9.114695466005430e-01, 4.113675553805872e-01, - -9.113906511041224e-01, 4.115423199137652e-01, - -9.113117220984728e-01, 4.117170693157086e-01, - -9.112327595864962e-01, 4.118918035799922e-01, - -9.111537635710959e-01, 4.120665227001916e-01, - -9.110747340551764e-01, 4.122412266698829e-01, - -9.109956710416431e-01, 4.124159154826427e-01, - -9.109165745334034e-01, 4.125905891320482e-01, - -9.108374445333650e-01, 4.127652476116773e-01, - -9.107582810444376e-01, 4.129398909151081e-01, - -9.106790840695316e-01, 4.131145190359194e-01, - -9.105998536115589e-01, 4.132891319676910e-01, - -9.105205896734327e-01, 4.134637297040024e-01, - -9.104412922580672e-01, 4.136383122384345e-01, - -9.103619613683780e-01, 4.138128795645683e-01, - -9.102825970072818e-01, 4.139874316759854e-01, - -9.102031991776965e-01, 4.141619685662681e-01, - -9.101237678825417e-01, 4.143364902289991e-01, - -9.100443031247375e-01, 4.145109966577618e-01, - -9.099648049072057e-01, 4.146854878461400e-01, - -9.098852732328692e-01, 4.148599637877183e-01, - -9.098057081046522e-01, 4.150344244760816e-01, - -9.097261095254802e-01, 4.152088699048156e-01, - -9.096464774982795e-01, 4.153833000675062e-01, - -9.095668120259783e-01, 4.155577149577404e-01, - -9.094871131115054e-01, 4.157321145691054e-01, - -9.094073807577913e-01, 4.159064988951888e-01, - -9.093276149677673e-01, 4.160808679295792e-01, - -9.092478157443663e-01, 4.162552216658655e-01, - -9.091679830905224e-01, 4.164295600976372e-01, - -9.090881170091706e-01, 4.166038832184843e-01, - -9.090082175032475e-01, 4.167781910219976e-01, - -9.089282845756906e-01, 4.169524835017682e-01, - -9.088483182294391e-01, 4.171267606513879e-01, - -9.087683184674329e-01, 4.173010224644489e-01, - -9.086882852926134e-01, 4.174752689345443e-01, - -9.086082187079232e-01, 4.176495000552674e-01, - -9.085281187163061e-01, 4.178237158202123e-01, - -9.084479853207073e-01, 4.179979162229736e-01, - -9.083678185240729e-01, 4.181721012571463e-01, - -9.082876183293505e-01, 4.183462709163263e-01, - -9.082073847394887e-01, 4.185204251941097e-01, - -9.081271177574376e-01, 4.186945640840936e-01, - -9.080468173861483e-01, 4.188686875798751e-01, - -9.079664836285734e-01, 4.190427956750524e-01, - -9.078861164876663e-01, 4.192168883632239e-01, - -9.078057159663819e-01, 4.193909656379889e-01, - -9.077252820676764e-01, 4.195650274929469e-01, - -9.076448147945072e-01, 4.197390739216982e-01, - -9.075643141498326e-01, 4.199131049178436e-01, - -9.074837801366126e-01, 4.200871204749845e-01, - -9.074032127578081e-01, 4.202611205867229e-01, - -9.073226120163814e-01, 4.204351052466612e-01, - -9.072419779152958e-01, 4.206090744484025e-01, - -9.071613104575162e-01, 4.207830281855505e-01, - -9.070806096460085e-01, 4.209569664517094e-01, - -9.069998754837396e-01, 4.211308892404840e-01, - -9.069191079736781e-01, 4.213047965454796e-01, - -9.068383071187934e-01, 4.214786883603023e-01, - -9.067574729220566e-01, 4.216525646785583e-01, - -9.066766053864395e-01, 4.218264254938549e-01, - -9.065957045149153e-01, 4.220002707997997e-01, - -9.065147703104588e-01, 4.221741005900008e-01, - -9.064338027760455e-01, 4.223479148580671e-01, - -9.063528019146524e-01, 4.225217135976078e-01, - -9.062717677292577e-01, 4.226954968022330e-01, - -9.061907002228407e-01, 4.228692644655531e-01, - -9.061095993983820e-01, 4.230430165811790e-01, - -9.060284652588636e-01, 4.232167531427226e-01, - -9.059472978072685e-01, 4.233904741437960e-01, - -9.058660970465809e-01, 4.235641795780120e-01, - -9.057848629797866e-01, 4.237378694389838e-01, - -9.057035956098720e-01, 4.239115437203256e-01, - -9.056222949398253e-01, 4.240852024156516e-01, - -9.055409609726356e-01, 4.242588455185770e-01, - -9.054595937112933e-01, 4.244324730227174e-01, - -9.053781931587901e-01, 4.246060849216891e-01, - -9.052967593181188e-01, 4.247796812091088e-01, - -9.052152921922736e-01, 4.249532618785939e-01, - -9.051337917842497e-01, 4.251268269237624e-01, - -9.050522580970436e-01, 4.253003763382326e-01, - -9.049706911336532e-01, 4.254739101156238e-01, - -9.048890908970775e-01, 4.256474282495556e-01, - -9.048074573903165e-01, 4.258209307336482e-01, - -9.047257906163719e-01, 4.259944175615224e-01, - -9.046440905782462e-01, 4.261678887267996e-01, - -9.045623572789433e-01, 4.263413442231018e-01, - -9.044805907214682e-01, 4.265147840440515e-01, - -9.043987909088274e-01, 4.266882081832719e-01, - -9.043169578440283e-01, 4.268616166343864e-01, - -9.042350915300797e-01, 4.270350093910197e-01, - -9.041531919699918e-01, 4.272083864467963e-01, - -9.040712591667754e-01, 4.273817477953418e-01, - -9.039892931234433e-01, 4.275550934302821e-01, - -9.039072938430090e-01, 4.277284233452438e-01, - -9.038252613284875e-01, 4.279017375338541e-01, - -9.037431955828946e-01, 4.280750359897407e-01, - -9.036610966092480e-01, 4.282483187065320e-01, - -9.035789644105661e-01, 4.284215856778567e-01, - -9.034967989898685e-01, 4.285948368973444e-01, - -9.034146003501763e-01, 4.287680723586251e-01, - -9.033323684945118e-01, 4.289412920553295e-01, - -9.032501034258984e-01, 4.291144959810888e-01, - -9.031678051473607e-01, 4.292876841295346e-01, - -9.030854736619246e-01, 4.294608564942995e-01, - -9.030031089726172e-01, 4.296340130690164e-01, - -9.029207110824667e-01, 4.298071538473187e-01, - -9.028382799945028e-01, 4.299802788228406e-01, - -9.027558157117561e-01, 4.301533879892169e-01, - -9.026733182372588e-01, 4.303264813400826e-01, - -9.025907875740439e-01, 4.304995588690738e-01, - -9.025082237251459e-01, 4.306726205698268e-01, - -9.024256266936004e-01, 4.308456664359787e-01, - -9.023429964824442e-01, 4.310186964611670e-01, - -9.022603330947155e-01, 4.311917106390299e-01, - -9.021776365334536e-01, 4.313647089632063e-01, - -9.020949068016989e-01, 4.315376914273355e-01, - -9.020121439024932e-01, 4.317106580250573e-01, - -9.019293478388795e-01, 4.318836087500122e-01, - -9.018465186139017e-01, 4.320565435958415e-01, - -9.017636562306057e-01, 4.322294625561867e-01, - -9.016807606920377e-01, 4.324023656246901e-01, - -9.015978320012457e-01, 4.325752527949946e-01, - -9.015148701612787e-01, 4.327481240607437e-01, - -9.014318751751870e-01, 4.329209794155813e-01, - -9.013488470460220e-01, 4.330938188531520e-01, - -9.012657857768366e-01, 4.332666423671009e-01, - -9.011826913706845e-01, 4.334394499510741e-01, - -9.010995638306210e-01, 4.336122415987176e-01, - -9.010164031597023e-01, 4.337850173036785e-01, - -9.009332093609862e-01, 4.339577770596044e-01, - -9.008499824375314e-01, 4.341305208601433e-01, - -9.007667223923979e-01, 4.343032486989440e-01, - -9.006834292286470e-01, 4.344759605696557e-01, - -9.006001029493409e-01, 4.346486564659283e-01, - -9.005167435575435e-01, 4.348213363814123e-01, - -9.004333510563198e-01, 4.349940003097587e-01, - -9.003499254487356e-01, 4.351666482446193e-01, - -9.002664667378585e-01, 4.353392801796461e-01, - -9.001829749267568e-01, 4.355118961084920e-01, - -9.000994500185004e-01, 4.356844960248105e-01, - -9.000158920161603e-01, 4.358570799222555e-01, - -8.999323009228085e-01, 4.360296477944816e-01, - -8.998486767415186e-01, 4.362021996351440e-01, - -8.997650194753651e-01, 4.363747354378983e-01, - -8.996813291274239e-01, 4.365472551964012e-01, - -8.995976057007722e-01, 4.367197589043094e-01, - -8.995138491984880e-01, 4.368922465552804e-01, - -8.994300596236509e-01, 4.370647181429724e-01, - -8.993462369793416e-01, 4.372371736610441e-01, - -8.992623812686420e-01, 4.374096131031548e-01, - -8.991784924946353e-01, 4.375820364629644e-01, - -8.990945706604058e-01, 4.377544437341334e-01, - -8.990106157690391e-01, 4.379268349103229e-01, - -8.989266278236219e-01, 4.380992099851945e-01, - -8.988426068272424e-01, 4.382715689524104e-01, - -8.987585527829894e-01, 4.384439118056337e-01, - -8.986744656939538e-01, 4.386162385385277e-01, - -8.985903455632270e-01, 4.387885491447563e-01, - -8.985061923939020e-01, 4.389608436179843e-01, - -8.984220061890725e-01, 4.391331219518769e-01, - -8.983377869518343e-01, 4.393053841401000e-01, - -8.982535346852836e-01, 4.394776301763198e-01, - -8.981692493925181e-01, 4.396498600542035e-01, - -8.980849310766368e-01, 4.398220737674185e-01, - -8.980005797407399e-01, 4.399942713096333e-01, - -8.979161953879287e-01, 4.401664526745163e-01, - -8.978317780213056e-01, 4.403386178557372e-01, - -8.977473276439747e-01, 4.405107668469659e-01, - -8.976628442590409e-01, 4.406828996418729e-01, - -8.975783278696102e-01, 4.408550162341294e-01, - -8.974937784787903e-01, 4.410271166174072e-01, - -8.974091960896897e-01, 4.411992007853787e-01, - -8.973245807054183e-01, 4.413712687317167e-01, - -8.972399323290872e-01, 4.415433204500949e-01, - -8.971552509638085e-01, 4.417153559341873e-01, - -8.970705366126959e-01, 4.418873751776689e-01, - -8.969857892788640e-01, 4.420593781742147e-01, - -8.969010089654288e-01, 4.422313649175010e-01, - -8.968161956755073e-01, 4.424033354012041e-01, - -8.967313494122179e-01, 4.425752896190012e-01, - -8.966464701786802e-01, 4.427472275645700e-01, - -8.965615579780150e-01, 4.429191492315890e-01, - -8.964766128133441e-01, 4.430910546137369e-01, - -8.963916346877908e-01, 4.432629437046933e-01, - -8.963066236044795e-01, 4.434348164981385e-01, - -8.962215795665360e-01, 4.436066729877530e-01, - -8.961365025770868e-01, 4.437785131672182e-01, - -8.960513926392601e-01, 4.439503370302161e-01, - -8.959662497561852e-01, 4.441221445704292e-01, - -8.958810739309924e-01, 4.442939357815406e-01, - -8.957958651668135e-01, 4.444657106572340e-01, - -8.957106234667813e-01, 4.446374691911938e-01, - -8.956253488340301e-01, 4.448092113771049e-01, - -8.955400412716950e-01, 4.449809372086527e-01, - -8.954547007829124e-01, 4.451526466795236e-01, - -8.953693273708203e-01, 4.453243397834042e-01, - -8.952839210385576e-01, 4.454960165139817e-01, - -8.951984817892642e-01, 4.456676768649443e-01, - -8.951130096260818e-01, 4.458393208299803e-01, - -8.950275045521526e-01, 4.460109484027789e-01, - -8.949419665706208e-01, 4.461825595770301e-01, - -8.948563956846310e-01, 4.463541543464238e-01, - -8.947707918973296e-01, 4.465257327046513e-01, - -8.946851552118640e-01, 4.466972946454041e-01, - -8.945994856313827e-01, 4.468688401623742e-01, - -8.945137831590356e-01, 4.470403692492544e-01, - -8.944280477979738e-01, 4.472118818997383e-01, - -8.943422795513495e-01, 4.473833781075196e-01, - -8.942564784223160e-01, 4.475548578662930e-01, - -8.941706444140283e-01, 4.477263211697536e-01, - -8.940847775296420e-01, 4.478977680115973e-01, - -8.939988777723142e-01, 4.480691983855204e-01, - -8.939129451452033e-01, 4.482406122852199e-01, - -8.938269796514686e-01, 4.484120097043934e-01, - -8.937409812942710e-01, 4.485833906367392e-01, - -8.936549500767725e-01, 4.487547550759560e-01, - -8.935688860021359e-01, 4.489261030157433e-01, - -8.934827890735259e-01, 4.490974344498010e-01, - -8.933966592941077e-01, 4.492687493718299e-01, - -8.933104966670482e-01, 4.494400477755311e-01, - -8.932243011955153e-01, 4.496113296546065e-01, - -8.931380728826783e-01, 4.497825950027587e-01, - -8.930518117317074e-01, 4.499538438136905e-01, - -8.929655177457744e-01, 4.501250760811057e-01, - -8.928791909280517e-01, 4.502962917987086e-01, - -8.927928312817136e-01, 4.504674909602041e-01, - -8.927064388099354e-01, 4.506386735592976e-01, - -8.926200135158932e-01, 4.508098395896953e-01, - -8.925335554027646e-01, 4.509809890451039e-01, - -8.924470644737287e-01, 4.511521219192306e-01, - -8.923605407319654e-01, 4.513232382057835e-01, - -8.922739841806558e-01, 4.514943378984711e-01, - -8.921873948229825e-01, 4.516654209910025e-01, - -8.921007726621291e-01, 4.518364874770875e-01, - -8.920141177012805e-01, 4.520075373504364e-01, - -8.919274299436225e-01, 4.521785706047604e-01, - -8.918407093923427e-01, 4.523495872337709e-01, - -8.917539560506295e-01, 4.525205872311800e-01, - -8.916671699216723e-01, 4.526915705907009e-01, - -8.915803510086623e-01, 4.528625373060468e-01, - -8.914934993147914e-01, 4.530334873709316e-01, - -8.914066148432529e-01, 4.532044207790702e-01, - -8.913196975972414e-01, 4.533753375241777e-01, - -8.912327475799525e-01, 4.535462375999701e-01, - -8.911457647945832e-01, 4.537171210001639e-01, - -8.910587492443316e-01, 4.538879877184760e-01, - -8.909717009323969e-01, 4.540588377486244e-01, - -8.908846198619795e-01, 4.542296710843273e-01, - -8.907975060362815e-01, 4.544004877193036e-01, - -8.907103594585056e-01, 4.545712876472729e-01, - -8.906231801318559e-01, 4.547420708619554e-01, - -8.905359680595378e-01, 4.549128373570719e-01, - -8.904487232447579e-01, 4.550835871263438e-01, - -8.903614456907238e-01, 4.552543201634931e-01, - -8.902741354006446e-01, 4.554250364622424e-01, - -8.901867923777302e-01, 4.555957360163150e-01, - -8.900994166251923e-01, 4.557664188194346e-01, - -8.900120081462433e-01, 4.559370848653260e-01, - -8.899245669440967e-01, 4.561077341477141e-01, - -8.898370930219679e-01, 4.562783666603246e-01, - -8.897495863830728e-01, 4.564489823968839e-01, - -8.896620470306289e-01, 4.566195813511189e-01, - -8.895744749678546e-01, 4.567901635167572e-01, - -8.894868701979699e-01, 4.569607288875270e-01, - -8.893992327241955e-01, 4.571312774571570e-01, - -8.893115625497539e-01, 4.573018092193766e-01, - -8.892238596778682e-01, 4.574723241679161e-01, - -8.891361241117632e-01, 4.576428222965058e-01, - -8.890483558546646e-01, 4.578133035988772e-01, - -8.889605549097993e-01, 4.579837680687621e-01, - -8.888727212803956e-01, 4.581542156998931e-01, - -8.887848549696828e-01, 4.583246464860032e-01, - -8.886969559808916e-01, 4.584950604208263e-01, - -8.886090243172539e-01, 4.586654574980966e-01, - -8.885210599820023e-01, 4.588358377115491e-01, - -8.884330629783713e-01, 4.590062010549196e-01, - -8.883450333095964e-01, 4.591765475219441e-01, - -8.882569709789139e-01, 4.593468771063596e-01, - -8.881688759895617e-01, 4.595171898019035e-01, - -8.880807483447789e-01, 4.596874856023139e-01, - -8.879925880478056e-01, 4.598577645013295e-01, - -8.879043951018832e-01, 4.600280264926896e-01, - -8.878161695102544e-01, 4.601982715701343e-01, - -8.877279112761630e-01, 4.603684997274040e-01, - -8.876396204028539e-01, 4.605387109582400e-01, - -8.875512968935734e-01, 4.607089052563841e-01, - -8.874629407515688e-01, 4.608790826155787e-01, - -8.873745519800889e-01, 4.610492430295669e-01, - -8.872861305823831e-01, 4.612193864920924e-01, - -8.871976765617029e-01, 4.613895129968995e-01, - -8.871091899213002e-01, 4.615596225377331e-01, - -8.870206706644284e-01, 4.617297151083388e-01, - -8.869321187943422e-01, 4.618997907024627e-01, - -8.868435343142974e-01, 4.620698493138518e-01, - -8.867549172275508e-01, 4.622398909362533e-01, - -8.866662675373610e-01, 4.624099155634154e-01, - -8.865775852469870e-01, 4.625799231890868e-01, - -8.864888703596896e-01, 4.627499138070167e-01, - -8.864001228787306e-01, 4.629198874109551e-01, - -8.863113428073728e-01, 4.630898439946525e-01, - -8.862225301488806e-01, 4.632597835518601e-01, - -8.861336849065193e-01, 4.634297060763298e-01, - -8.860448070835556e-01, 4.635996115618140e-01, - -8.859558966832570e-01, 4.637695000020656e-01, - -8.858669537088928e-01, 4.639393713908385e-01, - -8.857779781637329e-01, 4.641092257218870e-01, - -8.856889700510490e-01, 4.642790629889658e-01, - -8.855999293741134e-01, 4.644488831858307e-01, - -8.855108561362000e-01, 4.646186863062378e-01, - -8.854217503405837e-01, 4.647884723439440e-01, - -8.853326119905406e-01, 4.649582412927067e-01, - -8.852434410893483e-01, 4.651279931462839e-01, - -8.851542376402851e-01, 4.652977278984346e-01, - -8.850650016466309e-01, 4.654674455429178e-01, - -8.849757331116667e-01, 4.656371460734937e-01, - -8.848864320386746e-01, 4.658068294839227e-01, - -8.847970984309378e-01, 4.659764957679662e-01, - -8.847077322917410e-01, 4.661461449193859e-01, - -8.846183336243699e-01, 4.663157769319444e-01, - -8.845289024321115e-01, 4.664853917994049e-01, - -8.844394387182538e-01, 4.666549895155309e-01, - -8.843499424860861e-01, 4.668245700740870e-01, - -8.842604137388992e-01, 4.669941334688380e-01, - -8.841708524799845e-01, 4.671636796935498e-01, - -8.840812587126350e-01, 4.673332087419884e-01, - -8.839916324401449e-01, 4.675027206079209e-01, - -8.839019736658095e-01, 4.676722152851148e-01, - -8.838122823929251e-01, 4.678416927673382e-01, - -8.837225586247897e-01, 4.680111530483598e-01, - -8.836328023647019e-01, 4.681805961219493e-01, - -8.835430136159619e-01, 4.683500219818765e-01, - -8.834531923818709e-01, 4.685194306219123e-01, - -8.833633386657316e-01, 4.686888220358279e-01, - -8.832734524708474e-01, 4.688581962173953e-01, - -8.831835338005234e-01, 4.690275531603871e-01, - -8.830935826580654e-01, 4.691968928585766e-01, - -8.830035990467808e-01, 4.693662153057375e-01, - -8.829135829699780e-01, 4.695355204956445e-01, - -8.828235344309666e-01, 4.697048084220725e-01, - -8.827334534330576e-01, 4.698740790787974e-01, - -8.826433399795628e-01, 4.700433324595956e-01, - -8.825531940737955e-01, 4.702125685582442e-01, - -8.824630157190702e-01, 4.703817873685207e-01, - -8.823728049187023e-01, 4.705509888842035e-01, - -8.822825616760087e-01, 4.707201730990716e-01, - -8.821922859943074e-01, 4.708893400069045e-01, - -8.821019778769176e-01, 4.710584896014825e-01, - -8.820116373271596e-01, 4.712276218765863e-01, - -8.819212643483550e-01, 4.713967368259976e-01, - -8.818308589438266e-01, 4.715658344434984e-01, - -8.817404211168983e-01, 4.717349147228714e-01, - -8.816499508708953e-01, 4.719039776579002e-01, - -8.815594482091438e-01, 4.720730232423687e-01, - -8.814689131349714e-01, 4.722420514700615e-01, - -8.813783456517069e-01, 4.724110623347640e-01, - -8.812877457626801e-01, 4.725800558302622e-01, - -8.811971134712221e-01, 4.727490319503428e-01, - -8.811064487806651e-01, 4.729179906887928e-01, - -8.810157516943429e-01, 4.730869320394001e-01, - -8.809250222155899e-01, 4.732558559959533e-01, - -8.808342603477420e-01, 4.734247625522415e-01, - -8.807434660941363e-01, 4.735936517020545e-01, - -8.806526394581110e-01, 4.737625234391828e-01, - -8.805617804430057e-01, 4.739313777574174e-01, - -8.804708890521608e-01, 4.741002146505500e-01, - -8.803799652889182e-01, 4.742690341123730e-01, - -8.802890091566210e-01, 4.744378361366792e-01, - -8.801980206586132e-01, 4.746066207172626e-01, - -8.801069997982404e-01, 4.747753878479171e-01, - -8.800159465788491e-01, 4.749441375224378e-01, - -8.799248610037869e-01, 4.751128697346203e-01, - -8.798337430764029e-01, 4.752815844782607e-01, - -8.797425928000474e-01, 4.754502817471559e-01, - -8.796514101780716e-01, 4.756189615351033e-01, - -8.795601952138279e-01, 4.757876238359011e-01, - -8.794689479106702e-01, 4.759562686433481e-01, - -8.793776682719533e-01, 4.761248959512436e-01, - -8.792863563010332e-01, 4.762935057533877e-01, - -8.791950120012675e-01, 4.764620980435812e-01, - -8.791036353760143e-01, 4.766306728156253e-01, - -8.790122264286335e-01, 4.767992300633221e-01, - -8.789207851624858e-01, 4.769677697804742e-01, - -8.788293115809334e-01, 4.771362919608848e-01, - -8.787378056873394e-01, 4.773047965983579e-01, - -8.786462674850681e-01, 4.774732836866981e-01, - -8.785546969774854e-01, 4.776417532197105e-01, - -8.784630941679579e-01, 4.778102051912010e-01, - -8.783714590598535e-01, 4.779786395949762e-01, - -8.782797916565416e-01, 4.781470564248430e-01, - -8.781880919613922e-01, 4.783154556746095e-01, - -8.780963599777771e-01, 4.784838373380840e-01, - -8.780045957090691e-01, 4.786522014090755e-01, - -8.779127991586418e-01, 4.788205478813939e-01, - -8.778209703298705e-01, 4.789888767488495e-01, - -8.777291092261316e-01, 4.791571880052533e-01, - -8.776372158508022e-01, 4.793254816444171e-01, - -8.775452902072614e-01, 4.794937576601530e-01, - -8.774533322988886e-01, 4.796620160462742e-01, - -8.773613421290651e-01, 4.798302567965942e-01, - -8.772693197011732e-01, 4.799984799049273e-01, - -8.771772650185959e-01, 4.801666853650884e-01, - -8.770851780847184e-01, 4.803348731708930e-01, - -8.769930589029259e-01, 4.805030433161575e-01, - -8.769009074766057e-01, 4.806711957946986e-01, - -8.768087238091457e-01, 4.808393306003340e-01, - -8.767165079039354e-01, 4.810074477268816e-01, - -8.766242597643653e-01, 4.811755471681603e-01, - -8.765319793938271e-01, 4.813436289179897e-01, - -8.764396667957136e-01, 4.815116929701899e-01, - -8.763473219734190e-01, 4.816797393185815e-01, - -8.762549449303385e-01, 4.818477679569860e-01, - -8.761625356698685e-01, 4.820157788792256e-01, - -8.760700941954066e-01, 4.821837720791227e-01, - -8.759776205103518e-01, 4.823517475505010e-01, - -8.758851146181038e-01, 4.825197052871844e-01, - -8.757925765220639e-01, 4.826876452829975e-01, - -8.757000062256346e-01, 4.828555675317657e-01, - -8.756074037322193e-01, 4.830234720273149e-01, - -8.755147690452229e-01, 4.831913587634719e-01, - -8.754221021680509e-01, 4.833592277340638e-01, - -8.753294031041109e-01, 4.835270789329187e-01, - -8.752366718568109e-01, 4.836949123538651e-01, - -8.751439084295604e-01, 4.838627279907323e-01, - -8.750511128257700e-01, 4.840305258373500e-01, - -8.749582850488516e-01, 4.841983058875490e-01, - -8.748654251022183e-01, 4.843660681351604e-01, - -8.747725329892841e-01, 4.845338125740162e-01, - -8.746796087134645e-01, 4.847015391979487e-01, - -8.745866522781761e-01, 4.848692480007911e-01, - -8.744936636868366e-01, 4.850369389763773e-01, - -8.744006429428648e-01, 4.852046121185418e-01, - -8.743075900496810e-01, 4.853722674211198e-01, - -8.742145050107063e-01, 4.855399048779470e-01, - -8.741213878293633e-01, 4.857075244828598e-01, - -8.740282385090757e-01, 4.858751262296953e-01, - -8.739350570532682e-01, 4.860427101122913e-01, - -8.738418434653669e-01, 4.862102761244864e-01, - -8.737485977487989e-01, 4.863778242601194e-01, - -8.736553199069926e-01, 4.865453545130303e-01, - -8.735620099433778e-01, 4.867128668770592e-01, - -8.734686678613849e-01, 4.868803613460473e-01, - -8.733752936644460e-01, 4.870478379138364e-01, - -8.732818873559942e-01, 4.872152965742688e-01, - -8.731884489394638e-01, 4.873827373211874e-01, - -8.730949784182901e-01, 4.875501601484360e-01, - -8.730014757959099e-01, 4.877175650498588e-01, - -8.729079410757611e-01, 4.878849520193010e-01, - -8.728143742612824e-01, 4.880523210506083e-01, - -8.727207753559143e-01, 4.882196721376268e-01, - -8.726271443630980e-01, 4.883870052742035e-01, - -8.725334812862762e-01, 4.885543204541862e-01, - -8.724397861288923e-01, 4.887216176714231e-01, - -8.723460588943915e-01, 4.888888969197632e-01, - -8.722522995862199e-01, 4.890561581930560e-01, - -8.721585082078245e-01, 4.892234014851520e-01, - -8.720646847626539e-01, 4.893906267899019e-01, - -8.719708292541578e-01, 4.895578341011574e-01, - -8.718769416857869e-01, 4.897250234127709e-01, - -8.717830220609931e-01, 4.898921947185952e-01, - -8.716890703832297e-01, 4.900593480124839e-01, - -8.715950866559510e-01, 4.902264832882912e-01, - -8.715010708826125e-01, 4.903936005398720e-01, - -8.714070230666710e-01, 4.905606997610820e-01, - -8.713129432115840e-01, 4.907277809457774e-01, - -8.712188313208110e-01, 4.908948440878151e-01, - -8.711246873978119e-01, 4.910618891810526e-01, - -8.710305114460483e-01, 4.912289162193483e-01, - -8.709363034689828e-01, 4.913959251965608e-01, - -8.708420634700790e-01, 4.915629161065499e-01, - -8.707477914528018e-01, 4.917298889431758e-01, - -8.706534874206174e-01, 4.918968437002993e-01, - -8.705591513769932e-01, 4.920637803717820e-01, - -8.704647833253977e-01, 4.922306989514860e-01, - -8.703703832693003e-01, 4.923975994332744e-01, - -8.702759512121719e-01, 4.925644818110106e-01, - -8.701814871574846e-01, 4.927313460785588e-01, - -8.700869911087115e-01, 4.928981922297840e-01, - -8.699924630693269e-01, 4.930650202585517e-01, - -8.698979030428063e-01, 4.932318301587279e-01, - -8.698033110326266e-01, 4.933986219241798e-01, - -8.697086870422657e-01, 4.935653955487748e-01, - -8.696140310752023e-01, 4.937321510263810e-01, - -8.695193431349169e-01, 4.938988883508675e-01, - -8.694246232248909e-01, 4.940656075161036e-01, - -8.693298713486068e-01, 4.942323085159597e-01, - -8.692350875095484e-01, 4.943989913443066e-01, - -8.691402717112006e-01, 4.945656559950160e-01, - -8.690454239570495e-01, 4.947323024619599e-01, - -8.689505442505824e-01, 4.948989307390113e-01, - -8.688556325952879e-01, 4.950655408200436e-01, - -8.687606889946553e-01, 4.952321326989312e-01, - -8.686657134521757e-01, 4.953987063695490e-01, - -8.685707059713409e-01, 4.955652618257725e-01, - -8.684756665556441e-01, 4.957317990614780e-01, - -8.683805952085798e-01, 4.958983180705422e-01, - -8.682854919336433e-01, 4.960648188468429e-01, - -8.681903567343313e-01, 4.962313013842582e-01, - -8.680951896141417e-01, 4.963977656766672e-01, - -8.679999905765735e-01, 4.965642117179493e-01, - -8.679047596251269e-01, 4.967306395019848e-01, - -8.678094967633033e-01, 4.968970490226545e-01, - -8.677142019946051e-01, 4.970634402738403e-01, - -8.676188753225362e-01, 4.972298132494242e-01, - -8.675235167506015e-01, 4.973961679432893e-01, - -8.674281262823069e-01, 4.975625043493191e-01, - -8.673327039211598e-01, 4.977288224613979e-01, - -8.672372496706684e-01, 4.978951222734109e-01, - -8.671417635343425e-01, 4.980614037792434e-01, - -8.670462455156926e-01, 4.982276669727819e-01, - -8.669506956182309e-01, 4.983939118479132e-01, - -8.668551138454704e-01, 4.985601383985251e-01, - -8.667595002009254e-01, 4.987263466185059e-01, - -8.666638546881111e-01, 4.988925365017446e-01, - -8.665681773105445e-01, 4.990587080421309e-01, - -8.664724680717430e-01, 4.992248612335551e-01, - -8.663767269752258e-01, 4.993909960699082e-01, - -8.662809540245130e-01, 4.995571125450818e-01, - -8.661851492231258e-01, 4.997232106529685e-01, - -8.660893125745868e-01, 4.998892903874613e-01, - -8.659934440824195e-01, 5.000553517424539e-01, - -8.658975437501488e-01, 5.002213947118407e-01, - -8.658016115813008e-01, 5.003874192895166e-01, - -8.657056475794024e-01, 5.005534254693774e-01, - -8.656096517479820e-01, 5.007194132453199e-01, - -8.655136240905691e-01, 5.008853826112407e-01, - -8.654175646106944e-01, 5.010513335610380e-01, - -8.653214733118898e-01, 5.012172660886100e-01, - -8.652253501976882e-01, 5.013831801878558e-01, - -8.651291952716238e-01, 5.015490758526754e-01, - -8.650330085372319e-01, 5.017149530769691e-01, - -8.649367899980490e-01, 5.018808118546383e-01, - -8.648405396576129e-01, 5.020466521795847e-01, - -8.647442575194624e-01, 5.022124740457108e-01, - -8.646479435871375e-01, 5.023782774469198e-01, - -8.645515978641793e-01, 5.025440623771157e-01, - -8.644552203541304e-01, 5.027098288302030e-01, - -8.643588110605340e-01, 5.028755768000870e-01, - -8.642623699869350e-01, 5.030413062806735e-01, - -8.641658971368793e-01, 5.032070172658689e-01, - -8.640693925139138e-01, 5.033727097495810e-01, - -8.639728561215868e-01, 5.035383837257176e-01, - -8.638762879634475e-01, 5.037040391881871e-01, - -8.637796880430467e-01, 5.038696761308990e-01, - -8.636830563639358e-01, 5.040352945477632e-01, - -8.635863929296681e-01, 5.042008944326903e-01, - -8.634896977437971e-01, 5.043664757795920e-01, - -8.633929708098784e-01, 5.045320385823803e-01, - -8.632962121314682e-01, 5.046975828349676e-01, - -8.631994217121242e-01, 5.048631085312676e-01, - -8.631025995554049e-01, 5.050286156651941e-01, - -8.630057456648703e-01, 5.051941042306622e-01, - -8.629088600440814e-01, 5.053595742215873e-01, - -8.628119426966003e-01, 5.055250256318854e-01, - -8.627149936259907e-01, 5.056904584554734e-01, - -8.626180128358167e-01, 5.058558726862689e-01, - -8.625210003296445e-01, 5.060212683181897e-01, - -8.624239561110406e-01, 5.061866453451552e-01, - -8.623268801835731e-01, 5.063520037610848e-01, - -8.622297725508112e-01, 5.065173435598985e-01, - -8.621326332163254e-01, 5.066826647355176e-01, - -8.620354621836872e-01, 5.068479672818632e-01, - -8.619382594564693e-01, 5.070132511928582e-01, - -8.618410250382453e-01, 5.071785164624252e-01, - -8.617437589325907e-01, 5.073437630844879e-01, - -8.616464611430813e-01, 5.075089910529709e-01, - -8.615491316732947e-01, 5.076742003617989e-01, - -8.614517705268093e-01, 5.078393910048977e-01, - -8.613543777072049e-01, 5.080045629761940e-01, - -8.612569532180622e-01, 5.081697162696146e-01, - -8.611594970629634e-01, 5.083348508790874e-01, - -8.610620092454915e-01, 5.084999667985409e-01, - -8.609644897692310e-01, 5.086650640219040e-01, - -8.608669386377673e-01, 5.088301425431070e-01, - -8.607693558546872e-01, 5.089952023560801e-01, - -8.606717414235784e-01, 5.091602434547546e-01, - -8.605740953480300e-01, 5.093252658330625e-01, - -8.604764176316321e-01, 5.094902694849364e-01, - -8.603787082779761e-01, 5.096552544043093e-01, - -8.602809672906545e-01, 5.098202205851154e-01, - -8.601831946732610e-01, 5.099851680212895e-01, - -8.600853904293901e-01, 5.101500967067668e-01, - -8.599875545626382e-01, 5.103150066354832e-01, - -8.598896870766023e-01, 5.104798978013757e-01, - -8.597917879748807e-01, 5.106447701983816e-01, - -8.596938572610726e-01, 5.108096238204390e-01, - -8.595958949387791e-01, 5.109744586614868e-01, - -8.594979010116017e-01, 5.111392747154644e-01, - -8.593998754831434e-01, 5.113040719763120e-01, - -8.593018183570085e-01, 5.114688504379703e-01, - -8.592037296368019e-01, 5.116336100943812e-01, - -8.591056093261304e-01, 5.117983509394869e-01, - -8.590074574286015e-01, 5.119630729672302e-01, - -8.589092739478239e-01, 5.121277761715547e-01, - -8.588110588874076e-01, 5.122924605464049e-01, - -8.587128122509635e-01, 5.124571260857257e-01, - -8.586145340421042e-01, 5.126217727834630e-01, - -8.585162242644427e-01, 5.127864006335630e-01, - -8.584178829215939e-01, 5.129510096299730e-01, - -8.583195100171734e-01, 5.131155997666406e-01, - -8.582211055547982e-01, 5.132801710375142e-01, - -8.581226695380861e-01, 5.134447234365435e-01, - -8.580242019706565e-01, 5.136092569576778e-01, - -8.579257028561298e-01, 5.137737715948680e-01, - -8.578271721981274e-01, 5.139382673420654e-01, - -8.577286100002721e-01, 5.141027441932217e-01, - -8.576300162661876e-01, 5.142672021422897e-01, - -8.575313909994992e-01, 5.144316411832228e-01, - -8.574327342038327e-01, 5.145960613099750e-01, - -8.573340458828156e-01, 5.147604625165012e-01, - -8.572353260400765e-01, 5.149248447967565e-01, - -8.571365746792450e-01, 5.150892081446972e-01, - -8.570377918039517e-01, 5.152535525542802e-01, - -8.569389774178288e-01, 5.154178780194629e-01, - -8.568401315245092e-01, 5.155821845342038e-01, - -8.567412541276275e-01, 5.157464720924614e-01, - -8.566423452308188e-01, 5.159107406881956e-01, - -8.565434048377200e-01, 5.160749903153666e-01, - -8.564444329519686e-01, 5.162392209679355e-01, - -8.563454295772036e-01, 5.164034326398640e-01, - -8.562463947170652e-01, 5.165676253251144e-01, - -8.561473283751945e-01, 5.167317990176499e-01, - -8.560482305552339e-01, 5.168959537114342e-01, - -8.559491012608269e-01, 5.170600894004319e-01, - -8.558499404956182e-01, 5.172242060786083e-01, - -8.557507482632539e-01, 5.173883037399291e-01, - -8.556515245673807e-01, 5.175523823783609e-01, - -8.555522694116469e-01, 5.177164419878711e-01, - -8.554529827997018e-01, 5.178804825624277e-01, - -8.553536647351960e-01, 5.180445040959993e-01, - -8.552543152217810e-01, 5.182085065825555e-01, - -8.551549342631096e-01, 5.183724900160661e-01, - -8.550555218628360e-01, 5.185364543905022e-01, - -8.549560780246149e-01, 5.187003996998350e-01, - -8.548566027521028e-01, 5.188643259380369e-01, - -8.547570960489572e-01, 5.190282330990809e-01, - -8.546575579188365e-01, 5.191921211769402e-01, - -8.545579883654005e-01, 5.193559901655896e-01, - -8.544583873923102e-01, 5.195198400590038e-01, - -8.543587550032274e-01, 5.196836708511584e-01, - -8.542590912018155e-01, 5.198474825360302e-01, - -8.541593959917388e-01, 5.200112751075960e-01, - -8.540596693766628e-01, 5.201750485598338e-01, - -8.539599113602542e-01, 5.203388028867220e-01, - -8.538601219461808e-01, 5.205025380822397e-01, - -8.537603011381114e-01, 5.206662541403672e-01, - -8.536604489397164e-01, 5.208299510550847e-01, - -8.535605653546668e-01, 5.209936288203739e-01, - -8.534606503866353e-01, 5.211572874302166e-01, - -8.533607040392954e-01, 5.213209268785957e-01, - -8.532607263163219e-01, 5.214845471594943e-01, - -8.531607172213904e-01, 5.216481482668971e-01, - -8.530606767581783e-01, 5.218117301947885e-01, - -8.529606049303636e-01, 5.219752929371544e-01, - -8.528605017416258e-01, 5.221388364879808e-01, - -8.527603671956453e-01, 5.223023608412546e-01, - -8.526602012961038e-01, 5.224658659909638e-01, - -8.525600040466841e-01, 5.226293519310966e-01, - -8.524597754510701e-01, 5.227928186556421e-01, - -8.523595155129471e-01, 5.229562661585901e-01, - -8.522592242360011e-01, 5.231196944339312e-01, - -8.521589016239198e-01, 5.232831034756564e-01, - -8.520585476803917e-01, 5.234464932777578e-01, - -8.519581624091064e-01, 5.236098638342279e-01, - -8.518577458137548e-01, 5.237732151390602e-01, - -8.517572978980291e-01, 5.239365471862486e-01, - -8.516568186656224e-01, 5.240998599697877e-01, - -8.515563081202290e-01, 5.242631534836734e-01, - -8.514557662655443e-01, 5.244264277219014e-01, - -8.513551931052652e-01, 5.245896826784690e-01, - -8.512545886430891e-01, 5.247529183473734e-01, - -8.511539528827153e-01, 5.249161347226130e-01, - -8.510532858278438e-01, 5.250793317981868e-01, - -8.509525874821757e-01, 5.252425095680947e-01, - -8.508518578494135e-01, 5.254056680263369e-01, - -8.507510969332608e-01, 5.255688071669147e-01, - -8.506503047374221e-01, 5.257319269838298e-01, - -8.505494812656035e-01, 5.258950274710846e-01, - -8.504486265215118e-01, 5.260581086226828e-01, - -8.503477405088550e-01, 5.262211704326281e-01, - -8.502468232313427e-01, 5.263842128949251e-01, - -8.501458746926852e-01, 5.265472360035794e-01, - -8.500448948965942e-01, 5.267102397525970e-01, - -8.499438838467822e-01, 5.268732241359846e-01, - -8.498428415469633e-01, 5.270361891477501e-01, - -8.497417680008525e-01, 5.271991347819013e-01, - -8.496406632121659e-01, 5.273620610324475e-01, - -8.495395271846209e-01, 5.275249678933982e-01, - -8.494383599219361e-01, 5.276878553587637e-01, - -8.493371614278308e-01, 5.278507234225552e-01, - -8.492359317060260e-01, 5.280135720787846e-01, - -8.491346707602436e-01, 5.281764013214644e-01, - -8.490333785942068e-01, 5.283392111446077e-01, - -8.489320552116396e-01, 5.285020015422285e-01, - -8.488307006162675e-01, 5.286647725083413e-01, - -8.487293148118171e-01, 5.288275240369619e-01, - -8.486278978020159e-01, 5.289902561221060e-01, - -8.485264495905926e-01, 5.291529687577906e-01, - -8.484249701812776e-01, 5.293156619380333e-01, - -8.483234595778016e-01, 5.294783356568520e-01, - -8.482219177838970e-01, 5.296409899082659e-01, - -8.481203448032972e-01, 5.298036246862946e-01, - -8.480187406397368e-01, 5.299662399849586e-01, - -8.479171052969514e-01, 5.301288357982790e-01, - -8.478154387786779e-01, 5.302914121202773e-01, - -8.477137410886544e-01, 5.304539689449763e-01, - -8.476120122306197e-01, 5.306165062663993e-01, - -8.475102522083143e-01, 5.307790240785701e-01, - -8.474084610254797e-01, 5.309415223755136e-01, - -8.473066386858583e-01, 5.311040011512550e-01, - -8.472047851931941e-01, 5.312664603998204e-01, - -8.471029005512315e-01, 5.314289001152368e-01, - -8.470009847637169e-01, 5.315913202915317e-01, - -8.468990378343972e-01, 5.317537209227333e-01, - -8.467970597670209e-01, 5.319161020028706e-01, - -8.466950505653374e-01, 5.320784635259735e-01, - -8.465930102330972e-01, 5.322408054860722e-01, - -8.464909387740521e-01, 5.324031278771979e-01, - -8.463888361919549e-01, 5.325654306933826e-01, - -8.462867024905597e-01, 5.327277139286588e-01, - -8.461845376736216e-01, 5.328899775770598e-01, - -8.460823417448970e-01, 5.330522216326194e-01, - -8.459801147081433e-01, 5.332144460893730e-01, - -8.458778565671190e-01, 5.333766509413553e-01, - -8.457755673255840e-01, 5.335388361826031e-01, - -8.456732469872991e-01, 5.337010018071530e-01, - -8.455708955560263e-01, 5.338631478090426e-01, - -8.454685130355288e-01, 5.340252741823104e-01, - -8.453660994295710e-01, 5.341873809209954e-01, - -8.452636547419182e-01, 5.343494680191375e-01, - -8.451611789763371e-01, 5.345115354707771e-01, - -8.450586721365955e-01, 5.346735832699555e-01, - -8.449561342264622e-01, 5.348356114107146e-01, - -8.448535652497071e-01, 5.349976198870972e-01, - -8.447509652101015e-01, 5.351596086931466e-01, - -8.446483341114178e-01, 5.353215778229071e-01, - -8.445456719574292e-01, 5.354835272704234e-01, - -8.444429787519107e-01, 5.356454570297411e-01, - -8.443402544986376e-01, 5.358073670949064e-01, - -8.442374992013870e-01, 5.359692574599667e-01, - -8.441347128639369e-01, 5.361311281189695e-01, - -8.440318954900664e-01, 5.362929790659632e-01, - -8.439290470835559e-01, 5.364548102949971e-01, - -8.438261676481867e-01, 5.366166218001210e-01, - -8.437232571877417e-01, 5.367784135753859e-01, - -8.436203157060042e-01, 5.369401856148429e-01, - -8.435173432067592e-01, 5.371019379125441e-01, - -8.434143396937928e-01, 5.372636704625425e-01, - -8.433113051708921e-01, 5.374253832588916e-01, - -8.432082396418454e-01, 5.375870762956454e-01, - -8.431051431104422e-01, 5.377487495668594e-01, - -8.430020155804729e-01, 5.379104030665889e-01, - -8.428988570557293e-01, 5.380720367888906e-01, - -8.427956675400041e-01, 5.382336507278217e-01, - -8.426924470370917e-01, 5.383952448774400e-01, - -8.425891955507867e-01, 5.385568192318041e-01, - -8.424859130848856e-01, 5.387183737849736e-01, - -8.423825996431858e-01, 5.388799085310084e-01, - -8.422792552294860e-01, 5.390414234639694e-01, - -8.421758798475856e-01, 5.392029185779182e-01, - -8.420724735012856e-01, 5.393643938669170e-01, - -8.419690361943877e-01, 5.395258493250289e-01, - -8.418655679306953e-01, 5.396872849463176e-01, - -8.417620687140125e-01, 5.398487007248476e-01, - -8.416585385481448e-01, 5.400100966546840e-01, - -8.415549774368984e-01, 5.401714727298929e-01, - -8.414513853840813e-01, 5.403328289445407e-01, - -8.413477623935020e-01, 5.404941652926952e-01, - -8.412441084689706e-01, 5.406554817684242e-01, - -8.411404236142981e-01, 5.408167783657967e-01, - -8.410367078332966e-01, 5.409780550788821e-01, - -8.409329611297798e-01, 5.411393119017508e-01, - -8.408291835075616e-01, 5.413005488284741e-01, - -8.407253749704581e-01, 5.414617658531234e-01, - -8.406215355222857e-01, 5.416229629697715e-01, - -8.405176651668625e-01, 5.417841401724915e-01, - -8.404137639080075e-01, 5.419452974553574e-01, - -8.403098317495408e-01, 5.421064348124439e-01, - -8.402058686952836e-01, 5.422675522378265e-01, - -8.401018747490584e-01, 5.424286497255812e-01, - -8.399978499146888e-01, 5.425897272697853e-01, - -8.398937941959995e-01, 5.427507848645159e-01, - -8.397897075968164e-01, 5.429118225038517e-01, - -8.396855901209661e-01, 5.430728401818717e-01, - -8.395814417722771e-01, 5.432338378926559e-01, - -8.394772625545786e-01, 5.433948156302848e-01, - -8.393730524717007e-01, 5.435557733888395e-01, - -8.392688115274752e-01, 5.437167111624023e-01, - -8.391645397257347e-01, 5.438776289450560e-01, - -8.390602370703127e-01, 5.440385267308838e-01, - -8.389559035650445e-01, 5.441994045139703e-01, - -8.388515392137658e-01, 5.443602622884004e-01, - -8.387471440203139e-01, 5.445211000482596e-01, - -8.386427179885273e-01, 5.446819177876345e-01, - -8.385382611222453e-01, 5.448427155006124e-01, - -8.384337734253083e-01, 5.450034931812812e-01, - -8.383292549015583e-01, 5.451642508237293e-01, - -8.382247055548381e-01, 5.453249884220465e-01, - -8.381201253889915e-01, 5.454857059703225e-01, - -8.380155144078638e-01, 5.456464034626486e-01, - -8.379108726153012e-01, 5.458070808931161e-01, - -8.378062000151509e-01, 5.459677382558176e-01, - -8.377014966112617e-01, 5.461283755448460e-01, - -8.375967624074830e-01, 5.462889927542952e-01, - -8.374919974076659e-01, 5.464495898782596e-01, - -8.373872016156619e-01, 5.466101669108349e-01, - -8.372823750353243e-01, 5.467707238461168e-01, - -8.371775176705073e-01, 5.469312606782022e-01, - -8.370726295250660e-01, 5.470917774011885e-01, - -8.369677106028570e-01, 5.472522740091741e-01, - -8.368627609077379e-01, 5.474127504962579e-01, - -8.367577804435672e-01, 5.475732068565398e-01, - -8.366527692142050e-01, 5.477336430841201e-01, - -8.365477272235120e-01, 5.478940591731002e-01, - -8.364426544753504e-01, 5.480544551175819e-01, - -8.363375509735835e-01, 5.482148309116678e-01, - -8.362324167220756e-01, 5.483751865494616e-01, - -8.361272517246923e-01, 5.485355220250674e-01, - -8.360220559852999e-01, 5.486958373325901e-01, - -8.359168295077664e-01, 5.488561324661353e-01, - -8.358115722959607e-01, 5.490164074198094e-01, - -8.357062843537526e-01, 5.491766621877197e-01, - -8.356009656850134e-01, 5.493368967639740e-01, - -8.354956162936154e-01, 5.494971111426810e-01, - -8.353902361834319e-01, 5.496573053179499e-01, - -8.352848253583374e-01, 5.498174792838909e-01, - -8.351793838222077e-01, 5.499776330346149e-01, - -8.350739115789194e-01, 5.501377665642336e-01, - -8.349684086323504e-01, 5.502978798668592e-01, - -8.348628749863800e-01, 5.504579729366048e-01, - -8.347573106448882e-01, 5.506180457675843e-01, - -8.346517156117564e-01, 5.507780983539121e-01, - -8.345460898908669e-01, 5.509381306897039e-01, - -8.344404334861032e-01, 5.510981427690754e-01, - -8.343347464013501e-01, 5.512581345861436e-01, - -8.342290286404934e-01, 5.514181061350261e-01, - -8.341232802074201e-01, 5.515780574098410e-01, - -8.340175011060181e-01, 5.517379884047073e-01, - -8.339116913401768e-01, 5.518978991137452e-01, - -8.338058509137863e-01, 5.520577895310750e-01, - -8.336999798307383e-01, 5.522176596508179e-01, - -8.335940780949251e-01, 5.523775094670961e-01, - -8.334881457102408e-01, 5.525373389740321e-01, - -8.333821826805797e-01, 5.526971481657498e-01, - -8.332761890098382e-01, 5.528569370363733e-01, - -8.331701647019132e-01, 5.530167055800275e-01, - -8.330641097607029e-01, 5.531764537908384e-01, - -8.329580241901067e-01, 5.533361816629323e-01, - -8.328519079940251e-01, 5.534958891904366e-01, - -8.327457611763595e-01, 5.536555763674793e-01, - -8.326395837410128e-01, 5.538152431881891e-01, - -8.325333756918887e-01, 5.539748896466955e-01, - -8.324271370328923e-01, 5.541345157371289e-01, - -8.323208677679297e-01, 5.542941214536200e-01, - -8.322145679009080e-01, 5.544537067903009e-01, - -8.321082374357356e-01, 5.546132717413040e-01, - -8.320018763763220e-01, 5.547728163007625e-01, - -8.318954847265776e-01, 5.549323404628104e-01, - -8.317890624904144e-01, 5.550918442215824e-01, - -8.316826096717451e-01, 5.552513275712140e-01, - -8.315761262744837e-01, 5.554107905058416e-01, - -8.314696123025452e-01, 5.555702330196022e-01, - -8.313630677598459e-01, 5.557296551066334e-01, - -8.312564926503032e-01, 5.558890567610738e-01, - -8.311498869778355e-01, 5.560484379770626e-01, - -8.310432507463623e-01, 5.562077987487399e-01, - -8.309365839598044e-01, 5.563671390702464e-01, - -8.308298866220836e-01, 5.565264589357236e-01, - -8.307231587371229e-01, 5.566857583393139e-01, - -8.306164003088463e-01, 5.568450372751601e-01, - -8.305096113411791e-01, 5.570042957374060e-01, - -8.304027918380475e-01, 5.571635337201962e-01, - -8.302959418033791e-01, 5.573227512176762e-01, - -8.301890612411024e-01, 5.574819482239916e-01, - -8.300821501551470e-01, 5.576411247332894e-01, - -8.299752085494440e-01, 5.578002807397170e-01, - -8.298682364279248e-01, 5.579594162374230e-01, - -8.297612337945230e-01, 5.581185312205561e-01, - -8.296542006531726e-01, 5.582776256832663e-01, - -8.295471370078089e-01, 5.584366996197041e-01, - -8.294400428623682e-01, 5.585957530240208e-01, - -8.293329182207883e-01, 5.587547858903683e-01, - -8.292257630870076e-01, 5.589137982128998e-01, - -8.291185774649660e-01, 5.590727899857685e-01, - -8.290113613586044e-01, 5.592317612031289e-01, - -8.289041147718649e-01, 5.593907118591361e-01, - -8.287968377086906e-01, 5.595496419479458e-01, - -8.286895301730258e-01, 5.597085514637147e-01, - -8.285821921688158e-01, 5.598674404006002e-01, - -8.284748237000071e-01, 5.600263087527604e-01, - -8.283674247705475e-01, 5.601851565143541e-01, - -8.282599953843857e-01, 5.603439836795409e-01, - -8.281525355454714e-01, 5.605027902424811e-01, - -8.280450452577558e-01, 5.606615761973360e-01, - -8.279375245251909e-01, 5.608203415382674e-01, - -8.278299733517299e-01, 5.609790862594382e-01, - -8.277223917413272e-01, 5.611378103550114e-01, - -8.276147796979384e-01, 5.612965138191515e-01, - -8.275071372255198e-01, 5.614551966460233e-01, - -8.273994643280295e-01, 5.616138588297924e-01, - -8.272917610094258e-01, 5.617725003646253e-01, - -8.271840272736691e-01, 5.619311212446895e-01, - -8.270762631247203e-01, 5.620897214641525e-01, - -8.269684685665416e-01, 5.622483010171831e-01, - -8.268606436030962e-01, 5.624068598979511e-01, - -8.267527882383485e-01, 5.625653981006266e-01, - -8.266449024762643e-01, 5.627239156193804e-01, - -8.265369863208100e-01, 5.628824124483844e-01, - -8.264290397759535e-01, 5.630408885818112e-01, - -8.263210628456635e-01, 5.631993440138341e-01, - -8.262130555339102e-01, 5.633577787386270e-01, - -8.261050178446646e-01, 5.635161927503648e-01, - -8.259969497818991e-01, 5.636745860432231e-01, - -8.258888513495868e-01, 5.638329586113782e-01, - -8.257807225517024e-01, 5.639913104490070e-01, - -8.256725633922214e-01, 5.641496415502877e-01, - -8.255643738751205e-01, 5.643079519093986e-01, - -8.254561540043776e-01, 5.644662415205195e-01, - -8.253479037839714e-01, 5.646245103778301e-01, - -8.252396232178822e-01, 5.647827584755114e-01, - -8.251313123100911e-01, 5.649409858077452e-01, - -8.250229710645802e-01, 5.650991923687140e-01, - -8.249145994853332e-01, 5.652573781526008e-01, - -8.248061975763343e-01, 5.654155431535897e-01, - -8.246977653415695e-01, 5.655736873658653e-01, - -8.245893027850253e-01, 5.657318107836131e-01, - -8.244808099106895e-01, 5.658899134010196e-01, - -8.243722867225513e-01, 5.660479952122714e-01, - -8.242637332246006e-01, 5.662060562115567e-01, - -8.241551494208286e-01, 5.663640963930638e-01, - -8.240465353152278e-01, 5.665221157509821e-01, - -8.239378909117914e-01, 5.666801142795016e-01, - -8.238292162145140e-01, 5.668380919728133e-01, - -8.237205112273914e-01, 5.669960488251087e-01, - -8.236117759544203e-01, 5.671539848305801e-01, - -8.235030103995985e-01, 5.673118999834208e-01, - -8.233942145669251e-01, 5.674697942778245e-01, - -8.232853884604001e-01, 5.676276677079862e-01, - -8.231765320840249e-01, 5.677855202681011e-01, - -8.230676454418017e-01, 5.679433519523656e-01, - -8.229587285377340e-01, 5.681011627549765e-01, - -8.228497813758264e-01, 5.682589526701315e-01, - -8.227408039600844e-01, 5.684167216920293e-01, - -8.226317962945150e-01, 5.685744698148691e-01, - -8.225227583831259e-01, 5.687321970328510e-01, - -8.224136902299264e-01, 5.688899033401759e-01, - -8.223045918389263e-01, 5.690475887310451e-01, - -8.221954632141372e-01, 5.692052531996612e-01, - -8.220863043595711e-01, 5.693628967402272e-01, - -8.219771152792416e-01, 5.695205193469471e-01, - -8.218678959771633e-01, 5.696781210140256e-01, - -8.217586464573517e-01, 5.698357017356680e-01, - -8.216493667238239e-01, 5.699932615060805e-01, - -8.215400567805976e-01, 5.701508003194703e-01, - -8.214307166316919e-01, 5.703083181700449e-01, - -8.213213462811267e-01, 5.704658150520130e-01, - -8.212119457329236e-01, 5.706232909595838e-01, - -8.211025149911046e-01, 5.707807458869673e-01, - -8.209930540596936e-01, 5.709381798283744e-01, - -8.208835629427146e-01, 5.710955927780167e-01, - -8.207740416441937e-01, 5.712529847301067e-01, - -8.206644901681575e-01, 5.714103556788572e-01, - -8.205549085186339e-01, 5.715677056184826e-01, - -8.204452966996520e-01, 5.717250345431971e-01, - -8.203356547152418e-01, 5.718823424472166e-01, - -8.202259825694347e-01, 5.720396293247570e-01, - -8.201162802662628e-01, 5.721968951700356e-01, - -8.200065478097597e-01, 5.723541399772699e-01, - -8.198967852039598e-01, 5.725113637406788e-01, - -8.197869924528990e-01, 5.726685664544812e-01, - -8.196771695606139e-01, 5.728257481128975e-01, - -8.195673165311422e-01, 5.729829087101486e-01, - -8.194574333685233e-01, 5.731400482404560e-01, - -8.193475200767969e-01, 5.732971666980422e-01, - -8.192375766600045e-01, 5.734542640771304e-01, - -8.191276031221882e-01, 5.736113403719446e-01, - -8.190175994673915e-01, 5.737683955767096e-01, - -8.189075656996590e-01, 5.739254296856507e-01, - -8.187975018230360e-01, 5.740824426929945e-01, - -8.186874078415697e-01, 5.742394345929679e-01, - -8.185772837593076e-01, 5.743964053797987e-01, - -8.184671295802987e-01, 5.745533550477158e-01, - -8.183569453085932e-01, 5.747102835909483e-01, - -8.182467309482421e-01, 5.748671910037267e-01, - -8.181364865032977e-01, 5.750240772802817e-01, - -8.180262119778134e-01, 5.751809424148451e-01, - -8.179159073758439e-01, 5.753377864016495e-01, - -8.178055727014443e-01, 5.754946092349281e-01, - -8.176952079586717e-01, 5.756514109089151e-01, - -8.175848131515837e-01, 5.758081914178453e-01, - -8.174743882842392e-01, 5.759649507559542e-01, - -8.173639333606985e-01, 5.761216889174783e-01, - -8.172534483850223e-01, 5.762784058966549e-01, - -8.171429333612730e-01, 5.764351016877218e-01, - -8.170323882935139e-01, 5.765917762849178e-01, - -8.169218131858095e-01, 5.767484296824824e-01, - -8.168112080422253e-01, 5.769050618746560e-01, - -8.167005728668278e-01, 5.770616728556794e-01, - -8.165899076636849e-01, 5.772182626197949e-01, - -8.164792124368654e-01, 5.773748311612449e-01, - -8.163684871904392e-01, 5.775313784742727e-01, - -8.162577319284774e-01, 5.776879045531228e-01, - -8.161469466550523e-01, 5.778444093920398e-01, - -8.160361313742368e-01, 5.780008929852699e-01, - -8.159252860901055e-01, 5.781573553270594e-01, - -8.158144108067338e-01, 5.783137964116556e-01, - -8.157035055281983e-01, 5.784702162333066e-01, - -8.155925702585768e-01, 5.786266147862614e-01, - -8.154816050019478e-01, 5.787829920647697e-01, - -8.153706097623913e-01, 5.789393480630818e-01, - -8.152595845439883e-01, 5.790956827754491e-01, - -8.151485293508208e-01, 5.792519961961236e-01, - -8.150374441869722e-01, 5.794082883193579e-01, - -8.149263290565266e-01, 5.795645591394056e-01, - -8.148151839635694e-01, 5.797208086505214e-01, - -8.147040089121871e-01, 5.798770368469603e-01, - -8.145928039064673e-01, 5.800332437229782e-01, - -8.144815689504986e-01, 5.801894292728317e-01, - -8.143703040483711e-01, 5.803455934907783e-01, - -8.142590092041753e-01, 5.805017363710765e-01, - -8.141476844220034e-01, 5.806578579079853e-01, - -8.140363297059484e-01, 5.808139580957645e-01, - -8.139249450601046e-01, 5.809700369286748e-01, - -8.138135304885672e-01, 5.811260944009776e-01, - -8.137020859954327e-01, 5.812821305069350e-01, - -8.135906115847985e-01, 5.814381452408102e-01, - -8.134791072607632e-01, 5.815941385968669e-01, - -8.133675730274266e-01, 5.817501105693696e-01, - -8.132560088888894e-01, 5.819060611525838e-01, - -8.131444148492536e-01, 5.820619903407754e-01, - -8.130327909126220e-01, 5.822178981282117e-01, - -8.129211370830988e-01, 5.823737845091601e-01, - -8.128094533647893e-01, 5.825296494778893e-01, - -8.126977397617995e-01, 5.826854930286685e-01, - -8.125859962782371e-01, 5.828413151557676e-01, - -8.124742229182105e-01, 5.829971158534577e-01, - -8.123624196858292e-01, 5.831528951160104e-01, - -8.122505865852039e-01, 5.833086529376983e-01, - -8.121387236204465e-01, 5.834643893127943e-01, - -8.120268307956697e-01, 5.836201042355728e-01, - -8.119149081149878e-01, 5.837757977003081e-01, - -8.118029555825155e-01, 5.839314697012762e-01, - -8.116909732023690e-01, 5.840871202327534e-01, - -8.115789609786659e-01, 5.842427492890170e-01, - -8.114669189155242e-01, 5.843983568643446e-01, - -8.113548470170637e-01, 5.845539429530153e-01, - -8.112427452874048e-01, 5.847095075493084e-01, - -8.111306137306692e-01, 5.848650506475045e-01, - -8.110184523509795e-01, 5.850205722418845e-01, - -8.109062611524597e-01, 5.851760723267304e-01, - -8.107940401392347e-01, 5.853315508963249e-01, - -8.106817893154308e-01, 5.854870079449513e-01, - -8.105695086851746e-01, 5.856424434668944e-01, - -8.104571982525948e-01, 5.857978574564389e-01, - -8.103448580218205e-01, 5.859532499078706e-01, - -8.102324879969823e-01, 5.861086208154764e-01, - -8.101200881822116e-01, 5.862639701735436e-01, - -8.100076585816411e-01, 5.864192979763605e-01, - -8.098951991994044e-01, 5.865746042182162e-01, - -8.097827100396365e-01, 5.867298888934004e-01, - -8.096701911064731e-01, 5.868851519962040e-01, - -8.095576424040513e-01, 5.870403935209180e-01, - -8.094450639365092e-01, 5.871956134618348e-01, - -8.093324557079860e-01, 5.873508118132477e-01, - -8.092198177226217e-01, 5.875059885694500e-01, - -8.091071499845582e-01, 5.876611437247367e-01, - -8.089944524979377e-01, 5.878162772734029e-01, - -8.088817252669036e-01, 5.879713892097450e-01, - -8.087689682956009e-01, 5.881264795280599e-01, - -8.086561815881750e-01, 5.882815482226452e-01, - -8.085433651487730e-01, 5.884365952877998e-01, - -8.084305189815427e-01, 5.885916207178229e-01, - -8.083176430906333e-01, 5.887466245070145e-01, - -8.082047374801947e-01, 5.889016066496757e-01, - -8.080918021543784e-01, 5.890565671401085e-01, - -8.079788371173363e-01, 5.892115059726150e-01, - -8.078658423732221e-01, 5.893664231414988e-01, - -8.077528179261904e-01, 5.895213186410639e-01, - -8.076397637803965e-01, 5.896761924656154e-01, - -8.075266799399972e-01, 5.898310446094588e-01, - -8.074135664091502e-01, 5.899858750669009e-01, - -8.073004231920144e-01, 5.901406838322488e-01, - -8.071872502927500e-01, 5.902954708998108e-01, - -8.070740477155176e-01, 5.904502362638958e-01, - -8.069608154644797e-01, 5.906049799188133e-01, - -8.068475535437993e-01, 5.907597018588742e-01, - -8.067342619576409e-01, 5.909144020783895e-01, - -8.066209407101697e-01, 5.910690805716714e-01, - -8.065075898055523e-01, 5.912237373330329e-01, - -8.063942092479562e-01, 5.913783723567876e-01, - -8.062807990415505e-01, 5.915329856372500e-01, - -8.061673591905044e-01, 5.916875771687354e-01, - -8.060538896989891e-01, 5.918421469455601e-01, - -8.059403905711763e-01, 5.919966949620410e-01, - -8.058268618112393e-01, 5.921512212124955e-01, - -8.057133034233522e-01, 5.923057256912423e-01, - -8.055997154116901e-01, 5.924602083926008e-01, - -8.054860977804292e-01, 5.926146693108911e-01, - -8.053724505337471e-01, 5.927691084404341e-01, - -8.052587736758222e-01, 5.929235257755513e-01, - -8.051450672108342e-01, 5.930779213105655e-01, - -8.050313311429637e-01, 5.932322950397998e-01, - -8.049175654763923e-01, 5.933866469575785e-01, - -8.048037702153029e-01, 5.935409770582264e-01, - -8.046899453638795e-01, 5.936952853360692e-01, - -8.045760909263071e-01, 5.938495717854336e-01, - -8.044622069067718e-01, 5.940038364006467e-01, - -8.043482933094608e-01, 5.941580791760368e-01, - -8.042343501385624e-01, 5.943123001059328e-01, - -8.041203773982658e-01, 5.944664991846644e-01, - -8.040063750927615e-01, 5.946206764065622e-01, - -8.038923432262413e-01, 5.947748317659576e-01, - -8.037782818028976e-01, 5.949289652571824e-01, - -8.036641908269241e-01, 5.950830768745700e-01, - -8.035500703025157e-01, 5.952371666124538e-01, - -8.034359202338681e-01, 5.953912344651687e-01, - -8.033217406251786e-01, 5.955452804270498e-01, - -8.032075314806449e-01, 5.956993044924334e-01, - -8.030932928044664e-01, 5.958533066556563e-01, - -8.029790246008432e-01, 5.960072869110565e-01, - -8.028647268739767e-01, 5.961612452529725e-01, - -8.027503996280692e-01, 5.963151816757437e-01, - -8.026360428673242e-01, 5.964690961737104e-01, - -8.025216565959464e-01, 5.966229887412132e-01, - -8.024072408181413e-01, 5.967768593725944e-01, - -8.022927955381157e-01, 5.969307080621965e-01, - -8.021783207600774e-01, 5.970845348043627e-01, - -8.020638164882354e-01, 5.972383395934374e-01, - -8.019492827267998e-01, 5.973921224237657e-01, - -8.018347194799813e-01, 5.975458832896932e-01, - -8.017201267519923e-01, 5.976996221855668e-01, - -8.016055045470462e-01, 5.978533391057339e-01, - -8.014908528693570e-01, 5.980070340445427e-01, - -8.013761717231402e-01, 5.981607069963423e-01, - -8.012614611126125e-01, 5.983143579554826e-01, - -8.011467210419914e-01, 5.984679869163143e-01, - -8.010319515154953e-01, 5.986215938731889e-01, - -8.009171525373443e-01, 5.987751788204587e-01, - -8.008023241117591e-01, 5.989287417524769e-01, - -8.006874662429616e-01, 5.990822826635973e-01, - -8.005725789351749e-01, 5.992358015481746e-01, - -8.004576621926228e-01, 5.993892984005645e-01, - -8.003427160195307e-01, 5.995427732151234e-01, - -8.002277404201248e-01, 5.996962259862083e-01, - -8.001127353986324e-01, 5.998496567081772e-01, - -7.999977009592819e-01, 6.000030653753889e-01, - -7.998826371063028e-01, 6.001564519822032e-01, - -7.997675438439257e-01, 6.003098165229804e-01, - -7.996524211763822e-01, 6.004631589920816e-01, - -7.995372691079050e-01, 6.006164793838690e-01, - -7.994220876427280e-01, 6.007697776927052e-01, - -7.993068767850862e-01, 6.009230539129541e-01, - -7.991916365392152e-01, 6.010763080389802e-01, - -7.990763669093524e-01, 6.012295400651485e-01, - -7.989610678997358e-01, 6.013827499858254e-01, - -7.988457395146046e-01, 6.015359377953777e-01, - -7.987303817581992e-01, 6.016891034881730e-01, - -7.986149946347608e-01, 6.018422470585800e-01, - -7.984995781485321e-01, 6.019953685009680e-01, - -7.983841323037564e-01, 6.021484678097072e-01, - -7.982686571046784e-01, 6.023015449791685e-01, - -7.981531525555438e-01, 6.024546000037238e-01, - -7.980376186605994e-01, 6.026076328777454e-01, - -7.979220554240930e-01, 6.027606435956072e-01, - -7.978064628502736e-01, 6.029136321516830e-01, - -7.976908409433912e-01, 6.030665985403482e-01, - -7.975751897076967e-01, 6.032195427559784e-01, - -7.974595091474425e-01, 6.033724647929503e-01, - -7.973437992668817e-01, 6.035253646456415e-01, - -7.972280600702688e-01, 6.036782423084304e-01, - -7.971122915618589e-01, 6.038310977756959e-01, - -7.969964937459088e-01, 6.039839310418180e-01, - -7.968806666266758e-01, 6.041367421011775e-01, - -7.967648102084188e-01, 6.042895309481560e-01, - -7.966489244953973e-01, 6.044422975771359e-01, - -7.965330094918720e-01, 6.045950419825004e-01, - -7.964170652021050e-01, 6.047477641586334e-01, - -7.963010916303591e-01, 6.049004640999198e-01, - -7.961850887808984e-01, 6.050531418007453e-01, - -7.960690566579880e-01, 6.052057972554965e-01, - -7.959529952658939e-01, 6.053584304585605e-01, - -7.958369046088836e-01, 6.055110414043255e-01, - -7.957207846912251e-01, 6.056636300871804e-01, - -7.956046355171881e-01, 6.058161965015150e-01, - -7.954884570910430e-01, 6.059687406417197e-01, - -7.953722494170613e-01, 6.061212625021861e-01, - -7.952560124995156e-01, 6.062737620773064e-01, - -7.951397463426796e-01, 6.064262393614736e-01, - -7.950234509508280e-01, 6.065786943490813e-01, - -7.949071263282370e-01, 6.067311270345245e-01, - -7.947907724791832e-01, 6.068835374121985e-01, - -7.946743894079445e-01, 6.070359254764996e-01, - -7.945579771188004e-01, 6.071882912218252e-01, - -7.944415356160306e-01, 6.073406346425729e-01, - -7.943250649039165e-01, 6.074929557331415e-01, - -7.942085649867406e-01, 6.076452544879308e-01, - -7.940920358687860e-01, 6.077975309013411e-01, - -7.939754775543372e-01, 6.079497849677736e-01, - -7.938588900476797e-01, 6.081020166816304e-01, - -7.937422733531002e-01, 6.082542260373145e-01, - -7.936256274748863e-01, 6.084064130292292e-01, - -7.935089524173267e-01, 6.085585776517795e-01, - -7.933922481847111e-01, 6.087107198993703e-01, - -7.932755147813306e-01, 6.088628397664082e-01, - -7.931587522114771e-01, 6.090149372472998e-01, - -7.930419604794436e-01, 6.091670123364532e-01, - -7.929251395895243e-01, 6.093190650282768e-01, - -7.928082895460141e-01, 6.094710953171802e-01, - -7.926914103532094e-01, 6.096231031975737e-01, - -7.925745020154077e-01, 6.097750886638684e-01, - -7.924575645369071e-01, 6.099270517104761e-01, - -7.923405979220072e-01, 6.100789923318096e-01, - -7.922236021750083e-01, 6.102309105222826e-01, - -7.921065773002124e-01, 6.103828062763095e-01, - -7.919895233019218e-01, 6.105346795883053e-01, - -7.918724401844405e-01, 6.106865304526863e-01, - -7.917553279520732e-01, 6.108383588638692e-01, - -7.916381866091259e-01, 6.109901648162717e-01, - -7.915210161599052e-01, 6.111419483043126e-01, - -7.914038166087195e-01, 6.112937093224109e-01, - -7.912865879598778e-01, 6.114454478649870e-01, - -7.911693302176902e-01, 6.115971639264619e-01, - -7.910520433864680e-01, 6.117488575012573e-01, - -7.909347274705233e-01, 6.119005285837961e-01, - -7.908173824741698e-01, 6.120521771685015e-01, - -7.907000084017216e-01, 6.122038032497980e-01, - -7.905826052574945e-01, 6.123554068221106e-01, - -7.904651730458049e-01, 6.125069878798656e-01, - -7.903477117709705e-01, 6.126585464174893e-01, - -7.902302214373100e-01, 6.128100824294097e-01, - -7.901127020491433e-01, 6.129615959100552e-01, - -7.899951536107911e-01, 6.131130868538549e-01, - -7.898775761265753e-01, 6.132645552552390e-01, - -7.897599696008191e-01, 6.134160011086386e-01, - -7.896423340378463e-01, 6.135674244084853e-01, - -7.895246694419822e-01, 6.137188251492117e-01, - -7.894069758175529e-01, 6.138702033252513e-01, - -7.892892531688857e-01, 6.140215589310384e-01, - -7.891715015003089e-01, 6.141728919610080e-01, - -7.890537208161519e-01, 6.143242024095960e-01, - -7.889359111207452e-01, 6.144754902712390e-01, - -7.888180724184203e-01, 6.146267555403750e-01, - -7.887002047135097e-01, 6.147779982114421e-01, - -7.885823080103471e-01, 6.149292182788796e-01, - -7.884643823132675e-01, 6.150804157371275e-01, - -7.883464276266063e-01, 6.152315905806268e-01, - -7.882284439547005e-01, 6.153827428038192e-01, - -7.881104313018881e-01, 6.155338724011473e-01, - -7.879923896725080e-01, 6.156849793670546e-01, - -7.878743190709002e-01, 6.158360636959851e-01, - -7.877562195014061e-01, 6.159871253823838e-01, - -7.876380909683675e-01, 6.161381644206969e-01, - -7.875199334761278e-01, 6.162891808053710e-01, - -7.874017470290314e-01, 6.164401745308536e-01, - -7.872835316314236e-01, 6.165911455915931e-01, - -7.871652872876510e-01, 6.167420939820387e-01, - -7.870470140020608e-01, 6.168930196966407e-01, - -7.869287117790018e-01, 6.170439227298498e-01, - -7.868103806228235e-01, 6.171948030761176e-01, - -7.866920205378768e-01, 6.173456607298968e-01, - -7.865736315285132e-01, 6.174964956856409e-01, - -7.864552135990858e-01, 6.176473079378039e-01, - -7.863367667539483e-01, 6.177980974808410e-01, - -7.862182909974557e-01, 6.179488643092081e-01, - -7.860997863339639e-01, 6.180996084173620e-01, - -7.859812527678302e-01, 6.182503297997602e-01, - -7.858626903034126e-01, 6.184010284508610e-01, - -7.857440989450704e-01, 6.185517043651237e-01, - -7.856254786971637e-01, 6.187023575370085e-01, - -7.855068295640539e-01, 6.188529879609763e-01, - -7.853881515501036e-01, 6.190035956314887e-01, - -7.852694446596759e-01, 6.191541805430084e-01, - -7.851507088971356e-01, 6.193047426899987e-01, - -7.850319442668481e-01, 6.194552820669240e-01, - -7.849131507731800e-01, 6.196057986682493e-01, - -7.847943284204992e-01, 6.197562924884407e-01, - -7.846754772131743e-01, 6.199067635219647e-01, - -7.845565971555752e-01, 6.200572117632891e-01, - -7.844376882520728e-01, 6.202076372068824e-01, - -7.843187505070389e-01, 6.203580398472137e-01, - -7.841997839248466e-01, 6.205084196787534e-01, - -7.840807885098700e-01, 6.206587766959721e-01, - -7.839617642664841e-01, 6.208091108933419e-01, - -7.838427111990652e-01, 6.209594222653352e-01, - -7.837236293119905e-01, 6.211097108064256e-01, - -7.836045186096382e-01, 6.212599765110876e-01, - -7.834853790963878e-01, 6.214102193737961e-01, - -7.833662107766197e-01, 6.215604393890273e-01, - -7.832470136547154e-01, 6.217106365512577e-01, - -7.831277877350573e-01, 6.218608108549654e-01, - -7.830085330220291e-01, 6.220109622946286e-01, - -7.828892495200155e-01, 6.221610908647268e-01, - -7.827699372334020e-01, 6.223111965597403e-01, - -7.826505961665757e-01, 6.224612793741500e-01, - -7.825312263239242e-01, 6.226113393024377e-01, - -7.824118277098365e-01, 6.227613763390863e-01, - -7.822924003287024e-01, 6.229113904785795e-01, - -7.821729441849130e-01, 6.230613817154013e-01, - -7.820534592828603e-01, 6.232113500440373e-01, - -7.819339456269376e-01, 6.233612954589732e-01, - -7.818144032215388e-01, 6.235112179546964e-01, - -7.816948320710594e-01, 6.236611175256945e-01, - -7.815752321798956e-01, 6.238109941664561e-01, - -7.814556035524446e-01, 6.239608478714707e-01, - -7.813359461931049e-01, 6.241106786352285e-01, - -7.812162601062761e-01, 6.242604864522207e-01, - -7.810965452963585e-01, 6.244102713169393e-01, - -7.809768017677537e-01, 6.245600332238772e-01, - -7.808570295248646e-01, 6.247097721675281e-01, - -7.807372285720945e-01, 6.248594881423863e-01, - -7.806173989138484e-01, 6.250091811429475e-01, - -7.804975405545319e-01, 6.251588511637076e-01, - -7.803776534985520e-01, 6.253084981991640e-01, - -7.802577377503166e-01, 6.254581222438144e-01, - -7.801377933142346e-01, 6.256077232921574e-01, - -7.800178201947160e-01, 6.257573013386929e-01, - -7.798978183961720e-01, 6.259068563779211e-01, - -7.797777879230146e-01, 6.260563884043435e-01, - -7.796577287796569e-01, 6.262058974124621e-01, - -7.795376409705133e-01, 6.263553833967800e-01, - -7.794175244999989e-01, 6.265048463518008e-01, - -7.792973793725303e-01, 6.266542862720293e-01, - -7.791772055925247e-01, 6.268037031519712e-01, - -7.790570031644006e-01, 6.269530969861327e-01, - -7.789367720925775e-01, 6.271024677690209e-01, - -7.788165123814760e-01, 6.272518154951441e-01, - -7.786962240355175e-01, 6.274011401590110e-01, - -7.785759070591250e-01, 6.275504417551315e-01, - -7.784555614567219e-01, 6.276997202780162e-01, - -7.783351872327332e-01, 6.278489757221765e-01, - -7.782147843915845e-01, 6.279982080821247e-01, - -7.780943529377028e-01, 6.281474173523740e-01, - -7.779738928755161e-01, 6.282966035274383e-01, - -7.778534042094531e-01, 6.284457666018327e-01, - -7.777328869439440e-01, 6.285949065700726e-01, - -7.776123410834200e-01, 6.287440234266747e-01, - -7.774917666323130e-01, 6.288931171661565e-01, - -7.773711635950563e-01, 6.290421877830360e-01, - -7.772505319760841e-01, 6.291912352718323e-01, - -7.771298717798316e-01, 6.293402596270656e-01, - -7.770091830107353e-01, 6.294892608432566e-01, - -7.768884656732324e-01, 6.296382389149270e-01, - -7.767677197717615e-01, 6.297871938365992e-01, - -7.766469453107621e-01, 6.299361256027964e-01, - -7.765261422946744e-01, 6.300850342080432e-01, - -7.764053107279404e-01, 6.302339196468644e-01, - -7.762844506150025e-01, 6.303827819137859e-01, - -7.761635619603043e-01, 6.305316210033346e-01, - -7.760426447682908e-01, 6.306804369100380e-01, - -7.759216990434077e-01, 6.308292296284245e-01, - -7.758007247901016e-01, 6.309779991530235e-01, - -7.756797220128206e-01, 6.311267454783653e-01, - -7.755586907160136e-01, 6.312754685989808e-01, - -7.754376309041305e-01, 6.314241685094019e-01, - -7.753165425816225e-01, 6.315728452041610e-01, - -7.751954257529414e-01, 6.317214986777923e-01, - -7.750742804225405e-01, 6.318701289248299e-01, - -7.749531065948739e-01, 6.320187359398091e-01, - -7.748319042743969e-01, 6.321673197172659e-01, - -7.747106734655655e-01, 6.323158802517376e-01, - -7.745894141728376e-01, 6.324644175377618e-01, - -7.744681264006709e-01, 6.326129315698774e-01, - -7.743468101535251e-01, 6.327614223426240e-01, - -7.742254654358607e-01, 6.329098898505418e-01, - -7.741040922521390e-01, 6.330583340881721e-01, - -7.739826906068229e-01, 6.332067550500572e-01, - -7.738612605043755e-01, 6.333551527307400e-01, - -7.737398019492618e-01, 6.335035271247643e-01, - -7.736183149459475e-01, 6.336518782266749e-01, - -7.734967994988990e-01, 6.338002060310173e-01, - -7.733752556125845e-01, 6.339485105323378e-01, - -7.732536832914726e-01, 6.340967917251837e-01, - -7.731320825400331e-01, 6.342450496041033e-01, - -7.730104533627370e-01, 6.343932841636455e-01, - -7.728887957640562e-01, 6.345414953983600e-01, - -7.727671097484639e-01, 6.346896833027977e-01, - -7.726453953204339e-01, 6.348378478715100e-01, - -7.725236524844413e-01, 6.349859890990495e-01, - -7.724018812449625e-01, 6.351341069799692e-01, - -7.722800816064743e-01, 6.352822015088234e-01, - -7.721582535734552e-01, 6.354302726801672e-01, - -7.720363971503845e-01, 6.355783204885561e-01, - -7.719145123417424e-01, 6.357263449285471e-01, - -7.717925991520102e-01, 6.358743459946977e-01, - -7.716706575856703e-01, 6.360223236815663e-01, - -7.715486876472063e-01, 6.361702779837122e-01, - -7.714266893411026e-01, 6.363182088956955e-01, - -7.713046626718448e-01, 6.364661164120772e-01, - -7.711826076439193e-01, 6.366140005274191e-01, - -7.710605242618138e-01, 6.367618612362842e-01, - -7.709384125300169e-01, 6.369096985332359e-01, - -7.708162724530185e-01, 6.370575124128386e-01, - -7.706941040353091e-01, 6.372053028696576e-01, - -7.705719072813808e-01, 6.373530698982591e-01, - -7.704496821957260e-01, 6.375008134932102e-01, - -7.703274287828389e-01, 6.376485336490788e-01, - -7.702051470472142e-01, 6.377962303604335e-01, - -7.700828369933479e-01, 6.379439036218440e-01, - -7.699604986257372e-01, 6.380915534278808e-01, - -7.698381319488798e-01, 6.382391797731153e-01, - -7.697157369672751e-01, 6.383867826521196e-01, - -7.695933136854229e-01, 6.385343620594668e-01, - -7.694708621078247e-01, 6.386819179897307e-01, - -7.693483822389823e-01, 6.388294504374863e-01, - -7.692258740833993e-01, 6.389769593973091e-01, - -7.691033376455797e-01, 6.391244448637757e-01, - -7.689807729300289e-01, 6.392719068314635e-01, - -7.688581799412533e-01, 6.394193452949507e-01, - -7.687355586837603e-01, 6.395667602488163e-01, - -7.686129091620584e-01, 6.397141516876405e-01, - -7.684902313806569e-01, 6.398615196060039e-01, - -7.683675253440663e-01, 6.400088639984884e-01, - -7.682447910567983e-01, 6.401561848596765e-01, - -7.681220285233654e-01, 6.403034821841517e-01, - -7.679992377482813e-01, 6.404507559664981e-01, - -7.678764187360606e-01, 6.405980062013010e-01, - -7.677535714912190e-01, 6.407452328831464e-01, - -7.676306960182734e-01, 6.408924360066214e-01, - -7.675077923217413e-01, 6.410396155663134e-01, - -7.673848604061417e-01, 6.411867715568113e-01, - -7.672619002759945e-01, 6.413339039727043e-01, - -7.671389119358204e-01, 6.414810128085832e-01, - -7.670158953901415e-01, 6.416280980590388e-01, - -7.668928506434807e-01, 6.417751597186635e-01, - -7.667697777003619e-01, 6.419221977820502e-01, - -7.666466765653104e-01, 6.420692122437925e-01, - -7.665235472428522e-01, 6.422162030984854e-01, - -7.664003897375142e-01, 6.423631703407243e-01, - -7.662772040538247e-01, 6.425101139651057e-01, - -7.661539901963129e-01, 6.426570339662269e-01, - -7.660307481695090e-01, 6.428039303386860e-01, - -7.659074779779443e-01, 6.429508030770821e-01, - -7.657841796261510e-01, 6.430976521760151e-01, - -7.656608531186625e-01, 6.432444776300859e-01, - -7.655374984600131e-01, 6.433912794338958e-01, - -7.654141156547383e-01, 6.435380575820477e-01, - -7.652907047073744e-01, 6.436848120691449e-01, - -7.651672656224590e-01, 6.438315428897914e-01, - -7.650437984045305e-01, 6.439782500385927e-01, - -7.649203030581284e-01, 6.441249335101545e-01, - -7.647967795877935e-01, 6.442715932990838e-01, - -7.646732279980671e-01, 6.444182293999884e-01, - -7.645496482934921e-01, 6.445648418074766e-01, - -7.644260404786121e-01, 6.447114305161583e-01, - -7.643024045579717e-01, 6.448579955206437e-01, - -7.641787405361167e-01, 6.450045368155439e-01, - -7.640550484175940e-01, 6.451510543954712e-01, - -7.639313282069511e-01, 6.452975482550384e-01, - -7.638075799087372e-01, 6.454440183888592e-01, - -7.636838035275019e-01, 6.455904647915487e-01, - -7.635599990677961e-01, 6.457368874577223e-01, - -7.634361665341720e-01, 6.458832863819963e-01, - -7.633123059311824e-01, 6.460296615589883e-01, - -7.631884172633813e-01, 6.461760129833163e-01, - -7.630645005353237e-01, 6.463223406495995e-01, - -7.629405557515657e-01, 6.464686445524578e-01, - -7.628165829166644e-01, 6.466149246865120e-01, - -7.626925820351780e-01, 6.467611810463839e-01, - -7.625685531116654e-01, 6.469074136266960e-01, - -7.624444961506872e-01, 6.470536224220715e-01, - -7.623204111568043e-01, 6.471998074271352e-01, - -7.621962981345789e-01, 6.473459686365121e-01, - -7.620721570885746e-01, 6.474921060448281e-01, - -7.619479880233554e-01, 6.476382196467103e-01, - -7.618237909434870e-01, 6.477843094367864e-01, - -7.616995658535354e-01, 6.479303754096853e-01, - -7.615753127580680e-01, 6.480764175600365e-01, - -7.614510316616536e-01, 6.482224358824704e-01, - -7.613267225688614e-01, 6.483684303716183e-01, - -7.612023854842618e-01, 6.485144010221124e-01, - -7.610780204124266e-01, 6.486603478285858e-01, - -7.609536273579282e-01, 6.488062707856725e-01, - -7.608292063253400e-01, 6.489521698880073e-01, - -7.607047573192369e-01, 6.490980451302260e-01, - -7.605802803441944e-01, 6.492438965069649e-01, - -7.604557754047893e-01, 6.493897240128617e-01, - -7.603312425055990e-01, 6.495355276425547e-01, - -7.602066816512024e-01, 6.496813073906832e-01, - -7.600820928461793e-01, 6.498270632518871e-01, - -7.599574760951103e-01, 6.499727952208075e-01, - -7.598328314025774e-01, 6.501185032920862e-01, - -7.597081587731634e-01, 6.502641874603659e-01, - -7.595834582114520e-01, 6.504098477202903e-01, - -7.594587297220282e-01, 6.505554840665039e-01, - -7.593339733094779e-01, 6.507010964936520e-01, - -7.592091889783881e-01, 6.508466849963809e-01, - -7.590843767333466e-01, 6.509922495693377e-01, - -7.589595365789424e-01, 6.511377902071703e-01, - -7.588346685197657e-01, 6.512833069045277e-01, - -7.587097725604074e-01, 6.514287996560598e-01, - -7.585848487054596e-01, 6.515742684564170e-01, - -7.584598969595154e-01, 6.517197133002509e-01, - -7.583349173271690e-01, 6.518651341822139e-01, - -7.582099098130153e-01, 6.520105310969595e-01, - -7.580848744216507e-01, 6.521559040391416e-01, - -7.579598111576723e-01, 6.523012530034155e-01, - -7.578347200256783e-01, 6.524465779844367e-01, - -7.577096010302681e-01, 6.525918789768624e-01, - -7.575844541760418e-01, 6.527371559753503e-01, - -7.574592794676007e-01, 6.528824089745588e-01, - -7.573340769095471e-01, 6.530276379691475e-01, - -7.572088465064846e-01, 6.531728429537768e-01, - -7.570835882630171e-01, 6.533180239231077e-01, - -7.569583021837505e-01, 6.534631808718023e-01, - -7.568329882732908e-01, 6.536083137945239e-01, - -7.567076465362457e-01, 6.537534226859361e-01, - -7.565822769772235e-01, 6.538985075407038e-01, - -7.564568796008337e-01, 6.540435683534926e-01, - -7.563314544116869e-01, 6.541886051189690e-01, - -7.562060014143945e-01, 6.543336178318004e-01, - -7.560805206135691e-01, 6.544786064866553e-01, - -7.559550120138244e-01, 6.546235710782027e-01, - -7.558294756197748e-01, 6.547685116011126e-01, - -7.557039114360359e-01, 6.549134280500560e-01, - -7.555783194672245e-01, 6.550583204197049e-01, - -7.554526997179583e-01, 6.552031887047318e-01, - -7.553270521928557e-01, 6.553480328998105e-01, - -7.552013768965365e-01, 6.554928529996153e-01, - -7.550756738336216e-01, 6.556376489988218e-01, - -7.549499430087326e-01, 6.557824208921060e-01, - -7.548241844264924e-01, 6.559271686741454e-01, - -7.546983980915245e-01, 6.560718923396176e-01, - -7.545725840084538e-01, 6.562165918832019e-01, - -7.544467421819064e-01, 6.563612672995780e-01, - -7.543208726165088e-01, 6.565059185834266e-01, - -7.541949753168892e-01, 6.566505457294289e-01, - -7.540690502876761e-01, 6.567951487322681e-01, - -7.539430975334996e-01, 6.569397275866271e-01, - -7.538171170589908e-01, 6.570842822871902e-01, - -7.536911088687812e-01, 6.572288128286425e-01, - -7.535650729675043e-01, 6.573733192056702e-01, - -7.534390093597936e-01, 6.575178014129601e-01, - -7.533129180502843e-01, 6.576622594452001e-01, - -7.531867990436125e-01, 6.578066932970786e-01, - -7.530606523444151e-01, 6.579511029632855e-01, - -7.529344779573302e-01, 6.580954884385112e-01, - -7.528082758869970e-01, 6.582398497174469e-01, - -7.526820461380553e-01, 6.583841867947850e-01, - -7.525557887151464e-01, 6.585284996652186e-01, - -7.524295036229124e-01, 6.586727883234419e-01, - -7.523031908659964e-01, 6.588170527641495e-01, - -7.521768504490428e-01, 6.589612929820373e-01, - -7.520504823766964e-01, 6.591055089718021e-01, - -7.519240866536036e-01, 6.592497007281415e-01, - -7.517976632844116e-01, 6.593938682457539e-01, - -7.516712122737684e-01, 6.595380115193387e-01, - -7.515447336263237e-01, 6.596821305435961e-01, - -7.514182273467275e-01, 6.598262253132273e-01, - -7.512916934396309e-01, 6.599702958229345e-01, - -7.511651319096865e-01, 6.601143420674205e-01, - -7.510385427615474e-01, 6.602583640413890e-01, - -7.509119259998679e-01, 6.604023617395450e-01, - -7.507852816293037e-01, 6.605463351565939e-01, - -7.506586096545107e-01, 6.606902842872423e-01, - -7.505319100801464e-01, 6.608342091261976e-01, - -7.504051829108693e-01, 6.609781096681681e-01, - -7.502784281513387e-01, 6.611219859078629e-01, - -7.501516458062151e-01, 6.612658378399923e-01, - -7.500248358801598e-01, 6.614096654592669e-01, - -7.498979983778353e-01, 6.615534687603989e-01, - -7.497711333039051e-01, 6.616972477381010e-01, - -7.496442406630335e-01, 6.618410023870869e-01, - -7.495173204598862e-01, 6.619847327020709e-01, - -7.493903726991296e-01, 6.621284386777687e-01, - -7.492633973854311e-01, 6.622721203088966e-01, - -7.491363945234594e-01, 6.624157775901718e-01, - -7.490093641178839e-01, 6.625594105163123e-01, - -7.488823061733751e-01, 6.627030190820374e-01, - -7.487552206946048e-01, 6.628466032820669e-01, - -7.486281076862454e-01, 6.629901631111215e-01, - -7.485009671529704e-01, 6.631336985639230e-01, - -7.483737990994546e-01, 6.632772096351941e-01, - -7.482466035303734e-01, 6.634206963196583e-01, - -7.481193804504036e-01, 6.635641586120398e-01, - -7.479921298642227e-01, 6.637075965070640e-01, - -7.478648517765094e-01, 6.638510099994573e-01, - -7.477375461919433e-01, 6.639943990839466e-01, - -7.476102131152051e-01, 6.641377637552600e-01, - -7.474828525509766e-01, 6.642811040081262e-01, - -7.473554645039402e-01, 6.644244198372752e-01, - -7.472280489787799e-01, 6.645677112374375e-01, - -7.471006059801801e-01, 6.647109782033448e-01, - -7.469731355128268e-01, 6.648542207297297e-01, - -7.468456375814065e-01, 6.649974388113253e-01, - -7.467181121906071e-01, 6.651406324428661e-01, - -7.465905593451173e-01, 6.652838016190872e-01, - -7.464629790496268e-01, 6.654269463347247e-01, - -7.463353713088263e-01, 6.655700665845155e-01, - -7.462077361274078e-01, 6.657131623631976e-01, - -7.460800735100638e-01, 6.658562336655097e-01, - -7.459523834614883e-01, 6.659992804861915e-01, - -7.458246659863761e-01, 6.661423028199835e-01, - -7.456969210894228e-01, 6.662853006616273e-01, - -7.455691487753254e-01, 6.664282740058652e-01, - -7.454413490487817e-01, 6.665712228474406e-01, - -7.453135219144905e-01, 6.667141471810977e-01, - -7.451856673771516e-01, 6.668570470015812e-01, - -7.450577854414661e-01, 6.669999223036375e-01, - -7.449298761121353e-01, 6.671427730820133e-01, - -7.448019393938626e-01, 6.672855993314564e-01, - -7.446739752913517e-01, 6.674284010467155e-01, - -7.445459838093074e-01, 6.675711782225403e-01, - -7.444179649524356e-01, 6.677139308536810e-01, - -7.442899187254433e-01, 6.678566589348893e-01, - -7.441618451330382e-01, 6.679993624609174e-01, - -7.440337441799293e-01, 6.681420414265185e-01, - -7.439056158708265e-01, 6.682846958264467e-01, - -7.437774602104409e-01, 6.684273256554568e-01, - -7.436492772034841e-01, 6.685699309083050e-01, - -7.435210668546691e-01, 6.687125115797480e-01, - -7.433928291687100e-01, 6.688550676645436e-01, - -7.432645641503216e-01, 6.689975991574503e-01, - -7.431362718042198e-01, 6.691401060532276e-01, - -7.430079521351217e-01, 6.692825883466360e-01, - -7.428796051477452e-01, 6.694250460324369e-01, - -7.427512308468090e-01, 6.695674791053925e-01, - -7.426228292370335e-01, 6.697098875602658e-01, - -7.424944003231392e-01, 6.698522713918210e-01, - -7.423659441098485e-01, 6.699946305948230e-01, - -7.422374606018840e-01, 6.701369651640376e-01, - -7.421089498039699e-01, 6.702792750942318e-01, - -7.419804117208311e-01, 6.704215603801731e-01, - -7.418518463571935e-01, 6.705638210166300e-01, - -7.417232537177841e-01, 6.707060569983722e-01, - -7.415946338073311e-01, 6.708482683201696e-01, - -7.414659866305633e-01, 6.709904549767942e-01, - -7.413373121922107e-01, 6.711326169630177e-01, - -7.412086104970043e-01, 6.712747542736135e-01, - -7.410798815496761e-01, 6.714168669033554e-01, - -7.409511253549591e-01, 6.715589548470183e-01, - -7.408223419175873e-01, 6.717010180993783e-01, - -7.406935312422958e-01, 6.718430566552119e-01, - -7.405646933338202e-01, 6.719850705092969e-01, - -7.404358281968980e-01, 6.721270596564117e-01, - -7.403069358362669e-01, 6.722690240913359e-01, - -7.401780162566662e-01, 6.724109638088498e-01, - -7.400490694628356e-01, 6.725528788037347e-01, - -7.399200954595162e-01, 6.726947690707729e-01, - -7.397910942514500e-01, 6.728366346047473e-01, - -7.396620658433800e-01, 6.729784754004421e-01, - -7.395330102400502e-01, 6.731202914526421e-01, - -7.394039274462058e-01, 6.732620827561330e-01, - -7.392748174665925e-01, 6.734038493057017e-01, - -7.391456803059575e-01, 6.735455910961361e-01, - -7.390165159690487e-01, 6.736873081222243e-01, - -7.388873244606151e-01, 6.738290003787560e-01, - -7.387581057854069e-01, 6.739706678605216e-01, - -7.386288599481748e-01, 6.741123105623124e-01, - -7.384995869536711e-01, 6.742539284789204e-01, - -7.383702868066486e-01, 6.743955216051390e-01, - -7.382409595118613e-01, 6.745370899357620e-01, - -7.381116050740643e-01, 6.746786334655845e-01, - -7.379822234980136e-01, 6.748201521894022e-01, - -7.378528147884660e-01, 6.749616461020119e-01, - -7.377233789501797e-01, 6.751031151982114e-01, - -7.375939159879136e-01, 6.752445594727993e-01, - -7.374644259064276e-01, 6.753859789205748e-01, - -7.373349087104829e-01, 6.755273735363385e-01, - -7.372053644048412e-01, 6.756687433148919e-01, - -7.370757929942657e-01, 6.758100882510369e-01, - -7.369461944835203e-01, 6.759514083395770e-01, - -7.368165688773699e-01, 6.760927035753159e-01, - -7.366869161805805e-01, 6.762339739530590e-01, - -7.365572363979191e-01, 6.763752194676116e-01, - -7.364275295341537e-01, 6.765164401137811e-01, - -7.362977955940532e-01, 6.766576358863750e-01, - -7.361680345823874e-01, 6.767988067802018e-01, - -7.360382465039274e-01, 6.769399527900711e-01, - -7.359084313634452e-01, 6.770810739107935e-01, - -7.357785891657136e-01, 6.772221701371803e-01, - -7.356487199155065e-01, 6.773632414640439e-01, - -7.355188236175989e-01, 6.775042878861974e-01, - -7.353889002767667e-01, 6.776453093984549e-01, - -7.352589498977868e-01, 6.777863059956315e-01, - -7.351289724854372e-01, 6.779272776725430e-01, - -7.349989680444967e-01, 6.780682244240066e-01, - -7.348689365797452e-01, 6.782091462448399e-01, - -7.347388780959635e-01, 6.783500431298615e-01, - -7.346087925979335e-01, 6.784909150738911e-01, - -7.344786800904384e-01, 6.786317620717494e-01, - -7.343485405782616e-01, 6.787725841182577e-01, - -7.342183740661883e-01, 6.789133812082384e-01, - -7.340881805590040e-01, 6.790541533365149e-01, - -7.339579600614959e-01, 6.791949004979112e-01, - -7.338277125784517e-01, 6.793356226872526e-01, - -7.336974381146604e-01, 6.794763198993650e-01, - -7.335671366749114e-01, 6.796169921290756e-01, - -7.334368082639957e-01, 6.797576393712120e-01, - -7.333064528867053e-01, 6.798982616206033e-01, - -7.331760705478327e-01, 6.800388588720789e-01, - -7.330456612521721e-01, 6.801794311204697e-01, - -7.329152250045178e-01, 6.803199783606072e-01, - -7.327847618096658e-01, 6.804605005873239e-01, - -7.326542716724128e-01, 6.806009977954530e-01, - -7.325237545975567e-01, 6.807414699798291e-01, - -7.323932105898960e-01, 6.808819171352872e-01, - -7.322626396542308e-01, 6.810223392566637e-01, - -7.321320417953613e-01, 6.811627363387954e-01, - -7.320014170180896e-01, 6.813031083765205e-01, - -7.318707653272183e-01, 6.814434553646779e-01, - -7.317400867275510e-01, 6.815837772981075e-01, - -7.316093812238926e-01, 6.817240741716497e-01, - -7.314786488210485e-01, 6.818643459801467e-01, - -7.313478895238256e-01, 6.820045927184408e-01, - -7.312171033370313e-01, 6.821448143813756e-01, - -7.310862902654743e-01, 6.822850109637956e-01, - -7.309554503139644e-01, 6.824251824605461e-01, - -7.308245834873122e-01, 6.825653288664733e-01, - -7.306936897903290e-01, 6.827054501764246e-01, - -7.305627692278276e-01, 6.828455463852481e-01, - -7.304318218046215e-01, 6.829856174877927e-01, - -7.303008475255255e-01, 6.831256634789087e-01, - -7.301698463953549e-01, 6.832656843534467e-01, - -7.300388184189263e-01, 6.834056801062587e-01, - -7.299077636010571e-01, 6.835456507321975e-01, - -7.297766819465661e-01, 6.836855962261166e-01, - -7.296455734602725e-01, 6.838255165828707e-01, - -7.295144381469970e-01, 6.839654117973154e-01, - -7.293832760115610e-01, 6.841052818643071e-01, - -7.292520870587870e-01, 6.842451267787031e-01, - -7.291208712934982e-01, 6.843849465353617e-01, - -7.289896287205194e-01, 6.845247411291423e-01, - -7.288583593446758e-01, 6.846645105549050e-01, - -7.287270631707938e-01, 6.848042548075106e-01, - -7.285957402037009e-01, 6.849439738818215e-01, - -7.284643904482252e-01, 6.850836677727004e-01, - -7.283330139091964e-01, 6.852233364750112e-01, - -7.282016105914446e-01, 6.853629799836187e-01, - -7.280701804998012e-01, 6.855025982933886e-01, - -7.279387236390986e-01, 6.856421913991875e-01, - -7.278072400141700e-01, 6.857817592958830e-01, - -7.276757296298496e-01, 6.859213019783436e-01, - -7.275441924909728e-01, 6.860608194414387e-01, - -7.274126286023758e-01, 6.862003116800386e-01, - -7.272810379688959e-01, 6.863397786890145e-01, - -7.271494205953710e-01, 6.864792204632390e-01, - -7.270177764866407e-01, 6.866186369975846e-01, - -7.268861056475450e-01, 6.867580282869259e-01, - -7.267544080829250e-01, 6.868973943261376e-01, - -7.266226837976228e-01, 6.870367351100957e-01, - -7.264909327964819e-01, 6.871760506336768e-01, - -7.263591550843460e-01, 6.873153408917590e-01, - -7.262273506660604e-01, 6.874546058792210e-01, - -7.260955195464710e-01, 6.875938455909422e-01, - -7.259636617304249e-01, 6.877330600218032e-01, - -7.258317772227704e-01, 6.878722491666855e-01, - -7.256998660283561e-01, 6.880114130204716e-01, - -7.255679281520323e-01, 6.881505515780448e-01, - -7.254359635986498e-01, 6.882896648342893e-01, - -7.253039723730608e-01, 6.884287527840904e-01, - -7.251719544801180e-01, 6.885678154223343e-01, - -7.250399099246754e-01, 6.887068527439077e-01, - -7.249078387115878e-01, 6.888458647436990e-01, - -7.247757408457113e-01, 6.889848514165970e-01, - -7.246436163319026e-01, 6.891238127574916e-01, - -7.245114651750196e-01, 6.892627487612735e-01, - -7.243792873799212e-01, 6.894016594228343e-01, - -7.242470829514670e-01, 6.895405447370668e-01, - -7.241148518945179e-01, 6.896794046988648e-01, - -7.239825942139355e-01, 6.898182393031225e-01, - -7.238503099145829e-01, 6.899570485447354e-01, - -7.237179990013235e-01, 6.900958324186000e-01, - -7.235856614790221e-01, 6.902345909196134e-01, - -7.234532973525444e-01, 6.903733240426740e-01, - -7.233209066267570e-01, 6.905120317826811e-01, - -7.231884893065275e-01, 6.906507141345346e-01, - -7.230560453967244e-01, 6.907893710931357e-01, - -7.229235749022177e-01, 6.909280026533862e-01, - -7.227910778278775e-01, 6.910666088101892e-01, - -7.226585541785756e-01, 6.912051895584485e-01, - -7.225260039591845e-01, 6.913437448930687e-01, - -7.223934271745776e-01, 6.914822748089559e-01, - -7.222608238296293e-01, 6.916207793010163e-01, - -7.221281939292153e-01, 6.917592583641577e-01, - -7.219955374782119e-01, 6.918977119932888e-01, - -7.218628544814963e-01, 6.920361401833187e-01, - -7.217301449439472e-01, 6.921745429291581e-01, - -7.215974088704438e-01, 6.923129202257182e-01, - -7.214646462658664e-01, 6.924512720679111e-01, - -7.213318571350963e-01, 6.925895984506504e-01, - -7.211990414830157e-01, 6.927278993688498e-01, - -7.210661993145081e-01, 6.928661748174246e-01, - -7.209333306344575e-01, 6.930044247912909e-01, - -7.208004354477492e-01, 6.931426492853654e-01, - -7.206675137592695e-01, 6.932808482945660e-01, - -7.205345655739053e-01, 6.934190218138118e-01, - -7.204015908965448e-01, 6.935571698380223e-01, - -7.202685897320772e-01, 6.936952923621182e-01, - -7.201355620853924e-01, 6.938333893810213e-01, - -7.200025079613817e-01, 6.939714608896540e-01, - -7.198694273649369e-01, 6.941095068829398e-01, - -7.197363203009510e-01, 6.942475273558033e-01, - -7.196031867743181e-01, 6.943855223031697e-01, - -7.194700267899330e-01, 6.945234917199655e-01, - -7.193368403526917e-01, 6.946614356011178e-01, - -7.192036274674912e-01, 6.947993539415549e-01, - -7.190703881392292e-01, 6.949372467362058e-01, - -7.189371223728045e-01, 6.950751139800009e-01, - -7.188038301731169e-01, 6.952129556678708e-01, - -7.186705115450672e-01, 6.953507717947477e-01, - -7.185371664935574e-01, 6.954885623555644e-01, - -7.184037950234898e-01, 6.956263273452549e-01, - -7.182703971397683e-01, 6.957640667587537e-01, - -7.181369728472975e-01, 6.959017805909968e-01, - -7.180035221509832e-01, 6.960394688369207e-01, - -7.178700450557317e-01, 6.961771314914630e-01, - -7.177365415664510e-01, 6.963147685495621e-01, - -7.176030116880491e-01, 6.964523800061578e-01, - -7.174694554254358e-01, 6.965899658561904e-01, - -7.173358727835217e-01, 6.967275260946012e-01, - -7.172022637672181e-01, 6.968650607163325e-01, - -7.170686283814375e-01, 6.970025697163275e-01, - -7.169349666310931e-01, 6.971400530895304e-01, - -7.168012785210995e-01, 6.972775108308865e-01, - -7.166675640563719e-01, 6.974149429353418e-01, - -7.165338232418267e-01, 6.975523493978432e-01, - -7.164000560823810e-01, 6.976897302133388e-01, - -7.162662625829531e-01, 6.978270853767773e-01, - -7.161324427484623e-01, 6.979644148831087e-01, - -7.159985965838287e-01, 6.981017187272838e-01, - -7.158647240939735e-01, 6.982389969042543e-01, - -7.157308252838186e-01, 6.983762494089729e-01, - -7.155969001582875e-01, 6.985134762363930e-01, - -7.154629487223038e-01, 6.986506773814695e-01, - -7.153289709807926e-01, 6.987878528391577e-01, - -7.151949669386801e-01, 6.989250026044141e-01, - -7.150609366008931e-01, 6.990621266721961e-01, - -7.149268799723595e-01, 6.991992250374621e-01, - -7.147927970580082e-01, 6.993362976951711e-01, - -7.146586878627691e-01, 6.994733446402838e-01, - -7.145245523915729e-01, 6.996103658677610e-01, - -7.143903906493514e-01, 6.997473613725650e-01, - -7.142562026410375e-01, 6.998843311496588e-01, - -7.141219883715648e-01, 7.000212751940063e-01, - -7.139877478458678e-01, 7.001581935005727e-01, - -7.138534810688825e-01, 7.002950860643238e-01, - -7.137191880455452e-01, 7.004319528802264e-01, - -7.135848687807936e-01, 7.005687939432483e-01, - -7.134505232795663e-01, 7.007056092483585e-01, - -7.133161515468026e-01, 7.008423987905261e-01, - -7.131817535874432e-01, 7.009791625647224e-01, - -7.130473294064293e-01, 7.011159005659187e-01, - -7.129128790087035e-01, 7.012526127890875e-01, - -7.127784023992090e-01, 7.013892992292022e-01, - -7.126438995828902e-01, 7.015259598812373e-01, - -7.125093705646923e-01, 7.016625947401685e-01, - -7.123748153495617e-01, 7.017992038009717e-01, - -7.122402339424455e-01, 7.019357870586244e-01, - -7.121056263482919e-01, 7.020723445081046e-01, - -7.119709925720501e-01, 7.022088761443919e-01, - -7.118363326186701e-01, 7.023453819624659e-01, - -7.117016464931030e-01, 7.024818619573080e-01, - -7.115669342003007e-01, 7.026183161239001e-01, - -7.114321957452164e-01, 7.027547444572253e-01, - -7.112974311328040e-01, 7.028911469522674e-01, - -7.111626403680184e-01, 7.030275236040112e-01, - -7.110278234558153e-01, 7.031638744074428e-01, - -7.108929804011517e-01, 7.033001993575487e-01, - -7.107581112089854e-01, 7.034364984493167e-01, - -7.106232158842750e-01, 7.035727716777356e-01, - -7.104882944319805e-01, 7.037090190377948e-01, - -7.103533468570624e-01, 7.038452405244849e-01, - -7.102183731644822e-01, 7.039814361327976e-01, - -7.100833733592028e-01, 7.041176058577253e-01, - -7.099483474461874e-01, 7.042537496942615e-01, - -7.098132954304008e-01, 7.043898676374004e-01, - -7.096782173168086e-01, 7.045259596821374e-01, - -7.095431131103768e-01, 7.046620258234688e-01, - -7.094079828160730e-01, 7.047980660563920e-01, - -7.092728264388657e-01, 7.049340803759049e-01, - -7.091376439837240e-01, 7.050700687770068e-01, - -7.090024354556183e-01, 7.052060312546978e-01, - -7.088672008595198e-01, 7.053419678039788e-01, - -7.087319402004006e-01, 7.054778784198521e-01, - -7.085966534832341e-01, 7.056137630973205e-01, - -7.084613407129942e-01, 7.057496218313878e-01, - -7.083260018946559e-01, 7.058854546170590e-01, - -7.081906370331954e-01, 7.060212614493397e-01, - -7.080552461335895e-01, 7.061570423232371e-01, - -7.079198292008163e-01, 7.062927972337585e-01, - -7.077843862398546e-01, 7.064285261759128e-01, - -7.076489172556844e-01, 7.065642291447095e-01, - -7.075134222532863e-01, 7.066999061351594e-01, - -7.073779012376421e-01, 7.068355571422738e-01, - -7.072423542137347e-01, 7.069711821610654e-01, - -7.071067811865476e-01, 7.071067811865475e-01, -#elif TWIDDLE_TABLE_ORDER == 12 - -1.000000000000000e+00, 0.000000000000000e+00, - -9.999988234517019e-01, 1.533980186284766e-03, - -9.999952938095762e-01, 3.067956762965976e-03, - -9.999894110819284e-01, 4.601926120448570e-03, - -9.999811752826011e-01, 6.135884649154475e-03, - -9.999705864309741e-01, 7.669828739531097e-03, - -9.999576445519639e-01, 9.203754782059820e-03, - -9.999423496760239e-01, 1.073765916726449e-02, - -9.999247018391445e-01, 1.227153828571993e-02, - -9.999047010828529e-01, 1.380538852806039e-02, - -9.998823474542126e-01, 1.533920628498810e-02, - -9.998576410058239e-01, 1.687298794728171e-02, - -9.998305817958234e-01, 1.840672990580482e-02, - -9.998011698878843e-01, 1.994042855151444e-02, - -9.997694053512153e-01, 2.147408027546951e-02, - -9.997352882605617e-01, 2.300768146883937e-02, - -9.996988186962042e-01, 2.454122852291229e-02, - -9.996599967439592e-01, 2.607471782910390e-02, - -9.996188224951786e-01, 2.760814577896574e-02, - -9.995752960467492e-01, 2.914150876419372e-02, - -9.995294175010931e-01, 3.067480317663663e-02, - -9.994811869661670e-01, 3.220802540830459e-02, - -9.994306045554617e-01, 3.374117185137758e-02, - -9.993776703880028e-01, 3.527423889821395e-02, - -9.993223845883495e-01, 3.680722294135883e-02, - -9.992647472865944e-01, 3.834012037355269e-02, - -9.992047586183639e-01, 3.987292758773981e-02, - -9.991424187248169e-01, 4.140564097707674e-02, - -9.990777277526454e-01, 4.293825693494082e-02, - -9.990106858540734e-01, 4.447077185493867e-02, - -9.989412931868569e-01, 4.600318213091462e-02, - -9.988695499142836e-01, 4.753548415695930e-02, - -9.987954562051724e-01, 4.906767432741801e-02, - -9.987190122338729e-01, 5.059974903689928e-02, - -9.986402181802653e-01, 5.213170468028332e-02, - -9.985590742297593e-01, 5.366353765273052e-02, - -9.984755805732948e-01, 5.519524434968993e-02, - -9.983897374073402e-01, 5.672682116690775e-02, - -9.983015449338929e-01, 5.825826450043575e-02, - -9.982110033604782e-01, 5.978957074663987e-02, - -9.981181129001492e-01, 6.132073630220858e-02, - -9.980228737714862e-01, 6.285175756416140e-02, - -9.979252861985960e-01, 6.438263092985747e-02, - -9.978253504111116e-01, 6.591335279700380e-02, - -9.977230666441916e-01, 6.744391956366405e-02, - -9.976184351385196e-01, 6.897432762826675e-02, - -9.975114561403035e-01, 7.050457338961386e-02, - -9.974021299012753e-01, 7.203465324688933e-02, - -9.972904566786902e-01, 7.356456359966743e-02, - -9.971764367353262e-01, 7.509430084792130e-02, - -9.970600703394830e-01, 7.662386139203149e-02, - -9.969413577649822e-01, 7.815324163279423e-02, - -9.968202992911657e-01, 7.968243797143013e-02, - -9.966968952028961e-01, 8.121144680959244e-02, - -9.965711457905548e-01, 8.274026454937569e-02, - -9.964430513500426e-01, 8.426888759332407e-02, - -9.963126121827780e-01, 8.579731234443990e-02, - -9.961798285956970e-01, 8.732553520619206e-02, - -9.960447009012520e-01, 8.885355258252460e-02, - -9.959072294174117e-01, 9.038136087786498e-02, - -9.957674144676598e-01, 9.190895649713272e-02, - -9.956252563809943e-01, 9.343633584574779e-02, - -9.954807554919269e-01, 9.496349532963899e-02, - -9.953339121404823e-01, 9.649043135525259e-02, - -9.951847266721969e-01, 9.801714032956060e-02, - -9.950331994381186e-01, 9.954361866006932e-02, - -9.948793307948056e-01, 1.010698627548278e-01, - -9.947231211043257e-01, 1.025958690224363e-01, - -9.945645707342554e-01, 1.041216338720546e-01, - -9.944036800576791e-01, 1.056471537134106e-01, - -9.942404494531879e-01, 1.071724249568088e-01, - -9.940748793048794e-01, 1.086974440131387e-01, - -9.939069700023561e-01, 1.102222072938831e-01, - -9.937367219407246e-01, 1.117467112111266e-01, - -9.935641355205953e-01, 1.132709521775643e-01, - -9.933892111480807e-01, 1.147949266065101e-01, - -9.932119492347945e-01, 1.163186309119048e-01, - -9.930323501978514e-01, 1.178420615083250e-01, - -9.928504144598651e-01, 1.193652148109914e-01, - -9.926661424489480e-01, 1.208880872357771e-01, - -9.924795345987100e-01, 1.224106751992162e-01, - -9.922905913482574e-01, 1.239329751185122e-01, - -9.920993131421918e-01, 1.254549834115462e-01, - -9.919057004306093e-01, 1.269766964968859e-01, - -9.917097536690995e-01, 1.284981107937932e-01, - -9.915114733187439e-01, 1.300192227222333e-01, - -9.913108598461154e-01, 1.315400287028831e-01, - -9.911079137232769e-01, 1.330605251571391e-01, - -9.909026354277800e-01, 1.345807085071262e-01, - -9.906950254426646e-01, 1.361005751757062e-01, - -9.904850842564571e-01, 1.376201215864860e-01, - -9.902728123631691e-01, 1.391393441638262e-01, - -9.900582102622971e-01, 1.406582393328492e-01, - -9.898412784588205e-01, 1.421768035194480e-01, - -9.896220174632009e-01, 1.436950331502945e-01, - -9.894004277913804e-01, 1.452129246528475e-01, - -9.891765099647810e-01, 1.467304744553617e-01, - -9.889502645103030e-01, 1.482476789868960e-01, - -9.887216919603238e-01, 1.497645346773215e-01, - -9.884907928526966e-01, 1.512810379573302e-01, - -9.882575677307495e-01, 1.527971852584434e-01, - -9.880220171432835e-01, 1.543129730130201e-01, - -9.877841416445722e-01, 1.558283976542652e-01, - -9.875439417943592e-01, 1.573434556162382e-01, - -9.873014181578584e-01, 1.588581433338614e-01, - -9.870565713057510e-01, 1.603724572429283e-01, - -9.868094018141855e-01, 1.618863937801118e-01, - -9.865599102647754e-01, 1.633999493829732e-01, - -9.863080972445987e-01, 1.649131204899699e-01, - -9.860539633461954e-01, 1.664259035404641e-01, - -9.857975091675675e-01, 1.679382949747312e-01, - -9.855387353121761e-01, 1.694502912339680e-01, - -9.852776423889412e-01, 1.709618887603012e-01, - -9.850142310122398e-01, 1.724730839967960e-01, - -9.847485018019042e-01, 1.739838733874638e-01, - -9.844804553832209e-01, 1.754942533772714e-01, - -9.842100923869290e-01, 1.770042204121487e-01, - -9.839374134492189e-01, 1.785137709389975e-01, - -9.836624192117303e-01, 1.800229014056995e-01, - -9.833851103215512e-01, 1.815316082611250e-01, - -9.831054874312163e-01, 1.830398879551410e-01, - -9.828235511987052e-01, 1.845477369386196e-01, - -9.825393022874412e-01, 1.860551516634466e-01, - -9.822527413662894e-01, 1.875621285825296e-01, - -9.819638691095552e-01, 1.890686641498062e-01, - -9.816726861969831e-01, 1.905747548202527e-01, - -9.813791933137546e-01, 1.920803970498924e-01, - -9.810833911504867e-01, 1.935855872958036e-01, - -9.807852804032304e-01, 1.950903220161282e-01, - -9.804848617734694e-01, 1.965945976700802e-01, - -9.801821359681174e-01, 1.980984107179536e-01, - -9.798771036995176e-01, 1.996017576211310e-01, - -9.795697656854405e-01, 2.011046348420919e-01, - -9.792601226490820e-01, 2.026070388444211e-01, - -9.789481753190622e-01, 2.041089660928169e-01, - -9.786339244294232e-01, 2.056104130530992e-01, - -9.783173707196277e-01, 2.071113761922186e-01, - -9.779985149345571e-01, 2.086118519782635e-01, - -9.776773578245099e-01, 2.101118368804696e-01, - -9.773539001452000e-01, 2.116113273692276e-01, - -9.770281426577544e-01, 2.131103199160914e-01, - -9.767000861287118e-01, 2.146088109937868e-01, - -9.763697313300211e-01, 2.161067970762195e-01, - -9.760370790390390e-01, 2.176042746384836e-01, - -9.757021300385286e-01, 2.191012401568698e-01, - -9.753648851166570e-01, 2.205976901088735e-01, - -9.750253450669941e-01, 2.220936209732035e-01, - -9.746835106885107e-01, 2.235890292297900e-01, - -9.743393827855759e-01, 2.250839113597928e-01, - -9.739929621679558e-01, 2.265782638456100e-01, - -9.736442496508120e-01, 2.280720831708857e-01, - -9.732932460546982e-01, 2.295653658205189e-01, - -9.729399522055602e-01, 2.310581082806711e-01, - -9.725843689347322e-01, 2.325503070387752e-01, - -9.722264970789363e-01, 2.340419585835434e-01, - -9.718663374802794e-01, 2.355330594049755e-01, - -9.715038909862518e-01, 2.370236059943672e-01, - -9.711391584497251e-01, 2.385135948443184e-01, - -9.707721407289504e-01, 2.400030224487415e-01, - -9.704028386875555e-01, 2.414918853028693e-01, - -9.700312531945440e-01, 2.429801799032639e-01, - -9.696573851242924e-01, 2.444679027478242e-01, - -9.692812353565485e-01, 2.459550503357946e-01, - -9.689028047764289e-01, 2.474416191677733e-01, - -9.685220942744174e-01, 2.489276057457201e-01, - -9.681391047463624e-01, 2.504130065729652e-01, - -9.677538370934755e-01, 2.518978181542170e-01, - -9.673662922223285e-01, 2.533820369955702e-01, - -9.669764710448521e-01, 2.548656596045146e-01, - -9.665843744783331e-01, 2.563486824899429e-01, - -9.661900034454125e-01, 2.578311021621590e-01, - -9.657933588740837e-01, 2.593129151328862e-01, - -9.653944416976894e-01, 2.607941179152755e-01, - -9.649932528549203e-01, 2.622747070239136e-01, - -9.645897932898128e-01, 2.637546789748313e-01, - -9.641840639517458e-01, 2.652340302855118e-01, - -9.637760657954398e-01, 2.667127574748984e-01, - -9.633657997809540e-01, 2.681908570634032e-01, - -9.629532668736839e-01, 2.696683255729151e-01, - -9.625384680443592e-01, 2.711451595268080e-01, - -9.621214042690416e-01, 2.726213554499490e-01, - -9.617020765291225e-01, 2.740969098687064e-01, - -9.612804858113206e-01, 2.755718193109581e-01, - -9.608566331076797e-01, 2.770460803060999e-01, - -9.604305194155658e-01, 2.785196893850531e-01, - -9.600021457376660e-01, 2.799926430802732e-01, - -9.595715130819845e-01, 2.814649379257579e-01, - -9.591386224618419e-01, 2.829365704570554e-01, - -9.587034748958716e-01, 2.844075372112719e-01, - -9.582660714080177e-01, 2.858778347270806e-01, - -9.578264130275329e-01, 2.873474595447295e-01, - -9.573845007889759e-01, 2.888164082060495e-01, - -9.569403357322088e-01, 2.902846772544623e-01, - -9.564939189023951e-01, 2.917522632349893e-01, - -9.560452513499964e-01, 2.932191626942586e-01, - -9.555943341307711e-01, 2.946853721805143e-01, - -9.551411683057708e-01, 2.961508882436238e-01, - -9.546857549413383e-01, 2.976157074350862e-01, - -9.542280951091057e-01, 2.990798263080405e-01, - -9.537681898859903e-01, 3.005432414172735e-01, - -9.533060403541939e-01, 3.020059493192281e-01, - -9.528416476011987e-01, 3.034679465720113e-01, - -9.523750127197659e-01, 3.049292297354024e-01, - -9.519061368079323e-01, 3.063897953708609e-01, - -9.514350209690083e-01, 3.078496400415349e-01, - -9.509616663115751e-01, 3.093087603122687e-01, - -9.504860739494817e-01, 3.107671527496115e-01, - -9.500082450018430e-01, 3.122248139218249e-01, - -9.495281805930367e-01, 3.136817403988915e-01, - -9.490458818527006e-01, 3.151379287525224e-01, - -9.485613499157303e-01, 3.165933755561658e-01, - -9.480745859222762e-01, 3.180480773850149e-01, - -9.475855910177411e-01, 3.195020308160157e-01, - -9.470943663527772e-01, 3.209552324278752e-01, - -9.466009130832835e-01, 3.224076788010699e-01, - -9.461052323704034e-01, 3.238593665178529e-01, - -9.456073253805213e-01, 3.253102921622629e-01, - -9.451071932852606e-01, 3.267604523201317e-01, - -9.446048372614803e-01, 3.282098435790925e-01, - -9.441002584912727e-01, 3.296584625285875e-01, - -9.435934581619604e-01, 3.311063057598764e-01, - -9.430844374660935e-01, 3.325533698660442e-01, - -9.425731976014469e-01, 3.339996514420094e-01, - -9.420597397710173e-01, 3.354451470845316e-01, - -9.415440651830208e-01, 3.368898533922201e-01, - -9.410261750508893e-01, 3.383337669655411e-01, - -9.405060705932683e-01, 3.397768844068269e-01, - -9.399837530340140e-01, 3.412192023202824e-01, - -9.394592236021899e-01, 3.426607173119944e-01, - -9.389324835320646e-01, 3.441014259899388e-01, - -9.384035340631081e-01, 3.455413249639891e-01, - -9.378723764399899e-01, 3.469804108459237e-01, - -9.373390119125750e-01, 3.484186802494346e-01, - -9.368034417359216e-01, 3.498561297901349e-01, - -9.362656671702783e-01, 3.512927560855671e-01, - -9.357256894810804e-01, 3.527285557552107e-01, - -9.351835099389476e-01, 3.541635254204903e-01, - -9.346391298196808e-01, 3.555976617047839e-01, - -9.340925504042590e-01, 3.570309612334300e-01, - -9.335437729788362e-01, 3.584634206337365e-01, - -9.329927988347390e-01, 3.598950365349881e-01, - -9.324396292684624e-01, 3.613258055684543e-01, - -9.318842655816681e-01, 3.627557243673972e-01, - -9.313267090811804e-01, 3.641847895670799e-01, - -9.307669610789837e-01, 3.656129978047739e-01, - -9.302050228922191e-01, 3.670403457197672e-01, - -9.296408958431813e-01, 3.684668299533723e-01, - -9.290745812593159e-01, 3.698924471489341e-01, - -9.285060804732156e-01, 3.713171939518375e-01, - -9.279353948226179e-01, 3.727410670095158e-01, - -9.273625256504011e-01, 3.741640629714579e-01, - -9.267874743045817e-01, 3.755861784892172e-01, - -9.262102421383114e-01, 3.770074102164183e-01, - -9.256308305098727e-01, 3.784277548087656e-01, - -9.250492407826776e-01, 3.798472089240512e-01, - -9.244654743252626e-01, 3.812657692221624e-01, - -9.238795325112867e-01, 3.826834323650898e-01, - -9.232914167195276e-01, 3.841001950169350e-01, - -9.227011283338786e-01, 3.855160538439188e-01, - -9.221086687433452e-01, 3.869310055143886e-01, - -9.215140393420420e-01, 3.883450466988262e-01, - -9.209172415291895e-01, 3.897581740698564e-01, - -9.203182767091106e-01, 3.911703843022539e-01, - -9.197171462912274e-01, 3.925816740729515e-01, - -9.191138516900578e-01, 3.939920400610481e-01, - -9.185083943252123e-01, 3.954014789478164e-01, - -9.179007756213905e-01, 3.968099874167103e-01, - -9.172909970083779e-01, 3.982175621533736e-01, - -9.166790599210427e-01, 3.996241998456468e-01, - -9.160649657993317e-01, 4.010298971835756e-01, - -9.154487160882678e-01, 4.024346508594184e-01, - -9.148303122379462e-01, 4.038384575676541e-01, - -9.142097557035307e-01, 4.052413140049899e-01, - -9.135870479452508e-01, 4.066432168703690e-01, - -9.129621904283982e-01, 4.080441628649787e-01, - -9.123351846233227e-01, 4.094441486922576e-01, - -9.117060320054299e-01, 4.108431710579039e-01, - -9.110747340551764e-01, 4.122412266698829e-01, - -9.104412922580672e-01, 4.136383122384345e-01, - -9.098057081046522e-01, 4.150344244760816e-01, - -9.091679830905224e-01, 4.164295600976372e-01, - -9.085281187163061e-01, 4.178237158202123e-01, - -9.078861164876663e-01, 4.192168883632239e-01, - -9.072419779152958e-01, 4.206090744484025e-01, - -9.065957045149153e-01, 4.220002707997997e-01, - -9.059472978072685e-01, 4.233904741437960e-01, - -9.052967593181188e-01, 4.247796812091088e-01, - -9.046440905782462e-01, 4.261678887267996e-01, - -9.039892931234433e-01, 4.275550934302821e-01, - -9.033323684945118e-01, 4.289412920553295e-01, - -9.026733182372588e-01, 4.303264813400826e-01, - -9.020121439024932e-01, 4.317106580250573e-01, - -9.013488470460220e-01, 4.330938188531520e-01, - -9.006834292286470e-01, 4.344759605696557e-01, - -9.000158920161603e-01, 4.358570799222555e-01, - -8.993462369793416e-01, 4.372371736610441e-01, - -8.986744656939538e-01, 4.386162385385277e-01, - -8.980005797407399e-01, 4.399942713096333e-01, - -8.973245807054183e-01, 4.413712687317167e-01, - -8.966464701786802e-01, 4.427472275645700e-01, - -8.959662497561852e-01, 4.441221445704292e-01, - -8.952839210385576e-01, 4.454960165139817e-01, - -8.945994856313827e-01, 4.468688401623742e-01, - -8.939129451452033e-01, 4.482406122852199e-01, - -8.932243011955153e-01, 4.496113296546065e-01, - -8.925335554027646e-01, 4.509809890451039e-01, - -8.918407093923427e-01, 4.523495872337709e-01, - -8.911457647945832e-01, 4.537171210001639e-01, - -8.904487232447579e-01, 4.550835871263438e-01, - -8.897495863830728e-01, 4.564489823968839e-01, - -8.890483558546646e-01, 4.578133035988772e-01, - -8.883450333095964e-01, 4.591765475219441e-01, - -8.876396204028539e-01, 4.605387109582400e-01, - -8.869321187943422e-01, 4.618997907024627e-01, - -8.862225301488806e-01, 4.632597835518601e-01, - -8.855108561362000e-01, 4.646186863062378e-01, - -8.847970984309378e-01, 4.659764957679662e-01, - -8.840812587126350e-01, 4.673332087419884e-01, - -8.833633386657316e-01, 4.686888220358279e-01, - -8.826433399795628e-01, 4.700433324595956e-01, - -8.819212643483550e-01, 4.713967368259976e-01, - -8.811971134712221e-01, 4.727490319503428e-01, - -8.804708890521608e-01, 4.741002146505500e-01, - -8.797425928000474e-01, 4.754502817471559e-01, - -8.790122264286335e-01, 4.767992300633221e-01, - -8.782797916565416e-01, 4.781470564248430e-01, - -8.775452902072614e-01, 4.794937576601530e-01, - -8.768087238091457e-01, 4.808393306003340e-01, - -8.760700941954066e-01, 4.821837720791227e-01, - -8.753294031041109e-01, 4.835270789329187e-01, - -8.745866522781761e-01, 4.848692480007911e-01, - -8.738418434653669e-01, 4.862102761244864e-01, - -8.730949784182901e-01, 4.875501601484360e-01, - -8.723460588943915e-01, 4.888888969197632e-01, - -8.715950866559510e-01, 4.902264832882912e-01, - -8.708420634700790e-01, 4.915629161065499e-01, - -8.700869911087115e-01, 4.928981922297840e-01, - -8.693298713486068e-01, 4.942323085159597e-01, - -8.685707059713409e-01, 4.955652618257725e-01, - -8.678094967633033e-01, 4.968970490226545e-01, - -8.670462455156926e-01, 4.982276669727819e-01, - -8.662809540245130e-01, 4.995571125450818e-01, - -8.655136240905691e-01, 5.008853826112407e-01, - -8.647442575194624e-01, 5.022124740457108e-01, - -8.639728561215868e-01, 5.035383837257176e-01, - -8.631994217121242e-01, 5.048631085312676e-01, - -8.624239561110406e-01, 5.061866453451552e-01, - -8.616464611430813e-01, 5.075089910529709e-01, - -8.608669386377673e-01, 5.088301425431070e-01, - -8.600853904293901e-01, 5.101500967067668e-01, - -8.593018183570085e-01, 5.114688504379703e-01, - -8.585162242644427e-01, 5.127864006335630e-01, - -8.577286100002721e-01, 5.141027441932217e-01, - -8.569389774178288e-01, 5.154178780194629e-01, - -8.561473283751945e-01, 5.167317990176499e-01, - -8.553536647351960e-01, 5.180445040959993e-01, - -8.545579883654005e-01, 5.193559901655896e-01, - -8.537603011381114e-01, 5.206662541403672e-01, - -8.529606049303636e-01, 5.219752929371544e-01, - -8.521589016239198e-01, 5.232831034756564e-01, - -8.513551931052652e-01, 5.245896826784690e-01, - -8.505494812656035e-01, 5.258950274710846e-01, - -8.497417680008525e-01, 5.271991347819013e-01, - -8.489320552116396e-01, 5.285020015422285e-01, - -8.481203448032972e-01, 5.298036246862946e-01, - -8.473066386858583e-01, 5.311040011512550e-01, - -8.464909387740521e-01, 5.324031278771979e-01, - -8.456732469872991e-01, 5.337010018071530e-01, - -8.448535652497071e-01, 5.349976198870972e-01, - -8.440318954900664e-01, 5.362929790659632e-01, - -8.432082396418454e-01, 5.375870762956454e-01, - -8.423825996431858e-01, 5.388799085310084e-01, - -8.415549774368984e-01, 5.401714727298929e-01, - -8.407253749704581e-01, 5.414617658531234e-01, - -8.398937941959995e-01, 5.427507848645159e-01, - -8.390602370703127e-01, 5.440385267308838e-01, - -8.382247055548381e-01, 5.453249884220465e-01, - -8.373872016156619e-01, 5.466101669108349e-01, - -8.365477272235120e-01, 5.478940591731002e-01, - -8.357062843537526e-01, 5.491766621877197e-01, - -8.348628749863800e-01, 5.504579729366048e-01, - -8.340175011060181e-01, 5.517379884047073e-01, - -8.331701647019132e-01, 5.530167055800275e-01, - -8.323208677679297e-01, 5.542941214536200e-01, - -8.314696123025452e-01, 5.555702330196022e-01, - -8.306164003088463e-01, 5.568450372751601e-01, - -8.297612337945230e-01, 5.581185312205561e-01, - -8.289041147718649e-01, 5.593907118591361e-01, - -8.280450452577558e-01, 5.606615761973360e-01, - -8.271840272736691e-01, 5.619311212446895e-01, - -8.263210628456635e-01, 5.631993440138341e-01, - -8.254561540043776e-01, 5.644662415205195e-01, - -8.245893027850253e-01, 5.657318107836131e-01, - -8.237205112273914e-01, 5.669960488251087e-01, - -8.228497813758264e-01, 5.682589526701315e-01, - -8.219771152792416e-01, 5.695205193469471e-01, - -8.211025149911046e-01, 5.707807458869673e-01, - -8.202259825694347e-01, 5.720396293247570e-01, - -8.193475200767969e-01, 5.732971666980422e-01, - -8.184671295802987e-01, 5.745533550477158e-01, - -8.175848131515837e-01, 5.758081914178453e-01, - -8.167005728668278e-01, 5.770616728556794e-01, - -8.158144108067338e-01, 5.783137964116556e-01, - -8.149263290565266e-01, 5.795645591394056e-01, - -8.140363297059484e-01, 5.808139580957645e-01, - -8.131444148492536e-01, 5.820619903407754e-01, - -8.122505865852039e-01, 5.833086529376983e-01, - -8.113548470170637e-01, 5.845539429530153e-01, - -8.104571982525948e-01, 5.857978574564389e-01, - -8.095576424040513e-01, 5.870403935209180e-01, - -8.086561815881750e-01, 5.882815482226452e-01, - -8.077528179261904e-01, 5.895213186410639e-01, - -8.068475535437993e-01, 5.907597018588742e-01, - -8.059403905711763e-01, 5.919966949620410e-01, - -8.050313311429637e-01, 5.932322950397998e-01, - -8.041203773982658e-01, 5.944664991846644e-01, - -8.032075314806449e-01, 5.956993044924334e-01, - -8.022927955381157e-01, 5.969307080621965e-01, - -8.013761717231402e-01, 5.981607069963423e-01, - -8.004576621926228e-01, 5.993892984005645e-01, - -7.995372691079050e-01, 6.006164793838690e-01, - -7.986149946347608e-01, 6.018422470585800e-01, - -7.976908409433912e-01, 6.030665985403482e-01, - -7.967648102084188e-01, 6.042895309481560e-01, - -7.958369046088836e-01, 6.055110414043255e-01, - -7.949071263282370e-01, 6.067311270345245e-01, - -7.939754775543372e-01, 6.079497849677736e-01, - -7.930419604794436e-01, 6.091670123364532e-01, - -7.921065773002124e-01, 6.103828062763095e-01, - -7.911693302176902e-01, 6.115971639264619e-01, - -7.902302214373100e-01, 6.128100824294097e-01, - -7.892892531688857e-01, 6.140215589310384e-01, - -7.883464276266063e-01, 6.152315905806268e-01, - -7.874017470290314e-01, 6.164401745308536e-01, - -7.864552135990858e-01, 6.176473079378039e-01, - -7.855068295640539e-01, 6.188529879609763e-01, - -7.845565971555752e-01, 6.200572117632891e-01, - -7.836045186096382e-01, 6.212599765110876e-01, - -7.826505961665757e-01, 6.224612793741500e-01, - -7.816948320710594e-01, 6.236611175256945e-01, - -7.807372285720945e-01, 6.248594881423863e-01, - -7.797777879230146e-01, 6.260563884043435e-01, - -7.788165123814760e-01, 6.272518154951441e-01, - -7.778534042094531e-01, 6.284457666018327e-01, - -7.768884656732324e-01, 6.296382389149270e-01, - -7.759216990434077e-01, 6.308292296284245e-01, - -7.749531065948739e-01, 6.320187359398091e-01, - -7.739826906068229e-01, 6.332067550500572e-01, - -7.730104533627370e-01, 6.343932841636455e-01, - -7.720363971503845e-01, 6.355783204885561e-01, - -7.710605242618138e-01, 6.367618612362842e-01, - -7.700828369933479e-01, 6.379439036218440e-01, - -7.691033376455797e-01, 6.391244448637757e-01, - -7.681220285233654e-01, 6.403034821841517e-01, - -7.671389119358204e-01, 6.414810128085832e-01, - -7.661539901963129e-01, 6.426570339662269e-01, - -7.651672656224590e-01, 6.438315428897914e-01, - -7.641787405361167e-01, 6.450045368155439e-01, - -7.631884172633813e-01, 6.461760129833163e-01, - -7.621962981345789e-01, 6.473459686365121e-01, - -7.612023854842618e-01, 6.485144010221124e-01, - -7.602066816512024e-01, 6.496813073906832e-01, - -7.592091889783881e-01, 6.508466849963809e-01, - -7.582099098130153e-01, 6.520105310969595e-01, - -7.572088465064846e-01, 6.531728429537768e-01, - -7.562060014143945e-01, 6.543336178318004e-01, - -7.552013768965365e-01, 6.554928529996153e-01, - -7.541949753168892e-01, 6.566505457294289e-01, - -7.531867990436125e-01, 6.578066932970786e-01, - -7.521768504490428e-01, 6.589612929820373e-01, - -7.511651319096865e-01, 6.601143420674205e-01, - -7.501516458062151e-01, 6.612658378399923e-01, - -7.491363945234594e-01, 6.624157775901718e-01, - -7.481193804504036e-01, 6.635641586120398e-01, - -7.471006059801801e-01, 6.647109782033448e-01, - -7.460800735100638e-01, 6.658562336655097e-01, - -7.450577854414661e-01, 6.669999223036375e-01, - -7.440337441799293e-01, 6.681420414265185e-01, - -7.430079521351217e-01, 6.692825883466360e-01, - -7.419804117208311e-01, 6.704215603801731e-01, - -7.409511253549591e-01, 6.715589548470183e-01, - -7.399200954595162e-01, 6.726947690707729e-01, - -7.388873244606151e-01, 6.738290003787560e-01, - -7.378528147884660e-01, 6.749616461020119e-01, - -7.368165688773699e-01, 6.760927035753159e-01, - -7.357785891657136e-01, 6.772221701371803e-01, - -7.347388780959635e-01, 6.783500431298615e-01, - -7.336974381146604e-01, 6.794763198993650e-01, - -7.326542716724128e-01, 6.806009977954530e-01, - -7.316093812238926e-01, 6.817240741716497e-01, - -7.305627692278276e-01, 6.828455463852481e-01, - -7.295144381469970e-01, 6.839654117973154e-01, - -7.284643904482252e-01, 6.850836677727004e-01, - -7.274126286023758e-01, 6.862003116800386e-01, - -7.263591550843460e-01, 6.873153408917590e-01, - -7.253039723730608e-01, 6.884287527840904e-01, - -7.242470829514670e-01, 6.895405447370668e-01, - -7.231884893065275e-01, 6.906507141345346e-01, - -7.221281939292153e-01, 6.917592583641577e-01, - -7.210661993145081e-01, 6.928661748174246e-01, - -7.200025079613817e-01, 6.939714608896540e-01, - -7.189371223728045e-01, 6.950751139800009e-01, - -7.178700450557317e-01, 6.961771314914630e-01, - -7.168012785210995e-01, 6.972775108308865e-01, - -7.157308252838186e-01, 6.983762494089729e-01, - -7.146586878627691e-01, 6.994733446402838e-01, - -7.135848687807936e-01, 7.005687939432483e-01, - -7.125093705646923e-01, 7.016625947401685e-01, - -7.114321957452164e-01, 7.027547444572253e-01, - -7.103533468570624e-01, 7.038452405244849e-01, - -7.092728264388657e-01, 7.049340803759049e-01, - -7.081906370331954e-01, 7.060212614493397e-01, - -7.071067811865476e-01, 7.071067811865475e-01, -#else -#error Unsupported twiddle table size -#endif -}; diff --git a/media/openmax_dl/dl/sp/src/omxSP_FFTFwd_RToCCS_F32_Sfs_s.S b/media/openmax_dl/dl/sp/src/omxSP_FFTFwd_RToCCS_F32_Sfs_s.S deleted file mode 100644 index bbbd9d5b43..0000000000 --- a/media/openmax_dl/dl/sp/src/omxSP_FFTFwd_RToCCS_F32_Sfs_s.S +++ /dev/null @@ -1,404 +0,0 @@ -@// -@// Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. -@// -@// Use of this source code is governed by a BSD-style license -@// that can be found in the LICENSE file in the root of the source -@// tree. An additional intellectual property rights grant can be found -@// in the file PATENTS. All contributing project authors may -@// be found in the AUTHORS file in the root of the source tree. -@// -@// This is a modification of omxSP_FFTFwd_RToCCS_S32_Sfs_s.s -@// to support float instead of SC32. -@// - -@// -@// Description: -@// Compute FFT for a real signal -@// -@// - - -@// Include standard headers - -#include "dl/api/armCOMM_s.h" -#include "dl/api/omxtypes_s.h" - - -@// Import symbols required from other files -@// (For example tables) - - .extern armSP_FFTFwd_CToC_FC32_Radix2_fs_OutOfPlace_unsafe - .extern armSP_FFTFwd_CToC_FC32_Radix4_fs_OutOfPlace_unsafe - .extern armSP_FFTFwd_CToC_FC32_Radix8_fs_OutOfPlace_unsafe - .extern armSP_FFTFwd_CToC_FC32_Radix4_OutOfPlace_unsafe - .extern armSP_FFTFwd_CToC_FC32_Radix4_fs_OutOfPlace_unsafe - .extern armSP_FFTFwd_CToC_FC32_Radix8_fs_OutOfPlace_unsafe - .extern armSP_FFTFwd_CToC_FC32_Radix2_OutOfPlace_unsafe - -@// Set debugging level -@//DEBUG_ON SETL {TRUE} - - - -@// Guarding implementation by the processor name - - - - @// Guarding implementation by the processor name - -@// Import symbols required from other files -@// (For example tables) - .extern armSP_FFTFwd_CToC_FC32_Radix4_ls_OutOfPlace_unsafe - .extern armSP_FFTFwd_CToC_FC32_Radix2_ls_OutOfPlace_unsafe - - -@//Input Registers - -#define pSrc r0 -#define pDst r1 -#define pFFTSpec r2 -#define scale r3 - - -@// Output registers -#define result r0 - -@//Local Scratch Registers - -#define argTwiddle r1 -#define argDst r2 -#define argScale r4 -#define tmpOrder r4 -#define pTwiddle r4 -#define pOut r5 -#define subFFTSize r7 -#define subFFTNum r6 -#define N r6 -#define order r14 -#define diff r9 -@// Total num of radix stages required to comple the FFT -#define count r8 -#define x0r r4 -#define x0i r5 -#define diffMinusOne r2 -#define subFFTSizeTmp r6 -#define step r3 -#define step1 r4 -#define twStep r8 -#define zero r9 -#define pTwiddleTmp r5 -#define t0 r10 - -@// Neon registers - -#define dX0 d0 -#define dzero d1 -#define dZero d2 -#define dShift d3 -#define dX0r d2 -#define dX0i d3 -#define dX1r d4 -#define dX1i d5 -#define dT0 d6 -#define dT1 d7 -#define dT2 d8 -#define dT3 d9 -#define qT0 d10 -#define qT1 d12 -#define dW0r d14 -#define dW0i d15 -#define dW1r d16 -#define dW1i d17 -#define dY0r d14 -#define dY0i d15 -#define dY1r d16 -#define dY1i d17 -#define dY0rS64 d14.s64 -#define dY0iS64 d15.s64 -#define qT2 d18 -#define qT3 d20 -@// lastThreeelements -#define dX1 d3 -#define dW0 d4 -#define dW1 d5 -#define dY0 d10 -#define dY1 d11 -#define dY2 d12 -#define dY3 d13 - -#define half d0 - - @// Allocate stack memory required by the function - - @// Write function header - M_START omxSP_FFTFwd_RToCCS_F32_Sfs,r11,d15 - -@ Structure offsets for the FFTSpec - .set ARMsFFTSpec_N, 0 - .set ARMsFFTSpec_pBitRev, 4 - .set ARMsFFTSpec_pTwiddle, 8 - .set ARMsFFTSpec_pBuf, 12 - - @// Define stack arguments - - @// Read the size from structure and take log - LDR N, [pFFTSpec, #ARMsFFTSpec_N] - - @// Read other structure parameters - LDR pTwiddle, [pFFTSpec, #ARMsFFTSpec_pTwiddle] - LDR pOut, [pFFTSpec, #ARMsFFTSpec_pBuf] - - @// N=1 Treat seperately - CMP N,#1 - BGT sizeGreaterThanOne - VLD1.F32 dX0[0],[pSrc] - MOV zero,#0 - VMOV.F32 dzero[0],zero - VMOV.F32 dZero[0],zero - VST3.F32 {dX0[0],dzero[0],dZero[0]},[pDst] - - B End - - - -sizeGreaterThanOne: - @// Do a N/2 point complex FFT including the scaling - - MOV N,N,ASR #1 @// N/2 point complex FFT - - CLZ order,N @// N = 2^order - RSB order,order,#31 - MOV subFFTSize,#1 - @//MOV subFFTNum,N - - CMP order,#3 - BGT orderGreaterthan3 @// order > 3 - - CMP order,#1 - BGE orderGreaterthan0 @// order > 0 - VLD1.F32 dX0,[pSrc] - VST1.F32 dX0,[pOut] - MOV pSrc,pOut - MOV argDst,pDst - BLT FFTEnd - -orderGreaterthan0: - @// set the buffers appropriately for various orders - CMP order,#2 - MOVEQ argDst,pDst - MOVNE argDst,pOut - @// Pass the first stage destination in RN5 - MOVNE pOut,pDst - MOV argTwiddle,pTwiddle - - CMP order,#1 - BGT orderGreaterthan1 - @// order = 1 - BL armSP_FFTFwd_CToC_FC32_Radix2_fs_OutOfPlace_unsafe - B FFTEnd - -orderGreaterthan1: - CMP order,#2 - BGT orderGreaterthan2 - @// order =2 - BL armSP_FFTFwd_CToC_FC32_Radix2_fs_OutOfPlace_unsafe - BL armSP_FFTFwd_CToC_FC32_Radix2_ls_OutOfPlace_unsafe - B FFTEnd - -orderGreaterthan2:@// order =3 - BL armSP_FFTFwd_CToC_FC32_Radix2_fs_OutOfPlace_unsafe - BL armSP_FFTFwd_CToC_FC32_Radix2_OutOfPlace_unsafe - BL armSP_FFTFwd_CToC_FC32_Radix2_ls_OutOfPlace_unsafe - - B FFTEnd - - - -orderGreaterthan3: -specialScaleCase: - - @// Set input args to fft stages - TST order, #2 - MOVEQ argDst,pDst - MOVNE argDst,pOut - @// Pass the first stage destination in RN5 - MOVNE pOut,pDst - MOV argTwiddle,pTwiddle - - @//check for even or odd order - @// NOTE: The following combination of BL's would work fine even though - @// the first BL would corrupt the flags. This is because the end of - @// the "grpZeroSetLoop" loop inside - @// armSP_FFTFwd_CToC_FC32_Radix4_fs_OutOfPlace_unsafe sets the Z flag - @// to EQ - - TST order,#0x00000001 - BLEQ armSP_FFTFwd_CToC_FC32_Radix4_fs_OutOfPlace_unsafe - BLNE armSP_FFTFwd_CToC_FC32_Radix8_fs_OutOfPlace_unsafe - - CMP subFFTNum,#4 - BLT FFTEnd - - -unscaledRadix4Loop: - BEQ lastStageUnscaledRadix4 - BL armSP_FFTFwd_CToC_FC32_Radix4_OutOfPlace_unsafe - CMP subFFTNum,#4 - B unscaledRadix4Loop - -lastStageUnscaledRadix4: - BL armSP_FFTFwd_CToC_FC32_Radix4_ls_OutOfPlace_unsafe - B FFTEnd - - -FFTEnd: -finalComplexToRealFixup: - - - @// F(0) = 1/2[Z(0) + Z'(0)] - j [Z(0) - Z'(0)] - @// 1/2[(a+jb) + (a-jb)] - j [(a+jb) - (a-jb)] - @// 1/2[2a+j0] - j [0+j2b] - @// (a+b, 0) - - @// F(N/2) = 1/2[Z(0) + Z'(0)] + j [Z(0) - Z'(0)] - @// 1/2[(a+jb) + (a-jb)] + j [(a+jb) - (a-jb)] - @// 1/2[2a+j0] + j [0+j2b] - @// (a-b, 0) - - @// F(0) and F(N/2) - VLD2.F32 {dX0r[0],dX0i[0]},[pSrc]! - MOV zero,#0 - VMOV.F32 dX0r[1],zero - MOV step,subFFTSize,LSL #3 @// step = N/2 * 8 bytes - VMOV.F32 dX0i[1],zero - @// twStep = 3N/8 * 8 bytes pointing to W^1 - SUB twStep,step,subFFTSize,LSL #1 - - VADD.F32 dY0r,dX0r,dX0i @// F(0) = ((Z0.r+Z0.i) , 0) - MOV step1,subFFTSize,LSL #2 @// step1 = N/2 * 4 bytes - VSUB.F32 dY0i,dX0r,dX0i @// F(N/2) = ((Z0.r-Z0.i) , 0) - SUBS subFFTSize,subFFTSize,#2 - - VST1.F32 dY0r,[argDst],step - ADD pTwiddleTmp,argTwiddle,#8 @// W^2 - VST1.F32 dY0i,[argDst]! - ADD argTwiddle,argTwiddle,twStep @// W^1 - - VDUP.F32 dzero,zero - SUB argDst,argDst,step - - BLT End - BEQ lastElement - SUB step,step,#24 - SUB step1,step1,#8 @// (N/4-1)*8 bytes - - @// F(k) = 1/2[Z(k) + Z'(N/2-k)] -j*W^(k) [Z(k) - Z'(N/2-k)] - @// Note: W^k is stored as negative values in the table - @// Process 4 elements at a time. E.g: F(1),F(2) and F(N/2-2),F(N/2-1) - @// since both of them require Z(1),Z(2) and Z(N/2-2),Z(N/2-1) - - - ADR t0, HALF - VLD1.F32 half[0], [t0] - -evenOddButterflyLoop: - - - VLD1.F32 dW0r,[argTwiddle],step1 - VLD1.F32 dW1r,[argTwiddle]! - - VLD2.F32 {dX0r,dX0i},[pSrc],step - SUB argTwiddle,argTwiddle,step1 - VLD2.F32 {dX1r,dX1i},[pSrc]! - - - - SUB step1,step1,#8 @// (N/4-2)*8 bytes - VLD1.F32 dW0i,[pTwiddleTmp],step1 - VLD1.F32 dW1i,[pTwiddleTmp]! - SUB pSrc,pSrc,step - - SUB pTwiddleTmp,pTwiddleTmp,step1 - VREV64.F32 dX1r,dX1r - VREV64.F32 dX1i,dX1i - SUBS subFFTSize,subFFTSize,#4 - - - - VSUB.F32 dT2,dX0r,dX1r @// a-c - SUB step1,step1,#8 - VADD.F32 dT0,dX0r,dX1r @// a+c - VSUB.F32 dT1,dX0i,dX1i @// b-d - VADD.F32 dT3,dX0i,dX1i @// b+d - VMUL.F32 dT0,dT0,half[0] - VMUL.F32 dT1,dT1,half[0] - VZIP.F32 dW1r,dW1i - VZIP.F32 dW0r,dW0i - - - VMUL.F32 qT0,dW1r,dT2 - VMUL.F32 qT1,dW1r,dT3 - VMUL.F32 qT2,dW0r,dT2 - VMUL.F32 qT3,dW0r,dT3 - - VMLA.F32 qT0,dW1i,dT3 - VMLS.F32 qT1,dW1i,dT2 - - VMLS.F32 qT2,dW0i,dT3 - VMLA.F32 qT3,dW0i,dT2 - - - VMUL.F32 dX1r,qT0,half[0] - VMUL.F32 dX1i,qT1,half[0] - - VSUB.F32 dY1r,dT0,dX1i @// F(N/2 -1) - VADD.F32 dY1i,dT1,dX1r - VNEG.F32 dY1i,dY1i - - VREV64.F32 dY1r,dY1r - VREV64.F32 dY1i,dY1i - - - VMUL.F32 dX0r,qT2,half[0] - VMUL.F32 dX0i,qT3,half[0] - - VSUB.F32 dY0r,dT0,dX0i @// F(1) - VADD.F32 dY0i,dT1,dX0r - - - VST2.F32 {dY0r,dY0i},[argDst],step - VST2.F32 {dY1r,dY1i},[argDst]! - SUB argDst,argDst,step - SUB step,step,#32 @// (N/2-4)*8 bytes - - - BGT evenOddButterflyLoop - - @// set both the ptrs to the last element - SUB pSrc,pSrc,#8 - SUB argDst,argDst,#8 - - - - @// Last element can be expanded as follows - @// 1/2[Z(k) + Z'(k)] + j w^k [Z(k) - Z'(k)] - @// 1/2[(a+jb) + (a-jb)] + j w^k [(a+jb) - (a-jb)] - @// 1/2[2a+j0] + j (c+jd) [0+j2b] - @// (a-bc, -bd) - @// Since (c,d) = (0,1) for the last element, result is just (a,-b) - -lastElement: - VLD1.F32 dX0r,[pSrc] - - VST1.F32 dX0r[0],[argDst]! - VNEG.F32 dX0r,dX0r - VST1.F32 dX0r[1],[argDst]! - -End: - @// Set return value - MOV result, #OMX_Sts_NoErr - - @// Write function tail - M_END -HALF: .float 0.5 - .end diff --git a/media/openmax_dl/dl/sp/src/omxSP_FFTGetBufSize_R_F32.c b/media/openmax_dl/dl/sp/src/omxSP_FFTGetBufSize_R_F32.c deleted file mode 100644 index 19b16bbd95..0000000000 --- a/media/openmax_dl/dl/sp/src/omxSP_FFTGetBufSize_R_F32.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - * - */ - -#include "dl/api/armOMX.h" -#include "dl/api/omxtypes.h" -#include "dl/sp/api/armSP.h" -#include "dl/sp/api/omxSP.h" - -/** - * Function: omxSP_FFTGetBufSize_R_F32 - * - * Description: - * Computes the size of the specification structure required for the length - * 2^order real FFT and IFFT functions. - * - * Remarks: - * This function is used in conjunction with the 32-bit functions - * <FFTFwd_RToCCS_F32_Sfs> and <FFTInv_CCSToR_F32_Sfs>. - * - * Parameters: - * [in] order base-2 logarithm of the length; valid in the range - * [1,12]. ([1,15] if BIG_FFT_TABLE is defined.) - * [out] pSize pointer to the number of bytes required for the - * specification structure. - * - * Return Value: - * Standard omxError result. See enumeration for possible result codes. - * - */ - -OMXResult omxSP_FFTGetBufSize_R_F32(OMX_INT order, OMX_INT *pSize) { - if (!pSize || (order < 1) || (order > TWIDDLE_TABLE_ORDER)) - return OMX_Sts_BadArgErr; - - /* - * The required size is the same as for R_S32, because the - * elements are the same size and because ARMsFFTSpec_R_SC32 is - * the same size as ARMsFFTSpec_R_FC32. - */ - return omxSP_FFTGetBufSize_R_S32(order, pSize); -} diff --git a/media/openmax_dl/dl/sp/src/omxSP_FFTGetBufSize_R_S32.c b/media/openmax_dl/dl/sp/src/omxSP_FFTGetBufSize_R_S32.c deleted file mode 100644 index d57294700e..0000000000 --- a/media/openmax_dl/dl/sp/src/omxSP_FFTGetBufSize_R_S32.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - * - * This file was originally licensed as follows. It has been - * relicensed with permission from the copyright holders. - */ - -/** - * - * File Name: omxSP_FFTGetBufSize_R_S32.c - * OpenMAX DL: v1.0.2 - * Last Modified Revision: 7777 - * Last Modified Date: Thu, 27 Sep 2007 - * - * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. - * - * - * Description: - * Computes the size of the specification structure required. - */ - -#include "dl/api/armOMX.h" -#include "dl/api/omxtypes.h" -#include "dl/sp/api/armSP.h" -#include "dl/sp/api/omxSP.h" - -/** - * Function: omxSP_FFTGetBufSize_R_S32 - * - * Description: - * Computes the size of the specification structure required for the length - * 2^order real FFT and IFFT functions. - * - * Remarks: - * This function is used in conjunction with the 32-bit functions - * <FFTFwd_RToCCS_S32_Sfs> and <FFTInv_CCSToR_S32_Sfs>. - * - * Parameters: - * [in] order base-2 logarithm of the length; valid in the range - * [0,12]. - * [out] pSize pointer to the number of bytes required for the - * specification structure. - * - * Return Value: - * Standard omxError result. See enumeration for possible result codes. - * - */ - -OMXResult omxSP_FFTGetBufSize_R_S32( - OMX_INT order, - OMX_INT *pSize - ) -{ - OMX_INT NBy2,N,twiddleSize; - - - /* Check for order zero */ - if (order == 0) - { - *pSize = sizeof(ARMsFFTSpec_R_SC32) - + sizeof(OMX_S32) * (2); /* Extra size 'N' is used in FFTInv_CCSToR_S32S16_Sfs as a temporary buf */ - - return OMX_Sts_NoErr; - } - - NBy2 = 1 << (order - 1); - N = NBy2<<1; - twiddleSize = 5*N/8; /* 3/4(N/2) + N/4 */ - - /* 2 pointers to store bitreversed array and twiddle factor array */ - *pSize = sizeof(ARMsFFTSpec_R_SC32) - /* Twiddle factors */ - + sizeof(OMX_SC32) * twiddleSize - /* Ping Pong buffer for doing the N/2 point complex FFT */ - + sizeof(OMX_S32) * (N<<1) /* Extra size 'N' is used in FFTInv_CCSToR_S32_Sfs as a temporary buf */ - + 62 ; /* Extra bytes to get 32 byte alignment of ptwiddle and pBuf */ - - - return OMX_Sts_NoErr; -} - -/***************************************************************************** - * END OF FILE - *****************************************************************************/ - diff --git a/media/openmax_dl/dl/sp/src/omxSP_FFTInit_R_F32.c b/media/openmax_dl/dl/sp/src/omxSP_FFTInit_R_F32.c deleted file mode 100644 index 32d22230ed..0000000000 --- a/media/openmax_dl/dl/sp/src/omxSP_FFTInit_R_F32.c +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - * - * This is a modification of omxSP_FFTInit_R_S32.c to support float - * instead of S32. - */ - -#include "dl/api/armOMX.h" -#include "dl/api/omxtypes.h" -#include "dl/sp/api/armSP.h" -#include "dl/sp/api/omxSP.h" - -/** - * Function: omxSP_FFTInit_R_F32 - * - * Description: - * Initialize the real forward-FFT specification information struct. - * - * Remarks: - * This function is used to initialize the specification structures - * for functions <ippsFFTFwd_RToCCS_F32_Sfs> and - * <ippsFFTInv_CCSToR_F32_Sfs>. Memory for *pFFTSpec must be - * allocated prior to calling this function. The number of bytes - * required for *pFFTSpec can be determined using - * <FFTGetBufSize_R_F32>. - * - * Parameters: - * [in] order base-2 logarithm of the desired block length; - * valid in the range [1,12]. ([1,15] if - * BIG_FFT_TABLE is defined.) - * [out] pFFTFwdSpec pointer to the initialized specification structure. - * - * Return Value: - * Standard omxError result. See enumeration for possible result codes. - * - */ -OMXResult omxSP_FFTInit_R_F32(OMXFFTSpec_R_F32* pFFTSpec, OMX_INT order) { - OMX_INT i; - OMX_INT j; - OMX_FC32* pTwiddle; - OMX_FC32* pTwiddle1; - OMX_FC32* pTwiddle2; - OMX_FC32* pTwiddle3; - OMX_FC32* pTwiddle4; - OMX_F32* pBuf; - OMX_U16* pBitRev; - OMX_U32 pTmp; - OMX_INT Nby2; - OMX_INT N; - OMX_INT M; - OMX_INT diff; - OMX_INT step; - OMX_F32 x; - OMX_F32 y; - OMX_F32 xNeg; - ARMsFFTSpec_R_FC32* pFFTStruct = 0; - - pFFTStruct = (ARMsFFTSpec_R_FC32 *) pFFTSpec; - - /* Validate args */ - if (!pFFTSpec || (order < 1) || (order > TWIDDLE_TABLE_ORDER)) - return OMX_Sts_BadArgErr; - - /* Do the initializations */ - Nby2 = 1 << (order - 1); - N = Nby2 << 1; - - /* optimized implementations don't use bitreversal */ - pBitRev = NULL; - - pTwiddle = (OMX_FC32 *) (sizeof(ARMsFFTSpec_R_SC32) + (OMX_S8*) pFFTSpec); - - /* Align to 32 byte boundary */ - pTmp = ((OMX_U32)pTwiddle) & 31; - if (pTmp) - pTwiddle = (OMX_FC32*) ((OMX_S8*)pTwiddle + (32 - pTmp)); - - pBuf = (OMX_F32*) (sizeof(OMX_FC32)*(5*N/8) + (OMX_S8*) pTwiddle); - - /* Align to 32 byte boundary */ - pTmp = ((OMX_U32)pBuf)&31; /* (OMX_U32)pBuf % 32 */ - if (pTmp) - pBuf = (OMX_F32*) ((OMX_S8*)pBuf + (32 - pTmp)); - - /* - * Filling Twiddle factors : - * - * exp^(-j*2*PI*k/ (N/2) ) ; k=0,1,2,...,3/4(N/2) - * - * N/2 point complex FFT is used to compute N point real FFT The - * original twiddle table "armSP_FFT_F32TwiddleTable" is of size - * (MaxSize/8 + 1) Rest of the values i.e., upto MaxSize are - * calculated using the symmetries of sin and cos The max size of - * the twiddle table needed is 3/4(N/2) for a radix-4 stage - * - * W = (-2 * PI) / N - * N = 1 << order - * W = -PI >> (order - 1) - */ - - M = Nby2 >> 3; - diff = TWIDDLE_TABLE_ORDER - (order - 1); - /* step into the twiddle table for the current order */ - step = 1 << diff; - - x = armSP_FFT_F32TwiddleTable[0]; - y = armSP_FFT_F32TwiddleTable[1]; - xNeg = 1; - - if ((order - 1) >= 3) { - /* i = 0 case */ - pTwiddle[0].Re = x; - pTwiddle[0].Im = y; - pTwiddle[2*M].Re = -y; - pTwiddle[2*M].Im = xNeg; - pTwiddle[4*M].Re = xNeg; - pTwiddle[4*M].Im = y; - - for (i = 1; i <= M; i++) { - j = i*step; - - x = armSP_FFT_F32TwiddleTable[2*j]; - y = armSP_FFT_F32TwiddleTable[2*j+1]; - - pTwiddle[i].Re = x; - pTwiddle[i].Im = y; - pTwiddle[2*M-i].Re = -y; - pTwiddle[2*M-i].Im = -x; - pTwiddle[2*M+i].Re = y; - pTwiddle[2*M+i].Im = -x; - pTwiddle[4*M-i].Re = -x; - pTwiddle[4*M-i].Im = y; - pTwiddle[4*M+i].Re = -x; - pTwiddle[4*M+i].Im = -y; - pTwiddle[6*M-i].Re = y; - pTwiddle[6*M-i].Im = x; - } - } else if ((order - 1) == 2) { - pTwiddle[0].Re = x; - pTwiddle[0].Im = y; - pTwiddle[1].Re = -y; - pTwiddle[1].Im = xNeg; - pTwiddle[2].Re = xNeg; - pTwiddle[2].Im = y; - } else if ((order-1) == 1) { - pTwiddle[0].Re = x; - pTwiddle[0].Im = y; - } - - /* - * Now fill the last N/4 values : exp^(-j*2*PI*k/N) ; - * k=1,3,5,...,N/2-1 These are used for the final twiddle fix-up for - * converting complex to real FFT - */ - - M = N >> 3; - diff = TWIDDLE_TABLE_ORDER - order; - step = 1 << diff; - - pTwiddle1 = pTwiddle + 3*N/8; - pTwiddle4 = pTwiddle1 + (N/4 - 1); - pTwiddle3 = pTwiddle1 + N/8; - pTwiddle2 = pTwiddle1 + (N/8 - 1); - - x = armSP_FFT_F32TwiddleTable[0]; - y = armSP_FFT_F32TwiddleTable[1]; - xNeg = 1; - - if (order >=3) { - for (i = 1; i <= M; i += 2) { - j = i*step; - - x = armSP_FFT_F32TwiddleTable[2*j]; - y = armSP_FFT_F32TwiddleTable[2*j+1]; - - pTwiddle1[0].Re = x; - pTwiddle1[0].Im = y; - pTwiddle1 += 1; - pTwiddle2[0].Re = -y; - pTwiddle2[0].Im = -x; - pTwiddle2 -= 1; - pTwiddle3[0].Re = y; - pTwiddle3[0].Im = -x; - pTwiddle3 += 1; - pTwiddle4[0].Re = -x; - pTwiddle4[0].Im = y; - pTwiddle4 -= 1; - } - } else { - if (order == 2) { - pTwiddle1[0].Re = -y; - pTwiddle1[0].Im = xNeg; - } - } - - - /* Update the structure */ - pFFTStruct->N = N; - pFFTStruct->pTwiddle = pTwiddle; - pFFTStruct->pBitRev = pBitRev; - pFFTStruct->pBuf = pBuf; - - return OMX_Sts_NoErr; -} diff --git a/media/openmax_dl/dl/sp/src/omxSP_FFTInv_CCSToR_F32_Sfs_unscaled_s.S b/media/openmax_dl/dl/sp/src/omxSP_FFTInv_CCSToR_F32_Sfs_unscaled_s.S deleted file mode 100644 index 838de317f0..0000000000 --- a/media/openmax_dl/dl/sp/src/omxSP_FFTInv_CCSToR_F32_Sfs_unscaled_s.S +++ /dev/null @@ -1,284 +0,0 @@ -@// -@// Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. -@// -@// Copyright 2016, Mozilla Foundation and contributors -@// -@// Use of this source code is governed by a BSD-style license -@// that can be found in the LICENSE file in the root of the source -@// tree. An additional intellectual property rights grant can be found -@// in the file PATENTS. All contributing project authors may -@// be found in the AUTHORS file in the root of the source tree. -@// -@// This is a modification of omxSP_FFTInv_CCSToR_S32_Sfs_s.s -@// to support float instead of SC32. -@// -@// It is further modified to produce an "unscaled" version, which -@// actually multiplies by two for consistency with the other FFT functions -@// in use. -@// - -@// -@// Description: -@// Compute an inverse FFT for a complex signal -@// -@// - - -@// Include standard headers - -#include "dl/api/armCOMM_s.h" -#include "dl/api/omxtypes_s.h" - - -@// Import symbols required from other files -@// (For example tables) - - .extern armSP_FFTInv_CToC_FC32_Radix2_fs_OutOfPlace_unsafe - .extern armSP_FFTInv_CToC_FC32_Radix4_fs_OutOfPlace_unsafe - .extern armSP_FFTInv_CToC_FC32_Radix8_fs_OutOfPlace_unsafe - .extern armSP_FFTInv_CToC_FC32_Radix4_OutOfPlace_unsafe - .extern armSP_FFTInv_CToC_FC32_Radix2_OutOfPlace_unsafe - .extern armSP_FFTInv_CCSToR_F32_preTwiddleRadix2_unsafe - - -@// Set debugging level -@//DEBUG_ON SETL {TRUE} - - - -@// Guarding implementation by the processor name - - - - @// Guarding implementation by the processor name - -@// Import symbols required from other files -@// (For example tables) - .extern armSP_FFTInv_CToC_FC32_Radix4_ls_OutOfPlace_unsafe - .extern armSP_FFTInv_CToC_FC32_Radix2_ls_OutOfPlace_unsafe - - -@//Input Registers - -#define pSrc r0 -#define pDst r1 -#define pFFTSpec r2 -#define scale r3 - - -@// Output registers -#define result r0 - -@//Local Scratch Registers - -#define argTwiddle r1 -#define argDst r2 -#define argScale r4 -#define tmpOrder r4 -#define pTwiddle r4 -#define pOut r5 -#define subFFTSize r7 -#define subFFTNum r6 -#define N r6 -#define order r14 -#define diff r9 -@// Total num of radix stages required to comple the FFT -#define count r8 -#define x0r r4 -#define x0i r5 -#define diffMinusOne r2 -#define round r3 - -#define pOut1 r2 -#define size r7 -#define step r8 -#define step1 r9 -#define twStep r10 -#define pTwiddleTmp r11 -#define argTwiddle1 r12 -#define zero r14 - -@// Neon registers - -#define dX0 D0 -#define dShift D1 -#define dX1 D1 -#define dY0 D2 -#define dY1 D3 -#define dX0r D0 -#define dX0i D1 -#define dX1r D2 -#define dX1i D3 -#define dW0r D4 -#define dW0i D5 -#define dW1r D6 -#define dW1i D7 -#define dT0 D8 -#define dT1 D9 -#define dT2 D10 -#define dT3 D11 -#define qT0 d12 -#define qT1 d14 -#define qT2 d16 -#define qT3 d18 -#define dY0r D4 -#define dY0i D5 -#define dY1r D6 -#define dY1i D7 -#define dzero D20 - -#define dY2 D4 -#define dY3 D5 -#define dW0 D6 -#define dW1 D7 -#define dW0Tmp D10 -#define dW1Neg D11 - -#define sN S0.S32 -#define fN S1 -@// two must be the same as dScale[0]! -#define dScale D2 -#define two S4 - - - @// Allocate stack memory required by the function - M_ALLOC4 complexFFTSize, 4 - - @// Write function header - M_START omxSP_FFTInv_CCSToR_F32_Sfs_unscaled,r11,d15 - -@ Structure offsets for the FFTSpec - .set ARMsFFTSpec_N, 0 - .set ARMsFFTSpec_pBitRev, 4 - .set ARMsFFTSpec_pTwiddle, 8 - .set ARMsFFTSpec_pBuf, 12 - - @// Define stack arguments - - @// Read the size from structure and take log - LDR N, [pFFTSpec, #ARMsFFTSpec_N] - - @// Read other structure parameters - LDR pTwiddle, [pFFTSpec, #ARMsFFTSpec_pTwiddle] - LDR pOut, [pFFTSpec, #ARMsFFTSpec_pBuf] - - @// N=1 Treat seperately - CMP N,#1 - BGT sizeGreaterThanOne - VLD1.F32 dX0[0],[pSrc] - VST1.F32 dX0[0],[pDst] - - B End - -sizeGreaterThanOne: - - @// Call the preTwiddle Radix2 stage before doing the compledIFFT - - - BL armSP_FFTInv_CCSToR_F32_preTwiddleRadix2_unsafe - - -complexIFFT: - - ASR N,N,#1 @// N/2 point complex IFFT - M_STR N, complexFFTSize @ Save N for scaling later - ADD pSrc,pOut,N,LSL #3 @// set pSrc as pOut1 - - CLZ order,N @// N = 2^order - RSB order,order,#31 - MOV subFFTSize,#1 - @//MOV subFFTNum,N - - CMP order,#3 - BGT orderGreaterthan3 @// order > 3 - - CMP order,#1 - BGE orderGreaterthan0 @// order > 0 - - VLD1.F32 dX0,[pSrc] - VST1.F32 dX0,[pDst] - MOV pSrc,pDst - BLT FFTEnd - -orderGreaterthan0: - @// set the buffers appropriately for various orders - CMP order,#2 - MOVNE argDst,pDst - MOVEQ argDst,pOut - @// Pass the first stage destination in RN5 - MOVEQ pOut,pDst - MOV argTwiddle,pTwiddle - - BGE orderGreaterthan1 - BLLT armSP_FFTInv_CToC_FC32_Radix2_fs_OutOfPlace_unsafe @// order = 1 - B FFTEnd - -orderGreaterthan1: - MOV tmpOrder,order @// tmpOrder = RN 4 - BL armSP_FFTInv_CToC_FC32_Radix2_fs_OutOfPlace_unsafe - CMP tmpOrder,#2 - BLGT armSP_FFTInv_CToC_FC32_Radix2_OutOfPlace_unsafe - BL armSP_FFTInv_CToC_FC32_Radix2_ls_OutOfPlace_unsafe - B FFTEnd - - -orderGreaterthan3: -specialScaleCase: - - @// Set input args to fft stages - TST order, #2 - MOVNE argDst,pDst - MOVEQ argDst,pOut - @// Pass the first stage destination in RN5 - MOVEQ pOut,pDst - MOV argTwiddle,pTwiddle - - @//check for even or odd order - @// NOTE: The following combination of BL's would work fine even though - @// the first BL would corrupt the flags. This is because the end of - @// the "grpZeroSetLoop" loop inside - @// armSP_FFTInv_CToC_FC32_Radix4_fs_OutOfPlace_unsafe sets the Z flag - @// to EQ - - TST order,#0x00000001 - BLEQ armSP_FFTInv_CToC_FC32_Radix4_fs_OutOfPlace_unsafe - BLNE armSP_FFTInv_CToC_FC32_Radix8_fs_OutOfPlace_unsafe - - CMP subFFTNum,#4 - BLT FFTEnd - - -unscaledRadix4Loop: - BEQ lastStageUnscaledRadix4 - BL armSP_FFTInv_CToC_FC32_Radix4_OutOfPlace_unsafe - CMP subFFTNum,#4 - B unscaledRadix4Loop - -lastStageUnscaledRadix4: - BL armSP_FFTInv_CToC_FC32_Radix4_ls_OutOfPlace_unsafe - B FFTEnd - -FFTEnd: @// Does only the scaling - @ Scale inverse FFT result by 2 for consistency with other FFTs - VMOV.F32 two, #2.0 @ two = dScale[0] - - @// N = subFFTSize ; dataptr = pDst -scaleFFTData: - VLD1.F32 {dX0},[pSrc] @// pSrc contains pDst pointer - SUBS subFFTSize,subFFTSize,#1 - VMUL.F32 dX0, dX0, dScale[0] - VST1.F32 {dX0},[pSrc]! - - BGT scaleFFTData - - -End: - @// Set return value - MOV result, #OMX_Sts_NoErr - - @// Write function tail - M_END - - - - .end diff --git a/media/webrtc/signaling/gtest/jsep_session_unittest.cpp b/media/webrtc/signaling/gtest/jsep_session_unittest.cpp index 2ed2c4575a..2e4faa3af4 100644 --- a/media/webrtc/signaling/gtest/jsep_session_unittest.cpp +++ b/media/webrtc/signaling/gtest/jsep_session_unittest.cpp @@ -4985,10 +4985,13 @@ TEST_F(JsepSessionTest, TestRtcpFbStar) { } } -TEST_F(JsepSessionTest, TestUniquePayloadTypes) { - // The audio payload types will all appear more than once, but the video - // payload types will be unique. - AddTracks(*mSessionOff, "audio,audio,video"); +TEST_F(JsepSessionTest, TestUniqueReceivePayloadTypes) { + // The audio payload types will all appear more than once. + // For the offerer, only one video m-section will be receiving, so those + // video payload types will be unique. + // On the other hand, the answerer will have two video m-sections receiving, + // so those _won't_ be unique. + AddTracks(*mSessionOff, "audio,audio,video,video"); AddTracks(*mSessionAns, "audio,audio,video"); std::string offer = CreateOffer(); @@ -5000,49 +5003,67 @@ TEST_F(JsepSessionTest, TestUniquePayloadTypes) { auto offerTransceivers = GetTransceivers(*mSessionOff); auto answerTransceivers = GetTransceivers(*mSessionAns); - ASSERT_EQ(3U, offerTransceivers.size()); - ASSERT_EQ(3U, answerTransceivers.size()); + ASSERT_EQ(4U, offerTransceivers.size()); + ASSERT_EQ(4U, answerTransceivers.size()); ASSERT_FALSE(IsNull(offerTransceivers[0].mRecvTrack)); ASSERT_TRUE(offerTransceivers[0].mRecvTrack.GetNegotiatedDetails()); ASSERT_EQ(0U, offerTransceivers[0] .mRecvTrack.GetNegotiatedDetails() - ->GetUniquePayloadTypes() + ->GetUniqueReceivePayloadTypes() .size()); ASSERT_FALSE(IsNull(offerTransceivers[1].mRecvTrack)); ASSERT_TRUE(offerTransceivers[1].mRecvTrack.GetNegotiatedDetails()); ASSERT_EQ(0U, offerTransceivers[1] .mRecvTrack.GetNegotiatedDetails() - ->GetUniquePayloadTypes() + ->GetUniqueReceivePayloadTypes() .size()); + // First video transceiver is the only one receiving, so gets unique pts. ASSERT_FALSE(IsNull(offerTransceivers[2].mRecvTrack)); ASSERT_TRUE(offerTransceivers[2].mRecvTrack.GetNegotiatedDetails()); ASSERT_NE(0U, offerTransceivers[2] .mRecvTrack.GetNegotiatedDetails() - ->GetUniquePayloadTypes() + ->GetUniqueReceivePayloadTypes() + .size()); + + // First video transceiver is not receiving, so does not get unique pts. + ASSERT_TRUE(IsNull(offerTransceivers[3].mRecvTrack)); + ASSERT_TRUE(offerTransceivers[3].mRecvTrack.GetNegotiatedDetails()); + ASSERT_EQ(0U, offerTransceivers[3] + .mRecvTrack.GetNegotiatedDetails() + ->GetUniqueReceivePayloadTypes() .size()); ASSERT_FALSE(IsNull(answerTransceivers[0].mRecvTrack)); ASSERT_TRUE(answerTransceivers[0].mRecvTrack.GetNegotiatedDetails()); ASSERT_EQ(0U, answerTransceivers[0] .mRecvTrack.GetNegotiatedDetails() - ->GetUniquePayloadTypes() + ->GetUniqueReceivePayloadTypes() .size()); ASSERT_FALSE(IsNull(answerTransceivers[1].mRecvTrack)); ASSERT_TRUE(answerTransceivers[1].mRecvTrack.GetNegotiatedDetails()); ASSERT_EQ(0U, answerTransceivers[1] .mRecvTrack.GetNegotiatedDetails() - ->GetUniquePayloadTypes() + ->GetUniqueReceivePayloadTypes() .size()); + // Answerer is receiving two video streams with the same payload types. + // Neither recv track should have unique pts. ASSERT_FALSE(IsNull(answerTransceivers[2].mRecvTrack)); ASSERT_TRUE(answerTransceivers[2].mRecvTrack.GetNegotiatedDetails()); - ASSERT_NE(0U, answerTransceivers[2] + ASSERT_EQ(0U, answerTransceivers[2] + .mRecvTrack.GetNegotiatedDetails() + ->GetUniqueReceivePayloadTypes() + .size()); + + ASSERT_FALSE(IsNull(answerTransceivers[3].mRecvTrack)); + ASSERT_TRUE(answerTransceivers[3].mRecvTrack.GetNegotiatedDetails()); + ASSERT_EQ(0U, answerTransceivers[3] .mRecvTrack.GetNegotiatedDetails() - ->GetUniquePayloadTypes() + ->GetUniqueReceivePayloadTypes() .size()); } diff --git a/media/webrtc/signaling/gtest/jsep_track_unittest.cpp b/media/webrtc/signaling/gtest/jsep_track_unittest.cpp index cbb351c379..24e39b6a24 100644 --- a/media/webrtc/signaling/gtest/jsep_track_unittest.cpp +++ b/media/webrtc/signaling/gtest/jsep_track_unittest.cpp @@ -302,10 +302,11 @@ class JsepTrackTest : public JsepTrackTestBase { SanityCheckEncodings(a.GetEncoding(i), b.GetEncoding(i)); } - ASSERT_EQ(a.GetUniquePayloadTypes().size(), - b.GetUniquePayloadTypes().size()); - for (size_t i = 0; i < a.GetUniquePayloadTypes().size(); ++i) { - ASSERT_EQ(a.GetUniquePayloadTypes()[i], b.GetUniquePayloadTypes()[i]); + ASSERT_EQ(a.GetUniqueReceivePayloadTypes().size(), + b.GetUniqueReceivePayloadTypes().size()); + for (size_t i = 0; i < a.GetUniqueReceivePayloadTypes().size(); ++i) { + ASSERT_EQ(a.GetUniqueReceivePayloadTypes()[i], + b.GetUniqueReceivePayloadTypes()[i]); } } diff --git a/media/webrtc/signaling/gtest/mediapipeline_unittest.cpp b/media/webrtc/signaling/gtest/mediapipeline_unittest.cpp index afbdb85f18..032023d95f 100644 --- a/media/webrtc/signaling/gtest/mediapipeline_unittest.cpp +++ b/media/webrtc/signaling/gtest/mediapipeline_unittest.cpp @@ -598,6 +598,15 @@ TEST_F(MediaPipelineFilterTest, TestSSRCFilter) { EXPECT_FALSE(Filter(filter, 556, 110)); } +TEST_F(MediaPipelineFilterTest, TestSSRCFilterOverridesPayloadTypeFilter) { + MediaPipelineFilter filter; + filter.AddRemoteSSRC(555); + filter.AddUniqueReceivePT(110); + // We have a configured ssrc; do not allow payload type matching. + EXPECT_FALSE(Filter(filter, 556, 110)); + EXPECT_TRUE(Filter(filter, 555, 110)); +} + #define SSRC(ssrc) \ ((ssrc >> 24) & 0xFF), ((ssrc >> 16) & 0xFF), ((ssrc >> 8) & 0xFF), \ (ssrc & 0xFF) @@ -627,9 +636,14 @@ TEST_F(MediaPipelineFilterTest, TestMidFilter) { TEST_F(MediaPipelineFilterTest, TestPayloadTypeFilter) { MediaPipelineFilter filter; - filter.AddUniquePT(110); + filter.AddUniqueReceivePT(110); EXPECT_TRUE(Filter(filter, 555, 110)); EXPECT_FALSE(Filter(filter, 556, 111)); + // Matching based on unique payload type causes us to learn the ssrc. + EXPECT_TRUE(Filter(filter, 555, 98)); + // Once we have learned an SSRC, do _not_ learn new ones based on payload + // type. + EXPECT_FALSE(Filter(filter, 557, 110)); } TEST_F(MediaPipelineFilterTest, TestSSRCMovedWithMid) { @@ -651,7 +665,7 @@ TEST_F(MediaPipelineFilterTest, TestRemoteSDPNoSSRCs) { MediaPipelineFilter filter; const auto mid = Some(std::string("mid0")); filter.SetRemoteMediaStreamId(mid); - filter.AddUniquePT(111); + filter.AddUniqueReceivePT(111); EXPECT_TRUE(Filter(filter, 555, 110, mid)); EXPECT_TRUE(Filter(filter, 555, 110)); |