Mercurial > libavcodec.hg
comparison parser.c @ 2270:21f450be6cb5 libavcodec
lowres width/height cleanup 3rd try
author | michael |
---|---|
date | Mon, 27 Sep 2004 11:50:56 +0000 |
parents | 535b7dfee202 |
children | d02fb928ca44 |
comparison
equal
deleted
inserted
replaced
2269:535b7dfee202 | 2270:21f450be6cb5 |
---|---|
297 break; | 297 break; |
298 case SEQ_START_CODE: | 298 case SEQ_START_CODE: |
299 if (bytes_left >= 4) { | 299 if (bytes_left >= 4) { |
300 pc->width = (buf[0] << 4) | (buf[1] >> 4); | 300 pc->width = (buf[0] << 4) | (buf[1] >> 4); |
301 pc->height = ((buf[1] & 0x0f) << 8) | buf[2]; | 301 pc->height = ((buf[1] & 0x0f) << 8) | buf[2]; |
302 avctx->width = -((-pc->width )>>avctx->lowres); | 302 avcodec_set_dimensions(avctx, pc->width, pc->height); |
303 avctx->height = -((-pc->height)>>avctx->lowres); | |
304 frame_rate_index = buf[3] & 0xf; | 303 frame_rate_index = buf[3] & 0xf; |
305 pc->frame_rate = avctx->frame_rate = frame_rate_tab[frame_rate_index]; | 304 pc->frame_rate = avctx->frame_rate = frame_rate_tab[frame_rate_index]; |
306 avctx->frame_rate_base = MPEG1_FRAME_RATE_BASE; | 305 avctx->frame_rate_base = MPEG1_FRAME_RATE_BASE; |
307 avctx->codec_id = CODEC_ID_MPEG1VIDEO; | 306 avctx->codec_id = CODEC_ID_MPEG1VIDEO; |
308 avctx->sub_id = 1; | 307 avctx->sub_id = 1; |
320 frame_rate_ext_d = (buf[5] & 0x1f); | 319 frame_rate_ext_d = (buf[5] & 0x1f); |
321 pc->progressive_sequence = buf[1] & (1 << 3); | 320 pc->progressive_sequence = buf[1] & (1 << 3); |
322 | 321 |
323 pc->width |=(horiz_size_ext << 12); | 322 pc->width |=(horiz_size_ext << 12); |
324 pc->height |=( vert_size_ext << 12); | 323 pc->height |=( vert_size_ext << 12); |
325 avctx->width = -((-pc->width )>>avctx->lowres); | 324 avcodec_set_dimensions(avctx, pc->width, pc->height); |
326 avctx->height = -((-pc->height)>>avctx->lowres); | |
327 avctx->frame_rate = pc->frame_rate * (frame_rate_ext_n + 1); | 325 avctx->frame_rate = pc->frame_rate * (frame_rate_ext_n + 1); |
328 avctx->frame_rate_base = MPEG1_FRAME_RATE_BASE * (frame_rate_ext_d + 1); | 326 avctx->frame_rate_base = MPEG1_FRAME_RATE_BASE * (frame_rate_ext_d + 1); |
329 avctx->codec_id = CODEC_ID_MPEG2VIDEO; | 327 avctx->codec_id = CODEC_ID_MPEG2VIDEO; |
330 avctx->sub_id = 2; /* forces MPEG2 */ | 328 avctx->sub_id = 2; /* forces MPEG2 */ |
331 } | 329 } |
439 } | 437 } |
440 | 438 |
441 init_get_bits(gb, buf, 8 * buf_size); | 439 init_get_bits(gb, buf, 8 * buf_size); |
442 ret = ff_mpeg4_decode_picture_header(s, gb); | 440 ret = ff_mpeg4_decode_picture_header(s, gb); |
443 if (s->width) { | 441 if (s->width) { |
444 avctx->width = -((-s->width )>>avctx->lowres); | 442 avcodec_set_dimensions(avctx, s->width, s->height); |
445 avctx->height = -((-s->height)>>avctx->lowres); | |
446 } | 443 } |
447 pc->first_picture = 0; | 444 pc->first_picture = 0; |
448 return ret; | 445 return ret; |
449 } | 446 } |
450 | 447 |