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.

Help!!Why my JPEG encode crashed on Dm6446??

Other Parts Discussed in Thread: CCSTUDIO

Hi, I hit a problem when I use Jpeg library( Build ID: 2.00.002) in my project.

My code is bellow which very simple, I do it as the demo from “dm6446_jpegenc_2_00_002_production\packages\ti\sdo\codecs\jpegenc\app\Client\Test”.

 

When I run this task in DSP side without DSPlink environment, the .out file is loaded via emulator from JTAG, the While-loop can run continuously.

But When I run these code in DSP side with DSPLINK, which means boot from arm and two cores run together, the program crashed after soon. I doubted that maybe the DSPLINK configuration is incorrect in my project. Then I used the dsplink demo from “dsplink_1_30_08_02\packages\dsplink\dsp\src\samples\scale”. I add my code in the function “static Int tskScale()” , before the DSPLINK related code” status2 = TSKSCALE_create (&info);”. It crashed as well. Of course, I have checked the stack size and heap size, and try to enlarge it if it’s too small. Besides, I know the program crashed in "IIMGENC1fxns->process" by invoking the “abort()” function.

 This problem has troubled me for several days. I tried almost all ways I can figure out. but nothing changed. Any help would be greatly appreciated. Thanks.

Meisi

 ps:The attachment is the image data I uesed in my project.The format is yuv420(352*288,semiplanar format ,luma is planar but,chroma channels are interleaved).

/*********************************************************************************/ 

#define CIF_HEIGHT 288

#define CIF_HALF_HEIGHT 144

#define CIF_WIDTH 352

#define CIF_IMG_SIZE  101376 //(CIF_HEIGHT * CIF_WIDTH)

#define CIF_HALF_SIZE 50688

#define CIF_YUV420_SIZE  152064 // 10

 UINT8 uacImgYUV[CIF_YUV420_SIZE];

UINT8  uacImgOutput[CIF_YUV420_SIZE];

JpegProc()

{

 

        FILE *pFileIn;

        int swRtnVal;   

        UINT8 *pInBuf[3];

        Uns uwCnt = 0;

   

        int  uwImgLength = 0;        

        IIMGENC1_Params tGlobalParams;

        IIMGENC1_DynamicParams tDynamicParams;        

        IALG_Handle handle;

 

        IIMGENC1_Fxns            *IIMGENC1fxns;

        IIMGENC1_Status          status;

        XDAS_Int32   retVal;

  

        /* Input/Output Buffer Descriptor variables */

        XDM1_BufDesc inputBufDesc, outputBufDesc;

 

        IIMGENC1_InArgs          inArgs;

        IIMGENC1_OutArgs         outArgs;

       

        int ii;

        int swAuNum;   

 

         pFileIn = fopen("C:\\CCStudio_v3.3\\MyProjects\\Data\\yuv420_uvuv.txt","rb");

         if (pFileIn != NULL)

         {

             swRtnVal = fread(uacImgYUV,1,CIF_IMG_SIZE,pFileIn);

             if (swRtnVal != CIF_IMG_SIZE)

             {    

                 LOG_printf(&trace, "fread failed 1 %d\n",swRtnVal );

     

             }   

         }

         else

         {

               LOG_printf(&trace, "fopen failed\n" );    

         }

        

        pInBuf[0] =  uacImgYUV;

 

         tGlobalParams.size = sizeof(IIMGENC1_Params);

         tGlobalParams.maxHeight =288;

         tGlobalParams.maxWidth = 352;

         tGlobalParams.maxScans = 0;

         tGlobalParams.dataEndianness  = XDM_BYTE;

         tGlobalParams.forceChromaFormat = XDM_GRAY;//XDM_YUV_420P;  

 

 

        if ((handle =  (IALG_Handle)ALG_create (

              (IALG_Fxns *) &DMJPGE_TIGEM_IDMJPGE,

              (IALG_Handle) NULL,

              (IALG_Params *) &tGlobalParams)) == NULL)

        {

        #ifdef DEBUG_INFO_PRINT

             LOG_printf(&trace, "\nFailed to Create Instance... Exiting for this configuration..");

        #endif

       return  FAILURE;

        }

 

        status.size                     = sizeof(IIMGENC1_Status);   

    inArgs.size                     = sizeof(IIMGENC1_InArgs);

    outArgs.size                    = sizeof(IIMGENC1_OutArgs);

    outArgs.extendedError           = 0;

    outArgs.bytesGenerated          = 0;

    outArgs.currentAU               = 0;

 

         tDynamicParams.captureWidth = 352;

         tDynamicParams.generateHeader = 0;

         tDynamicParams.inputChromaFormat = XDM_GRAY;//XDM_YUV_420P;

         tDynamicParams.inputHeight = 288;

         tDynamicParams.inputWidth = 352;

 

         tDynamicParams.numAU = 0;

         tDynamicParams.qValue = 80;

         tDynamicParams.size = sizeof(IIMGENC1_DynamicParams);  

 

 

        while(1)

        {

            /* Activate the Algorithm   */

            handle->fxns->algActivate(handle);

 

            /* Assigning Algorithm handle fxns field to IIMGdecfxns */

            IIMGENC1fxns = (IIMGENC1_Fxns *)handle->fxns ;

 

            /* Optional: Set Run time parameters in the Algorithm via control()*/       

            retVal = IIMGENC1fxns->control((IIMGENC1_Handle)handle, XDM_SETPARAMS,

                                            (IIMGENC1_DynamicParams *)&tDynamicParams,

                                            (IIMGENC1_Status *)&status);

            if(retVal != IALG_EOK || status.extendedError)

            {

               

                LOG_printf(&trace, "control failed(%d)",status.extendedError);

                return  FAILURE;

           

            }

           

             /* Get Buffer information */   

            retVal =  IIMGENC1fxns->control((IIMGENC1_Handle)handle,

                                  XDM_GETBUFINFO,

                                  (IIMGENC1_DynamicParams *)&tDynamicParams,

                                  (IIMGENC1_Status *)&status);

             if(retVal != IALG_EOK || status.extendedError)

             {

                LOG_printf(&trace, "control failed(%d)",status.extendedError); 

                return  FAILURE;

            

             }

            

             swAuNum = status.totalAU;

             

             /*Fill up the buffers as required by algorithm                            */

             inputBufDesc.numBufs  = status.bufInfo.minNumInBufs ;

             inputBufDesc.descs[0].buf     = (XDAS_Int8 *)pInBuf[0];

             inputBufDesc.descs[0].bufSize = status.bufInfo.minInBufSize[0];

 

             for(ii=0; ii< (status.bufInfo.minNumInBufs - 1);ii++ )

             {

               inputBufDesc.descs[ii+1].buf = (XDAS_Int8 *)pInBuf[ii + 1];

               inputBufDesc.descs[ii +1].bufSize =

                 status.bufInfo.minInBufSize[ii +1];

             }

            

             outputBufDesc.numBufs     = status.bufInfo.minNumOutBufs ;

             outputBufDesc.descs[0].buf     =(XDAS_Int8 *) uacImgOutput;

             outputBufDesc.descs[0].bufSize = CIF_YUV420_SIZE;//MAX_JPEG_BUF_SIZE;/*status.bufInfo.minOutBufSize[0];*/

              /* Basic Algorithm process() call */

            

             retVal = IIMGENC1fxns->process((IIMGENC1_Handle)handle,

               (XDM1_BufDesc *)&inputBufDesc,

               (XDM1_BufDesc *)&outputBufDesc,

               (IIMGENC1_InArgs *)&inArgs,

               (IIMGENC1_OutArgs *)&outArgs);

 

             if(retVal == XDM_EFAIL)

               {

 

                 LOG_printf(&trace, "\n Process function returned an Error...  ");

                 return  FAILURE; 

                

               }

            

             if (outArgs.currentAU < swAuNum)

             {                

                LOG_printf(&trace, "\n currentAU is less than  the total AuNum  ");

                return  FAILURE;

             }

 

             LOG_printf(&trace, "process cnt(%d)",uwCnt++);

 

            /* DeActivate the Algorithm                */ 

                 handle->fxns->algDeactivate(handle); 

 

        }

}

 /**********************************************************************************************/