From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3E15FC433EF for ; Sun, 12 Dec 2021 11:52:21 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id BE2661909; Sun, 12 Dec 2021 12:51:28 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BE2661909 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1639309938; bh=sC7VsgMdvpbJMADn51kt37v6U3U/BBXjmz9LT1TTAa4=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=lrfX1XWR2YsWsvm9UZiIa1UBaPce10kC0R3TuOAUSEJnw2/pSlcx9j7435DWMDJ3o mVz8oXcuE6gqVwkJkHULx+6OUYfuc8+/XZ3/DJRZuCm0RFRJTIpXUz2wxDGxJ4Td2u 7Mp573hgSeg8JoUbhUx+6OIocDhnPLN8tSQwgN2Y= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 55E12F80165; Sun, 12 Dec 2021 12:51:28 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 14D88F80246; Sun, 12 Dec 2021 12:51:27 +0100 (CET) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C9CABF80161 for ; Sun, 12 Dec 2021 12:51:23 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C9CABF80161 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="mIJX827A"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="YVl98n/u" Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 788725C009F; Sun, 12 Dec 2021 06:51:21 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 12 Dec 2021 06:51:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=EycX5ym0EnPa7yW4BE7A5SkjPPj OyXeH61CZajHpRBA=; b=mIJX827AGJY0zCvGGvi6eZM01R4F4DhvrQbyl7idkjK mLN9TGhvfebEwVZg5BZgJv7spE6FHba79Tu+ASe9GXA6etXtYIr0lIRIYy/fhKrC s/V0YOPxJcoLe1H5LPWv8FjHGps8IZhQMEucYty+a1JhhG9vkjlL2l87eBu66qE+ lbeYfN6WuFYauEVqr4IetPH1B4Y8FNu1xz7s9YkEftU7J44K9aGkUu9owkK3fXXB C6VSGqux3S/LkiQacPvs16r6FdrdFb085w6AbGKDsxVeYcFnc7Rc1t0MiofS0XeI fLoMBwoOPjoR9TYaFpd3D4ZgshOBMeLaw7cSfksFtcA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=EycX5y m0EnPa7yW4BE7A5SkjPPjOyXeH61CZajHpRBA=; b=YVl98n/u3Cv2e7gbMRn7NE pn0J8rskhOtJSmnt8KoT8FMveQhBq9DroqBsvyrozojR+0UVjL/9BvXwDOQVG3Ll fGNus+mAfL69aQ7PiaGNyiKAcVAMJBHFlXHM2Wn1XYQKSfPwtJx8+yHhNOCSwIJ8 vr8kox9a5l5Rsb3L0t0IAekSSW1EJgiGd9j/hoSoEFGd3R9LsdjLSbmA6CfG+IOr 8Z+QeSbhyGIHxMCosiw0cR8/Ly4lHsFtw3esu73pzOCOKn+bgR2ZjW8CNL0UZCCE IZsjVoB0nmYe1mbmRHvVZo4L3Aw9Mrdf2bEhazdjSQIC9CnVgAzqrSfYYZHavasQ == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrkeeigdeffecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepvfgrkhgrshhh ihcuufgrkhgrmhhothhouceoohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhirdhjph eqnecuggftrfgrthhtvghrnhepjeegieefueevueefieeggeejledvgfejgeffjefgvdek leehgfdtfeetjeelkeejnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhi sehsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 12 Dec 2021 06:51:20 -0500 (EST) Date: Sun, 12 Dec 2021 20:51:17 +0900 From: Takashi Sakamoto To: Marios Sioutis Subject: Re: S24LE and S32LE format equivalency Message-ID: Mail-Followup-To: Marios Sioutis , alsa References: <2a4907ee-96d2-9969-de47-80b77b7444d1@jaist.ac.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2a4907ee-96d2-9969-de47-80b77b7444d1@jaist.ac.jp> Cc: alsa X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Hi, On Sun, Dec 12, 2021 at 08:16:57PM +0900, Marios Sioutis wrote: > Hi all, > > Quick question, I was troubleshooting a 24bit USB device and got down the > rabbit hole of sample formats. The device advertises itself as S24LE (4byte > payload) but it appears as S32LE under alsa, something that bothered me a > lot initially. However, If the conversion between the two formats is to just > << 8 i.e. put a zero byte as LSB, then the two formats are essentially > equivalent. > > Is this actually the case? If yes, who performs the conversion? Is it on the > alsa side, or the device already adds a zero byte LSB? > > Thank you in advance, > > Marios I think the format of sample is 'left-justified' or 'right-padding' 24 bit in 32 bit frame. For the case, in ALSA PCM interface, [S|U]32 sample format is used with 'msbits' hardware parameter. The snd-ua101 USB driver might be an good example for the case. * https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/sound/usb/misc/ua101.c#n615 In detail, please refer to my previous patch: * https://lore.kernel.org/alsa-devel/20210529033353.21641-1-o-takashi@sakamocchi.jp/ Unfortunately, as long as I know, no userspace application evaluates the msbits parameter with sample format, however in theory the conversion should be done in userspace in advance of transmission of audio data frame. Regards Takashi Sakamoto