Mark Thompson:
> On 30/04/2025 19:26, Andreas Rheinhardt wrote:
>> Patch attached.
>>
>> - Andreas
> 
> Hmm, the spec does write exactly this but also defines << as arithmetic left 
> shift of a two's complement representation so it works.
> 
> Seems fair, LGTM.
> 
> More generally this line is not robust to extreme values (can integer 
> overflow 32 bits), but the cases which do this are not useful and won't be in 
> real streams (if calculated at full precision they would always be far 
> outside the possible coefficient range from a forward transform, so it takes 
> a crafted encoder to make them).
> 
> Possibly a pre-clip to a calculated range which ensures it doesn't go too far 
> outside the following clip range is the right answer to avoid the overflow?  
> I will think about this a bit more.
> 

If it does not happen for real files, our usual answer is to use
unsigned types where overflow is defined.

- Andreas

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to