diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2003-10-20 23:24:39 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2003-10-20 23:24:39 +0000 |
commit | 5c9e4723e054701a645673bb49328702bbc9e1cc (patch) | |
tree | 4f35a98a8084bb17bd64c81a30d1bb4ae7bcf53d | |
parent | 5ed9f2e5aaa922b423e87a1b812ca5489238d08e (diff) | |
download | ffmpeg-5c9e4723e054701a645673bb49328702bbc9e1cc.tar.gz |
mpeg2 aspect ratio encoding fixed
Originally committed as revision 2406 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/mpeg12.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index f054e00d0d..cd3a725aec 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -219,7 +219,12 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) put_bits(&s->pb, 12, s->height); for(i=1; i<15; i++){ - float error= mpeg1_aspect[i] - aspect_ratio; + float error= aspect_ratio; + if(s->codec_id == CODEC_ID_MPEG1VIDEO || i <=1) + error-= mpeg1_aspect[i]; + else + error-= av_q2d(mpeg2_aspect[i])*s->height/s->width; + error= ABS(error); if(error < best_aspect_error){ @@ -2252,7 +2257,7 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx, s->aspect_ratio_info= get_bits(&s->gb, 4); if(s->codec_id == CODEC_ID_MPEG1VIDEO){ aspect= mpeg1_aspect[s->aspect_ratio_info]; - if(aspect!=0.0) avctx->sample_aspect_ratio= av_d2q(aspect, 30000); + if(aspect!=0.0) avctx->sample_aspect_ratio= av_d2q(aspect, 255); } s->frame_rate_index = get_bits(&s->gb, 4); |