Mercurial > libavcodec.hg
comparison common.c @ 396:fce0a2520551 libavcodec
removed useless header includes - use av memory functions
author | glantau |
---|---|
date | Sat, 18 May 2002 23:03:29 +0000 |
parents | 2066dc543be4 |
children | 718a22dc121f |
comparison
equal
deleted
inserted
replaced
395:80518daaab05 | 396:fce0a2520551 |
---|---|
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
18 * | 18 * |
19 * alternative bitstream reader & writer by Michael Niedermayer <michaelni@gmx.at> | 19 * alternative bitstream reader & writer by Michael Niedermayer <michaelni@gmx.at> |
20 */ | 20 */ |
21 #include "common.h" | 21 #include "common.h" |
22 #include <math.h> | |
23 | 22 |
24 void init_put_bits(PutBitContext *s, | 23 void init_put_bits(PutBitContext *s, |
25 UINT8 *buffer, int buffer_size, | 24 UINT8 *buffer, int buffer_size, |
26 void *opaque, | 25 void *opaque, |
27 void (*write_data)(void *, UINT8 *, int)) | 26 void (*write_data)(void *, UINT8 *, int)) |
442 | 441 |
443 if (build_table(vlc, nb_bits, nb_codes, | 442 if (build_table(vlc, nb_bits, nb_codes, |
444 bits, bits_wrap, bits_size, | 443 bits, bits_wrap, bits_size, |
445 codes, codes_wrap, codes_size, | 444 codes, codes_wrap, codes_size, |
446 0, 0) < 0) { | 445 0, 0) < 0) { |
447 if (vlc->table_bits) | 446 av_free(vlc->table_bits); |
448 free(vlc->table_bits); | 447 av_free(vlc->table_codes); |
449 if (vlc->table_codes) | |
450 free(vlc->table_codes); | |
451 return -1; | 448 return -1; |
452 } | 449 } |
453 return 0; | 450 return 0; |
454 } | 451 } |
455 | 452 |
456 | 453 |
457 void free_vlc(VLC *vlc) | 454 void free_vlc(VLC *vlc) |
458 { | 455 { |
459 free(vlc->table_bits); | 456 av_free(vlc->table_bits); |
460 free(vlc->table_codes); | 457 av_free(vlc->table_codes); |
461 } | 458 } |
462 | 459 |
463 int ff_gcd(int a, int b){ | 460 int ff_gcd(int a, int b){ |
464 if(b) return ff_gcd(b, a%b); | 461 if(b) return ff_gcd(b, a%b); |
465 else return a; | 462 else return a; |