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.

Ienc1_create Jpeg: Failed to create image encoder.

Hi All,

    I would ask some idea about what could prevent Ienc1_create to create a jpeg encoder. Is there some restriction on the image size? (720x576 in my case). Looking at the output I can see that the "jpegenc" algorithm should be available so I don't understand the reason why the encoder is not created.

Here the code:

    CaptureEnv               *envp     = (CaptureEnv *) arg;
    Void                     *threadstatus   = THREAD_SUCCESS;
    IMGENC1_Params          params             = Ienc1_Params_DEFAULT;
    IMGENC1_DynamicParams   dynParams         = Ienc1_DynamicParams_DEFAULT;
    Engine_Handle           hEngine     = NULL;
    IMGENC1_Handle             hImgencPtr;
    //Ienc_Handle             hIe         = NULL;
    Ienc1_Handle              hImgEnc     = NULL;
    int                      status;
    int                      bufId, chId;
    MCVIP_BufInfo              *pBuf;
    char                    algName[20];

....

    params.maxWidth           = gCAPTURE_ctrl.reszPrm.inWidth;
    params.maxHeight          = gCAPTURE_ctrl.reszPrm.inHeight;
    params.size               = sizeof(IMGENC1_Params);
    params.maxScans           = 1;
    params.dataEndianness       = XDM_BYTE;
    params.forceChromaFormat  = XDM_YUV_422ILE;
    dynParams.inputWidth      = params.maxWidth;
    dynParams.inputHeight     = params.maxHeight;

 

hEngine = Engine_open(envp->engineName, NULL, NULL);
   fprintf(stdout,"Engine name: %s\n", envp->engineName);
   if (hEngine == NULL) {
       ERR("Failed to open codec engine %s\n", envp->engineName);
       cleanup(THREAD_FAILURE);
   }

    hImgEnc = Ienc1_create(hEngine, algName, &params, &dynParams);
       if (hImgEnc == NULL) {
           ERR("Failed to create image encoder: %s\n", algName);

           Int numAlgs, i;
           char    name[30];
           Engine_AlgInfo algInfo;
           algInfo.algInfoSize=sizeof(Engine_AlgInfo);
           Engine_Error err;
           err = Engine_getNumAlgs(envp->engineName, &numAlgs);
           printf("Use one of the following %d Algorithms: \n", numAlgs);
           for (i = 0; i < numAlgs; i++) {
               err = Engine_getAlgInfo(envp->engineName, &algInfo, i);
               printf("alg[%d]: name = %s typeTab = %s local = %d\n", i, algInfo.name, *(algInfo.typeTab), algInfo.isLocal);
           }
           cleanup(THREAD_FAILURE);
       }

 

And this the OUTPUT screen: as you can see jpegenc is available on the codec engine...

Engine name: encode                                                            
 Avg Time (msecs) for Capture:  6.0, Demux:  6.0, DMA:  4.0 (1 frames)         
Error: Failed to create image encoder: jpegenc                                 
Use one of the following 5 Algorithms:                                         
alg[0]: name = mpeg4enc typeTab = ti.sdo.ce.video1.IVIDENC1 local = 1          
alg[1]: name = h264enc typeTab = ti.sdo.ce.video1.IVIDENC1 local = 1           
alg[2]: name = g711enc typeTab = ti.sdo.ce.speech1.ISPHENC1 local = 1          
alg[3]: name = jpegenc typeTab = ti.sdo.ce.image1.IIMGENC1 local = 1           
alg[4]: name = jpegdec typeTab = ti.sdo.ce.image1.IIMGDEC1 local = 1

 

Thank you!

 

 

  • Mario,

    It will help if we can get the exact values that you have programmed for creating the JPEG encoder. Do you get any other error on the terminal saying anything about EDMA channels or something similar?

     

    Can you run your demo application with CE_DEBUG=3 turned on and changes in .cfg file as below:

    1. Change your .cfg file and add following lines

                                                                   i.      xdc.useModule("ti.sdo.fc.global.Settings").profile = "debug_trace";

                                                                 ii.      xdc.loadPackage('ti.sdo.fc.rman').profile = "debug_trace";

                                                                iii.      xdc.loadPackage('ti.sdo.fc.edma3').profile = "debug_trace";

    1.  
      1. At shell prompt call following:

                                                                   i.      #> CE_DEBUG=3 <your program name say ./encode)

    Regards,

    Anshuman

  • Thank you for the Anshuman,

         I found the problem, it was in the line I have now commented in the initialization (gImageEncoderCtrl.params.forceChromaFormat  = XDM_YUV_422ILE):

        gImageEncoderCtrl.params         = Ienc1_Params_DEFAULT;
        gImageEncoderCtrl.dynParams     = Ienc1_DynamicParams_DEFAULT;

        gImageEncoderCtrl.params.maxWidth           = 736;// TO DO TEMP //gCAPTURE_ctrl.reszPrm.inWidth;
        gImageEncoderCtrl.params.maxHeight          = gCAPTURE_ctrl.reszPrm.inHeight;
        gImageEncoderCtrl.params.size                 = sizeof(IMGENC1_Params);
        gImageEncoderCtrl.params.maxScans             = 1;
        gImageEncoderCtrl.params.dataEndianness     = XDM_BYTE;
        //gImageEncoderCtrl.params.forceChromaFormat  = XDM_YUV_422ILE;
        gImageEncoderCtrl.dynParams.inputWidth      = gImageEncoderCtrl.params.maxWidth;
        gImageEncoderCtrl.dynParams.inputHeight     = gImageEncoderCtrl.params.maxHeight;

    Now I am able to get the compressed image!! :-)

    Nevertheless I still have some problem since after running my application I have to run the script which unload and reload the modules (cmem, irq, edma, dm365mmap) in order to run again the application otherwise the Ienc1_create fails again. I have not idea of the reason. I have to check if all is deallocated properly but it seems to me I am doing so.

    Attached the CE_DEBUG output.

    0741.ouput.txt

     

    Thank you,

    Mario