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 4CD4942F22 for ; Thu, 13 Jan 2022 02:43:42 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 112C368B91F; Thu, 13 Jan 2022 04:06:06 +0200 (EET) Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 995A568B908 for ; Thu, 13 Jan 2022 04:06:03 +0200 (EET) Received: by mail-qk1-f169.google.com with SMTP id bl18so5591521qkb.5 for ; Wed, 12 Jan 2022 18:06:03 -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=4VZfcurIWJQpUuphoeYI8qq5XleOxH8f/X3ICUfhU7M=; b=caiXURxNezDCELjAGHM5M2snjK9+MnFUubZ4z2IhWksDdUXmOCdcbuGkn55HGl3BZG LK4v09JzwK4vIUHpzq0xCCVUat3xMC3ahoefx1T5SIVQMJeVz2RNXJyF50g08ZtMRmxO Mn3+eZidUGDndW0fDMq2bl+vVCpm9uz1vJ0LZMkTKMB0v6ptQsmECLLYKs11l+nplpG1 cnERN4BAwygY86LjN0utnEGFr2I0Ld7ojwmaui+WfSOBxOa+K5BuAF82BWQcYw+MVHZ8 XoopHQyfTzGOy1ooRNH59NGXEAvgzdGkzlJvSWRxxGQXkLoJOc/pSk1lA34TrsSlRo7z euPw== 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=4VZfcurIWJQpUuphoeYI8qq5XleOxH8f/X3ICUfhU7M=; b=sCope1lFM50QQgCPLjJNK3EyC3a7ecHngYvBtM28fnXtfgnn60U72MoX47UlpegwXj lWMksS+WRRwGzJFnd/66ZuS98lGM0ogtXBHGvvKOFFHffrlbLXIK667RF+JZDXS/DBQR 8J+p45yKagC/yMUu99ymjPCPC/k/jeXJ6Og1cjjcCTxgpK2yNPNBgCozkMguLjqtPmSq 3+raWrosgagiScZ/Asgf2lWbNhrzejf00t02uTmjdkusQDJQAhA8hPuBOUwCMAszZAcW 8aaEbCyYKM38dD1fqkJvZNpvvbVDFZpH5TKyVmw3die/ZmqjJ1OOxZWjKPwQcIvM4Cfh Z1MA== X-Gm-Message-State: AOAM533ZiaOMIDTX2KHFJhT4ynzxLqkQPH/4MeUngvcMpjE6fV7JWXTl yEjf+rB/rv138YfGAamD9X7SMQtRAqg= X-Google-Smtp-Source: ABdhPJyHz/uXr5tOo4vXl3U6ygJciLd+TWyVruGeMHx5XRKN1i8Zj+TA3PkgHExqPy6PEn/UQouWqg== X-Received: by 2002:a05:620a:29d1:: with SMTP id s17mr1833881qkp.424.1642039561995; Wed, 12 Jan 2022 18:06:01 -0800 (PST) Received: from localhost.localdomain ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id k9sm1264556qko.29.2022.01.12.18.06.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 18:06:01 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Jan 2022 23:05:14 -0300 Message-Id: <20220113020518.730-26-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 235/281] mace: 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: James Almer --- libavcodec/mace.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libavcodec/mace.c b/libavcodec/mace.c index 506a0ddece..9ed4747ba9 100644 --- a/libavcodec/mace.c +++ b/libavcodec/mace.c @@ -226,7 +226,7 @@ static void chomp6(ChannelData *chd, int16_t *output, uint8_t val, int tab_idx) static av_cold int mace_decode_init(AVCodecContext * avctx) { - if (avctx->channels > 2 || avctx->channels < 1) + if (avctx->ch_layout.nb_channels > 2 || avctx->ch_layout.nb_channels < 1) return AVERROR(EINVAL); avctx->sample_fmt = AV_SAMPLE_FMT_S16P; @@ -239,31 +239,32 @@ static int mace_decode_frame(AVCodecContext *avctx, void *data, AVFrame *frame = data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; + int channels = avctx->ch_layout.nb_channels; int16_t **samples; MACEContext *ctx = avctx->priv_data; int i, j, k, l, ret; int is_mace3 = (avctx->codec_id == AV_CODEC_ID_MACE3); - if (buf_size % (avctx->channels << is_mace3)) { + if (buf_size % (channels << is_mace3)) { av_log(avctx, AV_LOG_ERROR, "buffer size %d is odd\n", buf_size); - buf_size -= buf_size % (avctx->channels << is_mace3); + buf_size -= buf_size % (channels << is_mace3); if (!buf_size) return AVERROR_INVALIDDATA; } /* get output buffer */ - frame->nb_samples = 3 * (buf_size << (1 - is_mace3)) / avctx->channels; + frame->nb_samples = 3 * (buf_size << (1 - is_mace3)) / channels; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; samples = (int16_t **)frame->extended_data; - for(i = 0; i < avctx->channels; i++) { + for(i = 0; i < channels; i++) { int16_t *output = samples[i]; - for (j=0; j < buf_size / (avctx->channels << is_mace3); j++) + for (j=0; j < buf_size / (channels << is_mace3); j++) for (k=0; k < (1 << is_mace3); k++) { uint8_t pkt = buf[(i << is_mace3) + - (j*avctx->channels << is_mace3) + k]; + (j * channels << is_mace3) + k]; uint8_t val[2][3] = {{pkt >> 5, (pkt >> 3) & 3, pkt & 7 }, {pkt & 7 , (pkt >> 3) & 3, pkt >> 5}}; -- 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".