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.

Minimal h264hpvenc application

Other Parts Discussed in Thread: TMS320C6678

Hello. I have already posted question. But it has no response. It's very important for as. And so I post again.

The application does two simple things initialize encoder and process frame from memory I do the application for demonstrate my problem with H264HPVENC.

This tiny application works wrong. Please, help me make clear this situation.

I tested it on tms320c6678 DSP.

All additional information is in attachment.

Input image:

Output result:

Project: 2068.tst.tar

YUV input data: 7827.yuv_planes.tar

h264 out data: 2818.out_image.tar

  • Hi, We are already working on this and we are tracking this issue properly.   The issue seems related to memory alignment/corruption.


    Change in MaxWidth and MaxHeight makes change in behavior and behaviour with Maxwidth=352 and Maxheight=288 is attached for reference. 


    We are analyzing the behavior  with different resolutions and different location to root cast the issue.



  • Hi Mahantes, thank you for reply.

    I updated the project. Fixed some mistakes. But result the same. I try to use dynamic memory allocation for algorithm, shared memory and frame memory with Memory_alloc and Heaps.h functions but result the same. Now I try to change resolution. Result the same.

    What do you consider about reason? Is it my bug or mistake in library?

    The project: 0513.tst.tar

  • Hi, Output stream was generated properly in our local test application, so the issue could be with test application only, not with library. Also you can try by changing maxwidth by keeping resolution unchanged just to check any change in behavior.

  • Ok, but could you point me to mistake in my application? Am I right configure parameters of encoder? What should I try to make to fix it? I tried to change Max resolution but have no result. I tried to allocate memory from Heap but have no result too.

  • I rewrited my custom allocator to Memory_alloc function. I removed every static array and allocate just from heap. Also I removed each uncleared encoder parameters for me and set mostly default settings. However I didn't get positive result. Did you try to execute the application? I attached rewrited application again and hope for your help.

    Project: 4274.tst.tar

    Dumped frame: 1018.out_h264_frame.tar

    Thank you, with best Regards, Ilya.

  • The behaviour is realy strange. It seem to me that there is a cache coherence problem exists. So far I use MSMCSRAM memory process generate n bytes but when I switch to DDR3 process generate m bytes when n!=m. And when I change program code, the amount of generated bytes changed too.

  • Hi llya,

    Inside the test application with the formal release of codec library, we can disable and enable cache.
    Replace the existing cache sizes to the following to disable cache ( Function: TestApp_EnableCache()/ File :h264hpvenc_ti_testapp.c)
    size.l1pSize = Cache_L1Size_0K; /* L1P cache size */
    size.l1dSize = Cache_L1Size_0K; /* L1D cache size */
    size.l2Size = Cache_L2Size_0K; /* L2 cache size */

    Please look at the corresponding code in test application.

    Please look at this thread regarding cache coherence.

    Please refer to h264hpvenc.cfg file(inside test application) for details regarding section mapping.

    Since the application is not building at our end, it is very difficult to help you.
    I tried with Build options->Main->Device variant -> Generic C66x Device
    and added dependencies for xdais, framework components, bios, edma3 and ipc.
    But this configuration is not taken by the project and it gives some java.lang.NullPointerException and unable to set target and platform. I tried to migrate your project to our test application, but lot of dependencies were there inside the application.

    Thanks

    Sudheesh

  • Hi, Sudheesh.

    The problem was solved. It was a Cache coherence issue. But anyway some things unclear for me. Why Cache_wbInvAll() didn't solve my issue. Ok.I'll check it out. Thank you for response. But why you can not to build my application? How dose should I build the project? It includes only required libraries.

    I match your reply as answer because it contains information which may be usefull to someone.

    Thank you.

  • Welcome llya.

    It's good to see that you solved the issue. I just want to know whether you could able to solve the issue with cache enabled? In that case, it is fine. Otherwise we will have to enable cache and fix the coherence issue.

    Meanwhile I have replied to your other thread also. Please check that thread also. (link)

    Thanks and regards

    Sudheesh

  • It works fine when cache is disabled. You told that can not to build my project. How does should I build the project for you? In the project I use Cache_wbInvAll() but seems it is not enough.

  • For multicore scenario, for shared memory sync we used to follow write-back followed by invalidate. Please see this thread.

    Please check any section mapping difference makes any issue.

    Please try building the project with Build options->Main->Device variant -> Generic C66x Device. and add the needed libraries xdais, framework components, bios, edma3 and ipc.

    And if required only other libraries.

    Thanks 

    Sudheesh

  • Sudheesh, ok thank you for response. I already look at the thread. If you can see I use single core mode. But anyway I try to solve the problem and rebuild the project.

  • Hi llya,

    From your .cfg and map files, it looks like the section of ".INTMEM_HEAP" is placed in MSMC. Can you please try placing it in local L2? This is because MSMC and L1D are not coherent while local L2 and L1D are. 

    In order to move ".INTMEM_HEAP" from MSMC to local L2, you may need to reduce "heapMemParams.size". Please find the actual usage of the heap in CCS through ROV.

    Thanks,

    Hongmei

  • Hi, you are right.

    There is a problem with the cache coherence. I made allocation internal memory for algorithm from l2sram. Now everything is fine. Thank you for your explanation.