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

Michael Niedermayer michaelni
Sat Feb 28 20:31:48 CET 2009


On Sat, Feb 28, 2009 at 08:13:45PM +0100, Reimar D?ffinger wrote:
> 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.

something like
split a in its prime factors p0^n0*p1^n1*...
split b in its prime factors p0^m0*p1^m1*...
p0 is the first prime number (2)
p1 is the second prime number (3)
...

g= product of all pi^MIN(ni,mi)
for gcd(0,0) though you get 1 not 0

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090228/21dc6a55/attachment.pgp>



More information about the ffmpeg-devel mailing list