[FFmpeg-devel] [PATCH] get/show_bits() can read up to MIN_CACHE_BITS bits

Måns Rullgård mans
Mon Feb 22 01:26:55 CET 2010


Stefan Gehrer <stefan.gehrer at gmx.de> writes:

> Mans Rullgard wrote:
>> The limit for get/show_bits_long() to use get/show_bits() directly
>> should be MIN_CACHE_BITS, not 17.
>
> I think something like attached should go with it.
> Index: libavcodec/get_bits.h
> ===================================================================
> --- libavcodec/get_bits.h	(revision 21936)
> +++ libavcodec/get_bits.h	(working copy)
> @@ -356,7 +356,7 @@
>  }
>  
>  /**
> - * reads 1-17 bits.
> + * reads between 1 and MIN_CACHE_BITS bits.
>   * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't
>   */
>  static inline unsigned int get_bits(GetBitContext *s, int n){
> @@ -370,7 +370,7 @@
>  }
>  
>  /**
> - * shows 1-17 bits.
> + * shows between 1 and MIN_CACHE_BITS bits.
>   * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't
>   */
>  static inline unsigned int show_bits(GetBitContext *s, int n){

I disagree.  17 is the maximum number of bits guaranteed to be
readable with any choice of implementation.  If you want to improve
the documentation, you should explain how MIN_CACHE_BITS is assigned
somewhere.  You should also make it clear that a specific reader
should be forced only in special cases.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list