public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Alexey Klimov <alexey.klimov@linaro.org>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Srinivas Kandagatla <srini@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Patrick Lai <plai@qti.qualcomm.com>,
	Annemarie Porter <annemari@quicinc.com>,
	srinivas.kandagatla@oss.qualcomm.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 v3 1/3] ALSA: compress: add raw opus codec define and opus decoder structs
Date: Thu, 18 Sep 2025 10:38:25 +0530	[thread overview]
Message-ID: <aMuTyZy50IvpAEG9@vaman> (raw)
In-Reply-To: <20250917-opus_codec_rfc_v1-v3-1-7737ad40132e@linaro.org>

On 17-09-25, 08:32, Alexey Klimov wrote:
> Adds a raw opus codec define and raw opus decoder structs.
> This is for raw OPUS packets not packed in any type of container
> (for instance OGG container). The decoder struct fields are
> taken from corresponding RFC document: RFC 7845 Section 5.
> 
> Cc: Srinivas Kandagatla <srini@kernel.org>
> Cc: Vinod Koul <vkoul@kernel.org>
> Co-developed-by: Annemarie Porter <annemari@quicinc.com>
> Signed-off-by: Annemarie Porter <annemari@quicinc.com>
> Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
> ---
>  include/uapi/sound/compress_params.h | 43 +++++++++++++++++++++++++++++++++++-
>  1 file changed, 42 insertions(+), 1 deletion(-)
> 
> diff --git a/include/uapi/sound/compress_params.h b/include/uapi/sound/compress_params.h
> index bc7648a30746f4632ecf6695868e79550a431dfa..faf4fa911f7fc2830c3ae42b93650fe40d8a776b 100644
> --- a/include/uapi/sound/compress_params.h
> +++ b/include/uapi/sound/compress_params.h
> @@ -43,7 +43,8 @@
>  #define SND_AUDIOCODEC_BESPOKE               ((__u32) 0x0000000E)
>  #define SND_AUDIOCODEC_ALAC                  ((__u32) 0x0000000F)
>  #define SND_AUDIOCODEC_APE                   ((__u32) 0x00000010)
> -#define SND_AUDIOCODEC_MAX                   SND_AUDIOCODEC_APE
> +#define SND_AUDIOCODEC_OPUS_RAW              ((__u32) 0x00000011)
> +#define SND_AUDIOCODEC_MAX                   SND_AUDIOCODEC_OPUS_RAW
>  
>  /*
>   * Profile and modes are listed with bit masks. This allows for a
> @@ -324,6 +325,45 @@ struct snd_dec_ape {
>  	__u32 seek_table_present;
>  } __attribute__((packed, aligned(4)));
>  
> +/**
> + * struct snd_dec_opus - Opus decoder parameters (raw opus packets)
> + * @version: Usually should be '1' but can be split into major (4 upper bits)
> + * and minor (4 lower bits) sub-fields.

Please clarify, if that should be 1.0 so a value of 0x10

> + * @num_channels: Number of output channels.
> + * @pre_skip: Number of samples to discard at 48 kHz.
> + * @sample_rate: Sample rate of original input.
> + * @output_gain: Gain to apply when decoding (in Q7.8 format).
> + * @mapping_family: Order and meaning of output channels. Only values 0 and 1
> + * are expected; values 2..255 are not recommended for playback.
> + *
> + * Optional channel mapping table. Describes mapping of opus streams to decoded
> + * channels.
> + * @struct snd_dec_opus_ch_map
> + *	@stream_count: Number of streams encoded in each Ogg packet.
> + *	@coupled_count: Number of streams whose decoders are used for two
> + *		channels.
> + *	@channel_map: describes which decoded channel to be used for each one.
> + *		See RFC doc for details.
> + *		This supports only mapping families 0 and 1, therefore max
> + *		number of channels is 8.
> + *
> + * These options were extracted from RFC7845 Section 5.
> + */
> +
> +struct snd_dec_opus {
> +	__u8 version;
> +	__u8 num_channels;
> +	__u16 pre_skip;
> +	__u32 sample_rate;
> +	__u16 output_gain;
> +	__u8 mapping_family;
> +	struct snd_dec_opus_ch_map {
> +		__u8 stream_count;
> +		__u8 coupled_count;
> +		__u8 channel_map[8];
> +	} chan_map;
> +} __attribute__((packed, aligned(4)));
> +
>  union snd_codec_options {
>  	struct snd_enc_wma wma;
>  	struct snd_enc_vorbis vorbis;
> @@ -334,6 +374,7 @@ union snd_codec_options {
>  	struct snd_dec_wma wma_d;
>  	struct snd_dec_alac alac_d;
>  	struct snd_dec_ape ape_d;
> +	struct snd_dec_opus opus_d;
>  	struct {
>  		__u32 out_sample_rate;
>  	} src_d;
> 
> -- 
> 2.47.3

-- 
~Vinod

  reply	other threads:[~2025-09-18  5:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-17  7:32 [PATCH v3 0/3] Add raw OPUS codec support for compress offload Alexey Klimov
2025-09-17  7:32 ` [PATCH v3 1/3] ALSA: compress: add raw opus codec define and opus decoder structs Alexey Klimov
2025-09-18  5:08   ` Vinod Koul [this message]
2025-10-15 16:36     ` Alexey Klimov
2025-09-17  7:32 ` [PATCH v3 2/3] ALSA: compress_offload: increase SNDRV_COMPRESS_VERSION minor version by 1 Alexey Klimov
2025-09-18  5:09   ` Vinod Koul
2025-09-17  7:32 ` [PATCH v3 3/3] ASoC: qcom: qdsp6/audioreach: add support for offloading raw opus playback Alexey Klimov
2025-09-17 11:39   ` Mark Brown
2025-09-19 13:00 ` [PATCH v3 0/3] Add raw OPUS codec support for compress offload Takashi Iwai

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=aMuTyZy50IvpAEG9@vaman \
    --to=vkoul@kernel.org \
    --cc=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 \
    /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