1 /*
2     libfame - Fast Assembly MPEG Encoder Library
3     Copyright (C) 2000-2001 Vivien Chappelier
4 
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Library General Public
7     License as published by the Free Software Foundation; either
8     version 2 of the License, or (at your option) any later version.
9 
10     This library is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13     Library General Public License for more details.
14 
15     You should have received a copy of the GNU Library General Public
16     License along with this library; if not, write to the Free
17     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 
20 #ifndef __FAME_SYNTAX_H
21 #define __FAME_SYNTAX_H
22 
23 #include "fame.h"
24 
25 #define FAME_SYNTAX_ARBITRARY_SHAPE 1 /* encode shape information */
26 #define FAME_SYNTAX_LOSSLESS_SHAPE  2 /* encode shape at full quality */
27 
28 typedef struct _fame_syntax_t_ {
29   FAME_EXTENDS(fame_object_t);
30   void (* init)            (struct _fame_syntax_t_ *syntax,
31 			    int mb_width,
32 			    int mb_height,
33 			    unsigned char **intra_default_matrix,
34 			    unsigned char **inter_default_matrix,
35 			    unsigned char *intra_dc_y_scale_table,
36 			    unsigned char *intra_dc_c_scale_table,
37 			    fame_mismatch_t *mismatch_type,
38 			    unsigned int flags);
39   void (* use)             (struct _fame_syntax_t_ *syntax,
40 			    unsigned char *buffer,
41 			    int size);
42   int  (* flush)           (struct _fame_syntax_t_ *syntax);
43   void (* start_sequence)  (struct _fame_syntax_t_ *syntax,
44 			    int width,
45 			    int height,
46 			    int fps_num,
47 			    int fps_den,
48 			    int size,
49 			    int bitrate);
50   void (* start_GOP)       (struct _fame_syntax_t_ *syntax,
51 			    int frame);
52   void (* start_picture)   (struct _fame_syntax_t_ *syntax,
53 			    char frame_type,
54 			    int frame_number,
55 			    fame_box_t *box,
56 			    int rounding_control,
57 			    int search_range);
58   void (* start_slice)     (struct _fame_syntax_t_ *syntax,
59 			    int vpos,
60 			    int length,
61 			    unsigned char qscale);
62   void (* end_slice)       (struct _fame_syntax_t_ *syntax);
63   void (* end_sequence)    (struct _fame_syntax_t_ *syntax);
64   void (* predict_vector)  (struct _fame_syntax_t_ *syntax,
65 			    int mb_x,
66 			    int mb_y,
67 			    int k,
68 			    fame_motion_vector_t *mv);
69   void (* compute_chrominance_vectors)(struct _fame_syntax_t_ *syntax,
70 				       struct _fame_motion_vector_t_ *vectors,
71 				       unsigned char pattern);
72   int (* write_intra_mb)  (struct _fame_syntax_t_ *syntax,
73                            int mb_x,
74                            int mb_y,
75                            short *blocks[6],
76                            unsigned char *bab,
77                            unsigned char *bab_map,
78                            fame_bab_t bab_type,
79                            int dquant,
80                            unsigned char pattern);
81   int (* write_inter_mb)  (struct _fame_syntax_t_ *syntax,
82                            int mb_x,
83                            int mb_y,
84                            short *blocks[6],
85                            unsigned char *bab,
86                            unsigned char *bab_map,
87                            fame_bab_t bab_type,
88                            int dquant,
89                            unsigned char pattern,
90                            fame_motion_vector_t *forward,
91                            fame_motion_vector_t *backward,
92                            fame_motion_coding_t motion_coding);
93   void (* close)           (struct _fame_syntax_t_ *syntax);
94 } fame_syntax_t;
95 
96 #define FAME_SYNTAX(x) ((fame_syntax_t *) x)
97 
98 #endif
99