This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RGB to YUV422/420 conversion using Openmax and V4L2

Hi,

I want to capture WUXGA RGB888 video input and want to perform cropping/scaling operation on it. I know I will need to support to capture this resolution in existing firmware.

As I understand, cropping/scaling can be done only on YUV data.

With above reference, I have following queries.

1. Can V4L2 support RGB888 capture as i/p but on-the-fly scaling or cropping ? If yes, What will be the data format of output of V4L2 ? Will it be YUV422 or YUV420 ?

2. If V4L2 can't support crop/scale with RGB888 i/p, can someone confirm that V4L2 will provide me RGB888 but Openmax component can support RGB to YUV conversion, after which I can use mem-mem mode to submit the converted data for crop/scale opeation.

3. Any other efficient approach to crop/scale RGB888 captured data ? I want to display the content as RGB888 only.

Thanks in advance,
Sweta

  • Inline,

    sweta bhatt said:
    As I understand, cropping/scaling can be done only on YUV data.

    Correct

    sweta bhatt said:
    Can V4L2 support RGB888 capture as i/p but on-the-fly scaling or cropping ? If yes, What will be the data format of output of V4L2 ? Will it be YUV422 or YUV420 ?

    It can support RGB888 at input. Refer to appnote on how to add decoders, Output format can be YUV422 or YUv420. If you want YUV422 or YUV420 you can scale image inline, but outupt format should be YUV only. Only downscaling is possible on the fly. Upscaling is not possible.

    sweta bhatt said:
    Any other efficient approach to crop/scale RGB888 captured data ? I want to display the content as RGB888 only.

    RGB data can be driven on GRPX pipeline, which supports scaling, so you can scaling it using grpx pipeline as well.

  • Hi Hardik,

    Thanks for quick reply.

    Few more queries on the same line and more overview.

    Requirement 1:  I want to capture WUXGA (1920x1200), this video will be given directly to Graphics pipeline so as to display RGB888 data on video out port 0.

    Requirement 2: In addition to above, I also want to perform cropping of image (extracting four 960x600 as 2x2 from 1920x1200 original source). On any of this cropped 960x600 rectangle, I want to perform up scaling from 960x600 to 1920x1200 (providing zooming effect) and want to send this as RGB888 on another video out port (eg. video out port 1).

    So, as I understand, I can straight away use V4L2 capture driver for requirement -1. Correct me if I am wrong.

    Now, for Requirement-2, can I use the graphics pipeline for crop and up-scale operation for exact use case as mentioned above ? If yes, I believe that's the perfect way so that I don't need to perform any RGB to YUV conversion and still I can achieve the end goal.

    Regards,
    Sweta

  • Just one correction,

    Cropping you need to do in software by adjusting the pointers. You can do it in hardware. So for grpx you need to adjust xoffset and yoffset pointers to do cropping. Hardware can do scaling only.

  • Thank yo so much for the details. Appreciated.

    One question to double check my assumption/understanding, I can get RGB888 as output from V4L2 capture driver, right ?

    I will not do any inline operation like crop/scale from V4L2 capture, but just want to give RGB888 i/p and get RGB888 o/p buffer.

    Please confirm that I can achieve this using V4L2 capture driver.

    Regards,
    Sweta

  • Yes,

    It should be possible.

  • Hello Hardik

    HardikShah said:
    So for grpx you need to adjust xoffset and yoffset pointers to do cropping.

    How to change them? Via sysfc or ioctl?

    Thanks