diff options
author | Paul B Mahol <onemda@gmail.com> | 2021-02-22 00:30:22 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2021-03-01 17:36:16 +0100 |
commit | 5111707df609796bf70a16ebbcf5a3d0bfa8c432 (patch) | |
tree | 5f42196318b9803bfda21520163f2787b3edab63 /libavcodec/pcm.c | |
parent | 0e645b98c66aafe32517b946a6484eb5579172d4 (diff) | |
download | ffmpeg-5111707df609796bf70a16ebbcf5a3d0bfa8c432.tar.gz |
avcodec: add SGA PCM decoder
Diffstat (limited to 'libavcodec/pcm.c')
-rw-r--r-- | libavcodec/pcm.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index 7f0af8564f..19d04e9181 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -419,6 +419,14 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data, for (; n > 0; n--) *samples++ = *src++ + 128; break; + case AV_CODEC_ID_PCM_SGA: + for (; n > 0; n--) { + int sign = *src >> 7; + int magn = *src & 0x7f; + *samples++ = sign ? 128 - magn : 128 + magn; + src++; + } + break; case AV_CODEC_ID_PCM_S8_PLANAR: n /= avctx->channels; for (c = 0; c < avctx->channels; c++) { @@ -622,3 +630,4 @@ PCM_CODEC (PCM_U32LE, AV_SAMPLE_FMT_S32, pcm_u32le, "PCM unsigned PCM_CODEC (PCM_S64BE, AV_SAMPLE_FMT_S64, pcm_s64be, "PCM signed 64-bit big-endian"); PCM_CODEC (PCM_S64LE, AV_SAMPLE_FMT_S64, pcm_s64le, "PCM signed 64-bit little-endian"); PCM_CODEC (PCM_VIDC, AV_SAMPLE_FMT_S16, pcm_vidc, "PCM Archimedes VIDC"); +PCM_DECODER(PCM_SGA, AV_SAMPLE_FMT_U8, pcm_sga, "PCM SGA"); |