Cutting pixels configured for each resolution.

This commit is contained in:
CafeDelMar 2012-04-05 22:51:20 +02:00 committed by Johns
parent c986d285ea
commit ac2e10a308
5 changed files with 121 additions and 77 deletions

View File

@ -2,6 +2,15 @@ User johns
Date:
Release Version 0.5.0
User: CafeDelMar
Date: Thu Apr 5 22:44:06 CEST 2012
Cutting pixels are now configured for each resolution.
User johns
Date: Thu Apr 5 15:47:59 CEST 2012
Buffer less video and audio.
Fix 100% cpu use, with mp3 plugin.
Audio/Video sync rewrite, trick-speed support moved to video.

View File

@ -138,6 +138,12 @@ Setup: /etc/vdr/setup.conf
-1000 .. 1000 noise reduction level (0 off, -1000 max blur,
1000 max sharp)
softhddevice.<res>.CutTopBottom = 0
Cut 'n' pixels at at top and bottom of the video picture.
softhddevice.<res>.CutLeftRight = 0
Cut 'n' pixels at at left and right of the video picture.
softhddevice.AudioDelay = 0
+n or -n ms
delay audio or delay video
@ -171,12 +177,6 @@ Setup: /etc/vdr/setup.conf
in the setup menu this is entered as (24bit RGB and 8bit Alpha)
(Red * 65536 + Green * 256 + Blue)
softhddevice.SkipLines = 0
skip 'n' lines at top and bottom of the video picture.
softhddevice.SkipPixels = 0
skip 'n' pixels at left and right of the video picture.
softhddevice.StudioLevels = 0
0 use PC levels (0-255) with vdpau.
1 use studio levels (16-235) with vdpau.

View File

@ -77,8 +77,6 @@ static char ConfigMakePrimary; ///< config primary wanted
static char ConfigHideMainMenuEntry; ///< config hide main menu entry
static uint32_t ConfigVideoBackground; ///< config video background color
static int ConfigVideoSkipLines; ///< config skip lines top/bottom
static int ConfigVideoSkipPixels; ///< config skip pixels left/right
static char ConfigVideoStudioLevels; ///< config use studio levels
static char ConfigVideo60HzMode; ///< config use 60Hz display mode
static char ConfigVideoSoftStartSync; ///< config use softstart sync
@ -101,6 +99,12 @@ static int ConfigVideoSharpen[RESOLUTIONS];
/// config scaling
static int ConfigVideoScaling[RESOLUTIONS];
/// config cut top and bottom pixels
static int ConfigVideoCutTopBottom[RESOLUTIONS];
/// config cut left and right pixels
static int ConfigVideoCutLeftRight[RESOLUTIONS];
static int ConfigVideoAudioDelay; ///< config audio delay
static int ConfigAudioPassthrough; ///< config audio pass-through
static int ConfigAudioDownmix; ///< config audio downmix
@ -469,8 +473,6 @@ class cMenuSetupSoft:public cMenuSetupPage
int HideMainMenuEntry;
uint32_t Background;
uint32_t BackgroundAlpha;
int SkipLines;
int SkipPixels;
int StudioLevels;
int _60HzMode;
int SoftStartSync;
@ -480,6 +482,8 @@ class cMenuSetupSoft:public cMenuSetupPage
int InverseTelecine[RESOLUTIONS];
int Denoise[RESOLUTIONS];
int Sharpen[RESOLUTIONS];
int CutTopBottom[RESOLUTIONS];
int CutLeftRight[RESOLUTIONS];
int AudioDelay;
int AudioPassthrough;
int AudioDownmix;
@ -550,12 +554,6 @@ cMenuSetupSoft::cMenuSetupSoft(void)
(int *)&Background, 0, 0x00FFFFFF));
Add(new cMenuEditIntItem(tr("video background color (Alpha)"),
(int *)&BackgroundAlpha, 0, 0xFF));
SkipLines = ConfigVideoSkipLines;
Add(new cMenuEditIntItem(tr("Skip lines top+bot (pixel)"), &SkipLines, 0,
64));
SkipPixels = ConfigVideoSkipPixels;
Add(new cMenuEditIntItem(tr("Skip pixels left+right (pixel)"), &SkipPixels,
0, 64));
StudioLevels = ConfigVideoStudioLevels;
Add(new cMenuEditBoolItem(tr("Use studio levels (vdpau only)"),
&StudioLevels, trVDR("no"), trVDR("yes")));
@ -585,6 +583,13 @@ cMenuSetupSoft::cMenuSetupSoft(void)
Sharpen[i] = ConfigVideoSharpen[i];
Add(new cMenuEditIntItem(tr("Sharpen (-1000..1000) (vdpau)"),
&Sharpen[i], -1000, 1000, tr("blur max"), tr("sharpen max")));
CutTopBottom[i] = ConfigVideoCutTopBottom[i];
Add(new cMenuEditIntItem(tr("Cut top and bottom (pixel)"),
&CutTopBottom[i], 0, 250));
CutLeftRight[i] = ConfigVideoCutLeftRight[i];
Add(new cMenuEditIntItem(tr("Cut left and right (pixel)"),
&CutLeftRight[i], 0, 250));
}
//
// audio
@ -638,10 +643,6 @@ void cMenuSetupSoft::Store(void)
ConfigVideoBackground = Background << 8 | (BackgroundAlpha & 0xFF);
SetupStore("Background", ConfigVideoBackground);
VideoSetBackground(ConfigVideoBackground);
SetupStore("SkipLines", ConfigVideoSkipLines = SkipLines);
VideoSetSkipLines(ConfigVideoSkipLines);
SetupStore("SkipPixels", ConfigVideoSkipPixels = SkipPixels);
VideoSetSkipPixels(ConfigVideoSkipPixels);
SetupStore("StudioLevels", ConfigVideoStudioLevels = StudioLevels);
VideoSetStudioLevels(ConfigVideoStudioLevels);
SetupStore("60HzMode", ConfigVideo60HzMode = _60HzMode);
@ -666,6 +667,11 @@ void cMenuSetupSoft::Store(void)
SetupStore(buf, ConfigVideoDenoise[i] = Denoise[i]);
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "Sharpen");
SetupStore(buf, ConfigVideoSharpen[i] = Sharpen[i]);
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "CutTopBottom");
SetupStore(buf, ConfigVideoCutTopBottom[i] = CutTopBottom[i]);
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "CutLeftRight");
SetupStore(buf, ConfigVideoCutLeftRight[i] = CutLeftRight[i]);
}
VideoSetScaling(ConfigVideoScaling);
VideoSetDeinterlace(ConfigVideoDeinterlace);
@ -673,6 +679,8 @@ void cMenuSetupSoft::Store(void)
VideoSetInverseTelecine(ConfigVideoInverseTelecine);
VideoSetDenoise(ConfigVideoDenoise);
VideoSetSharpen(ConfigVideoSharpen);
VideoSetCutTopBottom(ConfigVideoCutTopBottom);
VideoSetCutLeftRight(ConfigVideoCutLeftRight);
SetupStore("AudioDelay", ConfigVideoAudioDelay = AudioDelay);
VideoSetAudioDelay(ConfigVideoAudioDelay);
@ -1606,14 +1614,6 @@ bool cPluginSoftHdDevice::SetupParse(const char *name, const char *value)
VideoSetBackground(ConfigVideoBackground = strtoul(value, NULL, 0));
return true;
}
if (!strcasecmp(name, "SkipLines")) {
VideoSetSkipLines(ConfigVideoSkipLines = atoi(value));
return true;
}
if (!strcasecmp(name, "SkipPixels")) {
VideoSetSkipPixels(ConfigVideoSkipPixels = atoi(value));
return true;
}
if (!strcasecmp(name, "StudioLevels")) {
VideoSetStudioLevels(ConfigVideoStudioLevels = atoi(value));
return true;
@ -1666,6 +1666,19 @@ bool cPluginSoftHdDevice::SetupParse(const char *name, const char *value)
VideoSetSharpen(ConfigVideoSharpen);
return true;
}
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "CutTopBottom");
if (!strcasecmp(name, buf)) {
ConfigVideoCutTopBottom[i] = atoi(value);
VideoSetCutTopBottom(ConfigVideoCutTopBottom);
return true;
}
snprintf(buf, sizeof(buf), "%s.%s", Resolution[i], "CutLeftRight");
if (!strcasecmp(name, buf)) {
ConfigVideoCutLeftRight[i] = atoi(value);
VideoSetCutLeftRight(ConfigVideoCutLeftRight);
return true;
}
}
if (!strcasecmp(name, "AudioDelay")) {

112
video.c
View File

@ -304,8 +304,6 @@ static char VideoSurfaceModesChanged; ///< flag surface modes changed
static const char VideoTransparentOsd = 1;
static uint32_t VideoBackground; ///< video background color
static int VideoSkipLines; ///< skip video lines top/bottom
static int VideoSkipPixels; ///< skip video pixels left/right
static char VideoStudioLevels; ///< flag use studio levels
/// Default deinterlace mode.
@ -323,9 +321,15 @@ static char VideoInverseTelecine[VideoResolutionMax];
/// Default amount of noise reduction algorithm to apply (0 .. 1000).
static int VideoDenoise[VideoResolutionMax];
/// Default amount of of sharpening, or blurring, to apply (-1000 .. 1000).
/// Default amount of sharpening, or blurring, to apply (-1000 .. 1000).
static int VideoSharpen[VideoResolutionMax];
/// Default cut top and bottom in pixels
static int VideoCutTopBottom[VideoResolutionMax];
/// Default cut left and right in pixels
static int VideoCutLeftRight[VideoResolutionMax];
/// Color space ITU-R BT.601, ITU-R BT.709, ...
static const VideoColorSpace VideoColorSpaces[VideoResolutionMax] = {
VideoColorSpaceBt601, VideoColorSpaceBt709, VideoColorSpaceBt709,
@ -438,9 +442,9 @@ static void VideoSetPts(int64_t * pts_p, int interlaced, const AVFrame * frame)
/// @param input_aspect_ratio video stream aspect
///
static void VideoUpdateOutput(AVRational input_aspect_ratio, int input_width,
int input_height, int *output_x, int *output_y, int *output_width,
int *output_height, int *crop_x, int *crop_y, int *crop_width,
int *crop_height)
int input_height, VideoResolutions resolution, int *output_x,
int *output_y, int *output_width, int *output_height, int *crop_x,
int *crop_y, int *crop_width, int *crop_height)
{
AVRational display_aspect_ratio;
@ -464,10 +468,10 @@ static void VideoUpdateOutput(AVRational input_aspect_ratio, int input_width,
Debug(3, "video: aspect %d:%d\n", display_aspect_ratio.num,
display_aspect_ratio.den);
*crop_x = VideoSkipPixels;
*crop_y = VideoSkipLines;
*crop_width = input_width - VideoSkipPixels * 2;
*crop_height = input_height - VideoSkipLines * 2;
*crop_x = VideoCutLeftRight[resolution];
*crop_y = VideoCutTopBottom[resolution];
*crop_width = input_width - VideoCutLeftRight[resolution] * 2;
*crop_height = input_height - VideoCutTopBottom[resolution] * 2;
// FIXME: store different positions for the ratios
if (display_aspect_ratio.num == 4 && display_aspect_ratio.den == 3) {
@ -525,14 +529,14 @@ static void VideoUpdateOutput(AVRational input_aspect_ratio, int input_width,
if ((unsigned)*crop_width > VideoWindowWidth) {
*crop_height = input_height;
// adjust scaiing
// adjust scaling
*crop_x = ((*crop_width - (signed)VideoWindowWidth) * input_width)
/ (2 * VideoWindowWidth);
*crop_width = input_width - *crop_x * 2;
} else if ((unsigned)*crop_height > VideoWindowHeight) {
*crop_width = input_width;
// adjust scaiing
// adjust scaling
*crop_y = ((*crop_height - (signed)VideoWindowHeight) * input_height)
/ (2 * VideoWindowHeight);
*crop_height = input_height - *crop_y * 2;
@ -2155,9 +2159,10 @@ static void VaapiExit(void)
static void VaapiUpdateOutput(VaapiDecoder * decoder)
{
VideoUpdateOutput(decoder->InputAspect, decoder->InputWidth,
decoder->InputHeight, &decoder->OutputX, &decoder->OutputY,
&decoder->OutputWidth, &decoder->OutputHeight, &decoder->CropX,
&decoder->CropY, &decoder->CropWidth, &decoder->CropHeight);
decoder->InputHeight, decoder->Resolution, &decoder->OutputX,
&decoder->OutputY, &decoder->OutputWidth, &decoder->OutputHeight,
&decoder->CropX, &decoder->CropY, &decoder->CropWidth,
&decoder->CropHeight);
#ifdef USE_AUTOCROP
decoder->AutoCrop->State = 0;
decoder->AutoCrop->Count = AutoCropDelay;
@ -2900,9 +2905,11 @@ static void VaapiAutoCrop(VaapiDecoder * decoder)
decoder->AutoCrop->State = next_state;
if (next_state) {
decoder->CropX = VideoSkipPixels;
decoder->CropY = (next_state == 16 ? crop16 : crop14) + VideoSkipLines;
decoder->CropWidth = decoder->InputWidth;
decoder->CropX = VideoCutLeftRight[decoder->Resolution];
decoder->CropY =
(next_state ==
16 ? crop16 : crop14) + VideoCutTopBottom[decoder->Resolution];
decoder->CropWidth = decoder->InputWidth - decoder->CropX * 2;
decoder->CropHeight = decoder->InputHeight - decoder->CropY * 2;
// FIXME: this overwrites user choosen output position
@ -4518,7 +4525,7 @@ static void VaapiSyncDecoder(VaapiDecoder * decoder)
}
}
#endif
return;
return; // fix gcc bug!
}
///
@ -6326,9 +6333,10 @@ static void VdpauExit(void)
static void VdpauUpdateOutput(VdpauDecoder * decoder)
{
VideoUpdateOutput(decoder->InputAspect, decoder->InputWidth,
decoder->InputHeight, &decoder->OutputX, &decoder->OutputY,
&decoder->OutputWidth, &decoder->OutputHeight, &decoder->CropX,
&decoder->CropY, &decoder->CropWidth, &decoder->CropHeight);
decoder->InputHeight, decoder->Resolution, &decoder->OutputX,
&decoder->OutputY, &decoder->OutputWidth, &decoder->OutputHeight,
&decoder->CropX, &decoder->CropY, &decoder->CropWidth,
&decoder->CropHeight);
#ifdef USE_AUTOCROP
decoder->AutoCrop->State = 0;
decoder->AutoCrop->Count = AutoCropDelay;
@ -6543,10 +6551,12 @@ static enum PixelFormat Vdpau_get_format(VdpauDecoder * decoder,
goto slow_path;
}
// FIXME: combine this with VdpauSetupOutput and software decoder part
decoder->CropX = VideoSkipPixels;
decoder->CropY = VideoSkipLines;
decoder->CropWidth = video_ctx->width - VideoSkipPixels * 2;
decoder->CropHeight = video_ctx->height - VideoSkipLines * 2;
decoder->CropX = VideoCutLeftRight[decoder->Resolution];
decoder->CropY = VideoCutTopBottom[decoder->Resolution];
decoder->CropWidth =
video_ctx->width - VideoCutLeftRight[decoder->Resolution] * 2;
decoder->CropHeight =
video_ctx->height - VideoCutTopBottom[decoder->Resolution] * 2;
decoder->PixFmt = *fmt_idx;
decoder->InputWidth = video_ctx->width;
@ -6847,9 +6857,11 @@ static void VdpauAutoCrop(VdpauDecoder * decoder)
decoder->AutoCrop->State = next_state;
if (next_state) {
decoder->CropX = VideoSkipPixels;
decoder->CropY = (next_state == 16 ? crop16 : crop14) + VideoSkipLines;
decoder->CropWidth = decoder->InputWidth;
decoder->CropX = VideoCutLeftRight[decoder->Resolution];
decoder->CropY =
(next_state ==
16 ? crop16 : crop14) + VideoCutTopBottom[decoder->Resolution];
decoder->CropWidth = decoder->InputWidth - decoder->CropX * 2;
decoder->CropHeight = decoder->InputHeight - decoder->CropY * 2;
// FIXME: this overwrites user choosen output position
@ -6870,10 +6882,12 @@ static void VdpauAutoCrop(VdpauDecoder * decoder)
decoder->InputWidth, decoder->InputHeight, decoder->OutputWidth,
decoder->OutputHeight, decoder->OutputX, decoder->OutputY);
} else {
decoder->CropX = VideoSkipPixels;
decoder->CropY = VideoSkipLines;
decoder->CropWidth = decoder->InputWidth - VideoSkipPixels * 2;
decoder->CropHeight = decoder->InputHeight - VideoSkipLines * 2;
decoder->CropX = VideoCutLeftRight[decoder->Resolution];
decoder->CropY = VideoCutTopBottom[decoder->Resolution];
decoder->CropWidth =
decoder->InputWidth - VideoCutLeftRight[decoder->Resolution] * 2;
decoder->CropHeight =
decoder->InputHeight - VideoCutTopBottom[decoder->Resolution] * 2;
// sets AutoCrop->Count
VdpauUpdateOutput(decoder);
@ -7082,10 +7096,12 @@ static void VdpauRenderFrame(VdpauDecoder * decoder,
|| video_ctx->width != decoder->InputWidth
|| video_ctx->height != decoder->InputHeight) {
decoder->CropX = VideoSkipPixels;
decoder->CropY = VideoSkipLines;
decoder->CropWidth = video_ctx->width - VideoSkipPixels * 2;
decoder->CropHeight = video_ctx->height - VideoSkipLines * 2;
decoder->CropX = VideoCutLeftRight[decoder->Resolution];
decoder->CropY = VideoCutTopBottom[decoder->Resolution];
decoder->CropWidth =
video_ctx->width - VideoCutLeftRight[decoder->Resolution] * 2;
decoder->CropHeight =
video_ctx->height - VideoCutTopBottom[decoder->Resolution] * 2;
decoder->PixFmt = video_ctx->pix_fmt;
decoder->InputWidth = video_ctx->width;
@ -9708,23 +9724,29 @@ void VideoSetScaling(int mode[VideoResolutionMax])
}
///
/// Set skip lines.
/// Set cut top and bottom.
///
/// @param lines lines in pixel
/// @param pixels table with VideoResolutionMax values
///
void VideoSetSkipLines(int lines)
void VideoSetCutTopBottom(int pixels[VideoResolutionMax])
{
VideoSkipLines = lines;
VideoCutTopBottom[0] = pixels[0];
VideoCutTopBottom[1] = pixels[1];
VideoCutTopBottom[2] = pixels[2];
VideoCutTopBottom[3] = pixels[3];
}
///
/// Set skip pixels.
/// Set cut left and right.
///
/// @param pixels pixels in pixel
/// @param pixels table with VideoResolutionMax values
///
void VideoSetSkipPixels(int pixels)
void VideoSetCutLeftRight(int pixels[VideoResolutionMax])
{
VideoSkipPixels = pixels;
VideoCutLeftRight[0] = pixels[0];
VideoCutLeftRight[1] = pixels[1];
VideoCutLeftRight[2] = pixels[2];
VideoCutLeftRight[3] = pixels[3];
}
///

View File

@ -119,11 +119,11 @@ extern void VideoSetDenoise(int[]);
/// Set sharpen.
extern void VideoSetSharpen(int[]);
/// Set skip lines.
extern void VideoSetSkipLines(int);
/// Set cut top and bottom.
extern void VideoSetCutTopBottom(int[]);
/// Set skip pixels.
extern void VideoSetSkipPixels(int);
/// Set cut left and right.
extern void VideoSetCutLeftRight(int[]);
/// Set studio levels.
extern void VideoSetStudioLevels(int);