[Sumover-dev] [svn commit] r4885 - in vic/branches/mpeg4: codec
sumover-dev at cs.ucl.ac.uk
sumover-dev at cs.ucl.ac.uk
Sun Sep 12 10:51:34 BST 2010
Author: douglask
Date: Sun Sep 12 10:51:34 2010
New Revision: 4885
Modified:
vic/branches/mpeg4/codec/encoder-h264.cpp
vic/branches/mpeg4/codec/encoder-mpeg4.cpp
vic/branches/mpeg4/tcl/ui-ctrlmenu.tcl
vic/branches/mpeg4/tcl/ui-grabber.tcl
vic/branches/mpeg4/tcl/ui-resource.tcl
Log:
New menu and resource to enable/disable deinterlacer with H264 and MPEG4 encoding. The deinterlacer was reducing the fps
Added a resource for software scaler used with Blackmagic grabber
Modified: vic/branches/mpeg4/codec/encoder-h264.cpp
==============================================================================
--- vic/branches/mpeg4/codec/encoder-h264.cpp (original)
+++ vic/branches/mpeg4/codec/encoder-h264.cpp Sun Sep 12 10:51:34 2010
@@ -47,6 +47,7 @@
x264Encoder *enc;
DataBuffer *fOut;
Deinterlace deinterlacer;
+ bool use_deinterlacer;
FILE *fptr;
};
@@ -77,6 +78,7 @@
kbps = 512;
gop = 20;
fOut=NULL;
+ use_deinterlacer=false;
}
H264Encoder::~H264Encoder()
@@ -111,6 +113,10 @@
//std::cout << "H264: kbps " << kbps << "\n";
return (TCL_OK);
}
+ else if (strcmp(argv[1], "useDeinterlacer") == 0) {
+ use_deinterlacer = atoi(argv[2]);
+ return (TCL_OK);
+ }
else if (strcmp(argv[1], "hq") == 0) {
int enable_hq = atoi(argv[2]);
return (TCL_OK);
@@ -149,7 +155,9 @@
}
frame_size = vf->width_ * vf->height_;
- deinterlacer.render(vf->bp_, vf->width_, vf->height_);
+ if (use_deinterlacer) {
+ deinterlacer.render(vf->bp_, vf->width_, vf->height_);
+ }
enc->encodeFrame(vf->bp_);
numNAL = enc->numNAL();
Modified: vic/branches/mpeg4/codec/encoder-mpeg4.cpp
==============================================================================
--- vic/branches/mpeg4/codec/encoder-mpeg4.cpp (original)
+++ vic/branches/mpeg4/codec/encoder-mpeg4.cpp Sun Sep 12 10:51:34 2010
@@ -44,6 +44,7 @@
FFMpegCodec mpeg4;
UCHAR *bitstream;
Deinterlace deinterlacer;
+ bool use_deinterlacer;
};
static class MPEG4EncoderMatcher:public Matcher
@@ -106,6 +107,10 @@
kbps = atoi(argv[2]);
return (TCL_OK);
}
+ else if (strcmp(argv[1], "useDeinterlacer") == 0) {
+ use_deinterlacer = atoi(argv[2]);
+ return (TCL_OK);
+ }
else if (strcmp(argv[1], "hq") == 0) {
int enable_hq = atoi(argv[2]);
//printf("enable mpeg4 high quality encoding\n", enable_hq);
@@ -164,8 +169,10 @@
// std::cout << "kbps:" << kbps << " fps:" << fps << "\n";
mpeg4.init_encoder(vf->width_, vf->height_, kbps * 1024, fps, gop);
}
-
- deinterlacer.render(vf->bp_, vf->width_, vf->height_);
+
+ if (use_deinterlacer) {
+ deinterlacer.render(vf->bp_, vf->width_, vf->height_);
+ }
bitstream = mpeg4.encode(vf->bp_, len);
// std::cout << "MPEG4 ENC: packet length " << len << endl;
Modified: vic/branches/mpeg4/tcl/ui-ctrlmenu.tcl
==============================================================================
--- vic/branches/mpeg4/tcl/ui-ctrlmenu.tcl (original)
+++ vic/branches/mpeg4/tcl/ui-ctrlmenu.tcl Sun Sep 12 10:51:34 2010
@@ -523,10 +523,11 @@
}
proc update_encoder_param { } {
- global videoFormat fps_slider bps_slider
+ global videoFormat fps_slider bps_slider useDeinterlacerComp
if {$videoFormat == "mpeg4" || $videoFormat == "h264"} {
encoder kbps [expr round([$bps_slider get])]
encoder fps [expr round([$fps_slider get])]
+ encoder useDeinterlacer $useDeinterlacerComp
}
}
@@ -1192,9 +1193,10 @@
}
proc build.encoder_options w {
- global useJPEGforH261 tcl_platform useHardwareComp
+ global useJPEGforH261 tcl_platform useHardwareComp useDeinterlacerComp
set useJPEGforH261 [yesno useJPEGforH261]
set useHardwareComp [yesno useHardwareComp]
+ set useDeinterlacerComp [yesno useDeinterlacerComp]
set f [smallfont]
set m $w.menu
@@ -1213,6 +1215,8 @@
-variable useJPEGforH261 -font $f -command restart
$m add checkbutton -label "Use Hardware Encode" \
-variable useHardwareComp -font $f -command restart
+ $m add checkbutton -label "Use Deinterlacer" \
+ -variable useDeinterlacerComp -font $f -command restart
if { $tcl_platform(platform) == "windows" || [windowingsystem] == "aqua"} {
$m add checkbutton -label "Configure on Transmit" \
-variable configOnTransmit -font $f \
Modified: vic/branches/mpeg4/tcl/ui-grabber.tcl
==============================================================================
--- vic/branches/mpeg4/tcl/ui-grabber.tcl (original)
+++ vic/branches/mpeg4/tcl/ui-grabber.tcl Sun Sep 12 10:51:34 2010
@@ -194,7 +194,7 @@
}
proc build.blackmagic w {
- global scalerResolution scalerButtons
+ global scalerCompResolution scalerButtons
label $w.title -text "Blackmagic DeckLink-Grabber"
frame $w.f -relief sunken -borderwidth 2
@@ -203,40 +203,38 @@
if {$::tk_version > 8.4 && [windowingsystem] != "x11"} {
ttk::radiobutton $w.f.b0 -text "none" -command "restart" \
- -variable scalerResolution -value "none"
+ -variable scalerCompResolution -value "none"
ttk::radiobutton $w.f.b1 -text "960p" -command "restart" \
- -variable scalerResolution -value "960p"
+ -variable scalerCompResolution -value "960p"
ttk::radiobutton $w.f.b2 -text "720p" -command "restart" \
- -variable scalerResolution -value "720p"
+ -variable scalerCompResolution -value "720p"
ttk::radiobutton $w.f.b3 -text "576p" -command "restart" \
- -variable scalerResolution -value "576p"
+ -variable scalerCompResolution -value "576p"
ttk::radiobutton $w.f.b4 -text "480p" -command "restart" \
- -variable scalerResolution -value "480p"
+ -variable scalerCompResolution -value "480p"
} else {
set f [smallfont]
radiobutton $w.f.b0 -text "none" -command "restart" \
-padx 0 -pady 0 \
- -anchor w -variable scalerResolution -font $f -relief flat -value "none"
+ -anchor w -variable scalerCompResolution -font $f -relief flat -value "none"
radiobutton $w.f.b1 -text "960p" -command "restart" \
-padx 0 -pady 0 \
- -anchor w -variable scalerResolution -font $f -relief flat -value "960p"
+ -anchor w -variable scalerCompResolution -font $f -relief flat -value "960p"
radiobutton $w.f.b2 -text "720p" -command "restart" \
-padx 0 -pady 0 \
- -anchor w -variable scalerResolution -font $f -relief flat -value "720p"
+ -anchor w -variable scalerCompResolution -font $f -relief flat -value "720p"
radiobutton $w.f.b3 -text "576p" -command "restart" \
-padx 0 -pady 0 \
- -anchor w -variable scalerResolution -font $f -relief flat -value "576p"
+ -anchor w -variable scalerCompResolution -font $f -relief flat -value "576p"
radiobutton $w.f.b4 -text "480p" -command "restart" \
-padx 0 -pady 0 \
- -anchor w -variable scalerResolution -font $f -relief flat -value "480p"
+ -anchor w -variable scalerCompResolution -font $f -relief flat -value "480p"
}
pack $w.f.scaling $w.f.b0 $w.f.b1 $w.f.b2 $w.f.b3 $w.f.b4 -fill x -side left
pack $w.title $w.f -fill x -expand 1
- if { ! [info exists scalerResolution] } {
- set scalerResolution "none"
- }
+ set scalerCompResolution [resource scalerCompResolution]
set scalerButtons $w.f
set_scaler_buttons_state
}
Modified: vic/branches/mpeg4/tcl/ui-resource.tcl
==============================================================================
--- vic/branches/mpeg4/tcl/ui-resource.tcl (original)
+++ vic/branches/mpeg4/tcl/ui-resource.tcl Sun Sep 12 10:51:34 2010
@@ -179,11 +179,13 @@
option add Vic.infoHighlightColor LightYellow2 startupFile
option add Vic.useJPEGforH261 false startupFile
option add Vic.useHardwareComp false startupFile
+ option add Vic.useDeinterlacerComp false startupFile
option add Vic.stillGrabber false startupFile
option add Vic.fileGrabber false startupFile
option add Vic.siteDropTime "300" startupFile
option add Vic.quality "0" startupFile
option add Vic.inputType "ntsc" startupFile
+ option add Vic.scalerCompResolution "none" startupFile
option add Vic.brightness "128" startupFile
option add Vic.contrast "128" startupFile
More information about the Sumover-dev
mailing list