FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 recompostion)
26  * for Indeo Video Interactive codecs.
27  */
28 
29 #ifndef AVCODEC_IVI_DSP_H
30 #define AVCODEC_IVI_DSP_H
31 
32 #include "avcodec.h"
33 #include "ivi_common.h"
34 
35 /**
36  * 5/3 wavelet recomposition filter for Indeo5
37  *
38  * @param[in] plane pointer to the descriptor of the plane being processed
39  * @param[out] dst pointer to the destination buffer
40  * @param[in] dst_pitch pitch of the destination buffer
41  */
42 void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst,
43  const int dst_pitch);
44 
45 /**
46  * Haar wavelet recomposition filter for Indeo 4
47  *
48  * @param[in] plane pointer to the descriptor of the plane being processed
49  * @param[out] dst pointer to the destination buffer
50  * @param[in] dst_pitch pitch of the destination buffer
51  */
52 void ff_ivi_recompose_haar(const IVIPlaneDesc *plane, uint8_t *dst,
53  const int dst_pitch);
54 
55 /**
56  * two-dimensional inverse Haar 8x8 transform for Indeo 4
57  *
58  * @param[in] in pointer to the vector of transform coefficients
59  * @param[out] out pointer to the output buffer (frame)
60  * @param[in] pitch pitch to move to the next y line
61  * @param[in] flags pointer to the array of column flags:
62  * != 0 - non_empty column, 0 - empty one
63  * (this array must be filled by caller)
64  */
65 void ff_ivi_inverse_haar_8x8(const int32_t *in, int16_t *out, uint32_t pitch,
66  const uint8_t *flags);
67 void ff_ivi_inverse_haar_8x1(const int32_t *in, int16_t *out, uint32_t pitch,
68  const uint8_t *flags);
69 void ff_ivi_inverse_haar_1x8(const int32_t *in, int16_t *out, uint32_t pitch,
70  const uint8_t *flags);
71 
72 /**
73  * DC-only two-dimensional inverse Haar transform for Indeo 4.
74  * Performing the inverse transform in this case is equivalent to
75  * spreading DC_coeff >> 3 over the whole block.
76  *
77  * @param[in] in pointer to the dc coefficient
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] blk_size transform block size
81  */
82 void ff_ivi_dc_haar_2d(const int32_t *in, int16_t *out, uint32_t pitch,
83  int blk_size);
84 
85 /**
86  * two-dimensional inverse slant 8x8 transform
87  *
88  * @param[in] in pointer to the vector of transform coefficients
89  * @param[out] out pointer to the output buffer (frame)
90  * @param[in] pitch pitch to move to the next y line
91  * @param[in] flags pointer to the array of column flags:
92  * != 0 - non_empty column, 0 - empty one
93  * (this array must be filled by caller)
94  */
95 void ff_ivi_inverse_slant_8x8(const int32_t *in, int16_t *out, uint32_t pitch,
96  const uint8_t *flags);
97 
98 /**
99  * two-dimensional inverse slant 4x4 transform
100  *
101  * @param[in] in pointer to the vector of transform coefficients
102  * @param[out] out pointer to the output buffer (frame)
103  * @param[in] pitch pitch to move to the next y line
104  * @param[in] flags pointer to the array of column flags:
105  * != 0 - non_empty column, 0 - empty one
106  * (this array must be filled by caller)
107  */
108 void ff_ivi_inverse_slant_4x4(const int32_t *in, int16_t *out, uint32_t pitch,
109  const uint8_t *flags);
110 
111 /**
112  * DC-only two-dimensional inverse slant transform.
113  * Performing the inverse slant transform in this case is equivalent to
114  * spreading (DC_coeff + 1)/2 over the whole block.
115  * It works much faster than performing the slant transform on a vector of zeroes.
116  *
117  * @param[in] in pointer to the dc coefficient
118  * @param[out] out pointer to the output buffer (frame)
119  * @param[in] pitch pitch to move to the next y line
120  * @param[in] blk_size transform block size
121  */
122 void ff_ivi_dc_slant_2d(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
123 
124 /**
125  * inverse 1D row slant transform
126  *
127  * @param[in] in pointer to the vector of transform coefficients
128  * @param[out] out pointer to the output buffer (frame)
129  * @param[in] pitch pitch to move to the next y line
130  * @param[in] flags pointer to the array of column flags (unused here)
131  */
132 void ff_ivi_row_slant8(const int32_t *in, int16_t *out, uint32_t pitch,
133  const uint8_t *flags);
134 
135 /**
136  * inverse 1D column slant transform
137  *
138  * @param[in] in pointer to the vector of transform coefficients
139  * @param[out] out pointer to the output buffer (frame)
140  * @param[in] pitch pitch to move to the next y line
141  * @param[in] flags pointer to the array of column flags:
142  * != 0 - non_empty column, 0 - empty one
143  * (this array must be filled by caller)
144  */
145 void ff_ivi_col_slant8(const int32_t *in, int16_t *out, uint32_t pitch,
146  const uint8_t *flags);
147 
148 /**
149  * DC-only inverse row slant transform
150  */
151 void ff_ivi_dc_row_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
152 
153 /**
154  * DC-only inverse column slant transform
155  */
156 void ff_ivi_dc_col_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
157 
158 /**
159  * Copy the pixels into the frame buffer.
160  */
161 void ff_ivi_put_pixels_8x8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags);
162 
163 /**
164  * Copy the DC coefficient into the first pixel of the block and
165  * zero all others.
166  */
167 void ff_ivi_put_dc_pixel_8x8(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
168 
169 /**
170  * 8x8 block motion compensation with adding delta
171  *
172  * @param[in,out] buf pointer to the block in the current frame buffer containing delta
173  * @param[in] ref_buf pointer to the corresponding block in the reference frame
174  * @param[in] pitch pitch for moving to the next y line
175  * @param[in] mc_type interpolation type
176  */
177 void ff_ivi_mc_8x8_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
178 
179 /**
180  * 4x4 block motion compensation with adding delta
181  *
182  * @param[in,out] buf pointer to the block in the current frame buffer containing delta
183  * @param[in] ref_buf pointer to the corresponding block in the reference frame
184  * @param[in] pitch pitch for moving to the next y line
185  * @param[in] mc_type interpolation type
186  */
187 void ff_ivi_mc_4x4_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
188 
189 /**
190  * motion compensation without adding delta
191  *
192  * @param[in,out] buf pointer to the block in the current frame receiving the result
193  * @param[in] ref_buf pointer to the corresponding block in the reference frame
194  * @param[in] pitch pitch for moving to the next y line
195  * @param[in] mc_type interpolation type
196  */
197 void ff_ivi_mc_8x8_no_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
198 
199 /**
200  * 4x4 block motion compensation without adding delta
201  *
202  * @param[in,out] buf pointer to the block in the current frame receiving the result
203  * @param[in] ref_buf pointer to the corresponding block in the reference frame
204  * @param[in] pitch pitch for moving to the next y line
205  * @param[in] mc_type interpolation type
206  */
207 void ff_ivi_mc_4x4_no_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
208 
209 #endif /* AVCODEC_IVI_DSP_H */