Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/5] avcodec/mpeg12vlc: Move MPEG-1/2 RL VLCs to it
@ 2022-09-30  2:17 Andreas Rheinhardt
  2022-09-30  2:18 ` [FFmpeg-devel] [PATCH 2/5] avcodec/mpeg12dec: Don't call ff_mpeg12_common_init() Andreas Rheinhardt
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2022-09-30  2:17 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

It is better place for these declarations than
mpeg12data.h as RL VLC are just a variant of VLCs.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/mpeg12data.c |  1 +
 libavcodec/mpeg12data.h |  4 ----
 libavcodec/mpeg12dec.h  | 10 ----------
 libavcodec/mpeg12enc.c  |  1 +
 libavcodec/mpeg12enc.h  |  3 ---
 libavcodec/mpeg12vlc.h  | 15 +++++++++++++++
 libavcodec/speedhq.c    |  2 +-
 libavcodec/speedhqenc.c |  2 +-
 8 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/libavcodec/mpeg12data.c b/libavcodec/mpeg12data.c
index 4da96d7da3..e301310b9f 100644
--- a/libavcodec/mpeg12data.c
+++ b/libavcodec/mpeg12data.c
@@ -26,6 +26,7 @@
  */
 
 #include "mpeg12data.h"
+#include "mpeg12vlc.h"
 
 const uint16_t ff_mpeg1_default_intra_matrix[256] = {
         8, 16, 19, 22, 26, 27, 29, 34,
diff --git a/libavcodec/mpeg12data.h b/libavcodec/mpeg12data.h
index f51faf4607..bc39655fbf 100644
--- a/libavcodec/mpeg12data.h
+++ b/libavcodec/mpeg12data.h
@@ -30,7 +30,6 @@
 
 #include <stdint.h>
 #include "libavutil/rational.h"
-#include "rl.h"
 
 extern const uint16_t ff_mpeg1_default_intra_matrix[];
 extern const uint16_t ff_mpeg1_default_non_intra_matrix[64];
@@ -40,9 +39,6 @@ extern const unsigned char ff_mpeg12_vlc_dc_lum_bits[12];
 extern const uint16_t ff_mpeg12_vlc_dc_chroma_code[12];
 extern const unsigned char ff_mpeg12_vlc_dc_chroma_bits[12];
 
-extern RLTable ff_rl_mpeg1;
-extern RLTable ff_rl_mpeg2;
-
 extern const uint8_t ff_mpeg12_mbAddrIncrTable[36][2];
 extern const uint8_t ff_mpeg12_mbPatTable[64][2];
 
diff --git a/libavcodec/mpeg12dec.h b/libavcodec/mpeg12dec.h
index b4e94a92ce..4c015d3096 100644
--- a/libavcodec/mpeg12dec.h
+++ b/libavcodec/mpeg12dec.h
@@ -24,16 +24,6 @@
 
 #include "get_bits.h"
 #include "mpeg12vlc.h"
-#include "rl.h"
-
-#define INIT_2D_VLC_RL(rl, static_size, flags)\
-{\
-    static RL_VLC_ELEM rl_vlc_table[static_size];\
-    rl.rl_vlc[0] = rl_vlc_table;\
-    ff_init_2d_vlc_rl(&rl, static_size, flags);\
-}
-
-void ff_init_2d_vlc_rl(RLTable *rl, unsigned static_size, int flags);
 
 static inline int decode_dc(GetBitContext *gb, int component)
 {
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index e1f09b7ede..f636afe42d 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -43,6 +43,7 @@
 #include "mpeg12.h"
 #include "mpeg12data.h"
 #include "mpeg12enc.h"
+#include "mpeg12vlc.h"
 #include "mpegutils.h"
 #include "mpegvideo.h"
 #include "mpegvideoenc.h"
diff --git a/libavcodec/mpeg12enc.h b/libavcodec/mpeg12enc.h
index fbbc43f891..0455e5e4e2 100644
--- a/libavcodec/mpeg12enc.h
+++ b/libavcodec/mpeg12enc.h
@@ -25,9 +25,6 @@
 #include <stdint.h>
 
 #include "mpegvideo.h"
-#include "rl.h"
-
-void ff_mpeg1_init_uni_ac_vlc(const RLTable *rl, uint8_t *uni_ac_vlc_len);
 
 void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number);
 void ff_mpeg1_encode_mb(MpegEncContext *s, int16_t block[8][64],
diff --git a/libavcodec/mpeg12vlc.h b/libavcodec/mpeg12vlc.h
index 70aca645cb..4fb19371f0 100644
--- a/libavcodec/mpeg12vlc.h
+++ b/libavcodec/mpeg12vlc.h
@@ -28,6 +28,7 @@
 #ifndef AVCODEC_MPEG12VLC_H
 #define AVCODEC_MPEG12VLC_H
 
+#include "rl.h"
 #include "vlc.h"
 
 #define DC_VLC_BITS 9
@@ -49,4 +50,18 @@ extern VLC ff_mv_vlc;
 
 void ff_mpeg12_init_vlcs(void);
 
+#define INIT_2D_VLC_RL(rl, static_size, flags)\
+{\
+    static RL_VLC_ELEM rl_vlc_table[static_size];\
+    rl.rl_vlc[0] = rl_vlc_table;\
+    ff_init_2d_vlc_rl(&rl, static_size, flags);\
+}
+
+extern RLTable ff_rl_mpeg1;
+extern RLTable ff_rl_mpeg2;
+
+void ff_init_2d_vlc_rl(RLTable *rl, unsigned static_size, int flags);
+
+void ff_mpeg1_init_uni_ac_vlc(const RLTable *rl, uint8_t *uni_ac_vlc_len);
+
 #endif /* AVCODEC_MPEG12VLC_H */
diff --git a/libavcodec/speedhq.c b/libavcodec/speedhq.c
index 11d3311794..6dbba02776 100644
--- a/libavcodec/speedhq.c
+++ b/libavcodec/speedhq.c
@@ -38,9 +38,9 @@
 #include "idctdsp.h"
 #include "libavutil/thread.h"
 #include "mathops.h"
-#include "mpeg12dec.h"
 #include "mpeg12data.h"
 #include "mpeg12vlc.h"
+#include "rl.h"
 
 #define MAX_INDEX (64 - 1)
 
diff --git a/libavcodec/speedhqenc.c b/libavcodec/speedhqenc.c
index 747ed679bd..4a009bd070 100644
--- a/libavcodec/speedhqenc.c
+++ b/libavcodec/speedhqenc.c
@@ -34,7 +34,7 @@
 #include "avcodec.h"
 #include "codec_internal.h"
 #include "mpeg12data.h"
-#include "mpeg12enc.h"
+#include "mpeg12vlc.h"
 #include "mpegvideo.h"
 #include "mpegvideoenc.h"
 #include "speedhqenc.h"
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [FFmpeg-devel] [PATCH 2/5] avcodec/mpeg12dec: Don't call ff_mpeg12_common_init()
  2022-09-30  2:17 [FFmpeg-devel] [PATCH 1/5] avcodec/mpeg12vlc: Move MPEG-1/2 RL VLCs to it Andreas Rheinhardt
@ 2022-09-30  2:18 ` Andreas Rheinhardt
  2022-09-30  2:18 ` [FFmpeg-devel] [PATCH 3/5] avcodec/mpeg12: Inline ff_mpeg12_common_init() into mpeg12enc.c Andreas Rheinhardt
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2022-09-30  2:18 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

It only sets [yc]_dc_scale_table and these tables are only
read in ff_set_qscale(); but the MPEG-1/2 decoders don't call
ff_set_qscale() at all.
(Furthermore, given that intra_dc_precision is always zero
for a decoder at this point, ff_mpeg12_common_init()
actually set these pointers to what ff_mpv_common_defaults()
already set them.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/mpeg12dec.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 7133696f3c..dad1970f6c 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1062,7 +1062,6 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx)
     /* we need some permutation to store matrices,
      * until the decoder sets the real permutation. */
     ff_mpv_idct_init(s2);
-    ff_mpeg12_common_init(&s->mpeg_enc_ctx);
     ff_mpeg12_init_vlcs();
 
     s2->chroma_format              = 1;
@@ -3075,7 +3074,6 @@ static av_cold int ipu_decode_init(AVCodecContext *avctx)
 
     ff_mpv_decode_init(m, avctx);
     ff_mpv_idct_init(m);
-    ff_mpeg12_common_init(m);
     ff_mpeg12_init_vlcs();
 
     for (int i = 0; i < 64; i++) {
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [FFmpeg-devel] [PATCH 3/5] avcodec/mpeg12: Inline ff_mpeg12_common_init() into mpeg12enc.c
  2022-09-30  2:17 [FFmpeg-devel] [PATCH 1/5] avcodec/mpeg12vlc: Move MPEG-1/2 RL VLCs to it Andreas Rheinhardt
  2022-09-30  2:18 ` [FFmpeg-devel] [PATCH 2/5] avcodec/mpeg12dec: Don't call ff_mpeg12_common_init() Andreas Rheinhardt
@ 2022-09-30  2:18 ` Andreas Rheinhardt
  2022-09-30  2:18 ` [FFmpeg-devel] [PATCH 4/5] configure, avcodec/Makefile: Remove obsolete mpegvideo dependencies Andreas Rheinhardt
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2022-09-30  2:18 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/mpeg12.c    | 9 ---------
 libavcodec/mpeg12.h    | 2 --
 libavcodec/mpeg12enc.c | 4 +++-
 3 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index d78e25a777..7f2aaea7c0 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -36,7 +36,6 @@
 #include "mpeg12.h"
 #include "mpeg12data.h"
 #include "mpeg12dec.h"
-#include "mpegvideodata.h"
 #include "startcode.h"
 
 static const uint8_t table_mb_ptype[7][2] = {
@@ -100,14 +99,6 @@ av_cold void ff_init_2d_vlc_rl(RLTable *rl, unsigned static_size, int flags)
     }
 }
 
-av_cold void ff_mpeg12_common_init(MpegEncContext *s)
-{
-
-    s->y_dc_scale_table =
-    s->c_dc_scale_table = ff_mpeg2_dc_scale_table[s->intra_dc_precision];
-
-}
-
 void ff_mpeg1_clean_buffers(MpegEncContext *s)
 {
     s->last_dc[0] = 1 << (7 + s->intra_dc_precision);
diff --git a/libavcodec/mpeg12.h b/libavcodec/mpeg12.h
index e0406b32d9..b323728a33 100644
--- a/libavcodec/mpeg12.h
+++ b/libavcodec/mpeg12.h
@@ -34,8 +34,6 @@
 #define EXT_START_CODE          0x000001b5
 #define USER_START_CODE         0x000001b2
 
-void ff_mpeg12_common_init(MpegEncContext *s);
-
 void ff_mpeg1_clean_buffers(MpegEncContext *s);
 #if FF_API_FLAG_TRUNCATED
 int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size, AVCodecParserContext *s);
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index f636afe42d..01cfd1c1fa 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -46,6 +46,7 @@
 #include "mpeg12vlc.h"
 #include "mpegutils.h"
 #include "mpegvideo.h"
+#include "mpegvideodata.h"
 #include "mpegvideoenc.h"
 #include "profiles.h"
 
@@ -1133,7 +1134,8 @@ av_cold void ff_mpeg1_encode_init(MpegEncContext *s)
 {
     static AVOnce init_static_once = AV_ONCE_INIT;
 
-    ff_mpeg12_common_init(s);
+    s->y_dc_scale_table =
+    s->c_dc_scale_table = ff_mpeg2_dc_scale_table[s->intra_dc_precision];
 
     s->me.mv_penalty = mv_penalty;
     s->fcode_tab     = fcode_tab;
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [FFmpeg-devel] [PATCH 4/5] configure, avcodec/Makefile: Remove obsolete mpegvideo dependencies
  2022-09-30  2:17 [FFmpeg-devel] [PATCH 1/5] avcodec/mpeg12vlc: Move MPEG-1/2 RL VLCs to it Andreas Rheinhardt
  2022-09-30  2:18 ` [FFmpeg-devel] [PATCH 2/5] avcodec/mpeg12dec: Don't call ff_mpeg12_common_init() Andreas Rheinhardt
  2022-09-30  2:18 ` [FFmpeg-devel] [PATCH 3/5] avcodec/mpeg12: Inline ff_mpeg12_common_init() into mpeg12enc.c Andreas Rheinhardt
@ 2022-09-30  2:18 ` Andreas Rheinhardt
  2022-09-30  2:18 ` [FFmpeg-devel] [PATCH 5/5] avcodec/mpeg12: Move ff_mpeg1_clean_buffers decl to a new header Andreas Rheinhardt
  2022-10-02 23:08 ` [FFmpeg-devel] [PATCH 1/5] avcodec/mpeg12vlc: Move MPEG-1/2 RL VLCs to it Andreas Rheinhardt
  4 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2022-09-30  2:18 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

As long as ff_mpeg12_common_init() existed in mpeg12.c,
it added a dependency of mpeg12.o on mpegvideodata.o
(which provides ff_mpeg2_dc_scale_table, which is used
in ff_mpeg12_common_init()). mpegvideodata.o is normally
provided by the mpegvideo subsystem and therefore several
codecs and the MPEG-1/2 parser added a configure dependency
on said subsystem (additionally, the eatqi decoder just
added a Makefile dependency on mpegvideodata.o).

Given that ff_mpeg12_common_init() is no more, these dependencies
can be removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 configure           | 7 +++----
 libavcodec/Makefile | 4 ++--
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index 6712d045d9..28d5b0cabe 100755
--- a/configure
+++ b/configure
@@ -2819,7 +2819,7 @@ dxa_decoder_deps="zlib"
 dxv_decoder_select="lzf texturedsp"
 eac3_decoder_select="ac3_decoder"
 eac3_encoder_select="ac3_encoder"
-eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpegvideo"
+eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp"
 eatgq_decoder_select="aandcttables"
 eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp"
 exr_decoder_deps="zlib"
@@ -2873,7 +2873,7 @@ ljpeg_encoder_select="idctdsp jpegtables"
 lscr_decoder_select="inflate_wrapper"
 magicyuv_decoder_select="llviddsp"
 magicyuv_encoder_select="llvidencdsp"
-mdec_decoder_select="blockdsp bswapdsp idctdsp mpegvideo"
+mdec_decoder_select="blockdsp bswapdsp idctdsp"
 metasound_decoder_select="lsp mdct sinewin"
 mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp"
 mjpeg_decoder_select="blockdsp hpeldsp exif idctdsp jpegtables"
@@ -2951,7 +2951,7 @@ sonic_decoder_select="golomb rangecoder"
 sonic_encoder_select="golomb rangecoder"
 sonic_ls_encoder_select="golomb rangecoder"
 sp5x_decoder_select="mjpeg_decoder"
-speedhq_decoder_select="mpegvideo"
+speedhq_decoder_select="blockdsp idctdsp"
 speedhq_encoder_select="mpegvideoenc"
 srgc_decoder_select="inflate_wrapper"
 svq1_decoder_select="hpeldsp"
@@ -3275,7 +3275,6 @@ av1_parser_select="cbs_av1"
 h264_parser_select="atsc_a53 golomb h264dsp h264parse"
 hevc_parser_select="hevcparse"
 mpegaudio_parser_select="mpegaudioheader"
-mpegvideo_parser_select="mpegvideo"
 mpeg4video_parser_select="h263dsp mpegvideodec qpeldsp"
 vc1_parser_select="vc1dsp"
 
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 14434dc06c..8022e9a5e7 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -332,7 +332,7 @@ OBJS-$(CONFIG_EAMAD_DECODER)           += eamad.o eaidct.o mpeg12.o \
 OBJS-$(CONFIG_EATGQ_DECODER)           += eatgq.o eaidct.o
 OBJS-$(CONFIG_EATGV_DECODER)           += eatgv.o
 OBJS-$(CONFIG_EATQI_DECODER)           += eatqi.o eaidct.o mpeg12.o \
-                                          mpeg12data.o mpegvideodata.o
+                                          mpeg12data.o
 OBJS-$(CONFIG_EIGHTBPS_DECODER)        += 8bps.o
 OBJS-$(CONFIG_EIGHTSVX_EXP_DECODER)    += 8svx.o
 OBJS-$(CONFIG_EIGHTSVX_FIB_DECODER)    += 8svx.o
@@ -659,7 +659,7 @@ OBJS-$(CONFIG_SOL_DPCM_DECODER)        += dpcm.o
 OBJS-$(CONFIG_SONIC_DECODER)           += sonic.o
 OBJS-$(CONFIG_SONIC_ENCODER)           += sonic.o
 OBJS-$(CONFIG_SONIC_LS_ENCODER)        += sonic.o
-OBJS-$(CONFIG_SPEEDHQ_DECODER)         += speedhq.o mpeg12.o mpeg12data.o simple_idct.o
+OBJS-$(CONFIG_SPEEDHQ_DECODER)         += speedhq.o mpeg12.o mpeg12data.o
 OBJS-$(CONFIG_SPEEDHQ_ENCODER)         += speedhq.o mpeg12data.o mpeg12enc.o speedhqenc.o
 OBJS-$(CONFIG_SPEEX_DECODER)           += speexdec.o
 OBJS-$(CONFIG_SP5X_DECODER)            += sp5xdec.o
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [FFmpeg-devel] [PATCH 5/5] avcodec/mpeg12: Move ff_mpeg1_clean_buffers decl to a new header
  2022-09-30  2:17 [FFmpeg-devel] [PATCH 1/5] avcodec/mpeg12vlc: Move MPEG-1/2 RL VLCs to it Andreas Rheinhardt
                   ` (2 preceding siblings ...)
  2022-09-30  2:18 ` [FFmpeg-devel] [PATCH 4/5] configure, avcodec/Makefile: Remove obsolete mpegvideo dependencies Andreas Rheinhardt
@ 2022-09-30  2:18 ` Andreas Rheinhardt
  2022-10-02 23:08 ` [FFmpeg-devel] [PATCH 1/5] avcodec/mpeg12vlc: Move MPEG-1/2 RL VLCs to it Andreas Rheinhardt
  4 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2022-09-30  2:18 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

It allows to avoid including mpegvideo.h when including mpeg12.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/mpeg12.c                |  1 +
 libavcodec/mpeg12.h                | 10 +++++++---
 libavcodec/mpeg12codecs.h          | 29 +++++++++++++++++++++++++++++
 libavcodec/mpeg12dec.c             |  1 +
 libavcodec/mpegvideo_enc.c         |  2 +-
 libavcodec/tests/mpeg12framerate.c |  3 +++
 6 files changed, 42 insertions(+), 4 deletions(-)
 create mode 100644 libavcodec/mpeg12codecs.h

diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 7f2aaea7c0..df6aba9d74 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -34,6 +34,7 @@
 #include "avcodec.h"
 #include "mpegvideo.h"
 #include "mpeg12.h"
+#include "mpeg12codecs.h"
 #include "mpeg12data.h"
 #include "mpeg12dec.h"
 #include "startcode.h"
diff --git a/libavcodec/mpeg12.h b/libavcodec/mpeg12.h
index b323728a33..4e2e67eae1 100644
--- a/libavcodec/mpeg12.h
+++ b/libavcodec/mpeg12.h
@@ -22,7 +22,7 @@
 #ifndef AVCODEC_MPEG12_H
 #define AVCODEC_MPEG12_H
 
-#include "mpegvideo.h"
+#include "libavutil/rational.h"
 
 /* Start codes. */
 #define SEQ_END_CODE            0x000001b7
@@ -34,9 +34,13 @@
 #define EXT_START_CODE          0x000001b5
 #define USER_START_CODE         0x000001b2
 
-void ff_mpeg1_clean_buffers(MpegEncContext *s);
+#include "version_major.h"
 #if FF_API_FLAG_TRUNCATED
-int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size, AVCodecParserContext *s);
+#include <stdint.h>
+
+struct ParseContext;
+struct AVCodecParserContext;
+int ff_mpeg1_find_frame_end(struct ParseContext *pc, const uint8_t *buf, int buf_size, struct AVCodecParserContext *s);
 #endif
 
 void ff_mpeg12_find_best_frame_rate(AVRational frame_rate,
diff --git a/libavcodec/mpeg12codecs.h b/libavcodec/mpeg12codecs.h
new file mode 100644
index 0000000000..f8cf5503e2
--- /dev/null
+++ b/libavcodec/mpeg12codecs.h
@@ -0,0 +1,29 @@
+/*
+ * MPEG-1/2 codecs common code
+ * Copyright (c) 2007 Aurelien Jacobs <aurel@gnuage.org>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_MPEG12CODECS_H
+#define AVCODEC_MPEG12CODECS_H
+
+#include "mpegvideo.h"
+
+void ff_mpeg1_clean_buffers(MpegEncContext *s);
+
+#endif /* AVCODEC_MPEG12CODECS_H */
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index dad1970f6c..df76a90c6c 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -47,6 +47,7 @@
 #include "internal.h"
 #include "mpeg_er.h"
 #include "mpeg12.h"
+#include "mpeg12codecs.h"
 #include "mpeg12data.h"
 #include "mpeg12dec.h"
 #include "mpegutils.h"
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 0b398c56ab..06c3ff4cbe 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -46,7 +46,7 @@
 #include "dct.h"
 #include "encode.h"
 #include "idctdsp.h"
-#include "mpeg12.h"
+#include "mpeg12codecs.h"
 #include "mpeg12data.h"
 #include "mpeg12enc.h"
 #include "mpegvideo.h"
diff --git a/libavcodec/tests/mpeg12framerate.c b/libavcodec/tests/mpeg12framerate.c
index 595bdb278a..f2d3e2472c 100644
--- a/libavcodec/tests/mpeg12framerate.c
+++ b/libavcodec/tests/mpeg12framerate.c
@@ -16,6 +16,9 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <stddef.h>
+
+#include "libavutil/log.h"
 #include "libavcodec/mpeg12.h"
 #include "libavcodec/mpeg12data.h"
 
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/5] avcodec/mpeg12vlc: Move MPEG-1/2 RL VLCs to it
  2022-09-30  2:17 [FFmpeg-devel] [PATCH 1/5] avcodec/mpeg12vlc: Move MPEG-1/2 RL VLCs to it Andreas Rheinhardt
                   ` (3 preceding siblings ...)
  2022-09-30  2:18 ` [FFmpeg-devel] [PATCH 5/5] avcodec/mpeg12: Move ff_mpeg1_clean_buffers decl to a new header Andreas Rheinhardt
@ 2022-10-02 23:08 ` Andreas Rheinhardt
  4 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2022-10-02 23:08 UTC (permalink / raw)
  To: ffmpeg-devel

Andreas Rheinhardt:
> It is better place for these declarations than
> mpeg12data.h as RL VLC are just a variant of VLCs.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/mpeg12data.c |  1 +
>  libavcodec/mpeg12data.h |  4 ----
>  libavcodec/mpeg12dec.h  | 10 ----------
>  libavcodec/mpeg12enc.c  |  1 +
>  libavcodec/mpeg12enc.h  |  3 ---
>  libavcodec/mpeg12vlc.h  | 15 +++++++++++++++
>  libavcodec/speedhq.c    |  2 +-
>  libavcodec/speedhqenc.c |  2 +-
>  8 files changed, 19 insertions(+), 19 deletions(-)
> 
> diff --git a/libavcodec/mpeg12data.c b/libavcodec/mpeg12data.c
> index 4da96d7da3..e301310b9f 100644
> --- a/libavcodec/mpeg12data.c
> +++ b/libavcodec/mpeg12data.c
> @@ -26,6 +26,7 @@
>   */
>  
>  #include "mpeg12data.h"
> +#include "mpeg12vlc.h"
>  
>  const uint16_t ff_mpeg1_default_intra_matrix[256] = {
>          8, 16, 19, 22, 26, 27, 29, 34,
> diff --git a/libavcodec/mpeg12data.h b/libavcodec/mpeg12data.h
> index f51faf4607..bc39655fbf 100644
> --- a/libavcodec/mpeg12data.h
> +++ b/libavcodec/mpeg12data.h
> @@ -30,7 +30,6 @@
>  
>  #include <stdint.h>
>  #include "libavutil/rational.h"
> -#include "rl.h"
>  
>  extern const uint16_t ff_mpeg1_default_intra_matrix[];
>  extern const uint16_t ff_mpeg1_default_non_intra_matrix[64];
> @@ -40,9 +39,6 @@ extern const unsigned char ff_mpeg12_vlc_dc_lum_bits[12];
>  extern const uint16_t ff_mpeg12_vlc_dc_chroma_code[12];
>  extern const unsigned char ff_mpeg12_vlc_dc_chroma_bits[12];
>  
> -extern RLTable ff_rl_mpeg1;
> -extern RLTable ff_rl_mpeg2;
> -
>  extern const uint8_t ff_mpeg12_mbAddrIncrTable[36][2];
>  extern const uint8_t ff_mpeg12_mbPatTable[64][2];
>  
> diff --git a/libavcodec/mpeg12dec.h b/libavcodec/mpeg12dec.h
> index b4e94a92ce..4c015d3096 100644
> --- a/libavcodec/mpeg12dec.h
> +++ b/libavcodec/mpeg12dec.h
> @@ -24,16 +24,6 @@
>  
>  #include "get_bits.h"
>  #include "mpeg12vlc.h"
> -#include "rl.h"
> -
> -#define INIT_2D_VLC_RL(rl, static_size, flags)\
> -{\
> -    static RL_VLC_ELEM rl_vlc_table[static_size];\
> -    rl.rl_vlc[0] = rl_vlc_table;\
> -    ff_init_2d_vlc_rl(&rl, static_size, flags);\
> -}
> -
> -void ff_init_2d_vlc_rl(RLTable *rl, unsigned static_size, int flags);
>  
>  static inline int decode_dc(GetBitContext *gb, int component)
>  {
> diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
> index e1f09b7ede..f636afe42d 100644
> --- a/libavcodec/mpeg12enc.c
> +++ b/libavcodec/mpeg12enc.c
> @@ -43,6 +43,7 @@
>  #include "mpeg12.h"
>  #include "mpeg12data.h"
>  #include "mpeg12enc.h"
> +#include "mpeg12vlc.h"
>  #include "mpegutils.h"
>  #include "mpegvideo.h"
>  #include "mpegvideoenc.h"
> diff --git a/libavcodec/mpeg12enc.h b/libavcodec/mpeg12enc.h
> index fbbc43f891..0455e5e4e2 100644
> --- a/libavcodec/mpeg12enc.h
> +++ b/libavcodec/mpeg12enc.h
> @@ -25,9 +25,6 @@
>  #include <stdint.h>
>  
>  #include "mpegvideo.h"
> -#include "rl.h"
> -
> -void ff_mpeg1_init_uni_ac_vlc(const RLTable *rl, uint8_t *uni_ac_vlc_len);
>  
>  void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number);
>  void ff_mpeg1_encode_mb(MpegEncContext *s, int16_t block[8][64],
> diff --git a/libavcodec/mpeg12vlc.h b/libavcodec/mpeg12vlc.h
> index 70aca645cb..4fb19371f0 100644
> --- a/libavcodec/mpeg12vlc.h
> +++ b/libavcodec/mpeg12vlc.h
> @@ -28,6 +28,7 @@
>  #ifndef AVCODEC_MPEG12VLC_H
>  #define AVCODEC_MPEG12VLC_H
>  
> +#include "rl.h"
>  #include "vlc.h"
>  
>  #define DC_VLC_BITS 9
> @@ -49,4 +50,18 @@ extern VLC ff_mv_vlc;
>  
>  void ff_mpeg12_init_vlcs(void);
>  
> +#define INIT_2D_VLC_RL(rl, static_size, flags)\
> +{\
> +    static RL_VLC_ELEM rl_vlc_table[static_size];\
> +    rl.rl_vlc[0] = rl_vlc_table;\
> +    ff_init_2d_vlc_rl(&rl, static_size, flags);\
> +}
> +
> +extern RLTable ff_rl_mpeg1;
> +extern RLTable ff_rl_mpeg2;
> +
> +void ff_init_2d_vlc_rl(RLTable *rl, unsigned static_size, int flags);
> +
> +void ff_mpeg1_init_uni_ac_vlc(const RLTable *rl, uint8_t *uni_ac_vlc_len);
> +
>  #endif /* AVCODEC_MPEG12VLC_H */
> diff --git a/libavcodec/speedhq.c b/libavcodec/speedhq.c
> index 11d3311794..6dbba02776 100644
> --- a/libavcodec/speedhq.c
> +++ b/libavcodec/speedhq.c
> @@ -38,9 +38,9 @@
>  #include "idctdsp.h"
>  #include "libavutil/thread.h"
>  #include "mathops.h"
> -#include "mpeg12dec.h"
>  #include "mpeg12data.h"
>  #include "mpeg12vlc.h"
> +#include "rl.h"
>  
>  #define MAX_INDEX (64 - 1)
>  
> diff --git a/libavcodec/speedhqenc.c b/libavcodec/speedhqenc.c
> index 747ed679bd..4a009bd070 100644
> --- a/libavcodec/speedhqenc.c
> +++ b/libavcodec/speedhqenc.c
> @@ -34,7 +34,7 @@
>  #include "avcodec.h"
>  #include "codec_internal.h"
>  #include "mpeg12data.h"
> -#include "mpeg12enc.h"
> +#include "mpeg12vlc.h"
>  #include "mpegvideo.h"
>  #include "mpegvideoenc.h"
>  #include "speedhqenc.h"

Will apply this patchset tomorrow unless there are objections.

- Andreas

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-10-02 23:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-30  2:17 [FFmpeg-devel] [PATCH 1/5] avcodec/mpeg12vlc: Move MPEG-1/2 RL VLCs to it Andreas Rheinhardt
2022-09-30  2:18 ` [FFmpeg-devel] [PATCH 2/5] avcodec/mpeg12dec: Don't call ff_mpeg12_common_init() Andreas Rheinhardt
2022-09-30  2:18 ` [FFmpeg-devel] [PATCH 3/5] avcodec/mpeg12: Inline ff_mpeg12_common_init() into mpeg12enc.c Andreas Rheinhardt
2022-09-30  2:18 ` [FFmpeg-devel] [PATCH 4/5] configure, avcodec/Makefile: Remove obsolete mpegvideo dependencies Andreas Rheinhardt
2022-09-30  2:18 ` [FFmpeg-devel] [PATCH 5/5] avcodec/mpeg12: Move ff_mpeg1_clean_buffers decl to a new header Andreas Rheinhardt
2022-10-02 23:08 ` [FFmpeg-devel] [PATCH 1/5] avcodec/mpeg12vlc: Move MPEG-1/2 RL VLCs to it Andreas Rheinhardt

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git