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);
|
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) {
|
while (*string) {
|
||||||
put_bits(pb, 8, *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 bits = length & 15;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(length==0) return;
|
if (length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
if (CONFIG_SMALL || words < 16 || put_bits_count(pb) & 7) {
|
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 {
|
} else {
|
||||||
for (i = 0; put_bits_count(pb) & 31; i++)
|
for (i = 0; put_bits_count(pb) & 31; i++)
|
||||||
put_bits(pb, 8, src[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)
|
static int alloc_table(VLC *vlc, int size, int use_static)
|
||||||
{
|
{
|
||||||
int index;
|
int index = vlc->table_size;
|
||||||
index = vlc->table_size;
|
|
||||||
vlc->table_size += size;
|
vlc->table_size += size;
|
||||||
if (vlc->table_size > vlc->table_allocated) {
|
if (vlc->table_size > vlc->table_allocated) {
|
||||||
if (use_static)
|
if (use_static)
|
||||||
abort(); // cannot do anything, init_vlc() is used with too little memory
|
abort(); // cannot do anything, init_vlc() is used with too little memory
|
||||||
vlc->table_allocated += (1 << vlc->bits);
|
vlc->table_allocated += (1 << vlc->bits);
|
||||||
vlc->table = av_realloc(vlc->table,
|
vlc->table = av_realloc(vlc->table, sizeof(VLC_TYPE) * 2 * vlc->table_allocated);
|
||||||
sizeof(VLC_TYPE) * 2 * vlc->table_allocated);
|
|
||||||
if (!vlc->table)
|
if (!vlc->table)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_always_inline uint32_t bitswap_32(uint32_t x) {
|
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
|
return (uint32_t)ff_reverse[ x & 0xFF] << 24 |
|
||||||
| (uint32_t)ff_reverse[(x>>16)&0xFF]<<8
|
(uint32_t)ff_reverse[(x >> 8) & 0xFF] << 16 |
|
||||||
| (uint32_t)ff_reverse[x>>24];
|
(uint32_t)ff_reverse[(x >> 16) & 0xFF] << 8 |
|
||||||
|
(uint32_t)ff_reverse[ x >> 24];
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -134,7 +137,6 @@ static int compare_vlcspec(const void *a, const void *b)
|
|||||||
const VLCcode *sa = a, *sb = b;
|
const VLCcode *sa = a, *sb = b;
|
||||||
return (sa->code >> 1) - (sb->code >> 1);
|
return (sa->code >> 1) - (sb->code >> 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build VLC decoding tables suitable for use with get_vlc().
|
* 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);
|
av_freep(&vlc->table);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if((flags & INIT_VLC_USE_NEW_STATIC) && vlc->table_size != vlc->table_allocated)
|
if ((flags & INIT_VLC_USE_NEW_STATIC) &&
|
||||||
av_log(NULL, AV_LOG_ERROR, "needed %d had %d\n", vlc->table_size, vlc->table_allocated);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user