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: |
Gregory Maxwell | 71d39ad | 2011-07-30 00:00:29 -0400 | [diff] [blame] | 8 | |
Jean-Marc Valin | 8b0137a | 2007-12-06 07:51:53 +1100 | [diff] [blame] | 9 | - Redistributions of source code must retain the above copyright |
| 10 | notice, this list of conditions and the following disclaimer. |
Gregory Maxwell | 71d39ad | 2011-07-30 00:00:29 -0400 | [diff] [blame] | 11 | |
Jean-Marc Valin | 8b0137a | 2007-12-06 07:51:53 +1100 | [diff] [blame] | 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. |
Gregory Maxwell | 71d39ad | 2011-07-30 00:00:29 -0400 | [diff] [blame] | 15 | |
Jean-Marc Valin | 8b0137a | 2007-12-06 07:51:53 +1100 | [diff] [blame] | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
Jean-Marc Valin | cb05e7c | 2012-04-20 16:40:24 -0400 | [diff] [blame] | 19 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER |
| 20 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
Jean-Marc Valin | 8b0137a | 2007-12-06 07:51:53 +1100 | [diff] [blame] | 21 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 22 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 23 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 24 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 25 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | */ |
| 28 | |
| 29 | #ifndef QUANT_BANDS |
| 30 | #define QUANT_BANDS |
| 31 | |
Jean-Marc Valin | e901fe3 | 2008-02-26 14:46:26 +1100 | [diff] [blame] | 32 | #include "arch.h" |
Jean-Marc Valin | 8b0137a | 2007-12-06 07:51:53 +1100 | [diff] [blame] | 33 | #include "modes.h" |
Jean-Marc Valin | 8143be3 | 2007-12-07 16:40:39 +1100 | [diff] [blame] | 34 | #include "entenc.h" |
| 35 | #include "entdec.h" |
Jean-Marc Valin | 24c25a2 | 2009-06-09 11:56:59 -0400 | [diff] [blame] | 36 | #include "mathops.h" |
| 37 | |
Jean-Marc Valin | cf1053d | 2012-07-11 02:54:47 -0400 | [diff] [blame] | 38 | #ifdef FIXED_POINT |
| 39 | extern const signed char eMeans[25]; |
| 40 | #else |
| 41 | extern const opus_val16 eMeans[25]; |
| 42 | #endif |
| 43 | |
Jean-Marc Valin | 504fb3c | 2010-08-06 15:56:22 -0400 | [diff] [blame] | 44 | void amp2Log2(const CELTMode *m, int effEnd, int end, |
Ralph Giles | 120800f | 2011-11-25 13:02:00 -0800 | [diff] [blame] | 45 | celt_ener *bandE, opus_val16 *bandLogE, int C); |
Jean-Marc Valin | 24c25a2 | 2009-06-09 11:56:59 -0400 | [diff] [blame] | 46 | |
Jean-Marc Valin | bc272de | 2010-08-02 09:41:31 -0400 | [diff] [blame] | 47 | void log2Amp(const CELTMode *m, int start, int end, |
Ralph Giles | 120800f | 2011-11-25 13:02:00 -0800 | [diff] [blame] | 48 | celt_ener *eBands, const opus_val16 *oldEBands, int C); |
Jean-Marc Valin | 8b0137a | 2007-12-06 07:51:53 +1100 | [diff] [blame] | 49 | |
Jean-Marc Valin | 5e7f02d | 2010-08-08 09:48:22 -0400 | [diff] [blame] | 50 | void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd, |
Jean-Marc Valin | ff5f722 | 2011-07-29 18:59:12 -0400 | [diff] [blame] | 51 | const opus_val16 *eBands, opus_val16 *oldEBands, opus_uint32 budget, |
Ralph Giles | 120800f | 2011-11-25 13:02:00 -0800 | [diff] [blame] | 52 | opus_val16 *error, ec_enc *enc, int C, int LM, |
Jean-Marc Valin | ff5f722 | 2011-07-29 18:59:12 -0400 | [diff] [blame] | 53 | int nbAvailableBytes, int force_intra, opus_val32 *delayedIntra, |
Jean-Marc Valin | b08c4ca | 2013-04-26 16:32:10 -0400 | [diff] [blame] | 54 | int two_pass, int loss_rate, int lfe); |
Jean-Marc Valin | c890b58 | 2008-08-01 22:26:49 -0400 | [diff] [blame] | 55 | |
Ralph Giles | 120800f | 2011-11-25 13:02:00 -0800 | [diff] [blame] | 56 | void quant_fine_energy(const CELTMode *m, int start, int end, opus_val16 *oldEBands, opus_val16 *error, int *fine_quant, ec_enc *enc, int C); |
Jean-Marc Valin | c890b58 | 2008-08-01 22:26:49 -0400 | [diff] [blame] | 57 | |
Ralph Giles | 120800f | 2011-11-25 13:02:00 -0800 | [diff] [blame] | 58 | void quant_energy_finalise(const CELTMode *m, int start, int end, opus_val16 *oldEBands, opus_val16 *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 | |
Ralph Giles | 120800f | 2011-11-25 13:02:00 -0800 | [diff] [blame] | 60 | void unquant_coarse_energy(const CELTMode *m, int start, int end, opus_val16 *oldEBands, int intra, ec_dec *dec, int C, int LM); |
Jean-Marc Valin | c890b58 | 2008-08-01 22:26:49 -0400 | [diff] [blame] | 61 | |
Ralph Giles | 120800f | 2011-11-25 13:02:00 -0800 | [diff] [blame] | 62 | void unquant_fine_energy(const CELTMode *m, int start, int end, opus_val16 *oldEBands, int *fine_quant, ec_dec *dec, int C); |
Jean-Marc Valin | 8b0137a | 2007-12-06 07:51:53 +1100 | [diff] [blame] | 63 | |
Ralph Giles | 120800f | 2011-11-25 13:02:00 -0800 | [diff] [blame] | 64 | void unquant_energy_finalise(const CELTMode *m, int start, int end, opus_val16 *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 */ |