[FFmpeg-devel] [PATCH 3/4] Sanitise get_bits macros, part 2

Diego Biurrun diego
Sun Jan 23 09:45:26 CET 2011


On Sun, Jan 23, 2011 at 02:35:51AM +0000, Mans Rullgard wrote:
> These whitespace changes improve the readability of the get_bits
> macros.
> 
> --- a/libavcodec/get_bits.h
> +++ b/libavcodec/get_bits.h
> @@ -125,56 +125,46 @@ for examples see get_bits, show_bits, skip_bits, get_vlc
>  
> -#   define UPDATE_CACHE(name, gb)\
> -        name##_cache= AV_RL32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) >> (name##_index&0x07)
> +#   define UPDATE_CACHE(name, gb) \
> +    name##_cache = AV_RL32(((const uint8_t *)(gb)->buffer)+(name##_index>>3)) >> (name##_index&0x07)
>  
> -#   define UPDATE_CACHE(name, gb)\
> -        name##_cache= AV_RB32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) << (name##_index&0x07)
> +#   define UPDATE_CACHE(name, gb) \
> +    name##_cache = AV_RB32(((const uint8_t *)(gb)->buffer)+(name##_index>>3)) << (name##_index&0x07)
>  
> @@ -409,38 +391,38 @@ static inline int check_marker(GetBitContext *s, const char *msg)
>  
>  #elif defined A32_BITSTREAM_READER
> -    s->buffer_ptr = (uint32_t*)((intptr_t)buffer&(~3));
> -    s->bit_count = 32 + 8*((intptr_t)buffer&3);
> +    s->buffer_ptr   = (uint32_t*)((intptr_t)buffer&(~3));
> +    s->bit_count    = 32 + 8*((intptr_t)buffer&3);


While you are changing these lines anyway, I think a few more spaces
around operators would make this more readable.

> @@ -552,38 +531,45 @@ static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2],
>  static inline void print_bin(int bits, int n){
>      int i;
>  
> -    for(i=n-1; i>=0; i--){
> +    for (i = n-1; i >= 0; i--) {
>          av_log(NULL, AV_LOG_DEBUG, "%d", (bits>>i)&1);
>      }
> -    for(i=n; i<24; i++)
> +    for(i = n; i < 24; i++)

for (


OK otherwise

Diego



More information about the ffmpeg-devel mailing list