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

Michael Niedermayer michaelni at gmx.at
Mon Apr 28 22:21:48 CEST 2014


On Sat, Apr 26, 2014 at 04:42:27AM +0200, Peter Ross wrote:
> Quoting Michael Niedermayer <michaelni at gmx.at>:
> 
> >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.
> >>
> [..]
> >>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.
> 
> Right. Each DSD sample is 1-bit.
> 
> >>
> >>   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 ...
> 
> Okay.
> 
> >>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 ?
> 
> DoP is an industry standard that uses PCM to deliver DSD samples to
> external DAC equipment.
> 
> The encoding stores 16 x 1-bit DSD samples into each 24-bit PCM sample.
> The high 8 bits of each PCM sample indicate an alternating magic
> number, so that capable DACs can detect the marker and process the
> DSD samples. This is known as bit-perfect DSD. Therefore a source
> stream of DSD samples @ 2.8224 Mhz is "encoded" into a 176.4kHz PCM
> stream (2.8224 x 10^6 / 16).
> 
> The challenge for FFmpeg is that libavcodec/dopenc.c needs to change
> the sample rate (from 2.8224 MHz to 176.4kHz). Our codecs have not
> traditionally done this; there is no concept of input and output
> sample rate.
> 
> A solution I have considered is adding
> AVCodecContext.dsd_sample_rate that would only apply to
> SAMPLE_FMT_DSD. The dopenc_init() function would read
> dsd_sample_rate and then set sample_rate.

there is some similar mess with AAC-SBR where a incorrect sample
rate is stored

about the 24bit 176.4kHz, can this be played by normal PCM decoders?
that is, do the 8 or less high bits represent a downsampled version?

also what about simply considering that 24bit encoding to be a
opaque encoding like any other encoder produces ? 
there would be no sample rate on the output just a packet/frame rate

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- 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/20140428/f1189e59/attachment.asc>


More information about the ffmpeg-devel mailing list