Give context to dprintf
[ffmpeg.git] / libavcodec / mpeg12.c
index b7c6164..49802b7 100644 (file)
@@ -996,7 +996,7 @@ static void mpeg1_encode_block(MpegEncContext *s,
     next_coef:
 #if 0
         if (level != 0)
-            dprintf("level[%d]=%d\n", i, level);
+            dprintf(s->avctx, "level[%d]=%d\n", i, level);
 #endif
         /* encode using VLC */
         if (level != 0) {
@@ -1115,7 +1115,7 @@ static int mpeg_decode_mb(MpegEncContext *s,
     int i, j, k, cbp, val, mb_type, motion_type;
     const int mb_block_count = 4 + (1<< s->chroma_format);
 
-    dprintf("decode_mb: x=%d y=%d\n", s->mb_x, s->mb_y);
+    dprintf(s->avctx, "decode_mb: x=%d y=%d\n", s->mb_x, s->mb_y);
 
     assert(s->mb_skipped==0);
 
@@ -1199,7 +1199,7 @@ static int mpeg_decode_mb(MpegEncContext *s,
         mb_type = btype2mb_type[ mb_type ];
         break;
     }
-    dprintf("mb_type=%x\n", mb_type);
+    dprintf(s->avctx, "mb_type=%x\n", mb_type);
 //    motion_type = 0; /* avoid warning */
     if (IS_INTRA(mb_type)) {
         s->dsp.clear_blocks(s->block[0]);
@@ -1309,7 +1309,7 @@ static int mpeg_decode_mb(MpegEncContext *s,
             for(i=0;i<2;i++) {
                 if (USES_LIST(mb_type, i)) {
                     s->mv_dir |= (MV_DIR_FORWARD >> i);
-                    dprintf("motion_type=%d\n", motion_type);
+                    dprintf(s->avctx, "motion_type=%d\n", motion_type);
                     switch(motion_type) {
                     case MT_FRAME: /* or MT_16X8 */
                         if (s->picture_structure == PICT_FRAME) {
@@ -1350,12 +1350,12 @@ static int mpeg_decode_mb(MpegEncContext *s,
                                                          s->last_mv[i][j][0]);
                                 s->last_mv[i][j][0] = val;
                                 s->mv[i][j][0] = val;
-                                dprintf("fmx=%d\n", val);
+                                dprintf(s->avctx, "fmx=%d\n", val);
                                 val = mpeg_decode_motion(s, s->mpeg_f_code[i][1],
                                                          s->last_mv[i][j][1] >> 1);
                                 s->last_mv[i][j][1] = val << 1;
                                 s->mv[i][j][1] = val;
-                                dprintf("fmy=%d\n", val);
+                                dprintf(s->avctx, "fmy=%d\n", val);
                             }
                         } else {
                             mb_type |= MB_TYPE_16x16 | MB_TYPE_INTERLACED;
@@ -1580,7 +1580,7 @@ static inline int mpeg1_decode_block_intra(MpegEncContext *s,
     dc += diff;
     s->last_dc[component] = dc;
     block[0] = dc<<3;
-    dprintf("dc=%d diff=%d\n", dc, diff);
+    dprintf(s->avctx, "dc=%d diff=%d\n", dc, diff);
     i = 0;
     {
         OPEN_READER(re, &s->gb);
@@ -1954,7 +1954,7 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s,
     dc += diff;
     s->last_dc[component] = dc;
     block[0] = dc << (3 - s->intra_dc_precision);
-    dprintf("dc=%d\n", block[0]);
+    dprintf(s->avctx, "dc=%d\n", block[0]);
     mismatch = block[0] ^ 1;
     i = 0;
     if (s->intra_vlc_format)
@@ -2305,7 +2305,7 @@ static void mpeg_decode_sequence_extension(Mpeg1Context *s1)
     s1->frame_rate_ext.num = get_bits(&s->gb, 2)+1;
     s1->frame_rate_ext.den = get_bits(&s->gb, 5)+1;
 
-    dprintf("sequence extension\n");
+    dprintf(s->avctx, "sequence extension\n");
     s->codec_id= s->avctx->codec_id= CODEC_ID_MPEG2VIDEO;
     s->avctx->sub_id = 2; /* indicates mpeg2 found */
 
@@ -2377,7 +2377,7 @@ static void mpeg_decode_quant_matrix_extension(MpegEncContext *s)
 {
     int i, v, j;
 
-    dprintf("matrix extension\n");
+    dprintf(s->avctx, "matrix extension\n");
 
     if (get_bits1(&s->gb)) {
         for(i=0;i<64;i++) {
@@ -2448,15 +2448,15 @@ static void mpeg_decode_picture_coding_extension(MpegEncContext *s)
     }
 
     /* composite display not parsed */
-    dprintf("intra_dc_precision=%d\n", s->intra_dc_precision);
-    dprintf("picture_structure=%d\n", s->picture_structure);
-    dprintf("top field first=%d\n", s->top_field_first);
-    dprintf("repeat first field=%d\n", s->repeat_first_field);
-    dprintf("conceal=%d\n", s->concealment_motion_vectors);
-    dprintf("intra_vlc_format=%d\n", s->intra_vlc_format);
-    dprintf("alternate_scan=%d\n", s->alternate_scan);
-    dprintf("frame_pred_frame_dct=%d\n", s->frame_pred_frame_dct);
-    dprintf("progressive_frame=%d\n", s->progressive_frame);
+    dprintf(s->avctx, "intra_dc_precision=%d\n", s->intra_dc_precision);
+    dprintf(s->avctx, "picture_structure=%d\n", s->picture_structure);
+    dprintf(s->avctx, "top field first=%d\n", s->top_field_first);
+    dprintf(s->avctx, "repeat first field=%d\n", s->repeat_first_field);
+    dprintf(s->avctx, "conceal=%d\n", s->concealment_motion_vectors);
+    dprintf(s->avctx, "intra_vlc_format=%d\n", s->intra_vlc_format);
+    dprintf(s->avctx, "alternate_scan=%d\n", s->alternate_scan);
+    dprintf(s->avctx, "frame_pred_frame_dct=%d\n", s->frame_pred_frame_dct);
+    dprintf(s->avctx, "progressive_frame=%d\n", s->progressive_frame);
 }
 
 static void mpeg_decode_extension(AVCodecContext *avctx,
@@ -2635,7 +2635,7 @@ static int mpeg_decode_slice(Mpeg1Context *s1, int mb_y,
         ret = mpeg_decode_mb(s, s->block);
         s->chroma_qscale= s->qscale;
 
-        dprintf("ret=%d\n", ret);
+        dprintf(s->avctx, "ret=%d\n", ret);
         if (ret < 0)
             return -1;
 
@@ -2858,10 +2858,10 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx,
             s->chroma_intra_matrix[j] = v;
         }
 #ifdef DEBUG
-        dprintf("intra matrix present\n");
+        dprintf(s->avctx, "intra matrix present\n");
         for(i=0;i<64;i++)
-            dprintf(" %d", s->intra_matrix[s->dsp.idct_permutation[i]]);
-        dprintf("\n");
+            dprintf(s->avctx, " %d", s->intra_matrix[s->dsp.idct_permutation[i]]);
+        dprintf(s->avctx, "\n");
 #endif
     } else {
         for(i=0;i<64;i++) {
@@ -2883,10 +2883,10 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx,
             s->chroma_inter_matrix[j] = v;
         }
 #ifdef DEBUG
-        dprintf("non intra matrix present\n");
+        dprintf(s->avctx, "non intra matrix present\n");
         for(i=0;i<64;i++)
-            dprintf(" %d", s->inter_matrix[s->dsp.idct_permutation[i]]);
-        dprintf("\n");
+            dprintf(s->avctx, " %d", s->inter_matrix[s->dsp.idct_permutation[i]]);
+        dprintf(s->avctx, "\n");
 #endif
     } else {
         for(i=0;i<64;i++) {
@@ -3086,7 +3086,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
     int ret, input_size;
     AVFrame *picture = data;
     MpegEncContext *s2 = &s->mpeg_enc_ctx;
-    dprintf("fill_buffer\n");
+    dprintf(avctx, "fill_buffer\n");
 
     if (buf_size == 0) {
         /* special case for last picture */
@@ -3334,7 +3334,7 @@ static int mpeg_mc_decode_init(AVCodecContext *avctx){
     if( !(avctx->slice_flags & SLICE_FLAG_CODED_ORDER) )
         return -1;
     if( !(avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD) ){
-        dprintf("mpeg12.c: XvMC decoder will work better if SLICE_FLAG_ALLOW_FIELD is set\n");
+        dprintf(avctx, "mpeg12.c: XvMC decoder will work better if SLICE_FLAG_ALLOW_FIELD is set\n");
     }
     mpeg_decode_init(avctx);
     s = avctx->priv_data;