aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2006-08-27 18:22:15 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-09-26 11:30:34 -0400
commit44b579d63678609a16265a0acdb6405fafd173d6 (patch)
treef93c5a55b6761b7afab62f6f828b06fe48d7c441 /drivers
parent299006612a811ba5acc92e2686f2e8b8bc10d4b7 (diff)
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: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/cx2341x.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/drivers/media/video/cx2341x.c b/drivers/media/video/cx2341x.c
index 65f00fc08fa..657e0b96914 100644
--- a/drivers/media/video/cx2341x.c
+++ b/drivers/media/video/cx2341x.c
@@ -691,7 +691,7 @@ void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p)
691 .video_luma_spatial_filter_type = V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR, 691 .video_luma_spatial_filter_type = V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR,
692 .video_chroma_spatial_filter_type = V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR, 692 .video_chroma_spatial_filter_type = V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR,
693 .video_temporal_filter_mode = V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL, 693 .video_temporal_filter_mode = V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL,
694 .video_temporal_filter = 0, 694 .video_temporal_filter = 8,
695 .video_median_filter_type = V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF, 695 .video_median_filter_type = V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF,
696 .video_luma_median_filter_top = 255, 696 .video_luma_median_filter_top = 255,
697 .video_luma_median_filter_bottom = 0, 697 .video_luma_median_filter_bottom = 0,
@@ -731,6 +731,7 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func,
731 }; 731 };
732 732
733 int err = 0; 733 int err = 0;
734 u16 temporal = new->video_temporal_filter;
734 735
735 cx2341x_api(priv, func, CX2341X_ENC_SET_OUTPUT_PORT, 2, new->port, 0); 736 cx2341x_api(priv, func, CX2341X_ENC_SET_OUTPUT_PORT, 2, new->port, 0);
736 737
@@ -741,6 +742,7 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func,
741 742
742 if (old == NULL || old->width != new->width || old->height != new->height || 743 if (old == NULL || old->width != new->width || old->height != new->height ||
743 old->video_encoding != new->video_encoding) { 744 old->video_encoding != new->video_encoding) {
745 int is_scaling;
744 u16 w = new->width; 746 u16 w = new->width;
745 u16 h = new->height; 747 u16 h = new->height;
746 748
@@ -750,6 +752,20 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func,
750 } 752 }
751 err = cx2341x_api(priv, func, CX2341X_ENC_SET_FRAME_SIZE, 2, h, w); 753 err = cx2341x_api(priv, func, CX2341X_ENC_SET_FRAME_SIZE, 2, h, w);
752 if (err) return err; 754 if (err) return err;
755
756 /* Adjust temporal filter if necessary. The problem with the temporal
757 filter is that it works well with full resolution capturing, but
758 not when the capture window is scaled (the filter introduces
759 a ghosting effect). So if the capture window changed, and there is
760 no updated filter value, then the filter is set depending on whether
761 the new window is full resolution or not.
762
763 For full resolution a setting of 8 really improves the video
764 quality, especially if the original video quality is suboptimal. */
765 is_scaling = new->width != 720 || new->height != (new->is_50hz ? 576 : 480);
766 if (old && old->video_temporal_filter == temporal) {
767 temporal = is_scaling ? 0 : 8;
768 }
753 } 769 }
754 770
755 if (old == NULL || old->stream_type != new->stream_type) { 771 if (old == NULL || old->stream_type != new->stream_type) {
@@ -815,9 +831,9 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func,
815 } 831 }
816 if (old == NULL || 832 if (old == NULL ||
817 old->video_spatial_filter != new->video_spatial_filter || 833 old->video_spatial_filter != new->video_spatial_filter ||
818 old->video_temporal_filter != new->video_temporal_filter) { 834 old->video_temporal_filter != temporal) {
819 err = cx2341x_api(priv, func, CX2341X_ENC_SET_DNR_FILTER_PROPS, 2, 835 err = cx2341x_api(priv, func, CX2341X_ENC_SET_DNR_FILTER_PROPS, 2,
820 new->video_spatial_filter, new->video_temporal_filter); 836 new->video_spatial_filter, temporal);
821 if (err) return err; 837 if (err) return err;
822 } 838 }
823 if (old == NULL || old->video_temporal_decimation != new->video_temporal_decimation) { 839 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 printk(KERN_INFO "%s: Stream: %s\n", 871 printk(KERN_INFO "%s: Stream: %s\n",
856 prefix, 872 prefix,
857 cx2341x_menu_item(p, V4L2_CID_MPEG_STREAM_TYPE)); 873 cx2341x_menu_item(p, V4L2_CID_MPEG_STREAM_TYPE));
874 printk(KERN_INFO "%s: VBI Format: %s\n",
875 prefix,
876 cx2341x_menu_item(p, V4L2_CID_MPEG_STREAM_VBI_FMT));
858 877
859 /* Video */ 878 /* Video */
860 printk(KERN_INFO "%s: Video: %dx%d, %d fps\n", 879 printk(KERN_INFO "%s: Video: %dx%d, %d fps\n",