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.

C66x H264 HP 4-core decoder questions

Other Parts Discussed in Thread: TMS320C6678

Hi,

Our customer is trying to use shared engineering release and he has some question about callback functions, I was wondering if the codec team can take a look of his questions and help me to clarify them. Please see below questions:

1)      KeyCreate callback: Where could we find documentation of error flow in keyCreate callback?. In samples it is used "while(1);" for error flow but hanging core is not a variant for our application. is any other way to process error situations?

2)      Lock acquire:  from Brief description it is mentioned that If lock is successfully acquired it returns 1 and 0 if lock is already acquired. And it is non-blocking callback. However, in the sample application, which comes with the decoder, the lock looks like it is implemented in a different way, callback is blocking, it returns 0 if lock acquired and non-zero otherwise.

Version release codec: C66x_h264hpvdec_01_01_02_03_ELF

Thank you,

Paula

  • Hi Andrey,

    We could able to reproduce the issue with H264 stream you shared and we are looking into it. We will revert back with an update shortly.


    Thanks,

    Praveen.

  • Hi Andrey,

    We fixed the issue in the library when running decoder in 4-core mode, now 4-core decoder will also report same errors as 1/2-Core decoder and will not hang.

    Can you please check with this new library attached?

    6355.H264_4Core_Lib_20140219.zip

    Thanks,

    Praveen

  • Hi Praveen,

    I still experience the same issues with updated encoder: it works Ok in 2cores mode and hangs in 4core mode only in case of errors in stream.

    As I see you can reproduce errors by randomly skipping frames from correct elementary stream.

    Regards,

    Andrey Lisnevich

  • Hi Andrey,

    We try to replicate the issue at our end by skipping frames randomly  from correct elementary stream and found that decoder in 4-core mode was not hanging, but it is not bit-compliant with 2-core decoder.

    Can you please share the stream to reproduce the 4-core hang, meanwhile we will work on resolving the bit-compliance issue seen in this scenario.

    Please let us know for any questions

    Thanks,

    Praveen

  • Hi Praveen,


    I can't reproduce the same error on emulator that I get on production system. But please review two attached H.264 elementary streams and logs produced by decoder.


    First bug - decoder releases non existing buffer.

    Second bug - decoder fails to decode H.264 stream. Interesting that this stream was created by C66x H.264 HP encoder.

    You can find files by the following URL:

    https://drive.google.com/file/d/0Byw88ezNrM71Z0YwSzdlYzdLRDA/edit?usp=sharing

    The bugs can be reproduced by my demo attached above.

    Regards,

    Andrey Lisnevich

  • Hi Andrey,

    Just wanted to check, weather you could able decode these attached two streams using 1-core or 2-core decoder ?

    Thanks,

    Praveen.

  • Hi,

    First bug I can't reproduce in 2 cores mode.

    Second bug is the same in 2 cores mode.

    Regards,

    Andrey Lisnevich

  • I was wrong,

    In 1 and 2 cores mode decoder has also problems with first buggy stream. It just hangs inside process call:

    ----------
    process begin
    process end
    decode ticks=122009907 bytesConsumed=59943
    outputID = 57
    freeBufID 57
    ----------
    process begin
    process end
    decode ticks=101678745 bytesConsumed=25623
    outputID = 59
    freeBufID 59
    ----------
    process begin
    process end
    decode ticks=106329947 bytesConsumed=28851
    outputID = 56
    freeBufID 56
    ----------
    process begin

    Regards,

    Andrey Lisnevich

  • Hi Andrey,

    For Bug1, there is some issue in the code for 1-core decoder it self, we are debugging it and we will let you as soon as it is fixed.

    For Bug2, JM decoder  also fails to decode this stream, Can you please share the configuration used for HP encoder to generate this stream and which version of HP encoder you are using? 

    Thanks,

    Praveen.

  • Hi Praveen,


    The configuration to produce elementary stream for Bug2 is lost but I will try to recall it.

    VLC, FFmpeg and mplayer can play the stream from Bug2.


    Regards,

    Andrey Lisnevich

  • Hi Praveen,

    I was able to reproduce stream from C66x H.264 HP encoder that is not decodable by C66x H.264 HP decoder. Configuration and elementary stream are attached.

    Regards,

    Andrey Lisnevich

    c66x_h264hp_encoded.zip
  • Hi Andrey,

    It seems you are using 1080p resolution with a lower level (3.0). H264 standard supports only upto 1620 macroblocks for the level 3.0. 

    Decoded picture buffer limits and all  might have set wrt level limits and this can cause buffer issues. Please try setting a level of 4.0. (Level  = 40 in config) and see if any issues are there wrt decoding.

    Regards

    Sudheesh

  • Hi Sudheesh,

    I will test the use case using your recommendations soon.

    Why encoder does not validate Level limitations?


    Regards,

    Andrey Lisnevich

  • Hi Andrey,

    Encoder will return a non-fatal level incompliance error, but still it continues encoding.
    You can see codec user guide, Page 65(Table 4-4), page 80 ("Note :") for details.

    Regards

    Sudheesh

  • Hi,

    Using level = 40 while encoding fixed decoding.


    Do you have any updates on bug1?

    Regards,

    Andrey Lisnevich

  • Hi Andrey,

    Thanks for the update on bug2.

    Regarding bug1, we fixed the hang issue reported for the decoder, but still observing bit-compliance issues and we are looking into it. We will revert back with an updated library shortly.

    Thanks,

    Praveen

  • Hi Andrey,


    It looks like it will take some time to fix the bit-compliance issues, mean while you can use the updated library (attached) with fix for the decoder hang seen with bug1 test case.

    We will let you know once the bit-compliance issue is resolved.

    3618.H264_4Core_Lib_20140319.zip

    Thanks,

    Praveen.

  • Hi Praveen,


    I still experience problems with live streams. Decoder behaves differently in 1/2 cores mode and in 4 cores mode.

    See attached demo and logs (updated alittle). I fail to decode stream only in 4 cores mode.

    As I see problem appears when stream does not start with I/IDR frame and decoder has to skip few frames.

    Regards,

    Andrey Lisnevich

    h264dec_bug.zip
  • Hi Andrey,

    Thanks for validating the library.

    We fixed the issue in 4-core mode and attached the latest library. Can you please check with the updated library ?

    2262.H264_Lib_4Core_20140421.zip

    Thanks,

    Praveen

  •  Hi Praveen,

    This decoder works better with live streams in 4-cores mode. But while decoding it always reports an error. See attached log file.

    Another issue  - this decoder much slower than previous one and can't handle streams in realtime. I don't know why it is so but when I link with previous decoder decoding goes much faster.

    Regards,

    Andrey Lisnevich

  • Hi Andrey,

    Sorry for the wrong library, in that some of the files were build in debug mode, so decoding may take more cycles. I have rebuilt the library in release mode now and also issue with reporting error code also fixed.

    Can you please check with attached updated library ?

    4061.H264_Lib_4Core_20140423.zip


    Thanks,

    Praveen.

  • Thanks Praveen,


    This version works good with our live streams. Also we are able to do 1080i50 High Profile @ Level 40 decoding on 2 cores. Is it expected result? I thought we will need 4 cores for such decoding.


    Regards,

    Andrey Lisnevich

  • Hi Andrey,

    Thanks for the update.

    Regarding profile it depends bit rate also, if it is a lower bit-rate then you can do 1080i50 with 2-cores only, but for higher bit rates( >10Mbps) and for 1080i60 you may need 4-cores for decoding.

    Thanks,

    Praveen

  • Hi Praveen,

    Yes I noticed that sometimes I got frame drops. Most likely it happens when bitrate goes up in scenes with a lot of  motion.

    While running durable tests on live stream I found another problem - decoder outputs frame with the same ID twice. It happened to me in 2-cores mode but I will test in other modes later. Please see attached log files. They contain 2 such similar failures:

    1) -----------------------------------

    [2014-04-24 15:55:13] i:9720
    [2014-04-24 15:55:14] o:9715
    [2014-04-24 15:55:14] f:9715
    [2014-04-24 15:55:14]
    [2014-04-24 15:55:14] i:9721
    [2014-04-24 15:55:14] o:9718
    [2014-04-24 15:55:14] f:9712
    [2014-04-24 15:55:14] f:9718
    [2014-04-24 15:55:14]
    [2014-04-24 15:55:14] i:9722
    [2014-04-24 15:55:14] o:9720
    [2014-04-24 15:55:14]
    [2014-04-24 15:55:14] i:9723
    [2014-04-24 15:55:14] o:9720
    [2014-04-24 15:55:14] ERROR: frame ID not found in PTS queue
    [2014-04-24 15:55:14] WARNING: Deactivate resources failed (3)
    [2014-04-24 15:55:14] Fatal master decoder task error. Terminating task.

    2) -----------------------------------

    [2014-04-24 16:01:52] i:9555
    [2014-04-24 16:01:52]
    [2014-04-24 16:01:52] i:9556
    [2014-04-24 16:01:52]
    [2014-04-24 16:01:52] i:9557
    [2014-04-24 16:01:52] f:9548
    [2014-04-24 16:01:52]
    [2014-04-24 16:01:52] i:9558
    [2014-04-24 16:01:52]
    [2014-04-24 16:01:52] i:9559
    [2014-04-24 16:01:52]
    [2014-04-24 16:01:52] i:9560
    [2014-04-24 16:01:52] o:9555
    [2014-04-24 16:01:52] f:9555
    [2014-04-24 16:01:52]
    [2014-04-24 16:01:52] i:9561
    [2014-04-24 16:01:52] o:9558
    [2014-04-24 16:01:52] f:9552
    [2014-04-24 16:01:52] f:9558
    [2014-04-24 16:01:52]
    [2014-04-24 16:01:52] i:9562
    [2014-04-24 16:01:52] o:9560
    [2014-04-24 16:01:52]
    [2014-04-24 16:01:52] i:9563
    [2014-04-24 16:01:52] o:9560
    [2014-04-24 16:01:52] ERROR: frame ID not found in PTS queue
    [2014-04-24 16:01:53] WARNING: Deactivate resources failed (3)
    [2014-04-24 16:01:53] Fatal master decoder task error. Terminating task.

    Memo:

    i:%d - IVIDDEC2_InArgs.inputID input frame ID to process call

    o:%d - IVIDDEC2_OutArgs.outputID output frame IDs after process call

    f:%d - IVIDDEC2_OutArgs.freeBufID free frame IDs after process call

    Regards,

    Andrey Lisnevich

    h264dec_id_bug.zip
  • Hi Andrey,

    It is possible for you to share the stream to reproduce and debug the issue ?

    Thanks,

    Praveen

  • Hi Praveen,

    It happens with time on live streams. I will try to capture the stream that reproduces the error.


    Regards,

    Andrey Lisnevich

  • Hi Praveen,

    I did tests and see that the problem happens in 1 and 2 cores mode only. Also I noticed that it happens not on live stream, but on infinite transcoding of a file in loop (our transcoder has this feature for testing)

    But in demo I was able to reproduce different error also related to buffers management: with time decoder starts to not release buffers.

    Please see attached files.

    Archive contains modified Configuration.c and DecodeMasterTask.c to do infinite transcoding in loop of input.264 stream that should be uploaded into DSP memory by the same address as before.

    log.txt contains log of the problem. As you see at the end program fails with out of memory error because of buffers leak in decoder.

    Regards,

    Andrey Lisnevich

    decoder_bug.zip
  • Hi Andrey,


    Thanks for sharing the details.

    There is an issue in 1 and 2 cores modes of decoding with buffer management , we fixed the issue in the library and validated the library in the setup you shared.

    Attached the updated library, Can you please check with this latest library ?

    4643.H264_Lib_4Core_20140502.zip

    Thanks,

    Praveen

  • Thanks Praveen,

    The buffer management issue has gone.

    Regards

    Andrey Lisnevich

  • Hi Praveen,


    I found another problem.

    The same demo with the same input in 4 cores mode stops because decoder releases buffer with id < 0 (rubbish id):

    ----------
    inputID = 491
    ----------
    inputID = 492
    outputID = 486
    freeBufID = 486
    ----------
    inputID = 493
    ----------
    inputID = 494
    outputID = 489
    freeBufID = 483
    freeBufID = 489
    freeBufID = 488
    freeBufID = -2088401531
    Failed to release out decoder buffer

    Can you please check.

    Regards,

    Andrey Lisneivch

  • Hi Andrey,

    We could not able replicate this issue, we already ran the demo with this input in 4core mode, it is decoding fine.

    Today checked once again, we could not able to replicate this issue. Are we missing some thing ?

    Thanks,

    Praveen.

  • Hi Praveen,

    You are right. It was problem with my demo. No issues for now. Thanks for support!

    Andrey Lisnevich