1 /* stereoProcessing.h - header file for class providing M/S stereo coding functionality 2 * written by C. R. Helmrich, last modified in 2020 - see License.htm for legal notices 3 * 4 * The copyright in this software is being made available under the exhale Copyright License 5 * and comes with ABSOLUTELY NO WARRANTY. This software may be subject to other third- 6 * party rights, including patent rights. No such rights are granted under this License. 7 * 8 * Copyright (c) 2018-2021 Christian R. Helmrich, project ecodis. All rights reserved. 9 */ 10 11 #ifndef _STEREO_PROCESSING_H_ 12 #define _STEREO_PROCESSING_H_ 13 14 #include "exhaleLibPch.h" 15 #include "specAnalysis.h" // for SA_BW... constants 16 #include <random> 17 18 // constants, experimental macros 19 #define SP_0_DOT_1_16BIT 6554 20 #define SP_EPS 1 21 #define SP_MDST_PRED 1 22 #define SP_OPT_ALPHA_QUANT 1 // quantize alpha_q minimizing RMS distortion in louder channel 23 #define SP_SFB_WISE_STEREO 1 24 #if SP_OPT_ALPHA_QUANT 25 # define SP_DIV (1.0 / 4294967296.0) 26 #endif 27 28 // joint-channel processing class 29 class StereoProcessor 30 { 31 private: 32 33 // member variables 34 #if SP_SFB_WISE_STEREO 35 int32_t m_originBandMdct1[320]; // i.e. 64 * 5 - NOTE: increase this when maximum grpLength > 5 36 int32_t m_originBandMdct2[320]; 37 int32_t m_originBandMdst1[320]; 38 int32_t m_originBandMdst2[320]; 39 #endif 40 #if SP_OPT_ALPHA_QUANT 41 std::minstd_rand m_randomInt32; 42 int32_t m_randomIntMemRe[1+MAX_NUM_SWB_LONG/2]; 43 # if SP_MDST_PRED 44 int32_t m_randomIntMemIm[1+MAX_NUM_SWB_LONG/2]; 45 # endif 46 #endif 47 uint8_t m_stereoCorrValue[1024 >> SA_BW_SHIFT]; // one value for every 32 spectral coefficients 48 49 public: 50 51 // constructor 52 StereoProcessor (); 53 // destructor ~StereoProcessor()54 ~StereoProcessor () { } 55 // public functions 56 unsigned applyPredJointStereo (int32_t* const mdctSpectrum1, int32_t* const mdctSpectrum2, 57 int32_t* const mdstSpectrum1, int32_t* const mdstSpectrum2, 58 SfbGroupData& groupingData1, SfbGroupData& groupingData2, 59 const TnsData& filterData1, const TnsData& filterData2, 60 const uint8_t numSwbFrame, uint8_t* const sfbStereoData, 61 const uint8_t bitRateMode, const bool useFullFrameMS, 62 const bool reversePredDir, const uint8_t realOnlyOffset, 63 uint32_t* const sfbStepSize1, uint32_t* const sfbStepSize2); 64 }; // StereoProcessor 65 66 #endif // _STEREO_PROCESSING_H_ 67