Mercurial > libavcodec.hg
changeset 4660:c800e1a03b9c libavcodec
10^10l to whoever wrote this
author | michael |
---|---|
date | Tue, 13 Mar 2007 23:10:42 +0000 |
parents | 83dad4f266a6 |
children | 5b6f5e7ed3a0 |
files | pcm.c |
diffstat | 1 files changed, 4 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/pcm.c Tue Mar 13 22:53:01 2007 +0000 +++ b/pcm.c Tue Mar 13 23:10:42 2007 +0000 @@ -74,11 +74,8 @@ } /* 16384 entries per table */ -static uint8_t *linear_to_alaw = NULL; -static int linear_to_alaw_ref = 0; - -static uint8_t *linear_to_ulaw = NULL; -static int linear_to_ulaw_ref = 0; +static uint8_t linear_to_alaw[16384]; +static uint8_t linear_to_ulaw[16384]; static void build_xlaw_table(uint8_t *linear_to_xlaw, int (*xlaw2linear)(unsigned char), @@ -109,22 +106,10 @@ avctx->frame_size = 1; switch(avctx->codec->id) { case CODEC_ID_PCM_ALAW: - if (linear_to_alaw_ref == 0) { - linear_to_alaw = av_malloc(16384); - if (!linear_to_alaw) - return -1; - build_xlaw_table(linear_to_alaw, alaw2linear, 0xd5); - } - linear_to_alaw_ref++; + build_xlaw_table(linear_to_alaw, alaw2linear, 0xd5); break; case CODEC_ID_PCM_MULAW: - if (linear_to_ulaw_ref == 0) { - linear_to_ulaw = av_malloc(16384); - if (!linear_to_ulaw) - return -1; - build_xlaw_table(linear_to_ulaw, ulaw2linear, 0xff); - } - linear_to_ulaw_ref++; + build_xlaw_table(linear_to_ulaw, ulaw2linear, 0xff); break; default: break; @@ -170,19 +155,6 @@ { av_freep(&avctx->coded_frame); - switch(avctx->codec->id) { - case CODEC_ID_PCM_ALAW: - if (--linear_to_alaw_ref == 0) - av_free(linear_to_alaw); - break; - case CODEC_ID_PCM_MULAW: - if (--linear_to_ulaw_ref == 0) - av_free(linear_to_ulaw); - break; - default: - /* nothing to free */ - break; - } return 0; }