Codec Engine SOS)

來源:互聯網
上載者:User

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.