1 /* 2 * Musepack audio compression 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 */ 18 19 // psy_tab.h 20 #define PART_LONG 57 // number of partitions for long 21 #define PART_SHORT (PART_LONG / 3) // number of partitions for short 22 #define MAX_SPL 20 // maximum assumed Sound Pressure Level 23 24 // psy.c 25 #define SHORTFFT_OFFSET 168 // fft-offset for short FFT's 26 #define PREFAC_LONG 10 // preecho-factor for long partitions 27 28 29 #define MAX_CVD_LINE 300 // maximum FFT-Index for CVD 30 #define CVD_UNPRED 0.040f // unpredictability (cw) for CVD-detected bins, e33 (04) 31 #define MIN_ANALYZED_IDX 12 // maximum base-frequency = 44100/MIN_ANALYZED_IDX ^^^^^^ 32 #define MED_ANALYZED_IDX 50 // maximum base-frequency = 44100/MED_ANALYZED_IDX ^^^^^^ 33 #define MAX_ANALYZED_IDX 900 // minimum base-frequency = 44100/MAX_ANALYZED_IDX (816 for Amnesia) 34 35 36 #define MAX_NS_ORDER 6 // maximum order of the Adaptive Noise Shaping Filter (IIR) 37 #define MAX_ANS_BANDS 16 38 #define MAX_ANS_LINES (32 * MAX_ANS_BANDS) // maximum number of noiseshaped FFT-lines 39 ///////// 16 * MAX_ANS_BANDS not sufficient? ////////////////// 40 #define MS2SPAT1 0.5f 41 #define MS2SPAT2 0.25f 42 #define MS2SPAT3 0.125f 43 #define MS2SPAT4 0.0625f 44 45 typedef struct { 46 float L [32]; 47 float R [32]; 48 float M [32]; 49 float S [32]; 50 } SMRTyp; 51 52 typedef struct { 53 int Max_Band; // maximum bandwidth 54 float SampleFreq; 55 int MainQual; // main profile quality 56 float FullQual; // full profile quality 57 58 // profile params 59 float ShortThr; // Factor to calculate the masking threshold with transients 60 int MinValChoice; 61 unsigned int EarModelFlag; 62 float Ltq_offset; // Offset for threshold in quiet 63 float TMN; // Offset for purely sinusoid components 64 float NMT; // Offset for purely noisy components 65 float minSMR; // minimum SMR for all subbands 66 float Ltq_max; // maximum level for threshold in quiet 67 float BandWidth; 68 unsigned char tmpMask_used; // global flag for temporal masking 69 unsigned char CVD_used; // global flag for ClearVoiceDetection 70 float varLtq; // variable threshold in quiet 71 unsigned char MS_Channelmode; 72 int CombPenalities; 73 unsigned int NS_Order; // Maximum order for ANS 74 float PNS; 75 float TransDetect; // minimum slewrate for transient detection 76 77 // ans.h 78 unsigned int NS_Order_L [32]; 79 unsigned int NS_Order_R [32]; // frame-wise order of the Noiseshaping (0: off, 1...5: on) 80 float FIR_L [32] [MAX_NS_ORDER]; 81 float FIR_R [32] [MAX_NS_ORDER]; // contains FIR-Filter for NoiseShaping 82 float SNR_comp_L [32]; 83 float SNR_comp_R [32]; // SNR-compensation after SCF-combination and ANS-gain 84 85 float KBD1; // = 2. 86 float KBD2; // = -1. 87 88 // FIXME : remove this : 89 int * SCF_Index_L; 90 int * SCF_Index_R; // Scalefactor-index for Bitstream 91 92 } PsyModel; 93 94