taken from a patch by Steve L'Homme Originally committed as revision 5127 to svn://svn.ffmpeg.org/ffmpeg/trunktags/v0.5
| @@ -921,8 +921,8 @@ static int h261_decode_frame(AVCodecContext *avctx, | |||||
| AVFrame *pict = data; | AVFrame *pict = data; | ||||
| #ifdef DEBUG | #ifdef DEBUG | ||||
| printf("*****frame %d size=%d\n", avctx->frame_number, buf_size); | |||||
| printf("bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]); | |||||
| av_log(avctx, AV_LOG_DEBUG, "*****frame %d size=%d\n", avctx->frame_number, buf_size); | |||||
| av_log(avctx, AV_LOG_DEBUG, "bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]); | |||||
| #endif | #endif | ||||
| s->flags= avctx->flags; | s->flags= avctx->flags; | ||||
| s->flags2= avctx->flags2; | s->flags2= avctx->flags2; | ||||
| @@ -694,7 +694,7 @@ retry: | |||||
| return -1; | return -1; | ||||
| #ifdef DEBUG | #ifdef DEBUG | ||||
| printf("qscale=%d\n", s->qscale); | |||||
| av_log(avctx, AV_LOG_DEBUG, "qscale=%d\n", s->qscale); | |||||
| #endif | #endif | ||||
| ff_er_frame_start(s); | ff_er_frame_start(s); | ||||
| @@ -783,7 +783,7 @@ assert(s->current_picture.pict_type == s->pict_type); | |||||
| if(s->last_picture_ptr || s->low_delay) | if(s->last_picture_ptr || s->low_delay) | ||||
| *data_size = sizeof(AVFrame); | *data_size = sizeof(AVFrame); | ||||
| #ifdef PRINT_FRAME_TIME | #ifdef PRINT_FRAME_TIME | ||||
| printf("%Ld\n", rdtsc()-time); | |||||
| av_log(avctx, AV_LOG_DEBUG, "%Ld\n", rdtsc()-time); | |||||
| #endif | #endif | ||||
| return get_consumed_bytes(s, buf_size); | return get_consumed_bytes(s, buf_size); | ||||
| @@ -6977,7 +6977,7 @@ static int decode_slice(H264Context *h){ | |||||
| hl_decode_mb(h); | hl_decode_mb(h); | ||||
| if(ret<0){ | if(ret<0){ | ||||
| fprintf(stderr, "error while decoding MB %d %d\n", s->mb_x, s->mb_y); | |||||
| av_log(s->avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y); | |||||
| ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask); | ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask); | ||||
| return -1; | return -1; | ||||
| @@ -343,7 +343,7 @@ static int read_old_huffman_tables(HYuvContext *s){ | |||||
| return 0; | return 0; | ||||
| #else | #else | ||||
| fprintf(stderr, "v1 huffyuv is not supported \n"); | |||||
| av_log(s->avctx, AV_LOG_DEBUG, "v1 huffyuv is not supported \n"); | |||||
| return -1; | return -1; | ||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -365,7 +365,7 @@ static int full_motion_search(MpegEncContext * s, | |||||
| #if 0 | #if 0 | ||||
| if (*mx_ptr < -(2 * range) || *mx_ptr >= (2 * range) || | if (*mx_ptr < -(2 * range) || *mx_ptr >= (2 * range) || | ||||
| *my_ptr < -(2 * range) || *my_ptr >= (2 * range)) { | *my_ptr < -(2 * range) || *my_ptr >= (2 * range)) { | ||||
| fprintf(stderr, "error %d %d\n", *mx_ptr, *my_ptr); | |||||
| av_log(NULL, AV_LOG_ERROR, "error %d %d\n", *mx_ptr, *my_ptr); | |||||
| } | } | ||||
| #endif | #endif | ||||
| return dmin; | return dmin; | ||||
| @@ -2789,7 +2789,7 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx, | |||||
| dprintf("intra matrix present\n"); | dprintf("intra matrix present\n"); | ||||
| for(i=0;i<64;i++) | for(i=0;i<64;i++) | ||||
| dprintf(" %d", s->intra_matrix[s->dsp.idct_permutation[i]]); | dprintf(" %d", s->intra_matrix[s->dsp.idct_permutation[i]]); | ||||
| printf("\n"); | |||||
| dprintf("\n"); | |||||
| #endif | #endif | ||||
| } else { | } else { | ||||
| for(i=0;i<64;i++) { | for(i=0;i<64;i++) { | ||||
| @@ -2814,7 +2814,7 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx, | |||||
| dprintf("non intra matrix present\n"); | dprintf("non intra matrix present\n"); | ||||
| for(i=0;i<64;i++) | for(i=0;i<64;i++) | ||||
| dprintf(" %d", s->inter_matrix[s->dsp.idct_permutation[i]]); | dprintf(" %d", s->inter_matrix[s->dsp.idct_permutation[i]]); | ||||
| printf("\n"); | |||||
| dprintf("\n"); | |||||
| #endif | #endif | ||||
| } else { | } else { | ||||
| for(i=0;i<64;i++) { | for(i=0;i<64;i++) { | ||||
| @@ -489,10 +489,10 @@ static int decode_init(AVCodecContext * avctx) | |||||
| #if defined(DEBUG) | #if defined(DEBUG) | ||||
| for(j=0;j<8;j++) { | for(j=0;j<8;j++) { | ||||
| printf("win%d=\n", j); | |||||
| av_log(avctx, AV_LOG_DEBUG, "win%d=\n", j); | |||||
| for(i=0;i<36;i++) | for(i=0;i<36;i++) | ||||
| printf("%f, ", (double)mdct_win[j][i] / FRAC_ONE); | |||||
| printf("\n"); | |||||
| av_log(avctx, AV_LOG_DEBUG, "%f, ", (double)mdct_win[j][i] / FRAC_ONE); | |||||
| av_log(avctx, AV_LOG_DEBUG, "\n"); | |||||
| } | } | ||||
| #endif | #endif | ||||
| init = 1; | init = 1; | ||||
| @@ -1179,20 +1179,20 @@ static int decode_header(MPADecodeContext *s, uint32_t header) | |||||
| } | } | ||||
| #if defined(DEBUG) | #if defined(DEBUG) | ||||
| printf("layer%d, %d Hz, %d kbits/s, ", | |||||
| dprintf("layer%d, %d Hz, %d kbits/s, ", | |||||
| s->layer, s->sample_rate, s->bit_rate); | s->layer, s->sample_rate, s->bit_rate); | ||||
| if (s->nb_channels == 2) { | if (s->nb_channels == 2) { | ||||
| if (s->layer == 3) { | if (s->layer == 3) { | ||||
| if (s->mode_ext & MODE_EXT_MS_STEREO) | if (s->mode_ext & MODE_EXT_MS_STEREO) | ||||
| printf("ms-"); | |||||
| dprintf("ms-"); | |||||
| if (s->mode_ext & MODE_EXT_I_STEREO) | if (s->mode_ext & MODE_EXT_I_STEREO) | ||||
| printf("i-"); | |||||
| dprintf("i-"); | |||||
| } | } | ||||
| printf("stereo"); | |||||
| dprintf("stereo"); | |||||
| } else { | } else { | ||||
| printf("mono"); | |||||
| dprintf("mono"); | |||||
| } | } | ||||
| printf("\n"); | |||||
| dprintf("\n"); | |||||
| #endif | #endif | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -1370,8 +1370,8 @@ static int mp_decode_layer2(MPADecodeContext *s) | |||||
| { | { | ||||
| for(ch=0;ch<s->nb_channels;ch++) { | for(ch=0;ch<s->nb_channels;ch++) { | ||||
| for(i=0;i<sblimit;i++) | for(i=0;i<sblimit;i++) | ||||
| printf(" %d", bit_alloc[ch][i]); | |||||
| printf("\n"); | |||||
| dprintf(" %d", bit_alloc[ch][i]); | |||||
| dprintf("\n"); | |||||
| } | } | ||||
| } | } | ||||
| #endif | #endif | ||||
| @@ -1421,12 +1421,12 @@ static int mp_decode_layer2(MPADecodeContext *s) | |||||
| for(i=0;i<sblimit;i++) { | for(i=0;i<sblimit;i++) { | ||||
| if (bit_alloc[ch][i]) { | if (bit_alloc[ch][i]) { | ||||
| sf = scale_factors[ch][i]; | sf = scale_factors[ch][i]; | ||||
| printf(" %d %d %d", sf[0], sf[1], sf[2]); | |||||
| dprintf(" %d %d %d", sf[0], sf[1], sf[2]); | |||||
| } else { | } else { | ||||
| printf(" -"); | |||||
| dprintf(" -"); | |||||
| } | } | ||||
| } | } | ||||
| printf("\n"); | |||||
| dprintf("\n"); | |||||
| } | } | ||||
| #endif | #endif | ||||
| @@ -2285,11 +2285,11 @@ static int mp_decode_layer3(MPADecodeContext *s) | |||||
| } | } | ||||
| #if defined(DEBUG) | #if defined(DEBUG) | ||||
| { | { | ||||
| printf("scfsi=%x gr=%d ch=%d scale_factors:\n", | |||||
| dprintf("scfsi=%x gr=%d ch=%d scale_factors:\n", | |||||
| g->scfsi, gr, ch); | g->scfsi, gr, ch); | ||||
| for(i=0;i<j;i++) | for(i=0;i<j;i++) | ||||
| printf(" %d", g->scale_factors[i]); | |||||
| printf("\n"); | |||||
| dprintf(" %d", g->scale_factors[i]); | |||||
| dprintf("\n"); | |||||
| } | } | ||||
| #endif | #endif | ||||
| } else { | } else { | ||||
| @@ -2342,11 +2342,11 @@ static int mp_decode_layer3(MPADecodeContext *s) | |||||
| g->scale_factors[j] = 0; | g->scale_factors[j] = 0; | ||||
| #if defined(DEBUG) | #if defined(DEBUG) | ||||
| { | { | ||||
| printf("gr=%d ch=%d scale_factors:\n", | |||||
| dprintf("gr=%d ch=%d scale_factors:\n", | |||||
| gr, ch); | gr, ch); | ||||
| for(i=0;i<40;i++) | for(i=0;i<40;i++) | ||||
| printf(" %d", g->scale_factors[i]); | |||||
| printf("\n"); | |||||
| dprintf(" %d", g->scale_factors[i]); | |||||
| dprintf("\n"); | |||||
| } | } | ||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -2428,10 +2428,10 @@ static int mp_decode_frame(MPADecodeContext *s, | |||||
| for(i=0;i<nb_frames;i++) { | for(i=0;i<nb_frames;i++) { | ||||
| for(ch=0;ch<s->nb_channels;ch++) { | for(ch=0;ch<s->nb_channels;ch++) { | ||||
| int j; | int j; | ||||
| printf("%d-%d:", i, ch); | |||||
| dprintf("%d-%d:", i, ch); | |||||
| for(j=0;j<SBLIMIT;j++) | for(j=0;j<SBLIMIT;j++) | ||||
| printf(" %0.6f", (double)s->sb_samples[ch][i][j] / FRAC_ONE); | |||||
| printf("\n"); | |||||
| dprintf(" %0.6f", (double)s->sb_samples[ch][i][j] / FRAC_ONE); | |||||
| dprintf("\n"); | |||||
| } | } | ||||
| } | } | ||||
| #endif | #endif | ||||
| @@ -434,7 +434,7 @@ void msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number) | |||||
| #ifdef DEBUG | #ifdef DEBUG | ||||
| intra_count = 0; | intra_count = 0; | ||||
| printf("*****frame %d:\n", frame_count++); | |||||
| av_log(s->avctx, AV_LOG_DEBUG, "*****frame %d:\n", frame_count++); | |||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -504,7 +504,7 @@ static void msmpeg4_encode_motion(MpegEncContext * s, | |||||
| #if 0 | #if 0 | ||||
| if ((unsigned)mx >= 64 || | if ((unsigned)mx >= 64 || | ||||
| (unsigned)my >= 64) | (unsigned)my >= 64) | ||||
| fprintf(stderr, "error mx=%d my=%d\n", mx, my); | |||||
| av_log(s->avctx, AV_LOG_ERROR, "error mx=%d my=%d\n", mx, my); | |||||
| #endif | #endif | ||||
| mv = &mv_tables[s->mv_table_index]; | mv = &mv_tables[s->mv_table_index]; | ||||
| @@ -1214,9 +1214,9 @@ int msmpeg4_decode_picture_header(MpegEncContext * s) | |||||
| { | { | ||||
| int i; | int i; | ||||
| for(i=0; i<s->gb.size_in_bits; i++) | for(i=0; i<s->gb.size_in_bits; i++) | ||||
| printf("%d", get_bits1(&s->gb)); | |||||
| av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb)); | |||||
| // get_bits1(&s->gb); | // get_bits1(&s->gb); | ||||
| printf("END\n"); | |||||
| av_log(s->avctx, AV_LOG_DEBUG, "END\n"); | |||||
| return -1; | return -1; | ||||
| } | } | ||||
| #endif | #endif | ||||
| @@ -1370,7 +1370,7 @@ return -1; | |||||
| s->esc3_run_length= 0; | s->esc3_run_length= 0; | ||||
| #ifdef DEBUG | #ifdef DEBUG | ||||
| printf("*****frame %d:\n", frame_count++); | |||||
| av_log(s->avctx, AV_LOG_DEBUG, "*****frame %d:\n", frame_count++); | |||||
| #endif | #endif | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -1794,15 +1794,15 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, | |||||
| const int run1= run - rl->max_run[last][abs_level] - run_diff; | const int run1= run - rl->max_run[last][abs_level] - run_diff; | ||||
| if(abs_level<=MAX_LEVEL && run<=MAX_RUN){ | if(abs_level<=MAX_LEVEL && run<=MAX_RUN){ | ||||
| if(abs_level <= rl->max_level[last][run]){ | if(abs_level <= rl->max_level[last][run]){ | ||||
| fprintf(stderr, "illegal 3. esc, vlc encoding possible\n"); | |||||
| av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, vlc encoding possible\n"); | |||||
| return DECODING_AC_LOST; | return DECODING_AC_LOST; | ||||
| } | } | ||||
| if(abs_level <= rl->max_level[last][run]*2){ | if(abs_level <= rl->max_level[last][run]*2){ | ||||
| fprintf(stderr, "illegal 3. esc, esc 1 encoding possible\n"); | |||||
| av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 1 encoding possible\n"); | |||||
| return DECODING_AC_LOST; | return DECODING_AC_LOST; | ||||
| } | } | ||||
| if(run1>=0 && abs_level <= rl->max_level[last][run1]){ | if(run1>=0 && abs_level <= rl->max_level[last][run1]){ | ||||
| fprintf(stderr, "illegal 3. esc, esc 2 encoding possible\n"); | |||||
| av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 2 encoding possible\n"); | |||||
| return DECODING_AC_LOST; | return DECODING_AC_LOST; | ||||
| } | } | ||||
| } | } | ||||
| @@ -1813,7 +1813,7 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, | |||||
| else level= level * qmul - qadd; | else level= level * qmul - qadd; | ||||
| #if 0 // waste of time too :( | #if 0 // waste of time too :( | ||||
| if(level>2048 || level<-2048){ | if(level>2048 || level<-2048){ | ||||
| fprintf(stderr, "|level| overflow in 3. esc\n"); | |||||
| av_log(s->avctx, AV_LOG_ERROR, "|level| overflow in 3. esc\n"); | |||||
| return DECODING_AC_LOST; | return DECODING_AC_LOST; | ||||
| } | } | ||||
| #endif | #endif | ||||
| @@ -507,7 +507,7 @@ static int decode_frame(AVCodecContext *avctx, | |||||
| tag32 = get32(&s->bytestream); | tag32 = get32(&s->bytestream); | ||||
| tag = bswap_32(tag32); | tag = bswap_32(tag32); | ||||
| #ifdef DEBUG | #ifdef DEBUG | ||||
| printf("png: tag=%c%c%c%c length=%u\n", | |||||
| av_log(avctx, AV_LOG_DEBUG, "png: tag=%c%c%c%c length=%u\n", | |||||
| (tag & 0xff), | (tag & 0xff), | ||||
| ((tag >> 8) & 0xff), | ((tag >> 8) & 0xff), | ||||
| ((tag >> 16) & 0xff), | ((tag >> 16) & 0xff), | ||||
| @@ -531,7 +531,7 @@ static int decode_frame(AVCodecContext *avctx, | |||||
| crc = get32(&s->bytestream); | crc = get32(&s->bytestream); | ||||
| s->state |= PNG_IHDR; | s->state |= PNG_IHDR; | ||||
| #ifdef DEBUG | #ifdef DEBUG | ||||
| printf("width=%d height=%d depth=%d color_type=%d compression_type=%d filter_type=%d interlace_type=%d\n", | |||||
| av_log(avctx, AV_LOG_DEBUG, "width=%d height=%d depth=%d color_type=%d compression_type=%d filter_type=%d interlace_type=%d\n", | |||||
| s->width, s->height, s->bit_depth, s->color_type, | s->width, s->height, s->bit_depth, s->color_type, | ||||
| s->compression_type, s->filter_type, s->interlace_type); | s->compression_type, s->filter_type, s->interlace_type); | ||||
| #endif | #endif | ||||
| @@ -589,7 +589,7 @@ static int decode_frame(AVCodecContext *avctx, | |||||
| s->crow_size = s->pass_row_size + 1; | s->crow_size = s->pass_row_size + 1; | ||||
| } | } | ||||
| #ifdef DEBUG | #ifdef DEBUG | ||||
| printf("row_size=%d crow_size =%d\n", | |||||
| av_log(avctx, AV_LOG_DEBUG, "row_size=%d crow_size =%d\n", | |||||
| s->row_size, s->crow_size); | s->row_size, s->crow_size); | ||||
| #endif | #endif | ||||
| s->image_buf = p->data[0]; | s->image_buf = p->data[0]; | ||||
| @@ -321,7 +321,7 @@ static int rv10_decode_picture_header(MpegEncContext *s) | |||||
| pb_frame = get_bits(&s->gb, 1); | pb_frame = get_bits(&s->gb, 1); | ||||
| #ifdef DEBUG | #ifdef DEBUG | ||||
| printf("pict_type=%d pb_frame=%d\n", s->pict_type, pb_frame); | |||||
| av_log(s->avctx, AV_LOG_DEBUG, "pict_type=%d pb_frame=%d\n", s->pict_type, pb_frame); | |||||
| #endif | #endif | ||||
| if (pb_frame){ | if (pb_frame){ | ||||
| @@ -342,7 +342,7 @@ static int rv10_decode_picture_header(MpegEncContext *s) | |||||
| s->last_dc[1] = get_bits(&s->gb, 8); | s->last_dc[1] = get_bits(&s->gb, 8); | ||||
| s->last_dc[2] = get_bits(&s->gb, 8); | s->last_dc[2] = get_bits(&s->gb, 8); | ||||
| #ifdef DEBUG | #ifdef DEBUG | ||||
| printf("DC:%d %d %d\n", | |||||
| av_log(s->avctx, AV_LOG_DEBUG, "DC:%d %d %d\n", | |||||
| s->last_dc[0], | s->last_dc[0], | ||||
| s->last_dc[1], | s->last_dc[1], | ||||
| s->last_dc[2]); | s->last_dc[2]); | ||||
| @@ -631,7 +631,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, | |||||
| } | } | ||||
| #ifdef DEBUG | #ifdef DEBUG | ||||
| printf("qscale=%d\n", s->qscale); | |||||
| av_log(avctx, AV_LOG_DEBUG, "qscale=%d\n", s->qscale); | |||||
| #endif | #endif | ||||
| /* default quantization values */ | /* default quantization values */ | ||||
| @@ -672,7 +672,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, | |||||
| int ret; | int ret; | ||||
| ff_update_block_index(s); | ff_update_block_index(s); | ||||
| #ifdef DEBUG | #ifdef DEBUG | ||||
| printf("**mb x=%d y=%d\n", s->mb_x, s->mb_y); | |||||
| av_log(avctx, AV_LOG_DEBUG, "**mb x=%d y=%d\n", s->mb_x, s->mb_y); | |||||
| #endif | #endif | ||||
| s->mv_dir = MV_DIR_FORWARD; | s->mv_dir = MV_DIR_FORWARD; | ||||
| @@ -713,7 +713,7 @@ static int rv10_decode_frame(AVCodecContext *avctx, | |||||
| AVFrame *pict = data; | AVFrame *pict = data; | ||||
| #ifdef DEBUG | #ifdef DEBUG | ||||
| printf("*****frame %d size=%d\n", avctx->frame_number, buf_size); | |||||
| av_log(avctx, AV_LOG_DEBUG, "*****frame %d size=%d\n", avctx->frame_number, buf_size); | |||||
| #endif | #endif | ||||
| /* no supplementary picture */ | /* no supplementary picture */ | ||||
| @@ -173,7 +173,7 @@ restart_poll: | |||||
| return AVERROR_IO; | return AVERROR_IO; | ||||
| } | } | ||||
| #ifdef DV1394_DEBUG | #ifdef DV1394_DEBUG | ||||
| fprintf(stderr, "DV1394: status\n" | |||||
| av_log(context, AV_LOG_ERROR, "DV1394: status\n" | |||||
| "\tactive_frame\t%d\n" | "\tactive_frame\t%d\n" | ||||
| "\tfirst_clear_frame\t%d\n" | "\tfirst_clear_frame\t%d\n" | ||||
| "\tn_clear_frames\t%d\n" | "\tn_clear_frames\t%d\n" | ||||
| @@ -196,7 +196,7 @@ restart_poll: | |||||
| } | } | ||||
| #ifdef DV1394_DEBUG | #ifdef DV1394_DEBUG | ||||
| fprintf(stderr, "index %d, avail %d, done %d\n", dv->index, dv->avail, | |||||
| av_log(context, AV_LOG_ERROR, "index %d, avail %d, done %d\n", dv->index, dv->avail, | |||||
| dv->done); | dv->done); | ||||
| #endif | #endif | ||||