I'm capturing 720x480 UYVY on the DM368. I'm using the resizer to convert from UYVY to 420SP to feed the h.264 encoder. The Y data looks like it's encoder correctly, but the UV is offset in the picture. Questions....
1) The captured source has an imageWidth of 720, not 736 like the 420. Is this going to mess up the resizer feeding it a source that's not 32 byte aligned? When the dest buffer was 720 the resizer refused to config. But with the source being 720 it completed ok.
2) If the source image buffer must be 736 in width, is there an easy way to tell the DMAI capture to use 736 instead of 720? When using 420SP it automatically was 736.
Here's the code I use to configure the resizer. Maybe somebody can see something wrong....
//-------------------------------------------------------------------------
// First set up the resizer
//-------------------------------------------------------------------------
hResize = Resize_create(&rszAttrs);
// Set up a UYVY buffer for configuring the resizer
bufSize = BufferGfx_calcSize(VideoStd_D1_NTSC,ColorSpace_UYVY);
BufferGfx_calcDimensions(VideoStd_D1_NTSC,
ColorSpace_UYVY,
&gfxAttrs.dim);
gfxAttrs.colorSpace = ColorSpace_UYVY;
hUYVYBuf = Buffer_create(bufSize, (Buffer_Attrs*)&gfxAttrs);
if (hUYVYBuf == NULL)
{
eprintf(eLOG_WARNING,"Failed to create UYVY buffer\n");
goto error_exit;
}
BufferGfx_setColorSpace(hUYVYBuf,ColorSpace_UYVY);
// Set up a 420SP buffer for resize config and to be used as buffer
// for input to the encoder
bufSize = BufferGfx_calcSize(VideoStd_D1_NTSC,ColorSpace_YUV420PSEMI);
BufferGfx_calcDimensions(VideoStd_D1_NTSC,
ColorSpace_YUV420P,
&gfxAttrs.dim);
gfxAttrs.dim.width = 736;
gfxAttrs.dim.lineLength = 736;
gfxAttrs.colorSpace = ColorSpace_YUV420P;
h420Buf = Buffer_create(bufSize, (Buffer_Attrs*)&gfxAttrs);
if (hUYVYBuf == NULL)
{
eprintf(eLOG_WARNING,"Failed to create 420SP buffer\n");
goto error_exit;
}
p420_user_buf = Buffer_getUserPtr(h420Buf);
BufferGfx_setColorSpace(h420Buf,ColorSpace_YUV420PSEMI);
if(Resize_config(hResize,hUYVYBuf, h420Buf)<0)
{
eprintf(eLOG_WARNING,"Failed to config resizer\n");
goto error_exit;
}