diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2002-12-16 18:59:50 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2002-12-16 18:59:50 +0000 |
commit | 94ef6649dd5f4e95337af00dcede2337ea7cfb49 (patch) | |
tree | 07d679ce92b4e4517815abc42394480eebf44904 | |
parent | 48f4c5809db11a6df4a5e7285d5e60a2ed924e2a (diff) | |
download | xine-lib-94ef6649dd5f4e95337af00dcede2337ea7cfb49.tar.gz xine-lib-94ef6649dd5f4e95337af00dcede2337ea7cfb49.tar.bz2 |
updated libfaad
CVS patchset: 3560
CVS date: 2002/12/16 18:59:50
63 files changed, 21708 insertions, 2378 deletions
diff --git a/src/libfaad/Makefile.am b/src/libfaad/Makefile.am index fb3f7c7d7..dc9863aad 100644 --- a/src/libfaad/Makefile.am +++ b/src/libfaad/Makefile.am @@ -20,8 +20,10 @@ VPATH = @srcdir@:@srcdir@/codebook: xineplug_decode_faad_la_SOURCES = \ bits.c \ cfft.c \ + common.c \ data.c \ decoder.c \ + dither.c \ drc.c \ error.c \ filtbank.c \ @@ -37,6 +39,7 @@ xineplug_decode_faad_la_SOURCES = \ codebook/hcb_10.c \ codebook/hcb_11.c \ codebook/hcb_sf.c \ + hcr.c \ ic_predict.c \ is.c \ lt_predict.c \ @@ -46,9 +49,11 @@ xineplug_decode_faad_la_SOURCES = \ output.c \ pns.c \ pulse.c \ - reordered_spectral_data.c \ - rvlc_scale_factors.c \ + rvlc.c \ specrec.c \ + ssr.c \ + ssr_fb.c \ + ssr_ipqf.c \ syntax.c \ tns.c \ xine_decoder.c @@ -60,16 +65,20 @@ noinst_HEADERS = \ analysis.h \ bits.h \ cfft.h \ + cfft_tab.h \ common.h \ data.h \ decoder.h \ + dither.h \ drc.h \ error.h \ faad.h \ filtbank.h \ + fixed.h \ huffman.h \ ic_predict.h \ is.h \ + iq_table.h \ kbd_win.h \ lt_predict.h \ mdct.h \ @@ -78,12 +87,14 @@ noinst_HEADERS = \ output.h \ pns.h \ pulse.h \ - rvlc_scale_factors.h \ - sbr_dec.h \ - sbr_huff.h \ - sbr_qmf.h \ - sbr_syntax.h \ + rvlc.h \ + sine_win.h \ specrec.h \ + ssr.h \ + ssr_fb.h \ + ssr_ipqf.h \ + ssr_win.h \ + structs.h \ syntax.h \ tns.h diff --git a/src/libfaad/analysis.h b/src/libfaad/analysis.h index 96ce6b200..e160ac1db 100644 --- a/src/libfaad/analysis.h +++ b/src/libfaad/analysis.h @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: analysis.h,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: analysis.h,v 1.2 2002/12/16 18:59:51 miguelfreitas Exp $ **/ #ifndef __ANALYSIS_H__ diff --git a/src/libfaad/bits.c b/src/libfaad/bits.c index d2c2db785..66cade533 100644 --- a/src/libfaad/bits.c +++ b/src/libfaad/bits.c @@ -16,44 +16,59 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: bits.c,v 1.2 2002/08/09 22:36:36 miguelfreitas Exp $ +** $Id: bits.c,v 1.3 2002/12/16 18:59:52 miguelfreitas Exp $ **/ #include "common.h" +#include "structs.h" + #include <stdlib.h> +#include <string.h> #include "bits.h" /* initialize buffer, call once before first getbits or showbits */ -void faad_initbits(bitfile *ld, void *buffer) +void faad_initbits(bitfile *ld, void *_buffer, uint32_t buffer_size) { uint32_t tmp; - ld->start = (uint32_t*)buffer; + ld->buffer = malloc((buffer_size+12)*sizeof(uint8_t)); + memset(ld->buffer, 0, (buffer_size+12)*sizeof(uint8_t)); + memcpy(ld->buffer, _buffer, buffer_size*sizeof(uint8_t)); + + ld->buffer_size = buffer_size; - tmp = *(uint32_t*)buffer; + tmp = getdword((uint32_t*)ld->buffer); #ifndef ARCH_IS_BIG_ENDIAN BSWAP(tmp); #endif ld->bufa = tmp; - tmp = *((uint32_t*)buffer + 1); + tmp = getdword((uint32_t*)ld->buffer + 1); #ifndef ARCH_IS_BIG_ENDIAN BSWAP(tmp); #endif ld->bufb = tmp; - ld->pos = 0; - ld->tail = ((uint32_t*)buffer + 2); + ld->start = (uint32_t*)ld->buffer; + ld->tail = ((uint32_t*)ld->buffer + 2); + + ld->bits_left = 32; +} + +void faad_endbits(bitfile *ld) +{ + if (ld->buffer) free(ld->buffer); } + uint32_t faad_get_processed_bits(bitfile *ld) { - return 8 * (4*(ld->tail - ld->start) - 4) - (32 - ld->pos); + return 8 * (4*(ld->tail - ld->start) - 4) - (ld->bits_left); } uint8_t faad_byte_align(bitfile *ld) { - uint8_t remainder = (uint8_t)(ld->pos % 8); + uint8_t remainder = (uint8_t)((32 - ld->bits_left) % 8); if (remainder) { @@ -63,26 +78,79 @@ uint8_t faad_byte_align(bitfile *ld) return 0; } -uint8_t *faad_getbitbuffer(bitfile *ld, uint16_t bits +/* rewind to beginning */ +void faad_rewindbits(bitfile *ld) +{ + uint32_t tmp; + + tmp = ld->start[0]; +#ifndef ARCH_IS_BIG_ENDIAN + BSWAP(tmp); +#endif + ld->bufa = tmp; + + tmp = ld->start[1]; +#ifndef ARCH_IS_BIG_ENDIAN + BSWAP(tmp); +#endif + ld->bufb = tmp; + ld->bits_left = 32; + ld->tail = &ld->start[2]; +} + +uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits DEBUGDEC) { - uint16_t i, temp; - uint16_t bytes = bits / 8; - uint8_t remainder = bits % 8; + uint16_t i; + uint8_t temp; + uint16_t bytes = (uint16_t)bits / 8; + uint8_t remainder = (uint8_t)bits % 8; uint8_t *buffer = (uint8_t*)malloc((bytes+1)*sizeof(uint8_t)); for (i = 0; i < bytes; i++) { - buffer[i] = faad_getbits(ld, 8 DEBUGVAR(print,var,dbg)); + buffer[i] = (uint8_t)faad_getbits(ld, 8 DEBUGVAR(print,var,dbg)); } if (remainder) { - temp = faad_getbits(ld, remainder DEBUGVAR(print,var,dbg)) << (8-remainder); + temp = (uint8_t)faad_getbits(ld, remainder DEBUGVAR(print,var,dbg)) << (8-remainder); buffer[bytes] = temp; } return buffer; } + +/* reversed bit reading routines, used for RVLC and HCR */ +void faad_initbits_rev(bitfile *ld, void *buffer, + uint32_t bits_in_buffer) +{ + uint32_t tmp; + int32_t index; + + ld->buffer_size = bit2byte(bits_in_buffer); + + index = (bits_in_buffer+31)/32 - 1; + + ld->start = (uint32_t*)buffer + index - 2; + + tmp = getdword((uint32_t*)buffer + index); +#ifndef ARCH_IS_BIG_ENDIAN + BSWAP(tmp); +#endif + ld->bufa = tmp; + + tmp = getdword((uint32_t*)buffer + index - 1); +#ifndef ARCH_IS_BIG_ENDIAN + BSWAP(tmp); +#endif + ld->bufb = tmp; + + ld->tail = (uint32_t*)buffer + index; + + ld->bits_left = bits_in_buffer % 32; + if (ld->bits_left == 0) + ld->bits_left = 32; +} diff --git a/src/libfaad/bits.h b/src/libfaad/bits.h index 60fdcf5de..cdf83b539 100644 --- a/src/libfaad/bits.h +++ b/src/libfaad/bits.h @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: bits.h,v 1.2 2002/08/09 22:36:36 miguelfreitas Exp $ +** $Id: bits.h,v 1.3 2002/12/16 18:59:53 miguelfreitas Exp $ **/ #ifndef __BITS_H__ @@ -37,79 +37,106 @@ extern "C" { typedef struct _bitfile { /* bit input */ - uint32_t bufa; - uint32_t bufb; - uint32_t pos; - uint32_t *tail; - uint32_t *start; + uint32_t bufa; + uint32_t bufb; + uint32_t bits_left; + uint32_t buffer_size; /* size of the buffer in bytes */ + uint32_t *tail; + uint32_t *start; + void *buffer; } bitfile; -#if defined(_WIN32) +#if defined (_WIN32) && !defined(_WIN32_WCE) #define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax #elif defined(LINUX) || defined(DJGPP) #define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ) #else #define BSWAP(a) \ - ((a) = ( ((a)&0xff)<<24) | (((a)&0xff00)<<8) | (((a)>>8)&0xff00) | (((a)>>24)&0xff)) + ((a) = ( ((a)&0xff)<<24) | (((a)&0xff00)<<8) | (((a)>>8)&0xff00) | (((a)>>24)&0xff)) #endif - -void faad_initbits(bitfile *ld, void *buffer); +static uint32_t bitmask[] = { + 0x0, 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF, 0x1FF, + 0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF, + 0x1FFFF, 0x3FFFF, 0x7FFFF, 0xFFFFF, 0x1FFFFF, 0x3FFFFF, + 0x7FFFFF, 0xFFFFFF, 0x1FFFFFF, 0x3FFFFFF, 0x7FFFFFF, + 0xFFFFFFF, 0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF +}; + +void faad_initbits(bitfile *ld, void *buffer, uint32_t buffer_size); +void faad_endbits(bitfile *ld); +void faad_initbits_rev(bitfile *ld, void *buffer, + uint32_t bits_in_buffer); uint8_t faad_byte_align(bitfile *ld); uint32_t faad_get_processed_bits(bitfile *ld); -uint8_t *faad_getbitbuffer(bitfile *ld, uint16_t bits +void faad_rewindbits(bitfile *ld); +uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits DEBUGDEC); +/* circumvent memory alignment errors on ARM */ +static INLINE uint32_t getdword(void *mem) +{ +#ifdef ARM + uint32_t tmp; + ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[0]; + ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[1]; + ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[2]; + ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[3]; + + return tmp; +#else + return *(uint32_t*)mem; +#endif +} -static INLINE uint32_t faad_showbits(bitfile *ld, uint8_t bits) +static INLINE uint32_t faad_showbits(bitfile *ld, uint32_t bits) { - int32_t nbit = (bits + ld->pos) - 32; - if (nbit > 0) + if (bits <= ld->bits_left) { - return ((ld->bufa & (0xffffffff >> ld->pos)) << nbit) | - (ld->bufb >> (32 - nbit)); + return (ld->bufa >> (ld->bits_left - bits)) & bitmask[bits]; } else { - return (ld->bufa & (0xffffffff >> ld->pos)) >> (32 - ld->pos - bits); + bits -= ld->bits_left; + return ((ld->bufa & bitmask[ld->bits_left]) << bits) | (ld->bufb >> (32 - bits)); } } -static INLINE void faad_flushbits(bitfile *ld, uint8_t bits) +static INLINE void faad_flushbits(bitfile *ld, uint32_t bits) { - ld->pos += bits; - - if (ld->pos >= 32) - { - uint32_t tmp; + if (bits < ld->bits_left) + { + ld->bits_left -= bits; + } else { + uint32_t tmp; - ld->bufa = ld->bufb; - tmp = *(uint32_t*)ld->tail; + ld->bufa = ld->bufb; + tmp = getdword(ld->tail); + ld->tail++; #ifndef ARCH_IS_BIG_ENDIAN - BSWAP(tmp); + BSWAP(tmp); #endif - ld->bufb = tmp; - ld->tail++; - ld->pos -= 32; - } + ld->bufb = tmp; + ld->bits_left += (32 - bits); + } } /* return next n bits (right adjusted) */ -static INLINE uint32_t faad_getbits(bitfile *ld, uint8_t n DEBUGDEC) +static INLINE uint32_t faad_getbits(bitfile *ld, uint32_t n DEBUGDEC) { uint32_t ret; if (n == 0) return 0; - ret = faad_showbits(ld, n); - faad_flushbits(ld, n); + ret = faad_showbits(ld, n); + faad_flushbits(ld, n); #ifdef ANALYSIS if (print) fprintf(stdout, "%4d %2d bits, val: %4d, variable: %d %s\n", dbg_count++, n, ret, var, dbg); #endif - return ret; + return ret; } static INLINE uint8_t faad_get1bit(bitfile *ld DEBUGDEC) @@ -117,6 +144,74 @@ static INLINE uint8_t faad_get1bit(bitfile *ld DEBUGDEC) return (uint8_t)faad_getbits(ld, 1 DEBUGVAR(print,var,dbg)); } +/* reversed bitreading routines */ +static INLINE uint32_t faad_showbits_rev(bitfile *ld, uint32_t bits) +{ + uint8_t i; + uint32_t B = 0; + + if (bits <= ld->bits_left) + { + for (i = 0; i < bits; i++) + { + if (ld->bufa & (1 << (i + (32 - ld->bits_left)))) + B |= (1 << (bits - i - 1)); + } + return B; + } else { + for (i = 0; i < ld->bits_left; i++) + { + if (ld->bufa & (1 << (i + (32 - ld->bits_left)))) + B |= (1 << (bits - i - 1)); + } + for (i = 0; i < bits - ld->bits_left; i++) + { + if (ld->bufb & (1 << (i + (32-ld->bits_left)))) + B |= (1 << (bits - ld->bits_left - i - 1)); + } + return B; + } +} + +static INLINE void faad_flushbits_rev(bitfile *ld, uint32_t bits) +{ + if (bits < ld->bits_left) + { + ld->bits_left -= bits; + } else { + uint32_t tmp; + + ld->bufa = ld->bufb; + tmp = getdword(ld->start); +#ifndef ARCH_IS_BIG_ENDIAN + BSWAP(tmp); +#endif + ld->bufb = tmp; + ld->start--; + ld->bits_left += (32 - bits); + } +} + +static INLINE uint32_t faad_getbits_rev(bitfile *ld, uint32_t n + DEBUGDEC) +{ + uint32_t ret; + + if (n == 0) + return 0; + + ret = faad_showbits_rev(ld, n); + faad_flushbits_rev(ld, n); + +#ifdef ANALYSIS + if (print) + fprintf(stdout, "%4d %2d bits, val: %4d, variable: %d %s\n", dbg_count++, n, ret, var, dbg); +#endif + + return ret; +} + + #ifdef __cplusplus } #endif diff --git a/src/libfaad/cfft.c b/src/libfaad/cfft.c index 70aa084a1..567e8ce34 100644 --- a/src/libfaad/cfft.c +++ b/src/libfaad/cfft.c @@ -16,465 +16,324 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: cfft.c,v 1.2 2002/10/22 04:48:41 storri Exp $ +** $Id: cfft.c,v 1.3 2002/12/16 18:59:54 miguelfreitas Exp $ **/ /* * Algorithmically based on Fortran-77 FFTPACK * by Paul N. Swarztrauber(Version 4, 1985). + * + * Does even sized fft only */ /* isign is +1 for backward and -1 for forward transforms */ - #include "common.h" +#include "structs.h" + #include <stdlib.h> +#ifdef _WIN32_WCE +#define assert(x) +#else +#include <assert.h> +#endif #include "cfft.h" +#include "cfft_tab.h" /*---------------------------------------------------------------------- - passf2, passf3, passf4, passf5, passf. Complex FFT passes fwd and bwd. + passf2, passf3, passf4, passf5. Complex FFT passes fwd and bwd. ----------------------------------------------------------------------*/ -static void passf2(uint16_t ido, uint16_t l1, real_t *cc, real_t *ch, - real_t *wa1, int8_t isign) +static void passf2(uint16_t ido, uint16_t l1, complex_t *cc, complex_t *ch, + complex_t *wa, int8_t isign) { uint16_t i, k, ah, ac; - real_t ti2, tr2; - if (ido <= 2) + if (ido == 1) { for (k = 0; k < l1; k++) { - ah = k*ido; - ac = 2*k*ido; - ch[ah] = cc[ac] + cc[ac+ido]; - ch[ah+ido*l1] = cc[ac] - cc[ac+ido]; - ch[ah+1] = cc[ac+1] + cc[ac+ido+1]; - ch[ah+ido*l1+1] = cc[ac+1] - cc[ac+ido+1]; + ah = 2*k; + ac = 4*k; + + RE(ch[ah]) = RE(cc[ac]) + RE(cc[ac+1]); + IM(ch[ah]) = IM(cc[ac]) + IM(cc[ac+1]); + RE(ch[ah+l1]) = RE(cc[ac]) - RE(cc[ac+1]); + IM(ch[ah+l1]) = IM(cc[ac]) - IM(cc[ac+1]); } } else { for (k = 0; k < l1; k++) { - for(i = 0; i < ido-1; i += 2) + ah = k*ido; + ac = 2*k*ido; + + for (i = 0; i < ido; i++) { - ah = i + k*ido; - ac = i + 2*k*ido; - ch[ah] = cc[ac] + cc[ac+ido]; - tr2 = cc[ac] - cc[ac+ido]; - ch[ah+1] = cc[ac+1] + cc[ac+1+ido]; - ti2 = cc[ac+1] - cc[ac+1+ido]; - ch[ah+l1*ido+1] = wa1[i]*ti2 + isign*wa1[i+1]*tr2; - ch[ah+l1*ido] = wa1[i]*tr2 - isign*wa1[i+1]*ti2; - } - } - } -} + complex_t t2; + RE(ch[ah]) = RE(cc[ac]) + RE(cc[ac+ido]); + IM(ch[ah]) = IM(cc[ac]) + IM(cc[ac+ido]); -static void passf3(uint16_t ido, uint16_t l1, real_t *cc, real_t *ch, - real_t *wa1, real_t *wa2, int8_t isign) -{ - static real_t taur = -0.5; - static real_t taui = 0.866025403784439; - uint16_t i, k, ac, ah; - real_t ci2, ci3, di2, di3, cr2, cr3, dr2, dr3, ti2, tr2; + RE(t2) = RE(cc[ac]) - RE(cc[ac+ido]); + IM(t2) = IM(cc[ac]) - IM(cc[ac+ido]); - if (ido == 2) - { - for (k = 1; k <= l1; k++) - { - ac = (3*k-2) * ido; - tr2 = cc[ac] + cc[ac+ido]; - cr2 = cc[ac-ido] + taur*tr2; - ah = (k-1) * ido; - ch[ah] = cc[ac-ido] + tr2; - - ti2 = cc[ac+1] + cc[ac+ido+1]; - ci2 = cc[ac-ido+1] + taur*ti2; - ch[ah+1] = cc[ac-ido+1] + ti2; - - cr3 = isign * taui * (cc[ac] - cc[ac+ido]); - ci3 = isign * taui * (cc[ac+1] - cc[ac+ido+1]); - ch[ah+l1*ido] = cr2 - ci3; - ch[ah+2*l1*ido] = cr2 + ci3; - ch[ah+l1*ido+1] = ci2 + cr3; - ch[ah+2*l1*ido+1] = ci2 - cr3; - } - } else { - for (k = 1; k <= l1; k++) - { - for (i = 0; i < ido-1; i += 2) - { - ac = i + (3*k-2) * ido; - tr2 = cc[ac] + cc[ac+ido]; - cr2 = cc[ac-ido] + taur*tr2; - ah = i + (k-1) * ido; - ch[ah] = cc[ac-ido] + tr2; - ti2 = cc[ac+1] + cc[ac+ido+1]; - ci2 = cc[ac-ido+1] + taur*ti2; - ch[ah+1] = cc[ac-ido+1] + ti2; - cr3 = isign * taui * (cc[ac] - cc[ac+ido]); - ci3 = isign * taui * (cc[ac+1] - cc[ac+ido+1]); - dr2 = cr2 - ci3; - dr3 = cr2 + ci3; - di2 = ci2 + cr3; - di3 = ci2 - cr3; - ch[ah+l1*ido+1] = wa1[i]*di2 + isign*wa1[i+1]*dr2; - ch[ah+l1*ido] = wa1[i]*dr2 - isign*wa1[i+1]*di2; - ch[ah+2*l1*ido+1] = wa2[i]*di3 + isign*wa2[i+1]*dr3; - ch[ah+2*l1*ido] = wa2[i]*dr3 - isign*wa2[i+1]*di3; + RE(ch[ah+l1*ido]) = MUL_R_C(RE(t2),RE(wa[i])) - MUL_R_C(IM(t2),IM(wa[i]))*isign; + IM(ch[ah+l1*ido]) = MUL_R_C(IM(t2),RE(wa[i])) + MUL_R_C(RE(t2),IM(wa[i]))*isign; + ah++; + ac++; } } } } -static void passf4(uint16_t ido, uint16_t l1, real_t *cc, real_t *ch, - real_t *wa1, real_t *wa2, real_t *wa3, int8_t isign) +static void passf3(uint16_t ido, uint16_t l1, complex_t *cc, complex_t *ch, + complex_t *wa1, complex_t *wa2, int8_t isign) { + static real_t taur = COEF_CONST(-0.5); + static real_t taui = COEF_CONST(0.866025403784439); uint16_t i, k, ac, ah; - real_t ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, - tr3, tr4; + complex_t c2, c3, d2, d3, t2; - if (ido == 2) + if (ido == 1) { for (k = 0; k < l1; k++) { - ac = 4*k*ido + 1; - ti1 = cc[ac] - cc[ac+2*ido]; - ti2 = cc[ac] + cc[ac+2*ido]; - tr4 = cc[ac+3*ido] - cc[ac+ido]; - ti3 = cc[ac+ido] + cc[ac+3*ido]; - tr1 = cc[ac-1] - cc[ac+2*ido-1]; - tr2 = cc[ac-1] + cc[ac+2*ido-1]; - ti4 = cc[ac+ido-1] - cc[ac+3*ido-1]; - tr3 = cc[ac+ido-1] + cc[ac+3*ido-1]; - ah = k*ido; - ch[ah] = tr2 + tr3; - ch[ah+2*l1*ido] = tr2 - tr3; - ch[ah+1] = ti2 + ti3; - ch[ah+2*l1*ido+1] = ti2 - ti3; - ch[ah+l1*ido] = tr1 + isign*tr4; - ch[ah+3*l1*ido] = tr1 - isign*tr4; - ch[ah+l1*ido+1] = ti1 + isign*ti4; - ch[ah+3*l1*ido+1] = ti1 - isign*ti4; + ac = 3*k+1; + ah = k; + + RE(t2) = RE(cc[ac]) + RE(cc[ac+1]); + IM(t2) = IM(cc[ac]) + IM(cc[ac+1]); + RE(c2) = RE(cc[ac-1]) + MUL_R_C(RE(t2),taur); + IM(c2) = IM(cc[ac-1]) + MUL_R_C(IM(t2),taur); + + RE(ch[ah]) = RE(cc[ac-1]) + RE(t2); + IM(ch[ah]) = IM(cc[ac-1]) + IM(t2); + + RE(c3) = MUL_R_C((RE(cc[ac]) - RE(cc[ac+1])), taui)*isign; + IM(c3) = MUL_R_C((IM(cc[ac]) - IM(cc[ac+1])), taui)*isign; + + RE(ch[ah+l1]) = RE(c2) - IM(c3); + IM(ch[ah+l1]) = IM(c2) + RE(c3); + RE(ch[ah+2*l1]) = RE(c2) + IM(c3); + IM(ch[ah+2*l1]) = IM(c2) - RE(c3); } } else { for (k = 0; k < l1; k++) { - for (i = 0; i < ido-1; i += 2) + for (i = 0; i < ido; i++) { - ac = i + 1 + 4*k*ido; - ti1 = cc[ac] - cc[ac+2*ido]; - ti2 = cc[ac] + cc[ac+2*ido]; - ti3 = cc[ac+ido] + cc[ac+3*ido]; - tr4 = cc[ac+3*ido] - cc[ac+ido]; - tr1 = cc[ac-1] - cc[ac+2*ido-1]; - tr2 = cc[ac-1] + cc[ac+2*ido-1]; - ti4 = cc[ac+ido-1] - cc[ac+3*ido-1]; - tr3 = cc[ac+ido-1] + cc[ac+3*ido-1]; - ah = i + k*ido; - ch[ah] = tr2 + tr3; - cr3 = tr2 - tr3; - ch[ah+1] = ti2 + ti3; - ci3 = ti2 - ti3; - cr2 = tr1 + isign*tr4; - cr4 = tr1 - isign*tr4; - ci2 = ti1 + isign*ti4; - ci4 = ti1 - isign*ti4; - ch[ah+l1*ido] = wa1[i]*cr2 - isign*wa1[i+1]*ci2; - ch[ah+l1*ido+1] = wa1[i]*ci2 + isign*wa1[i+1]*cr2; - ch[ah+2*l1*ido] = wa2[i]*cr3 - isign*wa2[i+1]*ci3; - ch[ah+2*l1*ido+1] = wa2[i]*ci3 + isign*wa2[i+1]*cr3; - ch[ah+3*l1*ido] = wa3[i]*cr4 - isign*wa3[i+1]*ci4; - ch[ah+3*l1*ido+1] = wa3[i]*ci4 + isign*wa3[i+1]*cr4; - } - } - } -} + ac = i + (3*k+1)*ido; + ah = i + k * ido; + RE(t2) = RE(cc[ac]) + RE(cc[ac+ido]); + RE(c2) = RE(cc[ac-ido]) + MUL_R_C(RE(t2),taur); + IM(t2) = IM(cc[ac]) + IM(cc[ac+ido]); + IM(c2) = IM(cc[ac-ido]) + MUL_R_C(IM(t2),taur); -static void passf5(uint16_t ido, uint16_t l1, real_t *cc, real_t *ch, - real_t *wa1, real_t *wa2, real_t *wa3, real_t *wa4, - int8_t isign) -{ - static real_t tr11 = 0.309016994374947; - static real_t ti11 = 0.951056516295154; - static real_t tr12 = -0.809016994374947; - static real_t ti12 = 0.587785252292473; - uint16_t i, k, ac, ah; - real_t ci2, ci3, ci4, ci5, di3, di4, di5, di2, cr2, cr3, cr5, cr4, - ti2, ti3, ti4, ti5, dr3, dr4, dr5, dr2, tr2, tr3, tr4, tr5; + RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2); + IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2); - if (ido == 2) - { - for (k = 1; k <= l1; ++k) - { - ac = (5*k-4) * ido + 1; - ti5 = cc[ac] - cc[ac+3*ido]; - ti2 = cc[ac] + cc[ac+3*ido]; - ti4 = cc[ac+ido] - cc[ac+2*ido]; - ti3 = cc[ac+ido] + cc[ac+2*ido]; - tr5 = cc[ac-1] - cc[ac+3*ido-1]; - tr2 = cc[ac-1] + cc[ac+3*ido-1]; - tr4 = cc[ac+ido-1] - cc[ac+2*ido-1]; - tr3 = cc[ac+ido-1] + cc[ac+2*ido-1]; - ah = (k-1) * ido; - ch[ah] = cc[ac-ido-1] + tr2 + tr3; - ch[ah+1] = cc[ac-ido] + ti2 + ti3; - cr2 = cc[ac-ido-1] + tr11*tr2 + tr12*tr3; - ci2 = cc[ac-ido] + tr11*ti2 + tr12*ti3; - cr3 = cc[ac-ido-1] + tr12*tr2 + tr11*tr3; - ci3 = cc[ac-ido] + tr12*ti2 + tr11*ti3; - cr5 = isign * (ti11*tr5 + ti12*tr4); - ci5 = isign * (ti11*ti5 + ti12*ti4); - cr4 = isign * (ti12*tr5 - ti11*tr4); - ci4 = isign * (ti12*ti5 - ti11*ti4); - ch[ah+l1*ido] = cr2 - ci5; - ch[ah+4*l1*ido] = cr2 + ci5; - ch[ah+l1*ido+1] = ci2 + cr5; - ch[ah+2*l1*ido+1]=ci3 + cr4; - ch[ah+2*l1*ido] = cr3 - ci4; - ch[ah+3*l1*ido] = cr3 + ci4; - ch[ah+3*l1*ido+1] = ci3 - cr4; - ch[ah+4*l1*ido+1] = ci2 - cr5; - } - } else { - for (k = 1; k <= l1; k++) - { - for (i = 0; i < ido-1; i += 2) - { - ac = i + 1 + (k*5-4) * ido; - ti5 = cc[ac] - cc[ac+3*ido]; - ti2 = cc[ac] + cc[ac+3*ido]; - ti4 = cc[ac+ido] - cc[ac+2*ido]; - ti3 = cc[ac+ido] + cc[ac+2*ido]; - tr5 = cc[ac-1] - cc[ac+3*ido-1]; - tr2 = cc[ac-1] + cc[ac+3*ido-1]; - tr4 = cc[ac+ido-1] - cc[ac+2*ido-1]; - tr3 = cc[ac+ido-1] + cc[ac+2*ido-1]; - ah = i + (k-1) * ido; - ch[ah] = cc[ac-ido-1] + tr2 + tr3; - ch[ah+1] = cc[ac-ido] + ti2 + ti3; - cr2 = cc[ac-ido-1] + tr11*tr2 + tr12*tr3; - ci2 = cc[ac-ido] + tr11*ti2 + tr12*ti3; - cr3 = cc[ac-ido-1] + tr12*tr2 + tr11*tr3; - ci3 = cc[ac-ido] + tr12*ti2 + tr11*ti3; - cr5 = isign * (ti11*tr5 + ti12*tr4); - ci5 = isign * (ti11*ti5 + ti12*ti4); - cr4 = isign * (ti12*tr5 - ti11*tr4); - ci4 = isign * (ti12*ti5 - ti11*ti4); - dr3 = cr3 - ci4; - dr4 = cr3 + ci4; - di3 = ci3 + cr4; - di4 = ci3 - cr4; - dr5 = cr2 + ci5; - dr2 = cr2 - ci5; - di5 = ci2 - cr5; - di2 = ci2 + cr5; - ch[ah+l1*ido] = wa1[i]*dr2 - isign*wa1[i+1]*di2; - ch[ah+l1*ido+1] = wa1[i]*di2 + isign*wa1[i+1]*dr2; - ch[ah+2*l1*ido] = wa2[i]*dr3 - isign*wa2[i+1]*di3; - ch[ah+2*l1*ido+1] = wa2[i]*di3 + isign*wa2[i+1]*dr3; - ch[ah+3*l1*ido] = wa3[i]*dr4 - isign*wa3[i+1]*di4; - ch[ah+3*l1*ido+1] = wa3[i]*di4 + isign*wa3[i+1]*dr4; - ch[ah+4*l1*ido] = wa4[i]*dr5 - isign*wa4[i+1]*di5; - ch[ah+4*l1*ido+1] = wa4[i]*di5 + isign*wa4[i+1]*dr5; + RE(c3) = MUL_R_C((RE(cc[ac]) - RE(cc[ac+ido])), taui)*isign; + IM(c3) = MUL_R_C((IM(cc[ac]) - IM(cc[ac+ido])), taui)*isign; + + RE(d2) = RE(c2) - IM(c3); + IM(d3) = IM(c2) - RE(c3); + RE(d3) = RE(c2) + IM(c3); + IM(d2) = IM(c2) + RE(c3); + + RE(ch[ah+l1*ido]) = MUL_R_C(RE(d2),RE(wa1[i])) - MUL_R_C(IM(d2),IM(wa1[i]))*isign; + IM(ch[ah+l1*ido]) = MUL_R_C(IM(d2),RE(wa1[i])) + MUL_R_C(RE(d2),IM(wa1[i]))*isign; + RE(ch[ah+l1*2*ido]) = MUL_R_C(RE(d3),RE(wa2[i])) - MUL_R_C(IM(d3),IM(wa2[i]))*isign; + IM(ch[ah+l1*2*ido]) = MUL_R_C(IM(d3),RE(wa2[i])) + MUL_R_C(RE(d3),IM(wa2[i]))*isign; } } } } -static void passf(uint16_t *nac, uint16_t ido, uint16_t ip, uint16_t l1, - uint16_t idl1, real_t *cc, real_t *ch, real_t *wa, - int8_t isign) +static void passf4(uint16_t ido, uint16_t l1, complex_t *cc, complex_t *ch, + complex_t *wa1, complex_t *wa2, complex_t *wa3, int8_t isign) { - uint16_t idij, idlj, idot, ipph, i, j, k, l, jc, lc, ik, nt, idj, idl; - uint16_t inc, idp; - real_t wai, war; - - idot = ido / 2; - nt = ip*idl1; - ipph = (ip+1) / 2; - idp = ip*ido; + uint16_t i, k, ac, ah; + complex_t c2, c3, c4, t1, t2, t3, t4; - if (ido >= l1) + if (ido == 1) { - for (j = 1; j < ipph; j++) - { - jc = ip - j; - - for (k = 0; k < l1; k++) - { - for (i = 0; i < ido; i++) - { - ch[i+(k+j*l1)*ido] = cc[i+(j+k*ip)*ido] + cc[i+(jc+k*ip)*ido]; - ch[i+(k+jc*l1)*ido] = cc[i+(j+k*ip)*ido] - cc[i+(jc+k*ip)*ido]; - } - } - } - for (k = 0; k < l1; k++) { - for (i = 0; i < ido; i++) - ch[i+k*ido] = cc[i+k*ip*ido]; + ac = 4*k; + ah = k; + + RE(t2) = RE(cc[ac]) + RE(cc[ac+2]); + IM(t2) = IM(cc[ac]) + IM(cc[ac+2]); + RE(t3) = RE(cc[ac+1]) + RE(cc[ac+3]); + IM(t3) = IM(cc[ac+1]) + IM(cc[ac+3]); + RE(t1) = RE(cc[ac]) - RE(cc[ac+2]); + IM(t1) = IM(cc[ac]) - IM(cc[ac+2]); + RE(t4) = IM(cc[ac+3]) - IM(cc[ac+1]); + IM(t4) = RE(cc[ac+1]) - RE(cc[ac+3]); + + RE(ch[ah]) = RE(t2) + RE(t3); + IM(ch[ah]) = IM(t2) + IM(t3); + RE(ch[ah+l1]) = RE(t1) + RE(t4)*isign; + IM(ch[ah+l1]) = IM(t1) + IM(t4)*isign; + RE(ch[ah+2*l1]) = RE(t2) - RE(t3); + IM(ch[ah+2*l1]) = IM(t2) - IM(t3); + RE(ch[ah+3*l1]) = RE(t1) - RE(t4)*isign; + IM(ch[ah+3*l1]) = IM(t1) - IM(t4)*isign; } } else { - for (j = 1; j < ipph; j++) + for (k = 0; k < l1; k++) { - jc = ip - j; - for (i = 0; i < ido; i++) { - for (k = 0; k < l1; k++) - { - ch[i+(k+j*l1)*ido] = cc[i+(j+k*ip)*ido] + cc[i+(jc+k*ip)*ido]; - ch[i+(k+jc*l1)*ido] = cc[i+(j+k*ip)*ido] - cc[i+(jc+k*ip)*ido]; - } - } - } - - for (i = 0; i < ido; i++) - { - for (k = 0; k < l1; k++) - ch[i+k*ido] = cc[i+k*ip*ido]; - } - } - - idl = 2 - ido; - inc = 0; - - for (l = 1; l < ipph; l++) - { - lc = ip - l; - idl += ido; - - for (ik = 0; ik < idl1; ik++) - { - cc[ik+l*idl1] = ch[ik] + wa[idl-2]*ch[ik+idl1]; - cc[ik+lc*idl1] = isign*wa[idl-1]*ch[ik+(ip-1)*idl1]; - } - - idlj = idl; - inc += ido; - - for (j = 2; j < ipph; j++) - { - jc = ip - j; - idlj += inc; - - if (idlj > idp) - idlj -= idp; - - war = wa[idlj-2]; - wai = wa[idlj-1]; + ac = i + 4*k*ido; + ah = i + k*ido; - for (ik = 0; ik < idl1; ik++) - { - cc[ik+l*idl1] += war*ch[ik+j*idl1]; - cc[ik+lc*idl1] += isign*wai*ch[ik+jc*idl1]; + RE(t2) = RE(cc[ac]) + RE(cc[ac+2*ido]); + IM(t2) = IM(cc[ac]) + IM(cc[ac+2*ido]); + RE(t3) = RE(cc[ac+ido]) + RE(cc[ac+3*ido]); + IM(t3) = IM(cc[ac+ido]) + IM(cc[ac+3*ido]); + RE(t1) = RE(cc[ac]) - RE(cc[ac+2*ido]); + IM(t1) = IM(cc[ac]) - IM(cc[ac+2*ido]); + RE(t4) = IM(cc[ac+3*ido]) - IM(cc[ac+ido]); + IM(t4) = RE(cc[ac+ido]) - RE(cc[ac+3*ido]); + + RE(ch[ah]) = RE(t2) + RE(t3); + IM(ch[ah]) = IM(t2) + IM(t3); + + RE(c2) = RE(t1) + RE(t4)*isign; + IM(c2) = IM(t1) + IM(t4)*isign; + RE(c3) = RE(t2) - RE(t3); + IM(c3) = IM(t2) - IM(t3); + RE(c4) = RE(t1) - RE(t4)*isign; + IM(c4) = IM(t1) - IM(t4)*isign; + + RE(ch[ah+l1*ido]) = MUL_R_C(RE(c2),RE(wa1[i])) - MUL_R_C(IM(c2),IM(wa1[i]))*isign; + IM(ch[ah+l1*ido]) = MUL_R_C(IM(c2),RE(wa1[i])) + MUL_R_C(RE(c2),IM(wa1[i]))*isign; + RE(ch[ah+2*l1*ido]) = MUL_R_C(RE(c3),RE(wa2[i])) - MUL_R_C(IM(c3),IM(wa2[i]))*isign; + IM(ch[ah+2*l1*ido]) = MUL_R_C(IM(c3),RE(wa2[i])) + MUL_R_C(RE(c3),IM(wa2[i]))*isign; + RE(ch[ah+3*l1*ido]) = MUL_R_C(RE(c4),RE(wa3[i])) - MUL_R_C(IM(c4),IM(wa3[i]))*isign; + IM(ch[ah+3*l1*ido]) = MUL_R_C(IM(c4),RE(wa3[i])) + MUL_R_C(RE(c4),IM(wa3[i]))*isign; } } } +} - for (j = 1; j < ipph; j++) - { - for (ik = 0; ik < idl1; ik++) - ch[ik] += ch[ik+j*idl1]; - } - - for (j = 1; j < ipph; j++) - { - jc = ip - j; - - for (ik = 1; ik < idl1; ik += 2) - { - ch[ik-1+j*idl1] = cc[ik-1+j*idl1] - cc[ik+jc*idl1]; - ch[ik-1+jc*idl1] = cc[ik-1+j*idl1] + cc[ik+jc*idl1]; - ch[ik+j*idl1] = cc[ik+j*idl1] + cc[ik-1+jc*idl1]; - ch[ik+jc*idl1] = cc[ik+j*idl1] - cc[ik-1+jc*idl1]; - } - } - - *nac = 1; - - if (ido == 2) - return; - - *nac = 0; - for (ik = 0; ik < idl1; ik++) - cc[ik] = ch[ik]; +static void passf5(uint16_t ido, uint16_t l1, complex_t *cc, complex_t *ch, + complex_t *wa1, complex_t *wa2, complex_t *wa3, complex_t *wa4, + int8_t isign) +{ + static real_t tr11 = COEF_CONST(0.309016994374947); + static real_t ti11 = COEF_CONST(0.951056516295154); + static real_t tr12 = COEF_CONST(-0.809016994374947); + static real_t ti12 = COEF_CONST(0.587785252292473); + uint16_t i, k, ac, ah; + complex_t c2, c3, c4, c5, d3, d4, d5, d2, t2, t3, t4, t5; - for (j = 1; j < ip; j++) + if (ido == 1) { for (k = 0; k < l1; k++) { - cc[(k+j*l1)*ido+0] = ch[(k+j*l1)*ido+0]; - cc[(k+j*l1)*ido+1] = ch[(k+j*l1)*ido+1]; - } - } - - if (idot <= l1) - { - idij = 0; - - for (j = 1; j < ip; j++) - { - idij += 2; - - for (i = 3; i < ido; i += 2) - { - idij += 2; - - for (k = 0; k < l1; k++) - { - cc[i-1+(k+j*l1)*ido] = wa[idij-2] * ch[i-1+(k+j*l1)*ido] - - isign * wa[idij-1] * ch[i+(k+j*l1)*ido]; - cc[i+(k+j*l1)*ido] = wa[idij-2] * ch[i+(k+j*l1)*ido] + - isign * wa[idij-1] * ch[i-1+(k+j*l1)*ido]; - } - } + ac = 5*k + 1; + ah = k; + + RE(t2) = RE(cc[ac]) + RE(cc[ac+3]); + IM(t2) = IM(cc[ac]) + IM(cc[ac+3]); + RE(t3) = RE(cc[ac+1]) + RE(cc[ac+2]); + IM(t3) = IM(cc[ac+1]) + IM(cc[ac+2]); + RE(t4) = RE(cc[ac+1]) - RE(cc[ac+2]); + IM(t4) = IM(cc[ac+1]) - IM(cc[ac+2]); + RE(t5) = RE(cc[ac]) - RE(cc[ac+3]); + IM(t5) = IM(cc[ac]) - IM(cc[ac+3]); + + RE(ch[ah]) = RE(cc[ac-1]) + RE(t2) + RE(t3); + IM(ch[ah]) = IM(cc[ac-1]) + IM(t2) + IM(t3); + + RE(c2) = RE(cc[ac-1]) + MUL_R_C(RE(t2),tr11) + MUL_R_C(RE(t3),tr12); + IM(c2) = IM(cc[ac-1]) + MUL_R_C(IM(t2),tr11) + MUL_R_C(IM(t3),tr12); + RE(c3) = RE(cc[ac-1]) + MUL_R_C(RE(t2),tr12) + MUL_R_C(RE(t3),tr11); + IM(c3) = IM(cc[ac-1]) + MUL_R_C(IM(t2),tr12) + MUL_R_C(IM(t3),tr11); + RE(c4) = (MUL_R_C(RE(t5),ti12)*isign - MUL_R_C(RE(t4),ti11)); + IM(c4) = (MUL_R_C(IM(t5),ti12)*isign - MUL_R_C(IM(t4),ti11)); + RE(c5) = (MUL_R_C(RE(t5),ti11)*isign + MUL_R_C(RE(t4),ti12)); + IM(c5) = (MUL_R_C(IM(t5),ti11)*isign + MUL_R_C(IM(t4),ti12)); + + RE(ch[ah+l1]) = RE(c2) - IM(c5); + IM(ch[ah+l1]) = IM(c2) + RE(c5); + RE(ch[ah+2*l1]) = RE(c3) - IM(c4); + IM(ch[ah+2*l1]) = IM(c3) + RE(c4); + RE(ch[ah+3*l1]) = RE(c3) + IM(c4); + IM(ch[ah+3*l1]) = IM(c3) - RE(c4); + RE(ch[ah+4*l1]) = RE(c2) + IM(c5); + IM(ch[ah+4*l1]) = IM(c2) - RE(c5); } } else { - idj = 2 - ido; - - for (j = 1; j < ip; j++) + for (k = 0; k < l1; k++) { - idj += ido; - - for (k = 0; k < l1; k++) + for (i = 0; i < ido; i++) { - idij = idj; - - for (i = 3; i < ido; i += 2) - { - idij += 2; - cc[i-1+(k+j*l1)*ido] = wa[idij-2] * ch[i-1+(k+j*l1)*ido] - - isign * wa[idij-1] * ch[i+(k+j*l1)*ido]; - cc[i+(k+j*l1)*ido] = wa[idij-2] * ch[i+(k+j*l1)*ido] + - isign * wa[idij-1] * ch[i-1+(k+j*l1)*ido]; - } + ac = i + (k*5 + 1) * ido; + ah = i + k * ido; + + RE(t2) = RE(cc[ac]) + RE(cc[ac+3*ido]); + IM(t2) = IM(cc[ac]) + IM(cc[ac+3*ido]); + RE(t3) = RE(cc[ac+ido]) + RE(cc[ac+2*ido]); + IM(t3) = IM(cc[ac+ido]) + IM(cc[ac+2*ido]); + RE(t4) = RE(cc[ac+ido]) - RE(cc[ac+2*ido]); + IM(t4) = IM(cc[ac+ido]) - IM(cc[ac+2*ido]); + RE(t5) = RE(cc[ac]) - RE(cc[ac+3*ido]); + IM(t5) = IM(cc[ac]) - IM(cc[ac+3*ido]); + + RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2) + RE(t3); + IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2) + IM(t3); + + RE(c2) = RE(cc[ac-ido]) + MUL_R_C(RE(t2),tr11) + MUL_R_C(RE(t3),tr12); + IM(c2) = IM(cc[ac-ido]) + MUL_R_C(IM(t2),tr11) + MUL_R_C(IM(t3),tr12); + RE(c3) = RE(cc[ac-ido]) + MUL_R_C(RE(t2),tr12) + MUL_R_C(RE(t3),tr11); + IM(c3) = IM(cc[ac-ido]) + MUL_R_C(IM(t2),tr12) + MUL_R_C(IM(t3),tr11); + RE(c4) = (MUL_R_C(RE(t5),ti12)*isign - MUL_R_C(RE(t4),ti11)); + IM(c4) = (MUL_R_C(IM(t5),ti12)*isign - MUL_R_C(IM(t4),ti11)); + RE(c5) = (MUL_R_C(RE(t5),ti11)*isign + MUL_R_C(RE(t4),ti12)); + IM(c5) = (MUL_R_C(IM(t5),ti11)*isign + MUL_R_C(IM(t4),ti12)); + + IM(d2) = IM(c2) + RE(c5); + IM(d3) = IM(c3) + RE(c4); + RE(d4) = RE(c3) + IM(c4); + RE(d5) = RE(c2) + IM(c5); + RE(d2) = RE(c2) - IM(c5); + IM(d5) = IM(c2) - RE(c5); + RE(d3) = RE(c3) - IM(c4); + IM(d4) = IM(c3) - RE(c4); + + RE(ch[ah+l1*ido]) = MUL_R_C(RE(d2),RE(wa1[i])) - MUL_R_C(IM(d2),IM(wa1[i]))*isign; + IM(ch[ah+l1*ido]) = MUL_R_C(IM(d2),RE(wa1[i])) + MUL_R_C(RE(d2),IM(wa1[i]))*isign; + RE(ch[ah+2*l1*ido]) = MUL_R_C(RE(d3),RE(wa2[i])) - MUL_R_C(IM(d3),IM(wa2[i]))*isign; + IM(ch[ah+2*l1*ido]) = MUL_R_C(IM(d3),RE(wa2[i])) + MUL_R_C(RE(d3),IM(wa2[i]))*isign; + RE(ch[ah+3*l1*ido]) = MUL_R_C(RE(d4),RE(wa3[i])) - MUL_R_C(IM(d4),IM(wa3[i]))*isign; + IM(ch[ah+3*l1*ido]) = MUL_R_C(IM(d4),RE(wa3[i])) + MUL_R_C(RE(d4),IM(wa3[i]))*isign; + RE(ch[ah+4*l1*ido]) = MUL_R_C(RE(d5),RE(wa4[i])) - MUL_R_C(IM(d5),IM(wa4[i]))*isign; + IM(ch[ah+4*l1*ido]) = MUL_R_C(IM(d5),RE(wa4[i])) + MUL_R_C(RE(d5),IM(wa4[i]))*isign; } } } } - /*---------------------------------------------------------------------- cfftf1, cfftf, cfftb, cffti1, cffti. Complex FFTs. ----------------------------------------------------------------------*/ -INLINE void cfftf1(uint16_t n, real_t *c, real_t *ch, real_t *wa, - uint16_t *ifac, int8_t isign) +INLINE void cfftf1(uint16_t n, complex_t *c, complex_t *ch, + uint16_t *ifac, complex_t *wa, int8_t isign) { - uint16_t idot, i; + uint16_t i; uint16_t k1, l1, l2; - uint16_t na, nf, ip, iw, ix2, ix3, ix4, nac, ido, idl1; + uint16_t na, nf, ip, iw, ix2, ix3, ix4, ido, idl1; nf = ifac[1]; na = 0; @@ -486,92 +345,89 @@ INLINE void cfftf1(uint16_t n, real_t *c, real_t *ch, real_t *wa, ip = ifac[k1]; l2 = ip*l1; ido = n / l2; - idot = ido+ido; - idl1 = idot*l1; + idl1 = ido*l1; switch (ip) { case 2: if (na == 0) - passf2(idot, l1, c, ch, &wa[iw], isign); + passf2(ido, l1, c, ch, &wa[iw], isign); else - passf2(idot, l1, ch, c, &wa[iw], isign); + passf2(ido, l1, ch, c, &wa[iw], isign); na = 1 - na; break; case 3: - ix2 = iw + idot; + ix2 = iw + ido; if (na == 0) - passf3(idot, l1, c, ch, &wa[iw], &wa[ix2], isign); + passf3(ido, l1, c, ch, &wa[iw], &wa[ix2], isign); else - passf3(idot, l1, ch, c, &wa[iw], &wa[ix2], isign); + passf3(ido, l1, ch, c, &wa[iw], &wa[ix2], isign); na = 1 - na; break; case 4: - ix2 = iw + idot; - ix3 = ix2 + idot; + ix2 = iw + ido; + ix3 = ix2 + ido; if (na == 0) - passf4(idot, l1, c, ch, &wa[iw], &wa[ix2], &wa[ix3], isign); + passf4(ido, l1, c, ch, &wa[iw], &wa[ix2], &wa[ix3], isign); else - passf4(idot, l1, ch, c, &wa[iw], &wa[ix2], &wa[ix3], isign); + passf4(ido, l1, ch, c, &wa[iw], &wa[ix2], &wa[ix3], isign); na = 1 - na; break; case 5: - ix2 = iw + idot; - ix3 = ix2 + idot; - ix4 = ix3 + idot; + ix2 = iw + ido; + ix3 = ix2 + ido; + ix4 = ix3 + ido; if (na == 0) - passf5(idot, l1, c, ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign); + passf5(ido, l1, c, ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign); else - passf5(idot, l1, ch, c, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign); + passf5(ido, l1, ch, c, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign); na = 1 - na; break; - default: - if (na == 0) - passf(&nac, idot, ip, l1, idl1, c, ch, &wa[iw], isign); - else - passf(&nac, idot, ip, l1, idl1, ch, c, &wa[iw], isign); - - if (nac != 0) - na = 1 - na; - break; } l1 = l2; - iw += (ip-1) * idot; + iw += (ip-1) * ido; } if (na == 0) return; - for (i = 0; i < 2*n; i++) - c[i] = ch[i]; + for (i = 0; i < n; i++) + { + RE(c[i]) = RE(ch[i]); + IM(c[i]) = IM(ch[i]); + } } -void cfftf(cfft_info cfft, real_t *c) +void cfftf(cfft_info *cfft, complex_t *c) { - cfftf1(cfft.n, c, cfft.work, cfft.tab, cfft.ifac, -1); + cfftf1(cfft->n, c, cfft->work, cfft->ifac, cfft->tab, -1); } -void cfftb(cfft_info cfft, real_t *c) +void cfftb(cfft_info *cfft, complex_t *c) { - cfftf1(cfft.n, c, cfft.work, cfft.tab, cfft.ifac, +1); + cfftf1(cfft->n, c, cfft->work, cfft->ifac, cfft->tab, +1); } -static void cffti1(uint16_t n, real_t *wa, uint16_t *ifac) +static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac) { static uint16_t ntryh[4] = {3, 4, 2, 5}; +#ifndef FIXED_POINT real_t arg, argh, argld, fi; - uint16_t idot, ntry, i, j; - uint16_t i1, k1, l1, l2, ib; - uint16_t ld, ii, nf, ip, nl, nq, nr; uint16_t ido, ipm; + uint16_t i1, k1, l1, l2; + uint16_t ld, ii, ip; +#endif + uint16_t ntry, i, j; + uint16_t ib; + uint16_t nf, nl, nq, nr; nl = n; nf = 0; @@ -610,8 +466,10 @@ startloop: ifac[0] = n; ifac[1] = nf; - argh = 2*M_PI / (real_t)n; - i = 1; + +#ifndef FIXED_POINT + argh = 2.0*M_PI / (real_t)n; + i = 0; l1 = 1; for (k1 = 1; k1 <= nf; k1++) @@ -620,53 +478,73 @@ startloop: ld = 0; l2 = l1*ip; ido = n / l2; - idot = ido + ido + 2; ipm = ip - 1; - for (j = 1; j <= ipm; j++) + for (j = 0; j < ipm; j++) { i1 = i; - wa[i-1] = 1; - wa[i] = 0; + RE(wa[i]) = 1.0; + IM(wa[i]) = 0.0; ld += l1; fi = 0; argld = ld*argh; - for (ii = 4; ii <= idot; ii += 2) + for (ii = 0; ii < ido; ii++) { - i += 2; - fi += 1; - arg = fi*argld; - wa[i-1] = cos(arg); - wa[i] = sin(arg); + i++; + fi++; + arg = fi * argld; + RE(wa[i]) = cos(arg); + IM(wa[i]) = sin(arg); } if (ip > 5) { - wa[i1-1] = wa[i-1]; - wa[i1] = wa[i]; + RE(wa[i1]) = RE(wa[i]); + IM(wa[i1]) = IM(wa[i]); } } l1 = l2; } +#endif } -cfft_info cffti(uint16_t n) +cfft_info *cffti(uint16_t n) { - cfft_info cfft; + cfft_info *cfft = (cfft_info*)malloc(sizeof(cfft_info)); - cfft.n = n; - cfft.work = malloc(2*n*sizeof(real_t)); - cfft.tab = malloc(2*n*sizeof(real_t)); + cfft->n = n; + cfft->work = (complex_t*)malloc(n*sizeof(complex_t)); - cffti1(n, cfft.tab, cfft.ifac); +#ifndef FIXED_POINT + cfft->tab = (complex_t*)malloc(n*sizeof(complex_t)); + + cffti1(n, cfft->tab, cfft->ifac); +#else + cffti1(n, NULL, cfft->ifac); + + switch (n) + { + case 60: cfft->tab = cfft_tab_60; break; + case 64: cfft->tab = cfft_tab_64; break; + case 480: cfft->tab = cfft_tab_480; break; + case 512: cfft->tab = cfft_tab_512; break; +#ifdef LD_DEC + case 240: cfft->tab = cfft_tab_240; break; + case 256: cfft->tab = cfft_tab_256; break; +#endif + } +#endif return cfft; } -void cfftu(cfft_info cfft) +void cfftu(cfft_info *cfft) { - if (cfft.work) free(cfft.work); - if (cfft.tab) free(cfft.tab); -} + if (cfft->work) free(cfft->work); +#ifndef FIXED_POINT + if (cfft->tab) free(cfft->tab); +#endif + if (cfft) free(cfft); +}
\ No newline at end of file diff --git a/src/libfaad/cfft.h b/src/libfaad/cfft.h index 2a9817d7e..c3d860e71 100644 --- a/src/libfaad/cfft.h +++ b/src/libfaad/cfft.h @@ -1,22 +1,22 @@ /* ** FAAD - Freeware Advanced Audio Decoder ** Copyright (C) 2002 M. Bakker -** +** ** 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 +** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: cfft.h,v 1.2 2002/10/22 04:47:50 storri Exp $ +** $Id: cfft.h,v 1.3 2002/12/16 18:59:55 miguelfreitas Exp $ **/ #ifndef __CFFT_H__ @@ -26,35 +26,25 @@ extern "C" { #endif -typedef struct -{ - real_t *work; - real_t *tab; - uint16_t ifac[15]; - uint16_t n; -} cfft_info; - -void cfftf(cfft_info cfft, real_t *c); /* complex transform */ -void cfftb(cfft_info cfft, real_t *c); /* its inverse */ -cfft_info cffti(uint16_t n); /* initializer of the above routine pair */ -void cfftu(cfft_info cfft); - - -static void passf2(uint16_t ido, uint16_t l1, real_t *cc, real_t *ch, - real_t *wa1, int8_t isign); -static void passf3(uint16_t ido, uint16_t l1, real_t *cc, real_t *ch, - real_t *wa1, real_t *wa2, int8_t isign); -static void passf4(uint16_t ido, uint16_t l1, real_t *cc, real_t *ch, - real_t *wa1, real_t *wa2, real_t *wa3, int8_t isign); -static void passf5(uint16_t ido, uint16_t l1, real_t *cc, real_t *ch, - real_t *wa1, real_t *wa2, real_t *wa3, real_t *wa4, + +void cfftf(cfft_info *cfft, complex_t *c); +void cfftb(cfft_info *cfft, complex_t *c); +cfft_info *cffti(uint16_t n); +void cfftu(cfft_info *cfft); + + +static void passf2(uint16_t ido, uint16_t l1, complex_t *cc, complex_t *ch, + complex_t *wa, int8_t isign); +static void passf3(uint16_t ido, uint16_t l1, complex_t *cc, complex_t *ch, + complex_t *wa1, complex_t *wa2, int8_t isign); +static void passf4(uint16_t ido, uint16_t l1, complex_t *cc, complex_t *ch, + complex_t *wa1, complex_t *wa2, complex_t *wa3, int8_t isign); +static void passf5(uint16_t ido, uint16_t l1, complex_t *cc, complex_t *ch, + complex_t *wa1, complex_t *wa2, complex_t *wa3, complex_t *wa4, int8_t isign); -static void passf(uint16_t *nac, uint16_t ido, uint16_t ip, uint16_t l1, - uint16_t idl1, real_t *cc, real_t *ch, real_t *wa, - int8_t isign); -INLINE void cfftf1(uint16_t n, real_t *c, real_t *ch, real_t *wa, - uint16_t *ifac, int8_t isign); -static void cffti1(uint16_t n, real_t *wa, uint16_t *ifac); +INLINE void cfftf1(uint16_t n, complex_t *c, complex_t *ch, + uint16_t *ifac, complex_t *wa, int8_t isign); +static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac); #ifdef __cplusplus diff --git a/src/libfaad/cfft_tab.h b/src/libfaad/cfft_tab.h new file mode 100644 index 000000000..f504fd074 --- /dev/null +++ b/src/libfaad/cfft_tab.h @@ -0,0 +1,1676 @@ +/* +** FAAD - Freeware Advanced Audio Decoder +** Copyright (C) 2002 M. Bakker +** +** 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. +** +** $Id: cfft_tab.h,v 1.1 2002/12/16 18:59:56 miguelfreitas Exp $ +**/ + +#ifndef __CFFT_TAB_H__ +#define __CFFT_TAB_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef FIXED_POINT + +complex_t cfft_tab_512[] = +{ + { 0x10000000, 0x0 }, + { 0xFFFB110, 0x3243A4 }, + { 0xFFEC430, 0x648558 }, + { 0xFFD3970, 0x96C32C }, + { 0xFFB10F0, 0xC8FB30 }, + { 0xFF84AB0, 0xFB2B75 }, + { 0xFF4E6D0, 0x12D520A }, + { 0xFF0E580, 0x15F6D02 }, + { 0xFEC46D0, 0x1917A6C }, + { 0xFE70B00, 0x1C3785C }, + { 0xFE13240, 0x1F564E6 }, + { 0xFDABCC0, 0x2273E1C }, + { 0xFD3AAC0, 0x259020C }, + { 0xFCBFC90, 0x28AAED8 }, + { 0xFC3B280, 0x2BC428C }, + { 0xFBACCD0, 0x2EDBB3C }, + { 0xFB14BE0, 0x31F1708 }, + { 0xFA73020, 0x3505408 }, + { 0xF9C79D0, 0x381704C }, + { 0xF912980, 0x3B26A00 }, + { 0xF853F80, 0x3E33F34 }, + { 0xF78BC50, 0x413EE08 }, + { 0xF6BA070, 0x44474A0 }, + { 0xF5DEC60, 0x474D110 }, + { 0xF4FA0B0, 0x4A50188 }, + { 0xF40BDD0, 0x4D50430 }, + { 0xF314470, 0x504D728 }, + { 0xF213520, 0x5347898 }, + { 0xF109080, 0x563E6A0 }, + { 0xEFF5730, 0x5931F78 }, + { 0xEED89E0, 0x5C22150 }, + { 0xEDB2930, 0x5F0EA50 }, + { 0xEC835E0, 0x61F78B0 }, + { 0xEB4B0C0, 0x64DCAA0 }, + { 0xEA09A60, 0x67BDE58 }, + { 0xE8BF3B0, 0x6A9B210 }, + { 0xE76BD80, 0x6D74400 }, + { 0xE60F880, 0x7049278 }, + { 0xE4AA590, 0x7319BA8 }, + { 0xE33C5A0, 0x75E5DD8 }, + { 0xE1C5970, 0x78AD750 }, + { 0xE046210, 0x7B70650 }, + { 0xDEBE050, 0x7E2E940 }, + { 0xDD2D530, 0x80E7E40 }, + { 0xDB941A0, 0x839C3D0 }, + { 0xD9F26A0, 0x864B830 }, + { 0xD848530, 0x88F59B0 }, + { 0xD695E50, 0x8B9A6B0 }, + { 0xD4DB310, 0x8E39DA0 }, + { 0xD318480, 0x90D3CD0 }, + { 0xD14D3D0, 0x93682B0 }, + { 0xCF7A1F0, 0x95F6DA0 }, + { 0xCD9F020, 0x987FC00 }, + { 0xCBBBF80, 0x9B02C50 }, + { 0xC9D1120, 0x9D7FD20 }, + { 0xC7DE650, 0x9FF6CB0 }, + { 0xC5E4030, 0xA2679A0 }, + { 0xC3E2000, 0xA4D2250 }, + { 0xC1D8700, 0xA736560 }, + { 0xBFC7670, 0xA994150 }, + { 0xBDAEF90, 0xABEB4A0 }, + { 0xBB8F3B0, 0xAE3BDE0 }, + { 0xB968420, 0xB085BB0 }, + { 0xB73A220, 0xB2C8CA0 }, + { 0xB504F30, 0xB504F30 }, + { 0xB2C8C90, 0xB73A230 }, + { 0xB085BA0, 0xB968420 }, + { 0xAE3BDE0, 0xBB8F3B0 }, + { 0xABEB490, 0xBDAEFA0 }, + { 0xA994140, 0xBFC7670 }, + { 0xA736550, 0xC1D8710 }, + { 0xA4D2250, 0xC3E2010 }, + { 0xA267990, 0xC5E4030 }, + { 0x9FF6CA0, 0xC7DE660 }, + { 0x9D7FD10, 0xC9D1120 }, + { 0x9B02C50, 0xCBBBF80 }, + { 0x987FC00, 0xCD9F020 }, + { 0x95F6D90, 0xCF7A1F0 }, + { 0x93682A0, 0xD14D3D0 }, + { 0x90D3CD0, 0xD318490 }, + { 0x8E39D90, 0xD4DB320 }, + { 0x8B9A6B0, 0xD695E50 }, + { 0x88F59B0, 0xD848530 }, + { 0x864B820, 0xD9F26A0 }, + { 0x839C3C0, 0xDB941B0 }, + { 0x80E7E50, 0xDD2D530 }, + { 0x7E2E938, 0xDEBE050 }, + { 0x7B70648, 0xE046220 }, + { 0x78AD738, 0xE1C5980 }, + { 0x75E5DD8, 0xE33C5A0 }, + { 0x7319BA0, 0xE4AA590 }, + { 0x7049268, 0xE60F880 }, + { 0x6D74408, 0xE76BD80 }, + { 0x6A9B208, 0xE8BF3C0 }, + { 0x67BDE48, 0xEA09A70 }, + { 0x64DCA80, 0xEB4B0C0 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x5F0EA40, 0xEDB2930 }, + { 0x5C22138, 0xEED89E0 }, + { 0x5931F78, 0xEFF5730 }, + { 0x563E698, 0xF109080 }, + { 0x5347880, 0xF213530 }, + { 0x504D710, 0xF314480 }, + { 0x4D50430, 0xF40BDD0 }, + { 0x4A50180, 0xF4FA0B0 }, + { 0x474D0F8, 0xF5DEC70 }, + { 0x4447498, 0xF6BA070 }, + { 0x413EE00, 0xF78BC50 }, + { 0x3E33F20, 0xF853F80 }, + { 0x3B26A04, 0xF912980 }, + { 0x3817048, 0xF9C79D0 }, + { 0x35053F8, 0xFA73020 }, + { 0x31F16F0, 0xFB14BF0 }, + { 0x2EDBB3C, 0xFBACCD0 }, + { 0x2BC4280, 0xFC3B280 }, + { 0x28AAEC4, 0xFCBFC90 }, + { 0x2590214, 0xFD3AAC0 }, + { 0x2273E14, 0xFDABCC0 }, + { 0x1F564D8, 0xFE13240 }, + { 0x1C37844, 0xFE70B00 }, + { 0x1917A6A, 0xFEC46D0 }, + { 0x15F6CF6, 0xFF0E580 }, + { 0x12D51F6, 0xFF4E6D0 }, + { 0xFB2B77, 0xFF84AB0 }, + { 0xC8FB29, 0xFFB10F0 }, + { 0x96C31C, 0xFFD3980 }, + { 0x64853F, 0xFFEC430 }, + { 0x3243A1, 0xFFFB110 }, + { 0xFFFFFFF5, 0x10000000 }, + { 0xFFCDBC47, 0xFFFB110 }, + { 0xFF9B7AAA, 0xFFEC430 }, + { 0xFF693CCD, 0xFFD3970 }, + { 0xFF3704BF, 0xFFB10F0 }, + { 0xFF04D472, 0xFF84AB0 }, + { 0xFED2ADF4, 0xFF4E6D0 }, + { 0xFEA092F2, 0xFF0E580 }, + { 0xFE6E857E, 0xFEC46D0 }, + { 0xFE3C87A4, 0xFE70B00 }, + { 0xFE0A9B12, 0xFE13230 }, + { 0xFDD8C1D4, 0xFDABCB0 }, + { 0xFDA6FDD8, 0xFD3AAC0 }, + { 0xFD755124, 0xFCBFC90 }, + { 0xFD43BD68, 0xFC3B280 }, + { 0xFD1244AC, 0xFBACCD0 }, + { 0xFCE0E8F8, 0xFB14BE0 }, + { 0xFCAFABF0, 0xFA73020 }, + { 0xFC7E8FA0, 0xF9C79D0 }, + { 0xFC4D95E8, 0xF912970 }, + { 0xFC1CC0CC, 0xF853F80 }, + { 0xFBEC11F0, 0xF78BC50 }, + { 0xFBBB8B50, 0xF6BA070 }, + { 0xFB8B2EF0, 0xF5DEC60 }, + { 0xFB5AFE68, 0xF4FA0A0 }, + { 0xFB2AFBB8, 0xF40BDD0 }, + { 0xFAFB28E0, 0xF314470 }, + { 0xFACB8768, 0xF213520 }, + { 0xFA9C1950, 0xF109080 }, + { 0xFA6CE070, 0xEFF5720 }, + { 0xFA3DDEB0, 0xEED89E0 }, + { 0xFA0F15A8, 0xEDB2930 }, + { 0xF9E08740, 0xEC835E0 }, + { 0xF9B23568, 0xEB4B0C0 }, + { 0xF98421A8, 0xEA09A60 }, + { 0xF9564E00, 0xE8BF3C0 }, + { 0xF928BC00, 0xE76BD80 }, + { 0xF8FB6D88, 0xE60F870 }, + { 0xF8CE6450, 0xE4AA590 }, + { 0xF8A1A210, 0xE33C590 }, + { 0xF8752898, 0xE1C5970 }, + { 0xF848F988, 0xE046200 }, + { 0xF81D16D0, 0xDEBE060 }, + { 0xF7F181C0, 0xDD2D530 }, + { 0xF7C63C30, 0xDB941A0 }, + { 0xF79B47D0, 0xD9F2690 }, + { 0xF770A640, 0xD848520 }, + { 0xF7465930, 0xD695E40 }, + { 0xF71C6240, 0xD4DB300 }, + { 0xF6F2C340, 0xD318490 }, + { 0xF6C97D60, 0xD14D3D0 }, + { 0xF6A09260, 0xCF7A1F0 }, + { 0xF67803F0, 0xCD9F020 }, + { 0xF64FD390, 0xCBBBF70 }, + { 0xF62802D0, 0xC9D1110 }, + { 0xF6009330, 0xC7DE630 }, + { 0xF5D98670, 0xC5E4040 }, + { 0xF5B2DDB0, 0xC3E2000 }, + { 0xF58C9AA0, 0xC1D8700 }, + { 0xF566BEB0, 0xBFC7660 }, + { 0xF5414B50, 0xBDAEF80 }, + { 0xF51C4200, 0xBB8F390 }, + { 0xF4F7A430, 0xB968400 }, + { 0xF4D37370, 0xB73A230 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0xF48C5DD0, 0xB2C8C90 }, + { 0xF4697BD0, 0xB085BA0 }, + { 0xF4470C40, 0xAE3BDD0 }, + { 0xF4251050, 0xABEB480 }, + { 0xF4038970, 0xA994120 }, + { 0xF3E27900, 0xA736560 }, + { 0xF3C1DFF0, 0xA4D2250 }, + { 0xF3A1BFC0, 0xA267990 }, + { 0xF38219A0, 0x9FF6CA0 }, + { 0xF362EED0, 0x9D7FD00 }, + { 0xF3444070, 0x9B02C40 }, + { 0xF3260FC0, 0x987FBD0 }, + { 0xF3085E10, 0x95F6D90 }, + { 0xF2EB2C30, 0x93682A0 }, + { 0xF2CE7B70, 0x90D3CC0 }, + { 0xF2B24CE0, 0x8E39D90 }, + { 0xF296A1A0, 0x8B9A690 }, + { 0xF27B7AC0, 0x88F5980 }, + { 0xF260D940, 0x864B800 }, + { 0xF246BE60, 0x839C3D0 }, + { 0xF22D2AD0, 0x80E7E40 }, + { 0xF2141FA0, 0x7E2E928 }, + { 0xF1FB9DE0, 0x7B70640 }, + { 0xF1E3A670, 0x78AD730 }, + { 0xF1CC3A50, 0x75E5DB0 }, + { 0xF1B55A70, 0x7319BB0 }, + { 0xF19F0780, 0x7049278 }, + { 0xF1894280, 0x6D743F8 }, + { 0xF1740C40, 0x6A9B1F8 }, + { 0xF15F6590, 0x67BDE38 }, + { 0xF14B4F40, 0x64DCA78 }, + { 0xF137CA00, 0x61F7880 }, + { 0xF124D6D0, 0x5F0EA58 }, + { 0xF1127620, 0x5C22150 }, + { 0xF100A8D0, 0x5931F70 }, + { 0xF0EF6F70, 0x563E690 }, + { 0xF0DECAD0, 0x5347878 }, + { 0xF0CEBB80, 0x504D700 }, + { 0xF0BF4220, 0x4D50408 }, + { 0xF0B05F50, 0x4A50198 }, + { 0xF0A213A0, 0x474D110 }, + { 0xF0945F90, 0x4447490 }, + { 0xF08743B0, 0x413EDF0 }, + { 0xF07AC080, 0x3E33F14 }, + { 0xF06ED680, 0x3B269D8 }, + { 0xF0638620, 0x3817020 }, + { 0xF058CFE0, 0x350540C }, + { 0xF04EB410, 0x31F1704 }, + { 0xF0453330, 0x2EDBB30 }, + { 0xF03C4D80, 0x2BC4274 }, + { 0xF0340370, 0x28AAEB8 }, + { 0xF02C5540, 0x25901E8 }, + { 0xF0254340, 0x2273DE8 }, + { 0xF01ECDD0, 0x1F564EC }, + { 0xF018F500, 0x1C3785A }, + { 0xF013B930, 0x1917A60 }, + { 0xF00F1A80, 0x15F6CEA }, + { 0xF00B1920, 0x12D51EA }, + { 0xF007B550, 0xFB2B4B }, + { 0xF004EF10, 0xC8FAFD }, + { 0xF002C690, 0x96C330 }, + { 0xF0013BD0, 0x648553 }, + { 0xF0004EF0, 0x324395 }, + { 0x10000000, 0x0 }, + { 0xFFEC430, 0x648558 }, + { 0xFFB10F0, 0xC8FB30 }, + { 0xFF4E6D0, 0x12D520A }, + { 0xFEC46D0, 0x1917A6C }, + { 0xFE13240, 0x1F564E6 }, + { 0xFD3AAC0, 0x259020C }, + { 0xFC3B280, 0x2BC428C }, + { 0xFB14BE0, 0x31F1708 }, + { 0xF9C79D0, 0x381704C }, + { 0xF853F80, 0x3E33F34 }, + { 0xF6BA070, 0x44474A0 }, + { 0xF4FA0B0, 0x4A50188 }, + { 0xF314470, 0x504D728 }, + { 0xF109080, 0x563E6A0 }, + { 0xEED89E0, 0x5C22150 }, + { 0xEC835E0, 0x61F78B0 }, + { 0xEA09A60, 0x67BDE58 }, + { 0xE76BD80, 0x6D74400 }, + { 0xE4AA590, 0x7319BA8 }, + { 0xE1C5970, 0x78AD750 }, + { 0xDEBE050, 0x7E2E940 }, + { 0xDB941A0, 0x839C3D0 }, + { 0xD848530, 0x88F59B0 }, + { 0xD4DB310, 0x8E39DA0 }, + { 0xD14D3D0, 0x93682B0 }, + { 0xCD9F020, 0x987FC00 }, + { 0xC9D1120, 0x9D7FD20 }, + { 0xC5E4030, 0xA2679A0 }, + { 0xC1D8700, 0xA736560 }, + { 0xBDAEF90, 0xABEB4A0 }, + { 0xB968420, 0xB085BB0 }, + { 0xB504F30, 0xB504F30 }, + { 0xB085BA0, 0xB968420 }, + { 0xABEB490, 0xBDAEFA0 }, + { 0xA736550, 0xC1D8710 }, + { 0xA267990, 0xC5E4030 }, + { 0x9D7FD10, 0xC9D1120 }, + { 0x987FC00, 0xCD9F020 }, + { 0x93682A0, 0xD14D3D0 }, + { 0x8E39D90, 0xD4DB320 }, + { 0x88F59B0, 0xD848530 }, + { 0x839C3C0, 0xDB941B0 }, + { 0x7E2E938, 0xDEBE050 }, + { 0x78AD738, 0xE1C5980 }, + { 0x7319BA0, 0xE4AA590 }, + { 0x6D74408, 0xE76BD80 }, + { 0x67BDE48, 0xEA09A70 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x5C22138, 0xEED89E0 }, + { 0x563E698, 0xF109080 }, + { 0x504D710, 0xF314480 }, + { 0x4A50180, 0xF4FA0B0 }, + { 0x4447498, 0xF6BA070 }, + { 0x3E33F20, 0xF853F80 }, + { 0x3817048, 0xF9C79D0 }, + { 0x31F16F0, 0xFB14BF0 }, + { 0x2BC4280, 0xFC3B280 }, + { 0x2590214, 0xFD3AAC0 }, + { 0x1F564D8, 0xFE13240 }, + { 0x1917A6A, 0xFEC46D0 }, + { 0x12D51F6, 0xFF4E6D0 }, + { 0xC8FB29, 0xFFB10F0 }, + { 0x64853F, 0xFFEC430 }, + { 0x10000000, 0x0 }, + { 0xFFB10F0, 0xC8FB30 }, + { 0xFEC46D0, 0x1917A6C }, + { 0xFD3AAC0, 0x259020C }, + { 0xFB14BE0, 0x31F1708 }, + { 0xF853F80, 0x3E33F34 }, + { 0xF4FA0B0, 0x4A50188 }, + { 0xF109080, 0x563E6A0 }, + { 0xEC835E0, 0x61F78B0 }, + { 0xE76BD80, 0x6D74400 }, + { 0xE1C5970, 0x78AD750 }, + { 0xDB941A0, 0x839C3D0 }, + { 0xD4DB310, 0x8E39DA0 }, + { 0xCD9F020, 0x987FC00 }, + { 0xC5E4030, 0xA2679A0 }, + { 0xBDAEF90, 0xABEB4A0 }, + { 0xB504F30, 0xB504F30 }, + { 0xABEB490, 0xBDAEFA0 }, + { 0xA267990, 0xC5E4030 }, + { 0x987FC00, 0xCD9F020 }, + { 0x8E39D90, 0xD4DB320 }, + { 0x839C3C0, 0xDB941B0 }, + { 0x78AD738, 0xE1C5980 }, + { 0x6D74408, 0xE76BD80 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x563E698, 0xF109080 }, + { 0x4A50180, 0xF4FA0B0 }, + { 0x3E33F20, 0xF853F80 }, + { 0x31F16F0, 0xFB14BF0 }, + { 0x2590214, 0xFD3AAC0 }, + { 0x1917A6A, 0xFEC46D0 }, + { 0xC8FB29, 0xFFB10F0 }, + { 0xFFFFFFF5, 0x10000000 }, + { 0xFF3704BF, 0xFFB10F0 }, + { 0xFE6E857E, 0xFEC46D0 }, + { 0xFDA6FDD8, 0xFD3AAC0 }, + { 0xFCE0E8F8, 0xFB14BE0 }, + { 0xFC1CC0CC, 0xF853F80 }, + { 0xFB5AFE68, 0xF4FA0A0 }, + { 0xFA9C1950, 0xF109080 }, + { 0xF9E08740, 0xEC835E0 }, + { 0xF928BC00, 0xE76BD80 }, + { 0xF8752898, 0xE1C5970 }, + { 0xF7C63C30, 0xDB941A0 }, + { 0xF71C6240, 0xD4DB300 }, + { 0xF67803F0, 0xCD9F020 }, + { 0xF5D98670, 0xC5E4040 }, + { 0xF5414B50, 0xBDAEF80 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0xF4251050, 0xABEB480 }, + { 0xF3A1BFC0, 0xA267990 }, + { 0xF3260FC0, 0x987FBD0 }, + { 0xF2B24CE0, 0x8E39D90 }, + { 0xF246BE60, 0x839C3D0 }, + { 0xF1E3A670, 0x78AD730 }, + { 0xF1894280, 0x6D743F8 }, + { 0xF137CA00, 0x61F7880 }, + { 0xF0EF6F70, 0x563E690 }, + { 0xF0B05F50, 0x4A50198 }, + { 0xF07AC080, 0x3E33F14 }, + { 0xF04EB410, 0x31F1704 }, + { 0xF02C5540, 0x25901E8 }, + { 0xF013B930, 0x1917A60 }, + { 0xF004EF10, 0xC8FAFD }, + { 0x10000000, 0x0 }, + { 0xFF4E6D0, 0x12D520A }, + { 0xFD3AAC0, 0x259020C }, + { 0xF9C79D0, 0x381704C }, + { 0xF4FA0B0, 0x4A50188 }, + { 0xEED89E0, 0x5C22150 }, + { 0xE76BD80, 0x6D74400 }, + { 0xDEBE050, 0x7E2E940 }, + { 0xD4DB310, 0x8E39DA0 }, + { 0xC9D1130, 0x9D7FD10 }, + { 0xBDAEF90, 0xABEB4A0 }, + { 0xB085BA0, 0xB968420 }, + { 0xA267990, 0xC5E4030 }, + { 0x93682B0, 0xD14D3D0 }, + { 0x839C3C0, 0xDB941B0 }, + { 0x7319BA0, 0xE4AA590 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x504D728, 0xF314470 }, + { 0x3E33F40, 0xF853F80 }, + { 0x2BC4280, 0xFC3B280 }, + { 0x1917A6A, 0xFEC46D0 }, + { 0x64855F, 0xFFEC430 }, + { 0xFF3704BF, 0xFFB10F0 }, + { 0xFE0A9B12, 0xFE13230 }, + { 0xFCE0E8F8, 0xFB14BE0 }, + { 0xFBBB8B70, 0xF6BA070 }, + { 0xFA9C1970, 0xF109080 }, + { 0xF98421A8, 0xEA09A60 }, + { 0xF8752898, 0xE1C5970 }, + { 0xF770A640, 0xD848520 }, + { 0xF67803F0, 0xCD9F020 }, + { 0xF58C9AA0, 0xC1D8700 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0xF3E27900, 0xA736560 }, + { 0xF3260FE0, 0x987FC10 }, + { 0xF27B7AE0, 0x88F59C0 }, + { 0xF1E3A690, 0x78AD768 }, + { 0xF15F6590, 0x67BDE38 }, + { 0xF0EF6F70, 0x563E690 }, + { 0xF0945F90, 0x4447490 }, + { 0xF04EB410, 0x31F1704 }, + { 0xF01ECDD0, 0x1F564EC }, + { 0xF004EF10, 0xC8FB3D }, + { 0xF0013BD0, 0xFF9B7ABE }, + { 0xF013B930, 0xFE6E8572 }, + { 0xF03C4D80, 0xFD43BD5C }, + { 0xF07AC080, 0xFC1CC0C0 }, + { 0xF0CEBB90, 0xFAFB28D0 }, + { 0xF137CA20, 0xF9E08758 }, + { 0xF1B55A70, 0xF8CE6460 }, + { 0xF246BE50, 0xF7C63C40 }, + { 0xF2EB2C20, 0xF6C97D70 }, + { 0xF3A1BFB0, 0xF5D98680 }, + { 0xF4697BF0, 0xF4F7A440 }, + { 0xF5414B70, 0xF4251060 }, + { 0xF62802F0, 0xF362EED0 }, + { 0xF71C62A0, 0xF2B24CC0 }, + { 0xF81D16C8, 0xF2141FB0 }, + { 0xF928BC28, 0xF1894270 }, + { 0xFA3DDEA0, 0xF1127630 }, + { 0xFB5AFE98, 0xF0B05F50 }, + { 0xFC7E8F90, 0xF0638630 }, + { 0xFDA6FE04, 0xF02C5540 }, + { 0xFED2ADC2, 0xF00B1930 }, + { 0x10000000, 0x0 }, + { 0xFEC46D0, 0x1917A6C }, + { 0xFB14BE0, 0x31F1708 }, + { 0xF4FA0B0, 0x4A50188 }, + { 0xEC835E0, 0x61F78B0 }, + { 0xE1C5970, 0x78AD750 }, + { 0xD4DB310, 0x8E39DA0 }, + { 0xC5E4030, 0xA2679A0 }, + { 0xB504F30, 0xB504F30 }, + { 0xA267990, 0xC5E4030 }, + { 0x8E39D90, 0xD4DB320 }, + { 0x78AD738, 0xE1C5980 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x4A50180, 0xF4FA0B0 }, + { 0x31F16F0, 0xFB14BF0 }, + { 0x1917A6A, 0xFEC46D0 }, + { 0x10000000, 0x0 }, + { 0xFB14BE0, 0x31F1708 }, + { 0xEC835E0, 0x61F78B0 }, + { 0xD4DB310, 0x8E39DA0 }, + { 0xB504F30, 0xB504F30 }, + { 0x8E39D90, 0xD4DB320 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x31F16F0, 0xFB14BF0 }, + { 0xFFFFFFF5, 0x10000000 }, + { 0xFCE0E8F8, 0xFB14BE0 }, + { 0xF9E08740, 0xEC835E0 }, + { 0xF71C6240, 0xD4DB300 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0xF2B24CE0, 0x8E39D90 }, + { 0xF137CA00, 0x61F7880 }, + { 0xF04EB410, 0x31F1704 }, + { 0x10000000, 0x0 }, + { 0xF4FA0B0, 0x4A50188 }, + { 0xD4DB310, 0x8E39DA0 }, + { 0xA267990, 0xC5E4030 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x1917A6A, 0xFEC46D0 }, + { 0xFCE0E8F8, 0xFB14BE0 }, + { 0xF8752898, 0xE1C5970 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0xF1E3A690, 0x78AD768 }, + { 0xF04EB410, 0x31F1704 }, + { 0xF013B930, 0xFE6E8572 }, + { 0xF137CA20, 0xF9E08758 }, + { 0xF3A1BFB0, 0xF5D98680 }, + { 0xF71C62A0, 0xF2B24CC0 }, + { 0xFB5AFE98, 0xF0B05F50 }, + { 0x10000000, 0x0 }, + { 0xEC835E0, 0x61F78B0 }, + { 0xB504F30, 0xB504F30 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x10000000, 0x0 }, + { 0xB504F30, 0xB504F30 }, + { 0xFFFFFFF5, 0x10000000 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0x10000000, 0x0 }, + { 0x61F78A8, 0xEC835E0 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0xF137CA20, 0xF9E08758 }, + { 0x10000000, 0x0 }, + { 0x10000000, 0x0 }, + { 0x10000000, 0x0 }, + { 0x3, 0xF0000000 } +}; + +complex_t cfft_tab_480[] = +{ + { 0x10000000, 0x0 }, + { 0xFFFA630, 0x359D6F }, + { 0xFFE98B0, 0x6B3885 }, + { 0xFFCD790, 0xA0CEE7 }, + { 0xFFA62F0, 0xD65E3B }, + { 0xFF73AF0, 0x10BE428 }, + { 0xFF35F90, 0x1415E54 }, + { 0xFEED120, 0x176CA68 }, + { 0xFE98FD0, 0x1AC260A }, + { 0xFE39BC0, 0x1E16EE6 }, + { 0xFDCF550, 0x216A2A4 }, + { 0xFD59CB0, 0x24BBEEC }, + { 0xFCD9250, 0x280C170 }, + { 0xFC4D670, 0x2B5A7D4 }, + { 0xFBB6980, 0x2EA6FCC }, + { 0xFB14BE0, 0x31F1708 }, + { 0xFA67E20, 0x3539B38 }, + { 0xF9B0090, 0x387FA0C }, + { 0xF8ED3C0, 0x3BC3138 }, + { 0xF81F840, 0x3F03E70 }, + { 0xF746EA0, 0x4241F70 }, + { 0xF663770, 0x457D1F0 }, + { 0xF575360, 0x48B53B0 }, + { 0xF47C300, 0x4BEA268 }, + { 0xF378710, 0x4F1BBD0 }, + { 0xF26A030, 0x5249DB0 }, + { 0xF150F40, 0x55745E0 }, + { 0xF02D4F0, 0x589B210 }, + { 0xEEFF200, 0x5BBE008 }, + { 0xEDC6770, 0x5EDCDA0 }, + { 0xEC835E0, 0x61F78B0 }, + { 0xEB35E60, 0x650DEF8 }, + { 0xE9DE1D0, 0x681FE48 }, + { 0xE87C120, 0x6B2D490 }, + { 0xE70FD40, 0x6E35FA0 }, + { 0xE599740, 0x7139D58 }, + { 0xE419010, 0x7438B90 }, + { 0xE28E8D0, 0x7732838 }, + { 0xE0FA280, 0x7A27140 }, + { 0xDF5BE60, 0x7D16488 }, + { 0xDDB3D70, 0x8000000 }, + { 0xDC020F0, 0x82E41B0 }, + { 0xDA46A00, 0x85C2770 }, + { 0xD8819E0, 0x889AF60 }, + { 0xD6B31D0, 0x8B6D770 }, + { 0xD4DB310, 0x8E39DA0 }, + { 0xD2F9EF0, 0x9100000 }, + { 0xD10F6B0, 0x93BFCA0 }, + { 0xCF1BBD0, 0x9679180 }, + { 0xCD1EF80, 0x992BCD0 }, + { 0xCB19340, 0x9BD7CA0 }, + { 0xC90A870, 0x9E7CF10 }, + { 0xC6F3090, 0xA11B240 }, + { 0xC4D2D10, 0xA3B2460 }, + { 0xC2A9F70, 0xA6423B0 }, + { 0xC078920, 0xA8CAE40 }, + { 0xBE3EBD0, 0xAB4C250 }, + { 0xBBFC8F0, 0xADC5E30 }, + { 0xB9B2230, 0xB038010 }, + { 0xB75F900, 0xB2A2660 }, + { 0xB504F30, 0xB504F30 }, + { 0xB2A2650, 0xB75F910 }, + { 0xB038010, 0xB9B2230 }, + { 0xADC5E20, 0xBBFC900 }, + { 0xAB4C240, 0xBE3EBE0 }, + { 0xA8CAE30, 0xC078930 }, + { 0xA6423A0, 0xC2A9F70 }, + { 0xA3B2460, 0xC4D2D20 }, + { 0xA11B240, 0xC6F30A0 }, + { 0x9E7CF10, 0xC90A880 }, + { 0x9BD7C90, 0xCB19350 }, + { 0x992BCD0, 0xCD1EF90 }, + { 0x9679180, 0xCF1BBD0 }, + { 0x93BFC90, 0xD10F6C0 }, + { 0x9100000, 0xD2F9EF0 }, + { 0x8E39D90, 0xD4DB320 }, + { 0x8B6D760, 0xD6B31E0 }, + { 0x889AF60, 0xD8819E0 }, + { 0x85C2760, 0xDA46A10 }, + { 0x82E41B0, 0xDC020F0 }, + { 0x7FFFFF8, 0xDDB3D80 }, + { 0x7D16470, 0xDF5BE70 }, + { 0x7A27138, 0xE0FA290 }, + { 0x7732828, 0xE28E8D0 }, + { 0x7438B90, 0xE419010 }, + { 0x7139D48, 0xE599740 }, + { 0x6E35F88, 0xE70FD50 }, + { 0x6B2D490, 0xE87C120 }, + { 0x681FE40, 0xE9DE1E0 }, + { 0x650DEE0, 0xEB35E70 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x5EDCD98, 0xEDC6770 }, + { 0x5BBDFF0, 0xEEFF210 }, + { 0x589B208, 0xF02D4F0 }, + { 0x55745D0, 0xF150F40 }, + { 0x5249DB8, 0xF26A030 }, + { 0x4F1BBC8, 0xF378710 }, + { 0x4BEA250, 0xF47C300 }, + { 0x48B53A8, 0xF575360 }, + { 0x457D1E0, 0xF663780 }, + { 0x4241F78, 0xF746EA0 }, + { 0x3F03E68, 0xF81F840 }, + { 0x3BC3124, 0xF8ED3C0 }, + { 0x387FA0C, 0xF9B0090 }, + { 0x3539B2C, 0xFA67E20 }, + { 0x31F16F0, 0xFB14BF0 }, + { 0x2EA6FCC, 0xFBB6980 }, + { 0x2B5A7C4, 0xFC4D670 }, + { 0x280C154, 0xFCD9250 }, + { 0x24BBEE4, 0xFD59CB0 }, + { 0x216A290, 0xFDCF550 }, + { 0x1E16EE6, 0xFE39BC0 }, + { 0x1AC25FE, 0xFE98FD0 }, + { 0x176CA50, 0xFEED120 }, + { 0x1415E50, 0xFF35F90 }, + { 0x10BE418, 0xFF73AF0 }, + { 0xD65E3F, 0xFFA62F0 }, + { 0xA0CEDF, 0xFFCD790 }, + { 0x6B3871, 0xFFE98B0 }, + { 0x359D70, 0xFFFA630 }, + { 0xFFFFFFF5, 0x10000000 }, + { 0xFFCA6279, 0xFFFA630 }, + { 0xFF94C777, 0xFFE98B0 }, + { 0xFF5F3109, 0xFFCD790 }, + { 0xFF29A1AA, 0xFFA62F0 }, + { 0xFEF41BD0, 0xFF73AF0 }, + { 0xFEBEA198, 0xFF35F90 }, + { 0xFE893598, 0xFEED120 }, + { 0xFE53D9EA, 0xFE98FD0 }, + { 0xFE1E9102, 0xFE39BC0 }, + { 0xFDE95D58, 0xFDCF550 }, + { 0xFDB44104, 0xFD59CB0 }, + { 0xFD7F3E98, 0xFCD9250 }, + { 0xFD4A5824, 0xFC4D670 }, + { 0xFD159020, 0xFBB6980 }, + { 0xFCE0E8F8, 0xFB14BE0 }, + { 0xFCAC64BC, 0xFA67E10 }, + { 0xFC7805E0, 0xF9B0080 }, + { 0xFC43CEC4, 0xF8ED3C0 }, + { 0xFC0FC180, 0xF81F840 }, + { 0xFBDBE070, 0xF746EA0 }, + { 0xFBA82E08, 0xF663770 }, + { 0xFB74AC40, 0xF575350 }, + { 0xFB415DA0, 0xF47C300 }, + { 0xFB0E4428, 0xF378700 }, + { 0xFADB6230, 0xF26A030 }, + { 0xFAA8BA20, 0xF150F40 }, + { 0xFA764DE8, 0xF02D4E0 }, + { 0xFA441FF8, 0xEEFF210 }, + { 0xFA123250, 0xEDC6760 }, + { 0xF9E08740, 0xEC835E0 }, + { 0xF9AF2110, 0xEB35E70 }, + { 0xF97E01A8, 0xE9DE1D0 }, + { 0xF94D2B58, 0xE87C110 }, + { 0xF91CA060, 0xE70FD40 }, + { 0xF8EC62C0, 0xE599740 }, + { 0xF8BC7458, 0xE419000 }, + { 0xF88CD7C0, 0xE28E8C0 }, + { 0xF85D8ED0, 0xE0FA290 }, + { 0xF82E9B60, 0xDF5BE50 }, + { 0xF7FFFFF0, 0xDDB3D70 }, + { 0xF7D1BE60, 0xDC020F0 }, + { 0xF7A3D870, 0xDA469F0 }, + { 0xF7765090, 0xD8819E0 }, + { 0xF7492890, 0xD6B31D0 }, + { 0xF71C6240, 0xD4DB300 }, + { 0xF6EFFFF0, 0xD2F9EE0 }, + { 0xF6C40360, 0xD10F6C0 }, + { 0xF6986E90, 0xCF1BBD0 }, + { 0xF66D4320, 0xCD1EF70 }, + { 0xF6428360, 0xCB19340 }, + { 0xF6183100, 0xC90A880 }, + { 0xF5EE4DA0, 0xC6F3080 }, + { 0xF5C4DB90, 0xC4D2D10 }, + { 0xF59BDC60, 0xC2A9F70 }, + { 0xF57351B0, 0xC078910 }, + { 0xF54B3DA0, 0xBE3EBD0 }, + { 0xF523A1D0, 0xBBFC8F0 }, + { 0xF4FC7FD0, 0xB9B2210 }, + { 0xF4D5D9A0, 0xB75F8F0 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0xF48A06E0, 0xB2A2630 }, + { 0xF464DDC0, 0xB038000 }, + { 0xF4403700, 0xADC5E20 }, + { 0xF41C1410, 0xAB4C220 }, + { 0xF3F876C0, 0xA8CAE20 }, + { 0xF3D56080, 0xA6423A0 }, + { 0xF3B2D2F0, 0xA3B2470 }, + { 0xF390CF50, 0xA11B220 }, + { 0xF36F5780, 0x9E7CF00 }, + { 0xF34E6CC0, 0x9BD7CA0 }, + { 0xF32E1060, 0x992BCB0 }, + { 0xF30E4420, 0x9679170 }, + { 0xF2EF0940, 0x93BFCA0 }, + { 0xF2D060F0, 0x90FFFE0 }, + { 0xF2B24CE0, 0x8E39D90 }, + { 0xF294CE30, 0x8B6D770 }, + { 0xF277E600, 0x889AF30 }, + { 0xF25B95F0, 0x85C2760 }, + { 0xF23FDF10, 0x82E41A0 }, + { 0xF224C290, 0x8000010 }, + { 0xF20A4190, 0x7D16468 }, + { 0xF1F05D70, 0x7A27130 }, + { 0xF1D71730, 0x7732840 }, + { 0xF1BE6FE0, 0x7438B68 }, + { 0xF1A668C0, 0x7139D40 }, + { 0xF18F02C0, 0x6E35FA0 }, + { 0xF1783ED0, 0x6B2D468 }, + { 0xF1621E20, 0x681FE38 }, + { 0xF14CA190, 0x650DEF0 }, + { 0xF137CA00, 0x61F7880 }, + { 0xF1239890, 0x5EDCD88 }, + { 0xF1100DF0, 0x5BBE000 }, + { 0xF0FD2B00, 0x589B1E0 }, + { 0xF0EAF0B0, 0x55745C0 }, + { 0xF0D95FC0, 0x5249DB0 }, + { 0xF0C878E0, 0x4F1BB98 }, + { 0xF0B83CF0, 0x4BEA240 }, + { 0xF0A8ACA0, 0x48B53A0 }, + { 0xF099C890, 0x457D1F8 }, + { 0xF08B9150, 0x4241F50 }, + { 0xF07E07B0, 0x3F03E60 }, + { 0xF0712C40, 0x3BC3138 }, + { 0xF064FF70, 0x387F9E0 }, + { 0xF05981E0, 0x3539B20 }, + { 0xF04EB410, 0x31F1704 }, + { 0xF0449680, 0x2EA6FA0 }, + { 0xF03B2990, 0x2B5A7B8 }, + { 0xF0326DB0, 0x280C168 }, + { 0xF02A6340, 0x24BBEB8 }, + { 0xF0230AB0, 0x216A284 }, + { 0xF01C6440, 0x1E16EDA }, + { 0xF0167030, 0x1AC2612 }, + { 0xF0112ED0, 0x176CA44 }, + { 0xF00CA060, 0x1415E44 }, + { 0xF008C510, 0x10BE42C }, + { 0xF0059D00, 0xD65E13 }, + { 0xF0032870, 0xA0CED3 }, + { 0xF0016750, 0x6B3886 }, + { 0xF00059D0, 0x359D44 }, + { 0x10000000, 0x0 }, + { 0xFFE98B0, 0x6B3885 }, + { 0xFFA62F0, 0xD65E3B }, + { 0xFF35F90, 0x1415E54 }, + { 0xFE98FD0, 0x1AC260A }, + { 0xFDCF550, 0x216A2A4 }, + { 0xFCD9250, 0x280C170 }, + { 0xFBB6980, 0x2EA6FCC }, + { 0xFA67E20, 0x3539B38 }, + { 0xF8ED3C0, 0x3BC3138 }, + { 0xF746EA0, 0x4241F70 }, + { 0xF575360, 0x48B53B0 }, + { 0xF378710, 0x4F1BBD0 }, + { 0xF150F40, 0x55745E0 }, + { 0xEEFF200, 0x5BBE008 }, + { 0xEC835E0, 0x61F78B0 }, + { 0xE9DE1D0, 0x681FE48 }, + { 0xE70FD40, 0x6E35FA0 }, + { 0xE419010, 0x7438B90 }, + { 0xE0FA280, 0x7A27140 }, + { 0xDDB3D70, 0x8000000 }, + { 0xDA46A00, 0x85C2770 }, + { 0xD6B31D0, 0x8B6D770 }, + { 0xD2F9EF0, 0x9100000 }, + { 0xCF1BBD0, 0x9679180 }, + { 0xCB19340, 0x9BD7CA0 }, + { 0xC6F3090, 0xA11B240 }, + { 0xC2A9F70, 0xA6423B0 }, + { 0xBE3EBD0, 0xAB4C250 }, + { 0xB9B2230, 0xB038010 }, + { 0xB504F30, 0xB504F30 }, + { 0xB038010, 0xB9B2230 }, + { 0xAB4C240, 0xBE3EBE0 }, + { 0xA6423A0, 0xC2A9F70 }, + { 0xA11B240, 0xC6F30A0 }, + { 0x9BD7C90, 0xCB19350 }, + { 0x9679180, 0xCF1BBD0 }, + { 0x9100000, 0xD2F9EF0 }, + { 0x8B6D760, 0xD6B31E0 }, + { 0x85C2760, 0xDA46A10 }, + { 0x7FFFFF8, 0xDDB3D80 }, + { 0x7A27138, 0xE0FA290 }, + { 0x7438B90, 0xE419010 }, + { 0x6E35F88, 0xE70FD50 }, + { 0x681FE40, 0xE9DE1E0 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x5BBDFF0, 0xEEFF210 }, + { 0x55745D0, 0xF150F40 }, + { 0x4F1BBC8, 0xF378710 }, + { 0x48B53A8, 0xF575360 }, + { 0x4241F78, 0xF746EA0 }, + { 0x3BC3124, 0xF8ED3C0 }, + { 0x3539B2C, 0xFA67E20 }, + { 0x2EA6FCC, 0xFBB6980 }, + { 0x280C154, 0xFCD9250 }, + { 0x216A290, 0xFDCF550 }, + { 0x1AC25FE, 0xFE98FD0 }, + { 0x1415E50, 0xFF35F90 }, + { 0xD65E3F, 0xFFA62F0 }, + { 0x6B3871, 0xFFE98B0 }, + { 0xFFFFFFF5, 0x10000000 }, + { 0xFF94C777, 0xFFE98B0 }, + { 0xFF29A1AA, 0xFFA62F0 }, + { 0xFEBEA198, 0xFF35F90 }, + { 0xFE53D9EA, 0xFE98FD0 }, + { 0xFDE95D58, 0xFDCF550 }, + { 0xFD7F3E98, 0xFCD9250 }, + { 0xFD159020, 0xFBB6980 }, + { 0xFCAC64BC, 0xFA67E10 }, + { 0xFC43CEC4, 0xF8ED3C0 }, + { 0xFBDBE070, 0xF746EA0 }, + { 0xFB74AC40, 0xF575350 }, + { 0xFB0E4428, 0xF378700 }, + { 0xFAA8BA20, 0xF150F40 }, + { 0xFA441FF8, 0xEEFF210 }, + { 0xF9E08740, 0xEC835E0 }, + { 0xF97E01A8, 0xE9DE1D0 }, + { 0xF91CA060, 0xE70FD40 }, + { 0xF8BC7458, 0xE419000 }, + { 0xF85D8ED0, 0xE0FA290 }, + { 0x10000000, 0x0 }, + { 0xFFA62F0, 0xD65E3B }, + { 0xFE98FD0, 0x1AC260A }, + { 0xFCD9250, 0x280C170 }, + { 0xFA67E20, 0x3539B38 }, + { 0xF746EA0, 0x4241F70 }, + { 0xF378710, 0x4F1BBD0 }, + { 0xEEFF200, 0x5BBE008 }, + { 0xE9DE1D0, 0x681FE48 }, + { 0xE419010, 0x7438B90 }, + { 0xDDB3D70, 0x8000000 }, + { 0xD6B31D0, 0x8B6D770 }, + { 0xCF1BBD0, 0x9679180 }, + { 0xC6F3090, 0xA11B240 }, + { 0xBE3EBD0, 0xAB4C250 }, + { 0xB504F30, 0xB504F30 }, + { 0xAB4C240, 0xBE3EBE0 }, + { 0xA11B240, 0xC6F30A0 }, + { 0x9679180, 0xCF1BBD0 }, + { 0x8B6D760, 0xD6B31E0 }, + { 0x7FFFFF8, 0xDDB3D80 }, + { 0x7438B90, 0xE419010 }, + { 0x681FE40, 0xE9DE1E0 }, + { 0x5BBDFF0, 0xEEFF210 }, + { 0x4F1BBC8, 0xF378710 }, + { 0x4241F78, 0xF746EA0 }, + { 0x3539B2C, 0xFA67E20 }, + { 0x280C154, 0xFCD9250 }, + { 0x1AC25FE, 0xFE98FD0 }, + { 0xD65E3F, 0xFFA62F0 }, + { 0xFFFFFFF5, 0x10000000 }, + { 0xFF29A1AA, 0xFFA62F0 }, + { 0xFE53D9EA, 0xFE98FD0 }, + { 0xFD7F3E98, 0xFCD9250 }, + { 0xFCAC64BC, 0xFA67E10 }, + { 0xFBDBE070, 0xF746EA0 }, + { 0xFB0E4428, 0xF378700 }, + { 0xFA441FF8, 0xEEFF210 }, + { 0xF97E01A8, 0xE9DE1D0 }, + { 0xF8BC7458, 0xE419000 }, + { 0xF7FFFFF0, 0xDDB3D70 }, + { 0xF7492890, 0xD6B31D0 }, + { 0xF6986E90, 0xCF1BBD0 }, + { 0xF5EE4DA0, 0xC6F3080 }, + { 0xF54B3DA0, 0xBE3EBD0 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0xF41C1410, 0xAB4C220 }, + { 0xF390CF50, 0xA11B220 }, + { 0xF30E4420, 0x9679170 }, + { 0xF294CE30, 0x8B6D770 }, + { 0xF224C290, 0x8000010 }, + { 0xF1BE6FE0, 0x7438B68 }, + { 0xF1621E20, 0x681FE38 }, + { 0xF1100DF0, 0x5BBE000 }, + { 0xF0C878E0, 0x4F1BB98 }, + { 0xF08B9150, 0x4241F50 }, + { 0xF05981E0, 0x3539B20 }, + { 0xF0326DB0, 0x280C168 }, + { 0xF0167030, 0x1AC2612 }, + { 0xF0059D00, 0xD65E13 }, + { 0xF0000000, 0xFFFFFFE9 }, + { 0xF0059D10, 0xFF29A1BE }, + { 0xF0167040, 0xFE53D9BE }, + { 0xF0326DC0, 0xFD7F3E6C }, + { 0xF05981F0, 0xFCAC64B0 }, + { 0xF08B9160, 0xFBDBE088 }, + { 0xF0C878F0, 0xFB0E4438 }, + { 0xF1100E00, 0xFA441FD0 }, + { 0xF1621E30, 0xF97E01A0 }, + { 0xF1BE6FF0, 0xF8BC7468 }, + { 0xF224C2B0, 0xF7FFFFD0 }, + { 0xF294CE40, 0xF7492870 }, + { 0xF30E4440, 0xF6986E60 }, + { 0xF390CF70, 0xF5EE4DB0 }, + { 0xF41C1430, 0xF54B3DB0 }, + { 0xF4AFB0F0, 0xF4AFB0B0 }, + { 0xF54B3DD0, 0xF41C1420 }, + { 0xF5EE4DD0, 0xF390CF60 }, + { 0xF6986EB0, 0xF30E4410 }, + { 0xF7492880, 0xF294CE30 }, + { 0x10000000, 0x0 }, + { 0xFF35F90, 0x1415E54 }, + { 0xFCD9250, 0x280C170 }, + { 0xF8ED3C0, 0x3BC3138 }, + { 0xF378710, 0x4F1BBD0 }, + { 0xEC835E0, 0x61F78B0 }, + { 0xE419010, 0x7438B90 }, + { 0xDA46A00, 0x85C2770 }, + { 0xCF1BBD0, 0x9679180 }, + { 0xC2A9F70, 0xA6423B0 }, + { 0xB504F30, 0xB504F30 }, + { 0xA6423A0, 0xC2A9F70 }, + { 0x9679180, 0xCF1BBD0 }, + { 0x85C2760, 0xDA46A10 }, + { 0x7438B90, 0xE419010 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x4F1BBC8, 0xF378710 }, + { 0x3BC3124, 0xF8ED3C0 }, + { 0x280C154, 0xFCD9250 }, + { 0x1415E50, 0xFF35F90 }, + { 0x10000000, 0x0 }, + { 0xFCD9250, 0x280C170 }, + { 0xF378710, 0x4F1BBD0 }, + { 0xE419010, 0x7438B90 }, + { 0xCF1BBD0, 0x9679180 }, + { 0xB504F30, 0xB504F30 }, + { 0x9679180, 0xCF1BBD0 }, + { 0x7438B90, 0xE419010 }, + { 0x4F1BBC8, 0xF378710 }, + { 0x280C154, 0xFCD9250 }, + { 0xFFFFFFF5, 0x10000000 }, + { 0xFD7F3E98, 0xFCD9250 }, + { 0xFB0E4428, 0xF378700 }, + { 0xF8BC7458, 0xE419000 }, + { 0xF6986E90, 0xCF1BBD0 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0xF30E4420, 0x9679170 }, + { 0xF1BE6FE0, 0x7438B68 }, + { 0xF0C878E0, 0x4F1BB98 }, + { 0xF0326DB0, 0x280C168 }, + { 0x10000000, 0x0 }, + { 0xF8ED3C0, 0x3BC3138 }, + { 0xE419010, 0x7438B90 }, + { 0xC2A9F70, 0xA6423B0 }, + { 0x9679180, 0xCF1BBD0 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x280C154, 0xFCD9250 }, + { 0xFEBEA198, 0xFF35F90 }, + { 0xFB0E4428, 0xF378700 }, + { 0xF7A3D870, 0xDA469F0 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0xF25B95F0, 0x85C2760 }, + { 0xF0C878E0, 0x4F1BB98 }, + { 0xF00CA060, 0x1415E44 }, + { 0xF0326DC0, 0xFD7F3E6C }, + { 0xF137CA20, 0xF9E08758 }, + { 0xF30E4440, 0xF6986E60 }, + { 0xF59BDC80, 0xF3D56070 }, + { 0xF8BC74C0, 0xF1BE6FD0 }, + { 0xFC43CEB4, 0xF0712C40 }, + { 0x10000000, 0x0 }, + { 0xF378710, 0x4F1BBD0 }, + { 0xCF1BBD0, 0x9679180 }, + { 0x9679180, 0xCF1BBD0 }, + { 0x4F1BBC8, 0xF378710 }, + { 0x10000000, 0x0 }, + { 0xCF1BBD0, 0x9679180 }, + { 0x4F1BBC8, 0xF378710 }, + { 0xFB0E4428, 0xF378700 }, + { 0xF30E4420, 0x9679170 }, + { 0x10000000, 0x0 }, + { 0x9679180, 0xCF1BBD0 }, + { 0xFB0E4428, 0xF378700 }, + { 0xF0C878E0, 0x4F1BB98 }, + { 0xF30E4440, 0xF6986E60 }, + { 0x10000000, 0x0 }, + { 0x10000000, 0x0 }, + { 0x10000000, 0x0 }, + { 0x10000000, 0x0 }, + { 0x4F1BBF0, 0xF0C87900 } +}; + +complex_t cfft_tab_64[] = +{ + { 0x10000000, 0x0 }, + { 0xFEC46D0, 0x1917A6C }, + { 0xFB14BE0, 0x31F1708 }, + { 0xF4FA0B0, 0x4A50188 }, + { 0xEC835E0, 0x61F78B0 }, + { 0xE1C5970, 0x78AD750 }, + { 0xD4DB310, 0x8E39DA0 }, + { 0xC5E4030, 0xA2679A0 }, + { 0xB504F30, 0xB504F30 }, + { 0xA267990, 0xC5E4030 }, + { 0x8E39D90, 0xD4DB320 }, + { 0x78AD738, 0xE1C5980 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x4A50180, 0xF4FA0B0 }, + { 0x31F16F0, 0xFB14BF0 }, + { 0x1917A6A, 0xFEC46D0 }, + { 0x10000000, 0x0 }, + { 0xFB14BE0, 0x31F1708 }, + { 0xEC835E0, 0x61F78B0 }, + { 0xD4DB310, 0x8E39DA0 }, + { 0xB504F30, 0xB504F30 }, + { 0x8E39D90, 0xD4DB320 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x31F16F0, 0xFB14BF0 }, + { 0xFFFFFFF5, 0x10000000 }, + { 0xFCE0E8F8, 0xFB14BE0 }, + { 0xF9E08740, 0xEC835E0 }, + { 0xF71C6240, 0xD4DB300 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0xF2B24CE0, 0x8E39D90 }, + { 0xF137CA00, 0x61F7880 }, + { 0xF04EB410, 0x31F1704 }, + { 0x10000000, 0x0 }, + { 0xF4FA0B0, 0x4A50188 }, + { 0xD4DB310, 0x8E39DA0 }, + { 0xA267990, 0xC5E4030 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x1917A6A, 0xFEC46D0 }, + { 0xFCE0E8F8, 0xFB14BE0 }, + { 0xF8752898, 0xE1C5970 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0xF1E3A690, 0x78AD768 }, + { 0xF04EB410, 0x31F1704 }, + { 0xF013B930, 0xFE6E8572 }, + { 0xF137CA20, 0xF9E08758 }, + { 0xF3A1BFB0, 0xF5D98680 }, + { 0xF71C62A0, 0xF2B24CC0 }, + { 0xFB5AFE98, 0xF0B05F50 }, + { 0x10000000, 0x0 }, + { 0xEC835E0, 0x61F78B0 }, + { 0xB504F30, 0xB504F30 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x10000000, 0x0 }, + { 0xB504F30, 0xB504F30 }, + { 0xFFFFFFF5, 0x10000000 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0x10000000, 0x0 }, + { 0x61F78A8, 0xEC835E0 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0xF137CA20, 0xF9E08758 }, + { 0x10000000, 0x0 }, + { 0x10000000, 0x0 }, + { 0x10000000, 0x0 }, + { 0x3, 0xF0000000 } +}; + +complex_t cfft_tab_60[] = +{ + { 0x10000000, 0x0 }, + { 0xFE98FD0, 0x1AC260A }, + { 0xFA67E20, 0x3539B38 }, + { 0xF378710, 0x4F1BBD0 }, + { 0xE9DE1D0, 0x681FE48 }, + { 0xDDB3D70, 0x8000000 }, + { 0xCF1BBD0, 0x9679180 }, + { 0xBE3EBD0, 0xAB4C250 }, + { 0xAB4C240, 0xBE3EBE0 }, + { 0x9679180, 0xCF1BBD0 }, + { 0x7FFFFF8, 0xDDB3D80 }, + { 0x681FE40, 0xE9DE1E0 }, + { 0x4F1BBC8, 0xF378710 }, + { 0x3539B2C, 0xFA67E20 }, + { 0x1AC25FE, 0xFE98FD0 }, + { 0xFFFFFFF5, 0x10000000 }, + { 0xFE53D9EA, 0xFE98FD0 }, + { 0xFCAC64BC, 0xFA67E10 }, + { 0xFB0E4428, 0xF378700 }, + { 0xF97E01A8, 0xE9DE1D0 }, + { 0x10000000, 0x0 }, + { 0xFA67E20, 0x3539B38 }, + { 0xE9DE1D0, 0x681FE48 }, + { 0xCF1BBD0, 0x9679180 }, + { 0xAB4C240, 0xBE3EBE0 }, + { 0x7FFFFF8, 0xDDB3D80 }, + { 0x4F1BBC8, 0xF378710 }, + { 0x1AC25FE, 0xFE98FD0 }, + { 0xFE53D9EA, 0xFE98FD0 }, + { 0xFB0E4428, 0xF378700 }, + { 0xF7FFFFF0, 0xDDB3D70 }, + { 0xF54B3DA0, 0xBE3EBD0 }, + { 0xF30E4420, 0x9679170 }, + { 0xF1621E20, 0x681FE38 }, + { 0xF05981E0, 0x3539B20 }, + { 0xF0000000, 0xFFFFFFE9 }, + { 0xF05981F0, 0xFCAC64B0 }, + { 0xF1621E30, 0xF97E01A0 }, + { 0xF30E4440, 0xF6986E60 }, + { 0xF54B3DD0, 0xF41C1420 }, + { 0x10000000, 0x0 }, + { 0xF378710, 0x4F1BBD0 }, + { 0xCF1BBD0, 0x9679180 }, + { 0x9679180, 0xCF1BBD0 }, + { 0x4F1BBC8, 0xF378710 }, + { 0x10000000, 0x0 }, + { 0xCF1BBD0, 0x9679180 }, + { 0x4F1BBC8, 0xF378710 }, + { 0xFB0E4428, 0xF378700 }, + { 0xF30E4420, 0x9679170 }, + { 0x10000000, 0x0 }, + { 0x9679180, 0xCF1BBD0 }, + { 0xFB0E4428, 0xF378700 }, + { 0xF0C878E0, 0x4F1BB98 }, + { 0xF30E4440, 0xF6986E60 }, + { 0x10000000, 0x0 }, + { 0x10000000, 0x0 }, + { 0x10000000, 0x0 }, + { 0x10000000, 0x0 }, + { 0x4F1BBF0, 0xF0C87900 } +}; + +#ifdef LD_DEC + +complex_t cfft_tab_256[] = +{ + { 0x10000000, 0x0 }, + { 0xFFEC430, 0x648558 }, + { 0xFFB10F0, 0xC8FB30 }, + { 0xFF4E6D0, 0x12D520A }, + { 0xFEC46D0, 0x1917A6C }, + { 0xFE13240, 0x1F564E6 }, + { 0xFD3AAC0, 0x259020C }, + { 0xFC3B280, 0x2BC428C }, + { 0xFB14BE0, 0x31F1708 }, + { 0xF9C79D0, 0x381704C }, + { 0xF853F80, 0x3E33F34 }, + { 0xF6BA070, 0x44474A0 }, + { 0xF4FA0B0, 0x4A50188 }, + { 0xF314470, 0x504D728 }, + { 0xF109080, 0x563E6A0 }, + { 0xEED89E0, 0x5C22150 }, + { 0xEC835E0, 0x61F78B0 }, + { 0xEA09A60, 0x67BDE58 }, + { 0xE76BD80, 0x6D74400 }, + { 0xE4AA590, 0x7319BA8 }, + { 0xE1C5970, 0x78AD750 }, + { 0xDEBE050, 0x7E2E940 }, + { 0xDB941A0, 0x839C3D0 }, + { 0xD848530, 0x88F59B0 }, + { 0xD4DB310, 0x8E39DA0 }, + { 0xD14D3D0, 0x93682B0 }, + { 0xCD9F020, 0x987FC00 }, + { 0xC9D1120, 0x9D7FD20 }, + { 0xC5E4030, 0xA2679A0 }, + { 0xC1D8700, 0xA736560 }, + { 0xBDAEF90, 0xABEB4A0 }, + { 0xB968420, 0xB085BB0 }, + { 0xB504F30, 0xB504F30 }, + { 0xB085BA0, 0xB968420 }, + { 0xABEB490, 0xBDAEFA0 }, + { 0xA736550, 0xC1D8710 }, + { 0xA267990, 0xC5E4030 }, + { 0x9D7FD10, 0xC9D1120 }, + { 0x987FC00, 0xCD9F020 }, + { 0x93682A0, 0xD14D3D0 }, + { 0x8E39D90, 0xD4DB320 }, + { 0x88F59B0, 0xD848530 }, + { 0x839C3C0, 0xDB941B0 }, + { 0x7E2E938, 0xDEBE050 }, + { 0x78AD738, 0xE1C5980 }, + { 0x7319BA0, 0xE4AA590 }, + { 0x6D74408, 0xE76BD80 }, + { 0x67BDE48, 0xEA09A70 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x5C22138, 0xEED89E0 }, + { 0x563E698, 0xF109080 }, + { 0x504D710, 0xF314480 }, + { 0x4A50180, 0xF4FA0B0 }, + { 0x4447498, 0xF6BA070 }, + { 0x3E33F20, 0xF853F80 }, + { 0x3817048, 0xF9C79D0 }, + { 0x31F16F0, 0xFB14BF0 }, + { 0x2BC4280, 0xFC3B280 }, + { 0x2590214, 0xFD3AAC0 }, + { 0x1F564D8, 0xFE13240 }, + { 0x1917A6A, 0xFEC46D0 }, + { 0x12D51F6, 0xFF4E6D0 }, + { 0xC8FB29, 0xFFB10F0 }, + { 0x64853F, 0xFFEC430 }, + { 0x10000000, 0x0 }, + { 0xFFB10F0, 0xC8FB30 }, + { 0xFEC46D0, 0x1917A6C }, + { 0xFD3AAC0, 0x259020C }, + { 0xFB14BE0, 0x31F1708 }, + { 0xF853F80, 0x3E33F34 }, + { 0xF4FA0B0, 0x4A50188 }, + { 0xF109080, 0x563E6A0 }, + { 0xEC835E0, 0x61F78B0 }, + { 0xE76BD80, 0x6D74400 }, + { 0xE1C5970, 0x78AD750 }, + { 0xDB941A0, 0x839C3D0 }, + { 0xD4DB310, 0x8E39DA0 }, + { 0xCD9F020, 0x987FC00 }, + { 0xC5E4030, 0xA2679A0 }, + { 0xBDAEF90, 0xABEB4A0 }, + { 0xB504F30, 0xB504F30 }, + { 0xABEB490, 0xBDAEFA0 }, + { 0xA267990, 0xC5E4030 }, + { 0x987FC00, 0xCD9F020 }, + { 0x8E39D90, 0xD4DB320 }, + { 0x839C3C0, 0xDB941B0 }, + { 0x78AD738, 0xE1C5980 }, + { 0x6D74408, 0xE76BD80 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x563E698, 0xF109080 }, + { 0x4A50180, 0xF4FA0B0 }, + { 0x3E33F20, 0xF853F80 }, + { 0x31F16F0, 0xFB14BF0 }, + { 0x2590214, 0xFD3AAC0 }, + { 0x1917A6A, 0xFEC46D0 }, + { 0xC8FB29, 0xFFB10F0 }, + { 0xFFFFFFF5, 0x10000000 }, + { 0xFF3704BF, 0xFFB10F0 }, + { 0xFE6E857E, 0xFEC46D0 }, + { 0xFDA6FDD8, 0xFD3AAC0 }, + { 0xFCE0E8F8, 0xFB14BE0 }, + { 0xFC1CC0CC, 0xF853F80 }, + { 0xFB5AFE68, 0xF4FA0A0 }, + { 0xFA9C1950, 0xF109080 }, + { 0xF9E08740, 0xEC835E0 }, + { 0xF928BC00, 0xE76BD80 }, + { 0xF8752898, 0xE1C5970 }, + { 0xF7C63C30, 0xDB941A0 }, + { 0xF71C6240, 0xD4DB300 }, + { 0xF67803F0, 0xCD9F020 }, + { 0xF5D98670, 0xC5E4040 }, + { 0xF5414B50, 0xBDAEF80 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0xF4251050, 0xABEB480 }, + { 0xF3A1BFC0, 0xA267990 }, + { 0xF3260FC0, 0x987FBD0 }, + { 0xF2B24CE0, 0x8E39D90 }, + { 0xF246BE60, 0x839C3D0 }, + { 0xF1E3A670, 0x78AD730 }, + { 0xF1894280, 0x6D743F8 }, + { 0xF137CA00, 0x61F7880 }, + { 0xF0EF6F70, 0x563E690 }, + { 0xF0B05F50, 0x4A50198 }, + { 0xF07AC080, 0x3E33F14 }, + { 0xF04EB410, 0x31F1704 }, + { 0xF02C5540, 0x25901E8 }, + { 0xF013B930, 0x1917A60 }, + { 0xF004EF10, 0xC8FAFD }, + { 0x10000000, 0x0 }, + { 0xFF4E6D0, 0x12D520A }, + { 0xFD3AAC0, 0x259020C }, + { 0xF9C79D0, 0x381704C }, + { 0xF4FA0B0, 0x4A50188 }, + { 0xEED89E0, 0x5C22150 }, + { 0xE76BD80, 0x6D74400 }, + { 0xDEBE050, 0x7E2E940 }, + { 0xD4DB310, 0x8E39DA0 }, + { 0xC9D1130, 0x9D7FD10 }, + { 0xBDAEF90, 0xABEB4A0 }, + { 0xB085BA0, 0xB968420 }, + { 0xA267990, 0xC5E4030 }, + { 0x93682B0, 0xD14D3D0 }, + { 0x839C3C0, 0xDB941B0 }, + { 0x7319BA0, 0xE4AA590 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x504D728, 0xF314470 }, + { 0x3E33F40, 0xF853F80 }, + { 0x2BC4280, 0xFC3B280 }, + { 0x1917A6A, 0xFEC46D0 }, + { 0x64855F, 0xFFEC430 }, + { 0xFF3704BF, 0xFFB10F0 }, + { 0xFE0A9B12, 0xFE13230 }, + { 0xFCE0E8F8, 0xFB14BE0 }, + { 0xFBBB8B70, 0xF6BA070 }, + { 0xFA9C1970, 0xF109080 }, + { 0xF98421A8, 0xEA09A60 }, + { 0xF8752898, 0xE1C5970 }, + { 0xF770A640, 0xD848520 }, + { 0xF67803F0, 0xCD9F020 }, + { 0xF58C9AA0, 0xC1D8700 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0xF3E27900, 0xA736560 }, + { 0xF3260FE0, 0x987FC10 }, + { 0xF27B7AE0, 0x88F59C0 }, + { 0xF1E3A690, 0x78AD768 }, + { 0xF15F6590, 0x67BDE38 }, + { 0xF0EF6F70, 0x563E690 }, + { 0xF0945F90, 0x4447490 }, + { 0xF04EB410, 0x31F1704 }, + { 0xF01ECDD0, 0x1F564EC }, + { 0xF004EF10, 0xC8FB3D }, + { 0xF0013BD0, 0xFF9B7ABE }, + { 0xF013B930, 0xFE6E8572 }, + { 0xF03C4D80, 0xFD43BD5C }, + { 0xF07AC080, 0xFC1CC0C0 }, + { 0xF0CEBB90, 0xFAFB28D0 }, + { 0xF137CA20, 0xF9E08758 }, + { 0xF1B55A70, 0xF8CE6460 }, + { 0xF246BE50, 0xF7C63C40 }, + { 0xF2EB2C20, 0xF6C97D70 }, + { 0xF3A1BFB0, 0xF5D98680 }, + { 0xF4697BF0, 0xF4F7A440 }, + { 0xF5414B70, 0xF4251060 }, + { 0xF62802F0, 0xF362EED0 }, + { 0xF71C62A0, 0xF2B24CC0 }, + { 0xF81D16C8, 0xF2141FB0 }, + { 0xF928BC28, 0xF1894270 }, + { 0xFA3DDEA0, 0xF1127630 }, + { 0xFB5AFE98, 0xF0B05F50 }, + { 0xFC7E8F90, 0xF0638630 }, + { 0xFDA6FE04, 0xF02C5540 }, + { 0xFED2ADC2, 0xF00B1930 }, + { 0x10000000, 0x0 }, + { 0xFEC46D0, 0x1917A6C }, + { 0xFB14BE0, 0x31F1708 }, + { 0xF4FA0B0, 0x4A50188 }, + { 0xEC835E0, 0x61F78B0 }, + { 0xE1C5970, 0x78AD750 }, + { 0xD4DB310, 0x8E39DA0 }, + { 0xC5E4030, 0xA2679A0 }, + { 0xB504F30, 0xB504F30 }, + { 0xA267990, 0xC5E4030 }, + { 0x8E39D90, 0xD4DB320 }, + { 0x78AD738, 0xE1C5980 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x4A50180, 0xF4FA0B0 }, + { 0x31F16F0, 0xFB14BF0 }, + { 0x1917A6A, 0xFEC46D0 }, + { 0x10000000, 0x0 }, + { 0xFB14BE0, 0x31F1708 }, + { 0xEC835E0, 0x61F78B0 }, + { 0xD4DB310, 0x8E39DA0 }, + { 0xB504F30, 0xB504F30 }, + { 0x8E39D90, 0xD4DB320 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x31F16F0, 0xFB14BF0 }, + { 0xFFFFFFF5, 0x10000000 }, + { 0xFCE0E8F8, 0xFB14BE0 }, + { 0xF9E08740, 0xEC835E0 }, + { 0xF71C6240, 0xD4DB300 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0xF2B24CE0, 0x8E39D90 }, + { 0xF137CA00, 0x61F7880 }, + { 0xF04EB410, 0x31F1704 }, + { 0x10000000, 0x0 }, + { 0xF4FA0B0, 0x4A50188 }, + { 0xD4DB310, 0x8E39DA0 }, + { 0xA267990, 0xC5E4030 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x1917A6A, 0xFEC46D0 }, + { 0xFCE0E8F8, 0xFB14BE0 }, + { 0xF8752898, 0xE1C5970 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0xF1E3A690, 0x78AD768 }, + { 0xF04EB410, 0x31F1704 }, + { 0xF013B930, 0xFE6E8572 }, + { 0xF137CA20, 0xF9E08758 }, + { 0xF3A1BFB0, 0xF5D98680 }, + { 0xF71C62A0, 0xF2B24CC0 }, + { 0xFB5AFE98, 0xF0B05F50 }, + { 0x10000000, 0x0 }, + { 0xEC835E0, 0x61F78B0 }, + { 0xB504F30, 0xB504F30 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x10000000, 0x0 }, + { 0xB504F30, 0xB504F30 }, + { 0xFFFFFFF5, 0x10000000 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0x10000000, 0x0 }, + { 0x61F78A8, 0xEC835E0 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0xF137CA20, 0xF9E08758 }, + { 0x10000000, 0x0 }, + { 0x10000000, 0x0 }, + { 0x10000000, 0x0 }, + { 0x3, 0xF0000000 } +}; + +complex_t cfft_tab_240[] = +{ + { 0x10000000, 0x0 }, + { 0xFFE98B0, 0x6B3885 }, + { 0xFFA62F0, 0xD65E3B }, + { 0xFF35F90, 0x1415E54 }, + { 0xFE98FD0, 0x1AC260A }, + { 0xFDCF550, 0x216A2A4 }, + { 0xFCD9250, 0x280C170 }, + { 0xFBB6980, 0x2EA6FCC }, + { 0xFA67E20, 0x3539B38 }, + { 0xF8ED3C0, 0x3BC3138 }, + { 0xF746EA0, 0x4241F70 }, + { 0xF575360, 0x48B53B0 }, + { 0xF378710, 0x4F1BBD0 }, + { 0xF150F40, 0x55745E0 }, + { 0xEEFF200, 0x5BBE008 }, + { 0xEC835E0, 0x61F78B0 }, + { 0xE9DE1D0, 0x681FE48 }, + { 0xE70FD40, 0x6E35FA0 }, + { 0xE419010, 0x7438B90 }, + { 0xE0FA280, 0x7A27140 }, + { 0xDDB3D70, 0x8000000 }, + { 0xDA46A00, 0x85C2770 }, + { 0xD6B31D0, 0x8B6D770 }, + { 0xD2F9EF0, 0x9100000 }, + { 0xCF1BBD0, 0x9679180 }, + { 0xCB19340, 0x9BD7CA0 }, + { 0xC6F3090, 0xA11B240 }, + { 0xC2A9F70, 0xA6423B0 }, + { 0xBE3EBD0, 0xAB4C250 }, + { 0xB9B2230, 0xB038010 }, + { 0xB504F30, 0xB504F30 }, + { 0xB038010, 0xB9B2230 }, + { 0xAB4C240, 0xBE3EBE0 }, + { 0xA6423A0, 0xC2A9F70 }, + { 0xA11B240, 0xC6F30A0 }, + { 0x9BD7C90, 0xCB19350 }, + { 0x9679180, 0xCF1BBD0 }, + { 0x9100000, 0xD2F9EF0 }, + { 0x8B6D760, 0xD6B31E0 }, + { 0x85C2760, 0xDA46A10 }, + { 0x7FFFFF8, 0xDDB3D80 }, + { 0x7A27138, 0xE0FA290 }, + { 0x7438B90, 0xE419010 }, + { 0x6E35F88, 0xE70FD50 }, + { 0x681FE40, 0xE9DE1E0 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x5BBDFF0, 0xEEFF210 }, + { 0x55745D0, 0xF150F40 }, + { 0x4F1BBC8, 0xF378710 }, + { 0x48B53A8, 0xF575360 }, + { 0x4241F78, 0xF746EA0 }, + { 0x3BC3124, 0xF8ED3C0 }, + { 0x3539B2C, 0xFA67E20 }, + { 0x2EA6FCC, 0xFBB6980 }, + { 0x280C154, 0xFCD9250 }, + { 0x216A290, 0xFDCF550 }, + { 0x1AC25FE, 0xFE98FD0 }, + { 0x1415E50, 0xFF35F90 }, + { 0xD65E3F, 0xFFA62F0 }, + { 0x6B3871, 0xFFE98B0 }, + { 0xFFFFFFF5, 0x10000000 }, + { 0xFF94C777, 0xFFE98B0 }, + { 0xFF29A1AA, 0xFFA62F0 }, + { 0xFEBEA198, 0xFF35F90 }, + { 0xFE53D9EA, 0xFE98FD0 }, + { 0xFDE95D58, 0xFDCF550 }, + { 0xFD7F3E98, 0xFCD9250 }, + { 0xFD159020, 0xFBB6980 }, + { 0xFCAC64BC, 0xFA67E10 }, + { 0xFC43CEC4, 0xF8ED3C0 }, + { 0xFBDBE070, 0xF746EA0 }, + { 0xFB74AC40, 0xF575350 }, + { 0xFB0E4428, 0xF378700 }, + { 0xFAA8BA20, 0xF150F40 }, + { 0xFA441FF8, 0xEEFF210 }, + { 0xF9E08740, 0xEC835E0 }, + { 0xF97E01A8, 0xE9DE1D0 }, + { 0xF91CA060, 0xE70FD40 }, + { 0xF8BC7458, 0xE419000 }, + { 0xF85D8ED0, 0xE0FA290 }, + { 0x10000000, 0x0 }, + { 0xFFA62F0, 0xD65E3B }, + { 0xFE98FD0, 0x1AC260A }, + { 0xFCD9250, 0x280C170 }, + { 0xFA67E20, 0x3539B38 }, + { 0xF746EA0, 0x4241F70 }, + { 0xF378710, 0x4F1BBD0 }, + { 0xEEFF200, 0x5BBE008 }, + { 0xE9DE1D0, 0x681FE48 }, + { 0xE419010, 0x7438B90 }, + { 0xDDB3D70, 0x8000000 }, + { 0xD6B31D0, 0x8B6D770 }, + { 0xCF1BBD0, 0x9679180 }, + { 0xC6F3090, 0xA11B240 }, + { 0xBE3EBD0, 0xAB4C250 }, + { 0xB504F30, 0xB504F30 }, + { 0xAB4C240, 0xBE3EBE0 }, + { 0xA11B240, 0xC6F30A0 }, + { 0x9679180, 0xCF1BBD0 }, + { 0x8B6D760, 0xD6B31E0 }, + { 0x7FFFFF8, 0xDDB3D80 }, + { 0x7438B90, 0xE419010 }, + { 0x681FE40, 0xE9DE1E0 }, + { 0x5BBDFF0, 0xEEFF210 }, + { 0x4F1BBC8, 0xF378710 }, + { 0x4241F78, 0xF746EA0 }, + { 0x3539B2C, 0xFA67E20 }, + { 0x280C154, 0xFCD9250 }, + { 0x1AC25FE, 0xFE98FD0 }, + { 0xD65E3F, 0xFFA62F0 }, + { 0xFFFFFFF5, 0x10000000 }, + { 0xFF29A1AA, 0xFFA62F0 }, + { 0xFE53D9EA, 0xFE98FD0 }, + { 0xFD7F3E98, 0xFCD9250 }, + { 0xFCAC64BC, 0xFA67E10 }, + { 0xFBDBE070, 0xF746EA0 }, + { 0xFB0E4428, 0xF378700 }, + { 0xFA441FF8, 0xEEFF210 }, + { 0xF97E01A8, 0xE9DE1D0 }, + { 0xF8BC7458, 0xE419000 }, + { 0xF7FFFFF0, 0xDDB3D70 }, + { 0xF7492890, 0xD6B31D0 }, + { 0xF6986E90, 0xCF1BBD0 }, + { 0xF5EE4DA0, 0xC6F3080 }, + { 0xF54B3DA0, 0xBE3EBD0 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0xF41C1410, 0xAB4C220 }, + { 0xF390CF50, 0xA11B220 }, + { 0xF30E4420, 0x9679170 }, + { 0xF294CE30, 0x8B6D770 }, + { 0xF224C290, 0x8000010 }, + { 0xF1BE6FE0, 0x7438B68 }, + { 0xF1621E20, 0x681FE38 }, + { 0xF1100DF0, 0x5BBE000 }, + { 0xF0C878E0, 0x4F1BB98 }, + { 0xF08B9150, 0x4241F50 }, + { 0xF05981E0, 0x3539B20 }, + { 0xF0326DB0, 0x280C168 }, + { 0xF0167030, 0x1AC2612 }, + { 0xF0059D00, 0xD65E13 }, + { 0xF0000000, 0xFFFFFFE9 }, + { 0xF0059D10, 0xFF29A1BE }, + { 0xF0167040, 0xFE53D9BE }, + { 0xF0326DC0, 0xFD7F3E6C }, + { 0xF05981F0, 0xFCAC64B0 }, + { 0xF08B9160, 0xFBDBE088 }, + { 0xF0C878F0, 0xFB0E4438 }, + { 0xF1100E00, 0xFA441FD0 }, + { 0xF1621E30, 0xF97E01A0 }, + { 0xF1BE6FF0, 0xF8BC7468 }, + { 0xF224C2B0, 0xF7FFFFD0 }, + { 0xF294CE40, 0xF7492870 }, + { 0xF30E4440, 0xF6986E60 }, + { 0xF390CF70, 0xF5EE4DB0 }, + { 0xF41C1430, 0xF54B3DB0 }, + { 0xF4AFB0F0, 0xF4AFB0B0 }, + { 0xF54B3DD0, 0xF41C1420 }, + { 0xF5EE4DD0, 0xF390CF60 }, + { 0xF6986EB0, 0xF30E4410 }, + { 0xF7492880, 0xF294CE30 }, + { 0x10000000, 0x0 }, + { 0xFF35F90, 0x1415E54 }, + { 0xFCD9250, 0x280C170 }, + { 0xF8ED3C0, 0x3BC3138 }, + { 0xF378710, 0x4F1BBD0 }, + { 0xEC835E0, 0x61F78B0 }, + { 0xE419010, 0x7438B90 }, + { 0xDA46A00, 0x85C2770 }, + { 0xCF1BBD0, 0x9679180 }, + { 0xC2A9F70, 0xA6423B0 }, + { 0xB504F30, 0xB504F30 }, + { 0xA6423A0, 0xC2A9F70 }, + { 0x9679180, 0xCF1BBD0 }, + { 0x85C2760, 0xDA46A10 }, + { 0x7438B90, 0xE419010 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x4F1BBC8, 0xF378710 }, + { 0x3BC3124, 0xF8ED3C0 }, + { 0x280C154, 0xFCD9250 }, + { 0x1415E50, 0xFF35F90 }, + { 0x10000000, 0x0 }, + { 0xFCD9250, 0x280C170 }, + { 0xF378710, 0x4F1BBD0 }, + { 0xE419010, 0x7438B90 }, + { 0xCF1BBD0, 0x9679180 }, + { 0xB504F30, 0xB504F30 }, + { 0x9679180, 0xCF1BBD0 }, + { 0x7438B90, 0xE419010 }, + { 0x4F1BBC8, 0xF378710 }, + { 0x280C154, 0xFCD9250 }, + { 0xFFFFFFF5, 0x10000000 }, + { 0xFD7F3E98, 0xFCD9250 }, + { 0xFB0E4428, 0xF378700 }, + { 0xF8BC7458, 0xE419000 }, + { 0xF6986E90, 0xCF1BBD0 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0xF30E4420, 0x9679170 }, + { 0xF1BE6FE0, 0x7438B68 }, + { 0xF0C878E0, 0x4F1BB98 }, + { 0xF0326DB0, 0x280C168 }, + { 0x10000000, 0x0 }, + { 0xF8ED3C0, 0x3BC3138 }, + { 0xE419010, 0x7438B90 }, + { 0xC2A9F70, 0xA6423B0 }, + { 0x9679180, 0xCF1BBD0 }, + { 0x61F78A8, 0xEC835E0 }, + { 0x280C154, 0xFCD9250 }, + { 0xFEBEA198, 0xFF35F90 }, + { 0xFB0E4428, 0xF378700 }, + { 0xF7A3D870, 0xDA469F0 }, + { 0xF4AFB0D0, 0xB504F30 }, + { 0xF25B95F0, 0x85C2760 }, + { 0xF0C878E0, 0x4F1BB98 }, + { 0xF00CA060, 0x1415E44 }, + { 0xF0326DC0, 0xFD7F3E6C }, + { 0xF137CA20, 0xF9E08758 }, + { 0xF30E4440, 0xF6986E60 }, + { 0xF59BDC80, 0xF3D56070 }, + { 0xF8BC74C0, 0xF1BE6FD0 }, + { 0xFC43CEB4, 0xF0712C40 }, + { 0x10000000, 0x0 }, + { 0xF378710, 0x4F1BBD0 }, + { 0xCF1BBD0, 0x9679180 }, + { 0x9679180, 0xCF1BBD0 }, + { 0x4F1BBC8, 0xF378710 }, + { 0x10000000, 0x0 }, + { 0xCF1BBD0, 0x9679180 }, + { 0x4F1BBC8, 0xF378710 }, + { 0xFB0E4428, 0xF378700 }, + { 0xF30E4420, 0x9679170 }, + { 0x10000000, 0x0 }, + { 0x9679180, 0xCF1BBD0 }, + { 0xFB0E4428, 0xF378700 }, + { 0xF0C878E0, 0x4F1BB98 }, + { 0xF30E4440, 0xF6986E60 }, + { 0x10000000, 0x0 }, + { 0x10000000, 0x0 }, + { 0x10000000, 0x0 }, + { 0x10000000, 0x0 }, + { 0x4F1BBF0, 0xF0C87900 } +}; + +#endif + +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/libfaad/common.c b/src/libfaad/common.c index 394366d17..c68f438ff 100644 --- a/src/libfaad/common.c +++ b/src/libfaad/common.c @@ -16,17 +16,145 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: common.c,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: common.c,v 1.2 2002/12/16 18:59:56 miguelfreitas Exp $ **/ /* just some common functions that could be used anywhere */ #include "common.h" +#include "structs.h" -#define LOG2 0.30102999566398 +#include "syntax.h" + +/* Returns the sample rate index based on the samplerate */ +uint8_t get_sr_index(uint32_t samplerate) +{ + if (92017 <= samplerate) return 0; + if (75132 <= samplerate) return 1; + if (55426 <= samplerate) return 2; + if (46009 <= samplerate) return 3; + if (37566 <= samplerate) return 4; + if (27713 <= samplerate) return 5; + if (23004 <= samplerate) return 6; + if (18783 <= samplerate) return 7; + if (13856 <= samplerate) return 8; + if (11502 <= samplerate) return 9; + if (9391 <= samplerate) return 10; + + return 11; +} + +/* Returns 0 if an object type is decodable, otherwise returns -1 */ +int8_t can_decode_ot(uint8_t object_type) +{ + switch (object_type) + { + case LC: + return 0; + case MAIN: +#ifdef MAIN_DEC + return 0; +#else + return -1; +#endif + case SSR: +#ifdef SSR_DEC + return 0; +#else + return -1; +#endif + case LTP: +#ifdef LTP_DEC + return 0; +#else + return -1; +#endif + + /* ER object types */ +#ifdef ERROR_RESILIENCE + case ER_LC: +#ifdef DRM + case DRM_ER_LC: +#endif + return 0; + case ER_LTP: +#ifdef LTP_DEC + return 0; +#else + return -1; +#endif + case LD: +#ifdef LD_DEC + return 0; +#else + return -1; +#endif +#endif + } + + return -1; +} + +static const uint8_t Parity [256] = { // parity + 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, + 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, + 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, + 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, + 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, + 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, + 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, + 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0 +}; +static uint32_t __r1 = 1; +static uint32_t __r2 = 1; + + +/* + * This is a simple random number generator with good quality for audio purposes. + * It consists of two polycounters with opposite rotation direction and different + * periods. The periods are coprime, so the total period is the product of both. + * + * ------------------------------------------------------------------------------------------------- + * +-> |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0| + * | ------------------------------------------------------------------------------------------------- + * | | | | | | | + * | +--+--+--+-XOR-+--------+ + * | | + * +--------------------------------------------------------------------------------------+ + * + * ------------------------------------------------------------------------------------------------- + * |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0| <-+ + * ------------------------------------------------------------------------------------------------- | + * | | | | | + * +--+----XOR----+--+ | + * | | + * +----------------------------------------------------------------------------------------+ + * + * + * The first has an period of 3*5*17*257*65537, the second of 7*47*73*178481, + * which gives a period of 18.410.713.077.675.721.215. The result is the + * XORed values of both generators. + */ +uint32_t random_int(void) +{ + uint32_t t1, t2, t3, t4; + + t3 = t1 = __r1; t4 = t2 = __r2; // Parity calculation is done via table lookup, this is also available + t1 &= 0xF5; t2 >>= 25; // on CPUs without parity, can be implemented in C and avoid unpredictable + t1 = Parity [t1]; t2 &= 0x63; // jumps and slow rotate through the carry flag operations. + t1 <<= 31; t2 = Parity [t2]; + + return (__r1 = (t3 >> 1) | t1 ) ^ (__r2 = (t4 + t4) | t2 ); +} + +#if 0 + +#define LOG2 0.30102999566398 uint32_t int_log2(uint32_t val) { return (uint32_t)(log((real_t)val)/LOG2 + 0.5); } +#endif + diff --git a/src/libfaad/common.h b/src/libfaad/common.h index 2af093adb..9a220ed27 100644 --- a/src/libfaad/common.h +++ b/src/libfaad/common.h @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: common.h,v 1.3 2002/10/22 04:46:22 storri Exp $ +** $Id: common.h,v 1.4 2002/12/16 18:59:56 miguelfreitas Exp $ **/ #ifndef __COMMON_H__ @@ -26,16 +26,7 @@ extern "C" { #endif - -#ifdef LINUX -#define INLINE inline -#else -#ifdef _WIN32 #define INLINE __inline -#else -#define INLINE -#endif -#endif #ifndef max #define max(a, b) (((a) > (b)) ? (a) : (b)) @@ -44,28 +35,21 @@ extern "C" { #define min(a, b) (((a) < (b)) ? (a) : (b)) #endif -#ifndef LN2 -#define LN2 0.6931471805599453 -#endif - -#ifndef LN05 -#define LN05 -LN2 -#endif /* COMPILE TIME DEFINITIONS */ -/* use the somewhat faster, but a lot larger FFTW library */ -/* #define USE_FFTW */ - /* use double precision */ /* #define USE_DOUBLE_PRECISION */ +/* use fixed point reals */ +//#define FIXED_POINT -/* #define SBR */ #define ERROR_RESILIENCE /* Allow decoding of MAIN profile AAC */ #define MAIN_DEC +/* Allow decoding of SSR profile AAC */ +#define SSR_DEC /* Allow decoding of LTP profile AAC */ #define LTP_DEC /* Allow decoding of LD profile AAC */ @@ -84,48 +68,140 @@ extern "C" { /* END COMPILE TIME DEFINITIONS */ +#ifndef FIXED_POINT +#define POW_TABLE_SIZE 200 +#endif + #if defined(_WIN32) +typedef unsigned __int64 uint64_t; typedef unsigned __int32 uint32_t; typedef unsigned __int16 uint16_t; typedef unsigned __int8 uint8_t; +typedef __int64 int64_t; typedef __int32 int32_t; typedef __int16 int16_t; typedef __int8 int8_t; typedef float float32_t; -#elif defined(LINUX) || defined(DJGPP) +#else +#ifdef HAVE_CONFIG_H +# include "../config.h" +#endif -#if defined(LINUX) -#include <stdint.h> +#include <stdio.h> +#if HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#if HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> #else +# if HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#if HAVE_STRINGS_H +# include <strings.h> +#endif +#if HAVE_INTTYPES_H +# include <inttypes.h> +#else +# if HAVE_STDINT_H +# include <stdint.h> +# else +/* we need these... */ +typedef unsigned long long uint64_t; typedef unsigned long uint32_t; typedef unsigned short uint16_t; typedef unsigned char uint8_t; +typedef long long int64_t; typedef long int32_t; typedef short int16_t; typedef char int8_t; -typedef float float32_t; +# endif +#endif +#if HAVE_UNISTD_H +# include <unistd.h> #endif +#ifndef HAVE_FLOAT32_T +typedef float float32_t; +#endif -#else /* Some other OS */ +#if STDC_HEADERS +# include <string.h> +#else +# if !HAVE_STRCHR +# define strchr index +# define strrchr rindex +# endif +char *strchr(), *strrchr(); +# if !HAVE_MEMCPY +# define memcpy(d, s, n) bcopy((s), (d), (n)) +# define memmove(d, s, n) bcopy((s), (d), (n)) +# endif +#endif +#endif -#include <inttypes.h> +#ifdef WORDS_BIGENDIAN +#define ARCH_IS_BIG_ENDIAN +#endif +/* FIXED_POINT doesn't work with MAIN and SSR yet */ +#ifdef FIXED_POINT + #undef MAIN_DEC + #undef SSR_DEC #endif -#ifndef USE_DOUBLE_PRECISION +#if defined(FIXED_POINT) + + #ifdef HAS_MATHF_H + #include <mathf.h> + #else + #include <math.h> + #endif + + #include "fixed.h" + +#elif defined(USE_DOUBLE_PRECISION) + + typedef double real_t; + + #include <math.h> + + #define MUL(A,B) ((A)*(B)) + #define MUL_C_C(A,B) ((A)*(B)) + #define MUL_R_C(A,B) ((A)*(B)) + + #define REAL_CONST(A) ((real_t)A) + #define COEF_CONST(A) ((real_t)A) + +#else /* Normal floating point operation */ typedef float real_t; #define MUL(A,B) ((A)*(B)) + #define MUL_C_C(A,B) ((A)*(B)) + #define MUL_R_C(A,B) ((A)*(B)) + + #define REAL_CONST(A) ((real_t)A) + #define COEF_CONST(A) ((real_t)A) #ifdef __ICL /* only Intel C compiler has fmath ??? */ @@ -134,7 +210,6 @@ typedef float float32_t; #define sin sinf #define cos cosf #define log logf - #define exp expf #define floor floorf #define ceil ceilf #define sqrt sqrtf @@ -145,6 +220,7 @@ typedef float float32_t; #ifdef HAVE_SINF # define sin sinf +#error #endif #ifdef HAVE_COSF # define cos cosf @@ -158,7 +234,7 @@ typedef float float32_t; #ifdef HAVE_FLOORF # define floor floorf #endif -#ifdef HAVE_FLOORF +#ifdef HAVE_CEILF # define ceil ceilf #endif #ifdef HAVE_SQRTF @@ -167,19 +243,11 @@ typedef float float32_t; #endif -#else - - typedef double real_t; - #include <math.h> - - #define MUL(A,B) ((A)*(B)) - #endif -typedef struct { - real_t re; - real_t im; -} complex_t; +typedef real_t complex_t[2]; +#define RE(A) A[0] +#define IM(A) A[1] /* common functions */ @@ -192,6 +260,7 @@ uint32_t int_log2(uint32_t val); #define M_PI_2 1.57079632679489661923 #endif + #ifdef __cplusplus } #endif diff --git a/src/libfaad/data.c b/src/libfaad/data.c index 294f4e487..cac03544b 100644 --- a/src/libfaad/data.c +++ b/src/libfaad/data.c @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: data.c,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: data.c,v 1.2 2002/12/16 18:59:57 miguelfreitas Exp $ **/ #include "common.h" @@ -25,7 +25,11 @@ #ifdef LD_DEC extern uint8_t num_swb_512_window[] = { - 0, 0, 0, 35, 35, 36, 30, 30, 0, 0, 0, 0 + 0, 0, 0, 36, 36, 37, 31, 31, 0, 0, 0, 0 +}; +extern uint8_t num_swb_480_window[] = +{ + 0, 0, 0, 35, 35, 37, 30, 30, 0, 0, 0, 0 }; #endif @@ -80,6 +84,13 @@ static uint16_t swb_offset_512_48[] = 92, 100, 112, 124, 136, 148, 164, 184, 208, 236, 268, 300, 332, 364, 396, 428, 460, 512 }; + +static 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 static uint16_t swb_offset_128_48[] = @@ -102,6 +113,13 @@ static uint16_t swb_offset_512_32[] = 88, 96, 108, 120, 132, 144, 160, 176, 192, 212, 236, 260, 288, 320, 352, 384, 416, 448, 480, 512 }; + +static 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 static uint16_t swb_offset_1024_24[] = @@ -119,6 +137,12 @@ static uint16_t swb_offset_512_24[] = 80, 92, 104, 120, 140, 164, 192, 224, 256, 288, 320, 352, 384, 416, 448, 480, 512 }; + +static 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 static uint16_t swb_offset_128_24[] = @@ -182,6 +206,22 @@ extern uint16_t *swb_offset_512_window[] = 0, /* 11025 */ 0 /* 8000 */ }; + +extern 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 extern uint16_t *swb_offset_128_window[] = @@ -220,4 +260,4 @@ extern uint32_t sample_rates[] = { 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000 -}; +};
\ No newline at end of file diff --git a/src/libfaad/data.h b/src/libfaad/data.h index f72a9ed9c..6873c1217 100644 --- a/src/libfaad/data.h +++ b/src/libfaad/data.h @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: data.h,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: data.h,v 1.2 2002/12/16 18:59:58 miguelfreitas Exp $ **/ #ifndef __DATA_H__ @@ -29,11 +29,13 @@ extern "C" { extern uint8_t num_swb_1024_window[]; #ifdef LD_DEC extern uint8_t num_swb_512_window[]; +extern uint8_t num_swb_480_window[]; #endif extern uint8_t num_swb_128_window[]; extern uint16_t *swb_offset_1024_window[]; #ifdef LD_DEC extern uint16_t *swb_offset_512_window[]; +extern uint16_t *swb_offset_480_window[]; #endif extern uint16_t *swb_offset_128_window[]; extern uint8_t pred_sfb_max[]; diff --git a/src/libfaad/decoder.c b/src/libfaad/decoder.c index bf1045e59..1d492ef11 100644 --- a/src/libfaad/decoder.c +++ b/src/libfaad/decoder.c @@ -16,12 +16,15 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: decoder.c,v 1.2 2002/08/09 22:36:36 miguelfreitas Exp $ +** $Id: decoder.c,v 1.3 2002/12/16 18:59:59 miguelfreitas Exp $ **/ -#include <stdlib.h> -#include <memory.h> #include "common.h" +#include "structs.h" + +#include <stdlib.h> +#include <string.h> + #include "decoder.h" #include "mp4.h" #include "syntax.h" @@ -36,12 +39,17 @@ #include "drc.h" #include "error.h" #include "output.h" +#include "dither.h" +#ifdef SSR_DEC +#include "ssr.h" +#include "ssr_fb.h" +#endif #ifdef ANALYSIS uint16_t dbg_count; #endif -uint8_t* FAADAPI faacDecGetErrorMessage(uint8_t errcode) +int8_t* FAADAPI faacDecGetErrorMessage(uint8_t errcode) { return err_msg[errcode]; } @@ -55,16 +63,17 @@ faacDecHandle FAADAPI faacDecOpen() return NULL; memset(hDecoder, 0, sizeof(faacDecStruct)); - memset(&hDecoder->fb, 0, sizeof(fb_info)); hDecoder->config.outputFormat = FAAD_FMT_16BIT; hDecoder->config.defObjectType = MAIN; hDecoder->config.defSampleRate = 44100; /* Default: 44.1kHz */ hDecoder->adts_header_present = 0; hDecoder->adif_header_present = 0; +#ifdef ERROR_RESILIENCE hDecoder->aacSectionDataResilienceFlag = 0; hDecoder->aacScalefactorDataResilienceFlag = 0; hDecoder->aacSpectralDataResilienceFlag = 0; +#endif hDecoder->frameLength = 1024; hDecoder->frame = 0; @@ -73,8 +82,11 @@ faacDecHandle FAADAPI faacDecOpen() for (i = 0; i < MAX_CHANNELS; i++) { hDecoder->window_shape_prev[i] = 0; - hDecoder->time_state[i] = NULL; hDecoder->time_out[i] = NULL; +#ifdef SSR_DEC + hDecoder->ssr_overlap[i] = NULL; + hDecoder->prev_fmd[i] = NULL; +#endif #ifdef MAIN_DEC hDecoder->pred_stat[i] = NULL; #endif @@ -84,11 +96,11 @@ faacDecHandle FAADAPI faacDecOpen() #endif } - init_drc(&hDecoder->drc, 1.0f, 1.0f); -#if IQ_TABLE_SIZE && POW_TABLE_SIZE - build_tables(hDecoder->iq_table, hDecoder->pow2_table); -#elif !POW_TABLE_SIZE - build_tables(hDecoder->iq_table, NULL); + hDecoder->drc = drc_init(REAL_CONST(1.0), REAL_CONST(1.0)); + +#if POW_TABLE_SIZE + hDecoder->pow2_table = (real_t*)malloc(POW_TABLE_SIZE*sizeof(real_t)); + build_tables(hDecoder->pow2_table); #endif return hDecoder; @@ -105,15 +117,6 @@ uint8_t FAADAPI faacDecSetConfiguration(faacDecHandle hDecoder, faacDecConfigurationPtr config) { hDecoder->config.defObjectType = config->defObjectType; -#ifdef DRM - if (config->defObjectType == DRM_ER_LC) - { - hDecoder->aacSectionDataResilienceFlag = 1; /* VCB11 */ - hDecoder->aacScalefactorDataResilienceFlag = 0; /* no RVLC */ - hDecoder->aacSpectralDataResilienceFlag = 1; /* HCR */ - hDecoder->frameLength = 960; - } -#endif hDecoder->config.defSampleRate = config->defSampleRate; hDecoder->config.outputFormat = config->outputFormat; @@ -121,73 +124,9 @@ uint8_t FAADAPI faacDecSetConfiguration(faacDecHandle hDecoder, return 1; } -/* Returns the sample rate index */ -static uint8_t get_sr_index(uint32_t samplerate) -{ - if (92017 <= samplerate) return 0; - if (75132 <= samplerate) return 1; - if (55426 <= samplerate) return 2; - if (46009 <= samplerate) return 3; - if (37566 <= samplerate) return 4; - if (27713 <= samplerate) return 5; - if (23004 <= samplerate) return 6; - if (18783 <= samplerate) return 7; - if (13856 <= samplerate) return 8; - if (11502 <= samplerate) return 9; - if (9391 <= samplerate) return 10; - - return 11; -} - -/* Returns 0 if an object type is decodable, otherwise returns -1 */ -static int8_t can_decode_ot(uint8_t object_type) -{ - switch (object_type) - { - case LC: - return 0; - case MAIN: -#ifdef MAIN_DEC - return 0; -#else - return -1; -#endif - case SSR: - return -1; - case LTP: -#ifdef LTP_DEC - return 0; -#else - return -1; -#endif - - /* ER object types */ -#ifdef ERROR_RESILIENCE - case ER_LC: -#ifdef DRM - case DRM_ER_LC: -#endif - return 0; - case ER_LTP: -#ifdef LTP_DEC - return 0; -#else - return -1; -#endif - case LD: -#ifdef LD_DEC - return 0; -#else - return -1; -#endif -#endif - } - - return -1; -} - int32_t FAADAPI faacDecInit(faacDecHandle hDecoder, uint8_t *buffer, - uint32_t *samplerate, uint8_t *channels) + uint32_t buffer_size, + uint32_t *samplerate, uint8_t *channels) { uint32_t bits = 0; bitfile ld; @@ -201,11 +140,8 @@ int32_t FAADAPI faacDecInit(faacDecHandle hDecoder, uint8_t *buffer, if (buffer != NULL) { - faad_initbits(&ld, buffer); + faad_initbits(&ld, buffer, buffer_size); -#ifdef DRM - if (hDecoder->object_type != DRM_ER_LC) -#endif /* Check if an ADIF header is present */ if ((buffer[0] == 'A') && (buffer[1] == 'D') && (buffer[2] == 'I') && (buffer[3] == 'F')) @@ -235,11 +171,18 @@ int32_t FAADAPI faacDecInit(faacDecHandle hDecoder, uint8_t *buffer, *channels = (adts.channel_configuration > 6) ? 2 : adts.channel_configuration; } + + faad_endbits(&ld); } hDecoder->channelConfiguration = *channels; /* must be done before frameLength is divided by 2 for LD */ - filter_bank_init(&hDecoder->fb, hDecoder->frameLength); +#ifdef SSR_DEC + if (hDecoder->object_type == SSR) + hDecoder->fb = ssr_filter_bank_init(hDecoder->frameLength/SSR_BANDS); + else +#endif + hDecoder->fb = filter_bank_init(hDecoder->frameLength); #ifdef LD_DEC if (hDecoder->object_type == LD) @@ -249,6 +192,11 @@ int32_t FAADAPI faacDecInit(faacDecHandle hDecoder, uint8_t *buffer, if (can_decode_ot(hDecoder->object_type) < 0) return -1; +#ifndef FIXED_POINT + if (hDecoder->config.outputFormat >= 5) + Init_Dither(16, hDecoder->config.outputFormat - 5); +#endif + return bits; } @@ -272,13 +220,18 @@ int8_t FAADAPI faacDecInit2(faacDecHandle hDecoder, uint8_t *pBuffer, return -1; } - rc = AudioSpecificConfig(pBuffer, samplerate, channels, + rc = AudioSpecificConfig(pBuffer, SizeOfDecoderSpecificInfo, + samplerate, channels, &hDecoder->sf_index, &hDecoder->object_type, +#ifdef ERROR_RESILIENCE &hDecoder->aacSectionDataResilienceFlag, &hDecoder->aacScalefactorDataResilienceFlag, &hDecoder->aacSpectralDataResilienceFlag, +#else + NULL, NULL, NULL, +#endif &frameLengthFlag); - if (hDecoder->object_type < 4) + if (hDecoder->object_type < 5) hDecoder->object_type--; /* For AAC differs from MPEG-4 */ if (rc != 0) { @@ -289,13 +242,49 @@ int8_t FAADAPI faacDecInit2(faacDecHandle hDecoder, uint8_t *pBuffer, hDecoder->frameLength = 960; /* must be done before frameLength is divided by 2 for LD */ - filter_bank_init(&hDecoder->fb, hDecoder->frameLength); +#ifdef SSR_DEC + if (hDecoder->object_type == SSR) + hDecoder->fb = ssr_filter_bank_init(hDecoder->frameLength/SSR_BANDS); + else +#endif + hDecoder->fb = filter_bank_init(hDecoder->frameLength); #ifdef LD_DEC if (hDecoder->object_type == LD) hDecoder->frameLength >>= 1; #endif +#ifndef FIXED_POINT + if (hDecoder->config.outputFormat >= 5) + Init_Dither(16, hDecoder->config.outputFormat - 5); +#endif + + return 0; +} + +int8_t FAADAPI faacDecInitDRM(faacDecHandle hDecoder, uint32_t samplerate, + uint8_t channels) +{ + /* Special object type defined for DRM */ + hDecoder->config.defObjectType = DRM_ER_LC; + + hDecoder->config.defSampleRate = samplerate; + hDecoder->aacSectionDataResilienceFlag = 1; /* VCB11 */ + hDecoder->aacScalefactorDataResilienceFlag = 0; /* no RVLC */ + hDecoder->aacSpectralDataResilienceFlag = 1; /* HCR */ + hDecoder->frameLength = 960; + hDecoder->sf_index = get_sr_index(hDecoder->config.defSampleRate); + hDecoder->object_type = hDecoder->config.defObjectType; + hDecoder->channelConfiguration = channels; + + /* must be done before frameLength is divided by 2 for LD */ + hDecoder->fb = filter_bank_init(hDecoder->frameLength); + +#ifndef FIXED_POINT + if (hDecoder->config.outputFormat >= 5) + Init_Dither(16, hDecoder->config.outputFormat - 5); +#endif + return 0; } @@ -305,8 +294,11 @@ void FAADAPI faacDecClose(faacDecHandle hDecoder) for (i = 0; i < MAX_CHANNELS; i++) { - if (hDecoder->time_state[i]) free(hDecoder->time_state[i]); if (hDecoder->time_out[i]) free(hDecoder->time_out[i]); +#ifdef SSR_DEC + if (hDecoder->ssr_overlap[i]) free(hDecoder->ssr_overlap[i]); + if (hDecoder->prev_fmd[i]) free(hDecoder->prev_fmd[i]); +#endif #ifdef MAIN_DEC if (hDecoder->pred_stat[i]) free(hDecoder->pred_stat[i]); #endif @@ -315,120 +307,35 @@ void FAADAPI faacDecClose(faacDecHandle hDecoder) #endif } - filter_bank_end(&hDecoder->fb); +#ifdef SSR_DEC + if (hDecoder->object_type == SSR) + ssr_filter_bank_end(hDecoder->fb); + else +#endif + filter_bank_end(hDecoder->fb); + + drc_end(hDecoder->drc); + +#ifndef FIXED_POINT +#if POW_TABLE_SIZE + if (hDecoder->pow2_table) free(hDecoder->pow2_table); +#endif +#endif if (hDecoder->sample_buffer) free(hDecoder->sample_buffer); if (hDecoder) free(hDecoder); } -#ifdef ERROR_RESILIENCE -#define decode_sce_lfe() \ - spec_data[channels] = (int16_t*)malloc(frame_len*sizeof(int16_t)); \ - spec_coef[channels] = (real_t*)malloc(frame_len*sizeof(real_t)); \ - \ - syntax_elements[ch_ele] = (element*)malloc(sizeof(element)); \ - memset(syntax_elements[ch_ele], 0, sizeof(element)); \ - syntax_elements[ch_ele]->ele_id = id_syn_ele; \ - syntax_elements[ch_ele]->channel = channels; \ - syntax_elements[ch_ele]->paired_channel = -1; \ - \ - if ((hInfo->error = single_lfe_channel_element(syntax_elements[ch_ele], \ - ld, spec_data[channels], sf_index, object_type, frame_len, \ - aacSectionDataResilienceFlag, aacScalefactorDataResilienceFlag, \ - aacSpectralDataResilienceFlag)) > 0) \ - { \ - /* to make sure everything gets deallocated */ \ - channels++; ch_ele++; \ - goto error; \ - } \ - \ - channels++; \ - ch_ele++; -#else -#define decode_sce_lfe() \ - spec_data[channels] = (int16_t*)malloc(frame_len*sizeof(int16_t)); \ - spec_coef[channels] = (real_t*)malloc(frame_len*sizeof(real_t)); \ - \ - syntax_elements[ch_ele] = (element*)malloc(sizeof(element)); \ - memset(syntax_elements[ch_ele], 0, sizeof(element)); \ - syntax_elements[ch_ele]->ele_id = id_syn_ele; \ - syntax_elements[ch_ele]->channel = channels; \ - syntax_elements[ch_ele]->paired_channel = -1; \ - \ - if ((hInfo->error = single_lfe_channel_element(syntax_elements[ch_ele], \ - ld, spec_data[channels], sf_index, object_type, frame_len)) > 0) \ - { \ - /* to make sure everything gets deallocated */ \ - channels++; ch_ele++; \ - goto error; \ - } \ - \ - channels++; \ - ch_ele++; -#endif - -#ifdef ERROR_RESILIENCE -#define decode_cpe() \ - spec_data[channels] = (int16_t*)malloc(frame_len*sizeof(int16_t)); \ - spec_data[channels+1] = (int16_t*)malloc(frame_len*sizeof(int16_t)); \ - spec_coef[channels] = (real_t*)malloc(frame_len*sizeof(real_t)); \ - spec_coef[channels+1] = (real_t*)malloc(frame_len*sizeof(real_t)); \ - \ - syntax_elements[ch_ele] = (element*)malloc(sizeof(element)); \ - memset(syntax_elements[ch_ele], 0, sizeof(element)); \ - syntax_elements[ch_ele]->ele_id = id_syn_ele; \ - syntax_elements[ch_ele]->channel = channels; \ - syntax_elements[ch_ele]->paired_channel = channels+1; \ - \ - if ((hInfo->error = channel_pair_element(syntax_elements[ch_ele], \ - ld, spec_data[channels], spec_data[channels+1], \ - sf_index, object_type, frame_len, \ - aacSectionDataResilienceFlag, aacScalefactorDataResilienceFlag, \ - aacSpectralDataResilienceFlag)) > 0) \ - { \ - /* to make sure everything gets deallocated */ \ - channels+=2; ch_ele++; \ - goto error; \ - } \ - \ - channels += 2; \ - ch_ele++; -#else -#define decode_cpe() \ - spec_data[channels] = (int16_t*)malloc(frame_len*sizeof(int16_t)); \ - spec_data[channels+1] = (int16_t*)malloc(frame_len*sizeof(int16_t)); \ - spec_coef[channels] = (real_t*)malloc(frame_len*sizeof(real_t)); \ - spec_coef[channels+1] = (real_t*)malloc(frame_len*sizeof(real_t)); \ - \ - syntax_elements[ch_ele] = (element*)malloc(sizeof(element)); \ - memset(syntax_elements[ch_ele], 0, sizeof(element)); \ - syntax_elements[ch_ele]->ele_id = id_syn_ele; \ - syntax_elements[ch_ele]->channel = channels; \ - syntax_elements[ch_ele]->paired_channel = channels+1; \ - \ - if ((hInfo->error = channel_pair_element(syntax_elements[ch_ele], \ - ld, spec_data[channels], spec_data[channels+1], \ - sf_index, object_type, frame_len)) > 0) \ - { \ - /* to make sure everything gets deallocated */ \ - channels+=2; ch_ele++; \ - goto error; \ - } \ - \ - channels += 2; \ - ch_ele++; -#endif - void* FAADAPI faacDecDecode(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, - uint8_t *buffer) + uint8_t *buffer, uint32_t buffer_size) { int32_t i; - uint8_t id_syn_ele, ele, ch; + uint8_t ch; adts_header adts; - uint8_t channels, ch_ele; - bitfile *ld = malloc(sizeof(bitfile)); + uint8_t channels = 0, ch_ele = 0; + bitfile *ld = (bitfile*)malloc(sizeof(bitfile)); /* local copys of globals */ uint8_t sf_index = hDecoder->sf_index; @@ -440,45 +347,49 @@ void* FAADAPI faacDecDecode(faacDecHandle hDecoder, #ifdef LTP_DEC real_t **lt_pred_stat = hDecoder->lt_pred_stat; #endif - real_t *iq_table = hDecoder->iq_table; +#ifndef FIXED_POINT #if POW_TABLE_SIZE real_t *pow2_table = hDecoder->pow2_table; #else real_t *pow2_table = NULL; #endif +#endif uint8_t *window_shape_prev = hDecoder->window_shape_prev; - real_t **time_state = hDecoder->time_state; real_t **time_out = hDecoder->time_out; - fb_info *fb = &hDecoder->fb; - drc_info *drc = &hDecoder->drc; +#ifdef SSR_DEC + real_t **ssr_overlap = hDecoder->ssr_overlap; + real_t **prev_fmd = hDecoder->prev_fmd; +#endif + fb_info *fb = hDecoder->fb; + drc_info *drc = hDecoder->drc; uint8_t outputFormat = hDecoder->config.outputFormat; #ifdef LTP_DEC uint16_t *ltp_lag = hDecoder->ltp_lag; #endif -#ifdef ERROR_RESILIENCE - uint8_t aacSectionDataResilienceFlag = hDecoder->aacSectionDataResilienceFlag; - uint8_t aacScalefactorDataResilienceFlag = hDecoder->aacScalefactorDataResilienceFlag; - uint8_t aacSpectralDataResilienceFlag = hDecoder->aacSpectralDataResilienceFlag; -#endif program_config pce; element *syntax_elements[MAX_SYNTAX_ELEMENTS]; + element **elements; int16_t *spec_data[MAX_CHANNELS]; real_t *spec_coef[MAX_CHANNELS]; - /* frame length is different for Low Delay AAC */ uint16_t frame_len = hDecoder->frameLength; void *sample_buffer; - ele = 0; - channels = 0; - ch_ele = 0; memset(hInfo, 0, sizeof(faacDecFrameInfo)); /* initialize the bitstream */ - faad_initbits(ld, buffer); + faad_initbits(ld, buffer, buffer_size); + +#ifdef DRM + if (object_type == DRM_ER_LC) + { + faad_getbits(ld, 8 + DEBUGVAR(1,1,"faacDecDecode(): skip CRC")); + } +#endif if (hDecoder->adts_header_present) { @@ -495,114 +406,23 @@ void* FAADAPI faacDecDecode(faacDecHandle hDecoder, dbg_count = 0; #endif -#ifdef ERROR_RESILIENCE - if (object_type < ER_OBJECT_START) - { -#endif - /* Table 4.4.3: raw_data_block() */ - while ((id_syn_ele = (uint8_t)faad_getbits(ld, LEN_SE_ID - DEBUGVAR(1,4,"faacDecDecode(): id_syn_ele"))) != ID_END) - { - switch (id_syn_ele) { - case ID_SCE: - case ID_LFE: - decode_sce_lfe(); - break; - case ID_CPE: - decode_cpe(); - break; - case ID_CCE: /* not implemented yet */ - hInfo->error = 6; - goto error; - break; - case ID_DSE: - data_stream_element(ld); - break; - case ID_PCE: - if ((hInfo->error = program_config_element(&pce, ld)) > 0) - goto error; - break; - case ID_FIL: - if ((hInfo->error = fill_element(ld, drc)) > 0) - goto error; - break; - } - ele++; - } -#ifdef ERROR_RESILIENCE - } else { - /* Table 262: er_raw_data_block() */ - switch (channelConfiguration) - { - case 1: - id_syn_ele = ID_SCE; - decode_sce_lfe(); - break; - case 2: - id_syn_ele = ID_CPE; - decode_cpe(); - break; - case 3: - id_syn_ele = ID_SCE; - decode_sce_lfe(); - id_syn_ele = ID_CPE; - decode_cpe(); - break; - case 4: - id_syn_ele = ID_SCE; - decode_sce_lfe(); - id_syn_ele = ID_CPE; - decode_cpe(); - id_syn_ele = ID_SCE; - decode_sce_lfe(); - break; - case 5: - id_syn_ele = ID_SCE; - decode_sce_lfe(); - id_syn_ele = ID_CPE; - decode_cpe(); - id_syn_ele = ID_CPE; - decode_cpe(); - break; - case 6: - id_syn_ele = ID_SCE; - decode_sce_lfe(); - id_syn_ele = ID_CPE; - decode_cpe(); - id_syn_ele = ID_CPE; - decode_cpe(); - id_syn_ele = ID_LFE; - decode_sce_lfe(); - break; - case 7: - id_syn_ele = ID_SCE; - decode_sce_lfe(); - id_syn_ele = ID_CPE; - decode_cpe(); - id_syn_ele = ID_CPE; - decode_cpe(); - id_syn_ele = ID_CPE; - decode_cpe(); - id_syn_ele = ID_LFE; - decode_sce_lfe(); - break; - default: - hInfo->error = 7; - goto error; - } -#if 0 - cnt = bits_to_decode() / 8; - while (cnt >= 1) - { - cnt -= extension_payload(cnt); - } -#endif - } -#endif + elements = syntax_elements; + + /* decode the complete bitstream */ + elements = raw_data_block(hDecoder, hInfo, ld, syntax_elements, + spec_data, spec_coef, &pce, drc); + + if (hInfo->error > 0) + goto error; + + ch_ele = hDecoder->fr_ch_ele; + channels = hDecoder->fr_channels; + /* no more bit reading after this */ faad_byte_align(ld); hInfo->bytesconsumed = bit2byte(faad_get_processed_bits(ld)); + faad_endbits(ld); if (ld) free(ld); ld = NULL; @@ -611,8 +431,15 @@ void* FAADAPI faacDecDecode(faacDecHandle hDecoder, /* number of samples in this frame */ hInfo->channels = channels; + /* check if frame has channel elements */ + if (channels == 0) + { + hDecoder->frame++; + return NULL; + } + if (hDecoder->sample_buffer == NULL) - hDecoder->sample_buffer = malloc(frame_len*channels*sizeof(float32_t)); + hDecoder->sample_buffer = malloc(frame_len*channels*sizeof(real_t)); sample_buffer = hDecoder->sample_buffer; @@ -631,23 +458,26 @@ void* FAADAPI faacDecDecode(faacDecHandle hDecoder, } /* inverse quantization */ - inverse_quantization(spec_coef[ch], spec_data[ch], iq_table, - frame_len); + inverse_quantization(spec_coef[ch], spec_data[ch], frame_len); /* apply scalefactors */ +#ifdef FIXED_POINT + apply_scalefactors(ics, spec_coef[ch], frame_len); +#else apply_scalefactors(ics, spec_coef[ch], pow2_table, frame_len); +#endif /* deinterleave short block grouping */ if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) quant_to_spec(ics, spec_coef[ch], frame_len); } - /* Because for ms and is both channels spectral coefficients are needed + /* Because for ms, is and pns both channels spectral coefficients are needed we have to restart running through all channels here. */ for (ch = 0; ch < channels; ch++) { - uint8_t pch = 0; + int16_t pch = -1; uint8_t right_channel; ic_stream *ics, *icsr; ltp_info *ltp; @@ -664,21 +494,28 @@ void* FAADAPI faacDecDecode(faacDecHandle hDecoder, right_channel = 0; } else if (syntax_elements[i]->paired_channel == ch) { ics = &(syntax_elements[i]->ics2); - ltp = &(ics->ltp2); + if (syntax_elements[i]->common_window) + ltp = &(ics->ltp2); + else + ltp = &(ics->ltp); right_channel = 1; } } - /* mid/side decoding */ - if (!right_channel) - ms_decode(ics, icsr, spec_coef[ch], spec_coef[pch], frame_len); - /* pns decoding */ - pns_decode(ics, spec_coef[ch], frame_len); + if ((!right_channel) && (pch != -1) && (ics->ms_mask_present)) + pns_decode(ics, icsr, spec_coef[ch], spec_coef[pch], frame_len, 1); + else if ((pch == -1) || ((pch != -1) && (!ics->ms_mask_present))) + pns_decode(ics, NULL, spec_coef[ch], NULL, frame_len, 0); - /* intensity stereo decoding */ - if (!right_channel) + if (!right_channel && (pch != -1)) + { + /* mid/side decoding */ + ms_decode(ics, icsr, spec_coef[ch], spec_coef[pch], frame_len); + + /* intensity stereo decoding */ is_decode(ics, icsr, spec_coef[ch], spec_coef[pch], frame_len); + } #ifdef MAIN_DEC /* MAIN object type prediction */ @@ -687,7 +524,7 @@ void* FAADAPI faacDecDecode(faacDecHandle hDecoder, /* allocate the state only when needed */ if (pred_stat[ch] == NULL) { - pred_stat[ch] = malloc(frame_len * sizeof(pred_state)); + pred_stat[ch] = (pred_state*)malloc(frame_len * sizeof(pred_state)); reset_all_predictors(pred_stat[ch], frame_len); } @@ -702,7 +539,7 @@ void* FAADAPI faacDecDecode(faacDecHandle hDecoder, } #endif #ifdef LTP_DEC - else if ((object_type == LTP) + if ((object_type == LTP) #ifdef ERROR_RESILIENCE || (object_type == ER_LTP) #endif @@ -716,18 +553,17 @@ void* FAADAPI faacDecDecode(faacDecHandle hDecoder, { if (ltp->data_present) { - if (!ltp->lag_update) - ltp->lag = ltp_lag[ch]; - else + if (ltp->lag_update) ltp_lag[ch] = ltp->lag; } + ltp->lag = ltp_lag[ch]; } #endif /* allocate the state only when needed */ if (lt_pred_stat[ch] == NULL) { - lt_pred_stat[ch] = malloc(frame_len*4 * sizeof(real_t)); + lt_pred_stat[ch] = (real_t*)malloc(frame_len*4 * sizeof(real_t)); memset(lt_pred_stat[ch], 0, frame_len*4 * sizeof(real_t)); } @@ -749,29 +585,40 @@ void* FAADAPI faacDecDecode(faacDecHandle hDecoder, drc_decode(drc, spec_coef[ch]); } - if (time_state[ch] == NULL) - { - real_t *tp; - - time_state[ch] = malloc(frame_len*sizeof(real_t)); - tp = time_state[ch]; - for (i = frame_len/16-1; i >= 0; --i) - { - *tp++ = 0; *tp++ = 0; *tp++ = 0; *tp++ = 0; - *tp++ = 0; *tp++ = 0; *tp++ = 0; *tp++ = 0; - *tp++ = 0; *tp++ = 0; *tp++ = 0; *tp++ = 0; - *tp++ = 0; *tp++ = 0; *tp++ = 0; *tp++ = 0; - } - } if (time_out[ch] == NULL) { - time_out[ch] = malloc(frame_len*2*sizeof(real_t)); + time_out[ch] = (real_t*)malloc(frame_len*2*sizeof(real_t)); + memset(time_out[ch], 0, frame_len*2*sizeof(real_t)); } /* filter bank */ - ifilter_bank(fb, ics->window_sequence, ics->window_shape, - window_shape_prev[ch], spec_coef[ch], time_state[ch], - time_out[ch], object_type, frame_len); +#ifdef SSR_DEC + if (object_type != SSR) + { +#endif + ifilter_bank(fb, ics->window_sequence, ics->window_shape, + window_shape_prev[ch], spec_coef[ch], + time_out[ch], object_type, frame_len); +#ifdef SSR_DEC + } else { + if (ssr_overlap[ch] == NULL) + { + ssr_overlap[ch] = (real_t*)malloc(2*frame_len*sizeof(real_t)); + memset(ssr_overlap[ch], 0, 2*frame_len*sizeof(real_t)); + } + if (prev_fmd[ch] == NULL) + { + uint16_t k; + prev_fmd[ch] = (real_t*)malloc(2*frame_len*sizeof(real_t)); + for (k = 0; k < 2*frame_len; k++) + prev_fmd[ch][k] = REAL_CONST(-1); + } + + ssr_decode(&(ics->ssr), fb, ics->window_sequence, ics->window_shape, + window_shape_prev[ch], spec_coef[ch], time_out[ch], + ssr_overlap[ch], hDecoder->ipqf_buffer[ch], prev_fmd[ch], frame_len); + } +#endif /* save window shape for next frame */ window_shape_prev[ch] = ics->window_shape; @@ -785,7 +632,7 @@ void* FAADAPI faacDecDecode(faacDecHandle hDecoder, #endif ) { - lt_update_state(lt_pred_stat[ch], time_out[ch], time_state[ch], + lt_update_state(lt_pred_stat[ch], time_out[ch], time_out[ch]+frame_len, frame_len, object_type); } #endif @@ -812,13 +659,13 @@ void* FAADAPI faacDecDecode(faacDecHandle hDecoder, /* cleanup */ for (ch = 0; ch < channels; ch++) { - free(spec_coef[ch]); - free(spec_data[ch]); + if (spec_coef[ch]) free(spec_coef[ch]); + if (spec_data[ch]) free(spec_data[ch]); } for (i = 0; i < ch_ele; i++) { - free(syntax_elements[i]); + if (syntax_elements[i]) free(syntax_elements[i]); } #ifdef ANALYSIS @@ -829,18 +676,19 @@ void* FAADAPI faacDecDecode(faacDecHandle hDecoder, error: /* free all memory that could have been allocated */ + faad_endbits(ld); if (ld) free(ld); /* cleanup */ for (ch = 0; ch < channels; ch++) { - free(spec_coef[ch]); - free(spec_data[ch]); + if (spec_coef[ch]) free(spec_coef[ch]); + if (spec_data[ch]) free(spec_data[ch]); } for (i = 0; i < ch_ele; i++) { - free(syntax_elements[i]); + if (syntax_elements[i]) free(syntax_elements[i]); } #ifdef ANALYSIS diff --git a/src/libfaad/decoder.h b/src/libfaad/decoder.h index fb9f8c8c4..a7ea19232 100644 --- a/src/libfaad/decoder.h +++ b/src/libfaad/decoder.h @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: decoder.h,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: decoder.h,v 1.2 2002/12/16 18:59:59 miguelfreitas Exp $ **/ #ifndef __DECODER_H__ @@ -39,6 +39,7 @@ extern "C" { #include "bits.h" #include "syntax.h" +#include "drc.h" #include "specrec.h" #include "filtbank.h" #include "ic_predict.h" @@ -48,69 +49,13 @@ extern "C" { #define FAAD_FMT_24BIT 2 #define FAAD_FMT_32BIT 3 #define FAAD_FMT_FLOAT 4 +#define FAAD_FMT_16BIT_DITHER 5 +#define FAAD_FMT_16BIT_L_SHAPE 6 +#define FAAD_FMT_16BIT_M_SHAPE 7 +#define FAAD_FMT_16BIT_H_SHAPE 8 -typedef struct faacDecConfiguration -{ - uint8_t defObjectType; - uint32_t defSampleRate; - uint8_t outputFormat; -} faacDecConfiguration, *faacDecConfigurationPtr; - -typedef struct faacDecFrameInfo -{ - uint32_t bytesconsumed; - uint32_t samples; - uint8_t channels; - uint8_t error; -} faacDecFrameInfo; - -typedef struct -{ - uint8_t adts_header_present; - uint8_t adif_header_present; - uint8_t sf_index; - uint8_t object_type; - uint8_t channelConfiguration; - uint8_t aacSectionDataResilienceFlag; - uint8_t aacScalefactorDataResilienceFlag; - uint8_t aacSpectralDataResilienceFlag; - uint16_t frameLength; - - uint32_t frame; - - 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_state[MAX_CHANNELS]; - real_t *time_out[MAX_CHANNELS]; - -#ifdef MAIN_DEC - pred_state *pred_stat[MAX_CHANNELS]; -#endif -#ifdef LTP_DEC - real_t *lt_pred_stat[MAX_CHANNELS]; -#endif - real_t exp_table[256]; - real_t mnt_table[128]; - - real_t iq_table[IQ_TABLE_SIZE]; -#if POW_TABLE_SIZE - real_t pow2_table[POW_TABLE_SIZE]; -#endif - - /* Configuration data */ - faacDecConfiguration config; -} faacDecStruct, *faacDecHandle; - - -uint8_t* FAADAPI faacDecGetErrorMessage(uint8_t errcode); +int8_t* FAADAPI faacDecGetErrorMessage(uint8_t errcode); faacDecHandle FAADAPI faacDecOpen(); @@ -121,20 +66,39 @@ uint8_t FAADAPI faacDecSetConfiguration(faacDecHandle hDecoder, /* Init the library based on info from the AAC file (ADTS/ADIF) */ int32_t FAADAPI faacDecInit(faacDecHandle hDecoder, - uint8_t *buffer, - uint32_t *samplerate, - uint8_t *channels); + uint8_t *buffer, + uint32_t buffer_size, + uint32_t *samplerate, + uint8_t *channels); /* Init the library using a DecoderSpecificInfo */ int8_t FAADAPI faacDecInit2(faacDecHandle hDecoder, uint8_t *pBuffer, uint32_t SizeOfDecoderSpecificInfo, uint32_t *samplerate, uint8_t *channels); +/* Init the library for DRM */ +int8_t FAADAPI faacDecInitDRM(faacDecHandle hDecoder, uint32_t samplerate, + uint8_t channels); + void FAADAPI faacDecClose(faacDecHandle hDecoder); void* FAADAPI faacDecDecode(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, - uint8_t *buffer); + uint8_t *buffer, + uint32_t buffer_size); + +element *decode_sce_lfe(faacDecHandle hDecoder, + faacDecFrameInfo *hInfo, bitfile *ld, + int16_t **spec_data, real_t **spec_coef, + uint8_t id_syn_ele); +element *decode_cpe(faacDecHandle hDecoder, + faacDecFrameInfo *hInfo, bitfile *ld, + int16_t **spec_data, real_t **spec_coef, + uint8_t id_syn_ele); +element **raw_data_block(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, + bitfile *ld, element **elements, + int16_t **spec_data, real_t **spec_coef, + program_config *pce, drc_info *drc); #ifdef _WIN32 #pragma pack(pop) diff --git a/src/libfaad/dither.c b/src/libfaad/dither.c new file mode 100644 index 000000000..9c29e189a --- /dev/null +++ b/src/libfaad/dither.c @@ -0,0 +1,132 @@ +/* This program is licensed under the GNU Library General Public License, version 2, + * a copy of which is included with this program (with filename LICENSE.LGPL). + * + * (c) 2002 John Edwards + * mostly lifted from work by Frank Klemm + * random functions for dithering. + * + * last modified: + * $Id: dither.c,v 1.1 2002/12/16 18:59:59 miguelfreitas Exp $ + */ +#include "common.h" + +#ifndef FIXED_POINT + +#include <string.h> +#include "dither.h" +#include "common.h" + + +double +Random_Equi ( double mult ) // gives a equal distributed random number +{ // between -2^31*mult and +2^31*mult + return mult * (int) random_int (); +} + +double +Random_Triangular ( double mult ) // gives a triangular distributed random number +{ // between -2^32*mult and +2^32*mult + return mult * ( (double) (int) random_int () + (double) (int) random_int () ); +} + +/*********************************************************************************************************************/ + +static const float32_t F44_0 [16 + 32] = { + (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, + (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, + + (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, + (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, + + (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, + (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0 +}; + + +static const float32_t F44_1 [16 + 32] = { /* SNR(w) = 4.843163 dB, SNR = -3.192134 dB */ + (float) 0.85018292704024355931, (float) 0.29089597350995344721, (float)-0.05021866022121039450, (float)-0.23545456294599161833, + (float)-0.58362726442227032096, (float)-0.67038978965193036429, (float)-0.38566861572833459221, (float)-0.15218663390367969967, + (float)-0.02577543084864530676, (float) 0.14119295297688728127, (float) 0.22398848581628781612, (float) 0.15401727203382084116, + (float) 0.05216161232906000929, (float)-0.00282237820999675451, (float)-0.03042794608323867363, (float)-0.03109780942998826024, + + (float) 0.85018292704024355931, (float) 0.29089597350995344721, (float)-0.05021866022121039450, (float)-0.23545456294599161833, + (float)-0.58362726442227032096, (float)-0.67038978965193036429, (float)-0.38566861572833459221, (float)-0.15218663390367969967, + (float)-0.02577543084864530676, (float) 0.14119295297688728127, (float) 0.22398848581628781612, (float) 0.15401727203382084116, + (float) 0.05216161232906000929, (float)-0.00282237820999675451, (float)-0.03042794608323867363, (float)-0.03109780942998826024, + + (float) 0.85018292704024355931, (float) 0.29089597350995344721, (float)-0.05021866022121039450, (float)-0.23545456294599161833, + (float)-0.58362726442227032096, (float)-0.67038978965193036429, (float)-0.38566861572833459221, (float)-0.15218663390367969967, + (float)-0.02577543084864530676, (float) 0.14119295297688728127, (float) 0.22398848581628781612, (float) 0.15401727203382084116, + (float) 0.05216161232906000929, (float)-0.00282237820999675451, (float)-0.03042794608323867363, (float)-0.03109780942998826024, +}; + + +static const float32_t F44_2 [16 + 32] = { /* SNR(w) = 10.060213 dB, SNR = -12.766730 dB */ + (float) 1.78827593892108555290, (float) 0.95508210637394326553, (float)-0.18447626783899924429, (float)-0.44198126506275016437, + (float)-0.88404052492547413497, (float)-1.42218907262407452967, (float)-1.02037566838362314995, (float)-0.34861755756425577264, + (float)-0.11490230170431934434, (float) 0.12498899339968611803, (float) 0.38065885268563131927, (float) 0.31883491321310506562, + (float) 0.10486838686563442765, (float)-0.03105361685110374845, (float)-0.06450524884075370758, (float)-0.02939198261121969816, + + (float) 1.78827593892108555290, (float) 0.95508210637394326553, (float)-0.18447626783899924429, (float)-0.44198126506275016437, + (float)-0.88404052492547413497, (float)-1.42218907262407452967, (float)-1.02037566838362314995, (float)-0.34861755756425577264, + (float)-0.11490230170431934434, (float) 0.12498899339968611803, (float) 0.38065885268563131927, (float) 0.31883491321310506562, + (float) 0.10486838686563442765, (float)-0.03105361685110374845, (float)-0.06450524884075370758, (float)-0.02939198261121969816, + + (float) 1.78827593892108555290, (float) 0.95508210637394326553, (float)-0.18447626783899924429, (float)-0.44198126506275016437, + (float)-0.88404052492547413497, (float)-1.42218907262407452967, (float)-1.02037566838362314995, (float)-0.34861755756425577264, + (float)-0.11490230170431934434, (float) 0.12498899339968611803, (float) 0.38065885268563131927, (float) 0.31883491321310506562, + (float) 0.10486838686563442765, (float)-0.03105361685110374845, (float)-0.06450524884075370758, (float)-0.02939198261121969816, +}; + + +static const float32_t F44_3 [16 + 32] = { /* SNR(w) = 15.382598 dB, SNR = -29.402334 dB */ + (float) 2.89072132015058161445, (float) 2.68932810943698754106, (float) 0.21083359339410251227, (float)-0.98385073324997617515, + (float)-1.11047823227097316719, (float)-2.18954076314139673147, (float)-2.36498032881953056225, (float)-0.95484132880101140785, + (float)-0.23924057925542965158, (float)-0.13865235703915925642, (float) 0.43587843191057992846, (float) 0.65903257226026665927, + (float) 0.24361815372443152787, (float)-0.00235974960154720097, (float) 0.01844166574603346289, (float) 0.01722945988740875099, + + (float) 2.89072132015058161445, (float) 2.68932810943698754106, (float) 0.21083359339410251227, (float)-0.98385073324997617515, + (float)-1.11047823227097316719, (float)-2.18954076314139673147, (float)-2.36498032881953056225, (float)-0.95484132880101140785, + (float)-0.23924057925542965158, (float)-0.13865235703915925642, (float) 0.43587843191057992846, (float) 0.65903257226026665927, + (float) 0.24361815372443152787, (float)-0.00235974960154720097, (float) 0.01844166574603346289, (float) 0.01722945988740875099, + + (float) 2.89072132015058161445, (float) 2.68932810943698754106, (float) 0.21083359339410251227, (float)-0.98385073324997617515, + (float)-1.11047823227097316719, (float)-2.18954076314139673147, (float)-2.36498032881953056225, (float)-0.95484132880101140785, + (float)-0.23924057925542965158, (float)-0.13865235703915925642, (float) 0.43587843191057992846, (float) 0.65903257226026665927, + (float) 0.24361815372443152787, (float)-0.00235974960154720097, (float) 0.01844166574603346289, (float) 0.01722945988740875099 +}; + + +double +scalar16 ( const float32_t* x, const float32_t* y ) +{ + return x[ 0]*y[ 0] + x[ 1]*y[ 1] + x[ 2]*y[ 2] + x[ 3]*y[ 3] + + x[ 4]*y[ 4] + x[ 5]*y[ 5] + x[ 6]*y[ 6] + x[ 7]*y[ 7] + + x[ 8]*y[ 8] + x[ 9]*y[ 9] + x[10]*y[10] + x[11]*y[11] + + x[12]*y[12] + x[13]*y[13] + x[14]*y[14] + x[15]*y[15]; +} + + +void +Init_Dither ( unsigned char bits, unsigned char shapingtype ) +{ + static uint8_t default_dither [] = { 92, 92, 88, 84, 81, 78, 74, 67, 0, 0 }; + static const float32_t* F [] = { F44_0, F44_1, F44_2, F44_3 }; + uint8_t index; + + if (shapingtype < 0) shapingtype = 0; + if (shapingtype > 3) shapingtype = 3; + index = bits - 11 - shapingtype; + if (index < 0) index = 0; + if (index > 9) index = 9; + + memset ( Dither.ErrorHistory , 0, sizeof (Dither.ErrorHistory ) ); + memset ( Dither.DitherHistory, 0, sizeof (Dither.DitherHistory) ); + + Dither.FilterCoeff = F [shapingtype]; + Dither.Mask = ((uint64_t)-1) << (32 - bits); + Dither.Add = 0.5 * ((1L << (32 - bits)) - 1); + Dither.Dither = 0.01*default_dither[index] / (((int64_t)1) << bits); +} + +#endif diff --git a/src/libfaad/dither.h b/src/libfaad/dither.h new file mode 100644 index 000000000..34fb31996 --- /dev/null +++ b/src/libfaad/dither.h @@ -0,0 +1,47 @@ +/* This program is licensed under the GNU Library General Public License, version 2, + * a copy of which is included with this program (with filename LICENSE.LGPL). + * + * (c) 2002 John Edwards + * + * rand_t header. + * + * last modified: $ID:$ + */ + +#include "common.h" + +#ifndef __RAND_T_H +#define __RAND_T_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef FIXED_POINT + +typedef struct { + const float32_t* FilterCoeff; + uint64_t Mask; + double Add; + float32_t Dither; + float32_t ErrorHistory [2] [16]; // max. 2 channels, 16th order Noise shaping + float32_t DitherHistory [2] [16]; + int32_t LastRandomNumber [2]; +} dither_t; + +extern dither_t Dither; +extern double doubletmp; +//static const uint8_t Parity [256]; +uint32_t random_int ( void ); +extern double scalar16 ( const float32_t* x, const float32_t* y ); +extern double Random_Equi ( double mult ); +extern double Random_Triangular ( double mult ); +void Init_Dither ( unsigned char bits, unsigned char shapingtype ); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/libfaad/drc.c b/src/libfaad/drc.c index 0da3ed110..14f3a2b1f 100644 --- a/src/libfaad/drc.c +++ b/src/libfaad/drc.c @@ -16,17 +16,20 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: drc.c,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: drc.c,v 1.2 2002/12/16 19:00:00 miguelfreitas Exp $ **/ #include "common.h" +#include "structs.h" -#include <memory.h> +#include <stdlib.h> +#include <string.h> #include "syntax.h" #include "drc.h" -void init_drc(drc_info *drc, real_t cut, real_t boost) +drc_info *drc_init(real_t cut, real_t boost) { + drc_info *drc = (drc_info*)malloc(sizeof(drc_info)); memset(drc, 0, sizeof(drc_info)); drc->ctrl1 = cut; @@ -36,12 +39,76 @@ void init_drc(drc_info *drc, real_t cut, real_t boost) drc->band_top[0] = 1024/4 - 1; drc->dyn_rng_sgn[0] = 1; drc->dyn_rng_ctl[0] = 0; + + return drc; +} + +void drc_end(drc_info *drc) +{ + if (drc) free(drc); } +#ifdef FIXED_POINT +static real_t drc_pow2_table[] = +{ + COEF_CONST(0.5146511183), + COEF_CONST(0.5297315472), + COEF_CONST(0.5452538663), + COEF_CONST(0.5612310242), + COEF_CONST(0.5776763484), + COEF_CONST(0.5946035575), + COEF_CONST(0.6120267717), + COEF_CONST(0.6299605249), + COEF_CONST(0.6484197773), + COEF_CONST(0.6674199271), + COEF_CONST(0.6869768237), + COEF_CONST(0.7071067812), + COEF_CONST(0.7278265914), + COEF_CONST(0.7491535384), + COEF_CONST(0.7711054127), + COEF_CONST(0.7937005260), + COEF_CONST(0.8169577266), + COEF_CONST(0.8408964153), + COEF_CONST(0.8655365610), + COEF_CONST(0.8908987181), + COEF_CONST(0.9170040432), + COEF_CONST(0.9438743127), + COEF_CONST(0.9715319412), + COEF_CONST(1.0000000000), + COEF_CONST(1.0293022366), + COEF_CONST(1.0594630944), + COEF_CONST(1.0905077327), + COEF_CONST(1.1224620483), + COEF_CONST(1.1553526969), + COEF_CONST(1.1892071150), + COEF_CONST(1.2240535433), + COEF_CONST(1.2599210499), + COEF_CONST(1.2968395547), + COEF_CONST(1.3348398542), + COEF_CONST(1.3739536475), + COEF_CONST(1.4142135624), + COEF_CONST(1.4556531828), + COEF_CONST(1.4983070769), + COEF_CONST(1.5422108254), + COEF_CONST(1.5874010520), + COEF_CONST(1.6339154532), + COEF_CONST(1.6817928305), + COEF_CONST(1.7310731220), + COEF_CONST(1.7817974363), + COEF_CONST(1.8340080864), + COEF_CONST(1.8877486254), + COEF_CONST(1.9430638823) +}; +#endif + void drc_decode(drc_info *drc, real_t *spec) { uint16_t i, bd, top; - real_t factor; +#ifdef FIXED_POINT + int32_t exp, frac; +#else + real_t factor, exp; +#endif uint16_t bottom = 0; if (drc->num_bands == 1) @@ -51,26 +118,46 @@ void drc_decode(drc_info *drc, real_t *spec) { top = 4 * (drc->band_top[bd] + 1); +#ifndef FIXED_POINT /* Decode DRC gain factor */ if (drc->dyn_rng_sgn[bd]) /* compress */ - factor = (real_t)exp(LN2 * (-drc->ctrl1 * drc->dyn_rng_ctl[bd]/24.0)); + exp = -drc->ctrl1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/24.0; else /* boost */ - factor = (real_t)exp(LN2 * (drc->ctrl2 * drc->dyn_rng_ctl[bd]/24.0)); - - /* Level alignment between different programs (if desired) */ - /* If program reference normalization is done in the digital domain, - modify factor to perform normalization. - prog_ref_level can alternatively be passed to the system for - modification of the level in the analog domain. Analog level - modification avoids problems with reduced DAC SNR (if signal is - attenuated) or clipping (if signal is boosted) - */ - factor = MUL(factor, - (real_t)exp(LN05 * ((DRC_REF_LEVEL - drc->prog_ref_level)/24.0))); + exp = drc->ctrl2 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/24.0; + factor = (real_t)pow(2.0, exp); /* Apply gain factor */ for (i = bottom; i < top; i++) - spec[i] = MUL(spec[i], factor); + spec[i] *= factor; +#else + /* Decode DRC gain factor */ + if (drc->dyn_rng_sgn[bd]) /* compress */ + { + exp = -1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/ 24; + frac = -1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) % 24; + } else { /* boost */ + exp = (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/ 24; + frac = (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) % 24; + } + + /* Apply gain factor */ + if (exp < 0) + { + for (i = bottom; i < top; i++) + { + spec[i] >>= -exp; + if (frac) + spec[i] = MUL(spec[i],drc_pow2_table[frac+23]); + } + } else { + for (i = bottom; i < top; i++) + { + spec[i] <<= exp; + if (frac) + spec[i] = MUL(spec[i],drc_pow2_table[frac+23]); + } + } +#endif bottom = top; } diff --git a/src/libfaad/drc.h b/src/libfaad/drc.h index d81e8f717..e831f7545 100644 --- a/src/libfaad/drc.h +++ b/src/libfaad/drc.h @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: drc.h,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: drc.h,v 1.2 2002/12/16 19:00:00 miguelfreitas Exp $ **/ #ifndef __DRC_H__ @@ -28,7 +28,9 @@ extern "C" { #define DRC_REF_LEVEL 20*4 /* -20 dB */ -void init_drc(drc_info *drc, real_t cut, real_t boost); + +drc_info *drc_init(real_t cut, real_t boost); +void drc_end(drc_info *drc); void drc_decode(drc_info *drc, real_t *spec); diff --git a/src/libfaad/error.c b/src/libfaad/error.c index 8b31c01fc..2e766f64e 100644 --- a/src/libfaad/error.c +++ b/src/libfaad/error.c @@ -16,13 +16,13 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: error.c,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: error.c,v 1.2 2002/12/16 19:00:01 miguelfreitas Exp $ **/ #include "common.h" #include "error.h" -extern uint8_t *err_msg[] = { +extern int8_t *err_msg[] = { "No error", "Gain control not yet implemented", "Pulse coding not allowed in short blocks", @@ -34,5 +34,7 @@ extern uint8_t *err_msg[] = { "Bit error in error resilient scalefactor decoding", "Error decoding huffman scalefactor (bitstream error)", "Error decoding huffman codeword (bitstream error)", - "Non existent huffman codebook number found" + "Non existent huffman codebook number found", + "Maximum number of channels exceeded", + "Maximum number of bitstream elements exceeded" };
\ No newline at end of file diff --git a/src/libfaad/error.h b/src/libfaad/error.h index 5a9f38b09..52a9609ee 100644 --- a/src/libfaad/error.h +++ b/src/libfaad/error.h @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: error.h,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: error.h,v 1.2 2002/12/16 19:00:01 miguelfreitas Exp $ **/ #ifndef __ERROR_H__ @@ -26,7 +26,7 @@ extern "C" { #endif -extern uint8_t *err_msg[]; +extern int8_t *err_msg[]; #ifdef __cplusplus } diff --git a/src/libfaad/faad.h b/src/libfaad/faad.h index 68e5bf3a6..a86128733 100644 --- a/src/libfaad/faad.h +++ b/src/libfaad/faad.h @@ -1,22 +1,22 @@ /* ** FAAD - Freeware Advanced Audio Decoder ** Copyright (C) 2002 M. Bakker -** +** ** 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 +** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: faad.h,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: faad.h,v 1.2 2002/12/16 19:00:02 miguelfreitas Exp $ **/ #ifndef __AACDEC_H__ @@ -37,19 +37,32 @@ extern "C" { #endif #endif +#define FAAD2_VERSION "1.2 beta" -#define MAIN 0 -#define LC 1 -#define SSR 2 -#define LTP 3 -#define ER_LC 17 -#define LD 23 -#define DRM_ER_LC 27 /* special object type for DRM */ +/* object types for AAC */ +#define MAIN 0 +#define LC 1 +#define SSR 2 +#define LTP 3 +#define ER_LC 17 +#define ER_LTP 19 +#define LD 23 +#define DRM_ER_LC 27 /* special object type for DRM */ +/* header types */ +#define RAW 0 +#define ADIF 1 +#define ADTS 2 + +/* library output formats */ #define FAAD_FMT_16BIT 1 #define FAAD_FMT_24BIT 2 #define FAAD_FMT_32BIT 3 #define FAAD_FMT_FLOAT 4 +#define FAAD_FMT_16BIT_DITHER 5 +#define FAAD_FMT_16BIT_L_SHAPE 6 +#define FAAD_FMT_16BIT_M_SHAPE 7 +#define FAAD_FMT_16BIT_H_SHAPE 8 /* A decode call can eat up to FAAD_MIN_STREAMSIZE octets per decoded channel, so at least so much octets per channel should be available in this stream */ @@ -74,7 +87,7 @@ typedef struct faacDecFrameInfo unsigned char error; } faacDecFrameInfo; -unsigned char* FAADAPI faacDecGetErrorMessage(unsigned char errcode); +char* FAADAPI faacDecGetErrorMessage(unsigned char errcode); faacDecHandle FAADAPI faacDecOpen(); @@ -86,6 +99,7 @@ unsigned char FAADAPI faacDecSetConfiguration(faacDecHandle hDecoder, /* Init the library based on info from the AAC file (ADTS/ADIF) */ long FAADAPI faacDecInit(faacDecHandle hDecoder, unsigned char *buffer, + unsigned long buffer_size, unsigned long *samplerate, unsigned char *channels); @@ -94,13 +108,19 @@ char FAADAPI faacDecInit2(faacDecHandle hDecoder, unsigned char *pBuffer, unsigned long SizeOfDecoderSpecificInfo, unsigned long *samplerate, unsigned char *channels); +/* Init the library for DRM */ +char FAADAPI faacDecInitDRM(faacDecHandle hDecoder, unsigned long samplerate, + unsigned char channels); + void FAADAPI faacDecClose(faacDecHandle hDecoder); void* FAADAPI faacDecDecode(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, - unsigned char *buffer); + unsigned char *buffer, + unsigned long buffer_size); char FAADAPI AudioSpecificConfig(unsigned char *pBuffer, + unsigned long buffer_size, unsigned long *samplerate, unsigned char *channels, unsigned char *sf_index, diff --git a/src/libfaad/filtbank.c b/src/libfaad/filtbank.c index 8ba293686..24cc03780 100644 --- a/src/libfaad/filtbank.c +++ b/src/libfaad/filtbank.c @@ -16,148 +16,79 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: filtbank.c,v 1.2 2002/08/09 22:36:36 miguelfreitas Exp $ +** $Id: filtbank.c,v 1.3 2002/12/16 19:00:02 miguelfreitas Exp $ **/ #include "common.h" +#include "structs.h" #include <stdlib.h> +#include <string.h> +#ifdef _WIN32_WCE +#define assert(x) +#else #include <assert.h> +#endif + #include "filtbank.h" +#include "decoder.h" #include "syntax.h" #include "kbd_win.h" +#include "sine_win.h" #include "mdct.h" -void filter_bank_init(fb_info *fb, uint16_t frame_len) +fb_info *filter_bank_init(uint16_t frame_len) { - uint16_t i; uint16_t nshort = frame_len/8; #ifdef LD_DEC uint16_t frame_len_ld = frame_len/2; #endif - /* normal */ - faad_mdct_init(&(fb->mdct256), 2*nshort); - faad_mdct_init(&(fb->mdct2048), 2*frame_len); - - fb->long_window[0] = malloc(frame_len*sizeof(real_t)); - fb->short_window[0] = malloc(nshort*sizeof(real_t)); - fb->long_window[1] = kbd_long; - fb->short_window[1] = kbd_short; - - /* calculate the sine windows */ - for (i = 0; i < frame_len; i++) - fb->long_window[0][i] = (real_t)sin(M_PI / (2.0 * frame_len) * (i + 0.5)); - for (i = 0; i < nshort; i++) - fb->short_window[0][i] = (real_t)sin(M_PI / (2.0 * nshort) * (i + 0.5)); + fb_info *fb = (fb_info*)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); #ifdef LD_DEC /* LD */ - faad_mdct_init(&(fb->mdct1024), frame_len_ld); - - fb->ld_window[0] = malloc(frame_len_ld*sizeof(real_t)); - fb->ld_window[1] = malloc(frame_len_ld*sizeof(real_t)); - - /* calculate the sine windows */ - for (i = 0; i < frame_len_ld; i++) - fb->ld_window[0][i] = (real_t)sin(M_PI / (2.0 * frame_len_ld) * (i + 0.5)); - - /* low overlap window */ - for (i = 0; i < 3*(frame_len_ld>>3); i++) - fb->ld_window[1][i] = 0.0; - for (; i < 5*(frame_len_ld>>3); i++) - fb->ld_window[1][i] = (real_t)sin((i-3*(frame_len_ld>>3)+0.5) * M_PI / (frame_len_ld>>1)); - for (; i < frame_len_ld; i++) - fb->ld_window[1][i] = 1.0; + fb->mdct1024 = faad_mdct_init(2*frame_len_ld); #endif -} - -void filter_bank_end(fb_info *fb) -{ - faad_mdct_end(&(fb->mdct256)); - faad_mdct_end(&(fb->mdct2048)); - - if (fb->long_window[0]) free(fb->long_window[0]); - if (fb->short_window[0]) free(fb->short_window[0]); + if (frame_len == 1024) + { + fb->long_window[0] = sine_long_1024; + fb->short_window[0] = sine_short_128; + fb->long_window[1] = kbd_long_1024; + fb->short_window[1] = kbd_short_128; #ifdef LD_DEC - faad_mdct_end(&(fb->mdct1024)); - - if (fb->ld_window[0]) free(fb->ld_window[0]); - if (fb->ld_window[1]) free(fb->ld_window[1]); + fb->ld_window[0] = sine_mid_512; + fb->ld_window[1] = ld_mid_512; +#endif + } else /* (frame_len == 960) */ { + fb->long_window[0] = sine_long_960; + fb->short_window[0] = sine_short_120; + fb->long_window[1] = kbd_long_960; + fb->short_window[1] = kbd_short_120; +#ifdef LD_DEC + fb->ld_window[0] = sine_mid_480; + fb->ld_window[1] = ld_mid_480; #endif -} - -static INLINE void vcopy(real_t *src, real_t *dest, uint16_t vlen) -{ - int16_t i; - - assert(vlen % 4 == 0); - - for (i = vlen/4-1; i >= 0; --i) - { - *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; *dest++ = *src++; - } -} - -static INLINE void vzero(real_t *dest, uint16_t vlen) -{ - int16_t i; - - assert(vlen % 4 == 0); - - for (i = vlen/4-1; i >= 0; --i) - { - *dest-- = 0; *dest-- = 0; *dest-- = 0; *dest-- = 0; - } -} - -static INLINE void vmult1(real_t *src1, real_t *src2, real_t *dest, uint16_t vlen) -{ - int16_t i; - - assert(vlen % 4 == 0); - - for (i = vlen/4-1; i >= 0 ; --i) - { - *dest++ = MUL(*src1++, *src2++); *dest++ = MUL(*src1++, *src2++); - *dest++ = MUL(*src1++, *src2++); *dest++ = MUL(*src1++, *src2++); } -} -static INLINE void vmult2(real_t *src1, real_t *src2, real_t *dest, uint16_t vlen) -{ - int16_t i; - - assert(vlen % 4 == 0); - - for (i = vlen/4-1; i >= 0 ; --i) - { - *dest++ = MUL(*src1++, *src2--); *dest++ = MUL(*src1++, *src2--); - *dest++ = MUL(*src1++, *src2--); *dest++ = MUL(*src1++, *src2--); - } + return fb; } -static INLINE void vadd(real_t *src1, real_t *src2, real_t *dest, uint16_t vlen) +void filter_bank_end(fb_info *fb) { - int16_t i; - - assert(vlen % 4 == 0); + faad_mdct_end(fb->mdct256); + faad_mdct_end(fb->mdct2048); +#ifdef LD_DEC + faad_mdct_end(fb->mdct1024); +#endif - for (i = vlen/4-1; i >= 0; --i) - { - *dest++ = *src1++ + *src2++; *dest++ = *src1++ + *src2++; - *dest++ = *src1++ + *src2++; *dest++ = *src1++ + *src2++; -/* - *dest++ = *src1++ + *src2++; *dest++ = *src1++ + *src2++; - *dest++ = *src1++ + *src2++; *dest++ = *src1++ + *src2++; - *dest++ = *src1++ + *src2++; *dest++ = *src1++ + *src2++; - *dest++ = *src1++ + *src2++; *dest++ = *src1++ + *src2++; - *dest++ = *src1++ + *src2++; *dest++ = *src1++ + *src2++; - *dest++ = *src1++ + *src2++; *dest++ = *src1++ + *src2++; -*/ - } + if (fb) free(fb); } static INLINE void imdct(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len) @@ -168,16 +99,16 @@ static INLINE void imdct(fb_info *fb, real_t *in_data, real_t *out_data, uint16_ { case 2048: case 1920: - mdct = &(fb->mdct2048); + mdct = fb->mdct2048; break; case 256: case 240: - mdct = &(fb->mdct256); + mdct = fb->mdct256; break; #ifdef LD_DEC case 1024: case 960: - mdct = &(fb->mdct1024); + mdct = fb->mdct1024; break; #endif } @@ -194,16 +125,16 @@ static INLINE void mdct(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t { case 2048: case 1920: - mdct = &(fb->mdct2048); + mdct = fb->mdct2048; break; case 256: - case 120: - mdct = &(fb->mdct256); + case 240: + mdct = fb->mdct256; break; #ifdef LD_DEC case 1024: case 960: - mdct = &(fb->mdct1024); + mdct = fb->mdct1024; break; #endif } @@ -213,26 +144,24 @@ static INLINE void mdct(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t #endif void 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_buff, + uint8_t window_shape_prev, real_t *freq_in, real_t *time_out, uint8_t object_type, uint16_t frame_len) { - real_t *o_buf, *transf_buf; - real_t *obuf_temp; + 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; - real_t *window_short_prev_ptr; - real_t *fp; - int8_t win; 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 = malloc(2*nlong*sizeof(real_t)); + transf_buf = (real_t*)malloc(2*nlong*sizeof(real_t)); #ifdef LD_DEC if (object_type == LD) @@ -249,136 +178,96 @@ void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, } #endif - /* pointer to previous window function */ - window_short_prev_ptr = window_short_prev; - - vcopy(time_buff, time_out, nlong); - o_buf = time_out; - switch (window_sequence) { case ONLY_LONG_SEQUENCE: - /* inverse transform */ imdct(fb, freq_in, transf_buf, 2*nlong); - - /* window function (previous) on first half of the new data */ - vmult1(transf_buf, window_long_prev, transf_buf, nlong); - - /* overlap and add second half of the old data with first half - of the new data */ - vadd(transf_buf, o_buf, o_buf, nlong); - - /* reversed window function on second half of the new data */ - vmult2(transf_buf+nlong, window_long+nlong-1, o_buf+nlong, nlong); + for (i = nlong-1; i >= 0; i--) + { + time_out[i] = time_out[nlong+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: - /* inverse transform */ imdct(fb, freq_in, transf_buf, 2*nlong); - - /* window function (previous) on first half of the new data */ - vmult1(transf_buf, window_long_prev, transf_buf, nlong); - - /* overlap and add second half of the old data with first half - of the new data */ - vadd(transf_buf, o_buf, o_buf, nlong); - - /* copy data from nlong upto (3*nlong-nshort)/4; (window function = 1.0) */ - vcopy(transf_buf+nlong, o_buf+nlong, nflat_ls); - - /* reversed window function on part of second half of the new data */ - vmult2(transf_buf+nlong+nflat_ls, window_short+nshort-1, - o_buf+nlong+nflat_ls, nshort); - - /* zero rest of the data; (window function = 0.0) */ - vzero(o_buf+2*nlong-1, nflat_ls); + for (i = 0; i < nlong; i++) + time_out[i] = time_out[nlong+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: - obuf_temp = malloc(2*nlong*sizeof(real_t)); - vzero(obuf_temp+2*nlong-1, 2*nlong); - - fp = obuf_temp; - vcopy(time_buff+nflat_ls, fp, nshort); - - for (win = 8-1; win >= 0; --win) + imdct(fb, freq_in+0*nshort, transf_buf+2*nshort*0, 2*nshort); + imdct(fb, freq_in+1*nshort, transf_buf+2*nshort*1, 2*nshort); + imdct(fb, freq_in+2*nshort, transf_buf+2*nshort*2, 2*nshort); + imdct(fb, freq_in+3*nshort, transf_buf+2*nshort*3, 2*nshort); + imdct(fb, freq_in+4*nshort, transf_buf+2*nshort*4, 2*nshort); + imdct(fb, freq_in+5*nshort, transf_buf+2*nshort*5, 2*nshort); + imdct(fb, freq_in+6*nshort, transf_buf+2*nshort*6, 2*nshort); + imdct(fb, freq_in+7*nshort, transf_buf+2*nshort*7, 2*nshort); + for (i = 0; i < nflat_ls; i++) + time_out[i] = time_out[nlong+i]; + for(i = nshort-1; i >= 0; i--) { - /* inverse transform */ - imdct(fb, freq_in, transf_buf, 2*nshort); - - /* window function (previous) on first half of the new data */ - vmult1(transf_buf, window_short_prev_ptr, transf_buf, nshort); - - /* overlap and add second half of the old data with first half - of the new data */ - vadd(transf_buf, fp, fp, nshort); - - /* reversed window function on second half of the new data */ - vmult2(transf_buf+nshort, window_short+nshort-1, fp+nshort, nshort); - - /* shift to next short block */ - freq_in += nshort; - fp += nshort; - window_short_prev_ptr = window_short; + time_out[nflat_ls+ i] = time_out[nlong+nflat_ls+ i] + MUL_R_C(transf_buf[nshort*0+i],window_short_prev[i]); + time_out[nflat_ls+1*nshort+i] = time_out[nlong+nflat_ls+nshort*1+i] + MUL_R_C(transf_buf[nshort*1+i],window_short[nshort-1-i]) + MUL_R_C(transf_buf[nshort*2+i],window_short[i]); + time_out[nflat_ls+2*nshort+i] = time_out[nlong+nflat_ls+nshort*2+i] + MUL_R_C(transf_buf[nshort*3+i],window_short[nshort-1-i]) + MUL_R_C(transf_buf[nshort*4+i],window_short[i]); + time_out[nflat_ls+3*nshort+i] = time_out[nlong+nflat_ls+nshort*3+i] + MUL_R_C(transf_buf[nshort*5+i],window_short[nshort-1-i]) + MUL_R_C(transf_buf[nshort*6+i],window_short[i]); + if (i < trans) + time_out[nflat_ls+4*nshort+i] = time_out[nlong+nflat_ls+nshort*4+i] + MUL_R_C(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_R_C(transf_buf[nshort*8+i],window_short[i]); + else + time_out[nflat_ls+4*nshort+i] = MUL_R_C(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_R_C(transf_buf[nshort*8+i],window_short[i]); + time_out[nflat_ls+5*nshort+i] = MUL_R_C(transf_buf[nshort*9+i],window_short[nshort-1-i]) + MUL_R_C(transf_buf[nshort*10+i],window_short[i]); + time_out[nflat_ls+6*nshort+i] = MUL_R_C(transf_buf[nshort*11+i],window_short[nshort-1-i]) + MUL_R_C(transf_buf[nshort*12+i],window_short[i]); + time_out[nflat_ls+7*nshort+i] = MUL_R_C(transf_buf[nshort*13+i],window_short[nshort-1-i]) + MUL_R_C(transf_buf[nshort*14+i],window_short[i]); + time_out[nflat_ls+8*nshort+i] = MUL_R_C(transf_buf[nshort*15+i],window_short[nshort-1-i]); } - - vcopy(obuf_temp, o_buf + nflat_ls, nlong*2-nflat_ls); - vzero(o_buf+2*nlong-1, nflat_ls); - - free(obuf_temp); + for (i = 0; i < nflat_ls; i++) + time_out[nlong+nflat_ls+nshort+i] = 0; break; case LONG_STOP_SEQUENCE: - /* inverse transform */ imdct(fb, freq_in, transf_buf, 2*nlong); - - /* zero first part of first half of the data (window function = 0.0) */ - vzero(transf_buf+nflat_ls-1, nflat_ls); - - /* window function (previous) on part of the first half of - the new data */ - vmult1(transf_buf+nflat_ls, window_short_prev_ptr, - transf_buf+nflat_ls, nshort); - - /* third part of the stop sequence window is window function = 1, - so no need to actually apply that */ - - /* overlap and add second half of the old data with first half - of the new data */ - vadd(transf_buf, o_buf, o_buf, nlong); - - /* reversed window function on second half of the new data */ - vmult2(transf_buf+nlong, window_long+nlong-1, o_buf+nlong, nlong); + for (i = 0; i < nflat_ls; i++) + time_out[i] = time_out[nlong+i]; + for (i = 0; i < nshort; i++) + time_out[nflat_ls+i] = time_out[nlong+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] = time_out[nlong+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; } - /* save second half of data */ - vcopy(o_buf+nlong, time_buff, nlong); - free(transf_buf); } #ifdef LTP_DEC -/* only works for LTP -> no overlapping */ +/* only works for LTP -> no overlapping, no short blocks */ void filter_bank_ltp(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, uint8_t window_shape_prev, real_t *in_data, real_t *out_mdct, uint8_t object_type, uint16_t frame_len) { - int8_t win; + int16_t i; real_t *windowed_buf; - real_t *p_o_buf; real_t *window_long; real_t *window_long_prev; real_t *window_short; real_t *window_short_prev; - real_t *window_short_prev_ptr; uint16_t nlong = frame_len; uint16_t nshort = frame_len/8; uint16_t nflat_ls = (nlong-nshort)/2; - windowed_buf = malloc(nlong*2*sizeof(real_t)); + assert(window_sequence != EIGHT_SHORT_SEQUENCE); + + windowed_buf = (real_t*)malloc(nlong*2*sizeof(real_t)); #ifdef LD_DEC if (object_type == LD) @@ -395,44 +284,38 @@ void filter_bank_ltp(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, } #endif - window_short_prev_ptr = window_short_prev; - - p_o_buf = in_data; - switch(window_sequence) { case ONLY_LONG_SEQUENCE: - vmult1(p_o_buf, window_long_prev, windowed_buf, nlong); - vmult2(p_o_buf+nlong, window_long+nlong-1, windowed_buf+nlong, nlong); + for (i = nlong-1; i >= 0; i--) + { + windowed_buf[i] = MUL_R_C(in_data[i], window_long_prev[i]); + windowed_buf[i+nlong] = MUL_R_C(in_data[i+nlong], window_long[nlong-1-i]); + } mdct(fb, windowed_buf, out_mdct, 2*nlong); break; case LONG_START_SEQUENCE: - vmult1(p_o_buf, window_long_prev, windowed_buf, nlong); - vcopy(p_o_buf+nlong, windowed_buf+nlong, nflat_ls); - vmult2(p_o_buf+nlong+nflat_ls, window_short+nshort-1, windowed_buf+nlong+nflat_ls, nshort); - vzero(windowed_buf+2*nlong-1, nflat_ls); + for (i = 0; i < nlong; i++) + windowed_buf[i] = MUL_R_C(in_data[i], window_long_prev[i]); + for (i = 0; i < nflat_ls; i++) + windowed_buf[i+nlong] = in_data[i+nlong]; + for (i = 0; i < nshort; i++) + windowed_buf[i+nlong+nflat_ls] = MUL_R_C(in_data[i+nlong+nflat_ls], window_short[nshort-1-i]); + for (i = 0; i < nflat_ls; i++) + windowed_buf[i+nlong+nflat_ls+nshort] = 0; mdct(fb, windowed_buf, out_mdct, 2*nlong); break; - case EIGHT_SHORT_SEQUENCE: - for (win = 8-1; win >= 0; --win) - { - vmult1(p_o_buf, window_short_prev_ptr, windowed_buf, nshort); - vmult2(p_o_buf+nshort, window_short+nshort-1, windowed_buf+nshort, nshort); - mdct(fb, windowed_buf, out_mdct, 2*nshort); - - out_mdct += nshort; - p_o_buf += 2*nshort; - window_short_prev_ptr = window_short; - } - break; - case LONG_STOP_SEQUENCE: - vzero(windowed_buf+nflat_ls-1, nflat_ls); - vmult1(p_o_buf+nflat_ls, window_short_prev_ptr, windowed_buf+nflat_ls, nshort); - vcopy(p_o_buf+nflat_ls+nshort, windowed_buf+nflat_ls+nshort, nflat_ls); - vmult2(p_o_buf+nlong, window_long+nlong-1, windowed_buf+nlong, nlong); + for (i = 0; i < nflat_ls; i++) + windowed_buf[i] = 0; + for (i = 0; i < nshort; i++) + windowed_buf[i+nflat_ls] = MUL_R_C(in_data[i+nflat_ls], window_short_prev[i]); + for (i = 0; i < nflat_ls; i++) + windowed_buf[i+nflat_ls+nshort] = in_data[i+nflat_ls+nshort]; + for (i = 0; i < nlong; i++) + windowed_buf[i+nlong] = MUL_R_C(in_data[i+nlong], window_long[nlong-1-i]); mdct(fb, windowed_buf, out_mdct, 2*nlong); break; } diff --git a/src/libfaad/filtbank.h b/src/libfaad/filtbank.h index e84e729e0..96025d55b 100644 --- a/src/libfaad/filtbank.h +++ b/src/libfaad/filtbank.h @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: filtbank.h,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: filtbank.h,v 1.2 2002/12/16 19:00:04 miguelfreitas Exp $ **/ #ifndef __FILTBANK_H__ @@ -28,23 +28,7 @@ extern "C" { #include "mdct.h" - -typedef struct -{ - real_t *long_window[2]; - real_t *short_window[2]; -#ifdef LD_DEC - real_t *ld_window[2]; -#endif - - mdct_info mdct256; -#ifdef LD_DEC - mdct_info mdct1024; -#endif - mdct_info mdct2048; -} fb_info; - -void filter_bank_init(fb_info *fb, uint16_t frame_len); +fb_info *filter_bank_init(uint16_t frame_len); void filter_bank_end(fb_info *fb); #ifdef LTP_DEC @@ -63,7 +47,6 @@ void ifilter_bank(fb_info *fb, uint8_t window_shape, uint8_t window_shape_prev, real_t *freq_in, - real_t *time_buff, real_t *time_out, uint8_t object_type, uint16_t frame_len); diff --git a/src/libfaad/fixed.h b/src/libfaad/fixed.h new file mode 100644 index 000000000..ae5e5cc4a --- /dev/null +++ b/src/libfaad/fixed.h @@ -0,0 +1,89 @@ +/* +** FAAD - Freeware Advanced Audio Decoder +** Copyright (C) 2002 M. Bakker +** +** 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. +** +** $Id: fixed.h,v 1.1 2002/12/16 19:00:06 miguelfreitas Exp $ +**/ + +#ifndef __FIXED_H__ +#define __FIXED_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#define COEF_BITS 28 +#define COEF_PRECISION (1 << COEF_BITS) +#define REAL_BITS 7 +#define REAL_PRECISION (1 << REAL_BITS) + + +typedef int32_t real_t; + + +#define REAL_CONST(A) ((real_t)(A*(REAL_PRECISION))) +#define COEF_CONST(A) ((real_t)(A*(COEF_PRECISION))) + +#if defined(_WIN32) && !defined(_WIN32_WCE) + +/* multiply real with real */ +static INLINE MUL(real_t A, real_t B) +{ + _asm { + mov eax,A + imul B + shrd eax,edx,REAL_BITS + } +} + +/* multiply coef with coef */ +static INLINE MUL_C_C(real_t A, real_t B) +{ + _asm { + mov eax,A + imul B + shrd eax,edx,COEF_BITS + } +} + +/* multiply real with coef */ +static INLINE MUL_R_C(real_t A, real_t B) +{ + _asm { + mov eax,A + imul B + shrd eax,edx,COEF_BITS + } +} + +#else + + /* multiply real with real */ + #define MUL(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (REAL_BITS-1))) >> REAL_BITS) + /* multiply coef with coef */ + #define MUL_C_C(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (COEF_BITS-1))) >> COEF_BITS) + /* multiply real with coef */ + #define MUL_R_C(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (COEF_BITS-1))) >> COEF_BITS) + +#endif + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/libfaad/hcr.c b/src/libfaad/hcr.c new file mode 100644 index 000000000..d5652aa18 --- /dev/null +++ b/src/libfaad/hcr.c @@ -0,0 +1,644 @@ +/* +** FAAD - Freeware Advanced Audio Decoder +** Copyright (C) 2002 A. Kurpiers +** +** 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. +** +** $Id: hcr.c,v 1.1 2002/12/16 19:00:10 miguelfreitas Exp $ +**/ + +#include "common.h" +#include "structs.h" + +#include <stdlib.h> +#include <string.h> + +#include "syntax.h" +#include "specrec.h" +#include "bits.h" +#include "data.h" +#include "pulse.h" +#include "analysis.h" +#include "bits.h" +#include "codebook/hcb.h" + +/* Implements the HCR11 tool as described in ISO/IEC 14496-3/Amd.1, 8.5.3.3 */ + +#ifdef ERROR_RESILIENCE + +//FIXME these tables are not needed twice actually + +static hcb *hcb_table[] = { + 0, hcb1_1, hcb2_1, 0, hcb4_1, 0, hcb6_1, 0, hcb8_1, 0, hcb10_1, hcb11_1 +}; + +static hcb_2_quad *hcb_2_quad_table[] = { + 0, hcb1_2, hcb2_2, 0, hcb4_2, 0, 0, 0, 0, 0, 0, 0 +}; + +static hcb_2_pair *hcb_2_pair_table[] = { + 0, 0, 0, 0, 0, 0, hcb6_2, 0, hcb8_2, 0, hcb10_2, hcb11_2 +}; + +static hcb_bin_pair *hcb_bin_table[] = { + 0, 0, 0, 0, 0, hcb5, 0, hcb7, 0, hcb9, 0, 0 +}; + +static uint8_t hcbN[] = { 0, 5, 5, 0, 5, 0, 5, 0, 5, 0, 6, 5 }; + + +/* defines whether a huffman codebook is unsigned or not */ +/* Table 4.6.2 */ +static uint8_t unsigned_cb[] = { 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, + /* codebook 16 to 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 +}; +typedef struct +{ + /* bit input */ + uint32_t bufa; + uint32_t bufb; + int8_t len; +} bits_t; + + +static INLINE uint32_t showbits(bits_t *ld, uint8_t bits) +{ + if (bits == 0) return 0; + if (ld->len <= 32){ + /* huffman_spectral_data_2 needs to read more than may be available, bits maybe + > ld->len, deliver 0 than */ + if (ld->len >= bits) + return ((ld->bufa >> (ld->len - bits)) & (0xFFFFFFFF >> (32 - bits))); + else + return ((ld->bufa << (bits - ld->len)) & (0xFFFFFFFF >> (32 - bits))); + } else { + if ((ld->len - bits) < 32) + { + return ( (ld->bufb & (0xFFFFFFFF >> (64 - ld->len))) << (bits - ld->len + 32)) | + (ld->bufa >> (ld->len - bits)); + } else { + return ((ld->bufb >> (ld->len - bits - 32)) & (0xFFFFFFFF >> (32 - bits))); + } + } +} + +/* return 1 if position is outside of buffer, 0 otherwise */ +static INLINE int8_t flushbits( bits_t *ld, uint8_t bits) +{ + ld->len -= bits; + + if (ld->len <0) + { + ld->len = 0; + return 1; + } else { + return 0; + } +} + + +static INLINE int8_t getbits(bits_t *ld, uint8_t n, uint32_t *result) +{ + *result = showbits(ld, n); + return flushbits(ld, n); +} + +static INLINE int8_t get1bit(bits_t *ld, uint8_t *result) +{ + uint32_t res; + int8_t ret; + + ret = getbits(ld, 1, &res); + *result = res & 1; + return ret; +} + +/* Special version of huffman_spectral_data adapted from huffman.h +Will not read from a bitfile but a bits_t structure. +Will keep track of the bits decoded and return the number of bits remaining. +Do not read more than ld->len, return -1 if codeword would be longer */ + +static int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp ) +{ + uint32_t cw; + uint16_t offset = 0; + uint8_t extra_bits; + uint8_t i; + uint8_t save_cb = cb; + + + switch (cb) + { + case 1: /* 2-step method for data quadruples */ + case 2: + case 4: + + cw = showbits(ld, hcbN[cb]); + offset = hcb_table[cb][cw].offset; + extra_bits = hcb_table[cb][cw].extra_bits; + + if (extra_bits) + { + /* we know for sure it's more than hcbN[cb] bits long */ + if ( flushbits(ld, hcbN[cb]) ) return -1; + offset += (uint16_t)showbits(ld, extra_bits); + if ( flushbits(ld, hcb_2_quad_table[cb][offset].bits - hcbN[cb]) ) return -1; + } else { + if ( flushbits(ld, hcb_2_quad_table[cb][offset].bits) ) return -1; + } + + sp[0] = hcb_2_quad_table[cb][offset].x; + sp[1] = hcb_2_quad_table[cb][offset].y; + sp[2] = hcb_2_quad_table[cb][offset].v; + sp[3] = hcb_2_quad_table[cb][offset].w; + break; + + case 6: /* 2-step method for data pairs */ + case 8: + case 10: + case 11: + /* VCB11 uses codebook 11 */ + case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: + case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31: + + /* TODO: If ER is used, some extra error checking should be done */ + if (cb >= 16) + cb = 11; + + cw = showbits(ld, hcbN[cb]); + offset = hcb_table[cb][cw].offset; + extra_bits = hcb_table[cb][cw].extra_bits; + + if (extra_bits) + { + /* we know for sure it's more than hcbN[cb] bits long */ + if ( flushbits(ld, hcbN[cb]) ) return -1; + offset += (uint16_t)showbits(ld, extra_bits); + if ( flushbits(ld, hcb_2_pair_table[cb][offset].bits - hcbN[cb]) ) return -1; + } else { + if ( flushbits(ld, hcb_2_pair_table[cb][offset].bits) ) return -1; + } + sp[0] = hcb_2_pair_table[cb][offset].x; + sp[1] = hcb_2_pair_table[cb][offset].y; + break; + + case 3: /* binary search for data quadruples */ + + while (!hcb3[offset].is_leaf) + { + uint8_t b; + + if ( get1bit(ld, &b) ) return -1; + offset += hcb3[offset].data[b]; + } + + sp[0] = hcb3[offset].data[0]; + sp[1] = hcb3[offset].data[1]; + sp[2] = hcb3[offset].data[2]; + sp[3] = hcb3[offset].data[3]; + + break; + + case 5: /* binary search for data pairs */ + case 7: + case 9: + + while (!hcb_bin_table[cb][offset].is_leaf) + { + uint8_t b; + + if (get1bit(ld, &b) ) return -1; + offset += hcb_bin_table[cb][offset].data[b]; + } + + sp[0] = hcb_bin_table[cb][offset].data[0]; + sp[1] = hcb_bin_table[cb][offset].data[1]; + + break; + } + + /* decode sign bits */ + if (unsigned_cb[cb]) { + + for(i = 0; i < ((cb < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN); i++) + { + if(sp[i]) + { + uint8_t b; + if ( get1bit(ld, &b) ) return -1; + if (b != 0) { + sp[i] = -sp[i]; + } + } + } + } + + /* decode huffman escape bits */ + if ((cb == ESC_HCB) || (cb >= 16)) + { + uint8_t k; + for (k = 0; k < 2; k++) + { + if ((sp[k] == 16) || (sp[k] == -16)) + { + uint8_t neg, i; + int32_t j; + uint32_t off; + + neg = (sp[k] < 0) ? 1 : 0; + + for (i = 4; ; i++) + { + uint8_t b; + if (get1bit(ld, &b)) + return -1; + if (b == 0) + break; + } +// TODO: here we would need to test "off" if VCB11 is used! + if (getbits(ld, i, &off)) + return -1; + j = off + (1<<i); + sp[k] = neg ? -j : j; + } + } + } + return ld->len; +} + +/* rewind len (max. 32) bits so that the MSB becomes LSB */ + +static uint32_t rewind_word( uint32_t W, uint8_t len) +{ + uint8_t i; + uint32_t tmp_W=0; + + for ( i=0; i<len; i++ ) + { + tmp_W<<=1; + if (W & (1<<i)) tmp_W |= 1; + } + return tmp_W; +} + +static void rewind_lword( uint32_t *highW, uint32_t *lowW, uint8_t len) +{ + uint32_t tmp_lW=0; + + if (len > 32) + { + tmp_lW = rewind_word( (*highW << (64-len)) | (*lowW >> (len-32)), 32); + *highW = rewind_word( *lowW << (64-len) , 32); + *lowW = tmp_lW; + } else { + *highW = 0; + *lowW = rewind_word( *lowW, len); + } +} + +/* Takes a codeword as stored in r, rewinds the remaining bits and stores it back */ +static void rewind_bits(bits_t * r) +{ + uint32_t hw, lw; + + if (r->len == 0) return; + + if (r->len >32) + { + lw = r->bufa; + hw = r->bufb & (0xFFFFFFFF >> (64 - r->len)); + rewind_lword( &hw, &lw, r->len ); + r->bufa = lw; + r->bufb = hw; + + } else { + lw = showbits(r, r->len ); + r->bufa = rewind_word( lw, r->len); + r->bufb = 0; + } +} + +/* takes codewords from a and b, concatenate them and store them in b */ +static void concat_bits( bits_t * a, bits_t * b) +{ + uint32_t hwa, lwa, hwb, lwb; + + if (a->len == 0) return; + + if (a->len >32) + { + lwa = a->bufa; + hwa = a->bufb & (0xFFFFFFFF >> (64 - a->len)); + } else { + lwa = showbits(a, a->len ); + hwa = 0; + } + if (b->len >=32) { + lwb = b->bufa; + hwb = (b->bufb & (0xFFFFFFFF >> (64 - b->len)) ) | ( lwa << (b->len - 32)); + } else { + lwb = showbits(b, b->len ) | (lwa << (b->len)); + hwb = (lwa >> (32 - b->len)) | (hwa << (b->len)); + } + + b->bufa = lwb; + b->bufb = hwb; + b->len += a->len; +} + +/* 8.5.3.3.1 */ + +static const uint8_t PresortedCodebook_VCB11[] = { 11, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 9, 7, 5, 3, 1}; +static const uint8_t PresortedCodebook[] = { 11, 9, 7, 5, 3, 1}; + +static const uint8_t maxCwLen[32] = {0, 11, 9, 20, 16, 13, 11, 14, 12, 17, 14, 49, + 0, 0, 0, 0, 14, 17, 21, 21, 25, 25, 29, 29, 29, 29, 33, 33, 33, 37, 37, 41}; + +typedef struct +{ + bits_t bits; + uint8_t decoded; + uint16_t sp_offset; + uint8_t cb; +} codeword_state; + + +#define segmentWidth( codebook ) min( maxCwLen[codebook], ics->length_of_longest_codeword ) + +uint8_t reordered_spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld, + int16_t *spectral_data) +{ + uint16_t sp_offset[8]; + uint16_t g,i, presort; + uint16_t NrCodeWords=0, numberOfSegments=0, BitsRead=0; + uint8_t numberOfSets, set; + codeword_state Codewords[ 1024 ]; // FIXME max length? PCWs are not stored, so index is Codewordnr - numberOfSegments!, maybe malloc()? + bits_t Segment[ 512 ]; + + uint8_t PCW_decoded=0; + uint16_t segment_index=0, codeword_index=0; + uint16_t nshort = hDecoder->frameLength/8; + + + memset (spectral_data, 0, hDecoder->frameLength*sizeof(uint16_t)); + + if (ics->length_of_reordered_spectral_data == 0) + return 0; /* nothing to do */ + + /* if we have a corrupted bitstream this can happen... */ + if ((ics->length_of_longest_codeword == 0) || + (ics->length_of_reordered_spectral_data < + ics->length_of_longest_codeword) || + (ics->max_sfb == 0)) + { + return 10; /* this is not good... */ + } + + /* store the offset into the spectral data for all the window groups because we can't do it later */ + + sp_offset[0] = 0; + for (g=1; g < ics->num_window_groups; g++) + { + sp_offset[g] = sp_offset[g-1] + nshort*ics->window_group_length[g-1]; + } + + /* All data is sorted according to the codebook used */ + for (presort = 0; presort < (hDecoder->aacSectionDataResilienceFlag ? 22 : 6); presort++) + { + uint8_t sfb; + + /* next codebook that has to be processed according to presorting */ + uint8_t nextCB = hDecoder->aacSectionDataResilienceFlag ? PresortedCodebook_VCB11[ presort ] : PresortedCodebook[ presort ]; + + /* Data belonging to the same spectral unit and having the same codebook comes in consecutive codewords. + This is done by scanning all sfbs for possible codewords. For sfbs with more than 4 elements this has to be + repeated */ + + for (sfb=0; sfb<ics->max_sfb; sfb ++) + { + uint8_t sect_cb, w; + + for (w=0; w< (ics->swb_offset[sfb+1] - ics->swb_offset[sfb]); w+=4) + { + for(g = 0; g < ics->num_window_groups; g++) + { + for (i = 0; i < ics->num_sec[g]; i++) + { + sect_cb = ics->sect_cb[g][i]; + + if ( + /* process only sections that are due now */ + (( sect_cb == nextCB ) || (( nextCB < ESC_HCB ) && ( sect_cb == nextCB+1)) ) && + + /* process only sfb's that are due now */ + ((ics->sect_start[g][i] <= sfb) && (ics->sect_end[g][i] > sfb)) + ) + { + if ((sect_cb != ZERO_HCB) && + (sect_cb != NOISE_HCB) && + (sect_cb != INTENSITY_HCB) && + (sect_cb != INTENSITY_HCB2)) + { + uint8_t inc = (sect_cb < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN; + uint16_t k; + + uint32_t hw, lw; + + for (k=0; (k < (4/inc)*ics->window_group_length[g]) && + ( (k+w*ics->window_group_length[g]/inc) < (ics->sect_sfb_offset[g][sfb+1] - ics->sect_sfb_offset[g][sfb])); k++) + { + uint16_t sp = sp_offset[g] + ics->sect_sfb_offset[g][sfb] + inc*(k+w*ics->window_group_length[g]/inc); + + if (!PCW_decoded) + { + /* if we haven't yet read until the end of the buffer, we can directly decode the so-called PCWs */ + if ((BitsRead + segmentWidth( sect_cb ))<= ics->length_of_reordered_spectral_data) + { + Segment[ numberOfSegments ].len = segmentWidth( sect_cb ); + + if (segmentWidth( sect_cb ) > 32) + { + Segment[ numberOfSegments ].bufb = faad_showbits(ld, segmentWidth( sect_cb ) - 32); + faad_flushbits(ld, segmentWidth( sect_cb) - 32); + Segment[ numberOfSegments ].bufa = faad_showbits(ld, 32), + faad_flushbits(ld, 32 ); + + } else { + Segment[ numberOfSegments ].bufa = faad_showbits(ld, segmentWidth( sect_cb )); + Segment[ numberOfSegments ].bufb = 0; + faad_flushbits(ld, segmentWidth( sect_cb) ); + } + + huffman_spectral_data_2(sect_cb, &Segment[ numberOfSegments ], &spectral_data[sp]); + + BitsRead += segmentWidth( sect_cb ); + + /* skip to next segment, but store left bits in new buffer */ + rewind_bits( &Segment[ numberOfSegments ]); + + numberOfSegments++; + } else { + + /* the last segment is extended until length_of_reordered_spectral_data */ + + if (BitsRead < ics->length_of_reordered_spectral_data) + { + + uint8_t additional_bits = (ics->length_of_reordered_spectral_data - BitsRead); + + if ( additional_bits > 32) + { + hw = faad_showbits(ld, additional_bits - 32); + faad_flushbits(ld, additional_bits - 32); + lw = faad_showbits(ld, 32); + faad_flushbits(ld, 32 ); + } else { + lw = faad_showbits(ld, additional_bits); + hw = 0; + faad_flushbits(ld, additional_bits ); + } + rewind_lword( &hw, &lw, additional_bits + Segment[ numberOfSegments-1 ].len ); + if (Segment[ numberOfSegments-1 ].len > 32) + { + Segment[ numberOfSegments-1 ].bufb = hw + + showbits(&Segment[ numberOfSegments-1 ], Segment[ numberOfSegments-1 ].len - 32); + Segment[ numberOfSegments-1 ].bufa = lw + + showbits(&Segment[ numberOfSegments-1 ], 32); + } else { + Segment[ numberOfSegments-1 ].bufa = lw + + showbits(&Segment[ numberOfSegments-1 ], Segment[ numberOfSegments-1 ].len); + Segment[ numberOfSegments-1 ].bufb = hw; + } + Segment[ numberOfSegments-1 ].len += additional_bits; + } + BitsRead = ics->length_of_reordered_spectral_data; + PCW_decoded = 1; + + Codewords[ 0 ].sp_offset = sp; + Codewords[ 0 ].cb = sect_cb; + Codewords[ 0 ].decoded = 0; + Codewords[ 0 ].bits.len = 0; + } + } else { + Codewords[ NrCodeWords - numberOfSegments ].sp_offset = sp; + Codewords[ NrCodeWords - numberOfSegments ].cb = sect_cb; + Codewords[ NrCodeWords - numberOfSegments ].decoded = 0; + Codewords[ NrCodeWords - numberOfSegments ].bits.len = 0; + + } /* PCW decoded */ + NrCodeWords++; + } /* of k */ + } + } + } /* of i */ + } /* of g */ + } /* of w */ + } /* of sfb */ + } /* of presort */ + + numberOfSets = NrCodeWords / numberOfSegments; + + /* second step: decode nonPCWs */ + + for (set = 1; set <= numberOfSets; set++) + { + uint16_t trial; + + for (trial = 0; trial < numberOfSegments; trial++) + { + uint16_t codewordBase; + uint16_t set_decoded=numberOfSegments; + + if (set == numberOfSets) + set_decoded = NrCodeWords - set*numberOfSegments; /* last set is shorter than the rest */ + + for (codewordBase = 0; codewordBase < numberOfSegments; codewordBase++) + { + uint16_t segment_index = (trial + codewordBase) % numberOfSegments; + uint16_t codeword_index = codewordBase + set*numberOfSegments - numberOfSegments; + + if ((codeword_index + numberOfSegments) >= NrCodeWords) + break; + if (!Codewords[ codeword_index ].decoded) + { + if ( Segment[ segment_index ].len > 0) + { + uint8_t tmplen; + + if (Codewords[ codeword_index ].bits.len != 0) + { + /* on the first trial the data is only stored in Segment[], not in Codewords[]. + On next trials first collect the data stored for this codeword and + concatenate the new data from Segment[] */ + + concat_bits( &Codewords[ codeword_index ].bits, &Segment[ segment_index ]); + /* Now everthing is stored in Segment[] */ + } + tmplen = Segment[ segment_index ].len; + if ( huffman_spectral_data_2(Codewords[ codeword_index ].cb, &Segment[ segment_index ], + &spectral_data[ Codewords[ codeword_index ].sp_offset ]) >=0) + { + /* CW did fit into segment */ + + Codewords[ codeword_index ].decoded = 1; + set_decoded--; + } else { + + /* CW did not fit, so store for later use */ + + Codewords[ codeword_index ].bits.len = tmplen; + Codewords[ codeword_index ].bits.bufa = Segment[ segment_index ].bufa; + Codewords[ codeword_index ].bits.bufb = Segment[ segment_index ].bufb; + } + } + } + } /* of codewordBase */ + + if (set_decoded == 0) break; /* no undecoded codewords left in this set */ + + } /* of trial */ + + /* rewind all bits in remaining segments with len>0 */ + for (i=0; i < numberOfSegments; i++) + rewind_bits( &Segment[ i ] ); + } + +#if 0 + { + int i, r=0, c=0; + for (i=0; i< numberOfSegments; i++) + r += Segment[ i ].len; + if (r != 0) + { + printf("reordered_spectral_data: %d bits remaining!\n", r); + } + for (i=0; i< NrCodeWords - numberOfSegments; i++) + { + if (Codewords[ i ].decoded == 0) + { + c++; + } + } + if (c != 0) + { + printf("reordered_spectral_data: %d Undecoded Codewords remaining!\n",c ); + } + if ((r !=0) || (c!=0)) return 10; + } +#endif + + return 0; +} +#endif diff --git a/src/libfaad/huffman.h b/src/libfaad/huffman.h index b67e1eab0..3d56eae62 100644 --- a/src/libfaad/huffman.h +++ b/src/libfaad/huffman.h @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: huffman.h,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: huffman.h,v 1.2 2002/12/16 19:00:12 miguelfreitas Exp $ **/ #ifndef __HUFFMAN_H__ @@ -73,204 +73,258 @@ static hcb_bin_pair *hcb_bin_table[] = { static uint8_t hcbN[] = { 0, 5, 5, 0, 5, 0, 5, 0, 5, 0, 6, 5 }; +/* defines whether a huffman codebook is unsigned or not */ +/* Table 4.6.2 */ +static uint8_t unsigned_cb[] = { 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, + /* codebook 16 to 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 +}; + static int hcb_2_quad_table_size[] = { 0, 114, 86, 0, 185, 0, 0, 0, 0, 0, 0, 0 }; static int hcb_2_pair_table_size[] = { 0, 0, 0, 0, 0, 0, 126, 0, 83, 0, 210, 373 }; static int hcb_bin_table_size[] = { 0, 0, 0, 161, 0, 161, 0, 127, 0, 337, 0, 0 }; -static INLINE uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp) +static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len) { - uint32_t cw; - uint16_t offset = 0; - uint8_t extra_bits; + uint8_t i; - switch (cb) + for(i = 0; i < len; i++) { - case 1: /* 2-step method for data quadruples */ - case 2: - case 4: - - cw = faad_showbits(ld, hcbN[cb]); - offset = hcb_table[cb][cw].offset; - extra_bits = hcb_table[cb][cw].extra_bits; - - if (extra_bits) + if(sp[i]) { - /* we know for sure it's more than hcbN[cb] bits long */ - faad_flushbits(ld, hcbN[cb]); - offset += (uint16_t)faad_showbits(ld, extra_bits); - faad_flushbits(ld, hcb_2_quad_table[cb][offset].bits - hcbN[cb]); - } else { - faad_flushbits(ld, hcb_2_quad_table[cb][offset].bits); + if(faad_get1bit(ld + DEBUGVAR(1,5,"huffman_sign_bits(): sign bit")) & 1) + { + sp[i] = -sp[i]; + } } + } +} - if (offset > hcb_2_quad_table_size[cb]) +static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp) +{ + uint8_t neg, i; + int16_t j; + int32_t off; + + if (sp < 0) { + if(sp != -16) + return sp; + neg = 1; + } else { + if(sp != 16) + return sp; + neg = 0; + } + + for (i = 4; ; i++) + { + if (faad_get1bit(ld + DEBUGVAR(1,6,"huffman_getescape(): escape size")) == 0) { - /* printf("ERROR: offset into hcb_2_quad_table = %d >%d!\n", offset, - hcb_2_quad_table_size[cb]); */ - return 10; + break; } + } - sp[0] = hcb_2_quad_table[cb][offset].x; - sp[1] = hcb_2_quad_table[cb][offset].y; - sp[2] = hcb_2_quad_table[cb][offset].v; - sp[3] = hcb_2_quad_table[cb][offset].w; + off = faad_getbits(ld, i + DEBUGVAR(1,9,"huffman_getescape(): escape")); - return 0; + j = off + (1<<i); + if (neg) + j = -j; - case 6: /* 2-step method for data pairs */ - case 8: - case 10: - case 11: -#ifdef ERROR_RESILIENCE - /* VCB11 uses codebook 11 */ - case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: - case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31: + return j; +} - /* TODO: If ER is used, some extra error checking should be done */ - if (cb >= 16) - cb = 11; -#endif - cw = faad_showbits(ld, hcbN[cb]); - offset = hcb_table[cb][cw].offset; - extra_bits = hcb_table[cb][cw].extra_bits; +static uint8_t huffman_2step_quad(uint8_t cb, bitfile *ld, int16_t *sp) +{ + uint32_t cw; + uint16_t offset = 0; + uint8_t extra_bits; - if (extra_bits) - { - /* we know for sure it's more than hcbN[cb] bits long */ - faad_flushbits(ld, hcbN[cb]); - offset += (uint16_t)faad_showbits(ld, extra_bits); - faad_flushbits(ld, hcb_2_pair_table[cb][offset].bits - hcbN[cb]); - } else { - faad_flushbits(ld, hcb_2_pair_table[cb][offset].bits); - } + cw = faad_showbits(ld, hcbN[cb]); + offset = hcb_table[cb][cw].offset; + extra_bits = hcb_table[cb][cw].extra_bits; - if (offset > hcb_2_pair_table_size[cb]) - { - /* printf("ERROR: offset into hcb_2_pair_table = %d >%d!\n", offset, - hcb_2_pair_table_size[cb]); */ - return 10; - } + if (extra_bits) + { + /* we know for sure it's more than hcbN[cb] bits long */ + faad_flushbits(ld, hcbN[cb]); + offset += (uint16_t)faad_showbits(ld, extra_bits); + faad_flushbits(ld, hcb_2_quad_table[cb][offset].bits - hcbN[cb]); + } else { + faad_flushbits(ld, hcb_2_quad_table[cb][offset].bits); + } - sp[0] = hcb_2_pair_table[cb][offset].x; - sp[1] = hcb_2_pair_table[cb][offset].y; + if (offset > hcb_2_quad_table_size[cb]) + { + /* printf("ERROR: offset into hcb_2_quad_table = %d >%d!\n", offset, + hcb_2_quad_table_size[cb]); */ + return 10; + } - return 0; + sp[0] = hcb_2_quad_table[cb][offset].x; + sp[1] = hcb_2_quad_table[cb][offset].y; + sp[2] = hcb_2_quad_table[cb][offset].v; + sp[3] = hcb_2_quad_table[cb][offset].w; - case 3: /* binary search for data quadruples */ + return 0; +} - while (!hcb3[offset].is_leaf) - { - uint8_t b = faad_get1bit(ld - DEBUGVAR(1,255,"huffman_spectral_data():3")); - offset += hcb3[offset].data[b]; - } +static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp) +{ + uint8_t err = huffman_2step_quad(cb, ld, sp); + huffman_sign_bits(ld, sp, QUAD_LEN); - if (offset > hcb_bin_table_size[cb]) - { - /* printf("ERROR: offset into hcb_bin_table = %d >%d!\n", offset, - hcb_bin_table_size[cb]); */ - return 10; - } + return err; +} - sp[0] = hcb3[offset].data[0]; - sp[1] = hcb3[offset].data[1]; - sp[2] = hcb3[offset].data[2]; - sp[3] = hcb3[offset].data[3]; +static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp) +{ + uint32_t cw; + uint16_t offset = 0; + uint8_t extra_bits; - return 0; + cw = faad_showbits(ld, hcbN[cb]); + offset = hcb_table[cb][cw].offset; + extra_bits = hcb_table[cb][cw].extra_bits; - case 5: /* binary search for data pairs */ - case 7: - case 9: + if (extra_bits) + { + /* we know for sure it's more than hcbN[cb] bits long */ + faad_flushbits(ld, hcbN[cb]); + offset += (uint16_t)faad_showbits(ld, extra_bits); + faad_flushbits(ld, hcb_2_pair_table[cb][offset].bits - hcbN[cb]); + } else { + faad_flushbits(ld, hcb_2_pair_table[cb][offset].bits); + } - while (!hcb_bin_table[cb][offset].is_leaf) - { - uint8_t b = faad_get1bit(ld - DEBUGVAR(1,255,"huffman_spectral_data():9")); - offset += hcb_bin_table[cb][offset].data[b]; - } + if (offset > hcb_2_pair_table_size[cb]) + { + /* printf("ERROR: offset into hcb_2_pair_table = %d >%d!\n", offset, + hcb_2_pair_table_size[cb]); */ + return 10; + } - if (offset > hcb_bin_table_size[cb]) - { - /* printf("ERROR: offset into hcb_bin_table = %d >%d!\n", offset, - hcb_bin_table_size[cb]); */ - return 10; - } + sp[0] = hcb_2_pair_table[cb][offset].x; + sp[1] = hcb_2_pair_table[cb][offset].y; - sp[0] = hcb_bin_table[cb][offset].data[0]; - sp[1] = hcb_bin_table[cb][offset].data[1]; + return 0; +} - return 0; +static huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp) +{ + uint8_t err = huffman_2step_pair(cb, ld, sp); + huffman_sign_bits(ld, sp, PAIR_LEN); - default: - /* Non existent codebook number, something went wrong */ - return 11; + return err; +} + +static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp) +{ + uint16_t offset = 0; + + while (!hcb3[offset].is_leaf) + { + uint8_t b = faad_get1bit(ld + DEBUGVAR(1,255,"huffman_spectral_data():3")); + offset += hcb3[offset].data[b]; } + if (offset > hcb_bin_table_size[cb]) + { + /* printf("ERROR: offset into hcb_bin_table = %d >%d!\n", offset, + hcb_bin_table_size[cb]); */ + return 10; + } + + sp[0] = hcb3[offset].data[0]; + sp[1] = hcb3[offset].data[1]; + sp[2] = hcb3[offset].data[2]; + sp[3] = hcb3[offset].data[3]; + return 0; } -static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len) +static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp) { - uint8_t i; + uint8_t err = huffman_binary_quad(cb, ld, sp); + huffman_sign_bits(ld, sp, QUAD_LEN); - for(i = 0; i < len; i++) - { - if(sp[i]) - { - if(faad_get1bit(ld - DEBUGVAR(1,5,"huffman_sign_bits(): sign bit")) & 1) - { - sp[i] = -sp[i]; - } - } - } + return err; } -static INLINE int32_t huffman_getescape(bitfile *ld, int16_t sp) +static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp) { - uint8_t neg, i; - int32_t j, off; + uint16_t offset = 0; - if (sp < 0) { - if(sp != -16) - return sp; - neg = 1; - } else { - if(sp != 16) - return sp; - neg = 0; + while (!hcb_bin_table[cb][offset].is_leaf) + { + uint8_t b = faad_get1bit(ld + DEBUGVAR(1,255,"huffman_spectral_data():9")); + offset += hcb_bin_table[cb][offset].data[b]; } - for (i = 4; ; i++) + if (offset > hcb_bin_table_size[cb]) { - if (faad_get1bit(ld - DEBUGVAR(1,6,"huffman_getescape(): escape size")) == 0) - { - break; - } + /* printf("ERROR: offset into hcb_bin_table = %d >%d!\n", offset, + hcb_bin_table_size[cb]); */ + return 10; } -#if 0 - if (i > 16) + sp[0] = hcb_bin_table[cb][offset].data[0]; + sp[1] = hcb_bin_table[cb][offset].data[1]; + + return 0; +} + +static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp) +{ + uint8_t err = huffman_binary_pair(cb, ld, sp); + huffman_sign_bits(ld, sp, PAIR_LEN); + + return err; +} + +static INLINE uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp) +{ + switch (cb) { - off = faad_getbits(ld, i-16 - DEBUGVAR(1,7,"huffman_getescape(): escape, first part")) << 16; - off |= faad_getbits(ld, 16 - DEBUGVAR(1,8,"huffman_getescape(): escape, second part")); - } else { + case 1: /* 2-step method for data quadruples */ + case 2: + return huffman_2step_quad(cb, ld, sp); + case 3: /* binary search for data quadruples */ + return huffman_binary_quad_sign(cb, ld, sp); + case 4: /* 2-step method for data quadruples */ + return huffman_2step_quad_sign(cb, ld, sp); + case 5: /* binary search for data pairs */ + return huffman_binary_pair(cb, ld, sp); + case 6: /* 2-step method for data pairs */ + return huffman_2step_pair(cb, ld, sp); + case 7: /* binary search for data pairs */ + case 9: + return huffman_binary_pair_sign(cb, ld, sp); + case 8: /* 2-step method for data pairs */ + case 10: + return huffman_2step_pair_sign(cb, ld, sp); + case 11: +#ifdef ERROR_RESILIENCE + /* VCB11 uses codebook 11 */ + case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: + case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31: + /* TODO: If ER is used, some extra error checking should be done */ #endif - off = faad_getbits(ld, i - DEBUGVAR(1,9,"huffman_getescape(): escape")); -#if 0 + { + uint8_t err = huffman_2step_pair_sign(11, ld, sp); + sp[0] = huffman_getescape(ld, sp[0]); + sp[1] = huffman_getescape(ld, sp[1]); + return err; + } + default: + /* Non existent codebook number, something went wrong */ + return 11; } -#endif - - j = off + (1<<i); - if (neg) - j = -j; - return j; + return 0; } #ifdef __cplusplus diff --git a/src/libfaad/ic_predict.c b/src/libfaad/ic_predict.c index 28f5a2d0a..997b2c654 100644 --- a/src/libfaad/ic_predict.c +++ b/src/libfaad/ic_predict.c @@ -16,10 +16,11 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: ic_predict.c,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: ic_predict.c,v 1.2 2002/12/16 19:00:14 miguelfreitas Exp $ **/ #include "common.h" +#include "structs.h" #ifdef MAIN_DEC @@ -27,28 +28,6 @@ #include "ic_predict.h" #include "pns.h" -static void flt_round_inf(real_t *pf) -{ - int32_t flg; - uint32_t tmp; - real_t *pt = (real_t *)&tmp; - - *pt = *pf; - flg = tmp & (uint32_t)0x00008000; - tmp &= (uint32_t)0xffff0000; - *pf = *pt; - - /* round 1/2 lsb toward infinity */ - if (flg) - { - tmp &= (uint32_t)0xff800000; /* extract exponent and sign */ - tmp |= (uint32_t)0x00010000; /* insert 1 lsb */ - *pf += *pt; /* add 1 lsb and elided one */ - tmp &= (uint32_t)0xff800000; /* extract exponent and sign */ - *pf -= *pt; /* subtract elided one */ - } -} - static void ic_predict(pred_state *state, real_t input, real_t *output, uint8_t pred) { real_t dr1, predictedvalue; @@ -63,15 +42,20 @@ static void ic_predict(pred_state *state, real_t input, real_t *output, uint8_t KOR = state->KOR; /* correlations */ VAR = state->VAR; /* variances */ - k1 = KOR[0]/VAR[0]*B; + if (VAR[0] == 0) + k1 = 0; + else + k1 = KOR[0]/VAR[0]*B; if (pred) { /* only needed for the actual predicted value, k1 is always needed */ - k2 = KOR[1]/VAR[1]*B; + if (VAR[1] == 0) + k2 = 0; + else + k2 = KOR[1]/VAR[1]*B; predictedvalue = MUL(k1, r[0]) + MUL(k2, r[1]); - flt_round_inf(&predictedvalue); *output = input + predictedvalue; } else { @@ -82,11 +66,11 @@ static void ic_predict(pred_state *state, real_t input, real_t *output, uint8_t e0 = *output; e1 = e0 - MUL(k1, r[0]); - dr1 = k1 * e0; + dr1 = MUL(k1, e0); - VAR[0] = MUL(ALPHA, VAR[0]) + (0.5f) * (MUL(r[0], r[0]) + MUL(e0, e0)); + VAR[0] = MUL(ALPHA, VAR[0]) + MUL(REAL_CONST(0.5), (MUL(r[0], r[0]) + MUL(e0, e0))); KOR[0] = MUL(ALPHA, KOR[0]) + MUL(r[0], e0); - VAR[1] = MUL(ALPHA, VAR[1]) + (0.5f) * (MUL(r[1], r[1]) + MUL(e1, e1)); + VAR[1] = MUL(ALPHA, VAR[1]) + MUL(REAL_CONST(0.5), (MUL(r[1], r[1]) + MUL(e1, e1))); KOR[1] = MUL(ALPHA, KOR[1]) + MUL(r[1], e1); r[1] = MUL(A, (r[0]-dr1)); @@ -95,12 +79,12 @@ static void ic_predict(pred_state *state, real_t input, real_t *output, uint8_t static void reset_pred_state(pred_state *state) { - state->r[0] = 0.0f; - state->r[1] = 0.0f; - state->KOR[0] = 0.0f; - state->KOR[1] = 0.0f; - state->VAR[0] = 1.0f; - state->VAR[1] = 1.0f; + state->r[0] = 0; + state->r[1] = 0; + state->KOR[0] = 0; + state->KOR[1] = 0; + state->VAR[0] = REAL_CONST(1.0); + state->VAR[1] = REAL_CONST(1.0); } void pns_reset_pred_state(ic_stream *ics, pred_state *state) diff --git a/src/libfaad/ic_predict.h b/src/libfaad/ic_predict.h index 054615329..881e9fd98 100644 --- a/src/libfaad/ic_predict.h +++ b/src/libfaad/ic_predict.h @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: ic_predict.h,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: ic_predict.h,v 1.2 2002/12/16 19:00:20 miguelfreitas Exp $ **/ #ifdef MAIN_DEC @@ -28,17 +28,9 @@ extern "C" { #endif -#define ALPHA 0.90625f -#define A 0.953125f -#define B 0.953125f - - -/* used to save the state */ -typedef struct { - real_t r[2]; - real_t KOR[2]; - real_t VAR[2]; -} pred_state; +#define ALPHA REAL_CONST(0.90625) +#define A REAL_CONST(0.953125) +#define B REAL_CONST(0.953125) void pns_reset_pred_state(ic_stream *ics, pred_state *state); diff --git a/src/libfaad/iq_table.h b/src/libfaad/iq_table.h new file mode 100644 index 000000000..de78da88d --- /dev/null +++ b/src/libfaad/iq_table.h @@ -0,0 +1,2106 @@ +/* +** FAAD - Freeware Advanced Audio Decoder +** Copyright (C) 2002 M. Bakker +** +** 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. +** +** $Id: iq_table.h,v 1.1 2002/12/16 19:00:21 miguelfreitas Exp $ +**/ + +#ifndef IQ_TABLE_H__ +#define IQ_TABLE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* !!!DON'T CHANGE IQ_TABLE_SIZE!!! */ +#define IQ_TABLE_SIZE 1026 + +#ifndef FIXED_POINT + +#ifdef _MSC_VER +#pragma warning(disable:4305) +#pragma warning(disable:4244) +#endif + +static real_t iq_table[] = +{ + 0.0000000000, + 1.0000000000, + 2.5198420998, + 4.3267487109, + 6.3496042079, + 8.5498797334, + 10.9027235570, + 13.3905182794, + 16.0000000000, + 18.7207544075, + 21.5443469003, + 24.4637809963, + 27.4731418213, + 30.5673509404, + 33.7419916985, + 36.9931811150, + 40.3174735966, + 43.7117870412, + 47.1733450958, + 50.6996313257, + 54.2883523319, + 57.9374077040, + 61.6448652744, + 65.4089405366, + 69.2279793748, + 73.1004434553, + 77.0248977786, + 81.0000000000, + 85.0244912125, + 89.0971879449, + 93.2169751786, + 97.3828002241, + 101.5936673260, + 105.8486328899, + 110.1468012434, + 114.4873208566, + 118.8693809602, + 123.2922085109, + 127.7550654584, + 132.2572462776, + 136.7980757341, + 141.3769068557, + 145.9931190852, + 150.6461165966, + 155.3353267543, + 160.0601987021, + 164.8202020667, + 169.6148257665, + 174.4435769119, + 179.3059797911, + 184.2015749320, + 189.1299182326, + 194.0905801545, + 199.0831449737, + 204.1072100830, + 209.1623853419, + 214.2482924705, + 219.3645644828, + 224.5108451564, + 229.6867885365, + 234.8920584701, + 240.1263281692, + 245.3892798002, + 250.6806040975, + 256.0000000000, + 261.3471743083, + 266.7218413611, + 272.1237227299, + 277.5525469304, + 283.0080491495, + 288.4899709866, + 293.9980602090, + 299.5320705195, + 305.0917613358, + 310.6768975818, + 316.2872494882, + 321.9225924034, + 327.5827066139, + 333.2673771724, + 338.9763937351, + 344.7095504051, + 350.4666455847, + 356.2474818330, + 362.0518657308, + 367.8796077506, + 373.7305221334, + 379.6044267700, + 385.5011430873, + 391.4204959402, + 397.3623135070, + 403.3264271901, + 409.3126715201, + 415.3208840636, + 421.3509053358, + 427.4025787150, + 433.4757503618, + 439.5702691405, + 445.6859865441, + 451.8227566217, + 457.9804359091, + 464.1588833613, + 470.3579602882, + 476.5775302922, + 482.8174592083, + 489.0776150459, + 495.3578679332, + 501.6580900633, + 507.9781556420, + 514.3179408377, + 520.6773237328, + 527.0561842769, + 533.4544042413, + 539.8718671753, + 546.3084583636, + 552.7640647857, + 559.2385750758, + 565.7318794845, + 572.2438698415, + 578.7744395198, + 585.3234834006, + 591.8908978393, + 598.4765806331, + 605.0804309888, + 611.7023494920, + 618.3422380776, + 625.0000000000, + 631.6755398055, + 638.3687633048, + 645.0795775462, + 651.8078907899, + 658.5536124831, + 665.3166532354, + 672.0969247951, + 678.8943400262, + 685.7088128862, + 692.5402584041, + 699.3885926590, + 706.2537327602, + 713.1355968262, + 720.0341039659, + 726.9491742592, + 733.8807287386, + 740.8286893712, + 747.7929790411, + 754.7735215322, + 761.7702415115, + 768.7830645130, + 775.8119169219, + 782.8567259587, + 789.9174196648, + 796.9939268870, + 804.0861772639, + 811.1941012115, + 818.3176299096, + 825.4566952887, + 832.6112300164, + 839.7811674856, + 846.9664418012, + 854.1669877685, + 861.3827408814, + 868.6136373104, + 875.8596138918, + 883.1206081164, + 890.3965581189, + 897.6874026669, + 904.9930811514, + 912.3135335758, + 919.6487005467, + 926.9985232641, + 934.3629435117, + 941.7419036483, + 949.1353465979, + 956.5432158417, + 963.9654554089, + 971.4020098686, + 978.8528243212, + 986.3178443907, + 993.7970162163, + 1001.2902864449, + 1008.7976022234, + 1016.3189111915, + 1023.8541614739, + 1031.4033016737, + 1038.9662808647, + 1046.5430485854, + 1054.1335548314, + 1061.7377500496, + 1069.3555851309, + 1076.9870114047, + 1084.6319806319, + 1092.2904449995, + 1099.9623571140, + 1107.6476699961, + 1115.3463370744, + 1123.0583121801, + 1130.7835495416, + 1138.5220037785, + 1146.2736298969, + 1154.0383832838, + 1161.8162197020, + 1169.6070952851, + 1177.4109665328, + 1185.2277903054, + 1193.0575238198, + 1200.9001246442, + 1208.7555506939, + 1216.6237602266, + 1224.5047118380, + 1232.3983644575, + 1240.3046773436, + 1248.2236100803, + 1256.1551225723, + 1264.0991750417, + 1272.0557280230, + 1280.0247423603, + 1288.0061792024, + 1296.0000000000, + 1304.0061665011, + 1312.0246407478, + 1320.0553850728, + 1328.0983620955, + 1336.1535347188, + 1344.2208661255, + 1352.3003197751, + 1360.3918594003, + 1368.4954490040, + 1376.6110528559, + 1384.7386354892, + 1392.8781616980, + 1401.0295965338, + 1409.1929053025, + 1417.3680535619, + 1425.5550071182, + 1433.7537320236, + 1441.9641945733, + 1450.1863613025, + 1458.4201989843, + 1466.6656746263, + 1474.9227554684, + 1483.1914089801, + 1491.4716028579, + 1499.7633050227, + 1508.0664836175, + 1516.3811070048, + 1524.7071437644, + 1533.0445626906, + 1541.3933327903, + 1549.7534232806, + 1558.1248035861, + 1566.5074433375, + 1574.9013123686, + 1583.3063807145, + 1591.7226186094, + 1600.1499964846, + 1608.5884849662, + 1617.0380548732, + 1625.4986772154, + 1633.9703231917, + 1642.4529641876, + 1650.9465717736, + 1659.4511177036, + 1667.9665739122, + 1676.4929125137, + 1685.0301057998, + 1693.5781262378, + 1702.1369464690, + 1710.7065393070, + 1719.2868777356, + 1727.8779349075, + 1736.4796841426, + 1745.0920989258, + 1753.7151529063, + 1762.3488198950, + 1770.9930738636, + 1779.6478889428, + 1788.3132394207, + 1796.9890997413, + 1805.6754445031, + 1814.3722484576, + 1823.0794865074, + 1831.7971337056, + 1840.5251652535, + 1849.2635564999, + 1858.0122829390, + 1866.7713202096, + 1875.5406440938, + 1884.3202305150, + 1893.1100555371, + 1901.9100953633, + 1910.7203263343, + 1919.5407249276, + 1928.3712677557, + 1937.2119315653, + 1946.0626932359, + 1954.9235297784, + 1963.7944183344, + 1972.6753361744, + 1981.5662606973, + 1990.4671694285, + 1999.3780400196, + 2008.2988502465, + 2017.2295780088, + 2026.1702013285, + 2035.1206983489, + 2044.0810473338, + 2053.0512266659, + 2062.0312148464, + 2071.0209904936, + 2080.0205323417, + 2089.0298192403, + 2098.0488301532, + 2107.0775441570, + 2116.1159404408, + 2125.1639983049, + 2134.2216971598, + 2143.2890165253, + 2152.3659360297, + 2161.4524354089, + 2170.5484945052, + 2179.6540932666, + 2188.7692117462, + 2197.8938301007, + 2207.0279285901, + 2216.1714875766, + 2225.3244875237, + 2234.4869089955, + 2243.6587326558, + 2252.8399392674, + 2262.0305096911, + 2271.2304248850, + 2280.4396659037, + 2289.6582138977, + 2298.8860501122, + 2308.1231558868, + 2317.3695126545, + 2326.6251019409, + 2335.8899053637, + 2345.1639046317, + 2354.4470815443, + 2363.7394179907, + 2373.0408959490, + 2382.3514974860, + 2391.6712047559, + 2401.0000000000, + 2410.3378655461, + 2419.6847838074, + 2429.0407372823, + 2438.4057085534, + 2447.7796802872, + 2457.1626352330, + 2466.5545562227, + 2475.9554261700, + 2485.3652280695, + 2494.7839449968, + 2504.2115601072, + 2513.6480566352, + 2523.0934178943, + 2532.5476272760, + 2542.0106682495, + 2551.4825243609, + 2560.9631792328, + 2570.4526165636, + 2579.9508201270, + 2589.4577737714, + 2598.9734614194, + 2608.4978670675, + 2618.0309747849, + 2627.5727687136, + 2637.1232330677, + 2646.6823521328, + 2656.2501102653, + 2665.8264918923, + 2675.4114815110, + 2685.0050636878, + 2694.6072230582, + 2704.2179443264, + 2713.8372122643, + 2723.4650117115, + 2733.1013275747, + 2742.7461448270, + 2752.3994485079, + 2762.0612237221, + 2771.7314556399, + 2781.4101294962, + 2791.0972305902, + 2800.7927442847, + 2810.4966560063, + 2820.2089512442, + 2829.9296155502, + 2839.6586345385, + 2849.3959938845, + 2859.1416793251, + 2868.8956766580, + 2878.6579717413, + 2888.4285504930, + 2898.2073988909, + 2907.9945029718, + 2917.7898488313, + 2927.5934226236, + 2937.4052105607, + 2947.2251989123, + 2957.0533740053, + 2966.8897222234, + 2976.7342300070, + 2986.5868838523, + 2996.4476703115, + 3006.3165759920, + 3016.1935875562, + 3026.0786917212, + 3035.9718752584, + 3045.8731249931, + 3055.7824278041, + 3065.6997706236, + 3075.6251404365, + 3085.5585242804, + 3095.4999092450, + 3105.4492824719, + 3115.4066311543, + 3125.3719425365, + 3135.3452039137, + 3145.3264026318, + 3155.3155260867, + 3165.3125617243, + 3175.3174970403, + 3185.3303195795, + 3195.3510169356, + 3205.3795767511, + 3215.4159867169, + 3225.4602345719, + 3235.5123081028, + 3245.5721951437, + 3255.6398835758, + 3265.7153613275, + 3275.7986163735, + 3285.8896367348, + 3295.9884104787, + 3306.0949257178, + 3316.2091706107, + 3326.3311333606, + 3336.4608022160, + 3346.5981654700, + 3356.7432114599, + 3366.8959285672, + 3377.0563052172, + 3387.2243298788, + 3397.3999910641, + 3407.5832773283, + 3417.7741772695, + 3427.9726795281, + 3438.1787727870, + 3448.3924457710, + 3458.6136872466, + 3468.8424860221, + 3479.0788309468, + 3489.3227109112, + 3499.5741148464, + 3509.8330317244, + 3520.0994505573, + 3530.3733603973, + 3540.6547503364, + 3550.9436095064, + 3561.2399270783, + 3571.5436922624, + 3581.8548943078, + 3592.1735225026, + 3602.4995661730, + 3612.8330146838, + 3623.1738574377, + 3633.5220838752, + 3643.8776834744, + 3654.2406457510, + 3664.6109602577, + 3674.9886165844, + 3685.3736043574, + 3695.7659132398, + 3706.1655329312, + 3716.5724531671, + 3726.9866637191, + 3737.4081543945, + 3747.8369150361, + 3758.2729355221, + 3768.7162057659, + 3779.1667157159, + 3789.6244553551, + 3800.0894147012, + 3810.5615838063, + 3821.0409527566, + 3831.5275116724, + 3842.0212507077, + 3852.5221600504, + 3863.0302299216, + 3873.5454505757, + 3884.0678123003, + 3894.5973054159, + 3905.1339202756, + 3915.6776472653, + 3926.2284768030, + 3936.7863993390, + 3947.3514053559, + 3957.9234853677, + 3968.5026299205, + 3979.0888295917, + 3989.6820749901, + 4000.2823567557, + 4010.8896655596, + 4021.5039921036, + 4032.1253271203, + 4042.7536613729, + 4053.3889856548, + 4064.0312907898, + 4074.6805676315, + 4085.3368070638, + 4096.0000000000, + 4106.6701373831, + 4117.3472101855, + 4128.0312094089, + 4138.7221260843, + 4149.4199512713, + 4160.1246760588, + 4170.8362915639, + 4181.5547889326, + 4192.2801593392, + 4203.0123939861, + 4213.7514841039, + 4224.4974209512, + 4235.2501958144, + 4246.0098000075, + 4256.7762248721, + 4267.5494617770, + 4278.3295021186, + 4289.1163373202, + 4299.9099588321, + 4310.7103581313, + 4321.5175267219, + 4332.3314561342, + 4343.1521379251, + 4353.9795636778, + 4364.8137250016, + 4375.6546135320, + 4386.5022209304, + 4397.3565388837, + 4408.2175591050, + 4419.0852733324, + 4429.9596733298, + 4440.8407508861, + 4451.7284978156, + 4462.6229059575, + 4473.5239671759, + 4484.4316733599, + 4495.3460164231, + 4506.2669883035, + 4517.1945809640, + 4528.1287863914, + 4539.0695965968, + 4550.0170036156, + 4560.9709995068, + 4571.9315763535, + 4582.8987262626, + 4593.8724413645, + 4604.8527138130, + 4615.8395357856, + 4626.8328994828, + 4637.8327971284, + 4648.8392209693, + 4659.8521632753, + 4670.8716163390, + 4681.8975724760, + 4692.9300240243, + 4703.9689633444, + 4715.0143828193, + 4726.0662748543, + 4737.1246318771, + 4748.1894463371, + 4759.2607107062, + 4770.3384174777, + 4781.4225591672, + 4792.5131283116, + 4803.6101174696, + 4814.7135192213, + 4825.8233261683, + 4836.9395309335, + 4848.0621261609, + 4859.1911045158, + 4870.3264586842, + 4881.4681813733, + 4892.6162653110, + 4903.7707032459, + 4914.9314879474, + 4926.0986122052, + 4937.2720688295, + 4948.4518506510, + 4959.6379505206, + 4970.8303613092, + 4982.0290759079, + 4993.2340872279, + 5004.4453882001, + 5015.6629717753, + 5026.8868309241, + 5038.1169586365, + 5049.3533479223, + 5060.5959918105, + 5071.8448833497, + 5083.1000156077, + 5094.3613816714, + 5105.6289746470, + 5116.9027876595, + 5128.1828138531, + 5139.4690463907, + 5150.7614784539, + 5162.0601032433, + 5173.3649139777, + 5184.6759038949, + 5195.9930662506, + 5207.3163943194, + 5218.6458813939, + 5229.9815207850, + 5241.3233058217, + 5252.6712298510, + 5264.0252862380, + 5275.3854683656, + 5286.7517696346, + 5298.1241834635, + 5309.5027032884, + 5320.8873225631, + 5332.2780347590, + 5343.6748333647, + 5355.0777118863, + 5366.4866638472, + 5377.9016827880, + 5389.3227622665, + 5400.7498958574, + 5412.1830771527, + 5423.6222997611, + 5435.0675573082, + 5446.5188434364, + 5457.9761518049, + 5469.4394760894, + 5480.9088099822, + 5492.3841471923, + 5503.8654814448, + 5515.3528064816, + 5526.8461160606, + 5538.3454039558, + 5549.8506639579, + 5561.3618898731, + 5572.8790755240, + 5584.4022147491, + 5595.9313014028, + 5607.4663293552, + 5619.0072924923, + 5630.5541847159, + 5642.1069999431, + 5653.6657321070, + 5665.2303751559, + 5676.8009230538, + 5688.3773697797, + 5699.9597093284, + 5711.5479357096, + 5723.1420429485, + 5734.7420250850, + 5746.3478761746, + 5757.9595902874, + 5769.5771615087, + 5781.2005839386, + 5792.8298516920, + 5804.4649588987, + 5816.1058997031, + 5827.7526682643, + 5839.4052587560, + 5851.0636653664, + 5862.7278822983, + 5874.3979037688, + 5886.0737240093, + 5897.7553372658, + 5909.4427377983, + 5921.1359198811, + 5932.8348778025, + 5944.5396058651, + 5956.2500983854, + 5967.9663496940, + 5979.6883541351, + 5991.4161060672, + 6003.1495998623, + 6014.8888299063, + 6026.6337905987, + 6038.3844763527, + 6050.1408815952, + 6061.9030007664, + 6073.6708283203, + 6085.4443587241, + 6097.2235864585, + 6109.0085060174, + 6120.7991119082, + 6132.5953986513, + 6144.3973607806, + 6156.2049928426, + 6168.0182893975, + 6179.8372450182, + 6191.6618542904, + 6203.4921118132, + 6215.3280121982, + 6227.1695500700, + 6239.0167200659, + 6250.8695168361, + 6262.7279350432, + 6274.5919693627, + 6286.4616144826, + 6298.3368651034, + 6310.2177159382, + 6322.1041617124, + 6333.9961971640, + 6345.8938170431, + 6357.7970161124, + 6369.7057891466, + 6381.6201309327, + 6393.5400362700, + 6405.4654999698, + 6417.3965168555, + 6429.3330817625, + 6441.2751895383, + 6453.2228350423, + 6465.1760131457, + 6477.1347187317, + 6489.0989466952, + 6501.0686919430, + 6513.0439493936, + 6525.0247139769, + 6537.0109806350, + 6549.0027443210, + 6561.0000000000, + 6573.0027426484, + 6585.0109672541, + 6597.0246688165, + 6609.0438423464, + 6621.0684828657, + 6633.0985854079, + 6645.1341450177, + 6657.1751567510, + 6669.2216156747, + 6681.2735168671, + 6693.3308554176, + 6705.3936264265, + 6717.4618250051, + 6729.5354462759, + 6741.6144853722, + 6753.6989374383, + 6765.7887976291, + 6777.8840611107, + 6789.9847230597, + 6802.0907786636, + 6814.2022231205, + 6826.3190516394, + 6838.4412594396, + 6850.5688417513, + 6862.7017938151, + 6874.8401108821, + 6886.9837882140, + 6899.1328210829, + 6911.2872047712, + 6923.4469345719, + 6935.6120057882, + 6947.7824137335, + 6959.9581537318, + 6972.1392211169, + 6984.3256112330, + 6996.5173194347, + 7008.7143410863, + 7020.9166715624, + 7033.1243062477, + 7045.3372405367, + 7057.5554698343, + 7069.7789895548, + 7082.0077951229, + 7094.2418819728, + 7106.4812455489, + 7118.7258813051, + 7130.9757847053, + 7143.2309512230, + 7155.4913763416, + 7167.7570555538, + 7180.0279843624, + 7192.3041582795, + 7204.5855728270, + 7216.8722235361, + 7229.1641059476, + 7241.4612156120, + 7253.7635480891, + 7266.0710989478, + 7278.3838637670, + 7290.7018381344, + 7303.0250176474, + 7315.3533979125, + 7327.6869745455, + 7340.0257431713, + 7352.3696994244, + 7364.7188389480, + 7377.0731573946, + 7389.4326504259, + 7401.7973137127, + 7414.1671429346, + 7426.5421337804, + 7438.9222819480, + 7451.3075831438, + 7463.6980330837, + 7476.0936274921, + 7488.4943621024, + 7500.9002326569, + 7513.3112349065, + 7525.7273646110, + 7538.1486175390, + 7550.5749894679, + 7563.0064761834, + 7575.4430734804, + 7587.8847771619, + 7600.3315830400, + 7612.7834869349, + 7625.2404846758, + 7637.7025721001, + 7650.1697450538, + 7662.6419993914, + 7675.1193309757, + 7687.6017356782, + 7700.0892093785, + 7712.5817479647, + 7725.0793473331, + 7737.5820033885, + 7750.0897120437, + 7762.6024692201, + 7775.1202708469, + 7787.6431128620, + 7800.1709912110, + 7812.7039018478, + 7825.2418407347, + 7837.7848038416, + 7850.3327871468, + 7862.8857866366, + 7875.4437983052, + 7888.0068181548, + 7900.5748421957, + 7913.1478664460, + 7925.7258869318, + 7938.3088996870, + 7950.8969007534, + 7963.4898861807, + 7976.0878520263, + 7988.6907943555, + 8001.2987092412, + 8013.9115927643, + 8026.5294410131, + 8039.1522500838, + 8051.7800160802, + 8064.4127351138, + 8077.0504033037, + 8089.6930167764, + 8102.3405716663, + 8114.9930641151, + 8127.6504902721, + 8140.3128462940, + 8152.9801283453, + 8165.6523325976, + 8178.3294552300, + 8191.0114924292, + 8203.6984403890, + 8216.3902953107, + 8229.0870534031, + 8241.7887108821, + 8254.4952639709, + 8267.2067089000, + 8279.9230419073, + 8292.6442592376, + 8305.3703571432, + 8318.1013318835, + 8330.8371797251, + 8343.5778969415, + 8356.3234798136, + 8369.0739246292, + 8381.8292276834, + 8394.5893852780, + 8407.3543937222, + 8420.1242493321, + 8432.8989484305, + 8445.6784873475, + 8458.4628624202, + 8471.2520699922, + 8484.0461064144, + 8496.8449680444, + 8509.6486512468, + 8522.4571523928, + 8535.2704678607, + 8548.0885940353, + 8560.9115273086, + 8573.7392640788, + 8586.5718007514, + 8599.4091337382, + 8612.2512594579, + 8625.0981743359, + 8637.9498748040, + 8650.8063573010, + 8663.6676182722, + 8676.5336541692, + 8689.4044614507, + 8702.2800365815, + 8715.1603760331, + 8728.0454762838, + 8740.9353338178, + 8753.8299451264, + 8766.7293067070, + 8779.6334150636, + 8792.5422667064, + 8805.4558581523, + 8818.3741859245, + 8831.2972465524, + 8844.2250365719, + 8857.1575525253, + 8870.0947909611, + 8883.0367484340, + 8895.9834215053, + 8908.9348067421, + 8921.8909007182, + 8934.8517000133, + 8947.8172012135, + 8960.7874009109, + 8973.7622957040, + 8986.7418821972, + 8999.7261570012, + 9012.7151167328, + 9025.7087580148, + 9038.7070774762, + 9051.7100717521, + 9064.7177374833, + 9077.7300713171, + 9090.7470699065, + 9103.7687299106, + 9116.7950479945, + 9129.8260208291, + 9142.8616450914, + 9155.9019174644, + 9168.9468346367, + 9181.9963933031, + 9195.0505901642, + 9208.1094219263, + 9221.1728853017, + 9234.2409770084, + 9247.3136937704, + 9260.3910323173, + 9273.4729893846, + 9286.5595617135, + 9299.6507460510, + 9312.7465391496, + 9325.8469377679, + 9338.9519386698, + 9352.0615386252, + 9365.1757344094, + 9378.2945228036, + 9391.4179005944, + 9404.5458645741, + 9417.6784115407, + 9430.8155382977, + 9443.9572416540, + 9457.1035184244, + 9470.2543654290, + 9483.4097794934, + 9496.5697574489, + 9509.7342961321, + 9522.9033923851, + 9536.0770430556, + 9549.2552449966, + 9562.4379950666, + 9575.6252901295, + 9588.8171270546, + 9602.0135027165, + 9615.2144139955, + 9628.4198577767, + 9641.6298309511, + 9654.8443304146, + 9668.0633530688, + 9681.2868958202, + 9694.5149555808, + 9707.7475292679, + 9720.9846138040, + 9734.2262061168, + 9747.4723031393, + 9760.7229018097, + 9773.9779990712, + 9787.2375918726, + 9800.5016771674, + 9813.7702519147, + 9827.0433130783, + 9840.3208576275, + 9853.6028825365, + 9866.8893847847, + 9880.1803613565, + 9893.4758092415, + 9906.7757254342, + 9920.0801069342, + 9933.3889507462, + 9946.7022538799, + 9960.0200133500, + 9973.3422261761, + 9986.6688893829, + 10000.0000000000, + 10013.3355550619, + 10026.6755516082, + 10040.0199866833, + 10053.3688573365, + 10066.7221606221, + 10080.0798935991, + 10093.4420533317, + 10106.8086368886, + 10120.1796413436, + 10133.5550637751, + 10146.9349012666, + 10160.3191509062, + 10173.7078097869, + 10187.1008750065, + 10200.4983436674, + 10213.9002128770, + 10227.3064797472, + 10240.7171413949, + 10254.1321949415, + 10267.5516375131, + 10280.9754662408, + 10294.4036782600, + 10307.8362707111, + 10321.2732407388, + 10334.7145854928 +}; + +#else + +static real_t iq_table[] = +{ + 0x0, + 0x80, + 0x142, + 0x229, + 0x32C, + 0x446, + 0x573, + 0x6B1, + 0x7FF, + 0x95C, + 0xAC5, + 0xC3B, + 0xDBC, + 0xF48, + 0x10DE, + 0x127F, + 0x1428, + 0x15DB, + 0x1796, + 0x1959, + 0x1B24, + 0x1CF7, + 0x1ED2, + 0x20B4, + 0x229D, + 0x248C, + 0x2683, + 0x287F, + 0x2A83, + 0x2C8C, + 0x2E9B, + 0x30B0, + 0x32CB, + 0x34EC, + 0x3712, + 0x393E, + 0x3B6F, + 0x3DA5, + 0x3FE0, + 0x4220, + 0x4466, + 0x46B0, + 0x48FF, + 0x4B52, + 0x4DAA, + 0x5007, + 0x5268, + 0x54CE, + 0x5738, + 0x59A7, + 0x5C19, + 0x5E90, + 0x610B, + 0x638A, + 0x660D, + 0x6894, + 0x6B1F, + 0x6DAE, + 0x7041, + 0x72D7, + 0x7572, + 0x7810, + 0x7AB1, + 0x7D57, + 0x7FFF, + 0x82AC, + 0x855C, + 0x880F, + 0x8AC6, + 0x8D81, + 0x903E, + 0x92FF, + 0x95C4, + 0x988B, + 0x9B56, + 0x9E24, + 0xA0F6, + 0xA3CA, + 0xA6A2, + 0xA97C, + 0xAC5A, + 0xAF3B, + 0xB21F, + 0xB506, + 0xB7F0, + 0xBADD, + 0xBDCD, + 0xC0C0, + 0xC3B5, + 0xC6AE, + 0xC9A9, + 0xCCA8, + 0xCFA9, + 0xD2AC, + 0xD5B3, + 0xD8BC, + 0xDBC8, + 0xDED7, + 0xE1E9, + 0xE4FD, + 0xE814, + 0xEB2D, + 0xEE49, + 0xF168, + 0xF489, + 0xF7AD, + 0xFAD4, + 0xFDFD, + 0x10128, + 0x10456, + 0x10787, + 0x10ABA, + 0x10DEF, + 0x11127, + 0x11461, + 0x1179E, + 0x11ADD, + 0x11E1F, + 0x12163, + 0x124A9, + 0x127F2, + 0x12B3D, + 0x12E8A, + 0x131D9, + 0x1352B, + 0x1387F, + 0x13BD6, + 0x13F2F, + 0x1428A, + 0x145E7, + 0x14946, + 0x14CA8, + 0x1500C, + 0x15372, + 0x156DA, + 0x15A45, + 0x15DB1, + 0x16120, + 0x16491, + 0x16804, + 0x16B79, + 0x16EF0, + 0x1726A, + 0x175E5, + 0x17963, + 0x17CE2, + 0x18064, + 0x183E7, + 0x1876D, + 0x18AF5, + 0x18E7F, + 0x1920B, + 0x19598, + 0x19928, + 0x19CBA, + 0x1A04E, + 0x1A3E3, + 0x1A77B, + 0x1AB15, + 0x1AEB0, + 0x1B24E, + 0x1B5EE, + 0x1B98F, + 0x1BD32, + 0x1C0D7, + 0x1C47F, + 0x1C828, + 0x1CBD3, + 0x1CF7F, + 0x1D32E, + 0x1D6DE, + 0x1DA91, + 0x1DE45, + 0x1E1FB, + 0x1E5B3, + 0x1E96D, + 0x1ED28, + 0x1F0E6, + 0x1F4A5, + 0x1F866, + 0x1FC28, + 0x1FFED, + 0x203B3, + 0x2077B, + 0x20B45, + 0x20F11, + 0x212DE, + 0x216AD, + 0x21A7E, + 0x21E50, + 0x22225, + 0x225FB, + 0x229D2, + 0x22DAC, + 0x23187, + 0x23564, + 0x23942, + 0x23D23, + 0x24104, + 0x244E8, + 0x248CD, + 0x24CB4, + 0x2509D, + 0x25487, + 0x25873, + 0x25C60, + 0x2604F, + 0x26440, + 0x26832, + 0x26C26, + 0x2701C, + 0x27413, + 0x2780C, + 0x27C07, + 0x28003, + 0x28400, + 0x287FF, + 0x28C00, + 0x29003, + 0x29407, + 0x2980C, + 0x29C13, + 0x2A01C, + 0x2A426, + 0x2A832, + 0x2AC3F, + 0x2B04E, + 0x2B45E, + 0x2B870, + 0x2BC83, + 0x2C098, + 0x2C4AF, + 0x2C8C7, + 0x2CCE0, + 0x2D0FB, + 0x2D517, + 0x2D935, + 0x2DD55, + 0x2E176, + 0x2E598, + 0x2E9BC, + 0x2EDE1, + 0x2F208, + 0x2F630, + 0x2FA5A, + 0x2FE85, + 0x302B2, + 0x306E0, + 0x30B0F, + 0x30F40, + 0x31373, + 0x317A7, + 0x31BDC, + 0x32013, + 0x3244B, + 0x32884, + 0x32CBF, + 0x330FC, + 0x33539, + 0x33979, + 0x33DB9, + 0x341FB, + 0x3463F, + 0x34A83, + 0x34ECA, + 0x35311, + 0x3575A, + 0x35BA4, + 0x35FF0, + 0x3643D, + 0x3688B, + 0x36CDB, + 0x3712C, + 0x3757F, + 0x379D2, + 0x37E28, + 0x3827E, + 0x386D6, + 0x38B2F, + 0x38F8A, + 0x393E6, + 0x39843, + 0x39CA1, + 0x3A101, + 0x3A562, + 0x3A9C5, + 0x3AE28, + 0x3B28E, + 0x3B6F4, + 0x3BB5C, + 0x3BFC5, + 0x3C42F, + 0x3C89B, + 0x3CD08, + 0x3D176, + 0x3D5E5, + 0x3DA56, + 0x3DEC8, + 0x3E33B, + 0x3E7B0, + 0x3EC26, + 0x3F09D, + 0x3F515, + 0x3F98F, + 0x3FE0A, + 0x40286, + 0x40703, + 0x40B82, + 0x41002, + 0x41483, + 0x41906, + 0x41D89, + 0x4220E, + 0x42694, + 0x42B1C, + 0x42FA4, + 0x4342E, + 0x438B9, + 0x43D46, + 0x441D3, + 0x44662, + 0x44AF2, + 0x44F83, + 0x45415, + 0x458A9, + 0x45D3E, + 0x461D4, + 0x4666B, + 0x46B03, + 0x46F9D, + 0x47438, + 0x478D4, + 0x47D71, + 0x4820F, + 0x486AF, + 0x48B50, + 0x48FF1, + 0x49494, + 0x49939, + 0x49DDE, + 0x4A285, + 0x4A72C, + 0x4ABD5, + 0x4B07F, + 0x4B52B, + 0x4B9D7, + 0x4BE85, + 0x4C333, + 0x4C7E3, + 0x4CC94, + 0x4D146, + 0x4D5FA, + 0x4DAAE, + 0x4DF64, + 0x4E41B, + 0x4E8D2, + 0x4ED8B, + 0x4F246, + 0x4F701, + 0x4FBBD, + 0x5007B, + 0x50539, + 0x509F9, + 0x50EBA, + 0x5137C, + 0x5183F, + 0x51D03, + 0x521C9, + 0x5268F, + 0x52B57, + 0x53020, + 0x534E9, + 0x539B4, + 0x53E80, + 0x5434D, + 0x5481B, + 0x54CEB, + 0x551BB, + 0x5568C, + 0x55B5F, + 0x56033, + 0x56507, + 0x569DD, + 0x56EB4, + 0x5738C, + 0x57865, + 0x57D3F, + 0x5821A, + 0x586F6, + 0x58BD4, + 0x590B2, + 0x59592, + 0x59A72, + 0x59F54, + 0x5A436, + 0x5A91A, + 0x5ADFF, + 0x5B2E5, + 0x5B7CB, + 0x5BCB3, + 0x5C19C, + 0x5C686, + 0x5CB71, + 0x5D05D, + 0x5D54B, + 0x5DA39, + 0x5DF28, + 0x5E418, + 0x5E90A, + 0x5EDFC, + 0x5F2EF, + 0x5F7E4, + 0x5FCD9, + 0x601D0, + 0x606C7, + 0x60BBF, + 0x610B9, + 0x615B4, + 0x61AAF, + 0x61FAC, + 0x624A9, + 0x629A8, + 0x62EA8, + 0x633A8, + 0x638AA, + 0x63DAC, + 0x642B0, + 0x647B5, + 0x64CBA, + 0x651C1, + 0x656C9, + 0x65BD1, + 0x660DB, + 0x665E6, + 0x66AF1, + 0x66FFE, + 0x6750C, + 0x67A1A, + 0x67F2A, + 0x6843A, + 0x6894C, + 0x68E5F, + 0x69372, + 0x69887, + 0x69D9C, + 0x6A2B3, + 0x6A7CA, + 0x6ACE3, + 0x6B1FC, + 0x6B716, + 0x6BC32, + 0x6C14E, + 0x6C66B, + 0x6CB8A, + 0x6D0A9, + 0x6D5C9, + 0x6DAEA, + 0x6E00C, + 0x6E52F, + 0x6EA53, + 0x6EF78, + 0x6F49E, + 0x6F9C5, + 0x6FEED, + 0x70416, + 0x7093F, + 0x70E6A, + 0x71396, + 0x718C2, + 0x71DF0, + 0x7231E, + 0x7284E, + 0x72D7E, + 0x732AF, + 0x737E2, + 0x73D15, + 0x74249, + 0x7477E, + 0x74CB4, + 0x751EB, + 0x75722, + 0x75C5B, + 0x76195, + 0x766CF, + 0x76C0B, + 0x77147, + 0x77685, + 0x77BC3, + 0x78102, + 0x78642, + 0x78B83, + 0x790C5, + 0x79608, + 0x79B4C, + 0x7A091, + 0x7A5D6, + 0x7AB1D, + 0x7B064, + 0x7B5AC, + 0x7BAF6, + 0x7C040, + 0x7C58B, + 0x7CAD7, + 0x7D024, + 0x7D571, + 0x7DAC0, + 0x7E010, + 0x7E560, + 0x7EAB1, + 0x7F004, + 0x7F557, + 0x7FAAB, + 0x7FFFF, + 0x80555, + 0x80AAC, + 0x81003, + 0x8155C, + 0x81AB5, + 0x8200F, + 0x8256B, + 0x82AC7, + 0x83023, + 0x83581, + 0x83AE0, + 0x8403F, + 0x845A0, + 0x84B01, + 0x85063, + 0x855C6, + 0x85B2A, + 0x8608E, + 0x865F4, + 0x86B5A, + 0x870C2, + 0x8762A, + 0x87B93, + 0x880FD, + 0x88668, + 0x88BD3, + 0x89140, + 0x896AD, + 0x89C1B, + 0x8A18A, + 0x8A6FA, + 0x8AC6B, + 0x8B1DD, + 0x8B74F, + 0x8BCC3, + 0x8C237, + 0x8C7AC, + 0x8CD22, + 0x8D298, + 0x8D810, + 0x8DD88, + 0x8E302, + 0x8E87C, + 0x8EDF7, + 0x8F373, + 0x8F8EF, + 0x8FE6D, + 0x903EB, + 0x9096A, + 0x90EEA, + 0x9146B, + 0x919ED, + 0x91F6F, + 0x924F2, + 0x92A77, + 0x92FFC, + 0x93581, + 0x93B08, + 0x9408F, + 0x94618, + 0x94BA1, + 0x9512B, + 0x956B6, + 0x95C41, + 0x961CE, + 0x9675B, + 0x96CE9, + 0x97278, + 0x97807, + 0x97D98, + 0x98329, + 0x988BB, + 0x98E4E, + 0x993E2, + 0x99977, + 0x99F0C, + 0x9A4A2, + 0x9AA39, + 0x9AFD1, + 0x9B56A, + 0x9BB03, + 0x9C09D, + 0x9C639, + 0x9CBD4, + 0x9D171, + 0x9D70E, + 0x9DCAD, + 0x9E24C, + 0x9E7EC, + 0x9ED8C, + 0x9F32E, + 0x9F8D0, + 0x9FE73, + 0xA0417, + 0xA09BC, + 0xA0F61, + 0xA1507, + 0xA1AAE, + 0xA2056, + 0xA25FF, + 0xA2BA8, + 0xA3152, + 0xA36FD, + 0xA3CA9, + 0xA4255, + 0xA4803, + 0xA4DB1, + 0xA5360, + 0xA590F, + 0xA5EC0, + 0xA6471, + 0xA6A23, + 0xA6FD6, + 0xA7589, + 0xA7B3E, + 0xA80F3, + 0xA86A9, + 0xA8C5F, + 0xA9217, + 0xA97CF, + 0xA9D88, + 0xAA342, + 0xAA8FC, + 0xAAEB8, + 0xAB474, + 0xABA31, + 0xABFEE, + 0xAC5AD, + 0xACB6C, + 0xAD12C, + 0xAD6EC, + 0xADCAE, + 0xAE270, + 0xAE833, + 0xAEDF7, + 0xAF3BB, + 0xAF980, + 0xAFF46, + 0xB050D, + 0xB0AD5, + 0xB109D, + 0xB1666, + 0xB1C30, + 0xB21FA, + 0xB27C6, + 0xB2D92, + 0xB335E, + 0xB392C, + 0xB3EFA, + 0xB44C9, + 0xB4A99, + 0xB506A, + 0xB563B, + 0xB5C0D, + 0xB61E0, + 0xB67B3, + 0xB6D88, + 0xB735D, + 0xB7932, + 0xB7F09, + 0xB84E0, + 0xB8AB8, + 0xB9091, + 0xB966A, + 0xB9C45, + 0xBA220, + 0xBA7FB, + 0xBADD8, + 0xBB3B5, + 0xBB993, + 0xBBF71, + 0xBC551, + 0xBCB31, + 0xBD112, + 0xBD6F3, + 0xBDCD5, + 0xBE2B8, + 0xBE89C, + 0xBEE81, + 0xBF466, + 0xBFA4C, + 0xC0032, + 0xC061A, + 0xC0C02, + 0xC11EB, + 0xC17D4, + 0xC1DBE, + 0xC23A9, + 0xC2995, + 0xC2F82, + 0xC356F, + 0xC3B5D, + 0xC414B, + 0xC473B, + 0xC4D2B, + 0xC531B, + 0xC590D, + 0xC5EFF, + 0xC64F2, + 0xC6AE6, + 0xC70DA, + 0xC76CF, + 0xC7CC5, + 0xC82BB, + 0xC88B2, + 0xC8EAA, + 0xC94A3, + 0xC9A9C, + 0xCA096, + 0xCA691, + 0xCAC8C, + 0xCB288, + 0xCB885, + 0xCBE83, + 0xCC481, + 0xCCA80, + 0xCD07F, + 0xCD680, + 0xCDC81, + 0xCE283, + 0xCE885, + 0xCEE88, + 0xCF48C, + 0xCFA91, + 0xD0096, + 0xD069C, + 0xD0CA3, + 0xD12AA, + 0xD18B2, + 0xD1EBB, + 0xD24C4, + 0xD2ACE, + 0xD30D9, + 0xD36E4, + 0xD3CF1, + 0xD42FE, + 0xD490B, + 0xD4F19, + 0xD5528, + 0xD5B38, + 0xD6148, + 0xD6759, + 0xD6D6B, + 0xD737D, + 0xD7991, + 0xD7FA4, + 0xD85B9, + 0xD8BCE, + 0xD91E4, + 0xD97FA, + 0xD9E11, + 0xDA429, + 0xDAA42, + 0xDB05B, + 0xDB675, + 0xDBC8F, + 0xDC2AB, + 0xDC8C7, + 0xDCEE3, + 0xDD500, + 0xDDB1E, + 0xDE13D, + 0xDE75C, + 0xDED7C, + 0xDF39D, + 0xDF9BE, + 0xDFFE0, + 0xE0603, + 0xE0C26, + 0xE124A, + 0xE186F, + 0xE1E95, + 0xE24BB, + 0xE2AE1, + 0xE3109, + 0xE3731, + 0xE3D59, + 0xE4383, + 0xE49AD, + 0xE4FD7, + 0xE5603, + 0xE5C2F, + 0xE625C, + 0xE6889, + 0xE6EB7, + 0xE74E6, + 0xE7B15, + 0xE8145, + 0xE8776, + 0xE8DA7, + 0xE93D9, + 0xE9A0B, + 0xEA03F, + 0xEA673, + 0xEACA7, + 0xEB2DD, + 0xEB913, + 0xEBF49, + 0xEC580, + 0xECBB8, + 0xED1F1, + 0xED82A, + 0xEDE64, + 0xEE49E, + 0xEEAD9, + 0xEF115, + 0xEF752, + 0xEFD8F, + 0xF03CD, + 0xF0A0B, + 0xF104A, + 0xF168A, + 0xF1CCA, + 0xF230B, + 0xF294D, + 0xF2F8F, + 0xF35D2, + 0xF3C15, + 0xF425A, + 0xF489E, + 0xF4EE4, + 0xF552A, + 0xF5B71, + 0xF61B8, + 0xF6800, + 0xF6E49, + 0xF7492, + 0xF7ADC, + 0xF8127, + 0xF8772, + 0xF8DBE, + 0xF940B, + 0xF9A58, + 0xFA0A6, + 0xFA6F4, + 0xFAD43, + 0xFB393, + 0xFB9E3, + 0xFC034, + 0xFC686, + 0xFCCD8, + 0xFD32B, + 0xFD97F, + 0xFDFD3, + 0xFE628, + 0xFEC7D, + 0xFF2D3, + 0xFF92A, + 0xFFF81, + 0x1005D9, + 0x100C31, + 0x10128B, + 0x1018E4, + 0x101F3F, + 0x10259A, + 0x102BF6, + 0x103252, + 0x1038AF, + 0x103F0C, + 0x10456B, + 0x104BC9, + 0x105229, + 0x105889, + 0x105EEA, + 0x10654B, + 0x106BAD, + 0x10720F, + 0x107873, + 0x107ED6, + 0x10853B, + 0x108BA0, + 0x109205, + 0x10986C, + 0x109ED3, + 0x10A53A, + 0x10ABA2, + 0x10B20B, + 0x10B874, + 0x10BEDE, + 0x10C549, + 0x10CBB4, + 0x10D220, + 0x10D88C, + 0x10DEF9, + 0x10E567, + 0x10EBD5, + 0x10F244, + 0x10F8B3, + 0x10FF23, + 0x110594, + 0x110C05, + 0x111277, + 0x1118EA, + 0x111F5D, + 0x1125D1, + 0x112C45, + 0x1132BA, + 0x11392F, + 0x113FA6, + 0x11461C, + 0x114C94, + 0x11530C, + 0x115984, + 0x115FFD, + 0x116677, + 0x116CF2, + 0x11736D, + 0x1179E8, + 0x118064, + 0x1186E1, + 0x118D5E, + 0x1193DC, + 0x119A5B, + 0x11A0DA, + 0x11A75A, + 0x11ADDA, + 0x11B45B, + 0x11BADD, + 0x11C15F, + 0x11C7E2, + 0x11CE65, + 0x11D4E9, + 0x11DB6E, + 0x11E1F3, + 0x11E879, + 0x11EEFF, + 0x11F586, + 0x11FC0E, + 0x120296, + 0x12091E, + 0x120FA8, + 0x121632, + 0x121CBC, + 0x122347, + 0x1229D3, + 0x12305F, + 0x1236EC, + 0x123D79, + 0x124407, + 0x124A96, + 0x125125, + 0x1257B5, + 0x125E45, + 0x1264D6, + 0x126B68, + 0x1271FA, + 0x12788D, + 0x127F20, + 0x1285B4, + 0x128C48, + 0x1292DD, + 0x129973, + 0x12A009, + 0x12A6A0, + 0x12AD38, + 0x12B3D0, + 0x12BA68, + 0x12C101, + 0x12C79B, + 0x12CE35, + 0x12D4D0, + 0x12DB6C, + 0x12E208, + 0x12E8A4, + 0x12EF41, + 0x12F5DF, + 0x12FC7E, + 0x13031C, + 0x1309BC, + 0x13105C, + 0x1316FD, + 0x131D9E, + 0x132440, + 0x132AE2, + 0x133185, + 0x133829, + 0x133ECD, + 0x134571, + 0x134C17, + 0x1352BC, + 0x135963, + 0x13600A, + 0x1366B1, + 0x136D59, + 0x137402, + 0x137AAB, + 0x138155, + 0x1387FF, + 0x138EAA, + 0x139556, + 0x139C02, + 0x13A2AF, + 0x13A95C, + 0x13B00A, + 0x13B6B8, + 0x13BD67, + 0x13C416, + 0x13CAC7, + 0x13D177, + 0x13D828, + 0x13DEDA, + 0x13E58C, + 0x13EC3F, + 0x13F2F3, + 0x13F9A7, + 0x14005B, + 0x140710, + 0x140DC6, + 0x14147C, + 0x141B33, + 0x1421EB, + 0x1428A2, + 0x142F5B +}; + +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/libfaad/is.c b/src/libfaad/is.c index f64c41859..8a4d50b5c 100644 --- a/src/libfaad/is.c +++ b/src/libfaad/is.c @@ -16,20 +16,37 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: is.c,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: is.c,v 1.2 2002/12/16 19:00:26 miguelfreitas Exp $ **/ #include "common.h" +#include "structs.h" #include "syntax.h" #include "is.h" +#ifdef FIXED_POINT +static real_t pow05_table[] = { + COEF_CONST(1.68179283050743), /* 0.5^(-3/4) */ + COEF_CONST(1.41421356237310), /* 0.5^(-2/4) */ + COEF_CONST(1.18920711500272), /* 0.5^(-1/4) */ + COEF_CONST(1.0), /* 0.5^( 0/4) */ + COEF_CONST(0.84089641525371), /* 0.5^(+1/4) */ + COEF_CONST(0.70710678118655), /* 0.5^(+2/4) */ + COEF_CONST(0.59460355750136) /* 0.5^(+3/4) */ +}; +#endif + void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec, uint16_t frame_len) { uint8_t g, sfb, b; uint16_t i, k; +#ifndef FIXED_POINT real_t scale; +#else + int32_t exp, frac; +#endif uint16_t nshort = frame_len/8; uint8_t group = 0; @@ -50,16 +67,29 @@ void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec, ics->pred.prediction_used[sfb] = 0; icsr->pred.prediction_used[sfb] = 0; - scale = MUL(is_intensity(icsr, g, sfb), - MUL(invert_intensity(ics, g, sfb), - (real_t)exp(LN05 * (0.25*icsr->scale_factors[g][sfb])))); +#ifndef FIXED_POINT + scale = (real_t)pow(0.5, (0.25*icsr->scale_factors[g][sfb])); +#else + exp = icsr->scale_factors[g][sfb] / 4; + frac = icsr->scale_factors[g][sfb] % 4; +#endif /* Scale from left to right channel, do not touch left channel */ for (i = icsr->swb_offset[sfb]; i < icsr->swb_offset[sfb+1]; i++) { k = (group*nshort)+i; +#ifndef FIXED_POINT r_spec[k] = MUL(l_spec[k], scale); +#else + if (exp < 0) + r_spec[k] = l_spec[k] << -exp; + else + r_spec[k] = l_spec[k] >> exp; + r_spec[k] = MUL_R_C(r_spec[k], pow05_table[frac + 3]); +#endif + if (is_intensity(icsr, g, sfb) != invert_intensity(ics, g, sfb)) + r_spec[k] = -r_spec[k]; } } } diff --git a/src/libfaad/is.h b/src/libfaad/is.h index 3b311b8d8..3233f5242 100644 --- a/src/libfaad/is.h +++ b/src/libfaad/is.h @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: is.h,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: is.h,v 1.2 2002/12/16 19:00:31 miguelfreitas Exp $ **/ #ifndef __IS_H__ diff --git a/src/libfaad/kbd_win.h b/src/libfaad/kbd_win.h index b28e085de..c08603167 100644 --- a/src/libfaad/kbd_win.h +++ b/src/libfaad/kbd_win.h @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: kbd_win.h,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: kbd_win.h,v 1.2 2002/12/16 19:00:31 miguelfreitas Exp $ **/ #ifndef __KBD_WIN_H__ @@ -26,11 +26,14 @@ extern "C" { #endif +#ifndef FIXED_POINT + #ifdef _MSC_VER #pragma warning(disable:4305) +#pragma warning(disable:4244) #endif -real_t kbd_long[] = +real_t kbd_long_1024[] = { 0.00029256153896361, 0.00042998567353047, @@ -1058,8 +1061,970 @@ real_t kbd_long[] = 0.99999995720387 }; +real_t kbd_long_960[] = { + 0.0003021562530949, + 0.0004452267024786, + 0.0005674947527496, + 0.0006812465553466, + 0.0007910496776387, + 0.0008991655033895, + 0.0010068978259384, + 0.0011150758515751, + 0.0012242653193642, + 0.0013348735658205, + 0.0014472068670273, + 0.0015615039850448, + 0.0016779568885263, + 0.0017967241232412, + 0.0019179397560955, + 0.0020417195415393, + 0.0021681652836642, + 0.0022973679910599, + 0.0024294102029937, + 0.0025643677339078, + 0.0027023110014772, + 0.0028433060512612, + 0.0029874153568025, + 0.0031346984511728, + 0.0032852124303662, + 0.0034390123581190, + 0.0035961515940931, + 0.0037566820618961, + 0.0039206544694386, + 0.0040881184912194, + 0.0042591229199617, + 0.0044337157933972, + 0.0046119445007641, + 0.0047938558726415, + 0.0049794962570131, + 0.0051689115838900, + 0.0053621474203763, + 0.0055592490177131, + 0.0057602613515573, + 0.0059652291565289, + 0.0061741969558843, + 0.0063872090870253, + 0.0066043097234387, + 0.0068255428935640, + 0.0070509524970088, + 0.0072805823184660, + 0.0075144760396340, + 0.0077526772493942, + 0.0079952294524673, + 0.0082421760767325, + 0.0084935604793733, + 0.0087494259519870, + 0.0090098157247792, + 0.0092747729699467, + 0.0095443408043399, + 0.0098185622914832, + 0.0100974804430226, + 0.0103811382196612, + 0.0106695785316351, + 0.0109628442387771, + 0.0112609781502091, + 0.0115640230236993, + 0.0118720215647169, + 0.0121850164252137, + 0.0125030502021561, + 0.0128261654358321, + 0.0131544046079532, + 0.0134878101395681, + 0.0138264243888068, + 0.0141702896484671, + 0.0145194481434592, + 0.0148739420281182, + 0.0152338133833959, + 0.0155991042139432, + 0.0159698564450882, + 0.0163461119197227, + 0.0167279123950996, + 0.0171152995395520, + 0.0175083149291368, + 0.0179070000442104, + 0.0183113962659409, + 0.0187215448727609, + 0.0191374870367659, + 0.0195592638200623, + 0.0199869161710679, + 0.0204204849207691, + 0.0208600107789370, + 0.0213055343303066, + 0.0217570960307201, + 0.0222147362032386, + 0.0226784950342228, + 0.0231484125693867, + 0.0236245287098244, + 0.0241068832080138, + 0.0245955156637973, + 0.0250904655203431, + 0.0255917720600868, + 0.0260994744006559, + 0.0266136114907790, + 0.0271342221061795, + 0.0276613448454576, + 0.0281950181259587, + 0.0287352801796329, + 0.0292821690488833, + 0.0298357225824074, + 0.0303959784310299, + 0.0309629740435296, + 0.0315367466624615, + 0.0321173333199732, + 0.0327047708336193, + 0.0332990958021720, + 0.0339003446014307, + 0.0345085533800302, + 0.0351237580552491, + 0.0357459943088193, + 0.0363752975827358, + 0.0370117030750704, + 0.0376552457357870, + 0.0383059602625614, + 0.0389638810966056, + 0.0396290424184964, + 0.0403014781440112, + 0.0409812219199691, + 0.0416683071200799, + 0.0423627668408009, + 0.0430646338972016, + 0.0437739408188385, + 0.0444907198456388, + 0.0452150029237951, + 0.0459468217016708, + 0.0466862075257170, + 0.0474331914364021, + 0.0481878041641539, + 0.0489500761253148, + 0.0497200374181119, + 0.0504977178186404, + 0.0512831467768636, + 0.0520763534126273, + 0.0528773665116913, + 0.0536862145217772, + 0.0545029255486345, + 0.0553275273521232, + 0.0561600473423164, + 0.0570005125756209, + 0.0578489497509179, + 0.0587053852057233, + 0.0595698449123695, + 0.0604423544742077, + 0.0613229391218317, + 0.0622116237093247, + 0.0631084327105284, + 0.0640133902153352, + 0.0649265199260043, + 0.0658478451535027, + 0.0667773888138695, + 0.0677151734246072, + 0.0686612211010977, + 0.0696155535530446, + 0.0705781920809429, + 0.0715491575725758, + 0.0725284704995383, + 0.0735161509137906, + 0.0745122184442388, + 0.0755166922933461, + 0.0765295912337720, + 0.0775509336050437, + 0.0785807373102561, + 0.0796190198128044, + 0.0806657981331473, + 0.0817210888456026, + 0.0827849080751753, + 0.0838572714944183, + 0.0849381943203265, + 0.0860276913112652, + 0.0871257767639319, + 0.0882324645103534, + 0.0893477679149177, + 0.0904716998714418, + 0.0916042728002747, + 0.0927454986454381, + 0.0938953888718020, + 0.0950539544622996, + 0.0962212059151784, + 0.0973971532412897, + 0.0985818059614169, + 0.0997751731036425, + 0.1009772632007537, + 0.1021880842876888, + 0.1034076438990227, + 0.1046359490664932, + 0.1058730063165681, + 0.1071188216680533, + 0.1083734006297428, + 0.1096367481981100, + 0.1109088688550422, + 0.1121897665656167, + 0.1134794447759207, + 0.1147779064109143, + 0.1160851538723372, + 0.1174011890366591, + 0.1187260132530751, + 0.1200596273415457, + 0.1214020315908810, + 0.1227532257568719, + 0.1241132090604651, + 0.1254819801859856, + 0.1268595372794049, + 0.1282458779466558, + 0.1296409992519942, + 0.1310448977164081, + 0.1324575693160745, + 0.1338790094808633, + 0.1353092130928902, + 0.1367481744851168, + 0.1381958874400010, + 0.1396523451881945, + 0.1411175404072910, + 0.1425914652206223, + 0.1440741111961058, + 0.1455654693451402, + 0.1470655301215526, + 0.1485742834205956, + 0.1500917185779945, + 0.1516178243690463, + 0.1531525890077689, + 0.1546960001461024, + 0.1562480448731608, + 0.1578087097145364, + 0.1593779806316558, + 0.1609558430211876, + 0.1625422817145027, + 0.1641372809771871, + 0.1657408245086070, + 0.1673528954415270, + 0.1689734763417811, + 0.1706025492079969, + 0.1722400954713725, + 0.1738860959955082, + 0.1755405310762898, + 0.1772033804418275, + 0.1788746232524467, + 0.1805542381007349, + 0.1822422030116404, + 0.1839384954426268, + 0.1856430922838810, + 0.1873559698585756, + 0.1890771039231862, + 0.1908064696678625, + 0.1925440417168546, + 0.1942897941289937, + 0.1960437003982277, + 0.1978057334542116, + 0.1995758656629525, + 0.2013540688275098, + 0.2031403141887507, + 0.2049345724261595, + 0.2067368136587033, + 0.2085470074457521, + 0.2103651227880538, + 0.2121911281287646, + 0.2140249913545346, + 0.2158666797966480, + 0.2177161602322188, + 0.2195733988854414, + 0.2214383614288963, + 0.2233110129849106, + 0.2251913181269740, + 0.2270792408812093, + 0.2289747447278976, + 0.2308777926030592, + 0.2327883469000885, + 0.2347063694714437, + 0.2366318216303919, + 0.2385646641528076, + 0.2405048572790267, + 0.2424523607157545, + 0.2444071336380283, + 0.2463691346912334, + 0.2483383219931741, + 0.2503146531361985, + 0.2522980851893767, + 0.2542885747007335, + 0.2562860776995335, + 0.2582905496986215, + 0.2603019456968142, + 0.2623202201813464, + 0.2643453271303700, + 0.2663772200155053, + 0.2684158518044454, + 0.2704611749636135, + 0.2725131414608710, + 0.2745717027682799, + 0.2766368098649151, + 0.2787084132397296, + 0.2807864628944707, + 0.2828709083466482, + 0.2849616986325523, + 0.2870587823103237, + 0.2891621074630737, + 0.2912716217020546, + 0.2933872721698803, + 0.2955090055437973, + 0.2976367680390041, + 0.2997705054120213, + 0.3019101629641097, + 0.3040556855447379, + 0.3062070175550981, + 0.3083641029516701, + 0.3105268852498334, + 0.3126953075275265, + 0.3148693124289546, + 0.3170488421683428, + 0.3192338385337370, + 0.3214242428908514, + 0.3236199961869606, + 0.3258210389548392, + 0.3280273113167459, + 0.3302387529884521, + 0.3324553032833160, + 0.3346769011164010, + 0.3369034850086373, + 0.3391349930910280, + 0.3413713631088974, + 0.3436125324261830, + 0.3458584380297697, + 0.3481090165338656, + 0.3503642041844199, + 0.3526239368635820, + 0.3548881500942010, + 0.3571567790443668, + 0.3594297585319891, + 0.3617070230294185, + 0.3639885066681048, + 0.3662741432432950, + 0.3685638662187693, + 0.3708576087316147, + 0.3731553035970366, + 0.3754568833132069, + 0.3777622800661488, + 0.3800714257346570, + 0.3823842518952546, + 0.3847006898271841, + 0.3870206705174334, + 0.3893441246657958, + 0.3916709826899639, + 0.3940011747306560, + 0.3963346306567764, + 0.3986712800706062, + 0.4010110523130271, + 0.4033538764687756, + 0.4056996813717284, + 0.4080483956102172, + 0.4103999475323736, + 0.4127542652515031, + 0.4151112766514873, + 0.4174709093922143, + 0.4198330909150365, + 0.4221977484482556, + 0.4245648090126334, + 0.4269341994269293, + 0.4293058463134616, + 0.4316796761036958, + 0.4340556150438547, + 0.4364335892005536, + 0.4388135244664580, + 0.4411953465659639, + 0.4435789810609000, + 0.4459643533562509, + 0.4483513887059016, + 0.4507400122184019, + 0.4531301488627497, + 0.4555217234741947, + 0.4579146607600593, + 0.4603088853055777, + 0.4627043215797521, + 0.4651008939412254, + 0.4674985266441709, + 0.4698971438441951, + 0.4722966696042580, + 0.4746970279006055, + 0.4770981426287164, + 0.4794999376092619, + 0.4819023365940778, + 0.4843052632721476, + 0.4867086412755978, + 0.4891123941857028, + 0.4915164455388997, + 0.4939207188328126, + 0.4963251375322855, + 0.4987296250754225, + 0.5011341048796359, + 0.5035385003477012, + 0.5059427348738168, + 0.5083467318496706, + 0.5107504146705106, + 0.5131537067412193, + 0.5155565314823923, + 0.5179588123364193, + 0.5203604727735667, + 0.5227614362980630, + 0.5251616264541841, + 0.5275609668323384, + 0.5299593810751532, + 0.5323567928835578, + 0.5347531260228663, + 0.5371483043288580, + 0.5395422517138538, + 0.5419348921727899, + 0.5443261497892862, + 0.5467159487417104, + 0.5491042133092364, + 0.5514908678778958, + 0.5538758369466227, + 0.5562590451332913, + 0.5586404171807443, + 0.5610198779628133, + 0.5633973524903286, + 0.5657727659171199, + 0.5681460435460047, + 0.5705171108347663, + 0.5728858934021188, + 0.5752523170336598, + 0.5776163076878088, + 0.5799777915017323, + 0.5823366947972535, + 0.5846929440867458, + 0.5870464660790119, + 0.5893971876851449, + 0.5917450360243719, + 0.5940899384298793, + 0.5964318224546208, + 0.5987706158771039, + 0.6011062467071583, + 0.6034386431916822, + 0.6057677338203681, + 0.6080934473314057, + 0.6104157127171639, + 0.6127344592298474, + 0.6150496163871310, + 0.6173611139777690, + 0.6196688820671789, + 0.6219728510029997, + 0.6242729514206247, + 0.6265691142487051, + 0.6288612707146283, + 0.6311493523499663, + 0.6334332909958958, + 0.6357130188085891, + 0.6379884682645743, + 0.6402595721660647, + 0.6425262636462578, + 0.6447884761746012, + 0.6470461435620266, + 0.6492991999661505, + 0.6515475798964411, + 0.6537912182193508, + 0.6560300501634142, + 0.6582640113243098, + 0.6604930376698862, + 0.6627170655451516, + 0.6649360316772256, + 0.6671498731802533, + 0.6693585275602818, + 0.6715619327200959, + 0.6737600269640164, + 0.6759527490026566, + 0.6781400379576392, + 0.6803218333662715, + 0.6824980751861787, + 0.6846687037998949, + 0.6868336600194123, + 0.6889928850906855, + 0.6911463206980928, + 0.6932939089688525, + 0.6954355924773949, + 0.6975713142496884, + 0.6997010177675195, + 0.7018246469727265, + 0.7039421462713862, + 0.7060534605379528, + 0.7081585351193496, + 0.7102573158390105, + 0.7123497490008750, + 0.7144357813933307, + 0.7165153602931092, + 0.7185884334691287, + 0.7206549491862871, + 0.7227148562092042, + 0.7247681038059106, + 0.7268146417514855, + 0.7288544203316418, + 0.7308873903462577, + 0.7329135031128549, + 0.7349327104700221, + 0.7369449647807855, + 0.7389502189359237, + 0.7409484263572271, + 0.7429395410007016, + 0.7449235173597176, + 0.7469003104681008, + 0.7488698759031670, + 0.7508321697887005, + 0.7527871487978728, + 0.7547347701561059, + 0.7566749916438754, + 0.7586077715994560, + 0.7605330689216074, + 0.7624508430722016, + 0.7643610540787891, + 0.7662636625371070, + 0.7681586296135255, + 0.7700459170474343, + 0.7719254871535672, + 0.7737973028242671, + 0.7756613275316875, + 0.7775175253299340, + 0.7793658608571425, + 0.7812062993374951, + 0.7830388065831744, + 0.7848633489962533, + 0.7866798935705233, + 0.7884884078932579, + 0.7902888601469138, + 0.7920812191107668, + 0.7938654541624850, + 0.7956415352796368, + 0.7974094330411343, + 0.7991691186286133, + 0.8009205638277465, + 0.8026637410294932, + 0.8043986232312831, + 0.8061251840381346, + 0.8078433976637077, + 0.8095532389312917, + 0.8112546832747255, + 0.8129477067392539, + 0.8146322859823164, + 0.8163083982742698, + 0.8179760214990457, + 0.8196351341547393, + 0.8212857153541345, + 0.8229277448251595, + 0.8245612029112778, + 0.8261860705718113, + 0.8278023293821971, + 0.8294099615341773, + 0.8310089498359212, + 0.8325992777120815, + 0.8341809292037831, + 0.8357538889685445, + 0.8373181422801330, + 0.8388736750283521, + 0.8404204737187619, + 0.8419585254723335, + 0.8434878180250348, + 0.8450083397273509, + 0.8465200795437368, + 0.8480230270520029, + 0.8495171724426350, + 0.8510025065180464, + 0.8524790206917633, + 0.8539467069875448, + 0.8554055580384357, + 0.8568555670857525, + 0.8582967279780043, + 0.8597290351697464, + 0.8611524837203691, + 0.8625670692928198, + 0.8639727881522599, + 0.8653696371646555, + 0.8667576137953045, + 0.8681367161072958, + 0.8695069427599065, + 0.8708682930069319, + 0.8722207666949527, + 0.8735643642615368, + 0.8748990867333771, + 0.8762249357243662, + 0.8775419134336067, + 0.8788500226433579, + 0.8801492667169208, + 0.8814396495964587, + 0.8827211758007560, + 0.8839938504229149, + 0.8852576791279895, + 0.8865126681505587, + 0.8877588242922386, + 0.8889961549191320, + 0.8902246679592184, + 0.8914443718996848, + 0.8926552757841945, + 0.8938573892100969, + 0.8950507223255798, + 0.8962352858267605, + 0.8974110909547198, + 0.8985781494924783, + 0.8997364737619142, + 0.9008860766206249, + 0.9020269714587307, + 0.9031591721956235, + 0.9042826932766591, + 0.9053975496697941, + 0.9065037568621681, + 0.9076013308566311, + 0.9086902881682180, + 0.9097706458205682, + 0.9108424213422940, + 0.9119056327632955, + 0.9129602986110235, + 0.9140064379066919, + 0.9150440701614393, + 0.9160732153724396, + 0.9170938940189634, + 0.9181061270583908, + 0.9191099359221748, + 0.9201053425117579, + 0.9210923691944400, + 0.9220710387992010, + 0.9230413746124764, + 0.9240034003738882, + 0.9249571402719298, + 0.9259026189396085, + 0.9268398614500427, + 0.9277688933120170, + 0.9286897404654957, + 0.9296024292770939, + 0.9305069865355076, + 0.9314034394469048, + 0.9322918156302762, + 0.9331721431127471, + 0.9340444503248519, + 0.9349087660957711, + 0.9357651196485313, + 0.9366135405951697, + 0.9374540589318637, + 0.9382867050340261, + 0.9391115096513655, + 0.9399285039029165, + 0.9407377192720349, + 0.9415391876013639, + 0.9423329410877687, + 0.9431190122772415, + 0.9438974340597782, + 0.9446682396642262, + 0.9454314626531054, + 0.9461871369174033, + 0.9469352966713429, + 0.9476759764471278, + 0.9484092110896616, + 0.9491350357512457, + 0.9498534858862532, + 0.9505645972457831, + 0.9512684058722927, + 0.9519649480942105, + 0.9526542605205314, + 0.9533363800353921, + 0.9540113437926313, + 0.9546791892103320, + 0.9553399539653500, + 0.9559936759878265, + 0.9566403934556893, + 0.9572801447891388, + 0.9579129686451244, + 0.9585389039118085, + 0.9591579897030224, + 0.9597702653527108, + 0.9603757704093711, + 0.9609745446304828, + 0.9615666279769324, + 0.9621520606074324, + 0.9627308828729358, + 0.9633031353110477, + 0.9638688586404335, + 0.9644280937552258, + 0.9649808817194311, + 0.9655272637613366, + 0.9660672812679171, + 0.9666009757792454, + 0.9671283889829055, + 0.9676495627084089, + 0.9681645389216160, + 0.9686733597191652, + 0.9691760673229058, + 0.9696727040743406, + 0.9701633124290767, + 0.9706479349512860, + 0.9711266143081750, + 0.9715993932644684, + 0.9720663146769026, + 0.9725274214887337, + 0.9729827567242596, + 0.9734323634833574, + 0.9738762849360358, + 0.9743145643170059, + 0.9747472449202687, + 0.9751743700937215, + 0.9755959832337850, + 0.9760121277800496, + 0.9764228472099433, + 0.9768281850334235, + 0.9772281847876897, + 0.9776228900319223, + 0.9780123443420448, + 0.9783965913055132, + 0.9787756745161313, + 0.9791496375688939, + 0.9795185240548578, + 0.9798823775560431, + 0.9802412416403639, + 0.9805951598565897, + 0.9809441757293399, + 0.9812883327541090, + 0.9816276743923267, + 0.9819622440664515, + 0.9822920851550995, + 0.9826172409882086, + 0.9829377548422400, + 0.9832536699354163, + 0.9835650294229984, + 0.9838718763926001, + 0.9841742538595437, + 0.9844722047622547, + 0.9847657719576983, + 0.9850549982168574, + 0.9853399262202529, + 0.9856205985535073, + 0.9858970577029519, + 0.9861693460512790, + 0.9864375058732389, + 0.9867015793313820, + 0.9869616084718489, + 0.9872176352202061, + 0.9874697013773301, + 0.9877178486153397, + 0.9879621184735767, + 0.9882025523546365, + 0.9884391915204485, + 0.9886720770884069, + 0.9889012500275530, + 0.9891267511548089, + 0.9893486211312621, + 0.9895669004585049, + 0.9897816294750255, + 0.9899928483526520, + 0.9902005970930525, + 0.9904049155242876, + 0.9906058432974180, + 0.9908034198831690, + 0.9909976845686489, + 0.9911886764541239, + 0.9913764344498495, + 0.9915609972729590, + 0.9917424034444086, + 0.9919206912859797, + 0.9920958989173397, + 0.9922680642531603, + 0.9924372250002933, + 0.9926034186550070, + 0.9927666825002789, + 0.9929270536031491, + 0.9930845688121325, + 0.9932392647546895, + 0.9933911778347579, + 0.9935403442303433, + 0.9936867998911693, + 0.9938305805363887, + 0.9939717216523539, + 0.9941102584904481, + 0.9942462260649764, + 0.9943796591511174, + 0.9945105922829353, + 0.9946390597514524, + 0.9947650956027824, + 0.9948887336363228, + 0.9950100074030103, + 0.9951289502036336, + 0.9952455950872091, + 0.9953599748494155, + 0.9954721220310890, + 0.9955820689167787, + 0.9956898475333619, + 0.9957954896487196, + 0.9958990267704713, + 0.9960004901447701, + 0.9960999107551559, + 0.9961973193214694, + 0.9962927462988245, + 0.9963862218766388, + 0.9964777759777242, + 0.9965674382574342, + 0.9966552381028704, + 0.9967412046321465, + 0.9968253666937095, + 0.9969077528657186, + 0.9969883914554805, + 0.9970673104989413, + 0.9971445377602348, + 0.9972201007312871, + 0.9972940266314749, + 0.9973663424073412, + 0.9974370747323638, + 0.9975062500067785, + 0.9975738943574574, + 0.9976400336378379, + 0.9977046934279079, + 0.9977678990342401, + 0.9978296754900812, + 0.9978900475554902, + 0.9979490397175296, + 0.9980066761905056, + 0.9980629809162593, + 0.9981179775645063, + 0.9981716895332257, + 0.9982241399490979, + 0.9982753516679893, + 0.9983253472754841, + 0.9983741490874634, + 0.9984217791507299, + 0.9984682592436778, + 0.9985136108770075, + 0.9985578552944850, + 0.9986010134737439, + 0.9986431061271304, + 0.9986841537025921, + 0.9987241763846056, + 0.9987631940951476, + 0.9988012264947044, + 0.9988382929833222, + 0.9988744127016956, + 0.9989096045322947, + 0.9989438871005292, + 0.9989772787759494, + 0.9990097976734847, + 0.9990414616547146, + 0.9990722883291779, + 0.9991022950557125, + 0.9991314989438310, + 0.9991599168551279, + 0.9991875654047181, + 0.9992144609627068, + 0.9992406196556911, + 0.9992660573682882, + 0.9992907897446957, + 0.9993148321902777, + 0.9993381998731797, + 0.9993609077259696, + 0.9993829704473038, + 0.9994044025036201, + 0.9994252181308537, + 0.9994454313361775, + 0.9994650558997651, + 0.9994841053765757, + 0.9995025930981609, + 0.9995205321744921, + 0.9995379354958073, + 0.9995548157344778, + 0.9995711853468930, + 0.9995870565753632, + 0.9996024414500382, + 0.9996173517908444, + 0.9996317992094352, + 0.9996457951111574, + 0.9996593506970310, + 0.9996724769657434, + 0.9996851847156547, + 0.9996974845468164, + 0.9997093868630000, + 0.9997209018737374, + 0.9997320395963699, + 0.9997428098581069, + 0.9997532222980933, + 0.9997632863694836, + 0.9997730113415246, + 0.9997824063016426, + 0.9997914801575380, + 0.9998002416392840, + 0.9998086993014300, + 0.9998168615251084, + 0.9998247365201450, + 0.9998323323271717, + 0.9998396568197407, + 0.9998467177064404, + 0.9998535225330116, + 0.9998600786844637, + 0.9998663933871905, + 0.9998724737110845, + 0.9998783265716498, + 0.9998839587321121, + 0.9998893768055266, + 0.9998945872568815, + 0.9998995964051983, + 0.9999044104256269, + 0.9999090353515359, + 0.9999134770765971, + 0.9999177413568642, + 0.9999218338128448, + 0.9999257599315647, + 0.9999295250686255, + 0.9999331344502529, + 0.9999365931753376, + 0.9999399062174669, + 0.9999430784269460, + 0.9999461145328103, + 0.9999490191448277, + 0.9999517967554878, + 0.9999544517419835, + 0.9999569883681778, + 0.9999594107865607, + 0.9999617230401926, + 0.9999639290646355, + 0.9999660326898712, + 0.9999680376422052, + 0.9999699475461585, + 0.9999717659263435, + 0.9999734962093266, + 0.9999751417254756, + 0.9999767057107922, + 0.9999781913087290, + 0.9999796015719915, + 0.9999809394643231, + 0.9999822078622751, + 0.9999834095569596, + 0.9999845472557860, + 0.9999856235841805, + 0.9999866410872889, + 0.9999876022316609, + 0.9999885094069193, + 0.9999893649274085, + 0.9999901710338274, + 0.9999909298948430, + 0.9999916436086862, + 0.9999923142047299, + 0.9999929436450469, + 0.9999935338259505, + 0.9999940865795161, + 0.9999946036750835, + 0.9999950868207405, + 0.9999955376647868, + 0.9999959577971798, + 0.9999963487509599, + 0.9999967120036571, + 0.9999970489786785, + 0.9999973610466748, + 0.9999976495268890, + 0.9999979156884846, + 0.9999981607518545, + 0.9999983858899099, + 0.9999985922293493, + 0.9999987808519092, + 0.9999989527955938, + 0.9999991090558848, + 0.9999992505869332, + 0.9999993783027293, + 0.9999994930782556, + 0.9999995957506171, + 0.9999996871201549, + 0.9999997679515386, + 0.9999998389748399, + 0.9999999008865869, + 0.9999999543507984 +}; -real_t kbd_short[] = +real_t kbd_short_128[] = { 4.3795702929468881e-005, 0.00011867384265436617, @@ -1191,6 +2156,2382 @@ real_t kbd_short[] = 0.99999999904096815 }; +real_t kbd_short_120[] = +{ + 0.0000452320086910, + 0.0001274564692111, + 0.0002529398385345, + 0.0004335140496648, + 0.0006827100966952, + 0.0010158708222246, + 0.0014502162869659, + 0.0020048865156264, + 0.0027009618393178, + 0.0035614590925043, + 0.0046113018122711, + 0.0058772627936484, + 0.0073878776584103, + 0.0091733284512589, + 0.0112652966728373, + 0.0136967855861945, + 0.0165019120857793, + 0.0197156688892217, + 0.0233736582950619, + 0.0275117992367496, + 0.0321660098468534, + 0.0373718682174417, + 0.0431642544948834, + 0.0495769778717676, + 0.0566423924273392, + 0.0643910061132260, + 0.0728510874761729, + 0.0820482749475221, + 0.0920051937045235, + 0.1027410852163450, + 0.1142714546239370, + 0.1266077410648368, + 0.1397570159398145, + 0.1537217139274270, + 0.1684994012857075, + 0.1840825856392944, + 0.2004585710384133, + 0.2176093615976121, + 0.2355116164824983, + 0.2541366584185075, + 0.2734505372545160, + 0.2934141494343369, + 0.3139834135200387, + 0.3351095011824163, + 0.3567391223361566, + 0.3788148623608774, + 0.4012755686250732, + 0.4240567828288110, + 0.4470912150133537, + 0.4703092544619664, + 0.4936395121456694, + 0.5170093888596962, + 0.5403456627591340, + 0.5635750896430154, + 0.5866250090612892, + 0.6094239491338723, + 0.6319022228794100, + 0.6539925088563087, + 0.6756304090216887, + 0.6967549769155277, + 0.7173092095766250, + 0.7372404969921184, + 0.7565010233699827, + 0.7750481150999984, + 0.7928445309277697, + 0.8098586906021583, + 0.8260648390616000, + 0.8414431440907889, + 0.8559797262966709, + 0.8696666212110165, + 0.8825016743142358, + 0.8944883707784486, + 0.9056356027326216, + 0.9159573778427816, + 0.9254724739583072, + 0.9342040454819434, + 0.9421791879559176, + 0.9494284680976784, + 0.9559854271440150, + 0.9618860658493898, + 0.9671683198119525, + 0.9718715339497299, + 0.9760359449042233, + 0.9797021798981759, + 0.9829107801140203, + 0.9857017559923277, + 0.9881141809867999, + 0.9901858292742826, + 0.9919528617340944, + 0.9934495632180476, + 0.9947081327749199, + 0.9957585271195989, + 0.9966283562984427, + 0.9973428292485683, + 0.9979247458259197, + 0.9983945309245774, + 0.9987703055583410, + 0.9990679892449266, + 0.9993014277313617, + 0.9994825400228521, + 0.9996214788122335, + 0.9997267987294857, + 0.9998056273097539, + 0.9998638341781910, + 0.9999061946325793, + 0.9999365445321382, + 0.9999579241373735, + 0.9999727092594598, + 0.9999827287418790, + 0.9999893678912771, + 0.9999936579844555, + 0.9999963523959187, + 0.9999979902130101, + 0.9999989484358076, + 0.9999994840031031, + 0.9999997669534347, + 0.9999999060327799, + 0.9999999680107184, + 0.9999999918774242, + 0.9999999989770326 +}; + +#else + +real_t kbd_long_1024[] = +{ + 0x132C5, + 0x1C2DF, + 0x23D4C, + 0x2AEA1, + 0x31B8E, + 0x38665, + 0x3F07E, + 0x45AB3, + 0x4C598, + 0x53198, + 0x59F03, + 0x60E18, + 0x67F08, + 0x6F1FB, + 0x76714, + 0x7DE70, + 0x85828, + 0x8D455, + 0x95308, + 0x9D456, + 0xA5850, + 0xADF05, + 0xB6884, + 0xBF4DB, + 0xC8419, + 0xD1649, + 0xDAB78, + 0xE43B3, + 0xEDF05, + 0xF7D79, + 0x101F1B, + 0x10C3F5, + 0x116C13, + 0x12177F, + 0x12C644, + 0x13786C, + 0x142E01, + 0x14E70D, + 0x15A39B, + 0x1663B5, + 0x172764, + 0x17EEB2, + 0x18B9AA, + 0x198856, + 0x1A5ABE, + 0x1B30ED, + 0x1C0AED, + 0x1CE8C7, + 0x1DCA84, + 0x1EB030, + 0x1F99D2, + 0x208776, + 0x217924, + 0x226EE6, + 0x2368C6, + 0x2466CD, + 0x256905, + 0x266F77, + 0x277A2D, + 0x288930, + 0x299C8A, + 0x2AB445, + 0x2BD069, + 0x2CF101, + 0x2E1616, + 0x2F3FB1, + 0x306DDC, + 0x31A0A0, + 0x32D806, + 0x341419, + 0x3554E1, + 0x369A68, + 0x37E4B7, + 0x3933D7, + 0x3A87D3, + 0x3BE0B3, + 0x3D3E80, + 0x3EA144, + 0x400908, + 0x4175D6, + 0x42E7B6, + 0x445EB3, + 0x45DAD4, + 0x475C24, + 0x48E2AB, + 0x4A6E73, + 0x4BFF84, + 0x4D95E9, + 0x4F31AA, + 0x50D2CF, + 0x527963, + 0x54256E, + 0x55D6F9, + 0x578E0D, + 0x594AB4, + 0x5B0CF5, + 0x5CD4DA, + 0x5EA26C, + 0x6075B3, + 0x624EB9, + 0x642D86, + 0x661223, + 0x67FC98, + 0x69ECEE, + 0x6BE32E, + 0x6DDF61, + 0x6FE18F, + 0x71E9C0, + 0x73F7FD, + 0x760C4F, + 0x7826BD, + 0x7A4751, + 0x7C6E12, + 0x7E9B0A, + 0x80CE3F, + 0x8307BA, + 0x854784, + 0x878DA5, + 0x89DA24, + 0x8C2D09, + 0x8E865E, + 0x90E628, + 0x934C71, + 0x95B940, + 0x982C9D, + 0x9AA690, + 0x9D2720, + 0x9FAE55, + 0xA23C37, + 0xA4D0CD, + 0xA76C1E, + 0xAA0E31, + 0xACB70F, + 0xAF66BF, + 0xB21D47, + 0xB4DAAF, + 0xB79EFD, + 0xBA6A3A, + 0xBD3C6C, + 0xC01599, + 0xC2F5C9, + 0xC5DD03, + 0xC8CB4D, + 0xCBC0AD, + 0xCEBD2B, + 0xD1C0CD, + 0xD4CB99, + 0xD7DD96, + 0xDAF6C9, + 0xDE173A, + 0xE13EEF, + 0xE46DED, + 0xE7A43B, + 0xEAE1DE, + 0xEE26DC, + 0xF1733C, + 0xF4C702, + 0xF82235, + 0xFB84DA, + 0xFEEEF7, + 0x1026090, + 0x105D9AC, + 0x1095A50, + 0x10CE280, + 0x1107242, + 0x114099A, + 0x117A88E, + 0x11B4F24, + 0x11EFD5E, + 0x122B342, + 0x12670D4, + 0x12A361A, + 0x12E0318, + 0x131D7D0, + 0x135B44A, + 0x1399886, + 0x13D848C, + 0x141785E, + 0x14573FE, + 0x1497774, + 0x14D82C2, + 0x15195E8, + 0x155B0F0, + 0x159D3D8, + 0x15DFEA6, + 0x162315C, + 0x1666BFE, + 0x16AAE8E, + 0x16EF910, + 0x1734B86, + 0x177A5F4, + 0x17C085A, + 0x18072BE, + 0x184E520, + 0x1895F84, + 0x18DE1EA, + 0x1926C56, + 0x196FEC8, + 0x19B9946, + 0x1A03BCE, + 0x1A4E662, + 0x1A99904, + 0x1AE53B8, + 0x1B3167C, + 0x1B7E152, + 0x1BCB43E, + 0x1C18F3E, + 0x1C67254, + 0x1CB5D80, + 0x1D050C4, + 0x1D54C20, + 0x1DA4F96, + 0x1DF5B24, + 0x1E46ECC, + 0x1E98A8C, + 0x1EEAE68, + 0x1F3DA5E, + 0x1F90E6C, + 0x1FE4A94, + 0x2038ED8, + 0x208DB30, + 0x20E2FA4, + 0x2138C2C, + 0x218F0D0, + 0x21E5D84, + 0x223D250, + 0x2294F30, + 0x22ED420, + 0x2346124, + 0x239F634, + 0x23F9354, + 0x2453880, + 0x24AE5B8, + 0x2509AF8, + 0x2565840, + 0x25C1D88, + 0x261EAD4, + 0x267C024, + 0x26D9D6C, + 0x27382B0, + 0x2796FEC, + 0x27F651C, + 0x2856240, + 0x28B6754, + 0x2917450, + 0x2978938, + 0x29DA604, + 0x2A3CAB0, + 0x2A9F738, + 0x2B02BA0, + 0x2B667D8, + 0x2BCABE4, + 0x2C2F7C0, + 0x2C94B64, + 0x2CFA6CC, + 0x2D609F8, + 0x2DC74DC, + 0x2E2E77C, + 0x2E961CC, + 0x2EFE3C8, + 0x2F66D6C, + 0x2FCFEB8, + 0x30397A0, + 0x30A381C, + 0x310E030, + 0x3178FD0, + 0x31E46F8, + 0x32505A0, + 0x32BCBC4, + 0x3329960, + 0x3396E68, + 0x3404AD8, + 0x3472EAC, + 0x34E19DC, + 0x3550C60, + 0x35C0634, + 0x363074C, + 0x36A0FA8, + 0x3711F38, + 0x37835FC, + 0x37F53EC, + 0x38678FC, + 0x38DA528, + 0x394D868, + 0x39C12B4, + 0x3A35400, + 0x3AA9C48, + 0x3B1EB84, + 0x3B941AC, + 0x3C09EB4, + 0x3C80298, + 0x3CF6D4C, + 0x3D6DEC8, + 0x3DE5704, + 0x3E5D5F4, + 0x3ED5B94, + 0x3F4E7D8, + 0x3FC7AB4, + 0x4041428, + 0x40BB418, + 0x4135A90, + 0x41B0778, + 0x422BAD0, + 0x42A7488, + 0x4323490, + 0x439FAE8, + 0x441C780, + 0x4499A50, + 0x4517350, + 0x4595270, + 0x46137A8, + 0x46922F0, + 0x4711438, + 0x4790B78, + 0x48108A0, + 0x4890BB0, + 0x4911490, + 0x4992340, + 0x4A137A8, + 0x4A951C8, + 0x4B17188, + 0x4B996E8, + 0x4C1C1D8, + 0x4C9F250, + 0x4D22838, + 0x4DA6390, + 0x4E2A448, + 0x4EAEA50, + 0x4F335A0, + 0x4FB8628, + 0x503DBE0, + 0x50C36B0, + 0x51496A0, + 0x51CFB90, + 0x5256578, + 0x52DD450, + 0x5364808, + 0x53EC090, + 0x5473DD8, + 0x54FBFE0, + 0x5584690, + 0x560D1D8, + 0x56961B8, + 0x571F610, + 0x57A8EE0, + 0x5832C18, + 0x58BCDA0, + 0x5947378, + 0x59D1D88, + 0x5A5CBC0, + 0x5AE7E20, + 0x5B73488, + 0x5BFEEF8, + 0x5C8AD58, + 0x5D16FA0, + 0x5DA35B8, + 0x5E2FFA0, + 0x5EBCD40, + 0x5F49E80, + 0x5FD7368, + 0x6064BD0, + 0x60F27C0, + 0x6180718, + 0x620E9D0, + 0x629CFD8, + 0x632B920, + 0x63BA598, + 0x6449530, + 0x64D87D8, + 0x6567D88, + 0x65F7628, + 0x66871B0, + 0x6717008, + 0x67A7128, + 0x68374F8, + 0x68C7B68, + 0x6958478, + 0x69E9000, + 0x6A79E08, + 0x6B0AE70, + 0x6B9C128, + 0x6C2D628, + 0x6CBED60, + 0x6D506B8, + 0x6DE2220, + 0x6E73F90, + 0x6F05EF8, + 0x6F98040, + 0x702A358, + 0x70BC830, + 0x714EEC0, + 0x71E16E8, + 0x72740A8, + 0x7306BE8, + 0x7399898, + 0x742C6A0, + 0x74BF5F8, + 0x7552698, + 0x75E5858, + 0x7678B38, + 0x770BF28, + 0x779F410, + 0x78329E0, + 0x78C6090, + 0x7959800, + 0x79ED028, + 0x7A80900, + 0x7B14260, + 0x7BA7C50, + 0x7C3B6B0, + 0x7CCF170, + 0x7D62C88, + 0x7DF67E0, + 0x7E8A368, + 0x7F1DF10, + 0x7FB1AC8, + 0x8045670, + 0x80D9210, + 0x816CD90, + 0x82008E0, + 0x82943E0, + 0x8327E80, + 0x83BB8C0, + 0x844F290, + 0x84E2BD0, + 0x8576470, + 0x8609C60, + 0x869D3A0, + 0x8730A10, + 0x87C3FA0, + 0x8857440, + 0x88EA7E0, + 0x897DA60, + 0x8A10BD0, + 0x8AA3C10, + 0x8B36B00, + 0x8BC98A0, + 0x8C5C4E0, + 0x8CEEFB0, + 0x8D818F0, + 0x8E14090, + 0x8EA6690, + 0x8F38AE0, + 0x8FCAD60, + 0x905CE10, + 0x90EECC0, + 0x9180990, + 0x9212440, + 0x92A3CE0, + 0x9335350, + 0x93C6780, + 0x9457960, + 0x94E88F0, + 0x9579610, + 0x960A0B0, + 0x969A8C0, + 0x972AE30, + 0x97BB0F0, + 0x984B100, + 0x98DAE30, + 0x996A890, + 0x99FA000, + 0x9A89470, + 0x9B185D0, + 0x9BA7410, + 0x9C35F30, + 0x9CC4700, + 0x9D52B90, + 0x9DE0CC0, + 0x9E6EA90, + 0x9EFC4E0, + 0x9F89BA0, + 0xA016ED0, + 0xA0A3E50, + 0xA130A10, + 0xA1BD210, + 0xA249640, + 0xA2D5690, + 0xA3612E0, + 0xA3ECB30, + 0xA477F70, + 0xA502F90, + 0xA58DB80, + 0xA618330, + 0xA6A26A0, + 0xA72C5A0, + 0xA7B6050, + 0xA83F670, + 0xA8C8820, + 0xA951530, + 0xA9D9DA0, + 0xAA62170, + 0xAAEA070, + 0xAB71AB0, + 0xABF9010, + 0xAC80090, + 0xAD06C10, + 0xAD8D2A0, + 0xAE13410, + 0xAE99070, + 0xAF1E7A0, + 0xAFA39A0, + 0xB028650, + 0xB0ACDC0, + 0xB130FD0, + 0xB1B4C70, + 0xB2383A0, + 0xB2BB540, + 0xB33E160, + 0xB3C07D0, + 0xB4428B0, + 0xB4C43D0, + 0xB545930, + 0xB5C68C0, + 0xB647270, + 0xB6C7650, + 0xB747430, + 0xB7C6C20, + 0xB845E00, + 0xB8C49D0, + 0xB942F90, + 0xB9C0F10, + 0xBA3E870, + 0xBABBB80, + 0xBB38850, + 0xBBB4ED0, + 0xBC30EF0, + 0xBCAC8A0, + 0xBD27BE0, + 0xBDA28A0, + 0xBE1CED0, + 0xBE96E80, + 0xBF10780, + 0xBF899E0, + 0xC0025A0, + 0xC07AA90, + 0xC0F28D0, + 0xC16A030, + 0xC1E10C0, + 0xC257A80, + 0xC2CDD40, + 0xC343920, + 0xC3B8E00, + 0xC42DBE0, + 0xC4A22B0, + 0xC516270, + 0xC589B20, + 0xC5FCCA0, + 0xC66F6F0, + 0xC6E1A10, + 0xC7535F0, + 0xC7C4A90, + 0xC8357F0, + 0xC8A5DF0, + 0xC915C90, + 0xC9853D0, + 0xC9F43B0, + 0xCA62C20, + 0xCAD0D20, + 0xCB3E690, + 0xCBAB880, + 0xCC182F0, + 0xCC845D0, + 0xCCF0110, + 0xCD5B4B0, + 0xCDC60B0, + 0xCE30510, + 0xCE9A1C0, + 0xCF036B0, + 0xCF6C3F0, + 0xCFD4970, + 0xD03C720, + 0xD0A3D10, + 0xD10AB30, + 0xD171180, + 0xD1D6FF0, + 0xD23C680, + 0xD2A1530, + 0xD305C00, + 0xD369AF0, + 0xD3CD1E0, + 0xD4300E0, + 0xD4927F0, + 0xD4F4710, + 0xD555E20, + 0xD5B6D40, + 0xD617450, + 0xD677360, + 0xD6D6A60, + 0xD735950, + 0xD794030, + 0xD7F1F00, + 0xD84F5C0, + 0xD8AC460, + 0xD908AF0, + 0xD964960, + 0xD9BFFB0, + 0xDA1ADE0, + 0xDA753E0, + 0xDACF1D0, + 0xDB28790, + 0xDB81530, + 0xDBD9AA0, + 0xDC317F0, + 0xDC88D10, + 0xDCDFA00, + 0xDD35ED0, + 0xDD8BB70, + 0xDDE0FE0, + 0xDE35C20, + 0xDE8A030, + 0xDEDDC10, + 0xDF30FD0, + 0xDF83B50, + 0xDFD5EB0, + 0xE0279E0, + 0xE078CE0, + 0xE0C97B0, + 0xE119A60, + 0xE1694E0, + 0xE1B8730, + 0xE207150, + 0xE255350, + 0xE2A2D30, + 0xE2EFEE0, + 0xE33C870, + 0xE3889E0, + 0xE3D4330, + 0xE41F460, + 0xE469D70, + 0xE4B3E60, + 0xE4FD740, + 0xE546810, + 0xE58F0C0, + 0xE5D7160, + 0xE61EA00, + 0xE665A80, + 0xE6AC300, + 0xE6F2380, + 0xE737BF0, + 0xE77CC70, + 0xE7C14E0, + 0xE805560, + 0xE848DF0, + 0xE88BE90, + 0xE8CE740, + 0xE910800, + 0xE9520E0, + 0xE9931D0, + 0xE9D3AF0, + 0xEA13C30, + 0xEA535A0, + 0xEA92740, + 0xEAD1110, + 0xEB0F310, + 0xEB4CD50, + 0xEB89FE0, + 0xEBC6AB0, + 0xEC02DC0, + 0xEC3E930, + 0xEC79CF0, + 0xECB4900, + 0xECEED80, + 0xED28A60, + 0xED61FB0, + 0xED9AD70, + 0xEDD33B0, + 0xEE0B260, + 0xEE429A0, + 0xEE79960, + 0xEEB01B0, + 0xEEE6290, + 0xEF1BC20, + 0xEF50E40, + 0xEF85910, + 0xEFB9C90, + 0xEFED8C0, + 0xF020DB0, + 0xF053B60, + 0xF0861E0, + 0xF0B8130, + 0xF0E9960, + 0xF11AA60, + 0xF14B450, + 0xF17B730, + 0xF1AB300, + 0xF1DA7C0, + 0xF209590, + 0xF237C70, + 0xF265C60, + 0xF293570, + 0xF2C0790, + 0xF2ED2F0, + 0xF319770, + 0xF345530, + 0xF370C30, + 0xF39BC80, + 0xF3C6620, + 0xF3F0910, + 0xF41A570, + 0xF443B30, + 0xF46CA60, + 0xF495310, + 0xF4BD550, + 0xF4E5110, + 0xF50C660, + 0xF533550, + 0xF559DE0, + 0xF580030, + 0xF5A5C20, + 0xF5CB1E0, + 0xF5F0160, + 0xF614AB0, + 0xF638DE0, + 0xF65CAF0, + 0xF6801F0, + 0xF6A32E0, + 0xF6C5DD0, + 0xF6E82C0, + 0xF70A1C0, + 0xF72BAE0, + 0xF74CE20, + 0xF76DB90, + 0xF78E330, + 0xF7AE510, + 0xF7CE130, + 0xF7ED7A0, + 0xF80C870, + 0xF82B3A0, + 0xF849940, + 0xF867950, + 0xF8853E0, + 0xF8A2900, + 0xF8BF8B0, + 0xF8DC2F0, + 0xF8F87E0, + 0xF914780, + 0xF9301D0, + 0xF94B6F0, + 0xF9666D0, + 0xF981180, + 0xF99B720, + 0xF9B57A0, + 0xF9CF310, + 0xF9E8970, + 0xFA01AE0, + 0xFA1A760, + 0xFA32EF0, + 0xFA4B1B0, + 0xFA62F90, + 0xFA7A8A0, + 0xFA91D00, + 0xFAA8CA0, + 0xFABF790, + 0xFAD5DE0, + 0xFAEBF90, + 0xFB01CB0, + 0xFB17540, + 0xFB2C960, + 0xFB41900, + 0xFB56440, + 0xFB6AB20, + 0xFB7EDA0, + 0xFB92BE0, + 0xFBA65D0, + 0xFBB9B80, + 0xFBCCD00, + 0xFBDFA60, + 0xFBF23A0, + 0xFC048D0, + 0xFC169F0, + 0xFC28710, + 0xFC3A030, + 0xFC4B570, + 0xFC5C6C0, + 0xFC6D430, + 0xFC7DDD0, + 0xFC8E3B0, + 0xFC9E5C0, + 0xFCAE430, + 0xFCBDEE0, + 0xFCCD5F0, + 0xFCDC960, + 0xFCEB950, + 0xFCFA5A0, + 0xFD08E80, + 0xFD173E0, + 0xFD255E0, + 0xFD33470, + 0xFD40FA0, + 0xFD4E790, + 0xFD5BC30, + 0xFD68D80, + 0xFD75BB0, + 0xFD826A0, + 0xFD8EE70, + 0xFD9B320, + 0xFDA74C0, + 0xFDB3350, + 0xFDBEEE0, + 0xFDCA770, + 0xFDD5D10, + 0xFDE0FC0, + 0xFDEBFA0, + 0xFDF6C90, + 0xFE016C0, + 0xFE0BE30, + 0xFE162D0, + 0xFE204C0, + 0xFE2A400, + 0xFE34090, + 0xFE3DA90, + 0xFE471F0, + 0xFE506C0, + 0xFE59910, + 0xFE628E0, + 0xFE6B630, + 0xFE74120, + 0xFE7C9A0, + 0xFE84FC0, + 0xFE8D390, + 0xFE95500, + 0xFE9D440, + 0xFEA5130, + 0xFEACBE0, + 0xFEB4460, + 0xFEBBAC0, + 0xFEC2EF0, + 0xFECA110, + 0xFED1120, + 0xFED7F10, + 0xFEDEB00, + 0xFEE5500, + 0xFEEBCF0, + 0xFEF2300, + 0xFEF8720, + 0xFEFE960, + 0xFF049B0, + 0xFF0A840, + 0xFF10500, + 0xFF15FF0, + 0xFF1B920, + 0xFF21090, + 0xFF26650, + 0xFF2BA60, + 0xFF30CC0, + 0xFF35D90, + 0xFF3ACB0, + 0xFF3FA50, + 0xFF44650, + 0xFF490D0, + 0xFF4D9C0, + 0xFF52140, + 0xFF56740, + 0xFF5ABD0, + 0xFF5EF00, + 0xFF630C0, + 0xFF67120, + 0xFF6B020, + 0xFF6EDD0, + 0xFF72A30, + 0xFF76550, + 0xFF79F20, + 0xFF7D7B0, + 0xFF80F10, + 0xFF84530, + 0xFF87A30, + 0xFF8ADF0, + 0xFF8E0A0, + 0xFF91220, + 0xFF94280, + 0xFF971E0, + 0xFF9A020, + 0xFF9CD50, + 0xFF9F980, + 0xFFA24A0, + 0xFFA4ED0, + 0xFFA7800, + 0xFFAA030, + 0xFFAC780, + 0xFFAEDE0, + 0xFFB1350, + 0xFFB37E0, + 0xFFB5B90, + 0xFFB7E60, + 0xFFBA050, + 0xFFBC180, + 0xFFBE1D0, + 0xFFC0160, + 0xFFC2020, + 0xFFC3E20, + 0xFFC5B60, + 0xFFC77E0, + 0xFFC93B0, + 0xFFCAEC0, + 0xFFCC930, + 0xFFCE2E0, + 0xFFCFBF0, + 0xFFD1450, + 0xFFD2C10, + 0xFFD4340, + 0xFFD59C0, + 0xFFD6FB0, + 0xFFD8500, + 0xFFD99C0, + 0xFFDAE00, + 0xFFDC1A0, + 0xFFDD4C0, + 0xFFDE750, + 0xFFDF970, + 0xFFE0B00, + 0xFFE1C10, + 0xFFE2CA0, + 0xFFE3CC0, + 0xFFE4C70, + 0xFFE5BA0, + 0xFFE6A70, + 0xFFE78C0, + 0xFFE86B0, + 0xFFE9430, + 0xFFEA150, + 0xFFEAE10, + 0xFFEBA60, + 0xFFEC650, + 0xFFED1F0, + 0xFFEDD30, + 0xFFEE820, + 0xFFEF2B0, + 0xFFEFCE0, + 0xFFF06D0, + 0xFFF1070, + 0xFFF19B0, + 0xFFF22B0, + 0xFFF2B70, + 0xFFF33D0, + 0xFFF3C00, + 0xFFF43E0, + 0xFFF4B80, + 0xFFF52E0, + 0xFFF5A00, + 0xFFF60E0, + 0xFFF6780, + 0xFFF6DF0, + 0xFFF7420, + 0xFFF7A10, + 0xFFF7FE0, + 0xFFF8570, + 0xFFF8AC0, + 0xFFF8FF0, + 0xFFF94F0, + 0xFFF99C0, + 0xFFF9E60, + 0xFFFA2D0, + 0xFFFA720, + 0xFFFAB40, + 0xFFFAF30, + 0xFFFB310, + 0xFFFB6B0, + 0xFFFBA40, + 0xFFFBDA0, + 0xFFFC0E0, + 0xFFFC400, + 0xFFFC700, + 0xFFFC9E0, + 0xFFFCCA0, + 0xFFFCF50, + 0xFFFD1D0, + 0xFFFD440, + 0xFFFD690, + 0xFFFD8D0, + 0xFFFDAF0, + 0xFFFDD00, + 0xFFFDEF0, + 0xFFFE0D0, + 0xFFFE290, + 0xFFFE440, + 0xFFFE5E0, + 0xFFFE770, + 0xFFFE8E0, + 0xFFFEA50, + 0xFFFEBA0, + 0xFFFECE0, + 0xFFFEE20, + 0xFFFEF40, + 0xFFFF050, + 0xFFFF160, + 0xFFFF260, + 0xFFFF340, + 0xFFFF420, + 0xFFFF500, + 0xFFFF5C0, + 0xFFFF680, + 0xFFFF730, + 0xFFFF7E0, + 0xFFFF880, + 0xFFFF910, + 0xFFFF9A0, + 0xFFFFA30, + 0xFFFFAA0, + 0xFFFFB20, + 0xFFFFB90, + 0xFFFFBF0, + 0xFFFFC50, + 0xFFFFCA0, + 0xFFFFD00, + 0xFFFFD50, + 0xFFFFD90, + 0xFFFFDD0, + 0xFFFFE10, + 0xFFFFE50, + 0xFFFFE80, + 0xFFFFEB0, + 0xFFFFEE0, + 0xFFFFF00, + 0xFFFFF30, + 0xFFFFF50, + 0xFFFFF70, + 0xFFFFF80, + 0xFFFFFA0, + 0xFFFFFB0, + 0xFFFFFC0, + 0xFFFFFD0, + 0xFFFFFE0, + 0xFFFFFF0 +}; + +real_t kbd_long_960[] = +{ + 0x13CD5, + 0x1D2DA, + 0x2530F, + 0x2CA56, + 0x33D79, + 0x3AED7, + 0x41FCF, + 0x4913D, + 0x503BC, + 0x577B7, + 0x5ED81, + 0x6655B, + 0x6DF77, + 0x75C00, + 0x7DB1B, + 0x85CE5, + 0x8E17C, + 0x968F7, + 0x9F36B, + 0xA80EF, + 0xB1194, + 0xBA56C, + 0xC3C88, + 0xCD6F8, + 0xD74CB, + 0xE1610, + 0xEBAD6, + 0xF632A, + 0x100F1A, + 0x10BEB4, + 0x117203, + 0x122916, + 0x12E3F9, + 0x13A2B8, + 0x146561, + 0x152BFF, + 0x15F69E, + 0x16C54B, + 0x179812, + 0x186EFF, + 0x194A1D, + 0x1A2979, + 0x1B0D1E, + 0x1BF519, + 0x1CE175, + 0x1DD23E, + 0x1EC77F, + 0x1FC145, + 0x20BF9B, + 0x21C28C, + 0x22CA24, + 0x23D670, + 0x24E77A, + 0x25FD4E, + 0x2717F7, + 0x283782, + 0x295BF9, + 0x2A8569, + 0x2BB3DD, + 0x2CE760, + 0x2E1FFD, + 0x2F5DC1, + 0x30A0B7, + 0x31E8EA, + 0x333666, + 0x348935, + 0x35E164, + 0x373EFE, + 0x38A20E, + 0x3A0AA0, + 0x3B78BE, + 0x3CEC75, + 0x3E65CF, + 0x3FE4D8, + 0x41699B, + 0x42F424, + 0x44847D, + 0x461AB1, + 0x47B6CC, + 0x4958D9, + 0x4B00E4, + 0x4CAEF6, + 0x4E631C, + 0x501D60, + 0x51DDCD, + 0x53A46E, + 0x55714E, + 0x574479, + 0x591DF8, + 0x5AFDD7, + 0x5CE420, + 0x5ED0DE, + 0x60C41D, + 0x62BDE6, + 0x64BE44, + 0x66C542, + 0x68D2EB, + 0x6AE748, + 0x6D0265, + 0x6F244B, + 0x714D05, + 0x737C9E, + 0x75B320, + 0x77F094, + 0x7A3506, + 0x7C807E, + 0x7ED308, + 0x812CAD, + 0x838D77, + 0x85F570, + 0x8864A2, + 0x8ADB16, + 0x8D58D7, + 0x8FDDEE, + 0x926A64, + 0x94FE44, + 0x979995, + 0x9A3C63, + 0x9CE6B6, + 0x9F9897, + 0xA25210, + 0xA5132A, + 0xA7DBED, + 0xAAAC63, + 0xAD8495, + 0xB0648B, + 0xB34C4E, + 0xB63BE7, + 0xB9335E, + 0xBC32BC, + 0xBF3A09, + 0xC2494E, + 0xC56093, + 0xC87FE0, + 0xCBA73D, + 0xCED6B2, + 0xD20E47, + 0xD54E04, + 0xD895F0, + 0xDBE613, + 0xDF3E76, + 0xE29F1E, + 0xE60814, + 0xE9795F, + 0xECF305, + 0xF0750F, + 0xF3FF82, + 0xF79267, + 0xFB2DC3, + 0xFED19E, + 0x1027DFC, + 0x10632E8, + 0x109F064, + 0x10DB678, + 0x111852A, + 0x1155C82, + 0x1193C82, + 0x11D2532, + 0x121169A, + 0x12510BA, + 0x129139E, + 0x12D1F46, + 0x13133BA, + 0x13550FE, + 0x1397718, + 0x13DA60C, + 0x141DDE0, + 0x1461E98, + 0x14A6838, + 0x14EBAC6, + 0x1531644, + 0x1577AB8, + 0x15BE826, + 0x1605E92, + 0x164DE00, + 0x1696672, + 0x16DF7EC, + 0x1729274, + 0x177360A, + 0x17BE2B4, + 0x1809874, + 0x185574C, + 0x18A1F40, + 0x18EF052, + 0x193CA84, + 0x198ADDA, + 0x19D9A56, + 0x1A28FFA, + 0x1A78EC6, + 0x1AC96BE, + 0x1B1A7E4, + 0x1B6C23A, + 0x1BBE5C0, + 0x1C11276, + 0x1C64860, + 0x1CB8780, + 0x1D0CFD2, + 0x1D6215C, + 0x1DB7C1C, + 0x1E0E012, + 0x1E64D40, + 0x1EBC3A4, + 0x1F14342, + 0x1F6CC16, + 0x1FC5E22, + 0x201F964, + 0x2079DDC, + 0x20D4B8C, + 0x2130270, + 0x218C288, + 0x21E8BD4, + 0x2245E50, + 0x22A3A00, + 0x2301EDC, + 0x2360CE4, + 0x23C0418, + 0x2420478, + 0x2480DFC, + 0x24E20A8, + 0x2543C74, + 0x25A6164, + 0x2608F6C, + 0x266C694, + 0x26D06D0, + 0x2735020, + 0x279A284, + 0x27FFDF4, + 0x286626C, + 0x28CCFEC, + 0x2934670, + 0x299C5F0, + 0x2A04E68, + 0x2A6DFD8, + 0x2AD7A3C, + 0x2B41D88, + 0x2BAC9BC, + 0x2C17ED4, + 0x2C83CC8, + 0x2CF0398, + 0x2D5D338, + 0x2DCABA4, + 0x2E38CD8, + 0x2EA76CC, + 0x2F1697C, + 0x2F864E4, + 0x2FF68F8, + 0x30675B8, + 0x30D8B14, + 0x314A910, + 0x31BCF9C, + 0x322FEB8, + 0x32A3658, + 0x3317678, + 0x338BF0C, + 0x3401010, + 0x3476978, + 0x34ECB44, + 0x3563564, + 0x35DA7D0, + 0x3652288, + 0x36CA578, + 0x37430A0, + 0x37BC3F0, + 0x3835F64, + 0x38B02F4, + 0x392AE90, + 0x39A6238, + 0x3A21DD8, + 0x3A9E16C, + 0x3B1ACE8, + 0x3B98048, + 0x3C15B78, + 0x3C93E74, + 0x3D12930, + 0x3D91BA0, + 0x3E115BC, + 0x3E91774, + 0x3F120C4, + 0x3F9319C, + 0x40149F0, + 0x40969B8, + 0x41190E8, + 0x419BF70, + 0x421F548, + 0x42A3260, + 0x43276B0, + 0x43AC228, + 0x44314C0, + 0x44B6E68, + 0x453CF18, + 0x45C36C0, + 0x464A550, + 0x46D1AB8, + 0x47596F0, + 0x47E19F0, + 0x486A3A8, + 0x48F3400, + 0x497CAF0, + 0x4A06870, + 0x4A90C70, + 0x4B1B6D8, + 0x4BA67A8, + 0x4C31EC8, + 0x4CBDC28, + 0x4D49FC0, + 0x4DD6980, + 0x4E63958, + 0x4EF0F30, + 0x4F7EB08, + 0x500CCC8, + 0x509B468, + 0x512A1D0, + 0x51B94F0, + 0x5248DC0, + 0x52D8C28, + 0x5369020, + 0x53F9990, + 0x548A870, + 0x551BCA8, + 0x55AD628, + 0x563F4E8, + 0x56D18D0, + 0x57641D0, + 0x57F6FD8, + 0x588A2D8, + 0x591DAC0, + 0x59B1780, + 0x5A45900, + 0x5AD9F30, + 0x5B6EA08, + 0x5C03968, + 0x5C98D50, + 0x5D2E5A0, + 0x5DC4248, + 0x5E5A338, + 0x5EF0860, + 0x5F871B0, + 0x601DF10, + 0x60B5078, + 0x614C5C8, + 0x61E3EF0, + 0x627BBE8, + 0x6313C98, + 0x63AC0E8, + 0x64448C8, + 0x64DD430, + 0x65762F8, + 0x660F520, + 0x66A8A90, + 0x6742330, + 0x67DBEF0, + 0x6875DC0, + 0x690FF88, + 0x69AA438, + 0x6A44BB8, + 0x6ADF5F8, + 0x6B7A2E8, + 0x6C15270, + 0x6CB0478, + 0x6D4B8F8, + 0x6DE6FD0, + 0x6E828F0, + 0x6F1E450, + 0x6FBA1C8, + 0x7056158, + 0x70F22D8, + 0x718E648, + 0x722AB88, + 0x72C7280, + 0x7363B28, + 0x7400568, + 0x749D128, + 0x7539E50, + 0x75D6CD8, + 0x7673CA8, + 0x7710DA0, + 0x77ADFC0, + 0x784B2E0, + 0x78E86F0, + 0x7985BE8, + 0x7A231A8, + 0x7AC0820, + 0x7B5DF38, + 0x7BFB6E0, + 0x7C98F00, + 0x7D36788, + 0x7DD4058, + 0x7E71968, + 0x7F0F2A0, + 0x7FACBE8, + 0x804A530, + 0x80E7E60, + 0x8185770, + 0x8223030, + 0x82C08A0, + 0x835E0B0, + 0x83FB830, + 0x8498F30, + 0x8536580, + 0x85D3B20, + 0x8670FE0, + 0x870E3C0, + 0x87AB6B0, + 0x8848890, + 0x88E5950, + 0x89828D0, + 0x8A1F710, + 0x8ABC3F0, + 0x8B58F50, + 0x8BF5940, + 0x8C92180, + 0x8D2E810, + 0x8DCACF0, + 0x8E66FE0, + 0x8F030F0, + 0x8F9F000, + 0x903ACF0, + 0x90D67C0, + 0x9172050, + 0x920D690, + 0x92A8A60, + 0x9343BC0, + 0x93DEAA0, + 0x94796D0, + 0x9514050, + 0x95AE700, + 0x9648AD0, + 0x96E2BC0, + 0x977C9A0, + 0x9816470, + 0x98AFC20, + 0x9949080, + 0x99E2190, + 0x9A7AF40, + 0x9B13980, + 0x9BAC030, + 0x9C44340, + 0x9CDC2A0, + 0x9D73E40, + 0x9E0B610, + 0x9EA29F0, + 0x9F399D0, + 0x9FD05A0, + 0xA066D50, + 0xA0FD0D0, + 0xA193010, + 0xA228AF0, + 0xA2BE170, + 0xA353360, + 0xA3E80D0, + 0xA47C9A0, + 0xA510DC0, + 0xA5A4D10, + 0xA638790, + 0xA6CBD20, + 0xA75EDC0, + 0xA7F1960, + 0xA883FE0, + 0xA916120, + 0xA9A7D30, + 0xAA393F0, + 0xAACA560, + 0xAB5B150, + 0xABEB7C0, + 0xAC7B8A0, + 0xAD0B3D0, + 0xAD9A960, + 0xAE29920, + 0xAEB8320, + 0xAF46730, + 0xAFD4550, + 0xB061D60, + 0xB0EEF70, + 0xB17BB60, + 0xB208110, + 0xB294090, + 0xB31F9B0, + 0xB3AAC80, + 0xB4358D0, + 0xB4BFEB0, + 0xB549E10, + 0xB5D36C0, + 0xB65C8E0, + 0xB6E5430, + 0xB76D8D0, + 0xB7F5690, + 0xB87CD80, + 0xB903D70, + 0xB98A670, + 0xBA10860, + 0xBA96340, + 0xBB1B700, + 0xBBA0380, + 0xBC248D0, + 0xBCA86D0, + 0xBD2BD70, + 0xBDAECC0, + 0xBE31490, + 0xBEB34F0, + 0xBF34DC0, + 0xBFB5F00, + 0xC036890, + 0xC0B6A90, + 0xC1364C0, + 0xC1B5740, + 0xC2341E0, + 0xC2B24C0, + 0xC32FFA0, + 0xC3AD2B0, + 0xC429DB0, + 0xC4A60B0, + 0xC521BB0, + 0xC59CE90, + 0xC617940, + 0xC691BE0, + 0xC70B630, + 0xC784850, + 0xC7FD230, + 0xC8753B0, + 0xC8ECCE0, + 0xC963DA0, + 0xC9DA600, + 0xCA505F0, + 0xCAC5D60, + 0xCB3AC40, + 0xCBAF2A0, + 0xCC23060, + 0xCC96590, + 0xCD09210, + 0xCD7B5F0, + 0xCDED110, + 0xCE5E380, + 0xCECED30, + 0xCF3EE20, + 0xCFAE630, + 0xD01D570, + 0xD08BBE0, + 0xD0F9960, + 0xD166E00, + 0xD1D39C0, + 0xD23FC80, + 0xD2AB650, + 0xD316710, + 0xD380EE0, + 0xD3EADA0, + 0xD454360, + 0xD4BD010, + 0xD5253A0, + 0xD58CE20, + 0xD5F3F80, + 0xD65A7B0, + 0xD6C06D0, + 0xD725CC0, + 0xD78A980, + 0xD7EED10, + 0xD852770, + 0xD8B58A0, + 0xD918090, + 0xD979F50, + 0xD9DB4D0, + 0xDA3C110, + 0xDA9C400, + 0xDAFBDC0, + 0xDB5AE30, + 0xDBB9560, + 0xDC17340, + 0xDC747D0, + 0xDCD1320, + 0xDD2D520, + 0xDD88DD0, + 0xDDE3D40, + 0xDE3E350, + 0xDE98020, + 0xDEF1390, + 0xDF49DC0, + 0xDFA1EA0, + 0xDFF9630, + 0xE050470, + 0xE0A6960, + 0xE0FC510, + 0xE151760, + 0xE1A6070, + 0xE1FA040, + 0xE24D6C0, + 0xE2A03F0, + 0xE2F27F0, + 0xE3442A0, + 0xE395410, + 0xE3E5C40, + 0xE435B30, + 0xE4850E0, + 0xE4D3D60, + 0xE5220B0, + 0xE56FAD0, + 0xE5BCBC0, + 0xE609380, + 0xE655210, + 0xE6A0780, + 0xE6EB3D0, + 0xE735710, + 0xE77F120, + 0xE7C8220, + 0xE810A10, + 0xE858900, + 0xE89FED0, + 0xE8E6BB0, + 0xE92CF80, + 0xE972A60, + 0xE9B7C40, + 0xE9FC530, + 0xEA40540, + 0xEA83C60, + 0xEAC6AA0, + 0xEB09010, + 0xEB4ACA0, + 0xEB8C060, + 0xEBCCB60, + 0xEC0CD90, + 0xEC4C710, + 0xEC8B7D0, + 0xECC9FE0, + 0xED07F40, + 0xED45610, + 0xED82430, + 0xEDBE9C0, + 0xEDFA6D0, + 0xEE35B50, + 0xEE70750, + 0xEEAAAD0, + 0xEEE45F0, + 0xEF1D890, + 0xEF562E0, + 0xEF8E4E0, + 0xEFC5E80, + 0xEFFCFD0, + 0xF0338F0, + 0xF0699D0, + 0xF09F280, + 0xF0D4300, + 0xF108B60, + 0xF13CBB0, + 0xF1703F0, + 0xF1A3430, + 0xF1D5C70, + 0xF207CC0, + 0xF239520, + 0xF26A5A0, + 0xF29AE50, + 0xF2CAF20, + 0xF2FA840, + 0xF329990, + 0xF358340, + 0xF386540, + 0xF3B3FA0, + 0xF3E1260, + 0xF40DDA0, + 0xF43A160, + 0xF465DB0, + 0xF491290, + 0xF4BC000, + 0xF4E6630, + 0xF510500, + 0xF539C90, + 0xF562CE0, + 0xF58B610, + 0xF5B3810, + 0xF5DB300, + 0xF6026E0, + 0xF6293B0, + 0xF64F990, + 0xF675880, + 0xF69B090, + 0xF6C01C0, + 0xF6E4C20, + 0xF708FD0, + 0xF72CCB0, + 0xF7502F0, + 0xF773290, + 0xF795BA0, + 0xF7B7E20, + 0xF7D9A20, + 0xF7FAFA0, + 0xF81BEC0, + 0xF83C780, + 0xF85C9F0, + 0xF87C620, + 0xF89BC10, + 0xF8BABD0, + 0xF8D9570, + 0xF8F78F0, + 0xF915660, + 0xF932DD0, + 0xF94FF50, + 0xF96CAE0, + 0xF989090, + 0xF9A5070, + 0xF9C0A90, + 0xF9DBEE0, + 0xF9F6D90, + 0xFA11690, + 0xFA2BA00, + 0xFA457E0, + 0xFA5F040, + 0xFA78330, + 0xFA910B0, + 0xFAA98D0, + 0xFAC1BA0, + 0xFAD9920, + 0xFAF1170, + 0xFB08490, + 0xFB1F280, + 0xFB35B60, + 0xFB4BF40, + 0xFB61E10, + 0xFB777E0, + 0xFB8CCE0, + 0xFBA1CF0, + 0xFBB6830, + 0xFBCAEB0, + 0xFBDF070, + 0xFBF2D80, + 0xFC065F0, + 0xFC199C0, + 0xFC2C900, + 0xFC3F3D0, + 0xFC51A20, + 0xFC63C00, + 0xFC75980, + 0xFC872B0, + 0xFC987A0, + 0xFCA9840, + 0xFCBA4C0, + 0xFCCAD00, + 0xFCDB140, + 0xFCEB160, + 0xFCFAD80, + 0xFD0A5A0, + 0xFD199D0, + 0xFD28A20, + 0xFD37690, + 0xFD45F40, + 0xFD54420, + 0xFD62540, + 0xFD702C0, + 0xFD7DC90, + 0xFD8B2D0, + 0xFD98580, + 0xFDA54B0, + 0xFDB2060, + 0xFDBE8B0, + 0xFDCAD90, + 0xFDD6F10, + 0xFDE2D50, + 0xFDEE840, + 0xFDF9FF0, + 0xFE05480, + 0xFE105E0, + 0xFE1B420, + 0xFE25F50, + 0xFE30780, + 0xFE3ACA0, + 0xFE44EE0, + 0xFE4EE20, + 0xFE58A90, + 0xFE62420, + 0xFE6BAE0, + 0xFE74EE0, + 0xFE7E030, + 0xFE86EC0, + 0xFE8FAA0, + 0xFE983F0, + 0xFEA0AA0, + 0xFEA8ED0, + 0xFEB1070, + 0xFEB8FA0, + 0xFEC0C50, + 0xFEC86A0, + 0xFECFE90, + 0xFED7430, + 0xFEDE770, + 0xFEE5880, + 0xFEEC740, + 0xFEF33D0, + 0xFEF9E30, + 0xFF00670, + 0xFF06CA0, + 0xFF0D0B0, + 0xFF132B0, + 0xFF192B0, + 0xFF1F0B0, + 0xFF24CC0, + 0xFF2A6E0, + 0xFF2FF20, + 0xFF35590, + 0xFF3AA20, + 0xFF3FCE0, + 0xFF44DD0, + 0xFF49D10, + 0xFF4EA90, + 0xFF53670, + 0xFF58090, + 0xFF5C920, + 0xFF61010, + 0xFF65560, + 0xFF69930, + 0xFF6DB80, + 0xFF71C40, + 0xFF75B90, + 0xFF79970, + 0xFF7D5E0, + 0xFF810E0, + 0xFF84A90, + 0xFF882E0, + 0xFF8B9E0, + 0xFF8EF90, + 0xFF92400, + 0xFF95730, + 0xFF98920, + 0xFF9B9E0, + 0xFF9E970, + 0xFFA17D0, + 0xFFA4510, + 0xFFA7130, + 0xFFA9C40, + 0xFFAC630, + 0xFFAEF20, + 0xFFB1700, + 0xFFB3DE0, + 0xFFB63C0, + 0xFFB88A0, + 0xFFBAC90, + 0xFFBCFA0, + 0xFFBF1B0, + 0xFFC12E0, + 0xFFC3340, + 0xFFC52B0, + 0xFFC7150, + 0xFFC8F20, + 0xFFCAC20, + 0xFFCC850, + 0xFFCE3C0, + 0xFFCFE60, + 0xFFD1850, + 0xFFD3190, + 0xFFD4A10, + 0xFFD61E0, + 0xFFD7900, + 0xFFD8F80, + 0xFFDA550, + 0xFFDBA80, + 0xFFDCF10, + 0xFFDE310, + 0xFFDF670, + 0xFFE0940, + 0xFFE1B80, + 0xFFE2D30, + 0xFFE3E60, + 0xFFE4F00, + 0xFFE5F20, + 0xFFE6EC0, + 0xFFE7DF0, + 0xFFE8C90, + 0xFFE9AD0, + 0xFFEA890, + 0xFFEB5E0, + 0xFFEC2D0, + 0xFFECF40, + 0xFFEDB60, + 0xFFEE700, + 0xFFEF250, + 0xFFEFD40, + 0xFFF07D0, + 0xFFF1200, + 0xFFF1BD0, + 0xFFF2560, + 0xFFF2E90, + 0xFFF3770, + 0xFFF3FF0, + 0xFFF4840, + 0xFFF5030, + 0xFFF57E0, + 0xFFF5F40, + 0xFFF6670, + 0xFFF6D50, + 0xFFF73E0, + 0xFFF7A40, + 0xFFF8070, + 0xFFF8650, + 0xFFF8C00, + 0xFFF9170, + 0xFFF96C0, + 0xFFF9BC0, + 0xFFFA0A0, + 0xFFFA540, + 0xFFFA9C0, + 0xFFFAE10, + 0xFFFB220, + 0xFFFB620, + 0xFFFB9E0, + 0xFFFBD80, + 0xFFFC100, + 0xFFFC450, + 0xFFFC780, + 0xFFFCA90, + 0xFFFCD70, + 0xFFFD040, + 0xFFFD2E0, + 0xFFFD570, + 0xFFFD7E0, + 0xFFFDA30, + 0xFFFDC60, + 0xFFFDE80, + 0xFFFE080, + 0xFFFE260, + 0xFFFE430, + 0xFFFE5F0, + 0xFFFE790, + 0xFFFE920, + 0xFFFEAA0, + 0xFFFEC00, + 0xFFFED50, + 0xFFFEEA0, + 0xFFFEFD0, + 0xFFFF0F0, + 0xFFFF200, + 0xFFFF300, + 0xFFFF3F0, + 0xFFFF4E0, + 0xFFFF5B0, + 0xFFFF680, + 0xFFFF740, + 0xFFFF7F0, + 0xFFFF8A0, + 0xFFFF940, + 0xFFFF9D0, + 0xFFFFA50, + 0xFFFFAE0, + 0xFFFFB50, + 0xFFFFBC0, + 0xFFFFC30, + 0xFFFFC90, + 0xFFFFCE0, + 0xFFFFD40, + 0xFFFFD90, + 0xFFFFDD0, + 0xFFFFE10, + 0xFFFFE50, + 0xFFFFE80, + 0xFFFFEC0, + 0xFFFFEE0, + 0xFFFFF10, + 0xFFFFF30, + 0xFFFFF60, + 0xFFFFF70, + 0xFFFFF90, + 0xFFFFFB0, + 0xFFFFFC0, + 0xFFFFFD0, + 0xFFFFFE0, + 0xFFFFFF0 +}; + +real_t kbd_short_128[] = +{ + 0x2DEC, + 0x7C70, + 0xF1EC, + 0x19864, + 0x27B3D, + 0x3A753, + 0x52B03, + 0x71637, + 0x97A69, + 0xC6AA6, + 0xFFB8C, + 0x14433E, + 0x19595A, + 0x1F56E5, + 0x265635, + 0x2E72D1, + 0x37C94C, + 0x427722, + 0x4E9A83, + 0x5C5227, + 0x6BBD0D, + 0x7CFA46, + 0x9028AF, + 0xA566AF, + 0xBCD1EE, + 0xD6870D, + 0xF2A159, + 0x1113A7E, + 0x1326A3C, + 0x156461C, + 0x17CE124, + 0x1A64B92, + 0x1D29294, + 0x201C010, + 0x233DA5C, + 0x268E41C, + 0x2A0DBFC, + 0x2DBBCA0, + 0x3197C7C, + 0x35A0DC0, + 0x39D5E40, + 0x3E35788, + 0x42BDED0, + 0x476D508, + 0x4C41720, + 0x5137DE0, + 0x564DE60, + 0x5B80A20, + 0x60CCF50, + 0x662F918, + 0x6BA4FF0, + 0x7129A00, + 0x76B9B70, + 0x7C516F0, + 0x81ECE00, + 0x8788190, + 0x8D1F240, + 0x92AE100, + 0x9830F60, + 0x9DA4020, + 0xA3037A0, + 0xA84BC50, + 0xAD79720, + 0xB2893B0, + 0xB778110, + 0xBC431C0, + 0xC0E7C30, + 0xC563AF0, + 0xC9B4CF0, + 0xCDD95A0, + 0xD1CFD30, + 0xD597090, + 0xD92E180, + 0xDC94690, + 0xDFC9B20, + 0xE2CDF20, + 0xE5A1710, + 0xE844BD0, + 0xEAB8A30, + 0xECFE300, + 0xEF16A60, + 0xF1037D0, + 0xF2C6590, + 0xF461040, + 0xF5D56A0, + 0xF725920, + 0xF853960, + 0xF961A00, + 0xFA51DE0, + 0xFB26830, + 0xFBE1BE0, + 0xFC85B20, + 0xFD14770, + 0xFD90130, + 0xFDFA730, + 0xFE55700, + 0xFEA2C30, + 0xFEE40C0, + 0xFF1ACA0, + 0xFF485D0, + 0xFF6E070, + 0xFF8CEB0, + 0xFFA60D0, + 0xFFBA540, + 0xFFCA8C0, + 0xFFD7660, + 0xFFE17C0, + 0xFFE9530, + 0xFFEF5A0, + 0xFFF3EE0, + 0xFFF75F0, + 0xFFF9EC0, + 0xFFFBC90, + 0xFFFD210, + 0xFFFE150, + 0xFFFEBF0, + 0xFFFF330, + 0xFFFF800, + 0xFFFFB30, + 0xFFFFD30, + 0xFFFFE70, + 0xFFFFF30, + 0xFFFFF90, + 0xFFFFFD0, + 0xFFFFFF0, + 0x10000000, + 0x10000000, + 0x10000000 +}; + +real_t kbd_short_120[] = +{ + 0x2F6D, + 0x85A5, + 0x1093A, + 0x1C692, + 0x2CBDF, + 0x42937, + 0x5F0A9, + 0x83646, + 0xB1029, + 0xE9675, + 0x12E34C, + 0x1812C1, + 0x1E42C0, + 0x2592EE, + 0x2E2485, + 0x381A1F, + 0x439782, + 0x50C160, + 0x5FBD0E, + 0x70B036, + 0x83C082, + 0x99133E, + 0xB0CD00, + 0xCB113B, + 0xE801DA, + 0x107BEDE, + 0x12A65E6, + 0x15011DA, + 0x178DA70, + 0x1A4D3D6, + 0x1D40E4E, + 0x20695D8, + 0x23C71DC, + 0x275A4E8, + 0x2B22C6C, + 0x2F20094, + 0x335140C, + 0x37B53F4, + 0x3C4A7D4, + 0x410F198, + 0x4600DA8, + 0x4B1D308, + 0x5061378, + 0x55C9BC8, + 0x5B53418, + 0x60FA030, + 0x66B9FF0, + 0x6C8EFC0, + 0x7274920, + 0x7866300, + 0x7E5F288, + 0x845ABA0, + 0x8A54180, + 0x9046750, + 0x962D0E0, + 0x9C03350, + 0xA1C4580, + 0xA76C0E0, + 0xACF61D0, + 0xB25E890, + 0xB7A1940, + 0xBCBBCB0, + 0xC1AA0D0, + 0xC6698E0, + 0xCAF7DC0, + 0xCF52E60, + 0xD378FC0, + 0xD768D10, + 0xDB217D0, + 0xDEA2790, + 0xE1EBA10, + 0xE4FD310, + 0xE7D7BC0, + 0xEA7C2F0, + 0xECEBC40, + 0xEF27FF0, + 0xF132A80, + 0xF30DBE0, + 0xF4BB760, + 0xF63E2A0, + 0xF798580, + 0xF8CC930, + 0xF9DD7E0, + 0xFACDC30, + 0xFBA00A0, + 0xFC56F30, + 0xFCF50D0, + 0xFD7CD20, + 0xFDF09F0, + 0xFE52B60, + 0xFEA5310, + 0xFEEA080, + 0xFF23090, + 0xFF51DC0, + 0xFF77FF0, + 0xFF96C90, + 0xFFAF690, + 0xFFC2EB0, + 0xFFD2380, + 0xFFDE160, + 0xFFE7310, + 0xFFEE180, + 0xFFF3430, + 0xFFF7140, + 0xFFF9DA0, + 0xFFFBD70, + 0xFFFD3E0, + 0xFFFE360, + 0xFFFEDE0, + 0xFFFF4E0, + 0xFFFF960, + 0xFFFFC30, + 0xFFFFDE0, + 0xFFFFEE0, + 0xFFFFF70, + 0xFFFFFC0, + 0xFFFFFE0, + 0xFFFFFF0, + 0x10000000, + 0x10000000 +}; + +#endif + #ifdef __cplusplus } #endif diff --git a/src/libfaad/lt_predict.c b/src/libfaad/lt_predict.c index ff5c33f10..55e5f3aeb 100644 --- a/src/libfaad/lt_predict.c +++ b/src/libfaad/lt_predict.c @@ -16,11 +16,12 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: lt_predict.c,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: lt_predict.c,v 1.2 2002/12/16 19:00:34 miguelfreitas Exp $ **/ #include "common.h" +#include "structs.h" #ifdef LTP_DEC @@ -32,8 +33,14 @@ static real_t codebook[8] = { - 0.570829f, 0.696616f, 0.813004f, 0.911304f, 0.984900f, 1.067894f, - 1.194601f, 1.369533f + COEF_CONST(0.570829), + COEF_CONST(0.696616), + COEF_CONST(0.813004), + COEF_CONST(0.911304), + COEF_CONST(0.984900), + COEF_CONST(1.067894), + COEF_CONST(1.194601), + COEF_CONST(1.369533) }; void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec, @@ -52,15 +59,15 @@ void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec, { num_samples = frame_len << 1; - x_est = malloc(num_samples*sizeof(real_t)); - X_est = malloc(num_samples*sizeof(real_t)); + x_est = (real_t*)malloc(num_samples*sizeof(real_t)); + X_est = (real_t*)malloc(num_samples*sizeof(real_t)); for(i = 0; i < num_samples; i++) { /* The extra lookback M (N/2 for LD, 0 for LTP) is handled in the buffer updating */ - x_est[i] = MUL(codebook[ltp->coef], - lt_pred_stat[num_samples + i - ltp->lag]); + x_est[i] = MUL_R_C(lt_pred_stat[num_samples + i - ltp->lag], + codebook[ltp->coef]); } filter_bank_ltp(fb, ics->window_sequence, win_shape, win_shape_prev, diff --git a/src/libfaad/lt_predict.h b/src/libfaad/lt_predict.h index 42049b8d0..f9b06ab51 100644 --- a/src/libfaad/lt_predict.h +++ b/src/libfaad/lt_predict.h @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: lt_predict.h,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: lt_predict.h,v 1.2 2002/12/16 19:00:37 miguelfreitas Exp $ **/ #ifdef LTP_DEC diff --git a/src/libfaad/mdct.c b/src/libfaad/mdct.c index 886f227ff..62031bfed 100644 --- a/src/libfaad/mdct.c +++ b/src/libfaad/mdct.c @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: mdct.c,v 1.2 2002/08/09 22:36:36 miguelfreitas Exp $ +** $Id: mdct.c,v 1.3 2002/12/16 19:00:39 miguelfreitas Exp $ **/ /* @@ -31,146 +31,179 @@ * * * As of April 6th 2002 completely rewritten. - * Thanks to the FFTW library this (I)MDCT can now be used for any data - * size n, where n is divisible by 8. + * This (I)MDCT can now be used for any data size n, where n is divisible by 8. * */ - #include "common.h" +#include "structs.h" #include <stdlib.h> +#ifdef _WIN32_WCE +#define assert(x) +#else #include <assert.h> +#endif -#ifdef USE_FFTW -/* uses fftw (http://www.fftw.org) for very fast arbitrary-n FFT and IFFT */ -#include <fftw.h> -#else #include "cfft.h" -#endif +#include "mdct.h" +/* const_tab[]: + 0: sqrt(2 / N) + 1: cos(2 * PI / N) + 2: sin(2 * PI / N) + 3: cos(2 * PI * (1/8) / N) + 4: sin(2 * PI * (1/8) / N) + */ +#ifdef FIXED_POINT +real_t const_tab[][5] = +{ + { 0x800000, 0xFFFFB10, 0xC90FC, 0xFFFFFF0, 0x1921F }, /* 2048 */ + { 0x8432A5, 0xFFFFA60, 0xD6773, 0xFFFFFF0, 0x1ACEE }, /* 1920 */ + { 0xB504F3, 0xFFFEC40, 0x1921F1, 0xFFFFFB0, 0x3243F }, /* 1024 */ + { 0xBAF4BA, 0xFFFE990, 0x1ACEDD, 0xFFFFFA0, 0x359DD }, /* 960 */ + { 0x16A09E6, 0xFFEC430, 0x648558, 0xFFFFB10, 0xC90FC }, /* 256 */ + { 0x175E974, 0xFFE98B0, 0x6B3885, 0xFFFFA60, 0xD6773 } /* 240 */ +#ifdef SSR_DEC + ,{ 0, 0, 0, 0, 0 }, /* 512 */ + { 0, 0, 0, 0, 0 } /* 64 */ +#endif +}; +#else +#ifdef _MSC_VER +#pragma warning(disable:4305) +#pragma warning(disable:4244) +#endif +real_t const_tab[][5] = +{ + { 0.0312500000, 0.9999952938, 0.0030679568, 0.9999999265, 0.0003834952 }, /* 2048 */ + { 0.0322748612, 0.9999946356, 0.0032724866, 0.9999999404, 0.0004090615 }, /* 1920 */ + { 0.0441941738, 0.9999811649, 0.0061358847, 0.9999997020, 0.0007669903 }, /* 1024 */ + { 0.0456435465, 0.9999786019, 0.0065449383, 0.9999996424, 0.0008181230 }, /* 960 */ + { 0.0883883476, 0.9996988177, 0.0245412290, 0.9999952912, 0.0030679568 }, /* 256 */ + { 0.0912870929, 0.9996573329, 0.0261769500, 0.9999946356, 0.0032724866 } /* 240 */ +#ifdef SSR_DEC + ,{ 0.062500000, 0.999924702, 0.012271538, 0.999998823, 0.00153398 }, /* 512 */ + { 0.176776695, 0.995184727, 0.09801714, 0.999924702, 0.012271538 } /* 64 */ +#endif +}; +#endif -#include "mdct.h" +uint8_t map_N_to_idx(uint16_t N) +{ + switch(N) + { + case 2048: return 0; + case 1920: return 1; + case 1024: return 2; + case 960: return 3; + case 256: return 4; + case 240: return 5; +#ifdef SSR_DEC + case 512: return 6; + case 64: return 7; +#endif + } + return 0; +} -void faad_mdct_init(mdct_info *mdct, uint16_t N) +mdct_info *faad_mdct_init(uint16_t N) { - uint16_t k; + uint16_t k, N_idx; + real_t cangle, sangle, c, s, cold; + real_t scale; + + mdct_info *mdct = (mdct_info*)malloc(sizeof(mdct_info)); assert(N % 8 == 0); mdct->N = N; - mdct->sincos = (faad_sincos*)malloc(N/4*sizeof(faad_sincos)); -#ifdef USE_FFTW - mdct->Z1 = (fftw_complex*)malloc(N/4*sizeof(fftw_complex)); - mdct->Z2 = (fftw_complex*)malloc(N/4*sizeof(fftw_complex)); -#else - mdct->Z1 = (real_t*)malloc(N/2*sizeof(real_t)); - mdct->Z2 = (faad_complex*)malloc(N/4*sizeof(faad_complex)); -#endif + mdct->sincos = (complex_t*)malloc(N/4*sizeof(complex_t)); + mdct->Z1 = (complex_t*)malloc(N/4*sizeof(complex_t)); + + N_idx = map_N_to_idx(N); + + scale = const_tab[N_idx][0]; + cangle = const_tab[N_idx][1]; + sangle = const_tab[N_idx][2]; + c = const_tab[N_idx][3]; + s = const_tab[N_idx][4]; for (k = 0; k < N/4; k++) { - real_t angle = 2.0 * M_PI * (k + 1.0/8.0)/(real_t)N; - mdct->sincos[k].sin = -sin(angle); - mdct->sincos[k].cos = -cos(angle); + RE(mdct->sincos[k]) = -1*MUL_C_C(c,scale); + IM(mdct->sincos[k]) = -1*MUL_C_C(s,scale); + + cold = c; + c = MUL_C_C(c,cangle) - MUL_C_C(s,sangle); + s = MUL_C_C(s,cangle) + MUL_C_C(cold,sangle); } -#ifdef USE_FFTW - mdct->plan_backward = fftw_create_plan(N/4, FFTW_BACKWARD, FFTW_ESTIMATE); -#ifdef LTP_DEC - mdct->plan_forward = fftw_create_plan(N/4, FFTW_FORWARD, FFTW_ESTIMATE); -#endif -#else - /* own implementation */ + /* initialise fft */ mdct->cfft = cffti(N/4); -#endif + + return mdct; } void faad_mdct_end(mdct_info *mdct) { -#ifdef USE_FFTW - fftw_destroy_plan(mdct->plan_backward); -#ifdef LTP_DEC - fftw_destroy_plan(mdct->plan_forward); -#endif -#else cfftu(mdct->cfft); -#endif - if (mdct->Z2) free(mdct->Z2); if (mdct->Z1) free(mdct->Z1); if (mdct->sincos) free(mdct->sincos); + + if (mdct) free(mdct); } void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out) { uint16_t k; -#ifdef USE_FFTW - fftw_complex *Z1 = mdct->Z1; - fftw_complex *Z2 = mdct->Z2; -#else - real_t *Z1 = mdct->Z1; - faad_complex *Z2 = mdct->Z2; -#endif - faad_sincos *sincos = mdct->sincos; - real_t fftdata[1024]; + complex_t x; + complex_t *Z1 = mdct->Z1; + complex_t *sincos = mdct->sincos; uint16_t N = mdct->N; uint16_t N2 = N >> 1; uint16_t N4 = N >> 2; uint16_t N8 = N >> 3; - real_t fac = 2.0/(real_t)N; - /* pre-IFFT complex multiplication */ for (k = 0; k < N4; k++) { uint16_t n = k << 1; - real_t x0 = X_in[ n]; - real_t x1 = X_in[N2 - 1 - n]; -#ifdef USE_FFTW - Z1[k].re = MUL(fac, MUL(x1, sincos[k].cos) - MUL(x0, sincos[k].sin)); - Z1[k].im = MUL(fac, MUL(x0, sincos[k].cos) + MUL(x1, sincos[k].sin)); -#else - Z1[2*k] = MUL(fac, MUL(x1, sincos[k].cos) - MUL(x0, sincos[k].sin)); - Z1[2*k+1] = MUL(fac, MUL(x0, sincos[k].cos) + MUL(x1, sincos[k].sin)); -#endif + RE(x) = X_in[ n]; + IM(x) = X_in[N2 - 1 - n]; + RE(Z1[k]) = MUL_R_C(IM(x), RE(sincos[k])) - MUL_R_C(RE(x), IM(sincos[k])); + IM(Z1[k]) = MUL_R_C(RE(x), RE(sincos[k])) + MUL_R_C(IM(x), IM(sincos[k])); } /* complex IFFT */ -#ifdef USE_FFTW - fftw_one(mdct->plan_backward, Z1, Z2); -#else cfftb(mdct->cfft, Z1); -#endif /* post-IFFT complex multiplication */ for (k = 0; k < N4; k++) { -#ifdef USE_FFTW - real_t zr = Z2[k].re; - real_t zi = Z2[k].im; -#else - real_t zr = Z1[2*k]; - real_t zi = Z1[2*k+1]; -#endif - Z2[k].re = MUL(zr, sincos[k].cos) - MUL(zi, sincos[k].sin); - Z2[k].im = MUL(zi, sincos[k].cos) + MUL(zr, sincos[k].sin); + uint16_t n = k << 1; + RE(x) = RE(Z1[k]); + IM(x) = IM(Z1[k]); + + RE(Z1[k]) = MUL_R_C(RE(x), RE(sincos[k])) - MUL_R_C(IM(x), IM(sincos[k])); + IM(Z1[k]) = MUL_R_C(IM(x), RE(sincos[k])) + MUL_R_C(RE(x), IM(sincos[k])); } /* reordering */ for (k = 0; k < N8; k++) { uint16_t n = k << 1; - X_out[ n] = -Z2[N8 + k].im; - X_out[ 1 + n] = Z2[N8 - 1 - k].re; - X_out[N4 + n] = -Z2[ k].re; - X_out[N4 + 1 + n] = Z2[N4 - 1 - k].im; - X_out[N2 + n] = -Z2[N8 + k].re; - X_out[N2 + 1 + n] = Z2[N8 - 1 - k].im; - X_out[N2 + N4 + n] = Z2[ k].im; - X_out[N2 + N4 + 1 + n] = -Z2[N4 - 1 - k].re; + X_out[ n] = IM(Z1[N8 + k]); + X_out[ 1 + n] = -RE(Z1[N8 - 1 - k]); + X_out[N4 + n] = RE(Z1[ k]); + X_out[N4 + 1 + n] = -IM(Z1[N4 - 1 - k]); + X_out[N2 + n] = RE(Z1[N8 + k]); + X_out[N2 + 1 + n] = -IM(Z1[N8 - 1 - k]); + X_out[N2 + N4 + n] = -IM(Z1[ k]); + X_out[N2 + N4 + 1 + n] = RE(Z1[N4 - 1 - k]); } } @@ -179,70 +212,48 @@ void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out) { uint16_t k; -#ifdef USE_FFTW - fftw_complex *Z1 = mdct->Z1; - fftw_complex *Z2 = mdct->Z2; -#else - real_t *Z1 = mdct->Z1; -#endif - faad_sincos *sincos = mdct->sincos; + complex_t x; + complex_t *Z1 = mdct->Z1; + complex_t *sincos = mdct->sincos; uint16_t N = mdct->N; uint16_t N2 = N >> 1; uint16_t N4 = N >> 2; uint16_t N8 = N >> 3; + real_t scale = REAL_CONST(N); /* pre-FFT complex multiplication */ for (k = 0; k < N8; k++) { uint16_t n = k << 1; - real_t zr = X_in[N - N4 - 1 - n] + X_in[N - N4 + n]; - real_t zi = X_in[ N4 + n] - X_in[ N4 - 1 - n]; + RE(x) = X_in[N - N4 - 1 - n] + X_in[N - N4 + n]; + IM(x) = X_in[ N4 + n] - X_in[ N4 - 1 - n]; -#ifdef USE_FFTW - Z1[k ].re = -MUL(zr, sincos[k ].cos) - MUL(zi, sincos[k ].sin); - Z1[k ].im = -MUL(zi, sincos[k ].cos) + MUL(zr, sincos[k ].sin); -#else - Z1[k*2 ] = -MUL(zr, sincos[k ].cos) - MUL(zi, sincos[k ].sin); - Z1[k*2+1 ] = -MUL(zi, sincos[k ].cos) + MUL(zr, sincos[k ].sin); -#endif + RE(Z1[k]) = -MUL_R_C(RE(x), RE(sincos[k])) - MUL_R_C(IM(x), IM(sincos[k])); + IM(Z1[k]) = -MUL_R_C(IM(x), RE(sincos[k])) + MUL_R_C(RE(x), IM(sincos[k])); - zr = X_in[ N2 - 1 - n] - X_in[ n]; - zi = X_in[ N2 + n] + X_in[N - 1 - n]; + RE(x) = X_in[N2 - 1 - n] - X_in[ n]; + IM(x) = X_in[N2 + n] + X_in[N - 1 - n]; -#ifdef USE_FFTW - Z1[k + N8].re = -MUL(zr, sincos[k + N8].cos) - MUL(zi, sincos[k + N8].sin); - Z1[k + N8].im = -MUL(zi, sincos[k + N8].cos) + MUL(zr, sincos[k + N8].sin); -#else - Z1[k*2 + N8] = -MUL(zr, sincos[k + N8].cos) - MUL(zi, sincos[k + N8].sin); - Z1[k*2+1 + N8] = -MUL(zi, sincos[k + N8].cos) + MUL(zr, sincos[k + N8].sin); -#endif + RE(Z1[k + N8]) = -MUL_R_C(RE(x), RE(sincos[k + N8])) - MUL_R_C(IM(x), IM(sincos[k + N8])); + IM(Z1[k + N8]) = -MUL_R_C(IM(x), RE(sincos[k + N8])) + MUL_R_C(RE(x), IM(sincos[k + N8])); } /* complex FFT */ -#ifdef USE_FFTW - fftw_one(mdct->plan_forward, Z1, Z2); -#else cfftf(mdct->cfft, Z1); -#endif /* post-FFT complex multiplication */ for (k = 0; k < N4; k++) { uint16_t n = k << 1; -#ifdef USE_FFTW - real_t zr = MUL(2.0, MUL(Z2[k].re, sincos[k].cos) + MUL(Z2[k].im, sincos[k].sin)); - real_t zi = MUL(2.0, MUL(Z2[k].im, sincos[k].cos) - MUL(Z2[k].re, sincos[k].sin)); -#else - real_t zr = MUL(2.0, MUL(Z1[k*2], sincos[k].cos) + MUL(Z1[k*2+1], sincos[k].sin)); - real_t zi = MUL(2.0, MUL(Z1[k*2+1], sincos[k].cos) - MUL(Z1[k*2], sincos[k].sin)); -#endif + RE(x) = MUL(MUL_R_C(RE(Z1[k]), RE(sincos[k])) + MUL_R_C(IM(Z1[k]), IM(sincos[k])), scale); + IM(x) = MUL(MUL_R_C(IM(Z1[k]), RE(sincos[k])) - MUL_R_C(RE(Z1[k]), IM(sincos[k])), scale); - X_out[ n] = -zr; - X_out[N2 - 1 - n] = zi; - X_out[N2 + n] = -zi; - X_out[N - 1 - n] = zr; + X_out[ n] = RE(x); + X_out[N2 - 1 - n] = -IM(x); + X_out[N2 + n] = IM(x); + X_out[N - 1 - n] = -RE(x); } } #endif diff --git a/src/libfaad/mdct.h b/src/libfaad/mdct.h index 22622606e..e06d1e5db 100644 --- a/src/libfaad/mdct.h +++ b/src/libfaad/mdct.h @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: mdct.h,v 1.2 2002/08/09 22:36:36 miguelfreitas Exp $ +** $Id: mdct.h,v 1.3 2002/12/16 19:00:40 miguelfreitas Exp $ **/ #ifndef __MDCT_H__ @@ -26,42 +26,9 @@ extern "C" { #endif -#ifdef USE_FFTW -#include <fftw.h> -#else #include "cfft.h" -#endif - -typedef struct { - real_t sin; - real_t cos; -} faad_sincos; - -#ifndef USE_FFTW -typedef struct { - real_t re; - real_t im; -} faad_complex; -#endif - -typedef struct { - faad_sincos *sincos; -#ifdef USE_FFTW - fftw_complex *Z1; - fftw_complex *Z2; - fftw_plan plan_backward; -#ifdef LTP_DEC - fftw_plan plan_forward; -#endif -#else - real_t *Z1; - faad_complex *Z2; - cfft_info cfft; -#endif - uint16_t N; -} mdct_info; -void faad_mdct_init(mdct_info *mdct, uint16_t N); +mdct_info *faad_mdct_init(uint16_t N); void faad_mdct_end(mdct_info *mdct); void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out); void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out); diff --git a/src/libfaad/mp4.c b/src/libfaad/mp4.c index 974b89adc..a55c13e2b 100644 --- a/src/libfaad/mp4.c +++ b/src/libfaad/mp4.c @@ -16,10 +16,12 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: mp4.c,v 1.2 2002/08/09 22:36:36 miguelfreitas Exp $ +** $Id: mp4.c,v 1.3 2002/12/16 19:00:42 miguelfreitas Exp $ **/ #include "common.h" +#include "structs.h" + #include "bits.h" #include "mp4.h" #include "data.h" @@ -34,7 +36,11 @@ static uint8_t ObjectTypesTable[32] = { 0, /* 1 AAC Main */ #endif 1, /* 2 AAC LC */ +#ifdef SSR_DEC + 1, /* 3 AAC SSR */ +#else 0, /* 3 AAC SSR */ +#endif #ifdef LTP_DEC 1, /* 4 AAC LTP */ #else @@ -95,6 +101,7 @@ static uint8_t ObjectTypesTable[32] = { /* Table 1.6.1 */ int8_t FAADAPI AudioSpecificConfig(uint8_t *pBuffer, + uint32_t buffer_size, uint32_t *samplerate, uint8_t *channels, uint8_t *sf_index, @@ -105,9 +112,11 @@ int8_t FAADAPI AudioSpecificConfig(uint8_t *pBuffer, uint8_t *frameLengthFlag) { bitfile ld; + uint8_t ep_config = 0; + int8_t result = 0; uint8_t ObjectTypeIndex, SamplingFrequencyIndex, ChannelsConfiguration; - faad_initbits(&ld, pBuffer); + faad_initbits(&ld, pBuffer, buffer_size); faad_byte_align(&ld); ObjectTypeIndex = (uint8_t)faad_getbits(&ld, 5 @@ -126,19 +135,21 @@ int8_t FAADAPI AudioSpecificConfig(uint8_t *pBuffer, *sf_index = SamplingFrequencyIndex; *object_type = ObjectTypeIndex; - if (ObjectTypesTable[ObjectTypeIndex] != 1) { + faad_endbits(&ld); return -1; } if (*samplerate == 0) { + faad_endbits(&ld); return -2; } if (ChannelsConfiguration > 7) { + faad_endbits(&ld); return -3; } @@ -147,28 +158,39 @@ int8_t FAADAPI AudioSpecificConfig(uint8_t *pBuffer, ObjectTypeIndex == 3 || ObjectTypeIndex == 4 || ObjectTypeIndex == 6 || ObjectTypeIndex == 7) { - return GASpecificConfig(&ld, channels, ObjectTypeIndex, + result = GASpecificConfig(&ld, channels, ObjectTypeIndex, +#ifdef ERROR_RESILIENCE aacSectionDataResilienceFlag, aacScalefactorDataResilienceFlag, aacSpectralDataResilienceFlag, +#endif frameLengthFlag); #ifdef ERROR_RESILIENCE } else if (ObjectTypeIndex >= ER_OBJECT_START) { /* ER */ - int8_t result = GASpecificConfig(&ld, channels, ObjectTypeIndex, + result = GASpecificConfig(&ld, channels, ObjectTypeIndex, +#ifdef ERROR_RESILIENCE aacSectionDataResilienceFlag, aacScalefactorDataResilienceFlag, aacSpectralDataResilienceFlag, +#endif frameLengthFlag); - uint8_t ep_config = (uint8_t)faad_getbits(&ld, 2 + ep_config = (uint8_t)faad_getbits(&ld, 2 DEBUGVAR(1,143,"parse_audio_decoder_specific_info(): epConfig")); - if (ep_config != 0) - return -5; - return result; + if (ep_config != 0) + result = -5; #endif } else { - return -4; + result = -4; } - return 0; +#ifdef SSR_DEC + /* shorter frames not allowed for SSR */ + if ((ObjectTypeIndex == 4) && *frameLengthFlag) + return -6; +#endif + + faad_endbits(&ld); + + return result; } diff --git a/src/libfaad/mp4.h b/src/libfaad/mp4.h index a0c5d6052..71eae905b 100644 --- a/src/libfaad/mp4.h +++ b/src/libfaad/mp4.h @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: mp4.h,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: mp4.h,v 1.2 2002/12/16 19:00:45 miguelfreitas Exp $ **/ #ifndef __MP4_H__ @@ -29,6 +29,7 @@ extern "C" { #include "decoder.h" int8_t FAADAPI AudioSpecificConfig(uint8_t *pBuffer, + uint32_t buffer_size, uint32_t *samplerate, uint8_t *channels, uint8_t *sf_index, diff --git a/src/libfaad/ms.c b/src/libfaad/ms.c index fcf2c8774..cb4a64020 100644 --- a/src/libfaad/ms.c +++ b/src/libfaad/ms.c @@ -16,10 +16,12 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: ms.c,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: ms.c,v 1.2 2002/12/16 19:00:47 miguelfreitas Exp $ **/ #include "common.h" +#include "structs.h" + #include "syntax.h" #include "ms.h" #include "is.h" diff --git a/src/libfaad/ms.h b/src/libfaad/ms.h index cc79498f3..4acb4685f 100644 --- a/src/libfaad/ms.h +++ b/src/libfaad/ms.h @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: ms.h,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: ms.h,v 1.2 2002/12/16 19:00:48 miguelfreitas Exp $ **/ #ifndef __MS_H__ diff --git a/src/libfaad/output.c b/src/libfaad/output.c index f6e8c1382..21507e9ce 100644 --- a/src/libfaad/output.c +++ b/src/libfaad/output.c @@ -16,14 +16,19 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: output.c,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: output.c,v 1.2 2002/12/16 19:00:49 miguelfreitas Exp $ **/ #include "common.h" +#include "structs.h" #include "output.h" #include "decoder.h" +#ifndef FIXED_POINT + +#include "dither.h" + #define ftol(A,B) {tmp = *(int32_t*) & A - 0x4B7F8000; \ B = (int16_t)((tmp==(int16_t)tmp) ? tmp : (tmp>>31)^0x7FFF);} @@ -32,16 +37,19 @@ #define ROUND32(x) ROUND(x) +#define ROUND64(x) (doubletmp = (x) + Dither.Add + (int64_t)0x001FFFFD80000000L, *(int64_t*)(&doubletmp) - (int64_t)0x433FFFFD80000000L) + #define FLOAT_SCALE (1.0f/(1<<15)) +dither_t Dither; +double doubletmp; void* output_to_PCM(real_t **input, void *sample_buffer, uint8_t channels, uint16_t frame_len, uint8_t format) { uint8_t ch; - uint16_t i; + uint16_t i, j = 0; - uint8_t *p = (uint8_t*)sample_buffer; int16_t *short_sample_buffer = (int16_t*)sample_buffer; int32_t *int_sample_buffer = (int32_t*)sample_buffer; float32_t *float_sample_buffer = (float32_t*)sample_buffer; @@ -62,6 +70,44 @@ void* output_to_PCM(real_t **input, void *sample_buffer, uint8_t channels, } } break; + case FAAD_FMT_16BIT_DITHER: + for (ch = 0; ch < channels; ch++) + { + for(i = 0; i < frame_len; i++, j++) + { + double Sum = input[ch][i] * 65535.f; + int64_t val; + if(j > 31) + j = 0; + val = dither_output(1, 0, j, Sum, ch) / 65536; + if (val > (1<<15)-1) + val = (1<<15)-1; + else if (val < -(1<<15)) + val = -(1<<15); + short_sample_buffer[(i*channels)+ch] = (int16_t)val; + } + } + break; + case FAAD_FMT_16BIT_L_SHAPE: + case FAAD_FMT_16BIT_M_SHAPE: + case FAAD_FMT_16BIT_H_SHAPE: + for (ch = 0; ch < channels; ch++) + { + for(i = 0; i < frame_len; i++, j++) + { + double Sum = input[ch][i] * 65535.f; + int64_t val; + if(j > 31) + j = 0; + val = dither_output(1, 1, j, Sum, ch) / 65536; + if (val > (1<<15)-1) + val = (1<<15)-1; + else if (val < -(1<<15)) + val = -(1<<15); + short_sample_buffer[(i*channels)+ch] = (int16_t)val; + } + } + break; case FAAD_FMT_24BIT: for (ch = 0; ch < channels; ch++) { @@ -104,4 +150,60 @@ void* output_to_PCM(real_t **input, void *sample_buffer, uint8_t channels, } return sample_buffer; -}
\ No newline at end of file +} + + +/* Dither output */ +static int64_t dither_output(uint8_t dithering, uint8_t shapingtype, uint16_t i, double Sum, uint8_t k) +{ + double Sum2; + int64_t val; + if(dithering) + { + if(!shapingtype) + { + double tmp = Random_Equi(Dither.Dither); + Sum2 = tmp - Dither.LastRandomNumber[k]; + Dither.LastRandomNumber[k] = tmp; + Sum2 = Sum += Sum2; + val = ROUND64(Sum2)&Dither.Mask; + } else { + Sum2 = Random_Triangular(Dither.Dither) - scalar16(Dither.DitherHistory[k], Dither.FilterCoeff + i); + Sum += Dither.DitherHistory[k][(-1-i)&15] = Sum2; + Sum2 = Sum + scalar16(Dither.ErrorHistory[k], Dither.FilterCoeff + i ); + val = ROUND64(Sum2)&Dither.Mask; + Dither.ErrorHistory[k][(-1-i)&15] = (float)(Sum - val); + } + return val; + } + else + return ROUND64 (Sum); +} + +#else + +void* output_to_PCM(real_t **input, void *sample_buffer, uint8_t channels, + uint16_t frame_len, uint8_t format) +{ + uint8_t ch; + uint16_t i; + int16_t *short_sample_buffer = (int16_t*)sample_buffer; + + /* Copy output to a standard PCM buffer */ + for (ch = 0; ch < channels; ch++) + { + for(i = 0; i < frame_len; i++) + { + int32_t tmp = input[ch][i]; + tmp += (1 << (REAL_BITS-1)); + tmp >>= REAL_BITS; + if (tmp > 0x7fff) tmp = 0x7fff; + else if (tmp <= -32768) tmp = -32768; + short_sample_buffer[(i*channels)+ch] = (int16_t)tmp; + } + } + + return sample_buffer; +} + +#endif diff --git a/src/libfaad/output.h b/src/libfaad/output.h index 144a20f35..e46547bbe 100644 --- a/src/libfaad/output.h +++ b/src/libfaad/output.h @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: output.h,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: output.h,v 1.2 2002/12/16 19:00:51 miguelfreitas Exp $ **/ #ifndef __OUTPUT_H__ @@ -32,7 +32,8 @@ void* output_to_PCM(real_t **input, uint16_t frame_len, uint8_t format); -typedef float float32_t; +static int64_t dither_output(uint8_t dithering, uint8_t shapingtype, + uint16_t i, double Sum, uint8_t k); #ifdef __cplusplus } diff --git a/src/libfaad/pns.c b/src/libfaad/pns.c index 8df56cb9c..b14aba5d7 100644 --- a/src/libfaad/pns.c +++ b/src/libfaad/pns.c @@ -16,105 +16,225 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: pns.c,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: pns.c,v 1.2 2002/12/16 19:00:53 miguelfreitas Exp $ **/ #include "common.h" +#include "structs.h" #include "pns.h" -/* Needs some more work */ -/* From the spec: - If the same scalefactor band and group is coded by perceptual noise - substitution in both channels of a channel pair, the correlation of - the noise signal can be controlled by means of the ms_used field: While - the default noise generation process works independently for each channel - (separate generation of random vectors), the same random vector is used - for both channels if ms_used[] is set for a particular scalefactor band - and group. In this case, no M/S stereo coding is carried out (because M/S - stereo coding and noise substitution coding are mutually exclusive). - If the same scalefactor band and group is coded by perceptual noise - substitution in only one channel of a channel pair the setting of ms_used[] - is not evaluated. -*/ +#ifdef FIXED_POINT +#define DIV(A, B) (((int64_t)A << COEF_BITS)/B) +#define step(shift) \ + if ((0x40000000l >> shift) + root <= value) \ + { \ + value -= (0x40000000l >> shift) + root; \ + root = (root >> 1) | (0x40000000l >> shift); \ + } else { \ + root = root >> 1; \ + } -static INLINE int32_t random2() +/* fixed point square root approximation */ +real_t fp_sqrt(real_t value) { - static int32_t state = 1; + real_t root = 0; - state = (1664525L * state) + 1013904223L; /* Numerical recipes */ + step( 0); step( 2); step( 4); step( 6); + step( 8); step(10); step(12); step(14); + step(16); step(18); step(20); step(22); + step(24); step(26); step(28); step(30); - return state; + if (root < value) + ++root; + + root <<= (COEF_BITS/2); + + return root; } +static real_t pow2_table[] = +{ + COEF_CONST(0.59460355750136), + COEF_CONST(0.70710678118655), + COEF_CONST(0.84089641525371), + COEF_CONST(1.0), + COEF_CONST(1.18920711500272), + COEF_CONST(1.41421356237310), + COEF_CONST(1.68179283050743) +}; +#endif + /* The function gen_rand_vector(addr, size) generates a vector of length <size> with signed random values of average energy MEAN_NRG per random value. A suitable random number generator can be realized using one multiplication/accumulation per random value. */ -static INLINE void gen_rand_vector(real_t *spec, uint16_t scale_factor, uint16_t size) +static INLINE void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size) { +#ifndef FIXED_POINT uint16_t i; - real_t scale; + real_t energy = 0.0; + + real_t scale = 1.0/(real_t)size * ISQRT_MEAN_NRG; for (i = 0; i < size; i++) { - spec[i] = (real_t)random2(); + real_t tmp = scale*(real_t)(int32_t)random_int(); + spec[i] = tmp; + energy += tmp*tmp; } - /* 14496-3 says: - scale = 1.0f/(size * (real_t)sqrt(MEAN_NRG)); - */ - scale = 1.0f/(real_t)sqrt(size * MEAN_NRG); - scale = MUL(scale, (real_t)exp(LN2 * 0.25 * scale_factor)); + scale = 1.0/(real_t)sqrt(energy); + scale *= (real_t)pow(2.0, 0.25 * scale_factor); + for (i = 0; i < size; i++) + { + spec[i] *= scale; + } +#else + uint16_t i; + real_t energy = 0, scale; + int32_t exp, frac; - /* Scale random vector to desired target energy */ for (i = 0; i < size; i++) - spec[i] = MUL(spec[i], scale); + { + real_t tmp = ISQRT_MEAN_NRG * (int32_t)random_int(); + tmp = MUL_C_C(COEF_CONST(1)/size, tmp); + + energy += MUL_C_C(tmp,tmp); + + /* convert COEF to REAL */ + spec[i] = (tmp >> -(REAL_BITS-COEF_BITS)); + } + + energy = fp_sqrt(energy); + if (energy > 0) + { + scale = DIV(COEF_CONST(1),energy); + + scale >>= -(REAL_BITS-COEF_BITS); + + exp = scale_factor / 4; + frac = scale_factor % 4; + + if (exp < 0) + scale >>= -exp; + else + scale <<= exp; + + if (frac) + scale = MUL_R_C(scale, pow2_table[frac + 3]); + + for (i = 0; i < size; i++) + { + spec[i] = MUL(spec[i], scale); + } + } +#endif } -void pns_decode(ic_stream *ics, real_t *spec, uint16_t frame_len) +void pns_decode(ic_stream *ics_left, ic_stream *ics_right, + real_t *spec_left, real_t *spec_right, uint16_t frame_len, + uint8_t channel_pair) { uint8_t g, sfb, b; uint16_t size, offs; uint8_t group = 0; - uint16_t nshort = frame_len/8; + uint16_t nshort = frame_len >> 3; - for (g = 0; g < ics->num_window_groups; g++) + for (g = 0; g < ics_left->num_window_groups; g++) { /* Do perceptual noise substitution decoding */ - for (b = 0; b < ics->window_group_length[g]; b++) + for (b = 0; b < ics_left->window_group_length[g]; b++) { - for (sfb = 0; sfb < ics->max_sfb; sfb++) + for (sfb = 0; sfb < ics_left->max_sfb; sfb++) { - if (is_noise(ics, g, sfb)) + if (is_noise(ics_left, g, sfb)) { /* Simultaneous use of LTP and PNS is not prevented in the syntax. If both LTP, and PNS are enabled on the same scalefactor band, PNS takes precedence, and no prediction is applied to this band. - */ - ics->ltp.long_used[sfb] = 0; - ics->ltp2.long_used[sfb] = 0; + */ + ics_left->ltp.long_used[sfb] = 0; + ics_left->ltp2.long_used[sfb] = 0; /* For scalefactor bands coded using PNS the corresponding predictors are switched to "off". - */ - ics->pred.prediction_used[sfb] = 0; - - offs = ics->swb_offset[sfb]; - size = ics->swb_offset[sfb+1] - offs; + */ + ics_left->pred.prediction_used[sfb] = 0; + + offs = ics_left->swb_offset[sfb]; + size = ics_left->swb_offset[sfb+1] - offs; /* Generate random vector */ - gen_rand_vector(&spec[(group*nshort)+offs], - ics->scale_factors[g][sfb], size); + gen_rand_vector(&spec_left[(group*nshort)+offs], + ics_left->scale_factors[g][sfb], size); + } + +/* From the spec: + If the same scalefactor band and group is coded by perceptual noise + substitution in both channels of a channel pair, the correlation of + the noise signal can be controlled by means of the ms_used field: While + the default noise generation process works independently for each channel + (separate generation of random vectors), the same random vector is used + for both channels if ms_used[] is set for a particular scalefactor band + and group. In this case, no M/S stereo coding is carried out (because M/S + stereo coding and noise substitution coding are mutually exclusive). + If the same scalefactor band and group is coded by perceptual noise + substitution in only one channel of a channel pair the setting of ms_used[] + is not evaluated. +*/ + if (channel_pair) + { + if (is_noise(ics_right, g, sfb)) + { + if (ics_left->ms_mask_present == 1) + { + if (ics_left->ms_used[g][sfb]) + { + uint16_t c; + + offs = ics_right->swb_offset[sfb]; + size = ics_right->swb_offset[sfb+1] - offs; + + for (c = 0; c < size; c++) + { + spec_right[(group*nshort) + offs + c] = + spec_left[(group*nshort) + offs + c]; + } + } + } else if (ics_left->ms_mask_present == 2) { + uint16_t c; + + offs = ics_right->swb_offset[sfb]; + size = ics_right->swb_offset[sfb+1] - offs; + + for (c = 0; c < size; c++) + { + spec_right[(group*nshort) + offs + c] = + spec_left[(group*nshort) + offs + c]; + } + } else /*if (ics_left->ms_mask_present == 0)*/ { + ics_right->ltp.long_used[sfb] = 0; + ics_right->ltp2.long_used[sfb] = 0; + ics_right->pred.prediction_used[sfb] = 0; + + offs = ics_right->swb_offset[sfb]; + size = ics_right->swb_offset[sfb+1] - offs; + + /* Generate random vector */ + gen_rand_vector(&spec_right[(group*nshort)+offs], + ics_right->scale_factors[g][sfb], size); + } + } } - } + } /* sfb */ group++; - } - } + } /* b */ + } /* g */ } diff --git a/src/libfaad/pns.h b/src/libfaad/pns.h index 6cbcf00b8..1e381ec24 100644 --- a/src/libfaad/pns.h +++ b/src/libfaad/pns.h @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: pns.h,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: pns.h,v 1.2 2002/12/16 19:00:57 miguelfreitas Exp $ **/ #ifndef __PNS_H__ @@ -26,17 +26,25 @@ extern "C" { #endif -#include "syntax.h" #include "common.h" +#include "syntax.h" + #define NOISE_OFFSET 90 -#define MEAN_NRG 1.537228e+18 /* (2^31)^2 / 3 */ +/* #define MEAN_NRG 1.537228e+18 */ /* (2^31)^2 / 3 */ +#ifdef FIXED_POINT +#define ISQRT_MEAN_NRG 0x1DC7 /* sqrt(1/sqrt(MEAN_NRG)) */ +#else +#define ISQRT_MEAN_NRG 8.0655e-10 /* 1/sqrt(MEAN_NRG) */ +#endif -void pns_decode(ic_stream *ics, real_t *spec, uint16_t frame_len); +void pns_decode(ic_stream *ics_left, ic_stream *ics_right, + real_t *spec_left, real_t *spec_right, uint16_t frame_len, + uint8_t channel_pair); static INLINE int32_t random2(); -static void gen_rand_vector(real_t *spec, uint16_t scale_factor, uint16_t size); +static void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size); static INLINE uint8_t is_noise(ic_stream *ics, uint8_t group, uint8_t sfb) { diff --git a/src/libfaad/pulse.c b/src/libfaad/pulse.c index f3f149a71..024c473d9 100644 --- a/src/libfaad/pulse.c +++ b/src/libfaad/pulse.c @@ -16,10 +16,12 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: pulse.c,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: pulse.c,v 1.2 2002/12/16 19:00:59 miguelfreitas Exp $ **/ #include "common.h" +#include "structs.h" + #include "syntax.h" #include "pulse.h" diff --git a/src/libfaad/pulse.h b/src/libfaad/pulse.h index 13283acfa..d0084ccc3 100644 --- a/src/libfaad/pulse.h +++ b/src/libfaad/pulse.h @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: pulse.h,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: pulse.h,v 1.2 2002/12/16 19:01:00 miguelfreitas Exp $ **/ #ifndef __PULSE_H__ diff --git a/src/libfaad/rvlc.c b/src/libfaad/rvlc.c new file mode 100644 index 000000000..2194906d6 --- /dev/null +++ b/src/libfaad/rvlc.c @@ -0,0 +1,510 @@ +/* +** FAAD - Freeware Advanced Audio Decoder +** Copyright (C) 2002 M. Bakker +** +** 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. +** +** $Id: rvlc.c,v 1.1 2002/12/16 19:01:03 miguelfreitas Exp $ +**/ + +/* RVLC scalefactor decoding + * + * RVLC works like this: + * 1. Only symmetric huffman codewords are used + * 2. Total length of the scalefactor data is stored in the bitsream + * 3. Scalefactors are DPCM coded + * 4. Next to the starting value for DPCM the ending value is also stored + * + * With all this it is possible to read the scalefactor data from 2 sides. + * If there is a bit error in the scalefactor data it is possible to start + * decoding from the other end of the data, to find all but 1 scalefactor. + */ + +#include "common.h" +#include "structs.h" + +#include <stdlib.h> + +#include "syntax.h" +#include "bits.h" +#include "rvlc.h" + + +#ifdef ERROR_RESILIENCE + +//#define PRINT_RVLC + +uint8_t rvlc_scale_factor_data(ic_stream *ics, bitfile *ld) +{ + uint8_t bits = 9; + + ics->sf_concealment = faad_get1bit(ld + DEBUGVAR(1,149,"rvlc_scale_factor_data(): sf_concealment")); + ics->rev_global_gain = faad_getbits(ld, 8 + DEBUGVAR(1,150,"rvlc_scale_factor_data(): rev_global_gain")); + + if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) + bits = 11; + + /* the number of bits used for the huffman codewords */ + ics->length_of_rvlc_sf = faad_getbits(ld, bits + DEBUGVAR(1,151,"rvlc_scale_factor_data(): length_of_rvlc_sf")); + + if (ics->noise_used) + { + ics->dpcm_noise_nrg = faad_getbits(ld, 9 + DEBUGVAR(1,152,"rvlc_scale_factor_data(): dpcm_noise_nrg")); + + ics->length_of_rvlc_sf -= 9; + } + + ics->sf_escapes_present = faad_get1bit(ld + DEBUGVAR(1,153,"rvlc_scale_factor_data(): sf_escapes_present")); + + if (ics->sf_escapes_present) + { + ics->length_of_rvlc_escapes = faad_getbits(ld, 8 + DEBUGVAR(1,154,"rvlc_scale_factor_data(): length_of_rvlc_escapes")); + } + + if (ics->noise_used) + { + ics->dpcm_noise_last_position = faad_getbits(ld, 9 + DEBUGVAR(1,155,"rvlc_scale_factor_data(): dpcm_noise_last_position")); + } + + return 0; +} + +uint8_t rvlc_decode_scale_factors(ic_stream *ics, bitfile *ld) +{ + uint8_t result; + uint8_t intensity_used = 0; + uint8_t *rvlc_sf_buffer = NULL; + uint8_t *rvlc_esc_buffer = NULL; + bitfile ld_rvlc_sf, ld_rvlc_esc; +// bitfile ld_rvlc_sf_rev, ld_rvlc_esc_rev; + + if (ics->length_of_rvlc_sf > 0) + { + /* We read length_of_rvlc_sf bits here to put it in a + seperate bitfile. + */ + rvlc_sf_buffer = faad_getbitbuffer(ld, ics->length_of_rvlc_sf + DEBUGVAR(1,156,"rvlc_decode_scale_factors(): bitbuffer: length_of_rvlc_sf")); + + faad_initbits(&ld_rvlc_sf, (void*)rvlc_sf_buffer, bit2byte(ics->length_of_rvlc_sf)); +// faad_initbits_rev(&ld_rvlc_sf_rev, (void*)rvlc_sf_buffer, +// ics->length_of_rvlc_sf); + } + + if (ics->sf_escapes_present) + { + /* We read length_of_rvlc_escapes bits here to put it in a + seperate bitfile. + */ + rvlc_esc_buffer = faad_getbitbuffer(ld, ics->length_of_rvlc_escapes + DEBUGVAR(1,157,"rvlc_decode_scale_factors(): bitbuffer: length_of_rvlc_escapes")); + + faad_initbits(&ld_rvlc_esc, (void*)rvlc_esc_buffer, bit2byte(ics->length_of_rvlc_escapes)); +// faad_initbits_rev(&ld_rvlc_esc_rev, (void*)rvlc_esc_buffer, +// ics->length_of_rvlc_escapes); + } + + /* decode the rvlc scale factors and escapes */ + result = rvlc_decode_sf_forward(ics, &ld_rvlc_sf, + &ld_rvlc_esc, &intensity_used); +// result = rvlc_decode_sf_reverse(ics, &ld_rvlc_sf_rev, +// &ld_rvlc_esc_rev, intensity_used); + + + if (rvlc_esc_buffer) free(rvlc_esc_buffer); + if (rvlc_sf_buffer) free(rvlc_sf_buffer); + + faad_endbits(&ld_rvlc_sf); + faad_endbits(&ld_rvlc_esc); + + return result; +} + +static uint8_t rvlc_decode_sf_forward(ic_stream *ics, bitfile *ld_sf, bitfile *ld_esc, + uint8_t *intensity_used) +{ + int8_t g, sfb; + int8_t t = 0; + int8_t error = 0; + int8_t noise_pcm_flag = 1; + + int16_t scale_factor = ics->global_gain; + int16_t is_position = 0; + int16_t noise_energy = ics->global_gain - 90 - 256; + +#ifdef PRINT_RVLC + printf("\nglobal_gain: %d\n", ics->global_gain); +#endif + + for (g = 0; g < ics->num_window_groups; g++) + { + for (sfb = 0; sfb < ics->max_sfb; sfb++) + { + if (error) + { + ics->scale_factors[g][sfb] = 0; + } else { + switch (ics->sfb_cb[g][sfb]) + { + case ZERO_HCB: /* zero book */ + ics->scale_factors[g][sfb] = 0; + break; + case INTENSITY_HCB: /* intensity books */ + case INTENSITY_HCB2: + + *intensity_used = 1; + + /* decode intensity position */ + t = rvlc_huffman_sf(ld_sf, ld_esc, +1); + + is_position += t; + ics->scale_factors[g][sfb] = is_position; + + break; + case NOISE_HCB: /* noise books */ + + /* decode noise energy */ + if (noise_pcm_flag) + { + int16_t n = ics->dpcm_noise_nrg; + noise_pcm_flag = 0; + noise_energy += n; + } else { + t = rvlc_huffman_sf(ld_sf, ld_esc, +1); + noise_energy += t; + } + + ics->scale_factors[g][sfb] = noise_energy; + + break; + case BOOKSCL: /* invalid books */ + return 3; + default: /* spectral books */ + + /* decode scale factor */ + t = rvlc_huffman_sf(ld_sf, ld_esc, +1); + + scale_factor += t; + if (scale_factor < 0) + return 4; + + ics->scale_factors[g][sfb] = scale_factor; + + break; + } +#ifdef PRINT_RVLC + printf("%3d:%4d%4d\n", sfb, ics->sfb_cb[g][sfb], + ics->scale_factors[g][sfb]); +#endif + if (t == 99) + { + error = 1; + } + } + } + } +#ifdef PRINT_RVLC + printf("\n\n"); +#endif + + return 0; +} + +static uint8_t rvlc_decode_sf_reverse(ic_stream *ics, bitfile *ld_sf, bitfile *ld_esc, + uint8_t intensity_used) +{ + int8_t g, sfb; + int8_t t = 0; + int8_t error = 0; + int8_t noise_pcm_flag = 1, is_pcm_flag = 1, sf_pcm_flag = 1; + + int16_t scale_factor = ics->rev_global_gain; + int16_t is_position = 0; + int16_t noise_energy = ics->rev_global_gain; + +#ifdef PRINT_RVLC + printf("\nrev_global_gain: %d\n", ics->rev_global_gain); +#endif + + if (intensity_used) + { + is_position = rvlc_huffman_sf(ld_sf, ld_esc, -1); +#ifdef PRINT_RVLC + printf("is_position: %d\n", is_position); +#endif + } + + for (g = ics->num_window_groups-1; g >= 0; g--) + { + for (sfb = ics->max_sfb-1; sfb >= 0; sfb--) + { + if (error) + { + ics->scale_factors[g][sfb] = 0; + } else { + switch (ics->sfb_cb[g][sfb]) + { + case ZERO_HCB: /* zero book */ + ics->scale_factors[g][sfb] = 0; + break; + case INTENSITY_HCB: /* intensity books */ + case INTENSITY_HCB2: + + if (is_pcm_flag) + { + is_pcm_flag = 0; + ics->scale_factors[g][sfb] = is_position; + } else { + t = rvlc_huffman_sf(ld_sf, ld_esc, -1); + is_position -= t; + + ics->scale_factors[g][sfb] = is_position; + } + + break; + case NOISE_HCB: /* noise books */ + + /* decode noise energy */ + if (noise_pcm_flag) + { + noise_pcm_flag = 0; + noise_energy = ics->dpcm_noise_last_position; + } else { + t = rvlc_huffman_sf(ld_sf, ld_esc, -1); + noise_energy -= t; + } + + ics->scale_factors[g][sfb] = noise_energy; + + break; + case BOOKSCL: /* invalid books */ + return 3; + default: /* spectral books */ + + if (sf_pcm_flag || (sfb == 0)) + { + sf_pcm_flag = 0; + if (sfb == 0) + scale_factor = ics->global_gain; + } else { + /* decode scale factor */ + t = rvlc_huffman_sf(ld_sf, ld_esc, -1); + scale_factor -= t; + } + + ics->scale_factors[g][sfb] = scale_factor; + + if (scale_factor < 0) + return 4; + + break; + } +#ifdef PRINT_RVLC + printf("%3d:%4d%4d\n", sfb, ics->sfb_cb[g][sfb], + ics->scale_factors[g][sfb]); +#endif + if (t == 99) + { + error = 1; + } + } + } + } + +#ifdef PRINT_RVLC + printf("\n\n"); +#endif + + return 0; +} + +/* index == 99 means not allowed codeword */ +static rvlc_huff_table book_rvlc[] = { + /*index length codeword */ + { 0, 1, 0 }, /* 0 */ + { -1, 3, 5 }, /* 101 */ + { 1, 3, 7 }, /* 111 */ + { -2, 4, 9 }, /* 1001 */ + { -3, 5, 17 }, /* 10001 */ + { 2, 5, 27 }, /* 11011 */ + { -4, 6, 33 }, /* 100001 */ + { 99, 6, 50 }, /* 110010 */ + { 3, 6, 51 }, /* 110011 */ + { 99, 6, 52 }, /* 110100 */ + { -7, 7, 65 }, /* 1000001 */ + { 99, 7, 96 }, /* 1100000 */ + { 99, 7, 98 }, /* 1100010 */ + { 7, 7, 99 }, /* 1100011 */ + { 4, 7, 107 }, /* 1101011 */ + { -5, 8, 129 }, /* 10000001 */ + { 99, 8, 194 }, /* 11000010 */ + { 5, 8, 195 }, /* 11000011 */ + { 99, 8, 212 }, /* 11010100 */ + { 99, 9, 256 }, /* 100000000 */ + { -6, 9, 257 }, /* 100000001 */ + { 99, 9, 426 }, /* 110101010 */ + { 6, 9, 427 }, /* 110101011 */ + { 99, 10, 0 } /* Shouldn't come this far */ +}; + +static rvlc_huff_table book_escape[] = { + /*index length codeword */ + { 1, 2, 0 }, + { 0, 2, 2 }, + { 3, 3, 2 }, + { 2, 3, 6 }, + { 4, 4, 14 }, + { 7, 5, 13 }, + { 6, 5, 15 }, + { 5, 5, 31 }, + { 11, 6, 24 }, + { 10, 6, 25 }, + { 9, 6, 29 }, + { 8, 6, 61 }, + { 13, 7, 56 }, + { 12, 7, 120 }, + { 15, 8, 114 }, + { 14, 8, 242 }, + { 17, 9, 230 }, + { 16, 9, 486 }, + { 19, 10, 463 }, + { 18, 10, 974 }, + { 22, 11, 925 }, + { 20, 11, 1950 }, + { 21, 11, 1951 }, + { 23, 12, 1848 }, + { 25, 13, 3698 }, + { 24, 14, 7399 }, + { 26, 15, 14797 }, + { 49, 19, 236736 }, + { 50, 19, 236737 }, + { 51, 19, 236738 }, + { 52, 19, 236739 }, + { 53, 19, 236740 }, + { 27, 20, 473482 }, + { 28, 20, 473483 }, + { 29, 20, 473484 }, + { 30, 20, 473485 }, + { 31, 20, 473486 }, + { 32, 20, 473487 }, + { 33, 20, 473488 }, + { 34, 20, 473489 }, + { 35, 20, 473490 }, + { 36, 20, 473491 }, + { 37, 20, 473492 }, + { 38, 20, 473493 }, + { 39, 20, 473494 }, + { 40, 20, 473495 }, + { 41, 20, 473496 }, + { 42, 20, 473497 }, + { 43, 20, 473498 }, + { 44, 20, 473499 }, + { 45, 20, 473500 }, + { 46, 20, 473501 }, + { 47, 20, 473502 }, + { 48, 20, 473503 }, + { 99, 21, 0 } /* Shouldn't come this far */ +}; + +static int8_t rvlc_huffman_sf(bitfile *ld_sf, bitfile *ld_esc, + int8_t direction) +{ + uint8_t i, j; + int8_t index; + uint32_t cw; + rvlc_huff_table *h = book_rvlc; + + i = h->len; + if (direction > 0) + cw = faad_getbits(ld_sf, i DEBUGVAR(1,0,"")); + else + cw = faad_getbits_rev(ld_sf, i DEBUGVAR(1,0,"")); + + while ((cw != h->cw) + && (i < 10)) + { + h++; + j = h->len-i; + i += j; + cw <<= j; + if (direction > 0) + cw |= faad_getbits(ld_sf, j DEBUGVAR(1,0,"")); + else + cw |= faad_getbits_rev(ld_sf, j DEBUGVAR(1,0,"")); + } + + index = h->index; + + if (index == +ESC_VAL) + { + int8_t esc = rvlc_huffman_esc(ld_esc, direction); + if (esc == 99) + return 99; + index += esc; +#ifdef PRINT_RVLC + printf("esc: %d - ", esc); +#endif + } + if (index == -ESC_VAL) + { + int8_t esc = rvlc_huffman_esc(ld_esc, direction); + if (esc == 99) + return 99; + index -= esc; +#ifdef PRINT_RVLC + printf("esc: %d - ", esc); +#endif + } + + return index; +} + +static int8_t rvlc_huffman_esc(bitfile *ld, + int8_t direction) +{ + uint8_t i, j; + uint32_t cw; + rvlc_huff_table *h = book_escape; + + i = h->len; + if (direction > 0) + cw = faad_getbits(ld, i); + else + cw = faad_getbits_rev(ld, i); + + while ((cw != h->cw) + && (i < 21)) + { + h++; + j = h->len-i; + i += j; + cw <<= j; + if (direction > 0) + cw |= faad_getbits(ld, j DEBUGVAR(1,0,"")); + else + cw |= faad_getbits_rev(ld, j DEBUGVAR(1,0,"")); + } + + return h->index; +} + +#endif
\ No newline at end of file diff --git a/src/libfaad/rvlc.h b/src/libfaad/rvlc.h new file mode 100644 index 000000000..6727f5caa --- /dev/null +++ b/src/libfaad/rvlc.h @@ -0,0 +1,59 @@ +/* +** FAAD - Freeware Advanced Audio Decoder +** Copyright (C) 2002 M. Bakker +** +** 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. +** +** $Id: rvlc.h,v 1.1 2002/12/16 19:01:06 miguelfreitas Exp $ +**/ + +#ifndef __RVLC_SCF_H__ +#define __RVLC_SCF_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct +{ + int8_t index; + uint8_t len; + uint32_t cw; +} rvlc_huff_table; + + +#define ESC_VAL 7 + + +uint8_t rvlc_scale_factor_data(ic_stream *ics, bitfile *ld); +uint8_t rvlc_decode_scale_factors(ic_stream *ics, bitfile *ld); + +static uint8_t rvlc_decode_sf_forward(ic_stream *ics, + bitfile *ld_sf, + bitfile *ld_esc, + uint8_t *is_used); +static uint8_t rvlc_decode_sf_reverse(ic_stream *ics, + bitfile *ld_sf, + bitfile *ld_esc, + uint8_t is_used); +static int8_t rvlc_huffman_sf(bitfile *ld_sf, bitfile *ld_esc, + int8_t direction); +static int8_t rvlc_huffman_esc(bitfile *ld_esc, int8_t direction); + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/libfaad/sine_win.h b/src/libfaad/sine_win.h new file mode 100644 index 000000000..9e6fd503b --- /dev/null +++ b/src/libfaad/sine_win.h @@ -0,0 +1,8542 @@ +/* +** FAAD - Freeware Advanced Audio Decoder +** Copyright (C) 2002 M. Bakker +** +** 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. +** +** $Id: sine_win.h,v 1.1 2002/12/16 19:01:06 miguelfreitas Exp $ +**/ + +#ifndef __SINE_WIN_H__ +#define __SINE_WIN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef FIXED_POINT + +#ifdef _MSC_VER +#pragma warning(disable:4305) +#pragma warning(disable:4244) +#endif + +real_t sine_long_1024[] = +{ + 0.0007669903, + 0.0023009692, + 0.0038349427, + 0.0053689071, + 0.0069028589, + 0.0084367945, + 0.0099707102, + 0.0115046024, + 0.0130384676, + 0.0145723021, + 0.0161061023, + 0.0176398646, + 0.0191735854, + 0.0207072611, + 0.0222408880, + 0.0237744627, + 0.0253079813, + 0.0268414404, + 0.0283748364, + 0.0299081656, + 0.0314414244, + 0.0329746092, + 0.0345077165, + 0.0360407425, + 0.0375736838, + 0.0391065366, + 0.0406392974, + 0.0421719625, + 0.0437045285, + 0.0452369916, + 0.0467693482, + 0.0483015948, + 0.0498337277, + 0.0513657434, + 0.0528976382, + 0.0544294085, + 0.0559610508, + 0.0574925613, + 0.0590239366, + 0.0605551730, + 0.0620862669, + 0.0636172147, + 0.0651480128, + 0.0666786576, + 0.0682091456, + 0.0697394730, + 0.0712696363, + 0.0727996319, + 0.0743294562, + 0.0758591055, + 0.0773885764, + 0.0789178652, + 0.0804469683, + 0.0819758821, + 0.0835046030, + 0.0850331273, + 0.0865614516, + 0.0880895722, + 0.0896174856, + 0.0911451880, + 0.0926726760, + 0.0941999459, + 0.0957269942, + 0.0972538171, + 0.0987804113, + 0.1003067730, + 0.1018328987, + 0.1033587847, + 0.1048844276, + 0.1064098236, + 0.1079349692, + 0.1094598609, + 0.1109844950, + 0.1125088679, + 0.1140329761, + 0.1155568160, + 0.1170803839, + 0.1186036763, + 0.1201266897, + 0.1216494204, + 0.1231718648, + 0.1246940194, + 0.1262158806, + 0.1277374448, + 0.1292587084, + 0.1307796678, + 0.1323003195, + 0.1338206599, + 0.1353406854, + 0.1368603924, + 0.1383797774, + 0.1398988368, + 0.1414175669, + 0.1429359643, + 0.1444540254, + 0.1459717465, + 0.1474891242, + 0.1490061548, + 0.1505228347, + 0.1520391605, + 0.1535551285, + 0.1550707352, + 0.1565859770, + 0.1581008503, + 0.1596153516, + 0.1611294774, + 0.1626432239, + 0.1641565877, + 0.1656695653, + 0.1671821530, + 0.1686943474, + 0.1702061448, + 0.1717175416, + 0.1732285344, + 0.1747391196, + 0.1762492936, + 0.1777590529, + 0.1792683938, + 0.1807773130, + 0.1822858067, + 0.1837938716, + 0.1853015039, + 0.1868087002, + 0.1883154569, + 0.1898217705, + 0.1913276375, + 0.1928330542, + 0.1943380172, + 0.1958425228, + 0.1973465677, + 0.1988501481, + 0.2003532607, + 0.2018559018, + 0.2033580679, + 0.2048597554, + 0.2063609610, + 0.2078616809, + 0.2093619117, + 0.2108616499, + 0.2123608919, + 0.2138596342, + 0.2153578733, + 0.2168556056, + 0.2183528276, + 0.2198495358, + 0.2213457267, + 0.2228413967, + 0.2243365424, + 0.2258311602, + 0.2273252466, + 0.2288187981, + 0.2303118111, + 0.2318042822, + 0.2332962078, + 0.2347875845, + 0.2362784086, + 0.2377686768, + 0.2392583855, + 0.2407475313, + 0.2422361105, + 0.2437241197, + 0.2452115554, + 0.2466984140, + 0.2481846922, + 0.2496703864, + 0.2511554931, + 0.2526400088, + 0.2541239300, + 0.2556072532, + 0.2570899749, + 0.2585720917, + 0.2600536001, + 0.2615344965, + 0.2630147775, + 0.2644944396, + 0.2659734793, + 0.2674518932, + 0.2689296777, + 0.2704068294, + 0.2718833448, + 0.2733592205, + 0.2748344529, + 0.2763090386, + 0.2777829741, + 0.2792562559, + 0.2807288807, + 0.2822008448, + 0.2836721449, + 0.2851427776, + 0.2866127392, + 0.2880820264, + 0.2895506357, + 0.2910185637, + 0.2924858069, + 0.2939523618, + 0.2954182251, + 0.2968833932, + 0.2983478627, + 0.2998116301, + 0.3012746921, + 0.3027370451, + 0.3041986858, + 0.3056596107, + 0.3071198163, + 0.3085792992, + 0.3100380561, + 0.3114960833, + 0.3129533776, + 0.3144099355, + 0.3158657535, + 0.3173208283, + 0.3187751564, + 0.3202287344, + 0.3216815589, + 0.3231336264, + 0.3245849335, + 0.3260354769, + 0.3274852530, + 0.3289342586, + 0.3303824902, + 0.3318299443, + 0.3332766176, + 0.3347225067, + 0.3361676081, + 0.3376119185, + 0.3390554345, + 0.3404981526, + 0.3419400695, + 0.3433811818, + 0.3448214861, + 0.3462609790, + 0.3476996571, + 0.3491375170, + 0.3505745554, + 0.3520107688, + 0.3534461540, + 0.3548807074, + 0.3563144257, + 0.3577473057, + 0.3591793438, + 0.3606105367, + 0.3620408811, + 0.3634703735, + 0.3648990107, + 0.3663267892, + 0.3677537058, + 0.3691797569, + 0.3706049394, + 0.3720292498, + 0.3734526847, + 0.3748752409, + 0.3762969150, + 0.3777177036, + 0.3791376034, + 0.3805566111, + 0.3819747232, + 0.3833919366, + 0.3848082478, + 0.3862236535, + 0.3876381503, + 0.3890517351, + 0.3904644043, + 0.3918761548, + 0.3932869831, + 0.3946968860, + 0.3961058601, + 0.3975139021, + 0.3989210088, + 0.4003271768, + 0.4017324027, + 0.4031366834, + 0.4045400154, + 0.4059423955, + 0.4073438203, + 0.4087442867, + 0.4101437912, + 0.4115423307, + 0.4129399017, + 0.4143365010, + 0.4157321254, + 0.4171267715, + 0.4185204361, + 0.4199131159, + 0.4213048075, + 0.4226955078, + 0.4240852135, + 0.4254739212, + 0.4268616277, + 0.4282483298, + 0.4296340242, + 0.4310187077, + 0.4324023768, + 0.4337850286, + 0.4351666595, + 0.4365472665, + 0.4379268463, + 0.4393053955, + 0.4406829110, + 0.4420593896, + 0.4434348280, + 0.4448092229, + 0.4461825711, + 0.4475548694, + 0.4489261146, + 0.4502963034, + 0.4516654326, + 0.4530334990, + 0.4544004994, + 0.4557664305, + 0.4571312892, + 0.4584950722, + 0.4598577763, + 0.4612193983, + 0.4625799351, + 0.4639393833, + 0.4652977398, + 0.4666550015, + 0.4680111650, + 0.4693662273, + 0.4707201851, + 0.4720730353, + 0.4734247746, + 0.4747754000, + 0.4761249081, + 0.4774732959, + 0.4788205601, + 0.4801666976, + 0.4815117052, + 0.4828555798, + 0.4841983182, + 0.4855399172, + 0.4868803737, + 0.4882196845, + 0.4895578465, + 0.4908948565, + 0.4922307114, + 0.4935654080, + 0.4948989433, + 0.4962313139, + 0.4975625169, + 0.4988925491, + 0.5002214073, + 0.5015490885, + 0.5028755895, + 0.5042009071, + 0.5055250384, + 0.5068479800, + 0.5081697290, + 0.5094902823, + 0.5108096366, + 0.5121277890, + 0.5134447363, + 0.5147604754, + 0.5160750032, + 0.5173883167, + 0.5187004127, + 0.5200112881, + 0.5213209399, + 0.5226293650, + 0.5239365603, + 0.5252425227, + 0.5265472491, + 0.5278507366, + 0.5291529819, + 0.5304539821, + 0.5317537341, + 0.5330522349, + 0.5343494813, + 0.5356454703, + 0.5369401989, + 0.5382336641, + 0.5395258627, + 0.5408167917, + 0.5421064482, + 0.5433948291, + 0.5446819312, + 0.5459677517, + 0.5472522875, + 0.5485355355, + 0.5498174928, + 0.5510981563, + 0.5523775230, + 0.5536555900, + 0.5549323541, + 0.5562078124, + 0.5574819619, + 0.5587547996, + 0.5600263225, + 0.5612965275, + 0.5625654118, + 0.5638329724, + 0.5650992062, + 0.5663641102, + 0.5676276815, + 0.5688899172, + 0.5701508142, + 0.5714103696, + 0.5726685804, + 0.5739254436, + 0.5751809564, + 0.5764351157, + 0.5776879185, + 0.5789393621, + 0.5801894433, + 0.5814381593, + 0.5826855071, + 0.5839314838, + 0.5851760864, + 0.5864193121, + 0.5876611579, + 0.5889016208, + 0.5901406980, + 0.5913783866, + 0.5926146835, + 0.5938495860, + 0.5950830911, + 0.5963151959, + 0.5975458976, + 0.5987751931, + 0.6000030797, + 0.6012295544, + 0.6024546144, + 0.6036782567, + 0.6049004785, + 0.6061212769, + 0.6073406491, + 0.6085585921, + 0.6097751031, + 0.6109901793, + 0.6122038177, + 0.6134160156, + 0.6146267701, + 0.6158360782, + 0.6170439373, + 0.6182503444, + 0.6194552967, + 0.6206587913, + 0.6218608255, + 0.6230613964, + 0.6242605011, + 0.6254581369, + 0.6266543010, + 0.6278489904, + 0.6290422025, + 0.6302339344, + 0.6314241833, + 0.6326129463, + 0.6338002208, + 0.6349860039, + 0.6361702928, + 0.6373530847, + 0.6385343769, + 0.6397141665, + 0.6408924509, + 0.6420692271, + 0.6432444925, + 0.6444182443, + 0.6455904797, + 0.6467611960, + 0.6479303904, + 0.6490980601, + 0.6502642024, + 0.6514288146, + 0.6525918940, + 0.6537534377, + 0.6549134431, + 0.6560719074, + 0.6572288279, + 0.6583842018, + 0.6595380266, + 0.6606902994, + 0.6618410175, + 0.6629901782, + 0.6641377789, + 0.6652838167, + 0.6664282891, + 0.6675711934, + 0.6687125267, + 0.6698522866, + 0.6709904702, + 0.6721270748, + 0.6732620980, + 0.6743955368, + 0.6755273888, + 0.6766576511, + 0.6777863212, + 0.6789133965, + 0.6800388741, + 0.6811627516, + 0.6822850262, + 0.6834056954, + 0.6845247564, + 0.6856422067, + 0.6867580436, + 0.6878722645, + 0.6889848667, + 0.6900958478, + 0.6912052049, + 0.6923129356, + 0.6934190372, + 0.6945235071, + 0.6956263427, + 0.6967275415, + 0.6978271008, + 0.6989250180, + 0.7000212906, + 0.7011159160, + 0.7022088916, + 0.7033002148, + 0.7043898831, + 0.7054778939, + 0.7065642446, + 0.7076489327, + 0.7087319557, + 0.7098133109, + 0.7108929959, + 0.7119710081, + 0.7130473449, + 0.7141220039, + 0.7151949824, + 0.7162662781, + 0.7173358883, + 0.7184038105, + 0.7194700423, + 0.7205345811, + 0.7215974244, + 0.7226585697, + 0.7237180145, + 0.7247757564, + 0.7258317928, + 0.7268861212, + 0.7279387392, + 0.7289896443, + 0.7300388340, + 0.7310863058, + 0.7321320574, + 0.7331760861, + 0.7342183896, + 0.7352589655, + 0.7362978112, + 0.7373349243, + 0.7383703024, + 0.7394039430, + 0.7404358438, + 0.7414660022, + 0.7424944159, + 0.7435210825, + 0.7445459994, + 0.7455691644, + 0.7465905750, + 0.7476102287, + 0.7486281233, + 0.7496442563, + 0.7506586253, + 0.7516712279, + 0.7526820618, + 0.7536911245, + 0.7546984137, + 0.7557039270, + 0.7567076622, + 0.7577096166, + 0.7587097882, + 0.7597081744, + 0.7607047729, + 0.7616995815, + 0.7626925976, + 0.7636838191, + 0.7646732436, + 0.7656608687, + 0.7666466922, + 0.7676307116, + 0.7686129248, + 0.7695933293, + 0.7705719229, + 0.7715487032, + 0.7725236681, + 0.7734968151, + 0.7744681420, + 0.7754376465, + 0.7764053263, + 0.7773711792, + 0.7783352028, + 0.7792973950, + 0.7802577533, + 0.7812162757, + 0.7821729598, + 0.7831278033, + 0.7840808041, + 0.7850319598, + 0.7859812683, + 0.7869287273, + 0.7878743346, + 0.7888180880, + 0.7897599851, + 0.7907000239, + 0.7916382021, + 0.7925745175, + 0.7935089679, + 0.7944415511, + 0.7953722649, + 0.7963011071, + 0.7972280756, + 0.7981531680, + 0.7990763824, + 0.7999977164, + 0.8009171680, + 0.8018347350, + 0.8027504151, + 0.8036642063, + 0.8045761064, + 0.8054861132, + 0.8063942247, + 0.8073004386, + 0.8082047529, + 0.8091071654, + 0.8100076740, + 0.8109062766, + 0.8118029710, + 0.8126977551, + 0.8135906270, + 0.8144815843, + 0.8153706251, + 0.8162577473, + 0.8171429487, + 0.8180262273, + 0.8189075810, + 0.8197870078, + 0.8206645055, + 0.8215400721, + 0.8224137055, + 0.8232854037, + 0.8241551647, + 0.8250229863, + 0.8258888666, + 0.8267528035, + 0.8276147949, + 0.8284748389, + 0.8293329334, + 0.8301890764, + 0.8310432659, + 0.8318954999, + 0.8327457763, + 0.8335940932, + 0.8344404486, + 0.8352848405, + 0.8361272668, + 0.8369677257, + 0.8378062151, + 0.8386427331, + 0.8394772776, + 0.8403098468, + 0.8411404387, + 0.8419690512, + 0.8427956826, + 0.8436203307, + 0.8444429937, + 0.8452636697, + 0.8460823567, + 0.8468990528, + 0.8477137560, + 0.8485264645, + 0.8493371763, + 0.8501458896, + 0.8509526024, + 0.8517573128, + 0.8525600189, + 0.8533607189, + 0.8541594108, + 0.8549560928, + 0.8557507630, + 0.8565434196, + 0.8573340606, + 0.8581226843, + 0.8589092887, + 0.8596938720, + 0.8604764323, + 0.8612569679, + 0.8620354768, + 0.8628119573, + 0.8635864076, + 0.8643588257, + 0.8651292099, + 0.8658975583, + 0.8666638692, + 0.8674281408, + 0.8681903713, + 0.8689505588, + 0.8697087015, + 0.8704647978, + 0.8712188458, + 0.8719708437, + 0.8727207898, + 0.8734686823, + 0.8742145194, + 0.8749582994, + 0.8757000206, + 0.8764396811, + 0.8771772793, + 0.8779128134, + 0.8786462817, + 0.8793776825, + 0.8801070140, + 0.8808342745, + 0.8815594624, + 0.8822825758, + 0.8830036132, + 0.8837225727, + 0.8844394528, + 0.8851542517, + 0.8858669678, + 0.8865775993, + 0.8872861446, + 0.8879926020, + 0.8886969699, + 0.8893992467, + 0.8900994305, + 0.8907975199, + 0.8914935132, + 0.8921874087, + 0.8928792048, + 0.8935688998, + 0.8942564922, + 0.8949419803, + 0.8956253626, + 0.8963066373, + 0.8969858030, + 0.8976628579, + 0.8983378006, + 0.8990106294, + 0.8996813427, + 0.9003499390, + 0.9010164167, + 0.9016807742, + 0.9023430100, + 0.9030031224, + 0.9036611101, + 0.9043169713, + 0.9049707045, + 0.9056223083, + 0.9062717811, + 0.9069191213, + 0.9075643274, + 0.9082073980, + 0.9088483315, + 0.9094871263, + 0.9101237811, + 0.9107582942, + 0.9113906642, + 0.9120208897, + 0.9126489690, + 0.9132749009, + 0.9138986837, + 0.9145203160, + 0.9151397963, + 0.9157571232, + 0.9163722953, + 0.9169853111, + 0.9175961691, + 0.9182048679, + 0.9188114061, + 0.9194157822, + 0.9200179948, + 0.9206180426, + 0.9212159241, + 0.9218116378, + 0.9224051825, + 0.9229965566, + 0.9235857588, + 0.9241727878, + 0.9247576421, + 0.9253403203, + 0.9259208211, + 0.9264991431, + 0.9270752850, + 0.9276492454, + 0.9282210230, + 0.9287906163, + 0.9293580242, + 0.9299232451, + 0.9304862779, + 0.9310471211, + 0.9316057735, + 0.9321622337, + 0.9327165005, + 0.9332685724, + 0.9338184484, + 0.9343661269, + 0.9349116068, + 0.9354548868, + 0.9359959655, + 0.9365348418, + 0.9370715142, + 0.9376059817, + 0.9381382429, + 0.9386682966, + 0.9391961415, + 0.9397217764, + 0.9402452000, + 0.9407664111, + 0.9412854085, + 0.9418021910, + 0.9423167573, + 0.9428291063, + 0.9433392367, + 0.9438471473, + 0.9443528370, + 0.9448563045, + 0.9453575486, + 0.9458565683, + 0.9463533623, + 0.9468479294, + 0.9473402684, + 0.9478303783, + 0.9483182579, + 0.9488039059, + 0.9492873214, + 0.9497685031, + 0.9502474498, + 0.9507241606, + 0.9511986342, + 0.9516708696, + 0.9521408655, + 0.9526086210, + 0.9530741350, + 0.9535374062, + 0.9539984337, + 0.9544572163, + 0.9549137530, + 0.9553680427, + 0.9558200843, + 0.9562698768, + 0.9567174191, + 0.9571627101, + 0.9576057488, + 0.9580465342, + 0.9584850652, + 0.9589213409, + 0.9593553600, + 0.9597871218, + 0.9602166250, + 0.9606438688, + 0.9610688521, + 0.9614915739, + 0.9619120332, + 0.9623302290, + 0.9627461604, + 0.9631598263, + 0.9635712259, + 0.9639803580, + 0.9643872219, + 0.9647918164, + 0.9651941407, + 0.9655941938, + 0.9659919747, + 0.9663874826, + 0.9667807165, + 0.9671716754, + 0.9675603585, + 0.9679467648, + 0.9683308935, + 0.9687127436, + 0.9690923142, + 0.9694696044, + 0.9698446134, + 0.9702173403, + 0.9705877841, + 0.9709559440, + 0.9713218192, + 0.9716854088, + 0.9720467119, + 0.9724057277, + 0.9727624553, + 0.9731168939, + 0.9734690427, + 0.9738189008, + 0.9741664675, + 0.9745117418, + 0.9748547230, + 0.9751954102, + 0.9755338028, + 0.9758698998, + 0.9762037005, + 0.9765352041, + 0.9768644098, + 0.9771913168, + 0.9775159245, + 0.9778382319, + 0.9781582384, + 0.9784759432, + 0.9787913456, + 0.9791044447, + 0.9794152399, + 0.9797237305, + 0.9800299157, + 0.9803337948, + 0.9806353670, + 0.9809346317, + 0.9812315882, + 0.9815262358, + 0.9818185737, + 0.9821086014, + 0.9823963180, + 0.9826817229, + 0.9829648155, + 0.9832455951, + 0.9835240610, + 0.9838002126, + 0.9840740493, + 0.9843455703, + 0.9846147750, + 0.9848816628, + 0.9851462332, + 0.9854084853, + 0.9856684187, + 0.9859260328, + 0.9861813268, + 0.9864343003, + 0.9866849526, + 0.9869332832, + 0.9871792914, + 0.9874229766, + 0.9876643384, + 0.9879033761, + 0.9881400891, + 0.9883744770, + 0.9886065391, + 0.9888362750, + 0.9890636840, + 0.9892887657, + 0.9895115194, + 0.9897319448, + 0.9899500412, + 0.9901658081, + 0.9903792451, + 0.9905903517, + 0.9907991273, + 0.9910055714, + 0.9912096836, + 0.9914114634, + 0.9916109103, + 0.9918080239, + 0.9920028036, + 0.9921952491, + 0.9923853598, + 0.9925731354, + 0.9927585753, + 0.9929416792, + 0.9931224466, + 0.9933008770, + 0.9934769702, + 0.9936507256, + 0.9938221428, + 0.9939912215, + 0.9941579612, + 0.9943223616, + 0.9944844222, + 0.9946441427, + 0.9948015227, + 0.9949565619, + 0.9951092598, + 0.9952596161, + 0.9954076305, + 0.9955533026, + 0.9956966321, + 0.9958376186, + 0.9959762618, + 0.9961125614, + 0.9962465170, + 0.9963781284, + 0.9965073951, + 0.9966343170, + 0.9967588938, + 0.9968811250, + 0.9970010105, + 0.9971185500, + 0.9972337431, + 0.9973465897, + 0.9974570894, + 0.9975652420, + 0.9976710472, + 0.9977745048, + 0.9978756145, + 0.9979743762, + 0.9980707895, + 0.9981648543, + 0.9982565703, + 0.9983459372, + 0.9984329550, + 0.9985176234, + 0.9985999422, + 0.9986799111, + 0.9987575301, + 0.9988327989, + 0.9989057173, + 0.9989762853, + 0.9990445025, + 0.9991103689, + 0.9991738843, + 0.9992350485, + 0.9992938615, + 0.9993503230, + 0.9994044329, + 0.9994561911, + 0.9995055976, + 0.9995526521, + 0.9995973545, + 0.9996397048, + 0.9996797029, + 0.9997173486, + 0.9997526418, + 0.9997855826, + 0.9998161708, + 0.9998444063, + 0.9998702890, + 0.9998938190, + 0.9999149961, + 0.9999338204, + 0.9999502917, + 0.9999644100, + 0.9999761753, + 0.9999855875, + 0.9999926467, + 0.9999973529, + 0.9999997059 +}; + +real_t sine_long_960[] = +{ + 0.0008181230, + 0.0024543669, + 0.0040906041, + 0.0057268305, + 0.0073630415, + 0.0089992327, + 0.0106353999, + 0.0122715386, + 0.0139076445, + 0.0155437131, + 0.0171797401, + 0.0188157211, + 0.0204516518, + 0.0220875276, + 0.0237233444, + 0.0253590976, + 0.0269947829, + 0.0286303960, + 0.0302659324, + 0.0319013878, + 0.0335367578, + 0.0351720379, + 0.0368072240, + 0.0384423114, + 0.0400772960, + 0.0417121732, + 0.0433469388, + 0.0449815883, + 0.0466161174, + 0.0482505217, + 0.0498847968, + 0.0515189384, + 0.0531529420, + 0.0547868033, + 0.0564205179, + 0.0580540815, + 0.0596874897, + 0.0613207380, + 0.0629538222, + 0.0645867378, + 0.0662194805, + 0.0678520459, + 0.0694844297, + 0.0711166274, + 0.0727486347, + 0.0743804473, + 0.0760120607, + 0.0776434706, + 0.0792746727, + 0.0809056625, + 0.0825364356, + 0.0841669879, + 0.0857973147, + 0.0874274119, + 0.0890572750, + 0.0906868996, + 0.0923162815, + 0.0939454162, + 0.0955742994, + 0.0972029267, + 0.0988312938, + 0.1004593962, + 0.1020872297, + 0.1037147899, + 0.1053420724, + 0.1069690729, + 0.1085957870, + 0.1102222103, + 0.1118483386, + 0.1134741674, + 0.1150996924, + 0.1167249092, + 0.1183498135, + 0.1199744010, + 0.1215986673, + 0.1232226080, + 0.1248462188, + 0.1264694953, + 0.1280924333, + 0.1297150283, + 0.1313372760, + 0.1329591721, + 0.1345807122, + 0.1362018920, + 0.1378227072, + 0.1394431534, + 0.1410632262, + 0.1426829214, + 0.1443022345, + 0.1459211613, + 0.1475396975, + 0.1491578386, + 0.1507755804, + 0.1523929185, + 0.1540098486, + 0.1556263664, + 0.1572424676, + 0.1588581477, + 0.1604734026, + 0.1620882278, + 0.1637026190, + 0.1653165720, + 0.1669300823, + 0.1685431457, + 0.1701557579, + 0.1717679146, + 0.1733796113, + 0.1749908439, + 0.1766016080, + 0.1782118992, + 0.1798217134, + 0.1814310460, + 0.1830398930, + 0.1846482499, + 0.1862561124, + 0.1878634763, + 0.1894703372, + 0.1910766908, + 0.1926825329, + 0.1942878591, + 0.1958926651, + 0.1974969467, + 0.1991006995, + 0.2007039192, + 0.2023066016, + 0.2039087424, + 0.2055103372, + 0.2071113819, + 0.2087118720, + 0.2103118034, + 0.2119111716, + 0.2135099726, + 0.2151082019, + 0.2167058553, + 0.2183029285, + 0.2198994172, + 0.2214953172, + 0.2230906242, + 0.2246853339, + 0.2262794421, + 0.2278729444, + 0.2294658367, + 0.2310581146, + 0.2326497739, + 0.2342408103, + 0.2358312196, + 0.2374209975, + 0.2390101398, + 0.2405986421, + 0.2421865003, + 0.2437737101, + 0.2453602672, + 0.2469461675, + 0.2485314066, + 0.2501159802, + 0.2516998843, + 0.2532831145, + 0.2548656665, + 0.2564475362, + 0.2580287194, + 0.2596092117, + 0.2611890089, + 0.2627681069, + 0.2643465014, + 0.2659241881, + 0.2675011628, + 0.2690774214, + 0.2706529596, + 0.2722277732, + 0.2738018579, + 0.2753752096, + 0.2769478240, + 0.2785196969, + 0.2800908242, + 0.2816612016, + 0.2832308248, + 0.2847996898, + 0.2863677923, + 0.2879351281, + 0.2895016930, + 0.2910674829, + 0.2926324934, + 0.2941967205, + 0.2957601599, + 0.2973228075, + 0.2988846591, + 0.3004457105, + 0.3020059575, + 0.3035653959, + 0.3051240216, + 0.3066818303, + 0.3082388180, + 0.3097949805, + 0.3113503135, + 0.3129048130, + 0.3144584747, + 0.3160112945, + 0.3175632683, + 0.3191143918, + 0.3206646610, + 0.3222140717, + 0.3237626197, + 0.3253103009, + 0.3268571111, + 0.3284030463, + 0.3299481022, + 0.3314922747, + 0.3330355597, + 0.3345779531, + 0.3361194508, + 0.3376600485, + 0.3391997422, + 0.3407385278, + 0.3422764011, + 0.3438133581, + 0.3453493945, + 0.3468845064, + 0.3484186895, + 0.3499519398, + 0.3514842532, + 0.3530156256, + 0.3545460528, + 0.3560755308, + 0.3576040555, + 0.3591316228, + 0.3606582285, + 0.3621838687, + 0.3637085392, + 0.3652322359, + 0.3667549548, + 0.3682766918, + 0.3697974428, + 0.3713172038, + 0.3728359706, + 0.3743537392, + 0.3758705056, + 0.3773862656, + 0.3789010153, + 0.3804147505, + 0.3819274673, + 0.3834391615, + 0.3849498291, + 0.3864594661, + 0.3879680685, + 0.3894756321, + 0.3909821530, + 0.3924876271, + 0.3939920504, + 0.3954954189, + 0.3969977285, + 0.3984989752, + 0.3999991550, + 0.4014982640, + 0.4029962979, + 0.4044932530, + 0.4059891250, + 0.4074839102, + 0.4089776043, + 0.4104702036, + 0.4119617038, + 0.4134521011, + 0.4149413915, + 0.4164295710, + 0.4179166355, + 0.4194025812, + 0.4208874040, + 0.4223710999, + 0.4238536651, + 0.4253350954, + 0.4268153870, + 0.4282945359, + 0.4297725381, + 0.4312493897, + 0.4327250867, + 0.4341996252, + 0.4356730012, + 0.4371452107, + 0.4386162499, + 0.4400861148, + 0.4415548014, + 0.4430223059, + 0.4444886242, + 0.4459537525, + 0.4474176869, + 0.4488804234, + 0.4503419581, + 0.4518022871, + 0.4532614065, + 0.4547193124, + 0.4561760009, + 0.4576314680, + 0.4590857100, + 0.4605387228, + 0.4619905026, + 0.4634410455, + 0.4648903477, + 0.4663384052, + 0.4677852142, + 0.4692307707, + 0.4706750710, + 0.4721181112, + 0.4735598874, + 0.4750003957, + 0.4764396322, + 0.4778775932, + 0.4793142748, + 0.4807496731, + 0.4821837843, + 0.4836166046, + 0.4850481301, + 0.4864783569, + 0.4879072813, + 0.4893348994, + 0.4907612075, + 0.4921862016, + 0.4936098779, + 0.4950322328, + 0.4964532623, + 0.4978729626, + 0.4992913300, + 0.5007083606, + 0.5021240507, + 0.5035383964, + 0.5049513940, + 0.5063630397, + 0.5077733298, + 0.5091822603, + 0.5105898276, + 0.5119960280, + 0.5134008575, + 0.5148043125, + 0.5162063893, + 0.5176070840, + 0.5190063929, + 0.5204043123, + 0.5218008384, + 0.5231959674, + 0.5245896958, + 0.5259820196, + 0.5273729352, + 0.5287624389, + 0.5301505270, + 0.5315371956, + 0.5329224412, + 0.5343062600, + 0.5356886483, + 0.5370696023, + 0.5384491185, + 0.5398271931, + 0.5412038224, + 0.5425790028, + 0.5439527305, + 0.5453250019, + 0.5466958133, + 0.5480651610, + 0.5494330413, + 0.5507994507, + 0.5521643854, + 0.5535278418, + 0.5548898163, + 0.5562503051, + 0.5576093047, + 0.5589668114, + 0.5603228216, + 0.5616773317, + 0.5630303379, + 0.5643818368, + 0.5657318246, + 0.5670802978, + 0.5684272527, + 0.5697726858, + 0.5711165935, + 0.5724589721, + 0.5737998180, + 0.5751391277, + 0.5764768976, + 0.5778131241, + 0.5791478036, + 0.5804809326, + 0.5818125074, + 0.5831425246, + 0.5844709805, + 0.5857978716, + 0.5871231943, + 0.5884469451, + 0.5897691205, + 0.5910897169, + 0.5924087308, + 0.5937261586, + 0.5950419968, + 0.5963562420, + 0.5976688905, + 0.5989799388, + 0.6002893835, + 0.6015972211, + 0.6029034480, + 0.6042080607, + 0.6055110558, + 0.6068124298, + 0.6081121791, + 0.6094103003, + 0.6107067900, + 0.6120016446, + 0.6132948607, + 0.6145864349, + 0.6158763636, + 0.6171646434, + 0.6184512709, + 0.6197362426, + 0.6210195550, + 0.6223012049, + 0.6235811886, + 0.6248595028, + 0.6261361441, + 0.6274111090, + 0.6286843942, + 0.6299559962, + 0.6312259115, + 0.6324941370, + 0.6337606690, + 0.6350255043, + 0.6362886394, + 0.6375500710, + 0.6388097956, + 0.6400678100, + 0.6413241107, + 0.6425786945, + 0.6438315578, + 0.6450826974, + 0.6463321099, + 0.6475797920, + 0.6488257403, + 0.6500699516, + 0.6513124223, + 0.6525531494, + 0.6537921293, + 0.6550293589, + 0.6562648347, + 0.6574985536, + 0.6587305121, + 0.6599607069, + 0.6611891349, + 0.6624157927, + 0.6636406770, + 0.6648637845, + 0.6660851120, + 0.6673046561, + 0.6685224137, + 0.6697383815, + 0.6709525561, + 0.6721649344, + 0.6733755132, + 0.6745842891, + 0.6757912589, + 0.6769964195, + 0.6781997675, + 0.6794012997, + 0.6806010131, + 0.6817989042, + 0.6829949700, + 0.6841892071, + 0.6853816125, + 0.6865721829, + 0.6877609152, + 0.6889478061, + 0.6901328525, + 0.6913160512, + 0.6924973990, + 0.6936768929, + 0.6948545295, + 0.6960303058, + 0.6972042186, + 0.6983762648, + 0.6995464412, + 0.7007147448, + 0.7018811723, + 0.7030457206, + 0.7042083867, + 0.7053691674, + 0.7065280597, + 0.7076850603, + 0.7088401663, + 0.7099933745, + 0.7111446818, + 0.7122940851, + 0.7134415815, + 0.7145871677, + 0.7157308408, + 0.7168725976, + 0.7180124352, + 0.7191503504, + 0.7202863403, + 0.7214204017, + 0.7225525317, + 0.7236827271, + 0.7248109851, + 0.7259373025, + 0.7270616764, + 0.7281841037, + 0.7293045814, + 0.7304231066, + 0.7315396762, + 0.7326542872, + 0.7337669368, + 0.7348776218, + 0.7359863393, + 0.7370930863, + 0.7381978600, + 0.7393006572, + 0.7404014752, + 0.7415003108, + 0.7425971612, + 0.7436920235, + 0.7447848947, + 0.7458757719, + 0.7469646521, + 0.7480515325, + 0.7491364101, + 0.7502192821, + 0.7513001455, + 0.7523789975, + 0.7534558351, + 0.7545306554, + 0.7556034557, + 0.7566742330, + 0.7577429844, + 0.7588097072, + 0.7598743984, + 0.7609370551, + 0.7619976746, + 0.7630562540, + 0.7641127905, + 0.7651672812, + 0.7662197234, + 0.7672701141, + 0.7683184506, + 0.7693647301, + 0.7704089498, + 0.7714511069, + 0.7724911985, + 0.7735292220, + 0.7745651745, + 0.7755990532, + 0.7766308555, + 0.7776605784, + 0.7786882194, + 0.7797137755, + 0.7807372441, + 0.7817586225, + 0.7827779079, + 0.7837950975, + 0.7848101886, + 0.7858231786, + 0.7868340647, + 0.7878428442, + 0.7888495145, + 0.7898540727, + 0.7908565162, + 0.7918568424, + 0.7928550486, + 0.7938511320, + 0.7948450901, + 0.7958369201, + 0.7968266194, + 0.7978141854, + 0.7987996154, + 0.7997829068, + 0.8007640569, + 0.8017430631, + 0.8027199228, + 0.8036946334, + 0.8046671923, + 0.8056375968, + 0.8066058444, + 0.8075719325, + 0.8085358584, + 0.8094976197, + 0.8104572137, + 0.8114146378, + 0.8123698896, + 0.8133229663, + 0.8142738656, + 0.8152225848, + 0.8161691215, + 0.8171134730, + 0.8180556368, + 0.8189956104, + 0.8199333914, + 0.8208689772, + 0.8218023652, + 0.8227335530, + 0.8236625381, + 0.8245893180, + 0.8255138903, + 0.8264362524, + 0.8273564019, + 0.8282743363, + 0.8291900531, + 0.8301035500, + 0.8310148244, + 0.8319238740, + 0.8328306962, + 0.8337352887, + 0.8346376491, + 0.8355377749, + 0.8364356636, + 0.8373313130, + 0.8382247206, + 0.8391158841, + 0.8400048009, + 0.8408914688, + 0.8417758854, + 0.8426580483, + 0.8435379552, + 0.8444156036, + 0.8452909913, + 0.8461641159, + 0.8470349751, + 0.8479035665, + 0.8487698878, + 0.8496339367, + 0.8504957108, + 0.8513552080, + 0.8522124258, + 0.8530673619, + 0.8539200142, + 0.8547703802, + 0.8556184578, + 0.8564642446, + 0.8573077384, + 0.8581489370, + 0.8589878380, + 0.8598244392, + 0.8606587385, + 0.8614907335, + 0.8623204220, + 0.8631478018, + 0.8639728707, + 0.8647956265, + 0.8656160670, + 0.8664341900, + 0.8672499933, + 0.8680634747, + 0.8688746320, + 0.8696834631, + 0.8704899657, + 0.8712941378, + 0.8720959772, + 0.8728954818, + 0.8736926493, + 0.8744874777, + 0.8752799648, + 0.8760701085, + 0.8768579067, + 0.8776433574, + 0.8784264583, + 0.8792072074, + 0.8799856025, + 0.8807616417, + 0.8815353229, + 0.8823066439, + 0.8830756027, + 0.8838421972, + 0.8846064254, + 0.8853682853, + 0.8861277748, + 0.8868848918, + 0.8876396344, + 0.8883920005, + 0.8891419881, + 0.8898895952, + 0.8906348198, + 0.8913776599, + 0.8921181136, + 0.8928561787, + 0.8935918534, + 0.8943251357, + 0.8950560237, + 0.8957845152, + 0.8965106085, + 0.8972343016, + 0.8979555925, + 0.8986744793, + 0.8993909601, + 0.9001050330, + 0.9008166959, + 0.9015259472, + 0.9022327848, + 0.9029372068, + 0.9036392114, + 0.9043387967, + 0.9050359608, + 0.9057307018, + 0.9064230179, + 0.9071129073, + 0.9078003680, + 0.9084853983, + 0.9091679963, + 0.9098481602, + 0.9105258881, + 0.9112011783, + 0.9118740290, + 0.9125444382, + 0.9132124044, + 0.9138779255, + 0.9145410000, + 0.9152016259, + 0.9158598016, + 0.9165155252, + 0.9171687951, + 0.9178196094, + 0.9184679665, + 0.9191138645, + 0.9197573017, + 0.9203982766, + 0.9210367872, + 0.9216728319, + 0.9223064091, + 0.9229375169, + 0.9235661538, + 0.9241923180, + 0.9248160078, + 0.9254372217, + 0.9260559578, + 0.9266722147, + 0.9272859906, + 0.9278972838, + 0.9285060928, + 0.9291124159, + 0.9297162514, + 0.9303175979, + 0.9309164536, + 0.9315128169, + 0.9321066864, + 0.9326980603, + 0.9332869370, + 0.9338733151, + 0.9344571929, + 0.9350385689, + 0.9356174416, + 0.9361938093, + 0.9367676705, + 0.9373390237, + 0.9379078674, + 0.9384742000, + 0.9390380200, + 0.9395993260, + 0.9401581163, + 0.9407143896, + 0.9412681443, + 0.9418193789, + 0.9423680920, + 0.9429142821, + 0.9434579477, + 0.9439990874, + 0.9445376998, + 0.9450737833, + 0.9456073366, + 0.9461383582, + 0.9466668467, + 0.9471928007, + 0.9477162188, + 0.9482370995, + 0.9487554416, + 0.9492712435, + 0.9497845040, + 0.9502952216, + 0.9508033949, + 0.9513090227, + 0.9518121035, + 0.9523126361, + 0.9528106190, + 0.9533060510, + 0.9537989307, + 0.9542892567, + 0.9547770279, + 0.9552622428, + 0.9557449002, + 0.9562249988, + 0.9567025372, + 0.9571775143, + 0.9576499288, + 0.9581197793, + 0.9585870647, + 0.9590517836, + 0.9595139348, + 0.9599735172, + 0.9604305294, + 0.9608849703, + 0.9613368385, + 0.9617861330, + 0.9622328525, + 0.9626769958, + 0.9631185617, + 0.9635575491, + 0.9639939567, + 0.9644277835, + 0.9648590281, + 0.9652876896, + 0.9657137667, + 0.9661372582, + 0.9665581632, + 0.9669764804, + 0.9673922086, + 0.9678053469, + 0.9682158941, + 0.9686238491, + 0.9690292108, + 0.9694319780, + 0.9698321499, + 0.9702297252, + 0.9706247029, + 0.9710170819, + 0.9714068613, + 0.9717940399, + 0.9721786167, + 0.9725605907, + 0.9729399608, + 0.9733167261, + 0.9736908855, + 0.9740624381, + 0.9744313828, + 0.9747977187, + 0.9751614448, + 0.9755225600, + 0.9758810635, + 0.9762369542, + 0.9765902313, + 0.9769408937, + 0.9772889406, + 0.9776343710, + 0.9779771840, + 0.9783173786, + 0.9786549539, + 0.9789899092, + 0.9793222433, + 0.9796519555, + 0.9799790449, + 0.9803035106, + 0.9806253518, + 0.9809445675, + 0.9812611569, + 0.9815751192, + 0.9818864535, + 0.9821951590, + 0.9825012349, + 0.9828046803, + 0.9831054945, + 0.9834036766, + 0.9836992258, + 0.9839921414, + 0.9842824225, + 0.9845700684, + 0.9848550783, + 0.9851374515, + 0.9854171871, + 0.9856942845, + 0.9859687429, + 0.9862405616, + 0.9865097398, + 0.9867762768, + 0.9870401719, + 0.9873014244, + 0.9875600336, + 0.9878159988, + 0.9880693193, + 0.9883199945, + 0.9885680237, + 0.9888134061, + 0.9890561412, + 0.9892962283, + 0.9895336667, + 0.9897684559, + 0.9900005952, + 0.9902300839, + 0.9904569215, + 0.9906811073, + 0.9909026408, + 0.9911215213, + 0.9913377484, + 0.9915513213, + 0.9917622395, + 0.9919705024, + 0.9921761096, + 0.9923790604, + 0.9925793543, + 0.9927769908, + 0.9929719693, + 0.9931642894, + 0.9933539504, + 0.9935409519, + 0.9937252935, + 0.9939069745, + 0.9940859945, + 0.9942623531, + 0.9944360497, + 0.9946070839, + 0.9947754553, + 0.9949411633, + 0.9951042076, + 0.9952645877, + 0.9954223032, + 0.9955773536, + 0.9957297385, + 0.9958794576, + 0.9960265105, + 0.9961708966, + 0.9963126157, + 0.9964516674, + 0.9965880513, + 0.9967217670, + 0.9968528142, + 0.9969811925, + 0.9971069016, + 0.9972299412, + 0.9973503108, + 0.9974680103, + 0.9975830392, + 0.9976953973, + 0.9978050843, + 0.9979120998, + 0.9980164436, + 0.9981181155, + 0.9982171151, + 0.9983134421, + 0.9984070964, + 0.9984980776, + 0.9985863855, + 0.9986720200, + 0.9987549807, + 0.9988352674, + 0.9989128799, + 0.9989878181, + 0.9990600816, + 0.9991296704, + 0.9991965842, + 0.9992608228, + 0.9993223862, + 0.9993812740, + 0.9994374862, + 0.9994910226, + 0.9995418831, + 0.9995900674, + 0.9996355756, + 0.9996784075, + 0.9997185629, + 0.9997560418, + 0.9997908440, + 0.9998229695, + 0.9998524181, + 0.9998791899, + 0.9999032846, + 0.9999247024, + 0.9999434430, + 0.9999595065, + 0.9999728928, + 0.9999836018, + 0.9999916336, + 0.9999969881, + 0.9999996654 +}; + +real_t sine_short_128[] = +{ + 0.0061358848, + 0.0184067304, + 0.0306748040, + 0.0429382581, + 0.0551952459, + 0.0674439214, + 0.0796824402, + 0.0919089590, + 0.1041216368, + 0.1163186341, + 0.1284981143, + 0.1406582432, + 0.1527971895, + 0.1649131250, + 0.1770042253, + 0.1890686693, + 0.2011046404, + 0.2131103258, + 0.2250839175, + 0.2370236125, + 0.2489276125, + 0.2607941250, + 0.2726213628, + 0.2844075449, + 0.2961508962, + 0.3078496483, + 0.3195020394, + 0.3311063146, + 0.3426607265, + 0.3541635348, + 0.3656130075, + 0.3770074202, + 0.3883450569, + 0.3996242103, + 0.4108431818, + 0.4220002818, + 0.4330938301, + 0.4441221560, + 0.4550835988, + 0.4659765077, + 0.4767992422, + 0.4875501725, + 0.4982276796, + 0.5088301553, + 0.5193560032, + 0.5298036379, + 0.5401714861, + 0.5504579865, + 0.5606615899, + 0.5707807598, + 0.5808139721, + 0.5907597160, + 0.6006164937, + 0.6103828207, + 0.6200572264, + 0.6296382536, + 0.6391244597, + 0.6485144160, + 0.6578067083, + 0.6669999374, + 0.6760927188, + 0.6850836831, + 0.6939714763, + 0.7027547599, + 0.7114322112, + 0.7200025235, + 0.7284644060, + 0.7368165845, + 0.7450578010, + 0.7531868147, + 0.7612024011, + 0.7691033533, + 0.7768884813, + 0.7845566127, + 0.7921065928, + 0.7995372846, + 0.8068475690, + 0.8140363451, + 0.8211025303, + 0.8280450605, + 0.8348628901, + 0.8415549925, + 0.8481203597, + 0.8545580032, + 0.8608669533, + 0.8670462601, + 0.8730949928, + 0.8790122407, + 0.8847971125, + 0.8904487372, + 0.8959662635, + 0.9013488606, + 0.9065957178, + 0.9117060451, + 0.9166790728, + 0.9215140520, + 0.9262102546, + 0.9307669733, + 0.9351835219, + 0.9394592352, + 0.9435934695, + 0.9475856021, + 0.9514350317, + 0.9551411788, + 0.9587034850, + 0.9621214141, + 0.9653944512, + 0.9685221034, + 0.9715038998, + 0.9743393912, + 0.9770281507, + 0.9795697733, + 0.9819638764, + 0.9842100992, + 0.9863081037, + 0.9882575738, + 0.9900582159, + 0.9917097588, + 0.9932119539, + 0.9945645750, + 0.9957674182, + 0.9968203026, + 0.9977230695, + 0.9984755829, + 0.9990777296, + 0.9995294188, + 0.9998305826, + 0.9999811755 +}; + +real_t sine_short_120[] = +{ + 0.0065449381, + 0.0196336930, + 0.0327190837, + 0.0457988682, + 0.0588708053, + 0.0719326552, + 0.0849821797, + 0.0980171430, + 0.1110353116, + 0.1240344549, + 0.1370123455, + 0.1499667597, + 0.1628954779, + 0.1757962848, + 0.1886669699, + 0.2015053279, + 0.2143091589, + 0.2270762692, + 0.2398044712, + 0.2524915839, + 0.2651354334, + 0.2777338534, + 0.2902846851, + 0.3027857780, + 0.3152349901, + 0.3276301883, + 0.3399692488, + 0.3522500573, + 0.3644705095, + 0.3766285116, + 0.3887219804, + 0.4007488436, + 0.4127070406, + 0.4245945223, + 0.4364092520, + 0.4481492051, + 0.4598123703, + 0.4713967489, + 0.4829003561, + 0.4943212208, + 0.5056573861, + 0.5169069096, + 0.5280678638, + 0.5391383363, + 0.5501164301, + 0.5610002644, + 0.5717879741, + 0.5824777109, + 0.5930676432, + 0.6035559563, + 0.6139408533, + 0.6242205546, + 0.6343932989, + 0.6444573433, + 0.6544109631, + 0.6642524530, + 0.6739801267, + 0.6835923173, + 0.6930873779, + 0.7024636815, + 0.7117196216, + 0.7208536122, + 0.7298640883, + 0.7387495058, + 0.7475083425, + 0.7561390974, + 0.7646402918, + 0.7730104690, + 0.7812481948, + 0.7893520577, + 0.7973206693, + 0.8051526640, + 0.8128467000, + 0.8204014588, + 0.8278156461, + 0.8350879914, + 0.8422172487, + 0.8492021964, + 0.8560416377, + 0.8627344006, + 0.8692793384, + 0.8756753297, + 0.8819212785, + 0.8880161146, + 0.8939587938, + 0.8997482976, + 0.9053836343, + 0.9108638381, + 0.9161879700, + 0.9213551179, + 0.9263643963, + 0.9312149469, + 0.9359059386, + 0.9404365677, + 0.9448060577, + 0.9490136602, + 0.9530586539, + 0.9569403460, + 0.9606580713, + 0.9642111928, + 0.9675991016, + 0.9708212173, + 0.9738769878, + 0.9767658894, + 0.9794874272, + 0.9820411349, + 0.9844265749, + 0.9866433385, + 0.9886910458, + 0.9905693459, + 0.9922779171, + 0.9938164666, + 0.9951847307, + 0.9963824750, + 0.9974094943, + 0.9982656127, + 0.9989506833, + 0.9994645889, + 0.9998072413, + 0.9999785819 +}; + +#ifdef LD_DEC +real_t sine_mid_512[] = +{ + 0.0015339802, + 0.0046019262, + 0.0076698290, + 0.0107376595, + 0.0138053889, + 0.0168729884, + 0.0199404291, + 0.0230076821, + 0.0260747186, + 0.0291415096, + 0.0322080263, + 0.0352742399, + 0.0383401214, + 0.0414056421, + 0.0444707731, + 0.0475354855, + 0.0505997504, + 0.0536635391, + 0.0567268227, + 0.0597895724, + 0.0628517593, + 0.0659133546, + 0.0689743295, + 0.0720346552, + 0.0750943029, + 0.0781532438, + 0.0812114491, + 0.0842688899, + 0.0873255376, + 0.0903813634, + 0.0934363384, + 0.0964904340, + 0.0995436214, + 0.1025958719, + 0.1056471566, + 0.1086974470, + 0.1117467143, + 0.1147949298, + 0.1178420648, + 0.1208880906, + 0.1239329785, + 0.1269767000, + 0.1300192263, + 0.1330605288, + 0.1361005789, + 0.1391393480, + 0.1421768074, + 0.1452129287, + 0.1482476831, + 0.1512810421, + 0.1543129773, + 0.1573434600, + 0.1603724617, + 0.1633999539, + 0.1664259081, + 0.1694502959, + 0.1724730887, + 0.1754942582, + 0.1785137759, + 0.1815316133, + 0.1845477420, + 0.1875621337, + 0.1905747601, + 0.1935855926, + 0.1965946031, + 0.1996017631, + 0.2026070444, + 0.2056104187, + 0.2086118577, + 0.2116113332, + 0.2146088169, + 0.2176042806, + 0.2205976961, + 0.2235890353, + 0.2265782700, + 0.2295653721, + 0.2325503134, + 0.2355330658, + 0.2385136014, + 0.2414918919, + 0.2444679094, + 0.2474416259, + 0.2504130134, + 0.2533820439, + 0.2563486895, + 0.2593129222, + 0.2622747142, + 0.2652340375, + 0.2681908643, + 0.2711451669, + 0.2740969173, + 0.2770460878, + 0.2799926507, + 0.2829365781, + 0.2858778425, + 0.2888164160, + 0.2917522711, + 0.2946853801, + 0.2976157155, + 0.3005432495, + 0.3034679547, + 0.3063898036, + 0.3093087686, + 0.3122248223, + 0.3151379372, + 0.3180480859, + 0.3209552410, + 0.3238593752, + 0.3267604611, + 0.3296584714, + 0.3325533788, + 0.3354451561, + 0.3383337760, + 0.3412192114, + 0.3441014352, + 0.3469804201, + 0.3498561391, + 0.3527285651, + 0.3555976712, + 0.3584634302, + 0.3613258152, + 0.3641847992, + 0.3670403554, + 0.3698924569, + 0.3727410769, + 0.3755861884, + 0.3784277648, + 0.3812657793, + 0.3841002051, + 0.3869310157, + 0.3897581843, + 0.3925816844, + 0.3954014893, + 0.3982175726, + 0.4010299077, + 0.4038384682, + 0.4066432275, + 0.4094441594, + 0.4122412374, + 0.4150344353, + 0.4178237267, + 0.4206090854, + 0.4233904852, + 0.4261678998, + 0.4289413032, + 0.4317106692, + 0.4344759718, + 0.4372371850, + 0.4399942827, + 0.4427472390, + 0.4454960280, + 0.4482406238, + 0.4509810007, + 0.4537171327, + 0.4564489941, + 0.4591765593, + 0.4618998026, + 0.4646186982, + 0.4673332207, + 0.4700433445, + 0.4727490440, + 0.4754502939, + 0.4781470686, + 0.4808393428, + 0.4835270912, + 0.4862102885, + 0.4888889093, + 0.4915629286, + 0.4942323210, + 0.4968970616, + 0.4995571252, + 0.5022124867, + 0.5048631212, + 0.5075090038, + 0.5101501095, + 0.5127864135, + 0.5154178909, + 0.5180445171, + 0.5206662672, + 0.5232831165, + 0.5258950406, + 0.5285020147, + 0.5311040144, + 0.5337010151, + 0.5362929924, + 0.5388799219, + 0.5414617792, + 0.5440385402, + 0.5466101804, + 0.5491766757, + 0.5517380020, + 0.5542941351, + 0.5568450509, + 0.5593907256, + 0.5619311350, + 0.5644662553, + 0.5669960626, + 0.5695205332, + 0.5720396432, + 0.5745533690, + 0.5770616868, + 0.5795645732, + 0.5820620044, + 0.5845539570, + 0.5870404077, + 0.5895213328, + 0.5919967092, + 0.5944665134, + 0.5969307223, + 0.5993893127, + 0.6018422614, + 0.6042895453, + 0.6067311415, + 0.6091670268, + 0.6115971784, + 0.6140215735, + 0.6164401891, + 0.6188530025, + 0.6212599911, + 0.6236611322, + 0.6260564031, + 0.6284457813, + 0.6308292444, + 0.6332067698, + 0.6355783353, + 0.6379439184, + 0.6403034970, + 0.6426570488, + 0.6450045517, + 0.6473459836, + 0.6496813224, + 0.6520105461, + 0.6543336328, + 0.6566505608, + 0.6589613080, + 0.6612658529, + 0.6635641737, + 0.6658562488, + 0.6681420566, + 0.6704215756, + 0.6726947843, + 0.6749616613, + 0.6772221854, + 0.6794763352, + 0.6817240894, + 0.6839654271, + 0.6862003270, + 0.6884287681, + 0.6906507295, + 0.6928661902, + 0.6950751294, + 0.6972775262, + 0.6994733600, + 0.7016626102, + 0.7038452560, + 0.7060212769, + 0.7081906525, + 0.7103533623, + 0.7125093860, + 0.7146587034, + 0.7168012940, + 0.7189371379, + 0.7210662148, + 0.7231885048, + 0.7253039879, + 0.7274126442, + 0.7295144537, + 0.7316093968, + 0.7336974537, + 0.7357786047, + 0.7378528304, + 0.7399201111, + 0.7419804273, + 0.7440337598, + 0.7460800891, + 0.7481193961, + 0.7501516614, + 0.7521768661, + 0.7541949909, + 0.7562060170, + 0.7582099254, + 0.7602066973, + 0.7621963137, + 0.7641787561, + 0.7661540058, + 0.7681220441, + 0.7700828526, + 0.7720364128, + 0.7739827062, + 0.7759217146, + 0.7778534198, + 0.7797778035, + 0.7816948476, + 0.7836045342, + 0.7855068451, + 0.7874017626, + 0.7892892687, + 0.7911693458, + 0.7930419760, + 0.7949071418, + 0.7967648257, + 0.7986150101, + 0.8004576777, + 0.8022928110, + 0.8041203929, + 0.8059404060, + 0.8077528334, + 0.8095576578, + 0.8113548624, + 0.8131444302, + 0.8149263444, + 0.8167005882, + 0.8184671449, + 0.8202259979, + 0.8219771306, + 0.8237205265, + 0.8254561693, + 0.8271840425, + 0.8289041300, + 0.8306164155, + 0.8323208829, + 0.8340175162, + 0.8357062995, + 0.8373872167, + 0.8390602521, + 0.8407253900, + 0.8423826147, + 0.8440319105, + 0.8456732620, + 0.8473066536, + 0.8489320701, + 0.8505494961, + 0.8521589165, + 0.8537603160, + 0.8553536795, + 0.8569389922, + 0.8585162390, + 0.8600854051, + 0.8616464758, + 0.8631994363, + 0.8647442721, + 0.8662809686, + 0.8678095113, + 0.8693298858, + 0.8708420779, + 0.8723460733, + 0.8738418578, + 0.8753294174, + 0.8768087381, + 0.8782798059, + 0.8797426070, + 0.8811971277, + 0.8826433541, + 0.8840812728, + 0.8855108702, + 0.8869321328, + 0.8883450473, + 0.8897496003, + 0.8911457787, + 0.8925335692, + 0.8939129589, + 0.8952839348, + 0.8966464839, + 0.8980005934, + 0.8993462506, + 0.9006834428, + 0.9020121574, + 0.9033323820, + 0.9046441040, + 0.9059473112, + 0.9072419912, + 0.9085281320, + 0.9098057213, + 0.9110747472, + 0.9123351977, + 0.9135870610, + 0.9148303252, + 0.9160649787, + 0.9172910099, + 0.9185084071, + 0.9197171590, + 0.9209172542, + 0.9221086814, + 0.9232914293, + 0.9244654868, + 0.9256308430, + 0.9267874867, + 0.9279354072, + 0.9290745935, + 0.9302050351, + 0.9313267212, + 0.9324396413, + 0.9335437850, + 0.9346391418, + 0.9357257014, + 0.9368034535, + 0.9378723882, + 0.9389324952, + 0.9399837646, + 0.9410261866, + 0.9420597512, + 0.9430844489, + 0.9441002698, + 0.9451072045, + 0.9461052436, + 0.9470943775, + 0.9480745970, + 0.9490458928, + 0.9500082559, + 0.9509616771, + 0.9519061475, + 0.9528416583, + 0.9537682005, + 0.9546857654, + 0.9555943446, + 0.9564939293, + 0.9573845111, + 0.9582660816, + 0.9591386326, + 0.9600021558, + 0.9608566431, + 0.9617020864, + 0.9625384778, + 0.9633658095, + 0.9641840736, + 0.9649932624, + 0.9657933683, + 0.9665843838, + 0.9673663015, + 0.9681391139, + 0.9689028139, + 0.9696573941, + 0.9704028476, + 0.9711391673, + 0.9718663462, + 0.9725843776, + 0.9732932546, + 0.9739929706, + 0.9746835191, + 0.9753648934, + 0.9760370872, + 0.9767000942, + 0.9773539081, + 0.9779985228, + 0.9786339322, + 0.9792601304, + 0.9798771113, + 0.9804848693, + 0.9810833986, + 0.9816726935, + 0.9822527486, + 0.9828235583, + 0.9833851173, + 0.9839374204, + 0.9844804622, + 0.9850142377, + 0.9855387419, + 0.9860539698, + 0.9865599167, + 0.9870565776, + 0.9875439480, + 0.9880220232, + 0.9884907988, + 0.9889502704, + 0.9894004335, + 0.9898412841, + 0.9902728179, + 0.9906950309, + 0.9911079190, + 0.9915114785, + 0.9919057055, + 0.9922905963, + 0.9926661473, + 0.9930323550, + 0.9933892158, + 0.9937367265, + 0.9940748837, + 0.9944036844, + 0.9947231253, + 0.9950332035, + 0.9953339161, + 0.9956252602, + 0.9959072331, + 0.9961798322, + 0.9964430548, + 0.9966968986, + 0.9969413610, + 0.9971764399, + 0.9974021329, + 0.9976184380, + 0.9978253532, + 0.9980228764, + 0.9982110059, + 0.9983897398, + 0.9985590765, + 0.9987190144, + 0.9988695519, + 0.9990106877, + 0.9991424205, + 0.9992647489, + 0.9993776719, + 0.9994811883, + 0.9995752973, + 0.9996599979, + 0.9997352893, + 0.9998011707, + 0.9998576417, + 0.9999047017, + 0.9999423501, + 0.9999705868, + 0.9999894113, + 0.9999988235 +}; + +real_t sine_mid_480[] = +{ + 0.0016362455, + 0.0049087189, + 0.0081811398, + 0.0114534731, + 0.0147256837, + 0.0179977366, + 0.0212695968, + 0.0245412292, + 0.0278125988, + 0.0310836705, + 0.0343544094, + 0.0376247803, + 0.0408947483, + 0.0441642784, + 0.0474333354, + 0.0507018846, + 0.0539698907, + 0.0572373189, + 0.0605041341, + 0.0637703013, + 0.0670357857, + 0.0703005521, + 0.0735645656, + 0.0768277914, + 0.0800901944, + 0.0833517396, + 0.0866123923, + 0.0898721174, + 0.0931308800, + 0.0963886453, + 0.0996453784, + 0.1029010443, + 0.1061556082, + 0.1094090353, + 0.1126612907, + 0.1159123396, + 0.1191621472, + 0.1224106786, + 0.1256578991, + 0.1289037739, + 0.1321482683, + 0.1353913474, + 0.1386329767, + 0.1418731213, + 0.1451117465, + 0.1483488177, + 0.1515843002, + 0.1548181594, + 0.1580503605, + 0.1612808691, + 0.1645096505, + 0.1677366702, + 0.1709618935, + 0.1741852859, + 0.1774068130, + 0.1806264402, + 0.1838441330, + 0.1870598570, + 0.1902735777, + 0.1934852607, + 0.1966948717, + 0.1999023762, + 0.2031077400, + 0.2063109286, + 0.2095119078, + 0.2127106433, + 0.2159071008, + 0.2191012462, + 0.2222930451, + 0.2254824635, + 0.2286694671, + 0.2318540218, + 0.2350360936, + 0.2382156484, + 0.2413926520, + 0.2445670705, + 0.2477388699, + 0.2509080162, + 0.2540744755, + 0.2572382139, + 0.2603991974, + 0.2635573923, + 0.2667127647, + 0.2698652808, + 0.2730149069, + 0.2761616092, + 0.2793053540, + 0.2824461077, + 0.2855838367, + 0.2887185072, + 0.2918500858, + 0.2949785389, + 0.2981038331, + 0.3012259348, + 0.3043448106, + 0.3074604271, + 0.3105727510, + 0.3136817488, + 0.3167873874, + 0.3198896335, + 0.3229884538, + 0.3260838151, + 0.3291756844, + 0.3322640284, + 0.3353488142, + 0.3384300086, + 0.3415075788, + 0.3445814916, + 0.3476517143, + 0.3507182139, + 0.3537809576, + 0.3568399126, + 0.3598950461, + 0.3629463254, + 0.3659937179, + 0.3690371908, + 0.3720767117, + 0.3751122479, + 0.3781437670, + 0.3811712365, + 0.3841946239, + 0.3872138969, + 0.3902290232, + 0.3932399704, + 0.3962467063, + 0.3992491987, + 0.4022474156, + 0.4052413246, + 0.4082308939, + 0.4112160913, + 0.4141968849, + 0.4171732429, + 0.4201451332, + 0.4231125241, + 0.4260753838, + 0.4290336806, + 0.4319873828, + 0.4349364587, + 0.4378808768, + 0.4408206056, + 0.4437556136, + 0.4466858692, + 0.4496113412, + 0.4525319983, + 0.4554478091, + 0.4583587424, + 0.4612647671, + 0.4641658519, + 0.4670619660, + 0.4699530782, + 0.4728391575, + 0.4757201731, + 0.4785960942, + 0.4814668899, + 0.4843325294, + 0.4871929822, + 0.4900482174, + 0.4928982047, + 0.4957429134, + 0.4985823131, + 0.5014163734, + 0.5042450640, + 0.5070683544, + 0.5098862146, + 0.5126986143, + 0.5155055234, + 0.5183069119, + 0.5211027497, + 0.5238930069, + 0.5266776537, + 0.5294566601, + 0.5322299965, + 0.5349976332, + 0.5377595404, + 0.5405156887, + 0.5432660485, + 0.5460105903, + 0.5487492848, + 0.5514821026, + 0.5542090145, + 0.5569299913, + 0.5596450038, + 0.5623540230, + 0.5650570198, + 0.5677539653, + 0.5704448306, + 0.5731295868, + 0.5758082054, + 0.5784806575, + 0.5811469145, + 0.5838069479, + 0.5864607292, + 0.5891082300, + 0.5917494219, + 0.5943842766, + 0.5970127660, + 0.5996348618, + 0.6022505361, + 0.6048597607, + 0.6074625077, + 0.6100587493, + 0.6126484577, + 0.6152316051, + 0.6178081639, + 0.6203781064, + 0.6229414052, + 0.6254980328, + 0.6280479618, + 0.6305911649, + 0.6331276149, + 0.6356572846, + 0.6381801469, + 0.6406961748, + 0.6432053414, + 0.6457076197, + 0.6482029831, + 0.6506914047, + 0.6531728580, + 0.6556473162, + 0.6581147531, + 0.6605751420, + 0.6630284567, + 0.6654746709, + 0.6679137584, + 0.6703456931, + 0.6727704490, + 0.6751880000, + 0.6775983202, + 0.6800013840, + 0.6823971654, + 0.6847856390, + 0.6871667790, + 0.6895405601, + 0.6919069567, + 0.6942659435, + 0.6966174953, + 0.6989615869, + 0.7012981932, + 0.7036272892, + 0.7059488498, + 0.7082628503, + 0.7105692659, + 0.7128680719, + 0.7151592436, + 0.7174427565, + 0.7197185862, + 0.7219867083, + 0.7242470985, + 0.7264997326, + 0.7287445864, + 0.7309816360, + 0.7332108574, + 0.7354322266, + 0.7376457200, + 0.7398513138, + 0.7420489844, + 0.7442387082, + 0.7464204618, + 0.7485942218, + 0.7507599651, + 0.7529176682, + 0.7550673083, + 0.7572088621, + 0.7593423069, + 0.7614676197, + 0.7635847778, + 0.7656937585, + 0.7677945393, + 0.7698870976, + 0.7719714111, + 0.7740474573, + 0.7761152141, + 0.7781746593, + 0.7802257710, + 0.7822685270, + 0.7843029055, + 0.7863288848, + 0.7883464432, + 0.7903555590, + 0.7923562107, + 0.7943483769, + 0.7963320363, + 0.7983071676, + 0.8002737497, + 0.8022317615, + 0.8041811820, + 0.8061219904, + 0.8080541659, + 0.8099776877, + 0.8118925354, + 0.8137986883, + 0.8156961261, + 0.8175848285, + 0.8194647752, + 0.8213359460, + 0.8231983211, + 0.8250518803, + 0.8268966039, + 0.8287324721, + 0.8305594652, + 0.8323775637, + 0.8341867481, + 0.8359869990, + 0.8377782972, + 0.8395606235, + 0.8413339587, + 0.8430982839, + 0.8448535802, + 0.8465998288, + 0.8483370110, + 0.8500651082, + 0.8517841019, + 0.8534939737, + 0.8551947052, + 0.8568862783, + 0.8585686748, + 0.8602418767, + 0.8619058662, + 0.8635606253, + 0.8652061363, + 0.8668423818, + 0.8684693440, + 0.8700870056, + 0.8716953493, + 0.8732943578, + 0.8748840140, + 0.8764643010, + 0.8780352017, + 0.8795966993, + 0.8811487772, + 0.8826914187, + 0.8842246072, + 0.8857483265, + 0.8872625600, + 0.8887672917, + 0.8902625055, + 0.8917481852, + 0.8932243150, + 0.8946908791, + 0.8961478618, + 0.8975952475, + 0.8990330206, + 0.9004611658, + 0.9018796678, + 0.9032885114, + 0.9046876815, + 0.9060771631, + 0.9074569413, + 0.9088270015, + 0.9101873288, + 0.9115379087, + 0.9128787268, + 0.9142097687, + 0.9155310202, + 0.9168424670, + 0.9181440952, + 0.9194358908, + 0.9207178400, + 0.9219899290, + 0.9232521443, + 0.9245044723, + 0.9257468996, + 0.9269794128, + 0.9282019989, + 0.9294146447, + 0.9306173372, + 0.9318100635, + 0.9329928109, + 0.9341655667, + 0.9353283183, + 0.9364810533, + 0.9376237593, + 0.9387564242, + 0.9398790357, + 0.9409915818, + 0.9420940507, + 0.9431864306, + 0.9442687096, + 0.9453408763, + 0.9464029192, + 0.9474548268, + 0.9484965880, + 0.9495281915, + 0.9505496264, + 0.9515608816, + 0.9525619463, + 0.9535528099, + 0.9545334617, + 0.9555038913, + 0.9564640881, + 0.9574140420, + 0.9583537427, + 0.9592831803, + 0.9602023446, + 0.9611112260, + 0.9620098147, + 0.9628981010, + 0.9637760755, + 0.9646437286, + 0.9655010512, + 0.9663480341, + 0.9671846682, + 0.9680109445, + 0.9688268541, + 0.9696323885, + 0.9704275388, + 0.9712122966, + 0.9719866535, + 0.9727506013, + 0.9735041316, + 0.9742472365, + 0.9749799080, + 0.9757021383, + 0.9764139195, + 0.9771152442, + 0.9778061047, + 0.9784864937, + 0.9791564039, + 0.9798158282, + 0.9804647593, + 0.9811031905, + 0.9817311149, + 0.9823485257, + 0.9829554164, + 0.9835517804, + 0.9841376113, + 0.9847129029, + 0.9852776490, + 0.9858318436, + 0.9863754808, + 0.9869085546, + 0.9874310595, + 0.9879429897, + 0.9884443399, + 0.9889351046, + 0.9894152786, + 0.9898848568, + 0.9903438341, + 0.9907922056, + 0.9912299666, + 0.9916571122, + 0.9920736380, + 0.9924795395, + 0.9928748124, + 0.9932594523, + 0.9936334552, + 0.9939968171, + 0.9943495342, + 0.9946916025, + 0.9950230184, + 0.9953437785, + 0.9956538793, + 0.9959533173, + 0.9962420896, + 0.9965201929, + 0.9967876242, + 0.9970443807, + 0.9972904597, + 0.9975258586, + 0.9977505747, + 0.9979646057, + 0.9981679493, + 0.9983606034, + 0.9985425657, + 0.9987138346, + 0.9988744079, + 0.9990242842, + 0.9991634617, + 0.9992919389, + 0.9994097146, + 0.9995167873, + 0.9996131561, + 0.9996988198, + 0.9997737775, + 0.9998380284, + 0.9998915719, + 0.9999344073, + 0.9999665343, + 0.9999879524, + 0.9999986614 +}; + +real_t ld_mid_512[] = +{ + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0061358848, + 0.0184067304, + 0.0306748040, + 0.0429382581, + 0.0551952459, + 0.0674439214, + 0.0796824402, + 0.0919089590, + 0.1041216368, + 0.1163186341, + 0.1284981143, + 0.1406582432, + 0.1527971895, + 0.1649131250, + 0.1770042253, + 0.1890686693, + 0.2011046404, + 0.2131103258, + 0.2250839175, + 0.2370236125, + 0.2489276125, + 0.2607941250, + 0.2726213628, + 0.2844075449, + 0.2961508962, + 0.3078496483, + 0.3195020394, + 0.3311063146, + 0.3426607265, + 0.3541635348, + 0.3656130075, + 0.3770074202, + 0.3883450569, + 0.3996242103, + 0.4108431818, + 0.4220002818, + 0.4330938301, + 0.4441221560, + 0.4550835988, + 0.4659765077, + 0.4767992422, + 0.4875501725, + 0.4982276796, + 0.5088301553, + 0.5193560032, + 0.5298036379, + 0.5401714861, + 0.5504579865, + 0.5606615899, + 0.5707807598, + 0.5808139721, + 0.5907597160, + 0.6006164937, + 0.6103828207, + 0.6200572264, + 0.6296382536, + 0.6391244597, + 0.6485144160, + 0.6578067083, + 0.6669999374, + 0.6760927188, + 0.6850836831, + 0.6939714763, + 0.7027547599, + 0.7114322112, + 0.7200025235, + 0.7284644060, + 0.7368165845, + 0.7450578010, + 0.7531868147, + 0.7612024011, + 0.7691033533, + 0.7768884813, + 0.7845566127, + 0.7921065928, + 0.7995372846, + 0.8068475690, + 0.8140363451, + 0.8211025303, + 0.8280450605, + 0.8348628901, + 0.8415549925, + 0.8481203597, + 0.8545580032, + 0.8608669533, + 0.8670462601, + 0.8730949928, + 0.8790122407, + 0.8847971125, + 0.8904487372, + 0.8959662635, + 0.9013488606, + 0.9065957178, + 0.9117060451, + 0.9166790728, + 0.9215140520, + 0.9262102546, + 0.9307669733, + 0.9351835219, + 0.9394592352, + 0.9435934695, + 0.9475856021, + 0.9514350317, + 0.9551411788, + 0.9587034850, + 0.9621214141, + 0.9653944512, + 0.9685221034, + 0.9715038998, + 0.9743393912, + 0.9770281507, + 0.9795697733, + 0.9819638764, + 0.9842100992, + 0.9863081037, + 0.9882575738, + 0.9900582159, + 0.9917097588, + 0.9932119539, + 0.9945645750, + 0.9957674182, + 0.9968203026, + 0.9977230695, + 0.9984755829, + 0.9990777296, + 0.9995294188, + 0.9998305826, + 0.9999811755, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000 +}; + +real_t ld_mid_480[] = +{ + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0000000000, + 0.0065449381, + 0.0196336930, + 0.0327190837, + 0.0457988682, + 0.0588708053, + 0.0719326552, + 0.0849821797, + 0.0980171430, + 0.1110353116, + 0.1240344549, + 0.1370123455, + 0.1499667597, + 0.1628954779, + 0.1757962848, + 0.1886669699, + 0.2015053279, + 0.2143091589, + 0.2270762692, + 0.2398044712, + 0.2524915839, + 0.2651354334, + 0.2777338534, + 0.2902846851, + 0.3027857780, + 0.3152349901, + 0.3276301883, + 0.3399692488, + 0.3522500573, + 0.3644705095, + 0.3766285116, + 0.3887219804, + 0.4007488436, + 0.4127070406, + 0.4245945223, + 0.4364092520, + 0.4481492051, + 0.4598123703, + 0.4713967489, + 0.4829003561, + 0.4943212208, + 0.5056573861, + 0.5169069096, + 0.5280678638, + 0.5391383363, + 0.5501164301, + 0.5610002644, + 0.5717879741, + 0.5824777109, + 0.5930676432, + 0.6035559563, + 0.6139408533, + 0.6242205546, + 0.6343932989, + 0.6444573433, + 0.6544109631, + 0.6642524530, + 0.6739801267, + 0.6835923173, + 0.6930873779, + 0.7024636815, + 0.7117196216, + 0.7208536122, + 0.7298640883, + 0.7387495058, + 0.7475083425, + 0.7561390974, + 0.7646402918, + 0.7730104690, + 0.7812481948, + 0.7893520577, + 0.7973206693, + 0.8051526640, + 0.8128467000, + 0.8204014588, + 0.8278156461, + 0.8350879914, + 0.8422172487, + 0.8492021964, + 0.8560416377, + 0.8627344006, + 0.8692793384, + 0.8756753297, + 0.8819212785, + 0.8880161146, + 0.8939587938, + 0.8997482976, + 0.9053836343, + 0.9108638381, + 0.9161879700, + 0.9213551179, + 0.9263643963, + 0.9312149469, + 0.9359059386, + 0.9404365677, + 0.9448060577, + 0.9490136602, + 0.9530586539, + 0.9569403460, + 0.9606580713, + 0.9642111928, + 0.9675991016, + 0.9708212173, + 0.9738769878, + 0.9767658894, + 0.9794874272, + 0.9820411349, + 0.9844265749, + 0.9866433385, + 0.9886910458, + 0.9905693459, + 0.9922779171, + 0.9938164666, + 0.9951847307, + 0.9963824750, + 0.9974094943, + 0.9982656127, + 0.9989506833, + 0.9994645889, + 0.9998072413, + 0.9999785819, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000, + 1.0000000000 +}; +#endif + +#else + +real_t sine_long_1024[] = +{ + 0x3243F, + 0x96CBD, + 0xFB53A, + 0x15FDB5, + 0x1C462C, + 0x228E9E, + 0x28D70C, + 0x2F1F73, + 0x3567D2, + 0x3BB02A, + 0x41F878, + 0x4840BD, + 0x4E88F6, + 0x54D123, + 0x5B1942, + 0x616154, + 0x67A957, + 0x6DF14A, + 0x74392C, + 0x7A80FC, + 0x80C8B9, + 0x871062, + 0x8D57F6, + 0x939F75, + 0x99E6DC, + 0xA02E2C, + 0xA67564, + 0xACBC81, + 0xB30385, + 0xB94A6C, + 0xBF9137, + 0xC5D7E4, + 0xCC1E73, + 0xD264E2, + 0xD8AB31, + 0xDEF15F, + 0xE5376A, + 0xEB7D51, + 0xF1C315, + 0xF808B3, + 0xFE4E2B, + 0x104937C, + 0x10AD8A4, + 0x1111DA3, + 0x1176279, + 0x11DA723, + 0x123EBA1, + 0x12A2FF2, + 0x1307415, + 0x136B809, + 0x13CFBCD, + 0x1433F61, + 0x14982C2, + 0x14FC5F1, + 0x15608EC, + 0x15C4BB2, + 0x1628E42, + 0x168D09C, + 0x16F12BE, + 0x17554A8, + 0x17B9658, + 0x181D7CD, + 0x1881907, + 0x18E5A04, + 0x1949AC4, + 0x19ADB46, + 0x1A11B88, + 0x1A75B8A, + 0x1AD9B4B, + 0x1B3DAC9, + 0x1BA1A04, + 0x1C058FB, + 0x1C697AD, + 0x1CCD619, + 0x1D3143D, + 0x1D9521A, + 0x1DF8FAE, + 0x1E5CCF7, + 0x1EC09F6, + 0x1F246A9, + 0x1F8830F, + 0x1FEBF27, + 0x204FAF1, + 0x20B366B, + 0x2117194, + 0x217AC6B, + 0x21DE6F0, + 0x2242121, + 0x22A5AFE, + 0x2309485, + 0x236CDB6, + 0x23D0690, + 0x2433F11, + 0x2497738, + 0x24FAF06, + 0x255E678, + 0x25C1D8E, + 0x2625447, + 0x2688AA1, + 0x26EC09D, + 0x274F638, + 0x27B2B73, + 0x281604C, + 0x28794C1, + 0x28DC8D3, + 0x293FC80, + 0x29A2FC7, + 0x2A062A8, + 0x2A69521, + 0x2ACC731, + 0x2B2F8D8, + 0x2B92A14, + 0x2BF5AE4, + 0x2C58B48, + 0x2CBBB3F, + 0x2D1EAC7, + 0x2D819E0, + 0x2DE4889, + 0x2E476C0, + 0x2EAA485, + 0x2F0D1D7, + 0x2F6FEB5, + 0x2FD2B1E, + 0x3035711, + 0x309828D, + 0x30FAD91, + 0x315D81C, + 0x31C022E, + 0x3222BC4, + 0x32854DF, + 0x32E7D7E, + 0x334A59E, + 0x33ACD41, + 0x340F463, + 0x3471B05, + 0x34D4126, + 0x35366C5, + 0x3598BE0, + 0x35FB077, + 0x365D488, + 0x36BF814, + 0x3721B18, + 0x3783D95, + 0x37E5F88, + 0x38480F2, + 0x38AA1D1, + 0x390C223, + 0x396E1EA, + 0x39D0122, + 0x3A31FCC, + 0x3A93DE6, + 0x3AF5B70, + 0x3B57868, + 0x3BB94CD, + 0x3C1B0A0, + 0x3C7CBDE, + 0x3CDE687, + 0x3D40099, + 0x3DA1A15, + 0x3E032F8, + 0x3E64B43, + 0x3EC62F3, + 0x3F27A09, + 0x3F89083, + 0x3FEA660, + 0x404BB9F, + 0x40AD03F, + 0x410E441, + 0x416F7A1, + 0x41D0A60, + 0x4231C7D, + 0x4292DF6, + 0x42F3ECB, + 0x4354EFB, + 0x43B5E85, + 0x4416D68, + 0x4477BA2, + 0x44D8934, + 0x453961C, + 0x459A259, + 0x45FADEB, + 0x465B8CF, + 0x46BC306, + 0x471CC8F, + 0x477D568, + 0x47DDD91, + 0x483E508, + 0x489EBCD, + 0x48FF1DF, + 0x495F73D, + 0x49BFBE6, + 0x4A1FFD8, + 0x4A80314, + 0x4AE0598, + 0x4B40764, + 0x4BA0875, + 0x4C008CD, + 0x4C60868, + 0x4CC0747, + 0x4D20569, + 0x4D802CC, + 0x4DDFF70, + 0x4E3FB54, + 0x4E9F677, + 0x4EFF0D8, + 0x4F5EA76, + 0x4FBE351, + 0x501DB66, + 0x507D2B6, + 0x50DC93F, + 0x513BF01, + 0x519B3FA, + 0x51FA82A, + 0x5259B8F, + 0x52B8E2A, + 0x5317FF8, + 0x53770F9, + 0x53D612D, + 0x5435091, + 0x5493F26, + 0x54F2CEA, + 0x55519DC, + 0x55B05FC, + 0x560F149, + 0x566DBC1, + 0x56CC564, + 0x572AE30, + 0x5789626, + 0x57E7D44, + 0x5846388, + 0x58A48F3, + 0x5902D84, + 0x5961138, + 0x59BF410, + 0x5A1D60B, + 0x5A7B727, + 0x5AD9764, + 0x5B376C1, + 0x5B9553D, + 0x5BF32D6, + 0x5C50F8D, + 0x5CAEB60, + 0x5D0C64F, + 0x5D6A058, + 0x5DC797A, + 0x5E251B5, + 0x5E82908, + 0x5EDFF71, + 0x5F3D4F1, + 0x5F9A985, + 0x5FF7D2E, + 0x6054FE9, + 0x60B21B8, + 0x610F297, + 0x616C287, + 0x61C9187, + 0x6225F95, + 0x6282CB1, + 0x62DF8DA, + 0x633C40F, + 0x6398E4F, + 0x63F579A, + 0x6451FEE, + 0x64AE74A, + 0x650ADAE, + 0x6567319, + 0x65C3789, + 0x661FAFE, + 0x667BD78, + 0x66D7EF4, + 0x6733F73, + 0x678FEF3, + 0x67EBD74, + 0x6847AF4, + 0x68A3772, + 0x68FF2EF, + 0x695AD69, + 0x69B66DE, + 0x6A11F4F, + 0x6A6D6BA, + 0x6AC8D1F, + 0x6B2427C, + 0x6B7F6D0, + 0x6BDAA1C, + 0x6C35C5D, + 0x6C90D93, + 0x6CEBDBE, + 0x6D46CDB, + 0x6DA1AEB, + 0x6DFC7ED, + 0x6E573DF, + 0x6EB1EC1, + 0x6F0C891, + 0x6F67150, + 0x6FC18FC, + 0x701BF94, + 0x7076518, + 0x70D0986, + 0x712ACDD, + 0x7184F1E, + 0x71DF046, + 0x7239055, + 0x7292F4B, + 0x72ECD26, + 0x73469E5, + 0x73A0588, + 0x73FA00D, + 0x7453975, + 0x74AD1BD, + 0x75068E6, + 0x755FEED, + 0x75B93D3, + 0x7612797, + 0x766BA37, + 0x76C4BB3, + 0x771DC0A, + 0x7776B3C, + 0x77CF946, + 0x7828629, + 0x78811E3, + 0x78D9C74, + 0x79325DB, + 0x798AE16, + 0x79E3526, + 0x7A3BB09, + 0x7A93FBF, + 0x7AEC346, + 0x7B4459E, + 0x7B9C6C5, + 0x7BF46BC, + 0x7C4C581, + 0x7CA4313, + 0x7CFBF71, + 0x7D53A9B, + 0x7DAB490, + 0x7E02D4F, + 0x7E5A4D7, + 0x7EB1B27, + 0x7F0903F, + 0x7F6041D, + 0x7FB76C0, + 0x800E829, + 0x8065856, + 0x80BC746, + 0x81134F8, + 0x816A16C, + 0x81C0CA0, + 0x8217694, + 0x826DF48, + 0x82C46B9, + 0x831ACE8, + 0x83711D3, + 0x83C757A, + 0x841D7DC, + 0x84738F8, + 0x84C98CD, + 0x851F75B, + 0x85754A0, + 0x85CB09B, + 0x8620B4D, + 0x86764B4, + 0x86CBCCE, + 0x872139D, + 0x877691D, + 0x87CBD50, + 0x8821034, + 0x88761C7, + 0x88CB20A, + 0x89200FC, + 0x8974E9B, + 0x89C9AE7, + 0x8A1E5DE, + 0x8A72F82, + 0x8AC77CF, + 0x8B1BEC6, + 0x8B70466, + 0x8BC48AE, + 0x8C18B9D, + 0x8C6CD32, + 0x8CC0D6D, + 0x8D14C4C, + 0x8D689D0, + 0x8DBC5F6, + 0x8E100BF, + 0x8E63A29, + 0x8EB7234, + 0x8F0A8DF, + 0x8F5DE29, + 0x8FB1211, + 0x9004496, + 0x90575B9, + 0x90AA577, + 0x90FD3D0, + 0x91500C3, + 0x91A2C50, + 0x91F5675, + 0x9247F33, + 0x929A687, + 0x92ECC72, + 0x933F0F2, + 0x9391407, + 0x93E35AF, + 0x94355EB, + 0x94874B9, + 0x94D9219, + 0x952AE09, + 0x957C88A, + 0x95CE199, + 0x961F937, + 0x9670F62, + 0x96C241B, + 0x971375F, + 0x976492E, + 0x97B5988, + 0x980686C, + 0x98575D8, + 0x98A81CD, + 0x98F8C49, + 0x994954C, + 0x9999CD4, + 0x99EA2E1, + 0x9A3A773, + 0x9A8AA88, + 0x9ADAC1F, + 0x9B2AC39, + 0x9B7AAD4, + 0x9BCA7EF, + 0x9C1A389, + 0x9C69DA3, + 0x9CB963A, + 0x9D08D4F, + 0x9D582E1, + 0x9DA76EE, + 0x9DF6976, + 0x9E45A79, + 0x9E949F5, + 0x9EE37E9, + 0x9F32456, + 0x9F80F3A, + 0x9FCF894, + 0xA01E064, + 0xA06C6A9, + 0xA0BAB62, + 0xA108E8E, + 0xA15702D, + 0xA1A503E, + 0xA1F2EC0, + 0xA240BB3, + 0xA28E715, + 0xA2DC0E6, + 0xA329925, + 0xA376FD2, + 0xA3C44EC, + 0xA411871, + 0xA45EA61, + 0xA4ABABC, + 0xA4F8981, + 0xA5456AE, + 0xA592244, + 0xA5DEC41, + 0xA62B4A5, + 0xA677B6F, + 0xA6C409E, + 0xA710432, + 0xA75C62A, + 0xA7A8684, + 0xA7F4541, + 0xA840260, + 0xA88BDDF, + 0xA8D77BE, + 0xA922FFD, + 0xA96E69B, + 0xA9B9B96, + 0xAA04EEF, + 0xAA500A4, + 0xAA9B0B5, + 0xAAE5F21, + 0xAB30BE8, + 0xAB7B707, + 0xABC6080, + 0xAC10851, + 0xAC5AE7A, + 0xACA52F9, + 0xACEF5CE, + 0xAD396F9, + 0xAD83678, + 0xADCD44B, + 0xAE17071, + 0xAE60AE9, + 0xAEAA3B4, + 0xAEF3ACF, + 0xAF3D03B, + 0xAF863F6, + 0xAFCF600, + 0xB018658, + 0xB0614FE, + 0xB0AA1F1, + 0xB0F2D30, + 0xB13B6BA, + 0xB183E8F, + 0xB1CC4AE, + 0xB214916, + 0xB25CBC7, + 0xB2A4CC0, + 0xB2ECBFF, + 0xB334986, + 0xB37C552, + 0xB3C3F64, + 0xB40B7B9, + 0xB452E53, + 0xB49A330, + 0xB4E164F, + 0xB5287AF, + 0xB56F751, + 0xB5B6533, + 0xB5FD155, + 0xB643BB6, + 0xB68A455, + 0xB6D0B31, + 0xB71704B, + 0xB75D3A0, + 0xB7A3532, + 0xB7E94FE, + 0xB82F304, + 0xB874F44, + 0xB8BA9BD, + 0xB90026E, + 0xB945957, + 0xB98AE76, + 0xB9D01CC, + 0xBA15357, + 0xBA5A317, + 0xBA9F10B, + 0xBAE3D33, + 0xBB2878D, + 0xBB6D01A, + 0xBBB16D9, + 0xBBF5BC8, + 0xBC39EE7, + 0xBC7E036, + 0xBCC1FB4, + 0xBD05D60, + 0xBD4993A, + 0xBD8D341, + 0xBDD0B74, + 0xBE141D3, + 0xBE5765C, + 0xBE9A910, + 0xBEDD9EE, + 0xBF208F5, + 0xBF63624, + 0xBFA617B, + 0xBFE8AF9, + 0xC02B29E, + 0xC06D868, + 0xC0AFC58, + 0xC0F1E6C, + 0xC133EA4, + 0xC175D00, + 0xC1B797E, + 0xC1F941E, + 0xC23ACDF, + 0xC27C3C2, + 0xC2BD8C4, + 0xC2FEBE6, + 0xC33FD27, + 0xC380C86, + 0xC3C1A02, + 0xC40259C, + 0xC442F52, + 0xC483724, + 0xC4C3D10, + 0xC504118, + 0xC544339, + 0xC584373, + 0xC5C41C7, + 0xC603E32, + 0xC6438B4, + 0xC68314E, + 0xC6C27FD, + 0xC701CC2, + 0xC740F9D, + 0xC78008B, + 0xC7BEF8D, + 0xC7FDCA3, + 0xC83C7CB, + 0xC87B104, + 0xC8B9850, + 0xC8F7DAC, + 0xC936118, + 0xC974293, + 0xC9B221E, + 0xC9EFFB7, + 0xCA2DB5D, + 0xCA6B511, + 0xCAA8CD1, + 0xCAE629E, + 0xCB23675, + 0xCB60858, + 0xCB9D844, + 0xCBDA63A, + 0xCC1723A, + 0xCC53C41, + 0xCC90451, + 0xCCCCA67, + 0xCD08E85, + 0xCD450A8, + 0xCD810D1, + 0xCDBCEFF, + 0xCDF8B32, + 0xCE34568, + 0xCE6FDA1, + 0xCEAB3DD, + 0xCEE681B, + 0xCF21A5A, + 0xCF5CA9B, + 0xCF978DC, + 0xCFD251C, + 0xD00CF5C, + 0xD04779A, + 0xD081DD7, + 0xD0BC211, + 0xD0F6448, + 0xD13047C, + 0xD16A2AB, + 0xD1A3ED5, + 0xD1DD8FB, + 0xD21711A, + 0xD250733, + 0xD289B46, + 0xD2C2D50, + 0xD2FBD53, + 0xD334B4D, + 0xD36D73E, + 0xD3A6125, + 0xD3DE902, + 0xD416ED5, + 0xD44F29C, + 0xD487457, + 0xD4BF406, + 0xD4F71A7, + 0xD52ED3C, + 0xD5666C2, + 0xD59DE3A, + 0xD5D53A3, + 0xD60C6FC, + 0xD643845, + 0xD67A77D, + 0xD6B14A4, + 0xD6E7FB9, + 0xD71E8BC, + 0xD754FAD, + 0xD78B48A, + 0xD7C1753, + 0xD7F7808, + 0xD82D6A8, + 0xD863332, + 0xD898DA7, + 0xD8CE605, + 0xD903C4C, + 0xD93907C, + 0xD96E294, + 0xD9A3293, + 0xD9D8079, + 0xDA0CC46, + 0xDA415F9, + 0xDA75D91, + 0xDAAA30E, + 0xDADE670, + 0xDB127B6, + 0xDB466DF, + 0xDB7A3EB, + 0xDBADEDA, + 0xDBE17AA, + 0xDC14E5C, + 0xDC482EF, + 0xDC7B562, + 0xDCAE5B6, + 0xDCE13E9, + 0xDD13FFB, + 0xDD469EB, + 0xDD791B9, + 0xDDAB765, + 0xDDDDAEE, + 0xDE0FC54, + 0xDE41B96, + 0xDE738B3, + 0xDEA53AB, + 0xDED6C7E, + 0xDF0832C, + 0xDF397B3, + 0xDF6AA13, + 0xDF9BA4C, + 0xDFCC85D, + 0xDFFD446, + 0xE02DE06, + 0xE05E59D, + 0xE08EB0A, + 0xE0BEE4E, + 0xE0EEF67, + 0xE11EE55, + 0xE14EB17, + 0xE17E5AE, + 0xE1ADE18, + 0xE1DD455, + 0xE20C865, + 0xE23BA47, + 0xE26A9FB, + 0xE299781, + 0xE2C82D7, + 0xE2F6BFE, + 0xE3252F4, + 0xE3537BB, + 0xE381A50, + 0xE3AFAB4, + 0xE3DD8E6, + 0xE40B4E6, + 0xE438EB3, + 0xE46664D, + 0xE493BB4, + 0xE4C0EE7, + 0xE4EDFE5, + 0xE51AEAE, + 0xE547B42, + 0xE5745A0, + 0xE5A0DC9, + 0xE5CD3BA, + 0xE5F9775, + 0xE6258F8, + 0xE651843, + 0xE67D556, + 0xE6A9030, + 0xE6D48D1, + 0xE6FFF39, + 0xE72B366, + 0xE75655A, + 0xE781512, + 0xE7AC28F, + 0xE7D6DD1, + 0xE8016D6, + 0xE82BD9F, + 0xE85622C, + 0xE88047B, + 0xE8AA48C, + 0xE8D425F, + 0xE8FDDF4, + 0xE92774A, + 0xE950E60, + 0xE97A337, + 0xE9A35CE, + 0xE9CC624, + 0xE9F5439, + 0xEA1E00E, + 0xEA469A0, + 0xEA6F0F0, + 0xEA975FE, + 0xEABF8CA, + 0xEAE7952, + 0xEB0F796, + 0xEB37396, + 0xEB5ED52, + 0xEB864C9, + 0xEBAD9FC, + 0xEBD4CE8, + 0xEBFBD8F, + 0xEC22BEF, + 0xEC49809, + 0xEC701DC, + 0xEC96967, + 0xECBCEAB, + 0xECE31A6, + 0xED09259, + 0xED2F0C3, + 0xED54CE4, + 0xED7A6BC, + 0xED9FE49, + 0xEDC538C, + 0xEDEA685, + 0xEE0F732, + 0xEE34594, + 0xEE591AA, + 0xEE7DB74, + 0xEEA22F2, + 0xEEC6823, + 0xEEEAB06, + 0xEF0EB9D, + 0xEF329E5, + 0xEF565DF, + 0xEF79F8B, + 0xEF9D6E7, + 0xEFC0BF5, + 0xEFE3EB3, + 0xF006F21, + 0xF029D3F, + 0xF04C90C, + 0xF06F288, + 0xF0919B3, + 0xF0B3E8D, + 0xF0D6114, + 0xF0F8149, + 0xF119F2C, + 0xF13BABC, + 0xF15D3F9, + 0xF17EAE2, + 0xF19FF77, + 0xF1C11B8, + 0xF1E21A4, + 0xF202F3C, + 0xF223A7F, + 0xF24436C, + 0xF264A03, + 0xF284E44, + 0xF2A502F, + 0xF2C4FC3, + 0xF2E4D01, + 0xF3047E6, + 0xF324075, + 0xF3436AB, + 0xF362A89, + 0xF381C0F, + 0xF3A0B3B, + 0xF3BF80F, + 0xF3DE289, + 0xF3FCAAA, + 0xF41B070, + 0xF4393DC, + 0xF4574EE, + 0xF4753A4, + 0xF493000, + 0xF4B0A00, + 0xF4CE1A4, + 0xF4EB6EC, + 0xF5089D8, + 0xF525A67, + 0xF54289A, + 0xF55F46F, + 0xF57BDE7, + 0xF598501, + 0xF5B49BD, + 0xF5D0C1B, + 0xF5ECC1A, + 0xF6089BB, + 0xF6244FD, + 0xF63FDDF, + 0xF65B461, + 0xF676884, + 0xF691A47, + 0xF6AC9A9, + 0xF6C76AA, + 0xF6E214B, + 0xF6FC98B, + 0xF716F69, + 0xF7312E5, + 0xF74B400, + 0xF7652B8, + 0xF77EF0E, + 0xF798901, + 0xF7B2092, + 0xF7CB5BF, + 0xF7E4888, + 0xF7FD8EF, + 0xF8166F1, + 0xF82F28F, + 0xF847BC9, + 0xF86029E, + 0xF87870E, + 0xF890919, + 0xF8A88BF, + 0xF8C05FF, + 0xF8D80DA, + 0xF8EF94E, + 0xF906F5D, + 0xF91E305, + 0xF935446, + 0xF94C320, + 0xF962F93, + 0xF97999F, + 0xF990144, + 0xF9A6680, + 0xF9BC955, + 0xF9D29C1, + 0xF9E87C5, + 0xF9FE360, + 0xFA13C93, + 0xFA2935C, + 0xFA3E7BC, + 0xFA539B3, + 0xFA68940, + 0xFA7D663, + 0xFA9211D, + 0xFAA696C, + 0xFABAF50, + 0xFACF2CA, + 0xFAE33D9, + 0xFAF727D, + 0xFB0AEB5, + 0xFB1E883, + 0xFB31FE4, + 0xFB454DA, + 0xFB58764, + 0xFB6B782, + 0xFB7E533, + 0xFB91078, + 0xFBA3950, + 0xFBB5FBB, + 0xFBC83B9, + 0xFBDA54A, + 0xFBEC46E, + 0xFBFE124, + 0xFC0FB6C, + 0xFC21346, + 0xFC328B2, + 0xFC43BB0, + 0xFC54C3F, + 0xFC65A60, + 0xFC76612, + 0xFC86F55, + 0xFC97629, + 0xFCA7A8D, + 0xFCB7C83, + 0xFCC7C08, + 0xFCD791F, + 0xFCE73C5, + 0xFCF6BFB, + 0xFD061C1, + 0xFD15517, + 0xFD245FC, + 0xFD33471, + 0xFD42074, + 0xFD50A07, + 0xFD5F129, + 0xFD6D5DA, + 0xFD7B81A, + 0xFD897E8, + 0xFD97544, + 0xFDA502F, + 0xFDB28A8, + 0xFDBFEAF, + 0xFDCD244, + 0xFDDA366, + 0xFDE7217, + 0xFDF3E54, + 0xFE00820, + 0xFE0CF78, + 0xFE1945E, + 0xFE256D0, + 0xFE316D0, + 0xFE3D45C, + 0xFE48F75, + 0xFE5481B, + 0xFE5FE4D, + 0xFE6B20C, + 0xFE76356, + 0xFE8122D, + 0xFE8BE90, + 0xFE9687F, + 0xFEA0FFA, + 0xFEAB500, + 0xFEB5792, + 0xFEBF7AF, + 0xFEC9558, + 0xFED308D, + 0xFEDC94C, + 0xFEE5F97, + 0xFEEF36D, + 0xFEF84CE, + 0xFF013B9, + 0xFF0A030, + 0xFF12A31, + 0xFF1B1BD, + 0xFF236D3, + 0xFF2B974, + 0xFF3399F, + 0xFF3B754, + 0xFF43294, + 0xFF4AB5E, + 0xFF521B2, + 0xFF59590, + 0xFF606F8, + 0xFF675EA, + 0xFF6E266, + 0xFF74C6B, + 0xFF7B3FA, + 0xFF81913, + 0xFF87BB5, + 0xFF8DBE1, + 0xFF93996, + 0xFF994D5, + 0xFF9ED9D, + 0xFFA43EE, + 0xFFA97C9, + 0xFFAE92D, + 0xFFB3819, + 0xFFB848F, + 0xFFBCE8E, + 0xFFC1616, + 0xFFC5B27, + 0xFFC9DC1, + 0xFFCDDE3, + 0xFFD1B8F, + 0xFFD56C3, + 0xFFD8F80, + 0xFFDC5C6, + 0xFFDF994, + 0xFFE2AEB, + 0xFFE59CB, + 0xFFE8633, + 0xFFEB024, + 0xFFED79E, + 0xFFEFCA0, + 0xFFF1F2A, + 0xFFF3F3D, + 0xFFF5CD9, + 0xFFF77FC, + 0xFFF90A9, + 0xFFFA6DD, + 0xFFFBA9B, + 0xFFFCBE0, + 0xFFFDAAE, + 0xFFFE704, + 0xFFFF0E3, + 0xFFFF84A, + 0xFFFFD39, + 0xFFFFFB1 +}; + +real_t sine_long_960[] = { + 0x359DD, + 0xA0D97, + 0x10C14F, + 0x177504, + 0x1E28B5, + 0x24DC61, + 0x2B9006, + 0x3243A4, + 0x38F738, + 0x3FAAC3, + 0x465E43, + 0x4D11B6, + 0x53C51C, + 0x5A7873, + 0x612BBA, + 0x67DEF0, + 0x6E9214, + 0x754525, + 0x7BF821, + 0x82AB07, + 0x895DD6, + 0x90108E, + 0x96C32B, + 0x9D75AF, + 0xA42817, + 0xAADA62, + 0xB18C8F, + 0xB83E9D, + 0xBEF08A, + 0xC5A256, + 0xCC5400, + 0xD30585, + 0xD9B6E6, + 0xE06820, + 0xE71933, + 0xEDCA1D, + 0xF47ADE, + 0xFB2B74, + 0x101DBDD, + 0x1088C1A, + 0x10F3C28, + 0x115EC06, + 0x11C9BB4, + 0x1234B30, + 0x129FA78, + 0x130A98D, + 0x137586C, + 0x13E0714, + 0x144B584, + 0x14B63BC, + 0x15211B9, + 0x158BF7B, + 0x15F6D01, + 0x1661A49, + 0x16CC752, + 0x173741B, + 0x17A20A3, + 0x180CCE8, + 0x18778EA, + 0x18E24A7, + 0x194D01F, + 0x19B7B4F, + 0x1A22638, + 0x1A8D0D6, + 0x1AF7B2B, + 0x1B62533, + 0x1BCCEEF, + 0x1C3785D, + 0x1CA217B, + 0x1D0CA49, + 0x1D772C6, + 0x1DE1AF0, + 0x1E4C2C6, + 0x1EB6A47, + 0x1F21171, + 0x1F8B844, + 0x1FF5EBF, + 0x20604E0, + 0x20CAAA6, + 0x2135010, + 0x219F51D, + 0x22099CB, + 0x2273E1A, + 0x22DE208, + 0x2348595, + 0x23B28BE, + 0x241CB83, + 0x2486DE3, + 0x24F0FDC, + 0x255B16D, + 0x25C5295, + 0x262F354, + 0x26993A7, + 0x270338E, + 0x276D307, + 0x27D7212, + 0x28410AD, + 0x28AAED7, + 0x2914C8E, + 0x297E9D3, + 0x29E86A3, + 0x2A522FD, + 0x2ABBEE0, + 0x2B25A4C, + 0x2B8F53E, + 0x2BF8FB6, + 0x2C629B3, + 0x2CCC332, + 0x2D35C35, + 0x2D9F4B8, + 0x2E08CBB, + 0x2E7243D, + 0x2EDBB3D, + 0x2F451B9, + 0x2FAE7B0, + 0x3017D21, + 0x308120C, + 0x30EA66E, + 0x3153A47, + 0x31BCD96, + 0x3226058, + 0x328F28E, + 0x32F8437, + 0x3361550, + 0x33CA5D8, + 0x34335D0, + 0x349C535, + 0x3505406, + 0x356E242, + 0x35D6FE8, + 0x363FCF7, + 0x36A896E, + 0x371154C, + 0x377A08F, + 0x37E2B36, + 0x384B540, + 0x38B3EAC, + 0x391C779, + 0x3984FA6, + 0x39ED731, + 0x3A55E19, + 0x3ABE45E, + 0x3B269FE, + 0x3B8EEF8, + 0x3BF734A, + 0x3C5F6F4, + 0x3CC79F5, + 0x3D2FC4B, + 0x3D97DF6, + 0x3DFFEF3, + 0x3E67F43, + 0x3ECFEE3, + 0x3F37DD3, + 0x3F9FC11, + 0x400799D, + 0x406F675, + 0x40D7298, + 0x413EE05, + 0x41A68BB, + 0x420E2B8, + 0x4275BFD, + 0x42DD486, + 0x4344C54, + 0x43AC365, + 0x44139B8, + 0x447AF4C, + 0x44E2420, + 0x4549832, + 0x45B0B82, + 0x4617E0E, + 0x467EFD5, + 0x46E60D7, + 0x474D111, + 0x47B4084, + 0x481AF2D, + 0x4881D0B, + 0x48E8A1E, + 0x494F664, + 0x49B61DD, + 0x4A1CC86, + 0x4A83660, + 0x4AE9F68, + 0x4B5079E, + 0x4BB6F01, + 0x4C1D58F, + 0x4C83B47, + 0x4CEA029, + 0x4D50432, + 0x4DB6763, + 0x4E1C9B9, + 0x4E82B34, + 0x4EE8BD3, + 0x4F4EB94, + 0x4FB4A77, + 0x501A87A, + 0x508059C, + 0x50E61DB, + 0x514BD38, + 0x51B17B1, + 0x5217144, + 0x527C9F1, + 0x52E21B6, + 0x5347892, + 0x53ACE85, + 0x541238D, + 0x54777A9, + 0x54DCAD7, + 0x5541D18, + 0x55A6E69, + 0x560BECA, + 0x5670E39, + 0x56D5CB5, + 0x573AA3E, + 0x579F6D1, + 0x580426F, + 0x5868D16, + 0x58CD6C4, + 0x5931F79, + 0x5996734, + 0x59FADF3, + 0x5A5F3B6, + 0x5AC387B, + 0x5B27C41, + 0x5B8BF07, + 0x5BF00CC, + 0x5C54190, + 0x5CB814F, + 0x5D1C00B, + 0x5D7FDC1, + 0x5DE3A71, + 0x5E47619, + 0x5EAB0B9, + 0x5F0EA4E, + 0x5F722D9, + 0x5FD5A58, + 0x60390CA, + 0x609C62E, + 0x60FFA82, + 0x6162DC7, + 0x61C5FF9, + 0x622911A, + 0x628C126, + 0x62EF01F, + 0x6351E01, + 0x63B4ACC, + 0x6417680, + 0x647A11B, + 0x64DCA9B, + 0x653F301, + 0x65A1A4A, + 0x6604076, + 0x6666583, + 0x66C8971, + 0x672AC3F, + 0x678CDEA, + 0x67EEE73, + 0x6850DD9, + 0x68B2C19, + 0x6914934, + 0x6976527, + 0x69D7FF3, + 0x6A39995, + 0x6A9B20D, + 0x6AFC95A, + 0x6B5DF7B, + 0x6BBF46E, + 0x6C20832, + 0x6C81AC7, + 0x6CE2C2C, + 0x6D43C5F, + 0x6DA4B5F, + 0x6E0592B, + 0x6E665C2, + 0x6EC7123, + 0x6F27B4E, + 0x6F88440, + 0x6FE8BF9, + 0x7049279, + 0x70A97BC, + 0x7109BC4, + 0x7169E8E, + 0x71CA01A, + 0x722A066, + 0x7289F72, + 0x72E9D3D, + 0x73499C4, + 0x73A9508, + 0x7408F08, + 0x74687C1, + 0x74C7F34, + 0x752755F, + 0x7586A41, + 0x75E5DDA, + 0x7645027, + 0x76A4128, + 0x77030DC, + 0x7761F42, + 0x77C0C59, + 0x781F81F, + 0x787E295, + 0x78DCBB8, + 0x793B388, + 0x7999A03, + 0x79F7F29, + 0x7A562F9, + 0x7AB4571, + 0x7B12691, + 0x7B70658, + 0x7BCE4C3, + 0x7C2C1D3, + 0x7C89D87, + 0x7CE77DD, + 0x7D450D4, + 0x7DA286C, + 0x7DFFEA3, + 0x7E5D378, + 0x7EBA6EB, + 0x7F178F9, + 0x7F749A3, + 0x7FD18E7, + 0x802E6C5, + 0x808B33A, + 0x80E7E47, + 0x81447E9, + 0x81A1021, + 0x81FD6ED, + 0x8259C4C, + 0x82B603D, + 0x83122BF, + 0x836E3D1, + 0x83CA372, + 0x84261A1, + 0x8481E5D, + 0x84DD9A5, + 0x8539378, + 0x8594BD5, + 0x85F02BC, + 0x864B82A, + 0x86A6C1F, + 0x8701E9A, + 0x875CF9A, + 0x87B7F1E, + 0x8812D25, + 0x886D9AE, + 0x88C84B8, + 0x8922E42, + 0x897D64B, + 0x89D7CD2, + 0x8A321D6, + 0x8A8C556, + 0x8AE6752, + 0x8B407C7, + 0x8B9A6B5, + 0x8BF441B, + 0x8C4DFF9, + 0x8CA7A4C, + 0x8D01315, + 0x8D5AA52, + 0x8DB4002, + 0x8E0D424, + 0x8E666B8, + 0x8EBF7BB, + 0x8F1872E, + 0x8F71510, + 0x8FCA15E, + 0x9022C19, + 0x907B53F, + 0x90D3CD0, + 0x912C2CA, + 0x918472C, + 0x91DC9F6, + 0x9234B27, + 0x928CABD, + 0x92E48B7, + 0x933C516, + 0x9393FD6, + 0x93EB8F9, + 0x944307C, + 0x949A65F, + 0x94F1AA1, + 0x9548D41, + 0x959FE3E, + 0x95F6D96, + 0x964DB4A, + 0x96A4758, + 0x96FB1BE, + 0x9751A7D, + 0x97A8193, + 0x97FE700, + 0x9854AC1, + 0x98AACD7, + 0x9900D41, + 0x9956BFD, + 0x99AC90A, + 0x9A02468, + 0x9A57E15, + 0x9AAD612, + 0x9B02C5C, + 0x9B580F3, + 0x9BAD3D6, + 0x9C02503, + 0x9C5747B, + 0x9CAC23C, + 0x9D00E45, + 0x9D55895, + 0x9DAA12C, + 0x9DFE808, + 0x9E52D28, + 0x9EA708C, + 0x9EFB233, + 0x9F4F21B, + 0x9FA3044, + 0x9FF6CAD, + 0xA04A755, + 0xA09E03B, + 0xA0F175E, + 0xA144CBD, + 0xA198057, + 0xA1EB22C, + 0xA23E23A, + 0xA291080, + 0xA2E3CFF, + 0xA3367B4, + 0xA38909E, + 0xA3DB7BE, + 0xA42DD12, + 0xA480098, + 0xA4D2251, + 0xA52423C, + 0xA576056, + 0xA5C7CA0, + 0xA619719, + 0xA66AFBF, + 0xA6BC693, + 0xA70DB92, + 0xA75EEBC, + 0xA7B0010, + 0xA800F8E, + 0xA851D34, + 0xA8A2901, + 0xA8F32F5, + 0xA943B0E, + 0xA99414D, + 0xA9E45AF, + 0xAA34835, + 0xAA848DC, + 0xAAD47A5, + 0xAB2448E, + 0xAB73F97, + 0xABC38BF, + 0xAC13004, + 0xAC62566, + 0xACB18E5, + 0xAD00A7E, + 0xAD4FA32, + 0xAD9E7FF, + 0xADED3E5, + 0xAE3BDE3, + 0xAE8A5F7, + 0xAED8C22, + 0xAF27061, + 0xAF752B5, + 0xAFC331D, + 0xB011196, + 0xB05EE22, + 0xB0AC8BE, + 0xB0FA16B, + 0xB147827, + 0xB194CF1, + 0xB1E1FC8, + 0xB22F0AC, + 0xB27BF9C, + 0xB2C8C97, + 0xB31579B, + 0xB3620AA, + 0xB3AE7C0, + 0xB3FACDE, + 0xB447003, + 0xB49312E, + 0xB4DF05D, + 0xB52AD91, + 0xB5768C9, + 0xB5C2203, + 0xB60D93E, + 0xB658E7B, + 0xB6A41B8, + 0xB6EF2F4, + 0xB73A22E, + 0xB784F66, + 0xB7CFA9B, + 0xB81A3CC, + 0xB864AF8, + 0xB8AF01E, + 0xB8F933E, + 0xB943456, + 0xB98D367, + 0xB9D706E, + 0xBA20B6C, + 0xBA6A45F, + 0xBAB3B47, + 0xBAFD023, + 0xBB462F2, + 0xBB8F3B3, + 0xBBD8266, + 0xBC20F09, + 0xBC6999C, + 0xBCB221E, + 0xBCFA88F, + 0xBD42CED, + 0xBD8AF37, + 0xBDD2F6E, + 0xBE1AD8F, + 0xBE6299B, + 0xBEAA390, + 0xBEF1B6E, + 0xBF39135, + 0xBF804E2, + 0xBFC7675, + 0xC00E5EF, + 0xC05534D, + 0xC09BE8F, + 0xC0E27B4, + 0xC128EBC, + 0xC16F3A6, + 0xC1B5670, + 0xC1FB71B, + 0xC2415A5, + 0xC28720E, + 0xC2CCC55, + 0xC312479, + 0xC357A79, + 0xC39CE55, + 0xC3E200C, + 0xC426F9C, + 0xC46BD06, + 0xC4B0849, + 0xC4F5164, + 0xC539855, + 0xC57DD1D, + 0xC5C1FBB, + 0xC60602D, + 0xC649E73, + 0xC68DA8D, + 0xC6D1479, + 0xC714C37, + 0xC7581C7, + 0xC79B526, + 0xC7DE656, + 0xC821554, + 0xC864220, + 0xC8A6CBA, + 0xC8E9520, + 0xC92BB53, + 0xC96DF50, + 0xC9B0119, + 0xC9F20AB, + 0xCA33E06, + 0xCA75929, + 0xCAB7214, + 0xCAF88C6, + 0xCB39D3E, + 0xCB7AF7C, + 0xCBBBF7E, + 0xCBFCD44, + 0xCC3D8CE, + 0xCC7E21B, + 0xCCBE929, + 0xCCFEDF8, + 0xCD3F088, + 0xCD7F0D8, + 0xCDBEEE7, + 0xCDFEAB4, + 0xCE3E43F, + 0xCE7DB87, + 0xCEBD08B, + 0xCEFC34B, + 0xCF3B3C6, + 0xCF7A1FB, + 0xCFB8DEA, + 0xCFF7791, + 0xD035EF1, + 0xD074408, + 0xD0B26D6, + 0xD0F075A, + 0xD12E593, + 0xD16C181, + 0xD1A9B24, + 0xD1E7279, + 0xD224782, + 0xD261A3C, + 0xD29EAA8, + 0xD2DB8C5, + 0xD318491, + 0xD354E0D, + 0xD391538, + 0xD3CDA11, + 0xD409C97, + 0xD445CCA, + 0xD481AA8, + 0xD4BD633, + 0xD4F8F68, + 0xD534647, + 0xD56FAD0, + 0xD5AAD01, + 0xD5E5CDB, + 0xD620A5C, + 0xD65B584, + 0xD695E53, + 0xD6D04C6, + 0xD70A8DF, + 0xD744A9C, + 0xD77E9FD, + 0xD7B8701, + 0xD7F21A7, + 0xD82B9EF, + 0xD864FD8, + 0xD89E362, + 0xD8D748B, + 0xD910354, + 0xD948FBB, + 0xD9819C1, + 0xD9BA163, + 0xD9F26A3, + 0xDA2A97F, + 0xDA629F6, + 0xDA9A808, + 0xDAD23B4, + 0xDB09CFA, + 0xDB413DA, + 0xDB78851, + 0xDBAFA61, + 0xDBE6A07, + 0xDC1D745, + 0xDC54218, + 0xDC8AA81, + 0xDCC107F, + 0xDCF7411, + 0xDD2D537, + 0xDD633F0, + 0xDD9903B, + 0xDDCEA18, + 0xDE04187, + 0xDE39686, + 0xDE6E916, + 0xDEA3934, + 0xDED86E2, + 0xDF0D21F, + 0xDF41AE9, + 0xDF76140, + 0xDFAA524, + 0xDFDE694, + 0xE012590, + 0xE046217, + 0xE079C28, + 0xE0AD3C2, + 0xE0E08E6, + 0xE113B93, + 0xE146BC8, + 0xE179984, + 0xE1AC4C8, + 0xE1DED92, + 0xE2113E2, + 0xE2437B7, + 0xE275911, + 0xE2A77EF, + 0xE2D9451, + 0xE30AE36, + 0xE33C59E, + 0xE36DA87, + 0xE39ECF3, + 0xE3CFCDF, + 0xE400A4B, + 0xE431538, + 0xE461DA4, + 0xE49238F, + 0xE4C26F8, + 0xE4F27DF, + 0xE522643, + 0xE552224, + 0xE581B82, + 0xE5B125A, + 0xE5E06AE, + 0xE60F87D, + 0xE63E7C6, + 0xE66D488, + 0xE69BEC4, + 0xE6CA678, + 0xE6F8BA4, + 0xE726E48, + 0xE754E63, + 0xE782BF5, + 0xE7B06FC, + 0xE7DDF79, + 0xE80B56C, + 0xE8388D2, + 0xE8659AD, + 0xE8927FC, + 0xE8BF3BD, + 0xE8EBCF1, + 0xE918397, + 0xE9447AF, + 0xE970938, + 0xE99C832, + 0xE9C849C, + 0xE9F3E75, + 0xEA1F5BE, + 0xEA4AA75, + 0xEA75C9B, + 0xEAA0C2E, + 0xEACB92F, + 0xEAF639D, + 0xEB20B77, + 0xEB4B0BD, + 0xEB7536E, + 0xEB9F38B, + 0xEBC9111, + 0xEBF2C02, + 0xEC1C45D, + 0xEC45A21, + 0xEC6ED4D, + 0xEC97DE2, + 0xECC0BDE, + 0xECE9742, + 0xED1200D, + 0xED3A63E, + 0xED629D5, + 0xED8AAD2, + 0xEDB2934, + 0xEDDA4FB, + 0xEE01E25, + 0xEE294B4, + 0xEE508A6, + 0xEE779FB, + 0xEE9E8B3, + 0xEEC54CD, + 0xEEEBE48, + 0xEF12525, + 0xEF38962, + 0xEF5EB00, + 0xEF849FE, + 0xEFAA65C, + 0xEFD0018, + 0xEFF5734, + 0xF01ABAE, + 0xF03FD85, + 0xF064CBB, + 0xF08994D, + 0xF0AE33C, + 0xF0D2A88, + 0xF0F6F2F, + 0xF11B132, + 0xF13F090, + 0xF162D49, + 0xF18675C, + 0xF1A9EC9, + 0xF1CD390, + 0xF1F05AF, + 0xF213528, + 0xF2361F9, + 0xF258C22, + 0xF27B3A3, + 0xF29D87B, + 0xF2BFAAA, + 0xF2E1A2F, + 0xF30370B, + 0xF32513C, + 0xF3468C3, + 0xF367D9E, + 0xF388FCF, + 0xF3A9F54, + 0xF3CAC2C, + 0xF3EB658, + 0xF40BDD8, + 0xF42C2AA, + 0xF44C4CF, + 0xF46C446, + 0xF48C10F, + 0xF4ABB2A, + 0xF4CB295, + 0xF4EA751, + 0xF50995E, + 0xF5288BB, + 0xF547567, + 0xF565F63, + 0xF5846AE, + 0xF5A2B48, + 0xF5C0D30, + 0xF5DEC67, + 0xF5FC8EB, + 0xF61A2BC, + 0xF6379DB, + 0xF654E46, + 0xF671FFE, + 0xF68EF02, + 0xF6ABB52, + 0xF6C84ED, + 0xF6E4BD3, + 0xF701005, + 0xF71D181, + 0xF739047, + 0xF754C57, + 0xF7705B1, + 0xF78BC54, + 0xF7A7040, + 0xF7C2175, + 0xF7DCFF3, + 0xF7F7BB8, + 0xF8124C6, + 0xF82CB1B, + 0xF846EB7, + 0xF860F9A, + 0xF87ADC4, + 0xF894935, + 0xF8AE1EB, + 0xF8C77E8, + 0xF8E0B2A, + 0xF8F9BB1, + 0xF91297E, + 0xF92B48F, + 0xF943CE4, + 0xF95C27E, + 0xF97455C, + 0xF98C57E, + 0xF9A42E3, + 0xF9BBD8B, + 0xF9D3576, + 0xF9EAAA3, + 0xFA01D14, + 0xFA18CC6, + 0xFA2F9BA, + 0xFA463F0, + 0xFA5CB67, + 0xFA7301F, + 0xFA89218, + 0xFA9F152, + 0xFAB4DCC, + 0xFACA787, + 0xFADFE81, + 0xFAF52BB, + 0xFB0A435, + 0xFB1F2EE, + 0xFB33EE6, + 0xFB4881C, + 0xFB5CE91, + 0xFB71245, + 0xFB85337, + 0xFB99166, + 0xFBACCD3, + 0xFBC057E, + 0xFBD3B66, + 0xFBE6E8B, + 0xFBF9EEC, + 0xFC0CC8B, + 0xFC1F766, + 0xFC31F7D, + 0xFC444CF, + 0xFC5675E, + 0xFC68729, + 0xFC7A42E, + 0xFC8BE6F, + 0xFC9D5EB, + 0xFCAEAA2, + 0xFCBFC94, + 0xFCD0BBF, + 0xFCE1826, + 0xFCF21C6, + 0xFD028A0, + 0xFD12CB4, + 0xFD22E01, + 0xFD32C88, + 0xFD42848, + 0xFD52141, + 0xFD61772, + 0xFD70ADD, + 0xFD7FB80, + 0xFD8E95B, + 0xFD9D46E, + 0xFDABCBA, + 0xFDBA23D, + 0xFDC84F8, + 0xFDD64EB, + 0xFDE4214, + 0xFDF1C76, + 0xFDFF40E, + 0xFE0C8DD, + 0xFE19AE3, + 0xFE26A20, + 0xFE33693, + 0xFE4003C, + 0xFE4C71C, + 0xFE58B32, + 0xFE64C7E, + 0xFE70AFF, + 0xFE7C6B7, + 0xFE87FA4, + 0xFE935C6, + 0xFE9E91E, + 0xFEA99AA, + 0xFEB476C, + 0xFEBF263, + 0xFEC9A8F, + 0xFED3FEF, + 0xFEDE284, + 0xFEE824E, + 0xFEF1F4C, + 0xFEFB97E, + 0xFF050E4, + 0xFF0E57F, + 0xFF1774D, + 0xFF2064F, + 0xFF29286, + 0xFF31BEF, + 0xFF3A28D, + 0xFF4265D, + 0xFF4A761, + 0xFF52599, + 0xFF5A104, + 0xFF619A2, + 0xFF68F72, + 0xFF70276, + 0xFF772AD, + 0xFF7E017, + 0xFF84AB3, + 0xFF8B282, + 0xFF91784, + 0xFF979B8, + 0xFF9D91E, + 0xFFA35B7, + 0xFFA8F83, + 0xFFAE680, + 0xFFB3AB0, + 0xFFB8C12, + 0xFFBDAA6, + 0xFFC266C, + 0xFFC6F64, + 0xFFCB58E, + 0xFFCF8EA, + 0xFFD3978, + 0xFFD7738, + 0xFFDB229, + 0xFFDEA4C, + 0xFFE1FA1, + 0xFFE5227, + 0xFFE81DF, + 0xFFEAEC9, + 0xFFED8E4, + 0xFFF0030, + 0xFFF24AF, + 0xFFF465E, + 0xFFF653F, + 0xFFF8152, + 0xFFF9A96, + 0xFFFB10B, + 0xFFFC4B2, + 0xFFFD58A, + 0xFFFE393, + 0xFFFEECE, + 0xFFFF73A, + 0xFFFFCD7, + 0xFFFFFA6 +}; + +real_t sine_short_128[] = +{ + 0x1921F1, + 0x4B64DB, + 0x7DA4DD, + 0xAFE006, + 0xE21468, + 0x1144013, + 0x1466118, + 0x1787587, + 0x1AA7B73, + 0x1DC70ED, + 0x20E5409, + 0x24022DB, + 0x271DB77, + 0x2A37BF1, + 0x2D50261, + 0x3066CDE, + 0x337B97F, + 0x368E65F, + 0x399F198, + 0x3CAD945, + 0x3FB9B85, + 0x42C3675, + 0x45CA837, + 0x48CEEED, + 0x4BD08B8, + 0x4ECF3C0, + 0x51CAE2B, + 0x54C3622, + 0x57B89D0, + 0x5AAA761, + 0x5D98D06, + 0x60838EE, + 0x636A94E, + 0x664DC5B, + 0x692D04C, + 0x6C0835E, + 0x6EDF3CB, + 0x71B1FD5, + 0x74805BD, + 0x774A3C8, + 0x7A0F83E, + 0x7CD0168, + 0x7F8BD96, + 0x8242B16, + 0x84F483D, + 0x87A1361, + 0x8A48ADB, + 0x8CEAD08, + 0x8F87849, + 0x921EB01, + 0x94B0397, + 0x973C075, + 0x99C200A, + 0x9C420C6, + 0x9EBC120, + 0xA12FF8F, + 0xA39DA91, + 0xA6050A6, + 0xA866053, + 0xAAC0820, + 0xAD14699, + 0xAF61A4E, + 0xB1A81D5, + 0xB3E7BC6, + 0xB6206BE, + 0xB85215D, + 0xBA7CA4B, + 0xBCA002F, + 0xBEBC1BA, + 0xC0D0D9E, + 0xC2DE291, + 0xC4E3F51, + 0xC6E229D, + 0xC8D8B3C, + 0xCAC77F6, + 0xCCAE79B, + 0xCE8D8FF, + 0xD064AF9, + 0xD233C68, + 0xD3FAC2D, + 0xD5B9930, + 0xD77025E, + 0xD91E6A7, + 0xDAC4503, + 0xDC61C6D, + 0xDDF6BE6, + 0xDF83274, + 0xE106F23, + 0xE282104, + 0xE3F472C, + 0xE55E0B8, + 0xE6BECC8, + 0xE816A82, + 0xE965913, + 0xEAAB7AC, + 0xEBE8584, + 0xED1C1D8, + 0xEE46BE8, + 0xEF682FF, + 0xF080668, + 0xF18F577, + 0xF294F85, + 0xF3913F0, + 0xF48421D, + 0xF56D977, + 0xF64D96C, + 0xF724173, + 0xF7F1108, + 0xF8B47AC, + 0xF96E4E6, + 0xFA1E845, + 0xFAC515A, + 0xFB61FC0, + 0xFBF5316, + 0xFC7EB01, + 0xFCFE72C, + 0xFD74748, + 0xFDE0B0D, + 0xFE43237, + 0xFE9BC8B, + 0xFEEA9D0, + 0xFF2F9D8, + 0xFF6AC77, + 0xFF9C188, + 0xFFC38ED, + 0xFFE128F, + 0xFFF4E5A, + 0xFFFEC42 +}; + +real_t sine_short_120[] = +{ + 0x1ACEDD, + 0x506B6B, + 0x860472, + 0xBB9798, + 0xF12283, + 0x126A2DB, + 0x15C1646, + 0x1917A6C, + 0x1C6CCF6, + 0x1FC0B8D, + 0x23133DB, + 0x266438B, + 0x29B3849, + 0x2D00FC3, + 0x304C7A8, + 0x3395DA6, + 0x36DCF70, + 0x3A21AB9, + 0x3D63D36, + 0x40A349D, + 0x43DFEA6, + 0x471990D, + 0x4A5018D, + 0x4D835E6, + 0x50B33D8, + 0x53DF927, + 0x5708398, + 0x5A2D0F4, + 0x5D4DF07, + 0x606AB9E, + 0x638348A, + 0x669779E, + 0x69A72B2, + 0x6CB23A0, + 0x6FB8844, + 0x72B9E80, + 0x75B6437, + 0x78AD751, + 0x7B9F5B9, + 0x7E8BD5E, + 0x8172C33, + 0x845402D, + 0x872F749, + 0x8A04F85, + 0x8CD46E2, + 0x8F9DB69, + 0x9260B25, + 0x951D425, + 0x97D347F, + 0x9A82A4A, + 0x9D2B3A4, + 0x9FCCEB1, + 0xA267996, + 0xA4FB280, + 0xA7877A1, + 0xAA0C72E, + 0xAC89F62, + 0xAEFFE7F, + 0xB16E2CA, + 0xB3D4A8E, + 0xB63341D, + 0xB889DCC, + 0xBAD85F7, + 0xBD1EB00, + 0xBF5CB4E, + 0xC19254F, + 0xC3BF775, + 0xC5E4039, + 0xC7FFE1B, + 0xCA12F9F, + 0xCC1D351, + 0xCE1E7C2, + 0xD016B8A, + 0xD205D47, + 0xD3EBB9E, + 0xD5C8539, + 0xD79B8CB, + 0xD96550A, + 0xDB258B7, + 0xDCDC296, + 0xDE89173, + 0xE02C422, + 0xE1C597C, + 0xE355062, + 0xE4DA7BC, + 0xE655E78, + 0xE7C738C, + 0xE92E5F5, + 0xEA8B4B7, + 0xEBDDEDD, + 0xED26379, + 0xEE641A4, + 0xEF97881, + 0xF0C0736, + 0xF1DECF4, + 0xF2F28F2, + 0xF3FBA6E, + 0xF4FA0AE, + 0xF5EDAFF, + 0xF6D68B7, + 0xF7B4932, + 0xF887BD4, + 0xF950009, + 0xFA0D544, + 0xFABFB02, + 0xFB670C3, + 0xFC03614, + 0xFC94A86, + 0xFD1ADB3, + 0xFD95F3E, + 0xFE05ECF, + 0xFE6AC18, + 0xFEC46D2, + 0xFF12EC0, + 0xFF563A8, + 0xFF8E55C, + 0xFFBB3B6, + 0xFFDCE94, + 0xFFF35E0, + 0xFFFE98A +}; + +#ifdef LD_DEC +real_t sine_mid_512[] = +{ + 0x6487E, + 0x12D978, + 0x1F6A66, + 0x2BFB40, + 0x388BFF, + 0x451C9C, + 0x51AD0E, + 0x5E3D4D, + 0x6ACD52, + 0x775D16, + 0x83EC90, + 0x907BB8, + 0x9D0A87, + 0xA998F6, + 0xB626FC, + 0xC2B491, + 0xCF41AF, + 0xDBCE4C, + 0xE85A62, + 0xF4E5E9, + 0x10170D8, + 0x10DFB29, + 0x11A84D3, + 0x1270DCF, + 0x1339615, + 0x1401D9D, + 0x14CA460, + 0x1592A55, + 0x165AF76, + 0x17233BA, + 0x17EB71A, + 0x18B398D, + 0x197BB0D, + 0x1A43B91, + 0x1B0BB12, + 0x1BD3988, + 0x1C9B6EC, + 0x1D63335, + 0x1E2AE5C, + 0x1EF2859, + 0x1FBA125, + 0x20818B8, + 0x2148F0A, + 0x2210413, + 0x22D77CC, + 0x239EA2E, + 0x2465B30, + 0x252CACA, + 0x25F38F6, + 0x26BA5AB, + 0x27810E2, + 0x2847A93, + 0x290E2B6, + 0x29D4945, + 0x2A9AE36, + 0x2B61183, + 0x2C27324, + 0x2CED311, + 0x2DB3142, + 0x2E78DB1, + 0x2F3E855, + 0x3004126, + 0x30C981E, + 0x318ED34, + 0x3254061, + 0x331919E, + 0x33DE0E2, + 0x34A2E26, + 0x3567963, + 0x362C290, + 0x36F09A7, + 0x37B4EA0, + 0x3879173, + 0x393D218, + 0x3A01089, + 0x3AC4CBD, + 0x3B886AD, + 0x3C4BE51, + 0x3D0F3A3, + 0x3DD269A, + 0x3E9572E, + 0x3F58559, + 0x401B113, + 0x40DDA54, + 0x41A0115, + 0x426254E, + 0x43246F8, + 0x43E660B, + 0x44A8280, + 0x4569C50, + 0x462B372, + 0x46EC7E0, + 0x47AD992, + 0x486E881, + 0x492F4A5, + 0x49EFDF6, + 0x4AB046D, + 0x4B70804, + 0x4C308B2, + 0x4CF0670, + 0x4DB0136, + 0x4E6F8FE, + 0x4F2EDC0, + 0x4FEDF74, + 0x50ACE13, + 0x516B996, + 0x522A1F6, + 0x52E872B, + 0x53A692D, + 0x54647F6, + 0x552237D, + 0x55DFBBD, + 0x569D0AD, + 0x575A246, + 0x5817081, + 0x58D3B57, + 0x59902C0, + 0x5A4C6B5, + 0x5B0872F, + 0x5BC4426, + 0x5C7FD93, + 0x5D3B370, + 0x5DF65B5, + 0x5EB145A, + 0x5F6BF58, + 0x60266A9, + 0x60E0A45, + 0x619AA25, + 0x6254641, + 0x630DE93, + 0x63C7313, + 0x64803BB, + 0x6539083, + 0x65F1963, + 0x66A9E56, + 0x6761F53, + 0x6819C54, + 0x68D1551, + 0x6988A44, + 0x6A3FB25, + 0x6AF67EE, + 0x6BAD097, + 0x6C63519, + 0x6D1956E, + 0x6DCF18E, + 0x6E84972, + 0x6F39D13, + 0x6FEEC6B, + 0x70A3771, + 0x7157E20, + 0x720C071, + 0x72BFE5C, + 0x73737DA, + 0x7426CE5, + 0x74D9D75, + 0x758C985, + 0x763F10C, + 0x76F1404, + 0x77A3266, + 0x7854C2B, + 0x790614D, + 0x79B71C4, + 0x7A67D8A, + 0x7B18498, + 0x7BC86E7, + 0x7C78470, + 0x7D27D2D, + 0x7DD7116, + 0x7E86026, + 0x7F34A55, + 0x7FE2F9C, + 0x8090FF5, + 0x813EB5A, + 0x81EC1C2, + 0x8299329, + 0x8345F86, + 0x83F26D4, + 0x849E90C, + 0x854A626, + 0x85F5E1E, + 0x86A10EB, + 0x874BE87, + 0x87F66EC, + 0x88A0A13, + 0x894A7F5, + 0x89F408D, + 0x8A9D3D3, + 0x8B461C1, + 0x8BEEA51, + 0x8C96D7B, + 0x8D3EB3A, + 0x8DE6386, + 0x8E8D65B, + 0x8F343B0, + 0x8FDAB80, + 0x9080DC4, + 0x9126A76, + 0x91CC190, + 0x927130A, + 0x9315EDF, + 0x93BA509, + 0x945E580, + 0x950203F, + 0x95A5540, + 0x964847B, + 0x96EADEB, + 0x978D18A, + 0x982EF51, + 0x98D073A, + 0x997193F, + 0x9A12559, + 0x9AB2B83, + 0x9B52BB6, + 0x9BF25EC, + 0x9C91A1F, + 0x9D30849, + 0x9DCF063, + 0x9E6D267, + 0x9F0AE51, + 0x9FA8418, + 0xA0453B8, + 0xA0E1D29, + 0xA17E067, + 0xA219D6B, + 0xA2B5430, + 0xA3504AE, + 0xA3EAEE1, + 0xA4852C1, + 0xA51F04A, + 0xA5B8776, + 0xA65183E, + 0xA6EA29C, + 0xA78268B, + 0xA81A404, + 0xA8B1B03, + 0xA948B80, + 0xA9DF577, + 0xAA758E1, + 0xAB0B5B9, + 0xABA0BF9, + 0xAC35B9B, + 0xACCA499, + 0xAD5E6EE, + 0xADF2293, + 0xAE85784, + 0xAF185BB, + 0xAFAAD31, + 0xB03CDE2, + 0xB0CE7C7, + 0xB15FADB, + 0xB1F0719, + 0xB280C7A, + 0xB310AFA, + 0xB3A0292, + 0xB42F33E, + 0xB4BDCF7, + 0xB54BFB8, + 0xB5D9B7C, + 0xB66703D, + 0xB6F3DF6, + 0xB7804A2, + 0xB80C43A, + 0xB897CBA, + 0xB922E1C, + 0xB9AD85A, + 0xBA37B70, + 0xBAC1759, + 0xBB4AC0E, + 0xBBD398A, + 0xBC5BFC9, + 0xBCE3EC4, + 0xBD6B678, + 0xBDF26DE, + 0xBE78FF1, + 0xBEFF1AC, + 0xBF84C0B, + 0xC009F07, + 0xC08EA9C, + 0xC112EC4, + 0xC196B7B, + 0xC21A0BB, + 0xC29CE7F, + 0xC31F4C3, + 0xC3A1380, + 0xC422AB3, + 0xC4A3A57, + 0xC524265, + 0xC5A42DA, + 0xC623BB0, + 0xC6A2CE3, + 0xC72166D, + 0xC79F84A, + 0xC81D274, + 0xC89A4E8, + 0xC916FA0, + 0xC993297, + 0xCA0EDC8, + 0xCA8A130, + 0xCB04CC8, + 0xCB7F08D, + 0xCBF8C79, + 0xCC72088, + 0xCCEACB5, + 0xCD630FC, + 0xCDDAD58, + 0xCE521C4, + 0xCEC8E3C, + 0xCF3F2BB, + 0xCFB4F3C, + 0xD02A3BB, + 0xD09F034, + 0xD1134A2, + 0xD187101, + 0xD1FA54B, + 0xD26D17D, + 0xD2DF593, + 0xD351187, + 0xD3C2555, + 0xD4330FA, + 0xD4A3470, + 0xD512FB3, + 0xD5822C0, + 0xD5F0D91, + 0xD65F023, + 0xD6CCA71, + 0xD739C77, + 0xD7A6631, + 0xD81279A, + 0xD87E0AF, + 0xD8E916B, + 0xD9539CB, + 0xD9BD9C9, + 0xDA27163, + 0xDA90093, + 0xDAF8757, + 0xDB605A9, + 0xDBC7B86, + 0xDC2E8E9, + 0xDC94DD0, + 0xDCFAA36, + 0xDD5FE17, + 0xDDC496E, + 0xDE28C39, + 0xDE8C674, + 0xDEEF81A, + 0xDF52127, + 0xDFB4199, + 0xE01596B, + 0xE076899, + 0xE0D6F20, + 0xE136CFB, + 0xE196228, + 0xE1F4EA3, + 0xE253267, + 0xE2B0D72, + 0xE30DFBF, + 0xE36A94B, + 0xE3C6A13, + 0xE422213, + 0xE47D147, + 0xE4D77AC, + 0xE53153F, + 0xE58A9FB, + 0xE5E35DE, + 0xE63B8E4, + 0xE69330A, + 0xE6EA44C, + 0xE740CA7, + 0xE796C18, + 0xE7EC29B, + 0xE84102D, + 0xE8954CB, + 0xE8E9071, + 0xE93C31D, + 0xE98ECCA, + 0xE9E0D77, + 0xEA3251F, + 0xEA833C0, + 0xEAD3956, + 0xEB235DF, + 0xEB72956, + 0xEBC13BB, + 0xEC0F508, + 0xEC5CD3B, + 0xECA9C52, + 0xECF6249, + 0xED41F1D, + 0xED8D2CC, + 0xEDD7D52, + 0xEE21EAC, + 0xEE6B6D9, + 0xEEB45D4, + 0xEEFCB9B, + 0xEF4482C, + 0xEF8BB83, + 0xEFD259E, + 0xF01867A, + 0xF05DE14, + 0xF0A2C6A, + 0xF0E7179, + 0xF12AD3E, + 0xF16DFB8, + 0xF1B08E2, + 0xF1F28BB, + 0xF233F40, + 0xF274C6F, + 0xF2B5044, + 0xF2F4ABF, + 0xF333BDB, + 0xF372397, + 0xF3B01F0, + 0xF3ED6E5, + 0xF42A271, + 0xF466494, + 0xF4A1D4B, + 0xF4DCC94, + 0xF51726B, + 0xF550ED0, + 0xF58A1C0, + 0xF5C2B38, + 0xF5FAB37, + 0xF6321BA, + 0xF668EBF, + 0xF69F244, + 0xF6D4C47, + 0xF709CC6, + 0xF73E3BF, + 0xF77212F, + 0xF7A5516, + 0xF7D7F70, + 0xF80A03C, + 0xF83B778, + 0xF86C522, + 0xF89C939, + 0xF8CC3B9, + 0xF8FB4A2, + 0xF929BF2, + 0xF9579A7, + 0xF984DBE, + 0xF9B1837, + 0xF9DD910, + 0xFA09047, + 0xFA33DDA, + 0xFA5E1C7, + 0xFA87C0D, + 0xFAB0CAB, + 0xFAD939F, + 0xFB010E6, + 0xFB28481, + 0xFB4EE6D, + 0xFB74EA8, + 0xFB9A532, + 0xFBBF208, + 0xFBE352A, + 0xFC06E95, + 0xFC29E4A, + 0xFC4C445, + 0xFC6E087, + 0xFC8F30D, + 0xFCAFBD6, + 0xFCCFAE1, + 0xFCEF02E, + 0xFD0DBBA, + 0xFD2BD84, + 0xFD4958C, + 0xFD663D0, + 0xFD8284F, + 0xFD9E308, + 0xFDB93FA, + 0xFDD3B23, + 0xFDED884, + 0xFE06C1A, + 0xFE1F5E5, + 0xFE375E5, + 0xFE4EC17, + 0xFE6587B, + 0xFE7BB10, + 0xFE913D6, + 0xFEA62CB, + 0xFEBA7EF, + 0xFECE341, + 0xFEE14C0, + 0xFEF3C6C, + 0xFF05A43, + 0xFF16E45, + 0xFF27872, + 0xFF378C8, + 0xFF46F48, + 0xFF55BF0, + 0xFF63EC0, + 0xFF717B7, + 0xFF7E6D5, + 0xFF8AC1A, + 0xFF96785, + 0xFFA1915, + 0xFFAC0CA, + 0xFFB5EA3, + 0xFFBF2A1, + 0xFFC7CC3, + 0xFFCFD08, + 0xFFD7371, + 0xFFDDFFC, + 0xFFE42AA, + 0xFFE9B7B, + 0xFFEEA6E, + 0xFFF2F83, + 0xFFF6AB9, + 0xFFF9C12, + 0xFFFC38C, + 0xFFFE128, + 0xFFFF4E5, + 0xFFFFEC4 +}; + +real_t sine_mid_480[] = +{ + 0x6B3BA, + 0x141B2A, + 0x21828C, + 0x2EE9D6, + 0x3C50FF, + 0x49B7FE, + 0x571EC9, + 0x648558, + 0x71EB9F, + 0x7F5197, + 0x8CB735, + 0x9A1C71, + 0xA78140, + 0xB4E59A, + 0xC24975, + 0xCFACC7, + 0xDD0F88, + 0xEA71AD, + 0xF7D32E, + 0x1053401, + 0x112941D, + 0x11FF378, + 0x12D5209, + 0x13AAFC7, + 0x1480CA7, + 0x15568A2, + 0x162C3AD, + 0x1701DBE, + 0x17D76CE, + 0x18ACED1, + 0x19825C0, + 0x1A57B90, + 0x1B2D039, + 0x1C023B0, + 0x1CD75EC, + 0x1DAC6E5, + 0x1E81691, + 0x1F564E6, + 0x202B1DB, + 0x20FFD67, + 0x21D4780, + 0x22A901E, + 0x237D736, + 0x2451CBF, + 0x25260B1, + 0x25FA302, + 0x26CE3A8, + 0x27A229B, + 0x2875FD0, + 0x2949B3F, + 0x2A1D4DF, + 0x2AF0CA5, + 0x2BC4289, + 0x2C97682, + 0x2D6A886, + 0x2E3D88C, + 0x2F1068B, + 0x2FE3279, + 0x30B5C4E, + 0x3188400, + 0x325A985, + 0x332CCD5, + 0x33FEDE6, + 0x34D0CB0, + 0x35A2928, + 0x3674346, + 0x3745B01, + 0x381704E, + 0x38E8326, + 0x39B937F, + 0x3A8A150, + 0x3B5AC90, + 0x3C2B534, + 0x3CFBB36, + 0x3DCBE8A, + 0x3E9BF29, + 0x3F6BD08, + 0x403B81F, + 0x410B065, + 0x41DA5D1, + 0x42A9859, + 0x43787F4, + 0x444749A, + 0x4515E41, + 0x45E44E1, + 0x46B286F, + 0x47808E4, + 0x484E635, + 0x491C05B, + 0x49E974C, + 0x4AB6AFE, + 0x4B83B6A, + 0x4C50886, + 0x4D1D249, + 0x4DE98AA, + 0x4EB5B9F, + 0x4F81B22, + 0x504D727, + 0x5118FA6, + 0x51E4497, + 0x52AF5F0, + 0x537A3A9, + 0x5444DB8, + 0x550F415, + 0x55D96B7, + 0x56A3595, + 0x576D0A6, + 0x58367E1, + 0x58FFB3E, + 0x59C8AB3, + 0x5A91638, + 0x5B59DC4, + 0x5C2214E, + 0x5CEA0CE, + 0x5DB1C3A, + 0x5E7938A, + 0x5F406B5, + 0x60075B3, + 0x60CE07A, + 0x6194702, + 0x625A943, + 0x6320732, + 0x63E60C9, + 0x64AB5FE, + 0x65706C9, + 0x6635320, + 0x66F9AFC, + 0x67BDE53, + 0x6881D1E, + 0x6945752, + 0x6A08CE9, + 0x6ACBDD9, + 0x6B8EA1A, + 0x6C511A3, + 0x6D1346B, + 0x6DD526B, + 0x6E96B9A, + 0x6F57FEE, + 0x7018F60, + 0x70D99E8, + 0x7199F7C, + 0x725A014, + 0x7319BA9, + 0x73D9231, + 0x74983A4, + 0x7556FFA, + 0x761572A, + 0x76D392C, + 0x77915F7, + 0x784ED84, + 0x790BFCA, + 0x79C8CC1, + 0x7A85460, + 0x7B416A0, + 0x7BFD377, + 0x7CB8ADE, + 0x7D73CCC, + 0x7E2E93A, + 0x7EE901F, + 0x7FA3172, + 0x805CD2C, + 0x8116345, + 0x81CF3B4, + 0x8287E72, + 0x8340376, + 0x83F82B8, + 0x84AFC30, + 0x8566FD6, + 0x861DDA2, + 0x86D458C, + 0x878A78B, + 0x8840399, + 0x88F59AD, + 0x89AA9BF, + 0x8A5F3C7, + 0x8B137BD, + 0x8BC7599, + 0x8C7AD54, + 0x8D2DEE5, + 0x8DE0A45, + 0x8E92F6C, + 0x8F44E51, + 0x8FF66EE, + 0x90A793A, + 0x915852E, + 0x9208AC2, + 0x92B89ED, + 0x93682AA, + 0x94174EF, + 0x94C60B4, + 0x95745F4, + 0x96224A5, + 0x96CFCC0, + 0x977CE3D, + 0x9829916, + 0x98D5D42, + 0x9981AB9, + 0x9A2D175, + 0x9AD816D, + 0x9B82A9B, + 0x9C2CCF6, + 0x9CD6878, + 0x9D7FD18, + 0x9E28AD0, + 0x9ED1197, + 0x9F79168, + 0xA020A39, + 0xA0C7C05, + 0xA16E6C2, + 0xA214A6C, + 0xA2BA6F9, + 0xA35FC62, + 0xA404AA1, + 0xA4A91AF, + 0xA54D183, + 0xA5F0A17, + 0xA693B63, + 0xA736561, + 0xA7D880A, + 0xA87A355, + 0xA91B73D, + 0xA9BC3BA, + 0xAA5C8C4, + 0xAAFC656, + 0xAB9BC67, + 0xAC3AAF2, + 0xACD91EE, + 0xAD77156, + 0xAE14921, + 0xAEB194A, + 0xAF4E1C9, + 0xAFEA297, + 0xB085BAE, + 0xB120D07, + 0xB1BB69B, + 0xB255863, + 0xB2EF258, + 0xB388474, + 0xB420EB0, + 0xB4B9105, + 0xB550B6D, + 0xB5E7DE0, + 0xB67E859, + 0xB714AD1, + 0xB7AA541, + 0xB83F7A2, + 0xB8D41EF, + 0xB968420, + 0xB9FBE2E, + 0xBA8F015, + 0xBB219CC, + 0xBBB3B4E, + 0xBC45495, + 0xBCD6599, + 0xBD66E54, + 0xBDF6EC1, + 0xBE866D9, + 0xBF15695, + 0xBFA3DEF, + 0xC031CE1, + 0xC0BF365, + 0xC14C175, + 0xC1D870A, + 0xC26441E, + 0xC2EF8AB, + 0xC37A4AC, + 0xC404819, + 0xC48E2ED, + 0xC517522, + 0xC59FEB1, + 0xC627F96, + 0xC6AF7C9, + 0xC736745, + 0xC7BCE04, + 0xC842C00, + 0xC8C8134, + 0xC94CD98, + 0xC9D1128, + 0xCA54BDE, + 0xCAD7DB4, + 0xCB5A6A4, + 0xCBDC6A9, + 0xCC5DDBC, + 0xCCDEBD8, + 0xCD5F0F8, + 0xCDDED16, + 0xCE5E02C, + 0xCEDCA34, + 0xCF5AB29, + 0xCFD8306, + 0xD0551C5, + 0xD0D1761, + 0xD14D3D4, + 0xD1C8718, + 0xD243129, + 0xD2BD200, + 0xD336999, + 0xD3AF7EE, + 0xD427CFB, + 0xD49F8B8, + 0xD516B22, + 0xD58D434, + 0xD6033E7, + 0xD678A37, + 0xD6ED71E, + 0xD761A98, + 0xD7D54A0, + 0xD848530, + 0xD8BAC43, + 0xD92C9D4, + 0xD99DDDE, + 0xDA0E85D, + 0xDA7E94C, + 0xDAEE0A4, + 0xDB5CE62, + 0xDBCB281, + 0xDC38CFC, + 0xDCA5DCE, + 0xDD124F2, + 0xDD7E263, + 0xDDE961E, + 0xDE5401C, + 0xDEBE05A, + 0xDF276D2, + 0xDF90381, + 0xDFF8661, + 0xE05FF6E, + 0xE0C6EA3, + 0xE12D3FD, + 0xE192F75, + 0xE1F8109, + 0xE25C8B3, + 0xE2C066F, + 0xE323A39, + 0xE38640D, + 0xE3E83E5, + 0xE4499BE, + 0xE4AA594, + 0xE50A762, + 0xE569F23, + 0xE5C8CD5, + 0xE627072, + 0xE6849F7, + 0xE6E195F, + 0xE73DEA7, + 0xE7999CA, + 0xE7F4AC4, + 0xE84F191, + 0xE8A8E2E, + 0xE902096, + 0xE95A8C6, + 0xE9B26B9, + 0xEA09A6C, + 0xEA603DA, + 0xEAB6301, + 0xEB0B7DC, + 0xEB60268, + 0xEBB42A1, + 0xEC07883, + 0xEC5A40A, + 0xECAC533, + 0xECFDBFB, + 0xED4E85D, + 0xED9EA56, + 0xEDEE1E3, + 0xEE3CF01, + 0xEE8B1AB, + 0xEED89DE, + 0xEF25797, + 0xEF71AD3, + 0xEFBD38E, + 0xF0081C5, + 0xF052574, + 0xF09BE99, + 0xF0E4D30, + 0xF12D136, + 0xF174AA7, + 0xF1BB981, + 0xF201DC1, + 0xF247763, + 0xF28C664, + 0xF2D0AC2, + 0xF314479, + 0xF357386, + 0xF3997E7, + 0xF3DB198, + 0xF41C097, + 0xF45C4E1, + 0xF49BE72, + 0xF4DAD49, + 0xF519162, + 0xF556ABB, + 0xF593951, + 0xF5CFD22, + 0xF60B62A, + 0xF646467, + 0xF6807D6, + 0xF6BA076, + 0xF6F2E43, + 0xF72B13A, + 0xF76295B, + 0xF7996A1, + 0xF7CF90B, + 0xF805096, + 0xF839D40, + 0xF86DF06, + 0xF8A15E7, + 0xF8D41E0, + 0xF9062EF, + 0xF937911, + 0xF968445, + 0xF998488, + 0xF9C79D8, + 0xF9F6433, + 0xFA24398, + 0xFA51803, + 0xFA7E174, + 0xFAA9FE7, + 0xFAD535C, + 0xFAFFBD0, + 0xFB29942, + 0xFB52BAF, + 0xFB7B316, + 0xFBA2F75, + 0xFBCA0CA, + 0xFBF0714, + 0xFC16251, + 0xFC3B27F, + 0xFC5F79C, + 0xFC831A7, + 0xFCA609F, + 0xFCC8482, + 0xFCE9D4E, + 0xFD0AB03, + 0xFD2AD9D, + 0xFD4A51D, + 0xFD69180, + 0xFD872C6, + 0xFDA48ED, + 0xFDC13F4, + 0xFDDD3D9, + 0xFDF889B, + 0xFE13239, + 0xFE2D0B3, + 0xFE46406, + 0xFE5EC31, + 0xFE76934, + 0xFE8DB0E, + 0xFEA41BD, + 0xFEB9D41, + 0xFECED99, + 0xFEE32C3, + 0xFEF6CBE, + 0xFF09B8B, + 0xFF1BF28, + 0xFF2D794, + 0xFF3E4CE, + 0xFF4E6D7, + 0xFF5DDAC, + 0xFF6C94E, + 0xFF7A9BC, + 0xFF87EF4, + 0xFF948F7, + 0xFFA07C4, + 0xFFABB5B, + 0xFFB63BB, + 0xFFC00E3, + 0xFFC92D3, + 0xFFD198B, + 0xFFD950A, + 0xFFE0550, + 0xFFE6A5D, + 0xFFEC430, + 0xFFF12C9, + 0xFFF5629, + 0xFFF8E4E, + 0xFFFBB38, + 0xFFFDCE8, + 0xFFFF35D, + 0xFFFFE98 +}; + +real_t ld_mid_512[] = +{ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x1921F1, + 0x4B64DB, + 0x7DA4DD, + 0xAFE006, + 0xE21468, + 0x1144013, + 0x1466118, + 0x1787587, + 0x1AA7B73, + 0x1DC70ED, + 0x20E5409, + 0x24022DB, + 0x271DB77, + 0x2A37BF1, + 0x2D50261, + 0x3066CDE, + 0x337B97F, + 0x368E65F, + 0x399F198, + 0x3CAD945, + 0x3FB9B85, + 0x42C3675, + 0x45CA837, + 0x48CEEED, + 0x4BD08B8, + 0x4ECF3C0, + 0x51CAE2B, + 0x54C3622, + 0x57B89D0, + 0x5AAA761, + 0x5D98D06, + 0x60838EE, + 0x636A94E, + 0x664DC5B, + 0x692D04C, + 0x6C0835E, + 0x6EDF3CB, + 0x71B1FD5, + 0x74805BD, + 0x774A3C8, + 0x7A0F83E, + 0x7CD0168, + 0x7F8BD96, + 0x8242B16, + 0x84F483D, + 0x87A1361, + 0x8A48ADB, + 0x8CEAD08, + 0x8F87849, + 0x921EB01, + 0x94B0397, + 0x973C075, + 0x99C200A, + 0x9C420C6, + 0x9EBC120, + 0xA12FF8F, + 0xA39DA91, + 0xA6050A6, + 0xA866053, + 0xAAC0820, + 0xAD14699, + 0xAF61A4E, + 0xB1A81D5, + 0xB3E7BC6, + 0xB6206BE, + 0xB85215D, + 0xBA7CA4B, + 0xBCA002F, + 0xBEBC1BA, + 0xC0D0D9E, + 0xC2DE291, + 0xC4E3F51, + 0xC6E229D, + 0xC8D8B3C, + 0xCAC77F6, + 0xCCAE79B, + 0xCE8D8FF, + 0xD064AF9, + 0xD233C68, + 0xD3FAC2D, + 0xD5B9930, + 0xD77025E, + 0xD91E6A7, + 0xDAC4503, + 0xDC61C6D, + 0xDDF6BE6, + 0xDF83274, + 0xE106F23, + 0xE282104, + 0xE3F472C, + 0xE55E0B8, + 0xE6BECC8, + 0xE816A82, + 0xE965913, + 0xEAAB7AC, + 0xEBE8584, + 0xED1C1D8, + 0xEE46BE8, + 0xEF682FF, + 0xF080668, + 0xF18F577, + 0xF294F85, + 0xF3913F0, + 0xF48421D, + 0xF56D977, + 0xF64D96C, + 0xF724173, + 0xF7F1108, + 0xF8B47AC, + 0xF96E4E6, + 0xFA1E845, + 0xFAC515A, + 0xFB61FC0, + 0xFBF5316, + 0xFC7EB01, + 0xFCFE72C, + 0xFD74748, + 0xFDE0B0D, + 0xFE43237, + 0xFE9BC8B, + 0xFEEA9D0, + 0xFF2F9D8, + 0xFF6AC77, + 0xFF9C188, + 0xFFC38ED, + 0xFFE128F, + 0xFFF4E5A, + 0xFFFEC42, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000 +}; + +real_t ld_mid_480[] = +{ + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x1ACEDD, + 0x506B6B, + 0x860472, + 0xBB9798, + 0xF12283, + 0x126A2DB, + 0x15C1646, + 0x1917A6C, + 0x1C6CCF6, + 0x1FC0B8D, + 0x23133DB, + 0x266438B, + 0x29B3849, + 0x2D00FC3, + 0x304C7A8, + 0x3395DA6, + 0x36DCF70, + 0x3A21AB9, + 0x3D63D36, + 0x40A349D, + 0x43DFEA6, + 0x471990D, + 0x4A5018D, + 0x4D835E6, + 0x50B33D8, + 0x53DF927, + 0x5708398, + 0x5A2D0F4, + 0x5D4DF07, + 0x606AB9E, + 0x638348A, + 0x669779E, + 0x69A72B2, + 0x6CB23A0, + 0x6FB8844, + 0x72B9E80, + 0x75B6437, + 0x78AD751, + 0x7B9F5B9, + 0x7E8BD5E, + 0x8172C33, + 0x845402D, + 0x872F749, + 0x8A04F85, + 0x8CD46E2, + 0x8F9DB69, + 0x9260B25, + 0x951D425, + 0x97D347F, + 0x9A82A4A, + 0x9D2B3A4, + 0x9FCCEB1, + 0xA267996, + 0xA4FB280, + 0xA7877A1, + 0xAA0C72E, + 0xAC89F62, + 0xAEFFE7F, + 0xB16E2CA, + 0xB3D4A8E, + 0xB63341D, + 0xB889DCC, + 0xBAD85F7, + 0xBD1EB00, + 0xBF5CB4E, + 0xC19254F, + 0xC3BF775, + 0xC5E4039, + 0xC7FFE1B, + 0xCA12F9F, + 0xCC1D351, + 0xCE1E7C2, + 0xD016B8A, + 0xD205D47, + 0xD3EBB9E, + 0xD5C8539, + 0xD79B8CB, + 0xD96550A, + 0xDB258B7, + 0xDCDC296, + 0xDE89173, + 0xE02C422, + 0xE1C597C, + 0xE355062, + 0xE4DA7BC, + 0xE655E78, + 0xE7C738C, + 0xE92E5F5, + 0xEA8B4B7, + 0xEBDDEDD, + 0xED26379, + 0xEE641A4, + 0xEF97881, + 0xF0C0736, + 0xF1DECF4, + 0xF2F28F2, + 0xF3FBA6E, + 0xF4FA0AE, + 0xF5EDAFF, + 0xF6D68B7, + 0xF7B4932, + 0xF887BD4, + 0xF950009, + 0xFA0D544, + 0xFABFB02, + 0xFB670C3, + 0xFC03614, + 0xFC94A86, + 0xFD1ADB3, + 0xFD95F3E, + 0xFE05ECF, + 0xFE6AC18, + 0xFEC46D2, + 0xFF12EC0, + 0xFF563A8, + 0xFF8E55C, + 0xFFBB3B6, + 0xFFDCE94, + 0xFFF35E0, + 0xFFFE98A, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000, + 0x10000000 +}; +#endif + +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/libfaad/specrec.c b/src/libfaad/specrec.c index 7d97e2a76..dbb4416d2 100644 --- a/src/libfaad/specrec.c +++ b/src/libfaad/specrec.c @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: specrec.c,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: specrec.c,v 1.2 2002/12/16 19:01:14 miguelfreitas Exp $ **/ /* @@ -27,10 +27,13 @@ */ #include "common.h" +#include "structs.h" +#include <string.h> #include "specrec.h" #include "syntax.h" #include "data.h" +#include "iq_table.h" #define bit_set(A, B) ((A) & (1<<(B))) @@ -48,11 +51,12 @@ 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(ic_stream *ics, uint8_t fs_index, - uint8_t object_type, uint16_t frame_len) +uint8_t window_grouping_info(faacDecHandle 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: @@ -61,12 +65,15 @@ uint8_t window_grouping_info(ic_stream *ics, uint8_t fs_index, ics->num_window_groups = 1; ics->window_group_length[ics->num_window_groups-1] = 1; #ifdef LD_DEC - if (object_type == LD) + if (hDecoder->object_type == LD) { - ics->num_swb = num_swb_512_window[fs_index]; + 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 - ics->num_swb = num_swb_1024_window[fs_index]; + ics->num_swb = num_swb_1024_window[sf_index]; #ifdef LD_DEC } #endif @@ -74,24 +81,33 @@ uint8_t window_grouping_info(ic_stream *ics, uint8_t fs_index, /* preparation of sect_sfb_offset for long blocks */ /* also copy the last value! */ #ifdef LD_DEC - if (object_type == LD) + if (hDecoder->object_type == LD) { - for (i = 0; i < ics->num_swb; i++) + if (hDecoder->frameLength == 512) { - ics->sect_sfb_offset[0][i] = swb_offset_512_window[fs_index][i]; - ics->swb_offset[i] = swb_offset_512_window[fs_index][i]; + 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] = frame_len; - ics->swb_offset[ics->num_swb] = frame_len; + ics->sect_sfb_offset[0][ics->num_swb] = hDecoder->frameLength; + ics->swb_offset[ics->num_swb] = hDecoder->frameLength; } else { #endif for (i = 0; i < ics->num_swb; i++) { - ics->sect_sfb_offset[0][i] = swb_offset_1024_window[fs_index][i]; - ics->swb_offset[i] = swb_offset_1024_window[fs_index][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] = frame_len; - ics->swb_offset[ics->num_swb] = frame_len; + ics->sect_sfb_offset[0][ics->num_swb] = hDecoder->frameLength; + ics->swb_offset[ics->num_swb] = hDecoder->frameLength; #ifdef LD_DEC } #endif @@ -100,11 +116,11 @@ uint8_t window_grouping_info(ic_stream *ics, uint8_t fs_index, 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[fs_index]; + ics->num_swb = num_swb_128_window[sf_index]; for (i = 0; i < ics->num_swb; i++) - ics->swb_offset[i] = swb_offset_128_window[fs_index][i]; - ics->swb_offset[ics->num_swb] = frame_len/8; + ics->swb_offset[i] = swb_offset_128_window[sf_index][i]; + ics->swb_offset[ics->num_swb] = hDecoder->frameLength/8; for (i = 0; i < ics->num_windows-1; i++) { if (bit_set(ics->scale_factor_grouping, 6-i) == 0) @@ -127,10 +143,10 @@ uint8_t window_grouping_info(ic_stream *ics, uint8_t fs_index, { if (i+1 == ics->num_swb) { - width = (frame_len/8) - swb_offset_128_window[fs_index][i]; + width = (hDecoder->frameLength/8) - swb_offset_128_window[sf_index][i]; } else { - width = swb_offset_128_window[fs_index][i+1] - - swb_offset_128_window[fs_index][i]; + 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; @@ -166,7 +182,6 @@ uint8_t window_grouping_info(ic_stream *ics, uint8_t fs_index, */ void quant_to_spec(ic_stream *ics, real_t *spec_data, uint16_t frame_len) { - int8_t i; uint8_t g, sfb, win; uint16_t width, bin; real_t *start_inptr, *start_win_ptr, *win_ptr; @@ -175,17 +190,7 @@ void quant_to_spec(ic_stream *ics, real_t *spec_data, uint16_t frame_len) real_t *tmp_spec_ptr, *spec_ptr; tmp_spec_ptr = tmp_spec; - for (i = frame_len/16-1; i >= 0; --i) - { - *tmp_spec_ptr++ = 0; *tmp_spec_ptr++ = 0; - *tmp_spec_ptr++ = 0; *tmp_spec_ptr++ = 0; - *tmp_spec_ptr++ = 0; *tmp_spec_ptr++ = 0; - *tmp_spec_ptr++ = 0; *tmp_spec_ptr++ = 0; - *tmp_spec_ptr++ = 0; *tmp_spec_ptr++ = 0; - *tmp_spec_ptr++ = 0; *tmp_spec_ptr++ = 0; - *tmp_spec_ptr++ = 0; *tmp_spec_ptr++ = 0; - *tmp_spec_ptr++ = 0; *tmp_spec_ptr++ = 0; - } + memset(tmp_spec_ptr, 0, frame_len*sizeof(real_t)); spec_ptr = spec_data; tmp_spec_ptr = tmp_spec; @@ -212,10 +217,12 @@ void quant_to_spec(ic_stream *ics, real_t *spec_data, uint16_t frame_len) for (bin = 0; bin < width; bin += 4) { - *tmp_spec_ptr++ = *spec_ptr++; - *tmp_spec_ptr++ = *spec_ptr++; - *tmp_spec_ptr++ = *spec_ptr++; - *tmp_spec_ptr++ = *spec_ptr++; + tmp_spec_ptr[0] = spec_ptr[0]; + tmp_spec_ptr[1] = spec_ptr[1]; + tmp_spec_ptr[2] = spec_ptr[2]; + tmp_spec_ptr[3] = spec_ptr[3]; + tmp_spec_ptr += 4; + spec_ptr += 4; } win_ptr += win_inc; @@ -228,57 +235,42 @@ void quant_to_spec(ic_stream *ics, real_t *spec_data, uint16_t frame_len) spec_ptr = spec_data; tmp_spec_ptr = tmp_spec; - for (i = frame_len/16 - 1; i >= 0; --i) - { - *spec_ptr++ = *tmp_spec_ptr++; *spec_ptr++ = *tmp_spec_ptr++; - *spec_ptr++ = *tmp_spec_ptr++; *spec_ptr++ = *tmp_spec_ptr++; - *spec_ptr++ = *tmp_spec_ptr++; *spec_ptr++ = *tmp_spec_ptr++; - *spec_ptr++ = *tmp_spec_ptr++; *spec_ptr++ = *tmp_spec_ptr++; - *spec_ptr++ = *tmp_spec_ptr++; *spec_ptr++ = *tmp_spec_ptr++; - *spec_ptr++ = *tmp_spec_ptr++; *spec_ptr++ = *tmp_spec_ptr++; - *spec_ptr++ = *tmp_spec_ptr++; *spec_ptr++ = *tmp_spec_ptr++; - *spec_ptr++ = *tmp_spec_ptr++; *spec_ptr++ = *tmp_spec_ptr++; - } + memcpy(spec_ptr, tmp_spec_ptr, frame_len*sizeof(real_t)); } -void build_tables(real_t *iq_table, real_t *pow2_table) +#ifndef FIXED_POINT +void build_tables(real_t *pow2_table) { uint16_t i; - /* build pow(x, 4/3) table for inverse quantization */ - for(i = 0; i < IQ_TABLE_SIZE; i++) - { - iq_table[i] = (real_t)exp(log(i) * 4.0/3.0); - } - /* build pow(2, 0.25*x) table for scalefactors */ for(i = 0; i < POW_TABLE_SIZE; i++) { - pow2_table[i] = (real_t)exp(LN2 * 0.25 * (i-100)); + pow2_table[i] = REAL_CONST(pow(2.0, 0.25 * (i-100))); } } +#endif -static INLINE real_t iquant(int16_t q, real_t *iq_table) +static INLINE real_t iquant(int16_t q) { if (q > 0) { if (q < IQ_TABLE_SIZE) return iq_table[q]; else - return MUL(iq_table[q>>3], 16); + return iq_table[q>>3] * 16; } else if (q < 0) { q = -q; if (q < IQ_TABLE_SIZE) return -iq_table[q]; else - return -MUL(iq_table[q>>3], 16); + return -iq_table[q>>3] * 16; } else { - return 0.0f; + return 0; } } -void inverse_quantization(real_t *x_invquant, int16_t *x_quant, real_t *iq_table, - uint16_t frame_len) +void inverse_quantization(real_t *x_invquant, int16_t *x_quant, uint16_t frame_len) { int8_t i; int16_t *in_ptr = x_quant; @@ -286,31 +278,53 @@ void inverse_quantization(real_t *x_invquant, int16_t *x_quant, real_t *iq_table for(i = frame_len/8-1; i >= 0; --i) { - *out_ptr++ = iquant(*in_ptr++, iq_table); - *out_ptr++ = iquant(*in_ptr++, iq_table); - *out_ptr++ = iquant(*in_ptr++, iq_table); - *out_ptr++ = iquant(*in_ptr++, iq_table); - *out_ptr++ = iquant(*in_ptr++, iq_table); - *out_ptr++ = iquant(*in_ptr++, iq_table); - *out_ptr++ = iquant(*in_ptr++, iq_table); - *out_ptr++ = iquant(*in_ptr++, iq_table); + *out_ptr++ = iquant(*in_ptr++); + *out_ptr++ = iquant(*in_ptr++); + *out_ptr++ = iquant(*in_ptr++); + *out_ptr++ = iquant(*in_ptr++); + *out_ptr++ = iquant(*in_ptr++); + *out_ptr++ = iquant(*in_ptr++); + *out_ptr++ = iquant(*in_ptr++); + *out_ptr++ = iquant(*in_ptr++); } } +#ifndef FIXED_POINT static INLINE real_t get_scale_factor_gain(uint16_t scale_factor, real_t *pow2_table) { if (scale_factor < POW_TABLE_SIZE) return pow2_table[scale_factor]; else - return (real_t)exp(LN2 * 0.25 * (scale_factor - 100)); + return REAL_CONST(pow(2.0, 0.25 * (scale_factor - 100))); } +#else +static real_t pow2_table[] = +{ + COEF_CONST(0.59460355750136), + COEF_CONST(0.70710678118655), + COEF_CONST(0.84089641525371), + COEF_CONST(1.0), + COEF_CONST(1.18920711500272), + COEF_CONST(1.41421356237310), + COEF_CONST(1.68179283050743) +}; +#endif +#ifdef FIXED_POINT +void apply_scalefactors(ic_stream *ics, real_t *x_invquant, uint16_t frame_len) +#else void apply_scalefactors(ic_stream *ics, real_t *x_invquant, real_t *pow2_table, uint16_t frame_len) +#endif { uint8_t g, sfb; uint16_t top; - real_t *fp, scale; + real_t *fp; +#ifndef FIXED_POINT + real_t scale; +#else + int32_t exp, frac; +#endif uint8_t groups = 0; uint16_t nshort = frame_len/8; @@ -328,15 +342,44 @@ void apply_scalefactors(ic_stream *ics, real_t *x_invquant, real_t *pow2_table, { top = ics->sect_sfb_offset[g][sfb+1]; +#ifndef FIXED_POINT scale = get_scale_factor_gain(ics->scale_factors[g][sfb], pow2_table); +#else + exp = (ics->scale_factors[g][sfb] - 100) / 4; + frac = (ics->scale_factors[g][sfb] - 100) % 4; +#endif /* minimum size of a sf band is 4 and always a multiple of 4 */ - for ( ; k < top; k+=4) + for ( ; k < top; k += 4) { - *fp = MUL(*fp, scale); fp++; - *fp = MUL(*fp, scale); fp++; - *fp = MUL(*fp, scale); fp++; - *fp = MUL(*fp, scale); fp++; +#ifndef FIXED_POINT + fp[0] = MUL(fp[0],scale); + fp[1] = MUL(fp[1],scale); + fp[2] = MUL(fp[2],scale); + fp[3] = MUL(fp[3],scale); +#else + if (exp < 0) + { + fp[0] >>= -exp; + fp[1] >>= -exp; + fp[2] >>= -exp; + fp[3] >>= -exp; + } else { + fp[0] <<= exp; + fp[1] <<= exp; + fp[2] <<= exp; + fp[3] <<= exp; + } + + if (frac) + { + fp[0] = MUL_R_C(fp[0],pow2_table[frac + 3]); + fp[1] = MUL_R_C(fp[1],pow2_table[frac + 3]); + fp[2] = MUL_R_C(fp[2],pow2_table[frac + 3]); + fp[3] = MUL_R_C(fp[3],pow2_table[frac + 3]); + } +#endif + fp += 4; } } groups += ics->window_group_length[g]; diff --git a/src/libfaad/specrec.h b/src/libfaad/specrec.h index ffe229c40..882c13c4d 100644 --- a/src/libfaad/specrec.h +++ b/src/libfaad/specrec.h @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: specrec.h,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $ +** $Id: specrec.h,v 1.2 2002/12/16 19:01:16 miguelfreitas Exp $ **/ #ifndef __SPECREC_H__ @@ -28,21 +28,16 @@ extern "C" { #include "syntax.h" -/* !!!DON'T CHANGE IQ_TABLE_SIZE!!! */ -#define IQ_TABLE_SIZE 1026 - -#define POW_TABLE_SIZE 200 - - -uint8_t window_grouping_info(ic_stream *ics, uint8_t fs_index, - uint8_t object_type, uint16_t frame_len); +uint8_t window_grouping_info(faacDecHandle hDecoder, ic_stream *ics); void quant_to_spec(ic_stream *ics, real_t *spec_data, uint16_t frame_len); -void build_tables(real_t *iq_table, real_t *pow2_table); -void inverse_quantization(real_t *x_invquant, int16_t *x_quant, real_t *iq_table, - uint16_t frame_len); +void inverse_quantization(real_t *x_invquant, int16_t *x_quant, uint16_t frame_len); +#ifdef FIXED_POINT +void apply_scalefactors(ic_stream *ics, real_t *x_invquant, uint16_t frame_len); +#else +void build_tables(real_t *pow2_table); void apply_scalefactors(ic_stream *ics, real_t *x_invquant, real_t *pow2_table, uint16_t frame_len); - +#endif #ifdef __cplusplus } diff --git a/src/libfaad/ssr.c b/src/libfaad/ssr.c new file mode 100644 index 000000000..a4865a25d --- /dev/null +++ b/src/libfaad/ssr.c @@ -0,0 +1,169 @@ +/* +** FAAD - Freeware Advanced Audio Decoder +** Copyright (C) 2002 M. Bakker +** +** 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. +** +** $Id: ssr.c,v 1.1 2002/12/16 19:01:17 miguelfreitas 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]; + real_t output[1024]; + + memset(output, 0, 1024*sizeof(real_t)); + memset(time_tmp, 0, 2048*sizeof(real_t)); + + 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, 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, + 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 diff --git a/src/libfaad/ssr.h b/src/libfaad/ssr.h new file mode 100644 index 000000000..e562f2a1d --- /dev/null +++ b/src/libfaad/ssr.h @@ -0,0 +1,50 @@ +/* +** FAAD - Freeware Advanced Audio Decoder +** Copyright (C) 2002 M. Bakker +** +** 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. +** +** $Id: ssr.h,v 1.1 2002/12/16 19:01:29 miguelfreitas 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 diff --git a/src/libfaad/ssr_fb.c b/src/libfaad/ssr_fb.c new file mode 100644 index 000000000..8ad869d68 --- /dev/null +++ b/src/libfaad/ssr_fb.c @@ -0,0 +1,176 @@ +/* +** FAAD - Freeware Advanced Audio Decoder +** Copyright (C) 2002 M. Bakker +** +** 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. +** +** $Id: ssr_fb.c,v 1.1 2002/12/16 19:01:32 miguelfreitas 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*)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) 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*)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; + } + + free(transf_buf); +} + + +#endif diff --git a/src/libfaad/ssr_fb.h b/src/libfaad/ssr_fb.h new file mode 100644 index 000000000..55eebf130 --- /dev/null +++ b/src/libfaad/ssr_fb.h @@ -0,0 +1,44 @@ +/* +** FAAD - Freeware Advanced Audio Decoder +** Copyright (C) 2002 M. Bakker +** +** 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. +** +** $Id: ssr_fb.h,v 1.1 2002/12/16 19:01:38 miguelfreitas 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 diff --git a/src/libfaad/ssr_ipqf.c b/src/libfaad/ssr_ipqf.c new file mode 100644 index 000000000..78a50870b --- /dev/null +++ b/src/libfaad/ssr_ipqf.c @@ -0,0 +1,182 @@ +/* +** FAAD - Freeware Advanced Audio Decoder +** Copyright (C) 2002 M. Bakker +** +** 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. +** +** $Id: ssr_ipqf.c,v 1.1 2002/12/16 19:01:44 miguelfreitas 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 diff --git a/src/libfaad/ssr_ipqf.h b/src/libfaad/ssr_ipqf.h new file mode 100644 index 000000000..655db7ffe --- /dev/null +++ b/src/libfaad/ssr_ipqf.h @@ -0,0 +1,37 @@ +/* +** FAAD - Freeware Advanced Audio Decoder +** Copyright (C) 2002 M. Bakker +** +** 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. +** +** $Id: ssr_ipqf.h,v 1.1 2002/12/16 19:01:50 miguelfreitas 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 diff --git a/src/libfaad/ssr_win.h b/src/libfaad/ssr_win.h new file mode 100644 index 000000000..cb38d541f --- /dev/null +++ b/src/libfaad/ssr_win.h @@ -0,0 +1,626 @@ +/* +** FAAD - Freeware Advanced Audio Decoder +** Copyright (C) 2002 M. Bakker +** +** 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. +** +** $Id: ssr_win.h,v 1.1 2002/12/16 19:01:54 miguelfreitas 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 diff --git a/src/libfaad/structs.h b/src/libfaad/structs.h new file mode 100644 index 000000000..5a6e58d0a --- /dev/null +++ b/src/libfaad/structs.h @@ -0,0 +1,356 @@ +/* +** FAAD - Freeware Advanced Audio Decoder +** Copyright (C) 2002 M. Bakker +** +** 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. +** +** $Id: structs.h,v 1.1 2002/12/16 19:02:00 miguelfreitas Exp $ +**/ + +#ifndef __STRUCTS_H__ +#define __STRUCTS_H__ + +#ifdef __cplusplus +extern "C" { +#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 { + real_t r[2]; + real_t KOR[2]; + real_t VAR[2]; +} pred_state; + +typedef struct +{ + uint16_t n; + uint16_t ifac[15]; + complex_t *work; + complex_t *tab; +} cfft_info; + +typedef struct { + uint16_t N; + cfft_info *cfft; + complex_t *sincos; + complex_t *Z1; +} mdct_info; + +typedef struct +{ + real_t *long_window[2]; + real_t *short_window[2]; +#ifdef LD_DEC + real_t *ld_window[2]; +#endif + + mdct_info *mdct256; +#ifdef LD_DEC + mdct_info *mdct1024; +#endif + mdct_info *mdct2048; +} 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]; +} 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; +} 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; + + program_config pce; +} adif_header; + +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; + +typedef struct +{ + uint8_t limit; + uint8_t predictor_reset; + uint8_t predictor_reset_group_number; + uint8_t prediction_used[MAX_SFB]; +} pred_info; + +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]; + + 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]; + + uint8_t ms_mask_present; + uint8_t ms_used[MAX_WINDOW_GROUPS][MAX_SFB]; + + uint8_t noise_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; + pred_info pred; + ltp_info ltp; + ltp_info ltp2; +#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 ele_id; + + 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) */ + +typedef struct faacDecConfiguration +{ + uint8_t defObjectType; + uint32_t defSampleRate; + uint8_t outputFormat; +} faacDecConfiguration, *faacDecConfigurationPtr; + +typedef struct faacDecFrameInfo +{ + uint32_t bytesconsumed; + uint32_t samples; + uint8_t channels; + uint8_t error; +} faacDecFrameInfo; + +typedef struct +{ + uint8_t adts_header_present; + uint8_t adif_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; + + uint32_t frame; + + uint8_t fr_channels; + uint8_t fr_ch_ele; + + 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]; + +#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 + real_t *lt_pred_stat[MAX_CHANNELS]; +#endif + +#ifndef FIXED_POINT +#if POW_TABLE_SIZE + real_t *pow2_table; +#endif +#endif + + /* Configuration data */ + faacDecConfiguration config; +} faacDecStruct, *faacDecHandle; + + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/libfaad/syntax.c b/src/libfaad/syntax.c index d8aa34fef..27c68029b 100644 --- a/src/libfaad/syntax.c +++ b/src/libfaad/syntax.c @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: syntax.c,v 1.2 2002/08/09 22:36:36 miguelfreitas Exp $ +** $Id: syntax.c,v 1.3 2002/12/16 19:02:04 miguelfreitas Exp $ **/ /* @@ -27,9 +27,13 @@ an ADTS header)). */ -#include <stdlib.h> -#include <memory.h> #include "common.h" +#include "structs.h" + +#include <stdlib.h> +#include <string.h> + +#include "decoder.h" #include "syntax.h" #include "specrec.h" #include "huffman.h" @@ -37,20 +41,20 @@ #include "data.h" #include "pulse.h" #include "analysis.h" -#ifdef SBR -#include "sbr_syntax.h" -#endif +#include "drc.h" #ifdef ERROR_RESILIENCE -#include "rvlc_scale_factors.h" +#include "rvlc.h" #endif /* Table 4.4.1 */ int8_t GASpecificConfig(bitfile *ld, uint8_t *channelConfiguration, uint8_t object_type, +#ifdef ERROR_RESILIENCE uint8_t *aacSectionDataResilienceFlag, uint8_t *aacScalefactorDataResilienceFlag, uint8_t *aacSpectralDataResilienceFlag, +#endif uint8_t *frameLengthFlag) { uint8_t dependsOnCoreCoder, extensionFlag; @@ -79,6 +83,7 @@ int8_t GASpecificConfig(bitfile *ld, uint8_t *channelConfiguration, return -3; } +#ifdef ERROR_RESILIENCE if (extensionFlag == 1) { /* Error resilience not supported yet */ @@ -94,6 +99,7 @@ int8_t GASpecificConfig(bitfile *ld, uint8_t *channelConfiguration, /* 1 bit: extensionFlag3 */ } } +#endif return 0; } @@ -233,53 +239,304 @@ uint8_t program_config_element(program_config *pce, bitfile *ld) return 0; } -/* Table 4.4.4 and */ -/* Table 4.4.9 */ -uint8_t single_lfe_channel_element(element *sce, bitfile *ld, int16_t *spec_data, - uint8_t sf_index, uint8_t object_type, - uint16_t frame_len +element *decode_sce_lfe(faacDecHandle hDecoder, + faacDecFrameInfo *hInfo, bitfile *ld, + int16_t **spec_data, real_t **spec_coef, + uint8_t id_syn_ele) +{ + element *ele; + uint8_t channels = hDecoder->fr_channels; + + if (channels+1 >= MAX_CHANNELS) + { + hInfo->error = 12; + return NULL; + } + if (hDecoder->fr_ch_ele+1 >= MAX_SYNTAX_ELEMENTS) + { + hInfo->error = 13; + return NULL; + } + + spec_data[channels] = (int16_t*)malloc(hDecoder->frameLength*sizeof(int16_t)); + spec_coef[channels] = (real_t*)malloc(hDecoder->frameLength*sizeof(real_t)); + + ele = (element*)malloc(sizeof(element)); + memset(ele, 0, sizeof(element)); + ele->ele_id = id_syn_ele; + ele->channel = channels; + ele->paired_channel = -1; + + hInfo->error = single_lfe_channel_element(hDecoder, ele, + ld, spec_data[channels]); + + hDecoder->fr_channels++; + hDecoder->fr_ch_ele++; + + return ele; +} + +element *decode_cpe(faacDecHandle hDecoder, + faacDecFrameInfo *hInfo, bitfile *ld, + int16_t **spec_data, real_t **spec_coef, + uint8_t id_syn_ele) +{ + element *ele; + uint8_t channels = hDecoder->fr_channels; + + if (channels+2 >= MAX_CHANNELS) + { + hInfo->error = 12; + return NULL; + } + if (hDecoder->fr_ch_ele+1 >= MAX_SYNTAX_ELEMENTS) + { + hInfo->error = 13; + return NULL; + } + + spec_data[channels] = (int16_t*)malloc(hDecoder->frameLength*sizeof(int16_t)); + spec_data[channels+1] = (int16_t*)malloc(hDecoder->frameLength*sizeof(int16_t)); + spec_coef[channels] = (real_t*)malloc(hDecoder->frameLength*sizeof(real_t)); + spec_coef[channels+1] = (real_t*)malloc(hDecoder->frameLength*sizeof(real_t)); + + ele = (element*)malloc(sizeof(element)); + memset(ele, 0, sizeof(element)); + ele->ele_id = id_syn_ele; + ele->channel = channels; + ele->paired_channel = channels+1; + + hInfo->error = channel_pair_element(hDecoder, ele, + ld, spec_data[channels], spec_data[channels+1]); + + hDecoder->fr_channels += 2; + hDecoder->fr_ch_ele++; + + return ele; +} + +element **raw_data_block(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, + bitfile *ld, element **elements, + int16_t **spec_data, real_t **spec_coef, + program_config *pce, drc_info *drc) +{ + uint8_t id_syn_ele; + uint8_t ch_ele = 0; + + hDecoder->fr_channels = 0; + hDecoder->fr_ch_ele = 0; + #ifdef ERROR_RESILIENCE - ,uint8_t aacSectionDataResilienceFlag, - uint8_t aacScalefactorDataResilienceFlag, - uint8_t aacSpectralDataResilienceFlag + if (hDecoder->object_type < ER_OBJECT_START) + { +#endif + /* Table 4.4.3: raw_data_block() */ + while ((id_syn_ele = (uint8_t)faad_getbits(ld, LEN_SE_ID + DEBUGVAR(1,4,"faacDecDecode(): id_syn_ele"))) != ID_END) + { + switch (id_syn_ele) { + case ID_SCE: + case ID_LFE: + elements[ch_ele++] = decode_sce_lfe(hDecoder, + hInfo, ld, spec_data, spec_coef, id_syn_ele); + if (hInfo->error > 0) + return elements; + break; + case ID_CPE: + elements[ch_ele++] = decode_cpe(hDecoder, + hInfo, ld, spec_data, spec_coef, id_syn_ele); + if (hInfo->error > 0) + return elements; + break; + case ID_CCE: /* not implemented yet */ + hInfo->error = 6; + return elements; + case ID_DSE: + data_stream_element(ld); + break; + case ID_PCE: + if ((hInfo->error = program_config_element(pce, ld)) > 0) + return elements; + break; + case ID_FIL: + if ((hInfo->error = fill_element(ld, drc)) > 0) + return elements; + break; + } + } +#ifdef ERROR_RESILIENCE + } else { + /* Table 262: er_raw_data_block() */ + switch (hDecoder->channelConfiguration) + { + case 1: + elements[ch_ele++] = decode_sce_lfe(hDecoder, + hInfo, ld, spec_data, spec_coef, ID_SCE); + if (hInfo->error > 0) + return elements; + break; + case 2: + elements[ch_ele++] = decode_cpe(hDecoder, + hInfo, ld, spec_data, spec_coef, ID_CPE); + if (hInfo->error > 0) + return elements; + break; + case 3: + elements[ch_ele++] = decode_sce_lfe(hDecoder, + hInfo, ld, spec_data, spec_coef, ID_SCE); + elements[ch_ele++] = decode_cpe(hDecoder, + hInfo, ld, spec_data, spec_coef, ID_CPE); + if (hInfo->error > 0) + return elements; + break; + case 4: + elements[ch_ele++] = decode_sce_lfe(hDecoder, + hInfo, ld, spec_data, spec_coef, ID_SCE); + elements[ch_ele++] = decode_cpe(hDecoder, + hInfo, ld, spec_data, spec_coef, ID_CPE); + elements[ch_ele++] = decode_sce_lfe(hDecoder, + hInfo, ld, spec_data, spec_coef, ID_SCE); + if (hInfo->error > 0) + return elements; + break; + case 5: + elements[ch_ele++] = decode_sce_lfe(hDecoder, + hInfo, ld, spec_data, spec_coef, ID_SCE); + elements[ch_ele++] = decode_cpe(hDecoder, + hInfo, ld, spec_data, spec_coef, ID_CPE); + elements[ch_ele++] = decode_cpe(hDecoder, + hInfo, ld, spec_data, spec_coef, ID_CPE); + if (hInfo->error > 0) + return elements; + break; + case 6: + elements[ch_ele++] = decode_sce_lfe(hDecoder, + hInfo, ld, spec_data, spec_coef, ID_SCE); + elements[ch_ele++] = decode_cpe(hDecoder, + hInfo, ld, spec_data, spec_coef, ID_CPE); + elements[ch_ele++] = decode_cpe(hDecoder, + hInfo, ld, spec_data, spec_coef, ID_CPE); + elements[ch_ele++] = decode_sce_lfe(hDecoder, + hInfo, ld, spec_data, spec_coef, ID_LFE); + if (hInfo->error > 0) + return elements; + break; + case 7: + elements[ch_ele++] = decode_sce_lfe(hDecoder, + hInfo, ld, spec_data, spec_coef, ID_SCE); + elements[ch_ele++] = decode_cpe(hDecoder, + hInfo, ld, spec_data, spec_coef, ID_CPE); + elements[ch_ele++] = decode_cpe(hDecoder, + hInfo, ld, spec_data, spec_coef, ID_CPE); + elements[ch_ele++] = decode_cpe(hDecoder, + hInfo, ld, spec_data, spec_coef, ID_CPE); + elements[ch_ele++] = decode_sce_lfe(hDecoder, + hInfo, ld, spec_data, spec_coef, ID_LFE); + if (hInfo->error > 0) + return elements; + break; + default: + hInfo->error = 7; + return elements; + } +#if 0 + cnt = bits_to_decode() / 8; + while (cnt >= 1) + { + cnt -= extension_payload(cnt); + } #endif - ) + } +#endif + + return elements; +} + +#ifdef DRM +static uint8_t faad_check_CRC(bitfile *ld) { - ic_stream *ics = &(sce->ics1); + uint16_t len = faad_get_processed_bits(ld) - 8; + uint8_t CRC; + uint16_t r=255; /* Initialize to all ones */ + + /* CRC polynome used x^8 + x^4 + x^3 + x^2 +1 */ +#define GPOLY 0435 + faad_rewindbits(ld); + + CRC = ~faad_getbits(ld, 8 + DEBUGVAR(1,999,"faad_check_CRC(): CRC")); /* CRC is stored inverted */ + + for (; len>0; len--) + { + r = ( (r << 1) ^ (( ( faad_get1bit(ld + DEBUGVAR(1,998,"")) & 1) ^ ((r >> 7) & 1)) * GPOLY )) & 0xFF; + } + if (r != CRC) + { + return 8; + } else { + return 0; + } +} +#endif + +/* Table 4.4.4 and */ +/* Table 4.4.9 */ +static uint8_t single_lfe_channel_element(faacDecHandle hDecoder, + element *sce, bitfile *ld, + int16_t *spec_data) +{ + ic_stream *ics = &(sce->ics1); #ifdef DRM - if (object_type != DRM_ER_LC) + uint8_t result; + + if (hDecoder->object_type != DRM_ER_LC) #endif sce->element_instance_tag = (uint8_t)faad_getbits(ld, LEN_TAG DEBUGVAR(1,38,"single_lfe_channel_element(): element_instance_tag")); - return individual_channel_stream(sce, ld, ics, 0, spec_data, sf_index, - object_type, frame_len -#ifdef ERROR_RESILIENCE - ,aacSectionDataResilienceFlag, - aacScalefactorDataResilienceFlag, - aacSpectralDataResilienceFlag +#ifdef DRM + if (hDecoder->object_type == DRM_ER_LC) + { + individual_channel_stream(hDecoder, sce, ld, ics, 0, spec_data); + + if (ics->tns_data_present) + tns_data(ics, &(ics->tns), ld); + + if ((result = faad_check_CRC( ld )) > 0) + return result; + + /* error resilient spectral data decoding */ + if ((result = reordered_spectral_data(hDecoder, ics, ld, spec_data)) > 0) + return result; + + /* pulse coding reconstruction */ + if (ics->pulse_data_present) + { + if (ics->window_sequence != EIGHT_SHORT_SEQUENCE) + pulse_decode(ics, spec_data); + else + return 2; /* pulse coding not allowed for short blocks */ + } + return 0; + } else #endif - ); + + return individual_channel_stream(hDecoder, sce, ld, ics, 0, spec_data); } /* Table 4.4.5 */ -uint8_t channel_pair_element(element *cpe, bitfile *ld, int16_t *spec_data1, - int16_t *spec_data2, uint8_t sf_index, uint8_t object_type, - uint16_t frame_len -#ifdef ERROR_RESILIENCE - ,uint8_t aacSectionDataResilienceFlag, - uint8_t aacScalefactorDataResilienceFlag, - uint8_t aacSpectralDataResilienceFlag -#endif - ) +static uint8_t channel_pair_element(faacDecHandle hDecoder, element *cpe, + bitfile *ld, int16_t *spec_data1, + int16_t *spec_data2) { uint8_t result; ic_stream *ics1 = &(cpe->ics1); ic_stream *ics2 = &(cpe->ics2); #ifdef DRM - if (object_type != DRM_ER_LC) + if (hDecoder->object_type != DRM_ER_LC) #endif cpe->element_instance_tag = (uint8_t)faad_getbits(ld, LEN_TAG DEBUGVAR(1,39,"channel_pair_element(): element_instance_tag")); @@ -288,8 +545,7 @@ uint8_t channel_pair_element(element *cpe, bitfile *ld, int16_t *spec_data1, DEBUGVAR(1,40,"channel_pair_element(): common_window"))) & 1) { /* both channels have common ics information */ - if ((result = ics_info(ics1, ld, cpe->common_window, sf_index, - object_type, frame_len)) > 0) + if ((result = ics_info(hDecoder, ics1, ld, cpe->common_window)) > 0) return result; ics1->ms_mask_present = (uint8_t)faad_getbits(ld, 2 @@ -307,36 +563,90 @@ uint8_t channel_pair_element(element *cpe, bitfile *ld, int16_t *spec_data1, } } +#ifdef ERROR_RESILIENCE + if ((hDecoder->object_type >= ER_OBJECT_START) && (ics1->predictor_data_present)) + { + if ((ics1->ltp.data_present = faad_get1bit(ld + DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1) + { + ltp_data(hDecoder, ics1, &(ics1->ltp), ld); + } + } +#endif + memcpy(ics2, ics1, sizeof(ic_stream)); } else { ics1->ms_mask_present = 0; } - if ((result = individual_channel_stream(cpe, ld, ics1, 0, spec_data1, - sf_index, object_type, frame_len -#ifdef ERROR_RESILIENCE - ,aacSectionDataResilienceFlag, - aacScalefactorDataResilienceFlag, - aacSpectralDataResilienceFlag -#endif - )) > 0) + if ((result = individual_channel_stream(hDecoder, cpe, ld, ics1, + 0, spec_data1)) > 0) + { return result; - if ((result = individual_channel_stream(cpe, ld, ics2, 0, spec_data2, - sf_index, object_type, frame_len + } + #ifdef ERROR_RESILIENCE - ,aacSectionDataResilienceFlag, - aacScalefactorDataResilienceFlag, - aacSpectralDataResilienceFlag + if (cpe->common_window && (hDecoder->object_type >= ER_OBJECT_START) && + (ics1->predictor_data_present)) + { + if ((ics1->ltp2.data_present = faad_get1bit(ld + DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1) + { + ltp_data(hDecoder, ics1, &(ics1->ltp2), ld); + } + } #endif - )) > 0) + + if ((result = individual_channel_stream(hDecoder, cpe, ld, ics2, + 0, spec_data2)) > 0) + { return result; + } + +#ifdef DRM + if (hDecoder->object_type == DRM_ER_LC) + { + if (ics1->tns_data_present) + tns_data(ics1, &(ics1->tns), ld); + + if (ics1->tns_data_present) + tns_data(ics2, &(ics2->tns), ld); + + if ((result = faad_check_CRC( ld )) > 0) + { + printf("CRC wrong!\n"); + return result; + } + /* error resilient spectral data decoding */ + if ((result = reordered_spectral_data(hDecoder, ics1, ld, spec_data1)) > 0) + return result; + if ((result = reordered_spectral_data(hDecoder, ics2, ld, spec_data2)) > 0) + return result; + /* pulse coding reconstruction */ + if (ics1->pulse_data_present) + { + if (ics1->window_sequence != EIGHT_SHORT_SEQUENCE) + pulse_decode(ics1, spec_data1); + else + return 2; /* pulse coding not allowed for short blocks */ + } + if (ics2->pulse_data_present) + { + if (ics2->window_sequence != EIGHT_SHORT_SEQUENCE) + pulse_decode(ics2, spec_data2); + else + return 2; /* pulse coding not allowed for short blocks */ + } + return 0; + } else +#endif return 0; } /* Table 4.4.6 */ -static uint8_t ics_info(ic_stream *ics, bitfile *ld, uint8_t common_window, - uint8_t sf_index, uint8_t object_type, uint16_t frame_len) +static uint8_t ics_info(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld, + uint8_t common_window) { /* ics->ics_reserved_bit = */ faad_get1bit(ld DEBUGVAR(1,43,"ics_info(): ics_reserved_bit")); @@ -358,11 +668,11 @@ static uint8_t ics_info(ic_stream *ics, bitfile *ld, uint8_t common_window, if ((ics->predictor_data_present = faad_get1bit(ld DEBUGVAR(1,49,"ics_info(): predictor_data_present"))) & 1) { - if (object_type == MAIN) /* MPEG2 style AAC predictor */ + if (hDecoder->object_type == MAIN) /* MPEG2 style AAC predictor */ { uint8_t sfb; - ics->pred.limit = min(ics->max_sfb, pred_sfb_max[sf_index]); + ics->pred.limit = min(ics->max_sfb, pred_sfb_max[hDecoder->sf_index]); if ((ics->pred.predictor_reset = faad_get1bit(ld DEBUGVAR(1,53,"ics_info(): pred.predictor_reset"))) & 1) @@ -379,26 +689,39 @@ static uint8_t ics_info(ic_stream *ics, bitfile *ld, uint8_t common_window, } #ifdef LTP_DEC else { /* Long Term Prediction */ - if ((ics->ltp.data_present = faad_get1bit(ld - DEBUGVAR(1,50,"ics_info(): ltp.data_present"))) & 1) + if (hDecoder->object_type < ER_OBJECT_START) { - ltp_data(ics, &(ics->ltp), ld, object_type); + if ((ics->ltp.data_present = faad_get1bit(ld + DEBUGVAR(1,50,"ics_info(): ltp.data_present"))) & 1) + { + ltp_data(hDecoder, ics, &(ics->ltp), ld); + } + if (common_window) + { + if ((ics->ltp2.data_present = faad_get1bit(ld + DEBUGVAR(1,51,"ics_info(): ltp2.data_present"))) & 1) + { + ltp_data(hDecoder, ics, &(ics->ltp2), ld); + } + } } - if (common_window) +#ifdef ERROR_RESILIENCE + if (!common_window && (hDecoder->object_type >= ER_OBJECT_START)) { - if ((ics->ltp2.data_present = faad_get1bit(ld - DEBUGVAR(1,51,"ics_info(): ltp2.data_present"))) & 1) + if ((ics->ltp.data_present = faad_get1bit(ld + DEBUGVAR(1,50,"ics_info(): ltp.data_present"))) & 1) { - ltp_data(ics, &(ics->ltp2), ld, object_type); + ltp_data(hDecoder, ics, &(ics->ltp), ld); } } +#endif } #endif } } /* get the grouping information */ - return window_grouping_info(ics, sf_index, object_type, frame_len); + return window_grouping_info(hDecoder, ics); } /* Table 4.4.7 */ @@ -411,7 +734,8 @@ static void pulse_data(pulse_info *pul, bitfile *ld) pul->pulse_start_sfb = (uint8_t)faad_getbits(ld, 6 DEBUGVAR(1,57,"pulse_data(): pulse_start_sfb")); - for (i = 0; i < pul->number_pulse+1; i++) { + for (i = 0; i < pul->number_pulse+1; i++) + { pul->pulse_offset[i] = (uint8_t)faad_getbits(ld, 5 DEBUGVAR(1,58,"pulse_data(): pulse_offset")); pul->pulse_amp[i] = (uint8_t)faad_getbits(ld, 4 @@ -420,7 +744,7 @@ static void pulse_data(pulse_info *pul, bitfile *ld) } /* Table 4.4.10 */ -uint16_t data_stream_element(bitfile *ld) +static uint16_t data_stream_element(bitfile *ld) { uint8_t byte_aligned; uint16_t i, count; @@ -429,11 +753,11 @@ uint16_t data_stream_element(bitfile *ld) DEBUGVAR(1,60,"data_stream_element(): element_instance_tag")); byte_aligned = faad_get1bit(ld DEBUGVAR(1,61,"data_stream_element(): byte_aligned")); - count = faad_getbits(ld, 8 + count = (uint16_t)faad_getbits(ld, 8 DEBUGVAR(1,62,"data_stream_element(): count")); if (count == 255) { - count += faad_getbits(ld, 8 + count += (uint16_t)faad_getbits(ld, 8 DEBUGVAR(1,63,"data_stream_element(): extra count")); } if (byte_aligned) @@ -449,17 +773,9 @@ uint16_t data_stream_element(bitfile *ld) } /* Table 4.4.11 */ -uint8_t fill_element(bitfile *ld, drc_info *drc -#ifdef SBR - ,uint8_t next_ele_id -#endif - ) +static uint8_t fill_element(bitfile *ld, drc_info *drc) { uint16_t count; -#ifdef SBR - uint8_t bs_extension_type; - uint32_t btot; -#endif count = (uint16_t)faad_getbits(ld, 4 DEBUGVAR(1,65,"fill_element(): count")); @@ -469,135 +785,101 @@ uint8_t fill_element(bitfile *ld, drc_info *drc DEBUGVAR(1,66,"fill_element(): extra count")) - 1; } -#ifdef SBR - bs_extension_type = (uint8_t)faad_showbits(ld, 4); - - if (bs_extension_type == SBR_HDR || bs_extension_type == SBR_STD) + while (count > 0) { - uint16_t i; - uint16_t bytes, bits; - - /* flush the extension type and the fill nibble */ - faad_flushbits(ld, 8); - - btot = faad_get_processed_bits(ld); - - /* SBR bitstream reading function */ - sbr_bitstream(next_ele_id, bs_extension_type); - - btot = faad_get_processed_bits(ld) - btot; - - /* there might still be some fill bits left to read */ - bits = (8*(count-1) - btot) % 8; - bytes = ((8*(count-1) - btot) - bits) / 8; - - if (bits > 0) - faad_flushbits(ld, bits); - for (i = 0; i < bytes; i++) - { - faad_flushbits(ld, 8); - } - } else { -#endif - while (count > 0) - { - count -= extension_payload(ld, drc, count); - } -#ifdef SBR + count -= extension_payload(ld, drc, count); } -#endif return 0; } /* Table 4.4.12 */ +#ifdef SSR_DEC static void gain_control_data(bitfile *ld, ic_stream *ics) { uint8_t bd, wd, ad; - uint8_t adjust_num[4][8]; - uint8_t alevcode[4][8][8]; - uint8_t aloccode[4][8][8]; + ssr_info *ssr = &(ics->ssr); - uint8_t max_band = (uint8_t)faad_getbits(ld, 2 + ssr->max_band = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,1000,"gain_control_data(): max_band")); if (ics->window_sequence == ONLY_LONG_SEQUENCE) { - for (bd = 1; bd <= max_band; bd++) + for (bd = 1; bd <= ssr->max_band; bd++) { - for (wd=0; wd<1; wd++) + for (wd = 0; wd < 1; wd++) { - adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 + ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 DEBUGVAR(1,1001,"gain_control_data(): adjust_num")); - for (ad = 0; ad < adjust_num[bd][wd]; ad++) + for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++) { - alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 + ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,1002,"gain_control_data(): alevcode")); - aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 5 + ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 5 DEBUGVAR(1,1003,"gain_control_data(): aloccode")); } } } } else if (ics->window_sequence == LONG_START_SEQUENCE) { - for (bd = 1; bd <= max_band; bd++) + for (bd = 1; bd <= ssr->max_band; bd++) { for (wd = 0; wd < 2; wd++) { - adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 + ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 DEBUGVAR(1,1001,"gain_control_data(): adjust_num")); - for (ad = 0; ad < adjust_num[bd][wd]; ad++) + for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++) { - alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 + ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,1002,"gain_control_data(): alevcode")); if (wd == 0) { - aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 + ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,1003,"gain_control_data(): aloccode")); } else { - aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 2 + ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,1003,"gain_control_data(): aloccode")); } } } } } else if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) { - for (bd = 1; bd <= max_band; bd++) + for (bd = 1; bd <= ssr->max_band; bd++) { - for(wd=0; wd<8; wd++) + for (wd = 0; wd < 8; wd++) { - adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 + ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 DEBUGVAR(1,1001,"gain_control_data(): adjust_num")); - for (ad = 0; ad < adjust_num[bd][wd]; ad++) + for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++) { - alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 + ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,1002,"gain_control_data(): alevcode")); - aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 2 + ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,1003,"gain_control_data(): aloccode")); } } } } else if (ics->window_sequence == LONG_STOP_SEQUENCE) { - for (bd = 1; bd <= max_band; bd++) + for (bd = 1; bd <= ssr->max_band; bd++) { for (wd = 0; wd < 2; wd++) { - adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 + ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 DEBUGVAR(1,1001,"gain_control_data(): adjust_num")); - for (ad = 0; ad < adjust_num[bd][wd]; ad++) + for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++) { - alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 + ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,1002,"gain_control_data(): alevcode")); if (wd == 0) { - aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 + ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,1003,"gain_control_data(): aloccode")); } else { - aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 5 + ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 5 DEBUGVAR(1,1003,"gain_control_data(): aloccode")); } } @@ -605,18 +887,12 @@ static void gain_control_data(bitfile *ld, ic_stream *ics) } } } +#endif /* Table 4.4.24 */ -static uint8_t individual_channel_stream(element *ele, bitfile *ld, - ic_stream *ics, uint8_t scal_flag, - int16_t *spec_data, uint8_t sf_index, - uint8_t object_type, uint16_t frame_len -#ifdef ERROR_RESILIENCE - ,uint8_t aacSectionDataResilienceFlag, - uint8_t aacScalefactorDataResilienceFlag, - uint8_t aacSpectralDataResilienceFlag -#endif - ) +static uint8_t individual_channel_stream(faacDecHandle hDecoder, element *ele, + bitfile *ld, ic_stream *ics, uint8_t scal_flag, + int16_t *spec_data) { uint8_t result; @@ -625,20 +901,11 @@ static uint8_t individual_channel_stream(element *ele, bitfile *ld, if (!ele->common_window && !scal_flag) { - if ((result = ics_info(ics, ld, ele->common_window, sf_index, - object_type, frame_len)) > 0) + if ((result = ics_info(hDecoder, ics, ld, ele->common_window)) > 0) return result; } - section_data(ics, ld -#ifdef ERROR_RESILIENCE - ,aacSectionDataResilienceFlag -#endif - ); - if ((result = scale_factor_data(ics, ld -#ifdef ERROR_RESILIENCE - ,aacScalefactorDataResilienceFlag -#endif - )) > 0) + section_data(hDecoder, ics, ld); + if ((result = scale_factor_data(hDecoder, ics, ld)) > 0) return result; if (!scal_flag) @@ -660,7 +927,7 @@ static uint8_t individual_channel_stream(element *ele, bitfile *ld, DEBUGVAR(1,69,"individual_channel_stream(): tns_data_present"))) & 1) { #ifdef ERROR_RESILIENCE - if (object_type < ER_OBJECT_START) + if (hDecoder->object_type < ER_OBJECT_START) #endif tns_data(ics, &(ics->tns), ld); } @@ -669,17 +936,30 @@ static uint8_t individual_channel_stream(element *ele, bitfile *ld, if ((ics->gain_control_data_present = faad_get1bit(ld DEBUGVAR(1,70,"individual_channel_stream(): gain_control_data_present"))) & 1) { -#if 1 - return 1; +#ifdef SSR_DEC + if (hDecoder->object_type != SSR) + return 1; + else + gain_control_data(ld, ics); #else - gain_control_data(ld, ics); + return 1; #endif } } #ifdef ERROR_RESILIENCE - if (aacSpectralDataResilienceFlag) + if (hDecoder->aacSpectralDataResilienceFlag) { +#if 0 + if (hDecoder->channelConfiguration == 2) + { + if (ics->length_of_reordered_spectral_data > 6144) + ics->length_of_reordered_spectral_data = 6144; + } else { + if (ics->length_of_reordered_spectral_data > 12288) + ics->length_of_reordered_spectral_data = 12288; + } +#endif ics->length_of_reordered_spectral_data = (uint16_t)faad_getbits(ld, 14 DEBUGVAR(1,147,"individual_channel_stream(): length_of_reordered_spectral_data")); /* TODO: test for >6144/12288, see page 143 */ @@ -690,30 +970,34 @@ static uint8_t individual_channel_stream(element *ele, bitfile *ld, } /* RVLC spectral data is put here */ - if (aacScalefactorDataResilienceFlag) + if (hDecoder->aacScalefactorDataResilienceFlag) { if ((result = rvlc_decode_scale_factors(ics, ld)) > 0) return result; } - if (object_type >= ER_OBJECT_START) +#ifdef DRM + if (hDecoder->object_type == DRM_ER_LC) + return 0; +#endif + + if (hDecoder->object_type >= ER_OBJECT_START) { if (ics->tns_data_present) tns_data(ics, &(ics->tns), ld); } - if (aacSpectralDataResilienceFlag) + if (hDecoder->aacSpectralDataResilienceFlag) { /* error resilient spectral data decoding */ - if ((result = reordered_spectral_data(ics, ld, spec_data, frame_len, - aacSectionDataResilienceFlag)) > 0) + if ((result = reordered_spectral_data(hDecoder, ics, ld, spec_data)) > 0) { return result; } } else { #endif /* decode the spectral data */ - if ((result = spectral_data(ics, ld, spec_data, frame_len)) > 0) + if ((result = spectral_data(hDecoder, ics, ld, spec_data)) > 0) { return result; } @@ -734,11 +1018,7 @@ static uint8_t individual_channel_stream(element *ele, bitfile *ld, } /* Table 4.4.25 */ -static void section_data(ic_stream *ics, bitfile *ld -#ifdef ERROR_RESILIENCE - ,uint8_t aacSectionDataResilienceFlag -#endif - ) +static void section_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld) { uint8_t g; uint8_t sect_esc_val, sect_bits; @@ -749,20 +1029,28 @@ static void section_data(ic_stream *ics, bitfile *ld sect_bits = 5; sect_esc_val = (1<<sect_bits) - 1; +#if 0 + printf("\ntotal sfb %d\n", ics->max_sfb); + printf(" sect top cb\n"); +#endif + for (g = 0; g < ics->num_window_groups; g++) { - uint16_t k = 0; + uint8_t k = 0; uint8_t i = 0; while (k < ics->max_sfb) { +#ifdef ERROR_RESILIENCE + uint8_t vcb11 = 0; +#endif uint8_t sfb; uint8_t sect_len_incr; uint16_t sect_len = 0; uint8_t sect_cb_bits = 4; #ifdef ERROR_RESILIENCE - if (aacSectionDataResilienceFlag) + if (hDecoder->aacSectionDataResilienceFlag) sect_cb_bits = 5; #endif @@ -773,21 +1061,31 @@ static void section_data(ic_stream *ics, bitfile *ld ics->noise_used = 1; #ifdef ERROR_RESILIENCE - if (!aacSectionDataResilienceFlag || - (ics->sect_cb[g][i] < 11) || - (ics->sect_cb[g][i] > 11 && ics->sect_cb[g][i] < 16)) + if (hDecoder->aacSectionDataResilienceFlag) { -#endif - while ((sect_len_incr = (uint8_t)faad_getbits(ld, sect_bits - DEBUGVAR(1,72,"section_data(): sect_len_incr"))) == sect_esc_val) + if ((ics->sect_cb[g][i] == 11) || + ((ics->sect_cb[g][i] >= 16) && (ics->sect_cb[g][i] <= 32))) { - sect_len += sect_esc_val; + vcb11 = 1; } -#ifdef ERROR_RESILIENCE - } else { + } + if (vcb11) + { sect_len_incr = 1; + } else { +#endif + sect_len_incr = (uint8_t)faad_getbits(ld, sect_bits + DEBUGVAR(1,72,"section_data(): sect_len_incr")); +#ifdef ERROR_RESILIENCE } #endif + while ((sect_len_incr == sect_esc_val) /* && + (k+sect_len < ics->max_sfb)*/) + { + sect_len += sect_len_incr; + sect_len_incr = (uint8_t)faad_getbits(ld, sect_bits + DEBUGVAR(1,72,"section_data(): sect_len_incr")); + } sect_len += sect_len_incr; @@ -797,11 +1095,22 @@ static void section_data(ic_stream *ics, bitfile *ld for (sfb = k; sfb < k + sect_len; sfb++) ics->sfb_cb[g][sfb] = ics->sect_cb[g][i]; +#if 0 + printf(" %6d %6d %6d\n", + i, + ics->sect_end[g][i], + ics->sect_cb[g][i]); +#endif + k += sect_len; i++; } ics->num_sec[g] = i; } + +#if 0 + printf("\n"); +#endif } /* @@ -818,7 +1127,7 @@ static void section_data(ic_stream *ics, bitfile *ld static uint8_t decode_scale_factors(ic_stream *ics, bitfile *ld) { uint8_t g, sfb; - int8_t t; + int16_t t; int8_t noise_pcm_flag = 1; int16_t scale_factor = ics->global_gain; @@ -851,7 +1160,7 @@ static uint8_t decode_scale_factors(ic_stream *ics, bitfile *ld) if (noise_pcm_flag) { noise_pcm_flag = 0; - t = faad_getbits(ld, 9 + t = (int16_t)faad_getbits(ld, 9 DEBUGVAR(1,73,"scale_factor_data(): first noise")) - 256; } else { t = huffman_scale_factor(ld); @@ -885,14 +1194,10 @@ static uint8_t decode_scale_factors(ic_stream *ics, bitfile *ld) } /* Table 4.4.26 */ -static uint8_t scale_factor_data(ic_stream *ics, bitfile *ld -#ifdef ERROR_RESILIENCE - ,uint8_t aacScalefactorDataResilienceFlag -#endif - ) +static uint8_t scale_factor_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld) { #ifdef ERROR_RESILIENCE - if (!aacScalefactorDataResilienceFlag) + if (!hDecoder->aacScalefactorDataResilienceFlag) { #endif return decode_scale_factors(ics, ld); @@ -968,13 +1273,12 @@ static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld) The limit MAX_LTP_SFB is not defined in 14496-3, this is a bug in the document and will be corrected in one of the corrigenda. */ -static void ltp_data(ic_stream *ics, ltp_info *ltp, bitfile *ld, - uint8_t object_type) +static void ltp_data(faacDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld) { uint8_t sfb, w; #ifdef LD_DEC - if (object_type == LD) + if (hDecoder->object_type == LD) { ltp->lag_update = (uint8_t)faad_getbits(ld, 1 DEBUGVAR(1,142,"ltp_data(): lag_update")); @@ -1022,33 +1326,21 @@ static void ltp_data(ic_stream *ics, ltp_info *ltp, bitfile *ld, } #endif -/* defines whether a huffman codebook is unsigned or not */ -/* Table 4.6.2 */ -static uint8_t unsigned_cb[] = { 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, - /* codebook 16 to 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 -}; - /* Table 4.4.29 */ -static uint8_t spectral_data(ic_stream *ics, bitfile *ld, int16_t *spectral_data, - uint16_t frame_len) +static uint8_t spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld, + int16_t *spectral_data) { int8_t i; - uint8_t g, inc; + uint8_t g; int16_t *sp; uint16_t k, p = 0; uint8_t groups = 0; uint8_t sect_cb; uint8_t result; - uint16_t nshort = frame_len/8; + uint16_t nshort = hDecoder->frameLength/8; sp = spectral_data; - for (i = frame_len/16-1; i >= 0; --i) - { - *sp++ = 0; *sp++ = 0; *sp++ = 0; *sp++ = 0; - *sp++ = 0; *sp++ = 0; *sp++ = 0; *sp++ = 0; - *sp++ = 0; *sp++ = 0; *sp++ = 0; *sp++ = 0; - *sp++ = 0; *sp++ = 0; *sp++ = 0; *sp++ = 0; - } + memset(sp, 0, hDecoder->frameLength*sizeof(int16_t)); for(g = 0; g < ics->num_window_groups; g++) { @@ -1058,33 +1350,34 @@ static uint8_t spectral_data(ic_stream *ics, bitfile *ld, int16_t *spectral_data { sect_cb = ics->sect_cb[g][i]; - if ((sect_cb == ZERO_HCB) || - (sect_cb == NOISE_HCB) || - (sect_cb == INTENSITY_HCB) || - (sect_cb == INTENSITY_HCB2)) + switch (sect_cb) { + case ZERO_HCB: + case NOISE_HCB: + case INTENSITY_HCB: + case INTENSITY_HCB2: p += (ics->sect_sfb_offset[g][ics->sect_end[g][i]] - ics->sect_sfb_offset[g][ics->sect_start[g][i]]); - } else { + break; + default: for (k = ics->sect_sfb_offset[g][ics->sect_start[g][i]]; - k < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; ) + k < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; k += 4) { sp = spectral_data + p; - inc = (sect_cb < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN; - - if ((result = huffman_spectral_data(sect_cb, ld, sp)) > 0) - return result; - if (unsigned_cb[sect_cb]) - huffman_sign_bits(ld, sp, inc); - k += inc; - p += inc; - if ((sect_cb == ESC_HCB) || (sect_cb >= 16)) + if (sect_cb < FIRST_PAIR_HCB) { - sp[0] = huffman_getescape(ld, sp[0]); - sp[1] = huffman_getescape(ld, sp[1]); + if ((result = huffman_spectral_data(sect_cb, ld, sp)) > 0) + return result; + } else { + if ((result = huffman_spectral_data(sect_cb, ld, sp)) > 0) + return result; + if ((result = huffman_spectral_data(sect_cb, ld, sp+2)) > 0) + return result; } + p += 4; } + break; } } groups += ics->window_group_length[g]; @@ -1097,7 +1390,7 @@ static uint8_t spectral_data(ic_stream *ics, bitfile *ld, int16_t *spectral_data static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count) { uint16_t i, n; - uint8_t extension_type = faad_getbits(ld, 4 + uint8_t extension_type = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,87,"extension_payload(): extension_type")); switch (extension_type) @@ -1155,7 +1448,7 @@ static uint8_t dynamic_range_info(bitfile *ld, drc_info *drc) if (faad_get1bit(ld DEBUGVAR(1,94,"dynamic_range_info(): has bands data")) & 1) { - band_incr = faad_getbits(ld, 4 + band_incr = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,95,"dynamic_range_info(): band_incr")); /* drc->drc_bands_reserved_bits = */ faad_getbits(ld, 4 DEBUGVAR(1,96,"dynamic_range_info(): drc_bands_reserved_bits")); diff --git a/src/libfaad/syntax.h b/src/libfaad/syntax.h index 22ae96613..cb62b0ed1 100644 --- a/src/libfaad/syntax.h +++ b/src/libfaad/syntax.h @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: syntax.h,v 1.3 2002/08/09 22:36:36 miguelfreitas Exp $ +** $Id: syntax.h,v 1.4 2002/12/16 19:02:08 miguelfreitas Exp $ **/ #ifndef __SYNTAX_H__ @@ -26,16 +26,18 @@ extern "C" { #endif +#include "decoder.h" +#include "drc.h" #include "bits.h" -#define MAIN 0 -#define LC 1 -#define SSR 2 -#define LTP 3 -#define LD 23 -#define ER_LC 17 -#define ER_LTP 19 -#define DRM_ER_LC 27 /* special object type for DRM */ +#define MAIN 0 +#define LC 1 +#define SSR 2 +#define LTP 3 +#define LD 23 +#define ER_LC 17 +#define ER_LTP 19 +#define DRM_ER_LC 27 /* special object type for DRM */ /* First object type that has ER */ @@ -60,14 +62,6 @@ extern "C" { #define ID_FIL 0x6 #define ID_END 0x7 -#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 - - #define ONLY_LONG_SEQUENCE 0x0 #define LONG_START_SEQUENCE 0x1 #define EIGHT_SHORT_SEQUENCE 0x2 @@ -84,274 +78,47 @@ extern "C" { #define INTENSITY_HCB 15 -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]; -} 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; -} 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; - - program_config pce; -} adif_header; - -typedef struct -{ - uint8_t last_band; - uint8_t data_present; - uint16_t lag; - uint8_t lag_update; - uint8_t coef; - uint8_t long_used[51]; - uint8_t short_used[8]; - uint8_t short_lag_present[8]; - uint8_t short_lag[8]; -} ltp_info; - -typedef struct -{ - uint8_t limit; - uint8_t predictor_reset; - uint8_t predictor_reset_group_number; - uint8_t prediction_used[41]; -} pred_info; - -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; - -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 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]; - - 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; - uint16_t scale_factors[8][51]; - - uint8_t ms_mask_present; - uint8_t ms_used[MAX_WINDOW_GROUPS][MAX_SFB]; - - uint8_t noise_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; - pred_info pred; - ltp_info ltp; - ltp_info ltp2; - -#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 ele_id; - - uint8_t channel; - uint8_t paired_channel; - - uint8_t element_instance_tag; - uint8_t common_window; - - ic_stream ics1; - ic_stream ics2; -} element; /* syntax element (SCE, CPE, LFE) */ - - int8_t GASpecificConfig(bitfile *ld, uint8_t *channelConfiguration, uint8_t object_type, +#ifdef ERROR_RESILIENCE uint8_t *aacSectionDataResilienceFlag, uint8_t *aacScalefactorDataResilienceFlag, uint8_t *aacSpectralDataResilienceFlag, - uint8_t *frameLengthFlag); -uint8_t single_lfe_channel_element(element *sce, bitfile *ld, int16_t *spec_data, - uint8_t sf_index, uint8_t object_type, - uint16_t frame_len -#ifdef ERROR_RESILIENCE - ,uint8_t aacSectionDataResilienceFlag, - uint8_t aacScalefactorDataResilienceFlag, - uint8_t aacSpectralDataResilienceFlag #endif - ); -uint8_t channel_pair_element(element *cpe, bitfile *ld, int16_t *spec_data1, - int16_t *spec_data2, uint8_t sf_index, uint8_t object_type, - uint16_t frame_len -#ifdef ERROR_RESILIENCE - ,uint8_t aacSectionDataResilienceFlag, - uint8_t aacScalefactorDataResilienceFlag, - uint8_t aacSpectralDataResilienceFlag -#endif - ); -uint16_t data_stream_element(bitfile *ld); -uint8_t program_config_element(program_config *pce, bitfile *ld); -uint8_t fill_element(bitfile *ld, drc_info *drc -#ifdef SBR - ,uint8_t next_ele_id -#endif - ); + uint8_t *frameLengthFlag); + uint8_t adts_frame(adts_header *adts, bitfile *ld); void get_adif_header(adif_header *adif, bitfile *ld); /* static functions */ -static uint8_t individual_channel_stream(element *ele, bitfile *ld, - ic_stream *ics, uint8_t scal_flag, - int16_t *spec_data, uint8_t sf_index, - uint8_t object_type, uint16_t frame_len -#ifdef ERROR_RESILIENCE - ,uint8_t aacSectionDataResilienceFlag, - uint8_t aacScalefactorDataResilienceFlag, - uint8_t aacSpectralDataResilienceFlag -#endif - ); -static uint8_t ics_info(ic_stream *ics, bitfile *ld, uint8_t common_window, - uint8_t fs_index, uint8_t object_type, - uint16_t frame_len); -static void section_data(ic_stream *ics, bitfile *ld -#ifdef ERROR_RESILIENCE - ,uint8_t aacSectionDataResilienceFlag -#endif - ); -static uint8_t scale_factor_data(ic_stream *ics, bitfile *ld -#ifdef ERROR_RESILIENCE - ,uint8_t aacScalefactorDataResilienceFlag -#endif - ); +static uint8_t single_lfe_channel_element(faacDecHandle hDecoder, + element *sce, bitfile *ld, + int16_t *spec_data); +static uint8_t channel_pair_element(faacDecHandle hDecoder, element *cpe, + bitfile *ld, int16_t *spec_data1, + int16_t *spec_data2); +static uint16_t data_stream_element(bitfile *ld); +static uint8_t program_config_element(program_config *pce, bitfile *ld); +static uint8_t fill_element(bitfile *ld, drc_info *drc); +static uint8_t individual_channel_stream(faacDecHandle hDecoder, element *ele, + bitfile *ld, ic_stream *ics, uint8_t scal_flag, + int16_t *spec_data); +static uint8_t ics_info(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld, + uint8_t common_window); +static void section_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld); +static uint8_t scale_factor_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld); static void gain_control_data(bitfile *ld, ic_stream *ics); -static uint8_t spectral_data(ic_stream *ics, bitfile *ld, int16_t *spectral_data, - uint16_t frame_len); +static uint8_t spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld, + int16_t *spectral_data); static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count); #ifdef ERROR_RESILIENCE -uint8_t reordered_spectral_data(ic_stream *ics, bitfile *ld, int16_t *spectral_data, - uint16_t frame_len, uint8_t aacSectionDataResilienceFlag); +uint8_t reordered_spectral_data(faacDecHandle hDecoder, ic_stream *ics, + bitfile *ld, int16_t *spectral_data); #endif static void pulse_data(pulse_info *pul, bitfile *ld); static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld); -static void ltp_data(ic_stream *ics, ltp_info *ltp, bitfile *ld, - uint8_t object_type); +static void ltp_data(faacDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld); static uint8_t adts_fixed_header(adts_header *adts, bitfile *ld); static void adts_variable_header(adts_header *adts, bitfile *ld); static void adts_error_check(adts_header *adts, bitfile *ld); diff --git a/src/libfaad/tns.c b/src/libfaad/tns.c index a26ef4fab..d06fb5774 100644 --- a/src/libfaad/tns.c +++ b/src/libfaad/tns.c @@ -16,14 +16,79 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: tns.c,v 1.1 2002/07/14 23:43:02 miguelfreitas Exp $ +** $Id: tns.c,v 1.2 2002/12/16 19:02:10 miguelfreitas Exp $ **/ #include "common.h" +#include "structs.h" #include "syntax.h" #include "tns.h" +#ifdef FIXED_POINT +static real_t tns_coef_0_3[] = +{ + 0x0, 0x6F13013, 0xC8261BA, 0xF994E02, + 0xF03E3A3A, 0xF224C28C, 0xF5B72457, 0xFA8715E3, + 0xF90ECFED, 0xF37D9E46, 0xF066B1FE, 0xF066B1FE, + 0xF03E3A3A, 0xF224C28C, 0xF5B72457, 0xFA8715E3 +}; +static real_t tns_coef_0_4[] = +{ + 0x0, 0x3539B35, 0x681FE48, 0x9679182, + 0xBE3EBD4, 0xDDB3D74, 0xF378709, 0xFE98FCA, + 0xF011790B, 0xF09C5CB7, 0xF1AD6942, 0xF33B524A, + 0xF5388AEB, 0xF793BBDF, 0xFA385AA9, 0xFD0F5CAB +}; +static real_t tns_coef_1_3[] = +{ + 0x0, 0x6F13013, 0xF5B72457, 0xFA8715E3, + 0xF994E02, 0xC8261BA, 0xF5B72457, 0xFA8715E3, + 0xF90ECFED, 0xF37D9E46, 0xF5B72457, 0xFA8715E3, + 0xF37D9E46, 0xF90ECFED, 0xF5B72457, 0xFA8715E3 +}; +static real_t tns_coef_1_4[] = +{ + 0x0, 0x3539B35, 0x681FE48, 0x9679182, + 0xF5388AEB, 0xF793BBDF, 0xFA385AA9, 0xFD0F5CAB, + 0xFE98FCA, 0xF378709, 0xDDB3D74, 0xBE3EBD4, + 0xF5388AEB, 0xF793BBDF, 0xFA385AA9, 0xFD0F5CAB +}; +#else +#ifdef _MSC_VER +#pragma warning(disable:4305) +#pragma warning(disable:4244) +#endif +static real_t tns_coef_0_3[] = +{ + 0.0, 0.4338837391, 0.7818314825, 0.9749279122, + -0.9848077530, -0.8660254038, -0.6427876097, -0.3420201433, + -0.4338837391, -0.7818314825, -0.9749279122, -0.9749279122, + -0.9848077530, -0.8660254038, -0.6427876097, -0.3420201433 +}; +static real_t tns_coef_0_4[] = +{ + 0.0, 0.2079116908, 0.4067366431, 0.5877852523, + 0.7431448255, 0.8660254038, 0.9510565163, 0.9945218954, + -0.9957341763, -0.9618256432, -0.8951632914, -0.7980172273, + -0.6736956436, -0.5264321629, -0.3612416662, -0.1837495178 +}; +static real_t tns_coef_1_3[] = +{ + 0.0, 0.4338837391, -0.6427876097, -0.3420201433, + 0.9749279122, 0.7818314825, -0.6427876097, -0.3420201433, + -0.4338837391, -0.7818314825, -0.6427876097, -0.3420201433, + -0.7818314825, -0.4338837391, -0.6427876097, -0.3420201433 +}; +static real_t tns_coef_1_4[] = +{ + 0.0, 0.2079116908, 0.4067366431, 0.5877852523, + -0.6736956436, -0.5264321629, -0.3612416662, -0.1837495178, + 0.9945218954, 0.9510565163, 0.8660254038, 0.7431448255, + -0.6736956436, -0.5264321629, -0.3612416662, -0.1837495178 +}; +#endif + /* TNS decoding for one channel and frame */ void tns_decode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index, @@ -55,9 +120,11 @@ void tns_decode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index, tns->coef_compress[w][f], tns->coef[w][f], lpc); start = ics->swb_offset[min(bottom, - min(tns_max_bands(ics, sr_index, object_type), ics->max_sfb))]; + min(tns_max_bands(ics, sr_index, object_type, frame_len), + ics->max_sfb))]; end = ics->swb_offset[min(top, - min(tns_max_bands(ics, sr_index, object_type), ics->max_sfb))]; + min(tns_max_bands(ics, sr_index, object_type, frame_len), + ics->max_sfb))]; if ((size = end - start) <= 0) continue; @@ -105,9 +172,11 @@ void tns_encode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index, tns->coef_compress[w][f], tns->coef[w][f], lpc); start = ics->swb_offset[min(bottom, - min(tns_max_bands(ics, sr_index, object_type), ics->max_sfb))]; + min(tns_max_bands(ics, sr_index, object_type, frame_len), + ics->max_sfb))]; end = ics->swb_offset[min(top, - min(tns_max_bands(ics, sr_index, object_type), ics->max_sfb))]; + min(tns_max_bands(ics, sr_index, object_type, frame_len), + ics->max_sfb))]; if ((size = end - start) <= 0) continue; @@ -130,39 +199,35 @@ static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_c uint8_t *coef, real_t *a) { uint8_t i, m; - uint8_t coef_res2, s_mask, n_mask; real_t tmp2[TNS_MAX_ORDER+1], b[TNS_MAX_ORDER+1]; - real_t iqfac; - - /* Some internal tables */ - static uint8_t sgn_mask[] = { 0x2, 0x4, 0x8 }; - static uint8_t neg_mask[] = { ~0x3, ~0x7, ~0xf }; - - /* size used for transmission */ - coef_res2 = coef_res_bits - coef_compress; - s_mask = sgn_mask[coef_res2 - 2]; /* mask for sign bit */ - n_mask = neg_mask[coef_res2 - 2]; /* mask for padding neg. values */ /* Conversion to signed integer */ for (i = 0; i < order; i++) { - int8_t tmp = (coef[i] & s_mask) ? (coef[i] | n_mask) : coef[i]; - - /* Inverse quantization */ - if (tmp >= 0) - iqfac = ((1 << (coef_res_bits-1)) - 0.5f) / M_PI_2; - else - iqfac = ((1 << (coef_res_bits-1)) + 0.5f) / M_PI_2; - - tmp2[i] = (real_t)sin(tmp / iqfac); + 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] = 1; + 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(tmp2[m-1], a[m-i]); + b[i] = a[i] + MUL_C_C(tmp2[m-1], a[m-i]); for (i = 1; i < m; i++) /* loop only while i<m */ a[i] = b[i]; @@ -195,7 +260,7 @@ static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *l y = *spectrum; for (j = 0; j < order; j++) - y -= MUL(lpc[j+1], state[j]); + y -= MUL_R_C(state[j], lpc[j+1]); for (j = order-1; j > 0; j--) state[j] = state[j-1]; @@ -223,14 +288,14 @@ static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *l real_t y, state[TNS_MAX_ORDER]; for (i = 0; i < order; i++) - state[i] = 0; + state[i] = REAL_CONST(0.0); for (i = 0; i < size; i++) { y = *spectrum; for (j = 0; j < order; j++) - y += MUL(lpc[j+1], state[j]); + y += MUL_R_C(state[j], lpc[j+1]); for (j = order-1; j > 0; j--) state[j] = state[j-1]; @@ -241,7 +306,7 @@ static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *l } } -static uint8_t tns_max_bands_table[12][5] = +static uint8_t tns_max_bands_table[12][6] = { /* entry for each sampling rate * 1 Main/LC long window @@ -249,37 +314,43 @@ static uint8_t tns_max_bands_table[12][5] = * 3 SSR long window * 4 SSR short window * 5 LD 512 window + * 6 LD 480 window */ - { 31, 9, 28, 7, 0 }, /* 96000 */ - { 31, 9, 28, 7, 0 }, /* 88200 */ - { 34, 10, 27, 7, 0 }, /* 64000 */ - { 40, 14, 26, 6, 31 }, /* 48000 */ - { 42, 14, 26, 6, 32 }, /* 44100 */ - { 51, 14, 26, 6, 37 }, /* 32000 */ - { 46, 14, 29, 7, 31 }, /* 24000 */ - { 46, 14, 29, 7, 31 }, /* 22050 */ - { 42, 14, 23, 8, 0 }, /* 16000 */ - { 42, 14, 23, 8, 0 }, /* 12000 */ - { 42, 14, 23, 8, 0 }, /* 11025 */ - { 39, 14, 19, 7, 0 }, /* 8000 */ + { 31, 9, 28, 7, 0, 0 }, /* 96000 */ + { 31, 9, 28, 7, 0, 0 }, /* 88200 */ + { 34, 10, 27, 7, 0, 0 }, /* 64000 */ + { 40, 14, 26, 6, 31, 31 }, /* 48000 */ + { 42, 14, 26, 6, 32, 32 }, /* 44100 */ + { 51, 14, 26, 6, 37, 37 }, /* 32000 */ + { 46, 14, 29, 7, 31, 30 }, /* 24000 */ + { 46, 14, 29, 7, 31, 30 }, /* 22050 */ + { 42, 14, 23, 8, 0, 0 }, /* 16000 */ + { 42, 14, 23, 8, 0, 0 }, /* 12000 */ + { 42, 14, 23, 8, 0, 0 }, /* 11025 */ + { 39, 14, 19, 7, 0, 0 }, /* 8000 */ }; static uint8_t tns_max_bands(ic_stream *ics, uint8_t sr_index, - uint8_t object_type) + uint8_t object_type, uint16_t frame_len) { uint8_t i; i = (ics->window_sequence == EIGHT_SHORT_SEQUENCE) ? 1 : 0; #ifdef LD_DEC if (object_type == LD) - i = 4; + { + if (frame_len == 512) + i = 4; + else + i = 5; + } #endif return tns_max_bands_table[sr_index][i]; } static uint8_t tns_max_order(ic_stream *ics, uint8_t sr_index, - uint8_t object_type) + uint8_t object_type) { /* Correction in 14496-3 Cor. 1 Works like MPEG2-AAC (13818-7) now @@ -296,14 +367,15 @@ static uint8_t tns_max_order(ic_stream *ics, uint8_t sr_index, switch (object_type) { case MAIN: - return 20; case LTP: - return 20; + case ER_LTP: #ifdef LD_DEC case LD: - return 20; #endif + return 20; case LC: + case ER_LC: + case DRM_ER_LC: case SSR: return 12; } diff --git a/src/libfaad/tns.h b/src/libfaad/tns.h index 2221b6926..d9a904511 100644 --- a/src/libfaad/tns.h +++ b/src/libfaad/tns.h @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: tns.h,v 1.1 2002/07/14 23:43:02 miguelfreitas Exp $ +** $Id: tns.h,v 1.2 2002/12/16 19:02:12 miguelfreitas Exp $ **/ #ifndef __TNS_H__ @@ -41,7 +41,8 @@ static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *l uint8_t order); static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc, uint8_t order); -static uint8_t tns_max_bands(ic_stream *ics, uint8_t sr_index, uint8_t object_type); +static uint8_t tns_max_bands(ic_stream *ics, uint8_t sr_index, uint8_t object_type, + uint16_t frame_len); static uint8_t tns_max_order(ic_stream *ics, uint8_t sr_index, uint8_t object_type); diff --git a/src/libfaad/xine_decoder.c b/src/libfaad/xine_decoder.c index de9e3b95c..aabbef006 100644 --- a/src/libfaad/xine_decoder.c +++ b/src/libfaad/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.13 2002/12/08 20:46:00 tmmm Exp $ + * $Id: xine_decoder.c,v 1.14 2002/12/16 19:02:14 miguelfreitas Exp $ * */ @@ -116,7 +116,7 @@ static void faad_decode_audio ( faad_decoder_t *this, int end_frame ) { (!this->mp4_mode && this->size >= this->rec_audio_src_size) ) { sample_buffer = faacDecDecode(this->faac_dec, - &this->faac_finfo, inbuf); + &this->faac_finfo, inbuf, sample_size); used = sample_size; @@ -256,7 +256,7 @@ static void faad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { if( faad_open_dec(this) ) return; - used = faacDecInit(this->faac_dec, this->buf, + used = faacDecInit(this->faac_dec, this->buf, this->size, &this->rate, &this->num_channels); if( used < 0 ) { xine_log (this->stream->xine, XINE_LOG_MSG, |