我的DM368系统,需要在进行H264编码的时候,同时进行JPEG去完成图片抓拍。
单独创建和使用JPEG编码器和H264编码器都没有问题。但是当我先创建了JPEG编码器成功后,再去创建H264编码器,H264编码器就会创建失败。
反之先创建H264编码器成功,再去创建JPEG编码器就会失败。原因是JPEG和H264的EDMA资源限制,请教各位问题如何解决?十分感谢。
DVSDK version is 4_02_00_06
linux-2.6.32.17-psp3.01.01.39
Codecs-dm365_4_02_00_00
linuxutils_2_26_01_02
framework-components_2_26_00_01
创建H264编码器失败的信息如下:
EDMAK Error: dma_ioctl: REQUESTDMA failed: -12
EDMA Error: EDMA_IOCREQUESTDMA error
Error: major Failed to create video encoder: h264enc
CMEM Error: allocHeap: Failed to mmap buffer at physical address 0x84192000
CMEM Error: Freeing phys buffer 0x84192000
Failed to allocate memory.
Error: Failed to allocate contiguous buffers
.cfg配置文件如下:
/* Load support for the Codec Engine OSAL */
var osalGlobal = xdc.useModule('ti.sdo.ce.osal.Global');
osalGlobal.runtimeEnv = osalGlobal.LINUX;
/* Load support for the 'Davinci Multimedia Application Interface' module */
var DMAI = xdc.loadPackage('ti.sdo.dmai');
environment['xdc.cfg.check.fatal'] = 'false';
var RMAN = xdc.useModule('ti.sdo.fc.rman.RMAN');
RMAN.useDSKT2 = false;
RMAN.persistentAllocFxn = "__ALG_allocMemory";
RMAN.persistentFreeFxn = "__ALG_freeMemory";
RMAN.semCreateFxn = "Sem_create";
RMAN.semDeleteFxn = "Sem_delete";
RMAN.semPendFxn = "Sem_pend";
RMAN.semPostFxn = "Sem_post";
RMAN.tableSize = 10;
var EDMA3 = xdc.useModule('ti.sdo.fc.edma3.Settings');
var vicp = xdc.useModule('ti.sdo.linuxutils.vicp.VICP');
var HDVICP = xdc.useModule('ti.sdo.fc.ires.hdvicp.HDVICP');
var VICP2 = xdc.useModule('ti.sdo.fc.ires.vicp.VICP2');
var VICPSYNC = xdc.useModule('ti.sdo.fc.vicpsync.VICPSYNC');
var HDVICPSYNC = xdc.useModule('ti.sdo.fc.hdvicpsync.HDVICPSYNC');
var MEMUTILS = xdc.useModule('ti.sdo.fc.memutils.MEMUTILS');
var ADDRSPACE = xdc.useModule('ti.sdo.fc.ires.addrspace.ADDRSPACE');
var EDMA3CHAN = xdc.useModule('ti.sdo.fc.ires.edma3chan.EDMA3CHAN');
var EDMA = xdc.useModule('ti.sdo.linuxutils.edma.EDMA');
var CMEM = xdc.useModule('ti.sdo.linuxutils.cmem.CMEM');
var MEMTCM = xdc.useModule('ti.sdo.fc.ires.memtcm.MEMTCM');
MEMTCM.cmemBlockId = 1; //Since we use _1 in our insmod command.
xdc.loadPackage("ti.sdo.ce.video2");
xdc.loadPackage("ti.sdo.fc.hdvicpsync");
/*
* ======== Engine Configuration ========
*/
var H264ENC = xdc.useModule('ti.sdo.codecs.h264enc.ce.H264ENC');
var AACENC = xdc.useModule('ittiam.codecs.aaclc_enc.ce.AACLC_ENC');
var JPEGENC = xdc.useModule('ti.sdo.codecs.jpegenc.ce.JPEGENC');
var AACDEC = xdc.useModule('ittiam.codecs.aac_dec.ce.AAC_DEC');
var Engine = xdc.useModule('ti.sdo.ce.Engine');
var myEngine = Engine.create("SF_TVS3000I", [
{name: "h264enc", mod: H264ENC, local: true, groupId: 1},
{name: "aacenc", mod: AACENC, local: true},
{name: "jpegenc", mod: JPEGENC, local: true, groupId: 2},
{name: "aacdec", mod: AACDEC, local: true},
]);
/*
* Turn cache on while running the AAC encoder to achieve better performance. * The rest of the codecs are unaffected.
*/
AACENC.useCache = true;
/*
xdc.loadPackage('ti.sdo.fc.ires.vicp').profile = "debug_trace";
xdc.loadPackage('ti.sdo.fc.ires.edma3chan').profile = "debug_trace";
xdc.loadPackage('ti.sdo.fc.rman').profile = "debug_trace";
xdc.loadPackage('ti.sdo.fc.edma3').profile = "debug_trace";
EDMA3CHAN.trace = true;
EDMA3CHAN.debug = true;
*/
su shell:
我也遇到同样的问题,求解!谢谢!
我在论坛上看到“Now having said that, we have some mechanism in which we can run JPEG and H.264 in parallel. We need to use the following options:
1. Use scratchGroup Id = 1 for H.264 encoder, scratchGroupId = 2 for JPEG in your .cfg file
2. Release some EDMA channels from the kernel. You have to free atleast 4-6 channels and it can be done in edma.c in the linux kernel source code. The choice of channels to remove depends on your use case and the peripherals you use.
3. Turn on enableDDR parameter of H.264 encoder.
If you have IPNC Reference Design software, you can refer to it for item #1 and #3. But in IPNC also, we do not run JPEG and H.264 in parallel.
Please note that MPEG4 and H.264 cannot run in parallel due to EDMA channel limitation, so keep them both in some scratchGroupId.
Regards,”
e2e.ti.com/…/40743.aspx 但是照他的方法试了仍然不能解决,希望能得到指点,万谢!
su shell:
回复 su shell:
解决了,
“Assignment of alg resources through RMAN FAILED (0x7) ”CE_DEBUG=2得到的info。
在cfg中添加EDMA3.maxRequests = 128;重新编辑。运行即可
e2e.ti.com/…/298344.aspx