1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-18 22:31:48 -05:00
sdrangel/sdrbase/dsp/inthalfbandfilter.cpp

142 lines
8.8 KiB
C++

#include "dsp/inthalfbandfilter.h"
const qint16 HBFIRFilterTraits<32>::hbMod[32+6] = {
31,32,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19, 20,21,22,
23,24,25,26,27,28,29,30,31,32,0,1,2
};
const qint32 HBFIRFilterTraits<32>::hbCoeffs[8] = {
//* Firwin as in https://www.dsprelated.com/showcode/270.php */
(qint32)(-0.0018878783958199373254477348993418672762 * (1 << hbShift)),
(qint32)( 0.0038624783041994003966734805288751886110 * (1 << hbShift)),
(qint32)(-0.0082424665965482504098593707908548822161 * (1 << hbShift)),
(qint32)( 0.0159471139705940345709933581019868142903 * (1 << hbShift)),
(qint32)(-0.0286765592339759019246958615667608682998 * (1 << hbShift)),
(qint32)( 0.0507185615622293764492845014046906726435 * (1 << hbShift)),
(qint32)(-0.0980159074728618323613105189906491432339 * (1 << hbShift)),
(qint32)( 0.3159417644358786247948955860920250415802 * (1 << hbShift)),
// (qint32)(-0.015956912844043127236437484839370881673 * (1 << hbShift)),
// (qint32)( 0.013023031678944928940522274274371739011 * (1 << hbShift)),
// (qint32)(-0.01866942273717486777684371190844103694 * (1 << hbShift)),
// (qint32)( 0.026550887571157304190005987720724078827 * (1 << hbShift)),
// (qint32)(-0.038350314277854319344740474662103224546 * (1 << hbShift)),
// (qint32)( 0.058429248652825838128421764849917963147 * (1 << hbShift)),
// (qint32)(-0.102889802028955756885153505209018476307 * (1 << hbShift)),
// (qint32)( 0.317237706405931241260276465254719369113 * (1 << hbShift))
};
const qint16 HBFIRFilterTraits<48>::hbMod[48+6] = {
47,48,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,
24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,
47,48,0,1,2
};
const qint32 HBFIRFilterTraits<48>::hbCoeffs[12] = {
//* Firwin as in https://www.dsprelated.com/showcode/270.php */
(qint32)(-0.0011627994808655962074434020436797254661 * (1 << hbShift)),
(qint32)( 0.0017451165792459334517860991553561689216 * (1 << hbShift)),
(qint32)(-0.0029357205890606303047563052643909031758 * (1 << hbShift)),
(qint32)( 0.0048726090910227891003780875678330630763 * (1 << hbShift)),
(qint32)(-0.0077313759655872928144848543752232217230 * (1 << hbShift)),
(qint32)( 0.0117637971494846688830238079503942572046 * (1 << hbShift)),
(qint32)(-0.0173810771817523163074170611253066454083 * (1 << hbShift)),
(qint32)( 0.0253500636065296450216699497559602605179 * (1 << hbShift)),
(qint32)(-0.0373266939135983855102551842719549313188 * (1 << hbShift)),
(qint32)( 0.0576685041500848358242414803953579394147 * (1 << hbShift)),
(qint32)(-0.1024912545928038654086122960507054813206 * (1 << hbShift)),
(qint32)( 0.3173768238826674692454332671331940218806 * (1 << hbShift)),
// (qint32)(-0.004102576237611492253332112767338912818 * (1 << hbShift)),
// (qint32)( 0.003950551047979387886410762575906119309 * (1 << hbShift)),
// (qint32)(-0.005807875789391703583164350277456833282 * (1 << hbShift)),
// (qint32)( 0.00823497890520805998770814682075069868 * (1 << hbShift)),
// (qint32)(-0.011372226513199541059195851744334504474 * (1 << hbShift)),
// (qint32)( 0.015471557140973646315984524335362948477 * (1 << hbShift)),
// (qint32)(-0.020944996398689276484450516591095947661 * (1 << hbShift)),
// (qint32)( 0.028568078132034283034279553703527199104 * (1 << hbShift)),
// (qint32)(-0.040015143905614086738964374490024056286 * (1 << hbShift)),
// (qint32)( 0.059669519431831075095828964549582451582 * (1 << hbShift)),
// (qint32)(-0.103669138691865420076609893840213771909 * (1 << hbShift)),
// (qint32)( 0.317491986549921390015072120149852707982 * (1 << hbShift))
};
const qint16 HBFIRFilterTraits<64>::hbMod[64+6] = {
63,64,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,
24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,
47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,0,1,2
};
const qint32 HBFIRFilterTraits<64>::hbCoeffs[16] = {
//* Remez as in https://www.dsprelated.com/showcode/270.php */
(qint32)(-0.0004653050334792540416659067936677729449 * (1 << hbShift)),
(qint32)( 0.0007120490624526883919470643391491648799 * (1 << hbShift)),
(qint32)(-0.0012303473710125558716887983479182366864 * (1 << hbShift)),
(qint32)( 0.0019716520179919017584369012041634050547 * (1 << hbShift)),
(qint32)(-0.0029947484165425580261710170049127555103 * (1 << hbShift)),
(qint32)( 0.0043703902150498061263128590780979720876 * (1 << hbShift)),
(qint32)(-0.0061858352927315653213558022116558277048 * (1 << hbShift)),
(qint32)( 0.0085554408639278121950777489246320328675 * (1 << hbShift)),
(qint32)(-0.0116397924445187355563247066925214312505 * (1 << hbShift)),
(qint32)( 0.0156852221106748394852115069397768820636 * (1 << hbShift)),
(qint32)(-0.0211070832238078286147153761476147337817 * (1 << hbShift)),
(qint32)( 0.0286850846890029896607554604770484729670 * (1 << hbShift)),
(qint32)(-0.0400956173930921908055147184768429724500 * (1 << hbShift)),
(qint32)( 0.0597215923200692666572564348825835622847 * (1 << hbShift)),
(qint32)(-0.1036982054813635201195864965484361164272 * (1 << hbShift)),
(qint32)( 0.3175014394028848885298543791577685624361 * (1 << hbShift)),
// (qint32)(-0.001114417441601693505720538368564120901 * (1 << hbShift)),
// (qint32)( 0.001268007827185253051302527005361753254 * (1 << hbShift)),
// (qint32)(-0.001959831378850490895410230152151598304 * (1 << hbShift)),
// (qint32)( 0.002878308307661380308073439948657323839 * (1 << hbShift)),
// (qint32)(-0.004071361818258721100571850826099762344 * (1 << hbShift)),
// (qint32)( 0.005597288494657440618973431867289036745 * (1 << hbShift)),
// (qint32)(-0.007532345003308904551886371336877346039 * (1 << hbShift)),
// (qint32)( 0.009980346844667375288961963519795972388 * (1 << hbShift)),
// (qint32)(-0.013092614174300500062830820979797863401 * (1 << hbShift)),
// (qint32)( 0.01710934914871829748417297878404497169 * (1 << hbShift)),
// (qint32)(-0.022443558692997273018576720460259821266 * (1 << hbShift)),
// (qint32)( 0.029875811511593811098386197500076377764 * (1 << hbShift)),
// (qint32)(-0.041086352085710403647667021687084343284 * (1 << hbShift)),
// (qint32)( 0.060465467462665789533104998554335907102 * (1 << hbShift)),
// (qint32)(-0.104159517495977321788203084906854201108 * (1 << hbShift)),
// (qint32)( 0.317657589850154464805598308885237202048 * (1 << hbShift)),
};
const qint16 HBFIRFilterTraits<80>::hbMod[80+6] = {
79,80,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,
24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,
47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,
70,71,72,73,74,75,76,77,78,79,80,0,1,2
};
const qint32 HBFIRFilterTraits<80>::hbCoeffs[20] = {
//* Remez as in https://www.dsprelated.com/showcode/270.php */
(qint32)(-0.0001054430663706784843331246137587697831 * (1 << hbShift)),
(qint32)( 0.0001895717826405601933066613629108587702 * (1 << hbShift)),
(qint32)(-0.0003519516996893227891822497621632237497 * (1 << hbShift)),
(qint32)( 0.0005975111594421821190753485453228677216 * (1 << hbShift)),
(qint32)(-0.0009524124279789792160699768430731637636 * (1 << hbShift)),
(qint32)( 0.0014474605824692796454677967687985074008 * (1 << hbShift)),
(qint32)(-0.0021186428821101787461911314380813564640 * (1 << hbShift)),
(qint32)( 0.0030082068742630901220236339099756150972 * (1 << hbShift)),
(qint32)(-0.0041664004891296358909502650647027621744 * (1 << hbShift)),
(qint32)( 0.0056547140936428538088298623165428580251 * (1 << hbShift)),
(qint32)(-0.0075518323360079901707120342280177283101 * (1 << hbShift)),
(qint32)( 0.0099644038858163180155669280679830990266 * (1 << hbShift)),
(qint32)(-0.0130470841719700410971105597468522319105 * (1 << hbShift)),
(qint32)( 0.0170422818715445859028001507340377429500 * (1 << hbShift)),
(qint32)(-0.0223637819225956900603957677731159492396 * (1 << hbShift)),
(qint32)( 0.0297925991327811050257690084208661573939 * (1 << hbShift)),
(qint32)(-0.0410092859102263174175817539435229264200 * (1 << hbShift)),
(qint32)( 0.0604034694948822267757115866970707429573 * (1 << hbShift)),
(qint32)(-0.1041194584045879306666293473426776472479 * (1 << hbShift)),
(qint32)( 0.3176437752925042046214798574510496109724 * (1 << hbShift)),
};