[FFmpeg-devel] [PATCH 1/5] avcodec/mpeg12vlc: Move MPEG-1/2 RL VLCs to it
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Mon Oct 3 02:08:44 EEST 2022
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 at 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
More information about the ffmpeg-devel
mailing list