annotate libavcodec/dsputil.h @ 10:4d1f82230449

preprocessed source from newer mercurial ver.
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Tue, 13 Aug 2013 13:12:57 +0200
parents
children
rev   line source
nengel@2 1 /*
nengel@2 2 * DSP utils
nengel@2 3 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
nengel@2 4 * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
nengel@2 5 *
nengel@2 6 * This file is part of FFmpeg.
nengel@2 7 *
nengel@2 8 * FFmpeg is free software; you can redistribute it and/or
nengel@2 9 * modify it under the terms of the GNU Lesser General Public
nengel@2 10 * License as published by the Free Software Foundation; either
nengel@2 11 * version 2.1 of the License, or (at your option) any later version.
nengel@2 12 *
nengel@2 13 * FFmpeg is distributed in the hope that it will be useful,
nengel@2 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nengel@2 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
nengel@2 16 * Lesser General Public License for more details.
nengel@2 17 *
nengel@2 18 * You should have received a copy of the GNU Lesser General Public
nengel@2 19 * License along with FFmpeg; if not, write to the Free Software
nengel@2 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
nengel@2 21 */
nengel@2 22
nengel@2 23 /**
nengel@2 24 * @file
nengel@2 25 * DSP utils.
nengel@2 26 * note, many functions in here may use MMX which trashes the FPU state, it is
nengel@2 27 * absolutely necessary to call emms_c() between dsp & float/double code
nengel@2 28 */
nengel@2 29
nengel@2 30 #ifndef AVCODEC_DSPUTIL_H
nengel@2 31 #define AVCODEC_DSPUTIL_H
nengel@2 32
nengel@2 33 #include "libavutil/intreadwrite.h"
nengel@2 34 #include "avcodec.h"
nengel@2 35 #include "h264_idct.h"
nengel@2 36 //
nengel@2 37 void ff_vector_fmul_window_c(float *dst, const float *src0, const float *src1,
nengel@2 38 const float *win, float add_bias, int len);
nengel@2 39 void ff_float_to_int16_c(int16_t *dst, const float *src, long len);
nengel@2 40 void ff_float_to_int16_interleave_c(int16_t *dst, const float **src, long len, int channels);
nengel@2 41
nengel@2 42 /* encoding scans */
nengel@2 43 extern const uint8_t ff_alternate_horizontal_scan[64];
nengel@2 44 extern const uint8_t ff_alternate_vertical_scan[64];
nengel@2 45 extern const uint8_t ff_zigzag_direct[64];
nengel@2 46 extern const uint8_t ff_zigzag248_direct[64];
nengel@2 47
nengel@2 48 /* pixel operations */
nengel@2 49 #define MAX_NEG_CROP 1024
nengel@2 50
nengel@2 51 /* temporary */
nengel@2 52 extern uint32_t ff_squareTbl[512];
nengel@2 53 extern uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP];
nengel@2 54
nengel@2 55 /* VP3 DSP functions */
nengel@2 56 void ff_vp3_idct_c(DCTELEM *block/* align 16*/);
nengel@2 57 void ff_vp3_idct_put_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
nengel@2 58 void ff_vp3_idct_add_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
nengel@2 59 void ff_vp3_idct_dc_add_c(uint8_t *dest/*align 8*/, int line_size, const DCTELEM *block/*align 16*/);
nengel@2 60
nengel@2 61 void ff_vp3_v_loop_filter_c(uint8_t *src, int stride, int *bounding_values);
nengel@2 62 void ff_vp3_h_loop_filter_c(uint8_t *src, int stride, int *bounding_values);
nengel@2 63
nengel@2 64 /* VP6 DSP functions */
nengel@2 65 void ff_vp6_filter_diag4_c(uint8_t *dst, uint8_t *src, int stride,
nengel@2 66 const int16_t *h_weights, const int16_t *v_weights);
nengel@2 67
nengel@2 68 /* Bink functions */
nengel@2 69 void ff_bink_idct_c (DCTELEM *block);
nengel@2 70 void ff_bink_idct_add_c(uint8_t *dest, int linesize, DCTELEM *block);
nengel@2 71 void ff_bink_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block);
nengel@2 72
nengel@2 73 /* CAVS functions */
nengel@2 74 void ff_put_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride);
nengel@2 75 void ff_avg_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride);
nengel@2 76 void ff_put_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride);
nengel@2 77 void ff_avg_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride);
nengel@2 78
nengel@2 79 /* VC1 functions */
nengel@2 80 void ff_put_vc1_mspel_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int rnd);
nengel@2 81 void ff_avg_vc1_mspel_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int rnd);
nengel@2 82
nengel@2 83 /* EA functions */
nengel@2 84 void ff_ea_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block);
nengel@2 85
nengel@2 86 /* 1/2^n downscaling functions from imgconvert.c */
nengel@2 87 void ff_img_copy_plane(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
nengel@2 88 void ff_shrink22(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
nengel@2 89 void ff_shrink44(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
nengel@2 90 void ff_shrink88(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
nengel@2 91
nengel@2 92 void ff_gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy,
nengel@2 93 int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height);
nengel@2 94
nengel@2 95 /* minimum alignment rules ;)
nengel@2 96 If you notice errors in the align stuff, need more alignment for some ASM code
nengel@2 97 for some CPU or need to use a function with less aligned data then send a mail
nengel@2 98 to the ffmpeg-devel mailing list, ...
nengel@2 99
nengel@2 100 !warning These alignments might not match reality, (missing attribute((align))
nengel@2 101 stuff somewhere possible).
nengel@2 102 I (Michael) did not check them, these are just the alignments which I think
nengel@2 103 could be reached easily ...
nengel@2 104
nengel@2 105 !future video codecs might need functions with less strict alignment
nengel@2 106 */
nengel@2 107
nengel@2 108 /*
nengel@2 109 void get_pixels_c(DCTELEM *block, const uint8_t *pixels, int line_size);
nengel@2 110 void diff_pixels_c(DCTELEM *block, const uint8_t *s1, const uint8_t *s2, int stride);
nengel@2 111 void put_pixels_clamped_c(const DCTELEM *block, uint8_t *pixels, int line_size);
nengel@2 112 void add_pixels_clamped_c(const DCTELEM *block, uint8_t *pixels, int line_size);
nengel@2 113 void clear_blocks_c(DCTELEM *blocks);
nengel@2 114 */
nengel@2 115
nengel@2 116 /* add and put pixel (decoding) */
nengel@2 117 // blocksizes for op_pixels_func are 8x4,8x8 16x8 16x16
nengel@2 118 //h for op_pixels_func is limited to {width/2, width} but never larger than 16 and never smaller then 4
nengel@2 119 typedef void (*op_pixels_func)(uint8_t *block/*align width (8 or 16)*/, const uint8_t *pixels/*align 1*/, int line_size, int h);
nengel@2 120 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);
nengel@2 121 typedef void (*qpel_mc_func)(uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride);
nengel@2 122 typedef void (*h264_chroma_mc_func)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride, int h, int x, int y);
nengel@2 123
nengel@2 124 typedef void (*op_fill_func)(uint8_t *block/*align width (8 or 16)*/, uint8_t value, int line_size, int h);
nengel@2 125
nengel@2 126 #define DEF_OLD_QPEL(name)\
nengel@2 127 void ff_put_ ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride);\
nengel@2 128 void ff_put_no_rnd_ ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride);\
nengel@2 129 void ff_avg_ ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride);
nengel@2 130
nengel@2 131 DEF_OLD_QPEL(qpel16_mc11_old_c)
nengel@2 132 DEF_OLD_QPEL(qpel16_mc31_old_c)
nengel@2 133 DEF_OLD_QPEL(qpel16_mc12_old_c)
nengel@2 134 DEF_OLD_QPEL(qpel16_mc32_old_c)
nengel@2 135 DEF_OLD_QPEL(qpel16_mc13_old_c)
nengel@2 136 DEF_OLD_QPEL(qpel16_mc33_old_c)
nengel@2 137 DEF_OLD_QPEL(qpel8_mc11_old_c)
nengel@2 138 DEF_OLD_QPEL(qpel8_mc31_old_c)
nengel@2 139 DEF_OLD_QPEL(qpel8_mc12_old_c)
nengel@2 140 DEF_OLD_QPEL(qpel8_mc32_old_c)
nengel@2 141 DEF_OLD_QPEL(qpel8_mc13_old_c)
nengel@2 142 DEF_OLD_QPEL(qpel8_mc33_old_c)
nengel@2 143
nengel@2 144 #define CALL_2X_PIXELS(a, b, n)\
nengel@2 145 static void a(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
nengel@2 146 b(block , pixels , line_size, h);\
nengel@2 147 b(block+n, pixels+n, line_size, h);\
nengel@2 148 }
nengel@2 149
nengel@2 150 /* motion estimation */
nengel@2 151 // h is limited to {width/2, width, 2*width} but never larger than 16 and never smaller then 2
nengel@2 152 // although currently h<4 is not used as functions with width <8 are neither used nor implemented
nengel@2 153 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))*/;
nengel@2 154
nengel@2 155 /**
nengel@2 156 * Scantable.
nengel@2 157 */
nengel@2 158 typedef struct ScanTable{
nengel@2 159 const uint8_t *scantable;
nengel@2 160 uint8_t permutated[64];
nengel@2 161 uint8_t raster_end[64];
nengel@2 162 #if ARCH_PPC
nengel@2 163 /** Used by dct_quantize_altivec to find last-non-zero */
nengel@2 164 DECLARE_ALIGNED(16, uint8_t, inverse)[64];
nengel@2 165 #endif
nengel@2 166 } ScanTable;
nengel@2 167
nengel@2 168 void ff_init_scantable(uint8_t *, ScanTable *st, const uint8_t *src_scantable);
nengel@2 169
nengel@2 170 void ff_emulated_edge_mc(uint8_t *buf, uint8_t *src, int linesize,
nengel@2 171 int block_w, int block_h,
nengel@2 172 int src_x, int src_y, int w, int h);
nengel@2 173
nengel@2 174
nengel@2 175 /**
nengel@2 176 * DSPContext.
nengel@2 177 */
nengel@2 178 typedef struct DSPContext {
nengel@2 179 /* pixel ops : interface with DCT */
nengel@2 180 void (*get_pixels)(DCTELEM *block/*align 16*/, const uint8_t *pixels/*align 8*/, int line_size);
nengel@2 181 void (*diff_pixels)(DCTELEM *block/*align 16*/, const uint8_t *s1/*align 8*/, const uint8_t *s2/*align 8*/, int stride);
nengel@2 182 void (*put_pixels_clamped)(const DCTELEM *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size);
nengel@2 183 void (*put_signed_pixels_clamped)(const DCTELEM *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size);
nengel@2 184 void (*put_pixels_nonclamped)(const DCTELEM *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size);
nengel@2 185 void (*add_pixels_clamped)(const DCTELEM *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size);
nengel@2 186 void (*add_pixels8)(uint8_t *pixels, DCTELEM *block, int line_size);
nengel@2 187 void (*add_pixels4)(uint8_t *pixels, DCTELEM *block, int line_size);
nengel@2 188
nengel@2 189 void (*clear_block)(DCTELEM *block/*align 16*/);
nengel@2 190 void (*clear_blocks)(DCTELEM *blocks/*align 16*/);
nengel@2 191
nengel@2 192
nengel@2 193 /**
nengel@2 194 * Halfpel motion compensation with rounding (a+b+1)>>1.
nengel@2 195 * this is an array[4][4] of motion compensation functions for 4
nengel@2 196 * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
nengel@2 197 * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
nengel@2 198 * @param block destination where the result is stored
nengel@2 199 * @param pixels source
nengel@2 200 * @param line_size number of bytes in a horizontal line of block
nengel@2 201 * @param h height
nengel@2 202 */
nengel@2 203 op_pixels_func put_pixels_tab[4][4];
nengel@2 204
nengel@2 205 /**
nengel@2 206 * Halfpel motion compensation with rounding (a+b+1)>>1.
nengel@2 207 * This is an array[4][4] of motion compensation functions for 4
nengel@2 208 * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
nengel@2 209 * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
nengel@2 210 * @param block destination into which the result is averaged (a+b+1)>>1
nengel@2 211 * @param pixels source
nengel@2 212 * @param line_size number of bytes in a horizontal line of block
nengel@2 213 * @param h height
nengel@2 214 */
nengel@2 215 op_pixels_func avg_pixels_tab[4][4];
nengel@2 216
nengel@2 217 /**
nengel@2 218 * Halfpel motion compensation with no rounding (a+b)>>1.
nengel@2 219 * this is an array[2][4] of motion compensation functions for 2
nengel@2 220 * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
nengel@2 221 * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
nengel@2 222 * @param block destination where the result is stored
nengel@2 223 * @param pixels source
nengel@2 224 * @param line_size number of bytes in a horizontal line of block
nengel@2 225 * @param h height
nengel@2 226 */
nengel@2 227 op_pixels_func put_no_rnd_pixels_tab[4][4];
nengel@2 228
nengel@2 229 /**
nengel@2 230 * Halfpel motion compensation with no rounding (a+b)>>1.
nengel@2 231 * this is an array[2][4] of motion compensation functions for 2
nengel@2 232 * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
nengel@2 233 * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
nengel@2 234 * @param block destination into which the result is averaged (a+b)>>1
nengel@2 235 * @param pixels source
nengel@2 236 * @param line_size number of bytes in a horizontal line of block
nengel@2 237 * @param h height
nengel@2 238 */
nengel@2 239 op_pixels_func avg_no_rnd_pixels_tab[4][4];
nengel@2 240
nengel@2 241 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);
nengel@2 242
nengel@2 243
nengel@2 244 qpel_mc_func put_qpel_pixels_tab[2][16];
nengel@2 245 qpel_mc_func avg_qpel_pixels_tab[2][16];
nengel@2 246 qpel_mc_func put_no_rnd_qpel_pixels_tab[2][16];
nengel@2 247 qpel_mc_func avg_no_rnd_qpel_pixels_tab[2][16];
nengel@2 248 qpel_mc_func put_mspel_pixels_tab[8];
nengel@2 249
nengel@2 250 /**
nengel@2 251 * h264 Chroma MC
nengel@2 252 */
nengel@2 253 h264_chroma_mc_func put_h264_chroma_pixels_tab[3];
nengel@2 254 h264_chroma_mc_func avg_h264_chroma_pixels_tab[3];
nengel@2 255 /* This is really one func used in VC-1 decoding */
nengel@2 256 h264_chroma_mc_func put_no_rnd_vc1_chroma_pixels_tab[3];
nengel@2 257 h264_chroma_mc_func avg_no_rnd_vc1_chroma_pixels_tab[3];
nengel@2 258
nengel@2 259 qpel_mc_func put_h264_qpel_pixels_tab[4][16];
nengel@2 260 qpel_mc_func avg_h264_qpel_pixels_tab[4][16];
nengel@2 261
nengel@2 262 qpel_mc_func put_2tap_qpel_pixels_tab[4][16];
nengel@2 263 qpel_mc_func avg_2tap_qpel_pixels_tab[4][16];
nengel@2 264
nengel@2 265
nengel@2 266 /* (I)DCT */
nengel@2 267 void (*fdct)(DCTELEM *block/* align 16*/);
nengel@2 268 void (*fdct248)(DCTELEM *block/* align 16*/);
nengel@2 269
nengel@2 270 /* IDCT really*/
nengel@2 271 void (*idct)(DCTELEM *block/* align 16*/);
nengel@2 272
nengel@2 273 /**
nengel@2 274 * block -> idct -> clip to unsigned 8 bit -> dest.
nengel@2 275 * (-1392, 0, 0, ...) -> idct -> (-174, -174, ...) -> put -> (0, 0, ...)
nengel@2 276 * @param line_size size in bytes of a horizontal line of dest
nengel@2 277 */
nengel@2 278 void (*idct_put)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
nengel@2 279
nengel@2 280 /**
nengel@2 281 * block -> idct -> add dest -> clip to unsigned 8 bit -> dest.
nengel@2 282 * @param line_size size in bytes of a horizontal line of dest
nengel@2 283 */
nengel@2 284 void (*idct_add)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
nengel@2 285
nengel@2 286 void (*draw_edges)(uint8_t *buf, int wrap, int width, int height, int w);
nengel@2 287 #define EDGE_WIDTH 32
nengel@2 288
nengel@2 289 void (*prefetch)(void *mem, int stride, int h);
nengel@2 290
nengel@2 291 } DSPContext;
nengel@2 292
nengel@2 293 void dsputil_static_init(void);
nengel@2 294 void dsputil_init(DSPContext* p);
nengel@2 295
nengel@2 296 int ff_check_alignment(void);
nengel@2 297
nengel@2 298 /**
nengel@2 299 * permute block according to permuatation.
nengel@2 300 * @param last last non zero element in scantable order
nengel@2 301 */
nengel@2 302 void ff_block_permute(DCTELEM *block, uint8_t *permutation, const uint8_t *scantable, int last);
nengel@2 303
nengel@2 304 void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type);
nengel@2 305
nengel@2 306 #define BYTE_VEC32(c) ((c)*0x01010101UL)
nengel@2 307
nengel@2 308 static inline uint32_t rnd_avg32(uint32_t a, uint32_t b)
nengel@2 309 {
nengel@2 310 return (a | b) - (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1);
nengel@2 311 }
nengel@2 312
nengel@2 313 static inline uint32_t no_rnd_avg32(uint32_t a, uint32_t b)
nengel@2 314 {
nengel@2 315 return (a & b) + (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1);
nengel@2 316 }
nengel@2 317
nengel@2 318
nengel@2 319 /**
nengel@2 320 * Empty mmx state.
nengel@2 321 * this must be called between any dsp function and float/double code.
nengel@2 322 * for example sin(); dsp->idct_put(); emms_c(); cos()
nengel@2 323 */
nengel@2 324 #define emms_c()
nengel@2 325
nengel@2 326 /* should be defined by architectures supporting
nengel@2 327 one or more MultiMedia extension */
nengel@2 328 int mm_support(void);
nengel@2 329 extern int mm_flags;
nengel@2 330
nengel@2 331 void dsputil_init_arm(DSPContext* c);
nengel@2 332 void dsputil_init_mmx(DSPContext* c);
nengel@2 333 void dsputil_init_ppc(DSPContext* c);
nengel@2 334
nengel@2 335 void ff_dsputil_init_dwt(DSPContext *c);
nengel@2 336
nengel@2 337 #if HAVE_MMX
nengel@2 338
nengel@2 339 #undef emms_c
nengel@2 340
nengel@2 341 static inline void emms(void)
nengel@2 342 {
nengel@2 343 __asm__ volatile ("emms;":::"memory");
nengel@2 344 }
nengel@2 345
nengel@2 346
nengel@2 347 #define emms_c() \
nengel@2 348 {\
nengel@2 349 if (mm_flags & FF_MM_MMX)\
nengel@2 350 emms();\
nengel@2 351 }
nengel@2 352
nengel@2 353 #elif ARCH_ARM
nengel@2 354
nengel@2 355 #if HAVE_NEON
nengel@2 356 # define STRIDE_ALIGN 16
nengel@2 357 #endif
nengel@2 358
nengel@2 359 #elif ARCH_PPC || ARCH_PPC64 || ARCH_CELL
nengel@2 360
nengel@2 361 #define STRIDE_ALIGN 16
nengel@2 362
nengel@2 363 #endif
nengel@2 364
nengel@2 365 #ifndef STRIDE_ALIGN
nengel@2 366 # define STRIDE_ALIGN 8
nengel@2 367 #endif
nengel@2 368
nengel@2 369 #define WRAPPER8_16(name8, name16)\
nengel@2 370 static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int stride, int h){\
nengel@2 371 return name8(s, dst , src , stride, h)\
nengel@2 372 +name8(s, dst+8 , src+8 , stride, h);\
nengel@2 373 }
nengel@2 374
nengel@2 375 #define WRAPPER8_16_SQ(name8, name16)\
nengel@2 376 static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int stride, int h){\
nengel@2 377 int score=0;\
nengel@2 378 score +=name8(s, dst , src , stride, 8);\
nengel@2 379 score +=name8(s, dst+8 , src+8 , stride, 8);\
nengel@2 380 if(h==16){\
nengel@2 381 dst += 8*stride;\
nengel@2 382 src += 8*stride;\
nengel@2 383 score +=name8(s, dst , src , stride, 8);\
nengel@2 384 score +=name8(s, dst+8 , src+8 , stride, 8);\
nengel@2 385 }\
nengel@2 386 return score;\
nengel@2 387 }
nengel@2 388
nengel@2 389 static inline void copy_block2(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
nengel@2 390 {
nengel@2 391 int i;
nengel@2 392 for(i=0; i<h; i++)
nengel@2 393 {
nengel@2 394 AV_WN16(dst , AV_RN16(src ));
nengel@2 395 dst+=dstStride;
nengel@2 396 src+=srcStride;
nengel@2 397 }
nengel@2 398 }
nengel@2 399
nengel@2 400 static inline void copy_block4(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
nengel@2 401 {
nengel@2 402 int i;
nengel@2 403 for(i=0; i<h; i++)
nengel@2 404 {
nengel@2 405 AV_WN32(dst , AV_RN32(src ));
nengel@2 406 dst+=dstStride;
nengel@2 407 src+=srcStride;
nengel@2 408 }
nengel@2 409 }
nengel@2 410
nengel@2 411 static inline void copy_block8(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
nengel@2 412 {
nengel@2 413 int i;
nengel@2 414 for(i=0; i<h; i++)
nengel@2 415 {
nengel@2 416 AV_WN32(dst , AV_RN32(src ));
nengel@2 417 AV_WN32(dst+4 , AV_RN32(src+4 ));
nengel@2 418 dst+=dstStride;
nengel@2 419 src+=srcStride;
nengel@2 420 }
nengel@2 421 }
nengel@2 422
nengel@2 423 static inline void copy_block9(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
nengel@2 424 {
nengel@2 425 int i;
nengel@2 426 for(i=0; i<h; i++)
nengel@2 427 {
nengel@2 428 AV_WN32(dst , AV_RN32(src ));
nengel@2 429 AV_WN32(dst+4 , AV_RN32(src+4 ));
nengel@2 430 dst[8]= src[8];
nengel@2 431 dst+=dstStride;
nengel@2 432 src+=srcStride;
nengel@2 433 }
nengel@2 434 }
nengel@2 435
nengel@2 436 static inline void copy_block16(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
nengel@2 437 {
nengel@2 438 int i;
nengel@2 439 for(i=0; i<h; i++)
nengel@2 440 {
nengel@2 441 AV_WN32(dst , AV_RN32(src ));
nengel@2 442 AV_WN32(dst+4 , AV_RN32(src+4 ));
nengel@2 443 AV_WN32(dst+8 , AV_RN32(src+8 ));
nengel@2 444 AV_WN32(dst+12, AV_RN32(src+12));
nengel@2 445 dst+=dstStride;
nengel@2 446 src+=srcStride;
nengel@2 447 }
nengel@2 448 }
nengel@2 449
nengel@2 450 static inline void copy_block17(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
nengel@2 451 {
nengel@2 452 int i;
nengel@2 453 for(i=0; i<h; i++)
nengel@2 454 {
nengel@2 455 AV_WN32(dst , AV_RN32(src ));
nengel@2 456 AV_WN32(dst+4 , AV_RN32(src+4 ));
nengel@2 457 AV_WN32(dst+8 , AV_RN32(src+8 ));
nengel@2 458 AV_WN32(dst+12, AV_RN32(src+12));
nengel@2 459 dst[16]= src[16];
nengel@2 460 dst+=dstStride;
nengel@2 461 src+=srcStride;
nengel@2 462 }
nengel@2 463 }
nengel@2 464
nengel@2 465 #endif /* AVCODEC_DSPUTIL_H */