[svn] / trunk / xvidcore / src / global.h Repository:
ViewVC logotype

Annotation of /trunk/xvidcore/src/global.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 603 - (view) (download)

1 : edgomez 406 /*****************************************************************************
2 :     *
3 :     * XVID MPEG-4 VIDEO CODEC
4 :     * - Global structures, constants -
5 :     *
6 : edgomez 603 * Copyright(C) 2002 Michael Militzer <isibaar@xvid.org>
7 : edgomez 406 *
8 :     * This program is an implementation of a part of one or more MPEG-4
9 :     * Video tools as specified in ISO/IEC 14496-2 standard. Those intending
10 :     * to use this software module in hardware or software products are
11 :     * advised that its use may infringe existing patents or copyrights, and
12 :     * any such use would be at such party's own risk. The original
13 :     * developer of this software module and his/her company, and subsequent
14 :     * editors and their companies, will have no liability for use of this
15 :     * software or modifications or derivatives thereof.
16 :     *
17 :     * This program is free software ; you can redistribute it and/or modify
18 :     * it under the terms of the GNU General Public License as published by
19 :     * the Free Software Foundation ; either version 2 of the License, or
20 :     * (at your option) any later version.
21 :     *
22 :     * This program is distributed in the hope that it will be useful,
23 :     * but WITHOUT ANY WARRANTY ; without even the implied warranty of
24 :     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 :     * GNU General Public License for more details.
26 :     *
27 :     * You should have received a copy of the GNU General Public License
28 :     * along with this program ; if not, write to the Free Software
29 :     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 :     *
31 : edgomez 603 * $Id: global.h,v 1.15 2002-10-19 11:41:11 edgomez Exp $
32 : edgomez 406 *
33 :     ****************************************************************************/
34 :    
35 : Isibaar 3 #ifndef _GLOBAL_H_
36 :     #define _GLOBAL_H_
37 :    
38 : h 101 #include "xvid.h"
39 : Isibaar 3 #include "portab.h"
40 :    
41 : suxen_drol 118 /* --- macroblock modes --- */
42 : Isibaar 3
43 :     #define MODE_INTER 0
44 :     #define MODE_INTER_Q 1
45 :     #define MODE_INTER4V 2
46 :     #define MODE_INTRA 3
47 :     #define MODE_INTRA_Q 4
48 :     #define MODE_STUFFING 7
49 :     #define MODE_NOT_CODED 16
50 :    
51 : suxen_drol 118 /* --- bframe specific --- */
52 :    
53 :     #define MODE_DIRECT 0
54 :     #define MODE_INTERPOLATE 1
55 :     #define MODE_BACKWARD 2
56 :     #define MODE_FORWARD 3
57 : chenm001 156 #define MODE_DIRECT_NONE_MV 4
58 : suxen_drol 118
59 :    
60 : Isibaar 3 typedef struct
61 :     {
62 : h 101 uint32_t bufa;
63 :     uint32_t bufb;
64 :     uint32_t buf;
65 :     uint32_t pos;
66 :     uint32_t *tail;
67 :     uint32_t *start;
68 :     uint32_t length;
69 : edgomez 195 }
70 : h 101 Bitstream;
71 : Isibaar 3
72 :    
73 :     #define MBPRED_SIZE 15
74 :    
75 :    
76 :     typedef struct
77 :     {
78 :     // decoder/encoder
79 :     VECTOR mvs[4];
80 :    
81 : chl 172 short int pred_values[6][MBPRED_SIZE];
82 :     int acpred_directions[6];
83 : edgomez 195
84 : Isibaar 3 int mode;
85 : edgomez 195 int quant; // absolute quant
86 : Isibaar 3
87 : h 69 int field_dct;
88 :     int field_pred;
89 :     int field_for_top;
90 :     int field_for_bot;
91 :    
92 : Isibaar 3 // encoder specific
93 :    
94 : chl 172 VECTOR mv16;
95 : Isibaar 3 VECTOR pmvs[4];
96 : chl 172
97 : edgomez 195 int32_t sad8[4]; // SAD values for inter4v-VECTORs
98 :     int32_t sad16; // SAD value for inter-VECTOR
99 : chl 172
100 : Isibaar 3 int dquant;
101 :     int cbp;
102 :    
103 : suxen_drol 118 // bframe stuff
104 :    
105 :     VECTOR b_mvs[4];
106 :     VECTOR b_pmvs[4];
107 :    
108 : chl 338 // bframe direct mode
109 :    
110 :     VECTOR directmv[4];
111 :     VECTOR deltamv;
112 :    
113 : chenm001 156 int mb_type;
114 :     int dbquant;
115 :    
116 : chl 277 // stuff for block based ME (needed for Qpel ME)
117 :     // backup of last integer ME vectors/sad
118 :    
119 :     VECTOR i_mv16;
120 : chl 287 VECTOR i_mvs[4];
121 : chl 277
122 : chl 287 int32_t i_sad8[4]; // SAD values for inter4v-VECTORs
123 :     int32_t i_sad16; // SAD value for inter-VECTOR
124 : chl 277
125 : edgomez 195 }
126 :     MACROBLOCK;
127 : Isibaar 3
128 : edgomez 195 static __inline int8_t
129 :     get_dc_scaler(uint32_t quant,
130 :     uint32_t lum)
131 : Isibaar 3 {
132 : edgomez 195 if (quant < 5)
133 :     return 8;
134 : Isibaar 3
135 : edgomez 195 if (quant < 25 && !lum)
136 :     return (quant + 13) / 2;
137 : Isibaar 3
138 : edgomez 195 if (quant < 9)
139 :     return 2 * quant;
140 : Isibaar 3
141 : edgomez 195 if (quant < 25)
142 :     return quant + 8;
143 : Isibaar 3
144 : edgomez 195 if (lum)
145 : Isibaar 157 return 2 * quant - 16;
146 : Isibaar 3 else
147 : edgomez 195 return quant - 6;
148 : Isibaar 3 }
149 :    
150 : suxen_drol 118 // useful macros
151 :    
152 :     #define MIN(X, Y) ((X)<(Y)?(X):(Y))
153 :     #define MAX(X, Y) ((X)>(Y)?(X):(Y))
154 :     #define ABS(X) (((X)>0)?(X):-(X))
155 :     #define SIGN(X) (((X)>0)?1:-1)
156 :    
157 :    
158 : edgomez 406 #endif /* _GLOBAL_H_ */

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4