ref: 4b71303656e23cd9b9ee8c863d6f21b3a174ea31
parent: f81a60ca56f3b179c9433900e9cf5bf28e6f2ac8
author: Jean-Marc Valin <[email protected]>
date: Tue Aug 3 11:49:20 EDT 2010
Removing files that are no longer needed
--- a/libcelt/kfft_single.c
+++ /dev/null
@@ -1,44 +1,0 @@
-/* Copyright (c) 2008 Xiph.Org Foundation, CSIRO
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#ifdef FIXED_POINT
-
-#include "kfft_single.h"
-
-#define SKIP_CONFIG_H
-#include "kiss_fft.c"
-#include "kiss_fftr.c"
-
-#endif
--- a/libcelt/kfft_single.h
+++ /dev/null
@@ -1,84 +1,0 @@
-/* Copyright (c) 2008 Xiph.Org Foundation, CSIRO
-*/
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef KFFT_SINGLE_H
-#define KFFT_SINGLE_H
-
-#ifdef ENABLE_TI_DSPLIB55
-
-#include "dsplib.h"
-
-#define real16_fft_alloc(length) NULL
-#define real16_fft_free(state)
-#define BITREV(state, i) (i)
-
-#define real16_fft_inplace(state, X, nx)\
- (\
- cfft_SCALE(X,nx/2),\
- cbrev(X,X,nx/2),\
- unpack(X,nx)\
- )
-
-#define real16_ifft(state, X, Y, nx) \
- (\
- unpacki(X, nx),\
- cifft_NOSCALE(X,nx/2),\
- cbrev(X,Y,nx/2)\
- )
-
-
-#else /* ENABLE_TI_DSPLIB */
-
-#ifdef FIXED_POINT
-
-#ifdef DOUBLE_PRECISION
-#undef DOUBLE_PRECISION
-#endif
-
-#ifdef MIXED_PRECISION
-#undef MIXED_PRECISION
-#endif
-
-#endif /* FIXED_POINT */
-
-#include "kiss_fft.h"
-#include "kiss_fftr.h"
-#include "_kiss_fft_guts.h"
-
-#define real16_fft_alloc(length) kiss_fftr_alloc_celt_single(length, 0, 0);
-#define real16_fft_free(state) kiss_fft_free(state)
-#define real16_fft_inplace(state, X, nx) kiss_fftr_inplace(state,X)
-#define BITREV(state, i) ((state)->substate->bitrev[i])
-#define real16_ifft(state, X, Y, nx) kiss_fftri(state,X, Y)
-
-#endif /* !ENABLE_TI_DSPLIB */
-
-#endif /* KFFT_SINGLE_H */
--- a/libcelt/kiss_fftr.c
+++ /dev/null
@@ -1,165 +1,0 @@
-/*
-Original version:
-Copyright (c) 2003-2004, Mark Borgerding
-Followed by heavy modifications:
-Copyright (c) 2007-2008, Jean-Marc Valin
-
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef SKIP_CONFIG_H
-# ifdef HAVE_CONFIG_H
-# include "config.h"
-# endif
-#endif
-
-#include "os_support.h"
-#include "mathops.h"
-#include "kiss_fftr.h"
-#include "_kiss_fft_guts.h"
-
-
-kiss_fftr_cfg kiss_fftr_alloc(int nfft,void * mem,size_t * lenmem)
-{
- int i;
- int twiddle_size;
- kiss_fftr_cfg st = NULL;
- size_t subsize, memneeded;
-
- if (nfft & 1) {
- celt_warning("Real FFT optimization must be even.\n");
- return NULL;
- }
- nfft >>= 1;
- twiddle_size = nfft/2+1;
- kiss_fft_alloc (nfft, NULL, &subsize);
- memneeded = sizeof(struct kiss_fftr_state) + subsize + sizeof(kiss_twiddle_cpx)*twiddle_size;
-
- if (lenmem == NULL) {
- st = (kiss_fftr_cfg) KISS_FFT_MALLOC (memneeded);
- } else {
- if (*lenmem >= memneeded)
- st = (kiss_fftr_cfg) mem;
- *lenmem = memneeded;
- }
- if (!st)
- return NULL;
-
- st->substate = (kiss_fft_cfg) (st + 1); /*just beyond kiss_fftr_state struct */
- st->super_twiddles = (kiss_twiddle_cpx*) (((char *) st->substate) + subsize);
- kiss_fft_alloc(nfft, st->substate, &subsize);
-#ifndef FIXED_POINT
- st->substate->scale *= .5;
-#endif
-
-#if defined (FIXED_POINT) && (!defined(DOUBLE_PRECISION) || defined(MIXED_PRECISION))
- for (i=0;i<twiddle_size;++i) {
- celt_word32 phase = i+(nfft>>1);
- kf_cexp2(st->super_twiddles+i, DIV32(SHL32(phase,16),nfft));
- }
-#else
- for (i=0;i<twiddle_size;++i) {
- const double pi=3.14159265358979323846264338327;
- double phase = pi*(((double)i) /nfft + .5);
- kf_cexp(st->super_twiddles+i, phase );
- }
-#endif
- return st;
-}
-
-void kiss_fftr_twiddles(kiss_fftr_cfg st,kiss_fft_scalar *freqdata)
-{
- /* input buffer timedata is stored row-wise */
- int k,ncfft;
- kiss_fft_cpx f2k,f1k,tdc,tw;
-
- ncfft = st->substate->nfft;
-
- /* The real part of the DC element of the frequency spectrum in st->tmpbuf
- * contains the sum of the even-numbered elements of the input time sequence
- * The imag part is the sum of the odd-numbered elements
- *
- * The sum of tdc.r and tdc.i is the sum of the input time sequence.
- * yielding DC of input time sequence
- * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1...
- * yielding Nyquist bin of input time sequence
- */
-
- tdc.r = freqdata[0];
- tdc.i = freqdata[1];
- C_FIXDIV(tdc,2);
- CHECK_OVERFLOW_OP(tdc.r ,+, tdc.i);
- CHECK_OVERFLOW_OP(tdc.r ,-, tdc.i);
- freqdata[0] = tdc.r + tdc.i;
- freqdata[1] = tdc.r - tdc.i;
-
- for ( k=1;k <= ncfft/2 ; ++k )
- {
- f2k.r = SHR32(SUB32(EXT32(freqdata[2*k]), EXT32(freqdata[2*(ncfft-k)])),1);
- f2k.i = PSHR32(ADD32(EXT32(freqdata[2*k+1]), EXT32(freqdata[2*(ncfft-k)+1])),1);
-
- f1k.r = SHR32(ADD32(EXT32(freqdata[2*k]), EXT32(freqdata[2*(ncfft-k)])),1);
- f1k.i = SHR32(SUB32(EXT32(freqdata[2*k+1]), EXT32(freqdata[2*(ncfft-k)+1])),1);
-
- C_MULC( tw , f2k , st->super_twiddles[k]);
-
- freqdata[2*k] = HALF_OF(f1k.r + tw.r);
- freqdata[2*k+1] = HALF_OF(f1k.i + tw.i);
- freqdata[2*(ncfft-k)] = HALF_OF(f1k.r - tw.r);
- freqdata[2*(ncfft-k)+1] = HALF_OF(tw.i - f1k.i);
-
- }
-}
-
-void kiss_fftr(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar *freqdata)
-{
- /*perform the parallel fft of two real signals packed in real,imag*/
- kiss_fft( st->substate , (const kiss_fft_cpx*)timedata, (kiss_fft_cpx *)freqdata );
-
- kiss_fftr_twiddles(st,freqdata);
-}
-
-void kiss_fftr_inplace(kiss_fftr_cfg st, kiss_fft_scalar *X)
-{
- kf_work((kiss_fft_cpx*)X, NULL, 1,1, st->substate->factors,st->substate, 1, 1, 1);
- kiss_fftr_twiddles(st,X);
-}
-
-void kiss_fftri(kiss_fftr_cfg st,const kiss_fft_scalar *freqdata,kiss_fft_scalar *timedata)
-{
- /* input buffer timedata is stored row-wise */
- int k, ncfft;
-
- ncfft = st->substate->nfft;
-
- timedata[2*st->substate->bitrev[0]] = freqdata[0] + freqdata[1];
- timedata[2*st->substate->bitrev[0]+1] = freqdata[0] - freqdata[1];
- for (k = 1; k <= ncfft / 2; ++k) {
- kiss_fft_cpx fk, fnkc, fek, fok, tmp;
- int k1, k2;
- k1 = st->substate->bitrev[k];
- k2 = st->substate->bitrev[ncfft-k];
- fk.r = freqdata[2*k];
- fk.i = freqdata[2*k+1];
- fnkc.r = freqdata[2*(ncfft-k)];
- fnkc.i = -freqdata[2*(ncfft-k)+1];
-
- C_ADD (fek, fk, fnkc);
- C_SUB (tmp, fk, fnkc);
- C_MUL (fok, tmp, st->super_twiddles[k]);
- timedata[2*k1] = fek.r + fok.r;
- timedata[2*k1+1] = fek.i + fok.i;
- timedata[2*k2] = fek.r - fok.r;
- timedata[2*k2+1] = fok.i - fek.i;
- }
- ki_work((kiss_fft_cpx*)timedata, NULL, 1,1, st->substate->factors,st->substate, 1, 1, 1);
-}
--- a/libcelt/kiss_fftr.h
+++ /dev/null
@@ -1,82 +1,0 @@
-/*
-Original version:
-Copyright (c) 2003-2004, Mark Borgerding
-Followed by heavy modifications:
-Copyright (c) 2007-2008, Jean-Marc Valin
-
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef KISS_FTR_H
-#define KISS_FTR_H
-
-#include "kiss_fft.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define kiss_fftr_alloc SUF(kiss_fftr_alloc,KF_SUFFIX)
-#define kiss_fftr_inplace SUF(kiss_fftr_inplace,KF_SUFFIX)
-#define kiss_fftr_alloc SUF(kiss_fftr_alloc,KF_SUFFIX)
-#define kiss_fftr_twiddles SUF(kiss_fftr_twiddles,KF_SUFFIX)
-#define kiss_fftr SUF(kiss_fftr,KF_SUFFIX)
-#define kiss_fftri SUF(kiss_fftri,KF_SUFFIX)
-
-/*
-
- Real optimized version can save about 45% cpu time vs. complex fft of a real seq.
-
-
-
- */
-
-struct kiss_fftr_state{
- kiss_fft_cfg substate;
- kiss_twiddle_cpx * super_twiddles;
-#ifdef USE_SIMD
- long pad;
-#endif
- };
-
-typedef struct kiss_fftr_state *kiss_fftr_cfg;
-
-
-kiss_fftr_cfg kiss_fftr_alloc(int nfft,void * mem, size_t * lenmem);
-/*
- nfft must be even
-
- If you don't care to allocate space, use mem = lenmem = NULL
-*/
-
-
-/*
- input timedata has nfft scalar points
- output freqdata has nfft/2+1 complex points, packed into nfft scalar points
-*/
-void kiss_fftr_twiddles(kiss_fftr_cfg st,kiss_fft_scalar *freqdata);
-
-void kiss_fftr(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar *freqdata);
-void kiss_fftr_inplace(kiss_fftr_cfg st, kiss_fft_scalar *X);
-
-void kiss_fftri(kiss_fftr_cfg st,const kiss_fft_scalar *freqdata, kiss_fft_scalar *timedata);
-
-/*
- input freqdata has nfft/2+1 complex points, packed into nfft scalar points
- output timedata has nfft scalar points
-*/
-
-#define kiss_fftr_free speex_free
-
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/libcelt/mfrngdec.c
+++ /dev/null
@@ -1,248 +1,0 @@
-/* Copyright (c) 2001-2008 Timothy B. Terriberry
- Copyright (c) 2008-2009 Xiph.Org Foundation */
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "arch.h"
-#include "entdec.h"
-#include "mfrngcod.h"
-
-
-
-/*A multiply-free range decoder.
- This is an entropy decoder based upon \cite{Mar79}, which is itself a
- rediscovery of the FIFO arithmetic code introduced by \cite{Pas76}.
- It is very similar to arithmetic encoding, except that encoding is done with
- digits in any base, instead of with bits, and so it is faster when using
- larger bases (i.e.: a byte).
- The author claims an average waste of $\frac{1}{2}\log_b(2b)$ bits, where $b$
- is the base, longer than the theoretical optimum, but to my knowledge there
- is no published justification for this claim.
- This only seems true when using near-infinite precision arithmetic so that
- the process is carried out with no rounding errors.
-
- IBM (the author's employer) never sought to patent the idea, and to my
- knowledge the algorithm is unencumbered by any patents, though its
- performance is very competitive with proprietary arithmetic coding.
- The two are based on very similar ideas, however.
- An excellent description of implementation details is available at
- http://www.arturocampos.com/ac_range.html
- A recent work \cite{MNW98} which proposes several changes to arithmetic
- encoding for efficiency actually re-discovers many of the principles
- behind range encoding, and presents a good theoretical analysis of them.
-
- The coder is made multiply-free by replacing the standard multiply/divide
- used to partition the current interval according to the total frequency
- count.
- The new partition function scales the count so that it differs from the size
- of the interval by no more than a factor of two and then assigns each symbol
- one or two code words in the interval.
- For details see \cite{SM98}.
-
- End of stream is handled by writing out the smallest number of bits that
- ensures that the stream will be correctly decoded regardless of the value of
- any subsequent bits.
- ec_dec_tell() can be used to determine how many bits were needed to decode
- all the symbols thus far; other data can be packed in the remaining bits of
- the input buffer.
-
- @PHDTHESIS{Pas76,
- author="Richard Clark Pasco",
- title="Source coding algorithms for fast data compression",
- school="Dept. of Electrical Engineering, Stanford University",
- address="Stanford, CA",
- month=May,
- year=1976
- }
- @INPROCEEDINGS{Mar79,
- author="Martin, G.N.N.",
- title="Range encoding: an algorithm for removing redundancy from a digitised
- message",
- booktitle="Video & Data Recording Conference",
- year=1979,
- address="Southampton",
- month=Jul
- }
- @ARTICLE{MNW98,
- author="Alistair Moffat and Radford Neal and Ian H. Witten",
- title="Arithmetic Coding Revisited",
- journal="{ACM} Transactions on Information Systems",
- year=1998,
- volume=16,
- number=3,
- pages="256--294",
- month=Jul,
- URL="http://www.stanford.edu/class/ee398/handouts/papers/Moffat98ArithmCoding.pdf"
- }
- @INPROCEEDINGS{SM98,
- author="Lang Stuiver and Alistair Moffat",
- title="Piecewise Integer Mapping for Arithmetic Coding",
- booktitle="Proceedings of the {IEEE} Data Compression Conference",
- pages="1--10",
- address="Snowbird, UT",
- month="Mar./Apr.",
- year=1998
- }*/
-
-
-/*Gets the next byte of input.
- After all the bytes in the current packet have been consumed, and the extra
- end code returned if needed, this function will continue to return zero each
- time it is called.
- Return: The next byte of input.*/
-static int ec_dec_in(ec_dec *_this){
- int ret;
- ret=ec_byte_read1(_this->buf);
- if(ret<0){
- ret=0;
- /*Needed to keep oc_dec_tell() operating correctly.*/
- ec_byte_adv1(_this->buf);
- }
- return ret;
-}
-
-/*Normalizes the contents of dif and rng so that rng lies entirely in the
- high-order symbol.*/
-static inline void ec_dec_normalize(ec_dec *_this){
- /*If the range is too small, rescale it and input some bits.*/
- while(_this->rng<=EC_CODE_BOT){
- int sym;
- _this->rng<<=EC_SYM_BITS;
- /*Use up the remaining bits from our last symbol.*/
- sym=_this->rem<<EC_CODE_EXTRA&EC_SYM_MAX;
- /*Read the next value from the input.*/
- _this->rem=ec_dec_in(_this);
- /*Take the rest of the bits we need from this new symbol.*/
- sym|=_this->rem>>EC_SYM_BITS-EC_CODE_EXTRA;
- _this->dif=(_this->dif<<EC_SYM_BITS)+sym&EC_CODE_MASK;
- /*dif can never be larger than EC_CODE_TOP.
- This is equivalent to the slightly more readable:
- if(_this->dif>EC_CODE_TOP)_this->dif-=EC_CODE_TOP;*/
- _this->dif^=_this->dif&_this->dif-1&EC_CODE_TOP;
- }
-}
-
-void ec_dec_init(ec_dec *_this,ec_byte_buffer *_buf){
- _this->buf=_buf;
- _this->rem=ec_dec_in(_this);
- _this->rng=1U<<EC_CODE_EXTRA;
- _this->dif=_this->rem>>EC_SYM_BITS-EC_CODE_EXTRA;
- /*Normalize the interval.*/
- ec_dec_normalize(_this);
- _this->end_bits_left=0;
- _this->nb_end_bits=0;
-
-}
-
-unsigned ec_decode(ec_dec *_this,unsigned _ft){
- ec_uint32 ft;
- ec_uint32 d;
- unsigned e;
- /*Step 1: Compute the normalization factor for the frequency counts.*/
- _this->nrm=EC_ILOG(_this->rng)-EC_ILOG(_ft);
- ft=(ec_uint32)_ft<<_this->nrm;
- e=ft>_this->rng;
- ft>>=e;
- _this->nrm-=e;
- /*Step 2: invert the partition function.*/
- d=_this->rng-ft;
- return EC_MAXI((ec_int32)(_this->dif>>1),(ec_int32)(_this->dif-d))>>
- _this->nrm;
- /*Step 3: The caller locates the range [fl,fh) containing the return value
- and calls ec_dec_update().*/
-}
-
-unsigned ec_decode_bin(ec_dec *_this,unsigned bits){
-#if 0
- return ec_decode(_this, 1U<<bits);
-#else
- unsigned value=0;
- int count=0;
- _this->nb_end_bits += bits;
- while (bits>=_this->end_bits_left)
- {
- value |= _this->end_byte>>(8-_this->end_bits_left)<<count;
- count += _this->end_bits_left;
- bits -= _this->end_bits_left;
- _this->end_byte=ec_byte_look_at_end(_this->buf);
- _this->end_bits_left = 8;
- }
- value |= ((_this->end_byte>>(8-_this->end_bits_left))&((1<<bits)-1))<<count;
- _this->end_bits_left -= bits;
- return value;
-#endif
-}
-
-void ec_dec_update(ec_dec *_this,unsigned _fl,unsigned _fh,unsigned _ft){
- ec_uint32 fl;
- ec_uint32 fh;
- ec_uint32 ft;
- ec_uint32 r;
- ec_uint32 s;
- ec_uint32 d;
- /*Step 4: Evaluate the two partition function values.*/
- fl=(ec_uint32)_fl<<_this->nrm;
- fh=(ec_uint32)_fh<<_this->nrm;
- ft=(ec_uint32)_ft<<_this->nrm;
- d=_this->rng-ft;
- r=fh+EC_MINI(fh,d);
- s=fl+EC_MINI(fl,d);
- /*Step 5: Update the interval.*/
- _this->rng=r-s;
- _this->dif-=s;
- /*Step 6: Normalize the interval.*/
- ec_dec_normalize(_this);
-}
-
-long ec_dec_tell(ec_dec *_this,int _b){
- ec_uint32 r;
- int l;
- long nbits;
- nbits=(ec_byte_bytes(_this->buf)-(EC_CODE_BITS+EC_SYM_BITS-1)/EC_SYM_BITS)*
- EC_SYM_BITS;
- /*To handle the non-integral number of bits still left in the decoder state,
- we compute the number of bits of low that must be encoded to ensure that
- the value is inside the range for any possible subsequent bits.*/
- nbits+=EC_CODE_BITS+1+_this->nb_end_bits;
- nbits<<=_b;
- l=EC_ILOG(_this->rng);
- r=_this->rng>>l-16;
- while(_b-->0){
- int b;
- r=r*r>>15;
- b=(int)(r>>16);
- l=l<<1|b;
- r>>=b;
- }
- return nbits-l;
-}
--- a/libcelt/mfrngenc.c
+++ /dev/null
@@ -1,236 +1,0 @@
-/* Copyright (c) 2001-2008 Timothy B. Terriberry
- Copyright (c) 2008 Xiph.Org Foundation */
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "arch.h"
-#include "entenc.h"
-#include "mfrngcod.h"
-
-
-
-/*A multiply-free range encoder.
- See mfrngdec.c and the references for implementation details
- \cite{Mar79,MNW98,SM98}.
-
- @INPROCEEDINGS{Mar79,
- author="Martin, G.N.N.",
- title="Range encoding: an algorithm for removing redundancy from a digitised
- message",
- booktitle="Video \& Data Recording Conference",
- year=1979,
- address="Southampton",
- month=Jul
- }
- @ARTICLE{MNW98,
- author="Alistair Moffat and Radford Neal and Ian H. Witten",
- title="Arithmetic Coding Revisited",
- journal="{ACM} Transactions on Information Systems",
- year=1998,
- volume=16,
- number=3,
- pages="256--294",
- month=Jul,
- URL="http://www.stanford.edu/class/ee398/handouts/papers/Moffat98ArithmCoding.pdf"
- }
- @INPROCEEDINGS{SM98,
- author="Lang Stuiver and Alistair Moffat",
- title="Piecewise Integer Mapping for Arithmetic Coding",
- booktitle="Proceedings of the {IEEE} Data Compression Conference",
- pages="1--10",
- address="Snowbird, UT",
- month="Mar./Apr.",
- year=1998
- }*/
-
-
-
-/*Outputs a symbol, with a carry bit.
- If there is a potential to propagate a carry over several symbols, they are
- buffered until it can be determined whether or not an actual carry will
- occur.
- If the counter for the buffered symbols overflows, then the stream becomes
- undecodable.
- This gives a theoretical limit of a few billion symbols in a single packet on
- 32-bit systems.
- The alternative is to truncate the range in order to force a carry, but
- requires similar carry tracking in the decoder, needlessly slowing it down.*/
-static void ec_enc_carry_out(ec_enc *_this,int _c){
- if(_c!=EC_SYM_MAX){
- /*No further carry propagation possible, flush buffer.*/
- int carry;
- carry=_c>>EC_SYM_BITS;
- /*Don't output a byte on the first write.
- This compare should be taken care of by branch-prediction thereafter.*/
- if(_this->rem>=0)ec_byte_write1(_this->buf,_this->rem+carry);
- if(_this->ext>0){
- unsigned sym;
- sym=EC_SYM_MAX+carry&EC_SYM_MAX;
- do ec_byte_write1(_this->buf,sym);
- while(--(_this->ext)>0);
- }
- _this->rem=_c&EC_SYM_MAX;
- }
- else _this->ext++;
-}
-
-static inline void ec_enc_normalize(ec_enc *_this){
- /*If the range is too small, output some bits and rescale it.*/
- while(_this->rng<=EC_CODE_BOT){
- ec_enc_carry_out(_this,(int)(_this->low>>EC_CODE_SHIFT));
- /*Move the next-to-high-order symbol into the high-order position.*/
- _this->low=_this->low<<EC_SYM_BITS&EC_CODE_TOP-1;
- _this->rng<<=EC_SYM_BITS;
- }
-}
-
-void ec_enc_init(ec_enc *_this,ec_byte_buffer *_buf){
- _this->buf=_buf;
- _this->rem=-1;
- _this->ext=0;
- _this->low=0;
- _this->rng=EC_CODE_TOP;
- _this->end_byte=0;
- _this->end_bits_left=8;
- _this->nb_end_bits=0;
-}
-
-void ec_encode(ec_enc *_this,unsigned _fl,unsigned _fh,unsigned _ft){
- ec_uint32 fl;
- ec_uint32 fh;
- ec_uint32 ft;
- ec_uint32 r;
- ec_uint32 s;
- ec_uint32 d;
- int e;
- int nrm;
- /*Step 1: we want ft in the range of [rng/2,rng).
- The high-order bits of the rng and ft are computed via a logarithm.
- This could also be done on some architectures with some custom assembly,
- which would provide even more speed.*/
- nrm=EC_ILOG(_this->rng)-EC_ILOG(_ft);
- /*Having the same high order bit may be too much.
- We may need to shift one less to ensure that ft is actually in the proper
- range.*/
- ft=(ec_uint32)_ft<<nrm;
- e=ft>_this->rng;
- ft>>=e;
- nrm-=e;
- /*We then scale everything by the computed power of 2.*/
- fl=(ec_uint32)_fl<<nrm;
- fh=(ec_uint32)_fh<<nrm;
- /*Step 2: compute the two values of the partition function.
- d is the splitting point of the interval [0,ft).*/
- d=_this->rng-ft;
- r=fh+EC_MINI(fh,d);
- s=fl+EC_MINI(fl,d);
- /*Step 3: Update the end-point and range of the interval.*/
- _this->low+=s;
- _this->rng=r-s;
- /*Step 4: Normalize the interval.*/
- ec_enc_normalize(_this);
-}
-
-void ec_encode_bin(ec_enc *_this,unsigned _fl,unsigned _fh,unsigned bits){
-#if 0
- ec_encode(_this, _fl, _fh, 1U<<bits);
-#else
- _this->nb_end_bits += bits;
- while (bits >= _this->end_bits_left)
- {
- _this->end_byte |= (_fl<<(8-_this->end_bits_left)) & 0xff;
- _fl >>= _this->end_bits_left;
- ec_byte_write_at_end(_this->buf, _this->end_byte);
- _this->end_byte = 0;
- bits -= _this->end_bits_left;
- _this->end_bits_left = 8;
- }
- _this->end_byte |= (_fl<<(8-_this->end_bits_left)) & 0xff;
- _this->end_bits_left -= bits;
-#endif
-}
-
-long ec_enc_tell(ec_enc *_this,int _b){
- ec_uint32 r;
- int l;
- long nbits;
- nbits=(ec_byte_bytes(_this->buf)+(_this->rem>=0)+_this->ext)*EC_SYM_BITS;
- /*To handle the non-integral number of bits still left in the encoder state,
- we compute the number of bits of low that must be encoded to ensure that
- the value is inside the range for any possible subsequent bits.*/
- nbits+=EC_CODE_BITS+1+_this->nb_end_bits;
- nbits<<=_b;
- l=EC_ILOG(_this->rng);
- r=_this->rng>>l-16;
- while(_b-->0){
- int b;
- r=r*r>>15;
- b=(int)(r>>16);
- l=l<<1|b;
- r>>=b;
- }
- return nbits-l;
-}
-
-void ec_enc_done(ec_enc *_this){
- ec_uint32 end;
- ec_uint32 msk;
- int l;
- /*We output the minimum number of bits that ensures that the symbols encoded
- thus far will be decoded correctly regardless of the bits that follow.*/
- l=EC_CODE_BITS-EC_ILOG(_this->rng);
- msk=EC_CODE_TOP-1>>l;
- end=_this->low+msk&~msk;
- if((end|msk)>=_this->low+_this->rng){
- l++;
- msk>>=1;
- end=_this->low+msk&~msk;
- }
- while(l>0){
- ec_enc_carry_out(_this,(int)(end>>EC_CODE_SHIFT));
- end=end<<EC_SYM_BITS&EC_CODE_TOP-1;
- l-=EC_SYM_BITS;
- }
- /*If we have a buffered byte flush it into the output buffer.*/
- if(_this->rem>=0||_this->ext>0){
- ec_enc_carry_out(_this,0);
- _this->rem=-1;
- }
- {
- unsigned char *ptr = _this->buf->ptr;
- while (ptr<= _this->buf->end_ptr)
- *ptr++ = 0;
- if (_this->end_bits_left != 8)
- *_this->buf->end_ptr |= _this->end_byte;
- }
-}
--- a/libcelt/psy.c
+++ /dev/null
@@ -1,211 +1,0 @@
-/* Copyright (c) 2007-2008 CSIRO
- Copyright (c) 2007-2009 Xiph.Org Foundation
- Written by Jean-Marc Valin */
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "psy.h"
-#include <math.h>
-#include "os_support.h"
-#include "arch.h"
-#include "stack_alloc.h"
-#include "mathops.h"
-
-/* The Vorbis freq<->Bark mapping */
-#define toBARK(n) (13.1f*atan(.00074f*(n))+2.24f*atan((n)*(n)*1.85e-8f)+1e-4f*(n))
-#define fromBARK(z) (102.f*(z)-2.f*pow(z,2.f)+.4f*pow(z,3.f)+pow(1.46f,z)-1.f)
-
-#ifndef STATIC_MODES
-/* Psychoacoustic spreading function. The idea here is compute a first order
- recursive filter. The filter coefficient is frequency dependent and
- chosen such that we have a -10dB/Bark slope on the right side and a -25dB/Bark
- slope on the left side. */
-void psydecay_init(struct PsyDecay *decay, int len, celt_int32 Fs)
-{
- int i;
- celt_word16 *decayR = (celt_word16*)celt_alloc(sizeof(celt_word16)*len);
- decay->decayR = decayR;
- if (decayR==NULL)
- return;
- for (i=0;i<len;i++)
- {
- float f;
- float deriv;
- /* Real frequency (in Hz) */
- f = Fs*i*(1/(2.f*len));
- /* This is the derivative of the Vorbis freq->Bark function (see above) */
- deriv = (8.288e-8 * f)/(3.4225e-16 *f*f*f*f + 1) + .009694/(5.476e-7 *f*f + 1) + 1e-4;
- /* Back to FFT bin units */
- deriv *= Fs*(1/(2.f*len));
- /* decay corresponding to -10dB/Bark */
- decayR[i] = Q15ONE*pow(.1f, deriv);
- /* decay corresponding to -25dB/Bark */
- /*decay->decayL[i] = Q15ONE*pow(0.0031623f, deriv);*/
- /*printf ("%f %f\n", decayL[i], decayR[i]);*/
- }
-}
-
-void psydecay_clear(struct PsyDecay *decay)
-{
- celt_free((celt_word16 *)decay->decayR);
- /*celt_free(decay->decayL);*/
-}
-#endif
-
-static void spreading_func(const struct PsyDecay *d, celt_word32 * restrict psd, int len)
-{
- int i;
- celt_word32 mem;
- /* Compute right slope (-10 dB/Bark) */
- mem=psd[0];
- for (i=0;i<len;i++)
- {
- /* psd = (1-decay)*psd + decay*mem */
- psd[i] = EPSILON + psd[i] + MULT16_32_Q15(d->decayR[i],mem-psd[i]);
- mem = psd[i];
- }
- /* Compute left slope (-25 dB/Bark) */
- mem=psd[len-1];
- for (i=len-1;i>=0;i--)
- {
- /* Left side has around twice the slope as the right side, so we just
- square the coef instead of storing two sets of decay coefs */
- celt_word16 decayL = MULT16_16_Q15(d->decayR[i], d->decayR[i]);
- /* psd = (1-decay)*psd + decay*mem */
- psd[i] = EPSILON + psd[i] + MULT16_32_Q15(decayL,mem-psd[i]);
- mem = psd[i];
- }
-#if 0 /* Prints signal and mask energy per critical band */
- for (i=0;i<25;i++)
- {
- int start,end;
- int j;
- celt_word32 Esig=0, Emask=0;
- start = (int)floor(fromBARK((float)i)*(2*len)/Fs);
- if (start<0)
- start = 0;
- end = (int)ceil(fromBARK((float)(i+1))*(2*len)/Fs);
- if (end<=start)
- end = start+1;
- if (end>len-1)
- end = len-1;
- for (j=start;j<end;j++)
- {
- Esig += psd[j];
- Emask += mask[j];
- }
- printf ("%f %f ", Esig, Emask);
- }
- printf ("\n");
-#endif
-}
-
-/* Compute a marking threshold from the spectrum X. */
-void compute_masking(const struct PsyDecay *decay, celt_word16 *X, celt_mask * restrict mask, int len)
-{
- int i;
- int N;
- N=len>>1;
- mask[0] = MULT16_16(X[0], X[0]);
- for (i=1;i<N;i++)
- mask[i] = ADD32(MULT16_16(X[i*2], X[i*2]), MULT16_16(X[i*2+1], X[i*2+1]));
- /* TODO: Do tone masking */
- /* Noise masking */
- spreading_func(decay, mask, N);
-}
-
-#ifdef EXP_PSY /* Not needed for now, but will be useful in the future */
-void compute_mdct_masking(const struct PsyDecay *decay, celt_word32 *X, celt_word16 *tonality, celt_word16 *long_window, celt_mask *mask, int len)
-{
- int i;
- VARDECL(float, psd);
- SAVE_STACK;
- ALLOC(psd, len, float);
- for (i=0;i<len;i++)
- psd[i] = X[i]*X[i]*tonality[i];
- for (i=1;i<len-1;i++)
- mask[i] = .5*psd[i] + .25*(psd[i-1]+psd[i+1]);
- /*psd[0] = .5*mask[0]+.25*(mask[1]+mask[2]);*/
- mask[0] = .5*psd[0]+.5*psd[1];
- mask[len-1] = .5*(psd[len-1]+psd[len-2]);
- /* TODO: Do tone masking */
- /* Noise masking */
- spreading_func(decay, mask, len);
- RESTORE_STACK;
-}
-
-void compute_tonality(const CELTMode *m, celt_word16 * restrict X, celt_word16 * mem, int len, celt_word16 *tonality, int mdct_size)
-{
- int i;
- celt_word16 norm_1;
- celt_word16 *mem2;
- int N = len>>2;
-
- mem2 = mem+2*N;
- X[0] = 0;
- X[1] = 0;
- tonality[0] = 1;
- for (i=1;i<N;i++)
- {
- celt_word16 re, im, re2, im2;
- re = X[2*i];
- im = X[2*i+1];
- /* Normalise spectrum */
- norm_1 = celt_rsqrt(.01+MAC16_16(MULT16_16(re,re), im,im));
- re = MULT16_16(re, norm_1);
- im = MULT16_16(im, norm_1);
- /* Phase derivative */
- re2 = re*mem[2*i] + im*mem[2*i+1];
- im2 = im*mem[2*i] - re*mem[2*i+1];
- mem[2*i] = re;
- mem[2*i+1] = im;
- /* Phase second derivative */
- re = re2*mem2[2*i] + im2*mem2[2*i+1];
- im = im2*mem2[2*i] - re2*mem2[2*i+1];
- mem2[2*i] = re2;
- mem2[2*i+1] = im2;
- /*printf ("%f ", re);*/
- X[2*i] = re;
- X[2*i+1] = im;
- }
- /*printf ("\n");*/
- for (i=0;i<mdct_size;i++)
- {
- tonality[i] = 1.0-X[2*i]*X[2*i]*X[2*i];
- if (tonality[i]>1)
- tonality[i] = 1;
- if (tonality[i]<.02)
- tonality[i]=.02;
- }
-}
-#endif
--- a/libcelt/psy.h
+++ /dev/null
@@ -1,57 +1,0 @@
-/* Copyright (c) 2007-2008 CSIRO
- Copyright (c) 2007-2009 Xiph.Org Foundation
- Written by Jean-Marc Valin */
-/*
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- - Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-#ifndef PSY_H
-#define PSY_H
-
-#include "arch.h"
-#include "celt.h"
-
-struct PsyDecay {
- /*celt_word16 *decayL;*/
- const celt_word16 * restrict decayR;
-};
-
-/** Pre-compute the decay of the psycho-acoustic spreading function */
-void psydecay_init(struct PsyDecay *decay, int len, celt_int32 Fs);
-
-/** Free the memory allocated for the spreading function */
-void psydecay_clear(struct PsyDecay *decay);
-
-/** Compute the masking curve for an input (DFT) spectrum X */
-void compute_masking(const struct PsyDecay *decay, celt_word16 *X, celt_mask *mask, int len);
-
-/** Compute the masking curve for an input (MDCT) spectrum X */
-void compute_mdct_masking(const struct PsyDecay *decay, celt_word32 *X, celt_word16 *tonality, celt_word16 *long_window, celt_mask *mask, int len);
-
-void compute_tonality(const CELTMode *m, celt_word16 * restrict X, celt_word16 * mem, int len, celt_word16 *tonality, int mdct_size);
-
-#endif /* PSY_H */