Jean-Marc Valin | 8b2ff0d | 2009-10-17 21:40:10 -0400 | [diff] [blame] | 1 | /* Copyright (c) 2007-2008 CSIRO |
| 2 | Copyright (c) 2007-2009 Xiph.Org Foundation |
| 3 | Written by Jean-Marc Valin */ |
Jean-Marc Valin | 8b0137a | 2007-12-06 07:51:53 +1100 | [diff] [blame] | 4 | /* |
| 5 | Redistribution and use in source and binary forms, with or without |
| 6 | modification, are permitted provided that the following conditions |
| 7 | are met: |
| 8 | |
| 9 | - Redistributions of source code must retain the above copyright |
| 10 | notice, this list of conditions and the following disclaimer. |
| 11 | |
| 12 | - Redistributions in binary form must reproduce the above copyright |
| 13 | notice, this list of conditions and the following disclaimer in the |
| 14 | documentation and/or other materials provided with the distribution. |
| 15 | |
| 16 | - Neither the name of the Xiph.org Foundation nor the names of its |
| 17 | contributors may be used to endorse or promote products derived from |
| 18 | this software without specific prior written permission. |
| 19 | |
| 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 21 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR |
| 24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 | */ |
| 32 | |
| 33 | #ifndef QUANT_BANDS |
| 34 | #define QUANT_BANDS |
| 35 | |
Jean-Marc Valin | e901fe3 | 2008-02-26 14:46:26 +1100 | [diff] [blame] | 36 | #include "arch.h" |
Jean-Marc Valin | 8b0137a | 2007-12-06 07:51:53 +1100 | [diff] [blame] | 37 | #include "modes.h" |
Jean-Marc Valin | 8143be3 | 2007-12-07 16:40:39 +1100 | [diff] [blame] | 38 | #include "entenc.h" |
| 39 | #include "entdec.h" |
Jean-Marc Valin | 24c25a2 | 2009-06-09 11:56:59 -0400 | [diff] [blame] | 40 | #include "mathops.h" |
| 41 | |
Jean-Marc Valin | 504fb3c | 2010-08-06 15:56:22 -0400 | [diff] [blame] | 42 | void amp2Log2(const CELTMode *m, int effEnd, int end, |
| 43 | celt_ener *bandE, celt_word16 *bandLogE, int _C); |
Jean-Marc Valin | 24c25a2 | 2009-06-09 11:56:59 -0400 | [diff] [blame] | 44 | |
Jean-Marc Valin | bc272de | 2010-08-02 09:41:31 -0400 | [diff] [blame] | 45 | void log2Amp(const CELTMode *m, int start, int end, |
| 46 | celt_ener *eBands, celt_word16 *oldEBands, int _C); |
Jean-Marc Valin | 8b0137a | 2007-12-06 07:51:53 +1100 | [diff] [blame] | 47 | |
Timothy B. Terriberry | ef2e650 | 2010-11-09 01:43:18 -0800 | [diff] [blame^] | 48 | unsigned char *quant_prob_alloc(const CELTMode *m); |
Jean-Marc Valin | bb52881 | 2010-08-25 22:12:18 -0400 | [diff] [blame] | 49 | void quant_prob_free(const celt_int16 *freq); |
Jean-Marc Valin | 8b0137a | 2007-12-06 07:51:53 +1100 | [diff] [blame] | 50 | |
Jean-Marc Valin | 5e7f02d | 2010-08-08 09:48:22 -0400 | [diff] [blame] | 51 | void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd, |
| 52 | const celt_word16 *eBands, celt_word16 *oldEBands, int budget, |
Timothy B. Terriberry | ef2e650 | 2010-11-09 01:43:18 -0800 | [diff] [blame^] | 53 | celt_word16 *error, ec_enc *enc, int _C, int LM, |
Jean-Marc Valin | 1b36d6c | 2010-08-31 17:21:52 -0400 | [diff] [blame] | 54 | int nbAvailableBytes, int force_intra, int *delayedIntra, int two_pass); |
Jean-Marc Valin | c890b58 | 2008-08-01 22:26:49 -0400 | [diff] [blame] | 55 | |
Jean-Marc Valin | 525d7cf | 2010-07-13 14:14:16 -0400 | [diff] [blame] | 56 | void quant_fine_energy(const CELTMode *m, int start, int end, celt_ener *eBands, celt_word16 *oldEBands, celt_word16 *error, int *fine_quant, ec_enc *enc, int _C); |
Jean-Marc Valin | c890b58 | 2008-08-01 22:26:49 -0400 | [diff] [blame] | 57 | |
Jean-Marc Valin | 525d7cf | 2010-07-13 14:14:16 -0400 | [diff] [blame] | 58 | void quant_energy_finalise(const CELTMode *m, int start, int end, celt_ener *eBands, celt_word16 *oldEBands, celt_word16 *error, int *fine_quant, int *fine_priority, int bits_left, ec_enc *enc, int _C); |
Jean-Marc Valin | 3971053 | 2009-06-09 00:10:32 -0400 | [diff] [blame] | 59 | |
Timothy B. Terriberry | ef2e650 | 2010-11-09 01:43:18 -0800 | [diff] [blame^] | 60 | void unquant_coarse_energy(const CELTMode *m, int start, int end, celt_ener *eBands, celt_word16 *oldEBands, int intra, ec_dec *dec, int _C, int LM); |
Jean-Marc Valin | c890b58 | 2008-08-01 22:26:49 -0400 | [diff] [blame] | 61 | |
Jean-Marc Valin | 525d7cf | 2010-07-13 14:14:16 -0400 | [diff] [blame] | 62 | void unquant_fine_energy(const CELTMode *m, int start, int end, celt_ener *eBands, celt_word16 *oldEBands, int *fine_quant, ec_dec *dec, int _C); |
Jean-Marc Valin | 8b0137a | 2007-12-06 07:51:53 +1100 | [diff] [blame] | 63 | |
Jean-Marc Valin | 525d7cf | 2010-07-13 14:14:16 -0400 | [diff] [blame] | 64 | void unquant_energy_finalise(const CELTMode *m, int start, int end, celt_ener *eBands, celt_word16 *oldEBands, int *fine_quant, int *fine_priority, int bits_left, ec_dec *dec, int _C); |
Jean-Marc Valin | 3971053 | 2009-06-09 00:10:32 -0400 | [diff] [blame] | 65 | |
Jean-Marc Valin | 8b0137a | 2007-12-06 07:51:53 +1100 | [diff] [blame] | 66 | #endif /* QUANT_BANDS */ |