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

Diego Biurrun diego
Sun Jan 23 17:37:03 CET 2011


On Sun, Jan 23, 2011 at 01:24:50PM +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
>  
>  # ifdef ALT_BITSTREAM_READER_LE
> -#   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 SKIP_CACHE(name, gb, num)\
> -        name##_cache >>= (num)
> +#   define SKIP_CACHE(name, gb, num) name##_cache >>= (num)
>  # else
> -#   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)

Spaces around + and >> would make this more readable.

> @@ -409,38 +391,38 @@ static inline int check_marker(GetBitContext *s, const char *msg)
>  static inline void init_get_bits(GetBitContext *s,
>                     const uint8_t *buffer, int bit_size)
>  {
> -    int buffer_size= (bit_size+7)>>3;
> -    if(buffer_size < 0 || bit_size < 0) {
> +    int buffer_size = (bit_size+7)>>3;
> +    if (buffer_size < 0 || bit_size < 0) {

same

Push it anytime, with or without the suggested changes.

Diego



More information about the ffmpeg-devel mailing list