linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Andrey Utkin <andrey.utkin@corp.bluecherry.net>,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org
Cc: m.chehab@samsung.com, hans.verkuil@cisco.com
Subject: Re: [PATCH] solo6x10: just pass frame motion flag from hardware, drop additional handling as complicated and unstable
Date: Fri, 14 Nov 2014 12:10:47 +0100	[thread overview]
Message-ID: <5465E337.6020808@xs4all.nl> (raw)
In-Reply-To: <1415218274-28132-1-git-send-email-andrey.utkin@corp.bluecherry.net>

Hi Andrew,

FYI: I need to test this myself and understand it better, so it will take some
time before I get to this. It is in my TODO list, so it won't be forgotten.

Regards,

	Hans

On 11/05/2014 09:11 PM, Andrey Utkin wrote:
> Dropping code (introduced in 316d9e84a72069e04e483de0d5934c1d75f6a44c)
> which intends to make raising of motion events more "smooth"(?).
> 
> It made motion event never appear in my installation.
> That code is complicated, so I couldn't figure out quickly how to fix
> it, so dropping it seems better to me.
> 
> Another justification is that anyway application would implement
> "motion signal stabilization" if required, it is not necessarily kernel
> driver's job.
> 
> Signed-off-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net>
> ---
>  drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c | 30 +-------------------------
>  drivers/media/pci/solo6x10/solo6x10.h          |  2 --
>  2 files changed, 1 insertion(+), 31 deletions(-)
> 
> diff --git a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
> index 30e09d9..866f7b3 100644
> --- a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
> +++ b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
> @@ -239,8 +239,6 @@ static int solo_enc_on(struct solo_enc_dev *solo_enc)
>  	if (solo_enc->bw_weight > solo_dev->enc_bw_remain)
>  		return -EBUSY;
>  	solo_enc->sequence = 0;
> -	solo_enc->motion_last_state = false;
> -	solo_enc->frames_since_last_motion = 0;
>  	solo_dev->enc_bw_remain -= solo_enc->bw_weight;
>  
>  	if (solo_enc->type == SOLO_ENC_TYPE_EXT)
> @@ -555,36 +553,12 @@ static int solo_enc_fillbuf(struct solo_enc_dev *solo_enc,
>  	}
>  
>  	if (!ret) {
> -		bool send_event = false;
> -
>  		vb->v4l2_buf.sequence = solo_enc->sequence++;
>  		vb->v4l2_buf.timestamp.tv_sec = vop_sec(vh);
>  		vb->v4l2_buf.timestamp.tv_usec = vop_usec(vh);
>  
>  		/* Check for motion flags */
> -		if (solo_is_motion_on(solo_enc)) {
> -			/* It takes a few frames for the hardware to detect
> -			 * motion. Once it does it clears the motion detection
> -			 * register and it takes again a few frames before
> -			 * motion is seen. This means in practice that when the
> -			 * motion field is 1, it will go back to 0 for the next
> -			 * frame. This leads to motion detection event being
> -			 * sent all the time, which is not what we want.
> -			 * Instead wait a few frames before deciding that the
> -			 * motion has halted. After some experimentation it
> -			 * turns out that waiting for 5 frames works well.
> -			 */
> -			if (enc_buf->motion == 0 &&
> -			    solo_enc->motion_last_state &&
> -			    solo_enc->frames_since_last_motion++ > 5)
> -				send_event = true;
> -			else if (enc_buf->motion) {
> -				solo_enc->frames_since_last_motion = 0;
> -				send_event = !solo_enc->motion_last_state;
> -			}
> -		}
> -
> -		if (send_event) {
> +		if (solo_is_motion_on(solo_enc) && enc_buf->motion) {
>  			struct v4l2_event ev = {
>  				.type = V4L2_EVENT_MOTION_DET,
>  				.u.motion_det = {
> @@ -594,8 +568,6 @@ static int solo_enc_fillbuf(struct solo_enc_dev *solo_enc,
>  				},
>  			};
>  
> -			solo_enc->motion_last_state = enc_buf->motion;
> -			solo_enc->frames_since_last_motion = 0;
>  			v4l2_event_queue(solo_enc->vfd, &ev);
>  		}
>  	}
> diff --git a/drivers/media/pci/solo6x10/solo6x10.h b/drivers/media/pci/solo6x10/solo6x10.h
> index 72017b7..dc503fd 100644
> --- a/drivers/media/pci/solo6x10/solo6x10.h
> +++ b/drivers/media/pci/solo6x10/solo6x10.h
> @@ -159,8 +159,6 @@ struct solo_enc_dev {
>  	u16			motion_thresh;
>  	bool			motion_global;
>  	bool			motion_enabled;
> -	bool			motion_last_state;
> -	u8			frames_since_last_motion;
>  	u16			width;
>  	u16			height;
>  
> 


  reply	other threads:[~2014-11-14 11:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-05 20:11 [PATCH] solo6x10: just pass frame motion flag from hardware, drop additional handling as complicated and unstable Andrey Utkin
2014-11-14 11:10 ` Hans Verkuil [this message]
2014-12-11 16:08   ` Andrey Utkin
2014-12-11 16:42     ` Hans Verkuil
2014-12-12 13:30 ` Hans Verkuil
2014-12-12 13:53   ` Andrey Utkin
2014-12-17 20:54     ` Andrey Utkin
2014-12-18  7:54       ` Hans Verkuil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5465E337.6020808@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=andrey.utkin@corp.bluecherry.net \
    --cc=hans.verkuil@cisco.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).