Mercurial > libavcodec.hg
changeset 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 | 0e593c7d0ebc |
children | 2c98d63a8956 |
files | allcodecs.c allcodecs.h avcodec.h pcm.c |
diffstat | 4 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/allcodecs.c Sun Jul 29 21:34:31 2007 +0000 +++ b/allcodecs.c Mon Jul 30 02:05:16 2007 +0000 @@ -225,6 +225,7 @@ REGISTER_ENCDEC (PCM_U24LE, pcm_u24le); REGISTER_ENCDEC (PCM_U32BE, pcm_u32be); REGISTER_ENCDEC (PCM_U32LE, pcm_u32le); + REGISTER_ENCDEC (PCM_ZORK , pcm_zork); /* dpcm codecs */ REGISTER_DECODER(INTERPLAY_DPCM, interplay_dpcm);
--- a/allcodecs.h Sun Jul 29 21:34:31 2007 +0000 +++ b/allcodecs.h Mon Jul 30 02:05:16 2007 +0000 @@ -228,6 +228,7 @@ PCM_CODEC(CODEC_ID_PCM_U24LE, pcm_u24le); PCM_CODEC(CODEC_ID_PCM_U32BE, pcm_u32be); PCM_CODEC(CODEC_ID_PCM_U32LE, pcm_u32le); +PCM_CODEC(CODEC_ID_PCM_ZORK, pcm_zork); /* ADPCM codecs */
--- a/avcodec.h Sun Jul 29 21:34:31 2007 +0000 +++ b/avcodec.h Mon Jul 30 02:05:16 2007 +0000 @@ -185,6 +185,7 @@ CODEC_ID_PCM_U24LE, CODEC_ID_PCM_U24BE, CODEC_ID_PCM_S24DAUD, + CODEC_ID_PCM_ZORK, /* various ADPCM codecs */ CODEC_ID_ADPCM_IMA_QT= 0x11000,
--- 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