diff options
author | Takayuki 'January June' Suwa <jjsuwa.sys3175@gmail.com> | 2017-04-01 02:14:13 +0900 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-04-01 12:51:00 +0200 |
commit | e3d8963c3cb5b8cd31460dd9b3b9dba2a2343bf5 (patch) | |
tree | bb946f036884992f82b0a3aafe2cc82712dac2fc /libavcodec/dsddec.c | |
parent | 6200bf89a807288ceff3a0ec2b7380142355df8b (diff) | |
download | ffmpeg-e3d8963c3cb5b8cd31460dd9b3b9dba2a2343bf5.tar.gz |
avcodec/dsddec: correct for DSD silence bit-ordering
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/dsddec.c')
-rw-r--r-- | libavcodec/dsddec.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/libavcodec/dsddec.c b/libavcodec/dsddec.c index 880d69191c..2c5c357acc 100644 --- a/libavcodec/dsddec.c +++ b/libavcodec/dsddec.c @@ -31,10 +31,18 @@ #include "avcodec.h" #include "dsd.h" +#define DSD_SILENCE 0x69 +/* 0x69 = 01101001 + * This pattern "on repeat" makes a low energy 352.8 kHz tone + * and a high energy 1.0584 MHz tone which should be filtered + * out completely by any playback system --> silence + */ + static av_cold int decode_init(AVCodecContext *avctx) { DSDContext * s; int i; + uint8_t silence; ff_init_dsd_data(); @@ -42,15 +50,10 @@ static av_cold int decode_init(AVCodecContext *avctx) if (!s) return AVERROR(ENOMEM); + silence = avctx->codec_id == AV_CODEC_ID_DSD_LSBF || avctx->codec_id == AV_CODEC_ID_DSD_LSBF_PLANAR ? ff_reverse[DSD_SILENCE] : DSD_SILENCE; for (i = 0; i < avctx->channels; i++) { s[i].pos = 0; - memset(s[i].buf, 0x69, sizeof(s[i].buf)); - - /* 0x69 = 01101001 - * This pattern "on repeat" makes a low energy 352.8 kHz tone - * and a high energy 1.0584 MHz tone which should be filtered - * out completely by any playback system --> silence - */ + memset(s[i].buf, silence, sizeof(s[i].buf)); } avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; |