bitstream: K&R formatting cosmetics
This commit is contained in:
parent
9e80eda26d
commit
f776899a17
@ -47,7 +47,8 @@ void avpriv_align_put_bits(PutBitContext *s)
|
||||
put_bits(s, s->bit_left & 7, 0);
|
||||
}
|
||||
|
||||
void avpriv_put_string(PutBitContext *pb, const char *string, int terminate_string)
|
||||
void avpriv_put_string(PutBitContext *pb, const char *string,
|
||||
int terminate_string)
|
||||
{
|
||||
while (*string) {
|
||||
put_bits(pb, 8, *string);
|
||||
@ -63,10 +64,12 @@ void avpriv_copy_bits(PutBitContext *pb, const uint8_t *src, int length)
|
||||
int bits = length & 15;
|
||||
int i;
|
||||
|
||||
if(length==0) return;
|
||||
if (length == 0)
|
||||
return;
|
||||
|
||||
if (CONFIG_SMALL || words < 16 || put_bits_count(pb) & 7) {
|
||||
for(i=0; i<words; i++) put_bits(pb, 16, AV_RB16(src + 2*i));
|
||||
for (i = 0; i < words; i++)
|
||||
put_bits(pb, 16, AV_RB16(src + 2 * i));
|
||||
} else {
|
||||
for (i = 0; put_bits_count(pb) & 31; i++)
|
||||
put_bits(pb, 8, src[i]);
|
||||
@ -99,26 +102,26 @@ void avpriv_copy_bits(PutBitContext *pb, const uint8_t *src, int length)
|
||||
|
||||
static int alloc_table(VLC *vlc, int size, int use_static)
|
||||
{
|
||||
int index;
|
||||
index = vlc->table_size;
|
||||
int index = vlc->table_size;
|
||||
|
||||
vlc->table_size += size;
|
||||
if (vlc->table_size > vlc->table_allocated) {
|
||||
if (use_static)
|
||||
abort(); // cannot do anything, init_vlc() is used with too little memory
|
||||
vlc->table_allocated += (1 << vlc->bits);
|
||||
vlc->table = av_realloc(vlc->table,
|
||||
sizeof(VLC_TYPE) * 2 * vlc->table_allocated);
|
||||
vlc->table = av_realloc(vlc->table, sizeof(VLC_TYPE) * 2 * vlc->table_allocated);
|
||||
if (!vlc->table)
|
||||
return -1;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
static av_always_inline uint32_t bitswap_32(uint32_t x) {
|
||||
return (uint32_t)ff_reverse[x&0xFF]<<24
|
||||
| (uint32_t)ff_reverse[(x>>8)&0xFF]<<16
|
||||
| (uint32_t)ff_reverse[(x>>16)&0xFF]<<8
|
||||
| (uint32_t)ff_reverse[x>>24];
|
||||
static av_always_inline uint32_t bitswap_32(uint32_t x)
|
||||
{
|
||||
return (uint32_t)ff_reverse[ x & 0xFF] << 24 |
|
||||
(uint32_t)ff_reverse[(x >> 8) & 0xFF] << 16 |
|
||||
(uint32_t)ff_reverse[(x >> 16) & 0xFF] << 8 |
|
||||
(uint32_t)ff_reverse[ x >> 24];
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
@ -134,7 +137,6 @@ static int compare_vlcspec(const void *a, const void *b)
|
||||
const VLCcode *sa = a, *sb = b;
|
||||
return (sa->code >> 1) - (sb->code >> 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build VLC decoding tables suitable for use with get_vlc().
|
||||
*
|
||||
@ -313,8 +315,10 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
|
||||
av_freep(&vlc->table);
|
||||
return -1;
|
||||
}
|
||||
if((flags & INIT_VLC_USE_NEW_STATIC) && vlc->table_size != vlc->table_allocated)
|
||||
av_log(NULL, AV_LOG_ERROR, "needed %d had %d\n", vlc->table_size, vlc->table_allocated);
|
||||
if ((flags & INIT_VLC_USE_NEW_STATIC) &&
|
||||
vlc->table_size != vlc->table_allocated)
|
||||
av_log(NULL, AV_LOG_ERROR, "needed %d had %d\n",
|
||||
vlc->table_size, vlc->table_allocated);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user