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.

h.264: Problems with user data unregistered SEI message

Hi,

I'm trying to encode and decode some application specific data using the very latest TI h.264 encoder and decoder on a dm368 platform. Although encode appears to be successful, the decoder errors with extended error code 0x84d (corrupted data, Error in SEI message) and fail to output a frame. If I set insertUserData = XDAS_FALSE in the encoder, or if I set seiVuiParseFlag = 0 in the decoder, everything works perfectly.

In the encoder I have:

h264InArgs.insertUserData = XDAS_TRUE;
h264InArgs.lengthUserData = 60;

....Process call here.....

// Set user data uuid_iso_iec_11578 as per h.264 spec (D.1.6)

uuid_t uuid_iso_iec_11578;
uuid_generate(uuid_iso_iec_11578);
memcpy (outBufDesc.bufs[0] + h264OutArgs.offsetUserData, uuid_iso_iec_11578, 16);

// Set user data payload
memset(outBufDesc.bufs[0] + h264OutArgs.offsetUserData + 16, 0x00, 44);

In the decoder I have:

h264InArgs.seiVuiParseFlag = 1;
SeiVui_obj.sei_messages.user_data_unregistered.user_data_payload_byte = (XDAS_UInt8 *) userDataBuf0;
SeiVui_obj.sei_messages.user_data_unregistered.buffer_size = sizeof(userDataBuf0);
SeiVui_obj.sei_messages.user_data_registered.itu_t_t35_payload_byte = NULL;
SeiVui_obj.sei_messages.user_data_registered.buffer_size = 0;
h264InArgs.seiVuiBufferPtr = &(SeiVui_obj);

....Process call here.....

outSeiVuiBuffer = (sSeiVuiParams_t*)h264OutArgs.seiVuiBufferPtr;
printf("Parsed: %d\n", outSeiVuiBuffer->parsed_flag);

Best regards,

Alex

  • Here is the h.264 stream captured immediately after encode. It should contain the user data on every frame except for the first few.

    2746.videoEncFile.txt

    Hope someone can point me in the right direction.

    Thanks,


    Alex

  • Hi Alex,

    We are able decode your stream without any error; decoder detecting you sei as SEI_USER_DATA_UNREGISTERED correctly.  Can you decode same stream using decoder standalone test app provided with decoder release.

    one possible reason decoder to set  extended error 0x4d(only codec error) is mismatch between payload size and nal size.

    Thanks,

    Veeranna

  • Hi Veeranna,

    Thanks for picking this up. It's good news that the encoder is working correctly. I will investigate payload size vs. nal size. One thought that occurs to me is that we are running both encode and decode in low latency mode. I believe the decoder receives a single NAL with the user data in it via the low latency call back. Is anything special required to make this work?

    Thanks,

    ALex

  • In low latency mode can you check you payload size and packet size are same? No special handling is required. To conform its  something to do with sizes in low latency mode, please check stream standalone decoder testapp.

    Thanks,

    Veeranna

  • Hi Veeranna,

    I'm not sure what you mean. The size of the nal is 64 bytes, so I'm setting dataSyncDesc->blockSizes[0] = 64 and h264InArgs.pNumBytesInDesc[0] = 64.

    The nal structure is:

    Byte0: 6 (NAL type = SEI)

    Byte1: 5 (SEI = unregistered user data)

    Byte2: 60 (payload length)

    Byte3-18: UUID

    Byte19-62: User data

    Byte 63: ? I assumed this was a terminating byte, is that correct?

    Perhaps the length should only be 63?

    Thanks,


    Alex

  • Hi Veeranna,

    I built the stand alone test application and initially I was able to decode the stream I sent you correctly. The user data was correctly identified and printed. I tried in low latency mode with:

    params.inputDataMode = IH264VDEC_TI_SLICEMODE;

    params.sliceFormat = IH264VDEC_TI_BYTESTREAM;

    ...and it also worked. Then I tried it in our configuration which is:

    params.inputDataMode = IH264VDEC_TI_SLICEMODE;
    params.sliceFormat = IH264VDEC_TI_NALSTREAM;

    ...and immediately I got the same error I get in my application. It looks to me like the check in the decoder you referred to about payload size is not taking into account the setting of sliceFormat.

    To try and prove my theory I put a simple hack in the test application which reports the nalsize to the decoder as 4 bytes larger than it actually is if the nal is an SEI nal. The decoder produced errors about decoding the picture but this time it was able to decode the user-data with sliceFormat = IH264VDEC_TI_NALSTREAM.

    This looks like a bug in the decoder to me - what do you think?

    Alex

  • Yes it may be decoder issue. I will try at my end with Low Latency ON. If it is decoder bug please don't expect immediate release. Please use work around as of now.

    Thanks,

    Veeranna