@@ -41,6 +41,7 @@
#include "internal.h"
#include "mpeg_er.h"
#include "mpeg4video.h"
+#include "mpeg4videodec.h"
#if FF_API_FLAG_TRUNCATED
#include "mpeg4video_parser.h"
#endif
@@ -48,6 +48,7 @@
#include "rv10.h"
#include "mpeg4video.h"
#include "mpegvideodata.h"
+#include "mpeg4videodec.h"
// The defines below define the number of bits that are read at once for
// reading vlc values. Changing these may improve speed and data cache needs
@@ -70,86 +70,20 @@
/* smaller packets likely don't contain a real frame */
#define MAX_NVOP_SIZE 19
-typedef struct Mpeg4DecContext {
- MpegEncContext m;
-
- /// number of bits to represent the fractional part of time
- int time_increment_bits;
- int shape;
- int vol_sprite_usage;
- int sprite_brightness_change;
- int num_sprite_warping_points;
- /// sprite trajectory points
- uint16_t sprite_traj[4][2];
- /// sprite shift [isChroma]
- int sprite_shift[2];
-
- // reversible vlc
- int rvlc;
- /// could this stream contain resync markers
- int resync_marker;
- /// time distance of first I -> B, used for interlaced B-frames
- int t_frame;
-
- int new_pred;
- int enhancement_type;
- int scalability;
-
- /// QP above which the ac VLC should be used for intra dc
- int intra_dc_threshold;
-
- /* bug workarounds */
- int divx_version;
- int divx_build;
- int xvid_build;
- int lavc_build;
-
- int vo_type;
-
- /// flag for having shown the warning about invalid Divx B-frames
- int showed_packed_warning;
- /** does the stream contain the low_delay flag,
- * used to work around buggy encoders. */
- int vol_control_parameters;
- int cplx_estimation_trash_i;
- int cplx_estimation_trash_p;
- int cplx_estimation_trash_b;
-
- int rgb;
-
- int32_t block32[12][64];
- // 0 = DCT, 1 = DPCM top to bottom scan, -1 = DPCM bottom to top scan
- int dpcm_direction;
- int16_t dpcm_macroblock[3][256];
-} Mpeg4DecContext;
-
-
-void ff_mpeg4_decode_studio(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb,
- uint8_t *dest_cr, int block_size, int uvlinesize,
- int dct_linesize, int dct_offset);
void ff_mpeg4_encode_mb(MpegEncContext *s,
int16_t block[6][64],
int motion_x, int motion_y);
-void ff_mpeg4_pred_ac(MpegEncContext *s, int16_t *block, int n,
- int dir);
void ff_set_mpeg4_time(MpegEncContext *s);
int ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number);
-int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb,
- int header, int parse_only);
void ff_mpeg4_encode_video_packet_header(MpegEncContext *s);
void ff_mpeg4_clean_buffers(MpegEncContext *s);
void ff_mpeg4_stuffing(PutBitContext *pbc);
void ff_mpeg4_init_partitions(MpegEncContext *s);
void ff_mpeg4_merge_partitions(MpegEncContext *s);
void ff_clean_mpeg4_qscales(MpegEncContext *s);
-int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx);
int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s);
-int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx);
-int ff_mpeg4_decode_studio_slice_header(Mpeg4DecContext *ctx);
void ff_mpeg4_init_direct_mv(MpegEncContext *s);
-int ff_mpeg4_workaround_bugs(AVCodecContext *avctx);
-int ff_mpeg4_frame_end(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
/**
* @return the mb_type
@@ -26,6 +26,7 @@
#include "parser.h"
#include "mpegvideo.h"
#include "mpeg4video.h"
+#include "mpeg4videodec.h"
#if FF_API_FLAG_TRUNCATED
/* Nuke this header when removing FF_API_FLAG_TRUNCATED */
#include "mpeg4video_parser.h"
@@ -35,6 +35,7 @@
#include "mpegvideodata.h"
#include "mpeg4video.h"
#include "mpeg4videodata.h"
+#include "mpeg4videodec.h"
#include "h263.h"
#include "h263data.h"
#include "h263dec.h"
new file mode 100644
@@ -0,0 +1,99 @@
+/*
+ * MPEG-4 decoder internal header.
+ * Copyright (c) 2000,2001 Fabrice Bellard
+ * Copyright (c) 2002-2010 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * 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_MPEG4VIDEODEC_H
+#define AVCODEC_MPEG4VIDEODEC_H
+
+#include <stdint.h>
+
+#include "get_bits.h"
+#include "mpegvideo.h"
+
+
+typedef struct Mpeg4DecContext {
+ MpegEncContext m;
+
+ /// number of bits to represent the fractional part of time
+ int time_increment_bits;
+ int shape;
+ int vol_sprite_usage;
+ int sprite_brightness_change;
+ int num_sprite_warping_points;
+ /// sprite trajectory points
+ uint16_t sprite_traj[4][2];
+ /// sprite shift [isChroma]
+ int sprite_shift[2];
+
+ // reversible vlc
+ int rvlc;
+ /// could this stream contain resync markers
+ int resync_marker;
+ /// time distance of first I -> B, used for interlaced B-frames
+ int t_frame;
+
+ int new_pred;
+ int enhancement_type;
+ int scalability;
+
+ /// QP above which the ac VLC should be used for intra dc
+ int intra_dc_threshold;
+
+ /* bug workarounds */
+ int divx_version;
+ int divx_build;
+ int xvid_build;
+ int lavc_build;
+
+ int vo_type;
+
+ /// flag for having shown the warning about invalid Divx B-frames
+ int showed_packed_warning;
+ /** does the stream contain the low_delay flag,
+ * used to work around buggy encoders. */
+ int vol_control_parameters;
+ int cplx_estimation_trash_i;
+ int cplx_estimation_trash_p;
+ int cplx_estimation_trash_b;
+
+ int rgb;
+
+ int32_t block32[12][64];
+ // 0 = DCT, 1 = DPCM top to bottom scan, -1 = DPCM bottom to top scan
+ int dpcm_direction;
+ int16_t dpcm_macroblock[3][256];
+} Mpeg4DecContext;
+
+int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb,
+ int header, int parse_only);
+void ff_mpeg4_decode_studio(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb,
+ uint8_t *dest_cr, int block_size, int uvlinesize,
+ int dct_linesize, int dct_offset);
+int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx);
+int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx);
+int ff_mpeg4_decode_studio_slice_header(Mpeg4DecContext *ctx);
+int ff_mpeg4_workaround_bugs(AVCodecContext *avctx);
+void ff_mpeg4_pred_ac(MpegEncContext *s, int16_t *block, int n,
+ int dir);
+int ff_mpeg4_frame_end(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
+
+
+#endif
@@ -40,7 +40,7 @@
#include "mpeg_er.h"
#include "mpegutils.h"
#include "mpegvideo.h"
-#include "mpeg4video.h"
+#include "mpeg4videodec.h"
#include "mpegvideodata.h"
#include "qpeldsp.h"
#include "thread.h"
@@ -32,7 +32,7 @@
#include "h263.h"
#include "h263data.h"
#include "h263dec.h"
-#include "mpeg4video.h"
+#include "mpeg4videodec.h"
#include "msmpeg4data.h"
#include "vc1data.h"
#include "wmv2dec.h"
@@ -22,6 +22,7 @@
#include "avcodec.h"
#include "mpeg4video.h"
+#include "mpeg4videodec.h"
#include "nvdec.h"
#include "decode.h"
@@ -23,7 +23,7 @@
#include "h263.h"
#include "hwconfig.h"
#include "internal.h"
-#include "mpeg4video.h"
+#include "mpeg4videodec.h"
#include "mpegvideo.h"
#include "vaapi_decode.h"
@@ -25,7 +25,7 @@
#include "avcodec.h"
#include "hwconfig.h"
-#include "mpeg4video.h"
+#include "mpeg4videodec.h"
#include "vdpau.h"
#include "vdpau_internal.h"
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/h263dec.c | 1 + libavcodec/ituh263dec.c | 1 + libavcodec/mpeg4video.h | 66 ----------------------- libavcodec/mpeg4video_parser.c | 1 + libavcodec/mpeg4videodec.c | 1 + libavcodec/mpeg4videodec.h | 99 ++++++++++++++++++++++++++++++++++ libavcodec/mpegvideo.c | 2 +- libavcodec/msmpeg4dec.c | 2 +- libavcodec/nvdec_mpeg4.c | 1 + libavcodec/vaapi_mpeg4.c | 2 +- libavcodec/vdpau_mpeg4.c | 2 +- 11 files changed, 108 insertions(+), 70 deletions(-) create mode 100644 libavcodec/mpeg4videodec.h