Parent Directory | Revision Log
Revision 660 - (view) (download)
1 : | Isibaar | 3 | #ifndef _CODEC_H_ |
2 : | #define _CODEC_H_ | ||
3 : | |||
4 : | #include <windows.h> | ||
5 : | #include <vfw.h> | ||
6 : | #include "config.h" | ||
7 : | h | 527 | #include "xvid.h" |
8 : | Isibaar | 3 | |
9 : | suxen_drol | 595 | #if defined(_DEBUG) |
10 : | #define DEBUG(X) OutputDebugString(X) | ||
11 : | #define DEBUG1(X,A) { char tmp[120]; wsprintf(tmp, "%s %i", (X), (A)); OutputDebugString(tmp); } | ||
12 : | #define DEBUG2(X,A,B) { char tmp[120]; wsprintf(tmp, "%s %i %i", (X), (A), (B)); OutputDebugString(tmp); } | ||
13 : | #define DEBUG3(X,A,B,C) { char tmp[120]; wsprintf(tmp, "%s %i %i %i", (X), (A), (B), (C)); OutputDebugString(tmp); } | ||
14 : | #define DEBUG4(X,A,B,C,D) { char tmp[120]; wsprintf(tmp, "%s %i %i %i %i", (X), (A), (B), (C), (D)); OutputDebugString(tmp); } | ||
15 : | #define DEBUG5(X,A,B,C,D,E) { char tmp[120]; wsprintf(tmp, "%s %i %i %i %i %i", (X), (A), (B), (C), (D), (E)); OutputDebugString(tmp); } | ||
16 : | #define DEBUGFOURCC(X,Y) { char tmp[120]; wsprintf(tmp, "%s %c %c %c %c", (X), (Y)&0xff, ((Y)>>8)&0xff, ((Y)>>16)&0xff, ((Y)>>24)&0xff); OutputDebugString(tmp); } | ||
17 : | #else | ||
18 : | h | 32 | #define DEBUG(X) |
19 : | Foxer | 94 | #define DEBUG1(X,A) { char tmp[120]; wsprintf(tmp, "%s %i", (X), (A)); OutputDebugString(tmp); } |
20 : | Isibaar | 3 | #define DEBUG2(X,A,B) |
21 : | #define DEBUG3(X,A,B,C) | ||
22 : | #define DEBUG4(X,A,B,C,D) | ||
23 : | #define DEBUG5(X,A,B,C,D,E) | ||
24 : | #define DEBUGFOURCC(X,Y) | ||
25 : | suxen_drol | 595 | #endif |
26 : | |||
27 : | |||
28 : | h | 61 | #define DEBUGERR(X) OutputDebugString(X) |
29 : | Isibaar | 3 | #define DEBUG2P(X) OutputDebugString(X) |
30 : | suxen_drol | 660 | #define DEBUG1ST(A,B,C,D,E,F,G) { char tmp[140]; wsprintf(tmp, "1st-pass: size:%d total-kbytes:%d %s quant:%d %s kblocks:%d mblocks:%d", (A), (B), (C), (D), (E), (F), (G)); OutputDebugString(tmp); } |
31 : | #define DEBUG2ND(A,B,C,D,E,F,G,H) { char tmp[140]; wsprintf(tmp, "2nd-pass: quant:%d %s %s stats1:%d scaled:%d actual:%d overflow:%d %s", (A), (B), (C), (D), (E), (F), (G), (H) ? "credits" : "movie"); OutputDebugString(tmp); } | ||
32 : | Isibaar | 3 | |
33 : | |||
34 : | #define FOURCC_XVID mmioFOURCC('X','V','I','D') | ||
35 : | #define FOURCC_DIVX mmioFOURCC('D','I','V','X') | ||
36 : | h | 30 | #define FOURCC_DX50 mmioFOURCC('D','X','5','0') |
37 : | Isibaar | 3 | //#define FOURCC_DIV3 mmioFOURCC('D','I','V','3') |
38 : | //#define FOURCC_DIV4 mmioFOURCC('D','I','V','4') | ||
39 : | |||
40 : | /* yuyu 4:2:2 16bit, y-u-y-v, packed*/ | ||
41 : | #define FOURCC_YUYV mmioFOURCC('Y','U','Y','V') | ||
42 : | #define FOURCC_YUY2 mmioFOURCC('Y','U','Y','2') | ||
43 : | |||
44 : | /* yvyu 4:2:2 16bit, y-v-y-u, packed*/ | ||
45 : | #define FOURCC_YVYU mmioFOURCC('Y','V','Y','U') | ||
46 : | |||
47 : | /* uyvy 4:2:2 16bit, u-y-v-y, packed */ | ||
48 : | #define FOURCC_UYVY mmioFOURCC('U','Y','V','Y') | ||
49 : | |||
50 : | /* i420 y-u-v, planar */ | ||
51 : | #define FOURCC_I420 mmioFOURCC('I','4','2','0') | ||
52 : | #define FOURCC_IYUV mmioFOURCC('I','Y','U','V') | ||
53 : | |||
54 : | /* yv12 y-v-u, planar */ | ||
55 : | #define FOURCC_YV12 mmioFOURCC('Y','V','1','2') | ||
56 : | |||
57 : | |||
58 : | |||
59 : | #define XVID_NAME_L L"XVID" | ||
60 : | #define XVID_DESC_L L"XviD MPEG-4 Codec" | ||
61 : | |||
62 : | |||
63 : | #define NNSTATS_KEYFRAME (1<<31) | ||
64 : | suxen_drol | 660 | #define NNSTATS_BFRAME (1<<30) |
65 : | #define NNSTATS_SKIPFRAME (1<<29) | ||
66 : | #define NNSTATS_PADFRAME (1<<28) | ||
67 : | #define NNSTATS_DELAYFRAME (1<<27) | ||
68 : | Isibaar | 3 | |
69 : | typedef struct | ||
70 : | { | ||
71 : | /* frame length (bytes) */ | ||
72 : | |||
73 : | DWORD bytes; | ||
74 : | |||
75 : | /* ignored & zero'd by gk | ||
76 : | xvid specific: dk_v = frame header bytes | ||
77 : | */ | ||
78 : | |||
79 : | int dk_v, dk_u, dk_y; | ||
80 : | int dd_v, dd_u, dd_y; | ||
81 : | int mk_u, mk_y; | ||
82 : | int md_u, md_y; | ||
83 : | |||
84 : | /* q used for this frame | ||
85 : | set bit 31 for keyframe */ | ||
86 : | |||
87 : | int quant; | ||
88 : | |||
89 : | /* key, motion, not-coded macroblocks */ | ||
90 : | |||
91 : | int kblk, mblk, ublk; | ||
92 : | |||
93 : | /* lum_noise is actually a double (as 8 bytes) | ||
94 : | for some reason msvc6.0 stores doubles as 12 bytes!? | ||
95 : | lum_noise is not used so it doesnt matter */ | ||
96 : | |||
97 : | float lum_noise[2]; | ||
98 : | } NNSTATS; | ||
99 : | |||
100 : | |||
101 : | typedef struct | ||
102 : | { | ||
103 : | h | 102 | HANDLE hints; |
104 : | h | 30 | HANDLE stats1; |
105 : | HANDLE stats2; | ||
106 : | Isibaar | 3 | |
107 : | h | 102 | void * hintstream; |
108 : | |||
109 : | Isibaar | 3 | int bytes1; |
110 : | int bytes2; | ||
111 : | int desired_bytes2; | ||
112 : | |||
113 : | Foxer | 342 | int keyframe_locations[20480]; |
114 : | h | 109 | int max_framesize; |
115 : | suxen_drol | 660 | int minbsize, minpsize, minisize; |
116 : | Foxer | 94 | double movie_curve; |
117 : | double credits_start_curve; | ||
118 : | double credits_end_curve; | ||
119 : | Isibaar | 3 | |
120 : | suxen_drol | 660 | double average_pframe; |
121 : | double average_bframe; | ||
122 : | Isibaar | 3 | double curve_comp_scale; |
123 : | h | 61 | double curve_bias_bonus; |
124 : | double alt_curve_low; | ||
125 : | double alt_curve_high; | ||
126 : | double alt_curve_low_diff; | ||
127 : | double alt_curve_high_diff; | ||
128 : | double alt_curve_mid_qual; | ||
129 : | double alt_curve_qual_dev; | ||
130 : | Foxer | 342 | int overflow, KF_idx, KFoverflow, KFoverflow_partial; |
131 : | h | 105 | int quant_count[32]; |
132 : | Isibaar | 3 | |
133 : | NNSTATS nns1; | ||
134 : | NNSTATS nns2; | ||
135 : | suxen_drol | 660 | |
136 : | NNSTATS* nns1_array; | ||
137 : | NNSTATS* nns2_array; | ||
138 : | int nns_array_size; | ||
139 : | int nns_array_length; | ||
140 : | int nns_array_pos; | ||
141 : | Isibaar | 3 | } TWOPASS; |
142 : | |||
143 : | |||
144 : | typedef struct | ||
145 : | { | ||
146 : | // config | ||
147 : | CONFIG config; | ||
148 : | |||
149 : | // encore | ||
150 : | void * ehandle; | ||
151 : | int fincr; | ||
152 : | int fbase; | ||
153 : | int framenum; | ||
154 : | int keyspacing; | ||
155 : | |||
156 : | // encore 2pass | ||
157 : | TWOPASS twopass; | ||
158 : | |||
159 : | // decore | ||
160 : | void * dhandle; | ||
161 : | int dopt; // DEC_OPT_DECODE, DEC_OPT_DECODE_MS | ||
162 : | } CODEC; | ||
163 : | |||
164 : | |||
165 : | h | 30 | int get_colorspace(BITMAPINFOHEADER *); |
166 : | |||
167 : | Isibaar | 3 | LRESULT compress_query(CODEC *, BITMAPINFO *, BITMAPINFO *); |
168 : | LRESULT compress_get_format(CODEC *, BITMAPINFO *, BITMAPINFO *); | ||
169 : | LRESULT compress_get_size(CODEC *, BITMAPINFO *, BITMAPINFO *); | ||
170 : | LRESULT compress_frames_info(CODEC *, ICCOMPRESSFRAMES *); | ||
171 : | LRESULT compress_begin(CODEC *, BITMAPINFO *, BITMAPINFO *); | ||
172 : | LRESULT compress_end(CODEC *); | ||
173 : | LRESULT compress(CODEC *, ICCOMPRESS *); | ||
174 : | |||
175 : | LRESULT decompress_query(CODEC *, BITMAPINFO *, BITMAPINFO *); | ||
176 : | LRESULT decompress_get_format(CODEC *, BITMAPINFO *, BITMAPINFO *); | ||
177 : | LRESULT decompress_begin(CODEC *, BITMAPINFO *, BITMAPINFO *); | ||
178 : | LRESULT decompress_end(CODEC *); | ||
179 : | LRESULT decompress(CODEC *, ICDECOMPRESS *); | ||
180 : | |||
181 : | int codec_get_quant(CODEC *, XVID_ENC_FRAME *); | ||
182 : | int codec_is_in_credits(CONFIG *, int); | ||
183 : | Foxer | 362 | int codec_get_vbr_quant(CONFIG *, int); |
184 : | |||
185 : | // added by Koepi for greyscale credits | ||
186 : | chl | 361 | int check_greyscale_mode(CONFIG *, XVID_ENC_FRAME* , int); |
187 : | // end of koepi's additions | ||
188 : | Isibaar | 3 | |
189 : | #endif /* _CODEC_H_ */ |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |