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
172172 dst += n*sample_size;
173173 break;
174174 case CODEC_ID_PCM_ZORK:
175− for(;n>0;n--) {
176− v= *samples++ >> 8;
177− if(v<0) v = -v;
178− else v+= 128;
175+ srcu8 = data;
176+ for (; n > 0; n--) {
177+ v = *srcu8++;
178+ if (v < 128)
179+ v = 128 - v;
179180 *dst++ = v;
180181 }
181182 break;
@@ -387,12 +388,11 @@ static int pcm_decode_frame(AVCodecContext *avctx, · 205 unmodified lines
387388 samples += n * sample_size;
388389 break;
389390 case CODEC_ID_PCM_ZORK:
390− for(;n>0;n--) {
391− int x= *src++;
392− if(x&128) x-= 128;
393− else x = -x;
394− AV_WN16A(samples, x << 8);
395− samples += 2;
391+ for (; n > 0; n--) {
392+ int v = *src++;
393+ if (v < 128)
394+ v = 128 - v;
395+ *samples++ = v;
396396 }
397397 break;
398398 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
518518 PCM_CODEC (CODEC_ID_PCM_U24LE, AV_SAMPLE_FMT_S32, pcm_u24le, "PCM unsigned 24-bit little-endian");
519519 PCM_CODEC (CODEC_ID_PCM_U32BE, AV_SAMPLE_FMT_S32, pcm_u32be, "PCM unsigned 32-bit big-endian");
520520 PCM_CODEC (CODEC_ID_PCM_U32LE, AV_SAMPLE_FMT_S32, pcm_u32le, "PCM unsigned 32-bit little-endian");
521−PCM_CODEC (CODEC_ID_PCM_ZORK, AV_SAMPLE_FMT_S16, pcm_zork, "PCM Zork");
521+PCM_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