Cleaner way to take into account the prediction for stereo width
[opus.git] / silk / resampler_private.h
1 /***********************************************************************
2 Copyright (c) 2006-2011, Skype Limited. All rights reserved.
3 Redistribution and use in source and binary forms, with or without
4 modification, (subject to the limitations in the disclaimer below)
5 are permitted provided that the following conditions are met:
6 - Redistributions of source code must retain the above copyright notice,
7 this list of conditions and the following disclaimer.
8 - Redistributions in binary form must reproduce the above copyright
9 notice, this list of conditions and the following disclaimer in the
10 documentation and/or other materials provided with the distribution.
11 - Neither the name of Skype Limited, nor the names of specific
12 contributors, may be used to endorse or promote products derived from
13 this software without specific prior written permission.
14 NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
15 BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
16 CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 ***********************************************************************/
27
28 #ifndef SILK_RESAMPLER_H
29 #define SILK_RESAMPLER_H
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #include "SigProc_FIX.h"
36 #include "resampler_structs.h"
37 #include "resampler_rom.h"
38
39 /* Number of input samples to process in the inner loop */
40 #define RESAMPLER_MAX_BATCH_SIZE_IN             480
41
42 /* Description: Hybrid IIR/FIR polyphase implementation of resampling    */
43 void silk_resampler_private_IIR_FIR(
44     void                            *SS,            /* I/O: Resampler state                         */
45     opus_int16                        out[],            /* O:    Output signal                             */
46     const opus_int16                    in[],            /* I:    Input signal                            */
47     opus_int32                        inLen            /* I:    Number of input samples                    */
48 );
49
50 /* Description: Hybrid IIR/FIR polyphase implementation of resampling    */
51 void silk_resampler_private_down_FIR(
52     void                            *SS,            /* I/O: Resampler state                         */
53     opus_int16                        out[],            /* O:    Output signal                             */
54     const opus_int16                    in[],            /* I:    Input signal                            */
55     opus_int32                        inLen            /* I:    Number of input samples                    */
56 );
57
58 /* Copy */
59 void silk_resampler_private_copy(
60     void                            *SS,            /* I/O: Resampler state (unused)                */
61     opus_int16                        out[],            /* O:    Output signal                             */
62     const opus_int16                    in[],            /* I:    Input signal                            */
63     opus_int32                        inLen            /* I:    Number of input samples                    */
64 );
65
66 /* Upsample by a factor 2, high quality */
67 void silk_resampler_private_up2_HQ_wrapper(
68     void                            *SS,            /* I/O: Resampler state (unused)                */
69     opus_int16                       *out,           /* O:   Output signal [ 2 * len ]               */
70     const opus_int16                 *in,            /* I:   Input signal [ len ]                    */
71     opus_int32                       len             /* I:   Number of input samples                 */
72 );
73
74 /* Upsample by a factor 2, high quality */
75 void silk_resampler_private_up2_HQ(
76     opus_int32                        *S,                /* I/O: Resampler state [ 6 ]                    */
77     opus_int16                       *out,           /* O:   Output signal [ 2 * len ]               */
78     const opus_int16                 *in,            /* I:   Input signal [ len ]                    */
79     opus_int32                       len             /* I:   Number of input samples                 */
80 );
81
82 /* Second order AR filter */
83 void silk_resampler_private_AR2(
84     opus_int32                        S[],            /* I/O: State vector [ 2 ]                        */
85     opus_int32                        out_Q8[],        /* O:    Output signal                            */
86     const opus_int16                    in[],            /* I:    Input signal                            */
87     const opus_int16                    A_Q14[],        /* I:    AR coefficients, Q14                     */
88     opus_int32                        len                /* I:    Signal length                            */
89 );
90
91 #ifdef __cplusplus
92 }
93 #endif
94 #endif /* SILK_RESAMPLER_H*/
95