* qatar/master: avcodec: Convert some commented-out printf/av_log instances to av_dlog avcodec: Drop silly and/or broken printf debug output avcodec: Drop some silly commented-out av_log() invocations avformat: Convert some commented-out printf/av_log instances to av_dlog avformat: Remove non-compiling and/or silly commented-out printf/av_log statements Remove some silly disabled code. ac3dec: ensure get_buffer() gets a buffer for the correct number of channels Conflicts: libavcodec/dnxhddec.c libavcodec/ffv1.c libavcodec/h264.c libavcodec/h264_parser.c libavcodec/mjpegdec.c libavcodec/motion_est_template.c libavcodec/mpegaudiodec.c libavcodec/mpegvideo_enc.c libavcodec/put_bits.h libavcodec/ratecontrol.c libavcodec/wmaenc.c libavdevice/timefilter.c libavformat/asfdec.c libavformat/avidec.c libavformat/avienc.c libavformat/flvenc.c libavformat/utils.c
Unified · Split
| @@ -2689,8 +2689,6 @@ static int http_receive_data(HTTPContext *c) · 2688 unmodified lines | |||
| 2689 | /* a packet has been received : write it in the store, except | 2689 | /* a packet has been received : write it in the store, except |
| 2690 | if header */ | 2690 | if header */ |
| 2691 | if (c->data_count > FFM_PACKET_SIZE) { | 2691 | if (c->data_count > FFM_PACKET_SIZE) { |
| 2692 | |||
| 2693 | // printf("writing pos=0x%"PRIx64" size=0x%"PRIx64"\n", feed->feed_write_index, feed->feed_size); | ||
| 2694 | /* XXX: use llseek or url_seek */ | 2692 | /* XXX: use llseek or url_seek */ |
| 2695 | lseek(c->feed_fd, feed->feed_write_index, SEEK_SET); | 2693 | lseek(c->feed_fd, feed->feed_write_index, SEEK_SET); |
| 2696 | if (write(c->feed_fd, c->buffer, FFM_PACKET_SIZE) < 0) { | 2694 | if (write(c->feed_fd, c->buffer, FFM_PACKET_SIZE) < 0) { |
| @@ -585,7 +585,6 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s, · 584 unmodified lines | |||
| 585 | q0 = coef2minsf(q0f); | 585 | q0 = coef2minsf(q0f); |
| 586 | //maximum scalefactor index is when maximum coefficient after quantizing is still not zero | 586 | //maximum scalefactor index is when maximum coefficient after quantizing is still not zero |
| 587 | q1 = coef2maxsf(q1f); | 587 | q1 = coef2maxsf(q1f); |
| 588 | //av_log(NULL, AV_LOG_ERROR, "q0 %d, q1 %d\n", q0, q1); | ||
| 589 | if (q1 - q0 > 60) { | 588 | if (q1 - q0 > 60) { |
| 590 | int q0low = q0; | 589 | int q0low = q0; |
| 591 | int q1high = q1; | 590 | int q1high = q1; |
| @@ -593,7 +592,6 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s, · 1 unmodified line | |||
| 593 | int qnrg = av_clip_uint8(log2f(sqrtf(qnrgf/qcnt))*4 - 31 + SCALE_ONE_POS - SCALE_DIV_512); | 592 | int qnrg = av_clip_uint8(log2f(sqrtf(qnrgf/qcnt))*4 - 31 + SCALE_ONE_POS - SCALE_DIV_512); |
| 594 | q1 = qnrg + 30; | 593 | q1 = qnrg + 30; |
| 595 | q0 = qnrg - 30; | 594 | q0 = qnrg - 30; |
| 596 | //av_log(NULL, AV_LOG_ERROR, "q0 %d, q1 %d\n", q0, q1); | ||
| 597 | if (q0 < q0low) { | 595 | if (q0 < q0low) { |
| 598 | q1 += q0low - q0; | 596 | q1 += q0low - q0; |
| 599 | q0 = q0low; | 597 | q0 = q0low; |
| @@ -602,7 +600,6 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s, · 2 unmodified lines | |||
| 602 | q1 = q1high; | 600 | q1 = q1high; |
| 603 | } | 601 | } |
| 604 | } | 602 | } |
| 605 | //av_log(NULL, AV_LOG_ERROR, "q0 %d, q1 %d\n", q0, q1); | ||
| 606 | 603 | ||
| 607 | for (i = 0; i < TRELLIS_STATES; i++) { | 604 | for (i = 0; i < TRELLIS_STATES; i++) { |
| 608 | paths[0][i].cost = 0.0f; | 605 | paths[0][i].cost = 0.0f; |
| @@ -1377,6 +1377,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, · 1376 unmodified lines | |||
| 1377 | avctx->audio_service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE; | 1377 | avctx->audio_service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE; |
| 1378 | 1378 | ||
| 1379 | /* get output buffer */ | 1379 | /* get output buffer */ |
| 1380 | avctx->channels = s->out_channels; | ||
| 1380 | s->frame.nb_samples = s->num_blocks * 256; | 1381 | s->frame.nb_samples = s->num_blocks * 256; |
| 1381 | if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { | 1382 | if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { |
| 1382 | av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); | 1383 | av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); |
| @@ -353,7 +353,6 @@ static void adpcm_swf_decode(AVCodecContext *avctx, const uint8_t *buf, int buf_ · 352 unmodified lines | |||
| 353 | 353 | ||
| 354 | //read bits & initial values | 354 | //read bits & initial values |
| 355 | nb_bits = get_bits(&gb, 2)+2; | 355 | nb_bits = get_bits(&gb, 2)+2; |
| 356 | //av_log(NULL,AV_LOG_INFO,"nb_bits: %d\n", nb_bits); | ||
| 357 | table = swf_index_tables[nb_bits-2]; | 356 | table = swf_index_tables[nb_bits-2]; |
| 358 | k0 = 1 << (nb_bits-2); | 357 | k0 = 1 << (nb_bits-2); |
| 359 | signmask = 1 << (nb_bits-1); | 358 | signmask = 1 << (nb_bits-1); |
| @@ -420,11 +420,9 @@ static void categorize(COOKContext *q, COOKSubpacket *p, const int *quant_index_ · 419 unmodified lines | |||
| 420 | 420 | ||
| 421 | bits_left = p->bits_per_subpacket - get_bits_count(&q->gb); | 421 | bits_left = p->bits_per_subpacket - get_bits_count(&q->gb); |
| 422 | 422 | ||
| 423 | if (bits_left > q->samples_per_channel) { | 423 | if (bits_left > q->samples_per_channel) |
| 424 | bits_left = q->samples_per_channel + | 424 | bits_left = q->samples_per_channel + |
| 425 | ((bits_left - q->samples_per_channel) * 5) / 8; | 425 | ((bits_left - q->samples_per_channel) * 5) / 8; |
| 426 | //av_log(q->avctx, AV_LOG_ERROR, "bits_left = %d\n",bits_left); | ||
| 427 | } | ||
| 428 | 426 | ||
| 429 | bias = -32; | 427 | bias = -32; |
| 430 | 428 | ||
| @@ -936,10 +934,7 @@ static int decode_subpacket(COOKContext *q, COOKSubpacket *p, · 505 unmodified lines | |||
| 936 | { | 934 | { |
| 937 | int sub_packet_size = p->size; | 935 | int sub_packet_size = p->size; |
| 938 | int res; | 936 | int res; |
| 939 | /* packet dump */ | 937 | |
| 940 | // for (i = 0; i < sub_packet_size ; i++) | ||
| 941 | // av_log(q->avctx, AV_LOG_ERROR, "%02x", inbuffer[i]); | ||
| 942 | // av_log(q->avctx, AV_LOG_ERROR, "\n"); | ||
| 943 | memset(q->decode_buffer_1, 0, sizeof(q->decode_buffer_1)); | 938 | memset(q->decode_buffer_1, 0, sizeof(q->decode_buffer_1)); |
| 944 | decode_bytes_and_gain(q, p, inbuffer, &p->gains1); | 939 | decode_bytes_and_gain(q, p, inbuffer, &p->gains1); |
| 945 | 940 | ||
| @@ -861,8 +861,8 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index) · 860 unmodified lines | |||
| 861 | } | 861 | } |
| 862 | 862 | ||
| 863 | if (s->bitalloc[j][k] > 26) { | 863 | if (s->bitalloc[j][k] > 26) { |
| 864 | // av_log(s->avctx, AV_LOG_DEBUG, "bitalloc index [%i][%i] too big (%i)\n", | 864 | av_dlog(s->avctx, "bitalloc index [%i][%i] too big (%i)\n", |
| 865 | // j, k, s->bitalloc[j][k]); | 865 | j, k, s->bitalloc[j][k]); |
| 866 | return AVERROR_INVALIDDATA; | 866 | return AVERROR_INVALIDDATA; |
| 867 | } | 867 | } |
| 868 | } | 868 | } |
| @@ -223,7 +223,6 @@ static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx, · 222 unmodified lines | |||
| 223 | ctx->last_dc[component] += level; | 223 | ctx->last_dc[component] += level; |
| 224 | } | 224 | } |
| 225 | block[0] = ctx->last_dc[component]; | 225 | block[0] = ctx->last_dc[component]; |
| 226 | //av_log(ctx->avctx, AV_LOG_DEBUG, "dc %d\n", block[0]); | ||
| 227 | 226 | ||
| 228 | i = 0; | 227 | i = 0; |
| 229 | 228 | ||
| @@ -256,14 +255,11 @@ static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx, · 26 unmodified lines | |||
| 256 | } | 255 | } |
| 257 | 256 | ||
| 258 | j = ctx->scantable.permutated[i]; | 257 | j = ctx->scantable.permutated[i]; |
| 259 | //av_log(ctx->avctx, AV_LOG_DEBUG, "j %d\n", j); | ||
| 260 | //av_log(ctx->avctx, AV_LOG_DEBUG, "level %d, weight %d\n", level, weight_matrix[i]); | ||
| 261 | level *= scale[i]; | 258 | level *= scale[i]; |
| 262 | if (level_bias < 32 || weight_matrix[i] != level_bias) | 259 | if (level_bias < 32 || weight_matrix[i] != level_bias) |
| 263 | level += level_bias; | 260 | level += level_bias; |
| 264 | level >>= level_shift; | 261 | level >>= level_shift; |
| 265 | 262 | ||
| 266 | //av_log(NULL, AV_LOG_DEBUG, "i %d, j %d, end level %d\n", i, j, level); | ||
| 267 | block[j] = (level^sign) - sign; | 263 | block[j] = (level^sign) - sign; |
| 268 | 264 | ||
| 269 | UPDATE_CACHE(bs, &ctx->gb); | 265 | UPDATE_CACHE(bs, &ctx->gb); |
| @@ -297,7 +293,6 @@ static int dnxhd_decode_macroblock(DNXHDContext *ctx, int x, int y) · 27 unmodified lines | |||
| 297 | 293 | ||
| 298 | qscale = get_bits(&ctx->gb, 11); | 294 | qscale = get_bits(&ctx->gb, 11); |
| 299 | skip_bits1(&ctx->gb); | 295 | skip_bits1(&ctx->gb); |
| 300 | //av_log(ctx->avctx, AV_LOG_DEBUG, "qscale %d\n", qscale); | ||
| 301 | 296 | ||
| 302 | if (qscale != ctx->last_qscale) { | 297 | if (qscale != ctx->last_qscale) { |
| 303 | for (i = 0; i < 64; i++) { | 298 | for (i = 0; i < 64; i++) { |
| @@ -724,8 +724,6 @@ skip_last_mv: · 723 unmodified lines | |||
| 724 | fixed[mb_xy] = MV_UNCHANGED; | 724 | fixed[mb_xy] = MV_UNCHANGED; |
| 725 | } | 725 | } |
| 726 | } | 726 | } |
| 727 | |||
| 728 | // printf(".%d/%d", changed, score_sum); fflush(stdout); | ||
| 729 | } | 727 | } |
| 730 | 728 | ||
| 731 | if (none_left) | 729 | if (none_left) |
| @@ -736,7 +734,6 @@ skip_last_mv: · 4 unmodified lines | |||
| 736 | if (fixed[mb_xy]) | 734 | if (fixed[mb_xy]) |
| 737 | fixed[mb_xy] = MV_FROZEN; | 735 | fixed[mb_xy] = MV_FROZEN; |
| 738 | } | 736 | } |
| 739 | // printf(":"); fflush(stdout); | ||
| 740 | } | 737 | } |
| 741 | } | 738 | } |
| 742 | 739 | ||
| @@ -405,7 +405,6 @@ static inline void update_vlc_state(VlcState * const state, const int v){ · 404 unmodified lines | |||
| 405 | 405 | ||
| 406 | static inline void put_vlc_symbol(PutBitContext *pb, VlcState * const state, int v, int bits){ | 406 | static inline void put_vlc_symbol(PutBitContext *pb, VlcState * const state, int v, int bits){ |
| 407 | int i, k, code; | 407 | int i, k, code; |
| 408 | //printf("final: %d ", v); | ||
| 409 | v = fold(v - state->bias, bits); | 408 | v = fold(v - state->bias, bits); |
| 410 | 409 | ||
| 411 | i= state->count; | 410 | i= state->count; |
| @@ -424,7 +423,8 @@ static inline void put_vlc_symbol(PutBitContext *pb, VlcState * const state, int · 12 unmodified lines | |||
| 424 | code= v ^ ((2*state->drift + state->count)>>31); | 423 | code= v ^ ((2*state->drift + state->count)>>31); |
| 425 | #endif | 424 | #endif |
| 426 | 425 | ||
| 427 | //printf("v:%d/%d bias:%d error:%d drift:%d count:%d k:%d\n", v, code, state->bias, state->error_sum, state->drift, state->count, k); | 426 | av_dlog(NULL, "v:%d/%d bias:%d error:%d drift:%d count:%d k:%d\n", v, code, |
| 427 | state->bias, state->error_sum, state->drift, state->count, k); | ||
| 428 | set_sr_golomb(pb, code, k, 12, bits); | 428 | set_sr_golomb(pb, code, k, 12, bits); |
| 429 | 429 | ||
| 430 | update_vlc_state(state, v); | 430 | update_vlc_state(state, v); |
| @@ -443,7 +443,8 @@ static inline int get_vlc_symbol(GetBitContext *gb, VlcState * const state, int · 12 unmodified lines | |||
| 443 | assert(k<=8); | 443 | assert(k<=8); |
| 444 | 444 | ||
| 445 | v= get_sr_golomb(gb, k, 12, bits); | 445 | v= get_sr_golomb(gb, k, 12, bits); |
| 446 | //printf("v:%d bias:%d error:%d drift:%d count:%d k:%d", v, state->bias, state->error_sum, state->drift, state->count, k); | 446 | av_dlog(NULL, "v:%d bias:%d error:%d drift:%d count:%d k:%d", |
| 447 | v, state->bias, state->error_sum, state->drift, state->count, k); | ||
| 447 | 448 | ||
| 448 | #if 0 // JPEG LS | 449 | #if 0 // JPEG LS |
| 449 | if(k==0 && 2*state->drift <= - state->count) v ^= (-1); | 450 | if(k==0 && 2*state->drift <= - state->count) v ^= (-1); |
| @@ -454,7 +455,7 @@ static inline int get_vlc_symbol(GetBitContext *gb, VlcState * const state, int · 4 unmodified lines | |||
| 454 | ret= fold(v + state->bias, bits); | 455 | ret= fold(v + state->bias, bits); |
| 455 | 456 | ||
| 456 | update_vlc_state(state, v); | 457 | update_vlc_state(state, v); |
| 457 | //printf("final: %d\n", ret); | 458 | |
| 458 | return ret; | 459 | return ret; |
| 459 | } | 460 | } |
| 460 | 461 | ||
| @@ -523,7 +524,9 @@ static av_always_inline int encode_line(FFV1Context *s, int w, · 62 unmodified lines | |||
| 523 | } | 524 | } |
| 524 | } | 525 | } |
| 525 | 526 | ||
| 526 | // printf("count:%d index:%d, mode:%d, x:%d y:%d pos:%d\n", run_count, run_index, run_mode, x, y, (int)put_bits_count(&s->pb)); | 527 | av_dlog(s->avctx, "count:%d index:%d, mode:%d, x:%d pos:%d\n", |
| 528 | run_count, run_index, run_mode, x, | ||
| 529 | (int)put_bits_count(&s->pb)); | ||
| 527 | 530 | ||
| 528 | if(run_mode == 0) | 531 | if(run_mode == 0) |
| 529 | put_vlc_symbol(&s->pb, &p->vlc_state[context], diff, bits); | 532 | put_vlc_symbol(&s->pb, &p->vlc_state[context], diff, bits); |
| @@ -1488,7 +1491,8 @@ static av_always_inline void decode_line(FFV1Context *s, int w, · 958 unmodified lines | |||
| 1488 | }else | 1491 | }else |
| 1489 | diff= get_vlc_symbol(&s->gb, &p->vlc_state[context], bits); | 1492 | diff= get_vlc_symbol(&s->gb, &p->vlc_state[context], bits); |
| 1490 | 1493 | ||
| 1491 | // printf("count:%d index:%d, mode:%d, x:%d y:%d pos:%d\n", run_count, run_index, run_mode, x, y, get_bits_count(&s->gb)); | 1494 | av_dlog(s->avctx, "count:%d index:%d, mode:%d, x:%d pos:%d\n", |
| 1495 | run_count, run_index, run_mode, x, get_bits_count(&s->gb)); | ||
| 1492 | } | 1496 | } |
| 1493 | 1497 | ||
| 1494 | if(sign) diff= -diff; | 1498 | if(sign) diff= -diff; |
| @@ -1734,8 +1738,6 @@ static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale){ · 239 unmodified lines | |||
| 1734 | while(len--){ | 1738 | while(len--){ |
| 1735 | quant_table[i] = scale*v; | 1739 | quant_table[i] = scale*v; |
| 1736 | i++; | 1740 | i++; |
| 1737 | //printf("%2d ",v); | ||
| 1738 | //if(i%16==0) printf("\n"); | ||
| 1739 | } | 1741 | } |
| 1740 | } | 1742 | } |
| 1741 | 1743 | ||
| @@ -1945,7 +1947,8 @@ static int read_header(FFV1Context *f){ · 203 unmodified lines | |||
| 1945 | return -1; | 1947 | return -1; |
| 1946 | } | 1948 | } |
| 1947 | 1949 | ||
| 1948 | //printf("%d %d %d\n", f->chroma_h_shift, f->chroma_v_shift,f->avctx->pix_fmt); | 1950 | av_dlog(f->avctx, "%d %d %d\n", |
| 1951 | f->chroma_h_shift, f->chroma_v_shift, f->avctx->pix_fmt); | ||
| 1949 | if(f->version < 2){ | 1952 | if(f->version < 2){ |
| 1950 | context_count= read_quant_tables(c, f->quant_table); | 1953 | context_count= read_quant_tables(c, f->quant_table); |
| 1951 | if(context_count < 0){ | 1954 | if(context_count < 0){ |
| @@ -539,7 +539,9 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, · 538 unmodified lines | |||
| 539 | /* For some reason, it seems that non-palettized flics do | 539 | /* For some reason, it seems that non-palettized flics do |
| 540 | * include one of these chunks in their first frame. | 540 | * include one of these chunks in their first frame. |
| 541 | * Why I do not know, it seems rather extraneous. */ | 541 | * Why I do not know, it seems rather extraneous. */ |
| 542 | /* av_log(avctx, AV_LOG_ERROR, "Unexpected Palette chunk %d in non-paletised FLC\n",chunk_type);*/ | 542 | av_dlog(avctx, |
| 543 | "Unexpected Palette chunk %d in non-palettized FLC\n", | ||
| 544 | chunk_type); | ||
| 543 | bytestream2_skip(&g2, chunk_size - 6); | 545 | bytestream2_skip(&g2, chunk_size - 6); |
| 544 | break; | 546 | break; |
| 545 | 547 | ||
| @@ -465,8 +465,6 @@ static inline void set_te_golomb(PutBitContext *pb, int i, int range){ · 464 unmodified lines | |||
| 465 | * write signed exp golomb code. 16 bits at most. | 465 | * write signed exp golomb code. 16 bits at most. |
| 466 | */ | 466 | */ |
| 467 | static inline void set_se_golomb(PutBitContext *pb, int i){ | 467 | static inline void set_se_golomb(PutBitContext *pb, int i){ |
| 468 | // if (i>32767 || i<-32767) | ||
| 469 | // av_log(NULL,AV_LOG_ERROR,"value out of range %d\n", i); | ||
| 470 | #if 0 | 468 | #if 0 |
| 471 | if(i<=0) i= -2*i; | 469 | if(i<=0) i= -2*i; |
| 472 | else i= 2*i-1; | 470 | else i= 2*i-1; |
| @@ -221,7 +221,8 @@ static int decode_slice(MpegEncContext *s){ · 220 unmodified lines | |||
| 221 | s->mv_dir = MV_DIR_FORWARD; | 221 | s->mv_dir = MV_DIR_FORWARD; |
| 222 | s->mv_type = MV_TYPE_16X16; | 222 | s->mv_type = MV_TYPE_16X16; |
| 223 | // s->mb_skipped = 0; | 223 | // s->mb_skipped = 0; |
| 224 | //printf("%d %d %06X\n", ret, get_bits_count(&s->gb), show_bits(&s->gb, 24)); | 224 | av_dlog(s, "%d %d %06X\n", |
| 225 | ret, get_bits_count(&s->gb), show_bits(&s->gb, 24)); | ||
| 225 | ret= s->decode_mb(s, s->block); | 226 | ret= s->decode_mb(s, s->block); |
| 226 | 227 | ||
| 227 | if (s->pict_type!=AV_PICTURE_TYPE_B) | 228 | if (s->pict_type!=AV_PICTURE_TYPE_B) |
| @@ -234,7 +235,6 @@ static int decode_slice(MpegEncContext *s){ · 6 unmodified lines | |||
| 234 | if(s->loop_filter) | 235 | if(s->loop_filter) |
| 235 | ff_h263_loop_filter(s); | 236 | ff_h263_loop_filter(s); |
| 236 | 237 | ||
| 237 | //printf("%d %d %d %06X\n", s->mb_x, s->mb_y, s->gb.size*8 - get_bits_count(&s->gb), show_bits(&s->gb, 24)); | ||
| 238 | ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, ER_MB_END&part_mask); | 238 | ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, ER_MB_END&part_mask); |
| 239 | 239 | ||
| 240 | s->padding_bug_score--; | 240 | s->padding_bug_score--; |
| @@ -538,7 +538,6 @@ retry: · 297 unmodified lines | |||
| 538 | 538 | ||
| 539 | if(s->divx_version>=0) | 539 | if(s->divx_version>=0) |
| 540 | s->workaround_bugs|= FF_BUG_DIRECT_BLOCKSIZE; | 540 | s->workaround_bugs|= FF_BUG_DIRECT_BLOCKSIZE; |
| 541 | //printf("padding_bug_score: %d\n", s->padding_bug_score); | ||
| 542 | if(s->divx_version==501 && s->divx_build==20020416) | 541 | if(s->divx_version==501 && s->divx_build==20020416) |
| 543 | s->padding_bug_score= 256*256*256*64; | 542 | s->padding_bug_score= 256*256*256*64; |
| 544 | 543 | ||
| @@ -254,7 +254,6 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, · 253 unmodified lines | |||
| 254 | } | 254 | } |
| 255 | } | 255 | } |
| 256 | 256 | ||
| 257 | // printf("decoding esc\n"); | ||
| 258 | memcpy(dst, src, i); | 257 | memcpy(dst, src, i); |
| 259 | si = di = i; | 258 | si = di = i; |
| 260 | while (si + 2 < length) { | 259 | while (si + 2 < length) { |
| @@ -2135,7 +2134,6 @@ static int init_poc(H264Context *h) · 1874 unmodified lines | |||
| 2135 | h->poc_msb = h->prev_poc_msb - max_poc_lsb; | 2134 | h->poc_msb = h->prev_poc_msb - max_poc_lsb; |
| 2136 | else | 2135 | else |
| 2137 | h->poc_msb = h->prev_poc_msb; | 2136 | h->poc_msb = h->prev_poc_msb; |
| 2138 | // printf("poc: %d %d\n", h->poc_msb, h->poc_lsb); | ||
| 2139 | field_poc[0] = | 2137 | field_poc[0] = |
| 2140 | field_poc[1] = h->poc_msb + h->poc_lsb; | 2138 | field_poc[1] = h->poc_msb + h->poc_lsb; |
| 2141 | if (s->picture_structure == PICT_FRAME) | 2139 | if (s->picture_structure == PICT_FRAME) |
| @@ -4149,7 +4147,6 @@ not_extra: · 2007 unmodified lines | |||
| 4149 | 4147 | ||
| 4150 | assert(pict->data[0] || !*data_size); | 4148 | assert(pict->data[0] || !*data_size); |
| 4151 | ff_print_debug_info(s, pict); | 4149 | ff_print_debug_info(s, pict); |
| 4152 | // printf("out %d\n", (int)pict->data[0]); | ||
| 4153 | 4150 | ||
| 4154 | return get_consumed_bytes(s, buf_index, buf_size); | 4151 | return get_consumed_bytes(s, buf_index, buf_size); |
| 4155 | } | 4152 | } |
| @@ -1814,7 +1814,6 @@ static av_always_inline void decode_cabac_luma_residual( H264Context *h, const u · 1813 unmodified lines | |||
| 1814 | MpegEncContext * const s = &h->s; | 1814 | MpegEncContext * const s = &h->s; |
| 1815 | int qscale = p == 0 ? s->qscale : h->chroma_qp[p-1]; | 1815 | int qscale = p == 0 ? s->qscale : h->chroma_qp[p-1]; |
| 1816 | if( IS_INTRA16x16( mb_type ) ) { | 1816 | if( IS_INTRA16x16( mb_type ) ) { |
| 1817 | //av_log( s->avctx, AV_LOG_ERROR, "INTRA16x16 DC\n" ); | ||
| 1818 | AV_ZERO128(h->mb_luma_dc[p]+0); | 1817 | AV_ZERO128(h->mb_luma_dc[p]+0); |
| 1819 | AV_ZERO128(h->mb_luma_dc[p]+8); | 1818 | AV_ZERO128(h->mb_luma_dc[p]+8); |
| 1820 | AV_ZERO128(h->mb_luma_dc[p]+16); | 1819 | AV_ZERO128(h->mb_luma_dc[p]+16); |
| @@ -1825,7 +1824,6 @@ static av_always_inline void decode_cabac_luma_residual( H264Context *h, const u · 4 unmodified lines | |||
| 1825 | qmul = h->dequant4_coeff[p][qscale]; | 1824 | qmul = h->dequant4_coeff[p][qscale]; |
| 1826 | for( i4x4 = 0; i4x4 < 16; i4x4++ ) { | 1825 | for( i4x4 = 0; i4x4 < 16; i4x4++ ) { |
| 1827 | const int index = 16*p + i4x4; | 1826 | const int index = 16*p + i4x4; |
| 1828 | //av_log( s->avctx, AV_LOG_ERROR, "INTRA16x16 AC:%d\n", index ); | ||
| 1829 | decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), ctx_cat[1][p], index, scan + 1, qmul, 15); | 1827 | decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), ctx_cat[1][p], index, scan + 1, qmul, 15); |
| 1830 | } | 1828 | } |
| 1831 | } else { | 1829 | } else { |
| @@ -1843,7 +1841,6 @@ static av_always_inline void decode_cabac_luma_residual( H264Context *h, const u · 11 unmodified lines | |||
| 1843 | qmul = h->dequant4_coeff[cqm][qscale]; | 1841 | qmul = h->dequant4_coeff[cqm][qscale]; |
| 1844 | for( i4x4 = 0; i4x4 < 4; i4x4++ ) { | 1842 | for( i4x4 = 0; i4x4 < 4; i4x4++ ) { |
| 1845 | const int index = 16*p + 4*i8x8 + i4x4; | 1843 | const int index = 16*p + 4*i8x8 + i4x4; |
| 1846 | //av_log( s->avctx, AV_LOG_ERROR, "Luma4x4: %d\n", index ); | ||
| 1847 | //START_TIMER | 1844 | //START_TIMER |
| 1848 | decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), ctx_cat[2][p], index, scan, qmul, 16); | 1845 | decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), ctx_cat[2][p], index, scan, qmul, 16); |
| 1849 | //STOP_TIMER("decode_residual") | 1846 | //STOP_TIMER("decode_residual") |
| @@ -2029,7 +2026,8 @@ decode_intra_mb: · 179 unmodified lines | |||
| 2029 | int pred = pred_intra_mode( h, i ); | 2026 | int pred = pred_intra_mode( h, i ); |
| 2030 | h->intra4x4_pred_mode_cache[ scan8[i] ] = decode_cabac_mb_intra4x4_pred_mode( h, pred ); | 2027 | h->intra4x4_pred_mode_cache[ scan8[i] ] = decode_cabac_mb_intra4x4_pred_mode( h, pred ); |
| 2031 | 2028 | ||
| 2032 | //av_log( s->avctx, AV_LOG_ERROR, "i4x4 pred=%d mode=%d\n", pred, h->intra4x4_pred_mode_cache[ scan8[i] ] ); | 2029 | av_dlog(s->avctx, "i4x4 pred=%d mode=%d\n", pred, |
| 2030 | h->intra4x4_pred_mode_cache[scan8[i]]); | ||
| 2033 | } | 2031 | } |
| 2034 | } | 2032 | } |
| 2035 | write_back_intra_pred_mode(h); | 2033 | write_back_intra_pred_mode(h); |
| @@ -2350,12 +2348,10 @@ decode_intra_mb: · 314 unmodified lines | |||
| 2350 | } else if (CHROMA422) { | 2348 | } else if (CHROMA422) { |
| 2351 | if( cbp&0x30 ){ | 2349 | if( cbp&0x30 ){ |
| 2352 | int c; | 2350 | int c; |
| 2353 | for( c = 0; c < 2; c++ ) { | 2351 | for (c = 0; c < 2; c++) |
| 2354 | //av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-DC\n",c ); | ||
| 2355 | decode_cabac_residual_dc_422(h, h->mb + ((256 + 16*16*c) << pixel_shift), 3, | 2352 | decode_cabac_residual_dc_422(h, h->mb + ((256 + 16*16*c) << pixel_shift), 3, |
| 2356 | CHROMA_DC_BLOCK_INDEX + c, | 2353 | CHROMA_DC_BLOCK_INDEX + c, |
| 2357 | chroma422_dc_scan, 8); | 2354 | chroma422_dc_scan, 8); |
| 2358 | } | ||
| 2359 | } | 2355 | } |
| 2360 | 2356 | ||
| 2361 | if( cbp&0x20 ) { | 2357 | if( cbp&0x20 ) { |
| @@ -2366,7 +2362,6 @@ decode_intra_mb: · 4 unmodified lines | |||
| 2366 | for (i8x8 = 0; i8x8 < 2; i8x8++) { | 2362 | for (i8x8 = 0; i8x8 < 2; i8x8++) { |
| 2367 | for (i = 0; i < 4; i++) { | 2363 | for (i = 0; i < 4; i++) { |
| 2368 | const int index = 16 + 16 * c + 8*i8x8 + i; | 2364 | const int index = 16 + 16 * c + 8*i8x8 + i; |
| 2369 | //av_log(s->avctx, AV_LOG_ERROR, "INTRA C%d-AC %d\n",c, index - 16); | ||
| 2370 | decode_cabac_residual_nondc(h, mb, 4, index, scan + 1, qmul, 15); | 2365 | decode_cabac_residual_nondc(h, mb, 4, index, scan + 1, qmul, 15); |
| 2371 | mb += 16<<pixel_shift; | 2366 | mb += 16<<pixel_shift; |
| 2372 | } | 2367 | } |
| @@ -2379,10 +2374,8 @@ decode_intra_mb: · 6 unmodified lines | |||
| 2379 | } else /* yuv420 */ { | 2374 | } else /* yuv420 */ { |
| 2380 | if( cbp&0x30 ){ | 2375 | if( cbp&0x30 ){ |
| 2381 | int c; | 2376 | int c; |
| 2382 | for( c = 0; c < 2; c++ ) { | 2377 | for (c = 0; c < 2; c++) |
| 2383 | //av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-DC\n",c ); | ||
| 2384 | decode_cabac_residual_dc(h, h->mb + ((256 + 16*16*c) << pixel_shift), 3, CHROMA_DC_BLOCK_INDEX+c, chroma_dc_scan, 4); | 2378 | decode_cabac_residual_dc(h, h->mb + ((256 + 16*16*c) << pixel_shift), 3, CHROMA_DC_BLOCK_INDEX+c, chroma_dc_scan, 4); |
| 2385 | } | ||
| 2386 | } | 2379 | } |
| 2387 | 2380 | ||
| 2388 | if( cbp&0x20 ) { | 2381 | if( cbp&0x20 ) { |
| @@ -2391,7 +2384,6 @@ decode_intra_mb: · 2 unmodified lines | |||
| 2391 | qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[c]]; | 2384 | qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[c]]; |
| 2392 | for( i = 0; i < 4; i++ ) { | 2385 | for( i = 0; i < 4; i++ ) { |
| 2393 | const int index = 16 + 16 * c + i; | 2386 | const int index = 16 + 16 * c + i; |
| 2394 | //av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-AC %d\n",c, index - 16 ); | ||
| 2395 | decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), 4, index, scan + 1, qmul, 15); | 2387 | decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), 4, index, scan + 1, qmul, 15); |
| 2396 | } | 2388 | } |
| 2397 | } | 2389 | } |
| @@ -39,7 +39,6 @@ static int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_si · 38 unmodified lines | |||
| 39 | ParseContext *pc = &(h->s.parse_context); | 39 | ParseContext *pc = &(h->s.parse_context); |
| 40 | int next_avc= h->is_avc ? 0 : buf_size; | 40 | int next_avc= h->is_avc ? 0 : buf_size; |
| 41 | 41 | ||
| 42 | //printf("first %02X%02X%02X%02X\n", buf[0], buf[1],buf[2],buf[3]); | ||
| 43 | // mb_addr= pc->mb_addr - 1; | 42 | // mb_addr= pc->mb_addr - 1; |
| 44 | state= pc->state; | 43 | state= pc->state; |
| 45 | if(state>13) | 44 | if(state>13) |
| @@ -743,7 +743,7 @@ static int imc_get_coeffs(IMCContext *q, IMCChannel *chctx) · 742 unmodified lines | |||
| 743 | cw = 0; | 743 | cw = 0; |
| 744 | 744 | ||
| 745 | if (get_bits_count(&q->gb) + cw_len > 512) { | 745 | if (get_bits_count(&q->gb) + cw_len > 512) { |
| 746 | // av_log(NULL, 0, "Band %i coeff %i cw_len %i\n", i, j, cw_len); | 746 | av_dlog(NULL, "Band %i coeff %i cw_len %i\n", i, j, cw_len); |
| 747 | return AVERROR_INVALIDDATA; | 747 | return AVERROR_INVALIDDATA; |
| 748 | } | 748 | } |
| 749 | 749 | ||
| @@ -782,8 +782,6 @@ static int imc_decode_block(AVCodecContext *avctx, IMCContext *q, int ch) · 32 unmodified lines | |||
| 782 | return AVERROR_PATCHWELCOME; | 782 | return AVERROR_PATCHWELCOME; |
| 783 | } | 783 | } |
| 784 | 784 | ||
| 785 | // av_log(avctx, AV_LOG_DEBUG, "stream_format_code = %d\n", stream_format_code); | ||
| 786 | |||
| 787 | if (stream_format_code & 0x04) | 785 | if (stream_format_code & 0x04) |
| 788 | chctx->decoder_reset = 1; | 786 | chctx->decoder_reset = 1; |
| 789 | 787 | ||
| @@ -83,5 +83,5 @@ void ff_jpegls_reset_coding_parameters(JLSState *s, int reset_all){ · 82 unmodified lines | |||
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | if(s->reset==0 || reset_all) s->reset= 64; | 85 | if(s->reset==0 || reset_all) s->reset= 64; |
| 86 | // av_log(NULL, AV_LOG_DEBUG, "[JPEG-LS RESET] T=%i,%i,%i\n", s->T1, s->T2, s->T3); | 86 | av_dlog(NULL, "[JPEG-LS RESET] T=%i,%i,%i\n", s->T1, s->T2, s->T3); |
| 87 | } | 87 | } |
| @@ -78,7 +78,7 @@ int ff_jpegls_decode_lse(MJpegDecodeContext *s) · 77 unmodified lines | |||
| 78 | av_log(s->avctx, AV_LOG_ERROR, "invalid id %d\n", id); | 78 | av_log(s->avctx, AV_LOG_ERROR, "invalid id %d\n", id); |
| 79 | return -1; | 79 | return -1; |
| 80 | } | 80 | } |
| 81 | // av_log(s->avctx, AV_LOG_DEBUG, "ID=%i, T=%i,%i,%i\n", id, s->t1, s->t2, s->t3); | 81 | av_dlog(s->avctx, "ID=%i, T=%i,%i,%i\n", id, s->t1, s->t2, s->t3); |
| 82 | 82 | ||
| 83 | return 0; | 83 | return 0; |
| 84 | } | 84 | } |
| @@ -285,8 +285,12 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor · 200 unmodified lines | |||
| 285 | else | 285 | else |
| 286 | shift = point_transform + (16 - s->bits); | 286 | shift = point_transform + (16 - s->bits); |
| 287 | 287 | ||
| 288 | // av_log(s->avctx, AV_LOG_DEBUG, "JPEG-LS params: %ix%i NEAR=%i MV=%i T(%i,%i,%i) RESET=%i, LIMIT=%i, qbpp=%i, RANGE=%i\n",s->width,s->height,state->near,state->maxval,state->T1,state->T2,state->T3,state->reset,state->limit,state->qbpp, state->range); | 288 | av_dlog(s->avctx, "JPEG-LS params: %ix%i NEAR=%i MV=%i T(%i,%i,%i) RESET=%i, LIMIT=%i, qbpp=%i, RANGE=%i\n", |
| 289 | // av_log(s->avctx, AV_LOG_DEBUG, "JPEG params: ILV=%i Pt=%i BPP=%i, scan = %i\n", ilv, point_transform, s->bits, s->cur_scan); | 289 | s->width, s->height, state->near, state->maxval, |
| 290 | state->T1, state->T2, state->T3, | ||
| 291 | state->reset, state->limit, state->qbpp, state->range); | ||
| 292 | av_dlog(s->avctx, "JPEG params: ILV=%i Pt=%i BPP=%i, scan = %i\n", | ||
| 293 | ilv, point_transform, s->bits, s->cur_scan); | ||
| 290 | if(ilv == 0) { /* separate planes */ | 294 | if(ilv == 0) { /* separate planes */ |
| 291 | stride = (s->nb_components > 1) ? 3 : 1; | 295 | stride = (s->nb_components > 1) ? 3 : 1; |
| 292 | off = av_clip(s->cur_scan - 1, 0, stride); | 296 | off = av_clip(s->cur_scan - 1, 0, stride); |
| @@ -180,7 +180,6 @@ static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt, · 179 unmodified lines | |||
| 180 | int pred; | 180 | int pred; |
| 181 | 181 | ||
| 182 | ptr = p->data[i] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap | 182 | ptr = p->data[i] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap |
| 183 | //printf("%d %d %d %d %8X\n", mb_x, mb_y, x, y, ptr); | ||
| 184 | PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor); | 183 | PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor); |
| 185 | 184 | ||
| 186 | if(i==0) | 185 | if(i==0) |
| @@ -436,9 +436,9 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) · 435 unmodified lines | |||
| 436 | for (i = 0; i < 3; i++) | 436 | for (i = 0; i < 3; i++) |
| 437 | s->linesize[i] = s->picture_ptr->linesize[i] << s->interlaced; | 437 | s->linesize[i] = s->picture_ptr->linesize[i] << s->interlaced; |
| 438 | 438 | ||
| 439 | // printf("%d %d %d %d %d %d\n", | 439 | av_dlog(s->avctx, "%d %d %d %d %d %d\n", |
| 440 | // s->width, s->height, s->linesize[0], s->linesize[1], | 440 | s->width, s->height, s->linesize[0], s->linesize[1], |
| 441 | // s->interlaced, s->avctx->height); | 441 | s->interlaced, s->avctx->height); |
| 442 | 442 | ||
| 443 | if (len != (8 + (3 * nb_components))) | 443 | if (len != (8 + (3 * nb_components))) |
| 444 | av_log(s->avctx, AV_LOG_DEBUG, "decode_sof0: error, len(%d) mismatch\n", len); | 444 | av_log(s->avctx, AV_LOG_DEBUG, "decode_sof0: error, len(%d) mismatch\n", len); |
| @@ -1047,11 +1047,10 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, · 602 unmodified lines | |||
| 1047 | return AVERROR_INVALIDDATA; | 1047 | return AVERROR_INVALIDDATA; |
| 1048 | } | 1048 | } |
| 1049 | } | 1049 | } |
| 1050 | // av_log(s->avctx, AV_LOG_DEBUG, "mb: %d %d processed\n", | 1050 | av_dlog(s->avctx, "mb: %d %d processed\n", mb_y, mb_x); |
| 1051 | // mb_y, mb_x); | 1051 | av_dlog(s->avctx, "%d %d %d %d %d %d %d %d \n", |
| 1052 | // av_log(NULL, AV_LOG_DEBUG, "%d %d %d %d %d %d %d %d \n", | 1052 | mb_x, mb_y, x, y, c, s->bottom_field, |
| 1053 | // mb_x, mb_y, x, y, c, s->bottom_field, | 1053 | (v * mb_y + y) * 8, (h * mb_x + x) * 8); |
| 1054 | // (v * mb_y + y) * 8, (h * mb_x + x) * 8); | ||
| 1055 | if (++x == h) { | 1054 | if (++x == h) { |
| 1056 | x = 0; | 1055 | x = 0; |
| 1057 | y++; | 1056 | y++; |
| @@ -1331,8 +1330,6 @@ static int mjpeg_decode_app(MJpegDecodeContext *s) · 273 unmodified lines | |||
| 1331 | 4bytes field_size_less_padding | 1330 | 4bytes field_size_less_padding |
| 1332 | */ | 1331 | */ |
| 1333 | s->buggy_avid = 1; | 1332 | s->buggy_avid = 1; |
| 1334 | // if (s->first_picture) | ||
| 1335 | // printf("mjpeg: workarounding buggy AVID\n"); | ||
| 1336 | i = get_bits(&s->gb, 8); len--; | 1333 | i = get_bits(&s->gb, 8); len--; |
| 1337 | av_log(s->avctx, AV_LOG_DEBUG, "polarity %d\n", i); | 1334 | av_log(s->avctx, AV_LOG_DEBUG, "polarity %d\n", i); |
| 1338 | #if 0 | 1335 | #if 0 |
| @@ -1341,8 +1338,6 @@ static int mjpeg_decode_app(MJpegDecodeContext *s) · 2 unmodified lines | |||
| 1341 | skip_bits(&s->gb, 32); | 1338 | skip_bits(&s->gb, 32); |
| 1342 | len -= 10; | 1339 | len -= 10; |
| 1343 | #endif | 1340 | #endif |
| 1344 | // if (s->interlace_polarity) | ||
| 1345 | // printf("mjpeg: interlace polarity: %d\n", s->interlace_polarity); | ||
| 1346 | goto out; | 1341 | goto out; |
| 1347 | } | 1342 | } |
| 1348 | 1343 | ||
| @@ -1464,8 +1459,6 @@ static int mjpeg_decode_com(MJpegDecodeContext *s) · 115 unmodified lines | |||
| 1464 | /* buggy avid, it puts EOI only at every 10th frame */ | 1459 | /* buggy avid, it puts EOI only at every 10th frame */ |
| 1465 | if (!strcmp(cbuf, "AVID")) { | 1460 | if (!strcmp(cbuf, "AVID")) { |
| 1466 | s->buggy_avid = 1; | 1461 | s->buggy_avid = 1; |
| 1467 | // if (s->first_picture) | ||
| 1468 | // printf("mjpeg: workarounding buggy AVID\n"); | ||
| 1469 | } else if (!strcmp(cbuf, "CS=ITU601")) | 1462 | } else if (!strcmp(cbuf, "CS=ITU601")) |
| 1470 | s->cs_itu601 = 1; | 1463 | s->cs_itu601 = 1; |
| 1471 | else if ((len > 31 && !strncmp(cbuf, "Intel(R) JPEG Library, version 1", 32)) || | 1464 | else if ((len > 31 && !strncmp(cbuf, "Intel(R) JPEG Library, version 1", 32)) || |
| @@ -1741,9 +1734,6 @@ eoi_parser: · 269 unmodified lines | |||
| 1741 | av_log(avctx, AV_LOG_ERROR, | 1734 | av_log(avctx, AV_LOG_ERROR, |
| 1742 | "mjpeg: unsupported coding type (%x)\n", start_code); | 1735 | "mjpeg: unsupported coding type (%x)\n", start_code); |
| 1743 | break; | 1736 | break; |
| 1744 | // default: | ||
| 1745 | // printf("mjpeg: unsupported marker (%x)\n", start_code); | ||
| 1746 | // break; | ||
| 1747 | } | 1737 | } |
| 1748 | 1738 | ||
| 1749 | /* eof process start code */ | 1739 | /* eof process start code */ |
| @@ -339,7 +339,6 @@ static void escape_FF(MpegEncContext *s, int start) · 338 unmodified lines | |||
| 339 | int v= buf[i]; | 339 | int v= buf[i]; |
| 340 | 340 | ||
| 341 | if(v==0xFF){ | 341 | if(v==0xFF){ |
| 342 | //printf("%d %d\n", i, ff_count); | ||
| 343 | buf[i+ff_count]= 0; | 342 | buf[i+ff_count]= 0; |
| 344 | ff_count--; | 343 | ff_count--; |
| 345 | } | 344 | } |
| @@ -395,12 +395,10 @@ static int sad_hpel_motion_search(MpegEncContext * s, · 394 unmodified lines | |||
| 395 | assert(flags == 0); | 395 | assert(flags == 0); |
| 396 | 396 | ||
| 397 | if(c->skip){ | 397 | if(c->skip){ |
| 398 | // printf("S"); | ||
| 399 | *mx_ptr = 0; | 398 | *mx_ptr = 0; |
| 400 | *my_ptr = 0; | 399 | *my_ptr = 0; |
| 401 | return dmin; | 400 | return dmin; |
| 402 | } | 401 | } |
| 403 | // printf("N"); | ||
| 404 | 402 | ||
| 405 | pix = c->src[src_index][0]; | 403 | pix = c->src[src_index][0]; |
| 406 | 404 | ||
| @@ -1325,7 +1323,6 @@ static int ff_estimate_motion_b(MpegEncContext * s, · 918 unmodified lines | |||
| 1325 | if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip) | 1323 | if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip) |
| 1326 | dmin= get_mb_score(s, mx, my, 0, ref_index, 0, 16, 1); | 1324 | dmin= get_mb_score(s, mx, my, 0, ref_index, 0, 16, 1); |
| 1327 | 1325 | ||
| 1328 | //printf("%d %d %d %d//", s->mb_x, s->mb_y, mx, my); | ||
| 1329 | // s->mb_type[mb_y*s->mb_width + mb_x]= mb_type; | 1326 | // s->mb_type[mb_y*s->mb_width + mb_x]= mb_type; |
| 1330 | mv_table[mot_xy][0]= mx; | 1327 | mv_table[mot_xy][0]= mx; |
| 1331 | mv_table[mot_xy][1]= my; | 1328 | mv_table[mot_xy][1]= my; |
| @@ -1734,11 +1731,11 @@ void ff_estimate_b_frame_motion(MpegEncContext * s, · 402 unmodified lines | |||
| 1734 | 1731 | ||
| 1735 | c->skip=0; | 1732 | c->skip=0; |
| 1736 | bmin= ff_estimate_motion_b(s, mb_x, mb_y, s->b_back_mv_table, 2, s->b_code) + 2*penalty_factor; | 1733 | bmin= ff_estimate_motion_b(s, mb_x, mb_y, s->b_back_mv_table, 2, s->b_code) + 2*penalty_factor; |
| 1737 | //printf(" %d %d ", s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1]); | 1734 | av_dlog(s, " %d %d ", s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1]); |
| 1738 | 1735 | ||
| 1739 | c->skip=0; | 1736 | c->skip=0; |
| 1740 | fbmin= bidir_refine(s, mb_x, mb_y) + penalty_factor; | 1737 | fbmin= bidir_refine(s, mb_x, mb_y) + penalty_factor; |
| 1741 | //printf("%d %d %d %d\n", dmin, fmin, bmin, fbmin); | 1738 | av_dlog(s, "%d %d %d %d\n", dmin, fmin, bmin, fbmin); |
| 1742 | 1739 | ||
| 1743 | if(s->flags & CODEC_FLAG_INTERLACED_ME){ | 1740 | if(s->flags & CODEC_FLAG_INTERLACED_ME){ |
| 1744 | //FIXME mb type penalty | 1741 | //FIXME mb type penalty |
| @@ -1848,15 +1845,9 @@ int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type) · 103 unmodified lines | |||
| 1848 | best_score= score[i]; | 1845 | best_score= score[i]; |
| 1849 | best_fcode= i; | 1846 | best_fcode= i; |
| 1850 | } | 1847 | } |
| 1851 | // printf("%d %d\n", i, score[i]); | ||
| 1852 | } | 1848 | } |
| 1853 | 1849 | ||
| 1854 | // printf("fcode: %d type: %d\n", i, s->pict_type); | ||
| 1855 | return best_fcode; | 1850 | return best_fcode; |
| 1856 | /* for(i=0; i<=MAX_FCODE; i++){ | ||
| 1857 | printf("%d ", mv_num[i]); | ||
| 1858 | } | ||
| 1859 | printf("\n");*/ | ||
| 1860 | }else{ | 1851 | }else{ |
| 1861 | return 1; | 1852 | return 1; |
| 1862 | } | 1853 | } |
| @@ -1876,7 +1867,6 @@ void ff_fix_long_p_mvs(MpegEncContext * s) · 13 unmodified lines | |||
| 1876 | 1867 | ||
| 1877 | if(c->avctx->me_range && range > c->avctx->me_range) range= c->avctx->me_range; | 1868 | if(c->avctx->me_range && range > c->avctx->me_range) range= c->avctx->me_range; |
| 1878 | 1869 | ||
| 1879 | //printf("%d no:%d %d//\n", clip, noclip, f_code); | ||
| 1880 | if(s->flags&CODEC_FLAG_4MV){ | 1870 | if(s->flags&CODEC_FLAG_4MV){ |
| 1881 | const int wrap= s->b8_stride; | 1871 | const int wrap= s->b8_stride; |
| 1882 | 1872 | ||
| @@ -363,13 +363,11 @@ static int qpel_motion_search(MpegEncContext * s, · 362 unmodified lines | |||
| 363 | av_assert2((x) <= xmax);\ | 363 | av_assert2((x) <= xmax);\ |
| 364 | av_assert2((y) >= ymin);\ | 364 | av_assert2((y) >= ymin);\ |
| 365 | av_assert2((y) <= ymax);\ | 365 | av_assert2((y) <= ymax);\ |
| 366 | /*printf("check_mv %d %d\n", x, y);*/\ | ||
| 367 | if(map[index]!=key){\ | 366 | if(map[index]!=key){\ |
| 368 | d= cmp(s, x, y, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);\ | 367 | d= cmp(s, x, y, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);\ |
| 369 | map[index]= key;\ | 368 | map[index]= key;\ |
| 370 | score_map[index]= d;\ | 369 | score_map[index]= d;\ |
| 371 | d += (mv_penalty[((x)<<shift)-pred_x] + mv_penalty[((y)<<shift)-pred_y])*penalty_factor;\ | 370 | d += (mv_penalty[((x)<<shift)-pred_x] + mv_penalty[((y)<<shift)-pred_y])*penalty_factor;\ |
| 372 | /*printf("score:%d\n", d);*/\ | ||
| 373 | COPY3_IF_LT(dmin, d, best[0], x, best[1], y)\ | 371 | COPY3_IF_LT(dmin, d, best[0], x, best[1], y)\ |
| 374 | }\ | 372 | }\ |
| 375 | } | 373 | } |
| @@ -387,13 +385,11 @@ static int qpel_motion_search(MpegEncContext * s, · 11 unmodified lines | |||
| 387 | {\ | 385 | {\ |
| 388 | const unsigned key = ((y)<<ME_MAP_MV_BITS) + (x) + map_generation;\ | 386 | const unsigned key = ((y)<<ME_MAP_MV_BITS) + (x) + map_generation;\ |
| 389 | const int index= (((y)<<ME_MAP_SHIFT) + (x))&(ME_MAP_SIZE-1);\ | 387 | const int index= (((y)<<ME_MAP_SHIFT) + (x))&(ME_MAP_SIZE-1);\ |
| 390 | /*printf("check_mv_dir %d %d %d\n", x, y, new_dir);*/\ | ||
| 391 | if(map[index]!=key){\ | 388 | if(map[index]!=key){\ |
| 392 | d= cmp(s, x, y, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);\ | 389 | d= cmp(s, x, y, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);\ |
| 393 | map[index]= key;\ | 390 | map[index]= key;\ |
| 394 | score_map[index]= d;\ | 391 | score_map[index]= d;\ |
| 395 | d += (mv_penalty[((x)<<shift)-pred_x] + mv_penalty[((y)<<shift)-pred_y])*penalty_factor;\ | 392 | d += (mv_penalty[((x)<<shift)-pred_x] + mv_penalty[((y)<<shift)-pred_y])*penalty_factor;\ |
| 396 | /*printf("score:%d\n", d);*/\ | ||
| 397 | if(d<dmin){\ | 393 | if(d<dmin){\ |
| 398 | best[0]=x;\ | 394 | best[0]=x;\ |
| 399 | best[1]=y;\ | 395 | best[1]=y;\ |
| @@ -444,7 +440,6 @@ static av_always_inline int small_diamond_search(MpegEncContext * s, int *best, · 44 unmodified lines | |||
| 444 | const int y= best[1]; | 440 | const int y= best[1]; |
| 445 | next_dir=-1; | 441 | next_dir=-1; |
| 446 | 442 | ||
| 447 | //printf("%d", dir); | ||
| 448 | if(dir!=2 && x>xmin) CHECK_MV_DIR(x-1, y , 0) | 443 | if(dir!=2 && x>xmin) CHECK_MV_DIR(x-1, y , 0) |
| 449 | if(dir!=3 && y>ymin) CHECK_MV_DIR(x , y-1, 1) | 444 | if(dir!=3 && y>ymin) CHECK_MV_DIR(x , y-1, 1) |
| 450 | if(dir!=0 && x<xmax) CHECK_MV_DIR(x+1, y , 2) | 445 | if(dir!=0 && x<xmax) CHECK_MV_DIR(x+1, y , 2) |
| @@ -656,13 +651,11 @@ static int full_search(MpegEncContext * s, int *best, int dmin, · 205 unmodified lines | |||
| 656 | {\ | 651 | {\ |
| 657 | const unsigned key = ((ay)<<ME_MAP_MV_BITS) + (ax) + map_generation;\ | 652 | const unsigned key = ((ay)<<ME_MAP_MV_BITS) + (ax) + map_generation;\ |
| 658 | const int index= (((ay)<<ME_MAP_SHIFT) + (ax))&(ME_MAP_SIZE-1);\ | 653 | const int index= (((ay)<<ME_MAP_SHIFT) + (ax))&(ME_MAP_SIZE-1);\ |
| 659 | /*printf("sab check %d %d\n", ax, ay);*/\ | ||
| 660 | if(map[index]!=key){\ | 654 | if(map[index]!=key){\ |
| 661 | d= cmp(s, ax, ay, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);\ | 655 | d= cmp(s, ax, ay, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);\ |
| 662 | map[index]= key;\ | 656 | map[index]= key;\ |
| 663 | score_map[index]= d;\ | 657 | score_map[index]= d;\ |
| 664 | d += (mv_penalty[((ax)<<shift)-pred_x] + mv_penalty[((ay)<<shift)-pred_y])*penalty_factor;\ | 658 | d += (mv_penalty[((ax)<<shift)-pred_x] + mv_penalty[((ay)<<shift)-pred_y])*penalty_factor;\ |
| 665 | /*printf("score: %d\n", d);*/\ | ||
| 666 | if(d < minima[minima_count-1].height){\ | 659 | if(d < minima[minima_count-1].height){\ |
| 667 | int j=0;\ | 660 | int j=0;\ |
| 668 | \ | 661 | \ |
| @@ -970,7 +963,6 @@ static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int · 301 unmodified lines | |||
| 970 | *mx_ptr= best[0]; | 963 | *mx_ptr= best[0]; |
| 971 | *my_ptr= best[1]; | 964 | *my_ptr= best[1]; |
| 972 | 965 | ||
| 973 | // printf("%d %d %d \n", best[0], best[1], dmin); | ||
| 974 | return dmin; | 966 | return dmin; |
| 975 | } | 967 | } |
| 976 | 968 | ||
| @@ -1016,7 +1008,7 @@ static int epzs_motion_search4(MpegEncContext * s, · 39 unmodified lines | |||
| 1016 | map_generation= update_map_generation(c); | 1008 | map_generation= update_map_generation(c); |
| 1017 | 1009 | ||
| 1018 | dmin = 1000000; | 1010 | dmin = 1000000; |
| 1019 | //printf("%d %d %d %d //",xmin, ymin, xmax, ymax); | 1011 | |
| 1020 | /* first line */ | 1012 | /* first line */ |
| 1021 | if (s->first_slice_line) { | 1013 | if (s->first_slice_line) { |
| 1022 | CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) | 1014 | CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) |
| @@ -1046,7 +1038,6 @@ static int epzs_motion_search4(MpegEncContext * s, · 23 unmodified lines | |||
| 1046 | *mx_ptr= best[0]; | 1038 | *mx_ptr= best[0]; |
| 1047 | *my_ptr= best[1]; | 1039 | *my_ptr= best[1]; |
| 1048 | 1040 | ||
| 1049 | // printf("%d %d %d \n", best[0], best[1], dmin); | ||
| 1050 | return dmin; | 1041 | return dmin; |
| 1051 | } | 1042 | } |
| 1052 | 1043 | ||
| @@ -1076,7 +1067,7 @@ static int epzs_motion_search2(MpegEncContext * s, · 23 unmodified lines | |||
| 1076 | map_generation= update_map_generation(c); | 1067 | map_generation= update_map_generation(c); |
| 1077 | 1068 | ||
| 1078 | dmin = 1000000; | 1069 | dmin = 1000000; |
| 1079 | //printf("%d %d %d %d //",xmin, ymin, xmax, ymax); | 1070 | |
| 1080 | /* first line */ | 1071 | /* first line */ |
| 1081 | if (s->first_slice_line) { | 1072 | if (s->first_slice_line) { |
| 1082 | CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) | 1073 | CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) |
| @@ -1106,6 +1097,5 @@ static int epzs_motion_search2(MpegEncContext * s, · 23 unmodified lines | |||
| 1106 | *mx_ptr= best[0]; | 1097 | *mx_ptr= best[0]; |
| 1107 | *my_ptr= best[1]; | 1098 | *my_ptr= best[1]; |
| 1108 | 1099 | ||
| 1109 | // printf("%d %d %d \n", best[0], best[1], dmin); | ||
| 1110 | return dmin; | 1100 | return dmin; |
| 1111 | } | 1101 | } |
| @@ -1326,8 +1326,10 @@ static int mpeg_decode_postinit(AVCodecContext *avctx) · 1325 unmodified lines | |||
| 1326 | //res_change_ffmpeg_aspect.ts 4/3 225/44 ->4/3 | 1326 | //res_change_ffmpeg_aspect.ts 4/3 225/44 ->4/3 |
| 1327 | //widescreen-issue562.mpg 4/3 16/9 -> 16/9 | 1327 | //widescreen-issue562.mpg 4/3 16/9 -> 16/9 |
| 1328 | // s->avctx->sample_aspect_ratio = av_mul_q(s->avctx->sample_aspect_ratio, (AVRational) {s->width, s->height}); | 1328 | // s->avctx->sample_aspect_ratio = av_mul_q(s->avctx->sample_aspect_ratio, (AVRational) {s->width, s->height}); |
| 1329 | //av_log(NULL, AV_LOG_ERROR, "A %d/%d\n", ff_mpeg2_aspect[s->aspect_ratio_info].num, ff_mpeg2_aspect[s->aspect_ratio_info].den); | 1329 | av_dlog(avctx, "A %d/%d\n", |
| 1330 | //av_log(NULL, AV_LOG_ERROR, "B %d/%d\n", s->avctx->sample_aspect_ratio.num, s->avctx->sample_aspect_ratio.den); | 1330 | ff_mpeg2_aspect[s->aspect_ratio_info].num, ff_mpeg2_aspect[s->aspect_ratio_info].den); |
| 1331 | av_dlog(avctx, "B %d/%d\n", s->avctx->sample_aspect_ratio.num, | ||
| 1332 | s->avctx->sample_aspect_ratio.den); | ||
| 1331 | } | 1333 | } |
| 1332 | } else { | 1334 | } else { |
| 1333 | s->avctx->sample_aspect_ratio = | 1335 | s->avctx->sample_aspect_ratio = |
| @@ -1881,7 +1883,7 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y, · 547 unmodified lines | |||
| 1881 | } | 1883 | } |
| 1882 | eos: // end of slice | 1884 | eos: // end of slice |
| 1883 | *buf += (get_bits_count(&s->gb)-1)/8; | 1885 | *buf += (get_bits_count(&s->gb)-1)/8; |
| 1884 | //printf("y %d %d %d %d\n", s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y); | 1886 | av_dlog(s, "y %d %d %d %d\n", s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y); |
| 1885 | return 0; | 1887 | return 0; |
| 1886 | } | 1888 | } |
| 1887 | 1889 | ||
| @@ -1900,8 +1902,9 @@ static int slice_decode_thread(AVCodecContext *c, void *arg) · 12 unmodified lines | |||
| 1900 | 1902 | ||
| 1901 | ret = mpeg_decode_slice(s, mb_y, &buf, s->gb.buffer_end - buf); | 1903 | ret = mpeg_decode_slice(s, mb_y, &buf, s->gb.buffer_end - buf); |
| 1902 | emms_c(); | 1904 | emms_c(); |
| 1903 | //av_log(c, AV_LOG_DEBUG, "ret:%d resync:%d/%d mb:%d/%d ts:%d/%d ec:%d\n", | 1905 | av_dlog(c, "ret:%d resync:%d/%d mb:%d/%d ts:%d/%d ec:%d\n", |
| 1904 | //ret, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, s->start_mb_y, s->end_mb_y, s->error_count); | 1906 | ret, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, |
| 1907 | s->start_mb_y, s->end_mb_y, s->error_count); | ||
| 1905 | if (ret < 0) { | 1908 | if (ret < 0) { |
| 1906 | if (c->err_recognition & AV_EF_EXPLODE) | 1909 | if (c->err_recognition & AV_EF_EXPLODE) |
| 1907 | return ret; | 1910 | return ret; |
| @@ -892,9 +892,7 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g, · 891 unmodified lines | |||
| 892 | int pos = get_bits_count(&s->gb); | 892 | int pos = get_bits_count(&s->gb); |
| 893 | 893 | ||
| 894 | if (pos >= end_pos){ | 894 | if (pos >= end_pos){ |
| 895 | // av_log(NULL, AV_LOG_ERROR, "pos: %d %d %d %d\n", pos, end_pos, end_pos2, s_index); | ||
| 896 | switch_buffer(s, &pos, &end_pos, &end_pos2); | 895 | switch_buffer(s, &pos, &end_pos, &end_pos2); |
| 897 | // av_log(NULL, AV_LOG_ERROR, "new pos: %d %d\n", pos, end_pos); | ||
| 898 | if (pos >= end_pos) | 896 | if (pos >= end_pos) |
| 899 | break; | 897 | break; |
| 900 | } | 898 | } |
| @@ -968,9 +966,7 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g, · 67 unmodified lines | |||
| 968 | s_index=0; | 966 | s_index=0; |
| 969 | break; | 967 | break; |
| 970 | } | 968 | } |
| 971 | // av_log(NULL, AV_LOG_ERROR, "pos2: %d %d %d %d\n", pos, end_pos, end_pos2, s_index); | ||
| 972 | switch_buffer(s, &pos, &end_pos, &end_pos2); | 969 | switch_buffer(s, &pos, &end_pos, &end_pos2); |
| 973 | // av_log(NULL, AV_LOG_ERROR, "new pos2: %d %d %d\n", pos, end_pos, s_index); | ||
| 974 | if (pos >= end_pos) | 970 | if (pos >= end_pos) |
| 975 | break; | 971 | break; |
| 976 | } | 972 | } |
| @@ -993,7 +989,6 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g, · 16 unmodified lines | |||
| 993 | } | 989 | } |
| 994 | /* skip extension bits */ | 990 | /* skip extension bits */ |
| 995 | bits_left = end_pos2 - get_bits_count(&s->gb); | 991 | bits_left = end_pos2 - get_bits_count(&s->gb); |
| 996 | //av_log(NULL, AV_LOG_ERROR, "left:%d buf:%p\n", bits_left, s->in_gb.buffer); | ||
| 997 | if (bits_left < 0 && (s->err_recognition & (AV_EF_BUFFER|AV_EF_COMPLIANT))) { | 992 | if (bits_left < 0 && (s->err_recognition & (AV_EF_BUFFER|AV_EF_COMPLIANT))) { |
| 998 | av_log(s->avctx, AV_LOG_ERROR, "bits_left=%d\n", bits_left); | 993 | av_log(s->avctx, AV_LOG_ERROR, "bits_left=%d\n", bits_left); |
| 999 | s_index=0; | 994 | s_index=0; |
| @@ -1406,8 +1401,8 @@ static int mp_decode_layer3(MPADecodeContext *s) · 406 unmodified lines | |||
| 1406 | int extrasize = av_clip(get_bits_left(&s->gb) >> 3, 0, EXTRABYTES); | 1401 | int extrasize = av_clip(get_bits_left(&s->gb) >> 3, 0, EXTRABYTES); |
| 1407 | av_assert1((get_bits_count(&s->gb) & 7) == 0); | 1402 | av_assert1((get_bits_count(&s->gb) & 7) == 0); |
| 1408 | /* now we get bits from the main_data_begin offset */ | 1403 | /* now we get bits from the main_data_begin offset */ |
| 1409 | av_dlog(s->avctx, "seekback: %d\n", main_data_begin); | 1404 | av_dlog(s->avctx, "seekback:%d, lastbuf:%d\n", |
| 1410 | //av_log(NULL, AV_LOG_ERROR, "backstep:%d, lastbuf:%d\n", main_data_begin, s->last_buf_size); | 1405 | main_data_begin, s->last_buf_size); |
| 1411 | 1406 | ||
| 1412 | memcpy(s->last_buf + s->last_buf_size, ptr, extrasize); | 1407 | memcpy(s->last_buf + s->last_buf_size, ptr, extrasize); |
| 1413 | s->in_gb = s->gb; | 1408 | s->in_gb = s->gb; |
| @@ -1383,12 +1383,12 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) · 1382 unmodified lines | |||
| 1383 | if (!s->dropable) | 1383 | if (!s->dropable) |
| 1384 | s->next_picture_ptr = s->current_picture_ptr; | 1384 | s->next_picture_ptr = s->current_picture_ptr; |
| 1385 | } | 1385 | } |
| 1386 | /* av_log(s->avctx, AV_LOG_DEBUG, "L%p N%p C%p L%p N%p C%p type:%d drop:%d\n", | 1386 | av_dlog(s->avctx, "L%p N%p C%p L%p N%p C%p type:%d drop:%d\n", |
| 1387 | s->last_picture_ptr, s->next_picture_ptr,s->current_picture_ptr, | 1387 | s->last_picture_ptr, s->next_picture_ptr,s->current_picture_ptr, |
| 1388 | s->last_picture_ptr ? s->last_picture_ptr->f.data[0] : NULL, | 1388 | s->last_picture_ptr ? s->last_picture_ptr->f.data[0] : NULL, |
| 1389 | s->next_picture_ptr ? s->next_picture_ptr->f.data[0] : NULL, | 1389 | s->next_picture_ptr ? s->next_picture_ptr->f.data[0] : NULL, |
| 1390 | s->current_picture_ptr ? s->current_picture_ptr->f.data[0] : NULL, | 1390 | s->current_picture_ptr ? s->current_picture_ptr->f.data[0] : NULL, |
| 1391 | s->pict_type, s->dropable); */ | 1391 | s->pict_type, s->dropable); |
| 1392 | 1392 | ||
| 1393 | if (s->codec_id != AV_CODEC_ID_H264) { | 1393 | if (s->codec_id != AV_CODEC_ID_H264) { |
| 1394 | if ((s->last_picture_ptr == NULL || | 1394 | if ((s->last_picture_ptr == NULL || |
| @@ -1738,7 +1738,6 @@ void ff_print_debug_info(MpegEncContext *s, AVFrame *pict) · 343 unmodified lines | |||
| 1738 | else | 1738 | else |
| 1739 | av_log(s->avctx, AV_LOG_DEBUG, " "); | 1739 | av_log(s->avctx, AV_LOG_DEBUG, " "); |
| 1740 | } | 1740 | } |
| 1741 | // av_log(s->avctx, AV_LOG_DEBUG, " "); | ||
| 1742 | } | 1741 | } |
| 1743 | av_log(s->avctx, AV_LOG_DEBUG, "\n"); | 1742 | av_log(s->avctx, AV_LOG_DEBUG, "\n"); |
| 1744 | } | 1743 | } |
| @@ -1011,8 +1011,8 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg) · 1010 unmodified lines | |||
| 1011 | if (pic_arg->linesize[2] != s->uvlinesize) | 1011 | if (pic_arg->linesize[2] != s->uvlinesize) |
| 1012 | direct = 0; | 1012 | direct = 0; |
| 1013 | 1013 | ||
| 1014 | //av_log(AV_LOG_DEBUG, "%d %d %d %d\n",pic_arg->linesize[0], | 1014 | av_dlog(s->avctx, "%d %d %d %d\n", pic_arg->linesize[0], |
| 1015 | // pic_arg->linesize[1], s->linesize, s->uvlinesize); | 1015 | pic_arg->linesize[1], s->linesize, s->uvlinesize); |
| 1016 | 1016 | ||
| 1017 | if (direct) { | 1017 | if (direct) { |
| 1018 | i = ff_find_unused_picture(s, 1); | 1018 | i = ff_find_unused_picture(s, 1); |
| @@ -1291,10 +1291,6 @@ static int select_input_picture(MpegEncContext *s) · 272 unmodified lines | |||
| 1291 | if (s->picture_in_gop_number < s->gop_size && | 1291 | if (s->picture_in_gop_number < s->gop_size && |
| 1292 | skip_check(s, s->input_picture[0], s->next_picture_ptr)) { | 1292 | skip_check(s, s->input_picture[0], s->next_picture_ptr)) { |
| 1293 | // FIXME check that te gop check above is +-1 correct | 1293 | // FIXME check that te gop check above is +-1 correct |
| 1294 | //av_log(NULL, AV_LOG_DEBUG, "skip %p %"PRId64"\n", | ||
| 1295 | // s->input_picture[0]->f.data[0], | ||
| 1296 | // s->input_picture[0]->pts); | ||
| 1297 | |||
| 1298 | if (s->input_picture[0]->f.type == FF_BUFFER_TYPE_SHARED) { | 1294 | if (s->input_picture[0]->f.type == FF_BUFFER_TYPE_SHARED) { |
| 1299 | for (i = 0; i < 4; i++) | 1295 | for (i = 0; i < 4; i++) |
| 1300 | s->input_picture[0]->f.data[i] = NULL; | 1296 | s->input_picture[0]->f.data[i] = NULL; |
| @@ -1366,9 +1362,6 @@ static int select_input_picture(MpegEncContext *s) · 65 unmodified lines | |||
| 1366 | } | 1362 | } |
| 1367 | 1363 | ||
| 1368 | emms_c(); | 1364 | emms_c(); |
| 1369 | //static int b_count = 0; | ||
| 1370 | //b_count += b_frames; | ||
| 1371 | //av_log(s->avctx, AV_LOG_DEBUG, "b_frames: %d\n", b_count); | ||
| 1372 | 1365 | ||
| 1373 | for (i = b_frames - 1; i >= 0; i--) { | 1366 | for (i = b_frames - 1; i >= 0; i--) { |
| 1374 | int type = s->input_picture[i]->f.pict_type; | 1367 | int type = s->input_picture[i]->f.pict_type; |
| @@ -1462,7 +1455,6 @@ no_output_pic: · 87 unmodified lines | |||
| 1462 | ff_copy_picture(&s->current_picture, s->current_picture_ptr); | 1455 | ff_copy_picture(&s->current_picture, s->current_picture_ptr); |
| 1463 | 1456 | ||
| 1464 | s->picture_number = s->new_picture.f.display_picture_number; | 1457 | s->picture_number = s->new_picture.f.display_picture_number; |
| 1465 | //printf("dpn:%d\n", s->picture_number); | ||
| 1466 | } else { | 1458 | } else { |
| 1467 | memset(&s->new_picture, 0, sizeof(Picture)); | 1459 | memset(&s->new_picture, 0, sizeof(Picture)); |
| 1468 | } | 1460 | } |
| @@ -1508,8 +1500,6 @@ int ff_MPV_encode_picture(AVCodecContext *avctx, AVPacket *pkt, · 39 unmodified lines | |||
| 1508 | 1500 | ||
| 1509 | s->pict_type = s->new_picture.f.pict_type; | 1501 | s->pict_type = s->new_picture.f.pict_type; |
| 1510 | //emms_c(); | 1502 | //emms_c(); |
| 1511 | //printf("qs:%f %f %d\n", s->new_picture.quality, | ||
| 1512 | // s->current_picture.quality, s->qscale); | ||
| 1513 | ff_MPV_frame_start(s, avctx); | 1503 | ff_MPV_frame_start(s, avctx); |
| 1514 | vbv_retry: | 1504 | vbv_retry: |
| 1515 | if (encode_picture(s, s->picture_number) < 0) | 1505 | if (encode_picture(s, s->picture_number) < 0) |
| @@ -1558,7 +1548,6 @@ vbv_retry: · 42 unmodified lines | |||
| 1558 | s->time_base = s->last_time_base; | 1548 | s->time_base = s->last_time_base; |
| 1559 | s->last_non_b_time = s->time - s->pp_time; | 1549 | s->last_non_b_time = s->time - s->pp_time; |
| 1560 | } | 1550 | } |
| 1561 | //av_log(NULL, AV_LOG_ERROR, "R:%d ", s->next_lambda); | ||
| 1562 | for (i = 0; i < context_count; i++) { | 1551 | for (i = 0; i < context_count; i++) { |
| 1563 | PutBitContext *pb = &s->thread_context[i]->pb; | 1552 | PutBitContext *pb = &s->thread_context[i]->pb; |
| 1564 | init_put_bits(pb, pb->buf, pb->buf_end - pb->buf); | 1553 | init_put_bits(pb, pb->buf, pb->buf_end - pb->buf); |
| @@ -2463,7 +2452,6 @@ static int encode_thread(AVCodecContext *c, void *arg){ · 898 unmodified lines | |||
| 2463 | uint8_t bit_buf2[2][MAX_MB_BYTES]; | 2452 | uint8_t bit_buf2[2][MAX_MB_BYTES]; |
| 2464 | uint8_t bit_buf_tex[2][MAX_MB_BYTES]; | 2453 | uint8_t bit_buf_tex[2][MAX_MB_BYTES]; |
| 2465 | PutBitContext pb[2], pb2[2], tex_pb[2]; | 2454 | PutBitContext pb[2], pb2[2], tex_pb[2]; |
| 2466 | //printf("%d->%d\n", s->resync_mb_y, s->end_mb_y); | ||
| 2467 | 2455 | ||
| 2468 | ff_check_alignment(); | 2456 | ff_check_alignment(); |
| 2469 | 2457 | ||
| @@ -2518,7 +2506,6 @@ static int encode_thread(AVCodecContext *c, void *arg){ · 48 unmodified lines | |||
| 2518 | s->first_slice_line = 1; | 2506 | s->first_slice_line = 1; |
| 2519 | s->ptr_lastgob = s->pb.buf; | 2507 | s->ptr_lastgob = s->pb.buf; |
| 2520 | for(mb_y= s->start_mb_y; mb_y < s->end_mb_y; mb_y++) { | 2508 | for(mb_y= s->start_mb_y; mb_y < s->end_mb_y; mb_y++) { |
| 2521 | // printf("row %d at %X\n", s->mb_y, (int)s); | ||
| 2522 | s->mb_x=0; | 2509 | s->mb_x=0; |
| 2523 | s->mb_y= mb_y; | 2510 | s->mb_y= mb_y; |
| 2524 | 2511 | ||
| @@ -2992,7 +2979,6 @@ static int encode_thread(AVCodecContext *c, void *arg){ · 467 unmodified lines | |||
| 2992 | s->mb_intra= 0; | 2979 | s->mb_intra= 0; |
| 2993 | motion_x= s->mv[0][0][0] = s->b_forw_mv_table[xy][0]; | 2980 | motion_x= s->mv[0][0][0] = s->b_forw_mv_table[xy][0]; |
| 2994 | motion_y= s->mv[0][0][1] = s->b_forw_mv_table[xy][1]; | 2981 | motion_y= s->mv[0][0][1] = s->b_forw_mv_table[xy][1]; |
| 2995 | // printf(" %d %d ", motion_x, motion_y); | ||
| 2996 | break; | 2982 | break; |
| 2997 | case CANDIDATE_MB_TYPE_FORWARD_I: | 2983 | case CANDIDATE_MB_TYPE_FORWARD_I: |
| 2998 | s->mv_dir = MV_DIR_FORWARD; | 2984 | s->mv_dir = MV_DIR_FORWARD; |
| @@ -3069,7 +3055,8 @@ static int encode_thread(AVCodecContext *c, void *arg){ · 70 unmodified lines | |||
| 3069 | if(CONFIG_H263_ENCODER && s->out_format == FMT_H263) | 3055 | if(CONFIG_H263_ENCODER && s->out_format == FMT_H263) |
| 3070 | ff_h263_loop_filter(s); | 3056 | ff_h263_loop_filter(s); |
| 3071 | } | 3057 | } |
| 3072 | //printf("MB %d %d bits\n", s->mb_x+s->mb_y*s->mb_stride, put_bits_count(&s->pb)); | 3058 | av_dlog(s->avctx, "MB %d %d bits\n", |
| 3059 | s->mb_x + s->mb_y * s->mb_stride, put_bits_count(&s->pb)); | ||
| 3073 | } | 3060 | } |
| 3074 | } | 3061 | } |
| 3075 | 3062 | ||
| @@ -3162,7 +3149,6 @@ static int estimate_qp(MpegEncContext *s, int dry_run){ · 86 unmodified lines | |||
| 3162 | //FIXME broken | 3149 | //FIXME broken |
| 3163 | }else | 3150 | }else |
| 3164 | s->lambda = s->current_picture.f.quality; | 3151 | s->lambda = s->current_picture.f.quality; |
| 3165 | //printf("%d %d\n", s->avctx->global_quality, s->current_picture.quality); | ||
| 3166 | update_qscale(s); | 3152 | update_qscale(s); |
| 3167 | return 0; | 3153 | return 0; |
| 3168 | } | 3154 | } |
| @@ -3272,8 +3258,10 @@ static int encode_picture(MpegEncContext *s, int picture_number) · 103 unmodified lines | |||
| 3272 | s->pict_type= AV_PICTURE_TYPE_I; | 3258 | s->pict_type= AV_PICTURE_TYPE_I; |
| 3273 | for(i=0; i<s->mb_stride*s->mb_height; i++) | 3259 | for(i=0; i<s->mb_stride*s->mb_height; i++) |
| 3274 | s->mb_type[i]= CANDIDATE_MB_TYPE_INTRA; | 3260 | s->mb_type[i]= CANDIDATE_MB_TYPE_INTRA; |
| 3275 | //printf("Scene change detected, encoding as I Frame %d %d\n", s->current_picture.mb_var_sum, s->current_picture.mc_mb_var_sum); | 3261 | if(s->msmpeg4_version >= 3) |
| 3276 | if(s->msmpeg4_version >= 3) s->no_rounding=1; | 3262 | s->no_rounding=1; |
| 3263 | av_dlog(s, "Scene change detected, encoding as I Frame %d %d\n", | ||
| 3264 | s->current_picture.mb_var_sum, s->current_picture.mc_mb_var_sum); | ||
| 3277 | } | 3265 | } |
| 3278 | 3266 | ||
| 3279 | if(!s->umvplus){ | 3267 | if(!s->umvplus){ |
| @@ -380,7 +380,7 @@ static int msmpeg4v2_decode_motion(MpegEncContext * s, int pred, int f_code) · 379 unmodified lines | |||
| 380 | int code, val, sign, shift; | 380 | int code, val, sign, shift; |
| 381 | 381 | ||
| 382 | code = get_vlc2(&s->gb, v2_mv_vlc.table, V2_MV_VLC_BITS, 2); | 382 | code = get_vlc2(&s->gb, v2_mv_vlc.table, V2_MV_VLC_BITS, 2); |
| 383 | // printf("MV code %d at %d %d pred: %d\n", code, s->mb_x,s->mb_y, pred); | 383 | av_dlog(s, "MV code %d at %d %d pred: %d\n", code, s->mb_x,s->mb_y, pred); |
| 384 | if (code < 0) | 384 | if (code < 0) |
| 385 | return 0xffff; | 385 | return 0xffff; |
| 386 | 386 | ||
| @@ -547,7 +547,6 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) · 160 unmodified lines | |||
| 547 | 547 | ||
| 548 | if (!s->mb_intra) { | 548 | if (!s->mb_intra) { |
| 549 | int mx, my; | 549 | int mx, my; |
| 550 | //printf("P at %d %d\n", s->mb_x, s->mb_y); | ||
| 551 | if(s->per_mb_rl_table && cbp){ | 550 | if(s->per_mb_rl_table && cbp){ |
| 552 | s->rl_table_index = decode012(&s->gb); | 551 | s->rl_table_index = decode012(&s->gb); |
| 553 | s->rl_chroma_table_index = s->rl_table_index; | 552 | s->rl_chroma_table_index = s->rl_table_index; |
| @@ -561,12 +560,15 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) · 7 unmodified lines | |||
| 561 | s->mv[0][0][1] = my; | 560 | s->mv[0][0][1] = my; |
| 562 | *mb_type_ptr = MB_TYPE_L0 | MB_TYPE_16x16; | 561 | *mb_type_ptr = MB_TYPE_L0 | MB_TYPE_16x16; |
| 563 | } else { | 562 | } else { |
| 564 | //printf("I at %d %d %d %06X\n", s->mb_x, s->mb_y, ((cbp&3)? 1 : 0) +((cbp&0x3C)? 2 : 0), show_bits(&s->gb, 24)); | 563 | av_dlog(s, "I at %d %d %d %06X\n", s->mb_x, s->mb_y, |
| 564 | ((cbp & 3) ? 1 : 0) +((cbp & 0x3C)? 2 : 0), | ||
| 565 | show_bits(&s->gb, 24)); | ||
| 565 | s->ac_pred = get_bits1(&s->gb); | 566 | s->ac_pred = get_bits1(&s->gb); |
| 566 | *mb_type_ptr = MB_TYPE_INTRA; | 567 | *mb_type_ptr = MB_TYPE_INTRA; |
| 567 | if(s->inter_intra_pred){ | 568 | if(s->inter_intra_pred){ |
| 568 | s->h263_aic_dir= get_vlc2(&s->gb, ff_inter_intra_vlc.table, INTER_INTRA_VLC_BITS, 1); | 569 | s->h263_aic_dir= get_vlc2(&s->gb, ff_inter_intra_vlc.table, INTER_INTRA_VLC_BITS, 1); |
| 569 | // printf("%d%d %d %d/", s->ac_pred, s->h263_aic_dir, s->mb_x, s->mb_y); | 570 | av_dlog(s, "%d%d %d %d/", |
| 571 | s->ac_pred, s->h263_aic_dir, s->mb_x, s->mb_y); | ||
| 570 | } | 572 | } |
| 571 | if(s->per_mb_rl_table && cbp){ | 573 | if(s->per_mb_rl_table && cbp){ |
| 572 | s->rl_table_index = decode012(&s->gb); | 574 | s->rl_table_index = decode012(&s->gb); |
| @@ -841,7 +843,8 @@ int ff_msmpeg4_decode_picture_header(MpegEncContext * s) · 268 unmodified lines | |||
| 841 | s->no_rounding = 0; | 843 | s->no_rounding = 0; |
| 842 | } | 844 | } |
| 843 | } | 845 | } |
| 844 | //printf("%d %d %d %d %d\n", s->pict_type, s->bit_rate, s->inter_intra_pred, s->width, s->height); | 846 | av_dlog(s->avctx, "%d %d %d %d %d\n", s->pict_type, s->bit_rate, |
| 847 | s->inter_intra_pred, s->width, s->height); | ||
| 845 | 848 | ||
| 846 | s->esc3_level_length= 0; | 849 | s->esc3_level_length= 0; |
| 847 | s->esc3_run_length= 0; | 850 | s->esc3_run_length= 0; |
| @@ -862,8 +865,6 @@ int ff_msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size) · 14 unmodified lines | |||
| 862 | s->flipflop_rounding= get_bits1(&s->gb); | 865 | s->flipflop_rounding= get_bits1(&s->gb); |
| 863 | else | 866 | else |
| 864 | s->flipflop_rounding= 0; | 867 | s->flipflop_rounding= 0; |
| 865 | |||
| 866 | // printf("fps:%2d bps:%2d roundingType:%1d\n", fps, s->bit_rate/1024, s->flipflop_rounding); | ||
| 867 | } | 868 | } |
| 868 | else if(left<length+8) | 869 | else if(left<length+8) |
| 869 | { | 870 | { |
| @@ -1030,7 +1031,8 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, · 160 unmodified lines | |||
| 1030 | last= SHOW_UBITS(re, &s->gb, 1); SKIP_BITS(re, &s->gb, 1); | 1031 | last= SHOW_UBITS(re, &s->gb, 1); SKIP_BITS(re, &s->gb, 1); |
| 1031 | if(!s->esc3_level_length){ | 1032 | if(!s->esc3_level_length){ |
| 1032 | int ll; | 1033 | int ll; |
| 1033 | //printf("ESC-3 %X at %d %d\n", show_bits(&s->gb, 24), s->mb_x, s->mb_y); | 1034 | av_dlog(s->avctx, "ESC-3 %X at %d %d\n", |
| 1035 | show_bits(&s->gb, 24), s->mb_x, s->mb_y); | ||
| 1034 | if(s->qscale<8){ | 1036 | if(s->qscale<8){ |
| 1035 | ll= SHOW_UBITS(re, &s->gb, 3); SKIP_BITS(re, &s->gb, 3); | 1037 | ll= SHOW_UBITS(re, &s->gb, 3); SKIP_BITS(re, &s->gb, 3); |
| 1036 | if(ll==0){ | 1038 | if(ll==0){ |
| @@ -1047,7 +1049,6 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, · 10 unmodified lines | |||
| 1047 | 1049 | ||
| 1048 | s->esc3_level_length= ll; | 1050 | s->esc3_level_length= ll; |
| 1049 | s->esc3_run_length= SHOW_UBITS(re, &s->gb, 2) + 3; SKIP_BITS(re, &s->gb, 2); | 1051 | s->esc3_run_length= SHOW_UBITS(re, &s->gb, 2) + 3; SKIP_BITS(re, &s->gb, 2); |
| 1050 | //printf("level length:%d, run length: %d\n", ll, s->esc3_run_length); | ||
| 1051 | UPDATE_CACHE(re, &s->gb); | 1052 | UPDATE_CACHE(re, &s->gb); |
| 1052 | } | 1053 | } |
| 1053 | run= SHOW_UBITS(re, &s->gb, s->esc3_run_length); | 1054 | run= SHOW_UBITS(re, &s->gb, s->esc3_run_length); |
| @@ -1060,7 +1061,7 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, · 6 unmodified lines | |||
| 1060 | SKIP_BITS(re, &s->gb, s->esc3_level_length); | 1061 | SKIP_BITS(re, &s->gb, s->esc3_level_length); |
| 1061 | if(sign) level= -level; | 1062 | if(sign) level= -level; |
| 1062 | } | 1063 | } |
| 1063 | //printf("level: %d, run: %d at %d %d\n", level, run, s->mb_x, s->mb_y); | 1064 | |
| 1064 | #if 0 // waste of time / this will detect very few errors | 1065 | #if 0 // waste of time / this will detect very few errors |
| 1065 | { | 1066 | { |
| 1066 | const int abs_level= FFABS(level); | 1067 | const int abs_level= FFABS(level); |
| @@ -1186,7 +1187,6 @@ int ff_msmpeg4_decode_motion(MpegEncContext * s, · 119 unmodified lines | |||
| 1186 | return -1; | 1187 | return -1; |
| 1187 | } | 1188 | } |
| 1188 | if (code == mv->n) { | 1189 | if (code == mv->n) { |
| 1189 | //printf("MV ESC %X at %d %d\n", show_bits(&s->gb, 24), s->mb_x, s->mb_y); | ||
| 1190 | mx = get_bits(&s->gb, 6); | 1190 | mx = get_bits(&s->gb, 6); |
| 1191 | my = get_bits(&s->gb, 6); | 1191 | my = get_bits(&s->gb, 6); |
| 1192 | } else { | 1192 | } else { |
| @@ -193,9 +193,6 @@ static void find_best_tables(MpegEncContext * s) · 192 unmodified lines | |||
| 193 | } | 193 | } |
| 194 | } | 194 | } |
| 195 | 195 | ||
| 196 | // printf("type:%d, best:%d, qp:%d, var:%d, mcvar:%d, size:%d //\n", | ||
| 197 | // s->pict_type, best, s->qscale, s->mb_var_sum, s->mc_mb_var_sum, best_size); | ||
| 198 | |||
| 199 | if(s->pict_type==AV_PICTURE_TYPE_P) chroma_best= best; | 196 | if(s->pict_type==AV_PICTURE_TYPE_P) chroma_best= best; |
| 200 | 197 | ||
| 201 | memset(s->ac_stats, 0, sizeof(int)*(MAX_LEVEL+1)*(MAX_RUN+1)*2*2*2); | 198 | memset(s->ac_stats, 0, sizeof(int)*(MAX_LEVEL+1)*(MAX_RUN+1)*2*2*2); |
| @@ -233,7 +230,8 @@ void ff_msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number) · 31 unmodified lines | |||
| 233 | s->per_mb_rl_table = 0; | 230 | s->per_mb_rl_table = 0; |
| 234 | if(s->msmpeg4_version==4) | 231 | if(s->msmpeg4_version==4) |
| 235 | s->inter_intra_pred= (s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE && s->pict_type==AV_PICTURE_TYPE_P); | 232 | s->inter_intra_pred= (s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE && s->pict_type==AV_PICTURE_TYPE_P); |
| 236 | //printf("%d %d %d %d %d\n", s->pict_type, s->bit_rate, s->inter_intra_pred, s->width, s->height); | 233 | av_dlog(s, "%d %d %d %d %d\n", s->pict_type, s->bit_rate, |
| 234 | s->inter_intra_pred, s->width, s->height); | ||
| 237 | 235 | ||
| 238 | if (s->pict_type == AV_PICTURE_TYPE_I) { | 236 | if (s->pict_type == AV_PICTURE_TYPE_I) { |
| 239 | s->slice_height= s->mb_height/1; | 237 | s->slice_height= s->mb_height/1; |
| @@ -150,7 +150,6 @@ int av_parser_parse2(AVCodecParserContext *s, · 149 unmodified lines | |||
| 150 | 150 | ||
| 151 | /* WARNING: the returned index can be negative */ | 151 | /* WARNING: the returned index can be negative */ |
| 152 | index = s->parser->parser_parse(s, avctx, (const uint8_t **)poutbuf, poutbuf_size, buf, buf_size); | 152 | index = s->parser->parser_parse(s, avctx, (const uint8_t **)poutbuf, poutbuf_size, buf, buf_size); |
| 153 | //av_log(NULL, AV_LOG_DEBUG, "parser: in:%"PRId64", %"PRId64", out:%"PRId64", %"PRId64", in:%d out:%d id:%d\n", pts, dts, s->last_pts, s->last_dts, buf_size, *poutbuf_size, avctx->codec_id); | ||
| 154 | /* update the file pointer */ | 153 | /* update the file pointer */ |
| 155 | if (*poutbuf_size) { | 154 | if (*poutbuf_size) { |
| 156 | /* fill the data for the current frame */ | 155 | /* fill the data for the current frame */ |
| @@ -131,13 +131,11 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) · 130 unmodified lines | |||
| 131 | unsigned int bit_buf; | 131 | unsigned int bit_buf; |
| 132 | int bit_left; | 132 | int bit_left; |
| 133 | 133 | ||
| 134 | // printf("put_bits=%d %x\n", n, value); | ||
| 135 | av_assert2(n <= 31 && value < (1U << n)); | 134 | av_assert2(n <= 31 && value < (1U << n)); |
| 136 | 135 | ||
| 137 | bit_buf = s->bit_buf; | 136 | bit_buf = s->bit_buf; |
| 138 | bit_left = s->bit_left; | 137 | bit_left = s->bit_left; |
| 139 | 138 | ||
| 140 | // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf); | ||
| 141 | /* XXX: optimize */ | 139 | /* XXX: optimize */ |
| 142 | #ifdef BITSTREAM_WRITER_LE | 140 | #ifdef BITSTREAM_WRITER_LE |
| 143 | bit_buf |= value << (32 - bit_left); | 141 | bit_buf |= value << (32 - bit_left); |
| @@ -158,7 +156,6 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) · 14 unmodified lines | |||
| 158 | bit_buf |= value >> (n - bit_left); | 156 | bit_buf |= value >> (n - bit_left); |
| 159 | av_assert2(s->buf_ptr+3<s->buf_end); | 157 | av_assert2(s->buf_ptr+3<s->buf_end); |
| 160 | AV_WB32(s->buf_ptr, bit_buf); | 158 | AV_WB32(s->buf_ptr, bit_buf); |
| 161 | //printf("bitbuf = %08x\n", bit_buf); | ||
| 162 | s->buf_ptr+=4; | 159 | s->buf_ptr+=4; |
| 163 | bit_left+=32 - n; | 160 | bit_left+=32 - n; |
| 164 | bit_buf = value; | 161 | bit_buf = value; |
| @@ -283,7 +283,8 @@ int ff_vbv_update(MpegEncContext *s, int frame_size){ · 282 unmodified lines | |||
| 283 | const double min_rate= s->avctx->rc_min_rate/fps; | 283 | const double min_rate= s->avctx->rc_min_rate/fps; |
| 284 | const double max_rate= s->avctx->rc_max_rate/fps; | 284 | const double max_rate= s->avctx->rc_max_rate/fps; |
| 285 | 285 | ||
| 286 | //av_log(0,0, "%d %f %d %f %f\n", buffer_size, rcc->buffer_index, frame_size, min_rate, max_rate); | 286 | av_dlog(s, "%d %f %d %f %f\n", |
| 287 | buffer_size, rcc->buffer_index, frame_size, min_rate, max_rate); | ||
| 287 | if(buffer_size){ | 288 | if(buffer_size){ |
| 288 | int left; | 289 | int left; |
| 289 | 290 | ||
| @@ -457,7 +458,6 @@ static double modify_qscale(MpegEncContext *s, RateControlEntry *rce, double q, · 167 unmodified lines | |||
| 457 | if(s->avctx->rc_qmod_freq && frame_num%s->avctx->rc_qmod_freq==0 && pict_type==AV_PICTURE_TYPE_P) | 458 | if(s->avctx->rc_qmod_freq && frame_num%s->avctx->rc_qmod_freq==0 && pict_type==AV_PICTURE_TYPE_P) |
| 458 | q*= s->avctx->rc_qmod_amp; | 459 | q*= s->avctx->rc_qmod_amp; |
| 459 | 460 | ||
| 460 | //printf("q:%f\n", q); | ||
| 461 | /* buffer overflow/underflow protection */ | 461 | /* buffer overflow/underflow protection */ |
| 462 | if(buffer_size){ | 462 | if(buffer_size){ |
| 463 | double expected_size= rcc->buffer_index; | 463 | double expected_size= rcc->buffer_index; |
| @@ -493,7 +493,9 @@ static double modify_qscale(MpegEncContext *s, RateControlEntry *rce, double q, · 29 unmodified lines | |||
| 493 | } | 493 | } |
| 494 | } | 494 | } |
| 495 | } | 495 | } |
| 496 | //printf("q:%f max:%f min:%f size:%f index:%d bits:%f agr:%f\n", q,max_rate, min_rate, buffer_size, rcc->buffer_index, bits, s->avctx->rc_buffer_aggressivity); | 496 | av_dlog(s, "q:%f max:%f min:%f size:%f index:%f agr:%f\n", |
| 497 | q, max_rate, min_rate, buffer_size, rcc->buffer_index, | ||
| 498 | s->avctx->rc_buffer_aggressivity); | ||
| 497 | if(s->avctx->rc_qsquish==0.0 || qmin==qmax){ | 499 | if(s->avctx->rc_qsquish==0.0 || qmin==qmax){ |
| 498 | if (q<qmin) q=qmin; | 500 | if (q<qmin) q=qmin; |
| 499 | else if(q>qmax) q=qmax; | 501 | else if(q>qmax) q=qmax; |
| @@ -636,8 +638,6 @@ static void adaptive_quantization(MpegEncContext *s, double q){ · 136 unmodified lines | |||
| 636 | 638 | ||
| 637 | if (intq > qmax) intq= qmax; | 639 | if (intq > qmax) intq= qmax; |
| 638 | else if(intq < qmin) intq= qmin; | 640 | else if(intq < qmin) intq= qmin; |
| 639 | //if(i%s->mb_width==0) printf("\n"); | ||
| 640 | //printf("%2d%3d ", intq, ff_sqrt(s->mc_mb_var[i])); | ||
| 641 | s->lambda_table[mb_xy]= intq; | 641 | s->lambda_table[mb_xy]= intq; |
| 642 | } | 642 | } |
| 643 | } | 643 | } |
| @@ -682,7 +682,6 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) · 38 unmodified lines | |||
| 682 | get_qminmax(&qmin, &qmax, s, pict_type); | 682 | get_qminmax(&qmin, &qmax, s, pict_type); |
| 683 | 683 | ||
| 684 | fps= get_fps(s->avctx); | 684 | fps= get_fps(s->avctx); |
| 685 | //printf("input_pic_num:%d pic_num:%d frame_rate:%d\n", s->input_picture_number, s->picture_number, s->frame_rate); | ||
| 686 | /* update predictors */ | 685 | /* update predictors */ |
| 687 | if(picture_number>2 && !dry_run){ | 686 | if(picture_number>2 && !dry_run){ |
| 688 | const int last_var= s->last_pict_type == AV_PICTURE_TYPE_I ? rcc->last_mb_var_sum : rcc->last_mc_mb_var_sum; | 687 | const int last_var= s->last_pict_type == AV_PICTURE_TYPE_I ? rcc->last_mb_var_sum : rcc->last_mc_mb_var_sum; |
| @@ -706,9 +705,6 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) · 17 unmodified lines | |||
| 706 | else | 705 | else |
| 707 | dts_pic= s->last_picture_ptr; | 706 | dts_pic= s->last_picture_ptr; |
| 708 | 707 | ||
| 709 | //if(dts_pic) | ||
| 710 | // av_log(NULL, AV_LOG_ERROR, "%"PRId64" %"PRId64" %"PRId64" %d\n", s->current_picture_ptr->pts, s->user_specified_pts, dts_pic->pts, picture_number); | ||
| 711 | |||
| 712 | if (!dts_pic || dts_pic->f.pts == AV_NOPTS_VALUE) | 708 | if (!dts_pic || dts_pic->f.pts == AV_NOPTS_VALUE) |
| 713 | wanted_bits= (uint64_t)(s->bit_rate*(double)picture_number/fps); | 709 | wanted_bits= (uint64_t)(s->bit_rate*(double)picture_number/fps); |
| 714 | else | 710 | else |
| @@ -727,7 +723,8 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) · 12 unmodified lines | |||
| 727 | assert(pict_type == rce->new_pict_type); | 723 | assert(pict_type == rce->new_pict_type); |
| 728 | 724 | ||
| 729 | q= rce->new_qscale / br_compensation; | 725 | q= rce->new_qscale / br_compensation; |
| 730 | //printf("%f %f %f last:%d var:%d type:%d//\n", q, rce->new_qscale, br_compensation, s->frame_bits, var, pict_type); | 726 | av_dlog(s, "%f %f %f last:%d var:%d type:%d//\n", q, rce->new_qscale, |
| 727 | br_compensation, s->frame_bits, var, pict_type); | ||
| 731 | }else{ | 728 | }else{ |
| 732 | rce->pict_type= | 729 | rce->pict_type= |
| 733 | rce->new_pict_type= pict_type; | 730 | rce->new_pict_type= pict_type; |
| @@ -764,9 +761,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) · 30 unmodified lines | |||
| 764 | return -1; | 761 | return -1; |
| 765 | 762 | ||
| 766 | assert(q>0.0); | 763 | assert(q>0.0); |
| 767 | //printf("%f ", q); | ||
| 768 | q= get_diff_limited_q(s, rce, q); | 764 | q= get_diff_limited_q(s, rce, q); |
| 769 | //printf("%f ", q); | ||
| 770 | assert(q>0.0); | 765 | assert(q>0.0); |
| 771 | 766 | ||
| 772 | if(pict_type==AV_PICTURE_TYPE_P || s->intra_only){ //FIXME type dependent blur like in 2-pass | 767 | if(pict_type==AV_PICTURE_TYPE_P || s->intra_only){ //FIXME type dependent blur like in 2-pass |
| @@ -775,9 +770,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) · 2 unmodified lines | |||
| 775 | 770 | ||
| 776 | rcc->short_term_qsum+= q; | 771 | rcc->short_term_qsum+= q; |
| 777 | rcc->short_term_qcount++; | 772 | rcc->short_term_qcount++; |
| 778 | //printf("%f ", q); | ||
| 779 | q= short_term_q= rcc->short_term_qsum/rcc->short_term_qcount; | 773 | q= short_term_q= rcc->short_term_qsum/rcc->short_term_qcount; |
| 780 | //printf("%f ", q); | ||
| 781 | } | 774 | } |
| 782 | assert(q>0.0); | 775 | assert(q>0.0); |
| 783 | 776 | ||
| @@ -908,18 +901,15 @@ static int init_pass2(MpegEncContext *s) · 124 unmodified lines | |||
| 908 | double bits; | 901 | double bits; |
| 909 | rce->new_qscale= modify_qscale(s, rce, blurred_qscale[i], i); | 902 | rce->new_qscale= modify_qscale(s, rce, blurred_qscale[i], i); |
| 910 | bits= qp2bits(rce, rce->new_qscale) + rce->mv_bits + rce->misc_bits; | 903 | bits= qp2bits(rce, rce->new_qscale) + rce->mv_bits + rce->misc_bits; |
| 911 | //printf("%d %f\n", rce->new_bits, blurred_qscale[i]); | ||
| 912 | bits += 8*ff_vbv_update(s, bits); | 904 | bits += 8*ff_vbv_update(s, bits); |
| 913 | 905 | ||
| 914 | rce->expected_bits= expected_bits; | 906 | rce->expected_bits= expected_bits; |
| 915 | expected_bits += bits; | 907 | expected_bits += bits; |
| 916 | } | 908 | } |
| 917 | 909 | ||
| 918 | /* | 910 | av_dlog(s->avctx, |
| 919 | av_log(s->avctx, AV_LOG_INFO, | 911 | "expected_bits: %f all_available_bits: %d rate_factor: %f\n", |
| 920 | "expected_bits: %f all_available_bits: %d rate_factor: %f\n", | 912 | expected_bits, (int)all_available_bits, rate_factor); |
| 921 | expected_bits, (int)all_available_bits, rate_factor); | ||
| 922 | */ | ||
| 923 | if(expected_bits > all_available_bits) { | 913 | if(expected_bits > all_available_bits) { |
| 924 | rate_factor-= step; | 914 | rate_factor-= step; |
| 925 | ++toobig; | 915 | ++toobig; |
| @@ -931,8 +921,10 @@ static int init_pass2(MpegEncContext *s) · 5 unmodified lines | |||
| 931 | /* check bitrate calculations and print info */ | 921 | /* check bitrate calculations and print info */ |
| 932 | qscale_sum = 0.0; | 922 | qscale_sum = 0.0; |
| 933 | for(i=0; i<rcc->num_entries; i++){ | 923 | for(i=0; i<rcc->num_entries; i++){ |
| 934 | /* av_log(s->avctx, AV_LOG_DEBUG, "[lavc rc] entry[%d].new_qscale = %.3f qp = %.3f\n", | 924 | av_dlog(s, "[lavc rc] entry[%d].new_qscale = %.3f qp = %.3f\n", |
| 935 | i, rcc->entry[i].new_qscale, rcc->entry[i].new_qscale / FF_QP2LAMBDA); */ | 925 | i, |
| 926 | rcc->entry[i].new_qscale, | ||
| 927 | rcc->entry[i].new_qscale / FF_QP2LAMBDA); | ||
| 936 | qscale_sum += av_clip(rcc->entry[i].new_qscale / FF_QP2LAMBDA, s->avctx->qmin, s->avctx->qmax); | 928 | qscale_sum += av_clip(rcc->entry[i].new_qscale / FF_QP2LAMBDA, s->avctx->qmin, s->avctx->qmax); |
| 937 | } | 929 | } |
| 938 | assert(toobig <= 40); | 930 | assert(toobig <= 40); |
| @@ -399,7 +399,6 @@ static int rv20_decode_picture_header(RVDecContext *rv) · 398 unmodified lines | |||
| 399 | 399 | ||
| 400 | mb_pos = ff_h263_decode_mba(s); | 400 | mb_pos = ff_h263_decode_mba(s); |
| 401 | 401 | ||
| 402 | //av_log(s->avctx, AV_LOG_DEBUG, "%d\n", seq); | ||
| 403 | seq |= s->time &~0x7FFF; | 402 | seq |= s->time &~0x7FFF; |
| 404 | if(seq - s->time > 0x4000) seq -= 0x8000; | 403 | if(seq - s->time > 0x4000) seq -= 0x8000; |
| 405 | if(seq - s->time < -0x4000) seq += 0x8000; | 404 | if(seq - s->time < -0x4000) seq += 0x8000; |
| @@ -418,11 +417,7 @@ static int rv20_decode_picture_header(RVDecContext *rv) · 12 unmodified lines | |||
| 418 | ff_mpeg4_init_direct_mv(s); | 417 | ff_mpeg4_init_direct_mv(s); |
| 419 | } | 418 | } |
| 420 | } | 419 | } |
| 421 | // printf("%d %d %d %d %d\n", seq, (int)s->time, (int)s->last_non_b_time, s->pp_time, s->pb_time); | 420 | |
| 422 | /*for(i=0; i<32; i++){ | ||
| 423 | av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb)); | ||
| 424 | } | ||
| 425 | av_log(s->avctx, AV_LOG_DEBUG, "\n");*/ | ||
| 426 | s->no_rounding= get_bits1(&s->gb); | 421 | s->no_rounding= get_bits1(&s->gb); |
| 427 | 422 | ||
| 428 | if(RV_GET_MINOR_VER(rv->sub_id) <= 1 && s->pict_type == AV_PICTURE_TYPE_B) | 423 | if(RV_GET_MINOR_VER(rv->sub_id) <= 1 && s->pict_type == AV_PICTURE_TYPE_B) |
| @@ -521,8 +521,8 @@ static int svq1_decode_frame_header (GetBitContext *bitbuf,MpegEncContext *s) { · 520 unmodified lines | |||
| 521 | 521 | ||
| 522 | csum = ff_svq1_packet_checksum (bitbuf->buffer, bitbuf->size_in_bits>>3, csum); | 522 | csum = ff_svq1_packet_checksum (bitbuf->buffer, bitbuf->size_in_bits>>3, csum); |
| 523 | 523 | ||
| 524 | // av_log(s->avctx, AV_LOG_INFO, "%s checksum (%02x) for packet data\n", | 524 | av_dlog(s->avctx, "%s checksum (%02x) for packet data\n", |
| 525 | // (csum == 0) ? "correct" : "incorrect", csum); | 525 | (csum == 0) ? "correct" : "incorrect", csum); |
| 526 | } | 526 | } |
| 527 | 527 | ||
| 528 | if ((s->f_code ^ 0x10) >= 0x50) { | 528 | if ((s->f_code ^ 0x10) >= 0x50) { |
| @@ -610,7 +610,6 @@ void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic) · 609 unmodified lines | |||
| 610 | for (i = 0; i < AV_NUM_DATA_POINTERS; i++) | 610 | for (i = 0; i < AV_NUM_DATA_POINTERS; i++) |
| 611 | pic->data[i] = NULL; | 611 | pic->data[i] = NULL; |
| 612 | // pic->base[i]=NULL; | 612 | // pic->base[i]=NULL; |
| 613 | //printf("R%X\n", pic->opaque); | ||
| 614 | 613 | ||
| 615 | if (s->debug & FF_DEBUG_BUFFERS) | 614 | if (s->debug & FF_DEBUG_BUFFERS) |
| 616 | av_log(s, AV_LOG_DEBUG, "default_release_buffer called on pic %p, %d " | 615 | av_log(s, AV_LOG_DEBUG, "default_release_buffer called on pic %p, %d " |
| @@ -395,8 +395,6 @@ int ff_vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitCo · 394 unmodified lines | |||
| 395 | v->res_rtm_flag = get_bits1(gb); //reserved | 395 | v->res_rtm_flag = get_bits1(gb); //reserved |
| 396 | } | 396 | } |
| 397 | if (!v->res_rtm_flag) { | 397 | if (!v->res_rtm_flag) { |
| 398 | // av_log(avctx, AV_LOG_ERROR, | ||
| 399 | // "0 for reserved RES_RTM_FLAG is forbidden\n"); | ||
| 400 | av_log(avctx, AV_LOG_ERROR, | 398 | av_log(avctx, AV_LOG_ERROR, |
| 401 | "Old WMV3 version detected, some frames may be decoded incorrectly\n"); | 399 | "Old WMV3 version detected, some frames may be decoded incorrectly\n"); |
| 402 | //return -1; | 400 | //return -1; |
| @@ -663,8 +661,9 @@ int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb) · 260 unmodified lines | |||
| 663 | v->x8_type = get_bits1(gb); | 661 | v->x8_type = get_bits1(gb); |
| 664 | } else | 662 | } else |
| 665 | v->x8_type = 0; | 663 | v->x8_type = 0; |
| 666 | //av_log(v->s.avctx, AV_LOG_INFO, "%c Frame: QP=[%i]%i (+%i/2) %i\n", | 664 | av_dlog(v->s.avctx, "%c Frame: QP=[%i]%i (+%i/2) %i\n", |
| 667 | // (v->s.pict_type == AV_PICTURE_TYPE_P) ? 'P' : ((v->s.pict_type == AV_PICTURE_TYPE_I) ? 'I' : 'B'), pqindex, v->pq, v->halfpq, v->rangeredfrm); | 665 | (v->s.pict_type == AV_PICTURE_TYPE_P) ? 'P' : ((v->s.pict_type == AV_PICTURE_TYPE_I) ? 'I' : 'B'), |
| 666 | pqindex, v->pq, v->halfpq, v->rangeredfrm); | ||
| 668 | 667 | ||
| 669 | if (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_P) | 668 | if (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_P) |
| 670 | v->use_ic = 0; | 669 | v->use_ic = 0; |
| @@ -5637,7 +5637,8 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, · 5636 unmodified lines | |||
| 5637 | s->linesize >>= 1; | 5637 | s->linesize >>= 1; |
| 5638 | s->uvlinesize >>= 1; | 5638 | s->uvlinesize >>= 1; |
| 5639 | } | 5639 | } |
| 5640 | //av_log(s->avctx, AV_LOG_INFO, "Consumed %i/%i bits\n", get_bits_count(&s->gb), s->gb.size_in_bits); | 5640 | av_dlog(s->avctx, "Consumed %i/%i bits\n", |
| 5641 | get_bits_count(&s->gb), s->gb.size_in_bits); | ||
| 5641 | // if (get_bits_count(&s->gb) > buf_size * 8) | 5642 | // if (get_bits_count(&s->gb) > buf_size * 8) |
| 5642 | // return -1; | 5643 | // return -1; |
| 5643 | if(s->error_occurred && s->pict_type == AV_PICTURE_TYPE_B) | 5644 | if(s->error_occurred && s->pict_type == AV_PICTURE_TYPE_B) |
| @@ -66,10 +66,8 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num) · 65 unmodified lines | |||
| 66 | 66 | ||
| 67 | for (p = 0; (bits[p] == 0) && (p < num); ++p) | 67 | for (p = 0; (bits[p] == 0) && (p < num); ++p) |
| 68 | ; | 68 | ; |
| 69 | if (p == num) { | 69 | if (p == num) |
| 70 | // av_log(vc->avccontext, AV_LOG_INFO, "An empty codebook. Heh?! \n"); | ||
| 71 | return 0; | 70 | return 0; |
| 72 | } | ||
| 73 | 71 | ||
| 74 | codes[p] = 0; | 72 | codes[p] = 0; |
| 75 | if (bits[p] > 32) | 73 | if (bits[p] > 32) |
| @@ -2068,7 +2068,8 @@ static int read_huffman_tree(AVCodecContext *avctx, GetBitContext *gb) · 2067 unmodified lines | |||
| 2068 | return -1; | 2068 | return -1; |
| 2069 | } | 2069 | } |
| 2070 | token = get_bits(gb, 5); | 2070 | token = get_bits(gb, 5); |
| 2071 | //av_log(avctx, AV_LOG_DEBUG, "hti %d hbits %x token %d entry : %d size %d\n", s->hti, s->hbits, token, s->entries, s->huff_code_size); | 2071 | av_dlog(avctx, "hti %d hbits %x token %d entry : %d size %d\n", |
| 2072 | s->hti, s->hbits, token, s->entries, s->huff_code_size); | ||
| 2072 | s->huffman_table[s->hti][token][0] = s->hbits; | 2073 | s->huffman_table[s->hti][token][0] = s->hbits; |
| 2073 | s->huffman_table[s->hti][token][1] = s->huff_code_size; | 2074 | s->huffman_table[s->hti][token][1] = s->huff_code_size; |
| 2074 | s->entries++; | 2075 | s->entries++; |
| @@ -95,8 +95,6 @@ static int wma_decode_init(AVCodecContext * avctx) · 94 unmodified lines | |||
| 95 | } else if (avctx->codec->id == AV_CODEC_ID_WMAV2 && avctx->extradata_size >= 6) { | 95 | } else if (avctx->codec->id == AV_CODEC_ID_WMAV2 && avctx->extradata_size >= 6) { |
| 96 | flags2 = AV_RL16(extradata+4); | 96 | flags2 = AV_RL16(extradata+4); |
| 97 | } | 97 | } |
| 98 | // for(i=0; i<avctx->extradata_size; i++) | ||
| 99 | // av_log(NULL, AV_LOG_ERROR, "%02X ", extradata[i]); | ||
| 100 | 98 | ||
| 101 | s->use_exp_vlc = flags2 & 0x0001; | 99 | s->use_exp_vlc = flags2 & 0x0001; |
| 102 | s->use_bit_reservoir = flags2 & 0x0002; | 100 | s->use_bit_reservoir = flags2 & 0x0002; |
| @@ -866,7 +864,6 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data, · 763 unmodified lines | |||
| 866 | } | 864 | } |
| 867 | 865 | ||
| 868 | if (s->last_superframe_len > 0) { | 866 | if (s->last_superframe_len > 0) { |
| 869 | // printf("skip=%d\n", s->last_bitoffset); | ||
| 870 | /* add bit_offset bits to last frame */ | 867 | /* add bit_offset bits to last frame */ |
| 871 | if ((s->last_superframe_len + ((bit_offset + 7) >> 3)) > | 868 | if ((s->last_superframe_len + ((bit_offset + 7) >> 3)) > |
| 872 | MAX_CODED_SUPERFRAME_SIZE) | 869 | MAX_CODED_SUPERFRAME_SIZE) |
| @@ -929,7 +926,9 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data, · 56 unmodified lines | |||
| 929 | samples += s->nb_channels * s->frame_len; | 926 | samples += s->nb_channels * s->frame_len; |
| 930 | } | 927 | } |
| 931 | 928 | ||
| 932 | //av_log(NULL, AV_LOG_ERROR, "%d %d %d %d outbytes:%d eaten:%d\n", s->frame_len_bits, s->block_len_bits, s->frame_len, s->block_len, (int8_t *)samples - (int8_t *)data, s->block_align); | 929 | av_dlog(s->avctx, "%d %d %d %d outbytes:%d eaten:%d\n", |
| 930 | s->frame_len_bits, s->block_len_bits, s->frame_len, s->block_len, | ||
| 931 | (int8_t *)samples - (int8_t *)data, s->block_align); | ||
| 933 | 932 | ||
| 934 | *got_frame_ptr = 1; | 933 | *got_frame_ptr = 1; |
| 935 | *(AVFrame *)data = s->frame; | 934 | *(AVFrame *)data = s->frame; |
| @@ -82,7 +82,6 @@ static int encode_init(AVCodecContext * avctx){ · 81 unmodified lines | |||
| 82 | (avctx->sample_rate * 8); | 82 | (avctx->sample_rate * 8); |
| 83 | s->block_align = FFMIN(s->block_align, MAX_CODED_SUPERFRAME_SIZE); | 83 | s->block_align = FFMIN(s->block_align, MAX_CODED_SUPERFRAME_SIZE); |
| 84 | avctx->block_align = s->block_align; | 84 | avctx->block_align = s->block_align; |
| 85 | //av_log(NULL, AV_LOG_ERROR, "%d %d %d %d\n", s->block_align, avctx->bit_rate, s->frame_len, avctx->sample_rate); | ||
| 86 | avctx->frame_size = avctx->delay = s->frame_len; | 85 | avctx->frame_size = avctx->delay = s->frame_len; |
| 87 | 86 | ||
| 88 | #if FF_API_OLD_ENCODE_AUDIO | 87 | #if FF_API_OLD_ENCODE_AUDIO |
| @@ -244,8 +244,6 @@ static inline int wmv2_decode_motion(Wmv2Context *w, int *mx_ptr, int *my_ptr){ · 243 unmodified lines | |||
| 244 | else | 244 | else |
| 245 | w->hshift= 0; | 245 | w->hshift= 0; |
| 246 | 246 | ||
| 247 | //printf("%d %d ", *mx_ptr, *my_ptr); | ||
| 248 | |||
| 249 | return 0; | 247 | return 0; |
| 250 | } | 248 | } |
| 251 | 249 | ||
| @@ -314,7 +312,6 @@ static inline int wmv2_decode_inter_block(Wmv2Context *w, DCTELEM *block, int n, · 62 unmodified lines | |||
| 314 | // const uint8_t *scantable= w->abt_type-1 ? w->abt_scantable[1].permutated : w->abt_scantable[0].scantable; | 312 | // const uint8_t *scantable= w->abt_type-1 ? w->abt_scantable[1].permutated : w->abt_scantable[0].scantable; |
| 315 | 313 | ||
| 316 | sub_cbp= sub_cbp_table[ decode012(&s->gb) ]; | 314 | sub_cbp= sub_cbp_table[ decode012(&s->gb) ]; |
| 317 | // printf("S%d", sub_cbp); | ||
| 318 | 315 | ||
| 319 | if(sub_cbp&1){ | 316 | if(sub_cbp&1){ |
| 320 | if (ff_msmpeg4_decode_block(s, block, n, 1, scantable) < 0) | 317 | if (ff_msmpeg4_decode_block(s, block, n, 1, scantable) < 0) |
| @@ -385,7 +382,6 @@ int ff_wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) · 64 unmodified lines | |||
| 385 | 382 | ||
| 386 | if (!s->mb_intra) { | 383 | if (!s->mb_intra) { |
| 387 | int mx, my; | 384 | int mx, my; |
| 388 | //printf("P at %d %d\n", s->mb_x, s->mb_y); | ||
| 389 | wmv2_pred_motion(w, &mx, &my); | 385 | wmv2_pred_motion(w, &mx, &my); |
| 390 | 386 | ||
| 391 | if(cbp){ | 387 | if(cbp){ |
| @@ -419,13 +415,16 @@ int ff_wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) · 27 unmodified lines | |||
| 419 | } | 415 | } |
| 420 | } | 416 | } |
| 421 | } else { | 417 | } else { |
| 422 | //if(s->pict_type==AV_PICTURE_TYPE_P) | 418 | if (s->pict_type==AV_PICTURE_TYPE_P) |
| 423 | // printf("%d%d ", s->inter_intra_pred, cbp); | 419 | av_dlog(s->avctx, "%d%d ", s->inter_intra_pred, cbp); |
| 424 | //printf("I at %d %d %d %06X\n", s->mb_x, s->mb_y, ((cbp&3)? 1 : 0) +((cbp&0x3C)? 2 : 0), show_bits(&s->gb, 24)); | 420 | av_dlog(s->avctx, "I at %d %d %d %06X\n", s->mb_x, s->mb_y, |
| 421 | ((cbp & 3) ? 1 : 0) +((cbp & 0x3C)? 2 : 0), | ||
| 422 | show_bits(&s->gb, 24)); | ||
| 425 | s->ac_pred = get_bits1(&s->gb); | 423 | s->ac_pred = get_bits1(&s->gb); |
| 426 | if(s->inter_intra_pred){ | 424 | if(s->inter_intra_pred){ |
| 427 | s->h263_aic_dir= get_vlc2(&s->gb, ff_inter_intra_vlc.table, INTER_INTRA_VLC_BITS, 1); | 425 | s->h263_aic_dir= get_vlc2(&s->gb, ff_inter_intra_vlc.table, INTER_INTRA_VLC_BITS, 1); |
| 428 | // printf("%d%d %d %d/", s->ac_pred, s->h263_aic_dir, s->mb_x, s->mb_y); | 426 | av_dlog(s->avctx, "%d%d %d %d/", |
| 427 | s->ac_pred, s->h263_aic_dir, s->mb_x, s->mb_y); | ||
| 429 | } | 428 | } |
| 430 | if(s->per_mb_rl_table && cbp){ | 429 | if(s->per_mb_rl_table && cbp){ |
| 431 | s->rl_table_index = decode012(&s->gb); | 430 | s->rl_table_index = decode012(&s->gb); |
| @@ -51,7 +51,7 @@ static void dct_unquantize_h263_intra_mmx(MpegEncContext *s, · 50 unmodified lines | |||
| 51 | nCoeffs=63; | 51 | nCoeffs=63; |
| 52 | else | 52 | else |
| 53 | nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; | 53 | nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; |
| 54 | //printf("%d %d ", qmul, qadd); | 54 | |
| 55 | __asm__ volatile( | 55 | __asm__ volatile( |
| 56 | "movd %1, %%mm6 \n\t" //qmul | 56 | "movd %1, %%mm6 \n\t" //qmul |
| 57 | "packssdw %%mm6, %%mm6 \n\t" | 57 | "packssdw %%mm6, %%mm6 \n\t" |
| @@ -114,7 +114,7 @@ static void dct_unquantize_h263_inter_mmx(MpegEncContext *s, · 56 unmodified lines | |||
| 114 | assert(s->block_last_index[n]>=0 || s->h263_aic); | 114 | assert(s->block_last_index[n]>=0 || s->h263_aic); |
| 115 | 115 | ||
| 116 | nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; | 116 | nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; |
| 117 | //printf("%d %d ", qmul, qadd); | 117 | |
| 118 | __asm__ volatile( | 118 | __asm__ volatile( |
| 119 | "movd %1, %%mm6 \n\t" //qmul | 119 | "movd %1, %%mm6 \n\t" //qmul |
| 120 | "packssdw %%mm6, %%mm6 \n\t" | 120 | "packssdw %%mm6, %%mm6 \n\t" |
| @@ -103,15 +103,8 @@ int main(void) · 102 unmodified lines | |||
| 103 | double ideal[SAMPLES]; | 103 | double ideal[SAMPLES]; |
| 104 | double samples[SAMPLES]; | 104 | double samples[SAMPLES]; |
| 105 | double samplet[SAMPLES]; | 105 | double samplet[SAMPLES]; |
| 106 | #if 1 | ||
| 107 | for (n0 = 0; n0 < 40; n0 = 2 * n0 + 1) { | 106 | for (n0 = 0; n0 < 40; n0 = 2 * n0 + 1) { |
| 108 | for (n1 = 0; n1 < 10; n1 = 2 * n1 + 1) { | 107 | for (n1 = 0; n1 < 10; n1 = 2 * n1 + 1) { |
| 109 | #else | ||
| 110 | { | ||
| 111 | { | ||
| 112 | n0 = 7; | ||
| 113 | n1 = 1; | ||
| 114 | #endif | ||
| 115 | double best_error = 1000000000; | 108 | double best_error = 1000000000; |
| 116 | double bestpar0 = 1; | 109 | double bestpar0 = 1; |
| 117 | double bestpar1 = 1; | 110 | double bestpar1 = 1; |
| @@ -21,6 +21,7 @@ · 20 unmodified lines | |||
| 21 | 21 | ||
| 22 | //#define DEBUG | 22 | //#define DEBUG |
| 23 | 23 | ||
| 24 | #include "libavutil/attributes.h" | ||
| 24 | #include "libavutil/bswap.h" | 25 | #include "libavutil/bswap.h" |
| 25 | #include "libavutil/common.h" | 26 | #include "libavutil/common.h" |
| 26 | #include "libavutil/avstring.h" | 27 | #include "libavutil/avstring.h" |
| @@ -420,9 +421,6 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) · 393 unmodified lines | |||
| 420 | avio_rl16(pb); //ds_data_size | 421 | avio_rl16(pb); //ds_data_size |
| 421 | avio_r8(pb); //ds_silence_data | 422 | avio_r8(pb); //ds_silence_data |
| 422 | } | 423 | } |
| 423 | //printf("Descrambling: ps:%d cs:%d ds:%d s:%d sd:%d\n", | ||
| 424 | // asf_st->ds_packet_size, asf_st->ds_chunk_size, | ||
| 425 | // asf_st->ds_data_size, asf_st->ds_span, asf_st->ds_silence_data); | ||
| 426 | if (asf_st->ds_span > 1) { | 424 | if (asf_st->ds_span > 1) { |
| 427 | if (!asf_st->ds_chunk_size | 425 | if (!asf_st->ds_chunk_size |
| 428 | || (asf_st->ds_packet_size/asf_st->ds_chunk_size <= 1) | 426 | || (asf_st->ds_packet_size/asf_st->ds_chunk_size <= 1) |
| @@ -443,7 +441,6 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) · 14 unmodified lines | |||
| 443 | st->codec->bits_per_coded_sample = avio_rl16(pb); /* depth */ | 441 | st->codec->bits_per_coded_sample = avio_rl16(pb); /* depth */ |
| 444 | tag1 = avio_rl32(pb); | 442 | tag1 = avio_rl32(pb); |
| 445 | avio_skip(pb, 20); | 443 | avio_skip(pb, 20); |
| 446 | // av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX); | ||
| 447 | if (sizeX > 40) { | 444 | if (sizeX > 40) { |
| 448 | st->codec->extradata_size = sizeX - 40; | 445 | st->codec->extradata_size = sizeX - 40; |
| 449 | st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); | 446 | st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); |
| @@ -614,16 +611,18 @@ static int asf_read_metadata(AVFormatContext *s, int64_t size) · 164 unmodified lines | |||
| 614 | 611 | ||
| 615 | for(i=0;i<n;i++) { | 612 | for(i=0;i<n;i++) { |
| 616 | char name[1024]; | 613 | char name[1024]; |
| 614 | int av_unused value_type; | ||
| 617 | 615 | ||
| 618 | avio_rl16(pb); //lang_list_index | 616 | avio_rl16(pb); //lang_list_index |
| 619 | stream_num= avio_rl16(pb); | 617 | stream_num= avio_rl16(pb); |
| 620 | name_len= avio_rl16(pb); | 618 | name_len= avio_rl16(pb); |
| 621 | avio_skip(pb, 2); /* value_type */ | 619 | value_type = avio_rl16(pb); /* value_type */ |
| 622 | value_len= avio_rl32(pb); | 620 | value_len= avio_rl32(pb); |
| 623 | 621 | ||
| 624 | if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len) | 622 | if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len) |
| 625 | avio_skip(pb, name_len - ret); | 623 | avio_skip(pb, name_len - ret); |
| 626 | //av_log(s, AV_LOG_ERROR, "%d %d %d %d %d <%s>\n", i, stream_num, name_len, value_type, value_len, name); | 624 | av_dlog(s, "%d %d %d %d %d <%s>\n", |
| 625 | i, stream_num, name_len, value_type, value_len, name); | ||
| 627 | value_num= avio_rl16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere | 626 | value_num= avio_rl16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere |
| 628 | avio_skip(pb, value_len - 2); | 627 | avio_skip(pb, value_len - 2); |
| 629 | 628 | ||
| @@ -689,9 +688,7 @@ static int asf_read_header(AVFormatContext *s) · 59 unmodified lines | |||
| 689 | uint64_t gpos= avio_tell(pb); | 688 | uint64_t gpos= avio_tell(pb); |
| 690 | ff_get_guid(pb, &g); | 689 | ff_get_guid(pb, &g); |
| 691 | gsize = avio_rl64(pb); | 690 | gsize = avio_rl64(pb); |
| 692 | av_dlog(s, "%08"PRIx64": ", gpos); | ||
| 693 | print_guid(&g); | 691 | print_guid(&g); |
| 694 | av_dlog(s, " size=0x%"PRIx64"\n", gsize); | ||
| 695 | if (!ff_guidcmp(&g, &ff_asf_data_header)) { | 692 | if (!ff_guidcmp(&g, &ff_asf_data_header)) { |
| 696 | asf->data_object_offset = avio_tell(pb); | 693 | asf->data_object_offset = avio_tell(pb); |
| 697 | // if not streaming, gsize is not unlimited (how?), and there is enough space in the file.. | 694 | // if not streaming, gsize is not unlimited (how?), and there is enough space in the file.. |
| @@ -784,7 +781,9 @@ static int asf_read_header(AVFormatContext *s) · 86 unmodified lines | |||
| 784 | &st->sample_aspect_ratio.num, | 781 | &st->sample_aspect_ratio.num, |
| 785 | asf->dar[0].num, asf->dar[0].den, INT_MAX); | 782 | asf->dar[0].num, asf->dar[0].den, INT_MAX); |
| 786 | 783 | ||
| 787 | //av_log(s, AV_LOG_INFO, "i=%d, st->codec->codec_type:%d, dar %d:%d sar=%d:%d\n", i, st->codec->codec_type, dar[i].num, dar[i].den, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den); | 784 | av_dlog(s, "i=%d, st->codec->codec_type:%d, asf->dar %d:%d sar=%d:%d\n", |
| 785 | i, st->codec->codec_type, asf->dar[i].num, asf->dar[i].den, | ||
| 786 | st->sample_aspect_ratio.num, st->sample_aspect_ratio.den); | ||
| 788 | 787 | ||
| 789 | // copy and convert language codes to the frontend | 788 | // copy and convert language codes to the frontend |
| 790 | if (asf->streams[i].stream_language_index < 128) { | 789 | if (asf->streams[i].stream_language_index < 128) { |
| @@ -926,7 +925,9 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ · 135 unmodified lines | |||
| 926 | DO_2BITS(asf->packet_property >> 4, asf->packet_seq, 0); | 925 | DO_2BITS(asf->packet_property >> 4, asf->packet_seq, 0); |
| 927 | DO_2BITS(asf->packet_property >> 2, asf->packet_frag_offset, 0); | 926 | DO_2BITS(asf->packet_property >> 2, asf->packet_frag_offset, 0); |
| 928 | DO_2BITS(asf->packet_property, asf->packet_replic_size, 0); | 927 | DO_2BITS(asf->packet_property, asf->packet_replic_size, 0); |
| 929 | //printf("key:%d stream:%d seq:%d offset:%d replic_size:%d\n", asf->packet_key_frame, asf->stream_index, asf->packet_seq, //asf->packet_frag_offset, asf->packet_replic_size); | 928 | av_dlog(asf, "key:%d stream:%d seq:%d offset:%d replic_size:%d\n", |
| 929 | asf->packet_key_frame, asf->stream_index, asf->packet_seq, | ||
| 930 | asf->packet_frag_offset, asf->packet_replic_size); | ||
| 930 | if (rsize+asf->packet_replic_size > asf->packet_size_left) { | 931 | if (rsize+asf->packet_replic_size > asf->packet_size_left) { |
| 931 | av_log(s, AV_LOG_ERROR, "packet_replic_size %d is invalid\n", asf->packet_replic_size); | 932 | av_log(s, AV_LOG_ERROR, "packet_replic_size %d is invalid\n", asf->packet_replic_size); |
| 932 | return AVERROR_INVALIDDATA; | 933 | return AVERROR_INVALIDDATA; |
| @@ -939,9 +940,6 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ · 6 unmodified lines | |||
| 939 | } | 940 | } |
| 940 | asf->packet_frag_timestamp = avio_rl32(pb); // timestamp | 941 | asf->packet_frag_timestamp = avio_rl32(pb); // timestamp |
| 941 | if(asf->packet_replic_size >= 8+38+4){ | 942 | if(asf->packet_replic_size >= 8+38+4){ |
| 942 | // for(i=0; i<asf->packet_replic_size-8; i++) | ||
| 943 | // av_log(s, AV_LOG_DEBUG, "%02X ",avio_r8(pb)); | ||
| 944 | // av_log(s, AV_LOG_DEBUG, "\n"); | ||
| 945 | avio_skip(pb, 10); | 943 | avio_skip(pb, 10); |
| 946 | ts0= avio_rl64(pb); | 944 | ts0= avio_rl64(pb); |
| 947 | ts1= avio_rl64(pb); | 945 | ts1= avio_rl64(pb); |
| @@ -980,10 +978,8 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ · 32 unmodified lines | |||
| 980 | asf->packet_padsize -= diff; | 978 | asf->packet_padsize -= diff; |
| 981 | } | 979 | } |
| 982 | } | 980 | } |
| 983 | //printf("Fragsize %d\n", asf->packet_frag_size); | ||
| 984 | } else { | 981 | } else { |
| 985 | asf->packet_frag_size = asf->packet_size_left - rsize; | 982 | asf->packet_frag_size = asf->packet_size_left - rsize; |
| 986 | //printf("Using rest %d %d %d\n", asf->packet_frag_size, asf->packet_size_left, rsize); | ||
| 987 | } | 983 | } |
| 988 | if (asf->packet_replic_size == 1) { | 984 | if (asf->packet_replic_size == 1) { |
| 989 | asf->packet_multi_size = asf->packet_frag_size; | 985 | asf->packet_multi_size = asf->packet_frag_size; |
| @@ -991,7 +987,6 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ · 1 unmodified line | |||
| 991 | return AVERROR_INVALIDDATA; | 987 | return AVERROR_INVALIDDATA; |
| 992 | } | 988 | } |
| 993 | asf->packet_size_left -= rsize; | 989 | asf->packet_size_left -= rsize; |
| 994 | //printf("___objsize____ %d %d rs:%d\n", asf->packet_obj_size, asf->packet_frag_offset, rsize); | ||
| 995 | 990 | ||
| 996 | return 0; | 991 | return 0; |
| 997 | } | 992 | } |
| @@ -1017,7 +1012,6 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk · 19 unmodified lines | |||
| 1017 | || asf->packet_segments < 1) { | 1012 | || asf->packet_segments < 1) { |
| 1018 | //asf->packet_size_left <= asf->packet_padsize) { | 1013 | //asf->packet_size_left <= asf->packet_padsize) { |
| 1019 | int ret = asf->packet_size_left + asf->packet_padsize; | 1014 | int ret = asf->packet_size_left + asf->packet_padsize; |
| 1020 | //printf("PacketLeftSize:%d Pad:%d Pos:%"PRId64"\n", asf->packet_size_left, asf->packet_padsize, avio_tell(pb)); | ||
| 1021 | assert(ret>=0); | 1015 | assert(ret>=0); |
| 1022 | /* fail safe */ | 1016 | /* fail safe */ |
| 1023 | avio_skip(pb, ret); | 1017 | avio_skip(pb, ret); |
| @@ -1064,7 +1058,6 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk · 40 unmodified lines | |||
| 1064 | continue; | 1058 | continue; |
| 1065 | } | 1059 | } |
| 1066 | asf->packet_multi_size -= asf->packet_obj_size; | 1060 | asf->packet_multi_size -= asf->packet_obj_size; |
| 1067 | //printf("COMPRESS size %d %d %d ms:%d\n", asf->packet_obj_size, asf->packet_frag_timestamp, asf->packet_size_left, asf->packet_multi_size); | ||
| 1068 | } | 1061 | } |
| 1069 | if( /*asf->packet_frag_size == asf->packet_obj_size*/ | 1062 | if( /*asf->packet_frag_size == asf->packet_obj_size*/ |
| 1070 | asf_st->frag_offset + asf->packet_frag_size <= asf_st->pkt.size | 1063 | asf_st->frag_offset + asf->packet_frag_size <= asf_st->pkt.size |
| @@ -1100,9 +1093,11 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk · 29 unmodified lines | |||
| 1100 | asf_st->palette_changed = 0; | 1093 | asf_st->palette_changed = 0; |
| 1101 | } | 1094 | } |
| 1102 | } | 1095 | } |
| 1103 | //printf("new packet: stream:%d key:%d packet_key:%d audio:%d size:%d\n", | 1096 | av_dlog(asf, "new packet: stream:%d key:%d packet_key:%d audio:%d size:%d\n", |
| 1104 | //asf->stream_index, asf->packet_key_frame, asf_st->pkt.flags & AV_PKT_FLAG_KEY, | 1097 | asf->stream_index, asf->packet_key_frame, |
| 1105 | //s->streams[asf->stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO, asf->packet_obj_size); | 1098 | asf_st->pkt.flags & AV_PKT_FLAG_KEY, |
| 1099 | s->streams[asf->stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO, | ||
| 1100 | asf->packet_obj_size); | ||
| 1106 | if (s->streams[asf->stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO) | 1101 | if (s->streams[asf->stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO) |
| 1107 | asf->packet_key_frame = 1; | 1102 | asf->packet_key_frame = 1; |
| 1108 | if (asf->packet_key_frame) | 1103 | if (asf->packet_key_frame) |
| @@ -1110,9 +1105,9 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk · 1 unmodified line | |||
| 1110 | } | 1105 | } |
| 1111 | 1106 | ||
| 1112 | /* read data */ | 1107 | /* read data */ |
| 1113 | //printf("READ PACKET s:%d os:%d o:%d,%d l:%d DATA:%p\n", | 1108 | av_dlog(asf, "READ PACKET s:%d os:%d o:%d,%d l:%d DATA:%p\n", |
| 1114 | // s->packet_size, asf_st->pkt.size, asf->packet_frag_offset, | 1109 | s->packet_size, asf_st->pkt.size, asf->packet_frag_offset, |
| 1115 | // asf_st->frag_offset, asf->packet_frag_size, asf_st->pkt.data); | 1110 | asf_st->frag_offset, asf->packet_frag_size, asf_st->pkt.data); |
| 1116 | asf->packet_size_left -= asf->packet_frag_size; | 1111 | asf->packet_size_left -= asf->packet_frag_size; |
| 1117 | if (asf->packet_size_left < 0) | 1112 | if (asf->packet_size_left < 0) |
| 1118 | continue; | 1113 | continue; |
| @@ -1174,8 +1169,6 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk · 55 unmodified lines | |||
| 1174 | int row = off / asf_st->ds_span; | 1169 | int row = off / asf_st->ds_span; |
| 1175 | int col = off % asf_st->ds_span; | 1170 | int col = off % asf_st->ds_span; |
| 1176 | int idx = row + col * asf_st->ds_packet_size / asf_st->ds_chunk_size; | 1171 | int idx = row + col * asf_st->ds_packet_size / asf_st->ds_chunk_size; |
| 1177 | //printf("off:%d row:%d col:%d idx:%d\n", off, row, col, idx); | ||
| 1178 | |||
| 1179 | assert(offset + asf_st->ds_chunk_size <= asf_st->pkt.size); | 1172 | assert(offset + asf_st->ds_chunk_size <= asf_st->pkt.size); |
| 1180 | assert(idx+1 <= asf_st->pkt.size / asf_st->ds_chunk_size); | 1173 | assert(idx+1 <= asf_st->pkt.size / asf_st->ds_chunk_size); |
| 1181 | memcpy(newdata + offset, | 1174 | memcpy(newdata + offset, |
| @@ -1190,7 +1183,6 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk · 8 unmodified lines | |||
| 1190 | } | 1183 | } |
| 1191 | asf_st->frag_offset = 0; | 1184 | asf_st->frag_offset = 0; |
| 1192 | *pkt= asf_st->pkt; | 1185 | *pkt= asf_st->pkt; |
| 1193 | //printf("packet %d %d\n", asf_st->pkt.size, asf->packet_frag_size); | ||
| 1194 | asf_st->pkt.size = 0; | 1186 | asf_st->pkt.size = 0; |
| 1195 | asf_st->pkt.data = 0; | 1187 | asf_st->pkt.data = 0; |
| 1196 | asf_st->pkt.side_data_elems = 0; | 1188 | asf_st->pkt.side_data_elems = 0; |
| @@ -1280,7 +1272,6 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos, · 83 unmodified lines | |||
| 1280 | if (avio_seek(s->pb, pos, SEEK_SET) < 0) | 1272 | if (avio_seek(s->pb, pos, SEEK_SET) < 0) |
| 1281 | return AV_NOPTS_VALUE; | 1273 | return AV_NOPTS_VALUE; |
| 1282 | 1274 | ||
| 1283 | //printf("asf_read_pts\n"); | ||
| 1284 | asf_reset_header(s); | 1275 | asf_reset_header(s); |
| 1285 | for(;;){ | 1276 | for(;;){ |
| 1286 | if (av_read_frame(s, pkt) < 0){ | 1277 | if (av_read_frame(s, pkt) < 0){ |
| @@ -1308,8 +1299,6 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos, · 21 unmodified lines | |||
| 1308 | } | 1299 | } |
| 1309 | 1300 | ||
| 1310 | *ppos= pos; | 1301 | *ppos= pos; |
| 1311 | //printf("found keyframe at %"PRId64" stream %d stamp:%"PRId64"\n", *ppos, stream_index, pts); | ||
| 1312 | |||
| 1313 | return pts; | 1302 | return pts; |
| 1314 | } | 1303 | } |
| 1315 | 1304 | ||
| @@ -60,7 +60,7 @@ static int64_t get_pts(const uint8_t *p) · 59 unmodified lines | |||
| 60 | if(sscanf(p, "%*[^,],%d:%d:%d%*c%d", &hour, &min, &sec, &hsec) != 4) | 60 | if(sscanf(p, "%*[^,],%d:%d:%d%*c%d", &hour, &min, &sec, &hsec) != 4) |
| 61 | return AV_NOPTS_VALUE; | 61 | return AV_NOPTS_VALUE; |
| 62 | 62 | ||
| 63 | // av_log(NULL, AV_LOG_ERROR, "%d %d %d %d %d [%s]\n", i, hour, min, sec, hsec, p); | 63 | av_dlog(NULL, "%d %d %d %d [%s]\n", hour, min, sec, hsec, p); |
| 64 | 64 | ||
| 65 | min+= 60*hour; | 65 | min+= 60*hour; |
| 66 | sec+= 60*min; | 66 | sec+= 60*min; |
| @@ -545,7 +545,8 @@ static int avi_read_header(AVFormatContext *s) · 544 unmodified lines | |||
| 545 | } | 545 | } |
| 546 | ast->sample_size = avio_rl32(pb); /* sample ssize */ | 546 | ast->sample_size = avio_rl32(pb); /* sample ssize */ |
| 547 | ast->cum_len *= FFMAX(1, ast->sample_size); | 547 | ast->cum_len *= FFMAX(1, ast->sample_size); |
| 548 | // av_log(s, AV_LOG_DEBUG, "%d %d %d %d\n", ast->rate, ast->scale, ast->start, ast->sample_size); | 548 | av_dlog(s, "%"PRIu32" %"PRIu32" %d\n", |
| 549 | ast->rate, ast->scale, ast->sample_size); | ||
| 549 | 550 | ||
| 550 | switch(tag1) { | 551 | switch(tag1) { |
| 551 | case MKTAG('v', 'i', 'd', 's'): | 552 | case MKTAG('v', 'i', 'd', 's'): |
| @@ -743,7 +744,9 @@ static int avi_read_header(AVFormatContext *s) · 191 unmodified lines | |||
| 743 | 744 | ||
| 744 | if(active_aspect.num && active_aspect.den && active.num && active.den){ | 745 | if(active_aspect.num && active_aspect.den && active.num && active.den){ |
| 745 | st->sample_aspect_ratio= av_div_q(active_aspect, active); | 746 | st->sample_aspect_ratio= av_div_q(active_aspect, active); |
| 746 | //av_log(s, AV_LOG_ERROR, "vprp %d/%d %d/%d\n", active_aspect.num, active_aspect.den, active.num, active.den); | 747 | av_dlog(s, "vprp %d/%d %d/%d\n", |
| 748 | active_aspect.num, active_aspect.den, | ||
| 749 | active.num, active.den); | ||
| 747 | } | 750 | } |
| 748 | size -= 9*4; | 751 | size -= 9*4; |
| 749 | } | 752 | } |
| @@ -921,7 +924,8 @@ start_sync: · 171 unmodified lines | |||
| 921 | size= d[4] + (d[5]<<8) + (d[6]<<16) + (d[7]<<24); | 924 | size= d[4] + (d[5]<<8) + (d[6]<<16) + (d[7]<<24); |
| 922 | 925 | ||
| 923 | n= get_stream_idx(d+2); | 926 | n= get_stream_idx(d+2); |
| 924 | //av_log(s, AV_LOG_DEBUG, "%X %X %X %X %X %X %X %X %"PRId64" %d %d\n", d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], i, size, n); | 927 | av_dlog(s, "%X %X %X %X %X %X %X %X %"PRId64" %u %d\n", |
| 928 | d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], i, size, n); | ||
| 925 | if(i + (uint64_t)size > avi->fsize || d[0] > 127) | 929 | if(i + (uint64_t)size > avi->fsize || d[0] > 127) |
| 926 | continue; | 930 | continue; |
| 927 | 931 | ||
| @@ -931,7 +935,6 @@ start_sync: · 3 unmodified lines | |||
| 931 | ||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K') | 935 | ||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K') |
| 932 | ||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){ | 936 | ||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){ |
| 933 | avio_skip(pb, size); | 937 | avio_skip(pb, size); |
| 934 | //av_log(s, AV_LOG_DEBUG, "SKIP\n"); | ||
| 935 | goto start_sync; | 938 | goto start_sync; |
| 936 | } | 939 | } |
| 937 | 940 | ||
| @@ -1010,7 +1013,6 @@ start_sync: · 72 unmodified lines | |||
| 1010 | 1013 | ||
| 1011 | if (exit_early) | 1014 | if (exit_early) |
| 1012 | return 0; | 1015 | return 0; |
| 1013 | //av_log(s, AV_LOG_DEBUG, "OK\n"); | ||
| 1014 | if(d[2]*256+d[3] == ast->prefix) | 1016 | if(d[2]*256+d[3] == ast->prefix) |
| 1015 | ast->prefix_count++; | 1017 | ast->prefix_count++; |
| 1016 | else{ | 1018 | else{ |
| @@ -1073,7 +1075,8 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) · 56 unmodified lines | |||
| 1073 | 1075 | ||
| 1074 | ts = av_rescale_q(ts, st->time_base, (AVRational){FFMAX(1, ast->sample_size), AV_TIME_BASE}); | 1076 | ts = av_rescale_q(ts, st->time_base, (AVRational){FFMAX(1, ast->sample_size), AV_TIME_BASE}); |
| 1075 | 1077 | ||
| 1076 | // av_log(s, AV_LOG_DEBUG, "%"PRId64" %d/%d %"PRId64"\n", ts, st->time_base.num, st->time_base.den, ast->frame_offset); | 1078 | av_dlog(s, "%"PRId64" %d/%d %"PRId64"\n", ts, |
| 1079 | st->time_base.num, st->time_base.den, ast->frame_offset); | ||
| 1077 | if(ts < best_ts){ | 1080 | if(ts < best_ts){ |
| 1078 | best_ts= ts; | 1081 | best_ts= ts; |
| 1079 | best_st= st; | 1082 | best_st= st; |
| @@ -1093,13 +1096,11 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) · 13 unmodified lines | |||
| 1093 | best_ast->frame_offset= best_st->index_entries[i].timestamp; | 1096 | best_ast->frame_offset= best_st->index_entries[i].timestamp; |
| 1094 | } | 1097 | } |
| 1095 | 1098 | ||
| 1096 | // av_log(s, AV_LOG_DEBUG, "%d\n", i); | ||
| 1097 | if(i>=0){ | 1099 | if(i>=0){ |
| 1098 | int64_t pos= best_st->index_entries[i].pos; | 1100 | int64_t pos= best_st->index_entries[i].pos; |
| 1099 | pos += best_ast->packet_size - best_ast->remaining; | 1101 | pos += best_ast->packet_size - best_ast->remaining; |
| 1100 | if(avio_seek(s->pb, pos + 8, SEEK_SET) < 0) | 1102 | if(avio_seek(s->pb, pos + 8, SEEK_SET) < 0) |
| 1101 | return AVERROR_EOF; | 1103 | return AVERROR_EOF; |
| 1102 | // av_log(s, AV_LOG_DEBUG, "pos=%"PRId64"\n", pos); | ||
| 1103 | 1104 | ||
| 1104 | av_assert0(best_ast->remaining <= best_ast->packet_size); | 1105 | av_assert0(best_ast->remaining <= best_ast->packet_size); |
| 1105 | 1106 | ||
| @@ -1168,7 +1169,9 @@ resync: · 62 unmodified lines | |||
| 1168 | // pkt->dts += ast->start; | 1169 | // pkt->dts += ast->start; |
| 1169 | if(ast->sample_size) | 1170 | if(ast->sample_size) |
| 1170 | pkt->dts /= ast->sample_size; | 1171 | pkt->dts /= ast->sample_size; |
| 1171 | //av_log(s, AV_LOG_DEBUG, "dts:%"PRId64" offset:%"PRId64" %d/%d smpl_siz:%d base:%d st:%d size:%d\n", pkt->dts, ast->frame_offset, ast->scale, ast->rate, ast->sample_size, AV_TIME_BASE, avi->stream_index, size); | 1172 | av_dlog(s, "dts:%"PRId64" offset:%"PRId64" %d/%d smpl_siz:%d base:%d st:%d size:%d\n", |
| 1173 | pkt->dts, ast->frame_offset, ast->scale, ast->rate, | ||
| 1174 | ast->sample_size, AV_TIME_BASE, avi->stream_index, size); | ||
| 1172 | pkt->stream_index = avi->stream_index; | 1175 | pkt->stream_index = avi->stream_index; |
| 1173 | 1176 | ||
| 1174 | if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { | 1177 | if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { |
| @@ -1457,7 +1460,8 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp · 282 unmodified lines | |||
| 1457 | pos = st->index_entries[index].pos; | 1460 | pos = st->index_entries[index].pos; |
| 1458 | timestamp = st->index_entries[index].timestamp / FFMAX(ast->sample_size, 1); | 1461 | timestamp = st->index_entries[index].timestamp / FFMAX(ast->sample_size, 1); |
| 1459 | 1462 | ||
| 1460 | // av_log(s, AV_LOG_DEBUG, "XX %"PRId64" %d %"PRId64"\n", timestamp, index, st->index_entries[index].timestamp); | 1463 | av_dlog(s, "XX %"PRId64" %d %"PRId64"\n", |
| 1464 | timestamp, index, st->index_entries[index].timestamp); | ||
| 1461 | 1465 | ||
| 1462 | if (CONFIG_DV_DEMUXER && avi->dv_demux) { | 1466 | if (CONFIG_DV_DEMUXER && avi->dv_demux) { |
| 1463 | /* One and only one real stream for DV in AVI, and it has video */ | 1467 | /* One and only one real stream for DV in AVI, and it has video */ |
| @@ -246,9 +246,6 @@ static void adjust_write_index(AVFormatContext *s) · 245 unmodified lines | |||
| 246 | ffm->write_index += pos_max; | 246 | ffm->write_index += pos_max; |
| 247 | } | 247 | } |
| 248 | 248 | ||
| 249 | //printf("Adjusted write index from %"PRId64" to %"PRId64": pts=%0.6f\n", orig_write_index, ffm->write_index, pts / 1000000.); | ||
| 250 | //printf("pts range %0.6f - %0.6f\n", get_dts(s, 0) / 1000000. , get_dts(s, ffm->file_size - 2 * FFM_PACKET_SIZE) / 1000000. ); | ||
| 251 | |||
| 252 | end: | 249 | end: |
| 253 | avio_seek(pb, ptr, SEEK_SET); | 250 | avio_seek(pb, ptr, SEEK_SET); |
| 254 | } | 251 | } |
| @@ -446,9 +446,6 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) · 445 unmodified lines | |||
| 446 | uint8_t *data = NULL; | 446 | uint8_t *data = NULL; |
| 447 | int flags = -1, flags_size, ret; | 447 | int flags = -1, flags_size, ret; |
| 448 | 448 | ||
| 449 | av_dlog(s, "type:%s pts:%"PRId64" dts:%"PRId64" size:%d\n", | ||
| 450 | av_get_media_type_string(enc->codec_type), pkt->pts, pkt->dts, size); | ||
| 451 | |||
| 452 | if (enc->codec_id == AV_CODEC_ID_VP6 || enc->codec_id == AV_CODEC_ID_VP6F || | 449 | if (enc->codec_id == AV_CODEC_ID_VP6 || enc->codec_id == AV_CODEC_ID_VP6F || |
| 453 | enc->codec_id == AV_CODEC_ID_VP6A || enc->codec_id == AV_CODEC_ID_AAC) | 450 | enc->codec_id == AV_CODEC_ID_VP6A || enc->codec_id == AV_CODEC_ID_AAC) |
| 454 | flags_size = 2; | 451 | flags_size = 2; |
| @@ -55,8 +55,6 @@ static int h263_probe(AVProbeData *p) · 54 unmodified lines | |||
| 55 | last_gn= gn; | 55 | last_gn= gn; |
| 56 | } | 56 | } |
| 57 | } | 57 | } |
| 58 | //av_log(NULL, AV_LOG_ERROR, "h263_probe: psc:%d invalid:%d res_change:%d\n", valid_psc, invalid_psc, res_change); | ||
| 59 | //h263_probe: psc:3 invalid:0 res_change:0 (1588/recent_ffmpeg_parses_mpg_incorrectly.mpg) | ||
| 60 | if(valid_psc > 2*invalid_psc + 2*res_change + 3){ | 58 | if(valid_psc > 2*invalid_psc + 2*res_change + 3){ |
| 61 | return 50; | 59 | return 50; |
| 62 | }else if(valid_psc > 2*invalid_psc) | 60 | }else if(valid_psc > 2*invalid_psc) |
| @@ -2196,7 +2196,6 @@ static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s) · 2195 unmodified lines | |||
| 2196 | 2196 | ||
| 2197 | mov_write_psp_udta_tag(pb, LIBAVCODEC_IDENT, "eng", 0x04); | 2197 | mov_write_psp_udta_tag(pb, LIBAVCODEC_IDENT, "eng", 0x04); |
| 2198 | mov_write_psp_udta_tag(pb, title->value, "eng", 0x01); | 2198 | mov_write_psp_udta_tag(pb, title->value, "eng", 0x01); |
| 2199 | // snprintf(dt,32,"%04d/%02d/%02d %02d:%02d:%02d",t_st->tm_year+1900,t_st->tm_mon+1,t_st->tm_mday,t_st->tm_hour,t_st->tm_min,t_st->tm_sec); | ||
| 2200 | mov_write_psp_udta_tag(pb, "2006/04/01 11:11:11", "und", 0x03); | 2199 | mov_write_psp_udta_tag(pb, "2006/04/01 11:11:11", "und", 0x03); |
| 2201 | 2200 | ||
| 2202 | update_size(pb, pos2); | 2201 | update_size(pb, pos2); |
| @@ -85,7 +85,6 @@ static int mpegps_probe(AVProbeData *p) · 84 unmodified lines | |||
| 85 | if(vid+audio > invalid+1) /* invalid VDR files nd short PES streams */ | 85 | if(vid+audio > invalid+1) /* invalid VDR files nd short PES streams */ |
| 86 | score= AVPROBE_SCORE_MAX/4; | 86 | score= AVPROBE_SCORE_MAX/4; |
| 87 | 87 | ||
| 88 | //av_log(NULL, AV_LOG_ERROR, "%d %d %d %d %d %d len:%d\n", sys, priv1, pspack,vid, audio, invalid, p->buf_size); | ||
| 89 | if(sys>invalid && sys*9 <= pspack*10) | 88 | if(sys>invalid && sys*9 <= pspack*10) |
| 90 | return (audio > 12 || vid > 3 || pspack > 2) ? AVPROBE_SCORE_MAX/2+2 : AVPROBE_SCORE_MAX/4; // +1 for .mpg | 89 | return (audio > 12 || vid > 3 || pspack > 2) ? AVPROBE_SCORE_MAX/2+2 : AVPROBE_SCORE_MAX/4; // +1 for .mpg |
| 91 | if(pspack > invalid && (priv1+vid+audio)*10 >= pspack*9) | 90 | if(pspack > invalid && (priv1+vid+audio)*10 >= pspack*9) |
| @@ -223,7 +222,6 @@ static int mpegps_read_pes_header(AVFormatContext *s, · 131 unmodified lines | |||
| 223 | size = MAX_SYNC_SIZE; | 222 | size = MAX_SYNC_SIZE; |
| 224 | startcode = find_next_start_code(s->pb, &size, &m->header_state); | 223 | startcode = find_next_start_code(s->pb, &size, &m->header_state); |
| 225 | last_sync = avio_tell(s->pb); | 224 | last_sync = avio_tell(s->pb); |
| 226 | //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, avio_tell(s->pb)); | ||
| 227 | if (startcode < 0){ | 225 | if (startcode < 0){ |
| 228 | if(url_feof(s->pb)) | 226 | if(url_feof(s->pb)) |
| 229 | return AVERROR_EOF; | 227 | return AVERROR_EOF; |
| @@ -1006,7 +1006,10 @@ retry: · 1005 unmodified lines | |||
| 1006 | } | 1006 | } |
| 1007 | 1007 | ||
| 1008 | if(timestamp_packet){ | 1008 | if(timestamp_packet){ |
| 1009 | //av_log(ctx, AV_LOG_DEBUG, "dts:%f pts:%f scr:%f stream:%d\n", timestamp_packet->dts/90000.0, timestamp_packet->pts/90000.0, scr/90000.0, best_i); | 1009 | av_dlog(ctx, "dts:%f pts:%f scr:%f stream:%d\n", |
| 1010 | timestamp_packet->dts / 90000.0, | ||
| 1011 | timestamp_packet->pts / 90000.0, | ||
| 1012 | scr / 90000.0, best_i); | ||
| 1010 | es_size= flush_packet(ctx, best_i, timestamp_packet->pts, timestamp_packet->dts, scr, trailer_size); | 1013 | es_size= flush_packet(ctx, best_i, timestamp_packet->pts, timestamp_packet->dts, scr, trailer_size); |
| 1011 | }else{ | 1014 | }else{ |
| 1012 | assert(av_fifo_size(stream->fifo) == trailer_size); | 1015 | assert(av_fifo_size(stream->fifo) == trailer_size); |
| @@ -1065,7 +1068,9 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) · 52 unmodified lines | |||
| 1065 | dts += 2*preload; | 1068 | dts += 2*preload; |
| 1066 | } | 1069 | } |
| 1067 | 1070 | ||
| 1068 | //av_log(ctx, AV_LOG_DEBUG, "dts:%f pts:%f flags:%d stream:%d nopts:%d\n", dts/90000.0, pts/90000.0, pkt->flags, pkt->stream_index, pts != AV_NOPTS_VALUE); | 1071 | av_dlog(ctx, "dts:%f pts:%f flags:%d stream:%d nopts:%d\n", |
| 1072 | dts / 90000.0, pts / 90000.0, pkt->flags, | ||
| 1073 | pkt->stream_index, pts != AV_NOPTS_VALUE); | ||
| 1069 | if (!stream->premux_packet) | 1074 | if (!stream->premux_packet) |
| 1070 | stream->next_packet = &stream->premux_packet; | 1075 | stream->next_packet = &stream->premux_packet; |
| 1071 | *stream->next_packet= | 1076 | *stream->next_packet= |
| @@ -423,7 +423,8 @@ static int get_packet_size(const uint8_t *buf, int size) · 422 unmodified lines | |||
| 423 | score = analyze(buf, size, TS_PACKET_SIZE, NULL); | 423 | score = analyze(buf, size, TS_PACKET_SIZE, NULL); |
| 424 | dvhs_score = analyze(buf, size, TS_DVHS_PACKET_SIZE, NULL); | 424 | dvhs_score = analyze(buf, size, TS_DVHS_PACKET_SIZE, NULL); |
| 425 | fec_score= analyze(buf, size, TS_FEC_PACKET_SIZE, NULL); | 425 | fec_score= analyze(buf, size, TS_FEC_PACKET_SIZE, NULL); |
| 426 | // av_log(NULL, AV_LOG_DEBUG, "score: %d, dvhs_score: %d, fec_score: %d \n", score, dvhs_score, fec_score); | 426 | av_dlog(NULL, "score: %d, dvhs_score: %d, fec_score: %d \n", |
| 427 | score, dvhs_score, fec_score); | ||
| 427 | 428 | ||
| 428 | if (score > fec_score && score > dvhs_score) return TS_PACKET_SIZE; | 429 | if (score > fec_score && score > dvhs_score) return TS_PACKET_SIZE; |
| 429 | else if(dvhs_score > score && dvhs_score > fec_score) return TS_DVHS_PACKET_SIZE; | 430 | else if(dvhs_score > score && dvhs_score > fec_score) return TS_DVHS_PACKET_SIZE; |
| @@ -1878,7 +1879,8 @@ static int mpegts_probe(AVProbeData *p) · 1448 unmodified lines | |||
| 1878 | score = analyze(p->buf, TS_PACKET_SIZE *check_count, TS_PACKET_SIZE , NULL)*CHECK_COUNT/check_count; | 1879 | score = analyze(p->buf, TS_PACKET_SIZE *check_count, TS_PACKET_SIZE , NULL)*CHECK_COUNT/check_count; |
| 1879 | dvhs_score= analyze(p->buf, TS_DVHS_PACKET_SIZE*check_count, TS_DVHS_PACKET_SIZE, NULL)*CHECK_COUNT/check_count; | 1880 | dvhs_score= analyze(p->buf, TS_DVHS_PACKET_SIZE*check_count, TS_DVHS_PACKET_SIZE, NULL)*CHECK_COUNT/check_count; |
| 1880 | fec_score = analyze(p->buf, TS_FEC_PACKET_SIZE *check_count, TS_FEC_PACKET_SIZE , NULL)*CHECK_COUNT/check_count; | 1881 | fec_score = analyze(p->buf, TS_FEC_PACKET_SIZE *check_count, TS_FEC_PACKET_SIZE , NULL)*CHECK_COUNT/check_count; |
| 1881 | // av_log(NULL, AV_LOG_DEBUG, "score: %d, dvhs_score: %d, fec_score: %d \n", score, dvhs_score, fec_score); | 1882 | av_dlog(NULL, "score: %d, dvhs_score: %d, fec_score: %d \n", |
| 1883 | score, dvhs_score, fec_score); | ||
| 1882 | 1884 | ||
| 1883 | // we need a clear definition for the returned score otherwise things will become messy sooner or later | 1885 | // we need a clear definition for the returned score otherwise things will become messy sooner or later |
| 1884 | if (score > fec_score && score > dvhs_score && score > 6) return AVPROBE_SCORE_MAX + score - CHECK_COUNT; | 1886 | if (score > fec_score && score > dvhs_score && score > 6) return AVPROBE_SCORE_MAX + score - CHECK_COUNT; |
| @@ -1098,7 +1098,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt) · 1097 unmodified lines | |||
| 1098 | 1098 | ||
| 1099 | do { | 1099 | do { |
| 1100 | p = avpriv_mpv_find_start_code(p, buf_end, &state); | 1100 | p = avpriv_mpv_find_start_code(p, buf_end, &state); |
| 1101 | //av_log(s, AV_LOG_INFO, "nal %d\n", state & 0x1f); | 1101 | av_dlog(s, "nal %d\n", state & 0x1f); |
| 1102 | } while (p < buf_end && (state & 0x1f) != 9 && | 1102 | } while (p < buf_end && (state & 0x1f) != 9 && |
| 1103 | (state & 0x1f) != 5 && (state & 0x1f) != 1); | 1103 | (state & 0x1f) != 5 && (state & 0x1f) != 1); |
| 1104 | 1104 | ||
| @@ -2107,7 +2107,7 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket · 2106 unmodified lines | |||
| 2107 | } | 2107 | } |
| 2108 | 2108 | ||
| 2109 | *out = pktl->pkt; | 2109 | *out = pktl->pkt; |
| 2110 | //av_log(s, AV_LOG_DEBUG, "out st:%d dts:%lld\n", (*out).stream_index, (*out).dts); | 2110 | av_dlog(s, "out st:%d dts:%lld\n", (*out).stream_index, (*out).dts); |
| 2111 | s->packet_buffer = pktl->next; | 2111 | s->packet_buffer = pktl->next; |
| 2112 | if(s->streams[pktl->pkt.stream_index]->last_in_packet_buffer == pktl) | 2112 | if(s->streams[pktl->pkt.stream_index]->last_in_packet_buffer == pktl) |
| 2113 | s->streams[pktl->pkt.stream_index]->last_in_packet_buffer= NULL; | 2113 | s->streams[pktl->pkt.stream_index]->last_in_packet_buffer= NULL; |
| @@ -96,16 +96,12 @@ static int find_header_idx(AVFormatContext *s, AVCodecContext *c, int size, int · 95 unmodified lines | |||
| 96 | int i; | 96 | int i; |
| 97 | int len= find_expected_header(c, size, frame_type, out); | 97 | int len= find_expected_header(c, size, frame_type, out); |
| 98 | 98 | ||
| 99 | //av_log(NULL, AV_LOG_ERROR, "expected_h len=%d size=%d codec_id=%d\n", len, size, c->codec_id); | ||
| 100 | |||
| 101 | for(i=1; i<nut->header_count; i++){ | 99 | for(i=1; i<nut->header_count; i++){ |
| 102 | if( len == nut->header_len[i] | 100 | if( len == nut->header_len[i] |
| 103 | && !memcmp(out, nut->header[i], len)){ | 101 | && !memcmp(out, nut->header[i], len)){ |
| 104 | // av_log(NULL, AV_LOG_ERROR, "found %d\n", i); | ||
| 105 | return i; | 102 | return i; |
| 106 | } | 103 | } |
| 107 | } | 104 | } |
| 108 | // av_log(NULL, AV_LOG_ERROR, "nothing found\n"); | ||
| 109 | return 0; | 105 | return 0; |
| 110 | } | 106 | } |
| 111 | 107 | ||
| @@ -358,7 +358,7 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb, · 357 unmodified lines | |||
| 358 | st->codec->codec_tag = avio_rl32(pb); | 358 | st->codec->codec_tag = avio_rl32(pb); |
| 359 | st->codec->codec_id = ff_codec_get_id(ff_rm_codec_tags, | 359 | st->codec->codec_id = ff_codec_get_id(ff_rm_codec_tags, |
| 360 | st->codec->codec_tag); | 360 | st->codec->codec_tag); |
| 361 | // av_log(s, AV_LOG_DEBUG, "%X %X\n", st->codec->codec_tag, MKTAG('R', 'V', '2', '0')); | 361 | av_dlog(s, "%X %X\n", st->codec->codec_tag, MKTAG('R', 'V', '2', '0')); |
| 362 | if (st->codec->codec_id == AV_CODEC_ID_NONE) | 362 | if (st->codec->codec_id == AV_CODEC_ID_NONE) |
| 363 | goto fail1; | 363 | goto fail1; |
| 364 | st->codec->width = avio_rb16(pb); | 364 | st->codec->width = avio_rb16(pb); |
| @@ -1002,7 +1002,8 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index, · 637 unmodified lines | |||
| 1002 | } | 1002 | } |
| 1003 | 1003 | ||
| 1004 | if((flags&2) && (seq&0x7F) == 1){ | 1004 | if((flags&2) && (seq&0x7F) == 1){ |
| 1005 | // av_log(s, AV_LOG_DEBUG, "%d %d-%d %"PRId64" %d\n", flags, stream_index2, stream_index, dts, seq); | 1005 | av_dlog(s, "%d %d-%d %"PRId64" %d\n", |
| 1006 | flags, stream_index2, stream_index, dts, seq); | ||
| 1006 | av_add_index_entry(st, pos, dts, 0, 0, AVINDEX_KEYFRAME); | 1007 | av_add_index_entry(st, pos, dts, 0, 0, AVINDEX_KEYFRAME); |
| 1007 | if(stream_index2 == stream_index) | 1008 | if(stream_index2 == stream_index) |
| 1008 | break; | 1009 | break; |
| @@ -155,8 +155,6 @@ static void rtsp_parse_range_npt(const char *p, int64_t *start, int64_t *end) · 154 unmodified lines | |||
| 155 | get_word_sep(buf, sizeof(buf), "-", &p); | 155 | get_word_sep(buf, sizeof(buf), "-", &p); |
| 156 | av_parse_time(end, buf, 1); | 156 | av_parse_time(end, buf, 1); |
| 157 | } | 157 | } |
| 158 | // av_log(NULL, AV_LOG_DEBUG, "Range Start: %lld\n", *start); | ||
| 159 | // av_log(NULL, AV_LOG_DEBUG, "Range End: %lld\n", *end); | ||
| 160 | } | 158 | } |
| 161 | 159 | ||
| 162 | static int get_sockaddr(const char *buf, struct sockaddr_storage *sock) | 160 | static int get_sockaddr(const char *buf, struct sockaddr_storage *sock) |
| @@ -45,7 +45,6 @@ static int get_swf_tag(AVIOContext *pb, int *len_ptr) · 44 unmodified lines | |||
| 45 | if (len == 0x3f) { | 45 | if (len == 0x3f) { |
| 46 | len = avio_rl32(pb); | 46 | len = avio_rl32(pb); |
| 47 | } | 47 | } |
| 48 | // av_log(NULL, AV_LOG_DEBUG, "Tag: %d - Len: %d\n", tag, len); | ||
| 49 | *len_ptr = len; | 48 | *len_ptr = len; |
| 50 | return tag; | 49 | return tag; |
| 51 | } | 50 | } |
| @@ -1113,8 +1113,8 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, · 1112 unmodified lines | |||
| 1113 | if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts > pkt->dts) | 1113 | if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts > pkt->dts) |
| 1114 | presentation_delayed = 1; | 1114 | presentation_delayed = 1; |
| 1115 | 1115 | ||
| 1116 | // av_log(NULL, AV_LOG_DEBUG, "IN delayed:%d pts:%s, dts:%s cur_dts:%s st:%d pc:%p duration:%d\n", | 1116 | av_dlog(NULL, "IN delayed:%d pts:%s, dts:%s cur_dts:%s st:%d pc:%p duration:%d\n", |
| 1117 | // presentation_delayed, av_ts2str(pkt->pts), av_ts2str(pkt->dts), av_ts2str(st->cur_dts), pkt->stream_index, pc, pkt->duration); | 1117 | presentation_delayed, av_ts2str(pkt->pts), av_ts2str(pkt->dts), av_ts2str(st->cur_dts), pkt->stream_index, pc, pkt->duration); |
| 1118 | /* interpolate PTS and DTS if they are not present */ | 1118 | /* interpolate PTS and DTS if they are not present */ |
| 1119 | //We skip H264 currently because delay and has_b_frames are not reliably set | 1119 | //We skip H264 currently because delay and has_b_frames are not reliably set |
| 1120 | if((delay==0 || (delay==1 && pc)) && st->codec->codec_id != AV_CODEC_ID_H264){ | 1120 | if((delay==0 || (delay==1 && pc)) && st->codec->codec_id != AV_CODEC_ID_H264){ |
| @@ -1182,8 +1182,8 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, · 61 unmodified lines | |||
| 1182 | if(pkt->dts > st->cur_dts) | 1182 | if(pkt->dts > st->cur_dts) |
| 1183 | st->cur_dts = pkt->dts; | 1183 | st->cur_dts = pkt->dts; |
| 1184 | 1184 | ||
| 1185 | // av_log(NULL, AV_LOG_ERROR, "OUTdelayed:%d/%d pts:%s, dts:%s cur_dts:%s\n", | 1185 | av_dlog(NULL, "OUTdelayed:%d/%d pts:%s, dts:%s cur_dts:%s\n", |
| 1186 | // presentation_delayed, delay, av_ts2str(pkt->pts), av_ts2str(pkt->dts), av_ts2str(st->cur_dts)); | 1186 | presentation_delayed, delay, av_ts2str(pkt->pts), av_ts2str(pkt->dts), av_ts2str(st->cur_dts)); |
| 1187 | 1187 | ||
| 1188 | /* update flags */ | 1188 | /* update flags */ |
| 1189 | if (is_intra_only(st->codec)) | 1189 | if (is_intra_only(st->codec)) |
| @@ -3536,7 +3536,8 @@ static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt){ · 2346 unmodified lines | |||
| 3536 | return AVERROR(EINVAL); | 3536 | return AVERROR(EINVAL); |
| 3537 | } | 3537 | } |
| 3538 | 3538 | ||
| 3539 | // av_log(s, AV_LOG_DEBUG, "av_write_frame: pts2:%s dts2:%s\n", av_ts2str(pkt->pts), av_ts2str(pkt->dts)); | 3539 | av_dlog(s, "av_write_frame: pts2:%s dts2:%s\n", |
| 3540 | av_ts2str(pkt->pts), av_ts2str(pkt->dts)); | ||
| 3540 | st->cur_dts= pkt->dts; | 3541 | st->cur_dts= pkt->dts; |
| 3541 | st->pts.val= pkt->dts; | 3542 | st->pts.val= pkt->dts; |
| 3542 | 3543 | ||
| @@ -113,7 +113,6 @@ int main(int argc, char **argv) · 112 unmodified lines | |||
| 113 | (pkt.flags & AV_PKT_FLAG_KEY) ? 'K' : '_'); | 113 | (pkt.flags & AV_PKT_FLAG_KEY) ? 'K' : '_'); |
| 114 | printf(PKTFILESUFF "\n", pktnum, pkt.stream_index, pkt.pts, pkt.size, | 114 | printf(PKTFILESUFF "\n", pktnum, pkt.stream_index, pkt.pts, pkt.size, |
| 115 | (pkt.flags & AV_PKT_FLAG_KEY) ? 'K' : '_'); | 115 | (pkt.flags & AV_PKT_FLAG_KEY) ? 'K' : '_'); |
| 116 | //printf("open(\"%s\")\n", pktfilename); | ||
| 117 | if (!nowrite) { | 116 | if (!nowrite) { |
| 118 | fd = open(pktfilename, O_WRONLY | O_CREAT, 0644); | 117 | fd = open(pktfilename, O_WRONLY | O_CREAT, 0644); |
| 119 | err = write(fd, pkt.data, pkt.size); | 118 | err = write(fd, pkt.data, pkt.size); |