Commit 0440c859 authored by michael's avatar michael

10^10l to whoever wrote this


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@8394 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 45ee48d0
...@@ -74,11 +74,8 @@ static int ulaw2linear(unsigned char u_val) ...@@ -74,11 +74,8 @@ static int ulaw2linear(unsigned char u_val)
} }
/* 16384 entries per table */ /* 16384 entries per table */
static uint8_t *linear_to_alaw = NULL; static uint8_t linear_to_alaw[16384];
static int linear_to_alaw_ref = 0; static uint8_t linear_to_ulaw[16384];
static uint8_t *linear_to_ulaw = NULL;
static int linear_to_ulaw_ref = 0;
static void build_xlaw_table(uint8_t *linear_to_xlaw, static void build_xlaw_table(uint8_t *linear_to_xlaw,
int (*xlaw2linear)(unsigned char), int (*xlaw2linear)(unsigned char),
...@@ -109,22 +106,10 @@ static int pcm_encode_init(AVCodecContext *avctx) ...@@ -109,22 +106,10 @@ static int pcm_encode_init(AVCodecContext *avctx)
avctx->frame_size = 1; avctx->frame_size = 1;
switch(avctx->codec->id) { switch(avctx->codec->id) {
case CODEC_ID_PCM_ALAW: case CODEC_ID_PCM_ALAW:
if (linear_to_alaw_ref == 0) { build_xlaw_table(linear_to_alaw, alaw2linear, 0xd5);
linear_to_alaw = av_malloc(16384);
if (!linear_to_alaw)
return -1;
build_xlaw_table(linear_to_alaw, alaw2linear, 0xd5);
}
linear_to_alaw_ref++;
break; break;
case CODEC_ID_PCM_MULAW: case CODEC_ID_PCM_MULAW:
if (linear_to_ulaw_ref == 0) { build_xlaw_table(linear_to_ulaw, ulaw2linear, 0xff);
linear_to_ulaw = av_malloc(16384);
if (!linear_to_ulaw)
return -1;
build_xlaw_table(linear_to_ulaw, ulaw2linear, 0xff);
}
linear_to_ulaw_ref++;
break; break;
default: default:
break; break;
...@@ -170,19 +155,6 @@ static int pcm_encode_close(AVCodecContext *avctx) ...@@ -170,19 +155,6 @@ static int pcm_encode_close(AVCodecContext *avctx)
{ {
av_freep(&avctx->coded_frame); 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; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment