VPU MJPEG converter cInfoTab purpose and Stride values for C channel not functional

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VPU MJPEG converter cInfoTab purpose and Stride values for C channel not functional

483 Views
dmitryponv
Contributor II

Good afternoon,

This is a question regarding the VPU API on version 1.8 of the Yocto distribution running on IMX6 Hummingboard.

I am writing a compressor for Jpeg files and I have been able to complete the task without issues for NV12 images.

The format of enc_param.sourceFrame seems to be tailored to NV12 formats, and the VPU manual states the VPU will initially convert all other formats to a 4:2:0 format prior to compression,

For UYVY conversion, I had my frame_buffer configured as follows:

      frame_buffer.bufY =  _frame->physicalAddress+1;
      frame_buffer.bufCb = _frame->physicalAddress+0;
      frame_buffer.bufCr = _frame->physicalAddress+2;
      frame_buffer.strideY = w*2;
      frame_buffer.strideC = w*4;
  

   frame_buffer.myIndex = 0;

The issue I have is, changing enc_param.sourceFrame->strideC   does not seem to have any effect on the compressed image.

Also changing the enc_param.sourceFrame->bufCb and enc_param.sourceFrame->bufCr parameters do not have any effect either.

The only parameters that have any effect are enc_param.sourceFrame->bufY and enc_param.sourceFrame->strideY

However, there is a Jpeg Table header, called vpu_jpegtable.h that has cInfoTable which is copied into encOpenParam.EncStdParam.mjpgParam.cInfoTab

per specified mode, 4:2:0, 4:2:2H, 4:2:2V, 4:4:4, 4:0:0

This table seems to contain information on location and spacing of color and luminance channels.

However, there are no documents describing how it's organized and it seems gibberish at first sight

The table is shown below.

My assumption is that 4:2:0 values in the table are correct, but other values are not.

If anyone knows how to read this table, what needs to be changed in this table, or any other parameters, please advise,

Also for both NV12 and UYVY I had

   encOpenParam.chromaInterleave = 1;

static unsigned char cInfoTable[5][24] = {

    { 00, 02, 02, 00, 00, 00, 01, 01, 01, 01, 01, 01, 02, 01, 01, 01, 01, 01, 03, 00, 00, 00, 00, 00 }, //420

    { 00, 02, 01, 00, 00, 00, 01, 01, 01, 01, 01, 01, 02, 01, 01, 01, 01, 01, 03, 00, 00, 00, 00, 00 }, //422H

    { 00, 01, 02, 00, 00, 00, 01, 01, 01, 01, 01, 01, 02, 01, 01, 01, 01, 01, 03, 00, 00, 00, 00, 00 }, //422V

    { 00, 01, 01, 00, 00, 00, 01, 01, 01, 01, 01, 01, 02, 01, 01, 01, 01, 01, 03, 00, 00, 00, 00, 00 }, //444

    { 00, 01, 01, 00, 00, 00, 01, 00, 00, 00, 00, 00, 02, 00, 00, 00, 00, 00, 03, 00, 00, 00, 00, 00 }, //400

};

Thank you

0 Kudos
0 Replies