file_path
stringlengths
3
280
file_language
stringclasses
66 values
content
stringlengths
1
1.04M
repo_name
stringlengths
5
92
repo_stars
int64
0
154k
repo_description
stringlengths
0
402
repo_primary_language
stringclasses
108 values
developer_username
stringlengths
1
25
developer_name
stringlengths
0
30
developer_company
stringlengths
0
82
src/libFaad/sbr_e_nf.h
C/C++ Header
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_e_nf.h,v 1.18 2007/11/01 12:33:35 menno Exp $ **/ #ifndef __SBR_E_NF_H__ #define __SBR_E_NF_H__ #ifdef __cplusplus extern "C" { #endif void extract_envelope_data(sbr_info *sbr, uint8_t ch); void extract_noise_floor_data(sbr_info *sbr, uint8_t ch); #ifndef FIXED_POINT void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch); void unmap_envelope_noise(sbr_info *sbr); #endif #ifdef __cplusplus } #endif #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/sbr_fbt.c
C
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_fbt.c,v 1.21 2007/11/01 12:33:35 menno Exp $ **/ /* Calculate frequency band tables */ #include "common.h" #include "structs.h" #ifdef SBR_DEC #include <stdlib.h> #include "sbr_syntax.h" #include "sbr_fbt.h" /* static function declarations */ static int32_t find_bands(uint8_t warp, uint8_t bands, uint8_t a0, uint8_t a1); /* calculate the start QMF channel for the master frequency band table */ /* parameter is also called k0 */ uint8_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode, uint32_t sample_rate) { static const uint8_t startMinTable[12] = { 7, 7, 10, 11, 12, 16, 16, 17, 24, 32, 35, 48 }; static const uint8_t offsetIndexTable[12] = { 5, 5, 4, 4, 4, 3, 2, 1, 0, 6, 6, 6 }; static const int8_t offset[7][16] = { { -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7 }, { -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13 }, { -5, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16 }, { -6, -4, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16 }, { -4, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20 }, { -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20, 24 }, { 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20, 24, 28, 33 } }; uint8_t startMin = startMinTable[get_sr_index(sample_rate)]; uint8_t offsetIndex = offsetIndexTable[get_sr_index(sample_rate)]; #if 0 /* replaced with table (startMinTable) */ if (sample_rate >= 64000) { startMin = (uint8_t)((5000.*128.)/(float)sample_rate + 0.5); } else if (sample_rate < 32000) { startMin = (uint8_t)((3000.*128.)/(float)sample_rate + 0.5); } else { startMin = (uint8_t)((4000.*128.)/(float)sample_rate + 0.5); } #endif if (bs_samplerate_mode) { return startMin + offset[offsetIndex][bs_start_freq]; #if 0 /* replaced by offsetIndexTable */ switch (sample_rate) { case 16000: return startMin + offset[0][bs_start_freq]; case 22050: return startMin + offset[1][bs_start_freq]; case 24000: return startMin + offset[2][bs_start_freq]; case 32000: return startMin + offset[3][bs_start_freq]; default: if (sample_rate > 64000) { return startMin + offset[5][bs_start_freq]; } else { /* 44100 <= sample_rate <= 64000 */ return startMin + offset[4][bs_start_freq]; } } #endif } else { return startMin + offset[6][bs_start_freq]; } } static int longcmp(const void *a, const void *b) { return ((int)(*(int32_t*)a - *(int32_t*)b)); } /* calculate the stop QMF channel for the master frequency band table */ /* parameter is also called k2 */ uint8_t qmf_stop_channel(uint8_t bs_stop_freq, uint32_t sample_rate, uint8_t k0) { if (bs_stop_freq == 15) { return min(64, k0 * 3); } else if (bs_stop_freq == 14) { return min(64, k0 * 2); } else { static const uint8_t stopMinTable[12] = { 13, 15, 20, 21, 23, 32, 32, 35, 48, 64, 70, 96 }; static const int8_t offset[12][14] = { { 0, 2, 4, 6, 8, 11, 14, 18, 22, 26, 31, 37, 44, 51 }, { 0, 2, 4, 6, 8, 11, 14, 18, 22, 26, 31, 36, 42, 49 }, { 0, 2, 4, 6, 8, 11, 14, 17, 21, 25, 29, 34, 39, 44 }, { 0, 2, 4, 6, 8, 11, 14, 17, 20, 24, 28, 33, 38, 43 }, { 0, 2, 4, 6, 8, 11, 14, 17, 20, 24, 28, 32, 36, 41 }, { 0, 2, 4, 6, 8, 10, 12, 14, 17, 20, 23, 26, 29, 32 }, { 0, 2, 4, 6, 8, 10, 12, 14, 17, 20, 23, 26, 29, 32 }, { 0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 20, 23, 26, 29 }, { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, -1, -2, -3, -4, -5, -6, -6, -6, -6, -6, -6, -6, -6 }, { 0, -3, -6, -9, -12, -15, -18, -20, -22, -24, -26, -28, -30, -32 } }; #if 0 uint8_t i; int32_t stopDk[13], stopDk_t[14], k2; #endif uint8_t stopMin = stopMinTable[get_sr_index(sample_rate)]; #if 0 /* replaced by table lookup */ if (sample_rate >= 64000) { stopMin = (uint8_t)((10000.*128.)/(float)sample_rate + 0.5); } else if (sample_rate < 32000) { stopMin = (uint8_t)((6000.*128.)/(float)sample_rate + 0.5); } else { stopMin = (uint8_t)((8000.*128.)/(float)sample_rate + 0.5); } #endif #if 0 /* replaced by table lookup */ /* diverging power series */ for (i = 0; i <= 13; i++) { stopDk_t[i] = (int32_t)(stopMin*pow(64.0/stopMin, i/13.0) + 0.5); } for (i = 0; i < 13; i++) { stopDk[i] = stopDk_t[i+1] - stopDk_t[i]; } /* needed? */ qsort(stopDk, 13, sizeof(stopDk[0]), longcmp); k2 = stopMin; for (i = 0; i < bs_stop_freq; i++) { k2 += stopDk[i]; } return min(64, k2); #endif /* bs_stop_freq <= 13 */ return min(64, stopMin + offset[get_sr_index(sample_rate)][min(bs_stop_freq, 13)]); } return 0; } /* calculate the master frequency table from k0, k2, bs_freq_scale and bs_alter_scale version for bs_freq_scale = 0 */ uint8_t master_frequency_table_fs0(sbr_info *sbr, uint8_t k0, uint8_t k2, uint8_t bs_alter_scale) { int8_t incr; uint8_t k; uint8_t dk; uint32_t nrBands, k2Achieved; int32_t k2Diff, vDk[64] = {0}; /* mft only defined for k2 > k0 */ if (k2 <= k0) { sbr->N_master = 0; return 1; } dk = bs_alter_scale ? 2 : 1; #if 0 /* replaced by float-less design */ nrBands = 2 * (int32_t)((float)(k2-k0)/(dk*2) + (-1+dk)/2.0f); #else if (bs_alter_scale) { nrBands = (((k2-k0+2)>>2)<<1); } else { nrBands = (((k2-k0)>>1)<<1); } #endif nrBands = min(nrBands, 63); if (nrBands <= 0) return 1; k2Achieved = k0 + nrBands * dk; k2Diff = k2 - k2Achieved; for (k = 0; k < nrBands; k++) vDk[k] = dk; if (k2Diff) { incr = (k2Diff > 0) ? -1 : 1; k = (uint8_t) ((k2Diff > 0) ? (nrBands-1) : 0); while (k2Diff != 0) { vDk[k] -= incr; k += incr; k2Diff += incr; } } sbr->f_master[0] = k0; for (k = 1; k <= nrBands; k++) sbr->f_master[k] = (uint8_t)(sbr->f_master[k-1] + vDk[k-1]); sbr->N_master = (uint8_t)nrBands; sbr->N_master = (min(sbr->N_master, 64)); #if 0 printf("f_master[%d]: ", nrBands); for (k = 0; k <= nrBands; k++) { printf("%d ", sbr->f_master[k]); } printf("\n"); #endif return 0; } /* This function finds the number of bands using this formula: bands * log(a1/a0)/log(2.0) + 0.5 */ static int32_t find_bands(uint8_t warp, uint8_t bands, uint8_t a0, uint8_t a1) { #ifdef FIXED_POINT /* table with log2() values */ static const real_t log2Table[65] = { COEF_CONST(0.0), COEF_CONST(0.0), COEF_CONST(1.0000000000), COEF_CONST(1.5849625007), COEF_CONST(2.0000000000), COEF_CONST(2.3219280949), COEF_CONST(2.5849625007), COEF_CONST(2.8073549221), COEF_CONST(3.0000000000), COEF_CONST(3.1699250014), COEF_CONST(3.3219280949), COEF_CONST(3.4594316186), COEF_CONST(3.5849625007), COEF_CONST(3.7004397181), COEF_CONST(3.8073549221), COEF_CONST(3.9068905956), COEF_CONST(4.0000000000), COEF_CONST(4.0874628413), COEF_CONST(4.1699250014), COEF_CONST(4.2479275134), COEF_CONST(4.3219280949), COEF_CONST(4.3923174228), COEF_CONST(4.4594316186), COEF_CONST(4.5235619561), COEF_CONST(4.5849625007), COEF_CONST(4.6438561898), COEF_CONST(4.7004397181), COEF_CONST(4.7548875022), COEF_CONST(4.8073549221), COEF_CONST(4.8579809951), COEF_CONST(4.9068905956), COEF_CONST(4.9541963104), COEF_CONST(5.0000000000), COEF_CONST(5.0443941194), COEF_CONST(5.0874628413), COEF_CONST(5.1292830169), COEF_CONST(5.1699250014), COEF_CONST(5.2094533656), COEF_CONST(5.2479275134), COEF_CONST(5.2854022189), COEF_CONST(5.3219280949), COEF_CONST(5.3575520046), COEF_CONST(5.3923174228), COEF_CONST(5.4262647547), COEF_CONST(5.4594316186), COEF_CONST(5.4918530963), COEF_CONST(5.5235619561), COEF_CONST(5.5545888517), COEF_CONST(5.5849625007), COEF_CONST(5.6147098441), COEF_CONST(5.6438561898), COEF_CONST(5.6724253420), COEF_CONST(5.7004397181), COEF_CONST(5.7279204546), COEF_CONST(5.7548875022), COEF_CONST(5.7813597135), COEF_CONST(5.8073549221), COEF_CONST(5.8328900142), COEF_CONST(5.8579809951), COEF_CONST(5.8826430494), COEF_CONST(5.9068905956), COEF_CONST(5.9307373376), COEF_CONST(5.9541963104), COEF_CONST(5.9772799235), COEF_CONST(6.0) }; real_t r0 = log2Table[a0]; /* coef */ real_t r1 = log2Table[a1]; /* coef */ real_t r2 = (r1 - r0); /* coef */ if (warp) r2 = MUL_C(r2, COEF_CONST(1.0/1.3)); /* convert r2 to real and then multiply and round */ r2 = (r2 >> (COEF_BITS-REAL_BITS)) * bands + (1<<(REAL_BITS-1)); return (r2 >> REAL_BITS); #else real_t div = (real_t)log(2.0); if (warp) div *= (real_t)1.3; return (int32_t)(bands * log((float)a1/(float)a0)/div + 0.5); #endif } static real_t find_initial_power(uint8_t bands, uint8_t a0, uint8_t a1) { #ifdef FIXED_POINT /* table with log() values */ static const real_t logTable[65] = { COEF_CONST(0.0), COEF_CONST(0.0), COEF_CONST(0.6931471806), COEF_CONST(1.0986122887), COEF_CONST(1.3862943611), COEF_CONST(1.6094379124), COEF_CONST(1.7917594692), COEF_CONST(1.9459101491), COEF_CONST(2.0794415417), COEF_CONST(2.1972245773), COEF_CONST(2.3025850930), COEF_CONST(2.3978952728), COEF_CONST(2.4849066498), COEF_CONST(2.5649493575), COEF_CONST(2.6390573296), COEF_CONST(2.7080502011), COEF_CONST(2.7725887222), COEF_CONST(2.8332133441), COEF_CONST(2.8903717579), COEF_CONST(2.9444389792), COEF_CONST(2.9957322736), COEF_CONST(3.0445224377), COEF_CONST(3.0910424534), COEF_CONST(3.1354942159), COEF_CONST(3.1780538303), COEF_CONST(3.2188758249), COEF_CONST(3.2580965380), COEF_CONST(3.2958368660), COEF_CONST(3.3322045102), COEF_CONST(3.3672958300), COEF_CONST(3.4011973817), COEF_CONST(3.4339872045), COEF_CONST(3.4657359028), COEF_CONST(3.4965075615), COEF_CONST(3.5263605246), COEF_CONST(3.5553480615), COEF_CONST(3.5835189385), COEF_CONST(3.6109179126), COEF_CONST(3.6375861597), COEF_CONST(3.6635616461), COEF_CONST(3.6888794541), COEF_CONST(3.7135720667), COEF_CONST(3.7376696183), COEF_CONST(3.7612001157), COEF_CONST(3.7841896339), COEF_CONST(3.8066624898), COEF_CONST(3.8286413965), COEF_CONST(3.8501476017), COEF_CONST(3.8712010109), COEF_CONST(3.8918202981), COEF_CONST(3.9120230054), COEF_CONST(3.9318256327), COEF_CONST(3.9512437186), COEF_CONST(3.9702919136), COEF_CONST(3.9889840466), COEF_CONST(4.0073331852), COEF_CONST(4.0253516907), COEF_CONST(4.0430512678), COEF_CONST(4.0604430105), COEF_CONST(4.0775374439), COEF_CONST(4.0943445622), COEF_CONST(4.1108738642), COEF_CONST(4.1271343850), COEF_CONST(4.1431347264), COEF_CONST(4.158883083) }; /* standard Taylor polynomial coefficients for exp(x) around 0 */ /* a polynomial around x=1 is more precise, as most values are around 1.07, but this is just fine already */ static const real_t c1 = COEF_CONST(1.0); static const real_t c2 = COEF_CONST(1.0/2.0); static const real_t c3 = COEF_CONST(1.0/6.0); static const real_t c4 = COEF_CONST(1.0/24.0); real_t r0 = logTable[a0]; /* coef */ real_t r1 = logTable[a1]; /* coef */ real_t r2 = (r1 - r0) / bands; /* coef */ real_t rexp = c1 + MUL_C((c1 + MUL_C((c2 + MUL_C((c3 + MUL_C(c4,r2)), r2)), r2)), r2); return (rexp >> (COEF_BITS-REAL_BITS)); /* real */ #else return (real_t)pow((real_t)a1/(real_t)a0, 1.0/(real_t)bands); #endif } /* version for bs_freq_scale > 0 */ uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2, uint8_t bs_freq_scale, uint8_t bs_alter_scale) { uint8_t k, bands, twoRegions; uint8_t k1; uint8_t nrBand0, nrBand1; int32_t vDk0[64] = {0}, vDk1[64] = {0}; int32_t vk0[64] = {0}, vk1[64] = {0}; uint8_t temp1[] = { 6, 5, 4 }; real_t q, qk; int32_t A_1; #ifdef FIXED_POINT real_t rk2, rk0; #endif /* mft only defined for k2 > k0 */ if (k2 <= k0) { sbr->N_master = 0; return 1; } bands = temp1[bs_freq_scale-1]; #ifdef FIXED_POINT rk0 = (real_t)k0 << REAL_BITS; rk2 = (real_t)k2 << REAL_BITS; if (rk2 > MUL_C(rk0, COEF_CONST(2.2449))) #else if ((float)k2/(float)k0 > 2.2449) #endif { twoRegions = 1; k1 = k0 << 1; } else { twoRegions = 0; k1 = k2; } nrBand0 = (uint8_t)(2 * find_bands(0, bands, k0, k1)); nrBand0 = min(nrBand0, 63); if (nrBand0 <= 0) return 1; q = find_initial_power(nrBand0, k0, k1); #ifdef FIXED_POINT qk = (real_t)k0 << REAL_BITS; //A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS); A_1 = k0; #else qk = REAL_CONST(k0); A_1 = (int32_t)(qk + .5); #endif for (k = 0; k <= nrBand0; k++) { int32_t A_0 = A_1; #ifdef FIXED_POINT qk = MUL_R(qk,q); A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS); #else qk *= q; A_1 = (int32_t)(qk + 0.5); #endif vDk0[k] = A_1 - A_0; } /* needed? */ qsort(vDk0, nrBand0, sizeof(vDk0[0]), longcmp); vk0[0] = k0; for (k = 1; k <= nrBand0; k++) { vk0[k] = vk0[k-1] + vDk0[k-1]; if (vDk0[k-1] == 0) return 1; } if (!twoRegions) { for (k = 0; k <= nrBand0; k++) sbr->f_master[k] = (uint8_t) vk0[k]; sbr->N_master = nrBand0; sbr->N_master = min(sbr->N_master, 64); return 0; } nrBand1 = (uint8_t)(2 * find_bands(1 /* warped */, bands, k1, k2)); nrBand1 = min(nrBand1, 63); q = find_initial_power(nrBand1, k1, k2); #ifdef FIXED_POINT qk = (real_t)k1 << REAL_BITS; //A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS); A_1 = k1; #else qk = REAL_CONST(k1); A_1 = (int32_t)(qk + .5); #endif for (k = 0; k <= nrBand1 - 1; k++) { int32_t A_0 = A_1; #ifdef FIXED_POINT qk = MUL_R(qk,q); A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS); #else qk *= q; A_1 = (int32_t)(qk + 0.5); #endif vDk1[k] = A_1 - A_0; } if (vDk1[0] < vDk0[nrBand0 - 1]) { int32_t change; /* needed? */ qsort(vDk1, nrBand1 + 1, sizeof(vDk1[0]), longcmp); change = vDk0[nrBand0 - 1] - vDk1[0]; vDk1[0] = vDk0[nrBand0 - 1]; vDk1[nrBand1 - 1] = vDk1[nrBand1 - 1] - change; } /* needed? */ qsort(vDk1, nrBand1, sizeof(vDk1[0]), longcmp); vk1[0] = k1; for (k = 1; k <= nrBand1; k++) { vk1[k] = vk1[k-1] + vDk1[k-1]; if (vDk1[k-1] == 0) return 1; } sbr->N_master = nrBand0 + nrBand1; sbr->N_master = min(sbr->N_master, 64); for (k = 0; k <= nrBand0; k++) { sbr->f_master[k] = (uint8_t) vk0[k]; } for (k = nrBand0 + 1; k <= sbr->N_master; k++) { sbr->f_master[k] = (uint8_t) vk1[k - nrBand0]; } #if 0 printf("f_master[%d]: ", sbr->N_master); for (k = 0; k <= sbr->N_master; k++) { printf("%d ", sbr->f_master[k]); } printf("\n"); #endif return 0; } /* calculate the derived frequency border tables from f_master */ uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band, uint8_t k2) { uint8_t k, i; uint32_t minus; /* The following relation shall be satisfied: bs_xover_band < N_Master */ if (sbr->N_master <= bs_xover_band) return 1; sbr->N_high = sbr->N_master - bs_xover_band; sbr->N_low = (sbr->N_high>>1) + (sbr->N_high - ((sbr->N_high>>1)<<1)); sbr->n[0] = sbr->N_low; sbr->n[1] = sbr->N_high; for (k = 0; k <= sbr->N_high; k++) { sbr->f_table_res[HI_RES][k] = sbr->f_master[k + bs_xover_band]; } sbr->M = sbr->f_table_res[HI_RES][sbr->N_high] - sbr->f_table_res[HI_RES][0]; sbr->kx = sbr->f_table_res[HI_RES][0]; if (sbr->kx > 32) return 1; if (sbr->kx + sbr->M > 64) return 1; minus = (sbr->N_high & 1) ? 1 : 0; for (k = 0; k <= sbr->N_low; k++) { if (k == 0) i = 0; else i = (uint8_t)(2*k - minus); sbr->f_table_res[LO_RES][k] = sbr->f_table_res[HI_RES][i]; } #if 0 printf("bs_freq_scale: %d\n", sbr->bs_freq_scale); printf("bs_limiter_bands: %d\n", sbr->bs_limiter_bands); printf("f_table_res[HI_RES][%d]: ", sbr->N_high); for (k = 0; k <= sbr->N_high; k++) { printf("%d ", sbr->f_table_res[HI_RES][k]); } printf("\n"); #endif #if 0 printf("f_table_res[LO_RES][%d]: ", sbr->N_low); for (k = 0; k <= sbr->N_low; k++) { printf("%d ", sbr->f_table_res[LO_RES][k]); } printf("\n"); #endif sbr->N_Q = 0; if (sbr->bs_noise_bands == 0) { sbr->N_Q = 1; } else { #if 0 sbr->N_Q = max(1, (int32_t)(sbr->bs_noise_bands*(log(k2/(float)sbr->kx)/log(2.0)) + 0.5)); #else sbr->N_Q = (uint8_t)(max(1, find_bands(0, sbr->bs_noise_bands, sbr->kx, k2))); #endif sbr->N_Q = min(5, sbr->N_Q); } for (k = 0; k <= sbr->N_Q; k++) { if (k == 0) { i = 0; } else { /* i = i + (int32_t)((sbr->N_low - i)/(sbr->N_Q + 1 - k)); */ i = i + (sbr->N_low - i)/(sbr->N_Q + 1 - k); } sbr->f_table_noise[k] = sbr->f_table_res[LO_RES][i]; } /* build table for mapping k to g in hf patching */ for (k = 0; k < 64; k++) { uint8_t g; for (g = 0; g < sbr->N_Q; g++) { if ((sbr->f_table_noise[g] <= k) && (k < sbr->f_table_noise[g+1])) { sbr->table_map_k_to_g[k] = g; break; } } } #if 0 printf("f_table_noise[%d]: ", sbr->N_Q); for (k = 0; k <= sbr->N_Q; k++) { printf("%d ", sbr->f_table_noise[k] - sbr->kx); } printf("\n"); #endif return 0; } /* TODO: blegh, ugly */ /* Modified to calculate for all possible bs_limiter_bands always * This reduces the number calls to this functions needed (now only on * header reset) */ void limiter_frequency_table(sbr_info *sbr) { #if 0 static const real_t limiterBandsPerOctave[] = { REAL_CONST(1.2), REAL_CONST(2), REAL_CONST(3) }; #else static const real_t limiterBandsCompare[] = { REAL_CONST(1.327152), REAL_CONST(1.185093), REAL_CONST(1.119872) }; #endif uint8_t k, s; int8_t nrLim; #if 0 real_t limBands; #endif sbr->f_table_lim[0][0] = sbr->f_table_res[LO_RES][0] - sbr->kx; sbr->f_table_lim[0][1] = sbr->f_table_res[LO_RES][sbr->N_low] - sbr->kx; sbr->N_L[0] = 1; #if 0 printf("f_table_lim[%d][%d]: ", 0, sbr->N_L[0]); for (k = 0; k <= sbr->N_L[0]; k++) { printf("%d ", sbr->f_table_lim[0][k]); } printf("\n"); #endif for (s = 1; s < 4; s++) { int32_t limTable[100 /*TODO*/] = {0}; uint8_t patchBorders[64/*??*/] = {0}; #if 0 limBands = limiterBandsPerOctave[s - 1]; #endif patchBorders[0] = sbr->kx; for (k = 1; k <= sbr->noPatches; k++) { patchBorders[k] = patchBorders[k-1] + sbr->patchNoSubbands[k-1]; } for (k = 0; k <= sbr->N_low; k++) { limTable[k] = sbr->f_table_res[LO_RES][k]; } for (k = 1; k < sbr->noPatches; k++) { limTable[k+sbr->N_low] = patchBorders[k]; } /* needed */ qsort(limTable, sbr->noPatches + sbr->N_low, sizeof(limTable[0]), longcmp); k = 1; nrLim = sbr->noPatches + sbr->N_low - 1; if (nrLim < 0) // TODO: BIG FAT PROBLEM return; restart: if (k <= nrLim) { real_t nOctaves; if (limTable[k-1] != 0) #if 0 nOctaves = REAL_CONST(log((float)limTable[k]/(float)limTable[k-1])/log(2.0)); #else #ifdef FIXED_POINT nOctaves = DIV_R((limTable[k]<<REAL_BITS),REAL_CONST(limTable[k-1])); #else nOctaves = (real_t)limTable[k]/(real_t)limTable[k-1]; #endif #endif else nOctaves = 0; #if 0 if ((MUL_R(nOctaves,limBands)) < REAL_CONST(0.49)) #else if (nOctaves < limiterBandsCompare[s - 1]) #endif { uint8_t i; if (limTable[k] != limTable[k-1]) { uint8_t found = 0, found2 = 0; for (i = 0; i <= sbr->noPatches; i++) { if (limTable[k] == patchBorders[i]) found = 1; } if (found) { found2 = 0; for (i = 0; i <= sbr->noPatches; i++) { if (limTable[k-1] == patchBorders[i]) found2 = 1; } if (found2) { k++; goto restart; } else { /* remove (k-1)th element */ limTable[k-1] = sbr->f_table_res[LO_RES][sbr->N_low]; qsort(limTable, sbr->noPatches + sbr->N_low, sizeof(limTable[0]), longcmp); nrLim--; goto restart; } } } /* remove kth element */ limTable[k] = sbr->f_table_res[LO_RES][sbr->N_low]; qsort(limTable, nrLim, sizeof(limTable[0]), longcmp); nrLim--; goto restart; } else { k++; goto restart; } } sbr->N_L[s] = nrLim; for (k = 0; k <= nrLim; k++) { sbr->f_table_lim[s][k] = limTable[k] - sbr->kx; } #if 0 printf("f_table_lim[%d][%d]: ", s, sbr->N_L[s]); for (k = 0; k <= sbr->N_L[s]; k++) { printf("%d ", sbr->f_table_lim[s][k]); } printf("\n"); #endif } } #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/sbr_fbt.h
C/C++ Header
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_fbt.h,v 1.18 2007/11/01 12:33:35 menno Exp $ **/ #ifndef __SBR_FBT_H__ #define __SBR_FBT_H__ #ifdef __cplusplus extern "C" { #endif uint8_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode, uint32_t sample_rate); uint8_t qmf_stop_channel(uint8_t bs_stop_freq, uint32_t sample_rate, uint8_t k0); uint8_t master_frequency_table_fs0(sbr_info *sbr, uint8_t k0, uint8_t k2, uint8_t bs_alter_scale); uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2, uint8_t bs_freq_scale, uint8_t bs_alter_scale); uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band, uint8_t k2); void limiter_frequency_table(sbr_info *sbr); #ifdef __cplusplus } #endif #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/sbr_hfadj.c
C
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_hfadj.c,v 1.23 2008/09/19 22:50:20 menno Exp $ **/ /* High Frequency adjustment */ #include "common.h" #include "structs.h" #ifdef SBR_DEC #include "sbr_syntax.h" #include "sbr_hfadj.h" #include "sbr_noise.h" /* static function declarations */ static uint8_t estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj, qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch); static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch); #ifdef SBR_LOW_POWER static void calc_gain_groups(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch); static void aliasing_reduction(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch); #endif static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj, qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch); uint8_t hf_adjustment(sbr_info *sbr, qmf_t Xsbr[MAX_NTSRHFG][64] #ifdef SBR_LOW_POWER ,real_t *deg /* aliasing degree */ #endif ,uint8_t ch) { ALIGN sbr_hfadj_info adj = {{{0}}}; uint8_t ret = 0; if (sbr->bs_frame_class[ch] == FIXFIX) { sbr->l_A[ch] = -1; } else if (sbr->bs_frame_class[ch] == VARFIX) { if (sbr->bs_pointer[ch] > 1) sbr->l_A[ch] = sbr->bs_pointer[ch] - 1; else sbr->l_A[ch] = -1; } else { if (sbr->bs_pointer[ch] == 0) sbr->l_A[ch] = -1; else sbr->l_A[ch] = sbr->L_E[ch] + 1 - sbr->bs_pointer[ch]; } ret = estimate_current_envelope(sbr, &adj, Xsbr, ch); if (ret > 0) return 1; calculate_gain(sbr, &adj, ch); #ifdef SBR_LOW_POWER calc_gain_groups(sbr, &adj, deg, ch); aliasing_reduction(sbr, &adj, deg, ch); #endif hf_assembly(sbr, &adj, Xsbr, ch); return 0; } static uint8_t get_S_mapped(sbr_info *sbr, uint8_t ch, uint8_t l, uint8_t current_band) { if (sbr->f[ch][l] == HI_RES) { /* in case of using f_table_high we just have 1 to 1 mapping * from bs_add_harmonic[l][k] */ if ((l >= sbr->l_A[ch]) || (sbr->bs_add_harmonic_prev[ch][current_band] && sbr->bs_add_harmonic_flag_prev[ch])) { return sbr->bs_add_harmonic[ch][current_band]; } } else { uint8_t b, lb, ub; /* in case of f_table_low we check if any of the HI_RES bands * within this LO_RES band has bs_add_harmonic[l][k] turned on * (note that borders in the LO_RES table are also present in * the HI_RES table) */ /* find first HI_RES band in current LO_RES band */ lb = 2*current_band - ((sbr->N_high & 1) ? 1 : 0); /* find first HI_RES band in next LO_RES band */ ub = 2*(current_band+1) - ((sbr->N_high & 1) ? 1 : 0); /* check all HI_RES bands in current LO_RES band for sinusoid */ for (b = lb; b < ub; b++) { if ((l >= sbr->l_A[ch]) || (sbr->bs_add_harmonic_prev[ch][b] && sbr->bs_add_harmonic_flag_prev[ch])) { if (sbr->bs_add_harmonic[ch][b] == 1) return 1; } } } return 0; } static uint8_t estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj, qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch) { uint8_t m, l, j, k, k_l, k_h, p; real_t nrg, div; if (sbr->bs_interpol_freq == 1) { for (l = 0; l < sbr->L_E[ch]; l++) { uint8_t i, l_i, u_i; l_i = sbr->t_E[ch][l]; u_i = sbr->t_E[ch][l+1]; div = (real_t)(u_i - l_i); if (div == 0) div = 1; for (m = 0; m < sbr->M; m++) { nrg = 0; for (i = l_i + sbr->tHFAdj; i < u_i + sbr->tHFAdj; i++) { #ifdef FIXED_POINT #ifdef SBR_LOW_POWER nrg += ((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS); #else nrg += ((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS) + ((QMF_IM(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_IM(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS); #endif #else nrg += MUL_R(QMF_RE(Xsbr[i][m + sbr->kx]), QMF_RE(Xsbr[i][m + sbr->kx])) #ifndef SBR_LOW_POWER + MUL_R(QMF_IM(Xsbr[i][m + sbr->kx]), QMF_IM(Xsbr[i][m + sbr->kx])) #endif ; #endif } sbr->E_curr[ch][m][l] = nrg / div; #ifdef SBR_LOW_POWER #ifdef FIXED_POINT sbr->E_curr[ch][m][l] <<= 1; #else sbr->E_curr[ch][m][l] *= 2; #endif #endif } } } else { for (l = 0; l < sbr->L_E[ch]; l++) { for (p = 0; p < sbr->n[sbr->f[ch][l]]; p++) { k_l = sbr->f_table_res[sbr->f[ch][l]][p]; k_h = sbr->f_table_res[sbr->f[ch][l]][p+1]; for (k = k_l; k < k_h; k++) { uint8_t i, l_i, u_i; nrg = 0; l_i = sbr->t_E[ch][l]; u_i = sbr->t_E[ch][l+1]; div = (real_t)((u_i - l_i)*(k_h - k_l)); if (div == 0) div = 1; for (i = l_i + sbr->tHFAdj; i < u_i + sbr->tHFAdj; i++) { for (j = k_l; j < k_h; j++) { #ifdef FIXED_POINT #ifdef SBR_LOW_POWER nrg += ((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS); #else nrg += ((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS) + ((QMF_IM(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_IM(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS); #endif #else nrg += MUL_R(QMF_RE(Xsbr[i][j]), QMF_RE(Xsbr[i][j])) #ifndef SBR_LOW_POWER + MUL_R(QMF_IM(Xsbr[i][j]), QMF_IM(Xsbr[i][j])) #endif ; #endif } } sbr->E_curr[ch][k - sbr->kx][l] = nrg / div; #ifdef SBR_LOW_POWER #ifdef FIXED_POINT sbr->E_curr[ch][k - sbr->kx][l] <<= 1; #else sbr->E_curr[ch][k - sbr->kx][l] *= 2; #endif #endif } } } } return 0; } #ifdef FIXED_POINT #define EPS (1) /* smallest number available in fixed point */ #else #define EPS (1e-12) #endif #ifdef FIXED_POINT /* log2 values of [0..63] */ static const real_t log2_int_tab[] = { LOG2_MIN_INF, REAL_CONST(0.000000000000000), REAL_CONST(1.000000000000000), REAL_CONST(1.584962500721156), REAL_CONST(2.000000000000000), REAL_CONST(2.321928094887362), REAL_CONST(2.584962500721156), REAL_CONST(2.807354922057604), REAL_CONST(3.000000000000000), REAL_CONST(3.169925001442313), REAL_CONST(3.321928094887363), REAL_CONST(3.459431618637297), REAL_CONST(3.584962500721156), REAL_CONST(3.700439718141092), REAL_CONST(3.807354922057604), REAL_CONST(3.906890595608519), REAL_CONST(4.000000000000000), REAL_CONST(4.087462841250339), REAL_CONST(4.169925001442312), REAL_CONST(4.247927513443585), REAL_CONST(4.321928094887362), REAL_CONST(4.392317422778761), REAL_CONST(4.459431618637297), REAL_CONST(4.523561956057013), REAL_CONST(4.584962500721156), REAL_CONST(4.643856189774724), REAL_CONST(4.700439718141093), REAL_CONST(4.754887502163468), REAL_CONST(4.807354922057604), REAL_CONST(4.857980995127572), REAL_CONST(4.906890595608519), REAL_CONST(4.954196310386875), REAL_CONST(5.000000000000000), REAL_CONST(5.044394119358453), REAL_CONST(5.087462841250340), REAL_CONST(5.129283016944966), REAL_CONST(5.169925001442312), REAL_CONST(5.209453365628949), REAL_CONST(5.247927513443585), REAL_CONST(5.285402218862248), REAL_CONST(5.321928094887363), REAL_CONST(5.357552004618084), REAL_CONST(5.392317422778761), REAL_CONST(5.426264754702098), REAL_CONST(5.459431618637297), REAL_CONST(5.491853096329675), REAL_CONST(5.523561956057013), REAL_CONST(5.554588851677637), REAL_CONST(5.584962500721156), REAL_CONST(5.614709844115208), REAL_CONST(5.643856189774724), REAL_CONST(5.672425341971495), REAL_CONST(5.700439718141093), REAL_CONST(5.727920454563200), REAL_CONST(5.754887502163469), REAL_CONST(5.781359713524660), REAL_CONST(5.807354922057605), REAL_CONST(5.832890014164742), REAL_CONST(5.857980995127572), REAL_CONST(5.882643049361842), REAL_CONST(5.906890595608518), REAL_CONST(5.930737337562887), REAL_CONST(5.954196310386876), REAL_CONST(5.977279923499916) }; static const real_t pan_log2_tab[] = { REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362), REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339), REAL_CONST(0.044394119358453), REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878), REAL_CONST(0.002815015607054), REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247), REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122), REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667) }; static real_t find_log2_E(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch) { /* check for coupled energy/noise data */ if (sbr->bs_coupling == 1) { uint8_t amp0 = (sbr->amp_res[0]) ? 0 : 1; uint8_t amp1 = (sbr->amp_res[1]) ? 0 : 1; real_t tmp = (7 << REAL_BITS) + (sbr->E[0][k][l] << (REAL_BITS-amp0)); real_t pan; /* E[1] should always be even so shifting is OK */ uint8_t E = sbr->E[1][k][l] >> amp1; if (ch == 0) { if (E > 12) { /* negative */ pan = pan_log2_tab[-12 + E]; } else { /* positive */ pan = pan_log2_tab[12 - E] + ((12 - E)<<REAL_BITS); } } else { if (E < 12) { /* negative */ pan = pan_log2_tab[-E + 12]; } else { /* positive */ pan = pan_log2_tab[E - 12] + ((E - 12)<<REAL_BITS); } } /* tmp / pan in log2 */ return tmp - pan; } else { uint8_t amp = (sbr->amp_res[ch]) ? 0 : 1; return (6 << REAL_BITS) + (sbr->E[ch][k][l] << (REAL_BITS-amp)); } } static real_t find_log2_Q(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch) { /* check for coupled energy/noise data */ if (sbr->bs_coupling == 1) { real_t tmp = (7 << REAL_BITS) - (sbr->Q[0][k][l] << REAL_BITS); real_t pan; uint8_t Q = sbr->Q[1][k][l]; if (ch == 0) { if (Q > 12) { /* negative */ pan = pan_log2_tab[-12 + Q]; } else { /* positive */ pan = pan_log2_tab[12 - Q] + ((12 - Q)<<REAL_BITS); } } else { if (Q < 12) { /* negative */ pan = pan_log2_tab[-Q + 12]; } else { /* positive */ pan = pan_log2_tab[Q - 12] + ((Q - 12)<<REAL_BITS); } } /* tmp / pan in log2 */ return tmp - pan; } else { return (6 << REAL_BITS) - (sbr->Q[ch][k][l] << REAL_BITS); } } static const real_t log_Qplus1_pan[31][13] = { { REAL_CONST(0.044383447617292), REAL_CONST(0.169768601655960), REAL_CONST(0.583090126514435), REAL_CONST(1.570089221000671), REAL_CONST(3.092446088790894), REAL_CONST(4.733354568481445), REAL_CONST(6.022367954254150), REAL_CONST(6.692092418670654), REAL_CONST(6.924463272094727), REAL_CONST(6.989034175872803), REAL_CONST(7.005646705627441), REAL_CONST(7.009829998016357), REAL_CONST(7.010877609252930) }, { REAL_CONST(0.022362394258380), REAL_CONST(0.087379962205887), REAL_CONST(0.320804953575134), REAL_CONST(0.988859415054321), REAL_CONST(2.252387046813965), REAL_CONST(3.786596298217773), REAL_CONST(5.044394016265869), REAL_CONST(5.705977916717529), REAL_CONST(5.936291694641113), REAL_CONST(6.000346660614014), REAL_CONST(6.016829967498779), REAL_CONST(6.020981311798096), REAL_CONST(6.022020816802979) }, { REAL_CONST(0.011224525049329), REAL_CONST(0.044351425021887), REAL_CONST(0.169301137328148), REAL_CONST(0.577544987201691), REAL_CONST(1.527246952056885), REAL_CONST(2.887525320053101), REAL_CONST(4.087462902069092), REAL_CONST(4.733354568481445), REAL_CONST(4.959661006927490), REAL_CONST(5.022709369659424), REAL_CONST(5.038940429687500), REAL_CONST(5.043028831481934), REAL_CONST(5.044052600860596) }, { REAL_CONST(0.005623178556561), REAL_CONST(0.022346137091517), REAL_CONST(0.087132595479488), REAL_CONST(0.317482173442841), REAL_CONST(0.956931233406067), REAL_CONST(2.070389270782471), REAL_CONST(3.169924974441528), REAL_CONST(3.786596298217773), REAL_CONST(4.005294322967529), REAL_CONST(4.066420555114746), REAL_CONST(4.082170009613037), REAL_CONST(4.086137294769287), REAL_CONST(4.087131500244141) }, { REAL_CONST(0.002814328996465), REAL_CONST(0.011216334067285), REAL_CONST(0.044224001467228), REAL_CONST(0.167456731200218), REAL_CONST(0.556393325328827), REAL_CONST(1.378511548042297), REAL_CONST(2.321928024291992), REAL_CONST(2.887525320053101), REAL_CONST(3.092446088790894), REAL_CONST(3.150059700012207), REAL_CONST(3.164926528930664), REAL_CONST(3.168673276901245), REAL_CONST(3.169611930847168) }, { REAL_CONST(0.001407850766554), REAL_CONST(0.005619067233056), REAL_CONST(0.022281449288130), REAL_CONST(0.086156636476517), REAL_CONST(0.304854571819305), REAL_CONST(0.847996890544891), REAL_CONST(1.584962487220764), REAL_CONST(2.070389270782471), REAL_CONST(2.252387046813965), REAL_CONST(2.304061651229858), REAL_CONST(2.317430257797241), REAL_CONST(2.320801734924316), REAL_CONST(2.321646213531494) }, { REAL_CONST(0.000704097095877), REAL_CONST(0.002812269143760), REAL_CONST(0.011183738708496), REAL_CONST(0.043721374124289), REAL_CONST(0.160464659333229), REAL_CONST(0.485426813364029), REAL_CONST(1.000000000000000), REAL_CONST(1.378511548042297), REAL_CONST(1.527246952056885), REAL_CONST(1.570089221000671), REAL_CONST(1.581215262413025), REAL_CONST(1.584023833274841), REAL_CONST(1.584727644920349) }, { REAL_CONST(0.000352177477907), REAL_CONST(0.001406819908880), REAL_CONST(0.005602621007711), REAL_CONST(0.022026389837265), REAL_CONST(0.082462236285210), REAL_CONST(0.263034462928772), REAL_CONST(0.584962487220764), REAL_CONST(0.847996890544891), REAL_CONST(0.956931233406067), REAL_CONST(0.988859415054321), REAL_CONST(0.997190535068512), REAL_CONST(0.999296069145203), REAL_CONST(0.999823868274689) }, { REAL_CONST(0.000176099492819), REAL_CONST(0.000703581434209), REAL_CONST(0.002804030198604), REAL_CONST(0.011055230163038), REAL_CONST(0.041820213198662), REAL_CONST(0.137503549456596), REAL_CONST(0.321928083896637), REAL_CONST(0.485426813364029), REAL_CONST(0.556393325328827), REAL_CONST(0.577544987201691), REAL_CONST(0.583090126514435), REAL_CONST(0.584493279457092), REAL_CONST(0.584845066070557) }, { REAL_CONST(0.000088052431238), REAL_CONST(0.000351833587047), REAL_CONST(0.001402696361765), REAL_CONST(0.005538204684854), REAL_CONST(0.021061634644866), REAL_CONST(0.070389263331890), REAL_CONST(0.169925004243851), REAL_CONST(0.263034462928772), REAL_CONST(0.304854571819305), REAL_CONST(0.317482173442841), REAL_CONST(0.320804953575134), REAL_CONST(0.321646571159363), REAL_CONST(0.321857661008835) }, { REAL_CONST(0.000044026888645), REAL_CONST(0.000175927518285), REAL_CONST(0.000701518612914), REAL_CONST(0.002771759871393), REAL_CONST(0.010569252073765), REAL_CONST(0.035623874515295), REAL_CONST(0.087462842464447), REAL_CONST(0.137503549456596), REAL_CONST(0.160464659333229), REAL_CONST(0.167456731200218), REAL_CONST(0.169301137328148), REAL_CONST(0.169768601655960), REAL_CONST(0.169885858893394) }, { REAL_CONST(0.000022013611670), REAL_CONST(0.000088052431238), REAL_CONST(0.000350801943569), REAL_CONST(0.001386545598507), REAL_CONST(0.005294219125062), REAL_CONST(0.017921976745129), REAL_CONST(0.044394120573997), REAL_CONST(0.070389263331890), REAL_CONST(0.082462236285210), REAL_CONST(0.086156636476517), REAL_CONST(0.087132595479488), REAL_CONST(0.087379962205887), REAL_CONST(0.087442122399807) }, { REAL_CONST(0.000011006847672), REAL_CONST(0.000044026888645), REAL_CONST(0.000175411638338), REAL_CONST(0.000693439331371), REAL_CONST(0.002649537986144), REAL_CONST(0.008988817222416), REAL_CONST(0.022367812693119), REAL_CONST(0.035623874515295), REAL_CONST(0.041820213198662), REAL_CONST(0.043721374124289), REAL_CONST(0.044224001467228), REAL_CONST(0.044351425021887), REAL_CONST(0.044383447617292) }, { REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000087708482170), REAL_CONST(0.000346675369656), REAL_CONST(0.001325377263129), REAL_CONST(0.004501323681325), REAL_CONST(0.011227255687118), REAL_CONST(0.017921976745129), REAL_CONST(0.021061634644866), REAL_CONST(0.022026389837265), REAL_CONST(0.022281449288130), REAL_CONST(0.022346137091517), REAL_CONST(0.022362394258380) }, { REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043854910473), REAL_CONST(0.000173348103999), REAL_CONST(0.000662840844598), REAL_CONST(0.002252417383716), REAL_CONST(0.005624548997730), REAL_CONST(0.008988817222416), REAL_CONST(0.010569252073765), REAL_CONST(0.011055230163038), REAL_CONST(0.011183738708496), REAL_CONST(0.011216334067285), REAL_CONST(0.011224525049329) }, { REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000086676649516), REAL_CONST(0.000331544462824), REAL_CONST(0.001126734190620), REAL_CONST(0.002815015614033), REAL_CONST(0.004501323681325), REAL_CONST(0.005294219125062), REAL_CONST(0.005538204684854), REAL_CONST(0.005602621007711), REAL_CONST(0.005619067233056), REAL_CONST(0.005623178556561) }, { REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043338975956), REAL_CONST(0.000165781748365), REAL_CONST(0.000563477107789), REAL_CONST(0.001408194424585), REAL_CONST(0.002252417383716), REAL_CONST(0.002649537986144), REAL_CONST(0.002771759871393), REAL_CONST(0.002804030198604), REAL_CONST(0.002812269143760), REAL_CONST(0.002814328996465) }, { REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000021669651687), REAL_CONST(0.000082893253420), REAL_CONST(0.000281680084299), REAL_CONST(0.000704268983100), REAL_CONST(0.001126734190620), REAL_CONST(0.001325377263129), REAL_CONST(0.001386545598507), REAL_CONST(0.001402696361765), REAL_CONST(0.001406819908880), REAL_CONST(0.001407850766554) }, { REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010834866771), REAL_CONST(0.000041447223339), REAL_CONST(0.000140846910654), REAL_CONST(0.000352177477907), REAL_CONST(0.000563477107789), REAL_CONST(0.000662840844598), REAL_CONST(0.000693439331371), REAL_CONST(0.000701518612914), REAL_CONST(0.000703581434209), REAL_CONST(0.000704097095877) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000020637769921), REAL_CONST(0.000070511166996), REAL_CONST(0.000176099492819), REAL_CONST(0.000281680084299), REAL_CONST(0.000331544462824), REAL_CONST(0.000346675369656), REAL_CONST(0.000350801943569), REAL_CONST(0.000351833587047), REAL_CONST(0.000352177477907) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010318922250), REAL_CONST(0.000035256012779), REAL_CONST(0.000088052431238), REAL_CONST(0.000140846910654), REAL_CONST(0.000165781748365), REAL_CONST(0.000173348103999), REAL_CONST(0.000175411638338), REAL_CONST(0.000175927518285), REAL_CONST(0.000176099492819) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005159470220), REAL_CONST(0.000017542124624), REAL_CONST(0.000044026888645), REAL_CONST(0.000070511166996), REAL_CONST(0.000082893253420), REAL_CONST(0.000086676649516), REAL_CONST(0.000087708482170), REAL_CONST(0.000088052431238), REAL_CONST(0.000088052431238) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002579737384), REAL_CONST(0.000008771088687), REAL_CONST(0.000022013611670), REAL_CONST(0.000035256012779), REAL_CONST(0.000041447223339), REAL_CONST(0.000043338975956), REAL_CONST(0.000043854910473), REAL_CONST(0.000044026888645), REAL_CONST(0.000044026888645) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000004471542070), REAL_CONST(0.000011006847672), REAL_CONST(0.000017542124624), REAL_CONST(0.000020637769921), REAL_CONST(0.000021669651687), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002235772627), REAL_CONST(0.000005503434295), REAL_CONST(0.000008771088687), REAL_CONST(0.000010318922250), REAL_CONST(0.000010834866771), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001031895522), REAL_CONST(0.000002751719876), REAL_CONST(0.000004471542070), REAL_CONST(0.000005159470220), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000515947875), REAL_CONST(0.000001375860506), REAL_CONST(0.000002235772627), REAL_CONST(0.000002579737384), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000000687930424), REAL_CONST(0.000001031895522), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000515947875), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634) } }; static const real_t log_Qplus1[31] = { REAL_CONST(6.022367813028454), REAL_CONST(5.044394119358453), REAL_CONST(4.087462841250339), REAL_CONST(3.169925001442313), REAL_CONST(2.321928094887362), REAL_CONST(1.584962500721156), REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362), REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339), REAL_CONST(0.044394119358453), REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878), REAL_CONST(0.002815015607054), REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247), REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122), REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667), REAL_CONST(0.000005503434331), REAL_CONST(0.000002751719790), REAL_CONST(0.000001375860551), REAL_CONST(0.000000687930439), REAL_CONST(0.000000343965261), REAL_CONST(0.000000171982641), REAL_CONST(0.000000000000000) }; static real_t find_log2_Qplus1(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch) { /* check for coupled energy/noise data */ if (sbr->bs_coupling == 1) { if ((sbr->Q[0][k][l] >= 0) && (sbr->Q[0][k][l] <= 30) && (sbr->Q[1][k][l] >= 0) && (sbr->Q[1][k][l] <= 24)) { if (ch == 0) { return log_Qplus1_pan[sbr->Q[0][k][l]][sbr->Q[1][k][l] >> 1]; } else { return log_Qplus1_pan[sbr->Q[0][k][l]][12 - (sbr->Q[1][k][l] >> 1)]; } } else { return 0; } } else { if (sbr->Q[ch][k][l] >= 0 && sbr->Q[ch][k][l] <= 30) { return log_Qplus1[sbr->Q[ch][k][l]]; } else { return 0; } } } static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch) { /* log2 values of limiter gains */ static real_t limGain[] = { REAL_CONST(-1.0), REAL_CONST(0.0), REAL_CONST(1.0), REAL_CONST(33.219) }; uint8_t m, l, k; uint8_t current_t_noise_band = 0; uint8_t S_mapped; ALIGN real_t Q_M_lim[MAX_M]; ALIGN real_t G_lim[MAX_M]; ALIGN real_t G_boost; ALIGN real_t S_M[MAX_M]; for (l = 0; l < sbr->L_E[ch]; l++) { uint8_t current_f_noise_band = 0; uint8_t current_res_band = 0; uint8_t current_res_band2 = 0; uint8_t current_hi_res_band = 0; real_t delta = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 0 : 1; S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1]) { current_t_noise_band++; } for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++) { real_t Q_M = 0; real_t G_max; real_t den = 0; real_t acc1 = 0; real_t acc2 = 0; uint8_t current_res_band_size = 0; uint8_t Q_M_size = 0; uint8_t ml1, ml2; /* bounds of current limiter bands */ ml1 = sbr->f_table_lim[sbr->bs_limiter_bands][k]; ml2 = sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; /* calculate the accumulated E_orig and E_curr over the limiter band */ for (m = ml1; m < ml2; m++) { if ((m + sbr->kx) < sbr->f_table_res[sbr->f[ch][l]][current_res_band+1]) { current_res_band_size++; } else { acc1 += pow2_int(-REAL_CONST(10) + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch)); current_res_band++; current_res_band_size = 1; } acc2 += sbr->E_curr[ch][m][l]; } acc1 += pow2_int(-REAL_CONST(10) + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch)); if (acc1 == 0) acc1 = LOG2_MIN_INF; else acc1 = log2_int(acc1); /* calculate the maximum gain */ /* ratio of the energy of the original signal and the energy * of the HF generated signal */ G_max = acc1 - log2_int(acc2) + limGain[sbr->bs_limiter_gains]; G_max = min(G_max, limGain[3]); for (m = ml1; m < ml2; m++) { real_t G; real_t E_curr, E_orig; real_t Q_orig, Q_orig_plus1; uint8_t S_index_mapped; /* check if m is on a noise band border */ if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1]) { /* step to next noise band */ current_f_noise_band++; } /* check if m is on a resolution band border */ if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1]) { /* accumulate a whole range of equal Q_Ms */ if (Q_M_size > 0) den += pow2_int(log2_int_tab[Q_M_size] + Q_M); Q_M_size = 0; /* step to next resolution band */ current_res_band2++; /* if we move to a new resolution band, we should check if we are * going to add a sinusoid in this band */ S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); } /* check if m is on a HI_RES band border */ if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1]) { /* step to next HI_RES band */ current_hi_res_band++; } /* find S_index_mapped * S_index_mapped can only be 1 for the m in the middle of the * current HI_RES band */ S_index_mapped = 0; if ((l >= sbr->l_A[ch]) || (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch])) { /* find the middle subband of the HI_RES frequency band */ if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1) S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band]; } /* find bitstream parameters */ if (sbr->E_curr[ch][m][l] == 0) E_curr = LOG2_MIN_INF; else E_curr = log2_int(sbr->E_curr[ch][m][l]); E_orig = -REAL_CONST(10) + find_log2_E(sbr, current_res_band2, l, ch); Q_orig = find_log2_Q(sbr, current_f_noise_band, current_t_noise_band, ch); Q_orig_plus1 = find_log2_Qplus1(sbr, current_f_noise_band, current_t_noise_band, ch); /* Q_M only depends on E_orig and Q_div2: * since N_Q <= N_Low <= N_High we only need to recalculate Q_M on * a change of current res band (HI or LO) */ Q_M = E_orig + Q_orig - Q_orig_plus1; /* S_M only depends on E_orig, Q_div and S_index_mapped: * S_index_mapped can only be non-zero once per HI_RES band */ if (S_index_mapped == 0) { S_M[m] = LOG2_MIN_INF; /* -inf */ } else { S_M[m] = E_orig - Q_orig_plus1; /* accumulate sinusoid part of the total energy */ den += pow2_int(S_M[m]); } /* calculate gain */ /* ratio of the energy of the original signal and the energy * of the HF generated signal */ /* E_curr here is officially E_curr+1 so the log2() of that can never be < 0 */ /* scaled by -10 */ G = E_orig - max(-REAL_CONST(10), E_curr); if ((S_mapped == 0) && (delta == 1)) { /* G = G * 1/(1+Q) */ G -= Q_orig_plus1; } else if (S_mapped == 1) { /* G = G * Q/(1+Q) */ G += Q_orig - Q_orig_plus1; } /* limit the additional noise energy level */ /* and apply the limiter */ if (G_max > G) { Q_M_lim[m] = Q_M; G_lim[m] = G; if ((S_index_mapped == 0) && (l != sbr->l_A[ch])) { Q_M_size++; } } else { /* G > G_max */ Q_M_lim[m] = Q_M + G_max - G; G_lim[m] = G_max; /* accumulate limited Q_M */ if ((S_index_mapped == 0) && (l != sbr->l_A[ch])) { den += pow2_int(Q_M_lim[m]); } } /* accumulate the total energy */ /* E_curr changes for every m so we do need to accumulate every m */ den += pow2_int(E_curr + G_lim[m]); } /* accumulate last range of equal Q_Ms */ if (Q_M_size > 0) { den += pow2_int(log2_int_tab[Q_M_size] + Q_M); } /* calculate the final gain */ /* G_boost: [0..2.51188643] */ G_boost = acc1 - log2_int(den /*+ EPS*/); G_boost = min(G_boost, REAL_CONST(1.328771237) /* log2(1.584893192 ^ 2) */); for (m = ml1; m < ml2; m++) { /* apply compensation to gain, noise floor sf's and sinusoid levels */ #ifndef SBR_LOW_POWER adj->G_lim_boost[l][m] = pow2_fix((G_lim[m] + G_boost) >> 1); #else /* sqrt() will be done after the aliasing reduction to save a * few multiplies */ adj->G_lim_boost[l][m] = pow2_fix(G_lim[m] + G_boost); #endif adj->Q_M_lim_boost[l][m] = pow2_fix((Q_M_lim[m] + G_boost) >> 1); if (S_M[m] != LOG2_MIN_INF) { adj->S_M_boost[l][m] = pow2_int((S_M[m] + G_boost) >> 1); } else { adj->S_M_boost[l][m] = 0; } } } } } #else //#define LOG2_TEST #ifdef LOG2_TEST #define LOG2_MIN_INF -100000 __inline float pow2(float val) { return pow(2.0, val); } __inline float log2(float val) { return log(val)/log(2.0); } #define RB 14 float QUANTISE2REAL(float val) { __int32 ival = (__int32)(val * (1<<RB)); return (float)ival / (float)((1<<RB)); } float QUANTISE2INT(float val) { return floor(val); } /* log2 values of [0..63] */ static const real_t log2_int_tab[] = { LOG2_MIN_INF, 0.000000000000000, 1.000000000000000, 1.584962500721156, 2.000000000000000, 2.321928094887362, 2.584962500721156, 2.807354922057604, 3.000000000000000, 3.169925001442313, 3.321928094887363, 3.459431618637297, 3.584962500721156, 3.700439718141092, 3.807354922057604, 3.906890595608519, 4.000000000000000, 4.087462841250339, 4.169925001442312, 4.247927513443585, 4.321928094887362, 4.392317422778761, 4.459431618637297, 4.523561956057013, 4.584962500721156, 4.643856189774724, 4.700439718141093, 4.754887502163468, 4.807354922057604, 4.857980995127572, 4.906890595608519, 4.954196310386875, 5.000000000000000, 5.044394119358453, 5.087462841250340, 5.129283016944966, 5.169925001442312, 5.209453365628949, 5.247927513443585, 5.285402218862248, 5.321928094887363, 5.357552004618084, 5.392317422778761, 5.426264754702098, 5.459431618637297, 5.491853096329675, 5.523561956057013, 5.554588851677637, 5.584962500721156, 5.614709844115208, 5.643856189774724, 5.672425341971495, 5.700439718141093, 5.727920454563200, 5.754887502163469, 5.781359713524660, 5.807354922057605, 5.832890014164742, 5.857980995127572, 5.882643049361842, 5.906890595608518, 5.930737337562887, 5.954196310386876, 5.977279923499916 }; static const real_t pan_log2_tab[] = { 1.000000000000000, 0.584962500721156, 0.321928094887362, 0.169925001442312, 0.087462841250339, 0.044394119358453, 0.022367813028455, 0.011227255423254, 0.005624549193878, 0.002815015607054, 0.001408194392808, 0.000704269011247, 0.000352177480301, 0.000176099486443, 0.000088052430122, 0.000044026886827, 0.000022013611360, 0.000011006847667 }; static real_t find_log2_E(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch) { /* check for coupled energy/noise data */ if (sbr->bs_coupling == 1) { real_t amp0 = (sbr->amp_res[0]) ? 1.0 : 0.5; real_t amp1 = (sbr->amp_res[1]) ? 1.0 : 0.5; float tmp = QUANTISE2REAL(7.0 + (real_t)sbr->E[0][k][l] * amp0); float pan; int E = (int)(sbr->E[1][k][l] * amp1); if (ch == 0) { if (E > 12) { /* negative */ pan = QUANTISE2REAL(pan_log2_tab[-12 + E]); } else { /* positive */ pan = QUANTISE2REAL(pan_log2_tab[12 - E] + (12 - E)); } } else { if (E < 12) { /* negative */ pan = QUANTISE2REAL(pan_log2_tab[-E + 12]); } else { /* positive */ pan = QUANTISE2REAL(pan_log2_tab[E - 12] + (E - 12)); } } /* tmp / pan in log2 */ return QUANTISE2REAL(tmp - pan); } else { real_t amp = (sbr->amp_res[ch]) ? 1.0 : 0.5; return QUANTISE2REAL(6.0 + (real_t)sbr->E[ch][k][l] * amp); } } static real_t find_log2_Q(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch) { /* check for coupled energy/noise data */ if (sbr->bs_coupling == 1) { float tmp = QUANTISE2REAL(7.0 - (real_t)sbr->Q[0][k][l]); float pan; int Q = (int)(sbr->Q[1][k][l]); if (ch == 0) { if (Q > 12) { /* negative */ pan = QUANTISE2REAL(pan_log2_tab[-12 + Q]); } else { /* positive */ pan = QUANTISE2REAL(pan_log2_tab[12 - Q] + (12 - Q)); } } else { if (Q < 12) { /* negative */ pan = QUANTISE2REAL(pan_log2_tab[-Q + 12]); } else { /* positive */ pan = QUANTISE2REAL(pan_log2_tab[Q - 12] + (Q - 12)); } } /* tmp / pan in log2 */ return QUANTISE2REAL(tmp - pan); } else { return QUANTISE2REAL(6.0 - (real_t)sbr->Q[ch][k][l]); } } static const real_t log_Qplus1_pan[31][13] = { { REAL_CONST(0.044383447617292), REAL_CONST(0.169768601655960), REAL_CONST(0.583090126514435), REAL_CONST(1.570089221000671), REAL_CONST(3.092446088790894), REAL_CONST(4.733354568481445), REAL_CONST(6.022367954254150), REAL_CONST(6.692092418670654), REAL_CONST(6.924463272094727), REAL_CONST(6.989034175872803), REAL_CONST(7.005646705627441), REAL_CONST(7.009829998016357), REAL_CONST(7.010877609252930) }, { REAL_CONST(0.022362394258380), REAL_CONST(0.087379962205887), REAL_CONST(0.320804953575134), REAL_CONST(0.988859415054321), REAL_CONST(2.252387046813965), REAL_CONST(3.786596298217773), REAL_CONST(5.044394016265869), REAL_CONST(5.705977916717529), REAL_CONST(5.936291694641113), REAL_CONST(6.000346660614014), REAL_CONST(6.016829967498779), REAL_CONST(6.020981311798096), REAL_CONST(6.022020816802979) }, { REAL_CONST(0.011224525049329), REAL_CONST(0.044351425021887), REAL_CONST(0.169301137328148), REAL_CONST(0.577544987201691), REAL_CONST(1.527246952056885), REAL_CONST(2.887525320053101), REAL_CONST(4.087462902069092), REAL_CONST(4.733354568481445), REAL_CONST(4.959661006927490), REAL_CONST(5.022709369659424), REAL_CONST(5.038940429687500), REAL_CONST(5.043028831481934), REAL_CONST(5.044052600860596) }, { REAL_CONST(0.005623178556561), REAL_CONST(0.022346137091517), REAL_CONST(0.087132595479488), REAL_CONST(0.317482173442841), REAL_CONST(0.956931233406067), REAL_CONST(2.070389270782471), REAL_CONST(3.169924974441528), REAL_CONST(3.786596298217773), REAL_CONST(4.005294322967529), REAL_CONST(4.066420555114746), REAL_CONST(4.082170009613037), REAL_CONST(4.086137294769287), REAL_CONST(4.087131500244141) }, { REAL_CONST(0.002814328996465), REAL_CONST(0.011216334067285), REAL_CONST(0.044224001467228), REAL_CONST(0.167456731200218), REAL_CONST(0.556393325328827), REAL_CONST(1.378511548042297), REAL_CONST(2.321928024291992), REAL_CONST(2.887525320053101), REAL_CONST(3.092446088790894), REAL_CONST(3.150059700012207), REAL_CONST(3.164926528930664), REAL_CONST(3.168673276901245), REAL_CONST(3.169611930847168) }, { REAL_CONST(0.001407850766554), REAL_CONST(0.005619067233056), REAL_CONST(0.022281449288130), REAL_CONST(0.086156636476517), REAL_CONST(0.304854571819305), REAL_CONST(0.847996890544891), REAL_CONST(1.584962487220764), REAL_CONST(2.070389270782471), REAL_CONST(2.252387046813965), REAL_CONST(2.304061651229858), REAL_CONST(2.317430257797241), REAL_CONST(2.320801734924316), REAL_CONST(2.321646213531494) }, { REAL_CONST(0.000704097095877), REAL_CONST(0.002812269143760), REAL_CONST(0.011183738708496), REAL_CONST(0.043721374124289), REAL_CONST(0.160464659333229), REAL_CONST(0.485426813364029), REAL_CONST(1.000000000000000), REAL_CONST(1.378511548042297), REAL_CONST(1.527246952056885), REAL_CONST(1.570089221000671), REAL_CONST(1.581215262413025), REAL_CONST(1.584023833274841), REAL_CONST(1.584727644920349) }, { REAL_CONST(0.000352177477907), REAL_CONST(0.001406819908880), REAL_CONST(0.005602621007711), REAL_CONST(0.022026389837265), REAL_CONST(0.082462236285210), REAL_CONST(0.263034462928772), REAL_CONST(0.584962487220764), REAL_CONST(0.847996890544891), REAL_CONST(0.956931233406067), REAL_CONST(0.988859415054321), REAL_CONST(0.997190535068512), REAL_CONST(0.999296069145203), REAL_CONST(0.999823868274689) }, { REAL_CONST(0.000176099492819), REAL_CONST(0.000703581434209), REAL_CONST(0.002804030198604), REAL_CONST(0.011055230163038), REAL_CONST(0.041820213198662), REAL_CONST(0.137503549456596), REAL_CONST(0.321928083896637), REAL_CONST(0.485426813364029), REAL_CONST(0.556393325328827), REAL_CONST(0.577544987201691), REAL_CONST(0.583090126514435), REAL_CONST(0.584493279457092), REAL_CONST(0.584845066070557) }, { REAL_CONST(0.000088052431238), REAL_CONST(0.000351833587047), REAL_CONST(0.001402696361765), REAL_CONST(0.005538204684854), REAL_CONST(0.021061634644866), REAL_CONST(0.070389263331890), REAL_CONST(0.169925004243851), REAL_CONST(0.263034462928772), REAL_CONST(0.304854571819305), REAL_CONST(0.317482173442841), REAL_CONST(0.320804953575134), REAL_CONST(0.321646571159363), REAL_CONST(0.321857661008835) }, { REAL_CONST(0.000044026888645), REAL_CONST(0.000175927518285), REAL_CONST(0.000701518612914), REAL_CONST(0.002771759871393), REAL_CONST(0.010569252073765), REAL_CONST(0.035623874515295), REAL_CONST(0.087462842464447), REAL_CONST(0.137503549456596), REAL_CONST(0.160464659333229), REAL_CONST(0.167456731200218), REAL_CONST(0.169301137328148), REAL_CONST(0.169768601655960), REAL_CONST(0.169885858893394) }, { REAL_CONST(0.000022013611670), REAL_CONST(0.000088052431238), REAL_CONST(0.000350801943569), REAL_CONST(0.001386545598507), REAL_CONST(0.005294219125062), REAL_CONST(0.017921976745129), REAL_CONST(0.044394120573997), REAL_CONST(0.070389263331890), REAL_CONST(0.082462236285210), REAL_CONST(0.086156636476517), REAL_CONST(0.087132595479488), REAL_CONST(0.087379962205887), REAL_CONST(0.087442122399807) }, { REAL_CONST(0.000011006847672), REAL_CONST(0.000044026888645), REAL_CONST(0.000175411638338), REAL_CONST(0.000693439331371), REAL_CONST(0.002649537986144), REAL_CONST(0.008988817222416), REAL_CONST(0.022367812693119), REAL_CONST(0.035623874515295), REAL_CONST(0.041820213198662), REAL_CONST(0.043721374124289), REAL_CONST(0.044224001467228), REAL_CONST(0.044351425021887), REAL_CONST(0.044383447617292) }, { REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000087708482170), REAL_CONST(0.000346675369656), REAL_CONST(0.001325377263129), REAL_CONST(0.004501323681325), REAL_CONST(0.011227255687118), REAL_CONST(0.017921976745129), REAL_CONST(0.021061634644866), REAL_CONST(0.022026389837265), REAL_CONST(0.022281449288130), REAL_CONST(0.022346137091517), REAL_CONST(0.022362394258380) }, { REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043854910473), REAL_CONST(0.000173348103999), REAL_CONST(0.000662840844598), REAL_CONST(0.002252417383716), REAL_CONST(0.005624548997730), REAL_CONST(0.008988817222416), REAL_CONST(0.010569252073765), REAL_CONST(0.011055230163038), REAL_CONST(0.011183738708496), REAL_CONST(0.011216334067285), REAL_CONST(0.011224525049329) }, { REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000086676649516), REAL_CONST(0.000331544462824), REAL_CONST(0.001126734190620), REAL_CONST(0.002815015614033), REAL_CONST(0.004501323681325), REAL_CONST(0.005294219125062), REAL_CONST(0.005538204684854), REAL_CONST(0.005602621007711), REAL_CONST(0.005619067233056), REAL_CONST(0.005623178556561) }, { REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043338975956), REAL_CONST(0.000165781748365), REAL_CONST(0.000563477107789), REAL_CONST(0.001408194424585), REAL_CONST(0.002252417383716), REAL_CONST(0.002649537986144), REAL_CONST(0.002771759871393), REAL_CONST(0.002804030198604), REAL_CONST(0.002812269143760), REAL_CONST(0.002814328996465) }, { REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000021669651687), REAL_CONST(0.000082893253420), REAL_CONST(0.000281680084299), REAL_CONST(0.000704268983100), REAL_CONST(0.001126734190620), REAL_CONST(0.001325377263129), REAL_CONST(0.001386545598507), REAL_CONST(0.001402696361765), REAL_CONST(0.001406819908880), REAL_CONST(0.001407850766554) }, { REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010834866771), REAL_CONST(0.000041447223339), REAL_CONST(0.000140846910654), REAL_CONST(0.000352177477907), REAL_CONST(0.000563477107789), REAL_CONST(0.000662840844598), REAL_CONST(0.000693439331371), REAL_CONST(0.000701518612914), REAL_CONST(0.000703581434209), REAL_CONST(0.000704097095877) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000020637769921), REAL_CONST(0.000070511166996), REAL_CONST(0.000176099492819), REAL_CONST(0.000281680084299), REAL_CONST(0.000331544462824), REAL_CONST(0.000346675369656), REAL_CONST(0.000350801943569), REAL_CONST(0.000351833587047), REAL_CONST(0.000352177477907) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010318922250), REAL_CONST(0.000035256012779), REAL_CONST(0.000088052431238), REAL_CONST(0.000140846910654), REAL_CONST(0.000165781748365), REAL_CONST(0.000173348103999), REAL_CONST(0.000175411638338), REAL_CONST(0.000175927518285), REAL_CONST(0.000176099492819) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005159470220), REAL_CONST(0.000017542124624), REAL_CONST(0.000044026888645), REAL_CONST(0.000070511166996), REAL_CONST(0.000082893253420), REAL_CONST(0.000086676649516), REAL_CONST(0.000087708482170), REAL_CONST(0.000088052431238), REAL_CONST(0.000088052431238) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002579737384), REAL_CONST(0.000008771088687), REAL_CONST(0.000022013611670), REAL_CONST(0.000035256012779), REAL_CONST(0.000041447223339), REAL_CONST(0.000043338975956), REAL_CONST(0.000043854910473), REAL_CONST(0.000044026888645), REAL_CONST(0.000044026888645) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000004471542070), REAL_CONST(0.000011006847672), REAL_CONST(0.000017542124624), REAL_CONST(0.000020637769921), REAL_CONST(0.000021669651687), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002235772627), REAL_CONST(0.000005503434295), REAL_CONST(0.000008771088687), REAL_CONST(0.000010318922250), REAL_CONST(0.000010834866771), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001031895522), REAL_CONST(0.000002751719876), REAL_CONST(0.000004471542070), REAL_CONST(0.000005159470220), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000515947875), REAL_CONST(0.000001375860506), REAL_CONST(0.000002235772627), REAL_CONST(0.000002579737384), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000000687930424), REAL_CONST(0.000001031895522), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000515947875), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269) }, { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634) } }; static const real_t log_Qplus1[31] = { REAL_CONST(6.022367813028454), REAL_CONST(5.044394119358453), REAL_CONST(4.087462841250339), REAL_CONST(3.169925001442313), REAL_CONST(2.321928094887362), REAL_CONST(1.584962500721156), REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362), REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339), REAL_CONST(0.044394119358453), REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878), REAL_CONST(0.002815015607054), REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247), REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122), REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667), REAL_CONST(0.000005503434331), REAL_CONST(0.000002751719790), REAL_CONST(0.000001375860551), REAL_CONST(0.000000687930439), REAL_CONST(0.000000343965261), REAL_CONST(0.000000171982641), REAL_CONST(0.000000000000000) }; static real_t find_log2_Qplus1(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch) { /* check for coupled energy/noise data */ if (sbr->bs_coupling == 1) { if ((sbr->Q[0][k][l] >= 0) && (sbr->Q[0][k][l] <= 30) && (sbr->Q[1][k][l] >= 0) && (sbr->Q[1][k][l] <= 24)) { if (ch == 0) { return QUANTISE2REAL(log_Qplus1_pan[sbr->Q[0][k][l]][sbr->Q[1][k][l] >> 1]); } else { return QUANTISE2REAL(log_Qplus1_pan[sbr->Q[0][k][l]][12 - (sbr->Q[1][k][l] >> 1)]); } } else { return 0; } } else { if (sbr->Q[ch][k][l] >= 0 && sbr->Q[ch][k][l] <= 30) { return QUANTISE2REAL(log_Qplus1[sbr->Q[ch][k][l]]); } else { return 0; } } } static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch) { /* log2 values of limiter gains */ static real_t limGain[] = { -1.0, 0.0, 1.0, 33.219 }; uint8_t m, l, k; uint8_t current_t_noise_band = 0; uint8_t S_mapped; ALIGN real_t Q_M_lim[MAX_M]; ALIGN real_t G_lim[MAX_M]; ALIGN real_t G_boost; ALIGN real_t S_M[MAX_M]; for (l = 0; l < sbr->L_E[ch]; l++) { uint8_t current_f_noise_band = 0; uint8_t current_res_band = 0; uint8_t current_res_band2 = 0; uint8_t current_hi_res_band = 0; real_t delta = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 0 : 1; S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1]) { current_t_noise_band++; } for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++) { real_t Q_M = 0; real_t G_max; real_t den = 0; real_t acc1 = 0; real_t acc2 = 0; uint8_t current_res_band_size = 0; uint8_t Q_M_size = 0; uint8_t ml1, ml2; /* bounds of current limiter bands */ ml1 = sbr->f_table_lim[sbr->bs_limiter_bands][k]; ml2 = sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; /* calculate the accumulated E_orig and E_curr over the limiter band */ for (m = ml1; m < ml2; m++) { if ((m + sbr->kx) < sbr->f_table_res[sbr->f[ch][l]][current_res_band+1]) { current_res_band_size++; } else { acc1 += QUANTISE2INT(pow2(-10 + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch))); current_res_band++; current_res_band_size = 1; } acc2 += QUANTISE2INT(sbr->E_curr[ch][m][l]/1024.0); } acc1 += QUANTISE2INT(pow2(-10 + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch))); acc1 = QUANTISE2REAL( log2(EPS + acc1) ); /* calculate the maximum gain */ /* ratio of the energy of the original signal and the energy * of the HF generated signal */ G_max = acc1 - QUANTISE2REAL(log2(EPS + acc2)) + QUANTISE2REAL(limGain[sbr->bs_limiter_gains]); G_max = min(G_max, QUANTISE2REAL(limGain[3])); for (m = ml1; m < ml2; m++) { real_t G; real_t E_curr, E_orig; real_t Q_orig, Q_orig_plus1; uint8_t S_index_mapped; /* check if m is on a noise band border */ if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1]) { /* step to next noise band */ current_f_noise_band++; } /* check if m is on a resolution band border */ if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1]) { /* accumulate a whole range of equal Q_Ms */ if (Q_M_size > 0) den += QUANTISE2INT(pow2(log2_int_tab[Q_M_size] + Q_M)); Q_M_size = 0; /* step to next resolution band */ current_res_band2++; /* if we move to a new resolution band, we should check if we are * going to add a sinusoid in this band */ S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); } /* check if m is on a HI_RES band border */ if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1]) { /* step to next HI_RES band */ current_hi_res_band++; } /* find S_index_mapped * S_index_mapped can only be 1 for the m in the middle of the * current HI_RES band */ S_index_mapped = 0; if ((l >= sbr->l_A[ch]) || (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch])) { /* find the middle subband of the HI_RES frequency band */ if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1) S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band]; } /* find bitstream parameters */ if (sbr->E_curr[ch][m][l] == 0) E_curr = LOG2_MIN_INF; else E_curr = -10 + log2(sbr->E_curr[ch][m][l]); E_orig = -10 + find_log2_E(sbr, current_res_band2, l, ch); Q_orig = find_log2_Q(sbr, current_f_noise_band, current_t_noise_band, ch); Q_orig_plus1 = find_log2_Qplus1(sbr, current_f_noise_band, current_t_noise_band, ch); /* Q_M only depends on E_orig and Q_div2: * since N_Q <= N_Low <= N_High we only need to recalculate Q_M on * a change of current res band (HI or LO) */ Q_M = E_orig + Q_orig - Q_orig_plus1; /* S_M only depends on E_orig, Q_div and S_index_mapped: * S_index_mapped can only be non-zero once per HI_RES band */ if (S_index_mapped == 0) { S_M[m] = LOG2_MIN_INF; /* -inf */ } else { S_M[m] = E_orig - Q_orig_plus1; /* accumulate sinusoid part of the total energy */ den += pow2(S_M[m]); } /* calculate gain */ /* ratio of the energy of the original signal and the energy * of the HF generated signal */ /* E_curr here is officially E_curr+1 so the log2() of that can never be < 0 */ /* scaled by -10 */ G = E_orig - max(-10, E_curr); if ((S_mapped == 0) && (delta == 1)) { /* G = G * 1/(1+Q) */ G -= Q_orig_plus1; } else if (S_mapped == 1) { /* G = G * Q/(1+Q) */ G += Q_orig - Q_orig_plus1; } /* limit the additional noise energy level */ /* and apply the limiter */ if (G_max > G) { Q_M_lim[m] = QUANTISE2REAL(Q_M); G_lim[m] = QUANTISE2REAL(G); if ((S_index_mapped == 0) && (l != sbr->l_A[ch])) { Q_M_size++; } } else { /* G > G_max */ Q_M_lim[m] = QUANTISE2REAL(Q_M) + G_max - QUANTISE2REAL(G); G_lim[m] = G_max; /* accumulate limited Q_M */ if ((S_index_mapped == 0) && (l != sbr->l_A[ch])) { den += QUANTISE2INT(pow2(Q_M_lim[m])); } } /* accumulate the total energy */ /* E_curr changes for every m so we do need to accumulate every m */ den += QUANTISE2INT(pow2(E_curr + G_lim[m])); } /* accumulate last range of equal Q_Ms */ if (Q_M_size > 0) { den += QUANTISE2INT(pow2(log2_int_tab[Q_M_size] + Q_M)); } /* calculate the final gain */ /* G_boost: [0..2.51188643] */ G_boost = acc1 - QUANTISE2REAL(log2(den + EPS)); G_boost = min(G_boost, QUANTISE2REAL(1.328771237) /* log2(1.584893192 ^ 2) */); for (m = ml1; m < ml2; m++) { /* apply compensation to gain, noise floor sf's and sinusoid levels */ #ifndef SBR_LOW_POWER adj->G_lim_boost[l][m] = QUANTISE2REAL(pow2((G_lim[m] + G_boost) / 2.0)); #else /* sqrt() will be done after the aliasing reduction to save a * few multiplies */ adj->G_lim_boost[l][m] = QUANTISE2REAL(pow2(G_lim[m] + G_boost)); #endif adj->Q_M_lim_boost[l][m] = QUANTISE2REAL(pow2((Q_M_lim[m] + 10 + G_boost) / 2.0)); if (S_M[m] != LOG2_MIN_INF) { adj->S_M_boost[l][m] = QUANTISE2REAL(pow2((S_M[m] + 10 + G_boost) / 2.0)); } else { adj->S_M_boost[l][m] = 0; } } } } } #else static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch) { static real_t limGain[] = { 0.5, 1.0, 2.0, 1e10 }; uint8_t m, l, k; uint8_t current_t_noise_band = 0; uint8_t S_mapped; ALIGN real_t Q_M_lim[MAX_M]; ALIGN real_t G_lim[MAX_M]; ALIGN real_t G_boost; ALIGN real_t S_M[MAX_M]; for (l = 0; l < sbr->L_E[ch]; l++) { uint8_t current_f_noise_band = 0; uint8_t current_res_band = 0; uint8_t current_res_band2 = 0; uint8_t current_hi_res_band = 0; real_t delta = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 0 : 1; S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1]) { current_t_noise_band++; } for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++) { real_t G_max; real_t den = 0; real_t acc1 = 0; real_t acc2 = 0; uint8_t current_res_band_size = 0; uint8_t ml1, ml2; ml1 = sbr->f_table_lim[sbr->bs_limiter_bands][k]; ml2 = sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; /* calculate the accumulated E_orig and E_curr over the limiter band */ for (m = ml1; m < ml2; m++) { if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band+1]) { current_res_band++; } acc1 += sbr->E_orig[ch][current_res_band][l]; acc2 += sbr->E_curr[ch][m][l]; } /* calculate the maximum gain */ /* ratio of the energy of the original signal and the energy * of the HF generated signal */ G_max = ((EPS + acc1) / (EPS + acc2)) * limGain[sbr->bs_limiter_gains]; G_max = min(G_max, 1e10); for (m = ml1; m < ml2; m++) { real_t Q_M, G; real_t Q_div, Q_div2; uint8_t S_index_mapped; /* check if m is on a noise band border */ if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1]) { /* step to next noise band */ current_f_noise_band++; } /* check if m is on a resolution band border */ if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1]) { /* step to next resolution band */ current_res_band2++; /* if we move to a new resolution band, we should check if we are * going to add a sinusoid in this band */ S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); } /* check if m is on a HI_RES band border */ if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1]) { /* step to next HI_RES band */ current_hi_res_band++; } /* find S_index_mapped * S_index_mapped can only be 1 for the m in the middle of the * current HI_RES band */ S_index_mapped = 0; if ((l >= sbr->l_A[ch]) || (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch])) { /* find the middle subband of the HI_RES frequency band */ if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1) S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band]; } /* Q_div: [0..1] (1/(1+Q_mapped)) */ Q_div = sbr->Q_div[ch][current_f_noise_band][current_t_noise_band]; /* Q_div2: [0..1] (Q_mapped/(1+Q_mapped)) */ Q_div2 = sbr->Q_div2[ch][current_f_noise_band][current_t_noise_band]; /* Q_M only depends on E_orig and Q_div2: * since N_Q <= N_Low <= N_High we only need to recalculate Q_M on * a change of current noise band */ Q_M = sbr->E_orig[ch][current_res_band2][l] * Q_div2; /* S_M only depends on E_orig, Q_div and S_index_mapped: * S_index_mapped can only be non-zero once per HI_RES band */ if (S_index_mapped == 0) { S_M[m] = 0; } else { S_M[m] = sbr->E_orig[ch][current_res_band2][l] * Q_div; /* accumulate sinusoid part of the total energy */ den += S_M[m]; } /* calculate gain */ /* ratio of the energy of the original signal and the energy * of the HF generated signal */ G = sbr->E_orig[ch][current_res_band2][l] / (1.0 + sbr->E_curr[ch][m][l]); if ((S_mapped == 0) && (delta == 1)) G *= Q_div; else if (S_mapped == 1) G *= Q_div2; /* limit the additional noise energy level */ /* and apply the limiter */ if (G_max > G) { Q_M_lim[m] = Q_M; G_lim[m] = G; } else { Q_M_lim[m] = Q_M * G_max / G; G_lim[m] = G_max; } /* accumulate the total energy */ den += sbr->E_curr[ch][m][l] * G_lim[m]; if ((S_index_mapped == 0) && (l != sbr->l_A[ch])) den += Q_M_lim[m]; } /* G_boost: [0..2.51188643] */ G_boost = (acc1 + EPS) / (den + EPS); G_boost = min(G_boost, 2.51188643 /* 1.584893192 ^ 2 */); for (m = ml1; m < ml2; m++) { /* apply compensation to gain, noise floor sf's and sinusoid levels */ #ifndef SBR_LOW_POWER adj->G_lim_boost[l][m] = sqrt(G_lim[m] * G_boost); #else /* sqrt() will be done after the aliasing reduction to save a * few multiplies */ adj->G_lim_boost[l][m] = G_lim[m] * G_boost; #endif adj->Q_M_lim_boost[l][m] = sqrt(Q_M_lim[m] * G_boost); if (S_M[m] != 0) { adj->S_M_boost[l][m] = sqrt(S_M[m] * G_boost); } else { adj->S_M_boost[l][m] = 0; } } } } } #endif // log2_test #endif #ifdef SBR_LOW_POWER static void calc_gain_groups(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch) { uint8_t l, k, i; uint8_t grouping; uint8_t S_mapped; for (l = 0; l < sbr->L_E[ch]; l++) { uint8_t current_res_band = 0; i = 0; grouping = 0; S_mapped = get_S_mapped(sbr, ch, l, current_res_band); for (k = sbr->kx; k < sbr->kx + sbr->M - 1; k++) { if (k == sbr->f_table_res[sbr->f[ch][l]][current_res_band+1]) { /* step to next resolution band */ current_res_band++; S_mapped = get_S_mapped(sbr, ch, l, current_res_band); } if (deg[k + 1] && S_mapped == 0) { if (grouping == 0) { sbr->f_group[l][i] = k; grouping = 1; i++; } } else { if (grouping) { if (S_mapped) { sbr->f_group[l][i] = k; } else { sbr->f_group[l][i] = k + 1; } grouping = 0; i++; } } } if (grouping) { sbr->f_group[l][i] = sbr->kx + sbr->M; i++; } sbr->N_G[l] = (uint8_t)(i >> 1); } } static void aliasing_reduction(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch) { uint8_t l, k, m; real_t E_total, E_total_est, G_target, acc; for (l = 0; l < sbr->L_E[ch]; l++) { for (k = 0; k < sbr->N_G[l]; k++) { E_total_est = E_total = 0; for (m = sbr->f_group[l][k<<1]; m < sbr->f_group[l][(k<<1) + 1]; m++) { /* E_curr: integer */ /* G_lim_boost: fixed point */ /* E_total_est: integer */ /* E_total: integer */ E_total_est += sbr->E_curr[ch][m-sbr->kx][l]; #ifdef FIXED_POINT E_total += MUL_Q2(sbr->E_curr[ch][m-sbr->kx][l], adj->G_lim_boost[l][m-sbr->kx]); #else E_total += sbr->E_curr[ch][m-sbr->kx][l] * adj->G_lim_boost[l][m-sbr->kx]; #endif } /* G_target: fixed point */ if ((E_total_est + EPS) == 0) { G_target = 0; } else { #ifdef FIXED_POINT G_target = (((int64_t)(E_total))<<Q2_BITS)/(E_total_est + EPS); #else G_target = E_total / (E_total_est + EPS); #endif } acc = 0; for (m = sbr->f_group[l][(k<<1)]; m < sbr->f_group[l][(k<<1) + 1]; m++) { real_t alpha; /* alpha: (COEF) fixed point */ if (m < sbr->kx + sbr->M - 1) { alpha = max(deg[m], deg[m + 1]); } else { alpha = deg[m]; } adj->G_lim_boost[l][m-sbr->kx] = MUL_C(alpha, G_target) + MUL_C((COEF_CONST(1)-alpha), adj->G_lim_boost[l][m-sbr->kx]); /* acc: integer */ #ifdef FIXED_POINT acc += MUL_Q2(adj->G_lim_boost[l][m-sbr->kx], sbr->E_curr[ch][m-sbr->kx][l]); #else acc += adj->G_lim_boost[l][m-sbr->kx] * sbr->E_curr[ch][m-sbr->kx][l]; #endif } /* acc: fixed point */ if (acc + EPS == 0) { acc = 0; } else { #ifdef FIXED_POINT acc = (((int64_t)(E_total))<<Q2_BITS)/(acc + EPS); #else acc = E_total / (acc + EPS); #endif } for(m = sbr->f_group[l][(k<<1)]; m < sbr->f_group[l][(k<<1) + 1]; m++) { #ifdef FIXED_POINT adj->G_lim_boost[l][m-sbr->kx] = MUL_Q2(acc, adj->G_lim_boost[l][m-sbr->kx]); #else adj->G_lim_boost[l][m-sbr->kx] = acc * adj->G_lim_boost[l][m-sbr->kx]; #endif } } } for (l = 0; l < sbr->L_E[ch]; l++) { for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++) { for (m = sbr->f_table_lim[sbr->bs_limiter_bands][k]; m < sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; m++) { #ifdef FIXED_POINT adj->G_lim_boost[l][m] = SBR_SQRT_Q2(adj->G_lim_boost[l][m]); #else adj->G_lim_boost[l][m] = sqrt(adj->G_lim_boost[l][m]); #endif } } } } #endif static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj, qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch) { static real_t h_smooth[] = { FRAC_CONST(0.03183050093751), FRAC_CONST(0.11516383427084), FRAC_CONST(0.21816949906249), FRAC_CONST(0.30150283239582), FRAC_CONST(0.33333333333333) }; static int8_t phi_re[] = { 1, 0, -1, 0 }; static int8_t phi_im[] = { 0, 1, 0, -1 }; uint8_t m, l, i, n; uint16_t fIndexNoise = 0; uint8_t fIndexSine = 0; uint8_t assembly_reset = 0; real_t G_filt, Q_filt; uint8_t h_SL; if (sbr->Reset == 1) { assembly_reset = 1; fIndexNoise = 0; } else { fIndexNoise = sbr->index_noise_prev[ch]; } fIndexSine = sbr->psi_is_prev[ch]; for (l = 0; l < sbr->L_E[ch]; l++) { uint8_t no_noise = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 1 : 0; #ifdef SBR_LOW_POWER h_SL = 0; #else h_SL = (sbr->bs_smoothing_mode == 1) ? 0 : 4; h_SL = (no_noise ? 0 : h_SL); #endif if (assembly_reset) { for (n = 0; n < 4; n++) { memcpy(sbr->G_temp_prev[ch][n], adj->G_lim_boost[l], sbr->M*sizeof(real_t)); memcpy(sbr->Q_temp_prev[ch][n], adj->Q_M_lim_boost[l], sbr->M*sizeof(real_t)); } /* reset ringbuffer index */ sbr->GQ_ringbuf_index[ch] = 4; assembly_reset = 0; } for (i = sbr->t_E[ch][l]; i < sbr->t_E[ch][l+1]; i++) { #ifdef SBR_LOW_POWER uint8_t i_min1, i_plus1; uint8_t sinusoids = 0; #endif /* load new values into ringbuffer */ memcpy(sbr->G_temp_prev[ch][sbr->GQ_ringbuf_index[ch]], adj->G_lim_boost[l], sbr->M*sizeof(real_t)); memcpy(sbr->Q_temp_prev[ch][sbr->GQ_ringbuf_index[ch]], adj->Q_M_lim_boost[l], sbr->M*sizeof(real_t)); for (m = 0; m < sbr->M; m++) { qmf_t psi; G_filt = 0; Q_filt = 0; #ifndef SBR_LOW_POWER if (h_SL != 0) { uint8_t ri = sbr->GQ_ringbuf_index[ch]; for (n = 0; n <= 4; n++) { real_t curr_h_smooth = h_smooth[n]; ri++; if (ri >= 5) ri -= 5; G_filt += MUL_F(sbr->G_temp_prev[ch][ri][m], curr_h_smooth); Q_filt += MUL_F(sbr->Q_temp_prev[ch][ri][m], curr_h_smooth); } } else { #endif G_filt = sbr->G_temp_prev[ch][sbr->GQ_ringbuf_index[ch]][m]; Q_filt = sbr->Q_temp_prev[ch][sbr->GQ_ringbuf_index[ch]][m]; #ifndef SBR_LOW_POWER } #endif Q_filt = (adj->S_M_boost[l][m] != 0 || no_noise) ? 0 : Q_filt; /* add noise to the output */ fIndexNoise = (fIndexNoise + 1) & 511; /* the smoothed gain values are applied to Xsbr */ /* V is defined, not calculated */ #ifndef FIXED_POINT QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = G_filt * QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) + MUL_F(Q_filt, RE(V[fIndexNoise])); #else //QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_Q2(G_filt, QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx])) // + MUL_F(Q_filt, RE(V[fIndexNoise])); QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx])) + MUL_F(Q_filt, RE(V[fIndexNoise])); #endif if (sbr->bs_extension_id == 3 && sbr->bs_extension_data == 42) QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = 16428320; #ifndef SBR_LOW_POWER #ifndef FIXED_POINT QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = G_filt * QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) + MUL_F(Q_filt, IM(V[fIndexNoise])); #else //QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_Q2(G_filt, QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx])) // + MUL_F(Q_filt, IM(V[fIndexNoise])); QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx])) + MUL_F(Q_filt, IM(V[fIndexNoise])); #endif #endif { int8_t rev = (((m + sbr->kx) & 1) ? -1 : 1); QMF_RE(psi) = adj->S_M_boost[l][m] * phi_re[fIndexSine]; #ifdef FIXED_POINT QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += (QMF_RE(psi) << REAL_BITS); #else QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += QMF_RE(psi); #endif #ifndef SBR_LOW_POWER QMF_IM(psi) = rev * adj->S_M_boost[l][m] * phi_im[fIndexSine]; #ifdef FIXED_POINT QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += (QMF_IM(psi) << REAL_BITS); #else QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += QMF_IM(psi); #endif #else i_min1 = (fIndexSine - 1) & 3; i_plus1 = (fIndexSine + 1) & 3; #ifndef FIXED_POINT if ((m == 0) && (phi_re[i_plus1] != 0)) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) += (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][0], FRAC_CONST(0.00815))); if (sbr->M != 0) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][1], FRAC_CONST(0.00815))); } } if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0)) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m - 1], FRAC_CONST(0.00815))); } if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_plus1] != 0)) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][m + 1], FRAC_CONST(0.00815))); } if ((m == sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0)) { if (m > 0) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m - 1], FRAC_CONST(0.00815))); } if (m + sbr->kx < 64) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) += (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m], FRAC_CONST(0.00815))); } } #else if ((m == 0) && (phi_re[i_plus1] != 0)) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) += (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][0]<<REAL_BITS), FRAC_CONST(0.00815))); if (sbr->M != 0) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][1]<<REAL_BITS), FRAC_CONST(0.00815))); } } if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0)) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m - 1]<<REAL_BITS), FRAC_CONST(0.00815))); } if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_plus1] != 0)) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][m + 1]<<REAL_BITS), FRAC_CONST(0.00815))); } if ((m == sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0)) { if (m > 0) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m - 1]<<REAL_BITS), FRAC_CONST(0.00815))); } if (m + sbr->kx < 64) { QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) += (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m]<<REAL_BITS), FRAC_CONST(0.00815))); } } #endif if (adj->S_M_boost[l][m] != 0) sinusoids++; #endif } } fIndexSine = (fIndexSine + 1) & 3; /* update the ringbuffer index used for filtering G and Q with h_smooth */ sbr->GQ_ringbuf_index[ch]++; if (sbr->GQ_ringbuf_index[ch] >= 5) sbr->GQ_ringbuf_index[ch] = 0; } } sbr->index_noise_prev[ch] = fIndexNoise; sbr->psi_is_prev[ch] = fIndexSine; } #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/sbr_hfadj.h
C/C++ Header
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_hfadj.h,v 1.19 2007/11/01 12:33:35 menno Exp $ **/ #ifndef __SBR_HFADJ_H__ #define __SBR_HFADJ_H__ #ifdef __cplusplus extern "C" { #endif typedef struct { real_t G_lim_boost[MAX_L_E][MAX_M]; real_t Q_M_lim_boost[MAX_L_E][MAX_M]; real_t S_M_boost[MAX_L_E][MAX_M]; } sbr_hfadj_info; uint8_t hf_adjustment(sbr_info *sbr, qmf_t Xsbr[MAX_NTSRHFG][64] #ifdef SBR_LOW_POWER ,real_t *deg #endif ,uint8_t ch); #ifdef __cplusplus } #endif #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/sbr_hfgen.c
C
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_hfgen.c,v 1.26 2007/11/01 12:33:35 menno Exp $ **/ /* High Frequency generation */ #include "common.h" #include "structs.h" #ifdef SBR_DEC #include "sbr_syntax.h" #include "sbr_hfgen.h" #include "sbr_fbt.h" /* static function declarations */ #ifdef SBR_LOW_POWER static void calc_prediction_coef_lp(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], complex_t *alpha_0, complex_t *alpha_1, real_t *rxx); static void calc_aliasing_degree(sbr_info *sbr, real_t *rxx, real_t *deg); #else static void calc_prediction_coef(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], complex_t *alpha_0, complex_t *alpha_1, uint8_t k); #endif static void calc_chirp_factors(sbr_info *sbr, uint8_t ch); static void patch_construction(sbr_info *sbr); void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], qmf_t Xhigh[MAX_NTSRHFG][64] #ifdef SBR_LOW_POWER ,real_t *deg #endif ,uint8_t ch) { uint8_t l, i, x; ALIGN complex_t alpha_0[64], alpha_1[64]; #ifdef SBR_LOW_POWER ALIGN real_t rxx[64]; #endif uint8_t offset = sbr->tHFAdj; uint8_t first = sbr->t_E[ch][0]; uint8_t last = sbr->t_E[ch][sbr->L_E[ch]]; calc_chirp_factors(sbr, ch); #ifdef SBR_LOW_POWER memset(deg, 0, 64*sizeof(real_t)); #endif if ((ch == 0) && (sbr->Reset)) patch_construction(sbr); /* calculate the prediction coefficients */ #ifdef SBR_LOW_POWER calc_prediction_coef_lp(sbr, Xlow, alpha_0, alpha_1, rxx); calc_aliasing_degree(sbr, rxx, deg); #endif /* actual HF generation */ for (i = 0; i < sbr->noPatches; i++) { for (x = 0; x < sbr->patchNoSubbands[i]; x++) { real_t a0_r, a0_i, a1_r, a1_i; real_t bw, bw2; uint8_t q, p, k, g; /* find the low and high band for patching */ k = sbr->kx + x; for (q = 0; q < i; q++) { k += sbr->patchNoSubbands[q]; } p = sbr->patchStartSubband[i] + x; #ifdef SBR_LOW_POWER if (x != 0 /*x < sbr->patchNoSubbands[i]-1*/) deg[k] = deg[p]; else deg[k] = 0; #endif g = sbr->table_map_k_to_g[k]; bw = sbr->bwArray[ch][g]; bw2 = MUL_C(bw, bw); /* do the patching */ /* with or without filtering */ if (bw2 > 0) { real_t temp1_r, temp2_r, temp3_r; #ifndef SBR_LOW_POWER real_t temp1_i, temp2_i, temp3_i; calc_prediction_coef(sbr, Xlow, alpha_0, alpha_1, p); #endif a0_r = MUL_C(RE(alpha_0[p]), bw); a1_r = MUL_C(RE(alpha_1[p]), bw2); #ifndef SBR_LOW_POWER a0_i = MUL_C(IM(alpha_0[p]), bw); a1_i = MUL_C(IM(alpha_1[p]), bw2); #endif temp2_r = QMF_RE(Xlow[first - 2 + offset][p]); temp3_r = QMF_RE(Xlow[first - 1 + offset][p]); #ifndef SBR_LOW_POWER temp2_i = QMF_IM(Xlow[first - 2 + offset][p]); temp3_i = QMF_IM(Xlow[first - 1 + offset][p]); #endif for (l = first; l < last; l++) { temp1_r = temp2_r; temp2_r = temp3_r; temp3_r = QMF_RE(Xlow[l + offset][p]); #ifndef SBR_LOW_POWER temp1_i = temp2_i; temp2_i = temp3_i; temp3_i = QMF_IM(Xlow[l + offset][p]); #endif #ifdef SBR_LOW_POWER QMF_RE(Xhigh[l + offset][k]) = temp3_r +(MUL_R(a0_r, temp2_r) + MUL_R(a1_r, temp1_r)); #else QMF_RE(Xhigh[l + offset][k]) = temp3_r +(MUL_R(a0_r, temp2_r) - MUL_R(a0_i, temp2_i) + MUL_R(a1_r, temp1_r) - MUL_R(a1_i, temp1_i)); QMF_IM(Xhigh[l + offset][k]) = temp3_i +(MUL_R(a0_i, temp2_r) + MUL_R(a0_r, temp2_i) + MUL_R(a1_i, temp1_r) + MUL_R(a1_r, temp1_i)); #endif } } else { for (l = first; l < last; l++) { QMF_RE(Xhigh[l + offset][k]) = QMF_RE(Xlow[l + offset][p]); #ifndef SBR_LOW_POWER QMF_IM(Xhigh[l + offset][k]) = QMF_IM(Xlow[l + offset][p]); #endif } } } } if (sbr->Reset) { limiter_frequency_table(sbr); } } typedef struct { complex_t r01; complex_t r02; complex_t r11; complex_t r12; complex_t r22; real_t det; } acorr_coef; #ifdef SBR_LOW_POWER static void auto_correlation(sbr_info *sbr, acorr_coef *ac, qmf_t buffer[MAX_NTSRHFG][64], uint8_t bd, uint8_t len) { real_t r01 = 0, r02 = 0, r11 = 0; int8_t j; uint8_t offset = sbr->tHFAdj; #ifdef FIXED_POINT const real_t rel = FRAC_CONST(0.999999); // 1 / (1 + 1e-6f); uint32_t maxi = 0; uint32_t pow2, exp; #else const real_t rel = 1 / (1 + 1e-6f); #endif #ifdef FIXED_POINT mask = 0; for (j = (offset-2); j < (len + offset); j++) { real_t x; x = QMF_RE(buffer[j][bd])>>REAL_BITS; mask |= x ^ (x >> 31); } exp = wl_min_lzc(mask); /* improves accuracy */ if (exp > 0) exp -= 1; for (j = offset; j < len + offset; j++) { real_t buf_j = ((QMF_RE(buffer[j][bd])+(1<<(exp-1)))>>exp); real_t buf_j_1 = ((QMF_RE(buffer[j-1][bd])+(1<<(exp-1)))>>exp); real_t buf_j_2 = ((QMF_RE(buffer[j-2][bd])+(1<<(exp-1)))>>exp); /* normalisation with rounding */ r01 += MUL_R(buf_j, buf_j_1); r02 += MUL_R(buf_j, buf_j_2); r11 += MUL_R(buf_j_1, buf_j_1); } RE(ac->r12) = r01 - MUL_R(((QMF_RE(buffer[len+offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp)) + MUL_R(((QMF_RE(buffer[offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp)); RE(ac->r22) = r11 - MUL_R(((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp)) + MUL_R(((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp)); #else for (j = offset; j < len + offset; j++) { r01 += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-1][bd]); r02 += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-2][bd]); r11 += QMF_RE(buffer[j-1][bd]) * QMF_RE(buffer[j-1][bd]); } RE(ac->r12) = r01 - QMF_RE(buffer[len+offset-1][bd]) * QMF_RE(buffer[len+offset-2][bd]) + QMF_RE(buffer[offset-1][bd]) * QMF_RE(buffer[offset-2][bd]); RE(ac->r22) = r11 - QMF_RE(buffer[len+offset-2][bd]) * QMF_RE(buffer[len+offset-2][bd]) + QMF_RE(buffer[offset-2][bd]) * QMF_RE(buffer[offset-2][bd]); #endif RE(ac->r01) = r01; RE(ac->r02) = r02; RE(ac->r11) = r11; ac->det = MUL_R(RE(ac->r11), RE(ac->r22)) - MUL_F(MUL_R(RE(ac->r12), RE(ac->r12)), rel); } #else static void auto_correlation(sbr_info *sbr, acorr_coef *ac, qmf_t buffer[MAX_NTSRHFG][64], uint8_t bd, uint8_t len) { real_t r01r = 0, r01i = 0, r02r = 0, r02i = 0, r11r = 0; real_t temp1_r, temp1_i, temp2_r, temp2_i, temp3_r, temp3_i, temp4_r, temp4_i, temp5_r, temp5_i; #ifdef FIXED_POINT const real_t rel = FRAC_CONST(0.999999); // 1 / (1 + 1e-6f); uint32_t mask, exp; real_t pow2_to_exp; #else const real_t rel = 1 / (1 + 1e-6f); #endif int8_t j; uint8_t offset = sbr->tHFAdj; #ifdef FIXED_POINT mask = 0; for (j = (offset-2); j < (len + offset); j++) { real_t x; x = QMF_RE(buffer[j][bd])>>REAL_BITS; mask |= x ^ (x >> 31); x = QMF_IM(buffer[j][bd])>>REAL_BITS; mask |= x ^ (x >> 31); } exp = wl_min_lzc(mask); /* improves accuracy */ if (exp > 0) exp -= 1; pow2_to_exp = 1<<(exp-1); temp2_r = (QMF_RE(buffer[offset-2][bd]) + pow2_to_exp) >> exp; temp2_i = (QMF_IM(buffer[offset-2][bd]) + pow2_to_exp) >> exp; temp3_r = (QMF_RE(buffer[offset-1][bd]) + pow2_to_exp) >> exp; temp3_i = (QMF_IM(buffer[offset-1][bd]) + pow2_to_exp) >> exp; // Save these because they are needed after loop temp4_r = temp2_r; temp4_i = temp2_i; temp5_r = temp3_r; temp5_i = temp3_i; for (j = offset; j < len + offset; j++) { temp1_r = temp2_r; // temp1_r = (QMF_RE(buffer[offset-2][bd] + (1<<(exp-1))) >> exp; temp1_i = temp2_i; // temp1_i = (QMF_IM(buffer[offset-2][bd] + (1<<(exp-1))) >> exp; temp2_r = temp3_r; // temp2_r = (QMF_RE(buffer[offset-1][bd] + (1<<(exp-1))) >> exp; temp2_i = temp3_i; // temp2_i = (QMF_IM(buffer[offset-1][bd] + (1<<(exp-1))) >> exp; temp3_r = (QMF_RE(buffer[j][bd]) + pow2_to_exp) >> exp; temp3_i = (QMF_IM(buffer[j][bd]) + pow2_to_exp) >> exp; r01r += MUL_R(temp3_r, temp2_r) + MUL_R(temp3_i, temp2_i); r01i += MUL_R(temp3_i, temp2_r) - MUL_R(temp3_r, temp2_i); r02r += MUL_R(temp3_r, temp1_r) + MUL_R(temp3_i, temp1_i); r02i += MUL_R(temp3_i, temp1_r) - MUL_R(temp3_r, temp1_i); r11r += MUL_R(temp2_r, temp2_r) + MUL_R(temp2_i, temp2_i); } // These are actual values in temporary variable at this point // temp1_r = (QMF_RE(buffer[len+offset-1-2][bd] + (1<<(exp-1))) >> exp; // temp1_i = (QMF_IM(buffer[len+offset-1-2][bd] + (1<<(exp-1))) >> exp; // temp2_r = (QMF_RE(buffer[len+offset-1-1][bd] + (1<<(exp-1))) >> exp; // temp2_i = (QMF_IM(buffer[len+offset-1-1][bd] + (1<<(exp-1))) >> exp; // temp3_r = (QMF_RE(buffer[len+offset-1][bd]) + (1<<(exp-1))) >> exp; // temp3_i = (QMF_IM(buffer[len+offset-1][bd]) + (1<<(exp-1))) >> exp; // temp4_r = (QMF_RE(buffer[offset-2][bd]) + (1<<(exp-1))) >> exp; // temp4_i = (QMF_IM(buffer[offset-2][bd]) + (1<<(exp-1))) >> exp; // temp5_r = (QMF_RE(buffer[offset-1][bd]) + (1<<(exp-1))) >> exp; // temp5_i = (QMF_IM(buffer[offset-1][bd]) + (1<<(exp-1))) >> exp; RE(ac->r12) = r01r - (MUL_R(temp3_r, temp2_r) + MUL_R(temp3_i, temp2_i)) + (MUL_R(temp5_r, temp4_r) + MUL_R(temp5_i, temp4_i)); IM(ac->r12) = r01i - (MUL_R(temp3_i, temp2_r) - MUL_R(temp3_r, temp2_i)) + (MUL_R(temp5_i, temp4_r) - MUL_R(temp5_r, temp4_i)); RE(ac->r22) = r11r - (MUL_R(temp2_r, temp2_r) + MUL_R(temp2_i, temp2_i)) + (MUL_R(temp4_r, temp4_r) + MUL_R(temp4_i, temp4_i)); #else temp2_r = QMF_RE(buffer[offset-2][bd]); temp2_i = QMF_IM(buffer[offset-2][bd]); temp3_r = QMF_RE(buffer[offset-1][bd]); temp3_i = QMF_IM(buffer[offset-1][bd]); // Save these because they are needed after loop temp4_r = temp2_r; temp4_i = temp2_i; temp5_r = temp3_r; temp5_i = temp3_i; for (j = offset; j < len + offset; j++) { temp1_r = temp2_r; // temp1_r = QMF_RE(buffer[j-2][bd]; temp1_i = temp2_i; // temp1_i = QMF_IM(buffer[j-2][bd]; temp2_r = temp3_r; // temp2_r = QMF_RE(buffer[j-1][bd]; temp2_i = temp3_i; // temp2_i = QMF_IM(buffer[j-1][bd]; temp3_r = QMF_RE(buffer[j][bd]); temp3_i = QMF_IM(buffer[j][bd]); r01r += temp3_r * temp2_r + temp3_i * temp2_i; r01i += temp3_i * temp2_r - temp3_r * temp2_i; r02r += temp3_r * temp1_r + temp3_i * temp1_i; r02i += temp3_i * temp1_r - temp3_r * temp1_i; r11r += temp2_r * temp2_r + temp2_i * temp2_i; } // These are actual values in temporary variable at this point // temp1_r = QMF_RE(buffer[len+offset-1-2][bd]; // temp1_i = QMF_IM(buffer[len+offset-1-2][bd]; // temp2_r = QMF_RE(buffer[len+offset-1-1][bd]; // temp2_i = QMF_IM(buffer[len+offset-1-1][bd]; // temp3_r = QMF_RE(buffer[len+offset-1][bd]); // temp3_i = QMF_IM(buffer[len+offset-1][bd]); // temp4_r = QMF_RE(buffer[offset-2][bd]); // temp4_i = QMF_IM(buffer[offset-2][bd]); // temp5_r = QMF_RE(buffer[offset-1][bd]); // temp5_i = QMF_IM(buffer[offset-1][bd]); RE(ac->r12) = r01r - (temp3_r * temp2_r + temp3_i * temp2_i) + (temp5_r * temp4_r + temp5_i * temp4_i); IM(ac->r12) = r01i - (temp3_i * temp2_r - temp3_r * temp2_i) + (temp5_i * temp4_r - temp5_r * temp4_i); RE(ac->r22) = r11r - (temp2_r * temp2_r + temp2_i * temp2_i) + (temp4_r * temp4_r + temp4_i * temp4_i); #endif RE(ac->r01) = r01r; IM(ac->r01) = r01i; RE(ac->r02) = r02r; IM(ac->r02) = r02i; RE(ac->r11) = r11r; ac->det = MUL_R(RE(ac->r11), RE(ac->r22)) - MUL_F(rel, (MUL_R(RE(ac->r12), RE(ac->r12)) + MUL_R(IM(ac->r12), IM(ac->r12)))); } #endif /* calculate linear prediction coefficients using the covariance method */ #ifndef SBR_LOW_POWER static void calc_prediction_coef(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], complex_t *alpha_0, complex_t *alpha_1, uint8_t k) { real_t tmp; acorr_coef ac; auto_correlation(sbr, &ac, Xlow, k, sbr->numTimeSlotsRate + 6); if (ac.det == 0) { RE(alpha_1[k]) = 0; IM(alpha_1[k]) = 0; } else { #ifdef FIXED_POINT tmp = (MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(IM(ac.r01), IM(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11))); RE(alpha_1[k]) = DIV_R(tmp, ac.det); tmp = (MUL_R(IM(ac.r01), RE(ac.r12)) + MUL_R(RE(ac.r01), IM(ac.r12)) - MUL_R(IM(ac.r02), RE(ac.r11))); IM(alpha_1[k]) = DIV_R(tmp, ac.det); #else tmp = REAL_CONST(1.0) / ac.det; RE(alpha_1[k]) = (MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(IM(ac.r01), IM(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11))) * tmp; IM(alpha_1[k]) = (MUL_R(IM(ac.r01), RE(ac.r12)) + MUL_R(RE(ac.r01), IM(ac.r12)) - MUL_R(IM(ac.r02), RE(ac.r11))) * tmp; #endif } if (RE(ac.r11) == 0) { RE(alpha_0[k]) = 0; IM(alpha_0[k]) = 0; } else { #ifdef FIXED_POINT tmp = -(RE(ac.r01) + MUL_R(RE(alpha_1[k]), RE(ac.r12)) + MUL_R(IM(alpha_1[k]), IM(ac.r12))); RE(alpha_0[k]) = DIV_R(tmp, RE(ac.r11)); tmp = -(IM(ac.r01) + MUL_R(IM(alpha_1[k]), RE(ac.r12)) - MUL_R(RE(alpha_1[k]), IM(ac.r12))); IM(alpha_0[k]) = DIV_R(tmp, RE(ac.r11)); #else tmp = 1.0f / RE(ac.r11); RE(alpha_0[k]) = -(RE(ac.r01) + MUL_R(RE(alpha_1[k]), RE(ac.r12)) + MUL_R(IM(alpha_1[k]), IM(ac.r12))) * tmp; IM(alpha_0[k]) = -(IM(ac.r01) + MUL_R(IM(alpha_1[k]), RE(ac.r12)) - MUL_R(RE(alpha_1[k]), IM(ac.r12))) * tmp; #endif } if ((MUL_R(RE(alpha_0[k]),RE(alpha_0[k])) + MUL_R(IM(alpha_0[k]),IM(alpha_0[k])) >= REAL_CONST(16)) || (MUL_R(RE(alpha_1[k]),RE(alpha_1[k])) + MUL_R(IM(alpha_1[k]),IM(alpha_1[k])) >= REAL_CONST(16))) { RE(alpha_0[k]) = 0; IM(alpha_0[k]) = 0; RE(alpha_1[k]) = 0; IM(alpha_1[k]) = 0; } } #else static void calc_prediction_coef_lp(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], complex_t *alpha_0, complex_t *alpha_1, real_t *rxx) { uint8_t k; real_t tmp; acorr_coef ac; for (k = 1; k < sbr->f_master[0]; k++) { auto_correlation(sbr, &ac, Xlow, k, sbr->numTimeSlotsRate + 6); if (ac.det == 0) { RE(alpha_0[k]) = 0; RE(alpha_1[k]) = 0; } else { tmp = MUL_R(RE(ac.r01), RE(ac.r22)) - MUL_R(RE(ac.r12), RE(ac.r02)); RE(alpha_0[k]) = DIV_R(tmp, (-ac.det)); tmp = MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11)); RE(alpha_1[k]) = DIV_R(tmp, ac.det); } if ((RE(alpha_0[k]) >= REAL_CONST(4)) || (RE(alpha_1[k]) >= REAL_CONST(4))) { RE(alpha_0[k]) = REAL_CONST(0); RE(alpha_1[k]) = REAL_CONST(0); } /* reflection coefficient */ if (RE(ac.r11) == 0) { rxx[k] = COEF_CONST(0.0); } else { rxx[k] = DIV_C(RE(ac.r01), RE(ac.r11)); rxx[k] = -rxx[k]; if (rxx[k] > COEF_CONST(1.0)) rxx[k] = COEF_CONST(1.0); if (rxx[k] < COEF_CONST(-1.0)) rxx[k] = COEF_CONST(-1.0); } } } static void calc_aliasing_degree(sbr_info *sbr, real_t *rxx, real_t *deg) { uint8_t k; rxx[0] = COEF_CONST(0.0); deg[1] = COEF_CONST(0.0); for (k = 2; k < sbr->k0; k++) { deg[k] = 0.0; if ((k % 2 == 0) && (rxx[k] < COEF_CONST(0.0))) { if (rxx[k-1] < 0.0) { deg[k] = COEF_CONST(1.0); if (rxx[k-2] > COEF_CONST(0.0)) { deg[k-1] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]); } } else if (rxx[k-2] > COEF_CONST(0.0)) { deg[k] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]); } } if ((k % 2 == 1) && (rxx[k] > COEF_CONST(0.0))) { if (rxx[k-1] > COEF_CONST(0.0)) { deg[k] = COEF_CONST(1.0); if (rxx[k-2] < COEF_CONST(0.0)) { deg[k-1] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]); } } else if (rxx[k-2] < COEF_CONST(0.0)) { deg[k] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]); } } } } #endif /* FIXED POINT: bwArray = COEF */ static real_t mapNewBw(uint8_t invf_mode, uint8_t invf_mode_prev) { switch (invf_mode) { case 1: /* LOW */ if (invf_mode_prev == 0) /* NONE */ return COEF_CONST(0.6); else return COEF_CONST(0.75); case 2: /* MID */ return COEF_CONST(0.9); case 3: /* HIGH */ return COEF_CONST(0.98); default: /* NONE */ if (invf_mode_prev == 1) /* LOW */ return COEF_CONST(0.6); else return COEF_CONST(0.0); } } /* FIXED POINT: bwArray = COEF */ static void calc_chirp_factors(sbr_info *sbr, uint8_t ch) { uint8_t i; for (i = 0; i < sbr->N_Q; i++) { sbr->bwArray[ch][i] = mapNewBw(sbr->bs_invf_mode[ch][i], sbr->bs_invf_mode_prev[ch][i]); if (sbr->bwArray[ch][i] < sbr->bwArray_prev[ch][i]) sbr->bwArray[ch][i] = MUL_F(sbr->bwArray[ch][i], FRAC_CONST(0.75)) + MUL_F(sbr->bwArray_prev[ch][i], FRAC_CONST(0.25)); else sbr->bwArray[ch][i] = MUL_F(sbr->bwArray[ch][i], FRAC_CONST(0.90625)) + MUL_F(sbr->bwArray_prev[ch][i], FRAC_CONST(0.09375)); if (sbr->bwArray[ch][i] < COEF_CONST(0.015625)) sbr->bwArray[ch][i] = COEF_CONST(0.0); if (sbr->bwArray[ch][i] >= COEF_CONST(0.99609375)) sbr->bwArray[ch][i] = COEF_CONST(0.99609375); sbr->bwArray_prev[ch][i] = sbr->bwArray[ch][i]; sbr->bs_invf_mode_prev[ch][i] = sbr->bs_invf_mode[ch][i]; } } static void patch_construction(sbr_info *sbr) { uint8_t i, k; uint8_t odd, sb; uint8_t msb = sbr->k0; uint8_t usb = sbr->kx; uint8_t goalSbTab[] = { 21, 23, 32, 43, 46, 64, 85, 93, 128, 0, 0, 0 }; /* (uint8_t)(2.048e6/sbr->sample_rate + 0.5); */ uint8_t goalSb = goalSbTab[get_sr_index(sbr->sample_rate)]; sbr->noPatches = 0; if (goalSb < (sbr->kx + sbr->M)) { for (i = 0, k = 0; sbr->f_master[i] < goalSb; i++) k = i+1; } else { k = sbr->N_master; } if (sbr->N_master == 0) { sbr->noPatches = 0; sbr->patchNoSubbands[0] = 0; sbr->patchStartSubband[0] = 0; return; } do { uint8_t j = k + 1; do { j--; sb = sbr->f_master[j]; odd = (sb - 2 + sbr->k0) % 2; } while (sb > (sbr->k0 - 1 + msb - odd)); sbr->patchNoSubbands[sbr->noPatches] = max(sb - usb, 0); sbr->patchStartSubband[sbr->noPatches] = sbr->k0 - odd - sbr->patchNoSubbands[sbr->noPatches]; if (sbr->patchNoSubbands[sbr->noPatches] > 0) { usb = sb; msb = sb; sbr->noPatches++; } else { msb = sbr->kx; } if (sbr->f_master[k] - sb < 3) k = sbr->N_master; } while (sb != (sbr->kx + sbr->M)); if ((sbr->patchNoSubbands[sbr->noPatches-1] < 3) && (sbr->noPatches > 1)) { sbr->noPatches--; } sbr->noPatches = min(sbr->noPatches, 5); } #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/sbr_hfgen.h
C/C++ Header
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_hfgen.h,v 1.20 2007/11/01 12:33:35 menno Exp $ **/ #ifndef __SBR_HFGEN_H__ #define __SBR_HFGEN_H__ #ifdef __cplusplus extern "C" { #endif void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], qmf_t Xhigh[MAX_NTSRHFG][64] #ifdef SBR_LOW_POWER ,real_t *deg #endif ,uint8_t ch); #ifdef __cplusplus } #endif #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/sbr_huff.c
C
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_huff.c,v 1.21 2007/11/01 12:33:35 menno Exp $ **/ #include "common.h" #include "structs.h" #ifdef SBR_DEC #include "sbr_syntax.h" #include "bits.h" #include "sbr_huff.h" #include "sbr_e_nf.h" typedef const int8_t (*sbr_huff_tab)[2]; static const int8_t t_huffman_env_1_5dB[120][2] = { { 1, 2 }, { -64, -65 }, { 3, 4 }, { -63, -66 }, { 5, 6 }, { -62, -67 }, { 7, 8 }, { -61, -68 }, { 9, 10 }, { -60, -69 }, { 11, 12 }, { -59, -70 }, { 13, 14 }, { -58, -71 }, { 15, 16 }, { -57, -72 }, { 17, 18 }, { -73, -56 }, { 19, 21 }, { -74, 20 }, { -55, -75 }, { 22, 26 }, { 23, 24 }, { -54, -76 }, { -77, 25 }, { -53, -78 }, { 27, 34 }, { 28, 29 }, { -52, -79 }, { 30, 31 }, { -80, -51 }, { 32, 33 }, { -83, -82 }, { -81, -50 }, { 35, 57 }, { 36, 40 }, { 37, 38 }, { -88, -84 }, { -48, 39 }, { -90, -85 }, { 41, 46 }, { 42, 43 }, { -49, -87 }, { 44, 45 }, { -89, -86 }, {-124,-123 }, { 47, 50 }, { 48, 49 }, {-122,-121 }, {-120,-119 }, { 51, 54 }, { 52, 53 }, {-118,-117 }, {-116,-115 }, { 55, 56 }, {-114,-113 }, {-112,-111 }, { 58, 89 }, { 59, 74 }, { 60, 67 }, { 61, 64 }, { 62, 63 }, {-110,-109 }, {-108,-107 }, { 65, 66 }, {-106,-105 }, {-104,-103 }, { 68, 71 }, { 69, 70 }, {-102,-101 }, {-100, -99 }, { 72, 73 }, { -98, -97 }, { -96, -95 }, { 75, 82 }, { 76, 79 }, { 77, 78 }, { -94, -93 }, { -92, -91 }, { 80, 81 }, { -47, -46 }, { -45, -44 }, { 83, 86 }, { 84, 85 }, { -43, -42 }, { -41, -40 }, { 87, 88 }, { -39, -38 }, { -37, -36 }, { 90, 105 }, { 91, 98 }, { 92, 95 }, { 93, 94 }, { -35, -34 }, { -33, -32 }, { 96, 97 }, { -31, -30 }, { -29, -28 }, { 99, 102 }, { 100, 101 }, { -27, -26 }, { -25, -24 }, { 103, 104 }, { -23, -22 }, { -21, -20 }, { 106, 113 }, { 107, 110 }, { 108, 109 }, { -19, -18 }, { -17, -16 }, { 111, 112 }, { -15, -14 }, { -13, -12 }, { 114, 117 }, { 115, 116 }, { -11, -10 }, { -9, -8 }, { 118, 119 }, { -7, -6 }, { -5, -4 } }; static const int8_t f_huffman_env_1_5dB[120][2] = { { 1, 2 }, { -64, -65 }, { 3, 4 }, { -63, -66 }, { 5, 6 }, { -67, -62 }, { 7, 8 }, { -68, -61 }, { 9, 10 }, { -69, -60 }, { 11, 13 }, { -70, 12 }, { -59, -71 }, { 14, 16 }, { -58, 15 }, { -72, -57 }, { 17, 19 }, { -73, 18 }, { -56, -74 }, { 20, 23 }, { 21, 22 }, { -55, -75 }, { -54, -53 }, { 24, 27 }, { 25, 26 }, { -76, -52 }, { -77, -51 }, { 28, 31 }, { 29, 30 }, { -50, -78 }, { -79, -49 }, { 32, 36 }, { 33, 34 }, { -48, -47 }, { -80, 35 }, { -81, -82 }, { 37, 47 }, { 38, 41 }, { 39, 40 }, { -83, -46 }, { -45, -84 }, { 42, 44 }, { -85, 43 }, { -44, -43 }, { 45, 46 }, { -88, -87 }, { -86, -90 }, { 48, 66 }, { 49, 56 }, { 50, 53 }, { 51, 52 }, { -92, -42 }, { -41, -39 }, { 54, 55 }, {-105, -89 }, { -38, -37 }, { 57, 60 }, { 58, 59 }, { -94, -91 }, { -40, -36 }, { 61, 63 }, { -20, 62 }, {-115,-110 }, { 64, 65 }, {-108,-107 }, {-101, -97 }, { 67, 89 }, { 68, 75 }, { 69, 72 }, { 70, 71 }, { -95, -93 }, { -34, -27 }, { 73, 74 }, { -22, -17 }, { -16,-124 }, { 76, 82 }, { 77, 79 }, {-123, 78 }, {-122,-121 }, { 80, 81 }, {-120,-119 }, {-118,-117 }, { 83, 86 }, { 84, 85 }, {-116,-114 }, {-113,-112 }, { 87, 88 }, {-111,-109 }, {-106,-104 }, { 90, 105 }, { 91, 98 }, { 92, 95 }, { 93, 94 }, {-103,-102 }, {-100, -99 }, { 96, 97 }, { -98, -96 }, { -35, -33 }, { 99, 102 }, { 100, 101 }, { -32, -31 }, { -30, -29 }, { 103, 104 }, { -28, -26 }, { -25, -24 }, { 106, 113 }, { 107, 110 }, { 108, 109 }, { -23, -21 }, { -19, -18 }, { 111, 112 }, { -15, -14 }, { -13, -12 }, { 114, 117 }, { 115, 116 }, { -11, -10 }, { -9, -8 }, { 118, 119 }, { -7, -6 }, { -5, -4 } }; static const int8_t t_huffman_env_bal_1_5dB[48][2] = { { -64, 1 }, { -63, 2 }, { -65, 3 }, { -62, 4 }, { -66, 5 }, { -61, 6 }, { -67, 7 }, { -60, 8 }, { -68, 9 }, { 10, 11 }, { -69, -59 }, { 12, 13 }, { -70, -58 }, { 14, 28 }, { 15, 21 }, { 16, 18 }, { -57, 17 }, { -71, -56 }, { 19, 20 }, { -88, -87 }, { -86, -85 }, { 22, 25 }, { 23, 24 }, { -84, -83 }, { -82, -81 }, { 26, 27 }, { -80, -79 }, { -78, -77 }, { 29, 36 }, { 30, 33 }, { 31, 32 }, { -76, -75 }, { -74, -73 }, { 34, 35 }, { -72, -55 }, { -54, -53 }, { 37, 41 }, { 38, 39 }, { -52, -51 }, { -50, 40 }, { -49, -48 }, { 42, 45 }, { 43, 44 }, { -47, -46 }, { -45, -44 }, { 46, 47 }, { -43, -42 }, { -41, -40 } }; static const int8_t f_huffman_env_bal_1_5dB[48][2] = { { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 }, { -60, 9 }, { 10, 11 }, { -69, -59 }, { -70, 12 }, { -58, 13 }, { 14, 17 }, { -71, 15 }, { -57, 16 }, { -56, -73 }, { 18, 32 }, { 19, 25 }, { 20, 22 }, { -72, 21 }, { -88, -87 }, { 23, 24 }, { -86, -85 }, { -84, -83 }, { 26, 29 }, { 27, 28 }, { -82, -81 }, { -80, -79 }, { 30, 31 }, { -78, -77 }, { -76, -75 }, { 33, 40 }, { 34, 37 }, { 35, 36 }, { -74, -55 }, { -54, -53 }, { 38, 39 }, { -52, -51 }, { -50, -49 }, { 41, 44 }, { 42, 43 }, { -48, -47 }, { -46, -45 }, { 45, 46 }, { -44, -43 }, { -42, 47 }, { -41, -40 } }; static const int8_t t_huffman_env_3_0dB[62][2] = { { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, { -62, 5 }, { -67, 6 }, { -61, 7 }, { -68, 8 }, { -60, 9 }, { 10, 11 }, { -69, -59 }, { 12, 14 }, { -70, 13 }, { -71, -58 }, { 15, 18 }, { 16, 17 }, { -72, -57 }, { -73, -74 }, { 19, 22 }, { -56, 20 }, { -55, 21 }, { -54, -77 }, { 23, 31 }, { 24, 25 }, { -75, -76 }, { 26, 27 }, { -78, -53 }, { 28, 29 }, { -52, -95 }, { -94, 30 }, { -93, -92 }, { 32, 47 }, { 33, 40 }, { 34, 37 }, { 35, 36 }, { -91, -90 }, { -89, -88 }, { 38, 39 }, { -87, -86 }, { -85, -84 }, { 41, 44 }, { 42, 43 }, { -83, -82 }, { -81, -80 }, { 45, 46 }, { -79, -51 }, { -50, -49 }, { 48, 55 }, { 49, 52 }, { 50, 51 }, { -48, -47 }, { -46, -45 }, { 53, 54 }, { -44, -43 }, { -42, -41 }, { 56, 59 }, { 57, 58 }, { -40, -39 }, { -38, -37 }, { 60, 61 }, { -36, -35 }, { -34, -33 } }; static const int8_t f_huffman_env_3_0dB[62][2] = { { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, { -62, 5 }, { -67, 6 }, { 7, 8 }, { -61, -68 }, { 9, 10 }, { -60, -69 }, { 11, 12 }, { -59, -70 }, { 13, 14 }, { -58, -71 }, { 15, 16 }, { -57, -72 }, { 17, 19 }, { -56, 18 }, { -55, -73 }, { 20, 24 }, { 21, 22 }, { -74, -54 }, { -53, 23 }, { -75, -76 }, { 25, 30 }, { 26, 27 }, { -52, -51 }, { 28, 29 }, { -77, -79 }, { -50, -49 }, { 31, 39 }, { 32, 35 }, { 33, 34 }, { -78, -46 }, { -82, -88 }, { 36, 37 }, { -83, -48 }, { -47, 38 }, { -86, -85 }, { 40, 47 }, { 41, 44 }, { 42, 43 }, { -80, -44 }, { -43, -42 }, { 45, 46 }, { -39, -87 }, { -84, -40 }, { 48, 55 }, { 49, 52 }, { 50, 51 }, { -95, -94 }, { -93, -92 }, { 53, 54 }, { -91, -90 }, { -89, -81 }, { 56, 59 }, { 57, 58 }, { -45, -41 }, { -38, -37 }, { 60, 61 }, { -36, -35 }, { -34, -33 } }; static const int8_t t_huffman_env_bal_3_0dB[24][2] = { { -64, 1 }, { -63, 2 }, { -65, 3 }, { -66, 4 }, { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 }, { -60, 9 }, { 10, 16 }, { 11, 13 }, { -69, 12 }, { -76, -75 }, { 14, 15 }, { -74, -73 }, { -72, -71 }, { 17, 20 }, { 18, 19 }, { -70, -59 }, { -58, -57 }, { 21, 22 }, { -56, -55 }, { -54, 23 }, { -53, -52 } }; static const int8_t f_huffman_env_bal_3_0dB[24][2] = { { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 }, { -60, 9 }, { 10, 13 }, { -69, 11 }, { -59, 12 }, { -58, -76 }, { 14, 17 }, { 15, 16 }, { -75, -74 }, { -73, -72 }, { 18, 21 }, { 19, 20 }, { -71, -70 }, { -57, -56 }, { 22, 23 }, { -55, -54 }, { -53, -52 } }; static const int8_t t_huffman_noise_3_0dB[62][2] = { { -64, 1 }, { -63, 2 }, { -65, 3 }, { -66, 4 }, { -62, 5 }, { -67, 6 }, { 7, 8 }, { -61, -68 }, { 9, 30 }, { 10, 15 }, { -60, 11 }, { -69, 12 }, { 13, 14 }, { -59, -53 }, { -95, -94 }, { 16, 23 }, { 17, 20 }, { 18, 19 }, { -93, -92 }, { -91, -90 }, { 21, 22 }, { -89, -88 }, { -87, -86 }, { 24, 27 }, { 25, 26 }, { -85, -84 }, { -83, -82 }, { 28, 29 }, { -81, -80 }, { -79, -78 }, { 31, 46 }, { 32, 39 }, { 33, 36 }, { 34, 35 }, { -77, -76 }, { -75, -74 }, { 37, 38 }, { -73, -72 }, { -71, -70 }, { 40, 43 }, { 41, 42 }, { -58, -57 }, { -56, -55 }, { 44, 45 }, { -54, -52 }, { -51, -50 }, { 47, 54 }, { 48, 51 }, { 49, 50 }, { -49, -48 }, { -47, -46 }, { 52, 53 }, { -45, -44 }, { -43, -42 }, { 55, 58 }, { 56, 57 }, { -41, -40 }, { -39, -38 }, { 59, 60 }, { -37, -36 }, { -35, 61 }, { -34, -33 } }; static const int8_t t_huffman_noise_bal_3_0dB[24][2] = { { -64, 1 }, { -65, 2 }, { -63, 3 }, { 4, 9 }, { -66, 5 }, { -62, 6 }, { 7, 8 }, { -76, -75 }, { -74, -73 }, { 10, 17 }, { 11, 14 }, { 12, 13 }, { -72, -71 }, { -70, -69 }, { 15, 16 }, { -68, -67 }, { -61, -60 }, { 18, 21 }, { 19, 20 }, { -59, -58 }, { -57, -56 }, { 22, 23 }, { -55, -54 }, { -53, -52 } }; static INLINE int16_t sbr_huff_dec(bitfile *ld, sbr_huff_tab t_huff) { uint8_t bit; int16_t index = 0; while (index >= 0) { bit = (uint8_t)faad_get1bit(ld); index = t_huff[index][bit]; } return index + 64; } /* table 10 */ void sbr_envelope(bitfile *ld, sbr_info *sbr, uint8_t ch) { uint8_t env, band; int8_t delta = 0; sbr_huff_tab t_huff, f_huff; if ((sbr->L_E[ch] == 1) && (sbr->bs_frame_class[ch] == FIXFIX)) sbr->amp_res[ch] = 0; else sbr->amp_res[ch] = sbr->bs_amp_res; if ((sbr->bs_coupling) && (ch == 1)) { delta = 1; if (sbr->amp_res[ch]) { t_huff = t_huffman_env_bal_3_0dB; f_huff = f_huffman_env_bal_3_0dB; } else { t_huff = t_huffman_env_bal_1_5dB; f_huff = f_huffman_env_bal_1_5dB; } } else { delta = 0; if (sbr->amp_res[ch]) { t_huff = t_huffman_env_3_0dB; f_huff = f_huffman_env_3_0dB; } else { t_huff = t_huffman_env_1_5dB; f_huff = f_huffman_env_1_5dB; } } for (env = 0; env < sbr->L_E[ch]; env++) { if (sbr->bs_df_env[ch][env] == 0) { if ((sbr->bs_coupling == 1) && (ch == 1)) { if (sbr->amp_res[ch]) { sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 5 DEBUGVAR(1,272,"sbr_envelope(): bs_data_env")) << delta); } else { sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 6 DEBUGVAR(1,273,"sbr_envelope(): bs_data_env")) << delta); } } else { if (sbr->amp_res[ch]) { sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 6 DEBUGVAR(1,274,"sbr_envelope(): bs_data_env")) << delta); } else { sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 7 DEBUGVAR(1,275,"sbr_envelope(): bs_data_env")) << delta); } } for (band = 1; band < sbr->n[sbr->f[ch][env]]; band++) { sbr->E[ch][band][env] = (sbr_huff_dec(ld, f_huff) << delta); } } else { for (band = 0; band < sbr->n[sbr->f[ch][env]]; band++) { sbr->E[ch][band][env] = (sbr_huff_dec(ld, t_huff) << delta); } } } extract_envelope_data(sbr, ch); } /* table 11 */ void sbr_noise(bitfile *ld, sbr_info *sbr, uint8_t ch) { uint8_t noise, band; int8_t delta = 0; sbr_huff_tab t_huff, f_huff; if ((sbr->bs_coupling == 1) && (ch == 1)) { delta = 1; t_huff = t_huffman_noise_bal_3_0dB; f_huff = f_huffman_env_bal_3_0dB; } else { delta = 0; t_huff = t_huffman_noise_3_0dB; f_huff = f_huffman_env_3_0dB; } for (noise = 0; noise < sbr->L_Q[ch]; noise++) { if(sbr->bs_df_noise[ch][noise] == 0) { if ((sbr->bs_coupling == 1) && (ch == 1)) { sbr->Q[ch][0][noise] = (faad_getbits(ld, 5 DEBUGVAR(1,276,"sbr_noise(): bs_data_noise")) << delta); } else { sbr->Q[ch][0][noise] = (faad_getbits(ld, 5 DEBUGVAR(1,277,"sbr_noise(): bs_data_noise")) << delta); } for (band = 1; band < sbr->N_Q; band++) { sbr->Q[ch][band][noise] = (sbr_huff_dec(ld, f_huff) << delta); } } else { for (band = 0; band < sbr->N_Q; band++) { sbr->Q[ch][band][noise] = (sbr_huff_dec(ld, t_huff) << delta); } } } extract_noise_floor_data(sbr, ch); } #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/sbr_huff.h
C/C++ Header
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_huff.h,v 1.21 2007/11/01 12:33:35 menno Exp $ **/ #ifndef __SBR_HUFF_H__ #define __SBR_HUFF_H__ #ifdef __cplusplus extern "C" { #endif void sbr_envelope(bitfile *ld, sbr_info *sbr, uint8_t ch); void sbr_noise(bitfile *ld, sbr_info *sbr, uint8_t ch); #ifdef __cplusplus } #endif #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/sbr_noise.h
C/C++ Header
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_noise.h,v 1.17 2007/11/01 12:33:35 menno Exp $ **/ #ifndef __SBR_NOISE_H__ #define __SBR_NOISE_H__ #ifdef __cplusplus extern "C" { #endif #ifdef _MSC_VER #pragma warning(disable:4305) #pragma warning(disable:4244) #endif /* Table 1.A.13 Noise table V */ ALIGN static const complex_t V[] = { { FRAC_CONST(-0.99948155879974), FRAC_CONST(-0.59483414888382) }, { FRAC_CONST(0.97113454341888), FRAC_CONST(-0.67528516054153) }, { FRAC_CONST(0.14130051434040), FRAC_CONST(-0.95090985298157) }, { FRAC_CONST(-0.47005495429039), FRAC_CONST(-0.37340548634529) }, { FRAC_CONST(0.80705064535141), FRAC_CONST(0.29653668403625) }, { FRAC_CONST(-0.38981479406357), FRAC_CONST(0.89572608470917) }, { FRAC_CONST(-0.01053049881011), FRAC_CONST(-0.66959059238434) }, { FRAC_CONST(-0.91266369819641), FRAC_CONST(-0.11522938311100) }, { FRAC_CONST(0.54840421676636), FRAC_CONST(0.75221365690231) }, { FRAC_CONST(0.40009254217148), FRAC_CONST(-0.98929399251938) }, { FRAC_CONST(-0.99867975711823), FRAC_CONST(-0.88147068023682) }, { FRAC_CONST(-0.95531076192856), FRAC_CONST(0.90908759832382) }, { FRAC_CONST(-0.45725932717323), FRAC_CONST(-0.56716322898865) }, { FRAC_CONST(-0.72929674386978), FRAC_CONST(-0.98008275032043) }, { FRAC_CONST(0.75622802972794), FRAC_CONST(0.20950329303741) }, { FRAC_CONST(0.07069442421198), FRAC_CONST(-0.78247898817062) }, { FRAC_CONST(0.74496251344681), FRAC_CONST(-0.91169005632401) }, { FRAC_CONST(-0.96440184116364), FRAC_CONST(-0.94739919900894) }, { FRAC_CONST(0.30424630641937), FRAC_CONST(-0.49438267946243) }, { FRAC_CONST(0.66565030813217), FRAC_CONST(0.64652937650681) }, { FRAC_CONST(0.91697007417679), FRAC_CONST(0.17514097690582) }, { FRAC_CONST(-0.70774918794632), FRAC_CONST(0.52548652887344) }, { FRAC_CONST(-0.70051413774490), FRAC_CONST(-0.45340028405190) }, { FRAC_CONST(-0.99496513605118), FRAC_CONST(-0.90071910619736) }, { FRAC_CONST(0.98164492845535), FRAC_CONST(-0.77463155984879) }, { FRAC_CONST(-0.54671579599380), FRAC_CONST(-0.02570928446949) }, { FRAC_CONST(-0.01689629070461), FRAC_CONST(0.00287506449968) }, { FRAC_CONST(-0.86110347509384), FRAC_CONST(0.42548584938049) }, { FRAC_CONST(-0.98892980813980), FRAC_CONST(-0.87881129980087) }, { FRAC_CONST(0.51756626367569), FRAC_CONST(0.66926783323288) }, { FRAC_CONST(-0.99635028839111), FRAC_CONST(-0.58107727766037) }, { FRAC_CONST(-0.99969369173050), FRAC_CONST(0.98369991779327) }, { FRAC_CONST(0.55266261100769), FRAC_CONST(0.59449058771133) }, { FRAC_CONST(0.34581178426743), FRAC_CONST(0.94879418611526) }, { FRAC_CONST(0.62664210796356), FRAC_CONST(-0.74402970075607) }, { FRAC_CONST(-0.77149701118469), FRAC_CONST(-0.33883658051491) }, { FRAC_CONST(-0.91592246294022), FRAC_CONST(0.03687901422381) }, { FRAC_CONST(-0.76285493373871), FRAC_CONST(-0.91371870040894) }, { FRAC_CONST(0.79788339138031), FRAC_CONST(-0.93180972337723) }, { FRAC_CONST(0.54473078250885), FRAC_CONST(-0.11919206380844) }, { FRAC_CONST(-0.85639280080795), FRAC_CONST(0.42429855465889) }, { FRAC_CONST(-0.92882400751114), FRAC_CONST(0.27871808409691) }, { FRAC_CONST(-0.11708371341228), FRAC_CONST(-0.99800843000412) }, { FRAC_CONST(0.21356749534607), FRAC_CONST(-0.90716296434402) }, { FRAC_CONST(-0.76191693544388), FRAC_CONST(0.99768120050430) }, { FRAC_CONST(0.98111045360565), FRAC_CONST(-0.95854461193085) }, { FRAC_CONST(-0.85913270711899), FRAC_CONST(0.95766568183899) }, { FRAC_CONST(-0.93307244777679), FRAC_CONST(0.49431759119034) }, { FRAC_CONST(0.30485755205154), FRAC_CONST(-0.70540034770966) }, { FRAC_CONST(0.85289651155472), FRAC_CONST(0.46766132116318) }, { FRAC_CONST(0.91328084468842), FRAC_CONST(-0.99839597940445) }, { FRAC_CONST(-0.05890199914575), FRAC_CONST(0.70741826295853) }, { FRAC_CONST(0.28398686647415), FRAC_CONST(0.34633556008339) }, { FRAC_CONST(0.95258164405823), FRAC_CONST(-0.54893416166306) }, { FRAC_CONST(-0.78566324710846), FRAC_CONST(-0.75568538904190) }, { FRAC_CONST(-0.95789498090744), FRAC_CONST(-0.20423194766045) }, { FRAC_CONST(0.82411158084869), FRAC_CONST(0.96654617786407) }, { FRAC_CONST(-0.65185445547104), FRAC_CONST(-0.88734990358353) }, { FRAC_CONST(-0.93643605709076), FRAC_CONST(0.99870789051056) }, { FRAC_CONST(0.91427159309387), FRAC_CONST(-0.98290503025055) }, { FRAC_CONST(-0.70395684242249), FRAC_CONST(0.58796799182892) }, { FRAC_CONST(0.00563771976158), FRAC_CONST(0.61768198013306) }, { FRAC_CONST(0.89065051078796), FRAC_CONST(0.52783352136612) }, { FRAC_CONST(-0.68683707714081), FRAC_CONST(0.80806946754456) }, { FRAC_CONST(0.72165340185165), FRAC_CONST(-0.69259858131409) }, { FRAC_CONST(-0.62928247451782), FRAC_CONST(0.13627037405968) }, { FRAC_CONST(0.29938435554504), FRAC_CONST(-0.46051329374313) }, { FRAC_CONST(-0.91781955957413), FRAC_CONST(-0.74012714624405) }, { FRAC_CONST(0.99298715591431), FRAC_CONST(0.40816611051559) }, { FRAC_CONST(0.82368296384811), FRAC_CONST(-0.74036049842834) }, { FRAC_CONST(-0.98512834310532), FRAC_CONST(-0.99972331523895) }, { FRAC_CONST(-0.95915371179581), FRAC_CONST(-0.99237799644470) }, { FRAC_CONST(-0.21411126852036), FRAC_CONST(-0.93424820899963) }, { FRAC_CONST(-0.68821477890015), FRAC_CONST(-0.26892307400703) }, { FRAC_CONST(0.91851997375488), FRAC_CONST(0.09358228743076) }, { FRAC_CONST(-0.96062767505646), FRAC_CONST(0.36099094152451) }, { FRAC_CONST(0.51646184921265), FRAC_CONST(-0.71373331546783) }, { FRAC_CONST(0.61130720376968), FRAC_CONST(0.46950140595436) }, { FRAC_CONST(0.47336128354073), FRAC_CONST(-0.27333179116249) }, { FRAC_CONST(0.90998309850693), FRAC_CONST(0.96715664863586) }, { FRAC_CONST(0.44844800233841), FRAC_CONST(0.99211573600769) }, { FRAC_CONST(0.66614890098572), FRAC_CONST(0.96590173244476) }, { FRAC_CONST(0.74922239780426), FRAC_CONST(-0.89879858493805) }, { FRAC_CONST(-0.99571585655212), FRAC_CONST(0.52785521745682) }, { FRAC_CONST(0.97401082515717), FRAC_CONST(-0.16855870187283) }, { FRAC_CONST(0.72683745622635), FRAC_CONST(-0.48060774803162) }, { FRAC_CONST(0.95432192087173), FRAC_CONST(0.68849605321884) }, { FRAC_CONST(-0.72962206602097), FRAC_CONST(-0.76608443260193) }, { FRAC_CONST(-0.85359477996826), FRAC_CONST(0.88738125562668) }, { FRAC_CONST(-0.81412428617477), FRAC_CONST(-0.97480767965317) }, { FRAC_CONST(-0.87930774688721), FRAC_CONST(0.74748307466507) }, { FRAC_CONST(-0.71573328971863), FRAC_CONST(-0.98570609092712) }, { FRAC_CONST(0.83524298667908), FRAC_CONST(0.83702534437180) }, { FRAC_CONST(-0.48086065053940), FRAC_CONST(-0.98848503828049) }, { FRAC_CONST(0.97139126062393), FRAC_CONST(0.80093622207642) }, { FRAC_CONST(0.51992827653885), FRAC_CONST(0.80247628688812) }, { FRAC_CONST(-0.00848591234535), FRAC_CONST(-0.76670128107071) }, { FRAC_CONST(-0.70294374227524), FRAC_CONST(0.55359911918640) }, { FRAC_CONST(-0.95894426107407), FRAC_CONST(-0.43265503644943) }, { FRAC_CONST(0.97079253196716), FRAC_CONST(0.09325857460499) }, { FRAC_CONST(-0.92404294013977), FRAC_CONST(0.85507702827454) }, { FRAC_CONST(-0.69506472349167), FRAC_CONST(0.98633414506912) }, { FRAC_CONST(0.26559203863144), FRAC_CONST(0.73314309120178) }, { FRAC_CONST(0.28038442134857), FRAC_CONST(0.14537914097309) }, { FRAC_CONST(-0.74138122797012), FRAC_CONST(0.99310338497162) }, { FRAC_CONST(-0.01752796024084), FRAC_CONST(-0.82616633176804) }, { FRAC_CONST(-0.55126774311066), FRAC_CONST(-0.98898541927338) }, { FRAC_CONST(0.97960901260376), FRAC_CONST(-0.94021445512772) }, { FRAC_CONST(-0.99196308851242), FRAC_CONST(0.67019015550613) }, { FRAC_CONST(-0.67684930562973), FRAC_CONST(0.12631492316723) }, { FRAC_CONST(0.09140039235353), FRAC_CONST(-0.20537731051445) }, { FRAC_CONST(-0.71658962965012), FRAC_CONST(-0.97788202762604) }, { FRAC_CONST(0.81014639139175), FRAC_CONST(0.53722649812698) }, { FRAC_CONST(0.40616992115974), FRAC_CONST(-0.26469007134438) }, { FRAC_CONST(-0.67680186033249), FRAC_CONST(0.94502049684525) }, { FRAC_CONST(0.86849772930145), FRAC_CONST(-0.18333598971367) }, { FRAC_CONST(-0.99500381946564), FRAC_CONST(-0.02634122036397) }, { FRAC_CONST(0.84329187870026), FRAC_CONST(0.10406957566738) }, { FRAC_CONST(-0.09215968847275), FRAC_CONST(0.69540011882782) }, { FRAC_CONST(0.99956172704697), FRAC_CONST(-0.12358541786671) }, { FRAC_CONST(-0.79732781648636), FRAC_CONST(-0.91582524776459) }, { FRAC_CONST(0.96349972486496), FRAC_CONST(0.96640455722809) }, { FRAC_CONST(-0.79942780733109), FRAC_CONST(0.64323902130127) }, { FRAC_CONST(-0.11566039919853), FRAC_CONST(0.28587844967842) }, { FRAC_CONST(-0.39922955632210), FRAC_CONST(0.94129604101181) }, { FRAC_CONST(0.99089199304581), FRAC_CONST(-0.92062628269196) }, { FRAC_CONST(0.28631284832954), FRAC_CONST(-0.91035044193268) }, { FRAC_CONST(-0.83302724361420), FRAC_CONST(-0.67330408096313) }, { FRAC_CONST(0.95404446125031), FRAC_CONST(0.49162766337395) }, { FRAC_CONST(-0.06449863314629), FRAC_CONST(0.03250560909510) }, { FRAC_CONST(-0.99575054645538), FRAC_CONST(0.42389783263206) }, { FRAC_CONST(-0.65501141548157), FRAC_CONST(0.82546114921570) }, { FRAC_CONST(-0.81254440546036), FRAC_CONST(-0.51627236604691) }, { FRAC_CONST(-0.99646371603012), FRAC_CONST(0.84490531682968) }, { FRAC_CONST(0.00287840608507), FRAC_CONST(0.64768260717392) }, { FRAC_CONST(0.70176988840103), FRAC_CONST(-0.20453028380871) }, { FRAC_CONST(0.96361881494522), FRAC_CONST(0.40706968307495) }, { FRAC_CONST(-0.68883758783340), FRAC_CONST(0.91338956356049) }, { FRAC_CONST(-0.34875586628914), FRAC_CONST(0.71472293138504) }, { FRAC_CONST(0.91980081796646), FRAC_CONST(0.66507452726364) }, { FRAC_CONST(-0.99009048938751), FRAC_CONST(0.85868018865585) }, { FRAC_CONST(0.68865793943405), FRAC_CONST(0.55660319328308) }, { FRAC_CONST(-0.99484401941299), FRAC_CONST(-0.20052559673786) }, { FRAC_CONST(0.94214510917664), FRAC_CONST(-0.99696427583694) }, { FRAC_CONST(-0.67414629459381), FRAC_CONST(0.49548220634460) }, { FRAC_CONST(-0.47339352965355), FRAC_CONST(-0.85904330015182) }, { FRAC_CONST(0.14323651790619), FRAC_CONST(-0.94145596027374) }, { FRAC_CONST(-0.29268294572830), FRAC_CONST(0.05759225040674) }, { FRAC_CONST(0.43793860077858), FRAC_CONST(-0.78904968500137) }, { FRAC_CONST(-0.36345127224922), FRAC_CONST(0.64874434471130) }, { FRAC_CONST(-0.08750604838133), FRAC_CONST(0.97686946392059) }, { FRAC_CONST(-0.96495270729065), FRAC_CONST(-0.53960305452347) }, { FRAC_CONST(0.55526942014694), FRAC_CONST(0.78891521692276) }, { FRAC_CONST(0.73538213968277), FRAC_CONST(0.96452075242996) }, { FRAC_CONST(-0.30889773368835), FRAC_CONST(-0.80664390325546) }, { FRAC_CONST(0.03574995696545), FRAC_CONST(-0.97325617074966) }, { FRAC_CONST(0.98720687627792), FRAC_CONST(0.48409134149551) }, { FRAC_CONST(-0.81689298152924), FRAC_CONST(-0.90827703475952) }, { FRAC_CONST(0.67866861820221), FRAC_CONST(0.81284505128860) }, { FRAC_CONST(-0.15808570384979), FRAC_CONST(0.85279554128647) }, { FRAC_CONST(0.80723392963409), FRAC_CONST(-0.24717418849468) }, { FRAC_CONST(0.47788757085800), FRAC_CONST(-0.46333149075508) }, { FRAC_CONST(0.96367555856705), FRAC_CONST(0.38486748933792) }, { FRAC_CONST(-0.99143874645233), FRAC_CONST(-0.24945276975632) }, { FRAC_CONST(0.83081877231598), FRAC_CONST(-0.94780850410461) }, { FRAC_CONST(-0.58753192424774), FRAC_CONST(0.01290772389621) }, { FRAC_CONST(0.95538109540939), FRAC_CONST(-0.85557049512863) }, { FRAC_CONST(-0.96490919589996), FRAC_CONST(-0.64020973443985) }, { FRAC_CONST(-0.97327101230621), FRAC_CONST(0.12378127872944) }, { FRAC_CONST(0.91400367021561), FRAC_CONST(0.57972472906113) }, { FRAC_CONST(-0.99925839900970), FRAC_CONST(0.71084845066071) }, { FRAC_CONST(-0.86875903606415), FRAC_CONST(-0.20291699469090) }, { FRAC_CONST(-0.26240035891533), FRAC_CONST(-0.68264555931091) }, { FRAC_CONST(-0.24664412438869), FRAC_CONST(-0.87642270326614) }, { FRAC_CONST(0.02416275814176), FRAC_CONST(0.27192914485931) }, { FRAC_CONST(0.82068622112274), FRAC_CONST(-0.85087788105011) }, { FRAC_CONST(0.88547372817993), FRAC_CONST(-0.89636802673340) }, { FRAC_CONST(-0.18173077702522), FRAC_CONST(-0.26152145862579) }, { FRAC_CONST(0.09355476498604), FRAC_CONST(0.54845124483109) }, { FRAC_CONST(-0.54668414592743), FRAC_CONST(0.95980775356293) }, { FRAC_CONST(0.37050989270210), FRAC_CONST(-0.59910142421722) }, { FRAC_CONST(-0.70373594760895), FRAC_CONST(0.91227668523788) }, { FRAC_CONST(-0.34600785374641), FRAC_CONST(-0.99441426992416) }, { FRAC_CONST(-0.68774479627609), FRAC_CONST(-0.30238837003708) }, { FRAC_CONST(-0.26843291521072), FRAC_CONST(0.83115667104721) }, { FRAC_CONST(0.49072334170341), FRAC_CONST(-0.45359709858894) }, { FRAC_CONST(0.38975992798805), FRAC_CONST(0.95515358448029) }, { FRAC_CONST(-0.97757124900818), FRAC_CONST(0.05305894464254) }, { FRAC_CONST(-0.17325553297997), FRAC_CONST(-0.92770671844482) }, { FRAC_CONST(0.99948036670685), FRAC_CONST(0.58285546302795) }, { FRAC_CONST(-0.64946246147156), FRAC_CONST(0.68645507097244) }, { FRAC_CONST(-0.12016920745373), FRAC_CONST(-0.57147324085236) }, { FRAC_CONST(-0.58947455883026), FRAC_CONST(-0.34847131371498) }, { FRAC_CONST(-0.41815140843391), FRAC_CONST(0.16276422142982) }, { FRAC_CONST(0.99885648488998), FRAC_CONST(0.11136095225811) }, { FRAC_CONST(-0.56649613380432), FRAC_CONST(-0.90494865179062) }, { FRAC_CONST(0.94138020277023), FRAC_CONST(0.35281917452812) }, { FRAC_CONST(-0.75725078582764), FRAC_CONST(0.53650552034378) }, { FRAC_CONST(0.20541973412037), FRAC_CONST(-0.94435143470764) }, { FRAC_CONST(0.99980372190475), FRAC_CONST(0.79835915565491) }, { FRAC_CONST(0.29078277945518), FRAC_CONST(0.35393777489662) }, { FRAC_CONST(-0.62858772277832), FRAC_CONST(0.38765692710876) }, { FRAC_CONST(0.43440905213356), FRAC_CONST(-0.98546332120895) }, { FRAC_CONST(-0.98298585414886), FRAC_CONST(0.21021524071693) }, { FRAC_CONST(0.19513028860092), FRAC_CONST(-0.94239830970764) }, { FRAC_CONST(-0.95476663112640), FRAC_CONST(0.98364555835724) }, { FRAC_CONST(0.93379634618759), FRAC_CONST(-0.70881992578506) }, { FRAC_CONST(-0.85235410928726), FRAC_CONST(-0.08342348039150) }, { FRAC_CONST(-0.86425095796585), FRAC_CONST(-0.45795026421547) }, { FRAC_CONST(0.38879778981209), FRAC_CONST(0.97274428606033) }, { FRAC_CONST(0.92045122385025), FRAC_CONST(-0.62433654069901) }, { FRAC_CONST(0.89162534475327), FRAC_CONST(0.54950958490372) }, { FRAC_CONST(-0.36834338307381), FRAC_CONST(0.96458297967911) }, { FRAC_CONST(0.93891763687134), FRAC_CONST(-0.89968353509903) }, { FRAC_CONST(0.99267655611038), FRAC_CONST(-0.03757034242153) }, { FRAC_CONST(-0.94063472747803), FRAC_CONST(0.41332337260246) }, { FRAC_CONST(0.99740225076675), FRAC_CONST(-0.16830494999886) }, { FRAC_CONST(-0.35899412631989), FRAC_CONST(-0.46633225679398) }, { FRAC_CONST(0.05237237364054), FRAC_CONST(-0.25640362501144) }, { FRAC_CONST(0.36703583598137), FRAC_CONST(-0.38653266429901) }, { FRAC_CONST(0.91653180122375), FRAC_CONST(-0.30587628483772) }, { FRAC_CONST(0.69000804424286), FRAC_CONST(0.90952169895172) }, { FRAC_CONST(-0.38658750057220), FRAC_CONST(0.99501574039459) }, { FRAC_CONST(-0.29250815510750), FRAC_CONST(0.37444993853569) }, { FRAC_CONST(-0.60182201862335), FRAC_CONST(0.86779648065567) }, { FRAC_CONST(-0.97418588399887), FRAC_CONST(0.96468526124954) }, { FRAC_CONST(0.88461571931839), FRAC_CONST(0.57508403062820) }, { FRAC_CONST(0.05198933184147), FRAC_CONST(0.21269661188126) }, { FRAC_CONST(-0.53499621152878), FRAC_CONST(0.97241556644440) }, { FRAC_CONST(-0.49429559707642), FRAC_CONST(0.98183864355087) }, { FRAC_CONST(-0.98935145139694), FRAC_CONST(-0.40249159932137) }, { FRAC_CONST(-0.98081380128860), FRAC_CONST(-0.72856897115707) }, { FRAC_CONST(-0.27338150143623), FRAC_CONST(0.99950921535492) }, { FRAC_CONST(0.06310802698135), FRAC_CONST(-0.54539585113525) }, { FRAC_CONST(-0.20461677014828), FRAC_CONST(-0.14209978282452) }, { FRAC_CONST(0.66223841905594), FRAC_CONST(0.72528582811356) }, { FRAC_CONST(-0.84764343500137), FRAC_CONST(0.02372316829860) }, { FRAC_CONST(-0.89039862155914), FRAC_CONST(0.88866579532623) }, { FRAC_CONST(0.95903307199478), FRAC_CONST(0.76744925975800) }, { FRAC_CONST(0.73504126071930), FRAC_CONST(-0.03747203201056) }, { FRAC_CONST(-0.31744435429573), FRAC_CONST(-0.36834111809731) }, { FRAC_CONST(-0.34110826253891), FRAC_CONST(0.40211221575737) }, { FRAC_CONST(0.47803884744644), FRAC_CONST(-0.39423218369484) }, { FRAC_CONST(0.98299193382263), FRAC_CONST(0.01989791356027) }, { FRAC_CONST(-0.30963072180748), FRAC_CONST(-0.18076720833778) }, { FRAC_CONST(0.99992591142654), FRAC_CONST(-0.26281872391701) }, { FRAC_CONST(-0.93149733543396), FRAC_CONST(-0.98313164710999) }, { FRAC_CONST(0.99923473596573), FRAC_CONST(-0.80142992734909) }, { FRAC_CONST(-0.26024168729782), FRAC_CONST(-0.75999760627747) }, { FRAC_CONST(-0.35712513327599), FRAC_CONST(0.19298963248730) }, { FRAC_CONST(-0.99899083375931), FRAC_CONST(0.74645155668259) }, { FRAC_CONST(0.86557173728943), FRAC_CONST(0.55593866109848) }, { FRAC_CONST(0.33408042788506), FRAC_CONST(0.86185956001282) }, { FRAC_CONST(0.99010735750198), FRAC_CONST(0.04602397605777) }, { FRAC_CONST(-0.66694271564484), FRAC_CONST(-0.91643613576889) }, { FRAC_CONST(0.64016789197922), FRAC_CONST(0.15649530291557) }, { FRAC_CONST(0.99570536613464), FRAC_CONST(0.45844584703445) }, { FRAC_CONST(-0.63431465625763), FRAC_CONST(0.21079117059708) }, { FRAC_CONST(-0.07706847041845), FRAC_CONST(-0.89581435918808) }, { FRAC_CONST(0.98590087890625), FRAC_CONST(0.88241720199585) }, { FRAC_CONST(0.80099332332611), FRAC_CONST(-0.36851897835732) }, { FRAC_CONST(0.78368133306503), FRAC_CONST(0.45506998896599) }, { FRAC_CONST(0.08707806468010), FRAC_CONST(0.80938994884491) }, { FRAC_CONST(-0.86811882257462), FRAC_CONST(0.39347308874130) }, { FRAC_CONST(-0.39466530084610), FRAC_CONST(-0.66809433698654) }, { FRAC_CONST(0.97875326871872), FRAC_CONST(-0.72467839717865) }, { FRAC_CONST(-0.95038563013077), FRAC_CONST(0.89563220739365) }, { FRAC_CONST(0.17005239427090), FRAC_CONST(0.54683053493500) }, { FRAC_CONST(-0.76910793781281), FRAC_CONST(-0.96226614713669) }, { FRAC_CONST(0.99743282794952), FRAC_CONST(0.42697158455849) }, { FRAC_CONST(0.95437383651733), FRAC_CONST(0.97002321481705) }, { FRAC_CONST(0.99578905105591), FRAC_CONST(-0.54106825590134) }, { FRAC_CONST(0.28058260679245), FRAC_CONST(-0.85361421108246) }, { FRAC_CONST(0.85256522893906), FRAC_CONST(-0.64567607641220) }, { FRAC_CONST(-0.50608539581299), FRAC_CONST(-0.65846014022827) }, { FRAC_CONST(-0.97210735082626), FRAC_CONST(-0.23095212876797) }, { FRAC_CONST(0.95424050092697), FRAC_CONST(-0.99240148067474) }, { FRAC_CONST(-0.96926569938660), FRAC_CONST(0.73775655031204) }, { FRAC_CONST(0.30872163176537), FRAC_CONST(0.41514959931374) }, { FRAC_CONST(-0.24523839354515), FRAC_CONST(0.63206630945206) }, { FRAC_CONST(-0.33813264966011), FRAC_CONST(-0.38661777973175) }, { FRAC_CONST(-0.05826828256249), FRAC_CONST(-0.06940773874521) }, { FRAC_CONST(-0.22898460924625), FRAC_CONST(0.97054851055145) }, { FRAC_CONST(-0.18509915471077), FRAC_CONST(0.47565764188766) }, { FRAC_CONST(-0.10488238185644), FRAC_CONST(-0.87769949436188) }, { FRAC_CONST(-0.71886587142944), FRAC_CONST(0.78030979633331) }, { FRAC_CONST(0.99793875217438), FRAC_CONST(0.90041309595108) }, { FRAC_CONST(0.57563304901123), FRAC_CONST(-0.91034334897995) }, { FRAC_CONST(0.28909647464752), FRAC_CONST(0.96307784318924) }, { FRAC_CONST(0.42188999056816), FRAC_CONST(0.48148649930954) }, { FRAC_CONST(0.93335050344467), FRAC_CONST(-0.43537023663521) }, { FRAC_CONST(-0.97087377309799), FRAC_CONST(0.86636447906494) }, { FRAC_CONST(0.36722871661186), FRAC_CONST(0.65291655063629) }, { FRAC_CONST(-0.81093025207520), FRAC_CONST(0.08778370171785) }, { FRAC_CONST(-0.26240602135658), FRAC_CONST(-0.92774093151093) }, { FRAC_CONST(0.83996498584747), FRAC_CONST(0.55839848518372) }, { FRAC_CONST(-0.99909615516663), FRAC_CONST(-0.96024608612061) }, { FRAC_CONST(0.74649465084076), FRAC_CONST(0.12144893407822) }, { FRAC_CONST(-0.74774593114853), FRAC_CONST(-0.26898062229156) }, { FRAC_CONST(0.95781666040421), FRAC_CONST(-0.79047924280167) }, { FRAC_CONST(0.95472306013107), FRAC_CONST(-0.08588775992393) }, { FRAC_CONST(0.48708331584930), FRAC_CONST(0.99999040365219) }, { FRAC_CONST(0.46332037448883), FRAC_CONST(0.10964126139879) }, { FRAC_CONST(-0.76497006416321), FRAC_CONST(0.89210927486420) }, { FRAC_CONST(0.57397389411926), FRAC_CONST(0.35289704799652) }, { FRAC_CONST(0.75374317169189), FRAC_CONST(0.96705216169357) }, { FRAC_CONST(-0.59174400568008), FRAC_CONST(-0.89405369758606) }, { FRAC_CONST(0.75087904930115), FRAC_CONST(-0.29612672328949) }, { FRAC_CONST(-0.98607856035233), FRAC_CONST(0.25034910440445) }, { FRAC_CONST(-0.40761056542397), FRAC_CONST(-0.90045571327209) }, { FRAC_CONST(0.66929268836975), FRAC_CONST(0.98629492521286) }, { FRAC_CONST(-0.97463697195053), FRAC_CONST(-0.00190223299433) }, { FRAC_CONST(0.90145510435104), FRAC_CONST(0.99781388044357) }, { FRAC_CONST(-0.87259286642075), FRAC_CONST(0.99233585596085) }, { FRAC_CONST(-0.91529458761215), FRAC_CONST(-0.15698707103729) }, { FRAC_CONST(-0.03305738791823), FRAC_CONST(-0.37205263972282) }, { FRAC_CONST(0.07223051041365), FRAC_CONST(-0.88805001974106) }, { FRAC_CONST(0.99498009681702), FRAC_CONST(0.97094357013702) }, { FRAC_CONST(-0.74904936552048), FRAC_CONST(0.99985486268997) }, { FRAC_CONST(0.04585228487849), FRAC_CONST(0.99812334775925) }, { FRAC_CONST(-0.89054954051971), FRAC_CONST(-0.31791913509369) }, { FRAC_CONST(-0.83782142400742), FRAC_CONST(0.97637635469437) }, { FRAC_CONST(0.33454805612564), FRAC_CONST(-0.86231517791748) }, { FRAC_CONST(-0.99707579612732), FRAC_CONST(0.93237990140915) }, { FRAC_CONST(-0.22827528417110), FRAC_CONST(0.18874759972095) }, { FRAC_CONST(0.67248046398163), FRAC_CONST(-0.03646211326122) }, { FRAC_CONST(-0.05146538093686), FRAC_CONST(-0.92599701881409) }, { FRAC_CONST(0.99947297573090), FRAC_CONST(0.93625229597092) }, { FRAC_CONST(0.66951125860214), FRAC_CONST(0.98905825614929) }, { FRAC_CONST(-0.99602955579758), FRAC_CONST(-0.44654715061188) }, { FRAC_CONST(0.82104903459549), FRAC_CONST(0.99540740251541) }, { FRAC_CONST(0.99186509847641), FRAC_CONST(0.72022998332977) }, { FRAC_CONST(-0.65284591913223), FRAC_CONST(0.52186721563339) }, { FRAC_CONST(0.93885445594788), FRAC_CONST(-0.74895310401917) }, { FRAC_CONST(0.96735250949860), FRAC_CONST(0.90891814231873) }, { FRAC_CONST(-0.22225968539715), FRAC_CONST(0.57124030590057) }, { FRAC_CONST(-0.44132784008980), FRAC_CONST(-0.92688840627670) }, { FRAC_CONST(-0.85694974660873), FRAC_CONST(0.88844531774521) }, { FRAC_CONST(0.91783040761948), FRAC_CONST(-0.46356892585754) }, { FRAC_CONST(0.72556972503662), FRAC_CONST(-0.99899554252625) }, { FRAC_CONST(-0.99711579084396), FRAC_CONST(0.58211559057236) }, { FRAC_CONST(0.77638977766037), FRAC_CONST(0.94321835041046) }, { FRAC_CONST(0.07717324048281), FRAC_CONST(0.58638399839401) }, { FRAC_CONST(-0.56049829721451), FRAC_CONST(0.82522302865982) }, { FRAC_CONST(0.98398894071579), FRAC_CONST(0.39467439055443) }, { FRAC_CONST(0.47546947002411), FRAC_CONST(0.68613046407700) }, { FRAC_CONST(0.65675091743469), FRAC_CONST(0.18331636488438) }, { FRAC_CONST(0.03273375332355), FRAC_CONST(-0.74933111667633) }, { FRAC_CONST(-0.38684144616127), FRAC_CONST(0.51337349414825) }, { FRAC_CONST(-0.97346270084381), FRAC_CONST(-0.96549361944199) }, { FRAC_CONST(-0.53282153606415), FRAC_CONST(-0.91423267126083) }, { FRAC_CONST(0.99817311763763), FRAC_CONST(0.61133575439453) }, { FRAC_CONST(-0.50254499912262), FRAC_CONST(-0.88829338550568) }, { FRAC_CONST(0.01995873264968), FRAC_CONST(0.85223513841629) }, { FRAC_CONST(0.99930381774902), FRAC_CONST(0.94578897953033) }, { FRAC_CONST(0.82907766103745), FRAC_CONST(-0.06323442608118) }, { FRAC_CONST(-0.58660709857941), FRAC_CONST(0.96840775012970) }, { FRAC_CONST(-0.17573736608028), FRAC_CONST(-0.48166921734810) }, { FRAC_CONST(0.83434289693832), FRAC_CONST(-0.13023450970650) }, { FRAC_CONST(0.05946491286159), FRAC_CONST(0.20511047542095) }, { FRAC_CONST(0.81505483388901), FRAC_CONST(-0.94685947895050) }, { FRAC_CONST(-0.44976380467415), FRAC_CONST(0.40894573926926) }, { FRAC_CONST(-0.89746475219727), FRAC_CONST(0.99846577644348) }, { FRAC_CONST(0.39677256345749), FRAC_CONST(-0.74854665994644) }, { FRAC_CONST(-0.07588948309422), FRAC_CONST(0.74096214771271) }, { FRAC_CONST(0.76343196630478), FRAC_CONST(0.41746628284454) }, { FRAC_CONST(-0.74490106105804), FRAC_CONST(0.94725912809372) }, { FRAC_CONST(0.64880120754242), FRAC_CONST(0.41336661577225) }, { FRAC_CONST(0.62319535017014), FRAC_CONST(-0.93098312616348) }, { FRAC_CONST(0.42215818166733), FRAC_CONST(-0.07712787389755) }, { FRAC_CONST(0.02704554051161), FRAC_CONST(-0.05417517945170) }, { FRAC_CONST(0.80001771450043), FRAC_CONST(0.91542196273804) }, { FRAC_CONST(-0.79351830482483), FRAC_CONST(-0.36208897829056) }, { FRAC_CONST(0.63872361183167), FRAC_CONST(0.08128252625465) }, { FRAC_CONST(0.52890521287918), FRAC_CONST(0.60048872232437) }, { FRAC_CONST(0.74238550662994), FRAC_CONST(0.04491915181279) }, { FRAC_CONST(0.99096131324768), FRAC_CONST(-0.19451183080673) }, { FRAC_CONST(-0.80412328243256), FRAC_CONST(-0.88513815402985) }, { FRAC_CONST(-0.64612615108490), FRAC_CONST(0.72198677062988) }, { FRAC_CONST(0.11657770723104), FRAC_CONST(-0.83662831783295) }, { FRAC_CONST(-0.95053184032440), FRAC_CONST(-0.96939903497696) }, { FRAC_CONST(-0.62228870391846), FRAC_CONST(0.82767260074615) }, { FRAC_CONST(0.03004475869238), FRAC_CONST(-0.99738895893097) }, { FRAC_CONST(-0.97987216711044), FRAC_CONST(0.36526128649712) }, { FRAC_CONST(-0.99986982345581), FRAC_CONST(-0.36021611094475) }, { FRAC_CONST(0.89110648632050), FRAC_CONST(-0.97894251346588) }, { FRAC_CONST(0.10407960414886), FRAC_CONST(0.77357792854309) }, { FRAC_CONST(0.95964735746384), FRAC_CONST(-0.35435819625854) }, { FRAC_CONST(0.50843232870102), FRAC_CONST(0.96107691526413) }, { FRAC_CONST(0.17006334662437), FRAC_CONST(-0.76854026317596) }, { FRAC_CONST(0.25872674584389), FRAC_CONST(0.99893301725388) }, { FRAC_CONST(-0.01115998718888), FRAC_CONST(0.98496019840240) }, { FRAC_CONST(-0.79598701000214), FRAC_CONST(0.97138410806656) }, { FRAC_CONST(-0.99264711141586), FRAC_CONST(-0.99542820453644) }, { FRAC_CONST(-0.99829661846161), FRAC_CONST(0.01877138763666) }, { FRAC_CONST(-0.70801013708115), FRAC_CONST(0.33680686354637) }, { FRAC_CONST(-0.70467054843903), FRAC_CONST(0.93272775411606) }, { FRAC_CONST(0.99846023321152), FRAC_CONST(-0.98725748062134) }, { FRAC_CONST(-0.63364970684052), FRAC_CONST(-0.16473594307899) }, { FRAC_CONST(-0.16258217394352), FRAC_CONST(-0.95939123630524) }, { FRAC_CONST(-0.43645593523979), FRAC_CONST(-0.94805032014847) }, { FRAC_CONST(-0.99848473072052), FRAC_CONST(0.96245169639587) }, { FRAC_CONST(-0.16796459257603), FRAC_CONST(-0.98987513780594) }, { FRAC_CONST(-0.87979227304459), FRAC_CONST(-0.71725726127625) }, { FRAC_CONST(0.44183099269867), FRAC_CONST(-0.93568974733353) }, { FRAC_CONST(0.93310177326202), FRAC_CONST(-0.99913311004639) }, { FRAC_CONST(-0.93941932916641), FRAC_CONST(-0.56409376859665) }, { FRAC_CONST(-0.88590002059937), FRAC_CONST(0.47624599933624) }, { FRAC_CONST(0.99971461296082), FRAC_CONST(-0.83889955282211) }, { FRAC_CONST(-0.75376385450363), FRAC_CONST(0.00814643409103) }, { FRAC_CONST(0.93887686729431), FRAC_CONST(-0.11284527927637) }, { FRAC_CONST(0.85126435756683), FRAC_CONST(0.52349251508713) }, { FRAC_CONST(0.39701420068741), FRAC_CONST(0.81779634952545) }, { FRAC_CONST(-0.37024465203285), FRAC_CONST(-0.87071657180786) }, { FRAC_CONST(-0.36024826765060), FRAC_CONST(0.34655734896660) }, { FRAC_CONST(-0.93388813734055), FRAC_CONST(-0.84476542472839) }, { FRAC_CONST(-0.65298801660538), FRAC_CONST(-0.18439576029778) }, { FRAC_CONST(0.11960318684578), FRAC_CONST(0.99899345636368) }, { FRAC_CONST(0.94292563199997), FRAC_CONST(0.83163905143738) }, { FRAC_CONST(0.75081145763397), FRAC_CONST(-0.35533222556114) }, { FRAC_CONST(0.56721979379654), FRAC_CONST(-0.24076835811138) }, { FRAC_CONST(0.46857765316963), FRAC_CONST(-0.30140233039856) }, { FRAC_CONST(0.97312313318253), FRAC_CONST(-0.99548190832138) }, { FRAC_CONST(-0.38299977779388), FRAC_CONST(0.98516911268234) }, { FRAC_CONST(0.41025799512863), FRAC_CONST(0.02116736955941) }, { FRAC_CONST(0.09638062119484), FRAC_CONST(0.04411984235048) }, { FRAC_CONST(-0.85283249616623), FRAC_CONST(0.91475564241409) }, { FRAC_CONST(0.88866806030273), FRAC_CONST(-0.99735265970230) }, { FRAC_CONST(-0.48202428221703), FRAC_CONST(-0.96805608272552) }, { FRAC_CONST(0.27572581171989), FRAC_CONST(0.58634752035141) }, { FRAC_CONST(-0.65889132022858), FRAC_CONST(0.58835631608963) }, { FRAC_CONST(0.98838084936142), FRAC_CONST(0.99994349479675) }, { FRAC_CONST(-0.20651349425316), FRAC_CONST(0.54593044519424) }, { FRAC_CONST(-0.62126415967941), FRAC_CONST(-0.59893679618835) }, { FRAC_CONST(0.20320105552673), FRAC_CONST(-0.86879181861877) }, { FRAC_CONST(-0.97790551185608), FRAC_CONST(0.96290808916092) }, { FRAC_CONST(0.11112534999847), FRAC_CONST(0.21484763920307) }, { FRAC_CONST(-0.41368338465691), FRAC_CONST(0.28216838836670) }, { FRAC_CONST(0.24133038520813), FRAC_CONST(0.51294362545013) }, { FRAC_CONST(-0.66393411159515), FRAC_CONST(-0.08249679952860) }, { FRAC_CONST(-0.53697830438614), FRAC_CONST(-0.97649902105331) }, { FRAC_CONST(-0.97224736213684), FRAC_CONST(0.22081333398819) }, { FRAC_CONST(0.87392479181290), FRAC_CONST(-0.12796173989773) }, { FRAC_CONST(0.19050361216068), FRAC_CONST(0.01602615416050) }, { FRAC_CONST(-0.46353441476822), FRAC_CONST(-0.95249038934708) }, { FRAC_CONST(-0.07064096629620), FRAC_CONST(-0.94479805231094) }, { FRAC_CONST(-0.92444086074829), FRAC_CONST(-0.10457590222359) }, { FRAC_CONST(-0.83822596073151), FRAC_CONST(-0.01695043221116) }, { FRAC_CONST(0.75214684009552), FRAC_CONST(-0.99955683946609) }, { FRAC_CONST(-0.42102998495102), FRAC_CONST(0.99720942974091) }, { FRAC_CONST(-0.72094786167145), FRAC_CONST(-0.35008960962296) }, { FRAC_CONST(0.78843313455582), FRAC_CONST(0.52851396799088) }, { FRAC_CONST(0.97394025325775), FRAC_CONST(-0.26695942878723) }, { FRAC_CONST(0.99206465482712), FRAC_CONST(-0.57010120153427) }, { FRAC_CONST(0.76789611577988), FRAC_CONST(-0.76519358158112) }, { FRAC_CONST(-0.82002419233322), FRAC_CONST(-0.73530179262161) }, { FRAC_CONST(0.81924992799759), FRAC_CONST(0.99698424339294) }, { FRAC_CONST(-0.26719850301743), FRAC_CONST(0.68903368711472) }, { FRAC_CONST(-0.43311259150505), FRAC_CONST(0.85321813821793) }, { FRAC_CONST(0.99194979667664), FRAC_CONST(0.91876250505447) }, { FRAC_CONST(-0.80691999197006), FRAC_CONST(-0.32627540826797) }, { FRAC_CONST(0.43080005049706), FRAC_CONST(-0.21919095516205) }, { FRAC_CONST(0.67709493637085), FRAC_CONST(-0.95478075742722) }, { FRAC_CONST(0.56151771545410), FRAC_CONST(-0.70693808794022) }, { FRAC_CONST(0.10831862688065), FRAC_CONST(-0.08628837019205) }, { FRAC_CONST(0.91229414939880), FRAC_CONST(-0.65987348556519) }, { FRAC_CONST(-0.48972892761230), FRAC_CONST(0.56289243698120) }, { FRAC_CONST(-0.89033657312393), FRAC_CONST(-0.71656566858292) }, { FRAC_CONST(0.65269446372986), FRAC_CONST(0.65916007757187) }, { FRAC_CONST(0.67439478635788), FRAC_CONST(-0.81684380769730) }, { FRAC_CONST(-0.47770830988884), FRAC_CONST(-0.16789555549622) }, { FRAC_CONST(-0.99715977907181), FRAC_CONST(-0.93565785884857) }, { FRAC_CONST(-0.90889590978622), FRAC_CONST(0.62034398317337) }, { FRAC_CONST(-0.06618622690439), FRAC_CONST(-0.23812216520309) }, { FRAC_CONST(0.99430269002914), FRAC_CONST(0.18812555074692) }, { FRAC_CONST(0.97686403989792), FRAC_CONST(-0.28664535284042) }, { FRAC_CONST(0.94813650846481), FRAC_CONST(-0.97506642341614) }, { FRAC_CONST(-0.95434498786926), FRAC_CONST(-0.79607981443405) }, { FRAC_CONST(-0.49104782938957), FRAC_CONST(0.32895213365555) }, { FRAC_CONST(0.99881172180176), FRAC_CONST(0.88993984460831) }, { FRAC_CONST(0.50449168682098), FRAC_CONST(-0.85995072126389) }, { FRAC_CONST(0.47162890434265), FRAC_CONST(-0.18680204451084) }, { FRAC_CONST(-0.62081581354141), FRAC_CONST(0.75000673532486) }, { FRAC_CONST(-0.43867015838623), FRAC_CONST(0.99998068809509) }, { FRAC_CONST(0.98630565404892), FRAC_CONST(-0.53578901290894) }, { FRAC_CONST(-0.61510360240936), FRAC_CONST(-0.89515018463135) }, { FRAC_CONST(-0.03841517493129), FRAC_CONST(-0.69888818264008) }, { FRAC_CONST(-0.30102157592773), FRAC_CONST(-0.07667808979750) }, { FRAC_CONST(0.41881284117699), FRAC_CONST(0.02188098989427) }, { FRAC_CONST(-0.86135452985764), FRAC_CONST(0.98947483301163) }, { FRAC_CONST(0.67226862907410), FRAC_CONST(-0.13494388759136) }, { FRAC_CONST(-0.70737397670746), FRAC_CONST(-0.76547348499298) }, { FRAC_CONST(0.94044947624207), FRAC_CONST(0.09026201069355) }, { FRAC_CONST(-0.82386350631714), FRAC_CONST(0.08924768865108) }, { FRAC_CONST(-0.32070666551590), FRAC_CONST(0.50143420696259) }, { FRAC_CONST(0.57593160867691), FRAC_CONST(-0.98966425657272) }, { FRAC_CONST(-0.36326017975807), FRAC_CONST(0.07440242916346) }, { FRAC_CONST(0.99979043006897), FRAC_CONST(-0.14130286872387) }, { FRAC_CONST(-0.92366021871567), FRAC_CONST(-0.97979295253754) }, { FRAC_CONST(-0.44607177376747), FRAC_CONST(-0.54233253002167) }, { FRAC_CONST(0.44226801395416), FRAC_CONST(0.71326756477356) }, { FRAC_CONST(0.03671907261014), FRAC_CONST(0.63606387376785) }, { FRAC_CONST(0.52175426483154), FRAC_CONST(-0.85396826267242) }, { FRAC_CONST(-0.94701141119003), FRAC_CONST(-0.01826348155737) }, { FRAC_CONST(-0.98759609460831), FRAC_CONST(0.82288712263107) }, { FRAC_CONST(0.87434792518616), FRAC_CONST(0.89399492740631) }, { FRAC_CONST(-0.93412041664124), FRAC_CONST(0.41374051570892) }, { FRAC_CONST(0.96063941717148), FRAC_CONST(0.93116706609726) }, { FRAC_CONST(0.97534251213074), FRAC_CONST(0.86150932312012) }, { FRAC_CONST(0.99642467498779), FRAC_CONST(0.70190042257309) }, { FRAC_CONST(-0.94705086946487), FRAC_CONST(-0.29580041766167) }, { FRAC_CONST(0.91599804162979), FRAC_CONST(-0.98147833347321) } }; #ifdef __cplusplus #endif #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/sbr_qmf.c
C
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_qmf.c,v 1.32 2007/11/01 12:33:36 menno Exp $ **/ #include "common.h" #include "structs.h" #ifdef SBR_DEC #include <stdlib.h> #include <string.h> #include "sbr_dct.h" #include "sbr_qmf.h" #include "sbr_qmf_c.h" #include "sbr_syntax.h" qmfa_info *qmfa_init(uint8_t channels) { qmfa_info *qmfa = (qmfa_info*)faad_malloc(sizeof(qmfa_info)); /* x is implemented as double ringbuffer */ qmfa->x = (real_t*)faad_malloc(2 * channels * 10 * sizeof(real_t)); memset(qmfa->x, 0, 2 * channels * 10 * sizeof(real_t)); /* ringbuffer index */ qmfa->x_index = 0; qmfa->channels = channels; return qmfa; } void qmfa_end(qmfa_info *qmfa) { if (qmfa) { if (qmfa->x) faad_free(qmfa->x); faad_free(qmfa); } } void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input, qmf_t X[MAX_NTSRHFG][64], uint8_t offset, uint8_t kx) { ALIGN real_t u[64]; #ifndef SBR_LOW_POWER ALIGN real_t in_real[32], in_imag[32], out_real[32], out_imag[32]; #else ALIGN real_t y[32]; #endif uint32_t in = 0; uint8_t l; /* qmf subsample l */ for (l = 0; l < sbr->numTimeSlotsRate; l++) { int16_t n; /* shift input buffer x */ /* input buffer is not shifted anymore, x is implemented as double ringbuffer */ //memmove(qmfa->x + 32, qmfa->x, (320-32)*sizeof(real_t)); /* add new samples to input buffer x */ for (n = 32 - 1; n >= 0; n--) { #ifdef FIXED_POINT qmfa->x[qmfa->x_index + n] = qmfa->x[qmfa->x_index + n + 320] = (input[in++]) >> 4; #else qmfa->x[qmfa->x_index + n] = qmfa->x[qmfa->x_index + n + 320] = input[in++]; #endif } /* window and summation to create array u */ for (n = 0; n < 64; n++) { u[n] = MUL_F(qmfa->x[qmfa->x_index + n], qmf_c[2*n]) + MUL_F(qmfa->x[qmfa->x_index + n + 64], qmf_c[2*(n + 64)]) + MUL_F(qmfa->x[qmfa->x_index + n + 128], qmf_c[2*(n + 128)]) + MUL_F(qmfa->x[qmfa->x_index + n + 192], qmf_c[2*(n + 192)]) + MUL_F(qmfa->x[qmfa->x_index + n + 256], qmf_c[2*(n + 256)]); } /* update ringbuffer index */ qmfa->x_index -= 32; if (qmfa->x_index < 0) qmfa->x_index = (320-32); /* calculate 32 subband samples by introducing X */ #ifdef SBR_LOW_POWER y[0] = u[48]; for (n = 1; n < 16; n++) y[n] = u[n+48] + u[48-n]; for (n = 16; n < 32; n++) y[n] = -u[n-16] + u[48-n]; DCT3_32_unscaled(u, y); for (n = 0; n < 32; n++) { if (n < kx) { #ifdef FIXED_POINT QMF_RE(X[l + offset][n]) = u[n] /*<< 1*/; #else QMF_RE(X[l + offset][n]) = 2. * u[n]; #endif } else { QMF_RE(X[l + offset][n]) = 0; } } #else // Reordering of data moved from DCT_IV to here in_imag[31] = u[1]; in_real[0] = u[0]; for (n = 1; n < 31; n++) { in_imag[31 - n] = u[n+1]; in_real[n] = -u[64-n]; } in_imag[0] = u[32]; in_real[31] = -u[33]; // dct4_kernel is DCT_IV without reordering which is done before and after FFT dct4_kernel(in_real, in_imag, out_real, out_imag); // Reordering of data moved from DCT_IV to here for (n = 0; n < 16; n++) { if (2*n+1 < kx) { #ifdef FIXED_POINT QMF_RE(X[l + offset][2*n]) = out_real[n]; QMF_IM(X[l + offset][2*n]) = out_imag[n]; QMF_RE(X[l + offset][2*n+1]) = -out_imag[31-n]; QMF_IM(X[l + offset][2*n+1]) = -out_real[31-n]; #else QMF_RE(X[l + offset][2*n]) = 2. * out_real[n]; QMF_IM(X[l + offset][2*n]) = 2. * out_imag[n]; QMF_RE(X[l + offset][2*n+1]) = -2. * out_imag[31-n]; QMF_IM(X[l + offset][2*n+1]) = -2. * out_real[31-n]; #endif } else { if (2*n < kx) { #ifdef FIXED_POINT QMF_RE(X[l + offset][2*n]) = out_real[n]; QMF_IM(X[l + offset][2*n]) = out_imag[n]; #else QMF_RE(X[l + offset][2*n]) = 2. * out_real[n]; QMF_IM(X[l + offset][2*n]) = 2. * out_imag[n]; #endif } else { QMF_RE(X[l + offset][2*n]) = 0; QMF_IM(X[l + offset][2*n]) = 0; } QMF_RE(X[l + offset][2*n+1]) = 0; QMF_IM(X[l + offset][2*n+1]) = 0; } } #endif } } static const complex_t qmf32_pre_twiddle[] = { { FRAC_CONST(0.999924701839145), FRAC_CONST(-0.012271538285720) }, { FRAC_CONST(0.999322384588350), FRAC_CONST(-0.036807222941359) }, { FRAC_CONST(0.998118112900149), FRAC_CONST(-0.061320736302209) }, { FRAC_CONST(0.996312612182778), FRAC_CONST(-0.085797312344440) }, { FRAC_CONST(0.993906970002356), FRAC_CONST(-0.110222207293883) }, { FRAC_CONST(0.990902635427780), FRAC_CONST(-0.134580708507126) }, { FRAC_CONST(0.987301418157858), FRAC_CONST(-0.158858143333861) }, { FRAC_CONST(0.983105487431216), FRAC_CONST(-0.183039887955141) }, { FRAC_CONST(0.978317370719628), FRAC_CONST(-0.207111376192219) }, { FRAC_CONST(0.972939952205560), FRAC_CONST(-0.231058108280671) }, { FRAC_CONST(0.966976471044852), FRAC_CONST(-0.254865659604515) }, { FRAC_CONST(0.960430519415566), FRAC_CONST(-0.278519689385053) }, { FRAC_CONST(0.953306040354194), FRAC_CONST(-0.302005949319228) }, { FRAC_CONST(0.945607325380521), FRAC_CONST(-0.325310292162263) }, { FRAC_CONST(0.937339011912575), FRAC_CONST(-0.348418680249435) }, { FRAC_CONST(0.928506080473216), FRAC_CONST(-0.371317193951838) }, { FRAC_CONST(0.919113851690058), FRAC_CONST(-0.393992040061048) }, { FRAC_CONST(0.909167983090522), FRAC_CONST(-0.416429560097637) }, { FRAC_CONST(0.898674465693954), FRAC_CONST(-0.438616238538528) }, { FRAC_CONST(0.887639620402854), FRAC_CONST(-0.460538710958240) }, { FRAC_CONST(0.876070094195407), FRAC_CONST(-0.482183772079123) }, { FRAC_CONST(0.863972856121587), FRAC_CONST(-0.503538383725718) }, { FRAC_CONST(0.851355193105265), FRAC_CONST(-0.524589682678469) }, { FRAC_CONST(0.838224705554838), FRAC_CONST(-0.545324988422046) }, { FRAC_CONST(0.824589302785025), FRAC_CONST(-0.565731810783613) }, { FRAC_CONST(0.810457198252595), FRAC_CONST(-0.585797857456439) }, { FRAC_CONST(0.795836904608884), FRAC_CONST(-0.605511041404326) }, { FRAC_CONST(0.780737228572094), FRAC_CONST(-0.624859488142386) }, { FRAC_CONST(0.765167265622459), FRAC_CONST(-0.643831542889791) }, { FRAC_CONST(0.749136394523459), FRAC_CONST(-0.662415777590172) }, { FRAC_CONST(0.732654271672413), FRAC_CONST(-0.680600997795453) }, { FRAC_CONST(0.715730825283819), FRAC_CONST(-0.698376249408973) } }; qmfs_info *qmfs_init(uint8_t channels) { qmfs_info *qmfs = (qmfs_info*)faad_malloc(sizeof(qmfs_info)); /* v is a double ringbuffer */ qmfs->v = (real_t*)faad_malloc(2 * channels * 20 * sizeof(real_t)); memset(qmfs->v, 0, 2 * channels * 20 * sizeof(real_t)); qmfs->v_index = 0; qmfs->channels = channels; return qmfs; } void qmfs_end(qmfs_info *qmfs) { if (qmfs) { if (qmfs->v) faad_free(qmfs->v); faad_free(qmfs); } } #ifdef SBR_LOW_POWER void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], real_t *output) { ALIGN real_t x[16]; ALIGN real_t y[16]; int32_t n, k, out = 0; uint8_t l; /* qmf subsample l */ for (l = 0; l < sbr->numTimeSlotsRate; l++) { /* shift buffers */ /* we are not shifting v, it is a double ringbuffer */ //memmove(qmfs->v + 64, qmfs->v, (640-64)*sizeof(real_t)); /* calculate 64 samples */ for (k = 0; k < 16; k++) { #ifdef FIXED_POINT y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][31 - k])); x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][31 - k])); #else y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][31 - k])) / 32.0; x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][31 - k])) / 32.0; #endif } /* even n samples */ DCT2_16_unscaled(x, x); /* odd n samples */ DCT4_16(y, y); for (n = 8; n < 24; n++) { qmfs->v[qmfs->v_index + n*2] = qmfs->v[qmfs->v_index + 640 + n*2] = x[n-8]; qmfs->v[qmfs->v_index + n*2+1] = qmfs->v[qmfs->v_index + 640 + n*2+1] = y[n-8]; } for (n = 0; n < 16; n++) { qmfs->v[qmfs->v_index + n] = qmfs->v[qmfs->v_index + 640 + n] = qmfs->v[qmfs->v_index + 32-n]; } qmfs->v[qmfs->v_index + 48] = qmfs->v[qmfs->v_index + 640 + 48] = 0; for (n = 1; n < 16; n++) { qmfs->v[qmfs->v_index + 48+n] = qmfs->v[qmfs->v_index + 640 + 48+n] = -qmfs->v[qmfs->v_index + 48-n]; } /* calculate 32 output samples and window */ for (k = 0; k < 32; k++) { output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[2*k]) + MUL_F(qmfs->v[qmfs->v_index + 96 + k], qmf_c[64 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 128 + k], qmf_c[128 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 224 + k], qmf_c[192 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[256 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 352 + k], qmf_c[320 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 384 + k], qmf_c[384 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 480 + k], qmf_c[448 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[512 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 608 + k], qmf_c[576 + 2*k]); } /* update the ringbuffer index */ qmfs->v_index -= 64; if (qmfs->v_index < 0) qmfs->v_index = (640-64); } } void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], real_t *output) { ALIGN real_t x[64]; ALIGN real_t y[64]; int32_t n, k, out = 0; uint8_t l; /* qmf subsample l */ for (l = 0; l < sbr->numTimeSlotsRate; l++) { /* shift buffers */ /* we are not shifting v, it is a double ringbuffer */ //memmove(qmfs->v + 128, qmfs->v, (1280-128)*sizeof(real_t)); /* calculate 128 samples */ for (k = 0; k < 32; k++) { #ifdef FIXED_POINT y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][63 - k])); x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][63 - k])); #else y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][63 - k])) / 32.0; x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][63 - k])) / 32.0; #endif } /* even n samples */ DCT2_32_unscaled(x, x); /* odd n samples */ DCT4_32(y, y); for (n = 16; n < 48; n++) { qmfs->v[qmfs->v_index + n*2] = qmfs->v[qmfs->v_index + 1280 + n*2] = x[n-16]; qmfs->v[qmfs->v_index + n*2+1] = qmfs->v[qmfs->v_index + 1280 + n*2+1] = y[n-16]; } for (n = 0; n < 32; n++) { qmfs->v[qmfs->v_index + n] = qmfs->v[qmfs->v_index + 1280 + n] = qmfs->v[qmfs->v_index + 64-n]; } qmfs->v[qmfs->v_index + 96] = qmfs->v[qmfs->v_index + 1280 + 96] = 0; for (n = 1; n < 32; n++) { qmfs->v[qmfs->v_index + 96+n] = qmfs->v[qmfs->v_index + 1280 + 96+n] = -qmfs->v[qmfs->v_index + 96-n]; } /* calculate 64 output samples and window */ for (k = 0; k < 64; k++) { output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[k]) + MUL_F(qmfs->v[qmfs->v_index + 192 + k], qmf_c[64 + k]) + MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[128 + k]) + MUL_F(qmfs->v[qmfs->v_index + 256 + 192 + k], qmf_c[128 + 64 + k]) + MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[256 + k]) + MUL_F(qmfs->v[qmfs->v_index + 512 + 192 + k], qmf_c[256 + 64 + k]) + MUL_F(qmfs->v[qmfs->v_index + 768 + k], qmf_c[384 + k]) + MUL_F(qmfs->v[qmfs->v_index + 768 + 192 + k], qmf_c[384 + 64 + k]) + MUL_F(qmfs->v[qmfs->v_index + 1024 + k], qmf_c[512 + k]) + MUL_F(qmfs->v[qmfs->v_index + 1024 + 192 + k], qmf_c[512 + 64 + k]); } /* update the ringbuffer index */ qmfs->v_index -= 128; if (qmfs->v_index < 0) qmfs->v_index = (1280-128); } } #else void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], real_t *output) { ALIGN real_t x1[32], x2[32]; #ifndef FIXED_POINT real_t scale = 1.f/64.f; #endif int32_t n, k, out = 0; uint8_t l; /* qmf subsample l */ for (l = 0; l < sbr->numTimeSlotsRate; l++) { /* shift buffer v */ /* buffer is not shifted, we are using a ringbuffer */ //memmove(qmfs->v + 64, qmfs->v, (640-64)*sizeof(real_t)); /* calculate 64 samples */ /* complex pre-twiddle */ for (k = 0; k < 32; k++) { x1[k] = MUL_F(QMF_RE(X[l][k]), RE(qmf32_pre_twiddle[k])) - MUL_F(QMF_IM(X[l][k]), IM(qmf32_pre_twiddle[k])); x2[k] = MUL_F(QMF_IM(X[l][k]), RE(qmf32_pre_twiddle[k])) + MUL_F(QMF_RE(X[l][k]), IM(qmf32_pre_twiddle[k])); #ifndef FIXED_POINT x1[k] *= scale; x2[k] *= scale; #else x1[k] >>= 1; x2[k] >>= 1; #endif } /* transform */ DCT4_32(x1, x1); DST4_32(x2, x2); for (n = 0; n < 32; n++) { qmfs->v[qmfs->v_index + n] = qmfs->v[qmfs->v_index + 640 + n] = -x1[n] + x2[n]; qmfs->v[qmfs->v_index + 63 - n] = qmfs->v[qmfs->v_index + 640 + 63 - n] = x1[n] + x2[n]; } /* calculate 32 output samples and window */ for (k = 0; k < 32; k++) { output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[2*k]) + MUL_F(qmfs->v[qmfs->v_index + 96 + k], qmf_c[64 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 128 + k], qmf_c[128 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 224 + k], qmf_c[192 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[256 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 352 + k], qmf_c[320 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 384 + k], qmf_c[384 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 480 + k], qmf_c[448 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[512 + 2*k]) + MUL_F(qmfs->v[qmfs->v_index + 608 + k], qmf_c[576 + 2*k]); } /* update ringbuffer index */ qmfs->v_index -= 64; if (qmfs->v_index < 0) qmfs->v_index = (640 - 64); } } void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], real_t *output) { // ALIGN real_t x1[64], x2[64]; #ifndef SBR_LOW_POWER ALIGN real_t in_real1[32], in_imag1[32], out_real1[32], out_imag1[32]; ALIGN real_t in_real2[32], in_imag2[32], out_real2[32], out_imag2[32]; #endif qmf_t * pX; real_t * pring_buffer_1, * pring_buffer_3; // real_t * ptemp_1, * ptemp_2; #ifdef PREFER_POINTERS // These pointers are used if target platform has autoinc address generators real_t * pring_buffer_2, * pring_buffer_4; real_t * pring_buffer_5, * pring_buffer_6; real_t * pring_buffer_7, * pring_buffer_8; real_t * pring_buffer_9, * pring_buffer_10; const real_t * pqmf_c_1, * pqmf_c_2, * pqmf_c_3, * pqmf_c_4; const real_t * pqmf_c_5, * pqmf_c_6, * pqmf_c_7, * pqmf_c_8; const real_t * pqmf_c_9, * pqmf_c_10; #endif // #ifdef PREFER_POINTERS #ifndef FIXED_POINT real_t scale = 1.f/64.f; #endif int32_t n, k, out = 0; uint8_t l; /* qmf subsample l */ for (l = 0; l < sbr->numTimeSlotsRate; l++) { /* shift buffer v */ /* buffer is not shifted, we use double ringbuffer */ //memmove(qmfs->v + 128, qmfs->v, (1280-128)*sizeof(real_t)); /* calculate 128 samples */ #ifndef FIXED_POINT pX = X[l]; in_imag1[31] = scale*QMF_RE(pX[1]); in_real1[0] = scale*QMF_RE(pX[0]); in_imag2[31] = scale*QMF_IM(pX[63-1]); in_real2[0] = scale*QMF_IM(pX[63-0]); for (k = 1; k < 31; k++) { in_imag1[31 - k] = scale*QMF_RE(pX[2*k + 1]); in_real1[ k] = scale*QMF_RE(pX[2*k ]); in_imag2[31 - k] = scale*QMF_IM(pX[63 - (2*k + 1)]); in_real2[ k] = scale*QMF_IM(pX[63 - (2*k )]); } in_imag1[0] = scale*QMF_RE(pX[63]); in_real1[31] = scale*QMF_RE(pX[62]); in_imag2[0] = scale*QMF_IM(pX[63-63]); in_real2[31] = scale*QMF_IM(pX[63-62]); #else pX = X[l]; in_imag1[31] = QMF_RE(pX[1]) >> 1; in_real1[0] = QMF_RE(pX[0]) >> 1; in_imag2[31] = QMF_IM(pX[62]) >> 1; in_real2[0] = QMF_IM(pX[63]) >> 1; for (k = 1; k < 31; k++) { in_imag1[31 - k] = QMF_RE(pX[2*k + 1]) >> 1; in_real1[ k] = QMF_RE(pX[2*k ]) >> 1; in_imag2[31 - k] = QMF_IM(pX[63 - (2*k + 1)]) >> 1; in_real2[ k] = QMF_IM(pX[63 - (2*k )]) >> 1; } in_imag1[0] = QMF_RE(pX[63]) >> 1; in_real1[31] = QMF_RE(pX[62]) >> 1; in_imag2[0] = QMF_IM(pX[0]) >> 1; in_real2[31] = QMF_IM(pX[1]) >> 1; #endif // dct4_kernel is DCT_IV without reordering which is done before and after FFT dct4_kernel(in_real1, in_imag1, out_real1, out_imag1); dct4_kernel(in_real2, in_imag2, out_real2, out_imag2); pring_buffer_1 = qmfs->v + qmfs->v_index; pring_buffer_3 = pring_buffer_1 + 1280; #ifdef PREFER_POINTERS pring_buffer_2 = pring_buffer_1 + 127; pring_buffer_4 = pring_buffer_1 + (1280 + 127); #endif // #ifdef PREFER_POINTERS // ptemp_1 = x1; // ptemp_2 = x2; #ifdef PREFER_POINTERS for (n = 0; n < 32; n ++) { //real_t x1 = *ptemp_1++; //real_t x2 = *ptemp_2++; // pring_buffer_3 and pring_buffer_4 are needed only for double ring buffer *pring_buffer_1++ = *pring_buffer_3++ = out_real2[n] - out_real1[n]; *pring_buffer_2-- = *pring_buffer_4-- = out_real2[n] + out_real1[n]; //x1 = *ptemp_1++; //x2 = *ptemp_2++; *pring_buffer_1++ = *pring_buffer_3++ = out_imag2[31-n] + out_imag1[31-n]; *pring_buffer_2-- = *pring_buffer_4-- = out_imag2[31-n] - out_imag1[31-n]; } #else // #ifdef PREFER_POINTERS for (n = 0; n < 32; n++) { // pring_buffer_3 and pring_buffer_4 are needed only for double ring buffer pring_buffer_1[2*n] = pring_buffer_3[2*n] = out_real2[n] - out_real1[n]; pring_buffer_1[127-2*n] = pring_buffer_3[127-2*n] = out_real2[n] + out_real1[n]; pring_buffer_1[2*n+1] = pring_buffer_3[2*n+1] = out_imag2[31-n] + out_imag1[31-n]; pring_buffer_1[127-(2*n+1)] = pring_buffer_3[127-(2*n+1)] = out_imag2[31-n] - out_imag1[31-n]; } #endif // #ifdef PREFER_POINTERS pring_buffer_1 = qmfs->v + qmfs->v_index; #ifdef PREFER_POINTERS pring_buffer_2 = pring_buffer_1 + 192; pring_buffer_3 = pring_buffer_1 + 256; pring_buffer_4 = pring_buffer_1 + (256 + 192); pring_buffer_5 = pring_buffer_1 + 512; pring_buffer_6 = pring_buffer_1 + (512 + 192); pring_buffer_7 = pring_buffer_1 + 768; pring_buffer_8 = pring_buffer_1 + (768 + 192); pring_buffer_9 = pring_buffer_1 + 1024; pring_buffer_10 = pring_buffer_1 + (1024 + 192); pqmf_c_1 = qmf_c; pqmf_c_2 = qmf_c + 64; pqmf_c_3 = qmf_c + 128; pqmf_c_4 = qmf_c + 192; pqmf_c_5 = qmf_c + 256; pqmf_c_6 = qmf_c + 320; pqmf_c_7 = qmf_c + 384; pqmf_c_8 = qmf_c + 448; pqmf_c_9 = qmf_c + 512; pqmf_c_10 = qmf_c + 576; #endif // #ifdef PREFER_POINTERS /* calculate 64 output samples and window */ for (k = 0; k < 64; k++) { #ifdef PREFER_POINTERS output[out++] = MUL_F(*pring_buffer_1++, *pqmf_c_1++) + MUL_F(*pring_buffer_2++, *pqmf_c_2++) + MUL_F(*pring_buffer_3++, *pqmf_c_3++) + MUL_F(*pring_buffer_4++, *pqmf_c_4++) + MUL_F(*pring_buffer_5++, *pqmf_c_5++) + MUL_F(*pring_buffer_6++, *pqmf_c_6++) + MUL_F(*pring_buffer_7++, *pqmf_c_7++) + MUL_F(*pring_buffer_8++, *pqmf_c_8++) + MUL_F(*pring_buffer_9++, *pqmf_c_9++) + MUL_F(*pring_buffer_10++, *pqmf_c_10++); #else // #ifdef PREFER_POINTERS output[out++] = MUL_F(pring_buffer_1[k+0], qmf_c[k+0]) + MUL_F(pring_buffer_1[k+192], qmf_c[k+64]) + MUL_F(pring_buffer_1[k+256], qmf_c[k+128]) + MUL_F(pring_buffer_1[k+(256+192)], qmf_c[k+192]) + MUL_F(pring_buffer_1[k+512], qmf_c[k+256]) + MUL_F(pring_buffer_1[k+(512+192)], qmf_c[k+320]) + MUL_F(pring_buffer_1[k+768], qmf_c[k+384]) + MUL_F(pring_buffer_1[k+(768+192)], qmf_c[k+448]) + MUL_F(pring_buffer_1[k+1024], qmf_c[k+512]) + MUL_F(pring_buffer_1[k+(1024+192)], qmf_c[k+576]); #endif // #ifdef PREFER_POINTERS } /* update ringbuffer index */ qmfs->v_index -= 128; if (qmfs->v_index < 0) qmfs->v_index = (1280 - 128); } } #endif #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/sbr_qmf.h
C/C++ Header
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_qmf.h,v 1.25 2007/11/01 12:33:36 menno Exp $ **/ #ifndef __SBR_QMF_H__ #define __SBR_QMF_H__ #ifdef __cplusplus extern "C" { #endif qmfa_info *qmfa_init(uint8_t channels); void qmfa_end(qmfa_info *qmfa); qmfs_info *qmfs_init(uint8_t channels); void qmfs_end(qmfs_info *qmfs); void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input, qmf_t X[MAX_NTSRHFG][64], uint8_t offset, uint8_t kx); void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], real_t *output); void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], real_t *output); #ifdef __cplusplus } #endif #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/sbr_qmf_c.h
C/C++ Header
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_qmf_c.h,v 1.17 2007/11/01 12:33:36 menno Exp $ **/ #ifndef __SBR_QMF_C_H__ #define __SBR_QMF_C_H__ #ifdef __cplusplus extern "C" { #endif #ifdef _MSC_VER #pragma warning(disable:4305) #pragma warning(disable:4244) #endif ALIGN static const real_t qmf_c[640] = { FRAC_CONST(0), FRAC_CONST(-0.00055252865047), FRAC_CONST(-0.00056176925738), FRAC_CONST(-0.00049475180896), FRAC_CONST(-0.00048752279712), FRAC_CONST(-0.00048937912498), FRAC_CONST(-0.00050407143497), FRAC_CONST(-0.00052265642972), FRAC_CONST(-0.00054665656337), FRAC_CONST(-0.00056778025613), FRAC_CONST(-0.00058709304852), FRAC_CONST(-0.00061327473938), FRAC_CONST(-0.00063124935319), FRAC_CONST(-0.00065403333621), FRAC_CONST(-0.00067776907764), FRAC_CONST(-0.00069416146273), FRAC_CONST(-0.00071577364744), FRAC_CONST(-0.00072550431222), FRAC_CONST(-0.00074409418541), FRAC_CONST(-0.00074905980532), FRAC_CONST(-0.0007681371927), FRAC_CONST(-0.00077248485949), FRAC_CONST(-0.00078343322877), FRAC_CONST(-0.00077798694927), FRAC_CONST(-0.000780366471), FRAC_CONST(-0.00078014496257), FRAC_CONST(-0.0007757977331), FRAC_CONST(-0.00076307935757), FRAC_CONST(-0.00075300014201), FRAC_CONST(-0.00073193571525), FRAC_CONST(-0.00072153919876), FRAC_CONST(-0.00069179375372), FRAC_CONST(-0.00066504150893), FRAC_CONST(-0.00063415949025), FRAC_CONST(-0.0005946118933), FRAC_CONST(-0.00055645763906), FRAC_CONST(-0.00051455722108), FRAC_CONST(-0.00046063254803), FRAC_CONST(-0.00040951214522), FRAC_CONST(-0.00035011758756), FRAC_CONST(-0.00028969811748), FRAC_CONST(-0.0002098337344), FRAC_CONST(-0.00014463809349), FRAC_CONST(-6.173344072E-005), FRAC_CONST(1.349497418E-005), FRAC_CONST(0.00010943831274), FRAC_CONST(0.00020430170688), FRAC_CONST(0.00029495311041), FRAC_CONST(0.0004026540216), FRAC_CONST(0.00051073884952), FRAC_CONST(0.00062393761391), FRAC_CONST(0.00074580258865), FRAC_CONST(0.00086084433262), FRAC_CONST(0.00098859883015), FRAC_CONST(0.00112501551307), FRAC_CONST(0.00125778846475), FRAC_CONST(0.00139024948272), FRAC_CONST(0.00154432198471), FRAC_CONST(0.00168680832531), FRAC_CONST(0.00183482654224), FRAC_CONST(0.00198411407369), FRAC_CONST(0.00214615835557), FRAC_CONST(0.00230172547746), FRAC_CONST(0.00246256169126), FRAC_CONST(0.00262017586902), FRAC_CONST(0.00278704643465), FRAC_CONST(0.00294694477165), FRAC_CONST(0.00311254206525), FRAC_CONST(0.00327396134847), FRAC_CONST(0.00344188741828), FRAC_CONST(0.00360082681231), FRAC_CONST(0.00376039229104), FRAC_CONST(0.00392074323703), FRAC_CONST(0.00408197531935), FRAC_CONST(0.0042264269227), FRAC_CONST(0.00437307196781), FRAC_CONST(0.00452098527825), FRAC_CONST(0.00466064606118), FRAC_CONST(0.00479325608498), FRAC_CONST(0.00491376035745), FRAC_CONST(0.00503930226013), FRAC_CONST(0.00514073539032), FRAC_CONST(0.00524611661324), FRAC_CONST(0.00534716811982), FRAC_CONST(0.00541967759307), FRAC_CONST(0.00548760401507), FRAC_CONST(0.00554757145088), FRAC_CONST(0.00559380230045), FRAC_CONST(0.00562206432097), FRAC_CONST(0.00564551969164), FRAC_CONST(0.00563891995151), FRAC_CONST(0.00562661141932), FRAC_CONST(0.0055917128663), FRAC_CONST(0.005540436394), FRAC_CONST(0.0054753783077), FRAC_CONST(0.0053838975897), FRAC_CONST(0.00527157587272), FRAC_CONST(0.00513822754514), FRAC_CONST(0.00498396877629), FRAC_CONST(0.004810946906), FRAC_CONST(0.00460395301471), FRAC_CONST(0.00438018617447), FRAC_CONST(0.0041251642327), FRAC_CONST(0.00384564081246), FRAC_CONST(0.00354012465507), FRAC_CONST(0.00320918858098), FRAC_CONST(0.00284467578623), FRAC_CONST(0.00245085400321), FRAC_CONST(0.0020274176185), FRAC_CONST(0.00157846825768), FRAC_CONST(0.00109023290512), FRAC_CONST(0.0005832264248), FRAC_CONST(2.760451905E-005), FRAC_CONST(-0.00054642808664), FRAC_CONST(-0.00115681355227), FRAC_CONST(-0.00180394725893), FRAC_CONST(-0.00248267236449), FRAC_CONST(-0.003193377839), FRAC_CONST(-0.00394011240522), FRAC_CONST(-0.004722259624), FRAC_CONST(-0.00553372111088), FRAC_CONST(-0.00637922932685), FRAC_CONST(-0.00726158168517), FRAC_CONST(-0.00817982333726), FRAC_CONST(-0.00913253296085), FRAC_CONST(-0.01011502154986), FRAC_CONST(-0.01113155480321), FRAC_CONST(-0.01218499959508), FRAC_CONST(0.01327182200351), FRAC_CONST(0.01439046660792), FRAC_CONST(0.01554055533423), FRAC_CONST(0.01673247129989), FRAC_CONST(0.01794333813443), FRAC_CONST(0.01918724313698), FRAC_CONST(0.02045317933555), FRAC_CONST(0.02174675502535), FRAC_CONST(0.02306801692862), FRAC_CONST(0.02441609920285), FRAC_CONST(0.02578758475467), FRAC_CONST(0.02718594296329), FRAC_CONST(0.02860721736385), FRAC_CONST(0.03005026574279), FRAC_CONST(0.03150176087389), FRAC_CONST(0.03297540810337), FRAC_CONST(0.03446209487686), FRAC_CONST(0.03596975605542), FRAC_CONST(0.03748128504252), FRAC_CONST(0.03900536794745), FRAC_CONST(0.04053491705584), FRAC_CONST(0.04206490946367), FRAC_CONST(0.04360975421304), FRAC_CONST(0.04514884056413), FRAC_CONST(0.04668430272642), FRAC_CONST(0.04821657200672), FRAC_CONST(0.04973857556014), FRAC_CONST(0.05125561555216), FRAC_CONST(0.05276307465207), FRAC_CONST(0.05424527683589), FRAC_CONST(0.05571736482138), FRAC_CONST(0.05716164501299), FRAC_CONST(0.0585915683626), FRAC_CONST(0.05998374801761), FRAC_CONST(0.06134551717207), FRAC_CONST(0.06268578081172), FRAC_CONST(0.06397158980681), FRAC_CONST(0.0652247106438), FRAC_CONST(0.06643675122104), FRAC_CONST(0.06760759851228), FRAC_CONST(0.06870438283512), FRAC_CONST(0.06976302447127), FRAC_CONST(0.07076287107266), FRAC_CONST(0.07170026731102), FRAC_CONST(0.07256825833083), FRAC_CONST(0.07336202550803), FRAC_CONST(0.07410036424342), FRAC_CONST(0.07474525581194), FRAC_CONST(0.07531373362019), FRAC_CONST(0.07580083586584), FRAC_CONST(0.07619924793396), FRAC_CONST(0.07649921704119), FRAC_CONST(0.07670934904245), FRAC_CONST(0.07681739756964), FRAC_CONST(0.07682300113923), FRAC_CONST(0.07672049241746), FRAC_CONST(0.07650507183194), FRAC_CONST(0.07617483218536), FRAC_CONST(0.07573057565061), FRAC_CONST(0.0751576255287), FRAC_CONST(0.07446643947564), FRAC_CONST(0.0736406005762), FRAC_CONST(0.07267746427299), FRAC_CONST(0.07158263647903), FRAC_CONST(0.07035330735093), FRAC_CONST(0.06896640131951), FRAC_CONST(0.06745250215166), FRAC_CONST(0.06576906686508), FRAC_CONST(0.06394448059633), FRAC_CONST(0.06196027790387), FRAC_CONST(0.0598166570809), FRAC_CONST(0.05751526919867), FRAC_CONST(0.05504600343009), FRAC_CONST(0.05240938217366), FRAC_CONST(0.04959786763445), FRAC_CONST(0.04663033051701), FRAC_CONST(0.04347687821958), FRAC_CONST(0.04014582784127), FRAC_CONST(0.03664181168133), FRAC_CONST(0.03295839306691), FRAC_CONST(0.02908240060125), FRAC_CONST(0.02503075618909), FRAC_CONST(0.02079970728622), FRAC_CONST(0.01637012582228), FRAC_CONST(0.01176238327857), FRAC_CONST(0.00696368621617), FRAC_CONST(0.00197656014503), FRAC_CONST(-0.00320868968304), FRAC_CONST(-0.00857117491366), FRAC_CONST(-0.01412888273558), FRAC_CONST(-0.01988341292573), FRAC_CONST(-0.02582272888064), FRAC_CONST(-0.03195312745332), FRAC_CONST(-0.03827765720822), FRAC_CONST(-0.04478068215856), FRAC_CONST(-0.05148041767934), FRAC_CONST(-0.05837053268336), FRAC_CONST(-0.06544098531359), FRAC_CONST(-0.07269433008129), FRAC_CONST(-0.08013729344279), FRAC_CONST(-0.08775475365593), FRAC_CONST(-0.09555333528914), FRAC_CONST(-0.10353295311463), FRAC_CONST(-0.1116826931773), FRAC_CONST(-0.120007798468), FRAC_CONST(-0.12850028503878), FRAC_CONST(-0.13715517611934), FRAC_CONST(-0.1459766491187), FRAC_CONST(-0.15496070710605), FRAC_CONST(-0.16409588556669), FRAC_CONST(-0.17338081721706), FRAC_CONST(-0.18281725485142), FRAC_CONST(-0.19239667457267), FRAC_CONST(-0.20212501768103), FRAC_CONST(-0.21197358538056), FRAC_CONST(-0.22196526964149), FRAC_CONST(-0.23206908706791), FRAC_CONST(-0.24230168845974), FRAC_CONST(-0.25264803095722), FRAC_CONST(-0.26310532994603), FRAC_CONST(-0.27366340405625), FRAC_CONST(-0.28432141891085), FRAC_CONST(-0.29507167170646), FRAC_CONST(-0.30590985751916), FRAC_CONST(-0.31682789136456), FRAC_CONST(-0.32781137272105), FRAC_CONST(-0.33887226938665), FRAC_CONST(-0.3499914122931), FRAC_CONST(0.36115899031355), FRAC_CONST(0.37237955463061), FRAC_CONST(0.38363500139043), FRAC_CONST(0.39492117615675), FRAC_CONST(0.40623176767625), FRAC_CONST(0.41756968968409), FRAC_CONST(0.42891199207373), FRAC_CONST(0.44025537543665), FRAC_CONST(0.45159965356824), FRAC_CONST(0.46293080852757), FRAC_CONST(0.47424532146115), FRAC_CONST(0.48552530911099), FRAC_CONST(0.49677082545707), FRAC_CONST(0.50798175000434), FRAC_CONST(0.51912349702391), FRAC_CONST(0.53022408956855), FRAC_CONST(0.54125534487322), FRAC_CONST(0.55220512585061), FRAC_CONST(0.5630789140137), FRAC_CONST(0.57385241316923), FRAC_CONST(0.58454032354679), FRAC_CONST(0.59511230862496), FRAC_CONST(0.6055783538918), FRAC_CONST(0.61591099320291), FRAC_CONST(0.62612426956055), FRAC_CONST(0.63619801077286), FRAC_CONST(0.64612696959461), FRAC_CONST(0.65590163024671), FRAC_CONST(0.66551398801627), FRAC_CONST(0.67496631901712), FRAC_CONST(0.68423532934598), FRAC_CONST(0.69332823767032), FRAC_CONST(0.70223887193539), FRAC_CONST(0.71094104263095), FRAC_CONST(0.71944626349561), FRAC_CONST(0.72774489002994), FRAC_CONST(0.73582117582769), FRAC_CONST(0.74368278636488), FRAC_CONST(0.75131374561237), FRAC_CONST(0.75870807608242), FRAC_CONST(0.76586748650939), FRAC_CONST(0.77277808813327), FRAC_CONST(0.77942875190216), FRAC_CONST(0.7858353120392), FRAC_CONST(0.79197358416424), FRAC_CONST(0.797846641377), FRAC_CONST(0.80344857518505), FRAC_CONST(0.80876950044491), FRAC_CONST(0.81381912706217), FRAC_CONST(0.81857760046468), FRAC_CONST(0.82304198905409), FRAC_CONST(0.8272275347336), FRAC_CONST(0.8311038457152), FRAC_CONST(0.83469373618402), FRAC_CONST(0.83797173378865), FRAC_CONST(0.84095413924722), FRAC_CONST(0.84362382812005), FRAC_CONST(0.84598184698206), FRAC_CONST(0.84803157770763), FRAC_CONST(0.84978051984268), FRAC_CONST(0.85119715249343), FRAC_CONST(0.85230470352147), FRAC_CONST(0.85310209497017), FRAC_CONST(0.85357205739107), FRAC_CONST(0.85373856005937 /*max*/), FRAC_CONST(0.85357205739107), FRAC_CONST(0.85310209497017), FRAC_CONST(0.85230470352147), FRAC_CONST(0.85119715249343), FRAC_CONST(0.84978051984268), FRAC_CONST(0.84803157770763), FRAC_CONST(0.84598184698206), FRAC_CONST(0.84362382812005), FRAC_CONST(0.84095413924722), FRAC_CONST(0.83797173378865), FRAC_CONST(0.83469373618402), FRAC_CONST(0.8311038457152), FRAC_CONST(0.8272275347336), FRAC_CONST(0.82304198905409), FRAC_CONST(0.81857760046468), FRAC_CONST(0.81381912706217), FRAC_CONST(0.80876950044491), FRAC_CONST(0.80344857518505), FRAC_CONST(0.797846641377), FRAC_CONST(0.79197358416424), FRAC_CONST(0.7858353120392), FRAC_CONST(0.77942875190216), FRAC_CONST(0.77277808813327), FRAC_CONST(0.76586748650939), FRAC_CONST(0.75870807608242), FRAC_CONST(0.75131374561237), FRAC_CONST(0.74368278636488), FRAC_CONST(0.73582117582769), FRAC_CONST(0.72774489002994), FRAC_CONST(0.71944626349561), FRAC_CONST(0.71094104263095), FRAC_CONST(0.70223887193539), FRAC_CONST(0.69332823767032), FRAC_CONST(0.68423532934598), FRAC_CONST(0.67496631901712), FRAC_CONST(0.66551398801627), FRAC_CONST(0.65590163024671), FRAC_CONST(0.64612696959461), FRAC_CONST(0.63619801077286), FRAC_CONST(0.62612426956055), FRAC_CONST(0.61591099320291), FRAC_CONST(0.6055783538918), FRAC_CONST(0.59511230862496), FRAC_CONST(0.58454032354679), FRAC_CONST(0.57385241316923), FRAC_CONST(0.5630789140137), FRAC_CONST(0.55220512585061), FRAC_CONST(0.54125534487322), FRAC_CONST(0.53022408956855), FRAC_CONST(0.51912349702391), FRAC_CONST(0.50798175000434), FRAC_CONST(0.49677082545707), FRAC_CONST(0.48552530911099), FRAC_CONST(0.47424532146115), FRAC_CONST(0.46293080852757), FRAC_CONST(0.45159965356824), FRAC_CONST(0.44025537543665), FRAC_CONST(0.42891199207373), FRAC_CONST(0.41756968968409), FRAC_CONST(0.40623176767625), FRAC_CONST(0.39492117615675), FRAC_CONST(0.38363500139043), FRAC_CONST(0.37237955463061), FRAC_CONST(-0.36115899031355), FRAC_CONST(-0.3499914122931), FRAC_CONST(-0.33887226938665), FRAC_CONST(-0.32781137272105), FRAC_CONST(-0.31682789136456), FRAC_CONST(-0.30590985751916), FRAC_CONST(-0.29507167170646), FRAC_CONST(-0.28432141891085), FRAC_CONST(-0.27366340405625), FRAC_CONST(-0.26310532994603), FRAC_CONST(-0.25264803095722), FRAC_CONST(-0.24230168845974), FRAC_CONST(-0.23206908706791), FRAC_CONST(-0.22196526964149), FRAC_CONST(-0.21197358538056), FRAC_CONST(-0.20212501768103), FRAC_CONST(-0.19239667457267), FRAC_CONST(-0.18281725485142), FRAC_CONST(-0.17338081721706), FRAC_CONST(-0.16409588556669), FRAC_CONST(-0.15496070710605), FRAC_CONST(-0.1459766491187), FRAC_CONST(-0.13715517611934), FRAC_CONST(-0.12850028503878), FRAC_CONST(-0.120007798468), FRAC_CONST(-0.1116826931773), FRAC_CONST(-0.10353295311463), FRAC_CONST(-0.09555333528914), FRAC_CONST(-0.08775475365593), FRAC_CONST(-0.08013729344279), FRAC_CONST(-0.07269433008129), FRAC_CONST(-0.06544098531359), FRAC_CONST(-0.05837053268336), FRAC_CONST(-0.05148041767934), FRAC_CONST(-0.04478068215856), FRAC_CONST(-0.03827765720822), FRAC_CONST(-0.03195312745332), FRAC_CONST(-0.02582272888064), FRAC_CONST(-0.01988341292573), FRAC_CONST(-0.01412888273558), FRAC_CONST(-0.00857117491366), FRAC_CONST(-0.00320868968304), FRAC_CONST(0.00197656014503), FRAC_CONST(0.00696368621617), FRAC_CONST(0.01176238327857), FRAC_CONST(0.01637012582228), FRAC_CONST(0.02079970728622), FRAC_CONST(0.02503075618909), FRAC_CONST(0.02908240060125), FRAC_CONST(0.03295839306691), FRAC_CONST(0.03664181168133), FRAC_CONST(0.04014582784127), FRAC_CONST(0.04347687821958), FRAC_CONST(0.04663033051701), FRAC_CONST(0.04959786763445), FRAC_CONST(0.05240938217366), FRAC_CONST(0.05504600343009), FRAC_CONST(0.05751526919867), FRAC_CONST(0.0598166570809), FRAC_CONST(0.06196027790387), FRAC_CONST(0.06394448059633), FRAC_CONST(0.06576906686508), FRAC_CONST(0.06745250215166), FRAC_CONST(0.06896640131951), FRAC_CONST(0.07035330735093), FRAC_CONST(0.07158263647903), FRAC_CONST(0.07267746427299), FRAC_CONST(0.0736406005762), FRAC_CONST(0.07446643947564), FRAC_CONST(0.0751576255287), FRAC_CONST(0.07573057565061), FRAC_CONST(0.07617483218536), FRAC_CONST(0.07650507183194), FRAC_CONST(0.07672049241746), FRAC_CONST(0.07682300113923), FRAC_CONST(0.07681739756964), FRAC_CONST(0.07670934904245), FRAC_CONST(0.07649921704119), FRAC_CONST(0.07619924793396), FRAC_CONST(0.07580083586584), FRAC_CONST(0.07531373362019), FRAC_CONST(0.07474525581194), FRAC_CONST(0.07410036424342), FRAC_CONST(0.07336202550803), FRAC_CONST(0.07256825833083), FRAC_CONST(0.07170026731102), FRAC_CONST(0.07076287107266), FRAC_CONST(0.06976302447127), FRAC_CONST(0.06870438283512), FRAC_CONST(0.06760759851228), FRAC_CONST(0.06643675122104), FRAC_CONST(0.0652247106438), FRAC_CONST(0.06397158980681), FRAC_CONST(0.06268578081172), FRAC_CONST(0.06134551717207), FRAC_CONST(0.05998374801761), FRAC_CONST(0.0585915683626), FRAC_CONST(0.05716164501299), FRAC_CONST(0.05571736482138), FRAC_CONST(0.05424527683589), FRAC_CONST(0.05276307465207), FRAC_CONST(0.05125561555216), FRAC_CONST(0.04973857556014), FRAC_CONST(0.04821657200672), FRAC_CONST(0.04668430272642), FRAC_CONST(0.04514884056413), FRAC_CONST(0.04360975421304), FRAC_CONST(0.04206490946367), FRAC_CONST(0.04053491705584), FRAC_CONST(0.03900536794745), FRAC_CONST(0.03748128504252), FRAC_CONST(0.03596975605542), FRAC_CONST(0.03446209487686), FRAC_CONST(0.03297540810337), FRAC_CONST(0.03150176087389), FRAC_CONST(0.03005026574279), FRAC_CONST(0.02860721736385), FRAC_CONST(0.02718594296329), FRAC_CONST(0.02578758475467), FRAC_CONST(0.02441609920285), FRAC_CONST(0.02306801692862), FRAC_CONST(0.02174675502535), FRAC_CONST(0.02045317933555), FRAC_CONST(0.01918724313698), FRAC_CONST(0.01794333813443), FRAC_CONST(0.01673247129989), FRAC_CONST(0.01554055533423), FRAC_CONST(0.01439046660792), FRAC_CONST(-0.01327182200351), FRAC_CONST(-0.01218499959508), FRAC_CONST(-0.01113155480321), FRAC_CONST(-0.01011502154986), FRAC_CONST(-0.00913253296085), FRAC_CONST(-0.00817982333726), FRAC_CONST(-0.00726158168517), FRAC_CONST(-0.00637922932685), FRAC_CONST(-0.00553372111088), FRAC_CONST(-0.004722259624), FRAC_CONST(-0.00394011240522), FRAC_CONST(-0.003193377839), FRAC_CONST(-0.00248267236449), FRAC_CONST(-0.00180394725893), FRAC_CONST(-0.00115681355227), FRAC_CONST(-0.00054642808664), FRAC_CONST(2.760451905E-005), FRAC_CONST(0.0005832264248), FRAC_CONST(0.00109023290512), FRAC_CONST(0.00157846825768), FRAC_CONST(0.0020274176185), FRAC_CONST(0.00245085400321), FRAC_CONST(0.00284467578623), FRAC_CONST(0.00320918858098), FRAC_CONST(0.00354012465507), FRAC_CONST(0.00384564081246), FRAC_CONST(0.0041251642327), FRAC_CONST(0.00438018617447), FRAC_CONST(0.00460395301471), FRAC_CONST(0.004810946906), FRAC_CONST(0.00498396877629), FRAC_CONST(0.00513822754514), FRAC_CONST(0.00527157587272), FRAC_CONST(0.0053838975897), FRAC_CONST(0.0054753783077), FRAC_CONST(0.005540436394), FRAC_CONST(0.0055917128663), FRAC_CONST(0.00562661141932), FRAC_CONST(0.00563891995151), FRAC_CONST(0.00564551969164), FRAC_CONST(0.00562206432097), FRAC_CONST(0.00559380230045), FRAC_CONST(0.00554757145088), FRAC_CONST(0.00548760401507), FRAC_CONST(0.00541967759307), FRAC_CONST(0.00534716811982), FRAC_CONST(0.00524611661324), FRAC_CONST(0.00514073539032), FRAC_CONST(0.00503930226013), FRAC_CONST(0.00491376035745), FRAC_CONST(0.00479325608498), FRAC_CONST(0.00466064606118), FRAC_CONST(0.00452098527825), FRAC_CONST(0.00437307196781), FRAC_CONST(0.0042264269227), FRAC_CONST(0.00408197531935), FRAC_CONST(0.00392074323703), FRAC_CONST(0.00376039229104), FRAC_CONST(0.00360082681231), FRAC_CONST(0.00344188741828), FRAC_CONST(0.00327396134847), FRAC_CONST(0.00311254206525), FRAC_CONST(0.00294694477165), FRAC_CONST(0.00278704643465), FRAC_CONST(0.00262017586902), FRAC_CONST(0.00246256169126), FRAC_CONST(0.00230172547746), FRAC_CONST(0.00214615835557), FRAC_CONST(0.00198411407369), FRAC_CONST(0.00183482654224), FRAC_CONST(0.00168680832531), FRAC_CONST(0.00154432198471), FRAC_CONST(0.00139024948272), FRAC_CONST(0.00125778846475), FRAC_CONST(0.00112501551307), FRAC_CONST(0.00098859883015), FRAC_CONST(0.00086084433262), FRAC_CONST(0.00074580258865), FRAC_CONST(0.00062393761391), FRAC_CONST(0.00051073884952), FRAC_CONST(0.0004026540216), FRAC_CONST(0.00029495311041), FRAC_CONST(0.00020430170688), FRAC_CONST(0.00010943831274), FRAC_CONST(1.349497418E-005), FRAC_CONST(-6.173344072E-005), FRAC_CONST(-0.00014463809349), FRAC_CONST(-0.0002098337344), FRAC_CONST(-0.00028969811748), FRAC_CONST(-0.00035011758756), FRAC_CONST(-0.00040951214522), FRAC_CONST(-0.00046063254803), FRAC_CONST(-0.00051455722108), FRAC_CONST(-0.00055645763906), FRAC_CONST(-0.0005946118933), FRAC_CONST(-0.00063415949025), FRAC_CONST(-0.00066504150893), FRAC_CONST(-0.00069179375372), FRAC_CONST(-0.00072153919876), FRAC_CONST(-0.00073193571525), FRAC_CONST(-0.00075300014201), FRAC_CONST(-0.00076307935757), FRAC_CONST(-0.0007757977331), FRAC_CONST(-0.00078014496257), FRAC_CONST(-0.000780366471), FRAC_CONST(-0.00077798694927), FRAC_CONST(-0.00078343322877), FRAC_CONST(-0.00077248485949), FRAC_CONST(-0.0007681371927), FRAC_CONST(-0.00074905980532), FRAC_CONST(-0.00074409418541), FRAC_CONST(-0.00072550431222), FRAC_CONST(-0.00071577364744), FRAC_CONST(-0.00069416146273), FRAC_CONST(-0.00067776907764), FRAC_CONST(-0.00065403333621), FRAC_CONST(-0.00063124935319), FRAC_CONST(-0.00061327473938), FRAC_CONST(-0.00058709304852), FRAC_CONST(-0.00056778025613), FRAC_CONST(-0.00054665656337), FRAC_CONST(-0.00052265642972), FRAC_CONST(-0.00050407143497), FRAC_CONST(-0.00048937912498), FRAC_CONST(-0.00048752279712), FRAC_CONST(-0.00049475180896), FRAC_CONST(-0.00056176925738), FRAC_CONST(-0.00055252865047) }; #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/sbr_syntax.c
C
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_syntax.c,v 1.39 2009/01/26 22:32:31 menno Exp $ **/ #include "common.h" #include "structs.h" #ifdef SBR_DEC #include "sbr_syntax.h" #include "syntax.h" #include "sbr_huff.h" #include "sbr_fbt.h" #include "sbr_tf_grid.h" #include "sbr_e_nf.h" #include "bits.h" #ifdef PS_DEC #include "ps_dec.h" #endif #ifdef DRM_PS #include "drm_dec.h" #endif #include "analysis.h" /* static function declarations */ /* static function declarations */ static void sbr_header(bitfile *ld, sbr_info *sbr); static uint8_t calc_sbr_tables(sbr_info *sbr, uint8_t start_freq, uint8_t stop_freq, uint8_t samplerate_mode, uint8_t freq_scale, uint8_t alter_scale, uint8_t xover_band); static uint8_t sbr_data(bitfile *ld, sbr_info *sbr); static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr, uint8_t bs_extension_id, uint16_t num_bits_left); static uint8_t sbr_single_channel_element(bitfile *ld, sbr_info *sbr); static uint8_t sbr_channel_pair_element(bitfile *ld, sbr_info *sbr); static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch); static void sbr_dtdf(bitfile *ld, sbr_info *sbr, uint8_t ch); static void invf_mode(bitfile *ld, sbr_info *sbr, uint8_t ch); static void sinusoidal_coding(bitfile *ld, sbr_info *sbr, uint8_t ch); static void sbr_reset(sbr_info *sbr) { #if 0 printf("%d\n", sbr->bs_start_freq_prev); printf("%d\n", sbr->bs_stop_freq_prev); printf("%d\n", sbr->bs_freq_scale_prev); printf("%d\n", sbr->bs_alter_scale_prev); printf("%d\n", sbr->bs_xover_band_prev); printf("%d\n\n", sbr->bs_noise_bands_prev); #endif /* if these are different from the previous frame: Reset = 1 */ if ((sbr->bs_start_freq != sbr->bs_start_freq_prev) || (sbr->bs_stop_freq != sbr->bs_stop_freq_prev) || (sbr->bs_freq_scale != sbr->bs_freq_scale_prev) || (sbr->bs_alter_scale != sbr->bs_alter_scale_prev) || (sbr->bs_xover_band != sbr->bs_xover_band_prev) || (sbr->bs_noise_bands != sbr->bs_noise_bands_prev)) { sbr->Reset = 1; } else { sbr->Reset = 0; } sbr->bs_start_freq_prev = sbr->bs_start_freq; sbr->bs_stop_freq_prev = sbr->bs_stop_freq; sbr->bs_freq_scale_prev = sbr->bs_freq_scale; sbr->bs_alter_scale_prev = sbr->bs_alter_scale; sbr->bs_xover_band_prev = sbr->bs_xover_band; sbr->bs_noise_bands_prev = sbr->bs_noise_bands; } static uint8_t calc_sbr_tables(sbr_info *sbr, uint8_t start_freq, uint8_t stop_freq, uint8_t samplerate_mode, uint8_t freq_scale, uint8_t alter_scale, uint8_t xover_band) { uint8_t result = 0; uint8_t k2; /* calculate the Master Frequency Table */ sbr->k0 = qmf_start_channel(start_freq, samplerate_mode, sbr->sample_rate); k2 = qmf_stop_channel(stop_freq, sbr->sample_rate, sbr->k0); /* check k0 and k2 */ if (sbr->sample_rate >= 48000) { if ((k2 - sbr->k0) > 32) result += 1; } else if (sbr->sample_rate <= 32000) { if ((k2 - sbr->k0) > 48) result += 1; } else { /* (sbr->sample_rate == 44100) */ if ((k2 - sbr->k0) > 45) result += 1; } if (freq_scale == 0) { result += master_frequency_table_fs0(sbr, sbr->k0, k2, alter_scale); } else { result += master_frequency_table(sbr, sbr->k0, k2, freq_scale, alter_scale); } result += derived_frequency_table(sbr, xover_band, k2); result = (result > 0) ? 1 : 0; return result; } /* table 2 */ uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint16_t cnt, uint8_t psResetFlag) { uint8_t result = 0; uint16_t num_align_bits = 0; uint16_t num_sbr_bits1 = (uint16_t)faad_get_processed_bits(ld); uint16_t num_sbr_bits2; uint8_t saved_start_freq, saved_samplerate_mode; uint8_t saved_stop_freq, saved_freq_scale; uint8_t saved_alter_scale, saved_xover_band; #if (defined(PS_DEC) || defined(DRM_PS)) if (psResetFlag) sbr->psResetFlag = psResetFlag; #endif #ifdef DRM if (!sbr->Is_DRM_SBR) #endif { uint8_t bs_extension_type = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,198,"sbr_bitstream(): bs_extension_type")); if (bs_extension_type == EXT_SBR_DATA_CRC) { sbr->bs_sbr_crc_bits = (uint16_t)faad_getbits(ld, 10 DEBUGVAR(1,199,"sbr_bitstream(): bs_sbr_crc_bits")); } } /* save old header values, in case the new ones are corrupted */ saved_start_freq = sbr->bs_start_freq; saved_samplerate_mode = sbr->bs_samplerate_mode; saved_stop_freq = sbr->bs_stop_freq; saved_freq_scale = sbr->bs_freq_scale; saved_alter_scale = sbr->bs_alter_scale; saved_xover_band = sbr->bs_xover_band; sbr->bs_header_flag = faad_get1bit(ld DEBUGVAR(1,200,"sbr_bitstream(): bs_header_flag")); if (sbr->bs_header_flag) sbr_header(ld, sbr); /* Reset? */ sbr_reset(sbr); /* first frame should have a header */ //if (!(sbr->frame == 0 && sbr->bs_header_flag == 0)) if (sbr->header_count != 0) { if (sbr->Reset || (sbr->bs_header_flag && sbr->just_seeked)) { uint8_t rt = calc_sbr_tables(sbr, sbr->bs_start_freq, sbr->bs_stop_freq, sbr->bs_samplerate_mode, sbr->bs_freq_scale, sbr->bs_alter_scale, sbr->bs_xover_band); /* if an error occured with the new header values revert to the old ones */ if (rt > 0) { calc_sbr_tables(sbr, saved_start_freq, saved_stop_freq, saved_samplerate_mode, saved_freq_scale, saved_alter_scale, saved_xover_band); } } if (result == 0) { result = sbr_data(ld, sbr); /* sbr_data() returning an error means that there was an error in envelope_time_border_vector(). In this case the old time border vector is saved and all the previous data normally read after sbr_grid() is saved. */ /* to be on the safe side, calculate old sbr tables in case of error */ if ((result > 0) && (sbr->Reset || (sbr->bs_header_flag && sbr->just_seeked))) { calc_sbr_tables(sbr, saved_start_freq, saved_stop_freq, saved_samplerate_mode, saved_freq_scale, saved_alter_scale, saved_xover_band); } /* we should be able to safely set result to 0 now, */ /* but practise indicates this doesn't work well */ } } else { result = 1; } num_sbr_bits2 = (uint16_t)faad_get_processed_bits(ld) - num_sbr_bits1; /* check if we read more bits then were available for sbr */ if (8*cnt < num_sbr_bits2) { faad_resetbits(ld, num_sbr_bits1 + 8*cnt); num_sbr_bits2 = 8*cnt; #ifdef PS_DEC /* turn off PS for the unfortunate case that we randomly read some * PS data that looks correct */ sbr->ps_used = 0; #endif /* Make sure it doesn't decode SBR in this frame, or we'll get glitches */ return 1; } #ifdef DRM if (!sbr->Is_DRM_SBR) #endif { /* -4 does not apply, bs_extension_type is re-read in this function */ num_align_bits = 8*cnt /*- 4*/ - num_sbr_bits2; while (num_align_bits > 7) { faad_getbits(ld, 8 DEBUGVAR(1,999,"sbr_bitstream(): num_align_bits")); num_align_bits -= 8; } faad_getbits(ld, num_align_bits DEBUGVAR(1,999,"sbr_bitstream(): num_align_bits")); } return result; } /* table 3 */ static void sbr_header(bitfile *ld, sbr_info *sbr) { uint8_t bs_header_extra_1, bs_header_extra_2; sbr->header_count++; sbr->bs_amp_res = faad_get1bit(ld DEBUGVAR(1,203,"sbr_header(): bs_amp_res")); /* bs_start_freq and bs_stop_freq must define a fequency band that does not exceed 48 channels */ sbr->bs_start_freq = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,204,"sbr_header(): bs_start_freq")); sbr->bs_stop_freq = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,205,"sbr_header(): bs_stop_freq")); sbr->bs_xover_band = (uint8_t)faad_getbits(ld, 3 DEBUGVAR(1,206,"sbr_header(): bs_xover_band")); faad_getbits(ld, 2 DEBUGVAR(1,207,"sbr_header(): bs_reserved_bits_hdr")); bs_header_extra_1 = (uint8_t)faad_get1bit(ld DEBUGVAR(1,208,"sbr_header(): bs_header_extra_1")); bs_header_extra_2 = (uint8_t)faad_get1bit(ld DEBUGVAR(1,209,"sbr_header(): bs_header_extra_2")); if (bs_header_extra_1) { sbr->bs_freq_scale = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,211,"sbr_header(): bs_freq_scale")); sbr->bs_alter_scale = (uint8_t)faad_get1bit(ld DEBUGVAR(1,212,"sbr_header(): bs_alter_scale")); sbr->bs_noise_bands = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,213,"sbr_header(): bs_noise_bands")); } else { /* Default values */ sbr->bs_freq_scale = 2; sbr->bs_alter_scale = 1; sbr->bs_noise_bands = 2; } if (bs_header_extra_2) { sbr->bs_limiter_bands = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,214,"sbr_header(): bs_limiter_bands")); sbr->bs_limiter_gains = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,215,"sbr_header(): bs_limiter_gains")); sbr->bs_interpol_freq = (uint8_t)faad_get1bit(ld DEBUGVAR(1,216,"sbr_header(): bs_interpol_freq")); sbr->bs_smoothing_mode = (uint8_t)faad_get1bit(ld DEBUGVAR(1,217,"sbr_header(): bs_smoothing_mode")); } else { /* Default values */ sbr->bs_limiter_bands = 2; sbr->bs_limiter_gains = 2; sbr->bs_interpol_freq = 1; sbr->bs_smoothing_mode = 1; } #if 0 /* print the header to screen */ printf("bs_amp_res: %d\n", sbr->bs_amp_res); printf("bs_start_freq: %d\n", sbr->bs_start_freq); printf("bs_stop_freq: %d\n", sbr->bs_stop_freq); printf("bs_xover_band: %d\n", sbr->bs_xover_band); if (bs_header_extra_1) { printf("bs_freq_scale: %d\n", sbr->bs_freq_scale); printf("bs_alter_scale: %d\n", sbr->bs_alter_scale); printf("bs_noise_bands: %d\n", sbr->bs_noise_bands); } if (bs_header_extra_2) { printf("bs_limiter_bands: %d\n", sbr->bs_limiter_bands); printf("bs_limiter_gains: %d\n", sbr->bs_limiter_gains); printf("bs_interpol_freq: %d\n", sbr->bs_interpol_freq); printf("bs_smoothing_mode: %d\n", sbr->bs_smoothing_mode); } printf("\n"); #endif } /* table 4 */ static uint8_t sbr_data(bitfile *ld, sbr_info *sbr) { uint8_t result; #if 0 sbr->bs_samplerate_mode = faad_get1bit(ld DEBUGVAR(1,219,"sbr_data(): bs_samplerate_mode")); #endif sbr->rate = (sbr->bs_samplerate_mode) ? 2 : 1; switch (sbr->id_aac) { case ID_SCE: if ((result = sbr_single_channel_element(ld, sbr)) > 0) return result; break; case ID_CPE: if ((result = sbr_channel_pair_element(ld, sbr)) > 0) return result; break; } return 0; } /* table 5 */ static uint8_t sbr_single_channel_element(bitfile *ld, sbr_info *sbr) { uint8_t result; if (faad_get1bit(ld DEBUGVAR(1,220,"sbr_single_channel_element(): bs_data_extra"))) { faad_getbits(ld, 4 DEBUGVAR(1,221,"sbr_single_channel_element(): bs_reserved_bits_data")); } #ifdef DRM /* bs_coupling, from sbr_channel_pair_base_element(bs_amp_res) */ if (sbr->Is_DRM_SBR) { faad_get1bit(ld); } #endif if ((result = sbr_grid(ld, sbr, 0)) > 0) return result; sbr_dtdf(ld, sbr, 0); invf_mode(ld, sbr, 0); sbr_envelope(ld, sbr, 0); sbr_noise(ld, sbr, 0); #ifndef FIXED_POINT envelope_noise_dequantisation(sbr, 0); #endif memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t)); sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld DEBUGVAR(1,223,"sbr_single_channel_element(): bs_add_harmonic_flag[0]")); if (sbr->bs_add_harmonic_flag[0]) sinusoidal_coding(ld, sbr, 0); sbr->bs_extended_data = faad_get1bit(ld DEBUGVAR(1,224,"sbr_single_channel_element(): bs_extended_data[0]")); if (sbr->bs_extended_data) { uint16_t nr_bits_left; #if (defined(PS_DEC) || defined(DRM_PS)) uint8_t ps_ext_read = 0; #endif uint16_t cnt = (uint16_t)faad_getbits(ld, 4 DEBUGVAR(1,225,"sbr_single_channel_element(): bs_extension_size")); if (cnt == 15) { cnt += (uint16_t)faad_getbits(ld, 8 DEBUGVAR(1,226,"sbr_single_channel_element(): bs_esc_count")); } nr_bits_left = 8 * cnt; while (nr_bits_left > 7) { uint16_t tmp_nr_bits = 0; sbr->bs_extension_id = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,227,"sbr_single_channel_element(): bs_extension_id")); tmp_nr_bits += 2; /* allow only 1 PS extension element per extension data */ #if (defined(PS_DEC) || defined(DRM_PS)) #if (defined(PS_DEC) && defined(DRM_PS)) if (sbr->bs_extension_id == EXTENSION_ID_PS || sbr->bs_extension_id == DRM_PARAMETRIC_STEREO) #else #ifdef PS_DEC if (sbr->bs_extension_id == EXTENSION_ID_PS) #else #ifdef DRM_PS if (sbr->bs_extension_id == DRM_PARAMETRIC_STEREO) #endif #endif #endif { if (ps_ext_read == 0) { ps_ext_read = 1; } else { /* to be safe make it 3, will switch to "default" * in sbr_extension() */ #ifdef DRM return 1; #else sbr->bs_extension_id = 3; #endif } } #endif tmp_nr_bits += sbr_extension(ld, sbr, sbr->bs_extension_id, nr_bits_left); /* check if the data read is bigger than the number of available bits */ if (tmp_nr_bits > nr_bits_left) return 1; nr_bits_left -= tmp_nr_bits; } /* Corrigendum */ if (nr_bits_left > 0) { faad_getbits(ld, nr_bits_left DEBUGVAR(1,280,"sbr_single_channel_element(): nr_bits_left")); } } return 0; } /* table 6 */ static uint8_t sbr_channel_pair_element(bitfile *ld, sbr_info *sbr) { uint8_t n, result; if (faad_get1bit(ld DEBUGVAR(1,228,"sbr_single_channel_element(): bs_data_extra"))) { faad_getbits(ld, 4 DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_reserved_bits_data")); faad_getbits(ld, 4 DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_reserved_bits_data")); } sbr->bs_coupling = faad_get1bit(ld DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_coupling")); if (sbr->bs_coupling) { if ((result = sbr_grid(ld, sbr, 0)) > 0) return result; /* need to copy some data from left to right */ sbr->bs_frame_class[1] = sbr->bs_frame_class[0]; sbr->L_E[1] = sbr->L_E[0]; sbr->L_Q[1] = sbr->L_Q[0]; sbr->bs_pointer[1] = sbr->bs_pointer[0]; for (n = 0; n <= sbr->L_E[0]; n++) { sbr->t_E[1][n] = sbr->t_E[0][n]; sbr->f[1][n] = sbr->f[0][n]; } for (n = 0; n <= sbr->L_Q[0]; n++) sbr->t_Q[1][n] = sbr->t_Q[0][n]; sbr_dtdf(ld, sbr, 0); sbr_dtdf(ld, sbr, 1); invf_mode(ld, sbr, 0); /* more copying */ for (n = 0; n < sbr->N_Q; n++) sbr->bs_invf_mode[1][n] = sbr->bs_invf_mode[0][n]; sbr_envelope(ld, sbr, 0); sbr_noise(ld, sbr, 0); sbr_envelope(ld, sbr, 1); sbr_noise(ld, sbr, 1); memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t)); memset(sbr->bs_add_harmonic[1], 0, 64*sizeof(uint8_t)); sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld DEBUGVAR(1,231,"sbr_channel_pair_element(): bs_add_harmonic_flag[0]")); if (sbr->bs_add_harmonic_flag[0]) sinusoidal_coding(ld, sbr, 0); sbr->bs_add_harmonic_flag[1] = faad_get1bit(ld DEBUGVAR(1,232,"sbr_channel_pair_element(): bs_add_harmonic_flag[1]")); if (sbr->bs_add_harmonic_flag[1]) sinusoidal_coding(ld, sbr, 1); } else { uint8_t saved_t_E[6] = {0}, saved_t_Q[3] = {0}; uint8_t saved_L_E = sbr->L_E[0]; uint8_t saved_L_Q = sbr->L_Q[0]; uint8_t saved_frame_class = sbr->bs_frame_class[0]; for (n = 0; n < saved_L_E; n++) saved_t_E[n] = sbr->t_E[0][n]; for (n = 0; n < saved_L_Q; n++) saved_t_Q[n] = sbr->t_Q[0][n]; if ((result = sbr_grid(ld, sbr, 0)) > 0) return result; if ((result = sbr_grid(ld, sbr, 1)) > 0) { /* restore first channel data as well */ sbr->bs_frame_class[0] = saved_frame_class; sbr->L_E[0] = saved_L_E; sbr->L_Q[0] = saved_L_Q; for (n = 0; n < 6; n++) sbr->t_E[0][n] = saved_t_E[n]; for (n = 0; n < 3; n++) sbr->t_Q[0][n] = saved_t_Q[n]; return result; } sbr_dtdf(ld, sbr, 0); sbr_dtdf(ld, sbr, 1); invf_mode(ld, sbr, 0); invf_mode(ld, sbr, 1); sbr_envelope(ld, sbr, 0); sbr_envelope(ld, sbr, 1); sbr_noise(ld, sbr, 0); sbr_noise(ld, sbr, 1); memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t)); memset(sbr->bs_add_harmonic[1], 0, 64*sizeof(uint8_t)); sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld DEBUGVAR(1,239,"sbr_channel_pair_element(): bs_add_harmonic_flag[0]")); if (sbr->bs_add_harmonic_flag[0]) sinusoidal_coding(ld, sbr, 0); sbr->bs_add_harmonic_flag[1] = faad_get1bit(ld DEBUGVAR(1,240,"sbr_channel_pair_element(): bs_add_harmonic_flag[1]")); if (sbr->bs_add_harmonic_flag[1]) sinusoidal_coding(ld, sbr, 1); } #ifndef FIXED_POINT envelope_noise_dequantisation(sbr, 0); envelope_noise_dequantisation(sbr, 1); if (sbr->bs_coupling) unmap_envelope_noise(sbr); #endif sbr->bs_extended_data = faad_get1bit(ld DEBUGVAR(1,233,"sbr_channel_pair_element(): bs_extended_data[0]")); if (sbr->bs_extended_data) { uint16_t nr_bits_left; uint16_t cnt = (uint16_t)faad_getbits(ld, 4 DEBUGVAR(1,234,"sbr_channel_pair_element(): bs_extension_size")); if (cnt == 15) { cnt += (uint16_t)faad_getbits(ld, 8 DEBUGVAR(1,235,"sbr_channel_pair_element(): bs_esc_count")); } nr_bits_left = 8 * cnt; while (nr_bits_left > 7) { uint16_t tmp_nr_bits = 0; sbr->bs_extension_id = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,236,"sbr_channel_pair_element(): bs_extension_id")); tmp_nr_bits += 2; tmp_nr_bits += sbr_extension(ld, sbr, sbr->bs_extension_id, nr_bits_left); /* check if the data read is bigger than the number of available bits */ if (tmp_nr_bits > nr_bits_left) return 1; nr_bits_left -= tmp_nr_bits; } /* Corrigendum */ if (nr_bits_left > 0) { faad_getbits(ld, nr_bits_left DEBUGVAR(1,280,"sbr_channel_pair_element(): nr_bits_left")); } } return 0; } /* integer log[2](x): input range [0,10) */ static int8_t sbr_log2(const int8_t val) { int8_t log2tab[] = { 0, 0, 1, 2, 2, 3, 3, 3, 3, 4 }; if (val < 10 && val >= 0) return log2tab[val]; else return 0; } /* table 7 */ static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch) { uint8_t i, env, rel, result; uint8_t bs_abs_bord, bs_abs_bord_1; uint8_t bs_num_env = 0; uint8_t saved_L_E = sbr->L_E[ch]; uint8_t saved_L_Q = sbr->L_Q[ch]; uint8_t saved_frame_class = sbr->bs_frame_class[ch]; sbr->bs_frame_class[ch] = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,248,"sbr_grid(): bs_frame_class")); switch (sbr->bs_frame_class[ch]) { case FIXFIX: i = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,249,"sbr_grid(): bs_num_env_raw")); bs_num_env = min(1 << i, 5); i = (uint8_t)faad_get1bit(ld DEBUGVAR(1,250,"sbr_grid(): bs_freq_res_flag")); for (env = 0; env < bs_num_env; env++) sbr->f[ch][env] = i; sbr->abs_bord_lead[ch] = 0; sbr->abs_bord_trail[ch] = sbr->numTimeSlots; sbr->n_rel_lead[ch] = bs_num_env - 1; sbr->n_rel_trail[ch] = 0; break; case FIXVAR: bs_abs_bord = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,251,"sbr_grid(): bs_abs_bord")) + sbr->numTimeSlots; bs_num_env = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,252,"sbr_grid(): bs_num_env")) + 1; for (rel = 0; rel < bs_num_env-1; rel++) { sbr->bs_rel_bord[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,253,"sbr_grid(): bs_rel_bord")) + 2; } i = sbr_log2(bs_num_env + 1); sbr->bs_pointer[ch] = (uint8_t)faad_getbits(ld, i DEBUGVAR(1,254,"sbr_grid(): bs_pointer")); for (env = 0; env < bs_num_env; env++) { sbr->f[ch][bs_num_env - env - 1] = (uint8_t)faad_get1bit(ld DEBUGVAR(1,255,"sbr_grid(): bs_freq_res")); } sbr->abs_bord_lead[ch] = 0; sbr->abs_bord_trail[ch] = bs_abs_bord; sbr->n_rel_lead[ch] = 0; sbr->n_rel_trail[ch] = bs_num_env - 1; break; case VARFIX: bs_abs_bord = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,256,"sbr_grid(): bs_abs_bord")); bs_num_env = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,257,"sbr_grid(): bs_num_env")) + 1; for (rel = 0; rel < bs_num_env-1; rel++) { sbr->bs_rel_bord[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,258,"sbr_grid(): bs_rel_bord")) + 2; } i = sbr_log2(bs_num_env + 1); sbr->bs_pointer[ch] = (uint8_t)faad_getbits(ld, i DEBUGVAR(1,259,"sbr_grid(): bs_pointer")); for (env = 0; env < bs_num_env; env++) { sbr->f[ch][env] = (uint8_t)faad_get1bit(ld DEBUGVAR(1,260,"sbr_grid(): bs_freq_res")); } sbr->abs_bord_lead[ch] = bs_abs_bord; sbr->abs_bord_trail[ch] = sbr->numTimeSlots; sbr->n_rel_lead[ch] = bs_num_env - 1; sbr->n_rel_trail[ch] = 0; break; case VARVAR: bs_abs_bord = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,261,"sbr_grid(): bs_abs_bord_0")); bs_abs_bord_1 = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,262,"sbr_grid(): bs_abs_bord_1")) + sbr->numTimeSlots; sbr->bs_num_rel_0[ch] = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,263,"sbr_grid(): bs_num_rel_0")); sbr->bs_num_rel_1[ch] = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,264,"sbr_grid(): bs_num_rel_1")); bs_num_env = min(5, sbr->bs_num_rel_0[ch] + sbr->bs_num_rel_1[ch] + 1); for (rel = 0; rel < sbr->bs_num_rel_0[ch]; rel++) { sbr->bs_rel_bord_0[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,265,"sbr_grid(): bs_rel_bord")) + 2; } for(rel = 0; rel < sbr->bs_num_rel_1[ch]; rel++) { sbr->bs_rel_bord_1[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,266,"sbr_grid(): bs_rel_bord")) + 2; } i = sbr_log2(sbr->bs_num_rel_0[ch] + sbr->bs_num_rel_1[ch] + 2); sbr->bs_pointer[ch] = (uint8_t)faad_getbits(ld, i DEBUGVAR(1,267,"sbr_grid(): bs_pointer")); for (env = 0; env < bs_num_env; env++) { sbr->f[ch][env] = (uint8_t)faad_get1bit(ld DEBUGVAR(1,268,"sbr_grid(): bs_freq_res")); } sbr->abs_bord_lead[ch] = bs_abs_bord; sbr->abs_bord_trail[ch] = bs_abs_bord_1; sbr->n_rel_lead[ch] = sbr->bs_num_rel_0[ch]; sbr->n_rel_trail[ch] = sbr->bs_num_rel_1[ch]; break; } if (sbr->bs_frame_class[ch] == VARVAR) sbr->L_E[ch] = min(bs_num_env, 5); else sbr->L_E[ch] = min(bs_num_env, 4); if (sbr->L_E[ch] <= 0) return 1; if (sbr->L_E[ch] > 1) sbr->L_Q[ch] = 2; else sbr->L_Q[ch] = 1; /* TODO: this code can probably be integrated into the code above! */ if ((result = envelope_time_border_vector(sbr, ch)) > 0) { sbr->bs_frame_class[ch] = saved_frame_class; sbr->L_E[ch] = saved_L_E; sbr->L_Q[ch] = saved_L_Q; return result; } noise_floor_time_border_vector(sbr, ch); #if 0 for (env = 0; env < bs_num_env; env++) { printf("freq_res[ch:%d][env:%d]: %d\n", ch, env, sbr->f[ch][env]); } #endif return 0; } /* table 8 */ static void sbr_dtdf(bitfile *ld, sbr_info *sbr, uint8_t ch) { uint8_t i; for (i = 0; i < sbr->L_E[ch]; i++) { sbr->bs_df_env[ch][i] = faad_get1bit(ld DEBUGVAR(1,269,"sbr_dtdf(): bs_df_env")); } for (i = 0; i < sbr->L_Q[ch]; i++) { sbr->bs_df_noise[ch][i] = faad_get1bit(ld DEBUGVAR(1,270,"sbr_dtdf(): bs_df_noise")); } } /* table 9 */ static void invf_mode(bitfile *ld, sbr_info *sbr, uint8_t ch) { uint8_t n; for (n = 0; n < sbr->N_Q; n++) { sbr->bs_invf_mode[ch][n] = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,271,"invf_mode(): bs_invf_mode")); } } static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr, uint8_t bs_extension_id, uint16_t num_bits_left) { #ifdef PS_DEC uint8_t header; uint16_t ret; #endif switch (bs_extension_id) { #ifdef PS_DEC case EXTENSION_ID_PS: if (!sbr->ps) { sbr->ps = ps_init(get_sr_index(sbr->sample_rate), sbr->numTimeSlotsRate); } if (sbr->psResetFlag) { sbr->ps->header_read = 0; } ret = ps_data(sbr->ps, ld, &header); /* enable PS if and only if: a header has been decoded */ if (sbr->ps_used == 0 && header == 1) { sbr->ps_used = 1; } if (header == 1) { sbr->psResetFlag = 0; } return ret; #endif #ifdef DRM_PS case DRM_PARAMETRIC_STEREO: sbr->ps_used = 1; if (!sbr->drm_ps) { sbr->drm_ps = drm_ps_init(); } return drm_ps_data(sbr->drm_ps, ld); #endif default: sbr->bs_extension_data = (uint8_t)faad_getbits(ld, 6 DEBUGVAR(1,279,"sbr_single_channel_element(): bs_extension_data")); return 6; } } /* table 12 */ static void sinusoidal_coding(bitfile *ld, sbr_info *sbr, uint8_t ch) { uint8_t n; for (n = 0; n < sbr->N_high; n++) { sbr->bs_add_harmonic[ch][n] = faad_get1bit(ld DEBUGVAR(1,278,"sinusoidal_coding(): bs_add_harmonic")); } } #endif /* SBR_DEC */
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/sbr_syntax.h
C/C++ Header
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_syntax.h,v 1.23 2007/11/01 12:33:36 menno Exp $ **/ #ifndef __SBR_SYNTAX_H__ #define __SBR_SYNTAX_H__ #ifdef __cplusplus extern "C" { #endif #include "bits.h" #define T_HFGEN 8 #define T_HFADJ 2 #define EXT_SBR_DATA 13 #define EXT_SBR_DATA_CRC 14 #define FIXFIX 0 #define FIXVAR 1 #define VARFIX 2 #define VARVAR 3 #define LO_RES 0 #define HI_RES 1 #define NO_TIME_SLOTS_960 15 #define NO_TIME_SLOTS 16 #define RATE 2 #define NOISE_FLOOR_OFFSET 6 uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint16_t cnt, uint8_t resetFlag); #ifdef __cplusplus } #endif #endif /* __SBR_SYNTAX_H__ */
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/sbr_tf_grid.c
C
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_tf_grid.c,v 1.20 2008/09/19 22:50:20 menno Exp $ **/ /* Time/Frequency grid */ #include "common.h" #include "structs.h" #ifdef SBR_DEC #include <stdlib.h> #include "sbr_syntax.h" #include "sbr_tf_grid.h" /* static function declarations */ #if 0 static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l); static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l); #endif static uint8_t middleBorder(sbr_info *sbr, uint8_t ch); /* function constructs new time border vector */ /* first build into temp vector to be able to use previous vector on error */ uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch) { uint8_t l, border, temp; uint8_t t_E_temp[6] = {0}; t_E_temp[0] = sbr->rate * sbr->abs_bord_lead[ch]; t_E_temp[sbr->L_E[ch]] = sbr->rate * sbr->abs_bord_trail[ch]; switch (sbr->bs_frame_class[ch]) { case FIXFIX: switch (sbr->L_E[ch]) { case 4: temp = (sbr->numTimeSlots / 4); t_E_temp[3] = sbr->rate * 3 * temp; t_E_temp[2] = sbr->rate * 2 * temp; t_E_temp[1] = sbr->rate * temp; break; case 2: t_E_temp[1] = sbr->rate * (sbr->numTimeSlots / 2); break; default: break; } break; case FIXVAR: if (sbr->L_E[ch] > 1) { int8_t i = sbr->L_E[ch]; border = sbr->abs_bord_trail[ch]; for (l = 0; l < (sbr->L_E[ch] - 1); l++) { if (border < sbr->bs_rel_bord[ch][l]) return 1; border -= sbr->bs_rel_bord[ch][l]; t_E_temp[--i] = sbr->rate * border; } } break; case VARFIX: if (sbr->L_E[ch] > 1) { int8_t i = 1; border = sbr->abs_bord_lead[ch]; for (l = 0; l < (sbr->L_E[ch] - 1); l++) { border += sbr->bs_rel_bord[ch][l]; if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen) return 1; t_E_temp[i++] = sbr->rate * border; } } break; case VARVAR: if (sbr->bs_num_rel_0[ch]) { int8_t i = 1; border = sbr->abs_bord_lead[ch]; for (l = 0; l < sbr->bs_num_rel_0[ch]; l++) { border += sbr->bs_rel_bord_0[ch][l]; if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen) return 1; t_E_temp[i++] = sbr->rate * border; } } if (sbr->bs_num_rel_1[ch]) { int8_t i = sbr->L_E[ch]; border = sbr->abs_bord_trail[ch]; for (l = 0; l < sbr->bs_num_rel_1[ch]; l++) { if (border < sbr->bs_rel_bord_1[ch][l]) return 1; border -= sbr->bs_rel_bord_1[ch][l]; t_E_temp[--i] = sbr->rate * border; } } break; } /* no error occured, we can safely use this t_E vector */ for (l = 0; l < 6; l++) { sbr->t_E[ch][l] = t_E_temp[l]; } return 0; } void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch) { sbr->t_Q[ch][0] = sbr->t_E[ch][0]; if (sbr->L_E[ch] == 1) { sbr->t_Q[ch][1] = sbr->t_E[ch][1]; sbr->t_Q[ch][2] = 0; } else { uint8_t index = middleBorder(sbr, ch); sbr->t_Q[ch][1] = sbr->t_E[ch][index]; sbr->t_Q[ch][2] = sbr->t_E[ch][sbr->L_E[ch]]; } } #if 0 static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l) { uint8_t i; int16_t acc = 0; switch (sbr->bs_frame_class[ch]) { case FIXFIX: return sbr->numTimeSlots/sbr->L_E[ch]; case FIXVAR: return 0; case VARFIX: for (i = 0; i < l; i++) { acc += sbr->bs_rel_bord[ch][i]; } return acc; case VARVAR: for (i = 0; i < l; i++) { acc += sbr->bs_rel_bord_0[ch][i]; } return acc; } return 0; } static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l) { uint8_t i; int16_t acc = 0; switch (sbr->bs_frame_class[ch]) { case FIXFIX: case VARFIX: return 0; case FIXVAR: for (i = 0; i < l; i++) { acc += sbr->bs_rel_bord[ch][i]; } return acc; case VARVAR: for (i = 0; i < l; i++) { acc += sbr->bs_rel_bord_1[ch][i]; } return acc; } return 0; } #endif static uint8_t middleBorder(sbr_info *sbr, uint8_t ch) { int8_t retval = 0; switch (sbr->bs_frame_class[ch]) { case FIXFIX: retval = sbr->L_E[ch]/2; break; case VARFIX: if (sbr->bs_pointer[ch] == 0) retval = 1; else if (sbr->bs_pointer[ch] == 1) retval = sbr->L_E[ch] - 1; else retval = sbr->bs_pointer[ch] - 1; break; case FIXVAR: case VARVAR: if (sbr->bs_pointer[ch] > 1) retval = sbr->L_E[ch] + 1 - sbr->bs_pointer[ch]; else retval = sbr->L_E[ch] - 1; break; } return (retval > 0) ? retval : 0; } #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/sbr_tf_grid.h
C/C++ Header
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sbr_tf_grid.h,v 1.17 2007/11/01 12:33:36 menno Exp $ **/ #ifndef __SBR_TF_GRID_H__ #define __SBR_TF_GRID_H__ #ifdef __cplusplus extern "C" { #endif uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch); void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch); #ifdef __cplusplus } #endif #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/sine_win.h
C/C++ Header
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: sine_win.h,v 1.19 2007/11/01 12:33:36 menno Exp $ **/ #ifndef __SINE_WIN_H__ #define __SINE_WIN_H__ #ifdef __cplusplus extern "C" { #endif #ifdef _MSC_VER #pragma warning(disable:4305) #pragma warning(disable:4244) #endif ALIGN static const real_t sine_long_1024[] = { FRAC_CONST(0.00076699031874270449), FRAC_CONST(0.002300969151425805), FRAC_CONST(0.0038349425697062275), FRAC_CONST(0.0053689069639963425), FRAC_CONST(0.0069028587247297558), FRAC_CONST(0.0084367942423697988), FRAC_CONST(0.0099707099074180308), FRAC_CONST(0.011504602110422714), FRAC_CONST(0.013038467241987334), FRAC_CONST(0.014572301692779064), FRAC_CONST(0.016106101853537287), FRAC_CONST(0.017639864115082053), FRAC_CONST(0.019173584868322623), FRAC_CONST(0.020707260504265895), FRAC_CONST(0.022240887414024961), FRAC_CONST(0.023774461988827555), FRAC_CONST(0.025307980620024571), FRAC_CONST(0.026841439699098531), FRAC_CONST(0.028374835617672099), FRAC_CONST(0.029908164767516555), FRAC_CONST(0.031441423540560301), FRAC_CONST(0.032974608328897335), FRAC_CONST(0.03450771552479575), FRAC_CONST(0.036040741520706229), FRAC_CONST(0.037573682709270494), FRAC_CONST(0.039106535483329888), FRAC_CONST(0.040639296235933736), FRAC_CONST(0.042171961360347947), FRAC_CONST(0.043704527250063421), FRAC_CONST(0.04523699029880459), FRAC_CONST(0.046769346900537863), FRAC_CONST(0.048301593449480144), FRAC_CONST(0.049833726340107277), FRAC_CONST(0.051365741967162593), FRAC_CONST(0.052897636725665324), FRAC_CONST(0.054429407010919133), FRAC_CONST(0.055961049218520569), FRAC_CONST(0.057492559744367566), FRAC_CONST(0.059023934984667931), FRAC_CONST(0.060555171335947788), FRAC_CONST(0.062086265195060088), FRAC_CONST(0.063617212959193106), FRAC_CONST(0.065148011025878833), FRAC_CONST(0.066678655793001557), FRAC_CONST(0.068209143658806329), FRAC_CONST(0.069739471021907307), FRAC_CONST(0.071269634281296401), FRAC_CONST(0.072799629836351673), FRAC_CONST(0.074329454086845756), FRAC_CONST(0.075859103432954447), FRAC_CONST(0.077388574275265049), FRAC_CONST(0.078917863014784942), FRAC_CONST(0.080446966052950014), FRAC_CONST(0.081975879791633066), FRAC_CONST(0.083504600633152432), FRAC_CONST(0.085033124980280275), FRAC_CONST(0.08656144923625117), FRAC_CONST(0.088089569804770507), FRAC_CONST(0.089617483090022959), FRAC_CONST(0.091145185496681005), FRAC_CONST(0.09267267342991331), FRAC_CONST(0.094199943295393204), FRAC_CONST(0.095726991499307162), FRAC_CONST(0.097253814448363271), FRAC_CONST(0.098780408549799623), FRAC_CONST(0.10030677021139286), FRAC_CONST(0.10183289584146653), FRAC_CONST(0.10335878184889961), FRAC_CONST(0.10488442464313497), FRAC_CONST(0.10640982063418768), FRAC_CONST(0.10793496623265365), FRAC_CONST(0.10945985784971798), FRAC_CONST(0.11098449189716339), FRAC_CONST(0.11250886478737869), FRAC_CONST(0.1140329729333672), FRAC_CONST(0.11555681274875526), FRAC_CONST(0.11708038064780059), FRAC_CONST(0.11860367304540072), FRAC_CONST(0.1201266863571015), FRAC_CONST(0.12164941699910553), FRAC_CONST(0.12317186138828048), FRAC_CONST(0.12469401594216764), FRAC_CONST(0.12621587707899035), FRAC_CONST(0.12773744121766231), FRAC_CONST(0.12925870477779614), FRAC_CONST(0.13077966417971171), FRAC_CONST(0.13230031584444465), FRAC_CONST(0.13382065619375472), FRAC_CONST(0.13534068165013421), FRAC_CONST(0.13686038863681638), FRAC_CONST(0.13837977357778389), FRAC_CONST(0.13989883289777721), FRAC_CONST(0.14141756302230302), FRAC_CONST(0.14293596037764267), FRAC_CONST(0.14445402139086047), FRAC_CONST(0.14597174248981221), FRAC_CONST(0.14748912010315357), FRAC_CONST(0.14900615066034845), FRAC_CONST(0.1505228305916774), FRAC_CONST(0.15203915632824605), FRAC_CONST(0.15355512430199345), FRAC_CONST(0.15507073094570051), FRAC_CONST(0.15658597269299843), FRAC_CONST(0.15810084597837698), FRAC_CONST(0.15961534723719306), FRAC_CONST(0.16112947290567881), FRAC_CONST(0.16264321942095031), FRAC_CONST(0.16415658322101581), FRAC_CONST(0.16566956074478412), FRAC_CONST(0.16718214843207294), FRAC_CONST(0.16869434272361733), FRAC_CONST(0.17020614006107807), FRAC_CONST(0.17171753688704997), FRAC_CONST(0.17322852964507032), FRAC_CONST(0.1747391147796272), FRAC_CONST(0.17624928873616788), FRAC_CONST(0.17775904796110717), FRAC_CONST(0.17926838890183575), FRAC_CONST(0.18077730800672859), FRAC_CONST(0.1822858017251533), FRAC_CONST(0.18379386650747845), FRAC_CONST(0.1853014988050819), FRAC_CONST(0.18680869507035927), FRAC_CONST(0.18831545175673212), FRAC_CONST(0.18982176531865641), FRAC_CONST(0.1913276322116309), FRAC_CONST(0.19283304889220523), FRAC_CONST(0.1943380118179886), FRAC_CONST(0.19584251744765785), FRAC_CONST(0.19734656224096592), FRAC_CONST(0.19885014265875009), FRAC_CONST(0.20035325516294045), FRAC_CONST(0.20185589621656805), FRAC_CONST(0.20335806228377332), FRAC_CONST(0.20485974982981442), FRAC_CONST(0.20636095532107551), FRAC_CONST(0.20786167522507507), FRAC_CONST(0.20936190601047416), FRAC_CONST(0.21086164414708486), FRAC_CONST(0.21236088610587842), FRAC_CONST(0.21385962835899375), FRAC_CONST(0.21535786737974555), FRAC_CONST(0.21685559964263262), FRAC_CONST(0.21835282162334632), FRAC_CONST(0.2198495297987787), FRAC_CONST(0.22134572064703081), FRAC_CONST(0.22284139064742112), FRAC_CONST(0.2243365362804936), FRAC_CONST(0.22583115402802617), FRAC_CONST(0.22732524037303886), FRAC_CONST(0.22881879179980222), FRAC_CONST(0.23031180479384544), FRAC_CONST(0.23180427584196478), FRAC_CONST(0.23329620143223159), FRAC_CONST(0.23478757805400097), FRAC_CONST(0.23627840219791957), FRAC_CONST(0.23776867035593419), FRAC_CONST(0.23925837902129998), FRAC_CONST(0.24074752468858843), FRAC_CONST(0.24223610385369601), FRAC_CONST(0.24372411301385216), FRAC_CONST(0.24521154866762754), FRAC_CONST(0.24669840731494241), FRAC_CONST(0.24818468545707478), FRAC_CONST(0.24967037959666857), FRAC_CONST(0.25115548623774192), FRAC_CONST(0.25264000188569552), FRAC_CONST(0.25412392304732062), FRAC_CONST(0.25560724623080738), FRAC_CONST(0.25708996794575312), FRAC_CONST(0.25857208470317034), FRAC_CONST(0.26005359301549519), FRAC_CONST(0.26153448939659552), FRAC_CONST(0.263014770361779), FRAC_CONST(0.26449443242780163), FRAC_CONST(0.26597347211287559), FRAC_CONST(0.26745188593667762), FRAC_CONST(0.26892967042035726), FRAC_CONST(0.27040682208654482), FRAC_CONST(0.27188333745935972), FRAC_CONST(0.27335921306441868), FRAC_CONST(0.27483444542884394), FRAC_CONST(0.27630903108127108), FRAC_CONST(0.27778296655185769), FRAC_CONST(0.27925624837229118), FRAC_CONST(0.28072887307579719), FRAC_CONST(0.28220083719714756), FRAC_CONST(0.28367213727266843), FRAC_CONST(0.28514276984024867), FRAC_CONST(0.28661273143934779), FRAC_CONST(0.28808201861100413), FRAC_CONST(0.28955062789784303), FRAC_CONST(0.29101855584408509), FRAC_CONST(0.29248579899555388), FRAC_CONST(0.29395235389968466), FRAC_CONST(0.29541821710553201), FRAC_CONST(0.29688338516377827), FRAC_CONST(0.2983478546267414), FRAC_CONST(0.29981162204838335), FRAC_CONST(0.30127468398431795), FRAC_CONST(0.30273703699181914), FRAC_CONST(0.30419867762982911), FRAC_CONST(0.30565960245896612), FRAC_CONST(0.3071198080415331), FRAC_CONST(0.30857929094152509), FRAC_CONST(0.31003804772463789), FRAC_CONST(0.31149607495827591), FRAC_CONST(0.3129533692115602), FRAC_CONST(0.31440992705533666), FRAC_CONST(0.31586574506218396), FRAC_CONST(0.31732081980642174), FRAC_CONST(0.31877514786411848), FRAC_CONST(0.32022872581309986), FRAC_CONST(0.32168155023295658), FRAC_CONST(0.32313361770505233), FRAC_CONST(0.32458492481253215), FRAC_CONST(0.32603546814033024), FRAC_CONST(0.327485244275178), FRAC_CONST(0.3289342498056122), FRAC_CONST(0.33038248132198278), FRAC_CONST(0.33182993541646111), FRAC_CONST(0.33327660868304793), FRAC_CONST(0.33472249771758122), FRAC_CONST(0.33616759911774452), FRAC_CONST(0.33761190948307462), FRAC_CONST(0.33905542541496964), FRAC_CONST(0.34049814351669716), FRAC_CONST(0.34194006039340219), FRAC_CONST(0.34338117265211504), FRAC_CONST(0.34482147690175929), FRAC_CONST(0.34626096975316001), FRAC_CONST(0.34769964781905138), FRAC_CONST(0.34913750771408497), FRAC_CONST(0.35057454605483751), FRAC_CONST(0.35201075945981908), FRAC_CONST(0.35344614454948081), FRAC_CONST(0.35488069794622279), FRAC_CONST(0.35631441627440241), FRAC_CONST(0.3577472961603419), FRAC_CONST(0.3591793342323365), FRAC_CONST(0.36061052712066227), FRAC_CONST(0.36204087145758418), FRAC_CONST(0.36347036387736376), FRAC_CONST(0.36489900101626732), FRAC_CONST(0.36632677951257359), FRAC_CONST(0.36775369600658198), FRAC_CONST(0.36917974714062002), FRAC_CONST(0.37060492955905167), FRAC_CONST(0.37202923990828501), FRAC_CONST(0.3734526748367803), FRAC_CONST(0.37487523099505754), FRAC_CONST(0.37629690503570479), FRAC_CONST(0.37771769361338564), FRAC_CONST(0.37913759338484732), FRAC_CONST(0.38055660100892852), FRAC_CONST(0.38197471314656722), FRAC_CONST(0.38339192646080866), FRAC_CONST(0.38480823761681288), FRAC_CONST(0.38622364328186298), FRAC_CONST(0.38763814012537273), FRAC_CONST(0.38905172481889438), FRAC_CONST(0.39046439403612659), FRAC_CONST(0.39187614445292235), FRAC_CONST(0.3932869727472964), FRAC_CONST(0.39469687559943356), FRAC_CONST(0.39610584969169627), FRAC_CONST(0.39751389170863233), FRAC_CONST(0.39892099833698291), FRAC_CONST(0.40032716626569009), FRAC_CONST(0.40173239218590501), FRAC_CONST(0.4031366727909953), FRAC_CONST(0.404540004776553), FRAC_CONST(0.40594238484040251), FRAC_CONST(0.40734380968260797), FRAC_CONST(0.40874427600548136), FRAC_CONST(0.41014378051359024), FRAC_CONST(0.41154231991376522), FRAC_CONST(0.41293989091510808), FRAC_CONST(0.4143364902289991), FRAC_CONST(0.41573211456910536), FRAC_CONST(0.41712676065138787), FRAC_CONST(0.4185204251941097), FRAC_CONST(0.41991310491784362), FRAC_CONST(0.42130479654547964), FRAC_CONST(0.42269549680223295), FRAC_CONST(0.42408520241565156), FRAC_CONST(0.4254739101156238), FRAC_CONST(0.42686161663438643), FRAC_CONST(0.42824831870653196), FRAC_CONST(0.42963401306901638), FRAC_CONST(0.43101869646116703), FRAC_CONST(0.43240236562469014), FRAC_CONST(0.43378501730367852), FRAC_CONST(0.43516664824461926), FRAC_CONST(0.4365472551964012), FRAC_CONST(0.43792683491032286), FRAC_CONST(0.43930538414009995), FRAC_CONST(0.4406828996418729), FRAC_CONST(0.4420593781742147), FRAC_CONST(0.44343481649813848), FRAC_CONST(0.44480921137710488), FRAC_CONST(0.44618255957703007), FRAC_CONST(0.44755485786629301), FRAC_CONST(0.44892610301574326), FRAC_CONST(0.45029629179870861), FRAC_CONST(0.45166542099100249), FRAC_CONST(0.45303348737093158), FRAC_CONST(0.45440048771930358), FRAC_CONST(0.45576641881943464), FRAC_CONST(0.45713127745715698), FRAC_CONST(0.45849506042082627), FRAC_CONST(0.45985776450132954), FRAC_CONST(0.46121938649209238), FRAC_CONST(0.46257992318908681), FRAC_CONST(0.46393937139083852), FRAC_CONST(0.4652977278984346), FRAC_CONST(0.46665498951553092), FRAC_CONST(0.46801115304835983), FRAC_CONST(0.46936621530573752), FRAC_CONST(0.4707201730990716), FRAC_CONST(0.47207302324236866), FRAC_CONST(0.47342476255224153), FRAC_CONST(0.47477538784791712), FRAC_CONST(0.47612489595124358), FRAC_CONST(0.47747328368669806), FRAC_CONST(0.47882054788139389), FRAC_CONST(0.48016668536508839), FRAC_CONST(0.48151169297018986), FRAC_CONST(0.48285556753176567), FRAC_CONST(0.48419830588754903), FRAC_CONST(0.48553990487794696), FRAC_CONST(0.48688036134604734), FRAC_CONST(0.48821967213762679), FRAC_CONST(0.48955783410115744), FRAC_CONST(0.49089484408781509), FRAC_CONST(0.49223069895148602), FRAC_CONST(0.49356539554877477), FRAC_CONST(0.49489893073901126), FRAC_CONST(0.49623130138425825), FRAC_CONST(0.49756250434931915), FRAC_CONST(0.49889253650174459), FRAC_CONST(0.50022139471184068), FRAC_CONST(0.50154907585267539), FRAC_CONST(0.50287557680008699), FRAC_CONST(0.50420089443269034), FRAC_CONST(0.50552502563188539), FRAC_CONST(0.50684796728186321), FRAC_CONST(0.5081697162696146), FRAC_CONST(0.50949026948493636), FRAC_CONST(0.51080962382043904), FRAC_CONST(0.51212777617155469), FRAC_CONST(0.51344472343654346), FRAC_CONST(0.5147604625165012), FRAC_CONST(0.51607499031536663), FRAC_CONST(0.51738830373992906), FRAC_CONST(0.51870039969983495), FRAC_CONST(0.52001127510759604), FRAC_CONST(0.52132092687859566), FRAC_CONST(0.52262935193109661), FRAC_CONST(0.5239365471862486), FRAC_CONST(0.52524250956809471), FRAC_CONST(0.52654723600357944), FRAC_CONST(0.52785072342255523), FRAC_CONST(0.52915296875779061), FRAC_CONST(0.53045396894497632), FRAC_CONST(0.53175372092273332), FRAC_CONST(0.53305222163261945), FRAC_CONST(0.53434946801913752), FRAC_CONST(0.53564545702974109), FRAC_CONST(0.53694018561484291), FRAC_CONST(0.5382336507278217), FRAC_CONST(0.53952584932502889), FRAC_CONST(0.54081677836579667), FRAC_CONST(0.54210643481244392), FRAC_CONST(0.5433948156302848), FRAC_CONST(0.54468191778763453), FRAC_CONST(0.54596773825581757), FRAC_CONST(0.54725227400917409), FRAC_CONST(0.54853552202506739), FRAC_CONST(0.54981747928389091), FRAC_CONST(0.55109814276907543), FRAC_CONST(0.55237750946709607), FRAC_CONST(0.55365557636747931), FRAC_CONST(0.55493234046281037), FRAC_CONST(0.55620779874873993), FRAC_CONST(0.55748194822399155), FRAC_CONST(0.55875478589036831), FRAC_CONST(0.56002630875276038), FRAC_CONST(0.56129651381915147), FRAC_CONST(0.56256539810062656), FRAC_CONST(0.56383295861137817), FRAC_CONST(0.56509919236871398), FRAC_CONST(0.56636409639306384), FRAC_CONST(0.56762766770798623), FRAC_CONST(0.56888990334017586), FRAC_CONST(0.5701508003194703), FRAC_CONST(0.57141035567885723), FRAC_CONST(0.57266856645448116), FRAC_CONST(0.57392542968565075), FRAC_CONST(0.57518094241484508), FRAC_CONST(0.57643510168772183), FRAC_CONST(0.5776879045531228), FRAC_CONST(0.57893934806308178), FRAC_CONST(0.58018942927283168), FRAC_CONST(0.58143814524081017), FRAC_CONST(0.58268549302866846), FRAC_CONST(0.58393146970127618), FRAC_CONST(0.58517607232673041), FRAC_CONST(0.5864192979763605), FRAC_CONST(0.58766114372473666), FRAC_CONST(0.58890160664967572), FRAC_CONST(0.59014068383224882), FRAC_CONST(0.59137837235678758), FRAC_CONST(0.59261466931089113), FRAC_CONST(0.59384957178543363), FRAC_CONST(0.59508307687456996), FRAC_CONST(0.59631518167574371), FRAC_CONST(0.59754588328969316), FRAC_CONST(0.59877517882045872), FRAC_CONST(0.60000306537538894), FRAC_CONST(0.6012295400651485), FRAC_CONST(0.60245460000372375), FRAC_CONST(0.60367824230843037), FRAC_CONST(0.60490046409991982), FRAC_CONST(0.60612126250218612), FRAC_CONST(0.60734063464257293), FRAC_CONST(0.60855857765177945), FRAC_CONST(0.60977508866386843), FRAC_CONST(0.61099016481627166), FRAC_CONST(0.61220380324979795), FRAC_CONST(0.61341600110863859), FRAC_CONST(0.61462675554037505), FRAC_CONST(0.61583606369598509), FRAC_CONST(0.61704392272984976), FRAC_CONST(0.61825032979976025), FRAC_CONST(0.61945528206692402), FRAC_CONST(0.62065877669597214), FRAC_CONST(0.62186081085496536), FRAC_CONST(0.62306138171540126), FRAC_CONST(0.62426048645222065), FRAC_CONST(0.62545812224381436), FRAC_CONST(0.62665428627202935), FRAC_CONST(0.62784897572217646), FRAC_CONST(0.629042187783036), FRAC_CONST(0.63023391964686437), FRAC_CONST(0.63142416850940186), FRAC_CONST(0.63261293156987741), FRAC_CONST(0.63380020603101728), FRAC_CONST(0.63498598909904946), FRAC_CONST(0.63617027798371217), FRAC_CONST(0.63735306989825913), FRAC_CONST(0.63853436205946679), FRAC_CONST(0.63971415168764045), FRAC_CONST(0.64089243600662138), FRAC_CONST(0.64206921224379254), FRAC_CONST(0.64324447763008585), FRAC_CONST(0.64441822939998838), FRAC_CONST(0.64559046479154869), FRAC_CONST(0.64676118104638392), FRAC_CONST(0.64793037540968534), FRAC_CONST(0.64909804513022595), FRAC_CONST(0.65026418746036585), FRAC_CONST(0.65142879965605982), FRAC_CONST(0.65259187897686244), FRAC_CONST(0.65375342268593606), FRAC_CONST(0.65491342805005603), FRAC_CONST(0.6560718923396176), FRAC_CONST(0.65722881282864254), FRAC_CONST(0.65838418679478505), FRAC_CONST(0.65953801151933866), FRAC_CONST(0.6606902842872423), FRAC_CONST(0.66184100238708687), FRAC_CONST(0.66299016311112147), FRAC_CONST(0.66413776375526001), FRAC_CONST(0.66528380161908718), FRAC_CONST(0.66642827400586524), FRAC_CONST(0.66757117822254031), FRAC_CONST(0.66871251157974798), FRAC_CONST(0.66985227139182102), FRAC_CONST(0.67099045497679422), FRAC_CONST(0.67212705965641173), FRAC_CONST(0.67326208275613297), FRAC_CONST(0.67439552160513905), FRAC_CONST(0.67552737353633852), FRAC_CONST(0.67665763588637495), FRAC_CONST(0.6777863059956315), FRAC_CONST(0.67891338120823841), FRAC_CONST(0.68003885887207893), FRAC_CONST(0.68116273633879543), FRAC_CONST(0.68228501096379557), FRAC_CONST(0.68340568010625868), FRAC_CONST(0.6845247411291423), FRAC_CONST(0.68564219139918747), FRAC_CONST(0.68675802828692589), FRAC_CONST(0.68787224916668555), FRAC_CONST(0.68898485141659704), FRAC_CONST(0.69009583241859995), FRAC_CONST(0.69120518955844845), FRAC_CONST(0.69231292022571822), FRAC_CONST(0.69341902181381176), FRAC_CONST(0.69452349171996552), FRAC_CONST(0.69562632734525487), FRAC_CONST(0.6967275260946012), FRAC_CONST(0.69782708537677729), FRAC_CONST(0.69892500260441415), FRAC_CONST(0.70002127519400625), FRAC_CONST(0.70111590056591866), FRAC_CONST(0.70220887614439187), FRAC_CONST(0.70330019935754873), FRAC_CONST(0.70438986763740041), FRAC_CONST(0.7054778784198521), FRAC_CONST(0.70656422914470951), FRAC_CONST(0.70764891725568435), FRAC_CONST(0.70873194020040065), FRAC_CONST(0.70981329543040084), FRAC_CONST(0.71089298040115168), FRAC_CONST(0.71197099257204999), FRAC_CONST(0.71304732940642923), FRAC_CONST(0.71412198837156471), FRAC_CONST(0.71519496693868001), FRAC_CONST(0.71626626258295312), FRAC_CONST(0.71733587278352173), FRAC_CONST(0.71840379502348972), FRAC_CONST(0.71947002678993299), FRAC_CONST(0.72053456557390527), FRAC_CONST(0.72159740887044366), FRAC_CONST(0.72265855417857561), FRAC_CONST(0.72371799900132339), FRAC_CONST(0.72477574084571128), FRAC_CONST(0.72583177722277037), FRAC_CONST(0.72688610564754497), FRAC_CONST(0.72793872363909862), FRAC_CONST(0.72898962872051931), FRAC_CONST(0.73003881841892615), FRAC_CONST(0.73108629026547423), FRAC_CONST(0.73213204179536129), FRAC_CONST(0.73317607054783274), FRAC_CONST(0.73421837406618817), FRAC_CONST(0.73525894989778673), FRAC_CONST(0.73629779559405306), FRAC_CONST(0.73733490871048279), FRAC_CONST(0.73837028680664851), FRAC_CONST(0.73940392744620576), FRAC_CONST(0.74043582819689802), FRAC_CONST(0.74146598663056329), FRAC_CONST(0.74249440032313918), FRAC_CONST(0.74352106685466912), FRAC_CONST(0.74454598380930725), FRAC_CONST(0.74556914877532543), FRAC_CONST(0.74659055934511731), FRAC_CONST(0.74761021311520515), FRAC_CONST(0.74862810768624533), FRAC_CONST(0.74964424066303348), FRAC_CONST(0.75065860965451059), FRAC_CONST(0.75167121227376843), FRAC_CONST(0.75268204613805523), FRAC_CONST(0.75369110886878121), FRAC_CONST(0.75469839809152439), FRAC_CONST(0.75570391143603588), FRAC_CONST(0.75670764653624567), FRAC_CONST(0.75770960103026808), FRAC_CONST(0.75870977256040739), FRAC_CONST(0.75970815877316344), FRAC_CONST(0.76070475731923692), FRAC_CONST(0.76169956585353527), FRAC_CONST(0.76269258203517787), FRAC_CONST(0.76368380352750187), FRAC_CONST(0.76467322799806714), FRAC_CONST(0.76566085311866239), FRAC_CONST(0.76664667656531038), FRAC_CONST(0.76763069601827327), FRAC_CONST(0.76861290916205827), FRAC_CONST(0.76959331368542294), FRAC_CONST(0.7705719072813807), FRAC_CONST(0.7715486876472063), FRAC_CONST(0.77252365248444133), FRAC_CONST(0.77349679949889905), FRAC_CONST(0.77446812640067086), FRAC_CONST(0.77543763090413043), FRAC_CONST(0.77640531072794039), FRAC_CONST(0.7773711635950562), FRAC_CONST(0.77833518723273309), FRAC_CONST(0.7792973793725303), FRAC_CONST(0.78025773775031659), FRAC_CONST(0.78121626010627609), FRAC_CONST(0.7821729441849129), FRAC_CONST(0.78312778773505731), FRAC_CONST(0.78408078850986995), FRAC_CONST(0.78503194426684808), FRAC_CONST(0.78598125276783015), FRAC_CONST(0.7869287117790017), FRAC_CONST(0.78787431907090011), FRAC_CONST(0.78881807241842017), FRAC_CONST(0.78975996960081907), FRAC_CONST(0.79070000840172161), FRAC_CONST(0.79163818660912577), FRAC_CONST(0.79257450201540758), FRAC_CONST(0.79350895241732666), FRAC_CONST(0.79444153561603059), FRAC_CONST(0.79537224941706119), FRAC_CONST(0.79630109163035911), FRAC_CONST(0.7972280600702687), FRAC_CONST(0.79815315255554375), FRAC_CONST(0.79907636690935235), FRAC_CONST(0.79999770095928191), FRAC_CONST(0.8009171525373443), FRAC_CONST(0.80183471947998131), FRAC_CONST(0.80275039962806916), FRAC_CONST(0.80366419082692409), FRAC_CONST(0.804576090926307), FRAC_CONST(0.80548609778042912), FRAC_CONST(0.80639420924795624), FRAC_CONST(0.80730042319201445), FRAC_CONST(0.80820473748019472), FRAC_CONST(0.80910714998455813), FRAC_CONST(0.81000765858164114), FRAC_CONST(0.81090626115245967), FRAC_CONST(0.81180295558251536), FRAC_CONST(0.81269773976179949), FRAC_CONST(0.81359061158479851), FRAC_CONST(0.81448156895049861), FRAC_CONST(0.81537060976239129), FRAC_CONST(0.81625773192847739), FRAC_CONST(0.81714293336127297), FRAC_CONST(0.81802621197781344), FRAC_CONST(0.81890756569965895), FRAC_CONST(0.81978699245289899), FRAC_CONST(0.82066449016815746), FRAC_CONST(0.82154005678059761), FRAC_CONST(0.82241369022992639), FRAC_CONST(0.82328538846040011), FRAC_CONST(0.82415514942082857), FRAC_CONST(0.82502297106458022), FRAC_CONST(0.82588885134958678), FRAC_CONST(0.82675278823834852), FRAC_CONST(0.8276147796979384), FRAC_CONST(0.82847482370000713), FRAC_CONST(0.82933291822078825), FRAC_CONST(0.83018906124110237), FRAC_CONST(0.83104325074636232), FRAC_CONST(0.83189548472657759), FRAC_CONST(0.83274576117635946), FRAC_CONST(0.83359407809492514), FRAC_CONST(0.83444043348610319), FRAC_CONST(0.83528482535833737), FRAC_CONST(0.83612725172469216), FRAC_CONST(0.83696771060285702), FRAC_CONST(0.83780620001515094), FRAC_CONST(0.8386427179885273), FRAC_CONST(0.83947726255457855), FRAC_CONST(0.84030983174954077), FRAC_CONST(0.84114042361429808), FRAC_CONST(0.84196903619438768), FRAC_CONST(0.84279566754000412), FRAC_CONST(0.84362031570600404), FRAC_CONST(0.84444297875191066), FRAC_CONST(0.84526365474191822), FRAC_CONST(0.84608234174489694), FRAC_CONST(0.84689903783439735), FRAC_CONST(0.84771374108865427), FRAC_CONST(0.84852644959059265), FRAC_CONST(0.84933716142783067), FRAC_CONST(0.85014587469268521), FRAC_CONST(0.85095258748217573), FRAC_CONST(0.85175729789802912), FRAC_CONST(0.85256000404668397), FRAC_CONST(0.85336070403929543), FRAC_CONST(0.85415939599173873), FRAC_CONST(0.85495607802461482), FRAC_CONST(0.85575074826325392), FRAC_CONST(0.85654340483771996), FRAC_CONST(0.85733404588281559), FRAC_CONST(0.85812266953808602), FRAC_CONST(0.8589092739478239), FRAC_CONST(0.85969385726107261), FRAC_CONST(0.86047641763163207), FRAC_CONST(0.86125695321806206), FRAC_CONST(0.86203546218368721), FRAC_CONST(0.86281194269660033), FRAC_CONST(0.86358639292966799), FRAC_CONST(0.86435881106053403), FRAC_CONST(0.86512919527162369), FRAC_CONST(0.86589754375014882), FRAC_CONST(0.86666385468811102), FRAC_CONST(0.86742812628230692), FRAC_CONST(0.86819035673433131), FRAC_CONST(0.86895054425058238), FRAC_CONST(0.86970868704226556), FRAC_CONST(0.87046478332539767), FRAC_CONST(0.8712188313208109), FRAC_CONST(0.8719708292541577), FRAC_CONST(0.8727207753559143), FRAC_CONST(0.87346866786138488), FRAC_CONST(0.8742145050107063), FRAC_CONST(0.87495828504885154), FRAC_CONST(0.8757000062256346), FRAC_CONST(0.87643966679571361), FRAC_CONST(0.87717726501859594), FRAC_CONST(0.87791279915864173), FRAC_CONST(0.87864626748506813), FRAC_CONST(0.87937766827195318), FRAC_CONST(0.88010699979824036), FRAC_CONST(0.88083426034774204), FRAC_CONST(0.88155944820914378), FRAC_CONST(0.8822825616760086), FRAC_CONST(0.88300359904678072), FRAC_CONST(0.88372255862478966), FRAC_CONST(0.8844394387182537), FRAC_CONST(0.88515423764028511), FRAC_CONST(0.88586695370889279), FRAC_CONST(0.88657758524698704), FRAC_CONST(0.88728613058238315), FRAC_CONST(0.88799258804780556), FRAC_CONST(0.88869695598089171), FRAC_CONST(0.88939923272419552), FRAC_CONST(0.89009941662519221), FRAC_CONST(0.89079750603628149), FRAC_CONST(0.89149349931479138), FRAC_CONST(0.89218739482298248), FRAC_CONST(0.89287919092805168), FRAC_CONST(0.89356888600213602), FRAC_CONST(0.89425647842231604), FRAC_CONST(0.89494196657062075), FRAC_CONST(0.89562534883403), FRAC_CONST(0.89630662360447966), FRAC_CONST(0.89698578927886397), FRAC_CONST(0.89766284425904075), FRAC_CONST(0.89833778695183419), FRAC_CONST(0.89901061576903907), FRAC_CONST(0.89968132912742393), FRAC_CONST(0.9003499254487356), FRAC_CONST(0.90101640315970233), FRAC_CONST(0.90168076069203773), FRAC_CONST(0.9023429964824442), FRAC_CONST(0.90300310897261704), FRAC_CONST(0.90366109660924798), FRAC_CONST(0.90431695784402832), FRAC_CONST(0.90497069113365325), FRAC_CONST(0.90562229493982516), FRAC_CONST(0.90627176772925766), FRAC_CONST(0.90691910797367803), FRAC_CONST(0.90756431414983252), FRAC_CONST(0.9082073847394887), FRAC_CONST(0.90884831822943912), FRAC_CONST(0.90948711311150543), FRAC_CONST(0.91012376788254157), FRAC_CONST(0.91075828104443757), FRAC_CONST(0.91139065110412232), FRAC_CONST(0.91202087657356823), FRAC_CONST(0.9126489559697939), FRAC_CONST(0.91327488781486776), FRAC_CONST(0.91389867063591168), FRAC_CONST(0.91452030296510445), FRAC_CONST(0.91513978333968526), FRAC_CONST(0.91575711030195672), FRAC_CONST(0.91637228239928914), FRAC_CONST(0.91698529818412289), FRAC_CONST(0.91759615621397295), FRAC_CONST(0.9182048550514309), FRAC_CONST(0.91881139326416994), FRAC_CONST(0.91941576942494696), FRAC_CONST(0.92001798211160657), FRAC_CONST(0.92061802990708386), FRAC_CONST(0.92121591139940873), FRAC_CONST(0.92181162518170812), FRAC_CONST(0.92240516985220988), FRAC_CONST(0.92299654401424625), FRAC_CONST(0.92358574627625656), FRAC_CONST(0.9241727752517912), FRAC_CONST(0.92475762955951391), FRAC_CONST(0.9253403078232062), FRAC_CONST(0.92592080867176996), FRAC_CONST(0.92649913073923051), FRAC_CONST(0.9270752726647401), FRAC_CONST(0.92764923309258118), FRAC_CONST(0.92822101067216944), FRAC_CONST(0.92879060405805702), FRAC_CONST(0.9293580119099355), FRAC_CONST(0.92992323289263956), FRAC_CONST(0.93048626567614978), FRAC_CONST(0.93104710893559517), FRAC_CONST(0.93160576135125783), FRAC_CONST(0.93216222160857432), FRAC_CONST(0.93271648839814025), FRAC_CONST(0.93326856041571205), FRAC_CONST(0.93381843636221096), FRAC_CONST(0.9343661149437259), FRAC_CONST(0.93491159487151609), FRAC_CONST(0.93545487486201462), FRAC_CONST(0.9359959536368313), FRAC_CONST(0.9365348299227555), FRAC_CONST(0.93707150245175919), FRAC_CONST(0.93760596996099999), FRAC_CONST(0.93813823119282436), FRAC_CONST(0.93866828489477017), FRAC_CONST(0.9391961298195699), FRAC_CONST(0.93972176472515334), FRAC_CONST(0.94024518837465088), FRAC_CONST(0.94076639953639607), FRAC_CONST(0.94128539698392866), FRAC_CONST(0.94180217949599765), FRAC_CONST(0.94231674585656378), FRAC_CONST(0.94282909485480271), FRAC_CONST(0.94333922528510772), FRAC_CONST(0.94384713594709269), FRAC_CONST(0.94435282564559475), FRAC_CONST(0.94485629319067721), FRAC_CONST(0.94535753739763229), FRAC_CONST(0.94585655708698391), FRAC_CONST(0.94635335108449059), FRAC_CONST(0.946847918221148), FRAC_CONST(0.94734025733319194), FRAC_CONST(0.94783036726210101), FRAC_CONST(0.94831824685459909), FRAC_CONST(0.94880389496265838), FRAC_CONST(0.94928731044350201), FRAC_CONST(0.94976849215960668), FRAC_CONST(0.95024743897870523), FRAC_CONST(0.95072414977378961), FRAC_CONST(0.95119862342311323), FRAC_CONST(0.95167085881019386), FRAC_CONST(0.95214085482381583), FRAC_CONST(0.95260861035803324), FRAC_CONST(0.9530741243121722), FRAC_CONST(0.95353739559083328), FRAC_CONST(0.95399842310389449), FRAC_CONST(0.95445720576651349), FRAC_CONST(0.95491374249913052), FRAC_CONST(0.95536803222747024), FRAC_CONST(0.95582007388254542), FRAC_CONST(0.95626986640065814), FRAC_CONST(0.95671740872340305), FRAC_CONST(0.9571626997976701), FRAC_CONST(0.95760573857564624), FRAC_CONST(0.9580465240148186), FRAC_CONST(0.9584850550779761), FRAC_CONST(0.95892133073321306), FRAC_CONST(0.95935534995393079), FRAC_CONST(0.9597871117188399), FRAC_CONST(0.96021661501196343), FRAC_CONST(0.96064385882263847), FRAC_CONST(0.96106884214551935), FRAC_CONST(0.961491563980579), FRAC_CONST(0.9619120233331121), FRAC_CONST(0.9623302192137374), FRAC_CONST(0.96274615063839941), FRAC_CONST(0.96315981662837136), FRAC_CONST(0.96357121621025721), FRAC_CONST(0.96398034841599411), FRAC_CONST(0.96438721228285429), FRAC_CONST(0.9647918068534479), FRAC_CONST(0.96519413117572472), FRAC_CONST(0.96559418430297683), FRAC_CONST(0.96599196529384057), FRAC_CONST(0.96638747321229879), FRAC_CONST(0.96678070712768327), FRAC_CONST(0.96717166611467664), FRAC_CONST(0.96756034925331436), FRAC_CONST(0.9679467556289878), FRAC_CONST(0.9683308843324453), FRAC_CONST(0.96871273445979478), FRAC_CONST(0.9690923051125061), FRAC_CONST(0.96946959539741295), FRAC_CONST(0.96984460442671483), FRAC_CONST(0.97021733131797916), FRAC_CONST(0.97058777519414363), FRAC_CONST(0.97095593518351797), FRAC_CONST(0.97132181041978616), FRAC_CONST(0.97168540004200854), FRAC_CONST(0.9720467031946235), FRAC_CONST(0.97240571902744977), FRAC_CONST(0.97276244669568857), FRAC_CONST(0.97311688535992513), FRAC_CONST(0.97346903418613095), FRAC_CONST(0.9738188923456661), FRAC_CONST(0.97416645901528032), FRAC_CONST(0.97451173337711572), FRAC_CONST(0.97485471461870843), FRAC_CONST(0.97519540193299037), FRAC_CONST(0.97553379451829136), FRAC_CONST(0.97586989157834103), FRAC_CONST(0.97620369232227056), FRAC_CONST(0.97653519596461447), FRAC_CONST(0.97686440172531264), FRAC_CONST(0.97719130882971228), FRAC_CONST(0.97751591650856928), FRAC_CONST(0.97783822399805043), FRAC_CONST(0.97815823053973505), FRAC_CONST(0.97847593538061683), FRAC_CONST(0.97879133777310567), FRAC_CONST(0.97910443697502925), FRAC_CONST(0.97941523224963478), FRAC_CONST(0.97972372286559117), FRAC_CONST(0.98002990809698998), FRAC_CONST(0.98033378722334796), FRAC_CONST(0.98063535952960812), FRAC_CONST(0.98093462430614164), FRAC_CONST(0.98123158084874973), FRAC_CONST(0.98152622845866466), FRAC_CONST(0.9818185664425525), FRAC_CONST(0.98210859411251361), FRAC_CONST(0.98239631078608469), FRAC_CONST(0.98268171578624086), FRAC_CONST(0.98296480844139644), FRAC_CONST(0.98324558808540707), FRAC_CONST(0.98352405405757126), FRAC_CONST(0.98380020570263149), FRAC_CONST(0.98407404237077645), FRAC_CONST(0.9843455634176419), FRAC_CONST(0.9846147682043126), FRAC_CONST(0.9848816560973237), FRAC_CONST(0.98514622646866223), FRAC_CONST(0.98540847869576842), FRAC_CONST(0.98566841216153755), FRAC_CONST(0.98592602625432113), FRAC_CONST(0.98618132036792827), FRAC_CONST(0.98643429390162707), FRAC_CONST(0.98668494626014669), FRAC_CONST(0.98693327685367771), FRAC_CONST(0.98717928509787434), FRAC_CONST(0.98742297041385541), FRAC_CONST(0.98766433222820571), FRAC_CONST(0.98790336997297779), FRAC_CONST(0.98814008308569257), FRAC_CONST(0.98837447100934128), FRAC_CONST(0.98860653319238645), FRAC_CONST(0.98883626908876354), FRAC_CONST(0.98906367815788154), FRAC_CONST(0.98928875986462517), FRAC_CONST(0.98951151367935519), FRAC_CONST(0.98973193907791057), FRAC_CONST(0.98995003554160899), FRAC_CONST(0.9901658025572484), FRAC_CONST(0.99037923961710816), FRAC_CONST(0.99059034621895015), FRAC_CONST(0.99079912186602037), FRAC_CONST(0.99100556606704937), FRAC_CONST(0.99120967833625406), FRAC_CONST(0.99141145819333854), FRAC_CONST(0.99161090516349537), FRAC_CONST(0.99180801877740643), FRAC_CONST(0.99200279857124452), FRAC_CONST(0.99219524408667392), FRAC_CONST(0.99238535487085167), FRAC_CONST(0.99257313047642881), FRAC_CONST(0.99275857046155114), FRAC_CONST(0.99294167438986047), FRAC_CONST(0.99312244183049558), FRAC_CONST(0.99330087235809328), FRAC_CONST(0.99347696555278919), FRAC_CONST(0.99365072100021912), FRAC_CONST(0.99382213829151966), FRAC_CONST(0.99399121702332938), FRAC_CONST(0.99415795679778973), FRAC_CONST(0.99432235722254581), FRAC_CONST(0.9944844179107476), FRAC_CONST(0.99464413848105071), FRAC_CONST(0.99480151855761711), FRAC_CONST(0.99495655777011638), FRAC_CONST(0.99510925575372611), FRAC_CONST(0.99525961214913339), FRAC_CONST(0.9954076266025349), FRAC_CONST(0.99555329876563847), FRAC_CONST(0.99569662829566352), FRAC_CONST(0.99583761485534161), FRAC_CONST(0.99597625811291779), FRAC_CONST(0.99611255774215113), FRAC_CONST(0.99624651342231552), FRAC_CONST(0.99637812483820021), FRAC_CONST(0.99650739168011082), FRAC_CONST(0.9966343136438699), FRAC_CONST(0.996758890430818), FRAC_CONST(0.99688112174781385), FRAC_CONST(0.99700100730723529), FRAC_CONST(0.99711854682697998), FRAC_CONST(0.99723374003046616), FRAC_CONST(0.99734658664663323), FRAC_CONST(0.99745708640994191), FRAC_CONST(0.99756523906037575), FRAC_CONST(0.997671044343441), FRAC_CONST(0.99777450201016782), FRAC_CONST(0.99787561181711015), FRAC_CONST(0.99797437352634699), FRAC_CONST(0.99807078690548234), FRAC_CONST(0.99816485172764624), FRAC_CONST(0.99825656777149518), FRAC_CONST(0.99834593482121237), FRAC_CONST(0.99843295266650844), FRAC_CONST(0.99851762110262221), FRAC_CONST(0.99859993993032037), FRAC_CONST(0.99867990895589909), FRAC_CONST(0.99875752799118334), FRAC_CONST(0.99883279685352799), FRAC_CONST(0.99890571536581829), FRAC_CONST(0.99897628335646982), FRAC_CONST(0.99904450065942929), FRAC_CONST(0.99911036711417489), FRAC_CONST(0.99917388256571638), FRAC_CONST(0.99923504686459585), FRAC_CONST(0.99929385986688779), FRAC_CONST(0.99935032143419944), FRAC_CONST(0.9994044314336713), FRAC_CONST(0.99945618973797734), FRAC_CONST(0.99950559622532531), FRAC_CONST(0.99955265077945699), FRAC_CONST(0.99959735328964838), FRAC_CONST(0.9996397036507102), FRAC_CONST(0.99967970176298793), FRAC_CONST(0.99971734753236219), FRAC_CONST(0.99975264087024884), FRAC_CONST(0.99978558169359921), FRAC_CONST(0.99981616992490041), FRAC_CONST(0.99984440549217524), FRAC_CONST(0.99987028832898295), FRAC_CONST(0.99989381837441849), FRAC_CONST(0.99991499557311347), FRAC_CONST(0.999933819875236), FRAC_CONST(0.99995029123649048), FRAC_CONST(0.99996440961811828), FRAC_CONST(0.99997617498689761), FRAC_CONST(0.9999855873151432), FRAC_CONST(0.99999264658070719), FRAC_CONST(0.99999735276697821), FRAC_CONST(0.99999970586288223) }; #ifdef ALLOW_SMALL_FRAMELENGTH ALIGN static const real_t sine_long_960[] = { FRAC_CONST(0.00081812299560725323), FRAC_CONST(0.0024543667964602917), FRAC_CONST(0.0040906040262347889), FRAC_CONST(0.0057268303042312674), FRAC_CONST(0.0073630412497795667), FRAC_CONST(0.0089992324822505774), FRAC_CONST(0.010635399621067975), FRAC_CONST(0.012271538285719924), FRAC_CONST(0.013907644095770845), FRAC_CONST(0.015543712670873098), FRAC_CONST(0.017179739630778748), FRAC_CONST(0.018815720595351273), FRAC_CONST(0.020451651184577292), FRAC_CONST(0.022087527018578291), FRAC_CONST(0.023723343717622358), FRAC_CONST(0.025359096902135895), FRAC_CONST(0.02699478219271537), FRAC_CONST(0.028630395210139003), FRAC_CONST(0.030265931575378519), FRAC_CONST(0.031901386909610863), FRAC_CONST(0.033536756834229922), FRAC_CONST(0.035172036970858266), FRAC_CONST(0.036807222941358832), FRAC_CONST(0.038442310367846677), FRAC_CONST(0.040077294872700696), FRAC_CONST(0.041712172078575326), FRAC_CONST(0.043346937608412288), FRAC_CONST(0.044981587085452281), FRAC_CONST(0.046616116133246711), FRAC_CONST(0.048250520375669431), FRAC_CONST(0.049884795436928406), FRAC_CONST(0.051518936941577477), FRAC_CONST(0.053152940514528055), FRAC_CONST(0.05478680178106083), FRAC_CONST(0.056420516366837495), FRAC_CONST(0.05805407989791244), FRAC_CONST(0.059687488000744485), FRAC_CONST(0.061320736302208578), FRAC_CONST(0.062953820429607482), FRAC_CONST(0.064586736010683557), FRAC_CONST(0.066219478673630344), FRAC_CONST(0.06785204404710439), FRAC_CONST(0.069484427760236861), FRAC_CONST(0.071116625442645326), FRAC_CONST(0.072748632724445372), FRAC_CONST(0.07438044523626236), FRAC_CONST(0.076012058609243122), FRAC_CONST(0.077643468475067631), FRAC_CONST(0.079274670465960706), FRAC_CONST(0.080905660214703745), FRAC_CONST(0.082536433354646319), FRAC_CONST(0.084166985519717977), FRAC_CONST(0.085797312344439894), FRAC_CONST(0.08742740946393647), FRAC_CONST(0.089057272513947183), FRAC_CONST(0.090686897130838162), FRAC_CONST(0.092316278951613845), FRAC_CONST(0.093945413613928788), FRAC_CONST(0.095574296756099186), FRAC_CONST(0.097202924017114667), FRAC_CONST(0.098831291036649963), FRAC_CONST(0.10045939345507648), FRAC_CONST(0.10208722691347409), FRAC_CONST(0.10371478705364276), FRAC_CONST(0.10534206951811415), FRAC_CONST(0.10696906995016341), FRAC_CONST(0.10859578399382072), FRAC_CONST(0.11022220729388306), FRAC_CONST(0.11184833549592579), FRAC_CONST(0.11347416424631435), FRAC_CONST(0.11509968919221586), FRAC_CONST(0.11672490598161089), FRAC_CONST(0.11834981026330495), FRAC_CONST(0.11997439768694031), FRAC_CONST(0.12159866390300751), FRAC_CONST(0.12322260456285709), FRAC_CONST(0.12484621531871121), FRAC_CONST(0.12646949182367517), FRAC_CONST(0.12809242973174936), FRAC_CONST(0.12971502469784052), FRAC_CONST(0.13133727237777362), FRAC_CONST(0.13295916842830346), FRAC_CONST(0.13458070850712617), FRAC_CONST(0.13620188827289101), FRAC_CONST(0.1378227033852118), FRAC_CONST(0.13944314950467873), FRAC_CONST(0.14106322229286994), FRAC_CONST(0.14268291741236291), FRAC_CONST(0.14430223052674654), FRAC_CONST(0.1459211573006321), FRAC_CONST(0.14753969339966552), FRAC_CONST(0.14915783449053857), FRAC_CONST(0.15077557624100058), FRAC_CONST(0.15239291431987001), FRAC_CONST(0.1540098443970461), FRAC_CONST(0.15562636214352044), FRAC_CONST(0.15724246323138855), FRAC_CONST(0.15885814333386142), FRAC_CONST(0.16047339812527725), FRAC_CONST(0.16208822328111283), FRAC_CONST(0.16370261447799525), FRAC_CONST(0.16531656739371339), FRAC_CONST(0.16693007770722967), FRAC_CONST(0.16854314109869134), FRAC_CONST(0.17015575324944232), FRAC_CONST(0.17176790984203447), FRAC_CONST(0.17337960656023954), FRAC_CONST(0.1749908390890603), FRAC_CONST(0.17660160311474243), FRAC_CONST(0.17821189432478593), FRAC_CONST(0.17982170840795647), FRAC_CONST(0.18143104105429744), FRAC_CONST(0.18303988795514095), FRAC_CONST(0.1846482448031197), FRAC_CONST(0.18625610729217834), FRAC_CONST(0.1878634711175852), FRAC_CONST(0.18947033197594348), FRAC_CONST(0.19107668556520319), FRAC_CONST(0.19268252758467228), FRAC_CONST(0.19428785373502844), FRAC_CONST(0.19589265971833042), FRAC_CONST(0.19749694123802966), FRAC_CONST(0.19910069399898173), FRAC_CONST(0.20070391370745785), FRAC_CONST(0.20230659607115639), FRAC_CONST(0.20390873679921437), FRAC_CONST(0.20551033160221882), FRAC_CONST(0.20711137619221856), FRAC_CONST(0.2087118662827353), FRAC_CONST(0.21031179758877552), FRAC_CONST(0.21191116582684155), FRAC_CONST(0.21350996671494335), FRAC_CONST(0.21510819597260972), FRAC_CONST(0.21670584932089998), FRAC_CONST(0.2183029224824154), FRAC_CONST(0.21989941118131037), FRAC_CONST(0.22149531114330431), FRAC_CONST(0.22309061809569264), FRAC_CONST(0.22468532776735861), FRAC_CONST(0.22627943588878449), FRAC_CONST(0.22787293819206314), FRAC_CONST(0.22946583041090929), FRAC_CONST(0.23105810828067114), FRAC_CONST(0.23264976753834157), FRAC_CONST(0.23424080392256985), FRAC_CONST(0.2358312131736727), FRAC_CONST(0.23742099103364595), FRAC_CONST(0.23901013324617584), FRAC_CONST(0.24059863555665045), FRAC_CONST(0.24218649371217096), FRAC_CONST(0.24377370346156332), FRAC_CONST(0.24536026055538934), FRAC_CONST(0.24694616074595824), FRAC_CONST(0.24853139978733788), FRAC_CONST(0.25011597343536629), FRAC_CONST(0.25169987744766298), FRAC_CONST(0.25328310758364025), FRAC_CONST(0.25486565960451457), FRAC_CONST(0.25644752927331788), FRAC_CONST(0.25802871235490898), FRAC_CONST(0.25960920461598508), FRAC_CONST(0.26118900182509258), FRAC_CONST(0.26276809975263904), FRAC_CONST(0.264346494170904), FRAC_CONST(0.26592418085405067), FRAC_CONST(0.26750115557813692), FRAC_CONST(0.2690774141211269), FRAC_CONST(0.27065295226290209), FRAC_CONST(0.2722277657852728), FRAC_CONST(0.27380185047198918), FRAC_CONST(0.27537520210875299), FRAC_CONST(0.2769478164832283), FRAC_CONST(0.27851968938505312), FRAC_CONST(0.28009081660585067), FRAC_CONST(0.28166119393924061), FRAC_CONST(0.28323081718085019), FRAC_CONST(0.28479968212832563), FRAC_CONST(0.28636778458134327), FRAC_CONST(0.28793512034162105), FRAC_CONST(0.2895016852129294), FRAC_CONST(0.29106747500110264), FRAC_CONST(0.29263248551405047), FRAC_CONST(0.2941967125617686), FRAC_CONST(0.29576015195635058), FRAC_CONST(0.29732279951199847), FRAC_CONST(0.29888465104503475), FRAC_CONST(0.30044570237391266), FRAC_CONST(0.30200594931922808), FRAC_CONST(0.30356538770373032), FRAC_CONST(0.30512401335233358), FRAC_CONST(0.30668182209212791), FRAC_CONST(0.3082388097523906), FRAC_CONST(0.30979497216459695), FRAC_CONST(0.31135030516243201), FRAC_CONST(0.3129048045818012), FRAC_CONST(0.31445846626084178), FRAC_CONST(0.31601128603993378), FRAC_CONST(0.31756325976171151), FRAC_CONST(0.31911438327107416), FRAC_CONST(0.32066465241519732), FRAC_CONST(0.32221406304354389), FRAC_CONST(0.3237626110078754), FRAC_CONST(0.32531029216226293), FRAC_CONST(0.32685710236309828), FRAC_CONST(0.32840303746910487), FRAC_CONST(0.32994809334134939), FRAC_CONST(0.3314922658432522), FRAC_CONST(0.33303555084059877), FRAC_CONST(0.33457794420155085), FRAC_CONST(0.33611944179665709), FRAC_CONST(0.33766003949886464), FRAC_CONST(0.33919973318352969), FRAC_CONST(0.34073851872842903), FRAC_CONST(0.34227639201377064), FRAC_CONST(0.34381334892220483), FRAC_CONST(0.34534938533883547), FRAC_CONST(0.34688449715123082), FRAC_CONST(0.34841868024943456), FRAC_CONST(0.34995193052597684), FRAC_CONST(0.35148424387588523), FRAC_CONST(0.3530156161966958), FRAC_CONST(0.35454604338846402), FRAC_CONST(0.35607552135377557), FRAC_CONST(0.35760404599775775), FRAC_CONST(0.35913161322809023), FRAC_CONST(0.36065821895501554), FRAC_CONST(0.36218385909135092), FRAC_CONST(0.36370852955249849), FRAC_CONST(0.36523222625645668), FRAC_CONST(0.36675494512383078), FRAC_CONST(0.36827668207784414), FRAC_CONST(0.36979743304434909), FRAC_CONST(0.37131719395183754), FRAC_CONST(0.37283596073145214), FRAC_CONST(0.37435372931699717), FRAC_CONST(0.37587049564494951), FRAC_CONST(0.37738625565446909), FRAC_CONST(0.37890100528741022), FRAC_CONST(0.38041474048833229), FRAC_CONST(0.38192745720451066), FRAC_CONST(0.38343915138594736), FRAC_CONST(0.38494981898538222), FRAC_CONST(0.38645945595830333), FRAC_CONST(0.38796805826295838), FRAC_CONST(0.38947562186036483), FRAC_CONST(0.39098214271432141), FRAC_CONST(0.39248761679141814), FRAC_CONST(0.3939920400610481), FRAC_CONST(0.39549540849541737), FRAC_CONST(0.39699771806955625), FRAC_CONST(0.39849896476132979), FRAC_CONST(0.39999914455144892), FRAC_CONST(0.40149825342348083), FRAC_CONST(0.4029962873638599), FRAC_CONST(0.40449324236189854), FRAC_CONST(0.40598911440979762), FRAC_CONST(0.40748389950265762), FRAC_CONST(0.40897759363848879), FRAC_CONST(0.41047019281822261), FRAC_CONST(0.41196169304572178), FRAC_CONST(0.4134520903277914), FRAC_CONST(0.41494138067418929), FRAC_CONST(0.41642956009763715), FRAC_CONST(0.41791662461383078), FRAC_CONST(0.41940257024145089), FRAC_CONST(0.42088739300217382), FRAC_CONST(0.42237108892068231), FRAC_CONST(0.42385365402467584), FRAC_CONST(0.42533508434488143), FRAC_CONST(0.42681537591506419), FRAC_CONST(0.42829452477203828), FRAC_CONST(0.42977252695567697), FRAC_CONST(0.43124937850892364), FRAC_CONST(0.4327250754778022), FRAC_CONST(0.43419961391142781), FRAC_CONST(0.43567298986201736), FRAC_CONST(0.43714519938489987), FRAC_CONST(0.43861623853852766), FRAC_CONST(0.44008610338448595), FRAC_CONST(0.44155478998750436), FRAC_CONST(0.44302229441546676), FRAC_CONST(0.4444886127394222), FRAC_CONST(0.44595374103359531), FRAC_CONST(0.44741767537539667), FRAC_CONST(0.44888041184543348), FRAC_CONST(0.45034194652752002), FRAC_CONST(0.45180227550868812), FRAC_CONST(0.45326139487919759), FRAC_CONST(0.45471930073254679), FRAC_CONST(0.45617598916548296), FRAC_CONST(0.45763145627801283), FRAC_CONST(0.45908569817341294), FRAC_CONST(0.46053871095824001), FRAC_CONST(0.46199049074234161), FRAC_CONST(0.46344103363886635), FRAC_CONST(0.46489033576427435), FRAC_CONST(0.46633839323834758), FRAC_CONST(0.46778520218420055), FRAC_CONST(0.46923075872829029), FRAC_CONST(0.47067505900042683), FRAC_CONST(0.47211809913378361), FRAC_CONST(0.47355987526490806), FRAC_CONST(0.47500038353373153), FRAC_CONST(0.47643962008357982), FRAC_CONST(0.47787758106118372), FRAC_CONST(0.47931426261668875), FRAC_CONST(0.48074966090366611), FRAC_CONST(0.48218377207912272), FRAC_CONST(0.48361659230351117), FRAC_CONST(0.48504811774074069), FRAC_CONST(0.48647834455818684), FRAC_CONST(0.48790726892670194), FRAC_CONST(0.48933488702062544), FRAC_CONST(0.49076119501779414), FRAC_CONST(0.49218618909955225), FRAC_CONST(0.4936098654507618), FRAC_CONST(0.49503222025981269), FRAC_CONST(0.49645324971863303), FRAC_CONST(0.49787295002269943), FRAC_CONST(0.49929131737104687), FRAC_CONST(0.50070834796627917), FRAC_CONST(0.50212403801457872), FRAC_CONST(0.50353838372571758), FRAC_CONST(0.50495138131306638), FRAC_CONST(0.50636302699360547), FRAC_CONST(0.50777331698793449), FRAC_CONST(0.50918224752028263), FRAC_CONST(0.51058981481851906), FRAC_CONST(0.51199601511416237), FRAC_CONST(0.51340084464239111), FRAC_CONST(0.51480429964205421), FRAC_CONST(0.51620637635567967), FRAC_CONST(0.51760707102948678), FRAC_CONST(0.51900637991339404), FRAC_CONST(0.5204042992610306), FRAC_CONST(0.52180082532974559), FRAC_CONST(0.5231959543806185), FRAC_CONST(0.52458968267846895), FRAC_CONST(0.52598200649186677), FRAC_CONST(0.52737292209314235), FRAC_CONST(0.52876242575839572), FRAC_CONST(0.53015051376750777), FRAC_CONST(0.53153718240414882), FRAC_CONST(0.53292242795578992), FRAC_CONST(0.53430624671371152), FRAC_CONST(0.53568863497301467), FRAC_CONST(0.5370695890326298), FRAC_CONST(0.5384491051953274), FRAC_CONST(0.53982717976772743), FRAC_CONST(0.54120380906030963), FRAC_CONST(0.54257898938742311), FRAC_CONST(0.54395271706729609), FRAC_CONST(0.54532498842204646), FRAC_CONST(0.54669579977769045), FRAC_CONST(0.54806514746415402), FRAC_CONST(0.54943302781528081), FRAC_CONST(0.55079943716884383), FRAC_CONST(0.55216437186655387), FRAC_CONST(0.55352782825406999), FRAC_CONST(0.55488980268100907), FRAC_CONST(0.55625029150095584), FRAC_CONST(0.55760929107147217), FRAC_CONST(0.55896679775410718), FRAC_CONST(0.56032280791440714), FRAC_CONST(0.56167731792192455), FRAC_CONST(0.56303032415022869), FRAC_CONST(0.56438182297691453), FRAC_CONST(0.56573181078361312), FRAC_CONST(0.56708028395600085), FRAC_CONST(0.56842723888380908), FRAC_CONST(0.56977267196083425), FRAC_CONST(0.57111657958494688), FRAC_CONST(0.5724589581581021), FRAC_CONST(0.57379980408634845), FRAC_CONST(0.57513911377983773), FRAC_CONST(0.57647688365283478), FRAC_CONST(0.57781311012372738), FRAC_CONST(0.57914778961503466), FRAC_CONST(0.58048091855341843), FRAC_CONST(0.5818124933696911), FRAC_CONST(0.58314251049882604), FRAC_CONST(0.58447096637996743), FRAC_CONST(0.58579785745643886), FRAC_CONST(0.5871231801757536), FRAC_CONST(0.58844693098962408), FRAC_CONST(0.58976910635397084), FRAC_CONST(0.59108970272893235), FRAC_CONST(0.59240871657887517), FRAC_CONST(0.59372614437240179), FRAC_CONST(0.59504198258236196), FRAC_CONST(0.5963562276858605), FRAC_CONST(0.59766887616426767), FRAC_CONST(0.5989799245032289), FRAC_CONST(0.60028936919267273), FRAC_CONST(0.60159720672682204), FRAC_CONST(0.60290343360420195), FRAC_CONST(0.60420804632765002), FRAC_CONST(0.60551104140432543), FRAC_CONST(0.60681241534571839), FRAC_CONST(0.60811216466765883), FRAC_CONST(0.60941028589032709), FRAC_CONST(0.61070677553826169), FRAC_CONST(0.61200163014036979), FRAC_CONST(0.61329484622993602), FRAC_CONST(0.6145864203446314), FRAC_CONST(0.61587634902652377), FRAC_CONST(0.61716462882208556), FRAC_CONST(0.61845125628220421), FRAC_CONST(0.61973622796219074), FRAC_CONST(0.6210195404217892), FRAC_CONST(0.62230119022518593), FRAC_CONST(0.62358117394101897), FRAC_CONST(0.62485948814238634), FRAC_CONST(0.62613612940685637), FRAC_CONST(0.62741109431647646), FRAC_CONST(0.62868437945778133), FRAC_CONST(0.62995598142180387), FRAC_CONST(0.6312258968040827), FRAC_CONST(0.63249412220467238), FRAC_CONST(0.63376065422815175), FRAC_CONST(0.63502548948363347), FRAC_CONST(0.63628862458477287), FRAC_CONST(0.63755005614977711), FRAC_CONST(0.63880978080141437), FRAC_CONST(0.6400677951670225), FRAC_CONST(0.6413240958785188), FRAC_CONST(0.64257867957240766), FRAC_CONST(0.6438315428897915), FRAC_CONST(0.64508268247637779), FRAC_CONST(0.64633209498248945), FRAC_CONST(0.64757977706307335), FRAC_CONST(0.64882572537770888), FRAC_CONST(0.65006993659061751), FRAC_CONST(0.65131240737067142), FRAC_CONST(0.65255313439140239), FRAC_CONST(0.65379211433101081), FRAC_CONST(0.65502934387237444), FRAC_CONST(0.6562648197030575), FRAC_CONST(0.65749853851531959), FRAC_CONST(0.65873049700612374), FRAC_CONST(0.65996069187714679), FRAC_CONST(0.66118911983478657), FRAC_CONST(0.66241577759017178), FRAC_CONST(0.66364066185917048), FRAC_CONST(0.66486376936239888), FRAC_CONST(0.66608509682523009), FRAC_CONST(0.66730464097780284), FRAC_CONST(0.66852239855503071), FRAC_CONST(0.66973836629660977), FRAC_CONST(0.67095254094702894), FRAC_CONST(0.67216491925557675), FRAC_CONST(0.67337549797635199), FRAC_CONST(0.67458427386827102), FRAC_CONST(0.67579124369507693), FRAC_CONST(0.67699640422534846), FRAC_CONST(0.67819975223250772), FRAC_CONST(0.6794012844948305), FRAC_CONST(0.68060099779545302), FRAC_CONST(0.68179888892238183), FRAC_CONST(0.6829949546685018), FRAC_CONST(0.68418919183158522), FRAC_CONST(0.68538159721429948), FRAC_CONST(0.6865721676242168), FRAC_CONST(0.68776089987382172), FRAC_CONST(0.68894779078052026), FRAC_CONST(0.69013283716664853), FRAC_CONST(0.69131603585948032), FRAC_CONST(0.69249738369123692), FRAC_CONST(0.69367687749909468), FRAC_CONST(0.69485451412519361), FRAC_CONST(0.69603029041664599), FRAC_CONST(0.6972042032255451), FRAC_CONST(0.6983762494089728), FRAC_CONST(0.69954642582900894), FRAC_CONST(0.70071472935273893), FRAC_CONST(0.70188115685226271), FRAC_CONST(0.703045705204703), FRAC_CONST(0.70420837129221303), FRAC_CONST(0.70536915200198613), FRAC_CONST(0.70652804422626281), FRAC_CONST(0.70768504486233985), FRAC_CONST(0.70884015081257845), FRAC_CONST(0.70999335898441229), FRAC_CONST(0.711144666290356), FRAC_CONST(0.71229406964801356), FRAC_CONST(0.71344156598008623), FRAC_CONST(0.71458715221438096), FRAC_CONST(0.71573082528381871), FRAC_CONST(0.71687258212644234), FRAC_CONST(0.7180124196854254), FRAC_CONST(0.71915033490907943), FRAC_CONST(0.72028632475086318), FRAC_CONST(0.72142038616938997), FRAC_CONST(0.72255251612843596), FRAC_CONST(0.72368271159694852), FRAC_CONST(0.72481096954905444), FRAC_CONST(0.72593728696406756), FRAC_CONST(0.72706166082649704), FRAC_CONST(0.72818408812605595), FRAC_CONST(0.72930456585766834), FRAC_CONST(0.73042309102147851), FRAC_CONST(0.73153966062285747), FRAC_CONST(0.73265427167241282), FRAC_CONST(0.73376692118599507), FRAC_CONST(0.73487760618470677), FRAC_CONST(0.73598632369490979), FRAC_CONST(0.73709307074823405), FRAC_CONST(0.73819784438158409), FRAC_CONST(0.73930064163714881), FRAC_CONST(0.74040145956240788), FRAC_CONST(0.74150029521014049), FRAC_CONST(0.74259714563843304), FRAC_CONST(0.74369200791068657), FRAC_CONST(0.74478487909562552), FRAC_CONST(0.74587575626730485), FRAC_CONST(0.74696463650511791), FRAC_CONST(0.74805151689380456), FRAC_CONST(0.74913639452345926), FRAC_CONST(0.75021926648953785), FRAC_CONST(0.75130012989286621), FRAC_CONST(0.7523789818396478), FRAC_CONST(0.75345581944147111), FRAC_CONST(0.75453063981531809), FRAC_CONST(0.75560344008357094), FRAC_CONST(0.75667421737402052), FRAC_CONST(0.7577429688198738), FRAC_CONST(0.75880969155976163), FRAC_CONST(0.75987438273774599), FRAC_CONST(0.76093703950332836), FRAC_CONST(0.76199765901145666), FRAC_CONST(0.76305623842253345), FRAC_CONST(0.76411277490242291), FRAC_CONST(0.76516726562245885), FRAC_CONST(0.76621970775945258), FRAC_CONST(0.76727009849569949), FRAC_CONST(0.76831843501898767), FRAC_CONST(0.76936471452260458), FRAC_CONST(0.77040893420534517), FRAC_CONST(0.77145109127151923), FRAC_CONST(0.77249118293095853), FRAC_CONST(0.77352920639902467), FRAC_CONST(0.77456515889661659), FRAC_CONST(0.77559903765017746), FRAC_CONST(0.7766308398917029), FRAC_CONST(0.77766056285874774), FRAC_CONST(0.77868820379443371), FRAC_CONST(0.77971375994745684), FRAC_CONST(0.78073722857209438), FRAC_CONST(0.7817586069282132), FRAC_CONST(0.78277789228127592), FRAC_CONST(0.78379508190234881), FRAC_CONST(0.78481017306810918), FRAC_CONST(0.78582316306085265), FRAC_CONST(0.78683404916849986), FRAC_CONST(0.78784282868460476), FRAC_CONST(0.78884949890836087), FRAC_CONST(0.78985405714460888), FRAC_CONST(0.7908565007038445), FRAC_CONST(0.79185682690222425), FRAC_CONST(0.79285503306157412), FRAC_CONST(0.79385111650939566), FRAC_CONST(0.79484507457887377), FRAC_CONST(0.79583690460888357), FRAC_CONST(0.79682660394399751), FRAC_CONST(0.79781416993449272), FRAC_CONST(0.79879959993635785), FRAC_CONST(0.7997828913113002), FRAC_CONST(0.80076404142675273), FRAC_CONST(0.80174304765588156), FRAC_CONST(0.80271990737759213), FRAC_CONST(0.80369461797653707), FRAC_CONST(0.80466717684312306), FRAC_CONST(0.80563758137351682), FRAC_CONST(0.80660582896965372), FRAC_CONST(0.80757191703924336), FRAC_CONST(0.80853584299577752), FRAC_CONST(0.80949760425853612), FRAC_CONST(0.81045719825259477), FRAC_CONST(0.81141462240883167), FRAC_CONST(0.81236987416393436), FRAC_CONST(0.81332295096040608), FRAC_CONST(0.81427385024657373), FRAC_CONST(0.81522256947659355), FRAC_CONST(0.81616910611045879), FRAC_CONST(0.817113457614006), FRAC_CONST(0.81805562145892186), FRAC_CONST(0.81899559512275044), FRAC_CONST(0.81993337608889916), FRAC_CONST(0.82086896184664637), FRAC_CONST(0.8218023498911472), FRAC_CONST(0.82273353772344116), FRAC_CONST(0.82366252285045805), FRAC_CONST(0.82458930278502529), FRAC_CONST(0.82551387504587381), FRAC_CONST(0.82643623715764558), FRAC_CONST(0.82735638665089983), FRAC_CONST(0.82827432106211907), FRAC_CONST(0.82919003793371693), FRAC_CONST(0.83010353481404364), FRAC_CONST(0.83101480925739324), FRAC_CONST(0.83192385882400965), FRAC_CONST(0.83283068108009373), FRAC_CONST(0.8337352735978093), FRAC_CONST(0.83463763395529011), FRAC_CONST(0.83553775973664579), FRAC_CONST(0.83643564853196872), FRAC_CONST(0.83733129793734051), FRAC_CONST(0.83822470555483797), FRAC_CONST(0.83911586899254031), FRAC_CONST(0.84000478586453453), FRAC_CONST(0.84089145379092289), FRAC_CONST(0.84177587039782842), FRAC_CONST(0.84265803331740163), FRAC_CONST(0.84353794018782702), FRAC_CONST(0.844415588653329), FRAC_CONST(0.8452909763641786), FRAC_CONST(0.84616410097669936), FRAC_CONST(0.84703496015327406), FRAC_CONST(0.84790355156235053), FRAC_CONST(0.84876987287844818), FRAC_CONST(0.8496339217821639), FRAC_CONST(0.85049569596017938), FRAC_CONST(0.85135519310526508), FRAC_CONST(0.85221241091628896), FRAC_CONST(0.85306734709822085), FRAC_CONST(0.85391999936213903), FRAC_CONST(0.85477036542523732), FRAC_CONST(0.85561844301082923), FRAC_CONST(0.85646422984835635), FRAC_CONST(0.85730772367339259), FRAC_CONST(0.85814892222765116), FRAC_CONST(0.85898782325899026), FRAC_CONST(0.85982442452141961), FRAC_CONST(0.86065872377510555), FRAC_CONST(0.86149071878637817), FRAC_CONST(0.8623204073277364), FRAC_CONST(0.86314778717785412), FRAC_CONST(0.8639728561215867), FRAC_CONST(0.86479561194997623), FRAC_CONST(0.86561605246025763), FRAC_CONST(0.86643417545586487), FRAC_CONST(0.8672499787464365), FRAC_CONST(0.86806346014782154), FRAC_CONST(0.8688746174820855), FRAC_CONST(0.86968344857751589), FRAC_CONST(0.87048995126862883), FRAC_CONST(0.87129412339617363), FRAC_CONST(0.87209596280713941), FRAC_CONST(0.8728954673547612), FRAC_CONST(0.87369263489852422), FRAC_CONST(0.87448746330417149), FRAC_CONST(0.87527995044370765), FRAC_CONST(0.8760700941954066), FRAC_CONST(0.87685789244381551), FRAC_CONST(0.87764334307976144), FRAC_CONST(0.87842644400035663), FRAC_CONST(0.8792071931090043), FRAC_CONST(0.87998558831540408), FRAC_CONST(0.88076162753555787), FRAC_CONST(0.88153530869177488), FRAC_CONST(0.88230662971267804), FRAC_CONST(0.88307558853320878), FRAC_CONST(0.88384218309463292), FRAC_CONST(0.8846064113445461), FRAC_CONST(0.88536827123687933), FRAC_CONST(0.88612776073190425), FRAC_CONST(0.88688487779623937), FRAC_CONST(0.88763962040285393), FRAC_CONST(0.8883919865310751), FRAC_CONST(0.88914197416659235), FRAC_CONST(0.88988958130146301), FRAC_CONST(0.8906348059341177), FRAC_CONST(0.89137764606936609), FRAC_CONST(0.89211809971840139), FRAC_CONST(0.89285616489880615), FRAC_CONST(0.89359183963455813), FRAC_CONST(0.89432512195603453), FRAC_CONST(0.89505600990001799), FRAC_CONST(0.89578450150970124), FRAC_CONST(0.8965105948346932), FRAC_CONST(0.89723428793102367), FRAC_CONST(0.89795557886114807), FRAC_CONST(0.89867446569395382), FRAC_CONST(0.89939094650476448), FRAC_CONST(0.90010501937534515), FRAC_CONST(0.900816682393908), FRAC_CONST(0.90152593365511691), FRAC_CONST(0.90223277126009283), FRAC_CONST(0.90293719331641886), FRAC_CONST(0.90363919793814496), FRAC_CONST(0.90433878324579353), FRAC_CONST(0.90503594736636439), FRAC_CONST(0.90573068843333915), FRAC_CONST(0.90642300458668679), FRAC_CONST(0.90711289397286898), FRAC_CONST(0.90780035474484411), FRAC_CONST(0.90848538506207266), FRAC_CONST(0.90916798309052227), FRAC_CONST(0.90984814700267291), FRAC_CONST(0.9105258749775208), FRAC_CONST(0.91120116520058425), FRAC_CONST(0.91187401586390815), FRAC_CONST(0.91254442516606893), FRAC_CONST(0.9132123913121788), FRAC_CONST(0.91387791251389161), FRAC_CONST(0.91454098698940678), FRAC_CONST(0.91520161296347435), FRAC_CONST(0.91585978866739981), FRAC_CONST(0.91651551233904871), FRAC_CONST(0.91716878222285148), FRAC_CONST(0.91781959656980805), FRAC_CONST(0.91846795363749245), FRAC_CONST(0.91911385169005766), FRAC_CONST(0.9197572889982405), FRAC_CONST(0.9203982638393654), FRAC_CONST(0.92103677449734989), FRAC_CONST(0.92167281926270861), FRAC_CONST(0.92230639643255874), FRAC_CONST(0.92293750431062316), FRAC_CONST(0.92356614120723612), FRAC_CONST(0.92419230543934783), FRAC_CONST(0.92481599533052783), FRAC_CONST(0.92543720921097061), FRAC_CONST(0.92605594541749991), FRAC_CONST(0.92667220229357261), FRAC_CONST(0.92728597818928349), FRAC_CONST(0.9278972714613698), FRAC_CONST(0.92850608047321548), FRAC_CONST(0.9291124035948557), FRAC_CONST(0.92971623920298097), FRAC_CONST(0.93031758568094147), FRAC_CONST(0.93091644141875196), FRAC_CONST(0.93151280481309506), FRAC_CONST(0.93210667426732674), FRAC_CONST(0.93269804819147983), FRAC_CONST(0.93328692500226818), FRAC_CONST(0.93387330312309147), FRAC_CONST(0.93445718098403896), FRAC_CONST(0.93503855702189376), FRAC_CONST(0.9356174296801375), FRAC_CONST(0.93619379740895381), FRAC_CONST(0.93676765866523259), FRAC_CONST(0.93733901191257496), FRAC_CONST(0.93790785562129597), FRAC_CONST(0.93847418826842988), FRAC_CONST(0.93903800833773399), FRAC_CONST(0.93959931431969212), FRAC_CONST(0.94015810471151917), FRAC_CONST(0.94071437801716529), FRAC_CONST(0.94126813274731924), FRAC_CONST(0.94181936741941319), FRAC_CONST(0.94236808055762578), FRAC_CONST(0.94291427069288691), FRAC_CONST(0.94345793636288133), FRAC_CONST(0.94399907611205225), FRAC_CONST(0.9445376884916058), FRAC_CONST(0.94507377205951448), FRAC_CONST(0.94560732538052128), FRAC_CONST(0.94613834702614352), FRAC_CONST(0.94666683557467624), FRAC_CONST(0.94719278961119657), FRAC_CONST(0.94771620772756759), FRAC_CONST(0.94823708852244104), FRAC_CONST(0.94875543060126255), FRAC_CONST(0.94927123257627433), FRAC_CONST(0.94978449306651924), FRAC_CONST(0.95029521069784428), FRAC_CONST(0.9508033841029051), FRAC_CONST(0.95130901192116835), FRAC_CONST(0.9518120927989161), FRAC_CONST(0.95231262538924943), FRAC_CONST(0.95281060835209208), FRAC_CONST(0.95330604035419386), FRAC_CONST(0.95379892006913403), FRAC_CONST(0.95428924617732525), FRAC_CONST(0.95477701736601728), FRAC_CONST(0.95526223232929941), FRAC_CONST(0.95574488976810545), FRAC_CONST(0.95622498839021619), FRAC_CONST(0.95670252691026292), FRAC_CONST(0.95717750404973156), FRAC_CONST(0.95764991853696524), FRAC_CONST(0.95811976910716812), FRAC_CONST(0.95858705450240911), FRAC_CONST(0.95905177347162429), FRAC_CONST(0.95951392477062125), FRAC_CONST(0.95997350716208196), FRAC_CONST(0.96043051941556579), FRAC_CONST(0.96088496030751369), FRAC_CONST(0.96133682862125036), FRAC_CONST(0.96178612314698864), FRAC_CONST(0.96223284268183173), FRAC_CONST(0.9626769860297768), FRAC_CONST(0.96311855200171881), FRAC_CONST(0.96355753941545252), FRAC_CONST(0.96399394709567654), FRAC_CONST(0.96442777387399625), FRAC_CONST(0.96485901858892686), FRAC_CONST(0.96528768008589627), FRAC_CONST(0.96571375721724895), FRAC_CONST(0.96613724884224783), FRAC_CONST(0.96655815382707866), FRAC_CONST(0.96697647104485207), FRAC_CONST(0.96739219937560694), FRAC_CONST(0.96780533770631338), FRAC_CONST(0.96821588493087585), FRAC_CONST(0.9686238399501359), FRAC_CONST(0.96902920167187501), FRAC_CONST(0.96943196901081796), FRAC_CONST(0.96983214088863534), FRAC_CONST(0.9702297162339466), FRAC_CONST(0.97062469398232287), FRAC_CONST(0.97101707307629004), FRAC_CONST(0.97140685246533098), FRAC_CONST(0.97179403110588902), FRAC_CONST(0.97217860796137046), FRAC_CONST(0.97256058200214734), FRAC_CONST(0.97293995220556007), FRAC_CONST(0.97331671755592064), FRAC_CONST(0.97369087704451474), FRAC_CONST(0.97406242966960455), FRAC_CONST(0.97443137443643235), FRAC_CONST(0.97479771035722163), FRAC_CONST(0.97516143645118103), FRAC_CONST(0.97552255174450631), FRAC_CONST(0.97588105527038305), FRAC_CONST(0.97623694606898959), FRAC_CONST(0.97659022318749911), FRAC_CONST(0.97694088568008242), FRAC_CONST(0.97728893260791039), FRAC_CONST(0.97763436303915685), FRAC_CONST(0.97797717604900047), FRAC_CONST(0.97831737071962765), FRAC_CONST(0.97865494614023485), FRAC_CONST(0.97898990140703124), FRAC_CONST(0.97932223562324061), FRAC_CONST(0.97965194789910426), FRAC_CONST(0.9799790373518833), FRAC_CONST(0.98030350310586067), FRAC_CONST(0.98062534429234405), FRAC_CONST(0.98094456004966768), FRAC_CONST(0.98126114952319499), FRAC_CONST(0.98157511186532054), FRAC_CONST(0.98188644623547261), FRAC_CONST(0.98219515180011563), FRAC_CONST(0.98250122773275184), FRAC_CONST(0.98280467321392362), FRAC_CONST(0.98310548743121629), FRAC_CONST(0.98340366957925973), FRAC_CONST(0.98369921885973044), FRAC_CONST(0.98399213448135414), FRAC_CONST(0.98428241565990748), FRAC_CONST(0.98457006161822058), FRAC_CONST(0.98485507158617835), FRAC_CONST(0.98513744480072363), FRAC_CONST(0.98541718050585803), FRAC_CONST(0.98569427795264519), FRAC_CONST(0.98596873639921168), FRAC_CONST(0.98624055511074971), FRAC_CONST(0.98650973335951875), FRAC_CONST(0.98677627042484772), FRAC_CONST(0.98704016559313645), FRAC_CONST(0.98730141815785832), FRAC_CONST(0.98756002741956173), FRAC_CONST(0.9878159926858715), FRAC_CONST(0.98806931327149194), FRAC_CONST(0.98831998849820735), FRAC_CONST(0.98856801769488489), FRAC_CONST(0.98881340019747566), FRAC_CONST(0.98905613534901682), FRAC_CONST(0.98929622249963345), FRAC_CONST(0.98953366100653983), FRAC_CONST(0.98976845023404181), FRAC_CONST(0.99000058955353776), FRAC_CONST(0.99023007834352106), FRAC_CONST(0.99045691598958097), FRAC_CONST(0.99068110188440506), FRAC_CONST(0.99090263542778001), FRAC_CONST(0.99112151602659404), FRAC_CONST(0.99133774309483769), FRAC_CONST(0.99155131605360625), FRAC_CONST(0.99176223433110056), FRAC_CONST(0.99197049736262888), FRAC_CONST(0.99217610459060845), FRAC_CONST(0.99237905546456673), FRAC_CONST(0.99257934944114334), FRAC_CONST(0.99277698598409092), FRAC_CONST(0.99297196456427694), FRAC_CONST(0.99316428465968509), FRAC_CONST(0.99335394575541669), FRAC_CONST(0.99354094734369169), FRAC_CONST(0.99372528892385081), FRAC_CONST(0.99390697000235606), FRAC_CONST(0.99408599009279242), FRAC_CONST(0.99426234871586938), FRAC_CONST(0.99443604539942176), FRAC_CONST(0.99460707967841133), FRAC_CONST(0.99477545109492771), FRAC_CONST(0.99494115919819004), FRAC_CONST(0.99510420354454787), FRAC_CONST(0.99526458369748239), FRAC_CONST(0.99542229922760772), FRAC_CONST(0.99557734971267187), FRAC_CONST(0.9957297347375581), FRAC_CONST(0.99587945389428578), FRAC_CONST(0.99602650678201154), FRAC_CONST(0.99617089300703077), FRAC_CONST(0.996312612182778), FRAC_CONST(0.99645166392982831), FRAC_CONST(0.99658804787589839), FRAC_CONST(0.99672176365584741), FRAC_CONST(0.99685281091167788), FRAC_CONST(0.99698118929253687), FRAC_CONST(0.99710689845471678), FRAC_CONST(0.99722993806165661), FRAC_CONST(0.99735030778394196), FRAC_CONST(0.99746800729930707), FRAC_CONST(0.99758303629263489), FRAC_CONST(0.99769539445595812), FRAC_CONST(0.99780508148846014), FRAC_CONST(0.99791209709647588), FRAC_CONST(0.99801644099349218), FRAC_CONST(0.99811811290014918), FRAC_CONST(0.9982171125442405), FRAC_CONST(0.9983134396607144), FRAC_CONST(0.99840709399167404), FRAC_CONST(0.99849807528637868), FRAC_CONST(0.99858638330124405), FRAC_CONST(0.99867201779984294), FRAC_CONST(0.99875497855290607), FRAC_CONST(0.99883526533832245), FRAC_CONST(0.99891287794114036), FRAC_CONST(0.99898781615356746), FRAC_CONST(0.99906007977497147), FRAC_CONST(0.99912966861188113), FRAC_CONST(0.99919658247798593), FRAC_CONST(0.99926082119413751), FRAC_CONST(0.99932238458834954), FRAC_CONST(0.999381272495798), FRAC_CONST(0.99943748475882255), FRAC_CONST(0.9994910212269259), FRAC_CONST(0.99954188175677483), FRAC_CONST(0.99959006621220048), FRAC_CONST(0.99963557446419837), FRAC_CONST(0.99967840639092931), FRAC_CONST(0.99971856187771946), FRAC_CONST(0.99975604081706027), FRAC_CONST(0.99979084310860955), FRAC_CONST(0.99982296865919107), FRAC_CONST(0.99985241738279484), FRAC_CONST(0.99987918920057806), FRAC_CONST(0.99990328404086426), FRAC_CONST(0.9999247018391445), FRAC_CONST(0.99994344253807688), FRAC_CONST(0.99995950608748674), FRAC_CONST(0.99997289244436727), FRAC_CONST(0.99998360157287902), FRAC_CONST(0.9999916334443506), FRAC_CONST(0.99999698803727821), FRAC_CONST(0.99999966533732598) }; #endif ALIGN static const real_t sine_short_128[] = { FRAC_CONST(0.0061358846491544753), FRAC_CONST(0.01840672990580482), FRAC_CONST(0.030674803176636626), FRAC_CONST(0.04293825693494082), FRAC_CONST(0.055195244349689934), FRAC_CONST(0.067443919563664051), FRAC_CONST(0.079682437971430126), FRAC_CONST(0.091908956497132724), FRAC_CONST(0.10412163387205459), FRAC_CONST(0.11631863091190475), FRAC_CONST(0.12849811079379317), FRAC_CONST(0.14065823933284921), FRAC_CONST(0.15279718525844344), FRAC_CONST(0.16491312048996989), FRAC_CONST(0.17700422041214875), FRAC_CONST(0.18906866414980619), FRAC_CONST(0.2011046348420919), FRAC_CONST(0.21311031991609136), FRAC_CONST(0.22508391135979283), FRAC_CONST(0.2370236059943672), FRAC_CONST(0.24892760574572015), FRAC_CONST(0.26079411791527551), FRAC_CONST(0.27262135544994898), FRAC_CONST(0.28440753721127188), FRAC_CONST(0.29615088824362379), FRAC_CONST(0.30784964004153487), FRAC_CONST(0.31950203081601569), FRAC_CONST(0.33110630575987643), FRAC_CONST(0.34266071731199438), FRAC_CONST(0.35416352542049034), FRAC_CONST(0.36561299780477385), FRAC_CONST(0.37700741021641826), FRAC_CONST(0.38834504669882625), FRAC_CONST(0.39962419984564679), FRAC_CONST(0.41084317105790391), FRAC_CONST(0.42200027079979968), FRAC_CONST(0.43309381885315196), FRAC_CONST(0.4441221445704292), FRAC_CONST(0.45508358712634384), FRAC_CONST(0.46597649576796618), FRAC_CONST(0.47679923006332209), FRAC_CONST(0.487550160148436), FRAC_CONST(0.49822766697278187), FRAC_CONST(0.50883014254310699), FRAC_CONST(0.51935599016558964), FRAC_CONST(0.52980362468629461), FRAC_CONST(0.54017147272989285), FRAC_CONST(0.55045797293660481), FRAC_CONST(0.56066157619733603), FRAC_CONST(0.57078074588696726), FRAC_CONST(0.58081395809576453), FRAC_CONST(0.59075970185887416), FRAC_CONST(0.60061647938386897), FRAC_CONST(0.61038280627630948), FRAC_CONST(0.6200572117632891), FRAC_CONST(0.62963823891492698), FRAC_CONST(0.63912444486377573), FRAC_CONST(0.64851440102211244), FRAC_CONST(0.65780669329707864), FRAC_CONST(0.66699992230363747), FRAC_CONST(0.67609270357531592), FRAC_CONST(0.68508366777270036), FRAC_CONST(0.693971460889654), FRAC_CONST(0.7027547444572253), FRAC_CONST(0.71143219574521643), FRAC_CONST(0.72000250796138165), FRAC_CONST(0.7284643904482252), FRAC_CONST(0.73681656887736979), FRAC_CONST(0.74505778544146595), FRAC_CONST(0.75318679904361241), FRAC_CONST(0.76120238548426178), FRAC_CONST(0.76910333764557959), FRAC_CONST(0.77688846567323244), FRAC_CONST(0.78455659715557524), FRAC_CONST(0.79210657730021239), FRAC_CONST(0.79953726910790501), FRAC_CONST(0.80684755354379922), FRAC_CONST(0.8140363297059483), FRAC_CONST(0.82110251499110465), FRAC_CONST(0.8280450452577558), FRAC_CONST(0.83486287498638001), FRAC_CONST(0.84155497743689833), FRAC_CONST(0.84812034480329712), FRAC_CONST(0.85455798836540053), FRAC_CONST(0.86086693863776731), FRAC_CONST(0.86704624551569265), FRAC_CONST(0.87309497841829009), FRAC_CONST(0.87901222642863341), FRAC_CONST(0.88479709843093779), FRAC_CONST(0.89044872324475788), FRAC_CONST(0.89596624975618511), FRAC_CONST(0.90134884704602203), FRAC_CONST(0.90659570451491533), FRAC_CONST(0.91170603200542988), FRAC_CONST(0.9166790599210427), FRAC_CONST(0.9215140393420419), FRAC_CONST(0.92621024213831127), FRAC_CONST(0.93076696107898371), FRAC_CONST(0.9351835099389475), FRAC_CONST(0.93945922360218992), FRAC_CONST(0.94359345816196039), FRAC_CONST(0.94758559101774109), FRAC_CONST(0.95143502096900834), FRAC_CONST(0.95514116830577067), FRAC_CONST(0.9587034748958716), FRAC_CONST(0.96212140426904158), FRAC_CONST(0.9653944416976894), FRAC_CONST(0.96852209427441727), FRAC_CONST(0.97150389098625178), FRAC_CONST(0.97433938278557586), FRAC_CONST(0.97702814265775439), FRAC_CONST(0.97956976568544052), FRAC_CONST(0.98196386910955524), FRAC_CONST(0.98421009238692903), FRAC_CONST(0.98630809724459867), FRAC_CONST(0.98825756773074946), FRAC_CONST(0.99005821026229712), FRAC_CONST(0.99170975366909953), FRAC_CONST(0.9932119492347945), FRAC_CONST(0.99456457073425542), FRAC_CONST(0.99576741446765982), FRAC_CONST(0.99682029929116567), FRAC_CONST(0.99772306664419164), FRAC_CONST(0.99847558057329477), FRAC_CONST(0.99907772775264536), FRAC_CONST(0.99952941750109314), FRAC_CONST(0.9998305817958234), FRAC_CONST(0.99998117528260111) }; #ifdef ALLOW_SMALL_FRAMELENGTH ALIGN static const real_t sine_short_120[] = { FRAC_CONST(0.0065449379673518581), FRAC_CONST(0.019633692460628301), FRAC_CONST(0.032719082821776137), FRAC_CONST(0.045798866936520771), FRAC_CONST(0.058870803651189033), FRAC_CONST(0.071932653156719387), FRAC_CONST(0.084982177372441667), FRAC_CONST(0.09801714032956059), FRAC_CONST(0.11103530855427769), FRAC_CONST(0.12403445145048532), FRAC_CONST(0.13701234168196802), FRAC_CONST(0.14996675555404498), FRAC_CONST(0.16289547339458874), FRAC_CONST(0.17579627993435451), FRAC_CONST(0.18866696468655525), FRAC_CONST(0.2015053223256171), FRAC_CONST(0.21430915306505074), FRAC_CONST(0.2270762630343732), FRAC_CONST(0.23980446465501654), FRAC_CONST(0.25249157701515795), FRAC_CONST(0.26513542624340797), FRAC_CONST(0.27773384588129219), FRAC_CONST(0.29028467725446233), FRAC_CONST(0.3027857698425746), FRAC_CONST(0.31523498164776964), FRAC_CONST(0.32763017956169349), FRAC_CONST(0.33996923973099424), FRAC_CONST(0.35225004792123354), FRAC_CONST(0.36447049987914965), FRAC_CONST(0.37662850169321077), FRAC_CONST(0.38872197015239557), FRAC_CONST(0.40074883310314097), FRAC_CONST(0.41270702980439467), FRAC_CONST(0.42459451128071307), FRAC_CONST(0.43640924067334208), FRAC_CONST(0.44814919358922256), FRAC_CONST(0.45981235844785984), FRAC_CONST(0.47139673682599764), FRAC_CONST(0.48290034380003727), FRAC_CONST(0.49432120828614462), FRAC_CONST(0.50565737337798455), FRAC_CONST(0.51690689668202761), FRAC_CONST(0.52806785065036799), FRAC_CONST(0.53913832291100017), FRAC_CONST(0.55011641659549337), FRAC_CONST(0.56100025066400983), FRAC_CONST(0.57178796022761225), FRAC_CONST(0.58247769686780215), FRAC_CONST(0.59306762895323706), FRAC_CONST(0.60355594195357143), FRAC_CONST(0.61394083875036642), FRAC_CONST(0.62422053994501758), FRAC_CONST(0.63439328416364549), FRAC_CONST(0.64445732835889735), FRAC_CONST(0.65441094810861034), FRAC_CONST(0.66425243791128175), FRAC_CONST(0.67398011147829784), FRAC_CONST(0.68359230202287125), FRAC_CONST(0.69308736254563585), FRAC_CONST(0.70246366611685174), FRAC_CONST(0.71171960615517138), FRAC_CONST(0.72085359670291882), FRAC_CONST(0.7298640726978356), FRAC_CONST(0.73874949024124625), FRAC_CONST(0.74750832686259672), FRAC_CONST(0.75613908178032285), FRAC_CONST(0.76464027615900032), FRAC_CONST(0.77301045336273699), FRAC_CONST(0.78124817920475853), FRAC_CONST(0.78935204219315003), FRAC_CONST(0.79732065377270711), FRAC_CONST(0.80515264856285829), FRAC_CONST(0.81284668459161513), FRAC_CONST(0.82040144352551359), FRAC_CONST(0.82781563089550203), FRAC_CONST(0.83508797631874299), FRAC_CONST(0.84221723371628654), FRAC_CONST(0.84920218152657889), FRAC_CONST(0.85604162291477137), FRAC_CONST(0.86273438597779184), FRAC_CONST(0.86927932394514362), FRAC_CONST(0.87567531537539967), FRAC_CONST(0.88192126434835494), FRAC_CONST(0.88801610065280734), FRAC_CONST(0.89395877996993212), FRAC_CONST(0.8997482840522214), FRAC_CONST(0.90538362089795521), FRAC_CONST(0.91086382492117568), FRAC_CONST(0.91618795711713596), FRAC_CONST(0.92135510522319242), FRAC_CONST(0.9263643838751181), FRAC_CONST(0.93121493475880346), FRAC_CONST(0.93590592675732565), FRAC_CONST(0.94043655609335486), FRAC_CONST(0.94480604646687805), FRAC_CONST(0.94901364918821385), FRAC_CONST(0.95305864330629697), FRAC_CONST(0.95694033573220882), FRAC_CONST(0.9606580613579353), FRAC_CONST(0.96421118317032928), FRAC_CONST(0.96759909236025976), FRAC_CONST(0.9708212084269281), FRAC_CONST(0.97387697927733363), FRAC_CONST(0.97676588132087239), FRAC_CONST(0.97948741955905139), FRAC_CONST(0.98204112767030394), FRAC_CONST(0.98442656808989171), FRAC_CONST(0.98664333208487898), FRAC_CONST(0.98869103982416728), FRAC_CONST(0.99056934044357725), FRAC_CONST(0.99227791210596705), FRAC_CONST(0.99381646205637808), FRAC_CONST(0.99518472667219682), FRAC_CONST(0.99638247150832537), FRAC_CONST(0.99740949133735191), FRAC_CONST(0.99826561018471593), FRAC_CONST(0.99895068135886012), FRAC_CONST(0.99946458747636568), FRAC_CONST(0.99980724048206482), FRAC_CONST(0.99997858166412923) }; #endif #ifdef LD_DEC ALIGN static const real_t sine_mid_512[] = { FRAC_CONST(0.0015339801862847655), FRAC_CONST(0.0046019261204485705), FRAC_CONST(0.007669828739531097), FRAC_CONST(0.010737659167264491), FRAC_CONST(0.013805388528060391), FRAC_CONST(0.01687298794728171), FRAC_CONST(0.019940428551514441), FRAC_CONST(0.023007681468839369), FRAC_CONST(0.026074717829103901), FRAC_CONST(0.029141508764193722), FRAC_CONST(0.032208025408304586), FRAC_CONST(0.035274238898213947), FRAC_CONST(0.038340120373552694), FRAC_CONST(0.041405640977076739), FRAC_CONST(0.044470771854938668), FRAC_CONST(0.047535484156959303), FRAC_CONST(0.050599749036899282), FRAC_CONST(0.05366353765273052), FRAC_CONST(0.056726821166907748), FRAC_CONST(0.059789570746639868), FRAC_CONST(0.062851757564161406), FRAC_CONST(0.065913352797003805), FRAC_CONST(0.068974327628266746), FRAC_CONST(0.072034653246889332), FRAC_CONST(0.075094300847921305), FRAC_CONST(0.078153241632794232), FRAC_CONST(0.081211446809592441), FRAC_CONST(0.084268887593324071), FRAC_CONST(0.087325535206192059), FRAC_CONST(0.090381360877864983), FRAC_CONST(0.093436335845747787), FRAC_CONST(0.096490431355252593), FRAC_CONST(0.099543618660069319), FRAC_CONST(0.10259586902243628), FRAC_CONST(0.10564715371341062), FRAC_CONST(0.10869744401313872), FRAC_CONST(0.11174671121112659), FRAC_CONST(0.11479492660651008), FRAC_CONST(0.11784206150832498), FRAC_CONST(0.12088808723577708), FRAC_CONST(0.12393297511851216), FRAC_CONST(0.12697669649688587), FRAC_CONST(0.13001922272223335), FRAC_CONST(0.13306052515713906), FRAC_CONST(0.1361005751757062), FRAC_CONST(0.1391393441638262), FRAC_CONST(0.14217680351944803), FRAC_CONST(0.14521292465284746), FRAC_CONST(0.14824767898689603), FRAC_CONST(0.15128103795733022), FRAC_CONST(0.1543129730130201), FRAC_CONST(0.15734345561623825), FRAC_CONST(0.16037245724292828), FRAC_CONST(0.16339994938297323), FRAC_CONST(0.1664259035404641), FRAC_CONST(0.16945029123396796), FRAC_CONST(0.17247308399679595), FRAC_CONST(0.17549425337727143), FRAC_CONST(0.17851377093899751), FRAC_CONST(0.18153160826112497), FRAC_CONST(0.18454773693861962), FRAC_CONST(0.1875621285825296), FRAC_CONST(0.19057475482025274), FRAC_CONST(0.19358558729580361), FRAC_CONST(0.19659459767008022), FRAC_CONST(0.19960175762113097), FRAC_CONST(0.20260703884442113), FRAC_CONST(0.20561041305309924), FRAC_CONST(0.20861185197826349), FRAC_CONST(0.21161132736922755), FRAC_CONST(0.21460881099378676), FRAC_CONST(0.21760427463848364), FRAC_CONST(0.22059769010887351), FRAC_CONST(0.22358902922978999), FRAC_CONST(0.22657826384561), FRAC_CONST(0.22956536582051887), FRAC_CONST(0.23255030703877524), FRAC_CONST(0.23553305940497549), FRAC_CONST(0.23851359484431842), FRAC_CONST(0.24149188530286933), FRAC_CONST(0.24446790274782415), FRAC_CONST(0.24744161916777327), FRAC_CONST(0.25041300657296522), FRAC_CONST(0.25338203699557016), FRAC_CONST(0.25634868248994291), FRAC_CONST(0.25931291513288623), FRAC_CONST(0.26227470702391359), FRAC_CONST(0.26523403028551179), FRAC_CONST(0.26819085706340318), FRAC_CONST(0.27114515952680801), FRAC_CONST(0.27409690986870638), FRAC_CONST(0.2770460803060999), FRAC_CONST(0.27999264308027322), FRAC_CONST(0.28293657045705539), FRAC_CONST(0.28587783472708062), FRAC_CONST(0.28881640820604948), FRAC_CONST(0.29175226323498926), FRAC_CONST(0.29468537218051433), FRAC_CONST(0.2976157074350862), FRAC_CONST(0.30054324141727345), FRAC_CONST(0.30346794657201132), FRAC_CONST(0.30638979537086092), FRAC_CONST(0.30930876031226873), FRAC_CONST(0.31222481392182488), FRAC_CONST(0.31513792875252244), FRAC_CONST(0.31804807738501495), FRAC_CONST(0.32095523242787521), FRAC_CONST(0.32385936651785285), FRAC_CONST(0.32676045232013173), FRAC_CONST(0.32965846252858749), FRAC_CONST(0.33255336986604422), FRAC_CONST(0.3354451470845316), FRAC_CONST(0.33833376696554113), FRAC_CONST(0.34121920232028236), FRAC_CONST(0.34410142598993881), FRAC_CONST(0.34698041084592368), FRAC_CONST(0.34985612979013492), FRAC_CONST(0.35272855575521073), FRAC_CONST(0.35559766170478385), FRAC_CONST(0.35846342063373654), FRAC_CONST(0.36132580556845428), FRAC_CONST(0.36418478956707989), FRAC_CONST(0.36704034571976718), FRAC_CONST(0.3698924471489341), FRAC_CONST(0.37274106700951576), FRAC_CONST(0.37558617848921722), FRAC_CONST(0.37842775480876556), FRAC_CONST(0.38126576922216238), FRAC_CONST(0.38410019501693504), FRAC_CONST(0.38693100551438858), FRAC_CONST(0.38975817406985641), FRAC_CONST(0.39258167407295147), FRAC_CONST(0.39540147894781635), FRAC_CONST(0.39821756215337356), FRAC_CONST(0.40102989718357562), FRAC_CONST(0.40383845756765407), FRAC_CONST(0.40664321687036903), FRAC_CONST(0.40944414869225759), FRAC_CONST(0.41224122666988289), FRAC_CONST(0.41503442447608163), FRAC_CONST(0.41782371582021227), FRAC_CONST(0.42060907444840251), FRAC_CONST(0.42339047414379605), FRAC_CONST(0.42616788872679962), FRAC_CONST(0.42894129205532949), FRAC_CONST(0.43171065802505726), FRAC_CONST(0.43447596056965565), FRAC_CONST(0.43723717366104409), FRAC_CONST(0.43999427130963326), FRAC_CONST(0.44274722756457002), FRAC_CONST(0.44549601651398174), FRAC_CONST(0.44824061228521989), FRAC_CONST(0.45098098904510386), FRAC_CONST(0.45371712100016387), FRAC_CONST(0.45644898239688392), FRAC_CONST(0.45917654752194409), FRAC_CONST(0.46189979070246273), FRAC_CONST(0.46461868630623782), FRAC_CONST(0.46733320874198842), FRAC_CONST(0.47004333245959562), FRAC_CONST(0.47274903195034279), FRAC_CONST(0.47545028174715587), FRAC_CONST(0.47814705642484301), FRAC_CONST(0.48083933060033396), FRAC_CONST(0.48352707893291874), FRAC_CONST(0.48621027612448642), FRAC_CONST(0.48888889691976317), FRAC_CONST(0.4915629161065499), FRAC_CONST(0.49423230851595967), FRAC_CONST(0.49689704902265447), FRAC_CONST(0.49955711254508184), FRAC_CONST(0.50221247404571079), FRAC_CONST(0.50486310853126759), FRAC_CONST(0.50750899105297087), FRAC_CONST(0.51015009670676681), FRAC_CONST(0.51278640063356296), FRAC_CONST(0.51541787801946293), FRAC_CONST(0.51804450409599934), FRAC_CONST(0.52066625414036716), FRAC_CONST(0.52328310347565643), FRAC_CONST(0.52589502747108463), FRAC_CONST(0.52850200154222848), FRAC_CONST(0.531104001151255), FRAC_CONST(0.53370100180715296), FRAC_CONST(0.53629297906596318), FRAC_CONST(0.53887990853100842), FRAC_CONST(0.54146176585312344), FRAC_CONST(0.54403852673088382), FRAC_CONST(0.54661016691083486), FRAC_CONST(0.54917666218771966), FRAC_CONST(0.55173798840470734), FRAC_CONST(0.55429412145362), FRAC_CONST(0.5568450372751601), FRAC_CONST(0.55939071185913614), FRAC_CONST(0.56193112124468947), FRAC_CONST(0.5644662415205195), FRAC_CONST(0.56699604882510868), FRAC_CONST(0.56952051934694714), FRAC_CONST(0.57203962932475705), FRAC_CONST(0.57455335504771576), FRAC_CONST(0.57706167285567944), FRAC_CONST(0.57956455913940563), FRAC_CONST(0.58206199034077544), FRAC_CONST(0.58455394295301533), FRAC_CONST(0.58704039352091797), FRAC_CONST(0.58952131864106394), FRAC_CONST(0.59199669496204099), FRAC_CONST(0.59446649918466443), FRAC_CONST(0.5969307080621965), FRAC_CONST(0.59938929840056454), FRAC_CONST(0.60184224705858003), FRAC_CONST(0.60428953094815596), FRAC_CONST(0.60673112703452448), FRAC_CONST(0.60916701233645321), FRAC_CONST(0.61159716392646191), FRAC_CONST(0.61402155893103838), FRAC_CONST(0.61644017453085365), FRAC_CONST(0.61885298796097632), FRAC_CONST(0.62125997651108755), FRAC_CONST(0.62366111752569453), FRAC_CONST(0.62605638840434352), FRAC_CONST(0.62844576660183271), FRAC_CONST(0.63082922962842447), FRAC_CONST(0.63320675505005719), FRAC_CONST(0.63557832048855611), FRAC_CONST(0.63794390362184406), FRAC_CONST(0.64030348218415167), FRAC_CONST(0.64265703396622686), FRAC_CONST(0.64500453681554393), FRAC_CONST(0.64734596863651206), FRAC_CONST(0.64968130739068319), FRAC_CONST(0.6520105310969595), FRAC_CONST(0.65433361783180044), FRAC_CONST(0.65665054572942894), FRAC_CONST(0.65896129298203732), FRAC_CONST(0.66126583783999227), FRAC_CONST(0.66356415861203977), FRAC_CONST(0.66585623366550972), FRAC_CONST(0.66814204142651845), FRAC_CONST(0.67042156038017309), FRAC_CONST(0.67269476907077286), FRAC_CONST(0.67496164610201193), FRAC_CONST(0.67722217013718033), FRAC_CONST(0.67947631989936497), FRAC_CONST(0.68172407417164971), FRAC_CONST(0.6839654117973154), FRAC_CONST(0.68620031168003859), FRAC_CONST(0.68842875278409044), FRAC_CONST(0.6906507141345346), FRAC_CONST(0.69286617481742463), FRAC_CONST(0.69507511398000088), FRAC_CONST(0.69727751083088652), FRAC_CONST(0.69947334464028377), FRAC_CONST(0.70166259474016845), FRAC_CONST(0.70384524052448494), FRAC_CONST(0.70602126144933974), FRAC_CONST(0.70819063703319529), FRAC_CONST(0.71035334685706231), FRAC_CONST(0.71250937056469232), FRAC_CONST(0.71465868786276898), FRAC_CONST(0.71680127852109954), FRAC_CONST(0.71893712237280438), FRAC_CONST(0.72106619931450811), FRAC_CONST(0.72318848930652735), FRAC_CONST(0.72530397237306066), FRAC_CONST(0.72741262860237577), FRAC_CONST(0.7295144381469969), FRAC_CONST(0.73160938122389252), FRAC_CONST(0.73369743811466026), FRAC_CONST(0.73577858916571348), FRAC_CONST(0.73785281478846598), FRAC_CONST(0.73992009545951609), FRAC_CONST(0.74198041172083096), FRAC_CONST(0.74403374417992918), FRAC_CONST(0.74608007351006378), FRAC_CONST(0.74811938045040349), FRAC_CONST(0.75015164580621496), FRAC_CONST(0.7521768504490427), FRAC_CONST(0.75419497531688917), FRAC_CONST(0.75620600141439454), FRAC_CONST(0.75820990981301528), FRAC_CONST(0.76020668165120242), FRAC_CONST(0.7621962981345789), FRAC_CONST(0.76417874053611667), FRAC_CONST(0.76615399019631281), FRAC_CONST(0.76812202852336531), FRAC_CONST(0.7700828369933479), FRAC_CONST(0.77203639715038441), FRAC_CONST(0.77398269060682279), FRAC_CONST(0.77592169904340758), FRAC_CONST(0.77785340420945304), FRAC_CONST(0.77977778792301444), FRAC_CONST(0.78169483207105939), FRAC_CONST(0.7836045186096382), FRAC_CONST(0.78550682956405393), FRAC_CONST(0.78740174702903132), FRAC_CONST(0.78928925316888565), FRAC_CONST(0.79116933021769009), FRAC_CONST(0.79304196047944364), FRAC_CONST(0.79490712632823701), FRAC_CONST(0.79676481020841872), FRAC_CONST(0.79861499463476082), FRAC_CONST(0.80045766219262271), FRAC_CONST(0.80229279553811572), FRAC_CONST(0.8041203773982657), FRAC_CONST(0.80594039057117628), FRAC_CONST(0.80775281792619036), FRAC_CONST(0.80955764240405126), FRAC_CONST(0.81135484701706373), FRAC_CONST(0.81314441484925359), FRAC_CONST(0.81492632905652662), FRAC_CONST(0.81670057286682785), FRAC_CONST(0.81846712958029866), FRAC_CONST(0.82022598256943469), FRAC_CONST(0.82197711527924155), FRAC_CONST(0.82372051122739132), FRAC_CONST(0.82545615400437744), FRAC_CONST(0.82718402727366902), FRAC_CONST(0.82890411477186487), FRAC_CONST(0.8306164003088462), FRAC_CONST(0.83232086776792968), FRAC_CONST(0.83401750110601813), FRAC_CONST(0.8357062843537526), FRAC_CONST(0.83738720161566194), FRAC_CONST(0.83906023707031263), FRAC_CONST(0.84072537497045807), FRAC_CONST(0.84238259964318596), FRAC_CONST(0.84403189549006641), FRAC_CONST(0.84567324698729907), FRAC_CONST(0.84730663868585832), FRAC_CONST(0.84893205521163961), FRAC_CONST(0.85054948126560337), FRAC_CONST(0.85215890162391983), FRAC_CONST(0.8537603011381113), FRAC_CONST(0.85535366473519603), FRAC_CONST(0.85693897741782865), FRAC_CONST(0.85851622426444274), FRAC_CONST(0.86008539042939014), FRAC_CONST(0.8616464611430813), FRAC_CONST(0.86319942171212416), FRAC_CONST(0.86474425751946238), FRAC_CONST(0.86628095402451299), FRAC_CONST(0.86780949676330321), FRAC_CONST(0.86932987134860673), FRAC_CONST(0.87084206347007886), FRAC_CONST(0.87234605889439154), FRAC_CONST(0.87384184346536675), FRAC_CONST(0.87532940310411078), FRAC_CONST(0.87680872380914576), FRAC_CONST(0.87827979165654146), FRAC_CONST(0.87974259280004741), FRAC_CONST(0.88119711347122198), FRAC_CONST(0.88264333997956279), FRAC_CONST(0.88408125871263499), FRAC_CONST(0.88551085613619995), FRAC_CONST(0.88693211879434208), FRAC_CONST(0.88834503330959624), FRAC_CONST(0.88974958638307289), FRAC_CONST(0.89114576479458318), FRAC_CONST(0.89253355540276469), FRAC_CONST(0.89391294514520325), FRAC_CONST(0.89528392103855758), FRAC_CONST(0.89664647017868015), FRAC_CONST(0.89800057974073988), FRAC_CONST(0.89934623697934146), FRAC_CONST(0.90068342922864686), FRAC_CONST(0.90201214390249307), FRAC_CONST(0.90333236849451182), FRAC_CONST(0.90464409057824624), FRAC_CONST(0.90594729780726846), FRAC_CONST(0.90724197791529593), FRAC_CONST(0.90852811871630612), FRAC_CONST(0.90980570810465222), FRAC_CONST(0.91107473405517625), FRAC_CONST(0.91233518462332275), FRAC_CONST(0.91358704794525081), FRAC_CONST(0.91483031223794609), FRAC_CONST(0.91606496579933161), FRAC_CONST(0.91729099700837791), FRAC_CONST(0.91850839432521225), FRAC_CONST(0.91971714629122736), FRAC_CONST(0.92091724152918952), FRAC_CONST(0.92210866874334507), FRAC_CONST(0.92329141671952764), FRAC_CONST(0.9244654743252626), FRAC_CONST(0.92563083050987272), FRAC_CONST(0.92678747430458175), FRAC_CONST(0.92793539482261789), FRAC_CONST(0.92907458125931575), FRAC_CONST(0.93020502289221907), FRAC_CONST(0.93132670908118043), FRAC_CONST(0.93243962926846236), FRAC_CONST(0.93354377297883617), FRAC_CONST(0.93463912981968078), FRAC_CONST(0.93572568948108037), FRAC_CONST(0.93680344173592156), FRAC_CONST(0.93787237643998989), FRAC_CONST(0.93893248353206449), FRAC_CONST(0.93998375303401394), FRAC_CONST(0.94102617505088926), FRAC_CONST(0.94205973977101731), FRAC_CONST(0.94308443746609349), FRAC_CONST(0.94410025849127266), FRAC_CONST(0.94510719328526061), FRAC_CONST(0.94610523237040334), FRAC_CONST(0.94709436635277722), FRAC_CONST(0.94807458592227623), FRAC_CONST(0.94904588185270056), FRAC_CONST(0.950008245001843), FRAC_CONST(0.95096166631157508), FRAC_CONST(0.95190613680793223), FRAC_CONST(0.95284164760119872), FRAC_CONST(0.95376818988599033), FRAC_CONST(0.95468575494133834), FRAC_CONST(0.95559433413077111), FRAC_CONST(0.95649391890239499), FRAC_CONST(0.95738450078897586), FRAC_CONST(0.95826607140801767), FRAC_CONST(0.95913862246184189), FRAC_CONST(0.96000214573766585), FRAC_CONST(0.96085663310767966), FRAC_CONST(0.96170207652912254), FRAC_CONST(0.96253846804435916), FRAC_CONST(0.96336579978095405), FRAC_CONST(0.96418406395174572), FRAC_CONST(0.96499325285492032), FRAC_CONST(0.96579335887408357), FRAC_CONST(0.96658437447833312), FRAC_CONST(0.96736629222232851), FRAC_CONST(0.96813910474636233), FRAC_CONST(0.96890280477642887), FRAC_CONST(0.96965738512429245), FRAC_CONST(0.9704028386875555), FRAC_CONST(0.97113915844972509), FRAC_CONST(0.9718663374802794), FRAC_CONST(0.97258436893473221), FRAC_CONST(0.97329324605469825), FRAC_CONST(0.97399296216795583), FRAC_CONST(0.97468351068851067), FRAC_CONST(0.97536488511665687), FRAC_CONST(0.97603707903903902), FRAC_CONST(0.97670008612871184), FRAC_CONST(0.97735390014519996), FRAC_CONST(0.97799851493455714), FRAC_CONST(0.9786339244294231), FRAC_CONST(0.97926012264908202), FRAC_CONST(0.97987710369951764), FRAC_CONST(0.98048486177346938), FRAC_CONST(0.98108339115048659), FRAC_CONST(0.98167268619698311), FRAC_CONST(0.98225274136628937), FRAC_CONST(0.98282355119870524), FRAC_CONST(0.98338511032155118), FRAC_CONST(0.98393741344921892), FRAC_CONST(0.98448045538322093), FRAC_CONST(0.98501423101223984), FRAC_CONST(0.98553873531217606), FRAC_CONST(0.98605396334619544), FRAC_CONST(0.98655991026477541), FRAC_CONST(0.98705657130575097), FRAC_CONST(0.98754394179435923), FRAC_CONST(0.98802201714328353), FRAC_CONST(0.98849079285269659), FRAC_CONST(0.98895026451030299), FRAC_CONST(0.98940042779138038), FRAC_CONST(0.98984127845882053), FRAC_CONST(0.99027281236316911), FRAC_CONST(0.99069502544266463), FRAC_CONST(0.99110791372327678), FRAC_CONST(0.9915114733187439), FRAC_CONST(0.99190570043060933), FRAC_CONST(0.99229059134825737), FRAC_CONST(0.99266614244894802), FRAC_CONST(0.99303235019785141), FRAC_CONST(0.99338921114808065), FRAC_CONST(0.9937367219407246), FRAC_CONST(0.99407487930487937), FRAC_CONST(0.9944036800576791), FRAC_CONST(0.9947231211043257), FRAC_CONST(0.99503319943811863), FRAC_CONST(0.99533391214048228), FRAC_CONST(0.99562525638099431), FRAC_CONST(0.99590722941741172), FRAC_CONST(0.99617982859569687), FRAC_CONST(0.99644305135004263), FRAC_CONST(0.99669689520289606), FRAC_CONST(0.99694135776498216), FRAC_CONST(0.99717643673532619), FRAC_CONST(0.9974021299012753), FRAC_CONST(0.99761843513851955), FRAC_CONST(0.99782535041111164), FRAC_CONST(0.99802287377148624), FRAC_CONST(0.99821100336047819), FRAC_CONST(0.99838973740734016), FRAC_CONST(0.99855907422975931), FRAC_CONST(0.99871901223387294), FRAC_CONST(0.99886954991428356), FRAC_CONST(0.99901068585407338), FRAC_CONST(0.99914241872481691), FRAC_CONST(0.99926474728659442), FRAC_CONST(0.99937767038800285), FRAC_CONST(0.99948118696616695), FRAC_CONST(0.99957529604674922), FRAC_CONST(0.99965999674395922), FRAC_CONST(0.99973528826056168), FRAC_CONST(0.99980116988788426), FRAC_CONST(0.99985764100582386), FRAC_CONST(0.9999047010828529), FRAC_CONST(0.99994234967602391), FRAC_CONST(0.99997058643097414), FRAC_CONST(0.9999894110819284), FRAC_CONST(0.99999882345170188) }; #ifdef ALLOW_SMALL_FRAMELENGTH ALIGN static const real_t sine_mid_480[] = { FRAC_CONST(0.0016362454436240478), FRAC_CONST(0.00490871880799799), FRAC_CONST(0.0081811396039371282), FRAC_CONST(0.011453472786443779), FRAC_CONST(0.014725683311458524), FRAC_CONST(0.017997736136235509), FRAC_CONST(0.021269596219717739), FRAC_CONST(0.024541228522912285), FRAC_CONST(0.027812598009265607), FRAC_CONST(0.03108366964503869), FRAC_CONST(0.034354408399682276), FRAC_CONST(0.037624779246211978), FRAC_CONST(0.04089474716158345), FRAC_CONST(0.044164277127067358), FRAC_CONST(0.047433334128624507), FRAC_CONST(0.050701883157280733), FRAC_CONST(0.053969889209501881), FRAC_CONST(0.057237317287568618), FRAC_CONST(0.060504132399951269), FRAC_CONST(0.063770299561684493), FRAC_CONST(0.06703578379474201), FRAC_CONST(0.070300550128411174), FRAC_CONST(0.073564563599667426), FRAC_CONST(0.076827789253548759), FRAC_CONST(0.080090192143530081), FRAC_CONST(0.083351737331897449), FRAC_CONST(0.086612389890122182), FRAC_CONST(0.089872114899234967), FRAC_CONST(0.093130877450199795), FRAC_CONST(0.096388642644287828), FRAC_CONST(0.09964537559345106), FRAC_CONST(0.1029010414206961), FRAC_CONST(0.10615560526045748), FRAC_CONST(0.10940903225897117), FRAC_CONST(0.11266128757464781), FRAC_CONST(0.11591233637844581), FRAC_CONST(0.11916214385424433), FRAC_CONST(0.1224106751992162), FRAC_CONST(0.12565789562420052), FRAC_CONST(0.12890377035407541), FRAC_CONST(0.13214826462813015), FRAC_CONST(0.13539134370043773), FRAC_CONST(0.13863297284022669), FRAC_CONST(0.14187311733225325), FRAC_CONST(0.14511174247717309), FRAC_CONST(0.14834881359191271), FRAC_CONST(0.15158429601004111), FRAC_CONST(0.15481815508214106), FRAC_CONST(0.1580503561761798), FRAC_CONST(0.16128086467788047), FRAC_CONST(0.16450964599109233), FRAC_CONST(0.16773666553816149), FRAC_CONST(0.17096188876030122), FRAC_CONST(0.17418528111796186), FRAC_CONST(0.17740680809120093), FRAC_CONST(0.18062643518005275), FRAC_CONST(0.18384412790489776), FRAC_CONST(0.18705985180683199), FRAC_CONST(0.19027357244803589), FRAC_CONST(0.19348525541214331), FRAC_CONST(0.19669486630460997), FRAC_CONST(0.19990237075308173), FRAC_CONST(0.20310773440776286), FRAC_CONST(0.20631092294178383), FRAC_CONST(0.20951190205156878), FRAC_CONST(0.21271063745720317), FRAC_CONST(0.21590709490280058), FRAC_CONST(0.2191012401568698), FRAC_CONST(0.22229303901268133), FRAC_CONST(0.22548245728863364), FRAC_CONST(0.22866946082861941), FRAC_CONST(0.23185401550239115), FRAC_CONST(0.23503608720592667), FRAC_CONST(0.23821564186179459), FRAC_CONST(0.24139264541951888), FRAC_CONST(0.24456706385594387), FRAC_CONST(0.24773886317559846), FRAC_CONST(0.25090800941106001), FRAC_CONST(0.25407446862331851), FRAC_CONST(0.25723820690213967), FRAC_CONST(0.26039919036642817), FRAC_CONST(0.26355738516459076), FRAC_CONST(0.26671275747489837), FRAC_CONST(0.2698652735058486), FRAC_CONST(0.27301489949652735), FRAC_CONST(0.27616160171697068), FRAC_CONST(0.27930534646852595), FRAC_CONST(0.28244610008421245), FRAC_CONST(0.2855838289290823), FRAC_CONST(0.28871849940058025), FRAC_CONST(0.29185007792890405), FRAC_CONST(0.29497853097736348), FRAC_CONST(0.2981038250427398), FRAC_CONST(0.30122592665564446), FRAC_CONST(0.30434480238087736), FRAC_CONST(0.30746041881778519), FRAC_CONST(0.31057274260061901), FRAC_CONST(0.31368174039889146), FRAC_CONST(0.31678737891773395), FRAC_CONST(0.31988962489825296), FRAC_CONST(0.32298844511788638), FRAC_CONST(0.32608380639075912), FRAC_CONST(0.32917567556803889), FRAC_CONST(0.33226401953829071), FRAC_CONST(0.33534880522783189), FRAC_CONST(0.33842999960108583), FRAC_CONST(0.34150756966093632), FRAC_CONST(0.34458148244908043), FRAC_CONST(0.34765170504638188), FRAC_CONST(0.35071820457322322), FRAC_CONST(0.35378094818985806), FRAC_CONST(0.35683990309676283), FRAC_CONST(0.35989503653498811), FRAC_CONST(0.36294631578650921), FRAC_CONST(0.36599370817457672), FRAC_CONST(0.36903718106406647), FRAC_CONST(0.37207670186182878), FRAC_CONST(0.37511223801703802), FRAC_CONST(0.37814375702154046), FRAC_CONST(0.38117122641020335), FRAC_CONST(0.38419461376126157), FRAC_CONST(0.38721388669666562), FRAC_CONST(0.39022901288242801), FRAC_CONST(0.39323996002896966), FRAC_CONST(0.39624669589146555), FRAC_CONST(0.39924918827019029), FRAC_CONST(0.40224740501086254), FRAC_CONST(0.40524131400498986), FRAC_CONST(0.40823088319021217), FRAC_CONST(0.41121608055064529), FRAC_CONST(0.41419687411722372), FRAC_CONST(0.41717323196804335), FRAC_CONST(0.42014512222870243), FRAC_CONST(0.42311251307264408), FRAC_CONST(0.42607537272149631), FRAC_CONST(0.4290336694454126), FRAC_CONST(0.43198737156341183), FRAC_CONST(0.43493644744371707), FRAC_CONST(0.43788086550409511), FRAC_CONST(0.44082059421219388), FRAC_CONST(0.44375560208588088), FRAC_CONST(0.44668585769357955), FRAC_CONST(0.4496113296546066), FRAC_CONST(0.45253198663950756), FRAC_CONST(0.45544779737039259), FRAC_CONST(0.45835873062127125), FRAC_CONST(0.46126475521838717), FRAC_CONST(0.46416584004055156), FRAC_CONST(0.46706195401947659), FRAC_CONST(0.46995306614010829), FRAC_CONST(0.47283914544095862), FRAC_CONST(0.47572016101443682), FRAC_CONST(0.47859608200718085), FRAC_CONST(0.4814668776203872), FRAC_CONST(0.48433251711014125), FRAC_CONST(0.4871929697877464), FRAC_CONST(0.49004820502005247), FRAC_CONST(0.49289819222978404), FRAC_CONST(0.49574290089586776), FRAC_CONST(0.49858230055375902), FRAC_CONST(0.50141636079576901), FRAC_CONST(0.50424505127138919), FRAC_CONST(0.50706834168761705), FRAC_CONST(0.50988620180928057), FRAC_CONST(0.51269860145936175), FRAC_CONST(0.51550551051931948), FRAC_CONST(0.51830689892941317), FRAC_CONST(0.5211027366890234), FRAC_CONST(0.52389299385697385), FRAC_CONST(0.52667764055185196), FRAC_CONST(0.52945664695232897), FRAC_CONST(0.53222998329747884), FRAC_CONST(0.53499761988709726), FRAC_CONST(0.53775952708201991), FRAC_CONST(0.54051567530443978), FRAC_CONST(0.54326603503822357), FRAC_CONST(0.54601057682922816), FRAC_CONST(0.54874927128561579), FRAC_CONST(0.55148208907816942), FRAC_CONST(0.55420900094060566), FRAC_CONST(0.55692997766988939), FRAC_CONST(0.559644990126546), FRAC_CONST(0.56235400923497314), FRAC_CONST(0.56505700598375252), FRAC_CONST(0.56775395142596052), FRAC_CONST(0.57044481667947822), FRAC_CONST(0.57312957292730071), FRAC_CONST(0.57580819141784534), FRAC_CONST(0.57848064346525996), FRAC_CONST(0.58114690044973039), FRAC_CONST(0.58380693381778626), FRAC_CONST(0.58646071508260733), FRAC_CONST(0.58910821582432815), FRAC_CONST(0.5917494076903429), FRAC_CONST(0.5943842623956086), FRAC_CONST(0.59701275172294799), FRAC_CONST(0.59963484752335228), FRAC_CONST(0.60225052171628191), FRAC_CONST(0.60485974628996786), FRAC_CONST(0.60746249330171098), FRAC_CONST(0.61005873487818185), FRAC_CONST(0.61264844321571899), FRAC_CONST(0.61523159058062682), FRAC_CONST(0.61780814930947225), FRAC_CONST(0.62037809180938108), FRAC_CONST(0.62294139055833397), FRAC_CONST(0.6254980181054608), FRAC_CONST(0.62804794707133416), FRAC_CONST(0.63059115014826372), FRAC_CONST(0.63312760010058777), FRAC_CONST(0.63565726976496484), FRAC_CONST(0.63818013205066515), FRAC_CONST(0.64069615993986073), FRAC_CONST(0.64320532648791406), FRAC_CONST(0.64570760482366729), FRAC_CONST(0.64820296814972966), FRAC_CONST(0.65069138974276486), FRAC_CONST(0.65317284295377676), FRAC_CONST(0.65564730120839498), FRAC_CONST(0.65811473800715958), FRAC_CONST(0.660575126925805), FRAC_CONST(0.66302844161554231), FRAC_CONST(0.6654746558033422), FRAC_CONST(0.66791374329221598), FRAC_CONST(0.67034567796149647), FRAC_CONST(0.67277043376711676), FRAC_CONST(0.67518798474189046), FRAC_CONST(0.67759830499578866), FRAC_CONST(0.68000136871621808), FRAC_CONST(0.68239715016829683), FRAC_CONST(0.6847856236951303), FRAC_CONST(0.68716676371808583), FRAC_CONST(0.68954054473706683), FRAC_CONST(0.69190694133078579), FRAC_CONST(0.69426592815703603), FRAC_CONST(0.69661747995296419), FRAC_CONST(0.69896157153533944), FRAC_CONST(0.70129817780082437), FRAC_CONST(0.7036272737262429), FRAC_CONST(0.70594883436884903), FRAC_CONST(0.70826283486659336), FRAC_CONST(0.71056925043838959), FRAC_CONST(0.71286805638437978), FRAC_CONST(0.71515922808619936), FRAC_CONST(0.71744274100723993), FRAC_CONST(0.71971857069291278), FRAC_CONST(0.7219866927709101), FRAC_CONST(0.72424708295146689), FRAC_CONST(0.72649971702762028), FRAC_CONST(0.72874457087546896), FRAC_CONST(0.73098162045443171), FRAC_CONST(0.73321084180750484), FRAC_CONST(0.73543221106151868), FRAC_CONST(0.73764570442739286), FRAC_CONST(0.73985129820039208), FRAC_CONST(0.74204896876037885), FRAC_CONST(0.7442386925720671), FRAC_CONST(0.74642044618527381), FRAC_CONST(0.74859420623517081), FRAC_CONST(0.75075994944253421), FRAC_CONST(0.75291765261399446), FRAC_CONST(0.75506729264228367), FRAC_CONST(0.75720884650648446), FRAC_CONST(0.75934229127227548), FRAC_CONST(0.76146760409217706), FRAC_CONST(0.76358476220579641), FRAC_CONST(0.7656937429400712), FRAC_CONST(0.76779452370951196), FRAC_CONST(0.76988708201644451), FRAC_CONST(0.77197139545125026), FRAC_CONST(0.7740474416926072), FRAC_CONST(0.77611519850772781), FRAC_CONST(0.77817464375259782), FRAC_CONST(0.78022575537221317), FRAC_CONST(0.78226851140081632), FRAC_CONST(0.78430288996213138), FRAC_CONST(0.78632886926959822), FRAC_CONST(0.78834642762660623), FRAC_CONST(0.79035554342672631), FRAC_CONST(0.79235619515394229), FRAC_CONST(0.79434836138288134), FRAC_CONST(0.79633202077904397), FRAC_CONST(0.79830715209903147), FRAC_CONST(0.8002737341907743), FRAC_CONST(0.80223174599375802), FRAC_CONST(0.80418116653924954), FRAC_CONST(0.80612197495052085), FRAC_CONST(0.80805415044307316), FRAC_CONST(0.80997767232485907), FRAC_CONST(0.81189251999650469), FRAC_CONST(0.81379867295152986), FRAC_CONST(0.81569611077656778), FRAC_CONST(0.81758481315158371), FRAC_CONST(0.81946475985009259), FRAC_CONST(0.82133593073937561), FRAC_CONST(0.82319830578069586), FRAC_CONST(0.82505186502951278), FRAC_CONST(0.82689658863569615), FRAC_CONST(0.82873245684373809), FRAC_CONST(0.83055944999296494), FRAC_CONST(0.83237754851774781), FRAC_CONST(0.83418673294771239), FRAC_CONST(0.83598698390794668), FRAC_CONST(0.83777828211920935), FRAC_CONST(0.83956060839813562), FRAC_CONST(0.84133394365744296), FRAC_CONST(0.84309826890613537), FRAC_CONST(0.84485356524970701), FRAC_CONST(0.84659981389034411), FRAC_CONST(0.84833699612712676), FRAC_CONST(0.85006509335622882), FRAC_CONST(0.8517840870711173), FRAC_CONST(0.85349395886275037), FRAC_CONST(0.85519469041977514), FRAC_CONST(0.85688626352872277), FRAC_CONST(0.85856866007420429), FRAC_CONST(0.86024186203910447), FRAC_CONST(0.86190585150477417), FRAC_CONST(0.86356061065122347), FRAC_CONST(0.86520612175731115), FRAC_CONST(0.86684236720093533), FRAC_CONST(0.86846932945922151), FRAC_CONST(0.87008699110871135), FRAC_CONST(0.87169533482554817), FRAC_CONST(0.87329434338566281), FRAC_CONST(0.87488399966495822), FRAC_CONST(0.87646428663949283), FRAC_CONST(0.87803518738566277), FRAC_CONST(0.87959668508038291), FRAC_CONST(0.88114876300126743), FRAC_CONST(0.88269140452680916), FRAC_CONST(0.8842245931365561), FRAC_CONST(0.88574831241129048), FRAC_CONST(0.88726254603320276), FRAC_CONST(0.88876727778606746), FRAC_CONST(0.89026249155541637), FRAC_CONST(0.8917481713287112), FRAC_CONST(0.89322430119551532), FRAC_CONST(0.89469086534766362), FRAC_CONST(0.89614784807943237), FRAC_CONST(0.89759523378770689), FRAC_CONST(0.89903300697214927), FRAC_CONST(0.9004611522353636), FRAC_CONST(0.90187965428306172), FRAC_CONST(0.90328849792422594), FRAC_CONST(0.90468766807127299), FRAC_CONST(0.90607714974021469), FRAC_CONST(0.90745692805081868), FRAC_CONST(0.90882698822676755), FRAC_CONST(0.91018731559581767), FRAC_CONST(0.91153789558995579), FRAC_CONST(0.91287871374555518), FRAC_CONST(0.91420975570353069), FRAC_CONST(0.9155310072094921), FRAC_CONST(0.91684245411389753), FRAC_CONST(0.91814408237220391), FRAC_CONST(0.91943587804501858), FRAC_CONST(0.92071782729824769), FRAC_CONST(0.92198991640324446), FRAC_CONST(0.92325213173695675), FRAC_CONST(0.92450445978207241), FRAC_CONST(0.92574688712716402), FRAC_CONST(0.92697940046683291), FRAC_CONST(0.92820198660185149), FRAC_CONST(0.92941463243930444), FRAC_CONST(0.93061732499272909), FRAC_CONST(0.93181005138225426), FRAC_CONST(0.93299279883473885), FRAC_CONST(0.93416555468390772), FRAC_CONST(0.93532830637048769), FRAC_CONST(0.93648104144234268), FRAC_CONST(0.93762374755460598), FRAC_CONST(0.93875641246981323), FRAC_CONST(0.93987902405803303), FRAC_CONST(0.94099157029699743), FRAC_CONST(0.94209403927222979), FRAC_CONST(0.94318641917717327), FRAC_CONST(0.9442686983133165), FRAC_CONST(0.94534086509031956), FRAC_CONST(0.9464029080261378), FRAC_CONST(0.94745481574714419), FRAC_CONST(0.94849657698825252), FRAC_CONST(0.94952818059303667), FRAC_CONST(0.95054961551385087), FRAC_CONST(0.95156087081194762), FRAC_CONST(0.95256193565759528), FRAC_CONST(0.95355279933019343), FRAC_CONST(0.9545334512183884), FRAC_CONST(0.95550388082018611), FRAC_CONST(0.95646407774306541), FRAC_CONST(0.95741403170408834), FRAC_CONST(0.95835373253001133), FRAC_CONST(0.95928317015739362), FRAC_CONST(0.96020233463270466), FRAC_CONST(0.96111121611243155), FRAC_CONST(0.96200980486318388), FRAC_CONST(0.96289809126179782), FRAC_CONST(0.96377606579543984), FRAC_CONST(0.96464371906170809), FRAC_CONST(0.96550104176873297), FRAC_CONST(0.96634802473527726), FRAC_CONST(0.96718465889083372), FRAC_CONST(0.96801093527572268), FRAC_CONST(0.96882684504118799), FRAC_CONST(0.96963237944949143), FRAC_CONST(0.97042752987400682), FRAC_CONST(0.97121228779931179), FRAC_CONST(0.97198664482127939), FRAC_CONST(0.97275059264716823), FRAC_CONST(0.97350412309571066), FRAC_CONST(0.97424722809720088), FRAC_CONST(0.97497989969358168), FRAC_CONST(0.97570213003852857), FRAC_CONST(0.97641391139753486), FRAC_CONST(0.97711523614799412), FRAC_CONST(0.97780609677928154), FRAC_CONST(0.97848648589283505), FRAC_CONST(0.97915639620223371), FRAC_CONST(0.9798158205332762), FRAC_CONST(0.98046475182405801), FRAC_CONST(0.98110318312504607), FRAC_CONST(0.98173110759915416), FRAC_CONST(0.98234851852181571), FRAC_CONST(0.98295540928105563), FRAC_CONST(0.9835517733775615), FRAC_CONST(0.98413760442475307), FRAC_CONST(0.98471289614885038), FRAC_CONST(0.98527764238894122), FRAC_CONST(0.98583183709704714), FRAC_CONST(0.98637547433818806), FRAC_CONST(0.98690854829044583), FRAC_CONST(0.98743105324502667), FRAC_CONST(0.98794298360632238), FRAC_CONST(0.98844433389196995), FRAC_CONST(0.98893509873291074), FRAC_CONST(0.98941527287344755), FRAC_CONST(0.98988485117130098), FRAC_CONST(0.99034382859766479), FRAC_CONST(0.99079220023725967), FRAC_CONST(0.99122996128838525), FRAC_CONST(0.9916571070629725), FRAC_CONST(0.99207363298663342), FRAC_CONST(0.99247953459870997), FRAC_CONST(0.99287480755232194), FRAC_CONST(0.99325944761441354), FRAC_CONST(0.99363345066579889), FRAC_CONST(0.99399681270120555), FRAC_CONST(0.99434952982931812), FRAC_CONST(0.9946915982728195), FRAC_CONST(0.99502301436843166), FRAC_CONST(0.99534377456695422), FRAC_CONST(0.9956538754333033), FRAC_CONST(0.99595331364654771), FRAC_CONST(0.99624208599994479), FRAC_CONST(0.99652018940097464), FRAC_CONST(0.99678762087137318), FRAC_CONST(0.99704437754716424), FRAC_CONST(0.99729045667869021), FRAC_CONST(0.99752585563064111), FRAC_CONST(0.99775057188208349), FRAC_CONST(0.9979646030264866), FRAC_CONST(0.99816794677174903), FRAC_CONST(0.9983606009402225), FRAC_CONST(0.99854256346873571), FRAC_CONST(0.99871383240861611), FRAC_CONST(0.99887440592571108), FRAC_CONST(0.99902428230040718), FRAC_CONST(0.99916345992764877), FRAC_CONST(0.99929193731695531), FRAC_CONST(0.99940971309243731), FRAC_CONST(0.99951678599281069), FRAC_CONST(0.99961315487141078), FRAC_CONST(0.99969881869620425), FRAC_CONST(0.99977377654980037), FRAC_CONST(0.99983802762946083), FRAC_CONST(0.99989157124710804), FRAC_CONST(0.9999344068293331), FRAC_CONST(0.99996653391740109), FRAC_CONST(0.99998795216725689), FRAC_CONST(0.99999866134952808) }; #endif ALIGN static const real_t ld_mid_512[] = { FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0.0061358846491544753), FRAC_CONST(0.01840672990580482), FRAC_CONST(0.030674803176636626), FRAC_CONST(0.04293825693494082), FRAC_CONST(0.055195244349689934), FRAC_CONST(0.067443919563664051), FRAC_CONST(0.079682437971430126), FRAC_CONST(0.091908956497132724), FRAC_CONST(0.10412163387205459), FRAC_CONST(0.11631863091190475), FRAC_CONST(0.12849811079379317), FRAC_CONST(0.14065823933284921), FRAC_CONST(0.15279718525844344), FRAC_CONST(0.16491312048996989), FRAC_CONST(0.17700422041214875), FRAC_CONST(0.18906866414980619), FRAC_CONST(0.2011046348420919), FRAC_CONST(0.21311031991609136), FRAC_CONST(0.22508391135979283), FRAC_CONST(0.2370236059943672), FRAC_CONST(0.24892760574572015), FRAC_CONST(0.26079411791527551), FRAC_CONST(0.27262135544994898), FRAC_CONST(0.28440753721127188), FRAC_CONST(0.29615088824362379), FRAC_CONST(0.30784964004153487), FRAC_CONST(0.31950203081601569), FRAC_CONST(0.33110630575987643), FRAC_CONST(0.34266071731199438), FRAC_CONST(0.35416352542049034), FRAC_CONST(0.36561299780477385), FRAC_CONST(0.37700741021641826), FRAC_CONST(0.38834504669882625), FRAC_CONST(0.39962419984564679), FRAC_CONST(0.41084317105790391), FRAC_CONST(0.42200027079979968), FRAC_CONST(0.43309381885315196), FRAC_CONST(0.4441221445704292), FRAC_CONST(0.45508358712634384), FRAC_CONST(0.46597649576796618), FRAC_CONST(0.47679923006332209), FRAC_CONST(0.487550160148436), FRAC_CONST(0.49822766697278187), FRAC_CONST(0.50883014254310699), FRAC_CONST(0.51935599016558964), FRAC_CONST(0.52980362468629461), FRAC_CONST(0.54017147272989285), FRAC_CONST(0.55045797293660481), FRAC_CONST(0.56066157619733603), FRAC_CONST(0.57078074588696726), FRAC_CONST(0.58081395809576453), FRAC_CONST(0.59075970185887416), FRAC_CONST(0.60061647938386897), FRAC_CONST(0.61038280627630948), FRAC_CONST(0.6200572117632891), FRAC_CONST(0.62963823891492698), FRAC_CONST(0.63912444486377573), FRAC_CONST(0.64851440102211244), FRAC_CONST(0.65780669329707864), FRAC_CONST(0.66699992230363747), FRAC_CONST(0.67609270357531592), FRAC_CONST(0.68508366777270036), FRAC_CONST(0.693971460889654), FRAC_CONST(0.7027547444572253), FRAC_CONST(0.71143219574521643), FRAC_CONST(0.72000250796138165), FRAC_CONST(0.7284643904482252), FRAC_CONST(0.73681656887736979), FRAC_CONST(0.74505778544146595), FRAC_CONST(0.75318679904361241), FRAC_CONST(0.76120238548426178), FRAC_CONST(0.76910333764557959), FRAC_CONST(0.77688846567323244), FRAC_CONST(0.78455659715557524), FRAC_CONST(0.79210657730021239), FRAC_CONST(0.79953726910790501), FRAC_CONST(0.80684755354379922), FRAC_CONST(0.8140363297059483), FRAC_CONST(0.82110251499110465), FRAC_CONST(0.8280450452577558), FRAC_CONST(0.83486287498638001), FRAC_CONST(0.84155497743689833), FRAC_CONST(0.84812034480329712), FRAC_CONST(0.85455798836540053), FRAC_CONST(0.86086693863776731), FRAC_CONST(0.86704624551569265), FRAC_CONST(0.87309497841829009), FRAC_CONST(0.87901222642863341), FRAC_CONST(0.88479709843093779), FRAC_CONST(0.89044872324475788), FRAC_CONST(0.89596624975618511), FRAC_CONST(0.90134884704602203), FRAC_CONST(0.90659570451491533), FRAC_CONST(0.91170603200542988), FRAC_CONST(0.9166790599210427), FRAC_CONST(0.9215140393420419), FRAC_CONST(0.92621024213831127), FRAC_CONST(0.93076696107898371), FRAC_CONST(0.9351835099389475), FRAC_CONST(0.93945922360218992), FRAC_CONST(0.94359345816196039), FRAC_CONST(0.94758559101774109), FRAC_CONST(0.95143502096900834), FRAC_CONST(0.95514116830577067), FRAC_CONST(0.9587034748958716), FRAC_CONST(0.96212140426904158), FRAC_CONST(0.9653944416976894), FRAC_CONST(0.96852209427441727), FRAC_CONST(0.97150389098625178), FRAC_CONST(0.97433938278557586), FRAC_CONST(0.97702814265775439), FRAC_CONST(0.97956976568544052), FRAC_CONST(0.98196386910955524), FRAC_CONST(0.98421009238692903), FRAC_CONST(0.98630809724459867), FRAC_CONST(0.98825756773074946), FRAC_CONST(0.99005821026229712), FRAC_CONST(0.99170975366909953), FRAC_CONST(0.9932119492347945), FRAC_CONST(0.99456457073425542), FRAC_CONST(0.99576741446765982), FRAC_CONST(0.99682029929116567), FRAC_CONST(0.99772306664419164), FRAC_CONST(0.99847558057329477), FRAC_CONST(0.99907772775264536), FRAC_CONST(0.99952941750109314), FRAC_CONST(0.9998305817958234), FRAC_CONST(0.99998117528260111), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }; #ifdef ALLOW_SMALL_FRAMELENGTH ALIGN static const real_t ld_mid_480[] = { FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0.0065449379673518581), FRAC_CONST(0.019633692460628301), FRAC_CONST(0.032719082821776137), FRAC_CONST(0.045798866936520771), FRAC_CONST(0.058870803651189033), FRAC_CONST(0.071932653156719387), FRAC_CONST(0.084982177372441667), FRAC_CONST(0.09801714032956059), FRAC_CONST(0.11103530855427769), FRAC_CONST(0.12403445145048532), FRAC_CONST(0.13701234168196802), FRAC_CONST(0.14996675555404498), FRAC_CONST(0.16289547339458874), FRAC_CONST(0.17579627993435451), FRAC_CONST(0.18866696468655525), FRAC_CONST(0.2015053223256171), FRAC_CONST(0.21430915306505074), FRAC_CONST(0.2270762630343732), FRAC_CONST(0.23980446465501654), FRAC_CONST(0.25249157701515795), FRAC_CONST(0.26513542624340797), FRAC_CONST(0.27773384588129219), FRAC_CONST(0.29028467725446233), FRAC_CONST(0.3027857698425746), FRAC_CONST(0.31523498164776964), FRAC_CONST(0.32763017956169349), FRAC_CONST(0.33996923973099424), FRAC_CONST(0.35225004792123354), FRAC_CONST(0.36447049987914965), FRAC_CONST(0.37662850169321077), FRAC_CONST(0.38872197015239557), FRAC_CONST(0.40074883310314097), FRAC_CONST(0.41270702980439467), FRAC_CONST(0.42459451128071307), FRAC_CONST(0.43640924067334208), FRAC_CONST(0.44814919358922256), FRAC_CONST(0.45981235844785984), FRAC_CONST(0.47139673682599764), FRAC_CONST(0.48290034380003727), FRAC_CONST(0.49432120828614462), FRAC_CONST(0.50565737337798455), FRAC_CONST(0.51690689668202761), FRAC_CONST(0.52806785065036799), FRAC_CONST(0.53913832291100017), FRAC_CONST(0.55011641659549337), FRAC_CONST(0.56100025066400983), FRAC_CONST(0.57178796022761225), FRAC_CONST(0.58247769686780215), FRAC_CONST(0.59306762895323706), FRAC_CONST(0.60355594195357143), FRAC_CONST(0.61394083875036642), FRAC_CONST(0.62422053994501758), FRAC_CONST(0.63439328416364549), FRAC_CONST(0.64445732835889735), FRAC_CONST(0.65441094810861034), FRAC_CONST(0.66425243791128175), FRAC_CONST(0.67398011147829784), FRAC_CONST(0.68359230202287125), FRAC_CONST(0.69308736254563585), FRAC_CONST(0.70246366611685174), FRAC_CONST(0.71171960615517138), FRAC_CONST(0.72085359670291882), FRAC_CONST(0.7298640726978356), FRAC_CONST(0.73874949024124625), FRAC_CONST(0.74750832686259672), FRAC_CONST(0.75613908178032285), FRAC_CONST(0.76464027615900032), FRAC_CONST(0.77301045336273699), FRAC_CONST(0.78124817920475853), FRAC_CONST(0.78935204219315003), FRAC_CONST(0.79732065377270711), FRAC_CONST(0.80515264856285829), FRAC_CONST(0.81284668459161513), FRAC_CONST(0.82040144352551359), FRAC_CONST(0.82781563089550203), FRAC_CONST(0.83508797631874299), FRAC_CONST(0.84221723371628654), FRAC_CONST(0.84920218152657889), FRAC_CONST(0.85604162291477137), FRAC_CONST(0.86273438597779184), FRAC_CONST(0.86927932394514362), FRAC_CONST(0.87567531537539967), FRAC_CONST(0.88192126434835494), FRAC_CONST(0.88801610065280734), FRAC_CONST(0.89395877996993212), FRAC_CONST(0.8997482840522214), FRAC_CONST(0.90538362089795521), FRAC_CONST(0.91086382492117568), FRAC_CONST(0.91618795711713596), FRAC_CONST(0.92135510522319242), FRAC_CONST(0.9263643838751181), FRAC_CONST(0.93121493475880346), FRAC_CONST(0.93590592675732565), FRAC_CONST(0.94043655609335486), FRAC_CONST(0.94480604646687805), FRAC_CONST(0.94901364918821385), FRAC_CONST(0.95305864330629697), FRAC_CONST(0.95694033573220882), FRAC_CONST(0.9606580613579353), FRAC_CONST(0.96421118317032928), FRAC_CONST(0.96759909236025976), FRAC_CONST(0.9708212084269281), FRAC_CONST(0.97387697927733363), FRAC_CONST(0.97676588132087239), FRAC_CONST(0.97948741955905139), FRAC_CONST(0.98204112767030394), FRAC_CONST(0.98442656808989171), FRAC_CONST(0.98664333208487898), FRAC_CONST(0.98869103982416728), FRAC_CONST(0.99056934044357725), FRAC_CONST(0.99227791210596705), FRAC_CONST(0.99381646205637808), FRAC_CONST(0.99518472667219682), FRAC_CONST(0.99638247150832537), FRAC_CONST(0.99740949133735191), FRAC_CONST(0.99826561018471593), FRAC_CONST(0.99895068135886012), FRAC_CONST(0.99946458747636568), FRAC_CONST(0.99980724048206482), FRAC_CONST(0.99997858166412923), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }; #endif #endif #ifdef __cplusplus } #endif #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/specrec.c
C
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: specrec.c,v 1.62 2009/01/26 23:51:15 menno Exp $ **/ /* Spectral reconstruction: - grouping/sectioning - inverse quantization - applying scalefactors */ #include "common.h" #include "structs.h" #include <string.h> #include <stdlib.h> #include "specrec.h" #include "filtbank.h" #include "syntax.h" #include "iq_table.h" #include "ms.h" #include "is.h" #include "pns.h" #include "tns.h" #include "drc.h" #include "lt_predict.h" #include "ic_predict.h" #ifdef SSR_DEC #include "ssr.h" #include "ssr_fb.h" #endif /* static function declarations */ static uint8_t quant_to_spec(NeAACDecStruct *hDecoder, ic_stream *ics, int16_t *quant_data, real_t *spec_data, uint16_t frame_len); #ifdef LD_DEC ALIGN static const uint8_t num_swb_512_window[] = { 0, 0, 0, 36, 36, 37, 31, 31, 0, 0, 0, 0 }; ALIGN static const uint8_t num_swb_480_window[] = { 0, 0, 0, 35, 35, 37, 30, 30, 0, 0, 0, 0 }; #endif ALIGN static const uint8_t num_swb_960_window[] = { 40, 40, 45, 49, 49, 49, 46, 46, 42, 42, 42, 40 }; ALIGN static const uint8_t num_swb_1024_window[] = { 41, 41, 47, 49, 49, 51, 47, 47, 43, 43, 43, 40 }; ALIGN static const uint8_t num_swb_128_window[] = { 12, 12, 12, 14, 14, 14, 15, 15, 15, 15, 15, 15 }; ALIGN static const uint16_t swb_offset_1024_96[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72, 80, 88, 96, 108, 120, 132, 144, 156, 172, 188, 212, 240, 276, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960, 1024 }; ALIGN static const uint16_t swb_offset_128_96[] = { 0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128 }; ALIGN static const uint16_t swb_offset_1024_64[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72, 80, 88, 100, 112, 124, 140, 156, 172, 192, 216, 240, 268, 304, 344, 384, 424, 464, 504, 544, 584, 624, 664, 704, 744, 784, 824, 864, 904, 944, 984, 1024 }; ALIGN static const uint16_t swb_offset_128_64[] = { 0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128 }; ALIGN static const uint16_t swb_offset_1024_48[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 80, 88, 96, 108, 120, 132, 144, 160, 176, 196, 216, 240, 264, 292, 320, 352, 384, 416, 448, 480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800, 832, 864, 896, 928, 1024 }; #ifdef LD_DEC ALIGN static const uint16_t swb_offset_512_48[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 68, 76, 84, 92, 100, 112, 124, 136, 148, 164, 184, 208, 236, 268, 300, 332, 364, 396, 428, 460, 512 }; ALIGN static const uint16_t swb_offset_480_48[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72 ,80 ,88, 96, 108, 120, 132, 144, 156, 172, 188, 212, 240, 272, 304, 336, 368, 400, 432, 480 }; #endif ALIGN static const uint16_t swb_offset_128_48[] = { 0, 4, 8, 12, 16, 20, 28, 36, 44, 56, 68, 80, 96, 112, 128 }; ALIGN static const uint16_t swb_offset_1024_32[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 80, 88, 96, 108, 120, 132, 144, 160, 176, 196, 216, 240, 264, 292, 320, 352, 384, 416, 448, 480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800, 832, 864, 896, 928, 960, 992, 1024 }; #ifdef LD_DEC ALIGN static const uint16_t swb_offset_512_32[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72, 80, 88, 96, 108, 120, 132, 144, 160, 176, 192, 212, 236, 260, 288, 320, 352, 384, 416, 448, 480, 512 }; ALIGN static const uint16_t swb_offset_480_32[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 72, 80, 88, 96, 104, 112, 124, 136, 148, 164, 180, 200, 224, 256, 288, 320, 352, 384, 416, 448, 480 }; #endif ALIGN static const uint16_t swb_offset_1024_24[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68, 76, 84, 92, 100, 108, 116, 124, 136, 148, 160, 172, 188, 204, 220, 240, 260, 284, 308, 336, 364, 396, 432, 468, 508, 552, 600, 652, 704, 768, 832, 896, 960, 1024 }; #ifdef LD_DEC ALIGN static const uint16_t swb_offset_512_24[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68, 80, 92, 104, 120, 140, 164, 192, 224, 256, 288, 320, 352, 384, 416, 448, 480, 512 }; ALIGN static const uint16_t swb_offset_480_24[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68, 80, 92, 104, 120, 140, 164, 192, 224, 256, 288, 320, 352, 384, 416, 448, 480 }; #endif ALIGN static const uint16_t swb_offset_128_24[] = { 0, 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 64, 76, 92, 108, 128 }; ALIGN static const uint16_t swb_offset_1024_16[] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 100, 112, 124, 136, 148, 160, 172, 184, 196, 212, 228, 244, 260, 280, 300, 320, 344, 368, 396, 424, 456, 492, 532, 572, 616, 664, 716, 772, 832, 896, 960, 1024 }; ALIGN static const uint16_t swb_offset_128_16[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 40, 48, 60, 72, 88, 108, 128 }; ALIGN static const uint16_t swb_offset_1024_8[] = { 0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144, 156, 172, 188, 204, 220, 236, 252, 268, 288, 308, 328, 348, 372, 396, 420, 448, 476, 508, 544, 580, 620, 664, 712, 764, 820, 880, 944, 1024 }; ALIGN static const uint16_t swb_offset_128_8[] = { 0, 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 60, 72, 88, 108, 128 }; ALIGN static const uint16_t *swb_offset_1024_window[] = { swb_offset_1024_96, /* 96000 */ swb_offset_1024_96, /* 88200 */ swb_offset_1024_64, /* 64000 */ swb_offset_1024_48, /* 48000 */ swb_offset_1024_48, /* 44100 */ swb_offset_1024_32, /* 32000 */ swb_offset_1024_24, /* 24000 */ swb_offset_1024_24, /* 22050 */ swb_offset_1024_16, /* 16000 */ swb_offset_1024_16, /* 12000 */ swb_offset_1024_16, /* 11025 */ swb_offset_1024_8 /* 8000 */ }; #ifdef LD_DEC ALIGN static const uint16_t *swb_offset_512_window[] = { 0, /* 96000 */ 0, /* 88200 */ 0, /* 64000 */ swb_offset_512_48, /* 48000 */ swb_offset_512_48, /* 44100 */ swb_offset_512_32, /* 32000 */ swb_offset_512_24, /* 24000 */ swb_offset_512_24, /* 22050 */ 0, /* 16000 */ 0, /* 12000 */ 0, /* 11025 */ 0 /* 8000 */ }; ALIGN static const uint16_t *swb_offset_480_window[] = { 0, /* 96000 */ 0, /* 88200 */ 0, /* 64000 */ swb_offset_480_48, /* 48000 */ swb_offset_480_48, /* 44100 */ swb_offset_480_32, /* 32000 */ swb_offset_480_24, /* 24000 */ swb_offset_480_24, /* 22050 */ 0, /* 16000 */ 0, /* 12000 */ 0, /* 11025 */ 0 /* 8000 */ }; #endif ALIGN static const uint16_t *swb_offset_128_window[] = { swb_offset_128_96, /* 96000 */ swb_offset_128_96, /* 88200 */ swb_offset_128_64, /* 64000 */ swb_offset_128_48, /* 48000 */ swb_offset_128_48, /* 44100 */ swb_offset_128_48, /* 32000 */ swb_offset_128_24, /* 24000 */ swb_offset_128_24, /* 22050 */ swb_offset_128_16, /* 16000 */ swb_offset_128_16, /* 12000 */ swb_offset_128_16, /* 11025 */ swb_offset_128_8 /* 8000 */ }; #define bit_set(A, B) ((A) & (1<<(B))) /* 4.5.2.3.4 */ /* - determine the number of windows in a window_sequence named num_windows - determine the number of window_groups named num_window_groups - determine the number of windows in each group named window_group_length[g] - determine the total number of scalefactor window bands named num_swb for the actual window type - determine swb_offset[swb], the offset of the first coefficient in scalefactor window band named swb of the window actually used - determine sect_sfb_offset[g][section],the offset of the first coefficient in section named section. This offset depends on window_sequence and scale_factor_grouping and is needed to decode the spectral_data(). */ uint8_t window_grouping_info(NeAACDecStruct *hDecoder, ic_stream *ics) { uint8_t i, g; uint8_t sf_index = hDecoder->sf_index; switch (ics->window_sequence) { case ONLY_LONG_SEQUENCE: case LONG_START_SEQUENCE: case LONG_STOP_SEQUENCE: ics->num_windows = 1; ics->num_window_groups = 1; ics->window_group_length[ics->num_window_groups-1] = 1; #ifdef LD_DEC if (hDecoder->object_type == LD) { if (hDecoder->frameLength == 512) ics->num_swb = num_swb_512_window[sf_index]; else /* if (hDecoder->frameLength == 480) */ ics->num_swb = num_swb_480_window[sf_index]; } else { #endif if (hDecoder->frameLength == 1024) ics->num_swb = num_swb_1024_window[sf_index]; else /* if (hDecoder->frameLength == 960) */ ics->num_swb = num_swb_960_window[sf_index]; #ifdef LD_DEC } #endif if (ics->max_sfb > ics->num_swb) { return 32; } /* preparation of sect_sfb_offset for long blocks */ /* also copy the last value! */ #ifdef LD_DEC if (hDecoder->object_type == LD) { if (hDecoder->frameLength == 512) { for (i = 0; i < ics->num_swb; i++) { ics->sect_sfb_offset[0][i] = swb_offset_512_window[sf_index][i]; ics->swb_offset[i] = swb_offset_512_window[sf_index][i]; } } else /* if (hDecoder->frameLength == 480) */ { for (i = 0; i < ics->num_swb; i++) { ics->sect_sfb_offset[0][i] = swb_offset_480_window[sf_index][i]; ics->swb_offset[i] = swb_offset_480_window[sf_index][i]; } } ics->sect_sfb_offset[0][ics->num_swb] = hDecoder->frameLength; ics->swb_offset[ics->num_swb] = hDecoder->frameLength; ics->swb_offset_max = hDecoder->frameLength; } else { #endif for (i = 0; i < ics->num_swb; i++) { ics->sect_sfb_offset[0][i] = swb_offset_1024_window[sf_index][i]; ics->swb_offset[i] = swb_offset_1024_window[sf_index][i]; } ics->sect_sfb_offset[0][ics->num_swb] = hDecoder->frameLength; ics->swb_offset[ics->num_swb] = hDecoder->frameLength; ics->swb_offset_max = hDecoder->frameLength; #ifdef LD_DEC } #endif return 0; case EIGHT_SHORT_SEQUENCE: ics->num_windows = 8; ics->num_window_groups = 1; ics->window_group_length[ics->num_window_groups-1] = 1; ics->num_swb = num_swb_128_window[sf_index]; if (ics->max_sfb > ics->num_swb) { return 32; } for (i = 0; i < ics->num_swb; i++) ics->swb_offset[i] = swb_offset_128_window[sf_index][i]; ics->swb_offset[ics->num_swb] = hDecoder->frameLength/8; ics->swb_offset_max = hDecoder->frameLength/8; for (i = 0; i < ics->num_windows-1; i++) { if (bit_set(ics->scale_factor_grouping, 6-i) == 0) { ics->num_window_groups += 1; ics->window_group_length[ics->num_window_groups-1] = 1; } else { ics->window_group_length[ics->num_window_groups-1] += 1; } } /* preparation of sect_sfb_offset for short blocks */ for (g = 0; g < ics->num_window_groups; g++) { uint16_t width; uint8_t sect_sfb = 0; uint16_t offset = 0; for (i = 0; i < ics->num_swb; i++) { if (i+1 == ics->num_swb) { width = (hDecoder->frameLength/8) - swb_offset_128_window[sf_index][i]; } else { width = swb_offset_128_window[sf_index][i+1] - swb_offset_128_window[sf_index][i]; } width *= ics->window_group_length[g]; ics->sect_sfb_offset[g][sect_sfb++] = offset; offset += width; } ics->sect_sfb_offset[g][sect_sfb] = offset; } return 0; default: return 32; } } /* iquant() * /* output = sign(input)*abs(input)^(4/3) */ /**/ static INLINE real_t iquant(int16_t q, const real_t *tab, uint8_t *error) { #ifdef FIXED_POINT /* For FIXED_POINT the iq_table is prescaled by 3 bits (iq_table[]/8) */ /* BIG_IQ_TABLE allows you to use the full 8192 value table, if this is not * defined a 1026 value table and interpolation will be used */ #ifndef BIG_IQ_TABLE static const real_t errcorr[] = { REAL_CONST(0), REAL_CONST(1.0/8.0), REAL_CONST(2.0/8.0), REAL_CONST(3.0/8.0), REAL_CONST(4.0/8.0), REAL_CONST(5.0/8.0), REAL_CONST(6.0/8.0), REAL_CONST(7.0/8.0), REAL_CONST(0) }; real_t x1, x2; #endif int16_t sgn = 1; if (q < 0) { q = -q; sgn = -1; } if (q < IQ_TABLE_SIZE) { //#define IQUANT_PRINT #ifdef IQUANT_PRINT //printf("0x%.8X\n", sgn * tab[q]); printf("%d\n", sgn * tab[q]); #endif return sgn * tab[q]; } #ifndef BIG_IQ_TABLE if (q >= 8192) { *error = 17; return 0; } /* linear interpolation */ x1 = tab[q>>3]; x2 = tab[(q>>3) + 1]; return sgn * 16 * (MUL_R(errcorr[q&7],(x2-x1)) + x1); #else *error = 17; return 0; #endif #else if (q < 0) { /* tab contains a value for all possible q [0,8192] */ if (-q < IQ_TABLE_SIZE) return -tab[-q]; *error = 17; return 0; } else { /* tab contains a value for all possible q [0,8192] */ if (q < IQ_TABLE_SIZE) return tab[q]; *error = 17; return 0; } #endif } #ifndef FIXED_POINT ALIGN static const real_t pow2sf_tab[] = { 2.9802322387695313E-008, 5.9604644775390625E-008, 1.1920928955078125E-007, 2.384185791015625E-007, 4.76837158203125E-007, 9.5367431640625E-007, 1.9073486328125E-006, 3.814697265625E-006, 7.62939453125E-006, 1.52587890625E-005, 3.0517578125E-005, 6.103515625E-005, 0.0001220703125, 0.000244140625, 0.00048828125, 0.0009765625, 0.001953125, 0.00390625, 0.0078125, 0.015625, 0.03125, 0.0625, 0.125, 0.25, 0.5, 1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 128.0, 256.0, 512.0, 1024.0, 2048.0, 4096.0, 8192.0, 16384.0, 32768.0, 65536.0, 131072.0, 262144.0, 524288.0, 1048576.0, 2097152.0, 4194304.0, 8388608.0, 16777216.0, 33554432.0, 67108864.0, 134217728.0, 268435456.0, 536870912.0, 1073741824.0, 2147483648.0, 4294967296.0, 8589934592.0, 17179869184.0, 34359738368.0, 68719476736.0, 137438953472.0, 274877906944.0 }; #endif /* quant_to_spec: perform dequantisation and scaling * and in case of short block it also does the deinterleaving */ /* For ONLY_LONG_SEQUENCE windows (num_window_groups = 1, window_group_length[0] = 1) the spectral data is in ascending spectral order. For the EIGHT_SHORT_SEQUENCE window, the spectral order depends on the grouping in the following manner: - Groups are ordered sequentially - Within a group, a scalefactor band consists of the spectral data of all grouped SHORT_WINDOWs for the associated scalefactor window band. To clarify via example, the length of a group is in the range of one to eight SHORT_WINDOWs. - If there are eight groups each with length one (num_window_groups = 8, window_group_length[0..7] = 1), the result is a sequence of eight spectra, each in ascending spectral order. - If there is only one group with length eight (num_window_groups = 1, window_group_length[0] = 8), the result is that spectral data of all eight SHORT_WINDOWs is interleaved by scalefactor window bands. - Within a scalefactor window band, the coefficients are in ascending spectral order. */ static uint8_t quant_to_spec(NeAACDecStruct *hDecoder, ic_stream *ics, int16_t *quant_data, real_t *spec_data, uint16_t frame_len) { ALIGN static const real_t pow2_table[] = { COEF_CONST(1.0), COEF_CONST(1.1892071150027210667174999705605), /* 2^0.25 */ COEF_CONST(1.4142135623730950488016887242097), /* 2^0.5 */ COEF_CONST(1.6817928305074290860622509524664) /* 2^0.75 */ }; const real_t *tab = iq_table; uint8_t g, sfb, win; uint16_t width, bin, k, gindex, wa, wb; uint8_t error = 0; /* Init error flag */ #ifndef FIXED_POINT real_t scf; #endif k = 0; gindex = 0; for (g = 0; g < ics->num_window_groups; g++) { uint16_t j = 0; uint16_t gincrease = 0; uint16_t win_inc = ics->swb_offset[ics->num_swb]; for (sfb = 0; sfb < ics->num_swb; sfb++) { int32_t exp, frac; width = ics->swb_offset[sfb+1] - ics->swb_offset[sfb]; /* this could be scalefactor for IS or PNS, those can be negative or bigger then 255 */ /* just ignore them */ if (ics->scale_factors[g][sfb] < 0 || ics->scale_factors[g][sfb] > 255) { exp = 0; frac = 0; } else { /* ics->scale_factors[g][sfb] must be between 0 and 255 */ exp = (ics->scale_factors[g][sfb] /* - 100 */) >> 2; /* frac must always be > 0 */ frac = (ics->scale_factors[g][sfb] /* - 100 */) & 3; } #ifdef FIXED_POINT exp -= 25; /* IMDCT pre-scaling */ if (hDecoder->object_type == LD) { exp -= 6 /*9*/; } else { if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) exp -= 4 /*7*/; else exp -= 7 /*10*/; } #endif wa = gindex + j; #ifndef FIXED_POINT scf = pow2sf_tab[exp/*+25*/] * pow2_table[frac]; #endif for (win = 0; win < ics->window_group_length[g]; win++) { for (bin = 0; bin < width; bin += 4) { #ifndef FIXED_POINT wb = wa + bin; spec_data[wb+0] = iquant(quant_data[k+0], tab, &error) * scf; spec_data[wb+1] = iquant(quant_data[k+1], tab, &error) * scf; spec_data[wb+2] = iquant(quant_data[k+2], tab, &error) * scf; spec_data[wb+3] = iquant(quant_data[k+3], tab, &error) * scf; #else real_t iq0 = iquant(quant_data[k+0], tab, &error); real_t iq1 = iquant(quant_data[k+1], tab, &error); real_t iq2 = iquant(quant_data[k+2], tab, &error); real_t iq3 = iquant(quant_data[k+3], tab, &error); wb = wa + bin; if (exp < 0) { spec_data[wb+0] = iq0 >>= -exp; spec_data[wb+1] = iq1 >>= -exp; spec_data[wb+2] = iq2 >>= -exp; spec_data[wb+3] = iq3 >>= -exp; } else { spec_data[wb+0] = iq0 <<= exp; spec_data[wb+1] = iq1 <<= exp; spec_data[wb+2] = iq2 <<= exp; spec_data[wb+3] = iq3 <<= exp; } if (frac != 0) { spec_data[wb+0] = MUL_C(spec_data[wb+0],pow2_table[frac]); spec_data[wb+1] = MUL_C(spec_data[wb+1],pow2_table[frac]); spec_data[wb+2] = MUL_C(spec_data[wb+2],pow2_table[frac]); spec_data[wb+3] = MUL_C(spec_data[wb+3],pow2_table[frac]); } //#define SCFS_PRINT #ifdef SCFS_PRINT printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+0]); printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+1]); printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+2]); printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+3]); //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+0]); //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+1]); //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+2]); //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+3]); #endif #endif gincrease += 4; k += 4; } wa += win_inc; } j += width; } gindex += gincrease; } return error; } static uint8_t allocate_single_channel(NeAACDecStruct *hDecoder, uint8_t channel, uint8_t output_channels) { int mul = 1; #ifdef MAIN_DEC /* MAIN object type prediction */ if (hDecoder->object_type == MAIN) { /* allocate the state only when needed */ if (hDecoder->pred_stat[channel] != NULL) { faad_free(hDecoder->pred_stat[channel]); hDecoder->pred_stat[channel] = NULL; } hDecoder->pred_stat[channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); reset_all_predictors(hDecoder->pred_stat[channel], hDecoder->frameLength); } #endif #ifdef LTP_DEC if (is_ltp_ot(hDecoder->object_type)) { /* allocate the state only when needed */ if (hDecoder->lt_pred_stat[channel] != NULL) { faad_free(hDecoder->lt_pred_stat[channel]); hDecoder->lt_pred_stat[channel] = NULL; } hDecoder->lt_pred_stat[channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); memset(hDecoder->lt_pred_stat[channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); } #endif if (hDecoder->time_out[channel] != NULL) { faad_free(hDecoder->time_out[channel]); hDecoder->time_out[channel] = NULL; } { mul = 1; #ifdef SBR_DEC hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0; if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) { /* SBR requires 2 times as much output data */ mul = 2; hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1; } #endif hDecoder->time_out[channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); memset(hDecoder->time_out[channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); } #if (defined(PS_DEC) || defined(DRM_PS)) if (output_channels == 2) { if (hDecoder->time_out[channel+1] != NULL) { faad_free(hDecoder->time_out[channel+1]); hDecoder->time_out[channel+1] = NULL; } hDecoder->time_out[channel+1] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); memset(hDecoder->time_out[channel+1], 0, mul*hDecoder->frameLength*sizeof(real_t)); } #endif if (hDecoder->fb_intermed[channel] != NULL) { faad_free(hDecoder->fb_intermed[channel]); hDecoder->fb_intermed[channel] = NULL; } hDecoder->fb_intermed[channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); memset(hDecoder->fb_intermed[channel], 0, hDecoder->frameLength*sizeof(real_t)); #ifdef SSR_DEC if (hDecoder->object_type == SSR) { if (hDecoder->ssr_overlap[channel] == NULL) { hDecoder->ssr_overlap[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); memset(hDecoder->ssr_overlap[channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); } if (hDecoder->prev_fmd[channel] == NULL) { uint16_t k; hDecoder->prev_fmd[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); for (k = 0; k < 2*hDecoder->frameLength; k++) hDecoder->prev_fmd[channel][k] = REAL_CONST(-1); } } #endif return 0; } static uint8_t allocate_channel_pair(NeAACDecStruct *hDecoder, uint8_t channel, uint8_t paired_channel) { int mul = 1; #ifdef MAIN_DEC /* MAIN object type prediction */ if (hDecoder->object_type == MAIN) { /* allocate the state only when needed */ if (hDecoder->pred_stat[channel] == NULL) { hDecoder->pred_stat[channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); reset_all_predictors(hDecoder->pred_stat[channel], hDecoder->frameLength); } if (hDecoder->pred_stat[paired_channel] == NULL) { hDecoder->pred_stat[paired_channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); reset_all_predictors(hDecoder->pred_stat[paired_channel], hDecoder->frameLength); } } #endif #ifdef LTP_DEC if (is_ltp_ot(hDecoder->object_type)) { /* allocate the state only when needed */ if (hDecoder->lt_pred_stat[channel] == NULL) { hDecoder->lt_pred_stat[channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); memset(hDecoder->lt_pred_stat[channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); } if (hDecoder->lt_pred_stat[paired_channel] == NULL) { hDecoder->lt_pred_stat[paired_channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); memset(hDecoder->lt_pred_stat[paired_channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); } } #endif if (hDecoder->time_out[channel] == NULL) { mul = 1; #ifdef SBR_DEC hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0; if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) { /* SBR requires 2 times as much output data */ mul = 2; hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1; } #endif hDecoder->time_out[channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); memset(hDecoder->time_out[channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); } if (hDecoder->time_out[paired_channel] == NULL) { hDecoder->time_out[paired_channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); memset(hDecoder->time_out[paired_channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); } if (hDecoder->fb_intermed[channel] == NULL) { hDecoder->fb_intermed[channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); memset(hDecoder->fb_intermed[channel], 0, hDecoder->frameLength*sizeof(real_t)); } if (hDecoder->fb_intermed[paired_channel] == NULL) { hDecoder->fb_intermed[paired_channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); memset(hDecoder->fb_intermed[paired_channel], 0, hDecoder->frameLength*sizeof(real_t)); } #ifdef SSR_DEC if (hDecoder->object_type == SSR) { if (hDecoder->ssr_overlap[cpe->channel] == NULL) { hDecoder->ssr_overlap[cpe->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); memset(hDecoder->ssr_overlap[cpe->channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); } if (hDecoder->ssr_overlap[cpe->paired_channel] == NULL) { hDecoder->ssr_overlap[cpe->paired_channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); memset(hDecoder->ssr_overlap[cpe->paired_channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); } if (hDecoder->prev_fmd[cpe->channel] == NULL) { uint16_t k; hDecoder->prev_fmd[cpe->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); for (k = 0; k < 2*hDecoder->frameLength; k++) hDecoder->prev_fmd[cpe->channel][k] = REAL_CONST(-1); } if (hDecoder->prev_fmd[cpe->paired_channel] == NULL) { uint16_t k; hDecoder->prev_fmd[cpe->paired_channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); for (k = 0; k < 2*hDecoder->frameLength; k++) hDecoder->prev_fmd[cpe->paired_channel][k] = REAL_CONST(-1); } } #endif return 0; } uint8_t reconstruct_single_channel(NeAACDecStruct *hDecoder, ic_stream *ics, element *sce, int16_t *spec_data) { uint8_t retval; int output_channels; ALIGN real_t spec_coef[1024]; #ifdef PROFILE int64_t count = faad_get_ts(); #endif /* always allocate 2 channels, PS can always "suddenly" turn up */ #if ( (defined(DRM) && defined(DRM_PS)) ) output_channels = 2; #elif defined(PS_DEC) if (hDecoder->ps_used[hDecoder->fr_ch_ele]) output_channels = 2; else output_channels = 1; #else output_channels = 1; #endif if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0) { /* element_output_channels not set yet */ hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels; } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != output_channels) { /* element inconsistency */ /* this only happens if PS is actually found but not in the first frame * this means that there is only 1 bitstream element! */ /* reset the allocation */ hDecoder->element_alloced[hDecoder->fr_ch_ele] = 0; hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels; //return 21; } if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0) { retval = allocate_single_channel(hDecoder, sce->channel, output_channels); if (retval > 0) return retval; hDecoder->element_alloced[hDecoder->fr_ch_ele] = 1; } /* dequantisation and scaling */ retval = quant_to_spec(hDecoder, ics, spec_data, spec_coef, hDecoder->frameLength); if (retval > 0) return retval; #ifdef PROFILE count = faad_get_ts() - count; hDecoder->requant_cycles += count; #endif /* pns decoding */ pns_decode(ics, NULL, spec_coef, NULL, hDecoder->frameLength, 0, hDecoder->object_type, &(hDecoder->__r1), &(hDecoder->__r2)); #ifdef MAIN_DEC /* MAIN object type prediction */ if (hDecoder->object_type == MAIN) { if (!hDecoder->pred_stat[sce->channel]) return 33; /* intra channel prediction */ ic_prediction(ics, spec_coef, hDecoder->pred_stat[sce->channel], hDecoder->frameLength, hDecoder->sf_index); /* In addition, for scalefactor bands coded by perceptual noise substitution the predictors belonging to the corresponding spectral coefficients are reset. */ pns_reset_pred_state(ics, hDecoder->pred_stat[sce->channel]); } #endif #ifdef LTP_DEC if (is_ltp_ot(hDecoder->object_type)) { #ifdef LD_DEC if (hDecoder->object_type == LD) { if (ics->ltp.data_present) { if (ics->ltp.lag_update) hDecoder->ltp_lag[sce->channel] = ics->ltp.lag; } ics->ltp.lag = hDecoder->ltp_lag[sce->channel]; } #endif /* long term prediction */ lt_prediction(ics, &(ics->ltp), spec_coef, hDecoder->lt_pred_stat[sce->channel], hDecoder->fb, ics->window_shape, hDecoder->window_shape_prev[sce->channel], hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength); } #endif /* tns decoding */ tns_decode_frame(ics, &(ics->tns), hDecoder->sf_index, hDecoder->object_type, spec_coef, hDecoder->frameLength); /* drc decoding */ if (hDecoder->drc->present) { if (!hDecoder->drc->exclude_mask[sce->channel] || !hDecoder->drc->excluded_chns_present) drc_decode(hDecoder->drc, spec_coef); } /* filter bank */ #ifdef SSR_DEC if (hDecoder->object_type != SSR) { #endif ifilter_bank(hDecoder->fb, ics->window_sequence, ics->window_shape, hDecoder->window_shape_prev[sce->channel], spec_coef, hDecoder->time_out[sce->channel], hDecoder->fb_intermed[sce->channel], hDecoder->object_type, hDecoder->frameLength); #ifdef SSR_DEC } else { ssr_decode(&(ics->ssr), hDecoder->fb, ics->window_sequence, ics->window_shape, hDecoder->window_shape_prev[sce->channel], spec_coef, hDecoder->time_out[sce->channel], hDecoder->ssr_overlap[sce->channel], hDecoder->ipqf_buffer[sce->channel], hDecoder->prev_fmd[sce->channel], hDecoder->frameLength); } #endif /* save window shape for next frame */ hDecoder->window_shape_prev[sce->channel] = ics->window_shape; #ifdef LTP_DEC if (is_ltp_ot(hDecoder->object_type)) { lt_update_state(hDecoder->lt_pred_stat[sce->channel], hDecoder->time_out[sce->channel], hDecoder->fb_intermed[sce->channel], hDecoder->frameLength, hDecoder->object_type); } #endif #ifdef SBR_DEC if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) && hDecoder->sbr_alloced[hDecoder->fr_ch_ele]) { int ele = hDecoder->fr_ch_ele; int ch = sce->channel; /* following case can happen when forceUpSampling == 1 */ if (hDecoder->sbr[ele] == NULL) { hDecoder->sbr[ele] = sbrDecodeInit(hDecoder->frameLength, hDecoder->element_id[ele], 2*get_sample_rate(hDecoder->sf_index), hDecoder->downSampledSBR #ifdef DRM , 0 #endif ); } if (sce->ics1.window_sequence == EIGHT_SHORT_SEQUENCE) hDecoder->sbr[ele]->maxAACLine = 8*min(sce->ics1.swb_offset[max(sce->ics1.max_sfb-1, 0)], sce->ics1.swb_offset_max); else hDecoder->sbr[ele]->maxAACLine = min(sce->ics1.swb_offset[max(sce->ics1.max_sfb-1, 0)], sce->ics1.swb_offset_max); /* check if any of the PS tools is used */ #if (defined(PS_DEC) || defined(DRM_PS)) if (hDecoder->ps_used[ele] == 0) { #endif retval = sbrDecodeSingleFrame(hDecoder->sbr[ele], hDecoder->time_out[ch], hDecoder->postSeekResetFlag, hDecoder->downSampledSBR); #if (defined(PS_DEC) || defined(DRM_PS)) } else { retval = sbrDecodeSingleFramePS(hDecoder->sbr[ele], hDecoder->time_out[ch], hDecoder->time_out[ch+1], hDecoder->postSeekResetFlag, hDecoder->downSampledSBR); } #endif if (retval > 0) return retval; } else if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) && !hDecoder->sbr_alloced[hDecoder->fr_ch_ele]) { return 23; } #endif /* copy L to R when no PS is used */ #if (defined(PS_DEC) || defined(DRM_PS)) if ((hDecoder->ps_used[hDecoder->fr_ch_ele] == 0) && (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 2)) { int ele = hDecoder->fr_ch_ele; int ch = sce->channel; int frame_size = (hDecoder->sbr_alloced[ele]) ? 2 : 1; frame_size *= hDecoder->frameLength*sizeof(real_t); memcpy(hDecoder->time_out[ch+1], hDecoder->time_out[ch], frame_size); } #endif return 0; } uint8_t reconstruct_channel_pair(NeAACDecStruct *hDecoder, ic_stream *ics1, ic_stream *ics2, element *cpe, int16_t *spec_data1, int16_t *spec_data2) { uint8_t retval; ALIGN real_t spec_coef1[1024]; ALIGN real_t spec_coef2[1024]; #ifdef PROFILE int64_t count = faad_get_ts(); #endif if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0) { retval = allocate_channel_pair(hDecoder, cpe->channel, (uint8_t)cpe->paired_channel); if (retval > 0) return retval; hDecoder->element_alloced[hDecoder->fr_ch_ele] = 1; } /* dequantisation and scaling */ retval = quant_to_spec(hDecoder, ics1, spec_data1, spec_coef1, hDecoder->frameLength); if (retval > 0) return retval; retval = quant_to_spec(hDecoder, ics2, spec_data2, spec_coef2, hDecoder->frameLength); if (retval > 0) return retval; #ifdef PROFILE count = faad_get_ts() - count; hDecoder->requant_cycles += count; #endif /* pns decoding */ if (ics1->ms_mask_present) { pns_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength, 1, hDecoder->object_type, &(hDecoder->__r1), &(hDecoder->__r2)); } else { pns_decode(ics1, NULL, spec_coef1, NULL, hDecoder->frameLength, 0, hDecoder->object_type, &(hDecoder->__r1), &(hDecoder->__r2)); pns_decode(ics2, NULL, spec_coef2, NULL, hDecoder->frameLength, 0, hDecoder->object_type, &(hDecoder->__r1), &(hDecoder->__r2)); } /* mid/side decoding */ ms_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength); #if 0 { int i; for (i = 0; i < 1024; i++) { //printf("%d\n", spec_coef1[i]); printf("0x%.8X\n", spec_coef1[i]); } for (i = 0; i < 1024; i++) { //printf("%d\n", spec_coef2[i]); printf("0x%.8X\n", spec_coef2[i]); } } #endif /* intensity stereo decoding */ is_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength); #if 0 { int i; for (i = 0; i < 1024; i++) { printf("%d\n", spec_coef1[i]); //printf("0x%.8X\n", spec_coef1[i]); } for (i = 0; i < 1024; i++) { printf("%d\n", spec_coef2[i]); //printf("0x%.8X\n", spec_coef2[i]); } } #endif #ifdef MAIN_DEC /* MAIN object type prediction */ if (hDecoder->object_type == MAIN) { /* intra channel prediction */ ic_prediction(ics1, spec_coef1, hDecoder->pred_stat[cpe->channel], hDecoder->frameLength, hDecoder->sf_index); ic_prediction(ics2, spec_coef2, hDecoder->pred_stat[cpe->paired_channel], hDecoder->frameLength, hDecoder->sf_index); /* In addition, for scalefactor bands coded by perceptual noise substitution the predictors belonging to the corresponding spectral coefficients are reset. */ pns_reset_pred_state(ics1, hDecoder->pred_stat[cpe->channel]); pns_reset_pred_state(ics2, hDecoder->pred_stat[cpe->paired_channel]); } #endif #ifdef LTP_DEC if (is_ltp_ot(hDecoder->object_type)) { ltp_info *ltp1 = &(ics1->ltp); ltp_info *ltp2 = (cpe->common_window) ? &(ics2->ltp2) : &(ics2->ltp); #ifdef LD_DEC if (hDecoder->object_type == LD) { if (ltp1->data_present) { if (ltp1->lag_update) hDecoder->ltp_lag[cpe->channel] = ltp1->lag; } ltp1->lag = hDecoder->ltp_lag[cpe->channel]; if (ltp2->data_present) { if (ltp2->lag_update) hDecoder->ltp_lag[cpe->paired_channel] = ltp2->lag; } ltp2->lag = hDecoder->ltp_lag[cpe->paired_channel]; } #endif /* long term prediction */ lt_prediction(ics1, ltp1, spec_coef1, hDecoder->lt_pred_stat[cpe->channel], hDecoder->fb, ics1->window_shape, hDecoder->window_shape_prev[cpe->channel], hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength); lt_prediction(ics2, ltp2, spec_coef2, hDecoder->lt_pred_stat[cpe->paired_channel], hDecoder->fb, ics2->window_shape, hDecoder->window_shape_prev[cpe->paired_channel], hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength); } #endif /* tns decoding */ tns_decode_frame(ics1, &(ics1->tns), hDecoder->sf_index, hDecoder->object_type, spec_coef1, hDecoder->frameLength); tns_decode_frame(ics2, &(ics2->tns), hDecoder->sf_index, hDecoder->object_type, spec_coef2, hDecoder->frameLength); /* drc decoding */ if (hDecoder->drc->present) { if (!hDecoder->drc->exclude_mask[cpe->channel] || !hDecoder->drc->excluded_chns_present) drc_decode(hDecoder->drc, spec_coef1); if (!hDecoder->drc->exclude_mask[cpe->paired_channel] || !hDecoder->drc->excluded_chns_present) drc_decode(hDecoder->drc, spec_coef2); } /* filter bank */ #ifdef SSR_DEC if (hDecoder->object_type != SSR) { #endif ifilter_bank(hDecoder->fb, ics1->window_sequence, ics1->window_shape, hDecoder->window_shape_prev[cpe->channel], spec_coef1, hDecoder->time_out[cpe->channel], hDecoder->fb_intermed[cpe->channel], hDecoder->object_type, hDecoder->frameLength); ifilter_bank(hDecoder->fb, ics2->window_sequence, ics2->window_shape, hDecoder->window_shape_prev[cpe->paired_channel], spec_coef2, hDecoder->time_out[cpe->paired_channel], hDecoder->fb_intermed[cpe->paired_channel], hDecoder->object_type, hDecoder->frameLength); #ifdef SSR_DEC } else { ssr_decode(&(ics1->ssr), hDecoder->fb, ics1->window_sequence, ics1->window_shape, hDecoder->window_shape_prev[cpe->channel], spec_coef1, hDecoder->time_out[cpe->channel], hDecoder->ssr_overlap[cpe->channel], hDecoder->ipqf_buffer[cpe->channel], hDecoder->prev_fmd[cpe->channel], hDecoder->frameLength); ssr_decode(&(ics2->ssr), hDecoder->fb, ics2->window_sequence, ics2->window_shape, hDecoder->window_shape_prev[cpe->paired_channel], spec_coef2, hDecoder->time_out[cpe->paired_channel], hDecoder->ssr_overlap[cpe->paired_channel], hDecoder->ipqf_buffer[cpe->paired_channel], hDecoder->prev_fmd[cpe->paired_channel], hDecoder->frameLength); } #endif /* save window shape for next frame */ hDecoder->window_shape_prev[cpe->channel] = ics1->window_shape; hDecoder->window_shape_prev[cpe->paired_channel] = ics2->window_shape; #ifdef LTP_DEC if (is_ltp_ot(hDecoder->object_type)) { lt_update_state(hDecoder->lt_pred_stat[cpe->channel], hDecoder->time_out[cpe->channel], hDecoder->fb_intermed[cpe->channel], hDecoder->frameLength, hDecoder->object_type); lt_update_state(hDecoder->lt_pred_stat[cpe->paired_channel], hDecoder->time_out[cpe->paired_channel], hDecoder->fb_intermed[cpe->paired_channel], hDecoder->frameLength, hDecoder->object_type); } #endif #ifdef SBR_DEC if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) && hDecoder->sbr_alloced[hDecoder->fr_ch_ele]) { int ele = hDecoder->fr_ch_ele; int ch0 = cpe->channel; int ch1 = cpe->paired_channel; /* following case can happen when forceUpSampling == 1 */ if (hDecoder->sbr[ele] == NULL) { hDecoder->sbr[ele] = sbrDecodeInit(hDecoder->frameLength, hDecoder->element_id[ele], 2*get_sample_rate(hDecoder->sf_index), hDecoder->downSampledSBR #ifdef DRM , 0 #endif ); } if (cpe->ics1.window_sequence == EIGHT_SHORT_SEQUENCE) hDecoder->sbr[ele]->maxAACLine = 8*min(cpe->ics1.swb_offset[max(cpe->ics1.max_sfb-1, 0)], cpe->ics1.swb_offset_max); else hDecoder->sbr[ele]->maxAACLine = min(cpe->ics1.swb_offset[max(cpe->ics1.max_sfb-1, 0)], cpe->ics1.swb_offset_max); retval = sbrDecodeCoupleFrame(hDecoder->sbr[ele], hDecoder->time_out[ch0], hDecoder->time_out[ch1], hDecoder->postSeekResetFlag, hDecoder->downSampledSBR); if (retval > 0) return retval; } else if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) && !hDecoder->sbr_alloced[hDecoder->fr_ch_ele]) { return 23; } #endif return 0; }
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/specrec.h
C/C++ Header
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: specrec.h,v 1.33 2009/01/26 23:51:15 menno Exp $ **/ #ifndef __SPECREC_H__ #define __SPECREC_H__ #ifdef __cplusplus extern "C" { #endif #include "syntax.h" uint8_t window_grouping_info(NeAACDecStruct *hDecoder, ic_stream *ics); uint8_t reconstruct_channel_pair(NeAACDecStruct *hDecoder, ic_stream *ics1, ic_stream *ics2, element *cpe, int16_t *spec_data1, int16_t *spec_data2); uint8_t reconstruct_single_channel(NeAACDecStruct *hDecoder, ic_stream *ics, element *sce, int16_t *spec_data); #ifdef __cplusplus } #endif #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/ssr.c
C
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: ssr.c,v 1.19 2007/11/01 12:33:36 menno Exp $ **/ #include "common.h" #include "structs.h" #ifdef SSR_DEC #include "syntax.h" #include "filtbank.h" #include "ssr.h" #include "ssr_fb.h" void ssr_decode(ssr_info *ssr, fb_info *fb, uint8_t window_sequence, uint8_t window_shape, uint8_t window_shape_prev, real_t *freq_in, real_t *time_out, real_t *overlap, real_t ipqf_buffer[SSR_BANDS][96/4], real_t *prev_fmd, uint16_t frame_len) { uint8_t band; uint16_t ssr_frame_len = frame_len/SSR_BANDS; real_t time_tmp[2048] = {0}; real_t output[1024] = {0}; for (band = 0; band < SSR_BANDS; band++) { int16_t j; /* uneven bands have inverted frequency scale */ if (band == 1 || band == 3) { for (j = 0; j < ssr_frame_len/2; j++) { real_t tmp; tmp = freq_in[j + ssr_frame_len*band]; freq_in[j + ssr_frame_len*band] = freq_in[ssr_frame_len - j - 1 + ssr_frame_len*band]; freq_in[ssr_frame_len - j - 1 + ssr_frame_len*band] = tmp; } } /* non-overlapping inverse filterbank for SSR */ ssr_ifilter_bank(fb, window_sequence, window_shape, window_shape_prev, freq_in + band*ssr_frame_len, time_tmp + band*ssr_frame_len, ssr_frame_len); /* gain control */ ssr_gain_control(ssr, time_tmp, output, overlap, prev_fmd, band, window_sequence, ssr_frame_len); } /* inverse pqf to bring subbands together again */ ssr_ipqf(ssr, output, time_out, ipqf_buffer, frame_len, SSR_BANDS); } static void ssr_gain_control(ssr_info *ssr, real_t *data, real_t *output, real_t *overlap, real_t *prev_fmd, uint8_t band, uint8_t window_sequence, uint16_t frame_len) { uint16_t i; real_t gc_function[2*1024/SSR_BANDS]; if (window_sequence != EIGHT_SHORT_SEQUENCE) { ssr_gc_function(ssr, &prev_fmd[band * frame_len*2], gc_function, window_sequence, band, frame_len); for (i = 0; i < frame_len*2; i++) data[band * frame_len*2 + i] *= gc_function[i]; for (i = 0; i < frame_len; i++) { output[band*frame_len + i] = overlap[band*frame_len + i] + data[band*frame_len*2 + i]; } for (i = 0; i < frame_len; i++) { overlap[band*frame_len + i] = data[band*frame_len*2 + frame_len + i]; } } else { uint8_t w; for (w = 0; w < 8; w++) { uint16_t frame_len8 = frame_len/8; uint16_t frame_len16 = frame_len/16; ssr_gc_function(ssr, &prev_fmd[band*frame_len*2 + w*frame_len*2/8], gc_function, window_sequence, frame_len); for (i = 0; i < frame_len8*2; i++) data[band*frame_len*2 + w*frame_len8*2+i] *= gc_function[i]; for (i = 0; i < frame_len8; i++) { overlap[band*frame_len + i + 7*frame_len16 + w*frame_len8] += data[band*frame_len*2 + 2*w*frame_len8 + i]; } for (i = 0; i < frame_len8; i++) { overlap[band*frame_len + i + 7*frame_len16 + (w+1)*frame_len8] = data[band*frame_len*2 + 2*w*frame_len8 + frame_len8 + i]; } } for (i = 0; i < frame_len; i++) output[band*frame_len + i] = overlap[band*frame_len + i]; for (i = 0; i < frame_len; i++) overlap[band*frame_len + i] = overlap[band*frame_len + i + frame_len]; } } static void ssr_gc_function(ssr_info *ssr, real_t *prev_fmd, real_t *gc_function, uint8_t window_sequence, uint8_t band, uint16_t frame_len) { uint16_t i; uint16_t len_area1, len_area2; int32_t aloc[10]; real_t alev[10]; switch (window_sequence) { case ONLY_LONG_SEQUENCE: len_area1 = frame_len/SSR_BANDS; len_area2 = 0; break; case LONG_START_SEQUENCE: len_area1 = (frame_len/SSR_BANDS)*7/32; len_area2 = (frame_len/SSR_BANDS)/16; break; case EIGHT_SHORT_SEQUENCE: len_area1 = (frame_len/8)/SSR_BANDS; len_area2 = 0; break; case LONG_STOP_SEQUENCE: len_area1 = (frame_len/SSR_BANDS); len_area2 = 0; break; } /* decode bitstream information */ /* build array M */ for (i = 0; i < frame_len*2; i++) gc_function[i] = 1; } #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/ssr.h
C/C++ Header
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: ssr.h,v 1.19 2007/11/01 12:33:36 menno Exp $ **/ #ifndef __SSR_H__ #define __SSR_H__ #ifdef __cplusplus extern "C" { #endif #define SSR_BANDS 4 #define PQFTAPS 96 void ssr_decode(ssr_info *ssr, fb_info *fb, uint8_t window_sequence, uint8_t window_shape, uint8_t window_shape_prev, real_t *freq_in, real_t *time_out, real_t *overlap, real_t ipqf_buffer[SSR_BANDS][96/4], real_t *prev_fmd, uint16_t frame_len); static void ssr_gain_control(ssr_info *ssr, real_t *data, real_t *output, real_t *overlap, real_t *prev_fmd, uint8_t band, uint8_t window_sequence, uint16_t frame_len); static void ssr_gc_function(ssr_info *ssr, real_t *prev_fmd, real_t *gc_function, uint8_t window_sequence, uint16_t frame_len); #ifdef __cplusplus } #endif #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/ssr_fb.c
C
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: ssr_fb.c,v 1.17 2007/11/01 12:33:36 menno Exp $ **/ #include "common.h" #include "structs.h" #ifdef SSR_DEC #include <string.h> #include <stdlib.h> #include "syntax.h" #include "filtbank.h" #include "mdct.h" #include "ssr_fb.h" #include "ssr_win.h" fb_info *ssr_filter_bank_init(uint16_t frame_len) { uint16_t nshort = frame_len/8; fb_info *fb = (fb_info*)faad_malloc(sizeof(fb_info)); memset(fb, 0, sizeof(fb_info)); /* normal */ fb->mdct256 = faad_mdct_init(2*nshort); fb->mdct2048 = faad_mdct_init(2*frame_len); fb->long_window[0] = sine_long_256; fb->short_window[0] = sine_short_32; fb->long_window[1] = kbd_long_256; fb->short_window[1] = kbd_short_32; return fb; } void ssr_filter_bank_end(fb_info *fb) { faad_mdct_end(fb->mdct256); faad_mdct_end(fb->mdct2048); if (fb) faad_free(fb); } static INLINE void imdct_ssr(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len) { mdct_info *mdct; switch (len) { case 512: mdct = fb->mdct2048; break; case 64: mdct = fb->mdct256; break; } faad_imdct(mdct, in_data, out_data); } /* NON-overlapping inverse filterbank for use with SSR */ void ssr_ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, uint8_t window_shape_prev, real_t *freq_in, real_t *time_out, uint16_t frame_len) { int16_t i; real_t *transf_buf; real_t *window_long; real_t *window_long_prev; real_t *window_short; real_t *window_short_prev; uint16_t nlong = frame_len; uint16_t nshort = frame_len/8; uint16_t trans = nshort/2; uint16_t nflat_ls = (nlong-nshort)/2; transf_buf = (real_t*)faad_malloc(2*nlong*sizeof(real_t)); window_long = fb->long_window[window_shape]; window_long_prev = fb->long_window[window_shape_prev]; window_short = fb->short_window[window_shape]; window_short_prev = fb->short_window[window_shape_prev]; switch (window_sequence) { case ONLY_LONG_SEQUENCE: imdct_ssr(fb, freq_in, transf_buf, 2*nlong); for (i = nlong-1; i >= 0; i--) { time_out[i] = MUL_R_C(transf_buf[i],window_long_prev[i]); time_out[nlong+i] = MUL_R_C(transf_buf[nlong+i],window_long[nlong-1-i]); } break; case LONG_START_SEQUENCE: imdct_ssr(fb, freq_in, transf_buf, 2*nlong); for (i = 0; i < nlong; i++) time_out[i] = MUL_R_C(transf_buf[i],window_long_prev[i]); for (i = 0; i < nflat_ls; i++) time_out[nlong+i] = transf_buf[nlong+i]; for (i = 0; i < nshort; i++) time_out[nlong+nflat_ls+i] = MUL_R_C(transf_buf[nlong+nflat_ls+i],window_short[nshort-i-1]); for (i = 0; i < nflat_ls; i++) time_out[nlong+nflat_ls+nshort+i] = 0; break; case EIGHT_SHORT_SEQUENCE: imdct_ssr(fb, freq_in+0*nshort, transf_buf+2*nshort*0, 2*nshort); imdct_ssr(fb, freq_in+1*nshort, transf_buf+2*nshort*1, 2*nshort); imdct_ssr(fb, freq_in+2*nshort, transf_buf+2*nshort*2, 2*nshort); imdct_ssr(fb, freq_in+3*nshort, transf_buf+2*nshort*3, 2*nshort); imdct_ssr(fb, freq_in+4*nshort, transf_buf+2*nshort*4, 2*nshort); imdct_ssr(fb, freq_in+5*nshort, transf_buf+2*nshort*5, 2*nshort); imdct_ssr(fb, freq_in+6*nshort, transf_buf+2*nshort*6, 2*nshort); imdct_ssr(fb, freq_in+7*nshort, transf_buf+2*nshort*7, 2*nshort); for(i = nshort-1; i >= 0; i--) { time_out[i+0*nshort] = MUL_R_C(transf_buf[nshort*0+i],window_short_prev[i]); time_out[i+1*nshort] = MUL_R_C(transf_buf[nshort*1+i],window_short[i]); time_out[i+2*nshort] = MUL_R_C(transf_buf[nshort*2+i],window_short_prev[i]); time_out[i+3*nshort] = MUL_R_C(transf_buf[nshort*3+i],window_short[i]); time_out[i+4*nshort] = MUL_R_C(transf_buf[nshort*4+i],window_short_prev[i]); time_out[i+5*nshort] = MUL_R_C(transf_buf[nshort*5+i],window_short[i]); time_out[i+6*nshort] = MUL_R_C(transf_buf[nshort*6+i],window_short_prev[i]); time_out[i+7*nshort] = MUL_R_C(transf_buf[nshort*7+i],window_short[i]); time_out[i+8*nshort] = MUL_R_C(transf_buf[nshort*8+i],window_short_prev[i]); time_out[i+9*nshort] = MUL_R_C(transf_buf[nshort*9+i],window_short[i]); time_out[i+10*nshort] = MUL_R_C(transf_buf[nshort*10+i],window_short_prev[i]); time_out[i+11*nshort] = MUL_R_C(transf_buf[nshort*11+i],window_short[i]); time_out[i+12*nshort] = MUL_R_C(transf_buf[nshort*12+i],window_short_prev[i]); time_out[i+13*nshort] = MUL_R_C(transf_buf[nshort*13+i],window_short[i]); time_out[i+14*nshort] = MUL_R_C(transf_buf[nshort*14+i],window_short_prev[i]); time_out[i+15*nshort] = MUL_R_C(transf_buf[nshort*15+i],window_short[i]); } break; case LONG_STOP_SEQUENCE: imdct_ssr(fb, freq_in, transf_buf, 2*nlong); for (i = 0; i < nflat_ls; i++) time_out[i] = 0; for (i = 0; i < nshort; i++) time_out[nflat_ls+i] = MUL_R_C(transf_buf[nflat_ls+i],window_short_prev[i]); for (i = 0; i < nflat_ls; i++) time_out[nflat_ls+nshort+i] = transf_buf[nflat_ls+nshort+i]; for (i = 0; i < nlong; i++) time_out[nlong+i] = MUL_R_C(transf_buf[nlong+i],window_long[nlong-1-i]); break; } faad_free(transf_buf); } #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/ssr_fb.h
C/C++ Header
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** ** $Id: ssr_fb.h,v 1.16 2007/11/01 12:33:36 menno Exp $ **/ #ifndef __SSR_FB_H__ #define __SSR_FB_H__ #ifdef __cplusplus extern "C" { #endif fb_info *ssr_filter_bank_init(uint16_t frame_len); void ssr_filter_bank_end(fb_info *fb); /*non overlapping inverse filterbank */ void ssr_ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, uint8_t window_shape_prev, real_t *freq_in, real_t *time_out, uint16_t frame_len); #ifdef __cplusplus } #endif #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/ssr_ipqf.c
C
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: ssr_ipqf.c,v 1.18 2007/11/01 12:33:39 menno Exp $ **/ #include "common.h" #include "structs.h" #ifdef SSR_DEC #include "ssr.h" #include "ssr_ipqf.h" static real_t **app_pqfbuf; static real_t **pp_q0, **pp_t0, **pp_t1; void gc_set_protopqf(real_t *p_proto) { int j; static real_t a_half[48] = { 1.2206911375946939E-05, 1.7261986723798209E-05, 1.2300093657077942E-05, -1.0833943097791965E-05, -5.7772498639901686E-05, -1.2764767618947719E-04, -2.0965186675013334E-04, -2.8166673689263850E-04, -3.1234860429017460E-04, -2.6738519958452353E-04, -1.1949424681824722E-04, 1.3965139412648678E-04, 4.8864136409185725E-04, 8.7044629275148344E-04, 1.1949430269934793E-03, 1.3519708175026700E-03, 1.2346314373964412E-03, 7.6953209114159191E-04, -5.2242432579537141E-05, -1.1516092887213454E-03, -2.3538469841711277E-03, -3.4033123072127277E-03, -4.0028551071986133E-03, -3.8745415659693259E-03, -2.8321073426874310E-03, -8.5038892323704195E-04, 1.8856751185350931E-03, 4.9688741735340923E-03, 7.8056704536795926E-03, 9.7027909685901654E-03, 9.9960423120166159E-03, 8.2019366335594487E-03, 4.1642072876103365E-03, -1.8364453822737758E-03, -9.0384863094167686E-03, -1.6241528177129844E-02, -2.1939551286300665E-02, -2.4533179947088161E-02, -2.2591663337768787E-02, -1.5122066420044672E-02, -1.7971713448186293E-03, 1.6903413428575379E-02, 3.9672315874127042E-02, 6.4487527248102796E-02, 8.8850025474701726E-02, 0.1101132906105560 , 0.1258540205143761 , 0.1342239368467012 }; for (j = 0; j < 48; ++j) { p_proto[j] = p_proto[95-j] = a_half[j]; } } void gc_setcoef_eff_pqfsyn(int mm, int kk, real_t *p_proto, real_t ***ppp_q0, real_t ***ppp_t0, real_t ***ppp_t1) { int i, k, n; real_t w; /* Set 1st Mul&Acc Coef's */ *ppp_q0 = (real_t **) calloc(mm, sizeof(real_t *)); for (n = 0; n < mm; ++n) { (*ppp_q0)[n] = (real_t *) calloc(mm, sizeof(real_t)); } for (n = 0; n < mm/2; ++n) { for (i = 0; i < mm; ++i) { w = (2*i+1)*(2*n+1-mm)*M_PI/(4*mm); (*ppp_q0)[n][i] = 2.0 * cos((real_t) w); w = (2*i+1)*(2*(mm+n)+1-mm)*M_PI/(4*mm); (*ppp_q0)[n + mm/2][i] = 2.0 * cos((real_t) w); } } /* Set 2nd Mul&Acc Coef's */ *ppp_t0 = (real_t **) calloc(mm, sizeof(real_t *)); *ppp_t1 = (real_t **) calloc(mm, sizeof(real_t *)); for (n = 0; n < mm; ++n) { (*ppp_t0)[n] = (real_t *) calloc(kk, sizeof(real_t)); (*ppp_t1)[n] = (real_t *) calloc(kk, sizeof(real_t)); } for (n = 0; n < mm; ++n) { for (k = 0; k < kk; ++k) { (*ppp_t0)[n][k] = mm * p_proto[2*k *mm + n]; (*ppp_t1)[n][k] = mm * p_proto[(2*k+1)*mm + n]; if (k%2 != 0) { (*ppp_t0)[n][k] = -(*ppp_t0)[n][k]; (*ppp_t1)[n][k] = -(*ppp_t1)[n][k]; } } } } void ssr_ipqf(ssr_info *ssr, real_t *in_data, real_t *out_data, real_t buffer[SSR_BANDS][96/4], uint16_t frame_len, uint8_t bands) { static int initFlag = 0; real_t a_pqfproto[PQFTAPS]; int i; if (initFlag == 0) { gc_set_protopqf(a_pqfproto); gc_setcoef_eff_pqfsyn(SSR_BANDS, PQFTAPS/(2*SSR_BANDS), a_pqfproto, &pp_q0, &pp_t0, &pp_t1); initFlag = 1; } for (i = 0; i < frame_len / SSR_BANDS; i++) { int l, n, k; int mm = SSR_BANDS; int kk = PQFTAPS/(2*SSR_BANDS); for (n = 0; n < mm; n++) { for (k = 0; k < 2*kk-1; k++) { buffer[n][k] = buffer[n][k+1]; } } for (n = 0; n < mm; n++) { real_t acc = 0.0; for (l = 0; l < mm; l++) { acc += pp_q0[n][l] * in_data[l*frame_len/SSR_BANDS + i]; } buffer[n][2*kk-1] = acc; } for (n = 0; n < mm/2; n++) { real_t acc = 0.0; for (k = 0; k < kk; k++) { acc += pp_t0[n][k] * buffer[n][2*kk-1-2*k]; } for (k = 0; k < kk; ++k) { acc += pp_t1[n][k] * buffer[n + mm/2][2*kk-2-2*k]; } out_data[i*SSR_BANDS + n] = acc; acc = 0.0; for (k = 0; k < kk; k++) { acc += pp_t0[mm-1-n][k] * buffer[n][2*kk-1-2*k]; } for (k = 0; k < kk; k++) { acc -= pp_t1[mm-1-n][k] * buffer[n + mm/2][2*kk-2-2*k]; } out_data[i*SSR_BANDS + mm-1-n] = acc; } } } #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/ssr_ipqf.h
C/C++ Header
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** ** $Id: ssr_ipqf.h,v 1.17 2007/11/01 12:33:39 menno Exp $ **/ #ifndef __SSR_IPQF_H__ #define __SSR_IPQF_H__ #ifdef __cplusplus extern "C" { #endif void ssr_ipqf(ssr_info *ssr, real_t *in_data, real_t *out_data, real_t buffer[SSR_BANDS][96/4], uint16_t frame_len, uint8_t bands); #ifdef __cplusplus } #endif #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/ssr_win.h
C/C++ Header
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** ** $Id: ssr_win.h,v 1.16 2007/11/01 12:33:39 menno Exp $ **/ #ifndef __SSR_WIN_H__ #define __SSR_WIN_H__ #ifdef __cplusplus extern "C" { #endif #ifdef _MSC_VER #pragma warning(disable:4305) #pragma warning(disable:4244) #endif static real_t sine_short_32[] = { 0.0245412290, 0.0735645667, 0.1224106774, 0.1709618866, 0.2191012502, 0.2667127550, 0.3136817515, 0.3598950505, 0.4052413106, 0.4496113360, 0.4928981960, 0.5349976420, 0.5758082271, 0.6152316332, 0.6531728506, 0.6895405650, 0.7242470980, 0.7572088838, 0.7883464694, 0.8175848126, 0.8448535800, 0.8700870275, 0.8932242990, 0.9142097831, 0.9329928160, 0.9495282173, 0.9637760520, 0.9757021666, 0.9852776527, 0.9924795628, 0.9972904325, 0.9996988177 }; static real_t sine_long_256[] = { 0.0030679568, 0.0092037553, 0.0153392069, 0.0214740802, 0.0276081469, 0.0337411724, 0.0398729295, 0.0460031852, 0.0521317050, 0.0582582653, 0.0643826351, 0.0705045760, 0.0766238645, 0.0827402696, 0.0888535529, 0.0949634984, 0.1010698676, 0.1071724296, 0.1132709533, 0.1193652153, 0.1254549921, 0.1315400302, 0.1376201212, 0.1436950415, 0.1497645378, 0.1558284014, 0.1618863940, 0.1679383069, 0.1739838719, 0.1800229102, 0.1860551536, 0.1920804083, 0.1980984211, 0.2041089684, 0.2101118416, 0.2161068022, 0.2220936269, 0.2280720919, 0.2340419590, 0.2400030345, 0.2459550500, 0.2518978119, 0.2578310966, 0.2637546957, 0.2696683407, 0.2755718231, 0.2814649343, 0.2873474658, 0.2932191789, 0.2990798354, 0.3049292266, 0.3107671738, 0.3165933788, 0.3224076927, 0.3282098472, 0.3339996636, 0.3397769034, 0.3455413282, 0.3512927592, 0.3570309579, 0.3627557456, 0.3684668541, 0.3741640747, 0.3798472285, 0.3855160773, 0.3911703825, 0.3968099952, 0.4024346471, 0.4080441594, 0.4136383235, 0.4192169011, 0.4247796834, 0.4303264916, 0.4358570874, 0.4413712919, 0.4468688369, 0.4523496032, 0.4578133225, 0.4632597864, 0.4686888456, 0.4741002321, 0.4794937670, 0.4848692715, 0.4902265072, 0.4955652654, 0.5008853674, 0.5061866641, 0.5114688873, 0.5167317986, 0.5219752789, 0.5271991491, 0.5324031115, 0.5375871062, 0.5427507758, 0.5478940606, 0.5530167222, 0.5581185222, 0.5631993413, 0.5682589412, 0.5732972026, 0.5783138275, 0.5833086967, 0.5882815719, 0.5932323337, 0.5981607437, 0.6030666232, 0.6079497933, 0.6128100753, 0.6176473498, 0.6224613190, 0.6272518039, 0.6320187449, 0.6367619038, 0.6414810419, 0.6461760402, 0.6508467197, 0.6554928422, 0.6601143479, 0.6647109985, 0.6692826152, 0.6738290191, 0.6783500314, 0.6828455329, 0.6873153448, 0.6917592883, 0.6961771250, 0.7005687952, 0.7049341202, 0.7092728615, 0.7135848999, 0.7178700566, 0.7221282125, 0.7263591886, 0.7305628061, 0.7347388864, 0.7388873696, 0.7430079579, 0.7471006513, 0.7511651516, 0.7552013993, 0.7592092156, 0.7631884217, 0.7671388984, 0.7710605264, 0.7749531269, 0.7788165212, 0.7826505899, 0.7864552140, 0.7902302146, 0.7939754725, 0.7976908684, 0.8013761640, 0.8050313592, 0.8086562157, 0.8122506142, 0.8158144355, 0.8193475604, 0.8228498101, 0.8263210654, 0.8297612667, 0.8331701756, 0.8365477324, 0.8398938179, 0.8432082534, 0.8464909792, 0.8497417569, 0.8529606462, 0.8561473489, 0.8593018055, 0.8624239564, 0.8655136228, 0.8685707450, 0.8715950847, 0.8745866418, 0.8775452971, 0.8804709315, 0.8833633661, 0.8862225413, 0.8890483975, 0.8918406963, 0.8945994973, 0.8973246217, 0.9000158906, 0.9026733041, 0.9052967429, 0.9078861475, 0.9104412794, 0.9129621983, 0.9154487252, 0.9179008007, 0.9203183055, 0.9227011204, 0.9250492454, 0.9273625612, 0.9296408892, 0.9318842888, 0.9340925813, 0.9362657070, 0.9384035468, 0.9405061007, 0.9425731897, 0.9446048737, 0.9466009140, 0.9485613704, 0.9504860640, 0.9523749948, 0.9542281032, 0.9560452700, 0.9578264356, 0.9595715404, 0.9612805247, 0.9629532695, 0.9645897746, 0.9661900401, 0.9677538276, 0.9692812562, 0.9707721472, 0.9722265005, 0.9736442566, 0.9750253558, 0.9763697386, 0.9776773453, 0.9789481759, 0.9801821709, 0.9813792109, 0.9825392962, 0.9836624265, 0.9847484827, 0.9857975245, 0.9868094325, 0.9877841473, 0.9887216687, 0.9896219969, 0.9904850721, 0.9913108945, 0.9920993447, 0.9928504229, 0.9935641289, 0.9942404628, 0.9948793054, 0.9954807758, 0.9960446954, 0.9965711236, 0.9970600605, 0.9975114465, 0.9979252815, 0.9983015656, 0.9986402392, 0.9989413023, 0.9992047548, 0.9994305968, 0.9996188283, 0.9997693896, 0.9998823404, 0.9999576211, 0.9999952912 }; static real_t kbd_short_32[] = { 0.0000875914060105, 0.0009321760265333, 0.0032114611466596, 0.0081009893216786, 0.0171240286619181, 0.0320720743527833, 0.0548307856028528, 0.0871361822564870, 0.1302923415174603, 0.1848955425508276, 0.2506163195331889, 0.3260874142923209, 0.4089316830907141, 0.4959414909423747, 0.5833939894958904, 0.6674601983218376, 0.7446454751465113, 0.8121892962974020, 0.8683559394406505, 0.9125649996381605, 0.9453396205809574, 0.9680864942677585, 0.9827581789763112, 0.9914756203467121, 0.9961964092194694, 0.9984956609571091, 0.9994855586984285, 0.9998533730714648, 0.9999671864476404, 0.9999948432453556, 0.9999995655238333, 0.9999999961638728 }; static real_t kbd_long_256[] = { 0.0005851230124487, 0.0009642149851497, 0.0013558207534965, 0.0017771849644394, 0.0022352533849672, 0.0027342299070304, 0.0032773001022195, 0.0038671998069216, 0.0045064443384152, 0.0051974336885144, 0.0059425050016407, 0.0067439602523141, 0.0076040812644888, 0.0085251378135895, 0.0095093917383048, 0.0105590986429280, 0.0116765080854300, 0.0128638627792770, 0.0141233971318631, 0.0154573353235409, 0.0168678890600951, 0.0183572550877256, 0.0199276125319803, 0.0215811201042484, 0.0233199132076965, 0.0251461009666641, 0.0270617631981826, 0.0290689473405856, 0.0311696653515848, 0.0333658905863535, 0.0356595546648444, 0.0380525443366107, 0.0405466983507029, 0.0431438043376910, 0.0458455957104702, 0.0486537485902075, 0.0515698787635492, 0.0545955386770205, 0.0577322144743916, 0.0609813230826460, 0.0643442093520723, 0.0678221432558827, 0.0714163171546603, 0.0751278431308314, 0.0789577503982528, 0.0829069827918993, 0.0869763963425241, 0.0911667569410503, 0.0954787380973307, 0.0999129187977865, 0.1044697814663005, 0.1091497100326053, 0.1139529881122542, 0.1188797973021148, 0.1239302155951605, 0.1291042159181728, 0.1344016647957880, 0.1398223211441467, 0.1453658351972151, 0.1510317475686540, 0.1568194884519144, 0.1627283769610327, 0.1687576206143887, 0.1749063149634756, 0.1811734433685097, 0.1875578769224857, 0.1940583745250518, 0.2006735831073503, 0.2074020380087318, 0.2142421635060113, 0.2211922734956977, 0.2282505723293797, 0.2354151558022098, 0.2426840122941792, 0.2500550240636293, 0.2575259686921987, 0.2650945206801527, 0.2727582531907993, 0.2805146399424422, 0.2883610572460804, 0.2962947861868143, 0.3043130149466800, 0.3124128412663888, 0.3205912750432127, 0.3288452410620226, 0.3371715818562547, 0.3455670606953511, 0.3540283646950029, 0.3625521080463003, 0.3711348353596863, 0.3797730251194006, 0.3884630932439016, 0.3972013967475546, 0.4059842374986933, 0.4148078660689724, 0.4236684856687616, 0.4325622561631607, 0.4414852981630577, 0.4504336971855032, 0.4594035078775303, 0.4683907582974173, 0.4773914542472655, 0.4864015836506502, 0.4954171209689973, 0.5044340316502417, 0.5134482766032377, 0.5224558166913167, 0.5314526172383208, 0.5404346525403849, 0.5493979103766972, 0.5583383965124314, 0.5672521391870222, 0.5761351935809411, 0.5849836462541291, 0.5937936195492526, 0.6025612759529649, 0.6112828224083939, 0.6199545145721097, 0.6285726610088878, 0.6371336273176413, 0.6456338401819751, 0.6540697913388968, 0.6624380414593221, 0.6707352239341151, 0.6789580485595255, 0.6871033051160131, 0.6951678668345944, 0.7031486937449871, 0.7110428359000029, 0.7188474364707993, 0.7265597347077880, 0.7341770687621900, 0.7416968783634273, 0.7491167073477523, 0.7564342060337386, 0.7636471334404891, 0.7707533593446514, 0.7777508661725849, 0.7846377507242818, 0.7914122257259034, 0.7980726212080798, 0.8046173857073919, 0.8110450872887550, 0.8173544143867162, 0.8235441764639875, 0.8296133044858474, 0.8355608512093652, 0.8413859912867303, 0.8470880211822968, 0.8526663589032990, 0.8581205435445334, 0.8634502346476508, 0.8686552113760616, 0.8737353715068081, 0.8786907302411250, 0.8835214188357692, 0.8882276830575707, 0.8928098814640207, 0.8972684835130879, 0.9016040675058185, 0.9058173183656508, 0.9099090252587376, 0.9138800790599416, 0.9177314696695282, 0.9214642831859411, 0.9250796989403991, 0.9285789863994010, 0.9319635019415643, 0.9352346855155568, 0.9383940571861993, 0.9414432135761304, 0.9443838242107182, 0.9472176277741918, 0.9499464282852282, 0.9525720912004834, 0.9550965394547873, 0.9575217494469370, 0.9598497469802043, 0.9620826031668507, 0.9642224303060783, 0.9662713777449607, 0.9682316277319895, 0.9701053912729269, 0.9718949039986892, 0.9736024220549734, 0.9752302180233160, 0.9767805768831932, 0.9782557920246753, 0.9796581613210076, 0.9809899832703159, 0.9822535532154261, 0.9834511596505429, 0.9845850806232530, 0.9856575802399989, 0.9866709052828243, 0.9876272819448033, 0.9885289126911557, 0.9893779732525968, 0.9901766097569984, 0.9909269360049311, 0.9916310308941294, 0.9922909359973702, 0.9929086532976777, 0.9934861430841844, 0.9940253220113651, 0.9945280613237534, 0.9949961852476154, 0.9954314695504363, 0.9958356402684387, 0.9962103726017252, 0.9965572899760172, 0.9968779632693499, 0.9971739102014799, 0.9974465948831872, 0.9976974275220812, 0.9979277642809907, 0.9981389072844972, 0.9983321047686901, 0.9985085513687731, 0.9986693885387259, 0.9988157050968516, 0.9989485378906924, 0.9990688725744943, 0.9991776444921379, 0.9992757396582338, 0.9993639958299003, 0.9994432036616085, 0.9995141079353859, 0.9995774088586188, 0.9996337634216871, 0.9996837868076957, 0.9997280538466377, 0.9997671005064359, 0.9998014254134544, 0.9998314913952471, 0.9998577270385304, 0.9998805282555989, 0.9999002598526793, 0.9999172570940037, 0.9999318272557038, 0.9999442511639580, 0.9999547847121726, 0.9999636603523446, 0.9999710885561258, 0.9999772592414866, 0.9999823431612708, 0.9999864932503106, 0.9999898459281599, 0.9999925223548691, 0.9999946296375997, 0.9999962619864214, 0.9999975018180320, 0.9999984208055542, 0.9999990808746198, 0.9999995351446231, 0.9999998288155155 }; #ifdef __cplusplus } #endif #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/structs.h
C/C++ Header
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: structs.h,v 1.49 2009/01/26 23:51:15 menno Exp $ **/ #ifndef __STRUCTS_H__ #define __STRUCTS_H__ #ifdef __cplusplus extern "C" { #endif #include "cfft.h" #ifdef SBR_DEC #include "sbr_dec.h" #endif #define MAX_CHANNELS 64 #define MAX_SYNTAX_ELEMENTS 48 #define MAX_WINDOW_GROUPS 8 #define MAX_SFB 51 #define MAX_LTP_SFB 40 #define MAX_LTP_SFB_S 8 /* used to save the prediction state */ typedef struct { int16_t r[2]; int16_t COR[2]; int16_t VAR[2]; } pred_state; typedef struct { uint16_t N; cfft_info *cfft; complex_t *sincos; #ifdef PROFILE int64_t cycles; int64_t fft_cycles; #endif } mdct_info; typedef struct { const real_t *long_window[2]; const real_t *short_window[2]; #ifdef LD_DEC const real_t *ld_window[2]; #endif mdct_info *mdct256; #ifdef LD_DEC mdct_info *mdct1024; #endif mdct_info *mdct2048; #ifdef PROFILE int64_t cycles; #endif } fb_info; typedef struct { uint8_t present; uint8_t num_bands; uint8_t pce_instance_tag; uint8_t excluded_chns_present; uint8_t band_top[17]; uint8_t prog_ref_level; uint8_t dyn_rng_sgn[17]; uint8_t dyn_rng_ctl[17]; uint8_t exclude_mask[MAX_CHANNELS]; uint8_t additional_excluded_chns[MAX_CHANNELS]; real_t ctrl1; real_t ctrl2; } drc_info; typedef struct { uint8_t element_instance_tag; uint8_t object_type; uint8_t sf_index; uint8_t num_front_channel_elements; uint8_t num_side_channel_elements; uint8_t num_back_channel_elements; uint8_t num_lfe_channel_elements; uint8_t num_assoc_data_elements; uint8_t num_valid_cc_elements; uint8_t mono_mixdown_present; uint8_t mono_mixdown_element_number; uint8_t stereo_mixdown_present; uint8_t stereo_mixdown_element_number; uint8_t matrix_mixdown_idx_present; uint8_t pseudo_surround_enable; uint8_t matrix_mixdown_idx; uint8_t front_element_is_cpe[16]; uint8_t front_element_tag_select[16]; uint8_t side_element_is_cpe[16]; uint8_t side_element_tag_select[16]; uint8_t back_element_is_cpe[16]; uint8_t back_element_tag_select[16]; uint8_t lfe_element_tag_select[16]; uint8_t assoc_data_element_tag_select[16]; uint8_t cc_element_is_ind_sw[16]; uint8_t valid_cc_element_tag_select[16]; uint8_t channels; uint8_t comment_field_bytes; uint8_t comment_field_data[257]; /* extra added values */ uint8_t num_front_channels; uint8_t num_side_channels; uint8_t num_back_channels; uint8_t num_lfe_channels; uint8_t sce_channel[16]; uint8_t cpe_channel[16]; } program_config; typedef struct { uint16_t syncword; uint8_t id; uint8_t layer; uint8_t protection_absent; uint8_t profile; uint8_t sf_index; uint8_t private_bit; uint8_t channel_configuration; uint8_t original; uint8_t home; uint8_t emphasis; uint8_t copyright_identification_bit; uint8_t copyright_identification_start; uint16_t aac_frame_length; uint16_t adts_buffer_fullness; uint8_t no_raw_data_blocks_in_frame; uint16_t crc_check; /* control param */ uint8_t old_format; } adts_header; typedef struct { uint8_t copyright_id_present; int8_t copyright_id[10]; uint8_t original_copy; uint8_t home; uint8_t bitstream_type; uint32_t bitrate; uint8_t num_program_config_elements; uint32_t adif_buffer_fullness; /* maximum of 16 PCEs */ program_config pce[16]; } adif_header; #ifdef LTP_DEC typedef struct { uint8_t last_band; uint8_t data_present; uint16_t lag; uint8_t lag_update; uint8_t coef; uint8_t long_used[MAX_SFB]; uint8_t short_used[8]; uint8_t short_lag_present[8]; uint8_t short_lag[8]; } ltp_info; #endif #ifdef MAIN_DEC typedef struct { uint8_t limit; uint8_t predictor_reset; uint8_t predictor_reset_group_number; uint8_t prediction_used[MAX_SFB]; } pred_info; #endif typedef struct { uint8_t number_pulse; uint8_t pulse_start_sfb; uint8_t pulse_offset[4]; uint8_t pulse_amp[4]; } pulse_info; typedef struct { uint8_t n_filt[8]; uint8_t coef_res[8]; uint8_t length[8][4]; uint8_t order[8][4]; uint8_t direction[8][4]; uint8_t coef_compress[8][4]; uint8_t coef[8][4][32]; } tns_info; #ifdef SSR_DEC typedef struct { uint8_t max_band; uint8_t adjust_num[4][8]; uint8_t alevcode[4][8][8]; uint8_t aloccode[4][8][8]; } ssr_info; #endif typedef struct { uint8_t max_sfb; uint8_t num_swb; uint8_t num_window_groups; uint8_t num_windows; uint8_t window_sequence; uint8_t window_group_length[8]; uint8_t window_shape; uint8_t scale_factor_grouping; uint16_t sect_sfb_offset[8][15*8]; uint16_t swb_offset[52]; uint16_t swb_offset_max; uint8_t sect_cb[8][15*8]; uint16_t sect_start[8][15*8]; uint16_t sect_end[8][15*8]; uint8_t sfb_cb[8][8*15]; uint8_t num_sec[8]; /* number of sections in a group */ uint8_t global_gain; int16_t scale_factors[8][51]; /* [0..255] */ uint8_t ms_mask_present; uint8_t ms_used[MAX_WINDOW_GROUPS][MAX_SFB]; uint8_t noise_used; uint8_t is_used; uint8_t pulse_data_present; uint8_t tns_data_present; uint8_t gain_control_data_present; uint8_t predictor_data_present; pulse_info pul; tns_info tns; #ifdef MAIN_DEC pred_info pred; #endif #ifdef LTP_DEC ltp_info ltp; ltp_info ltp2; #endif #ifdef SSR_DEC ssr_info ssr; #endif #ifdef ERROR_RESILIENCE /* ER HCR data */ uint16_t length_of_reordered_spectral_data; uint8_t length_of_longest_codeword; /* ER RLVC data */ uint8_t sf_concealment; uint8_t rev_global_gain; uint16_t length_of_rvlc_sf; uint16_t dpcm_noise_nrg; uint8_t sf_escapes_present; uint8_t length_of_rvlc_escapes; uint16_t dpcm_noise_last_position; #endif } ic_stream; /* individual channel stream */ typedef struct { uint8_t channel; int16_t paired_channel; uint8_t element_instance_tag; uint8_t common_window; ic_stream ics1; ic_stream ics2; } element; /* syntax element (SCE, CPE, LFE) */ #define MAX_ASC_BYTES 64 typedef struct { int inited; int version, versionA; int framelen_type; int useSameStreamMux; int allStreamsSameTimeFraming; int numSubFrames; int numPrograms; int numLayers; int otherDataPresent; uint32_t otherDataLenBits; uint32_t frameLength; uint8_t ASC[MAX_ASC_BYTES]; uint32_t ASCbits; } latm_header; typedef struct { uint8_t adts_header_present; uint8_t adif_header_present; uint8_t latm_header_present; uint8_t sf_index; uint8_t object_type; uint8_t channelConfiguration; #ifdef ERROR_RESILIENCE uint8_t aacSectionDataResilienceFlag; uint8_t aacScalefactorDataResilienceFlag; uint8_t aacSpectralDataResilienceFlag; #endif uint16_t frameLength; uint8_t postSeekResetFlag; uint32_t frame; uint8_t downMatrix; uint8_t upMatrix; uint8_t first_syn_ele; uint8_t has_lfe; /* number of channels in current frame */ uint8_t fr_channels; /* number of elements in current frame */ uint8_t fr_ch_ele; /* element_output_channels: determines the number of channels the element will output */ uint8_t element_output_channels[MAX_SYNTAX_ELEMENTS]; /* element_alloced: determines whether the data needed for the element is allocated or not */ uint8_t element_alloced[MAX_SYNTAX_ELEMENTS]; /* alloced_channels: determines the number of channels where output data is allocated for */ uint8_t alloced_channels; /* output data buffer */ void *sample_buffer; uint8_t window_shape_prev[MAX_CHANNELS]; #ifdef LTP_DEC uint16_t ltp_lag[MAX_CHANNELS]; #endif fb_info *fb; drc_info *drc; real_t *time_out[MAX_CHANNELS]; real_t *fb_intermed[MAX_CHANNELS]; #ifdef SBR_DEC int8_t sbr_present_flag; int8_t forceUpSampling; int8_t downSampledSBR; /* determines whether SBR data is allocated for the gives element */ uint8_t sbr_alloced[MAX_SYNTAX_ELEMENTS]; sbr_info *sbr[MAX_SYNTAX_ELEMENTS]; #endif #if (defined(PS_DEC) || defined(DRM_PS)) uint8_t ps_used[MAX_SYNTAX_ELEMENTS]; uint8_t ps_used_global; #endif #ifdef SSR_DEC real_t *ssr_overlap[MAX_CHANNELS]; real_t *prev_fmd[MAX_CHANNELS]; real_t ipqf_buffer[MAX_CHANNELS][4][96/4]; #endif #ifdef MAIN_DEC pred_state *pred_stat[MAX_CHANNELS]; #endif #ifdef LTP_DEC int16_t *lt_pred_stat[MAX_CHANNELS]; #endif #ifdef DRM uint8_t error_state; #endif /* RNG states */ uint32_t __r1; uint32_t __r2; /* Program Config Element */ uint8_t pce_set; program_config pce; uint8_t element_id[MAX_CHANNELS]; uint8_t internal_channel[MAX_CHANNELS]; /* Configuration data */ NeAACDecConfiguration config; #ifdef PROFILE int64_t cycles; int64_t spectral_cycles; int64_t output_cycles; int64_t scalefac_cycles; int64_t requant_cycles; #endif latm_header latm_config; const unsigned char *cmes; } NeAACDecStruct; #ifdef __cplusplus } #endif #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/syntax.h
C/C++ Header
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: syntax.h,v 1.60 2009/01/26 23:51:17 menno Exp $ **/ #ifndef __SYNTAX_H__ #define __SYNTAX_H__ #ifdef __cplusplus extern "C" { #endif #include "bits.h" #define MAIN 1 #define LC 2 #define SSR 3 #define LTP 4 #define HE_AAC 5 #define LD 23 #define ER_LC 17 #define ER_LTP 19 #define DRM_ER_LC 27 /* special object type for DRM */ /* header types */ #define RAW 0 #define ADIF 1 #define ADTS 2 #define LATM 3 /* SBR signalling */ #define NO_SBR 0 #define SBR_UPSAMPLED 1 #define SBR_DOWNSAMPLED 2 #define NO_SBR_UPSAMPLED 3 /* DRM channel definitions */ #define DRMCH_MONO 1 #define DRMCH_STEREO 2 #define DRMCH_SBR_MONO 3 #define DRMCH_SBR_STEREO 4 #define DRMCH_SBR_PS_STEREO 5 /* First object type that has ER */ #define ER_OBJECT_START 17 /* Bitstream */ #define LEN_SE_ID 3 #define LEN_TAG 4 #define LEN_BYTE 8 #define EXT_FIL 0 #define EXT_FILL_DATA 1 #define EXT_DATA_ELEMENT 2 #define EXT_DYNAMIC_RANGE 11 #define ANC_DATA 0 /* Syntax elements */ #define ID_SCE 0x0 #define ID_CPE 0x1 #define ID_CCE 0x2 #define ID_LFE 0x3 #define ID_DSE 0x4 #define ID_PCE 0x5 #define ID_FIL 0x6 #define ID_END 0x7 #define ONLY_LONG_SEQUENCE 0x0 #define LONG_START_SEQUENCE 0x1 #define EIGHT_SHORT_SEQUENCE 0x2 #define LONG_STOP_SEQUENCE 0x3 #define ZERO_HCB 0 #define FIRST_PAIR_HCB 5 #define ESC_HCB 11 #define QUAD_LEN 4 #define PAIR_LEN 2 #define NOISE_HCB 13 #define INTENSITY_HCB2 14 #define INTENSITY_HCB 15 #define INVALID_SBR_ELEMENT 255 int8_t GASpecificConfig(bitfile *ld, mp4AudioSpecificConfig *mp4ASC, program_config *pce); uint8_t adts_frame(adts_header *adts, bitfile *ld); void get_adif_header(adif_header *adif, bitfile *ld); void raw_data_block(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, program_config *pce, drc_info *drc); uint8_t reordered_spectral_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *ld, int16_t *spectral_data); #ifdef DRM void DRM_aac_scalable_main_element(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, program_config *pce, drc_info *drc); #endif uint32_t faad_latm_frame(latm_header *latm, bitfile *ld); #ifdef __cplusplus } #endif #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/tns.c
C
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: tns.c,v 1.40 2007/11/01 12:33:40 menno Exp $ **/ #include "common.h" #include "structs.h" #include "syntax.h" #include "tns.h" /* static function declarations */ static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_compress, uint8_t *coef, real_t *a); static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc, uint8_t order); static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc, uint8_t order); #ifdef _MSC_VER #pragma warning(disable:4305) #pragma warning(disable:4244) #endif static real_t tns_coef_0_3[] = { COEF_CONST(0.0), COEF_CONST(0.4338837391), COEF_CONST(0.7818314825), COEF_CONST(0.9749279122), COEF_CONST(-0.9848077530), COEF_CONST(-0.8660254038), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433), COEF_CONST(-0.4338837391), COEF_CONST(-0.7818314825), COEF_CONST(-0.9749279122), COEF_CONST(-0.9749279122), COEF_CONST(-0.9848077530), COEF_CONST(-0.8660254038), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433) }; static real_t tns_coef_0_4[] = { COEF_CONST(0.0), COEF_CONST(0.2079116908), COEF_CONST(0.4067366431), COEF_CONST(0.5877852523), COEF_CONST(0.7431448255), COEF_CONST(0.8660254038), COEF_CONST(0.9510565163), COEF_CONST(0.9945218954), COEF_CONST(-0.9957341763), COEF_CONST(-0.9618256432), COEF_CONST(-0.8951632914), COEF_CONST(-0.7980172273), COEF_CONST(-0.6736956436), COEF_CONST(-0.5264321629), COEF_CONST(-0.3612416662), COEF_CONST(-0.1837495178) }; static real_t tns_coef_1_3[] = { COEF_CONST(0.0), COEF_CONST(0.4338837391), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433), COEF_CONST(0.9749279122), COEF_CONST(0.7818314825), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433), COEF_CONST(-0.4338837391), COEF_CONST(-0.7818314825), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433), COEF_CONST(-0.7818314825), COEF_CONST(-0.4338837391), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433) }; static real_t tns_coef_1_4[] = { COEF_CONST(0.0), COEF_CONST(0.2079116908), COEF_CONST(0.4067366431), COEF_CONST(0.5877852523), COEF_CONST(-0.6736956436), COEF_CONST(-0.5264321629), COEF_CONST(-0.3612416662), COEF_CONST(-0.1837495178), COEF_CONST(0.9945218954), COEF_CONST(0.9510565163), COEF_CONST(0.8660254038), COEF_CONST(0.7431448255), COEF_CONST(-0.6736956436), COEF_CONST(-0.5264321629), COEF_CONST(-0.3612416662), COEF_CONST(-0.1837495178) }; /* TNS decoding for one channel and frame */ void tns_decode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index, uint8_t object_type, real_t *spec, uint16_t frame_len) { uint8_t w, f, tns_order; int8_t inc; int16_t size; uint16_t bottom, top, start, end; uint16_t nshort = frame_len/8; real_t lpc[TNS_MAX_ORDER+1]; if (!ics->tns_data_present) return; for (w = 0; w < ics->num_windows; w++) { bottom = ics->num_swb; for (f = 0; f < tns->n_filt[w]; f++) { top = bottom; bottom = max(top - tns->length[w][f], 0); tns_order = min(tns->order[w][f], TNS_MAX_ORDER); if (!tns_order) continue; tns_decode_coef(tns_order, tns->coef_res[w]+3, tns->coef_compress[w][f], tns->coef[w][f], lpc); start = min(bottom, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE))); start = min(start, ics->max_sfb); start = min(ics->swb_offset[start], ics->swb_offset_max); end = min(top, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE))); end = min(end, ics->max_sfb); end = min(ics->swb_offset[end], ics->swb_offset_max); size = end - start; if (size <= 0) continue; if (tns->direction[w][f]) { inc = -1; start = end - 1; } else { inc = 1; } tns_ar_filter(&spec[(w*nshort)+start], size, inc, lpc, tns_order); } } } /* TNS encoding for one channel and frame */ void tns_encode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index, uint8_t object_type, real_t *spec, uint16_t frame_len) { uint8_t w, f, tns_order; int8_t inc; int16_t size; uint16_t bottom, top, start, end; uint16_t nshort = frame_len/8; real_t lpc[TNS_MAX_ORDER+1]; if (!ics->tns_data_present) return; for (w = 0; w < ics->num_windows; w++) { bottom = ics->num_swb; for (f = 0; f < tns->n_filt[w]; f++) { top = bottom; bottom = max(top - tns->length[w][f], 0); tns_order = min(tns->order[w][f], TNS_MAX_ORDER); if (!tns_order) continue; tns_decode_coef(tns_order, tns->coef_res[w]+3, tns->coef_compress[w][f], tns->coef[w][f], lpc); start = min(bottom, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE))); start = min(start, ics->max_sfb); start = min(ics->swb_offset[start], ics->swb_offset_max); end = min(top, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE))); end = min(end, ics->max_sfb); end = min(ics->swb_offset[end], ics->swb_offset_max); size = end - start; if (size <= 0) continue; if (tns->direction[w][f]) { inc = -1; start = end - 1; } else { inc = 1; } tns_ma_filter(&spec[(w*nshort)+start], size, inc, lpc, tns_order); } } } /* Decoder transmitted coefficients for one TNS filter */ static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_compress, uint8_t *coef, real_t *a) { uint8_t i, m; real_t tmp2[TNS_MAX_ORDER+1], b[TNS_MAX_ORDER+1]; /* Conversion to signed integer */ for (i = 0; i < order; i++) { if (coef_compress == 0) { if (coef_res_bits == 3) { tmp2[i] = tns_coef_0_3[coef[i]]; } else { tmp2[i] = tns_coef_0_4[coef[i]]; } } else { if (coef_res_bits == 3) { tmp2[i] = tns_coef_1_3[coef[i]]; } else { tmp2[i] = tns_coef_1_4[coef[i]]; } } } /* Conversion to LPC coefficients */ a[0] = COEF_CONST(1.0); for (m = 1; m <= order; m++) { for (i = 1; i < m; i++) /* loop only while i<m */ b[i] = a[i] + MUL_C(tmp2[m-1], a[m-i]); for (i = 1; i < m; i++) /* loop only while i<m */ a[i] = b[i]; a[m] = tmp2[m-1]; /* changed */ } } static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc, uint8_t order) { /* - Simple all-pole filter of order "order" defined by y(n) = x(n) - lpc[1]*y(n-1) - ... - lpc[order]*y(n-order) - The state variables of the filter are initialized to zero every time - The output data is written over the input data ("in-place operation") - An input vector of "size" samples is processed and the index increment to the next data sample is given by "inc" */ uint8_t j; uint16_t i; real_t y; /* state is stored as a double ringbuffer */ real_t state[2*TNS_MAX_ORDER] = {0}; int8_t state_index = 0; for (i = 0; i < size; i++) { y = *spectrum; for (j = 0; j < order; j++) y -= MUL_C(state[state_index+j], lpc[j+1]); /* double ringbuffer state */ state_index--; if (state_index < 0) state_index = order-1; state[state_index] = state[state_index + order] = y; *spectrum = y; spectrum += inc; //#define TNS_PRINT #ifdef TNS_PRINT //printf("%d\n", y); printf("0x%.8X\n", y); #endif } } static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc, uint8_t order) { /* - Simple all-zero filter of order "order" defined by y(n) = x(n) + a(2)*x(n-1) + ... + a(order+1)*x(n-order) - The state variables of the filter are initialized to zero every time - The output data is written over the input data ("in-place operation") - An input vector of "size" samples is processed and the index increment to the next data sample is given by "inc" */ uint8_t j; uint16_t i; real_t y; /* state is stored as a double ringbuffer */ real_t state[2*TNS_MAX_ORDER] = {0}; int8_t state_index = 0; for (i = 0; i < size; i++) { y = *spectrum; for (j = 0; j < order; j++) y += MUL_C(state[state_index+j], lpc[j+1]); /* double ringbuffer state */ state_index--; if (state_index < 0) state_index = order-1; state[state_index] = state[state_index + order] = *spectrum; *spectrum = y; spectrum += inc; } }
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/libFaad/tns.h
C/C++ Header
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. ** ** $Id: tns.h,v 1.23 2007/11/01 12:33:41 menno Exp $ **/ #ifndef __TNS_H__ #define __TNS_H__ #ifdef __cplusplus extern "C" { #endif #define TNS_MAX_ORDER 20 void tns_decode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index, uint8_t object_type, real_t *spec, uint16_t frame_len); void tns_encode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index, uint8_t object_type, real_t *spec, uint16_t frame_len); #ifdef __cplusplus } #endif #endif
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
src/test_player.cpp
C++
/* * MIT License * * Copyright (c) 2017 xiongziliang <771730766@qq.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include "MediaPlayer/MediaPlayerWrapper.h" #if defined(_WIN32) #include <windows.h> #include <tchar.h> LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); //¥∞ø⁄∫Ø ˝Àµ√˜ //------------ ≥ı ºªØ¥∞ø⁄¿‡---------------- int WINAPI WinMain(HINSTANCE hInstance, //WinMain∫Ø ˝Àµ√˜ HINSTANCE hPrevInst, LPSTR lpszCmdLine, int nCmdShow){ HWND hwnd; MSG Msg; WNDCLASS wndclass; TCHAR lpszClassName[] = _T("¥∞ø⁄"); //¥∞ø⁄¿‡√˚ TCHAR lpszTitle[] = _T("My_Windows"); //¥∞ø⁄±ÍÂ√˚ //¥∞ø⁄¿‡µƒ∂®“ wndclass.style = 0; //¥∞ø⁄¿‡–ÕŒ™»± °¿‡–Õ wndclass.lpfnWndProc = WndProc; //¥∞ø⁄¥¶¿Ì∫Ø ˝Œ™WndProc wndclass.cbClsExtra = 0; //¥∞ø⁄¿‡Œfi¿©’π wndclass.cbWndExtra = 0; //¥∞ø⁄ µ¿˝Œfi¿©’π wndclass.hInstance = hInstance; //µ±«∞ µ¿˝æ‰±˙ wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION); //¥∞ø⁄µƒ◊Ó–°ªØÕº±ÍŒ™»± °Õº±Í wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); //¥∞ø⁄≤…”√º˝Õ∑π‚±Í wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); //¥∞ø⁄±≥æ∞Œ™∞◊…´ wndclass.lpszMenuName = NULL; //¥∞ø⁄÷–Œfi≤Àµ• wndclass.lpszClassName = lpszClassName; //¥∞ø⁄¿‡√˚Œ™"¥∞ø⁄ æ¿˝" //--------------- ¥∞ø⁄¿‡µƒ◊¢≤· ----------------- if (!RegisterClass(&wndclass)) //»Áπ˚◊¢≤· ß∞‹‘Ú∑¢≥ˆæØ∏Ê…˘“Ù { MessageBeep(0); return FALSE; } //¥¥Ω®¥∞ø⁄ hwnd = CreateWindow(lpszClassName, //¥∞ø⁄¿‡√˚ lpszTitle, //¥∞ø⁄ µ¿˝µƒ±ÍÂ√˚ WS_OVERLAPPEDWINDOW, //¥∞ø⁄µƒ∑Á∏Ò CW_USEDEFAULT, CW_USEDEFAULT, //¥∞ø⁄◊Û…œΩ«◊¯±ÍŒ™»± °÷µ CW_USEDEFAULT, CW_USEDEFAULT, //¥∞ø⁄µƒ∏fl∫ÕøÌŒ™»± °÷µ NULL, //¥À¥∞ø⁄Œfi∏∏¥∞ø⁄ NULL, //¥À¥∞ø⁄Œfi÷˜≤Àµ• hInstance, //¥¥Ω®¥À¥∞ø⁄µƒ”¶”√≥Öڵƒµ±«∞扱˙ NULL); //≤ª π”√∏√÷µ MediaPlayerWrapperHelper::globalInitialization(); MediaPlayerWrapperHelper::Instance().addDelegate("rtmp://live.hkstv.hk.lxdns.com/live/hks", new MediaPlayerWrapperDelegateImp(hwnd)); MediaPlayerWrapperHelper::Instance().getPlayer("rtmp://live.hkstv.hk.lxdns.com/live/hks")->setPauseAuto(false); /*MediaPlayerWrapper::Ptr player(new MediaPlayerWrapper()); player->setOption("rtp_type",1); player->setPauseAuto(true); player->addDelegate(new MediaPlayerWrapperDelegateImp(hwnd)); player->addDelegate(new MediaPlayerWrapperDelegateImp(hwnd1));*/ //player->play("rtmp://douyucdn.cn/live/260965rO4IFm4Mat"); //player->play("rtmp://live.hkstv.hk.lxdns.com/live/hks"); //player->play("rtmp://192.168.0.124/live/obs"); //player->play("rtsp://192.168.0.233/live/test0"); //player->play("rtsp://192.168.0.124/record/live/obs/2017-08-16/11-21-47.mp4"); //player->play("rtsp://admin:jzan123456@192.168.0.122/live/test0"); //œ‘ æ¥∞ø⁄ ShowWindow(hwnd, nCmdShow); //ªÊ÷∆”√ªß«¯ UpdateWindow(hwnd); //œ˚œ¢—≠ª∑ while (GetMessage(&Msg, NULL, 0, 0)){ TranslateMessage(&Msg); DispatchMessage(&Msg); //MediaPlayerWrapperHelper::Instance().getPlayer("rtsp://192.168.0.233/live/test0")->reDraw(); } MediaPlayerWrapperHelper::globalUninitialization(); return Msg.wParam; //œ˚œ¢—≠ª∑Ω· ¯º¥≥ÖÚ÷’÷π ±Ω´–≈œ¢∑µªÿœµÕ≥ } //¥∞ø⁄∫Ø ˝ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_DESTROY: PostQuitMessage(0); //µ˜”√PostQuitMessage∑¢≥ˆWM_QUITœ˚œ¢ default: //»± ° ±≤…”√œµÕ≥œ˚œ¢»± °¥¶¿Ì∫Ø ˝ return DefWindowProc(hwnd, message, wParam, lParam); } return (0); } #else #include <unistd.h> #include <signal.h> int main(int argc,char *argv[]){ //监听SIGINT信号,在按下 Ctrl + C后将调用stopSdlLoop方法通知runSdlLoop函数退出 signal(SIGINT, [](int) { MediaPlayerWrapperHelper::stopSdlLoop();}); //初始化基础网络库 MediaPlayerWrapperHelper::globalInitialization(); for(int i = 1 ;i < argc ; i++){ //添加播放器实例,你可以这么执行本程序: ./test_player rtmp://127.0.0.1/live/0 rtsp://127.0.0.1/live/0 ... MediaPlayerWrapperHelper::Instance().addDelegate(argv[i], new MediaPlayerWrapperDelegateImp(nullptr)); MediaPlayerWrapperHelper::Instance().getPlayer(argv[i])->setPauseAuto(false); } //执行sdl渲染循环线程,该操作将导致此线程阻塞 //在macOS Majove 系统下,sdl渲染线程必须在main函数中执行,否则会黑屏 //windows/linux系统下可以在后台线程执行runSdlLoop MediaPlayerWrapperHelper::runSdlLoop(); //释放基础网络库 MediaPlayerWrapperHelper::globalUninitialization(); } #endif //defined(_WIN32)
xia-chu/ZLMediaPlayer
45
一个简单的rtmp/rtsp播放器,支持windows/linux/macos
C
xia-chu
夏楚
.fatherrc.base.ts
TypeScript
import { defineConfig } from 'father'; export default defineConfig({ cjs: { output: 'dist', }, });
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
.inularc.ts
TypeScript
export default { plugins: ['@umijs/plugin-docs'], mfsu: false, conventionRoutes: { exclude: [/\/components\//], }, azure: false, styles: [`.py-36 { padding-bottom: 0rem !important; }`], // TODO: ??? 为什么 esbuild 压缩会报错??? jsMinifier: 'terser', };
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
docs/components/Item.tsx
TypeScript (TSX)
import React from 'react'; interface Feature { icon: string; title: string; description: string; link?: string; } export function FeatureIItem(props: Feature) { return ( <div className="w-full md:w-1/2 lg:w-1/3 flex flex-row items-center justify-center mb-8 lg:mb-16"> <div className="flex flex-col w-5/6 lg:w-3/4 items-center bg-white dark:bg-gray-800 py-12 px-6 justify-center border-gray-300 dark:border-gray-500 border transition-all hover:scale-105 rounded-xl shadow-lg hover:shadow-2xl h-72 lg:h-96 dark:shadow-gray-700" > <img src={props.icon} className="w-32 h-32" alt="feature-icon" /> <p className="text-3xl font-extrabold mb-4 text-gray-900 dark:text-gray-200" > {props.title} </p> <p className="text-center text-gray-600 text-sm lg:text-base dark:text-gray-400"> {props.description} </p> {props.link && ( <a href={props.link} target="_blank" rel="noreferrer" className="mt-4 link-with-underline" > 深入了解 </a> )} </div> </div> ); }
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/antd/.inularc.ts
TypeScript
import { defineConfig } from 'inula'; export default defineConfig({ title: 'antd', antd: {}, // TODO: ??? 为什么 esbuild 压缩会报错??? jsMinifier: 'terser', });
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/antd/src/pages/index.tsx
TypeScript (TSX)
import { Button } from 'antd'; const Page = () => { return ( <div> <Button>1243</Button> </div> ); }; export default Page;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/antd/typings.d.ts
TypeScript
import "inula/typings";
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/.inularc.ts
TypeScript
import { defineConfig } from 'inula'; export default defineConfig({ title: 'antd', antd: {}, // TODO: ??? 为什么 esbuild 压缩会报错??? jsMinifier: 'terser', });
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/plugin.ts
TypeScript
import { IApi } from 'inula'; export default (api: IApi) => { api?._modifyBlockFile?.((memo) => { // TODO: 还有什么操作,都可以在这里处理 return memo.replaceAll('request', 'ir'); }); };
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/app.ts
TypeScript
import { ir, IrRequestConfig } from 'inula'; // 定义成功处理函数 const fulfilledHandler = (response) => { // 修改响应内容 return response?.data?.data ?? response?.data; }; // 定义失败处理函数 const rejectedHandler = (error) => { console.error('请求失败:', error); return Promise.reject(error); }; // 定义拦截器选项 const options = { synchronous: true, // 选择同步执行拦截器,默认为异步执行 }; // 使用ir.interceptors.response.use方法 const interceptorId = ir.interceptors.response.use( fulfilledHandler, rejectedHandler, options, ); export const request: IrRequestConfig = { // TODO: 如果有些要加,有些不加怎么办? baseURL: '', headers: { inula: 'haha', }, };
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/abc/Center.style.ts
TypeScript
import { createStyles } from 'antd-style'; const useStyles = createStyles(({ token }) => { return { avatarHolder: { marginBottom: '24px', textAlign: 'center', '& > img': { width: '104px', height: '104px', marginBottom: '20px' }, }, name: { marginBottom: '4px', color: token.colorTextHeading, fontWeight: '500', fontSize: '20px', lineHeight: '28px', }, detail: { p: { position: 'relative', marginBottom: '8px', paddingLeft: '26px', '&:last-child': { marginBottom: '0', }, }, i: { position: 'absolute', top: '4px', left: '0', width: '14px', height: '14px', }, }, tagsTitle: { marginBottom: '12px', color: token.colorTextHeading, fontWeight: '500', }, teamTitle: { marginBottom: '12px', color: token.colorTextHeading, fontWeight: '500', }, tags: { '.ant-tag': { marginBottom: '8px' }, }, team: { '.ant-avatar': { marginRight: '12px' }, a: { display: 'block', marginBottom: '24px', overflow: 'hidden', color: token.colorText, whiteSpace: 'nowrap', textOverflow: 'ellipsis', wordBreak: 'break-all', transition: 'color 0.3s', '&:hover': { color: token.colorPrimary, }, }, }, tabsCard: { '.ant-card-head': { padding: '0 16px' }, }, }; }); export default useStyles;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/abc/_mock.ts
TypeScript
// @ts-nocheck import type { Request, Response } from 'express'; import type { ListItemDataType } from './data.d'; const titles = [ 'Alipay', 'Angular', 'Ant Design', 'Ant Design Pro', 'Bootstrap', 'React', 'Vue', 'Webpack', ]; const avatars = [ 'https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png', // Alipay 'https://gw.alipayobjects.com/zos/rmsportal/zOsKZmFRdUtvpqCImOVY.png', // Angular 'https://gw.alipayobjects.com/zos/rmsportal/dURIMkkrRFpPgTuzkwnB.png', // Ant Design 'https://gw.alipayobjects.com/zos/rmsportal/sfjbOqnsXXJgNCjCzDBL.png', // Ant Design Pro 'https://gw.alipayobjects.com/zos/rmsportal/siCrBXXhmvTQGWPNLBow.png', // Bootstrap 'https://gw.alipayobjects.com/zos/rmsportal/kZzEzemZyKLKFsojXItE.png', // React 'https://gw.alipayobjects.com/zos/rmsportal/ComBAopevLwENQdKWiIn.png', // Vue 'https://gw.alipayobjects.com/zos/rmsportal/nxkuOJlFJuAUhzlMTCEe.png', // Webpack ]; const covers = [ 'https://gw.alipayobjects.com/zos/rmsportal/uMfMFlvUuceEyPpotzlq.png', 'https://gw.alipayobjects.com/zos/rmsportal/iZBVOIhGJiAnhplqjvZW.png', 'https://gw.alipayobjects.com/zos/rmsportal/iXjVmWVHbCJAyqvDxdtx.png', 'https://gw.alipayobjects.com/zos/rmsportal/gLaIAoVWTtLbBWZNYEMg.png', ]; const desc = [ '那是一种内在的东西, 他们到达不了,也无法触及的', '希望是一个好东西,也许是最好的,好东西是不会消亡的', '生命就像一盒巧克力,结果往往出人意料', '城镇中有那么多的酒馆,她却偏偏走进了我的酒馆', '那时候我只会想自己想要什么,从不想自己拥有什么', ]; const user = [ '付小小', '曲丽丽', '林东东', '周星星', '吴加好', '朱偏右', '鱼酱', '乐哥', '谭小仪', '仲尼', ]; // 当前用户信息 const currentUseDetail = { name: 'Serati Ma', avatar: 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png', userid: '00000001', email: 'antdesign@alipay.com', signature: '海纳百川,有容乃大', title: '交互专家', group: '蚂蚁金服-某某某事业群-某某平台部-某某技术部-UED', tags: [ { key: '0', label: '很有想法的', }, { key: '1', label: '专注设计', }, { key: '2', label: '辣~', }, { key: '3', label: '大长腿', }, { key: '4', label: '川妹子', }, { key: '5', label: '海纳百川', }, ], notice: [ { id: 'xxx1', title: titles[0], logo: avatars[0], description: '那是一种内在的东西,他们到达不了,也无法触及的', updatedAt: new Date(), member: '科学搬砖组', href: '', memberLink: '', }, { id: 'xxx2', title: titles[1], logo: avatars[1], description: '希望是一个好东西,也许是最好的,好东西是不会消亡的', updatedAt: new Date('2017-07-24'), member: '全组都是吴彦祖', href: '', memberLink: '', }, { id: 'xxx3', title: titles[2], logo: avatars[2], description: '城镇中有那么多的酒馆,她却偏偏走进了我的酒馆', updatedAt: new Date(), member: '中二少女团', href: '', memberLink: '', }, { id: 'xxx4', title: titles[3], logo: avatars[3], description: '那时候我只会想自己想要什么,从不想自己拥有什么', updatedAt: new Date('2017-07-23'), member: '程序员日常', href: '', memberLink: '', }, { id: 'xxx5', title: titles[4], logo: avatars[4], description: '凛冬将至', updatedAt: new Date('2017-07-23'), member: '高逼格设计天团', href: '', memberLink: '', }, { id: 'xxx6', title: titles[5], logo: avatars[5], description: '生命就像一盒巧克力,结果往往出人意料', updatedAt: new Date('2017-07-23'), member: '骗你来学计算机', href: '', memberLink: '', }, ], notifyCount: 12, unreadCount: 11, country: 'China', geographic: { province: { label: '浙江省', key: '330000', }, city: { label: '杭州市', key: '330100', }, }, address: '西湖区工专路 77 号', phone: '0752-268888888', }; function fakeList(count: number): ListItemDataType[] { const list = []; for (let i = 0; i < count; i += 1) { list.push({ id: `fake-list-${i}`, owner: user[i % 10], title: titles[i % 8], avatar: avatars[i % 8], cover: parseInt(`${i / 4}`, 10) % 2 === 0 ? covers[i % 4] : covers[3 - (i % 4)], status: ['active', 'exception', 'normal'][i % 3] as | 'normal' | 'exception' | 'active' | 'success', percent: Math.ceil(Math.random() * 50) + 50, logo: avatars[i % 8], href: 'https://ant.design', updatedAt: new Date( new Date().getTime() - 1000 * 60 * 60 * 2 * i, ).getTime(), createdAt: new Date( new Date().getTime() - 1000 * 60 * 60 * 2 * i, ).getTime(), subDescription: desc[i % 5], description: '在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。', activeUser: Math.ceil(Math.random() * 100000) + 100000, newUser: Math.ceil(Math.random() * 1000) + 1000, star: Math.ceil(Math.random() * 100) + 100, like: Math.ceil(Math.random() * 100) + 100, message: Math.ceil(Math.random() * 10) + 10, content: '段落示意:蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。', members: [ { avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ZiESqWwCXBRQoaPONSJe.png', name: '曲丽丽', id: 'member1', }, { avatar: 'https://gw.alipayobjects.com/zos/rmsportal/tBOxZPlITHqwlGjsJWaF.png', name: '王昭君', id: 'member2', }, { avatar: 'https://gw.alipayobjects.com/zos/rmsportal/sBxjgqiuHMGRkIjqlQCd.png', name: '董娜娜', id: 'member3', }, ], }); } return list; } function getFakeList(req: Request, res: Response) { const params = req.query as any; const count = Number(params.count) * 1 || 5; const result = fakeList(count); return res.json({ data: { list: result, }, }); } // 获取用户信息 function getCurrentUser(req: Request, res: Response) { return res.json({ data: currentUseDetail, }); } export default { 'GET /api/fake_list_Detail': getFakeList, // 支持值为 Object 和 Array 'GET /api/currentUserDetail': getCurrentUser, };
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/abc/components/Applications/index.style.ts
TypeScript
import { createStyles } from 'antd-style'; const useStyles = createStyles(({ token }) => { return { filterCardList: { marginBottom: '-24px', '.ant-card-meta-content': { marginTop: '0' }, '.ant-list .ant-list-item-content-single': { maxWidth: '100%' }, }, cardInfo: { marginTop: '16px', marginLeft: '40px', zoom: '1', '&::before, &::after': { display: 'table', content: "' '" }, '&::after': { clear: 'both', height: '0', fontSize: '0', visibility: 'hidden', }, '& > div': { position: 'relative', float: 'left', width: '50%', textAlign: 'left', p: { margin: '0', fontSize: '24px', lineHeight: '32px', }, 'p:first-child': { marginBottom: '4px', color: token.colorTextSecondary, fontSize: '12px', lineHeight: '20px', }, }, }, cardItemContent: { display: 'flex', height: '20px', marginTop: '16px', marginBottom: '-4px', lineHeight: '20px', '& > span': { flex: '1', color: token.colorTextSecondary, fontSize: '12px', }, }, }; }); export default useStyles;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/abc/components/Applications/index.tsx
TypeScript (TSX)
import { DownloadOutlined, EditOutlined, EllipsisOutlined, ShareAltOutlined, } from '@ant-design/icons'; import { Avatar, Card, Dropdown, List, Menu, Tooltip } from 'antd'; import { useRequest } from 'inula'; import numeral from 'numeral'; import React from 'react'; import type { ListItemDataType } from '../../data.d'; import { queryFakeList } from '../../service'; import useStyles from './index.style'; export function formatWan(val: number) { const v = val * 1; if (!v || Number.isNaN(v)) return ''; let result: React.ReactNode = val; if (val > 10000) { result = ( <span> {Math.floor(val / 10000)} <span style={{ position: 'relative', top: -2, fontSize: 14, fontStyle: 'normal', marginLeft: 2, }} > 万 </span> </span> ); } return result; } const Applications: React.FC = () => { const { styles } = useStyles(); // 获取tab列表数据 const { data: listData } = useRequest(() => { return queryFakeList({ count: 30, }); }); const itemMenu = ( <Menu> <Menu.Item> <a target="_blank" rel="noopener noreferrer" href="https://www.alipay.com/" > 1st menu item </a> </Menu.Item> <Menu.Item> <a target="_blank" rel="noopener noreferrer" href="https://www.taobao.com/" > 2nd menu item </a> </Menu.Item> <Menu.Item> <a target="_blank" rel="noopener noreferrer" href="https://www.tmall.com/" > 3d menu item </a> </Menu.Item> </Menu> ); const CardInfo: React.FC<{ activeUser: React.ReactNode; newUser: React.ReactNode; }> = ({ activeUser, newUser }) => ( <div className={styles.cardInfo}> <div> <p>活跃用户</p> <p>{activeUser}</p> </div> <div> <p>新增用户</p> <p>{newUser}</p> </div> </div> ); return ( <List<ListItemDataType> rowKey="id" className={styles.filterCardList} grid={{ gutter: 24, xxl: 3, xl: 2, lg: 2, md: 2, sm: 2, xs: 1 }} dataSource={listData?.list || []} renderItem={(item) => ( <List.Item key={item.id}> <Card hoverable bodyStyle={{ paddingBottom: 20 }} actions={[ <Tooltip key="download" title="下载"> <DownloadOutlined /> </Tooltip>, <Tooltip title="编辑" key="edit"> <EditOutlined /> </Tooltip>, <Tooltip title="分享" key="share"> <ShareAltOutlined /> </Tooltip>, <Dropdown overlay={itemMenu} key="ellipsis"> <EllipsisOutlined /> </Dropdown>, ]} > <Card.Meta avatar={<Avatar size="small" src={item.avatar} />} title={item.title} /> <div className={styles.cardItemContent}> <CardInfo activeUser={formatWan(item.activeUser)} newUser={numeral(item.newUser).format('0,0')} /> </div> </Card> </List.Item> )} /> ); }; export default Applications;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/abc/components/ArticleListContent/index.style.ts
TypeScript
import { createStyles } from 'antd-style'; const useStyles = createStyles(({ token }) => { return { description: { maxWidth: '720px', lineHeight: '22px', }, extra: { marginTop: '16px', color: token.colorTextSecondary, lineHeight: '22px', '& > em': { marginLeft: '16px', color: token.colorTextDisabled, fontStyle: 'normal', }, [`@media screen and (max-width: ${token.screenXS}px)`]: { '& > em': { display: 'block', marginTop: '8px', marginLeft: '0', }, }, }, }; }); export default useStyles;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/abc/components/ArticleListContent/index.tsx
TypeScript (TSX)
import { Avatar } from 'antd'; import moment from 'moment'; import React from 'react'; import useStyles from './index.style'; export type ApplicationsProps = { data: { content?: string; updatedAt?: any; avatar?: string; owner?: string; href?: string; }; }; const ArticleListContent: React.FC<ApplicationsProps> = ({ data: { content, updatedAt, avatar, owner, href }, }) => { const { styles } = useStyles(); return ( <div> <div className={styles.description}>{content}</div> <div className={styles.extra}> <Avatar src={avatar} size="small" /> <a href={href}>{owner}</a> 发布在 <a href={href}>{href}</a> <em>{moment(updatedAt).format('YYYY-MM-DD HH:mm')}</em> </div> </div> ); }; export default ArticleListContent;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/abc/components/Articles/index.style.ts
TypeScript
import { createStyles } from 'antd-style'; const useStyles = createStyles(({ token }) => { return { articleList: { '.ant-list-item:first-child': { paddingTop: '0' }, }, listItemMetaTitle: { color: token.colorTextHeading, }, }; }); export default useStyles;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/abc/components/Articles/index.tsx
TypeScript (TSX)
import { LikeOutlined, MessageFilled, StarTwoTone } from '@ant-design/icons'; import { List, Tag } from 'antd'; import { useRequest } from 'inula'; import React from 'react'; import type { ListItemDataType } from '../../data.d'; import { queryFakeList } from '../../service'; import ArticleListContent from '../ArticleListContent'; import useStyles from './index.style'; const Articles: React.FC = () => { const { styles } = useStyles(); const IconText: React.FC<{ icon: React.ReactNode; text: React.ReactNode; }> = ({ icon, text }) => ( <span> {icon} {text} </span> ); // 获取tab列表数据 const { data: listData } = useRequest(() => { return queryFakeList({ count: 30, }); }); return ( <List<ListItemDataType> size="large" className={styles.articleList} rowKey="id" itemLayout="vertical" dataSource={listData?.list || []} renderItem={(item) => ( <List.Item key={item.id} actions={[ <IconText key="star" icon={<StarTwoTone />} text={item.star} />, <IconText key="like" icon={<LikeOutlined />} text={item.like} />, <IconText key="message" icon={<MessageFilled />} text={item.message} />, ]} > <List.Item.Meta title={ <a className={styles.listItemMetaTitle} href={item.href}> {item.title} </a> } description={ <span> <Tag>Ant Design</Tag> <Tag>设计语言</Tag> <Tag>蚂蚁金服</Tag> </span> } /> <ArticleListContent data={item} /> </List.Item> )} /> ); }; export default Articles;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/abc/components/AvatarList/index.style.ts
TypeScript
import { createStyles } from 'antd-style'; const useStyles = createStyles(({ token }) => { return { avatarList: { display: 'inline-block', ul: { display: 'inline-block', marginLeft: '8px', fontSize: '0' }, }, avatarItem: { display: 'inline-block', width: token.controlHeight, height: token.controlHeight, marginLeft: '-8px', fontSize: token.fontSize, '.ant-avatar': { border: `1px solid ${token.colorBorder}` }, }, avatarItemLarge: { width: token.controlHeightLG, height: token.controlHeightLG, }, avatarItemSmall: { width: token.controlHeightSM, height: token.controlHeightSM, }, avatarItemMini: { width: '20px', height: '20px', '.ant-avatar': { width: '20px', height: '20px', lineHeight: '20px', '.ant-avatar-string': { fontSize: '12px', lineHeight: '18px', }, }, }, }; }); export default useStyles;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/abc/components/AvatarList/index.tsx
TypeScript (TSX)
import { Avatar, Tooltip } from 'antd'; import classNames from 'classnames'; import React from 'react'; import useStyles from './index.style'; export declare type SizeType = number | 'small' | 'default' | 'large'; export type AvatarItemProps = { tips: React.ReactNode; src: string; size?: SizeType; style?: React.CSSProperties; onClick?: () => void; }; export type AvatarListProps = { Item?: React.ReactElement<AvatarItemProps>; size?: SizeType; maxLength?: number; excessItemsStyle?: React.CSSProperties; style?: React.CSSProperties; children: | React.ReactElement<AvatarItemProps> | React.ReactElement<AvatarItemProps>[]; }; const avatarSizeToClassName = (styles: any, size?: SizeType | 'mini') => classNames(styles.avatarItem, { [styles.avatarItemLarge]: size === 'large', [styles.avatarItemSmall]: size === 'small', [styles.avatarItemMini]: size === 'mini', }); const Item: React.FC<AvatarItemProps> = ({ src, size, tips, onClick = () => {}, }) => { const { styles } = useStyles(); const cls = avatarSizeToClassName(styles, size); return ( <li className={cls} onClick={onClick}> {tips ? ( <Tooltip title={tips}> <Avatar src={src} size={size} style={{ cursor: 'pointer' }} /> </Tooltip> ) : ( <Avatar src={src} size={size} /> )} </li> ); }; const AvatarList: React.FC<AvatarListProps> & { Item: typeof Item } = ({ children, size, maxLength = 5, excessItemsStyle, ...other }) => { const { styles } = useStyles(); const numOfChildren = React.Children.count(children); const numToShow = maxLength >= numOfChildren ? numOfChildren : maxLength; const childrenArray = React.Children.toArray( children, ) as React.ReactElement<AvatarItemProps>[]; const childrenWithProps = childrenArray.slice(0, numToShow).map((child) => React.cloneElement(child, { size, }), ); if (numToShow < numOfChildren) { const cls = avatarSizeToClassName(styles, size); childrenWithProps.push( <li key="exceed" className={cls}> <Avatar size={size} style={excessItemsStyle}>{`+${ numOfChildren - maxLength }`}</Avatar> </li>, ); } return ( <div {...other} className={styles.avatarList}> <ul> {childrenWithProps} </ul> </div> ); }; AvatarList.Item = Item; export default AvatarList;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/abc/components/Projects/index.style.ts
TypeScript
import { createStyles } from 'antd-style'; const useStyles = createStyles(({ token }) => { return { card: { '.ant-card-meta-title': { marginBottom: '4px', '& > a': { display: 'inline-block', maxWidth: '100%', color: token.colorTextHeading, }, }, '.ant-card-meta-description': { height: '44px', overflow: 'hidden', lineHeight: '22px', }, '&:hover': { '.ant-card-meta-title > a': { color: token.colorPrimary, }, }, }, cardItemContent: { display: 'flex', height: '20px', marginTop: '16px', marginBottom: '-4px', lineHeight: '20px', '& > span': { flex: '1', color: token.colorTextSecondary, fontSize: '12px', }, }, avatarList: { flex: '0 1 auto', }, cardList: { marginTop: '24px', }, coverCardList: { '.ant-list .ant-list-item-content-single': { maxWidth: '100%' }, }, }; }); export default useStyles;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/abc/components/Projects/index.tsx
TypeScript (TSX)
import { Card, List } from 'antd'; import { useRequest } from 'inula'; import moment from 'moment'; import React from 'react'; import type { ListItemDataType } from '../../data.d'; import { queryFakeList } from '../../service'; import AvatarList from '../AvatarList'; import useStyles from './index.style'; const Projects: React.FC = () => { const { styles } = useStyles(); // 获取tab列表数据 const { data: listData } = useRequest(() => { return queryFakeList({ count: 30, }); }); return ( <List<ListItemDataType> className={styles.coverCardList} rowKey="id" grid={{ gutter: 24, xxl: 3, xl: 2, lg: 2, md: 2, sm: 2, xs: 1 }} dataSource={listData?.list || []} renderItem={(item) => ( <List.Item> <Card className={styles.card} hoverable cover={<img alt={item.title} src={item.cover} />} > <Card.Meta title={<a>{item.title}</a>} description={item.subDescription} /> <div className={styles.cardItemContent}> <span>{moment(item.updatedAt).fromNow()}</span> <div className={styles.avatarList}> <AvatarList size="small"> {item.members.map((member) => ( <AvatarList.Item key={`${item.id}-avatar-${member.id}`} src={member.avatar} tips={member.name} /> ))} </AvatarList> </div> </div> </Card> </List.Item> )} /> ); }; export default Projects;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/abc/data.d.ts
TypeScript
export type tabKeyType = 'articles' | 'applications' | 'projects'; export interface TagType { key: string; label: string; } export type GeographicType = { province: { label: string; key: string; }; city: { label: string; key: string; }; }; export type NoticeType = { id: string; title: string; logo: string; description: string; updatedAt: string; member: string; href: string; memberLink: string; }; export type CurrentUser = { name: string; avatar: string; userid: string; notice: NoticeType[]; email: string; signature: string; title: string; group: string; tags: TagType[]; notifyCount: number; unreadCount: number; country: string; geographic: GeographicType; address: string; phone: string; }; export type Member = { avatar: string; name: string; id: string; }; export type ListItemDataType = { id: string; owner: string; title: string; avatar: string; cover: string; status: 'normal' | 'exception' | 'active' | 'success'; percent: number; logo: string; href: string; body?: any; updatedAt: number; createdAt: number; subDescription: string; description: string; activeUser: number; newUser: number; star: number; like: number; message: number; content: string; members: Member[]; };
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/abc/index.tsx
TypeScript (TSX)
import { ClusterOutlined, ContactsOutlined, HomeOutlined, PlusOutlined, } from '@ant-design/icons'; import { GridContent } from '@ant-design/pro-components'; import { Avatar, Card, Col, Divider, Input, InputRef, Row, Tag } from 'antd'; import { Link, useRequest } from 'inula'; import React, { useRef, useState } from 'react'; import useStyles from './Center.style'; import Applications from './components/Applications'; import Articles from './components/Articles'; import Projects from './components/Projects'; import type { CurrentUser, tabKeyType, TagType } from './data.d'; import { queryCurrent } from './service'; const operationTabList = [ { key: 'articles', tab: ( <span> 文章 <span style={{ fontSize: 14 }}>(8)</span> </span> ), }, { key: 'applications', tab: ( <span> 应用 <span style={{ fontSize: 14 }}>(8)</span> </span> ), }, { key: 'projects', tab: ( <span> 项目 <span style={{ fontSize: 14 }}>(8)</span> </span> ), }, ]; const TagList: React.FC<{ tags: CurrentUser['tags'] }> = ({ tags }) => { const { styles } = useStyles(); const ref = useRef<InputRef>(null); const [newTags, setNewTags] = useState<TagType[]>([]); const [inputVisible, setInputVisible] = useState<boolean>(false); const [inputValue, setInputValue] = useState<string>(''); const showInput = () => { setInputVisible(true); if (ref.current) { // eslint-disable-next-line no-unused-expressions ref.current?.focus(); } }; const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => { setInputValue(e.target.value); }; const handleInputConfirm = () => { let tempsTags = [...newTags]; if ( inputValue && tempsTags.filter((tag) => tag.label === inputValue).length === 0 ) { tempsTags = [ ...tempsTags, { key: `new-${tempsTags.length}`, label: inputValue }, ]; } setNewTags(tempsTags); setInputVisible(false); setInputValue(''); }; return ( <div className={styles.tags}> <div className={styles.tagsTitle}>标签</div> {(tags || []).concat(newTags).map((item) => ( <Tag key={item.key}>{item.label}</Tag> ))} {inputVisible && ( <Input ref={ref} type="text" size="small" style={{ width: 78 }} value={inputValue} onChange={handleInputChange} onBlur={handleInputConfirm} onPressEnter={handleInputConfirm} /> )} {!inputVisible && ( <Tag onClick={showInput} style={{ borderStyle: 'dashed' }}> <PlusOutlined /> </Tag> )} </div> ); }; const Abc: React.FC = () => { const { styles } = useStyles(); const [tabKey, setTabKey] = useState<tabKeyType>('articles'); // 获取用户信息 const { data: currentUser, loading } = useRequest(() => { return queryCurrent(); }); console.log(currentUser); // 渲染用户信息 const renderUserInfo = ({ title, group, geographic, }: Partial<CurrentUser>) => { return ( <div className={styles.detail}> <p> <ContactsOutlined style={{ marginRight: 8, }} /> {title} </p> <p> <ClusterOutlined style={{ marginRight: 8, }} /> {group} </p> <p> <HomeOutlined style={{ marginRight: 8, }} /> {(geographic || { province: { label: '' } }).province.label} { ( geographic || { city: { label: '', }, } ).city.label } </p> </div> ); }; // 渲染tab切换 const renderChildrenByTabKey = (tabValue: tabKeyType) => { if (tabValue === 'projects') { return <Projects />; } if (tabValue === 'applications') { return <Applications />; } if (tabValue === 'articles') { return <Articles />; } return null; }; return ( <GridContent> <Row gutter={24}> <Col lg={7} md={24}> <Card bordered={false} style={{ marginBottom: 24 }} loading={loading}> {!loading && currentUser && ( <div> <div className={styles.avatarHolder}> <img alt="" src={currentUser.avatar} /> <div className={styles.name}>{currentUser.name}</div> <div>{currentUser?.signature}</div> </div> {renderUserInfo(currentUser)} <Divider dashed /> <TagList tags={currentUser.tags || []} /> <Divider style={{ marginTop: 16 }} dashed /> <div className={styles.team}> <div className={styles.teamTitle}>团队</div> <Row gutter={36}> {currentUser.notice && currentUser.notice.map((item) => ( <Col key={item.id} lg={24} xl={12}> <Link to={item.href}> <Avatar size="small" src={item.logo} /> {item.member} </Link> </Col> ))} </Row> </div> </div> )} </Card> </Col> <Col lg={17} md={24}> <Card className={styles.tabsCard} bordered={false} tabList={operationTabList} activeTabKey={tabKey} onTabChange={(_tabKey: string) => { setTabKey(_tabKey as tabKeyType); }} > {renderChildrenByTabKey(tabKey)} </Card> </Col> </Row> </GridContent> ); }; export default Abc;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/abc/service.ts
TypeScript
import { ir } from 'inula'; import type { CurrentUser, ListItemDataType } from './data.d'; export async function queryCurrent(): Promise<{ data: CurrentUser }> { return ir('/api/currentUserDetail'); } export async function queryFakeList(params: { count: number; }): Promise<{ data: { list: ListItemDataType[] } }> { return ir('/api/fake_list_Detail', { params, }); }
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/_mock.ts
TypeScript
import type { Request, Response } from 'express'; import moment from 'moment'; import type { AnalysisData, DataItem, RadarData } from './data.d'; // mock data const visitData: DataItem[] = []; const beginDay = new Date().getTime(); const fakeY = [7, 5, 4, 2, 4, 7, 5, 6, 5, 9, 6, 3, 1, 5, 3, 6, 5]; for (let i = 0; i < fakeY.length; i += 1) { visitData.push({ x: moment(new Date(beginDay + 1000 * 60 * 60 * 24 * i)).format( 'YYYY-MM-DD', ), y: fakeY[i], }); } const visitData2 = []; const fakeY2 = [1, 6, 4, 8, 3, 7, 2]; for (let i = 0; i < fakeY2.length; i += 1) { visitData2.push({ x: moment(new Date(beginDay + 1000 * 60 * 60 * 24 * i)).format( 'YYYY-MM-DD', ), y: fakeY2[i], }); } const salesData = []; for (let i = 0; i < 12; i += 1) { salesData.push({ x: `${i + 1}月`, y: Math.floor(Math.random() * 1000) + 200, }); } const searchData = []; for (let i = 0; i < 50; i += 1) { searchData.push({ index: i + 1, keyword: `搜索关键词-${i}`, count: Math.floor(Math.random() * 1000), range: Math.floor(Math.random() * 100), status: Math.floor((Math.random() * 10) % 2), }); } const salesTypeData = [ { x: '家用电器', y: 4544, }, { x: '食用酒水', y: 3321, }, { x: '个护健康', y: 3113, }, { x: '服饰箱包', y: 2341, }, { x: '母婴产品', y: 1231, }, { x: '其他', y: 1231, }, ]; const salesTypeDataOnline = [ { x: '家用电器', y: 244, }, { x: '食用酒水', y: 321, }, { x: '个护健康', y: 311, }, { x: '服饰箱包', y: 41, }, { x: '母婴产品', y: 121, }, { x: '其他', y: 111, }, ]; const salesTypeDataOffline = [ { x: '家用电器', y: 99, }, { x: '食用酒水', y: 188, }, { x: '个护健康', y: 344, }, { x: '服饰箱包', y: 255, }, { x: '其他', y: 65, }, ]; const offlineData = []; for (let i = 0; i < 10; i += 1) { offlineData.push({ name: `Stores ${i}`, cvr: Math.ceil(Math.random() * 9) / 10, }); } const offlineChartData = []; for (let i = 0; i < 20; i += 1) { const date = moment(new Date().getTime() + 1000 * 60 * 30 * i).format( 'HH:mm', ); offlineChartData.push({ date, type: '客流量', value: Math.floor(Math.random() * 100) + 10, }); offlineChartData.push({ date, type: '支付笔数', value: Math.floor(Math.random() * 100) + 10, }); } const radarOriginData = [ { name: '个人', ref: 10, koubei: 8, output: 4, contribute: 5, hot: 7, }, { name: '团队', ref: 3, koubei: 9, output: 6, contribute: 3, hot: 1, }, { name: '部门', ref: 4, koubei: 1, output: 6, contribute: 5, hot: 7, }, ]; const radarData: RadarData[] = []; const radarTitleMap = { ref: '引用', koubei: '口碑', output: '产量', contribute: '贡献', hot: '热度', }; radarOriginData.forEach((item) => { Object.keys(item).forEach((key) => { if (key !== 'name') { radarData.push({ name: item.name, label: radarTitleMap[key], value: item[key], }); } }); }); const getFakeChartData: AnalysisData = { visitData, visitData2, salesData, searchData, offlineData, offlineChartData, salesTypeData, salesTypeDataOnline, salesTypeDataOffline, radarData, }; const fakeChartData = (_: Request, res: Response) => { return res.json({ data: getFakeChartData, }); }; export default { 'GET /api/fake_analysis_chart_data': fakeChartData, };
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/Charts/Bar/index.tsx
TypeScript (TSX)
import { Axis, Chart, Geom, Tooltip } from 'bizcharts'; import React, { Component } from 'react'; import Debounce from 'lodash.debounce'; import autoHeight from '../autoHeight'; import styles from '../index.less'; export type BarProps = { title: React.ReactNode; color?: string; padding?: [number, number, number, number]; height?: number; data: { x: string; y: number; }[]; forceFit?: boolean; autoLabel?: boolean; style?: React.CSSProperties; }; class Bar extends Component< BarProps, { autoHideXLabels: boolean; } > { state = { autoHideXLabels: false, }; root: HTMLDivElement | undefined = undefined; node: HTMLDivElement | undefined = undefined; resize = Debounce(() => { if (!this.node || !this.node.parentNode) { return; } const canvasWidth = (this.node.parentNode as HTMLDivElement).clientWidth; const { data = [], autoLabel = true } = this.props; if (!autoLabel) { return; } const minWidth = data.length * 30; const { autoHideXLabels } = this.state; if (canvasWidth <= minWidth) { if (!autoHideXLabels) { this.setState({ autoHideXLabels: true, }); } } else if (autoHideXLabels) { this.setState({ autoHideXLabels: false, }); } }, 500); componentDidMount() { window.addEventListener('resize', this.resize, { passive: true }); } componentWillUnmount() { window.removeEventListener('resize', this.resize); } handleRoot = (n: HTMLDivElement) => { this.root = n; }; handleRef = (n: HTMLDivElement) => { this.node = n; }; render() { const { height = 1, title, forceFit = true, data, color = 'rgba(24, 144, 255, 0.85)', padding, } = this.props; const { autoHideXLabels } = this.state; const scale = { x: { type: 'cat', }, y: { min: 0, }, }; const tooltip: [ string, (...args: any[]) => { name?: string; value: string }, ] = [ 'x*y', (x: string, y: string) => ({ name: x, value: y, }), ]; return ( <div className={styles.chart} style={{ height }} ref={this.handleRoot}> <div ref={this.handleRef}> {title && <h4 style={{ marginBottom: 20 }}>{title}</h4>} <Chart scale={scale} height={title ? height - 41 : height} forceFit={forceFit} data={data} padding={padding || 'auto'} > <Axis name="x" title={false} label={autoHideXLabels ? undefined : {}} tickLine={autoHideXLabels ? undefined : {}} /> <Axis name="y" min={0} /> <Tooltip showTitle={false} crosshairs={false} /> <Geom type="interval" position="x*y" color={color} tooltip={tooltip} /> </Chart> </div> </div> ); } } export default autoHeight()(Bar);
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/Charts/ChartCard/index.less
LESS
@import '~antd/es/style/themes/default.less'; .chartCard { position: relative; .chartTop { position: relative; width: 100%; overflow: hidden; } .chartTopMargin { margin-bottom: 12px; } .chartTopHasMargin { margin-bottom: 20px; } .metaWrap { float: left; } .avatar { position: relative; top: 4px; float: left; margin-right: 20px; img { border-radius: 100%; } } .meta { height: 22px; color: @text-color-secondary; font-size: @font-size-base; line-height: 22px; } .action { position: absolute; top: 4px; right: 0; line-height: 1; cursor: pointer; } .total { height: 38px; margin-top: 4px; margin-bottom: 0; overflow: hidden; color: @heading-color; font-size: 30px; line-height: 38px; white-space: nowrap; text-overflow: ellipsis; word-break: break-all; } .content { position: relative; width: 100%; margin-bottom: 12px; } .contentFixed { position: absolute; bottom: 0; left: 0; width: 100%; } .footer { margin-top: 8px; padding-top: 9px; border-top: 1px solid @border-color-split; & > * { position: relative; } } .footerMargin { margin-top: 20px; } }
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/Charts/ChartCard/index.tsx
TypeScript (TSX)
import { Card } from 'antd'; import type { CardProps } from 'antd/es/card'; import classNames from 'classnames'; import React from 'react'; import styles from './index.less'; type totalType = () => React.ReactNode; const renderTotal = (total?: number | totalType | React.ReactNode) => { if (!total && total !== 0) { return null; } let totalDom; switch (typeof total) { case 'undefined': totalDom = null; break; case 'function': totalDom = <div className={styles.total}>{total()}</div>; break; default: totalDom = <div className={styles.total}>{total}</div>; } return totalDom; }; export type ChartCardProps = { title: React.ReactNode; action?: React.ReactNode; total?: React.ReactNode | number | (() => React.ReactNode | number); footer?: React.ReactNode; contentHeight?: number; avatar?: React.ReactNode; style?: React.CSSProperties; } & CardProps; class ChartCard extends React.Component<ChartCardProps> { renderContent = () => { const { contentHeight, title, avatar, action, total, footer, children, loading, } = this.props; if (loading) { return false; } return ( <div className={styles.chartCard}> <div className={classNames(styles.chartTop, { [styles.chartTopMargin]: !children && !footer, })} > <div className={styles.avatar}>{avatar}</div> <div className={styles.metaWrap}> <div className={styles.meta}> <span className={styles.title}>{title}</span> <span className={styles.action}>{action}</span> </div> {renderTotal(total)} </div> </div> {children && ( <div className={styles.content} style={{ height: contentHeight || 'auto' }} > <div className={contentHeight && styles.contentFixed}> {children} </div> </div> )} {footer && ( <div className={classNames(styles.footer, { [styles.footerMargin]: !children, })} > {footer} </div> )} </div> ); }; render() { const { loading = false, contentHeight, title, avatar, action, total, footer, children, ...rest } = this.props; return ( <Card loading={loading} bodyStyle={{ padding: '20px 24px 8px 24px' }} {...rest} > {this.renderContent()} </Card> ); } } export default ChartCard;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/Charts/Field/index.less
LESS
@import '~antd/es/style/themes/default.less'; .field { margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; .label, .number { font-size: @font-size-base; line-height: 22px; } .number { margin-left: 8px; color: @heading-color; } }
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/Charts/Field/index.tsx
TypeScript (TSX)
import React from 'react'; import styles from './index.less'; export type FieldProps = { label: React.ReactNode; value: React.ReactNode; style?: React.CSSProperties; }; const Field: React.FC<FieldProps> = ({ label, value, ...rest }) => ( <div className={styles.field} {...rest}> <span className={styles.label}>{label}</span> <span className={styles.number}>{value}</span> </div> ); export default Field;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/Charts/Gauge/index.tsx
TypeScript (TSX)
import { Axis, Chart, Coord, Geom, Guide, Shape } from 'bizcharts'; import React from 'react'; import autoHeight from '../autoHeight'; const { Arc, Html, Line } = Guide; export type GaugeProps = { title: React.ReactNode; color?: string; height?: number; bgColor?: number; percent: number; forceFit?: boolean; style?: React.CSSProperties; formatter: (value: string) => string; }; const defaultFormatter = (val: string): string => { switch (val) { case '2': return '差'; case '4': return '中'; case '6': return '良'; case '8': return '优'; default: return ''; } }; if (Shape.registerShape) { Shape.registerShape('point', 'pointer', { drawShape(cfg: any, group: any) { let point = cfg.points[0]; point = (this as any).parsePoint(point); const center = (this as any).parsePoint({ x: 0, y: 0, }); group.addShape('line', { attrs: { x1: center.x, y1: center.y, x2: point.x, y2: point.y, stroke: cfg.color, lineWidth: 2, lineCap: 'round', }, }); return group.addShape('circle', { attrs: { x: center.x, y: center.y, r: 6, stroke: cfg.color, lineWidth: 3, fill: '#fff', }, }); }, }); } const Gauge: React.FC<GaugeProps> = (props) => { const { title, height = 1, percent, forceFit = true, formatter = defaultFormatter, color = '#2F9CFF', bgColor = '#F0F2F5', } = props; const cols = { value: { type: 'linear', min: 0, max: 10, tickCount: 6, nice: true, }, }; const data = [{ value: percent / 10 }]; const renderHtml = () => ` <div style="width: 300px;text-align: center;font-size: 12px!important;"> <div style="font-size: 14px; color: rgba(0,0,0,0.43);margin: 0;">${title}</div> <div style="font-size: 24px;color: rgba(0,0,0,0.85);margin: 0;"> ${(data[0].value * 10).toFixed(2)}% </div> </div>`; const textStyle: { fontSize: number; fill: string; textAlign: 'center'; } = { fontSize: 12, fill: 'rgba(0, 0, 0, 0.65)', textAlign: 'center', }; return ( <Chart height={height} data={data} scale={cols} padding={[-16, 0, 16, 0]} forceFit={forceFit} > <Coord type="polar" startAngle={-1.25 * Math.PI} endAngle={0.25 * Math.PI} radius={0.8} /> <Axis name="1" line={undefined} /> <Axis line={undefined} tickLine={undefined} subTickLine={undefined} name="value" zIndex={2} label={{ offset: -12, formatter, textStyle, }} /> <Guide> <Line start={[3, 0.905]} end={[3, 0.85]} lineStyle={{ stroke: color, lineDash: undefined, lineWidth: 2, }} /> <Line start={[5, 0.905]} end={[5, 0.85]} lineStyle={{ stroke: color, lineDash: undefined, lineWidth: 3, }} /> <Line start={[7, 0.905]} end={[7, 0.85]} lineStyle={{ stroke: color, lineDash: undefined, lineWidth: 3, }} /> <Arc start={[0, 0.965]} end={[10, 0.965]} style={{ stroke: bgColor, lineWidth: 10, }} /> <Arc start={[0, 0.965]} end={[data[0].value, 0.965]} style={{ stroke: color, lineWidth: 10, }} /> <Html position={['50%', '95%']} html={renderHtml()} /> </Guide> <Geom line={false} type="point" position="value*1" shape="pointer" color={color} active={false} /> </Chart> ); }; export default autoHeight()(Gauge);
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/Charts/MiniArea/index.tsx
TypeScript (TSX)
import type { AxisProps } from 'bizcharts'; import { Axis, Chart, Geom, Tooltip } from 'bizcharts'; import React from 'react'; import autoHeight from '../autoHeight'; import styles from '../index.less'; export type MiniAreaProps = { color?: string; height?: number; borderColor?: string; line?: boolean; animate?: boolean; xAxis?: AxisProps; forceFit?: boolean; scale?: { x?: { tickCount: number; }; y?: { tickCount: number; }; }; yAxis?: Partial<AxisProps>; borderWidth?: number; data: { x: number | string; y: number; }[]; }; const MiniArea: React.FC<MiniAreaProps> = (props) => { const { height = 1, data = [], forceFit = true, color = 'rgba(24, 144, 255, 0.2)', borderColor = '#1089ff', scale = { x: {}, y: {} }, borderWidth = 2, line, xAxis, yAxis, animate = true, } = props; const padding: [number, number, number, number] = [36, 5, 30, 5]; const scaleProps = { x: { type: 'cat', range: [0, 1], ...scale.x, }, y: { min: 0, ...scale.y, }, }; const tooltip: [ string, (...args: any[]) => { name?: string; value: string }, ] = [ 'x*y', (x: string, y: string) => ({ name: x, value: y, }), ]; const chartHeight = height + 54; return ( <div className={styles.miniChart} style={{ height }}> <div className={styles.chartContent}> {height > 0 && ( <Chart animate={animate} scale={scaleProps} height={chartHeight} forceFit={forceFit} data={data} padding={padding} > <Axis key="axis-x" name="x" label={null} line={null} tickLine={null} grid={null} {...xAxis} /> <Axis key="axis-y" name="y" label={null} line={null} tickLine={null} grid={null} {...yAxis} /> <Tooltip showTitle={false} crosshairs={false} /> <Geom type="area" position="x*y" color={color} tooltip={tooltip} shape="smooth" style={{ fillOpacity: 1, }} /> {line ? ( <Geom type="line" position="x*y" shape="smooth" color={borderColor} size={borderWidth} tooltip={false} /> ) : ( <span style={{ display: 'none' }} /> )} </Chart> )} </div> </div> ); }; export default autoHeight()(MiniArea);
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/Charts/MiniBar/index.tsx
TypeScript (TSX)
import { Chart, Geom, Tooltip } from 'bizcharts'; import React from 'react'; import autoHeight from '../autoHeight'; import styles from '../index.less'; export type MiniBarProps = { color?: string; height?: number; data: { x: number | string; y: number; }[]; forceFit?: boolean; style?: React.CSSProperties; }; const MiniBar: React.FC<MiniBarProps> = (props) => { const { height = 0, forceFit = true, color = '#1890FF', data = [] } = props; const scale = { x: { type: 'cat', }, y: { min: 0, }, }; const padding: [number, number, number, number] = [36, 5, 30, 5]; const tooltip: [ string, (...args: any[]) => { name?: string; value: string }, ] = [ 'x*y', (x: string, y: string) => ({ name: x, value: y, }), ]; // for tooltip not to be hide const chartHeight = height + 54; return ( <div className={styles.miniChart} style={{ height }}> <div className={styles.chartContent}> <Chart scale={scale} height={chartHeight} forceFit={forceFit} data={data} padding={padding} > <Tooltip showTitle={false} crosshairs={false} /> <Geom type="interval" position="x*y" color={color} tooltip={tooltip} /> </Chart> </div> </div> ); }; export default autoHeight()(MiniBar);
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/Charts/MiniProgress/index.tsx
TypeScript (TSX)
import { Tooltip } from 'antd'; import React from 'react'; import styles from './index.less'; export type MiniProgressProps = { target: number; targetLabel?: string; color?: string; strokeWidth?: number; percent?: number; style?: React.CSSProperties; }; const MiniProgress: React.FC<MiniProgressProps> = ({ targetLabel, target, color = 'rgb(19, 194, 194)', strokeWidth, percent, }) => ( <div className={styles.miniProgress}> <Tooltip title={targetLabel}> <div className={styles.target} style={{ left: target ? `${target}%` : undefined }} > <span style={{ backgroundColor: color || undefined }} /> <span style={{ backgroundColor: color || undefined }} /> </div> </Tooltip> <div className={styles.progressWrap}> <div className={styles.progress} style={{ backgroundColor: color || undefined, width: percent ? `${percent}%` : undefined, height: strokeWidth || undefined, }} /> </div> </div> ); export default MiniProgress;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/Charts/Pie/index.tsx
TypeScript (TSX)
import { Chart, Coord, Geom, Tooltip } from 'bizcharts'; import React, { Component } from 'react'; import { DataView } from '@antv/data-set'; import { Divider } from 'antd'; import classNames from 'classnames'; import Debounce from 'lodash.debounce'; import ReactFitText from 'react-fittext'; import autoHeight from '../autoHeight'; import styles from './index.less'; export type PieProps = { animate?: boolean; color?: string; colors?: string[]; selected?: boolean; height?: number; margin?: [number, number, number, number]; hasLegend?: boolean; padding?: [number, number, number, number]; percent?: number; data?: { x: string | string; y: number; }[]; inner?: number; lineWidth?: number; forceFit?: boolean; style?: React.CSSProperties; className?: string; total?: React.ReactNode | number | (() => React.ReactNode | number); title?: React.ReactNode; tooltip?: boolean; valueFormat?: (value: string) => string | React.ReactNode; subTitle?: React.ReactNode; }; type PieState = { legendData: { checked: boolean; x: string; color: string; percent: number; y: string; }[]; legendBlock: boolean; }; class Pie extends Component<PieProps, PieState> { state: PieState = { legendData: [], legendBlock: false, }; irRef: number | undefined = undefined; root: HTMLDivElement | undefined = undefined; chart: G2.Chart | undefined = undefined; // for window resize auto responsive legend resize = Debounce(() => { const { hasLegend } = this.props; const { legendBlock } = this.state; if (!hasLegend || !this.root) { window.removeEventListener('resize', this.resize); return; } if ( this.root && this.root.parentNode && (this.root.parentNode as HTMLElement).clientWidth <= 380 ) { if (!legendBlock) { this.setState({ legendBlock: true, }); } } else if (legendBlock) { this.setState({ legendBlock: false, }); } }, 400); componentDidMount() { window.addEventListener( 'resize', () => { this.irRef = irAnimationFrame(() => this.resize()); }, { passive: true }, ); } componentDidUpdate(preProps: PieProps) { const { data } = this.props; if (data !== preProps.data) { // because of charts data create when rendered // so there is a trick for get rendered time this.getLegendData(); } } componentWillUnmount() { if (this.irRef) { window.cancelAnimationFrame(this.irRef); } window.removeEventListener('resize', this.resize); if (this.resize) { (this.resize as any).cancel(); } } getG2Instance = (chart: G2.Chart) => { this.chart = chart; irAnimationFrame(() => { this.getLegendData(); this.resize(); }); }; // for custom lengend view getLegendData = () => { if (!this.chart) return; const geom = this.chart.getAllGeoms()[0]; // 获取所有的图形 if (!geom) return; const items = (geom as any).get('dataArray') || []; // 获取图形对应的 const legendData = items.map((item: { color: any; _origin: any }[]) => { /* eslint no-underscore-dangle:0 */ const origin = item[0]._origin; origin.color = item[0].color; origin.checked = true; return origin; }); this.setState({ legendData, }); }; handleRoot = (n: HTMLDivElement) => { this.root = n; }; handleLegendClick = (item: any, i: string | number) => { const newItem = item; newItem.checked = !newItem.checked; const { legendData } = this.state; legendData[i] = newItem; const filteredLegendData = legendData .filter((l) => l.checked) .map((l) => l.x); if (this.chart) { this.chart.filter( 'x', (val) => filteredLegendData.indexOf(`${val}`) > -1, ); } this.setState({ legendData, }); }; render() { const { valueFormat, subTitle, total, hasLegend = false, className, style, height = 0, forceFit = true, percent, color, inner = 0.75, animate = true, colors, lineWidth = 1, } = this.props; const { legendData, legendBlock } = this.state; const pieClassName = classNames(styles.pie, className, { [styles.hasLegend]: !!hasLegend, [styles.legendBlock]: legendBlock, }); const { data: propsData, selected: propsSelected = true, tooltip: propsTooltip = true, } = this.props; let data = propsData || []; let selected = propsSelected; let tooltip = propsTooltip; const defaultColors = colors; data = data || []; selected = selected || true; tooltip = tooltip || true; let formatColor; const scale = { x: { type: 'cat', range: [0, 1], }, y: { min: 0, }, }; if (percent || percent === 0) { selected = false; tooltip = false; formatColor = (value: string) => { if (value === '占比') { return color || 'rgba(24, 144, 255, 0.85)'; } return '#F0F2F5'; }; data = [ { x: '占比', y: parseFloat(`${percent}`), }, { x: '反比', y: 100 - parseFloat(`${percent}`), }, ]; } const tooltipFormat: [ string, (...args: any[]) => { name?: string; value: string }, ] = [ 'x*percent', (x: string, p: number) => ({ name: x, value: `${(p * 100).toFixed(2)}%`, }), ]; const padding = [12, 0, 12, 0] as [number, number, number, number]; const dv = new DataView(); dv.source(data).transform({ type: 'percent', field: 'y', dimension: 'x', as: 'percent', }); return ( <div ref={this.handleRoot} className={pieClassName} style={style}> <ReactFitText maxFontSize={25}> <div className={styles.chart}> <Chart scale={scale} height={height} forceFit={forceFit} data={dv} padding={padding} animate={animate} onGetG2Instance={this.getG2Instance} > {!!tooltip && <Tooltip showTitle={false} />} <Coord type="theta" innerRadius={inner} /> <Geom style={{ lineWidth, stroke: '#fff' }} tooltip={tooltip ? tooltipFormat : undefined} type="intervalStack" position="percent" color={ [ 'x', percent || percent === 0 ? formatColor : defaultColors, ] as any } selected={selected} /> </Chart> {(subTitle || total) && ( <div className={styles.total}> {subTitle && <h4 className="pie-sub-title">{subTitle}</h4>} {/* eslint-disable-next-line */} {total && ( <div className="pie-stat"> {typeof total === 'function' ? total() : total} </div> )} </div> )} </div> </ReactFitText> {hasLegend && ( <ul className={styles.legend}> {legendData.map((item, i) => ( <li key={item.x} onClick={() => this.handleLegendClick(item, i)}> <span className={styles.dot} style={{ backgroundColor: !item.checked ? '#aaa' : item.color, }} /> <span className={styles.legendTitle}>{item.x}</span> <Divider type="vertical" /> <span className={styles.percent}> {`${(Number.isNaN(item.percent) ? 0 : item.percent * 100 ).toFixed(2)}%`} </span> <span className={styles.value}> {valueFormat ? valueFormat(item.y) : item.y} </span> </li> ))} </ul> )} </div> ); } } export default autoHeight()(Pie);
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/Charts/TagCloud/index.tsx
TypeScript (TSX)
import { Chart, Coord, Geom, Shape, Tooltip } from 'bizcharts'; import React, { Component } from 'react'; import DataSet from '@antv/data-set'; import classNames from 'classnames'; import Debounce from 'lodash.debounce'; import autoHeight from '../autoHeight'; import styles from './index.less'; /* eslint no-underscore-dangle: 0 */ /* eslint no-param-reassign: 0 */ const imgUrl = 'https://gw.alipayobjects.com/zos/rmsportal/gWyeGLCdFFRavBGIDzWk.png'; export type TagCloudProps = { data: { name: string; value: number; }[]; height?: number; className?: string; style?: React.CSSProperties; }; type TagCloudState = { dv: any; height?: number; width: number; }; class TagCloud extends Component<TagCloudProps, TagCloudState> { state = { dv: null, height: 0, width: 0, }; isUnmount: boolean = false; irRef: number = 0; root: HTMLDivElement | undefined = undefined; imageMask: HTMLImageElement | undefined = undefined; componentDidMount() { irAnimationFrame(() => { this.initTagCloud(); this.renderChart(this.props); }); window.addEventListener('resize', this.resize, { passive: true }); } componentDidUpdate(preProps?: TagCloudProps) { const { data } = this.props; if (preProps && JSON.stringify(preProps.data) !== JSON.stringify(data)) { this.renderChart(this.props); } } componentWillUnmount() { this.isUnmount = true; window.cancelAnimationFrame(this.irRef); window.removeEventListener('resize', this.resize); } resize = () => { this.irRef = irAnimationFrame(() => { this.renderChart(this.props); }); }; saveRootRef = (node: HTMLDivElement) => { this.root = node; }; initTagCloud = () => { function getTextAttrs(cfg: { x?: any; y?: any; style?: any; opacity?: any; origin?: any; color?: any; }) { return { ...cfg.style, fillOpacity: cfg.opacity, fontSize: cfg.origin._origin.size, rotate: cfg.origin._origin.rotate, text: cfg.origin._origin.text, textAlign: 'center', fontFamily: cfg.origin._origin.font, fill: cfg.color, textBaseline: 'Alphabetic', }; } (Shape as any).registerShape('point', 'cloud', { drawShape( cfg: { x: any; y: any }, container: { addShape: (arg0: string, arg1: { attrs: any }) => void }, ) { const attrs = getTextAttrs(cfg); return container.addShape('text', { attrs: { ...attrs, x: cfg.x, y: cfg.y, }, }); }, }); }; renderChart = Debounce((nextProps: TagCloudProps) => { // const colors = ['#1890FF', '#41D9C7', '#2FC25B', '#FACC14', '#9AE65C']; const { data, height } = nextProps || this.props; if (data.length < 1 || !this.root) { return; } const h = height; const w = this.root.offsetWidth; const onload = () => { const dv = new DataSet.View().source(data); const range = dv.range('value'); const [min, max] = range; dv.transform({ type: 'tag-cloud', fields: ['name', 'value'], imageMask: this.imageMask, font: 'Verdana', size: [w, h], // 宽高设置最好根据 imageMask 做调整 padding: 0, timeInterval: 5000, // max execute time rotate() { return 0; }, fontSize(d: { value: number }) { const size = ((d.value - min) / (max - min)) ** 2; return size * (17.5 - 5) + 5; }, }); if (this.isUnmount) { return; } this.setState({ dv, width: w, height: h, }); }; if (!this.imageMask) { this.imageMask = new Image(); this.imageMask.crossOrigin = ''; this.imageMask.src = imgUrl; this.imageMask.onload = onload; } else { onload(); } }, 500); render() { const { className, height } = this.props; const { dv, width, height: stateHeight } = this.state; return ( <div className={classNames(styles.tagCloud, className)} style={{ width: '100%', height }} ref={this.saveRootRef} > {dv && ( <Chart width={width} height={stateHeight} data={dv} padding={0} scale={{ x: { nice: false }, y: { nice: false }, }} > <Tooltip showTitle={false} /> <Coord reflect="y" /> <Geom type="point" position="x*y" color="text" shape="cloud" tooltip={[ 'text*value', function trans(text, value) { return { name: text, value }; }, ]} /> </Chart> )} </div> ); } } export default autoHeight()(TagCloud);
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/Charts/TimelineChart/index.tsx
TypeScript (TSX)
import { Axis, Chart, Geom, Legend, Tooltip } from 'bizcharts'; import DataSet from '@antv/data-set'; import Slider from 'bizcharts-plugin-slider'; import React from 'react'; import autoHeight from '../autoHeight'; import styles from './index.less'; export type TimelineChartProps = { data: { x: number; y1: number; y2: number; }[]; title?: string; titleMap: { y1: string; y2: string }; padding?: [number, number, number, number]; height?: number; style?: React.CSSProperties; borderWidth?: number; }; const TimelineChart: React.FC<TimelineChartProps> = (props) => { const { title, height = 400, padding = [60, 20, 40, 40] as [number, number, number, number], titleMap = { y1: 'y1', y2: 'y2', }, borderWidth = 2, data: sourceData, } = props; const data = Array.isArray(sourceData) ? sourceData : [{ x: 0, y1: 0, y2: 0 }]; data.sort((a, b) => a.x - b.x); let max; if (data[0] && data[0].y1 && data[0].y2) { max = Math.max( [...data].sort((a, b) => b.y1 - a.y1)[0].y1, [...data].sort((a, b) => b.y2 - a.y2)[0].y2, ); } const ds = new DataSet({ state: { start: data[0].x, end: data[data.length - 1].x, }, }); const dv = ds.createView(); dv.source(data) .transform({ type: 'filter', callback: (obj: { x: string }) => { const date = obj.x; return date <= ds.state.end && date >= ds.state.start; }, }) .transform({ type: 'map', callback(row: { y1: string; y2: string }) { const newRow = { ...row }; newRow[titleMap.y1] = row.y1; newRow[titleMap.y2] = row.y2; return newRow; }, }) .transform({ type: 'fold', fields: [titleMap.y1, titleMap.y2], // 展开字段集 key: 'key', // key字段 value: 'value', // value字段 }); const timeScale = { type: 'time', tickInterval: 60 * 60 * 1000, mask: 'HH:mm', range: [0, 1], }; const cols = { x: timeScale, value: { max, min: 0, }, }; const SliderGen = () => ( <Slider padding={[0, padding[1] + 20, 0, padding[3]]} width="auto" height={26} xAxis="x" yAxis="y1" scales={{ x: timeScale }} data={data} start={ds.state.start} end={ds.state.end} backgroundChart={{ type: 'line' }} onChange={({ startValue, endValue, }: { startValue: string; endValue: string; }) => { ds.setState('start', startValue); ds.setState('end', endValue); }} /> ); return ( <div className={styles.timelineChart} style={{ height: height + 30 }}> <div> {title && <h4>{title}</h4>} <Chart height={height} padding={padding} data={dv} scale={cols} forceFit > <Axis name="x" /> <Tooltip /> <Legend name="key" position="top" /> <Geom type="line" position="x*value" size={borderWidth} color="key" /> </Chart> <div style={{ marginRight: -20 }}> <SliderGen /> </div> </div> </div> ); }; export default autoHeight()(TimelineChart);
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/Charts/WaterWave/index.tsx
TypeScript (TSX)
import React, { Component } from 'react'; import autoHeight from '../autoHeight'; import styles from './index.less'; /* eslint no-return-assign: 0 */ /* eslint no-mixed-operators: 0 */ // riddle: https://riddle.alibaba-inc.com/riddles/2d9a4b90 export type WaterWaveProps = { title: React.ReactNode; color?: string; height?: number; percent: number; style?: React.CSSProperties; }; class WaterWave extends Component<WaterWaveProps> { state = { radio: 1, }; timer: number = 0; root: HTMLDivElement | undefined | null = null; node: HTMLCanvasElement | undefined | null = null; componentDidMount() { this.renderChart(); this.resize(); window.addEventListener( 'resize', () => { irAnimationFrame(() => this.resize()); }, { passive: true }, ); } componentDidUpdate(props: WaterWaveProps) { const { percent } = this.props; if (props.percent !== percent) { // 不加这个会造成绘制缓慢 this.renderChart('update'); } } componentWillUnmount() { cancelAnimationFrame(this.timer); if (this.node) { this.node.innerHTML = ''; } window.removeEventListener('resize', this.resize); } resize = () => { if (this.root) { const { height = 1 } = this.props; const { offsetWidth } = this.root.parentNode as HTMLElement; this.setState({ radio: offsetWidth < height ? offsetWidth / height : 1, }); } }; renderChart(type?: string) { const { percent, color = '#1890FF' } = this.props; const data = percent / 100; cancelAnimationFrame(this.timer); if (!this.node || (data !== 0 && !data)) { return; } const canvas = this.node; const ctx = canvas.getContext('2d'); if (!ctx) { return; } const canvasWidth = canvas.width; const canvasHeight = canvas.height; const radius = canvasWidth / 2; const lineWidth = 2; const cR = radius - lineWidth; ctx.beginPath(); ctx.lineWidth = lineWidth * 2; const axisLength = canvasWidth - lineWidth; const unit = axisLength / 8; const range = 0.2; // 振幅 let currRange = range; const xOffset = lineWidth; let sp = 0; // 周期偏移量 let currData = 0; const waveupsp = 0.005; // 水波上涨速度 let arcStack: number[][] = []; const bR = radius - lineWidth; const circleOffset = -(Math.PI / 2); let circleLock = true; for ( let i = circleOffset; i < circleOffset + 2 * Math.PI; i += 1 / (8 * Math.PI) ) { arcStack.push([radius + bR * Math.cos(i), radius + bR * Math.sin(i)]); } const cStartPoint = arcStack.shift() as number[]; ctx.strokeStyle = color; ctx.moveTo(cStartPoint[0], cStartPoint[1]); const drawSin = () => { if (!ctx) { return; } ctx.beginPath(); ctx.save(); const sinStack = []; for (let i = xOffset; i <= xOffset + axisLength; i += 20 / axisLength) { const x = sp + (xOffset + i) / unit; const y = Math.sin(x) * currRange; const dx = i; const dy = 2 * cR * (1 - currData) + (radius - cR) - unit * y; ctx.lineTo(dx, dy); sinStack.push([dx, dy]); } const startPoint = sinStack.shift() as number[]; ctx.lineTo(xOffset + axisLength, canvasHeight); ctx.lineTo(xOffset, canvasHeight); ctx.lineTo(startPoint[0], startPoint[1]); const gradient = ctx.createLinearGradient(0, 0, 0, canvasHeight); gradient.addColorStop(0, '#ffffff'); gradient.addColorStop(1, color); ctx.fillStyle = gradient; ctx.fill(); ctx.restore(); }; const render = () => { if (!ctx) { return; } ctx.clearRect(0, 0, canvasWidth, canvasHeight); if (circleLock && type !== 'update') { if (arcStack.length) { const temp = arcStack.shift() as number[]; ctx.lineTo(temp[0], temp[1]); ctx.stroke(); } else { circleLock = false; ctx.lineTo(cStartPoint[0], cStartPoint[1]); ctx.stroke(); arcStack = []; ctx.globalCompositeOperation = 'destination-over'; ctx.beginPath(); ctx.lineWidth = lineWidth; ctx.arc(radius, radius, bR, 0, 2 * Math.PI, true); ctx.beginPath(); ctx.save(); ctx.arc(radius, radius, radius - 3 * lineWidth, 0, 2 * Math.PI, true); ctx.restore(); ctx.clip(); ctx.fillStyle = color; } } else { if (data >= 0.85) { if (currRange > range / 4) { const t = range * 0.01; currRange -= t; } } else if (data <= 0.1) { if (currRange < range * 1.5) { const t = range * 0.01; currRange += t; } } else { if (currRange <= range) { const t = range * 0.01; currRange += t; } if (currRange >= range) { const t = range * 0.01; currRange -= t; } } if (data - currData > 0) { currData += waveupsp; } if (data - currData < 0) { currData -= waveupsp; } sp += 0.07; drawSin(); } this.timer = irAnimationFrame(render); }; render(); } render() { const { radio } = this.state; const { percent, title, height = 1 } = this.props; return ( <div className={styles.waterWave} ref={(n) => (this.root = n)} style={{ transform: `scale(${radio})` }} > <div style={{ width: height, height, overflow: 'hidden' }}> <canvas className={styles.waterWaveCanvasWrapper} ref={(n) => (this.node = n)} width={height * 2} height={height * 2} /> </div> <div className={styles.text} style={{ width: height }}> {title && <span>{title}</span>} <h4>{percent}%</h4> </div> </div> ); } } export default autoHeight()(WaterWave);
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/Charts/autoHeight.tsx
TypeScript (TSX)
import React from 'react'; export type IReactComponent<P = any> = | React.StatelessComponent<P> | React.ComponentClass<P> | React.ClassicComponentClass<P>; function computeHeight(node: HTMLDivElement) { const { style } = node; style.height = '100%'; const totalHeight = parseInt(`${getComputedStyle(node).height}`, 10); const padding = parseInt(`${getComputedStyle(node).paddingTop}`, 10) + parseInt(`${getComputedStyle(node).paddingBottom}`, 10); return totalHeight - padding; } function getAutoHeight(n: HTMLDivElement | undefined) { if (!n) { return 0; } const node = n; let height = computeHeight(node); const parentNode = node.parentNode as HTMLDivElement; if (parentNode) { height = computeHeight(parentNode); } return height; } type AutoHeightProps = { height?: number; }; function autoHeight() { return <P extends AutoHeightProps>( WrappedComponent: React.ComponentClass<P> | React.FC<P>, ): React.ComponentClass<P> => { class AutoHeightComponent extends React.Component<P & AutoHeightProps> { state = { computedHeight: 0, }; root: HTMLDivElement | undefined = undefined; componentDidMount() { const { height } = this.props; if (!height) { let h = getAutoHeight(this.root); this.setState({ computedHeight: h }); if (h < 1) { h = getAutoHeight(this.root); this.setState({ computedHeight: h }); } } } handleRoot = (node: HTMLDivElement) => { this.root = node; }; render() { const { height } = this.props; const { computedHeight } = this.state; const h = height || computedHeight; return ( <div ref={this.handleRoot}> {h > 0 && <WrappedComponent {...this.props} height={h} />} </div> ); } } return AutoHeightComponent; }; } export default autoHeight;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/Charts/index.less
LESS
.miniChart { position: relative; width: 100%; .chartContent { position: absolute; bottom: -28px; width: 100%; > div { margin: 0 -5px; overflow: hidden; } } .chartLoading { position: absolute; top: 16px; left: 50%; margin-left: -7px; } }
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/Charts/index.tsx
TypeScript (TSX)
import numeral from 'numeral'; import ChartCard from './ChartCard'; import Field from './Field'; const yuan = (val: number | string) => `¥ ${numeral(val).format('0,0')}`; const Charts = { yuan, ChartCard, Field, }; export { Charts as default, yuan, ChartCard, Field };
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/IntroduceRow.tsx
TypeScript (TSX)
import { Progress, TinyArea, TinyColumn } from '@ant-design/charts'; import { InfoCircleOutlined } from '@ant-design/icons'; import { Col, Row, Tooltip } from 'antd'; import numeral from 'numeral'; import type { DataItem } from '../data.d'; import styles from '../style.less'; import Yuan from '../utils/Yuan'; import { ChartCard, Field } from './Charts'; import Trend from './Trend'; const topColResponsiveProps = { xs: 24, sm: 12, md: 12, lg: 12, xl: 6, style: { marginBottom: 24 }, }; const IntroduceRow = ({ loading, visitData = [], }: { loading: boolean; visitData: DataItem[]; }) => ( <Row gutter={24}> <Col {...topColResponsiveProps}> <ChartCard bordered={false} title="总销售额" action={ <Tooltip title="指标说明"> <InfoCircleOutlined /> </Tooltip> } loading={loading} total={() => <Yuan>126560</Yuan>} footer={ <Field label="日销售额" value={`¥${numeral(12423).format('0,0')}`} /> } contentHeight={46} > <Trend flag="up" style={{ marginRight: 16 }}> 周同比 <span className={styles.trendText}>12%</span> </Trend> <Trend flag="down"> 日同比 <span className={styles.trendText}>11%</span> </Trend> </ChartCard> </Col> <Col {...topColResponsiveProps}> <ChartCard bordered={false} loading={loading} title="访问量" action={ <Tooltip title="指标说明"> <InfoCircleOutlined /> </Tooltip> } total={numeral(8846).format('0,0')} footer={<Field label="日访问量" value={numeral(1234).format('0,0')} />} contentHeight={46} > <TinyArea height={46} autoFit smooth areaStyle={{ fill: 'l(270) 0:rgb(151 95 228 / 10%) 0.5:rgb(151 95 228 / 60%) 1:rgb(151 95 228)', }} line={{ color: '#975FE4', }} data={visitData.map((item) => item.y)} /> </ChartCard> </Col> <Col {...topColResponsiveProps}> <ChartCard bordered={false} loading={loading} title="支付笔数" action={ <Tooltip title="指标说明"> <InfoCircleOutlined /> </Tooltip> } total={numeral(6560).format('0,0')} footer={<Field label="转化率" value="60%" />} contentHeight={46} > <TinyColumn height={46} autoFit data={visitData.map((item) => item.y)} /> </ChartCard> </Col> <Col {...topColResponsiveProps}> <ChartCard loading={loading} bordered={false} title="运营活动效果" action={ <Tooltip title="指标说明"> <InfoCircleOutlined /> </Tooltip> } total="78%" footer={ <div style={{ whiteSpace: 'nowrap', overflow: 'hidden' }}> <Trend flag="up" style={{ marginRight: 16 }}> 周同比 <span className={styles.trendText}>12%</span> </Trend> <Trend flag="down"> 日同比 <span className={styles.trendText}>11%</span> </Trend> </div> } contentHeight={46} > <Progress height={46} padding={[15, 0]} percent={0.78} color="#13C2C2" autoFit annotations={[ { type: 'line', start: ['80%', '0%'], end: ['80%', '100%'], style: { stroke: '#13C2C2', }, }, ]} /> </ChartCard> </Col> </Row> ); export default IntroduceRow;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/NumberInfo/index.less
LESS
@import '~antd/es/style/themes/default.less'; .numberInfo { .suffix { margin-left: 4px; color: @text-color; font-size: 16px; font-style: normal; } .numberInfoTitle { margin-bottom: 16px; color: @text-color; font-size: @font-size-lg; transition: all 0.3s; } .numberInfoSubTitle { height: 22px; overflow: hidden; color: @text-color-secondary; font-size: @font-size-base; line-height: 22px; white-space: nowrap; text-overflow: ellipsis; word-break: break-all; } .numberInfoValue { margin-top: 4px; overflow: hidden; font-size: 0; white-space: nowrap; text-overflow: ellipsis; word-break: break-all; & > span { display: inline-block; height: 32px; margin-right: 32px; color: @heading-color; font-size: 24px; line-height: 32px; } .subTotal { margin-right: 0; color: @text-color-secondary; font-size: @font-size-lg; vertical-align: top; .anticon { margin-left: 4px; font-size: 12px; transform: scale(0.82); } :global { .anticon-caret-up { color: @red-6; } .anticon-caret-down { color: @green-6; } } } } } .numberInfolight { .numberInfoValue { & > span { color: @text-color; } } }
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/NumberInfo/index.tsx
TypeScript (TSX)
import { CaretDownOutlined, CaretUpOutlined } from '@ant-design/icons'; import classNames from 'classnames'; import React from 'react'; import styles from './index.less'; export type NumberInfoProps = { title?: React.ReactNode | string; subTitle?: React.ReactNode | string; total?: React.ReactNode | string; status?: 'up' | 'down'; theme?: string; gap?: number; subTotal?: number; suffix?: string; style?: React.CSSProperties; }; const NumberInfo: React.FC<NumberInfoProps> = ({ theme, title, subTitle, total, subTotal, status, suffix, gap, ...rest }) => ( <div className={classNames(styles.numberInfo, { [styles[`numberInfo${theme}`]]: theme, })} {...rest} > {title && ( <div className={styles.numberInfoTitle} title={typeof title === 'string' ? title : ''} > {title} </div> )} {subTitle && ( <div className={styles.numberInfoSubTitle} title={typeof subTitle === 'string' ? subTitle : ''} > {subTitle} </div> )} <div className={styles.numberInfoValue} style={gap ? { marginTop: gap } : {}} > <span> {total} {suffix && <em className={styles.suffix}>{suffix}</em>} </span> {(status || subTotal) && ( <span className={styles.subTotal}> {subTotal} {status && status === 'up' ? ( <CaretUpOutlined /> ) : ( <CaretDownOutlined /> )} </span> )} </div> </div> ); export default NumberInfo;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/OfflineData.tsx
TypeScript (TSX)
import { Line, RingProgress } from '@ant-design/charts'; import { Card, Col, Row, Tabs } from 'antd'; import type { DataItem, OfflineDataType } from '../data.d'; import styles from '../style.less'; import NumberInfo from './NumberInfo'; const CustomTab = ({ data, currentTabKey: currentKey, }: { data: OfflineDataType; currentTabKey: string; }) => ( <Row gutter={8} style={{ width: 138, margin: '8px 0' }}> <Col span={12}> <NumberInfo title={data.name} subTitle="转化率" gap={2} total={`${data.cvr * 100}%`} theme={currentKey !== data.name ? 'light' : undefined} /> </Col> <Col span={12} style={{ paddingTop: 36 }}> <RingProgress autoFit height={60} innerRadius={0.7} width={60} percent={data.cvr} statistic={{ title: false, content: false, }} /> </Col> </Row> ); const { TabPane } = Tabs; const OfflineData = ({ activeKey, loading, offlineData, offlineChartData, handleTabChange, }: { activeKey: string; loading: boolean; offlineData: OfflineDataType[]; offlineChartData: DataItem[]; handleTabChange: (activeKey: string) => void; }) => ( <Card loading={loading} className={styles.offlineCard} bordered={false} style={{ marginTop: 32 }} > <Tabs activeKey={activeKey} onChange={handleTabChange}> {offlineData.map((shop) => ( <TabPane tab={<CustomTab data={shop} currentTabKey={activeKey} />} key={shop.name} > <div style={{ padding: '0 24px' }}> <Line autoFit height={400} data={offlineChartData} xField="date" yField="value" seriesField="type" slider={{ start: 0.1, end: 0.5, }} interactions={[ { type: 'slider', cfg: {}, }, ]} legend={{ position: 'top', }} /> </div> </TabPane> ))} </Tabs> </Card> ); export default OfflineData;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/PageLoading/index.tsx
TypeScript (TSX)
import { Spin } from 'antd'; // loading components from code split // https://umijs.org/plugin/umi-plugin-react.html#dynamicimport export default () => ( <div style={{ paddingTop: 100, textAlign: 'center' }}> <Spin size="large" /> </div> );
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/ProportionSales.tsx
TypeScript (TSX)
import type { PieConfig } from '@ant-design/charts'; import { Pie } from '@ant-design/charts'; import { Card, Radio, Typography } from 'antd'; import type { RadioChangeEvent } from 'antd/es/radio'; import numeral from 'numeral'; import React from 'react'; import type { DataItem } from '../data.d'; import styles from '../style.less'; const { Text } = Typography; const ProportionSales = ({ dropdownGroup, salesType, loading, salesPieData, handleChangeSalesType, }: { loading: boolean; dropdownGroup: React.ReactNode; salesType: 'all' | 'online' | 'stores'; salesPieData: DataItem[]; handleChangeSalesType?: (e: RadioChangeEvent) => void; }) => { const pieConfig: PieConfig = { autoFit: true, height: 300, data: salesPieData, radius: 1, innerRadius: 0.64, angleField: 'y', colorField: 'x', legend: false, label: { type: 'spider', formatter: (text, item) => { // eslint-disable-next-line no-underscore-dangle return `${item._origin.x}: ${numeral(item._origin.y).format('0,0')}`; }, }, statistic: { title: { content: '销售额', }, }, }; return ( <Card loading={loading} className={styles.salesCard} bordered={false} title="销售额类别占比" style={{ height: '100%', }} extra={ <div className={styles.salesCardExtra}> {dropdownGroup} <div className={styles.salesTypeRadio}> <Radio.Group value={salesType} onChange={handleChangeSalesType}> <Radio.Button value="all">全部渠道</Radio.Button> <Radio.Button value="online">线上</Radio.Button> <Radio.Button value="stores">门店</Radio.Button> </Radio.Group> </div> </div> } > <div> <Text>销售额</Text> <Pie {...pieConfig} /> </div> </Card> ); }; export default ProportionSales;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/SalesCard.tsx
TypeScript (TSX)
import { Column } from '@ant-design/charts'; import { Card, Col, DatePicker, Row, Tabs } from 'antd'; import type { RangePickerProps } from 'antd/es/date-picker/generatePicker'; import type moment from 'moment'; import numeral from 'numeral'; import type { DataItem } from '../data.d'; import styles from '../style.less'; type RangePickerValue = RangePickerProps<moment.Moment>['value']; export type TimeType = 'today' | 'week' | 'month' | 'year'; const { RangePicker } = DatePicker; const { TabPane } = Tabs; const rankingListData: { title: string; total: number }[] = []; for (let i = 0; i < 7; i += 1) { rankingListData.push({ title: `工专路 ${i} 号店`, total: 323234, }); } const SalesCard = ({ rangePickerValue, salesData, isActive, handleRangePickerChange, loading, selectDate, }: { rangePickerValue: RangePickerValue; isActive: (key: TimeType) => string; salesData: DataItem[]; loading: boolean; handleRangePickerChange: ( dates: RangePickerValue, dateStrings: [string, string], ) => void; selectDate: (key: TimeType) => void; }) => ( <Card loading={loading} bordered={false} bodyStyle={{ padding: 0 }}> <div className={styles.salesCard}> <Tabs tabBarExtraContent={ <div className={styles.salesExtraWrap}> <div className={styles.salesExtra}> <a className={isActive('today')} onClick={() => selectDate('today')} > 今日 </a> <a className={isActive('week')} onClick={() => selectDate('week')} > 本周 </a> <a className={isActive('month')} onClick={() => selectDate('month')} > 本月 </a> <a className={isActive('year')} onClick={() => selectDate('year')} > 本年 </a> </div> <RangePicker value={rangePickerValue} onChange={handleRangePickerChange} style={{ width: 256 }} /> </div> } size="large" tabBarStyle={{ marginBottom: 24 }} > <TabPane tab="销售额" key="sales"> <Row> <Col xl={16} lg={12} md={12} sm={24} xs={24}> <div className={styles.salesBar}> <Column height={300} autoFit data={salesData} xField="x" yField="y" xAxis={{ title: null, }} yAxis={{ title: null, }} meta={{ y: { alias: '销售量', }, }} /> </div> </Col> <Col xl={8} lg={12} md={12} sm={24} xs={24}> <div className={styles.salesRank}> <h4 className={styles.rankingTitle}>门店销售额排名</h4> <ul className={styles.rankingList}> {rankingListData.map((item, i) => ( <li key={item.title}> <span className={`${styles.rankingItemNumber} ${ i < 3 ? styles.active : '' }`} > {i + 1} </span> <span className={styles.rankingItemTitle} title={item.title} > {item.title} </span> <span className={styles.rankingItemValue}> {numeral(item.total).format('0,0')} </span> </li> ))} </ul> </div> </Col> </Row> </TabPane> <TabPane tab="访问量" key="views"> <Row> <Col xl={16} lg={12} md={12} sm={24} xs={24}> <div className={styles.salesBar}> <Column height={300} autoFit data={salesData} xField="x" yField="y" xAxis={{ title: null, }} yAxis={{ title: null, }} meta={{ y: { alias: '访问量', }, }} /> </div> </Col> <Col xl={8} lg={12} md={12} sm={24} xs={24}> <div className={styles.salesRank}> <h4 className={styles.rankingTitle}>门店访问量排名</h4> <ul className={styles.rankingList}> {rankingListData.map((item, i) => ( <li key={item.title}> <span className={`${styles.rankingItemNumber} ${ i < 3 ? styles.active : '' }`} > {i + 1} </span> <span className={styles.rankingItemTitle} title={item.title} > {item.title} </span> <span>{numeral(item.total).format('0,0')}</span> </li> ))} </ul> </div> </Col> </Row> </TabPane> </Tabs> </div> </Card> ); export default SalesCard;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/TopSearch.tsx
TypeScript (TSX)
import { TinyArea } from '@ant-design/charts'; import { InfoCircleOutlined } from '@ant-design/icons'; import { Card, Col, Row, Table, Tooltip } from 'antd'; import numeral from 'numeral'; import React from 'react'; import type { DataItem } from '../data.d'; import styles from '../style.less'; import NumberInfo from './NumberInfo'; import Trend from './Trend'; const columns = [ { title: '排名', dataIndex: 'index', key: 'index', }, { title: '搜索关键词', dataIndex: 'keyword', key: 'keyword', render: (text: React.ReactNode) => <a href="/">{text}</a>, }, { title: '用户数', dataIndex: 'count', key: 'count', sorter: (a: { count: number }, b: { count: number }) => a.count - b.count, className: styles.alignRight, }, { title: '周涨幅', dataIndex: 'range', key: 'range', sorter: (a: { range: number }, b: { range: number }) => a.range - b.range, render: (text: React.ReactNode, record: { status: number }) => ( <Trend flag={record.status === 1 ? 'down' : 'up'}> <span style={{ marginRight: 4 }}>{text}%</span> </Trend> ), }, ]; const TopSearch = ({ loading, visitData2 = [], searchData = [], dropdownGroup, }: { loading: boolean; visitData2?: DataItem[]; searchData?: DataItem[]; dropdownGroup: React.ReactNode; }) => ( <Card loading={loading} bordered={false} title="线上热门搜索" extra={dropdownGroup} style={{ height: '100%', }} > <Row gutter={68}> <Col sm={12} xs={24} style={{ marginBottom: 24 }}> <NumberInfo subTitle={ <span> 搜索用户数 <Tooltip title="指标说明"> <InfoCircleOutlined style={{ marginLeft: 8 }} /> </Tooltip> </span> } gap={8} total={numeral(12321).format('0,0')} status="up" subTotal={17.1} /> <TinyArea height={45} autoFit smooth data={visitData2.map((item) => item.y)} /> </Col> <Col sm={12} xs={24} style={{ marginBottom: 24 }}> <NumberInfo subTitle={ <span> 人均搜索次数 <Tooltip title="指标说明"> <InfoCircleOutlined style={{ marginLeft: 8 }} /> </Tooltip> </span> } total={2.7} status="down" subTotal={26.2} gap={8} /> <TinyArea height={45} autoFit smooth data={visitData2.map((item) => item.y)} /> </Col> </Row> <Table<any> rowKey={(record) => record.index} size="small" columns={columns} dataSource={searchData} pagination={{ style: { marginBottom: 0 }, pageSize: 5, }} /> </Card> ); export default TopSearch;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/Trend/index.less
LESS
@import '~antd/es/style/themes/default.less'; .trendItem { display: inline-block; font-size: @font-size-base; line-height: 22px; .up, .down { position: relative; top: 1px; margin-left: 4px; span { font-size: 12px; transform: scale(0.83); } } .up { color: @red-6; } .down { top: -1px; color: @green-6; } &.trendItemGrey .up, &.trendItemGrey .down { color: @text-color; } &.reverseColor .up { color: @green-6; } &.reverseColor .down { color: @red-6; } }
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/components/Trend/index.tsx
TypeScript (TSX)
import { CaretDownOutlined, CaretUpOutlined } from '@ant-design/icons'; import classNames from 'classnames'; import React from 'react'; import styles from './index.less'; export type TrendProps = { colorful?: boolean; flag: 'up' | 'down'; style?: React.CSSProperties; reverseColor?: boolean; className?: string; }; const Trend: React.FC<TrendProps> = ({ colorful = true, reverseColor = false, flag, children, className, ...rest }) => { const classString = classNames( styles.trendItem, { [styles.trendItemGrey]: !colorful, [styles.reverseColor]: reverseColor && colorful, }, className, ); return ( <div {...rest} className={classString} title={typeof children === 'string' ? children : ''} > <span>{children}</span> {flag && ( <span className={styles[flag]}> {flag === 'up' ? <CaretUpOutlined /> : <CaretDownOutlined />} </span> )} </div> ); }; export default Trend;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/data.d.ts
TypeScript
import { DataItem } from '@antv/g2plot/esm/interface/config'; export { DataItem }; export interface VisitDataType { x: string; y: number; } export type SearchDataType = { index: number; keyword: string; count: number; range: number; status: number; }; export type OfflineDataType = { name: string; cvr: number; }; export interface OfflineChartData { date: number; type: number; value: number; } export type RadarData = { name: string; label: string; value: number; }; export interface AnalysisData { visitData: DataItem[]; visitData2: DataItem[]; salesData: DataItem[]; searchData: DataItem[]; offlineData: OfflineDataType[]; offlineChartData: DataItem[]; salesTypeData: DataItem[]; salesTypeDataOnline: DataItem[]; salesTypeDataOffline: DataItem[]; radarData: RadarData[]; }
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/index.tsx
TypeScript (TSX)
import { EllipsisOutlined } from '@ant-design/icons'; import { GridContent } from '@ant-design/pro-layout'; import { Col, Dropdown, Menu, Row } from 'antd'; import type { RangePickerProps } from 'antd/es/date-picker/generatePicker'; import type { RadioChangeEvent } from 'antd/es/radio'; import type moment from 'moment'; import type { FC } from 'react'; import { Suspense, useState } from 'react'; import { useRequest } from 'umi'; import IntroduceRow from './components/IntroduceRow'; import OfflineData from './components/OfflineData'; import PageLoading from './components/PageLoading'; import ProportionSales from './components/ProportionSales'; import type { TimeType } from './components/SalesCard'; import SalesCard from './components/SalesCard'; import TopSearch from './components/TopSearch'; import type { AnalysisData } from './data.d'; import { fakeChartData } from './service'; import styles from './style.less'; import { getTimeDistance } from './utils/utils'; type RangePickerValue = RangePickerProps<moment.Moment>['value']; type HomeProps = { home: AnalysisData; loading: boolean; }; type SalesType = 'all' | 'online' | 'stores'; const Home: FC<HomeProps> = () => { const [salesType, setSalesType] = useState<SalesType>('all'); const [currentTabKey, setCurrentTabKey] = useState<string>(''); const [rangePickerValue, setRangePickerValue] = useState<RangePickerValue>( getTimeDistance('year'), ); const { loading, data } = useRequest(fakeChartData); const selectDate = (type: TimeType) => { setRangePickerValue(getTimeDistance(type)); }; const handleRangePickerChange = (value: RangePickerValue) => { setRangePickerValue(value); }; const isActive = (type: TimeType) => { if (!rangePickerValue) { return ''; } const value = getTimeDistance(type); if (!value) { return ''; } if (!rangePickerValue[0] || !rangePickerValue[1]) { return ''; } if ( rangePickerValue[0].isSame(value[0] as moment.Moment, 'day') && rangePickerValue[1].isSame(value[1] as moment.Moment, 'day') ) { return styles.currentDate; } return ''; }; let salesPieData; if (salesType === 'all') { salesPieData = data?.salesTypeData; } else { salesPieData = salesType === 'online' ? data?.salesTypeDataOnline : data?.salesTypeDataOffline; } const menu = ( <Menu> <Menu.Item>操作一</Menu.Item> <Menu.Item>操作二</Menu.Item> </Menu> ); const dropdownGroup = ( <span className={styles.iconGroup}> <Dropdown overlay={menu} placement="bottomRight"> <EllipsisOutlined /> </Dropdown> </span> ); const handleChangeSalesType = (e: RadioChangeEvent) => { setSalesType(e.target.value); }; const handleTabChange = (key: string) => { setCurrentTabKey(key); }; const activeKey = currentTabKey || (data?.offlineData[0] && data?.offlineData[0].name) || ''; return ( <GridContent> <> <Suspense fallback={<PageLoading />}> <IntroduceRow loading={loading} visitData={data?.visitData || []} /> </Suspense> <Suspense fallback={null}> <SalesCard rangePickerValue={rangePickerValue} salesData={data?.salesData || []} isActive={isActive} handleRangePickerChange={handleRangePickerChange} loading={loading} selectDate={selectDate} /> </Suspense> <Row gutter={24} style={{ marginTop: 24, }} > <Col xl={12} lg={24} md={24} sm={24} xs={24}> <Suspense fallback={null}> <TopSearch loading={loading} visitData2={data?.visitData2} searchData={data?.searchData} dropdownGroup={dropdownGroup} /> </Suspense> </Col> <Col xl={12} lg={24} md={24} sm={24} xs={24}> <Suspense fallback={null}> <ProportionSales dropdownGroup={dropdownGroup} salesType={salesType} loading={loading} salesPieData={salesPieData || []} handleChangeSalesType={handleChangeSalesType} /> </Suspense> </Col> </Row> <Suspense fallback={null}> <OfflineData activeKey={activeKey} loading={loading} offlineData={data?.offlineData || []} offlineChartData={data?.offlineChartData || []} handleTabChange={handleTabChange} /> </Suspense> </> </GridContent> ); }; export default Home;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/service.ts
TypeScript
import { ir } from 'umi'; import type { AnalysisData } from './data'; export async function fakeChartData(): Promise<{ data: AnalysisData }> { return ir('/api/fake_analysis_chart_data'); }
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/style.less
LESS
@import '~antd/es/style/themes/default.less'; .iconGroup { span.anticon { margin-left: 16px; color: @text-color-secondary; cursor: pointer; transition: color 0.32s; &:hover { color: @text-color; } } } .rankingList { margin: 25px 0 0; padding: 0; list-style: none; li { display: flex; align-items: center; margin-top: 16px; zoom: 1; &::before, &::after { display: table; content: ' '; } &::after { clear: both; height: 0; font-size: 0; visibility: hidden; } span { color: @text-color; font-size: 14px; line-height: 22px; } .rankingItemNumber { display: inline-block; width: 20px; height: 20px; margin-top: 1.5px; margin-right: 16px; font-weight: 600; font-size: 12px; line-height: 20px; text-align: center; background-color: @tag-default-bg; border-radius: 20px; &.active { color: #fff; background-color: #314659; } } .rankingItemTitle { flex: 1; margin-right: 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } } } .salesExtra { display: inline-block; margin-right: 24px; a { margin-left: 24px; color: @text-color; &:hover { color: @primary-color; } &.currentDate { color: @primary-color; } } } .salesCard { .salesBar { padding: 0 0 32px 32px; } .salesRank { padding: 0 32px 32px 72px; } :global { .ant-tabs-bar, .ant-tabs-nav-wrap { padding-left: 16px; .ant-tabs-nav .ant-tabs-tab { padding-top: 16px; padding-bottom: 14px; line-height: 24px; } } .ant-tabs-extra-content { padding-right: 24px; line-height: 55px; } .ant-card-head { position: relative; } .ant-card-head-title { align-items: normal; } } } .salesCardExtra { height: inherit; } .salesTypeRadio { position: absolute; right: 54px; bottom: 12px; } .offlineCard { :global { .ant-tabs-ink-bar { bottom: auto; } .ant-tabs-bar { border-bottom: none; } .ant-tabs-nav-container-scrolling { padding-right: 40px; padding-left: 40px; } .ant-tabs-tab-prev-icon::before { position: relative; left: 6px; } .ant-tabs-tab-next-icon::before { position: relative; right: 6px; } .ant-tabs-tab-active h4 { color: @primary-color; } } } .trendText { margin-left: 8px; color: @heading-color; } @media screen and (max-width: @screen-lg) { .salesExtra { display: none; } .rankingList { li { span:first-child { margin-right: 8px; } } } } @media screen and (max-width: @screen-md) { .rankingTitle { margin-top: 16px; } .salesCard .salesBar { padding: 16px; } } @media screen and (max-width: @screen-sm) { .salesExtraWrap { display: none; } .salesCard { :global { .ant-tabs-content { padding-top: 30px; } } } }
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/utils/Yuan.tsx
TypeScript (TSX)
import React from 'react'; import { yuan } from '../components/Charts'; /** 减少使用 dangerouslySetInnerHTML */ export default class Yuan extends React.Component<{ children: React.ReactText; }> { main: HTMLSpanElement | undefined | null = null; componentDidMount() { this.renderToHtml(); } componentDidUpdate() { this.renderToHtml(); } renderToHtml = () => { const { children } = this.props; if (this.main) { this.main.innerHTML = yuan(children); } }; render() { return ( <span ref={(ref) => { this.main = ref; }} /> ); } }
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/utils/utils.less
LESS
.textOverflow() { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; word-break: break-all; } .textOverflowMulti(@line: 3, @bg: #fff) { position: relative; max-height: @line * 1.5em; margin-right: -1em; padding-right: 1em; overflow: hidden; line-height: 1.5em; text-align: justify; &::before { position: absolute; right: 14px; bottom: 0; padding: 0 1px; background: @bg; content: '...'; } &::after { position: absolute; right: 14px; width: 1em; height: 1em; margin-top: 0.2em; background: white; content: ''; } } // mixins for clearfix // ------------------------ .clearfix() { zoom: 1; &::before, &::after { display: table; content: ' '; } &::after { clear: both; height: 0; font-size: 0; visibility: hidden; } }
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/home/utils/utils.ts
TypeScript
import type { RangePickerProps } from 'antd/es/date-picker/generatePicker'; import moment from 'moment'; type RangePickerValue = RangePickerProps<moment.Moment>['value']; export function fixedZero(val: number) { return val * 1 < 10 ? `0${val}` : val; } export function getTimeDistance( type: 'today' | 'week' | 'month' | 'year', ): RangePickerValue { const now = new Date(); const oneDay = 1000 * 60 * 60 * 24; if (type === 'today') { now.setHours(0); now.setMinutes(0); now.setSeconds(0); return [moment(now), moment(now.getTime() + (oneDay - 1000))]; } if (type === 'week') { let day = now.getDay(); now.setHours(0); now.setMinutes(0); now.setSeconds(0); if (day === 0) { day = 6; } else { day -= 1; } const beginTime = now.getTime() - day * oneDay; return [moment(beginTime), moment(beginTime + (7 * oneDay - 1000))]; } const year = now.getFullYear(); if (type === 'month') { const month = now.getMonth(); const nextDate = moment(now).add(1, 'months'); const nextYear = nextDate.year(); const nextMonth = nextDate.month(); return [ moment(`${year}-${fixedZero(month + 1)}-01 00:00:00`), moment( moment( `${nextYear}-${fixedZero(nextMonth + 1)}-01 00:00:00`, ).valueOf() - 1000, ), ]; } return [moment(`${year}-01-01 00:00:00`), moment(`${year}-12-31 23:59:59`)]; }
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/src/pages/index.tsx
TypeScript (TSX)
import { Button } from 'antd'; const Page = () => { return ( <div> <Button>1243</Button> </div> ); }; export default Page;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/blocks/typings.d.ts
TypeScript
import "inula/typings";
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/boilerplate/.inularc.ts
TypeScript
import { defineConfig } from 'inula'; export default defineConfig({ title: 'boilerplate', });
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/boilerplate/src/pages/index.tsx
TypeScript (TSX)
import { useStore } from 'inula'; const Page = () => { const store = useStore('hello'); return ( <div> hello {store.title} <button onClick={() => { store.changeName(); }} > 改名字啦 </button> </div> ); }; export default Page;
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/boilerplate/src/pages/store.ts
TypeScript
import { createStore } from 'inula'; export default createStore({ id: 'hello12', actions: { changeName: (state) => { state.title = 'openinula'; }, }, state: { title: 'inulajs', }, });
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/boilerplate/src/stores/hello.ts
TypeScript
import { createStore } from 'inula'; export default createStore({ id: 'hello', actions: { changeName: (state) => { state.title = 'openinula'; }, }, state: { title: 'inulajs', }, });
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/boilerplate/typings.d.ts
TypeScript
import "inula/typings";
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/cli/sdasd.js
JavaScript
const a = 'a12312'; const v = 'a12312'; const d = 'a12312';
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/intl/.inularc.ts
TypeScript
import { defineConfig } from 'inula'; export default defineConfig({ title: 'inula-intl', });
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏
examples/intl/src/locales/ar-EG.ts
TypeScript
export default { 'navBar.lang': 'لغة', 'layout.user.link.help': 'مساعده', 'layout.user.link.privacy': 'الخصوصية', 'layout.user.link.terms': 'شروط', 'app.preview.down.block': 'تنزيل هذه الصفحة إلى المشروع المحلي', 'app.welcome.link.fetch-blocks': 'الحصول على جميع الكتل', 'app.welcome.link.block-list': 'تطوير بناءً على الكتل ، بناء صفحات قياسية بسرعة', };
xiaohuoni/inula
0
TypeScript
xiaohuoni
聪小陈
浮光陈氏