/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * * by the Xiph.Org Foundation https://xiph.org/ * * * ******************************************************************** function: normalized modified discrete cosine transform power of two length transform only [64 <= n ] Original algorithm adapted long ago from _The use of multirate filter banks for coding of high quality digital audio_, by T. Sporer, K. Brandenburg and B. Edler, collection of the European Signal Processing Conference (EUSIPCO), Amsterdam, June 1992, Vol.1, pp 211-214 The below code implements an algorithm that no longer looks much like that presented in the paper, but the basic structure remains if you dig deep enough to see it. This module DOES NOT INCLUDE code to generate/apply the window function. Everybody has their own weird favorite including me... I happen to like the properties of y=sin(.5PI*sin^2(x)), but others may vehemently disagree. ********************************************************************/ /* this can also be run as an integer transform by uncommenting a define in mdct.h; the integerization is a first pass and although it's likely stable for Vorbis, the dynamic range is constrained and roundoff isn't done (so it's noisy). Consider it functional, but only a starting point. There's no point on a machine with an FPU */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include "vorbis/codec.h" #include "mdct.h" #include "os.h" #include "misc.h" /* build lookups for trig functions; also pre-figure scaling and some window function algebra. */ void mdct_init(mdct_lookup *lookup,int n){ … } /* 8 point butterfly (in place, 4 register) */ STIN void mdct_butterfly_8(DATA_TYPE *x){ … } /* 16 point butterfly (in place, 4 register) */ STIN void mdct_butterfly_16(DATA_TYPE *x){ … } /* 32 point butterfly (in place, 4 register) */ STIN void mdct_butterfly_32(DATA_TYPE *x){ … } /* N point first stage butterfly (in place, 2 register) */ STIN void mdct_butterfly_first(DATA_TYPE *T, DATA_TYPE *x, int points){ … } /* N/stage point generic N stage butterfly (in place, 2 register) */ STIN void mdct_butterfly_generic(DATA_TYPE *T, DATA_TYPE *x, int points, int trigint){ … } STIN void mdct_butterflies(mdct_lookup *init, DATA_TYPE *x, int points){ … } void mdct_clear(mdct_lookup *l){ … } STIN void mdct_bitreverse(mdct_lookup *init, DATA_TYPE *x){ … } void mdct_backward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out){ … } void mdct_forward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out){ … }