[FFmpeg-devel] [PATCH] Document av_gcd()

Reimar Döffinger Reimar.Doeffinger
Sat Feb 28 20:13:45 CET 2009

On Sat, Feb 28, 2009 at 07:51:22PM +0100, Michael Niedermayer wrote:
> you can from libav* but i dont want to gurantee this to all applications
> maybe the 0 case could be relaxed ... dunno if theres a implementation
> for which it would be annoying

I just don't want anyone to optimize it and break existing code with
no-one realizing it.
Maybe e.g. just documenting that the =0 case is used in lav* in the .c
file is ok...

> and mathematically one can define it as
> ae + bf = g
> with e,f in Z and g being the smallest number >0
> with that you have a gcd that works with numbers out of R as long as
> a/b or b/a is in Q

It can also be defined via the norm that is based on how often a certain
prime number p appears when you split the number in its prime factors
(sorry, I forgot half of the details and don't know the English words
for the other half ;-) ), that results in gcd(0, 0) = 0.
I am not aware of a convincing argument why for negative numbers the
sign of the gcd should be one way and not the other though...

More information about the ffmpeg-devel mailing list