From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 00/31] Major library soname bump
Date: Sat, 15 Mar 2025 22:50:54 +0100
Message-ID: <AS8P250MB0744A24D36BCFCD66D774F728FDD2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20250223220630.18756-1-jamrial@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 148 bytes --]
James Almer:
> It's been a year since the last bump, so lets get rid of old deprecated API
> in time for ffmpeg 8.0
>
Two more patches.
- Andreas
[-- Attachment #2: 0001-avutil-dict-Unavpriv-avpriv_dict_set_timestamp.patch --]
[-- Type: text/x-patch, Size: 10115 bytes --]
From 1c0532d20ce6f56902c94913dc6d8b5d7a714de9 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 15 Mar 2025 22:10:44 +0100
Subject: [PATCH 1/2] avutil/dict: Unavpriv avpriv_dict_set_timestamp()
And move it to lavf, its only user.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/flvdec.c | 3 +--
libavformat/ifv.c | 3 +--
libavformat/internal.h | 11 +++++++++++
libavformat/matroskadec.c | 3 +--
libavformat/mov.c | 3 +--
libavformat/mux_utils.c | 3 +--
libavformat/mxfdec.c | 3 +--
libavformat/utils.c | 19 +++++++++++++++++++
libavutil/dict.c | 18 ------------------
libavutil/dict_internal.h | 37 -------------------------------------
10 files changed, 36 insertions(+), 67 deletions(-)
delete mode 100644 libavutil/dict_internal.h
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index c51f64a588..b90ed34b1c 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -28,7 +28,6 @@
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/dict.h"
-#include "libavutil/dict_internal.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/internal.h"
@@ -826,7 +825,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream,
) {
// timezone is ignored, since there is no easy way to offset the UTC
// timestamp into the specified timezone
- avpriv_dict_set_timestamp(&s->metadata, key, 1000 * (int64_t)date.milliseconds);
+ ff_dict_set_timestamp(&s->metadata, key, 1000 * (int64_t)date.milliseconds);
}
}
diff --git a/libavformat/ifv.c b/libavformat/ifv.c
index 0cfd2763a9..f0263ed3b4 100644
--- a/libavformat/ifv.c
+++ b/libavformat/ifv.c
@@ -21,7 +21,6 @@
*/
#include "libavutil/channel_layout.h"
-#include "libavutil/dict_internal.h"
#include "avformat.h"
#include "demux.h"
#include "internal.h"
@@ -96,7 +95,7 @@ static int parse_header(AVFormatContext *s)
uint32_t vid_magic;
avio_skip(s->pb, 0x34);
- avpriv_dict_set_timestamp(&s->metadata, "creation_time", avio_rl32(s->pb) * 1000000LL);
+ ff_dict_set_timestamp(&s->metadata, "creation_time", avio_rl32(s->pb) * 1000000LL);
avio_skip(s->pb, 0x24);
ifv->width = avio_rl16(s->pb);
diff --git a/libavformat/internal.h b/libavformat/internal.h
index b909adf209..1cf162c2bd 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -651,4 +651,15 @@ int ff_match_url_ext(const char *url, const char *extensions);
int ff_get_frame_filename(char *buf, int buf_size, const char *path,
int64_t number, int flags);
+/**
+ * Set a dictionary value to an ISO-8601 compliant timestamp string.
+ *
+ * @param dict pointer to a pointer to a dictionary struct. If *dict is NULL
+ * a dictionary struct is allocated and put in *dict.
+ * @param key metadata key
+ * @param timestamp unix timestamp in microseconds
+ * @return <0 on error
+ */
+int ff_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp);
+
#endif /* AVFORMAT_INTERNAL_H */
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index efa3e44c85..d4b7ae112c 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -38,7 +38,6 @@
#include "libavutil/base64.h"
#include "libavutil/bprint.h"
#include "libavutil/dict.h"
-#include "libavutil/dict_internal.h"
#include "libavutil/display.h"
#include "libavutil/hdr_dynamic_metadata.h"
#include "libavutil/intfloat.h"
@@ -2137,7 +2136,7 @@ static int matroska_aac_sri(int samplerate)
static void matroska_metadata_creation_time(AVDictionary **metadata, int64_t date_utc)
{
/* Convert to seconds and adjust by number of seconds between 2001-01-01 and Epoch */
- avpriv_dict_set_timestamp(metadata, "creation_time", date_utc / 1000 + 978307200000000LL);
+ ff_dict_set_timestamp(metadata, "creation_time", date_utc / 1000 + 978307200000000LL);
}
static int matroska_parse_flac(AVFormatContext *s,
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 57d9364ea2..cb96521e81 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -32,7 +32,6 @@
#include "libavutil/attributes.h"
#include "libavutil/bprint.h"
#include "libavutil/channel_layout.h"
-#include "libavutil/dict_internal.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/intfloat.h"
@@ -1858,7 +1857,7 @@ static void mov_metadata_creation_time(MOVContext *c, AVIOContext *pb, AVDiction
return;
}
- avpriv_dict_set_timestamp(metadata, "creation_time", time * 1000000);
+ ff_dict_set_timestamp(metadata, "creation_time", time * 1000000);
}
}
diff --git a/libavformat/mux_utils.c b/libavformat/mux_utils.c
index ed1242a6a2..86d333dbe7 100644
--- a/libavformat/mux_utils.c
+++ b/libavformat/mux_utils.c
@@ -20,7 +20,6 @@
*/
#include "libavutil/dict.h"
-#include "libavutil/dict_internal.h"
#include "libavutil/internal.h"
#include "libavutil/log.h"
#include "libavutil/mem.h"
@@ -157,6 +156,6 @@ int ff_standardize_creation_time(AVFormatContext *s)
int64_t timestamp;
int ret = ff_parse_creation_time_metadata(s, ×tamp, 0);
if (ret == 1)
- return avpriv_dict_set_timestamp(&s->metadata, "creation_time", timestamp);
+ return ff_dict_set_timestamp(&s->metadata, "creation_time", timestamp);
return ret;
}
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 3b87063c3f..1978b2cec5 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -56,7 +56,6 @@
#include "libavcodec/defs.h"
#include "libavcodec/internal.h"
#include "libavutil/channel_layout.h"
-#include "libavutil/dict_internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/parseutils.h"
#include "libavutil/timecode.h"
@@ -3207,7 +3206,7 @@ static int64_t mxf_timestamp_to_int64(uint64_t timestamp)
#define SET_TS_METADATA(pb, name, var, str) do { \
var = avio_rb64(pb); \
- if (var && (ret = avpriv_dict_set_timestamp(&s->metadata, name, mxf_timestamp_to_int64(var))) < 0) \
+ if (var && (ret = ff_dict_set_timestamp(&s->metadata, name, mxf_timestamp_to_int64(var))) < 0) \
return ret; \
} while (0)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index e892e8bde7..eee7b9e0e3 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -20,14 +20,17 @@
*/
#include <stdint.h>
+#include <time.h>
#include "config.h"
#include "libavutil/avstring.h"
#include "libavutil/bprint.h"
+#include "libavutil/dict.h"
#include "libavutil/internal.h"
#include "libavutil/mem.h"
#include "libavutil/time.h"
+#include "libavutil/time_internal.h"
#include "libavcodec/internal.h"
@@ -596,3 +599,19 @@ int ff_bprint_to_codecpar_extradata(AVCodecParameters *par, struct AVBPrint *buf
par->extradata_size = buf->len;
return 0;
}
+
+int ff_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp)
+{
+ time_t seconds = timestamp / 1000000;
+ struct tm *ptm, tmbuf;
+ ptm = gmtime_r(&seconds, &tmbuf);
+ if (ptm) {
+ char buf[32];
+ if (!strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S", ptm))
+ return AVERROR_EXTERNAL;
+ av_strlcatf(buf, sizeof(buf), ".%06dZ", (int)(timestamp % 1000000));
+ return av_dict_set(dict, key, buf, 0);
+ } else {
+ return AVERROR_EXTERNAL;
+ }
+}
diff --git a/libavutil/dict.c b/libavutil/dict.c
index 6fb09399ba..a5fa2d3bfa 100644
--- a/libavutil/dict.c
+++ b/libavutil/dict.c
@@ -25,10 +25,8 @@
#include "avassert.h"
#include "avstring.h"
#include "dict.h"
-#include "dict_internal.h"
#include "error.h"
#include "mem.h"
-#include "time_internal.h"
#include "bprint.h"
struct AVDictionary {
@@ -274,19 +272,3 @@ int av_dict_get_string(const AVDictionary *m, char **buffer,
}
return av_bprint_finalize(&bprint, buffer);
}
-
-int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp)
-{
- time_t seconds = timestamp / 1000000;
- struct tm *ptm, tmbuf;
- ptm = gmtime_r(&seconds, &tmbuf);
- if (ptm) {
- char buf[32];
- if (!strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S", ptm))
- return AVERROR_EXTERNAL;
- av_strlcatf(buf, sizeof(buf), ".%06dZ", (int)(timestamp % 1000000));
- return av_dict_set(dict, key, buf, 0);
- } else {
- return AVERROR_EXTERNAL;
- }
-}
diff --git a/libavutil/dict_internal.h b/libavutil/dict_internal.h
deleted file mode 100644
index 6d5b0dc2b0..0000000000
--- a/libavutil/dict_internal.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_DICT_INTERNAL_H
-#define AVUTIL_DICT_INTERNAL_H
-
-#include <stdint.h>
-
-#include "dict.h"
-
-/**
- * Set a dictionary value to an ISO-8601 compliant timestamp string.
- *
- * @param dict pointer to a pointer to a dictionary struct. If *dict is NULL
- * a dictionary struct is allocated and put in *dict.
- * @param key metadata key
- * @param timestamp unix timestamp in microseconds
- * @return <0 on error
- */
-int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp);
-
-#endif /* AVUTIL_DICT_INTERNAL_H */
--
2.45.2
[-- Attachment #3: 0002-avutil-float_dsp-Unavpriv-avpriv_scalarproduct_float.patch --]
[-- Type: text/x-patch, Size: 15438 bytes --]
From 09ebb5dbefcfa588f4021269438674fab631a60b Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sat, 15 Mar 2025 22:26:26 +0100
Subject: [PATCH 2/2] avutil/float_dsp: Unavpriv avpriv_scalarproduct_float_c()
Not worth the overhead of exporting it.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/Makefile | 3 ++-
libavcodec/acelp_pitch_delay.c | 2 +-
libavcodec/acelp_vectors.c | 4 ++--
libavcodec/float_scalarproduct.c | 19 ++++++++++++++++++
libavcodec/qcelpdec.c | 8 ++++----
libavcodec/ra288.c | 4 ++--
libavcodec/sipr.c | 12 ++++++------
libavcodec/sipr16k.c | 6 +++---
libavcodec/wmavoice.c | 16 ++++++++--------
libavutil/Makefile | 1 +
libavutil/float_dsp.c | 13 +------------
libavutil/float_dsp.h | 2 +-
libavutil/float_scalarproduct.c | 33 ++++++++++++++++++++++++++++++++
13 files changed, 83 insertions(+), 40 deletions(-)
create mode 100644 libavcodec/float_scalarproduct.c
create mode 100644 libavutil/float_scalarproduct.c
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 3c7043a617..3c2c614f1a 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -64,7 +64,8 @@ OBJS = ac3_parser.o \
vorbis_parser.o \
xiph.o \
-SHLIBOBJS = timecode_internal.o \
+SHLIBOBJS = float_scalarproduct.o \
+ timecode_internal.o \
# subsystems
include $(SRC_PATH)/libavcodec/aac/Makefile
diff --git a/libavcodec/acelp_pitch_delay.c b/libavcodec/acelp_pitch_delay.c
index 6cf880e4ac..65f659cb2e 100644
--- a/libavcodec/acelp_pitch_delay.c
+++ b/libavcodec/acelp_pitch_delay.c
@@ -90,7 +90,7 @@ float ff_amr_set_fixed_gain(float fixed_gain_factor, float fixed_mean_energy,
// Note 10^(0.05 * -10log(average x2)) = 1/sqrt((average x2)).
float val = fixed_gain_factor *
ff_exp10(0.05 *
- (avpriv_scalarproduct_float_c(pred_table, prediction_error, 4) +
+ (ff_scalarproduct_float_c(pred_table, prediction_error, 4) +
energy_mean)) /
sqrtf(fixed_mean_energy ? fixed_mean_energy : 1.0);
diff --git a/libavcodec/acelp_vectors.c b/libavcodec/acelp_vectors.c
index 04cbffd79f..f47da40008 100644
--- a/libavcodec/acelp_vectors.c
+++ b/libavcodec/acelp_vectors.c
@@ -193,7 +193,7 @@ void ff_adaptive_gain_control(float *out, const float *in, float speech_energ,
int size, float alpha, float *gain_mem)
{
int i;
- float postfilter_energ = avpriv_scalarproduct_float_c(in, in, size);
+ float postfilter_energ = ff_scalarproduct_float_c(in, in, size);
float gain_scale_factor = 1.0;
float mem = *gain_mem;
@@ -214,7 +214,7 @@ void ff_scale_vector_to_given_sum_of_squares(float *out, const float *in,
float sum_of_squares, const int n)
{
int i;
- float scalefactor = avpriv_scalarproduct_float_c(in, in, n);
+ float scalefactor = ff_scalarproduct_float_c(in, in, n);
if (scalefactor)
scalefactor = sqrt(sum_of_squares / scalefactor);
for (i = 0; i < n; i++)
diff --git a/libavcodec/float_scalarproduct.c b/libavcodec/float_scalarproduct.c
new file mode 100644
index 0000000000..647f0ec72d
--- /dev/null
+++ b/libavcodec/float_scalarproduct.c
@@ -0,0 +1,19 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/float_scalarproduct.c"
diff --git a/libavcodec/qcelpdec.c b/libavcodec/qcelpdec.c
index 1435fecc2e..7d23a11102 100644
--- a/libavcodec/qcelpdec.c
+++ b/libavcodec/qcelpdec.c
@@ -397,7 +397,7 @@ static void apply_gain_ctrl(float *v_out, const float *v_ref, const float *v_in)
int i;
for (i = 0; i < 160; i += 40) {
- float res = avpriv_scalarproduct_float_c(v_ref + i, v_ref + i, 40);
+ float res = ff_scalarproduct_float_c(v_ref + i, v_ref + i, 40);
ff_scale_vector_to_given_sum_of_squares(v_out + i, v_in + i, res, 40);
}
}
@@ -676,9 +676,9 @@ static void postfilter(QCELPContext *q, float *samples, float *lpc)
ff_tilt_compensation(&q->postfilter_tilt_mem, 0.3, pole_out + 10, 160);
ff_adaptive_gain_control(samples, pole_out + 10,
- avpriv_scalarproduct_float_c(q->formant_mem + 10,
- q->formant_mem + 10,
- 160),
+ ff_scalarproduct_float_c(q->formant_mem + 10,
+ q->formant_mem + 10,
+ 160),
160, 0.9375, &q->postfilter_agc_mem);
}
diff --git a/libavcodec/ra288.c b/libavcodec/ra288.c
index 5b186a7a3d..aa499506b7 100644
--- a/libavcodec/ra288.c
+++ b/libavcodec/ra288.c
@@ -90,7 +90,7 @@ static av_cold int ra288_decode_init(AVCodecContext *avctx)
static void convolve(float *tgt, const float *src, int len, int n)
{
for (; n >= 0; n--)
- tgt[n] = avpriv_scalarproduct_float_c(src, src - n, len);
+ tgt[n] = ff_scalarproduct_float_c(src, src - n, len);
}
@@ -119,7 +119,7 @@ static void decode(RA288Context *ractx, float gain, int cb_coef)
for (i=0; i < 5; i++)
buffer[i] = codetable[cb_coef][i] * sumsum;
- sum = avpriv_scalarproduct_float_c(buffer, buffer, 5);
+ sum = ff_scalarproduct_float_c(buffer, buffer, 5);
sum = FFMAX(sum, 5.0 / (1<<24));
diff --git a/libavcodec/sipr.c b/libavcodec/sipr.c
index 3ddc579f09..ebd7dab03c 100644
--- a/libavcodec/sipr.c
+++ b/libavcodec/sipr.c
@@ -412,9 +412,9 @@ static void decode_frame(SiprContext *ctx, SiprParameters *params,
convolute_with_sparse(fixed_vector, &fixed_cb, impulse_response,
SUBFR_SIZE);
- avg_energy = (0.01 + avpriv_scalarproduct_float_c(fixed_vector,
- fixed_vector,
- SUBFR_SIZE)) /
+ avg_energy = (0.01 + ff_scalarproduct_float_c(fixed_vector,
+ fixed_vector,
+ SUBFR_SIZE)) /
SUBFR_SIZE;
ctx->past_pitch_gain = pitch_gain = gain_cb[params->gc_index[i]][0];
@@ -456,9 +456,9 @@ static void decode_frame(SiprContext *ctx, SiprParameters *params,
if (ctx->mode == MODE_5k0) {
for (i = 0; i < subframe_count; i++) {
- float energy = avpriv_scalarproduct_float_c(ctx->postfilter_syn5k0 + LP_FILTER_ORDER + i * SUBFR_SIZE,
- ctx->postfilter_syn5k0 + LP_FILTER_ORDER + i * SUBFR_SIZE,
- SUBFR_SIZE);
+ float energy = ff_scalarproduct_float_c(ctx->postfilter_syn5k0 + LP_FILTER_ORDER + i * SUBFR_SIZE,
+ ctx->postfilter_syn5k0 + LP_FILTER_ORDER + i * SUBFR_SIZE,
+ SUBFR_SIZE);
ff_adaptive_gain_control(&synth[i * SUBFR_SIZE],
&synth[i * SUBFR_SIZE], energy,
SUBFR_SIZE, 0.9, &ctx->postfilter_agc);
diff --git a/libavcodec/sipr16k.c b/libavcodec/sipr16k.c
index 9c8f684003..ab892d0547 100644
--- a/libavcodec/sipr16k.c
+++ b/libavcodec/sipr16k.c
@@ -163,11 +163,11 @@ static float acelp_decode_gain_codef(float gain_corr_factor, const float *fc_v,
const float *ma_prediction_coeff,
int subframe_size, int ma_pred_order)
{
- mr_energy += avpriv_scalarproduct_float_c(quant_energy, ma_prediction_coeff,
- ma_pred_order);
+ mr_energy += ff_scalarproduct_float_c(quant_energy, ma_prediction_coeff,
+ ma_pred_order);
mr_energy = gain_corr_factor * exp(M_LN10 / 20. * mr_energy) /
- sqrt((0.01 + avpriv_scalarproduct_float_c(fc_v, fc_v, subframe_size)));
+ sqrt((0.01 + ff_scalarproduct_float_c(fc_v, fc_v, subframe_size)));
return mr_energy;
}
diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index a1f89aeb76..e89a5c2bfb 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -559,7 +559,7 @@ static int kalman_smoothen(WMAVoiceContext *s, int pitch,
/* find best fitting point in history */
do {
- dot = avpriv_scalarproduct_float_c(in, ptr, size);
+ dot = ff_scalarproduct_float_c(in, ptr, size);
if (dot > optimal_gain) {
optimal_gain = dot;
best_hist_ptr = ptr;
@@ -568,7 +568,7 @@ static int kalman_smoothen(WMAVoiceContext *s, int pitch,
if (optimal_gain <= 0)
return -1;
- dot = avpriv_scalarproduct_float_c(best_hist_ptr, best_hist_ptr, size);
+ dot = ff_scalarproduct_float_c(best_hist_ptr, best_hist_ptr, size);
if (dot <= 0) // would be 1.0
return -1;
@@ -598,8 +598,8 @@ static float tilt_factor(const float *lpcs, int n_lpcs)
{
float rh0, rh1;
- rh0 = 1.0 + avpriv_scalarproduct_float_c(lpcs, lpcs, n_lpcs);
- rh1 = lpcs[0] + avpriv_scalarproduct_float_c(lpcs, &lpcs[1], n_lpcs - 1);
+ rh0 = 1.0 + ff_scalarproduct_float_c(lpcs, lpcs, n_lpcs);
+ rh1 = lpcs[0] + ff_scalarproduct_float_c(lpcs, &lpcs[1], n_lpcs - 1);
return rh1 / rh0;
}
@@ -699,8 +699,8 @@ static void calc_input_response(WMAVoiceContext *s, float *lpcs_src,
-1.8 * tilt_factor(coeffs_dst, remainder - 1),
coeffs_dst, remainder);
}
- sq = (1.0 / 64.0) * sqrtf(1 / avpriv_scalarproduct_float_c(coeffs_dst, coeffs_dst,
- remainder));
+ sq = (1.0 / 64.0) * sqrtf(1 / ff_scalarproduct_float_c(coeffs_dst, coeffs_dst,
+ remainder));
for (n = 0; n < remainder; n++)
coeffs_dst[n] *= sq;
}
@@ -1378,8 +1378,8 @@ static void synth_block_fcb_acb(WMAVoiceContext *s, GetBitContext *gb,
/* Calculate gain for adaptive & fixed codebook signal.
* see ff_amr_set_fixed_gain(). */
idx = get_bits(gb, 7);
- fcb_gain = expf(avpriv_scalarproduct_float_c(s->gain_pred_err,
- gain_coeff, 6) -
+ fcb_gain = expf(ff_scalarproduct_float_c(s->gain_pred_err,
+ gain_coeff, 6) -
5.2409161640 + wmavoice_gain_codebook_fcb[idx]);
acb_gain = wmavoice_gain_codebook_acb[idx];
pred_err = av_clipf(wmavoice_gain_codebook_fcb[idx],
diff --git a/libavutil/Makefile b/libavutil/Makefile
index b7ed339ab3..a5a92ea5f7 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -139,6 +139,7 @@ OBJS = adler32.o \
file.o \
file_open.o \
float_dsp.o \
+ float_scalarproduct.o \
film_grain_params.o \
fixed_dsp.o \
frame.o \
diff --git a/libavutil/float_dsp.c b/libavutil/float_dsp.c
index 08bbc85e3e..f38ad565cf 100644
--- a/libavutil/float_dsp.c
+++ b/libavutil/float_dsp.c
@@ -121,17 +121,6 @@ static void butterflies_float_c(float *restrict v1, float *restrict v2,
}
}
-float avpriv_scalarproduct_float_c(const float *v1, const float *v2, int len)
-{
- float p = 0.0;
- int i;
-
- for (i = 0; i < len; i++)
- p += v1[i] * v2[i];
-
- return p;
-}
-
double ff_scalarproduct_double_c(const double *v1, const double *v2,
size_t len)
{
@@ -159,7 +148,7 @@ av_cold AVFloatDSPContext *avpriv_float_dsp_alloc(int bit_exact)
fdsp->vector_fmul_add = vector_fmul_add_c;
fdsp->vector_fmul_reverse = vector_fmul_reverse_c;
fdsp->butterflies_float = butterflies_float_c;
- fdsp->scalarproduct_float = avpriv_scalarproduct_float_c;
+ fdsp->scalarproduct_float = ff_scalarproduct_float_c;
fdsp->scalarproduct_double = ff_scalarproduct_double_c;
#if ARCH_AARCH64
diff --git a/libavutil/float_dsp.h b/libavutil/float_dsp.h
index a99edc39bb..ab34277c20 100644
--- a/libavutil/float_dsp.h
+++ b/libavutil/float_dsp.h
@@ -215,7 +215,7 @@ typedef struct AVFloatDSPContext {
*
* @return sum of elementwise products
*/
-float avpriv_scalarproduct_float_c(const float *v1, const float *v2, int len);
+float ff_scalarproduct_float_c(const float *v1, const float *v2, int len);
/**
* Return the scalar product of two vectors of doubles.
diff --git a/libavutil/float_scalarproduct.c b/libavutil/float_scalarproduct.c
new file mode 100644
index 0000000000..c7b3b72852
--- /dev/null
+++ b/libavutil/float_scalarproduct.c
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2005 Balatoni Denes
+ * Copyright 2006 Loren Merritt
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "float_dsp.h"
+
+float ff_scalarproduct_float_c(const float *v1, const float *v2, int len)
+{
+ float p = 0.0;
+
+ for (int i = 0; i < len; i++)
+ p += v1[i] * v2[i];
+
+ return p;
+}
+
--
2.45.2
[-- Attachment #4: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
next prev parent reply other threads:[~2025-03-15 21:51 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-23 22:06 James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 01/30] avcodec: remove deprecated FF_API_SUBFRAMES James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 02/30] avcodec: remove deprecated FF_API_TICKS_PER_FRAME James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 03/30] avcodec: remove deprecated FF_API_DROPCHANGED James Almer
2025-02-24 9:44 ` Gyan Doshi
2025-03-15 13:51 ` Gyan Doshi
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 04/30] avcodec: remove deprecated FF_API_AVFFT James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 05/30] avcodec: remove deprecated FF_API_FF_PROFILE_LEVEL James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 06/30] avcodec: remove deprecated FF_API_AVCODEC_CLOSE James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 07/30] avcodec: remove deprecated FF_API_BUFFER_MIN_SIZE James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 08/30] avcodec: remove deprecated FF_API_VDPAU_ALLOC_GET_SET James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 09/30] avcodec: remove deprecated FF_API_QUALITY_FACTOR James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 10/30] avcodec/version_major: postpone some deprecations until the next bump James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 11/30] avdevice: remove deprecated FF_API_BKTR_DEVICE James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 12/30] avdevice: remove deprecated FF_API_OPENGL_DEVICE James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 13/30] avdevice: remove deprecated FF_API_SDL2_DEVICE James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 14/30] avdevice/version_major: postpone some deprecations until the next bump James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 15/30] avformat: remove deprecated FF_API_LAVF_SHORTEST James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 16/30] avformat: remove deprecated FF_API_ALLOW_FLUSH James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 17/30] avformat: remove deprecated FF_API_AVSTREAM_SIDE_DATA James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 18/30] avformat: remove deprecated FF_API_GET_DUR_ESTIMATE_METHOD James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 19/30] avformat/version_major: postpone some deprecations until the next bump James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 20/30] avfilter: remove deprecated FF_API_LINK_PUBLIC James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 21/30] avfilter/version_major: postpone some deprecations until the next bump James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 22/30] avutil: remove deprecated FF_API_HDR_VIVID_THREE_SPLINE James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 23/30] avutil: remove deprecated FF_API_FRAME_PKT James Almer
2025-03-01 17:29 ` Marton Balint
2025-03-02 0:48 ` James Almer
2025-03-02 18:27 ` Marton Balint
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 24/30] avutil: remove deprecated FF_API_INTERLACED_FRAME James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 25/30] avutil: remove deprecated FF_API_FRAME_KEY James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 26/30] avutil: remove deprecated FF_API_PALETTE_HAS_CHANGED James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 27/30] avutil: remove deprecated FF_API_VULKAN_CONTIGUOUS_MEMORY James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 28/30] avutil: remove deprecated FF_API_H274_FILM_GRAIN_VCS James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 29/30] avutil/version_major: postpone some deprecations until the next bump James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 30/30] libs: bump major version for all libraries James Almer
2025-03-26 23:41 ` Wang Bin
2025-02-25 12:29 ` [FFmpeg-devel] [PATCH] avutil/frame: Port AVFrame.private_ref to RefStruct API Andreas Rheinhardt
2025-02-25 14:31 ` James Almer
2025-03-15 21:50 ` Andreas Rheinhardt [this message]
2025-03-26 22:50 ` [FFmpeg-devel] [PATCH 00/31] Major library soname bump James Almer
2025-03-26 23:01 ` Sean McGovern
2025-03-26 23:28 ` James Almer
2025-03-28 5:07 ` Andreas Rheinhardt
2025-03-28 12:11 ` James Almer
2025-03-28 16:58 ` Andreas Rheinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AS8P250MB0744A24D36BCFCD66D774F728FDD2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
--to=andreas.rheinhardt@outlook.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git