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

Reimar Döffinger Reimar.Doeffinger
Thu Jul 24 20:46:33 CEST 2008


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?

> @@ -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




More information about the ffmpeg-devel mailing list