From patchwork Fri Jan 29 05:22:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25255 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 0E0C744B9EE for ; Fri, 29 Jan 2021 07:34:33 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E2C4D68A867; Fri, 29 Jan 2021 07:34:32 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6039568A898 for ; Fri, 29 Jan 2021 07:34:26 +0200 (EET) Received: by mail-lj1-f178.google.com with SMTP id e18so9114478lja.12 for ; Thu, 28 Jan 2021 21:34:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iOKZRJ+aDGVNXcfvQkY5ShZEllC0hAr4G6SBoVGIwKk=; b=kFgnYdVlpSHCYnI+VuYFhKksOoWQHbU7kpT9pluI4yFwBYYl3itetfKU0AmlbKm0x6 nCleQ7vi418seniNTH06U2Lu9zPRyeSwR1JZ9C+kreOl+bXFShfxxyW6L0q0tMBABbw/ vFQRk5fwzQ7yjvVLW6jMtdz+na+MYExPa/RhpYn3oVpYndNYorx0mdiT0SM5XAW/rKyq rXoOlfd+kDiLzM1vdtpKzNeZdC6+Pm87dDrX50v/X+L17zh1dCG+wR/w5/h6IhNdyIal rXXQxY2oF2yMkGb39Oor57RhNanMvYpgLX3Fee2p6m1A8qwjH36v4Ci2JCcu2OKXqHVK Qt6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iOKZRJ+aDGVNXcfvQkY5ShZEllC0hAr4G6SBoVGIwKk=; b=GzjPeMFR+7TMN2vDb2atNPfSa5b6S5qVn5zzwJwHcQyb/gCmyEthJpOO6Xtsql48hk UVDCZ8a0sSOCFtp7Sxksf3mhTARlF68wvEmDOZgraELgQ5ujReDlQ7ojnc9/UEy/quGy lSr956hRk/fc0hvOtPffa+/eGpGfnPJq8pDpAv2Rbb9FaXV44KG30535gFwx6iKbHysV 4eCiiPN17BnJVkB8KTlvTR/IAfAG1cTnTPLGx9okYc4aBOR1i/R7SBFQsBXzwOJnHEYe ajNcUxN+gXvQNQ6QiqMSofh5JHKX6eSUxRlBXuXcwXn7972RqUnhjhyZYJFsZyu2yoJE 3z5g== X-Gm-Message-State: AOAM5319ixdkgZlh9dVJtb0C3rEkyTsF/cATTuSmmFwXkmKNH4dG/dG2 w3q5tQKPjsHaV35iT/ORGWelGmmY17U= X-Google-Smtp-Source: ABdhPJynlzIT594PvKE70apNx0yBsoGOU7YHTDqo6itDMe9dlxGCbeAsvKjKL3Rwjp1ayykgcmSCBQ== X-Received: by 2002:a5d:6045:: with SMTP id j5mr2412298wrt.365.1611897982489; Thu, 28 Jan 2021 21:26:22 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id d13sm10068611wrx.93.2021.01.28.21.26.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jan 2021 21:26:22 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 29 Jan 2021 06:22:58 +0100 Message-Id: <20210129052302.3124447-9-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210129052302.3124447-1-andreas.rheinhardt@gmail.com> References: <20210129052302.3124447-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 09/13] avfilter/ebur128: Remove unused functions 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Also make a function only used here static. Signed-off-by: Andreas Rheinhardt --- libavfilter/ebur128.c | 54 +++------------------------------ libavfilter/ebur128.h | 69 +------------------------------------------ 2 files changed, 5 insertions(+), 118 deletions(-) diff --git a/libavfilter/ebur128.c b/libavfilter/ebur128.c index 2e86974eba..d93500ef3e 100644 --- a/libavfilter/ebur128.c +++ b/libavfilter/ebur128.c @@ -362,9 +362,6 @@ static void ebur128_filter_##type(FFEBUR128State* st, const type** srcs, st->d->v[ci][1] = fabs(st->d->v[ci][1]) < DBL_MIN ? 0.0 : st->d->v[ci][1]; \ } \ } -EBUR128_FILTER(short, -((double)SHRT_MIN)) -EBUR128_FILTER(int, -((double)INT_MIN)) -EBUR128_FILTER(float, 1.0) EBUR128_FILTER(double, 1.0) static double ebur128_energy_to_loudness(double energy) @@ -459,8 +456,8 @@ int ff_ebur128_set_channel(FFEBUR128State * st, } static int ebur128_energy_shortterm(FFEBUR128State * st, double *out); -#define FF_EBUR128_ADD_FRAMES_PLANAR(type) \ -void ff_ebur128_add_frames_planar_##type(FFEBUR128State* st, const type** srcs, \ +#define EBUR128_ADD_FRAMES_PLANAR(type) \ +static void ebur128_add_frames_planar_##type(FFEBUR128State* st, const type** srcs, \ size_t frames, int stride) { \ size_t src_index = 0; \ while (frames > 0) { \ @@ -502,10 +499,7 @@ void ff_ebur128_add_frames_planar_##type(FFEBUR128State* st, const type** srcs, } \ } \ } -FF_EBUR128_ADD_FRAMES_PLANAR(short) -FF_EBUR128_ADD_FRAMES_PLANAR(int) -FF_EBUR128_ADD_FRAMES_PLANAR(float) -FF_EBUR128_ADD_FRAMES_PLANAR(double) +EBUR128_ADD_FRAMES_PLANAR(double) #define FF_EBUR128_ADD_FRAMES(type) \ void ff_ebur128_add_frames_##type(FFEBUR128State* st, const type* src, \ size_t frames) { \ @@ -513,11 +507,8 @@ void ff_ebur128_add_frames_##type(FFEBUR128State* st, const type* src, \ const type **buf = (const type**)st->d->data_ptrs; \ for (i = 0; i < st->channels; i++) \ buf[i] = src + i; \ - ff_ebur128_add_frames_planar_##type(st, buf, frames, st->channels); \ + ebur128_add_frames_planar_##type(st, buf, frames, st->channels); \ } -FF_EBUR128_ADD_FRAMES(short) -FF_EBUR128_ADD_FRAMES(int) -FF_EBUR128_ADD_FRAMES(float) FF_EBUR128_ADD_FRAMES(double) static int ebur128_calc_relative_threshold(FFEBUR128State **sts, size_t size, @@ -606,12 +597,6 @@ int ff_ebur128_loudness_global(FFEBUR128State * st, double *out) return ebur128_gated_loudness(&st, 1, out); } -int ff_ebur128_loudness_global_multiple(FFEBUR128State ** sts, size_t size, - double *out) -{ - return ebur128_gated_loudness(sts, size, out); -} - static int ebur128_energy_in_interval(FFEBUR128State * st, size_t interval_frames, double *out) { @@ -628,21 +613,6 @@ static int ebur128_energy_shortterm(FFEBUR128State * st, double *out) out); } -int ff_ebur128_loudness_momentary(FFEBUR128State * st, double *out) -{ - double energy; - int error = ebur128_energy_in_interval(st, st->d->samples_in_100ms * 4, - &energy); - if (error) { - return error; - } else if (energy <= 0.0) { - *out = -HUGE_VAL; - return 0; - } - *out = ebur128_energy_to_loudness(energy); - return 0; -} - int ff_ebur128_loudness_shortterm(FFEBUR128State * st, double *out) { double energy; @@ -657,22 +627,6 @@ int ff_ebur128_loudness_shortterm(FFEBUR128State * st, double *out) return 0; } -int ff_ebur128_loudness_window(FFEBUR128State * st, - unsigned long window, double *out) -{ - double energy; - size_t interval_frames = st->samplerate * window / 1000; - int error = ebur128_energy_in_interval(st, interval_frames, &energy); - if (error) { - return error; - } else if (energy <= 0.0) { - *out = -HUGE_VAL; - return 0; - } - *out = ebur128_energy_to_loudness(energy); - return 0; -} - /* EBU - TECH 3342 */ int ff_ebur128_loudness_range_multiple(FFEBUR128State ** sts, size_t size, double *out) diff --git a/libavfilter/ebur128.h b/libavfilter/ebur128.h index 74367545e8..8e7385e044 100644 --- a/libavfilter/ebur128.h +++ b/libavfilter/ebur128.h @@ -81,7 +81,7 @@ enum channel { * modes that suit your needs, as performance will be better. */ enum mode { - /** can call ff_ebur128_loudness_momentary */ + /** can resurrrect and call ff_ebur128_loudness_momentary */ FF_EBUR128_MODE_M = (1 << 0), /** can call ff_ebur128_loudness_shortterm */ FF_EBUR128_MODE_S = (1 << 1) | FF_EBUR128_MODE_M, @@ -151,41 +151,9 @@ int ff_ebur128_set_channel(FFEBUR128State * st, * @param src array of source frames. Channels must be interleaved. * @param frames number of frames. Not number of samples! */ -void ff_ebur128_add_frames_short(FFEBUR128State * st, - const short *src, size_t frames); -/** \brief See \ref ebur128_add_frames_short */ -void ff_ebur128_add_frames_int(FFEBUR128State * st, - const int *src, size_t frames); -/** \brief See \ref ebur128_add_frames_short */ -void ff_ebur128_add_frames_float(FFEBUR128State * st, - const float *src, size_t frames); -/** \brief See \ref ebur128_add_frames_short */ void ff_ebur128_add_frames_double(FFEBUR128State * st, const double *src, size_t frames); -/** \brief Add frames to be processed. - * - * @param st library state. - * @param srcs array of source frame channel data pointers - * @param frames number of frames. Not number of samples! - * @param stride number of samples to skip to for the next sample of the same channel - */ -void ff_ebur128_add_frames_planar_short(FFEBUR128State * st, - const short **srcs, - size_t frames, int stride); -/** \brief See \ref ebur128_add_frames_planar_short */ -void ff_ebur128_add_frames_planar_int(FFEBUR128State * st, - const int **srcs, - size_t frames, int stride); -/** \brief See \ref ebur128_add_frames_planar_short */ -void ff_ebur128_add_frames_planar_float(FFEBUR128State * st, - const float **srcs, - size_t frames, int stride); -/** \brief See \ref ebur128_add_frames_planar_short */ -void ff_ebur128_add_frames_planar_double(FFEBUR128State * st, - const double **srcs, - size_t frames, int stride); - /** \brief Get global integrated loudness in LUFS. * * @param st library state. @@ -196,28 +164,7 @@ void ff_ebur128_add_frames_planar_double(FFEBUR128State * st, * - AVERROR(EINVAL) if mode "FF_EBUR128_MODE_I" has not been set. */ int ff_ebur128_loudness_global(FFEBUR128State * st, double *out); -/** \brief Get global integrated loudness in LUFS across multiple instances. - * - * @param sts array of library states. - * @param size length of sts - * @param out integrated loudness in LUFS. -HUGE_VAL if result is negative - * infinity. - * @return - * - 0 on success. - * - AVERROR(EINVAL) if mode "FF_EBUR128_MODE_I" has not been set. - */ -int ff_ebur128_loudness_global_multiple(FFEBUR128State ** sts, - size_t size, double *out); -/** \brief Get momentary loudness (last 400ms) in LUFS. - * - * @param st library state. - * @param out momentary loudness in LUFS. -HUGE_VAL if result is negative - * infinity. - * @return - * - 0 on success. - */ -int ff_ebur128_loudness_momentary(FFEBUR128State * st, double *out); /** \brief Get short-term loudness (last 3s) in LUFS. * * @param st library state. @@ -229,20 +176,6 @@ int ff_ebur128_loudness_momentary(FFEBUR128State * st, double *out); */ int ff_ebur128_loudness_shortterm(FFEBUR128State * st, double *out); -/** \brief Get loudness of the specified window in LUFS. - * - * window must not be larger than the current window set in st. - * - * @param st library state. - * @param window window in ms to calculate loudness. - * @param out loudness in LUFS. -HUGE_VAL if result is negative infinity. - * @return - * - 0 on success. - * - AVERROR(EINVAL) if window larger than current window in st. - */ -int ff_ebur128_loudness_window(FFEBUR128State * st, - unsigned long window, double *out); - /** \brief Get loudness range (LRA) of programme in LU. * * Calculates loudness range according to EBU 3342.