⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dsputil.h

📁 播放H264文件的播放器
💻 H
📖 第 1 页 / 共 3 页
字号:
static _inline void emms(void){    __asm__ volatile ("emms;":::"memory");}#define emms_c() \{\    if (mm_flags & FF_MM_MMX)\        emms();\}void dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx);#elif ARCH_ARMextern int mm_flags;#if HAVE_NEON#   define DECLARE_ALIGNED_8(t, v) DECLARE_ALIGNED(16, t, v)#   define STRIDE_ALIGN 16#endif#elif ARCH_PPCextern int mm_flags;#define DECLARE_ALIGNED_8(t, v) DECLARE_ALIGNED(16, t, v)#define STRIDE_ALIGN 16#elif 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 */    FFTComplex *tmp_buf;    void (*fft_permute)(struct FFTContext *s, FFTComplex *z);    void (*fft_calc)(struct FFTContext *s, FFTComplex *z);    void (*imdct_calc)(struct MDCTContext *s, FFTSample *output, const FFTSample *input);    void (*imdct_half)(struct MDCTContext *s, FFTSample *output, const FFTSample *input);} FFTContext;extern FFTSample* ff_cos_tabs[13];/** * Sets up a complex FFT. * @param nbits           log2 of the length of the input array * @param inverse         if 0 perform the forward transform, if 1 perform the inverse */int ff_fft_init(FFTContext *s, int nbits, int inverse);void ff_fft_permute_c(FFTContext *s, FFTComplex *z);void ff_fft_permute_sse(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);/** * Do the permutation needed BEFORE calling ff_fft_calc(). */static _inline void ff_fft_permute(FFTContext *s, FFTComplex *z){    s->fft_permute(s, z);}/** * Do a complex FFT with the parameters defined in ff_fft_init(). The * input data must be permuted before. No 1.0/sqrt(n) normalization is done. */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;static _inline void ff_imdct_calc(MDCTContext *s, FFTSample *output, const FFTSample *input){    s->fft.imdct_calc(s, output, input);}static _inline void ff_imdct_half(MDCTContext *s, FFTSample *output, const FFTSample *input){    s->fft.imdct_half(s, output, input);}/** * 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);extern float ff_sine_128 [ 128];extern float ff_sine_256 [ 256];extern float ff_sine_512 [ 512];extern float ff_sine_1024[1024];extern float ff_sine_2048[2048];extern float ff_sine_4096[4096];extern float *ff_sine_windows[6];int ff_mdct_init(MDCTContext *s, int nbits, int inverse);void ff_imdct_calc_c(MDCTContext *s, FFTSample *output, const FFTSample *input);void ff_imdct_half_c(MDCTContext *s, FFTSample *output, const FFTSample *input);void ff_imdct_calc_3dn(MDCTContext *s, FFTSample *output, const FFTSample *input);void ff_imdct_half_3dn(MDCTContext *s, FFTSample *output, const FFTSample *input);void ff_imdct_calc_3dn2(MDCTContext *s, FFTSample *output, const FFTSample *input);void ff_imdct_half_3dn2(MDCTContext *s, FFTSample *output, const FFTSample *input);void ff_imdct_calc_sse(MDCTContext *s, FFTSample *output, const FFTSample *input);void ff_imdct_half_sse(MDCTContext *s, FFTSample *output, const FFTSample *input);void ff_mdct_calc(MDCTContext *s, FFTSample *out, const FFTSample *input);void ff_mdct_end(MDCTContext *s);/* Real Discrete Fourier Transform */enum RDFTransformType {    RDFT,    IRDFT,    RIDFT,    IRIDFT,};typedef struct {    int nbits;    int inverse;    int sign_convention;    /* pre/post rotation tables */    FFTSample *tcos;    FFTSample *tsin;    FFTContext fft;} RDFTContext;/** * Sets up a real FFT. * @param nbits           log2 of the length of the input array * @param trans           the type of transform */int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans);void ff_rdft_calc(RDFTContext *s, FFTSample *data);void ff_rdft_end(RDFTContext *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   ));		memcpy(dst, src, sizeof(uint16_t));        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   ));		memcpy(dst, src, sizeof(uint32_t));        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 ));		memcpy(dst, src, 2*sizeof(uint32_t));        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 ));		memcpy(dst, src, 2*sizeof(uint32_t));        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));		memcpy(dst, src, 4*sizeof(uint32_t));        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));		memcpy(dst, src, 4*sizeof(uint32_t));        dst[16]= src[16];        dst+=dstStride;        src+=srcStride;    }}#endif /* AVCODEC_DSPUTIL_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -