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 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);
70 * one-dimensional inverse 8-point Haar transform on rows for Indeo 4
72 * @param[in] in pointer to the vector of transform coefficients
73 * @param[out] out pointer to the output buffer (frame)
74 * @param[in] pitch pitch to move to the next y line
75 * @param[in] flags pointer to the array of column flags:
76 * != 0 - non_empty column, 0 - empty one
77 * (this array must be filled by caller)
79 void ff_ivi_row_haar8(const int32_t *in, int16_t *out, uint32_t pitch,
80 const uint8_t *flags);
83 * one-dimensional inverse 8-point Haar transform on columns for Indeo 4
85 * @param[in] in pointer to the vector of transform coefficients
86 * @param[out] out pointer to the output buffer (frame)
87 * @param[in] pitch pitch to move to the next y line
88 * @param[in] flags pointer to the array of column flags:
89 * != 0 - non_empty column, 0 - empty one
90 * (this array must be filled by caller)
92 void ff_ivi_col_haar8(const int32_t *in, int16_t *out, uint32_t pitch,
93 const uint8_t *flags);
96 * two-dimensional inverse Haar 4x4 transform for Indeo 4
98 * @param[in] in pointer to the vector of transform coefficients
99 * @param[out] out pointer to the output buffer (frame)
100 * @param[in] pitch pitch to move to the next y line
101 * @param[in] flags pointer to the array of column flags:
102 * != 0 - non_empty column, 0 - empty one
103 * (this array must be filled by caller)
105 void ff_ivi_inverse_haar_4x4(const int32_t *in, int16_t *out, uint32_t pitch,
106 const uint8_t *flags);
109 * one-dimensional inverse 4-point Haar transform on rows for Indeo 4
111 * @param[in] in pointer to the vector of transform coefficients
112 * @param[out] out pointer to the output buffer (frame)
113 * @param[in] pitch pitch to move to the next y line
114 * @param[in] flags pointer to the array of column flags:
115 * != 0 - non_empty column, 0 - empty one
116 * (this array must be filled by caller)
118 void ff_ivi_row_haar4(const int32_t *in, int16_t *out, uint32_t pitch,
119 const uint8_t *flags);
122 * one-dimensional inverse 4-point Haar transform on columns for Indeo 4
124 * @param[in] in pointer to the vector of transform coefficients
125 * @param[out] out pointer to the output buffer (frame)
126 * @param[in] pitch pitch to move to the next y line
127 * @param[in] flags pointer to the array of column flags:
128 * != 0 - non_empty column, 0 - empty one
129 * (this array must be filled by caller)
131 void ff_ivi_col_haar4(const int32_t *in, int16_t *out, uint32_t pitch,
132 const uint8_t *flags);
135 * DC-only two-dimensional inverse Haar transform for Indeo 4.
136 * Performing the inverse transform in this case is equivalent to
137 * spreading DC_coeff >> 3 over the whole block.
139 * @param[in] in pointer to the dc coefficient
140 * @param[out] out pointer to the output buffer (frame)
141 * @param[in] pitch pitch to move to the next y line
142 * @param[in] blk_size transform block size
144 void ff_ivi_dc_haar_2d(const int32_t *in, int16_t *out, uint32_t pitch,
148 * two-dimensional inverse slant 8x8 transform
150 * @param[in] in pointer to the vector of transform coefficients
151 * @param[out] out pointer to the output buffer (frame)
152 * @param[in] pitch pitch to move to the next y line
153 * @param[in] flags pointer to the array of column flags:
154 * != 0 - non_empty column, 0 - empty one
155 * (this array must be filled by caller)
157 void ff_ivi_inverse_slant_8x8(const int32_t *in, int16_t *out, uint32_t pitch,
158 const uint8_t *flags);
161 * two-dimensional inverse slant 4x4 transform
163 * @param[in] in pointer to the vector of transform coefficients
164 * @param[out] out pointer to the output buffer (frame)
165 * @param[in] pitch pitch to move to the next y line
166 * @param[in] flags pointer to the array of column flags:
167 * != 0 - non_empty column, 0 - empty one
168 * (this array must be filled by caller)
170 void ff_ivi_inverse_slant_4x4(const int32_t *in, int16_t *out, uint32_t pitch,
171 const uint8_t *flags);
174 * DC-only two-dimensional inverse slant transform.
175 * Performing the inverse slant transform in this case is equivalent to
176 * spreading (DC_coeff + 1)/2 over the whole block.
177 * It works much faster than performing the slant transform on a vector of zeroes.
179 * @param[in] in pointer to the dc coefficient
180 * @param[out] out pointer to the output buffer (frame)
181 * @param[in] pitch pitch to move to the next y line
182 * @param[in] blk_size transform block size
184 void ff_ivi_dc_slant_2d(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
187 * inverse 1D row slant transform
189 * @param[in] in pointer to the vector of transform coefficients
190 * @param[out] out pointer to the output buffer (frame)
191 * @param[in] pitch pitch to move to the next y line
192 * @param[in] flags pointer to the array of column flags (unused here)
194 void ff_ivi_row_slant8(const int32_t *in, int16_t *out, uint32_t pitch,
195 const uint8_t *flags);
198 * inverse 1D column slant transform
200 * @param[in] in pointer to the vector of transform coefficients
201 * @param[out] out pointer to the output buffer (frame)
202 * @param[in] pitch pitch to move to the next y line
203 * @param[in] flags pointer to the array of column flags:
204 * != 0 - non_empty column, 0 - empty one
205 * (this array must be filled by caller)
207 void ff_ivi_col_slant8(const int32_t *in, int16_t *out, uint32_t pitch,
208 const uint8_t *flags);
211 * inverse 1D row slant transform
213 * @param[in] in pointer to the vector of transform coefficients
214 * @param[out] out pointer to the output buffer (frame)
215 * @param[in] pitch pitch to move to the next y line
216 * @param[in] flags pointer to the array of column flags (unused here)
218 void ff_ivi_row_slant4(const int32_t *in, int16_t *out, uint32_t pitch,
219 const uint8_t *flags);
222 * inverse 1D column slant transform
224 * @param[in] in pointer to the vector of transform coefficients
225 * @param[out] out pointer to the output buffer (frame)
226 * @param[in] pitch pitch to move to the next y line
227 * @param[in] flags pointer to the array of column flags:
228 * != 0 - non_empty column, 0 - empty one
229 * (this array must be filled by caller)
231 void ff_ivi_col_slant4(const int32_t *in, int16_t *out, uint32_t pitch,
232 const uint8_t *flags);
235 * DC-only inverse row slant transform
237 void ff_ivi_dc_row_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
240 * DC-only inverse column slant transform
242 void ff_ivi_dc_col_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
245 * Copy the pixels into the frame buffer.
247 void ff_ivi_put_pixels_8x8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags);
250 * Copy the DC coefficient into the first pixel of the block and
253 void ff_ivi_put_dc_pixel_8x8(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
256 * 8x8 block motion compensation with adding delta
258 * @param[in,out] buf pointer to the block in the current frame buffer containing delta
259 * @param[in] ref_buf pointer to the corresponding block in the reference frame
260 * @param[in] pitch pitch for moving to the next y line
261 * @param[in] mc_type interpolation type
263 void ff_ivi_mc_8x8_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
266 * 4x4 block motion compensation with adding delta
268 * @param[in,out] buf pointer to the block in the current frame buffer containing delta
269 * @param[in] ref_buf pointer to the corresponding block in the reference frame
270 * @param[in] pitch pitch for moving to the next y line
271 * @param[in] mc_type interpolation type
273 void ff_ivi_mc_4x4_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
276 * motion compensation without adding delta
278 * @param[in,out] buf pointer to the block in the current frame receiving the result
279 * @param[in] ref_buf pointer to the corresponding block in the reference frame
280 * @param[in] pitch pitch for moving to the next y line
281 * @param[in] mc_type interpolation type
283 void ff_ivi_mc_8x8_no_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
286 * 4x4 block motion compensation without adding delta
288 * @param[in,out] buf pointer to the block in the current frame receiving the result
289 * @param[in] ref_buf pointer to the corresponding block in the reference frame
290 * @param[in] pitch pitch for moving to the next y line
291 * @param[in] mc_type interpolation type
293 void ff_ivi_mc_4x4_no_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
296 * 8x8 block motion compensation with adding delta
298 * @param[in,out] buf pointer to the block in the current frame buffer containing delta
299 * @param[in] ref_buf pointer to the corresponding block in the backward reference frame
300 * @param[in] ref_buf2 pointer to the corresponding block in the forward reference frame
301 * @param[in] pitch pitch for moving to the next y line
302 * @param[in] mc_type interpolation type for backward reference
303 * @param[in] mc_type2 interpolation type for forward reference
305 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);
308 * 4x4 block motion compensation with adding delta
310 * @param[in,out] buf pointer to the block in the current frame buffer containing delta
311 * @param[in] ref_buf pointer to the corresponding block in the backward reference frame
312 * @param[in] ref_buf2 pointer to the corresponding block in the forward reference frame
313 * @param[in] pitch pitch for moving to the next y line
314 * @param[in] mc_type interpolation type for backward reference
315 * @param[in] mc_type2 interpolation type for forward reference
317 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);
320 * motion compensation without adding delta for B-frames
322 * @param[in,out] buf pointer to the block in the current frame receiving the result
323 * @param[in] ref_buf pointer to the corresponding block in the backward reference frame
324 * @param[in] ref_buf2 pointer to the corresponding block in the forward reference frame
325 * @param[in] pitch pitch for moving to the next y line
326 * @param[in] mc_type interpolation type for backward reference
327 * @param[in] mc_type2 interpolation type for forward reference
329 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);
332 * 4x4 block motion compensation without adding delta for B-frames
334 * @param[in,out] buf pointer to the block in the current frame receiving the result
335 * @param[in] ref_buf pointer to the corresponding block in the backward reference frame
336 * @param[in] ref_buf2 pointer to the corresponding block in the forward reference frame
337 * @param[in] pitch pitch for moving to the next y line
338 * @param[in] mc_type interpolation type for backward reference
339 * @param[in] mc_type2 interpolation type for forward reference
341 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);
343 #endif /* AVCODEC_IVI_DSP_H */