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 1BABA42EFC for ; Thu, 13 Jan 2022 02:40:47 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2740568B884; Thu, 13 Jan 2022 04:05:50 +0200 (EET) Received: from mail-qt1-f177.google.com (mail-qt1-f177.google.com [209.85.160.177]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3751768B84B for ; Thu, 13 Jan 2022 04:05:45 +0200 (EET) Received: by mail-qt1-f177.google.com with SMTP id y17so5341344qtx.9 for ; Wed, 12 Jan 2022 18:05:45 -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=Z/2aqDOgloct0BkI82zAYATCk0c13opHhtRoUNM0/aA=; b=lAus1XJ5EAmxWyHYHE9CGH0LI6Crqv+ljJVbd6FKttSjHDl0D9Im1ML9Nfxz6bd4XV Uiw+EelqgAKIRzCuuNexbw78/JnGzEN6jc4EUornXg2veNIPAWcpJ2+q12DnJhaiS3Vv 0iFOmTVtA3tvk9USqdHQR7xQrFzjJYc7me45DpOSRvDDzmrdl0pYaol2I05SlpU03r80 CqKhXhYwHfXMgvuxRK+FhqNBlx++M7ZSGqZbk5yMs+hDs3dSVhhqb6+sg0TIY5SVR5/O Xbc1YGPsEE2kORkbTeoId4LLotfdm3ZZs+FgEayST+5jaCnJqAg0SwQRc/dlXXdm0BTS zC7w== 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=Z/2aqDOgloct0BkI82zAYATCk0c13opHhtRoUNM0/aA=; b=18+L8Uy//R2LtZ/44h2wlRaWjfWPVS//6wSdeXg5p1CL5ClhPC/2SKz423kUzqMZmD KEYEzjMLeZENbSsBLDNzkI8WzQem9TIEC1Ft2e9vesW4R7krVpOxr0DvJ0LY0/zx3JNe HknbhgVlSmLeYY3oxdNSggXqfb4XH9sYlHN8PC1yEiEZwhCyVWcOSebUwAynC1ZVA+xs r6tYIXb8ViO6m5tkXcYoxMvOynxYIL1TD3E/mgbxs86fLkfZe+fuHtRJEaT04E1EovMG sMyszjfJ7ZhKlj1V78WUTj3q6lT0ewjXAW9tUAZ5YYFyFVcWFVVXdYz9TCapMUuemd7x hlJA== X-Gm-Message-State: AOAM530MjFjZGlejsHinfEcTZDXjpywxvxTBJEnkWA74Pi/ghhsNhfZN T7wgjmVuaX9sbDOWmkgqs4N5qZVCnc4= X-Google-Smtp-Source: ABdhPJxx2QwdexId0sg7nMzokBZiPXAylMqS6w0RtzGYa6Wm/1Fw94JyPZ7vFzyfReLZLKG59bHOrQ== X-Received: by 2002:a05:622a:148e:: with SMTP id t14mr2024058qtx.254.1642039543770; Wed, 12 Jan 2022 18:05:43 -0800 (PST) Received: from localhost.localdomain ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id k9sm1264556qko.29.2022.01.12.18.05.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 18:05:43 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Jan 2022 23:04:59 -0300 Message-Id: <20220113020518.730-11-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 220/281] imc: 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: Vittorio Giovara Signed-off-by: Anton Khirnov Signed-off-by: James Almer --- libavcodec/imc.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/libavcodec/imc.c b/libavcodec/imc.c index 116c273ba0..89b2ac33e6 100644 --- a/libavcodec/imc.c +++ b/libavcodec/imc.c @@ -206,15 +206,17 @@ static av_cold int imc_decode_init(AVCodecContext *avctx) return AVERROR_PATCHWELCOME; } - if (avctx->codec_id == AV_CODEC_ID_IMC) - avctx->channels = 1; + if (avctx->codec_id == AV_CODEC_ID_IMC) { + av_channel_layout_uninit(&avctx->ch_layout); + avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; + } - if (avctx->channels > 2) { + if (avctx->ch_layout.nb_channels > 2) { avpriv_request_sample(avctx, "Number of channels > 2"); return AVERROR_PATCHWELCOME; } - for (j = 0; j < avctx->channels; j++) { + for (j = 0; j < avctx->ch_layout.nb_channels; j++) { q->chctx[j].decoder_reset = 1; for (i = 0; i < BANDS; i++) @@ -270,8 +272,6 @@ static av_cold int imc_decode_init(AVCodecContext *avctx) ff_bswapdsp_init(&q->bdsp); avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; - avctx->channel_layout = avctx->channels == 1 ? AV_CH_LAYOUT_MONO - : AV_CH_LAYOUT_STEREO; ff_thread_once(&init_static_once, imc_init_static); @@ -1013,7 +1013,7 @@ static int imc_decode_block(AVCodecContext *avctx, IMCContext *q, int ch) memset(chctx->skipFlags, 0, sizeof(chctx->skipFlags)); - imc_imdct256(q, chctx, avctx->channels); + imc_imdct256(q, chctx, avctx->ch_layout.nb_channels); return 0; } @@ -1032,7 +1032,7 @@ static int imc_decode_frame(AVCodecContext *avctx, void *data, q->avctx = avctx; - if (buf_size < IMC_BLOCK_SIZE * avctx->channels) { + if (buf_size < IMC_BLOCK_SIZE * avctx->ch_layout.nb_channels) { av_log(avctx, AV_LOG_ERROR, "frame too small!\n"); return AVERROR_INVALIDDATA; } @@ -1042,7 +1042,7 @@ static int imc_decode_frame(AVCodecContext *avctx, void *data, if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - for (i = 0; i < avctx->channels; i++) { + for (i = 0; i < avctx->ch_layout.nb_channels; i++) { q->out_samples = (float *)frame->extended_data[i]; q->bdsp.bswap16_buf(buf16, (const uint16_t *) buf, IMC_BLOCK_SIZE / 2); @@ -1055,14 +1055,14 @@ static int imc_decode_frame(AVCodecContext *avctx, void *data, return ret; } - if (avctx->channels == 2) { + if (avctx->ch_layout.nb_channels == 2) { q->butterflies_float((float *)frame->extended_data[0], (float *)frame->extended_data[1], COEFFS); } *got_frame_ptr = 1; - return IMC_BLOCK_SIZE * avctx->channels; + return IMC_BLOCK_SIZE * avctx->ch_layout.nb_channels; } static av_cold int imc_decode_close(AVCodecContext * avctx) -- 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".