00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00030 #ifndef AVCODEC_DSPUTIL_H
00031 #define AVCODEC_DSPUTIL_H
00032
00033 #include "libavutil/intreadwrite.h"
00034 #include "avcodec.h"
00035
00036
00037
00038
00039 typedef short DCTELEM;
00040
00041 void fdct_ifast (DCTELEM *data);
00042 void fdct_ifast248 (DCTELEM *data);
00043 void ff_jpeg_fdct_islow (DCTELEM *data);
00044 void ff_fdct248_islow (DCTELEM *data);
00045
00046 void j_rev_dct (DCTELEM *data);
00047 void j_rev_dct4 (DCTELEM *data);
00048 void j_rev_dct2 (DCTELEM *data);
00049 void j_rev_dct1 (DCTELEM *data);
00050 void ff_wmv2_idct_c(DCTELEM *data);
00051
00052 void ff_fdct_mmx(DCTELEM *block);
00053 void ff_fdct_mmx2(DCTELEM *block);
00054 void ff_fdct_sse2(DCTELEM *block);
00055
00056 void ff_h264_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride);
00057 void ff_h264_idct_add_c(uint8_t *dst, DCTELEM *block, int stride);
00058 void ff_h264_idct8_dc_add_c(uint8_t *dst, DCTELEM *block, int stride);
00059 void ff_h264_idct_dc_add_c(uint8_t *dst, DCTELEM *block, int stride);
00060 void ff_h264_lowres_idct_add_c(uint8_t *dst, int stride, DCTELEM *block);
00061 void ff_h264_lowres_idct_put_c(uint8_t *dst, int stride, DCTELEM *block);
00062 void ff_h264_idct_add16_c(uint8_t *dst, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
00063 void ff_h264_idct_add16intra_c(uint8_t *dst, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
00064 void ff_h264_idct8_add4_c(uint8_t *dst, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
00065 void ff_h264_idct_add8_c(uint8_t **dest, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
00066
00067 void ff_h264_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qmul);
00068 void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qp);
00069 void ff_svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc);
00070
00071
00072 extern const uint8_t ff_alternate_horizontal_scan[64];
00073 extern const uint8_t ff_alternate_vertical_scan[64];
00074 extern const uint8_t ff_zigzag_direct[64];
00075 extern const uint8_t ff_zigzag248_direct[64];
00076
00077
00078 #define MAX_NEG_CROP 1024
00079
00080
00081 extern uint32_t ff_squareTbl[512];
00082 extern uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP];
00083
00084 void ff_put_pixels8x8_c(uint8_t *dst, uint8_t *src, int stride);
00085 void ff_avg_pixels8x8_c(uint8_t *dst, uint8_t *src, int stride);
00086 void ff_put_pixels16x16_c(uint8_t *dst, uint8_t *src, int stride);
00087 void ff_avg_pixels16x16_c(uint8_t *dst, uint8_t *src, int stride);
00088
00089
00090 void ff_vp3_idct_c(DCTELEM *block);
00091 void ff_vp3_idct_put_c(uint8_t *dest, int line_size, DCTELEM *block);
00092 void ff_vp3_idct_add_c(uint8_t *dest, int line_size, DCTELEM *block);
00093 void ff_vp3_idct_dc_add_c(uint8_t *dest, int line_size, const DCTELEM *block);
00094
00095 void ff_vp3_v_loop_filter_c(uint8_t *src, int stride, int *bounding_values);
00096 void ff_vp3_h_loop_filter_c(uint8_t *src, int stride, int *bounding_values);
00097
00098
00099 void ff_bink_idct_c (DCTELEM *block);
00100 void ff_bink_idct_add_c(uint8_t *dest, int linesize, DCTELEM *block);
00101 void ff_bink_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block);
00102
00103
00104 void ff_ea_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block);
00105
00106
00107 #if LIBAVCODEC_VERSION_MAJOR < 53
00108
00111 attribute_deprecated
00112 void ff_img_copy_plane(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
00113 #endif
00114
00115 void ff_shrink22(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
00116 void ff_shrink44(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
00117 void ff_shrink88(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
00118
00119 void ff_gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy,
00120 int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height);
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146 typedef void (*op_pixels_func)(uint8_t *block, const uint8_t *pixels, int line_size, int h);
00147 typedef void (*tpel_mc_func)(uint8_t *block, const uint8_t *pixels, int line_size, int w, int h);
00148 typedef void (*qpel_mc_func)(uint8_t *dst, uint8_t *src, int stride);
00149 typedef void (*h264_chroma_mc_func)(uint8_t *dst, uint8_t *src, int srcStride, int h, int x, int y);
00150
00151 typedef void (*op_fill_func)(uint8_t *block, uint8_t value, int line_size, int h);
00152
00153 #define DEF_OLD_QPEL(name)\
00154 void ff_put_ ## name (uint8_t *dst, uint8_t *src, int stride);\
00155 void ff_put_no_rnd_ ## name (uint8_t *dst, uint8_t *src, int stride);\
00156 void ff_avg_ ## name (uint8_t *dst, uint8_t *src, int stride);
00157
00158 DEF_OLD_QPEL(qpel16_mc11_old_c)
00159 DEF_OLD_QPEL(qpel16_mc31_old_c)
00160 DEF_OLD_QPEL(qpel16_mc12_old_c)
00161 DEF_OLD_QPEL(qpel16_mc32_old_c)
00162 DEF_OLD_QPEL(qpel16_mc13_old_c)
00163 DEF_OLD_QPEL(qpel16_mc33_old_c)
00164 DEF_OLD_QPEL(qpel8_mc11_old_c)
00165 DEF_OLD_QPEL(qpel8_mc31_old_c)
00166 DEF_OLD_QPEL(qpel8_mc12_old_c)
00167 DEF_OLD_QPEL(qpel8_mc32_old_c)
00168 DEF_OLD_QPEL(qpel8_mc13_old_c)
00169 DEF_OLD_QPEL(qpel8_mc33_old_c)
00170
00171 #define CALL_2X_PIXELS(a, b, n)\
00172 static void a(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
00173 b(block , pixels , line_size, h);\
00174 b(block+n, pixels+n, line_size, h);\
00175 }
00176
00177
00178
00179
00180 typedef int (*me_cmp_func)(void *s, uint8_t *blk1, uint8_t *blk2, int line_size, int h);
00181
00185 typedef struct ScanTable{
00186 const uint8_t *scantable;
00187 uint8_t permutated[64];
00188 uint8_t raster_end[64];
00189 #if ARCH_PPC
00190
00191 DECLARE_ALIGNED(16, uint8_t, inverse)[64];
00192 #endif
00193 } ScanTable;
00194
00195 void ff_init_scantable(uint8_t *, ScanTable *st, const uint8_t *src_scantable);
00196
00197 void ff_emulated_edge_mc(uint8_t *buf, const uint8_t *src, int linesize,
00198 int block_w, int block_h,
00199 int src_x, int src_y, int w, int h);
00200
00201 void ff_add_pixels_clamped_c(const DCTELEM *block, uint8_t *dest, int linesize);
00202 void ff_put_pixels_clamped_c(const DCTELEM *block, uint8_t *dest, int linesize);
00203 void ff_put_signed_pixels_clamped_c(const DCTELEM *block, uint8_t *dest, int linesize);
00204
00208 typedef struct DSPContext {
00209
00210 void (*get_pixels)(DCTELEM *block, const uint8_t *pixels, int line_size);
00211 void (*diff_pixels)(DCTELEM *block, const uint8_t *s1, const uint8_t *s2, int stride);
00212 void (*put_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size);
00213 void (*put_signed_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size);
00214 void (*put_pixels_nonclamped)(const DCTELEM *block, uint8_t *pixels, int line_size);
00215 void (*add_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size);
00216 void (*add_pixels8)(uint8_t *pixels, DCTELEM *block, int line_size);
00217 void (*add_pixels4)(uint8_t *pixels, DCTELEM *block, int line_size);
00218 int (*sum_abs_dctelem)(DCTELEM *block);
00231 void (*emulated_edge_mc)(uint8_t *buf, const uint8_t *src, int linesize,
00232 int block_w, int block_h,
00233 int src_x, int src_y, int w, int h);
00237 void (*gmc1)(uint8_t *dst, uint8_t *src, int srcStride, int h, int x16, int y16, int rounder);
00241 void (*gmc )(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy,
00242 int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height);
00243 void (*clear_block)(DCTELEM *block);
00244 void (*clear_blocks)(DCTELEM *blocks);
00245 int (*pix_sum)(uint8_t * pix, int line_size);
00246 int (*pix_norm1)(uint8_t * pix, int line_size);
00247
00248
00249 me_cmp_func sad[6];
00250 me_cmp_func sse[6];
00251 me_cmp_func hadamard8_diff[6];
00252 me_cmp_func dct_sad[6];
00253 me_cmp_func quant_psnr[6];
00254 me_cmp_func bit[6];
00255 me_cmp_func rd[6];
00256 me_cmp_func vsad[6];
00257 me_cmp_func vsse[6];
00258 me_cmp_func nsse[6];
00259 me_cmp_func w53[6];
00260 me_cmp_func w97[6];
00261 me_cmp_func dct_max[6];
00262 me_cmp_func dct264_sad[6];
00263
00264 me_cmp_func me_pre_cmp[6];
00265 me_cmp_func me_cmp[6];
00266 me_cmp_func me_sub_cmp[6];
00267 me_cmp_func mb_cmp[6];
00268 me_cmp_func ildct_cmp[6];
00269 me_cmp_func frame_skip_cmp[6];
00270
00271 int (*ssd_int8_vs_int16)(const int8_t *pix1, const int16_t *pix2,
00272 int size);
00273
00284 op_pixels_func put_pixels_tab[4][4];
00285
00296 op_pixels_func avg_pixels_tab[4][4];
00297
00308 op_pixels_func put_no_rnd_pixels_tab[4][4];
00309
00320 op_pixels_func avg_no_rnd_pixels_tab[4][4];
00321
00322 void (*put_no_rnd_pixels_l2[2])(uint8_t *block, const uint8_t *a, const uint8_t *b, int line_size, int h);
00323
00334 tpel_mc_func put_tpel_pixels_tab[11];
00335 tpel_mc_func avg_tpel_pixels_tab[11];
00336
00337 qpel_mc_func put_qpel_pixels_tab[2][16];
00338 qpel_mc_func avg_qpel_pixels_tab[2][16];
00339 qpel_mc_func put_no_rnd_qpel_pixels_tab[2][16];
00340 qpel_mc_func avg_no_rnd_qpel_pixels_tab[2][16];
00341 qpel_mc_func put_mspel_pixels_tab[8];
00342
00346 h264_chroma_mc_func put_h264_chroma_pixels_tab[3];
00347 h264_chroma_mc_func avg_h264_chroma_pixels_tab[3];
00348
00349 qpel_mc_func put_h264_qpel_pixels_tab[4][16];
00350 qpel_mc_func avg_h264_qpel_pixels_tab[4][16];
00351
00352 qpel_mc_func put_2tap_qpel_pixels_tab[4][16];
00353 qpel_mc_func avg_2tap_qpel_pixels_tab[4][16];
00354
00355 me_cmp_func pix_abs[2][4];
00356
00357
00358 void (*add_bytes)(uint8_t *dst, uint8_t *src, int w);
00359 void (*add_bytes_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w);
00360 void (*diff_bytes)(uint8_t *dst, uint8_t *src1, uint8_t *src2,int w);
00365 void (*sub_hfyu_median_prediction)(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int w, int *left, int *left_top);
00366 void (*add_hfyu_median_prediction)(uint8_t *dst, const uint8_t *top, const uint8_t *diff, int w, int *left, int *left_top);
00367 int (*add_hfyu_left_prediction)(uint8_t *dst, const uint8_t *src, int w, int left);
00368 void (*add_hfyu_left_prediction_bgr32)(uint8_t *dst, const uint8_t *src, int w, int *red, int *green, int *blue, int *alpha);
00369
00370 void (*add_png_paeth_prediction)(uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp);
00371 void (*bswap_buf)(uint32_t *dst, const uint32_t *src, int w);
00372
00373 void (*h263_v_loop_filter)(uint8_t *src, int stride, int qscale);
00374 void (*h263_h_loop_filter)(uint8_t *src, int stride, int qscale);
00375
00376 void (*h261_loop_filter)(uint8_t *src, int stride);
00377
00378 void (*x8_v_loop_filter)(uint8_t *src, int stride, int qscale);
00379 void (*x8_h_loop_filter)(uint8_t *src, int stride, int qscale);
00380
00381 void (*vp3_idct_dc_add)(uint8_t *dest, int line_size, const DCTELEM *block);
00382 void (*vp3_v_loop_filter)(uint8_t *src, int stride, int *bounding_values);
00383 void (*vp3_h_loop_filter)(uint8_t *src, int stride, int *bounding_values);
00384
00385
00386 void (*vorbis_inverse_coupling)(float *mag, float *ang, int blocksize);
00387 void (*ac3_downmix)(float (*samples)[256], float (*matrix)[2], int out_ch, int in_ch, int len);
00388
00389 void (*vector_fmul)(float *dst, const float *src0, const float *src1, int len);
00390 void (*vector_fmul_reverse)(float *dst, const float *src0, const float *src1, int len);
00391
00392 void (*vector_fmul_add)(float *dst, const float *src0, const float *src1, const float *src2, int len);
00393
00394 void (*vector_fmul_window)(float *dst, const float *src0, const float *src1, const float *win, int len);
00395
00396 void (*vector_clipf)(float *dst , const float *src , float min, float max, int len );
00405 void (*vector_fmul_scalar)(float *dst, const float *src, float mul,
00406 int len);
00419 void (*vector_fmul_sv_scalar[2])(float *dst, const float *src,
00420 const float **sv, float mul, int len);
00431 void (*sv_fmul_scalar[2])(float *dst, const float **sv,
00432 float mul, int len);
00439 float (*scalarproduct_float)(const float *v1, const float *v2, int len);
00446 void (*butterflies_float)(float *restrict v1, float *restrict v2, int len);
00447
00448
00449 void (*fdct)(DCTELEM *block);
00450 void (*fdct248)(DCTELEM *block);
00451
00452
00453 void (*idct)(DCTELEM *block);
00454
00460 void (*idct_put)(uint8_t *dest, int line_size, DCTELEM *block);
00461
00466 void (*idct_add)(uint8_t *dest, int line_size, DCTELEM *block);
00467
00480 uint8_t idct_permutation[64];
00481 int idct_permutation_type;
00482 #define FF_NO_IDCT_PERM 1
00483 #define FF_LIBMPEG2_IDCT_PERM 2
00484 #define FF_SIMPLE_IDCT_PERM 3
00485 #define FF_TRANSPOSE_IDCT_PERM 4
00486 #define FF_PARTTRANS_IDCT_PERM 5
00487 #define FF_SSE2_IDCT_PERM 6
00488
00489 int (*try_8x8basis)(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale);
00490 void (*add_8x8basis)(int16_t rem[64], int16_t basis[64], int scale);
00491 #define BASIS_SHIFT 16
00492 #define RECON_SHIFT 6
00493
00494 void (*draw_edges)(uint8_t *buf, int wrap, int width, int height, int w);
00495 #define EDGE_WIDTH 16
00496
00497 void (*prefetch)(void *mem, int stride, int h);
00498
00499 void (*shrink[4])(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
00500
00501
00502 void (*mlp_filter_channel)(int32_t *state, const int32_t *coeff,
00503 int firorder, int iirorder,
00504 unsigned int filter_shift, int32_t mask, int blocksize,
00505 int32_t *sample_buffer);
00506
00507
00508 void (*x8_spatial_compensation[12])(uint8_t *src , uint8_t *dst, int linesize);
00509 void (*x8_setup_spatial_compensation)(uint8_t *src, uint8_t *dst, int linesize,
00510 int * range, int * sum, int edges);
00511
00517 int32_t (*scalarproduct_int16)(const int16_t *v1, const int16_t *v2, int len, int shift);
00518
00524 int32_t (*scalarproduct_and_madd_int16)(int16_t *v1, const int16_t *v2, const int16_t *v3, int len, int mul);
00525
00526
00527 qpel_mc_func put_rv30_tpel_pixels_tab[4][16];
00528 qpel_mc_func avg_rv30_tpel_pixels_tab[4][16];
00529
00530
00531 qpel_mc_func put_rv40_qpel_pixels_tab[4][16];
00532 qpel_mc_func avg_rv40_qpel_pixels_tab[4][16];
00533 h264_chroma_mc_func put_rv40_chroma_pixels_tab[3];
00534 h264_chroma_mc_func avg_rv40_chroma_pixels_tab[3];
00535
00536
00537 op_fill_func fill_block_tab[2];
00538 void (*scale_block)(const uint8_t src[64], uint8_t *dst, int linesize);
00539 } DSPContext;
00540
00541 void dsputil_static_init(void);
00542 void dsputil_init(DSPContext* p, AVCodecContext *avctx);
00543
00544 int ff_check_alignment(void);
00545
00550 void ff_block_permute(DCTELEM *block, uint8_t *permutation, const uint8_t *scantable, int last);
00551
00552 void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type);
00553
00554 #define BYTE_VEC32(c) ((c)*0x01010101UL)
00555
00556 static inline uint32_t rnd_avg32(uint32_t a, uint32_t b)
00557 {
00558 return (a | b) - (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1);
00559 }
00560
00561 static inline uint32_t no_rnd_avg32(uint32_t a, uint32_t b)
00562 {
00563 return (a & b) + (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1);
00564 }
00565
00566 static inline int get_penalty_factor(int lambda, int lambda2, int type){
00567 switch(type&0xFF){
00568 default:
00569 case FF_CMP_SAD:
00570 return lambda>>FF_LAMBDA_SHIFT;
00571 case FF_CMP_DCT:
00572 return (3*lambda)>>(FF_LAMBDA_SHIFT+1);
00573 case FF_CMP_W53:
00574 return (4*lambda)>>(FF_LAMBDA_SHIFT);
00575 case FF_CMP_W97:
00576 return (2*lambda)>>(FF_LAMBDA_SHIFT);
00577 case FF_CMP_SATD:
00578 case FF_CMP_DCT264:
00579 return (2*lambda)>>FF_LAMBDA_SHIFT;
00580 case FF_CMP_RD:
00581 case FF_CMP_PSNR:
00582 case FF_CMP_SSE:
00583 case FF_CMP_NSSE:
00584 return lambda2>>FF_LAMBDA_SHIFT;
00585 case FF_CMP_BIT:
00586 return 1;
00587 }
00588 }
00589
00595 #define emms_c()
00596
00597 void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx);
00598 void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx);
00599 void dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx);
00600 void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx);
00601 void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx);
00602 void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx);
00603 void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx);
00604 void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx);
00605 void dsputil_init_vis(DSPContext* c, AVCodecContext *avctx);
00606
00607 void ff_dsputil_init_dwt(DSPContext *c);
00608 void ff_rv30dsp_init(DSPContext* c, AVCodecContext *avctx);
00609 void ff_rv40dsp_init(DSPContext* c, AVCodecContext *avctx);
00610 void ff_intrax8dsp_init(DSPContext* c, AVCodecContext *avctx);
00611 void ff_mlp_init(DSPContext* c, AVCodecContext *avctx);
00612 void ff_mlp_init_x86(DSPContext* c, AVCodecContext *avctx);
00613
00614 #if HAVE_MMX
00615
00616 #undef emms_c
00617
00618 static inline void emms(void)
00619 {
00620 __asm__ volatile ("emms;":::"memory");
00621 }
00622
00623 #define emms_c() emms()
00624
00625 #elif ARCH_ARM
00626
00627 #if HAVE_NEON
00628 # define STRIDE_ALIGN 16
00629 #endif
00630
00631 #elif ARCH_PPC
00632
00633 #define STRIDE_ALIGN 16
00634
00635 #elif HAVE_MMI
00636
00637 #define STRIDE_ALIGN 16
00638
00639 #endif
00640
00641 #ifndef STRIDE_ALIGN
00642 # define STRIDE_ALIGN 8
00643 #endif
00644
00645 #define LOCAL_ALIGNED_A(a, t, v, s, o, ...) \
00646 uint8_t la_##v[sizeof(t s o) + (a)]; \
00647 t (*v) o = (void *)FFALIGN((uintptr_t)la_##v, a)
00648
00649 #define LOCAL_ALIGNED_D(a, t, v, s, o, ...) DECLARE_ALIGNED(a, t, v) s o
00650
00651 #define LOCAL_ALIGNED(a, t, v, ...) LOCAL_ALIGNED_A(a, t, v, __VA_ARGS__,,)
00652
00653 #if HAVE_LOCAL_ALIGNED_8
00654 # define LOCAL_ALIGNED_8(t, v, ...) LOCAL_ALIGNED_D(8, t, v, __VA_ARGS__,,)
00655 #else
00656 # define LOCAL_ALIGNED_8(t, v, ...) LOCAL_ALIGNED(8, t, v, __VA_ARGS__)
00657 #endif
00658
00659 #if HAVE_LOCAL_ALIGNED_16
00660 # define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED_D(16, t, v, __VA_ARGS__,,)
00661 #else
00662 # define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED(16, t, v, __VA_ARGS__)
00663 #endif
00664
00665
00666 void get_psnr(uint8_t *orig_image[3], uint8_t *coded_image[3],
00667 int orig_linesize[3], int coded_linesize,
00668 AVCodecContext *avctx);
00669
00670 #define WRAPPER8_16(name8, name16)\
00671 static int name16(void *s, uint8_t *dst, uint8_t *src, int stride, int h){\
00672 return name8(s, dst , src , stride, h)\
00673 +name8(s, dst+8 , src+8 , stride, h);\
00674 }
00675
00676 #define WRAPPER8_16_SQ(name8, name16)\
00677 static int name16(void *s, uint8_t *dst, uint8_t *src, int stride, int h){\
00678 int score=0;\
00679 score +=name8(s, dst , src , stride, 8);\
00680 score +=name8(s, dst+8 , src+8 , stride, 8);\
00681 if(h==16){\
00682 dst += 8*stride;\
00683 src += 8*stride;\
00684 score +=name8(s, dst , src , stride, 8);\
00685 score +=name8(s, dst+8 , src+8 , stride, 8);\
00686 }\
00687 return score;\
00688 }
00689
00690
00691 static inline void copy_block2(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
00692 {
00693 int i;
00694 for(i=0; i<h; i++)
00695 {
00696 AV_WN16(dst , AV_RN16(src ));
00697 dst+=dstStride;
00698 src+=srcStride;
00699 }
00700 }
00701
00702 static inline void copy_block4(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
00703 {
00704 int i;
00705 for(i=0; i<h; i++)
00706 {
00707 AV_WN32(dst , AV_RN32(src ));
00708 dst+=dstStride;
00709 src+=srcStride;
00710 }
00711 }
00712
00713 static inline void copy_block8(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
00714 {
00715 int i;
00716 for(i=0; i<h; i++)
00717 {
00718 AV_WN32(dst , AV_RN32(src ));
00719 AV_WN32(dst+4 , AV_RN32(src+4 ));
00720 dst+=dstStride;
00721 src+=srcStride;
00722 }
00723 }
00724
00725 static inline void copy_block9(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
00726 {
00727 int i;
00728 for(i=0; i<h; i++)
00729 {
00730 AV_WN32(dst , AV_RN32(src ));
00731 AV_WN32(dst+4 , AV_RN32(src+4 ));
00732 dst[8]= src[8];
00733 dst+=dstStride;
00734 src+=srcStride;
00735 }
00736 }
00737
00738 static inline void copy_block16(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
00739 {
00740 int i;
00741 for(i=0; i<h; i++)
00742 {
00743 AV_WN32(dst , AV_RN32(src ));
00744 AV_WN32(dst+4 , AV_RN32(src+4 ));
00745 AV_WN32(dst+8 , AV_RN32(src+8 ));
00746 AV_WN32(dst+12, AV_RN32(src+12));
00747 dst+=dstStride;
00748 src+=srcStride;
00749 }
00750 }
00751
00752 static inline void copy_block17(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
00753 {
00754 int i;
00755 for(i=0; i<h; i++)
00756 {
00757 AV_WN32(dst , AV_RN32(src ));
00758 AV_WN32(dst+4 , AV_RN32(src+4 ));
00759 AV_WN32(dst+8 , AV_RN32(src+8 ));
00760 AV_WN32(dst+12, AV_RN32(src+12));
00761 dst[16]= src[16];
00762 dst+=dstStride;
00763 src+=srcStride;
00764 }
00765 }
00766
00767 #endif