2 * DSP functions for Indeo Video Interactive codecs (Indeo4 and Indeo5)
4 * Copyright (c) 2009-2011 Maxim Poliakovski
6 * This file is part of FFmpeg.
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.
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.
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
25 * DSP functions (inverse transforms, motion compensations, wavelet recompostion)
26 * for Indeo Video Interactive codecs.
29 #ifndef AVCODEC_IVI_DSP_H
30 #define AVCODEC_IVI_DSP_H
37 * 5/3 wavelet recomposition filter for Indeo5
39 * @param[in] plane pointer to the descriptor of the plane being processed
40 * @param[out] dst pointer to the destination buffer
41 * @param[in] dst_pitch pitch of the destination buffer
43 void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst,
47 * Haar wavelet recomposition filter for Indeo 4
49 * @param[in] plane pointer to the descriptor of the plane being processed
50 * @param[out] dst pointer to the destination buffer
51 * @param[in] dst_pitch pitch of the destination buffer
53 void ff_ivi_recompose_haar(const IVIPlaneDesc *plane, uint8_t *dst,
57 * two-dimensional inverse Haar 8x8 transform for Indeo 4
59 * @param[in] in pointer to the vector of transform coefficients
60 * @param[out] out pointer to the output buffer (frame)
61 * @param[in] pitch pitch to move to the next y line
62 * @param[in] flags pointer to the array of column flags:
63 * != 0 - non_empty column, 0 - empty one
64 * (this array must be filled by caller)
66 void ff_ivi_inverse_haar_8x8(const int32_t *in, int16_t *out, uint32_t pitch,
67 const uint8_t *flags);
68 void ff_ivi_inverse_haar_8x1(const int32_t *in, int16_t *out, uint32_t pitch,
69 const uint8_t *flags);
70 void ff_ivi_inverse_haar_1x8(const int32_t *in, int16_t *out, uint32_t pitch,
71 const uint8_t *flags);
74 * one-dimensional inverse 8-point Haar transform on rows for Indeo 4
76 * @param[in] in pointer to the vector of transform coefficients
77 * @param[out] out pointer to the output buffer (frame)
78 * @param[in] pitch pitch to move to the next y line
79 * @param[in] flags pointer to the array of column flags:
80 * != 0 - non_empty column, 0 - empty one
81 * (this array must be filled by caller)
83 void ff_ivi_row_haar8(const int32_t *in, int16_t *out, uint32_t pitch,
84 const uint8_t *flags);
87 * one-dimensional inverse 8-point Haar transform on columns for Indeo 4
89 * @param[in] in pointer to the vector of transform coefficients
90 * @param[out] out pointer to the output buffer (frame)
91 * @param[in] pitch pitch to move to the next y line
92 * @param[in] flags pointer to the array of column flags:
93 * != 0 - non_empty column, 0 - empty one
94 * (this array must be filled by caller)
96 void ff_ivi_col_haar8(const int32_t *in, int16_t *out, uint32_t pitch,
97 const uint8_t *flags);
100 * two-dimensional inverse Haar 4x4 transform for Indeo 4
102 * @param[in] in pointer to the vector of transform coefficients
103 * @param[out] out pointer to the output buffer (frame)
104 * @param[in] pitch pitch to move to the next y line
105 * @param[in] flags pointer to the array of column flags:
106 * != 0 - non_empty column, 0 - empty one
107 * (this array must be filled by caller)
109 void ff_ivi_inverse_haar_4x4(const int32_t *in, int16_t *out, uint32_t pitch,
110 const uint8_t *flags);
113 * one-dimensional inverse 4-point Haar transform on rows for Indeo 4
115 * @param[in] in pointer to the vector of transform coefficients
116 * @param[out] out pointer to the output buffer (frame)
117 * @param[in] pitch pitch to move to the next y line
118 * @param[in] flags pointer to the array of column flags:
119 * != 0 - non_empty column, 0 - empty one
120 * (this array must be filled by caller)
122 void ff_ivi_row_haar4(const int32_t *in, int16_t *out, uint32_t pitch,
123 const uint8_t *flags);
126 * one-dimensional inverse 4-point Haar transform on columns for Indeo 4
128 * @param[in] in pointer to the vector of transform coefficients
129 * @param[out] out pointer to the output buffer (frame)
130 * @param[in] pitch pitch to move to the next y line
131 * @param[in] flags pointer to the array of column flags:
132 * != 0 - non_empty column, 0 - empty one
133 * (this array must be filled by caller)
135 void ff_ivi_col_haar4(const int32_t *in, int16_t *out, uint32_t pitch,
136 const uint8_t *flags);
139 * DC-only two-dimensional inverse Haar transform for Indeo 4.
140 * Performing the inverse transform in this case is equivalent to
141 * spreading DC_coeff >> 3 over the whole block.
143 * @param[in] in pointer to the dc coefficient
144 * @param[out] out pointer to the output buffer (frame)
145 * @param[in] pitch pitch to move to the next y line
146 * @param[in] blk_size transform block size
148 void ff_ivi_dc_haar_2d(const int32_t *in, int16_t *out, uint32_t pitch,
152 * two-dimensional inverse slant 8x8 transform
154 * @param[in] in pointer to the vector of transform coefficients
155 * @param[out] out pointer to the output buffer (frame)
156 * @param[in] pitch pitch to move to the next y line
157 * @param[in] flags pointer to the array of column flags:
158 * != 0 - non_empty column, 0 - empty one
159 * (this array must be filled by caller)
161 void ff_ivi_inverse_slant_8x8(const int32_t *in, int16_t *out, uint32_t pitch,
162 const uint8_t *flags);
165 * two-dimensional inverse slant 4x4 transform
167 * @param[in] in pointer to the vector of transform coefficients
168 * @param[out] out pointer to the output buffer (frame)
169 * @param[in] pitch pitch to move to the next y line
170 * @param[in] flags pointer to the array of column flags:
171 * != 0 - non_empty column, 0 - empty one
172 * (this array must be filled by caller)
174 void ff_ivi_inverse_slant_4x4(const int32_t *in, int16_t *out, uint32_t pitch,
175 const uint8_t *flags);
178 * DC-only two-dimensional inverse slant transform.
179 * Performing the inverse slant transform in this case is equivalent to
180 * spreading (DC_coeff + 1)/2 over the whole block.
181 * It works much faster than performing the slant transform on a vector of zeroes.
183 * @param[in] in pointer to the dc coefficient
184 * @param[out] out pointer to the output buffer (frame)
185 * @param[in] pitch pitch to move to the next y line
186 * @param[in] blk_size transform block size
188 void ff_ivi_dc_slant_2d(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
191 * inverse 1D row slant transform
193 * @param[in] in pointer to the vector of transform coefficients
194 * @param[out] out pointer to the output buffer (frame)
195 * @param[in] pitch pitch to move to the next y line
196 * @param[in] flags pointer to the array of column flags (unused here)
198 void ff_ivi_row_slant8(const int32_t *in, int16_t *out, uint32_t pitch,
199 const uint8_t *flags);
202 * inverse 1D column slant transform
204 * @param[in] in pointer to the vector of transform coefficients
205 * @param[out] out pointer to the output buffer (frame)
206 * @param[in] pitch pitch to move to the next y line
207 * @param[in] flags pointer to the array of column flags:
208 * != 0 - non_empty column, 0 - empty one
209 * (this array must be filled by caller)
211 void ff_ivi_col_slant8(const int32_t *in, int16_t *out, uint32_t pitch,
212 const uint8_t *flags);
215 * inverse 1D row slant transform
217 * @param[in] in pointer to the vector of transform coefficients
218 * @param[out] out pointer to the output buffer (frame)
219 * @param[in] pitch pitch to move to the next y line
220 * @param[in] flags pointer to the array of column flags (unused here)
222 void ff_ivi_row_slant4(const int32_t *in, int16_t *out, uint32_t pitch,
223 const uint8_t *flags);
226 * inverse 1D column slant transform
228 * @param[in] in pointer to the vector of transform coefficients
229 * @param[out] out pointer to the output buffer (frame)
230 * @param[in] pitch pitch to move to the next y line
231 * @param[in] flags pointer to the array of column flags:
232 * != 0 - non_empty column, 0 - empty one
233 * (this array must be filled by caller)
235 void ff_ivi_col_slant4(const int32_t *in, int16_t *out, uint32_t pitch,
236 const uint8_t *flags);
239 * DC-only inverse row slant transform
241 void ff_ivi_dc_row_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
244 * DC-only inverse column slant transform
246 void ff_ivi_dc_col_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
249 * Copy the pixels into the frame buffer.
251 void ff_ivi_put_pixels_8x8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags);
254 * Copy the DC coefficient into the first pixel of the block and
257 void ff_ivi_put_dc_pixel_8x8(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
260 * 8x8 block motion compensation with adding delta
262 * @param[in,out] buf pointer to the block in the current frame buffer containing delta
263 * @param[in] ref_buf pointer to the corresponding block in the reference frame
264 * @param[in] pitch pitch for moving to the next y line
265 * @param[in] mc_type interpolation type
267 void ff_ivi_mc_8x8_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
270 * 4x4 block motion compensation with adding delta
272 * @param[in,out] buf pointer to the block in the current frame buffer containing delta
273 * @param[in] ref_buf pointer to the corresponding block in the reference frame
274 * @param[in] pitch pitch for moving to the next y line
275 * @param[in] mc_type interpolation type
277 void ff_ivi_mc_4x4_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
280 * motion compensation without adding delta
282 * @param[in,out] buf pointer to the block in the current frame receiving the result
283 * @param[in] ref_buf pointer to the corresponding block in the reference frame
284 * @param[in] pitch pitch for moving to the next y line
285 * @param[in] mc_type interpolation type
287 void ff_ivi_mc_8x8_no_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
290 * 4x4 block motion compensation without adding delta
292 * @param[in,out] buf pointer to the block in the current frame receiving the result
293 * @param[in] ref_buf pointer to the corresponding block in the reference frame
294 * @param[in] pitch pitch for moving to the next y line
295 * @param[in] mc_type interpolation type
297 void ff_ivi_mc_4x4_no_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
300 * 8x8 block motion compensation with adding delta
302 * @param[in,out] buf pointer to the block in the current frame buffer containing delta
303 * @param[in] ref_buf pointer to the corresponding block in the backward reference frame
304 * @param[in] ref_buf2 pointer to the corresponding block in the forward reference frame
305 * @param[in] pitch pitch for moving to the next y line
306 * @param[in] mc_type interpolation type for backward reference
307 * @param[in] mc_type2 interpolation type for forward reference
309 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);
312 * 4x4 block motion compensation with adding delta
314 * @param[in,out] buf pointer to the block in the current frame buffer containing delta
315 * @param[in] ref_buf pointer to the corresponding block in the backward reference frame
316 * @param[in] ref_buf2 pointer to the corresponding block in the forward reference frame
317 * @param[in] pitch pitch for moving to the next y line
318 * @param[in] mc_type interpolation type for backward reference
319 * @param[in] mc_type2 interpolation type for forward reference
321 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);
324 * motion compensation without adding delta for B-frames
326 * @param[in,out] buf pointer to the block in the current frame receiving the result
327 * @param[in] ref_buf pointer to the corresponding block in the backward reference frame
328 * @param[in] ref_buf2 pointer to the corresponding block in the forward reference frame
329 * @param[in] pitch pitch for moving to the next y line
330 * @param[in] mc_type interpolation type for backward reference
331 * @param[in] mc_type2 interpolation type for forward reference
333 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);
336 * 4x4 block motion compensation without adding delta for B-frames
338 * @param[in,out] buf pointer to the block in the current frame receiving the result
339 * @param[in] ref_buf pointer to the corresponding block in the backward reference frame
340 * @param[in] ref_buf2 pointer to the corresponding block in the forward reference frame
341 * @param[in] pitch pitch for moving to the next y line
342 * @param[in] mc_type interpolation type for backward reference
343 * @param[in] mc_type2 interpolation type for forward reference
345 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);
347 #endif /* AVCODEC_IVI_DSP_H */