[FFmpeg-devel] [RFC] TwinVQ decoder

Diego Biurrun diego
Sat Mar 7 19:45:09 CET 2009


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

A docs and changelog update is missing.

Diego




More information about the ffmpeg-devel mailing list