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.

Problems about Jpeg Encoder on Dm365



Greetings,

The dvsdk encode demo in DM365 doesn't support the jpeg encode algorithm. So I modified the code to make the jpeg encoder work based on the encode demo in dvsdk.

At first, add following to the encode.cfg:

var JPEGENC = xdc.useModule('ti.sdo.codecs.jpegenc.ce.JPEGENC');

var myEngine = Engine.create("encode", [

    {name: "mpeg4enc", mod: MPEG4ENC, local: true, groupId: 1},
    {name: "h264enc", mod: H264ENC, local: true, groupId: 1},

    {name: "jpegenc", mod: JPEGENC, local: true, groupId: 1},

    {name: "g711enc", mod: G711ENC, local: true},]);

Sencond, invoke the jpeg coder in the programme:

 

/* Set up codec parameters */
    IMGENC1_Params          params;

    params.maxWidth          = envp->imageWidth;
    params.maxHeight         = envp->imageHeight;
    params.size = sizeof(IMGENC1_Params);
    params.maxScans = 1;
    params.dataEndianness = XDM_BYTE;
    if (colorSpace ==  ColorSpace_YUV420PSEMI) { 
        params.forceChromaFormat = XDM_YUV_420SP;
    } else {
        params.forceChromaFormat = XDM_YUV_422ILE;
    }
 
    dynParams.inputWidth      = params.maxWidth;
    dynParams.inputHeight     = params.maxHeight;    
      
    /* Create the video encoder */
 
    hIe1 = Ienc1_create(hEngine, algname, &params, &dynParams);
    if (hIe1 == NULL) {
        ERR("Failed to create video encoder: %s\n", envp->videoEncoder);
        cleanup(THREAD_FAILURE);
    }

But video coder creation failed. After using CE_DEBUG=1, the console output is:

@2,417,953us: [+7 T:0x43782490] ti.sdo.ce.alg - ALG_create> algInit call failed
49157
@2,419,097us: [+7 T:0x43782490] ti.sdo.ce.alg.Algorithm - Algorithm_create> Algo
rithm creation FAILED; make sure that 1) alg params are correct/appropriate, 2)
there is enough internal and external algorithm memory available -- check DSKT2
settings for heap assignments and scratch allocation
@2,419,637us: [+7 T:0x43782490] ti.sdo.dmai - [Ienc1] Can't open imaging encode
algorithm
Error: Failed to create video encoder: jpegenc

Finally, I found the corresponding code in the dmai code:
    hEncode = IMGENC1_create(hEngine, codecName, params);

    if (hEncode == NULL) {
        Dmai_err0("Can't open imaging encode algorithm\n");
        free(hIe);
        return NULL;
    }
That mens the invoke of the IMGENC1_create() failed.
Any advice or hint will be grateful.
Best Regards;