[FFmpeg-devel] [PATCH] adpcm: convert VLAs to malloc/free
Loren Merritt
lorenm
Sun Jun 27 05:23:06 CEST 2010
On Sat, 26 Jun 2010, M?ns Rullg?rd wrote:
> static void adpcm_compress_trellis(AVCodecContext *avctx, const short *samples,
> uint8_t *dst, ADPCMChannelStatus *c, int n)
> {
>-#define FREEZE_INTERVAL 128
> //FIXME 6% faster if frontier is a compile-time constant
>+ ADPCMContext *s = avctx->priv_data;
> const int frontier = 1 << avctx->trellis;
> const int stride = avctx->channels;
> const int version = avctx->codec->id;
>- const int max_paths = frontier*FREEZE_INTERVAL;
>- TrellisPath paths[max_paths], *p;
>- TrellisNode node_buf[2][frontier];
>- TrellisNode *nodep_buf[2][frontier];
>- TrellisNode **nodes = nodep_buf[0]; // nodes[] is always sorted by .ssd
>- TrellisNode **nodes_next = nodep_buf[1];
>+ TrellisPath *paths = s->paths, *p;
>+ TrellisNode *node_buf = s->node_buf;
>+ TrellisNode **nodep_buf = s->nodep_buf;
>+ TrellisNode **nodes = nodep_buf; // nodes[] is always sorted by .ssd
>+ TrellisNode **nodes_next = nodep_buf + frontier;
> int pathn = 0, froze = -1, i, j, k;
>
> assert(!(max_paths&(max_paths-1)));
max_paths no longer exists
Other than that, ok. I don't have any better ideas.
--Loren Merritt
More information about the ffmpeg-devel
mailing list