[FFmpeg-devel] [PATCH]Lagarigh Rangecoder v2

Michael Niedermayer michaelni
Fri Sep 18 21:09:40 CEST 2009


On Thu, Sep 17, 2009 at 03:00:10AM -0600, Nathan Caldwell wrote:
> Here's the updated Lagarith range coder with Loren's optimizations.
> Along with Loren's patch to extend ff_inverse by 1, and update it's
> documentation.
> 
> -- 
> -Nathan Caldwell

>  libavcodec/dsputil.c |    5 +++--
>  libavutil/internal.h |    2 +-
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 022809a4d8b423e3c0b77a9577760471f454f308  ff_inverse.diff
> commit 8c34a188a421a7c03b3a36d1595397e643b2a8dc
> Author: Loren Merritt <pengvado at akuvian.org>
> Date:   Sat Sep 5 13:59:36 2009 +0000
> 
>     extend ff_inverse[], and fix its documentation
> 
> diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
> index 758f613..6dfaff6 100644
> --- a/libavcodec/dsputil.c
> +++ b/libavcodec/dsputil.c
> @@ -110,8 +110,8 @@ const uint8_t ff_alternate_vertical_scan[64] = {
>      38, 46, 54, 62, 39, 47, 55, 63,
>  };
>  
> -/* a*inverse[b]>>32 == a/b for all 0<=a<=65536 && 2<=b<=255 */
> -const uint32_t ff_inverse[256]={
> +/* a*inverse[b]>>32 == a/b for all 0<=a<=16909558 && 2<=b<=256 */
> +const uint32_t ff_inverse[257]={
>           0, 4294967295U,2147483648U,1431655766, 1073741824,  858993460,  715827883,  613566757,
>   536870912,  477218589,  429496730,  390451573,  357913942,  330382100,  306783379,  286331154,
>   268435456,  252645136,  238609295,  226050911,  214748365,  204522253,  195225787,  186737709,
> @@ -144,6 +144,7 @@ const uint32_t ff_inverse[256]={
>    18512791,   18433337,   18354562,   18276457,   18199014,   18122225,   18046082,   17970575,
>    17895698,   17821442,   17747799,   17674763,   17602325,   17530479,   17459217,   17388532,
>    17318417,   17248865,   17179870,   17111424,   17043522,   16976156,   16909321,   16843010,
> +  16777216
>  };
>  
>  /* Input permutation for the simple_idct_mmx */
> diff --git a/libavutil/internal.h b/libavutil/internal.h
> index 38bca42..0e37a94 100644
> --- a/libavutil/internal.h
> +++ b/libavutil/internal.h
> @@ -124,7 +124,7 @@
>  
>  /* math */
>  
> -extern const uint32_t ff_inverse[256];
> +extern const uint32_t ff_inverse[257];
>  
>  #if ARCH_X86
>  #    define FASTDIV(a,b) \

if this has been exhaustively tested or proofen (in the mathematical sense)
then the patch above is ok

[...2nd patch ...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- 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/20090918/3ba295f9/attachment.pgp>



More information about the ffmpeg-devel mailing list