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 void (*bswap16_buf)(uint16_t *dst, const uint16_t *src, int len);
00373
00374 void (*h263_v_loop_filter)(uint8_t *src, int stride, int qscale);
00375 void (*h263_h_loop_filter)(uint8_t *src, int stride, int qscale);
00376
00377 void (*h261_loop_filter)(uint8_t *src, int stride);
00378
00379 void (*x8_v_loop_filter)(uint8_t *src, int stride, int qscale);
00380 void (*x8_h_loop_filter)(uint8_t *src, int stride, int qscale);
00381
00382 void (*vp3_idct_dc_add)(uint8_t *dest, int line_size, const DCTELEM *block);
00383 void (*vp3_v_loop_filter)(uint8_t *src, int stride, int *bounding_values);
00384 void (*vp3_h_loop_filter)(uint8_t *src, int stride, int *bounding_values);
00385
00386
00387 void (*vorbis_inverse_coupling)(float *mag, float *ang, int blocksize);
00388 void (*ac3_downmix)(float (*samples)[256], float (*matrix)[2], int out_ch, int in_ch, int len);
00389
00390 void (*vector_fmul)(float *dst, const float *src0, const float *src1, int len);
00391 void (*vector_fmul_reverse)(float *dst, const float *src0, const float *src1, int len);
00392
00393 void (*vector_fmul_add)(float *dst, const float *src0, const float *src1, const float *src2, int len);
00394
00395 void (*vector_fmul_window)(float *dst, const float *src0, const float *src1, const float *win, int len);
00396
00397 void (*vector_clipf)(float *dst , const float *src , float min, float max, int len );
00406 void (*vector_fmul_scalar)(float *dst, const float *src, float mul,
00407 int len);
00420 void (*vector_fmul_sv_scalar[2])(float *dst, const float *src,
00421 const float **sv, float mul, int len);
00432 void (*sv_fmul_scalar[2])(float *dst, const float **sv,
00433 float mul, int len);
00440 float (*scalarproduct_float)(const float *v1, const float *v2, int len);
00447 void (*butterflies_float)(float *restrict v1, float *restrict v2, int len);
00448
00449
00450 void (*fdct)(DCTELEM *block);
00451 void (*fdct248)(DCTELEM *block);
00452
00453
00454 void (*idct)(DCTELEM *block);
00455
00461 void (*idct_put)(uint8_t *dest, int line_size, DCTELEM *block);
00462
00467 void (*idct_add)(uint8_t *dest, int line_size, DCTELEM *block);
00468
00481 uint8_t idct_permutation[64];
00482 int idct_permutation_type;
00483 #define FF_NO_IDCT_PERM 1
00484 #define FF_LIBMPEG2_IDCT_PERM 2
00485 #define FF_SIMPLE_IDCT_PERM 3
00486 #define FF_TRANSPOSE_IDCT_PERM 4
00487 #define FF_PARTTRANS_IDCT_PERM 5
00488 #define FF_SSE2_IDCT_PERM 6
00489
00490 int (*try_8x8basis)(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale);
00491 void (*add_8x8basis)(int16_t rem[64], int16_t basis[64], int scale);
00492 #define BASIS_SHIFT 16
00493 #define RECON_SHIFT 6
00494
00495 void (*draw_edges)(uint8_t *buf, int wrap, int width, int height, int w, int sides);
00496 #define EDGE_WIDTH 16
00497 #define EDGE_TOP 1
00498 #define EDGE_BOTTOM 2
00499
00500 void (*prefetch)(void *mem, int stride, int h);
00501
00502 void (*shrink[4])(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
00503
00504
00505 void (*mlp_filter_channel)(int32_t *state, const int32_t *coeff,
00506 int firorder, int iirorder,
00507 unsigned int filter_shift, int32_t mask, int blocksize,
00508 int32_t *sample_buffer);
00509
00510
00511 void (*x8_spatial_compensation[12])(uint8_t *src , uint8_t *dst, int linesize);
00512 void (*x8_setup_spatial_compensation)(uint8_t *src, uint8_t *dst, int linesize,
00513 int * range, int * sum, int edges);
00514
00520 int32_t (*scalarproduct_int16)(const int16_t *v1, const int16_t *v2, int len, int shift);
00521
00527 int32_t (*scalarproduct_and_madd_int16)(int16_t *v1, const int16_t *v2, const int16_t *v3, int len, int mul);
00528
00529
00530 qpel_mc_func put_rv30_tpel_pixels_tab[4][16];
00531 qpel_mc_func avg_rv30_tpel_pixels_tab[4][16];
00532
00533
00534 qpel_mc_func put_rv40_qpel_pixels_tab[4][16];
00535 qpel_mc_func avg_rv40_qpel_pixels_tab[4][16];
00536 h264_chroma_mc_func put_rv40_chroma_pixels_tab[3];
00537 h264_chroma_mc_func avg_rv40_chroma_pixels_tab[3];
00538
00539
00540 op_fill_func fill_block_tab[2];
00541 void (*scale_block)(const uint8_t src[64], uint8_t *dst, int linesize);
00542 } DSPContext;
00543
00544 void dsputil_static_init(void);
00545 void dsputil_init(DSPContext* p, AVCodecContext *avctx);
00546
00547 int ff_check_alignment(void);
00548
00553 void ff_block_permute(DCTELEM *block, uint8_t *permutation, const uint8_t *scantable, int last);
00554
00555 void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type);
00556
00557 #define BYTE_VEC32(c) ((c)*0x01010101UL)
00558
00559 static inline uint32_t rnd_avg32(uint32_t a, uint32_t b)
00560 {
00561 return (a | b) - (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1);
00562 }
00563
00564 static inline uint32_t no_rnd_avg32(uint32_t a, uint32_t b)
00565 {
00566 return (a & b) + (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1);
00567 }
00568
00569 static inline int get_penalty_factor(int lambda, int lambda2, int type){
00570 switch(type&0xFF){
00571 default:
00572 case FF_CMP_SAD:
00573 return lambda>>FF_LAMBDA_SHIFT;
00574 case FF_CMP_DCT:
00575 return (3*lambda)>>(FF_LAMBDA_SHIFT+1);
00576 case FF_CMP_W53:
00577 return (4*lambda)>>(FF_LAMBDA_SHIFT);
00578 case FF_CMP_W97:
00579 return (2*lambda)>>(FF_LAMBDA_SHIFT);
00580 case FF_CMP_SATD:
00581 case FF_CMP_DCT264:
00582 return (2*lambda)>>FF_LAMBDA_SHIFT;
00583 case FF_CMP_RD:
00584 case FF_CMP_PSNR:
00585 case FF_CMP_SSE:
00586 case FF_CMP_NSSE:
00587 return lambda2>>FF_LAMBDA_SHIFT;
00588 case FF_CMP_BIT:
00589 return 1;
00590 }
00591 }
00592
00598 #define emms_c()
00599
00600 void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx);
00601 void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx);
00602 void dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx);
00603 void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx);
00604 void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx);
00605 void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx);
00606 void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx);
00607 void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx);
00608 void dsputil_init_vis(DSPContext* c, AVCodecContext *avctx);
00609
00610 void ff_dsputil_init_dwt(DSPContext *c);
00611 void ff_rv30dsp_init(DSPContext* c, AVCodecContext *avctx);
00612 void ff_rv40dsp_init(DSPContext* c, AVCodecContext *avctx);
00613 void ff_intrax8dsp_init(DSPContext* c, AVCodecContext *avctx);
00614 void ff_mlp_init(DSPContext* c, AVCodecContext *avctx);
00615 void ff_mlp_init_x86(DSPContext* c, AVCodecContext *avctx);
00616
00617 #if HAVE_MMX
00618
00619 #undef emms_c
00620
00621 static inline void emms(void)
00622 {
00623 __asm__ volatile ("emms;":::"memory");
00624 }
00625
00626 #define emms_c() emms()
00627
00628 #elif ARCH_ARM
00629
00630 #if HAVE_NEON
00631 # define STRIDE_ALIGN 16
00632 #endif
00633
00634 #elif ARCH_PPC
00635
00636 #define STRIDE_ALIGN 16
00637
00638 #elif HAVE_MMI
00639
00640 #define STRIDE_ALIGN 16
00641
00642 #endif
00643
00644 #ifndef STRIDE_ALIGN
00645 # define STRIDE_ALIGN 8
00646 #endif
00647
00648 #define LOCAL_ALIGNED_A(a, t, v, s, o, ...) \
00649 uint8_t la_##v[sizeof(t s o) + (a)]; \
00650 t (*v) o = (void *)FFALIGN((uintptr_t)la_##v, a)
00651
00652 #define LOCAL_ALIGNED_D(a, t, v, s, o, ...) DECLARE_ALIGNED(a, t, v) s o
00653
00654 #define LOCAL_ALIGNED(a, t, v, ...) LOCAL_ALIGNED_A(a, t, v, __VA_ARGS__,,)
00655
00656 #if HAVE_LOCAL_ALIGNED_8
00657 # define LOCAL_ALIGNED_8(t, v, ...) LOCAL_ALIGNED_D(8, t, v, __VA_ARGS__,,)
00658 #else
00659 # define LOCAL_ALIGNED_8(t, v, ...) LOCAL_ALIGNED(8, t, v, __VA_ARGS__)
00660 #endif
00661
00662 #if HAVE_LOCAL_ALIGNED_16
00663 # define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED_D(16, t, v, __VA_ARGS__,,)
00664 #else
00665 # define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED(16, t, v, __VA_ARGS__)
00666 #endif
00667
00668
00669 void get_psnr(uint8_t *orig_image[3], uint8_t *coded_image[3],
00670 int orig_linesize[3], int coded_linesize,
00671 AVCodecContext *avctx);
00672
00673 #define WRAPPER8_16(name8, name16)\
00674 static int name16(void *s, uint8_t *dst, uint8_t *src, int stride, int h){\
00675 return name8(s, dst , src , stride, h)\
00676 +name8(s, dst+8 , src+8 , stride, h);\
00677 }
00678
00679 #define WRAPPER8_16_SQ(name8, name16)\
00680 static int name16(void *s, uint8_t *dst, uint8_t *src, int stride, int h){\
00681 int score=0;\
00682 score +=name8(s, dst , src , stride, 8);\
00683 score +=name8(s, dst+8 , src+8 , stride, 8);\
00684 if(h==16){\
00685 dst += 8*stride;\
00686 src += 8*stride;\
00687 score +=name8(s, dst , src , stride, 8);\
00688 score +=name8(s, dst+8 , src+8 , stride, 8);\
00689 }\
00690 return score;\
00691 }
00692
00693
00694 static inline void copy_block2(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
00695 {
00696 int i;
00697 for(i=0; i<h; i++)
00698 {
00699 AV_WN16(dst , AV_RN16(src ));
00700 dst+=dstStride;
00701 src+=srcStride;
00702 }
00703 }
00704
00705 static inline void copy_block4(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
00706 {
00707 int i;
00708 for(i=0; i<h; i++)
00709 {
00710 AV_WN32(dst , AV_RN32(src ));
00711 dst+=dstStride;
00712 src+=srcStride;
00713 }
00714 }
00715
00716 static inline void copy_block8(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
00717 {
00718 int i;
00719 for(i=0; i<h; i++)
00720 {
00721 AV_WN32(dst , AV_RN32(src ));
00722 AV_WN32(dst+4 , AV_RN32(src+4 ));
00723 dst+=dstStride;
00724 src+=srcStride;
00725 }
00726 }
00727
00728 static inline void copy_block9(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
00729 {
00730 int i;
00731 for(i=0; i<h; i++)
00732 {
00733 AV_WN32(dst , AV_RN32(src ));
00734 AV_WN32(dst+4 , AV_RN32(src+4 ));
00735 dst[8]= src[8];
00736 dst+=dstStride;
00737 src+=srcStride;
00738 }
00739 }
00740
00741 static inline void copy_block16(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
00742 {
00743 int i;
00744 for(i=0; i<h; i++)
00745 {
00746 AV_WN32(dst , AV_RN32(src ));
00747 AV_WN32(dst+4 , AV_RN32(src+4 ));
00748 AV_WN32(dst+8 , AV_RN32(src+8 ));
00749 AV_WN32(dst+12, AV_RN32(src+12));
00750 dst+=dstStride;
00751 src+=srcStride;
00752 }
00753 }
00754
00755 static inline void copy_block17(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
00756 {
00757 int i;
00758 for(i=0; i<h; i++)
00759 {
00760 AV_WN32(dst , AV_RN32(src ));
00761 AV_WN32(dst+4 , AV_RN32(src+4 ));
00762 AV_WN32(dst+8 , AV_RN32(src+8 ));
00763 AV_WN32(dst+12, AV_RN32(src+12));
00764 dst[16]= src[16];
00765 dst+=dstStride;
00766 src+=srcStride;
00767 }
00768 }
00769
00770 #endif