|
|
用户名:bavon 笔名:bavon 地区: 湖北-武汉 行业:其他 |
| 日 | 一 | 二 | 三 | 四 | 五 | 六 |
天是灰色的,心是蓝色的…
如何到达浙江大学玉泉校区
浙大保送复试经验
integrate 2 engines
我发的邮件:
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
i830_wait_ring error解决了
设置locale
[转贴] 如何在C中使用C++的类
Bus error的解决方法
[转贴]完全用GNU/Linux工作
Win32下汇编语言常用批处理文件
在Win32下进行汇编语言编程时,经常需要在汇编、资源转换和连接等一系列操作之后才可能生成可执行文件,而在这些过程中如果只是仅仅使用ML.EXE、RC.EXE、CVTRES.EXE和LINK.EXE来进行的话,繁多的参数输入也挺让人烦的。鉴于此,笔者写了几个批处理文件myMasm.bat、myCvt.bat和myLink.bat分别来执行汇编、资源转换和连接等操作,最后还写了一个能将上述操作同时完成的批处理文件myMake.bat。
为了使用该处理文件,有一些规则得统一。
1. ML.EXE、RC.EXE、CVTRES.EXE和LINK.EXE这几个文件必须放在目录\masm32\bin里面。
2. 如果你还有资源文件,其命名方式为你的源文件名字(不含扩展名)加“-RC.rc”。例如你的源文件为Hello.asm,则你的资源文件应该命名为Hello-RC.rc。
3. 使用这些批处理文件的时候,只需输入相应的批处理文件名加源文件名字(不含扩展名)。例如你要操作的文件有Hello.asm和Hello-RC.rc,那么如果执行下面的操作成功的话将会产生一个Hello.exe。所用操作如下:
mymasm hello
mycvt hello (注:如果没有Hello-RC.rc,此操作可以省略)
mylink hello
或者你直接使用
mymake hello
也可以直接产生上述3个操作的结果,获得Hello.exe。
这4个批处理文件的内容如下所示,只需将其内容复制并按其文件名创建批处理文件。
REM myMasm.bat
@echo off
cls
if exist "%1.obj" del "%1.obj"
\masm32\bin\ml /c /coff /Fl "%1.asm"
if errorlevel 0 dir "%1.*"
if not exist "%1.obj" echo Assembling Failed!
if exist "%1.obj" echo Assembling Succeeded!
REM myMasm.bat
REM myCvt.bat
@echo off
cls
\masm32\bin\rc "%1-RC.rc"
\masm32\bin\cvtres /machine:ix86 "%1-RC.res"
if errorlevel 0 dir "%1.*"
if not exist "%1-RC.obj" echo Converting Failed!
if exist "%1-RC.obj" echo Converting Succeeded!
REM myCvt.bat
REM myLink.bat
@echo off
cls
if exist "%1.exe" del "%1.exe"
if not exist "%1-RC.obj" goto nores
\masm32\bin\Link /SUBSYSTEM:WINDOWS "%1.obj" "%1-RC.obj"
goto done
:nores
\masm32\bin\Link /SUBSYSTEM:WINDOWS "%1.obj"
:done
if errorlevel 0 dir "%1.*"
if not exist "%1.exe" echo Linking Failed!
if exist "%1.exe" echo Linking Succeeded!
REM myLink.bat
REM myMake.bat
@echo off
cls
:1_masm
if exist "%1.obj" del "%1.obj"
\masm32\bin\ml /c /coff /Fl "%1.asm"
if not exist "%1.obj" echo Assembling Failed!
if not exist "%1.obj" goto done
:2_convert
if not exist "%1-RC.rc" goto 3_link
if exist "%1-RC.obj" del "%1-RC.obj"
\masm32\bin\rc "%1-RC.rc"
\masm32\bin\cvtres /machine:ix86 "%1-RC.res"
if not exist "%1-RC.obj" echo Converting Failed!
if not exist "%1-RC.obj" goto done
:3_link
if exist "%1.exe" del "%1.exe"
if not exist "%1-RC.obj" goto nores
\masm32\bin\Link /SUBSYSTEM:WINDOWS "%1.obj" "%1-RC.obj"
goto done
:nores
\masm32\bin\Link /SUBSYSTEM:WINDOWS "%1.obj"
:done
if errorlevel 0 dir "%1.*" "%1-RC.*"
if exist "%1.exe" echo %1.exe was successfully made!
if not exist "%1.exe" echo %1.exe was NOT made!
REM myMake.bat