History

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

Justin Ruggles committed 15 years ago

Commit 67a3b671 parent 06af3351 file · +11 −11Browse files

Unified · Split

libavcodec/pcm.c+11−11
@@ -172,10 +172,11 @@ static int pcm_encode_frame(AVCodecContext *avctx, · 171 unmodified lines
172 dst += n*sample_size;172 dst += n*sample_size;
173 break;173 break;
174 case CODEC_ID_PCM_ZORK:174 case CODEC_ID_PCM_ZORK:
175 for(;n>0;n--) {175 srcu8 = data;
176 v= *samples++ >> 8;176 for (; n > 0; n--) {
177 if(v<0) v = -v;177 v = *srcu8++;
178 else v+= 128;178 if (v < 128)
179 v = 128 - v;
179 *dst++ = v;180 *dst++ = v;
180 }181 }
181 break;182 break;
@@ -387,12 +388,11 @@ static int pcm_decode_frame(AVCodecContext *avctx, · 205 unmodified lines
387 samples += n * sample_size;388 samples += n * sample_size;
388 break;389 break;
389 case CODEC_ID_PCM_ZORK:390 case CODEC_ID_PCM_ZORK:
390 for(;n>0;n--) {391 for (; n > 0; n--) {
391 int x= *src++;392 int v = *src++;
392 if(x&128) x-= 128;393 if (v < 128)
393 else x = -x;394 v = 128 - v;
394 AV_WN16A(samples, x << 8);395 *samples++ = v;
395 samples += 2;
396 }396 }
397 break;397 break;
398 case CODEC_ID_PCM_ALAW:398 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 · 119 unmodified lines
518PCM_CODEC (CODEC_ID_PCM_U24LE, AV_SAMPLE_FMT_S32, pcm_u24le, "PCM unsigned 24-bit little-endian");518PCM_CODEC (CODEC_ID_PCM_U24LE, AV_SAMPLE_FMT_S32, pcm_u24le, "PCM unsigned 24-bit little-endian");
519PCM_CODEC (CODEC_ID_PCM_U32BE, AV_SAMPLE_FMT_S32, pcm_u32be, "PCM unsigned 32-bit big-endian");519PCM_CODEC (CODEC_ID_PCM_U32BE, AV_SAMPLE_FMT_S32, pcm_u32be, "PCM unsigned 32-bit big-endian");
520PCM_CODEC (CODEC_ID_PCM_U32LE, AV_SAMPLE_FMT_S32, pcm_u32le, "PCM unsigned 32-bit little-endian");520PCM_CODEC (CODEC_ID_PCM_U32LE, AV_SAMPLE_FMT_S32, pcm_u32le, "PCM unsigned 32-bit little-endian");
521PCM_CODEC (CODEC_ID_PCM_ZORK, AV_SAMPLE_FMT_S16, pcm_zork, "PCM Zork");521PCM_CODEC (CODEC_ID_PCM_ZORK, AV_SAMPLE_FMT_U8, pcm_zork, "PCM Zork");

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t