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 |
|
|
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 }, |
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 |
|
|
131 |
|
#ifdef DXN_PROFILES |
132 |
{ "DXN Handheld", 0x00, 176, 144, 15, -1, 198, 99, 1485, 100, 16*16368, -1, 128, PROFILE_ADAPTQUANT }, |
{ "DXN Handheld", 0x00, 176, 144, 15, -1, 198, 99, 1485, 100, 16*16368, -1, 128, PROFILE_ADAPTQUANT }, |
133 |
{ "DXN Portable NTSC", 0x00, 352, 240, 30, -1, 990, 330, 9900, 100, 64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP }, |
{ "DXN Portable NTSC", 0x00, 352, 240, 30, -1, 990, 330, 9900, 100, 64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP }, |
134 |
{ "DXN Portable PAL", 0x00, 352, 288, 25, -1, 1188, 396, 9900, 100, 64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP }, |
{ "DXN Portable PAL", 0x00, 352, 288, 25, -1, 1188, 396, 9900, 100, 64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP }, |
135 |
{ "DXN HT NTSC", 0x00, 720, 480, 30, -1, 4050, 1350, 40500, 100, 192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
{ "DXN HT NTSC", 0x00, 720, 480, 30, -1, 4050, 1350, 40500, 100, 192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
136 |
{ "DXN HT PAL", 0x00, 720, 576, 25, -1, 4860, 1620, 40500, 100, 192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
{ "DXN HT PAL", 0x00, 720, 576, 25, -1, 4860, 1620, 40500, 100, 192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
137 |
{ "DXN HDTV", 0x00, 1280, 720, 30, -1,10800, 3600, 108000, 100, 384*16368, -1, 8000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
{ "DXN HDTV", 0x00, 1280, 720, 30, -1,10800, 3600, 108000, 100, 384*16368, -1, 8000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
138 |
|
#endif |
139 |
|
|
140 |
{ "(unrestricted)", 0x00, 0, 0, 0, 0, 0, 0, 0, 100, 0*16368, 0, 0, 0xffffffff }, |
{ "(unrestricted)", 0x00, 0, 0, 0, 0, 0, 0, 0, 100, 0*16368, 0, 0, 0xffffffff }, |
141 |
}; |
}; |
151 |
static const REG_INT reg_ints[] = { |
static const REG_INT reg_ints[] = { |
152 |
{"mode", ®.mode, RC_MODE_1PASS}, |
{"mode", ®.mode, RC_MODE_1PASS}, |
153 |
{"bitrate", ®.bitrate, 700}, |
{"bitrate", ®.bitrate, 700}, |
154 |
/* {"desired_size", ®.desired_size, 570000}, not used */ |
{"desired_size", ®.desired_size, 570000}, |
155 |
|
{"use_2pass_bitrate", ®.use_2pass_bitrate, 0}, |
|
{"rc_reaction_delay_factor",®.rc_reaction_delay_factor, 16}, |
|
|
{"rc_averaging_period", ®.rc_averaging_period, 100}, |
|
|
{"rc_buffer", ®.rc_buffer, 100}, |
|
156 |
|
|
157 |
{"motion_search", ®.motion_search, 6}, |
/* profile */ |
158 |
{"quant_type", ®.quant_type, 0}, |
{"quant_type", ®.quant_type, 0}, |
|
{"fourcc_used", ®.fourcc_used, 0}, |
|
|
{"vhq_mode", ®.vhq_mode, 0}, |
|
|
{"max_key_interval", ®.max_key_interval, 300}, |
|
|
{"min_key_interval", ®.min_key_interval, 1}, |
|
159 |
{"lum_masking", ®.lum_masking, 0}, |
{"lum_masking", ®.lum_masking, 0}, |
160 |
{"interlacing", ®.interlacing, 0}, |
{"interlacing", ®.interlacing, 0}, |
161 |
{"qpel", ®.qpel, 0}, |
{"qpel", ®.qpel, 0}, |
162 |
{"gmc", ®.gmc, 0}, |
{"gmc", ®.gmc, 0}, |
163 |
{"chromame", ®.chromame, 0}, |
{"reduced_resolution", ®.reduced_resolution, 0}, |
164 |
{"use_bvop", ®.use_bvop, 0}, |
{"use_bvop", ®.use_bvop, 1}, |
165 |
{"max_bframes", ®.max_bframes, 2}, |
{"max_bframes", ®.max_bframes, 2}, |
166 |
{"bquant_ratio", ®.bquant_ratio, 150}, /* 100-base float */ |
{"bquant_ratio", ®.bquant_ratio, 150}, /* 100-base float */ |
167 |
{"bquant_offset", ®.bquant_offset, 100}, /* 100-base float */ |
{"bquant_offset", ®.bquant_offset, 100}, /* 100-base float */ |
168 |
{"packed", ®.packed, 0}, |
{"packed", ®.packed, 1}, |
169 |
{"closed_gov", ®.closed_gov, 1}, |
{"closed_gov", ®.closed_gov, 1}, |
170 |
{"vop_debug", ®.vop_debug, 0}, |
|
171 |
{"debug", ®.debug, 0x0}, |
/* aspect ratio */ |
172 |
{"reduced_resolution", ®.reduced_resolution, 0}, |
{"ar_mode", ®.ar_mode, 0}, |
173 |
|
{"aspect_ratio", ®.display_aspect_ratio, 0}, |
174 |
|
{"par_x", ®.par_x, 1}, |
175 |
|
{"par_y", ®.par_y, 1}, |
176 |
|
{"ar_x", ®.ar_x, 4}, |
177 |
|
{"ar_y", ®.ar_y, 3}, |
178 |
|
|
179 |
|
/* zones */ |
180 |
|
{"num_zones", ®.num_zones, 1}, |
181 |
|
|
182 |
|
/* single pass */ |
183 |
|
{"rc_reaction_delay_factor",®.rc_reaction_delay_factor, 16}, |
184 |
|
{"rc_averaging_period", ®.rc_averaging_period, 100}, |
185 |
|
{"rc_buffer", ®.rc_buffer, 100}, |
186 |
|
|
187 |
|
/* 2pass1 */ |
188 |
|
{"discard1pass", ®.discard1pass, 1}, |
189 |
|
|
190 |
|
/* 2pass2 */ |
191 |
|
{"keyframe_boost", ®.keyframe_boost, 0}, |
192 |
|
{"kfreduction", ®.kfreduction, 20}, |
193 |
|
{"kfthreshold", ®.kfthreshold, 1}, |
194 |
|
{"curve_compression_high", ®.curve_compression_high, 0}, |
195 |
|
{"curve_compression_low", ®.curve_compression_low, 0}, |
196 |
|
{"overflow_control_strength", ®.overflow_control_strength, 5}, |
197 |
|
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 5}, |
198 |
|
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 5}, |
199 |
|
|
200 |
|
/* motion */ |
201 |
|
{"motion_search", ®.motion_search, 6}, |
202 |
|
{"vhq_mode", ®.vhq_mode, 1}, |
203 |
|
{"chromame", ®.chromame, 1}, |
204 |
|
{"cartoon_mode", ®.cartoon_mode, 0}, |
205 |
|
{"max_key_interval", ®.max_key_interval, 300}, |
206 |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
207 |
|
|
208 |
|
/* quant */ |
209 |
{"min_iquant", ®.min_iquant, 2}, |
{"min_iquant", ®.min_iquant, 2}, |
210 |
{"max_iquant", ®.max_iquant, 31}, |
{"max_iquant", ®.max_iquant, 31}, |
211 |
{"min_pquant", ®.min_pquant, 2}, |
{"min_pquant", ®.min_pquant, 2}, |
214 |
{"max_bquant", ®.max_bquant, 31}, |
{"max_bquant", ®.max_bquant, 31}, |
215 |
{"trellis_quant", ®.trellis_quant, 0}, |
{"trellis_quant", ®.trellis_quant, 0}, |
216 |
|
|
217 |
{"keyframe_boost", ®.keyframe_boost, 0}, |
/* debug */ |
218 |
{"discard1pass", ®.discard1pass, 1}, |
{"fourcc_used", ®.fourcc_used, 0}, |
219 |
{"kftreshold", ®.kftreshold, 10}, |
{"debug", ®.debug, 0x0}, |
220 |
{"kfreduction", ®.kfreduction, 20}, |
{"vop_debug", ®.vop_debug, 0}, |
221 |
{"curve_compression_high", ®.curve_compression_high, 0}, |
{"display_status", ®.display_status, 1}, |
|
{"curve_compression_low", ®.curve_compression_low, 0}, |
|
|
{"bitrate_payback_delay", ®.bitrate_payback_delay, 250}, |
|
|
{"bitrate_payback_method", ®.bitrate_payback_method, XVID_PAYBACK_BIAS }, |
|
|
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 60}, |
|
|
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 60}, |
|
|
|
|
|
{"num_zones", ®.num_zones, 1}, |
|
222 |
}; |
}; |
223 |
|
|
224 |
static const REG_STR reg_strs[] = { |
static const REG_STR reg_strs[] = { |
233 |
{"zone%i_mode", &stmp.mode, RC_ZONE_WEIGHT}, |
{"zone%i_mode", &stmp.mode, RC_ZONE_WEIGHT}, |
234 |
{"zone%i_weight", &stmp.weight, 100}, /* 100-base float */ |
{"zone%i_weight", &stmp.weight, 100}, /* 100-base float */ |
235 |
{"zone%i_quant", &stmp.quant, 500}, /* 100-base float */ |
{"zone%i_quant", &stmp.quant, 500}, /* 100-base float */ |
236 |
|
{"zone%i_type", &stmp.type, XVID_TYPE_AUTO}, |
237 |
{"zone%i_greyscale", &stmp.greyscale, 0}, |
{"zone%i_greyscale", &stmp.greyscale, 0}, |
238 |
{"zone%i_chroma_opt", &stmp.chroma_opt, 0}, |
{"zone%i_chroma_opt", &stmp.chroma_opt, 0}, |
239 |
{"zone%i_bvop_threshold", &stmp.bvop_threshold, 0}, |
{"zone%i_bvop_threshold", &stmp.bvop_threshold, 0}, |
635 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
636 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
637 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
638 |
|
|
639 |
|
break; |
640 |
|
case IDD_AR: |
641 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"Square (default)"); |
642 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"4:3 PAL"); |
643 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"4:3 NTSC"); |
644 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"16:9 PAL"); |
645 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"16:9 NTSC"); |
646 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"Custom..."); |
647 |
break; |
break; |
648 |
|
|
649 |
case IDD_LEVEL : |
case IDD_LEVEL : |
652 |
break; |
break; |
653 |
|
|
654 |
case IDD_ZONE : |
case IDD_ZONE : |
655 |
EnableDlgWindow(hDlg, IDC_ZONE_FETCH, |
EnableDlgWindow(hDlg, IDC_ZONE_FETCH, config->ci_valid); |
|
config->cur_zone>0 && config->ci_valid && config->ci.ciActiveFrame>0); |
|
656 |
break; |
break; |
657 |
|
|
658 |
case IDD_MOTION : |
case IDD_MOTION : |
692 |
int weight_en, quant_en; |
int weight_en, quant_en; |
693 |
int cpu_force; |
int cpu_force; |
694 |
int custom_quant, bvops; |
int custom_quant, bvops; |
695 |
|
int ar_mode, ar_par; |
696 |
|
|
697 |
switch(idd) { |
switch(idd) { |
698 |
case IDD_PROFILE : |
case IDD_PROFILE : |
719 |
EnableDlgWindow(hDlg, IDC_BQUANTOFFSET_S, bvops); |
EnableDlgWindow(hDlg, IDC_BQUANTOFFSET_S, bvops); |
720 |
EnableDlgWindow(hDlg, IDC_PACKED, bvops); |
EnableDlgWindow(hDlg, IDC_PACKED, bvops); |
721 |
EnableDlgWindow(hDlg, IDC_CLOSEDGOV, bvops); |
EnableDlgWindow(hDlg, IDC_CLOSEDGOV, bvops); |
722 |
|
break; |
723 |
|
|
724 |
|
case IDD_AR: |
725 |
|
ar_mode = IsDlgChecked(hDlg, IDC_PAR); |
726 |
|
EnableDlgWindow(hDlg, IDC_ASPECT_RATIO, ar_mode); |
727 |
|
|
728 |
|
ar_par = SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_GETCURSEL, 0, 0); |
729 |
|
if (ar_par == 5) { /* custom par */ |
730 |
|
SetDlgItemInt(hDlg, IDC_PARY, config->par_y, FALSE); |
731 |
|
SetDlgItemInt(hDlg, IDC_PARX, config->par_x, FALSE); |
732 |
|
|
733 |
|
EnableDlgWindow(hDlg, IDC_PARX, ar_mode); |
734 |
|
EnableDlgWindow(hDlg, IDC_PARY, ar_mode); |
735 |
|
} else { |
736 |
|
SetDlgItemInt(hDlg, IDC_PARX, PARS[ar_par][0], FALSE); |
737 |
|
SetDlgItemInt(hDlg, IDC_PARY, PARS[ar_par][1], FALSE); |
738 |
|
EnableDlgWindow(hDlg, IDC_PARX, FALSE); |
739 |
|
EnableDlgWindow(hDlg, IDC_PARY, FALSE); |
740 |
|
} |
741 |
|
|
742 |
|
ar_mode = IsDlgChecked(hDlg, IDC_AR); |
743 |
|
|
744 |
|
config->ar_x = config_get_uint(hDlg, IDC_ARX, config->ar_x); |
745 |
|
config->ar_y = config_get_uint(hDlg, IDC_ARY, config->ar_y); |
746 |
|
|
747 |
|
EnableDlgWindow(hDlg, IDC_ARX, ar_mode); |
748 |
|
EnableDlgWindow(hDlg, IDC_ARY, ar_mode); |
749 |
|
break; |
750 |
|
|
751 |
case IDD_LEVEL : |
case IDD_LEVEL : |
752 |
profile = SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_GETCURSEL, 0, 0); |
profile = SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_GETCURSEL, 0, 0); |
817 |
set_dlgitem_float(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
set_dlgitem_float(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
818 |
CheckDlg(hDlg, IDC_PACKED, config->packed); |
CheckDlg(hDlg, IDC_PACKED, config->packed); |
819 |
CheckDlg(hDlg, IDC_CLOSEDGOV, config->closed_gov); |
CheckDlg(hDlg, IDC_CLOSEDGOV, config->closed_gov); |
820 |
|
|
821 |
|
break; |
822 |
|
case IDD_AR: |
823 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, config->ar_mode == 0 ? IDC_PAR : IDC_AR); |
824 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_SETCURSEL, (config->display_aspect_ratio), 0); |
825 |
|
SetDlgItemInt(hDlg, IDC_ARX, config->ar_x, FALSE); |
826 |
|
SetDlgItemInt(hDlg, IDC_ARY, config->ar_y, FALSE); |
827 |
break; |
break; |
828 |
|
|
829 |
case IDD_LEVEL : |
case IDD_LEVEL : |
844 |
case IDD_RC_2PASS2 : |
case IDD_RC_2PASS2 : |
845 |
SetDlgItemText(hDlg, IDC_STATS, config->stats); |
SetDlgItemText(hDlg, IDC_STATS, config->stats); |
846 |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
|
SetDlgItemInt(hDlg, IDC_KFTRESHOLD, config->kftreshold, FALSE); |
|
847 |
SetDlgItemInt(hDlg, IDC_KFREDUCTION, config->kfreduction, FALSE); |
SetDlgItemInt(hDlg, IDC_KFREDUCTION, config->kfreduction, FALSE); |
848 |
|
|
849 |
|
SetDlgItemInt(hDlg, IDC_OVERFLOW_CONTROL_STRENGTH, config->overflow_control_strength, FALSE); |
850 |
SetDlgItemInt(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement, FALSE); |
SetDlgItemInt(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement, FALSE); |
851 |
SetDlgItemInt(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation, FALSE); |
SetDlgItemInt(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation, FALSE); |
852 |
|
|
853 |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
854 |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
855 |
SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, FALSE); |
SetDlgItemInt(hDlg, IDC_MINKEY, config->kfthreshold, FALSE); |
|
CheckDlgButton(hDlg, IDC_PAYBACKBIAS, (config->bitrate_payback_method == XVID_PAYBACK_BIAS)); |
|
|
CheckDlgButton(hDlg, IDC_PAYBACKPROP, (config->bitrate_payback_method == XVID_PAYBACK_PROP)); |
|
856 |
break; |
break; |
857 |
|
|
858 |
case IDD_ZONE : |
case IDD_ZONE : |
859 |
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); |
|
860 |
|
|
861 |
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); |
862 |
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); |
864 |
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); |
865 |
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); |
866 |
|
|
867 |
|
CheckDlgButton(hDlg, IDC_ZONE_FORCEIVOP, config->zones[config->cur_zone].type==XVID_TYPE_IVOP); |
868 |
CheckDlgButton(hDlg, IDC_ZONE_GREYSCALE, config->zones[config->cur_zone].greyscale); |
CheckDlgButton(hDlg, IDC_ZONE_GREYSCALE, config->zones[config->cur_zone].greyscale); |
869 |
CheckDlgButton(hDlg, IDC_ZONE_CHROMAOPT, config->zones[config->cur_zone].chroma_opt); |
CheckDlgButton(hDlg, IDC_ZONE_CHROMAOPT, config->zones[config->cur_zone].chroma_opt); |
870 |
|
|
875 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); |
876 |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0); |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0); |
877 |
CheckDlg(hDlg, IDC_CHROMAME, config->chromame); |
CheckDlg(hDlg, IDC_CHROMAME, config->chromame); |
878 |
|
CheckDlg(hDlg, IDC_CARTOON, config->cartoon_mode); |
879 |
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
880 |
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
|
SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE); |
|
881 |
break; |
break; |
882 |
|
|
883 |
case IDD_QUANT : |
case IDD_QUANT : |
903 |
|
|
904 |
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
905 |
|
|
|
CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug); |
|
|
set_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
|
906 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
907 |
|
set_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
908 |
|
CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug); |
909 |
|
CheckDlg(hDlg, IDC_DISPLAY_STATUS, config->display_status); |
910 |
break; |
break; |
911 |
} |
} |
912 |
} |
} |
936 |
config->closed_gov = IsDlgChecked(hDlg, IDC_CLOSEDGOV); |
config->closed_gov = IsDlgChecked(hDlg, IDC_CLOSEDGOV); |
937 |
break; |
break; |
938 |
|
|
939 |
|
case IDD_AR: |
940 |
|
config->ar_mode = IsDlgChecked(hDlg, IDC_PAR) ? 0:1; |
941 |
|
config->ar_x = config_get_uint(hDlg, IDC_ARX, config->ar_x); |
942 |
|
config->ar_y = config_get_uint(hDlg, IDC_ARY, config->ar_y); |
943 |
|
config->display_aspect_ratio = SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_GETCURSEL, 0, 0); |
944 |
|
if (config->display_aspect_ratio == 5) { |
945 |
|
config->par_x = config_get_uint(hDlg, IDC_PARX, config->par_x); |
946 |
|
config->par_y = config_get_uint(hDlg, IDC_PARY, config->par_y); |
947 |
|
} |
948 |
|
break; |
949 |
|
|
950 |
case IDD_LEVEL : |
case IDD_LEVEL : |
951 |
config->profile = SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_GETCURSEL, 0, 0); |
config->profile = SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_GETCURSEL, 0, 0); |
952 |
break; |
break; |
968 |
lstrcpy(config->stats, CONFIG_2PASS_FILE); |
lstrcpy(config->stats, CONFIG_2PASS_FILE); |
969 |
|
|
970 |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
|
config->kftreshold = GetDlgItemInt(hDlg, IDC_KFTRESHOLD, NULL, FALSE); |
|
971 |
config->kfreduction = GetDlgItemInt(hDlg, IDC_KFREDUCTION, NULL, FALSE); |
config->kfreduction = GetDlgItemInt(hDlg, IDC_KFREDUCTION, NULL, FALSE); |
972 |
|
CONSTRAINVAL(config->keyframe_boost, 0, 1000); |
973 |
|
|
974 |
|
config->overflow_control_strength = GetDlgItemInt(hDlg, IDC_OVERFLOW_CONTROL_STRENGTH, NULL, FALSE); |
975 |
config->twopass_max_overflow_improvement = config_get_uint(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement); |
config->twopass_max_overflow_improvement = config_get_uint(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement); |
976 |
config->twopass_max_overflow_degradation = config_get_uint(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation); |
config->twopass_max_overflow_degradation = config_get_uint(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation); |
977 |
CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); |
CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); |
978 |
CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); |
CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); |
979 |
|
CONSTRAINVAL(config->overflow_control_strength, 0, 100); |
980 |
|
|
981 |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
982 |
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
|
config->bitrate_payback_delay = config_get_uint(hDlg, IDC_PAYBACK, config->bitrate_payback_delay); |
|
|
config->bitrate_payback_method = IsDlgChecked(hDlg, IDC_PAYBACKPROP) ? XVID_PAYBACK_PROP : XVID_PAYBACK_BIAS; |
|
|
|
|
|
CONSTRAINVAL(config->bitrate_payback_delay, 1, 10000); |
|
|
CONSTRAINVAL(config->keyframe_boost, 0, 1000); |
|
983 |
CONSTRAINVAL(config->curve_compression_high, 0, 100); |
CONSTRAINVAL(config->curve_compression_high, 0, 100); |
984 |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
985 |
|
|
986 |
|
config->kfthreshold = config_get_uint(hDlg, IDC_MINKEY, config->kfthreshold); |
987 |
|
|
988 |
break; |
break; |
989 |
|
|
990 |
case IDD_ZONE : |
case IDD_ZONE : |
999 |
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); |
1000 |
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); |
1001 |
|
|
1002 |
|
config->zones[config->cur_zone].type = IsDlgButtonChecked(hDlg, IDC_ZONE_FORCEIVOP)?XVID_TYPE_IVOP:XVID_TYPE_AUTO; |
1003 |
config->zones[config->cur_zone].greyscale = IsDlgButtonChecked(hDlg, IDC_ZONE_GREYSCALE); |
config->zones[config->cur_zone].greyscale = IsDlgButtonChecked(hDlg, IDC_ZONE_GREYSCALE); |
1004 |
config->zones[config->cur_zone].chroma_opt = IsDlgButtonChecked(hDlg, IDC_ZONE_CHROMAOPT); |
config->zones[config->cur_zone].chroma_opt = IsDlgButtonChecked(hDlg, IDC_ZONE_CHROMAOPT); |
1005 |
|
|
1010 |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
1011 |
config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0); |
config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0); |
1012 |
config->chromame = IsDlgChecked(hDlg, IDC_CHROMAME); |
config->chromame = IsDlgChecked(hDlg, IDC_CHROMAME); |
1013 |
|
config->cartoon_mode = IsDlgChecked(hDlg, IDC_CARTOON); |
1014 |
|
|
1015 |
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); |
1016 |
|
|
1017 |
config->max_key_interval = config_get_uint(hDlg, IDC_MAXKEY, config->max_key_interval); |
config->max_key_interval = config_get_uint(hDlg, IDC_MAXKEY, config->max_key_interval); |
|
config->min_key_interval = config_get_uint(hDlg, IDC_MINKEY, config->min_key_interval); |
|
1018 |
break; |
break; |
1019 |
|
|
1020 |
case IDD_QUANT : |
case IDD_QUANT : |
1048 |
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
1049 |
|
|
1050 |
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); |
|
1051 |
config->debug = get_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
config->debug = get_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
1052 |
|
config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG); |
1053 |
|
config->display_status = IsDlgChecked(hDlg, IDC_DISPLAY_STATUS); |
1054 |
break; |
break; |
1055 |
} |
} |
1056 |
} |
} |
1088 |
case IDC_ZONE_BVOPTHRESHOLD_ENABLE : |
case IDC_ZONE_BVOPTHRESHOLD_ENABLE : |
1089 |
case IDC_CPU_AUTO : |
case IDC_CPU_AUTO : |
1090 |
case IDC_CPU_FORCE : |
case IDC_CPU_FORCE : |
1091 |
|
case IDC_AR : |
1092 |
|
case IDC_PAR : |
1093 |
adv_mode(hDlg, psi->idd, psi->config); |
adv_mode(hDlg, psi->idd, psi->config); |
1094 |
break; |
break; |
1095 |
|
|
1129 |
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, psi->config->ci.ciActiveFrame, FALSE); |
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, psi->config->ci.ciActiveFrame, FALSE); |
1130 |
break; |
break; |
1131 |
|
|
1132 |
|
case IDC_AR_DEFAULT: |
1133 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_PAR); |
1134 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_SETCURSEL, 0, 0); |
1135 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1136 |
|
break; |
1137 |
|
case IDC_AR_4_3: |
1138 |
|
SetDlgItemInt(hDlg, IDC_ARX, 4, FALSE); |
1139 |
|
SetDlgItemInt(hDlg, IDC_ARY, 3, FALSE); |
1140 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_AR); |
1141 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1142 |
|
break; |
1143 |
|
case IDC_AR_16_9: |
1144 |
|
SetDlgItemInt(hDlg, IDC_ARX, 16, FALSE); |
1145 |
|
SetDlgItemInt(hDlg, IDC_ARY, 9, FALSE); |
1146 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_AR); |
1147 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1148 |
|
break; |
1149 |
|
case IDC_AR_235_100: |
1150 |
|
SetDlgItemInt(hDlg, IDC_ARX, 235, FALSE); |
1151 |
|
SetDlgItemInt(hDlg, IDC_ARY, 100, FALSE); |
1152 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_AR); |
1153 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1154 |
|
break; |
1155 |
|
|
1156 |
default : |
default : |
1157 |
return TRUE; |
return TRUE; |
1158 |
} |
} |
1159 |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
1160 |
(LOWORD(wParam) == IDC_PROFILE_PROFILE || |
(LOWORD(wParam) == IDC_PROFILE_PROFILE || |
1161 |
LOWORD(wParam) == IDC_LEVEL_PROFILE || |
LOWORD(wParam) == IDC_LEVEL_PROFILE || |
1162 |
LOWORD(wParam) == IDC_QUANTTYPE)) |
LOWORD(wParam) == IDC_QUANTTYPE || |
1163 |
|
LOWORD(wParam) == IDC_ASPECT_RATIO)) |
1164 |
{ |
{ |
1165 |
adv_mode(hDlg, psi->idd, psi->config); |
adv_mode(hDlg, psi->idd, psi->config); |
1166 |
}else if (HIWORD(wParam) == EN_UPDATE && (LOWORD(wParam)==IDC_ZONE_WEIGHT || LOWORD(wParam)==IDC_ZONE_QUANT)) { |
}else if (HIWORD(wParam) == EN_UPDATE && (LOWORD(wParam)==IDC_ZONE_WEIGHT || LOWORD(wParam)==IDC_ZONE_QUANT)) { |
1167 |
|
|
1168 |
SendDlgItemMessage(hDlg, IDC_ZONE_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_ZONE_SLIDER, TBM_SETPOS, TRUE, |
1169 |
get_dlgitem_float(hDlg, LOWORD(wParam), 100)); |
get_dlgitem_float(hDlg, LOWORD(wParam), 100)); |
1170 |
}else { |
} else if (HIWORD(wParam) == EN_UPDATE && (LOWORD(wParam)==IDC_PARX || LOWORD(wParam)==IDC_PARY)) { |
1171 |
return 0; |
if (5 == SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_GETCURSEL, 0, 0)) { |
1172 |
|
if(LOWORD(wParam)==IDC_PARX) |
1173 |
|
psi->config->par_x = config_get_uint(hDlg, LOWORD(wParam), psi->config->par_x); |
1174 |
|
else |
1175 |
|
psi->config->par_y = config_get_uint(hDlg, LOWORD(wParam), psi->config->par_y); |
1176 |
} |
} |
1177 |
|
} else |
1178 |
|
return 0; |
1179 |
break; |
break; |
1180 |
|
|
1181 |
case WM_HSCROLL : |
case WM_HSCROLL : |
1305 |
ListView_SetItemText(hDlg, i, 1, tmp); |
ListView_SetItemText(hDlg, i, 1, tmp); |
1306 |
|
|
1307 |
tmp[0] = '\0'; |
tmp[0] = '\0'; |
1308 |
|
if (s->type==XVID_TYPE_IVOP) |
1309 |
|
strcat(tmp, "K "); |
1310 |
|
|
1311 |
if (s->greyscale) |
if (s->greyscale) |
1312 |
strcat(tmp, "G "); |
strcat(tmp, "G "); |
1313 |
|
|
1317 |
ListView_SetItemText(hDlg, i, 2, tmp); |
ListView_SetItemText(hDlg, i, 2, tmp); |
1318 |
} |
} |
1319 |
|
|
1320 |
|
static int g_use_bitrate = 1; |
1321 |
|
|
1322 |
void main_mode(HWND hDlg, CONFIG * config) |
void main_mode(HWND hDlg, CONFIG * config) |
1323 |
{ |
{ |
1324 |
|
const int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1325 |
|
const int rc_mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1326 |
|
/* enable target rate/size control only for 1pass and 2pass modes*/ |
1327 |
|
const int target_en = rc_mode==RC_MODE_1PASS || rc_mode==RC_MODE_2PASS2; |
1328 |
|
|
1329 |
char buf[16]; |
char buf[16]; |
|
int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
|
|
int bitrate_en; |
|
1330 |
int max; |
int max; |
1331 |
|
|
1332 |
|
g_use_bitrate = rc_mode==RC_MODE_1PASS || config->use_2pass_bitrate; |
1333 |
|
|
1334 |
|
if (g_use_bitrate) { |
1335 |
|
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target bitrate (kbps):"); |
1336 |
|
|
1337 |
wsprintf(buf, "%i kbps", DEFAULT_MIN_KBPS); |
wsprintf(buf, "%i kbps", DEFAULT_MIN_KBPS); |
1338 |
SetDlgItemText(hDlg, IDC_BITRATE_MIN, buf); |
SetDlgItemText(hDlg, IDC_BITRATE_MIN, buf); |
1339 |
|
|
1346 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1347 |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
1348 |
|
|
1349 |
bitrate_en = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
}else{ |
1350 |
bitrate_en = bitrate_en==RC_MODE_1PASS || bitrate_en==RC_MODE_2PASS2; |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target size (kbytes):"); |
1351 |
|
} |
1352 |
|
|
1353 |
EnableDlgWindow(hDlg, IDC_BITRATE_S, bitrate_en); |
EnableDlgWindow(hDlg, IDC_BITRATE_S, target_en); |
1354 |
EnableDlgWindow(hDlg, IDC_BITRATE, bitrate_en); |
EnableDlgWindow(hDlg, IDC_BITRATE, target_en); |
1355 |
EnableDlgWindow(hDlg, IDC_BITRATE_MIN, bitrate_en); |
|
1356 |
EnableDlgWindow(hDlg, IDC_BITRATE_MAX, bitrate_en); |
EnableDlgWindow(hDlg, IDC_BITRATE_MIN, target_en && g_use_bitrate); |
1357 |
EnableDlgWindow(hDlg, IDC_SLIDER, bitrate_en); |
EnableDlgWindow(hDlg, IDC_BITRATE_MAX, target_en && g_use_bitrate); |
1358 |
|
EnableDlgWindow(hDlg, IDC_SLIDER, target_en && g_use_bitrate); |
1359 |
} |
} |
1360 |
|
|
1361 |
|
|
1362 |
|
|
1363 |
void main_upload(HWND hDlg, CONFIG * config) |
void main_upload(HWND hDlg, CONFIG * config) |
1364 |
{ |
{ |
1365 |
int i; |
int i; |
1366 |
|
|
1367 |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
1368 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
1369 |
|
|
1370 |
|
if (g_use_bitrate) { |
1371 |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
1372 |
|
}else{ |
1373 |
|
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
1374 |
|
} |
1375 |
|
|
1376 |
ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES)); |
ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES)); |
1377 |
for (i=0; i < config->num_zones; i++) { |
for (i=0; i < config->num_zones; i++) { |
1385 |
{ |
{ |
1386 |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1387 |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1388 |
|
|
1389 |
|
if (g_use_bitrate) { |
1390 |
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
1391 |
|
}else{ |
1392 |
|
config->desired_size = config_get_uint(hDlg, IDC_BITRATE, config->desired_size); |
1393 |
|
} |
1394 |
} |
} |
|
|
|
|
|
|
1395 |
|
|
1396 |
|
|
1397 |
/* main dialog proc */ |
/* main dialog proc */ |
1398 |
|
|
1399 |
static const int profile_dlgs[] = { IDD_PROFILE, IDD_LEVEL }; |
static const int profile_dlgs[] = { IDD_PROFILE, IDD_LEVEL, IDD_AR }; |
1400 |
static const int single_dlgs[] = { IDD_RC_CBR }; |
static const int single_dlgs[] = { IDD_RC_CBR }; |
1401 |
static const int pass1_dlgs[] = { IDD_RC_2PASS1 }; |
static const int pass1_dlgs[] = { IDD_RC_2PASS1 }; |
1402 |
static const int pass2_dlgs[] = { IDD_RC_2PASS2 }; |
static const int pass2_dlgs[] = { IDD_RC_2PASS2 }; |
1428 |
|
|
1429 |
InitCommonControls(); |
InitCommonControls(); |
1430 |
|
|
|
|
|
1431 |
if ((g_hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, |
if ((g_hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, |
1432 |
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
1433 |
NULL, NULL, g_hInst, NULL))) |
NULL, NULL, g_hInst, NULL))) |
1439 |
EnumChildWindows(hDlg, enum_tooltips, 0); |
EnumChildWindows(hDlg, enum_tooltips, 0); |
1440 |
} |
} |
1441 |
|
|
1442 |
|
SetClassLong(GetDlgItem(hDlg, IDC_BITRATE_S), GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_HAND)); |
1443 |
|
|
1444 |
{ |
{ |
1445 |
DWORD ext_style = ListView_GetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES)); |
DWORD ext_style = ListView_GetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES)); |
1446 |
ext_style |= LVS_EX_FULLROWSELECT | LVS_EX_FLATSB ; |
ext_style |= LVS_EX_FULLROWSELECT | LVS_EX_FLATSB ; |
1461 |
LVCOLUMN lvc; |
LVCOLUMN lvc; |
1462 |
int i; |
int i; |
1463 |
|
|
1464 |
// Initialize the LVCOLUMN structure. |
/* Initialize the LVCOLUMN structure. */ |
1465 |
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; |
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; |
1466 |
lvc.fmt = LVCFMT_LEFT; |
lvc.fmt = LVCFMT_LEFT; |
1467 |
|
|
1468 |
// Add the columns. |
/* Add the columns. */ |
1469 |
for (i=0; i<sizeof(columns)/sizeof(char_int_t); i++) { |
for (i=0; i<sizeof(columns)/sizeof(char_int_t); i++) { |
1470 |
lvc.pszText = (char*)columns[i].name; |
lvc.pszText = (char*)columns[i].name; |
1471 |
lvc.cchTextMax = strlen(columns[i].name); |
lvc.cchTextMax = strlen(columns[i].name); |
1475 |
} |
} |
1476 |
} |
} |
1477 |
|
|
1478 |
|
/* XXX: main_mode needs RC_MODE_xxx, main_upload needs g_use_bitrate set correctly... */ |
1479 |
main_upload(hDlg, config); |
main_upload(hDlg, config); |
1480 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
1481 |
|
main_upload(hDlg, config); |
1482 |
break; |
break; |
1483 |
|
|
1484 |
case WM_NOTIFY : |
case WM_NOTIFY : |
1485 |
{ |
{ |
1486 |
NMHDR * n = (NMHDR*)lParam; |
NMHDR * n = (NMHDR*)lParam; |
|
int idc = (int)wParam; |
|
1487 |
|
|
1488 |
if (n->code == NM_DBLCLK) { |
if (n->code == NM_DBLCLK) { |
1489 |
NMLISTVIEW * nmlv = (NMLISTVIEW*) lParam; |
NMLISTVIEW * nmlv = (NMLISTVIEW*) lParam; |
1525 |
} |
} |
1526 |
break; |
break; |
1527 |
|
|
1528 |
|
|
1529 |
|
case IDC_BITRATE_S : |
1530 |
|
/* alternate between bitrate/desired_length metrics */ |
1531 |
|
main_download(hDlg, config); |
1532 |
|
config->use_2pass_bitrate = !config->use_2pass_bitrate; |
1533 |
|
main_mode(hDlg, config); |
1534 |
|
main_upload(hDlg, config); |
1535 |
|
break; |
1536 |
|
|
1537 |
case IDC_BITRATE_CALC : |
case IDC_BITRATE_CALC : |
1538 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1539 |
adv_dialog(hDlg, config, bitrate_dlgs, sizeof(bitrate_dlgs)/sizeof(int)); |
adv_dialog(hDlg, config, bitrate_dlgs, sizeof(bitrate_dlgs)/sizeof(int)); |
1540 |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
//SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
1541 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
1542 |
break; |
break; |
1543 |
|
|
1546 |
int i, sel, new_frame; |
int i, sel, new_frame; |
1547 |
|
|
1548 |
if (config->num_zones >= MAX_ZONES) { |
if (config->num_zones >= MAX_ZONES) { |
1549 |
MessageBox(hDlg, "MAX_ZONES", "Warning", 0); |
MessageBox(hDlg, "Exceeded maximum number of zones.\nIncrease config.h:MAX_ZONES and rebuild.", "Warning", 0); |
1550 |
break; |
break; |
1551 |
} |
} |
1552 |
|
|
1559 |
new_frame = config->ci.ciActiveFrame; |
new_frame = config->ci.ciActiveFrame; |
1560 |
}else{ |
}else{ |
1561 |
sel = config->num_zones-1; |
sel = config->num_zones-1; |
1562 |
new_frame = config->zones[sel].frame + 1; |
new_frame = sel<0 ? 0 : config->zones[sel].frame + 1; |
1563 |
} |
} |
1564 |
}else{ |
}else{ |
1565 |
new_frame = config->zones[sel].frame + 1; |
new_frame = config->zones[sel].frame + 1; |
1566 |
} |
} |
1567 |
|
|
|
if (sel+1<config->num_zones && config->zones[sel+1].frame==new_frame) { |
|
|
MessageBox(hDlg, "CANT ADD HERE", "Warning", 0); |
|
|
break; |
|
|
} |
|
|
|
|
1568 |
for(i=config->num_zones-1; i>sel; i--) { |
for(i=config->num_zones-1; i>sel; i--) { |
1569 |
config->zones[i+1] = config->zones[i]; |
config->zones[i+1] = config->zones[i]; |
1570 |
} |
} |
1573 |
config->zones[sel+1].mode = RC_ZONE_WEIGHT; |
config->zones[sel+1].mode = RC_ZONE_WEIGHT; |
1574 |
config->zones[sel+1].weight = 100; |
config->zones[sel+1].weight = 100; |
1575 |
config->zones[sel+1].quant = 500; |
config->zones[sel+1].quant = 500; |
1576 |
|
config->zones[sel+1].type = XVID_TYPE_AUTO; |
1577 |
config->zones[sel+1].greyscale = 0; |
config->zones[sel+1].greyscale = 0; |
1578 |
config->zones[sel+1].chroma_opt = 0; |
config->zones[sel+1].chroma_opt = 0; |
1579 |
config->zones[sel+1].bvop_threshold = 0; |
config->zones[sel+1].bvop_threshold = 0; |
1594 |
break; |
break; |
1595 |
} |
} |
1596 |
|
|
|
if (sel == 0) { |
|
|
MessageBox(hDlg, "Can't remove first zone", "Warning", 0); |
|
|
break; |
|
|
} |
|
|
|
|
1597 |
for (i=sel; i<config->num_zones-1; i++) { |
for (i=sel; i<config->num_zones-1; i++) { |
1598 |
config->zones[i] = config->zones[i+1]; |
config->zones[i] = config->zones[i+1]; |
1599 |
} |
} |
1600 |
config->num_zones--; |
config->num_zones--; |
1601 |
ListView_DeleteItem(GetDlgItem(hDlg, IDC_ZONES), sel); |
ListView_DeleteItem(GetDlgItem(hDlg, IDC_ZONES), sel); |
1602 |
|
|
|
|
|
1603 |
sel--; |
sel--; |
1604 |
if (sel==0 && config->num_zones>1) { |
if (sel==0 && config->num_zones>1) { |
1605 |
sel=1; |
sel=1; |
1639 |
} |
} |
1640 |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
1641 |
(LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) { |
(LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) { |
1642 |
|
|
1643 |
|
main_download(hDlg, config); |
1644 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
1645 |
|
main_upload(hDlg, config); |
1646 |
|
|
1647 |
}else if (HIWORD(wParam)==EN_UPDATE && LOWORD(wParam)==IDC_BITRATE) { |
}else if (HIWORD(wParam)==EN_UPDATE && LOWORD(wParam)==IDC_BITRATE) { |
1648 |
|
|
1649 |
|
if (g_use_bitrate) { |
1650 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1651 |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
1652 |
|
} |
1653 |
|
|
1654 |
}else { |
}else { |
1655 |
return 0; |
return 0; |
1656 |
} |
} |
1694 |
info.version = XVID_VERSION; |
info.version = XVID_VERSION; |
1695 |
xvid_global(0, XVID_GBL_INFO, &info, NULL); |
xvid_global(0, XVID_GBL_INFO, &info, NULL); |
1696 |
wsprintf(core, "libxvidcore version %d.%d.%d (\"%s\")", |
wsprintf(core, "libxvidcore version %d.%d.%d (\"%s\")", |
1697 |
XVID_MAJOR(info.actual_version), |
XVID_VERSION_MAJOR(info.actual_version), |
1698 |
XVID_MINOR(info.actual_version), |
XVID_VERSION_MINOR(info.actual_version), |
1699 |
XVID_PATCH(info.actual_version), |
XVID_VERSION_PATCH(info.actual_version), |
1700 |
info.build); |
info.build); |
1701 |
|
|
1702 |
SetDlgItemText(hDlg, IDC_CORE, core); |
SetDlgItemText(hDlg, IDC_CORE, core); |