On Mon, 16 Mar 2009, Robert Jarzmik wrote: > >> + 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 Before you spend too much time on this, maybe I could offer a patch to use the generic alignment function I posted before? I beleive the method in that code will produce better results I think there are multiple drivers that could make use of it. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html