]> git.sesse.net Git - x264/blob - common/mc.h
memzero_aligned_mmx
[x264] / common / mc.h
1 /*****************************************************************************
2  * mc.h: h264 encoder library (Motion Compensation)
3  *****************************************************************************
4  * Copyright (C) 2003 Laurent Aimar
5  * $Id: mc.h,v 1.1 2004/06/03 19:27:07 fenrir Exp $
6  *
7  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 #ifndef X264_MC_H
25 #define X264_MC_H
26
27 /* Do the MC
28  * XXX: Only width = 4, 8 or 16 are valid
29  * width == 4 -> height == 4 or 8
30  * width == 8 -> height == 4 or 8 or 16
31  * width == 16-> height == 8 or 16
32  * */
33
34 typedef struct
35 {
36     void (*mc_luma)(uint8_t *dst, int i_dst, uint8_t **src, int i_src,
37                     int mvx, int mvy,
38                     int i_width, int i_height );
39
40     /* may round up the dimensions if they're not a power of 2 */
41     uint8_t* (*get_ref)(uint8_t *dst, int *i_dst, uint8_t **src, int i_src,
42                         int mvx, int mvy,
43                         int i_width, int i_height );
44
45     /* mc_chroma may write up to 2 bytes of garbage to the right of dst,
46      * so it must be run from left to right. */
47     void (*mc_chroma)(uint8_t *dst, int i_dst, uint8_t *src, int i_src,
48                       int mvx, int mvy,
49                       int i_width, int i_height );
50
51     void (*avg[10])( uint8_t *dst, int, uint8_t *src, int );
52     void (*avg_weight[10])( uint8_t *dst, int, uint8_t *src, int, int i_weight );
53
54     /* only 16x16, 8x8, and 4x4 defined */
55     void (*copy[7])( uint8_t *dst, int, uint8_t *src, int, int i_height );
56
57     void (*plane_copy)( uint8_t *dst, int i_dst,
58                         uint8_t *src, int i_src, int w, int h);
59
60     void (*hpel_filter)( uint8_t *dsth, uint8_t *dstv, uint8_t *dstc, uint8_t *src,
61                          int i_stride, int i_width, int i_height );
62
63     /* prefetch the next few macroblocks of fenc or fdec */
64     void (*prefetch_fenc)( uint8_t *pix_y, int stride_y,
65                            uint8_t *pix_uv, int stride_uv, int mb_x );
66     /* prefetch the next few macroblocks of a hpel reference frame */
67     void (*prefetch_ref)( uint8_t *pix, int stride, int parity );
68     
69     void *(*memcpy_aligned)( void *dst, const void *src, size_t n );
70     void (*memzero_aligned)( void *dst, int n );
71
72 } x264_mc_functions_t;
73
74 void x264_mc_init( int cpu, x264_mc_functions_t *pf );
75
76 #endif