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