ffmpeg-cvslog
Threads by month
- ----- 2026 -----
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
May 2022
- 2 participants
- 350 discussions
30 May '22
ffmpeg | branch: master | Michael Niedermayer <michael(a)niedermayer.cc> | Fri May 27 19:31:33 2022 +0200| [366ef56f7f126398c813407c45f91216978224ba] | committer: Michael Niedermayer
avcodec/ffv1enc: Eliminate float/double from find_best_state()
log2() remains, this can either be replaced by a integer implementation or the table
hardcoded if needed
Tested-by: Anton Khirnov <anton(a)khirnov.net>
Tested-by: Martin Storsjö <martin(a)martin.st>
Signed-off-by: Michael Niedermayer <michael(a)niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=366ef56f7f126398c…
---
libavcodec/ffv1enc.c | 25 ++++++++++++-------------
tests/ref/vsynth/vsynth1-ffv1-2pass | 4 ++--
tests/ref/vsynth/vsynth2-ffv1-2pass | 4 ++--
tests/ref/vsynth/vsynth3-ffv1-2pass | 4 ++--
tests/ref/vsynth/vsynth_lena-ffv1-2pass | 4 ++--
5 files changed, 20 insertions(+), 21 deletions(-)
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index cee2627eed..311f377b1e 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -140,32 +140,31 @@ static void find_best_state(uint8_t best_state[256][256],
const uint8_t one_state[256])
{
int i, j, k, m;
- double l2tab[256];
+ uint32_t l2tab[256];
for (i = 1; i < 256; i++)
- l2tab[i] = log2(i / 256.0);
+ l2tab[i] = log2(i / 256.0) * ((-1<<31) / 8);
for (i = 0; i < 256; i++) {
- double best_len[256];
- double p = i / 256.0;
+ uint64_t best_len[256];
for (j = 0; j < 256; j++)
- best_len[j] = 1 << 30;
+ best_len[j] = UINT64_MAX;
for (j = FFMAX(i - 10, 1); j < FFMIN(i + 11, 256); j++) {
- double occ[256] = { 0 };
- double len = 0;
- occ[j] = 1.0;
+ uint32_t occ[256] = { 0 };
+ uint64_t len = 0;
+ occ[j] = UINT32_MAX;
if (!one_state[j])
continue;
for (k = 0; k < 256; k++) {
- double newocc[256] = { 0 };
+ uint32_t newocc[256] = { 0 };
for (m = 1; m < 256; m++)
if (occ[m]) {
- len -=occ[m]*( p *l2tab[ m]
- + (1-p)*l2tab[256-m]);
+ len += (occ[m]*(( i *(uint64_t)l2tab[ m]
+ + (256-i)*(uint64_t)l2tab[256-m])>>8)) >> 8;
}
if (len < best_len[k]) {
best_len[k] = len;
@@ -173,8 +172,8 @@ static void find_best_state(uint8_t best_state[256][256],
}
for (m = 1; m < 256; m++)
if (occ[m]) {
- newocc[ one_state[ m]] += occ[m] * p;
- newocc[256 - one_state[256 - m]] += occ[m] * (1 - p);
+ newocc[ one_state[ m]] += occ[m] * (uint64_t) i >> 8;
+ newocc[256 - one_state[256 - m]] += occ[m] * (uint64_t)(256 - i) >> 8;
}
memcpy(occ, newocc, sizeof(occ));
}
diff --git a/tests/ref/vsynth/vsynth1-ffv1-2pass b/tests/ref/vsynth/vsynth1-ffv1-2pass
index c27c9691d2..477a1bf49e 100644
--- a/tests/ref/vsynth/vsynth1-ffv1-2pass
+++ b/tests/ref/vsynth/vsynth1-ffv1-2pass
@@ -1,4 +1,4 @@
-7332cfda96233acc7178b09868c07ad7 *tests/data/fate/vsynth1-ffv1-2pass.avi
-2382244 tests/data/fate/vsynth1-ffv1-2pass.avi
+266ff859dade888a2c0cfddb29260186 *tests/data/fate/vsynth1-ffv1-2pass.avi
+2382240 tests/data/fate/vsynth1-ffv1-2pass.avi
c5ccac874dbf808e9088bc3107860042 *tests/data/fate/vsynth1-ffv1-2pass.out.rawvideo
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/tests/ref/vsynth/vsynth2-ffv1-2pass b/tests/ref/vsynth/vsynth2-ffv1-2pass
index 26c20db24d..e14eb1a94e 100644
--- a/tests/ref/vsynth/vsynth2-ffv1-2pass
+++ b/tests/ref/vsynth/vsynth2-ffv1-2pass
@@ -1,4 +1,4 @@
-2f5af924c6f7de1d4c34ec2dc9fca4ac *tests/data/fate/vsynth2-ffv1-2pass.avi
-3530664 tests/data/fate/vsynth2-ffv1-2pass.avi
+97b5dc666896cbaf98cec3acfbe0f3fc *tests/data/fate/vsynth2-ffv1-2pass.avi
+3530654 tests/data/fate/vsynth2-ffv1-2pass.avi
36d7ca943916e1743cefa609eba0205c *tests/data/fate/vsynth2-ffv1-2pass.out.rawvideo
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/tests/ref/vsynth/vsynth3-ffv1-2pass b/tests/ref/vsynth/vsynth3-ffv1-2pass
index dd0fd615f4..dd7943c9ac 100644
--- a/tests/ref/vsynth/vsynth3-ffv1-2pass
+++ b/tests/ref/vsynth/vsynth3-ffv1-2pass
@@ -1,4 +1,4 @@
-5b658e65541539248035c17da5eada3a *tests/data/fate/vsynth3-ffv1-2pass.avi
-53522 tests/data/fate/vsynth3-ffv1-2pass.avi
+96a6700731a71ee2e05c207e2334ade7 *tests/data/fate/vsynth3-ffv1-2pass.avi
+53520 tests/data/fate/vsynth3-ffv1-2pass.avi
a038ad7c3c09f776304ef7accdea9c74 *tests/data/fate/vsynth3-ffv1-2pass.out.rawvideo
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 86700/ 86700
diff --git a/tests/ref/vsynth/vsynth_lena-ffv1-2pass b/tests/ref/vsynth/vsynth_lena-ffv1-2pass
index 9ece86aaa3..ef49a9f5a6 100644
--- a/tests/ref/vsynth/vsynth_lena-ffv1-2pass
+++ b/tests/ref/vsynth/vsynth_lena-ffv1-2pass
@@ -1,4 +1,4 @@
-2e1833cf75da113a6fabbaae07ddd455 *tests/data/fate/vsynth_lena-ffv1-2pass.avi
-3490450 tests/data/fate/vsynth_lena-ffv1-2pass.avi
+c46df7f2b5770564475710f1086cdff6 *tests/data/fate/vsynth_lena-ffv1-2pass.avi
+3490446 tests/data/fate/vsynth_lena-ffv1-2pass.avi
dde5895817ad9d219f79a52d0bdfb001 *tests/data/fate/vsynth_lena-ffv1-2pass.out.rawvideo
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
1
0
ffmpeg | branch: master | Michael Niedermayer <michael(a)niedermayer.cc> | Thu May 26 03:04:31 2022 +0200| [9e4d1549e84eac99f038342a9c14a31c64188ef0] | committer: Michael Niedermayer
avcodec/pcm-dvdenc: Mark unreachable defaults
Helps: CID1441929
Helps: CID1441931
Signed-off-by: Michael Niedermayer <michael(a)niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9e4d1549e84eac99f…
---
libavcodec/pcm-dvdenc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libavcodec/pcm-dvdenc.c b/libavcodec/pcm-dvdenc.c
index f18855cfa7..6bab1e0aaa 100644
--- a/libavcodec/pcm-dvdenc.c
+++ b/libavcodec/pcm-dvdenc.c
@@ -47,6 +47,8 @@ static av_cold int pcm_dvd_encode_init(AVCodecContext *avctx)
case 96000:
freq = 1;
break;
+ default:
+ av_assert1(0);
}
switch (avctx->sample_fmt) {
@@ -58,6 +60,8 @@ static av_cold int pcm_dvd_encode_init(AVCodecContext *avctx)
avctx->bits_per_coded_sample = 24;
quant = 2;
break;
+ default:
+ av_assert1(0);
}
avctx->bits_per_coded_sample = 16 + quant * 4;
1
0
ffmpeg | branch: master | Paul B Mahol <onemda(a)gmail.com> | Sun May 29 12:34:29 2022 +0200| [a7e099732405c5f048fb306d8e3c1dffe0d60e41] | committer: Paul B Mahol
avfilter/af_biquads: refactor some options
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a7e099732405c5f04…
---
libavfilter/af_biquads.c | 382 ++++++++++++-----------------------------------
1 file changed, 96 insertions(+), 286 deletions(-)
diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c
index 9110faabac..03165bf22d 100644
--- a/libavfilter/af_biquads.c
+++ b/libavfilter/af_biquads.c
@@ -1453,45 +1453,63 @@ const AVFilter ff_af_##name_ = { \
AVFILTER_DEFINE_CLASS(name); \
DEFINE_BIQUAD_FILTER_2(name, description, name)
+#define WIDTH_OPTION(x) \
+ {"width", "set width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=x}, 0, 99999, FLAGS}, \
+ {"w", "set width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=x}, 0, 99999, FLAGS}
+
+#define WIDTH_TYPE_OPTION(x) \
+ {"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=x}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"}, \
+ {"t", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=x}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"}, \
+ {"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"}, \
+ {"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"}, \
+ {"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"}, \
+ {"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"}, \
+ {"k", "kHz", 0, AV_OPT_TYPE_CONST, {.i64=KHERTZ}, 0, 0, FLAGS, "width_type"}
+
+#define MIX_CHANNELS_NORMALIZE_OPTION(x, y, z) \
+ {"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=x}, 0, 1, FLAGS}, \
+ {"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=x}, 0, 1, FLAGS}, \
+ {"channels", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str=y}, 0, 0, FLAGS}, \
+ {"c", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str=y}, 0, 0, FLAGS}, \
+ {"normalize", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=z}, 0, 1, FLAGS}, \
+ {"n", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=z}, 0, 1, FLAGS}
+
+#define TRANSFORM_OPTION(x) \
+ {"transform", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=x}, 0, NB_TTYPE-1, AF, "transform_type"}, \
+ {"a", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=x}, 0, NB_TTYPE-1, AF, "transform_type"}, \
+ {"di", "direct form I", 0, AV_OPT_TYPE_CONST, {.i64=DI}, 0, 0, AF, "transform_type"}, \
+ {"dii", "direct form II", 0, AV_OPT_TYPE_CONST, {.i64=DII}, 0, 0, AF, "transform_type"}, \
+ {"tdi", "transposed direct form I", 0, AV_OPT_TYPE_CONST, {.i64=TDI}, 0, 0, AF, "transform_type"}, \
+ {"tdii", "transposed direct form II", 0, AV_OPT_TYPE_CONST, {.i64=TDII}, 0, 0, AF, "transform_type"}, \
+ {"latt", "lattice-ladder form", 0, AV_OPT_TYPE_CONST, {.i64=LATT}, 0, 0, AF, "transform_type"}, \
+ {"svf", "state variable filter form", 0, AV_OPT_TYPE_CONST, {.i64=SVF}, 0, 0, AF, "transform_type"}, \
+ {"zdf", "zero-delay filter form", 0, AV_OPT_TYPE_CONST, {.i64=ZDF}, 0, 0, AF, "transform_type"}
+
+#define PRECISION_OPTION(x) \
+ {"precision", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=x}, -1, 3, AF, "precision"}, \
+ {"r", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=x}, -1, 3, AF, "precision"}, \
+ {"auto", "automatic", 0, AV_OPT_TYPE_CONST, {.i64=-1}, 0, 0, AF, "precision"}, \
+ {"s16", "signed 16-bit", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, "precision"}, \
+ {"s32", "signed 32-bit", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, "precision"}, \
+ {"f32", "floating-point single", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, AF, "precision"}, \
+ {"f64", "floating-point double", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, AF, "precision"}
+
+#define BLOCKSIZE_OPTION(x) \
+ {"blocksize", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=x}, 0, 32768, AF}, \
+ {"b", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=x}, 0, 32768, AF}
+
#if CONFIG_EQUALIZER_FILTER
static const AVOption equalizer_options[] = {
{"frequency", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, 999999, FLAGS},
{"f", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, 999999, FLAGS},
- {"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
- {"t", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
- {"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
- {"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
- {"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
- {"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
- {"k", "kHz", 0, AV_OPT_TYPE_CONST, {.i64=KHERTZ}, 0, 0, FLAGS, "width_type"},
- {"width", "set band-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 99999, FLAGS},
- {"w", "set band-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 99999, FLAGS},
+ WIDTH_TYPE_OPTION(QFACTOR),
+ WIDTH_OPTION(1.0),
{"gain", "set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 900, FLAGS},
{"g", "set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 900, FLAGS},
- {"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
- {"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
- {"channels", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str="all"}, 0, 0, FLAGS},
- {"c", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str="all"}, 0, 0, FLAGS},
- {"normalize", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
- {"n", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
- {"transform", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_TTYPE-1, AF, "transform_type"},
- {"a", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_TTYPE-1, AF, "transform_type"},
- {"di", "direct form I", 0, AV_OPT_TYPE_CONST, {.i64=DI}, 0, 0, AF, "transform_type"},
- {"dii", "direct form II", 0, AV_OPT_TYPE_CONST, {.i64=DII}, 0, 0, AF, "transform_type"},
- {"tdi", "transposed direct form I", 0, AV_OPT_TYPE_CONST, {.i64=TDI}, 0, 0, AF, "transform_type"},
- {"tdii", "transposed direct form II", 0, AV_OPT_TYPE_CONST, {.i64=TDII}, 0, 0, AF, "transform_type"},
- {"latt", "lattice-ladder form", 0, AV_OPT_TYPE_CONST, {.i64=LATT}, 0, 0, AF, "transform_type"},
- {"svf", "state variable filter form", 0, AV_OPT_TYPE_CONST, {.i64=SVF}, 0, 0, AF, "transform_type"},
- {"zdf", "zero-delay filter form", 0, AV_OPT_TYPE_CONST, {.i64=ZDF}, 0, 0, AF, "transform_type"},
- {"precision", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=-1}, -1, 3, AF, "precision"},
- {"r", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=-1}, -1, 3, AF, "precision"},
- {"auto", "automatic", 0, AV_OPT_TYPE_CONST, {.i64=-1}, 0, 0, AF, "precision"},
- {"s16", "signed 16-bit", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, "precision"},
- {"s32", "signed 32-bit", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, "precision"},
- {"f32", "floating-point single", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, AF, "precision"},
- {"f64", "floating-point double", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, AF, "precision"},
- {"blocksize", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=0}, 0, 32768, AF},
- {"b", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=0}, 0, 32768, AF},
+ MIX_CHANNELS_NORMALIZE_OPTION(1, "all", 0),
+ TRANSFORM_OPTION(DI),
+ PRECISION_OPTION(-1),
+ BLOCKSIZE_OPTION(0),
{NULL}
};
@@ -1501,43 +1519,16 @@ DEFINE_BIQUAD_FILTER(equalizer, "Apply two-pole peaking equalization (EQ) filter
static const AVOption bass_lowshelf_options[] = {
{"frequency", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=100}, 0, 999999, FLAGS},
{"f", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=100}, 0, 999999, FLAGS},
- {"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
- {"t", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
- {"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
- {"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
- {"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
- {"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
- {"k", "kHz", 0, AV_OPT_TYPE_CONST, {.i64=KHERTZ}, 0, 0, FLAGS, "width_type"},
- {"width", "set shelf transition steep", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
- {"w", "set shelf transition steep", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
+ WIDTH_TYPE_OPTION(QFACTOR),
+ WIDTH_OPTION(0.5),
{"gain", "set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 900, FLAGS},
{"g", "set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 900, FLAGS},
{"poles", "set number of poles", OFFSET(poles), AV_OPT_TYPE_INT, {.i64=2}, 1, 2, AF},
{"p", "set number of poles", OFFSET(poles), AV_OPT_TYPE_INT, {.i64=2}, 1, 2, AF},
- {"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
- {"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
- {"channels", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str="all"}, 0, 0, FLAGS},
- {"c", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str="all"}, 0, 0, FLAGS},
- {"normalize", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
- {"n", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
- {"transform", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_TTYPE-1, AF, "transform_type"},
- {"a", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_TTYPE-1, AF, "transform_type"},
- {"di", "direct form I", 0, AV_OPT_TYPE_CONST, {.i64=DI}, 0, 0, AF, "transform_type"},
- {"dii", "direct form II", 0, AV_OPT_TYPE_CONST, {.i64=DII}, 0, 0, AF, "transform_type"},
- {"tdi", "transposed direct form I", 0, AV_OPT_TYPE_CONST, {.i64=TDI}, 0, 0, AF, "transform_type"},
- {"tdii", "transposed direct form II", 0, AV_OPT_TYPE_CONST, {.i64=TDII}, 0, 0, AF, "transform_type"},
- {"latt", "lattice-ladder form", 0, AV_OPT_TYPE_CONST, {.i64=LATT}, 0, 0, AF, "transform_type"},
- {"svf", "state variable filter form", 0, AV_OPT_TYPE_CONST, {.i64=SVF}, 0, 0, AF, "transform_type"},
- {"zdf", "zero-delay filter form", 0, AV_OPT_TYPE_CONST, {.i64=ZDF}, 0, 0, AF, "transform_type"},
- {"precision", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=-1}, -1, 3, AF, "precision"},
- {"r", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=-1}, -1, 3, AF, "precision"},
- {"auto", "automatic", 0, AV_OPT_TYPE_CONST, {.i64=-1}, 0, 0, AF, "precision"},
- {"s16", "signed 16-bit", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, "precision"},
- {"s32", "signed 32-bit", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, "precision"},
- {"f32", "floating-point single", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, AF, "precision"},
- {"f64", "floating-point double", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, AF, "precision"},
- {"blocksize", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=0}, 0, 32768, AF},
- {"b", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=0}, 0, 32768, AF},
+ MIX_CHANNELS_NORMALIZE_OPTION(1, "all", 0),
+ TRANSFORM_OPTION(DI),
+ PRECISION_OPTION(-1),
+ BLOCKSIZE_OPTION(0),
{NULL}
};
@@ -1554,43 +1545,16 @@ DEFINE_BIQUAD_FILTER_2(lowshelf, "Apply a low shelf filter.", bass_lowshelf);
static const AVOption treble_highshelf_options[] = {
{"frequency", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
{"f", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
- {"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
- {"t", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
- {"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
- {"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
- {"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
- {"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
- {"k", "kHz", 0, AV_OPT_TYPE_CONST, {.i64=KHERTZ}, 0, 0, FLAGS, "width_type"},
- {"width", "set shelf transition steep", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
- {"w", "set shelf transition steep", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
+ WIDTH_TYPE_OPTION(QFACTOR),
+ WIDTH_OPTION(0.5),
{"gain", "set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 900, FLAGS},
{"g", "set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 900, FLAGS},
{"poles", "set number of poles", OFFSET(poles), AV_OPT_TYPE_INT, {.i64=2}, 1, 2, AF},
{"p", "set number of poles", OFFSET(poles), AV_OPT_TYPE_INT, {.i64=2}, 1, 2, AF},
- {"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
- {"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
- {"channels", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str="all"}, 0, 0, FLAGS},
- {"c", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str="all"}, 0, 0, FLAGS},
- {"normalize", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
- {"n", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
- {"transform", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_TTYPE-1, AF, "transform_type"},
- {"a", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_TTYPE-1, AF, "transform_type"},
- {"di", "direct form I", 0, AV_OPT_TYPE_CONST, {.i64=DI}, 0, 0, AF, "transform_type"},
- {"dii", "direct form II", 0, AV_OPT_TYPE_CONST, {.i64=DII}, 0, 0, AF, "transform_type"},
- {"tdi", "transposed direct form I", 0, AV_OPT_TYPE_CONST, {.i64=TDI}, 0, 0, AF, "transform_type"},
- {"tdii", "transposed direct form II", 0, AV_OPT_TYPE_CONST, {.i64=TDII}, 0, 0, AF, "transform_type"},
- {"latt", "lattice-ladder form", 0, AV_OPT_TYPE_CONST, {.i64=LATT}, 0, 0, AF, "transform_type"},
- {"svf", "state variable filter form", 0, AV_OPT_TYPE_CONST, {.i64=SVF}, 0, 0, AF, "transform_type"},
- {"zdf", "zero-delay filter form", 0, AV_OPT_TYPE_CONST, {.i64=ZDF}, 0, 0, AF, "transform_type"},
- {"precision", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=-1}, -1, 3, AF, "precision"},
- {"r", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=-1}, -1, 3, AF, "precision"},
- {"auto", "automatic", 0, AV_OPT_TYPE_CONST, {.i64=-1}, 0, 0, AF, "precision"},
- {"s16", "signed 16-bit", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, "precision"},
- {"s32", "signed 32-bit", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, "precision"},
- {"f32", "floating-point single", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, AF, "precision"},
- {"f64", "floating-point double", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, AF, "precision"},
- {"blocksize", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=0}, 0, 32768, AF},
- {"b", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=0}, 0, 32768, AF},
+ MIX_CHANNELS_NORMALIZE_OPTION(1, "all", 0),
+ TRANSFORM_OPTION(DI),
+ PRECISION_OPTION(-1),
+ BLOCKSIZE_OPTION(0),
{NULL}
};
@@ -1614,40 +1578,13 @@ DEFINE_BIQUAD_FILTER_2(tiltshelf, "Apply a tilt shelf filter.", treble_highshelf
static const AVOption bandpass_options[] = {
{"frequency", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
{"f", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
- {"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
- {"t", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
- {"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
- {"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
- {"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
- {"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
- {"k", "kHz", 0, AV_OPT_TYPE_CONST, {.i64=KHERTZ}, 0, 0, FLAGS, "width_type"},
- {"width", "set band-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
- {"w", "set band-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
+ WIDTH_TYPE_OPTION(QFACTOR),
+ WIDTH_OPTION(0.5),
{"csg", "use constant skirt gain", OFFSET(csg), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
- {"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
- {"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
- {"channels", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str="all"}, 0, 0, FLAGS},
- {"c", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str="all"}, 0, 0, FLAGS},
- {"normalize", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
- {"n", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
- {"transform", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_TTYPE-1, AF, "transform_type"},
- {"a", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_TTYPE-1, AF, "transform_type"},
- {"di", "direct form I", 0, AV_OPT_TYPE_CONST, {.i64=DI}, 0, 0, AF, "transform_type"},
- {"dii", "direct form II", 0, AV_OPT_TYPE_CONST, {.i64=DII}, 0, 0, AF, "transform_type"},
- {"tdi", "transposed direct form I", 0, AV_OPT_TYPE_CONST, {.i64=TDI}, 0, 0, AF, "transform_type"},
- {"tdii", "transposed direct form II", 0, AV_OPT_TYPE_CONST, {.i64=TDII}, 0, 0, AF, "transform_type"},
- {"latt", "lattice-ladder form", 0, AV_OPT_TYPE_CONST, {.i64=LATT}, 0, 0, AF, "transform_type"},
- {"svf", "state variable filter form", 0, AV_OPT_TYPE_CONST, {.i64=SVF}, 0, 0, AF, "transform_type"},
- {"zdf", "zero-delay filter form", 0, AV_OPT_TYPE_CONST, {.i64=ZDF}, 0, 0, AF, "transform_type"},
- {"precision", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=-1}, -1, 3, AF, "precision"},
- {"r", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=-1}, -1, 3, AF, "precision"},
- {"auto", "automatic", 0, AV_OPT_TYPE_CONST, {.i64=-1}, 0, 0, AF, "precision"},
- {"s16", "signed 16-bit", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, "precision"},
- {"s32", "signed 32-bit", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, "precision"},
- {"f32", "floating-point single", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, AF, "precision"},
- {"f64", "floating-point double", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, AF, "precision"},
- {"blocksize", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=0}, 0, 32768, AF},
- {"b", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=0}, 0, 32768, AF},
+ MIX_CHANNELS_NORMALIZE_OPTION(1, "all", 0),
+ TRANSFORM_OPTION(DI),
+ PRECISION_OPTION(-1),
+ BLOCKSIZE_OPTION(0),
{NULL}
};
@@ -1657,39 +1594,12 @@ DEFINE_BIQUAD_FILTER(bandpass, "Apply a two-pole Butterworth band-pass filter.")
static const AVOption bandreject_options[] = {
{"frequency", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
{"f", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
- {"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
- {"t", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
- {"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
- {"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
- {"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
- {"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
- {"k", "kHz", 0, AV_OPT_TYPE_CONST, {.i64=KHERTZ}, 0, 0, FLAGS, "width_type"},
- {"width", "set band-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
- {"w", "set band-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
- {"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
- {"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
- {"channels", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str="all"}, 0, 0, FLAGS},
- {"c", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str="all"}, 0, 0, FLAGS},
- {"normalize", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
- {"n", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
- {"transform", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_TTYPE-1, AF, "transform_type"},
- {"a", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_TTYPE-1, AF, "transform_type"},
- {"di", "direct form I", 0, AV_OPT_TYPE_CONST, {.i64=DI}, 0, 0, AF, "transform_type"},
- {"dii", "direct form II", 0, AV_OPT_TYPE_CONST, {.i64=DII}, 0, 0, AF, "transform_type"},
- {"tdi", "transposed direct form I", 0, AV_OPT_TYPE_CONST, {.i64=TDI}, 0, 0, AF, "transform_type"},
- {"tdii", "transposed direct form II", 0, AV_OPT_TYPE_CONST, {.i64=TDII}, 0, 0, AF, "transform_type"},
- {"latt", "lattice-ladder form", 0, AV_OPT_TYPE_CONST, {.i64=LATT}, 0, 0, AF, "transform_type"},
- {"svf", "state variable filter form", 0, AV_OPT_TYPE_CONST, {.i64=SVF}, 0, 0, AF, "transform_type"},
- {"zdf", "zero-delay filter form", 0, AV_OPT_TYPE_CONST, {.i64=ZDF}, 0, 0, AF, "transform_type"},
- {"precision", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=-1}, -1, 3, AF, "precision"},
- {"r", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=-1}, -1, 3, AF, "precision"},
- {"auto", "automatic", 0, AV_OPT_TYPE_CONST, {.i64=-1}, 0, 0, AF, "precision"},
- {"s16", "signed 16-bit", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, "precision"},
- {"s32", "signed 32-bit", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, "precision"},
- {"f32", "floating-point single", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, AF, "precision"},
- {"f64", "floating-point double", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, AF, "precision"},
- {"blocksize", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=0}, 0, 32768, AF},
- {"b", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=0}, 0, 32768, AF},
+ WIDTH_TYPE_OPTION(QFACTOR),
+ WIDTH_OPTION(0.5),
+ MIX_CHANNELS_NORMALIZE_OPTION(1, "all", 0),
+ TRANSFORM_OPTION(DI),
+ PRECISION_OPTION(-1),
+ BLOCKSIZE_OPTION(0),
{NULL}
};
@@ -1699,41 +1609,14 @@ DEFINE_BIQUAD_FILTER(bandreject, "Apply a two-pole Butterworth band-reject filte
static const AVOption lowpass_options[] = {
{"frequency", "set frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=500}, 0, 999999, FLAGS},
{"f", "set frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=500}, 0, 999999, FLAGS},
- {"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
- {"t", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
- {"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
- {"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
- {"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
- {"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
- {"k", "kHz", 0, AV_OPT_TYPE_CONST, {.i64=KHERTZ}, 0, 0, FLAGS, "width_type"},
- {"width", "set width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.707}, 0, 99999, FLAGS},
- {"w", "set width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.707}, 0, 99999, FLAGS},
+ WIDTH_TYPE_OPTION(QFACTOR),
+ WIDTH_OPTION(0.707),
{"poles", "set number of poles", OFFSET(poles), AV_OPT_TYPE_INT, {.i64=2}, 1, 2, AF},
{"p", "set number of poles", OFFSET(poles), AV_OPT_TYPE_INT, {.i64=2}, 1, 2, AF},
- {"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
- {"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
- {"channels", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str="all"}, 0, 0, FLAGS},
- {"c", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str="all"}, 0, 0, FLAGS},
- {"normalize", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
- {"n", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
- {"transform", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_TTYPE-1, AF, "transform_type"},
- {"a", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_TTYPE-1, AF, "transform_type"},
- {"di", "direct form I", 0, AV_OPT_TYPE_CONST, {.i64=DI}, 0, 0, AF, "transform_type"},
- {"dii", "direct form II", 0, AV_OPT_TYPE_CONST, {.i64=DII}, 0, 0, AF, "transform_type"},
- {"tdi", "transposed direct form I", 0, AV_OPT_TYPE_CONST, {.i64=TDI}, 0, 0, AF, "transform_type"},
- {"tdii", "transposed direct form II", 0, AV_OPT_TYPE_CONST, {.i64=TDII}, 0, 0, AF, "transform_type"},
- {"latt", "lattice-ladder form", 0, AV_OPT_TYPE_CONST, {.i64=LATT}, 0, 0, AF, "transform_type"},
- {"svf", "state variable filter form", 0, AV_OPT_TYPE_CONST, {.i64=SVF}, 0, 0, AF, "transform_type"},
- {"zdf", "zero-delay filter form", 0, AV_OPT_TYPE_CONST, {.i64=ZDF}, 0, 0, AF, "transform_type"},
- {"precision", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=-1}, -1, 3, AF, "precision"},
- {"r", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=-1}, -1, 3, AF, "precision"},
- {"auto", "automatic", 0, AV_OPT_TYPE_CONST, {.i64=-1}, 0, 0, AF, "precision"},
- {"s16", "signed 16-bit", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, "precision"},
- {"s32", "signed 32-bit", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, "precision"},
- {"f32", "floating-point single", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, AF, "precision"},
- {"f64", "floating-point double", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, AF, "precision"},
- {"blocksize", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=0}, 0, 32768, AF},
- {"b", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=0}, 0, 32768, AF},
+ MIX_CHANNELS_NORMALIZE_OPTION(1, "all", 0),
+ TRANSFORM_OPTION(DI),
+ PRECISION_OPTION(-1),
+ BLOCKSIZE_OPTION(0),
{NULL}
};
@@ -1743,41 +1626,14 @@ DEFINE_BIQUAD_FILTER(lowpass, "Apply a low-pass filter with 3dB point frequency.
static const AVOption highpass_options[] = {
{"frequency", "set frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
{"f", "set frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
- {"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
- {"t", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
- {"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
- {"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
- {"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
- {"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
- {"k", "kHz", 0, AV_OPT_TYPE_CONST, {.i64=KHERTZ}, 0, 0, FLAGS, "width_type"},
- {"width", "set width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.707}, 0, 99999, FLAGS},
- {"w", "set width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.707}, 0, 99999, FLAGS},
+ WIDTH_TYPE_OPTION(QFACTOR),
+ WIDTH_OPTION(0.707),
{"poles", "set number of poles", OFFSET(poles), AV_OPT_TYPE_INT, {.i64=2}, 1, 2, AF},
{"p", "set number of poles", OFFSET(poles), AV_OPT_TYPE_INT, {.i64=2}, 1, 2, AF},
- {"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
- {"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
- {"channels", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str="all"}, 0, 0, FLAGS},
- {"c", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str="all"}, 0, 0, FLAGS},
- {"normalize", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
- {"n", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
- {"transform", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_TTYPE-1, AF, "transform_type"},
- {"a", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_TTYPE-1, AF, "transform_type"},
- {"di", "direct form I", 0, AV_OPT_TYPE_CONST, {.i64=DI}, 0, 0, AF, "transform_type"},
- {"dii", "direct form II", 0, AV_OPT_TYPE_CONST, {.i64=DII}, 0, 0, AF, "transform_type"},
- {"tdi", "transposed direct form I", 0, AV_OPT_TYPE_CONST, {.i64=TDI}, 0, 0, AF, "transform_type"},
- {"tdii", "transposed direct form II", 0, AV_OPT_TYPE_CONST, {.i64=TDII}, 0, 0, AF, "transform_type"},
- {"latt", "lattice-ladder form", 0, AV_OPT_TYPE_CONST, {.i64=LATT}, 0, 0, AF, "transform_type"},
- {"svf", "state variable filter form", 0, AV_OPT_TYPE_CONST, {.i64=SVF}, 0, 0, AF, "transform_type"},
- {"zdf", "zero-delay filter form", 0, AV_OPT_TYPE_CONST, {.i64=ZDF}, 0, 0, AF, "transform_type"},
- {"precision", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=-1}, -1, 3, AF, "precision"},
- {"r", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=-1}, -1, 3, AF, "precision"},
- {"auto", "automatic", 0, AV_OPT_TYPE_CONST, {.i64=-1}, 0, 0, AF, "precision"},
- {"s16", "signed 16-bit", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, "precision"},
- {"s32", "signed 32-bit", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, "precision"},
- {"f32", "floating-point single", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, AF, "precision"},
- {"f64", "floating-point double", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, AF, "precision"},
- {"blocksize", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=0}, 0, 32768, AF},
- {"b", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=0}, 0, 32768, AF},
+ MIX_CHANNELS_NORMALIZE_OPTION(1, "all", 0),
+ TRANSFORM_OPTION(DI),
+ PRECISION_OPTION(-1),
+ BLOCKSIZE_OPTION(0),
{NULL}
};
@@ -1787,39 +1643,13 @@ DEFINE_BIQUAD_FILTER(highpass, "Apply a high-pass filter with 3dB point frequenc
static const AVOption allpass_options[] = {
{"frequency", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
{"f", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
- {"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=HERTZ}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
- {"t", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=HERTZ}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
- {"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
- {"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
- {"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
- {"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
- {"k", "kHz", 0, AV_OPT_TYPE_CONST, {.i64=KHERTZ}, 0, 0, FLAGS, "width_type"},
- {"width", "set filter-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=707.1}, 0, 99999, FLAGS},
- {"w", "set filter-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=707.1}, 0, 99999, FLAGS},
- {"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
- {"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
- {"channels", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str="all"}, 0, 0, FLAGS},
- {"c", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str="all"}, 0, 0, FLAGS},
- {"normalize", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
- {"n", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
+ WIDTH_TYPE_OPTION(QFACTOR),
+ WIDTH_OPTION(0.707),
+ MIX_CHANNELS_NORMALIZE_OPTION(1, "all", 0),
{"order", "set filter order", OFFSET(order), AV_OPT_TYPE_INT, {.i64=2}, 1, 2, FLAGS},
{"o", "set filter order", OFFSET(order), AV_OPT_TYPE_INT, {.i64=2}, 1, 2, FLAGS},
- {"transform", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_TTYPE-1, AF, "transform_type"},
- {"a", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_TTYPE-1, AF, "transform_type"},
- {"di", "direct form I", 0, AV_OPT_TYPE_CONST, {.i64=DI}, 0, 0, AF, "transform_type"},
- {"dii", "direct form II", 0, AV_OPT_TYPE_CONST, {.i64=DII}, 0, 0, AF, "transform_type"},
- {"tdi", "transposed direct form I", 0, AV_OPT_TYPE_CONST, {.i64=TDI}, 0, 0, AF, "transform_type"},
- {"tdii", "transposed direct form II", 0, AV_OPT_TYPE_CONST, {.i64=TDII}, 0, 0, AF, "transform_type"},
- {"latt", "lattice-ladder form", 0, AV_OPT_TYPE_CONST, {.i64=LATT}, 0, 0, AF, "transform_type"},
- {"svf", "state variable filter form", 0, AV_OPT_TYPE_CONST, {.i64=SVF}, 0, 0, AF, "transform_type"},
- {"zdf", "zero-delay filter form", 0, AV_OPT_TYPE_CONST, {.i64=ZDF}, 0, 0, AF, "transform_type"},
- {"precision", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=-1}, -1, 3, AF, "precision"},
- {"r", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=-1}, -1, 3, AF, "precision"},
- {"auto", "automatic", 0, AV_OPT_TYPE_CONST, {.i64=-1}, 0, 0, AF, "precision"},
- {"s16", "signed 16-bit", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, "precision"},
- {"s32", "signed 32-bit", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, "precision"},
- {"f32", "floating-point single", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, AF, "precision"},
- {"f64", "floating-point double", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, AF, "precision"},
+ TRANSFORM_OPTION(DI),
+ PRECISION_OPTION(-1),
{NULL}
};
@@ -1833,30 +1663,10 @@ static const AVOption biquad_options[] = {
{"b0", NULL, OFFSET(ob0), AV_OPT_TYPE_DOUBLE, {.dbl=0}, INT32_MIN, INT32_MAX, FLAGS},
{"b1", NULL, OFFSET(ob1), AV_OPT_TYPE_DOUBLE, {.dbl=0}, INT32_MIN, INT32_MAX, FLAGS},
{"b2", NULL, OFFSET(ob2), AV_OPT_TYPE_DOUBLE, {.dbl=0}, INT32_MIN, INT32_MAX, FLAGS},
- {"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
- {"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
- {"channels", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str="all"}, 0, 0, FLAGS},
- {"c", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str="all"}, 0, 0, FLAGS},
- {"normalize", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
- {"n", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
- {"transform", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_TTYPE-1, AF, "transform_type"},
- {"a", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_TTYPE-1, AF, "transform_type"},
- {"di", "direct form I", 0, AV_OPT_TYPE_CONST, {.i64=DI}, 0, 0, AF, "transform_type"},
- {"dii", "direct form II", 0, AV_OPT_TYPE_CONST, {.i64=DII}, 0, 0, AF, "transform_type"},
- {"tdi", "transposed direct form I", 0, AV_OPT_TYPE_CONST, {.i64=TDI}, 0, 0, AF, "transform_type"},
- {"tdii", "transposed direct form II", 0, AV_OPT_TYPE_CONST, {.i64=TDII}, 0, 0, AF, "transform_type"},
- {"latt", "lattice-ladder form", 0, AV_OPT_TYPE_CONST, {.i64=LATT}, 0, 0, AF, "transform_type"},
- {"svf", "state variable filter form", 0, AV_OPT_TYPE_CONST, {.i64=SVF}, 0, 0, AF, "transform_type"},
- {"zdf", "zero-delay filter form", 0, AV_OPT_TYPE_CONST, {.i64=ZDF}, 0, 0, AF, "transform_type"},
- {"precision", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=-1}, -1, 3, AF, "precision"},
- {"r", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=-1}, -1, 3, AF, "precision"},
- {"auto", "automatic", 0, AV_OPT_TYPE_CONST, {.i64=-1}, 0, 0, AF, "precision"},
- {"s16", "signed 16-bit", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, "precision"},
- {"s32", "signed 32-bit", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, "precision"},
- {"f32", "floating-point single", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, AF, "precision"},
- {"f64", "floating-point double", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, AF, "precision"},
- {"blocksize", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=0}, 0, 32768, AF},
- {"b", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=0}, 0, 32768, AF},
+ MIX_CHANNELS_NORMALIZE_OPTION(1, "all", 0),
+ TRANSFORM_OPTION(DI),
+ PRECISION_OPTION(-1),
+ BLOCKSIZE_OPTION(0),
{NULL}
};
1
0
ffmpeg | branch: master | Paul B Mahol <onemda(a)gmail.com> | Wed May 25 11:13:32 2022 +0200| [525f83becd7c1cc8de4c1def6584510026c12f23] | committer: Paul B Mahol
avfilter: add tiltshelf audio filter
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=525f83becd7c1cc8d…
---
Changelog | 1 +
doc/filters.texi | 91 ++++++++++++++++++++++++++++++++++++++++++++++++
libavfilter/af_biquads.c | 39 +++++++++++++++++----
libavfilter/allfilters.c | 1 +
libavfilter/version.h | 2 +-
5 files changed, 127 insertions(+), 7 deletions(-)
diff --git a/Changelog b/Changelog
index 53130f072f..c5eab22c83 100644
--- a/Changelog
+++ b/Changelog
@@ -17,6 +17,7 @@ version 5.1:
- multiply video filter
- PGS subtitle frame merge bitstream filter
- blurdetect filter
+- tiltshelf audio filter
version 5.0:
diff --git a/doc/filters.texi b/doc/filters.texi
index 0e10946cca..d65e83d4d0 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -6690,6 +6690,97 @@ Set window overlap. If set to 1, the recommended overlap for selected
window function will be picked. Default is @code{0.5}.
@end table
+@section tiltshelf
+
+Boost or cut the lower frequencies and cut or boost higher frequencies
+of the audio using a two-pole shelving filter with a response similar to
+that of a standard hi-fi's tone-controls.
+This is also known as shelving equalisation (EQ).
+
+The filter accepts the following options:
+
+@table @option
+@item gain, g
+Give the gain at 0 Hz. Its useful range is about -20
+(for a large cut) to +20 (for a large boost).
+Beware of clipping when using a positive gain.
+
+@item frequency, f
+Set the filter's central frequency and so can be used
+to extend or reduce the frequency range to be boosted or cut.
+The default value is @code{3000} Hz.
+
+@item width_type, t
+Set method to specify band-width of filter.
+@table @option
+@item h
+Hz
+@item q
+Q-Factor
+@item o
+octave
+@item s
+slope
+@item k
+kHz
+@end table
+
+@item width, w
+Determine how steep is the filter's shelf transition.
+
+@item poles, p
+Set number of poles. Default is 2.
+
+@item mix, m
+How much to use filtered signal in output. Default is 1.
+Range is between 0 and 1.
+
+@item channels, c
+Specify which channels to filter, by default all available are filtered.
+
+@item normalize, n
+Normalize biquad coefficients, by default is disabled.
+Enabling it will normalize magnitude response at DC to 0dB.
+
+@item transform, a
+Set transform type of IIR filter.
+@table @option
+@item di
+@item dii
+@item tdi
+@item tdii
+@item latt
+@item svf
+@item zdf
+@end table
+
+@item precision, r
+Set precison of filtering.
+@table @option
+@item auto
+Pick automatic sample format depending on surround filters.
+@item s16
+Always use signed 16-bit.
+@item s32
+Always use signed 32-bit.
+@item f32
+Always use float 32-bit.
+@item f64
+Always use float 64-bit.
+@end table
+
+@item block_size, b
+Set block size used for reverse IIR processing. If this value is set to high enough
+value (higher than impulse response length truncated when reaches near zero values) filtering
+will become linear phase otherwise if not big enough it will just produce nasty artifacts.
+
+Note that filter delay will be exactly this many samples when set to non-zero value.
+@end table
+
+@subsection Commands
+
+This filter supports some options as @ref{commands}.
+
@section treble, highshelf
Boost or cut treble (upper) frequencies of the audio using a two-pole
diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c
index 26cb4d49bb..9110faabac 100644
--- a/libavfilter/af_biquads.c
+++ b/libavfilter/af_biquads.c
@@ -85,6 +85,7 @@ enum FilterType {
lowpass,
lowshelf,
highshelf,
+ tiltshelf,
};
enum WidthType {
@@ -698,6 +699,17 @@ static void convert_dir2zdf(BiquadsContext *s, int sample_rate)
m[1] = k * (A - 1.);
m[2] = A * A - 1.;
break;
+ case tiltshelf:
+ A = ff_exp10(s->gain / 20.);
+ g = tan(M_PI * s->frequency / sample_rate) / sqrt(A);
+ k = 1. / Q;
+ a[0] = 1. / (1. + g * (g + k));
+ a[1] = g * a[0];
+ a[2] = g * a[1];
+ m[0] = 1./ A;
+ m[1] = k * (A - 1.) / A;
+ m[2] = (A * A - 1.) / A;
+ break;
case treble:
case highshelf:
A = ff_exp10(s->gain / 40.);
@@ -777,7 +789,8 @@ static int config_filter(AVFilterLink *outlink, int reset)
AVFilterContext *ctx = outlink->src;
BiquadsContext *s = ctx->priv;
AVFilterLink *inlink = ctx->inputs[0];
- double A = ff_exp10(s->gain / 40);
+ double gain = s->gain * ((s->filter_type == tiltshelf) + 1.);
+ double A = ff_exp10(gain / 40);
double w0 = 2 * M_PI * s->frequency / inlink->sample_rate;
double K = tan(w0 / 2.);
double alpha, beta;
@@ -835,9 +848,10 @@ static int config_filter(AVFilterLink *outlink, int reset)
break;
case bass:
beta = sqrt((A * A + 1) - (A - 1) * (A - 1));
+ case tiltshelf:
case lowshelf:
if (s->poles == 1) {
- double A = ff_exp10(s->gain / 20);
+ double A = ff_exp10(gain / 20);
double ro = -sin(w0 / 2. - M_PI_4) / sin(w0 / 2. + M_PI_4);
double n = (A + 1) / (A - 1);
double alpha1 = A == 1. ? 0. : n - FFSIGN(n) * sqrt(n * n - 1);
@@ -863,7 +877,7 @@ static int config_filter(AVFilterLink *outlink, int reset)
beta = sqrt((A * A + 1) - (A - 1) * (A - 1));
case highshelf:
if (s->poles == 1) {
- double A = ff_exp10(s->gain / 20);
+ double A = ff_exp10(gain / 20);
double ro = sin(w0 / 2. - M_PI_4) / sin(w0 / 2. + M_PI_4);
double n = (A + 1) / (A - 1);
double alpha1 = A == 1. ? 0. : n - FFSIGN(n) * sqrt(n * n - 1);
@@ -985,6 +999,14 @@ static int config_filter(AVFilterLink *outlink, int reset)
s->b2 *= factor;
}
+ switch (s->filter_type) {
+ case tiltshelf:
+ s->b0 /= A;
+ s->b1 /= A;
+ s->b2 /= A;
+ break;
+ }
+
s->cache = av_realloc_f(s->cache, sizeof(ChanCache), inlink->ch_layout.nb_channels);
if (!s->cache)
return AVERROR(ENOMEM);
@@ -1528,7 +1550,7 @@ DEFINE_BIQUAD_FILTER_2(bass, "Boost or cut lower frequencies.", bass_lowshelf);
DEFINE_BIQUAD_FILTER_2(lowshelf, "Apply a low shelf filter.", bass_lowshelf);
#endif /* CONFIG_LOWSHELF_FILTER */
#endif /* CONFIG_BASS_FILTER || CONFIG LOWSHELF_FILTER */
-#if CONFIG_TREBLE_FILTER || CONFIG_HIGHSHELF_FILTER
+#if CONFIG_TREBLE_FILTER || CONFIG_HIGHSHELF_FILTER || CONFIG_TILTSHELF_FILTER
static const AVOption treble_highshelf_options[] = {
{"frequency", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
{"f", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
@@ -1572,7 +1594,7 @@ static const AVOption treble_highshelf_options[] = {
{NULL}
};
-AVFILTER_DEFINE_CLASS_EXT(treble_highshelf, "treble/highshelf",
+AVFILTER_DEFINE_CLASS_EXT(treble_highshelf, "treble/high/tiltshelf",
treble_highshelf_options);
#if CONFIG_TREBLE_FILTER
@@ -1582,7 +1604,12 @@ DEFINE_BIQUAD_FILTER_2(treble, "Boost or cut upper frequencies.", treble_highshe
#if CONFIG_HIGHSHELF_FILTER
DEFINE_BIQUAD_FILTER_2(highshelf, "Apply a high shelf filter.", treble_highshelf);
#endif /* CONFIG_HIGHSHELF_FILTER */
-#endif /* CONFIG_TREBLE_FILTER || CONFIG_HIGHSHELF_FILTER */
+
+#if CONFIG_TILTSHELF_FILTER
+DEFINE_BIQUAD_FILTER_2(tiltshelf, "Apply a tilt shelf filter.", treble_highshelf);
+#endif
+#endif /* CONFIG_TREBLE_FILTER || CONFIG_HIGHSHELF_FILTER || CONFIG_TILTSHELF_FILTER */
+
#if CONFIG_BANDPASS_FILTER
static const AVOption bandpass_options[] = {
{"frequency", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 2409964e53..2f72477523 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -149,6 +149,7 @@ extern const AVFilter ff_af_stereotools;
extern const AVFilter ff_af_stereowiden;
extern const AVFilter ff_af_superequalizer;
extern const AVFilter ff_af_surround;
+extern const AVFilter ff_af_tiltshelf;
extern const AVFilter ff_af_treble;
extern const AVFilter ff_af_tremolo;
extern const AVFilter ff_af_vibrato;
diff --git a/libavfilter/version.h b/libavfilter/version.h
index df23710223..86b33c4174 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -31,7 +31,7 @@
#include "version_major.h"
-#define LIBAVFILTER_VERSION_MINOR 39
+#define LIBAVFILTER_VERSION_MINOR 40
#define LIBAVFILTER_VERSION_MICRO 100
1
0
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com> | Thu May 26 00:05:32 2022 +0200| [fab9130c7ae97709b9dde4e4eecf83afb747241b] | committer: Andreas Rheinhardt
fate/ffmpeg: Fix test requirements
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fab9130c7ae97709b…
---
tests/Makefile | 1 +
tests/fate/ffmpeg.mak | 122 ++++++++++++++++++++------------------------------
2 files changed, 49 insertions(+), 74 deletions(-)
diff --git a/tests/Makefile b/tests/Makefile
index 5677364471..035bdf783e 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -174,6 +174,7 @@ include $(SRC_PATH)/tests/fate/dpcm.mak
include $(SRC_PATH)/tests/fate/dvvideo.mak
include $(SRC_PATH)/tests/fate/ea.mak
include $(SRC_PATH)/tests/fate/exif.mak
+# Must be included after lavf-video.mak
include $(SRC_PATH)/tests/fate/ffmpeg.mak
include $(SRC_PATH)/tests/fate/ffprobe.mak
include $(SRC_PATH)/tests/fate/fft.mak
diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
index 9d14a96e13..94f50423be 100644
--- a/tests/fate/ffmpeg.mak
+++ b/tests/fate/ffmpeg.mak
@@ -1,20 +1,20 @@
-FATE_MAPCHAN-$(CONFIG_CHANNELMAP_FILTER) += fate-mapchan-6ch-extract-2
+FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN, WAV, PCM_S16LE, PCM_S16LE, WAV, MD5_PROTOCOL) += fate-mapchan-6ch-extract-2
fate-mapchan-6ch-extract-2: tests/data/asynth-22050-6.wav
fate-mapchan-6ch-extract-2: CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-22050-6.wav -map_channel 0.0.0 -fflags +bitexact -f wav md5: -map_channel 0.0.1 -fflags +bitexact -f wav md5:
-FATE_MAPCHAN-$(CONFIG_CHANNELMAP_FILTER) += fate-mapchan-6ch-extract-2-downmix-mono
+FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN ARESAMPLE, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-mapchan-6ch-extract-2-downmix-mono
fate-mapchan-6ch-extract-2-downmix-mono: tests/data/asynth-22050-6.wav
fate-mapchan-6ch-extract-2-downmix-mono: CMD = md5 -auto_conversion_filters -i $(TARGET_PATH)/tests/data/asynth-22050-6.wav -map_channel 0.0.1 -map_channel 0.0.0 -ac 1 -fflags +bitexact -f wav
-FATE_MAPCHAN-$(CONFIG_CHANNELMAP_FILTER) += fate-mapchan-silent-mono
+FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-mapchan-silent-mono
fate-mapchan-silent-mono: tests/data/asynth-22050-1.wav
fate-mapchan-silent-mono: CMD = md5 -i $(TARGET_PATH)/tests/data/asynth-22050-1.wav -map_channel -1 -map_channel 0.0.0 -fflags +bitexact -f wav
-FATE_MAPCHAN-$(CONFIG_CHANNELMAP_FILTER) += fate-mapchan-2ch-extract-ch0-ch2-trailing
+FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-mapchan-2ch-extract-ch0-ch2-trailing
fate-mapchan-2ch-extract-ch0-ch2-trailing: tests/data/asynth-44100-2.wav
fate-mapchan-2ch-extract-ch0-ch2-trailing: CMD = md5 -i $(TARGET_PATH)/tests/data/asynth-44100-2.wav -map_channel 0.0.0 -map_channel 0.0.2? -fflags +bitexact -f wav
-FATE_MAPCHAN-$(CONFIG_CHANNELMAP_FILTER) += fate-mapchan-3ch-extract-ch0-ch2-trailing
+FATE_MAPCHAN-$(call FILTERDEMDECENCMUX, PAN, WAV, PCM_S16LE, PCM_S16LE, WAV) += fate-mapchan-3ch-extract-ch0-ch2-trailing
fate-mapchan-3ch-extract-ch0-ch2-trailing: tests/data/asynth-44100-3.wav
fate-mapchan-3ch-extract-ch0-ch2-trailing: CMD = md5 -i $(TARGET_PATH)/tests/data/asynth-44100-3.wav -map_channel 0.0.0 -map_channel 0.0.2? -fflags +bitexact -f wav
@@ -23,25 +23,25 @@ FATE_MAPCHAN = $(FATE_MAPCHAN-yes)
FATE_FFMPEG += $(FATE_MAPCHAN)
fate-mapchan: $(FATE_MAPCHAN)
-FATE_FFMPEG-$(CONFIG_COLOR_FILTER) += fate-ffmpeg-filter_complex
+FATE_FFMPEG-$(call FILTERFRAMECRC, COLOR) += fate-ffmpeg-filter_complex
fate-ffmpeg-filter_complex: CMD = framecrc -filter_complex color=d=1:r=5 -fflags +bitexact
# Ticket 6603
-FATE_FFMPEG-$(call ALLYES, AEVALSRC_FILTER ASETNSAMPLES_FILTER AC3_FIXED_ENCODER) += fate-ffmpeg-filter_complex_audio
+FATE_FFMPEG-$(call FILTERFRAMECRC, AEVALSRC ASETNSAMPLES ARESAMPLE, AC3_FIXED_ENCODER) += fate-ffmpeg-filter_complex_audio
fate-ffmpeg-filter_complex_audio: CMD = framecrc -auto_conversion_filters -filter_complex "aevalsrc=0:d=0.1,asetnsamples=1537" -c ac3_fixed
# Ticket 6375, use case of NoX
-FATE_SAMPLES_FFMPEG-$(call ALLYES, MOV_DEMUXER PNG_DECODER ALAC_DECODER PCM_S16LE_ENCODER RAWVIDEO_ENCODER) += fate-ffmpeg-attached_pics
-fate-ffmpeg-attached_pics: CMD = threads=2 framecrc -i $(TARGET_SAMPLES)/lossless-audio/inside.m4a -c:a pcm_s16le -threads 1 -max_muxing_queue_size 16 -af aresample
+FATE_SAMPLES_FFMPEG-$(call FRAMECRC, MOV, PNG ALAC, ARESAMPLE_FILTER) += fate-ffmpeg-attached_pics
+fate-ffmpeg-attached_pics: CMD = threads=2 framecrc -i $(TARGET_SAMPLES)/lossless-audio/inside.m4a -threads 1 -max_muxing_queue_size 16 -af aresample
-FATE_SAMPLES_FFMPEG-$(CONFIG_COLORKEY_FILTER) += fate-ffmpeg-filter_colorkey
+FATE_SAMPLES_FFMPEG-$(call FILTERDEMDEC, COLORKEY OVERLAY SCALE, MPEGPS IMAGE_PPM_PIPE, CAVS PPM, CAVSVIDEO_PARSER) += fate-ffmpeg-filter_colorkey
fate-ffmpeg-filter_colorkey: tests/data/filtergraphs/colorkey
fate-ffmpeg-filter_colorkey: CMD = framecrc -auto_conversion_filters -idct simple -fflags +bitexact -flags +bitexact -sws_flags +accurate_rnd+bitexact -i $(TARGET_SAMPLES)/cavs/cavs.mpg -fflags +bitexact -flags +bitexact -sws_flags +accurate_rnd+bitexact -i $(TARGET_SAMPLES)/lena.pnm -an -filter_complex_script $(TARGET_PATH)/tests/data/filtergraphs/colorkey -sws_flags +accurate_rnd+bitexact -fflags +bitexact -flags +bitexact -qscale 2 -frames:v 10
-FATE_FFMPEG-$(CONFIG_COLOR_FILTER) += fate-ffmpeg-lavfi
+FATE_FFMPEG-$(call FILTERFRAMECRC, COLOR) += fate-ffmpeg-lavfi
fate-ffmpeg-lavfi: CMD = framecrc -lavfi color=d=1:r=5 -fflags +bitexact
-FATE_SAMPLES_FFMPEG-$(CONFIG_RAWVIDEO_DEMUXER) += fate-force_key_frames
+FATE_SAMPLES_FFMPEG-$(call ENCDEC2, MPEG4, RAWVIDEO, AVI, RAWVIDEO_DEMUXER FRAMECRC_MUXER) += fate-force_key_frames
fate-force_key_frames: tests/data/vsynth_lena.yuv
fate-force_key_frames: CMD = enc_dec \
"rawvideo -s 352x288 -pix_fmt yuv420p" tests/data/vsynth_lena.yuv \
@@ -51,10 +51,10 @@ fate-force_key_frames: CMD = enc_dec \
# Tests that the video is properly autorotated using the contained
# display matrix and that the generated file does not contain
# a display matrix any more.
-FATE_SAMPLES_FFMPEG_FFPROBE-$(call ALLYES, FILE_PROTOCOL MOV_DEMUXER H264_DECODER AAC_FIXED_DECODER MPEG2VIDEO_ENCODER AC3_FIXED_ENCODER MOV_MUXER MPEG2VIDEO_DECODER EXTRACT_EXTRADATA_BSF PIPE_PROTOCOL FRAMECRC_MUXER) += fate-autorotate
+FATE_SAMPLES_FFMPEG_FFPROBE-$(call TRANSCODE, MPEG2VIDEO, MOV, H264_DECODER AAC_FIXED_DECODER AC3_FIXED_ENCODER EXTRACT_EXTRADATA_BSF) += fate-autorotate
fate-autorotate: CMD = transcode "mov -c:a aac_fixed" $(TARGET_SAMPLES)/filter/sample-in-issue-505.mov mov "-c:v mpeg2video -c:a ac3_fixed" "-c copy -t 0.5" "-show_entries stream_side_data_list"
-FATE_SAMPLES_FFMPEG-$(call ALLYES, VOBSUB_DEMUXER DVDSUB_DECODER AVFILTER OVERLAY_FILTER DVDSUB_ENCODER) += fate-sub2video
+FATE_SAMPLES_FFMPEG-$(call FILTERDEMDEC, OVERLAY SCALE, RAWVIDEO VOBSUB, RAWVIDEO DVDSUB, DVDSUB_ENCODER) += fate-sub2video
fate-sub2video: tests/data/vsynth_lena.yuv
fate-sub2video: CMD = framecrc -auto_conversion_filters \
-f rawvideo -r 5 -s 352x288 -pix_fmt yuv420p -i $(TARGET_PATH)/tests/data/vsynth_lena.yuv \
@@ -64,7 +64,7 @@ fate-sub2video: CMD = framecrc -auto_conversion_filters \
# Very basic sub2video example, decode and convert to AVFrame with sub2video.
# Attempt to not touch timestamps.
-FATE_SAMPLES_FFMPEG-$(call ALLYES, VOBSUB_DEMUXER DVDSUB_DECODER AVFILTER) += fate-sub2video_basic
+FATE_SAMPLES_FFMPEG-$(call FRAMECRC, VOBSUB, DVDSUB, SCALE_FILTER) += fate-sub2video_basic
fate-sub2video_basic: CMD = framecrc -auto_conversion_filters \
-i $(TARGET_SAMPLES)/sub/vobsub.idx \
-vsync passthrough -copyts \
@@ -73,7 +73,7 @@ fate-sub2video_basic: CMD = framecrc -auto_conversion_filters \
# Time-limited run with a sample that doesn't require seeking and
# contains samples within the initial period.
-FATE_SAMPLES_FFMPEG-$(call ALLYES, SUP_DEMUXER PGSSUB_DECODER AVFILTER) += fate-sub2video_time_limited
+FATE_SAMPLES_FFMPEG-$(call FRAMECRC, SUP, PGSSUB, SCALE_FILTER RAWVIDEO_ENCODER) += fate-sub2video_time_limited
fate-sub2video_time_limited: CMD = framecrc -auto_conversion_filters \
-i $(TARGET_SAMPLES)/sub/pgs_sub.sup \
-vsync passthrough -copyts \
@@ -81,79 +81,70 @@ fate-sub2video_time_limited: CMD = framecrc -auto_conversion_filters \
-filter_complex "sws_flags=+accurate_rnd+bitexact\;[0:s:0]scale" \
-c:v rawvideo -threads 1
-FATE_FFMPEG-$(call ALLYES, PCM_S16LE_DEMUXER PCM_S16LE_MUXER PCM_S16LE_DECODER PCM_S16LE_ENCODER) += fate-unknown_layout-pcm
+FATE_FFMPEG-$(call ENCDEC, PCM_S16LE, PCM_S16LE) += fate-unknown_layout-pcm
fate-unknown_layout-pcm: $(AREF)
fate-unknown_layout-pcm: CMD = md5 \
-guess_layout_max 0 -f s16le -ac 1 -ar 44100 -i $(TARGET_PATH)/$(AREF) -f s16le
-FATE_FFMPEG-$(call ALLYES, PCM_S16LE_DEMUXER AC3_MUXER PCM_S16LE_DECODER AC3_FIXED_ENCODER) += fate-unknown_layout-ac3
+FATE_FFMPEG-$(call FILTERDEMDECENCMUX, ARESAMPLE, PCM_S32LE, PCM_S32LE, AC3_FIXED, AC3) += fate-unknown_layout-ac3
fate-unknown_layout-ac3: $(AREF)
fate-unknown_layout-ac3: CMD = md5 -auto_conversion_filters \
-guess_layout_max 0 -f s32le -ac 1 -ar 44100 -i $(TARGET_PATH)/$(AREF) \
-f ac3 -flags +bitexact -c ac3_fixed
-FATE_SAMPLES_FFMPEG-$(call ALLYES, FILE_PROTOCOL LAVFI_INDEV RAWVIDEO_DEMUXER \
- SINE_FILTER PCM_S16LE_DECODER RAWVIDEO_DECODER \
- ARESAMPLE_FILTER AMIX_FILTER MPEG4_ENCODER \
- AC3_FIXED_ENCODER FRAMECRC_MUXER PIPE_PROTOCOL) \
+FATE_SAMPLES_FFMPEG-$(call FILTERDEMDEC, AMIX ARESAMPLE SINE, RAWVIDEO, \
+ PCM_S16LE RAWVIDEO, LAVFI_INDEV \
+ MPEG4_ENCODER AC3_FIXED_ENCODER) \
+= fate-shortest
fate-shortest: tests/data/vsynth_lena.yuv
fate-shortest: CMD = framecrc -auto_conversion_filters -f lavfi -i "sine=3000:d=10" -f lavfi -i "sine=1000:d=1" -sws_flags +accurate_rnd+bitexact -fflags +bitexact -flags +bitexact -idct simple -f rawvideo -s 352x288 -pix_fmt yuv420p -i $(TARGET_PATH)/tests/data/vsynth_lena.yuv -filter_complex "[0:a:0][1:a:0]amix=inputs=2[audio]" -map 2:v:0 -map "[audio]" -sws_flags +accurate_rnd+bitexact -fflags +bitexact -flags +bitexact -idct simple -dct fastint -qscale 10 -threads 1 -c:v mpeg4 -c:a ac3_fixed -shortest
# Basic test for fix_sub_duration, which calculates duration based on the
# following subtitle's pts.
-FATE_SAMPLES_FFMPEG-$(call ALLYES, LAVFI_INDEV MOVIE_FILTER FILE_PROTOCOL \
- PIPE_PROTOCOL MPEGVIDEO_DEMUXER \
- MPEG2VIDEO_DECODER CCAPTION_DECODER \
- SUBRIP_ENCODER SRT_MUXER) \
+FATE_SAMPLES_FFMPEG-$(call FILTERDEMDECENCMUX, MOVIE, MPEGVIDEO, \
+ MPEG2VIDEO, SUBRIP, SRT, LAVFI_INDEV \
+ MPEGVIDEO_PARSER CCAPTION_DECODER PIPE_PROTOCOL) \
+= fate-ffmpeg-fix_sub_duration
fate-ffmpeg-fix_sub_duration: CMD = fmtstdout srt -fix_sub_duration \
-real_time 1 -f lavfi \
-i "movie=$(TARGET_SAMPLES)/sub/Closedcaption_rollup.m2v[out0+subcc]"
-FATE_STREAMCOPY-$(call ALLYES, EAC3_DEMUXER MOV_MUXER) += fate-copy-trac3074
-fate-copy-trac3074: $(SAMPLES)/eac3/csi_miami_stereo_128_spx.eac3
+FATE_STREAMCOPY-$(call REMUX, MP4 MOV, EAC3_DEMUXER) += fate-copy-trac3074
fate-copy-trac3074: CMD = transcode eac3 $(TARGET_SAMPLES)/eac3/csi_miami_stereo_128_spx.eac3\
mp4 "-codec copy -map 0" "-codec copy"
-FATE_STREAMCOPY-$(call ALLYES, MOV_DEMUXER MOV_MUXER) += fate-copy-trac236
-fate-copy-trac236: $(SAMPLES)/mov/fcp_export8-236.mov
+FATE_STREAMCOPY-$(call TRANSCODE, RAWVIDEO DVVIDEO, MOV, PCM_S16LE_DECODER) += fate-copy-trac236
fate-copy-trac236: CMD = transcode mov $(TARGET_SAMPLES)/mov/fcp_export8-236.mov\
mov "-codec copy -map 0"
-FATE_STREAMCOPY-$(call ALLYES, MPEGTS_DEMUXER MXF_MUXER PCM_S16LE_ENCODER) += fate-copy-trac4914
-fate-copy-trac4914: $(SAMPLES)/mpeg2/xdcam8mp2-1s_small.ts
+FATE_STREAMCOPY-$(call TRANSCODE, RAWVIDEO MPEG2VIDEO, MXF, MPEGTS_DEMUXER MPEGVIDEO_PARSER MPEGAUDIO_PARSER MP2_DECODER ARESAMPLE_FILTER PCM_S16LE_DECODER) += fate-copy-trac4914
fate-copy-trac4914: CMD = transcode mpegts $(TARGET_SAMPLES)/mpeg2/xdcam8mp2-1s_small.ts\
mxf "-c:a pcm_s16le -af aresample -c:v copy"
-FATE_STREAMCOPY-$(call ALLYES, MPEGTS_DEMUXER AVI_MUXER) += fate-copy-trac4914-avi
-fate-copy-trac4914-avi: $(SAMPLES)/mpeg2/xdcam8mp2-1s_small.ts
+FATE_STREAMCOPY-$(call TRANSCODE, RAWVIDEO MPEG2VIDEO, AVI, MPEGTS_DEMUXER MPEGVIDEO_PARSER MPEGAUDIO_PARSER EXTRACT_EXTRADATA_BSF MP2_DECODER ARESAMPLE_FILTER) += fate-copy-trac4914-avi
fate-copy-trac4914-avi: CMD = transcode mpegts $(TARGET_SAMPLES)/mpeg2/xdcam8mp2-1s_small.ts\
avi "-c:a copy -c:v copy" "-af aresample"
-FATE_STREAMCOPY-$(call ALLYES, H264_DEMUXER AVI_MUXER) += fate-copy-trac2211-avi
-fate-copy-trac2211-avi: $(SAMPLES)/h264/bbc2.sample.h264
+FATE_STREAMCOPY-$(call TRANSCODE, RAWVIDEO H264, AVI, H264_DEMUXER H264_PARSER EXTRACT_EXTRADATA_BSF) += fate-copy-trac2211-avi
fate-copy-trac2211-avi: CMD = transcode "h264 -r 14" $(TARGET_SAMPLES)/h264/bbc2.sample.h264\
- avi "-c:a copy -c:v copy"
+ avi "-c:v copy"
-FATE_STREAMCOPY-$(call ENCDEC, APNG, APNG) += fate-copy-apng
+ifneq (,$(filter fate-lavf-apng,$(FATE_LAVF_VIDEO)))
+FATE_STREAMCOPY-$(call TRANSCODE, RAWVIDEO APNG, APNG) += fate-copy-apng
+endif
fate-copy-apng: fate-lavf-apng
fate-lavf-apng: KEEP_FILES ?= 1
fate-copy-apng: CMD = transcode apng tests/data/lavf/lavf.apng apng "-c:v copy"
FATE_STREAMCOPY-$(call DEMMUX, OGG, OGG) += fate-limited_input_seek fate-limited_input_seek-copyts
-fate-limited_input_seek: $(SAMPLES)/vorbis/moog_small.ogg
fate-limited_input_seek: CMD = md5 -ss 1.5 -t 1.3 -i $(TARGET_SAMPLES)/vorbis/moog_small.ogg -c:a copy -fflags +bitexact -f ogg
-fate-limited_input_seek-copyts: $(SAMPLES)/vorbis/moog_small.ogg
fate-limited_input_seek-copyts: CMD = md5 -ss 1.5 -t 1.3 -i $(TARGET_SAMPLES)/vorbis/moog_small.ogg -c:a copy -copyts -fflags +bitexact -f ogg
-FATE_STREAMCOPY-$(call ALLYES, MOV_DEMUXER MOV_MUXER) += fate-copy-psp
-fate-copy-psp: $(SAMPLES)/h264/wwwq_cut.mp4
+FATE_STREAMCOPY-$(call REMUX, PSP MOV, H264_PARSER H264_DECODER) += fate-copy-psp
fate-copy-psp: CMD = transcode "mov" $(TARGET_SAMPLES)/h264/wwwq_cut.mp4\
psp "-c copy" "-codec copy"
-FATE_STREAMCOPY-$(CONFIG_FLV_DEMUXER) += fate-ffmpeg-streamloop
-fate-ffmpeg-streamloop: $(SAMPLES)/flv/streamloop.flv
+FATE_STREAMCOPY-$(call FRAMEMD5, FLV, H264) += fate-ffmpeg-streamloop
fate-ffmpeg-streamloop: CMD = framemd5 -stream_loop 2 -i $(TARGET_SAMPLES)/flv/streamloop.flv -c copy
tests/data/audio_shorter_than_video.nut: TAG = GEN
@@ -165,65 +156,48 @@ tests/data/audio_shorter_than_video.nut: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
-sws_flags +accurate_rnd+bitexact -fflags +bitexact -flags +bitexact -idct simple -dct fastint -qscale 10 -c:v mpeg4 -threads 1 -c:a pcm_s16le -bitexact \
-y $(TARGET_PATH)/tests/data/audio_shorter_than_video.nut 2>/dev/null
-FATE_STREAMCOPY-$(call ALLYES, FILE_PROTOCOL RAWVIDEO_DEMUXER LAVFI_INDEV \
- RAWVIDEO_DECODER PCM_S16LE_DECODER MPEG4_ENCODER \
- PCM_S16LE_ENCODER SINE_FILTER NUT_DEMUXER \
- MPEG4_DECODER ARESAMPLE_FILTER AMIX_FILTER \
- NUT_MUXER AC3_FIXED_ENCODER PIPE_PROTOCOL) \
- += fate-copy-shortest1
-fate-copy-shortest1: tests/data/audio_shorter_than_video.nut
+FATE_STREAMCOPY-$(call FRAMEMD5, NUT, RAWVIDEO PCM_S16LE MPEG4, \
+ RAWVIDEO_DEMUXER LAVFI_INDEV \
+ MPEG4_ENCODER PCM_S16LE_ENCODER \
+ SINE_FILTER ARESAMPLE_FILTER AMIX_FILTER \
+ NUT_MUXER AC3_FIXED_ENCODER) \
+ += fate-copy-shortest1 fate-copy-shortest2
+fate-copy-shortest1 fate-copy-shortest2: tests/data/audio_shorter_than_video.nut
fate-copy-shortest1: CMD = framemd5 -auto_conversion_filters -fflags +bitexact -flags +bitexact -f lavfi -i "sine=3000:d=10" -f lavfi -i "sine=1000:d=1" -i $(TARGET_PATH)/tests/data/audio_shorter_than_video.nut -filter_complex "[0:a:0][1:a:0]amix=inputs=2[audio]" -map 2:v:0 -map "[audio]" -fflags +bitexact -flags +bitexact -c:v copy -c:a ac3_fixed -shortest
-
-FATE_STREAMCOPY-$(call ALLYES, FILE_PROTOCOL RAWVIDEO_DEMUXER LAVFI_INDEV \
- RAWVIDEO_DECODER PCM_S16LE_DECODER MPEG4_ENCODER \
- PCM_S16LE_ENCODER SINE_FILTER NUT_DEMUXER \
- MPEG4_DECODER ARESAMPLE_FILTER AMIX_FILTER \
- NUT_MUXER AC3_FIXED_ENCODER PIPE_PROTOCOL) \
- += fate-copy-shortest2
-fate-copy-shortest2: tests/data/audio_shorter_than_video.nut
fate-copy-shortest2: CMD = framemd5 -auto_conversion_filters -fflags +bitexact -flags +bitexact -f lavfi -i "sine=3000:d=10" -i $(TARGET_PATH)/tests/data/audio_shorter_than_video.nut -filter_complex "[0:a:0][1:a:0]amix=inputs=2[audio]" -map 1:v:0 -map "[audio]" -fflags +bitexact -flags +bitexact -c:v copy -c:a ac3_fixed -shortest
fate-streamcopy: $(FATE_STREAMCOPY-yes)
-FATE_SAMPLES_FFMPEG-$(call ALLYES, MOV_DEMUXER MATROSKA_MUXER) += fate-rgb24-mkv
-fate-rgb24-mkv: $(SAMPLES)/qtrle/aletrek-rle.mov
+FATE_SAMPLES_FFMPEG-$(call TRANSCODE, RAWVIDEO, MATROSKA, MOV_DEMUXER QTRLE_DECODER) += fate-rgb24-mkv
fate-rgb24-mkv: CMD = transcode "mov" $(TARGET_SAMPLES)/qtrle/aletrek-rle.mov\
matroska "-c:v rawvideo -threads 1 -pix_fmt rgb24 -allow_raw_vfw 1 -frames:v 1"
-FATE_SAMPLES_FFMPEG-$(call ALLYES, AAC_DEMUXER MOV_MUXER) += fate-adtstoasc_ticket3715
-fate-adtstoasc_ticket3715: $(SAMPLES)/aac/foo.aac
+FATE_SAMPLES_FFMPEG-$(call REMUX, MOV, AAC_DEMUXER AAC_DECODER AAC_PARSER AAC_ADTSTOASC_BSF) += fate-adtstoasc_ticket3715
fate-adtstoasc_ticket3715: CMD = transcode "aac" $(TARGET_SAMPLES)/aac/foo.aac\
mov "-c copy -bsf:a aac_adtstoasc" "-codec copy"
-FATE_SAMPLES_FFMPEG-$(call ALLYES, MOV_DEMUXER H264_MUXER H264_MP4TOANNEXB_BSF) += fate-h264_mp4toannexb_ticket2991
-fate-h264_mp4toannexb_ticket2991: $(SAMPLES)/h264/wwwq_cut.mp4
+FATE_SAMPLES_FFMPEG-$(call REMUX, H264, MOV_DEMUXER H264_MP4TOANNEXB_BSF H264_PARSER H264_DECODER EXTRACT_EXTRADATA_BSF) += fate-h264_mp4toannexb_ticket2991 fate-h264_mp4toannexb_ticket5927 fate-h264_mp4toannexb_ticket5927_2
fate-h264_mp4toannexb_ticket2991: CMD = transcode "mp4" $(TARGET_SAMPLES)/h264/wwwq_cut.mp4\
h264 "-c:v copy -bsf:v h264_mp4toannexb" "-codec copy"
-
-FATE_SAMPLES_FFMPEG-$(call ALLYES, MOV_DEMUXER H264_MUXER H264_MP4TOANNEXB_BSF) += fate-h264_mp4toannexb_ticket5927 fate-h264_mp4toannexb_ticket5927_2
fate-h264_mp4toannexb_ticket5927: CMD = transcode "mp4" $(TARGET_SAMPLES)/h264/thezerotheorem-cut.mp4 \
h264 "-c:v copy -bsf:v h264_mp4toannexb -an" "-c:v copy"
fate-h264_mp4toannexb_ticket5927_2: CMD = transcode "mp4" $(TARGET_SAMPLES)/h264/thezerotheorem-cut.mp4 \
h264 "-c:v copy -an" "-c:v copy"
-FATE_SAMPLES_FFMPEG-$(call ALLYES, MPEGPS_DEMUXER AVI_MUXER REMOVE_EXTRADATA_BSF) += fate-ffmpeg-bsf-remove-k fate-ffmpeg-bsf-remove-r fate-ffmpeg-bsf-remove-e
-fate-ffmpeg-bsf-remove-k: $(SAMPLES)/mpeg2/matrixbench_mpeg2.lq1.mpg
+FATE_SAMPLES_FFMPEG-$(call TRANSCODE, MPEG4 MPEG2VIDEO, AVI, MPEGPS_DEMUXER MPEGVIDEO_DEMUXER MPEGVIDEO_PARSER EXTRACT_EXTRADATA_BSF REMOVE_EXTRADATA_BSF) += fate-ffmpeg-bsf-remove-k fate-ffmpeg-bsf-remove-r fate-ffmpeg-bsf-remove-e
fate-ffmpeg-bsf-remove-k: CMD = transcode "mpeg" $(TARGET_SAMPLES)/mpeg2/matrixbench_mpeg2.lq1.mpg\
avi "-vbsf remove_extra=k" "-codec copy"
-fate-ffmpeg-bsf-remove-r: $(SAMPLES)/mpeg2/matrixbench_mpeg2.lq1.mpg
fate-ffmpeg-bsf-remove-r: CMD = transcode "mpeg" $(TARGET_SAMPLES)/mpeg2/matrixbench_mpeg2.lq1.mpg\
avi "-vbsf remove_extra=keyframe" "-codec copy"
-fate-ffmpeg-bsf-remove-e: $(SAMPLES)/mpeg2/matrixbench_mpeg2.lq1.mpg
fate-ffmpeg-bsf-remove-e: CMD = transcode "mpeg" $(TARGET_SAMPLES)/mpeg2/matrixbench_mpeg2.lq1.mpg\
avi "-vbsf remove_extra=e" "-codec copy"
-FATE_SAMPLES_FFMPEG-$(call ALLYES, APNG_DEMUXER SETTS_BSF) += fate-ffmpeg-setts-bsf
+FATE_SAMPLES_FFMPEG-$(call DEMMUX, APNG, FRAMECRC, SETTS_BSF PIPE_PROTOCOL) += fate-ffmpeg-setts-bsf
fate-ffmpeg-setts-bsf: CMD = framecrc -i $(TARGET_SAMPLES)/apng/clock.png -c:v copy -bsf:v "setts=duration=if(eq(NEXT_PTS\,NOPTS)\,PREV_OUTDURATION\,(NEXT_PTS-PTS)/2):ts=PTS/2" -fflags +bitexact
FATE_SAMPLES_FFMPEG-yes += $(FATE_STREAMCOPY-yes)
-FATE_TIME_BASE-$(call ALLYES, MPEGPS_DEMUXER MXF_MUXER) += fate-time_base
-fate-time_base: $(SAMPLES)/mpeg2/dvd_single_frame.vob
+FATE_TIME_BASE-$(call PARSERDEMDEC, MPEGVIDEO, MPEGPS, MPEG2VIDEO, MPEGVIDEO_DEMUXER MXF_MUXER) += fate-time_base
fate-time_base: CMD = md5 -i $(TARGET_SAMPLES)/mpeg2/dvd_single_frame.vob -an -sn -c:v copy -r 25 -time_base 1001:30000 -fflags +bitexact -f mxf
FATE_SAMPLES_FFMPEG-yes += $(FATE_TIME_BASE-yes)
1
0
28 May '22
ffmpeg | branch: master | Martin Storsjö <martin(a)martin.st> | Thu May 26 00:31:05 2022 +0300| [9fba0b8a8c754a012fc74c90ffb7c26a56be8ca0] | committer: Martin Storsjö
mfenc: Use dlopen instead of LoadLibrary for loading mfplat.dll
The dlopen wrapper contains code to make loading libraries safer,
to avoid loading a potentially malicious DLL with the same name.
Signed-off-by: Martin Storsjö <martin(a)martin.st>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9fba0b8a8c754a012…
---
libavcodec/mfenc.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libavcodec/mfenc.c b/libavcodec/mfenc.c
index 17d0ec60bd..13ed7b3e11 100644
--- a/libavcodec/mfenc.c
+++ b/libavcodec/mfenc.c
@@ -29,6 +29,7 @@
#include "libavutil/time.h"
#include "codec_internal.h"
#include "internal.h"
+#include "compat/w32dlfcn.h"
typedef struct MFContext {
AVClass *av_class;
@@ -1131,7 +1132,7 @@ static int mf_init_encoder(AVCodecContext *avctx)
#if !HAVE_UWP
#define LOAD_MF_FUNCTION(context, func_name) \
- context->functions.func_name = (void *)GetProcAddress(context->library, #func_name); \
+ context->functions.func_name = (void *)dlsym(context->library, #func_name); \
if (!context->functions.func_name) { \
av_log(context, AV_LOG_ERROR, "DLL mfplat.dll failed to find function "\
#func_name "\n"); \
@@ -1158,7 +1159,7 @@ static int mf_load_library(AVCodecContext *avctx)
MFContext *c = avctx->priv_data;
#if !HAVE_UWP
- c->library = LoadLibraryA("mfplat.dll");
+ c->library = dlopen("mfplat.dll", 0);
if (!c->library) {
av_log(c, AV_LOG_ERROR, "DLL mfplat.dll failed to open\n");
@@ -1191,7 +1192,7 @@ static int mf_close(AVCodecContext *avctx)
if (c->library)
ff_free_mf(&c->functions, &c->mft);
- FreeLibrary(c->library);
+ dlclose(c->library);
c->library = NULL;
#else
ff_free_mf(&c->functions, &c->mft);
1
0
ffmpeg | branch: master | Swinney, Jonathan <jswinney(a)amazon.com> | Thu May 26 02:02:13 2022 +0000| [0ea61725b1bd35f47d0ebc49597e73e6798c553d] | committer: Martin Storsjö
swscale/aarch64: add hscale specializations
This patch adds code to support specializations of the hscale function
and adds a specialization for filterSize == 4.
ff_hscale8to15_4_neon is a complete rewrite. Since the main bottleneck
here is loading the data from src, this data is loaded a whole block
ahead and stored back to the stack to be loaded again with ld4. This
arranges the data for most efficient use of the vector instructions and
removes the need for completion adds at the end. The number of
iterations of the C per iteration of the assembly is increased from 4 to
8, but because of the prefetching, there must be a special section
without prefetching when dstW < 16.
This improves speed on Graviton 2 (Neoverse N1) dramatically in the case
where previously fs=8 would have been required.
before: hscale_8_to_15__fs_8_dstW_512_neon: 1962.8
after : hscale_8_to_15__fs_4_dstW_512_neon: 1220.9
Signed-off-by: Jonathan Swinney <jswinney(a)amazon.com>
Signed-off-by: Martin Storsjö <martin(a)martin.st>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0ea61725b1bd35f47…
---
libswscale/aarch64/hscale.S | 172 ++++++++++++++++++++++++++++++++++++++++++-
libswscale/aarch64/swscale.c | 39 +++++++---
libswscale/utils.c | 2 +-
3 files changed, 202 insertions(+), 11 deletions(-)
diff --git a/libswscale/aarch64/hscale.S b/libswscale/aarch64/hscale.S
index da34f1cb8d..b7b21b7a0f 100644
--- a/libswscale/aarch64/hscale.S
+++ b/libswscale/aarch64/hscale.S
@@ -1,5 +1,7 @@
/*
* Copyright (c) 2016 Clément Bœsch <clement stupeflix.com>
+ * Copyright (c) 2019-2021 Sebastian Pop <spop(a)amazon.com>
+ * Copyright (c) 2022 Jonathan Swinney <jswinney(a)amazon.com>
*
* This file is part of FFmpeg.
*
@@ -20,7 +22,25 @@
#include "libavutil/aarch64/asm.S"
-function ff_hscale_8_to_15_neon, export=1
+/*
+;-----------------------------------------------------------------------------
+; horizontal line scaling
+;
+; void hscale<source_width>to<intermediate_nbits>_<filterSize>_<opt>
+; (SwsContext *c, int{16,32}_t *dst,
+; int dstW, const uint{8,16}_t *src,
+; const int16_t *filter,
+; const int32_t *filterPos, int filterSize);
+;
+; Scale one horizontal line. Input is either 8-bit width or 16-bit width
+; ($source_width can be either 8, 9, 10 or 16, difference is whether we have to
+; downscale before multiplying). Filter is 14 bits. Output is either 15 bits
+; (in int16_t) or 19 bits (in int32_t), as given in $intermediate_nbits. Each
+; output pixel is generated from $filterSize input pixels, the position of
+; the first pixel is given in filterPos[nOutputPixel].
+;----------------------------------------------------------------------------- */
+
+function ff_hscale8to15_X8_neon, export=1
sbfiz x7, x6, #1, #32 // filterSize*2 (*2 because int16)
1: ldr w8, [x5], #4 // filterPos[idx]
ldr w0, [x5], #4 // filterPos[idx + 1]
@@ -70,3 +90,153 @@ function ff_hscale_8_to_15_neon, export=1
b.gt 1b // loop until end of line
ret
endfunc
+
+function ff_hscale8to15_4_neon, export=1
+// x0 SwsContext *c (not used)
+// x1 int16_t *dst
+// x2 int dstW
+// x3 const uint8_t *src
+// x4 const int16_t *filter
+// x5 const int32_t *filterPos
+// x6 int filterSize
+// x8-x15 registers for gathering src data
+
+// v0 madd accumulator 4S
+// v1-v4 filter values (16 bit) 8H
+// v5 madd accumulator 4S
+// v16-v19 src values (8 bit) 8B
+
+// This implementation has 4 sections:
+// 1. Prefetch src data
+// 2. Interleaved prefetching src data and madd
+// 3. Complete madd
+// 4. Complete remaining iterations when dstW % 8 != 0
+
+ sub sp, sp, #32 // allocate 32 bytes on the stack
+ cmp w2, #16 // if dstW <16, skip to the last block used for wrapping up
+ b.lt 2f
+
+ // load 8 values from filterPos to be used as offsets into src
+ ldp w8, w9, [x5] // filterPos[idx + 0], [idx + 1]
+ ldp w10, w11, [x5, #8] // filterPos[idx + 2], [idx + 3]
+ ldp w12, w13, [x5, #16] // filterPos[idx + 4], [idx + 5]
+ ldp w14, w15, [x5, #24] // filterPos[idx + 6], [idx + 7]
+ add x5, x5, #32 // advance filterPos
+
+ // gather random access data from src into contiguous memory
+ ldr w8, [x3, w8, UXTW] // src[filterPos[idx + 0]][0..3]
+ ldr w9, [x3, w9, UXTW] // src[filterPos[idx + 1]][0..3]
+ ldr w10, [x3, w10, UXTW] // src[filterPos[idx + 2]][0..3]
+ ldr w11, [x3, w11, UXTW] // src[filterPos[idx + 3]][0..3]
+ ldr w12, [x3, w12, UXTW] // src[filterPos[idx + 4]][0..3]
+ ldr w13, [x3, w13, UXTW] // src[filterPos[idx + 5]][0..3]
+ ldr w14, [x3, w14, UXTW] // src[filterPos[idx + 6]][0..3]
+ ldr w15, [x3, w15, UXTW] // src[filterPos[idx + 7]][0..3]
+ stp w8, w9, [sp] // *scratch_mem = { src[filterPos[idx + 0]][0..3], src[filterPos[idx + 1]][0..3] }
+ stp w10, w11, [sp, #8] // *scratch_mem = { src[filterPos[idx + 2]][0..3], src[filterPos[idx + 3]][0..3] }
+ stp w12, w13, [sp, #16] // *scratch_mem = { src[filterPos[idx + 4]][0..3], src[filterPos[idx + 5]][0..3] }
+ stp w14, w15, [sp, #24] // *scratch_mem = { src[filterPos[idx + 6]][0..3], src[filterPos[idx + 7]][0..3] }
+
+1:
+ ld4 {v16.8B, v17.8B, v18.8B, v19.8B}, [sp] // transpose 8 bytes each from src into 4 registers
+
+ // load 8 values from filterPos to be used as offsets into src
+ ldp w8, w9, [x5] // filterPos[idx + 0][0..3], [idx + 1][0..3], next iteration
+ ldp w10, w11, [x5, #8] // filterPos[idx + 2][0..3], [idx + 3][0..3], next iteration
+ ldp w12, w13, [x5, #16] // filterPos[idx + 4][0..3], [idx + 5][0..3], next iteration
+ ldp w14, w15, [x5, #24] // filterPos[idx + 6][0..3], [idx + 7][0..3], next iteration
+
+ movi v0.2D, #0 // Clear madd accumulator for idx 0..3
+ movi v5.2D, #0 // Clear madd accumulator for idx 4..7
+
+ ld4 {v1.8H, v2.8H, v3.8H, v4.8H}, [x4], #64 // load filter idx + 0..7
+
+ add x5, x5, #32 // advance filterPos
+
+ // interleaved SIMD and prefetching intended to keep ld/st and vector pipelines busy
+ uxtl v16.8H, v16.8B // unsigned extend long, covert src data to 16-bit
+ uxtl v17.8H, v17.8B // unsigned extend long, covert src data to 16-bit
+ ldr w8, [x3, w8, UXTW] // src[filterPos[idx + 0]], next iteration
+ ldr w9, [x3, w9, UXTW] // src[filterPos[idx + 1]], next iteration
+ uxtl v18.8H, v18.8B // unsigned extend long, covert src data to 16-bit
+ uxtl v19.8H, v19.8B // unsigned extend long, covert src data to 16-bit
+ ldr w10, [x3, w10, UXTW] // src[filterPos[idx + 2]], next iteration
+ ldr w11, [x3, w11, UXTW] // src[filterPos[idx + 3]], next iteration
+
+ smlal v0.4S, v1.4H, v16.4H // multiply accumulate inner loop j = 0, idx = 0..3
+ smlal v0.4S, v2.4H, v17.4H // multiply accumulate inner loop j = 1, idx = 0..3
+ ldr w12, [x3, w12, UXTW] // src[filterPos[idx + 4]], next iteration
+ ldr w13, [x3, w13, UXTW] // src[filterPos[idx + 5]], next iteration
+ smlal v0.4S, v3.4H, v18.4H // multiply accumulate inner loop j = 2, idx = 0..3
+ smlal v0.4S, v4.4H, v19.4H // multiply accumulate inner loop j = 3, idx = 0..3
+ ldr w14, [x3, w14, UXTW] // src[filterPos[idx + 6]], next iteration
+ ldr w15, [x3, w15, UXTW] // src[filterPos[idx + 7]], next iteration
+
+ smlal2 v5.4S, v1.8H, v16.8H // multiply accumulate inner loop j = 0, idx = 4..7
+ smlal2 v5.4S, v2.8H, v17.8H // multiply accumulate inner loop j = 1, idx = 4..7
+ stp w8, w9, [sp] // *scratch_mem = { src[filterPos[idx + 0]][0..3], src[filterPos[idx + 1]][0..3] }
+ stp w10, w11, [sp, #8] // *scratch_mem = { src[filterPos[idx + 2]][0..3], src[filterPos[idx + 3]][0..3] }
+ smlal2 v5.4S, v3.8H, v18.8H // multiply accumulate inner loop j = 2, idx = 4..7
+ smlal2 v5.4S, v4.8H, v19.8H // multiply accumulate inner loop j = 3, idx = 4..7
+ stp w12, w13, [sp, #16] // *scratch_mem = { src[filterPos[idx + 4]][0..3], src[filterPos[idx + 5]][0..3] }
+ stp w14, w15, [sp, #24] // *scratch_mem = { src[filterPos[idx + 6]][0..3], src[filterPos[idx + 7]][0..3] }
+
+ sub w2, w2, #8 // dstW -= 8
+ sqshrn v0.4H, v0.4S, #7 // shift and clip the 2x16-bit final values
+ sqshrn v1.4H, v5.4S, #7 // shift and clip the 2x16-bit final values
+ st1 {v0.4H, v1.4H}, [x1], #16 // write to dst[idx + 0..7]
+ cmp w2, #16 // continue on main loop if there are at least 16 iterations left
+ b.ge 1b
+
+ // last full iteration
+ ld4 {v16.8B, v17.8B, v18.8B, v19.8B}, [sp]
+ ld4 {v1.8H, v2.8H, v3.8H, v4.8H}, [x4], #64 // load filter idx + 0..7
+
+ movi v0.2D, #0 // Clear madd accumulator for idx 0..3
+ movi v5.2D, #0 // Clear madd accumulator for idx 4..7
+
+ uxtl v16.8H, v16.8B // unsigned extend long, covert src data to 16-bit
+ uxtl v17.8H, v17.8B // unsigned extend long, covert src data to 16-bit
+ uxtl v18.8H, v18.8B // unsigned extend long, covert src data to 16-bit
+ uxtl v19.8H, v19.8B // unsigned extend long, covert src data to 16-bit
+
+ smlal v0.4S, v1.4H, v16.4H // multiply accumulate inner loop j = 0, idx = 0..3
+ smlal v0.4S, v2.4H, v17.4H // multiply accumulate inner loop j = 1, idx = 0..3
+ smlal v0.4S, v3.4H, v18.4H // multiply accumulate inner loop j = 2, idx = 0..3
+ smlal v0.4S, v4.4H, v19.4H // multiply accumulate inner loop j = 3, idx = 0..3
+
+ smlal2 v5.4S, v1.8H, v16.8H // multiply accumulate inner loop j = 0, idx = 4..7
+ smlal2 v5.4S, v2.8H, v17.8H // multiply accumulate inner loop j = 1, idx = 4..7
+ smlal2 v5.4S, v3.8H, v18.8H // multiply accumulate inner loop j = 2, idx = 4..7
+ smlal2 v5.4S, v4.8H, v19.8H // multiply accumulate inner loop j = 3, idx = 4..7
+
+ subs w2, w2, #8 // dstW -= 8
+ sqshrn v0.4H, v0.4S, #7 // shift and clip the 2x16-bit final values
+ sqshrn v1.4H, v5.4S, #7 // shift and clip the 2x16-bit final values
+ st1 {v0.4H, v1.4H}, [x1], #16 // write to dst[idx + 0..7]
+
+ cbnz w2, 2f // if >0 iterations remain, jump to the wrap up section
+
+ add sp, sp, #32 // clean up stack
+ ret
+
+ // finish up when dstW % 8 != 0 or dstW < 16
+2:
+ // load src
+ ldr w8, [x5], #4 // filterPos[i]
+ add x9, x3, w8, UXTW // calculate the address for src load
+ ld1 {v5.S}[0], [x9] // src[filterPos[i] + 0..3]
+ // load filter
+ ld1 {v6.4H}, [x4], #8 // filter[filterSize * i + 0..3]
+
+ uxtl v5.8H, v5.8B // unsigned exten long, convert src data to 16-bit
+ smull v0.4S, v5.4H, v6.4H // 4 iterations of src[...] * filter[...]
+ addv s0, v0.4S // add up products of src and filter values
+ sqshrn h0, s0, #7 // shift and clip the 2x16-bit final value
+ st1 {v0.H}[0], [x1], #2 // dst[i] = ...
+ sub w2, w2, #1 // dstW--
+ cbnz w2, 2b
+
+ add sp, sp, #32 // clean up stack
+ ret
+endfunc
diff --git a/libswscale/aarch64/swscale.c b/libswscale/aarch64/swscale.c
index 09d0a7130e..ab28be4da6 100644
--- a/libswscale/aarch64/swscale.c
+++ b/libswscale/aarch64/swscale.c
@@ -22,25 +22,46 @@
#include "libswscale/swscale_internal.h"
#include "libavutil/aarch64/cpu.h"
-void ff_hscale_8_to_15_neon(SwsContext *c, int16_t *dst, int dstW,
- const uint8_t *src, const int16_t *filter,
- const int32_t *filterPos, int filterSize);
+#define SCALE_FUNC(filter_n, from_bpc, to_bpc, opt) \
+void ff_hscale ## from_bpc ## to ## to_bpc ## _ ## filter_n ## _ ## opt( \
+ SwsContext *c, int16_t *data, \
+ int dstW, const uint8_t *src, \
+ const int16_t *filter, \
+ const int32_t *filterPos, int filterSize)
+#define SCALE_FUNCS(filter_n, opt) \
+ SCALE_FUNC(filter_n, 8, 15, opt);
+#define ALL_SCALE_FUNCS(opt) \
+ SCALE_FUNCS(4, opt); \
+ SCALE_FUNCS(X8, opt)
+
+ALL_SCALE_FUNCS(neon);
void ff_yuv2planeX_8_neon(const int16_t *filter, int filterSize,
const int16_t **src, uint8_t *dest, int dstW,
const uint8_t *dither, int offset);
+#define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt) do { \
+ if (c->srcBpc == 8 && c->dstBpc <= 14) { \
+ hscalefn = \
+ ff_hscale8to15_ ## filtersize ## _ ## opt; \
+ } \
+} while (0)
+
+#define ASSIGN_SCALE_FUNC(hscalefn, filtersize, opt) \
+ switch (filtersize) { \
+ case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt); break; \
+ default: if (filtersize % 8 == 0) \
+ ASSIGN_SCALE_FUNC2(hscalefn, X8, opt); \
+ break; \
+ }
+
av_cold void ff_sws_init_swscale_aarch64(SwsContext *c)
{
int cpu_flags = av_get_cpu_flags();
if (have_neon(cpu_flags)) {
- if (c->srcBpc == 8 && c->dstBpc <= 14 &&
- (c->hLumFilterSize % 8) == 0 &&
- (c->hChrFilterSize % 8) == 0)
- {
- c->hyScale = c->hcScale = ff_hscale_8_to_15_neon;
- }
+ ASSIGN_SCALE_FUNC(c->hyScale, c->hLumFilterSize, neon);
+ ASSIGN_SCALE_FUNC(c->hcScale, c->hChrFilterSize, neon);
if (c->dstBpc == 8) {
c->yuv2planeX = ff_yuv2planeX_8_neon;
}
diff --git a/libswscale/utils.c b/libswscale/utils.c
index ffa130524a..105781c4f4 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -1820,7 +1820,7 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
{
const int filterAlign = X86_MMX(cpu_flags) ? 4 :
PPC_ALTIVEC(cpu_flags) ? 8 :
- have_neon(cpu_flags) ? 8 : 1;
+ have_neon(cpu_flags) ? 4 : 1;
if ((ret = initFilter(&c->hLumFilter, &c->hLumFilterPos,
&c->hLumFilterSize, c->lumXInc,
1
0
ffmpeg | branch: master | Swinney, Jonathan <jswinney(a)amazon.com> | Thu May 26 02:01:58 2022 +0000| [92ea8e03dfc17cc580e8c6e0fb1923a2c02f68aa] | committer: Martin Storsjö
checkasm: added additional dstW tests for hscale
Signed-off-by: Jonathan Swinney <jswinney(a)amazon.com>
Signed-off-by: Martin Storsjö <martin(a)martin.st>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=92ea8e03dfc17cc58…
---
tests/checkasm/sw_scale.c | 104 ++++++++++++++++++++++++----------------------
1 file changed, 55 insertions(+), 49 deletions(-)
diff --git a/tests/checkasm/sw_scale.c b/tests/checkasm/sw_scale.c
index 3c0a083b42..31d9a525e9 100644
--- a/tests/checkasm/sw_scale.c
+++ b/tests/checkasm/sw_scale.c
@@ -148,7 +148,11 @@ static void check_hscale(void)
{ 8, 18 },
};
- int i, j, fsi, hpi, width;
+#define LARGEST_INPUT_SIZE 512
+#define INPUT_SIZES 6
+ static const int input_sizes[INPUT_SIZES] = {8, 24, 128, 144, 256, 512};
+
+ int i, j, fsi, hpi, width, dstWi;
struct SwsContext *ctx;
// padded
@@ -178,57 +182,59 @@ static void check_hscale(void)
for (hpi = 0; hpi < HSCALE_PAIRS; hpi++) {
for (fsi = 0; fsi < FILTER_SIZES; fsi++) {
- width = filter_sizes[fsi];
-
- ctx->srcBpc = hscale_pairs[hpi][0];
- ctx->dstBpc = hscale_pairs[hpi][1];
- ctx->hLumFilterSize = ctx->hChrFilterSize = width;
- ctx->dstW = ctx->chrDstW = SRC_PIXELS;
-
- for (i = 0; i < SRC_PIXELS; i++) {
- filterPos[i] = i;
- filterPosAvx[i] = i;
-
- // These filter cofficients are chosen to try break two corner
- // cases, namely:
- //
- // - Negative filter coefficients. The filters output signed
- // values, and it should be possible to end up with negative
- // output values.
- //
- // - Positive clipping. The hscale filter function has clipping
- // at (1<<15) - 1
- //
- // The coefficients sum to the 1.0 point for the hscale
- // functions (1 << 14).
-
- for (j = 0; j < width; j++) {
- filter[i * width + j] = -((1 << 14) / (width - 1));
+ for (dstWi = 0; dstWi < INPUT_SIZES; dstWi++) {
+ width = filter_sizes[fsi];
+
+ ctx->srcBpc = hscale_pairs[hpi][0];
+ ctx->dstBpc = hscale_pairs[hpi][1];
+ ctx->hLumFilterSize = ctx->hChrFilterSize = width;
+
+ for (i = 0; i < SRC_PIXELS; i++) {
+ filterPos[i] = i;
+ filterPosAvx[i] = i;
+
+ // These filter cofficients are chosen to try break two corner
+ // cases, namely:
+ //
+ // - Negative filter coefficients. The filters output signed
+ // values, and it should be possible to end up with negative
+ // output values.
+ //
+ // - Positive clipping. The hscale filter function has clipping
+ // at (1<<15) - 1
+ //
+ // The coefficients sum to the 1.0 point for the hscale
+ // functions (1 << 14).
+
+ for (j = 0; j < width; j++) {
+ filter[i * width + j] = -((1 << 14) / (width - 1));
+ }
+ filter[i * width + (rnd() % width)] = ((1 << 15) - 1);
}
- filter[i * width + (rnd() % width)] = ((1 << 15) - 1);
- }
- for (i = 0; i < MAX_FILTER_WIDTH; i++) {
- // These values should be unused in SIMD implementations but
- // may still be read, random coefficients here should help show
- // issues where they are used in error.
+ for (i = 0; i < MAX_FILTER_WIDTH; i++) {
+ // These values should be unused in SIMD implementations but
+ // may still be read, random coefficients here should help show
+ // issues where they are used in error.
- filter[SRC_PIXELS * width + i] = rnd();
- }
- ff_sws_init_scale(ctx);
- memcpy(filterAvx2, filter, sizeof(uint16_t) * (SRC_PIXELS * MAX_FILTER_WIDTH + MAX_FILTER_WIDTH));
- if ((cpu_flags & AV_CPU_FLAG_AVX2) && !(cpu_flags & AV_CPU_FLAG_SLOW_GATHER))
- ff_shuffle_filter_coefficients(ctx, filterPosAvx, width, filterAvx2, SRC_PIXELS);
-
- if (check_func(ctx->hcScale, "hscale_%d_to_%d_width%d", ctx->srcBpc, ctx->dstBpc + 1, width)) {
- memset(dst0, 0, SRC_PIXELS * sizeof(dst0[0]));
- memset(dst1, 0, SRC_PIXELS * sizeof(dst1[0]));
-
- call_ref(NULL, dst0, SRC_PIXELS, src, filter, filterPos, width);
- call_new(NULL, dst1, SRC_PIXELS, src, filterAvx2, filterPosAvx, width);
- if (memcmp(dst0, dst1, SRC_PIXELS * sizeof(dst0[0])))
- fail();
- bench_new(NULL, dst0, SRC_PIXELS, src, filter, filterPosAvx, width);
+ filter[SRC_PIXELS * width + i] = rnd();
+ }
+ ctx->dstW = ctx->chrDstW = input_sizes[dstWi];
+ ff_sws_init_scale(ctx);
+ memcpy(filterAvx2, filter, sizeof(uint16_t) * (SRC_PIXELS * MAX_FILTER_WIDTH + MAX_FILTER_WIDTH));
+ if ((cpu_flags & AV_CPU_FLAG_AVX2) && !(cpu_flags & AV_CPU_FLAG_SLOW_GATHER))
+ ff_shuffle_filter_coefficients(ctx, filterPosAvx, width, filterAvx2, SRC_PIXELS);
+
+ if (check_func(ctx->hcScale, "hscale_%d_to_%d__fs_%d_dstW_%d", ctx->srcBpc, ctx->dstBpc + 1, width, ctx->dstW)) {
+ memset(dst0, 0, SRC_PIXELS * sizeof(dst0[0]));
+ memset(dst1, 0, SRC_PIXELS * sizeof(dst1[0]));
+
+ call_ref(NULL, dst0, ctx->dstW, src, filter, filterPos, width);
+ call_new(NULL, dst1, ctx->dstW, src, filterAvx2, filterPosAvx, width);
+ if (memcmp(dst0, dst1, ctx->dstW * sizeof(dst0[0])))
+ fail();
+ bench_new(NULL, dst0, ctx->dstW, src, filter, filterPosAvx, width);
+ }
}
}
}
1
0
ffmpeg | branch: master | Bohan Li <bohanli-at-google.com(a)ffmpeg.org> | Tue Apr 19 11:18:51 2022 -0700| [950123dc31470ccfd248e465e6b97ec48c640aa9] | committer: James Zern
avcodec/libaomenc: Add unmet target level warning
When target levels are set, this patch checks whether they are
satisfied by libaom. If not, a warning is shown. Otherwise the output
levels are also logged.
This patch applies basically the same approach used for libvpx.
Signed-off-by: Bohan Li <bohanli(a)google.com>
Signed-off-by: James Zern <jzern(a)google.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=950123dc31470ccfd…
---
libavcodec/libaomenc.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++
libavcodec/version.h | 2 +-
2 files changed, 65 insertions(+), 1 deletion(-)
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 0411773bbf..ca5a581b3e 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -199,6 +199,12 @@ static const char *const ctlidstr[] = {
[AV1E_SET_ENABLE_SMOOTH_INTERINTRA] = "AV1E_SET_ENABLE_SMOOTH_INTERINTRA",
[AV1E_SET_ENABLE_REF_FRAME_MVS] = "AV1E_SET_ENABLE_REF_FRAME_MVS",
#endif
+#ifdef AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX
+ [AV1E_GET_SEQ_LEVEL_IDX] = "AV1E_GET_SEQ_LEVEL_IDX",
+#endif
+#ifdef AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX
+ [AV1E_GET_TARGET_SEQ_LEVEL_IDX] = "AV1E_GET_TARGET_SEQ_LEVEL_IDX",
+#endif
};
static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc)
@@ -324,10 +330,68 @@ static av_cold int codecctl_int(AVCodecContext *avctx,
return 0;
}
+#if defined(AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX) && \
+ defined(AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX)
+static av_cold int codecctl_intp(AVCodecContext *avctx,
+#ifdef UENUM1BYTE
+ aome_enc_control_id id,
+#else
+ enum aome_enc_control_id id,
+#endif
+ int* ptr)
+{
+ AOMContext *ctx = avctx->priv_data;
+ char buf[80];
+ int width = -30;
+ int res;
+
+ snprintf(buf, sizeof(buf), "%s:", ctlidstr[id]);
+ av_log(avctx, AV_LOG_DEBUG, " %*s%d\n", width, buf, *ptr);
+
+ res = aom_codec_control(&ctx->encoder, id, ptr);
+ if (res != AOM_CODEC_OK) {
+ snprintf(buf, sizeof(buf), "Failed to set %s codec control",
+ ctlidstr[id]);
+ log_encoder_error(avctx, buf);
+ return AVERROR(EINVAL);
+ }
+
+ return 0;
+}
+#endif
+
static av_cold int aom_free(AVCodecContext *avctx)
{
AOMContext *ctx = avctx->priv_data;
+#if defined(AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX) && \
+ defined(AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX)
+ if (!(avctx->flags & AV_CODEC_FLAG_PASS1)) {
+ int levels[32] = { 0 };
+ int target_levels[32] = { 0 };
+
+ if (!codecctl_intp(avctx, AV1E_GET_SEQ_LEVEL_IDX, levels) &&
+ !codecctl_intp(avctx, AV1E_GET_TARGET_SEQ_LEVEL_IDX,
+ target_levels)) {
+ for (int i = 0; i < 32; i++) {
+ if (levels[i] > target_levels[i]) {
+ // Warn when the target level was not met
+ av_log(avctx, AV_LOG_WARNING,
+ "Could not encode to target level %d.%d for "
+ "operating point %d. The output level is %d.%d.\n",
+ 2 + (target_levels[i] >> 2), target_levels[i] & 3,
+ i, 2 + (levels[i] >> 2), levels[i] & 3);
+ } else if (target_levels[i] < 31) {
+ // Log the encoded level if a target level was given
+ av_log(avctx, AV_LOG_INFO,
+ "Output level for operating point %d is %d.%d.\n",
+ i, 2 + (levels[i] >> 2), levels[i] & 3);
+ }
+ }
+ }
+ }
+#endif
+
aom_codec_destroy(&ctx->encoder);
av_freep(&ctx->twopass_stats.buf);
av_freep(&avctx->stats_out);
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 56dbb9238d..02192c86f7 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -30,7 +30,7 @@
#include "version_major.h"
#define LIBAVCODEC_VERSION_MINOR 32
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
1
0
ffmpeg | branch: master | Paul B Mahol <onemda(a)gmail.com> | Fri May 27 09:36:19 2022 +0200| [93b31dae1dec4c2b3e6c63a7e9f5b344b849126c] | committer: Paul B Mahol
avfilter/af_biquads: fix low/highshelf 'k' calculation
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=93b31dae1dec4c2b3…
---
libavfilter/af_biquads.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c
index 0687bc31e9..26cb4d49bb 100644
--- a/libavfilter/af_biquads.c
+++ b/libavfilter/af_biquads.c
@@ -690,7 +690,7 @@ static void convert_dir2zdf(BiquadsContext *s, int sample_rate)
case lowshelf:
A = ff_exp10(s->gain / 40.);
g = tan(M_PI * s->frequency / sample_rate) / sqrt(A);
- k = 1. / (Q * A);
+ k = 1. / Q;
a[0] = 1. / (1. + g * (g + k));
a[1] = g * a[0];
a[2] = g * a[1];
@@ -702,7 +702,7 @@ static void convert_dir2zdf(BiquadsContext *s, int sample_rate)
case highshelf:
A = ff_exp10(s->gain / 40.);
g = tan(M_PI * s->frequency / sample_rate) / sqrt(A);
- k = 1. / (Q * A);
+ k = 1. / Q;
a[0] = 1. / (1. + g * (g + k));
a[1] = g * a[0];
a[2] = g * a[1];
1
0