]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/blob - libav/mpegvideo.h
test
[frescor/ffmpeg.git] / libav / mpegvideo.h
1 /* mpegencode.c */
2
3 /* Start codes. */
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
12
13 /* Macros for picture code type. */
14 #define I_TYPE 1
15 #define P_TYPE 2
16 #define B_TYPE 3
17
18 typedef int DCTELEM;
19
20 enum OutputFormat {
21     FMT_MPEG1,
22     FMT_H263,
23     FMT_MJPEG,
24 };
25
26 #define MAX_NEG_CROP 384
27
28 #define MPEG_BUF_SIZE (16 * 1024)
29
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 */
33     int gop_size;
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 */
39
40     /* the following fields are managed internally by the encoder */
41
42     /* bit output */
43     PutBitContext pb;
44
45     /* sequence parameters */
46     int picture_number;
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 */
53     int last_dc[3];
54     int qscale;
55     int pict_type;
56     int frame_rate_index;
57     /* macroblock layer */
58     int mb_incr;
59     int mb_intra;
60     /* matrix transmitted in the bitstream */
61     UINT8 init_intra_matrix[64];
62     /* precomputed matrix (combine qscale and DCT renorm) */
63     int intra_matrix[64];
64     int non_intra_matrix[64];
65     int block_last_index[6];  /* last non zero coefficient in block */
66
67     void *opaque; /* private data for the user */
68
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;
73     long long total_bits;
74     struct MJpegContext *mjpeg_ctx;
75 } MpegEncContext;
76
77 extern const UINT8 zigzag_direct[64];
78
79 /* h263enc.c */
80
81 void h263_encode_mb(MpegEncContext *s, 
82                     DCTELEM block[6][64],
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);
86
87 /* mjpegenc.c */
88
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);