media/libopus/silk/resampler_rom.c

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libopus/silk/resampler_rom.c	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,96 @@
     1.4 +/***********************************************************************
     1.5 +Copyright (c) 2006-2011, Skype Limited. All rights reserved.
     1.6 +Redistribution and use in source and binary forms, with or without
     1.7 +modification, are permitted provided that the following conditions
     1.8 +are met:
     1.9 +- Redistributions of source code must retain the above copyright notice,
    1.10 +this list of conditions and the following disclaimer.
    1.11 +- Redistributions in binary form must reproduce the above copyright
    1.12 +notice, this list of conditions and the following disclaimer in the
    1.13 +documentation and/or other materials provided with the distribution.
    1.14 +- Neither the name of Internet Society, IETF or IETF Trust, nor the
    1.15 +names of specific contributors, may be used to endorse or promote
    1.16 +products derived from this software without specific prior written
    1.17 +permission.
    1.18 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    1.19 +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1.20 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    1.21 +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
    1.22 +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    1.23 +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    1.24 +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    1.25 +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    1.26 +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    1.27 +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    1.28 +POSSIBILITY OF SUCH DAMAGE.
    1.29 +***********************************************************************/
    1.30 +
    1.31 +#ifdef HAVE_CONFIG_H
    1.32 +#include "config.h"
    1.33 +#endif
    1.34 +
    1.35 +/* Filter coefficients for IIR/FIR polyphase resampling     *
    1.36 + * Total size: 179 Words (358 Bytes)                        */
    1.37 +
    1.38 +#include "resampler_private.h"
    1.39 +
    1.40 +/* Matlab code for the notch filter coefficients: */
    1.41 +/* B = [1, 0.147, 1];  A = [1, 0.107, 0.89]; G = 0.93; freqz(G * B, A, 2^14, 16e3); axis([0, 8000, -10, 1]) */
    1.42 +/* fprintf('\t%6d, %6d, %6d, %6d\n', round(B(2)*2^16), round(-A(2)*2^16), round((1-A(3))*2^16), round(G*2^15)) */
    1.43 +/* const opus_int16 silk_resampler_up2_hq_notch[ 4 ] = { 9634,  -7012,   7209,  30474 }; */
    1.44 +
    1.45 +/* Tables with IIR and FIR coefficients for fractional downsamplers (123 Words) */
    1.46 +silk_DWORD_ALIGN const opus_int16 silk_Resampler_3_4_COEFS[ 2 + 3 * RESAMPLER_DOWN_ORDER_FIR0 / 2 ] = {
    1.47 +	-20694, -13867,
    1.48 +	   -49,     64,     17,   -157,    353,   -496,    163,  11047,  22205,
    1.49 +	   -39,      6,     91,   -170,    186,     23,   -896,   6336,  19928,
    1.50 +	   -19,    -36,    102,    -89,    -24,    328,   -951,   2568,  15909,
    1.51 +};
    1.52 +
    1.53 +silk_DWORD_ALIGN const opus_int16 silk_Resampler_2_3_COEFS[ 2 + 2 * RESAMPLER_DOWN_ORDER_FIR0 / 2 ] = {
    1.54 +	-14457, -14019,
    1.55 +	    64,    128,   -122,     36,    310,   -768,    584,   9267,  17733,
    1.56 +	    12,    128,     18,   -142,    288,   -117,   -865,   4123,  14459,
    1.57 +};
    1.58 +
    1.59 +silk_DWORD_ALIGN const opus_int16 silk_Resampler_1_2_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR1 / 2 ] = {
    1.60 +	   616, -14323,
    1.61 +	   -10,     39,     58,    -46,    -84,    120,    184,   -315,   -541,   1284,   5380,   9024,
    1.62 +};
    1.63 +
    1.64 +silk_DWORD_ALIGN const opus_int16 silk_Resampler_1_3_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR2 / 2 ] = {
    1.65 +	 16102, -15162,
    1.66 +	   -13,      0,     20,     26,      5,    -31,    -43,     -4,     65,     90,      7,   -157,   -248,    -44,    593,   1583,   2612,   3271,
    1.67 +};
    1.68 +
    1.69 +silk_DWORD_ALIGN const opus_int16 silk_Resampler_1_4_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR2 / 2 ] = {
    1.70 +	 22500, -15099,
    1.71 +	     3,    -14,    -20,    -15,      2,     25,     37,     25,    -16,    -71,   -107,    -79,     50,    292,    623,    982,   1288,   1464,
    1.72 +};
    1.73 +
    1.74 +silk_DWORD_ALIGN const opus_int16 silk_Resampler_1_6_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR2 / 2 ] = {
    1.75 +	 27540, -15257,
    1.76 +	    17,     12,      8,      1,    -10,    -22,    -30,    -32,    -22,      3,     44,    100,    168,    243,    317,    381,    429,    455,
    1.77 +};
    1.78 +
    1.79 +silk_DWORD_ALIGN const opus_int16 silk_Resampler_2_3_COEFS_LQ[ 2 + 2 * 2 ] = {
    1.80 +     -2797,  -6507,
    1.81 +      4697,  10739,
    1.82 +      1567,   8276,
    1.83 +};
    1.84 +
    1.85 +/* Table with interplation fractions of 1/24, 3/24, 5/24, ... , 23/24 : 23/24 (46 Words) */
    1.86 +silk_DWORD_ALIGN const opus_int16 silk_resampler_frac_FIR_12[ 12 ][ RESAMPLER_ORDER_FIR_12 / 2 ] = {
    1.87 +	{  189,  -600,   617, 30567 },
    1.88 +	{  117,  -159, -1070, 29704 },
    1.89 +	{   52,   221, -2392, 28276 },
    1.90 +	{   -4,   529, -3350, 26341 },
    1.91 +	{  -48,   758, -3956, 23973 },
    1.92 +	{  -80,   905, -4235, 21254 },
    1.93 +	{  -99,   972, -4222, 18278 },
    1.94 +	{ -107,   967, -3957, 15143 },
    1.95 +	{ -103,   896, -3487, 11950 },
    1.96 +	{  -91,   773, -2865,  8798 },
    1.97 +	{  -71,   611, -2143,  5784 },
    1.98 +	{  -46,   425, -1375,  2996 },
    1.99 +};

mercurial