Qmmp
/usr/src/RPM/BUILD/qmmp-0.11-svn/src/qmmp/dithering_p.h
00001 /***************************************************************************
00002  *  Based on madplay project                                               *
00003  *                                                                         *
00004  * Copyright (C) 2000-2004 Robert Leslie <rob@mars.org>                    *
00005  * Copyright (C) 2016 Ilya Kotov forkotov02@hotmail.ru                     *
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  *   This program is distributed in the hope that it will be useful,       *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU General Public License for more details.                          *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU General Public License     *
00018  *   along with this program; if not, write to the                         *
00019  *   Free Software Foundation, Inc.,                                       *
00020  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
00021  ***************************************************************************/
00022 
00023 
00024 #ifndef DITHERING_P_H
00025 #define DITHERING_P_H
00026 
00027 #include "effect.h"
00028 
00032 class Dithering : public Effect
00033 {
00034 public:
00035     Dithering();
00036 
00037     void configure(quint32 srate, ChannelMap map);
00038     void setFormats(Qmmp::AudioFormat in, Qmmp::AudioFormat out);
00039     void applyEffect(Buffer *b);
00040     void setEnabled(bool enabled);
00041 
00042 private:
00043     void clearHistory();
00044     int m_chan;
00045 
00046     typedef struct
00047     {
00048         float error[3];
00049         quint32 random;
00050 
00051     } AudioDither;
00052 
00053     AudioDither m_dither[9];
00054     float m_lsb;
00055     bool m_required, m_enabled;
00056 
00057 
00058     quint32 prng(quint32 state);
00059     float audioLinearDither(float sample, AudioDither *dither);
00060 };
00061 
00062 #endif // DITHERING_P_H
 All Classes Functions Variables Enumerations Enumerator