Add configurable skip lines at video top + bottom.

This commit is contained in:
Johns 2012-01-28 01:44:50 +01:00
parent 4d74ed1bfc
commit 60a7c36fa6
6 changed files with 42 additions and 16 deletions

View File

@ -1,6 +1,7 @@
User johns
Date:
Add configurable skip lines at video top and bottom.
Add auto-crop tolerance configuration.
Reduces audio latency, increases audio buffer time.
Made video_test working again.

View File

@ -139,9 +139,14 @@ Setup: /etc/vdr/setup.conf
n each 'n' frames auto-crop is checked.
softhddevice.AutoCrop.Delay = 0
if auto-crop is over after 'n' intervals the same, the cropping is
if auto-crop is over 'n' intervals the same, the cropping is
used.
softhddevice.AutoCrop.Tolerance = 0
if detected crop area is too small, cut max 'n' pixels at top and
bottom.
softhddevice.Suspend.Close = 0
1 suspend closes x11 window, connection and audio device.
(use svdrpsend plug softhddevice RESU to resume, if you have no lirc)

2
Todo
View File

@ -37,8 +37,8 @@ video:
grab image with hardware and better scaling support
suspendoutput didn't show logo or black pictures
(must detect video format to show image)
incomplete mpeg packets creates artefacts after channel switch
hard channel switch
skip line not configurable from setup menu.
vdpau:

View File

@ -77,6 +77,7 @@ static int ConfigVideoSharpen[RESOLUTIONS];
static int ConfigVideoScaling[RESOLUTIONS];
static int ConfigVideoAudioDelay; ///< config audio delay
static int ConfigVideoSkipLines; ///< config skip lines top/bottom
static int ConfigAudioPassthrough; ///< config audio pass-through
static int ConfigAutoCropInterval; ///< auto crop detection interval
@ -1203,6 +1204,10 @@ bool cPluginSoftHdDevice::SetupParse(const char *name, const char *value)
}
}
if (!strcmp(name, "SkipLines")) {
VideoSetSkipLines(ConfigVideoSkipLines = atoi(value));
return true;
}
if (!strcmp(name, "AudioDelay")) {
VideoSetAudioDelay(ConfigVideoAudioDelay = atoi(value));
return true;

40
video.c
View File

@ -259,6 +259,8 @@ static char VideoSurfaceModesChanged; ///< flag surface modes changed
/// flag use transparent OSD.
static const char VideoTransparentOsd = 1;
static int VideoSkipLines; ///< skip video lines top/bottom
/// Default deinterlace mode.
static VideoDeinterlaceModes VideoDeinterlace[VideoResolutionMax];
@ -2006,9 +2008,9 @@ static enum PixelFormat Vaapi_get_format(VaapiDecoder * decoder,
}
decoder->CropX = 0;
decoder->CropY = 0;
decoder->CropY = VideoSkipLines;
decoder->CropWidth = video_ctx->width;
decoder->CropHeight = video_ctx->height;
decoder->CropHeight = video_ctx->height - VideoSkipLines * 2;
decoder->PixFmt = video_ctx->pix_fmt;
decoder->InputWidth = video_ctx->width;
@ -2486,7 +2488,7 @@ static void VaapiAutoCrop(VaapiDecoder * decoder)
if (next_state) {
decoder->CropX = 0;
decoder->CropY = next_state == 16 ? crop16 : crop14;
decoder->CropY = (next_state == 16 ? crop16 : crop14) + VideoSkipLines;
decoder->CropWidth = decoder->InputWidth;
decoder->CropHeight = decoder->InputHeight - decoder->CropY * 2;
@ -2508,9 +2510,9 @@ static void VaapiAutoCrop(VaapiDecoder * decoder)
decoder->OutputHeight, decoder->OutputX, decoder->OutputY);
} else {
decoder->CropX = 0;
decoder->CropY = 0;
decoder->CropY = VideoSkipLines;
decoder->CropWidth = decoder->InputWidth;
decoder->CropHeight = decoder->InputHeight;
decoder->CropHeight = decoder->InputHeight - VideoSkipLines * 2;
VaapiUpdateOutput(decoder);
}
@ -3337,9 +3339,9 @@ static void VaapiRenderFrame(VaapiDecoder * decoder,
|| height != decoder->InputHeight) {
decoder->CropX = 0;
decoder->CropY = 0;
decoder->CropY = VideoSkipLines;
decoder->CropWidth = video_ctx->width;
decoder->CropHeight = video_ctx->height;
decoder->CropHeight = video_ctx->height - VideoSkipLines * 2;
decoder->PixFmt = video_ctx->pix_fmt;
decoder->InputWidth = width;
@ -5538,9 +5540,9 @@ static enum PixelFormat Vdpau_get_format(VdpauDecoder * decoder,
}
// FIXME: combine this with VdpauSetupOutput and software decoder part
decoder->CropX = 0;
decoder->CropY = 0;
decoder->CropY = VideoSkipLines;
decoder->CropWidth = video_ctx->width;
decoder->CropHeight = video_ctx->height;
decoder->CropHeight = video_ctx->height - VideoSkipLines * 2;
decoder->PixFmt = video_ctx->pix_fmt;
decoder->InputWidth = video_ctx->width;
@ -5836,7 +5838,7 @@ static void VdpauAutoCrop(VdpauDecoder * decoder)
if (next_state) {
decoder->CropX = 0;
decoder->CropY = next_state == 16 ? crop16 : crop14;
decoder->CropY = (next_state == 16 ? crop16 : crop14) + VideoSkipLines;
decoder->CropWidth = decoder->InputWidth;
decoder->CropHeight = decoder->InputHeight - decoder->CropY * 2;
@ -5858,9 +5860,9 @@ static void VdpauAutoCrop(VdpauDecoder * decoder)
decoder->OutputHeight, decoder->OutputX, decoder->OutputY);
} else {
decoder->CropX = 0;
decoder->CropY = 0;
decoder->CropY = VideoSkipLines;
decoder->CropWidth = decoder->InputWidth;
decoder->CropHeight = decoder->InputHeight;
decoder->CropHeight = decoder->InputHeight - VideoSkipLines * 2;
VdpauUpdateOutput(decoder);
}
@ -6069,9 +6071,9 @@ static void VdpauRenderFrame(VdpauDecoder * decoder,
|| video_ctx->height != decoder->InputHeight) {
decoder->CropX = 0;
decoder->CropY = 0;
decoder->CropY = VideoSkipLines;
decoder->CropWidth = video_ctx->width;
decoder->CropHeight = video_ctx->height;
decoder->CropHeight = video_ctx->height - VideoSkipLines * 2;
decoder->PixFmt = video_ctx->pix_fmt;
decoder->InputWidth = video_ctx->width;
@ -8352,6 +8354,16 @@ void VideoSetScaling(int mode[VideoResolutionMax])
VideoSurfaceModesChanged = 1;
}
///
/// Set skip lines.
///
/// @param lines lines in pixel
///
void VideoSetSkipLines(int lines)
{
VideoSkipLines = lines;
}
///
/// Set audio delay.
///

View File

@ -97,6 +97,9 @@ extern void VideoSetDenoise(int[]);
/// Set sharpen.
extern void VideoSetSharpen(int[]);
/// Set skip lines.
extern void VideoSetSkipLines(int);
/// Set audio delay.
extern void VideoSetAudioDelay(int);