OLD | NEW |
1 /* | 1 /* |
2 * DSP utils | 2 * DSP utils |
3 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard | 3 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard |
4 * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> | 4 * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> |
5 * | 5 * |
6 * This file is part of FFmpeg. | 6 * This file is part of FFmpeg. |
7 * | 7 * |
8 * FFmpeg is free software; you can redistribute it and/or | 8 * FFmpeg is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 void ff_vp3_idct_put_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*
align 16*/); | 89 void ff_vp3_idct_put_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*
align 16*/); |
90 void ff_vp3_idct_add_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*
align 16*/); | 90 void ff_vp3_idct_add_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*
align 16*/); |
91 | 91 |
92 void ff_vp3_v_loop_filter_c(uint8_t *src, int stride, int *bounding_values); | 92 void ff_vp3_v_loop_filter_c(uint8_t *src, int stride, int *bounding_values); |
93 void ff_vp3_h_loop_filter_c(uint8_t *src, int stride, int *bounding_values); | 93 void ff_vp3_h_loop_filter_c(uint8_t *src, int stride, int *bounding_values); |
94 | 94 |
95 /* VP6 DSP functions */ | 95 /* VP6 DSP functions */ |
96 void ff_vp6_filter_diag4_c(uint8_t *dst, uint8_t *src, int stride, | 96 void ff_vp6_filter_diag4_c(uint8_t *dst, uint8_t *src, int stride, |
97 const int16_t *h_weights, const int16_t *v_weights); | 97 const int16_t *h_weights, const int16_t *v_weights); |
98 | 98 |
| 99 /* Bink functions */ |
| 100 void ff_bink_idct_c (DCTELEM *block); |
| 101 void ff_bink_idct_add_c(uint8_t *dest, int linesize, DCTELEM *block); |
| 102 void ff_bink_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block); |
| 103 |
| 104 /* CAVS functions */ |
| 105 void ff_put_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride); |
| 106 void ff_avg_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride); |
| 107 void ff_put_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride); |
| 108 void ff_avg_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride); |
| 109 |
| 110 /* VC1 functions */ |
| 111 void ff_put_vc1_mspel_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int r
nd); |
| 112 void ff_avg_vc1_mspel_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int r
nd); |
| 113 |
| 114 /* EA functions */ |
| 115 void ff_ea_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block); |
| 116 |
99 /* 1/2^n downscaling functions from imgconvert.c */ | 117 /* 1/2^n downscaling functions from imgconvert.c */ |
100 void ff_img_copy_plane(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_w
rap, int width, int height); | 118 void ff_img_copy_plane(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_w
rap, int width, int height); |
101 void ff_shrink22(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, i
nt width, int height); | 119 void ff_shrink22(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, i
nt width, int height); |
102 void ff_shrink44(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, i
nt width, int height); | 120 void ff_shrink44(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, i
nt width, int height); |
103 void ff_shrink88(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, i
nt width, int height); | 121 void ff_shrink88(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, i
nt width, int height); |
104 | 122 |
105 void ff_gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, | 123 void ff_gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, |
106 int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, i
nt height); | 124 int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, i
nt height); |
107 | 125 |
108 /* minimum alignment rules ;) | 126 /* minimum alignment rules ;) |
(...skipping 20 matching lines...) Expand all Loading... |
129 /* add and put pixel (decoding) */ | 147 /* add and put pixel (decoding) */ |
130 // blocksizes for op_pixels_func are 8x4,8x8 16x8 16x16 | 148 // blocksizes for op_pixels_func are 8x4,8x8 16x8 16x16 |
131 //h for op_pixels_func is limited to {width/2, width} but never larger than 16 a
nd never smaller then 4 | 149 //h for op_pixels_func is limited to {width/2, width} but never larger than 16 a
nd never smaller then 4 |
132 typedef void (*op_pixels_func)(uint8_t *block/*align width (8 or 16)*/, const ui
nt8_t *pixels/*align 1*/, int line_size, int h); | 150 typedef void (*op_pixels_func)(uint8_t *block/*align width (8 or 16)*/, const ui
nt8_t *pixels/*align 1*/, int line_size, int h); |
133 typedef void (*tpel_mc_func)(uint8_t *block/*align width (8 or 16)*/, const uint
8_t *pixels/*align 1*/, int line_size, int w, int h); | 151 typedef void (*tpel_mc_func)(uint8_t *block/*align width (8 or 16)*/, const uint
8_t *pixels/*align 1*/, int line_size, int w, int h); |
134 typedef void (*qpel_mc_func)(uint8_t *dst/*align width (8 or 16)*/, uint8_t *src
/*align 1*/, int stride); | 152 typedef void (*qpel_mc_func)(uint8_t *dst/*align width (8 or 16)*/, uint8_t *src
/*align 1*/, int stride); |
135 typedef void (*h264_chroma_mc_func)(uint8_t *dst/*align 8*/, uint8_t *src/*align
1*/, int srcStride, int h, int x, int y); | 153 typedef void (*h264_chroma_mc_func)(uint8_t *dst/*align 8*/, uint8_t *src/*align
1*/, int srcStride, int h, int x, int y); |
136 typedef void (*h264_weight_func)(uint8_t *block, int stride, int log2_denom, int
weight, int offset); | 154 typedef void (*h264_weight_func)(uint8_t *block, int stride, int log2_denom, int
weight, int offset); |
137 typedef void (*h264_biweight_func)(uint8_t *dst, uint8_t *src, int stride, int l
og2_denom, int weightd, int weights, int offset); | 155 typedef void (*h264_biweight_func)(uint8_t *dst, uint8_t *src, int stride, int l
og2_denom, int weightd, int weights, int offset); |
138 | 156 |
| 157 typedef void (*op_fill_func)(uint8_t *block/*align width (8 or 16)*/, uint8_t va
lue, int line_size, int h); |
| 158 |
139 #define DEF_OLD_QPEL(name)\ | 159 #define DEF_OLD_QPEL(name)\ |
140 void ff_put_ ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src
/*align 1*/, int stride);\ | 160 void ff_put_ ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src
/*align 1*/, int stride);\ |
141 void ff_put_no_rnd_ ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src
/*align 1*/, int stride);\ | 161 void ff_put_no_rnd_ ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src
/*align 1*/, int stride);\ |
142 void ff_avg_ ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src
/*align 1*/, int stride); | 162 void ff_avg_ ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src
/*align 1*/, int stride); |
143 | 163 |
144 DEF_OLD_QPEL(qpel16_mc11_old_c) | 164 DEF_OLD_QPEL(qpel16_mc11_old_c) |
145 DEF_OLD_QPEL(qpel16_mc31_old_c) | 165 DEF_OLD_QPEL(qpel16_mc31_old_c) |
146 DEF_OLD_QPEL(qpel16_mc12_old_c) | 166 DEF_OLD_QPEL(qpel16_mc12_old_c) |
147 DEF_OLD_QPEL(qpel16_mc32_old_c) | 167 DEF_OLD_QPEL(qpel16_mc32_old_c) |
148 DEF_OLD_QPEL(qpel16_mc13_old_c) | 168 DEF_OLD_QPEL(qpel16_mc13_old_c) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 210 |
191 /** | 211 /** |
192 * DSPContext. | 212 * DSPContext. |
193 */ | 213 */ |
194 typedef struct DSPContext { | 214 typedef struct DSPContext { |
195 /* pixel ops : interface with DCT */ | 215 /* pixel ops : interface with DCT */ |
196 void (*get_pixels)(DCTELEM *block/*align 16*/, const uint8_t *pixels/*align
8*/, int line_size); | 216 void (*get_pixels)(DCTELEM *block/*align 16*/, const uint8_t *pixels/*align
8*/, int line_size); |
197 void (*diff_pixels)(DCTELEM *block/*align 16*/, const uint8_t *s1/*align 8*/
, const uint8_t *s2/*align 8*/, int stride); | 217 void (*diff_pixels)(DCTELEM *block/*align 16*/, const uint8_t *s1/*align 8*/
, const uint8_t *s2/*align 8*/, int stride); |
198 void (*put_pixels_clamped)(const DCTELEM *block/*align 16*/, uint8_t *pixels
/*align 8*/, int line_size); | 218 void (*put_pixels_clamped)(const DCTELEM *block/*align 16*/, uint8_t *pixels
/*align 8*/, int line_size); |
199 void (*put_signed_pixels_clamped)(const DCTELEM *block/*align 16*/, uint8_t
*pixels/*align 8*/, int line_size); | 219 void (*put_signed_pixels_clamped)(const DCTELEM *block/*align 16*/, uint8_t
*pixels/*align 8*/, int line_size); |
| 220 void (*put_pixels_nonclamped)(const DCTELEM *block/*align 16*/, uint8_t *pix
els/*align 8*/, int line_size); |
200 void (*add_pixels_clamped)(const DCTELEM *block/*align 16*/, uint8_t *pixels
/*align 8*/, int line_size); | 221 void (*add_pixels_clamped)(const DCTELEM *block/*align 16*/, uint8_t *pixels
/*align 8*/, int line_size); |
201 void (*add_pixels8)(uint8_t *pixels, DCTELEM *block, int line_size); | 222 void (*add_pixels8)(uint8_t *pixels, DCTELEM *block, int line_size); |
202 void (*add_pixels4)(uint8_t *pixels, DCTELEM *block, int line_size); | 223 void (*add_pixels4)(uint8_t *pixels, DCTELEM *block, int line_size); |
203 int (*sum_abs_dctelem)(DCTELEM *block/*align 16*/); | 224 int (*sum_abs_dctelem)(DCTELEM *block/*align 16*/); |
204 /** | 225 /** |
205 * translational global motion compensation. | 226 * translational global motion compensation. |
206 */ | 227 */ |
207 void (*gmc1)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride
, int h, int x16, int y16, int rounder); | 228 void (*gmc1)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride
, int h, int x16, int y16, int rounder); |
208 /** | 229 /** |
209 * global motion compensation. | 230 * global motion compensation. |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 | 599 |
579 /* rv30 functions */ | 600 /* rv30 functions */ |
580 qpel_mc_func put_rv30_tpel_pixels_tab[4][16]; | 601 qpel_mc_func put_rv30_tpel_pixels_tab[4][16]; |
581 qpel_mc_func avg_rv30_tpel_pixels_tab[4][16]; | 602 qpel_mc_func avg_rv30_tpel_pixels_tab[4][16]; |
582 | 603 |
583 /* rv40 functions */ | 604 /* rv40 functions */ |
584 qpel_mc_func put_rv40_qpel_pixels_tab[4][16]; | 605 qpel_mc_func put_rv40_qpel_pixels_tab[4][16]; |
585 qpel_mc_func avg_rv40_qpel_pixels_tab[4][16]; | 606 qpel_mc_func avg_rv40_qpel_pixels_tab[4][16]; |
586 h264_chroma_mc_func put_rv40_chroma_pixels_tab[3]; | 607 h264_chroma_mc_func put_rv40_chroma_pixels_tab[3]; |
587 h264_chroma_mc_func avg_rv40_chroma_pixels_tab[3]; | 608 h264_chroma_mc_func avg_rv40_chroma_pixels_tab[3]; |
| 609 |
| 610 /* bink functions */ |
| 611 op_fill_func fill_block_tab[2]; |
| 612 void (*scale_block)(const uint8_t src[64]/*align 8*/, uint8_t *dst/*align 8*
/, int linesize); |
588 } DSPContext; | 613 } DSPContext; |
589 | 614 |
590 void dsputil_static_init(void); | 615 void dsputil_static_init(void); |
591 void dsputil_init(DSPContext* p, AVCodecContext *avctx); | 616 void dsputil_init(DSPContext* p, AVCodecContext *avctx); |
592 | 617 |
593 int ff_check_alignment(void); | 618 int ff_check_alignment(void); |
594 | 619 |
595 /** | 620 /** |
596 * permute block according to permuatation. | 621 * permute block according to permuatation. |
597 * @param last last non zero element in scantable order | 622 * @param last last non zero element in scantable order |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx); | 676 void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx); |
652 void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx); | 677 void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx); |
653 void dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx); | 678 void dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx); |
654 void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx); | 679 void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx); |
655 void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx); | 680 void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx); |
656 void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx); | 681 void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx); |
657 void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx); | 682 void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx); |
658 void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx); | 683 void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx); |
659 void dsputil_init_vis(DSPContext* c, AVCodecContext *avctx); | 684 void dsputil_init_vis(DSPContext* c, AVCodecContext *avctx); |
660 | 685 |
661 #define DECLARE_ALIGNED_16(t, v, ...) DECLARE_ALIGNED(16, t, v) | 686 void ff_cavsdsp_init(DSPContext* c, AVCodecContext *avctx); |
662 #define DECLARE_ALIGNED_8(t, v, ...) DECLARE_ALIGNED(8, t, v) | 687 void ff_rv30dsp_init(DSPContext* c, AVCodecContext *avctx); |
| 688 void ff_rv40dsp_init(DSPContext* c, AVCodecContext *avctx); |
| 689 void ff_vc1dsp_init(DSPContext* c, AVCodecContext *avctx); |
| 690 void ff_intrax8dsp_init(DSPContext* c, AVCodecContext *avctx); |
| 691 void ff_mlp_init(DSPContext* c, AVCodecContext *avctx); |
| 692 void ff_mlp_init_x86(DSPContext* c, AVCodecContext *avctx); |
663 | 693 |
664 #if HAVE_MMX | 694 #if HAVE_MMX |
665 | 695 |
666 #undef emms_c | 696 #undef emms_c |
667 | 697 |
668 static inline void emms(void) | 698 static inline void emms(void) |
669 { | 699 { |
670 __asm__ volatile ("emms;":::"memory"); | 700 __asm__ volatile ("emms;":::"memory"); |
671 } | 701 } |
672 | 702 |
(...skipping 22 matching lines...) Expand all Loading... |
695 | 725 |
696 #define mm_flags 0 | 726 #define mm_flags 0 |
697 #define mm_support() 0 | 727 #define mm_support() 0 |
698 | 728 |
699 #endif | 729 #endif |
700 | 730 |
701 #ifndef STRIDE_ALIGN | 731 #ifndef STRIDE_ALIGN |
702 # define STRIDE_ALIGN 8 | 732 # define STRIDE_ALIGN 8 |
703 #endif | 733 #endif |
704 | 734 |
| 735 #define LOCAL_ALIGNED(a, t, v, s, ...) \ |
| 736 uint8_t la_##v[sizeof(t s __VA_ARGS__) + (a)]; \ |
| 737 t (*v) __VA_ARGS__ = (void *)FFALIGN((uintptr_t)la_##v, a) |
| 738 |
| 739 #if HAVE_LOCAL_ALIGNED_8 |
| 740 # define LOCAL_ALIGNED_8(t, v, s, ...) DECLARE_ALIGNED(8, t, v) s __VA_ARGS__ |
| 741 #else |
| 742 # define LOCAL_ALIGNED_8(t, v, s, ...) LOCAL_ALIGNED(8, t, v, s, __VA_ARGS__) |
| 743 #endif |
| 744 |
| 745 #if HAVE_LOCAL_ALIGNED_16 |
| 746 # define LOCAL_ALIGNED_16(t, v, s, ...) DECLARE_ALIGNED(16, t, v) s __VA_ARGS_
_ |
| 747 #else |
| 748 # define LOCAL_ALIGNED_16(t, v, s, ...) LOCAL_ALIGNED(16, t, v, s, __VA_ARGS__
) |
| 749 #endif |
| 750 |
705 /* PSNR */ | 751 /* PSNR */ |
706 void get_psnr(uint8_t *orig_image[3], uint8_t *coded_image[3], | 752 void get_psnr(uint8_t *orig_image[3], uint8_t *coded_image[3], |
707 int orig_linesize[3], int coded_linesize, | 753 int orig_linesize[3], int coded_linesize, |
708 AVCodecContext *avctx); | 754 AVCodecContext *avctx); |
709 | 755 |
710 /* FFT computation */ | |
711 | |
712 /* NOTE: soon integer code will be added, so you must use the | |
713 FFTSample type */ | |
714 typedef float FFTSample; | |
715 | |
716 typedef struct FFTComplex { | |
717 FFTSample re, im; | |
718 } FFTComplex; | |
719 | |
720 typedef struct FFTContext { | |
721 int nbits; | |
722 int inverse; | |
723 uint16_t *revtab; | |
724 FFTComplex *exptab; | |
725 FFTComplex *exptab1; /* only used by SSE code */ | |
726 FFTComplex *tmp_buf; | |
727 int mdct_size; /* size of MDCT (i.e. number of input data * 2) */ | |
728 int mdct_bits; /* n = 2^nbits */ | |
729 /* pre/post rotation tables */ | |
730 FFTSample *tcos; | |
731 FFTSample *tsin; | |
732 void (*fft_permute)(struct FFTContext *s, FFTComplex *z); | |
733 void (*fft_calc)(struct FFTContext *s, FFTComplex *z); | |
734 void (*imdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample
*input); | |
735 void (*imdct_half)(struct FFTContext *s, FFTSample *output, const FFTSample
*input); | |
736 void (*mdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *
input); | |
737 int split_radix; | |
738 int permutation; | |
739 #define FF_MDCT_PERM_NONE 0 | |
740 #define FF_MDCT_PERM_INTERLEAVE 1 | |
741 } FFTContext; | |
742 | |
743 #if CONFIG_HARDCODED_TABLES | |
744 #define COSTABLE_CONST const | |
745 #define SINTABLE_CONST const | |
746 #define SINETABLE_CONST const | |
747 #else | |
748 #define COSTABLE_CONST | |
749 #define SINTABLE_CONST | |
750 #define SINETABLE_CONST | |
751 #endif | |
752 | |
753 #define COSTABLE(size) \ | |
754 COSTABLE_CONST DECLARE_ALIGNED_16(FFTSample, ff_cos_##size)[size/2] | |
755 #define SINTABLE(size) \ | |
756 SINTABLE_CONST DECLARE_ALIGNED_16(FFTSample, ff_sin_##size)[size/2] | |
757 #define SINETABLE(size) \ | |
758 SINETABLE_CONST DECLARE_ALIGNED_16(float, ff_sine_##size)[size] | |
759 extern COSTABLE(16); | |
760 extern COSTABLE(32); | |
761 extern COSTABLE(64); | |
762 extern COSTABLE(128); | |
763 extern COSTABLE(256); | |
764 extern COSTABLE(512); | |
765 extern COSTABLE(1024); | |
766 extern COSTABLE(2048); | |
767 extern COSTABLE(4096); | |
768 extern COSTABLE(8192); | |
769 extern COSTABLE(16384); | |
770 extern COSTABLE(32768); | |
771 extern COSTABLE(65536); | |
772 extern COSTABLE_CONST FFTSample* const ff_cos_tabs[17]; | |
773 | |
774 /** | |
775 * Initializes the cosine table in ff_cos_tabs[index] | |
776 * \param index index in ff_cos_tabs array of the table to initialize | |
777 */ | |
778 void ff_init_ff_cos_tabs(int index); | |
779 | |
780 extern SINTABLE(16); | |
781 extern SINTABLE(32); | |
782 extern SINTABLE(64); | |
783 extern SINTABLE(128); | |
784 extern SINTABLE(256); | |
785 extern SINTABLE(512); | |
786 extern SINTABLE(1024); | |
787 extern SINTABLE(2048); | |
788 extern SINTABLE(4096); | |
789 extern SINTABLE(8192); | |
790 extern SINTABLE(16384); | |
791 extern SINTABLE(32768); | |
792 extern SINTABLE(65536); | |
793 | |
794 /** | |
795 * Sets up a complex FFT. | |
796 * @param nbits log2 of the length of the input array | |
797 * @param inverse if 0 perform the forward transform, if 1 perform the i
nverse | |
798 */ | |
799 int ff_fft_init(FFTContext *s, int nbits, int inverse); | |
800 void ff_fft_permute_c(FFTContext *s, FFTComplex *z); | |
801 void ff_fft_calc_c(FFTContext *s, FFTComplex *z); | |
802 | |
803 void ff_fft_init_altivec(FFTContext *s); | |
804 void ff_fft_init_mmx(FFTContext *s); | |
805 void ff_fft_init_arm(FFTContext *s); | |
806 | |
807 /** | |
808 * Do the permutation needed BEFORE calling ff_fft_calc(). | |
809 */ | |
810 static inline void ff_fft_permute(FFTContext *s, FFTComplex *z) | |
811 { | |
812 s->fft_permute(s, z); | |
813 } | |
814 /** | |
815 * Do a complex FFT with the parameters defined in ff_fft_init(). The | |
816 * input data must be permuted before. No 1.0/sqrt(n) normalization is done. | |
817 */ | |
818 static inline void ff_fft_calc(FFTContext *s, FFTComplex *z) | |
819 { | |
820 s->fft_calc(s, z); | |
821 } | |
822 void ff_fft_end(FFTContext *s); | |
823 | |
824 /* MDCT computation */ | |
825 | |
826 static inline void ff_imdct_calc(FFTContext *s, FFTSample *output, const FFTSamp
le *input) | |
827 { | |
828 s->imdct_calc(s, output, input); | |
829 } | |
830 static inline void ff_imdct_half(FFTContext *s, FFTSample *output, const FFTSamp
le *input) | |
831 { | |
832 s->imdct_half(s, output, input); | |
833 } | |
834 | |
835 static inline void ff_mdct_calc(FFTContext *s, FFTSample *output, | |
836 const FFTSample *input) | |
837 { | |
838 s->mdct_calc(s, output, input); | |
839 } | |
840 | |
841 /** | |
842 * Generate a Kaiser-Bessel Derived Window. | |
843 * @param window pointer to half window | |
844 * @param alpha determines window shape | |
845 * @param n size of half window | |
846 */ | |
847 void ff_kbd_window_init(float *window, float alpha, int n); | |
848 | |
849 /** | |
850 * Generate a sine window. | |
851 * @param window pointer to half window | |
852 * @param n size of half window | |
853 */ | |
854 void ff_sine_window_init(float *window, int n); | |
855 /** | |
856 * initialize the specified entry of ff_sine_windows | |
857 */ | |
858 void ff_init_ff_sine_windows(int index); | |
859 extern SINETABLE( 32); | |
860 extern SINETABLE( 64); | |
861 extern SINETABLE( 128); | |
862 extern SINETABLE( 256); | |
863 extern SINETABLE( 512); | |
864 extern SINETABLE(1024); | |
865 extern SINETABLE(2048); | |
866 extern SINETABLE(4096); | |
867 extern SINETABLE_CONST float * const ff_sine_windows[13]; | |
868 | |
869 int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale); | |
870 void ff_imdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input); | |
871 void ff_imdct_half_c(FFTContext *s, FFTSample *output, const FFTSample *input); | |
872 void ff_mdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input); | |
873 void ff_mdct_end(FFTContext *s); | |
874 | |
875 /* Real Discrete Fourier Transform */ | |
876 | |
877 enum RDFTransformType { | |
878 RDFT, | |
879 IRDFT, | |
880 RIDFT, | |
881 IRIDFT, | |
882 }; | |
883 | |
884 typedef struct { | |
885 int nbits; | |
886 int inverse; | |
887 int sign_convention; | |
888 | |
889 /* pre/post rotation tables */ | |
890 const FFTSample *tcos; | |
891 SINTABLE_CONST FFTSample *tsin; | |
892 FFTContext fft; | |
893 } RDFTContext; | |
894 | |
895 /** | |
896 * Sets up a real FFT. | |
897 * @param nbits log2 of the length of the input array | |
898 * @param trans the type of transform | |
899 */ | |
900 int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans); | |
901 void ff_rdft_calc(RDFTContext *s, FFTSample *data); | |
902 void ff_rdft_end(RDFTContext *s); | |
903 | |
904 /* Discrete Cosine Transform */ | |
905 | |
906 typedef struct { | |
907 int nbits; | |
908 int inverse; | |
909 FFTSample *data; | |
910 RDFTContext rdft; | |
911 const float *costab; | |
912 FFTSample *csc2; | |
913 } DCTContext; | |
914 | |
915 /** | |
916 * Sets up (Inverse)DCT. | |
917 * @param nbits log2 of the length of the input array | |
918 * @param inverse >0 forward transform, <0 inverse transform | |
919 */ | |
920 int ff_dct_init(DCTContext *s, int nbits, int inverse); | |
921 void ff_dct_calc(DCTContext *s, FFTSample *data); | |
922 void ff_dct_end (DCTContext *s); | |
923 | |
924 #define WRAPPER8_16(name8, name16)\ | 756 #define WRAPPER8_16(name8, name16)\ |
925 static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int st
ride, int h){\ | 757 static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int st
ride, int h){\ |
926 return name8(s, dst , src , stride, h)\ | 758 return name8(s, dst , src , stride, h)\ |
927 +name8(s, dst+8 , src+8 , stride, h);\ | 759 +name8(s, dst+8 , src+8 , stride, h);\ |
928 } | 760 } |
929 | 761 |
930 #define WRAPPER8_16_SQ(name8, name16)\ | 762 #define WRAPPER8_16_SQ(name8, name16)\ |
931 static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int st
ride, int h){\ | 763 static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int st
ride, int h){\ |
932 int score=0;\ | 764 int score=0;\ |
933 score +=name8(s, dst , src , stride, 8);\ | 765 score +=name8(s, dst , src , stride, 8);\ |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 AV_WN32(dst+4 , AV_RN32(src+4 )); | 844 AV_WN32(dst+4 , AV_RN32(src+4 )); |
1013 AV_WN32(dst+8 , AV_RN32(src+8 )); | 845 AV_WN32(dst+8 , AV_RN32(src+8 )); |
1014 AV_WN32(dst+12, AV_RN32(src+12)); | 846 AV_WN32(dst+12, AV_RN32(src+12)); |
1015 dst[16]= src[16]; | 847 dst[16]= src[16]; |
1016 dst+=dstStride; | 848 dst+=dstStride; |
1017 src+=srcStride; | 849 src+=srcStride; |
1018 } | 850 } |
1019 } | 851 } |
1020 | 852 |
1021 #endif /* AVCODEC_DSPUTIL_H */ | 853 #endif /* AVCODEC_DSPUTIL_H */ |
OLD | NEW |