1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-13 21:28:01 +02:00

pcm_zork: use AV_SAMPLE_FMT_U8 instead of shifting all samples by 8.

This commit is contained in:
Justin Ruggles 2011-09-28 19:31:05 -04:00
parent 06af335a33
commit 67a3b67c71

View File

@ -172,10 +172,11 @@ static int pcm_encode_frame(AVCodecContext *avctx,
dst += n*sample_size; dst += n*sample_size;
break; break;
case CODEC_ID_PCM_ZORK: case CODEC_ID_PCM_ZORK:
for(;n>0;n--) { srcu8 = data;
v= *samples++ >> 8; for (; n > 0; n--) {
if(v<0) v = -v; v = *srcu8++;
else v+= 128; if (v < 128)
v = 128 - v;
*dst++ = v; *dst++ = v;
} }
break; break;
@ -387,12 +388,11 @@ static int pcm_decode_frame(AVCodecContext *avctx,
samples += n * sample_size; samples += n * sample_size;
break; break;
case CODEC_ID_PCM_ZORK: case CODEC_ID_PCM_ZORK:
for(;n>0;n--) { for (; n > 0; n--) {
int x= *src++; int v = *src++;
if(x&128) x-= 128; if (v < 128)
else x = -x; v = 128 - v;
AV_WN16A(samples, x << 8); *samples++ = v;
samples += 2;
} }
break; break;
case CODEC_ID_PCM_ALAW: case CODEC_ID_PCM_ALAW:
@ -518,4 +518,4 @@ PCM_CODEC (CODEC_ID_PCM_U24BE, AV_SAMPLE_FMT_S32, pcm_u24be, "PCM unsigned 24-b
PCM_CODEC (CODEC_ID_PCM_U24LE, AV_SAMPLE_FMT_S32, pcm_u24le, "PCM unsigned 24-bit little-endian"); PCM_CODEC (CODEC_ID_PCM_U24LE, AV_SAMPLE_FMT_S32, pcm_u24le, "PCM unsigned 24-bit little-endian");
PCM_CODEC (CODEC_ID_PCM_U32BE, AV_SAMPLE_FMT_S32, pcm_u32be, "PCM unsigned 32-bit big-endian"); PCM_CODEC (CODEC_ID_PCM_U32BE, AV_SAMPLE_FMT_S32, pcm_u32be, "PCM unsigned 32-bit big-endian");
PCM_CODEC (CODEC_ID_PCM_U32LE, AV_SAMPLE_FMT_S32, pcm_u32le, "PCM unsigned 32-bit little-endian"); PCM_CODEC (CODEC_ID_PCM_U32LE, AV_SAMPLE_FMT_S32, pcm_u32le, "PCM unsigned 32-bit little-endian");
PCM_CODEC (CODEC_ID_PCM_ZORK, AV_SAMPLE_FMT_S16, pcm_zork, "PCM Zork"); PCM_CODEC (CODEC_ID_PCM_ZORK, AV_SAMPLE_FMT_U8, pcm_zork, "PCM Zork");