Re: Raw JPEG Data Size



<nozisles_2000@xxxxxxxxx> wrote in message
news:1136833978.124058.79510@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>I have a raw stream of data, part of which contains a JPEG (possibly
> not in its entirity). I am attempting to extract (just extract, not
> interpret) the image. Currently I detect the JPEG (JFIF) signature,
> then walk through the image for as long as possible by detecting valid
> headers and their size. Unfortunately, once I reach the start of a
> scan (M_SOS) I am lost as to how to detect the correct/appropriate
> size.

I think you have to decode it.

> I could attempt to scan for M_EOI however, this is extremely
> unreliable as a) it may occur in data (?)

Not legally. Any image data that looks like a valid marker has a 0x00
inserted in the middle.

> and b) there is the
> possiblity it will not be there at all and my extraction will never
> end. I am not very versed in the ways of JPEG and any help on this
> matter will be great. I have looked over IJG's code on the subject and
> it seems rather advanced for what I am trying to do. Is there any
> simple calculations I can use to get the size of the scan or the
> distance from any unique marker to M_EOI?

If your codestream is complete, looking for the FFD9 should work.
If it's truncated, I think you need to decode till you can decode no more
(assuming I've understood your question correctly).


.



Relevant Pages

  • Converting Tif to Jpeg problem
    ... I'm writing an application that extract attachment from ... works fine for JPG, GIF, etc. ... However for TIFF file I need to convert them. ... not from TIFF to GIF or JPEG. ...
    (microsoft.public.dotnet.framework)
  • Re: Raw JPEG Data Size
    ... > not in its entirity). ... I am attempting to extract (just extract, ... Currently I detect the JPEG signature, ... http://uio.imagero.com Unified I/O for Java ...
    (sci.image.processing)
  • Re: Decoding a JPEG in memory
    ... >having great difficulty in finding a library or source code to decode a ... >JPEG image that I have in memory. ... >image in memory and would like to call a lib function to decode the ... custom data source manager. ...
    (comp.compression)
  • Decoding progressive JPEG with low memory consumption
    ... The input JPEG images can are usually some mega pixels large and I have to decode these only a small screen canvas. ... I do not have this much memory available, hence my only option seems to be decoding the image from scratch for each pass/scan. ...
    (comp.graphics.algorithms)
  • Re: Raw vs jpeg
    ... In these circumstances RAW wins hands down because you do not get the JPEG subsampled chroma problems damaging the image resolution. ... In general for images containing areas of white or black with sharp edges there are values in the reconstruction after inverting the quantised coefficients through the DCT that are outside the allowed range of 0..255. ... If you decode again to a colour image you will see the luminance error smearing from the chroma and convert that to monochrome and you do not get the right answer. ... Most digital cameras that I have seen use the default Huffman tables from the JPEG standard App K.3. ...
    (rec.photo.digital)