1/*
2 * MPEG-4 decoder internal header.
3 * Copyright (c) 2000,2001 Fabrice Bellard
4 * Copyright (c) 2002-2010 Michael Niedermayer <michaelni@gmx.at>
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifndef AVCODEC_MPEG4VIDEODEC_H
24#define AVCODEC_MPEG4VIDEODEC_H
25
26#include <stdint.h>
27
28#include "get_bits.h"
29#include "mpegvideo.h"
30
31
32typedef struct Mpeg4DecContext {
33    MpegEncContext m;
34
35    /// number of bits to represent the fractional part of time
36    int time_increment_bits;
37    int shape;
38    int vol_sprite_usage;
39    int sprite_brightness_change;
40    int num_sprite_warping_points;
41    /// sprite trajectory points
42    uint16_t sprite_traj[4][2];
43    /// sprite shift [isChroma]
44    int sprite_shift[2];
45
46    // reversible vlc
47    int rvlc;
48    /// could this stream contain resync markers
49    int resync_marker;
50    /// time distance of first I -> B, used for interlaced B-frames
51    int t_frame;
52
53    int new_pred;
54    int enhancement_type;
55    int scalability;
56
57    /// QP above which the ac VLC should be used for intra dc
58    int intra_dc_threshold;
59
60    /* bug workarounds */
61    int divx_version;
62    int divx_build;
63    int xvid_build;
64    int lavc_build;
65
66    int vo_type;
67
68    /// flag for having shown the warning about invalid Divx B-frames
69    int showed_packed_warning;
70    /** does the stream contain the low_delay flag,
71     *  used to work around buggy encoders. */
72    int vol_control_parameters;
73    int cplx_estimation_trash_i;
74    int cplx_estimation_trash_p;
75    int cplx_estimation_trash_b;
76
77    int rgb;
78
79    int32_t block32[12][64];
80    // 0 = DCT, 1 = DPCM top to bottom scan, -1 = DPCM bottom to top scan
81    int dpcm_direction;
82    int16_t dpcm_macroblock[3][256];
83} Mpeg4DecContext;
84
85int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb,
86                                   int header, int parse_only);
87void ff_mpeg4_decode_studio(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb,
88                            uint8_t *dest_cr, int block_size, int uvlinesize,
89                            int dct_linesize, int dct_offset);
90int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx);
91int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx);
92int ff_mpeg4_decode_studio_slice_header(Mpeg4DecContext *ctx);
93int ff_mpeg4_workaround_bugs(AVCodecContext *avctx);
94void ff_mpeg4_pred_ac(MpegEncContext *s, int16_t *block, int n,
95                      int dir);
96int ff_mpeg4_frame_end(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
97
98
99#endif
100