Hi,

On Tue, Apr 26, 2011 at 2:07 PM, Diego Biurrun <[email protected]> wrote:
[..]
> diff --git a/ffplay.c b/ffplay.c
[..]
> -#if 0
> -                printf("diff=%f adiff=%f sample_diff=%d apts=%0.3f 
> vpts=%0.3f %f\n",
> -                       diff, avg_diff, samples_size - samples_size1,
> -                       is->audio_clock, is->video_clock, 
> is->audio_diff_threshold);
> -#endif

av_dlog() this one please.

> diff --git a/libavcodec/asv1.c b/libavcodec/asv1.c
[..]
> -#if 0
> -int i;
> -printf("%d %d\n", 8*buf_size, get_bits_count(&a->gb));
> -for(i=get_bits_count(&a->gb); i<8*buf_size; i++){
> -    printf("%d", get_bits1(&a->gb));
> -}
> -
> -for(i=0; i<s->avctx->extradata_size; i++){
> -    printf("%c\n", ((uint8_t*)s->avctx->extradata)[i]);
> -}
> -#endif

OK.

> diff --git a/libavcodec/dct-test.c b/libavcodec/dct-test.c
[..]
> -#if 0 // print different matrix pairs
> -        if(blockSumErr){
> -            printf("\n");
> -            for(i=0; i<64; i++){
> -                if((i&7)==0) printf("\n");
> -                printf("%4d ", block_org[i]);
> -            }
> -            for(i=0; i<64; i++){
> -                if((i&7)==0) printf("\n");
> -                printf("%4d ", block[i] - block1[i]);
> -            }
> -        }
> -#endif

Leave this in for now.

> -#if 0
> -        printf("ref=\n");
> -        for(i=0;i<8;i++) {
> -            int j;
> -            for(j=0;j<8;j++) {
> -                printf(" %3d", img_dest1[i*8+j]);
> -            }
> -            printf("\n");
> -        }
> -
> -        printf("out=\n");
> -        for(i=0;i<8;i++) {
> -            int j;
> -            for(j=0;j<8;j++) {
> -                printf(" %3d", img_dest[i*8+j]);
> -            }
> -            printf("\n");
> -        }
> -#endif

OK.

> diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
[..]
> -#if 0
> -static int maxi=0;
> -if(sum>maxi){
> -    maxi=sum;
> -    printf("MAX:%d\n", maxi);
> -}
> -#endif

OK.

> diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
[..]
> -#if 0 // dump bits per frame / qp / complexity
> -{
> -    static FILE *f=NULL;
> -    if(!f) f=fopen("rate_qp_cplx.txt", "w");
> -    fprintf(f, "%d %d %f\n", buf_size, s->qscale, 
> buf_size*(double)s->qscale);
> -}
> -#endif

OK.

> diff --git a/libavcodec/h264.c b/libavcodec/h264.c
[..]
> -#if 0
> -    for(i=0; i<length; i++)
> -        printf("%2X ", src[i]);
> -#endif

OK.

> -#if 0
> -    int i;
> -    for(i=0; i<50; i++){
> -        av_log(NULL, AV_LOG_ERROR,"%02X ", buf[i]);
> -    }
> -#endif

OK.

(This seems to be a poor man's manual version of a NAL testunit. The
idea of testing NAL decoding is interesting, but should have been done
in FATE.)

> diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c
[..]
> -#if 0
> -for(j=0; j<256; j++){
> -printf("%6X, %2d,  %3d\n", s->bits[i][j], s->len[i][j], j);
> -}
> -#endif

OK.

> diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
> -#if 0
> -    printf("varc=%4d avg_var=%4d (sum=%4d) vard=%4d mx=%2d my=%2d\n",
> -           varc, s->avg_mb_var, sum, vard, mx - xx, my - yy);
> -#endif

av_dlog().

> diff --git a/libavcodec/motion_est_template.c 
> b/libavcodec/motion_est_template.c
[..]
> -#if 0
> -{
> -int dx, dy, i;
> -static int stats[8*8];
> -dx= FFABS(x-best[0]);
> -dy= FFABS(y-best[1]);
> -if(dy>dx){
> -    dx^=dy; dy^=dx; dx^=dy;
> -}
> -stats[dy*8 + dx] ++;
> -if(256*256*256*64 % (stats[0]+1)==0){
> -    for(i=0; i<64; i++){
> -        if((i&7)==0) printf("\n");
> -        printf("%8d ", stats[i]);
> -    }
> -    printf("\n");
> -}
> -}
> -#endif

OK.

> -#if 0
> -{
> -int dx, dy, i;
> -static int stats[8*8];
> -dx= FFABS(x-best[0]);
> -dy= FFABS(y-best[1]);
> -stats[dy*8 + dx] ++;
> -if(256*256*256*64 % (stats[0]+1)==0){
> -    for(i=0; i<64; i++){
> -        if((i&7)==0) printf("\n");
> -        printf("%6d ", stats[i]);
> -    }
> -    printf("\n");
> -}
> -}
> -#endif

OK.

> diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
[..]
> -#if 0
> -        if (level != 0)
> -            av_dlog(s->avctx, "level[%d]=%d\n", i, level);
> -#endif

OK.

> diff --git a/libavcodec/mpegaudioenc.c b/libavcodec/mpegaudioenc.c
[..]
> -#if 0
> -            printf("%2d:%d in=%x %x %d\n",
> -                   j, i, vmax, scale_factor_table[index], index);
> -#endif
[..]
> -#if 0
> -        printf("%d: %2d %2d %2d %d %d -> %d\n", j,
> -               sf[0], sf[1], sf[2], d1, d2, code);
> -#endif
[..]
> -#if 0
> -        printf("current=%d max=%d max_sb=%d alloc=%d\n",
> -               current_frame_size, max_frame_size, max_sb,
> -               bit_alloc[max_sb]);
> -#endif

av_dlog() for these three please.

> -#if 0
> -    for(i=0;i<s->sblimit;i++) {
> -        printf("%d ", bit_alloc[i]);
> -    }
> -    printf("\n");
> -#endif

OK.

> -#if 0
> -                            printf("%d: gr1 %d\n",
> -                                   i, q[0] + steps * (q[1] + steps * q[2]));
> -#endif
>                         } else {
> -#if 0
> -                            printf("%d: gr3 %d %d %d\n",
> -                                   i, q[0], q[1], q[2]);
> -#endif

OK.

> diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c
[..]
> -#if 0
> -    printf("pict_type=%d frame_rate=%0.3f repeat_pict=%d\n",
> -           s->pict_type, (double)avctx->time_base.den / 
> avctx->time_base.num, s->repeat_pict);
> -#endif

av_dlog().

> diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c
[..]
> -#if 0
> -    if ((unsigned)mx >= 64 ||
> -        (unsigned)my >= 64)
> -        av_log(s->avctx, AV_LOG_ERROR, "error mx=%d my=%d\n", mx, my);
> -#endif

Uhm. This should either be an assert() or there's some really broad,
undocumented assumptions in this code. In fact it looks like this may
easily crash the encoder. Can someone else look at this? Please leave
it for now so it serves as a FIXME.

> -#if 0
> -        if (coded_cbp)
> -            printf("cbp=%x %x\n", cbp, coded_cbp);
> -#endif
[..]
> -#if 0
> -{
> -int i;
> -for(i=0; i<s->gb.size_in_bits; i++)
> -    av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));
> -//    get_bits1(&s->gb);
> -av_log(s->avctx, AV_LOG_DEBUG, "END\n");
> -return -1;
> -}
> -#endif

OK.

> diff --git a/libavcodec/parser.c b/libavcodec/parser.c
[..]
> -#if 0
> -    if(pc->overread){
> -        printf("overread %d, state:%X next:%d index:%d o_index:%d\n", 
> pc->overread, pc->state, next, pc->index, pc->overread_index);
> -        printf("%X %X %X %X\n", (*buf)[0], (*buf)[1],(*buf)[2],(*buf)[3]);
> -    }
> -#endif
[..]
> -#if 0
> -    if(pc->overread){
> -        printf("overread %d, state:%X next:%d index:%d o_index:%d\n", 
> pc->overread, pc->state, next, pc->index, pc->overread_index);
> -        printf("%X %X %X %X\n", (*buf)[0], (*buf)[1],(*buf)[2],(*buf)[3]);
> -    }
> -#endif

av_dlog() for both.

> diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
[..]
> -#if 0
> -{
> -    static int mvsum=0, texsum=0;
> -    mvsum += s->mv_bits;
> -    texsum += s->i_tex_bits + s->p_tex_bits;
> -    printf("%d %d//\n\n", mvsum, texsum);
> -}
> -#endif

OK.

> diff --git a/libavcodec/resample2.c b/libavcodec/resample2.c
[..]
> -#if 0
> -    if(update_ctx && !c->compensation_distance){
> -#undef rand
> -        av_resample_compensate(c, rand() % (8000*2) - 8000, 8000*2);
> -av_log(NULL, AV_LOG_DEBUG, "%d %d %d\n", c->dst_incr, c->ideal_dst_incr, 
> c->compensation_distance);
> -    }
> -#endif

Doesn't belong in this patch.

> diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
[..]
> -#if 0
> -    GetBitContext gb= s->gb;
> -    for(i=0; i<64; i++){
> -        av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&gb));
> -        if(i%4==3) av_log(s->avctx, AV_LOG_DEBUG, " ");
> -    }
> -    av_log(s->avctx, AV_LOG_DEBUG, "\n");
> -#endif
> -#if 0
> -    av_log(s->avctx, AV_LOG_DEBUG, "%3dx%03d/%02Xx%02X ", s->width, 
> s->height, s->width/4, s->height/4);
> -    for(i=0; i<s->avctx->extradata_size; i++){
> -        av_log(s->avctx, AV_LOG_DEBUG, "%02X ", 
> ((uint8_t*)s->avctx->extradata)[i]);
> -        if(i%4==3) av_log(s->avctx, AV_LOG_DEBUG, " ");
> -    }
> -    av_log(s->avctx, AV_LOG_DEBUG, "\n");
> -#endif

Ugh, OK.

> diff --git a/libavcodec/svq1dec.c b/libavcodec/svq1dec.c
[..]
> -#if 0
> -  int w= (s->width+15)&~15;
> -  int h= (s->height+15)&~15;
> -  if(x + (mv.x >> 1)<0 || y + (mv.y >> 1)<0 || x + (mv.x >> 1) + 16 > w || y 
> + (mv.y >> 1) + 16> h)
> -      av_log(s->avctx, AV_LOG_INFO, "%d %d %d %d\n", x, y, x + (mv.x >> 1), 
> y + (mv.y >> 1));
> -#endif
[..]
> -#if 0
> -  int w= (s->width+15)&~15;
> -  int h= (s->height+15)&~15;
> -  if(x + (mvx >> 1)<0 || y + (mvy >> 1)<0 || x + (mvx >> 1) + 8 > w || y + 
> (mvy >> 1) + 8> h)
> -      av_log(s->avctx, AV_LOG_INFO, "%d %d %d %d\n", x, y, x + (mvx >> 1), y 
> + (mvy >> 1));
> -#endif

OK.

> diff --git a/libavcodec/wma.c b/libavcodec/wma.c
[..]
> -#if 0
> -            tprintf(s->avctx, "%5d: coefs_end=%d high_band_start=%d 
> nb_high_bands=%d: ",
> -                    s->frame_len >> k,
> -                    s->coefs_end[k],
> -                    s->high_band_start[k],
> -                    s->exponent_high_sizes[k]);
> -            for (j = 0; j < s->exponent_high_sizes[k]; j++)
> -                tprintf(s->avctx, " %d", s->exponent_high_bands[k][j]);
> -            tprintf(s->avctx, "\n");
> -#endif

No. tprintf() are special versions of av_dlog(). As you can see, this
evaluates to actual loop code that gcc may not easily throw out (you
should test that :-) ), but removing is not good. Same goes for all
tprintf() that you may have seen in h264*.[ch].

> diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c
[..]
> -#if 0
> -    for(i=1;i<20;i++) {
> -        float v, r1, r2;
> -        v = 5.0 / i;
> -        r1 = pow_m1_4(s, v);
> -        r2 = pow(v,-0.25);
> -        printf("%f^-0.25=%f e=%f\n", v, r1, r2 - r1);
> -    }
> -#endif

OK.

> diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
[..]
> -#if 0
> -{
> -int i;
> -for(i=0; i<s->gb.size*8; i++)
> -    printf("%d", get_bits1(&s->gb));
> -//    get_bits1(&s->gb);
> -printf("END\n");
> -return -1;
> -}
> -#endif
[..]
> -#if 0
> -    if(w->per_block_abt)
> -        printf("B%d", w->abt_type);
> -#endif

OK.

> diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c
[..]
> -#if 0
> -    av_log(avctx, AV_LOG_INFO, "libavcodec: CPU flags:");
> -    if (mm_flags & AV_CPU_FLAG_MMX)
> -        av_log(avctx, AV_LOG_INFO, " mmx");
> -    if (mm_flags & AV_CPU_FLAG_MMX2)
> -        av_log(avctx, AV_LOG_INFO, " mmx2");
> -    if (mm_flags & AV_CPU_FLAG_3DNOW)
> -        av_log(avctx, AV_LOG_INFO, " 3dnow");
> -    if (mm_flags & AV_CPU_FLAG_SSE)
> -        av_log(avctx, AV_LOG_INFO, " sse");
> -    if (mm_flags & AV_CPU_FLAG_SSE2)
> -        av_log(avctx, AV_LOG_INFO, " sse2");
> -    av_log(avctx, AV_LOG_INFO, "\n");
> -#endif

I would say uncomment this and make it a AV_LOG_DEBUG. But then it
should probably be moved to libavutil/x86/cpu.c.

> diff --git a/libavdevice/v4l.c b/libavdevice/v4l.c
[..]
> @@ -147,16 +147,8 @@ static int grab_read_header(AVFormatContext *s1, 
> AVFormatParameters *ap)
>     memcpy(&s->audio_saved, &audio, sizeof(audio));
>     audio.flags &= ~VIDEO_AUDIO_MUTE;
>     ioctl(video_fd, VIDIOCSAUDIO, &audio);
> -
>     ioctl(video_fd, VIDIOCGPICT, &pict);

Unrelated.

> -#if 0
> -    printf("v4l: colour=%d hue=%d brightness=%d constrast=%d whiteness=%d\n",
> -           pict.colour,
> -           pict.hue,
> -           pict.brightness,
> -           pict.contrast,
> -           pict.whiteness);
> -#endif

av_dlog().

> diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
[..]
> -#if 0
> -        av_hexdump_log(s, AV_LOG_DEBUG, ffm->header, FRAME_HEADER_SIZE);
> -#endif

OK.

> diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
[..]
> -#if 0
> -    av_log(s, AV_LOG_DEBUG, "%d: pts=%0.3f dts=%0.3f size=%d\n",
> -           pkt->stream_index, pkt->pts / 90000.0, pkt->dts / 90000.0, 
> pkt->size);
> -#endif

av_dlog().

> diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
[..]
> -#if 0
> -    printf("packet ID=%2x PTS=%0.3f\n",
> -           id, pts / 90000.0);
> -#endif
[..]
> -#if 0
> -        av_log(ctx, AV_LOG_DEBUG, "bumping scr, scr:%f, dts:%f\n",
> -               scr/90000.0, best_dts/90000.0);
> -#endif

av_dlog().

> diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
[..]
> -#if 0
> -                av_hex_dump_log(pes->stream, AV_LOG_DEBUG, pes->header, 
> pes->data_index);
> -#endif

OK.

> -#if 0
> -        av_log(ts->stream, AV_LOG_DEBUG, "start=%0.3f pcr=%0.3f incr=%d\n",
> -               st->start_time / 1000000.0, pcrs[0] / 27e6, ts->pcr_incr);
> -#endif

av_dlog().

> diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
[..]
> -#if 0
> -    av_log (s, AV_LOG_DEBUG, "ogg_packet: curidx=%i\n", ogg->curidx);
> -#endif
[..]
> -#if 0
> -        av_log (s, AV_LOG_DEBUG,
> -                "ogg_packet: idx=%d pstart=%d psize=%d segp=%d nsegs=%d\n",
> -                idx, os->pstart, os->psize, os->segp, os->nsegs);
> -#endif
[..]
> -#if 0
> -    av_log (s, AV_LOG_DEBUG,
> -            "ogg_packet: idx %i, frame size %i, start %i\n",
> -            idx, os->psize, os->pstart);
> -#endif
[..]
> -#if 0
> -    av_log (s, AV_LOG_DEBUG, "found headers\n");
> -#endif

av_dlog() all.

> diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
[..]
> -#if 0
> -        printf("tag=%c%c%c%c (%08x) size=%d\n",
> -               (tag) & 0xff,
> -               (tag >> 8) & 0xff,
> -               (tag >> 16) & 0xff,
> -               (tag >> 24) & 0xff,
> -               tag,
> -               tag_size);
> -#endif

av_dlog().

> diff --git a/libavformat/utils.c b/libavformat/utils.c
[..]
> -#if 0
> -    {
> -        int i;
> -        AVStream *st;
> -        for(i = 0;i < ic->nb_streams; i++) {
> -            st = ic->streams[i];
> -        printf("%d: start_time: %0.3f duration: %0.3f\n",
> -               i, (double)st->start_time / AV_TIME_BASE,
> -               (double)st->duration / AV_TIME_BASE);
> -        }
> -        printf("stream: start_time: %0.3f duration: %0.3f bitrate=%d kb/s\n",
> -               (double)ic->start_time / AV_TIME_BASE,
> -               (double)ic->duration / AV_TIME_BASE,
> -               ic->bit_rate / 1000);
> -    }
> -#endif

av_dlog(). The compiler should be able to clean up the empty loop itself.

Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to