[FFmpeg-devel] [PATCH] Remove final semicolons from get_bits macros
Mans Rullgard
mans
Fri Feb 19 14:31:04 CET 2010
Some of the macros in get_bits.h include a final semicolon. This
removes them and adds semicolons as necessary where these macros
are invoked.
Tested with all three readers.
---
libavcodec/get_bits.h | 118 ++++++++++++++++++++++++------------------------
libavcodec/mjpegdec.c | 24 +++++-----
2 files changed, 71 insertions(+), 71 deletions(-)
diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index bb40ff4..7a30e88 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -132,37 +132,37 @@ for examples see get_bits, show_bits, skip_bits, get_vlc
# define OPEN_READER(name, gb)\
unsigned int name##_index= (gb)->index;\
- int name##_cache= 0;\
+ int name##_cache= 0
# define CLOSE_READER(name, gb)\
- (gb)->index= name##_index;\
+ (gb)->index= name##_index
# 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);\
+ name##_cache= AV_RL32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) >> (name##_index&0x07)
# define SKIP_CACHE(name, gb, num)\
- name##_cache >>= (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);\
+ name##_cache= AV_RB32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) << (name##_index&0x07)
# define SKIP_CACHE(name, gb, num)\
- name##_cache <<= (num);
+ name##_cache <<= (num)
# endif
// FIXME name?
# define SKIP_COUNTER(name, gb, num)\
- name##_index += (num);\
+ name##_index += (num)
# define SKIP_BITS(name, gb, num)\
{\
- SKIP_CACHE(name, gb, num)\
- SKIP_COUNTER(name, gb, num)\
+ SKIP_CACHE(name, gb, num);\
+ SKIP_COUNTER(name, gb, num);\
}\
# define LAST_SKIP_BITS(name, gb, num) SKIP_COUNTER(name, gb, num)
-# define LAST_SKIP_CACHE(name, gb, num) ;
+# define LAST_SKIP_CACHE(name, gb, num)
# ifdef ALT_BITSTREAM_READER_LE
# define SHOW_UBITS(name, gb, num)\
@@ -197,12 +197,12 @@ static inline void skip_bits_long(GetBitContext *s, int n){
# define OPEN_READER(name, gb)\
int name##_bit_count=(gb)->bit_count;\
int name##_cache= (gb)->cache;\
- uint8_t * name##_buffer_ptr=(gb)->buffer_ptr;\
+ uint8_t * name##_buffer_ptr=(gb)->buffer_ptr
# define CLOSE_READER(name, gb)\
(gb)->bit_count= name##_bit_count;\
(gb)->cache= name##_cache;\
- (gb)->buffer_ptr= name##_buffer_ptr;\
+ (gb)->buffer_ptr= name##_buffer_ptr
# define UPDATE_CACHE(name, gb)\
if(name##_bit_count >= 0){\
@@ -212,15 +212,15 @@ static inline void skip_bits_long(GetBitContext *s, int n){
}\
# define SKIP_CACHE(name, gb, num)\
- name##_cache <<= (num);\
+ name##_cache <<= (num)
# define SKIP_COUNTER(name, gb, num)\
- name##_bit_count += (num);\
+ name##_bit_count += (num)
# define SKIP_BITS(name, gb, num)\
{\
- SKIP_CACHE(name, gb, num)\
- SKIP_COUNTER(name, gb, num)\
+ SKIP_CACHE(name, gb, num);\
+ SKIP_COUNTER(name, gb, num);\
}\
# define LAST_SKIP_BITS(name, gb, num) SKIP_BITS(name, gb, num)
@@ -240,13 +240,13 @@ static inline int get_bits_count(const GetBitContext *s){
}
static inline void skip_bits_long(GetBitContext *s, int n){
- OPEN_READER(re, s)
+ OPEN_READER(re, s);
re_bit_count += n;
re_buffer_ptr += 2*(re_bit_count>>4);
re_bit_count &= 15;
re_cache = ((re_buffer_ptr[-2]<<8) + re_buffer_ptr[-1]) << (16+re_bit_count);
- UPDATE_CACHE(re, s)
- CLOSE_READER(re, s)
+ UPDATE_CACHE(re, s);
+ CLOSE_READER(re, s);
}
#elif defined A32_BITSTREAM_READER
@@ -257,13 +257,13 @@ static inline void skip_bits_long(GetBitContext *s, int n){
int name##_bit_count=(gb)->bit_count;\
uint32_t name##_cache0= (gb)->cache0;\
uint32_t name##_cache1= (gb)->cache1;\
- uint32_t * name##_buffer_ptr=(gb)->buffer_ptr;\
+ uint32_t * name##_buffer_ptr=(gb)->buffer_ptr
# define CLOSE_READER(name, gb)\
(gb)->bit_count= name##_bit_count;\
(gb)->cache0= name##_cache0;\
(gb)->cache1= name##_cache1;\
- (gb)->buffer_ptr= name##_buffer_ptr;\
+ (gb)->buffer_ptr= name##_buffer_ptr
# define UPDATE_CACHE(name, gb)\
if(name##_bit_count > 0){\
@@ -281,21 +281,21 @@ static inline void skip_bits_long(GetBitContext *s, int n){
"shll %2, %1 \n\t"\
: "+r" (name##_cache0), "+r" (name##_cache1)\
: "Ic" ((uint8_t)(num))\
- );
+ )
#else
# define SKIP_CACHE(name, gb, num)\
name##_cache0 <<= (num);\
name##_cache0 |= NEG_USR32(name##_cache1,num);\
- name##_cache1 <<= (num);
+ name##_cache1 <<= (num)
#endif
# define SKIP_COUNTER(name, gb, num)\
- name##_bit_count += (num);\
+ name##_bit_count += (num)
# define SKIP_BITS(name, gb, num)\
{\
- SKIP_CACHE(name, gb, num)\
- SKIP_COUNTER(name, gb, num)\
+ SKIP_CACHE(name, gb, num);\
+ SKIP_COUNTER(name, gb, num);\
}\
# define LAST_SKIP_BITS(name, gb, num) SKIP_BITS(name, gb, num)
@@ -315,14 +315,14 @@ static inline int get_bits_count(const GetBitContext *s){
}
static inline void skip_bits_long(GetBitContext *s, int n){
- OPEN_READER(re, s)
+ OPEN_READER(re, s);
re_bit_count += n;
re_buffer_ptr += re_bit_count>>5;
re_bit_count &= 31;
re_cache0 = be2me_32( re_buffer_ptr[-1] ) << re_bit_count;
re_cache1 = 0;
- UPDATE_CACHE(re, s)
- CLOSE_READER(re, s)
+ UPDATE_CACHE(re, s);
+ CLOSE_READER(re, s);
}
#endif
@@ -336,22 +336,22 @@ static inline void skip_bits_long(GetBitContext *s, int n){
static inline int get_xbits(GetBitContext *s, int n){
register int sign;
register int32_t cache;
- OPEN_READER(re, s)
- UPDATE_CACHE(re, s)
+ OPEN_READER(re, s);
+ UPDATE_CACHE(re, s);
cache = GET_CACHE(re,s);
sign=(~cache)>>31;
- LAST_SKIP_BITS(re, s, n)
- CLOSE_READER(re, s)
+ LAST_SKIP_BITS(re, s, n);
+ CLOSE_READER(re, s);
return (NEG_USR32(sign ^ cache, n) ^ sign) - sign;
}
static inline int get_sbits(GetBitContext *s, int n){
register int tmp;
- OPEN_READER(re, s)
- UPDATE_CACHE(re, s)
+ OPEN_READER(re, s);
+ UPDATE_CACHE(re, s);
tmp= SHOW_SBITS(re, s, n);
- LAST_SKIP_BITS(re, s, n)
- CLOSE_READER(re, s)
+ LAST_SKIP_BITS(re, s, n);
+ CLOSE_READER(re, s);
return tmp;
}
@@ -361,11 +361,11 @@ static inline int get_sbits(GetBitContext *s, int n){
*/
static inline unsigned int get_bits(GetBitContext *s, int n){
register int tmp;
- OPEN_READER(re, s)
- UPDATE_CACHE(re, s)
+ OPEN_READER(re, s);
+ UPDATE_CACHE(re, s);
tmp= SHOW_UBITS(re, s, n);
- LAST_SKIP_BITS(re, s, n)
- CLOSE_READER(re, s)
+ LAST_SKIP_BITS(re, s, n);
+ CLOSE_READER(re, s);
return tmp;
}
@@ -375,8 +375,8 @@ static inline unsigned int get_bits(GetBitContext *s, int n){
*/
static inline unsigned int show_bits(GetBitContext *s, int n){
register int tmp;
- OPEN_READER(re, s)
- UPDATE_CACHE(re, s)
+ OPEN_READER(re, s);
+ UPDATE_CACHE(re, s);
tmp= SHOW_UBITS(re, s, n);
// CLOSE_READER(re, s)
return tmp;
@@ -384,10 +384,10 @@ static inline unsigned int show_bits(GetBitContext *s, int n){
static inline void skip_bits(GetBitContext *s, int n){
//Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
- OPEN_READER(re, s)
- UPDATE_CACHE(re, s)
- LAST_SKIP_BITS(re, s, n)
- CLOSE_READER(re, s)
+ OPEN_READER(re, s);
+ UPDATE_CACHE(re, s);
+ LAST_SKIP_BITS(re, s, n);
+ CLOSE_READER(re, s);
}
static inline unsigned int get_bits1(GetBitContext *s){
@@ -544,8 +544,8 @@ void free_vlc(VLC *vlc);
n = table[index][1];\
\
if(max_depth > 1 && n < 0){\
- LAST_SKIP_BITS(name, gb, bits)\
- UPDATE_CACHE(name, gb)\
+ LAST_SKIP_BITS(name, gb, bits);\
+ UPDATE_CACHE(name, gb);\
\
nb_bits = -n;\
\
@@ -553,8 +553,8 @@ void free_vlc(VLC *vlc);
code = table[index][0];\
n = table[index][1];\
if(max_depth > 2 && n < 0){\
- LAST_SKIP_BITS(name, gb, nb_bits)\
- UPDATE_CACHE(name, gb)\
+ LAST_SKIP_BITS(name, gb, nb_bits);\
+ UPDATE_CACHE(name, gb);\
\
nb_bits = -n;\
\
@@ -563,7 +563,7 @@ void free_vlc(VLC *vlc);
n = table[index][1];\
}\
}\
- SKIP_BITS(name, gb, n)\
+ SKIP_BITS(name, gb, n);\
}
#define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update)\
@@ -576,9 +576,9 @@ void free_vlc(VLC *vlc);
n = table[index].len;\
\
if(max_depth > 1 && n < 0){\
- SKIP_BITS(name, gb, bits)\
+ SKIP_BITS(name, gb, bits);\
if(need_update){\
- UPDATE_CACHE(name, gb)\
+ UPDATE_CACHE(name, gb);\
}\
\
nb_bits = -n;\
@@ -588,7 +588,7 @@ void free_vlc(VLC *vlc);
n = table[index].len;\
}\
run= table[index].run;\
- SKIP_BITS(name, gb, n)\
+ SKIP_BITS(name, gb, n);\
}
@@ -605,12 +605,12 @@ static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2],
{
int code;
- OPEN_READER(re, s)
- UPDATE_CACHE(re, s)
+ OPEN_READER(re, s);
+ UPDATE_CACHE(re, s);
- GET_VLC(code, re, s, table, bits, max_depth)
+ GET_VLC(code, re, s, table, bits, max_depth);
- CLOSE_READER(re, s)
+ CLOSE_READER(re, s);
return code;
}
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 14bd24e..df81e33 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -405,10 +405,10 @@ static int decode_block(MJpegDecodeContext *s, DCTELEM *block,
block[0] = val;
/* AC coefs */
i = 0;
- {OPEN_READER(re, &s->gb)
+ {OPEN_READER(re, &s->gb);
for(;;) {
UPDATE_CACHE(re, &s->gb);
- GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2)
+ GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2);
/* EOB */
if (code == 0x10)
@@ -417,7 +417,7 @@ static int decode_block(MJpegDecodeContext *s, DCTELEM *block,
if(code != 0x100){
code &= 0xf;
if(code > MIN_CACHE_BITS - 16){
- UPDATE_CACHE(re, &s->gb)
+ UPDATE_CACHE(re, &s->gb);
}
{
int cache=GET_CACHE(re,&s->gb);
@@ -425,7 +425,7 @@ static int decode_block(MJpegDecodeContext *s, DCTELEM *block,
level = (NEG_USR32(sign ^ cache,code) ^ sign) - sign;
}
- LAST_SKIP_BITS(re, &s->gb, code)
+ LAST_SKIP_BITS(re, &s->gb, code);
if (i >= 63) {
if(i == 63){
@@ -440,7 +440,7 @@ static int decode_block(MJpegDecodeContext *s, DCTELEM *block,
block[j] = level * quant_matrix[j];
}
}
- CLOSE_READER(re, &s->gb)}
+ CLOSE_READER(re, &s->gb);}
return 0;
}
@@ -472,17 +472,17 @@ static int decode_block_progressive(MJpegDecodeContext *s, DCTELEM *block, uint8
(*EOBRUN)--;
return 0;
}
- {OPEN_READER(re, &s->gb)
+ {OPEN_READER(re, &s->gb);
for(i=ss;;i++) {
UPDATE_CACHE(re, &s->gb);
- GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2)
+ GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2);
/* Progressive JPEG use AC coeffs from zero and this decoder sets offset 16 by default */
code -= 16;
if(code & 0xF) {
i += ((unsigned) code) >> 4;
code &= 0xf;
if(code > MIN_CACHE_BITS - 16){
- UPDATE_CACHE(re, &s->gb)
+ UPDATE_CACHE(re, &s->gb);
}
{
int cache=GET_CACHE(re,&s->gb);
@@ -490,7 +490,7 @@ static int decode_block_progressive(MJpegDecodeContext *s, DCTELEM *block, uint8
level = (NEG_USR32(sign ^ cache,code) ^ sign) - sign;
}
- LAST_SKIP_BITS(re, &s->gb, code)
+ LAST_SKIP_BITS(re, &s->gb, code);
if (i >= se) {
if(i == se){
@@ -519,7 +519,7 @@ static int decode_block_progressive(MJpegDecodeContext *s, DCTELEM *block, uint8
}
}
}
- CLOSE_READER(re, &s->gb)}
+ CLOSE_READER(re, &s->gb);}
if(i > *last_nnz)
*last_nnz = i;
return 0;
@@ -563,7 +563,7 @@ static int decode_block_refinement(MJpegDecodeContext *s, DCTELEM *block, uint8_
else {
for(;;i++) {
UPDATE_CACHE(re, &s->gb);
- GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2)
+ GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2);
/* Progressive JPEG use AC coeffs from zero and this decoder sets offset 16 by default */
code -= 16;
if(code & 0xF) {
@@ -578,7 +578,7 @@ static int decode_block_refinement(MJpegDecodeContext *s, DCTELEM *block, uint8_
if(i == se) {
if(i > *last_nnz)
*last_nnz = i;
- CLOSE_READER(re, &s->gb)
+ CLOSE_READER(re, &s->gb);
return 0;
}
}else{
--
1.7.0
More information about the ffmpeg-devel
mailing list