1 /***************************************************************************** 2 * 3 * XVID MPEG-4 VIDEO CODEC 4 * - VFW configuration header - 5 * 6 * Copyright(C) Peter Ross <pross@xvid.org> 7 * 8 * This program is free software ; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation ; either version 2 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY ; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program ; if not, write to the Free Software 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * 22 * $Id: config.h 1985 2011-05-18 09:02:35Z Isibaar $ 23 * 24 ****************************************************************************/ 25 26 #ifndef _CONFIG_H_ 27 #define _CONFIG_H_ 28 29 #include <windows.h> 30 #include "vfwext.h" 31 #include <xvid.h> 32 33 extern HINSTANCE g_hInst; 34 35 36 /* small hack */ 37 #ifndef IDC_HAND 38 #define IDC_HAND MAKEINTRESOURCE(32649) 39 #endif 40 41 /* one kilobit */ 42 #define CONFIG_KBPS 1000 43 44 /* min/max bitrate when not specified by profile */ 45 #define DEFAULT_MIN_KBPS 16 46 #define DEFAULT_MAX_KBPS 20480 47 #define DEFAULT_QUANT 400 48 49 /* registry stuff */ 50 #define XVID_REG_KEY HKEY_CURRENT_USER 51 #define XVID_REG_PARENT "Software\\GNU" 52 #define XVID_REG_CHILD "XviD" 53 #define XVID_REG_CLASS "config" 54 55 #define XVID_BUILD __TIME__ ", " __DATE__ 56 #define XVID_WEBSITE "http://www.xvid.org/" 57 #define XVID_SPECIAL_BUILD "Vanilla CVS Build" 58 59 /* constants */ 60 #define CONFIG_2PASS_FILE ".\\video.pass" 61 62 /* codec modes */ 63 #define RC_MODE_1PASS 0 64 #define RC_MODE_2PASS1 1 65 #define RC_MODE_2PASS2 2 66 #define RC_MODE_NULL 3 67 68 #define RC_ZONE_WEIGHT 0 69 #define RC_ZONE_QUANT 1 70 71 /* vhq modes */ 72 #define VHQ_OFF 0 73 #define VHQ_MODE_DECISION 1 74 #define VHQ_LIMITED_SEARCH 2 75 #define VHQ_MEDIUM_SEARCH 3 76 #define VHQ_WIDE_SEARCH 4 77 78 /* quantizer modes */ 79 #define QUANT_MODE_H263 0 80 #define QUANT_MODE_MPEG 1 81 #define QUANT_MODE_CUSTOM 2 82 83 84 #define MAX_ZONES 64 85 typedef struct 86 { 87 int frame; 88 89 int type; 90 int mode; 91 int weight; 92 int quant; 93 94 unsigned int greyscale; 95 unsigned int chroma_opt; 96 unsigned int bvop_threshold; 97 unsigned int cartoon_mode; 98 } zone_t; 99 100 101 /* this structure represents a quality preset. it encapsulates 102 options from the motion and quantizer config pages. */ 103 #define QUALITY_GENERAL_STRING "General purpose" 104 #define QUALITY_USER_STRING "(User defined)" 105 typedef struct { 106 char * name; 107 /* motion */ 108 int motion_search; 109 int vhq_mode; 110 int vhq_metric; 111 int vhq_bframe; 112 int chromame; 113 int turbo; 114 int max_key_interval; 115 int frame_drop_ratio; 116 117 /* quant */ 118 int min_iquant; 119 int max_iquant; 120 int min_pquant; 121 int max_pquant; 122 int min_bquant; 123 int max_bquant; 124 int trellis_quant; 125 } quality_t; 126 127 128 typedef struct 129 { 130 /********** ATTENTION **********/ 131 int mode; /* Vidomi directly accesses these vars */ 132 int bitrate; 133 int desired_size; /* please try to avoid modifications here */ 134 char stats[MAX_PATH]; 135 /*******************************/ 136 int use_2pass_bitrate; /* use bitrate for 2pass2 (instead of desired size) */ 137 int desired_quant; /* for one-pass constant quant */ 138 139 /* profile */ 140 char profile_name[MAX_PATH]; 141 int profile; /* used internally; *not* written to registry */ 142 143 /* quality preset */ 144 char quality_name[MAX_PATH]; 145 int quality; /* used internally; *not* written to registry */ 146 147 int quant_type; 148 BYTE qmatrix_intra[64]; 149 BYTE qmatrix_inter[64]; 150 int lum_masking; 151 int interlacing; 152 int tff; 153 int qpel; 154 int gmc; 155 int use_bvop; 156 int max_bframes; 157 int bquant_ratio; 158 int bquant_offset; 159 int packed; 160 int display_aspect_ratio; /* aspect ratio */ 161 int ar_x, ar_y; /* picture aspect ratio */ 162 int par_x, par_y; /* custom pixel aspect ratio */ 163 int ar_mode; /* picture/pixel AR */ 164 165 /* zones */ 166 int num_zones; 167 zone_t zones[MAX_ZONES]; 168 int cur_zone; /* used internally; *not* written to registry */ 169 170 /* single pass */ 171 int rc_reaction_delay_factor; 172 int rc_averaging_period; 173 int rc_buffer; 174 175 /* 2pass1 */ 176 int discard1pass; 177 178 /* 2pass2 */ 179 int keyframe_boost; 180 int kfthreshold; 181 int kfreduction; 182 int curve_compression_high; 183 int curve_compression_low; 184 int overflow_control_strength; 185 int twopass_max_overflow_improvement; 186 int twopass_max_overflow_degradation; 187 188 /* bitrate calculator */ 189 int target_size; 190 int subtitle_size; 191 int container_type; 192 int hours; 193 int minutes; 194 int seconds; 195 int fps; 196 int audio_mode; 197 int audio_type; 198 int audio_rate; 199 int audio_size; 200 201 /* user defined quality settings */ 202 quality_t quality_user; 203 204 /* debug */ 205 int num_threads; 206 int fourcc_used; 207 int vop_debug; 208 int debug; 209 int display_status; 210 int full1pass; 211 212 DWORD cpu; 213 214 int num_slices; 215 216 /* internal */ 217 int ci_valid; 218 VFWEXT_CONFIGURE_INFO_T ci; 219 220 BOOL save; 221 } CONFIG; 222 223 typedef struct PROPSHEETINFO 224 { 225 int idd; 226 CONFIG * config; 227 } PROPSHEETINFO; 228 229 typedef struct REG_INT 230 { 231 char* reg_value; 232 int* config_int; 233 int def; 234 } REG_INT; 235 236 typedef struct REG_STR 237 { 238 char* reg_value; 239 char* config_str; 240 char* def; 241 } REG_STR; 242 243 244 #define PROFILE_ADAPTQUANT 0x00000001 245 #define PROFILE_BVOP 0x00000002 246 #define PROFILE_MPEGQUANT 0x00000004 247 #define PROFILE_INTERLACE 0x00000008 248 #define PROFILE_QPEL 0x00000010 249 #define PROFILE_GMC 0x00000020 250 #define PROFILE_4MV 0x00000040 251 #define PROFILE_PACKED 0x00000080 252 #define PROFILE_EXTRA 0x00000100 253 #define PROFILE_XVID 0x00000200 254 #define PROFILE_RESYNCMARKER 0x00000400 255 256 static const int PARS[][2] = { 257 {1, 1}, 258 {12, 11}, 259 {10, 11}, 260 {16, 11}, 261 {40, 33}, 262 {0, 0}, 263 }; 264 265 266 267 268 typedef struct 269 { 270 char * name; 271 char * short_name; 272 int id; /* mpeg-4 profile id; iso/iec 14496-2:2001 table G-1 */ 273 int width; 274 int height; 275 int fps; 276 int max_objects; 277 int total_vmv_buffer_sz; /* macroblock memory; when BVOPS=false, vmv = 2*vcv; when BVOPS=true, vmv = 3*vcv*/ 278 int max_vmv_buffer_sz; /* max macroblocks per vop */ 279 int vcv_decoder_rate; /* macroblocks decoded per second */ 280 int max_acpred_mbs; /* percentage */ 281 int max_vbv_size; /* max vbv size (bits) 16368 bits */ 282 int max_video_packet_length;/* bits */ 283 int max_bitrate; /* bits per second */ 284 int vbv_peakrate; /* max bits over anyone second period; 0=don't care */ 285 int xvid_max_bframes; /* xvid: max consecutive bframes */ 286 unsigned int flags; 287 } profile_t; 288 289 290 extern const profile_t profiles[]; 291 292 extern const quality_t quality_table[]; 293 extern const int quality_table_num; /* number of elements in quality table */ 294 295 296 void config_reg_get(CONFIG * config); 297 void config_reg_set(CONFIG * config); 298 void sort_zones(zone_t * zones, int zone_num, int * sel); 299 300 301 INT_PTR CALLBACK main_proc(HWND, UINT, WPARAM, LPARAM); 302 INT_PTR CALLBACK about_proc(HWND, UINT, WPARAM, LPARAM); 303 304 #endif /* _CONFIG_H_ */ 305