Parent Directory
|
Revision Log
Revision 3 - (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 : | #include "xvid.h" | ||
8 : | |||
9 : | #define DEBUG(X) | ||
10 : | // OutputDebugString(X) | ||
11 : | #define DEBUG1(X,A) | ||
12 : | // { char tmp[100]; wsprintf(tmp, "%s %i", (X), (A)); OutputDebugString(tmp); } | ||
13 : | #define DEBUG2(X,A,B) | ||
14 : | // { char tmp[100]; wsprintf(tmp, "%s %i %i", (X), (A), (B)); OutputDebugString(tmp); } | ||
15 : | #define DEBUG3(X,A,B,C) | ||
16 : | // { char tmp[100]; wsprintf(tmp, "%s %i %i %i", (X), (A), (B), (C)); OutputDebugString(tmp); } | ||
17 : | #define DEBUG4(X,A,B,C,D) | ||
18 : | // { char tmp[100]; wsprintf(tmp, "%s %i %i %i %i", (X), (A), (B), (C), (D)); OutputDebugString(tmp); } | ||
19 : | #define DEBUG5(X,A,B,C,D,E) | ||
20 : | // { char tmp[100]; wsprintf(tmp, "%s %i %i %i %i %i", (X), (A), (B), (C), (D), (E)); OutputDebugString(tmp); } | ||
21 : | #define DEBUGFOURCC(X,Y) | ||
22 : | // { char tmp[100]; wsprintf(tmp, "%s %c %c %c %c", (X), (Y)&0xff, ((Y)>>8)&0xff, ((Y)>>16)&0xff, ((Y)>>24)&0xff); OutputDebugString(tmp); } | ||
23 : | #define DEBUG2P(X) OutputDebugString(X) | ||
24 : | #define DEBUG1ST(A,B,C,D,E,F) { char tmp[100]; wsprintf(tmp, "1st-pass: size:%d total-kbytes:%d %s quant:%d kblocks:%d mblocks:%d", (A), (B), (C) ? "intra" : "inter", (D), (E), (F)); OutputDebugString(tmp); } | ||
25 : | #define DEBUG2ND(A,B,C,D,E,F,G) { char tmp[100]; wsprintf(tmp, "2nd-pass: quant:%d %s stats1:%d scaled:%d actual:%d overflow:%d %s", (A), (B) ? "intra" : "inter", (C), (D), (E), (F), (G) ? "credits" : "movie"); OutputDebugString(tmp); } | ||
26 : | |||
27 : | |||
28 : | #define FOURCC_XVID mmioFOURCC('X','V','I','D') | ||
29 : | #define FOURCC_DIVX mmioFOURCC('D','I','V','X') | ||
30 : | //#define FOURCC_DIV3 mmioFOURCC('D','I','V','3') | ||
31 : | //#define FOURCC_DIV4 mmioFOURCC('D','I','V','4') | ||
32 : | |||
33 : | /* yuyu 4:2:2 16bit, y-u-y-v, packed*/ | ||
34 : | #define FOURCC_YUYV mmioFOURCC('Y','U','Y','V') | ||
35 : | #define FOURCC_YUY2 mmioFOURCC('Y','U','Y','2') | ||
36 : | #define FOURCC_V422 mmioFOURCC('V','4','2','2') | ||
37 : | |||
38 : | /* yvyu 4:2:2 16bit, y-v-y-u, packed*/ | ||
39 : | #define FOURCC_YVYU mmioFOURCC('Y','V','Y','U') | ||
40 : | |||
41 : | /* uyvy 4:2:2 16bit, u-y-v-y, packed */ | ||
42 : | #define FOURCC_UYVY mmioFOURCC('U','Y','V','Y') | ||
43 : | |||
44 : | /* i420 y-u-v, planar */ | ||
45 : | #define FOURCC_I420 mmioFOURCC('I','4','2','0') | ||
46 : | #define FOURCC_IYUV mmioFOURCC('I','Y','U','V') | ||
47 : | |||
48 : | /* yv12 y-v-u, planar */ | ||
49 : | #define FOURCC_YV12 mmioFOURCC('Y','V','1','2') | ||
50 : | |||
51 : | |||
52 : | |||
53 : | #define XVID_NAME_L L"XVID" | ||
54 : | #define XVID_DESC_L L"XviD MPEG-4 Codec" | ||
55 : | |||
56 : | |||
57 : | #define NNSTATS_KEYFRAME (1<<31) | ||
58 : | |||
59 : | typedef struct | ||
60 : | { | ||
61 : | /* frame length (bytes) */ | ||
62 : | |||
63 : | DWORD bytes; | ||
64 : | |||
65 : | /* ignored & zero'd by gk | ||
66 : | xvid specific: dk_v = frame header bytes | ||
67 : | */ | ||
68 : | |||
69 : | int dk_v, dk_u, dk_y; | ||
70 : | int dd_v, dd_u, dd_y; | ||
71 : | int mk_u, mk_y; | ||
72 : | int md_u, md_y; | ||
73 : | |||
74 : | /* q used for this frame | ||
75 : | set bit 31 for keyframe */ | ||
76 : | |||
77 : | int quant; | ||
78 : | |||
79 : | /* key, motion, not-coded macroblocks */ | ||
80 : | |||
81 : | int kblk, mblk, ublk; | ||
82 : | |||
83 : | /* lum_noise is actually a double (as 8 bytes) | ||
84 : | for some reason msvc6.0 stores doubles as 12 bytes!? | ||
85 : | lum_noise is not used so it doesnt matter */ | ||
86 : | |||
87 : | float lum_noise[2]; | ||
88 : | } NNSTATS; | ||
89 : | |||
90 : | |||
91 : | typedef struct | ||
92 : | { | ||
93 : | HANDLE * stats1; | ||
94 : | HANDLE * stats2; | ||
95 : | |||
96 : | int bytes1; | ||
97 : | int bytes2; | ||
98 : | int desired_bytes2; | ||
99 : | |||
100 : | float movie_curve; | ||
101 : | float credits_start_curve; | ||
102 : | float credits_end_curve; | ||
103 : | |||
104 : | double average_frame; | ||
105 : | double curve_comp_scale; | ||
106 : | int overflow; | ||
107 : | |||
108 : | NNSTATS nns1; | ||
109 : | NNSTATS nns2; | ||
110 : | } TWOPASS; | ||
111 : | |||
112 : | |||
113 : | typedef struct | ||
114 : | { | ||
115 : | // config | ||
116 : | CONFIG config; | ||
117 : | |||
118 : | // encore | ||
119 : | void * ehandle; | ||
120 : | int fincr; | ||
121 : | int fbase; | ||
122 : | int framenum; | ||
123 : | int keyspacing; | ||
124 : | |||
125 : | // encore 2pass | ||
126 : | TWOPASS twopass; | ||
127 : | |||
128 : | // decore | ||
129 : | void * dhandle; | ||
130 : | int dopt; // DEC_OPT_DECODE, DEC_OPT_DECODE_MS | ||
131 : | } CODEC; | ||
132 : | |||
133 : | |||
134 : | LRESULT compress_query(CODEC *, BITMAPINFO *, BITMAPINFO *); | ||
135 : | LRESULT compress_get_format(CODEC *, BITMAPINFO *, BITMAPINFO *); | ||
136 : | LRESULT compress_get_size(CODEC *, BITMAPINFO *, BITMAPINFO *); | ||
137 : | LRESULT compress_frames_info(CODEC *, ICCOMPRESSFRAMES *); | ||
138 : | LRESULT compress_begin(CODEC *, BITMAPINFO *, BITMAPINFO *); | ||
139 : | LRESULT compress_end(CODEC *); | ||
140 : | LRESULT compress(CODEC *, ICCOMPRESS *); | ||
141 : | |||
142 : | LRESULT decompress_query(CODEC *, BITMAPINFO *, BITMAPINFO *); | ||
143 : | LRESULT decompress_get_format(CODEC *, BITMAPINFO *, BITMAPINFO *); | ||
144 : | LRESULT decompress_begin(CODEC *, BITMAPINFO *, BITMAPINFO *); | ||
145 : | LRESULT decompress_end(CODEC *); | ||
146 : | LRESULT decompress(CODEC *, ICDECOMPRESS *); | ||
147 : | |||
148 : | int codec_2pass_init(CODEC *); | ||
149 : | int codec_get_quant(CODEC *, XVID_ENC_FRAME *); | ||
150 : | int codec_2pass_get_quant(CODEC *, XVID_ENC_FRAME *); | ||
151 : | int codec_2pass_update(CODEC *, XVID_ENC_FRAME *, XVID_ENC_STATS *); | ||
152 : | int codec_is_in_credits(CONFIG *, int); | ||
153 : | int codec_get_vbr_quant(CONFIG *, int); | ||
154 : | |||
155 : | |||
156 : | #endif /* _CODEC_H_ */ |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |