[FFmpeg-cvslog] avcodec/idctdsp: Avoid inclusion of avcodec.h

Andreas Rheinhardt git at videolan.org
Mon Sep 11 02:02:26 EEST 2023


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Fri Sep  8 13:41:33 2023 +0200| [a84fe06112af4929a4f3d993373b4f3cf2725f9a] | committer: Andreas Rheinhardt

avcodec/idctdsp: Avoid inclusion of avcodec.h

Not every user of idctdsp.h wants to initialize an IDCTDSPContext;
e.g. the proresdsp only uses ff_init_scantable_permutation()
and the IDCT permutation enum; similarly for cavsdsp and wmv2dsp.
Using a forward declaration here avoids an avcodec.h dependency
in the relevant files.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a84fe06112af4929a4f3d993373b4f3cf2725f9a
---

 libavcodec/alpha/idctdsp_alpha.c |  1 +
 libavcodec/idctdsp.h             | 21 +++++++++++----------
 libavcodec/ppc/idctdsp.c         |  1 +
 libavcodec/rtjpeg.c              |  2 +-
 libavcodec/rtjpeg.h              |  4 +++-
 tests/checkasm/idctdsp.c         |  1 +
 6 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/libavcodec/alpha/idctdsp_alpha.c b/libavcodec/alpha/idctdsp_alpha.c
index bd43842535..ff770c15fd 100644
--- a/libavcodec/alpha/idctdsp_alpha.c
+++ b/libavcodec/alpha/idctdsp_alpha.c
@@ -19,6 +19,7 @@
  */
 
 #include "libavutil/attributes.h"
+#include "libavcodec/avcodec.h"
 #include "libavcodec/idctdsp.h"
 #include "idctdsp_alpha.h"
 #include "asm.h"
diff --git a/libavcodec/idctdsp.h b/libavcodec/idctdsp.h
index 7224463349..c840a5186f 100644
--- a/libavcodec/idctdsp.h
+++ b/libavcodec/idctdsp.h
@@ -19,11 +19,12 @@
 #ifndef AVCODEC_IDCTDSP_H
 #define AVCODEC_IDCTDSP_H
 
+#include <stddef.h>
 #include <stdint.h>
 
 #include "config.h"
 
-#include "avcodec.h"
+struct AVCodecContext;
 
 enum idct_permutation_type {
     FF_IDCT_PERM_NONE,
@@ -95,23 +96,23 @@ void ff_put_pixels_clamped_c(const int16_t *block, uint8_t *av_restrict pixels,
 void ff_add_pixels_clamped_c(const int16_t *block, uint8_t *av_restrict pixels,
                              ptrdiff_t line_size);
 
-void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx);
+void ff_idctdsp_init(IDCTDSPContext *c, struct AVCodecContext *avctx);
 
-void ff_idctdsp_init_aarch64(IDCTDSPContext *c, AVCodecContext *avctx,
+void ff_idctdsp_init_aarch64(IDCTDSPContext *c, struct AVCodecContext *avctx,
                              unsigned high_bit_depth);
-void ff_idctdsp_init_alpha(IDCTDSPContext *c, AVCodecContext *avctx,
+void ff_idctdsp_init_alpha(IDCTDSPContext *c, struct AVCodecContext *avctx,
                            unsigned high_bit_depth);
-void ff_idctdsp_init_arm(IDCTDSPContext *c, AVCodecContext *avctx,
+void ff_idctdsp_init_arm(IDCTDSPContext *c, struct AVCodecContext *avctx,
                          unsigned high_bit_depth);
-void ff_idctdsp_init_ppc(IDCTDSPContext *c, AVCodecContext *avctx,
+void ff_idctdsp_init_ppc(IDCTDSPContext *c, struct AVCodecContext *avctx,
                          unsigned high_bit_depth);
-void ff_idctdsp_init_riscv(IDCTDSPContext *c, AVCodecContext *avctx,
+void ff_idctdsp_init_riscv(IDCTDSPContext *c, struct AVCodecContext *avctx,
                            unsigned high_bit_depth);
-void ff_idctdsp_init_x86(IDCTDSPContext *c, AVCodecContext *avctx,
+void ff_idctdsp_init_x86(IDCTDSPContext *c, struct AVCodecContext *avctx,
                          unsigned high_bit_depth);
-void ff_idctdsp_init_mips(IDCTDSPContext *c, AVCodecContext *avctx,
+void ff_idctdsp_init_mips(IDCTDSPContext *c, struct AVCodecContext *avctx,
                           unsigned high_bit_depth);
-void ff_idctdsp_init_loongarch(IDCTDSPContext *c, AVCodecContext *avctx,
+void ff_idctdsp_init_loongarch(IDCTDSPContext *c, struct AVCodecContext *avctx,
                                unsigned high_bit_depth);
 
 #endif /* AVCODEC_IDCTDSP_H */
diff --git a/libavcodec/ppc/idctdsp.c b/libavcodec/ppc/idctdsp.c
index 29f625a01c..a7acbc5ead 100644
--- a/libavcodec/ppc/idctdsp.c
+++ b/libavcodec/ppc/idctdsp.c
@@ -40,6 +40,7 @@
 #include "libavutil/ppc/cpu.h"
 #include "libavutil/ppc/util_altivec.h"
 
+#include "libavcodec/avcodec.h"
 #include "libavcodec/idctdsp.h"
 
 #if HAVE_ALTIVEC
diff --git a/libavcodec/rtjpeg.c b/libavcodec/rtjpeg.c
index 8e02bce2e8..734e3875da 100644
--- a/libavcodec/rtjpeg.c
+++ b/libavcodec/rtjpeg.c
@@ -167,7 +167,7 @@ void ff_rtjpeg_decode_init(RTJpegContext *c, int width, int height,
     c->h = height;
 }
 
-void ff_rtjpeg_init(RTJpegContext *c, AVCodecContext *avctx)
+void ff_rtjpeg_init(RTJpegContext *c, struct AVCodecContext *avctx)
 {
     int i;
 
diff --git a/libavcodec/rtjpeg.h b/libavcodec/rtjpeg.h
index d4dc074408..14befb5489 100644
--- a/libavcodec/rtjpeg.h
+++ b/libavcodec/rtjpeg.h
@@ -24,6 +24,7 @@
 
 #include <stdint.h>
 
+#include "libavutil/frame.h"
 #include "libavutil/mem_internal.h"
 #include "idctdsp.h"
 
@@ -39,7 +40,8 @@ typedef struct RTJpegContext {
     DECLARE_ALIGNED(16, int16_t, block)[64];
 } RTJpegContext;
 
-void ff_rtjpeg_init(RTJpegContext *c, AVCodecContext *avctx);
+struct AVCodecContext;
+void ff_rtjpeg_init(RTJpegContext *c, struct AVCodecContext *avctx);
 
 void ff_rtjpeg_decode_init(RTJpegContext *c, int width, int height,
                            const uint32_t *lquant, const uint32_t *cquant);
diff --git a/tests/checkasm/idctdsp.c b/tests/checkasm/idctdsp.c
index c06e607d99..05aeddea45 100644
--- a/tests/checkasm/idctdsp.c
+++ b/tests/checkasm/idctdsp.c
@@ -22,6 +22,7 @@
 
 #include "checkasm.h"
 
+#include "libavcodec/avcodec.h"
 #include "libavcodec/idctdsp.h"
 
 #include "libavutil/common.h"



More information about the ffmpeg-cvslog mailing list