media/libtheora/lib/bitpack.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libtheora/lib/bitpack.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,76 @@
     1.4 +/********************************************************************
     1.5 + *                                                                  *
     1.6 + * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE.   *
     1.7 + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
     1.8 + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
     1.9 + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
    1.10 + *                                                                  *
    1.11 + * THE OggTheora SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
    1.12 + * by the Xiph.Org Foundation and contributors http://www.xiph.org/ *
    1.13 + *                                                                  *
    1.14 + ********************************************************************
    1.15 +
    1.16 +  function: packing variable sized words into an octet stream
    1.17 +  last mod: $Id: bitwise.c 7675 2004-09-01 00:34:39Z xiphmont $
    1.18 +
    1.19 + ********************************************************************/
    1.20 +#if !defined(_bitpack_H)
    1.21 +# define _bitpack_H (1)
    1.22 +# include <stddef.h>
    1.23 +# include <limits.h>
    1.24 +# include "internal.h"
    1.25 +
    1.26 +
    1.27 +
    1.28 +typedef size_t             oc_pb_window;
    1.29 +typedef struct oc_pack_buf oc_pack_buf;
    1.30 +
    1.31 +
    1.32 +
    1.33 +/*Custom bitpacker implementations.*/
    1.34 +# if defined(OC_ARM_ASM)
    1.35 +#  include "arm/armbits.h"
    1.36 +# endif
    1.37 +
    1.38 +# if !defined(oc_pack_read)
    1.39 +#  define oc_pack_read oc_pack_read_c
    1.40 +# endif
    1.41 +# if !defined(oc_pack_read1)
    1.42 +#  define oc_pack_read1 oc_pack_read1_c
    1.43 +# endif
    1.44 +# if !defined(oc_huff_token_decode)
    1.45 +#  define oc_huff_token_decode oc_huff_token_decode_c
    1.46 +# endif
    1.47 +
    1.48 +# define OC_PB_WINDOW_SIZE ((int)sizeof(oc_pb_window)*CHAR_BIT)
    1.49 +/*This is meant to be a large, positive constant that can still be efficiently
    1.50 +   loaded as an immediate (on platforms like ARM, for example).
    1.51 +  Even relatively modest values like 100 would work fine.*/
    1.52 +# define OC_LOTS_OF_BITS (0x40000000)
    1.53 +
    1.54 +
    1.55 +
    1.56 +struct oc_pack_buf{
    1.57 +  const unsigned char *stop;
    1.58 +  const unsigned char *ptr;
    1.59 +  oc_pb_window         window;
    1.60 +  int                  bits;
    1.61 +  int                  eof;
    1.62 +};
    1.63 +
    1.64 +void oc_pack_readinit(oc_pack_buf *_b,unsigned char *_buf,long _bytes);
    1.65 +int oc_pack_look1(oc_pack_buf *_b);
    1.66 +void oc_pack_adv1(oc_pack_buf *_b);
    1.67 +/*Here we assume 0<=_bits&&_bits<=32.*/
    1.68 +long oc_pack_read_c(oc_pack_buf *_b,int _bits);
    1.69 +int oc_pack_read1_c(oc_pack_buf *_b);
    1.70 +/* returns -1 for read beyond EOF, or the number of whole bytes available */
    1.71 +long oc_pack_bytes_left(oc_pack_buf *_b);
    1.72 +
    1.73 +/*These two functions are implemented locally in huffdec.c*/
    1.74 +/*Read in bits without advancing the bitptr.
    1.75 +  Here we assume 0<=_bits&&_bits<=32.*/
    1.76 +/*static int oc_pack_look(oc_pack_buf *_b,int _bits);*/
    1.77 +/*static void oc_pack_adv(oc_pack_buf *_b,int _bits);*/
    1.78 +
    1.79 +#endif

mercurial