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 | Anton Khirnov <anton(a)khirnov.net> | Fri Apr 17 10:32:12 2020 +0200| [3f0930387cd8f365381b02d03407ec33f06e6f05] | committer: Anton Khirnov
lavfi/vf_fspp: convert to the video_enc_params API
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3f0930387cd8f3653…
---
libavfilter/Makefile | 2 +-
libavfilter/vf_fspp.c | 59 ++++++++++++++++++++-------------------------------
libavfilter/vf_fspp.h | 4 ++--
3 files changed, 26 insertions(+), 39 deletions(-)
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 2d836f0a7f..1be93e443a 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -271,7 +271,7 @@ OBJS-$(CONFIG_FRAMESTEP_FILTER) += vf_framestep.o
OBJS-$(CONFIG_FREEZEDETECT_FILTER) += vf_freezedetect.o
OBJS-$(CONFIG_FREEZEFRAMES_FILTER) += vf_freezeframes.o
OBJS-$(CONFIG_FREI0R_FILTER) += vf_frei0r.o
-OBJS-$(CONFIG_FSPP_FILTER) += vf_fspp.o
+OBJS-$(CONFIG_FSPP_FILTER) += vf_fspp.o qp_table.o
OBJS-$(CONFIG_GBLUR_FILTER) += vf_gblur.o
OBJS-$(CONFIG_GEQ_FILTER) += vf_geq.o
OBJS-$(CONFIG_GRADFUN_FILTER) += vf_gradfun.o
diff --git a/libavfilter/vf_fspp.c b/libavfilter/vf_fspp.c
index e57e6f9ec6..d70952a142 100644
--- a/libavfilter/vf_fspp.c
+++ b/libavfilter/vf_fspp.c
@@ -41,6 +41,7 @@
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "internal.h"
+#include "qp_table.h"
#include "vf_fspp.h"
#define OFFSET(x) offsetof(FSPPContext, x)
@@ -526,13 +527,6 @@ static int config_input(AVFilterLink *inlink)
if (!fspp->temp || !fspp->src)
return AVERROR(ENOMEM);
- if (!fspp->use_bframe_qp && !fspp->qp) {
- fspp->non_b_qp_alloc_size = AV_CEIL_RSHIFT(inlink->w, 4) * AV_CEIL_RSHIFT(inlink->h, 4);
- fspp->non_b_qp_table = av_calloc(fspp->non_b_qp_alloc_size, sizeof(*fspp->non_b_qp_table));
- if (!fspp->non_b_qp_table)
- return AVERROR(ENOMEM);
- }
-
fspp->store_slice = store_slice_c;
fspp->store_slice2 = store_slice2_c;
fspp->mul_thrmat = mul_thrmat_c;
@@ -554,8 +548,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
AVFrame *out = in;
int qp_stride = 0;
- uint8_t *qp_table = NULL;
+ int8_t *qp_table = NULL;
int i, bias;
+ int ret = 0;
int custom_threshold_m[64];
bias = (1 << 4) + fspp->strength;
@@ -582,38 +577,25 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
* the quantizers from the B-frames (B-frames often have a higher QP), we
* need to save the qp table from the last non B-frame; this is what the
* following code block does */
- if (!fspp->qp) {
- qp_table = av_frame_get_qp_table(in, &qp_stride, &fspp->qscale_type);
-
- if (qp_table && !fspp->use_bframe_qp && in->pict_type != AV_PICTURE_TYPE_B) {
- int w, h;
-
- /* if the qp stride is not set, it means the QP are only defined on
- * a line basis */
- if (!qp_stride) {
- w = AV_CEIL_RSHIFT(inlink->w, 4);
- h = 1;
- } else {
- w = qp_stride;
- h = AV_CEIL_RSHIFT(inlink->h, 4);
- }
- if (w * h > fspp->non_b_qp_alloc_size) {
- int ret = av_reallocp_array(&fspp->non_b_qp_table, w, h);
- if (ret < 0) {
- fspp->non_b_qp_alloc_size = 0;
- return ret;
- }
- fspp->non_b_qp_alloc_size = w * h;
- }
+ if (!fspp->qp && (fspp->use_bframe_qp || in->pict_type != AV_PICTURE_TYPE_B)) {
+ ret = ff_qp_table_extract(in, &qp_table, &qp_stride, NULL, &fspp->qscale_type);
+ if (ret < 0) {
+ av_frame_free(&in);
+ return ret;
+ }
- av_assert0(w * h <= fspp->non_b_qp_alloc_size);
- memcpy(fspp->non_b_qp_table, qp_table, w * h);
+ if (!fspp->use_bframe_qp && in->pict_type != AV_PICTURE_TYPE_B) {
+ av_freep(&fspp->non_b_qp_table);
+ fspp->non_b_qp_table = qp_table;
+ fspp->non_b_qp_stride = qp_stride;
}
}
if (fspp->log2_count && !ctx->is_disabled) {
- if (!fspp->use_bframe_qp && fspp->non_b_qp_table)
+ if (!fspp->use_bframe_qp && fspp->non_b_qp_table) {
qp_table = fspp->non_b_qp_table;
+ qp_stride = fspp->non_b_qp_stride;
+ }
if (qp_table || fspp->qp) {
const int cw = AV_CEIL_RSHIFT(inlink->w, fspp->hsub);
@@ -628,7 +610,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
out = ff_get_video_buffer(outlink, aligned_w, aligned_h);
if (!out) {
av_frame_free(&in);
- return AVERROR(ENOMEM);
+ ret = AVERROR(ENOMEM);
+ goto finish;
}
av_frame_copy_props(out, in);
out->width = in->width;
@@ -652,7 +635,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
inlink->w, inlink->h);
av_frame_free(&in);
}
- return ff_filter_frame(outlink, out);
+ ret = ff_filter_frame(outlink, out);
+finish:
+ if (qp_table != fspp->non_b_qp_table)
+ av_freep(&qp_table);
+ return ret;
}
static av_cold void uninit(AVFilterContext *ctx)
diff --git a/libavfilter/vf_fspp.h b/libavfilter/vf_fspp.h
index 73d8c7c771..6623af450c 100644
--- a/libavfilter/vf_fspp.h
+++ b/libavfilter/vf_fspp.h
@@ -65,8 +65,8 @@ typedef struct FSPPContext {
int prev_q;
uint8_t *src;
int16_t *temp;
- uint8_t *non_b_qp_table;
- int non_b_qp_alloc_size;
+ int8_t *non_b_qp_table;
+ int non_b_qp_stride;
int use_bframe_qp;
void (*store_slice)(uint8_t *dst, int16_t *src,
1
0
ffmpeg | branch: master | Anton Khirnov <anton(a)khirnov.net> | Fri Apr 17 10:32:12 2020 +0200| [955bdb1d32b279ea7a773dba66ac375d98d71740] | committer: Anton Khirnov
lavfi/vf_pp7: convert to the video_enc_params API
Re-enable fate-filter-pp7
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=955bdb1d32b279ea7…
---
libavfilter/Makefile | 2 +-
libavfilter/vf_pp7.c | 14 +++++++++++---
tests/fate/filter-video.mak | 4 ++--
3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 88640e7477..2d836f0a7f 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -353,7 +353,7 @@ OBJS-$(CONFIG_PHOTOSENSITIVITY_FILTER) += vf_photosensitivity.o
OBJS-$(CONFIG_PIXDESCTEST_FILTER) += vf_pixdesctest.o
OBJS-$(CONFIG_PIXSCOPE_FILTER) += vf_datascope.o
OBJS-$(CONFIG_PP_FILTER) += vf_pp.o qp_table.o
-OBJS-$(CONFIG_PP7_FILTER) += vf_pp7.o
+OBJS-$(CONFIG_PP7_FILTER) += vf_pp7.o qp_table.o
OBJS-$(CONFIG_PREMULTIPLY_FILTER) += vf_premultiply.o framesync.o
OBJS-$(CONFIG_PREWITT_FILTER) += vf_convolution.o
OBJS-$(CONFIG_PREWITT_OPENCL_FILTER) += vf_convolution_opencl.o opencl.o \
diff --git a/libavfilter/vf_pp7.c b/libavfilter/vf_pp7.c
index 66979d9a13..ade7feb0b2 100644
--- a/libavfilter/vf_pp7.c
+++ b/libavfilter/vf_pp7.c
@@ -33,6 +33,7 @@
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "internal.h"
+#include "qp_table.h"
#include "vf_pp7.h"
enum mode {
@@ -323,10 +324,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
AVFrame *out = in;
int qp_stride = 0;
- uint8_t *qp_table = NULL;
+ int8_t *qp_table = NULL;
- if (!pp7->qp)
- qp_table = av_frame_get_qp_table(in, &qp_stride, &pp7->qscale_type);
+ if (!pp7->qp) {
+ int ret = ff_qp_table_extract(in, &qp_table, &qp_stride, NULL, &pp7->qscale_type);
+ if (ret < 0) {
+ av_frame_free(&in);
+ return ret;
+ }
+ }
if (!ctx->is_disabled) {
const int cw = AV_CEIL_RSHIFT(inlink->w, pp7->hsub);
@@ -341,6 +347,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
out = ff_get_video_buffer(outlink, aligned_w, aligned_h);
if (!out) {
av_frame_free(&in);
+ av_freep(&qp_table);
return AVERROR(ENOMEM);
}
av_frame_copy_props(out, in);
@@ -367,6 +374,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
inlink->w, inlink->h);
av_frame_free(&in);
}
+ av_freep(&qp_table);
return ff_filter_frame(outlink, out);
}
diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index 7f6b2d0f15..9c7e3489f4 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -573,9 +573,9 @@ fate-filter-pp4: CMD = video_filter "pp=be/ci"
fate-filter-pp5: CMD = video_filter "pp=md"
fate-filter-pp6: CMD = video_filter "pp=be/fd"
-#FATE_FILTER_VSYNTH-$(CONFIG_PP7_FILTER) += fate-filter-pp7
+FATE_FILTER_VSYNTH-$(CONFIG_PP7_FILTER) += fate-filter-pp7
fate-filter-pp7: fate-vsynth1-mpeg4-qprd
-fate-filter-pp7: CMD = framecrc -flags bitexact -idct simple -i $(TARGET_PATH)/tests/data/fate/vsynth1-mpeg4-qprd.avi -frames:v 5 -flags +bitexact -vf "pp7"
+fate-filter-pp7: CMD = framecrc -flags bitexact -export_side_data venc_params -idct simple -i $(TARGET_PATH)/tests/data/fate/vsynth1-mpeg4-qprd.avi -frames:v 5 -flags +bitexact -vf "pp7"
FATE_FILTER_VSYNTH-$(CONFIG_SPP_FILTER) += fate-filter-spp
fate-filter-spp: fate-vsynth1-mpeg4-qprd
1
0
ffmpeg | branch: master | Anton Khirnov <anton(a)khirnov.net> | Fri Apr 17 10:32:12 2020 +0200| [775707aba9d2181e144b6be5f312539460eff31e] | committer: Anton Khirnov
lavfi/vf_spp: convert to the video_enc_params API
Re-enable fate-filter-spp
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=775707aba9d2181e1…
---
libavfilter/Makefile | 2 +-
libavfilter/vf_spp.c | 55 ++++++++++++++++++++-------------------------
libavfilter/vf_spp.h | 2 +-
tests/fate/filter-video.mak | 4 ++--
4 files changed, 28 insertions(+), 35 deletions(-)
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 557f3b97c7..88640e7477 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -414,7 +414,7 @@ OBJS-$(CONFIG_SOBEL_FILTER) += vf_convolution.o
OBJS-$(CONFIG_SOBEL_OPENCL_FILTER) += vf_convolution_opencl.o opencl.o \
opencl/convolution.o
OBJS-$(CONFIG_SPLIT_FILTER) += split.o
-OBJS-$(CONFIG_SPP_FILTER) += vf_spp.o
+OBJS-$(CONFIG_SPP_FILTER) += vf_spp.o qp_table.o
OBJS-$(CONFIG_SR_FILTER) += vf_sr.o
OBJS-$(CONFIG_SSIM_FILTER) += vf_ssim.o framesync.o
OBJS-$(CONFIG_STEREO3D_FILTER) += vf_stereo3d.o
diff --git a/libavfilter/vf_spp.c b/libavfilter/vf_spp.c
index 54457ebb0b..6ea7e7458f 100644
--- a/libavfilter/vf_spp.c
+++ b/libavfilter/vf_spp.c
@@ -37,6 +37,7 @@
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "internal.h"
+#include "qp_table.h"
#include "vf_spp.h"
enum mode {
@@ -375,47 +376,34 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
AVFilterLink *outlink = ctx->outputs[0];
AVFrame *out = in;
int qp_stride = 0;
- const int8_t *qp_table = NULL;
+ int8_t *qp_table = NULL;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
const int depth = desc->comp[0].depth;
+ int ret = 0;
/* if we are not in a constant user quantizer mode and we don't want to use
* the quantizers from the B-frames (B-frames often have a higher QP), we
* need to save the qp table from the last non B-frame; this is what the
* following code block does */
- if (!s->qp) {
- qp_table = av_frame_get_qp_table(in, &qp_stride, &s->qscale_type);
-
- if (qp_table && !s->use_bframe_qp && in->pict_type != AV_PICTURE_TYPE_B) {
- int w, h;
-
- /* if the qp stride is not set, it means the QP are only defined on
- * a line basis */
- if (!qp_stride) {
- w = AV_CEIL_RSHIFT(inlink->w, 4);
- h = 1;
- } else {
- w = qp_stride;
- h = AV_CEIL_RSHIFT(inlink->h, 4);
- }
-
- if (w * h > s->non_b_qp_alloc_size) {
- int ret = av_reallocp_array(&s->non_b_qp_table, w, h);
- if (ret < 0) {
- s->non_b_qp_alloc_size = 0;
- return ret;
- }
- s->non_b_qp_alloc_size = w * h;
- }
+ if (!s->qp && (s->use_bframe_qp || in->pict_type != AV_PICTURE_TYPE_B)) {
+ ret = ff_qp_table_extract(in, &qp_table, &qp_stride, NULL, &s->qscale_type);
+ if (ret < 0) {
+ av_frame_free(&in);
+ return ret;
+ }
- av_assert0(w * h <= s->non_b_qp_alloc_size);
- memcpy(s->non_b_qp_table, qp_table, w * h);
+ if (!s->use_bframe_qp && in->pict_type != AV_PICTURE_TYPE_B) {
+ av_freep(&s->non_b_qp_table);
+ s->non_b_qp_table = qp_table;
+ s->non_b_qp_stride = qp_stride;
}
}
if (s->log2_count && !ctx->is_disabled) {
- if (!s->use_bframe_qp && s->non_b_qp_table)
- qp_table = s->non_b_qp_table;
+ if (!s->use_bframe_qp && s->non_b_qp_table) {
+ qp_table = s->non_b_qp_table;
+ qp_stride = s->non_b_qp_stride;
+ }
if (qp_table || s->qp) {
const int cw = AV_CEIL_RSHIFT(inlink->w, s->hsub);
@@ -430,7 +418,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
out = ff_get_video_buffer(outlink, aligned_w, aligned_h);
if (!out) {
av_frame_free(&in);
- return AVERROR(ENOMEM);
+ ret = AVERROR(ENOMEM);
+ goto finish;
}
av_frame_copy_props(out, in);
out->width = in->width;
@@ -454,7 +443,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
inlink->w, inlink->h);
av_frame_free(&in);
}
- return ff_filter_frame(outlink, out);
+ ret = ff_filter_frame(outlink, out);
+finish:
+ if (qp_table != s->non_b_qp_table)
+ av_freep(&qp_table);
+ return ret;
}
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
diff --git a/libavfilter/vf_spp.h b/libavfilter/vf_spp.h
index 879ed40f03..76c0c34ab2 100644
--- a/libavfilter/vf_spp.h
+++ b/libavfilter/vf_spp.h
@@ -39,7 +39,7 @@ typedef struct SPPContext {
uint16_t *temp;
AVDCT *dct;
int8_t *non_b_qp_table;
- int non_b_qp_alloc_size;
+ int non_b_qp_stride;
int use_bframe_qp;
int hsub, vsub;
diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index 9c48d65ef7..7f6b2d0f15 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -577,9 +577,9 @@ fate-filter-pp6: CMD = video_filter "pp=be/fd"
fate-filter-pp7: fate-vsynth1-mpeg4-qprd
fate-filter-pp7: CMD = framecrc -flags bitexact -idct simple -i $(TARGET_PATH)/tests/data/fate/vsynth1-mpeg4-qprd.avi -frames:v 5 -flags +bitexact -vf "pp7"
-#FATE_FILTER_VSYNTH-$(CONFIG_SPP_FILTER) += fate-filter-spp
+FATE_FILTER_VSYNTH-$(CONFIG_SPP_FILTER) += fate-filter-spp
fate-filter-spp: fate-vsynth1-mpeg4-qprd
-fate-filter-spp: CMD = framecrc -flags bitexact -idct simple -i $(TARGET_PATH)/tests/data/fate/vsynth1-mpeg4-qprd.avi -frames:v 5 -flags +bitexact -vf "spp=idct=simple:dct=int"
+fate-filter-spp: CMD = framecrc -flags bitexact -export_side_data venc_params -idct simple -i $(TARGET_PATH)/tests/data/fate/vsynth1-mpeg4-qprd.avi -frames:v 5 -flags +bitexact -vf "spp=idct=simple:dct=int"
FATE_FILTER_VSYNTH-$(CONFIG_CODECVIEW_FILTER) += fate-filter-codecview
fate-filter-codecview: fate-vsynth1-mpeg4-qprd
1
0
ffmpeg | branch: master | Anton Khirnov <anton(a)khirnov.net> | Fri Apr 17 10:32:12 2020 +0200| [a11ee841949170e18c3670bec4bb312b844ebe59] | committer: Anton Khirnov
lavfi/vf_pp: convert to the video_enc_params API
Re-enable fate-filter-qp and fate-filter-pp.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a11ee841949170e18…
---
libavfilter/Makefile | 2 +-
libavfilter/vf_pp.c | 19 +++++++++++++++----
tests/fate/filter-video.mak | 6 +++---
3 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 526da8d69e..557f3b97c7 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -352,7 +352,7 @@ OBJS-$(CONFIG_PHASE_FILTER) += vf_phase.o
OBJS-$(CONFIG_PHOTOSENSITIVITY_FILTER) += vf_photosensitivity.o
OBJS-$(CONFIG_PIXDESCTEST_FILTER) += vf_pixdesctest.o
OBJS-$(CONFIG_PIXSCOPE_FILTER) += vf_datascope.o
-OBJS-$(CONFIG_PP_FILTER) += vf_pp.o
+OBJS-$(CONFIG_PP_FILTER) += vf_pp.o qp_table.o
OBJS-$(CONFIG_PP7_FILTER) += vf_pp7.o
OBJS-$(CONFIG_PREMULTIPLY_FILTER) += vf_premultiply.o framesync.o
OBJS-$(CONFIG_PREWITT_FILTER) += vf_convolution.o
diff --git a/libavfilter/vf_pp.c b/libavfilter/vf_pp.c
index 524ef1bb0a..29ab777e01 100644
--- a/libavfilter/vf_pp.c
+++ b/libavfilter/vf_pp.c
@@ -26,7 +26,9 @@
#include "libavutil/avassert.h"
#include "libavutil/opt.h"
+
#include "internal.h"
+#include "qp_table.h"
#include "libpostproc/postprocess.h"
@@ -126,8 +128,9 @@ static int pp_filter_frame(AVFilterLink *inlink, AVFrame *inbuf)
const int aligned_w = FFALIGN(outlink->w, 8);
const int aligned_h = FFALIGN(outlink->h, 8);
AVFrame *outbuf;
- int qstride, qp_type;
- int8_t *qp_table ;
+ int qstride = 0;
+ int8_t *qp_table = NULL;
+ int ret;
outbuf = ff_get_video_buffer(outlink, aligned_w, aligned_h);
if (!outbuf) {
@@ -137,7 +140,14 @@ static int pp_filter_frame(AVFilterLink *inlink, AVFrame *inbuf)
av_frame_copy_props(outbuf, inbuf);
outbuf->width = inbuf->width;
outbuf->height = inbuf->height;
- qp_table = av_frame_get_qp_table(inbuf, &qstride, &qp_type);
+
+ ret = ff_qp_table_extract(inbuf, &qp_table, &qstride, NULL, NULL);
+ if (ret < 0) {
+ av_frame_free(&inbuf);
+ av_frame_free(&outbuf);
+ av_freep(&qp_table);
+ return ret;
+ }
pp_postprocess((const uint8_t **)inbuf->data, inbuf->linesize,
outbuf->data, outbuf->linesize,
@@ -146,9 +156,10 @@ static int pp_filter_frame(AVFilterLink *inlink, AVFrame *inbuf)
qstride,
pp->modes[pp->mode_id],
pp->pp_ctx,
- outbuf->pict_type | (qp_type ? PP_PICT_TYPE_QP2 : 0));
+ outbuf->pict_type | (qp_table ? PP_PICT_TYPE_QP2 : 0));
av_frame_free(&inbuf);
+ av_freep(&qp_table);
return ff_filter_frame(outlink, outbuf);
}
diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index 7f5c07fd24..9c48d65ef7 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -561,11 +561,11 @@ fate-filter-idet: CMD = framecrc -flags bitexact -idct simple -i $(SRC) -vf idet
FATE_FILTER_VSYNTH-$(CONFIG_PAD_FILTER) += fate-filter-pad
fate-filter-pad: CMD = video_filter "pad=iw*1.5:ih*1.5:iw*0.3:ih*0.2"
-#FATE_FILTER_PP = fate-filter-pp fate-filter-pp1 fate-filter-pp2 fate-filter-pp3 fate-filter-pp4 fate-filter-pp5 fate-filter-pp6
+FATE_FILTER_PP = fate-filter-pp fate-filter-pp1 fate-filter-pp2 fate-filter-pp3 fate-filter-pp4 fate-filter-pp5 fate-filter-pp6
FATE_FILTER_VSYNTH-$(CONFIG_PP_FILTER) += $(FATE_FILTER_PP)
$(FATE_FILTER_PP): fate-vsynth1-mpeg4-qprd
-fate-filter-pp: CMD = framecrc -flags bitexact -idct simple -i $(TARGET_PATH)/tests/data/fate/vsynth1-mpeg4-qprd.avi -frames:v 5 -flags +bitexact -vf "pp=be/hb/vb/tn/l5/al"
+fate-filter-pp: CMD = framecrc -flags bitexact -export_side_data venc_params -idct simple -i $(TARGET_PATH)/tests/data/fate/vsynth1-mpeg4-qprd.avi -frames:v 5 -flags +bitexact -vf "pp=be/hb/vb/tn/l5/al"
fate-filter-pp1: CMD = video_filter "pp=fq|4/be/hb/vb/tn/l5/al"
fate-filter-pp2: CMD = video_filter "qp=2*(x+y),pp=be/h1/v1/lb"
fate-filter-pp3: CMD = video_filter "qp=2*(x+y),pp=be/ha|128|7/va/li"
@@ -585,7 +585,7 @@ FATE_FILTER_VSYNTH-$(CONFIG_CODECVIEW_FILTER) += fate-filter-codecview
fate-filter-codecview: fate-vsynth1-mpeg4-qprd
fate-filter-codecview: CMD = framecrc -flags bitexact -idct simple -flags2 +export_mvs -i $(TARGET_PATH)/tests/data/fate/vsynth1-mpeg4-qprd.avi -frames:v 5 -flags +bitexact -vf codecview=mv=pf+bf+bb
-#FATE_FILTER_VSYNTH-$(call ALLYES, QP_FILTER PP_FILTER) += fate-filter-qp
+FATE_FILTER_VSYNTH-$(call ALLYES, QP_FILTER PP_FILTER) += fate-filter-qp
fate-filter-qp: CMD = video_filter "qp=34,pp=be/hb/vb/tn/l5/al"
FATE_FILTER_VSYNTH-$(CONFIG_SELECT_FILTER) += fate-filter-select
1
0
ffmpeg | branch: master | Anton Khirnov <anton(a)khirnov.net> | Mon Dec 14 14:36:05 2020 +0100| [fba0ecbe20db2d63c0227887ce21a137da68b30d] | committer: Anton Khirnov
lavfi: add common code to handle QP tables
It will be used for converting the *pp filters to the new
AVVideoEncParams API.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fba0ecbe20db2d63c…
---
libavfilter/qp_table.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++
libavfilter/qp_table.h | 33 +++++++++++++++++++++++
2 files changed, 105 insertions(+)
diff --git a/libavfilter/qp_table.c b/libavfilter/qp_table.c
new file mode 100644
index 0000000000..33812b708d
--- /dev/null
+++ b/libavfilter/qp_table.c
@@ -0,0 +1,72 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 <stdint.h>
+
+// for FF_QSCALE_TYPE_*
+#include "libavcodec/internal.h"
+
+#include "libavutil/frame.h"
+#include "libavutil/mem.h"
+#include "libavutil/video_enc_params.h"
+
+#include "qp_table.h"
+
+int ff_qp_table_extract(AVFrame *frame, int8_t **table, int *table_w, int *table_h,
+ int *qscale_type)
+{
+ AVFrameSideData *sd;
+ AVVideoEncParams *par;
+ unsigned int mb_h = (frame->height + 15) / 16;
+ unsigned int mb_w = (frame->width + 15) / 16;
+ unsigned int nb_mb = mb_h * mb_w;
+ unsigned int block_idx;
+
+ *table = NULL;
+
+ sd = av_frame_get_side_data(frame, AV_FRAME_DATA_VIDEO_ENC_PARAMS);
+ if (!sd)
+ return 0;
+ par = (AVVideoEncParams*)sd->data;
+ if (par->type != AV_VIDEO_ENC_PARAMS_MPEG2 ||
+ (par->nb_blocks != 0 && par->nb_blocks != nb_mb))
+ return AVERROR(ENOSYS);
+
+ *table = av_malloc(nb_mb);
+ if (!*table)
+ return AVERROR(ENOMEM);
+ if (table_w)
+ *table_w = mb_w;
+ if (table_h)
+ *table_h = mb_h;
+ if (qscale_type)
+ *qscale_type = FF_QSCALE_TYPE_MPEG2;
+
+ if (par->nb_blocks == 0) {
+ memset(*table, par->qp, nb_mb);
+ return 0;
+ }
+
+ for (block_idx = 0; block_idx < nb_mb; block_idx++) {
+ AVVideoBlockParams *b = av_video_enc_params_block(par, block_idx);
+ (*table)[block_idx] = par->qp + b->delta_qp;
+ }
+
+ return 0;
+}
+
diff --git a/libavfilter/qp_table.h b/libavfilter/qp_table.h
new file mode 100644
index 0000000000..a552fe2e64
--- /dev/null
+++ b/libavfilter/qp_table.h
@@ -0,0 +1,33 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 AVFILTER_QP_TABLE_H
+#define AVFILTER_QP_TABLE_H
+
+#include <stdint.h>
+
+#include "libavutil/frame.h"
+
+/**
+ * Extract a libpostproc-compatible QP table - an 8-bit QP value per 16x16
+ * macroblock, stored in raster order - from AVVideoEncParams side data.
+ */
+int ff_qp_table_extract(AVFrame *frame, int8_t **table, int *table_w, int *table_h,
+ int *qscale_type);
+
+#endif // AVFILTER_QP_TABLE_H
1
0
ffmpeg | branch: master | Anton Khirnov <anton(a)khirnov.net> | Fri Apr 17 10:32:12 2020 +0200| [c72d5264944c11ecf4e5724b56876721becd5aa3] | committer: Anton Khirnov
lavfi/vf_qp: convert to the video_enc_params API
Temporarily disable fate-filter-qp until vf_pp is converted.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c72d5264944c11ecf…
---
libavfilter/vf_qp.c | 65 ++++++++++++++++++++++++++++++---------------
tests/fate/filter-video.mak | 8 +++---
2 files changed, 47 insertions(+), 26 deletions(-)
diff --git a/libavfilter/vf_qp.c b/libavfilter/vf_qp.c
index 33d39493bc..306e8e4594 100644
--- a/libavfilter/vf_qp.c
+++ b/libavfilter/vf_qp.c
@@ -23,6 +23,8 @@
#include "libavutil/imgutils.h"
#include "libavutil/pixdesc.h"
#include "libavutil/opt.h"
+#include "libavutil/video_enc_params.h"
+
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
@@ -89,38 +91,59 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
AVFilterContext *ctx = inlink->dst;
AVFilterLink *outlink = ctx->outputs[0];
QPContext *s = ctx->priv;
- AVBufferRef *out_qp_table_buf;
AVFrame *out = NULL;
- const int8_t *in_qp_table;
- int type, stride, ret;
+ int ret;
+
+ AVFrameSideData *sd_in;
+ AVVideoEncParams *par_in = NULL;
+ int8_t in_qp_global = 0;
+
+ AVVideoEncParams *par_out;
if (!s->qp_expr_str || ctx->is_disabled)
return ff_filter_frame(outlink, in);
- out_qp_table_buf = av_buffer_alloc(s->h * s->qstride);
- if (!out_qp_table_buf) {
- ret = AVERROR(ENOMEM);
- goto fail;
+ sd_in = av_frame_get_side_data(in, AV_FRAME_DATA_VIDEO_ENC_PARAMS);
+ if (sd_in && sd_in->size >= sizeof(AVVideoEncParams)) {
+ par_in = (AVVideoEncParams*)sd_in->data;
+
+ // we accept the input QP table only if it is of the MPEG2 type
+ // and contains either no blocks at all or 16x16 macroblocks
+ if (par_in->type == AV_VIDEO_ENC_PARAMS_MPEG2 &&
+ (par_in->nb_blocks == s->h * s->qstride || !par_in->nb_blocks)) {
+ in_qp_global = par_in->qp;
+ if (!par_in->nb_blocks)
+ par_in = NULL;
+ } else
+ par_in = NULL;
}
out = av_frame_clone(in);
if (!out) {
- av_buffer_unref(&out_qp_table_buf);
ret = AVERROR(ENOMEM);
goto fail;
}
- in_qp_table = av_frame_get_qp_table(in, &stride, &type);
- av_frame_set_qp_table(out, out_qp_table_buf, s->qstride, type);
+ par_out = av_video_enc_params_create_side_data(out, AV_VIDEO_ENC_PARAMS_MPEG2,
+ (s->evaluate_per_mb || sd_in) ?
+ s->h * s->qstride : 0);
+ if (!par_out) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+#define BLOCK_QP_DELTA(block_idx) \
+ (par_in ? av_video_enc_params_block(par_in, block_idx)->delta_qp : 0)
if (s->evaluate_per_mb) {
int y, x;
for (y = 0; y < s->h; y++)
for (x = 0; x < s->qstride; x++) {
- int qp = in_qp_table ? in_qp_table[x + stride * y] : NAN;
- double var_values[] = { !!in_qp_table, qp, x, y, s->qstride, s->h, 0};
+ unsigned int block_idx = y * s->qstride + x;
+ AVVideoBlockParams *b = av_video_enc_params_block(par_out, block_idx);
+ int qp = sd_in ? in_qp_global + BLOCK_QP_DELTA(block_idx) : NAN;
+ double var_values[] = { !!sd_in, qp, x, y, s->qstride, s->h, 0};
static const char *var_names[] = { "known", "qp", "x", "y", "w", "h", NULL };
double temp_val;
@@ -129,21 +152,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
NULL, NULL, NULL, NULL, 0, 0, ctx);
if (ret < 0)
goto fail;
- out_qp_table_buf->data[x + s->qstride * y] = lrintf(temp_val);
+ b->delta_qp = lrintf(temp_val);
}
- } else if (in_qp_table) {
+ } else if (sd_in) {
int y, x;
for (y = 0; y < s->h; y++)
- for (x = 0; x < s->qstride; x++)
- out_qp_table_buf->data[x + s->qstride * y] = s->lut[129 +
- ((int8_t)in_qp_table[x + stride * y])];
+ for (x = 0; x < s->qstride; x++) {
+ unsigned int block_idx = y * s->qstride + x;
+ AVVideoBlockParams *b = av_video_enc_params_block(par_out, block_idx);
+ b->delta_qp = s->lut[129 + (int8_t)(in_qp_global + BLOCK_QP_DELTA(block_idx))];
+ }
} else {
- int y, x, qp = s->lut[0];
-
- for (y = 0; y < s->h; y++)
- for (x = 0; x < s->qstride; x++)
- out_qp_table_buf->data[x + s->qstride * y] = qp;
+ par_out->qp = s->lut[0];
}
ret = ff_filter_frame(outlink, out);
diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index 34cfc38aba..7f5c07fd24 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -567,8 +567,8 @@ $(FATE_FILTER_PP): fate-vsynth1-mpeg4-qprd
fate-filter-pp: CMD = framecrc -flags bitexact -idct simple -i $(TARGET_PATH)/tests/data/fate/vsynth1-mpeg4-qprd.avi -frames:v 5 -flags +bitexact -vf "pp=be/hb/vb/tn/l5/al"
fate-filter-pp1: CMD = video_filter "pp=fq|4/be/hb/vb/tn/l5/al"
-fate-filter-pp2: CMD = video_filter "qp=x+y,pp=be/h1/v1/lb"
-fate-filter-pp3: CMD = video_filter "qp=x+y,pp=be/ha|128|7/va/li"
+fate-filter-pp2: CMD = video_filter "qp=2*(x+y),pp=be/h1/v1/lb"
+fate-filter-pp3: CMD = video_filter "qp=2*(x+y),pp=be/ha|128|7/va/li"
fate-filter-pp4: CMD = video_filter "pp=be/ci"
fate-filter-pp5: CMD = video_filter "pp=md"
fate-filter-pp6: CMD = video_filter "pp=be/fd"
@@ -585,8 +585,8 @@ FATE_FILTER_VSYNTH-$(CONFIG_CODECVIEW_FILTER) += fate-filter-codecview
fate-filter-codecview: fate-vsynth1-mpeg4-qprd
fate-filter-codecview: CMD = framecrc -flags bitexact -idct simple -flags2 +export_mvs -i $(TARGET_PATH)/tests/data/fate/vsynth1-mpeg4-qprd.avi -frames:v 5 -flags +bitexact -vf codecview=mv=pf+bf+bb
-FATE_FILTER_VSYNTH-$(call ALLYES, QP_FILTER PP_FILTER) += fate-filter-qp
-fate-filter-qp: CMD = video_filter "qp=17,pp=be/hb/vb/tn/l5/al"
+#FATE_FILTER_VSYNTH-$(call ALLYES, QP_FILTER PP_FILTER) += fate-filter-qp
+fate-filter-qp: CMD = video_filter "qp=34,pp=be/hb/vb/tn/l5/al"
FATE_FILTER_VSYNTH-$(CONFIG_SELECT_FILTER) += fate-filter-select
fate-filter-select: CMD = framecrc -flags bitexact -idct simple -i $(SRC) -vf "select=not(eq(mod(n\,2)\,0)+eq(mod(n\,3)\,0))" -frames:v 25 -flags +bitexact
1
0
01 Jan '21
ffmpeg | branch: master | Anton Khirnov <anton(a)khirnov.net> | Tue Mar 10 11:45:55 2020 +0100| [baecaa16c16dc2bca7ca15ed3c379d7343955adb] | committer: Anton Khirnov
mpegvideo: use the AVVideoEncParams API for exporting QP tables
Do it only when requested with the AV_CODEC_EXPORT_DATA_VIDEO_ENC_PARAMS
flag.
Drop previous code using the long-deprecated AV_FRAME_DATA_QP_TABLE*
API. Temporarily disable fate-filter-pp, fate-filter-pp7,
fate-filter-spp. They will be reenabled once these filters are converted
in following commits.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=baecaa16c16dc2bca…
---
doc/APIchanges | 3 +++
libavcodec/h263dec.c | 2 ++
libavcodec/mpeg12dec.c | 1 +
libavcodec/mpegpicture.c | 2 ++
libavcodec/mpegpicture.h | 1 +
libavcodec/mpegvideo.c | 35 ++++++++++++++++++++++++++++-------
libavcodec/rv34.c | 1 +
libavutil/version.h | 2 +-
libavutil/video_enc_params.h | 8 ++++++++
tests/fate/filter-video.mak | 6 +++---
10 files changed, 50 insertions(+), 11 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index 3fb9e12525..6c1d73515a 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2017-10-21
API changes, most recent first:
+2020-xx-xx - xxxxxxxxxx - lavu 56.63.100 - video_enc_params.h
+ Add AV_VIDEO_ENC_PARAMS_MPEG2
+
2020-12-03 - xxxxxxxxxx - lavu 56.62.100 - timecode.h
Add av_timecode_init_from_components.
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 8b441b2951..dafa54d8d4 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -28,6 +28,8 @@
#define UNCHECKED_BITSTREAM_READER 1
#include "libavutil/cpu.h"
+#include "libavutil/video_enc_params.h"
+
#include "avcodec.h"
#include "error_resilience.h"
#include "flv.h"
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 7b98d488a2..b9bd7daa25 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -33,6 +33,7 @@
#include "libavutil/internal.h"
#include "libavutil/mem_internal.h"
#include "libavutil/stereo3d.h"
+#include "libavutil/video_enc_params.h"
#include "avcodec.h"
#include "bytestream.h"
diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c
index 13c11ec492..e495e315e6 100644
--- a/libavcodec/mpegpicture.c
+++ b/libavcodec/mpegpicture.c
@@ -220,6 +220,7 @@ static int alloc_picture_tables(AVCodecContext *avctx, Picture *pic, int encodin
pic->alloc_mb_width = mb_width;
pic->alloc_mb_height = mb_height;
+ pic->alloc_mb_stride = mb_stride;
return 0;
}
@@ -346,6 +347,7 @@ int ff_update_picture_tables(Picture *dst, Picture *src)
dst->alloc_mb_width = src->alloc_mb_width;
dst->alloc_mb_height = src->alloc_mb_height;
+ dst->alloc_mb_stride = src->alloc_mb_stride;
return 0;
}
diff --git a/libavcodec/mpegpicture.h b/libavcodec/mpegpicture.h
index 2db3d6733a..4bcd666797 100644
--- a/libavcodec/mpegpicture.h
+++ b/libavcodec/mpegpicture.h
@@ -69,6 +69,7 @@ typedef struct Picture {
int alloc_mb_width; ///< mb_width used to allocate tables
int alloc_mb_height; ///< mb_height used to allocate tables
+ int alloc_mb_stride; ///< mb_stride used to allocate tables
AVBufferRef *mb_mean_buf;
uint8_t *mb_mean; ///< Table for MB luminance
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 60ed716865..988dd18a33 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -32,6 +32,8 @@
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/motion_vector.h"
+#include "libavutil/video_enc_params.h"
+
#include "avcodec.h"
#include "blockdsp.h"
#include "h264chroma.h"
@@ -1422,14 +1424,33 @@ void ff_print_debug_info(MpegEncContext *s, Picture *p, AVFrame *pict)
int ff_mpv_export_qp_table(MpegEncContext *s, AVFrame *f, Picture *p, int qp_type)
{
- AVBufferRef *ref = av_buffer_ref(p->qscale_table_buf);
- int offset = 2*s->mb_stride + 1;
- if(!ref)
+ AVVideoEncParams *par;
+ int mult = (qp_type == FF_QSCALE_TYPE_MPEG1) ? 2 : 1;
+ unsigned int nb_mb = p->alloc_mb_height * p->alloc_mb_width;
+ unsigned int x, y;
+
+ if (!(s->avctx->export_side_data & AV_CODEC_EXPORT_DATA_VIDEO_ENC_PARAMS))
+ return 0;
+
+ par = av_video_enc_params_create_side_data(f, AV_VIDEO_ENC_PARAMS_MPEG2, nb_mb);
+ if (!par)
return AVERROR(ENOMEM);
- av_assert0(ref->size >= offset + s->mb_stride * ((f->height+15)/16));
- ref->size -= offset;
- ref->data += offset;
- return av_frame_set_qp_table(f, ref, s->mb_stride, qp_type);
+
+ for (y = 0; y < p->alloc_mb_height; y++)
+ for (x = 0; x < p->alloc_mb_width; x++) {
+ const unsigned int block_idx = y * p->alloc_mb_width + x;
+ const unsigned int mb_xy = y * p->alloc_mb_stride + x;
+ AVVideoBlockParams *b = av_video_enc_params_block(par, block_idx);
+
+ b->src_x = x * 16;
+ b->src_y = y * 16;
+ b->w = 16;
+ b->h = 16;
+
+ b->delta_qp = p->qscale_table[mb_xy] * mult;
+ }
+
+ return 0;
}
static inline int hpel_motion_lowres(MpegEncContext *s,
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 6434f784d6..7e5bfe0e22 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -29,6 +29,7 @@
#include "libavutil/internal.h"
#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
+#include "libavutil/video_enc_params.h"
#include "avcodec.h"
#include "error_resilience.h"
diff --git a/libavutil/version.h b/libavutil/version.h
index 085c4e30f9..5e6fe02d88 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 56
-#define LIBAVUTIL_VERSION_MINOR 62
+#define LIBAVUTIL_VERSION_MINOR 63
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
diff --git a/libavutil/video_enc_params.h b/libavutil/video_enc_params.h
index e3b422d6f3..fc0c3bc1a5 100644
--- a/libavutil/video_enc_params.h
+++ b/libavutil/video_enc_params.h
@@ -55,6 +55,14 @@ enum AVVideoEncParamsType {
* as AVVideoBlockParams.qp_delta.
*/
AV_VIDEO_ENC_PARAMS_H264,
+
+ /*
+ * MPEG-2-compatible quantizer.
+ *
+ * Summing the frame-level qp with the per-block delta_qp gives the
+ * resulting quantizer for the block.
+ */
+ AV_VIDEO_ENC_PARAMS_MPEG2,
};
/**
diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index a2967de3ae..34cfc38aba 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -561,7 +561,7 @@ fate-filter-idet: CMD = framecrc -flags bitexact -idct simple -i $(SRC) -vf idet
FATE_FILTER_VSYNTH-$(CONFIG_PAD_FILTER) += fate-filter-pad
fate-filter-pad: CMD = video_filter "pad=iw*1.5:ih*1.5:iw*0.3:ih*0.2"
-FATE_FILTER_PP = fate-filter-pp fate-filter-pp1 fate-filter-pp2 fate-filter-pp3 fate-filter-pp4 fate-filter-pp5 fate-filter-pp6
+#FATE_FILTER_PP = fate-filter-pp fate-filter-pp1 fate-filter-pp2 fate-filter-pp3 fate-filter-pp4 fate-filter-pp5 fate-filter-pp6
FATE_FILTER_VSYNTH-$(CONFIG_PP_FILTER) += $(FATE_FILTER_PP)
$(FATE_FILTER_PP): fate-vsynth1-mpeg4-qprd
@@ -573,11 +573,11 @@ fate-filter-pp4: CMD = video_filter "pp=be/ci"
fate-filter-pp5: CMD = video_filter "pp=md"
fate-filter-pp6: CMD = video_filter "pp=be/fd"
-FATE_FILTER_VSYNTH-$(CONFIG_PP7_FILTER) += fate-filter-pp7
+#FATE_FILTER_VSYNTH-$(CONFIG_PP7_FILTER) += fate-filter-pp7
fate-filter-pp7: fate-vsynth1-mpeg4-qprd
fate-filter-pp7: CMD = framecrc -flags bitexact -idct simple -i $(TARGET_PATH)/tests/data/fate/vsynth1-mpeg4-qprd.avi -frames:v 5 -flags +bitexact -vf "pp7"
-FATE_FILTER_VSYNTH-$(CONFIG_SPP_FILTER) += fate-filter-spp
+#FATE_FILTER_VSYNTH-$(CONFIG_SPP_FILTER) += fate-filter-spp
fate-filter-spp: fate-vsynth1-mpeg4-qprd
fate-filter-spp: CMD = framecrc -flags bitexact -idct simple -i $(TARGET_PATH)/tests/data/fate/vsynth1-mpeg4-qprd.avi -frames:v 5 -flags +bitexact -vf "spp=idct=simple:dct=int"
1
0
lavu/mem: move the DECLARE_ALIGNED macro family to mem_internal on next+1 bump
by Anton Khirnov 01 Jan '21
by Anton Khirnov 01 Jan '21
01 Jan '21
ffmpeg | branch: master | Anton Khirnov <anton(a)khirnov.net> | Wed May 27 14:54:38 2020 +0200| [e15371061d23457554d241a80dc471515ac13ad4] | committer: Anton Khirnov
lavu/mem: move the DECLARE_ALIGNED macro family to mem_internal on next+1 bump
They are not properly namespaced and not intended for public use.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e15371061d2345755…
---
libavcodec/4xm.c | 1 +
libavcodec/aac.h | 1 +
libavcodec/aacenc.h | 2 +
libavcodec/aacps.h | 2 +
libavcodec/aacps_fixed_tablegen.h | 1 +
libavcodec/aacsbrdata.h | 2 +-
libavcodec/aactab.c | 1 +
libavcodec/aactab.h | 2 +-
libavcodec/ac3dec.h | 2 +
libavcodec/ac3dsp.c | 2 +
libavcodec/ac3tab.c | 2 +-
libavcodec/agm.c | 2 +
libavcodec/aic.c | 2 +
libavcodec/arm/sbcdsp_init_arm.c | 1 +
libavcodec/asv.h | 2 +-
libavcodec/atrac1.c | 2 +
libavcodec/atrac3.c | 1 +
libavcodec/atrac3plus.h | 2 +
libavcodec/atrac3plusdec.c | 1 +
libavcodec/atrac9dec.c | 1 +
libavcodec/binkaudio.c | 1 +
libavcodec/cabac.c | 1 +
libavcodec/cavs.c | 2 +
libavcodec/cavs.h | 2 +
libavcodec/clearvideo.c | 1 +
libavcodec/cook.c | 1 +
libavcodec/dca_core.h | 2 +-
libavcodec/dca_lbr.h | 2 +-
libavcodec/dca_xll.h | 2 +-
libavcodec/dcadata.c | 2 +-
libavcodec/dirac_vlc.c | 2 +
libavcodec/diracdec.c | 1 +
libavcodec/dnxhddec.c | 2 +
libavcodec/dnxhdenc.h | 2 +
libavcodec/dolby_e.h | 2 +-
libavcodec/dss_sp.c | 1 +
libavcodec/dstdec.c | 1 +
libavcodec/eamad.c | 2 +
libavcodec/eatgq.c | 3 ++
libavcodec/eatqi.c | 2 +
libavcodec/fft.h | 3 +-
libavcodec/fic.c | 1 +
libavcodec/g2meet.c | 1 +
libavcodec/h264_mvpred.h | 1 +
libavcodec/h264dec.h | 1 +
libavcodec/hcadec.c | 1 +
libavcodec/hevcdec.h | 1 +
libavcodec/hevcdsp.h | 2 +
libavcodec/hq_hqa.h | 2 +
libavcodec/hqx.h | 3 +-
libavcodec/imm4.c | 1 +
libavcodec/mdct15.h | 2 +
libavcodec/mdec.c | 2 +
libavcodec/mimic.c | 1 +
libavcodec/mips/constants.c | 2 +-
libavcodec/mips/h264dsp_mmi.c | 1 +
libavcodec/mips/simple_idct_mmi.c | 1 +
libavcodec/mips/vc1dsp_mmi.c | 2 +
libavcodec/mips/vp8dsp_mmi.c | 1 +
libavcodec/mips/xvid_idct_mmi.c | 2 +
libavcodec/mjpegdec.h | 1 +
libavcodec/mlpdec.c | 1 +
libavcodec/mpc.h | 1 +
libavcodec/mpeg12dec.c | 1 +
libavcodec/mpegaudiodec_template.c | 2 +
libavcodec/mpegaudiodsp_template.c | 2 +
libavcodec/nellymoserdec.c | 1 +
libavcodec/on2avc.c | 2 +
libavcodec/opus.h | 1 +
libavcodec/opus_celt.h | 1 +
libavcodec/opus_pvq.h | 2 +
libavcodec/opusenc.c | 1 +
libavcodec/opusenc_psy.h | 2 +
libavcodec/opustab.c | 2 +
libavcodec/ppc/h264chroma_template.c | 2 +-
libavcodec/ppc/h264dsp.c | 2 +-
libavcodec/ppc/h264qpel.c | 1 +
libavcodec/ppc/mpegvideo_altivec.c | 1 +
libavcodec/ppc/mpegvideodsp.c | 2 +-
libavcodec/ppc/vp8dsp_altivec.c | 2 +-
libavcodec/proresenc_kostya.c | 1 +
libavcodec/qdm2.c | 1 +
libavcodec/ra144.h | 3 ++
libavcodec/ra288.h | 1 +
libavcodec/rtjpeg.h | 2 +-
libavcodec/rv34.h | 2 +
libavcodec/sbc.h | 1 +
libavcodec/sbcdec.c | 1 +
libavcodec/sbcdsp.h | 2 +
libavcodec/sbcdsp_data.c | 2 +
libavcodec/sbr.h | 3 ++
libavcodec/sinewin.h | 2 +-
libavcodec/sipr.h | 2 +-
libavcodec/siren.c | 1 +
libavcodec/svq1_cb.h | 2 +-
libavcodec/svq1enc.h | 1 +
libavcodec/svq3.c | 1 +
libavcodec/tableprint.h | 1 +
libavcodec/takdec.c | 1 +
libavcodec/truespeech.c | 2 +
libavcodec/vorbis_data.c | 3 +-
libavcodec/vp3.c | 1 +
libavcodec/vp56.h | 2 +
libavcodec/vp8.h | 1 +
libavcodec/vp9dec.h | 1 +
libavcodec/vp9dsp.c | 2 +
libavcodec/wma.h | 1 +
libavcodec/wmalosslessdec.c | 1 +
libavcodec/wmaprodec.c | 2 +
libavcodec/wmavoice.c | 2 +-
libavcodec/wmv2.h | 2 +
libavcodec/x86/constants.c | 2 +-
libavcodec/x86/fdct.c | 1 +
libavcodec/x86/me_cmp_init.c | 1 +
libavcodec/x86/mpegvideoenc.c | 1 +
libavfilter/ebur128.c | 1 +
libavfilter/vf_colorspace.c | 1 +
libavfilter/vf_dctdnoiz.c | 1 +
libavfilter/vf_fspp.c | 1 +
libavfilter/vf_gradfun.c | 1 +
libavfilter/vf_owdenoise.c | 1 +
libavfilter/vf_pp7.c | 1 +
libavfilter/vf_spp.c | 1 +
libavfilter/vf_uspp.c | 1 +
libavutil/aes_internal.h | 2 +-
libavutil/internal.h | 1 -
libavutil/lls.h | 2 +-
libavutil/mem.h | 6 +++
libavutil/mem_internal.h | 70 ++++++++++++++++++++++++++++++
libavutil/tests/aes_ctr.c | 1 +
libavutil/tests/des.c | 1 +
libavutil/tx_priv.h | 1 +
libavutil/version.h | 3 ++
libpostproc/postprocess_altivec_template.c | 1 +
libpostproc/postprocess_internal.h | 1 +
libpostproc/postprocess_template.c | 1 +
libswscale/output.c | 1 +
libswscale/ppc/yuv2rgb_altivec.c | 1 +
libswscale/swscale.c | 1 +
libswscale/swscale_internal.h | 1 +
libswscale/swscale_unscaled.c | 1 +
libswscale/x86/hscale_fast_bilinear_simd.c | 1 +
libswscale/x86/rgb2rgb.c | 2 +
libswscale/x86/swscale.c | 1 +
144 files changed, 264 insertions(+), 26 deletions(-)
diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c
index 336c651d31..4d58b093f7 100644
--- a/libavcodec/4xm.c
+++ b/libavcodec/4xm.c
@@ -30,6 +30,7 @@
#include "libavutil/frame.h"
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "blockdsp.h"
#include "bswapdsp.h"
diff --git a/libavcodec/aac.h b/libavcodec/aac.h
index d422ea5b13..1e82f56ca9 100644
--- a/libavcodec/aac.h
+++ b/libavcodec/aac.h
@@ -34,6 +34,7 @@
#include "aac_defines.h"
#include "libavutil/float_dsp.h"
#include "libavutil/fixed_dsp.h"
+#include "libavutil/mem_internal.h"
#include "avcodec.h"
#if !USE_FIXED
#include "mdct15.h"
diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h
index 5a015ca92e..8ffc94f99b 100644
--- a/libavcodec/aacenc.h
+++ b/libavcodec/aacenc.h
@@ -23,6 +23,8 @@
#define AVCODEC_AACENC_H
#include "libavutil/float_dsp.h"
+#include "libavutil/mem_internal.h"
+
#include "avcodec.h"
#include "put_bits.h"
diff --git a/libavcodec/aacps.h b/libavcodec/aacps.h
index 4f6d2ad7dd..3efa38ad88 100644
--- a/libavcodec/aacps.h
+++ b/libavcodec/aacps.h
@@ -24,6 +24,8 @@
#include <stdint.h>
+#include "libavutil/mem_internal.h"
+
#include "aacpsdsp.h"
#include "avcodec.h"
#include "get_bits.h"
diff --git a/libavcodec/aacps_fixed_tablegen.h b/libavcodec/aacps_fixed_tablegen.h
index 8b82deb596..356fb8b293 100644
--- a/libavcodec/aacps_fixed_tablegen.h
+++ b/libavcodec/aacps_fixed_tablegen.h
@@ -37,6 +37,7 @@
#include "libavutil/common.h"
#include "libavutil/mathematics.h"
#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "aac_defines.h"
#include "libavutil/softfloat.h"
diff --git a/libavcodec/aacsbrdata.h b/libavcodec/aacsbrdata.h
index bba50db9bd..7a11594c9b 100644
--- a/libavcodec/aacsbrdata.h
+++ b/libavcodec/aacsbrdata.h
@@ -29,7 +29,7 @@
#define AVCODEC_AACSBRDATA_H
#include <stdint.h>
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "aac_defines.h"
///< Huffman tables for SBR
diff --git a/libavcodec/aactab.c b/libavcodec/aactab.c
index abe5fd7567..fa5420fec6 100644
--- a/libavcodec/aactab.c
+++ b/libavcodec/aactab.c
@@ -29,6 +29,7 @@
#include "config.h"
#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
#include "aac.h"
#include "aactab.h"
diff --git a/libavcodec/aactab.h b/libavcodec/aactab.h
index 8a354e8186..9b1450c2eb 100644
--- a/libavcodec/aactab.h
+++ b/libavcodec/aactab.h
@@ -30,7 +30,7 @@
#ifndef AVCODEC_AACTAB_H
#define AVCODEC_AACTAB_H
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "aac.h"
#include <stdint.h>
diff --git a/libavcodec/ac3dec.h b/libavcodec/ac3dec.h
index ce1434b55c..85653990cf 100644
--- a/libavcodec/ac3dec.h
+++ b/libavcodec/ac3dec.h
@@ -53,6 +53,8 @@
#include "libavutil/float_dsp.h"
#include "libavutil/fixed_dsp.h"
#include "libavutil/lfg.h"
+#include "libavutil/mem_internal.h"
+
#include "ac3.h"
#include "ac3dsp.h"
#include "bswapdsp.h"
diff --git a/libavcodec/ac3dsp.c b/libavcodec/ac3dsp.c
index 43438da131..382f87c05f 100644
--- a/libavcodec/ac3dsp.c
+++ b/libavcodec/ac3dsp.c
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/mem_internal.h"
+
#include "avcodec.h"
#include "ac3.h"
#include "ac3dsp.h"
diff --git a/libavcodec/ac3tab.c b/libavcodec/ac3tab.c
index ef2a41bc59..d018110331 100644
--- a/libavcodec/ac3tab.c
+++ b/libavcodec/ac3tab.c
@@ -25,7 +25,7 @@
*/
#include "libavutil/channel_layout.h"
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "ac3tab.h"
diff --git a/libavcodec/agm.c b/libavcodec/agm.c
index f60cbf1a18..f39383140f 100644
--- a/libavcodec/agm.c
+++ b/libavcodec/agm.c
@@ -26,6 +26,8 @@
#define BITSTREAM_READER_LE
+#include "libavutil/mem_internal.h"
+
#include "avcodec.h"
#include "bytestream.h"
#include "copy_block.h"
diff --git a/libavcodec/aic.c b/libavcodec/aic.c
index f027fa99ef..cf5b0782be 100644
--- a/libavcodec/aic.c
+++ b/libavcodec/aic.c
@@ -22,6 +22,8 @@
#include <inttypes.h>
+#include "libavutil/mem_internal.h"
+
#include "avcodec.h"
#include "bytestream.h"
#include "internal.h"
diff --git a/libavcodec/arm/sbcdsp_init_arm.c b/libavcodec/arm/sbcdsp_init_arm.c
index 6bf7e729ef..b8fa5a35ab 100644
--- a/libavcodec/arm/sbcdsp_init_arm.c
+++ b/libavcodec/arm/sbcdsp_init_arm.c
@@ -30,6 +30,7 @@
*/
#include "libavutil/cpu.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/arm/cpu.h"
#include "libavcodec/sbcdsp.h"
diff --git a/libavcodec/asv.h b/libavcodec/asv.h
index e778c72d34..269bbe7c18 100644
--- a/libavcodec/asv.h
+++ b/libavcodec/asv.h
@@ -28,7 +28,7 @@
#include <stdint.h>
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "blockdsp.h"
diff --git a/libavcodec/atrac1.c b/libavcodec/atrac1.c
index 0dd8b87bf5..54f9b1c2d8 100644
--- a/libavcodec/atrac1.c
+++ b/libavcodec/atrac1.c
@@ -33,6 +33,8 @@
#include <stdio.h>
#include "libavutil/float_dsp.h"
+#include "libavutil/mem_internal.h"
+
#include "avcodec.h"
#include "get_bits.h"
#include "fft.h"
diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c
index 633032786f..37ccbcc946 100644
--- a/libavcodec/atrac3.c
+++ b/libavcodec/atrac3.c
@@ -39,6 +39,7 @@
#include "libavutil/attributes.h"
#include "libavutil/float_dsp.h"
#include "libavutil/libm.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
#include "avcodec.h"
diff --git a/libavcodec/atrac3plus.h b/libavcodec/atrac3plus.h
index 82fe0fe1f8..a588436e2a 100644
--- a/libavcodec/atrac3plus.h
+++ b/libavcodec/atrac3plus.h
@@ -31,6 +31,8 @@
#include <stdint.h>
#include "libavutil/float_dsp.h"
+#include "libavutil/mem_internal.h"
+
#include "atrac.h"
#include "avcodec.h"
#include "fft.h"
diff --git a/libavcodec/atrac3plusdec.c b/libavcodec/atrac3plusdec.c
index 2ae03d838f..c024ab6bde 100644
--- a/libavcodec/atrac3plusdec.c
+++ b/libavcodec/atrac3plusdec.c
@@ -39,6 +39,7 @@
#include "libavutil/channel_layout.h"
#include "libavutil/float_dsp.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
#include "avcodec.h"
#include "get_bits.h"
diff --git a/libavcodec/atrac9dec.c b/libavcodec/atrac9dec.c
index f2413ef68a..f88b25da48 100644
--- a/libavcodec/atrac9dec.c
+++ b/libavcodec/atrac9dec.c
@@ -27,6 +27,7 @@
#include "atrac9tab.h"
#include "libavutil/lfg.h"
#include "libavutil/float_dsp.h"
+#include "libavutil/mem_internal.h"
#define ATRAC9_SF_VLC_BITS 8
#define ATRAC9_COEFF_VLC_BITS 9
diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c
index 7b5965ede1..381fc4cd15 100644
--- a/libavcodec/binkaudio.c
+++ b/libavcodec/binkaudio.c
@@ -30,6 +30,7 @@
#include "libavutil/channel_layout.h"
#include "libavutil/intfloat.h"
+#include "libavutil/mem_internal.h"
#define BITSTREAM_READER_LE
#include "avcodec.h"
diff --git a/libavcodec/cabac.c b/libavcodec/cabac.c
index 54e9bb4d8f..3bbecf50dd 100644
--- a/libavcodec/cabac.c
+++ b/libavcodec/cabac.c
@@ -27,6 +27,7 @@
#include <string.h>
#include "libavutil/common.h"
+#include "libavutil/mem_internal.h"
#include "cabac.h"
#include "cabac_functions.h"
diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c
index ba2b6ef232..74b8371501 100644
--- a/libavcodec/cavs.c
+++ b/libavcodec/cavs.c
@@ -25,6 +25,8 @@
* @author Stefan Gehrer <stefan.gehrer(a)gmx.de>
*/
+#include "libavutil/mem_internal.h"
+
#include "avcodec.h"
#include "get_bits.h"
#include "golomb.h"
diff --git a/libavcodec/cavs.h b/libavcodec/cavs.h
index 6bfb22ce48..cbc163fb4d 100644
--- a/libavcodec/cavs.h
+++ b/libavcodec/cavs.h
@@ -22,6 +22,8 @@
#ifndef AVCODEC_CAVS_H
#define AVCODEC_CAVS_H
+#include "libavutil/mem_internal.h"
+
#include "cavsdsp.h"
#include "blockdsp.h"
#include "h264chroma.h"
diff --git a/libavcodec/clearvideo.c b/libavcodec/clearvideo.c
index 7342557cd2..79ba88857c 100644
--- a/libavcodec/clearvideo.c
+++ b/libavcodec/clearvideo.c
@@ -24,6 +24,7 @@
* ClearVideo decoder
*/
+#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
#include "avcodec.h"
diff --git a/libavcodec/cook.c b/libavcodec/cook.c
index 1968f2f896..a9de3c8b1a 100644
--- a/libavcodec/cook.c
+++ b/libavcodec/cook.c
@@ -44,6 +44,7 @@
#include "libavutil/channel_layout.h"
#include "libavutil/lfg.h"
+#include "libavutil/mem_internal.h"
#include "audiodsp.h"
#include "avcodec.h"
diff --git a/libavcodec/dca_core.h b/libavcodec/dca_core.h
index 10128d1e32..86bfa62203 100644
--- a/libavcodec/dca_core.h
+++ b/libavcodec/dca_core.h
@@ -24,7 +24,7 @@
#include "libavutil/common.h"
#include "libavutil/float_dsp.h"
#include "libavutil/fixed_dsp.h"
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "internal.h"
diff --git a/libavcodec/dca_lbr.h b/libavcodec/dca_lbr.h
index 6d4c0a8a63..e6856a2cf7 100644
--- a/libavcodec/dca_lbr.h
+++ b/libavcodec/dca_lbr.h
@@ -23,7 +23,7 @@
#include "libavutil/common.h"
#include "libavutil/float_dsp.h"
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "internal.h"
diff --git a/libavcodec/dca_xll.h b/libavcodec/dca_xll.h
index bc0aa65b1a..3aaad6d370 100644
--- a/libavcodec/dca_xll.h
+++ b/libavcodec/dca_xll.h
@@ -22,7 +22,7 @@
#define AVCODEC_DCA_XLL_H
#include "libavutil/common.h"
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "internal.h"
diff --git a/libavcodec/dcadata.c b/libavcodec/dcadata.c
index 1b646a7aa6..643b0cc025 100644
--- a/libavcodec/dcadata.c
+++ b/libavcodec/dcadata.c
@@ -22,7 +22,7 @@
#include <stdint.h>
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "dca.h"
#include "dcadata.h"
diff --git a/libavcodec/dirac_vlc.c b/libavcodec/dirac_vlc.c
index 2e2fa7ea63..2c07440df0 100644
--- a/libavcodec/dirac_vlc.c
+++ b/libavcodec/dirac_vlc.c
@@ -16,6 +16,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/mem_internal.h"
+
#include "dirac_vlc.h"
enum {
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index ed42bc366a..b9999cde01 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -26,6 +26,7 @@
* @author Marco Gerards <marco(a)gnu.org>, David Conrad, Jordi Ortiz <nenjordi(a)gmail.com>
*/
+#include "libavutil/mem_internal.h"
#include "libavutil/pixdesc.h"
#include "libavutil/thread.h"
#include "avcodec.h"
diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index e5d01e2e71..09bc6f9b59 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -25,6 +25,8 @@
*/
#include "libavutil/imgutils.h"
+#include "libavutil/mem_internal.h"
+
#include "avcodec.h"
#include "blockdsp.h"
#define UNCHECKED_BITSTREAM_READER 1
diff --git a/libavcodec/dnxhdenc.h b/libavcodec/dnxhdenc.h
index 7b0d862e28..9e4c869bc4 100644
--- a/libavcodec/dnxhdenc.h
+++ b/libavcodec/dnxhdenc.h
@@ -28,6 +28,8 @@
#include "config.h"
+#include "libavutil/mem_internal.h"
+
#include "mpegvideo.h"
#include "dnxhddata.h"
diff --git a/libavcodec/dolby_e.h b/libavcodec/dolby_e.h
index ae04bf699c..68223a62ef 100644
--- a/libavcodec/dolby_e.h
+++ b/libavcodec/dolby_e.h
@@ -23,7 +23,7 @@
#include "libavutil/float_dsp.h"
#include "libavutil/libm.h"
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "internal.h"
#include "get_bits.h"
diff --git a/libavcodec/dss_sp.c b/libavcodec/dss_sp.c
index 71da65cecd..568757d212 100644
--- a/libavcodec/dss_sp.c
+++ b/libavcodec/dss_sp.c
@@ -22,6 +22,7 @@
#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "avcodec.h"
diff --git a/libavcodec/dstdec.c b/libavcodec/dstdec.c
index 3fd710d2f6..84d19b91aa 100644
--- a/libavcodec/dstdec.c
+++ b/libavcodec/dstdec.c
@@ -27,6 +27,7 @@
#include "libavutil/avassert.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#include "internal.h"
#include "get_bits.h"
#include "avcodec.h"
diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c
index 9dccddd6d3..2c03aa5a1c 100644
--- a/libavcodec/eamad.c
+++ b/libavcodec/eamad.c
@@ -28,6 +28,8 @@
* http://wiki.multimedia.cx/index.php?title=Electronic_Arts_MAD
*/
+#include "libavutil/mem_internal.h"
+
#include "avcodec.h"
#include "blockdsp.h"
#include "bytestream.h"
diff --git a/libavcodec/eatgq.c b/libavcodec/eatgq.c
index 1308c07cff..197ba6fc6e 100644
--- a/libavcodec/eatgq.c
+++ b/libavcodec/eatgq.c
@@ -29,6 +29,9 @@
*/
#define BITSTREAM_READER_LE
+
+#include "libavutil/mem_internal.h"
+
#include "aandcttab.h"
#include "avcodec.h"
#include "bytestream.h"
diff --git a/libavcodec/eatqi.c b/libavcodec/eatqi.c
index 456bd3c563..2be2737fd6 100644
--- a/libavcodec/eatqi.c
+++ b/libavcodec/eatqi.c
@@ -26,6 +26,8 @@
* @see http://wiki.multimedia.cx/index.php?title=Electronic_Arts_TQI
*/
+#include "libavutil/mem_internal.h"
+
#include "avcodec.h"
#include "blockdsp.h"
#include "bswapdsp.h"
diff --git a/libavcodec/fft.h b/libavcodec/fft.h
index c858570a21..5f67b61f06 100644
--- a/libavcodec/fft.h
+++ b/libavcodec/fft.h
@@ -32,7 +32,8 @@
#include <stdint.h>
#include "config.h"
-#include "libavutil/mem.h"
+
+#include "libavutil/mem_internal.h"
#if FFT_FLOAT
diff --git a/libavcodec/fic.c b/libavcodec/fic.c
index 95baaedaa5..ef5f3f44d1 100644
--- a/libavcodec/fic.c
+++ b/libavcodec/fic.c
@@ -22,6 +22,7 @@
*/
#include "libavutil/common.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "internal.h"
diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c
index f6aa636bde..70dc8c72a3 100644
--- a/libavcodec/g2meet.c
+++ b/libavcodec/g2meet.c
@@ -30,6 +30,7 @@
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "blockdsp.h"
diff --git a/libavcodec/h264_mvpred.h b/libavcodec/h264_mvpred.h
index bf395e3fe2..19d9ee462d 100644
--- a/libavcodec/h264_mvpred.h
+++ b/libavcodec/h264_mvpred.h
@@ -33,6 +33,7 @@
#include "h264dec.h"
#include "mpegutils.h"
#include "libavutil/avassert.h"
+#include "libavutil/mem_internal.h"
static av_always_inline int fetch_diagonal_mv(const H264Context *h, H264SliceContext *sl,
diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h
index 29c4d4e42c..b3677cdbb9 100644
--- a/libavcodec/h264dec.h
+++ b/libavcodec/h264dec.h
@@ -30,6 +30,7 @@
#include "libavutil/buffer.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
#include "cabac.h"
diff --git a/libavcodec/hcadec.c b/libavcodec/hcadec.c
index 11cb157277..9c3eda21af 100644
--- a/libavcodec/hcadec.c
+++ b/libavcodec/hcadec.c
@@ -19,6 +19,7 @@
#include "libavutil/crc.h"
#include "libavutil/float_dsp.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/tx.h"
#include "avcodec.h"
diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h
index c0a138e97a..b2aa392b43 100644
--- a/libavcodec/hevcdec.h
+++ b/libavcodec/hevcdec.h
@@ -27,6 +27,7 @@
#include "libavutil/buffer.h"
#include "libavutil/md5.h"
+#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "bswapdsp.h"
diff --git a/libavcodec/hevcdsp.h b/libavcodec/hevcdsp.h
index 0ae67cba85..c605a343d6 100644
--- a/libavcodec/hevcdsp.h
+++ b/libavcodec/hevcdsp.h
@@ -25,6 +25,8 @@
#ifndef AVCODEC_HEVCDSP_H
#define AVCODEC_HEVCDSP_H
+#include "libavutil/mem_internal.h"
+
#include "get_bits.h"
#define MAX_PB_SIZE 64
diff --git a/libavcodec/hq_hqa.h b/libavcodec/hq_hqa.h
index 608e2ca1a6..08d79e7454 100644
--- a/libavcodec/hq_hqa.h
+++ b/libavcodec/hq_hqa.h
@@ -23,6 +23,8 @@
#include <stdint.h>
+#include "libavutil/mem_internal.h"
+
#include "avcodec.h"
#include "bytestream.h"
#include "hq_hqadsp.h"
diff --git a/libavcodec/hqx.h b/libavcodec/hqx.h
index 50d60f9e03..3eddaafb29 100644
--- a/libavcodec/hqx.h
+++ b/libavcodec/hqx.h
@@ -24,7 +24,8 @@
#include <stdint.h>
#include "libavutil/frame.h"
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
+
#include "get_bits.h"
#include "hqxdsp.h"
diff --git a/libavcodec/imm4.c b/libavcodec/imm4.c
index 4cbafffd9d..636130dd54 100644
--- a/libavcodec/imm4.c
+++ b/libavcodec/imm4.c
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include <string.h>
+#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
#include "avcodec.h"
diff --git a/libavcodec/mdct15.h b/libavcodec/mdct15.h
index 42e60f3e10..035246ff97 100644
--- a/libavcodec/mdct15.h
+++ b/libavcodec/mdct15.h
@@ -23,6 +23,8 @@
#include <stddef.h>
+#include "libavutil/mem_internal.h"
+
#include "fft.h"
typedef struct MDCT15Context {
diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c
index d0bb1162b6..101e558336 100644
--- a/libavcodec/mdec.c
+++ b/libavcodec/mdec.c
@@ -27,6 +27,8 @@
* This is very similar to intra-only MPEG-1.
*/
+#include "libavutil/mem_internal.h"
+
#include "avcodec.h"
#include "blockdsp.h"
#include "bswapdsp.h"
diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c
index ea6a7efe93..407faa02da 100644
--- a/libavcodec/mimic.c
+++ b/libavcodec/mimic.c
@@ -23,6 +23,7 @@
#include <string.h>
#include <stdint.h>
+#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
#include "avcodec.h"
diff --git a/libavcodec/mips/constants.c b/libavcodec/mips/constants.c
index a7c4a5ccf6..8c990b6119 100644
--- a/libavcodec/mips/constants.c
+++ b/libavcodec/mips/constants.c
@@ -20,7 +20,7 @@
*/
#include "config.h"
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "constants.h"
DECLARE_ALIGNED(8, const uint64_t, ff_pw_1) = {0x0001000100010001ULL};
diff --git a/libavcodec/mips/h264dsp_mmi.c b/libavcodec/mips/h264dsp_mmi.c
index 173e191c77..d4fcef0d65 100644
--- a/libavcodec/mips/h264dsp_mmi.c
+++ b/libavcodec/mips/h264dsp_mmi.c
@@ -26,6 +26,7 @@
#include "libavcodec/bit_depth_template.c"
#include "h264dsp_mips.h"
#include "libavutil/mips/mmiutils.h"
+#include "libavutil/mem_internal.h"
void ff_h264_add_pixels4_8_mmi(uint8_t *dst, int16_t *src, int stride)
{
diff --git a/libavcodec/mips/simple_idct_mmi.c b/libavcodec/mips/simple_idct_mmi.c
index 73d797ffbc..e4b58dcfdd 100644
--- a/libavcodec/mips/simple_idct_mmi.c
+++ b/libavcodec/mips/simple_idct_mmi.c
@@ -26,6 +26,7 @@
#include "constants.h"
#include "libavutil/mips/asmdefs.h"
#include "libavutil/mips/mmiutils.h"
+#include "libavutil/mem_internal.h"
#define W1 22725 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
#define W2 21407 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
diff --git a/libavcodec/mips/vc1dsp_mmi.c b/libavcodec/mips/vc1dsp_mmi.c
index 79f19a9b39..8355cd1b26 100644
--- a/libavcodec/mips/vc1dsp_mmi.c
+++ b/libavcodec/mips/vc1dsp_mmi.c
@@ -21,6 +21,8 @@
*/
#include "libavutil/avassert.h"
+#include "libavutil/mem_internal.h"
+
#include "libavcodec/vc1dsp.h"
#include "constants.h"
#include "vc1dsp_mips.h"
diff --git a/libavcodec/mips/vp8dsp_mmi.c b/libavcodec/mips/vp8dsp_mmi.c
index bd80aa1445..aa6e856dd2 100644
--- a/libavcodec/mips/vp8dsp_mmi.c
+++ b/libavcodec/mips/vp8dsp_mmi.c
@@ -24,6 +24,7 @@
#include "vp8dsp_mips.h"
#include "constants.h"
#include "libavutil/mips/mmiutils.h"
+#include "libavutil/mem_internal.h"
#define DECLARE_DOUBLE_1 double db_1
#define DECLARE_DOUBLE_2 double db_2
diff --git a/libavcodec/mips/xvid_idct_mmi.c b/libavcodec/mips/xvid_idct_mmi.c
index b822b8add8..034a48d2a2 100644
--- a/libavcodec/mips/xvid_idct_mmi.c
+++ b/libavcodec/mips/xvid_idct_mmi.c
@@ -21,6 +21,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/mem_internal.h"
+
#include "idctdsp_mips.h"
#include "xvididct_mips.h"
diff --git a/libavcodec/mjpegdec.h b/libavcodec/mjpegdec.h
index d9844adf4e..fcbe58bcb8 100644
--- a/libavcodec/mjpegdec.h
+++ b/libavcodec/mjpegdec.h
@@ -30,6 +30,7 @@
#define AVCODEC_MJPEGDEC_H
#include "libavutil/log.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/pixdesc.h"
#include "libavutil/stereo3d.h"
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index 3b1608b29b..0c30034dd4 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -30,6 +30,7 @@
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/channel_layout.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
#include "get_bits.h"
#include "internal.h"
diff --git a/libavcodec/mpc.h b/libavcodec/mpc.h
index 704edc9a38..f8093796a3 100644
--- a/libavcodec/mpc.h
+++ b/libavcodec/mpc.h
@@ -30,6 +30,7 @@
#define AVCODEC_MPC_H
#include "libavutil/lfg.h"
+#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "bswapdsp.h"
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 123ede4704..7b98d488a2 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -31,6 +31,7 @@
#include "libavutil/attributes.h"
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/stereo3d.h"
#include "avcodec.h"
diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c
index 0ceeee2d46..4fd9e3a690 100644
--- a/libavcodec/mpegaudiodec_template.c
+++ b/libavcodec/mpegaudiodec_template.c
@@ -30,7 +30,9 @@
#include "libavutil/crc.h"
#include "libavutil/float_dsp.h"
#include "libavutil/libm.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
+
#include "avcodec.h"
#include "get_bits.h"
#include "internal.h"
diff --git a/libavcodec/mpegaudiodsp_template.c b/libavcodec/mpegaudiodsp_template.c
index c67c456e8a..97317967a2 100644
--- a/libavcodec/mpegaudiodsp_template.c
+++ b/libavcodec/mpegaudiodsp_template.c
@@ -22,7 +22,9 @@
#include "libavutil/attributes.h"
#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
+
#include "dct32.h"
#include "mathops.h"
#include "mpegaudiodsp.h"
diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c
index 9ea679d89f..e091ec94bd 100644
--- a/libavcodec/nellymoserdec.c
+++ b/libavcodec/nellymoserdec.c
@@ -34,6 +34,7 @@
#include "libavutil/channel_layout.h"
#include "libavutil/float_dsp.h"
#include "libavutil/lfg.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/random_seed.h"
#define BITSTREAM_READER_LE
diff --git a/libavcodec/on2avc.c b/libavcodec/on2avc.c
index 3885f9acd7..d7a3e4945a 100644
--- a/libavcodec/on2avc.c
+++ b/libavcodec/on2avc.c
@@ -23,6 +23,8 @@
#include "libavutil/channel_layout.h"
#include "libavutil/ffmath.h"
#include "libavutil/float_dsp.h"
+#include "libavutil/mem_internal.h"
+
#include "avcodec.h"
#include "bytestream.h"
#include "fft.h"
diff --git a/libavcodec/opus.h b/libavcodec/opus.h
index fa63353e9b..b73949a811 100644
--- a/libavcodec/opus.h
+++ b/libavcodec/opus.h
@@ -28,6 +28,7 @@
#include "libavutil/audio_fifo.h"
#include "libavutil/float_dsp.h"
#include "libavutil/frame.h"
+#include "libavutil/mem_internal.h"
#include "libswresample/swresample.h"
diff --git a/libavcodec/opus_celt.h b/libavcodec/opus_celt.h
index 7c1c5316b9..661ca251de 100644
--- a/libavcodec/opus_celt.h
+++ b/libavcodec/opus_celt.h
@@ -33,6 +33,7 @@
#include "mdct15.h"
#include "libavutil/float_dsp.h"
#include "libavutil/libm.h"
+#include "libavutil/mem_internal.h"
#define CELT_VECTORS 11
#define CELT_ALLOC_STEPS 6
diff --git a/libavcodec/opus_pvq.h b/libavcodec/opus_pvq.h
index 52f9a4e6d4..b30407f5ab 100644
--- a/libavcodec/opus_pvq.h
+++ b/libavcodec/opus_pvq.h
@@ -23,6 +23,8 @@
#ifndef AVCODEC_OPUS_PVQ_H
#define AVCODEC_OPUS_PVQ_H
+#include "libavutil/mem_internal.h"
+
#include "opus_celt.h"
#define QUANT_FN(name) uint32_t (name)(struct CeltPVQ *pvq, CeltFrame *f, \
diff --git a/libavcodec/opusenc.c b/libavcodec/opusenc.c
index 953749af3a..8bc9e9dc4a 100644
--- a/libavcodec/opusenc.c
+++ b/libavcodec/opusenc.c
@@ -25,6 +25,7 @@
#include "opustab.h"
#include "libavutil/float_dsp.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "internal.h"
#include "bytestream.h"
diff --git a/libavcodec/opusenc_psy.h b/libavcodec/opusenc_psy.h
index b91e4f1b8b..d4fb096a3d 100644
--- a/libavcodec/opusenc_psy.h
+++ b/libavcodec/opusenc_psy.h
@@ -22,6 +22,8 @@
#ifndef AVCODEC_OPUSENC_PSY_H
#define AVCODEC_OPUSENC_PSY_H
+#include "libavutil/mem_internal.h"
+
#include "opusenc.h"
#include "opusenc_utils.h"
#include "libavfilter/window_func.h"
diff --git a/libavcodec/opustab.c b/libavcodec/opustab.c
index 7276dad793..29eb05a12a 100644
--- a/libavcodec/opustab.c
+++ b/libavcodec/opustab.c
@@ -20,6 +20,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/mem_internal.h"
+
#include "opustab.h"
const uint8_t ff_opus_default_coupled_streams[] = { 0, 1, 1, 2, 2, 2, 2, 3 };
diff --git a/libavcodec/ppc/h264chroma_template.c b/libavcodec/ppc/h264chroma_template.c
index 8f43e5dee1..eda98c67ec 100644
--- a/libavcodec/ppc/h264chroma_template.c
+++ b/libavcodec/ppc/h264chroma_template.c
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/ppc/util_altivec.h"
/* this code assume that stride % 16 == 0 */
diff --git a/libavcodec/ppc/h264dsp.c b/libavcodec/ppc/h264dsp.c
index d8a3baa34d..779092fd76 100644
--- a/libavcodec/ppc/h264dsp.c
+++ b/libavcodec/ppc/h264dsp.c
@@ -26,7 +26,7 @@
#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
#include "libavutil/intreadwrite.h"
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/ppc/cpu.h"
#include "libavutil/ppc/util_altivec.h"
diff --git a/libavcodec/ppc/h264qpel.c b/libavcodec/ppc/h264qpel.c
index bef421fa4f..fe896c8453 100644
--- a/libavcodec/ppc/h264qpel.c
+++ b/libavcodec/ppc/h264qpel.c
@@ -23,6 +23,7 @@
#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/ppc/cpu.h"
#include "libavutil/ppc/util_altivec.h"
diff --git a/libavcodec/ppc/mpegvideo_altivec.c b/libavcodec/ppc/mpegvideo_altivec.c
index 2c6ff9165b..bcb59ba845 100644
--- a/libavcodec/ppc/mpegvideo_altivec.c
+++ b/libavcodec/ppc/mpegvideo_altivec.c
@@ -28,6 +28,7 @@
#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/ppc/cpu.h"
#include "libavutil/ppc/util_altivec.h"
diff --git a/libavcodec/ppc/mpegvideodsp.c b/libavcodec/ppc/mpegvideodsp.c
index 990a974a4e..81f4845e6e 100644
--- a/libavcodec/ppc/mpegvideodsp.c
+++ b/libavcodec/ppc/mpegvideodsp.c
@@ -21,7 +21,7 @@
*/
#include "libavutil/cpu.h"
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/ppc/cpu.h"
#include "libavutil/ppc/util_altivec.h"
diff --git a/libavcodec/ppc/vp8dsp_altivec.c b/libavcodec/ppc/vp8dsp_altivec.c
index 31201ed2d8..64ee703dc7 100644
--- a/libavcodec/ppc/vp8dsp_altivec.c
+++ b/libavcodec/ppc/vp8dsp_altivec.c
@@ -23,7 +23,7 @@
#include "config.h"
#include "libavutil/cpu.h"
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/ppc/cpu.h"
#include "libavutil/ppc/util_altivec.h"
diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c
index 8e6f905a9f..0e70163bcc 100644
--- a/libavcodec/proresenc_kostya.c
+++ b/libavcodec/proresenc_kostya.c
@@ -23,6 +23,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avcodec.h"
diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index 1eb6ce38bc..07dea55a76 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -36,6 +36,7 @@
#include <stdio.h>
#include "libavutil/channel_layout.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
#define BITSTREAM_READER_LE
diff --git a/libavcodec/ra144.h b/libavcodec/ra144.h
index 19a4ce09fe..82ef852884 100644
--- a/libavcodec/ra144.h
+++ b/libavcodec/ra144.h
@@ -23,6 +23,9 @@
#define AVCODEC_RA144_H
#include <stdint.h>
+
+#include "libavutil/mem_internal.h"
+
#include "lpc.h"
#include "audio_frame_queue.h"
#include "audiodsp.h"
diff --git a/libavcodec/ra288.h b/libavcodec/ra288.h
index fa0b528b8a..96b074bffb 100644
--- a/libavcodec/ra288.h
+++ b/libavcodec/ra288.h
@@ -24,6 +24,7 @@
#include <stdint.h>
#include "libavutil/common.h"
+#include "libavutil/mem_internal.h"
static const float amptable[8]={
0.515625, 0.90234375, 1.57910156, 2.76342773,
diff --git a/libavcodec/rtjpeg.h b/libavcodec/rtjpeg.h
index d22ff4070e..d4dc074408 100644
--- a/libavcodec/rtjpeg.h
+++ b/libavcodec/rtjpeg.h
@@ -24,7 +24,7 @@
#include <stdint.h>
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "idctdsp.h"
#define RTJPEG_FILE_VERSION 0
diff --git a/libavcodec/rv34.h b/libavcodec/rv34.h
index 1d5522538b..53b29dc245 100644
--- a/libavcodec/rv34.h
+++ b/libavcodec/rv34.h
@@ -27,6 +27,8 @@
#ifndef AVCODEC_RV34_H
#define AVCODEC_RV34_H
+#include "libavutil/mem_internal.h"
+
#include "avcodec.h"
#include "mpegvideo.h"
diff --git a/libavcodec/sbc.h b/libavcodec/sbc.h
index de9c8d9aed..419c8eab90 100644
--- a/libavcodec/sbc.h
+++ b/libavcodec/sbc.h
@@ -35,6 +35,7 @@
#include "avcodec.h"
#include "libavutil/crc.h"
+#include "libavutil/mem_internal.h"
#define MSBC_BLOCKS 15
diff --git a/libavcodec/sbcdec.c b/libavcodec/sbcdec.c
index b8f01d5ff0..bb590e8a05 100644
--- a/libavcodec/sbcdec.c
+++ b/libavcodec/sbcdec.c
@@ -33,6 +33,7 @@
#include "avcodec.h"
#include "internal.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#include "sbc.h"
#include "sbcdec_data.h"
diff --git a/libavcodec/sbcdsp.h b/libavcodec/sbcdsp.h
index 334c058e6d..24264df51d 100644
--- a/libavcodec/sbcdsp.h
+++ b/libavcodec/sbcdsp.h
@@ -32,6 +32,8 @@
#ifndef AVCODEC_SBCDSP_H
#define AVCODEC_SBCDSP_H
+#include "libavutil/mem_internal.h"
+
#include "sbc.h"
#include "sbcdsp_data.h"
diff --git a/libavcodec/sbcdsp_data.c b/libavcodec/sbcdsp_data.c
index 78c07c0077..ad6390c7cf 100644
--- a/libavcodec/sbcdsp_data.c
+++ b/libavcodec/sbcdsp_data.c
@@ -29,6 +29,8 @@
* miscellaneous SBC tables
*/
+#include "libavutil/mem_internal.h"
+
#include "sbcdsp_data.h"
#define F_PROTO(x) ((int32_t) (((x) * 2) * ((int32_t) 1 << 15) + 0.5))
diff --git a/libavcodec/sbr.h b/libavcodec/sbr.h
index eb7d1aec09..f80f122c51 100644
--- a/libavcodec/sbr.h
+++ b/libavcodec/sbr.h
@@ -30,6 +30,9 @@
#define AVCODEC_SBR_H
#include <stdint.h>
+
+#include "libavutil/mem_internal.h"
+
#include "fft.h"
#include "aacps.h"
#include "sbrdsp.h"
diff --git a/libavcodec/sinewin.h b/libavcodec/sinewin.h
index 1348740905..e6de4dfe7b 100644
--- a/libavcodec/sinewin.h
+++ b/libavcodec/sinewin.h
@@ -22,7 +22,7 @@
#define AVCODEC_SINEWIN_H
#include "config.h"
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "libavcodec/aac_defines.h"
#if CONFIG_HARDCODED_TABLES
diff --git a/libavcodec/sipr.h b/libavcodec/sipr.h
index 34f7f994cd..e1ef35d658 100644
--- a/libavcodec/sipr.h
+++ b/libavcodec/sipr.h
@@ -26,7 +26,7 @@
#include "avcodec.h"
#include "acelp_pitch_delay.h"
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#define LP_FILTER_ORDER_16k 16
#define L_SUBFR_16k 80
diff --git a/libavcodec/siren.c b/libavcodec/siren.c
index b1b4944562..3d0cdd4554 100644
--- a/libavcodec/siren.c
+++ b/libavcodec/siren.c
@@ -23,6 +23,7 @@
#include "libavutil/tx.h"
#include "libavutil/float_dsp.h"
+#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "get_bits.h"
diff --git a/libavcodec/svq1_cb.h b/libavcodec/svq1_cb.h
index 11f79691cd..30cca19acc 100644
--- a/libavcodec/svq1_cb.h
+++ b/libavcodec/svq1_cb.h
@@ -34,7 +34,7 @@
#include <stdint.h>
#include <stdlib.h>
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
/* 6x16-entry codebook for inter-coded 4x2 vectors */
DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_4x2)[768] = {
diff --git a/libavcodec/svq1enc.h b/libavcodec/svq1enc.h
index b4ef763417..bb6af082d5 100644
--- a/libavcodec/svq1enc.h
+++ b/libavcodec/svq1enc.h
@@ -24,6 +24,7 @@
#include <stdint.h>
#include "libavutil/frame.h"
+#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "hpeldsp.h"
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index fb7b992496..54ef4add06 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -44,6 +44,7 @@
#include "libavutil/attributes.h"
#include "libavutil/crc.h"
+#include "libavutil/mem_internal.h"
#include "internal.h"
#include "avcodec.h"
diff --git a/libavcodec/tableprint.h b/libavcodec/tableprint.h
index 6f61c7124b..e57eeb6ca6 100644
--- a/libavcodec/tableprint.h
+++ b/libavcodec/tableprint.h
@@ -27,6 +27,7 @@
#include <stdio.h>
#include "libavutil/common.h"
+#include "libavutil/mem_internal.h"
#define WRITE_1D_FUNC_ARGV(type, linebrk, fmtstr, ...)\
void write_##type##_array(const type *data, int len)\
diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c
index 6bf5dcc2d3..931e5d3fb4 100644
--- a/libavcodec/takdec.c
+++ b/libavcodec/takdec.c
@@ -26,6 +26,7 @@
*/
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/samplefmt.h"
#define BITSTREAM_READER_LE
diff --git a/libavcodec/truespeech.c b/libavcodec/truespeech.c
index 3cdae8c556..272fc43deb 100644
--- a/libavcodec/truespeech.c
+++ b/libavcodec/truespeech.c
@@ -21,6 +21,8 @@
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
+
#include "avcodec.h"
#include "bswapdsp.h"
#include "get_bits.h"
diff --git a/libavcodec/vorbis_data.c b/libavcodec/vorbis_data.c
index 063a075ce0..4dba6a8cd3 100644
--- a/libavcodec/vorbis_data.c
+++ b/libavcodec/vorbis_data.c
@@ -19,7 +19,8 @@
*/
#include "libavutil/channel_layout.h"
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
+
#include "vorbis.h"
const uint8_t ff_vorbis_channel_layout_offsets[8][8] = {
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index cf64a8c61e..2a1da6b062 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -35,6 +35,7 @@
#include <string.h>
#include "libavutil/imgutils.h"
+#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "get_bits.h"
diff --git a/libavcodec/vp56.h b/libavcodec/vp56.h
index 65cf46870a..46090f25c9 100644
--- a/libavcodec/vp56.h
+++ b/libavcodec/vp56.h
@@ -26,6 +26,8 @@
#ifndef AVCODEC_VP56_H
#define AVCODEC_VP56_H
+#include "libavutil/mem_internal.h"
+
#include "avcodec.h"
#include "get_bits.h"
#include "hpeldsp.h"
diff --git a/libavcodec/vp8.h b/libavcodec/vp8.h
index 70d21e3c60..e6091dfe04 100644
--- a/libavcodec/vp8.h
+++ b/libavcodec/vp8.h
@@ -29,6 +29,7 @@
#include <stdatomic.h>
#include "libavutil/buffer.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
#include "h264pred.h"
diff --git a/libavcodec/vp9dec.h b/libavcodec/vp9dec.h
index cc2440b854..d82b258a3d 100644
--- a/libavcodec/vp9dec.h
+++ b/libavcodec/vp9dec.h
@@ -29,6 +29,7 @@
#include <stdatomic.h>
#include "libavutil/buffer.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
#include "libavutil/internal.h"
diff --git a/libavcodec/vp9dsp.c b/libavcodec/vp9dsp.c
index f6d73f73cd..41b8ad1ad1 100644
--- a/libavcodec/vp9dsp.c
+++ b/libavcodec/vp9dsp.c
@@ -23,6 +23,8 @@
#include "libavutil/avassert.h"
#include "libavutil/common.h"
+#include "libavutil/mem_internal.h"
+
#include "vp9dsp.h"
const DECLARE_ALIGNED(16, int16_t, ff_vp9_subpel_filters)[3][16][8] = {
diff --git a/libavcodec/wma.h b/libavcodec/wma.h
index 7935bcdb31..aea7ba28ab 100644
--- a/libavcodec/wma.h
+++ b/libavcodec/wma.h
@@ -23,6 +23,7 @@
#define AVCODEC_WMA_H
#include "libavutil/float_dsp.h"
+#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "fft.h"
diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index a8fd99774e..e1fcf8afeb 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -26,6 +26,7 @@
#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
+#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "internal.h"
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index 63e7680f9a..88ee5f4015 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -92,6 +92,8 @@
#include "libavutil/float_dsp.h"
#include "libavutil/intfloat.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
+
#include "avcodec.h"
#include "internal.h"
#include "get_bits.h"
diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index a588bb6c84..fbdb865360 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -29,7 +29,7 @@
#include "libavutil/channel_layout.h"
#include "libavutil/float_dsp.h"
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
#include "avcodec.h"
#include "internal.h"
diff --git a/libavcodec/wmv2.h b/libavcodec/wmv2.h
index 0f459ae5ae..f425332c9a 100644
--- a/libavcodec/wmv2.h
+++ b/libavcodec/wmv2.h
@@ -21,6 +21,8 @@
#ifndef AVCODEC_WMV2_H
#define AVCODEC_WMV2_H
+#include "libavutil/mem_internal.h"
+
#include "avcodec.h"
#include "intrax8.h"
#include "mpegvideo.h"
diff --git a/libavcodec/x86/constants.c b/libavcodec/x86/constants.c
index 4bfb78cc36..f2d267e85d 100644
--- a/libavcodec/x86/constants.c
+++ b/libavcodec/x86/constants.c
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/x86/asm.h" // for xmm_reg
#include "constants.h"
diff --git a/libavcodec/x86/fdct.c b/libavcodec/x86/fdct.c
index 112566ded0..d77f60c86f 100644
--- a/libavcodec/x86/fdct.c
+++ b/libavcodec/x86/fdct.c
@@ -31,6 +31,7 @@
*/
#include "libavutil/common.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/x86/asm.h"
#include "fdct.h"
diff --git a/libavcodec/x86/me_cmp_init.c b/libavcodec/x86/me_cmp_init.c
index 6aec93e55f..701eb1ab25 100644
--- a/libavcodec/x86/me_cmp_init.c
+++ b/libavcodec/x86/me_cmp_init.c
@@ -24,6 +24,7 @@
#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/x86/asm.h"
#include "libavutil/x86/cpu.h"
#include "libavcodec/me_cmp.h"
diff --git a/libavcodec/x86/mpegvideoenc.c b/libavcodec/x86/mpegvideoenc.c
index c884cf121b..4bad6a87ef 100644
--- a/libavcodec/x86/mpegvideoenc.c
+++ b/libavcodec/x86/mpegvideoenc.c
@@ -21,6 +21,7 @@
#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/x86/asm.h"
#include "libavutil/x86/cpu.h"
#include "libavcodec/avcodec.h"
diff --git a/libavfilter/ebur128.c b/libavfilter/ebur128.c
index ca2fca0066..2e86974eba 100644
--- a/libavfilter/ebur128.c
+++ b/libavfilter/ebur128.c
@@ -49,6 +49,7 @@
#include "libavutil/common.h"
#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
#define CHECK_ERROR(condition, errorcode, goto_point) \
diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c
index 39af74c221..471669500b 100644
--- a/libavfilter/vf_colorspace.c
+++ b/libavfilter/vf_colorspace.c
@@ -24,6 +24,7 @@
*/
#include "libavutil/avassert.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/pixfmt.h"
diff --git a/libavfilter/vf_dctdnoiz.c b/libavfilter/vf_dctdnoiz.c
index cdbe5f853f..a89f2631c8 100644
--- a/libavfilter/vf_dctdnoiz.c
+++ b/libavfilter/vf_dctdnoiz.c
@@ -30,6 +30,7 @@
#include "libavutil/avassert.h"
#include "libavutil/eval.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "internal.h"
diff --git a/libavfilter/vf_fspp.c b/libavfilter/vf_fspp.c
index c6989046c4..e57e6f9ec6 100644
--- a/libavfilter/vf_fspp.c
+++ b/libavfilter/vf_fspp.c
@@ -37,6 +37,7 @@
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "internal.h"
diff --git a/libavfilter/vf_gradfun.c b/libavfilter/vf_gradfun.c
index f63128d72e..28da37ff93 100644
--- a/libavfilter/vf_gradfun.c
+++ b/libavfilter/vf_gradfun.c
@@ -35,6 +35,7 @@
#include "libavutil/imgutils.h"
#include "libavutil/common.h"
#include "libavutil/cpu.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
diff --git a/libavfilter/vf_owdenoise.c b/libavfilter/vf_owdenoise.c
index 6d6c2a3d53..7dfe10f2f1 100644
--- a/libavfilter/vf_owdenoise.c
+++ b/libavfilter/vf_owdenoise.c
@@ -30,6 +30,7 @@
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "internal.h"
diff --git a/libavfilter/vf_pp7.c b/libavfilter/vf_pp7.c
index 570a1c90b9..66979d9a13 100644
--- a/libavfilter/vf_pp7.c
+++ b/libavfilter/vf_pp7.c
@@ -29,6 +29,7 @@
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "internal.h"
diff --git a/libavfilter/vf_spp.c b/libavfilter/vf_spp.c
index 4bcc6429e0..54457ebb0b 100644
--- a/libavfilter/vf_spp.c
+++ b/libavfilter/vf_spp.c
@@ -33,6 +33,7 @@
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "internal.h"
diff --git a/libavfilter/vf_uspp.c b/libavfilter/vf_uspp.c
index 6a814350e8..1acef67ffb 100644
--- a/libavfilter/vf_uspp.c
+++ b/libavfilter/vf_uspp.c
@@ -29,6 +29,7 @@
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "internal.h"
diff --git a/libavutil/aes_internal.h b/libavutil/aes_internal.h
index 494425878d..beee626831 100644
--- a/libavutil/aes_internal.h
+++ b/libavutil/aes_internal.h
@@ -21,7 +21,7 @@
#ifndef AVUTIL_AES_INTERNAL_H
#define AVUTIL_AES_INTERNAL_H
-#include "mem.h"
+#include "mem_internal.h"
#include <stdint.h>
typedef union {
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 80c5d06326..93ea57c324 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -43,7 +43,6 @@
#include "cpu.h"
#include "dict.h"
#include "macros.h"
-#include "mem.h"
#include "pixfmt.h"
#include "version.h"
diff --git a/libavutil/lls.h b/libavutil/lls.h
index 1a276d537d..5f849206f7 100644
--- a/libavutil/lls.h
+++ b/libavutil/lls.h
@@ -24,7 +24,7 @@
#define AVUTIL_LLS_H
#include "macros.h"
-#include "mem.h"
+#include "mem_internal.h"
#include "version.h"
#define MAX_VARS 32
diff --git a/libavutil/mem.h b/libavutil/mem.h
index 5fb1a02dd9..e21a1feaae 100644
--- a/libavutil/mem.h
+++ b/libavutil/mem.h
@@ -33,6 +33,7 @@
#include "attributes.h"
#include "error.h"
#include "avutil.h"
+#include "version.h"
/**
* @addtogroup lavu_mem
@@ -49,6 +50,10 @@
* dealing with memory consistently possible on all platforms.
*
* @{
+ */
+
+#if FF_API_DECLARE_ALIGNED
+/**
*
* @defgroup lavu_mem_macros Alignment Macros
* Helper macros for declaring aligned variables.
@@ -125,6 +130,7 @@
/**
* @}
*/
+#endif
/**
* @defgroup lavu_mem_attrs Function Attributes
diff --git a/libavutil/mem_internal.h b/libavutil/mem_internal.h
index 14f45c657f..ee2575c85f 100644
--- a/libavutil/mem_internal.h
+++ b/libavutil/mem_internal.h
@@ -27,6 +27,76 @@
#include "avassert.h"
#include "mem.h"
+#include "version.h"
+
+#if !FF_API_DECLARE_ALIGNED
+/**
+ * @def DECLARE_ALIGNED(n,t,v)
+ * Declare a variable that is aligned in memory.
+ *
+ * @code{.c}
+ * DECLARE_ALIGNED(16, uint16_t, aligned_int) = 42;
+ * DECLARE_ALIGNED(32, uint8_t, aligned_array)[128];
+ *
+ * // The default-alignment equivalent would be
+ * uint16_t aligned_int = 42;
+ * uint8_t aligned_array[128];
+ * @endcode
+ *
+ * @param n Minimum alignment in bytes
+ * @param t Type of the variable (or array element)
+ * @param v Name of the variable
+ */
+
+/**
+ * @def DECLARE_ASM_ALIGNED(n,t,v)
+ * Declare an aligned variable appropriate for use in inline assembly code.
+ *
+ * @code{.c}
+ * DECLARE_ASM_ALIGNED(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
+ * @endcode
+ *
+ * @param n Minimum alignment in bytes
+ * @param t Type of the variable (or array element)
+ * @param v Name of the variable
+ */
+
+/**
+ * @def DECLARE_ASM_CONST(n,t,v)
+ * Declare a static constant aligned variable appropriate for use in inline
+ * assembly code.
+ *
+ * @code{.c}
+ * DECLARE_ASM_CONST(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
+ * @endcode
+ *
+ * @param n Minimum alignment in bytes
+ * @param t Type of the variable (or array element)
+ * @param v Name of the variable
+ */
+
+#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C)
+ #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
+ #define DECLARE_ASM_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
+ #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v
+#elif defined(__DJGPP__)
+ #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (FFMIN(n, 16)))) v
+ #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
+ #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
+#elif defined(__GNUC__) || defined(__clang__)
+ #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
+ #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (n))) v
+ #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v
+#elif defined(_MSC_VER)
+ #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v
+ #define DECLARE_ASM_ALIGNED(n,t,v) __declspec(align(n)) t v
+ #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v
+#else
+ #define DECLARE_ALIGNED(n,t,v) t v
+ #define DECLARE_ASM_ALIGNED(n,t,v) t v
+ #define DECLARE_ASM_CONST(n,t,v) static const t v
+#endif
+#endif
// Some broken preprocessors need a second expansion
// to be forced to tokenize __VA_ARGS__
diff --git a/libavutil/tests/aes_ctr.c b/libavutil/tests/aes_ctr.c
index 00fdb05d13..53d0e4a244 100644
--- a/libavutil/tests/aes_ctr.c
+++ b/libavutil/tests/aes_ctr.c
@@ -18,6 +18,7 @@
#include "libavutil/log.h"
#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/aes_ctr.h"
static const DECLARE_ALIGNED(8, uint8_t, plain)[] = {
diff --git a/libavutil/tests/des.c b/libavutil/tests/des.c
index f2a5c34f1a..8fa88df684 100644
--- a/libavutil/tests/des.c
+++ b/libavutil/tests/des.c
@@ -16,6 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/mem_internal.h"
#include "libavutil/timer.h"
#include "libavutil/des.c"
diff --git a/libavutil/tx_priv.h b/libavutil/tx_priv.h
index e0d980abfb..a3738f68bd 100644
--- a/libavutil/tx_priv.h
+++ b/libavutil/tx_priv.h
@@ -23,6 +23,7 @@
#include <stddef.h>
#include "thread.h"
#include "mem.h"
+#include "mem_internal.h"
#include "avassert.h"
#include "attributes.h"
diff --git a/libavutil/version.h b/libavutil/version.h
index 9b311b5b27..085c4e30f9 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -135,6 +135,9 @@
#ifndef FF_API_D2STR
#define FF_API_D2STR (LIBAVUTIL_VERSION_MAJOR < 58)
#endif
+#ifndef FF_API_DECLARE_ALIGNED
+#define FF_API_DECLARE_ALIGNED (LIBAVUTIL_VERSION_MAJOR < 58)
+#endif
/**
* @}
diff --git a/libpostproc/postprocess_altivec_template.c b/libpostproc/postprocess_altivec_template.c
index fa6ebe279d..a9d4cd29a3 100644
--- a/libpostproc/postprocess_altivec_template.c
+++ b/libpostproc/postprocess_altivec_template.c
@@ -21,6 +21,7 @@
*/
#include "libavutil/avutil.h"
+#include "libavutil/mem_internal.h"
#define ALTIVEC_TRANSPOSE_8x8_SHORT(src_a,src_b,src_c,src_d,src_e,src_f,src_g,src_h) \
do { \
diff --git a/libpostproc/postprocess_internal.h b/libpostproc/postprocess_internal.h
index 765fdeb14a..5d1aee362e 100644
--- a/libpostproc/postprocess_internal.h
+++ b/libpostproc/postprocess_internal.h
@@ -30,6 +30,7 @@
#include "libavutil/avutil.h"
#include "libavutil/intmath.h"
#include "libavutil/log.h"
+#include "libavutil/mem_internal.h"
#include "postprocess.h"
#define V_DEBLOCK 0x01
diff --git a/libpostproc/postprocess_template.c b/libpostproc/postprocess_template.c
index df1684d1e2..411fc41915 100644
--- a/libpostproc/postprocess_template.c
+++ b/libpostproc/postprocess_template.c
@@ -23,6 +23,7 @@
* mmx/mmx2/3dnow postprocess code.
*/
+#include "libavutil/mem_internal.h"
#include "libavutil/x86/asm.h"
/* A single TEMPLATE_PP_* should be defined (to 1) when this template is
diff --git a/libswscale/output.c b/libswscale/output.c
index 4ef436e7e4..e855ad606a 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -30,6 +30,7 @@
#include "libavutil/cpu.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/pixdesc.h"
#include "config.h"
#include "rgb2rgb.h"
diff --git a/libswscale/ppc/yuv2rgb_altivec.c b/libswscale/ppc/yuv2rgb_altivec.c
index 536545293d..58e480dd2c 100644
--- a/libswscale/ppc/yuv2rgb_altivec.c
+++ b/libswscale/ppc/yuv2rgb_altivec.c
@@ -96,6 +96,7 @@
#include "libswscale/swscale_internal.h"
#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/pixdesc.h"
#include "yuv2rgb_altivec.h"
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 9cb7e8f6ac..12160a169a 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -30,6 +30,7 @@
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/pixdesc.h"
#include "config.h"
#include "rgb2rgb.h"
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index d207d3beff..a1de95cee0 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -29,6 +29,7 @@
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/log.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/pixfmt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/ppc/util_altivec.h"
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index 7e92f3fafc..c4dd8a4d83 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -30,6 +30,7 @@
#include "libavutil/cpu.h"
#include "libavutil/avutil.h"
#include "libavutil/mathematics.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/bswap.h"
#include "libavutil/pixdesc.h"
#include "libavutil/avassert.h"
diff --git a/libswscale/x86/hscale_fast_bilinear_simd.c b/libswscale/x86/hscale_fast_bilinear_simd.c
index 60a2cbfc50..850f0add31 100644
--- a/libswscale/x86/hscale_fast_bilinear_simd.c
+++ b/libswscale/x86/hscale_fast_bilinear_simd.c
@@ -21,6 +21,7 @@
#include "../swscale_internal.h"
#include "libavutil/x86/asm.h"
#include "libavutil/x86/cpu.h"
+#include "libavutil/mem_internal.h"
#define RET 0xC3 // near return opcode for x86
#define PREFETCH "prefetchnta"
diff --git a/libswscale/x86/rgb2rgb.c b/libswscale/x86/rgb2rgb.c
index 2d6fc2ad26..4344b5f714 100644
--- a/libswscale/x86/rgb2rgb.c
+++ b/libswscale/x86/rgb2rgb.c
@@ -30,6 +30,8 @@
#include "libavutil/x86/cpu.h"
#include "libavutil/cpu.h"
#include "libavutil/bswap.h"
+#include "libavutil/mem_internal.h"
+
#include "libswscale/rgb2rgb.h"
#include "libswscale/swscale.h"
#include "libswscale/swscale_internal.h"
diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c
index 3160fedf04..15c0b22f20 100644
--- a/libswscale/x86/swscale.c
+++ b/libswscale/x86/swscale.c
@@ -27,6 +27,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/x86/cpu.h"
#include "libavutil/cpu.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/pixdesc.h"
const DECLARE_ALIGNED(8, uint64_t, ff_dither4)[2] = {
1
0
ffmpeg | branch: master | Anton Khirnov <anton(a)khirnov.net> | Wed Jun 10 15:38:08 2020 +0200| [c8c2dfbc378e54aee7e8181ff532483096dc4bc7] | committer: Anton Khirnov
lavu: move LOCAL_ALIGNED from internal.h to mem_internal.h
That is a more appropriate place for it.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c8c2dfbc378e54aee…
---
libavcodec/aacps.c | 1 +
libavcodec/aacsbr.c | 1 +
.../aarch64/vp9dsp_init_16bpp_aarch64_template.c | 1 +
libavcodec/aarch64/vp9dsp_init_aarch64.c | 1 +
libavcodec/ac3enc.c | 1 +
libavcodec/ac3enc_template.c | 1 +
libavcodec/arm/vp9dsp_init_16bpp_arm_template.c | 1 +
libavcodec/arm/vp9dsp_init_arm.c | 1 +
libavcodec/atrac3plusdsp.c | 2 ++
libavcodec/bink.c | 1 +
libavcodec/dca_lbr.c | 1 +
libavcodec/dcadsp.c | 1 +
libavcodec/dcaenc.c | 1 +
libavcodec/dnxhdenc.c | 1 +
libavcodec/dolby_e.c | 1 +
libavcodec/dvdec.c | 1 +
libavcodec/dvenc.c | 1 +
libavcodec/h264_loopfilter.c | 1 +
libavcodec/imc.c | 2 ++
libavcodec/ituh263dec.c | 1 +
libavcodec/lpc.c | 1 +
libavcodec/me_cmp.c | 1 +
libavcodec/mips/aacsbr_mips.c | 1 +
libavcodec/mips/vc1dsp_mmi.c | 1 +
libavcodec/mpc7.c | 2 ++
libavcodec/mpegvideo_enc.c | 1 +
libavcodec/mpegvideo_motion.c | 2 ++
libavcodec/ppc/mpegaudiodsp_altivec.c | 1 +
libavcodec/proresdec2.c | 2 ++
libavcodec/proresenc_anatoliy.c | 1 +
libavcodec/ra288.c | 1 +
libavcodec/rv34.c | 1 +
libavcodec/speedhq.c | 1 +
libavcodec/tests/dct.c | 1 +
libavcodec/tests/x86/dct.c | 2 ++
libavcodec/vp8.c | 1 +
libavcodec/vp9recon.c | 1 +
libavcodec/x86/cavsdsp.c | 1 +
libavcodec/x86/h264_qpel.c | 1 +
libavcodec/x86/hevcdsp_init.c | 1 +
libavcodec/x86/mpegaudiodsp.c | 1 +
libavcodec/x86/mpegvideoenc_template.c | 1 +
libavcodec/x86/rv40dsp_init.c | 1 +
libavcodec/x86/vc1dsp_mmx.c | 1 +
libavcodec/x86/vp8dsp_init.c | 1 +
libavcodec/x86/vp9dsp_init.h | 2 ++
libavfilter/af_arnndn.c | 1 +
libavutil/internal.h | 37 -------------------
libavutil/mem_internal.h | 42 ++++++++++++++++++++++
libavutil/mips/mmiutils.h | 2 ++
libavutil/tests/lls.c | 1 +
libswscale/ppc/swscale_ppc_template.c | 2 ++
libswscale/ppc/swscale_vsx.c | 1 +
tests/checkasm/aacpsdsp.c | 1 +
tests/checkasm/af_afir.c | 1 +
tests/checkasm/alacdsp.c | 1 +
tests/checkasm/audiodsp.c | 1 +
tests/checkasm/blockdsp.c | 1 +
tests/checkasm/bswapdsp.c | 1 +
tests/checkasm/exrdsp.c | 1 +
tests/checkasm/fixed_dsp.c | 1 +
tests/checkasm/flacdsp.c | 1 +
tests/checkasm/float_dsp.c | 2 ++
tests/checkasm/fmtconvert.c | 2 ++
tests/checkasm/h264dsp.c | 1 +
tests/checkasm/h264pred.c | 1 +
tests/checkasm/h264qpel.c | 1 +
tests/checkasm/hevc_add_res.c | 1 +
tests/checkasm/hevc_idct.c | 1 +
tests/checkasm/hevc_sao.c | 1 +
tests/checkasm/jpeg2000dsp.c | 1 +
tests/checkasm/llviddspenc.c | 1 +
tests/checkasm/opusdsp.c | 2 ++
tests/checkasm/pixblockdsp.c | 1 +
tests/checkasm/sbrdsp.c | 2 ++
tests/checkasm/sw_rgb.c | 1 +
tests/checkasm/sw_scale.c | 1 +
tests/checkasm/synth_filter.c | 2 ++
tests/checkasm/utvideodsp.c | 1 +
tests/checkasm/v210enc.c | 1 +
tests/checkasm/vf_colorspace.c | 1 +
tests/checkasm/vf_eq.c | 1 +
tests/checkasm/vf_hflip.c | 1 +
tests/checkasm/vf_threshold.c | 1 +
tests/checkasm/videodsp.c | 1 +
tests/checkasm/vp8dsp.c | 1 +
tests/checkasm/vp9dsp.c | 1 +
87 files changed, 141 insertions(+), 37 deletions(-)
diff --git a/libavcodec/aacps.c b/libavcodec/aacps.c
index 05a6b5afb8..6c7a33fea8 100644
--- a/libavcodec/aacps.c
+++ b/libavcodec/aacps.c
@@ -25,6 +25,7 @@
#include <stdint.h>
#include "libavutil/common.h"
#include "libavutil/mathematics.h"
+#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "aacps.h"
#if USE_FIXED
diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c
index ca4e83ed64..b74cd82ac0 100644
--- a/libavcodec/aacsbr.c
+++ b/libavcodec/aacsbr.c
@@ -38,6 +38,7 @@
#include "libavutil/internal.h"
#include "libavutil/libm.h"
#include "libavutil/avassert.h"
+#include "libavutil/mem_internal.h"
#include <stdint.h>
#include <float.h>
diff --git a/libavcodec/aarch64/vp9dsp_init_16bpp_aarch64_template.c b/libavcodec/aarch64/vp9dsp_init_16bpp_aarch64_template.c
index 8dcfdeaaf7..d2a4e90b3a 100644
--- a/libavcodec/aarch64/vp9dsp_init_16bpp_aarch64_template.c
+++ b/libavcodec/aarch64/vp9dsp_init_16bpp_aarch64_template.c
@@ -22,6 +22,7 @@
#include "libavutil/attributes.h"
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/aarch64/cpu.h"
#include "vp9dsp_init.h"
diff --git a/libavcodec/aarch64/vp9dsp_init_aarch64.c b/libavcodec/aarch64/vp9dsp_init_aarch64.c
index 4c699759fe..4d1fee62de 100644
--- a/libavcodec/aarch64/vp9dsp_init_aarch64.c
+++ b/libavcodec/aarch64/vp9dsp_init_aarch64.c
@@ -22,6 +22,7 @@
#include "libavutil/attributes.h"
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/aarch64/cpu.h"
#include "libavcodec/vp9dsp.h"
#include "vp9dsp_init.h"
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
index 37dc0fb2ef..0afe94a909 100644
--- a/libavcodec/ac3enc.c
+++ b/libavcodec/ac3enc.c
@@ -34,6 +34,7 @@
#include "libavutil/channel_layout.h"
#include "libavutil/crc.h"
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "internal.h"
diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c
index b85fe51ef5..b74e38aea0 100644
--- a/libavcodec/ac3enc_template.c
+++ b/libavcodec/ac3enc_template.c
@@ -30,6 +30,7 @@
#include "libavutil/attributes.h"
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
#include "audiodsp.h"
#include "internal.h"
diff --git a/libavcodec/arm/vp9dsp_init_16bpp_arm_template.c b/libavcodec/arm/vp9dsp_init_16bpp_arm_template.c
index 1b0007859d..b0907094c1 100644
--- a/libavcodec/arm/vp9dsp_init_16bpp_arm_template.c
+++ b/libavcodec/arm/vp9dsp_init_16bpp_arm_template.c
@@ -22,6 +22,7 @@
#include "libavutil/attributes.h"
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/arm/cpu.h"
#include "vp9dsp_init.h"
diff --git a/libavcodec/arm/vp9dsp_init_arm.c b/libavcodec/arm/vp9dsp_init_arm.c
index cb7f48d5ca..b3911f7e49 100644
--- a/libavcodec/arm/vp9dsp_init_arm.c
+++ b/libavcodec/arm/vp9dsp_init_arm.c
@@ -22,6 +22,7 @@
#include "libavutil/attributes.h"
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/arm/cpu.h"
#include "libavcodec/vp9dsp.h"
#include "vp9dsp_init.h"
diff --git a/libavcodec/atrac3plusdsp.c b/libavcodec/atrac3plusdsp.c
index 7af1fa2141..e32c5c8170 100644
--- a/libavcodec/atrac3plusdsp.c
+++ b/libavcodec/atrac3plusdsp.c
@@ -29,6 +29,8 @@
#include "libavutil/float_dsp.h"
#include "libavutil/libm.h"
+#include "libavutil/mem_internal.h"
+
#include "avcodec.h"
#include "sinewin.h"
#include "fft.h"
diff --git a/libavcodec/bink.c b/libavcodec/bink.c
index ec164d0165..5efd24e9c3 100644
--- a/libavcodec/bink.c
+++ b/libavcodec/bink.c
@@ -23,6 +23,7 @@
#include "libavutil/attributes.h"
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
#define BITSTREAM_READER_LE
#include "avcodec.h"
diff --git a/libavcodec/dca_lbr.c b/libavcodec/dca_lbr.c
index 747fdafd3e..2f8060df89 100644
--- a/libavcodec/dca_lbr.c
+++ b/libavcodec/dca_lbr.c
@@ -21,6 +21,7 @@
#define BITSTREAM_READER_LE
#include "libavutil/channel_layout.h"
+#include "libavutil/mem_internal.h"
#include "dcadec.h"
#include "dcadata.h"
diff --git a/libavcodec/dcadsp.c b/libavcodec/dcadsp.c
index fade1a6c02..faf244c8ad 100644
--- a/libavcodec/dcadsp.c
+++ b/libavcodec/dcadsp.c
@@ -19,6 +19,7 @@
*/
#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "dcadsp.h"
#include "dcamath.h"
diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c
index 34b3e94165..a40d2e0ca0 100644
--- a/libavcodec/dcaenc.c
+++ b/libavcodec/dcaenc.c
@@ -28,6 +28,7 @@
#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "libavutil/ffmath.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "dca.h"
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 91eeb47e33..0144797d1b 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -25,6 +25,7 @@
#include "libavutil/attributes.h"
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "avcodec.h"
diff --git a/libavcodec/dolby_e.c b/libavcodec/dolby_e.c
index 429612ec08..2b2f0a1640 100644
--- a/libavcodec/dolby_e.c
+++ b/libavcodec/dolby_e.c
@@ -21,6 +21,7 @@
#include "libavutil/float_dsp.h"
#include "libavutil/thread.h"
#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "internal.h"
#include "get_bits.h"
diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
index c526091eb4..a0647e58b4 100644
--- a/libavcodec/dvdec.c
+++ b/libavcodec/dvdec.c
@@ -38,6 +38,7 @@
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/pixdesc.h"
#include "avcodec.h"
diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c
index 21a8b841f6..0dc290642e 100644
--- a/libavcodec/dvenc.c
+++ b/libavcodec/dvenc.c
@@ -30,6 +30,7 @@
#include "libavutil/attributes.h"
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
diff --git a/libavcodec/h264_loopfilter.c b/libavcodec/h264_loopfilter.c
index 0924f32613..558ec6c02d 100644
--- a/libavcodec/h264_loopfilter.c
+++ b/libavcodec/h264_loopfilter.c
@@ -27,6 +27,7 @@
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#include "internal.h"
#include "avcodec.h"
#include "h264dec.h"
diff --git a/libavcodec/imc.c b/libavcodec/imc.c
index dbcb98a966..0f6db8f708 100644
--- a/libavcodec/imc.c
+++ b/libavcodec/imc.c
@@ -38,7 +38,9 @@
#include "libavutil/ffmath.h"
#include "libavutil/float_dsp.h"
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
+
#include "avcodec.h"
#include "bswapdsp.h"
#include "get_bits.h"
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index ced7fa52ee..c9007b2fd6 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -34,6 +34,7 @@
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/mathematics.h"
+#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "mpegvideo.h"
#include "h263.h"
diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c
index f8da1e1266..1d1d04fd80 100644
--- a/libavcodec/lpc.c
+++ b/libavcodec/lpc.c
@@ -21,6 +21,7 @@
#include "libavutil/common.h"
#include "libavutil/lls.h"
+#include "libavutil/mem_internal.h"
#define LPC_USE_DOUBLE
#include "lpc.h"
diff --git a/libavcodec/me_cmp.c b/libavcodec/me_cmp.c
index ae248c52f8..ba72468240 100644
--- a/libavcodec/me_cmp.c
+++ b/libavcodec/me_cmp.c
@@ -22,6 +22,7 @@
#include "libavutil/attributes.h"
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "copy_block.h"
#include "simple_idct.h"
diff --git a/libavcodec/mips/aacsbr_mips.c b/libavcodec/mips/aacsbr_mips.c
index 5ef5e68371..33fd9b229e 100644
--- a/libavcodec/mips/aacsbr_mips.c
+++ b/libavcodec/mips/aacsbr_mips.c
@@ -53,6 +53,7 @@
#include "libavcodec/aac.h"
#include "libavcodec/aacsbr.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/mips/asmdefs.h"
#define ENVELOPE_ADJUSTMENT_OFFSET 2
diff --git a/libavcodec/mips/vc1dsp_mmi.c b/libavcodec/mips/vc1dsp_mmi.c
index 98378683b8..79f19a9b39 100644
--- a/libavcodec/mips/vc1dsp_mmi.c
+++ b/libavcodec/mips/vc1dsp_mmi.c
@@ -25,6 +25,7 @@
#include "constants.h"
#include "vc1dsp_mips.h"
#include "hpeldsp_mips.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/mips/mmiutils.h"
#define VC1_INV_TRANCS_8_TYPE1(o1, o2, r1, r2, r3, r4, c0) \
diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c
index 720d67623f..af12a6fd8e 100644
--- a/libavcodec/mpc7.c
+++ b/libavcodec/mpc7.c
@@ -28,7 +28,9 @@
#include "libavutil/channel_layout.h"
#include "libavutil/internal.h"
#include "libavutil/lfg.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
+
#include "avcodec.h"
#include "get_bits.h"
#include "internal.h"
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 243d3ca632..25d9004199 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -36,6 +36,7 @@
#include "libavutil/internal.h"
#include "libavutil/intmath.h"
#include "libavutil/mathematics.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/pixdesc.h"
#include "libavutil/opt.h"
#include "avcodec.h"
diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c
index 5624c10629..58cdecf83b 100644
--- a/libavcodec/mpegvideo_motion.c
+++ b/libavcodec/mpegvideo_motion.c
@@ -25,6 +25,8 @@
#include "libavutil/avassert.h"
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
+
#include "avcodec.h"
#include "h261.h"
#include "mpegutils.h"
diff --git a/libavcodec/ppc/mpegaudiodsp_altivec.c b/libavcodec/ppc/mpegaudiodsp_altivec.c
index efa9fd5fed..6794ed0928 100644
--- a/libavcodec/ppc/mpegaudiodsp_altivec.c
+++ b/libavcodec/ppc/mpegaudiodsp_altivec.c
@@ -23,6 +23,7 @@
#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/ppc/cpu.h"
#include "libavutil/ppc/util_altivec.h"
#include "libavcodec/mpegaudiodsp.h"
diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c
index 5fd2796115..136f341c08 100644
--- a/libavcodec/proresdec2.c
+++ b/libavcodec/proresdec2.c
@@ -29,6 +29,8 @@
#define LONG_BITSTREAM_READER
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
+
#include "avcodec.h"
#include "get_bits.h"
#include "idctdsp.h"
diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c
index 8bc13fd576..c34e55f873 100644
--- a/libavcodec/proresenc_anatoliy.c
+++ b/libavcodec/proresenc_anatoliy.c
@@ -27,6 +27,7 @@
* Known FOURCCs: 'ap4h' (444), 'apch' (HQ), 'apcn' (422), 'apcs' (LT), 'acpo' (Proxy)
*/
+#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "dct.h"
diff --git a/libavcodec/ra288.c b/libavcodec/ra288.c
index 6495026874..0eb2a661cb 100644
--- a/libavcodec/ra288.c
+++ b/libavcodec/ra288.c
@@ -22,6 +22,7 @@
#include "libavutil/channel_layout.h"
#include "libavutil/float_dsp.h"
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
#define BITSTREAM_READER_LE
#include "avcodec.h"
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index f8cc837985..6434f784d6 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -27,6 +27,7 @@
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
#include "avcodec.h"
diff --git a/libavcodec/speedhq.c b/libavcodec/speedhq.c
index 221a70b3e9..759fc6dfc5 100644
--- a/libavcodec/speedhq.c
+++ b/libavcodec/speedhq.c
@@ -28,6 +28,7 @@
#include "config.h"
#include "libavutil/attributes.h"
+#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "get_bits.h"
diff --git a/libavcodec/tests/dct.c b/libavcodec/tests/dct.c
index 2ca8039c01..eab39e9468 100644
--- a/libavcodec/tests/dct.c
+++ b/libavcodec/tests/dct.c
@@ -38,6 +38,7 @@
#include "libavutil/common.h"
#include "libavutil/internal.h"
#include "libavutil/lfg.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/time.h"
#include "libavcodec/dct.h"
diff --git a/libavcodec/tests/x86/dct.c b/libavcodec/tests/x86/dct.c
index afb03b194b..f5c238efc7 100644
--- a/libavcodec/tests/x86/dct.c
+++ b/libavcodec/tests/x86/dct.c
@@ -18,6 +18,8 @@
#include "config.h"
+#include "libavutil/mem_internal.h"
+
#include "libavcodec/x86/fdct.h"
#include "libavcodec/x86/xvididct.h"
#include "libavcodec/x86/simple_idct.h"
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index d5d133540a..9440969728 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -25,6 +25,7 @@
*/
#include "libavutil/imgutils.h"
+#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "hwconfig.h"
diff --git a/libavcodec/vp9recon.c b/libavcodec/vp9recon.c
index 9a4e7c7a03..e38cf99ec5 100644
--- a/libavcodec/vp9recon.c
+++ b/libavcodec/vp9recon.c
@@ -22,6 +22,7 @@
*/
#include "libavutil/avassert.h"
+#include "libavutil/mem_internal.h"
#include "avcodec.h"
#include "internal.h"
diff --git a/libavcodec/x86/cavsdsp.c b/libavcodec/x86/cavsdsp.c
index becb3a4808..f974f93fc0 100644
--- a/libavcodec/x86/cavsdsp.c
+++ b/libavcodec/x86/cavsdsp.c
@@ -25,6 +25,7 @@
#include "libavutil/attributes.h"
#include "libavutil/common.h"
#include "libavutil/cpu.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/x86/asm.h"
#include "libavutil/x86/cpu.h"
#include "libavcodec/cavsdsp.h"
diff --git a/libavcodec/x86/h264_qpel.c b/libavcodec/x86/h264_qpel.c
index 0d3dbbadb0..a2d8a64976 100644
--- a/libavcodec/x86/h264_qpel.c
+++ b/libavcodec/x86/h264_qpel.c
@@ -21,6 +21,7 @@
#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/x86/asm.h"
#include "libavutil/x86/cpu.h"
#include "libavcodec/h264dec.h"
diff --git a/libavcodec/x86/hevcdsp_init.c b/libavcodec/x86/hevcdsp_init.c
index 17cd2332aa..8a3fa2744b 100644
--- a/libavcodec/x86/hevcdsp_init.c
+++ b/libavcodec/x86/hevcdsp_init.c
@@ -22,6 +22,7 @@
#include "config.h"
#include "libavutil/cpu.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/x86/asm.h"
#include "libavutil/x86/cpu.h"
#include "libavcodec/get_bits.h" /* required for hevcdsp.h GetBitContext */
diff --git a/libavcodec/x86/mpegaudiodsp.c b/libavcodec/x86/mpegaudiodsp.c
index d646c6dbcb..50692f29ce 100644
--- a/libavcodec/x86/mpegaudiodsp.c
+++ b/libavcodec/x86/mpegaudiodsp.c
@@ -22,6 +22,7 @@
#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/x86/asm.h"
#include "libavutil/x86/cpu.h"
#include "libavcodec/mpegaudiodsp.h"
diff --git a/libavcodec/x86/mpegvideoenc_template.c b/libavcodec/x86/mpegvideoenc_template.c
index 1201be514b..b32b1b0350 100644
--- a/libavcodec/x86/mpegvideoenc_template.c
+++ b/libavcodec/x86/mpegvideoenc_template.c
@@ -23,6 +23,7 @@
#include <stdint.h>
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/x86/asm.h"
#include "libavcodec/mpegutils.h"
#include "libavcodec/mpegvideo.h"
diff --git a/libavcodec/x86/rv40dsp_init.c b/libavcodec/x86/rv40dsp_init.c
index b57a3fc31a..79a617ffbe 100644
--- a/libavcodec/x86/rv40dsp_init.c
+++ b/libavcodec/x86/rv40dsp_init.c
@@ -29,6 +29,7 @@
#include "libavcodec/rv34dsp.h"
#include "libavutil/attributes.h"
#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/x86/cpu.h"
#include "hpeldsp.h"
diff --git a/libavcodec/x86/vc1dsp_mmx.c b/libavcodec/x86/vc1dsp_mmx.c
index 45c8a68f29..6541dda429 100644
--- a/libavcodec/x86/vc1dsp_mmx.c
+++ b/libavcodec/x86/vc1dsp_mmx.c
@@ -26,6 +26,7 @@
#include "libavutil/cpu.h"
#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/x86/asm.h"
#include "libavutil/x86/cpu.h"
#include "libavcodec/vc1dsp.h"
diff --git a/libavcodec/x86/vp8dsp_init.c b/libavcodec/x86/vp8dsp_init.c
index 397b2518cb..dffa7a2418 100644
--- a/libavcodec/x86/vp8dsp_init.c
+++ b/libavcodec/x86/vp8dsp_init.c
@@ -23,6 +23,7 @@
#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/x86/cpu.h"
#include "libavcodec/vp8dsp.h"
diff --git a/libavcodec/x86/vp9dsp_init.h b/libavcodec/x86/vp9dsp_init.h
index e410cab3a1..ebe7ca8ad0 100644
--- a/libavcodec/x86/vp9dsp_init.h
+++ b/libavcodec/x86/vp9dsp_init.h
@@ -23,6 +23,8 @@
#ifndef AVCODEC_X86_VP9DSP_INIT_H
#define AVCODEC_X86_VP9DSP_INIT_H
+#include "libavutil/mem_internal.h"
+
#include "libavcodec/vp9dsp.h"
// hack to force-expand BPC
diff --git a/libavfilter/af_arnndn.c b/libavfilter/af_arnndn.c
index 4551ce2b83..bcb99dbfc3 100644
--- a/libavfilter/af_arnndn.c
+++ b/libavfilter/af_arnndn.c
@@ -36,6 +36,7 @@
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/float_dsp.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "libavutil/tx.h"
#include "avfilter.h"
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 12f824d97a..80c5d06326 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -92,10 +92,6 @@
type av_##name##_get_##field(const str *s) { return s->field; } \
void av_##name##_set_##field(str *s, type v) { s->field = v; }
-// Some broken preprocessors need a second expansion
-// to be forced to tokenize __VA_ARGS__
-#define E1(x) x
-
/* Check if the hard coded offset of a struct member still matches reality.
* Induce a compilation failure if not.
*/
@@ -103,39 +99,6 @@
int x_##o[offsetof(s, m) == o? 1: -1]; \
}
-#define LOCAL_ALIGNED_A(a, t, v, s, o, ...) \
- uint8_t la_##v[sizeof(t s o) + (a)]; \
- t (*v) o = (void *)FFALIGN((uintptr_t)la_##v, a)
-
-#define LOCAL_ALIGNED_D(a, t, v, s, o, ...) \
- DECLARE_ALIGNED(a, t, la_##v) s o; \
- t (*v) o = la_##v
-
-#define LOCAL_ALIGNED(a, t, v, ...) LOCAL_ALIGNED_##a(t, v, __VA_ARGS__)
-
-#if HAVE_LOCAL_ALIGNED
-# define LOCAL_ALIGNED_4(t, v, ...) E1(LOCAL_ALIGNED_D(4, t, v, __VA_ARGS__,,))
-#else
-# define LOCAL_ALIGNED_4(t, v, ...) E1(LOCAL_ALIGNED_A(4, t, v, __VA_ARGS__,,))
-#endif
-
-#if HAVE_LOCAL_ALIGNED
-# define LOCAL_ALIGNED_8(t, v, ...) E1(LOCAL_ALIGNED_D(8, t, v, __VA_ARGS__,,))
-#else
-# define LOCAL_ALIGNED_8(t, v, ...) E1(LOCAL_ALIGNED_A(8, t, v, __VA_ARGS__,,))
-#endif
-
-#if HAVE_LOCAL_ALIGNED
-# define LOCAL_ALIGNED_16(t, v, ...) E1(LOCAL_ALIGNED_D(16, t, v, __VA_ARGS__,,))
-#else
-# define LOCAL_ALIGNED_16(t, v, ...) E1(LOCAL_ALIGNED_A(16, t, v, __VA_ARGS__,,))
-#endif
-
-#if HAVE_LOCAL_ALIGNED
-# define LOCAL_ALIGNED_32(t, v, ...) E1(LOCAL_ALIGNED_D(32, t, v, __VA_ARGS__,,))
-#else
-# define LOCAL_ALIGNED_32(t, v, ...) E1(LOCAL_ALIGNED_A(32, t, v, __VA_ARGS__,,))
-#endif
#define FF_ALLOC_TYPED_ARRAY(p, nelem) (p = av_malloc_array(nelem, sizeof(*p)))
#define FF_ALLOCZ_TYPED_ARRAY(p, nelem) (p = av_mallocz_array(nelem, sizeof(*p)))
diff --git a/libavutil/mem_internal.h b/libavutil/mem_internal.h
index 6fdbcb016e..14f45c657f 100644
--- a/libavutil/mem_internal.h
+++ b/libavutil/mem_internal.h
@@ -21,9 +21,51 @@
#ifndef AVUTIL_MEM_INTERNAL_H
#define AVUTIL_MEM_INTERNAL_H
+#include "config.h"
+
+#include <stdint.h>
+
#include "avassert.h"
#include "mem.h"
+// Some broken preprocessors need a second expansion
+// to be forced to tokenize __VA_ARGS__
+#define E1(x) x
+
+#define LOCAL_ALIGNED_A(a, t, v, s, o, ...) \
+ uint8_t la_##v[sizeof(t s o) + (a)]; \
+ t (*v) o = (void *)FFALIGN((uintptr_t)la_##v, a)
+
+#define LOCAL_ALIGNED_D(a, t, v, s, o, ...) \
+ DECLARE_ALIGNED(a, t, la_##v) s o; \
+ t (*v) o = la_##v
+
+#define LOCAL_ALIGNED(a, t, v, ...) LOCAL_ALIGNED_##a(t, v, __VA_ARGS__)
+
+#if HAVE_LOCAL_ALIGNED
+# define LOCAL_ALIGNED_4(t, v, ...) E1(LOCAL_ALIGNED_D(4, t, v, __VA_ARGS__,,))
+#else
+# define LOCAL_ALIGNED_4(t, v, ...) E1(LOCAL_ALIGNED_A(4, t, v, __VA_ARGS__,,))
+#endif
+
+#if HAVE_LOCAL_ALIGNED
+# define LOCAL_ALIGNED_8(t, v, ...) E1(LOCAL_ALIGNED_D(8, t, v, __VA_ARGS__,,))
+#else
+# define LOCAL_ALIGNED_8(t, v, ...) E1(LOCAL_ALIGNED_A(8, t, v, __VA_ARGS__,,))
+#endif
+
+#if HAVE_LOCAL_ALIGNED
+# define LOCAL_ALIGNED_16(t, v, ...) E1(LOCAL_ALIGNED_D(16, t, v, __VA_ARGS__,,))
+#else
+# define LOCAL_ALIGNED_16(t, v, ...) E1(LOCAL_ALIGNED_A(16, t, v, __VA_ARGS__,,))
+#endif
+
+#if HAVE_LOCAL_ALIGNED
+# define LOCAL_ALIGNED_32(t, v, ...) E1(LOCAL_ALIGNED_D(32, t, v, __VA_ARGS__,,))
+#else
+# define LOCAL_ALIGNED_32(t, v, ...) E1(LOCAL_ALIGNED_A(32, t, v, __VA_ARGS__,,))
+#endif
+
static inline int ff_fast_malloc(void *ptr, unsigned int *size, size_t min_size, int zero_realloc)
{
void *val;
diff --git a/libavutil/mips/mmiutils.h b/libavutil/mips/mmiutils.h
index 8f692e86c5..6a82caa908 100644
--- a/libavutil/mips/mmiutils.h
+++ b/libavutil/mips/mmiutils.h
@@ -25,6 +25,8 @@
#define AVUTIL_MIPS_MMIUTILS_H
#include "config.h"
+
+#include "libavutil/mem_internal.h"
#include "libavutil/mips/asmdefs.h"
#if HAVE_LOONGSON2
diff --git a/libavutil/tests/lls.c b/libavutil/tests/lls.c
index 965b0f458d..4c14c0c4b4 100644
--- a/libavutil/tests/lls.c
+++ b/libavutil/tests/lls.c
@@ -22,6 +22,7 @@
#include "libavutil/internal.h"
#include "libavutil/lfg.h"
#include "libavutil/lls.h"
+#include "libavutil/mem_internal.h"
int main(void)
{
diff --git a/libswscale/ppc/swscale_ppc_template.c b/libswscale/ppc/swscale_ppc_template.c
index aff2dd79f9..0ffa92725b 100644
--- a/libswscale/ppc/swscale_ppc_template.c
+++ b/libswscale/ppc/swscale_ppc_template.c
@@ -21,6 +21,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/mem_internal.h"
+
static void FUNC(yuv2planeX_8_16)(const int16_t *filter, int filterSize,
const int16_t **src, uint8_t *dest,
const uint8_t *dither, int offset, int x)
diff --git a/libswscale/ppc/swscale_vsx.c b/libswscale/ppc/swscale_vsx.c
index af8b0e1fa3..8152ce7f10 100644
--- a/libswscale/ppc/swscale_vsx.c
+++ b/libswscale/ppc/swscale_vsx.c
@@ -28,6 +28,7 @@
#include "libswscale/swscale_internal.h"
#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
+#include "libavutil/mem_internal.h"
#include "yuv2rgb_altivec.h"
#include "libavutil/ppc/util_altivec.h"
diff --git a/tests/checkasm/aacpsdsp.c b/tests/checkasm/aacpsdsp.c
index 2ceef4341f..359b1e9a00 100644
--- a/tests/checkasm/aacpsdsp.c
+++ b/tests/checkasm/aacpsdsp.c
@@ -18,6 +18,7 @@
#include "libavcodec/aacpsdsp.h"
#include "libavutil/intfloat.h"
+#include "libavutil/mem_internal.h"
#include "checkasm.h"
diff --git a/tests/checkasm/af_afir.c b/tests/checkasm/af_afir.c
index 8d1f815469..b8a845db82 100644
--- a/tests/checkasm/af_afir.c
+++ b/tests/checkasm/af_afir.c
@@ -23,6 +23,7 @@
#include "libavfilter/af_afir.h"
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
#include "checkasm.h"
#define LEN 256
diff --git a/tests/checkasm/alacdsp.c b/tests/checkasm/alacdsp.c
index cbf03f82e8..b822c725cf 100644
--- a/tests/checkasm/alacdsp.c
+++ b/tests/checkasm/alacdsp.c
@@ -24,6 +24,7 @@
#include "libavcodec/mathops.h"
#include "libavutil/common.h"
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
#define BUF_SIZE 256
#define MAX_CHANNELS 2
diff --git a/tests/checkasm/audiodsp.c b/tests/checkasm/audiodsp.c
index 7c4e16e40d..d3a5604299 100644
--- a/tests/checkasm/audiodsp.c
+++ b/tests/checkasm/audiodsp.c
@@ -25,6 +25,7 @@
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#include "checkasm.h"
diff --git a/tests/checkasm/blockdsp.c b/tests/checkasm/blockdsp.c
index c753506b3c..9e6ce9d7d1 100644
--- a/tests/checkasm/blockdsp.c
+++ b/tests/checkasm/blockdsp.c
@@ -27,6 +27,7 @@
#include "libavutil/common.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#define randomize_buffers(size) \
do { \
diff --git a/tests/checkasm/bswapdsp.c b/tests/checkasm/bswapdsp.c
index 5f7555037d..d789e90de3 100644
--- a/tests/checkasm/bswapdsp.c
+++ b/tests/checkasm/bswapdsp.c
@@ -24,6 +24,7 @@
#include "libavutil/common.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#define BUF_SIZE 512
diff --git a/tests/checkasm/exrdsp.c b/tests/checkasm/exrdsp.c
index 754a079f83..2a5febb9d3 100644
--- a/tests/checkasm/exrdsp.c
+++ b/tests/checkasm/exrdsp.c
@@ -24,6 +24,7 @@
#include "libavcodec/avcodec.h"
#include "libavcodec/exrdsp.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#define BUF_SIZE 5120
#define PADDED_BUF_SIZE BUF_SIZE+AV_INPUT_BUFFER_PADDING_SIZE*2
diff --git a/tests/checkasm/fixed_dsp.c b/tests/checkasm/fixed_dsp.c
index fa11f2e23f..4e610a148e 100644
--- a/tests/checkasm/fixed_dsp.c
+++ b/tests/checkasm/fixed_dsp.c
@@ -23,6 +23,7 @@
#include "libavutil/fixed_dsp.h"
#include "libavutil/internal.h"
#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#define BUF_SIZE 256
diff --git a/tests/checkasm/flacdsp.c b/tests/checkasm/flacdsp.c
index dccb54d672..6cd8ac50ef 100644
--- a/tests/checkasm/flacdsp.c
+++ b/tests/checkasm/flacdsp.c
@@ -24,6 +24,7 @@
#include "libavutil/common.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#define BUF_SIZE 256
#define MAX_CHANNELS 8
diff --git a/tests/checkasm/float_dsp.c b/tests/checkasm/float_dsp.c
index a1616a61a8..1437d8ee97 100644
--- a/tests/checkasm/float_dsp.c
+++ b/tests/checkasm/float_dsp.c
@@ -23,6 +23,8 @@
#include "libavutil/float_dsp.h"
#include "libavutil/internal.h"
+#include "libavutil/mem_internal.h"
+
#include "checkasm.h"
#define LEN 256
diff --git a/tests/checkasm/fmtconvert.c b/tests/checkasm/fmtconvert.c
index 50ad3ca2ea..aef74479f6 100644
--- a/tests/checkasm/fmtconvert.c
+++ b/tests/checkasm/fmtconvert.c
@@ -24,6 +24,8 @@
#include "libavutil/internal.h"
#include "libavutil/common.h"
+#include "libavutil/mem_internal.h"
+
#include "libavcodec/fmtconvert.h"
#include "checkasm.h"
diff --git a/tests/checkasm/h264dsp.c b/tests/checkasm/h264dsp.c
index 6975205743..7392452957 100644
--- a/tests/checkasm/h264dsp.c
+++ b/tests/checkasm/h264dsp.c
@@ -26,6 +26,7 @@
#include "libavutil/common.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
static const uint32_t pixel_mask[3] = { 0xffffffff, 0x01ff01ff, 0x03ff03ff };
static const uint32_t pixel_mask_lf[3] = { 0xff0fff0f, 0x01ff000f, 0x03ff000f };
diff --git a/tests/checkasm/h264pred.c b/tests/checkasm/h264pred.c
index 59dcb2f427..a3077f6946 100644
--- a/tests/checkasm/h264pred.c
+++ b/tests/checkasm/h264pred.c
@@ -25,6 +25,7 @@
#include "libavutil/common.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
static const int codec_ids[4] = { AV_CODEC_ID_H264, AV_CODEC_ID_VP8, AV_CODEC_ID_RV40, AV_CODEC_ID_SVQ3 };
diff --git a/tests/checkasm/h264qpel.c b/tests/checkasm/h264qpel.c
index ba069f1259..e47d659929 100644
--- a/tests/checkasm/h264qpel.c
+++ b/tests/checkasm/h264qpel.c
@@ -24,6 +24,7 @@
#include "libavutil/common.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
static const uint32_t pixel_mask[3] = { 0xffffffff, 0x01ff01ff, 0x03ff03ff };
diff --git a/tests/checkasm/hevc_add_res.c b/tests/checkasm/hevc_add_res.c
index 0a3bcbb706..0c896adaca 100644
--- a/tests/checkasm/hevc_add_res.c
+++ b/tests/checkasm/hevc_add_res.c
@@ -21,6 +21,7 @@
#include <string.h>
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#include "libavcodec/hevcdsp.h"
diff --git a/tests/checkasm/hevc_idct.c b/tests/checkasm/hevc_idct.c
index c20111c2df..338b8a23e4 100644
--- a/tests/checkasm/hevc_idct.c
+++ b/tests/checkasm/hevc_idct.c
@@ -21,6 +21,7 @@
#include <string.h>
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#include "libavcodec/hevcdsp.h"
diff --git a/tests/checkasm/hevc_sao.c b/tests/checkasm/hevc_sao.c
index 8d0cf80774..6b750758e2 100644
--- a/tests/checkasm/hevc_sao.c
+++ b/tests/checkasm/hevc_sao.c
@@ -21,6 +21,7 @@
#include <string.h>
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#include "libavcodec/avcodec.h"
diff --git a/tests/checkasm/jpeg2000dsp.c b/tests/checkasm/jpeg2000dsp.c
index bce534dbaf..c9158ab3de 100644
--- a/tests/checkasm/jpeg2000dsp.c
+++ b/tests/checkasm/jpeg2000dsp.c
@@ -23,6 +23,7 @@
#include "libavutil/common.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#define BUF_SIZE 512
diff --git a/tests/checkasm/llviddspenc.c b/tests/checkasm/llviddspenc.c
index 31eafd5526..132f6d2771 100644
--- a/tests/checkasm/llviddspenc.c
+++ b/tests/checkasm/llviddspenc.c
@@ -23,6 +23,7 @@
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "libavcodec/lossless_videoencdsp.h"
diff --git a/tests/checkasm/opusdsp.c b/tests/checkasm/opusdsp.c
index 828ecf9ce2..34ee5a4edc 100644
--- a/tests/checkasm/opusdsp.c
+++ b/tests/checkasm/opusdsp.c
@@ -16,6 +16,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include "libavutil/mem_internal.h"
+
#include "libavcodec/opusdsp.h"
#include "checkasm.h"
diff --git a/tests/checkasm/pixblockdsp.c b/tests/checkasm/pixblockdsp.c
index 79ab156d45..9a7865aa5f 100644
--- a/tests/checkasm/pixblockdsp.c
+++ b/tests/checkasm/pixblockdsp.c
@@ -24,6 +24,7 @@
#include "libavutil/common.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#define BUF_UNITS 8
#define BUF_SIZE (BUF_UNITS * 128 + 8 * BUF_UNITS)
diff --git a/tests/checkasm/sbrdsp.c b/tests/checkasm/sbrdsp.c
index 516b9f0ec6..2fb14d5bf8 100644
--- a/tests/checkasm/sbrdsp.c
+++ b/tests/checkasm/sbrdsp.c
@@ -16,6 +16,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include "libavutil/mem_internal.h"
+
#include "libavcodec/sbrdsp.h"
#include <float.h>
diff --git a/tests/checkasm/sw_rgb.c b/tests/checkasm/sw_rgb.c
index e5aad20c6d..c29b75d09b 100644
--- a/tests/checkasm/sw_rgb.c
+++ b/tests/checkasm/sw_rgb.c
@@ -22,6 +22,7 @@
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "libswscale/rgb2rgb.h"
diff --git a/tests/checkasm/sw_scale.c b/tests/checkasm/sw_scale.c
index 9efa2b4def..8741b3943c 100644
--- a/tests/checkasm/sw_scale.c
+++ b/tests/checkasm/sw_scale.c
@@ -22,6 +22,7 @@
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
+#include "libavutil/mem_internal.h"
#include "libswscale/swscale.h"
#include "libswscale/swscale_internal.h"
diff --git a/tests/checkasm/synth_filter.c b/tests/checkasm/synth_filter.c
index 87e32ebc0e..9a0d746c96 100644
--- a/tests/checkasm/synth_filter.c
+++ b/tests/checkasm/synth_filter.c
@@ -25,6 +25,8 @@
#include "libavutil/internal.h"
#include "libavutil/intfloat.h"
+#include "libavutil/mem_internal.h"
+
#include "libavcodec/dcadata.h"
#include "libavcodec/synth_filter.h"
diff --git a/tests/checkasm/utvideodsp.c b/tests/checkasm/utvideodsp.c
index 080b4287d7..bdede6107b 100644
--- a/tests/checkasm/utvideodsp.c
+++ b/tests/checkasm/utvideodsp.c
@@ -24,6 +24,7 @@
#include "libavcodec/avcodec.h"
#include "libavcodec/utvideodsp.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#define WIDTH 240
#define HEIGHT 120
diff --git a/tests/checkasm/v210enc.c b/tests/checkasm/v210enc.c
index ed3677659d..c3d5cc5145 100644
--- a/tests/checkasm/v210enc.c
+++ b/tests/checkasm/v210enc.c
@@ -24,6 +24,7 @@
#include "libavutil/common.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#define BUF_SIZE 512
diff --git a/tests/checkasm/vf_colorspace.c b/tests/checkasm/vf_colorspace.c
index 10b7b83924..31efa671f9 100644
--- a/tests/checkasm/vf_colorspace.c
+++ b/tests/checkasm/vf_colorspace.c
@@ -24,6 +24,7 @@
#include "libavutil/common.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#define W 64
#define H 64
diff --git a/tests/checkasm/vf_eq.c b/tests/checkasm/vf_eq.c
index 48dccddf77..1315b08f0e 100644
--- a/tests/checkasm/vf_eq.c
+++ b/tests/checkasm/vf_eq.c
@@ -21,6 +21,7 @@
#include "libavfilter/avfilter.h"
#include "libavfilter/vf_eq.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#define WIDTH 256
#define HEIGHT 256
diff --git a/tests/checkasm/vf_hflip.c b/tests/checkasm/vf_hflip.c
index 2d6fdeca7b..a3b6e613d5 100644
--- a/tests/checkasm/vf_hflip.c
+++ b/tests/checkasm/vf_hflip.c
@@ -20,6 +20,7 @@
#include "checkasm.h"
#include "libavfilter/hflip.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#define WIDTH 256
#define WIDTH_PADDED 256 + 32
diff --git a/tests/checkasm/vf_threshold.c b/tests/checkasm/vf_threshold.c
index 5a2fc0e4ee..2c5cc807ee 100644
--- a/tests/checkasm/vf_threshold.c
+++ b/tests/checkasm/vf_threshold.c
@@ -20,6 +20,7 @@
#include "checkasm.h"
#include "libavfilter/threshold.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#define WIDTH 256
#define WIDTH_PADDED 256 + 32
diff --git a/tests/checkasm/videodsp.c b/tests/checkasm/videodsp.c
index 0a4424a28c..eb2845a7d9 100644
--- a/tests/checkasm/videodsp.c
+++ b/tests/checkasm/videodsp.c
@@ -23,6 +23,7 @@
#include "libavcodec/videodsp.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#define randomize_buffers(w, h) \
do { \
diff --git a/tests/checkasm/vp8dsp.c b/tests/checkasm/vp8dsp.c
index d93f73087f..c3af54fbfd 100644
--- a/tests/checkasm/vp8dsp.c
+++ b/tests/checkasm/vp8dsp.c
@@ -25,6 +25,7 @@
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#include "checkasm.h"
diff --git a/tests/checkasm/vp9dsp.c b/tests/checkasm/vp9dsp.c
index a91577b94e..99c023899f 100644
--- a/tests/checkasm/vp9dsp.c
+++ b/tests/checkasm/vp9dsp.c
@@ -27,6 +27,7 @@
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
+#include "libavutil/mem_internal.h"
static const uint32_t pixel_mask[3] = { 0xffffffff, 0x03ff03ff, 0x0fff0fff };
#define SIZEOF_PIXEL ((bit_depth + 7) / 8)
1
0
ffmpeg | branch: master | Paul B Mahol <onemda(a)gmail.com> | Sat Dec 26 13:52:24 2020 +0100| [54cd025a82fcee1813aba64de4d7a52d0b9b1e79] | committer: Paul B Mahol
avfilter: add temporal midway equalizer filter
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=54cd025a82fcee181…
---
Changelog | 1 +
doc/filters.texi | 22 +++
libavfilter/Makefile | 1 +
libavfilter/allfilters.c | 1 +
libavfilter/version.h | 2 +-
libavfilter/vf_tmidequalizer.c | 440 +++++++++++++++++++++++++++++++++++++++++
6 files changed, 466 insertions(+), 1 deletion(-)
diff --git a/Changelog b/Changelog
index 854e037a0d..dcb80e0ed9 100644
--- a/Changelog
+++ b/Changelog
@@ -54,6 +54,7 @@ version <next>:
- AV1 monochrome encoding support via libaom >= 2.0.1
- asuperpass and asuperstop filter
- shufflepixels filter
+- tmidequalizer filter
version 4.3:
diff --git a/doc/filters.texi b/doc/filters.texi
index 435575a5fb..01ae540c5c 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -19323,6 +19323,28 @@ minimum values, and @code{1} maximum values.
This filter supports all above options as @ref{commands}, excluding option @code{radius}.
+@section tmidequalizer
+
+Apply Temporal Midway Video Equalization effect.
+
+Midway Video Equalization adjusts a sequence of video frames to have the same
+histograms, while maintaining their dynamics as much as possible. It's
+useful for e.g. matching exposures from a video frames sequence.
+
+This filter accepts the following option:
+
+@table @option
+@item radius
+Set filtering radius. Default is @code{5}. Allowed range is from 1 to 127.
+
+@item sigma
+Set filtering sigma. Default is @code{0.5}. This controls strength of filtering.
+Setting this option to 0 effectively does nothing.
+
+@item planes
+Set which planes to process. Default is @code{15}, which is all available planes.
+@end table
+
@section tmix
Mix successive video frames.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 5b4831781f..526da8d69e 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -433,6 +433,7 @@ OBJS-$(CONFIG_TILE_FILTER) += vf_tile.o
OBJS-$(CONFIG_TINTERLACE_FILTER) += vf_tinterlace.o
OBJS-$(CONFIG_TLUT2_FILTER) += vf_lut2.o framesync.o
OBJS-$(CONFIG_TMEDIAN_FILTER) += vf_xmedian.o framesync.o
+OBJS-$(CONFIG_TMIDEQUALIZER_FILTER) += vf_tmidequalizer.o
OBJS-$(CONFIG_TMIX_FILTER) += vf_mix.o framesync.o
OBJS-$(CONFIG_TONEMAP_FILTER) += vf_tonemap.o colorspace.o
OBJS-$(CONFIG_TONEMAP_OPENCL_FILTER) += vf_tonemap_opencl.o colorspace.o opencl.o \
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 1b77bf1c81..ce317dfa1c 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -413,6 +413,7 @@ extern AVFilter ff_vf_tile;
extern AVFilter ff_vf_tinterlace;
extern AVFilter ff_vf_tlut2;
extern AVFilter ff_vf_tmedian;
+extern AVFilter ff_vf_tmidequalizer;
extern AVFilter ff_vf_tmix;
extern AVFilter ff_vf_tonemap;
extern AVFilter ff_vf_tonemap_opencl;
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 2e7449b74c..fbe2ed62b2 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 94
+#define LIBAVFILTER_VERSION_MINOR 95
#define LIBAVFILTER_VERSION_MICRO 100
diff --git a/libavfilter/vf_tmidequalizer.c b/libavfilter/vf_tmidequalizer.c
new file mode 100644
index 0000000000..6e3f3ccce1
--- /dev/null
+++ b/libavfilter/vf_tmidequalizer.c
@@ -0,0 +1,440 @@
+/*
+ * Copyright (c) 2020 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/imgutils.h"
+#include "libavutil/pixdesc.h"
+#include "libavutil/opt.h"
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
+
+typedef struct TMidEqualizerContext {
+ const AVClass *class;
+
+ int planes;
+ int radius;
+ float sigma;
+
+ int plane_width[4], plane_height[4];
+ int nb_frames;
+ int depth;
+ int f_frames;
+ int l_frames;
+ int del_frame;
+ int cur_frame;
+ int nb_planes;
+ int histogram_size;
+ float kernel[127];
+ float *histogram[4][256];
+ float *change[4];
+
+ AVFrame **frames;
+
+ void (*compute_histogram)(const uint8_t *ssrc, ptrdiff_t linesize,
+ int w, int h, float *histogram, size_t hsize);
+ void (*apply_contrast_change)(const uint8_t *src, ptrdiff_t src_linesize,
+ uint8_t *dst, ptrdiff_t dst_linesize,
+ int w, int h, float *change, float *orig);
+} TMidEqualizerContext;
+
+#define OFFSET(x) offsetof(TMidEqualizerContext, x)
+#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
+
+static const AVOption tmidequalizer_options[] = {
+ { "radius", "set radius", OFFSET(radius), AV_OPT_TYPE_INT, {.i64=5}, 1, 127, FLAGS },
+ { "sigma", "set sigma", OFFSET(sigma), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGS },
+ { "planes", "set planes", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=0xF}, 0, 0xF, FLAGS },
+ { NULL }
+};
+
+AVFILTER_DEFINE_CLASS(tmidequalizer);
+
+static int query_formats(AVFilterContext *ctx)
+{
+ static const enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV440P,
+ AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P,
+ AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ420P,
+ AV_PIX_FMT_YUVJ411P, AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P,
+ AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP,
+ AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY9, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, AV_PIX_FMT_GRAY14,
+ 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_YUV420P12, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV444P12,
+ AV_PIX_FMT_YUV420P14, AV_PIX_FMT_YUV422P14, AV_PIX_FMT_YUV444P14,
+ AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14,
+ AV_PIX_FMT_YUVA420P9, AV_PIX_FMT_YUVA422P9, AV_PIX_FMT_YUVA444P9,
+ AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA422P10, AV_PIX_FMT_YUVA444P10,
+ AV_PIX_FMT_YUVA422P12, AV_PIX_FMT_YUVA444P12,
+ AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12,
+ AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, AV_PIX_FMT_YUV444P16,
+ AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16,
+ AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16,
+ AV_PIX_FMT_GRAY16,
+ AV_PIX_FMT_NONE
+ };
+
+ return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
+}
+
+static void compute_contrast_function(const float *const histograms[256],
+ const float *const kernel,
+ int nb_frames, int radius, int hsize,
+ float *f, int idx)
+{
+ const float *const h1 = histograms[idx];
+ int p2[256] = { 0 };
+
+ for (int p1 = 0; p1 < hsize; p1++) {
+ float weight = 1.f;
+ float sum = p1 * weight;
+
+ for (int j = 0; j < radius; j++) {
+ const int nidx = ((idx - radius + j) % nb_frames);
+ const float *const h2 = histograms[nidx < 0 ? nidx + nb_frames: nidx];
+ int k = j;
+
+ for (; p2[k] < hsize && h2[p2[k]] < h1[p1]; p2[k]++);
+ if (p2[k] == hsize)
+ p2[k]--;
+
+ weight += kernel[j];
+ sum += kernel[j] * p2[k];
+ }
+
+ for (int j = radius + 1; j < nb_frames; j++) {
+ const int nidx = (idx - radius + j) % nb_frames;
+ const float *const h2 = histograms[nidx < 0 ? nidx + nb_frames: nidx];
+ int k = j;
+
+ for (; p2[k] < hsize && h2[p2[k]] < h1[p1]; p2[k]++);
+ if (p2[k] == hsize)
+ p2[k]--;
+
+ weight += kernel[j - radius - 1];
+ sum += kernel[j - radius - 1] * p2[k];
+ }
+
+ f[p1] = sum / weight;
+ }
+}
+
+static void apply_contrast_change8(const uint8_t *src, ptrdiff_t src_linesize,
+ uint8_t *dst, ptrdiff_t dst_linesize,
+ int w, int h, float *change, float *orig)
+{
+ for (int y = 0; y < h; y++) {
+ for (int x = 0; x < w; x++)
+ dst[x] = lrintf(change[src[x]]);
+
+ dst += dst_linesize;
+ src += src_linesize;
+ }
+}
+
+static void apply_contrast_change16(const uint8_t *ssrc, ptrdiff_t src_linesize,
+ uint8_t *ddst, ptrdiff_t dst_linesize,
+ int w, int h, float *change, float *orig)
+{
+ const uint16_t *src = (const uint16_t *)ssrc;
+ uint16_t *dst = (uint16_t *)ddst;
+
+ for (int y = 0; y < h; y++) {
+ for (int x = 0; x < w; x++)
+ dst[x] = lrintf(change[src[x]]);
+
+ dst += dst_linesize / 2;
+ src += src_linesize / 2;
+ }
+}
+
+static int filter_frame(AVFilterLink *inlink, AVFrame *in)
+{
+ AVFilterContext *ctx = inlink->dst;
+ TMidEqualizerContext *s = ctx->priv;
+ AVFilterLink *outlink = ctx->outputs[0];
+ AVFrame *out;
+ int eof = 0;
+
+ if (!in) {
+ int idx = s->f_frames < s->nb_frames ? s->radius : s->del_frame ? s->del_frame - 1 : s->nb_frames - 1;
+
+ if (s->f_frames < s->nb_frames) {
+ s->l_frames = s->nb_frames - s->f_frames;
+ } else {
+ s->l_frames++;
+ }
+ in = av_frame_clone(s->frames[idx]);
+ if (!in)
+ return AVERROR(ENOMEM);
+ eof = 1;
+ }
+
+ if (s->f_frames < s->nb_frames) {
+ s->frames[s->f_frames] = in;
+
+ for (int p = 0; p < s->nb_planes; p++) {
+ s->compute_histogram(in->data[p], in->linesize[p],
+ s->plane_width[p], s->plane_height[p],
+ s->histogram[p][s->f_frames],
+ s->histogram_size);
+ }
+
+ s->f_frames++;
+
+ while (s->f_frames <= s->radius) {
+ s->frames[s->f_frames] = av_frame_clone(in);
+ if (!s->frames[s->f_frames])
+ return AVERROR(ENOMEM);
+ for (int p = 0; p < s->nb_planes; p++) {
+ memcpy(s->histogram[p][s->f_frames],
+ s->histogram[p][s->f_frames - 1],
+ s->histogram_size * sizeof(float));
+ }
+ s->f_frames++;
+ }
+
+ if (!eof && s->f_frames < s->nb_frames) {
+ return 0;
+ } else {
+ while (s->f_frames < s->nb_frames) {
+ s->frames[s->f_frames] = av_frame_clone(in);
+ if (!s->frames[s->f_frames])
+ return AVERROR(ENOMEM);
+ for (int p = 0; p < s->nb_planes; p++) {
+ memcpy(s->histogram[p][s->f_frames],
+ s->histogram[p][s->f_frames - 1],
+ s->histogram_size * sizeof(float));
+ }
+ s->f_frames++;
+ }
+ }
+ s->cur_frame = s->radius;
+ s->del_frame = 0;
+ } else {
+ av_frame_free(&s->frames[s->del_frame]);
+ s->frames[s->del_frame] = in;
+
+ for (int p = 0; p < s->nb_planes; p++) {
+ s->compute_histogram(in->data[p], in->linesize[p],
+ s->plane_width[p], s->plane_height[p],
+ s->histogram[p][s->del_frame],
+ s->histogram_size);
+ }
+
+ s->del_frame++;
+ if (s->del_frame >= s->nb_frames)
+ s->del_frame = 0;
+ }
+
+ if (ctx->is_disabled) {
+ const int idx = s->cur_frame;
+
+ out = av_frame_clone(s->frames[idx]);
+ if (!out)
+ return AVERROR(ENOMEM);
+ } else {
+ const int idx = s->cur_frame;
+
+ in = s->frames[idx];
+ out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
+ if (!out)
+ return AVERROR(ENOMEM);
+ av_frame_copy_props(out, in);
+
+ for (int p = 0; p < s->nb_planes; p++) {
+ if (!((1 << p) & s->planes)) {
+ av_image_copy_plane(out->data[p], out->linesize[p], in->data[p], in->linesize[p],
+ s->plane_width[p] * (1 + (s->depth > 8)), s->plane_height[p]);
+ continue;
+ }
+
+ compute_contrast_function((const float *const *)s->histogram[p], s->kernel,
+ s->nb_frames, s->radius, s->histogram_size, s->change[p], idx);
+
+ s->apply_contrast_change(in->data[p], in->linesize[p],
+ out->data[p], out->linesize[p],
+ s->plane_width[p], s->plane_height[p],
+ s->change[p], s->histogram[p][idx]);
+ }
+ }
+
+ s->cur_frame++;
+ if (s->cur_frame >= s->nb_frames)
+ s->cur_frame = 0;
+
+ return ff_filter_frame(outlink, out);
+}
+
+static void compute_histogram8(const uint8_t *src, ptrdiff_t linesize,
+ int w, int h, float *histogram, size_t hsize)
+{
+ memset(histogram, 0, hsize * sizeof(*histogram));
+
+ for (int y = 0; y < h; y++) {
+ for (int x = 0; x < w; x++)
+ histogram[src[x]] += 1;
+ src += linesize;
+ }
+
+ for (int x = 0; x < hsize; x++)
+ histogram[x] /= hsize;
+
+ for (int x = 1; x < hsize; x++)
+ histogram[x] += histogram[x-1];
+}
+
+static void compute_histogram16(const uint8_t *ssrc, ptrdiff_t linesize,
+ int w, int h, float *histogram, size_t hsize)
+{
+ const uint16_t *src = (const uint16_t *)ssrc;
+
+ memset(histogram, 0, hsize * sizeof(*histogram));
+
+ for (int y = 0; y < h; y++) {
+ for (int x = 0; x < w; x++)
+ histogram[src[x]] += 1;
+ src += linesize / 2;
+ }
+
+ for (int x = 0; x < hsize; x++)
+ histogram[x] /= hsize;
+
+ for (int x = 1; x < hsize; x++)
+ histogram[x] += histogram[x-1];
+}
+
+static int config_input(AVFilterLink *inlink)
+{
+ AVFilterContext *ctx = inlink->dst;
+ TMidEqualizerContext *s = ctx->priv;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
+ float sigma = s->radius * s->sigma;
+ int vsub, hsub;
+
+ s->depth = desc->comp[0].depth;
+ s->nb_frames = s->radius * 2 + 1;
+ s->nb_planes = av_pix_fmt_count_planes(inlink->format);
+
+ hsub = desc->log2_chroma_w;
+ vsub = desc->log2_chroma_h;
+
+ s->plane_height[0] = s->plane_height[3] = inlink->h;
+ s->plane_width[0] = s->plane_width[3] = inlink->w;
+ s->plane_height[1] = s->plane_height[2] = AV_CEIL_RSHIFT(inlink->h, vsub);
+ s->plane_width[1] = s->plane_width[2] = AV_CEIL_RSHIFT(inlink->w, hsub);
+
+ s->histogram_size = 1 << s->depth;
+
+ for (int n = 0; n < s->radius; n++)
+ s->kernel[n] = expf(-0.5 * (n + 1) * (n + 1) / (sigma * sigma));
+
+ for (int p = 0; p < s->nb_planes; p++) {
+ for (int n = 0; n < s->nb_frames; n++) {
+ s->histogram[p][n] = av_calloc(s->histogram_size, sizeof(float));
+ if (!s->histogram[p][n])
+ return AVERROR(ENOMEM);
+ }
+
+ s->change[p] = av_calloc(s->histogram_size, sizeof(float));
+ if (!s->change[p])
+ return AVERROR(ENOMEM);
+ }
+
+ if (!s->frames)
+ s->frames = av_calloc(s->nb_frames, sizeof(*s->frames));
+ if (!s->frames)
+ return AVERROR(ENOMEM);
+
+ s->compute_histogram = s->depth <= 8 ? compute_histogram8 : compute_histogram16;
+ s->apply_contrast_change = s->depth <= 8 ? apply_contrast_change8 : apply_contrast_change16;
+
+ return 0;
+}
+
+static int request_frame(AVFilterLink *outlink)
+{
+ AVFilterContext *ctx = outlink->src;
+ TMidEqualizerContext *s = ctx->priv;
+ int ret;
+
+ ret = ff_request_frame(ctx->inputs[0]);
+ if (ret == AVERROR_EOF && s->l_frames < s->radius) {
+ ret = filter_frame(ctx->inputs[0], NULL);
+ }
+
+ return ret;
+}
+
+static void free_histograms(AVFilterContext *ctx, int x, int nb_frames)
+{
+ TMidEqualizerContext *s = ctx->priv;
+
+ for (int n = 0; n < nb_frames; n++)
+ av_freep(&s->histogram[x][n]);
+ av_freep(&s->change[x]);
+}
+
+static av_cold void uninit(AVFilterContext *ctx)
+{
+ TMidEqualizerContext *s = ctx->priv;
+
+ free_histograms(ctx, 0, s->nb_frames);
+ free_histograms(ctx, 1, s->nb_frames);
+ free_histograms(ctx, 2, s->nb_frames);
+ free_histograms(ctx, 3, s->nb_frames);
+
+ for (int i = 0; i < s->nb_frames && s->frames; i++)
+ av_frame_free(&s->frames[i]);
+ av_freep(&s->frames);
+}
+
+static const AVFilterPad tmidequalizer_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .config_props = config_input,
+ .filter_frame = filter_frame,
+ },
+ { NULL }
+};
+
+static const AVFilterPad tmidequalizer_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .request_frame = request_frame,
+ },
+ { NULL }
+};
+
+AVFilter ff_vf_tmidequalizer = {
+ .name = "tmidequalizer",
+ .description = NULL_IF_CONFIG_SMALL("Apply Temporal Midway Equalization."),
+ .priv_size = sizeof(TMidEqualizerContext),
+ .uninit = uninit,
+ .query_formats = query_formats,
+ .inputs = tmidequalizer_inputs,
+ .outputs = tmidequalizer_outputs,
+ .priv_class = &tmidequalizer_class,
+ .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL,
+};
1
0