summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--video.c194
2 files changed, 121 insertions, 76 deletions
diff --git a/ChangeLog b/ChangeLog
index 0f3112f..e529fd5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
User johns
Date:
+ Release Version 0.3.6
+ Fix bug: Used VideoSharpen for denoise settings.
+ Instant update deinterlace/... configuration changes.
Fix bug: AudioExit called without AudioInit crash.
Date: Thu Jan 19 15:58:40 CET 2012
diff --git a/video.c b/video.c
index d6d4ccb..024db4c 100644
--- a/video.c
+++ b/video.c
@@ -230,14 +230,20 @@ static char VideoHardwareDecoder; ///< flag use hardware decoder
static char VideoSurfaceModesChanged; ///< flag surface modes changed
+ /// flag use transparent OSD.
+static const char VideoTransparentOsd = 1;
+
/// Default deinterlace mode.
static VideoDeinterlaceModes VideoDeinterlace[VideoResolutionMax];
/// Default number of deinterlace surfaces
static const int VideoDeinterlaceSurfaces = 4;
- /// Default skip chroma deinterlace flag (VDPAU only)
-static int VideoSkipChromaDeinterlace[VideoResolutionMax];
+ /// Default Inverse telecine flag (VDPAU only).
+static char VideoInverseTelecine[VideoResolutionMax];
+
+ /// Default skip chroma deinterlace flag (VDPAU only).
+static char VideoSkipChromaDeinterlace[VideoResolutionMax];
/// Default amount of noise reduction algorithm to apply (0 .. 1000).
static int VideoDenoise[VideoResolutionMax];
@@ -3997,80 +4003,24 @@ static void VdpauMixerSetup(VdpauDecoder * decoder)
VdpVideoMixerFeature features[15];
VdpBool enables[15];
int feature_n;
- VdpVideoMixerParameter paramaters[4];
- void const *value_ptrs[4];
- int parameter_n;
VdpVideoMixerAttribute attributes[4];
void const *attribute_value_ptrs[4];
int attribute_n;
uint8_t skip_chroma_value;
float noise_reduction_level;
float sharpness_level;
- VdpChromaType chroma_type;
- int layers;
VdpColorStandard color_standard;
VdpCSCMatrix csc_matrix[1];
//
- // Build feature table
- //
- feature_n = 0;
- if (VdpauTemporal) {
- features[feature_n++] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL;
- }
- if (VdpauTemporalSpatial) {
- features[feature_n++] =
- VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL;
- }
- if (VdpauInverseTelecine) {
- features[feature_n++] = VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE;
- }
- if (VdpauNoiseReduction) {
- features[feature_n++] = VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION;
- }
- if (VdpauSharpness) {
- features[feature_n++] = VDP_VIDEO_MIXER_FEATURE_SHARPNESS;
- }
- for (i = VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1;
- i <= VdpauHqScalingMax; ++i) {
- features[feature_n++] = i;
- }
-
- decoder->ChromaType = chroma_type = VDP_CHROMA_TYPE_420;
- // FIXME: use best chroma
-
- //
- // Setup parameter/value tables
- //
- paramaters[0] = VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH;
- value_ptrs[0] = &decoder->InputWidth;
- paramaters[1] = VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT;
- value_ptrs[1] = &decoder->InputHeight;
- paramaters[2] = VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE;
- value_ptrs[2] = &chroma_type;
- layers = 0;
- paramaters[3] = VDP_VIDEO_MIXER_PARAMETER_LAYERS;
- value_ptrs[3] = &layers;
- parameter_n = 4;
-
- status =
- VdpauVideoMixerCreate(VdpauDevice, feature_n, features, parameter_n,
- paramaters, value_ptrs, &decoder->VideoMixer);
- if (status != VDP_STATUS_OK) {
- Fatal(_("video/vdpau: can't create video mixer: %s\n"),
- VdpauGetErrorString(status));
- // FIXME: no fatal errors
- }
- //
- // Build default enables table
+ // Build enables table
//
feature_n = 0;
if (VdpauTemporal) {
enables[feature_n] =
(VideoDeinterlace[decoder->Resolution] == VideoDeinterlaceTemporal
- || (VideoDeinterlace[decoder->Resolution] ==
- VideoDeinterlaceTemporalSpatial
- && !VdpauTemporalSpatial)) ? VDP_TRUE : VDP_FALSE;
+ || VideoDeinterlace[decoder->Resolution] ==
+ VideoDeinterlaceTemporalSpatial) ? VDP_TRUE : VDP_FALSE;
features[feature_n++] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL;
Debug(3, "video/vdpau: temporal deinterlace %s\n",
enables[feature_n - 1] ? "enabled" : "disabled");
@@ -4085,7 +4035,8 @@ static void VdpauMixerSetup(VdpauDecoder * decoder)
enables[feature_n - 1] ? "enabled" : "disabled");
}
if (VdpauInverseTelecine) {
- enables[feature_n] = VDP_FALSE;
+ enables[feature_n] =
+ VideoInverseTelecine[decoder->Resolution] ? VDP_TRUE : VDP_FALSE;
features[feature_n++] = VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE;
Debug(3, "video/vdpau: inverse telecine %s\n",
enables[feature_n - 1] ? "enabled" : "disabled");
@@ -4114,10 +4065,13 @@ static void VdpauMixerSetup(VdpauDecoder * decoder)
1 + i - VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1,
enables[feature_n - 1] ? "enabled" : "disabled");
}
- VdpauVideoMixerSetFeatureEnables(decoder->VideoMixer, feature_n, features,
- enables);
- // FIXME: check status
-
+ status =
+ VdpauVideoMixerSetFeatureEnables(decoder->VideoMixer, feature_n,
+ features, enables);
+ if (status != VDP_STATUS_OK) {
+ Error(_("video/vdpau: can't set mixer feature enables: %s\n"),
+ VdpauGetErrorString(status));
+ }
//
// build attributes table
//
@@ -4151,7 +4105,7 @@ static void VdpauMixerSetup(VdpauDecoder * decoder)
attribute_value_ptrs[attribute_n++] = &sharpness_level;
Debug(3, "video/vdpau: sharpness level %+1.3f\n", sharpness_level);
}
-
+ // FIXME: studio colors, VideoColorStandard[decoder->Resolution]
if (decoder->InputWidth > 1280 || decoder->InputHeight > 576) {
// HDTV
color_standard = VDP_COLOR_STANDARD_ITUR_BT_709;
@@ -4172,9 +4126,87 @@ static void VdpauMixerSetup(VdpauDecoder * decoder)
attributes[attribute_n] = VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX;
attribute_value_ptrs[attribute_n++] = csc_matrix;
- VdpauVideoMixerSetAttributeValues(decoder->VideoMixer, attribute_n,
+ status =
+ VdpauVideoMixerSetAttributeValues(decoder->VideoMixer, attribute_n,
attributes, attribute_value_ptrs);
- // FIXME: check status
+ if (status != VDP_STATUS_OK) {
+ Error(_("video/vdpau: can't set mixer attribute values: %s\n"),
+ VdpauGetErrorString(status));
+ }
+}
+
+///
+/// Create and setup VDPAU mixer.
+///
+/// @param decoder VDPAU hw decoder
+///
+/// @note don't forget to update features, paramaters, attributes table
+/// size, if more is add.
+///
+static void VdpauMixerCreate(VdpauDecoder * decoder)
+{
+ VdpStatus status;
+ int i;
+ VdpVideoMixerFeature features[15];
+ int feature_n;
+ VdpVideoMixerParameter paramaters[4];
+ void const *value_ptrs[4];
+ int parameter_n;
+ VdpChromaType chroma_type;
+ int layers;
+
+ //
+ // Build feature table
+ //
+ feature_n = 0;
+ if (VdpauTemporal) {
+ features[feature_n++] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL;
+ }
+ if (VdpauTemporalSpatial) {
+ features[feature_n++] =
+ VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL;
+ }
+ if (VdpauInverseTelecine) {
+ features[feature_n++] = VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE;
+ }
+ if (VdpauNoiseReduction) {
+ features[feature_n++] = VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION;
+ }
+ if (VdpauSharpness) {
+ features[feature_n++] = VDP_VIDEO_MIXER_FEATURE_SHARPNESS;
+ }
+ for (i = VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1;
+ i <= VdpauHqScalingMax; ++i) {
+ features[feature_n++] = i;
+ }
+
+ decoder->ChromaType = chroma_type = VDP_CHROMA_TYPE_420;
+ // FIXME: use best chroma
+
+ //
+ // Setup parameter/value tables
+ //
+ paramaters[0] = VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH;
+ value_ptrs[0] = &decoder->InputWidth;
+ paramaters[1] = VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT;
+ value_ptrs[1] = &decoder->InputHeight;
+ paramaters[2] = VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE;
+ value_ptrs[2] = &chroma_type;
+ layers = 0;
+ paramaters[3] = VDP_VIDEO_MIXER_PARAMETER_LAYERS;
+ value_ptrs[3] = &layers;
+ parameter_n = 4;
+
+ status =
+ VdpauVideoMixerCreate(VdpauDevice, feature_n, features, parameter_n,
+ paramaters, value_ptrs, &decoder->VideoMixer);
+ if (status != VDP_STATUS_OK) {
+ Fatal(_("video/vdpau: can't create video mixer: %s\n"),
+ VdpauGetErrorString(status));
+ // FIXME: no fatal errors
+ }
+
+ VdpauMixerSetup(decoder);
}
///
@@ -5074,7 +5106,7 @@ static enum PixelFormat Vdpau_get_format(VdpauDecoder * decoder,
decoder->Interlaced);
VdpauCreateSurfaces(decoder, video_ctx->width, video_ctx->height);
- VdpauMixerSetup(decoder);
+ VdpauMixerCreate(decoder);
Debug(3, "\t%#010x %s\n", fmt_idx[0], av_get_pix_fmt_name(fmt_idx[0]));
@@ -5108,7 +5140,7 @@ static void VdpauSetup(VdpauDecoder * decoder,
decoder->Interlaced);
VdpauCreateSurfaces(decoder, video_ctx->width, video_ctx->height);
- VdpauMixerSetup(decoder);
+ VdpauMixerCreate(decoder);
// get real surface size
status =
@@ -5477,7 +5509,8 @@ static void VdpauMixOsd(void)
VdpauOutputSurfaceRenderBitmapSurface(VdpauSurfacesRb
[VdpauSurfaceIndex], &output_rect,
VdpauOsdBitmapSurface[!VdpauOsdSurfaceIndex], &source_rect, NULL,
- &blend_state, VDP_OUTPUT_SURFACE_RENDER_ROTATE_0);
+ VideoTransparentOsd ? &blend_state : NULL,
+ VDP_OUTPUT_SURFACE_RENDER_ROTATE_0);
if (status != VDP_STATUS_OK) {
Error(_("video/vdpau: can't render bitmap surface: %s\n"),
VdpauGetErrorString(status));
@@ -5487,7 +5520,8 @@ static void VdpauMixOsd(void)
VdpauOutputSurfaceRenderOutputSurface(VdpauSurfacesRb
[VdpauSurfaceIndex], &output_rect,
VdpauOsdOutputSurface[!VdpauOsdSurfaceIndex], &source_rect, NULL,
- &blend_state, VDP_OUTPUT_SURFACE_RENDER_ROTATE_0);
+ VideoTransparentOsd ? &blend_state : NULL,
+ VDP_OUTPUT_SURFACE_RENDER_ROTATE_0);
if (status != VDP_STATUS_OK) {
Error(_("video/vdpau: can't render output surface: %s\n"),
VdpauGetErrorString(status));
@@ -5733,6 +5767,12 @@ static void VdpauDisplayFrame(void)
static VdpTime last_time;
int i;
+ if (VideoSurfaceModesChanged) { // handle changed modes
+ for (i = 0; i < VdpauDecoderN; ++i) {
+ VdpauMixerSetup(VdpauDecoders[i]);
+ }
+ VideoSurfaceModesChanged = 0;
+ }
//
// wait for surface visible (blocks max ~5ms)
//
@@ -7399,9 +7439,9 @@ void VideoSetSkipChromaDeinterlace(int onoff[VideoResolutionMax])
void VideoSetDenoise(int level[VideoResolutionMax])
{
VideoDenoise[0] = level[0];
- VideoSharpen[1] = level[1];
- VideoSharpen[2] = level[2];
- VideoSharpen[3] = level[3];
+ VideoDenoise[1] = level[1];
+ VideoDenoise[2] = level[2];
+ VideoDenoise[3] = level[3];
VideoSurfaceModesChanged = 1;
}
@@ -7420,6 +7460,8 @@ void VideoSetSharpen(int level[VideoResolutionMax])
///
/// Set scaling mode.
///
+/// @param mode table with VideoResolutionMax values
+///
void VideoSetScaling(int mode[VideoResolutionMax])
{
VideoScaling[0] = mode[0];