Mercurial > libavcodec.hg
diff pcm.c @ 5422:ad384eda0cb7 libavcodec
support silly PCM variant used by zork nemesis
fixes audio decoding of T000A11C.AVI
author | michael |
---|---|
date | Mon, 30 Jul 2007 02:05:16 +0000 |
parents | 91015dc624ad |
children | 13039fd7cf10 |
line wrap: on
line diff
--- a/pcm.c Sun Jul 29 21:34:31 2007 +0000 +++ b/pcm.c Mon Jul 30 02:05:16 2007 +0000 @@ -291,6 +291,14 @@ *dst++ = (v >> 8) + 128; } break; + case CODEC_ID_PCM_ZORK: + for(;n>0;n--) { + v= *samples++ >> 8; + if(v<0) v = -v; + else v+= 128; + *dst++ = v; + } + break; case CODEC_ID_PCM_ALAW: for(;n>0;n--) { v = *samples++; @@ -452,6 +460,15 @@ *samples++ = ((int)*src++ - 128) << 8; } break; + case CODEC_ID_PCM_ZORK: + n = buf_size; + for(;n>0;n--) { + int x= *src++; + if(x&128) x-= 128; + else x = -x; + *samples++ = x << 8; + } + break; case CODEC_ID_PCM_ALAW: case CODEC_ID_PCM_MULAW: n = buf_size; @@ -505,5 +522,6 @@ PCM_CODEC(CODEC_ID_PCM_U8, pcm_u8); PCM_CODEC(CODEC_ID_PCM_ALAW, pcm_alaw); PCM_CODEC(CODEC_ID_PCM_MULAW, pcm_mulaw); +PCM_CODEC(CODEC_ID_PCM_ZORK, pcm_zork); #undef PCM_CODEC