Browse code

Make 1pass statistic collection in ffv1 put_symbol_inline() conditional to avoid slowdown when more statistic collection code is added.

Originally committed as revision 25577 to svn://svn.ffmpeg.org/ffmpeg/trunk

Michael Niedermayer authored on 2010/10/27 08:00:49
Showing 1 changed files
... ...
@@ -304,7 +304,9 @@ static av_always_inline av_flatten void put_symbol_inline(RangeCoder *c, uint8_t
304 304
 
305 305
 #define put_rac(C,S,B) \
306 306
 do{\
307
+    if(rc_stat){\
307 308
     rc_stat[*(S)][B]++;\
309
+    }\
308 310
     put_rac(C,S,B);\
309 311
 }while(0)
310 312
 
... ...
@@ -344,8 +346,7 @@ do{\
344 344
 }
345 345
 
346 346
 static void av_noinline put_symbol(RangeCoder *c, uint8_t *state, int v, int is_signed){
347
-    uint64_t rc_stat[256][2]; //we dont bother counting header bits.
348
-    put_symbol_inline(c, state, v, is_signed, rc_stat);
347
+    put_symbol_inline(c, state, v, is_signed, NULL);
349 348
 }
350 349
 
351 350
 static inline av_flatten int get_symbol_inline(RangeCoder *c, uint8_t *state, int is_signed){
... ...
@@ -493,7 +494,11 @@ static av_always_inline int encode_line(FFV1Context *s, int w, int_fast16_t *sam
493 493
         diff= fold(diff, bits);
494 494
 
495 495
         if(s->ac){
496
+            if(s->flags & CODEC_FLAG_PASS1){
496 497
             put_symbol_inline(c, p->state[context], diff, 1, s->rc_stat);
498
+            }else{
499
+                put_symbol_inline(c, p->state[context], diff, 1, NULL);
500
+            }
497 501
         }else{
498 502
             if(context == 0) run_mode=1;
499 503