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.

questions about h264hpvenc runs on a single core except core 0 in C6678

Other Parts Discussed in Thread: TMS320C6678

Hi,everyone

  C66x_h264hpvenc_01_00_01_04_ELF can run on a single core core0 successfully;

  C66x_h264hpvenc_01_00_01_04_ELF can run on multicore  successfully,core0 as IVIDMC_TASK_MASTER ;

  Now I have a problem:  when I run C66x_h264hpvenc_01_00_01_04_ELF on the TMS320C6678 EVM, 

   1   for example ,if run on core 1, in a file  encoder.cfg,modified

   ncores                  = 1
  CoreTeamMap      = 1;

on a single core run,current core id as IVIDMC_TASK_MASTER , I found that h264hpven can run on core0,but except core 0, on other core      C66x_h264hpvenc_01_00_01_04_ELF can't run,failed reason is sharing region  fialed ,

I found that function  ipcCreateShare(sizeof(H264HPVENC_Shared_MemTab),                                                             (void**)&codecShm);  failed;

because of variable codecShm is null;

so I modified h264hpvenc.cfg file,for example h264hpvenc run on core,,in this file,I modified

SharedRegion.setEntryMeta(0,     { base: Program.global.shmSL2Base,       len: Program.global.shmSL2Size,       ownerProcId: 0,       isValid: true,       cacheEnable: true,           cacheLineSize: 64,       name: "ipc_internal_shared_mem",     });

to

   SharedRegion.setEntryMeta(0,     { base: Program.global.shmSL2Base,       len: Program.global.shmSL2Size,       ownerProcId: 1,       isValid: true,       cacheEnable: true,           cacheLineSize: 64,       name: "ipc_internal_shared_mem",     });

     I found  variable codecShm is non zero, function ipcCreateShare() can run  successfully.C66x_h264hpvenc_01_00_01_04_ELF can run,but I found bits number of output stream is 0,loutArgs->bytesconsumed = 0,function H264HPVENC_encodeFrame() return 0;

    via analyzing,I found H264HPVENC_encodeFrame() only encoded  frame header,when encoding the first macroblock ,not successfully,exit for unkwown reason;

     I want to know,above modification is whether right or not ; if C66x_h264hpvenc_01_00_01_04_ELFwant to run on a single core run successfully except core 0,what  I should do?,How do?Thanks!

The encoder errors are as follows:

[C66xx_1]
---------------------------------------------------------
Test Case Number : 1
---------------------------------------------------------
Config File   : ..\..\..\Test\TestVecs\Config\encoder.cfg
Input YUV     : ..\..\..\Test\TestVecs\Input\airshow_p352x288.yuv
Output Stream : ..\..\..\Test\TestVecs\Output\airshow_p352x288.264

ShmemTab initialized on Core 1

Algorithm Instance  Creation for the Module DEV.H264HP.E.C6678.01.00.01.04 Done...

Started Reading Frame : 0.......

Frame_Cycles :  0.102369
#0    : IVIDEO_IDR_FRAME      : Bits  : 0        

Started Reading Frame : 1.......

Frame_Cycles :  0.119687
#1    : IVIDEO_P_FRAME        : Bits  : 0        

Started Reading Frame : 2.......

Frame_Cycles :  0.118790
#2    : IVIDEO_P_FRAME        : Bits  : 0        

Started Reading Frame : 3.......

Frame_Cycles :  0.118818
#3    : IVIDEO_P_FRAME        : Bits  : 0   

2

 for example ,if run on core 1 and core2, in a file  encoder.cfg,modified

   ncores                  = 2  

   CoreTeamMap      = 1,2;

on multicore(except core 0) run,for example ,run on core 1and core2,core 1 as IVIDMC_TASK_MASTER, the same question exists;

  thanks,I am looking forward to your answer;

  • Hi Jingshuai,

    I haven't yet tested it in my side, but in a quick look I see

    ividmc.h(38): IVIDMC_TASK_MASTER = 0,

    have you try changing this value to 1?

    Thank you,

    Paula

  • Hi Jingshuai,

    Codec treats a core as Master when coreID = 0. This is application level setting and the physical core(DNUM register) can be any any core from 0 to 7 for C6678.

    Please see this link for different single core and multicore scenarios.

    Regards

    Sudheesh

  • HI  Paula,

     

    I will  try  changing this value to 1,if you have any good idea,please tell me at any moment.

     

    Thank you very much.

    jingshuai

     

  • HI  Sudheesh:

        I will try it, I will tell you if I have a result.

    Thank you very much;

    jingshuai

     

  • Hi Jingshuai, please try Sudheesh suggestion first. By the way are you using a Shannon EVM or a Quad-Shannon board (DSPC8681)?

    Thank you,

    Paula

  • HI,Paula

    I  are using a Shannon EVM.after running successfully, it will run on advantech 8901(i.e. 20 dsps,160 cores).

    Thank you,

     

    jingshuai

     

  • HI  Paula,

           I  try Sudheesh suggestion,currently,Encoder can Run a single core successfully.

    i.e.  Scenario #1 is OK;

          but Scenario #2 is failed.

       1)

       Scenario #1: Single core usage
     Multicore codec works on Master-Slave model.
     When core ID is set as zero, codec treat that core as Master core.
     
     For core7, DNUM will be 7.
     But you can set coreID = 0 (instead of DNUM value);
     core_task_ID = Master and ncores = 1;
     It will work fine.
     
     
     Scenario #2: Multi core usage , You want to run codec on Core #6 and Core #7
     You can set the values as below.
     
     For Core #6, your DNUM will be 6.
     coreID = 0; core_task_ID = Master;
     
     For Core #7, your DNUM will be 7.
     coreID = 1; core_task_ID = Slave;
     
     ncores = 2;

     

    2)  Multi core usage,except  aboved modified place,I modified ownerProcId in file H264VEncApp6678.cfg also.

    for example ,Scenario #2:

    SharedRegion.setEntryMeta(0,
        { base: Program.global.shmSL2Base,
          len: Program.global.shmSL2Size,
          ownerProcId: 0,
          isValid: true,
          cacheEnable: true,    
          cacheLineSize: 64,
          name: "ipc_internal_shared_mem",
        });

    -->

    SharedRegion.setEntryMeta(0,
        { base: Program.global.shmSL2Base,
          len: Program.global.shmSL2Size,
          ownerProcId: 6,
          isValid: true,
          cacheEnable: true,    
          cacheLineSize: 64,
          name: "ipc_internal_shared_mem",
        });

     

     in a file  encoder.cfg,modified

       ncores                  = 2
      CoreTeamMap      = 6,7

    in function Encode_Task(),  modified if(DNUM==0) to if(DNUM == 6)  for encoder initialing

    in function ipcAttachOwner(),modified i to CORE_TEAM_MAPPING[i];

    void ipcAttachOwner(UInt numCores)
    {
      SharedRegion_Entry entry;
      int  status;

      /* get region 0 information */
      SharedRegion_getEntry(0, &entry);

      /* Must attach to owner first to get default GateMP and HeapMemMP */
      if (MultiProc_self() != entry.ownerProcId) {
          do {
              status = Ipc_attach(entry.ownerProcId);
              if (status < 0) {
                Task_sleep(1);
              }
          } while (status < 0);
      } else {
      /* Owner core needs to call Ipc_attach() for remote processors. */
          int i;
     
          for (i = 0; i < numCores; i++) {         
              /* Bypass itself */
              if (CORE_TEAM_MAPPING[i] == MultiProc_self())  {
                  continue;
              }
              do {
                  status = Ipc_attach(CORE_TEAM_MAPPING[i]);
                  if (status < 0) {
                    Task_sleep(1);
                  }
              } while (status < 0);
          }
      }

     

    encoder  error;

    [C66xx_7]
    ---------------------------------------------------------
    Test Case Number : 1
    ---------------------------------------------------------
    [C66xx_6] Config File   : ..\..\..\Test\TestVecs\Config\encoder.cfg
    Input YUV     : D:\h264\shiquanshimei40s.yuv
    Output Stream : ..\..\..\Test\TestVecs\Output\airshow_p720x576.264

    [C66xx_7] ShmemTab initialized on Core 1
    [C66xx_6] ShmemTab initialized on Core 0

    Algorithm Instance  Creation for the Module DEV.H264HP.E.C6678.01.00.01.04 Done...
    [C66xx_7]
    Algorithm Instance  Creation for the Module DEV.H264HP.E.C6678.01.00.01.04 Done...

    Control Failed.
    Failed in control call (XDM_SETPARAMS).
    [C66xx_6]


     ******** Request to END H264 Encoder ********
    [C66xx_7]


     ******** Request to END H264 Encoder ********

     

      Can I need to modified any other place in  C66x_h264hpvenc_01_00_01_04_ELF project?

    I am looking for your answer!!!

    Thank you

    jingshuai

     

     

     

  • HI Sudheesh,

          thank you for your answer!I  Encoder can Run on a single core successfully,but Multi core usage is failed ;

    i.e.  Scenario #1 is OK;

          but Scenario #2 is failed.

    detailed description is aboved for replying to  Paula ;

    I am looking forward to your answer!

    Thank you

    jingshuai!

     

  • Hi jingshuai,

    I could reproduce the issue and found slave shared memory is not synced to master in this case, thereby failing at setparams. We will further look in to the issue and will root cause the issue.

    Thanks and regards

    Sudheesh

  • Hi Jingshuai, just wanted to touch bases with you, we are working on this and we will try to update you by the end of the week.

    thank you,

    Paula

  • Hi Jingshuai,

    Please find the attached files which have application level changes for taking user core configuration for running at C66x platform for different physical core ids(DNUMs).

    Changes are mainly in ipc level and shared memory management to level to attach correct id and shared memory.

    Please tell us if you need any further information.

    Thanks and regards

    Sudheesh

  • HI Sudheesh,

    I find that the link “attached files” is not opened.please give me a new link for downloading attached files.

     

     

    thanks and regards

     

    jingshuai

  • Hi jingshuai,

    I verified the link again from other PCs. It is working.

    It's a google drive file link. And you have the download option at the right edge when you click.

    In case it is not working, you can send me your email id to my mail(please select my profile to see that), then I will send you the files.

    (Attachment option in E2E reply interface is not working.)

    Regards

    Sudheesh

  • HI Sudheesh,

     I can't open this link,my email is      personalmaterial@163.com     ,I have send you my email,you can send me the files by email.

    I have another question:

      currently,code of the H264 decoder and encoder  library is stored in MSMCSRAM,now I want to move code of the H264 decoder and encoder  library to DDR,how do I should do ? 

  • Hi jingshuai,

    In h264hpvenc.cfg, you can change .text section similar to below to push code section to DDR.

    Program.sectMap[".text"] = "ERAM";
    Program.sectMap[".text:cabac"] = "ERAM";

    Moving code memory to external memory will have performance impact.

    Thanks and regards

    Sudheesh

  • Praveen, Sudheesh, thanks for all your help here,

    Paula

  • Hi  Sudheesh,

     According to  your answer ,I am verifying it,when I am running C66x_h264hpvdec_01_01_01_04_ELF on core 2 about 8901,I met a question ;

    the description is the following as:

         1)the program is in dead loop in function  ECPY_directWait() of  H264dec library.

         2)the program prompts this function is located in 

          at "/db/atree/library/trees/fc/fc-r16/src/ti/sdo/fc/ecpy/ecpy_directwait.h" 

         I think it is a question about  DMA waiting complete,missing interrupt,is it ?

     

          

  • Hi Jingshuai,

    The files I sent, can be compared with H264 HP Encoder only (C66x_h264hpvenc_01_00_01_04_ELF). Please check it with H264 HP encoder application and lib.

    The logic of proc id and shared memory management can be applicable across shannon platforms with its ipc mechanism but I dont know about that in C66x H264 HP Decoder.

    Please raise this decoder problem you are facing as a separate thread, so that concerned experts will see the problem quickly.

    Thanks and regards

    Sudheesh

  • Hi Jingshuai,

    The codec experts point it out this issue was fixed in latest release. Please use latest HP decoder (C66x_h264hpvdec_01_01_03_00_ELF) which is available on the external web (http://software-dl.ti.com/dsps/dsps_public_sw/codecs/C6678/H264HP_D/latest/index_FDS.html).

    Thank you,
    Paula

     

  • HI Sudheesh,

    I'm facing a question,on 8901,decoder runs on core 2,encoder runs core 1,; A H264 decoder decode D1,then out tputing YUV as input of the encoder,I find that encoder have a question,the description is the following as:

      1)when encoding the first frame  ,the program will stop in encoding function process(),the place of the stop is spkernel instruction,which is used to protect the code pipeline.

     2) if I have a breakpoint  before  encoding function process() every time,then this problem will disappear.

         if  I added a printf() before   encoding function process() every time,then this problem will appear for having a delay.

      

  • Hi jingshuai,

    I have following questions to understand more about the issue.

    *With break point, are you getting proper output at every time you run the application?

    *Without breakpoint, is it consistent at one point across different applications runs?

    *Please cross check to ensure that no DMA channels are shared between decoder and encoder instances.

    *Guideline for placement of sections especially in multi instance cases (from Hongmei - TI)

    Generally the following sections need to be placed in either local L2 or DDR dedicated to individual cores.

    .neardata
    .rodata
    .bss
    .fardata
    .cio
    .far
    .stack
    .args

    Regards

    Sudheesh

     

  • HI Sudheesh,

        * With break point,I  can get proper output at every time I run the application.

       *Without breakpoint,  it  is consistent at one point across different applications runs!

       * by  cross check ,I ensure that no DMA channels are shared between decoder and encoder instances

         see the attached files

       * decoder runs core2, encoder runs core1,  placement of sectionsin multi instance cases is seen in the attached files.

    2364.h264hpvdec_ti_edmaConfig.c4331.h264hpvenc_ti_edmaConfig.c

    4760.TestAppDecoder.txt1057.h264hpvenc_ti_c66x.txt

  • Hi jingshuai

    I hope you are assigning different EDMA instance to encoder and decoder for EDMA3_PARAMS.regionConfig settings in application.

    Any interrupts/timer events are defined for input/output data transfer or some other purpose?

    Try placing .arg section in L2 memory.

    Please try the following if you have not already tried:
    You can debug this by halting decoder at various points(creating, before and after process call, output etc), and just running encoder independently(let the encoder run with any input data) and vice versa.

    Regards

    Sudheesh

  • Hi jingshuai, a colleague point me out that this kind of behaviour (working with breakpoint set, broken without breakpoint) is typical of a cache issue. You can verify this by disabling all cache. Also keep in mind that for multicore codecs, some sections may need to be placed in a non-cached area and that your application needs to have correct cache inv/wb operations. You can check codec unit test application as a reference for both, cache inv/wb and non-cache sections. 

    thank you,

    Paula

  • Hi Jingshuai, wondering if you were able to resolve the issue.

    thank you,

    Paula