[svn] / branches / dev-api-4 / xvidcore / vfw / src / config.c Repository:
ViewVC logotype

Diff of /branches/dev-api-4/xvidcore/vfw/src/config.c

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

revision 1052, Mon Jun 2 11:47:30 2003 UTC revision 1193, Tue Oct 28 23:42:09 2003 UTC
# Line 60  Line 60 
60  #include <shlobj.h>  #include <shlobj.h>
61  #include <prsht.h>  #include <prsht.h>
62    
63  #include <stdio.h>  // sprintf  #include <stdio.h>  /* sprintf */
64  #include <xvid.h>       // XviD API  #include <xvid.h>       /* XviD API */
65    
66  #include "debug.h"  #include "debug.h"
 #include "codec.h"  
67  #include "config.h"  #include "config.h"
68  #include "resource.h"  #include "resource.h"
69    
# Line 109  Line 108 
108  {  {
109  /*    name                 p@l,    w    h  fps  obj  Tvmv  vmv    vcv   ac%     vbv      pkt   kbps  flags */  /*    name                 p@l,    w    h  fps  obj  Tvmv  vmv    vcv   ac%     vbv      pkt   kbps  flags */
110      { "Simple @ L0",       0x08,  176, 144, 15,  1,  198,   99,   1485, 100,  10*16368,  2048,   64, 0 },      { "Simple @ L0",       0x08,  176, 144, 15,  1,  198,   99,   1485, 100,  10*16368,  2048,   64, 0 },
111              /* simple@l0: max f_code=1, intra_dc_vlc_threshold=0          /* simple@l0: max f_code=1, intra_dc_vlc_threshold=0 */
112              /* if ac preidition is used, adaptive quantization must not be used */              /* if ac preidition is used, adaptive quantization must not be used */
113            /* <=qcif must be used */
114          { "Simple @ L1",       0x01,  176, 144, 15,  4,  198,   99,   1485, 100,  10*16368,  2048,   64, PROFILE_ADAPTQUANT },          { "Simple @ L1",       0x01,  176, 144, 15,  4,  198,   99,   1485, 100,  10*16368,  2048,   64, PROFILE_ADAPTQUANT },
115          { "Simple @ L2",       0x02,  352, 288, 15,  4,  792,  396,   5940, 100,  40*16368,  4096,  128, PROFILE_ADAPTQUANT },          { "Simple @ L2",       0x02,  352, 288, 15,  4,  792,  396,   5940, 100,  40*16368,  4096,  128, PROFILE_ADAPTQUANT },
116          { "Simple @ L3",       0x03,  352, 288, 15,  4,  792,  396,  11880, 100,  40*16368,  8192,  384, PROFILE_ADAPTQUANT },          { "Simple @ L3",       0x03,  352, 288, 15,  4,  792,  396,  11880, 100,  40*16368,  8192,  384, PROFILE_ADAPTQUANT },
# Line 124  Line 124 
124          { "AS @ L1",           0xf1,  176, 144, 30,  4,  297,   99,   2970, 100,  10*16368,  2048,  128, PROFILE_AS },          { "AS @ L1",           0xf1,  176, 144, 30,  4,  297,   99,   2970, 100,  10*16368,  2048,  128, PROFILE_AS },
125          { "AS @ L2",           0xf2,  352, 288, 15,  4, 1188,  396,   5940, 100,  40*16368,  4096,  384, PROFILE_AS },          { "AS @ L2",           0xf2,  352, 288, 15,  4, 1188,  396,   5940, 100,  40*16368,  4096,  384, PROFILE_AS },
126          { "AS @ L3",           0xf3,  352, 288, 30,  4, 1188,  396,  11880, 100,  40*16368,  4096,  768, PROFILE_AS },          { "AS @ L3",           0xf3,  352, 288, 30,  4, 1188,  396,  11880, 100,  40*16368,  4096,  768, PROFILE_AS },
127     /*  ISMA Profile 1, (ASP) @ L3b (CIF, 1.5 Mb/s) CIF(352x288), 30fps, 1.5Mbps max ??? */
128          { "AS @ L4",           0xf4,  352, 576, 30,  4, 2376,  792,  23760,  50,  80*16368,  8192, 3000, PROFILE_AS },          { "AS @ L4",           0xf4,  352, 576, 30,  4, 2376,  792,  23760,  50,  80*16368,  8192, 3000, PROFILE_AS },
129          { "AS @ L5",           0xf5,  720, 576, 30,  4, 4860, 1620,  48600,  25, 112*16368, 16384, 8000, PROFILE_AS },          { "AS @ L5",           0xf5,  720, 576, 30,  4, 4860, 1620,  48600,  25, 112*16368, 16384, 8000, PROFILE_AS },
130    
# Line 148  Line 149 
149  static const REG_INT reg_ints[] = {  static const REG_INT reg_ints[] = {
150          {"mode",                                        &reg.mode,                                              RC_MODE_1PASS},          {"mode",                                        &reg.mode,                                              RC_MODE_1PASS},
151          {"bitrate",                                     &reg.bitrate,                                   700},          {"bitrate",                                     &reg.bitrate,                                   700},
152   /* {"desired_size",                    &reg.desired_size,                              570000},   not used */      {"desired_size",                    &reg.desired_size,                              570000},
153        {"use_2pass_bitrate",       &reg.use_2pass_bitrate,         0},
154    
155          {"rc_reaction_delay_factor",&reg.rc_reaction_delay_factor,      16},      /* profile */
         {"rc_averaging_period",         &reg.rc_averaging_period,               100},  
         {"rc_buffer",                           &reg.rc_buffer,                         100},  
   
         {"motion_search",                       &reg.motion_search,                             6},  
156          {"quant_type",                          &reg.quant_type,                                0},          {"quant_type",                          &reg.quant_type,                                0},
         {"fourcc_used",                         &reg.fourcc_used,                               0},  
         {"vhq_mode",                            &reg.vhq_mode,                                  0},  
         {"max_key_interval",            &reg.max_key_interval,                  300},  
         {"min_key_interval",            &reg.min_key_interval,                  1},  
157          {"lum_masking",                         &reg.lum_masking,                               0},          {"lum_masking",                         &reg.lum_masking,                               0},
158          {"interlacing",                         &reg.interlacing,                               0},          {"interlacing",                         &reg.interlacing,                               0},
159          {"qpel",                                        &reg.qpel,                                              0},          {"qpel",                                        &reg.qpel,                                              0},
160          {"gmc",                                         &reg.gmc,                                               0},          {"gmc",                                         &reg.gmc,                                               0},
161          {"chromame",                            &reg.chromame,                                  0},          {"reduced_resolution",          &reg.reduced_resolution,                0},
162      {"use_bvop",                                &reg.use_bvop,                          0},      {"use_bvop",                                &reg.use_bvop,                          0},
163          {"max_bframes",                         &reg.max_bframes,                               2},          {"max_bframes",                         &reg.max_bframes,                               2},
164          {"bquant_ratio",                        &reg.bquant_ratio,                              150},   /* 100-base float */          {"bquant_ratio",                        &reg.bquant_ratio,                              150},   /* 100-base float */
165          {"bquant_offset",                       &reg.bquant_offset,                             100},   /* 100-base float */          {"bquant_offset",                       &reg.bquant_offset,                             100},   /* 100-base float */
166          {"packed",                                      &reg.packed,                                    0},          {"packed",                                      &reg.packed,                                    0},
167          {"closed_gov",                          &reg.closed_gov,                                1},          {"closed_gov",                          &reg.closed_gov,                                1},
         {"vop_debug",                           &reg.vop_debug,                                 0},  
     {"debug",                                   &reg.debug,                                             0x0},  
         {"reduced_resolution",          &reg.reduced_resolution,                0},  
         {"frame_drop_ratio",            &reg.frame_drop_ratio,                  0},  
168    
169          {"min_iquant",                          &reg.min_iquant,                                2},      /* zones */
170          {"max_iquant",                          &reg.max_iquant,                                31},      {"num_zones",               &reg.num_zones,                 1},
         {"min_pquant",                          &reg.min_pquant,                                2},  
         {"max_pquant",                          &reg.max_pquant,                                31},  
         {"min_bquant",                          &reg.min_bquant,                                2},  
         {"max_bquant",                          &reg.max_bquant,                                31},  
     {"trellis_quant",           &reg.trellis_quant,             0},  
171    
172          {"keyframe_boost",                      &reg.keyframe_boost,                    0},      /* single pass */
173            {"rc_reaction_delay_factor",&reg.rc_reaction_delay_factor,      16},
174            {"rc_averaging_period",         &reg.rc_averaging_period,               100},
175            {"rc_buffer",                           &reg.rc_buffer,                         100},
176    
177        /* 2pass1 */
178          {"discard1pass",                        &reg.discard1pass,                              1},          {"discard1pass",                        &reg.discard1pass,                              1},
179    
180        /* 2pass2 */
181            {"keyframe_boost",                      &reg.keyframe_boost,                    0},
182          {"kftreshold",                          &reg.kftreshold,                                10},          {"kftreshold",                          &reg.kftreshold,                                10},
183          {"kfreduction",                         &reg.kfreduction,                               20},          {"kfreduction",                         &reg.kfreduction,                               20},
184          {"curve_compression_high",      &reg.curve_compression_high,    0},          {"curve_compression_high",      &reg.curve_compression_high,    0},
# Line 195  Line 188 
188          {"twopass_max_overflow_improvement", &reg.twopass_max_overflow_improvement, 60},          {"twopass_max_overflow_improvement", &reg.twopass_max_overflow_improvement, 60},
189          {"twopass_max_overflow_degradation", &reg.twopass_max_overflow_degradation, 60},          {"twopass_max_overflow_degradation", &reg.twopass_max_overflow_degradation, 60},
190    
191      {"num_zones",               &reg.num_zones,                 1},      /* motion */
192        {"motion_search",                   &reg.motion_search,                             6},
193            {"vhq_mode",                            &reg.vhq_mode,                                  0},
194        {"chromame",                                &reg.chromame,                                  0},
195        {"cartoon_mode",                    &reg.cartoon_mode,                              0},
196            {"max_key_interval",            &reg.max_key_interval,                  300},
197            {"min_key_interval",            &reg.min_key_interval,                  1},
198            {"frame_drop_ratio",            &reg.frame_drop_ratio,                  0},
199    
200        /* quant */
201            {"min_iquant",                          &reg.min_iquant,                                2},
202            {"max_iquant",                          &reg.max_iquant,                                31},
203            {"min_pquant",                          &reg.min_pquant,                                2},
204            {"max_pquant",                          &reg.max_pquant,                                31},
205            {"min_bquant",                          &reg.min_bquant,                                2},
206            {"max_bquant",                          &reg.max_bquant,                                31},
207        {"trellis_quant",           &reg.trellis_quant,             0},
208    
209        /* debug */
210        {"fourcc_used",                             &reg.fourcc_used,                               0},
211        {"debug",                                   &reg.debug,                                             0x0},
212        {"vop_debug",                               &reg.vop_debug,                                 0},
213        {"display_status",          &reg.display_status,            1},
214  };  };
215    
216  static const REG_STR reg_strs[] = {  static const REG_STR reg_strs[] = {
# Line 210  Line 225 
225      {"zone%i_mode",             &stmp.mode,                      RC_ZONE_WEIGHT},      {"zone%i_mode",             &stmp.mode,                      RC_ZONE_WEIGHT},
226      {"zone%i_weight",           &stmp.weight,                    100},      /* 100-base float */      {"zone%i_weight",           &stmp.weight,                    100},      /* 100-base float */
227      {"zone%i_quant",            &stmp.quant,                     500},      /* 100-base float */      {"zone%i_quant",            &stmp.quant,                     500},      /* 100-base float */
228        {"zone%i_type",             &stmp.type,                      XVID_TYPE_AUTO},
229      {"zone%i_greyscale",        &stmp.greyscale,                 0},      {"zone%i_greyscale",        &stmp.greyscale,                 0},
230      {"zone%i_chroma_opt",       &stmp.chroma_opt,                0},      {"zone%i_chroma_opt",       &stmp.chroma_opt,                0},
231      {"zone%i_bvop_threshold",   &stmp.bvop_threshold,            0},      {"zone%i_bvop_threshold",   &stmp.bvop_threshold,            0},
# Line 619  Line 635 
635          break;          break;
636    
637      case IDD_ZONE :      case IDD_ZONE :
638          EnableDlgWindow(hDlg, IDC_ZONE_FETCH,          EnableDlgWindow(hDlg, IDC_ZONE_FETCH, config->ci_valid);
             config->cur_zone>0 && config->ci_valid && config->ci.ciActiveFrame>0);  
639          break;          break;
640    
641      case IDD_MOTION :      case IDD_MOTION :
# Line 791  Line 806 
806    
807      case IDD_ZONE :      case IDD_ZONE :
808          SetDlgItemInt(hDlg, IDC_ZONE_FRAME, config->zones[config->cur_zone].frame, FALSE);          SetDlgItemInt(hDlg, IDC_ZONE_FRAME, config->zones[config->cur_zone].frame, FALSE);
         SendDlgItemMessage(hDlg, IDC_ZONE_FRAME, EM_SETREADONLY, config->cur_zone==0?TRUE:FALSE, 0);  
809    
810          CheckDlgButton(hDlg, IDC_ZONE_MODE_WEIGHT,   config->zones[config->cur_zone].mode == RC_ZONE_WEIGHT);          CheckDlgButton(hDlg, IDC_ZONE_MODE_WEIGHT,   config->zones[config->cur_zone].mode == RC_ZONE_WEIGHT);
811          CheckDlgButton(hDlg, IDC_ZONE_MODE_QUANT,         config->zones[config->cur_zone].mode == RC_ZONE_QUANT);          CheckDlgButton(hDlg, IDC_ZONE_MODE_QUANT,         config->zones[config->cur_zone].mode == RC_ZONE_QUANT);
# Line 799  Line 813 
813          set_dlgitem_float(hDlg, IDC_ZONE_WEIGHT, config->zones[config->cur_zone].weight);          set_dlgitem_float(hDlg, IDC_ZONE_WEIGHT, config->zones[config->cur_zone].weight);
814          set_dlgitem_float(hDlg, IDC_ZONE_QUANT, config->zones[config->cur_zone].quant);          set_dlgitem_float(hDlg, IDC_ZONE_QUANT, config->zones[config->cur_zone].quant);
815    
816            CheckDlgButton(hDlg, IDC_ZONE_FORCEIVOP, config->zones[config->cur_zone].type==XVID_TYPE_IVOP);
817          CheckDlgButton(hDlg, IDC_ZONE_GREYSCALE, config->zones[config->cur_zone].greyscale);          CheckDlgButton(hDlg, IDC_ZONE_GREYSCALE, config->zones[config->cur_zone].greyscale);
818          CheckDlgButton(hDlg, IDC_ZONE_CHROMAOPT, config->zones[config->cur_zone].chroma_opt);          CheckDlgButton(hDlg, IDC_ZONE_CHROMAOPT, config->zones[config->cur_zone].chroma_opt);
819    
# Line 810  Line 824 
824                  SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0);                  SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0);
825                  SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0);                  SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0);
826          CheckDlg(hDlg, IDC_CHROMAME, config->chromame);          CheckDlg(hDlg, IDC_CHROMAME, config->chromame);
827            CheckDlg(hDlg, IDC_CARTOON, config->cartoon_mode);
828                  SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE);                  SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE);
829                  SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE);                  SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE);
830                  SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE);                  SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE);
# Line 838  Line 853 
853    
854                  SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE);                  SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE);
855    
                 CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug);  
         set_dlgitem_hex(hDlg, IDC_DEBUG, config->debug);  
856                  SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0);                  SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0);
857            set_dlgitem_hex(hDlg, IDC_DEBUG, config->debug);
858                    CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug);
859            CheckDlg(hDlg, IDC_DISPLAY_STATUS, config->display_status);
860                  break;                  break;
861          }          }
862  }  }
# Line 922  Line 938 
938          config->zones[config->cur_zone].weight = get_dlgitem_float(hDlg, IDC_ZONE_WEIGHT, config->zones[config->cur_zone].weight);          config->zones[config->cur_zone].weight = get_dlgitem_float(hDlg, IDC_ZONE_WEIGHT, config->zones[config->cur_zone].weight);
939          config->zones[config->cur_zone].quant =  get_dlgitem_float(hDlg, IDC_ZONE_QUANT, config->zones[config->cur_zone].quant);          config->zones[config->cur_zone].quant =  get_dlgitem_float(hDlg, IDC_ZONE_QUANT, config->zones[config->cur_zone].quant);
940    
941            config->zones[config->cur_zone].type = IsDlgButtonChecked(hDlg, IDC_ZONE_FORCEIVOP)?XVID_TYPE_IVOP:XVID_TYPE_AUTO;
942          config->zones[config->cur_zone].greyscale = IsDlgButtonChecked(hDlg, IDC_ZONE_GREYSCALE);          config->zones[config->cur_zone].greyscale = IsDlgButtonChecked(hDlg, IDC_ZONE_GREYSCALE);
943          config->zones[config->cur_zone].chroma_opt = IsDlgButtonChecked(hDlg, IDC_ZONE_CHROMAOPT);          config->zones[config->cur_zone].chroma_opt = IsDlgButtonChecked(hDlg, IDC_ZONE_CHROMAOPT);
944    
# Line 932  Line 949 
949                  config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0);                  config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0);
950                  config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0);                  config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0);
951                  config->chromame = IsDlgChecked(hDlg, IDC_CHROMAME);                  config->chromame = IsDlgChecked(hDlg, IDC_CHROMAME);
952                    config->cartoon_mode = IsDlgChecked(hDlg, IDC_CARTOON);
953    
954          config->frame_drop_ratio = config_get_uint(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio);          config->frame_drop_ratio = config_get_uint(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio);
955    
# Line 970  Line 988 
988                  config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads);                  config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads);
989    
990          config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0);          config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0);
                 config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG);  
991          config->debug = get_dlgitem_hex(hDlg, IDC_DEBUG, config->debug);          config->debug = get_dlgitem_hex(hDlg, IDC_DEBUG, config->debug);
992            config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG);
993            config->display_status = IsDlgChecked(hDlg, IDC_DISPLAY_STATUS);
994                  break;                  break;
995          }          }
996  }  }
# Line 1193  Line 1212 
1212      ListView_SetItemText(hDlg, i, 1, tmp);      ListView_SetItemText(hDlg, i, 1, tmp);
1213    
1214      tmp[0] = '\0';      tmp[0] = '\0';
1215        if (s->type==XVID_TYPE_IVOP)
1216            strcat(tmp, "K ");
1217    
1218      if (s->greyscale)      if (s->greyscale)
1219          strcat(tmp, "G ");          strcat(tmp, "G ");
1220    
# Line 1202  Line 1224 
1224      ListView_SetItemText(hDlg, i, 2, tmp);      ListView_SetItemText(hDlg, i, 2, tmp);
1225  }  }
1226    
1227    static int g_use_bitrate = 1;
1228    
1229  void main_mode(HWND hDlg, CONFIG * config)  void main_mode(HWND hDlg, CONFIG * config)
1230  {  {
1231        const int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0);
1232        const int rc_mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0);
1233        /* enable target rate/size control only for 1pass and 2pass  modes*/
1234        const int target_en = rc_mode==RC_MODE_1PASS || rc_mode==RC_MODE_2PASS2;
1235    
1236      char buf[16];      char buf[16];
     int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0);  
     int bitrate_en;  
1237      int max;      int max;
1238    
1239        g_use_bitrate = rc_mode==RC_MODE_1PASS || config->use_2pass_bitrate;
1240    
1241        if (g_use_bitrate) {
1242            SetDlgItemText(hDlg, IDC_BITRATE_S, "Target bitrate (kbps):");
1243    
1244      wsprintf(buf, "%i kbps", DEFAULT_MIN_KBPS);      wsprintf(buf, "%i kbps", DEFAULT_MIN_KBPS);
1245      SetDlgItemText(hDlg, IDC_BITRATE_MIN, buf);      SetDlgItemText(hDlg, IDC_BITRATE_MIN, buf);
1246    
# Line 1222  Line 1253 
1253      SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE,      SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE,
1254                      config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) );                      config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) );
1255    
1256      bitrate_en = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0);      }else{
1257      bitrate_en = bitrate_en==RC_MODE_1PASS || bitrate_en==RC_MODE_2PASS2;          SetDlgItemText(hDlg, IDC_BITRATE_S, "Target size (kbytes):");
1258        }
1259    
1260        EnableDlgWindow(hDlg, IDC_BITRATE_S, target_en);
1261        EnableDlgWindow(hDlg, IDC_BITRATE, target_en);
1262    
1263      EnableDlgWindow(hDlg, IDC_BITRATE_S, bitrate_en);      EnableDlgWindow(hDlg, IDC_BITRATE_MIN, target_en && g_use_bitrate);
1264      EnableDlgWindow(hDlg, IDC_BITRATE, bitrate_en);      EnableDlgWindow(hDlg, IDC_BITRATE_MAX, target_en && g_use_bitrate);
1265      EnableDlgWindow(hDlg, IDC_BITRATE_MIN, bitrate_en);      EnableDlgWindow(hDlg, IDC_SLIDER, target_en && g_use_bitrate);
     EnableDlgWindow(hDlg, IDC_BITRATE_MAX, bitrate_en);  
     EnableDlgWindow(hDlg, IDC_SLIDER, bitrate_en);  
1266  }  }
1267    
1268    
1269    
1270  void main_upload(HWND hDlg, CONFIG * config)  void main_upload(HWND hDlg, CONFIG * config)
1271  {  {
1272      int i;      int i;
1273    
1274      SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0);      SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0);
1275          SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0);          SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0);
1276    
1277        if (g_use_bitrate) {
1278      SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE);      SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE);
1279        }else{
1280            SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE);
1281        }
1282    
1283      ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES));      ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES));
1284      for (i=0; i < config->num_zones; i++) {      for (i=0; i < config->num_zones; i++) {
# Line 1252  Line 1292 
1292  {  {
1293      config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0);      config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0);
1294          config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0);          config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0);
1295    
1296        if (g_use_bitrate) {
1297      config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate);      config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate);
1298        }else{
1299            config->desired_size = config_get_uint(hDlg, IDC_BITRATE, config->desired_size);
1300        }
1301  }  }
   
   
1302    
1303    
1304  /* main dialog proc */  /* main dialog proc */
# Line 1292  Line 1335 
1335    
1336                  InitCommonControls();                  InitCommonControls();
1337    
   
1338                  if ((g_hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP,                  if ((g_hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP,
1339                                  CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,                                  CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
1340                                  NULL, NULL, g_hInst, NULL)))                                  NULL, NULL, g_hInst, NULL)))
# Line 1304  Line 1346 
1346                          EnumChildWindows(hDlg, enum_tooltips, 0);                          EnumChildWindows(hDlg, enum_tooltips, 0);
1347                  }                  }
1348    
1349            SetClassLong(GetDlgItem(hDlg, IDC_BITRATE_S), GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_HAND));
1350    
1351          {          {
1352              DWORD ext_style = ListView_GetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES));              DWORD ext_style = ListView_GetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES));
1353              ext_style |= LVS_EX_FULLROWSELECT | LVS_EX_FLATSB ;              ext_style |= LVS_EX_FULLROWSELECT | LVS_EX_FLATSB ;
# Line 1324  Line 1368 
1368              LVCOLUMN lvc;              LVCOLUMN lvc;
1369              int i;              int i;
1370    
1371              // Initialize the LVCOLUMN structure.              /* Initialize the LVCOLUMN structure.  */
1372              lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;              lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
1373              lvc.fmt = LVCFMT_LEFT;              lvc.fmt = LVCFMT_LEFT;
1374    
1375              // Add the columns.              /* Add the columns.  */
1376              for (i=0; i<sizeof(columns)/sizeof(char_int_t); i++) {              for (i=0; i<sizeof(columns)/sizeof(char_int_t); i++) {
1377                  lvc.pszText = (char*)columns[i].name;                  lvc.pszText = (char*)columns[i].name;
1378                  lvc.cchTextMax = strlen(columns[i].name);                  lvc.cchTextMax = strlen(columns[i].name);
# Line 1338  Line 1382 
1382              }              }
1383          }          }
1384    
1385            /* XXX: main_mode needs RC_MODE_xxx, main_upload needs g_use_bitrate set correctly... */
1386          main_upload(hDlg, config);          main_upload(hDlg, config);
1387          main_mode(hDlg, config);          main_mode(hDlg, config);
1388            main_upload(hDlg, config);
1389                  break;                  break;
1390    
1391      case WM_NOTIFY :      case WM_NOTIFY :
1392          {          {
1393              NMHDR * n = (NMHDR*)lParam;              NMHDR * n = (NMHDR*)lParam;
             int idc = (int)wParam;  
1394    
1395              if (n->code == NM_DBLCLK) {              if (n->code == NM_DBLCLK) {
1396                   NMLISTVIEW * nmlv = (NMLISTVIEW*) lParam;                   NMLISTVIEW * nmlv = (NMLISTVIEW*) lParam;
# Line 1387  Line 1432 
1432                              }                              }
1433                  break;                  break;
1434    
1435    
1436                case IDC_BITRATE_S :
1437                    /* alternate between bitrate/desired_length metrics */
1438                    main_download(hDlg, config);
1439                    config->use_2pass_bitrate = !config->use_2pass_bitrate;
1440                    main_mode(hDlg, config);
1441                    main_upload(hDlg, config);
1442                    break;
1443    
1444              case IDC_BITRATE_CALC :              case IDC_BITRATE_CALC :
1445                  main_download(hDlg, config);                  main_download(hDlg, config);
1446                  adv_dialog(hDlg, config, bitrate_dlgs, sizeof(bitrate_dlgs)/sizeof(int));                  adv_dialog(hDlg, config, bitrate_dlgs, sizeof(bitrate_dlgs)/sizeof(int));
# Line 1399  Line 1453 
1453                  int i, sel, new_frame;                  int i, sel, new_frame;
1454    
1455                  if (config->num_zones >= MAX_ZONES) {                  if (config->num_zones >= MAX_ZONES) {
1456                      MessageBox(hDlg, "MAX_ZONES", "Warning", 0);                      MessageBox(hDlg, "Exceeded maximum number of zones.\nIncrease config.h:MAX_ZONES and rebuild.", "Warning", 0);
1457                      break;                      break;
1458                  }                  }
1459    
# Line 1412  Line 1466 
1466                          new_frame = config->ci.ciActiveFrame;                          new_frame = config->ci.ciActiveFrame;
1467                      }else{                      }else{
1468                          sel = config->num_zones-1;                          sel = config->num_zones-1;
1469                          new_frame = config->zones[sel].frame + 1;                          new_frame = sel<0 ? 0 : config->zones[sel].frame + 1;
1470                      }                      }
1471                  }else{                  }else{
1472                      new_frame = config->zones[sel].frame + 1;                      new_frame = config->zones[sel].frame + 1;
1473                  }                  }
1474    
                 if (sel+1<config->num_zones && config->zones[sel+1].frame==new_frame) {  
                     MessageBox(hDlg, "CANT ADD HERE", "Warning", 0);  
                     break;  
                 }  
   
1475                  for(i=config->num_zones-1; i>sel; i--) {                  for(i=config->num_zones-1; i>sel; i--) {
1476                      config->zones[i+1] = config->zones[i];                      config->zones[i+1] = config->zones[i];
1477                  }                  }
# Line 1431  Line 1480 
1480                  config->zones[sel+1].mode = RC_ZONE_WEIGHT;                  config->zones[sel+1].mode = RC_ZONE_WEIGHT;
1481                  config->zones[sel+1].weight = 100;                  config->zones[sel+1].weight = 100;
1482                  config->zones[sel+1].quant = 500;                  config->zones[sel+1].quant = 500;
1483                    config->zones[sel+1].type = XVID_TYPE_AUTO;
1484                  config->zones[sel+1].greyscale = 0;                  config->zones[sel+1].greyscale = 0;
1485                  config->zones[sel+1].chroma_opt = 0;                  config->zones[sel+1].chroma_opt = 0;
1486                  config->zones[sel+1].bvop_threshold = 0;                  config->zones[sel+1].bvop_threshold = 0;
# Line 1451  Line 1501 
1501                      break;                      break;
1502                  }                  }
1503    
                 if (sel == 0) {  
                     MessageBox(hDlg, "Can't remove first zone", "Warning", 0);  
                     break;  
                 }  
   
1504                  for (i=sel; i<config->num_zones-1; i++) {                  for (i=sel; i<config->num_zones-1; i++) {
1505                      config->zones[i] = config->zones[i+1];                      config->zones[i] = config->zones[i+1];
1506                  }                  }
1507                  config->num_zones--;                  config->num_zones--;
1508                  ListView_DeleteItem(GetDlgItem(hDlg, IDC_ZONES), sel);                  ListView_DeleteItem(GetDlgItem(hDlg, IDC_ZONES), sel);
1509    
   
1510                  sel--;                  sel--;
1511                  if (sel==0 && config->num_zones>1) {                  if (sel==0 && config->num_zones>1) {
1512                      sel=1;                      sel=1;
# Line 1502  Line 1546 
1546              }              }
1547          }else if (HIWORD(wParam) == LBN_SELCHANGE &&          }else if (HIWORD(wParam) == LBN_SELCHANGE &&
1548              (LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) {              (LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) {
1549    
1550                main_download(hDlg, config);
1551              main_mode(hDlg, config);              main_mode(hDlg, config);
1552                main_upload(hDlg, config);
1553    
1554          }else if (HIWORD(wParam)==EN_UPDATE && LOWORD(wParam)==IDC_BITRATE) {          }else if (HIWORD(wParam)==EN_UPDATE && LOWORD(wParam)==IDC_BITRATE) {
1555    
1556                if (g_use_bitrate) {
1557              SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE,              SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE,
1558                      config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) );                      config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) );
1559                }
1560    
1561          }else {          }else {
1562              return 0;              return 0;
1563          }          }
# Line 1550  Line 1601 
1601                          info.version = XVID_VERSION;                          info.version = XVID_VERSION;
1602                          xvid_global(0, XVID_GBL_INFO, &info, NULL);                          xvid_global(0, XVID_GBL_INFO, &info, NULL);
1603                          wsprintf(core, "libxvidcore version %d.%d.%d (\"%s\")",                          wsprintf(core, "libxvidcore version %d.%d.%d (\"%s\")",
1604                                  XVID_MAJOR(info.actual_version),                                  XVID_VERSION_MAJOR(info.actual_version),
1605                                  XVID_MINOR(info.actual_version),                                  XVID_VERSION_MINOR(info.actual_version),
1606                                  XVID_PATCH(info.actual_version),                                  XVID_VERSION_PATCH(info.actual_version),
1607                                  info.build);                                  info.build);
1608    
1609                          SetDlgItemText(hDlg, IDC_CORE, core);                          SetDlgItemText(hDlg, IDC_CORE, core);

Legend:
Removed from v.1052  
changed lines
  Added in v.1193

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