[FFmpeg-devel] [PATCH 1/3] adler32: avoid "too big" check in the inner loop

Michael Niedermayer michaelni at gmx.at
Sat Feb 4 05:43:24 CET 2012


On Fri, Feb 03, 2012 at 10:51:01PM +0100, Reimar Döffinger wrote:
> 
> 
> On 3 Feb 2012, at 22:20, Michael Niedermayer <michaelni at gmx.at> wrote:
> 
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> > libavutil/adler32.c |   14 ++++++++++----
> > 1 files changed, 10 insertions(+), 4 deletions(-)
> > 
> > diff --git a/libavutil/adler32.c b/libavutil/adler32.c
> > index f4f56ea..9ea639f 100644
> > --- a/libavutil/adler32.c
> > +++ b/libavutil/adler32.c
> > @@ -37,17 +37,23 @@ unsigned long av_adler32_update(unsigned long adler, const uint8_t * buf,
> >     unsigned long s2 = adler >> 16;
> > 
> >     while (len > 0) {
> > +        unsigned len2=(len-1) & ~15;
> > +        if (len2 > 2048) len2 = 2048;
> 
> I would suggest FFALIGN and FFMIN.

i added FFMIN() but not FFALIGN because the FFALIGN operation rounds
up and we need quite specific round down with at least 1 remaining
here. It could be used of course but it feels quite unintuitiv to me.

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

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120204/f4c0e366/attachment.asc>


More information about the ffmpeg-devel mailing list