Mercurial > libavcodec.hg
comparison ivi_common.h @ 12024:fdafbcef52f5 libavcodec
Fix grammar errors in documentation
author | mru |
---|---|
date | Wed, 30 Jun 2010 15:38:06 +0000 |
parents | 7d12639b4b05 |
children | 0885e7a93ed4 |
comparison
equal
deleted
inserted
replaced
12023:c7455450364d | 12024:fdafbcef52f5 |
---|---|
192 uint16_t tile_height; | 192 uint16_t tile_height; |
193 uint8_t luma_bands; | 193 uint8_t luma_bands; |
194 uint8_t chroma_bands; | 194 uint8_t chroma_bands; |
195 } IVIPicConfig; | 195 } IVIPicConfig; |
196 | 196 |
197 /** compares some properties of two pictures */ | 197 /** compare some properties of two pictures */ |
198 static inline int ivi_pic_config_cmp(IVIPicConfig *str1, IVIPicConfig *str2) | 198 static inline int ivi_pic_config_cmp(IVIPicConfig *str1, IVIPicConfig *str2) |
199 { | 199 { |
200 return (str1->pic_width != str2->pic_width || str1->pic_height != str2->pic_height || | 200 return (str1->pic_width != str2->pic_width || str1->pic_height != str2->pic_height || |
201 str1->chroma_width != str2->chroma_width || str1->chroma_height != str2->chroma_height || | 201 str1->chroma_width != str2->chroma_width || str1->chroma_height != str2->chroma_height || |
202 str1->tile_width != str2->tile_width || str1->tile_height != str2->tile_height || | 202 str1->tile_width != str2->tile_width || str1->tile_height != str2->tile_height || |
211 ((((tile_width) + (mb_size) - 1) / (mb_size)) * (((tile_height) + (mb_size) - 1) / (mb_size))) | 211 ((((tile_width) + (mb_size) - 1) / (mb_size)) * (((tile_height) + (mb_size) - 1) / (mb_size))) |
212 | 212 |
213 /** convert unsigned values into signed ones (the sign is in the LSB) */ | 213 /** convert unsigned values into signed ones (the sign is in the LSB) */ |
214 #define IVI_TOSIGNED(val) (-(((val) >> 1) ^ -((val) & 1))) | 214 #define IVI_TOSIGNED(val) (-(((val) >> 1) ^ -((val) & 1))) |
215 | 215 |
216 /** scales motion vector */ | 216 /** scale motion vector */ |
217 static inline int ivi_scale_mv(int mv, int mv_scale) | 217 static inline int ivi_scale_mv(int mv, int mv_scale) |
218 { | 218 { |
219 return (mv + (mv > 0) + (mv_scale - 1)) >> mv_scale; | 219 return (mv + (mv > 0) + (mv_scale - 1)) >> mv_scale; |
220 } | 220 } |
221 | 221 |
222 /** | 222 /** |
223 * Generates a huffman codebook from the given descriptor | 223 * Generate a huffman codebook from the given descriptor |
224 * and converts it into the FFmpeg VLC table. | 224 * and convert it into the FFmpeg VLC table. |
225 * | 225 * |
226 * @param cb [in] pointer to codebook descriptor | 226 * @param cb [in] pointer to codebook descriptor |
227 * @param vlc [out] where to place the generated VLC table | 227 * @param vlc [out] where to place the generated VLC table |
228 * @param flag [in] flag: 1 - for static or 0 for dynamic tables | 228 * @param flag [in] flag: 1 - for static or 0 for dynamic tables |
229 * @return result code: 0 - OK, -1 = error (invalid codebook descriptor) | 229 * @return result code: 0 - OK, -1 = error (invalid codebook descriptor) |
230 */ | 230 */ |
231 int ff_ivi_create_huff_from_desc(const IVIHuffDesc *cb, VLC *vlc, int flag); | 231 int ff_ivi_create_huff_from_desc(const IVIHuffDesc *cb, VLC *vlc, int flag); |
232 | 232 |
233 /** | 233 /** |
234 * Initializes static codes used for macroblock and block decoding. | 234 * Initialize static codes used for macroblock and block decoding. |
235 */ | 235 */ |
236 void ff_ivi_init_static_vlc(void); | 236 void ff_ivi_init_static_vlc(void); |
237 | 237 |
238 /** | 238 /** |
239 * Decodes a huffman codebook descriptor from the bitstream | 239 * Decode a huffman codebook descriptor from the bitstream |
240 * and selects specified huffman table. | 240 * and select specified huffman table. |
241 * | 241 * |
242 * @param gb [in,out] the GetBit context | 242 * @param gb [in,out] the GetBit context |
243 * @param desc_coded [in] flag signalling if table descriptor was coded | 243 * @param desc_coded [in] flag signalling if table descriptor was coded |
244 * @param which_tab [in] codebook purpose (IVI_MB_HUFF or IVI_BLK_HUFF) | 244 * @param which_tab [in] codebook purpose (IVI_MB_HUFF or IVI_BLK_HUFF) |
245 * @param huff_tab [out] pointer to the descriptor of the selected table | 245 * @param huff_tab [out] pointer to the descriptor of the selected table |
248 */ | 248 */ |
249 int ff_ivi_dec_huff_desc(GetBitContext *gb, int desc_coded, int which_tab, | 249 int ff_ivi_dec_huff_desc(GetBitContext *gb, int desc_coded, int which_tab, |
250 IVIHuffTab *huff_tab, AVCodecContext *avctx); | 250 IVIHuffTab *huff_tab, AVCodecContext *avctx); |
251 | 251 |
252 /** | 252 /** |
253 * Compares two huffman codebook descriptors. | 253 * Compare two huffman codebook descriptors. |
254 * | 254 * |
255 * @param desc1 [in] ptr to the 1st descriptor to compare | 255 * @param desc1 [in] ptr to the 1st descriptor to compare |
256 * @param desc2 [in] ptr to the 2nd descriptor to compare | 256 * @param desc2 [in] ptr to the 2nd descriptor to compare |
257 * @return comparison result: 0 - equal, 1 - not equal | 257 * @return comparison result: 0 - equal, 1 - not equal |
258 */ | 258 */ |
259 int ff_ivi_huff_desc_cmp(const IVIHuffDesc *desc1, const IVIHuffDesc *desc2); | 259 int ff_ivi_huff_desc_cmp(const IVIHuffDesc *desc1, const IVIHuffDesc *desc2); |
260 | 260 |
261 /** | 261 /** |
262 * Copies huffman codebook descriptors. | 262 * Copy huffman codebook descriptors. |
263 * | 263 * |
264 * @param dst [out] ptr to the destination descriptor | 264 * @param dst [out] ptr to the destination descriptor |
265 * @param src [in] ptr to the source descriptor | 265 * @param src [in] ptr to the source descriptor |
266 */ | 266 */ |
267 void ff_ivi_huff_desc_copy(IVIHuffDesc *dst, const IVIHuffDesc *src); | 267 void ff_ivi_huff_desc_copy(IVIHuffDesc *dst, const IVIHuffDesc *src); |
268 | 268 |
269 /** | 269 /** |
270 * Initializes planes (prepares descriptors, allocates buffers etc). | 270 * Initialize planes (prepares descriptors, allocates buffers etc). |
271 * | 271 * |
272 * @param planes [in,out] pointer to the array of the plane descriptors | 272 * @param planes [in,out] pointer to the array of the plane descriptors |
273 * @param cfg [in] pointer to the ivi_pic_config structure describing picture layout | 273 * @param cfg [in] pointer to the ivi_pic_config structure describing picture layout |
274 * @return result code: 0 - OK | 274 * @return result code: 0 - OK |
275 */ | 275 */ |
276 int ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg); | 276 int ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg); |
277 | 277 |
278 /** | 278 /** |
279 * Frees planes, bands and macroblocks buffers. | 279 * Free planes, bands and macroblocks buffers. |
280 * | 280 * |
281 * @param planes [in] pointer to the array of the plane descriptors | 281 * @param planes [in] pointer to the array of the plane descriptors |
282 */ | 282 */ |
283 void ff_ivi_free_buffers(IVIPlaneDesc *planes); | 283 void ff_ivi_free_buffers(IVIPlaneDesc *planes); |
284 | 284 |
285 /** | 285 /** |
286 * Initializes tile and macroblock descriptors. | 286 * Initialize tile and macroblock descriptors. |
287 * | 287 * |
288 * @param planes [in,out] pointer to the array of the plane descriptors | 288 * @param planes [in,out] pointer to the array of the plane descriptors |
289 * @param tile_width [in] tile width | 289 * @param tile_width [in] tile width |
290 * @param tile_height [in] tile height | 290 * @param tile_height [in] tile height |
291 * @return result code: 0 - OK | 291 * @return result code: 0 - OK |
292 */ | 292 */ |
293 int ff_ivi_init_tiles(IVIPlaneDesc *planes, int tile_width, int tile_height); | 293 int ff_ivi_init_tiles(IVIPlaneDesc *planes, int tile_width, int tile_height); |
294 | 294 |
295 /** | 295 /** |
296 * Decodes size of the tile data. | 296 * Decode size of the tile data. |
297 * The size is stored as a variable-length field having the following format: | 297 * The size is stored as a variable-length field having the following format: |
298 * if (tile_data_size < 255) than this field is only one byte long | 298 * if (tile_data_size < 255) than this field is only one byte long |
299 * if (tile_data_size >= 255) than this field four is byte long: 0xFF X1 X2 X3 | 299 * if (tile_data_size >= 255) than this field four is byte long: 0xFF X1 X2 X3 |
300 * where X1-X3 is size of the tile data | 300 * where X1-X3 is size of the tile data |
301 * | 301 * |
303 * @return size of the tile data in bytes | 303 * @return size of the tile data in bytes |
304 */ | 304 */ |
305 int ff_ivi_dec_tile_data_size(GetBitContext *gb); | 305 int ff_ivi_dec_tile_data_size(GetBitContext *gb); |
306 | 306 |
307 /** | 307 /** |
308 * Decodes block data: | 308 * Decode block data: |
309 * extracts huffman-coded transform coefficients from the bitstream, | 309 * extract huffman-coded transform coefficients from the bitstream, |
310 * dequantizes them, applies inverse transform and motion compensation | 310 * dequantize them, apply inverse transform and motion compensation |
311 * in order to reconstruct the picture. | 311 * in order to reconstruct the picture. |
312 * | 312 * |
313 * @param gb [in,out] the GetBit context | 313 * @param gb [in,out] the GetBit context |
314 * @param band [in] pointer to the band descriptor | 314 * @param band [in] pointer to the band descriptor |
315 * @param tile [in] pointer to the tile descriptor | 315 * @param tile [in] pointer to the tile descriptor |
316 * @return result code: 0 - OK, -1 = error (corrupted blocks data) | 316 * @return result code: 0 - OK, -1 = error (corrupted blocks data) |
317 */ | 317 */ |
318 int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile); | 318 int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile); |
319 | 319 |
320 /** | 320 /** |
321 * Handles empty tiles by performing data copying and motion | 321 * Handle empty tiles by performing data copying and motion |
322 * compensation respectively. | 322 * compensation respectively. |
323 * | 323 * |
324 * @param avctx [in] ptr to the AVCodecContext | 324 * @param avctx [in] ptr to the AVCodecContext |
325 * @param band [in] pointer to the band descriptor | 325 * @param band [in] pointer to the band descriptor |
326 * @param tile [in] pointer to the tile descriptor | 326 * @param tile [in] pointer to the tile descriptor |
328 */ | 328 */ |
329 void ff_ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band, | 329 void ff_ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band, |
330 IVITile *tile, int32_t mv_scale); | 330 IVITile *tile, int32_t mv_scale); |
331 | 331 |
332 /** | 332 /** |
333 * Converts and outputs the current plane. | 333 * Convert and output the current plane. |
334 * This conversion is done by adding back the bias value of 128 | 334 * This conversion is done by adding back the bias value of 128 |
335 * (subtracted in the encoder) and clipping the result. | 335 * (subtracted in the encoder) and clipping the result. |
336 * | 336 * |
337 * @param plane [in] pointer to the descriptor of the plane being processed | 337 * @param plane [in] pointer to the descriptor of the plane being processed |
338 * @param dst [out] pointer to the buffer receiving converted pixels | 338 * @param dst [out] pointer to the buffer receiving converted pixels |
340 */ | 340 */ |
341 void ff_ivi_output_plane(IVIPlaneDesc *plane, uint8_t *dst, int dst_pitch); | 341 void ff_ivi_output_plane(IVIPlaneDesc *plane, uint8_t *dst, int dst_pitch); |
342 | 342 |
343 #if IVI_DEBUG | 343 #if IVI_DEBUG |
344 /** | 344 /** |
345 * Calculates band checksum from band data. | 345 * Calculate band checksum from band data. |
346 */ | 346 */ |
347 uint16_t ivi_calc_band_checksum (IVIBandDesc *band); | 347 uint16_t ivi_calc_band_checksum (IVIBandDesc *band); |
348 | 348 |
349 /** | 349 /** |
350 * Verifies that band data lies in range. | 350 * Verify that band data lies in range. |
351 */ | 351 */ |
352 int ivi_check_band (IVIBandDesc *band, const uint8_t *ref, int pitch); | 352 int ivi_check_band (IVIBandDesc *band, const uint8_t *ref, int pitch); |
353 #endif | 353 #endif |
354 | 354 |
355 #endif /* AVCODEC_IVI_COMMON_H */ | 355 #endif /* AVCODEC_IVI_COMMON_H */ |