For Programmers: Free Programming Magazines  


Home > Archive > Compression > February 2005 > Level Shift in JPEG optional or mandatory









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Level Shift in JPEG optional or mandatory
Jochen Messner

2005-02-02, 3:55 pm

Hi,

I am wondering whether the level shift on the input pixel values
[0..255] by -128 is mandatory or optional.

(I guess in the latter case one would need a bit in the compressed date
to indicate that.)

I'm asking because several authors seem to ignore the level shift
totally (like Salomons "complete reference" and also the FAQ of this
group), in fact i couldn't find a reference which indicates whether the
level shift is done before or after the optional color space
transformation.

I just want to know how it is ... theoretically the level shift seems to
be useless to me, a shift of -128 on the input values will cause a shift
of -1024 on the DC value (AC values will be the same). So one obtains a
range [-1024,1023] for the DC values instead of [0,2047]. This may just
be of some use if one has a processor which wasts a sign bit anyway for
every number.

Thank You for any help,
Jochen Messner
Guido Vollbeding

2005-02-02, 3:55 pm

Jochen Messner wrote:
>
> I just want to know how it is ... theoretically the level shift seems to
> be useless to me, a shift of -128 on the input values will cause a shift
> of -1024 on the DC value (AC values will be the same). So one obtains a
> range [-1024,1023] for the DC values instead of [0,2047]. This may just
> be of some use if one has a processor which wasts a sign bit anyway for
> every number.


I have some special experiences with level shift implementation in JPEG.
As you say, the level shift only manifests itself in the DC after the DCT,
the AC values are the same independent from the input level.
The level shift brings the DC values in a similar signed integer range as
the AC values, so the whole DCT calculation is more consistent (in signed
integer representation).
You could also move the level shift from the input values to the DC
output only, which would save some operations. This might work well
in some implementations, but not so well in others. I tried this
sometime in my scaled DCT implementations (http://jpegclub.org/cjpeg/),
but then removed it since it wouldn't work in all cases with 16-bit
integer arithmetic (no problem with 32-bit arithmetic though).

Regards
Guido
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com