Issue when downscaling GRAY8 image on iMX6q

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue when downscaling GRAY8 image on iMX6q

861 Views
phdm
Contributor III

Using an Imx6q custom board based on the sabresd board, and a 4.1.15_1.2.0_ga based kernel, with some patches to accept a grayscale sensor, I run a gstreamer-imx pipeline with a downscale of my 1280x1024 grayscale images to 640x512, and I have noticed artifacts in the result : a repetitive pattern in the first two lines of the result image.  This happens for all images, except the full black ones, and whether I use 0 or IPU_PIX_FMT_GREY as format in the ipu_task for the ioctl.  The downscale I ask is just a division of width and height by a factor 2.  I have attached a full-scale image and the corresponding downscaled image.   Is that a known bug/feature of the IC or is it caused by some bad registers configuration when asking for the conversion ?

4 Replies

415 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hi,

When downscaling, if the ratio src/dest is>8, the ipu fails.This applies to both width and height. So, the ratios src_width/dest_width and src_height/dest_height must both be <8.

Please check the fix:

https://github.com/Gateworks/linux-imx6/commit/0d54f90b94a0d968241847226f70e189b15900eaipu3: fix stripe calculation · Gateworks/linux-imx6@0d54f90 · GitHub 

regards

0 Kudos

415 Views
phdm
Contributor III

to ease testing at your side, here is a gstreamer pipelline that does not need a grayscale sensor, but uses a .pgm file as src :

gst-launch-1.0 multifilesrc location=fullframe.pgm loop=true num-buffers=10 ! video/x-raw,format=GRAY8,width=1280,height=1024,framerate=10/1,interlace-mode=progressive ! imxipuvideotransform ! video/x-raw,format=GRAY8,width=640,height=512 ! avenc_pgm ! multifilesink location=halfframe%05d.pgm

I join a 1280x1024 grayscale .pgm file

0 Kudos

415 Views
phdm
Contributor III

Hi,

thanks for the link to the patch.  The patch is useful as it avoids unaligned accesses when creating I420 from 1280x1024 RGB.

However it does not solve my problem when downscaling grayscale 1280x1024 frames to 640x512, thus with a ratio src/dest == 2, for width and height.

I join the the patch for branch imx_4.1.15_1.0.0_ga (tag rel_imx_4.1.15_1.2.0_ga) that I have written to let the capture subsystem accept grayscale sensors, a patch to gstreamer-imx to let imxipuvideotransform accept to work on GRAY frames, and some resulting images, with some variation in the artifact.

I produce the frames using the following gstreamer pipe-line :

gst-launch-1.0 imxv4l2videosrc fps_n=10 ! video/x-raw,format=GRAY8,framerate=10/1,width=1280,height=1024 ! imxipuvideotransform ! video/x-raw,format=GRAY8,width=640,height=512 ! imxvpuenc_mjpeg ! multifilesink location=/tmp/frame%06d.jpg max-files=150

0 Kudos

415 Views
phdm
Contributor III

I forgot to join a patch needed to let imxv4l2videosrc start : the capture driver must know the actual frame format of the sensor.  Here  it is.

0 Kudos