All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alexander E. Patrakov" <patrakov@gmail.com>
To: alsa-devel@alsa-project.org
Cc: gtmkramer@xs4all.nl
Subject: Re: [PATCH] pcm: 2nd round of pcm_misc DSD fixes
Date: Fri, 15 Aug 2014 15:02:35 +0600	[thread overview]
Message-ID: <53EDCCAB.3050206@gmail.com> (raw)
In-Reply-To: <1408085019-5277-1-git-send-email-gtmkramer@xs4all.nl>

15.08.2014 12:43, Jurgen Kramer wrote:
> Functions 'snd_pcm_format_silence_64' and 'snd_pcm_format_size' also need to be
> able to handle the DSD formats.

0 is not a DSD silence value. It is the most negative value, similar to 
-32768 for S16 samples. We need something that will average to zero.

ffmpeg uses a repeating pattern of 0x69 here, with this comment:

         /* 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
          */

https://ffmpeg.org/pipermail/ffmpeg-cvslog/2014-April/076427.html

>
> Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
> ---
>   src/pcm/pcm_misc.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/src/pcm/pcm_misc.c b/src/pcm/pcm_misc.c
> index 24d52f9..c52e7bf 100644
> --- a/src/pcm/pcm_misc.c
> +++ b/src/pcm/pcm_misc.c
> @@ -317,11 +317,13 @@ ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples)
>   	switch (format) {
>   	case SNDRV_PCM_FORMAT_S8:
>   	case SNDRV_PCM_FORMAT_U8:
> +	case SNDRV_PCM_FORMAT_DSD_U8:
>   		return samples;
>   	case SNDRV_PCM_FORMAT_S16_LE:
>   	case SNDRV_PCM_FORMAT_S16_BE:
>   	case SNDRV_PCM_FORMAT_U16_LE:
>   	case SNDRV_PCM_FORMAT_U16_BE:
> +	case SNDRV_PCM_FORMAT_DSD_U16_LE:
>   		return samples * 2;
>   	case SNDRV_PCM_FORMAT_S18_3LE:
>   	case SNDRV_PCM_FORMAT_S18_3BE:
> @@ -387,6 +389,8 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
>   	case SNDRV_PCM_FORMAT_S20_3BE:
>   	case SNDRV_PCM_FORMAT_S18_3LE:
>   	case SNDRV_PCM_FORMAT_S18_3BE:
> +	case SNDRV_PCM_FORMAT_DSD_U8:
> +	case SNDRV_PCM_FORMAT_DSD_U16_LE:
>   		return 0;
>   	case SNDRV_PCM_FORMAT_U8:
>   		return 0x8080808080808080ULL;
>


-- 
Alexander E. Patrakov

  reply	other threads:[~2014-08-15  9:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-15  6:43 [PATCH] pcm: 2nd round of pcm_misc DSD fixes Jurgen Kramer
2014-08-15  9:02 ` Alexander E. Patrakov [this message]
2014-08-15 15:40   ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53EDCCAB.3050206@gmail.com \
    --to=patrakov@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=gtmkramer@xs4all.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.