[svn] / trunk / xvidcore / vfw / src / config.c Repository:
ViewVC logotype

Diff of /trunk/xvidcore/vfw/src/config.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1649, Sun Oct 16 00:00:04 2005 UTC revision 1917, Wed Dec 22 16:52:12 2010 UTC
# Line 3  Line 3 
3   *      XVID VFW FRONTEND   *      XVID VFW FRONTEND
4   *      config   *      config
5   *   *
6     *      Copyright(C) Peter Ross <pross@xvid.org>
7     *
8   *      This program is free software; you can redistribute it and/or modify   *      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   *      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   *      the Free Software Foundation; either version 2 of the License, or
# Line 17  Line 19 
19   *      along with this program; if not, write to the Free Software   *      along with this program; if not, write to the Free Software
20   *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.   *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21   *   *
22   *************************************************************************/   * $Id: config.c,v 1.44 2010-12-22 16:52:12 Isibaar Exp $
   
 /**************************************************************************  
  *  
  *      History:  
  *  
  *      15.06.2002      added bframes options  
  *      21.04.2002      fixed custom matrix support, tried to get dll size down  
  *      17.04.2002      re-enabled lumi masking in 1st pass  
  *      15.04.2002      updated cbr support  
  *      07.04.2002      min keyframe interval checkbox  
  *                              2-pass max bitrate and overflow customization  
  *      04.04.2002      interlacing support  
  *                              hinted ME support  
  *      24.03.2002      daniel smith <danielsmith@astroboymail.com>  
  *                              added Foxer's new CBR engine  
  *                              - cbr_buffer is being used as reaction delay (quick hack)  
  *      23.03.2002      daniel smith <danielsmith@astroboymail.com>  
  *                              added load defaults button  
  *                              merged foxer's alternative 2-pass code (2-pass alt tab)  
  *                              added proper tooltips  
  *                              moved registry data into reg_ints/reg_strs arrays  
  *                              added DEBUGERR output on errors instead of returning  
  *      16.03.2002      daniel smith <danielsmith@astroboymail.com>  
  *                              rewrote/restructured most of file  
  *                              added tooltips (kind of - dirty message hook method)  
  *                              split tabs into a main dialog / advanced prop sheet  
  *                              advanced controls are now enabled/disabled by mode  
  *                              added modulated quantization, DX50 fourcc  
  *      11.03.2002  Min Chen <chenm001@163.com>  
  *                        now get Core Version use xvid_init()  
  *      05.03.2002  Min Chen <chenm001@163.com>  
  *                              Add Core version display to about box  
  *      01.12.2001      inital version; (c)2001 peter ross <pross@xvid.org>  
23   *   *
24   *************************************************************************/   *************************************************************************/
25    
   
26  #include <windows.h>  #include <windows.h>
27  #include <commctrl.h>  #include <commctrl.h>
28  #include <stdio.h>  /* sprintf */  #include <stdio.h>  /* sprintf */
29  #include <xvid.h>       /* XviD API */  #include <xvid.h>       /* Xvid API */
30    
31  #include "debug.h"  #include "debug.h"
32  #include "config.h"  #include "config.h"
# Line 104  Line 72 
72  /* MPEG-4 PROFILES/LEVELS ============================================================== */  /* MPEG-4 PROFILES/LEVELS ============================================================== */
73  /* ===================================================================================== */  /* ===================================================================================== */
74    
75  #define DXN_PROFILES  /* #define EXTRA_PROFILES */
76    
77  /* default vbv_occupancy is (64/170)*vbv_buffer_size */  /* default vbv_occupancy is (64/170)*vbv_buffer_size */
78    
# Line 115  Line 83 
83  const profile_t profiles[] =  const profile_t profiles[] =
84  {  {
85  /*  name                p@l    w    h    fps  obj Tvmv vmv    vcv    ac%   vbv        pkt     bps    vbv_peak dbf flags */  /*  name                p@l    w    h    fps  obj Tvmv vmv    vcv    ac%   vbv        pkt     bps    vbv_peak dbf flags */
86    { "Simple @ L0",      0x08,  176, 144, 15,  1,  198,   99,   1485, 100,  10*16368,  2048,   64000,        0, -1, PROFILE_S },  #ifndef EXTRA_PROFILES
87      { "Xvid Mobile",  "Xvid Mobile",  0x00,  352, 240, 30,  1,  990,  330,   9900, 100,  128*8192,    -1, 1334850,  8000000,  5, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_PACKED|PROFILE_MPEGQUANT|PROFILE_QPEL|PROFILE_XVID },
88      { "Xvid Home",    "Xvid Home",    0x00,  720, 576, 25,  1, 4860, 1620,  40500, 100,  384*8192,    -1, 4854000,  8000000,  5, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_PACKED|PROFILE_MPEGQUANT|PROFILE_QPEL|PROFILE_INTERLACE|PROFILE_XVID },
89      { "Xvid HD 720",  "Xvid HD 720",  0x00, 1280, 720, 30,  1,10800, 3600, 108000, 100,  768*8192,    -1, 9708400, 16000000,  5, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_PACKED|PROFILE_MPEGQUANT|PROFILE_QPEL|PROFILE_INTERLACE|PROFILE_XVID },
90      { "Xvid HD 1080",     "Xvid HD 1080", 0x00, 1920,1080, 30,  1,24480, 8160, 244800, 100, 2047*8192,    -1,20480000, 36000000,  5, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_PACKED|PROFILE_MPEGQUANT|PROFILE_QPEL|PROFILE_INTERLACE|PROFILE_XVID },
91    #else
92      { "Handheld",          "Handheld",              0x00,  176, 144, 15,  1,  198,   99,   1485, 100,   32*8192,    -1,  537600,   800000,  0, PROFILE_ADAPTQUANT|PROFILE_EXTRA },
93      { "Portable NTSC",     "Portable NTSC",         0x00,  352, 240, 30,  1,  990,  330,  36000, 100,  384*8192,    -1, 4854000,  8000000,  1, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_PACKED|PROFILE_EXTRA },
94      { "Portable PAL",          "Portable PAL",      0x00,  352, 288, 25,  1, 1188,  396,  36000, 100,  384*8192,    -1, 4854000,  8000000,  1, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_PACKED|PROFILE_EXTRA },
95      { "Home Theatre NTSC", "Home Theatre NTSC", 0x00,  720, 480, 30,  1, 4050, 1350,  40500, 100,  384*8192,    -1, 4854000,  8000000,  1, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_PACKED|PROFILE_INTERLACE|PROFILE_EXTRA },
96      { "Home Theatre PAL",  "Home Theatre PAL",  0x00,  720, 576, 25,  1, 4860, 1620,  40500, 100,  384*8192,    -1, 4854000,  8000000,  1, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_PACKED|PROFILE_INTERLACE|PROFILE_EXTRA },
97      { "HDTV",                  "HDTV",                      0x00, 1280, 720, 30,  1,10800, 3600, 108000, 100,  768*8192,    -1, 9708400, 16000000,  2, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_PACKED|PROFILE_INTERLACE|PROFILE_EXTRA },
98    #endif
99    
100      { "MPEG4 Simple @ L0", "MPEG4 SP @ L0",     0x08,  176, 144, 15,  1,  198,   99,   1485, 100,  10*16368,  2048,   64000,        0, -1, PROFILE_S },
101    /* simple@l0: max f_code=1, intra_dc_vlc_threshold=0 */    /* simple@l0: max f_code=1, intra_dc_vlc_threshold=0 */
102    /* if ac preidition is used, adaptive quantization must not be used */    /* if ac preidition is used, adaptive quantization must not be used */
103    /* <=qcif must be used */    /* <=qcif must be used */
104    { "Simple @ L1",      0x01,  176, 144, 15,  4,  198,   99,   1485, 100,  10*16368,  2048,   64000,        0, -1, PROFILE_S|PROFILE_ADAPTQUANT },    { "MPEG4 Simple @ L1", "MPEG4 SP @ L1",     0x01,  176, 144, 15,  4,  198,   99,   1485, 100,  10*16368,  2048,   64000,        0, -1, PROFILE_S|PROFILE_ADAPTQUANT },
105    { "Simple @ L2",      0x02,  352, 288, 15,  4,  792,  396,   5940, 100,  40*16368,  4096,  128000,        0, -1, PROFILE_S|PROFILE_ADAPTQUANT },    { "MPEG4 Simple @ L2", "MPEG4 SP @ L2",     0x02,  352, 288, 15,  4,  792,  396,   5940, 100,  40*16368,  4096,  128000,        0, -1, PROFILE_S|PROFILE_ADAPTQUANT },
106    { "Simple @ L3",      0x03,  352, 288, 15,  4,  792,  396,  11880, 100,  40*16368,  8192,  384000,        0, -1, PROFILE_S|PROFILE_ADAPTQUANT },    { "MPEG4 Simple @ L3", "MPEG4 SP @ L3",     0x03,  352, 288, 30,  4,  792,  396,  11880, 100,  40*16368,  8192,  384000,        0, -1, PROFILE_S|PROFILE_ADAPTQUANT },
107      /* From ISO/IEC 14496-2:2004/FPDAM 2: New Levels for Simple Profile */
108      { "MPEG4 Simple @ L4a","MPEG4 SP @ L4a",    0x04,  640, 480, 30,  4, 2400, 1200,  36000, 100,  80*16368, 16384, 4000000,        0, -1, PROFILE_S|PROFILE_ADAPTQUANT },
109      { "MPEG4 Simple @ L5", "MPEG4 SP @ L5",     0x05,  720, 576, 30,  4, 3240, 1620,  40500, 100, 112*16368, 16384, 8000000,        0, -1, PROFILE_S|PROFILE_ADAPTQUANT },
110      /* From ISO/IEC 14496-2:2004/FPDAM 4: Simple profile level 6 */
111      { "MPEG4 Simple @ L6", "MPEG4 SP @ L6",     0x06, 1280, 720, 30,  4, 7200, 3600, 108000, 100, 248*16368, 16384,12000000,        0, -1, PROFILE_S|PROFILE_ADAPTQUANT },
112    
113  #if 0 /* since rrv encoding is no longer support, these profiles have little use */  #if 0 /* since rrv encoding is no longer support, these profiles have little use */
114    { "ARTS @ L1",        0x91,  176, 144, 15,  4,  198,   99,   1485, 100,  10*16368,  8192,   64000,        0, -1, PROFILE_ARTS },    { "MPEG4 ARTS @ L1", "MPEG4 ARTS @ L1",       0x91,  176, 144, 15,  4,  198,   99,   1485, 100,  10*16368,  8192,   64000,        0, -1, PROFILE_ARTS },
115    { "ARTS @ L2",        0x92,  352, 288, 15,  4,  792,  396,   5940, 100,  40*16368, 16384,  128000,        0, -1, PROFILE_ARTS },    { "MPEG4 ARTS @ L2", "MPEG4 ARTS @ L2",       0x92,  352, 288, 15,  4,  792,  396,   5940, 100,  40*16368, 16384,  128000,        0, -1, PROFILE_ARTS },
116    { "ARTS @ L3",        0x93,  352, 288, 30,  4,  792,  396,  11880, 100,  40*16368, 16384,  384000,        0, -1, PROFILE_ARTS },    { "MPEG4 ARTS @ L3", "MPEG4 ARTS @ L3",       0x93,  352, 288, 30,  4,  792,  396,  11880, 100,  40*16368, 16384,  384000,        0, -1, PROFILE_ARTS },
117    { "ARTS @ L4",        0x94,  352, 288, 30, 16,  792,  396,  11880, 100,  80*16368, 16384, 2000000,        0, -1, PROFILE_ARTS },    { "MPEG4 ARTS @ L4", "MPEG4 ARTS @ L4",       0x94,  352, 288, 30, 16,  792,  396,  11880, 100,  80*16368, 16384, 2000000,        0, -1, PROFILE_ARTS },
118  #endif  #endif
119    
120    { "AS @ L0",          0xf0,  176, 144, 30,  1,  297,   99,   2970, 100,  10*16368,  2048,  128000,        0, -1, PROFILE_AS },    { "MPEG4 Advanced Simple @ L0", "MPEG4 ASP @ L0",         0xf0,  176, 144, 30,  1,  297,   99,   2970, 100,  10*16368,  2048,  128000,        0, -1, PROFILE_AS },
121    { "AS @ L1",          0xf1,  176, 144, 30,  4,  297,   99,   2970, 100,  10*16368,  2048,  128000,        0, -1, PROFILE_AS },    { "MPEG4 Advanced Simple @ L1", "MPEG4 ASP @ L1",         0xf1,  176, 144, 30,  4,  297,   99,   2970, 100,  10*16368,  2048,  128000,        0, -1, PROFILE_AS },
122    { "AS @ L2",          0xf2,  352, 288, 15,  4, 1188,  396,   5940, 100,  40*16368,  4096,  384000,        0, -1, PROFILE_AS },    { "MPEG4 Advanced Simple @ L2", "MPEG4 ASP @ L2",         0xf2,  352, 288, 15,  4, 1188,  396,   5940, 100,  40*16368,  4096,  384000,        0, -1, PROFILE_AS },
123    { "AS @ L3",          0xf3,  352, 288, 30,  4, 1188,  396,  11880, 100,  40*16368,  4096,  768000,        0, -1, PROFILE_AS },    { "MPEG4 Advanced Simple @ L3", "MPEG4 ASP @ L3",         0xf3,  352, 288, 30,  4, 1188,  396,  11880, 100,  40*16368,  4096,  768000,        0, -1, PROFILE_AS },
124   /*  ISMA Profile 1, (ASP) @ L3b (CIF, 1.5 Mb/s) CIF(352x288), 30fps, 1.5Mbps max ??? */   /*  ISMA Profile 1, (ASP) @ L3b (CIF, 1.5 Mb/s) CIF(352x288), 30fps, 1.5Mbps max ??? */
125    { "AS @ L4",          0xf4,  352, 576, 30,  4, 2376,  792,  23760,  50,  80*16368,  8192, 3000000,        0, -1, PROFILE_AS },    { "MPEG4 Advanced Simple @ L4", "MPEG4 ASP @ L4",         0xf4,  352, 576, 30,  4, 2376,  792,  23760,  50,  80*16368,  8192, 3000000,        0, -1, PROFILE_AS },
126    { "AS @ L5",          0xf5,  720, 576, 30,  4, 4860, 1620,  48600,  25, 112*16368, 16384, 8000000,        0, -1, PROFILE_AS },    { "MPEG4 Advanced Simple @ L5", "MPEG4 ASP @ L5",         0xf5,  720, 576, 30,  4, 4860, 1620,  48600,  25, 112*16368, 16384, 8000000,        0, -1, PROFILE_AS },
   
 #ifdef DXN_PROFILES  
 //      information provided by DivXNetworks, USA.  
 //  "DivX Certified Profile Compatibility v1.1", February 2005  
   { "DXN Handheld",     0x00,  176, 144, 15,  1,  198,   99,   1485, 100,   32*8192,    -1,  537600,   800000,  0, PROFILE_ADAPTQUANT|PROFILE_DXN },  
   { "DXN Portable NTSC",0x00,  352, 240, 30,  1,  990,  330,  36000, 100,  384*8192,    -1, 4854000,  8000000,  1, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_DXN },  
   { "DXN Portable PAL", 0x00,  352, 288, 25,  1, 1188,  396,  36000, 100,  384*8192,    -1, 4854000,  8000000,  1, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_DXN },  
   { "DXN HT NTSC",      0x00,  720, 480, 30,  1, 4050, 1350,  40500, 100,  384*8192,    -1, 4854000,  8000000,  1, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE|PROFILE_DXN },  
   { "DXN HT PAL",       0x00,  720, 576, 25,  1, 4860, 1620,  40500, 100,  384*8192,    -1, 4854000,  8000000,  1, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE|PROFILE_DXN },  
   { "DXN HDTV",         0x00, 1280, 720, 30,  1,10800, 3600, 108000, 100,  768*8192,    -1, 9708400, 16000000,  2, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE|PROFILE_DXN },  
 #endif  
127    
128    { "(unrestricted)",   0x00,    0,   0,  0,  0,    0,    0,      0, 100,   0*16368,    -1,       0,        0, -1, 0xffffffff & ~PROFILE_DXN },    { "(unrestricted)", "(unrestricted)",  0x00,    0,   0,  0,  0,    0,    0,      0, 100,   0*16368,    -1,       0,        0, -1, 0xffffffff & ~(PROFILE_EXTRA | PROFILE_PACKED | PROFILE_XVID)},
129  };  };
130    
131    
132  const quality_t quality_table[] =  const quality_t quality_table[] =
133  {  {
134      /* name                 |  m  vhq  bf cme  tbo  kfi  fdr  | iquant pquant bquant trellis */      /* name                 |  m  vhq mtc bf cme  tbo  kfi  fdr  | iquant pquant bquant trellis */
135    { "Real-time",               1,  0,  0,  0,  0,  300,  0,     1, 31, 1, 31, 1, 31,   0   },    { "Real-time",               1,  0,  0,  0,  0,  0,  300,  0,     1, 31, 1, 31, 1, 31,   0   },
136    { QUALITY_GENERAL_STRING,    6,  1,  0,  1,  0,  300,  0,     1, 31, 1, 31, 1, 31,   1   },    { QUALITY_GENERAL_STRING,    6,  1,  0,  0,  1,  0,  300,  0,     1, 31, 1, 31, 1, 31,   1   },
137  };  };
138    
139  const int quality_table_num = sizeof(quality_table)/sizeof(quality_t);  const int quality_table_num = sizeof(quality_table)/sizeof(quality_t);
# Line 225  Line 201 
201          {"bquant_ratio",                        &reg.bquant_ratio,                              150},   /* 100-base float */          {"bquant_ratio",                        &reg.bquant_ratio,                              150},   /* 100-base float */
202          {"bquant_offset",                       &reg.bquant_offset,                             100},   /* 100-base float */          {"bquant_offset",                       &reg.bquant_offset,                             100},   /* 100-base float */
203          {"packed",                                      &reg.packed,                                    1},          {"packed",                                      &reg.packed,                                    1},
204            {"num_slices",                          &reg.num_slices,                                1},
205    
206          /* aspect ratio */          /* aspect ratio */
207          {"ar_mode",                                     &reg.ar_mode,                                   0},          {"ar_mode",                                     &reg.ar_mode,                                   0},
# Line 272  Line 249 
249          /* motion */          /* motion */
250          {"motion_search",                       &reg.quality_user.motion_search,                                6},          {"motion_search",                       &reg.quality_user.motion_search,                                6},
251          {"vhq_mode",                            &reg.quality_user.vhq_mode,                                     1},          {"vhq_mode",                            &reg.quality_user.vhq_mode,                                     1},
252            {"vhq_metric",                          &reg.quality_user.vhq_metric,                           0},
253          {"vhq_bframe",                          &reg.quality_user.vhq_bframe,                           0},          {"vhq_bframe",                          &reg.quality_user.vhq_bframe,                           0},
254          {"chromame",                            &reg.quality_user.chromame,                                     1},          {"chromame",                            &reg.quality_user.chromame,                                     1},
255          {"turbo",                                       &reg.quality_user.turbo,                                                0},          {"turbo",                                       &reg.quality_user.turbo,                                                0},
256          {"max_key_interval",            &reg.quality_user.max_key_interval,                     300},          {"max_key_interval",            &reg.quality_user.max_key_interval,                     250},
257          {"frame_drop_ratio",            &reg.quality_user.frame_drop_ratio,                     0},          {"frame_drop_ratio",            &reg.quality_user.frame_drop_ratio,                     0},
258    
259          /* quant */          /* quant */
# Line 292  Line 270 
270          {"debug",                                       &reg.debug,                                             0x0},          {"debug",                                       &reg.debug,                                             0x0},
271          {"vop_debug",                           &reg.vop_debug,                                 0},          {"vop_debug",                           &reg.vop_debug,                                 0},
272          {"display_status",                      &reg.display_status,                    1},          {"display_status",                      &reg.display_status,                    1},
273            {"cpu_flags",                           &reg.cpu,                                               0},
274    
275            /* smp */
276            {"num_threads",                         &reg.num_threads,                               0},
277    
278          /* decoder, shared with dshow */          /* decoder, shared with dshow */
279          {"Brightness",                          &pp_brightness,                                 0},          {"Brightness",                          &pp_brightness,                                 0},
# Line 304  Line 286 
286  };  };
287    
288  static const REG_STR reg_strs[] = {  static const REG_STR reg_strs[] = {
289          {"profile",                                     reg.profile_name,                               "(unrestricted)"},          {"profile",                                     reg.profile_name,                               "Xvid Home"},
290    {"quality",         reg.quality_name,       QUALITY_GENERAL_STRING},    {"quality",         reg.quality_name,       QUALITY_GENERAL_STRING},
291          {"stats",                                       reg.stats,                                              CONFIG_2PASS_FILE},          {"stats",                                       reg.stats,                                              CONFIG_2PASS_FILE},
292  };  };
# Line 372  Line 354 
354                  FreeLibrary(m_hdll);                  FreeLibrary(m_hdll);
355          }          }
356    
         reg.cpu = info.cpu_flags;  
         reg.num_threads = info.num_threads;  
   
357          RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT "\\" XVID_REG_CHILD, 0, KEY_READ, &hKey);          RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT "\\" XVID_REG_CHILD, 0, KEY_READ, &hKey);
358    
359          /* read integer values */          /* read integer values */
# Line 396  Line 375 
375    /* find profile table index */    /* find profile table index */
376          reg.profile = 0;          reg.profile = 0;
377          for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) {          for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) {
378                  if (lstrcmpi(profiles[i].name, reg.profile_name) == 0) {                  char perm1[255] = {"Xvid "}, perm2[255] = {"MPEG4 "};
379                    if (lstrcmpi(profiles[i].name, reg.profile_name) == 0 ||
380                            lstrcmpi(profiles[i].name, lstrcat(perm1, reg.profile_name)) == 0 ||
381                            lstrcmpi(profiles[i].name, lstrcat(perm2, reg.profile_name)) == 0) { /* legacy names */
382                          reg.profile = i;                          reg.profile = i;
383                  }                  }
384          }          }
# Line 436  Line 418 
418                  memcpy(&config->zones[i], &stmp, sizeof(zone_t));                  memcpy(&config->zones[i], &stmp, sizeof(zone_t));
419          }          }
420    
421            if (!(config->cpu&XVID_CPU_FORCE)) {
422                    config->cpu = info.cpu_flags;
423                    config->num_threads = info.num_threads; /* autodetect */
424            }
425    
426          RegCloseKey(hKey);          RegCloseKey(hKey);
427  }  }
428    
# Line 498  Line 485 
485  }  }
486    
487    
488  /* clear XviD registry key, load defaults */  /* clear Xvid registry key, load defaults */
489    
490  static void config_reg_default(CONFIG * config)  static void config_reg_default(CONFIG * config)
491  {  {
# Line 541  Line 528 
528  #define UINT_BUF_SZ     20  #define UINT_BUF_SZ     20
529  static int config_get_cbuint(HWND hDlg, UINT item, int def)  static int config_get_cbuint(HWND hDlg, UINT item, int def)
530  {  {
531          int sel = SendMessage(GetDlgItem(hDlg, item), CB_GETCURSEL, 0, 0);          LRESULT sel = SendMessage(GetDlgItem(hDlg, item), CB_GETCURSEL, 0, 0);
532          char buf[UINT_BUF_SZ];          char buf[UINT_BUF_SZ];
533    
534          if (sel<0) {          if (sel<0) {
# Line 698  Line 685 
685    
686  /* quantization matrix dialog proc */  /* quantization matrix dialog proc */
687    
688  static BOOL CALLBACK quantmatrix_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)  static INT_PTR CALLBACK quantmatrix_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
689  {  {
690          CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA);          CONFIG* config = (CONFIG*)GetWindowLongPtr(hDlg, GWLP_USERDATA);
691    
692          switch (uMsg)          switch (uMsg)
693          {          {
694          case WM_INITDIALOG :          case WM_INITDIALOG :
695                  SetWindowLong(hDlg, GWL_USERDATA, lParam);                  SetWindowLongPtr(hDlg, GWLP_USERDATA, lParam);
696                  config = (CONFIG*)lParam;                  config = (CONFIG*)lParam;
697                  quant_upload(hDlg, config);                  quant_upload(hDlg, config);
698    
# Line 767  Line 754 
754                  SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263");                  SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263");
755                  SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG");                  SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG");
756                  SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom");                  SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom");
757    
758                    SendDlgItemMessage(hDlg, IDC_LUMMASK, CB_ADDSTRING, 0, (LPARAM)"Off");
759                    SendDlgItemMessage(hDlg, IDC_LUMMASK, CB_ADDSTRING, 0, (LPARAM)"Luminance-Masking");
760                    SendDlgItemMessage(hDlg, IDC_LUMMASK, CB_ADDSTRING, 0, (LPARAM)"Variance-Masking");
761                  break;                  break;
762    
763          case IDD_AR:          case IDD_AR:
# Line 834  Line 825 
825                  SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"2 - Limited Search");                  SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"2 - Limited Search");
826                  SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"3 - Medium Search");                  SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"3 - Medium Search");
827                  SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"4 - Wide Search");                  SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"4 - Wide Search");
828    
829                    SendDlgItemMessage(hDlg, IDC_VHQ_METRIC, CB_ADDSTRING, 0, (LPARAM)"0 - PSNR");
830                    SendDlgItemMessage(hDlg, IDC_VHQ_METRIC, CB_ADDSTRING, 0, (LPARAM)"1 - PSNR-HVS-M");
831                  break;                  break;
832    
833          case IDD_ENC :          case IDD_ENC :
                 /* force threads disabled */  
                 EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS_STATIC), FALSE);  
                 EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS), FALSE);  
   
834                  SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"XVID");                  SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"XVID");
835                  SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX");                  SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX");
836                  SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50");                  SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50");
# Line 879  Line 869 
869                  EnableDlgWindow(hDlg, IDC_TFF, IsDlgChecked(hDlg, IDC_INTERLACING));                  EnableDlgWindow(hDlg, IDC_TFF, IsDlgChecked(hDlg, IDC_INTERLACING));
870                  EnableDlgWindow(hDlg, IDC_QPEL, profiles[profile].flags&PROFILE_QPEL);                  EnableDlgWindow(hDlg, IDC_QPEL, profiles[profile].flags&PROFILE_QPEL);
871                  EnableDlgWindow(hDlg, IDC_GMC, profiles[profile].flags&PROFILE_GMC);                  EnableDlgWindow(hDlg, IDC_GMC, profiles[profile].flags&PROFILE_GMC);
872                    EnableDlgWindow(hDlg, IDC_SLICES, profiles[profile].flags&PROFILE_RESYNCMARKER);
873    
874                  bvops = (profiles[profile].flags&PROFILE_BVOP) && IsDlgChecked(hDlg, IDC_BVOP);                  bvops = (profiles[profile].flags&PROFILE_BVOP) && IsDlgChecked(hDlg, IDC_BVOP);
875                  EnableDlgWindow(hDlg, IDC_MAXBFRAMES,      bvops);                  EnableDlgWindow(hDlg, IDC_MAXBFRAMES,      bvops);
# Line 887  Line 878 
878                  EnableDlgWindow(hDlg, IDC_MAXBFRAMES_S,  bvops);                  EnableDlgWindow(hDlg, IDC_MAXBFRAMES_S,  bvops);
879                  EnableDlgWindow(hDlg, IDC_BQUANTRATIO_S,        bvops);                  EnableDlgWindow(hDlg, IDC_BQUANTRATIO_S,        bvops);
880                  EnableDlgWindow(hDlg, IDC_BQUANTOFFSET_S,   bvops);                  EnableDlgWindow(hDlg, IDC_BQUANTOFFSET_S,   bvops);
881                  EnableDlgWindow(hDlg, IDC_PACKED,                  bvops && !(profiles[profile].flags & PROFILE_DXN));                  EnableDlgWindow(hDlg, IDC_PACKED,                  bvops && !(profiles[profile].flags & PROFILE_PACKED));
882    
883                    switch(profile) {
884                    case 0:
885                            {
886                                    HICON profile_icon = LoadImage(g_hInst, MAKEINTRESOURCE(IDI_MOBILE), IMAGE_ICON, 0, 0, 0);
887                                    SendDlgItemMessage(hDlg, IDC_PROFILE_LOGO, STM_SETIMAGE, IMAGE_ICON, (LPARAM)profile_icon);
888                            }
889                            break;
890                    case 1:
891                            {
892                                    HICON profile_icon = LoadImage(g_hInst, MAKEINTRESOURCE(IDI_HOME), IMAGE_ICON, 0, 0, 0);
893                                    SendDlgItemMessage(hDlg, IDC_PROFILE_LOGO, STM_SETIMAGE, IMAGE_ICON, (LPARAM)profile_icon);
894                            }
895                            break;
896                    case 2:
897                            {
898                                    HICON profile_icon = LoadImage(g_hInst, MAKEINTRESOURCE(IDI_HD720), IMAGE_ICON, 0, 0, 0);
899                                    SendDlgItemMessage(hDlg, IDC_PROFILE_LOGO, STM_SETIMAGE, IMAGE_ICON, (LPARAM)profile_icon);
900                            }
901                            break;
902                    case 3:
903                            {
904                                    HICON profile_icon = LoadImage(g_hInst, MAKEINTRESOURCE(IDI_HD1080), IMAGE_ICON, 0, 0, 0);
905                                    SendDlgItemMessage(hDlg, IDC_PROFILE_LOGO, STM_SETIMAGE, IMAGE_ICON, (LPARAM)profile_icon);
906                            }
907                            break;
908                    default:
909                            SendDlgItemMessage(hDlg, IDC_PROFILE_LOGO, STM_SETIMAGE, IMAGE_ICON, (LPARAM)NULL);
910                            break;
911                    }
912                    if (profile < 4)
913                            ShowWindow(GetDlgItem(hDlg, IDC_PROFILE_LABEL), SW_HIDE);
914                    else
915                            ShowWindow(GetDlgItem(hDlg, IDC_PROFILE_LABEL), SW_SHOW);
916                  break;                  break;
917    
918          case IDD_AR:          case IDD_AR:
# Line 955  Line 980 
980        EnableDlgWindow(hDlg, IDC_LEVEL_PEAKRATE_S, en_pr);        EnableDlgWindow(hDlg, IDC_LEVEL_PEAKRATE_S, en_pr);
981        EnableDlgWindow(hDlg, IDC_LEVEL_PEAKRATE,   en_pr);        EnableDlgWindow(hDlg, IDC_LEVEL_PEAKRATE,   en_pr);
982      }      }
983    
984                    switch(profile) {
985                    case 0:
986                            {
987                                    HICON profile_icon = LoadImage(g_hInst, MAKEINTRESOURCE(IDI_MOBILE), IMAGE_ICON, 0, 0, 0);
988                                    SendDlgItemMessage(hDlg, IDC_PROFILE_LOGO, STM_SETIMAGE, IMAGE_ICON, (LPARAM)profile_icon);
989                            }
990                            break;
991                    case 1:
992                            {
993                                    HICON profile_icon = LoadImage(g_hInst, MAKEINTRESOURCE(IDI_HOME), IMAGE_ICON, 0, 0, 0);
994                                    SendDlgItemMessage(hDlg, IDC_PROFILE_LOGO, STM_SETIMAGE, IMAGE_ICON, (LPARAM)profile_icon);
995                            }
996                            break;
997                    case 2:
998                            {
999                                    HICON profile_icon = LoadImage(g_hInst, MAKEINTRESOURCE(IDI_HD720), IMAGE_ICON, 0, 0, 0);
1000                                    SendDlgItemMessage(hDlg, IDC_PROFILE_LOGO, STM_SETIMAGE, IMAGE_ICON, (LPARAM)profile_icon);
1001                            }
1002                            break;
1003                    case 3:
1004                            {
1005                                    HICON profile_icon = LoadImage(g_hInst, MAKEINTRESOURCE(IDI_HD1080), IMAGE_ICON, 0, 0, 0);
1006                                    SendDlgItemMessage(hDlg, IDC_PROFILE_LOGO, STM_SETIMAGE, IMAGE_ICON, (LPARAM)profile_icon);
1007                            }
1008                            break;
1009                    default:
1010                            SendDlgItemMessage(hDlg, IDC_PROFILE_LOGO, STM_SETIMAGE, IMAGE_ICON, (LPARAM)NULL);
1011                            break;
1012                    }
1013                    if (profile < 4)
1014                            ShowWindow(GetDlgItem(hDlg, IDC_PROFILE_LABEL), SW_HIDE);
1015                    else
1016                            ShowWindow(GetDlgItem(hDlg, IDC_PROFILE_LABEL), SW_SHOW);
1017    
1018                  break;                  break;
1019    
1020          case IDD_BITRATE :          case IDD_BITRATE :
# Line 1104  Line 1164 
1164                  EnableDlgWindow(hDlg, IDC_CPU_MMXEXT,   cpu_force);                  EnableDlgWindow(hDlg, IDC_CPU_MMXEXT,   cpu_force);
1165                  EnableDlgWindow(hDlg, IDC_CPU_SSE,              cpu_force);                  EnableDlgWindow(hDlg, IDC_CPU_SSE,              cpu_force);
1166                  EnableDlgWindow(hDlg, IDC_CPU_SSE2,             cpu_force);                  EnableDlgWindow(hDlg, IDC_CPU_SSE2,             cpu_force);
1167                    EnableDlgWindow(hDlg, IDC_CPU_SSE3,             cpu_force);
1168                    EnableDlgWindow(hDlg, IDC_CPU_SSE4,     cpu_force);
1169                  EnableDlgWindow(hDlg, IDC_CPU_3DNOW,    cpu_force);                  EnableDlgWindow(hDlg, IDC_CPU_3DNOW,    cpu_force);
1170                  EnableDlgWindow(hDlg, IDC_CPU_3DNOWEXT, cpu_force);                  EnableDlgWindow(hDlg, IDC_CPU_3DNOWEXT, cpu_force);
1171                    EnableDlgWindow(hDlg, IDC_NUMTHREADS,   cpu_force);
1172                    EnableDlgWindow(hDlg, IDC_NUMTHREADS_STATIC,   cpu_force);
1173                  break;                  break;
1174          }          }
1175  }  }
# Line 1120  Line 1184 
1184                  SendDlgItemMessage(hDlg, IDC_PROFILE_PROFILE, CB_SETCURSEL, config->profile, 0);                  SendDlgItemMessage(hDlg, IDC_PROFILE_PROFILE, CB_SETCURSEL, config->profile, 0);
1185    
1186                  SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0);                  SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0);
1187                  CheckDlg(hDlg, IDC_LUMMASK, config->lum_masking);                  SendDlgItemMessage(hDlg, IDC_LUMMASK, CB_SETCURSEL, config->lum_masking, 0);
1188                  CheckDlg(hDlg, IDC_INTERLACING, config->interlacing);                  CheckDlg(hDlg, IDC_INTERLACING, config->interlacing);
1189                  CheckDlg(hDlg, IDC_TFF, config->tff);                  CheckDlg(hDlg, IDC_TFF, config->tff);
1190                  CheckDlg(hDlg, IDC_QPEL, config->qpel);                  CheckDlg(hDlg, IDC_QPEL, config->qpel);
1191                  CheckDlg(hDlg, IDC_GMC, config->gmc);                  CheckDlg(hDlg, IDC_GMC, config->gmc);
1192                    CheckDlg(hDlg, IDC_SLICES, (config->num_slices != 1));
1193                  CheckDlg(hDlg, IDC_BVOP, config->use_bvop);                  CheckDlg(hDlg, IDC_BVOP, config->use_bvop);
1194    
1195                  SetDlgItemInt(hDlg, IDC_MAXBFRAMES, config->max_bframes, FALSE);                  SetDlgItemInt(hDlg, IDC_MAXBFRAMES, config->max_bframes, FALSE);
# Line 1211  Line 1276 
1276    
1277                  SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, quality_preset->motion_search, 0);                  SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, quality_preset->motion_search, 0);
1278                  SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, quality_preset->vhq_mode, 0);                  SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, quality_preset->vhq_mode, 0);
1279                    SendDlgItemMessage(hDlg, IDC_VHQ_METRIC, CB_SETCURSEL, quality_preset->vhq_metric, 0);
1280                  CheckDlg(hDlg, IDC_VHQ_BFRAME, quality_preset->vhq_bframe);                  CheckDlg(hDlg, IDC_VHQ_BFRAME, quality_preset->vhq_bframe);
1281                  CheckDlg(hDlg, IDC_CHROMAME, quality_preset->chromame);                  CheckDlg(hDlg, IDC_CHROMAME, quality_preset->chromame);
1282                  CheckDlg(hDlg, IDC_TURBO, quality_preset->turbo);                  CheckDlg(hDlg, IDC_TURBO, quality_preset->turbo);
# Line 1219  Line 1285 
1285    
1286      EnableDlgWindow(hDlg, IDC_MOTION,     userdef);      EnableDlgWindow(hDlg, IDC_MOTION,     userdef);
1287      EnableDlgWindow(hDlg, IDC_VHQ,        userdef);      EnableDlgWindow(hDlg, IDC_VHQ,        userdef);
1288        EnableDlgWindow(hDlg, IDC_VHQ_METRIC, userdef);
1289      EnableDlgWindow(hDlg, IDC_VHQ_BFRAME, userdef);      EnableDlgWindow(hDlg, IDC_VHQ_BFRAME, userdef);
1290      EnableDlgWindow(hDlg, IDC_CHROMAME,   userdef);      EnableDlgWindow(hDlg, IDC_CHROMAME,   userdef);
1291      EnableDlgWindow(hDlg, IDC_TURBO,      userdef);      EnableDlgWindow(hDlg, IDC_TURBO,      userdef);
# Line 1255  Line 1322 
1322                  CheckDlg(hDlg, IDC_CPU_MMXEXT, (config->cpu & XVID_CPU_MMXEXT));                  CheckDlg(hDlg, IDC_CPU_MMXEXT, (config->cpu & XVID_CPU_MMXEXT));
1323                  CheckDlg(hDlg, IDC_CPU_SSE, (config->cpu & XVID_CPU_SSE));                  CheckDlg(hDlg, IDC_CPU_SSE, (config->cpu & XVID_CPU_SSE));
1324                  CheckDlg(hDlg, IDC_CPU_SSE2, (config->cpu & XVID_CPU_SSE2));                  CheckDlg(hDlg, IDC_CPU_SSE2, (config->cpu & XVID_CPU_SSE2));
1325                    CheckDlg(hDlg, IDC_CPU_SSE3, (config->cpu & XVID_CPU_SSE3));
1326                    CheckDlg(hDlg, IDC_CPU_SSE4, (config->cpu & XVID_CPU_SSE41));
1327                  CheckDlg(hDlg, IDC_CPU_3DNOW, (config->cpu & XVID_CPU_3DNOW));                  CheckDlg(hDlg, IDC_CPU_3DNOW, (config->cpu & XVID_CPU_3DNOW));
1328                  CheckDlg(hDlg, IDC_CPU_3DNOWEXT, (config->cpu & XVID_CPU_3DNOWEXT));                  CheckDlg(hDlg, IDC_CPU_3DNOWEXT, (config->cpu & XVID_CPU_3DNOWEXT));
1329    
1330                  CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE,                  CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE,
1331                          config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO );                          config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO );
1332                  set_dlgitem_hex(hDlg, IDC_DEBUG, config->debug);                  set_dlgitem_hex(hDlg, IDC_DEBUG, config->debug);
1333                    SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE);
1334      break;      break;
1335    
1336    case IDD_ENC:    case IDD_ENC:
1337                  SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE);                  if(profiles[config->profile].flags & PROFILE_XVID)
1338                            SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, 0, 0);
1339                    else
1340                  SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0);                  SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0);
1341                    EnableDlgWindow(hDlg, IDC_FOURCC, (!(profiles[config->profile].flags & PROFILE_XVID)));
1342                  CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug);                  CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug);
1343                  CheckDlg(hDlg, IDC_DISPLAY_STATUS, config->display_status);                  CheckDlg(hDlg, IDC_DISPLAY_STATUS, config->display_status);
1344                  break;                  break;
# Line 1294  Line 1367 
1367                  config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE_PROFILE, CB_GETCURSEL, 0, 0);                  config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE_PROFILE, CB_GETCURSEL, 0, 0);
1368    
1369                  config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0);                  config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0);
1370                  config->lum_masking = IsDlgChecked(hDlg, IDC_LUMMASK);                  config->lum_masking = SendDlgItemMessage(hDlg, IDC_LUMMASK, CB_GETCURSEL, 0, 0);
1371                  config->interlacing = IsDlgChecked(hDlg, IDC_INTERLACING);                  config->interlacing = IsDlgChecked(hDlg, IDC_INTERLACING);
1372                  config->tff = IsDlgChecked(hDlg, IDC_TFF);                  config->tff = IsDlgChecked(hDlg, IDC_TFF);
1373                  config->qpel = IsDlgChecked(hDlg, IDC_QPEL);                  config->qpel = IsDlgChecked(hDlg, IDC_QPEL);
1374                  config->gmc = IsDlgChecked(hDlg, IDC_GMC);                  config->gmc = IsDlgChecked(hDlg, IDC_GMC);
1375                    config->num_slices = (IsDlgChecked(hDlg, IDC_SLICES) ? ((config->num_slices < 2) ? 0 : config->num_slices) : 1);
1376    
1377                  config->use_bvop = IsDlgChecked(hDlg, IDC_BVOP);                  config->use_bvop = IsDlgChecked(hDlg, IDC_BVOP);
1378                  config->max_bframes = config_get_uint(hDlg, IDC_MAXBFRAMES, config->max_bframes);                  config->max_bframes = config_get_uint(hDlg, IDC_MAXBFRAMES, config->max_bframes);
# Line 1416  Line 1490 
1490      if (config->quality==quality_table_num) {      if (config->quality==quality_table_num) {
1491        config->quality_user.motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0);        config->quality_user.motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0);
1492                    config->quality_user.vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0);                    config->quality_user.vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0);
1493                      config->quality_user.vhq_metric = SendDlgItemMessage(hDlg, IDC_VHQ_METRIC, CB_GETCURSEL, 0, 0);
1494                    config->quality_user.vhq_bframe = IsDlgButtonChecked(hDlg, IDC_VHQ_BFRAME);                    config->quality_user.vhq_bframe = IsDlgButtonChecked(hDlg, IDC_VHQ_BFRAME);
1495                    config->quality_user.chromame = IsDlgChecked(hDlg, IDC_CHROMAME);                    config->quality_user.chromame = IsDlgChecked(hDlg, IDC_CHROMAME);
1496                    config->quality_user.turbo = IsDlgChecked(hDlg, IDC_TURBO);                    config->quality_user.turbo = IsDlgChecked(hDlg, IDC_TURBO);
# Line 1452  Line 1527 
1527                  config->cpu |= IsDlgChecked(hDlg, IDC_CPU_MMXEXT)   ? XVID_CPU_MMXEXT : 0;                  config->cpu |= IsDlgChecked(hDlg, IDC_CPU_MMXEXT)   ? XVID_CPU_MMXEXT : 0;
1528                  config->cpu |= IsDlgChecked(hDlg, IDC_CPU_SSE)    ? XVID_CPU_SSE : 0;                  config->cpu |= IsDlgChecked(hDlg, IDC_CPU_SSE)    ? XVID_CPU_SSE : 0;
1529                  config->cpu |= IsDlgChecked(hDlg, IDC_CPU_SSE2)  ? XVID_CPU_SSE2 : 0;                  config->cpu |= IsDlgChecked(hDlg, IDC_CPU_SSE2)  ? XVID_CPU_SSE2 : 0;
1530                    config->cpu |= IsDlgChecked(hDlg, IDC_CPU_SSE3)   ? XVID_CPU_SSE3 : 0;
1531                    config->cpu |= IsDlgChecked(hDlg, IDC_CPU_SSE4)     ? XVID_CPU_SSE41 : 0;
1532                  config->cpu |= IsDlgChecked(hDlg, IDC_CPU_3DNOW)        ? XVID_CPU_3DNOW : 0;                  config->cpu |= IsDlgChecked(hDlg, IDC_CPU_3DNOW)        ? XVID_CPU_3DNOW : 0;
1533                  config->cpu |= IsDlgChecked(hDlg, IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT : 0;                  config->cpu |= IsDlgChecked(hDlg, IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT : 0;
1534                  config->cpu |= IsDlgChecked(hDlg, IDC_CPU_FORCE)        ? XVID_CPU_FORCE : 0;                  config->cpu |= IsDlgChecked(hDlg, IDC_CPU_FORCE)        ? XVID_CPU_FORCE : 0;
1535      config->debug = get_dlgitem_hex(hDlg, IDC_DEBUG, config->debug);      config->debug = get_dlgitem_hex(hDlg, IDC_DEBUG, config->debug);
1536                    config->num_threads = min(16, config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads));
1537      break;      break;
1538    
1539    case IDD_ENC :    case IDD_ENC :
1540                  config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads);                  if(!(profiles[config->profile].flags & PROFILE_XVID))
1541                  config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0);                  config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0);
1542                  config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG);                  config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG);
1543                  config->display_status = IsDlgChecked(hDlg, IDC_DISPLAY_STATUS);                  config->display_status = IsDlgChecked(hDlg, IDC_DISPLAY_STATUS);
# Line 1480  Line 1558 
1558    
1559  /* advanced dialog proc */  /* advanced dialog proc */
1560    
1561  static BOOL CALLBACK adv_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)  static INT_PTR CALLBACK adv_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
1562  {  {
1563          PROPSHEETINFO *psi;          PROPSHEETINFO *psi;
1564    
1565          psi = (PROPSHEETINFO*)GetWindowLong(hDlg, GWL_USERDATA);          psi = (PROPSHEETINFO*)GetWindowLongPtr(hDlg, GWLP_USERDATA);
1566    
1567          switch (uMsg)          switch (uMsg)
1568          {          {
1569          case WM_INITDIALOG :          case WM_INITDIALOG :
1570                  psi = (PROPSHEETINFO*) ((LPPROPSHEETPAGE)lParam)->lParam;                  psi = (PROPSHEETINFO*) ((LPPROPSHEETPAGE)lParam)->lParam;
1571                  SetWindowLong(hDlg, GWL_USERDATA, (LPARAM)psi);                  SetWindowLongPtr(hDlg, GWLP_USERDATA, (LPARAM)psi);
1572    
1573                  if (g_hTooltip)                  if (g_hTooltip)
1574                          EnumChildWindows(hDlg, enum_tooltips, 0);                          EnumChildWindows(hDlg, enum_tooltips, 0);
# Line 1678  Line 1756 
1756                          DPRINTF("PSN_SET");                          DPRINTF("PSN_SET");
1757                          adv_upload(hDlg, psi->idd, psi->config);                          adv_upload(hDlg, psi->idd, psi->config);
1758                          adv_mode(hDlg, psi->idd, psi->config);                          adv_mode(hDlg, psi->idd, psi->config);
1759                          SetWindowLong(hDlg, DWL_MSGRESULT, FALSE);                          SetWindowLongPtr(hDlg, DWLP_MSGRESULT, FALSE);
1760                          break;                          break;
1761    
1762                  case PSN_KILLACTIVE :                  case PSN_KILLACTIVE :
1763                          DPRINTF("PSN_KILL");                          DPRINTF("PSN_KILL");
1764                          adv_download(hDlg, psi->idd, psi->config);                          adv_download(hDlg, psi->idd, psi->config);
1765                          SetWindowLong(hDlg, DWL_MSGRESULT, FALSE);                          SetWindowLongPtr(hDlg, DWLP_MSGRESULT, FALSE);
1766                          break;                          break;
1767    
1768                  case PSN_APPLY :                  case PSN_APPLY :
1769                          DPRINTF("PSN_APPLY");                          DPRINTF("PSN_APPLY");
1770                          psi->config->save = TRUE;                          psi->config->save = TRUE;
1771                          SetWindowLong(hDlg, DWL_MSGRESULT, FALSE);                          SetWindowLongPtr(hDlg, DWLP_MSGRESULT, FALSE);
1772                          break;                          break;
1773                  }                  }
1774                  break;                  break;
# Line 1744  Line 1822 
1822          psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW | PSH_NOCONTEXTHELP;          psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW | PSH_NOCONTEXTHELP;
1823          psh.hwndParent = hParent;          psh.hwndParent = hParent;
1824          psh.hInstance = g_hInst;          psh.hInstance = g_hInst;
1825          psh.pszCaption = (LPSTR) "XviD Configuration";          psh.pszCaption = (LPSTR) "Xvid Configuration";
1826          psh.nPages = size;          psh.nPages = size;
1827          psh.nStartPage = 0;          psh.nStartPage = 0;
1828          psh.ppsp = (LPCPROPSHEETPAGE)&psp;          psh.ppsp = (LPCPROPSHEETPAGE)&psp;
# Line 1911  Line 1989 
1989  static const int other_dlgs[] = { IDD_ENC, IDD_DEC, IDD_COMMON };  static const int other_dlgs[] = { IDD_ENC, IDD_DEC, IDD_COMMON };
1990    
1991    
1992  BOOL CALLBACK main_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)  INT_PTR CALLBACK main_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
1993  {  {
1994          CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA);          CONFIG* config = (CONFIG*)GetWindowLongPtr(hDlg, GWLP_USERDATA);
1995          unsigned int i;          unsigned int i;
1996    
1997          switch (uMsg)          switch (uMsg)
1998          {          {
1999          case WM_INITDIALOG :          case WM_INITDIALOG :
2000                  SetWindowLong(hDlg, GWL_USERDATA, lParam);                  SetWindowLongPtr(hDlg, GWLP_USERDATA, lParam);
2001                  config = (CONFIG*)lParam;                  config = (CONFIG*)lParam;
2002    
2003                  for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++)                  for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++)
2004                          SendDlgItemMessage(hDlg, IDC_PROFILE, CB_ADDSTRING, 0, (LPARAM)profiles[i].name);                          SendDlgItemMessage(hDlg, IDC_PROFILE, CB_ADDSTRING, 0, (LPARAM)profiles[i].short_name);
2005    
2006                  SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Single pass");                  SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Single pass");
2007                  SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Twopass - 1st pass");                  SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Twopass - 1st pass");
# Line 1951  Line 2029 
2029                          EnumChildWindows(hDlg, enum_tooltips, 0);                          EnumChildWindows(hDlg, enum_tooltips, 0);
2030                  }                  }
2031    
2032                  SetClassLong(GetDlgItem(hDlg, IDC_BITRATE_S), GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_HAND));                  SetClassLongPtr(GetDlgItem(hDlg, IDC_BITRATE_S), GCLP_HCURSOR, (LONG_PTR)LoadCursor(NULL, IDC_HAND));
2033    
2034                  {                  {
2035                          DWORD ext_style = ListView_GetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES));                          DWORD ext_style = ListView_GetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES));
# Line 2224  Line 2302 
2302  /* LICENSE DIALOG ====================================================================== */  /* LICENSE DIALOG ====================================================================== */
2303  /* ===================================================================================== */  /* ===================================================================================== */
2304    
2305  static BOOL CALLBACK license_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)  static INT_PTR CALLBACK license_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
2306  {  {
2307          switch (uMsg)          switch (uMsg)
2308          {          {
# Line 2242  Line 2320 
2320                                          }                                          }
2321                                  }                                  }
2322                          }                          }
2323                          SetWindowLong(hDlg, GWL_USERDATA, (LONG)hGlobal);                          SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)hGlobal);
2324                  }                  }
2325                  break;                  break;
2326    
2327          case WM_DESTROY :          case WM_DESTROY :
2328                  {                  {
2329                          HGLOBAL hGlobal = (HGLOBAL)GetWindowLong(hDlg, GWL_USERDATA);                          HGLOBAL hGlobal = (HGLOBAL)GetWindowLongPtr(hDlg, GWLP_USERDATA);
2330                          if (hGlobal) {                          if (hGlobal) {
2331                                  FreeResource(hGlobal);                                  FreeResource(hGlobal);
2332                          }                          }
# Line 2280  Line 2358 
2358  /* ABOUT DIALOG ======================================================================== */  /* ABOUT DIALOG ======================================================================== */
2359  /* ===================================================================================== */  /* ===================================================================================== */
2360    
2361  BOOL CALLBACK about_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)  INT_PTR CALLBACK about_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
2362  {  {
2363          switch (uMsg)          switch (uMsg)
2364          {          {
# Line 2293  Line 2371 
2371                          HINSTANCE m_hdll;                          HINSTANCE m_hdll;
2372    
2373                          SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD);                          SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD);
2374                          SetDlgItemText(hDlg, IDC_SPECIAL_BUILD, XVID_SPECIAL_BUILD);  #ifdef _WIN64
2375                            wsprintf(core, "(%s, 64-bit Edition)", XVID_SPECIAL_BUILD);
2376    #else
2377                            wsprintf(core, "(%s)", XVID_SPECIAL_BUILD);
2378    #endif
2379                            SetDlgItemText(hDlg, IDC_SPECIAL_BUILD, core);
2380    
2381                          memset(&info, 0, sizeof(info));                          memset(&info, 0, sizeof(info));
2382                          info.version = XVID_VERSION;                          info.version = XVID_VERSION;
# Line 2328  Line 2411 
2411                                  }                                  }
2412                          }                          }
2413    
2414                          SetClassLong(GetDlgItem(hDlg, IDC_WEBSITE), GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_HAND));                          SetClassLongPtr(GetDlgItem(hDlg, IDC_WEBSITE), GCLP_HCURSOR, (LONG_PTR)LoadCursor(NULL, IDC_HAND));
2415                          SetDlgItemText(hDlg, IDC_WEBSITE, XVID_WEBSITE);                          SetDlgItemText(hDlg, IDC_WEBSITE, XVID_WEBSITE);
2416                  }                  }
2417                  break;                  break;
# Line 2337  Line 2420 
2420                  {                  {
2421                          SetBkMode((HDC)wParam, TRANSPARENT) ;                          SetBkMode((HDC)wParam, TRANSPARENT) ;
2422                          SetTextColor((HDC)wParam, RGB(0x00,0x00,0xc0));                          SetTextColor((HDC)wParam, RGB(0x00,0x00,0xc0));
2423                          return (BOOL)GetStockObject(NULL_BRUSH);                          return (INT_PTR)GetStockObject(NULL_BRUSH);
2424                  }                  }
2425                  return 0;                  return 0;
2426    

Legend:
Removed from v.1649  
changed lines
  Added in v.1917

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4