[Ffmpeg-devel] [PATCH] Vorbis decoder

Michael Niedermayer michaelni
Thu May 12 13:42:44 CEST 2005


Hi

On Wednesday 11 May 2005 22:42, Balatoni Denes wrote:
> Hi!
>
> Here is a vorbis decoder which uses lavc's bitreader, vlc reader, imdct and
> av_log, also ld_exp from libm - but otherwise selfcontained. It is roughly
> 5 percent slower than libvorbis, it's not entirely clear why. Note it is
> fully floating point, and there still is room for improvement.

[...]

> +#ifdef CONFIG_VORBIS_DECODER
> +    register_avcodec(&vorbis_decoder);
> +#endif //CONFIG_WS_SND1_DECODER

typo


> +    uint32_t ret=0;

exact width types should only be used when an exact width is needed (not for 
local variables like ret,i, ...)


the file is full of tabs please convert them to spaces
you might also wish to remove the trailing whitespace


> +    av_free(vc->channel_residues);

av_freep(&vc->channel_residues); would zero the pointer afterwards too, which 
is IMHO a nice safety meassure against misstakly using it afterwards


> +for(t=0;t<(1<<16);++t) tmp_vlc_bits[t]=0;

memset(tmp_vlc_bits, 0, sizeof(tmp_vlc_bits)); would be cleaner


> +	    codebook_setup->codevectors=(float 
*)av_mallocz(used_entries*codebook_setup->dimensions * sizeof(float));

is used_entries*codebook_setup->dimensions * sizeof(float) somehow guranteed 
not to overflow 32bit? if not then this might be exploitable


> +    switch (vc->blocksize_1) {
> +	case 64:
> ...

code duplication, not to mention that the 1 page switch() can be replaced by a 
log2() and a table of pointers to vwin*


> +#ifdef V_DEBUG
> +    av_log(vc->avccontext, AV_LOG_INFO, " Codebooks: %d \n", 
vc->codebook_count);
> +#endif

maybe add a 
AV_DEBUG(...) av_log(NULL, AV_LOG_DEBUG, ...) 
macro to common.h which could then easily be #defined to nothing to avoid the 
#ifdefs around, it would also make a few developers happy who complained 
about having to type too much for a quick debug av_log


> + static float vwin64[32] = {

should either be static const or generated during init



[...]
-- 
Michael





More information about the ffmpeg-devel mailing list