comparison mpeg12.c @ 1710:4a68b20eeb2c libavcodec

print vbv buffer size & bitrate when decoding with -debug 1
author michael
date Thu, 01 Jan 2004 02:56:35 +0000
parents dea5b2946999
children 8158e66f1f75
comparison
equal deleted inserted replaced
1709:39a209b0c82c 1710:4a68b20eeb2c
1823 s->width |= (horiz_size_ext << 12); 1823 s->width |= (horiz_size_ext << 12);
1824 s->height |= (vert_size_ext << 12); 1824 s->height |= (vert_size_ext << 12);
1825 bit_rate_ext = get_bits(&s->gb, 12); /* XXX: handle it */ 1825 bit_rate_ext = get_bits(&s->gb, 12); /* XXX: handle it */
1826 s->bit_rate = ((s->bit_rate / 400) | (bit_rate_ext << 12)) * 400; 1826 s->bit_rate = ((s->bit_rate / 400) | (bit_rate_ext << 12)) * 400;
1827 skip_bits1(&s->gb); /* marker */ 1827 skip_bits1(&s->gb); /* marker */
1828 vbv_buf_ext = get_bits(&s->gb, 8); 1828 s->avctx->rc_buffer_size += get_bits(&s->gb, 8)*1024*16<<10;
1829 1829
1830 s->low_delay = get_bits1(&s->gb); 1830 s->low_delay = get_bits1(&s->gb);
1831 if(s->flags & CODEC_FLAG_LOW_DELAY) s->low_delay=1; 1831 if(s->flags & CODEC_FLAG_LOW_DELAY) s->low_delay=1;
1832 1832
1833 frame_rate_ext_n = get_bits(&s->gb, 2); 1833 frame_rate_ext_n = get_bits(&s->gb, 2);
1852 (AVRational){s->width, s->height} 1852 (AVRational){s->width, s->height}
1853 ); 1853 );
1854 } 1854 }
1855 1855
1856 if(s->avctx->debug & FF_DEBUG_PICT_INFO) 1856 if(s->avctx->debug & FF_DEBUG_PICT_INFO)
1857 av_log(s->avctx, AV_LOG_DEBUG, "profile: %d, level: %d \n", profile, level); 1857 av_log(s->avctx, AV_LOG_DEBUG, "profile: %d, level: %d vbv buffer: %d, bitrate:%d\n",
1858 profile, level, s->avctx->rc_buffer_size, s->bit_rate);
1858 } 1859 }
1859 1860
1860 static void mpeg_decode_sequence_display_extension(Mpeg1Context *s1) 1861 static void mpeg_decode_sequence_display_extension(Mpeg1Context *s1)
1861 { 1862 {
1862 MpegEncContext *s= &s1->mpeg_enc_ctx; 1863 MpegEncContext *s= &s1->mpeg_enc_ctx;
2389 return -1; 2390 return -1;
2390 s1->mpeg_enc_ctx_allocated = 1; 2391 s1->mpeg_enc_ctx_allocated = 1;
2391 s->swap_uv = 0;//just in case vcr2 and mpeg2 stream have been concatinated 2392 s->swap_uv = 0;//just in case vcr2 and mpeg2 stream have been concatinated
2392 } 2393 }
2393 2394
2394 skip_bits(&s->gb, 10); /* vbv_buffer_size */ 2395 s->avctx->rc_buffer_size= get_bits(&s->gb, 10) * 1024*16;
2395 skip_bits(&s->gb, 1); 2396 skip_bits(&s->gb, 1);
2396 2397
2397 /* get matrix */ 2398 /* get matrix */
2398 if (get_bits1(&s->gb)) { 2399 if (get_bits1(&s->gb)) {
2399 for(i=0;i<64;i++) { 2400 for(i=0;i<64;i++) {
2444 s->picture_structure = PICT_FRAME; 2445 s->picture_structure = PICT_FRAME;
2445 s->frame_pred_frame_dct = 1; 2446 s->frame_pred_frame_dct = 1;
2446 s->codec_id= s->avctx->codec_id= CODEC_ID_MPEG1VIDEO; 2447 s->codec_id= s->avctx->codec_id= CODEC_ID_MPEG1VIDEO;
2447 avctx->sub_id = 1; /* indicates mpeg1 */ 2448 avctx->sub_id = 1; /* indicates mpeg1 */
2448 if(s->flags & CODEC_FLAG_LOW_DELAY) s->low_delay=1; 2449 if(s->flags & CODEC_FLAG_LOW_DELAY) s->low_delay=1;
2450
2451 if(s->avctx->debug & FF_DEBUG_PICT_INFO)
2452 av_log(s->avctx, AV_LOG_DEBUG, "vbv buffer: %d, bitrate:%d\n",
2453 s->avctx->rc_buffer_size, s->bit_rate);
2454
2449 return 0; 2455 return 0;
2450 } 2456 }
2451 2457
2452 static int vcr2_init_sequence(AVCodecContext *avctx) 2458 static int vcr2_init_sequence(AVCodecContext *avctx)
2453 { 2459 {