diff mbox

[FFmpeg-devel] dsddec: correct for DSD silence bit-ordering

Message ID 1490980453-3054-1-git-send-email-jjsuwa.sys3175@gmail.com
State Accepted
Commit e3d8963c3cb5b8cd31460dd9b3b9dba2a2343bf5
Headers show

Commit Message

Takayuki 'January June' Suwa March 31, 2017, 5:14 p.m. UTC
---
 libavcodec/dsddec.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

Comments

Paul B Mahol March 31, 2017, 5:32 p.m. UTC | #1
On 3/31/17, Takayuki 'January June' Suwa <jjsuwa.sys3175@gmail.com> wrote:
> ---
>  libavcodec/dsddec.c | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/libavcodec/dsddec.c b/libavcodec/dsddec.c
> index 880d691..2c5c357 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;
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

lgtm
Michael Niedermayer April 1, 2017, 10:25 a.m. UTC | #2
On Fri, Mar 31, 2017 at 07:32:41PM +0200, Paul B Mahol wrote:
> On 3/31/17, Takayuki 'January June' Suwa <jjsuwa.sys3175@gmail.com> wrote:
> > ---
> >  libavcodec/dsddec.c | 17 ++++++++++-------
> >  1 file changed, 10 insertions(+), 7 deletions(-)
> >
> > diff --git a/libavcodec/dsddec.c b/libavcodec/dsddec.c
> > index 880d691..2c5c357 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;
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> 
> lgtm

applied

thx

[...]
--
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.
diff mbox

Patch

diff --git a/libavcodec/dsddec.c b/libavcodec/dsddec.c
index 880d691..2c5c357 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;