[FFmpeg-devel] [PATCH/RFC] honor DAR aspect ratio in nuv files.

elupus elupus
Thu Jul 24 22:52:24 CEST 2008


On Thu, 24 Jul 2008 20:46:33 +0200, Reimar D?ffinger wrote:

> Hello,
>> diff --git a/libavformat/nuv.c b/libavformat/nuv.c
>> index 74393af..a32dc2c 100644
>> --- a/libavformat/nuv.c
>> +++ b/libavformat/nuv.c
>> @@ -137,6 +137,8 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
>>      get_byte(pb); // 'P' == progressive, 'I' == interlaced
>>      url_fskip(pb, 3); // padding
>>      aspect = av_int2dbl(get_le64(pb));
>> +    if(aspect > 0.9999 && aspect < 1.0001)
>> +        aspect = 4.0 / 3.0;
>>      fps = av_int2dbl(get_le64(pb));
> 
> I guess this is like that in MythTV? Then it probably is best to keep
> like that, but why not
> if (aspect == 1)
> ? Any reason to believe that this is one of the cases where a floating
> point comparison actually can be a problem, or paranoia, or maybe
> someone just reading about the issue and not understanding it (or, of
> course, me never understanding the issue, not unlikely since I always
> considered it a non-issue)?
> Or did the old muxer actually write different values there?

This is how its done in MythTV's demuxer. Not sure we can be 100% sure all
files will have been stored with an exact 1.

>> @@ -156,7 +158,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
>>          vst->codec->width = width;
>>          vst->codec->height = height;
>>          vst->codec->bits_per_sample = 10;
>> -        vst->codec->sample_aspect_ratio = av_d2q(aspect, 10000);
>> +        vst->codec->sample_aspect_ratio = av_d2q(aspect*height/width, 10000);
> 
> 
> I applied that part.
> 
> Greetings,
> Reimar D?ffinger

Heh, and in doing that you broke all old nuv files :). Without the first
part, they break.

Regards
Joakim





More information about the ffmpeg-devel mailing list