public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [media] vivid: add 1080p capture at 2 fps and 5 fps to webcam emulation
@ 2015-04-23 13:52 Philipp Zabel
  2015-04-24  6:43 ` Hans Verkuil
  0 siblings, 1 reply; 3+ messages in thread
From: Philipp Zabel @ 2015-04-23 13:52 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: Mauro Carvalho Chehab, linux-media, Philipp Zabel

Use the VIVID_WEBCAM_SIZES constant where appropriate and add a 1920x1080 pixel
frame size setting with frame rates of 2 fps and 5 fps.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/media/platform/vivid/vivid-vid-cap.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c b/drivers/media/platform/vivid/vivid-vid-cap.c
index 867a29a..468b8b5 100644
--- a/drivers/media/platform/vivid/vivid-vid-cap.c
+++ b/drivers/media/platform/vivid/vivid-vid-cap.c
@@ -60,7 +60,7 @@ static const struct vivid_fmt formats_ovl[] = {
 };
 
 /* The number of discrete webcam framesizes */
-#define VIVID_WEBCAM_SIZES 3
+#define VIVID_WEBCAM_SIZES 4
 /* The number of discrete webcam frameintervals */
 #define VIVID_WEBCAM_IVALS (VIVID_WEBCAM_SIZES * 2)
 
@@ -69,6 +69,7 @@ static const struct v4l2_frmsize_discrete webcam_sizes[VIVID_WEBCAM_SIZES] = {
 	{  320, 180 },
 	{  640, 360 },
 	{ 1280, 720 },
+	{ 1920, 1080 },
 };
 
 /*
@@ -76,6 +77,8 @@ static const struct v4l2_frmsize_discrete webcam_sizes[VIVID_WEBCAM_SIZES] = {
  * elements in this array as there are in webcam_sizes.
  */
 static const struct v4l2_fract webcam_intervals[VIVID_WEBCAM_IVALS] = {
+	{  1, 2 },
+	{  1, 5 },
 	{  1, 10 },
 	{  1, 15 },
 	{  1, 25 },
@@ -715,8 +718,8 @@ int vivid_s_fmt_vid_cap(struct file *file, void *priv,
 					webcam_sizes[i].height == mp->height)
 				break;
 		dev->webcam_size_idx = i;
-		if (dev->webcam_ival_idx >= 2 * (3 - i))
-			dev->webcam_ival_idx = 2 * (3 - i) - 1;
+		if (dev->webcam_ival_idx >= 2 * (VIVID_WEBCAM_SIZES - i))
+			dev->webcam_ival_idx = 2 * (VIVID_WEBCAM_SIZES - i) - 1;
 		vivid_update_format_cap(dev, false);
 	} else {
 		struct v4l2_rect r = { 0, 0, mp->width, mp->height };
@@ -1684,7 +1687,7 @@ int vidioc_enum_frameintervals(struct file *file, void *priv,
 			break;
 	if (i == ARRAY_SIZE(webcam_sizes))
 		return -EINVAL;
-	if (fival->index >= 2 * (3 - i))
+	if (fival->index >= 2 * (VIVID_WEBCAM_SIZES - i))
 		return -EINVAL;
 	fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
 	fival->discrete = webcam_intervals[fival->index];
@@ -1714,7 +1717,7 @@ int vivid_vid_cap_s_parm(struct file *file, void *priv,
 			  struct v4l2_streamparm *parm)
 {
 	struct vivid_dev *dev = video_drvdata(file);
-	unsigned ival_sz = 2 * (3 - dev->webcam_size_idx);
+	unsigned ival_sz = 2 * (VIVID_WEBCAM_SIZES - dev->webcam_size_idx);
 	struct v4l2_fract tpf;
 	unsigned i;
 
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] [media] vivid: add 1080p capture at 2 fps and 5 fps to webcam emulation
  2015-04-23 13:52 [PATCH] [media] vivid: add 1080p capture at 2 fps and 5 fps to webcam emulation Philipp Zabel
@ 2015-04-24  6:43 ` Hans Verkuil
  2015-04-24  8:18   ` Philipp Zabel
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Verkuil @ 2015-04-24  6:43 UTC (permalink / raw)
  To: Philipp Zabel; +Cc: Mauro Carvalho Chehab, linux-media

Hi Philipp,

Thank you for the patch, but I have one question:

On 04/23/2015 03:52 PM, Philipp Zabel wrote:
> Use the VIVID_WEBCAM_SIZES constant where appropriate and add a 1920x1080 pixel
> frame size setting with frame rates of 2 fps and 5 fps.

Why add both 2 and 5 fps? Is there a reason why you want both of those fps values?

Just wondering.

Regards,

	Hans

> 
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> ---
>  drivers/media/platform/vivid/vivid-vid-cap.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c b/drivers/media/platform/vivid/vivid-vid-cap.c
> index 867a29a..468b8b5 100644
> --- a/drivers/media/platform/vivid/vivid-vid-cap.c
> +++ b/drivers/media/platform/vivid/vivid-vid-cap.c
> @@ -60,7 +60,7 @@ static const struct vivid_fmt formats_ovl[] = {
>  };
>  
>  /* The number of discrete webcam framesizes */
> -#define VIVID_WEBCAM_SIZES 3
> +#define VIVID_WEBCAM_SIZES 4
>  /* The number of discrete webcam frameintervals */
>  #define VIVID_WEBCAM_IVALS (VIVID_WEBCAM_SIZES * 2)
>  
> @@ -69,6 +69,7 @@ static const struct v4l2_frmsize_discrete webcam_sizes[VIVID_WEBCAM_SIZES] = {
>  	{  320, 180 },
>  	{  640, 360 },
>  	{ 1280, 720 },
> +	{ 1920, 1080 },
>  };
>  
>  /*
> @@ -76,6 +77,8 @@ static const struct v4l2_frmsize_discrete webcam_sizes[VIVID_WEBCAM_SIZES] = {
>   * elements in this array as there are in webcam_sizes.
>   */
>  static const struct v4l2_fract webcam_intervals[VIVID_WEBCAM_IVALS] = {
> +	{  1, 2 },
> +	{  1, 5 },
>  	{  1, 10 },
>  	{  1, 15 },
>  	{  1, 25 },
> @@ -715,8 +718,8 @@ int vivid_s_fmt_vid_cap(struct file *file, void *priv,
>  					webcam_sizes[i].height == mp->height)
>  				break;
>  		dev->webcam_size_idx = i;
> -		if (dev->webcam_ival_idx >= 2 * (3 - i))
> -			dev->webcam_ival_idx = 2 * (3 - i) - 1;
> +		if (dev->webcam_ival_idx >= 2 * (VIVID_WEBCAM_SIZES - i))
> +			dev->webcam_ival_idx = 2 * (VIVID_WEBCAM_SIZES - i) - 1;
>  		vivid_update_format_cap(dev, false);
>  	} else {
>  		struct v4l2_rect r = { 0, 0, mp->width, mp->height };
> @@ -1684,7 +1687,7 @@ int vidioc_enum_frameintervals(struct file *file, void *priv,
>  			break;
>  	if (i == ARRAY_SIZE(webcam_sizes))
>  		return -EINVAL;
> -	if (fival->index >= 2 * (3 - i))
> +	if (fival->index >= 2 * (VIVID_WEBCAM_SIZES - i))
>  		return -EINVAL;
>  	fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
>  	fival->discrete = webcam_intervals[fival->index];
> @@ -1714,7 +1717,7 @@ int vivid_vid_cap_s_parm(struct file *file, void *priv,
>  			  struct v4l2_streamparm *parm)
>  {
>  	struct vivid_dev *dev = video_drvdata(file);
> -	unsigned ival_sz = 2 * (3 - dev->webcam_size_idx);
> +	unsigned ival_sz = 2 * (VIVID_WEBCAM_SIZES - dev->webcam_size_idx);
>  	struct v4l2_fract tpf;
>  	unsigned i;
>  
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [media] vivid: add 1080p capture at 2 fps and 5 fps to webcam emulation
  2015-04-24  6:43 ` Hans Verkuil
@ 2015-04-24  8:18   ` Philipp Zabel
  0 siblings, 0 replies; 3+ messages in thread
From: Philipp Zabel @ 2015-04-24  8:18 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: Mauro Carvalho Chehab, linux-media

Hi Hans,

Am Freitag, den 24.04.2015, 08:43 +0200 schrieb Hans Verkuil:
> Hi Philipp,
> 
> Thank you for the patch, but I have one question:
> 
> On 04/23/2015 03:52 PM, Philipp Zabel wrote:
> > Use the VIVID_WEBCAM_SIZES constant where appropriate and add a 1920x1080 pixel
> > frame size setting with frame rates of 2 fps and 5 fps.
> 
> Why add both 2 and 5 fps? Is there a reason why you want both of those fps values?
> 
> Just wondering.

I just wanted to quickly test 1080p at 5 fps, so I didn't change that
afterwards for the patch. 5 fps also seems like the next logical step.
webcam_intervals needs to be twice the size of webcam_sizes, the comment
above webcam_intervals told me to add two intervals for every new
element in webcam_sizes. For the second interval, I didn't think much
about the actual value. Choosing 2 fps next was probably influenced by
our monetary system.
To keep data rates similar to 720p at 10 fps and 15 fps, 1080p at 4 fps
and 6 fps, respectively, would be the better choice.

regards
Philipp


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-24  8:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-23 13:52 [PATCH] [media] vivid: add 1080p capture at 2 fps and 5 fps to webcam emulation Philipp Zabel
2015-04-24  6:43 ` Hans Verkuil
2015-04-24  8:18   ` Philipp Zabel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox