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.

dm368 jpegdec decoding mjpeg frame failed !

hi:

  I was using 'jpegdec' codec of dm368  to decode mjpeg frame captured from usb camera ,  decoder returns -1 always ,   does that jpegdecoder  supports decoding mjpeg frame ? 

 My another app  use jpeg frame to feed decoder , and its OK!

 Then I tried to convert mjpeg frame  to jpeg  .

  1 change "FF E0" FILED, AV1->JFIF

  2 add 'standard mjpeg huffman table' searching from google

  sometimes it's decoded  OK but sometimes  not !

can anyone help me , thks !

  • Hi Hugo, The JPEG Decoder decodes each frame of the MJPEG sequence as if it were an individual JPEG image. It makes no assumptions about the header, tables, etc. As long as your image begins with a xFFD8 marker and ends with a xFFD9 one, you should not face any issues. Regards. Akshay

  • Hi,

    This issue is observed by some other users earlier as the mjpeg streams from some of the USB cameras does not have DHT marker (FFC4 defined Huff man table )

    With Dm36x decoder, DHT marker is must to decode JPEG files. For MJPEG file, at least first frame should have the DHT marker for successful decoding.

    Please insert DHT marker in the first frame of this bit-stream and try.

    Please find some relevant code at following link for inserting DHT marker along with default Huffman table. http://svn.openrobotino.org/common/trunk/lib/rec/cv_lt/jpeg_dec.cpp

    Some more information on this topic – MJPEG with missing DHT marker/segment:  http://sourceforge.net/mailarchive/message.php?msg_id=28417508

    Regards, RSV

  • Hi,

      I found  it was my capture-driver's problem , the mjpeg frame captured sometimes  was not complete !  

      And when decoded failed, I  didn't  reset the decoder , so  as long as one frame was failed, the followings failed as well .

      Finally , My testing proved  that  the jpeg decoder does not need the  DHT  , feed the  mjpeg frame of correct format   and it works well !

      Thanks a lot !