This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Can I decode two or more h.264 files simultaneously on DM6467 ?

Dear sir:

I am using DM6467 now, I need to decode two or more h.264 files simultaneously and show on multi screen.

I use /dvsdk_1_40_00_31/dvsdk_demos_1_40_00_18/dm6467/decode/main.c sample code to do this.

In sample code only has one video decode thread to do one file decode job,

now I create 2 same video decode thread to do 2 files decode job.

BUT, when program runs to "ret = Vdec2_process(hVd2, hInBuf, hDstBuf); " line, it suddenly stop !!!!

No error message displayed.

It has been nagging me for couple days, can anyone help me ??

Thanks !!

 

Tai Chang.

  • What version of codec engine are you running?  I believe earlier versions of codec engine did not allow you to call into codec engine (e.g. process function) more than once  (see http://wiki.davincidsp.com/index.php?title=Codec_Engine_Roadmap )

    Also, are you creating two unique instances of the codec or are you simply using two threads to access same instance of the codec?

     

  • Hi Juan,

    The SDK version is DM6467_DVSDK_1_40_02_33,

    The codec engine is "codec_engine_2_10_02"

    I use two threads to access same instance of the codec in one process.

     Below is my code:

        for(i=0;i<2;i++) 
        {
            /* Create the video thread */
            videoEnv[i].hRendezvousInit    = hRendezvousInit;
            videoEnv[i].hRendezvousCleanup = hRendezvousCleanup;
            videoEnv[i].hRendezvousLoop    = hRendezvousLoop;
            videoEnv[i].hRendezvousLoader  = hRendezvousLoader[i];
            videoEnv[i].hPauseProcess      = hPauseProcess;
            videoEnv[i].hPausePrime        = hPausePrime[i];
            videoEnv[i].hDisplayInFifo     = displayEnv.hInFifo[i];
            videoEnv[i].hDisplayOutFifo    = displayEnv.hOutFifo[i];
            videoEnv[i].engineName         = ENGINE_NAME;
            videoEnv[i].videoFile          = args.videoFile[i];
            videoEnv[i].videoDecoder = args.videoDecoder[i];  
            videoEnv[i].loop               = args.loop;

            if (pthread_create(&videoThread[i], &attr, videoThrFxn, &videoEnv[i])) {
                ERR("Failed to create video thread\n");
                cleanup(EXIT_FAILURE);
            }

            //Wait for the Loader to be created in the video thread before launching the loader thread.
            Rendezvous_meet(hRendezvousLoader[i]);
        }

     Can I use the video thread like this ?

     THe "videoThrFxn" part is the same as release,

    So, can I call "Engine_open", "Vdec2_create" and "BufTab_create" in each thread within multi thread process ?

     

    BTW, Can I use "displayThrFxn" in multi thread process, that means each video thread use one display thread to display video?

     

     

    Really thanks !!

     

    Tai chang.

  • Tai Chang said:

    So, can I call "Engine_open", "Vdec2_create" and "BufTab_create" in each thread within multi thread process ?

    I believe you can so long as the Engine_open is calling on the same exact engine as the other thread; in other words, you can only load one DSP image (represented by a codec engine server) on the DSP at any one time.

    Tai Chang said:

    BTW, Can I use "displayThrFxn" in multi thread process, that means each video thread use one display thread to display video?

    You can create two display threads from each video thread (each thread wil be given a unique ID); however, if you are using the same displayThrFxn function, it is your responsability to make sure 'displayThrFxn' is re-entrant.  This means avoiding use of global variables (or protecting them with mutexes or such...) and not grabbing the same resources (e.g. same frame buffer device such as /fb/dev/1...).

    I hope this helps.

     

     

  • Juan said:

    I believe you can so long as the Engine_open is calling on the same exact engine as the other thread; in other words, you can only load one DSP image (represented by a codec engine server) on the DSP at any one time.

    This means each video thread has to finish process one frame done then release the codec engine to another video thread ?

     

  • Tai Chang said:
    This means each video thread has to finish process one frame done then release the codec engine to another video thread ?

    No; once the unique Engines are opened in each thread (by each calling Engine_open()), you can call *_process() from each thread without the other knowing about it.  Juan's point was just this one:

    http://tiexpressdsp.com/index.php?title=Codec_Engine_FAQ#Can_I_have_multiple.2C_different_engines_open_at_the_same_time.3F

    Chris

  • I got it, thank you !!