4 #define SEQ_END_CODE 0x000001b7
5 #define SEQ_START_CODE 0x000001b3
6 #define GOP_START_CODE 0x000001b8
7 #define PICTURE_START_CODE 0x00000100
8 #define SLICE_MIN_START_CODE 0x00000101
9 #define SLICE_MAX_START_CODE 0x000001af
10 #define EXT_START_CODE 0x000001b5
11 #define USER_START_CODE 0x000001b2
13 /* Macros for picture code type. */
26 #define MAX_NEG_CROP 384
28 #define MPEG_BUF_SIZE (16 * 1024)
30 typedef struct MpegEncContext {
31 /* the following parameters must be initialized before encoding */
32 int width, height; /* picture size. must be a multiple of 16 */
34 int frame_rate; /* number of frames per second */
35 int intra_only; /* if true, only intra pictures are generated */
36 int bit_rate; /* wanted bit rate */
37 enum OutputFormat out_format; /* output format */
38 int h263_rv10; /* use RV10 variation for H263 */
40 /* the following fields are managed internally by the encoder */
45 /* sequence parameters */
47 int fake_picture_number; /* picture number at the bitstream frame rate */
48 int gop_picture_number; /* index of the first picture of a GOP */
49 int mb_width, mb_height;
50 UINT8 *new_picture[3]; /* picture to be compressed */
51 UINT8 *last_picture[3]; /* previous picture */
52 UINT8 *current_picture[3]; /* buffer to store the decompressed current picture */
57 /* macroblock layer */
60 /* matrix transmitted in the bitstream */
61 UINT8 init_intra_matrix[64];
62 /* precomputed matrix (combine qscale and DCT renorm) */
64 int non_intra_matrix[64];
65 int block_last_index[6]; /* last non zero coefficient in block */
67 void *opaque; /* private data for the user */
69 /* bit rate control */
70 int I_frame_bits; /* wanted number of bits per I frame */
71 int P_frame_bits; /* same for P frame */
72 long long wanted_bits;
74 struct MJpegContext *mjpeg_ctx;
77 extern const UINT8 zigzag_direct[64];
81 void h263_encode_mb(MpegEncContext *s,
83 int motion_x, int motion_y);
84 void h263_picture_header(MpegEncContext *s, int picture_number);
85 void rv10_encode_picture_header(MpegEncContext *s, int picture_number);
89 int mjpeg_init(MpegEncContext *s);
90 void mjpeg_close(MpegEncContext *s);
91 void mjpeg_encode_mb(MpegEncContext *s,
92 DCTELEM block[6][64]);
93 void mjpeg_picture_header(MpegEncContext *s);
94 void mjpeg_picture_trailer(MpegEncContext *s);