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.

HEVC 4K encoding

Hi,

I have a DSPC-8682 (octal DSP) card and installed Desktop Linux SDK version 1.00.03 and MCSDK Video version 2.2.00.45 on Ubuntu 14.04 (64 bit).

I can run the out of the box HEVC encoding demo available as part of the MCSDK Video (encoding the 720p airshow sequence). I can also encode a 1080p sequence using 4 chips (32 cores in total). But when I try to encode a 2160p sequence (using 64 cores) I get the following message from all nodes: "DSP codec create on node ... failed with error code -4". Using a different number of cores also fails with similar error messages.

Do I need to set specific parameters for 4K encoding?

Best regards,

Jurgen

  • Hi Jurgen Slowack,

        Can you please share the config you are using for encoding.

    And also share the details like number of core you are using and what is the encoder version you are using.

    Regards

    Kuladeepak

  • 1541.codecParams_2160p.cfgHi Kuladeepak,

    I am using C66x_h265venc_01_00_00_44_ELF.

    I run the encoder as follows:

    CLIP_CONFIG=multiClip_2160p.cfg
    CODEC_PARAMS=codecParams_2160p.cfg

    $MCSDK_VIDEO_HOSTBIN_DIR/demo_c667x --dsp-image=$MCSDK_VIDEO_DSPIMAGE_DIR/sv04.out -v --channel="H265 Encode" -a HEVCENC -f $CLIP_CONFIG -c $CODEC_PARAMS -t "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63" --width=3840 --height=2160

    using the codec parameter file in attachment.

    Best regards,

    Jurgen

  • Hi Jurgen Slowack,

        Looks like you are using bit older encoder version where we support only up to 1080p on platform.

    That time we had support 2160p on Visual studio.

    Regards

    Kuladeepak

  • Hi,
    As far as I know, latest HEVC Encoder (01.00.00.44) supports resolutions up to 1920x1088. It looks like 4K resolution will be available only from the next version (01.00.00.47).
  • "you are using bit older encoder version" -> I am using the most recent HEVC encoder that I could find on TI's website (if not, a link to a newer version will be very much appreciated).

    "That time we had support 2160p on Visual studio." -> Can I conclude from your answer that the Windows version of the HEVC encoder (1.0.0.44) supports 2160p, but the Linux version only supports 1080p?

    Regards,
    Jurgen
  • Hi Jurgen, please see attached latest HEVC encoder.3073.C66x_h265venc_02_00_00_00_ELF.bin

    Thank you,

    Paula

  • Hi Paula,

    Thank you very much for a more recent version of the encoder, I installed it (and removed the previous version). However, I still can't get it to work for a 3840x2160 sequence, so there is probably something wrong with my parameters.

    I try to run it as follows:

    CLIP_CONFIG=multiClip_2160p.cfg

    CODEC_PARAMS=codecParams_2160p.cfg

    $MCSDK_VIDEO_HOSTBIN_DIR/demo_c667x --dsp-image=$MCSDK_VIDEO_DSPIMAGE_DIR/sv04.out -v --channel="H265 Encode" -a HEVCENC -f $CLIP_CONFIG -c $CODEC_PARAMS -t "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63" --width=3840 --height=2160

    With the following codec parameter file: 3122.codecParams_2160p.cfg

    Btw, I tried a couple of different things (e.g., for virtual tlles) but nothing worked. I have no problems doing 1080p HEVC encoding on multiple chips with a similar config file, but maybe there are some additional parameters to set / change for 2160p. If you can share an example config file for 2160p HEVC encoding on 8 DSP's from which I can start, that would be great also.

    Best regards,

    Jurgen

  • Hi Jurgen,

         Looks like config needs some changes.

    Please find the attached config for 2160p encoding. 

    Regards

    Kuladeepak8078.codecParms2160p30.cfg

  • Hi Kuladeepak,

    Thanks for the config file! The encoder now processes 2160p without crashing. However, after decoding the sequence, the luma plane is fine but the chroma appears to be corrupt, as if the encoder used a wrong memory offset to retrieve the chroma or so (but could be something else of course). Decoding itself does not throw errors and the (third party) decoder generates the correct output for 2160p HEVC sequences generated by other encoders.

    Changing the resolution in the config file and encoding 1080p instead produces output that looks perfectly fine. So nothing wrong with that.

    My test sequences (2160p and 1080p) are in YUV 420 planar format by the way. I allocated 4GB of contiguous memory (out of a total of 12GB) for the octal card to use.

    Best regards,
    Jurgen
  • Hi Jurgen,

         Can you please share the 265 if possible.

    Regards

    Kuladeepak

  • Hi Kuladeepak,

    Here is the encoded file (I was not allowed to upload the file as *.265 so I changed it to *.123, so just change again the extension). 6507.Encoded_3840x2160.123

    I am using the config file you provided (without any modifications) and run the encoder through:

    $MCSDK_VIDEO_HOSTBIN_DIR/demo_c667x --dsp-image=$MCSDK_VIDEO_DSPIMAGE_DIR/sv04.out -v --channel="H265 Encode" -a HEVCENC -f $CLIP_CONFIG -c $CODEC_PARAMS -t "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63" --width=3840 --height=2160

    Best regards,

    Jurgen

  • Hi Jurgen,

    Please do the following changes in MCSDK drop 45 for 4k encoding. Changes needs to be done in demoBufferPools.c(mcsdk_video_2_2_0_42\host\src).

    Replace
      if(context->memInitAPI->allocBuffDescMem(bufPools->numHostInputBufs, bufPools->hostInputBufSize, x86IPBufDescs) != 0)
      if(context->memInitAPI->allocBuffDescMem(bufPools->numHostOutputBufs, bufPools->hostOutputBufSize, x86OPBufDescs) != 0)

    With
      int32_t allocX86OutBufSize = 0; /* Size of x86 Output Buffer Descriptor to be allocated from CMEM Driver */
      int32_t allocX86InpBufSize = 0; /* Size of x86 Input Buffer Descriptor to be allocated from CMEM Driver */

      allocX86InpBufSize = (bufPools->hostInputBufSize > HOST_CMEM_BUFFER_SIZE ? HOST_CMEM_BUFFER_SIZE : bufPools->hostInputBufSize );
      if(context->memInitAPI->allocBuffDescMem(bufPools->numHostInputBufs, allocX86InpBufSize, x86IPBufDescs) != 0)

      allocX86OutBufSize = (bufPools->hostOutputBufSize > HOST_CMEM_BUFFER_SIZE ? HOST_CMEM_BUFFER_SIZE : bufPools->hostOutputBufSize );
      if(context->memInitAPI->allocBuffDescMem(bufPools->numHostOutputBufs, allocX86OutBufSize, x86OPBufDescs) != 0)

    Regards

    Kuladeepak

  • Great, this works for me, thanks!

    Jurgen

  • Hi Kuladeepak,

    Still some problems though when trying to encode longer sequences. In my case, the encoder hangs after about 160 frames (HEVC 4K). I am using the same config parameters and settings as before (and 4GB of contiguous pre-reserved memory). Here are the log files: 1732.HEVC_err.txt and 0871.HEVC_log.txt

    Best regards,

    Jurgen

  • Hi Jurgen,
    It seems like number of frames in input file is 168. According to log file encoding worked correctly because of flush message at the end.

    Number of frames must be equal to (yuv file size) / (3840 * 2160 * 3 / 2)

  • Hi Alexander,

    The encoder hangs so I have to press CTRL-C manually to terminate the program. So everything starting from "Terminating remaining threads" in the log file should be ignored.

    Best regards,
    Jurgen
  • Hi Jurgen,
       MCSDK hangs if you try to encode more number of frame than actual number of frame present in file.
    So can please try to encode same number of frame. I.e if file contain 100 frame, encode only encode 100 or less the 100.

    We have tried encoding some sequences where we couln't reproduce hang.

    Regards
    Kuladeepak

  • Hi Kuladeepak,

    Sorry, my mistake. Indeed, there was something wrong with the input file, everything works fine now.

    Best regards,

    Jurgen

  • Hi,

    I am now using the HEVC encoder in a video streaming setup and want to reduce encoder latency as much as possible. The config file in Kuladeepak's previous post implies out of order encoding (B frames etc), which introduces a structural delay that I want to avoid. I tried to change the config file myself but failed to find a good configuration.

    Do you have a sample config file for low latency encoding? (2160p / 1080p)

    I am using C66x_h265venc_02_00_00_00_ELF.bin.

    Best regards,
    Jurgen
  • Hi Jurgen,

    I have attached the low delay config for 2160P and 1080P. I have also attached the latest RTSC package (C66x_h265venc_02_00_00_02_ELF) . 

    5238.user_cfg.7z

    8132.RTSC_Package.zip

    Thanks and Regards,

    Palachandra M V

  • Hi Jurgen,

    Attached the modified config, please ignore the previous config.

    0844.user_cfg.7z

    Thanks and Regards,

    Palachandra M V