📄 dsputil.h
字号:
one or more MultiMedia extension */int mm_support(void);void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx);void dsputil_init_armv4l(DSPContext* c, AVCodecContext *avctx);void dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx);void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx);void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx);void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx);void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx);void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx);void dsputil_init_vis(DSPContext* c, AVCodecContext *avctx);#define DECLARE_ALIGNED_16(t, v) DECLARE_ALIGNED(16, t, v)#if defined(HAVE_MMX)#undef emms_c#define MM_MMX 0x0001 /* standard MMX */#define MM_3DNOW 0x0004 /* AMD 3DNOW */#define MM_MMXEXT 0x0002 /* SSE integer functions or AMD MMX ext */#define MM_SSE 0x0008 /* SSE functions */#define MM_SSE2 0x0010 /* PIV SSE2 functions */#define MM_3DNOWEXT 0x0020 /* AMD 3DNowExt */#define MM_SSE3 0x0040 /* Prescott SSE3 functions */#define MM_SSSE3 0x0080 /* Conroe SSSE3 functions */extern int mm_flags;void add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size);void put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size);void put_signed_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size);static inline void emms(void){ asm volatile ("emms;":::"memory");}#define emms_c() \{\ if (mm_flags & MM_MMX)\ emms();\}void dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx);#elif defined(ARCH_ARMV4L)#define MM_IWMMXT 0x0100 /* XScale IWMMXT */extern int mm_flags;#elif defined(ARCH_POWERPC)#define MM_ALTIVEC 0x0001 /* standard AltiVec */extern int mm_flags;#define DECLARE_ALIGNED_8(t, v) DECLARE_ALIGNED(16, t, v)#define STRIDE_ALIGN 16#elif defined(HAVE_MMI)#define DECLARE_ALIGNED_8(t, v) DECLARE_ALIGNED(16, t, v)#define STRIDE_ALIGN 16#else#define mm_flags 0#define mm_support() 0#endif#ifndef DECLARE_ALIGNED_8# define DECLARE_ALIGNED_8(t, v) DECLARE_ALIGNED(8, t, v)#endif#ifndef STRIDE_ALIGN# define STRIDE_ALIGN 8#endif/* PSNR */void get_psnr(uint8_t *orig_image[3], uint8_t *coded_image[3], int orig_linesize[3], int coded_linesize, AVCodecContext *avctx);/* FFT computation *//* NOTE: soon integer code will be added, so you must use the FFTSample type */typedef float FFTSample;struct MDCTContext;typedef struct FFTComplex { FFTSample re, im;} FFTComplex;typedef struct FFTContext { int nbits; int inverse; uint16_t *revtab; FFTComplex *exptab; FFTComplex *exptab1; /* only used by SSE code */ void (*fft_calc)(struct FFTContext *s, FFTComplex *z); void (*imdct_calc)(struct MDCTContext *s, FFTSample *output, const FFTSample *input, FFTSample *tmp); void (*imdct_half)(struct MDCTContext *s, FFTSample *output, const FFTSample *input, FFTSample *tmp);} FFTContext;int ff_fft_init(FFTContext *s, int nbits, int inverse);void ff_fft_permute(FFTContext *s, FFTComplex *z);void ff_fft_calc_c(FFTContext *s, FFTComplex *z);void ff_fft_calc_sse(FFTContext *s, FFTComplex *z);void ff_fft_calc_3dn(FFTContext *s, FFTComplex *z);void ff_fft_calc_3dn2(FFTContext *s, FFTComplex *z);void ff_fft_calc_altivec(FFTContext *s, FFTComplex *z);static inline void ff_fft_calc(FFTContext *s, FFTComplex *z){ s->fft_calc(s, z);}void ff_fft_end(FFTContext *s);/* MDCT computation */typedef struct MDCTContext { int n; /* size of MDCT (i.e. number of input data * 2) */ int nbits; /* n = 2^nbits */ /* pre/post rotation tables */ FFTSample *tcos; FFTSample *tsin; FFTContext fft;} MDCTContext;/** * Generate a Kaiser-Bessel Derived Window. * @param window pointer to half window * @param alpha determines window shape * @param n size of half window */void ff_kbd_window_init(float *window, float alpha, int n);/** * Generate a sine window. * @param window pointer to half window * @param n size of half window */void ff_sine_window_init(float *window, int n);int ff_mdct_init(MDCTContext *s, int nbits, int inverse);void ff_imdct_calc(MDCTContext *s, FFTSample *output, const FFTSample *input, FFTSample *tmp);void ff_imdct_half(MDCTContext *s, FFTSample *output, const FFTSample *input, FFTSample *tmp);void ff_imdct_calc_3dn2(MDCTContext *s, FFTSample *output, const FFTSample *input, FFTSample *tmp);void ff_imdct_half_3dn2(MDCTContext *s, FFTSample *output, const FFTSample *input, FFTSample *tmp);void ff_imdct_calc_sse(MDCTContext *s, FFTSample *output, const FFTSample *input, FFTSample *tmp);void ff_imdct_half_sse(MDCTContext *s, FFTSample *output, const FFTSample *input, FFTSample *tmp);void ff_mdct_calc(MDCTContext *s, FFTSample *out, const FFTSample *input, FFTSample *tmp);void ff_mdct_end(MDCTContext *s);#define WRAPPER8_16(name8, name16)\static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int stride, int h){\ return name8(s, dst , src , stride, h)\ +name8(s, dst+8 , src+8 , stride, h);\}#define WRAPPER8_16_SQ(name8, name16)\static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int stride, int h){\ int score=0;\ score +=name8(s, dst , src , stride, 8);\ score +=name8(s, dst+8 , src+8 , stride, 8);\ if(h==16){\ dst += 8*stride;\ src += 8*stride;\ score +=name8(s, dst , src , stride, 8);\ score +=name8(s, dst+8 , src+8 , stride, 8);\ }\ return score;\}static inline void copy_block2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){ int i; for(i=0; i<h; i++) { AV_WN16(dst , AV_RN16(src )); dst+=dstStride; src+=srcStride; }}static inline void copy_block4(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){ int i; for(i=0; i<h; i++) { AV_WN32(dst , AV_RN32(src )); dst+=dstStride; src+=srcStride; }}static inline void copy_block8(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){ int i; for(i=0; i<h; i++) { AV_WN32(dst , AV_RN32(src )); AV_WN32(dst+4 , AV_RN32(src+4 )); dst+=dstStride; src+=srcStride; }}static inline void copy_block9(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){ int i; for(i=0; i<h; i++) { AV_WN32(dst , AV_RN32(src )); AV_WN32(dst+4 , AV_RN32(src+4 )); dst[8]= src[8]; dst+=dstStride; src+=srcStride; }}static inline void copy_block16(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){ int i; for(i=0; i<h; i++) { AV_WN32(dst , AV_RN32(src )); AV_WN32(dst+4 , AV_RN32(src+4 )); AV_WN32(dst+8 , AV_RN32(src+8 )); AV_WN32(dst+12, AV_RN32(src+12)); dst+=dstStride; src+=srcStride; }}static inline void copy_block17(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){ int i; for(i=0; i<h; i++) { AV_WN32(dst , AV_RN32(src )); AV_WN32(dst+4 , AV_RN32(src+4 )); AV_WN32(dst+8 , AV_RN32(src+8 )); AV_WN32(dst+12, AV_RN32(src+12)); dst[16]= src[16]; dst+=dstStride; src+=srcStride; }}#endif /* FFMPEG_DSPUTIL_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -