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

Peter Ross pross at xvid.org
Mon Apr 21 08:15:09 CEST 2014


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.

5. DST (Direct Stream Transfer) decoder
   Lossless compression for DSD samples. Described in MPEG-4 Part 3, Subpart 10.


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?

   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?
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.


-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- 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/9c493cd9/attachment.asc>

More information about the ffmpeg-devel mailing list