]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/blobdiff - libavcodec/utils.c
frsh: Export information about the last RTP contract and VRES
[frescor/ffmpeg.git] / libavcodec / utils.c
index f39b49d5119845c05eef511c9cc042924632151b..141d97b14980d98a186d36549390e659f780d035 100644 (file)
@@ -80,6 +80,17 @@ void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size)
     return ptr;
 }
 
+void av_fast_malloc(void *ptr, unsigned int *size, unsigned int min_size)
+{
+    void **p = ptr;
+    if (min_size < *size)
+        return;
+    *size= FFMAX(17*min_size/16 + 32, min_size);
+    av_free(*p);
+    *p = av_malloc(*size);
+    if (!*p) *size = 0;
+}
+
 /* encoder management */
 static AVCodec *first_avcodec = NULL;
 
@@ -144,6 +155,8 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){
     case PIX_FMT_YUVA420P:
         w_align= 16; //FIXME check for non mpeg style codecs and use less alignment
         h_align= 16;
+        if(s->codec_id == CODEC_ID_MPEG2VIDEO)
+            h_align= 32; // interlaced is rounded up to 2 MBs
         break;
     case PIX_FMT_YUV411P:
     case PIX_FMT_UYYVYY411:
@@ -187,7 +200,7 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){
 }
 
 int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h){
-    if((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/4)
+    if((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8)
         return 0;
 
     av_log(av_log_ctx, AV_LOG_ERROR, "picture size invalid (%ux%u)\n", w, h);
@@ -972,6 +985,7 @@ int av_get_bits_per_sample_format(enum SampleFormat sample_fmt) {
 
 #if !HAVE_THREADS
 int avcodec_thread_init(AVCodecContext *s, int thread_count){
+    s->thread_count = thread_count;
     return -1;
 }
 #endif