ffmpeg-cvslog
Threads by month
- ----- 2026 -----
- October
- September
- 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
January 2021
- 1 participants
- 381 discussions
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt(a)gmail.com> | Sat Jan 23 14:28:21 2021 +0100| [2668caf13c68098f99ee12e2a2a99cf9daf8b25a] | committer: Andreas Rheinhardt
avcodec/atrac3plus_data: Remove unused arrays
Forgotten in 58fc810d42fde26ed6c1f2996122e98ab7005849.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2668caf13c68098f9…
---
libavcodec/atrac3plus_data.h | 19 -------------------
1 file changed, 19 deletions(-)
diff --git a/libavcodec/atrac3plus_data.h b/libavcodec/atrac3plus_data.h
index b0b85c4368..05ae2b78a9 100644
--- a/libavcodec/atrac3plus_data.h
+++ b/libavcodec/atrac3plus_data.h
@@ -104,25 +104,6 @@ static const uint8_t atrac3p_sf_xlats[] = {
0, 1, 2, 14, 15, 3, 13, 4, 12, 5, 11, 6, 7, 9, 10,
};
-static const uint8_t atrac3p_ct_huff1[4][2] = {
- { 0, 1 }, { 1, 2 }, { 2, 3 }, { 3, 3 },
-};
-
-static const uint8_t atrac3p_ct_huff2[8][2] = {
- { 0, 2 }, { 1, 3 }, { 2, 3 }, { 3, 3 }, { 4, 3 }, { 5, 3 }, { 6, 4 },
- { 7, 4 },
-};
-
-static const uint8_t atrac3p_ct_huff3[8][2] = {
- { 0, 2 }, { 1, 3 }, { 2, 3 }, { 3, 3 }, { 6, 3 }, { 7, 3 }, { 4, 4 },
- { 5, 4 },
-};
-
-static const uint8_t atrac3p_ct_huff4[8][2] = {
- { 0, 1 }, { 1, 3 }, { 2, 4 }, { 3, 4 }, { 4, 4 }, { 5, 4 }, { 6, 4 },
- { 7, 4 },
-};
-
/* weights for quantized word lengths */
static const int8_t atrac3p_wl_weights[6][32] = {
{ 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0,
1
0
avcodec/dnxhd: Make ff_dxnhd_get_cid_table return a pointer, not index
by Andreas Rheinhardt 26 Jan '21
by Andreas Rheinhardt 26 Jan '21
26 Jan '21
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt(a)gmail.com> | Fri Jan 22 22:47:27 2021 +0100| [10d059bb24eb88157e071a3db102ddd8f4937a00] | committer: Andreas Rheinhardt
avcodec/dnxhd: Make ff_dxnhd_get_cid_table return a pointer, not index
All callers only use the index into ff_dnxhd_cid_table to get a pointer
to the desired entry.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=10d059bb24eb88157…
---
libavcodec/dnxhddata.c | 46 +++++++++++++++++++++++-----------------------
libavcodec/dnxhddata.h | 4 +---
libavcodec/dnxhddec.c | 13 +++++++------
libavcodec/dnxhdenc.c | 8 +++-----
4 files changed, 34 insertions(+), 37 deletions(-)
diff --git a/libavcodec/dnxhddata.c b/libavcodec/dnxhddata.c
index 154be89860..3a69a0f501 100644
--- a/libavcodec/dnxhddata.c
+++ b/libavcodec/dnxhddata.c
@@ -932,7 +932,7 @@ static const uint8_t dnxhd_1250_run[62] = {
49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
};
-const CIDEntry ff_dnxhd_cid_table[] = {
+static const CIDEntry dnxhd_cid_table[] = {
{ 1235, 1920, 1080, 917504, 917504,
0, 6, 10, 4,
dnxhd_1235_luma_weight, dnxhd_1235_chroma_weight,
@@ -1075,31 +1075,31 @@ const CIDEntry ff_dnxhd_cid_table[] = {
{ 0 }, { 5888, 255} },
};
-int ff_dnxhd_get_cid_table(int cid)
+const CIDEntry *ff_dnxhd_get_cid_table(int cid)
{
- int i;
- for (i = 0; i < FF_ARRAY_ELEMS(ff_dnxhd_cid_table); i++)
- if (ff_dnxhd_cid_table[i].cid == cid)
- return i;
- return -1;
+ for (int i = 0; i < FF_ARRAY_ELEMS(dnxhd_cid_table); i++)
+ if (dnxhd_cid_table[i].cid == cid)
+ return &dnxhd_cid_table[i];
+ return NULL;
}
int avpriv_dnxhd_get_frame_size(int cid)
{
- int i = ff_dnxhd_get_cid_table(cid);
- if (i<0)
- return i;
- return ff_dnxhd_cid_table[i].frame_size;
+ const CIDEntry *entry = ff_dnxhd_get_cid_table(cid);
+ if (!entry)
+ return -1;
+ return entry->frame_size;
}
int avpriv_dnxhd_get_hr_frame_size(int cid, int w, int h)
{
- int result, i = ff_dnxhd_get_cid_table(cid);
+ const CIDEntry *entry = ff_dnxhd_get_cid_table(cid);
+ int result;
- if (i < 0)
- return i;
+ if (!entry)
+ return -1;
- result = ((h + 15) / 16) * ((w + 15) / 16) * (int64_t)ff_dnxhd_cid_table[i].packet_scale.num / ff_dnxhd_cid_table[i].packet_scale.den;
+ result = ((h + 15) / 16) * ((w + 15) / 16) * (int64_t)entry->packet_scale.num / entry->packet_scale.den;
result = (result + 2048) / 4096 * 4096;
return FFMAX(result, 8192);
@@ -1107,10 +1107,10 @@ int avpriv_dnxhd_get_hr_frame_size(int cid, int w, int h)
int avpriv_dnxhd_get_interlaced(int cid)
{
- int i = ff_dnxhd_get_cid_table(cid);
- if (i < 0)
- return i;
- return ff_dnxhd_cid_table[i].flags & DNXHD_INTERLACED ? 1 : 0;
+ const CIDEntry *entry = ff_dnxhd_get_cid_table(cid);
+ if (!entry)
+ return -1;
+ return entry->flags & DNXHD_INTERLACED ? 1 : 0;
}
static int dnxhd_find_hr_cid(AVCodecContext *avctx)
@@ -1140,8 +1140,8 @@ int ff_dnxhd_find_cid(AVCodecContext *avctx, int bit_depth)
if (!mbs)
return 0;
- for (i = 0; i < FF_ARRAY_ELEMS(ff_dnxhd_cid_table); i++) {
- const CIDEntry *cid = &ff_dnxhd_cid_table[i];
+ for (i = 0; i < FF_ARRAY_ELEMS(dnxhd_cid_table); i++) {
+ const CIDEntry *cid = &dnxhd_cid_table[i];
int interlaced = cid->flags & DNXHD_INTERLACED ? 1 : 0;
if (cid->width == avctx->width && cid->height == avctx->height &&
interlaced == !!(avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) &&
@@ -1163,8 +1163,8 @@ int ff_dnxhd_find_cid(AVCodecContext *avctx, int bit_depth)
void ff_dnxhd_print_profiles(AVCodecContext *avctx, int loglevel)
{
int i, j;
- for (i = 0; i < FF_ARRAY_ELEMS(ff_dnxhd_cid_table); i++) {
- const CIDEntry *cid = &ff_dnxhd_cid_table[i];
+ for (i = 0; i < FF_ARRAY_ELEMS(dnxhd_cid_table); i++) {
+ const CIDEntry *cid = &dnxhd_cid_table[i];
for (j = 0; j < FF_ARRAY_ELEMS(cid->bit_rates); j++) {
if (!cid->bit_rates[j])
break;
diff --git a/libavcodec/dnxhddata.h b/libavcodec/dnxhddata.h
index cfa6b0c99d..898079cffc 100644
--- a/libavcodec/dnxhddata.h
+++ b/libavcodec/dnxhddata.h
@@ -58,9 +58,7 @@ typedef struct CIDEntry {
AVRational packet_scale;
} CIDEntry;
-extern const CIDEntry ff_dnxhd_cid_table[];
-
-int ff_dnxhd_get_cid_table(int cid);
+const CIDEntry *ff_dnxhd_get_cid_table(int cid);
int ff_dnxhd_find_cid(AVCodecContext *avctx, int bit_depth);
void ff_dnxhd_print_profiles(AVCodecContext *avctx, int loglevel);
diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 09bc6f9b59..c78d55aee5 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -113,18 +113,19 @@ static av_cold int dnxhd_decode_init(AVCodecContext *avctx)
static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid, int bitdepth)
{
if (cid != ctx->cid) {
- int index;
+ const CIDEntry *cid_table = ff_dnxhd_get_cid_table(cid);
- if ((index = ff_dnxhd_get_cid_table(cid)) < 0) {
+ if (!cid_table) {
av_log(ctx->avctx, AV_LOG_ERROR, "unsupported cid %"PRIu32"\n", cid);
return AVERROR(ENOSYS);
}
- if (ff_dnxhd_cid_table[index].bit_depth != bitdepth &&
- ff_dnxhd_cid_table[index].bit_depth != DNXHD_VARIABLE) {
- av_log(ctx->avctx, AV_LOG_ERROR, "bit depth mismatches %d %d\n", ff_dnxhd_cid_table[index].bit_depth, bitdepth);
+ if (cid_table->bit_depth != bitdepth &&
+ cid_table->bit_depth != DNXHD_VARIABLE) {
+ av_log(ctx->avctx, AV_LOG_ERROR, "bit depth mismatches %d %d\n",
+ cid_table->bit_depth, bitdepth);
return AVERROR_INVALIDDATA;
}
- ctx->cid_table = &ff_dnxhd_cid_table[index];
+ ctx->cid_table = cid_table;
av_log(ctx->avctx, AV_LOG_VERBOSE, "Profile cid %"PRIu32".\n", cid);
ff_free_vlc(&ctx->ac_vlc);
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 0144797d1b..2461c51727 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -351,7 +351,7 @@ static av_cold int dnxhd_init_rc(DNXHDEncContext *ctx)
static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
{
DNXHDEncContext *ctx = avctx->priv_data;
- int i, index, ret;
+ int i, ret;
switch (avctx->pix_fmt) {
case AV_PIX_FMT_YUV422P:
@@ -411,10 +411,8 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
return AVERROR(EINVAL);
}
- index = ff_dnxhd_get_cid_table(ctx->cid);
- av_assert0(index >= 0);
-
- ctx->cid_table = &ff_dnxhd_cid_table[index];
+ ctx->cid_table = ff_dnxhd_get_cid_table(ctx->cid);
+ av_assert0(ctx->cid_table);
ctx->m.avctx = avctx;
ctx->m.mb_intra = 1;
1
0
ffmpeg | branch: master | Paul B Mahol <onemda(a)gmail.com> | Sat Jan 23 11:21:47 2021 +0100| [37f76c81d6669033c315354a7d30ef6e605414ae] | committer: Paul B Mahol
avfilter: add shear video filter
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=37f76c81d6669033c…
---
Changelog | 1 +
doc/filters.texi | 27 ++++
libavfilter/Makefile | 1 +
libavfilter/allfilters.c | 1 +
libavfilter/version.h | 2 +-
libavfilter/vf_shear.c | 330 +++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 361 insertions(+), 1 deletion(-)
diff --git a/Changelog b/Changelog
index 20f6b79ab4..8319bbc298 100644
--- a/Changelog
+++ b/Changelog
@@ -58,6 +58,7 @@ version <next>:
- estdif filter
- epx filter
- Dolby E parser
+- shear filter
version 4.3:
diff --git a/doc/filters.texi b/doc/filters.texi
index d43db8c59e..c35bda46eb 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -17818,6 +17818,33 @@ Keep the same colorspace property (default).
@end table
@end table
+@section shear
+Apply shear transform to input video.
+
+This filter supports the following options:
+
+@table @option
+@item shx
+Shear factor in X-direction. Default value is 0.
+Allowed range is from -2 to 2.
+
+@item shy
+Shear factor in Y-direction. Default value is 0.
+Allowed range is from -2 to 2.
+
+@item fillcolor, c
+Set the color used to fill the output area not covered by the transformed
+video. For the general syntax of this option, check the
+@ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
+If the special value "none" is selected then no
+background is printed (useful for example if the background is never shown).
+
+Default value is "black".
+
+@item interp
+Set interpolation type. Can be @code{bilinear} or @code{nearest}. Default is @code{bilinear}.
+@end table
+
@section showinfo
Show a line containing various information for each input video frame.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index fb7bc8f140..b930a00d8b 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -403,6 +403,7 @@ OBJS-$(CONFIG_SETRANGE_FILTER) += vf_setparams.o
OBJS-$(CONFIG_SETSAR_FILTER) += vf_aspect.o
OBJS-$(CONFIG_SETTB_FILTER) += settb.o
OBJS-$(CONFIG_SHARPNESS_VAAPI_FILTER) += vf_misc_vaapi.o vaapi_vpp.o
+OBJS-$(CONFIG_SHEAR_FILTER) += vf_shear.o
OBJS-$(CONFIG_SHOWINFO_FILTER) += vf_showinfo.o
OBJS-$(CONFIG_SHOWPALETTE_FILTER) += vf_showpalette.o
OBJS-$(CONFIG_SHUFFLEFRAMES_FILTER) += vf_shuffleframes.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 139ba15f7c..616962690b 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -384,6 +384,7 @@ extern AVFilter ff_vf_setrange;
extern AVFilter ff_vf_setsar;
extern AVFilter ff_vf_settb;
extern AVFilter ff_vf_sharpness_vaapi;
+extern AVFilter ff_vf_shear;
extern AVFilter ff_vf_showinfo;
extern AVFilter ff_vf_showpalette;
extern AVFilter ff_vf_shuffleframes;
diff --git a/libavfilter/version.h b/libavfilter/version.h
index e949e9bfb8..d588e3169b 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -30,7 +30,7 @@
#include "libavutil/version.h"
#define LIBAVFILTER_VERSION_MAJOR 7
-#define LIBAVFILTER_VERSION_MINOR 97
+#define LIBAVFILTER_VERSION_MINOR 98
#define LIBAVFILTER_VERSION_MICRO 100
diff --git a/libavfilter/vf_shear.c b/libavfilter/vf_shear.c
new file mode 100644
index 0000000000..de298af94b
--- /dev/null
+++ b/libavfilter/vf_shear.c
@@ -0,0 +1,330 @@
+/*
+ * Copyright (c) 2021 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/avstring.h"
+#include "libavutil/opt.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/parseutils.h"
+#include "libavutil/pixdesc.h"
+
+#include "avfilter.h"
+#include "drawutils.h"
+#include "internal.h"
+#include "video.h"
+
+#include <float.h>
+
+typedef struct ShearContext {
+ const AVClass *class;
+
+ float shx, shy;
+ int interp;
+
+ uint8_t fillcolor[4]; ///< color expressed either in YUVA or RGBA colorspace for the padding area
+ char *fillcolor_str;
+ int fillcolor_enable;
+ int nb_planes;
+ int depth;
+ FFDrawContext draw;
+ FFDrawColor color;
+
+ int hsub, vsub;
+ int planewidth[4];
+ int planeheight[4];
+
+ int (*filter_slice[2])(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
+} ShearContext;
+
+typedef struct ThreadData {
+ AVFrame *in, *out;
+} ThreadData;
+
+#define OFFSET(x) offsetof(ShearContext, x)
+#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
+
+static const AVOption shear_options[] = {
+ { "shx", "set x shear factor", OFFSET(shx), AV_OPT_TYPE_FLOAT, {.dbl=0.}, -2, 2, .flags=FLAGS },
+ { "shy", "set y shear factor", OFFSET(shy), AV_OPT_TYPE_FLOAT, {.dbl=0.}, -2, 2, .flags=FLAGS },
+ { "fillcolor", "set background fill color", OFFSET(fillcolor_str), AV_OPT_TYPE_STRING, {.str="black"}, 0, 0, .flags=FLAGS },
+ { "c", "set background fill color", OFFSET(fillcolor_str), AV_OPT_TYPE_STRING, {.str="black"}, 0, 0, .flags=FLAGS },
+ { "interp", "set interpolation", OFFSET(interp), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, .flags=FLAGS, "interp" },
+ { "nearest", "nearest neighbour", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, .flags=FLAGS, "interp" },
+ { "bilinear", "bilinear", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, .flags=FLAGS, "interp" },
+ { NULL }
+};
+
+AVFILTER_DEFINE_CLASS(shear);
+
+static av_cold int init(AVFilterContext *ctx)
+{
+ ShearContext *s = ctx->priv;
+
+ if (!strcmp(s->fillcolor_str, "none"))
+ s->fillcolor_enable = 0;
+ else if (av_parse_color(s->fillcolor, s->fillcolor_str, -1, ctx) >= 0)
+ s->fillcolor_enable = 1;
+ else
+ return AVERROR(EINVAL);
+ return 0;
+}
+
+static int query_formats(AVFilterContext *ctx)
+{
+ static const enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY9,
+ AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, AV_PIX_FMT_GRAY14,
+ AV_PIX_FMT_GRAY16,
+ AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P,
+ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P,
+ AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV444P,
+ AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P,
+ AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_YUVJ444P,
+ AV_PIX_FMT_YUVJ411P,
+ AV_PIX_FMT_YUV420P9, AV_PIX_FMT_YUV422P9, AV_PIX_FMT_YUV444P9,
+ AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10,
+ AV_PIX_FMT_YUV440P10,
+ AV_PIX_FMT_YUV444P12, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV420P12,
+ AV_PIX_FMT_YUV440P12,
+ AV_PIX_FMT_YUV444P14, AV_PIX_FMT_YUV422P14, AV_PIX_FMT_YUV420P14,
+ AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, AV_PIX_FMT_YUV444P16,
+ AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10,
+ AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16,
+ AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA444P,
+ AV_PIX_FMT_YUVA444P9, AV_PIX_FMT_YUVA444P10, AV_PIX_FMT_YUVA444P12, AV_PIX_FMT_YUVA444P16,
+ AV_PIX_FMT_YUVA422P9, AV_PIX_FMT_YUVA422P10, AV_PIX_FMT_YUVA422P12, AV_PIX_FMT_YUVA422P16,
+ AV_PIX_FMT_YUVA420P9, AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA420P16,
+ AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16,
+ AV_PIX_FMT_NONE
+ };
+
+ AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
+ if (!fmts_list)
+ return AVERROR(ENOMEM);
+ return ff_set_common_formats(ctx, fmts_list);
+}
+
+#define NN(type, name) \
+static int filter_slice_nn##name(AVFilterContext *ctx, void *arg, int jobnr, \
+ int nb_jobs) \
+{ \
+ ThreadData *td = arg; \
+ AVFrame *in = td->in; \
+ AVFrame *out = td->out; \
+ ShearContext *s = ctx->priv; \
+ const float shx = s->shx; \
+ const float shy = s->shy; \
+ \
+ for (int p = 0; p < s->nb_planes; p++) { \
+ const int hsub = (p == 1 || p == 2) ? s->hsub: 1; \
+ const int vsub = (p == 1 || p == 2) ? s->vsub: 1; \
+ const int width = s->planewidth[p]; \
+ const int height = s->planeheight[p]; \
+ const int wx = vsub * shx * height * 0.5f / hsub; \
+ const int wy = hsub * shy * width * 0.5f / vsub; \
+ const int slice_start = (height * jobnr) / nb_jobs; \
+ const int slice_end = (height * (jobnr+1)) / nb_jobs; \
+ const int src_linesize = in->linesize[p] / sizeof(type); \
+ const int dst_linesize = out->linesize[p] / sizeof(type); \
+ const type *src = (const type *)in->data[p]; \
+ type *dst = (type *)out->data[p] + slice_start * dst_linesize; \
+ \
+ for (int y = slice_start; y < slice_end; y++) { \
+ for (int x = 0; x < width; x++) { \
+ int sx = x + vsub * shx * y / hsub - wx; \
+ int sy = y + hsub * shy * x / vsub - wy; \
+ \
+ if (sx >= 0 && sx < width - 1 && \
+ sy >= 0 && sy < height - 1) { \
+ dst[x] = src[sy * src_linesize + sx]; \
+ } \
+ } \
+ \
+ dst += dst_linesize; \
+ } \
+ } \
+ \
+ return 0; \
+}
+
+NN(uint8_t, 8)
+NN(uint16_t, 16)
+
+#define BL(type, name) \
+static int filter_slice_bl##name(AVFilterContext *ctx, void *arg, int jobnr, \
+ int nb_jobs) \
+{ \
+ ThreadData *td = arg; \
+ AVFrame *in = td->in; \
+ AVFrame *out = td->out; \
+ ShearContext *s = ctx->priv; \
+ const int depth = s->depth; \
+ const float shx = s->shx; \
+ const float shy = s->shy; \
+ \
+ for (int p = 0; p < s->nb_planes; p++) { \
+ const int hsub = (p == 1 || p == 2) ? s->hsub: 1; \
+ const int vsub = (p == 1 || p == 2) ? s->vsub: 1; \
+ const int width = s->planewidth[p]; \
+ const int height = s->planeheight[p]; \
+ const float wx = vsub * shx * height * 0.5f / hsub; \
+ const float wy = hsub * shy * width * 0.5f / vsub; \
+ const int slice_start = (height * jobnr) / nb_jobs; \
+ const int slice_end = (height * (jobnr+1)) / nb_jobs; \
+ const int src_linesize = in->linesize[p] / sizeof(type); \
+ const int dst_linesize = out->linesize[p] / sizeof(type); \
+ const type *src = (const type *)in->data[p]; \
+ type *dst = (type *)out->data[p] + slice_start * dst_linesize; \
+ \
+ for (int y = slice_start; y < slice_end; y++) { \
+ for (int x = 0; x < width; x++) { \
+ const float sx = x + vsub * shx * y / hsub - wx; \
+ const float sy = y + hsub * shy * x / vsub - wy; \
+ \
+ if (sx >= 0 && sx < width - 1 && \
+ sy >= 0 && sy < height - 1) { \
+ float sum = 0.f; \
+ int ax = floorf(sx); \
+ int ay = floorf(sy); \
+ float du = sx - ax; \
+ float dv = sy - ay; \
+ int bx = FFMIN(ax + 1, width - 1); \
+ int by = FFMIN(ay + 1, height - 1); \
+ \
+ sum += (1.f - du) * (1.f - dv) * src[ay * src_linesize + ax];\
+ sum += ( du) * (1.f - dv) * src[ay * src_linesize + bx];\
+ sum += (1.f - du) * ( dv) * src[by * src_linesize + ax];\
+ sum += ( du) * ( dv) * src[by * src_linesize + bx];\
+ dst[x] = av_clip_uintp2_c(lrintf(sum), depth); \
+ } \
+ } \
+ \
+ dst += dst_linesize; \
+ } \
+ } \
+ \
+ return 0; \
+}
+
+BL(uint8_t, 8)
+BL(uint16_t, 16)
+
+static int filter_frame(AVFilterLink *inlink, AVFrame *in)
+{
+ AVFilterContext *ctx = inlink->dst;
+ ShearContext *s = ctx->priv;
+ AVFilterLink *outlink = ctx->outputs[0];
+ ThreadData td;
+ AVFrame *out;
+
+ out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
+ if (!out) {
+ av_frame_free(&in);
+ return AVERROR(ENOMEM);
+ }
+ av_frame_copy_props(out, in);
+
+ /* fill background */
+ if (s->fillcolor_enable)
+ ff_fill_rectangle(&s->draw, &s->color, out->data, out->linesize,
+ 0, 0, outlink->w, outlink->h);
+
+ td.in = in, td.out = out;
+ ctx->internal->execute(ctx, s->filter_slice[s->interp], &td, NULL, FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx)));
+
+ av_frame_free(&in);
+ return ff_filter_frame(outlink, out);
+}
+
+static int config_output(AVFilterLink *outlink)
+{
+ AVFilterContext *ctx = outlink->src;
+ ShearContext *s = ctx->priv;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(outlink->format);
+
+ s->nb_planes = av_pix_fmt_count_planes(outlink->format);
+ s->depth = desc->comp[0].depth;
+ s->hsub = 1 << desc->log2_chroma_w;
+ s->vsub = 1 << desc->log2_chroma_h;
+ s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(ctx->inputs[0]->w, desc->log2_chroma_w);
+ s->planewidth[0] = s->planewidth[3] = ctx->inputs[0]->w;
+ s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(ctx->inputs[0]->h, desc->log2_chroma_h);
+ s->planeheight[0] = s->planeheight[3] = ctx->inputs[0]->h;
+
+ ff_draw_init(&s->draw, outlink->format, 0);
+ ff_draw_color(&s->draw, &s->color, s->fillcolor);
+
+ s->filter_slice[0] = s->depth <= 8 ? filter_slice_nn8 : filter_slice_nn16;
+ s->filter_slice[1] = s->depth <= 8 ? filter_slice_bl8 : filter_slice_bl16;
+
+ return 0;
+}
+
+static int process_command(AVFilterContext *ctx,
+ const char *cmd,
+ const char *arg,
+ char *res,
+ int res_len,
+ int flags)
+{
+ ShearContext *s = ctx->priv;
+ int ret;
+
+ ret = ff_filter_process_command(ctx, cmd, arg, res, res_len, flags);
+ if (ret < 0)
+ return ret;
+
+ ret = init(ctx);
+ if (ret < 0)
+ return ret;
+ ff_draw_color(&s->draw, &s->color, s->fillcolor);
+
+ return 0;
+}
+
+static const AVFilterPad inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .filter_frame = filter_frame,
+ },
+ { NULL }
+};
+
+static const AVFilterPad outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .config_props = config_output,
+ },
+ { NULL }
+};
+
+AVFilter ff_vf_shear = {
+ .name = "shear",
+ .description = NULL_IF_CONFIG_SMALL("Shear transform the input image."),
+ .priv_size = sizeof(ShearContext),
+ .init = init,
+ .query_formats = query_formats,
+ .inputs = inputs,
+ .outputs = outputs,
+ .priv_class = &shear_class,
+ .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,
+ .process_command = process_command,
+};
1
0
25 Jan '21
ffmpeg | branch: master | James Almer <jamrial(a)gmail.com> | Thu Jan 21 19:45:48 2021 -0300| [911ba8417e8881a7380842e69e11ca05fdc46575] | committer: James Almer
avdevice/dshow: Add namespace prefix to the remaining global symbols
Signed-off-by: James Almer <jamrial(a)gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=911ba8417e8881a73…
---
libavdevice/dshow.c | 18 +--
libavdevice/dshow_capture.h | 226 ++++++++++++++++++-------------------
libavdevice/dshow_enummediatypes.c | 51 ++++-----
libavdevice/dshow_enumpins.c | 62 +++++-----
libavdevice/dshow_filter.c | 119 +++++++++----------
libavdevice/dshow_pin.c | 225 ++++++++++++++++--------------------
6 files changed, 325 insertions(+), 376 deletions(-)
diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index 1b9e5be399..a16764d74c 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -87,13 +87,13 @@ dshow_read_close(AVFormatContext *s)
}
if (ctx->capture_pin[VideoDevice])
- libAVPin_Release(ctx->capture_pin[VideoDevice]);
+ ff_dshow_pin_Release(ctx->capture_pin[VideoDevice]);
if (ctx->capture_pin[AudioDevice])
- libAVPin_Release(ctx->capture_pin[AudioDevice]);
+ ff_dshow_pin_Release(ctx->capture_pin[AudioDevice]);
if (ctx->capture_filter[VideoDevice])
- libAVFilter_Release(ctx->capture_filter[VideoDevice]);
+ ff_dshow_filter_Release(ctx->capture_filter[VideoDevice]);
if (ctx->capture_filter[AudioDevice])
- libAVFilter_Release(ctx->capture_filter[AudioDevice]);
+ ff_dshow_filter_Release(ctx->capture_filter[AudioDevice]);
if (ctx->device_pin[VideoDevice])
IPin_Release(ctx->device_pin[VideoDevice]);
@@ -731,8 +731,8 @@ dshow_open_device(AVFormatContext *avctx, ICreateDevEnum *devenum,
char *device_filter_unique_name = NULL;
IGraphBuilder *graph = ctx->graph;
IPin *device_pin = NULL;
- libAVPin *capture_pin = NULL;
- libAVFilter *capture_filter = NULL;
+ DShowPin *capture_pin = NULL;
+ DShowFilter *capture_filter = NULL;
ICaptureGraphBuilder2 *graph_builder2 = NULL;
int ret = AVERROR(EIO);
int r;
@@ -807,7 +807,7 @@ dshow_open_device(AVFormatContext *avctx, ICreateDevEnum *devenum,
ctx->device_pin[devtype] = device_pin;
- capture_filter = libAVFilter_Create(avctx, callback, devtype);
+ capture_filter = ff_dshow_filter_Create(avctx, callback, devtype);
if (!capture_filter) {
av_log(avctx, AV_LOG_ERROR, "Could not create grabber filter.\n");
goto error;
@@ -863,7 +863,7 @@ dshow_open_device(AVFormatContext *avctx, ICreateDevEnum *devenum,
goto error;
}
- libAVPin_AddRef(capture_filter->pin);
+ ff_dshow_pin_AddRef(capture_filter->pin);
capture_pin = capture_filter->pin;
ctx->capture_pin[devtype] = capture_pin;
@@ -953,7 +953,7 @@ dshow_add_device(AVFormatContext *avctx,
ctx->capture_filter[devtype]->stream_index = st->index;
- libAVPin_ConnectionMediaType(ctx->capture_pin[devtype], &type);
+ ff_dshow_pin_ConnectionMediaType(ctx->capture_pin[devtype], &type);
par = st->codecpar;
if (devtype == VideoDevice) {
diff --git a/libavdevice/dshow_capture.h b/libavdevice/dshow_capture.h
index 79c004a87f..710b65cc85 100644
--- a/libavdevice/dshow_capture.h
+++ b/libavdevice/dshow_capture.h
@@ -68,20 +68,20 @@ enum dshowSourceFilterType {
AudioSourceDevice = 1,
};
-#define DECLARE_QUERYINTERFACE(class, ...) \
-long WINAPI \
-class##_QueryInterface(class *this, const GUID *riid, void **ppvObject) \
+#define DECLARE_QUERYINTERFACE(prefix, class, ...) \
+long \
+ff_dshow_##prefix##_QueryInterface(class *this, const GUID *riid, void **ppvObject) \
{ \
struct GUIDoffset ifaces[] = __VA_ARGS__; \
int i; \
- dshowdebug(AV_STRINGIFY(class)"_QueryInterface(%p, %p, %p)\n", this, riid, ppvObject); \
+ dshowdebug("ff_dshow_"AV_STRINGIFY(prefix)"_QueryInterface(%p, %p, %p)\n", this, riid, ppvObject); \
ff_printGUID(riid); \
if (!ppvObject) \
return E_POINTER; \
for (i = 0; i < sizeof(ifaces)/sizeof(ifaces[0]); i++) { \
if (IsEqualGUID(riid, ifaces[i].iid)) { \
void *obj = (void *) ((uint8_t *) this + ifaces[i].offset); \
- class##_AddRef(this); \
+ ff_dshow_##prefix##_AddRef(this); \
dshowdebug("\tfound %d with offset %d\n", i, ifaces[i].offset); \
*ppvObject = (void *) obj; \
return S_OK; \
@@ -91,28 +91,28 @@ class##_QueryInterface(class *this, const GUID *riid, void **ppvObject) \
*ppvObject = NULL; \
return E_NOINTERFACE; \
}
-#define DECLARE_ADDREF(class) \
-unsigned long WINAPI \
-class##_AddRef(class *this) \
+#define DECLARE_ADDREF(prefix, class) \
+unsigned long \
+ff_dshow_##prefix##_AddRef(class *this) \
{ \
- dshowdebug(AV_STRINGIFY(class)"_AddRef(%p)\t%ld\n", this, this->ref+1); \
+ dshowdebug("ff_dshow_"AV_STRINGIFY(prefix)"_AddRef(%p)\t%ld\n", this, this->ref+1); \
return InterlockedIncrement(&this->ref); \
}
-#define DECLARE_RELEASE(class) \
-unsigned long WINAPI \
-class##_Release(class *this) \
+#define DECLARE_RELEASE(prefix, class) \
+unsigned long \
+ff_dshow_##prefix##_Release(class *this) \
{ \
long ref = InterlockedDecrement(&this->ref); \
- dshowdebug(AV_STRINGIFY(class)"_Release(%p)\t%ld\n", this, ref); \
+ dshowdebug("ff_dshow_"AV_STRINGIFY(prefix)"_Release(%p)\t%ld\n", this, ref); \
if (!ref) \
- class##_Destroy(this); \
+ ff_dshow_##prefix##_Destroy(this); \
return ref; \
}
-#define DECLARE_DESTROY(class, func) \
-void class##_Destroy(class *this) \
+#define DECLARE_DESTROY(prefix, class, func) \
+void ff_dshow_##prefix##_Destroy(class *this) \
{ \
- dshowdebug(AV_STRINGIFY(class)"_Destroy(%p)\n", this); \
+ dshowdebug("ff_dshow_"AV_STRINGIFY(prefix)"_Destroy(%p)\n", this); \
func(this); \
if (this) { \
if (this->vtbl) \
@@ -120,12 +120,12 @@ void class##_Destroy(class *this) \
CoTaskMemFree(this); \
} \
}
-#define DECLARE_CREATE(class, setup, ...) \
-class *class##_Create(__VA_ARGS__) \
+#define DECLARE_CREATE(prefix, class, setup, ...) \
+class *ff_dshow_##prefix##_Create(__VA_ARGS__) \
{ \
class *this = CoTaskMemAlloc(sizeof(class)); \
void *vtbl = CoTaskMemAlloc(sizeof(*this->vtbl)); \
- dshowdebug(AV_STRINGIFY(class)"_Create(%p)\n", this); \
+ dshowdebug("ff_dshow_"AV_STRINGIFY(prefix)"_Create(%p)\n", this); \
if (!this || !vtbl) \
goto fail; \
ZeroMemory(this, sizeof(class)); \
@@ -134,123 +134,123 @@ class *class##_Create(__VA_ARGS__) \
this->vtbl = vtbl; \
if (!setup) \
goto fail; \
- dshowdebug("created "AV_STRINGIFY(class)" %p\n", this); \
+ dshowdebug("created ff_dshow_"AV_STRINGIFY(prefix)" %p\n", this); \
return this; \
fail: \
- class##_Destroy(this); \
- dshowdebug("could not create "AV_STRINGIFY(class)"\n"); \
+ ff_dshow_##prefix##_Destroy(this); \
+ dshowdebug("could not create ff_dshow_"AV_STRINGIFY(prefix)"\n"); \
return NULL; \
}
-#define SETVTBL(vtbl, class, fn) \
- do { (vtbl)->fn = (void *) class##_##fn; } while(0)
+#define SETVTBL(vtbl, prefix, fn) \
+ do { (vtbl)->fn = (void *) ff_dshow_##prefix##_##fn; } while(0)
/*****************************************************************************
* Forward Declarations
****************************************************************************/
-typedef struct libAVPin libAVPin;
-typedef struct libAVMemInputPin libAVMemInputPin;
-typedef struct libAVEnumPins libAVEnumPins;
-typedef struct libAVEnumMediaTypes libAVEnumMediaTypes;
-typedef struct libAVFilter libAVFilter;
+typedef struct DShowPin DShowPin;
+typedef struct DShowMemInputPin DShowMemInputPin;
+typedef struct DShowEnumPins DShowEnumPins;
+typedef struct DShowEnumMediaTypes DShowEnumMediaTypes;
+typedef struct DShowFilter DShowFilter;
/*****************************************************************************
- * libAVPin
+ * DShowPin
****************************************************************************/
-struct libAVPin {
+struct DShowPin {
IPinVtbl *vtbl;
long ref;
- libAVFilter *filter;
+ DShowFilter *filter;
IPin *connectedto;
AM_MEDIA_TYPE type;
IMemInputPinVtbl *imemvtbl;
};
-long WINAPI libAVPin_QueryInterface (libAVPin *, const GUID *, void **);
-unsigned long WINAPI libAVPin_AddRef (libAVPin *);
-unsigned long WINAPI libAVPin_Release (libAVPin *);
-long WINAPI libAVPin_Connect (libAVPin *, IPin *, const AM_MEDIA_TYPE *);
-long WINAPI libAVPin_ReceiveConnection (libAVPin *, IPin *, const AM_MEDIA_TYPE *);
-long WINAPI libAVPin_Disconnect (libAVPin *);
-long WINAPI libAVPin_ConnectedTo (libAVPin *, IPin **);
-long WINAPI libAVPin_ConnectionMediaType (libAVPin *, AM_MEDIA_TYPE *);
-long WINAPI libAVPin_QueryPinInfo (libAVPin *, PIN_INFO *);
-long WINAPI libAVPin_QueryDirection (libAVPin *, PIN_DIRECTION *);
-long WINAPI libAVPin_QueryId (libAVPin *, wchar_t **);
-long WINAPI libAVPin_QueryAccept (libAVPin *, const AM_MEDIA_TYPE *);
-long WINAPI libAVPin_EnumMediaTypes (libAVPin *, IEnumMediaTypes **);
-long WINAPI libAVPin_QueryInternalConnections(libAVPin *, IPin **, unsigned long *);
-long WINAPI libAVPin_EndOfStream (libAVPin *);
-long WINAPI libAVPin_BeginFlush (libAVPin *);
-long WINAPI libAVPin_EndFlush (libAVPin *);
-long WINAPI libAVPin_NewSegment (libAVPin *, REFERENCE_TIME, REFERENCE_TIME, double);
-
-long WINAPI libAVMemInputPin_QueryInterface (libAVMemInputPin *, const GUID *, void **);
-unsigned long WINAPI libAVMemInputPin_AddRef (libAVMemInputPin *);
-unsigned long WINAPI libAVMemInputPin_Release (libAVMemInputPin *);
-long WINAPI libAVMemInputPin_GetAllocator (libAVMemInputPin *, IMemAllocator **);
-long WINAPI libAVMemInputPin_NotifyAllocator (libAVMemInputPin *, IMemAllocator *, BOOL);
-long WINAPI libAVMemInputPin_GetAllocatorRequirements(libAVMemInputPin *, ALLOCATOR_PROPERTIES *);
-long WINAPI libAVMemInputPin_Receive (libAVMemInputPin *, IMediaSample *);
-long WINAPI libAVMemInputPin_ReceiveMultiple (libAVMemInputPin *, IMediaSample **, long, long *);
-long WINAPI libAVMemInputPin_ReceiveCanBlock (libAVMemInputPin *);
-
-void libAVPin_Destroy(libAVPin *);
-libAVPin *libAVPin_Create (libAVFilter *filter);
-
-void libAVMemInputPin_Destroy(libAVMemInputPin *);
+long ff_dshow_pin_QueryInterface (DShowPin *, const GUID *, void **);
+unsigned long ff_dshow_pin_AddRef (DShowPin *);
+unsigned long ff_dshow_pin_Release (DShowPin *);
+long ff_dshow_pin_Connect (DShowPin *, IPin *, const AM_MEDIA_TYPE *);
+long ff_dshow_pin_ReceiveConnection (DShowPin *, IPin *, const AM_MEDIA_TYPE *);
+long ff_dshow_pin_Disconnect (DShowPin *);
+long ff_dshow_pin_ConnectedTo (DShowPin *, IPin **);
+long ff_dshow_pin_ConnectionMediaType (DShowPin *, AM_MEDIA_TYPE *);
+long ff_dshow_pin_QueryPinInfo (DShowPin *, PIN_INFO *);
+long ff_dshow_pin_QueryDirection (DShowPin *, PIN_DIRECTION *);
+long ff_dshow_pin_QueryId (DShowPin *, wchar_t **);
+long ff_dshow_pin_QueryAccept (DShowPin *, const AM_MEDIA_TYPE *);
+long ff_dshow_pin_EnumMediaTypes (DShowPin *, IEnumMediaTypes **);
+long ff_dshow_pin_QueryInternalConnections(DShowPin *, IPin **, unsigned long *);
+long ff_dshow_pin_EndOfStream (DShowPin *);
+long ff_dshow_pin_BeginFlush (DShowPin *);
+long ff_dshow_pin_EndFlush (DShowPin *);
+long ff_dshow_pin_NewSegment (DShowPin *, REFERENCE_TIME, REFERENCE_TIME, double);
+
+long ff_dshow_meminputpin_QueryInterface (DShowMemInputPin *, const GUID *, void **);
+unsigned long ff_dshow_meminputpin_AddRef (DShowMemInputPin *);
+unsigned long ff_dshow_meminputpin_Release (DShowMemInputPin *);
+long ff_dshow_meminputpin_GetAllocator (DShowMemInputPin *, IMemAllocator **);
+long ff_dshow_meminputpin_NotifyAllocator (DShowMemInputPin *, IMemAllocator *, BOOL);
+long ff_dshow_meminputpin_GetAllocatorRequirements(DShowMemInputPin *, ALLOCATOR_PROPERTIES *);
+long ff_dshow_meminputpin_Receive (DShowMemInputPin *, IMediaSample *);
+long ff_dshow_meminputpin_ReceiveMultiple (DShowMemInputPin *, IMediaSample **, long, long *);
+long ff_dshow_meminputpin_ReceiveCanBlock (DShowMemInputPin *);
+
+void ff_dshow_pin_Destroy(DShowPin *);
+DShowPin *ff_dshow_pin_Create (DShowFilter *filter);
+
+void ff_dshow_meminputpin_Destroy(DShowMemInputPin *);
/*****************************************************************************
- * libAVEnumPins
+ * DShowEnumPins
****************************************************************************/
-struct libAVEnumPins {
+struct DShowEnumPins {
IEnumPinsVtbl *vtbl;
long ref;
int pos;
- libAVPin *pin;
- libAVFilter *filter;
+ DShowPin *pin;
+ DShowFilter *filter;
};
-long WINAPI libAVEnumPins_QueryInterface(libAVEnumPins *, const GUID *, void **);
-unsigned long WINAPI libAVEnumPins_AddRef (libAVEnumPins *);
-unsigned long WINAPI libAVEnumPins_Release (libAVEnumPins *);
-long WINAPI libAVEnumPins_Next (libAVEnumPins *, unsigned long, IPin **, unsigned long *);
-long WINAPI libAVEnumPins_Skip (libAVEnumPins *, unsigned long);
-long WINAPI libAVEnumPins_Reset (libAVEnumPins *);
-long WINAPI libAVEnumPins_Clone (libAVEnumPins *, libAVEnumPins **);
+long ff_dshow_enumpins_QueryInterface(DShowEnumPins *, const GUID *, void **);
+unsigned long ff_dshow_enumpins_AddRef (DShowEnumPins *);
+unsigned long ff_dshow_enumpins_Release (DShowEnumPins *);
+long ff_dshow_enumpins_Next (DShowEnumPins *, unsigned long, IPin **, unsigned long *);
+long ff_dshow_enumpins_Skip (DShowEnumPins *, unsigned long);
+long ff_dshow_enumpins_Reset (DShowEnumPins *);
+long ff_dshow_enumpins_Clone (DShowEnumPins *, DShowEnumPins **);
-void libAVEnumPins_Destroy(libAVEnumPins *);
-libAVEnumPins *libAVEnumPins_Create (libAVPin *pin, libAVFilter *filter);
+void ff_dshow_enumpins_Destroy(DShowEnumPins *);
+DShowEnumPins *ff_dshow_enumpins_Create (DShowPin *pin, DShowFilter *filter);
/*****************************************************************************
- * libAVEnumMediaTypes
+ * DShowEnumMediaTypes
****************************************************************************/
-struct libAVEnumMediaTypes {
+struct DShowEnumMediaTypes {
IEnumMediaTypesVtbl *vtbl;
long ref;
int pos;
AM_MEDIA_TYPE type;
};
-long WINAPI libAVEnumMediaTypes_QueryInterface(libAVEnumMediaTypes *, const GUID *, void **);
-unsigned long WINAPI libAVEnumMediaTypes_AddRef (libAVEnumMediaTypes *);
-unsigned long WINAPI libAVEnumMediaTypes_Release (libAVEnumMediaTypes *);
-long WINAPI libAVEnumMediaTypes_Next (libAVEnumMediaTypes *, unsigned long, AM_MEDIA_TYPE **, unsigned long *);
-long WINAPI libAVEnumMediaTypes_Skip (libAVEnumMediaTypes *, unsigned long);
-long WINAPI libAVEnumMediaTypes_Reset (libAVEnumMediaTypes *);
-long WINAPI libAVEnumMediaTypes_Clone (libAVEnumMediaTypes *, libAVEnumMediaTypes **);
+long ff_dshow_enummediatypes_QueryInterface(DShowEnumMediaTypes *, const GUID *, void **);
+unsigned long ff_dshow_enummediatypes_AddRef (DShowEnumMediaTypes *);
+unsigned long ff_dshow_enummediatypes_Release (DShowEnumMediaTypes *);
+long ff_dshow_enummediatypes_Next (DShowEnumMediaTypes *, unsigned long, AM_MEDIA_TYPE **, unsigned long *);
+long ff_dshow_enummediatypes_Skip (DShowEnumMediaTypes *, unsigned long);
+long ff_dshow_enummediatypes_Reset (DShowEnumMediaTypes *);
+long ff_dshow_enummediatypes_Clone (DShowEnumMediaTypes *, DShowEnumMediaTypes **);
-void libAVEnumMediaTypes_Destroy(libAVEnumMediaTypes *);
-libAVEnumMediaTypes *libAVEnumMediaTypes_Create(const AM_MEDIA_TYPE *type);
+void ff_dshow_enummediatypes_Destroy(DShowEnumMediaTypes *);
+DShowEnumMediaTypes *ff_dshow_enummediatypes_Create(const AM_MEDIA_TYPE *type);
/*****************************************************************************
- * libAVFilter
+ * DShowFilter
****************************************************************************/
-struct libAVFilter {
+struct DShowFilter {
IBaseFilterVtbl *vtbl;
long ref;
const wchar_t *name;
- libAVPin *pin;
+ DShowPin *pin;
FILTER_INFO info;
FILTER_STATE state;
IReferenceClock *clock;
@@ -261,24 +261,24 @@ struct libAVFilter {
void (*callback)(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time, enum dshowDeviceType type);
};
-long WINAPI libAVFilter_QueryInterface (libAVFilter *, const GUID *, void **);
-unsigned long WINAPI libAVFilter_AddRef (libAVFilter *);
-unsigned long WINAPI libAVFilter_Release (libAVFilter *);
-long WINAPI libAVFilter_GetClassID (libAVFilter *, CLSID *);
-long WINAPI libAVFilter_Stop (libAVFilter *);
-long WINAPI libAVFilter_Pause (libAVFilter *);
-long WINAPI libAVFilter_Run (libAVFilter *, REFERENCE_TIME);
-long WINAPI libAVFilter_GetState (libAVFilter *, DWORD, FILTER_STATE *);
-long WINAPI libAVFilter_SetSyncSource (libAVFilter *, IReferenceClock *);
-long WINAPI libAVFilter_GetSyncSource (libAVFilter *, IReferenceClock **);
-long WINAPI libAVFilter_EnumPins (libAVFilter *, IEnumPins **);
-long WINAPI libAVFilter_FindPin (libAVFilter *, const wchar_t *, IPin **);
-long WINAPI libAVFilter_QueryFilterInfo(libAVFilter *, FILTER_INFO *);
-long WINAPI libAVFilter_JoinFilterGraph(libAVFilter *, IFilterGraph *, const wchar_t *);
-long WINAPI libAVFilter_QueryVendorInfo(libAVFilter *, wchar_t **);
-
-void libAVFilter_Destroy(libAVFilter *);
-libAVFilter *libAVFilter_Create (void *, void *, enum dshowDeviceType);
+long ff_dshow_filter_QueryInterface (DShowFilter *, const GUID *, void **);
+unsigned long ff_dshow_filter_AddRef (DShowFilter *);
+unsigned long ff_dshow_filter_Release (DShowFilter *);
+long ff_dshow_filter_GetClassID (DShowFilter *, CLSID *);
+long ff_dshow_filter_Stop (DShowFilter *);
+long ff_dshow_filter_Pause (DShowFilter *);
+long ff_dshow_filter_Run (DShowFilter *, REFERENCE_TIME);
+long ff_dshow_filter_GetState (DShowFilter *, DWORD, FILTER_STATE *);
+long ff_dshow_filter_SetSyncSource (DShowFilter *, IReferenceClock *);
+long ff_dshow_filter_GetSyncSource (DShowFilter *, IReferenceClock **);
+long ff_dshow_filter_EnumPins (DShowFilter *, IEnumPins **);
+long ff_dshow_filter_FindPin (DShowFilter *, const wchar_t *, IPin **);
+long ff_dshow_filter_QueryFilterInfo(DShowFilter *, FILTER_INFO *);
+long ff_dshow_filter_JoinFilterGraph(DShowFilter *, IFilterGraph *, const wchar_t *);
+long ff_dshow_filter_QueryVendorInfo(DShowFilter *, wchar_t **);
+
+void ff_dshow_filter_Destroy(DShowFilter *);
+DShowFilter *ff_dshow_filter_Create (void *, void *, enum dshowDeviceType);
/*****************************************************************************
* dshow_ctx
@@ -314,8 +314,8 @@ struct dshow_ctx {
IBaseFilter *device_filter[2];
IPin *device_pin[2];
- libAVFilter *capture_filter[2];
- libAVPin *capture_pin[2];
+ DShowFilter *capture_filter[2];
+ DShowPin *capture_pin[2];
HANDLE mutex;
HANDLE event[2]; /* event[0] is set by DirectShow
diff --git a/libavdevice/dshow_enummediatypes.c b/libavdevice/dshow_enummediatypes.c
index 3a66a4de14..82944507f6 100644
--- a/libavdevice/dshow_enummediatypes.c
+++ b/libavdevice/dshow_enummediatypes.c
@@ -21,17 +21,16 @@
#include "dshow_capture.h"
-DECLARE_QUERYINTERFACE(libAVEnumMediaTypes,
+DECLARE_QUERYINTERFACE(enummediatypes, DShowEnumMediaTypes,
{ {&IID_IUnknown,0}, {&IID_IEnumMediaTypes,0} })
-DECLARE_ADDREF(libAVEnumMediaTypes)
-DECLARE_RELEASE(libAVEnumMediaTypes)
+DECLARE_ADDREF(enummediatypes, DShowEnumMediaTypes)
+DECLARE_RELEASE(enummediatypes, DShowEnumMediaTypes)
-long WINAPI
-libAVEnumMediaTypes_Next(libAVEnumMediaTypes *this, unsigned long n,
+long ff_dshow_enummediatypes_Next(DShowEnumMediaTypes *this, unsigned long n,
AM_MEDIA_TYPE **types, unsigned long *fetched)
{
int count = 0;
- dshowdebug("libAVEnumMediaTypes_Next(%p)\n", this);
+ dshowdebug("ff_dshow_enummediatypes_Next(%p)\n", this);
if (!types)
return E_POINTER;
if (!this->pos && n == 1) {
@@ -51,29 +50,26 @@ libAVEnumMediaTypes_Next(libAVEnumMediaTypes *this, unsigned long n,
return S_FALSE;
return S_OK;
}
-long WINAPI
-libAVEnumMediaTypes_Skip(libAVEnumMediaTypes *this, unsigned long n)
+long ff_dshow_enummediatypes_Skip(DShowEnumMediaTypes *this, unsigned long n)
{
- dshowdebug("libAVEnumMediaTypes_Skip(%p)\n", this);
+ dshowdebug("ff_dshow_enummediatypes_Skip(%p)\n", this);
if (n) /* Any skip will always fall outside of the only valid type. */
return S_FALSE;
return S_OK;
}
-long WINAPI
-libAVEnumMediaTypes_Reset(libAVEnumMediaTypes *this)
+long ff_dshow_enummediatypes_Reset(DShowEnumMediaTypes *this)
{
- dshowdebug("libAVEnumMediaTypes_Reset(%p)\n", this);
+ dshowdebug("ff_dshow_enummediatypes_Reset(%p)\n", this);
this->pos = 0;
return S_OK;
}
-long WINAPI
-libAVEnumMediaTypes_Clone(libAVEnumMediaTypes *this, libAVEnumMediaTypes **enums)
+long ff_dshow_enummediatypes_Clone(DShowEnumMediaTypes *this, DShowEnumMediaTypes **enums)
{
- libAVEnumMediaTypes *new;
- dshowdebug("libAVEnumMediaTypes_Clone(%p)\n", this);
+ DShowEnumMediaTypes *new;
+ dshowdebug("ff_dshow_enummediatypes_Clone(%p)\n", this);
if (!enums)
return E_POINTER;
- new = libAVEnumMediaTypes_Create(&this->type);
+ new = ff_dshow_enummediatypes_Create(&this->type);
if (!new)
return E_OUTOFMEMORY;
new->pos = this->pos;
@@ -81,17 +77,16 @@ libAVEnumMediaTypes_Clone(libAVEnumMediaTypes *this, libAVEnumMediaTypes **enums
return S_OK;
}
-static int
-libAVEnumMediaTypes_Setup(libAVEnumMediaTypes *this, const AM_MEDIA_TYPE *type)
+static int ff_dshow_enummediatypes_Setup(DShowEnumMediaTypes *this, const AM_MEDIA_TYPE *type)
{
IEnumMediaTypesVtbl *vtbl = this->vtbl;
- SETVTBL(vtbl, libAVEnumMediaTypes, QueryInterface);
- SETVTBL(vtbl, libAVEnumMediaTypes, AddRef);
- SETVTBL(vtbl, libAVEnumMediaTypes, Release);
- SETVTBL(vtbl, libAVEnumMediaTypes, Next);
- SETVTBL(vtbl, libAVEnumMediaTypes, Skip);
- SETVTBL(vtbl, libAVEnumMediaTypes, Reset);
- SETVTBL(vtbl, libAVEnumMediaTypes, Clone);
+ SETVTBL(vtbl, enummediatypes, QueryInterface);
+ SETVTBL(vtbl, enummediatypes, AddRef);
+ SETVTBL(vtbl, enummediatypes, Release);
+ SETVTBL(vtbl, enummediatypes, Next);
+ SETVTBL(vtbl, enummediatypes, Skip);
+ SETVTBL(vtbl, enummediatypes, Reset);
+ SETVTBL(vtbl, enummediatypes, Clone);
if (!type) {
this->type.majortype = GUID_NULL;
@@ -101,5 +96,5 @@ libAVEnumMediaTypes_Setup(libAVEnumMediaTypes *this, const AM_MEDIA_TYPE *type)
return 1;
}
-DECLARE_CREATE(libAVEnumMediaTypes, libAVEnumMediaTypes_Setup(this, type), const AM_MEDIA_TYPE *type)
-DECLARE_DESTROY(libAVEnumMediaTypes, nothing)
+DECLARE_CREATE(enummediatypes, DShowEnumMediaTypes, ff_dshow_enummediatypes_Setup(this, type), const AM_MEDIA_TYPE *type)
+DECLARE_DESTROY(enummediatypes, DShowEnumMediaTypes, nothing)
diff --git a/libavdevice/dshow_enumpins.c b/libavdevice/dshow_enumpins.c
index e5c11cb54e..6bf59928f9 100644
--- a/libavdevice/dshow_enumpins.c
+++ b/libavdevice/dshow_enumpins.c
@@ -21,21 +21,20 @@
#include "dshow_capture.h"
-DECLARE_QUERYINTERFACE(libAVEnumPins,
+DECLARE_QUERYINTERFACE(enumpins, DShowEnumPins,
{ {&IID_IUnknown,0}, {&IID_IEnumPins,0} })
-DECLARE_ADDREF(libAVEnumPins)
-DECLARE_RELEASE(libAVEnumPins)
+DECLARE_ADDREF(enumpins, DShowEnumPins)
+DECLARE_RELEASE(enumpins, DShowEnumPins)
-long WINAPI
-libAVEnumPins_Next(libAVEnumPins *this, unsigned long n, IPin **pins,
+long ff_dshow_enumpins_Next(DShowEnumPins *this, unsigned long n, IPin **pins,
unsigned long *fetched)
{
int count = 0;
- dshowdebug("libAVEnumPins_Next(%p)\n", this);
+ dshowdebug("ff_dshow_enumpins_Next(%p)\n", this);
if (!pins)
return E_POINTER;
if (!this->pos && n == 1) {
- libAVPin_AddRef(this->pin);
+ ff_dshow_pin_AddRef(this->pin);
*pins = (IPin *) this->pin;
count = 1;
this->pos = 1;
@@ -46,29 +45,26 @@ libAVEnumPins_Next(libAVEnumPins *this, unsigned long n, IPin **pins,
return S_FALSE;
return S_OK;
}
-long WINAPI
-libAVEnumPins_Skip(libAVEnumPins *this, unsigned long n)
+long ff_dshow_enumpins_Skip(DShowEnumPins *this, unsigned long n)
{
- dshowdebug("libAVEnumPins_Skip(%p)\n", this);
+ dshowdebug("ff_dshow_enumpins_Skip(%p)\n", this);
if (n) /* Any skip will always fall outside of the only valid pin. */
return S_FALSE;
return S_OK;
}
-long WINAPI
-libAVEnumPins_Reset(libAVEnumPins *this)
+long ff_dshow_enumpins_Reset(DShowEnumPins *this)
{
- dshowdebug("libAVEnumPins_Reset(%p)\n", this);
+ dshowdebug("ff_dshow_enumpins_Reset(%p)\n", this);
this->pos = 0;
return S_OK;
}
-long WINAPI
-libAVEnumPins_Clone(libAVEnumPins *this, libAVEnumPins **pins)
+long ff_dshow_enumpins_Clone(DShowEnumPins *this, DShowEnumPins **pins)
{
- libAVEnumPins *new;
- dshowdebug("libAVEnumPins_Clone(%p)\n", this);
+ DShowEnumPins *new;
+ dshowdebug("ff_dshow_enumpins_Clone(%p)\n", this);
if (!pins)
return E_POINTER;
- new = libAVEnumPins_Create(this->pin, this->filter);
+ new = ff_dshow_enumpins_Create(this->pin, this->filter);
if (!new)
return E_OUTOFMEMORY;
new->pos = this->pos;
@@ -76,30 +72,28 @@ libAVEnumPins_Clone(libAVEnumPins *this, libAVEnumPins **pins)
return S_OK;
}
-static int
-libAVEnumPins_Setup(libAVEnumPins *this, libAVPin *pin, libAVFilter *filter)
+static int ff_dshow_enumpins_Setup(DShowEnumPins *this, DShowPin *pin, DShowFilter *filter)
{
IEnumPinsVtbl *vtbl = this->vtbl;
- SETVTBL(vtbl, libAVEnumPins, QueryInterface);
- SETVTBL(vtbl, libAVEnumPins, AddRef);
- SETVTBL(vtbl, libAVEnumPins, Release);
- SETVTBL(vtbl, libAVEnumPins, Next);
- SETVTBL(vtbl, libAVEnumPins, Skip);
- SETVTBL(vtbl, libAVEnumPins, Reset);
- SETVTBL(vtbl, libAVEnumPins, Clone);
+ SETVTBL(vtbl, enumpins, QueryInterface);
+ SETVTBL(vtbl, enumpins, AddRef);
+ SETVTBL(vtbl, enumpins, Release);
+ SETVTBL(vtbl, enumpins, Next);
+ SETVTBL(vtbl, enumpins, Skip);
+ SETVTBL(vtbl, enumpins, Reset);
+ SETVTBL(vtbl, enumpins, Clone);
this->pin = pin;
this->filter = filter;
- libAVFilter_AddRef(this->filter);
+ ff_dshow_filter_AddRef(this->filter);
return 1;
}
-static int
-libAVEnumPins_Cleanup(libAVEnumPins *this)
+static int ff_dshow_enumpins_Cleanup(DShowEnumPins *this)
{
- libAVFilter_Release(this->filter);
+ ff_dshow_filter_Release(this->filter);
return 1;
}
-DECLARE_CREATE(libAVEnumPins, libAVEnumPins_Setup(this, pin, filter),
- libAVPin *pin, libAVFilter *filter)
-DECLARE_DESTROY(libAVEnumPins, libAVEnumPins_Cleanup)
+DECLARE_CREATE(enumpins, DShowEnumPins, ff_dshow_enumpins_Setup(this, pin, filter),
+ DShowPin *pin, DShowFilter *filter)
+DECLARE_DESTROY(enumpins, DShowEnumPins, ff_dshow_enumpins_Cleanup)
diff --git a/libavdevice/dshow_filter.c b/libavdevice/dshow_filter.c
index db4bff60f8..61e057a836 100644
--- a/libavdevice/dshow_filter.c
+++ b/libavdevice/dshow_filter.c
@@ -21,53 +21,47 @@
#include "dshow_capture.h"
-DECLARE_QUERYINTERFACE(libAVFilter,
+DECLARE_QUERYINTERFACE(filter, DShowFilter,
{ {&IID_IUnknown,0}, {&IID_IBaseFilter,0} })
-DECLARE_ADDREF(libAVFilter)
-DECLARE_RELEASE(libAVFilter)
+DECLARE_ADDREF(filter, DShowFilter)
+DECLARE_RELEASE(filter, DShowFilter)
-long WINAPI
-libAVFilter_GetClassID(libAVFilter *this, CLSID *id)
+long ff_dshow_filter_GetClassID(DShowFilter *this, CLSID *id)
{
- dshowdebug("libAVFilter_GetClassID(%p)\n", this);
+ dshowdebug("ff_dshow_filter_GetClassID(%p)\n", this);
/* I'm not creating a ClassID just for this. */
return E_FAIL;
}
-long WINAPI
-libAVFilter_Stop(libAVFilter *this)
+long ff_dshow_filter_Stop(DShowFilter *this)
{
- dshowdebug("libAVFilter_Stop(%p)\n", this);
+ dshowdebug("ff_dshow_filter_Stop(%p)\n", this);
this->state = State_Stopped;
return S_OK;
}
-long WINAPI
-libAVFilter_Pause(libAVFilter *this)
+long ff_dshow_filter_Pause(DShowFilter *this)
{
- dshowdebug("libAVFilter_Pause(%p)\n", this);
+ dshowdebug("ff_dshow_filter_Pause(%p)\n", this);
this->state = State_Paused;
return S_OK;
}
-long WINAPI
-libAVFilter_Run(libAVFilter *this, REFERENCE_TIME start)
+long ff_dshow_filter_Run(DShowFilter *this, REFERENCE_TIME start)
{
- dshowdebug("libAVFilter_Run(%p) %"PRId64"\n", this, start);
+ dshowdebug("ff_dshow_filter_Run(%p) %"PRId64"\n", this, start);
this->state = State_Running;
this->start_time = start;
return S_OK;
}
-long WINAPI
-libAVFilter_GetState(libAVFilter *this, DWORD ms, FILTER_STATE *state)
+long ff_dshow_filter_GetState(DShowFilter *this, DWORD ms, FILTER_STATE *state)
{
- dshowdebug("libAVFilter_GetState(%p)\n", this);
+ dshowdebug("ff_dshow_filter_GetState(%p)\n", this);
if (!state)
return E_POINTER;
*state = this->state;
return S_OK;
}
-long WINAPI
-libAVFilter_SetSyncSource(libAVFilter *this, IReferenceClock *clock)
+long ff_dshow_filter_SetSyncSource(DShowFilter *this, IReferenceClock *clock)
{
- dshowdebug("libAVFilter_SetSyncSource(%p)\n", this);
+ dshowdebug("ff_dshow_filter_SetSyncSource(%p)\n", this);
if (this->clock != clock) {
if (this->clock)
@@ -79,10 +73,9 @@ libAVFilter_SetSyncSource(libAVFilter *this, IReferenceClock *clock)
return S_OK;
}
-long WINAPI
-libAVFilter_GetSyncSource(libAVFilter *this, IReferenceClock **clock)
+long ff_dshow_filter_GetSyncSource(DShowFilter *this, IReferenceClock **clock)
{
- dshowdebug("libAVFilter_GetSyncSource(%p)\n", this);
+ dshowdebug("ff_dshow_filter_GetSyncSource(%p)\n", this);
if (!clock)
return E_POINTER;
@@ -92,32 +85,30 @@ libAVFilter_GetSyncSource(libAVFilter *this, IReferenceClock **clock)
return S_OK;
}
-long WINAPI
-libAVFilter_EnumPins(libAVFilter *this, IEnumPins **enumpin)
+long ff_dshow_filter_EnumPins(DShowFilter *this, IEnumPins **enumpin)
{
- libAVEnumPins *new;
- dshowdebug("libAVFilter_EnumPins(%p)\n", this);
+ DShowEnumPins *new;
+ dshowdebug("ff_dshow_filter_EnumPins(%p)\n", this);
if (!enumpin)
return E_POINTER;
- new = libAVEnumPins_Create(this->pin, this);
+ new = ff_dshow_enumpins_Create(this->pin, this);
if (!new)
return E_OUTOFMEMORY;
*enumpin = (IEnumPins *) new;
return S_OK;
}
-long WINAPI
-libAVFilter_FindPin(libAVFilter *this, const wchar_t *id, IPin **pin)
+long ff_dshow_filter_FindPin(DShowFilter *this, const wchar_t *id, IPin **pin)
{
- libAVPin *found = NULL;
- dshowdebug("libAVFilter_FindPin(%p)\n", this);
+ DShowPin *found = NULL;
+ dshowdebug("ff_dshow_filter_FindPin(%p)\n", this);
if (!id || !pin)
return E_POINTER;
if (!wcscmp(id, L"In")) {
found = this->pin;
- libAVPin_AddRef(found);
+ ff_dshow_pin_AddRef(found);
}
*pin = (IPin *) found;
if (!found)
@@ -125,10 +116,9 @@ libAVFilter_FindPin(libAVFilter *this, const wchar_t *id, IPin **pin)
return S_OK;
}
-long WINAPI
-libAVFilter_QueryFilterInfo(libAVFilter *this, FILTER_INFO *info)
+long ff_dshow_filter_QueryFilterInfo(DShowFilter *this, FILTER_INFO *info)
{
- dshowdebug("libAVFilter_QueryFilterInfo(%p)\n", this);
+ dshowdebug("ff_dshow_filter_QueryFilterInfo(%p)\n", this);
if (!info)
return E_POINTER;
@@ -138,11 +128,10 @@ libAVFilter_QueryFilterInfo(libAVFilter *this, FILTER_INFO *info)
return S_OK;
}
-long WINAPI
-libAVFilter_JoinFilterGraph(libAVFilter *this, IFilterGraph *graph,
+long ff_dshow_filter_JoinFilterGraph(DShowFilter *this, IFilterGraph *graph,
const wchar_t *name)
{
- dshowdebug("libAVFilter_JoinFilterGraph(%p)\n", this);
+ dshowdebug("ff_dshow_filter_JoinFilterGraph(%p)\n", this);
this->info.pGraph = graph;
if (name)
@@ -150,10 +139,9 @@ libAVFilter_JoinFilterGraph(libAVFilter *this, IFilterGraph *graph,
return S_OK;
}
-long WINAPI
-libAVFilter_QueryVendorInfo(libAVFilter *this, wchar_t **info)
+long ff_dshow_filter_QueryVendorInfo(DShowFilter *this, wchar_t **info)
{
- dshowdebug("libAVFilter_QueryVendorInfo(%p)\n", this);
+ dshowdebug("ff_dshow_filter_QueryVendorInfo(%p)\n", this);
if (!info)
return E_POINTER;
@@ -161,27 +149,27 @@ libAVFilter_QueryVendorInfo(libAVFilter *this, wchar_t **info)
}
static int
-libAVFilter_Setup(libAVFilter *this, void *priv_data, void *callback,
+ff_dshow_filter_Setup(DShowFilter *this, void *priv_data, void *callback,
enum dshowDeviceType type)
{
IBaseFilterVtbl *vtbl = this->vtbl;
- SETVTBL(vtbl, libAVFilter, QueryInterface);
- SETVTBL(vtbl, libAVFilter, AddRef);
- SETVTBL(vtbl, libAVFilter, Release);
- SETVTBL(vtbl, libAVFilter, GetClassID);
- SETVTBL(vtbl, libAVFilter, Stop);
- SETVTBL(vtbl, libAVFilter, Pause);
- SETVTBL(vtbl, libAVFilter, Run);
- SETVTBL(vtbl, libAVFilter, GetState);
- SETVTBL(vtbl, libAVFilter, SetSyncSource);
- SETVTBL(vtbl, libAVFilter, GetSyncSource);
- SETVTBL(vtbl, libAVFilter, EnumPins);
- SETVTBL(vtbl, libAVFilter, FindPin);
- SETVTBL(vtbl, libAVFilter, QueryFilterInfo);
- SETVTBL(vtbl, libAVFilter, JoinFilterGraph);
- SETVTBL(vtbl, libAVFilter, QueryVendorInfo);
-
- this->pin = libAVPin_Create(this);
+ SETVTBL(vtbl, filter, QueryInterface);
+ SETVTBL(vtbl, filter, AddRef);
+ SETVTBL(vtbl, filter, Release);
+ SETVTBL(vtbl, filter, GetClassID);
+ SETVTBL(vtbl, filter, Stop);
+ SETVTBL(vtbl, filter, Pause);
+ SETVTBL(vtbl, filter, Run);
+ SETVTBL(vtbl, filter, GetState);
+ SETVTBL(vtbl, filter, SetSyncSource);
+ SETVTBL(vtbl, filter, GetSyncSource);
+ SETVTBL(vtbl, filter, EnumPins);
+ SETVTBL(vtbl, filter, FindPin);
+ SETVTBL(vtbl, filter, QueryFilterInfo);
+ SETVTBL(vtbl, filter, JoinFilterGraph);
+ SETVTBL(vtbl, filter, QueryVendorInfo);
+
+ this->pin = ff_dshow_pin_Create(this);
this->priv_data = priv_data;
this->callback = callback;
@@ -189,12 +177,11 @@ libAVFilter_Setup(libAVFilter *this, void *priv_data, void *callback,
return 1;
}
-static int
-libAVFilter_Cleanup(libAVFilter *this)
+static int ff_dshow_filter_Cleanup(DShowFilter *this)
{
- libAVPin_Release(this->pin);
+ ff_dshow_pin_Release(this->pin);
return 1;
}
-DECLARE_CREATE(libAVFilter, libAVFilter_Setup(this, priv_data, callback, type),
+DECLARE_CREATE(filter, DShowFilter, ff_dshow_filter_Setup(this, priv_data, callback, type),
void *priv_data, void *callback, enum dshowDeviceType type)
-DECLARE_DESTROY(libAVFilter, libAVFilter_Cleanup)
+DECLARE_DESTROY(filter, DShowFilter, ff_dshow_filter_Cleanup)
diff --git a/libavdevice/dshow_pin.c b/libavdevice/dshow_pin.c
index 53b1c9150d..3dae405e65 100644
--- a/libavdevice/dshow_pin.c
+++ b/libavdevice/dshow_pin.c
@@ -22,26 +22,24 @@
#include "dshow_capture.h"
#include <stddef.h>
-#define imemoffset offsetof(libAVPin, imemvtbl)
+#define imemoffset offsetof(DShowPin, imemvtbl)
-DECLARE_QUERYINTERFACE(libAVPin,
+DECLARE_QUERYINTERFACE(pin, DShowPin,
{ {&IID_IUnknown,0}, {&IID_IPin,0}, {&IID_IMemInputPin,imemoffset} })
-DECLARE_ADDREF(libAVPin)
-DECLARE_RELEASE(libAVPin)
+DECLARE_ADDREF(pin, DShowPin)
+DECLARE_RELEASE(pin, DShowPin)
-long WINAPI
-libAVPin_Connect(libAVPin *this, IPin *pin, const AM_MEDIA_TYPE *type)
+long ff_dshow_pin_Connect(DShowPin *this, IPin *pin, const AM_MEDIA_TYPE *type)
{
- dshowdebug("libAVPin_Connect(%p, %p, %p)\n", this, pin, type);
+ dshowdebug("ff_dshow_pin_Connect(%p, %p, %p)\n", this, pin, type);
/* Input pins receive connections. */
return S_FALSE;
}
-long WINAPI
-libAVPin_ReceiveConnection(libAVPin *this, IPin *pin,
+long ff_dshow_pin_ReceiveConnection(DShowPin *this, IPin *pin,
const AM_MEDIA_TYPE *type)
{
enum dshowDeviceType devtype = this->filter->type;
- dshowdebug("libAVPin_ReceiveConnection(%p)\n", this);
+ dshowdebug("ff_dshow_pin_ReceiveConnection(%p)\n", this);
if (!pin)
return E_POINTER;
@@ -64,10 +62,9 @@ libAVPin_ReceiveConnection(libAVPin *this, IPin *pin,
return S_OK;
}
-long WINAPI
-libAVPin_Disconnect(libAVPin *this)
+long ff_dshow_pin_Disconnect(DShowPin *this)
{
- dshowdebug("libAVPin_Disconnect(%p)\n", this);
+ dshowdebug("ff_dshow_pin_Disconnect(%p)\n", this);
if (this->filter->state != State_Stopped)
return VFW_E_NOT_STOPPED;
@@ -78,10 +75,9 @@ libAVPin_Disconnect(libAVPin *this)
return S_OK;
}
-long WINAPI
-libAVPin_ConnectedTo(libAVPin *this, IPin **pin)
+long ff_dshow_pin_ConnectedTo(DShowPin *this, IPin **pin)
{
- dshowdebug("libAVPin_ConnectedTo(%p)\n", this);
+ dshowdebug("ff_dshow_pin_ConnectedTo(%p)\n", this);
if (!pin)
return E_POINTER;
@@ -92,10 +88,9 @@ libAVPin_ConnectedTo(libAVPin *this, IPin **pin)
return S_OK;
}
-long WINAPI
-libAVPin_ConnectionMediaType(libAVPin *this, AM_MEDIA_TYPE *type)
+long ff_dshow_pin_ConnectionMediaType(DShowPin *this, AM_MEDIA_TYPE *type)
{
- dshowdebug("libAVPin_ConnectionMediaType(%p)\n", this);
+ dshowdebug("ff_dshow_pin_ConnectionMediaType(%p)\n", this);
if (!type)
return E_POINTER;
@@ -104,16 +99,15 @@ libAVPin_ConnectionMediaType(libAVPin *this, AM_MEDIA_TYPE *type)
return ff_copy_dshow_media_type(type, &this->type);
}
-long WINAPI
-libAVPin_QueryPinInfo(libAVPin *this, PIN_INFO *info)
+long ff_dshow_pin_QueryPinInfo(DShowPin *this, PIN_INFO *info)
{
- dshowdebug("libAVPin_QueryPinInfo(%p)\n", this);
+ dshowdebug("ff_dshow_pin_QueryPinInfo(%p)\n", this);
if (!info)
return E_POINTER;
if (this->filter)
- libAVFilter_AddRef(this->filter);
+ ff_dshow_filter_AddRef(this->filter);
info->pFilter = (IBaseFilter *) this->filter;
info->dir = PINDIR_INPUT;
@@ -121,19 +115,17 @@ libAVPin_QueryPinInfo(libAVPin *this, PIN_INFO *info)
return S_OK;
}
-long WINAPI
-libAVPin_QueryDirection(libAVPin *this, PIN_DIRECTION *dir)
+long ff_dshow_pin_QueryDirection(DShowPin *this, PIN_DIRECTION *dir)
{
- dshowdebug("libAVPin_QueryDirection(%p)\n", this);
+ dshowdebug("ff_dshow_pin_QueryDirection(%p)\n", this);
if (!dir)
return E_POINTER;
*dir = PINDIR_INPUT;
return S_OK;
}
-long WINAPI
-libAVPin_QueryId(libAVPin *this, wchar_t **id)
+long ff_dshow_pin_QueryId(DShowPin *this, wchar_t **id)
{
- dshowdebug("libAVPin_QueryId(%p)\n", this);
+ dshowdebug("ff_dshow_pin_QueryId(%p)\n", this);
if (!id)
return E_POINTER;
@@ -142,67 +134,59 @@ libAVPin_QueryId(libAVPin *this, wchar_t **id)
return S_OK;
}
-long WINAPI
-libAVPin_QueryAccept(libAVPin *this, const AM_MEDIA_TYPE *type)
+long ff_dshow_pin_QueryAccept(DShowPin *this, const AM_MEDIA_TYPE *type)
{
- dshowdebug("libAVPin_QueryAccept(%p)\n", this);
+ dshowdebug("ff_dshow_pin_QueryAccept(%p)\n", this);
return S_FALSE;
}
-long WINAPI
-libAVPin_EnumMediaTypes(libAVPin *this, IEnumMediaTypes **enumtypes)
+long ff_dshow_pin_EnumMediaTypes(DShowPin *this, IEnumMediaTypes **enumtypes)
{
const AM_MEDIA_TYPE *type = NULL;
- libAVEnumMediaTypes *new;
- dshowdebug("libAVPin_EnumMediaTypes(%p)\n", this);
+ DShowEnumMediaTypes *new;
+ dshowdebug("ff_dshow_pin_EnumMediaTypes(%p)\n", this);
if (!enumtypes)
return E_POINTER;
- new = libAVEnumMediaTypes_Create(type);
+ new = ff_dshow_enummediatypes_Create(type);
if (!new)
return E_OUTOFMEMORY;
*enumtypes = (IEnumMediaTypes *) new;
return S_OK;
}
-long WINAPI
-libAVPin_QueryInternalConnections(libAVPin *this, IPin **pin,
+long ff_dshow_pin_QueryInternalConnections(DShowPin *this, IPin **pin,
unsigned long *npin)
{
- dshowdebug("libAVPin_QueryInternalConnections(%p)\n", this);
+ dshowdebug("ff_dshow_pin_QueryInternalConnections(%p)\n", this);
return E_NOTIMPL;
}
-long WINAPI
-libAVPin_EndOfStream(libAVPin *this)
+long ff_dshow_pin_EndOfStream(DShowPin *this)
{
- dshowdebug("libAVPin_EndOfStream(%p)\n", this);
+ dshowdebug("ff_dshow_pin_EndOfStream(%p)\n", this);
/* I don't care. */
return S_OK;
}
-long WINAPI
-libAVPin_BeginFlush(libAVPin *this)
+long ff_dshow_pin_BeginFlush(DShowPin *this)
{
- dshowdebug("libAVPin_BeginFlush(%p)\n", this);
+ dshowdebug("ff_dshow_pin_BeginFlush(%p)\n", this);
/* I don't care. */
return S_OK;
}
-long WINAPI
-libAVPin_EndFlush(libAVPin *this)
+long ff_dshow_pin_EndFlush(DShowPin *this)
{
- dshowdebug("libAVPin_EndFlush(%p)\n", this);
+ dshowdebug("ff_dshow_pin_EndFlush(%p)\n", this);
/* I don't care. */
return S_OK;
}
-long WINAPI
-libAVPin_NewSegment(libAVPin *this, REFERENCE_TIME start, REFERENCE_TIME stop,
+long ff_dshow_pin_NewSegment(DShowPin *this, REFERENCE_TIME start, REFERENCE_TIME stop,
double rate)
{
- dshowdebug("libAVPin_NewSegment(%p)\n", this);
+ dshowdebug("ff_dshow_pin_NewSegment(%p)\n", this);
/* I don't care. */
return S_OK;
}
-static int
-libAVPin_Setup(libAVPin *this, libAVFilter *filter)
+static int ff_dshow_pin_Setup(DShowPin *this, DShowFilter *filter)
{
IPinVtbl *vtbl = this->vtbl;
IMemInputPinVtbl *imemvtbl;
@@ -214,44 +198,43 @@ libAVPin_Setup(libAVPin *this, libAVFilter *filter)
if (!imemvtbl)
return 0;
- SETVTBL(imemvtbl, libAVMemInputPin, QueryInterface);
- SETVTBL(imemvtbl, libAVMemInputPin, AddRef);
- SETVTBL(imemvtbl, libAVMemInputPin, Release);
- SETVTBL(imemvtbl, libAVMemInputPin, GetAllocator);
- SETVTBL(imemvtbl, libAVMemInputPin, NotifyAllocator);
- SETVTBL(imemvtbl, libAVMemInputPin, GetAllocatorRequirements);
- SETVTBL(imemvtbl, libAVMemInputPin, Receive);
- SETVTBL(imemvtbl, libAVMemInputPin, ReceiveMultiple);
- SETVTBL(imemvtbl, libAVMemInputPin, ReceiveCanBlock);
+ SETVTBL(imemvtbl, meminputpin, QueryInterface);
+ SETVTBL(imemvtbl, meminputpin, AddRef);
+ SETVTBL(imemvtbl, meminputpin, Release);
+ SETVTBL(imemvtbl, meminputpin, GetAllocator);
+ SETVTBL(imemvtbl, meminputpin, NotifyAllocator);
+ SETVTBL(imemvtbl, meminputpin, GetAllocatorRequirements);
+ SETVTBL(imemvtbl, meminputpin, Receive);
+ SETVTBL(imemvtbl, meminputpin, ReceiveMultiple);
+ SETVTBL(imemvtbl, meminputpin, ReceiveCanBlock);
this->imemvtbl = imemvtbl;
- SETVTBL(vtbl, libAVPin, QueryInterface);
- SETVTBL(vtbl, libAVPin, AddRef);
- SETVTBL(vtbl, libAVPin, Release);
- SETVTBL(vtbl, libAVPin, Connect);
- SETVTBL(vtbl, libAVPin, ReceiveConnection);
- SETVTBL(vtbl, libAVPin, Disconnect);
- SETVTBL(vtbl, libAVPin, ConnectedTo);
- SETVTBL(vtbl, libAVPin, ConnectionMediaType);
- SETVTBL(vtbl, libAVPin, QueryPinInfo);
- SETVTBL(vtbl, libAVPin, QueryDirection);
- SETVTBL(vtbl, libAVPin, QueryId);
- SETVTBL(vtbl, libAVPin, QueryAccept);
- SETVTBL(vtbl, libAVPin, EnumMediaTypes);
- SETVTBL(vtbl, libAVPin, QueryInternalConnections);
- SETVTBL(vtbl, libAVPin, EndOfStream);
- SETVTBL(vtbl, libAVPin, BeginFlush);
- SETVTBL(vtbl, libAVPin, EndFlush);
- SETVTBL(vtbl, libAVPin, NewSegment);
+ SETVTBL(vtbl, pin, QueryInterface);
+ SETVTBL(vtbl, pin, AddRef);
+ SETVTBL(vtbl, pin, Release);
+ SETVTBL(vtbl, pin, Connect);
+ SETVTBL(vtbl, pin, ReceiveConnection);
+ SETVTBL(vtbl, pin, Disconnect);
+ SETVTBL(vtbl, pin, ConnectedTo);
+ SETVTBL(vtbl, pin, ConnectionMediaType);
+ SETVTBL(vtbl, pin, QueryPinInfo);
+ SETVTBL(vtbl, pin, QueryDirection);
+ SETVTBL(vtbl, pin, QueryId);
+ SETVTBL(vtbl, pin, QueryAccept);
+ SETVTBL(vtbl, pin, EnumMediaTypes);
+ SETVTBL(vtbl, pin, QueryInternalConnections);
+ SETVTBL(vtbl, pin, EndOfStream);
+ SETVTBL(vtbl, pin, BeginFlush);
+ SETVTBL(vtbl, pin, EndFlush);
+ SETVTBL(vtbl, pin, NewSegment);
this->filter = filter;
return 1;
}
-static void
-libAVPin_Free(libAVPin *this)
+static void ff_dshow_pin_Free(DShowPin *this)
{
if (!this)
return;
@@ -261,58 +244,51 @@ libAVPin_Free(libAVPin *this)
this->type.pbFormat = NULL;
}
}
-DECLARE_CREATE(libAVPin, libAVPin_Setup(this, filter), libAVFilter *filter)
-DECLARE_DESTROY(libAVPin, libAVPin_Free)
+DECLARE_CREATE(pin, DShowPin, ff_dshow_pin_Setup(this, filter), DShowFilter *filter)
+DECLARE_DESTROY(pin, DShowPin, ff_dshow_pin_Free)
/*****************************************************************************
- * libAVMemInputPin
+ * DShowMemInputPin
****************************************************************************/
-long WINAPI
-libAVMemInputPin_QueryInterface(libAVMemInputPin *this, const GUID *riid,
+long ff_dshow_meminputpin_QueryInterface(DShowMemInputPin *this, const GUID *riid,
void **ppvObject)
{
- libAVPin *pin = (libAVPin *) ((uint8_t *) this - imemoffset);
- dshowdebug("libAVMemInputPin_QueryInterface(%p)\n", this);
- return libAVPin_QueryInterface(pin, riid, ppvObject);
+ DShowPin *pin = (DShowPin *) ((uint8_t *) this - imemoffset);
+ dshowdebug("ff_dshow_meminputpin_QueryInterface(%p)\n", this);
+ return ff_dshow_pin_QueryInterface(pin, riid, ppvObject);
}
-unsigned long WINAPI
-libAVMemInputPin_AddRef(libAVMemInputPin *this)
+unsigned long ff_dshow_meminputpin_AddRef(DShowMemInputPin *this)
{
- libAVPin *pin = (libAVPin *) ((uint8_t *) this - imemoffset);
- dshowdebug("libAVMemInputPin_AddRef(%p)\n", this);
- return libAVPin_AddRef(pin);
+ DShowPin *pin = (DShowPin *) ((uint8_t *) this - imemoffset);
+ dshowdebug("ff_dshow_meminputpin_AddRef(%p)\n", this);
+ return ff_dshow_pin_AddRef(pin);
}
-unsigned long WINAPI
-libAVMemInputPin_Release(libAVMemInputPin *this)
+unsigned long ff_dshow_meminputpin_Release(DShowMemInputPin *this)
{
- libAVPin *pin = (libAVPin *) ((uint8_t *) this - imemoffset);
- dshowdebug("libAVMemInputPin_Release(%p)\n", this);
- return libAVPin_Release(pin);
+ DShowPin *pin = (DShowPin *) ((uint8_t *) this - imemoffset);
+ dshowdebug("ff_dshow_meminputpin_Release(%p)\n", this);
+ return ff_dshow_pin_Release(pin);
}
-long WINAPI
-libAVMemInputPin_GetAllocator(libAVMemInputPin *this, IMemAllocator **alloc)
+long ff_dshow_meminputpin_GetAllocator(DShowMemInputPin *this, IMemAllocator **alloc)
{
- dshowdebug("libAVMemInputPin_GetAllocator(%p)\n", this);
+ dshowdebug("ff_dshow_meminputpin_GetAllocator(%p)\n", this);
return VFW_E_NO_ALLOCATOR;
}
-long WINAPI
-libAVMemInputPin_NotifyAllocator(libAVMemInputPin *this, IMemAllocator *alloc,
+long ff_dshow_meminputpin_NotifyAllocator(DShowMemInputPin *this, IMemAllocator *alloc,
BOOL rdwr)
{
- dshowdebug("libAVMemInputPin_NotifyAllocator(%p)\n", this);
+ dshowdebug("ff_dshow_meminputpin_NotifyAllocator(%p)\n", this);
return S_OK;
}
-long WINAPI
-libAVMemInputPin_GetAllocatorRequirements(libAVMemInputPin *this,
+long ff_dshow_meminputpin_GetAllocatorRequirements(DShowMemInputPin *this,
ALLOCATOR_PROPERTIES *props)
{
- dshowdebug("libAVMemInputPin_GetAllocatorRequirements(%p)\n", this);
+ dshowdebug("ff_dshow_meminputpin_GetAllocatorRequirements(%p)\n", this);
return E_NOTIMPL;
}
-long WINAPI
-libAVMemInputPin_Receive(libAVMemInputPin *this, IMediaSample *sample)
+long ff_dshow_meminputpin_Receive(DShowMemInputPin *this, IMediaSample *sample)
{
- libAVPin *pin = (libAVPin *) ((uint8_t *) this - imemoffset);
+ DShowPin *pin = (DShowPin *) ((uint8_t *) this - imemoffset);
enum dshowDeviceType devtype = pin->filter->type;
void *priv_data;
AVFormatContext *s;
@@ -328,7 +304,7 @@ libAVMemInputPin_Receive(libAVMemInputPin *this, IMediaSample *sample)
struct dshow_ctx *ctx;
- dshowdebug("libAVMemInputPin_Receive(%p)\n", this);
+ dshowdebug("ff_dshow_meminputpin_Receive(%p)\n", this);
if (!sample)
return E_POINTER;
@@ -366,31 +342,28 @@ libAVMemInputPin_Receive(libAVMemInputPin *this, IMediaSample *sample)
return S_OK;
}
-long WINAPI
-libAVMemInputPin_ReceiveMultiple(libAVMemInputPin *this,
+long ff_dshow_meminputpin_ReceiveMultiple(DShowMemInputPin *this,
IMediaSample **samples, long n, long *nproc)
{
int i;
- dshowdebug("libAVMemInputPin_ReceiveMultiple(%p)\n", this);
+ dshowdebug("ff_dshow_meminputpin_ReceiveMultiple(%p)\n", this);
for (i = 0; i < n; i++)
- libAVMemInputPin_Receive(this, samples[i]);
+ ff_dshow_meminputpin_Receive(this, samples[i]);
*nproc = n;
return S_OK;
}
-long WINAPI
-libAVMemInputPin_ReceiveCanBlock(libAVMemInputPin *this)
+long ff_dshow_meminputpin_ReceiveCanBlock(DShowMemInputPin *this)
{
- dshowdebug("libAVMemInputPin_ReceiveCanBlock(%p)\n", this);
+ dshowdebug("ff_dshow_meminputpin_ReceiveCanBlock(%p)\n", this);
/* I swear I will not block. */
return S_FALSE;
}
-void
-libAVMemInputPin_Destroy(libAVMemInputPin *this)
+void ff_dshow_meminputpin_Destroy(DShowMemInputPin *this)
{
- libAVPin *pin = (libAVPin *) ((uint8_t *) this - imemoffset);
- dshowdebug("libAVMemInputPin_Destroy(%p)\n", this);
- libAVPin_Destroy(pin);
+ DShowPin *pin = (DShowPin *) ((uint8_t *) this - imemoffset);
+ dshowdebug("ff_dshow_meminputpin_Destroy(%p)\n", this);
+ ff_dshow_pin_Destroy(pin);
}
1
0
ffmpeg | branch: master | James Almer <jamrial(a)gmail.com> | Sun Jan 24 20:45:18 2021 -0300| [56709ca8aaffed529b62b2afa4288325d64dae57] | committer: James Almer
avcodec: deprecate AVCodecContext.debug_mv
It's been unused for almost three years now.
Signed-off-by: James Almer <jamrial(a)gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=56709ca8aaffed529…
---
doc/APIchanges | 4 ++++
libavcodec/avcodec.h | 7 ++++---
libavcodec/pthread_frame.c | 1 -
libavcodec/version.h | 5 ++++-
4 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index bbf56a5385..1509c9b8cb 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,10 @@ libavutil: 2017-10-21
API changes, most recent first:
+2021-01-25 - xxxxxxxxxx - lavc 58.119.100 - avcodec.h
+ Deprecate AVCodecContext.debug_mv, FF_DEBUG_VIS_MV_P_FOR, FF_DEBUG_VIS_MV_B_FOR,
+ FF_DEBUG_VIS_MV_B_BACK
+
2021-01-11 - xxxxxxxxxx - lavc 58.116.100 - avcodec.h
Add FF_PROFILE_VVC_MAIN_10 and FF_PROFILE_VVC_MAIN_10_444.
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index dc8738c819..eafc2e84e3 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2141,15 +2141,16 @@ typedef struct AVCodecContext {
*/
int seek_preroll;
+#if FF_API_DEBUG_MV
/**
- * debug motion vectors
- * - encoding: Set by user.
- * - decoding: Set by user.
+ * @deprecated unused
*/
+ attribute_deprecated
int debug_mv;
#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames
#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames
#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
+#endif
/**
* custom intra quantization matrix
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index a570e25e0d..4429a4d59c 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -342,7 +342,6 @@ static int update_context_from_user(AVCodecContext *dst, AVCodecContext *src)
dst->opaque = src->opaque;
dst->debug = src->debug;
- dst->debug_mv = src->debug_mv;
dst->slice_flags = src->slice_flags;
dst->flags2 = src->flags2;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index c0ce9f1865..866932cb84 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 58
-#define LIBAVCODEC_VERSION_MINOR 118
+#define LIBAVCODEC_VERSION_MINOR 119
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
@@ -147,5 +147,8 @@
#ifndef FF_API_THREAD_SAFE_CALLBACKS
#define FF_API_THREAD_SAFE_CALLBACKS (LIBAVCODEC_VERSION_MAJOR < 60)
#endif
+#ifndef FF_API_DEBUG_MV
+#define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 60)
+#endif
#endif /* AVCODEC_VERSION_H */
1
0
ffmpeg | branch: master | James Almer <jamrial(a)gmail.com> | Sun Jan 24 19:34:56 2021 -0300| [c3f3b562c92ed8422f2db085f7d2a4a618e1e2d4] | committer: James Almer
avcodec: remove long dead debug_mv code
FF_API_DEBUG_MV has been zero since ffmpeg 4.0
Signed-off-by: James Almer <jamrial(a)gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c3f3b562c92ed8422…
---
fftools/ffmpeg.c | 6 +--
libavcodec/avcodec.h | 24 ---------
libavcodec/mpegpicture.c | 3 --
libavcodec/mpegutils.c | 128 ---------------------------------------------
libavcodec/options_table.h | 7 ---
libavcodec/pthread_frame.c | 4 --
libavcodec/version.h | 3 --
7 files changed, 1 insertion(+), 174 deletions(-)
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 4419c68d11..d7c833be63 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -4032,11 +4032,7 @@ static int check_keyboard_interaction(int64_t cur_time)
if(key == 'D') {
debug = input_streams[0]->dec_ctx->debug << 1;
if(!debug) debug = 1;
- while(debug & (FF_DEBUG_DCT_COEFF
-#if FF_API_DEBUG_MV
- |FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE
-#endif
- )) //unsupported, would just crash
+ while (debug & FF_DEBUG_DCT_COEFF) //unsupported, would just crash
debug += debug;
}else{
char buf[32];
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index fdb4276260..dc8738c819 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1619,39 +1619,17 @@ typedef struct AVCodecContext {
#define FF_DEBUG_BITSTREAM 4
#define FF_DEBUG_MB_TYPE 8
#define FF_DEBUG_QP 16
-#if FF_API_DEBUG_MV
-/**
- * @deprecated this option does nothing
- */
-#define FF_DEBUG_MV 32
-#endif
#define FF_DEBUG_DCT_COEFF 0x00000040
#define FF_DEBUG_SKIP 0x00000080
#define FF_DEBUG_STARTCODE 0x00000100
#define FF_DEBUG_ER 0x00000400
#define FF_DEBUG_MMCO 0x00000800
#define FF_DEBUG_BUGS 0x00001000
-#if FF_API_DEBUG_MV
-#define FF_DEBUG_VIS_QP 0x00002000
-#define FF_DEBUG_VIS_MB_TYPE 0x00004000
-#endif
#define FF_DEBUG_BUFFERS 0x00008000
#define FF_DEBUG_THREADS 0x00010000
#define FF_DEBUG_GREEN_MD 0x00800000
#define FF_DEBUG_NOMC 0x01000000
-#if FF_API_DEBUG_MV
- /**
- * debug
- * - encoding: Set by user.
- * - decoding: Set by user.
- */
- int debug_mv;
-#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 // visualize forward predicted MVs of P-frames
-#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 // visualize forward predicted MVs of B-frames
-#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 // visualize backward predicted MVs of B-frames
-#endif
-
/**
* Error recognition; may misdetect some more or less valid parts as errors.
* - encoding: unused
@@ -2163,7 +2141,6 @@ typedef struct AVCodecContext {
*/
int seek_preroll;
-#if !FF_API_DEBUG_MV
/**
* debug motion vectors
* - encoding: Set by user.
@@ -2173,7 +2150,6 @@ typedef struct AVCodecContext {
#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames
#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames
#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
-#endif
/**
* custom intra quantization matrix
diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c
index e495e315e6..e3f648895d 100644
--- a/libavcodec/mpegpicture.c
+++ b/libavcodec/mpegpicture.c
@@ -203,9 +203,6 @@ static int alloc_picture_tables(AVCodecContext *avctx, Picture *pic, int encodin
}
if (out_format == FMT_H263 || encoding ||
-#if FF_API_DEBUG_MV
- avctx->debug_mv ||
-#endif
(avctx->export_side_data & AV_CODEC_EXPORT_DATA_MVS)) {
int mv_size = 2 * (b8_array_size + 4) * sizeof(int16_t);
int ref_index_size = 4 * mb_array_size;
diff --git a/libavcodec/mpegutils.c b/libavcodec/mpegutils.c
index c0ee3aae85..e5105ecc58 100644
--- a/libavcodec/mpegutils.c
+++ b/libavcodec/mpegutils.c
@@ -262,132 +262,4 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_
av_log(avctx, AV_LOG_DEBUG, "\n");
}
}
-
-#if FF_API_DEBUG_MV
- if ((avctx->debug & (FF_DEBUG_VIS_QP | FF_DEBUG_VIS_MB_TYPE)) ||
- (avctx->debug_mv)) {
- int mb_y;
- int i, ret;
- int h_chroma_shift, v_chroma_shift, block_height;
- const int mv_sample_log2 = avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_SVQ3 ? 2 : 1;
- const int mv_stride = (mb_width << mv_sample_log2) +
- (avctx->codec->id == AV_CODEC_ID_H264 ? 0 : 1);
-
- if (low_delay)
- *low_delay = 0; // needed to see the vectors without trashing the buffers
-
- ret = av_pix_fmt_get_chroma_sub_sample (avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift);
- if (ret)
- return ret;
-
- av_frame_make_writable(pict);
-
- pict->opaque = NULL;
- block_height = 16 >> v_chroma_shift;
-
- for (mb_y = 0; mb_y < mb_height; mb_y++) {
- int mb_x;
- for (mb_x = 0; mb_x < mb_width; mb_x++) {
- const int mb_index = mb_x + mb_y * mb_stride;
- if ((avctx->debug & FF_DEBUG_VIS_QP)) {
- uint64_t c = (qscale_table[mb_index] * 128 / 31) *
- 0x0101010101010101ULL;
- int y;
- for (y = 0; y < block_height; y++) {
- *(uint64_t *)(pict->data[1] + 8 * mb_x +
- (block_height * mb_y + y) *
- pict->linesize[1]) = c;
- *(uint64_t *)(pict->data[2] + 8 * mb_x +
- (block_height * mb_y + y) *
- pict->linesize[2]) = c;
- }
- }
- if ((avctx->debug & FF_DEBUG_VIS_MB_TYPE) &&
- motion_val[0]) {
- int mb_type = mbtype_table[mb_index];
- uint64_t u,v;
- int y;
-#define COLOR(theta, r) \
- u = (int)(128 + r * cos(theta * M_PI / 180)); \
- v = (int)(128 + r * sin(theta * M_PI / 180));
-
-
- u = v = 128;
- if (IS_PCM(mb_type)) {
- COLOR(120, 48)
- } else if ((IS_INTRA(mb_type) && IS_ACPRED(mb_type)) ||
- IS_INTRA16x16(mb_type)) {
- COLOR(30, 48)
- } else if (IS_INTRA4x4(mb_type)) {
- COLOR(90, 48)
- } else if (IS_DIRECT(mb_type) && IS_SKIP(mb_type)) {
- // COLOR(120, 48)
- } else if (IS_DIRECT(mb_type)) {
- COLOR(150, 48)
- } else if (IS_GMC(mb_type) && IS_SKIP(mb_type)) {
- COLOR(170, 48)
- } else if (IS_GMC(mb_type)) {
- COLOR(190, 48)
- } else if (IS_SKIP(mb_type)) {
- // COLOR(180, 48)
- } else if (!USES_LIST(mb_type, 1)) {
- COLOR(240, 48)
- } else if (!USES_LIST(mb_type, 0)) {
- COLOR(0, 48)
- } else {
- av_assert2(USES_LIST(mb_type, 0) && USES_LIST(mb_type, 1));
- COLOR(300,48)
- }
-
- u *= 0x0101010101010101ULL;
- v *= 0x0101010101010101ULL;
- for (y = 0; y < block_height; y++) {
- *(uint64_t *)(pict->data[1] + 8 * mb_x +
- (block_height * mb_y + y) * pict->linesize[1]) = u;
- *(uint64_t *)(pict->data[2] + 8 * mb_x +
- (block_height * mb_y + y) * pict->linesize[2]) = v;
- }
-
- // segmentation
- if (IS_8X8(mb_type) || IS_16X8(mb_type)) {
- *(uint64_t *)(pict->data[0] + 16 * mb_x + 0 +
- (16 * mb_y + 8) * pict->linesize[0]) ^= 0x8080808080808080ULL;
- *(uint64_t *)(pict->data[0] + 16 * mb_x + 8 +
- (16 * mb_y + 8) * pict->linesize[0]) ^= 0x8080808080808080ULL;
- }
- if (IS_8X8(mb_type) || IS_8X16(mb_type)) {
- for (y = 0; y < 16; y++)
- pict->data[0][16 * mb_x + 8 + (16 * mb_y + y) *
- pict->linesize[0]] ^= 0x80;
- }
- if (IS_8X8(mb_type) && mv_sample_log2 >= 2) {
- int dm = 1 << (mv_sample_log2 - 2);
- for (i = 0; i < 4; i++) {
- int sx = mb_x * 16 + 8 * (i & 1);
- int sy = mb_y * 16 + 8 * (i >> 1);
- int xy = (mb_x * 2 + (i & 1) +
- (mb_y * 2 + (i >> 1)) * mv_stride) << (mv_sample_log2 - 1);
- // FIXME bidir
- int32_t *mv = (int32_t *) &motion_val[0][xy];
- if (mv[0] != mv[dm] ||
- mv[dm * mv_stride] != mv[dm * (mv_stride + 1)])
- for (y = 0; y < 8; y++)
- pict->data[0][sx + 4 + (sy + y) * pict->linesize[0]] ^= 0x80;
- if (mv[0] != mv[dm * mv_stride] || mv[dm] != mv[dm * (mv_stride + 1)])
- *(uint64_t *)(pict->data[0] + sx + (sy + 4) *
- pict->linesize[0]) ^= 0x8080808080808080ULL;
- }
- }
-
- if (IS_INTERLACED(mb_type) &&
- avctx->codec->id == AV_CODEC_ID_H264) {
- // hmm
- }
- }
- if (mbskip_table)
- mbskip_table[mb_index] = 0;
- }
- }
- }
-#endif
}
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index 1b9d39a3a7..61b4fb9e7f 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -208,9 +208,6 @@ static const AVOption avcodec_options[] = {
{"bitstream", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BITSTREAM }, INT_MIN, INT_MAX, V|D, "debug"},
{"mb_type", "macroblock (MB) type", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_MB_TYPE }, INT_MIN, INT_MAX, V|D, "debug"},
{"qp", "per-block quantization parameter (QP)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_QP }, INT_MIN, INT_MAX, V|D, "debug"},
-#if FF_API_DEBUG_MV
-{"mv", "motion vector", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_MV }, INT_MIN, INT_MAX, V|D, "debug"},
-#endif
{"dct_coeff", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_DCT_COEFF }, INT_MIN, INT_MAX, V|D, "debug"},
{"green_metadata", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_GREEN_MD }, INT_MIN, INT_MAX, V|D, "debug"},
{"skip", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_SKIP }, INT_MIN, INT_MAX, V|D, "debug"},
@@ -218,10 +215,6 @@ static const AVOption avcodec_options[] = {
{"er", "error recognition", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_ER }, INT_MIN, INT_MAX, V|D, "debug"},
{"mmco", "memory management control operations (H.264)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_MMCO }, INT_MIN, INT_MAX, V|D, "debug"},
{"bugs", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BUGS }, INT_MIN, INT_MAX, V|D, "debug"},
-#if FF_API_DEBUG_MV
-{"vis_qp", "visualize quantization parameter (QP), lower QP are tinted greener", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_QP }, INT_MIN, INT_MAX, V|D, "debug"},
-{"vis_mb_type", "visualize block types", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_MB_TYPE }, INT_MIN, INT_MAX, V|D, "debug"},
-#endif
{"buffers", "picture buffer allocations", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BUFFERS }, INT_MIN, INT_MAX, V|D, "debug"},
{"thread_ops", "threading operations", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_THREADS }, INT_MIN, INT_MAX, V|A|D, "debug"},
{"nomc", "skip motion compensation", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_NOMC }, INT_MIN, INT_MAX, V|A|D, "debug"},
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index c9d2e00ce3..a570e25e0d 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -774,10 +774,6 @@ int ff_frame_thread_init(AVCodecContext *avctx)
if (!thread_count) {
int nb_cpus = av_cpu_count();
-#if FF_API_DEBUG_MV
- if ((avctx->debug & (FF_DEBUG_VIS_QP | FF_DEBUG_VIS_MB_TYPE)) || avctx->debug_mv)
- nb_cpus = 1;
-#endif
// use number of cores + 1 as thread count if there is more than one
if (nb_cpus > 1)
thread_count = avctx->thread_count = FFMIN(nb_cpus + 1, MAX_AUTO_THREADS);
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 807062af7f..c0ce9f1865 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -54,9 +54,6 @@
#ifndef FF_API_LOWRES
#define FF_API_LOWRES (LIBAVCODEC_VERSION_MAJOR < 59)
#endif
-#ifndef FF_API_DEBUG_MV
-#define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 58)
-#endif
#ifndef FF_API_AVCTX_TIMEBASE
#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 59)
#endif
1
0
ffmpeg | branch: master | James Almer <jamrial(a)gmail.com> | Mon Jan 25 11:29:27 2021 -0300| [81d070dd09ce154d635414fd07d80a591266b421] | committer: James Almer
avcodec/dolby_e: split decoder and parser more thoroughly
Neither module should depend on the other.
Move shared functions to its own file for this purpose, and ensure
source files are compiled only when the required modules are enabled.
Signed-off-by: James Almer <jamrial(a)gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=81d070dd09ce154d6…
---
libavcodec/Makefile | 4 +-
libavcodec/dolby_e.c | 578 ++++++++++++++++++++++++++++++++-
libavcodec/dolby_e.h | 19 ++
libavcodec/dolby_e_parse.c | 180 +++++++++++
libavcodec/dolby_e_parser.c | 161 +---------
libavcodec/dolby_e_parser.h | 41 ---
libavcodec/dolby_e_parser_internal.h | 46 ---
libavcodec/dolby_edec.h | 607 -----------------------------------
8 files changed, 782 insertions(+), 854 deletions(-)
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 633ebc37f8..e2cd18632f 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -40,7 +40,6 @@ OBJS = ac3_parser.o \
d3d11va.o \
decode.o \
dirac.o \
- dolby_e_parser.o \
dv_profile.o \
encode.o \
imgconvert.o \
@@ -286,7 +285,7 @@ OBJS-$(CONFIG_DIRAC_DECODER) += diracdec.o dirac.o diracdsp.o diractab
OBJS-$(CONFIG_DFA_DECODER) += dfa.o
OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o dnxhddata.o
OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o
-OBJS-$(CONFIG_DOLBY_E_DECODER) += dolby_e.o kbdwin.o
+OBJS-$(CONFIG_DOLBY_E_DECODER) += dolby_e.o dolby_e_parse.o kbdwin.o
OBJS-$(CONFIG_DPX_DECODER) += dpx.o
OBJS-$(CONFIG_DPX_ENCODER) += dpxenc.o
OBJS-$(CONFIG_DSD_LSBF_DECODER) += dsddec.o dsd.o
@@ -1087,6 +1086,7 @@ OBJS-$(CONFIG_COOK_PARSER) += cook_parser.o
OBJS-$(CONFIG_DCA_PARSER) += dca_parser.o dca_exss.o dca.o
OBJS-$(CONFIG_DIRAC_PARSER) += dirac_parser.o
OBJS-$(CONFIG_DNXHD_PARSER) += dnxhd_parser.o dnxhddata.o
+OBJS-$(CONFIG_DOLBY_E_PARSER) += dolby_e_parser.o dolby_e_parse.o
OBJS-$(CONFIG_DPX_PARSER) += dpx_parser.o
OBJS-$(CONFIG_DVAUDIO_PARSER) += dvaudio_parser.o
OBJS-$(CONFIG_DVBSUB_PARSER) += dvbsub_parser.o
diff --git a/libavcodec/dolby_e.c b/libavcodec/dolby_e.c
index 74388f43d1..1dd69a2ec2 100644
--- a/libavcodec/dolby_e.c
+++ b/libavcodec/dolby_e.c
@@ -26,12 +26,584 @@
#include "internal.h"
#include "get_bits.h"
#include "put_bits.h"
-#include "parser.h"
#include "dolby_e.h"
-#include "dolby_edec.h"
-#include "dolby_e_parser_internal.h"
+#include "kbdwin.h"
#include "fft.h"
+#define MAX_SEGMENTS 2
+
+#define MAX_GROUPS 8
+#define MAX_EXPONENTS 304
+#define MAX_MANTISSAS 1024
+
+#define MAX_MSTR_EXP 2
+#define MAX_BIAS_EXP 50
+
+typedef struct DBEGroup {
+ uint8_t nb_exponent;
+ uint8_t nb_bias_exp[MAX_MSTR_EXP];
+ uint16_t exp_ofs;
+ uint16_t mnt_ofs;
+ const uint8_t *nb_mantissa;
+ uint8_t imdct_idx;
+ uint8_t imdct_phs;
+ uint16_t win_len;
+ uint16_t dst_ofs;
+ uint16_t win_ofs;
+ uint16_t src_ofs;
+} DBEGroup;
+
+typedef struct DBEChannel {
+ int gr_code;
+ int bw_code;
+
+ int nb_groups;
+ int nb_mstr_exp;
+ DBEGroup groups[MAX_GROUPS];
+
+ int exp_strategy[MAX_GROUPS];
+ int exponents[MAX_EXPONENTS];
+ int bap[MAX_EXPONENTS];
+ int idx[MAX_EXPONENTS];
+
+ DECLARE_ALIGNED(32, float, mantissas)[MAX_MANTISSAS];
+} DBEChannel;
+
+typedef struct DBEDecodeContext {
+ AVCodecContext *avctx;
+ DBEContext dectx;
+
+ DolbyEHeaderInfo metadata;
+
+ DBEChannel channels[MAX_SEGMENTS][MAX_CHANNELS];
+
+ DECLARE_ALIGNED(32, float, history)[MAX_CHANNELS][256];
+
+ FFTContext imdct[3];
+ AVFloatDSPContext *fdsp;
+} DBEDecodeContext;
+
+static const int8_t lfe_channel_tab[MAX_PROG_CONF + 1] = {
+ 5, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, 5
+};
+
+static const uint8_t ch_reorder_4[4] = { 0, 2, 1, 3 };
+static const uint8_t ch_reorder_6[6] = { 0, 2, 4, 1, 3, 5 };
+static const uint8_t ch_reorder_8[8] = { 0, 2, 6, 4, 1, 3, 7, 5 };
+static const uint8_t ch_reorder_n[8] = { 0, 2, 4, 6, 1, 3, 5, 7 };
+
+
+static const uint8_t nb_groups_tab[4] = { 1, 8, 7, 1 };
+
+static const uint8_t nb_mstr_exp_tab[4] = { 2, 2, 2, 1 };
+
+static const uint8_t nb_mantissa_38[38] = {
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6,
+ 7, 8, 9, 10, 11, 12,
+};
+
+static const uint8_t nb_mantissa_44[44] = {
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
+ 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 5, 5, 6, 7, 7,
+ 8, 9, 10, 11, 12, 13, 15, 16, 18, 20, 22, 25,
+};
+
+static const uint8_t nb_mantissa_50[50] = {
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3,
+ 3, 4, 4, 5, 5, 6, 6, 7, 8, 9, 9, 10, 12, 13, 14, 16,
+ 18, 19, 22, 24, 27, 29, 32, 36, 40, 44, 49, 54, 60, 66, 74, 82,
+ 90, 100,
+};
+
+static const uint8_t imdct_bits_tab[3] = { 8, 9, 11 };
+
+static const DBEGroup grp_tab_0[1] = {
+ { 50, { 27, 23 }, 0, 0, nb_mantissa_50, 2, 0, 1152, 0, 1408, 0 },
+};
+
+static const DBEGroup grp_tab_1[8] = {
+ { 38, { 12, 26 }, 0, 0, nb_mantissa_38, 0, 0, 192, 0, 256, 0 },
+ { 38, { 12, 26 }, 38, 128, nb_mantissa_38, 0, 1, 256, 64, 448, 0 },
+ { 38, { 12, 26 }, 76, 256, nb_mantissa_38, 0, 1, 256, 192, 704, 0 },
+ { 38, { 12, 26 }, 114, 384, nb_mantissa_38, 0, 1, 256, 320, 0, 0 },
+ { 38, { 12, 26 }, 152, 512, nb_mantissa_38, 0, 1, 256, 448, 0, 0 },
+ { 38, { 12, 26 }, 190, 640, nb_mantissa_38, 0, 1, 256, 576, 0, 0 },
+ { 38, { 12, 26 }, 228, 768, nb_mantissa_38, 0, 1, 256, 704, 0, 0 },
+ { 38, { 12, 26 }, 266, 896, nb_mantissa_38, 0, 1, 256, 832, 0, 0 },
+};
+
+static const DBEGroup grp_tab_2[7] = {
+ { 38, { 12, 26 }, 0, 0, nb_mantissa_38, 0, 0, 192, 0, 256, 0 },
+ { 38, { 12, 26 }, 38, 128, nb_mantissa_38, 0, 1, 256, 64, 448, 0 },
+ { 38, { 12, 26 }, 76, 256, nb_mantissa_38, 0, 1, 256, 192, 704, 0 },
+ { 38, { 12, 26 }, 114, 384, nb_mantissa_38, 0, 1, 256, 320, 0, 0 },
+ { 38, { 12, 26 }, 152, 512, nb_mantissa_38, 0, 1, 256, 448, 0, 0 },
+ { 38, { 12, 26 }, 190, 640, nb_mantissa_38, 0, 1, 256, 576, 0, 0 },
+ { 44, { 19, 25 }, 228, 768, nb_mantissa_44, 1, 1, 448, 704, 960, 64 },
+};
+
+static const DBEGroup grp_tab_3[1] = {
+ { 21, { 21 }, 0, 0, nb_mantissa_50, 2, 0, 1152, 0, 1408, 0 },
+};
+
+static const DBEGroup grp_tab_4[1] = {
+ { 50, { 27, 23 }, 0, 0, nb_mantissa_50, 2, 2, 1152, 0, 1408, 896 },
+};
+
+static const DBEGroup grp_tab_5[8] = {
+ { 38, { 12, 26 }, 0, 0, nb_mantissa_38, 0, 1, 256, 64, 0, 0 },
+ { 38, { 12, 26 }, 38, 128, nb_mantissa_38, 0, 1, 256, 192, 0, 0 },
+ { 38, { 12, 26 }, 76, 256, nb_mantissa_38, 0, 1, 256, 320, 0, 0 },
+ { 38, { 12, 26 }, 114, 384, nb_mantissa_38, 0, 1, 256, 448, 0, 0 },
+ { 38, { 12, 26 }, 152, 512, nb_mantissa_38, 0, 1, 256, 576, 0, 0 },
+ { 38, { 12, 26 }, 190, 640, nb_mantissa_38, 0, 1, 256, 704, 3008, 0 },
+ { 38, { 12, 26 }, 228, 768, nb_mantissa_38, 0, 1, 256, 832, 2752, 0 },
+ { 38, { 12, 26 }, 266, 896, nb_mantissa_38, 0, 2, 192, 960, 2560, 64 },
+};
+
+static const DBEGroup grp_tab_6[7] = {
+ { 44, { 19, 25 }, 0, 0, nb_mantissa_44, 1, 1, 448, 0, 3264, 0 },
+ { 38, { 12, 26 }, 44, 256, nb_mantissa_38, 0, 1, 256, 320, 0, 0 },
+ { 38, { 12, 26 }, 82, 384, nb_mantissa_38, 0, 1, 256, 448, 0, 0 },
+ { 38, { 12, 26 }, 120, 512, nb_mantissa_38, 0, 1, 256, 576, 0, 0 },
+ { 38, { 12, 26 }, 158, 640, nb_mantissa_38, 0, 1, 256, 704, 3008, 0 },
+ { 38, { 12, 26 }, 196, 768, nb_mantissa_38, 0, 1, 256, 832, 2752, 0 },
+ { 38, { 12, 26 }, 234, 896, nb_mantissa_38, 0, 2, 192, 960, 2560, 64 },
+};
+
+static const DBEGroup grp_tab_7[1] = {
+ { 21, { 21 }, 0, 0, nb_mantissa_50, 2, 2, 1152, 0, 1408, 896 },
+};
+
+static const DBEGroup *const frm_ofs_tab[2][4] = {
+ { grp_tab_0, grp_tab_1, grp_tab_2, grp_tab_3 },
+ { grp_tab_4, grp_tab_5, grp_tab_6, grp_tab_7 }
+};
+
+static const uint8_t mantissa_size1[16][4] = {
+ { 0, 0, 0, 0 }, { 2, 1, 1, 1 }, { 3, 2, 1, 1 }, { 4, 3, 2, 1 },
+ { 5, 4, 3, 2 }, { 6, 5, 4, 3 }, { 7, 6, 5, 4 }, { 8, 7, 6, 5 },
+ { 9, 8, 7, 6 }, { 10, 9, 8, 7 }, { 11, 10, 9, 8 }, { 12, 11, 10, 9 },
+ { 13, 12, 11, 10 }, { 14, 13, 12, 11 }, { 15, 14, 13, 12 }, { 16, 15, 14, 13 },
+};
+
+static const uint8_t mantissa_size2[16][4] = {
+ { 0, 0, 0, 0 }, { 2, 1, 2, 2 }, { 3, 2, 3, 3 }, { 4, 3, 4, 4 },
+ { 5, 4, 5, 5 }, { 6, 5, 6, 6 }, { 7, 6, 7, 7 }, { 8, 7, 8, 8 },
+ { 9, 8, 9, 9 }, { 10, 9, 10, 10 }, { 11, 10, 11, 11 }, { 12, 11, 12, 12 },
+ { 13, 12, 13, 13 }, { 14, 13, 14, 14 }, { 15, 14, 15, 15 }, { 16, 15, 16, 16 },
+};
+
+static const float start_window[192] = {
+ 0.00161569379826, 0.00185748233347, 0.00198562758548, 0.00207834078104,
+ 0.00215717748523, 0.00223067096393, 0.00230299213147, 0.00237651215396,
+ 0.00245275561606, 0.00253281402069, 0.00261754673613, 0.00270768786168,
+ 0.00280390761895, 0.00290684998656, 0.00301715751161, 0.00313548872798,
+ 0.00326253122934, 0.00339901215995, 0.00354570716636, 0.00370344845023,
+ 0.00387313232586, 0.00405572653911, 0.00425227750970, 0.00446391759265,
+ 0.00469187240551, 0.00493746822816, 0.00520213944619, 0.00548743597507,
+ 0.00579503056737, 0.00612672586953, 0.00648446105606, 0.00687031782873,
+ 0.00728652552677, 0.00773546505205, 0.00821967127415, 0.00874183354619,
+ 0.00930479393832, 0.00991154278653, 0.01056521116692, 0.01126905994567,
+ 0.01202646513050, 0.01284089936559, 0.01371590957417, 0.01465509096066,
+ 0.01566205783408, 0.01674041199523, 0.01789370972358, 0.01912542867865,
+ 0.02043893626265, 0.02183746113793, 0.02332406961796, 0.02490164852364,
+ 0.02657289580178, 0.02834031974193, 0.03020624702903, 0.03217283918354,
+ 0.03424211623810, 0.03641598586180, 0.03869627565015, 0.04108476601498,
+ 0.04358322107390, 0.04619341515939, 0.04891715301882, 0.05175628239149,
+
+ 0.05471237327267, 0.05778734733755, 0.06098291402413, 0.06430101352084,
+ 0.06774345212186, 0.07131188644726, 0.07500780649199, 0.07883251748595,
+ 0.08278712056651, 0.08687249228061, 0.09108926295730, 0.09543779401074,
+ 0.09991815425851, 0.10453009536427, 0.10927302653894, 0.11414598865987,
+ 0.11914762799220, 0.12427616972097, 0.12952939152560, 0.13490459744934,
+ 0.14039859233595, 0.14600765712201, 0.15172752528722, 0.15755336077528,
+ 0.16347973770491, 0.16950062219342, 0.17560935661442, 0.18179864660619,
+ 0.18806055113821, 0.19438647593012, 0.20076717050010, 0.20719272909882,
+ 0.21365259576030, 0.22013557367283, 0.22662983904194, 0.23312295958328,
+ 0.23960191774666, 0.24605313873388, 0.25246252333253, 0.25881548554631,
+ 0.26509699495987, 0.27129162373316, 0.27738359807707, 0.28335685401987,
+ 0.28919509723179, 0.29488186663467, 0.30040060148455, 0.30573471157819,
+ 0.31086765019993, 0.31578298939317, 0.32046449711227, 0.32489621578468,
+ 0.32906254179156, 0.33294830535654, 0.33653885031840, 0.33982011325336,
+ 0.34277870140679, 0.34540196889300, 0.34767809062480, 0.34959613344194,
+ 0.35114612391958, 0.35231911235422, 0.35310723244504, 0.35350375621308,
+
+ 0.35350314372945, 0.35310108725579, 0.35229454943591, 0.35108179521634,
+ 0.34946241721522, 0.34743735430290, 0.34500890320420, 0.34218072298001,
+ 0.33895783229541, 0.33534659943168, 0.33135472505060, 0.32699121776996,
+ 0.32226636266000, 0.31719168282019, 0.31177989424432, 0.30604485422875,
+ 0.30000150362379, 0.29366580327088, 0.28705466500775, 0.28018587766131,
+ 0.27307802848095, 0.26575042049535, 0.25822298630189, 0.25051619882000,
+ 0.24265097955783, 0.23464860495522, 0.22653061137548, 0.21831869932335,
+ 0.21003463746705, 0.20170016703857, 0.19333690717811, 0.18496626177620,
+ 0.17660932835062, 0.16828680947474, 0.16001892724986, 0.15182534128597,
+ 0.14372507062477, 0.13573642000364, 0.12787691082233, 0.12016321713317,
+ 0.11261110693234, 0.10523538898282, 0.09804986534955, 0.09106728977263,
+ 0.08429933194438, 0.07775654768810, 0.07144835495683, 0.06538301547324,
+ 0.05956762170687, 0.05400808871425, 0.04870915012107, 0.04367435714993,
+ 0.03890607899172, 0.03440550179663, 0.03017262174627, 0.02620622428513,
+ 0.02250383492507, 0.01906161305732, 0.01587412848221, 0.01293388032354,
+ 0.01023019677288, 0.00774641320626, 0.00545109736891, 0.00325868651263,
+};
+
+static const float short_window2[192] = {
+ 0.00018861094606, 0.00033433010202, 0.00050309624485, 0.00070306161748,
+ 0.00093995174533, 0.00121913067128, 0.00154606505568, 0.00192647806126,
+ 0.00236641248692, 0.00287225985240, 0.00345077377440, 0.00410907465023,
+ 0.00485464855241, 0.00569534163219, 0.00663935063508, 0.00769520981249,
+ 0.00887177436246, 0.01017820046395, 0.01162392194150, 0.01321862359335,
+ 0.01497221122468, 0.01689477844427, 0.01899657030441, 0.02128794388846,
+ 0.02377932597692, 0.02648116795039, 0.02940389811590, 0.03255787167130,
+ 0.03595331854986, 0.03960028941437, 0.04350860009563, 0.04768777479454,
+ 0.05214698838949, 0.05689500821121, 0.06194013566525, 0.06729014809766,
+ 0.07295224131210, 0.07893297315602, 0.08523820859989, 0.09187306673620,
+ 0.09884187012422, 0.10614809690222, 0.11379433608064, 0.12178224641797,
+ 0.13011251926531, 0.13878484574660, 0.14779788861830, 0.15714925912610,
+ 0.16683549914631, 0.17685206886673, 0.18719334022589, 0.19785259629099,
+ 0.20882203671372, 0.22009278936030, 0.23165492816694, 0.24349749722585,
+ 0.25560854105961, 0.26797514099368, 0.28058345748882, 0.29341877824732,
+ 0.30646557185942, 0.31970754671026, 0.33312771482295, 0.34670846027024,
+
+ 0.36043161174692, 0.37427851885723, 0.38823013163645, 0.40226708279486,
+ 0.41636977214436, 0.43051845264462, 0.44469331748632, 0.45887458761470,
+ 0.47304259908636, 0.48717788964798, 0.50126128392546, 0.51527397661778,
+ 0.52919761310050, 0.54301436685998, 0.55670701320069, 0.57025899869448,
+ 0.58365450587230, 0.59687851269542, 0.60991684638414, 0.62275623122793,
+ 0.63538433005035, 0.64778977905593, 0.65996221584264, 0.67189230042379,
+ 0.68357172916486, 0.69499324160511, 0.70615062019861, 0.71703868307548,
+ 0.72765326998919, 0.73799122168099, 0.74805035295521, 0.75782941981995,
+ 0.76732808110520, 0.77654685502339, 0.78548707118622, 0.79415081863423,
+ 0.80254089047207, 0.81066072573188, 0.81851434910893, 0.82610630922734,
+ 0.83344161609862, 0.84052567843230, 0.84736424144524, 0.85396332579459,
+ 0.86032916822973, 0.86646816451999, 0.87238681516918, 0.87809167437532,
+ 0.88358930263537, 0.88888622333073, 0.89398888356256, 0.89890361943564,
+ 0.90363662591861, 0.90819393133744, 0.91258137648979, 0.91680459830070,
+ 0.92086901787718, 0.92477983276087, 0.92854201312583, 0.93216030163834,
+ 0.93563921662343, 0.93898305819384, 0.94219591693690, 0.94528168477979,
+
+ 0.94823843319821, 0.95106834367330, 0.95377776558539, 0.95636718335775,
+ 0.95883679961479, 0.96118650212341, 0.96341583179195, 0.96552395212906,
+ 0.96750962060547, 0.96937116231768, 0.97110644638309, 0.97271286544154,
+ 0.97418731862798, 0.97552619834964, 0.97672538116257, 0.97778022299974,
+ 0.97868555895586, 0.97943570778357, 0.98002448120255, 0.98044519806866,
+ 0.98069070339493, 0.98075339216123, 0.98062523779637, 0.98029782516478,
+ 0.97976238784222, 0.97900984942031, 0.97803086854002, 0.97681588731895,
+ 0.97535518280755, 0.97363892108474, 0.97165721358452, 0.96940017523145,
+ 0.96685798395452, 0.96402094114589, 0.96087953263194, 0.95742448973047,
+ 0.95364684997699, 0.94953801711660, 0.94508981997396, 0.94029456983253,
+ 0.93514511597504, 0.92963489905951, 0.92375800202883, 0.91750919827624,
+ 0.91088399681406, 0.90387868421832, 0.89649036314692, 0.88871698725397,
+ 0.88055739234735, 0.87201132366062, 0.86307945913336, 0.85376342861693,
+ 0.84406582894455, 0.83399023482637, 0.82354120554757, 0.81272428745995,
+ 0.80154601230457, 0.79001389138101, 0.77813640562199, 0.76592299164227,
+ 0.75338402384395, 0.74053079267526, 0.72737547915460, 0.71393112578527,
+};
+
+static const float short_window3[64] = {
+ 0.00326887936450, 0.00550242900936, 0.00786846643791, 0.01045683453520,
+ 0.01330402120132, 0.01643221072863, 0.01985798040609, 0.02359509464766,
+ 0.02765559221954, 0.03205025893128, 0.03678884369614, 0.04188015679495,
+ 0.04733210987781, 0.05315172583924, 0.05934513287609, 0.06591755045290,
+ 0.07287327156378, 0.08021564389822, 0.08794705152307, 0.09606889811179,
+ 0.10458159240070, 0.11348453632940, 0.12277611617809, 0.13245369691511,
+ 0.14251361989876, 0.15295120402567, 0.16376075037904, 0.17493555039885,
+ 0.18646789757072, 0.19834910260891, 0.21056951208995, 0.22311853047787,
+ 0.23598464546683, 0.24915545655419, 0.26261770674500, 0.27635731727778,
+ 0.29035942525136, 0.30460842402318, 0.31908800624032, 0.33378120935681,
+ 0.34867046348260, 0.36373764140285, 0.37896411059909, 0.39433078709788,
+ 0.40981819096657, 0.42540650327031, 0.44107562429959, 0.45680523287270,
+ 0.47257484651351, 0.48836388230077, 0.50415171818214, 0.51991775454258,
+ 0.53564147581496, 0.55130251191887, 0.56688069931047, 0.58235614142007,
+ 0.59770926827271, 0.61292089506118, 0.62797227945823, 0.64284517745255,
+ 0.65752189749349, 0.67198535273209, 0.68621911114984, 0.70020744337099,
+};
+
+static const uint8_t dc_code_tab[5] = { 0, 0, 0, 1, 1 };
+
+static const uint8_t ht_code_tab[5] = { 0, 0, 1, 2, 2 };
+
+static const uint8_t band_ofs_tab[3][4] = {
+ { 12, 8, 4, 0 }, { 14, 10, 6, 0 }, { 12, 8, 4, 0 }
+};
+
+static const uint8_t band_low_tab[3] = { 9, 17, 24 };
+
+static const uint16_t fast_gain_tab[8] = {
+ 128, 256, 384, 512, 640, 768, 896, 1024
+};
+
+static const uint16_t slow_decay_tab[2][2] = { { 27, -1 }, { 32, 21 } };
+
+static const uint16_t misc_decay_tab[3][2][2] = {
+ { { 354, -1 }, { 425, 425 } },
+ { { 266, -1 }, { 320, -1 } },
+ { { 213, -1 }, { 256, -1 } }
+};
+
+static const uint16_t fast_decay_tab[3][2][2][50] = {
+ {{{
+ 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
+ 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
+ 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
+ 142, 142, 142, 142, 142, 142, 142, 142,
+ }, {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ }}, {{
+ 170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
+ 170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
+ 170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
+ 170, 170, 170, 170, 170, 170, 170, 170,
+ }, {
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64,
+ }}}, {{{
+ 266, 266, 106, 106, 106, 106, 106, 106, 106, 106,
+ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
+ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
+ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
+ 106, 106, 106, 106,
+ }, {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1,
+ }}, {{
+ 319, 319, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128,
+ }, {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1,
+ }}}, {{{
+ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
+ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
+ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
+ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
+ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
+ }, {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ }}, {{
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ }, {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ }}}
+};
+
+static const uint16_t fast_gain_adj_tab[3][2][62] = {
+ {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 2, 4, 7, 11, 16, 29, 44, 59,
+ 76, 94, 116, 142, 179, 221, 252, 285, 312, 334,
+ }, {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 2, 5, 8, 10, 15, 28, 42, 57, 75, 93,
+ 115, 140, 177, 219, 247, 280, 308, 330, 427, 533,
+ }}, {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 2, 5, 8, 12, 21, 35, 51, 69, 89,
+ 111, 138, 176, 220, 251, 284, 312, 334,
+ }, {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
+ 5, 8, 11, 18, 33, 49, 65, 84, 106, 132,
+ 168, 214, 245, 279, 308, 329, 427, 533,
+ }}, {{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 4, 7, 10, 17,
+ 31, 47, 65, 84, 107, 134, 171, 215, 250, 283,
+ 312, 334,
+ }, {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 6, 9, 13, 27, 43,
+ 60, 79, 100, 126, 160, 207, 242, 276, 307, 329,
+ 427, 533,
+ }}
+};
+
+static const uint16_t slow_gain_tab[3][2][50] = {
+ {{
+ 3072, 3072, 3072, 3072, 3072, 3072, 1063, 1063, 1063, 1063,
+ 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063,
+ 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063,
+ 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063,
+ }, {
+ 3072, 3072, 3072, 3072, 3072, 3072, 850, 850, 850, 850,
+ 850, 850, 850, 850, 850, 850, 850, 850, 850, 850,
+ 850, 850, 850, 850, 850, 850, 850, 850, 850, 850,
+ 850, 850, 850, 850, 850, 850, 850, 850,
+ }}, {{
+ 3072, 1212, 1212, 1212, 999, 999, 999, 999, 999, 999,
+ 999, 999, 999, 999, 999, 999, 999, 999, 999, 999,
+ 999, 999, 999, 999, 999, 999, 999, 999, 999, 999,
+ 999, 999, 999, 999, 999, 999, 999, 999, 999, 999,
+ 999, 999, 999, 999,
+ }, {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1,
+ }}, {{
+ 3072, 3072, 3072, 3072, 3072, 3072, 3072, 3072, 3072, 3072,
+ 999, 999, 999, 999, 999, 999, 999, 999, 999, 999,
+ 999, 999, 999, 999, 999, 999, 999, 999, 999, 999,
+ 999, 999, 999, 999, 999, 999, 999, 999, 999, 999,
+ 999, 999, 999, 999, 999, 999, 999, 999, 999, 999,
+ }, {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ }}
+};
+
+static const uint16_t hearing_thresh_tab[3][3][50] = {
+ {{
+ 1403, 1141, 1000, 959, 948, 957, 946, 925, 899, 871,
+ 843, 815, 789, 766, 745, 727, 705, 687, 681, 686,
+ 701, 725, 768, 854, 940, 1018, 1075, 1103, 1111, 1106,
+ 1098, 1105, 1142, 1237, 1419, 1721, 2169, 2805,
+ }, {
+ 1401, 1130, 995, 957, 947, 955, 941, 918, 890, 861,
+ 831, 803, 777, 754, 734, 717, 698, 684, 682, 692,
+ 712, 743, 798, 894, 976, 1045, 1091, 1109, 1110, 1102,
+ 1098, 1116, 1174, 1300, 1526, 1884, 2401, 3072,
+ }, {
+ 1393, 1086, 974, 949, 957, 941, 913, 878, 843, 808,
+ 777, 750, 727, 708, 695, 686, 681, 689, 714, 752,
+ 811, 888, 971, 1044, 1087, 1108, 1110, 1102, 1098, 1115,
+ 1172, 1290, 1489, 1812, 2293, 2964, 3072, 3072,
+ }}, {{
+ 1412, 1343, 1141, 1047, 1000, 974, 959, 951, 948, 947,
+ 957, 953, 946, 936, 925, 906, 878, 850, 822, 795,
+ 771, 745, 719, 700, 687, 681, 685, 701, 733, 784,
+ 885, 977, 1047, 1092, 1110, 1108, 1099, 1102, 1138, 1233,
+ 1413, 1711, 2157, 2797,
+ }, {
+ 1412, 1336, 1130, 1040, 995, 970, 957, 950, 947, 947,
+ 955, 950, 941, 930, 918, 897, 868, 838, 810, 783,
+ 759, 734, 710, 693, 684, 681, 690, 712, 752, 823,
+ 924, 1009, 1069, 1102, 1111, 1104, 1098, 1111, 1168, 1295,
+ 1518, 1873, 2388, 3072,
+ }, {
+ 1411, 1293, 1086, 1009, 974, 957, 949, 947, 957, 951,
+ 941, 928, 913, 896, 878, 852, 817, 785, 756, 732,
+ 713, 695, 683, 682, 689, 710, 746, 811, 906, 992,
+ 1061, 1099, 1111, 1106, 1098, 1107, 1155, 1266, 1471, 1799,
+ 2277, 2945, 3072, 3072,
+ }}, {{
+ 1431, 1412, 1403, 1379, 1343, 1293, 1229, 1180, 1125, 1075,
+ 1040, 1014, 996, 979, 965, 957, 951, 948, 947, 957,
+ 951, 940, 924, 903, 877, 846, 815, 785, 753, 725,
+ 702, 686, 681, 689, 714, 760, 847, 947, 1028, 1083,
+ 1108, 1109, 1101, 1100, 1132, 1222, 1402, 1705, 2160, 2803,
+ }, {
+ 1431, 1412, 1401, 1375, 1336, 1278, 1215, 1168, 1115, 1066,
+ 1032, 1008, 991, 975, 962, 954, 950, 947, 947, 955,
+ 948, 935, 916, 894, 866, 835, 803, 772, 742, 715,
+ 695, 683, 683, 697, 729, 784, 887, 982, 1054, 1096,
+ 1111, 1106, 1098, 1107, 1159, 1281, 1505, 1865, 2391, 3072,
+ }, {
+ 1427, 1411, 1393, 1353, 1293, 1215, 1160, 1118, 1072, 1031,
+ 1003, 984, 971, 960, 952, 948, 947, 957, 952, 941,
+ 924, 902, 876, 847, 815, 781, 750, 723, 700, 685,
+ 681, 691, 719, 766, 858, 958, 1039, 1089, 1109, 1108,
+ 1099, 1102, 1141, 1245, 1442, 1766, 2250, 2930, 3072, 3072,
+ }}
+};
+
+static const int16_t lwc_gain_tab[11][7] = {
+ { -21, -197, -271, -466, 32767, 32767, 32767 },
+ { -197, -29, -244, -271, -540, 32767, 32767 },
+ { -271, -244, -29, -249, -271, -593, 32767 },
+ { -466, -271, -249, -29, -251, -271, -632 },
+ { -540, -271, -251, -29, -251, -271, -664 },
+ { -593, -271, -251, -29, -252, -271, -690 },
+ { -632, -271, -252, -29, -252, -271, -711 },
+ { -664, -271, -252, -29, -252, -271, -730 },
+ { -690, -271, -252, -29, -252, -271, -745 },
+ { -711, -271, -252, -29, -253, -271, -759 },
+ { -730, -271, -253, -29, -253, -271, -771 },
+};
+
+static const int16_t lwc_adj_tab[7] = {
+ -192, -320, -448, -512, -448, -320, -192,
+};
+
+static const uint8_t log_add_tab[212] = {
+ 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 52, 51, 50,
+ 49, 48, 47, 47, 46, 45, 44, 44, 43, 42, 41, 41, 40, 39, 38, 38,
+ 37, 36, 36, 35, 35, 34, 33, 33, 32, 32, 31, 30, 30, 29, 29, 28,
+ 28, 27, 27, 26, 26, 25, 25, 24, 24, 23, 23, 22, 22, 21, 21, 21,
+ 20, 20, 19, 19, 19, 18, 18, 18, 17, 17, 17, 16, 16, 16, 15, 15,
+ 15, 14, 14, 14, 13, 13, 13, 13, 12, 12, 12, 12, 11, 11, 11, 11,
+ 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8,
+ 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5,
+ 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 0, 0,
+};
+
+static const uint8_t bap_tab[64] = {
+ 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4,
+ 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8,
+ 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12,
+ 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 15,
+};
+
+static float mantissa_tab1[17][4];
+static float mantissa_tab2[17][4];
+static float mantissa_tab3[17][4];
+static float exponent_tab[50];
+static float gain_tab[1024];
+
+DECLARE_ALIGNED(32, static float, window)[3712];
+
static int skip_input(DBEContext *s, int nb_words)
{
if (nb_words > s->input_size) {
diff --git a/libavcodec/dolby_e.h b/libavcodec/dolby_e.h
index 855d978bc2..d7fac94fd9 100644
--- a/libavcodec/dolby_e.h
+++ b/libavcodec/dolby_e.h
@@ -21,6 +21,7 @@
#ifndef AVCODEC_DOLBY_E_H
#define AVCODEC_DOLBY_E_H
+#include <stdint.h>
#include "get_bits.h"
#define FRAME_SAMPLES 1792
@@ -81,5 +82,23 @@ typedef struct DolbyEHeaderInfo {
static const uint16_t sample_rate_tab[16] = {
0, 42965, 43008, 44800, 53706, 53760
};
+/**
+ * Initialize DBEContext.
+ * Set word_bits/word_bytes, input, input_size, key_present.
+ * @param[out] s DBEContext.
+ * @param[in] buf raw input buffer.
+ * @param[in] buf_size must be 3 bytes at least.
+ * @return Returns 0 on success, AVERROR_INVALIDDATA on error
+ */
+int ff_dolby_e_parse_init(DBEContext *s, const uint8_t *buf, int buf_size);
+
+/**
+ * Parse Dolby E metadata.
+ * Parse the header up to the end_gain element.
+ * @param[in] s DBEContext .
+ * @param[out] hdr Pointer to struct where header info is written.
+ * @return Returns 0 on success, AVERROR_INVALIDDATA on error
+ */
+int ff_dolby_e_parse_header(DBEContext *s, DolbyEHeaderInfo *hdr);
#endif
diff --git a/libavcodec/dolby_e_parse.c b/libavcodec/dolby_e_parse.c
new file mode 100644
index 0000000000..df2ba4a017
--- /dev/null
+++ b/libavcodec/dolby_e_parse.c
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) 2017 foo86
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "get_bits.h"
+#include "put_bits.h"
+#include "dolby_e.h"
+
+static const uint8_t nb_programs_tab[MAX_PROG_CONF + 1] = {
+ 2, 3, 2, 3, 4, 5, 4, 5, 6, 7, 8, 1, 2, 3, 3, 4, 5, 6, 1, 2, 3, 4, 1, 1
+};
+
+static const uint8_t nb_channels_tab[MAX_PROG_CONF + 1] = {
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 6, 6, 6, 6, 6, 6, 6, 4, 4, 4, 4, 8, 8
+};
+
+static int skip_input(DBEContext *s, int nb_words)
+{
+ if (nb_words > s->input_size) {
+ return AVERROR_INVALIDDATA;
+ }
+
+ s->input += nb_words * s->word_bytes;
+ s->input_size -= nb_words;
+ return 0;
+}
+
+static int parse_key(DBEContext *s)
+{
+ if (s->key_present) {
+ const uint8_t *key = s->input;
+ int ret = skip_input(s, 1);
+ if (ret < 0)
+ return ret;
+ return AV_RB24(key) >> 24 - s->word_bits;
+ }
+ return 0;
+}
+
+static int convert_input(DBEContext *s, int nb_words, int key)
+{
+ const uint8_t *src = s->input;
+ uint8_t *dst = s->buffer;
+ PutBitContext pb;
+ int i;
+
+ av_assert0(nb_words <= 1024u);
+
+ if (nb_words > s->input_size) {
+ return AVERROR_INVALIDDATA;
+ }
+
+ switch (s->word_bits) {
+ case 16:
+ for (i = 0; i < nb_words; i++, src += 2, dst += 2)
+ AV_WB16(dst, AV_RB16(src) ^ key);
+ break;
+ case 20:
+ init_put_bits(&pb, s->buffer, sizeof(s->buffer));
+ for (i = 0; i < nb_words; i++, src += 3)
+ put_bits(&pb, 20, AV_RB24(src) >> 4 ^ key);
+ flush_put_bits(&pb);
+ break;
+ case 24:
+ for (i = 0; i < nb_words; i++, src += 3, dst += 3)
+ AV_WB24(dst, AV_RB24(src) ^ key);
+ break;
+ default:
+ av_assert0(0);
+ }
+
+ return init_get_bits(&s->gb, s->buffer, nb_words * s->word_bits);
+}
+
+int ff_dolby_e_parse_init(DBEContext *s, const uint8_t *buf, int buf_size)
+{
+ int hdr;
+
+ if (buf_size < 3)
+ return AVERROR_INVALIDDATA;
+
+ hdr = AV_RB24(buf);
+ if ((hdr & 0xfffffe) == 0x7888e) {
+ s->word_bits = 24;
+ } else if ((hdr & 0xffffe0) == 0x788e0) {
+ s->word_bits = 20;
+ } else if ((hdr & 0xfffe00) == 0x78e00) {
+ s->word_bits = 16;
+ } else {
+ if (s->avctx)
+ av_log(s->avctx, AV_LOG_ERROR, "Invalid frame header\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ s->word_bytes = s->word_bits + 7 >> 3;
+ s->input = buf + s->word_bytes;
+ s->input_size = buf_size / s->word_bytes - 1;
+ s->key_present = hdr >> 24 - s->word_bits & 1;
+
+ return 0;
+}
+
+int ff_dolby_e_parse_header(DBEContext *s, DolbyEHeaderInfo *hdr)
+{
+ int i, ret, key, mtd_size;
+
+ if ((key = parse_key(s)) < 0)
+ return key;
+ if ((ret = convert_input(s, 1, key)) < 0)
+ return ret;
+
+ skip_bits(&s->gb, 4);
+ mtd_size = get_bits(&s->gb, 10);
+ if (!mtd_size) {
+ if (s->avctx)
+ av_log(s->avctx, AV_LOG_ERROR, "Invalid metadata size\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if ((ret = convert_input(s, mtd_size, key)) < 0)
+ return ret;
+
+ skip_bits(&s->gb, 14);
+ hdr->prog_conf = get_bits(&s->gb, 6);
+ if (hdr->prog_conf > MAX_PROG_CONF) {
+ if (s->avctx)
+ av_log(s->avctx, AV_LOG_ERROR, "Invalid program configuration\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ hdr->nb_channels = nb_channels_tab[hdr->prog_conf];
+ hdr->nb_programs = nb_programs_tab[hdr->prog_conf];
+
+ hdr->fr_code = get_bits(&s->gb, 4);
+ hdr->fr_code_orig = get_bits(&s->gb, 4);
+ if (!sample_rate_tab[hdr->fr_code] ||
+ !sample_rate_tab[hdr->fr_code_orig]) {
+ if (s->avctx)
+ av_log(s->avctx, AV_LOG_ERROR, "Invalid frame rate code\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ skip_bits_long(&s->gb, 88);
+ for (i = 0; i < hdr->nb_channels; i++)
+ hdr->ch_size[i] = get_bits(&s->gb, 10);
+ hdr->mtd_ext_size = get_bits(&s->gb, 8);
+ hdr->meter_size = get_bits(&s->gb, 8);
+
+ skip_bits_long(&s->gb, 10 * hdr->nb_programs);
+ for (i = 0; i < hdr->nb_channels; i++) {
+ hdr->rev_id[i] = get_bits(&s->gb, 4);
+ skip_bits1(&s->gb);
+ hdr->begin_gain[i] = get_bits(&s->gb, 10);
+ hdr->end_gain[i] = get_bits(&s->gb, 10);
+ }
+
+ if (get_bits_left(&s->gb) < 0) {
+ if (s->avctx)
+ av_log(s->avctx, AV_LOG_ERROR, "Read past end of metadata\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ return skip_input(s, mtd_size + 1);
+}
diff --git a/libavcodec/dolby_e_parser.c b/libavcodec/dolby_e_parser.c
index c85027e94c..2c11617906 100644
--- a/libavcodec/dolby_e_parser.c
+++ b/libavcodec/dolby_e_parser.c
@@ -20,164 +20,16 @@
#include "parser.h"
-#if CONFIG_DOLBY_E_PARSER | CONFIG_DOLBY_E_DECODER
-
+#include "dolby_e.h"
#include "get_bits.h"
#include "put_bits.h"
-#include "dolby_e_parser.h"
-#include "dolby_e_parser_internal.h"
-
-static int skip_input(DBEContext *s, int nb_words)
-{
- if (nb_words > s->input_size) {
- return AVERROR_INVALIDDATA;
- }
-
- s->input += nb_words * s->word_bytes;
- s->input_size -= nb_words;
- return 0;
-}
-
-static int parse_key(DBEContext *s)
-{
- if (s->key_present) {
- const uint8_t *key = s->input;
- int ret = skip_input(s, 1);
- if (ret < 0)
- return ret;
- return AV_RB24(key) >> 24 - s->word_bits;
- }
- return 0;
-}
-
-static int convert_input(DBEContext *s, int nb_words, int key)
-{
- const uint8_t *src = s->input;
- uint8_t *dst = s->buffer;
- PutBitContext pb;
- int i;
-
- av_assert0(nb_words <= 1024u);
-
- if (nb_words > s->input_size) {
- return AVERROR_INVALIDDATA;
- }
-
- switch (s->word_bits) {
- case 16:
- for (i = 0; i < nb_words; i++, src += 2, dst += 2)
- AV_WB16(dst, AV_RB16(src) ^ key);
- break;
- case 20:
- init_put_bits(&pb, s->buffer, sizeof(s->buffer));
- for (i = 0; i < nb_words; i++, src += 3)
- put_bits(&pb, 20, AV_RB24(src) >> 4 ^ key);
- flush_put_bits(&pb);
- break;
- case 24:
- for (i = 0; i < nb_words; i++, src += 3, dst += 3)
- AV_WB24(dst, AV_RB24(src) ^ key);
- break;
- default:
- av_assert0(0);
- }
-
- return init_get_bits(&s->gb, s->buffer, nb_words * s->word_bits);
-}
-
-int ff_dolby_e_parse_init(DBEContext *s, const uint8_t *buf, int buf_size)
-{
- int hdr;
- if (buf_size < 3)
- return AVERROR_INVALIDDATA;
-
- hdr = AV_RB24(buf);
- if ((hdr & 0xfffffe) == 0x7888e) {
- s->word_bits = 24;
- } else if ((hdr & 0xffffe0) == 0x788e0) {
- s->word_bits = 20;
- } else if ((hdr & 0xfffe00) == 0x78e00) {
- s->word_bits = 16;
- } else {
- if (s->avctx)
- av_log(s->avctx, AV_LOG_ERROR, "Invalid frame header\n");
- return AVERROR_INVALIDDATA;
- }
-
- s->word_bytes = s->word_bits + 7 >> 3;
- s->input = buf + s->word_bytes;
- s->input_size = buf_size / s->word_bytes - 1;
- s->key_present = hdr >> 24 - s->word_bits & 1;
-
- return 0;
-}
-
-int ff_dolby_e_parse_header(DBEContext *s, DolbyEHeaderInfo *hdr)
-{
- int i, ret, key, mtd_size;
-
- if ((key = parse_key(s)) < 0)
- return key;
- if ((ret = convert_input(s, 1, key)) < 0)
- return ret;
-
- skip_bits(&s->gb, 4);
- mtd_size = get_bits(&s->gb, 10);
- if (!mtd_size) {
- if (s->avctx)
- av_log(s->avctx, AV_LOG_ERROR, "Invalid metadata size\n");
- return AVERROR_INVALIDDATA;
- }
-
- if ((ret = convert_input(s, mtd_size, key)) < 0)
- return ret;
-
- skip_bits(&s->gb, 14);
- hdr->prog_conf = get_bits(&s->gb, 6);
- if (hdr->prog_conf > MAX_PROG_CONF) {
- if (s->avctx)
- av_log(s->avctx, AV_LOG_ERROR, "Invalid program configuration\n");
- return AVERROR_INVALIDDATA;
- }
-
- hdr->nb_channels = nb_channels_tab[hdr->prog_conf];
- hdr->nb_programs = nb_programs_tab[hdr->prog_conf];
-
- hdr->fr_code = get_bits(&s->gb, 4);
- hdr->fr_code_orig = get_bits(&s->gb, 4);
- if (!sample_rate_tab[hdr->fr_code] ||
- !sample_rate_tab[hdr->fr_code_orig]) {
- if (s->avctx)
- av_log(s->avctx, AV_LOG_ERROR, "Invalid frame rate code\n");
- return AVERROR_INVALIDDATA;
- }
-
- skip_bits_long(&s->gb, 88);
- for (i = 0; i < hdr->nb_channels; i++)
- hdr->ch_size[i] = get_bits(&s->gb, 10);
- hdr->mtd_ext_size = get_bits(&s->gb, 8);
- hdr->meter_size = get_bits(&s->gb, 8);
-
- skip_bits_long(&s->gb, 10 * hdr->nb_programs);
- for (i = 0; i < hdr->nb_channels; i++) {
- hdr->rev_id[i] = get_bits(&s->gb, 4);
- skip_bits1(&s->gb);
- hdr->begin_gain[i] = get_bits(&s->gb, 10);
- hdr->end_gain[i] = get_bits(&s->gb, 10);
- }
-
- if (get_bits_left(&s->gb) < 0) {
- if (s->avctx)
- av_log(s->avctx, AV_LOG_ERROR, "Read past end of metadata\n");
- return AVERROR_INVALIDDATA;
- }
-
- return skip_input(s, mtd_size + 1);
-}
-#endif /* CONFIG_DOLBY_E_PARSER | CONFIG_DOLBY_E_DECODER */
+typedef struct DBEParseContext {
+ ParseContext pc;
+ DBEContext dectx;
-#if CONFIG_DOLBY_E_PARSER
+ DolbyEHeaderInfo metadata;
+} DBEParseContext;
static int dolby_e_parse(AVCodecParserContext *s2, AVCodecContext *avctx,
const uint8_t **poutbuf, int *poutbuf_size,
@@ -224,4 +76,3 @@ AVCodecParser ff_dolby_e_parser = {
.parser_parse = dolby_e_parse,
.parser_close = ff_parse_close,
};
-#endif /* CONFIG_DOLBY_E_PARSER */
diff --git a/libavcodec/dolby_e_parser.h b/libavcodec/dolby_e_parser.h
deleted file mode 100644
index 2f9a2b2ebb..0000000000
--- a/libavcodec/dolby_e_parser.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2017 foo86
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_DOLBY_E_PARSER_H
-#define AVCODEC_DOLBY_E_PARSER_H
-
-#include "dolby_e.h"
-
-typedef struct DBEParseContext {
- ParseContext pc;
- DBEContext dectx;
-
- DolbyEHeaderInfo metadata;
-} DBEParseContext;
-
-static const uint8_t nb_programs_tab[MAX_PROG_CONF + 1] = {
- 2, 3, 2, 3, 4, 5, 4, 5, 6, 7, 8, 1, 2, 3, 3, 4, 5, 6, 1, 2, 3, 4, 1, 1
-};
-
-static const uint8_t nb_channels_tab[MAX_PROG_CONF + 1] = {
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 6, 6, 6, 6, 6, 6, 6, 4, 4, 4, 4, 8, 8
-};
-
-#endif
diff --git a/libavcodec/dolby_e_parser_internal.h b/libavcodec/dolby_e_parser_internal.h
deleted file mode 100644
index defd1f97d6..0000000000
--- a/libavcodec/dolby_e_parser_internal.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Dolby E parser internal code
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_DOLBY_E_PARSER_INTERNAL_H
-#define AVCODEC_DOLBY_E_PARSER_INTERNAL_H
-
-#include "dolby_e.h"
-
-/**
- * Initialize DBEContext.
- * Set word_bits/word_bytes, input, input_size, key_present.
- * @param[out] s DBEContext.
- * @param[in] buf raw input buffer.
- * @param[in] buf_size must be 3 bytes at least.
- * @return Returns 0 on success, AVERROR_INVALIDDATA on error
- */
-int ff_dolby_e_parse_init(DBEContext *s, const uint8_t *buf, int buf_size);
-
-/**
- * Parse Dolby E metadata.
- * Parse the header up to the end_gain element.
- * @param[in] s DBEContext .
- * @param[out] hdr Pointer to struct where header info is written.
- * @return Returns 0 on success, AVERROR_INVALIDDATA on error
- */
-int ff_dolby_e_parse_header(DBEContext *s, DolbyEHeaderInfo *hdr);
-
-
-#endif /* AVCODEC_DOLBY_E_PARSER_INTERNAL_H */
diff --git a/libavcodec/dolby_edec.h b/libavcodec/dolby_edec.h
deleted file mode 100644
index 02760bb852..0000000000
--- a/libavcodec/dolby_edec.h
+++ /dev/null
@@ -1,607 +0,0 @@
-/*
- * Copyright (C) 2017 foo86
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_DOLBY_EDEC_H
-#define AVCODEC_DOLBY_EDEC_H
-
-#include "libavutil/float_dsp.h"
-#include "libavutil/libm.h"
-#include "libavutil/mem_internal.h"
-
-#include "internal.h"
-#include "get_bits.h"
-#include "kbdwin.h"
-#include "fft.h"
-
-#define MAX_SEGMENTS 2
-
-#define MAX_GROUPS 8
-#define MAX_EXPONENTS 304
-#define MAX_MANTISSAS 1024
-
-#define MAX_MSTR_EXP 2
-#define MAX_BIAS_EXP 50
-
-typedef struct DBEGroup {
- uint8_t nb_exponent;
- uint8_t nb_bias_exp[MAX_MSTR_EXP];
- uint16_t exp_ofs;
- uint16_t mnt_ofs;
- const uint8_t *nb_mantissa;
- uint8_t imdct_idx;
- uint8_t imdct_phs;
- uint16_t win_len;
- uint16_t dst_ofs;
- uint16_t win_ofs;
- uint16_t src_ofs;
-} DBEGroup;
-
-typedef struct DBEChannel {
- int gr_code;
- int bw_code;
-
- int nb_groups;
- int nb_mstr_exp;
- DBEGroup groups[MAX_GROUPS];
-
- int exp_strategy[MAX_GROUPS];
- int exponents[MAX_EXPONENTS];
- int bap[MAX_EXPONENTS];
- int idx[MAX_EXPONENTS];
-
- DECLARE_ALIGNED(32, float, mantissas)[MAX_MANTISSAS];
-} DBEChannel;
-
-typedef struct DBEDecodeContext {
- AVCodecContext *avctx;
- DBEContext dectx;
-
- DolbyEHeaderInfo metadata;
-
- DBEChannel channels[MAX_SEGMENTS][MAX_CHANNELS];
-
- DECLARE_ALIGNED(32, float, history)[MAX_CHANNELS][256];
-
- FFTContext imdct[3];
- AVFloatDSPContext *fdsp;
-} DBEDecodeContext;
-
-static const int8_t lfe_channel_tab[MAX_PROG_CONF + 1] = {
- 5, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, 5
-};
-
-static const uint8_t ch_reorder_4[4] = { 0, 2, 1, 3 };
-static const uint8_t ch_reorder_6[6] = { 0, 2, 4, 1, 3, 5 };
-static const uint8_t ch_reorder_8[8] = { 0, 2, 6, 4, 1, 3, 7, 5 };
-static const uint8_t ch_reorder_n[8] = { 0, 2, 4, 6, 1, 3, 5, 7 };
-
-
-static const uint8_t nb_groups_tab[4] = { 1, 8, 7, 1 };
-
-static const uint8_t nb_mstr_exp_tab[4] = { 2, 2, 2, 1 };
-
-static const uint8_t nb_mantissa_38[38] = {
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 2, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6,
- 7, 8, 9, 10, 11, 12,
-};
-
-static const uint8_t nb_mantissa_44[44] = {
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
- 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 5, 5, 6, 7, 7,
- 8, 9, 10, 11, 12, 13, 15, 16, 18, 20, 22, 25,
-};
-
-static const uint8_t nb_mantissa_50[50] = {
- 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3,
- 3, 4, 4, 5, 5, 6, 6, 7, 8, 9, 9, 10, 12, 13, 14, 16,
- 18, 19, 22, 24, 27, 29, 32, 36, 40, 44, 49, 54, 60, 66, 74, 82,
- 90, 100,
-};
-
-static const uint8_t imdct_bits_tab[3] = { 8, 9, 11 };
-
-static const DBEGroup grp_tab_0[1] = {
- { 50, { 27, 23 }, 0, 0, nb_mantissa_50, 2, 0, 1152, 0, 1408, 0 },
-};
-
-static const DBEGroup grp_tab_1[8] = {
- { 38, { 12, 26 }, 0, 0, nb_mantissa_38, 0, 0, 192, 0, 256, 0 },
- { 38, { 12, 26 }, 38, 128, nb_mantissa_38, 0, 1, 256, 64, 448, 0 },
- { 38, { 12, 26 }, 76, 256, nb_mantissa_38, 0, 1, 256, 192, 704, 0 },
- { 38, { 12, 26 }, 114, 384, nb_mantissa_38, 0, 1, 256, 320, 0, 0 },
- { 38, { 12, 26 }, 152, 512, nb_mantissa_38, 0, 1, 256, 448, 0, 0 },
- { 38, { 12, 26 }, 190, 640, nb_mantissa_38, 0, 1, 256, 576, 0, 0 },
- { 38, { 12, 26 }, 228, 768, nb_mantissa_38, 0, 1, 256, 704, 0, 0 },
- { 38, { 12, 26 }, 266, 896, nb_mantissa_38, 0, 1, 256, 832, 0, 0 },
-};
-
-static const DBEGroup grp_tab_2[7] = {
- { 38, { 12, 26 }, 0, 0, nb_mantissa_38, 0, 0, 192, 0, 256, 0 },
- { 38, { 12, 26 }, 38, 128, nb_mantissa_38, 0, 1, 256, 64, 448, 0 },
- { 38, { 12, 26 }, 76, 256, nb_mantissa_38, 0, 1, 256, 192, 704, 0 },
- { 38, { 12, 26 }, 114, 384, nb_mantissa_38, 0, 1, 256, 320, 0, 0 },
- { 38, { 12, 26 }, 152, 512, nb_mantissa_38, 0, 1, 256, 448, 0, 0 },
- { 38, { 12, 26 }, 190, 640, nb_mantissa_38, 0, 1, 256, 576, 0, 0 },
- { 44, { 19, 25 }, 228, 768, nb_mantissa_44, 1, 1, 448, 704, 960, 64 },
-};
-
-static const DBEGroup grp_tab_3[1] = {
- { 21, { 21 }, 0, 0, nb_mantissa_50, 2, 0, 1152, 0, 1408, 0 },
-};
-
-static const DBEGroup grp_tab_4[1] = {
- { 50, { 27, 23 }, 0, 0, nb_mantissa_50, 2, 2, 1152, 0, 1408, 896 },
-};
-
-static const DBEGroup grp_tab_5[8] = {
- { 38, { 12, 26 }, 0, 0, nb_mantissa_38, 0, 1, 256, 64, 0, 0 },
- { 38, { 12, 26 }, 38, 128, nb_mantissa_38, 0, 1, 256, 192, 0, 0 },
- { 38, { 12, 26 }, 76, 256, nb_mantissa_38, 0, 1, 256, 320, 0, 0 },
- { 38, { 12, 26 }, 114, 384, nb_mantissa_38, 0, 1, 256, 448, 0, 0 },
- { 38, { 12, 26 }, 152, 512, nb_mantissa_38, 0, 1, 256, 576, 0, 0 },
- { 38, { 12, 26 }, 190, 640, nb_mantissa_38, 0, 1, 256, 704, 3008, 0 },
- { 38, { 12, 26 }, 228, 768, nb_mantissa_38, 0, 1, 256, 832, 2752, 0 },
- { 38, { 12, 26 }, 266, 896, nb_mantissa_38, 0, 2, 192, 960, 2560, 64 },
-};
-
-static const DBEGroup grp_tab_6[7] = {
- { 44, { 19, 25 }, 0, 0, nb_mantissa_44, 1, 1, 448, 0, 3264, 0 },
- { 38, { 12, 26 }, 44, 256, nb_mantissa_38, 0, 1, 256, 320, 0, 0 },
- { 38, { 12, 26 }, 82, 384, nb_mantissa_38, 0, 1, 256, 448, 0, 0 },
- { 38, { 12, 26 }, 120, 512, nb_mantissa_38, 0, 1, 256, 576, 0, 0 },
- { 38, { 12, 26 }, 158, 640, nb_mantissa_38, 0, 1, 256, 704, 3008, 0 },
- { 38, { 12, 26 }, 196, 768, nb_mantissa_38, 0, 1, 256, 832, 2752, 0 },
- { 38, { 12, 26 }, 234, 896, nb_mantissa_38, 0, 2, 192, 960, 2560, 64 },
-};
-
-static const DBEGroup grp_tab_7[1] = {
- { 21, { 21 }, 0, 0, nb_mantissa_50, 2, 2, 1152, 0, 1408, 896 },
-};
-
-static const DBEGroup *const frm_ofs_tab[2][4] = {
- { grp_tab_0, grp_tab_1, grp_tab_2, grp_tab_3 },
- { grp_tab_4, grp_tab_5, grp_tab_6, grp_tab_7 }
-};
-
-static const uint8_t mantissa_size1[16][4] = {
- { 0, 0, 0, 0 }, { 2, 1, 1, 1 }, { 3, 2, 1, 1 }, { 4, 3, 2, 1 },
- { 5, 4, 3, 2 }, { 6, 5, 4, 3 }, { 7, 6, 5, 4 }, { 8, 7, 6, 5 },
- { 9, 8, 7, 6 }, { 10, 9, 8, 7 }, { 11, 10, 9, 8 }, { 12, 11, 10, 9 },
- { 13, 12, 11, 10 }, { 14, 13, 12, 11 }, { 15, 14, 13, 12 }, { 16, 15, 14, 13 },
-};
-
-static const uint8_t mantissa_size2[16][4] = {
- { 0, 0, 0, 0 }, { 2, 1, 2, 2 }, { 3, 2, 3, 3 }, { 4, 3, 4, 4 },
- { 5, 4, 5, 5 }, { 6, 5, 6, 6 }, { 7, 6, 7, 7 }, { 8, 7, 8, 8 },
- { 9, 8, 9, 9 }, { 10, 9, 10, 10 }, { 11, 10, 11, 11 }, { 12, 11, 12, 12 },
- { 13, 12, 13, 13 }, { 14, 13, 14, 14 }, { 15, 14, 15, 15 }, { 16, 15, 16, 16 },
-};
-
-static const float start_window[192] = {
- 0.00161569379826, 0.00185748233347, 0.00198562758548, 0.00207834078104,
- 0.00215717748523, 0.00223067096393, 0.00230299213147, 0.00237651215396,
- 0.00245275561606, 0.00253281402069, 0.00261754673613, 0.00270768786168,
- 0.00280390761895, 0.00290684998656, 0.00301715751161, 0.00313548872798,
- 0.00326253122934, 0.00339901215995, 0.00354570716636, 0.00370344845023,
- 0.00387313232586, 0.00405572653911, 0.00425227750970, 0.00446391759265,
- 0.00469187240551, 0.00493746822816, 0.00520213944619, 0.00548743597507,
- 0.00579503056737, 0.00612672586953, 0.00648446105606, 0.00687031782873,
- 0.00728652552677, 0.00773546505205, 0.00821967127415, 0.00874183354619,
- 0.00930479393832, 0.00991154278653, 0.01056521116692, 0.01126905994567,
- 0.01202646513050, 0.01284089936559, 0.01371590957417, 0.01465509096066,
- 0.01566205783408, 0.01674041199523, 0.01789370972358, 0.01912542867865,
- 0.02043893626265, 0.02183746113793, 0.02332406961796, 0.02490164852364,
- 0.02657289580178, 0.02834031974193, 0.03020624702903, 0.03217283918354,
- 0.03424211623810, 0.03641598586180, 0.03869627565015, 0.04108476601498,
- 0.04358322107390, 0.04619341515939, 0.04891715301882, 0.05175628239149,
-
- 0.05471237327267, 0.05778734733755, 0.06098291402413, 0.06430101352084,
- 0.06774345212186, 0.07131188644726, 0.07500780649199, 0.07883251748595,
- 0.08278712056651, 0.08687249228061, 0.09108926295730, 0.09543779401074,
- 0.09991815425851, 0.10453009536427, 0.10927302653894, 0.11414598865987,
- 0.11914762799220, 0.12427616972097, 0.12952939152560, 0.13490459744934,
- 0.14039859233595, 0.14600765712201, 0.15172752528722, 0.15755336077528,
- 0.16347973770491, 0.16950062219342, 0.17560935661442, 0.18179864660619,
- 0.18806055113821, 0.19438647593012, 0.20076717050010, 0.20719272909882,
- 0.21365259576030, 0.22013557367283, 0.22662983904194, 0.23312295958328,
- 0.23960191774666, 0.24605313873388, 0.25246252333253, 0.25881548554631,
- 0.26509699495987, 0.27129162373316, 0.27738359807707, 0.28335685401987,
- 0.28919509723179, 0.29488186663467, 0.30040060148455, 0.30573471157819,
- 0.31086765019993, 0.31578298939317, 0.32046449711227, 0.32489621578468,
- 0.32906254179156, 0.33294830535654, 0.33653885031840, 0.33982011325336,
- 0.34277870140679, 0.34540196889300, 0.34767809062480, 0.34959613344194,
- 0.35114612391958, 0.35231911235422, 0.35310723244504, 0.35350375621308,
-
- 0.35350314372945, 0.35310108725579, 0.35229454943591, 0.35108179521634,
- 0.34946241721522, 0.34743735430290, 0.34500890320420, 0.34218072298001,
- 0.33895783229541, 0.33534659943168, 0.33135472505060, 0.32699121776996,
- 0.32226636266000, 0.31719168282019, 0.31177989424432, 0.30604485422875,
- 0.30000150362379, 0.29366580327088, 0.28705466500775, 0.28018587766131,
- 0.27307802848095, 0.26575042049535, 0.25822298630189, 0.25051619882000,
- 0.24265097955783, 0.23464860495522, 0.22653061137548, 0.21831869932335,
- 0.21003463746705, 0.20170016703857, 0.19333690717811, 0.18496626177620,
- 0.17660932835062, 0.16828680947474, 0.16001892724986, 0.15182534128597,
- 0.14372507062477, 0.13573642000364, 0.12787691082233, 0.12016321713317,
- 0.11261110693234, 0.10523538898282, 0.09804986534955, 0.09106728977263,
- 0.08429933194438, 0.07775654768810, 0.07144835495683, 0.06538301547324,
- 0.05956762170687, 0.05400808871425, 0.04870915012107, 0.04367435714993,
- 0.03890607899172, 0.03440550179663, 0.03017262174627, 0.02620622428513,
- 0.02250383492507, 0.01906161305732, 0.01587412848221, 0.01293388032354,
- 0.01023019677288, 0.00774641320626, 0.00545109736891, 0.00325868651263,
-};
-
-static const float short_window2[192] = {
- 0.00018861094606, 0.00033433010202, 0.00050309624485, 0.00070306161748,
- 0.00093995174533, 0.00121913067128, 0.00154606505568, 0.00192647806126,
- 0.00236641248692, 0.00287225985240, 0.00345077377440, 0.00410907465023,
- 0.00485464855241, 0.00569534163219, 0.00663935063508, 0.00769520981249,
- 0.00887177436246, 0.01017820046395, 0.01162392194150, 0.01321862359335,
- 0.01497221122468, 0.01689477844427, 0.01899657030441, 0.02128794388846,
- 0.02377932597692, 0.02648116795039, 0.02940389811590, 0.03255787167130,
- 0.03595331854986, 0.03960028941437, 0.04350860009563, 0.04768777479454,
- 0.05214698838949, 0.05689500821121, 0.06194013566525, 0.06729014809766,
- 0.07295224131210, 0.07893297315602, 0.08523820859989, 0.09187306673620,
- 0.09884187012422, 0.10614809690222, 0.11379433608064, 0.12178224641797,
- 0.13011251926531, 0.13878484574660, 0.14779788861830, 0.15714925912610,
- 0.16683549914631, 0.17685206886673, 0.18719334022589, 0.19785259629099,
- 0.20882203671372, 0.22009278936030, 0.23165492816694, 0.24349749722585,
- 0.25560854105961, 0.26797514099368, 0.28058345748882, 0.29341877824732,
- 0.30646557185942, 0.31970754671026, 0.33312771482295, 0.34670846027024,
-
- 0.36043161174692, 0.37427851885723, 0.38823013163645, 0.40226708279486,
- 0.41636977214436, 0.43051845264462, 0.44469331748632, 0.45887458761470,
- 0.47304259908636, 0.48717788964798, 0.50126128392546, 0.51527397661778,
- 0.52919761310050, 0.54301436685998, 0.55670701320069, 0.57025899869448,
- 0.58365450587230, 0.59687851269542, 0.60991684638414, 0.62275623122793,
- 0.63538433005035, 0.64778977905593, 0.65996221584264, 0.67189230042379,
- 0.68357172916486, 0.69499324160511, 0.70615062019861, 0.71703868307548,
- 0.72765326998919, 0.73799122168099, 0.74805035295521, 0.75782941981995,
- 0.76732808110520, 0.77654685502339, 0.78548707118622, 0.79415081863423,
- 0.80254089047207, 0.81066072573188, 0.81851434910893, 0.82610630922734,
- 0.83344161609862, 0.84052567843230, 0.84736424144524, 0.85396332579459,
- 0.86032916822973, 0.86646816451999, 0.87238681516918, 0.87809167437532,
- 0.88358930263537, 0.88888622333073, 0.89398888356256, 0.89890361943564,
- 0.90363662591861, 0.90819393133744, 0.91258137648979, 0.91680459830070,
- 0.92086901787718, 0.92477983276087, 0.92854201312583, 0.93216030163834,
- 0.93563921662343, 0.93898305819384, 0.94219591693690, 0.94528168477979,
-
- 0.94823843319821, 0.95106834367330, 0.95377776558539, 0.95636718335775,
- 0.95883679961479, 0.96118650212341, 0.96341583179195, 0.96552395212906,
- 0.96750962060547, 0.96937116231768, 0.97110644638309, 0.97271286544154,
- 0.97418731862798, 0.97552619834964, 0.97672538116257, 0.97778022299974,
- 0.97868555895586, 0.97943570778357, 0.98002448120255, 0.98044519806866,
- 0.98069070339493, 0.98075339216123, 0.98062523779637, 0.98029782516478,
- 0.97976238784222, 0.97900984942031, 0.97803086854002, 0.97681588731895,
- 0.97535518280755, 0.97363892108474, 0.97165721358452, 0.96940017523145,
- 0.96685798395452, 0.96402094114589, 0.96087953263194, 0.95742448973047,
- 0.95364684997699, 0.94953801711660, 0.94508981997396, 0.94029456983253,
- 0.93514511597504, 0.92963489905951, 0.92375800202883, 0.91750919827624,
- 0.91088399681406, 0.90387868421832, 0.89649036314692, 0.88871698725397,
- 0.88055739234735, 0.87201132366062, 0.86307945913336, 0.85376342861693,
- 0.84406582894455, 0.83399023482637, 0.82354120554757, 0.81272428745995,
- 0.80154601230457, 0.79001389138101, 0.77813640562199, 0.76592299164227,
- 0.75338402384395, 0.74053079267526, 0.72737547915460, 0.71393112578527,
-};
-
-static const float short_window3[64] = {
- 0.00326887936450, 0.00550242900936, 0.00786846643791, 0.01045683453520,
- 0.01330402120132, 0.01643221072863, 0.01985798040609, 0.02359509464766,
- 0.02765559221954, 0.03205025893128, 0.03678884369614, 0.04188015679495,
- 0.04733210987781, 0.05315172583924, 0.05934513287609, 0.06591755045290,
- 0.07287327156378, 0.08021564389822, 0.08794705152307, 0.09606889811179,
- 0.10458159240070, 0.11348453632940, 0.12277611617809, 0.13245369691511,
- 0.14251361989876, 0.15295120402567, 0.16376075037904, 0.17493555039885,
- 0.18646789757072, 0.19834910260891, 0.21056951208995, 0.22311853047787,
- 0.23598464546683, 0.24915545655419, 0.26261770674500, 0.27635731727778,
- 0.29035942525136, 0.30460842402318, 0.31908800624032, 0.33378120935681,
- 0.34867046348260, 0.36373764140285, 0.37896411059909, 0.39433078709788,
- 0.40981819096657, 0.42540650327031, 0.44107562429959, 0.45680523287270,
- 0.47257484651351, 0.48836388230077, 0.50415171818214, 0.51991775454258,
- 0.53564147581496, 0.55130251191887, 0.56688069931047, 0.58235614142007,
- 0.59770926827271, 0.61292089506118, 0.62797227945823, 0.64284517745255,
- 0.65752189749349, 0.67198535273209, 0.68621911114984, 0.70020744337099,
-};
-
-static const uint8_t dc_code_tab[5] = { 0, 0, 0, 1, 1 };
-
-static const uint8_t ht_code_tab[5] = { 0, 0, 1, 2, 2 };
-
-static const uint8_t band_ofs_tab[3][4] = {
- { 12, 8, 4, 0 }, { 14, 10, 6, 0 }, { 12, 8, 4, 0 }
-};
-
-static const uint8_t band_low_tab[3] = { 9, 17, 24 };
-
-static const uint16_t fast_gain_tab[8] = {
- 128, 256, 384, 512, 640, 768, 896, 1024
-};
-
-static const uint16_t slow_decay_tab[2][2] = { { 27, -1 }, { 32, 21 } };
-
-static const uint16_t misc_decay_tab[3][2][2] = {
- { { 354, -1 }, { 425, 425 } },
- { { 266, -1 }, { 320, -1 } },
- { { 213, -1 }, { 256, -1 } }
-};
-
-static const uint16_t fast_decay_tab[3][2][2][50] = {
- {{{
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
- 142, 142, 142, 142, 142, 142, 142, 142,
- }, {
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- }}, {{
- 170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
- 170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
- 170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
- 170, 170, 170, 170, 170, 170, 170, 170,
- }, {
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64,
- }}}, {{{
- 266, 266, 106, 106, 106, 106, 106, 106, 106, 106,
- 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
- 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
- 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
- 106, 106, 106, 106,
- }, {
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1,
- }}, {{
- 319, 319, 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128,
- }, {
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1,
- }}}, {{{
- 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
- 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
- 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
- 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
- 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
- }, {
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- }}, {{
- 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
- }, {
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- }}}
-};
-
-static const uint16_t fast_gain_adj_tab[3][2][62] = {
- {{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 2, 4, 7, 11, 16, 29, 44, 59,
- 76, 94, 116, 142, 179, 221, 252, 285, 312, 334,
- }, {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 2, 5, 8, 10, 15, 28, 42, 57, 75, 93,
- 115, 140, 177, 219, 247, 280, 308, 330, 427, 533,
- }}, {{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 2, 5, 8, 12, 21, 35, 51, 69, 89,
- 111, 138, 176, 220, 251, 284, 312, 334,
- }, {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
- 5, 8, 11, 18, 33, 49, 65, 84, 106, 132,
- 168, 214, 245, 279, 308, 329, 427, 533,
- }}, {{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 4, 7, 10, 17,
- 31, 47, 65, 84, 107, 134, 171, 215, 250, 283,
- 312, 334,
- }, {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 3, 6, 9, 13, 27, 43,
- 60, 79, 100, 126, 160, 207, 242, 276, 307, 329,
- 427, 533,
- }}
-};
-
-static const uint16_t slow_gain_tab[3][2][50] = {
- {{
- 3072, 3072, 3072, 3072, 3072, 3072, 1063, 1063, 1063, 1063,
- 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063,
- 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063,
- 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063,
- }, {
- 3072, 3072, 3072, 3072, 3072, 3072, 850, 850, 850, 850,
- 850, 850, 850, 850, 850, 850, 850, 850, 850, 850,
- 850, 850, 850, 850, 850, 850, 850, 850, 850, 850,
- 850, 850, 850, 850, 850, 850, 850, 850,
- }}, {{
- 3072, 1212, 1212, 1212, 999, 999, 999, 999, 999, 999,
- 999, 999, 999, 999, 999, 999, 999, 999, 999, 999,
- 999, 999, 999, 999, 999, 999, 999, 999, 999, 999,
- 999, 999, 999, 999, 999, 999, 999, 999, 999, 999,
- 999, 999, 999, 999,
- }, {
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1,
- }}, {{
- 3072, 3072, 3072, 3072, 3072, 3072, 3072, 3072, 3072, 3072,
- 999, 999, 999, 999, 999, 999, 999, 999, 999, 999,
- 999, 999, 999, 999, 999, 999, 999, 999, 999, 999,
- 999, 999, 999, 999, 999, 999, 999, 999, 999, 999,
- 999, 999, 999, 999, 999, 999, 999, 999, 999, 999,
- }, {
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- }}
-};
-
-static const uint16_t hearing_thresh_tab[3][3][50] = {
- {{
- 1403, 1141, 1000, 959, 948, 957, 946, 925, 899, 871,
- 843, 815, 789, 766, 745, 727, 705, 687, 681, 686,
- 701, 725, 768, 854, 940, 1018, 1075, 1103, 1111, 1106,
- 1098, 1105, 1142, 1237, 1419, 1721, 2169, 2805,
- }, {
- 1401, 1130, 995, 957, 947, 955, 941, 918, 890, 861,
- 831, 803, 777, 754, 734, 717, 698, 684, 682, 692,
- 712, 743, 798, 894, 976, 1045, 1091, 1109, 1110, 1102,
- 1098, 1116, 1174, 1300, 1526, 1884, 2401, 3072,
- }, {
- 1393, 1086, 974, 949, 957, 941, 913, 878, 843, 808,
- 777, 750, 727, 708, 695, 686, 681, 689, 714, 752,
- 811, 888, 971, 1044, 1087, 1108, 1110, 1102, 1098, 1115,
- 1172, 1290, 1489, 1812, 2293, 2964, 3072, 3072,
- }}, {{
- 1412, 1343, 1141, 1047, 1000, 974, 959, 951, 948, 947,
- 957, 953, 946, 936, 925, 906, 878, 850, 822, 795,
- 771, 745, 719, 700, 687, 681, 685, 701, 733, 784,
- 885, 977, 1047, 1092, 1110, 1108, 1099, 1102, 1138, 1233,
- 1413, 1711, 2157, 2797,
- }, {
- 1412, 1336, 1130, 1040, 995, 970, 957, 950, 947, 947,
- 955, 950, 941, 930, 918, 897, 868, 838, 810, 783,
- 759, 734, 710, 693, 684, 681, 690, 712, 752, 823,
- 924, 1009, 1069, 1102, 1111, 1104, 1098, 1111, 1168, 1295,
- 1518, 1873, 2388, 3072,
- }, {
- 1411, 1293, 1086, 1009, 974, 957, 949, 947, 957, 951,
- 941, 928, 913, 896, 878, 852, 817, 785, 756, 732,
- 713, 695, 683, 682, 689, 710, 746, 811, 906, 992,
- 1061, 1099, 1111, 1106, 1098, 1107, 1155, 1266, 1471, 1799,
- 2277, 2945, 3072, 3072,
- }}, {{
- 1431, 1412, 1403, 1379, 1343, 1293, 1229, 1180, 1125, 1075,
- 1040, 1014, 996, 979, 965, 957, 951, 948, 947, 957,
- 951, 940, 924, 903, 877, 846, 815, 785, 753, 725,
- 702, 686, 681, 689, 714, 760, 847, 947, 1028, 1083,
- 1108, 1109, 1101, 1100, 1132, 1222, 1402, 1705, 2160, 2803,
- }, {
- 1431, 1412, 1401, 1375, 1336, 1278, 1215, 1168, 1115, 1066,
- 1032, 1008, 991, 975, 962, 954, 950, 947, 947, 955,
- 948, 935, 916, 894, 866, 835, 803, 772, 742, 715,
- 695, 683, 683, 697, 729, 784, 887, 982, 1054, 1096,
- 1111, 1106, 1098, 1107, 1159, 1281, 1505, 1865, 2391, 3072,
- }, {
- 1427, 1411, 1393, 1353, 1293, 1215, 1160, 1118, 1072, 1031,
- 1003, 984, 971, 960, 952, 948, 947, 957, 952, 941,
- 924, 902, 876, 847, 815, 781, 750, 723, 700, 685,
- 681, 691, 719, 766, 858, 958, 1039, 1089, 1109, 1108,
- 1099, 1102, 1141, 1245, 1442, 1766, 2250, 2930, 3072, 3072,
- }}
-};
-
-static const int16_t lwc_gain_tab[11][7] = {
- { -21, -197, -271, -466, 32767, 32767, 32767 },
- { -197, -29, -244, -271, -540, 32767, 32767 },
- { -271, -244, -29, -249, -271, -593, 32767 },
- { -466, -271, -249, -29, -251, -271, -632 },
- { -540, -271, -251, -29, -251, -271, -664 },
- { -593, -271, -251, -29, -252, -271, -690 },
- { -632, -271, -252, -29, -252, -271, -711 },
- { -664, -271, -252, -29, -252, -271, -730 },
- { -690, -271, -252, -29, -252, -271, -745 },
- { -711, -271, -252, -29, -253, -271, -759 },
- { -730, -271, -253, -29, -253, -271, -771 },
-};
-
-static const int16_t lwc_adj_tab[7] = {
- -192, -320, -448, -512, -448, -320, -192,
-};
-
-static const uint8_t log_add_tab[212] = {
- 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 52, 51, 50,
- 49, 48, 47, 47, 46, 45, 44, 44, 43, 42, 41, 41, 40, 39, 38, 38,
- 37, 36, 36, 35, 35, 34, 33, 33, 32, 32, 31, 30, 30, 29, 29, 28,
- 28, 27, 27, 26, 26, 25, 25, 24, 24, 23, 23, 22, 22, 21, 21, 21,
- 20, 20, 19, 19, 19, 18, 18, 18, 17, 17, 17, 16, 16, 16, 15, 15,
- 15, 14, 14, 14, 13, 13, 13, 13, 12, 12, 12, 12, 11, 11, 11, 11,
- 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8,
- 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5,
- 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 0, 0,
-};
-
-static const uint8_t bap_tab[64] = {
- 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4,
- 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8,
- 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12,
- 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 15,
-};
-
-static float mantissa_tab1[17][4];
-static float mantissa_tab2[17][4];
-static float mantissa_tab3[17][4];
-static float exponent_tab[50];
-static float gain_tab[1024];
-
-DECLARE_ALIGNED(32, static float, window)[3712];
-
-#endif
1
0
ffmpeg | branch: master | James Almer <jamrial(a)gmail.com> | Sun Jan 24 18:33:23 2021 -0300| [12c8aeb2b822f8acec5a94ed4591ec6db9994c74] | committer: James Almer
fate/hlsenc: rework the ffprobe dependency of hls-fmp4_ac3
Add it to the existing FATE_SAMPLES_FFMPEG_FFPROBE list of ffprobe dependant
tests instead.
Signed-off-by: James Almer <jamrial(a)gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=12c8aeb2b822f8ace…
---
tests/fate/hlsenc.mak | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tests/fate/hlsenc.mak b/tests/fate/hlsenc.mak
index 02f041a7c2..aff81a83fc 100644
--- a/tests/fate/hlsenc.mak
+++ b/tests/fate/hlsenc.mak
@@ -105,9 +105,10 @@ tests/data/hls_fmp4_ac3.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
-hls_time 2 -hls_segment_filename "$(TARGET_PATH)/tests/data/hls_fmp4_ac3_%d.m4s" \
$(TARGET_PATH)/tests/data/hls_fmp4_ac3.m3u8 2>/dev/null
-FATE_HLSENC-$(call ALLYES, HLS_DEMUXER EAC3_DEMUXER) += fate-hls-fmp4_ac3
-fate-hls-fmp4_ac3: ffprobe$(PROGSSUF)$(EXESUF) tests/data/hls_fmp4_ac3.m3u8
+FATE_HLSENC_PROBE-$(call ALLYES, HLS_DEMUXER EAC3_DEMUXER) += fate-hls-fmp4_ac3
+fate-hls-fmp4_ac3: tests/data/hls_fmp4_ac3.m3u8
fate-hls-fmp4_ac3: CMD = probeaudiostream $(TARGET_PATH)/tests/data/now_ac3.mp4
FATE_SAMPLES_FFMPEG += $(FATE_HLSENC-yes)
-fate-hlsenc: $(FATE_HLSENC-yes)
+FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_HLSENC_PROBE-yes)
+fate-hlsenc: $(FATE_HLSENC-yes) $(FATE_HLSENC_PROBE-yes)
1
0
avcodec/h263data, ituh263*: Make initializing RL inter table thread-safe
by Andreas Rheinhardt 25 Jan '21
by Andreas Rheinhardt 25 Jan '21
25 Jan '21
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt(a)gmail.com> | Wed Dec 2 03:26:41 2020 +0100| [61fe481586425a41d45e371de1e875b49882477d] | committer: Andreas Rheinhardt
avcodec/h263data, ituh263*: Make initializing RL inter table thread-safe
Up until now, ff_h263_rl_inter was initialized by both ituh263dec and
ituh263enc; this is an obstacle in making the codecs that use this code
init-threadsafe.
This obstacle is eliminated by only initializing this RLTable from
a single place that is guarded by a dedicated AVOnce.
Reviewed-by: Anton Khirnov <anton(a)khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=61fe481586425a41d…
---
libavcodec/h263data.c | 16 ++++++++++++++--
libavcodec/h263data.h | 2 +-
libavcodec/ituh263dec.c | 2 +-
libavcodec/ituh263enc.c | 5 +++--
4 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/libavcodec/h263data.c b/libavcodec/h263data.c
index f649d58f4e..604a0425e1 100644
--- a/libavcodec/h263data.c
+++ b/libavcodec/h263data.c
@@ -25,11 +25,11 @@
#include <stdint.h>
+#include "libavutil/thread.h"
+
#include "h263data.h"
#include "mpegvideo.h"
-uint8_t ff_h263_static_rl_table_store[2][2][2 * MAX_RUN + MAX_LEVEL + 3];
-
/* intra MCBPC, mb_type = (intra), then (intraq) */
const uint8_t ff_h263_intra_MCBPC_code[9] = { 1, 1, 2, 3, 1, 1, 2, 3, 1 };
const uint8_t ff_h263_intra_MCBPC_bits[9] = { 1, 3, 3, 3, 4, 6, 6, 6, 9 };
@@ -290,3 +290,15 @@ const AVRational ff_h263_pixel_aspect[16] = {
{ 0, 1 },
{ 0, 1 },
};
+
+static av_cold void h263_init_rl_inter(void)
+{
+ static uint8_t h263_rl_inter_table[2][2 * MAX_RUN + MAX_LEVEL + 3];
+ ff_rl_init(&ff_h263_rl_inter, h263_rl_inter_table);
+}
+
+av_cold void ff_h263_init_rl_inter(void)
+{
+ static AVOnce init_static_once = AV_ONCE_INIT;
+ ff_thread_once(&init_static_once, h263_init_rl_inter);
+}
diff --git a/libavcodec/h263data.h b/libavcodec/h263data.h
index 3da0e3771f..144704d12b 100644
--- a/libavcodec/h263data.h
+++ b/libavcodec/h263data.h
@@ -61,7 +61,7 @@ extern const int8_t ff_inter_run[102];
extern RLTable ff_h263_rl_inter;
extern RLTable ff_rl_intra_aic;
-extern uint8_t ff_h263_static_rl_table_store[2][2][2 * MAX_RUN + MAX_LEVEL + 3];
+void ff_h263_init_rl_inter(void);
extern const uint16_t ff_h263_format[8][2];
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index ce044af9b3..565a6a1ac8 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -122,7 +122,7 @@ av_cold void ff_h263_decode_init_vlc(void)
INIT_VLC_STATIC(&ff_h263_mv_vlc, H263_MV_VLC_BITS, 33,
&ff_mvtab[0][1], 2, 1,
&ff_mvtab[0][0], 2, 1, 538);
- ff_rl_init(&ff_h263_rl_inter, ff_h263_static_rl_table_store[0]);
+ ff_h263_init_rl_inter();
INIT_VLC_RL(ff_h263_rl_inter, 554);
INIT_FIRST_VLC_RL(ff_rl_intra_aic, 554);
INIT_VLC_STATIC(&h263_mbtype_b_vlc, H263_MBTYPE_B_VLC_BITS, 15,
diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c
index e1debcf63b..43260e6984 100644
--- a/libavcodec/ituh263enc.c
+++ b/libavcodec/ituh263enc.c
@@ -759,10 +759,11 @@ av_cold void ff_h263_encode_init(MpegEncContext *s)
static int done = 0;
if (!done) {
+ static uint8_t rl_intra_table[2][2 * MAX_RUN + MAX_LEVEL + 3];
done = 1;
- ff_rl_init(&ff_h263_rl_inter, ff_h263_static_rl_table_store[0]);
- ff_rl_init(&ff_rl_intra_aic, ff_h263_static_rl_table_store[1]);
+ ff_rl_init(&ff_rl_intra_aic, rl_intra_table);
+ ff_h263_init_rl_inter();
init_uni_h263_rl_tab(&ff_rl_intra_aic, uni_h263_intra_aic_rl_len);
init_uni_h263_rl_tab(&ff_h263_rl_inter, uni_h263_inter_rl_len);
1
0
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt(a)gmail.com> | Wed Dec 2 01:08:32 2020 +0100| [12d0bb382b7f8f67981ec61aad1ce4f6840ab2dc] | committer: Andreas Rheinhardt
avcodec/ituh263enc: Remove unused function parameter
Reviewed-by: Anton Khirnov <anton(a)khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt(a)gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=12d0bb382b7f8f679…
---
libavcodec/ituh263enc.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c
index b1b78218a5..e1debcf63b 100644
--- a/libavcodec/ituh263enc.c
+++ b/libavcodec/ituh263enc.c
@@ -713,8 +713,7 @@ static av_cold void init_mv_penalty_and_fcode(MpegEncContext *s)
}
}
-static av_cold void init_uni_h263_rl_tab(RLTable *rl, uint32_t *bits_tab,
- uint8_t *len_tab)
+static av_cold void init_uni_h263_rl_tab(const RLTable *rl, uint8_t *len_tab)
{
int slevel, run, last;
@@ -738,10 +737,9 @@ static av_cold void init_uni_h263_rl_tab(RLTable *rl, uint32_t *bits_tab,
len= rl->table_vlc[code][1];
bits=bits*2+sign; len++;
- if(code!=rl->n && len < len_tab[index]){
- if(bits_tab) bits_tab[index]= bits;
+ if (code != rl->n && len < len_tab[index])
len_tab [index]= len;
- }
+
/* ESC */
bits= rl->table_vlc[rl->n][0];
len = rl->table_vlc[rl->n][1];
@@ -749,10 +747,8 @@ static av_cold void init_uni_h263_rl_tab(RLTable *rl, uint32_t *bits_tab,
bits=bits*64+run; len+=6;
bits=bits*256+(level&0xff); len+=8;
- if(len < len_tab[index]){
- if(bits_tab) bits_tab[index]= bits;
+ if (len < len_tab[index])
len_tab [index]= len;
- }
}
}
}
@@ -768,8 +764,8 @@ av_cold void ff_h263_encode_init(MpegEncContext *s)
ff_rl_init(&ff_h263_rl_inter, ff_h263_static_rl_table_store[0]);
ff_rl_init(&ff_rl_intra_aic, ff_h263_static_rl_table_store[1]);
- init_uni_h263_rl_tab(&ff_rl_intra_aic, NULL, uni_h263_intra_aic_rl_len);
- init_uni_h263_rl_tab(&ff_h263_rl_inter , NULL, uni_h263_inter_rl_len);
+ init_uni_h263_rl_tab(&ff_rl_intra_aic, uni_h263_intra_aic_rl_len);
+ init_uni_h263_rl_tab(&ff_h263_rl_inter, uni_h263_inter_rl_len);
init_mv_penalty_and_fcode(s);
}
1
0