blob: 0490bca4b404d4928a9b09395ddf170cea24374a [file] [log] [blame]
Jean-Marc Valin8b2ff0d2009-10-17 21:40:10 -04001/* Copyright (c) 2007-2008 CSIRO
2 Copyright (c) 2007-2009 Xiph.Org Foundation
3 Written by Jean-Marc Valin */
Jean-Marc Valin8b0137a2007-12-06 07:51:53 +11004/*
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 Maxwell71d39ad2011-07-30 00:00:29 -04008
Jean-Marc Valin8b0137a2007-12-06 07:51:53 +11009 - Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
Gregory Maxwell71d39ad2011-07-30 00:00:29 -040011
Jean-Marc Valin8b0137a2007-12-06 07:51:53 +110012 - 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 Maxwell71d39ad2011-07-30 00:00:29 -040015
Jean-Marc Valin8b0137a2007-12-06 07:51:53 +110016 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 Valincb05e7c2012-04-20 16:40:24 -040019 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 Valin8b0137a2007-12-06 07:51:53 +110021 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 Valine901fe32008-02-26 14:46:26 +110032#include "arch.h"
Jean-Marc Valin8b0137a2007-12-06 07:51:53 +110033#include "modes.h"
Jean-Marc Valin8143be32007-12-07 16:40:39 +110034#include "entenc.h"
35#include "entdec.h"
Jean-Marc Valin24c25a22009-06-09 11:56:59 -040036#include "mathops.h"
37
Jean-Marc Valincf1053d2012-07-11 02:54:47 -040038#ifdef FIXED_POINT
39extern const signed char eMeans[25];
40#else
41extern const opus_val16 eMeans[25];
42#endif
43
Jean-Marc Valin504fb3c2010-08-06 15:56:22 -040044void amp2Log2(const CELTMode *m, int effEnd, int end,
Ralph Giles120800f2011-11-25 13:02:00 -080045 celt_ener *bandE, opus_val16 *bandLogE, int C);
Jean-Marc Valin24c25a22009-06-09 11:56:59 -040046
Jean-Marc Valinbc272de2010-08-02 09:41:31 -040047void log2Amp(const CELTMode *m, int start, int end,
Ralph Giles120800f2011-11-25 13:02:00 -080048 celt_ener *eBands, const opus_val16 *oldEBands, int C);
Jean-Marc Valin8b0137a2007-12-06 07:51:53 +110049
Jean-Marc Valin5e7f02d2010-08-08 09:48:22 -040050void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd,
Jean-Marc Valinff5f7222011-07-29 18:59:12 -040051 const opus_val16 *eBands, opus_val16 *oldEBands, opus_uint32 budget,
Ralph Giles120800f2011-11-25 13:02:00 -080052 opus_val16 *error, ec_enc *enc, int C, int LM,
Jean-Marc Valinff5f7222011-07-29 18:59:12 -040053 int nbAvailableBytes, int force_intra, opus_val32 *delayedIntra,
Jean-Marc Valinb08c4ca2013-04-26 16:32:10 -040054 int two_pass, int loss_rate, int lfe);
Jean-Marc Valinc890b582008-08-01 22:26:49 -040055
Ralph Giles120800f2011-11-25 13:02:00 -080056void 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 Valinc890b582008-08-01 22:26:49 -040057
Ralph Giles120800f2011-11-25 13:02:00 -080058void 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 Valin39710532009-06-09 00:10:32 -040059
Ralph Giles120800f2011-11-25 13:02:00 -080060void unquant_coarse_energy(const CELTMode *m, int start, int end, opus_val16 *oldEBands, int intra, ec_dec *dec, int C, int LM);
Jean-Marc Valinc890b582008-08-01 22:26:49 -040061
Ralph Giles120800f2011-11-25 13:02:00 -080062void unquant_fine_energy(const CELTMode *m, int start, int end, opus_val16 *oldEBands, int *fine_quant, ec_dec *dec, int C);
Jean-Marc Valin8b0137a2007-12-06 07:51:53 +110063
Ralph Giles120800f2011-11-25 13:02:00 -080064void 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 Valin39710532009-06-09 00:10:32 -040065
Jean-Marc Valin8b0137a2007-12-06 07:51:53 +110066#endif /* QUANT_BANDS */