changeset 930:6bcb214d6a17 libavcodec

more debug output
author michaelni
date Tue, 17 Dec 2002 11:25:29 +0000
parents c35f06d95e64
children 5bc072934017
files h263.c mpeg12.c mpegvideo.c mpegvideo.h ratecontrol.c
diffstat 5 files changed, 32 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/h263.c	Sun Dec 15 22:42:59 2002 +0000
+++ b/h263.c	Tue Dec 17 11:25:29 2002 +0000
@@ -4552,11 +4552,11 @@
              s->b_code=1;
 
          if(s->avctx->debug&FF_DEBUG_PICT_INFO){
-             printf("qp:%d fc:%d bc:%d type:%s size:%d pro:%d alt:%d top:%d qpel:%d part:%d resync:%d w:%d a:%d\n", 
+             printf("qp:%d fc:%d,%d %s size:%d pro:%d alt:%d top:%d %spel part:%d resync:%d w:%d a:%d\n", 
                  s->qscale, s->f_code, s->b_code, 
                  s->pict_type == I_TYPE ? "I" : (s->pict_type == P_TYPE ? "P" : (s->pict_type == B_TYPE ? "B" : "S")), 
                  gb->size,s->progressive_sequence, s->alternate_scan, s->top_field_first, 
-                 s->quarter_sample, s->data_partitioning, s->resync_marker, s->num_sprite_warping_points,
+                 s->quarter_sample ? "q" : "h", s->data_partitioning, s->resync_marker, s->num_sprite_warping_points,
                  s->sprite_warping_accuracy); 
          }
 
--- a/mpeg12.c	Sun Dec 15 22:42:59 2002 +0000
+++ b/mpeg12.c	Tue Dec 17 11:25:29 2002 +0000
@@ -736,6 +736,7 @@
             s->mv[1][0][0] = s->last_mv[1][0][0];
             s->mv[1][0][1] = s->last_mv[1][0][1];
         }
+
         s->mb_skiped = 1;
         return 0;
     }
@@ -1617,6 +1618,15 @@
         s->first_slice = 0;
         if(MPV_frame_start(s, avctx) < 0)
             return DECODE_SLICE_FATAL_ERROR;
+            
+        if(s->avctx->debug&FF_DEBUG_PICT_INFO){
+             printf("qp:%d fc:%d%d%d%d %s %s %s %s dc:%d pstruct:%d fdct:%d cmv:%d qtype:%d ivlc:%d rff:%d %s\n", 
+                 s->qscale, s->mpeg_f_code[0][0],s->mpeg_f_code[0][1],s->mpeg_f_code[1][0],s->mpeg_f_code[1][1],
+                 s->pict_type == I_TYPE ? "I" : (s->pict_type == P_TYPE ? "P" : (s->pict_type == B_TYPE ? "B" : "S")), 
+                 s->progressive_sequence ? "pro" :"", s->alternate_scan ? "alt" :"", s->top_field_first ? "top" :"", 
+                 s->intra_dc_precision, s->picture_structure, s->frame_pred_frame_dct, s->concealment_motion_vectors,
+                 s->q_scale_type, s->intra_vlc_format, s->repeat_first_field, s->chroma_420_type ? "420" :"");
+        }
     }
 
     init_get_bits(&s->gb, buf, buf_size);
--- a/mpegvideo.c	Sun Dec 15 22:42:59 2002 +0000
+++ b/mpegvideo.c	Tue Dec 17 11:25:29 2002 +0000
@@ -914,7 +914,6 @@
 void MPV_frame_end(MpegEncContext *s)
 {
     int i;
-
     /* draw edge for correct motion prediction if outside */
     if(s->codec_id!=CODEC_ID_SVQ1){
         if (s->pict_type != B_TYPE && !s->intra_only && !(s->flags&CODEC_FLAG_EMU_EDGE)) {
@@ -3466,6 +3465,15 @@
     }
 }
 
+char ff_get_pict_type_char(int pict_type){
+    switch(pict_type){
+    case I_TYPE: return 'I'; 
+    case P_TYPE: return 'P'; 
+    case B_TYPE: return 'B'; 
+    case S_TYPE: return 'S'; 
+    }
+}
+
 AVCodec mpeg1video_encoder = {
     "mpeg1video",
     CODEC_TYPE_VIDEO,
--- a/mpegvideo.h	Sun Dec 15 22:42:59 2002 +0000
+++ b/mpegvideo.h	Tue Dec 17 11:25:29 2002 +0000
@@ -553,6 +553,8 @@
 void ff_init_scantable(MpegEncContext *s, ScanTable *st, const UINT8 *src_scantable);
 void ff_error_resilience(MpegEncContext *s);
 void ff_draw_horiz_band(MpegEncContext *s);
+char ff_get_pict_type_char(int pict_type);
+
 
 extern int ff_bit_exact;
 
--- a/ratecontrol.c	Sun Dec 15 22:42:59 2002 +0000
+++ b/ratecontrol.c	Tue Dec 17 11:25:29 2002 +0000
@@ -330,7 +330,7 @@
     const int pict_type= rce->new_pict_type;
     const double last_p_q    = rcc->last_qscale_for[P_TYPE];
     const double last_non_b_q= rcc->last_qscale_for[rcc->last_non_b_pict_type];
-
+    
     if     (pict_type==I_TYPE && (a->i_quant_factor>0.0 || rcc->last_non_b_pict_type==P_TYPE))
         q= last_p_q    *ABS(a->i_quant_factor) + a->i_quant_offset;
     else if(pict_type==B_TYPE && a->b_quant_factor>0.0)
@@ -339,6 +339,7 @@
     /* last qscale / qdiff stuff */
     if(rcc->last_non_b_pict_type==pict_type || pict_type!=I_TYPE){
         double last_q= rcc->last_qscale_for[pict_type];
+
         if     (q > last_q + a->max_qdiff) q= last_q + a->max_qdiff;
         else if(q < last_q - a->max_qdiff) q= last_q - a->max_qdiff;
     }
@@ -658,17 +659,16 @@
 
         assert(q>0.0);
     }
-//printf("qmin:%d, qmax:%d, q:%f\n", qmin, qmax, q);
-    
+
+    if(s->avctx->debug&FF_DEBUG_RC){
+        printf("%c qp:%d<%2.1f<%d %d want:%d total:%d comp:%f st_q:%2.2f size:%d var:%d/%d br:%d fps:%d\n",
+        ff_get_pict_type_char(pict_type), qmin, q, qmax, picture_number, (int)wanted_bits/1000, (int)s->total_bits/1000,
+        br_compensation, short_term_q, s->frame_bits, pic->mb_var_sum, pic->mc_mb_var_sum, s->bit_rate/1000, (int)fps
+        );
+    }
 
     if     (q<qmin) q=qmin; 
     else if(q>qmax) q=qmax;
-        
-//    printf("%f %d %d %d\n", q, picture_number, (int)wanted_bits, (int)s->total_bits);
-       
-//printf("diff:%d comp:%f st_q:%f last_size:%d type:%d\n", (int)diff, br_compensation, 
-//       short_term_q, s->frame_bits, pict_type);
-//printf("%d %d\n", s->bit_rate, (int)fps);
 
     if(s->adaptive_quant)
         adaptive_quantization(s, q);