media/libopus/celt/mdct.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libopus/celt/mdct.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,70 @@
     1.4 +/* Copyright (c) 2007-2008 CSIRO
     1.5 +   Copyright (c) 2007-2008 Xiph.Org Foundation
     1.6 +   Written by Jean-Marc Valin */
     1.7 +/*
     1.8 +   Redistribution and use in source and binary forms, with or without
     1.9 +   modification, are permitted provided that the following conditions
    1.10 +   are met:
    1.11 +
    1.12 +   - Redistributions of source code must retain the above copyright
    1.13 +   notice, this list of conditions and the following disclaimer.
    1.14 +
    1.15 +   - Redistributions in binary form must reproduce the above copyright
    1.16 +   notice, this list of conditions and the following disclaimer in the
    1.17 +   documentation and/or other materials provided with the distribution.
    1.18 +
    1.19 +   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1.20 +   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    1.21 +   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    1.22 +   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
    1.23 +   OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    1.24 +   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    1.25 +   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    1.26 +   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    1.27 +   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    1.28 +   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    1.29 +   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1.30 +*/
    1.31 +
    1.32 +/* This is a simple MDCT implementation that uses a N/4 complex FFT
    1.33 +   to do most of the work. It should be relatively straightforward to
    1.34 +   plug in pretty much and FFT here.
    1.35 +
    1.36 +   This replaces the Vorbis FFT (and uses the exact same API), which
    1.37 +   was a bit too messy and that was ending up duplicating code
    1.38 +   (might as well use the same FFT everywhere).
    1.39 +
    1.40 +   The algorithm is similar to (and inspired from) Fabrice Bellard's
    1.41 +   MDCT implementation in FFMPEG, but has differences in signs, ordering
    1.42 +   and scaling in many places.
    1.43 +*/
    1.44 +
    1.45 +#ifndef MDCT_H
    1.46 +#define MDCT_H
    1.47 +
    1.48 +#include "opus_defines.h"
    1.49 +#include "kiss_fft.h"
    1.50 +#include "arch.h"
    1.51 +
    1.52 +typedef struct {
    1.53 +   int n;
    1.54 +   int maxshift;
    1.55 +   const kiss_fft_state *kfft[4];
    1.56 +   const kiss_twiddle_scalar * OPUS_RESTRICT trig;
    1.57 +} mdct_lookup;
    1.58 +
    1.59 +int clt_mdct_init(mdct_lookup *l,int N, int maxshift);
    1.60 +void clt_mdct_clear(mdct_lookup *l);
    1.61 +
    1.62 +/** Compute a forward MDCT and scale by 4/N, trashes the input array */
    1.63 +void clt_mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in,
    1.64 +      kiss_fft_scalar * OPUS_RESTRICT out,
    1.65 +      const opus_val16 *window, int overlap, int shift, int stride);
    1.66 +
    1.67 +/** Compute a backward MDCT (no scaling) and performs weighted overlap-add
    1.68 +    (scales implicitly by 1/2) */
    1.69 +void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in,
    1.70 +      kiss_fft_scalar * OPUS_RESTRICT out,
    1.71 +      const opus_val16 * OPUS_RESTRICT window, int overlap, int shift, int stride);
    1.72 +
    1.73 +#endif

mercurial