[SCM] libav/experimental: Keep track of how many slices*gops where encoded in ffv1 2 pass.

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 17:18:15 UTC 2013


The following commit has been merged in the experimental branch:
commit 0ae0faa7c03688a46441f31d2d6eacaeb3fde6aa
Author: Michael Niedermayer <michaelni at gmx.at>
Date:   Thu Oct 28 12:15:44 2010 +0000

    Keep track of how many slices*gops where encoded in ffv1 2 pass.
    
    Originally committed as revision 25593 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
index b183ddd..6c5408d 100644
--- a/libavcodec/ffv1.c
+++ b/libavcodec/ffv1.c
@@ -251,6 +251,7 @@ typedef struct FFV1Context{
     int run_index;
     int colorspace;
     int_fast16_t *sample_buffer;
+    int gob_count;
 
     int quant_table_count;
 
@@ -960,6 +961,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
     }
     if(avctx->stats_in){
         char *p= avctx->stats_in;
+        int gob_count=0;
         char *next;
 
         av_assert0(s->version>=2);
@@ -989,6 +991,12 @@ static av_cold int encode_init(AVCodecContext *avctx)
                     }
                 }
             }
+            gob_count= strtol(p, &next, 0);
+            if(next==p || gob_count <0){
+                av_log(avctx, AV_LOG_ERROR, "2Pass file invalid\n");
+                return -1;
+            }
+            p=next;
             while(*p=='\n' || *p==' ') p++;
             if(p[0]==0) break;
         }
@@ -1113,6 +1121,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
     if(avctx->gop_size==0 || f->picture_number % avctx->gop_size == 0){
         put_rac(c, &keystate, 1);
         p->key_frame= 1;
+        f->gob_count++;
         write_header(f);
         clear_state(f);
     }else{
@@ -1208,7 +1217,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
                 }
             }
         }
-        snprintf(p, end-p, "\n");
+        snprintf(p, end-p, "%d\n", f->gob_count);
     } else if(avctx->flags&CODEC_FLAG_PASS1)
         avctx->stats_out[0] = '\0';
 

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list