【VC开源代码栏目提醒】:网学会员为需要VC开源代码的朋友们搜集整理了synfilt.cpp相关资料,希望对各位网友有所帮助!
/* synfilt.cpp
Synthesis Filter implementation */
/* -- 03/20/97 --
* compute_new_v() -- reoptimized with the assumption that constant offsets
* to memory are free. Common subexpression were redone for better
* optimization.
* compute_pcm_samples() -- reoptimized with constant offsets.
*
* -- Conrad Wei-Li Song (conradsong@mail.utexas.edu)
*/
/*
* @(#) synthesis_filter.cc 1.14, last edit: 6/21/94 11:22:20
* @(#) Copyright (C) 1993, 1994 Tobias Bading (bading@cs.tu-berlin.de)
* @(#) Berlin University of Technology
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* Changes from version 1.1 to 1.2:
* - compute_new_v() uses a 32 point fast cosine transform as described by
* Byeong Gi Lee in IEEE Transactions ASSP-32 Part 2, August 1984,
* "A New Algorithm to Compute the Discrete Cosine Transform"
* instead of the matrix-vector multiplication in V1.1
* - loop unrolling done in compute_pcm_samples()
* - if ULAW is defined, the synthesis filter does a downsampling
* to 8 kHz by dropping samples and ignoring subbands above 4 kHz
*/
#include <math.h>
#include "all.h"
#include "synfilt.h"
#define MY_PI 3.14323846
#include "scalfact.h"
#ifdef __WIN32__
#pragma warning (disable: 4244 4305)
#endif
static const real cos1_64 = (real)(1.0 / (2.0 * cos(MY_PI / 64.0)));
static const real cos3_64 = (real)(.0 / (2.0 * cos(MY_PI * 3.0 / 64.0)));
static const real cos5_64 = (real)(1.0 / (2.0 * cos(MY_PI * 5.0 / 64.0)));
static const real cos7_64 = (real)(1.0 / (2.0 * cos(MY_PI * 7.0 / 64.0)));
static const real cos9_64 = (real)(1.0 / (2.0 * cos(MY_PI * 9.0 / 64.0)));
static const real cos11_64 = (real)(1.0 / (2.0 * cos(MY_PI * 11.0 / 64.0)));
static const real cos13_64 = (real)(1.0 / (2.0 * cos(MY_PI * 13.0 / 64.0)));
static const real cos15_64 = (real)(1.0 / (2.0 * cos(MY_PI * 15.0 / 64.0)));
static const real cos17_64 = (real)(1.0 / (2.0 * cos(MY_PI * 17.0 / 64.0)));
static const real cos19_64 = (real)(1.0 / (2.0 * cos(MY_PI * 19.0 / 64.0)));
static const real cos21_64 = (real)(1.0 / (2.0 * cos(MY_PI * 21.0 / 64.0)));
static const real cos23_64 = (real)(1.0 / (2.0 * cos(MY_PI * 23.0 / 64.0)));
static const real cos25_64 = (real)(1.0 / (2.0 * cos(MY_PI * 25.0 / 64.0)));
static const real cos27_64 = (real)(1.0 / (2.0 * cos(MY_PI * 27.0 / 64.0)));
static const real cos29_64 = (real)(1.0 / (2.0 * cos(MY_PI * 29.0 / 64.0)));
static const real cos31_64 = (real)(1.0 / (2.0 * cos(MY_PI * 31.0 / 64.0)));
static const real cos1_32 = (real)(1.0 / (2.0 * cos(MY_PI / 32.0)));
static const real cos3_32 = (real)(1.0 / (2.0 * cos(MY_PI * 3.0 / 32.0)));
static const real cos5_32 = (real)(1.0 / (2.0 * cos(MY_PI * 5.0 / 32.0)));
static const real cos7_32 = (real)(1.0 / (2.0 * cos(MY_PI * 7.0 / 32.0)));
static const real cos9_32 = (real)(1.0 / (2.0 * cos(MY_PI * 9.0 / 32.0)));
static const real cos11_32 = (real)(1.0 / (2.0 * cos(MY_PI * 11.0 / 32.0)));
static const real cos13_32 = (real)(1.0 / (2.0 * cos(MY_PI * 13.0 / 32.0)));
static const real cos15_32 = (real)(1.0 / (2.0 * cos(MY_PI * 15.0 / 32.0)));
static const real cos1_16 = (real)(1.0 / (2.0 * cos(MY_PI / 16.0)));
static const real cos3_16 = (real)(1.0 / (2.0 * cos(MY_PI * 3.0 / 16.0)));
static const real cos5_16 = (real)(1.0 / (2.0 * cos(MY_PI * 5.0 / 16.0)));
static const real cos7_16 = (real)(1.0 / (2.0 * cos(MY_PI * 7.0 / 16.0)));
static const real cos1_8 = (real)(1.0 / (2.0 * cos(MY_PI / 8.0)));
static const real cos3_8 = (real)(1.0 / (2.0 * cos(MY_PI * 3.0 / 8.0)));
static const real cos1_4 = (real)(1.0 / (2.0 * cos(MY_PI / 4.0)));
const real SynthesisFilter::d[512] = {
// Note: These values are not in the same order
// as in Annex 3-B.3 of the ISO/IEC DIS 11172-3
0.000000000f, -0.000442505f, 0.003250122f, -0.007003784f,
0.031082153f, -0.078628540f, 0.100311279f, -0.572036743f,
1.144989014f, 0.572036743f, 0.100311279f, 0.078628540f,
0.031082153f, 0.007003784f, 0.003250122f, 0.000442505f,
-0.000015