]> git.sesse.net Git - ffmpeg/blob - libavcodec/hpeldsp.h
Merge commit '2957d29f0531ccd8a6f4378293424dfd92db3044'
[ffmpeg] / libavcodec / hpeldsp.h
1 /*
2  * Half-pel DSP functions.
3  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
4  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * 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  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22
23 /**
24  * @file
25  * Half-pel DSP functions.
26  */
27
28 #ifndef AVCODEC_HPELDSP_H
29 #define AVCODEC_HPELDSP_H
30
31 #include <stdint.h>
32 #include <stddef.h>
33
34 /* add and put pixel (decoding) */
35 // blocksizes for hpel_pixels_func are 8x4,8x8 16x8 16x16
36 // h for hpel_pixels_func is limited to {width/2, width} but never larger
37 // than 16 and never smaller than 4
38 typedef void (*hpel_pixels_func)(uint8_t *block /*align width (8 or 16)*/,
39                                  const uint8_t *pixels /*align 1*/,
40                                  ptrdiff_t line_size, int h);
41 typedef void (*op_pixels_func)(uint8_t *block /*align width (8 or 16)*/,
42                                const uint8_t *pixels /*align 1*/,
43                                ptrdiff_t line_size, int h);
44
45 /**
46  * Half-pel DSP context.
47  */
48 typedef struct HpelDSPContext {
49     /**
50      * Halfpel motion compensation with rounding (a+b+1)>>1.
51      * this is an array[4][4] of motion compensation functions for 4
52      * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
53      * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
54      * @param block destination where the result is stored
55      * @param pixels source
56      * @param line_size number of bytes in a horizontal line of block
57      * @param h height
58      */
59     hpel_pixels_func put_pixels_tab[4][4];
60
61     /**
62      * Halfpel motion compensation with rounding (a+b+1)>>1.
63      * This is an array[4][4] of motion compensation functions for 4
64      * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
65      * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
66      * @param block destination into which the result is averaged (a+b+1)>>1
67      * @param pixels source
68      * @param line_size number of bytes in a horizontal line of block
69      * @param h height
70      */
71     hpel_pixels_func avg_pixels_tab[4][4];
72
73     /**
74      * Halfpel motion compensation with no rounding (a+b)>>1.
75      * this is an array[4][4] of motion compensation functions for 2
76      * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
77      * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
78      * @param block destination where the result is stored
79      * @param pixels source
80      * @param line_size number of bytes in a horizontal line of block
81      * @param h height
82      */
83     hpel_pixels_func put_no_rnd_pixels_tab[4][4];
84
85     /**
86      * Halfpel motion compensation with no rounding (a+b)>>1.
87      * this is an array[4] of motion compensation functions for 1
88      * horizontal blocksize (16) and the 4 halfpel positions<br>
89      * *pixels_tab[0][ xhalfpel + 2*yhalfpel ]
90      * @param block destination into which the result is averaged (a+b)>>1
91      * @param pixels source
92      * @param line_size number of bytes in a horizontal line of block
93      * @param h height
94      */
95     hpel_pixels_func avg_no_rnd_pixels_tab[4];
96 } HpelDSPContext;
97
98 void ff_hpeldsp_init(HpelDSPContext *c, int flags);
99
100 void ff_hpeldsp_init_alpha(HpelDSPContext *c, int flags);
101 void ff_hpeldsp_init_arm(HpelDSPContext *c, int flags);
102 void ff_hpeldsp_init_bfin(HpelDSPContext *c, int flags);
103 void ff_hpeldsp_init_ppc(HpelDSPContext *c, int flags);
104 void ff_hpeldsp_init_sh4(HpelDSPContext *c, int flags);
105 void ff_hpeldsp_init_vis(HpelDSPContext *c, int flags);
106 void ff_hpeldsp_init_x86(HpelDSPContext *c, int flags);
107
108 #endif /* AVCODEC_HPELDSP_H */