All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Jarzmik <robert.jarzmik@free.fr>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: Re: [PATCH v2 1/4] pxa_camera: Enforce YUV422P frame sizes to be 16 multiples
Date: Mon, 16 Mar 2009 19:26:50 +0100	[thread overview]
Message-ID: <8763i9fhn9.fsf@free.fr> (raw)
In-Reply-To: Pine.LNX.4.64.0903142359230.8263@axis700.grange

Guennadi Liakhovetski <g.liakhovetski@gmx.de> writes:

>> @@ -162,6 +162,8 @@
>>  			CICR0_PERRM | CICR0_QDM | CICR0_CDM | CICR0_SOFM | \
>>  			CICR0_EOFM | CICR0_FOM)
>>  
>> +#define PIX_YUV422P_ALIGN 16	/* YUV422P pix size should be a multiple of 16 */
>
> What is a "pix size?" Did you mean "picture size?"
Yes. I'll change the comment from "pix size" into "picture size"

>> -	/* planar capture requires Y, U and V buffers to be page aligned */
>> -	if (pcdev->channels == 3) {
>> -		*size = PAGE_ALIGN(icd->width * icd->height); /* Y pages */
>> -		*size += PAGE_ALIGN(icd->width * icd->height / 2); /* U pages */
>> -		*size += PAGE_ALIGN(icd->width * icd->height / 2); /* V pages */
>> -	} else {
>> -		*size = icd->width * icd->height *
>> -			((icd->current_fmt->depth + 7) >> 3);
>> -	}
>> +	if (pcdev->channels == 3)
>> +		*size = icd->width * icd->height * 2;
>
> This is not very obvious, why "* 2". Maybe use
>
> pxa_camera_formats[0].depth / 8 or at least add a comment?

Yes.
I was wondering about simplifying the if (removing it actually), and changing :
>> +	if (pcdev->channels == 3)
>> +		*size = icd->width * icd->height * 2;
>> +	else
>> +		*size = roundup(icd->width * icd->height *
>> +				((icd->current_fmt->depth + 7) >> 3), 8);
into:
	*size = roundup(icd->width * icd->height *
			((icd->current_fmt->depth + 7) >> 3), 8);

>> +	if (xlate->host_fmt->fourcc == V4L2_PIX_FMT_YUV422P) {
>> +		if (!IS_ALIGNED(pix->width * pix->height, PIX_YUV422P_ALIGN))
>> +			pix->height = ALIGN(pix->height, PIX_YUV422P_ALIGN / 2);
>> +		if (!IS_ALIGNED(pix->width * pix->height, PIX_YUV422P_ALIGN))
>> +			pix->width = ALIGN(pix->width, PIX_YUV422P_ALIGN / 2);
>
> Shouldn't this have been sqrt(PIX_YUV422P_ALIGN) (of course, not 
> literally) instead of PIX_YUV422P_ALIGN / 2? At least above you say, 
> height and width shall be 4 bytes aligned, not 8.
That's a very good catch.
Maybe 2 defines will fit better, as I'm not very please with log2 logic here ... :

/*
 * YUV422P picture size should be a multiple of 16, so the heuristic aligns
 * height, width on 4 byte boundaries to reach the 16 multiple for the size.
 */
#define YUV422P_X_Y_ALIGN 4
#define YUV422P_SIZE_ALIGN YUV422P_X_Y_ALIGN * YUV422P_X_Y_ALIGN

Cheers.

--
Robert

  reply	other threads:[~2009-03-16 18:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-13 23:17 [PATCH v2 0/4] pxa_camera: DMA redesign Robert Jarzmik
2009-03-13 23:17 ` [PATCH v2 1/4] pxa_camera: Enforce YUV422P frame sizes to be 16 multiples Robert Jarzmik
2009-03-13 23:17   ` [PATCH v2 2/4] pxa_camera: remove YUV planar formats hole Robert Jarzmik
2009-03-13 23:17     ` [PATCH v2 3/4] pxa_camera: Redesign DMA handling Robert Jarzmik
2009-03-13 23:17       ` [PATCH v2 4/4] pxa_camera: Fix overrun condition on last buffer Robert Jarzmik
2009-03-16 11:25         ` Guennadi Liakhovetski
2009-03-16 19:37           ` Robert Jarzmik
2009-03-16 11:22       ` [PATCH v2 3/4] pxa_camera: Redesign DMA handling Guennadi Liakhovetski
2009-03-16 19:36         ` Robert Jarzmik
2009-03-16 20:42           ` Trent Piepho
2009-03-25  8:37           ` [PATCH] pxa-camera: simplify the .buf_queue path by merging two loops Guennadi Liakhovetski
2009-03-25 20:40             ` Robert Jarzmik
2009-03-16 10:50     ` [PATCH v2 2/4] pxa_camera: remove YUV planar formats hole Guennadi Liakhovetski
2009-03-16 19:37       ` Robert Jarzmik
2009-03-16  9:25   ` [PATCH v2 1/4] pxa_camera: Enforce YUV422P frame sizes to be 16 multiples Guennadi Liakhovetski
2009-03-16 18:26     ` Robert Jarzmik [this message]
2009-03-16 20:29       ` Trent Piepho
2009-03-16 20:47         ` Guennadi Liakhovetski

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=8763i9fhn9.fsf@free.fr \
    --to=robert.jarzmik@free.fr \
    --cc=g.liakhovetski@gmx.de \
    --cc=linux-media@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.