2 * DSP functions for Indeo Video Interactive codecs (Indeo4 and Indeo5)
4 * Copyright (c) 2009-2011 Maxim Poliakovski
6 * This file is part of Libav.
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.
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.
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
25 * DSP functions (inverse transforms, motion compensations, wavelet recomposition)
26 * for Indeo Video Interactive codecs.
29 #ifndef AVCODEC_IVI_DSP_H
30 #define AVCODEC_IVI_DSP_H
38 * 5/3 wavelet recomposition filter for Indeo5
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
44 void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst,
45 const ptrdiff_t dst_pitch);
48 * Haar wavelet recomposition filter for Indeo 4
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
54 void ff_ivi_recompose_haar(const IVIPlaneDesc *plane, uint8_t *dst,
55 const ptrdiff_t dst_pitch);
58 * two-dimensional inverse Haar 8x8 transform for Indeo 4
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)
67 void ff_ivi_inverse_haar_8x8(const int32_t *in, int16_t *out, ptrdiff_t pitch,
68 const uint8_t *flags);
71 * one-dimensional inverse 8-point Haar transform on rows for Indeo 4
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)
80 void ff_ivi_row_haar8(const int32_t *in, int16_t *out, ptrdiff_t pitch,
81 const uint8_t *flags);
84 * one-dimensional inverse 8-point Haar transform on columns for Indeo 4
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)
93 void ff_ivi_col_haar8(const int32_t *in, int16_t *out, ptrdiff_t pitch,
94 const uint8_t *flags);
97 * two-dimensional inverse Haar 4x4 transform for Indeo 4
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)
106 void ff_ivi_inverse_haar_4x4(const int32_t *in, int16_t *out, ptrdiff_t pitch,
107 const uint8_t *flags);
110 * one-dimensional inverse 4-point Haar transform on rows for Indeo 4
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)
119 void ff_ivi_row_haar4(const int32_t *in, int16_t *out, ptrdiff_t pitch,
120 const uint8_t *flags);
123 * one-dimensional inverse 4-point Haar transform on columns for Indeo 4
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)
132 void ff_ivi_col_haar4(const int32_t *in, int16_t *out, ptrdiff_t pitch,
133 const uint8_t *flags);
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.
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
145 void ff_ivi_dc_haar_2d(const int32_t *in, int16_t *out, ptrdiff_t pitch,
149 * two-dimensional inverse slant 8x8 transform
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)
158 void ff_ivi_inverse_slant_8x8(const int32_t *in, int16_t *out, ptrdiff_t pitch,
159 const uint8_t *flags);
162 * two-dimensional inverse slant 4x4 transform
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)
171 void ff_ivi_inverse_slant_4x4(const int32_t *in, int16_t *out, ptrdiff_t pitch,
172 const uint8_t *flags);
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.
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
185 void ff_ivi_dc_slant_2d(const int32_t *in, int16_t *out, ptrdiff_t pitch, int blk_size);
188 * inverse 1D row slant transform
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)
195 void ff_ivi_row_slant8(const int32_t *in, int16_t *out, ptrdiff_t pitch,
196 const uint8_t *flags);
199 * inverse 1D column slant transform
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)
208 void ff_ivi_col_slant8(const int32_t *in, int16_t *out, ptrdiff_t pitch,
209 const uint8_t *flags);
212 * inverse 1D row slant transform
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)
219 void ff_ivi_row_slant4(const int32_t *in, int16_t *out, ptrdiff_t pitch,
220 const uint8_t *flags);
223 * inverse 1D column slant transform
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)
232 void ff_ivi_col_slant4(const int32_t *in, int16_t *out, ptrdiff_t pitch,
233 const uint8_t *flags);
236 * DC-only inverse row slant transform
238 void ff_ivi_dc_row_slant(const int32_t *in, int16_t *out, ptrdiff_t pitch, int blk_size);
241 * DC-only inverse column slant transform
243 void ff_ivi_dc_col_slant(const int32_t *in, int16_t *out, ptrdiff_t pitch, int blk_size);
246 * Copy the pixels into the frame buffer.
248 void ff_ivi_put_pixels_8x8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags);
251 * Copy the DC coefficient into the first pixel of the block and
254 void ff_ivi_put_dc_pixel_8x8(const int32_t *in, int16_t *out, ptrdiff_t pitch, int blk_size);
257 * 8x8 block motion compensation with adding delta
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
264 void ff_ivi_mc_8x8_delta(int16_t *buf, const int16_t *ref_buf, ptrdiff_t pitch, int mc_type);
267 * 4x4 block motion compensation with adding delta
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
274 void ff_ivi_mc_4x4_delta(int16_t *buf, const int16_t *ref_buf, ptrdiff_t pitch, int mc_type);
277 * motion compensation without adding delta
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
284 void ff_ivi_mc_8x8_no_delta(int16_t *buf, const int16_t *ref_buf, ptrdiff_t pitch, int mc_type);
287 * 4x4 block motion compensation without adding delta
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
294 void ff_ivi_mc_4x4_no_delta(int16_t *buf, const int16_t *ref_buf, ptrdiff_t pitch, int mc_type);
297 * 8x8 block motion compensation with adding delta
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
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);
309 * 4x4 block motion compensation with adding delta
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
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);
321 * motion compensation without adding delta for B-frames
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
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);
333 * 4x4 block motion compensation without adding delta for B-frames
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
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);
344 #endif /* AVCODEC_IVI_DSP_H */