Statistics
| Branch: | Revision:

ffmpeg / libavcodec / dsputil.h @ 2029f312

History | View | Annotate | Download (27.7 KB)

1 ff4ec49e Fabrice Bellard
/*
2
 * DSP utils
3
 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard.
4 8f2ab833 Michael Niedermayer
 * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
5 ff4ec49e Fabrice Bellard
 *
6 b78e7197 Diego Biurrun
 * This file is part of FFmpeg.
7
 *
8
 * FFmpeg is free software; you can redistribute it and/or
9 ff4ec49e Fabrice Bellard
 * modify it under the terms of the GNU Lesser General Public
10
 * License as published by the Free Software Foundation; either
11 b78e7197 Diego Biurrun
 * version 2.1 of the License, or (at your option) any later version.
12 ff4ec49e Fabrice Bellard
 *
13 b78e7197 Diego Biurrun
 * FFmpeg is distributed in the hope that it will be useful,
14 ff4ec49e Fabrice Bellard
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
 * Lesser General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU Lesser General Public
19 b78e7197 Diego Biurrun
 * License along with FFmpeg; if not, write to the Free Software
20 5509bffa Diego Biurrun
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 ff4ec49e Fabrice Bellard
 */
22 24641185 Michael Niedermayer
23
/**
24
 * @file dsputil.h
25 983e3246 Michael Niedermayer
 * DSP utils.
26 5755c27f Michael Niedermayer
 * note, many functions in here may use MMX which trashes the FPU state, it is
27
 * absolutely necessary to call emms_c() between dsp & float/double code
28 24641185 Michael Niedermayer
 */
29
30 de6d9b64 Fabrice Bellard
#ifndef DSPUTIL_H
31
#define DSPUTIL_H
32
33 43f1708f Juanjo
#include "avcodec.h"
34 de6d9b64 Fabrice Bellard
35 24641185 Michael Niedermayer
36 44eb4951 Michael Niedermayer
//#define DEBUG
37 de6d9b64 Fabrice Bellard
/* dct code */
38
typedef short DCTELEM;
39 059715a4 Robert Edele
typedef int DWTELEM;
40 de6d9b64 Fabrice Bellard
41 03c94ede Fabrice Bellard
void fdct_ifast (DCTELEM *data);
42 48b1f800 Roman Shaposhnik
void fdct_ifast248 (DCTELEM *data);
43 28db7fce Michael Niedermayer
void ff_jpeg_fdct_islow (DCTELEM *data);
44 10acc479 Roman Shaposhnik
void ff_fdct248_islow (DCTELEM *data);
45 de6d9b64 Fabrice Bellard
46
void j_rev_dct (DCTELEM *data);
47 178fcca8 Michael Niedermayer
void j_rev_dct4 (DCTELEM *data);
48 9ca358b9 Michael Niedermayer
void j_rev_dct2 (DCTELEM *data);
49 1aa8c57b Michael Niedermayer
void j_rev_dct1 (DCTELEM *data);
50 de6d9b64 Fabrice Bellard
51 3f09f52a Arpi
void ff_fdct_mmx(DCTELEM *block);
52 cf3bf5bb Michael Niedermayer
void ff_fdct_mmx2(DCTELEM *block);
53 8fd19ab2 Michael Niedermayer
void ff_fdct_sse2(DCTELEM *block);
54 de6d9b64 Fabrice Bellard
55 43efd19a Loren Merritt
void ff_h264_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride);
56 0fa8158d Michael Niedermayer
void ff_h264_idct_add_c(uint8_t *dst, DCTELEM *block, int stride);
57 ef9d1d15 Loren Merritt
void ff_h264_idct8_dc_add_c(uint8_t *dst, DCTELEM *block, int stride);
58
void ff_h264_idct_dc_add_c(uint8_t *dst, DCTELEM *block, int stride);
59 0fa8158d Michael Niedermayer
void ff_h264_lowres_idct_add_c(uint8_t *dst, int stride, DCTELEM *block);
60
void ff_h264_lowres_idct_put_c(uint8_t *dst, int stride, DCTELEM *block);
61
62 eb4825b5 Loren Merritt
void ff_vector_fmul_add_add_c(float *dst, const float *src0, const float *src1,
63
                              const float *src2, int src3, int blocksize, int step);
64
void ff_float_to_int16_c(int16_t *dst, const float *src, int len);
65
66 e0eac44e Fabrice Bellard
/* encoding scans */
67 0c1a9eda Zdenek Kabelac
extern const uint8_t ff_alternate_horizontal_scan[64];
68
extern const uint8_t ff_alternate_vertical_scan[64];
69
extern const uint8_t ff_zigzag_direct[64];
70 10acc479 Roman Shaposhnik
extern const uint8_t ff_zigzag248_direct[64];
71 5a240838 Michael Niedermayer
72 de6d9b64 Fabrice Bellard
/* pixel operations */
73 f2e92ef2 Michael Niedermayer
#define MAX_NEG_CROP 1024
74 de6d9b64 Fabrice Bellard
75
/* temporary */
76 1d503957 Måns Rullgård
extern uint32_t ff_squareTbl[512];
77 55fde95e Måns Rullgård
extern uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP];
78 de6d9b64 Fabrice Bellard
79 44cb64ee Mike Melanson
/* VP3 DSP functions */
80 8b6103da Michael Niedermayer
void ff_vp3_idct_c(DCTELEM *block/* align 16*/);
81
void ff_vp3_idct_put_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
82
void ff_vp3_idct_add_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
83 de6d9b64 Fabrice Bellard
84 54009d42 Michael Niedermayer
/* 1/2^n downscaling functions from imgconvert.c */
85
void ff_img_copy_plane(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
86
void ff_shrink22(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
87
void ff_shrink44(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
88
void ff_shrink88(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
89 703c8195 Loren Merritt
90
void ff_gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy,
91
              int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height);
92 54009d42 Michael Niedermayer
93 b7c27ee6 Michael Niedermayer
/* minimum alignment rules ;)
94 eb4b3dd3 Zdenek Kabelac
if u notice errors in the align stuff, need more alignment for some asm code for some cpu
95 b7c27ee6 Michael Niedermayer
or need to use a function with less aligned data then send a mail to the ffmpeg-dev list, ...
96

97
!warning these alignments might not match reallity, (missing attribute((align)) stuff somewhere possible)
98
i (michael) didnt check them, these are just the alignents which i think could be reached easily ...
99 de6d9b64 Fabrice Bellard

100 b7c27ee6 Michael Niedermayer
!future video codecs might need functions with less strict alignment
101
*/
102
103 eb4b3dd3 Zdenek Kabelac
/*
104 0c1a9eda Zdenek Kabelac
void get_pixels_c(DCTELEM *block, const uint8_t *pixels, int line_size);
105
void diff_pixels_c(DCTELEM *block, const uint8_t *s1, const uint8_t *s2, int stride);
106
void put_pixels_clamped_c(const DCTELEM *block, uint8_t *pixels, int line_size);
107
void add_pixels_clamped_c(const DCTELEM *block, uint8_t *pixels, int line_size);
108 649c00c9 Michael Niedermayer
void clear_blocks_c(DCTELEM *blocks);
109 eb4b3dd3 Zdenek Kabelac
*/
110 de6d9b64 Fabrice Bellard
111
/* add and put pixel (decoding) */
112 b7c27ee6 Michael Niedermayer
// blocksizes for op_pixels_func are 8x4,8x8 16x8 16x16
113 7d67aa9b Michael Niedermayer
//h for op_pixels_func is limited to {width/2, width} but never larger than 16 and never smaller then 4
114 0c1a9eda Zdenek Kabelac
typedef void (*op_pixels_func)(uint8_t *block/*align width (8 or 16)*/, const uint8_t *pixels/*align 1*/, int line_size, int h);
115 669ac79c Michael Niedermayer
typedef void (*tpel_mc_func)(uint8_t *block/*align width (8 or 16)*/, const uint8_t *pixels/*align 1*/, int line_size, int w, int h);
116 0c1a9eda Zdenek Kabelac
typedef void (*qpel_mc_func)(uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride);
117 0da71265 Michael Niedermayer
typedef void (*h264_chroma_mc_func)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride, int h, int x, int y);
118 9f2d1b4f Loren Merritt
typedef void (*h264_weight_func)(uint8_t *block, int stride, int log2_denom, int weight, int offset);
119 e8b56208 Loren Merritt
typedef void (*h264_biweight_func)(uint8_t *dst, uint8_t *src, int stride, int log2_denom, int weightd, int weights, int offset);
120 b3184779 Michael Niedermayer
121 db794953 Michael Niedermayer
#define DEF_OLD_QPEL(name)\
122 0c1a9eda Zdenek Kabelac
void ff_put_        ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride);\
123
void ff_put_no_rnd_ ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride);\
124
void ff_avg_        ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride);
125 db794953 Michael Niedermayer
126
DEF_OLD_QPEL(qpel16_mc11_old_c)
127
DEF_OLD_QPEL(qpel16_mc31_old_c)
128
DEF_OLD_QPEL(qpel16_mc12_old_c)
129
DEF_OLD_QPEL(qpel16_mc32_old_c)
130
DEF_OLD_QPEL(qpel16_mc13_old_c)
131
DEF_OLD_QPEL(qpel16_mc33_old_c)
132
DEF_OLD_QPEL(qpel8_mc11_old_c)
133
DEF_OLD_QPEL(qpel8_mc31_old_c)
134
DEF_OLD_QPEL(qpel8_mc12_old_c)
135
DEF_OLD_QPEL(qpel8_mc32_old_c)
136
DEF_OLD_QPEL(qpel8_mc13_old_c)
137
DEF_OLD_QPEL(qpel8_mc33_old_c)
138 b3184779 Michael Niedermayer
139
#define CALL_2X_PIXELS(a, b, n)\
140
static void a(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
141
    b(block  , pixels  , line_size, h);\
142
    b(block+n, pixels+n, line_size, h);\
143
}
144 44eb4951 Michael Niedermayer
145 de6d9b64 Fabrice Bellard
/* motion estimation */
146 7d67aa9b Michael Niedermayer
// h is limited to {width/2, width, 2*width} but never larger than 16 and never smaller then 2
147
// allthough currently h<4 is not used as functions with width <8 are not used and neither implemented
148 bb198e19 Michael Niedermayer
typedef int (*me_cmp_func)(void /*MpegEncContext*/ *s, uint8_t *blk1/*align width (8 or 16)*/, uint8_t *blk2/*align 1*/, int line_size, int h)/* __attribute__ ((const))*/;
149 1457ab52 Michael Niedermayer
150 0da71265 Michael Niedermayer
151 059715a4 Robert Edele
// for snow slices
152
typedef struct slice_buffer_s slice_buffer;
153
154 24641185 Michael Niedermayer
/**
155
 * DSPContext.
156
 */
157 eb4b3dd3 Zdenek Kabelac
typedef struct DSPContext {
158
    /* pixel ops : interface with DCT */
159 0c1a9eda Zdenek Kabelac
    void (*get_pixels)(DCTELEM *block/*align 16*/, const uint8_t *pixels/*align 8*/, int line_size);
160
    void (*diff_pixels)(DCTELEM *block/*align 16*/, const uint8_t *s1/*align 8*/, const uint8_t *s2/*align 8*/, int stride);
161
    void (*put_pixels_clamped)(const DCTELEM *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size);
162 f9ed9d85 Mike Melanson
    void (*put_signed_pixels_clamped)(const DCTELEM *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size);
163 0c1a9eda Zdenek Kabelac
    void (*add_pixels_clamped)(const DCTELEM *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size);
164 36940eca Loren Merritt
    void (*add_pixels8)(uint8_t *pixels, DCTELEM *block, int line_size);
165
    void (*add_pixels4)(uint8_t *pixels, DCTELEM *block, int line_size);
166 d518aebd Michael Niedermayer
    /**
167
     * translational global motion compensation.
168
     */
169 0c1a9eda Zdenek Kabelac
    void (*gmc1)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride, int h, int x16, int y16, int rounder);
170 d518aebd Michael Niedermayer
    /**
171
     * global motion compensation.
172
     */
173 0c1a9eda Zdenek Kabelac
    void (*gmc )(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int ox, int oy,
174 bb270c08 Diego Biurrun
                    int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height);
175 eb4b3dd3 Zdenek Kabelac
    void (*clear_blocks)(DCTELEM *blocks/*align 16*/);
176 0c1a9eda Zdenek Kabelac
    int (*pix_sum)(uint8_t * pix, int line_size);
177
    int (*pix_norm1)(uint8_t * pix, int line_size);
178 bb198e19 Michael Niedermayer
// 16x16 8x8 4x4 2x2 16x8 8x4 4x2 8x16 4x8 2x4
179 115329f1 Diego Biurrun
180 622348f9 Michael Niedermayer
    me_cmp_func sad[5]; /* identical to pix_absAxA except additional void * */
181
    me_cmp_func sse[5];
182
    me_cmp_func hadamard8_diff[5];
183
    me_cmp_func dct_sad[5];
184
    me_cmp_func quant_psnr[5];
185
    me_cmp_func bit[5];
186
    me_cmp_func rd[5];
187
    me_cmp_func vsad[5];
188
    me_cmp_func vsse[5];
189 e6a2ac34 Michael Niedermayer
    me_cmp_func nsse[5];
190 26efc54e Michael Niedermayer
    me_cmp_func w53[5];
191
    me_cmp_func w97[5];
192 0fd6aea1 Michael Niedermayer
    me_cmp_func dct_max[5];
193 27c61ac5 Michael Niedermayer
    me_cmp_func dct264_sad[5];
194 1457ab52 Michael Niedermayer
195 bb198e19 Michael Niedermayer
    me_cmp_func me_pre_cmp[5];
196
    me_cmp_func me_cmp[5];
197
    me_cmp_func me_sub_cmp[5];
198
    me_cmp_func mb_cmp[5];
199 622348f9 Michael Niedermayer
    me_cmp_func ildct_cmp[5]; //only width 16 used
200 0fd6aea1 Michael Niedermayer
    me_cmp_func frame_skip_cmp[5]; //only width 8 used
201 eb4b3dd3 Zdenek Kabelac
202 59006372 Loren Merritt
    int (*ssd_int8_vs_int16)(int8_t *pix1, int16_t *pix2, int size);
203
204 d518aebd Michael Niedermayer
    /**
205
     * Halfpel motion compensation with rounding (a+b+1)>>1.
206 30f15053 Luca Barbato
     * this is an array[4][4] of motion compensation functions for 4
207 e5771f4f Michael Niedermayer
     * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
208 5755c27f Michael Niedermayer
     * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
209 d518aebd Michael Niedermayer
     * @param block destination where the result is stored
210
     * @param pixels source
211
     * @param line_size number of bytes in a horizontal line of block
212
     * @param h height
213
     */
214 669ac79c Michael Niedermayer
    op_pixels_func put_pixels_tab[4][4];
215 d518aebd Michael Niedermayer
216
    /**
217
     * Halfpel motion compensation with rounding (a+b+1)>>1.
218 115329f1 Diego Biurrun
     * This is an array[4][4] of motion compensation functions for 4
219 e5771f4f Michael Niedermayer
     * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
220 5755c27f Michael Niedermayer
     * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
221 d518aebd Michael Niedermayer
     * @param block destination into which the result is averaged (a+b+1)>>1
222
     * @param pixels source
223
     * @param line_size number of bytes in a horizontal line of block
224
     * @param h height
225
     */
226 da3b9756 Mike Melanson
    op_pixels_func avg_pixels_tab[4][4];
227 d518aebd Michael Niedermayer
228
    /**
229
     * Halfpel motion compensation with no rounding (a+b)>>1.
230 30f15053 Luca Barbato
     * this is an array[2][4] of motion compensation functions for 2
231 eb14c713 Michael Niedermayer
     * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
232 5755c27f Michael Niedermayer
     * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
233 d518aebd Michael Niedermayer
     * @param block destination where the result is stored
234
     * @param pixels source
235
     * @param line_size number of bytes in a horizontal line of block
236
     * @param h height
237
     */
238 dbc56b39 Michael Niedermayer
    op_pixels_func put_no_rnd_pixels_tab[4][4];
239 d518aebd Michael Niedermayer
240
    /**
241
     * Halfpel motion compensation with no rounding (a+b)>>1.
242 30f15053 Luca Barbato
     * this is an array[2][4] of motion compensation functions for 2
243 eb14c713 Michael Niedermayer
     * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
244 5755c27f Michael Niedermayer
     * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
245 d518aebd Michael Niedermayer
     * @param block destination into which the result is averaged (a+b)>>1
246
     * @param pixels source
247
     * @param line_size number of bytes in a horizontal line of block
248
     * @param h height
249
     */
250 dbc56b39 Michael Niedermayer
    op_pixels_func avg_no_rnd_pixels_tab[4][4];
251 115329f1 Diego Biurrun
252 c0a0170c Michael Niedermayer
    void (*put_no_rnd_pixels_l2[2])(uint8_t *block/*align width (8 or 16)*/, const uint8_t *a/*align 1*/, const uint8_t *b/*align 1*/, int line_size, int h);
253 115329f1 Diego Biurrun
254 669ac79c Michael Niedermayer
    /**
255
     * Thirdpel motion compensation with rounding (a+b+1)>>1.
256 30f15053 Luca Barbato
     * this is an array[12] of motion compensation functions for the 9 thirdpe
257
     * positions<br>
258 669ac79c Michael Niedermayer
     * *pixels_tab[ xthirdpel + 4*ythirdpel ]
259
     * @param block destination where the result is stored
260
     * @param pixels source
261
     * @param line_size number of bytes in a horizontal line of block
262
     * @param h height
263
     */
264
    tpel_mc_func put_tpel_pixels_tab[11]; //FIXME individual func ptr per width?
265 da3b9756 Mike Melanson
    tpel_mc_func avg_tpel_pixels_tab[11]; //FIXME individual func ptr per width?
266
267 eb4b3dd3 Zdenek Kabelac
    qpel_mc_func put_qpel_pixels_tab[2][16];
268
    qpel_mc_func avg_qpel_pixels_tab[2][16];
269
    qpel_mc_func put_no_rnd_qpel_pixels_tab[2][16];
270
    qpel_mc_func avg_no_rnd_qpel_pixels_tab[2][16];
271 1457ab52 Michael Niedermayer
    qpel_mc_func put_mspel_pixels_tab[8];
272 115329f1 Diego Biurrun
273 0da71265 Michael Niedermayer
    /**
274 30f15053 Luca Barbato
     * h264 Chroma MC
275 0da71265 Michael Niedermayer
     */
276
    h264_chroma_mc_func put_h264_chroma_pixels_tab[3];
277 e34350a3 Kostya Shishkov
    /* This is really one func used in VC-1 decoding */
278
    h264_chroma_mc_func put_no_rnd_h264_chroma_pixels_tab[3];
279 0da71265 Michael Niedermayer
    h264_chroma_mc_func avg_h264_chroma_pixels_tab[3];
280 eb4b3dd3 Zdenek Kabelac
281 80e44bc3 Michael Niedermayer
    qpel_mc_func put_h264_qpel_pixels_tab[4][16];
282
    qpel_mc_func avg_h264_qpel_pixels_tab[4][16];
283 115329f1 Diego Biurrun
284 2833fc46 Loren Merritt
    qpel_mc_func put_2tap_qpel_pixels_tab[4][16];
285
    qpel_mc_func avg_2tap_qpel_pixels_tab[4][16];
286
287 9f2d1b4f Loren Merritt
    h264_weight_func weight_h264_pixels_tab[10];
288
    h264_biweight_func biweight_h264_pixels_tab[10];
289 115329f1 Diego Biurrun
290 b482e2d1 Michael Niedermayer
    /* AVS specific */
291
    qpel_mc_func put_cavs_qpel_pixels_tab[2][16];
292
    qpel_mc_func avg_cavs_qpel_pixels_tab[2][16];
293
    void (*cavs_filter_lv)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2);
294
    void (*cavs_filter_lh)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2);
295
    void (*cavs_filter_cv)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2);
296
    void (*cavs_filter_ch)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2);
297
    void (*cavs_idct8_add)(uint8_t *dst, DCTELEM *block, int stride);
298
299 bb198e19 Michael Niedermayer
    me_cmp_func pix_abs[2][4];
300 115329f1 Diego Biurrun
301 11f18faf Michael Niedermayer
    /* huffyuv specific */
302
    void (*add_bytes)(uint8_t *dst/*align 16*/, uint8_t *src/*align 16*/, int w);
303 1457ab52 Michael Niedermayer
    void (*diff_bytes)(uint8_t *dst/*align 16*/, uint8_t *src1/*align 16*/, uint8_t *src2/*align 1*/,int w);
304 84705403 Michael Niedermayer
    /**
305
     * subtract huffyuv's variant of median prediction
306
     * note, this might read from src1[-1], src2[-1]
307
     */
308
    void (*sub_hfyu_median_prediction)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w, int *left, int *left_top);
309 3d2e8cce Michael Niedermayer
    void (*bswap_buf)(uint32_t *dst, uint32_t *src, int w);
310 42251a2a Loren Merritt
311 5cf08f23 Loren Merritt
    void (*h264_v_loop_filter_luma)(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0);
312
    void (*h264_h_loop_filter_luma)(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0);
313
    void (*h264_v_loop_filter_chroma)(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0);
314
    void (*h264_h_loop_filter_chroma)(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0);
315
    void (*h264_v_loop_filter_chroma_intra)(uint8_t *pix, int stride, int alpha, int beta);
316
    void (*h264_h_loop_filter_chroma_intra)(uint8_t *pix, int stride, int alpha, int beta);
317 3e20143e Loren Merritt
    // h264_loop_filter_strength: simd only. the C version is inlined in h264.c
318
    void (*h264_loop_filter_strength)(int16_t bS[2][4][4], uint8_t nnz[40], int8_t ref[2][40], int16_t mv[2][40][2],
319
                                      int bidir, int edges, int step, int mask_mv0, int mask_mv1);
320 115329f1 Diego Biurrun
321 332f9ac4 Michael Niedermayer
    void (*h263_v_loop_filter)(uint8_t *src, int stride, int qscale);
322
    void (*h263_h_loop_filter)(uint8_t *src, int stride, int qscale);
323
324 fdbbf2e0 Michael Niedermayer
    void (*h261_loop_filter)(uint8_t *src, int stride);
325 c6148de2 Michael Niedermayer
326 eb4825b5 Loren Merritt
    /* assume len is a multiple of 4, and arrays are 16-byte aligned */
327 2dac4acf Loren Merritt
    void (*vorbis_inverse_coupling)(float *mag, float *ang, int blocksize);
328 eb4825b5 Loren Merritt
    /* assume len is a multiple of 8, and arrays are 16-byte aligned */
329 06972056 Loren Merritt
    void (*vector_fmul)(float *dst, const float *src, int len);
330 eb4825b5 Loren Merritt
    void (*vector_fmul_reverse)(float *dst, const float *src0, const float *src1, int len);
331
    /* assume len is a multiple of 8, and src arrays are 16-byte aligned */
332
    void (*vector_fmul_add_add)(float *dst, const float *src0, const float *src1, const float *src2, int src3, int len, int step);
333
334
    /* C version: convert floats from the range [384.0,386.0] to ints in [-32768,32767]
335 98145875 Luca Barbato
     * simd versions: convert floats from [-32768.0,32767.0] without rescaling and arrays are 16byte aligned */
336 eb4825b5 Loren Merritt
    void (*float_to_int16)(int16_t *dst, const float *src, int len);
337 2dac4acf Loren Merritt
338 b0368839 Michael Niedermayer
    /* (I)DCT */
339
    void (*fdct)(DCTELEM *block/* align 16*/);
340 10acc479 Roman Shaposhnik
    void (*fdct248)(DCTELEM *block/* align 16*/);
341 115329f1 Diego Biurrun
342 4fb518c3 Michael Niedermayer
    /* IDCT really*/
343
    void (*idct)(DCTELEM *block/* align 16*/);
344 115329f1 Diego Biurrun
345 24641185 Michael Niedermayer
    /**
346 77c92c2d Michael Niedermayer
     * block -> idct -> clip to unsigned 8 bit -> dest.
347 24641185 Michael Niedermayer
     * (-1392, 0, 0, ...) -> idct -> (-174, -174, ...) -> put -> (0, 0, ...)
348 a1adf436 Michael Niedermayer
     * @param line_size size in bytes of a horizotal line of dest
349 24641185 Michael Niedermayer
     */
350 b0368839 Michael Niedermayer
    void (*idct_put)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
351 115329f1 Diego Biurrun
352 24641185 Michael Niedermayer
    /**
353
     * block -> idct -> add dest -> clip to unsigned 8 bit -> dest.
354 a1adf436 Michael Niedermayer
     * @param line_size size in bytes of a horizotal line of dest
355 24641185 Michael Niedermayer
     */
356 b0368839 Michael Niedermayer
    void (*idct_add)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
357 115329f1 Diego Biurrun
358 24641185 Michael Niedermayer
    /**
359 77c92c2d Michael Niedermayer
     * idct input permutation.
360 05493021 Michael Niedermayer
     * several optimized IDCTs need a permutated input (relative to the normal order of the reference
361
     * IDCT)
362
     * this permutation must be performed before the idct_put/add, note, normally this can be merged
363
     * with the zigzag/alternate scan<br>
364 24641185 Michael Niedermayer
     * an example to avoid confusion:
365
     * - (->decode coeffs -> zigzag reorder -> dequant -> reference idct ->...)
366
     * - (x -> referece dct -> reference idct -> x)
367
     * - (x -> referece dct -> simple_mmx_perm = idct_permutation -> simple_idct_mmx -> x)
368
     * - (->decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant -> simple_idct_mmx ->...)
369
     */
370 b0368839 Michael Niedermayer
    uint8_t idct_permutation[64];
371
    int idct_permutation_type;
372
#define FF_NO_IDCT_PERM 1
373
#define FF_LIBMPEG2_IDCT_PERM 2
374
#define FF_SIMPLE_IDCT_PERM 3
375
#define FF_TRANSPOSE_IDCT_PERM 4
376 5773a746 Michael Niedermayer
#define FF_PARTTRANS_IDCT_PERM 5
377 b0368839 Michael Niedermayer
378 364a1797 Michael Niedermayer
    int (*try_8x8basis)(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale);
379
    void (*add_8x8basis)(int16_t rem[64], int16_t basis[64], int scale);
380
#define BASIS_SHIFT 16
381
#define RECON_SHIFT 6
382 115329f1 Diego Biurrun
383 ea9f5d6f Panagiotis Issaris
    /* h264 functions */
384 0fa8158d Michael Niedermayer
    void (*h264_idct_add)(uint8_t *dst, DCTELEM *block, int stride);
385 43efd19a Loren Merritt
    void (*h264_idct8_add)(uint8_t *dst, DCTELEM *block, int stride);
386 ef9d1d15 Loren Merritt
    void (*h264_idct_dc_add)(uint8_t *dst, DCTELEM *block, int stride);
387
    void (*h264_idct8_dc_add)(uint8_t *dst, DCTELEM *block, int stride);
388 f1862127 Panagiotis Issaris
    void (*h264_dct)(DCTELEM block[4][4]);
389 059715a4 Robert Edele
390
    /* snow wavelet */
391
    void (*vertical_compose97i)(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, DWTELEM *b3, DWTELEM *b4, DWTELEM *b5, int width);
392
    void (*horizontal_compose97i)(DWTELEM *b, int width);
393 9dd6c804 Panagiotis Issaris
    void (*inner_add_yblock)(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h, int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8);
394 513fbd8e Loren Merritt
395
    void (*prefetch)(void *mem, int stride, int h);
396 54009d42 Michael Niedermayer
397
    void (*shrink[4])(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
398 64db55ae Kostya Shishkov
399
    /* vc1 functions */
400
    void (*vc1_inv_trans_8x8)(DCTELEM *b);
401
    void (*vc1_inv_trans_8x4)(DCTELEM *b, int n);
402
    void (*vc1_inv_trans_4x8)(DCTELEM *b, int n);
403
    void (*vc1_inv_trans_4x4)(DCTELEM *b, int n);
404 61f5b14a Kostya Shishkov
    void (*vc1_v_overlap)(uint8_t* src, int stride);
405
    void (*vc1_h_overlap)(uint8_t* src, int stride);
406 64db55ae Kostya Shishkov
    /* put 8x8 block with bicubic interpolation and quarterpel precision
407
     * last argument is actually round value instead of height
408
     */
409
    op_pixels_func put_vc1_mspel_pixels_tab[16];
410 eb4b3dd3 Zdenek Kabelac
} DSPContext;
411
412 486497e0 Måns Rullgård
void dsputil_static_init(void);
413 b0368839 Michael Niedermayer
void dsputil_init(DSPContext* p, AVCodecContext *avctx);
414 de6d9b64 Fabrice Bellard
415 6dc7d5da Michael Niedermayer
int ff_check_alignment(void);
416
417 7801d21d Michael Niedermayer
/**
418
 * permute block according to permuatation.
419
 * @param last last non zero element in scantable order
420
 */
421 0c1a9eda Zdenek Kabelac
void ff_block_permute(DCTELEM *block, uint8_t *permutation, const uint8_t *scantable, int last);
422 e0eac44e Fabrice Bellard
423 622348f9 Michael Niedermayer
void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type);
424
425 bb270c08 Diego Biurrun
#define         BYTE_VEC32(c)   ((c)*0x01010101UL)
426 d8085ea7 Michael Niedermayer
427
static inline uint32_t rnd_avg32(uint32_t a, uint32_t b)
428
{
429
    return (a | b) - (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1);
430
}
431
432
static inline uint32_t no_rnd_avg32(uint32_t a, uint32_t b)
433
{
434
    return (a & b) + (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1);
435
}
436
437 26efc54e Michael Niedermayer
static inline int get_penalty_factor(int lambda, int lambda2, int type){
438
    switch(type&0xFF){
439
    default:
440
    case FF_CMP_SAD:
441
        return lambda>>FF_LAMBDA_SHIFT;
442
    case FF_CMP_DCT:
443
        return (3*lambda)>>(FF_LAMBDA_SHIFT+1);
444
    case FF_CMP_W53:
445
        return (4*lambda)>>(FF_LAMBDA_SHIFT);
446
    case FF_CMP_W97:
447
        return (2*lambda)>>(FF_LAMBDA_SHIFT);
448
    case FF_CMP_SATD:
449 27c61ac5 Michael Niedermayer
    case FF_CMP_DCT264:
450 26efc54e Michael Niedermayer
        return (2*lambda)>>FF_LAMBDA_SHIFT;
451
    case FF_CMP_RD:
452
    case FF_CMP_PSNR:
453
    case FF_CMP_SSE:
454
    case FF_CMP_NSSE:
455
        return lambda2>>FF_LAMBDA_SHIFT;
456
    case FF_CMP_BIT:
457
        return 1;
458
    }
459
}
460
461 24641185 Michael Niedermayer
/**
462 77c92c2d Michael Niedermayer
 * Empty mmx state.
463 24641185 Michael Niedermayer
 * this must be called between any dsp function and float/double code.
464
 * for example sin(); dsp->idct_put(); emms_c(); cos()
465
 */
466 eb4b3dd3 Zdenek Kabelac
#define emms_c()
467
468 e629ab68 Romain Dolbeau
/* should be defined by architectures supporting
469
   one or more MultiMedia extension */
470
int mm_support(void);
471
472 68b51e58 Steve L'Homme
#ifdef __GNUC__
473
  #define DECLARE_ALIGNED_16(t,v)       t v __attribute__ ((aligned (16)))
474
#else
475
  #define DECLARE_ALIGNED_16(t,v)      __declspec(align(16)) t v
476
#endif
477 92a69cf8 Mike Melanson
478 3d03c0a2 Fabrice Bellard
#if defined(HAVE_MMX)
479 de6d9b64 Fabrice Bellard
480 18f77016 Zdenek Kabelac
#undef emms_c
481 eb4b3dd3 Zdenek Kabelac
482 de6d9b64 Fabrice Bellard
#define MM_MMX    0x0001 /* standard MMX */
483
#define MM_3DNOW  0x0004 /* AMD 3DNOW */
484
#define MM_MMXEXT 0x0002 /* SSE integer functions or AMD MMX ext */
485
#define MM_SSE    0x0008 /* SSE functions */
486
#define MM_SSE2   0x0010 /* PIV SSE2 functions */
487 e42a152b Michael Niedermayer
#define MM_3DNOWEXT  0x0020 /* AMD 3DNowExt */
488 392f6da8 Zuxy Meng
#define MM_SSE3   0x0040 /* Prescott SSE3 functions */
489 5a5c770d Guillaume Poirier
#define MM_SSSE3  0x0080 /* Conroe SSSE3 functions */
490 de6d9b64 Fabrice Bellard
491 486497e0 Måns Rullgård
extern int mm_flags;
492
493 0c1a9eda Zdenek Kabelac
void add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size);
494
void put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size);
495 f9ed9d85 Mike Melanson
void put_signed_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size);
496 de6d9b64 Fabrice Bellard
497
static inline void emms(void)
498
{
499 fb16b7e7 Fabrice Bellard
    __asm __volatile ("emms;":::"memory");
500
}
501
502 1457ab52 Michael Niedermayer
503 fb16b7e7 Fabrice Bellard
#define emms_c() \
504
{\
505 486497e0 Måns Rullgård
    if (mm_flags & MM_MMX)\
506 fb16b7e7 Fabrice Bellard
        emms();\
507 de6d9b64 Fabrice Bellard
}
508
509 68b51e58 Steve L'Homme
#ifdef __GNUC__
510
  #define DECLARE_ALIGNED_8(t,v)       t v __attribute__ ((aligned (8)))
511
#else
512
  #define DECLARE_ALIGNED_8(t,v)      __declspec(align(8)) t v
513
#endif
514
515 3237f731 Michael Niedermayer
#define STRIDE_ALIGN 8
516 de6d9b64 Fabrice Bellard
517 b0368839 Michael Niedermayer
void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx);
518
void dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx);
519 2720569a Zdenek Kabelac
520 3d03c0a2 Fabrice Bellard
#elif defined(ARCH_ARMV4L)
521
522
/* This is to use 4 bytes read to the IDCT pointers for some 'zero'
523 92a69cf8 Mike Melanson
   line optimizations */
524 68b51e58 Steve L'Homme
#define DECLARE_ALIGNED_8(t,v)    t v __attribute__ ((aligned (4)))
525 3237f731 Michael Niedermayer
#define STRIDE_ALIGN 4
526 3d03c0a2 Fabrice Bellard
527 eba9ae3c Gildas Bazin
#define MM_IWMMXT    0x0100 /* XScale IWMMXT */
528
529 486497e0 Måns Rullgård
extern int mm_flags;
530
531 b0368839 Michael Niedermayer
void dsputil_init_armv4l(DSPContext* c, AVCodecContext *avctx);
532 3d03c0a2 Fabrice Bellard
533 c34270f5 Fabrice Bellard
#elif defined(HAVE_MLIB)
534
535
/* SPARC/VIS IDCT needs 8-byte aligned DCT blocks */
536 68b51e58 Steve L'Homme
#define DECLARE_ALIGNED_8(t,v)    t v __attribute__ ((aligned (8)))
537 3237f731 Michael Niedermayer
#define STRIDE_ALIGN 8
538 c34270f5 Fabrice Bellard
539 b0368839 Michael Niedermayer
void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx);
540 c34270f5 Fabrice Bellard
541 44f54ceb Michael Niedermayer
#elif defined(ARCH_SPARC)
542
543
/* SPARC/VIS IDCT needs 8-byte aligned DCT blocks */
544 68b51e58 Steve L'Homme
#define DECLARE_ALIGNED_8(t,v)    t v __attribute__ ((aligned (8)))
545 3237f731 Michael Niedermayer
#define STRIDE_ALIGN 8
546 44f54ceb Michael Niedermayer
void dsputil_init_vis(DSPContext* c, AVCodecContext *avctx);
547
548 1e98dffb Nick Kurshev
#elif defined(ARCH_ALPHA)
549
550 68b51e58 Steve L'Homme
#define DECLARE_ALIGNED_8(t,v)    t v __attribute__ ((aligned (8)))
551 3237f731 Michael Niedermayer
#define STRIDE_ALIGN 8
552 1e98dffb Nick Kurshev
553 b0368839 Michael Niedermayer
void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx);
554 1e98dffb Nick Kurshev
555 59925ef2 Brian Foley
#elif defined(ARCH_POWERPC)
556
557 404d2241 Brian Foley
#define MM_ALTIVEC    0x0001 /* standard AltiVec */
558
559 486497e0 Måns Rullgård
extern int mm_flags;
560
561 3b991c54 Romain Dolbeau
#if defined(HAVE_ALTIVEC) && !defined(CONFIG_DARWIN)
562 9a197a24 Michael Niedermayer
#define pixel altivec_pixel
563 3b991c54 Romain Dolbeau
#include <altivec.h>
564 9a197a24 Michael Niedermayer
#undef pixel
565 3b991c54 Romain Dolbeau
#endif
566
567 68b51e58 Steve L'Homme
#define DECLARE_ALIGNED_8(t,v)    t v __attribute__ ((aligned (16)))
568 3237f731 Michael Niedermayer
#define STRIDE_ALIGN 16
569 59925ef2 Brian Foley
570 b0368839 Michael Niedermayer
void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx);
571 59925ef2 Brian Foley
572 d46aba26 Leon van Stuivenberg
#elif defined(HAVE_MMI)
573
574 68b51e58 Steve L'Homme
#define DECLARE_ALIGNED_8(t,v)    t v __attribute__ ((aligned (16)))
575 3237f731 Michael Niedermayer
#define STRIDE_ALIGN 16
576 d46aba26 Leon van Stuivenberg
577 b0368839 Michael Niedermayer
void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx);
578 d46aba26 Leon van Stuivenberg
579 0c6bd2ea BERO
#elif defined(ARCH_SH4)
580
581 68b51e58 Steve L'Homme
#define DECLARE_ALIGNED_8(t,v)    t v __attribute__ ((aligned (8)))
582 3237f731 Michael Niedermayer
#define STRIDE_ALIGN 8
583 0c6bd2ea BERO
584
void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx);
585
586 5ca030fe Michael Benjamin
#elif defined(ARCH_BFIN)
587
588
#define DECLARE_ALIGNED_8(t,v)    t v __attribute__ ((aligned (8)))
589
#define STRIDE_ALIGN 8
590
591
void dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx);
592
593 de6d9b64 Fabrice Bellard
#else
594
595 68b51e58 Steve L'Homme
#define DECLARE_ALIGNED_8(t,v)    t v __attribute__ ((aligned (8)))
596 3237f731 Michael Niedermayer
#define STRIDE_ALIGN 8
597 de6d9b64 Fabrice Bellard
598
#endif
599
600 43f1708f Juanjo
/* PSNR */
601 0c1a9eda Zdenek Kabelac
void get_psnr(uint8_t *orig_image[3], uint8_t *coded_image[3],
602 43f1708f Juanjo
              int orig_linesize[3], int coded_linesize,
603
              AVCodecContext *avctx);
604 bb6f5690 Fabrice Bellard
605
/* FFT computation */
606
607
/* NOTE: soon integer code will be added, so you must use the
608
   FFTSample type */
609
typedef float FFTSample;
610
611 bcfa3e58 Loren Merritt
struct MDCTContext;
612
613 bb6f5690 Fabrice Bellard
typedef struct FFTComplex {
614
    FFTSample re, im;
615
} FFTComplex;
616
617
typedef struct FFTContext {
618
    int nbits;
619
    int inverse;
620
    uint16_t *revtab;
621
    FFTComplex *exptab;
622
    FFTComplex *exptab1; /* only used by SSE code */
623
    void (*fft_calc)(struct FFTContext *s, FFTComplex *z);
624 bcfa3e58 Loren Merritt
    void (*imdct_calc)(struct MDCTContext *s, FFTSample *output,
625
                       const FFTSample *input, FFTSample *tmp);
626 bb6f5690 Fabrice Bellard
} FFTContext;
627
628 68951ecf Gildas Bazin
int ff_fft_init(FFTContext *s, int nbits, int inverse);
629
void ff_fft_permute(FFTContext *s, FFTComplex *z);
630
void ff_fft_calc_c(FFTContext *s, FFTComplex *z);
631
void ff_fft_calc_sse(FFTContext *s, FFTComplex *z);
632 82eb4b0f Zuxy Meng
void ff_fft_calc_3dn(FFTContext *s, FFTComplex *z);
633
void ff_fft_calc_3dn2(FFTContext *s, FFTComplex *z);
634 68951ecf Gildas Bazin
void ff_fft_calc_altivec(FFTContext *s, FFTComplex *z);
635 8d268a7d Fabrice Bellard
636 68951ecf Gildas Bazin
static inline void ff_fft_calc(FFTContext *s, FFTComplex *z)
637 bb6f5690 Fabrice Bellard
{
638
    s->fft_calc(s, z);
639
}
640 68951ecf Gildas Bazin
void ff_fft_end(FFTContext *s);
641 bb6f5690 Fabrice Bellard
642
/* MDCT computation */
643
644
typedef struct MDCTContext {
645
    int n;  /* size of MDCT (i.e. number of input data * 2) */
646
    int nbits; /* n = 2^nbits */
647
    /* pre/post rotation tables */
648
    FFTSample *tcos;
649
    FFTSample *tsin;
650
    FFTContext fft;
651
} MDCTContext;
652
653 82696bee Fabrice Bellard
int ff_mdct_init(MDCTContext *s, int nbits, int inverse);
654 eb4b3dd3 Zdenek Kabelac
void ff_imdct_calc(MDCTContext *s, FFTSample *output,
655 bb6f5690 Fabrice Bellard
                const FFTSample *input, FFTSample *tmp);
656 bcfa3e58 Loren Merritt
void ff_imdct_calc_3dn2(MDCTContext *s, FFTSample *output,
657
                        const FFTSample *input, FFTSample *tmp);
658 ebbafcb4 Loren Merritt
void ff_imdct_calc_sse(MDCTContext *s, FFTSample *output,
659
                       const FFTSample *input, FFTSample *tmp);
660 eb4b3dd3 Zdenek Kabelac
void ff_mdct_calc(MDCTContext *s, FFTSample *out,
661 bb6f5690 Fabrice Bellard
               const FFTSample *input, FFTSample *tmp);
662 82696bee Fabrice Bellard
void ff_mdct_end(MDCTContext *s);
663 bb6f5690 Fabrice Bellard
664 bb198e19 Michael Niedermayer
#define WARPER8_16(name8, name16)\
665
static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int stride, int h){\
666
    return name8(s, dst           , src           , stride, h)\
667
          +name8(s, dst+8         , src+8         , stride, h);\
668
}
669
670
#define WARPER8_16_SQ(name8, name16)\
671
static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int stride, int h){\
672
    int score=0;\
673
    score +=name8(s, dst           , src           , stride, 8);\
674
    score +=name8(s, dst+8         , src+8         , stride, 8);\
675
    if(h==16){\
676
        dst += 8*stride;\
677
        src += 8*stride;\
678
        score +=name8(s, dst           , src           , stride, 8);\
679
        score +=name8(s, dst+8         , src+8         , stride, 8);\
680
    }\
681
    return score;\
682 1457ab52 Michael Niedermayer
}
683
684 49cef744 Brian Foley
685
static inline void copy_block2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h)
686
{
687
    int i;
688
    for(i=0; i<h; i++)
689
    {
690
        ST16(dst   , LD16(src   ));
691
        dst+=dstStride;
692
        src+=srcStride;
693
    }
694
}
695
696
static inline void copy_block4(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h)
697
{
698
    int i;
699
    for(i=0; i<h; i++)
700
    {
701
        ST32(dst   , LD32(src   ));
702
        dst+=dstStride;
703
        src+=srcStride;
704
    }
705
}
706
707
static inline void copy_block8(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h)
708
{
709
    int i;
710
    for(i=0; i<h; i++)
711
    {
712
        ST32(dst   , LD32(src   ));
713
        ST32(dst+4 , LD32(src+4 ));
714
        dst+=dstStride;
715
        src+=srcStride;
716
    }
717
}
718
719
static inline void copy_block9(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h)
720
{
721
    int i;
722
    for(i=0; i<h; i++)
723
    {
724
        ST32(dst   , LD32(src   ));
725
        ST32(dst+4 , LD32(src+4 ));
726
        dst[8]= src[8];
727
        dst+=dstStride;
728
        src+=srcStride;
729
    }
730
}
731
732
static inline void copy_block16(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h)
733
{
734
    int i;
735
    for(i=0; i<h; i++)
736
    {
737
        ST32(dst   , LD32(src   ));
738
        ST32(dst+4 , LD32(src+4 ));
739
        ST32(dst+8 , LD32(src+8 ));
740
        ST32(dst+12, LD32(src+12));
741
        dst+=dstStride;
742
        src+=srcStride;
743
    }
744
}
745
746
static inline void copy_block17(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h)
747
{
748
    int i;
749
    for(i=0; i<h; i++)
750
    {
751
        ST32(dst   , LD32(src   ));
752
        ST32(dst+4 , LD32(src+4 ));
753
        ST32(dst+8 , LD32(src+8 ));
754
        ST32(dst+12, LD32(src+12));
755
        dst[16]= src[16];
756
        dst+=dstStride;
757
        src+=srcStride;
758
    }
759
}
760
761 de6d9b64 Fabrice Bellard
#endif