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.

Failed to open snapshot algorithm: jpegenc



Hi all !

I am using OV9715 IPNC-DM365 RDK 5.0 with codec engine2_26.

I am trying to capture an image from OV9715 image sensor and store the image in JPEG format.

OV9715 outputs image in RAW format which is converted to YUV format by the IPIPE engine.

Now i am trying to use H264 encoder to convert this YUV image into JPEG image

Capturing part is working fine but there is some issue with the encoding part.

I am able to create encode algorithm with function ALG_vidEncCreate(&createPrm) and createPrm set as follows;

createPrm.resetHDVICP        = 0;
createPrm.codec                      = ALG_VID_CODEC_H264;
createPrm.dataFormat             = DRV_DATA_FORMAT_YUV420;
createPrm.width                      = 640;
createPrm.height                    = 480;
createPrm.offsetH                   = createPrm.width;
createPrm.offsetV                   = createPrm.height;
createPrm.framerate                = 30*1000;
createPrm.bitrate                     = 400;
createPrm.keyFrameInterval   = 30;
createPrm.mbMvOutEnable   = FALSE;
createPrm.qValue                    = 400;
createPrm.rateControlType     = ALG_VID_ENC_RATE_CONTROL_VBR;
createPrm.encodePreset          = ALG_VID_ENC_PRESET_AUTO;
createPrm.ddrEnable                          = FALSE;
createPrm.enableROI             = FALSE;
createPrm.qpinit                      = (createPrm.codec==ALG_VID_CODEC_H264)?28:4;
createPrm.qpmin                     = 1;
createPrm.qpmax                    = (createPrm.codec==ALG_VID_CODEC_H264)?51:31;
createPrm.packetsize               = 100; //set to 100%
createPrm.mode                      = ALG_VID_ENC_MODE_BEST_QUALITY;

But when I try to run the encode algorithm with function ALG_vidEncRun(algEncHndl, &encPrm, &encStatus) and encPrm set as follows

encPrm.inAddr                                 = OSA_cmemAlloc(bufSize, 32);

encPrm.outAddr                              = OSA_cmemAlloc(bufSize, 32);

OSA_fileReadFile(filename, encPrm.inAddr, bufSize, &fileSize);

encPrm.mbMvInfo                         = NULL;

encPrm.outDataMaxSize              = bufSize + VIDEO_BUF_HEADER_SIZE;

encPrm.roiPrm.numROI               = 0;

encPrm.snapMode                         = SNAPSHOT_JPEG;

 encPrm.snapEnable                       = 1;

 

I get the following error

 

ERROR  (alg_jpgEnc.c|SnapshotFrameData|224): Failed to open snapshot algorithm: jpegenc (0x0)

 

I used CE_DEBUG=2 and enabled GT_TRACE which gave me the following log

 

@17,688,985us: [+0 T:0x4016f000] ti.sdo.ce.video1.VIDENC1 - VIDENC1_control> Enter (handle=0x493358, id=1, dynParams=0x4931dc (size=0xd4), status=0x4932b0 (size=0x9c)

@17,689,225us: [+5 T:0x4016f000] CV - VISA_enter(visa=0x493358): algHandle = 0x492f88

@17,689,383us: [+0 T:0x4016f000] ti.sdo.ce.alg.Algorithm - Algorithm_activate> Enter(alg=0x492f88)

@17,689,597us: [+0 T:0x4016f000] ti.sdo.ce.alg.Algorithm - Algorithm_activate> Exit

@17,689,887us: [+5 T:0x4016f000] CV - VISA_exit(visa=0x493358): algHandle = 0x492f88

@17,690,123us: [+0 T:0x4016f000] ti.sdo.ce.alg.Algorithm - Algorithm_deactivate> Enter(alg=0x492f88)

@17,690,347us: [+0 T:0x4016f000] ti.sdo.ce.alg.Algorithm - Algorithm_deactivate> Exit

@17,690,511us: [+0 T:0x4016f000] ti.sdo.ce.video1.VIDENC1 - VIDENC1_control> Exit (handle=0x493358, retVal=0x0)

@17,690,670us: [+0 T:0x4016f000] ti.sdo.ce.video1.VIDENC1 - VIDENC1_control> Enter (handle=0x493358, id=5, dynParams=0x4931dc (size=0xd4), status=0x4932b0 (size=0x9c)

@17,690,845us: [+5 T:0x4016f000] CV - VISA_enter(visa=0x493358): algHandle = 0x492f88

@17,690,987us: [+0 T:0x4016f000] ti.sdo.ce.alg.Algorithm - Algorithm_activate> Enter(alg=0x492f88)

@17,691,187us: [+0 T:0x4016f000] ti.sdo.ce.alg.Algorithm - Algorithm_activate> Exit

@17,691,404us: [+5 T:0x4016f000] CV - VISA_exit(visa=0x493358): algHandle = 0x492f88

@17,691,568us: [+0 T:0x4016f000] ti.sdo.ce.alg.Algorithm - Algorithm_deactivate> Enter(alg=0x492f88)

@17,691,779us: [+0 T:0x4016f000] ti.sdo.ce.alg.Algorithm - Algorithm_deactivate> Exit

@17,691,940us: [+0 T:0x4016f000] ti.sdo.ce.video1.VIDENC1 - VIDENC1_control> Exit (handle=0x493358, retVal=0x0)

@17,692,246us: [+0 T:0x4016f000] ti.sdo.ce.image1.IMGENC1 - IMGENC1_create> Enter (engine=0x492eb0, name='jpegenc', params=0xbebde70c)

@17,692,458us: [+0 T:0x4016f000] CV - VISA_create(0x492eb0, 'jpegenc', 0xbebde70c, 0x460, 'ti.sdo.ce.image1.IIMGENC1')

@17,692,627us: [+0 T:0x4016f000] CV - VISA_create2(0x492eb0, 'jpegenc', 0xbebde70c, 0x18, 0x460, 'ti.sdo.ce.image1.IIMGENC1')

@17,692,898us: [+0 T:0x4016f000] ti.sdo.ce.alg.Algorithm - Algorithm_create> Enter (fxns=0x2fba88, idma3Fxns=0x0, iresFxns=0x2fba60, params=0xbebde70c, attrs=0xbebde3fc)

@17,693,096us: [+2 T:0x4016f000] ti.sdo.ce.alg.Algorithm - Algorithm_create> useCachedMem = -1

@17,693,268us: [+0 T:0x4016f000] ti.sdo.ce.alg - ALG_create> Enter (scratchId=1, fxns=0x2fba88, parentAlg=0x0, params=0xbebde70c, useCacheMem=-1)

@17,693,535us: [+2 T:0x4016f000] ti.sdo.ce.alg - ALG_create> algNumAlloc 5 memory recs

@17,693,722us: [+2 T:0x4016f000] ti.sdo.ce.alg - ALG_create> algAlloc returned numRecs=5

@17,693,876us: [+4 T:0x4016f000] ti.sdo.ce.alg - ALG_create>  Memory requested memTab[0]: size=0xf54, align=0x80, space=0x11, attrs=0x1

@17,694,035us: [+4 T:0x4016f000] ti.sdo.ce.alg - ALG_create>  Memory requested memTab[1]: size=0xc00, align=0x80, space=0x11, attrs=0x1

@17,694,245us: [+4 T:0x4016f000] ti.sdo.ce.alg - ALG_create>  Memory requested memTab[2]: size=0xc400, align=0x80, space=0x11, attrs=0x1

@17,694,404us: [+4 T:0x4016f000] ti.sdo.ce.alg - ALG_create>  Memory requested memTab[3]: size=0x968, align=0x80, space=0x11, attrs=0x1

@17,694,559us: [+4 T:0x4016f000] ti.sdo.ce.alg - ALG_create>  Memory requested memTab[4]: size=0x64, align=0x80, space=0x11, attrs=0x1

@17,694,709us: [+0 T:0x4016f000] ti.sdo.ce.alg - _ALG_allocMemory2> memTab=0x493a38, n=5, useCachedMem=-1

@17,695,042us: [+4 T:0x4016f000] OM - Memory_contigAlloc> CMEM_alloc(3924) = 0x4008a000.

@17,695,266us: [+4 T:0x4016f000] OM - Memory_contigAlloc> CMEM_getPhys(0x4008a000) = 0x83c36000.

@17,695,765us: [+4 T:0x4016f000] OM - Memory_contigAlloc> CMEM_alloc(3072) = 0x412db000.

@17,695,990us: [+4 T:0x4016f000] OM - Memory_contigAlloc> CMEM_getPhys(0x412db000) = 0x83c37000.

@17,696,413us: [+4 T:0x4016f000] OM - Memory_contigAlloc> CMEM_alloc(50176) = 0x4136e000.

@17,696,668us: [+4 T:0x4016f000] OM - Memory_contigAlloc> CMEM_getPhys(0x4136e000) = 0x83c38000.

@17,697,524us: [+4 T:0x4016f000] OM - Memory_contigAlloc> CMEM_alloc(2408) = 0x4008b000.

@17,697,769us: [+4 T:0x4016f000] OM - Memory_contigAlloc> CMEM_getPhys(0x4008b000) = 0x83c45000.

@18,029,511us: [+4 T:0x4016f000] OM - Memory_contigAlloc> CMEM_alloc(100) = 0x412dc000.

@18,029,761us: [+4 T:0x4016f000] OM - Memory_contigAlloc> CMEM_getPhys(0x412dc000) = 0x83c46000.

@18,030,005us: [+0 T:0x4016f000] ti.sdo.ce.alg - _ALG_allocMemory2> Returning (TRUE)

@18,030,433us: [+7 T:0x4016f000] ti.sdo.ce.alg - ALG_create> algInit call failed 49153

@18,030,667us: [+0 T:0x4016f000] ti.sdo.ce.alg - _ALG_freeMemory2> memTab=0x493a38, n=5, useCachedMem=-1

@18,031,678us: [+0 T:0x4016f000] ti.sdo.ce.alg - ALG_create> Exit (algHandle=NULL)

@18,031,941us: [+7 T:0x4016f000] ti.sdo.ce.alg.Algorithm - Algorithm_create> Algorithm creation FAILED; make sure that 1) alg params are correct/supported, 2) there is enough internal and external algorithm memory available

@18,032,133us: [+0 T:0x4016f000] ti.sdo.ce.alg.Algorithm - Algorithm_delete> Enter(alg=0x493a20)

@18,032,297us: [+0 T:0x4016f000] ti.sdo.ce.alg.Algorithm - Algorithm_delete> Exit

@18,032,441us: [+0 T:0x4016f000] ti.sdo.ce.alg.Algorithm - Algorithm_create> return (0x0)

@18,032,583us: [+6 T:0x4016f000] CV - VISA_create2> FAILED to create local codec.

@18,032,717us: [+0 T:0x4016f000] CV - VISA_delete(0x4939e8)

@18,032,907us: [+5 T:0x4016f000] CV - VISA_delete> deleting codec (localQueue=0xffff, remoteQueue=0xffff)

@18,033,094us: [+0 T:0x4016f000] ti.sdo.ce.image1.IMGENC1 - IMGENC_create> return (0x0)

 ERROR  (alg_jpgEnc.c|SnapshotFrameData|224): Failed to open snapshot algorithm: jpegenc (0x0)

@18,033,731us: [+0 T:0x4016f000] ti.sdo.ce.video1.VIDENC1 - VIDENC1_process> Enter (handle=0x493358, inBufs=0xbebde774, outBufs=0xbebdea28, inArgs=0xbebde844, outArgs=0xbebde8dc)

@18,033,939us: [+5 T:0x4016f000] CV - VISA_enter(visa=0x493358): algHandle = 0x492f88

@18,034,092us: [+0 T:0x4016f000] ti.sdo.ce.alg.Algorithm - Algorithm_activate> Enter(alg=0x492f88)

@18,034,311us: [+0 T:0x4016f000] ti.sdo.ce.alg.Algorithm - Algorithm_activate> Exit

@18,044,119us: [+5 T:0x4016f000] CV - VISA_exit(visa=0x493358): algHandle = 0x492f88

@18,044,388us: [+0 T:0x4016f000] ti.sdo.ce.alg.Algorithm - Algorithm_deactivate> Enter(alg=0x492f88)

@18,044,628us: [+0 T:0x4016f000] ti.sdo.ce.alg.Algorithm - Algorithm_deactivate> Exit

@18,044,797us: [+0 T:0x4016f000] ti.sdo.ce.video1.VIDENC1 - VIDENC1_process> Exit (handle=0x493358, retVal=0x0)

@18,045,232us: [+0 T:0x4016f000] ti.sdo.ce.video1.VIDENC1 - VIDENC1_delete> Enter (handle=0x493358)

@18,045,488us: [+0 T:0x4016f000] CV - VISA_delete(0x493358)

@18,045,635us: [+5 T:0x4016f000] CV - VISA_delete> deleting codec (localQueue=0xffff, remoteQueue=0xffff)

@18,045,831us: [+5 T:0x4016f000] CV - VISA_delete> deleting codec 0x492f88

@18,045,971us: [+0 T:0x4016f000] ti.sdo.ce.alg.Algorithm - Algorithm_delete> Enter(alg=0x492f88)

@18,046,126us: [+0 T:0x4016f000] ti.sdo.ce.alg - _ALG_allocMemory> memTab=0xbebde9cc, n=1

@18,046,271us: [+0 T:0x4016f000] ti.sdo.ce.alg - _ALG_allocMemory2> memTab=0xbebde9cc, n=1, useCachedMem=-1

 

Can anyone help me with this error?

 

Thanks and Regards,

Arpitha

  • Hi,

    How can you use h264dec lib to do JPEG file encoding? You need to use JPEGenc lib to do jpeg encoding.

    I think JPEGenc is already supported in IPNC SW. Have you check it?

  • Hi,

    As Chris mentioned you need only JPEGENC codec to convert YUV to JPEG images. No need of H264 codec.

    In your debug log I see that you are setting H264 encoder related params and calling H264 control call and you are calling JPEG encoder create . This is wrong. 

    IPNC RDK has JPEG encoder usage. Please refer that.

    Thanks,

    Veeranna

  • Hi Chris and veeranna,

     

    Thank you so much for your replies.

     

    Since I am a fresher, I have very little knowledge on this.

    Sorry if my questions are silly.

     

    I am not sure whether the RDK version has JPEG Encoder.

    It has H264, MJPEG and MPEG4 codecs

    With JPEG encoder you mean MJPEG codec?

     

    Before I was using IPNC_RDK version 3.0 with which my encoding was working perfect with the same setting (H264).

    Later we moved to IPNC_RDK version 5.0 with which I am having the above error.

     

    So could you please tell me the difference in the H264 encoder implementation between the two versions?

     

    Best Regards,

    Arpitha

  • Hi,

    I tried with MJPEG codec. It worked !!!

    Thank you

    Regards,

    Arpitha