diff options
author | tetsuo55 <tetsuo55@users.sourceforge.net> | 2010-04-09 01:14:58 +0400 |
---|---|---|
committer | tetsuo55 <tetsuo55@users.sourceforge.net> | 2010-04-09 01:14:58 +0400 |
commit | a9b7bf3fb3e1334d8defd05ca4cfae870b4912e5 (patch) | |
tree | 2dab453d94d5e003379a6cc895eceb84c80e23ec /src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/put_bits.h | |
parent | aafd49a91f7c2fa9c7103971c16fa6e1b29e8bfd (diff) |
astyle formatting cleanup to make the sourcecode more accessible
switch used: astyle --style=ansi --min-conditional-indent=0 --pad=oper --unpad=paren
http://astyle.sourceforge.net/
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1783 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/put_bits.h')
-rw-r--r-- | src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/put_bits.h | 161 |
1 files changed, 86 insertions, 75 deletions
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/put_bits.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/put_bits.h index c02027857..e47b0ec6a 100644 --- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/put_bits.h +++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/put_bits.h @@ -39,7 +39,8 @@ //#define ALIGNED_BITSTREAM_WRITER
/* buf and buf_end must be present and used by every alternative writer. */
-typedef struct PutBitContext {
+typedef struct PutBitContext
+{
#ifdef ALT_BITSTREAM_WRITER
uint8_t *buf, *buf_end;
int index;
@@ -59,22 +60,23 @@ typedef struct PutBitContext { */
static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
{
- if(buffer_size < 0) {
+ if(buffer_size < 0)
+ {
buffer_size = 0;
buffer = NULL;
}
- s->size_in_bits= 8*buffer_size;
+ s->size_in_bits = 8 * buffer_size;
s->buf = buffer;
s->buf_end = s->buf + buffer_size;
#ifdef ALT_BITSTREAM_WRITER
- s->index=0;
- ((uint32_t*)(s->buf))[0]=0;
+ s->index = 0;
+ ((uint32_t*)(s->buf))[0] = 0;
// memset(buffer, 0, buffer_size);
#else
s->buf_ptr = s->buf;
- s->bit_left=32;
- s->bit_buf=0;
+ s->bit_left = 32;
+ s->bit_buf = 0;
#endif
}
@@ -99,21 +101,22 @@ static inline void flush_put_bits(PutBitContext *s) align_put_bits(s);
#else
#ifndef BITSTREAM_WRITER_LE
- s->bit_buf<<= s->bit_left;
+ s->bit_buf <<= s->bit_left;
#endif
- while (s->bit_left < 32) {
+ while(s->bit_left < 32)
+ {
/* XXX: should test end of buffer */
#ifdef BITSTREAM_WRITER_LE
- *s->buf_ptr++=s->bit_buf;
- s->bit_buf>>=8;
+ *s->buf_ptr++ = s->bit_buf;
+ s->bit_buf >>= 8;
#else
- *s->buf_ptr++=s->bit_buf >> 24;
- s->bit_buf<<=8;
+ *s->buf_ptr++ = s->bit_buf >> 24;
+ s->bit_buf <<= 8;
#endif
- s->bit_left+=8;
+ s->bit_left += 8;
}
- s->bit_left=32;
- s->bit_buf=0;
+ s->bit_left = 32;
+ s->bit_buf = 0;
#endif
}
@@ -162,34 +165,42 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) /* XXX: optimize */
#ifdef BITSTREAM_WRITER_LE
bit_buf |= value << (32 - bit_left);
- if (n >= bit_left) {
+ if(n >= bit_left)
+ {
#if !HAVE_FAST_UNALIGNED
- if (3 & (intptr_t) s->buf_ptr) {
+ if(3 & (intptr_t) s->buf_ptr)
+ {
AV_WL32(s->buf_ptr, bit_buf);
- } else
+ }
+ else
#endif
- *(uint32_t *)s->buf_ptr = le2me_32(bit_buf);
- s->buf_ptr+=4;
- bit_buf = (bit_left==32)?0:value >> bit_left;
- bit_left+=32;
+ *(uint32_t *)s->buf_ptr = le2me_32(bit_buf);
+ s->buf_ptr += 4;
+ bit_buf = (bit_left == 32) ? 0 : value >> bit_left;
+ bit_left += 32;
}
- bit_left-=n;
+ bit_left -= n;
#else
- if (n < bit_left) {
- bit_buf = (bit_buf<<n) | value;
- bit_left-=n;
- } else {
- bit_buf<<=bit_left;
+ if(n < bit_left)
+ {
+ bit_buf = (bit_buf << n) | value;
+ bit_left -= n;
+ }
+ else
+ {
+ bit_buf <<= bit_left;
bit_buf |= value >> (n - bit_left);
#if !HAVE_FAST_UNALIGNED
- if (3 & (intptr_t) s->buf_ptr) {
+ if(3 & (intptr_t) s->buf_ptr)
+ {
AV_WB32(s->buf_ptr, bit_buf);
- } else
+ }
+ else
#endif
- *(uint32_t *)s->buf_ptr = be2me_32(bit_buf);
+ *(uint32_t *)s->buf_ptr = be2me_32(bit_buf);
//printf("bitbuf = %08x\n", bit_buf);
- s->buf_ptr+=4;
- bit_left+=32 - n;
+ s->buf_ptr += 4;
+ bit_left += 32 - n;
bit_buf = value;
}
#endif
@@ -214,49 +225,49 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) "bswapl %%eax \n\t"
"addl %3, %0 \n\t"
"movl %%eax, 4(%2, %%ecx) \n\t"
- : "=&r" (s->index), "=&r" (value)
- : "r" (s->buf), "r" (n), "0" (s->index), "1" (value<<(-n))
+ : "=&r"(s->index), "=&r"(value)
+ : "r"(s->buf), "r"(n), "0"(s->index), "1"(value<<(-n))
: "%eax", "%ecx"
);
# else
- int index= s->index;
- uint32_t *ptr= ((uint32_t *)s->buf)+(index>>5);
+int index = s->index;
+uint32_t *ptr = ((uint32_t *)s->buf) + (index >> 5);
- value<<= 32-n;
+value <<= 32 - n;
- ptr[0] |= be2me_32(value>>(index&31));
- ptr[1] = be2me_32(value<<(32-(index&31)));
+ptr[0] |= be2me_32(value >> (index & 31));
+ptr[1] = be2me_32(value << (32 - (index & 31)));
//if(n>24) printf("%d %d\n", n, value);
- index+= n;
- s->index= index;
+index += n;
+s->index = index;
# endif
# else //ALIGNED_BITSTREAM_WRITER
# if ARCH_X86
- __asm__ volatile(
- "movl $7, %%ecx \n\t"
- "andl %0, %%ecx \n\t"
- "addl %3, %%ecx \n\t"
- "negl %%ecx \n\t"
- "shll %%cl, %1 \n\t"
- "bswapl %1 \n\t"
- "movl %0, %%ecx \n\t"
- "shrl $3, %%ecx \n\t"
- "orl %1, (%%ecx, %2) \n\t"
- "addl %3, %0 \n\t"
- "movl $0, 4(%%ecx, %2) \n\t"
- : "=&r" (s->index), "=&r" (value)
- : "r" (s->buf), "r" (n), "0" (s->index), "1" (value)
- : "%ecx"
- );
+__asm__ volatile(
+ "movl $7, %%ecx \n\t"
+ "andl %0, %%ecx \n\t"
+ "addl %3, %%ecx \n\t"
+ "negl %%ecx \n\t"
+ "shll %%cl, %1 \n\t"
+ "bswapl %1 \n\t"
+ "movl %0, %%ecx \n\t"
+ "shrl $3, %%ecx \n\t"
+ "orl %1, (%%ecx, %2) \n\t"
+ "addl %3, %0 \n\t"
+ "movl $0, 4(%%ecx, %2) \n\t"
+ : "=&r"(s->index), "=&r"(value)
+ : "r"(s->buf), "r"(n), "0"(s->index), "1"(value)
+ : "%ecx"
+);
# else
- int index= s->index;
- uint32_t *ptr= (uint32_t*)(((uint8_t *)s->buf)+(index>>3));
+int index = s->index;
+uint32_t *ptr = (uint32_t*)(((uint8_t *)s->buf) + (index >> 3));
- ptr[0] |= be2me_32(value<<(32-n-(index&7) ));
- ptr[1] = 0;
+ptr[0] |= be2me_32(value << (32 - n - (index & 7)));
+ptr[1] = 0;
//if(n>24) printf("%d %d\n", n, value);
- index+= n;
- s->index= index;
+index += n;
+s->index = index;
# endif
# endif //!ALIGNED_BITSTREAM_WRITER
}
@@ -266,7 +277,7 @@ static inline void put_sbits(PutBitContext *pb, int n, int32_t value) {
assert(n >= 0 && n <= 31);
- put_bits(pb, n, value & ((1<<n)-1));
+ put_bits(pb, n, value & ((1 << n) - 1));
}
/**
@@ -292,9 +303,9 @@ static void av_unused put_bits32(PutBitContext *s, uint32_t value) static inline uint8_t* put_bits_ptr(PutBitContext *s)
{
#ifdef ALT_BITSTREAM_WRITER
- return s->buf + (s->index>>3);
+ return s->buf + (s->index >> 3);
#else
- return s->buf_ptr;
+ return s->buf_ptr;
#endif
}
@@ -304,13 +315,13 @@ static inline uint8_t* put_bits_ptr(PutBitContext *s) */
static inline void skip_put_bytes(PutBitContext *s, int n)
{
- assert((put_bits_count(s)&7)==0);
+ assert((put_bits_count(s) & 7) == 0);
#ifdef ALT_BITSTREAM_WRITER
- FIXME may need some cleaning of the buffer
- s->index += n<<3;
+ FIXME may need some cleaning of the buffer
+ s->index += n << 3;
#else
- assert(s->bit_left==32);
- s->buf_ptr += n;
+ assert(s->bit_left == 32);
+ s->buf_ptr += n;
#endif
}
@@ -325,7 +336,7 @@ static inline void skip_put_bits(PutBitContext *s, int n) s->index += n;
#else
s->bit_left -= n;
- s->buf_ptr-= 4*(s->bit_left>>5);
+ s->buf_ptr -= 4 * (s->bit_left >> 5);
s->bit_left &= 31;
#endif
}
@@ -337,7 +348,7 @@ static inline void skip_put_bits(PutBitContext *s, int n) */
static inline void set_put_bits_buffer_size(PutBitContext *s, int size)
{
- s->buf_end= s->buf + size;
+ s->buf_end = s->buf + size;
}
#endif /* AVCODEC_PUT_BITS_H */
|