diff options
author | Johns <johns98@gmx.net> | 2012-01-27 23:49:05 +0100 |
---|---|---|
committer | Johns <johns98@gmx.net> | 2012-01-27 23:49:05 +0100 |
commit | 4d74ed1bfc2199d58b2375153cb838b3e71042e3 (patch) | |
tree | 553206a246994c8047ff8dec85d56e79d0846541 | |
parent | c3b924a2393c46513e5b02d5b821084d668e0bb9 (diff) | |
download | vdr-plugin-softhddevice-4d74ed1bfc2199d58b2375153cb838b3e71042e3.tar.gz vdr-plugin-softhddevice-4d74ed1bfc2199d58b2375153cb838b3e71042e3.tar.bz2 |
Add auto-crop tolerance configuration.
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | softhddevice.cpp | 16 | ||||
-rw-r--r-- | video.c | 26 | ||||
-rw-r--r-- | video.h | 2 |
4 files changed, 30 insertions, 15 deletions
@@ -1,6 +1,7 @@ User johns Date: + Add auto-crop tolerance configuration. Reduces audio latency, increases audio buffer time. Made video_test working again. Disabled VA-API Intel vaAssociateSubpicture workaround. diff --git a/softhddevice.cpp b/softhddevice.cpp index 8e3a336..d882ce3 100644 --- a/softhddevice.cpp +++ b/softhddevice.cpp @@ -81,6 +81,7 @@ static int ConfigAudioPassthrough; ///< config audio pass-through static int ConfigAutoCropInterval; ///< auto crop detection interval static int ConfigAutoCropDelay; ///< auto crop detection delay +static int ConfigAutoCropTolerance; ///< auto crop detection tolerance static char ConfigSuspendClose; ///< suspend should close devices static char ConfigSuspendX11; ///< suspend should stop x11 @@ -371,6 +372,7 @@ class cMenuSetupSoft:public cMenuSetupPage int AudioPassthrough; int AutoCropInterval; int AutoCropDelay; + int AutoCropTolerance; int SuspendClose; int SuspendX11; protected: @@ -462,6 +464,9 @@ cMenuSetupSoft::cMenuSetupSoft(void) AutoCropDelay = ConfigAutoCropDelay; Add(new cMenuEditIntItem(tr("autocrop delay (n * interval)"), &AutoCropDelay, 0, 200)); + AutoCropTolerance = ConfigAutoCropTolerance; + Add(new cMenuEditIntItem(tr("autocrop tolerance (pixel)"), + &AutoCropTolerance, 0, 32)); // // suspend // @@ -514,7 +519,8 @@ void cMenuSetupSoft::Store(void) SetupStore("AutoCrop.Interval", ConfigAutoCropInterval = AutoCropInterval); SetupStore("AutoCrop.Delay", ConfigAutoCropDelay = AutoCropDelay); - VideoSetAutoCrop(ConfigAutoCropInterval, ConfigAutoCropDelay); + SetupStore("AutoCrop.Tolerance", ConfigAutoCropTolerance = AutoCropTolerance); + VideoSetAutoCrop(ConfigAutoCropInterval, ConfigAutoCropDelay, ConfigAutoCropTolerance); SetupStore("Suspend.Close", ConfigSuspendClose = SuspendClose); SetupStore("Suspend.X11", ConfigSuspendX11 = SuspendX11); @@ -1208,12 +1214,16 @@ bool cPluginSoftHdDevice::SetupParse(const char *name, const char *value) if (!strcmp(name, "AutoCrop.Interval")) { VideoSetAutoCrop(ConfigAutoCropInterval = - atoi(value), ConfigAutoCropDelay); + atoi(value), ConfigAutoCropDelay, ConfigAutoCropTolerance); return true; } if (!strcmp(name, "AutoCrop.Delay")) { VideoSetAutoCrop(ConfigAutoCropInterval, ConfigAutoCropDelay = - atoi(value)); + atoi(value), ConfigAutoCropTolerance); + return true; + } + if (!strcmp(name, "AutoCrop.Tolerance")) { + VideoSetAutoCrop(ConfigAutoCropInterval, ConfigAutoCropDelay, ConfigAutoCropTolerance = atoi(value)); return true; } @@ -873,6 +873,7 @@ typedef struct _auto_crop_ctx_ static const int AutoCropLogoIgnore = 24; static int AutoCropInterval; ///< auto-crop check interval static int AutoCropDelay; ///< auto-crop switch delay +static int AutoCropTolerance; ///< auto-crop tolerance /// /// Detect black line Y. @@ -2443,12 +2444,13 @@ static void VaapiAutoCrop(VaapiDecoder * decoder) (decoder->InputAspect.den * 16); crop16 = (decoder->InputHeight - crop16) / 2; - // -2 for rounding errors - if (decoder->AutoCrop->Y1 >= crop16 - 2 - && decoder->InputHeight - decoder->AutoCrop->Y2 >= crop16 - 2) { + if (decoder->AutoCrop->Y1 >= crop16 - AutoCropTolerance + && decoder->InputHeight - decoder->AutoCrop->Y2 >= + crop16 - AutoCropTolerance) { next_state = 16; - } else if (decoder->AutoCrop->Y1 >= crop14 - 2 - && decoder->InputHeight - decoder->AutoCrop->Y2 >= crop14 - 2) { + } else if (decoder->AutoCrop->Y1 >= crop14 - AutoCropTolerance + && decoder->InputHeight - decoder->AutoCrop->Y2 >= + crop14 - AutoCropTolerance) { next_state = 14; } else { next_state = 0; @@ -5792,12 +5794,13 @@ static void VdpauAutoCrop(VdpauDecoder * decoder) (decoder->InputAspect.den * 16); crop16 = (decoder->InputHeight - crop16) / 2; - // -2 for rounding errors - if (decoder->AutoCrop->Y1 >= crop16 - 2 - && decoder->InputHeight - decoder->AutoCrop->Y2 >= crop16 - 2) { + if (decoder->AutoCrop->Y1 >= crop16 - AutoCropTolerance + && decoder->InputHeight - decoder->AutoCrop->Y2 >= + crop16 - AutoCropTolerance) { next_state = 16; - } else if (decoder->AutoCrop->Y1 >= crop14 - 2 - && decoder->InputHeight - decoder->AutoCrop->Y2 >= crop14 - 2) { + } else if (decoder->AutoCrop->Y1 >= crop14 - AutoCropTolerance + && decoder->InputHeight - decoder->AutoCrop->Y2 >= + crop14 - AutoCropTolerance) { next_state = 14; } else { next_state = 0; @@ -8362,11 +8365,12 @@ void VideoSetAudioDelay(int ms) /// /// Set auto-crop parameters. /// -void VideoSetAutoCrop(int interval, int delay) +void VideoSetAutoCrop(int interval, int delay, int tolerance) { #ifdef USE_AUTOCROP AutoCropInterval = interval; AutoCropDelay = delay; + AutoCropTolerance = tolerance; #ifdef USE_VDPAU if (VideoVdpauEnabled) { VdpauResetAutoCrop(); @@ -101,7 +101,7 @@ extern void VideoSetSharpen(int[]); extern void VideoSetAudioDelay(int); /// Set auto-crop parameters. -extern void VideoSetAutoCrop(int, int); +extern void VideoSetAutoCrop(int, int, int); /// Clear OSD. extern void VideoOsdClear(void); |