From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id D540D42F5D for ; Thu, 13 Jan 2022 02:46:07 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AEC5768B99A; Thu, 13 Jan 2022 04:07:40 +0200 (EET) Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 11C8B68AEC8 for ; Thu, 13 Jan 2022 04:07:32 +0200 (EET) Received: by mail-qk1-f176.google.com with SMTP id h16so5626083qkp.3 for ; Wed, 12 Jan 2022 18:07:32 -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=gvzpkLYgQan+PpmhIVJrlCKvu7XMU6S4aIib6h+rNfE=; b=FCUm9rGE2s/8522IR6ykxoGO/HDyqk/Oc7dwutz+zT6kVbtGTbNOWpd32Eic+ySWtb g6vYMvhMxcWHUeTviOOBj3C58bRqaE1WH/f7mwsNl3ZfDSDnvQTKB9upU/59rc7XNjgg 5Ycp2rvLBFwioiBpuUnOG8YbXBtX3hJMEuYGzkTEQJWRCH3wyvmeeYpCYyts5Zpi63bP I2H/J6JY/p6gD0SNRSpXvcQR1JD/GrWaSWU5wHFhPIumb8tvNjFtPKOFzJwLtawjcH2V XYHzWQ3GfVcMM2WR0SzUEqFUq2G03w+qcnBYXtlYxBQTJbUbspr0nGsJFoN+EMXLRyJB GT0Q== 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=gvzpkLYgQan+PpmhIVJrlCKvu7XMU6S4aIib6h+rNfE=; b=oU7Dr/cCUVEgIp/bBfINTAES0a6ZwsSW4mtrPFVXJtMcCBCdv6Xdg2pXisIuMBwJ3O xqU1Cb+IFUIQOF687ompy9fXrFl0wk/JgOo+sv5g1nvIWZyMJ83Hn8B41K1uWoXFAi5s g95x9iwVC+ostxwTcOJBDEjI5mhA1YOykX+kS4rlvHjcG36xGc5oKQYVxNVImPZEm1mV ac4jKNY9wc1B70qhD5/Vdy2SyzUadB/sLGKux+O8HLEox4m3bgumOpE1Thtd227pJPXf 7w/5dmAYspEY6tku4NZPQw+TLKKocnrxIbDPhq6FIZc7AcT3pPIRXWUmnhf8kYzfgrop +CVg== X-Gm-Message-State: AOAM5316+1gWD7z3OZ+QFChDfwW8WhWV3y2/K3uLbsukTgdtMb3YHH39 R68GNdrAuzn0OmMAtmkAM6ywJ02SlOM= X-Google-Smtp-Source: ABdhPJwt8z+lBajZmC3Z5qkFcdwvZcF6izpgE4ajjJ9n6Chxuk8X+7nnOBWcsqlucNtZntJkzrZYEg== X-Received: by 2002:a05:620a:6ca:: with SMTP id 10mr1900221qky.206.1642039650694; Wed, 12 Jan 2022 18:07:30 -0800 (PST) Received: from localhost.localdomain ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id a16sm1085946qta.13.2022.01.12.18.07.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 18:07:30 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Jan 2022 23:06:47 -0300 Message-Id: <20220113020713.801-4-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 243/281] on2avc: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Anton Khirnov Signed-off-by: James Almer --- libavcodec/on2avc.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/libavcodec/on2avc.c b/libavcodec/on2avc.c index fa3eb4b219..1d5a9487b3 100644 --- a/libavcodec/on2avc.c +++ b/libavcodec/on2avc.c @@ -691,7 +691,7 @@ static int on2avc_reconstruct_channel_ext(On2AVCContext *c, AVFrame *dst, int of { int ch, i; - for (ch = 0; ch < c->avctx->channels; ch++) { + for (ch = 0; ch < c->avctx->ch_layout.nb_channels; ch++) { float *out = (float*)dst->extended_data[ch] + offset; float *in = c->coeffs[ch]; float *saved = c->delay[ch]; @@ -823,13 +823,13 @@ static int on2avc_decode_subframe(On2AVCContext *c, const uint8_t *buf, c->grouping[i] = !get_bits1(&gb); on2avc_read_ms_info(c, &gb); - for (i = 0; i < c->avctx->channels; i++) + for (i = 0; i < c->avctx->ch_layout.nb_channels; i++) if ((ret = on2avc_read_channel_data(c, &gb, i)) < 0) return AVERROR_INVALIDDATA; - if (c->avctx->channels == 2 && c->ms_present) + if (c->avctx->ch_layout.nb_channels == 2 && c->ms_present) on2avc_apply_ms(c); if (c->window_type < WINDOW_TYPE_EXT4) { - for (i = 0; i < c->avctx->channels; i++) + for (i = 0; i < c->avctx->ch_layout.nb_channels; i++) on2avc_reconstruct_channel(c, i, dst, offset); } else { on2avc_reconstruct_channel_ext(c, dst, offset); @@ -910,21 +910,23 @@ static av_cold int on2avc_decode_init(AVCodecContext *avctx) On2AVCContext *c = avctx->priv_data; const uint8_t *lens = ff_on2avc_cb_lens; const uint16_t *syms = ff_on2avc_cb_syms; + int channels = avctx->ch_layout.nb_channels; int i, ret; - if (avctx->channels > 2U) { + if (channels > 2U) { avpriv_request_sample(avctx, "Decoding more than 2 channels"); return AVERROR_PATCHWELCOME; } c->avctx = avctx; avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; - avctx->channel_layout = (avctx->channels == 2) ? AV_CH_LAYOUT_STEREO - : AV_CH_LAYOUT_MONO; + av_channel_layout_uninit(&avctx->ch_layout); + avctx->ch_layout = (channels == 2) ? (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO : + (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; c->is_av500 = (avctx->codec_tag == 0x500); - if (avctx->channels == 2) + if (channels == 2) av_log(avctx, AV_LOG_WARNING, "Stereo mode support is not good, patch is welcome\n"); @@ -936,7 +938,7 @@ static av_cold int on2avc_decode_init(AVCodecContext *avctx) for (; i < 128; i++) c->scale_tab[i] = ceil(ff_exp10(i * 0.1) * 0.5 - 0.01); - if (avctx->sample_rate < 32000 || avctx->channels == 1) + if (avctx->sample_rate < 32000 || channels == 1) memcpy(c->long_win, ff_on2avc_window_long_24000, 1024 * sizeof(*c->long_win)); else -- 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".