Commit | Line | Data |
---|---|---|
1cf31685 KS |
1 | /* |
2 | * DSP functions for Indeo Video Interactive codecs (Indeo4 and Indeo5) | |
3 | * | |
adfe0c94 | 4 | * Copyright (c) 2009-2011 Maxim Poliakovski |
1cf31685 | 5 | * |
2912e87a | 6 | * This file is part of Libav. |
1cf31685 | 7 | * |
2912e87a | 8 | * Libav is free software; you can redistribute it and/or |
1cf31685 KS |
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 | * | |
2912e87a | 13 | * Libav is distributed in the hope that it will be useful, |
1cf31685 KS |
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 | |
2912e87a | 19 | * License along with Libav; if not, write to the Free Software |
1cf31685 KS |
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
21 | */ | |
22 | ||
23 | /** | |
ba87f080 | 24 | * @file |
1cf31685 KS |
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 | * | |
0c733da8 DB |
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 | * @param[in] num_bands number of wavelet bands to be processed | |
1cf31685 KS |
42 | */ |
43 | void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst, | |
44 | const int dst_pitch, const int num_bands); | |
45 | ||
46 | /** | |
adfe0c94 KS |
47 | * Haar wavelet recomposition filter for Indeo 4 |
48 | * | |
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 | |
52 | * @param[in] num_bands number of wavelet bands to be processed | |
53 | */ | |
54 | void ff_ivi_recompose_haar(const IVIPlaneDesc *plane, uint8_t *dst, | |
55 | const int dst_pitch, const int num_bands); | |
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, uint32_t pitch, | |
68 | const uint8_t *flags); | |
69 | ||
70 | /** | |
71 | * DC-only two-dimensional inverse Haar transform for Indeo 4. | |
72 | * Performing the inverse transform in this case is equivalent to | |
73 | * spreading DC_coeff >> 3 over the whole block. | |
74 | * | |
75 | * @param[in] in pointer to the dc coefficient | |
76 | * @param[out] out pointer to the output buffer (frame) | |
77 | * @param[in] pitch pitch to move to the next y line | |
78 | * @param[in] blk_size transform block size | |
79 | */ | |
80 | void ff_ivi_dc_haar_2d(const int32_t *in, int16_t *out, uint32_t pitch, | |
81 | int blk_size); | |
82 | ||
83 | /** | |
1cf31685 KS |
84 | * two-dimensional inverse slant 8x8 transform |
85 | * | |
0c733da8 DB |
86 | * @param[in] in pointer to the vector of transform coefficients |
87 | * @param[out] out pointer to the output buffer (frame) | |
88 | * @param[in] pitch pitch to move to the next y line | |
89 | * @param[in] flags pointer to the array of column flags: | |
1cf31685 KS |
90 | * != 0 - non_empty column, 0 - empty one |
91 | * (this array must be filled by caller) | |
92 | */ | |
93 | void ff_ivi_inverse_slant_8x8(const int32_t *in, int16_t *out, uint32_t pitch, | |
94 | const uint8_t *flags); | |
95 | ||
96 | /** | |
97 | * two-dimensional inverse slant 4x4 transform | |
98 | * | |
0c733da8 DB |
99 | * @param[in] in pointer to the vector of transform coefficients |
100 | * @param[out] out pointer to the output buffer (frame) | |
101 | * @param[in] pitch pitch to move to the next y line | |
102 | * @param[in] flags pointer to the array of column flags: | |
1cf31685 KS |
103 | * != 0 - non_empty column, 0 - empty one |
104 | * (this array must be filled by caller) | |
105 | */ | |
106 | void ff_ivi_inverse_slant_4x4(const int32_t *in, int16_t *out, uint32_t pitch, | |
107 | const uint8_t *flags); | |
108 | ||
109 | /** | |
110 | * DC-only two-dimensional inverse slant transform. | |
111 | * Performing the inverse slant transform in this case is equivalent to | |
112 | * spreading (DC_coeff + 1)/2 over the whole block. | |
113 | * It works much faster than performing the slant transform on a vector of zeroes. | |
114 | * | |
0c733da8 DB |
115 | * @param[in] in pointer to the dc coefficient |
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] blk_size transform block size | |
1cf31685 KS |
119 | */ |
120 | void ff_ivi_dc_slant_2d(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size); | |
121 | ||
122 | /** | |
123 | * inverse 1D row slant transform | |
124 | * | |
0c733da8 DB |
125 | * @param[in] in pointer to the vector of transform coefficients |
126 | * @param[out] out pointer to the output buffer (frame) | |
127 | * @param[in] pitch pitch to move to the next y line | |
128 | * @param[in] flags pointer to the array of column flags (unused here) | |
1cf31685 KS |
129 | */ |
130 | void ff_ivi_row_slant8(const int32_t *in, int16_t *out, uint32_t pitch, | |
131 | const uint8_t *flags); | |
132 | ||
133 | /** | |
134 | * inverse 1D column slant transform | |
135 | * | |
0c733da8 DB |
136 | * @param[in] in pointer to the vector of transform coefficients |
137 | * @param[out] out pointer to the output buffer (frame) | |
138 | * @param[in] pitch pitch to move to the next y line | |
139 | * @param[in] flags pointer to the array of column flags: | |
1cf31685 KS |
140 | * != 0 - non_empty column, 0 - empty one |
141 | * (this array must be filled by caller) | |
142 | */ | |
143 | void ff_ivi_col_slant8(const int32_t *in, int16_t *out, uint32_t pitch, | |
144 | const uint8_t *flags); | |
145 | ||
146 | /** | |
147 | * DC-only inverse row slant transform | |
148 | */ | |
149 | void ff_ivi_dc_row_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size); | |
150 | ||
151 | /** | |
152 | * DC-only inverse column slant transform | |
153 | */ | |
154 | void ff_ivi_dc_col_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size); | |
155 | ||
156 | /** | |
49bd8e4b | 157 | * Copy the pixels into the frame buffer. |
1cf31685 KS |
158 | */ |
159 | void ff_ivi_put_pixels_8x8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags); | |
160 | ||
161 | /** | |
49bd8e4b MR |
162 | * Copy the DC coefficient into the first pixel of the block and |
163 | * zero all others. | |
1cf31685 KS |
164 | */ |
165 | void ff_ivi_put_dc_pixel_8x8(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size); | |
166 | ||
167 | /** | |
168 | * 8x8 block motion compensation with adding delta | |
169 | * | |
0c733da8 DB |
170 | * @param[in,out] buf pointer to the block in the current frame buffer containing delta |
171 | * @param[in] ref_buf pointer to the corresponding block in the reference frame | |
172 | * @param[in] pitch pitch for moving to the next y line | |
173 | * @param[in] mc_type interpolation type | |
1cf31685 KS |
174 | */ |
175 | void ff_ivi_mc_8x8_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type); | |
176 | ||
177 | /** | |
178 | * 4x4 block motion compensation with adding delta | |
179 | * | |
0c733da8 DB |
180 | * @param[in,out] buf pointer to the block in the current frame buffer containing delta |
181 | * @param[in] ref_buf pointer to the corresponding block in the reference frame | |
182 | * @param[in] pitch pitch for moving to the next y line | |
183 | * @param[in] mc_type interpolation type | |
1cf31685 KS |
184 | */ |
185 | void ff_ivi_mc_4x4_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type); | |
186 | ||
187 | /** | |
188 | * motion compensation without adding delta | |
189 | * | |
0c733da8 DB |
190 | * @param[in,out] buf pointer to the block in the current frame receiving the result |
191 | * @param[in] ref_buf pointer to the corresponding block in the reference frame | |
192 | * @param[in] pitch pitch for moving to the next y line | |
193 | * @param[in] mc_type interpolation type | |
1cf31685 KS |
194 | */ |
195 | void ff_ivi_mc_8x8_no_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type); | |
196 | ||
197 | /** | |
198 | * 4x4 block motion compensation without adding delta | |
199 | * | |
0c733da8 DB |
200 | * @param[in,out] buf pointer to the block in the current frame receiving the result |
201 | * @param[in] ref_buf pointer to the corresponding block in the reference frame | |
202 | * @param[in] pitch pitch for moving to the next y line | |
203 | * @param[in] mc_type interpolation type | |
1cf31685 KS |
204 | */ |
205 | void ff_ivi_mc_4x4_no_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type); | |
206 | ||
207 | #endif /* AVCODEC_IVI_DSP_H */ |