# [FFmpeg-devel] [PATCH] Improve documentation for libavutil/base64.h

Stefano Sabatini stefano.sabatini-lala
Wed Jan 28 01:03:29 CET 2009

```On date Tuesday 2009-01-27 02:58:03 +0100, Michael Niedermayer encoded:
> On Tue, Jan 27, 2009 at 12:45:31AM +0100, Stefano Sabatini wrote:
> > On date Sunday 2009-01-25 22:51:53 +0100, Michael Niedermayer encoded:
[...]
> > > Well my point is the user should neither depend on the implementation nor
> > > should he need precisse knowledge of base64 coding, and a len%3+1-len/123+98
> > > is a little much for just avoiding 1 or 2 bytes overallocation
> > >
> > > anyway my wild guess is that (len+2)/3*4+1 might be minimal
> >
> > floor (4/3 * (L + 2)) = floor (4/3 * (L'  + R + 2)) =
>
> this is not the same to what i wrote
> i used C semantics you clearly do not (4/3=1 in C)

Yes and the demonstration was also wrong (floor (A + B) != floor(A) +
floor(B)).

Anyway your guess looks correct, since I cannot costrict my
mathematical compulsion I'll inflict to you this other (undoubtedly
flawed) demonstration:

floor ((L + M-1) / M)

L = L' + R, L' being a multiple of L', 0 < R < (M-1)

L'' = smaller multiple of M greater or equal to L

if R = 0, L' = L''

and we have:
floor ((L'' + M-1) / M) = L''/M

if R > 0, L' < L'' and we have L' + R = L'' + R', R' < M, thus:
floor ((L'' + R') / M) = L''/M

In this case so we have:
floor (4 * (L+2) / 3) = L'' / 3 *4

...

Reattaching the patch after another auto-review, I hope it addresses

Regards.
--
FFmpeg = Fast & Friendly Multipurpose Pitiless EniGma
-------------- next part --------------
A non-text attachment was scrubbed...
Name: doxy-for-base64-02.patch
Type: text/x-diff
Size: 1497 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090128/16097d84/attachment.patch>

```