180 likes | 312 Views
Overview. General View of DAVINCI development Developing non-XDM algorithms. What is DAVINCI. Typical application runtime. The development procedure. Developing non-XDM algorithms. Application range. Development overview.
E N D
Overview • General View of DAVINCI development • Developing non-XDM algorithms
Developing non-XDM algorithms • Application range
Development overview • Codec Engine provides an easy-to-use application interface-VISA-for multi-media developers to integrate and deploy compliant codecs. CE uses the codec’s xDM interface to call specific processing and control functions. • Developing non-XDM is extend CE by adding new VISA-like APIs for remotely accessing xDAIS algorithms that do not implement the xDM interface.
1.The GPP-side ap-plication makes an algorithm MOD_pro-cess() call. 2.CE forwards this call and its argume-nts to the GPP-side algorithm stub. 3.The stub places the arguments in an inter-CPU message and replaces all GPP-side (virtual address) pointer values with DSP-side (physical address) values. This called “marshalling” the arguments. 4.CE delivers the message to the DSP-side algorithm skeleton. 5.The skeleton unmarshals the arguments and calls the actual xDAIS algo-rithm’s process() function. 6.On the way back, the skeleton marshals any return arguments, places th-em in a message, and the stub unmarshals them for the application.
Tasks (The core xDAIS algorithm interface is alre-ady there.) • Create CE extension layer. • Custom stub interface • Custom skeleton interface • Perform CE packaging and configuration (Codec Server & Codec Engine engineers’ job)
Create CE extension layer • Design a new application interface, including the following core functions: ROTATE_create(), ROTATE_delete(), ROTATE_process()
ROTATE_Handle ROTATE_create(Engine_Handle server, String name, ROTATE_Params *params) { ROTATE_Handle visa; static Bool curInit = FALSE; if (params == NULL) { params = &ROTATE_PARAMS; } visa = VISA_create(server, name, (IALG_Params *)params, sizeof (_ROTATE_Msg), "ti.sdo.apps.extensions.rotate.IROTATE"); return (visa); }
Void ROTATE_delete(ROTATE_Handle handle) { VISA_delete(handle); }
XDAS_Int32 ROTATE_process(ROTATE_Handle handle, char inBuf[], char outBuf[], XDAS_Int32 bufSize, XDAS_Int16 cosine, XDAS_Int16 sine) { Int32 retVal = ROTATE_EFAIL; ROTATE_InArgs inArgs; inArgs.bufSize = bufSize; inArgs.cosine = cosine; inArgs.sine = sine; if (handle) { IROTATE_ADAPT_Fxns *fxns = (IROTATE_ADAPT_Fxns *)VISA_getAlgFxns((VISA_Handle)handle); IROTATE_Handle alg = VISA_getAlgHandle((VISA_Handle)handle); if (fxns && (alg != NULL)) { VISA_enter((VISA_Handle)handle); retVal = fxns->process(alg, (XDAS_Int8 *)inBuf, (XDAS_Int8 *)outBuf, &inArgs); VISA_exit((VISA_Handle)handle); } } return (retVal); }
Create CE extension layer • Develop CE stubs • Define a new VISA “message” type used for marshalling and unmarshalling call • Marshal the call and its arguments using the VISA “message” • Dispatch the call to the server • Unmarshal the returned arguments • Free any required VISA message • Return the results of remote computation
/* ======== rotate_stubs.c ========*/ _ROTATE_Msg *msg; if ((msg = (ROTATE_Msg *)VISA_allocMsg(visa)) == NULL) { return (ROTATE_ERUNTIME); } //Create the “message” msg->visa.cmd = _ROTATE_CPROCESS;//Set the command ID msg->cmd.process.inBuf = (XDAS_Int8 *) Memory_getBufferPhysicalAddress(inBuf, inArgs->bufSize, NULL); if (msg->cmd.process.inBuf == NULL) { retVal = ROTATE_ERUNTIME; }//Marshalling:Translate the address references to server’s address space msg->cmd.process.outBuf = (XDAS_Int8 *) Memory_getBufferVirtualAddress(outBuf, inArgs->bufSize, NULL); if (msg->cmd.process.outBuf == NULL) { retVal = ROTATE_ERUNTIME; }//Unmarshalling msg->cmd.process.inArgs = *inArgs; retVal = VISA_call(visa, (VISA_Msg *)&msg); exit: VISA_freeMsg(visa, (VISA_Msg)msg); return (retVal);//return the rusults of remote computation
Create CE extension layer • Develop skeletons for CE extension • Select the dispatch function by parsing the command ID in the message • Unmarshalling “processing” function arguments • Call the core xDAIS algorithm interface function • Marshal return arguments into the reply message • Send the reply message back to the caller
/* ======== rotate_skel.c ========*/ static VISA_Status call(VISA_Handle visaHandle, VISA_Msg visaMsg) { _ROTATE_Msg *msg = (_ROTATE_Msg *)visaMsg; ROTATE_Handle handle = (ROTATE_Handle)visaHandle; switch (msg->visa.cmd) { case _ROTATE_CPROCESS: { inBuf = msg->cmd.process.inBuf; outBuf = msg->cmd.process.outBuf; Memory_cacheInv(inBuf, msg->cmd.process.inArgs.bufSize); /* make the process call */ msg->visa.status = ROTATE_process(handle, (char *)inBuf, (char *)outBuf, msg->cmd.process.inArgs.bufSize, msg->cmd.process.inArgs.cosine, msg->cmd.process.inArgs.sine); Memory_cacheWbInv(outBuf, msg->cmd.process.inArgs.bufSize); break; } default: { msg->visa.status = VISA_EFAIL; break; } } return (VISA_EOK); }
Packaging the extension Compile the packaging file: package.xdc, package.xs, package.bld, IROTATE.xdc, makefile Build the extension package
Advice and Criticism are warmly welcomed!