media/libsoundtouch/src/InterpolateLinear.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 ////////////////////////////////////////////////////////////////////////////////
michael@0 2 ///
michael@0 3 /// Linear interpolation routine.
michael@0 4 ///
michael@0 5 /// Author : Copyright (c) Olli Parviainen
michael@0 6 /// Author e-mail : oparviai 'at' iki.fi
michael@0 7 /// SoundTouch WWW: http://www.surina.net/soundtouch
michael@0 8 ///
michael@0 9 ////////////////////////////////////////////////////////////////////////////////
michael@0 10 //
michael@0 11 // $Id: InterpolateLinear.h 179 2014-01-06 18:41:42Z oparviai $
michael@0 12 //
michael@0 13 ////////////////////////////////////////////////////////////////////////////////
michael@0 14 //
michael@0 15 // License :
michael@0 16 //
michael@0 17 // SoundTouch audio processing library
michael@0 18 // Copyright (c) Olli Parviainen
michael@0 19 //
michael@0 20 // This library is free software; you can redistribute it and/or
michael@0 21 // modify it under the terms of the GNU Lesser General Public
michael@0 22 // License as published by the Free Software Foundation; either
michael@0 23 // version 2.1 of the License, or (at your option) any later version.
michael@0 24 //
michael@0 25 // This library is distributed in the hope that it will be useful,
michael@0 26 // but WITHOUT ANY WARRANTY; without even the implied warranty of
michael@0 27 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
michael@0 28 // Lesser General Public License for more details.
michael@0 29 //
michael@0 30 // You should have received a copy of the GNU Lesser General Public
michael@0 31 // License along with this library; if not, write to the Free Software
michael@0 32 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
michael@0 33 //
michael@0 34 ////////////////////////////////////////////////////////////////////////////////
michael@0 35
michael@0 36 #ifndef _InterpolateLinear_H_
michael@0 37 #define _InterpolateLinear_H_
michael@0 38
michael@0 39 #include "RateTransposer.h"
michael@0 40 #include "STTypes.h"
michael@0 41
michael@0 42 namespace soundtouch
michael@0 43 {
michael@0 44
michael@0 45 /// Linear transposer class that uses integer arithmetics
michael@0 46 class InterpolateLinearInteger : public TransposerBase
michael@0 47 {
michael@0 48 protected:
michael@0 49 int iFract;
michael@0 50 int iRate;
michael@0 51
michael@0 52 virtual void resetRegisters();
michael@0 53
michael@0 54 virtual int transposeMono(SAMPLETYPE *dest,
michael@0 55 const SAMPLETYPE *src,
michael@0 56 int &srcSamples);
michael@0 57 virtual int transposeStereo(SAMPLETYPE *dest,
michael@0 58 const SAMPLETYPE *src,
michael@0 59 int &srcSamples);
michael@0 60 virtual int transposeMulti(SAMPLETYPE *dest, const SAMPLETYPE *src, int &srcSamples);
michael@0 61 public:
michael@0 62 InterpolateLinearInteger();
michael@0 63
michael@0 64 /// Sets new target rate. Normal rate = 1.0, smaller values represent slower
michael@0 65 /// rate, larger faster rates.
michael@0 66 virtual void setRate(float newRate);
michael@0 67 };
michael@0 68
michael@0 69
michael@0 70 /// Linear transposer class that uses floating point arithmetics
michael@0 71 class InterpolateLinearFloat : public TransposerBase
michael@0 72 {
michael@0 73 protected:
michael@0 74 float fract;
michael@0 75
michael@0 76 virtual void resetRegisters();
michael@0 77
michael@0 78 virtual int transposeMono(SAMPLETYPE *dest,
michael@0 79 const SAMPLETYPE *src,
michael@0 80 int &srcSamples);
michael@0 81 virtual int transposeStereo(SAMPLETYPE *dest,
michael@0 82 const SAMPLETYPE *src,
michael@0 83 int &srcSamples);
michael@0 84 virtual int transposeMulti(SAMPLETYPE *dest, const SAMPLETYPE *src, int &srcSamples);
michael@0 85
michael@0 86 public:
michael@0 87 InterpolateLinearFloat();
michael@0 88 };
michael@0 89
michael@0 90 }
michael@0 91
michael@0 92 #endif

mercurial