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