Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
x264
Commits
5ccb93c1
Commit
5ccb93c1
authored
Jan 10, 2005
by
Loren Merritt
Browse files
updated VfW interface by Radek Czyz
git-svn-id:
svn://svn.videolan.org/x264/trunk@89
df754926-b1dd-0310-bc7b-ec298dee348c
parent
fc2e7ba6
Changes
7
Hide whitespace changes
Inline
Side-by-side
vfw/build/win32/x264vfw.dsp
View file @
5ccb93c1
# Microsoft Developer Studio Project File - Name="x264vfw" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=x264vfw - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "x264vfw.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "x264vfw.mak" CFG="x264vfw - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "x264vfw - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "x264vfw - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "x264vfw - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "obj/Release"
# PROP Intermediate_Dir "obj/Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VFW_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../../extras" /I "../../.." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VFW_EXPORTS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x804 /d "NDEBUG"
# ADD RSC /l 0x804 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 winmm.lib vfw32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"bin/x264vfw.dll"
!ELSEIF "$(CFG)" == "x264vfw - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "obj/Debug"
# PROP Intermediate_Dir "obj/Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VFW_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../../extras" /I "../../.." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VFW_EXPORTS" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x804 /d "_DEBUG"
# ADD RSC /l 0x804 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"bin/x264vfw.dll" /pdbtype:sept
!ENDIF
# Begin Target
# Name "x264vfw - Win32 Release"
# Name "x264vfw - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\..\codec.c
# End Source File
# Begin Source File
SOURCE=..\..\config.c
# End Source File
# Begin Source File
SOURCE=..\..\driverproc.c
# End Source File
# Begin Source File
SOURCE=..\..\driverproc.def
# End Source File
# Begin Source File
SOURCE=..\..\resource.rc
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\..\resource.h
# End Source File
# Begin Source File
SOURCE=..\..\x264vfw.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# Begin Source File
SOURCE=..\..\..\build\win32\bin\libx264.lib
# End Source File
# End Target
# End Project
# Microsoft Developer Studio Project File - Name="x264vfw" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=x264vfw - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "x264vfw.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "x264vfw.mak" CFG="x264vfw - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "x264vfw - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "x264vfw - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=xicl6.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "x264vfw - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "obj/Release"
# PROP Intermediate_Dir "obj/Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VFW_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../../extras" /I "../../.." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VFW_EXPORTS" /FR /YX /FD /c
# SUBTRACT CPP /Z<none>
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x804 /d "NDEBUG"
# ADD RSC /l 0x804 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 winmm.lib vfw32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"bin/x264vfw.dll"
# SUBTRACT LINK32 /debug
!ELSEIF "$(CFG)" == "x264vfw - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "obj/Debug"
# PROP Intermediate_Dir "obj/Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VFW_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../../extras" /I "../../.." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VFW_EXPORTS" /FR /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x804 /d "_DEBUG"
# ADD RSC /l 0x804 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"bin/x264vfw.dll" /pdbtype:sept
!ENDIF
# Begin Target
# Name "x264vfw - Win32 Release"
# Name "x264vfw - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\..\codec.c
# End Source File
# Begin Source File
SOURCE=..\..\config.c
# End Source File
# Begin Source File
SOURCE=..\..\driverproc.c
# End Source File
# Begin Source File
SOURCE=..\..\driverproc.def
# End Source File
# Begin Source File
SOURCE=..\..\resource.rc
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\..\resource.h
# End Source File
# Begin Source File
SOURCE=..\..\x264vfw.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# Begin Source File
SOURCE=..\..\..\build\win32\bin\libx264.lib
# End Source File
# End Target
# End Project
vfw/codec.c
View file @
5ccb93c1
...
...
@@ -24,6 +24,8 @@
#include
"x264vfw.h"
#include
<stdio.h>
/* debug only */
/* get_csp:
* return a valid x264 CSP or X264_CSP_NULL if unsuported */
static
int
get_csp
(
BITMAPINFOHEADER
*
hdr
)
...
...
@@ -130,6 +132,7 @@ LRESULT compress_begin(CODEC * codec, BITMAPINFO * lpbiInput, BITMAPINFO * lpbiO
{
CONFIG
*
config
=
&
codec
->
config
;
x264_param_t
param
;
static
char
statsfile
[]
=
".
\\
x264.stats"
;
/* Destroy previous handle */
if
(
codec
->
h
!=
NULL
)
...
...
@@ -141,37 +144,66 @@ LRESULT compress_begin(CODEC * codec, BITMAPINFO * lpbiInput, BITMAPINFO * lpbiO
/* Get default param */
x264_param_default
(
&
param
);
param
.
i_log_level
=
X264_LOG_NONE
;
param
.
analyse
.
b_psnr
=
0
;
param
.
analyse
.
inter
=
param
.
analyse
.
intra
=
0
;
/* Set params: TODO to complete */
param
.
i_width
=
lpbiInput
->
bmiHeader
.
biWidth
;
param
.
i_height
=
lpbiInput
->
bmiHeader
.
biHeight
;
if
(
codec
->
fbase
>
0
)
param
.
f
_fps
=
(
float
)
codec
->
fincr
/
(
float
)
codec
->
fbase
;
param
.
i_fps_num
=
codec
->
fbase
;
param
.
i
_fps
_den
=
codec
->
fincr
;
param
.
i_frame_reference
=
config
->
i_refmax
;
param
.
i_idrframe
=
config
->
i_idrframe
;
param
.
i_iframe
=
config
->
i_iframe
;
param
.
i_qp_constant
=
config
->
i_qp
;
param
.
b_deblocking_filter
=
config
->
b_filter
;
param
.
b_cabac
=
config
->
b_cabac
;
param
.
analyse
.
intra
=
0
;
param
.
analyse
.
inter
=
0
;
param
.
i_bframe
=
config
->
i_bframe
;
param
.
analyse
.
i_subpel_refine
=
config
->
i_subpel_refine
+
1
;
/* 0..4 -> 1..5 */
/* bframe prediction - gui goes alphabetically, so 0=NONE, 1=SPATIAL, 2=TEMPORAL */
switch
(
config
->
i_direct_mv_pred
)
{
case
0
:
param
.
analyse
.
i_direct_mv_pred
=
X264_DIRECT_PRED_NONE
;
break
;
case
1
:
param
.
analyse
.
i_direct_mv_pred
=
X264_DIRECT_PRED_SPATIAL
;
break
;
case
2
:
param
.
analyse
.
i_direct_mv_pred
=
X264_DIRECT_PRED_TEMPORAL
;
break
;
}
param
.
i_deblocking_filter_alphac0
=
config
->
i_inloop_a
;
param
.
i_deblocking_filter_beta
=
config
->
i_inloop_b
;
if
(
config
->
b_bsub16x16
)
param
.
analyse
.
inter
|=
X264_ANALYSE_BSUB16x16
;
if
(
config
->
b_psub16x16
)
param
.
analyse
.
inter
|=
X264_ANALYSE_PSUB16x16
;
if
(
config
->
b_psub8x8
)
param
.
analyse
.
inter
|=
X264_ANALYSE_PSUB8x8
;
if
(
config
->
b_i4x4
)
{
if
(
config
->
b_i4x4
)
{
param
.
analyse
.
intra
|=
X264_ANALYSE_I4x4
;
param
.
analyse
.
inter
|=
X264_ANALYSE_I4x4
;
}
switch
(
config
->
mod
e
)
switch
(
config
->
i_encoding_typ
e
)
{
case
0
:
/* 1 PASS */
case
0
:
/* 1 PASS CBR */
param
.
rc
.
b_cbr
=
1
;
param
.
rc
.
i_bitrate
=
config
->
bitrate
;
break
;
case
1
:
/* 1 PASS CQ */
param
.
rc
.
i_qp_constant
=
config
->
i_qp
;
break
;
default:
case
2
:
/* 2 PASS */
param
.
rc
.
psz_stat_out
=
param
.
rc
.
psz_stat_in
=
".
\\
x264.stats"
;
if
(
config
->
i_pass
==
1
)
param
.
rc
.
b_stat_write
=
1
;
else
{
param
.
rc
.
i_bitrate
=
config
->
i_2passbitrate
;
param
.
rc
.
b_stat_read
=
1
;
param
.
rc
.
b_cbr
=
1
;
}
break
;
}
...
...
@@ -253,15 +285,18 @@ LRESULT compress( CODEC *codec, ICCOMPRESS *icc )
/* encode it */
x264_encoder_encode
(
codec
->
h
,
&
nal
,
&
i_nal
,
&
pic
);
/* create bitstream */
/* create bitstream
, unless we're dropping it in 1st pass
*/
i_out
=
0
;
for
(
i
=
0
;
i
<
i_nal
;
i
++
)
{
int
i_size
=
outhdr
->
biSizeImage
-
i_out
;
x264_nal_encode
(
(
uint8_t
*
)
icc
->
lpOutput
+
i_out
,
&
i_size
,
1
,
&
nal
[
i
]
);
i_out
+=
i_size
;
if
(
codec
->
config
.
i_encoding_type
!=
2
||
codec
->
config
.
i_pass
>
1
)
{
for
(
i
=
0
;
i
<
i_nal
;
i
++
)
{
int
i_size
=
outhdr
->
biSizeImage
-
i_out
;
x264_nal_encode
(
(
uint8_t
*
)
icc
->
lpOutput
+
i_out
,
&
i_size
,
1
,
&
nal
[
i
]
);
i_out
+=
i_size
;
}
}
outhdr
->
biSizeImage
=
i_out
;
/* Set key frame only for IDR, as they are real synch point, I frame
...
...
vfw/config.c
View file @
5ccb93c1
...
...
@@ -35,18 +35,18 @@
#include
<commctrl.h>
/* Registry */
#define X264_REG_KEY
HKEY_CURRENT_USER
#define X264_REG_PARENT "Software\\GNU
\\x264
"
#define X264_REG_KEY
HKEY_CURRENT_USER
#define X264_REG_PARENT "Software\\GNU"
#define X264_REG_CHILD "x264"
#define X264_REG_CLASS "config"
/* window controls */
#define BITRATE_MAX
5000
#define QUANT_MAX
51
#define BITRATE_MAX
5000
#define QUANT_MAX
51
/* description */
#define X264_NAME
"x264"
#define X264_DEF_TEXT
"Are you sure you want to load default vaules"
#define X264_NAME
"x264"
#define X264_DEF_TEXT
"Are you sure you want to load default vaules"
/* Registery handling */
typedef
struct
...
...
@@ -70,23 +70,32 @@ static const reg_int_t reg_int_table[] =
{
"bitrate"
,
&
reg
.
bitrate
,
800
},
{
"quantizer"
,
&
reg
.
i_qp
,
26
},
{
"encoding_type"
,
&
reg
.
i_encoding_type
,
1
},
{
"passbitrate"
,
&
reg
.
i_2passbitrate
,
800
},
{
"pass_number"
,
&
reg
.
i_pass
,
1
},
/* Advance dialog */
{
"cabac"
,
&
reg
.
b_cabac
,
1
},
{
"loop_filter"
,
&
reg
.
b_filter
,
1
},
{
"idrframe"
,
&
reg
.
i_idrframe
,
1
},
{
"iframe"
,
&
reg
.
i_iframe
,
1
50
},
{
"iframe"
,
&
reg
.
i_iframe
,
2
50
},
{
"refmax"
,
&
reg
.
i_refmax
,
1
},
{
"bmax"
,
&
reg
.
i_bframe
,
0
},
{
"direct_pred"
,
&
reg
.
i_direct_mv_pred
,
2
},
{
"inloop_a"
,
&
reg
.
i_inloop_a
,
0
},
{
"inloop_b"
,
&
reg
.
i_inloop_b
,
0
},
/* analysis */
{
"i4x4"
,
&
reg
.
b_i4x4
,
1
},
{
"psub16x16"
,
&
reg
.
b_psub16x16
,
1
},
{
"psub8x8"
,
&
reg
.
b_psub8x8
,
1
}
{
"psub8x8"
,
&
reg
.
b_psub8x8
,
0
},
{
"bsub16x16"
,
&
reg
.
b_bsub16x16
,
1
},
{
"subpel"
,
&
reg
.
i_subpel_refine
,
3
}
};
static
const
reg_str_t
reg_str_table
[]
=
{
{
"fourcc"
,
reg
.
fcc
,
"
x
264"
}
{
"fourcc"
,
reg
.
fcc
,
"
h
264"
}
};
void
config_reg_load
(
CONFIG
*
config
)
...
...
@@ -164,15 +173,17 @@ void config_reg_defaults( CONFIG *config )
{
HKEY
hKey
;
/* Just in case */
memset
(
config
,
0
,
sizeof
(
CONFIG
)
);
if
(
RegOpenKeyEx
(
X264_REG_KEY
,
X264_REG_PARENT
,
0
,
KEY_ALL_ACCESS
,
&
hKey
))
if
(
RegOpenKeyEx
(
X264_REG_KEY
,
X264_REG_PARENT
,
0
,
KEY_ALL_ACCESS
,
&
hKey
))
{
return
;
if
(
RegDeleteKey
(
hKey
,
X264_REG_CHILD
)
)
}
if
(
RegDeleteKey
(
hKey
,
X264_REG_CHILD
)
)
{
return
;
}
RegCloseKey
(
hKey
);
/* Just in case */
memset
(
config
,
0
,
sizeof
(
CONFIG
)
);
config_reg_load
(
config
);
config_reg_save
(
config
);
}
...
...
@@ -190,7 +201,12 @@ static void main_enable_item( HWND hDlg, CONFIG * config )
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_QUANTEDIT
),
FALSE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_QUANTSLIDER
),
FALSE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_2PASS1
),
FALSE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_2PASS2
),
FALSE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_2PASSBITRATE
),
FALSE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_2PASSBITRATE_S
),
FALSE
);
break
;
case
1
:
/* 1 Pass, Quantizer Based */
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_BITRATEEDIT
),
FALSE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_BITRATESLIDER
),
FALSE
);
...
...
@@ -198,9 +214,24 @@ static void main_enable_item( HWND hDlg, CONFIG * config )
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_QUANTEDIT
),
TRUE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_QUANTSLIDER
),
TRUE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_2PASS1
),
FALSE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_2PASS2
),
FALSE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_2PASSBITRATE
),
FALSE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_2PASSBITRATE_S
),
FALSE
);
break
;
case
2
:
/* 2 Pass */
/* not yet implemented */
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_BITRATEEDIT
),
FALSE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_BITRATESLIDER
),
FALSE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_QUANTEDIT
),
FALSE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_QUANTSLIDER
),
FALSE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_2PASS1
),
TRUE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_2PASS2
),
TRUE
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_2PASSBITRATE
),
config
->
i_pass
>
1
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_2PASSBITRATE_S
),
config
->
i_pass
>
1
);
break
;
}
...
...
@@ -208,6 +239,10 @@ static void main_enable_item( HWND hDlg, CONFIG * config )
(
LPARAM
)
MAKELONG
(
0
,
BITRATE_MAX
)
);
SendDlgItemMessage
(
hDlg
,
IDC_QUANTSLIDER
,
TBM_SETRANGE
,
TRUE
,
(
LPARAM
)
MAKELONG
(
0
,
QUANT_MAX
)
);
SendDlgItemMessage
(
hDlg
,
IDC_2PASSBITRATE_S
,
TBM_SETRANGE
,
TRUE
,
(
LPARAM
)
MAKELONG
(
0
,
BITRATE_MAX
)
);
}
/* Updates the window from config */
...
...
@@ -215,6 +250,7 @@ static void main_update_dlg( HWND hDlg, CONFIG * config )
{
SetDlgItemInt
(
hDlg
,
IDC_BITRATEEDIT
,
config
->
bitrate
,
FALSE
);
SetDlgItemInt
(
hDlg
,
IDC_QUANTEDIT
,
config
->
i_qp
,
FALSE
);
SetDlgItemInt
(
hDlg
,
IDC_2PASSBITRATE
,
config
->
i_2passbitrate
,
FALSE
);
switch
(
config
->
i_encoding_type
)
{
...
...
@@ -223,12 +259,22 @@ static void main_update_dlg( HWND hDlg, CONFIG * config )
IDC_RADIOBITRATE
,
IDC_RADIOTWOPASS
,
IDC_RADIOBITRATE
);
break
;
case
1
:
/* 1 Pass, Quantizer Based */
CheckRadioButton
(
hDlg
,
IDC_RADIOBITRATE
,
IDC_RADIOTWOPASS
,
IDC_RADIOQUANT
);
CheckRadioButton
(
hDlg
,
IDC_RADIOBITRATE
,
IDC_RADIOTWOPASS
,
IDC_RADIOQUANT
);
break
;
case
2
:
/* 2 Pass */
CheckRadioButton
(
hDlg
,
IDC_RADIOBITRATE
,
IDC_RADIOTWOPASS
,
IDC_RADIOTWOPASS
);
CheckRadioButton
(
hDlg
,
IDC_RADIOBITRATE
,
IDC_RADIOTWOPASS
,
IDC_RADIOTWOPASS
);
if
(
config
->
i_pass
==
1
)
CheckRadioButton
(
hDlg
,
IDC_2PASS1
,
IDC_2PASS2
,
IDC_2PASS1
);
else
CheckRadioButton
(
hDlg
,
IDC_2PASS1
,
IDC_2PASS2
,
IDC_2PASS2
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_2PASSBITRATE
),
config
->
i_pass
>
1
);
EnableWindow
(
GetDlgItem
(
hDlg
,
IDC_2PASSBITRATE_S
),
config
->
i_pass
>
1
);
break
;
}
...
...
@@ -236,6 +282,9 @@ static void main_update_dlg( HWND hDlg, CONFIG * config )
config
->
bitrate
);
SendDlgItemMessage
(
hDlg
,
IDC_QUANTSLIDER
,
TBM_SETPOS
,
TRUE
,
config
->
i_qp
);
SendDlgItemMessage
(
hDlg
,
IDC_2PASSBITRATE_S
,
TBM_SETPOS
,
TRUE
,
config
->
i_2passbitrate
);
}
...
...
@@ -297,6 +346,16 @@ BOOL CALLBACK callback_main( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
main_enable_item
(
hDlg
,
config
);
main_update_dlg
(
hDlg
,
config
);
break
;
case
IDC_2PASS1
:
config
->
i_pass
=
1
;
/* 1st pass */
main_enable_item
(
hDlg
,
config
);
main_update_dlg
(
hDlg
,
config
);
break
;
case
IDC_2PASS2
:
config
->
i_pass
=
2
;
/* 2nd pass */
main_enable_item
(
hDlg
,
config
);
main_update_dlg
(
hDlg
,
config
);
break
;
}
break
;
case
EN_CHANGE
:
...
...
@@ -310,6 +369,10 @@ BOOL CALLBACK callback_main( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
config
->
i_qp
=
GetDlgItemInt
(
hDlg
,
IDC_QUANTEDIT
,
FALSE
,
FALSE
);
SendDlgItemMessage
(
hDlg
,
IDC_QUANTSLIDER
,
TBM_SETPOS
,
TRUE
,
config
->
i_qp
);
break
;
case
IDC_2PASSBITRATE
:
config
->
i_2passbitrate
=
GetDlgItemInt
(
hDlg
,
IDC_2PASSBITRATE
,
FALSE
,
FALSE
);
SendDlgItemMessage
(
hDlg
,
IDC_2PASSBITRATE_S
,
TBM_SETPOS
,
TRUE
,
config
->
i_2passbitrate
);
break
;
}
break
;
default:
...
...
@@ -329,6 +392,11 @@ BOOL CALLBACK callback_main( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
config
->
i_qp
=
SendDlgItemMessage
(
hDlg
,
IDC_QUANTSLIDER
,
TBM_GETPOS
,
0
,
0
);
SetDlgItemInt
(
hDlg
,
IDC_QUANTEDIT
,
config
->
i_qp
,
FALSE
);
}
else
if
(
(
HWND
)
lParam
==
GetDlgItem
(
hDlg
,
IDC_2PASSBITRATE_S
)
)
{
config
->
i_2passbitrate
=
SendDlgItemMessage
(
hDlg
,
IDC_2PASSBITRATE_S
,
TBM_GETPOS
,
0
,
0
);
SetDlgItemInt
(
hDlg
,
IDC_2PASSBITRATE
,
config
->
i_2passbitrate
,
FALSE
);
}
break
;
default
:
...
...
@@ -365,18 +433,62 @@ BOOL CALLBACK callback_about( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
return
1
;
}
static
void
set_dlgitem_int
(
HWND
hDlg
,
UINT
item
,
int
value
)
{
char
buf
[
8
];
sprintf
(
buf
,
"%i"
,
value
);
SetDlgItemText
(
hDlg
,
item
,
buf
);
}
static
void
adv_update_dlg
(
HWND
hDlg
,
CONFIG
*
config
)
{
char
fourcc
[
5
];
SendDlgItemMessage
(
hDlg
,
IDC_DIRECTPRED
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
"None"
);
SendDlgItemMessage
(
hDlg
,
IDC_DIRECTPRED
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
"Spatial"
);
SendDlgItemMessage
(
hDlg
,
IDC_DIRECTPRED
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
"Temporal"
);
SendDlgItemMessage
(
hDlg
,
IDC_SUBPEL
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
"1 (Fastest)"
);
SendDlgItemMessage
(
hDlg
,
IDC_SUBPEL
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
"2"
);
SendDlgItemMessage
(
hDlg
,
IDC_SUBPEL
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
"3"
);
SendDlgItemMessage
(
hDlg
,
IDC_SUBPEL
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
"4"
);
SendDlgItemMessage
(
hDlg
,
IDC_SUBPEL
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
"5 (Max Quality)"
);
CheckDlgButton
(
hDlg
,
IDC_CABAC
,
config
->
b_cabac
?
BST_CHECKED
:
BST_UNCHECKED
);
CheckDlgButton
(
hDlg
,
IDC_LOOPFILTER
,
config
->
b_filter
?
BST_CHECKED
:
BST_UNCHECKED
);
CheckDlgButton
(
hDlg
,
IDC_P16X16
,
config
->
b_psub16x16
?
BST_CHECKED
:
BST_UNCHECKED
);
CheckDlgButton
(
hDlg
,
IDC_P8X8
,