comparison dsputil.h @ 10199:38ab367d4231 libavcodec

Merge FFTContext and MDCTContext
author mru
date Sun, 20 Sep 2009 17:30:20 +0000
parents 278d78d1bf19
children db033d1fbf44
comparison
equal deleted inserted replaced
10198:78af613fc316 10199:38ab367d4231
663 663
664 /* NOTE: soon integer code will be added, so you must use the 664 /* NOTE: soon integer code will be added, so you must use the
665 FFTSample type */ 665 FFTSample type */
666 typedef float FFTSample; 666 typedef float FFTSample;
667 667
668 struct MDCTContext;
669
670 typedef struct FFTComplex { 668 typedef struct FFTComplex {
671 FFTSample re, im; 669 FFTSample re, im;
672 } FFTComplex; 670 } FFTComplex;
673 671
674 typedef struct FFTContext { 672 typedef struct FFTContext {
676 int inverse; 674 int inverse;
677 uint16_t *revtab; 675 uint16_t *revtab;
678 FFTComplex *exptab; 676 FFTComplex *exptab;
679 FFTComplex *exptab1; /* only used by SSE code */ 677 FFTComplex *exptab1; /* only used by SSE code */
680 FFTComplex *tmp_buf; 678 FFTComplex *tmp_buf;
679 int mdct_size; /* size of MDCT (i.e. number of input data * 2) */
680 int mdct_bits; /* n = 2^nbits */
681 /* pre/post rotation tables */
682 FFTSample *tcos;
683 FFTSample *tsin;
681 void (*fft_permute)(struct FFTContext *s, FFTComplex *z); 684 void (*fft_permute)(struct FFTContext *s, FFTComplex *z);
682 void (*fft_calc)(struct FFTContext *s, FFTComplex *z); 685 void (*fft_calc)(struct FFTContext *s, FFTComplex *z);
683 void (*imdct_calc)(struct MDCTContext *s, FFTSample *output, const FFTSample *input); 686 void (*imdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input);
684 void (*imdct_half)(struct MDCTContext *s, FFTSample *output, const FFTSample *input); 687 void (*imdct_half)(struct FFTContext *s, FFTSample *output, const FFTSample *input);
685 void (*mdct_calc)(struct MDCTContext *s, FFTSample *output, const FFTSample *input); 688 void (*mdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input);
686 int split_radix; 689 int split_radix;
687 } FFTContext; 690 } FFTContext;
688 691
689 extern FFTSample* const ff_cos_tabs[13]; 692 extern FFTSample* const ff_cos_tabs[13];
690 693
718 } 721 }
719 void ff_fft_end(FFTContext *s); 722 void ff_fft_end(FFTContext *s);
720 723
721 /* MDCT computation */ 724 /* MDCT computation */
722 725
723 typedef struct MDCTContext { 726 static inline void ff_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input)
724 int n; /* size of MDCT (i.e. number of input data * 2) */ 727 {
725 int nbits; /* n = 2^nbits */ 728 s->imdct_calc(s, output, input);
726 /* pre/post rotation tables */ 729 }
727 FFTSample *tcos; 730 static inline void ff_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input)
728 FFTSample *tsin; 731 {
729 FFTContext fft; 732 s->imdct_half(s, output, input);
730 } MDCTContext; 733 }
731 734
732 static inline void ff_imdct_calc(MDCTContext *s, FFTSample *output, const FFTSample *input) 735 static inline void ff_mdct_calc(FFTContext *s, FFTSample *output,
733 {
734 s->fft.imdct_calc(s, output, input);
735 }
736 static inline void ff_imdct_half(MDCTContext *s, FFTSample *output, const FFTSample *input)
737 {
738 s->fft.imdct_half(s, output, input);
739 }
740
741 static inline void ff_mdct_calc(MDCTContext *s, FFTSample *output,
742 const FFTSample *input) 736 const FFTSample *input)
743 { 737 {
744 s->fft.mdct_calc(s, output, input); 738 s->mdct_calc(s, output, input);
745 } 739 }
746 740
747 /** 741 /**
748 * Generate a Kaiser-Bessel Derived Window. 742 * Generate a Kaiser-Bessel Derived Window.
749 * @param window pointer to half window 743 * @param window pointer to half window
766 extern float ff_sine_1024[1024]; 760 extern float ff_sine_1024[1024];
767 extern float ff_sine_2048[2048]; 761 extern float ff_sine_2048[2048];
768 extern float ff_sine_4096[4096]; 762 extern float ff_sine_4096[4096];
769 extern float * const ff_sine_windows[13]; 763 extern float * const ff_sine_windows[13];
770 764
771 int ff_mdct_init(MDCTContext *s, int nbits, int inverse, double scale); 765 int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale);
772 void ff_imdct_calc_c(MDCTContext *s, FFTSample *output, const FFTSample *input); 766 void ff_imdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input);
773 void ff_imdct_half_c(MDCTContext *s, FFTSample *output, const FFTSample *input); 767 void ff_imdct_half_c(FFTContext *s, FFTSample *output, const FFTSample *input);
774 void ff_mdct_calc_c(MDCTContext *s, FFTSample *output, const FFTSample *input); 768 void ff_mdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input);
775 void ff_mdct_end(MDCTContext *s); 769 void ff_mdct_end(FFTContext *s);
776 770
777 /* Real Discrete Fourier Transform */ 771 /* Real Discrete Fourier Transform */
778 772
779 enum RDFTransformType { 773 enum RDFTransformType {
780 RDFT, 774 RDFT,