From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ffmpeg-devel-bounces@ffmpeg.org>
Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100])
	by master.gitmailbox.com (Postfix) with ESMTP id A178642F01
	for <ffmpegdev@gitmailbox.com>; Thu, 13 Jan 2022 02:39:45 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BFFBF68B852;
	Thu, 13 Jan 2022 04:05:45 +0200 (EET)
Received: from mail-qv1-f45.google.com (mail-qv1-f45.google.com
 [209.85.219.45])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 88B2568AFBA
 for <ffmpeg-devel@ffmpeg.org>; Thu, 13 Jan 2022 04:05:41 +0200 (EET)
Received: by mail-qv1-f45.google.com with SMTP id iw1so5174732qvb.1
 for <ffmpeg-devel@ffmpeg.org>; Wed, 12 Jan 2022 18:05:41 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=IjpGrBykBgYvB9+z8BGKv85zCdC9YOqvzeiqbB/1yWs=;
 b=QPwYkW7gVzZHN2YVK0i0dJu3PIIsiHtubdaisB6U1oDokiIjHcvMpjk08p9Dy6X7FB
 xKYM3cDxCDidky094K2jGMEWVJKvyn+XAZWNIf8rqXBoqyaF+2Z28b0DQO/FsFtiYloC
 xM2McTX2KY3FxPhJQ6qpSGMCyKYNDtjaDlcXoTAbtXvKkP/ucYauK1ME+ipfz5ZDoTUS
 HCUFsFv816c3f3xGIac2uoK/Bq7Yn7A2wvcQwl2JKCSjObLTxaa9bu2KmHogbwaQOlsj
 aH+xusrsquxH7rikp6hY0yK4eKb0ZVvD22ej+FmWBnfyGHPiGs7hz5fousM+cSDTfjTj
 3wIQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=IjpGrBykBgYvB9+z8BGKv85zCdC9YOqvzeiqbB/1yWs=;
 b=lh4Kzs9umktYxm3k9h5VfBXzawmmdIBuTt+h4iJNO35OkzDJ5zSErDQ50MEfbhEitW
 LIt00O3Bp5AJqPrUjIcOpYSAZzwQIh6GWM4yS13ClPCKj7dlkZtfSDRX+eQJFOGl/v3M
 ifRxizO7EudhP+f3fvXhnDy7jZSDEo9JHs1+Fx/P55sS6aD+xpLA+hDDRh9ESJpCPc8D
 TLMGhQyoe8FBueGzrAP5iUODkVEQdrPPaX3TvtYn0Rk2fKfgvmW5S925Av7LC0ndvPaL
 SznGVj2bMaCIDPar8dXqKrEUDQooQYVtf45zcitxIRybrJU4Mvl30FNYW3aP6PosK8rP
 CCvQ==
X-Gm-Message-State: AOAM530cszwFLV15VlU6DuwktRR80IdBJxPBKgsZBr3beygVYRH34TQI
 Clh5Yv5u9QhxhtZlZwQZDzwF/2QQJ9k=
X-Google-Smtp-Source: ABdhPJyO62G+oWB0uRMKRCP22eofwlOOG+QKVaVRndcDw+ny6sBeT8DEjcWBIIP3VSwiWgludKZsIg==
X-Received: by 2002:a05:6214:da8:: with SMTP id h8mr2258621qvh.9.1642039540143; 
 Wed, 12 Jan 2022 18:05:40 -0800 (PST)
Received: from localhost.localdomain ([186.136.131.95])
 by smtp.gmail.com with ESMTPSA id k9sm1264556qko.29.2022.01.12.18.05.39
 for <ffmpeg-devel@ffmpeg.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 12 Jan 2022 18:05:39 -0800 (PST)
From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Date: Wed, 12 Jan 2022 23:04:56 -0300
Message-Id: <20220113020518.730-8-jamrial@gmail.com>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20220113015101.4-1-jamrial@gmail.com>
References: <20220113015101.4-1-jamrial@gmail.com>
MIME-Version: 1.0
Subject: [FFmpeg-devel] [PATCH 217/281] hca: convert to new channel layout
 API
X-BeenThere: ffmpeg-devel@ffmpeg.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org>
List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe>
List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel>
List-Post: <mailto:ffmpeg-devel@ffmpeg.org>
List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help>
List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe>
Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
Archived-At: <https://master.gitmailbox.com/ffmpegdev/20220113020518.730-8-jamrial@gmail.com/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/hcadec.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavcodec/hcadec.c b/libavcodec/hcadec.c
index c98f8eb379..9757fcc74b 100644
--- a/libavcodec/hcadec.c
+++ b/libavcodec/hcadec.c
@@ -114,7 +114,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
     avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
     c->crc_table = av_crc_get_table(AV_CRC_16_ANSI);
 
-    if (avctx->channels <= 0 || avctx->channels > 16)
+    if (avctx->ch_layout.nb_channels <= 0 || avctx->ch_layout.nb_channels > 16)
         return AVERROR(EINVAL);
 
     ret = init_get_bits8(gb, avctx->extradata, avctx->extradata_size);
@@ -194,7 +194,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
     if (!c->track_count)
         c->track_count = 1;
 
-    b = avctx->channels / c->track_count;
+    b = avctx->ch_layout.nb_channels / c->track_count;
     if (c->stereo_band_count && b > 1) {
         int8_t *x = r;
 
@@ -239,7 +239,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
     if (c->base_band_count + c->stereo_band_count + (unsigned long)c->hfr_group_count > 128ULL)
         return AVERROR_INVALIDDATA;
 
-    for (int i = 0; i < avctx->channels; i++) {
+    for (int i = 0; i < avctx->ch_layout.nb_channels; i++) {
         c->ch[i].chan_type = r[i];
         c->ch[i].count     = c->base_band_count + ((r[i] != 2) ? c->stereo_band_count : 0);
         c->ch[i].hfr_scale = &c->ch[i].scale_factors[c->base_band_count + c->stereo_band_count];
@@ -413,20 +413,20 @@ static int decode_frame(AVCodecContext *avctx, void *data,
 
     packed_noise_level = (get_bits(gb, 9) << 8) - get_bits(gb, 7);
 
-    for (ch = 0; ch < avctx->channels; ch++)
+    for (ch = 0; ch < avctx->ch_layout.nb_channels; ch++)
         unpack(c, &c->ch[ch], c->hfr_group_count, packed_noise_level, c->ath);
 
     for (int i = 0; i < 8; i++) {
-        for (ch = 0; ch < avctx->channels; ch++)
+        for (ch = 0; ch < avctx->ch_layout.nb_channels; ch++)
             dequantize_coefficients(c, &c->ch[ch]);
-        for (ch = 0; ch < avctx->channels; ch++)
+        for (ch = 0; ch < avctx->ch_layout.nb_channels; ch++)
             reconstruct_hfr(c, &c->ch[ch], c->hfr_group_count, c->bands_per_hfr_group,
                             c->stereo_band_count + c->base_band_count, c->total_band_count);
-        for (ch = 0; ch < avctx->channels - 1; ch++)
+        for (ch = 0; ch < avctx->ch_layout.nb_channels - 1; ch++)
             apply_intensity_stereo(c, &c->ch[ch], &c->ch[ch+1], i,
                                    c->total_band_count - c->base_band_count,
                                    c->base_band_count, c->stereo_band_count);
-        for (ch = 0; ch < avctx->channels; ch++)
+        for (ch = 0; ch < avctx->ch_layout.nb_channels; ch++)
             run_imdct(c, &c->ch[ch], i, samples[ch] + i * 128);
     }
 
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".