comparison dsputil.h @ 936:caa77cd960c0 libavcodec

qpel encoding 4mv+b frames encoding finally fixed chroma ME 5 comparission functions for ME b frame encoding speedup wmv2 codec (unfinished) user specified diamond size for EPZS
author michaelni
date Fri, 27 Dec 2002 23:51:46 +0000
parents a408778eff87
children 13aec7e50c52
comparison
equal deleted inserted replaced
935:c9bbd35064b6 936:caa77cd960c0
77 b(block+n, pixels+n, line_size, h);\ 77 b(block+n, pixels+n, line_size, h);\
78 } 78 }
79 79
80 /* motion estimation */ 80 /* motion estimation */
81 81
82 typedef int (*op_pixels_abs_func)(UINT8 *blk1/*align width (8 or 16)*/, UINT8 *blk2/*align 1*/, int line_size); 82 typedef int (*op_pixels_abs_func)(UINT8 *blk1/*align width (8 or 16)*/, UINT8 *blk2/*align 1*/, int line_size)/* __attribute__ ((const))*/;
83 /* 83
84 int pix_abs16x16_c(UINT8 *blk1, UINT8 *blk2, int lx); 84 typedef int (*me_cmp_func)(void /*MpegEncContext*/ *s, UINT8 *blk1/*align width (8 or 16)*/, UINT8 *blk2/*align 1*/, int line_size)/* __attribute__ ((const))*/;
85 int pix_abs16x16_x2_c(UINT8 *blk1, UINT8 *blk2, int lx); 85
86 int pix_abs16x16_y2_c(UINT8 *blk1, UINT8 *blk2, int lx);
87 int pix_abs16x16_xy2_c(UINT8 *blk1, UINT8 *blk2, int lx);
88 */
89 typedef struct DSPContext { 86 typedef struct DSPContext {
90 /* pixel ops : interface with DCT */ 87 /* pixel ops : interface with DCT */
91 void (*get_pixels)(DCTELEM *block/*align 16*/, const UINT8 *pixels/*align 8*/, int line_size); 88 void (*get_pixels)(DCTELEM *block/*align 16*/, const UINT8 *pixels/*align 8*/, int line_size);
92 void (*diff_pixels)(DCTELEM *block/*align 16*/, const UINT8 *s1/*align 8*/, const UINT8 *s2/*align 8*/, int stride); 89 void (*diff_pixels)(DCTELEM *block/*align 16*/, const UINT8 *s1/*align 8*/, const UINT8 *s2/*align 8*/, int stride);
93 void (*put_pixels_clamped)(const DCTELEM *block/*align 16*/, UINT8 *pixels/*align 8*/, int line_size); 90 void (*put_pixels_clamped)(const DCTELEM *block/*align 16*/, UINT8 *pixels/*align 8*/, int line_size);
96 void (*gmc )(UINT8 *dst/*align 8*/, UINT8 *src/*align 1*/, int stride, int h, int ox, int oy, 93 void (*gmc )(UINT8 *dst/*align 8*/, UINT8 *src/*align 1*/, int stride, int h, int ox, int oy,
97 int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height); 94 int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height);
98 void (*clear_blocks)(DCTELEM *blocks/*align 16*/); 95 void (*clear_blocks)(DCTELEM *blocks/*align 16*/);
99 int (*pix_sum)(UINT8 * pix, int line_size); 96 int (*pix_sum)(UINT8 * pix, int line_size);
100 int (*pix_norm1)(UINT8 * pix, int line_size); 97 int (*pix_norm1)(UINT8 * pix, int line_size);
101 int (*pix_norm)(UINT8 * pix1, UINT8 * pix2, int line_size); 98 me_cmp_func sad[2]; /* identical to pix_absAxA except additional void * */
99 me_cmp_func sse[2];
100 me_cmp_func hadamard8_diff[2];
101 me_cmp_func dct_sad[2];
102 me_cmp_func quant_psnr[2];
103 int (*hadamard8_abs )(uint8_t *src, int stride, int mean);
104
105 me_cmp_func me_cmp[11];
106 me_cmp_func me_sub_cmp[11];
107 me_cmp_func mb_cmp[11];
102 108
103 /* maybe create an array for 16/8 functions */ 109 /* maybe create an array for 16/8 functions */
104 op_pixels_func put_pixels_tab[2][4]; 110 op_pixels_func put_pixels_tab[2][4];
105 op_pixels_func avg_pixels_tab[2][4]; 111 op_pixels_func avg_pixels_tab[2][4];
106 op_pixels_func put_no_rnd_pixels_tab[2][4]; 112 op_pixels_func put_no_rnd_pixels_tab[2][4];
107 op_pixels_func avg_no_rnd_pixels_tab[2][4]; 113 op_pixels_func avg_no_rnd_pixels_tab[2][4];
108 qpel_mc_func put_qpel_pixels_tab[2][16]; 114 qpel_mc_func put_qpel_pixels_tab[2][16];
109 qpel_mc_func avg_qpel_pixels_tab[2][16]; 115 qpel_mc_func avg_qpel_pixels_tab[2][16];
110 qpel_mc_func put_no_rnd_qpel_pixels_tab[2][16]; 116 qpel_mc_func put_no_rnd_qpel_pixels_tab[2][16];
111 qpel_mc_func avg_no_rnd_qpel_pixels_tab[2][16]; 117 qpel_mc_func avg_no_rnd_qpel_pixels_tab[2][16];
118 qpel_mc_func put_mspel_pixels_tab[8];
112 119
113 op_pixels_abs_func pix_abs16x16; 120 op_pixels_abs_func pix_abs16x16;
114 op_pixels_abs_func pix_abs16x16_x2; 121 op_pixels_abs_func pix_abs16x16_x2;
115 op_pixels_abs_func pix_abs16x16_y2; 122 op_pixels_abs_func pix_abs16x16_y2;
116 op_pixels_abs_func pix_abs16x16_xy2; 123 op_pixels_abs_func pix_abs16x16_xy2;
118 op_pixels_abs_func pix_abs8x8_x2; 125 op_pixels_abs_func pix_abs8x8_x2;
119 op_pixels_abs_func pix_abs8x8_y2; 126 op_pixels_abs_func pix_abs8x8_y2;
120 op_pixels_abs_func pix_abs8x8_xy2; 127 op_pixels_abs_func pix_abs8x8_xy2;
121 128
122 /* huffyuv specific */ 129 /* huffyuv specific */
123 //FIXME note: alignment isnt guranteed currently but could be if needed
124 void (*add_bytes)(uint8_t *dst/*align 16*/, uint8_t *src/*align 16*/, int w); 130 void (*add_bytes)(uint8_t *dst/*align 16*/, uint8_t *src/*align 16*/, int w);
125 void (*diff_bytes)(uint8_t *dst/*align 16*/, uint8_t *src1/*align 16*/, uint8_t *src2/*align 16*/,int w); 131 void (*diff_bytes)(uint8_t *dst/*align 16*/, uint8_t *src1/*align 16*/, uint8_t *src2/*align 1*/,int w);
126 } DSPContext; 132 } DSPContext;
127 133
128 void dsputil_init(DSPContext* p, unsigned mask); 134 void dsputil_init(DSPContext* p, unsigned mask);
129 135
130 /** 136 /**
153 159
154 static inline void emms(void) 160 static inline void emms(void)
155 { 161 {
156 __asm __volatile ("emms;":::"memory"); 162 __asm __volatile ("emms;":::"memory");
157 } 163 }
164
158 165
159 #define emms_c() \ 166 #define emms_c() \
160 {\ 167 {\
161 if (mm_flags & MM_MMX)\ 168 if (mm_flags & MM_MMX)\
162 emms();\ 169 emms();\
279 const FFTSample *input, FFTSample *tmp); 286 const FFTSample *input, FFTSample *tmp);
280 void ff_mdct_calc(MDCTContext *s, FFTSample *out, 287 void ff_mdct_calc(MDCTContext *s, FFTSample *out,
281 const FFTSample *input, FFTSample *tmp); 288 const FFTSample *input, FFTSample *tmp);
282 void ff_mdct_end(MDCTContext *s); 289 void ff_mdct_end(MDCTContext *s);
283 290
291 #define WARPER88_1616(name8, name16)\
292 static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int stride){\
293 return name8(s, dst , src , stride)\
294 +name8(s, dst+8 , src+8 , stride)\
295 +name8(s, dst +8*stride, src +8*stride, stride)\
296 +name8(s, dst+8+8*stride, src+8+8*stride, stride);\
297 }
298
284 #ifndef HAVE_LRINTF 299 #ifndef HAVE_LRINTF
285 /* XXX: add ISOC specific test to avoid specific BSD testing. */ 300 /* XXX: add ISOC specific test to avoid specific BSD testing. */
286 /* better than nothing implementation. */ 301 /* better than nothing implementation. */
287 /* btw, rintf() is existing on fbsd too -- alex */ 302 /* btw, rintf() is existing on fbsd too -- alex */
288 static inline long int lrintf(float x) 303 static inline long int lrintf(float x)