[FFmpeg-devel] [PATCH] Document av_gcd()
Reimar Döffinger
Reimar.Doeffinger
Sat Feb 28 20:56:00 CET 2009
On Sat, Feb 28, 2009 at 08:31:48PM +0100, Michael Niedermayer wrote:
> 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
No, that would not result in a norm I think, I meant this:
http://mathworld.wolfram.com/p-adicNorm.html
The p-adic norm of the gcd would be the maximum of the p-adic norms
of the two numbers, and only gcd(0,0) = 0 is consistent with that.
More information about the ffmpeg-devel
mailing list