avformat/mpeg: demux ivtv captions
[ffmpeg.git] / libavcodec / ivi_dsp.h
blob2704d2b9a540d5b9ed0792dc0f46d0d5c2e46514
1 /*
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
23 /**
24 * @file
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
32 #include <stddef.h>
33 #include <stdint.h>
35 #include "ivi.h"
37 /**
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);
47 /**
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);
57 /**
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);
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);
74 /**
75 * one-dimensional inverse 8-point Haar transform on rows for Indeo 4
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)
84 void ff_ivi_row_haar8(const int32_t *in, int16_t *out, ptrdiff_t pitch,
85 const uint8_t *flags);
87 /**
88 * one-dimensional inverse 8-point Haar transform on columns for Indeo 4
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)
97 void ff_ivi_col_haar8(const int32_t *in, int16_t *out, ptrdiff_t pitch,
98 const uint8_t *flags);
101 * two-dimensional inverse Haar 4x4 transform for Indeo 4
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)
110 void ff_ivi_inverse_haar_4x4(const int32_t *in, int16_t *out, ptrdiff_t pitch,
111 const uint8_t *flags);
114 * one-dimensional inverse 4-point Haar transform on rows for Indeo 4
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)
123 void ff_ivi_row_haar4(const int32_t *in, int16_t *out, ptrdiff_t pitch,
124 const uint8_t *flags);
127 * one-dimensional inverse 4-point Haar transform on columns for Indeo 4
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)
136 void ff_ivi_col_haar4(const int32_t *in, int16_t *out, ptrdiff_t pitch,
137 const uint8_t *flags);
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.
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
149 void ff_ivi_dc_haar_2d(const int32_t *in, int16_t *out, ptrdiff_t pitch,
150 int blk_size);
153 * two-dimensional inverse slant 8x8 transform
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)
162 void ff_ivi_inverse_slant_8x8(const int32_t *in, int16_t *out, ptrdiff_t pitch,
163 const uint8_t *flags);
166 * two-dimensional inverse slant 4x4 transform
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)
175 void ff_ivi_inverse_slant_4x4(const int32_t *in, int16_t *out, ptrdiff_t pitch,
176 const uint8_t *flags);
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.
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
189 void ff_ivi_dc_slant_2d(const int32_t *in, int16_t *out, ptrdiff_t pitch, int blk_size);
192 * inverse 1D row slant transform
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)
199 void ff_ivi_row_slant8(const int32_t *in, int16_t *out, ptrdiff_t pitch,
200 const uint8_t *flags);
203 * inverse 1D column slant transform
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)
212 void ff_ivi_col_slant8(const int32_t *in, int16_t *out, ptrdiff_t pitch,
213 const uint8_t *flags);
216 * inverse 1D row slant transform
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)
223 void ff_ivi_row_slant4(const int32_t *in, int16_t *out, ptrdiff_t pitch,
224 const uint8_t *flags);
227 * inverse 1D column slant transform
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)
236 void ff_ivi_col_slant4(const int32_t *in, int16_t *out, ptrdiff_t pitch,
237 const uint8_t *flags);
240 * DC-only inverse row slant transform
242 void ff_ivi_dc_row_slant(const int32_t *in, int16_t *out, ptrdiff_t pitch, int blk_size);
245 * DC-only inverse column slant transform
247 void ff_ivi_dc_col_slant(const int32_t *in, int16_t *out, ptrdiff_t pitch, int blk_size);
250 * Copy the pixels into the frame buffer.
252 void ff_ivi_put_pixels_8x8(const int32_t *in, int16_t *out, ptrdiff_t pitch, const uint8_t *flags);
255 * Copy the DC coefficient into the first pixel of the block and
256 * zero all others.
258 void ff_ivi_put_dc_pixel_8x8(const int32_t *in, int16_t *out, ptrdiff_t pitch, int blk_size);
261 * 8x8 block motion compensation with adding delta
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
268 void ff_ivi_mc_8x8_delta(int16_t *buf, const int16_t *ref_buf, ptrdiff_t pitch, int mc_type);
271 * 4x4 block motion compensation with adding delta
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
278 void ff_ivi_mc_4x4_delta(int16_t *buf, const int16_t *ref_buf, ptrdiff_t pitch, int mc_type);
281 * motion compensation without adding delta
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
288 void ff_ivi_mc_8x8_no_delta(int16_t *buf, const int16_t *ref_buf, ptrdiff_t pitch, int mc_type);
291 * 4x4 block motion compensation without adding delta
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
298 void ff_ivi_mc_4x4_no_delta(int16_t *buf, const int16_t *ref_buf, ptrdiff_t pitch, int mc_type);
301 * 8x8 block motion compensation with adding delta
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
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);
313 * 4x4 block motion compensation with adding delta
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
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);
325 * motion compensation without adding delta for B-frames
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
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);
337 * 4x4 block motion compensation without adding delta for B-frames
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
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);
348 #endif /* AVCODEC_IVI_DSP_H */