How to access Sekonix embedded data through NVMedia?

Hi,

I’m using the NVMedia ipp_raw sample application with a normal Sekonix camera. Everything works well, but now I need to access the embedded information from the camera.

Normally, the AR0231 sensor outputs a copy of all registers in the “top” embedded data, while the “bottom” embedded data has histogram data and other stats. How can I read these embedded lines from the ipp_raw sample?

I tried to access it as metadata. I see that in img_producer.c there is a function called “PrintMetadataInfo()” that fills the “NvMediaISCEmbeddedData embeddedData” object:

NvMediaIPPMetadataGet(
  output->metadata,
  NVMEDIA_IPP_METADATA_EMBEDDED_DATA_ISC,
  &embeddedData,
  sizeof(embeddedData));

When printing out “embeddedData.top.size” it confirms that the top embedded data size is 4096 (and “embeddedData.top.bufferSize” is 16384), so I would expect the actual data to be there – however, I get a segfault when trying to read anything in “embeddedData.top.data”, as this is a null pointer apparently.

I have also tried to access the top line data specifically as follows:

NvMediaISCEmbeddedData embeddedDataTop;
NvMediaIPPMetadataGet(
  output->metadata,
  NVMEDIA_IPP_METADATA_EMBEDDED_DATA_TOP,
  &embeddedDataTop,
  embeddedData.top.size);

Which according to the docs does return the actual top data lines, but this results in a segfault as well.

How can I access the actual data in these elements? Or is there an alternative method I can use to access this information somewhere else within ipp_raw?

Any information would be greatly appreciated! Thanks in advanced.

Ok, after trying a lot of things, I think finally found how to obtain the embedded data. Turns out it is necessary to allocate the memory beforehand. This is what I have so far:

uint8_t * top = malloc(embeddedData.top.size); // 4096 bytes

NvMediaIPPMetadataGet(
  output->metadata,
  NVMEDIA_IPP_METADATA_EMBEDDED_DATA_TOP,
  top,
  embeddedData.top.size); // Same 4096 bytes

And with this, I can finally read the top embedded data, I decoded it, and everything matches as per the AR0231 documentation.

However, I have run into a new problem. This is only filling 1078 bytes of embedded data into my “top” allocation. After these 1078 bytes, the remaining 3000 or so bytes are all 0’s.

I still need to access information after this threshold. Any idea what I’m doing wrong here?

Thanks again in advanced…

UPDATE: I also tried to read directly from the output->metadata buffer, as the top embedded line data is there somewhere, after some offset, and I see the same thing happen, with a lot of 0’s after the 1078th byte corresponding to the top embedded line. I’m starting to think this might be a bug when the metadata buffer gets created. Is there anything that can be done to correct this? Or at least is there any other way to access the embedded information chunk?

Dear monoeci,

Could you please help to refer to the following link for your topic?
https://devtalk.nvidia.com/default/topic/1057566/general/reading-ar0231-registers-through-nvmedia-ipp/