Mercurial > audlegacy-plugins
comparison src/ffmpeg/libavcodec/utils.c @ 816:87b58fcb96c8 trunk
[svn] - remove more video stuff, remove vorbis
| author | nenolod |
|---|---|
| date | Mon, 12 Mar 2007 13:11:29 -0700 |
| parents | 23a5aa2c545c |
| children | 07107d476f32 |
comparison
equal
deleted
inserted
replaced
| 815:23a5aa2c545c | 816:87b58fcb96c8 |
|---|---|
| 35 memset(ptr, 0, size); | 35 memset(ptr, 0, size); |
| 36 | 36 |
| 37 return ptr; | 37 return ptr; |
| 38 } | 38 } |
| 39 | 39 |
| 40 /** | |
| 41 * realloc which does nothing if the block is large enough | |
| 42 */ | |
| 43 void *av_fast_realloc(void *ptr, int *size, unsigned int min_size) | |
| 44 { | |
| 45 if(min_size < (unsigned int)*size) | |
| 46 return ptr; | |
| 47 | |
| 48 *size= min_size + 10*1024; | |
| 49 | |
| 50 return realloc(ptr, *size); | |
| 51 } | |
| 52 | |
| 53 | |
| 54 /* allocation of static arrays - do not use for normal allocation */ | 40 /* allocation of static arrays - do not use for normal allocation */ |
| 55 static unsigned int last_static = 0; | 41 static unsigned int last_static = 0; |
| 56 static char*** array_static = NULL; | 42 static char*** array_static = NULL; |
| 57 static const unsigned int grow_static = 64; // ^2 | 43 static const unsigned int grow_static = 64; // ^2 |
| 58 void *__av_mallocz_static(void** location, unsigned int size) | 44 void *__av_mallocz_static(void** location, unsigned int size) |
| 175 pic->data[i]=NULL; | 161 pic->data[i]=NULL; |
| 176 // pic->base[i]=NULL; | 162 // pic->base[i]=NULL; |
| 177 } | 163 } |
| 178 } | 164 } |
| 179 | 165 |
| 180 enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, enum PixelFormat * fmt){ | |
| 181 return fmt[0]; | |
| 182 } | |
| 183 | 166 |
| 184 void avcodec_get_context_defaults(AVCodecContext *s){ | 167 void avcodec_get_context_defaults(AVCodecContext *s){ |
| 185 s->bit_rate= 800*1000; | 168 s->bit_rate= 800*1000; |
| 186 s->bit_rate_tolerance= s->bit_rate*10; | 169 s->bit_rate_tolerance= s->bit_rate*10; |
| 187 s->qmin= 2; | 170 s->qmin= 2; |
| 196 s->i_quant_factor=-0.8; | 179 s->i_quant_factor=-0.8; |
| 197 s->i_quant_offset=0.0; | 180 s->i_quant_offset=0.0; |
| 198 s->error_concealment= 3; | 181 s->error_concealment= 3; |
| 199 s->error_resilience= 1; | 182 s->error_resilience= 1; |
| 200 s->workaround_bugs= FF_BUG_AUTODETECT; | 183 s->workaround_bugs= FF_BUG_AUTODETECT; |
| 201 s->frame_rate_base= 1; | |
| 202 s->frame_rate = 25; | |
| 203 s->gop_size= 50; | 184 s->gop_size= 50; |
| 204 s->me_method= ME_EPZS; | 185 s->me_method= ME_EPZS; |
| 205 //s->get_buffer= avcodec_default_get_buffer; | 186 //s->get_buffer= avcodec_default_get_buffer; |
| 206 s->release_buffer= avcodec_default_release_buffer; | 187 s->release_buffer= avcodec_default_release_buffer; |
| 207 s->get_format= avcodec_default_get_format; | 188 s->get_format= avcodec_default_get_format; |
| 559 *dst_den = den; | 540 *dst_den = den; |
| 560 | 541 |
| 561 return exact; | 542 return exact; |
| 562 } | 543 } |
| 563 #endif | 544 #endif |
| 564 int64_t av_rescale(int64_t a, int b, int c){ | |
| 565 uint64_t h, l; | |
| 566 assert(c > 0); | |
| 567 assert(b >=0); | |
| 568 | |
| 569 if(a<0) return -av_rescale(-a, b, c); | |
| 570 | |
| 571 h= a>>32; | |
| 572 if(h==0) return a*b/c; | |
| 573 | |
| 574 l= a&0xFFFFFFFF; | |
| 575 l *= b; | |
| 576 h *= b; | |
| 577 | |
| 578 l += (h%c)<<32; | |
| 579 | |
| 580 return ((h/c)<<32) + l/c; | |
| 581 } | |
| 582 | |
| 583 /* av_log API */ | |
| 584 | |
| 585 #ifdef AV_LOG_TRAP_PRINTF | |
| 586 #undef stderr | |
| 587 #undef fprintf | |
| 588 #endif | |
| 589 | |
| 590 static int av_log_level = AV_LOG_DEBUG; | |
| 591 | |
| 592 static void av_log_default_callback(AVCodecContext* avctx, int level, const char* fmt, va_list vl) | |
| 593 { | |
| 594 static int print_prefix=1; | |
| 595 | |
| 596 if(level>av_log_level) | |
| 597 return; | |
| 598 if(avctx && print_prefix) | |
| 599 fprintf(stderr, "[%s @ %p]", avctx->codec ? avctx->codec->name : "?", avctx); | |
| 600 | |
| 601 print_prefix= strstr(fmt, "\n") != NULL; | |
| 602 | |
| 603 vfprintf(stderr, fmt, vl); | |
| 604 } | |
| 605 | |
| 606 static void (*av_log_callback)(AVCodecContext*, int, const char*, va_list) = av_log_default_callback; | |
| 607 | |
| 608 void av_log(AVCodecContext* avctx, int level, const char *fmt, ...) | |
| 609 { | |
| 610 va_list vl; | |
| 611 va_start(vl, fmt); | |
| 612 av_vlog(avctx, level, fmt, vl); | |
| 613 va_end(vl); | |
| 614 } | |
| 615 | |
| 616 void av_vlog(AVCodecContext* avctx, int level, const char *fmt, va_list vl) | |
| 617 { | |
| 618 av_log_callback(avctx, level, fmt, vl); | |
| 619 } | |
| 620 | |
| 621 int av_log_get_level(void) | |
| 622 { | |
| 623 return av_log_level; | |
| 624 } | |
| 625 | |
| 626 void av_log_set_level(int level) | |
| 627 { | |
| 628 av_log_level = level; | |
| 629 } | |
| 630 | |
| 631 void av_log_set_callback(void (*callback)(AVCodecContext*, int, const char*, va_list)) | |
| 632 { | |
| 633 av_log_callback = callback; | |
| 634 } | |
| 635 |
