diff mbox series

[FFmpeg-devel,16/17] Remove/replace some unnecessary avcodec.h inclusions

Message ID HE1PR0301MB2154B12EBBF7B3D77A6E9A4A8F319@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Accepted
Headers show
Series [FFmpeg-devel,01/17] avcodec/avcodec: Stop including bsf.h in avcodec.h
Related show

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 June 14, 2021, 10:41 p.m. UTC
Also remove other unnecessary headers and include headers directly while
at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/ac3.c                     |  1 -
 libavcodec/ac3.h                     |  5 +++--
 libavcodec/ac3dsp.c                  |  9 ++++++++-
 libavcodec/ac3enc.h                  |  1 +
 libavcodec/ac3tab.c                  |  3 +--
 libavcodec/acelp_filters.c           |  4 +++-
 libavcodec/allcodecs.c               |  6 +++++-
 libavcodec/ass_split.c               |  4 +++-
 libavcodec/atrac.c                   |  4 +---
 libavcodec/av1_parse.h               |  6 +++++-
 libavcodec/bitstream.c               | 15 +++++++++++++--
 libavcodec/bmp.h                     |  2 --
 libavcodec/celp_filters.c            |  5 +++--
 libavcodec/dcahuff.c                 |  6 ++++--
 libavcodec/dcahuff.h                 |  7 ++++---
 libavcodec/dirac.c                   |  4 +---
 libavcodec/dsd.c                     |  6 +++---
 libavcodec/dsd.h                     |  5 ++---
 libavcodec/elbg.c                    |  1 -
 libavcodec/elsdec.c                  |  1 -
 libavcodec/exif.h                    |  4 ++--
 libavcodec/fits.c                    |  7 ++++++-
 libavcodec/g722.h                    |  2 +-
 libavcodec/g723_1.c                  |  3 ++-
 libavcodec/g729postfilter.c          | 10 +++++++---
 libavcodec/gsmdec_data.h             |  1 -
 libavcodec/h261.c                    |  2 +-
 libavcodec/h263.c                    |  9 ++++-----
 libavcodec/h2645_parse.h             |  4 +++-
 libavcodec/h264_cabac.c              |  1 -
 libavcodec/h264_cavlc.c              |  1 -
 libavcodec/h264_levels.c             |  3 ++-
 libavcodec/h264_mp4toannexb_bsf.c    |  2 +-
 libavcodec/h264_sei.c                | 10 ++++++++--
 libavcodec/h264data.c                |  2 +-
 libavcodec/h264dsp.c                 |  1 -
 libavcodec/h264pred.c                |  4 +++-
 libavcodec/hevc_mp4toannexb_bsf.c    |  2 +-
 libavcodec/ivi_dsp.c                 |  3 ++-
 libavcodec/jpegls.c                  |  4 +++-
 libavcodec/jpegls.h                  |  3 +--
 libavcodec/lossless_audiodsp.c       |  3 ++-
 libavcodec/lossless_videoencdsp.h    |  3 +--
 libavcodec/lsp.c                     |  2 +-
 libavcodec/lzw.c                     |  2 +-
 libavcodec/lzwenc.c                  |  5 +++--
 libavcodec/mlp.h                     |  2 --
 libavcodec/mpc.c                     |  5 ++---
 libavcodec/mpc.h                     |  3 ++-
 libavcodec/mpegaudiodecheader.c      |  2 --
 libavcodec/mpegaudiodecheader.h      |  3 ++-
 libavcodec/nellymoser.c              |  4 +++-
 libavcodec/nellymoser.h              |  2 +-
 libavcodec/pcm_rechunk_bsf.c         |  1 -
 libavcodec/png.c                     |  4 +++-
 libavcodec/rangecoder.c              |  2 +-
 libavcodec/raw.h                     |  3 +--
 libavcodec/rle.c                     |  3 ++-
 libavcodec/roqvideo.c                |  3 ++-
 libavcodec/rv30dsp.c                 |  5 ++++-
 libavcodec/rv40dsp.c                 |  1 -
 libavcodec/sbc.c                     |  1 -
 libavcodec/sbc.h                     |  3 ++-
 libavcodec/setts_bsf.c               |  1 -
 libavcodec/simple_idct.c             |  1 -
 libavcodec/tiff_common.c             |  1 +
 libavcodec/tiff_common.h             |  5 ++---
 libavcodec/v4l2_buffers.h            |  5 ++++-
 libavcodec/v4l2_context.h            |  7 ++++---
 libavcodec/v4l2_fmt.h                |  3 ++-
 libavcodec/vc1data.c                 |  2 +-
 libavcodec/vp3dsp.c                  |  5 ++++-
 libavcodec/vp56dsp.c                 |  2 +-
 libavcodec/vp9block.c                |  3 ---
 libavcodec/vp9recon.c                |  2 --
 libavcodec/wmv2.h                    |  1 -
 libavcodec/wmv2dsp.c                 |  3 ++-
 libavcodec/x86/cfhddsp_init.c        |  3 ++-
 libavcodec/x86/cfhdencdsp_init.c     |  3 ++-
 libavcodec/x86/h264_intrapred_init.c |  5 ++++-
 libavcodec/x86/mlpdsp_init.c         |  3 +++
 libavcodec/x86/snowdsp.c             |  3 ++-
 libavdevice/avdevice.c               |  1 -
 libavdevice/oss.c                    |  1 -
 libavdevice/oss.h                    |  5 +++--
 libavdevice/oss_dec.c                |  2 --
 libavdevice/oss_enc.c                |  2 --
 libavfilter/af_ashowinfo.c           |  2 --
 libavformat/mxf.c                    |  1 +
 libavformat/mxf.h                    |  5 +++--
 libavformat/riff.c                   |  5 +++--
 libavformat/riff.h                   |  1 -
 libavformat/riffdec.c                |  5 ++---
 libavformat/rtp.h                    |  6 ++++--
 libavformat/rtpdec.h                 |  3 ++-
 libavformat/rtpdec_qdm2.c            |  1 -
 libavformat/vpcc.c                   |  1 +
 libavformat/vpcc.h                   |  4 ++--
 98 files changed, 196 insertions(+), 142 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/ac3.c b/libavcodec/ac3.c
index 6d09288eee..a0fd00138f 100644
--- a/libavcodec/ac3.c
+++ b/libavcodec/ac3.c
@@ -26,7 +26,6 @@ 
 
 #include "libavutil/common.h"
 
-#include "avcodec.h"
 #include "ac3.h"
 
 /**
diff --git a/libavcodec/ac3.h b/libavcodec/ac3.h
index e358f8d9e3..0e52028111 100644
--- a/libavcodec/ac3.h
+++ b/libavcodec/ac3.h
@@ -27,6 +27,9 @@ 
 #ifndef AVCODEC_AC3_H
 #define AVCODEC_AC3_H
 
+#include <math.h>
+#include <stdint.h>
+
 #define EAC3_MAX_CHANNELS 16          /**< maximum number of channels in EAC3 */
 #define AC3_MAX_CHANNELS 7            /**< maximum number of channels, including coupling channel */
 #define CPL_CH 0                      /**< coupling channel index */
@@ -39,8 +42,6 @@ 
 #define AC3_CRITICAL_BANDS 50
 #define AC3_MAX_CPL_BANDS  18
 
-#include "libavutil/opt.h"
-#include "avcodec.h"
 #include "ac3tab.h"
 
 /* exponent encoding strategy */
diff --git a/libavcodec/ac3dsp.c b/libavcodec/ac3dsp.c
index 85c721dd3b..d006ca8c0a 100644
--- a/libavcodec/ac3dsp.c
+++ b/libavcodec/ac3dsp.c
@@ -19,9 +19,16 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "config.h"
+#include "libavutil/attributes.h"
+#include "libavutil/common.h"
+#include "libavutil/intmath.h"
 #include "libavutil/mem_internal.h"
 
-#include "avcodec.h"
 #include "ac3.h"
 #include "ac3dsp.h"
 #include "mathops.h"
diff --git a/libavcodec/ac3enc.h b/libavcodec/ac3enc.h
index c064ba4d63..f0a7476282 100644
--- a/libavcodec/ac3enc.h
+++ b/libavcodec/ac3enc.h
@@ -30,6 +30,7 @@ 
 
 #include <stdint.h>
 
+#include "libavutil/opt.h"
 #include "ac3.h"
 #include "ac3dsp.h"
 #include "avcodec.h"
diff --git a/libavcodec/ac3tab.c b/libavcodec/ac3tab.c
index e53086a754..5c5ea7e27e 100644
--- a/libavcodec/ac3tab.c
+++ b/libavcodec/ac3tab.c
@@ -25,9 +25,8 @@ 
  */
 
 #include "libavutil/channel_layout.h"
-#include "libavutil/mem_internal.h"
 
-#include "avcodec.h"
+#include "ac3.h"
 #include "ac3tab.h"
 
 /**
diff --git a/libavcodec/acelp_filters.c b/libavcodec/acelp_filters.c
index 35aa863e7a..b950ba6cbe 100644
--- a/libavcodec/acelp_filters.c
+++ b/libavcodec/acelp_filters.c
@@ -21,10 +21,12 @@ 
  */
 
 #include <inttypes.h>
+#include <stddef.h>
 
+#include "config.h"
 #include "libavutil/avassert.h"
 #include "libavutil/common.h"
-#include "avcodec.h"
+#include "libavutil/log.h"
 #include "acelp_filters.h"
 
 const int16_t ff_acelp_interp_filter[61] = { /* (0.15) */
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 623db2a9fa..71bc21aa05 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -24,9 +24,13 @@ 
  * Provide registration of all codecs, parsers and bitstream filters for libavcodec.
  */
 
+#include <stdint.h>
+#include <string.h>
+
 #include "config.h"
 #include "libavutil/thread.h"
-#include "avcodec.h"
+#include "codec.h"
+#include "codec_id.h"
 
 extern const AVCodec ff_a64multi_encoder;
 extern const AVCodec ff_a64multi5_encoder;
diff --git a/libavcodec/ass_split.c b/libavcodec/ass_split.c
index 189272bbd9..85cadcb7a9 100644
--- a/libavcodec/ass_split.c
+++ b/libavcodec/ass_split.c
@@ -19,7 +19,9 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "avcodec.h"
+#include "libavutil/common.h"
+#include "libavutil/error.h"
+#include "libavutil/mem.h"
 #include "ass_split.h"
 
 typedef enum {
diff --git a/libavcodec/atrac.c b/libavcodec/atrac.c
index bf9878be45..c3c9d491a5 100644
--- a/libavcodec/atrac.c
+++ b/libavcodec/atrac.c
@@ -26,13 +26,11 @@ 
  */
 
 #include <math.h>
-#include <stddef.h>
-#include <stdio.h>
 #include <string.h>
 
+#include "libavutil/attributes.h"
 #include "libavutil/thread.h"
 
-#include "avcodec.h"
 #include "atrac.h"
 
 float ff_atrac_sf_table[64];
diff --git a/libavcodec/av1_parse.h b/libavcodec/av1_parse.h
index ae0ebb5a18..3861d80b4c 100644
--- a/libavcodec/av1_parse.h
+++ b/libavcodec/av1_parse.h
@@ -21,10 +21,14 @@ 
 #ifndef AVCODEC_AV1_PARSE_H
 #define AVCODEC_AV1_PARSE_H
 
+#include <limits.h>
 #include <stdint.h>
 
+#include "libavutil/common.h"
+#include "libavutil/error.h"
+#include "libavutil/intmath.h"
+
 #include "av1.h"
-#include "avcodec.h"
 #include "get_bits.h"
 
 // OBU header fields + max leb128 length
diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index f0488cafd4..1f77cafae6 100644
--- a/libavcodec/bitstream.c
+++ b/libavcodec/bitstream.c
@@ -28,10 +28,21 @@ 
  * bitstream api.
  */
 
+#include <inttypes.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "config.h"
 #include "libavutil/avassert.h"
+#include "libavutil/bswap.h"
+#include "libavutil/common.h"
+#include "libavutil/error.h"
+#include "libavutil/internal.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/log.h"
+#include "libavutil/mem.h"
 #include "libavutil/qsort.h"
-#include "avcodec.h"
-#include "internal.h"
 #include "mathops.h"
 #include "put_bits.h"
 #include "vlc.h"
diff --git a/libavcodec/bmp.h b/libavcodec/bmp.h
index fb21090678..6b8dcb43ea 100644
--- a/libavcodec/bmp.h
+++ b/libavcodec/bmp.h
@@ -22,8 +22,6 @@ 
 #ifndef AVCODEC_BMP_H
 #define AVCODEC_BMP_H
 
-#include "avcodec.h"
-
 typedef enum {
     BMP_RGB         =0,
     BMP_RLE8        =1,
diff --git a/libavcodec/celp_filters.c b/libavcodec/celp_filters.c
index 40ff7427df..b96ebcebb3 100644
--- a/libavcodec/celp_filters.c
+++ b/libavcodec/celp_filters.c
@@ -20,9 +20,10 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include <inttypes.h>
+#include <stdint.h>
+#include <string.h>
 
-#include "avcodec.h"
+#include "config.h"
 #include "celp_filters.h"
 #include "libavutil/avassert.h"
 #include "libavutil/common.h"
diff --git a/libavcodec/dcahuff.c b/libavcodec/dcahuff.c
index 6197ccfe9b..fec60771ec 100644
--- a/libavcodec/dcahuff.c
+++ b/libavcodec/dcahuff.c
@@ -20,11 +20,13 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <stddef.h>
+
+#include "libavutil/avassert.h"
 #include "libavutil/common.h"
 
-#include "avcodec.h"
-#include "get_bits.h"
 #include "dcahuff.h"
+#include "put_bits.h"
 
 #define TMODE_COUNT 4
 static const uint8_t tmode_vlc_bits[TMODE_COUNT] = { 3, 3, 3, 2 };
diff --git a/libavcodec/dcahuff.h b/libavcodec/dcahuff.h
index 02b0e375ae..c0e04b725a 100644
--- a/libavcodec/dcahuff.h
+++ b/libavcodec/dcahuff.h
@@ -23,11 +23,12 @@ 
 #ifndef AVCODEC_DCAHUFF_H
 #define AVCODEC_DCAHUFF_H
 
-#include "libavutil/common.h"
+#include <stdint.h>
+
+#include "libavutil/attributes.h"
 
-#include "avcodec.h"
-#include "get_bits.h"
 #include "put_bits.h"
+#include "vlc.h"
 
 #define DCA_CODE_BOOKS      10
 #define DCA_BITALLOC_12_COUNT    5
diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c
index d5870d6c00..bc51a2fbd7 100644
--- a/libavcodec/dirac.c
+++ b/libavcodec/dirac.c
@@ -26,12 +26,10 @@ 
  * @author Marco Gerards <marco@gnu.org>, David Conrad, Jordi Ortiz <nenjordi@gmail.com>
  */
 
-#include "libavutil/imgutils.h"
+#include "libavutil/pixdesc.h"
 
-#include "avcodec.h"
 #include "dirac.h"
 #include "golomb.h"
-#include "internal.h"
 #include "mpeg12data.h"
 
 #if CONFIG_DIRAC_PARSE
diff --git a/libavcodec/dsd.c b/libavcodec/dsd.c
index c18e20436a..e039302c99 100644
--- a/libavcodec/dsd.c
+++ b/libavcodec/dsd.c
@@ -21,10 +21,10 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <string.h>
+#include "libavutil/attributes.h"
+#include "libavutil/reverse.h"
 #include "libavutil/thread.h"
-#include "libavcodec/internal.h"
-#include "libavcodec/mathops.h"
-#include "avcodec.h"
 #include "dsd.h"
 
 #define CTABLES ((HTAPS + 7) / 8) /** number of "8 MACs" lookup tables */
diff --git a/libavcodec/dsd.h b/libavcodec/dsd.h
index ed09cb9b12..74da74fccc 100644
--- a/libavcodec/dsd.h
+++ b/libavcodec/dsd.h
@@ -24,9 +24,8 @@ 
 #ifndef AVCODEC_DSD_H
 #define AVCODEC_DSD_H
 
-#include "libavcodec/internal.h"
-#include "libavcodec/mathops.h"
-#include "avcodec.h"
+#include <stddef.h>
+#include <stdint.h>
 
 #define HTAPS   48               /** number of FIR constants */
 #define FIFOSIZE 16              /** must be a power of two */
diff --git a/libavcodec/elbg.c b/libavcodec/elbg.c
index b6049c938b..377d5209cf 100644
--- a/libavcodec/elbg.c
+++ b/libavcodec/elbg.c
@@ -29,7 +29,6 @@ 
 #include "libavutil/common.h"
 #include "libavutil/lfg.h"
 #include "elbg.h"
-#include "avcodec.h"
 
 #define DELTA_ERR_MAX 0.1  ///< Precision of the ELBG algorithm (as percentage error)
 
diff --git a/libavcodec/elsdec.c b/libavcodec/elsdec.c
index cb0e9c6534..ecb5757066 100644
--- a/libavcodec/elsdec.c
+++ b/libavcodec/elsdec.c
@@ -31,7 +31,6 @@ 
 #include "libavutil/common.h"
 #include "libavutil/intreadwrite.h"
 
-#include "avcodec.h"
 #include "elsdec.h"
 
 /* ELS coder constants and structures. */
diff --git a/libavcodec/exif.h b/libavcodec/exif.h
index 05af756c48..4db84a1c2f 100644
--- a/libavcodec/exif.h
+++ b/libavcodec/exif.h
@@ -28,8 +28,8 @@ 
 #ifndef AVCODEC_EXIF_H
 #define AVCODEC_EXIF_H
 
-#include "avcodec.h"
-#include "bytestream.h"
+#include <stdint.h>
+#include "libavutil/dict.h"
 #include "tiff.h"
 
 #define EXIF_MAX_IFD_RECURSION 2
diff --git a/libavcodec/fits.c b/libavcodec/fits.c
index 97fa7abe80..5f364960e0 100644
--- a/libavcodec/fits.c
+++ b/libavcodec/fits.c
@@ -19,8 +19,13 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "avcodec.h"
+#include <inttypes.h>
+#include <limits.h>
+#include <stdio.h>
+#include <string.h>
 #include "libavutil/dict.h"
+#include "libavutil/error.h"
+#include "libavutil/log.h"
 #include "fits.h"
 
 int avpriv_fits_header_init(FITSHeader *header, FITSHeaderState state)
diff --git a/libavcodec/g722.h b/libavcodec/g722.h
index 25676a326e..a2a9ae4531 100644
--- a/libavcodec/g722.h
+++ b/libavcodec/g722.h
@@ -26,7 +26,7 @@ 
 #define AVCODEC_G722_H
 
 #include <stdint.h>
-#include "avcodec.h"
+#include "libavutil/log.h"
 #include "g722dsp.h"
 
 #define PREV_SAMPLES_BUF_SIZE 1024
diff --git a/libavcodec/g723_1.c b/libavcodec/g723_1.c
index 0c47458c23..d19d09dd89 100644
--- a/libavcodec/g723_1.c
+++ b/libavcodec/g723_1.c
@@ -21,11 +21,12 @@ 
  */
 
 #include <stdint.h>
+#include <string.h>
 
 #include "libavutil/common.h"
+#include "libavutil/intmath.h"
 
 #include "acelp_vectors.h"
-#include "avcodec.h"
 #include "celp_math.h"
 #include "g723_1.h"
 
diff --git a/libavcodec/g729postfilter.c b/libavcodec/g729postfilter.c
index 125a4095f8..f3cacbac05 100644
--- a/libavcodec/g729postfilter.c
+++ b/libavcodec/g729postfilter.c
@@ -18,10 +18,14 @@ 
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-#include <inttypes.h>
-#include <limits.h>
 
-#include "avcodec.h"
+#include <stdint.h>
+#include <string.h>
+
+#include "libavutil/common.h"
+#include "libavutil/intmath.h"
+
+#include "audiodsp.h"
 #include "g729.h"
 #include "g729postfilter.h"
 #include "celp_math.h"
diff --git a/libavcodec/gsmdec_data.h b/libavcodec/gsmdec_data.h
index f3499e8ae2..576bf071f4 100644
--- a/libavcodec/gsmdec_data.h
+++ b/libavcodec/gsmdec_data.h
@@ -23,7 +23,6 @@ 
 #define AVCODEC_GSMDEC_DATA_H
 
 #include <stdint.h>
-#include "avcodec.h"
 
 typedef struct GSMContext {
     // Contains first 120 elements from the previous frame
diff --git a/libavcodec/h261.c b/libavcodec/h261.c
index 01abfadcda..1290c040cd 100644
--- a/libavcodec/h261.c
+++ b/libavcodec/h261.c
@@ -25,8 +25,8 @@ 
  * H.261 codec
  */
 
-#include "avcodec.h"
 #include "h261.h"
+#include "mpegvideo.h"
 
 #define IS_FIL(a)    ((a) & MB_TYPE_H261_FIL)
 
diff --git a/libavcodec/h263.c b/libavcodec/h263.c
index 4a03c710a6..f8fba3c9f4 100644
--- a/libavcodec/h263.c
+++ b/libavcodec/h263.c
@@ -27,17 +27,16 @@ 
  * H.263/MPEG-4 codec.
  */
 
-#include <limits.h>
-
 #include "libavutil/thread.h"
-#include "avcodec.h"
 #include "mpegvideo.h"
 #include "h263.h"
 #include "h263data.h"
+#include "h263dsp.h"
+#include "idctdsp.h"
 #include "mathops.h"
+#include "mpegpicture.h"
 #include "mpegutils.h"
-#include "flv.h"
-#include "mpeg4video.h"
+#include "rl.h"
 
 static av_cold void h263_init_rl_inter(void)
 {
diff --git a/libavcodec/h2645_parse.h b/libavcodec/h2645_parse.h
index 3e47f86c53..20a9d355f2 100644
--- a/libavcodec/h2645_parse.h
+++ b/libavcodec/h2645_parse.h
@@ -24,7 +24,9 @@ 
 #include <stdint.h>
 
 #include "libavutil/buffer.h"
-#include "avcodec.h"
+#include "libavutil/error.h"
+#include "libavutil/log.h"
+#include "codec_id.h"
 #include "get_bits.h"
 
 #define MAX_MBPAIR_SIZE (256*1024) // a tighter bound could be calculated if someone cares about a few bytes
diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c
index 86f0a412fa..973b3419c4 100644
--- a/libavcodec/h264_cabac.c
+++ b/libavcodec/h264_cabac.c
@@ -35,7 +35,6 @@ 
 #include "cabac.h"
 #include "cabac_functions.h"
 #include "internal.h"
-#include "avcodec.h"
 #include "h264dec.h"
 #include "h264data.h"
 #include "h264_mvpred.h"
diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c
index 9f5f692331..fa8ba5dac7 100644
--- a/libavcodec/h264_cavlc.c
+++ b/libavcodec/h264_cavlc.c
@@ -29,7 +29,6 @@ 
 #define UNCHECKED_BITSTREAM_READER 1
 
 #include "internal.h"
-#include "avcodec.h"
 #include "h264dec.h"
 #include "h264_mvpred.h"
 #include "h264data.h"
diff --git a/libavcodec/h264_levels.c b/libavcodec/h264_levels.c
index 801b27fdd9..1b9f78da04 100644
--- a/libavcodec/h264_levels.c
+++ b/libavcodec/h264_levels.c
@@ -16,7 +16,8 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "avcodec.h"
+#include <stddef.h>
+#include "libavutil/common.h"
 #include "h264_levels.h"
 
 // H.264 table A-1.
diff --git a/libavcodec/h264_mp4toannexb_bsf.c b/libavcodec/h264_mp4toannexb_bsf.c
index 2822644b10..5a2656197e 100644
--- a/libavcodec/h264_mp4toannexb_bsf.c
+++ b/libavcodec/h264_mp4toannexb_bsf.c
@@ -25,10 +25,10 @@ 
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mem.h"
 
-#include "avcodec.h"
 #include "bsf.h"
 #include "bsf_internal.h"
 #include "bytestream.h"
+#include "defs.h"
 #include "h264.h"
 
 typedef struct H264BSFContext {
diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index ca2ca59e1f..15dadba325 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -25,13 +25,19 @@ 
  * @author Michael Niedermayer <michaelni@gmx.at>
  */
 
+#include <limits.h>
+#include <stdio.h>
+#include <string.h>
+#include "libavutil/common.h"
+#include "libavutil/error.h"
+#include "libavutil/log.h"
+#include "libavutil/mem.h"
 #include "atsc_a53.h"
-#include "avcodec.h"
 #include "get_bits.h"
 #include "golomb.h"
 #include "h264_ps.h"
 #include "h264_sei.h"
-#include "internal.h"
+#include "sei.h"
 
 #define AVERROR_PS_NOT_FOUND      FFERRTAG(0xF8,'?','P','S')
 
diff --git a/libavcodec/h264data.c b/libavcodec/h264data.c
index a4c6d93cf0..eb8728a9db 100644
--- a/libavcodec/h264data.c
+++ b/libavcodec/h264data.c
@@ -30,9 +30,9 @@ 
 
 #include "libavutil/avutil.h"
 
-#include "avcodec.h"
 #include "h264dec.h"
 #include "h264data.h"
+#include "mpegutils.h"
 
 const uint8_t ff_h264_golomb_to_pict_type[5] = {
     AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, AV_PICTURE_TYPE_I,
diff --git a/libavcodec/h264dsp.c b/libavcodec/h264dsp.c
index d26f552369..e76932b565 100644
--- a/libavcodec/h264dsp.c
+++ b/libavcodec/h264dsp.c
@@ -30,7 +30,6 @@ 
 #include "libavutil/attributes.h"
 #include "libavutil/avassert.h"
 
-#include "avcodec.h"
 #include "h264dsp.h"
 #include "h264idct.h"
 #include "startcode.h"
diff --git a/libavcodec/h264pred.c b/libavcodec/h264pred.c
index 5632a58fd7..b0fec71f25 100644
--- a/libavcodec/h264pred.c
+++ b/libavcodec/h264pred.c
@@ -25,11 +25,13 @@ 
  * @author Michael Niedermayer <michaelni@gmx.at>
  */
 
+#include "config.h"
 #include "libavutil/attributes.h"
 #include "libavutil/avassert.h"
 #include "libavutil/intreadwrite.h"
-#include "avcodec.h"
+#include "codec_id.h"
 #include "h264pred.h"
+#include "mathops.h"
 
 #define BIT_DEPTH 8
 #include "h264pred_template.c"
diff --git a/libavcodec/hevc_mp4toannexb_bsf.c b/libavcodec/hevc_mp4toannexb_bsf.c
index ba1deb2848..790dfb0394 100644
--- a/libavcodec/hevc_mp4toannexb_bsf.c
+++ b/libavcodec/hevc_mp4toannexb_bsf.c
@@ -24,10 +24,10 @@ 
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mem.h"
 
-#include "avcodec.h"
 #include "bsf.h"
 #include "bsf_internal.h"
 #include "bytestream.h"
+#include "defs.h"
 #include "hevc.h"
 
 #define MIN_HEVCC_LENGTH 23
diff --git a/libavcodec/ivi_dsp.c b/libavcodec/ivi_dsp.c
index 4aedf17907..d7111565c2 100644
--- a/libavcodec/ivi_dsp.c
+++ b/libavcodec/ivi_dsp.c
@@ -26,7 +26,8 @@ 
  * for Indeo Video Interactive codecs.
  */
 
-#include "avcodec.h"
+#include <string.h>
+#include "libavutil/common.h"
 #include "ivi.h"
 #include "ivi_dsp.h"
 
diff --git a/libavcodec/jpegls.c b/libavcodec/jpegls.c
index 7f9fa8d60c..cc598f3c17 100644
--- a/libavcodec/jpegls.c
+++ b/libavcodec/jpegls.c
@@ -25,7 +25,9 @@ 
  * JPEG-LS common code.
  */
 
-#include "internal.h"
+#include <stddef.h>
+#include "libavutil/internal.h"
+#include "libavutil/intmath.h"
 #include "jpegls.h"
 
 void ff_jpegls_init_state(JLSState *state)
diff --git a/libavcodec/jpegls.h b/libavcodec/jpegls.h
index aac67bbe31..ebf9159371 100644
--- a/libavcodec/jpegls.h
+++ b/libavcodec/jpegls.h
@@ -28,9 +28,8 @@ 
 #ifndef AVCODEC_JPEGLS_H
 #define AVCODEC_JPEGLS_H
 
+#include <limits.h>
 #include "libavutil/common.h"
-#include "avcodec.h"
-#include "internal.h"
 
 #undef near /* This file uses struct member 'near' which in windows.h is defined as empty. */
 
diff --git a/libavcodec/lossless_audiodsp.c b/libavcodec/lossless_audiodsp.c
index 378165924d..274ab5a854 100644
--- a/libavcodec/lossless_audiodsp.c
+++ b/libavcodec/lossless_audiodsp.c
@@ -20,7 +20,8 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "avcodec.h"
+#include "config.h"
+#include "libavutil/attributes.h"
 #include "lossless_audiodsp.h"
 
 static int32_t scalarproduct_and_madd_int16_c(int16_t *v1, const int16_t *v2,
diff --git a/libavcodec/lossless_videoencdsp.h b/libavcodec/lossless_videoencdsp.h
index faa6c32551..7794f03e3f 100644
--- a/libavcodec/lossless_videoencdsp.h
+++ b/libavcodec/lossless_videoencdsp.h
@@ -19,10 +19,9 @@ 
 #ifndef AVCODEC_LOSSLESS_VIDEOENCDSP_H
 #define AVCODEC_LOSSLESS_VIDEOENCDSP_H
 
+#include <stddef.h>
 #include <stdint.h>
 
-#include "avcodec.h"
-
 typedef struct LLVidEncDSPContext {
     void (*diff_bytes)(uint8_t *dst /* align 16 */,
                        const uint8_t *src1 /* align 16 */,
diff --git a/libavcodec/lsp.c b/libavcodec/lsp.c
index fb4da47894..29055fd478 100644
--- a/libavcodec/lsp.c
+++ b/libavcodec/lsp.c
@@ -23,8 +23,8 @@ 
 
 #include <inttypes.h>
 
-#include "avcodec.h"
 #define FRAC_BITS 14
+#include "libavutil/common.h"
 #include "mathops.h"
 #include "lsp.h"
 #include "libavcodec/mips/lsp_mips.h"
diff --git a/libavcodec/lzw.c b/libavcodec/lzw.c
index e26e4829ee..a917263682 100644
--- a/libavcodec/lzw.c
+++ b/libavcodec/lzw.c
@@ -27,7 +27,7 @@ 
  * @author modified for use in TIFF by Konstantin Shishkov
  */
 
-#include "avcodec.h"
+#include "libavutil/attributes.h"
 #include "bytestream.h"
 #include "lzw.h"
 #include "libavutil/mem.h"
diff --git a/libavcodec/lzwenc.c b/libavcodec/lzwenc.c
index 6c45f7cc37..bb8eb2e1dd 100644
--- a/libavcodec/lzwenc.c
+++ b/libavcodec/lzwenc.c
@@ -25,9 +25,10 @@ 
  * @author Bartlomiej Wolowiec
  */
 
-#include "avcodec.h"
+#include <stdint.h>
+#include "libavutil/avassert.h"
+#include "libavutil/common.h"
 #include "lzw.h"
-#include "mathops.h"
 #include "put_bits.h"
 
 #define LZW_MAXBITS 12
diff --git a/libavcodec/mlp.h b/libavcodec/mlp.h
index 41a45a30d8..5b7d8c8cac 100644
--- a/libavcodec/mlp.h
+++ b/libavcodec/mlp.h
@@ -24,8 +24,6 @@ 
 
 #include <stdint.h>
 
-#include "avcodec.h"
-
 /** Last possible matrix channel for each codec */
 #define MAX_MATRIX_CHANNEL_MLP      5
 #define MAX_MATRIX_CHANNEL_TRUEHD   7
diff --git a/libavcodec/mpc.c b/libavcodec/mpc.c
index e29b823460..6aa3e80927 100644
--- a/libavcodec/mpc.c
+++ b/libavcodec/mpc.c
@@ -26,10 +26,9 @@ 
  * divided into 32 subbands.
  */
 
-#include "libavutil/attributes.h"
-#include "avcodec.h"
+#include <string.h>
+#include "libavutil/intmath.h"
 #include "mpegaudiodsp.h"
-#include "mpegaudio.h"
 
 #include "mpc.h"
 #include "mpcdata.h"
diff --git a/libavcodec/mpc.h b/libavcodec/mpc.h
index f8093796a3..cef8db4899 100644
--- a/libavcodec/mpc.h
+++ b/libavcodec/mpc.h
@@ -29,10 +29,11 @@ 
 #ifndef AVCODEC_MPC_H
 #define AVCODEC_MPC_H
 
+#include <stdint.h>
+
 #include "libavutil/lfg.h"
 #include "libavutil/mem_internal.h"
 
-#include "avcodec.h"
 #include "bswapdsp.h"
 #include "mpegaudio.h"
 #include "mpegaudiodsp.h"
diff --git a/libavcodec/mpegaudiodecheader.c b/libavcodec/mpegaudiodecheader.c
index 6cc79f18b5..93c5f3d8f8 100644
--- a/libavcodec/mpegaudiodecheader.c
+++ b/libavcodec/mpegaudiodecheader.c
@@ -26,8 +26,6 @@ 
 
 #include "libavutil/common.h"
 
-#include "avcodec.h"
-#include "internal.h"
 #include "mpegaudio.h"
 #include "mpegaudiodata.h"
 #include "mpegaudiodecheader.h"
diff --git a/libavcodec/mpegaudiodecheader.h b/libavcodec/mpegaudiodecheader.h
index 1da2a4cb6f..ed5d1f3b33 100644
--- a/libavcodec/mpegaudiodecheader.h
+++ b/libavcodec/mpegaudiodecheader.h
@@ -27,7 +27,8 @@ 
 #ifndef AVCODEC_MPEGAUDIODECHEADER_H
 #define AVCODEC_MPEGAUDIODECHEADER_H
 
-#include "avcodec.h"
+#include <stdint.h>
+#include "codec_id.h"
 
 #define MP3_MASK 0xFFFE0CCF
 
diff --git a/libavcodec/nellymoser.c b/libavcodec/nellymoser.c
index 5ff6583c5e..66c5f83a56 100644
--- a/libavcodec/nellymoser.c
+++ b/libavcodec/nellymoser.c
@@ -31,9 +31,11 @@ 
  * implementors. The original code is available from http://code.google.com/p/nelly2pcm/
  */
 
+#include <stdlib.h>
+
+#include "libavutil/intmath.h"
 #include "libavutil/common.h"
 
-#include "avcodec.h"
 #include "nellymoser.h"
 
 const float ff_nelly_dequantization_table[127] = {
diff --git a/libavcodec/nellymoser.h b/libavcodec/nellymoser.h
index 027fc7ed23..6d032c97be 100644
--- a/libavcodec/nellymoser.h
+++ b/libavcodec/nellymoser.h
@@ -34,7 +34,7 @@ 
 #ifndef AVCODEC_NELLYMOSER_H
 #define AVCODEC_NELLYMOSER_H
 
-#include "avcodec.h"
+#include <stdint.h>
 
 #define NELLY_BANDS       23
 #define NELLY_BLOCK_LEN   64
diff --git a/libavcodec/pcm_rechunk_bsf.c b/libavcodec/pcm_rechunk_bsf.c
index 32a90cd2f7..7cf763359d 100644
--- a/libavcodec/pcm_rechunk_bsf.c
+++ b/libavcodec/pcm_rechunk_bsf.c
@@ -18,7 +18,6 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "avcodec.h"
 #include "bsf.h"
 #include "bsf_internal.h"
 #include "libavutil/avassert.h"
diff --git a/libavcodec/png.c b/libavcodec/png.c
index ef52b51bd4..4ea286075d 100644
--- a/libavcodec/png.c
+++ b/libavcodec/png.c
@@ -18,7 +18,9 @@ 
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-#include "avcodec.h"
+
+#include <stdint.h>
+#include "libavutil/mem.h"
 #include "png.h"
 
 /* Mask to determine which y pixels are valid in a pass */
diff --git a/libavcodec/rangecoder.c b/libavcodec/rangecoder.c
index fa7d5526d1..510dab2c29 100644
--- a/libavcodec/rangecoder.c
+++ b/libavcodec/rangecoder.c
@@ -34,9 +34,9 @@ 
 
 #include "libavutil/attributes.h"
 #include "libavutil/avassert.h"
+#include "libavutil/bswap.h"
 #include "libavutil/intreadwrite.h"
 
-#include "avcodec.h"
 #include "rangecoder.h"
 
 av_cold void ff_init_range_encoder(RangeCoder *c, uint8_t *buf, int buf_size)
diff --git a/libavcodec/raw.h b/libavcodec/raw.h
index 28a27b1f9e..6a041690b1 100644
--- a/libavcodec/raw.h
+++ b/libavcodec/raw.h
@@ -27,9 +27,8 @@ 
 #ifndef AVCODEC_RAW_H
 #define AVCODEC_RAW_H
 
-#include "avcodec.h"
+#include "libavutil/pixfmt.h"
 #include "internal.h"
-#include "libavutil/internal.h"
 
 typedef struct PixelFormatTag {
     enum AVPixelFormat pix_fmt;
diff --git a/libavcodec/rle.c b/libavcodec/rle.c
index 792bc05e5d..1ef6077a6b 100644
--- a/libavcodec/rle.c
+++ b/libavcodec/rle.c
@@ -19,9 +19,10 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <string.h>
+
 #include "libavutil/common.h"
 
-#include "avcodec.h"
 #include "rle.h"
 
 int ff_rle_count_pixels(const uint8_t *start, int len, int bpp, int same)
diff --git a/libavcodec/roqvideo.c b/libavcodec/roqvideo.c
index 8eda93c13c..f9a3c8e083 100644
--- a/libavcodec/roqvideo.c
+++ b/libavcodec/roqvideo.c
@@ -24,7 +24,8 @@ 
  * id RoQ Video common functions based on work by Dr. Tim Ferguson
  */
 
-#include "avcodec.h"
+#include <stdint.h>
+#include <string.h>
 #include "roqvideo.h"
 
 static inline void block_copy(unsigned char *out, unsigned char *in,
diff --git a/libavcodec/rv30dsp.c b/libavcodec/rv30dsp.c
index 8b205e09b6..c2624a9113 100644
--- a/libavcodec/rv30dsp.c
+++ b/libavcodec/rv30dsp.c
@@ -24,10 +24,13 @@ 
  * RV30 decoder motion compensation functions
  */
 
-#include "avcodec.h"
+#include <stddef.h>
+#include <stdint.h>
+#include "libavutil/attributes.h"
 #include "h264chroma.h"
 #include "h264qpel.h"
 #include "mathops.h"
+#include "qpeldsp.h"
 #include "rv34dsp.h"
 
 #define RV30_LOWPASS(OPNAME, OP) \
diff --git a/libavcodec/rv40dsp.c b/libavcodec/rv40dsp.c
index 2ac791d674..414c4d30b1 100644
--- a/libavcodec/rv40dsp.c
+++ b/libavcodec/rv40dsp.c
@@ -26,7 +26,6 @@ 
 
 #include "libavutil/common.h"
 #include "libavutil/intreadwrite.h"
-#include "avcodec.h"
 #include "h264qpel.h"
 #include "mathops.h"
 #include "pixels.h"
diff --git a/libavcodec/sbc.c b/libavcodec/sbc.c
index b43b66e3f5..47d88f28df 100644
--- a/libavcodec/sbc.c
+++ b/libavcodec/sbc.c
@@ -30,7 +30,6 @@ 
  * SBC common functions for the encoder and decoder
  */
 
-#include "avcodec.h"
 #include "sbc.h"
 
 /* A2DP specification: Appendix B, page 69 */
diff --git a/libavcodec/sbc.h b/libavcodec/sbc.h
index 419c8eab90..0a54f1fbbc 100644
--- a/libavcodec/sbc.h
+++ b/libavcodec/sbc.h
@@ -33,7 +33,8 @@ 
 #ifndef AVCODEC_SBC_H
 #define AVCODEC_SBC_H
 
-#include "avcodec.h"
+#include <stddef.h>
+#include <stdint.h>
 #include "libavutil/crc.h"
 #include "libavutil/mem_internal.h"
 
diff --git a/libavcodec/setts_bsf.c b/libavcodec/setts_bsf.c
index 2558e38f51..318913c7fe 100644
--- a/libavcodec/setts_bsf.c
+++ b/libavcodec/setts_bsf.c
@@ -26,7 +26,6 @@ 
 #include "libavutil/opt.h"
 #include "libavutil/eval.h"
 
-#include "avcodec.h"
 #include "bsf.h"
 #include "bsf_internal.h"
 
diff --git a/libavcodec/simple_idct.c b/libavcodec/simple_idct.c
index 0ef167491a..eb13cff146 100644
--- a/libavcodec/simple_idct.c
+++ b/libavcodec/simple_idct.c
@@ -26,7 +26,6 @@ 
  */
 
 #include "libavutil/intreadwrite.h"
-#include "avcodec.h"
 #include "mathops.h"
 #include "simple_idct.h"
 
diff --git a/libavcodec/tiff_common.c b/libavcodec/tiff_common.c
index 0af62ee962..b3c6b96b57 100644
--- a/libavcodec/tiff_common.c
+++ b/libavcodec/tiff_common.c
@@ -25,6 +25,7 @@ 
  * @author Thilo Borgmann <thilo.borgmann _at_ mail.de>
  */
 
+#include "libavutil/bprint.h"
 #include "tiff_common.h"
 
 
diff --git a/libavcodec/tiff_common.h b/libavcodec/tiff_common.h
index 019d23e6d5..e429b8eaeb 100644
--- a/libavcodec/tiff_common.h
+++ b/libavcodec/tiff_common.h
@@ -28,10 +28,9 @@ 
 #ifndef AVCODEC_TIFF_COMMON_H
 #define AVCODEC_TIFF_COMMON_H
 
-#include "avcodec.h"
-#include "tiff.h"
+#include <stdint.h>
+#include "libavutil/dict.h"
 #include "bytestream.h"
-#include "libavutil/bprint.h"
 
 /** data type identifiers for TIFF tags */
 enum TiffTypes {
diff --git a/libavcodec/v4l2_buffers.h b/libavcodec/v4l2_buffers.h
index 8dbc7fc104..3d2ff1b9a5 100644
--- a/libavcodec/v4l2_buffers.h
+++ b/libavcodec/v4l2_buffers.h
@@ -25,9 +25,12 @@ 
 #define AVCODEC_V4L2_BUFFERS_H
 
 #include <stdatomic.h>
+#include <stddef.h>
 #include <linux/videodev2.h>
 
-#include "avcodec.h"
+#include "libavutil/buffer.h"
+#include "libavutil/frame.h"
+#include "packet.h"
 
 enum V4L2Buffer_status {
     V4L2BUF_AVAILABLE,
diff --git a/libavcodec/v4l2_context.h b/libavcodec/v4l2_context.h
index 22a9532444..6f7460c89a 100644
--- a/libavcodec/v4l2_context.h
+++ b/libavcodec/v4l2_context.h
@@ -24,13 +24,14 @@ 
 #ifndef AVCODEC_V4L2_CONTEXT_H
 #define AVCODEC_V4L2_CONTEXT_H
 
-#include <stdatomic.h>
+#include <stdint.h>
 #include <linux/videodev2.h>
 
-#include "libavcodec/avcodec.h"
 #include "libavutil/pixfmt.h"
 #include "libavutil/frame.h"
-#include "libavutil/buffer.h"
+#include "libavutil/rational.h"
+#include "codec_id.h"
+#include "packet.h"
 #include "v4l2_buffers.h"
 
 typedef struct V4L2Context {
diff --git a/libavcodec/v4l2_fmt.h b/libavcodec/v4l2_fmt.h
index 01360029c8..577e03a7a7 100644
--- a/libavcodec/v4l2_fmt.h
+++ b/libavcodec/v4l2_fmt.h
@@ -24,8 +24,9 @@ 
 #ifndef AVCODEC_V4L2_FMT_H
 #define AVCODEC_V4L2_FMT_H
 
-#include "libavcodec/avcodec.h"
+#include <stdint.h>
 #include "libavutil/pixfmt.h"
+#include "codec_id.h"
 
 enum AVPixelFormat ff_v4l2_format_v4l2_to_avfmt(uint32_t v4l2_fmt, enum AVCodecID avcodec);
 uint32_t ff_v4l2_format_avcodec_to_v4l2(enum AVCodecID avcodec);
diff --git a/libavcodec/vc1data.c b/libavcodec/vc1data.c
index 19f1cad45f..844bc0f5c5 100644
--- a/libavcodec/vc1data.c
+++ b/libavcodec/vc1data.c
@@ -26,9 +26,9 @@ 
  * VC-1 tables.
  */
 
-#include "avcodec.h"
 #include "vc1.h"
 #include "vc1data.h"
+#include "vlc.h"
 
 /** Table for conversion between TTBLK and TTMB */
 const int ff_vc1_ttblk_to_tt[3][8] = {
diff --git a/libavcodec/vp3dsp.c b/libavcodec/vp3dsp.c
index ec859a679d..f06834f42e 100644
--- a/libavcodec/vp3dsp.c
+++ b/libavcodec/vp3dsp.c
@@ -24,12 +24,15 @@ 
  * source code.
  */
 
+#include <string.h>
+
+#include "config.h"
 #include "libavutil/attributes.h"
 #include "libavutil/common.h"
+#include "libavutil/internal.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/avassert.h"
 
-#include "avcodec.h"
 #include "rnd_avg.h"
 #include "vp3dsp.h"
 
diff --git a/libavcodec/vp56dsp.c b/libavcodec/vp56dsp.c
index e8d93d6680..de6803e0fb 100644
--- a/libavcodec/vp56dsp.c
+++ b/libavcodec/vp56dsp.c
@@ -21,8 +21,8 @@ 
 
 #include <stdint.h>
 
+#include "config.h"
 #include "libavutil/attributes.h"
-#include "avcodec.h"
 #include "vp56dsp.h"
 #include "libavutil/common.h"
 
diff --git a/libavcodec/vp9block.c b/libavcodec/vp9block.c
index ec16e26c69..5e6cded2bc 100644
--- a/libavcodec/vp9block.c
+++ b/libavcodec/vp9block.c
@@ -23,9 +23,6 @@ 
 
 #include "libavutil/avassert.h"
 
-#include "avcodec.h"
-#include "internal.h"
-#include "videodsp.h"
 #include "vp56.h"
 #include "vp9.h"
 #include "vp9data.h"
diff --git a/libavcodec/vp9recon.c b/libavcodec/vp9recon.c
index e38cf99ec5..503091e545 100644
--- a/libavcodec/vp9recon.c
+++ b/libavcodec/vp9recon.c
@@ -24,8 +24,6 @@ 
 #include "libavutil/avassert.h"
 #include "libavutil/mem_internal.h"
 
-#include "avcodec.h"
-#include "internal.h"
 #include "videodsp.h"
 #include "vp9data.h"
 #include "vp9dec.h"
diff --git a/libavcodec/wmv2.h b/libavcodec/wmv2.h
index f425332c9a..1798dbabcd 100644
--- a/libavcodec/wmv2.h
+++ b/libavcodec/wmv2.h
@@ -23,7 +23,6 @@ 
 
 #include "libavutil/mem_internal.h"
 
-#include "avcodec.h"
 #include "intrax8.h"
 #include "mpegvideo.h"
 #include "wmv2dsp.h"
diff --git a/libavcodec/wmv2dsp.c b/libavcodec/wmv2dsp.c
index 543f01b852..3bd482176a 100644
--- a/libavcodec/wmv2dsp.c
+++ b/libavcodec/wmv2dsp.c
@@ -16,11 +16,12 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "config.h"
 #include "libavutil/attributes.h"
 #include "libavutil/common.h"
-#include "avcodec.h"
 #include "idctdsp.h"
 #include "mathops.h"
+#include "qpeldsp.h"
 #include "wmv2dsp.h"
 
 #define W0 2048
diff --git a/libavcodec/x86/cfhddsp_init.c b/libavcodec/x86/cfhddsp_init.c
index ab7ff83087..c5d89561ae 100644
--- a/libavcodec/x86/cfhddsp_init.c
+++ b/libavcodec/x86/cfhddsp_init.c
@@ -18,12 +18,13 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <stddef.h>
 #include <stdint.h>
 
+#include "config.h"
 #include "libavutil/attributes.h"
 #include "libavutil/cpu.h"
 #include "libavutil/x86/cpu.h"
-#include "libavcodec/avcodec.h"
 #include "libavcodec/cfhddsp.h"
 
 void ff_cfhd_horiz_filter_sse2(int16_t *output, ptrdiff_t out_stride,
diff --git a/libavcodec/x86/cfhdencdsp_init.c b/libavcodec/x86/cfhdencdsp_init.c
index 28f1dd504d..1e3586e08c 100644
--- a/libavcodec/x86/cfhdencdsp_init.c
+++ b/libavcodec/x86/cfhdencdsp_init.c
@@ -18,12 +18,13 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <stddef.h>
 #include <stdint.h>
 
+#include "config.h"
 #include "libavutil/attributes.h"
 #include "libavutil/cpu.h"
 #include "libavutil/x86/cpu.h"
-#include "libavcodec/avcodec.h"
 #include "libavcodec/cfhdencdsp.h"
 
 void ff_cfhdenc_horiz_filter_sse2(int16_t *input, int16_t *low, int16_t *high,
diff --git a/libavcodec/x86/h264_intrapred_init.c b/libavcodec/x86/h264_intrapred_init.c
index bdd5125d68..a95cfbca55 100644
--- a/libavcodec/x86/h264_intrapred_init.c
+++ b/libavcodec/x86/h264_intrapred_init.c
@@ -18,10 +18,13 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <stddef.h>
+#include <stdint.h>
+#include "config.h"
 #include "libavutil/attributes.h"
 #include "libavutil/cpu.h"
 #include "libavutil/x86/cpu.h"
-#include "libavcodec/avcodec.h"
+#include "libavcodec/codec_id.h"
 #include "libavcodec/h264pred.h"
 
 #define PRED4x4(TYPE, DEPTH, OPT) \
diff --git a/libavcodec/x86/mlpdsp_init.c b/libavcodec/x86/mlpdsp_init.c
index cb90ca24f0..950f996832 100644
--- a/libavcodec/x86/mlpdsp_init.c
+++ b/libavcodec/x86/mlpdsp_init.c
@@ -19,8 +19,11 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <stdint.h>
+#include "config.h"
 #include "libavutil/attributes.h"
 #include "libavutil/cpu.h"
+#include "libavutil/macros.h"
 #include "libavutil/x86/asm.h"
 #include "libavutil/x86/cpu.h"
 #include "libavcodec/mlpdsp.h"
diff --git a/libavcodec/x86/snowdsp.c b/libavcodec/x86/snowdsp.c
index 84bc74f915..bca1f9bd2e 100644
--- a/libavcodec/x86/snowdsp.c
+++ b/libavcodec/x86/snowdsp.c
@@ -19,10 +19,11 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <stdint.h>
+#include "config.h"
 #include "libavutil/attributes.h"
 #include "libavutil/cpu.h"
 #include "libavutil/x86/asm.h"
-#include "libavcodec/avcodec.h"
 #include "libavcodec/snow.h"
 #include "libavcodec/snow_dwt.h"
 
diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c
index 22b7595ab1..2ae26ab8e3 100644
--- a/libavdevice/avdevice.c
+++ b/libavdevice/avdevice.c
@@ -19,7 +19,6 @@ 
 #include "libavutil/avassert.h"
 #include "libavutil/samplefmt.h"
 #include "libavutil/pixfmt.h"
-#include "libavcodec/avcodec.h"
 #include "avdevice.h"
 #include "internal.h"
 #include "config.h"
diff --git a/libavdevice/oss.c b/libavdevice/oss.c
index d92cde3313..eddc2ddf1a 100644
--- a/libavdevice/oss.c
+++ b/libavdevice/oss.c
@@ -32,7 +32,6 @@ 
 
 #include "libavutil/log.h"
 
-#include "libavcodec/avcodec.h"
 #include "avdevice.h"
 
 #include "oss.h"
diff --git a/libavdevice/oss.h b/libavdevice/oss.h
index 1f3f5e4e83..66d1a34cf6 100644
--- a/libavdevice/oss.h
+++ b/libavdevice/oss.h
@@ -19,8 +19,9 @@ 
 #ifndef AVDEVICE_OSS_H
 #define AVDEVICE_OSS_H
 
-#include "libavcodec/avcodec.h"
-
+#include <stdint.h>
+#include "libavutil/log.h"
+#include "libavcodec/codec_id.h"
 #include "libavformat/avformat.h"
 
 #define OSS_AUDIO_BLOCK_SIZE 4096
diff --git a/libavdevice/oss_dec.c b/libavdevice/oss_dec.c
index 34efb6b184..4f3772c1f5 100644
--- a/libavdevice/oss_dec.c
+++ b/libavdevice/oss_dec.c
@@ -34,8 +34,6 @@ 
 #include "libavutil/opt.h"
 #include "libavutil/time.h"
 
-#include "libavcodec/avcodec.h"
-
 #include "avdevice.h"
 #include "libavformat/internal.h"
 
diff --git a/libavdevice/oss_enc.c b/libavdevice/oss_enc.c
index 6c1bc042c1..3103d2de9a 100644
--- a/libavdevice/oss_enc.c
+++ b/libavdevice/oss_enc.c
@@ -30,8 +30,6 @@ 
 
 #include "libavutil/internal.h"
 
-#include "libavcodec/avcodec.h"
-
 #include "avdevice.h"
 #include "libavformat/internal.h"
 
diff --git a/libavfilter/af_ashowinfo.c b/libavfilter/af_ashowinfo.c
index 652197b2d1..db8aa029c4 100644
--- a/libavfilter/af_ashowinfo.c
+++ b/libavfilter/af_ashowinfo.c
@@ -37,8 +37,6 @@ 
 #include "libavutil/timestamp.h"
 #include "libavutil/samplefmt.h"
 
-#include "libavcodec/avcodec.h"
-
 #include "audio.h"
 #include "avfilter.h"
 #include "internal.h"
diff --git a/libavformat/mxf.c b/libavformat/mxf.c
index 7c355d789b..36d662b58c 100644
--- a/libavformat/mxf.c
+++ b/libavformat/mxf.c
@@ -20,6 +20,7 @@ 
  */
 
 #include "libavutil/common.h"
+#include "libavcodec/codec_id.h"
 #include "mxf.h"
 
 const uint8_t ff_mxf_random_index_pack_key[16] = { 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x11,0x01,0x00 };
diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index b1b1fedac7..eb473d8a55 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -21,9 +21,10 @@ 
 #ifndef AVFORMAT_MXF_H
 #define AVFORMAT_MXF_H
 
-#include "avformat.h"
-#include "libavcodec/avcodec.h"
 #include <stdint.h>
+#include "libavutil/log.h"
+#include "libavutil/pixfmt.h"
+#include "libavutil/rational.h"
 
 typedef uint8_t UID[16];
 
diff --git a/libavformat/riff.c b/libavformat/riff.c
index 270ff7c024..423926e3bd 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -20,9 +20,10 @@ 
  */
 
 #include "config.h"
-#include "libavutil/error.h"
-#include "libavcodec/avcodec.h"
+#include "libavutil/common.h"
 #include "avformat.h"
+#include "internal.h"
+#include "metadata.h"
 #include "riff.h"
 
 /* Note: When encoding, the first matching tag is used, so order is
diff --git a/libavformat/riff.h b/libavformat/riff.h
index 0548279c6b..85d6786663 100644
--- a/libavformat/riff.h
+++ b/libavformat/riff.h
@@ -28,7 +28,6 @@ 
 #ifndef AVFORMAT_RIFF_H
 #define AVFORMAT_RIFF_H
 
-#include "libavcodec/avcodec.h"
 #include "avio.h"
 #include "internal.h"
 #include "metadata.h"
diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c
index 533bb5a15d..444b9fc00d 100644
--- a/libavformat/riffdec.c
+++ b/libavformat/riffdec.c
@@ -19,12 +19,11 @@ 
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/avassert.h"
 #include "libavutil/dict.h"
 #include "libavutil/error.h"
+#include "libavutil/intreadwrite.h"
 #include "libavutil/log.h"
-#include "libavutil/mathematics.h"
-#include "libavcodec/avcodec.h"
-#include "libavcodec/bytestream.h"
 #include "avformat.h"
 #include "avio_internal.h"
 #include "riff.h"
diff --git a/libavformat/rtp.h b/libavformat/rtp.h
index 54512c6f71..389b824223 100644
--- a/libavformat/rtp.h
+++ b/libavformat/rtp.h
@@ -21,9 +21,11 @@ 
 #ifndef AVFORMAT_RTP_H
 #define AVFORMAT_RTP_H
 
+#include <stdint.h>
+#include "libavutil/avutil.h"
+#include "libavcodec/codec_id.h"
+#include "libavcodec/codec_par.h"
 #include "libavformat/avformat.h"
-#include "libavcodec/avcodec.h"
-#include "libavutil/mathematics.h"
 
 /**
  * Return the payload type for a given stream used in the given format context.
diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h
index 701ce072b6..d54a05869f 100644
--- a/libavformat/rtpdec.h
+++ b/libavformat/rtpdec.h
@@ -23,7 +23,8 @@ 
 #ifndef AVFORMAT_RTPDEC_H
 #define AVFORMAT_RTPDEC_H
 
-#include "libavcodec/avcodec.h"
+#include "libavcodec/codec_id.h"
+#include "libavcodec/packet.h"
 #include "avformat.h"
 #include "rtp.h"
 #include "url.h"
diff --git a/libavformat/rtpdec_qdm2.c b/libavformat/rtpdec_qdm2.c
index 1eec2da5b4..dce3c48bcc 100644
--- a/libavformat/rtpdec_qdm2.c
+++ b/libavformat/rtpdec_qdm2.c
@@ -28,7 +28,6 @@ 
 #include <string.h>
 #include "libavutil/avassert.h"
 #include "libavutil/intreadwrite.h"
-#include "libavcodec/avcodec.h"
 #include "internal.h"
 #include "rtp.h"
 #include "rtpdec.h"
diff --git a/libavformat/vpcc.c b/libavformat/vpcc.c
index e0b7f288a6..8b4f913b5d 100644
--- a/libavformat/vpcc.c
+++ b/libavformat/vpcc.c
@@ -21,6 +21,7 @@ 
 
 #include "libavutil/pixdesc.h"
 #include "libavutil/pixfmt.h"
+#include "libavcodec/avcodec.h"
 #include "vpcc.h"
 
 enum VPX_CHROMA_SUBSAMPLING
diff --git a/libavformat/vpcc.h b/libavformat/vpcc.h
index e87bec55c2..f05b2f58b3 100644
--- a/libavformat/vpcc.h
+++ b/libavformat/vpcc.h
@@ -27,10 +27,10 @@ 
 #ifndef AVFORMAT_VPCC_H
 #define AVFORMAT_VPCC_H
 
-#include <stdint.h>
+#include "libavutil/rational.h"
+#include "libavcodec/codec_par.h"
 #include "avio.h"
 #include "avformat.h"
-#include "libavcodec/avcodec.h"
 
 typedef struct VPCC {
     int profile;