]> git.sesse.net Git - ffmpeg/blob - libavcodec/ivi_dsp.h
dca: Move data tables from a header to an object file
[ffmpeg] / libavcodec / ivi_dsp.h
1 /*
2  * DSP functions for Indeo Video Interactive codecs (Indeo4 and Indeo5)
3  *
4  * Copyright (c) 2009-2011 Maxim Poliakovski
5  *
6  * This file is part of Libav.
7  *
8  * Libav 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  * Libav 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 Libav; 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  * DSP functions (inverse transforms, motion compensations, wavelet recompostion)
26  * for Indeo Video Interactive codecs.
27  */
28
29 #ifndef AVCODEC_IVI_DSP_H
30 #define AVCODEC_IVI_DSP_H
31
32 #include "avcodec.h"
33 #include "ivi_common.h"
34
35 /**
36  *  5/3 wavelet recomposition filter for Indeo5
37  *
38  *  @param[in]   plane        pointer to the descriptor of the plane being processed
39  *  @param[out]  dst          pointer to the destination buffer
40  *  @param[in]   dst_pitch    pitch of the destination buffer
41  */
42 void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst,
43                         const int dst_pitch);
44
45 /**
46  *  Haar wavelet recomposition filter for Indeo 4
47  *
48  *  @param[in]  plane        pointer to the descriptor of the plane being processed
49  *  @param[out] dst          pointer to the destination buffer
50  *  @param[in]  dst_pitch    pitch of the destination buffer
51  */
52 void ff_ivi_recompose_haar(const IVIPlaneDesc *plane, uint8_t *dst,
53                            const int dst_pitch);
54
55 /**
56  *  two-dimensional inverse Haar 8x8 transform for Indeo 4
57  *
58  *  @param[in]  in        pointer to the vector of transform coefficients
59  *  @param[out] out       pointer to the output buffer (frame)
60  *  @param[in]  pitch     pitch to move to the next y line
61  *  @param[in]  flags     pointer to the array of column flags:
62  *                        != 0 - non_empty column, 0 - empty one
63  *                        (this array must be filled by caller)
64  */
65 void ff_ivi_inverse_haar_8x8(const int32_t *in, int16_t *out, uint32_t pitch,
66                              const uint8_t *flags);
67
68 /**
69  *  one-dimensional inverse 8-point Haar transform on rows for Indeo 4
70  *
71  *  @param[in]  in        pointer to the vector of transform coefficients
72  *  @param[out] out       pointer to the output buffer (frame)
73  *  @param[in]  pitch     pitch to move to the next y line
74  *  @param[in]  flags     pointer to the array of column flags:
75  *                        != 0 - non_empty column, 0 - empty one
76  *                        (this array must be filled by caller)
77  */
78 void ff_ivi_row_haar8(const int32_t *in, int16_t *out, uint32_t pitch,
79                       const uint8_t *flags);
80
81 /**
82  *  one-dimensional inverse 8-point Haar transform on columns for Indeo 4
83  *
84  *  @param[in]  in        pointer to the vector of transform coefficients
85  *  @param[out] out       pointer to the output buffer (frame)
86  *  @param[in]  pitch     pitch to move to the next y line
87  *  @param[in]  flags     pointer to the array of column flags:
88  *                        != 0 - non_empty column, 0 - empty one
89  *                        (this array must be filled by caller)
90  */
91 void ff_ivi_col_haar8(const int32_t *in, int16_t *out, uint32_t pitch,
92                       const uint8_t *flags);
93
94 /**
95  *  two-dimensional inverse Haar 4x4 transform for Indeo 4
96  *
97  *  @param[in]  in        pointer to the vector of transform coefficients
98  *  @param[out] out       pointer to the output buffer (frame)
99  *  @param[in]  pitch     pitch to move to the next y line
100  *  @param[in]  flags     pointer to the array of column flags:
101  *                        != 0 - non_empty column, 0 - empty one
102  *                        (this array must be filled by caller)
103  */
104 void ff_ivi_inverse_haar_4x4(const int32_t *in, int16_t *out, uint32_t pitch,
105                              const uint8_t *flags);
106
107 /**
108  *  one-dimensional inverse 4-point Haar transform on rows for Indeo 4
109  *
110  *  @param[in]  in        pointer to the vector of transform coefficients
111  *  @param[out] out       pointer to the output buffer (frame)
112  *  @param[in]  pitch     pitch to move to the next y line
113  *  @param[in]  flags     pointer to the array of column flags:
114  *                        != 0 - non_empty column, 0 - empty one
115  *                        (this array must be filled by caller)
116  */
117 void ff_ivi_row_haar4(const int32_t *in, int16_t *out, uint32_t pitch,
118                       const uint8_t *flags);
119
120 /**
121  *  one-dimensional inverse 4-point Haar transform on columns for Indeo 4
122  *
123  *  @param[in]  in        pointer to the vector of transform coefficients
124  *  @param[out] out       pointer to the output buffer (frame)
125  *  @param[in]  pitch     pitch to move to the next y line
126  *  @param[in]  flags     pointer to the array of column flags:
127  *                        != 0 - non_empty column, 0 - empty one
128  *                        (this array must be filled by caller)
129  */
130 void ff_ivi_col_haar4(const int32_t *in, int16_t *out, uint32_t pitch,
131                       const uint8_t *flags);
132
133 /**
134  *  DC-only two-dimensional inverse Haar transform for Indeo 4.
135  *  Performing the inverse transform in this case is equivalent to
136  *  spreading DC_coeff >> 3 over the whole block.
137  *
138  *  @param[in]  in          pointer to the dc coefficient
139  *  @param[out] out         pointer to the output buffer (frame)
140  *  @param[in]  pitch       pitch to move to the next y line
141  *  @param[in]  blk_size    transform block size
142  */
143 void ff_ivi_dc_haar_2d(const int32_t *in, int16_t *out, uint32_t pitch,
144                        int blk_size);
145
146 /**
147  *  two-dimensional inverse slant 8x8 transform
148  *
149  *  @param[in]    in      pointer to the vector of transform coefficients
150  *  @param[out]   out     pointer to the output buffer (frame)
151  *  @param[in]    pitch   pitch to move to the next y line
152  *  @param[in]    flags   pointer to the array of column flags:
153  *                        != 0 - non_empty column, 0 - empty one
154  *                        (this array must be filled by caller)
155  */
156 void ff_ivi_inverse_slant_8x8(const int32_t *in, int16_t *out, uint32_t pitch,
157                               const uint8_t *flags);
158
159 /**
160  *  two-dimensional inverse slant 4x4 transform
161  *
162  *  @param[in]    in      pointer to the vector of transform coefficients
163  *  @param[out]   out     pointer to the output buffer (frame)
164  *  @param[in]    pitch   pitch to move to the next y line
165  *  @param[in]    flags   pointer to the array of column flags:
166  *                        != 0 - non_empty column, 0 - empty one
167  *                        (this array must be filled by caller)
168  */
169 void ff_ivi_inverse_slant_4x4(const int32_t *in, int16_t *out, uint32_t pitch,
170                               const uint8_t *flags);
171
172 /**
173  *  DC-only two-dimensional inverse slant transform.
174  *  Performing the inverse slant transform in this case is equivalent to
175  *  spreading (DC_coeff + 1)/2 over the whole block.
176  *  It works much faster than performing the slant transform on a vector of zeroes.
177  *
178  *  @param[in]    in          pointer to the dc coefficient
179  *  @param[out]   out         pointer to the output buffer (frame)
180  *  @param[in]    pitch       pitch to move to the next y line
181  *  @param[in]    blk_size    transform block size
182  */
183 void ff_ivi_dc_slant_2d(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
184
185 /**
186  *  inverse 1D row slant transform
187  *
188  *  @param[in]    in      pointer to the vector of transform coefficients
189  *  @param[out]   out     pointer to the output buffer (frame)
190  *  @param[in]    pitch   pitch to move to the next y line
191  *  @param[in]    flags   pointer to the array of column flags (unused here)
192  */
193 void ff_ivi_row_slant8(const int32_t *in, int16_t *out, uint32_t pitch,
194                        const uint8_t *flags);
195
196 /**
197  *  inverse 1D column slant transform
198  *
199  *  @param[in]    in      pointer to the vector of transform coefficients
200  *  @param[out]   out     pointer to the output buffer (frame)
201  *  @param[in]    pitch   pitch to move to the next y line
202  *  @param[in]    flags   pointer to the array of column flags:
203  *                        != 0 - non_empty column, 0 - empty one
204  *                        (this array must be filled by caller)
205  */
206 void ff_ivi_col_slant8(const int32_t *in, int16_t *out, uint32_t pitch,
207                        const uint8_t *flags);
208
209 /**
210  *  inverse 1D row slant transform
211  *
212  *  @param[in]    in      pointer to the vector of transform coefficients
213  *  @param[out]   out     pointer to the output buffer (frame)
214  *  @param[in]    pitch   pitch to move to the next y line
215  *  @param[in]    flags   pointer to the array of column flags (unused here)
216  */
217 void ff_ivi_row_slant4(const int32_t *in, int16_t *out, uint32_t pitch,
218                        const uint8_t *flags);
219
220 /**
221  *  inverse 1D column slant transform
222  *
223  *  @param[in]    in      pointer to the vector of transform coefficients
224  *  @param[out]   out     pointer to the output buffer (frame)
225  *  @param[in]    pitch   pitch to move to the next y line
226  *  @param[in]    flags   pointer to the array of column flags:
227  *                        != 0 - non_empty column, 0 - empty one
228  *                        (this array must be filled by caller)
229  */
230 void ff_ivi_col_slant4(const int32_t *in, int16_t *out, uint32_t pitch,
231                        const uint8_t *flags);
232
233 /**
234  *  DC-only inverse row slant transform
235  */
236 void ff_ivi_dc_row_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
237
238 /**
239  *  DC-only inverse column slant transform
240  */
241 void ff_ivi_dc_col_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
242
243 /**
244  *  Copy the pixels into the frame buffer.
245  */
246 void ff_ivi_put_pixels_8x8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags);
247
248 /**
249  *  Copy the DC coefficient into the first pixel of the block and
250  *  zero all others.
251  */
252 void ff_ivi_put_dc_pixel_8x8(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
253
254 /**
255  *  8x8 block motion compensation with adding delta
256  *
257  *  @param[in,out]   buf      pointer to the block in the current frame buffer containing delta
258  *  @param[in]       ref_buf  pointer to the corresponding block in the reference frame
259  *  @param[in]       pitch    pitch for moving to the next y line
260  *  @param[in]       mc_type  interpolation type
261  */
262 void ff_ivi_mc_8x8_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
263
264 /**
265  *  4x4 block motion compensation with adding delta
266  *
267  *  @param[in,out]   buf      pointer to the block in the current frame buffer containing delta
268  *  @param[in]       ref_buf  pointer to the corresponding block in the reference frame
269  *  @param[in]       pitch    pitch for moving to the next y line
270  *  @param[in]       mc_type  interpolation type
271  */
272 void ff_ivi_mc_4x4_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
273
274 /**
275  *  motion compensation without adding delta
276  *
277  *  @param[in,out]  buf      pointer to the block in the current frame receiving the result
278  *  @param[in]      ref_buf  pointer to the corresponding block in the reference frame
279  *  @param[in]      pitch    pitch for moving to the next y line
280  *  @param[in]      mc_type  interpolation type
281  */
282 void ff_ivi_mc_8x8_no_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
283
284 /**
285  *  4x4 block motion compensation without adding delta
286  *
287  *  @param[in,out]  buf      pointer to the block in the current frame receiving the result
288  *  @param[in]      ref_buf  pointer to the corresponding block in the reference frame
289  *  @param[in]      pitch    pitch for moving to the next y line
290  *  @param[in]      mc_type  interpolation type
291  */
292 void ff_ivi_mc_4x4_no_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
293
294 /**
295  *  8x8 block motion compensation with adding delta
296  *
297  *  @param[in,out]  buf      pointer to the block in the current frame buffer containing delta
298  *  @param[in]      ref_buf  pointer to the corresponding block in the backward reference frame
299  *  @param[in]      ref_buf2 pointer to the corresponding block in the forward reference frame
300  *  @param[in]      pitch    pitch for moving to the next y line
301  *  @param[in]      mc_type  interpolation type for backward reference
302  *  @param[in]      mc_type2 interpolation type for forward reference
303  */
304 void ff_ivi_mc_avg_8x8_delta(int16_t *buf, const int16_t *ref_buf, const int16_t *ref_buf2, uint32_t pitch, int mc_type, int mc_type2);
305
306 /**
307  *  4x4 block motion compensation with adding delta
308  *
309  *  @param[in,out]  buf      pointer to the block in the current frame buffer containing delta
310  *  @param[in]      ref_buf  pointer to the corresponding block in the backward reference frame
311  *  @param[in]      ref_buf2 pointer to the corresponding block in the forward reference frame
312  *  @param[in]      pitch    pitch for moving to the next y line
313  *  @param[in]      mc_type  interpolation type for backward reference
314  *  @param[in]      mc_type2 interpolation type for forward reference
315  */
316 void ff_ivi_mc_avg_4x4_delta(int16_t *buf, const int16_t *ref_buf, const int16_t *ref_buf2, uint32_t pitch, int mc_type, int mc_type2);
317
318 /**
319  *  motion compensation without adding delta for B-frames
320  *
321  *  @param[in,out]  buf      pointer to the block in the current frame receiving the result
322  *  @param[in]      ref_buf  pointer to the corresponding block in the backward reference frame
323  *  @param[in]      ref_buf2 pointer to the corresponding block in the forward reference frame
324  *  @param[in]      pitch    pitch for moving to the next y line
325  *  @param[in]      mc_type  interpolation type for backward reference
326  *  @param[in]      mc_type2 interpolation type for forward reference
327  */
328 void ff_ivi_mc_avg_8x8_no_delta(int16_t *buf, const int16_t *ref_buf, const int16_t *ref_buf2, uint32_t pitch, int mc_type, int mc_type2);
329
330 /**
331  *  4x4 block motion compensation without adding delta for B-frames
332  *
333  *  @param[in,out]  buf      pointer to the block in the current frame receiving the result
334  *  @param[in]      ref_buf  pointer to the corresponding block in the backward reference frame
335  *  @param[in]      ref_buf2 pointer to the corresponding block in the forward reference frame
336  *  @param[in]      pitch    pitch for moving to the next y line
337  *  @param[in]      mc_type  interpolation type for backward reference
338  *  @param[in]      mc_type2 interpolation type for forward reference
339  */
340 void ff_ivi_mc_avg_4x4_no_delta(int16_t *buf, const int16_t *ref_buf, const int16_t *ref_buf2, uint32_t pitch, int mc_type, int mc_type2);
341
342 #endif /* AVCODEC_IVI_DSP_H */