Mercurial > libavcodec.hg
comparison h263dec.c @ 880:1c32039e7215 libavcodec
aspect ratio cleanup
author | michaelni |
---|---|
date | Wed, 20 Nov 2002 13:08:04 +0000 |
parents | eacc2dd8fd9d |
children | 35d28522a1c5 |
comparison
equal
deleted
inserted
replaced
879:af969e91f422 | 880:1c32039e7215 |
---|---|
346 UINT8 *buf, int buf_size) | 346 UINT8 *buf, int buf_size) |
347 { | 347 { |
348 MpegEncContext *s = avctx->priv_data; | 348 MpegEncContext *s = avctx->priv_data; |
349 int ret,i; | 349 int ret,i; |
350 AVPicture *pict = data; | 350 AVPicture *pict = data; |
351 float new_aspect; | |
352 | |
351 #ifdef PRINT_FRAME_TIME | 353 #ifdef PRINT_FRAME_TIME |
352 uint64_t time= rdtsc(); | 354 uint64_t time= rdtsc(); |
353 #endif | 355 #endif |
354 #ifdef DEBUG | 356 #ifdef DEBUG |
355 printf("*****frame %d size=%d\n", avctx->frame_number, buf_size); | 357 printf("*****frame %d size=%d\n", avctx->frame_number, buf_size); |
493 | 495 |
494 /* After H263 & mpeg4 header decode we have the height, width,*/ | 496 /* After H263 & mpeg4 header decode we have the height, width,*/ |
495 /* and other parameters. So then we could init the picture */ | 497 /* and other parameters. So then we could init the picture */ |
496 /* FIXME: By the way H263 decoder is evolving it should have */ | 498 /* FIXME: By the way H263 decoder is evolving it should have */ |
497 /* an H263EncContext */ | 499 /* an H263EncContext */ |
500 if(s->aspected_height) | |
501 new_aspect= (float)s->aspected_width / (float)s->aspected_height; | |
502 else | |
503 new_aspect=0; | |
504 | |
498 if ( s->width != avctx->width || s->height != avctx->height | 505 if ( s->width != avctx->width || s->height != avctx->height |
499 || avctx->aspect_ratio_info != s->aspect_ratio_info | 506 || ABS(new_aspect - avctx->aspect_ratio) > 0.001) { |
500 || avctx->aspected_width != s->aspected_width | |
501 || avctx->aspected_height != s->aspected_height) { | |
502 /* H.263 could change picture size any time */ | 507 /* H.263 could change picture size any time */ |
503 MPV_common_end(s); | 508 MPV_common_end(s); |
504 s->context_initialized=0; | 509 s->context_initialized=0; |
505 } | 510 } |
506 if (!s->context_initialized) { | 511 if (!s->context_initialized) { |
507 avctx->width = s->width; | 512 avctx->aspect_ratio= new_aspect; |
508 avctx->height = s->height; | |
509 avctx->aspect_ratio_info= s->aspect_ratio_info; | |
510 if (s->aspect_ratio_info == FF_ASPECT_EXTENDED) | |
511 { | |
512 avctx->aspected_width = s->aspected_width; | |
513 avctx->aspected_height = s->aspected_height; | |
514 } | |
515 | 513 |
516 goto retry; | 514 goto retry; |
517 } | 515 } |
518 | 516 |
519 if((s->codec_id==CODEC_ID_H263 || s->codec_id==CODEC_ID_H263P)) | 517 if((s->codec_id==CODEC_ID_H263 || s->codec_id==CODEC_ID_H263P)) |