--- branches/dev-api-4/xvidcore/vfw/src/config.h 2003/02/22 08:24:01 889 +++ branches/dev-api-4/xvidcore/vfw/src/config.h 2003/12/05 14:44:35 1242 @@ -1,11 +1,34 @@ +/***************************************************************************** + * + * XVID MPEG-4 VIDEO CODEC + * - VFW configuration header - + * + * Copyright(C) 2002-2003 Anonymous + * + * This program is free software ; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation ; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY ; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program ; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id: config.h,v 1.1.2.12 2003-12-05 14:44:35 edgomez Exp $ + * + ****************************************************************************/ #ifndef _CONFIG_H_ #define _CONFIG_H_ #include +#include "vfwext.h" - -HINSTANCE hInst; -HWND hTooltip; +extern HINSTANCE g_hInst; /* small hack */ @@ -16,6 +39,10 @@ /* one kilobit */ #define CONFIG_KBPS 1000 +/* min/max bitrate when not specified by profile */ +#define DEFAULT_MIN_KBPS 16 +#define DEFAULT_MAX_KBPS 10000 + /* registry stuff */ #define XVID_REG_KEY HKEY_CURRENT_USER #define XVID_REG_PARENT "Software\\GNU" @@ -27,40 +54,16 @@ #define XVID_SPECIAL_BUILD "(Vanilla CVS Build)" /* constants */ -#define CONFIG_HINTFILE "\\hintfile.mvh" -#define CONFIG_2PASS_1_FILE "\\video.stats" -#define CONFIG_2PASS_2_FILE "\\videogk.stats" - -/* property sheets - sheets can be reordered here */ -#define DLG_COUNT 6 - -#define DLG_GLOBAL 0 -#define DLG_QUANT 1 -#define DLG_2PASS 2 -#define DLG_2PASSALT 3 -#define DLG_CREDITS 4 -#define DLG_CPU 5 +#define CONFIG_2PASS_FILE "\\video.pass" /* codec modes */ -#define DLG_MODE_CBR 0 -#define DLG_MODE_VBR_QUAL 1 -#define DLG_MODE_VBR_QUANT 2 -#define DLG_MODE_2PASS_1 3 -#define DLG_MODE_2PASS_2_EXT 4 -#define DLG_MODE_2PASS_2_INT 5 -#define DLG_MODE_NULL 6 - -/* quantizer modes */ -#define QUANT_MODE_H263 0 -#define QUANT_MODE_MPEG 1 -#define QUANT_MODE_CUSTOM 2 -#define QUANT_MODE_MOD 3 -#define QUANT_MODE_MOD_NEW 4 +#define RC_MODE_1PASS 0 +#define RC_MODE_2PASS1 1 +#define RC_MODE_2PASS2 2 +#define RC_MODE_NULL 3 -/* credits modes */ -#define CREDITS_MODE_RATE 0 -#define CREDITS_MODE_QUANT 1 -#define CREDITS_MODE_SIZE 2 +#define RC_ZONE_WEIGHT 0 +#define RC_ZONE_QUANT 1 /* vhq modes */ #define VHQ_OFF 0 @@ -69,119 +72,116 @@ #define VHQ_MEDIUM_SEARCH 3 #define VHQ_WIDE_SEARCH 4 -#define CREDITS_START 1 -#define CREDITS_END 2 +/* quantizer modes */ +#define QUANT_MODE_H263 0 +#define QUANT_MODE_MPEG 1 +#define QUANT_MODE_CUSTOM 2 + + +#define MAX_ZONES 64 +typedef struct +{ + int frame; + + int type; + int mode; + int weight; + int quant; + + unsigned int greyscale; + unsigned int chroma_opt; + unsigned int bvop_threshold; +} zone_t; -#define RAD2DEG 57.295779513082320876798154814105 -#define DEG2RAD 0.017453292519943295769236907684886 typedef struct { /********** ATTENTION **********/ - int mode; // Vidomi directly accesses these vars - int rc_bitrate; // - int desired_size; // please try to avoid modifications here - char stats1[MAX_PATH]; // + int mode; /* Vidomi directly accesses these vars */ + int bitrate; + int desired_size; /* please try to avoid modifications here */ + char stats[MAX_PATH]; /*******************************/ + int use_2pass_bitrate; /* use bitrate for 2pass2 (instead of desired size) */ - int quality; - int quant; - int rc_reaction_delay_factor; - int rc_averaging_period; - int rc_buffer; + /* profile */ + char profile_name[MAX_PATH]; + int profile; /* used internally; *not* written to registry */ - int motion_search; - int quant_type; - int fourcc_used; - int vhq_mode; - int max_key_interval; - int min_key_interval; + int quant_type; + BYTE qmatrix_intra[64]; + BYTE qmatrix_inter[64]; int lum_masking; int interlacing; int qpel; int gmc; - int chromame; -//added by koepi for gruel's greyscale_mode - int greyscale; -// end of koepi's additions + int reduced_resolution; + int use_bvop; int max_bframes; int bquant_ratio; int bquant_offset; int packed; - int dx50bvop; - int debug; - int reduced_resolution; + int closed_gov; - int min_iquant; - int max_iquant; - int min_pquant; - int max_pquant; - BYTE qmatrix_intra[64]; - BYTE qmatrix_inter[64]; + /* zones */ + int num_zones; + zone_t zones[MAX_ZONES]; + int cur_zone; /* used internally; *not* written to registry */ + /* single pass */ + int rc_reaction_delay_factor; + int rc_averaging_period; + int rc_buffer; + + /* 2pass1 */ + int discard1pass; + + /* 2pass2 */ int keyframe_boost; -//added by koepi for new 2pass curve treatment - int kftreshold; + int kfthreshold; int kfreduction; -// end of koepi's additions - int discard1pass; - int dummy2pass; int curve_compression_high; int curve_compression_low; - int use_alt_curve; - int alt_curve_use_auto; - int alt_curve_auto_str; - int alt_curve_use_auto_bonus_bias; - int alt_curve_bonus_bias; - int alt_curve_type; - int alt_curve_high_dist; - int alt_curve_low_dist; - int alt_curve_min_rel_qual; - int twopass_max_bitrate; + int overflow_control_strength; int twopass_max_overflow_improvement; int twopass_max_overflow_degradation; - int bitrate_payback_delay; - int bitrate_payback_method; - int hinted_me; - char hintfile[MAX_PATH]; - char stats2[MAX_PATH]; - - int credits_start; - int credits_start_begin; - int credits_start_end; - int credits_end; - int credits_end_begin; - int credits_end_end; - -//added by koepi for gruel's greyscale_mode - int credits_greyscale; -// end of koepi's additions - int credits_mode; - int credits_rate; - int credits_quant_i; - int credits_quant_p; - int credits_start_size; - int credits_end_size; - - int num_threads; - int chroma_opt; + /* motion */ + int motion_search; + int vhq_mode; + int chromame; + int cartoon_mode; + int max_key_interval; int frame_drop_ratio; - /* decoder */ + /* quant */ + int min_iquant; + int max_iquant; + int min_pquant; + int max_pquant; + int min_bquant; + int max_bquant; + int trellis_quant; - int deblock_y; - int deblock_uv; + /* debug */ + int num_threads; + int fourcc_used; + int vop_debug; + int debug; + int display_status; -// char build[50]; DWORD cpu; - float fquant; + + /* internal */ + int ci_valid; + VFWEXT_CONFIGURE_INFO_T ci; + BOOL save; } CONFIG; typedef struct PROPSHEETINFO { - int page; + int idd; CONFIG * config; } PROPSHEETINFO; @@ -199,24 +199,46 @@ char* def; } REG_STR; -void config_reg_get(CONFIG *); -void config_reg_set(CONFIG *); -void config_reg_default(CONFIG *); -int config_get_int(HWND, INT, int); -int config_get_uint(HWND, UINT, int); -void main_download(HWND, CONFIG *); -void main_slider(HWND, CONFIG *); -void main_value(HWND, CONFIG *); -void adv_dialog(HWND, CONFIG *); -void adv_mode(HWND, int); -void adv_upload(HWND, int, CONFIG *); -void adv_download(HWND, int, CONFIG *); -void quant_upload(HWND, CONFIG *); -void quant_download(HWND, CONFIG *); -BOOL CALLBACK enum_tooltips(HWND, LPARAM); + +#define PROFILE_ADAPTQUANT 0x00000001 +#define PROFILE_BVOP 0x00000002 +#define PROFILE_MPEGQUANT 0x00000004 +#define PROFILE_INTERLACE 0x00000008 +#define PROFILE_QPEL 0x00000010 +#define PROFILE_GMC 0x00000020 +#define PROFILE_REDUCED 0x00000040 /* dynamic resolution conversion */ + +#define PROFILE_AS (PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_MPEGQUANT|PROFILE_INTERLACE|PROFILE_QPEL|PROFILE_GMC) +#define PROFILE_ARTS (PROFILE_ADAPTQUANT|PROFILE_REDUCED) + + +typedef struct +{ + char * name; + int id; /* mpeg-4 profile id; iso/iec 14496-2:2001 table G-1 */ + int width; + int height; + int fps; + int max_objects; + int total_vmv_buffer_sz; /* macroblock memory; when BVOPS=false, vmv = 2*vcv; when BVOPS=true, vmv = 3*vcv*/ + int max_vmv_buffer_sz; /* max macroblocks per vop */ + int vcv_decoder_rate; /* macroblocks decoded per second */ + int max_acpred_mbs; /* percentage */ + int max_vbv_size; /* max vbv size (bits) 16368 bits */ + int max_video_packet_length; /* bits */ + int max_bitrate; /* kbits/s */ + unsigned int flags; +} profile_t; + + +extern const profile_t profiles[]; + + +void config_reg_get(CONFIG * config); +void config_reg_set(CONFIG * config); + BOOL CALLBACK main_proc(HWND, UINT, WPARAM, LPARAM); -BOOL CALLBACK adv_proc(HWND, UINT, WPARAM, LPARAM); -BOOL CALLBACK quantmatrix_proc(HWND, UINT, WPARAM, LPARAM); BOOL CALLBACK about_proc(HWND, UINT, WPARAM, LPARAM); + #endif /* _CONFIG_H_ */