[FFmpeg-devel] [PATCH 2/3] avcodec/blockdsp: Remove unused AVCodecContext parameter

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Tue Sep 20 04:31:29 EEST 2022


Possible since be95df12bb06b183c8d2aea3b0831fdf05466cf3.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/4xm.c               | 2 +-
 libavcodec/asvdec.c            | 2 +-
 libavcodec/bink.c              | 2 +-
 libavcodec/blockdsp.c          | 5 ++---
 libavcodec/blockdsp.h          | 6 ++----
 libavcodec/cavs.c              | 2 +-
 libavcodec/dnxhddec.c          | 2 +-
 libavcodec/dnxhdenc.c          | 2 +-
 libavcodec/eamad.c             | 2 +-
 libavcodec/eatqi.c             | 2 +-
 libavcodec/g2meet.c            | 2 +-
 libavcodec/intrax8.c           | 2 +-
 libavcodec/jvdec.c             | 2 +-
 libavcodec/mdec.c              | 2 +-
 libavcodec/mimic.c             | 2 +-
 libavcodec/mjpegdec.c          | 2 +-
 libavcodec/mpegvideo.c         | 2 +-
 libavcodec/mv30.c              | 2 +-
 libavcodec/proresdec2.c        | 2 +-
 libavcodec/speedhq.c           | 2 +-
 libavcodec/vc1dec.c            | 2 +-
 libavcodec/wmv2.c              | 2 +-
 libavcodec/x86/blockdsp_init.c | 3 +--
 tests/checkasm/blockdsp.c      | 3 +--
 24 files changed, 26 insertions(+), 31 deletions(-)

diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c
index 6015fe5299..5636fdef2d 100644
--- a/libavcodec/4xm.c
+++ b/libavcodec/4xm.c
@@ -1012,7 +1012,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
         return AVERROR(ENOMEM);
 
     f->version = AV_RL32(avctx->extradata) >> 16;
-    ff_blockdsp_init(&f->bdsp, avctx);
+    ff_blockdsp_init(&f->bdsp);
     ff_bswapdsp_init(&f->bbdsp);
     f->avctx = avctx;
 
diff --git a/libavcodec/asvdec.c b/libavcodec/asvdec.c
index c8c50cc8d4..4ca370d1ec 100644
--- a/libavcodec/asvdec.c
+++ b/libavcodec/asvdec.c
@@ -292,7 +292,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
     }
 
     ff_asv_common_init(avctx);
-    ff_blockdsp_init(&a->bdsp, avctx);
+    ff_blockdsp_init(&a->bdsp);
     ff_idctdsp_init(&a->idsp, avctx);
     ff_init_scantable(a->idsp.idct_permutation, &a->scantable, ff_asv_scantab);
     avctx->pix_fmt = AV_PIX_FMT_YUV420P;
diff --git a/libavcodec/bink.c b/libavcodec/bink.c
index e43ff1f4fa..e3971e557a 100644
--- a/libavcodec/bink.c
+++ b/libavcodec/bink.c
@@ -1384,7 +1384,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
     avctx->pix_fmt = c->has_alpha ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P;
     avctx->color_range = c->version == 'k' ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
 
-    ff_blockdsp_init(&c->bdsp, avctx);
+    ff_blockdsp_init(&c->bdsp);
     ff_hpeldsp_init(&hdsp, avctx->flags);
     c->put_pixels_tab = hdsp.put_pixels_tab[1][0];
     ff_binkdsp_init(&c->binkdsp);
diff --git a/libavcodec/blockdsp.c b/libavcodec/blockdsp.c
index c8f85dd202..98f06c5d16 100644
--- a/libavcodec/blockdsp.c
+++ b/libavcodec/blockdsp.c
@@ -21,7 +21,6 @@
 
 #include "config.h"
 #include "libavutil/attributes.h"
-#include "avcodec.h"
 #include "blockdsp.h"
 
 static void clear_block_c(int16_t *block)
@@ -56,7 +55,7 @@ static void fill_block8_c(uint8_t *block, uint8_t value, ptrdiff_t line_size,
     }
 }
 
-av_cold void ff_blockdsp_init(BlockDSPContext *c, AVCodecContext *avctx)
+av_cold void ff_blockdsp_init(BlockDSPContext *c)
 {
     c->clear_block  = clear_block_c;
     c->clear_blocks = clear_blocks_c;
@@ -71,7 +70,7 @@ av_cold void ff_blockdsp_init(BlockDSPContext *c, AVCodecContext *avctx)
 #elif ARCH_PPC
     ff_blockdsp_init_ppc(c);
 #elif ARCH_X86
-    ff_blockdsp_init_x86(c, avctx);
+    ff_blockdsp_init_x86(c);
 #elif ARCH_MIPS
     ff_blockdsp_init_mips(c);
 #endif
diff --git a/libavcodec/blockdsp.h b/libavcodec/blockdsp.h
index 58eecffb07..d853adada2 100644
--- a/libavcodec/blockdsp.h
+++ b/libavcodec/blockdsp.h
@@ -22,8 +22,6 @@
 #include <stddef.h>
 #include <stdint.h>
 
-#include "avcodec.h"
-
 /* add and put pixel (decoding)
  * Block sizes for op_pixels_func are 8x4,8x8 16x8 16x16.
  * h for op_pixels_func is limited to { width / 2, width },
@@ -38,12 +36,12 @@ typedef struct BlockDSPContext {
     op_fill_func fill_block_tab[2];
 } BlockDSPContext;
 
-void ff_blockdsp_init(BlockDSPContext *c, AVCodecContext *avctx);
+void ff_blockdsp_init(BlockDSPContext *c);
 
 void ff_blockdsp_init_alpha(BlockDSPContext *c);
 void ff_blockdsp_init_arm(BlockDSPContext *c);
 void ff_blockdsp_init_ppc(BlockDSPContext *c);
-void ff_blockdsp_init_x86(BlockDSPContext *c, AVCodecContext *avctx);
+void ff_blockdsp_init_x86(BlockDSPContext *c);
 void ff_blockdsp_init_mips(BlockDSPContext *c);
 
 #endif /* AVCODEC_BLOCKDSP_H */
diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c
index cba0a06e89..6d54e8eae5 100644
--- a/libavcodec/cavs.c
+++ b/libavcodec/cavs.c
@@ -793,7 +793,7 @@ av_cold int ff_cavs_init(AVCodecContext *avctx)
 {
     AVSContext *h = avctx->priv_data;
 
-    ff_blockdsp_init(&h->bdsp, avctx);
+    ff_blockdsp_init(&h->bdsp);
     ff_h264chroma_init(&h->h264chroma, 8);
     ff_idctdsp_init(&h->idsp, avctx);
     ff_videodsp_init(&h->vdsp, 8);
diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 17b7179927..a44f95f044 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -273,7 +273,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
 
     ctx->avctx->bits_per_raw_sample = ctx->bit_depth = bitdepth;
     if (ctx->bit_depth != old_bit_depth) {
-        ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
+        ff_blockdsp_init(&ctx->bdsp);
         ff_idctdsp_init(&ctx->idsp, ctx->avctx);
         ff_init_scantable(ctx->idsp.idct_permutation, &ctx->scantable,
                           ff_zigzag_direct);
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index e1008ec776..b7dc54f86a 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -419,7 +419,7 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
 
     avctx->bits_per_raw_sample = ctx->bit_depth;
 
-    ff_blockdsp_init(&ctx->bdsp, avctx);
+    ff_blockdsp_init(&ctx->bdsp);
     ff_fdctdsp_init(&ctx->m.fdsp, avctx);
     ff_mpv_idct_init(&ctx->m);
     ff_mpegvideoencdsp_init(&ctx->m.mpvencdsp, avctx);
diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c
index 7ce2ce36c8..2a5aac912d 100644
--- a/libavcodec/eamad.c
+++ b/libavcodec/eamad.c
@@ -69,7 +69,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
     MadContext *s = avctx->priv_data;
     s->avctx = avctx;
     avctx->pix_fmt = AV_PIX_FMT_YUV420P;
-    ff_blockdsp_init(&s->bdsp, avctx);
+    ff_blockdsp_init(&s->bdsp);
     ff_bswapdsp_init(&s->bbdsp);
     ff_idctdsp_init(&s->idsp, avctx);
     ff_init_scantable_permutation(s->idsp.idct_permutation, FF_IDCT_PERM_NONE);
diff --git a/libavcodec/eatqi.c b/libavcodec/eatqi.c
index 4799f75886..324e6f1ced 100644
--- a/libavcodec/eatqi.c
+++ b/libavcodec/eatqi.c
@@ -62,7 +62,7 @@ static av_cold int tqi_decode_init(AVCodecContext *avctx)
 {
     TqiContext *t = avctx->priv_data;
 
-    ff_blockdsp_init(&t->bdsp, avctx);
+    ff_blockdsp_init(&t->bdsp);
     ff_bswapdsp_init(&t->bsdsp);
     ff_idctdsp_init(&t->idsp, avctx);
     ff_init_scantable_permutation(t->idsp.idct_permutation, FF_IDCT_PERM_NONE);
diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c
index 080544de8b..4367af3dc0 100644
--- a/libavcodec/g2meet.c
+++ b/libavcodec/g2meet.c
@@ -180,7 +180,7 @@ static av_cold int jpg_init(AVCodecContext *avctx, JPGContext *c)
     if (ret)
         return ret;
 
-    ff_blockdsp_init(&c->bdsp, avctx);
+    ff_blockdsp_init(&c->bdsp);
     ff_idctdsp_init(&c->idsp, avctx);
     ff_init_scantable(c->idsp.idct_permutation, &c->scantable,
                       ff_zigzag_direct);
diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index e82cb8680e..f88baf8daf 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -722,7 +722,7 @@ av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
                       ff_wmv1_scantable[3]);
 
     ff_intrax8dsp_init(&w->dsp);
-    ff_blockdsp_init(&w->bdsp, avctx);
+    ff_blockdsp_init(&w->bdsp);
 
     ff_thread_once(&init_static_once, x8_vlc_init);
 
diff --git a/libavcodec/jvdec.c b/libavcodec/jvdec.c
index dd7e4a93ef..e0287a9cb9 100644
--- a/libavcodec/jvdec.c
+++ b/libavcodec/jvdec.c
@@ -56,7 +56,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
         return AVERROR(ENOMEM);
 
     avctx->pix_fmt = AV_PIX_FMT_PAL8;
-    ff_blockdsp_init(&s->bdsp, avctx);
+    ff_blockdsp_init(&s->bdsp);
     return 0;
 }
 
diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c
index c8994f68ee..f27cf84122 100644
--- a/libavcodec/mdec.c
+++ b/libavcodec/mdec.c
@@ -219,7 +219,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
     a->avctx           = avctx;
 
-    ff_blockdsp_init(&a->bdsp, avctx);
+    ff_blockdsp_init(&a->bdsp);
     ff_bswapdsp_init(&a->bbdsp);
     ff_idctdsp_init(&a->idsp, avctx);
     ff_mpeg12_init_vlcs();
diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c
index 1d4f2b85c1..74eaa7d043 100644
--- a/libavcodec/mimic.c
+++ b/libavcodec/mimic.c
@@ -133,7 +133,7 @@ static av_cold int mimic_decode_init(AVCodecContext *avctx)
     ctx->prev_index = 0;
     ctx->cur_index  = 15;
 
-    ff_blockdsp_init(&ctx->bdsp, avctx);
+    ff_blockdsp_init(&ctx->bdsp);
     ff_bswapdsp_init(&ctx->bbdsp);
     ff_hpeldsp_init(&ctx->hdsp, avctx->flags);
     ff_idctdsp_init(&ctx->idsp, avctx);
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index ca7e752f16..5b7a8b1e7c 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -134,7 +134,7 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
     s->pkt = avctx->internal->in_pkt;
 
     s->avctx = avctx;
-    ff_blockdsp_init(&s->bdsp, avctx);
+    ff_blockdsp_init(&s->bdsp);
     ff_hpeldsp_init(&s->hdsp, avctx->flags);
     init_idct(avctx);
     s->buffer_size   = 0;
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 86fe5e4022..d8c7bc687d 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -281,7 +281,7 @@ static void gray8(uint8_t *dst, const uint8_t *src, ptrdiff_t linesize, int h)
 /* init common dct for both encoder and decoder */
 static av_cold int dct_init(MpegEncContext *s)
 {
-    ff_blockdsp_init(&s->bdsp, s->avctx);
+    ff_blockdsp_init(&s->bdsp);
     ff_h264chroma_init(&s->h264chroma, 8); //for lowres
     ff_hpeldsp_init(&s->hdsp, s->avctx->flags);
     ff_mpegvideodsp_init(&s->mdsp);
diff --git a/libavcodec/mv30.c b/libavcodec/mv30.c
index 03be4ddd9d..24b04400fd 100644
--- a/libavcodec/mv30.c
+++ b/libavcodec/mv30.c
@@ -670,7 +670,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
     avctx->pix_fmt = AV_PIX_FMT_YUV420P;
     avctx->color_range = AVCOL_RANGE_JPEG;
 
-    ff_blockdsp_init(&s->bdsp, avctx);
+    ff_blockdsp_init(&s->bdsp);
 
     s->prev_frame = av_frame_alloc();
     if (!s->prev_frame)
diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c
index 5ec579b994..b0d7f8d5d5 100644
--- a/libavcodec/proresdec2.c
+++ b/libavcodec/proresdec2.c
@@ -177,7 +177,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
         av_log(avctx, AV_LOG_DEBUG, "Auto bitdepth precision. Use 12b decoding based on codec tag.\n");
     }
 
-    ff_blockdsp_init(&ctx->bdsp, avctx);
+    ff_blockdsp_init(&ctx->bdsp);
     ret = ff_proresdsp_init(&ctx->prodsp, avctx);
     if (ret < 0) {
         av_log(avctx, AV_LOG_ERROR, "Fail to init proresdsp for bits per raw sample %d\n", avctx->bits_per_raw_sample);
diff --git a/libavcodec/speedhq.c b/libavcodec/speedhq.c
index 4f0e417a82..11d3311794 100644
--- a/libavcodec/speedhq.c
+++ b/libavcodec/speedhq.c
@@ -665,7 +665,7 @@ static av_cold int speedhq_decode_init(AVCodecContext *avctx)
     if (ret)
         return AVERROR_UNKNOWN;
 
-    ff_blockdsp_init(&s->bdsp, avctx);
+    ff_blockdsp_init(&s->bdsp);
     ff_idctdsp_init(&s->idsp, avctx);
     ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct);
 
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 9f32e82f9e..fa6b5cfd3c 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -540,7 +540,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
     // That this is necessary might indicate a bug.
     ff_vc1_decode_end(avctx);
 
-    ff_blockdsp_init(&s->bdsp, avctx);
+    ff_blockdsp_init(&s->bdsp);
     ff_h264chroma_init(&v->h264chroma, 8);
     ff_qpeldsp_init(&s->qdsp);
 
diff --git a/libavcodec/wmv2.c b/libavcodec/wmv2.c
index 5fea009e12..07a5d14f90 100644
--- a/libavcodec/wmv2.c
+++ b/libavcodec/wmv2.c
@@ -29,7 +29,7 @@ av_cold void ff_wmv2_common_init(MpegEncContext *s)
 {
     WMV2Context *const w = s->private_ctx;
 
-    ff_blockdsp_init(&s->bdsp, s->avctx);
+    ff_blockdsp_init(&s->bdsp);
     ff_wmv2dsp_init(&w->wdsp);
     s->idsp.perm_type = w->wdsp.idct_perm;
     ff_init_scantable_permutation(s->idsp.idct_permutation,
diff --git a/libavcodec/x86/blockdsp_init.c b/libavcodec/x86/blockdsp_init.c
index b0ff9376d9..996124114f 100644
--- a/libavcodec/x86/blockdsp_init.c
+++ b/libavcodec/x86/blockdsp_init.c
@@ -29,8 +29,7 @@ void ff_clear_block_avx(int16_t *block);
 void ff_clear_blocks_sse(int16_t *blocks);
 void ff_clear_blocks_avx(int16_t *blocks);
 
-av_cold void ff_blockdsp_init_x86(BlockDSPContext *c,
-                                  AVCodecContext *avctx)
+av_cold void ff_blockdsp_init_x86(BlockDSPContext *c)
 {
 #if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
diff --git a/tests/checkasm/blockdsp.c b/tests/checkasm/blockdsp.c
index 9e6ce9d7d1..99d79209e4 100644
--- a/tests/checkasm/blockdsp.c
+++ b/tests/checkasm/blockdsp.c
@@ -57,10 +57,9 @@ void checkasm_check_blockdsp(void)
     LOCAL_ALIGNED_32(uint16_t, buf0, [6 * 8 * 8]);
     LOCAL_ALIGNED_32(uint16_t, buf1, [6 * 8 * 8]);
 
-    AVCodecContext avctx = { 0 };
     BlockDSPContext h;
 
-    ff_blockdsp_init(&h, &avctx);
+    ff_blockdsp_init(&h);
 
     check_clear(clear_block,  8 * 8);
     check_clear(clear_blocks, 8 * 8 * 6);
-- 
2.34.1



More information about the ffmpeg-devel mailing list