[FFmpeg-devel] [RFC] TwinVQ decoder

Vitor Sessak vitor1001
Sat Mar 7 23:24:10 CET 2009


Diego Biurrun wrote:
> On Sat, Mar 07, 2009 at 05:47:51PM +0100, Vitor Sessak wrote:
>> This code is still not review-quality, but any comment is welcome.
>>
>> /**
>>  * Parameters and tables that are different for each frame type
>>  */
>> typedef struct {
>>     uint8_t   sub;
>>     const uint16_t *crb_tbl;
>>     uint8_t   n_crb;
>>     const float *fw_cb;
>>     uint8_t   fw_n_div;
>>     uint8_t   fw_n_bit;
>>     const float *cb0;
>>     const float *cb1;
>>     uint8_t   cb_len_read;
>> } FrameMode;
> 
> This would be more readable aligned.
> 
>> typedef struct {
>>     const FrameMode fmode[3];
>>
>>     uint16_t  n_fr;
>>     uint8_t   n_pr;
>>     const float *lspcodebook;
>>     uint8_t   lsp_bit0;
>>     uint8_t   lsp_bit1;
>>     uint8_t   lsp_bit2;
>>     uint8_t   lsp_split;
>>     const float *pit_cb;
>>     uint8_t   basf_bit;
>>     uint8_t   pit_n_bit;
>>     uint8_t   pit_cb_len;
>>     uint8_t   pgain_bit;
>> } ModeTab;
> 
> I don't like typedefs :)
> 
>> static void mulddd(int cont, const float *buf1, const float *buf2, float *buf3)
>> {
>>     while(cont--)
> 
> For new files I recommend K&R style space after if/for/while/switch.
> You use a mix of both in this file.
> 
>>     size = tctx->avctx->channels*mtab->fmode[ftype].sub;
>>     size3 = tctx->avctx->channels * mtab->n_fr;
> 
> align
> 
>>     size = tabs[b/5].size;
>>     tab = tabs[b/5].tab;
> 
> align
> 
>> static void dec_bark_env(int a1, const uint8_t *a2, const uint8_t *a3, enum FrameType ftype, int a5, int a6,
>>                          float *a7, TwinContext *tctx)
> 
> long line
> 
>> static av_cold int twin_decode_init(AVCodecContext *avctx)
>> {
>>     TwinContext *tctx = avctx->priv_data;
>>     int isampf = avctx->sample_rate/1000;
>>     int ibps = avctx->bit_rate/(1000 * avctx->channels);
>>
>>     tctx->avctx = avctx;
>>     tctx->skip_cnt = 2;
>>     avctx->sample_fmt = SAMPLE_FMT_FLT;
> 
> align

Fixed all but the typedefs locally.

> A docs and changelog update is missing.

That's why there is no "[PATCH]" in the message subject ;)

-Vitor




More information about the ffmpeg-devel mailing list