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

Jerome Borsboom jerome.borsboom at carpalis.nl
Fri Nov 16 19:19:02 EET 2018


> Hi
> 
[...]
> 
> iam not sure this is valid C and not undefined
> 
> but either way this patch breaks fate
> 
> TEST    vc1-ism
> --- ./tests/ref/fate/vc1-ism	2018-11-13 19:52:23.489023763 +0100
> +++ tests/data/fate/vc1-ism	2018-11-14 21:50:11.522992878 +0100
> @@ -2,7 +2,7 @@
>  #media_type 0: video
>  #codec_id 0: rawvideo
>  #dimensions 0: 240x104
> -#sar 0: 156/156
> +#sar 0: 13/30
>  0,          0,          0,        1,    37440, 0xd1bc5235
>  0,          2,          2,        1,    37440, 0x158e6167
>  0,          3,          3,        1,    37440, 0x0faa4481
> Test vc1-ism failed. Look at tests/data/fate/vc1-ism.err for details.
> make: *** [fate-vc1-ism] Error 1
> 

Thank you for the catch. Although 

v->aspect_ratio = (AVRational){get_bits(gb, 8) + 1, get_bits(gb, 8) + 1};

is valid in C99, the order of evaluation of the initialization arguments is
indeed undefined. In C90 the arguments must be constant expressions, so the
previous line in which variables were used was not allowed either according
to the developer documentation.



More information about the ffmpeg-devel mailing list