oggenc: return error value from ogg_build_flac_headers()
[FFMpeg-mirror/lagarith.git] / libavcodec / celp_filters.h
blob4a9eb1c49b120cbf69366dbbcdf4e2b40bb38ba3
1 /*
2 * various filters for CELP-based codecs
4 * Copyright (c) 2008 Vladimir Voroshilov
6 * This file is part of FFmpeg.
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 #ifndef AVCODEC_CELP_FILTERS_H
24 #define AVCODEC_CELP_FILTERS_H
26 #include <stdint.h>
28 /**
29 * Circularly convolve fixed vector with a phase dispersion impulse
30 * response filter (D.6.2 of G.729 and 6.1.5 of AMR).
31 * @param fc_out vector with filter applied
32 * @param fc_in source vector
33 * @param filter phase filter coefficients
35 * fc_out[n] = sum(i,0,len-1){ fc_in[i] * filter[(len + n - i)%len] }
37 * \note fc_in and fc_out should not overlap!
39 void ff_celp_convolve_circ(
40 int16_t* fc_out,
41 const int16_t* fc_in,
42 const int16_t* filter,
43 int len);
45 /**
46 * LP synthesis filter.
47 * @param out [out] pointer to output buffer
48 * @param filter_coeffs filter coefficients (-0x8000 <= (3.12) < 0x8000)
49 * @param in input signal
50 * @param buffer_length amount of data to process
51 * @param filter_length filter length (10 for 10th order LP filter)
52 * @param stop_on_overflow 1 - return immediately if overflow occurs
53 * 0 - ignore overflows
54 * @param rounder the amount to add for rounding (usually 0x800 or 0xfff)
56 * @return 1 if overflow occurred, 0 - otherwise
58 * @note Output buffer must contain filter_length samples of past
59 * speech data before pointer.
61 * Routine applies 1/A(z) filter to given speech data.
63 int ff_celp_lp_synthesis_filter(
64 int16_t *out,
65 const int16_t* filter_coeffs,
66 const int16_t* in,
67 int buffer_length,
68 int filter_length,
69 int stop_on_overflow,
70 int rounder);
72 /**
73 * LP synthesis filter.
74 * @param out [out] pointer to output buffer
75 * - the array out[-filter_length, -1] must
76 * contain the previous result of this filter
77 * @param filter_coeffs filter coefficients.
78 * @param in input signal
79 * @param buffer_length amount of data to process
80 * @param filter_length filter length (10 for 10th order LP filter)
82 * @note Output buffer must contain filter_length samples of past
83 * speech data before pointer.
85 * Routine applies 1/A(z) filter to given speech data.
87 void ff_celp_lp_synthesis_filterf(
88 float *out,
89 const float* filter_coeffs,
90 const float* in,
91 int buffer_length,
92 int filter_length);
94 /**
95 * LP zero synthesis filter.
96 * @param out [out] pointer to output buffer
97 * @param filter_coeffs filter coefficients.
98 * @param in input signal
99 * - the array in[-filter_length, -1] must
100 * contain the previous input of this filter
101 * @param buffer_length amount of data to process
102 * @param filter_length filter length (10 for 10th order LP filter)
104 * @note Output buffer must contain filter_length samples of past
105 * speech data before pointer.
107 * Routine applies A(z) filter to given speech data.
109 void ff_celp_lp_zero_synthesis_filterf(
110 float *out,
111 const float* filter_coeffs,
112 const float* in,
113 int buffer_length,
114 int filter_length);
116 #endif /* AVCODEC_CELP_FILTERS_H */