18d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 28d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* ----------------------------------------------------------------------------------------------------------- 38d520ff1dc2da35cdca849e982051b86468016d8Dmitry ShmidtSoftware License for The Fraunhofer FDK AAC Codec Library for Android 48d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt� Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur F�rderung der angewandten Forschung e.V. 6c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt All rights reserved. 78d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 88d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1. INTRODUCTION 98d520ff1dc2da35cdca849e982051b86468016d8Dmitry ShmidtThe Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software that implements 108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtthe MPEG Advanced Audio Coding ("AAC") encoding and decoding scheme for digital audio. 118d520ff1dc2da35cdca849e982051b86468016d8Dmitry ShmidtThis FDK AAC Codec software is intended to be used on a wide variety of Android devices. 128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 138d520ff1dc2da35cdca849e982051b86468016d8Dmitry ShmidtAAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient general perceptual 148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtaudio codecs. AAC-ELD is considered the best-performing full-bandwidth communications codec by 158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtindependent studies and is widely deployed. AAC has been standardized by ISO and IEC as part 168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtof the MPEG specifications. 178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 188d520ff1dc2da35cdca849e982051b86468016d8Dmitry ShmidtPatent licenses for necessary patent claims for the FDK AAC Codec (including those of Fraunhofer) 198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtmay be obtained through Via Licensing (www.vialicensing.com) or through the respective patent owners 208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtindividually for the purpose of encoding or decoding bit streams in products that are compliant with 218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtthe ISO/IEC MPEG audio standards. Please note that most manufacturers of Android devices already license 228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtthese patent claims through Via Licensing or directly from the patent owners, and therefore FDK AAC Codec 238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtsoftware may already be covered under those patent licenses when it is used for those licensed purposes only. 248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 258d520ff1dc2da35cdca849e982051b86468016d8Dmitry ShmidtCommercially-licensed AAC software libraries, including floating-point versions with enhanced sound quality, 268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtare also available from Fraunhofer. Users are encouraged to check the Fraunhofer website for additional 278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtapplications information and documentation. 288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt2. COPYRIGHT LICENSE 301d755d025b206e22b06aeb322e25a79f98ca7777Dmitry Shmidt 318d520ff1dc2da35cdca849e982051b86468016d8Dmitry ShmidtRedistribution and use in source and binary forms, with or without modification, are permitted without 328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtpayment of copyright license fees provided that you satisfy the following conditions: 338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 348d520ff1dc2da35cdca849e982051b86468016d8Dmitry ShmidtYou must retain the complete text of this software license in redistributions of the FDK AAC Codec or 358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtyour modifications thereto in source code form. 368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 378d520ff1dc2da35cdca849e982051b86468016d8Dmitry ShmidtYou must retain the complete text of this software license in the documentation and/or other materials 388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtprovided with redistributions of the FDK AAC Codec or your modifications thereto in binary form. 398d520ff1dc2da35cdca849e982051b86468016d8Dmitry ShmidtYou must make available free of charge copies of the complete source code of the FDK AAC Codec and your 408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtmodifications thereto to recipients of copies in binary form. 418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 428d520ff1dc2da35cdca849e982051b86468016d8Dmitry ShmidtThe name of Fraunhofer may not be used to endorse or promote products derived from this library without 438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtprior written permission. 448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 458d520ff1dc2da35cdca849e982051b86468016d8Dmitry ShmidtYou may not charge copyright license fees for anyone to use, copy or distribute the FDK AAC Codec 468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtsoftware or your modifications thereto. 478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 488d520ff1dc2da35cdca849e982051b86468016d8Dmitry ShmidtYour modified versions of the FDK AAC Codec must carry prominent notices stating that you changed the software 498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtand the date of any change. For modified versions of the FDK AAC Codec, the term 508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt"Fraunhofer FDK AAC Codec Library for Android" must be replaced by the term 518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt"Third-Party Modified Version of the Fraunhofer FDK AAC Codec Library for Android." 528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt3. NO PATENT LICENSE 548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 558d520ff1dc2da35cdca849e982051b86468016d8Dmitry ShmidtNO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without limitation the patents of Fraunhofer, 568d520ff1dc2da35cdca849e982051b86468016d8Dmitry ShmidtARE GRANTED BY THIS SOFTWARE LICENSE. Fraunhofer provides no warranty of patent non-infringement with 578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtrespect to this software. 588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 598d520ff1dc2da35cdca849e982051b86468016d8Dmitry ShmidtYou may use this FDK AAC Codec software or modifications thereto only for purposes that are authorized 608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtby appropriate patent licenses. 618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt4. DISCLAIMER 638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 648d520ff1dc2da35cdca849e982051b86468016d8Dmitry ShmidtThis FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright holders and contributors 658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt"AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, including but not limited to the implied warranties 668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtof merchantability and fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 678d520ff1dc2da35cdca849e982051b86468016d8Dmitry ShmidtCONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, or consequential damages, 688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtincluding but not limited to procurement of substitute goods or services; loss of use, data, or profits, 698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtor business interruption, however caused and on any theory of liability, whether in contract, strict 708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtliability, or tort (including negligence), arising in any way out of the use of this software, even if 718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtadvised of the possibility of such damage. 728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt5. CONTACT INFORMATION 748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 758d520ff1dc2da35cdca849e982051b86468016d8Dmitry ShmidtFraunhofer Institute for Integrated Circuits IIS 768d520ff1dc2da35cdca849e982051b86468016d8Dmitry ShmidtAttention: Audio and Multimedia Departments - FDK AAC LL 778d520ff1dc2da35cdca849e982051b86468016d8Dmitry ShmidtAm Wolfsmantel 33 788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt91058 Erlangen, Germany 798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtwww.iis.fraunhofer.de/amm 818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtamm-info@iis.fraunhofer.de 828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt----------------------------------------------------------------------------------------------------------- */ 838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/******************************** MPEG Audio Encoder ************************** 858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt author: M. Werner 878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt contents/description: Convert chaos measure to the tonality index 888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt******************************************************************************/ 908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "tonality.h" 928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#include "chaosmeasure.h" 938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic const FIXP_DBL normlog = (FIXP_DBL)0xd977d949; /*FL2FXCONST_DBL(-0.4342944819f * FDKlog(2.0)/FDKlog(2.7182818)); */ 958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void FDKaacEnc_CalcSfbTonality(FIXP_DBL *RESTRICT spectrum, 978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt INT *RESTRICT sfbMaxScaleSpec, 988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt FIXP_DBL *RESTRICT chaosMeasure, 998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt FIXP_SGL *RESTRICT sfbTonality, 1008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt INT sfbCnt, 1018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const INT *RESTRICT sfbOffset, 1028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt FIXP_DBL *RESTRICT sfbEnergyLD64 ); 1038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid FDKaacEnc_CalculateFullTonality(FIXP_DBL *RESTRICT spectrum, 1068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt INT *RESTRICT sfbMaxScaleSpec, 1078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt FIXP_DBL *RESTRICT sfbEnergyLD64, 1088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt FIXP_SGL *RESTRICT sfbTonality, 1098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt INT sfbCnt, 1108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const INT *sfbOffset, 1118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt INT usePns) 1128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 1138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt INT j; 1148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#if defined(ARCH_PREFER_MULT_32x16) 1158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt FIXP_SGL alpha_0 = FL2FXCONST_SGL(0.25f); /* used in smooth ChaosMeasure */ 1168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt FIXP_SGL alpha_1 = FL2FXCONST_SGL(1.0f-0.25f); /* used in smooth ChaosMeasure */ 1178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#else 1188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt FIXP_DBL alpha_0 = FL2FXCONST_DBL(0.25f); /* used in smooth ChaosMeasure */ 1198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt FIXP_DBL alpha_1 = FL2FXCONST_DBL(1.0f-0.25f); /* used in smooth ChaosMeasure */ 1208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif 1218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt INT numberOfLines = sfbOffset[sfbCnt]; 1228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (!usePns) 1248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt return; 1258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt C_ALLOC_SCRATCH_START(chaosMeasurePerLine, FIXP_DBL, (1024)); 1278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* calculate chaos measure */ 1288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt FDKaacEnc_CalculateChaosMeasure(spectrum, 1298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt numberOfLines, 1308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt chaosMeasurePerLine); 1318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* smooth ChaosMeasure */ 1338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt for (j=1;j<numberOfLines;j++) { 1348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt FIXP_DBL tmp = fMultDiv2(alpha_1, chaosMeasurePerLine[j]); 1358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt chaosMeasurePerLine[j] = fMultAdd(tmp, alpha_0, chaosMeasurePerLine[j-1]); 1368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 1378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt FDKaacEnc_CalcSfbTonality(spectrum, 1398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt sfbMaxScaleSpec, 1408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt chaosMeasurePerLine, 1418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt sfbTonality, 1428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt sfbCnt, 1438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt sfbOffset, 1448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt sfbEnergyLD64); 1458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt C_ALLOC_SCRATCH_END(chaosMeasurePerLine, FIXP_DBL, (1024)); 1478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 1488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/***************************************************************************** 1518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt functionname: CalculateTonalityIndex 1538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt description: computes tonality values out of unpredictability values 1548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt limits range and computes log() 1558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt returns: 1568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt input: ptr to energies, ptr to chaos measure values, 1578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt number of sfb 1588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt output: sfb wise tonality values 1598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt*****************************************************************************/ 1618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstatic void FDKaacEnc_CalcSfbTonality(FIXP_DBL *RESTRICT spectrum, 1628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt INT *RESTRICT sfbMaxScaleSpec, 1638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt FIXP_DBL *RESTRICT chaosMeasure, 1648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt FIXP_SGL *RESTRICT sfbTonality, 1658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt INT sfbCnt, 1668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt const INT *RESTRICT sfbOffset, 1678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt FIXP_DBL *RESTRICT sfbEnergyLD64 ) 1688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt{ 1698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt INT i, j; 1708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt for (i=0; i<sfbCnt; i++) { 1728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt FIXP_DBL chaosMeasureSfbLD64; 1738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt INT shiftBits = fixMax(0,sfbMaxScaleSpec[i] - 4); /* max sfbWidth = 96 ; 2^7=128 => 7/2 = 4 (spc*spc) */ 1748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt FIXP_DBL chaosMeasureSfb = FL2FXCONST_DBL(0.0); 1768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* calc chaosMeasurePerSfb */ 1788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt for (j=(sfbOffset[i+1]-sfbOffset[i])-1; j>=0; j--) { 1798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt FIXP_DBL tmp = (*spectrum++)<<shiftBits; 1808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt FIXP_DBL lineNrg = fMultDiv2(tmp, tmp); 1818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt chaosMeasureSfb = fMultAddDiv2(chaosMeasureSfb, lineNrg, *chaosMeasure++); 1828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 1838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* calc tonalityPerSfb */ 1858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (chaosMeasureSfb != FL2FXCONST_DBL(0.0)) 1868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 1878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt /* add ld(convtone)/64 and 2/64 bec.fMultDiv2 */ 1888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt chaosMeasureSfbLD64 = CalcLdData((chaosMeasureSfb)) - sfbEnergyLD64[i]; 1898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt chaosMeasureSfbLD64 += FL2FXCONST_DBL(3.0f/64) - ((FIXP_DBL)(shiftBits)<<(DFRACT_BITS-6)); 1908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 1918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (chaosMeasureSfbLD64 > FL2FXCONST_DBL(-0.0519051) ) /* > ld(0.05)+ld(2) */ 1928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt { 1938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt if (chaosMeasureSfbLD64 <= FL2FXCONST_DBL(0.0) ) 1948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt sfbTonality[i] = FX_DBL2FX_SGL(fMultDiv2( chaosMeasureSfbLD64 , normlog ) << 7); 1958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt else 1968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt sfbTonality[i] = FL2FXCONST_SGL(0.0); 1978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 1988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt else 1998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt sfbTonality[i] = (FIXP_SGL)MAXVAL_SGL; 2008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 2018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt else 2028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt sfbTonality[i] = (FIXP_SGL)MAXVAL_SGL; 2038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt } 2048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt} 2058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt