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