diff mbox series

[FFmpeg-devel,1/4] Remove unnecessary mem.h inclusions

Message ID 20210203102749.473999-1-andreas.rheinhardt@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel,1/4] Remove unnecessary mem.h inclusions | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Feb. 3, 2021, 10:27 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 fftools/ffmpeg_qsv.c                        | 1 -
 libavcodec/aactab.c                         | 1 -
 libavcodec/arbc.c                           | 1 -
 libavcodec/argo.c                           | 1 -
 libavcodec/dcadsp.c                         | 1 -
 libavcodec/dss_sp.c                         | 1 -
 libavcodec/dvbsub_parser.c                  | 1 -
 libavcodec/h264_redundant_pps_bsf.c         | 1 -
 libavcodec/libvo-amrwbenc.c                 | 1 -
 libavcodec/mpegaudiodsp_template.c          | 1 -
 libavcodec/opustab.h                        | 2 --
 libavcodec/rl.c                             | 1 -
 libavcodec/snappy.c                         | 2 --
 libavcodec/truemotion2rt.c                  | 1 -
 libavcodec/v210dec.c                        | 1 -
 libavcodec/v210x.c                          | 1 -
 libavcodec/x86/ac3dsp_init.c                | 1 -
 libavcodec/x86/lpc.c                        | 2 +-
 libavcodec/x86/rv40dsp_init.c               | 1 -
 libavcodec/x86/vc1dsp_mmx.c                 | 1 -
 libavcodec/x86/videodsp_init.c              | 1 -
 libavcodec/x86/vp8dsp_init.c                | 1 -
 libavcodec/x86/vp9dsp_init.c                | 1 -
 libavcodec/x86/vp9dsp_init_16bpp_template.c | 1 -
 libavdevice/fbdev_dec.c                     | 1 -
 libavdevice/fbdev_enc.c                     | 1 -
 libavdevice/libcdio.c                       | 1 -
 libavfilter/boxblur.h                       | 1 -
 libavfilter/drawutils.c                     | 1 -
 libavfilter/vf_deinterlace_vaapi.c          | 1 -
 libavfilter/vf_misc_vaapi.c                 | 1 -
 libavfilter/vf_neighbor_opencl.c            | 1 -
 libavfilter/vf_overlay_cuda.c               | 1 -
 libavfilter/vf_overlay_opencl.c             | 1 -
 libavfilter/vf_procamp_vaapi.c              | 1 -
 libavfilter/vf_scale_vaapi.c                | 1 -
 libavfilter/vf_tonemap_opencl.c             | 1 -
 libavfilter/vf_tonemap_vaapi.c              | 1 -
 libavfilter/vf_transpose_opencl.c           | 1 -
 libavfilter/vf_transpose_vaapi.c            | 1 -
 libavfilter/vf_xfade_opencl.c               | 1 -
 libavfilter/video.c                         | 1 -
 libavfilter/x86/vf_atadenoise_init.c        | 1 -
 libavfilter/x86/vf_bwdif_init.c             | 1 -
 libavfilter/x86/vf_eq_init.c                | 1 -
 libavfilter/x86/vf_gradfun_init.c           | 1 -
 libavfilter/x86/vf_idet_init.c              | 1 -
 libavfilter/x86/vf_maskedclamp_init.c       | 1 -
 libavfilter/x86/vf_transpose_init.c         | 1 -
 libavfilter/x86/vf_w3fdif_init.c            | 1 -
 libavfilter/x86/vf_yadif_init.c             | 1 -
 libavformat/replaygain.c                    | 1 -
 libavutil/avsscanf.c                        | 1 -
 libavutil/tests/aes_ctr.c                   | 1 -
 libavutil/tx_priv.h                         | 1 -
 tests/checkasm/llviddspenc.c                | 1 -
 tests/checkasm/sw_rgb.c                     | 1 -
 tests/checkasm/sw_scale.c                   | 1 -
 tools/ffhash.c                              | 1 -
 59 files changed, 1 insertion(+), 61 deletions(-)

Comments

Michael Niedermayer Feb. 3, 2021, 11:31 p.m. UTC | #1
On Wed, Feb 03, 2021 at 11:27:46AM +0100, Andreas Rheinhardt wrote:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  fftools/ffmpeg_qsv.c                        | 1 -
>  libavcodec/aactab.c                         | 1 -
>  libavcodec/arbc.c                           | 1 -
>  libavcodec/argo.c                           | 1 -
>  libavcodec/dcadsp.c                         | 1 -
>  libavcodec/dss_sp.c                         | 1 -
>  libavcodec/dvbsub_parser.c                  | 1 -
>  libavcodec/h264_redundant_pps_bsf.c         | 1 -
>  libavcodec/libvo-amrwbenc.c                 | 1 -
>  libavcodec/mpegaudiodsp_template.c          | 1 -
>  libavcodec/opustab.h                        | 2 --
>  libavcodec/rl.c                             | 1 -
>  libavcodec/snappy.c                         | 2 --
>  libavcodec/truemotion2rt.c                  | 1 -
>  libavcodec/v210dec.c                        | 1 -
>  libavcodec/v210x.c                          | 1 -
>  libavcodec/x86/ac3dsp_init.c                | 1 -
>  libavcodec/x86/lpc.c                        | 2 +-
>  libavcodec/x86/rv40dsp_init.c               | 1 -
>  libavcodec/x86/vc1dsp_mmx.c                 | 1 -
>  libavcodec/x86/videodsp_init.c              | 1 -
>  libavcodec/x86/vp8dsp_init.c                | 1 -
>  libavcodec/x86/vp9dsp_init.c                | 1 -
>  libavcodec/x86/vp9dsp_init_16bpp_template.c | 1 -
>  libavdevice/fbdev_dec.c                     | 1 -
>  libavdevice/fbdev_enc.c                     | 1 -
>  libavdevice/libcdio.c                       | 1 -
>  libavfilter/boxblur.h                       | 1 -
>  libavfilter/drawutils.c                     | 1 -
>  libavfilter/vf_deinterlace_vaapi.c          | 1 -
>  libavfilter/vf_misc_vaapi.c                 | 1 -
>  libavfilter/vf_neighbor_opencl.c            | 1 -
>  libavfilter/vf_overlay_cuda.c               | 1 -
>  libavfilter/vf_overlay_opencl.c             | 1 -
>  libavfilter/vf_procamp_vaapi.c              | 1 -
>  libavfilter/vf_scale_vaapi.c                | 1 -
>  libavfilter/vf_tonemap_opencl.c             | 1 -
>  libavfilter/vf_tonemap_vaapi.c              | 1 -
>  libavfilter/vf_transpose_opencl.c           | 1 -
>  libavfilter/vf_transpose_vaapi.c            | 1 -
>  libavfilter/vf_xfade_opencl.c               | 1 -
>  libavfilter/video.c                         | 1 -
>  libavfilter/x86/vf_atadenoise_init.c        | 1 -
>  libavfilter/x86/vf_bwdif_init.c             | 1 -
>  libavfilter/x86/vf_eq_init.c                | 1 -
>  libavfilter/x86/vf_gradfun_init.c           | 1 -
>  libavfilter/x86/vf_idet_init.c              | 1 -
>  libavfilter/x86/vf_maskedclamp_init.c       | 1 -
>  libavfilter/x86/vf_transpose_init.c         | 1 -
>  libavfilter/x86/vf_w3fdif_init.c            | 1 -
>  libavfilter/x86/vf_yadif_init.c             | 1 -
>  libavformat/replaygain.c                    | 1 -
>  libavutil/avsscanf.c                        | 1 -
>  libavutil/tests/aes_ctr.c                   | 1 -
>  libavutil/tx_priv.h                         | 1 -
>  tests/checkasm/llviddspenc.c                | 1 -
>  tests/checkasm/sw_rgb.c                     | 1 -
>  tests/checkasm/sw_scale.c                   | 1 -
>  tools/ffhash.c                              | 1 -
>  59 files changed, 1 insertion(+), 61 deletions(-)

breaks build on arm

make -j32 tools/ffhash.o 

WARNING: src/libavformat/allformats.c src/libavcodec/parsers.c newer than config.h, rerun configure

CC	tools/ffhash.o
src/tools/ffhash.c: In function ‘check’:
src/tools/ffhash.c:87:63: error: implicit declaration of function ‘strerror’; did you mean ‘perror’? [-Werror=implicit-function-declaration]
         printf("%s=OPEN-FAILED: %s:", av_hash_get_name(hash), strerror(errno));
                                                               ^~~~~~~~
                                                               perror
src/tools/ffhash.c:87:34: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat=]
         printf("%s=OPEN-FAILED: %s:", av_hash_get_name(hash), strerror(errno));
                                 ~^                            ~~~~~~~~~~~~~~~
                                 %d
src/tools/ffhash.c:99:36: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=]
             printf("+READ-FAILED: %s", strerror(err));
                                   ~^   ~~~~~~~~~~~~~
                                   %d
src/tools/ffhash.c: In function ‘main’:
src/tools/ffhash.c:136:22: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=]
             printf("%s\n", strerror(errno));
                     ~^     ~~~~~~~~~~~~~~~
                     %d
cc1: some warnings being treated as errors
src/ffbuild/common.mak:67: recipe for target 'tools/ffhash.o' failed
make: *** [tools/ffhash.o] Error 1


[...]
Andreas Rheinhardt Feb. 4, 2021, 12:05 a.m. UTC | #2
Michael Niedermayer:
> On Wed, Feb 03, 2021 at 11:27:46AM +0100, Andreas Rheinhardt wrote:
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
>> ---
>>  fftools/ffmpeg_qsv.c                        | 1 -
>>  libavcodec/aactab.c                         | 1 -
>>  libavcodec/arbc.c                           | 1 -
>>  libavcodec/argo.c                           | 1 -
>>  libavcodec/dcadsp.c                         | 1 -
>>  libavcodec/dss_sp.c                         | 1 -
>>  libavcodec/dvbsub_parser.c                  | 1 -
>>  libavcodec/h264_redundant_pps_bsf.c         | 1 -
>>  libavcodec/libvo-amrwbenc.c                 | 1 -
>>  libavcodec/mpegaudiodsp_template.c          | 1 -
>>  libavcodec/opustab.h                        | 2 --
>>  libavcodec/rl.c                             | 1 -
>>  libavcodec/snappy.c                         | 2 --
>>  libavcodec/truemotion2rt.c                  | 1 -
>>  libavcodec/v210dec.c                        | 1 -
>>  libavcodec/v210x.c                          | 1 -
>>  libavcodec/x86/ac3dsp_init.c                | 1 -
>>  libavcodec/x86/lpc.c                        | 2 +-
>>  libavcodec/x86/rv40dsp_init.c               | 1 -
>>  libavcodec/x86/vc1dsp_mmx.c                 | 1 -
>>  libavcodec/x86/videodsp_init.c              | 1 -
>>  libavcodec/x86/vp8dsp_init.c                | 1 -
>>  libavcodec/x86/vp9dsp_init.c                | 1 -
>>  libavcodec/x86/vp9dsp_init_16bpp_template.c | 1 -
>>  libavdevice/fbdev_dec.c                     | 1 -
>>  libavdevice/fbdev_enc.c                     | 1 -
>>  libavdevice/libcdio.c                       | 1 -
>>  libavfilter/boxblur.h                       | 1 -
>>  libavfilter/drawutils.c                     | 1 -
>>  libavfilter/vf_deinterlace_vaapi.c          | 1 -
>>  libavfilter/vf_misc_vaapi.c                 | 1 -
>>  libavfilter/vf_neighbor_opencl.c            | 1 -
>>  libavfilter/vf_overlay_cuda.c               | 1 -
>>  libavfilter/vf_overlay_opencl.c             | 1 -
>>  libavfilter/vf_procamp_vaapi.c              | 1 -
>>  libavfilter/vf_scale_vaapi.c                | 1 -
>>  libavfilter/vf_tonemap_opencl.c             | 1 -
>>  libavfilter/vf_tonemap_vaapi.c              | 1 -
>>  libavfilter/vf_transpose_opencl.c           | 1 -
>>  libavfilter/vf_transpose_vaapi.c            | 1 -
>>  libavfilter/vf_xfade_opencl.c               | 1 -
>>  libavfilter/video.c                         | 1 -
>>  libavfilter/x86/vf_atadenoise_init.c        | 1 -
>>  libavfilter/x86/vf_bwdif_init.c             | 1 -
>>  libavfilter/x86/vf_eq_init.c                | 1 -
>>  libavfilter/x86/vf_gradfun_init.c           | 1 -
>>  libavfilter/x86/vf_idet_init.c              | 1 -
>>  libavfilter/x86/vf_maskedclamp_init.c       | 1 -
>>  libavfilter/x86/vf_transpose_init.c         | 1 -
>>  libavfilter/x86/vf_w3fdif_init.c            | 1 -
>>  libavfilter/x86/vf_yadif_init.c             | 1 -
>>  libavformat/replaygain.c                    | 1 -
>>  libavutil/avsscanf.c                        | 1 -
>>  libavutil/tests/aes_ctr.c                   | 1 -
>>  libavutil/tx_priv.h                         | 1 -
>>  tests/checkasm/llviddspenc.c                | 1 -
>>  tests/checkasm/sw_rgb.c                     | 1 -
>>  tests/checkasm/sw_scale.c                   | 1 -
>>  tools/ffhash.c                              | 1 -
>>  59 files changed, 1 insertion(+), 61 deletions(-)
> 
> breaks build on arm
> 
> make -j32 tools/ffhash.o 
> 
> WARNING: src/libavformat/allformats.c src/libavcodec/parsers.c newer than config.h, rerun configure
> 
> CC	tools/ffhash.o
> src/tools/ffhash.c: In function ‘check’:
> src/tools/ffhash.c:87:63: error: implicit declaration of function ‘strerror’; did you mean ‘perror’? [-Werror=implicit-function-declaration]
>          printf("%s=OPEN-FAILED: %s:", av_hash_get_name(hash), strerror(errno));
>                                                                ^~~~~~~~
>                                                                perror
> src/tools/ffhash.c:87:34: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat=]
>          printf("%s=OPEN-FAILED: %s:", av_hash_get_name(hash), strerror(errno));
>                                  ~^                            ~~~~~~~~~~~~~~~
>                                  %d
> src/tools/ffhash.c:99:36: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=]
>              printf("+READ-FAILED: %s", strerror(err));
>                                    ~^   ~~~~~~~~~~~~~
>                                    %d
> src/tools/ffhash.c: In function ‘main’:
> src/tools/ffhash.c:136:22: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=]
>              printf("%s\n", strerror(errno));
>                      ~^     ~~~~~~~~~~~~~~~
>                      %d
> cc1: some warnings being treated as errors
> src/ffbuild/common.mak:67: recipe for target 'tools/ffhash.o' failed
> make: *** [tools/ffhash.o] Error 1
> 
> 
Thanks for the report. I have only checked for whether the relevant
translation unit uses any of the alloc/free functions (because
DECLARE_ALIGNED is already provided by mem_internal.h), but I have not
taken into account stuff that is included by the headers included by
mem.h. In this case, one needs string.h (which is included in
libavutil/common.h which in turn is included in avutil.h which is
included in mem.h). Will look over everything again.

- Andreas

PS: It actually seems that the only thing provided by avutil.h that
mem.h uses is size_t. Do we allow to remove included headers from
installed headers at major version bumps?
Anton Khirnov Feb. 4, 2021, 10:34 a.m. UTC | #3
Quoting Andreas Rheinhardt (2021-02-04 01:05:05)
> Thanks for the report. I have only checked for whether the relevant
> translation unit uses any of the alloc/free functions (because
> DECLARE_ALIGNED is already provided by mem_internal.h), but I have not
> taken into account stuff that is included by the headers included by
> mem.h. In this case, one needs string.h (which is included in
> libavutil/common.h which in turn is included in avutil.h which is
> included in mem.h). Will look over everything again.
> 
> - Andreas
> 
> PS: It actually seems that the only thing provided by avutil.h that
> mem.h uses is size_t. Do we allow to remove included headers from
> installed headers at major version bumps?

I would say yes, IIRC it has happened before.
Certainly nobody should depend on our headers to provide any random
system headers.
Andreas Rheinhardt Feb. 4, 2021, 11:06 a.m. UTC | #4
Anton Khirnov:
> Quoting Andreas Rheinhardt (2021-02-04 01:05:05)
>> Thanks for the report. I have only checked for whether the relevant
>> translation unit uses any of the alloc/free functions (because
>> DECLARE_ALIGNED is already provided by mem_internal.h), but I have not
>> taken into account stuff that is included by the headers included by
>> mem.h. In this case, one needs string.h (which is included in
>> libavutil/common.h which in turn is included in avutil.h which is
>> included in mem.h). Will look over everything again.
>>
>> - Andreas
>>
>> PS: It actually seems that the only thing provided by avutil.h that
>> mem.h uses is size_t. Do we allow to remove included headers from
>> installed headers at major version bumps?
> 
> I would say yes, IIRC it has happened before.
> Certainly nobody should depend on our headers to provide any random
> system headers.
> 
Removing avutil.h affects not only system headers, but which of our
headers are included as it includes
#include "common.h"
#include "error.h"
#include "rational.h"
#include "version.h"
#include "macros.h"
#include "mathematics.h"
#include "log.h"
#include "pixfmt.h"
(And removing avutil.h will also remove avutil.h, of course.)

Other installed headers include too much, too: audio_fifo.h includes
avutil.h and fifo.h, but needs only attributes.h; eval.h unnecessarily
includes avutil.h; display.h includes common.h without needing it.
fifo.h includes avutil.h and attributes.h, but needs only stddef.h.
Several other headers include version.h despite the relevant FF_API
check for which it has been included no longer existing. (If we don't
remove version.h, sooner or later all headers will contain it.)

And while I played around a bit with this night, I found something odd:
libavutil/error.h is broken: It relies on MKTAG without providing the
header for it. MKTAG is in common.h which also includes mem.h which uses
an AVERROR code in an inline function. So the simple solution of
including common.h at the beginning of error.h doesn't work, as
AVERROR(EINVAL) will still be undefined in said function. I see two
other solutions: Move MKTAG (and probably a bit other stuff) to a new
header and include that in error.h; include common.h, but not at the
beginning of error.h, but only after the definition of AVERROR. Given
that I dislike monster headers like common.h, I prefer the first approach.
(I already mentioned this on IRC, but those who only follow the ML
should be informed, too.)

- Andreas
Anton Khirnov Feb. 4, 2021, 2:33 p.m. UTC | #5
Quoting Andreas Rheinhardt (2021-02-04 12:06:15)
> Anton Khirnov:
> > Quoting Andreas Rheinhardt (2021-02-04 01:05:05)
> >> Thanks for the report. I have only checked for whether the relevant
> >> translation unit uses any of the alloc/free functions (because
> >> DECLARE_ALIGNED is already provided by mem_internal.h), but I have not
> >> taken into account stuff that is included by the headers included by
> >> mem.h. In this case, one needs string.h (which is included in
> >> libavutil/common.h which in turn is included in avutil.h which is
> >> included in mem.h). Will look over everything again.
> >>
> >> - Andreas
> >>
> >> PS: It actually seems that the only thing provided by avutil.h that
> >> mem.h uses is size_t. Do we allow to remove included headers from
> >> installed headers at major version bumps?
> > 
> > I would say yes, IIRC it has happened before.
> > Certainly nobody should depend on our headers to provide any random
> > system headers.
> > 
> Removing avutil.h affects not only system headers, but which of our
> headers are included as it includes
> #include "common.h"
> #include "error.h"
> #include "rational.h"
> #include "version.h"
> #include "macros.h"
> #include "mathematics.h"
> #include "log.h"
> #include "pixfmt.h"
> (And removing avutil.h will also remove avutil.h, of course.)
> 
> Other installed headers include too much, too: audio_fifo.h includes
> avutil.h and fifo.h, but needs only attributes.h; eval.h unnecessarily
> includes avutil.h; display.h includes common.h without needing it.
> fifo.h includes avutil.h and attributes.h, but needs only stddef.h.
> Several other headers include version.h despite the relevant FF_API
> check for which it has been included no longer existing. (If we don't
> remove version.h, sooner or later all headers will contain it.)

I don't think we have an official project policy on this, but I would
be in favor of something like:

    All installed headers are only guaranteed to provide those
    identifiers that are explicitly declared in them. Users must not
    rely on an installed header #include'ing any other specific headers,
    as those can change at any time.

+exceptions for av*.h, but ideally I'd remove those too in the long
run - people should just include what they need and avoid monsterheaders

> 
> And while I played around a bit with this night, I found something odd:
> libavutil/error.h is broken: It relies on MKTAG without providing the
> header for it. MKTAG is in common.h which also includes mem.h which uses
> an AVERROR code in an inline function. So the simple solution of
> including common.h at the beginning of error.h doesn't work, as
> AVERROR(EINVAL) will still be undefined in said function. I see two
> other solutions: Move MKTAG (and probably a bit other stuff) to a new
> header and include that in error.h; include common.h, but not at the
> beginning of error.h, but only after the definition of AVERROR. Given
> that I dislike monster headers like common.h, I prefer the first approach.
> (I already mentioned this on IRC, but those who only follow the ML
> should be informed, too.)

I am in favor of moving MKTAG if you can think of a good place for it.
(also it should be properly namespaced, but not necessarily now)
Nicolas George Feb. 4, 2021, 2:48 p.m. UTC | #6
Anton Khirnov (12021-02-04):
> I don't think we have an official project policy on this, but I would
> be in favor of something like:
> 
>     All installed headers are only guaranteed to provide those
>     identifiers that are explicitly declared in them. Users must not
>     rely on an installed header #include'ing any other specific headers,
>     as those can change at any time.

That would probably be ok, but I would suggest to add:

... explicitly declared or used in them.

If a function argument is size_t or int64_t, then we can expect size_t
or int64_t to be defined.

Regards,
Anton Khirnov Feb. 4, 2021, 4:17 p.m. UTC | #7
Quoting Nicolas George (2021-02-04 15:48:03)
> Anton Khirnov (12021-02-04):
> > I don't think we have an official project policy on this, but I would
> > be in favor of something like:
> > 
> >     All installed headers are only guaranteed to provide those
> >     identifiers that are explicitly declared in them. Users must not
> >     rely on an installed header #include'ing any other specific headers,
> >     as those can change at any time.
> 
> That would probably be ok, but I would suggest to add:
> 
> ... explicitly declared or used in them.
> 
> If a function argument is size_t or int64_t, then we can expect size_t
> or int64_t to be defined.

That leads to undesirable situations, such as:
- header avfoo.h declares 'int64_t av_foo(void);'
- people start using av_foo() in their code, but do not include
  <stdint.h> because avfoo.h includes it for them
- at some later point av_foo() is deprecated and removed
- everyone depends on avfoo.h to provide int64_t, even though avfoo.h
  does not use it anymore
Andreas Rheinhardt Feb. 9, 2021, 7:56 a.m. UTC | #8
Anton Khirnov:
> Quoting Andreas Rheinhardt (2021-02-04 12:06:15)
>> Anton Khirnov:
>>> Quoting Andreas Rheinhardt (2021-02-04 01:05:05)
>>>> Thanks for the report. I have only checked for whether the relevant
>>>> translation unit uses any of the alloc/free functions (because
>>>> DECLARE_ALIGNED is already provided by mem_internal.h), but I have not
>>>> taken into account stuff that is included by the headers included by
>>>> mem.h. In this case, one needs string.h (which is included in
>>>> libavutil/common.h which in turn is included in avutil.h which is
>>>> included in mem.h). Will look over everything again.
>>>>
>>>> - Andreas
>>>>
>>>> PS: It actually seems that the only thing provided by avutil.h that
>>>> mem.h uses is size_t. Do we allow to remove included headers from
>>>> installed headers at major version bumps?
>>>
>>> I would say yes, IIRC it has happened before.
>>> Certainly nobody should depend on our headers to provide any random
>>> system headers.
>>>
>> Removing avutil.h affects not only system headers, but which of our
>> headers are included as it includes
>> #include "common.h"
>> #include "error.h"
>> #include "rational.h"
>> #include "version.h"
>> #include "macros.h"
>> #include "mathematics.h"
>> #include "log.h"
>> #include "pixfmt.h"
>> (And removing avutil.h will also remove avutil.h, of course.)
>>
>> Other installed headers include too much, too: audio_fifo.h includes
>> avutil.h and fifo.h, but needs only attributes.h; eval.h unnecessarily
>> includes avutil.h; display.h includes common.h without needing it.
>> fifo.h includes avutil.h and attributes.h, but needs only stddef.h.
>> Several other headers include version.h despite the relevant FF_API
>> check for which it has been included no longer existing. (If we don't
>> remove version.h, sooner or later all headers will contain it.)
> 
> I don't think we have an official project policy on this, but I would
> be in favor of something like:
> 
>     All installed headers are only guaranteed to provide those
>     identifiers that are explicitly declared in them. Users must not
>     rely on an installed header #include'ing any other specific headers,
>     as those can change at any time.
> 
> +exceptions for av*.h, but ideally I'd remove those too in the long
> run - people should just include what they need and avoid monsterheaders
> 
>>
>> And while I played around a bit with this night, I found something odd:
>> libavutil/error.h is broken: It relies on MKTAG without providing the
>> header for it. MKTAG is in common.h which also includes mem.h which uses
>> an AVERROR code in an inline function. So the simple solution of
>> including common.h at the beginning of error.h doesn't work, as
>> AVERROR(EINVAL) will still be undefined in said function. I see two
>> other solutions: Move MKTAG (and probably a bit other stuff) to a new
>> header and include that in error.h; include common.h, but not at the
>> beginning of error.h, but only after the definition of AVERROR. Given
>> that I dislike monster headers like common.h, I prefer the first approach.
>> (I already mentioned this on IRC, but those who only follow the ML
>> should be informed, too.)
> 
> I am in favor of moving MKTAG if you can think of a good place for it.
> (also it should be properly namespaced, but not necessarily now)
> 
macros.h seems like a good place for it; in fact, it seems like a better
place for all the macros from common.h. common.h would then be reduced
to misc inline math functions and inclusions of other headers.
common.h already includes macros.h, so this would not be disruptive.
Furthermore, the hardcoded tables code currently has to define
FF_ARRAY_ELEMS itself, because common.h includes config.h (when building
the libraries itself), and by moving this stuff to macros.h one can
simply use macros.h.
If no one objects, I'll prepare patches for this.

- Andreas
diff mbox series

Patch

diff --git a/fftools/ffmpeg_qsv.c b/fftools/ffmpeg_qsv.c
index 960c88b69d..7bd999d310 100644
--- a/fftools/ffmpeg_qsv.c
+++ b/fftools/ffmpeg_qsv.c
@@ -22,7 +22,6 @@ 
 #include "libavutil/dict.h"
 #include "libavutil/hwcontext.h"
 #include "libavutil/hwcontext_qsv.h"
-#include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavcodec/qsv.h"
 
diff --git a/libavcodec/aactab.c b/libavcodec/aactab.c
index fa5420fec6..0553f41a61 100644
--- a/libavcodec/aactab.c
+++ b/libavcodec/aactab.c
@@ -28,7 +28,6 @@ 
  */
 
 #include "config.h"
-#include "libavutil/mem.h"
 #include "libavutil/mem_internal.h"
 #include "libavutil/thread.h"
 #include "aac.h"
diff --git a/libavcodec/arbc.c b/libavcodec/arbc.c
index 06970f140b..20e9581ccd 100644
--- a/libavcodec/arbc.c
+++ b/libavcodec/arbc.c
@@ -26,7 +26,6 @@ 
 #include "libavutil/imgutils.h"
 #include "libavutil/internal.h"
 #include "libavutil/intreadwrite.h"
-#include "libavutil/mem.h"
 
 #include "avcodec.h"
 #include "bytestream.h"
diff --git a/libavcodec/argo.c b/libavcodec/argo.c
index 6b4d449935..5cd591329e 100644
--- a/libavcodec/argo.c
+++ b/libavcodec/argo.c
@@ -26,7 +26,6 @@ 
 #include "libavutil/imgutils.h"
 #include "libavutil/internal.h"
 #include "libavutil/intreadwrite.h"
-#include "libavutil/mem.h"
 
 #include "avcodec.h"
 #include "bytestream.h"
diff --git a/libavcodec/dcadsp.c b/libavcodec/dcadsp.c
index faf244c8ad..b2ef8b3e87 100644
--- a/libavcodec/dcadsp.c
+++ b/libavcodec/dcadsp.c
@@ -18,7 +18,6 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavutil/mem.h"
 #include "libavutil/mem_internal.h"
 
 #include "dcadsp.h"
diff --git a/libavcodec/dss_sp.c b/libavcodec/dss_sp.c
index 568757d212..6e1a78b6b4 100644
--- a/libavcodec/dss_sp.c
+++ b/libavcodec/dss_sp.c
@@ -21,7 +21,6 @@ 
 
 #include "libavutil/channel_layout.h"
 #include "libavutil/common.h"
-#include "libavutil/mem.h"
 #include "libavutil/mem_internal.h"
 #include "libavutil/opt.h"
 
diff --git a/libavcodec/dvbsub_parser.c b/libavcodec/dvbsub_parser.c
index b7a3d6154c..a38ac6693b 100644
--- a/libavcodec/dvbsub_parser.c
+++ b/libavcodec/dvbsub_parser.c
@@ -23,7 +23,6 @@ 
 #include <string.h>
 
 #include "libavutil/intreadwrite.h"
-#include "libavutil/mem.h"
 
 #include "avcodec.h"
 #include "internal.h"
diff --git a/libavcodec/h264_redundant_pps_bsf.c b/libavcodec/h264_redundant_pps_bsf.c
index 6ba40291d5..fb678beef3 100644
--- a/libavcodec/h264_redundant_pps_bsf.c
+++ b/libavcodec/h264_redundant_pps_bsf.c
@@ -19,7 +19,6 @@ 
 #include <string.h>
 
 #include "libavutil/common.h"
-#include "libavutil/mem.h"
 
 #include "bsf.h"
 #include "bsf_internal.h"
diff --git a/libavcodec/libvo-amrwbenc.c b/libavcodec/libvo-amrwbenc.c
index 77d0ccef15..b57ab87971 100644
--- a/libavcodec/libvo-amrwbenc.c
+++ b/libavcodec/libvo-amrwbenc.c
@@ -25,7 +25,6 @@ 
 
 #include "libavutil/avstring.h"
 #include "libavutil/internal.h"
-#include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "avcodec.h"
 #include "internal.h"
diff --git a/libavcodec/mpegaudiodsp_template.c b/libavcodec/mpegaudiodsp_template.c
index 97317967a2..fbbd94e486 100644
--- a/libavcodec/mpegaudiodsp_template.c
+++ b/libavcodec/mpegaudiodsp_template.c
@@ -21,7 +21,6 @@ 
 #include <stdint.h>
 
 #include "libavutil/attributes.h"
-#include "libavutil/mem.h"
 #include "libavutil/mem_internal.h"
 #include "libavutil/thread.h"
 
diff --git a/libavcodec/opustab.h b/libavcodec/opustab.h
index 4525837942..16011db758 100644
--- a/libavcodec/opustab.h
+++ b/libavcodec/opustab.h
@@ -23,8 +23,6 @@ 
 #ifndef AVCODEC_OPUSTAB_H
 #define AVCODEC_OPUSTAB_H
 
-#include "libavutil/mem.h"
-
 #include <stdint.h>
 
 extern const uint8_t  ff_celt_band_end[];
diff --git a/libavcodec/rl.c b/libavcodec/rl.c
index 93153ff723..fab96d63a1 100644
--- a/libavcodec/rl.c
+++ b/libavcodec/rl.c
@@ -21,7 +21,6 @@ 
 
 #include "libavutil/attributes.h"
 #include "libavutil/avassert.h"
-#include "libavutil/mem.h"
 
 #include "rl.h"
 
diff --git a/libavcodec/snappy.c b/libavcodec/snappy.c
index f5c4c6578b..91dd84fad4 100644
--- a/libavcodec/snappy.c
+++ b/libavcodec/snappy.c
@@ -19,8 +19,6 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavutil/mem.h"
-
 #include "bytestream.h"
 #include "snappy.h"
 
diff --git a/libavcodec/truemotion2rt.c b/libavcodec/truemotion2rt.c
index e3ab998fda..af88bf1cc2 100644
--- a/libavcodec/truemotion2rt.c
+++ b/libavcodec/truemotion2rt.c
@@ -25,7 +25,6 @@ 
 #include "libavutil/imgutils.h"
 #include "libavutil/internal.h"
 #include "libavutil/intreadwrite.h"
-#include "libavutil/mem.h"
 
 #define BITSTREAM_READER_LE
 #include "avcodec.h"
diff --git a/libavcodec/v210dec.c b/libavcodec/v210dec.c
index 044d35338b..16cab650fe 100644
--- a/libavcodec/v210dec.c
+++ b/libavcodec/v210dec.c
@@ -26,7 +26,6 @@ 
 #include "v210dec.h"
 #include "libavutil/bswap.h"
 #include "libavutil/internal.h"
-#include "libavutil/mem.h"
 #include "libavutil/intreadwrite.h"
 #include "thread.h"
 
diff --git a/libavcodec/v210x.c b/libavcodec/v210x.c
index f6a453aabf..e92e0b33b8 100644
--- a/libavcodec/v210x.c
+++ b/libavcodec/v210x.c
@@ -22,7 +22,6 @@ 
 #include "internal.h"
 #include "libavutil/bswap.h"
 #include "libavutil/internal.h"
-#include "libavutil/mem.h"
 
 static av_cold int decode_init(AVCodecContext *avctx)
 {
diff --git a/libavcodec/x86/ac3dsp_init.c b/libavcodec/x86/ac3dsp_init.c
index 2ae762af46..923c3e0a31 100644
--- a/libavcodec/x86/ac3dsp_init.c
+++ b/libavcodec/x86/ac3dsp_init.c
@@ -20,7 +20,6 @@ 
  */
 
 #include "libavutil/attributes.h"
-#include "libavutil/mem.h"
 #include "libavutil/x86/asm.h"
 #include "libavutil/x86/cpu.h"
 #include "libavcodec/ac3.h"
diff --git a/libavcodec/x86/lpc.c b/libavcodec/x86/lpc.c
index 6c72e21bac..544083bd37 100644
--- a/libavcodec/x86/lpc.c
+++ b/libavcodec/x86/lpc.c
@@ -21,7 +21,7 @@ 
 
 #include "libavutil/attributes.h"
 #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/lpc.h"
diff --git a/libavcodec/x86/rv40dsp_init.c b/libavcodec/x86/rv40dsp_init.c
index 79a617ffbe..7a05ab14ad 100644
--- a/libavcodec/x86/rv40dsp_init.c
+++ b/libavcodec/x86/rv40dsp_init.c
@@ -28,7 +28,6 @@ 
 
 #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 6541dda429..a57930e46c 100644
--- a/libavcodec/x86/vc1dsp_mmx.c
+++ b/libavcodec/x86/vc1dsp_mmx.c
@@ -25,7 +25,6 @@ 
  */
 
 #include "libavutil/cpu.h"
-#include "libavutil/mem.h"
 #include "libavutil/mem_internal.h"
 #include "libavutil/x86/asm.h"
 #include "libavutil/x86/cpu.h"
diff --git a/libavcodec/x86/videodsp_init.c b/libavcodec/x86/videodsp_init.c
index eeebb41547..961424aa13 100644
--- a/libavcodec/x86/videodsp_init.c
+++ b/libavcodec/x86/videodsp_init.c
@@ -24,7 +24,6 @@ 
 #include "libavutil/avassert.h"
 #include "libavutil/common.h"
 #include "libavutil/cpu.h"
-#include "libavutil/mem.h"
 #include "libavutil/x86/asm.h"
 #include "libavutil/x86/cpu.h"
 #include "libavcodec/videodsp.h"
diff --git a/libavcodec/x86/vp8dsp_init.c b/libavcodec/x86/vp8dsp_init.c
index dffa7a2418..289f1d5115 100644
--- a/libavcodec/x86/vp8dsp_init.c
+++ b/libavcodec/x86/vp8dsp_init.c
@@ -22,7 +22,6 @@ 
 
 #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.c b/libavcodec/x86/vp9dsp_init.c
index 837cce8508..8d11dbc348 100644
--- a/libavcodec/x86/vp9dsp_init.c
+++ b/libavcodec/x86/vp9dsp_init.c
@@ -22,7 +22,6 @@ 
 
 #include "libavutil/attributes.h"
 #include "libavutil/cpu.h"
-#include "libavutil/mem.h"
 #include "libavutil/x86/cpu.h"
 #include "libavcodec/vp9dsp.h"
 #include "libavcodec/x86/vp9dsp_init.h"
diff --git a/libavcodec/x86/vp9dsp_init_16bpp_template.c b/libavcodec/x86/vp9dsp_init_16bpp_template.c
index b56afc7f50..f93ea2468e 100644
--- a/libavcodec/x86/vp9dsp_init_16bpp_template.c
+++ b/libavcodec/x86/vp9dsp_init_16bpp_template.c
@@ -22,7 +22,6 @@ 
 
 #include "libavutil/attributes.h"
 #include "libavutil/cpu.h"
-#include "libavutil/mem.h"
 #include "libavutil/x86/cpu.h"
 #include "libavcodec/vp9dsp.h"
 #include "libavcodec/x86/vp9dsp_init.h"
diff --git a/libavdevice/fbdev_dec.c b/libavdevice/fbdev_dec.c
index 6a51816868..f0abaf4eca 100644
--- a/libavdevice/fbdev_dec.c
+++ b/libavdevice/fbdev_dec.c
@@ -36,7 +36,6 @@ 
 
 #include "libavutil/internal.h"
 #include "libavutil/log.h"
-#include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavutil/time.h"
 #include "libavutil/parseutils.h"
diff --git a/libavdevice/fbdev_enc.c b/libavdevice/fbdev_enc.c
index 4191596825..1f1885cf8e 100644
--- a/libavdevice/fbdev_enc.c
+++ b/libavdevice/fbdev_enc.c
@@ -25,7 +25,6 @@ 
 #include <linux/fb.h>
 #include "libavutil/pixdesc.h"
 #include "libavutil/log.h"
-#include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavformat/avformat.h"
 #include "fbdev_common.h"
diff --git a/libavdevice/libcdio.c b/libavdevice/libcdio.c
index a4c9f52337..bd8a5baa42 100644
--- a/libavdevice/libcdio.c
+++ b/libavdevice/libcdio.c
@@ -34,7 +34,6 @@ 
 #endif
 
 #include "libavutil/log.h"
-#include "libavutil/mem.h"
 #include "libavutil/opt.h"
 
 #include "libavformat/avformat.h"
diff --git a/libavfilter/boxblur.h b/libavfilter/boxblur.h
index 5694722a9d..214d4e0c93 100644
--- a/libavfilter/boxblur.h
+++ b/libavfilter/boxblur.h
@@ -25,7 +25,6 @@ 
 
 #include "libavutil/eval.h"
 #include "libavutil/pixdesc.h"
-#include "libavutil/mem.h"
 
 #include "avfilter.h"
 
diff --git a/libavfilter/drawutils.c b/libavfilter/drawutils.c
index 71fe25692c..33f0fecb32 100644
--- a/libavfilter/drawutils.c
+++ b/libavfilter/drawutils.c
@@ -25,7 +25,6 @@ 
 #include "libavutil/avutil.h"
 #include "libavutil/colorspace.h"
 #include "libavutil/intreadwrite.h"
-#include "libavutil/mem.h"
 #include "libavutil/pixdesc.h"
 #include "drawutils.h"
 #include "formats.h"
diff --git a/libavfilter/vf_deinterlace_vaapi.c b/libavfilter/vf_deinterlace_vaapi.c
index 71809eb01a..e5e7faaea8 100644
--- a/libavfilter/vf_deinterlace_vaapi.c
+++ b/libavfilter/vf_deinterlace_vaapi.c
@@ -20,7 +20,6 @@ 
 
 #include "libavutil/avassert.h"
 #include "libavutil/common.h"
-#include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 
diff --git a/libavfilter/vf_misc_vaapi.c b/libavfilter/vf_misc_vaapi.c
index 5814ff8c2e..e84c6ef2ca 100644
--- a/libavfilter/vf_misc_vaapi.c
+++ b/libavfilter/vf_misc_vaapi.c
@@ -18,7 +18,6 @@ 
 #include <string.h>
 
 #include "libavutil/avassert.h"
-#include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 
diff --git a/libavfilter/vf_neighbor_opencl.c b/libavfilter/vf_neighbor_opencl.c
index fb40132d95..87a81b4cc2 100644
--- a/libavfilter/vf_neighbor_opencl.c
+++ b/libavfilter/vf_neighbor_opencl.c
@@ -20,7 +20,6 @@ 
 
 #include "libavutil/common.h"
 #include "libavutil/imgutils.h"
-#include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 #include "libavutil/avstring.h"
diff --git a/libavfilter/vf_overlay_cuda.c b/libavfilter/vf_overlay_cuda.c
index 2f0f860e50..c7c115bf14 100644
--- a/libavfilter/vf_overlay_cuda.c
+++ b/libavfilter/vf_overlay_cuda.c
@@ -24,7 +24,6 @@ 
  */
 
 #include "libavutil/log.h"
-#include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 #include "libavutil/hwcontext.h"
diff --git a/libavfilter/vf_overlay_opencl.c b/libavfilter/vf_overlay_opencl.c
index e9c853203b..718df73fdb 100644
--- a/libavfilter/vf_overlay_opencl.c
+++ b/libavfilter/vf_overlay_opencl.c
@@ -17,7 +17,6 @@ 
  */
 
 #include "libavutil/log.h"
-#include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 
diff --git a/libavfilter/vf_procamp_vaapi.c b/libavfilter/vf_procamp_vaapi.c
index 7342048583..240ab09e20 100644
--- a/libavfilter/vf_procamp_vaapi.c
+++ b/libavfilter/vf_procamp_vaapi.c
@@ -18,7 +18,6 @@ 
 #include <string.h>
 
 #include "libavutil/avassert.h"
-#include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 
diff --git a/libavfilter/vf_scale_vaapi.c b/libavfilter/vf_scale_vaapi.c
index b9a5eeff65..01983d5996 100644
--- a/libavfilter/vf_scale_vaapi.c
+++ b/libavfilter/vf_scale_vaapi.c
@@ -19,7 +19,6 @@ 
 #include <string.h>
 
 #include "libavutil/avassert.h"
-#include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 
diff --git a/libavfilter/vf_tonemap_opencl.c b/libavfilter/vf_tonemap_opencl.c
index 2681ebd1b5..695c6c9eb8 100644
--- a/libavfilter/vf_tonemap_opencl.c
+++ b/libavfilter/vf_tonemap_opencl.c
@@ -20,7 +20,6 @@ 
 #include "libavutil/avassert.h"
 #include "libavutil/common.h"
 #include "libavutil/imgutils.h"
-#include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 
diff --git a/libavfilter/vf_tonemap_vaapi.c b/libavfilter/vf_tonemap_vaapi.c
index 2f41b90424..0e22b859b8 100644
--- a/libavfilter/vf_tonemap_vaapi.c
+++ b/libavfilter/vf_tonemap_vaapi.c
@@ -18,7 +18,6 @@ 
 #include <string.h>
 
 #include "libavutil/avassert.h"
-#include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 #include "libavutil/mastering_display_metadata.h"
diff --git a/libavfilter/vf_transpose_opencl.c b/libavfilter/vf_transpose_opencl.c
index dd678e91cd..ecf4b48bec 100644
--- a/libavfilter/vf_transpose_opencl.c
+++ b/libavfilter/vf_transpose_opencl.c
@@ -20,7 +20,6 @@ 
 #include "libavutil/avassert.h"
 #include "libavutil/common.h"
 #include "libavutil/imgutils.h"
-#include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 
diff --git a/libavfilter/vf_transpose_vaapi.c b/libavfilter/vf_transpose_vaapi.c
index a4c654266d..6d2bb3a341 100644
--- a/libavfilter/vf_transpose_vaapi.c
+++ b/libavfilter/vf_transpose_vaapi.c
@@ -18,7 +18,6 @@ 
 #include <string.h>
 
 #include "libavutil/avassert.h"
-#include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 
diff --git a/libavfilter/vf_xfade_opencl.c b/libavfilter/vf_xfade_opencl.c
index 4736043147..8cc1253dc5 100644
--- a/libavfilter/vf_xfade_opencl.c
+++ b/libavfilter/vf_xfade_opencl.c
@@ -17,7 +17,6 @@ 
  */
 
 #include "libavutil/log.h"
-#include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 
diff --git a/libavfilter/video.c b/libavfilter/video.c
index 7a8e587798..ee1d440bb2 100644
--- a/libavfilter/video.c
+++ b/libavfilter/video.c
@@ -27,7 +27,6 @@ 
 #include "libavutil/buffer.h"
 #include "libavutil/hwcontext.h"
 #include "libavutil/imgutils.h"
-#include "libavutil/mem.h"
 
 #include "avfilter.h"
 #include "internal.h"
diff --git a/libavfilter/x86/vf_atadenoise_init.c b/libavfilter/x86/vf_atadenoise_init.c
index 3f87f3c445..e7a653f191 100644
--- a/libavfilter/x86/vf_atadenoise_init.c
+++ b/libavfilter/x86/vf_atadenoise_init.c
@@ -20,7 +20,6 @@ 
 
 #include "libavutil/attributes.h"
 #include "libavutil/cpu.h"
-#include "libavutil/mem.h"
 #include "libavutil/x86/asm.h"
 #include "libavutil/x86/cpu.h"
 #include "libavfilter/atadenoise.h"
diff --git a/libavfilter/x86/vf_bwdif_init.c b/libavfilter/x86/vf_bwdif_init.c
index b1e70b3bc6..f632c4f340 100644
--- a/libavfilter/x86/vf_bwdif_init.c
+++ b/libavfilter/x86/vf_bwdif_init.c
@@ -20,7 +20,6 @@ 
 
 #include "libavutil/attributes.h"
 #include "libavutil/cpu.h"
-#include "libavutil/mem.h"
 #include "libavutil/x86/asm.h"
 #include "libavutil/x86/cpu.h"
 #include "libavfilter/bwdif.h"
diff --git a/libavfilter/x86/vf_eq_init.c b/libavfilter/x86/vf_eq_init.c
index 274325074a..113056e76b 100644
--- a/libavfilter/x86/vf_eq_init.c
+++ b/libavfilter/x86/vf_eq_init.c
@@ -21,7 +21,6 @@ 
 
 #include "libavutil/attributes.h"
 #include "libavutil/cpu.h"
-#include "libavutil/mem.h"
 #include "libavutil/x86/cpu.h"
 #include "libavutil/x86/asm.h"
 #include "libavfilter/vf_eq.h"
diff --git a/libavfilter/x86/vf_gradfun_init.c b/libavfilter/x86/vf_gradfun_init.c
index 4009711701..56e6774a79 100644
--- a/libavfilter/x86/vf_gradfun_init.c
+++ b/libavfilter/x86/vf_gradfun_init.c
@@ -21,7 +21,6 @@ 
 #include "config.h"
 #include "libavutil/attributes.h"
 #include "libavutil/cpu.h"
-#include "libavutil/mem.h"
 #include "libavutil/x86/cpu.h"
 #include "libavfilter/gradfun.h"
 
diff --git a/libavfilter/x86/vf_idet_init.c b/libavfilter/x86/vf_idet_init.c
index ca175e2d40..d4d9bd0893 100644
--- a/libavfilter/x86/vf_idet_init.c
+++ b/libavfilter/x86/vf_idet_init.c
@@ -18,7 +18,6 @@ 
 
 #include "libavutil/attributes.h"
 #include "libavutil/cpu.h"
-#include "libavutil/mem.h"
 #include "libavutil/x86/asm.h"
 #include "libavutil/x86/cpu.h"
 #include "libavfilter/vf_idet.h"
diff --git a/libavfilter/x86/vf_maskedclamp_init.c b/libavfilter/x86/vf_maskedclamp_init.c
index 53153f80ea..2a5388abac 100644
--- a/libavfilter/x86/vf_maskedclamp_init.c
+++ b/libavfilter/x86/vf_maskedclamp_init.c
@@ -20,7 +20,6 @@ 
 
 #include "libavutil/attributes.h"
 #include "libavutil/cpu.h"
-#include "libavutil/mem.h"
 #include "libavutil/x86/asm.h"
 #include "libavutil/x86/cpu.h"
 #include "libavfilter/maskedclamp.h"
diff --git a/libavfilter/x86/vf_transpose_init.c b/libavfilter/x86/vf_transpose_init.c
index 6bb9908725..95c56eab73 100644
--- a/libavfilter/x86/vf_transpose_init.c
+++ b/libavfilter/x86/vf_transpose_init.c
@@ -20,7 +20,6 @@ 
 
 #include "libavutil/attributes.h"
 #include "libavutil/cpu.h"
-#include "libavutil/mem.h"
 #include "libavutil/x86/asm.h"
 #include "libavutil/x86/cpu.h"
 #include "libavfilter/transpose.h"
diff --git a/libavfilter/x86/vf_w3fdif_init.c b/libavfilter/x86/vf_w3fdif_init.c
index d4534bb1ed..16202fba76 100644
--- a/libavfilter/x86/vf_w3fdif_init.c
+++ b/libavfilter/x86/vf_w3fdif_init.c
@@ -20,7 +20,6 @@ 
 
 #include "libavutil/attributes.h"
 #include "libavutil/cpu.h"
-#include "libavutil/mem.h"
 #include "libavutil/x86/asm.h"
 #include "libavutil/x86/cpu.h"
 #include "libavfilter/w3fdif.h"
diff --git a/libavfilter/x86/vf_yadif_init.c b/libavfilter/x86/vf_yadif_init.c
index c39bc44da6..66cbee8510 100644
--- a/libavfilter/x86/vf_yadif_init.c
+++ b/libavfilter/x86/vf_yadif_init.c
@@ -20,7 +20,6 @@ 
 
 #include "libavutil/attributes.h"
 #include "libavutil/cpu.h"
-#include "libavutil/mem.h"
 #include "libavutil/x86/cpu.h"
 #include "libavfilter/yadif.h"
 
diff --git a/libavformat/replaygain.c b/libavformat/replaygain.c
index 707d3cd4f1..24f5c74183 100644
--- a/libavformat/replaygain.c
+++ b/libavformat/replaygain.c
@@ -29,7 +29,6 @@ 
 #include "libavutil/dict.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mathematics.h"
-#include "libavutil/mem.h"
 #include "libavutil/replaygain.h"
 
 #include "avformat.h"
diff --git a/libavutil/avsscanf.c b/libavutil/avsscanf.c
index b7f0f71c2d..a20cb15b01 100644
--- a/libavutil/avsscanf.c
+++ b/libavutil/avsscanf.c
@@ -29,7 +29,6 @@ 
 
 #include "config.h"
 #include "common.h"
-#include "mem.h"
 #include "avassert.h"
 #include "avstring.h"
 #include "bprint.h"
diff --git a/libavutil/tests/aes_ctr.c b/libavutil/tests/aes_ctr.c
index 53d0e4a244..9dbf0af8aa 100644
--- a/libavutil/tests/aes_ctr.c
+++ b/libavutil/tests/aes_ctr.c
@@ -17,7 +17,6 @@ 
  */
 
 #include "libavutil/log.h"
-#include "libavutil/mem.h"
 #include "libavutil/mem_internal.h"
 #include "libavutil/aes_ctr.h"
 
diff --git a/libavutil/tx_priv.h b/libavutil/tx_priv.h
index 18a07c312c..7edaa8d8c6 100644
--- a/libavutil/tx_priv.h
+++ b/libavutil/tx_priv.h
@@ -22,7 +22,6 @@ 
 #include "tx.h"
 #include <stddef.h>
 #include "thread.h"
-#include "mem.h"
 #include "mem_internal.h"
 #include "avassert.h"
 #include "attributes.h"
diff --git a/tests/checkasm/llviddspenc.c b/tests/checkasm/llviddspenc.c
index 132f6d2771..4ec46c96bd 100644
--- a/tests/checkasm/llviddspenc.c
+++ b/tests/checkasm/llviddspenc.c
@@ -22,7 +22,6 @@ 
 
 #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/sw_rgb.c b/tests/checkasm/sw_rgb.c
index c29b75d09b..7cd815e5be 100644
--- a/tests/checkasm/sw_rgb.c
+++ b/tests/checkasm/sw_rgb.c
@@ -21,7 +21,6 @@ 
 
 #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 8741b3943c..41ee9ba4cc 100644
--- a/tests/checkasm/sw_scale.c
+++ b/tests/checkasm/sw_scale.c
@@ -21,7 +21,6 @@ 
 
 #include "libavutil/common.h"
 #include "libavutil/intreadwrite.h"
-#include "libavutil/mem.h"
 #include "libavutil/mem_internal.h"
 
 #include "libswscale/swscale.h"
diff --git a/tools/ffhash.c b/tools/ffhash.c
index 6942527732..3034aa863f 100644
--- a/tools/ffhash.c
+++ b/tools/ffhash.c
@@ -24,7 +24,6 @@ 
 #include "libavutil/avstring.h"
 #include "libavutil/error.h"
 #include "libavutil/hash.h"
-#include "libavutil/mem.h"
 
 #include <errno.h>
 #include <fcntl.h>