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.

DM368 mjpeg decoder with XDM_YUV_420SP output

Hi,

My codec is jpegdec 1.0.0.10, and jpeg image is 1920x1080.

When I set forceChromaFormat to XDM_YUV_422ILE, the output image is good. Because the display buf is YUV420PSEMI, so I want a YUV420 output from the jpeg deocder. But, when I set forceChromaFormat to XDM_YUV_420SP, the output image have l lot of small dark blocks in random position.

Best regards,

Huo

 

 

  • Hi Huo,

    Are you using DVSDK? If yes, may I know which version you are using?

    Regards, RSV

  • Hi RSV,

    Thansk for you reply!

    I'm using dvsdk_2_10_00_17, and had updated newest codecs from TI website.

    Regards, Huo

     

  • Hi Chengping,

    I am having the same problem with forceChromaFormat set to XDM_YUV_420SP when decoding a 1920x1080 jpeg file.  It appears the small random dark blocks are on the Y planar only.  I am wondering if you have solved the problem.

    The problem still exists even I tried decoding the 1920x1080 JPEG file captured using XDM's jpegenc (01_00_00_09) with inputChromaFormat set to XDM_YUV_420SP.

    Regards,

    Jimmy

  • Finally found a workaround to get those random dark blocks (see attached picture) removed from the luma planar of the jpeg decoder output.  It turns out that I had to turn off V4L2 capture (by issuing VIDIOC_STREAMOFF ioctl call) and waited for a few hundred milliseconds before starting the JPEG decoder.  I don't know how V4L2 capture and JPEG decoder got related to each other to cause conflicts.  Maybe TI engineers can take a look into it.

    Jimmy

  • I have not fixed this issue. I guess this is a bug in TI mjpeg decoder.

  • I have the same problem with forceChromaFormat set to XDM_YUV_420SP when decoding a 1280x720 jpeg file(DM368)

    How to resolve this problem?

  • Can you please provide input JPEG file?

    Regards, RSV

  • I think All jpeg files have the same problem(random small block).

    We are using captured jpeg file(720P) from HDMI input.

    This problem appears Jpeg decoder forceChromaFormat value only set to XDM_YUV_420SP(forceChromaFormat).

    Attached file is sample file(1280x720). If do not appear this problem, plz test repeatly.

     

     

  • hi, all

    i want to ask if you got this problem solved.

    i got the same problem as you did.

    regards, Mike

    Thanks.

  • the jpegdec codec versioin is just the newest one, say 1.00.00.10 as you can see here http://software-dl.ti.com/dsps/dsps_public_sw/codecs/DM36x/index_FDS.html

    i have done 800*480 jpegdec and i believe the input buff is the same as the file we can see in Windows.

    it's random thing when i have don 100 times jpegdec and just found the black block about 10 times.

    it's very annoy and need your help.

    regards, Mike

    thanks in advance

  • Hi,

    We are trying to reproduce the issue at our end using standalone testapp provided with MJPEG decoder release package, but we are seeing the issue. Can you help us to reproduce it.

    We wanted know which environment corruption is visible? in system along with JPEG decoder is anything else running ? like capture or streaming thread which uses shared resources.

    Have you tried running in standalone? are you seeing the issue here?

  • Hi Veeranna,

    Thanks for taking the time to investigate the problem.

    In my case, I have both JPEG encoder and decoder instantiated sharing the resources (using the same SCRATCH_GROUP_ID). Only one of them runs at a time. The problem exists only when decoding an image of format YUV_420SP.

    Let me know if you need more information.

    Thanks,

    Jimmy

  • We did the fix and sharing the testlib as attachment here.
    Please remove .txt from attached and run JPEG decoder with this lib. Let us know your observations.
     
    Thanks,
    Veeranna
  • hi, Veeranna.

    when will it be released? i saw it's still Version 1.00.00.10 here http://software-dl.ti.com/dsps/dsps_public_sw/codecs/DM36x/index_FDS.html

    im looking forward to see it.

    regards, Mike

  • Hello Mike,

    Is artifact issue got solved with attached lib in previous post?. after fix we are not seeing the artifacts at our end. If you test with lib and conforms about the fix we will do final release.

    Thanks,

    Veeranna

  • Can somebody tried running with lib attached in previous post?. Can you please reply,  we want close on this issue.

    Thanks,

    Veeranna

  • Hi, Veeranna

    I tested it.
    However, the results are not good.
    When I use the library, IMGDEC1_process () API returns -1 and outArgs.extendedError was a 0xc000.

    Thanks,

    Justin

  • Dear Justin,

    The extended error 0xc000 means :

    XDM_UNSUPPORTEDPARAM (Unsupported input parameter or configuration.)

    and 

    XDM_FATALERROR.


    So can you please check you parameters which u have set.

    If possible please share the parameters which you are using.

  • Dear Prashanth,

    When using the dm365_jpegdec_01_00_00_10 does not generate any errors.

    Please see my code and parameters below.

     

    Thanks,

    Justin

     


    Idec1_Handle OpenPhotoDecoder(Engine_Handle hEngine)

    {

               Idec1_Handle                          hId = NULL;

               IMGDEC1_Handle                      hDecode = NULL;

               IMGDEC1_Status                      decStatus;

               XDAS_Int32                                       status;

     

               IMGDEC1_Params                                params = Idec1_Params_DEFAULT;

               IMGDEC1_DynamicParams dynParams = Idec1_DynamicParams_DEFAULT;

               char                                                *algName = "jpegdec";

     

               /* allocate and initialize JPEG decoder on the engine */

               params.size                                       = sizeof(IMGDEC1_Params);

     

               params.maxWidth                               = 2176;

               params.maxHeight                               = 1632;

     

               params.maxScans                                = SCANS;

               params.dataEndianness              = XDM_BYTE;

               params.forceChromaFormat         = XDM_YUV_420SP;

     

               if (hEngine == NULL)

                         DBG("hEngine is NULL\n");

     

               hDecode = IMGDEC1_create(hEngine, algName, &params);

               if (hDecode == NULL) {

                         DBG("can't open codec jpegdec\n");

                         return NULL;

               }

     

               dynParams.size = sizeof(IMGDEC1_DynamicParams);

               dynParams.numAU = XDM_DEFAULT;

               dynParams.decodeHeader = XDM_DECODE_AU;

     

               /* Set image decoder dynamic params */

               decStatus.data.buf = NULL;

               decStatus.size = sizeof(IMGDEC1_Status);

               status = IMGDEC1_control(hDecode, XDM_SETPARAMS, &dynParams, &decStatus);

     

               if (status != IMGDEC1_EOK) {

                         DBG("XDM_SETPARAMS control failed\n");

                         IMGDEC1_delete(hDecode);

                         return NULL;

               }

     

               /* Get buffer information from image decoder */

               status = IMGDEC1_control(hDecode, XDM_GETBUFINFO, &dynParams, &decStatus);

     

               if (status != IMGDEC1_EOK) {

                         DBG("XDM_GETBUFINFO control failed\n");

                         IMGDEC1_delete(hDecode);

                         return NULL;

               }

     

               /* Allocate space for the object */

               hId = (Idec1_Handle)calloc(1, sizeof(Idec1_Object));

     

               if (hId == NULL) {

                         DBG("Failed to allocate space for Idec1 Object\n");

                         IMGDEC1_delete(hDecode);

                         return NULL;

               }

     

               hId->hDecode = hDecode;

               memcpy(hId->minInBufSize, decStatus.bufInfo.minInBufSize, sizeof(hId->minInBufSize));

               hId->minNumInBufs = decStatus.bufInfo.minNumInBufs;

               memcpy(hId->minOutBufSize, decStatus.bufInfo.minOutBufSize, sizeof(hId->minOutBufSize));

               hId->minNumOutBufs = decStatus.bufInfo.minNumOutBufs;

     

               return hId;

    }

     

    int DecodePhoto(char *inBuf, int inBufSize, char *outBuf)

    {

               XDAS_Int32                                       status;

               IMGDEC1_InArgs                      inArgs;

               IMGDEC1_OutArgs                              outArgs;

               XDM1_BufDesc                        inBufDesc;

               XDM1_BufDesc                        outBufDesc;

               UInt32                                             offset = 0;

               UInt32                                             i;

     

               inArgs.size                   = sizeof(IMGDEC1_InArgs);

               inArgs.numBytes = inBufSize;

     

               outArgs.size            = sizeof(IMGDEC1_OutArgs);

     

               inBufDesc.numBufs                   = 1;

               outBufDesc.numBufs       = g_hId->minNumOutBufs;

              

               inBufDesc.descs[0].buf = (XDAS_Int8 *)inBuf;

               inBufDesc.descs[0].bufSize = g_hId->minInBufSize[0];

     

               for(i = 0; i < g_hId->minNumOutBufs; i++)

               {

                         outBufDesc.descs[i].buf = (XDAS_Int8 *)((unsigned int)outBuf + offset);

                         outBufDesc.descs[i].bufSize = g_hId->minOutBufSize[i];

                        

                         offset +=  g_hId->minOutBufSize[i];

               }

     

               status = IMGDEC1_process(g_hId->hDecode, &inBufDesc, &outBufDesc, &inArgs, &outArgs);

     

               if (status != IMGDEC1_EOK)

               {

                         if (XDM_ISFATALERROR(outArgs.extendedError))

                         {

                                    DBG("IMGDEC1_process() failed with error (%d ext: 0x%x), %u\n", (int)status, (unsigned int) outArgs.extendedError, (unsigned int) outArgs.bytesConsumed);

                                    return -1;

                         }

                         else

                         {

                                    DBG("IMGDEC1_process() non-fatal error 0x%x\n", (unsigned int) outArgs.extendedError);

                                    return -1;

                         }

               }

     

               return 0;

    }

     

  • hi, Veeranna.

    we tested your attached lib but we found that the sd card cannot work as usual.

    the sdio driver use edma queue 3 and we doubt the new lib use the same queue.

    we have not found the artifacts so far, it used to come out once in a way so we dont konw it fixed the issue.

    please check it out.

    regards, Mike

     

  • Hi,

    In test lib we didnt change anything related to TC map or EDMA queue. We just changed some EDMA transferrs related to LINK transfer.

    Thanks,

    Veeranna