diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2011-10-15 15:31:30 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2011-10-15 15:31:30 +0000 |
| commit | 6001cbf024d3bd902edb19d4e770efb7f37e14d0 (patch) | |
| tree | 8bdbdb443c249af79db6857efdcd7db6cf8c7394 /src/plugins/Input/mad/decoder_mad.h | |
| parent | 0ca799e3f0c6744b66941d04398d6706c7279b85 (diff) | |
| download | qmmp-6001cbf024d3bd902edb19d4e770efb7f37e14d0.tar.gz qmmp-6001cbf024d3bd902edb19d4e770efb7f37e14d0.tar.bz2 qmmp-6001cbf024d3bd902edb19d4e770efb7f37e14d0.zip | |
mad plugin: added dithering
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@2403 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Input/mad/decoder_mad.h')
| -rw-r--r-- | src/plugins/Input/mad/decoder_mad.h | 49 |
1 files changed, 39 insertions, 10 deletions
diff --git a/src/plugins/Input/mad/decoder_mad.h b/src/plugins/Input/mad/decoder_mad.h index c78e3f8c8..bae3ab58b 100644 --- a/src/plugins/Input/mad/decoder_mad.h +++ b/src/plugins/Input/mad/decoder_mad.h @@ -1,8 +1,25 @@ -// Copyright (c) 2000-2001 Brad Hughes <bhughes@trolltech.com> -// -// Use, modification and distribution is allowed without limitation, -// warranty, or liability of any kind. -// +/*************************************************************************** + * Based on mq3 and madplay progects * + * * + * Copyright (c) 2000-2001 Brad Hughes <bhughes@trolltech.com> * + * Copyright (C) 2000-2004 Robert Leslie <rob@mars.org> * + * Copyright (C) 2009-2011 Ilya Kotov forkotov02@hotmail.ru * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ #ifndef DECODER_MAD_H #define DECODER_MAD_H @@ -18,7 +35,6 @@ extern "C" #include <mad.h> } - class DecoderMAD : public Decoder { public: @@ -34,7 +50,7 @@ public: private: // helper functions - qint64 madOutput(char *data, qint64 size); + qint64 madOutput(char *data, qint64 size); bool fillBuffer(); void deinit(); bool findHeader(); @@ -69,9 +85,22 @@ private: XING_SCALE = 0x0008 }; - struct mad_stream stream; - struct mad_frame frame; - struct mad_synth synth; + struct audio_dither + { + mad_fixed_t error[3]; + mad_fixed_t random; + }; + + struct mad_stream m_stream; + struct mad_frame m_frame; + struct mad_synth m_synth; + struct audio_dither m_left_dither, m_right_dither; + + //converter functions + unsigned long prng(unsigned long state); + void clip(mad_fixed_t *sample); + long audio_linear_dither(unsigned int bits, mad_fixed_t sample, struct audio_dither *dither); + long audio_linear_round(unsigned int bits, mad_fixed_t sample); }; |
