| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 extern const uint8_t ff_zigzag_direct[64]; | 75 extern const uint8_t ff_zigzag_direct[64]; |
| 76 extern const uint8_t ff_zigzag248_direct[64]; | 76 extern const uint8_t ff_zigzag248_direct[64]; |
| 77 | 77 |
| 78 /* pixel operations */ | 78 /* pixel operations */ |
| 79 #define MAX_NEG_CROP 1024 | 79 #define MAX_NEG_CROP 1024 |
| 80 | 80 |
| 81 /* temporary */ | 81 /* temporary */ |
| 82 extern uint32_t ff_squareTbl[512]; | 82 extern uint32_t ff_squareTbl[512]; |
| 83 extern uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP]; | 83 extern uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP]; |
| 84 | 84 |
| 85 void ff_put_pixels8x8_c(uint8_t *dst, uint8_t *src, int stride); |
| 86 void ff_avg_pixels8x8_c(uint8_t *dst, uint8_t *src, int stride); |
| 87 void ff_put_pixels16x16_c(uint8_t *dst, uint8_t *src, int stride); |
| 88 void ff_avg_pixels16x16_c(uint8_t *dst, uint8_t *src, int stride); |
| 89 |
| 85 /* VP3 DSP functions */ | 90 /* VP3 DSP functions */ |
| 86 void ff_vp3_idct_c(DCTELEM *block/* align 16*/); | 91 void ff_vp3_idct_c(DCTELEM *block/* align 16*/); |
| 87 void ff_vp3_idct_put_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*
align 16*/); | 92 void ff_vp3_idct_put_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*
align 16*/); |
| 88 void ff_vp3_idct_add_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*
align 16*/); | 93 void ff_vp3_idct_add_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*
align 16*/); |
| 89 void ff_vp3_idct_dc_add_c(uint8_t *dest/*align 8*/, int line_size, const DCTELEM
*block/*align 16*/); | 94 void ff_vp3_idct_dc_add_c(uint8_t *dest/*align 8*/, int line_size, const DCTELEM
*block/*align 16*/); |
| 90 | 95 |
| 91 void ff_vp3_v_loop_filter_c(uint8_t *src, int stride, int *bounding_values); | 96 void ff_vp3_v_loop_filter_c(uint8_t *src, int stride, int *bounding_values); |
| 92 void ff_vp3_h_loop_filter_c(uint8_t *src, int stride, int *bounding_values); | 97 void ff_vp3_h_loop_filter_c(uint8_t *src, int stride, int *bounding_values); |
| 93 | 98 |
| 94 /* VP6 DSP functions */ | |
| 95 void ff_vp6_filter_diag4_c(uint8_t *dst, uint8_t *src, int stride, | |
| 96 const int16_t *h_weights, const int16_t *v_weights); | |
| 97 | |
| 98 /* Bink functions */ | 99 /* Bink functions */ |
| 99 void ff_bink_idct_c (DCTELEM *block); | 100 void ff_bink_idct_c (DCTELEM *block); |
| 100 void ff_bink_idct_add_c(uint8_t *dest, int linesize, DCTELEM *block); | 101 void ff_bink_idct_add_c(uint8_t *dest, int linesize, DCTELEM *block); |
| 101 void ff_bink_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block); | 102 void ff_bink_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block); |
| 102 | 103 |
| 103 /* CAVS functions */ | |
| 104 void ff_put_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride); | |
| 105 void ff_avg_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride); | |
| 106 void ff_put_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride); | |
| 107 void ff_avg_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride); | |
| 108 | |
| 109 /* VC1 functions */ | |
| 110 void ff_put_vc1_mspel_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int r
nd); | |
| 111 void ff_avg_vc1_mspel_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int r
nd); | |
| 112 | |
| 113 /* EA functions */ | 104 /* EA functions */ |
| 114 void ff_ea_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block); | 105 void ff_ea_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block); |
| 115 | 106 |
| 116 /* 1/2^n downscaling functions from imgconvert.c */ | 107 /* 1/2^n downscaling functions from imgconvert.c */ |
| 108 #if LIBAVCODEC_VERSION_MAJOR < 53 |
| 109 /** |
| 110 * @deprecated Use av_image_copy_plane() instead. |
| 111 */ |
| 112 attribute_deprecated |
| 117 void ff_img_copy_plane(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_w
rap, int width, int height); | 113 void ff_img_copy_plane(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_w
rap, int width, int height); |
| 114 #endif |
| 115 |
| 118 void ff_shrink22(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, i
nt width, int height); | 116 void ff_shrink22(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, i
nt width, int height); |
| 119 void ff_shrink44(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, i
nt width, int height); | 117 void ff_shrink44(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, i
nt width, int height); |
| 120 void ff_shrink88(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, i
nt width, int height); | 118 void ff_shrink88(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, i
nt width, int height); |
| 121 | 119 |
| 122 void ff_gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, | 120 void ff_gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, |
| 123 int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, i
nt height); | 121 int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, i
nt height); |
| 124 | 122 |
| 125 /* minimum alignment rules ;) | 123 /* minimum alignment rules ;) |
| 126 If you notice errors in the align stuff, need more alignment for some ASM code | 124 If you notice errors in the align stuff, need more alignment for some ASM code |
| 127 for some CPU or need to use a function with less aligned data then send a mail | 125 for some CPU or need to use a function with less aligned data then send a mail |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 | 360 |
| 363 void (*h261_loop_filter)(uint8_t *src, int stride); | 361 void (*h261_loop_filter)(uint8_t *src, int stride); |
| 364 | 362 |
| 365 void (*x8_v_loop_filter)(uint8_t *src, int stride, int qscale); | 363 void (*x8_v_loop_filter)(uint8_t *src, int stride, int qscale); |
| 366 void (*x8_h_loop_filter)(uint8_t *src, int stride, int qscale); | 364 void (*x8_h_loop_filter)(uint8_t *src, int stride, int qscale); |
| 367 | 365 |
| 368 void (*vp3_idct_dc_add)(uint8_t *dest/*align 8*/, int line_size, const DCTEL
EM *block/*align 16*/); | 366 void (*vp3_idct_dc_add)(uint8_t *dest/*align 8*/, int line_size, const DCTEL
EM *block/*align 16*/); |
| 369 void (*vp3_v_loop_filter)(uint8_t *src, int stride, int *bounding_values); | 367 void (*vp3_v_loop_filter)(uint8_t *src, int stride, int *bounding_values); |
| 370 void (*vp3_h_loop_filter)(uint8_t *src, int stride, int *bounding_values); | 368 void (*vp3_h_loop_filter)(uint8_t *src, int stride, int *bounding_values); |
| 371 | 369 |
| 372 void (*vp6_filter_diag4)(uint8_t *dst, uint8_t *src, int stride, | |
| 373 const int16_t *h_weights,const int16_t *v_weights); | |
| 374 | |
| 375 /* assume len is a multiple of 4, and arrays are 16-byte aligned */ | 370 /* assume len is a multiple of 4, and arrays are 16-byte aligned */ |
| 376 void (*vorbis_inverse_coupling)(float *mag, float *ang, int blocksize); | 371 void (*vorbis_inverse_coupling)(float *mag, float *ang, int blocksize); |
| 377 void (*ac3_downmix)(float (*samples)[256], float (*matrix)[2], int out_ch, i
nt in_ch, int len); | 372 void (*ac3_downmix)(float (*samples)[256], float (*matrix)[2], int out_ch, i
nt in_ch, int len); |
| 378 /* no alignment needed */ | 373 /* no alignment needed */ |
| 379 void (*lpc_compute_autocorr)(const int32_t *data, int len, int lag, double *
autoc); | 374 void (*lpc_compute_autocorr)(const int32_t *data, int len, int lag, double *
autoc); |
| 380 /* assume len is a multiple of 8, and arrays are 16-byte aligned */ | 375 /* assume len is a multiple of 8, and arrays are 16-byte aligned */ |
| 381 void (*vector_fmul)(float *dst, const float *src, int len); | 376 void (*vector_fmul)(float *dst, const float *src, int len); |
| 382 void (*vector_fmul_reverse)(float *dst, const float *src0, const float *src1
, int len); | 377 void (*vector_fmul_reverse)(float *dst, const float *src0, const float *src1
, int len); |
| 383 /* assume len is a multiple of 8, and src arrays are 16-byte aligned */ | 378 /* assume len is a multiple of 8, and src arrays are 16-byte aligned */ |
| 384 void (*vector_fmul_add)(float *dst, const float *src0, const float *src1, co
nst float *src2, int len); | 379 void (*vector_fmul_add)(float *dst, const float *src0, const float *src1, co
nst float *src2, int len); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 } | 605 } |
| 611 } | 606 } |
| 612 | 607 |
| 613 /** | 608 /** |
| 614 * Empty mmx state. | 609 * Empty mmx state. |
| 615 * this must be called between any dsp function and float/double code. | 610 * this must be called between any dsp function and float/double code. |
| 616 * for example sin(); dsp->idct_put(); emms_c(); cos() | 611 * for example sin(); dsp->idct_put(); emms_c(); cos() |
| 617 */ | 612 */ |
| 618 #define emms_c() | 613 #define emms_c() |
| 619 | 614 |
| 620 /* should be defined by architectures supporting | |
| 621 one or more MultiMedia extension */ | |
| 622 int mm_support(void); | |
| 623 extern int mm_flags; | |
| 624 | |
| 625 void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx); | 615 void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx); |
| 626 void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx); | 616 void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx); |
| 627 void dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx); | 617 void dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx); |
| 628 void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx); | 618 void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx); |
| 629 void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx); | 619 void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx); |
| 630 void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx); | 620 void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx); |
| 631 void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx); | 621 void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx); |
| 632 void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx); | 622 void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx); |
| 633 void dsputil_init_vis(DSPContext* c, AVCodecContext *avctx); | 623 void dsputil_init_vis(DSPContext* c, AVCodecContext *avctx); |
| 634 | 624 |
| 635 void ff_dsputil_init_dwt(DSPContext *c); | 625 void ff_dsputil_init_dwt(DSPContext *c); |
| 636 void ff_rv30dsp_init(DSPContext* c, AVCodecContext *avctx); | 626 void ff_rv30dsp_init(DSPContext* c, AVCodecContext *avctx); |
| 637 void ff_rv40dsp_init(DSPContext* c, AVCodecContext *avctx); | 627 void ff_rv40dsp_init(DSPContext* c, AVCodecContext *avctx); |
| 638 void ff_vc1dsp_init(DSPContext* c, AVCodecContext *avctx); | 628 void ff_vc1dsp_init(DSPContext* c, AVCodecContext *avctx); |
| 639 void ff_intrax8dsp_init(DSPContext* c, AVCodecContext *avctx); | 629 void ff_intrax8dsp_init(DSPContext* c, AVCodecContext *avctx); |
| 640 void ff_mlp_init(DSPContext* c, AVCodecContext *avctx); | 630 void ff_mlp_init(DSPContext* c, AVCodecContext *avctx); |
| 641 void ff_mlp_init_x86(DSPContext* c, AVCodecContext *avctx); | 631 void ff_mlp_init_x86(DSPContext* c, AVCodecContext *avctx); |
| 642 | 632 |
| 643 #if HAVE_MMX | 633 #if HAVE_MMX |
| 644 | 634 |
| 645 #undef emms_c | 635 #undef emms_c |
| 646 | 636 |
| 647 static inline void emms(void) | 637 static inline void emms(void) |
| 648 { | 638 { |
| 649 __asm__ volatile ("emms;":::"memory"); | 639 __asm__ volatile ("emms;":::"memory"); |
| 650 } | 640 } |
| 651 | 641 |
| 652 | 642 #define emms_c() emms() |
| 653 #define emms_c() \ | |
| 654 {\ | |
| 655 if (mm_flags & FF_MM_MMX)\ | |
| 656 emms();\ | |
| 657 } | |
| 658 | 643 |
| 659 #elif ARCH_ARM | 644 #elif ARCH_ARM |
| 660 | 645 |
| 661 #if HAVE_NEON | 646 #if HAVE_NEON |
| 662 # define STRIDE_ALIGN 16 | 647 # define STRIDE_ALIGN 16 |
| 663 #endif | 648 #endif |
| 664 | 649 |
| 665 #elif ARCH_PPC | 650 #elif ARCH_PPC |
| 666 | 651 |
| 667 #define STRIDE_ALIGN 16 | 652 #define STRIDE_ALIGN 16 |
| 668 | 653 |
| 669 #elif HAVE_MMI | 654 #elif HAVE_MMI |
| 670 | 655 |
| 671 #define STRIDE_ALIGN 16 | 656 #define STRIDE_ALIGN 16 |
| 672 | 657 |
| 673 #else | |
| 674 | |
| 675 #define mm_flags 0 | |
| 676 #define mm_support() 0 | |
| 677 | |
| 678 #endif | 658 #endif |
| 679 | 659 |
| 680 #ifndef STRIDE_ALIGN | 660 #ifndef STRIDE_ALIGN |
| 681 # define STRIDE_ALIGN 8 | 661 # define STRIDE_ALIGN 8 |
| 682 #endif | 662 #endif |
| 683 | 663 |
| 684 #define LOCAL_ALIGNED(a, t, v, s, ...) \ | 664 #define LOCAL_ALIGNED(a, t, v, s, ...) \ |
| 685 uint8_t la_##v[sizeof(t s __VA_ARGS__) + (a)]; \ | 665 uint8_t la_##v[sizeof(t s __VA_ARGS__) + (a)]; \ |
| 686 t (*v) __VA_ARGS__ = (void *)FFALIGN((uintptr_t)la_##v, a) | 666 t (*v) __VA_ARGS__ = (void *)FFALIGN((uintptr_t)la_##v, a) |
| 687 | 667 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 AV_WN32(dst+4 , AV_RN32(src+4 )); | 773 AV_WN32(dst+4 , AV_RN32(src+4 )); |
| 794 AV_WN32(dst+8 , AV_RN32(src+8 )); | 774 AV_WN32(dst+8 , AV_RN32(src+8 )); |
| 795 AV_WN32(dst+12, AV_RN32(src+12)); | 775 AV_WN32(dst+12, AV_RN32(src+12)); |
| 796 dst[16]= src[16]; | 776 dst[16]= src[16]; |
| 797 dst+=dstStride; | 777 dst+=dstStride; |
| 798 src+=srcStride; | 778 src+=srcStride; |
| 799 } | 779 } |
| 800 } | 780 } |
| 801 | 781 |
| 802 #endif /* AVCODEC_DSPUTIL_H */ | 782 #endif /* AVCODEC_DSPUTIL_H */ |
| OLD | NEW |