media/libopus/celt/mdct.h

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /* Copyright (c) 2007-2008 CSIRO
     2    Copyright (c) 2007-2008 Xiph.Org Foundation
     3    Written by Jean-Marc Valin */
     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:
     9    - Redistributions of source code must retain the above copyright
    10    notice, this list of conditions and the following disclaimer.
    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.
    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
    19    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
    20    OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    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 */
    29 /* This is a simple MDCT implementation that uses a N/4 complex FFT
    30    to do most of the work. It should be relatively straightforward to
    31    plug in pretty much and FFT here.
    33    This replaces the Vorbis FFT (and uses the exact same API), which
    34    was a bit too messy and that was ending up duplicating code
    35    (might as well use the same FFT everywhere).
    37    The algorithm is similar to (and inspired from) Fabrice Bellard's
    38    MDCT implementation in FFMPEG, but has differences in signs, ordering
    39    and scaling in many places.
    40 */
    42 #ifndef MDCT_H
    43 #define MDCT_H
    45 #include "opus_defines.h"
    46 #include "kiss_fft.h"
    47 #include "arch.h"
    49 typedef struct {
    50    int n;
    51    int maxshift;
    52    const kiss_fft_state *kfft[4];
    53    const kiss_twiddle_scalar * OPUS_RESTRICT trig;
    54 } mdct_lookup;
    56 int clt_mdct_init(mdct_lookup *l,int N, int maxshift);
    57 void clt_mdct_clear(mdct_lookup *l);
    59 /** Compute a forward MDCT and scale by 4/N, trashes the input array */
    60 void clt_mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in,
    61       kiss_fft_scalar * OPUS_RESTRICT out,
    62       const opus_val16 *window, int overlap, int shift, int stride);
    64 /** Compute a backward MDCT (no scaling) and performs weighted overlap-add
    65     (scales implicitly by 1/2) */
    66 void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in,
    67       kiss_fft_scalar * OPUS_RESTRICT out,
    68       const opus_val16 * OPUS_RESTRICT window, int overlap, int shift, int stride);
    70 #endif

mercurial