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.

How to deal with this situation for convert yuv444 to yuv420planner ?

Hi,all:

I want to call jpeg codec v02.02.02 on 6678.I see the datasheet of jpeg that Arbitrary image size supported.

By the way,My image format is YUV444.And for some reason,I must select yuv420p as the input of jpeg codec.

Because my jpeg decoder just support YUV420 format.So,I must convert YUV444p to YUV420p.

       Most of important,my image size is arbitrary.May be width and height are all multiple of 2.such as 

2x2 ,4x4,8x2 100x100 .... and so on.On other case ,width and height may not be multiple of 2. such as  5x5,

7x7, 11x11,9x13  ....and so on.

     So, If  9x13 occurs.I am puzzled. How can I convert 9x13  YUV444p to YUV420p ?

As I understand, YUV420 =Y( widthxheight) + U(w x h/4) + V(w x h /4).But now, w x h = 9x13 can not be

divisible  by  4. how to do that ?

Does it mean that if I want to convert yuv444 to yuv420 I must make sure that width and height are all multiple 

of 2? 

     Thanks!

  • Hi Steve, In 420 format evey two vertical and horizontal neighbor pixels share one U or V value, so the image Width and Height need to be an even number. One option in case of Odd dimensions is cropping or padding the image to the next even resolution.

    Also checking jpeg 2.2.2.5 configuration files (C66x_jpegenc_02_02_02_05_ELF\packages\ti\sdo\codecs\jpegenc\App\Client\Test\TestVecs\Config)

    It says that image width/height in Pels, must be multiple of 16.. .

    thank you,

    Paula

  • Hi,Paula:

    I noted that what you say about cfg file in App\Client\Test\TestVecs\Config.like below:

    But in the datasheet of jpeg encode ,it also say that jpeg encode lib support Arbitrary image size like below

    So, I think that above two kinds of sayings are contradiction.Paula,what's your opinion ? This is the right 

    thing which puzzled me.Do you think the view which say arbitrary image size supported is wrong?

  • Hi Steve, as a test a cropped Input_444P.yuv (from \C66x_jpegenc_02_02_02_05_ELF\packages\ti\sdo\codecs\jpegenc\App\Client\Test\TestVecs\Input) to a no divisible by 16 size and also to an odd (wxh) resolution. Both output images are OK. I am attaching you an example of  used configuration file and the input/output files.

    thanks,

    Paula

    0243.Jpeg_test_e2e.rar

  • Paula Carrillo said:

    It says that image width/height in Pels, must be multiple of 16.. .

    Hi,Paula:

    I see that test example and know that however it is multiple of 16 or not multiple of 16 jpeg

    codec all support.Thanks!

           But my another focus is not jpeg encoding but yuv420 convert. Taking a example,If I want to convert

    715x475 (you supply yuv444p) to yuv420 planner,Can I achieve that ? I guess that cannot be achieved.

    Because 715 cannot be divided by 2 and 475 cannot be divided by 2 too.You know converting yuv444p to

    yuv420p you must down scale 1/2 from width and height.Isn't it?

  • Seteve, yes, you need even dimensions for yuv420.

    thank you,

    Paula

  • Paula Carrillo said:

    Seteve, yes, you need even dimensions for yuv420.

    thank you,

    Paula

    Hi,Paula:

    1.

    Does it mean that it cannot be achieved  If I want to convert yuv444 715x475 to yuv420 planner?

    As your said,715 and 475 are not even number.

    2.

    If I must to convert 715x475 yuv444 to yuv420 how to do ?

    Do I need pad one row or one col ?

  • Steve, both answer are yes. Well for the second you can crop or pad.

    thanks,

    Paula