From patchwork Mon Mar 7 22:15:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Anthony Lemieux X-Patchwork-Id: 34636 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6838:d078:0:0:0:0 with SMTP id x24csp1905780nkx; Mon, 7 Mar 2022 14:17:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJzSQcnYHWHumXwGb2engMrrcZEEty/ySv7JPxAE/q8xKntdMDtMlDbDiZFKwGfkl6eQB9hS X-Received: by 2002:a05:6402:b87:b0:416:44f5:10d1 with SMTP id cf7-20020a0564020b8700b0041644f510d1mr7295633edb.323.1646691431052; Mon, 07 Mar 2022 14:17:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646691431; cv=none; d=google.com; s=arc-20160816; b=GxgMpL3AmbFa1sgGPUOdyGIWh56ISif9YNefEk2NtaaszorqZR/D0Y2QyfMT2YvTFz AgJqvera8koCQNOWqjUJhYt87ugDNH2d83BzOR+gMQaEB1ubb8pVns5qXXVX74ba3AZC J/7xebUSQRHY/vRpdR1ZopXNPrYuExmIB0fOMVlA+9Lz+W7/ppoNbXqnsWCuOG4NaFnG W3Ka7Rk1f+cjjkxb3Lklif032jfPVnab0Xe+sLmck5mfGQe8gd8TKx2/7vP9CSMyqE7u 569nKD18SNoI8vbPdGlH+0FIGRUXvxai0Qj+n5GraqCimHel8KsY6JvmVm2AzGWqVF9O ow2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:delivered-to; bh=XCUXXmyfBKf1z3nuvGVMphv+mYfOS3qPcNmA7mykuN4=; b=A0pPikS+FN6ZS/oyPAigrW9uUt9PJSsY0jGTQNC21y8xO79Dyeve3VqwnTVraZWnmo WcUnAGIpofI9V19NqanqyLecWOTauEIHnw+yik3U1jq8xjd7TGogVKmO6U9odORmLKKo oHqEJKssftntQCaQrVz0ldA/e7y0lMYvCzHivF8F/xDc5Dz2/rwj2lTl6xl5agZnq+8/ hSaiUeeIF8n2CZWe+cI9BWEK0kUhQwkCIIVPEG84KP8u3rEr/vx6LeBVUib1dRl8QbOs txBc02T+dG9SxYwOupzctXlwrvfIN5r97tqKTUrkfoicB4toa3TBiNqCrBWsZpGepgEE lVZg== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ga11-20020a1709070c0b00b006daaccc9629si7732150ejc.517.2022.03.07.14.17.10; Mon, 07 Mar 2022 14:17:11 -0800 (PST) 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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 49F4668B1B5; Tue, 8 Mar 2022 00:16:30 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A297F68B1B0 for ; Tue, 8 Mar 2022 00:16:23 +0200 (EET) Received: by mail-pf1-f169.google.com with SMTP id d187so15626937pfa.10 for ; Mon, 07 Mar 2022 14:16:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rPGMObBRuj26RPvSu+2dG8DtZLw1ENbsXIR+DY1VKWM=; b=FYBUqW8ZvY4DIwn/OY3XOQgZ6f+Ic6oHWgEkt31Cw9+0jrM1X5QWXdYpPAFWlZElGm try8ObSqo4JwtFEULSXCeNPGibSne0T2FCgUAG+cbpC/nTgeM5gJH+UVe++8vPD5IOoQ a5O8jr51suzQUd1nKRSYklORXKqDi9eeiubUWoPgFGIBH56xwnS92DBdoKquqLRNj76V hOA8jdU41qcSb3uFIBJWv3cL5w5XnsN1SWetC5oZhc2v/TBn7mPqIrmiJD7cs40kfkcM TgQoSrGEh9RfI7cG/RObcKOx1GuCMFXFwtbY2YZcMZEASjTbjez6MshWozK63DNK8V75 HkcQ== X-Gm-Message-State: AOAM532XNBOa/h+tlaXSe3/Xu51b6D8o0Mn3LP8Oz8EGVy9+g7w4uHTM lxVA/25z1fLHbEN7JPuNW4QgNApujAg= X-Received: by 2002:a63:7d49:0:b0:378:907d:1fc7 with SMTP id m9-20020a637d49000000b00378907d1fc7mr11543737pgn.252.1646691381573; Mon, 07 Mar 2022 14:16:21 -0800 (PST) Received: from localhost (76-14-89-2.sf-cable.astound.net. [76.14.89.2]) by smtp.gmail.com with ESMTPSA id x23-20020a63fe57000000b0036490068f12sm12687814pgj.90.2022.03.07.14.16.20 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Mar 2022 14:16:21 -0800 (PST) Received: by localhost (sSMTP sendmail emulation); Mon, 07 Mar 2022 14:15:57 -0800 From: pal@sandflow.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 7 Mar 2022 14:15:41 -0800 Message-Id: <20220307221542.3265-6-pal@sandflow.com> X-Mailer: git-send-email 2.35.1.windows.2 In-Reply-To: <20220307221542.3265-1-pal@sandflow.com> References: <20220307221542.3265-1-pal@sandflow.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 6/7] avformat/imf: refactor to use ff_rescale_interval() 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 Cc: Pierre-Anthony Lemieux Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: NM86q564cVEP From: Pierre-Anthony Lemieux --- libavformat/imfdec.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c index ac212b05e1..a19e431df3 100644 --- a/libavformat/imfdec.c +++ b/libavformat/imfdec.c @@ -904,14 +904,6 @@ static int imf_probe(const AVProbeData *p) return AVPROBE_SCORE_MAX; } -static void rescale_interval(AVRational tb_in, AVRational tb_out, - int64_t *min_ts, int64_t *ts, int64_t *max_ts) -{ - *ts = av_rescale_q(*ts, tb_in, tb_out); - *min_ts = av_rescale_q_rnd(*min_ts, tb_in, tb_out, AV_ROUND_UP | AV_ROUND_PASS_MINMAX); - *max_ts = av_rescale_q_rnd(*max_ts, tb_in, tb_out, AV_ROUND_DOWN | AV_ROUND_PASS_MINMAX); -} - static int coherent_ts(int64_t ts, AVRational in_tb, AVRational out_tb) { int dst_num; @@ -937,13 +929,13 @@ static int imf_seek(AVFormatContext *s, int stream_index, int64_t min_ts, /* rescale timestamps to Composition edit units */ if (stream_index < 0) - rescale_interval(AV_TIME_BASE_Q, - av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num), - &min_ts, &ts, &max_ts); + ff_rescale_interval(AV_TIME_BASE_Q, + av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num), + &min_ts, &ts, &max_ts); else - rescale_interval(s->streams[stream_index]->time_base, - av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num), - &min_ts, &ts, &max_ts); + ff_rescale_interval(s->streams[stream_index]->time_base, + av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num), + &min_ts, &ts, &max_ts); /* requested timestamp bounds are too close */ if (max_ts < min_ts)