--- branches/dev-api-4/xvidcore/vfw/src/codec.h 2003/02/22 08:24:01 889 +++ branches/dev-api-4/xvidcore/vfw/src/codec.h 2003/04/12 06:58:50 983 @@ -1,163 +1,45 @@ #ifndef _CODEC_H_ #define _CODEC_H_ -#include #include -#include #include "config.h" -#if defined(_DEBUG) -#define DEBUG(X) OutputDebugString(X) -#define DEBUG1(X,A) { char tmp[120]; wsprintf(tmp, "%s %i", (X), (A)); OutputDebugString(tmp); } -#define DEBUG2(X,A,B) { char tmp[120]; wsprintf(tmp, "%s %i %i", (X), (A), (B)); OutputDebugString(tmp); } -#define DEBUG3(X,A,B,C) { char tmp[120]; wsprintf(tmp, "%s %i %i %i", (X), (A), (B), (C)); OutputDebugString(tmp); } -#define DEBUG4(X,A,B,C,D) { char tmp[120]; wsprintf(tmp, "%s %i %i %i %i", (X), (A), (B), (C), (D)); OutputDebugString(tmp); } -#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); } -#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); } -#else -#define DEBUG(X) -#define DEBUG1(X,A) { char tmp[120]; wsprintf(tmp, "%s %i", (X), (A)); OutputDebugString(tmp); } -#define DEBUG2(X,A,B) -#define DEBUG3(X,A,B,C) -#define DEBUG4(X,A,B,C,D) -#define DEBUG5(X,A,B,C,D,E) -#define DEBUGFOURCC(X,Y) -#endif - - -#define DEBUGERR(X) OutputDebugString(X) -#define DEBUG2P(X) OutputDebugString(X) -#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); } -#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); } - +#define XVID_NAME_L L"XVID" +#define XVID_DESC_L L"XviD MPEG-4 Codec" #define FOURCC_XVID mmioFOURCC('X','V','I','D') #define FOURCC_DIVX mmioFOURCC('D','I','V','X') #define FOURCC_DX50 mmioFOURCC('D','X','5','0') -//#define FOURCC_DIV3 mmioFOURCC('D','I','V','3') -//#define FOURCC_DIV4 mmioFOURCC('D','I','V','4') - /* yuyu 4:2:2 16bit, y-u-y-v, packed*/ #define FOURCC_YUYV mmioFOURCC('Y','U','Y','V') #define FOURCC_YUY2 mmioFOURCC('Y','U','Y','2') - /* yvyu 4:2:2 16bit, y-v-y-u, packed*/ #define FOURCC_YVYU mmioFOURCC('Y','V','Y','U') - /* uyvy 4:2:2 16bit, u-y-v-y, packed */ #define FOURCC_UYVY mmioFOURCC('U','Y','V','Y') - /* i420 y-u-v, planar */ #define FOURCC_I420 mmioFOURCC('I','4','2','0') #define FOURCC_IYUV mmioFOURCC('I','Y','U','V') - /* yv12 y-v-u, planar */ #define FOURCC_YV12 mmioFOURCC('Y','V','1','2') - -#define XVID_NAME_L L"XVID" -#define XVID_DESC_L L"XviD MPEG-4 Codec" - - -#define NNSTATS_KEYFRAME (1<<31) -#define NNSTATS_BFRAME (1<<30) - -typedef struct -{ - /* frame length (bytes) */ - - DWORD bytes; - - /* ignored & zero'd by gk - xvid specific: dk_v = frame header bytes - */ - - int dk_v, dk_u, dk_y; - int dd_v, dd_u, dd_y; - int mk_u, mk_y; - int md_u, md_y; - - /* q used for this frame - set bit 31 for keyframe */ - - int quant; - - /* key, motion, not-coded macroblocks */ - - int kblk, mblk, ublk; - - /* lum_noise is actually a double (as 8 bytes) - for some reason msvc6.0 stores doubles as 12 bytes!? - lum_noise is not used so it doesnt matter */ - - float lum_noise[2]; -} NNSTATS; - - -typedef struct -{ - HANDLE hints; - HANDLE stats1; - HANDLE stats2; - - void * hintstream; - - int bytes1; - int bytes2; - int desired_bytes2; - - int keyframe_locations[20480]; - int max_framesize; - int minbsize, minpsize, minisize; - double movie_curve; - double credits_start_curve; - double credits_end_curve; - - double average_pframe; - double average_bframe; - double curve_comp_scale; - double curve_bias_bonus; - double alt_curve_low; - double alt_curve_high; - double alt_curve_low_diff; - double alt_curve_high_diff; - double alt_curve_mid_qual; - double alt_curve_qual_dev; - int overflow, KF_idx, KFoverflow, KFoverflow_partial; - int quant_count[32]; - - NNSTATS nns1; - NNSTATS nns2; - - NNSTATS* nns1_array; - NNSTATS* nns2_array; - int nns_array_size; - int nns_array_length; - int nns_array_pos; - - int nns_update_pos; /* codec_2pass_update() */ -} TWOPASS; - - typedef struct { - // config CONFIG config; - // encore + // decoder + void * dhandle; + + // encoder void * ehandle; int fincr; int fbase; - int framenum; + + // encoder min keyframe internal + int framenum; int keyspacing; - // encore 2pass - TWOPASS twopass; - - // decore - void * dhandle; - int dopt; // DEC_OPT_DECODE, DEC_OPT_DECODE_MS } CODEC; @@ -177,12 +59,4 @@ LRESULT decompress_end(CODEC *); LRESULT decompress(CODEC *, ICDECOMPRESS *); -int codec_get_quant(CODEC *, xvid_enc_frame_t *); -int codec_is_in_credits(CONFIG *, int); -int codec_get_vbr_quant(CONFIG *, int); - -// added by Koepi for greyscale credits -int check_greyscale_mode(CONFIG *, xvid_enc_frame_t* , int); -// end of koepi's additions - #endif /* _CODEC_H_ */