From patchwork Tue Oct 4 16:12:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 873 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.66 with SMTP id o63csp2241363vsd; Tue, 4 Oct 2016 09:25:09 -0700 (PDT) X-Received: by 10.28.152.2 with SMTP id a2mr13085247wme.66.1475598309222; Tue, 04 Oct 2016 09:25:09 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id jm8si5467643wjb.20.2016.10.04.09.24.45; Tue, 04 Oct 2016 09:25:09 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CF49E68993E; Tue, 4 Oct 2016 19:24:28 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ua0-f194.google.com (mail-ua0-f194.google.com [209.85.217.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6A815687EEC for ; Tue, 4 Oct 2016 19:24:22 +0300 (EEST) Received: by mail-ua0-f194.google.com with SMTP id m26so2394834uaa.2 for ; Tue, 04 Oct 2016 09:24:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=xjlQ+l5g6lW9vgzMBO4SgF361hQTjZ0crO6h70ovaAk=; b=YQp9wp2qQ8rpurktZK/EfFC2/rM3w8mlUDMqKaR9wuCuqqtQY1N4B6LRNnMv/9Dsei GvjxAMxhGx2A2dBlnX6QPbQObAkn5VUb56U3w+7voKiIvCvFYLJfgFLoDGEejHMzFvW4 VN01nrOYlaHlcc4dggadjJyQSaHqHftel61RlsgofNnacPgm3sL7a4gmPoj1Pb2HgcQH XegmU0LQMQEDZf+xCVC+2iVjsSwTLyi8El5bHhXdcFcqh2AF45fwJvgAeTrORqHcl6Ta W2Gk0Fp6A81SdSwTRPsbcBHJqhiKW3xwrd94/m31vltW76HY5Jsf0qG7vlgpkyjE2x3E bbcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=xjlQ+l5g6lW9vgzMBO4SgF361hQTjZ0crO6h70ovaAk=; b=bLrjgPXssjx3Kb4uzzaJwYZMQTNrRRkPTyhoSxflDb0NltfeCzOZzaKMi6+dCrfxP7 qhUqJ3IY8whHXTMBxYYh32m2y6rC0/Glswr8D+fv5gPNY+kCW5ChtpnkRkGbH58ysHG2 voLMDBkY5uws98lgjGuuE2H2b5Y1awSYhAfHRBSy44h9VHTkDpmF/YCZnl62uWyK4jwi 77+XED43aZVp+ADowQR3b1czz72ByVukHD8sgQTScV0ChQwL4/fUIgtgBpIipbSGBn36 dt03OKzi8BhFy7hcI1NKfMIQ/h6hP1F4sp0NGR1NZIVGgojMNlhxDJxIbLZMXoqhEw7P YZPQ== X-Gm-Message-State: AA6/9RlkNkpFJHeaHKVZXjkfdVgRn+g45hA2+2/7Qom/Qx9jImFIamuCKbSUrHKkZ6TVlg== X-Received: by 10.159.34.9 with SMTP id 9mr2745442uad.6.1475597561062; Tue, 04 Oct 2016 09:12:41 -0700 (PDT) Received: from [192.168.1.33] ([181.22.58.118]) by smtp.googlemail.com with ESMTPSA id 1sm885221uaz.19.2016.10.04.09.12.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Oct 2016 09:12:40 -0700 (PDT) To: FFmpeg development discussions and patches References: <1475087343-29745-1-git-send-email-jtoohill@google.com> <1475541908-21260-1-git-send-email-jtoohill@google.com> <1475541908-21260-4-git-send-email-jtoohill@google.com> From: James Almer Message-ID: <3028b667-a8a8-62c3-6658-d0bf9e5d84bc@gmail.com> Date: Tue, 4 Oct 2016 13:12:31 -0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH 3/3] lavf/mp3dec: read encoder delay/padding from Info tag X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" On 10/4/2016 12:52 PM, Hendrik Leppkes wrote: > On Tue, Oct 4, 2016 at 2:45 AM, Jon Toohill > wrote: >> Muxers can check AVCodecParameters.initial_padding for the >> encoder+decoder delay, and read the AV_PKT_DATA_SKIP_SAMPLES >> side data from the last packet for the encoder padding. >> >> This change also fixes the first_discard_sample calculation >> which erroneously included the decoder delay. Decoder delay >> is already accounted for in st->skip_samples. The affected >> FATE tests have been updated accordingly. >> --- >> libavformat/mp3dec.c | 3 ++- >> tests/ref/fate/audiomatch-square-mp3 | 2 +- >> tests/ref/fate/gapless-mp3 | 10 +++++----- >> 3 files changed, 8 insertions(+), 7 deletions(-) >> >> diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c >> index 56c7f8c..e8b2428 100644 >> --- a/libavformat/mp3dec.c >> +++ b/libavformat/mp3dec.c >> @@ -239,9 +239,10 @@ static void mp3_parse_info_tag(AVFormatContext *s, AVStream *st, >> >> mp3->start_pad = v>>12; >> mp3-> end_pad = v&4095; >> + st->codecpar->initial_padding = mp3->start_pad + 528 + 1; >> st->start_skip_samples = mp3->start_pad + 528 + 1; >> if (mp3->frames) { >> - st->first_discard_sample = -mp3->end_pad + 528 + 1 + mp3->frames * (int64_t)spf; >> + st->first_discard_sample = -mp3->end_pad + mp3->frames * (int64_t)spf; >> st->last_discard_sample = mp3->frames * (int64_t)spf; >> } >> if (!st->start_time) >> diff --git a/tests/ref/fate/audiomatch-square-mp3 b/tests/ref/fate/audiomatch-square-mp3 >> index 8de55c2..05176a0 100644 >> --- a/tests/ref/fate/audiomatch-square-mp3 >> +++ b/tests/ref/fate/audiomatch-square-mp3 >> @@ -1 +1 @@ >> -presig: 0 postsig:0 c: 0.9447 lenerr:0 >> +presig: 0 postsig:-529 c: 0.9334 lenerr:-529 >> diff --git a/tests/ref/fate/gapless-mp3 b/tests/ref/fate/gapless-mp3 >> index ebe7bfa..8b80bfc 100644 >> --- a/tests/ref/fate/gapless-mp3 >> +++ b/tests/ref/fate/gapless-mp3 >> @@ -1,5 +1,5 @@ >> -37534a3bcc3ef306e8c5ebfcfedfc41c *tests/data/fate/gapless-mp3.out-1 >> -c96c3ae7bd3300fd2f4debac222de5b7 >> -0cd1cdbcfd5cdbf6270cd98219bf31cd *tests/data/fate/gapless-mp3.out-2 >> -c96c3ae7bd3300fd2f4debac222de5b7 >> -9d3d8ba8a61b534f2d02ee648d6a8229 *tests/data/fate/gapless-mp3.out-3 >> +81695be427d45e8be4d527a6b2af2a85 *tests/data/fate/gapless-mp3.out-1 >> +c7879a827ab017364774069268d9a267 >> +62d074296f8c84a5f86a6afdd7bab459 *tests/data/fate/gapless-mp3.out-2 >> +c7879a827ab017364774069268d9a267 >> +e931f3fe1ba25e0d5eece4977c4061a9 *tests/data/fate/gapless-mp3.out-3 >> -- > > Presumably when these tests were setup, someone verified that their > output was sane and proper, and gapless. > So when these are changed, I have to ask - what exactly changes in > this output? The hashes unfortunately don't tell us that. > > - Hendrik Changing the test to output the framecrc directly instead of doing a md5sum of the output file shows this TEST gapless-mp3 What changed is the side data from one packet at the end for codec copy cases, and what i think is duration in decoded cases. --- /ffmpeg/src/tests/ref/fate/gapless-mp3 2016-10-04 13:08:51.271126400 -0300 +++ tests/data/fate/gapless-mp3 2016-10-04 13:09:26.519070600 -0300 @@ -596,7 +596,7 @@ 0, 217143996, 217143996, 368640, 418, 0xb260c6a6 0, 217512636, 217512636, 368640, 418, 0xe448c368 0, 217881276, 217881276, 368640, 418, 0xb229c63f -0, 218249916, 218249916, 368640, 418, 0x53de9611, S=1, 10, 0x011f0030 +0, 218249916, 218249916, 368640, 418, 0x53de9611, S=1, 10, 0x018f0043 0, 218618556, 218618556, 368640, 418, 0xe12f8514, S=1, 10, 0x03140084 #tb 0: 1/44100 #media_type 0: audio @@ -1196,7 +1196,7 @@ 0, 678575, 678575, 1152, 4608, 0x5fd9abc4 0, 679727, 679727, 1152, 4608, 0xc7ccda46 0, 680879, 680879, 1152, 4608, 0x96c68e2f -0, 682031, 682031, 849, 3396, 0x4fe14cc5 +0, 682031, 682031, 320, 1280, 0xb3535bc6 #tb 0: 1/14112000 #media_type 0: audio #codec_id 0: mp3 @@ -1795,7 +1795,7 @@ 0, 217497600, 217497600, 368640, 418, 0xb260c6a6 0, 217866240, 217866240, 368640, 418, 0xe448c368 0, 218234880, 218234880, 368640, 418, 0xb229c63f -0, 218603520, 218603520, 368640, 418, 0x53de9611, S=1, 10, 0x011f0030 +0, 218603520, 218603520, 368640, 418, 0x53de9611, S=1, 10, 0x018f0043 0, 218972160, 218972160, 368640, 418, 0xe12f8514, S=1, 10, 0x03140084 #tb 0: 1/44100 #media_type 0: audio @@ -2395,7 +2395,7 @@ 0, 679680, 679680, 1152, 4608, 0x5fd9abc4 0, 680832, 680832, 1152, 4608, 0xc7ccda46 0, 681984, 681984, 1152, 4608, 0x96c68e2f -0, 683136, 683136, 849, 3396, 0x4fe14cc5 +0, 683136, 683136, 320, 1280, 0xb3535bc6 #tb 0: 1/14112000 #media_type 0: audio #codec_id 0: mp3 @@ -2803,5 +2803,5 @@ 0, 146937600, 146937600, 368640, 418, 0xb260c6a6 0, 147306240, 147306240, 368640, 418, 0xe448c368 0, 147674880, 147674880, 368640, 418, 0xb229c63f -0, 148043520, 148043520, 368640, 418, 0x53de9611, S=1, 10, 0x011f0030 +0, 148043520, 148043520, 368640, 418, 0x53de9611, S=1, 10, 0x018f0043 0, 148412160, 148412160, 368640, 418, 0xe12f8514, S=1, 10, 0x03140084