From patchwork Fri May 15 17:32:04 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dean Anderson X-Patchwork-Id: 24144 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n4FHWBPR031993 for ; Fri, 15 May 2009 17:32:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755035AbZEORcI (ORCPT ); Fri, 15 May 2009 13:32:08 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755372AbZEORcI (ORCPT ); Fri, 15 May 2009 13:32:08 -0400 Received: from mail11b.verio-web.com ([204.202.242.87]:47745 "HELO mail11b.verio-web.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1755035AbZEORcH (ORCPT ); Fri, 15 May 2009 13:32:07 -0400 Received: from mx89.stngva01.us.mxservers.net (198.173.112.6) by mail11b.verio-web.com (RS ver 1.0.95vs) with SMTP id 1-0970708726 for ; Fri, 15 May 2009 13:32:06 -0400 (EDT) Received: from unknown [161.58.148.76] (EHLO mmm1118.verio-web.com) by va1-mx89.stngva01.us.mxservers.net (mxl_mta-3.1.0-05) with ESMTP id 617ad0a4.2586135456.50456.00-003.va1-mx89.stngva01.us.mxservers.net (envelope-from ); Fri, 15 May 2009 13:32:06 -0400 (EDT) Received: (qmail 22592 invoked from network); 15 May 2009 17:32:06 -0000 Received: from unknown (HELO ?10.140.5.9?) (66.15.212.169) by with SMTP; 15 May 2009 17:32:06 -0000 Date: Fri, 15 May 2009 10:32:04 -0700 (PDT) From: "Dean A." Subject: patch: s2255drv: adding V4L2_MODE_HIGHQUALITY To: linux-media@vger.kernel.org, mchehab@infradead.org, video4linux-list@redhat.com Message-ID: MIME-Version: 1.0 Content-Disposition: INLINE X-Spam: [F=0.2000000000; S=0.200(2009020301); MH=0.500(2009051530)] X-MAIL-FROM: X-SOURCE-IP: [161.58.148.76] X-SF-Loop: 1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Dean Anderson Adding V4L2_MODE_HIGHQUALITY feature. Signed-off-by: Dean Anderson --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- v4l-dvb-0018ed9bbca3/linux/drivers/media/video/s2255drv.c.orig 2009-05-15 10:15:36.000000000 -0700 +++ v4l-dvb-0018ed9bbca3/linux/drivers/media/video/s2255drv.c 2009-05-15 10:20:43.000000000 -0700 @@ -110,6 +110,8 @@ #define SCALE_4CIFS 1 /* 640x480(NTSC) or 704x576(PAL) */ #define SCALE_2CIFS 2 /* 640x240(NTSC) or 704x288(PAL) */ #define SCALE_1CIFS 3 /* 320x240(NTSC) or 352x288(PAL) */ +/* SCALE_4CIFSI is the 2 fields interpolated into one */ +#define SCALE_4CIFSI 4 /* 640x480(NTSC) or 704x576(PAL) high quality */ #define COLOR_YUVPL 1 /* YUV planar */ #define COLOR_YUVPK 2 /* YUV packed */ @@ -239,6 +241,8 @@ struct s2255_mode mode[MAX_CHANNELS]; /* jpeg compression */ struct v4l2_jpegcompression jc[MAX_CHANNELS]; + /* capture parameters (for high quality mode full size) */ + struct v4l2_captureparm cap_parm[MAX_CHANNELS]; const struct s2255_fmt *cur_fmt[MAX_CHANNELS]; int cur_frame[MAX_CHANNELS]; int last_frame[MAX_CHANNELS]; @@ -1021,9 +1025,16 @@ fh->type = f->type; norm = norm_minw(fh->dev->vdev[fh->channel]); if (fh->width > norm_minw(fh->dev->vdev[fh->channel])) { - if (fh->height > norm_minh(fh->dev->vdev[fh->channel])) - fh->mode.scale = SCALE_4CIFS; - else + if (fh->height > norm_minh(fh->dev->vdev[fh->channel])) { + if (fh->dev->cap_parm[fh->channel].capturemode & + V4L2_MODE_HIGHQUALITY) { + fh->mode.scale = SCALE_4CIFSI; + dprintk(2, "scale 4CIFSI\n"); + } else { + fh->mode.scale = SCALE_4CIFS; + dprintk(2, "scale 4CIFS\n"); + } + } else fh->mode.scale = SCALE_2CIFS; } else { @@ -1124,6 +1135,7 @@ if (mode->format == FORMAT_NTSC) { switch (mode->scale) { case SCALE_4CIFS: + case SCALE_4CIFSI: linesPerFrame = NUM_LINES_4CIFS_NTSC * 2; pixelsPerLine = LINE_SZ_4CIFS_NTSC; break; @@ -1141,6 +1153,7 @@ } else if (mode->format == FORMAT_PAL) { switch (mode->scale) { case SCALE_4CIFS: + case SCALE_4CIFSI: linesPerFrame = NUM_LINES_4CIFS_PAL * 2; pixelsPerLine = LINE_SZ_4CIFS_PAL; break; @@ -1496,6 +1509,33 @@ dprintk(2, "setting jpeg quality %d\n", jc->quality); return 0; } + +static int vidioc_g_parm(struct file *file, void *priv, + struct v4l2_streamparm *sp) +{ + struct s2255_fh *fh = priv; + struct s2255_dev *dev = fh->dev; + if (sp->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + sp->parm.capture.capturemode = dev->cap_parm[fh->channel].capturemode; + dprintk(2, "getting parm %d\n", sp->parm.capture.capturemode); + return 0; +} + +static int vidioc_s_parm(struct file *file, void *priv, + struct v4l2_streamparm *sp) +{ + struct s2255_fh *fh = priv; + struct s2255_dev *dev = fh->dev; + + if (sp->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + + dev->cap_parm[fh->channel].capturemode = sp->parm.capture.capturemode; + dprintk(2, "setting param capture mode %d\n", + sp->parm.capture.capturemode); + return 0; +} static int s2255_open(struct file *file) { int minor = video_devdata(file)->minor; @@ -1787,6 +1827,8 @@ #endif .vidioc_s_jpegcomp = vidioc_s_jpegcomp, .vidioc_g_jpegcomp = vidioc_g_jpegcomp, + .vidioc_s_parm = vidioc_s_parm, + .vidioc_g_parm = vidioc_g_parm, }; static struct video_device template = {