刘品
学以致用---博主简介:专注语音、视频数字信号处理方面的研究以及算法在手机平台上面的移植和优化。涉及语音/音频编解码,语音增强,语音识别,语音音质客观评估,VOIP语音引擎 Qos算法模块和声音变速不变调和变调不变速等功能实现。熟悉ARM 各个系列的CPU,用ARMv4,ARMv5,ARMv6 and Cortex Neon 汇编优化相关算法代码,争取perforamance 最优。目前主要Windows mobile and Android platform上做相关speech/audio算法以及应用开发, HEVC 编解码器PC 和手机上的开发与应用。(交流Email:liupin.2008@gmail.com)

Dear Henry,
    In the document of <<Codec Engine Application Developer's Guide>>, it says "Each thread that uses an

Engine instance should perform its own
Engine_open call and use its own Engine handle. This protects each Engine instance from access by other

threads in a multi-threaded environment" .
    In my application, I need 2 engines for different puspose. So, following the instructions for integrating a

server, I wrote my Codec Engine configuration file, which contents are as follows:
/*********************** my.cfg ************************************/
/* Load engine1 */
var osalGlobal1 = xdc.useModule( 'ti.sdo.ce.osal.Global' );
osalGlobal1.runtimeEnv = osalGlobal1.DSPLINK_LINUX;
var MPEG2DEC1 = xdc.useModule('codecs.mpeg2dec.MPEG2DEC');
var Engine1 = xdc.useModule('ti.sdo.ce.Engine');
var demoEngine = Engine1.create("decode", [
    {name: "mpeg2dec", mod: MPEG2DEC1, local: false},
]);
demoEngine.server = "./decodeCombo.x64P";
Program.main = Program.system = null;

/* Load engine2 */
var osalGlobal2 = xdc.useModule( 'ti.sdo.ce.osal.Global' );
osalGlobal2.runtimeEnv = osalGlobal2.DSPLINK_LINUX;
var MPEG2DEC2 = xdc.useModule('codecs.mpeg2dec-ywg.MPEG2DEC');
var Engine2 = xdc.useModule('ti.sdo.ce.Engine');
var watermarkEngine = Engine2.create("watermarkengine", [
    {name: "watermark", mod: MPEG2DEC2, local: false},
]);
watermarkEngine.server = "./mpeg2dec.x64P";
Program.main = Program.system = null;
/*********************** my.cfg ************************************/

    And the application passed compiling with this configuration file. However, when executing the

application, I got the following trace message:
/************************** dump message *******************************/
CE T:0x4383bb60: Engine_open('decode', 0x0, 0x4383b460)
CE T:0x4383bb60: rserverOpen('./decodeCombo.x64P'), count = 0
OP T:0x4383bb60: Process_create('./decodeCombo.x64P', 0x437927c4)
OP T:0x40ba5b60: Process_create> Initializing DSP PROC...
OP T:0x40ba5b60: Process_create> Attaching to DSP PROC...
OP T:0x40ba5b60: Process_create> Opening MSGQ pool...
OP T:0x40ba5b60: Process_create> Loading ./decodeCombo.x64P on DSP (1 args)...
OP T:0x40ba5b60: Process_create> Starting DSP PROC...
OP T:0x40ba5b60: Process_create> Opening remote transport...
OP T:0x40ba5b60: Process_create> Returning successfully.
OP T:0x40ba5b60: putReply(0x1): proc = 0x97438
CE T:0x4383bb60: rserverOpen('./decodeCombo.x64P'): 0x94a28 done.
CE T:0x4383bb60: checkServer(0x97408)
[DSP] ZZ T:0x0: main> Welcome to decode server's main().
CE T:0x4383bb60: Engine_open('watermarkengine', 0x0, 0x4383b460)
CE T:0x4383bb60: rserverOpen('./mpeg2dec.x64P'), count = 1
CE T:0x4383bb60: rserverOpen('./mpeg2dec.x64P'): 0x0 done.
CE T:0x4383bb60: Engine_close(0x97458)
OP T:0x40ba5b60: putReply(0x1): proc = 0x0
OP T:0x40ba5b60: daemon() terminating
/************************** dump message *******************************/

    It seems that DSP does not allow to get two engine opened.
    The two servers runs well when executed seperately. But when I need them to work together, they do

not cooperate.
    Could you please point out what was wrong and tell me how to fix this problem?
   
Best regards,

Bavon
Oct. 1st, 2006

Henry的回复:

Bavon,
 
Based on the configuration, the customer has defined 2 engines: demo engine and watermark engine.

Each engine requires a different server image to run on the dsp (decodeCombo.x64P and

mpeg2dec.x64P). It is not possible to load and execute both images at the same time, hence the failure. It

is however possible to concurrently use multiple engines; e.g., you can open any number of “local” engines

and any number of engines that use exactly the same server image.  You can not, however, concurrently

use multiple engines that use different server images.  Opening an engine implicitly loads the DSP with the

server image required by the engine if it is not already loaded.
 
In our supported model, only one engine can be run at once. Note that in a multi-threaded application,

Engine_open() must be called in each thread in order to obtain separate engine handles to allow

concurrency (each handle uses its own set of message queues to talk to the DSP); however, the calls must

be for the same type of engine. 
 
If the two engines are needed simultaneously, then they must ask the server integrator to combine the two

engines into a single one that can run either algorithm. Then in the application configuration, they can do

the following:
 
var osalGlobal1 = xdc.useModule( 'ti.sdo.ce.osal.Global' );
osalGlobal1.runtimeEnv = osalGlobal1.DSPLINK_LINUX;
var MPEG2DEC1 = xdc.useModule('codecs.mpeg2dec.MPEG2DEC');
var MPEG2DEC2 = xdc.useModule('codecs.mpeg2dec-ywg.MPEG2DEC');
var Engine = xdc.useModule('ti.sdo.ce.Engine');
var combinedEngine = Engine.create("decode", [
    {name: "mpeg2dec", mod: MPEG2DEC1, local: false},
    {name: "watermark", mod: MPEG2DEC2, local: false},
]);
combinedEngine.server = "./newCombo.x64P";
Program.main = Program.system = null;
 
Note that the algorithm instance is not created until VIDDEC_create is called, so if VIDDEC_create is only

called for mpeg2dec, no watermark algorithm instance is created, even though they are in the same

engine.
 
If the two engines are not needed simultaneously, and if the server integrator is unable to combine the two

engines for some reason (e.g. the two engines came from different ASPs), they can try closing the first

engine with Engine_close() before opening the 2nd one. But IMO combining the engines is the best

approach whenever possible.
 
As an aside, I’d strongly recommend that you talk to the codec developer(s) for these two engines. Codec

package/module name (e.g. codecs.mpeg2dec.MPEG2DEC and codecs.mpeg2dec-ywg.MPEG2DEC)

should contain the vendor name at the very least. This is a good practice to avoid potential collisions. For

example, if a server integrator wishes to combine an mpeg2dec from Ateme and another from TI into a

single engine, he or she cannot work with both being named codecs.mpeg2dec.MPEG2DEC, The

xdc.useModule() call will not be able to distinguish between the two. TI and Ateme should name their

codecs as
 
ti.codecs.mpeg2dec.MPEG2DEC
ateme.codecs.mpeg2dec.MPEG2DEC

链接:http://bavon.bokee.com/5723797.html

posted on 2008-10-17 10:01  liupin  阅读(777)  评论(0)    收藏  举报

-->