FFmpeg
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dsputil_mmx.h
Go to the documentation of this file.
1 /*
2  * MMX optimized DSP utils
3  * Copyright (c) 2007 Aurelien Jacobs <aurel@gnuage.org>
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef AVCODEC_X86_DSPUTIL_MMX_H
23 #define AVCODEC_X86_DSPUTIL_MMX_H
24 
25 #include <stdint.h>
26 #include "libavcodec/dsputil.h"
27 #include "libavutil/x86/asm.h"
28 
29 typedef struct xmm_reg { uint64_t a, b; } xmm_reg;
30 
31 extern const uint64_t ff_bone;
32 extern const uint64_t ff_wtwo;
33 
34 extern const uint64_t ff_pdw_80000000[2];
35 
36 extern const xmm_reg ff_pw_3;
37 extern const xmm_reg ff_pw_4;
38 extern const xmm_reg ff_pw_5;
39 extern const xmm_reg ff_pw_8;
40 extern const uint64_t ff_pw_15;
41 extern const xmm_reg ff_pw_16;
42 extern const xmm_reg ff_pw_18;
43 extern const uint64_t ff_pw_20;
44 extern const xmm_reg ff_pw_27;
45 extern const xmm_reg ff_pw_28;
46 extern const xmm_reg ff_pw_32;
47 extern const uint64_t ff_pw_42;
48 extern const uint64_t ff_pw_53;
49 extern const xmm_reg ff_pw_63;
50 extern const xmm_reg ff_pw_64;
51 extern const uint64_t ff_pw_96;
52 extern const uint64_t ff_pw_128;
53 extern const uint64_t ff_pw_255;
54 
55 extern const xmm_reg ff_pb_1;
56 extern const xmm_reg ff_pb_3;
57 extern const uint64_t ff_pb_7;
58 extern const uint64_t ff_pb_1F;
59 extern const uint64_t ff_pb_3F;
60 extern const uint64_t ff_pb_81;
61 extern const xmm_reg ff_pb_A1;
62 extern const xmm_reg ff_pb_F8;
63 extern const uint64_t ff_pb_FC;
64 extern const xmm_reg ff_pb_FE;
65 
66 extern const double ff_pd_1[2];
67 extern const double ff_pd_2[2];
68 
69 #define SBUTTERFLY(a,b,t,n,m)\
70  "mov" #m " " #a ", " #t " \n\t" /* abcd */\
71  "punpckl" #n " " #b ", " #a " \n\t" /* aebf */\
72  "punpckh" #n " " #b ", " #t " \n\t" /* cgdh */\
73 
74 #define TRANSPOSE4(a,b,c,d,t)\
75  SBUTTERFLY(a,b,t,wd,q) /* a=aebf t=cgdh */\
76  SBUTTERFLY(c,d,b,wd,q) /* c=imjn b=kolp */\
77  SBUTTERFLY(a,c,d,dq,q) /* a=aeim d=bfjn */\
78  SBUTTERFLY(t,b,c,dq,q) /* t=cgko c=dhlp */
79 
80 #define MOVQ_WONE(regd) \
81  __asm__ volatile ( \
82  "pcmpeqd %%" #regd ", %%" #regd " \n\t" \
83  "psrlw $15, %%" #regd ::)
84 
87 
88 void ff_add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size);
89 void ff_put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size);
90 void ff_put_signed_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size);
91 
96 
97 void ff_put_vc1_mspel_mc00_mmx(uint8_t *dst, const uint8_t *src, int stride, int rnd);
98 void ff_avg_vc1_mspel_mc00_mmxext(uint8_t *dst, const uint8_t *src, int stride, int rnd);
99 
100 void ff_put_rv40_qpel8_mc33_mmx(uint8_t *block, uint8_t *pixels, int line_size);
101 void ff_put_rv40_qpel16_mc33_mmx(uint8_t *block, uint8_t *pixels, int line_size);
102 void ff_avg_rv40_qpel8_mc33_mmx(uint8_t *block, uint8_t *pixels, int line_size);
103 void ff_avg_rv40_qpel16_mc33_mmx(uint8_t *block, uint8_t *pixels, int line_size);
104 
105 void ff_mmx_idct(DCTELEM *block);
107 
108 
110  const uint8_t *lum_m4, const uint8_t *lum_m3,
111  const uint8_t *lum_m2, const uint8_t *lum_m1,
112  const uint8_t *lum,
113  int size);
114 
115 void ff_deinterlace_line_inplace_mmx(const uint8_t *lum_m4,
116  const uint8_t *lum_m3,
117  const uint8_t *lum_m2,
118  const uint8_t *lum_m1,
119  const uint8_t *lum, int size);
120 
121 #endif /* AVCODEC_X86_DSPUTIL_MMX_H */