[FFmpeg-devel] DSD and supporting codec-requested sample rate change

Michael Niedermayer michaelni at gmx.at
Mon Apr 21 23:34:35 CEST 2014

On Mon, Apr 21, 2014 at 04:15:09PM +1000, Peter Ross wrote:
> Hi,
> Direct Stream Digital (DSD) is the name given to the 1-bit delta sigma encoding
> system found in audiophile equipment. It is an alternative to PCM.
> A DSD decoder was added recently that transforms an input DSD bitstream into
> floating point PCM. While this is sufficient to listen to content on a computer,
> it doesn't permit direct manipulation of the DSD samples. Nor does it let FFmpeg
> feed DSD samples into an external DAC.
> I have started modifying FFmpeg to better support DSD, but have hit problems with
> sample rate changes. Potentially some API changes to libswresample is required.
> Ideas or comments welcome.
> 1. add AV_SAMPLE_FMT_DSD (and the planar variant).
> 2. incorporate DSD->PCM conversion into libswresample.
> 3. rework the dsd_msbf, dsd_lsbf, etc decoders to output AV_SAMPLE_FMT_DSD.
>    (very similar in function to the libavcodec/pcm.c decoders)
> 4. DSD-over-PCM (DoP) encoder
>    DoP is a method of storing DSD bits into a 24-bit PCM stream. The high 8-bits
>    of each PCM sample is marked with a pattern, and the lower 16-bits are DSD samples.
>    External DACs are able to detect the pattern and process the raw DSD samples.
>    http://dsd-guide.com/sites/default/files/white-papers/DoP_openStandard_1v1.pdf
> 5. DST (Direct Stream Transfer) decoder
>    Lossless compression for DSD samples. Described in MPEG-4 Part 3, Subpart 10.
>    http://itscj.ipsj.or.jp/sc29/open/29view/29n6213t.doc
> 1. DSD->PCM conversion results in a change to the sample rate. For example,
>     2.8224 MHz 1-bit DSD samples => 352.8 kHz PCM samples; and
>     5.6448 MHz 1-bit DSD samples => 705.6 kHz PCM samples.
>    a) Should libswresample return the new sample rate?

id tend to suggest that the sample rates should represent the true
(in a mathematical sense) samplerates of the signals.
And i realize that this definition is a bit fuzzy without a definition
of what a sample is.

>    b) Should the user of libswresample be expected to know the change between
>       DSD->PCM and populate the 'in_sample_rate' and 'out_sample_rate' accordingly?

id suggest that it should be handled like any other sample format
but iam not working on this, you do, so there may be better options
that iam not recognizing ...

> 2. DoP encoding takes DSD 1-bit samples @ 2.8224 MHz and smushes them into 24-bit
>    PCM @ 176.4 kHz. How can the DoP codec inform avcodec that the output packets have
>    a different sample rate? Editing 'avctx->sample_rate' doesnt work because other
>    modules expect this information to remain static.

iam not sure i understand the problem

where does mhz DSD -> khz PCM differ from mhz PCM -> khz PCM ?


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140421/dff93377/attachment.asc>

More information about the ffmpeg-devel mailing list