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 39C7745259 for ; Wed, 15 Feb 2023 11:59:39 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id ECBE568BE27; Wed, 15 Feb 2023 13:59:36 +0200 (EET) Received: from mail-oo1-f48.google.com (mail-oo1-f48.google.com [209.85.161.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 948E468BA40 for ; Wed, 15 Feb 2023 13:59:30 +0200 (EET) Received: by mail-oo1-f48.google.com with SMTP id y13-20020a4ae7cd000000b0051a750e2ebdso1858170oov.5 for ; Wed, 15 Feb 2023 03:59:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=4z/bzigkcDrnu9heoDazheeUNpyx796s9sb0vwfbnog=; b=E3GqB4Ed8Sp6jAoPZfYMG/GTsj0kCGFg0hZyUKEl6p2BhG/h7mHqBrAqQ+cHSRX2cF k6QCWMW7I6Arb6g6oioqo/rWr3F+JBXOj1qLfYFmqfhGxPUNHR2JZOo2ianY1Geg7cq5 iRbJKYKgZtW/qKMDPOBZTdyonJGRubx0oRZxbobLBfUE/RzCwXVquvgOeu67ieh3EGP+ /TPnxtZE8ocKnBXIJvoEuCiKbUWpM36P2Bb82L1pAv1+wUepNngpuxa1PEQBUFk0Eksa otACYSM7tBEoF0e0NJ2aGyZSALNdqyYS29pillgspzLIC7IOpulhugRCMNRRRk5Dgs/h ZMwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4z/bzigkcDrnu9heoDazheeUNpyx796s9sb0vwfbnog=; b=VdxfsJEOZ7EIfulS1Ne33GCXPqDsqNTRcEEdLjsgNXtwCod/LSfzIOXziUKYMYt5y3 ayEpmMVjg98BpEWslmOMGBoq2icIXRH9vDz/4M+WIZpnQiRJvL6+zYZbbR+xlGEYtM1P xthQT5Ecyt3xig6RE4/Ij3wFrAKYpDRcdc0zkmlcaGCB4FL9TnD8Z5aCGbfLZUPSP/kY HGP4eEJ15OtmfN6zy7ldgzKeeesFOEK49XUJ7VU6vLEmwQgC+P/gc80x2eBsQdCdIjh8 6smJgdDDAfJaRSW0hHEc8cyNDBe+g/FSziJmy3Q7DHktv0Vm0BkqeqXHBWwApk6wqfqL OdKg== X-Gm-Message-State: AO0yUKVab1WIBcCCIpzu4bhXKXHTPkyAcJG8RdRK19wkmJOtnsiV0aGb KmtzpBnyp0YsZuZzIrL9f8sSME7RNc8= X-Google-Smtp-Source: AK7set/TV5Fxd3TJy8C7t0zybk64LGEJzpJ8R2Nq5QdCDVXfy92X0ukhMzr99cEIuCWmBmu9dGPxnQ== X-Received: by 2002:a4a:ac84:0:b0:51a:7af8:457b with SMTP id b4-20020a4aac84000000b0051a7af8457bmr974494oon.1.1676462368175; Wed, 15 Feb 2023 03:59:28 -0800 (PST) Received: from [192.168.0.14] (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id m8-20020a4ad508000000b0051134f333d3sm6850481oos.16.2023.02.15.03.59.27 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Feb 2023 03:59:27 -0800 (PST) Message-ID: Date: Wed, 15 Feb 2023 08:59:43 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.7.2 To: ffmpeg-devel@ffmpeg.org References: Content-Language: en-US From: James Almer In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH] RK Audio demuxer and decoder 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 2/5/2023 4:17 PM, Paul B Mahol wrote: > On 2/4/23, Paul B Mahol wrote: >> Hi, >> >> Patches attached, decoder is not bit by bit exact yet for lossless >> mode because some samples are not properly rounded. >> > > Now lossless mode is bit exact. [...] > +static av_cold int rka_decode_init(AVCodecContext *avctx) > +{ > + RKAContext *s = avctx->priv_data; > + int cmode; > + > + if (avctx->extradata_size < 16) > + return AVERROR_INVALIDDATA; > + > + s->bps = avctx->bits_per_raw_sample = avctx->extradata[13]; > + > + switch (s->bps) { > + case 8: > + avctx->sample_fmt = AV_SAMPLE_FMT_U8P; > + break; > + case 16: > + avctx->sample_fmt = AV_SAMPLE_FMT_S16P; > + break; > + default: > + return AVERROR_INVALIDDATA; > + } > + > + s->channels = avctx->ch_layout.nb_channels; You're ignoring the channels reported by the extradata despite flagging this decoder as AV_CODEC_CAP_CHANNEL_CONF. It should be the other way around, and ignore the user set layout, if any, with av_channel_layout_uninit(&avctx->ch_layout); s->channels = avctx->ch_layout.nb_channels = avctx->extradata[12]; Because the stream may not necessarily come from the lavf demuxer. Extradata presence is required given you check for it above, but the avctx fields could be set to whatever if the source is not the lavf rka demuxer. > + if (s->channels < 1 || s->channels > 2) > + return AVERROR_INVALIDDATA; > + > + s->align = (s->channels * (avctx->bits_per_raw_sample >> 3)); > + s->samples_left = s->total_nb_samples = (AV_RL32(avctx->extradata + 4)) / s->align; > + s->frame_samples = 131072 / s->align; > + s->last_nb_samples = s->total_nb_samples % s->frame_samples; > + > + cmode = avctx->extradata[14] & 0xf; > + if ((avctx->extradata[15] & 4) != 0) > + cmode = -cmode; > + > + s->ch[0].cmode = s->ch[1].cmode = cmode; > + s->ch[0].cmode2 = -s->ch[0].cmode; > + s->ch[1].cmode2 = -s->ch[1].cmode; > + av_log(avctx, AV_LOG_DEBUG, "cmode: %d\n", cmode); > + > + return 0; > +} _______________________________________________ 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".