[FFmpeg-devel] [PATCH] avcodec/vc1: correct aspect ratio calculation

Carl Eugen Hoyos ceffmpeg at gmail.com
Wed Nov 14 19:16:50 EET 2018


2018-11-14 17:16 GMT+01:00, Jerome Borsboom <jerome.borsboom at carpalis.nl>:
>>> +    av_reduce(&avctx->sample_aspect_ratio.num,
>>> +              &avctx->sample_aspect_ratio.den,
>>> +              v->disp_horiz_size * v->aspect_ratio.num * h,
>>> +              v->disp_vert_size * v->aspect_ratio.den * w,
>>> +              1 << 30);
>>
>>> +    ff_set_sar(avctx, avctx->sample_aspect_ratio);
>>
>> I would have expected these two statements to be redundant -
>> am I wrong?

> av_reduce takes out the greatest common divisor and puts a bound on the
> individual fraction numbers. ff_set_sar checks that the SAR makes sense
> in relation to the image size. Although, the code is reassigning
> avctx->sample_aspect_ratio to itself in ff_set_sar, the different checks
> make both statements necessary.

Thank you!

Carl Eugen


More information about the ffmpeg-devel mailing list