linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	vkoul@kernel.org, perex@perex.cz, tiwai@suse.com,
	plai@codeaurora.org
Cc: alsa-devel@alsa-project.org, bgoswami@codeaurora.org,
	vathota@codeaurora.org, lgirdwood@gmail.com,
	linux-kernel@vger.kernel.org, broonie@kernel.org,
	ckeepax@opensource.cirrus.com
Subject: Re: [RFC PATCH] ALSA: compress: add support to change codec profile in gapless playback
Date: Mon, 6 Jul 2020 10:14:30 -0500	[thread overview]
Message-ID: <ee34dac9-715c-6e6c-aa33-bb46f0c8261a@linux.intel.com> (raw)
In-Reply-To: <2444711a-319e-1f9b-1289-7744bb1a2987@linaro.org>

On 7/3/20 4:47 AM, Srinivas Kandagatla wrote:
> Thanks Pierre for the comments,
> 
> +Adding Patric Lai into loop,
> 
> 
> 
> On 02/07/2020 16:00, Pierre-Louis Bossart wrote:
>>
>>
>> On 7/2/20 6:11 AM, Srinivas Kandagatla wrote:
>>> For gapless playback its possible that each track can have different
>>> codec profile with same decoder, for example we have WMA album,
>>> we may have different tracks as WMA v9, WMA v10 and so on
>>>
>>> Existing code does not allow to change this profile while doing gapless
>>> playback.
>>>
>>> This patch adds new SNDRV_COMPRESS_SET_CODEC_PARAMS IOCTL to allow
>>> userspace to set this new parameters required for new codec profile.
>>
>> That does not seem fully correct to me. WMA profiles are actually 
>> different encoding schemes - specifically the WMA 10 LBR.
>>
>> The premise for gapless playback was that the same codec and profile 
>> be used between tracks, so that the same internal delay was used. If 
>> you look at the output data, it's made of zeroes for N samples, and 
>> then you see decoded data. When you change tracks, the first N samples 
>> actually come from the previous track.
>>
>> If you change coding schemes between tracks, you cannot call this 
>> gapless playback. You will both remove the last N samples of the 
>> previous track and insert M zeroes (for the new decoder).
>>
>> If you wanted to support such a mode, you would need to provide an 
>> indication of the delay difference, e.g. by looking at the ID3 tags 
>> and let firmware realign. Unfortunately, you don't send this 
>> information with the new IOCTL? You would also need firmware tricks 
>> for the first decoder to flush out its output and the new decoder to 
>> realign.
>>
>> I also don't see how one might end-up with different profiles for an 
>> album in the first place. The gapless use came mostly from ripping 
>> live music recorded on audio CDs in different tracks, and it would 
>> have taken a twisted mind to select different encodings between tracks.
>>
>> If the 'album' is really a playlist, then the gapless playback as 
>> supported by the ASoC compressed layer is nearly useless. What you 
>> would really want is cross-fade but that's a different use case and 
>> implementation that would be needed.
> 
> Patrick seems to have discussed this topic in detail at one of the audio 
> conf!
> 
> He might want to add more to this discussion.

One more counter-argument I thought of after sending my response. If the 
samples for the previous track and the next track are not generated by 
the *same* filterbank, then you would lose the implicit averaging 
between tracks performed by the filterbank (usually an inverse MDCT), 
which will likely result in sample discontinuities and pop noise on 
transitions. If we have different filterbanks we should really look into 
explicit cross-fading which is a much larger change than what this patch 
suggests.



      reply	other threads:[~2020-07-06 15:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-02 11:11 [RFC PATCH] ALSA: compress: add support to change codec profile in gapless playback Srinivas Kandagatla
2020-07-02 11:36 ` Vinod Koul
2020-07-02 12:29   ` Srinivas Kandagatla
2020-07-02 15:00 ` Pierre-Louis Bossart
2020-07-03  9:47   ` Srinivas Kandagatla
2020-07-06 15:14     ` Pierre-Louis Bossart [this message]

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=ee34dac9-715c-6e6c-aa33-bb46f0c8261a@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=bgoswami@codeaurora.org \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=plai@codeaurora.org \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=tiwai@suse.com \
    --cc=vathota@codeaurora.org \
    --cc=vkoul@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).