Commit 44b579d6 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

V4L/DVB (4548): Better temporal filter handling.

Adjust temporal filter if necessary. The problem with the temporal
filter is that it works well with full resolution capturing, but
not when the capture window is scaled (the filter introduces
a ghosting effect). So if the capture window changed, and there is
no updated filter value, then the filter is set depending on whether
the new window is full resolution or not.
For full resolution a setting of 8 really improves the video
quality, especially if the original video quality is suboptimal. 
Also report VBI Format in VIDIOC_LOG_STATUS, it was missing.
Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 29900661
...@@ -691,7 +691,7 @@ void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p) ...@@ -691,7 +691,7 @@ void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p)
.video_luma_spatial_filter_type = V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR, .video_luma_spatial_filter_type = V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR,
.video_chroma_spatial_filter_type = V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR, .video_chroma_spatial_filter_type = V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR,
.video_temporal_filter_mode = V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL, .video_temporal_filter_mode = V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL,
.video_temporal_filter = 0, .video_temporal_filter = 8,
.video_median_filter_type = V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF, .video_median_filter_type = V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF,
.video_luma_median_filter_top = 255, .video_luma_median_filter_top = 255,
.video_luma_median_filter_bottom = 0, .video_luma_median_filter_bottom = 0,
...@@ -731,6 +731,7 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func, ...@@ -731,6 +731,7 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func,
}; };
int err = 0; int err = 0;
u16 temporal = new->video_temporal_filter;
cx2341x_api(priv, func, CX2341X_ENC_SET_OUTPUT_PORT, 2, new->port, 0); cx2341x_api(priv, func, CX2341X_ENC_SET_OUTPUT_PORT, 2, new->port, 0);
...@@ -741,6 +742,7 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func, ...@@ -741,6 +742,7 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func,
if (old == NULL || old->width != new->width || old->height != new->height || if (old == NULL || old->width != new->width || old->height != new->height ||
old->video_encoding != new->video_encoding) { old->video_encoding != new->video_encoding) {
int is_scaling;
u16 w = new->width; u16 w = new->width;
u16 h = new->height; u16 h = new->height;
...@@ -750,6 +752,20 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func, ...@@ -750,6 +752,20 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func,
} }
err = cx2341x_api(priv, func, CX2341X_ENC_SET_FRAME_SIZE, 2, h, w); err = cx2341x_api(priv, func, CX2341X_ENC_SET_FRAME_SIZE, 2, h, w);
if (err) return err; if (err) return err;
/* Adjust temporal filter if necessary. The problem with the temporal
filter is that it works well with full resolution capturing, but
not when the capture window is scaled (the filter introduces
a ghosting effect). So if the capture window changed, and there is
no updated filter value, then the filter is set depending on whether
the new window is full resolution or not.
For full resolution a setting of 8 really improves the video
quality, especially if the original video quality is suboptimal. */
is_scaling = new->width != 720 || new->height != (new->is_50hz ? 576 : 480);
if (old && old->video_temporal_filter == temporal) {
temporal = is_scaling ? 0 : 8;
}
} }
if (old == NULL || old->stream_type != new->stream_type) { if (old == NULL || old->stream_type != new->stream_type) {
...@@ -815,9 +831,9 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func, ...@@ -815,9 +831,9 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func,
} }
if (old == NULL || if (old == NULL ||
old->video_spatial_filter != new->video_spatial_filter || old->video_spatial_filter != new->video_spatial_filter ||
old->video_temporal_filter != new->video_temporal_filter) { old->video_temporal_filter != temporal) {
err = cx2341x_api(priv, func, CX2341X_ENC_SET_DNR_FILTER_PROPS, 2, err = cx2341x_api(priv, func, CX2341X_ENC_SET_DNR_FILTER_PROPS, 2,
new->video_spatial_filter, new->video_temporal_filter); new->video_spatial_filter, temporal);
if (err) return err; if (err) return err;
} }
if (old == NULL || old->video_temporal_decimation != new->video_temporal_decimation) { if (old == NULL || old->video_temporal_decimation != new->video_temporal_decimation) {
...@@ -855,6 +871,9 @@ void cx2341x_log_status(struct cx2341x_mpeg_params *p, const char *prefix) ...@@ -855,6 +871,9 @@ void cx2341x_log_status(struct cx2341x_mpeg_params *p, const char *prefix)
printk(KERN_INFO "%s: Stream: %s\n", printk(KERN_INFO "%s: Stream: %s\n",
prefix, prefix,
cx2341x_menu_item(p, V4L2_CID_MPEG_STREAM_TYPE)); cx2341x_menu_item(p, V4L2_CID_MPEG_STREAM_TYPE));
printk(KERN_INFO "%s: VBI Format: %s\n",
prefix,
cx2341x_menu_item(p, V4L2_CID_MPEG_STREAM_VBI_FMT));
/* Video */ /* Video */
printk(KERN_INFO "%s: Video: %dx%d, %d fps\n", printk(KERN_INFO "%s: Video: %dx%d, %d fps\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment