linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Alexey Klimov" <alexey.klimov@linaro.org>
To: "Srinivas Kandagatla" <srinivas.kandagatla@oss.qualcomm.com>,
	"Srinivas Kandagatla" <srini@kernel.org>
Cc: "Vinod Koul" <vkoul@kernel.org>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Patrick Lai" <plai@qti.qualcomm.com>,
	"Annemarie Porter" <annemari@quicinc.com>,
	<linux-sound@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-msm@vger.kernel.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski@linaro.org>,
	<kernel@oss.qualcomm.com>,
	"Ekansh Gupta" <ekansh.gupta@oss.qualcomm.com>,
	"Pierre-Louis Bossart" <pierre-louis.bossart@linux.dev>
Subject: Re: [PATCH RFC 2/2] ASoC: qcom: qdsp6/audioreach: add support for offloading raw opus playback
Date: Wed, 20 Aug 2025 19:04:10 +0100	[thread overview]
Message-ID: <DC7GC0UEKZDM.2C8KIM6TFLMHK@linaro.org> (raw)
In-Reply-To: <DB2HSWQRGFZM.JVPTBYXCOTKS@linaro.org>

On Thu Jul 3, 2025 at 3:33 PM BST, Alexey Klimov wrote:
> On Wed Jun 18, 2025 at 1:34 PM BST, Srinivas Kandagatla wrote:

[...]

>> Pl use audioreach_set_default_channel_mapping() to fill in the channel
>> mapping data.
>>
>> Why are we not using channel mapping info from the snd_dec_opus struct here?
>
> Okay, I was re-reading RFC and can't really get my head around this.
>
> So first I came up with something like this:
>
> 	switch (opus_cfg->mapping_family) {
> 	case 0:
> 		if (num_chan == 1 || num_chan == 2)
> 			audioreach_set_default_channel_mapping(ch_map, num_chan);
> 		else
> 			/* mapping family 0 allows only 1 or 2 channels */
> 			return -EINVAL;
> 			break;
> 		case 1:
> 			if (num_chan > 8)
> 				return -EINVAL;
> 			if (mcfg->codec.options.opus_d.coupled_count > mcfg->codec.options.opus_d.stream_count)
> 				return -EINVAL;
>
> 			memcpy(ch_map, mcfg->codec.options.opus_d.channel_map, sizeof(mcfg->codec.options.opus_d.channel_map));
> 			break;
> 		default:
> 			/* mapping family 2..255 shouldn't be allowed to playback */
> 			return -EOPNOTSUPP;
> 		}
>
> but I don't think above is correct at all.
>
> After re-reading the RFC few more times. It looks that channel_mapping in
> opus struct has nothing to do with channel mapping that we need to provide
> to DSP here. The channel mapping maps "decoded" channels to output channels
> and seems to be needed by opus decoder logic and in some sense is internal
> thingy to correctly construct sound for output channel from opus stream(s).
> In other words if output channel is present and valid then channel_mapping
> describes how and which decoded stream or streams (coupled or uncoupled)
> to use for producing sound output for that output channel.
> This is described in https://www.rfc-editor.org/rfc/rfc7845#section-5.1.1
>
> The number of output channels here actually matters for us. We can construct
> mapping for channels that we pass to DSP based just only on the number of
> output channels here and let DSP to figure out how to scatter or downmix or
> upmix them to its own output channels.
>
> Conclusion from my understanding:
> -- we shouldn't mess with opus_cfg->channel_mapping here, it is needed for
> the correct operation of decoder, we shouldn't call
> audioreach_set_default_channel_mapping() on it;
> -- mapping output channels to provide the mapping to DSP might require some
> rework or I need to look into this.
>
> Or something else that didn't came up in my mind yet.

As discussed during out-of-list chats I'll update it to include mfc module in
compress-playback path that should handle the mapping to output channels.
I already have a change for that locally and it seems to work, at least it
doesn't break playback.

Thanks,
Alexey

  reply	other threads:[~2025-08-20 18:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-16 15:26 [PATCH RFC 0/2] Add raw OPUS codec support for compress offload Alexey Klimov
2025-06-16 15:26 ` [PATCH RFC 1/2] ALSA: compress: add raw opus codec define and struct snd_dec_opus Alexey Klimov
2025-06-18 12:33   ` Srinivas Kandagatla
2025-08-20 17:59     ` Alexey Klimov
2025-06-16 15:26 ` [PATCH RFC 2/2] ASoC: qcom: qdsp6/audioreach: add support for offloading raw opus playback Alexey Klimov
2025-06-18 12:34   ` Srinivas Kandagatla
2025-07-03 14:33     ` Alexey Klimov
2025-08-20 18:04       ` Alexey Klimov [this message]
2025-08-20 17:56     ` Alexey Klimov

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=DC7GC0UEKZDM.2C8KIM6TFLMHK@linaro.org \
    --to=alexey.klimov@linaro.org \
    --cc=annemari@quicinc.com \
    --cc=broonie@kernel.org \
    --cc=ekansh.gupta@oss.qualcomm.com \
    --cc=kernel@oss.qualcomm.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=plai@qti.qualcomm.com \
    --cc=srini@kernel.org \
    --cc=srinivas.kandagatla@oss.qualcomm.com \
    --cc=tiwai@suse.com \
    --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).