I was finding GetCodingType to sometimes take 200ms for a single jpeg.
That was a mixture of the slow bit oriented parsing, but more significantly some bugs in the parsing.
The SOF blocks skipped the wrong number of bytes, resulting in us parsing junk.
The M_TEM, M_DRI, M_SOI and M_EOI tags when seen (usually due to the junk) can only escape by slowly parsing until end of file.
Also, after a M_SOS, there is the variable sized jpeg block which we can't parse, so best to give up then, rather than misparsing
the remaining jpeg data
{
switch(marker)
{
- case M_TEM:
- case M_DRI:
- CBitstreamConverter::skip_bits(&br, 16);
- continue;
- case M_SOI:
- case M_EOI:
- continue;
-
- case M_SOS:
case M_DQT:
case M_DNL:
case M_DHP:
nMarker = true;
break;
+ case M_SOS:
default:
nMarker = false;
break;
{
m_progressive = true;
}
+ int readBits = 2;
SKIPN(p, 1);
+ readBits ++;
m_omx_image.nFrameHeight = READ16(p);
+ readBits += 2;
m_omx_image.nFrameWidth = READ16(p);
- SKIPN(p, 1 * (block_size - 9));
+ readBits += 2;
+ SKIPN(p, 1 * (block_size - readBits));
}
else if(marker == M_APP1)
{