annotate mpegvideo.h @ 113:3e0dcdb6b340 libavcodec

added compiletime option to turn width%8==0 on
author michael
date Fri, 19 Oct 2001 13:56:12 +0000
parents 82e579c37bc3
children ae0516eadae2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
1 /*
986e461dc072 Initial revision
glantau
parents:
diff changeset
2 * Generic DCT based hybrid video encoder
986e461dc072 Initial revision
glantau
parents:
diff changeset
3 * Copyright (c) 2000,2001 Gerard Lantau.
986e461dc072 Initial revision
glantau
parents:
diff changeset
4 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify
986e461dc072 Initial revision
glantau
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
986e461dc072 Initial revision
glantau
parents:
diff changeset
7 * the Free Software Foundation; either version 2 of the License, or
986e461dc072 Initial revision
glantau
parents:
diff changeset
8 * (at your option) any later version.
986e461dc072 Initial revision
glantau
parents:
diff changeset
9 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
986e461dc072 Initial revision
glantau
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
986e461dc072 Initial revision
glantau
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
986e461dc072 Initial revision
glantau
parents:
diff changeset
13 * GNU General Public License for more details.
986e461dc072 Initial revision
glantau
parents:
diff changeset
14 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
986e461dc072 Initial revision
glantau
parents:
diff changeset
16 * along with this program; if not, write to the Free Software
986e461dc072 Initial revision
glantau
parents:
diff changeset
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
986e461dc072 Initial revision
glantau
parents:
diff changeset
18 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
19
986e461dc072 Initial revision
glantau
parents:
diff changeset
20 /* Macros for picture code type. */
986e461dc072 Initial revision
glantau
parents:
diff changeset
21 #define I_TYPE 1
986e461dc072 Initial revision
glantau
parents:
diff changeset
22 #define P_TYPE 2
986e461dc072 Initial revision
glantau
parents:
diff changeset
23 #define B_TYPE 3
986e461dc072 Initial revision
glantau
parents:
diff changeset
24
986e461dc072 Initial revision
glantau
parents:
diff changeset
25 enum OutputFormat {
986e461dc072 Initial revision
glantau
parents:
diff changeset
26 FMT_MPEG1,
986e461dc072 Initial revision
glantau
parents:
diff changeset
27 FMT_H263,
986e461dc072 Initial revision
glantau
parents:
diff changeset
28 FMT_MJPEG,
986e461dc072 Initial revision
glantau
parents:
diff changeset
29 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
30
986e461dc072 Initial revision
glantau
parents:
diff changeset
31 #define MPEG_BUF_SIZE (16 * 1024)
986e461dc072 Initial revision
glantau
parents:
diff changeset
32
986e461dc072 Initial revision
glantau
parents:
diff changeset
33 typedef struct MpegEncContext {
71
79be2c581c01 changed opendivx to mpeg4
glantau
parents: 64
diff changeset
34 struct AVCodecContext *avctx;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
35 /* the following parameters must be initialized before encoding */
986e461dc072 Initial revision
glantau
parents:
diff changeset
36 int width, height; /* picture size. must be a multiple of 16 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
37 int gop_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
38 int frame_rate; /* number of frames per second */
986e461dc072 Initial revision
glantau
parents:
diff changeset
39 int intra_only; /* if true, only intra pictures are generated */
986e461dc072 Initial revision
glantau
parents:
diff changeset
40 int bit_rate; /* wanted bit rate */
986e461dc072 Initial revision
glantau
parents:
diff changeset
41 enum OutputFormat out_format; /* output format */
986e461dc072 Initial revision
glantau
parents:
diff changeset
42 int h263_plus; /* h263 plus headers */
986e461dc072 Initial revision
glantau
parents:
diff changeset
43 int h263_rv10; /* use RV10 variation for H263 */
71
79be2c581c01 changed opendivx to mpeg4
glantau
parents: 64
diff changeset
44 int h263_pred; /* use mpeg4/h263 ac/dc predictions */
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
45 int h263_msmpeg4; /* generate MSMPEG4 compatible stream */
986e461dc072 Initial revision
glantau
parents:
diff changeset
46 int h263_intel; /* use I263 intel h263 header */
986e461dc072 Initial revision
glantau
parents:
diff changeset
47 int fixed_qscale; /* fixed qscale if non zero */
7
1d3ac9654178 added skip macroblock optimization (big perf win on black regions for example)
glantau
parents: 0
diff changeset
48 int encoding; /* true if we are encoding (vs decoding) */
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
49 /* the following fields are managed internally by the encoder */
986e461dc072 Initial revision
glantau
parents:
diff changeset
50
986e461dc072 Initial revision
glantau
parents:
diff changeset
51 /* bit output */
986e461dc072 Initial revision
glantau
parents:
diff changeset
52 PutBitContext pb;
986e461dc072 Initial revision
glantau
parents:
diff changeset
53
986e461dc072 Initial revision
glantau
parents:
diff changeset
54 /* sequence parameters */
986e461dc072 Initial revision
glantau
parents:
diff changeset
55 int context_initialized;
986e461dc072 Initial revision
glantau
parents:
diff changeset
56 int picture_number;
986e461dc072 Initial revision
glantau
parents:
diff changeset
57 int fake_picture_number; /* picture number at the bitstream frame rate */
986e461dc072 Initial revision
glantau
parents:
diff changeset
58 int gop_picture_number; /* index of the first picture of a GOP */
986e461dc072 Initial revision
glantau
parents:
diff changeset
59 int mb_width, mb_height;
986e461dc072 Initial revision
glantau
parents:
diff changeset
60 int linesize; /* line size, in bytes, may be different from width */
986e461dc072 Initial revision
glantau
parents:
diff changeset
61 UINT8 *new_picture[3]; /* picture to be compressed */
986e461dc072 Initial revision
glantau
parents:
diff changeset
62 UINT8 *last_picture[3]; /* previous picture */
986e461dc072 Initial revision
glantau
parents:
diff changeset
63 UINT8 *last_picture_base[3]; /* real start of the picture */
986e461dc072 Initial revision
glantau
parents:
diff changeset
64 UINT8 *next_picture[3]; /* previous picture (for bidir pred) */
986e461dc072 Initial revision
glantau
parents:
diff changeset
65 UINT8 *next_picture_base[3]; /* real start of the picture */
986e461dc072 Initial revision
glantau
parents:
diff changeset
66 UINT8 *aux_picture[3]; /* aux picture (for B frames only) */
986e461dc072 Initial revision
glantau
parents:
diff changeset
67 UINT8 *aux_picture_base[3]; /* real start of the picture */
986e461dc072 Initial revision
glantau
parents:
diff changeset
68 UINT8 *current_picture[3]; /* buffer to store the decompressed current picture */
986e461dc072 Initial revision
glantau
parents:
diff changeset
69 int last_dc[3]; /* last DC values for MPEG1 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
70 INT16 *dc_val[3]; /* used for mpeg4 DC prediction */
986e461dc072 Initial revision
glantau
parents:
diff changeset
71 int y_dc_scale, c_dc_scale;
986e461dc072 Initial revision
glantau
parents:
diff changeset
72 UINT8 *coded_block; /* used for coded block pattern prediction */
986e461dc072 Initial revision
glantau
parents:
diff changeset
73 INT16 (*ac_val[3])[16]; /* used for for mpeg4 AC prediction */
986e461dc072 Initial revision
glantau
parents:
diff changeset
74 int ac_pred;
7
1d3ac9654178 added skip macroblock optimization (big perf win on black regions for example)
glantau
parents: 0
diff changeset
75 int mb_skiped; /* MUST BE SET only during DECODING */
1d3ac9654178 added skip macroblock optimization (big perf win on black regions for example)
glantau
parents: 0
diff changeset
76 UINT8 *mbskip_table; /* used to avoid copy if macroblock
1d3ac9654178 added skip macroblock optimization (big perf win on black regions for example)
glantau
parents: 0
diff changeset
77 skipped (for black regions for example) */
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
78
986e461dc072 Initial revision
glantau
parents:
diff changeset
79 int qscale;
986e461dc072 Initial revision
glantau
parents:
diff changeset
80 int pict_type;
986e461dc072 Initial revision
glantau
parents:
diff changeset
81 int frame_rate_index;
986e461dc072 Initial revision
glantau
parents:
diff changeset
82 /* motion compensation */
986e461dc072 Initial revision
glantau
parents:
diff changeset
83 int unrestricted_mv;
986e461dc072 Initial revision
glantau
parents:
diff changeset
84 int h263_long_vectors; /* use horrible h263v1 long vector mode */
986e461dc072 Initial revision
glantau
parents:
diff changeset
85
986e461dc072 Initial revision
glantau
parents:
diff changeset
86 int f_code; /* resolution */
986e461dc072 Initial revision
glantau
parents:
diff changeset
87 INT16 (*motion_val)[2]; /* used for MV prediction */
986e461dc072 Initial revision
glantau
parents:
diff changeset
88 int full_search;
986e461dc072 Initial revision
glantau
parents:
diff changeset
89 int mv_dir;
986e461dc072 Initial revision
glantau
parents:
diff changeset
90 #define MV_DIR_BACKWARD 1
986e461dc072 Initial revision
glantau
parents:
diff changeset
91 #define MV_DIR_FORWARD 2
986e461dc072 Initial revision
glantau
parents:
diff changeset
92 int mv_type;
986e461dc072 Initial revision
glantau
parents:
diff changeset
93 #define MV_TYPE_16X16 0 /* 1 vector for the whole mb */
986e461dc072 Initial revision
glantau
parents:
diff changeset
94 #define MV_TYPE_8X8 1 /* 4 vectors (h263) */
986e461dc072 Initial revision
glantau
parents:
diff changeset
95 #define MV_TYPE_16X8 2 /* 2 vectors, one per 16x8 block */
986e461dc072 Initial revision
glantau
parents:
diff changeset
96 #define MV_TYPE_FIELD 3 /* 2 vectors, one per field */
986e461dc072 Initial revision
glantau
parents:
diff changeset
97 #define MV_TYPE_DMV 4 /* 2 vectors, special mpeg2 Dual Prime Vectors */
986e461dc072 Initial revision
glantau
parents:
diff changeset
98 /* motion vectors for a macroblock
986e461dc072 Initial revision
glantau
parents:
diff changeset
99 first coordinate : 0 = forward 1 = backward
986e461dc072 Initial revision
glantau
parents:
diff changeset
100 second " : depend on type
986e461dc072 Initial revision
glantau
parents:
diff changeset
101 third " : 0 = x, 1 = y
986e461dc072 Initial revision
glantau
parents:
diff changeset
102 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
103 int mv[2][4][2];
986e461dc072 Initial revision
glantau
parents:
diff changeset
104 int field_select[2][2];
986e461dc072 Initial revision
glantau
parents:
diff changeset
105 int last_mv[2][2][2];
986e461dc072 Initial revision
glantau
parents:
diff changeset
106
986e461dc072 Initial revision
glantau
parents:
diff changeset
107 int has_b_frames;
986e461dc072 Initial revision
glantau
parents:
diff changeset
108 int no_rounding; /* apply no rounding to motion estimation (MPEG4) */
986e461dc072 Initial revision
glantau
parents:
diff changeset
109
986e461dc072 Initial revision
glantau
parents:
diff changeset
110 /* macroblock layer */
986e461dc072 Initial revision
glantau
parents:
diff changeset
111 int mb_x, mb_y;
986e461dc072 Initial revision
glantau
parents:
diff changeset
112 int mb_incr;
986e461dc072 Initial revision
glantau
parents:
diff changeset
113 int mb_intra;
986e461dc072 Initial revision
glantau
parents:
diff changeset
114 /* matrix transmitted in the bitstream */
986e461dc072 Initial revision
glantau
parents:
diff changeset
115 UINT16 intra_matrix[64];
986e461dc072 Initial revision
glantau
parents:
diff changeset
116 UINT16 chroma_intra_matrix[64];
986e461dc072 Initial revision
glantau
parents:
diff changeset
117 UINT16 non_intra_matrix[64];
986e461dc072 Initial revision
glantau
parents:
diff changeset
118 UINT16 chroma_non_intra_matrix[64];
986e461dc072 Initial revision
glantau
parents:
diff changeset
119 /* precomputed matrix (combine qscale and DCT renorm) */
986e461dc072 Initial revision
glantau
parents:
diff changeset
120 int q_intra_matrix[64];
986e461dc072 Initial revision
glantau
parents:
diff changeset
121 int q_non_intra_matrix[64];
986e461dc072 Initial revision
glantau
parents:
diff changeset
122 int block_last_index[6]; /* last non zero coefficient in block */
986e461dc072 Initial revision
glantau
parents:
diff changeset
123
986e461dc072 Initial revision
glantau
parents:
diff changeset
124 void *opaque; /* private data for the user */
986e461dc072 Initial revision
glantau
parents:
diff changeset
125
986e461dc072 Initial revision
glantau
parents:
diff changeset
126 /* bit rate control */
986e461dc072 Initial revision
glantau
parents:
diff changeset
127 int I_frame_bits; /* wanted number of bits per I frame */
986e461dc072 Initial revision
glantau
parents:
diff changeset
128 int P_frame_bits; /* same for P frame */
64
5aa6292a1660 win32 fixes
glantau
parents: 41
diff changeset
129 INT64 wanted_bits;
5aa6292a1660 win32 fixes
glantau
parents: 41
diff changeset
130 INT64 total_bits;
79
82e579c37bc3 Moved some H.263+ variables to MpegEncContext to be thread-safe.
pulento
parents: 71
diff changeset
131
82e579c37bc3 Moved some H.263+ variables to MpegEncContext to be thread-safe.
pulento
parents: 71
diff changeset
132 /* H.263+ specific */
82e579c37bc3 Moved some H.263+ variables to MpegEncContext to be thread-safe.
pulento
parents: 71
diff changeset
133 int umvplus;
82e579c37bc3 Moved some H.263+ variables to MpegEncContext to be thread-safe.
pulento
parents: 71
diff changeset
134 int umvplus_dec;
82e579c37bc3 Moved some H.263+ variables to MpegEncContext to be thread-safe.
pulento
parents: 71
diff changeset
135
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
136 /* mpeg4 specific */
986e461dc072 Initial revision
glantau
parents:
diff changeset
137 int time_increment_bits;
64
5aa6292a1660 win32 fixes
glantau
parents: 41
diff changeset
138 int shape;
5aa6292a1660 win32 fixes
glantau
parents: 41
diff changeset
139 int vol_sprite_usage;
5aa6292a1660 win32 fixes
glantau
parents: 41
diff changeset
140 int quant_precision;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
141
986e461dc072 Initial revision
glantau
parents:
diff changeset
142 /* RV10 specific */
986e461dc072 Initial revision
glantau
parents:
diff changeset
143 int rv10_version; /* RV10 version: 0 or 3 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
144 int rv10_first_dc_coded[3];
986e461dc072 Initial revision
glantau
parents:
diff changeset
145
986e461dc072 Initial revision
glantau
parents:
diff changeset
146 /* MJPEG specific */
986e461dc072 Initial revision
glantau
parents:
diff changeset
147 struct MJpegContext *mjpeg_ctx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
148
986e461dc072 Initial revision
glantau
parents:
diff changeset
149 /* MSMPEG4 specific */
986e461dc072 Initial revision
glantau
parents:
diff changeset
150 int mv_table_index;
986e461dc072 Initial revision
glantau
parents:
diff changeset
151 int rl_table_index;
986e461dc072 Initial revision
glantau
parents:
diff changeset
152 int rl_chroma_table_index;
986e461dc072 Initial revision
glantau
parents:
diff changeset
153 int dc_table_index;
986e461dc072 Initial revision
glantau
parents:
diff changeset
154 int use_skip_mb_code;
986e461dc072 Initial revision
glantau
parents:
diff changeset
155 int slice_height; /* in macroblocks */
986e461dc072 Initial revision
glantau
parents:
diff changeset
156 int first_slice_line;
986e461dc072 Initial revision
glantau
parents:
diff changeset
157 /* decompression specific */
986e461dc072 Initial revision
glantau
parents:
diff changeset
158 GetBitContext gb;
986e461dc072 Initial revision
glantau
parents:
diff changeset
159
986e461dc072 Initial revision
glantau
parents:
diff changeset
160 /* MPEG2 specific - I wish I had not to support this mess. */
986e461dc072 Initial revision
glantau
parents:
diff changeset
161 int progressive_sequence;
986e461dc072 Initial revision
glantau
parents:
diff changeset
162 int mpeg_f_code[2][2];
986e461dc072 Initial revision
glantau
parents:
diff changeset
163 int picture_structure;
986e461dc072 Initial revision
glantau
parents:
diff changeset
164 /* picture type */
986e461dc072 Initial revision
glantau
parents:
diff changeset
165 #define PICT_TOP_FIELD 1
986e461dc072 Initial revision
glantau
parents:
diff changeset
166 #define PICT_BOTTOM_FIELD 2
986e461dc072 Initial revision
glantau
parents:
diff changeset
167 #define PICT_FRAME 3
986e461dc072 Initial revision
glantau
parents:
diff changeset
168
986e461dc072 Initial revision
glantau
parents:
diff changeset
169 int intra_dc_precision;
986e461dc072 Initial revision
glantau
parents:
diff changeset
170 int frame_pred_frame_dct;
986e461dc072 Initial revision
glantau
parents:
diff changeset
171 int top_field_first;
986e461dc072 Initial revision
glantau
parents:
diff changeset
172 int concealment_motion_vectors;
986e461dc072 Initial revision
glantau
parents:
diff changeset
173 int q_scale_type;
986e461dc072 Initial revision
glantau
parents:
diff changeset
174 int intra_vlc_format;
986e461dc072 Initial revision
glantau
parents:
diff changeset
175 int alternate_scan;
986e461dc072 Initial revision
glantau
parents:
diff changeset
176 int repeat_first_field;
986e461dc072 Initial revision
glantau
parents:
diff changeset
177 int chroma_420_type;
986e461dc072 Initial revision
glantau
parents:
diff changeset
178 int progressive_frame;
986e461dc072 Initial revision
glantau
parents:
diff changeset
179 int mpeg2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
180 int full_pel[2];
986e461dc072 Initial revision
glantau
parents:
diff changeset
181 int interlaced_dct;
986e461dc072 Initial revision
glantau
parents:
diff changeset
182 int last_qscale;
986e461dc072 Initial revision
glantau
parents:
diff changeset
183 int first_slice;
13
174ef88f619a use block[] in structure to have it aligned on 8 bytes for mmx optimizations - dct_unquantize is always a function pointer - added specialized dct_unquantize_h263
glantau
parents: 7
diff changeset
184
174ef88f619a use block[] in structure to have it aligned on 8 bytes for mmx optimizations - dct_unquantize is always a function pointer - added specialized dct_unquantize_h263
glantau
parents: 7
diff changeset
185 DCTELEM block[6][64] __align8;
174ef88f619a use block[] in structure to have it aligned on 8 bytes for mmx optimizations - dct_unquantize is always a function pointer - added specialized dct_unquantize_h263
glantau
parents: 7
diff changeset
186 void (*dct_unquantize)(struct MpegEncContext *s,
174ef88f619a use block[] in structure to have it aligned on 8 bytes for mmx optimizations - dct_unquantize is always a function pointer - added specialized dct_unquantize_h263
glantau
parents: 7
diff changeset
187 DCTELEM *block, int n, int qscale);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
188 } MpegEncContext;
986e461dc072 Initial revision
glantau
parents:
diff changeset
189
986e461dc072 Initial revision
glantau
parents:
diff changeset
190 int MPV_common_init(MpegEncContext *s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
191 void MPV_common_end(MpegEncContext *s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
192 void MPV_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);
986e461dc072 Initial revision
glantau
parents:
diff changeset
193 void MPV_frame_start(MpegEncContext *s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
194 void MPV_frame_end(MpegEncContext *s);
13
174ef88f619a use block[] in structure to have it aligned on 8 bytes for mmx optimizations - dct_unquantize is always a function pointer - added specialized dct_unquantize_h263
glantau
parents: 7
diff changeset
195 #ifdef HAVE_MMX
174ef88f619a use block[] in structure to have it aligned on 8 bytes for mmx optimizations - dct_unquantize is always a function pointer - added specialized dct_unquantize_h263
glantau
parents: 7
diff changeset
196 void MPV_common_init_mmx(MpegEncContext *s);
174ef88f619a use block[] in structure to have it aligned on 8 bytes for mmx optimizations - dct_unquantize is always a function pointer - added specialized dct_unquantize_h263
glantau
parents: 7
diff changeset
197 #endif
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
198
986e461dc072 Initial revision
glantau
parents:
diff changeset
199 /* motion_est.c */
986e461dc072 Initial revision
glantau
parents:
diff changeset
200
986e461dc072 Initial revision
glantau
parents:
diff changeset
201 int estimate_motion(MpegEncContext *s,
986e461dc072 Initial revision
glantau
parents:
diff changeset
202 int mb_x, int mb_y,
986e461dc072 Initial revision
glantau
parents:
diff changeset
203 int *mx_ptr, int *my_ptr);
986e461dc072 Initial revision
glantau
parents:
diff changeset
204
986e461dc072 Initial revision
glantau
parents:
diff changeset
205 /* mpeg12.c */
41
d99e8a2351f4 fixed scan protos
glantau
parents: 19
diff changeset
206 extern INT16 default_intra_matrix[64];
d99e8a2351f4 fixed scan protos
glantau
parents: 19
diff changeset
207 extern INT16 default_non_intra_matrix[64];
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
208
986e461dc072 Initial revision
glantau
parents:
diff changeset
209 void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number);
986e461dc072 Initial revision
glantau
parents:
diff changeset
210 void mpeg1_encode_mb(MpegEncContext *s,
986e461dc072 Initial revision
glantau
parents:
diff changeset
211 DCTELEM block[6][64],
986e461dc072 Initial revision
glantau
parents:
diff changeset
212 int motion_x, int motion_y);
986e461dc072 Initial revision
glantau
parents:
diff changeset
213
986e461dc072 Initial revision
glantau
parents:
diff changeset
214 /* h263enc.c */
986e461dc072 Initial revision
glantau
parents:
diff changeset
215
986e461dc072 Initial revision
glantau
parents:
diff changeset
216 /* run length table */
986e461dc072 Initial revision
glantau
parents:
diff changeset
217 #define MAX_RUN 64
986e461dc072 Initial revision
glantau
parents:
diff changeset
218 #define MAX_LEVEL 64
986e461dc072 Initial revision
glantau
parents:
diff changeset
219
986e461dc072 Initial revision
glantau
parents:
diff changeset
220 typedef struct RLTable {
986e461dc072 Initial revision
glantau
parents:
diff changeset
221 int n; /* number of entries of table_vlc minus 1 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
222 int last; /* number of values for last = 0 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
223 const UINT16 (*table_vlc)[2];
986e461dc072 Initial revision
glantau
parents:
diff changeset
224 const INT8 *table_run;
986e461dc072 Initial revision
glantau
parents:
diff changeset
225 const INT8 *table_level;
986e461dc072 Initial revision
glantau
parents:
diff changeset
226 UINT8 *index_run[2]; /* encoding only */
986e461dc072 Initial revision
glantau
parents:
diff changeset
227 INT8 *max_level[2]; /* encoding & decoding */
986e461dc072 Initial revision
glantau
parents:
diff changeset
228 INT8 *max_run[2]; /* encoding & decoding */
986e461dc072 Initial revision
glantau
parents:
diff changeset
229 VLC vlc; /* decoding only */
986e461dc072 Initial revision
glantau
parents:
diff changeset
230 } RLTable;
986e461dc072 Initial revision
glantau
parents:
diff changeset
231
986e461dc072 Initial revision
glantau
parents:
diff changeset
232 void init_rl(RLTable *rl);
986e461dc072 Initial revision
glantau
parents:
diff changeset
233 void init_vlc_rl(RLTable *rl);
986e461dc072 Initial revision
glantau
parents:
diff changeset
234
986e461dc072 Initial revision
glantau
parents:
diff changeset
235 extern inline int get_rl_index(const RLTable *rl, int last, int run, int level)
986e461dc072 Initial revision
glantau
parents:
diff changeset
236 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
237 int index;
986e461dc072 Initial revision
glantau
parents:
diff changeset
238 index = rl->index_run[last][run];
986e461dc072 Initial revision
glantau
parents:
diff changeset
239 if (index >= rl->n)
986e461dc072 Initial revision
glantau
parents:
diff changeset
240 return rl->n;
986e461dc072 Initial revision
glantau
parents:
diff changeset
241 if (level > rl->max_level[last][run])
986e461dc072 Initial revision
glantau
parents:
diff changeset
242 return rl->n;
986e461dc072 Initial revision
glantau
parents:
diff changeset
243 return index + level - 1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
244 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
245
986e461dc072 Initial revision
glantau
parents:
diff changeset
246 void h263_encode_mb(MpegEncContext *s,
986e461dc072 Initial revision
glantau
parents:
diff changeset
247 DCTELEM block[6][64],
986e461dc072 Initial revision
glantau
parents:
diff changeset
248 int motion_x, int motion_y);
986e461dc072 Initial revision
glantau
parents:
diff changeset
249 void h263_encode_picture_header(MpegEncContext *s, int picture_number);
986e461dc072 Initial revision
glantau
parents:
diff changeset
250 void h263_dc_scale(MpegEncContext *s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
251 INT16 *h263_pred_motion(MpegEncContext * s, int block,
986e461dc072 Initial revision
glantau
parents:
diff changeset
252 int *px, int *py);
986e461dc072 Initial revision
glantau
parents:
diff changeset
253 void mpeg4_pred_ac(MpegEncContext * s, INT16 *block, int n,
986e461dc072 Initial revision
glantau
parents:
diff changeset
254 int dir);
986e461dc072 Initial revision
glantau
parents:
diff changeset
255 void mpeg4_encode_picture_header(MpegEncContext *s, int picture_number);
986e461dc072 Initial revision
glantau
parents:
diff changeset
256 void h263_encode_init_vlc(MpegEncContext *s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
257
986e461dc072 Initial revision
glantau
parents:
diff changeset
258 void h263_decode_init_vlc(MpegEncContext *s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
259 int h263_decode_picture_header(MpegEncContext *s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
260 int mpeg4_decode_picture_header(MpegEncContext * s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
261 int intel_h263_decode_picture_header(MpegEncContext *s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
262 int h263_decode_mb(MpegEncContext *s,
986e461dc072 Initial revision
glantau
parents:
diff changeset
263 DCTELEM block[6][64]);
986e461dc072 Initial revision
glantau
parents:
diff changeset
264 int h263_get_picture_format(int width, int height);
986e461dc072 Initial revision
glantau
parents:
diff changeset
265
986e461dc072 Initial revision
glantau
parents:
diff changeset
266 /* rv10.c */
986e461dc072 Initial revision
glantau
parents:
diff changeset
267 void rv10_encode_picture_header(MpegEncContext *s, int picture_number);
986e461dc072 Initial revision
glantau
parents:
diff changeset
268 int rv_decode_dc(MpegEncContext *s, int n);
986e461dc072 Initial revision
glantau
parents:
diff changeset
269
986e461dc072 Initial revision
glantau
parents:
diff changeset
270 /* msmpeg4.c */
986e461dc072 Initial revision
glantau
parents:
diff changeset
271 void msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number);
986e461dc072 Initial revision
glantau
parents:
diff changeset
272 void msmpeg4_encode_mb(MpegEncContext * s,
986e461dc072 Initial revision
glantau
parents:
diff changeset
273 DCTELEM block[6][64],
986e461dc072 Initial revision
glantau
parents:
diff changeset
274 int motion_x, int motion_y);
986e461dc072 Initial revision
glantau
parents:
diff changeset
275 void msmpeg4_dc_scale(MpegEncContext * s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
276 int msmpeg4_decode_picture_header(MpegEncContext * s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
277 int msmpeg4_decode_mb(MpegEncContext *s,
986e461dc072 Initial revision
glantau
parents:
diff changeset
278 DCTELEM block[6][64]);
986e461dc072 Initial revision
glantau
parents:
diff changeset
279 int msmpeg4_decode_init_vlc(MpegEncContext *s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
280
986e461dc072 Initial revision
glantau
parents:
diff changeset
281 /* mjpegenc.c */
986e461dc072 Initial revision
glantau
parents:
diff changeset
282
986e461dc072 Initial revision
glantau
parents:
diff changeset
283 int mjpeg_init(MpegEncContext *s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
284 void mjpeg_close(MpegEncContext *s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
285 void mjpeg_encode_mb(MpegEncContext *s,
986e461dc072 Initial revision
glantau
parents:
diff changeset
286 DCTELEM block[6][64]);
986e461dc072 Initial revision
glantau
parents:
diff changeset
287 void mjpeg_picture_header(MpegEncContext *s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
288 void mjpeg_picture_trailer(MpegEncContext *s);