Re: DCT coefficient quantization factors
- From: "cr88192" <cr88192@xxxxxxxxxxxxxxxxxx>
- Date: Mon, 25 Dec 2006 13:31:13 +1000
"Thomas Richter" <thor@xxxxxxxxxxxxxxxxx> wrote in message
news:4v8g02F1ajbk3U1@xxxxxxxxxxxxxxxx
fulltime wrote:
In JPEG, after passing the pixel values thru DCT computation, we
quantatize it b4 encoding the code. I understand tat the quantization
matrix given can be scaled by a factor.
This is one way to setup a quantization matrix for an arbitrary quality.
This is definitely not the only way to do it, but only a *recommendation*.
yes, for example, my implementation makes a pass over all the output DCT
blocks, calculates the general energy distributions, and uses this, along
with the quality factor, to attempt to come up with a "good" set of
quantization values.
DCT quantized = ROUND (DCTcoefficient/(Q*Scale Factor))
where Q is a value of the quantization matrix and
scale factor =
i) 50/Quality Factor for QF <50
ii) 2- QF/50 for QF>=50
My qn is to get the best quality factor, we set QF = 100, therefore
scale factor = 2-100/5 = 0
that means the DCT quantized value will be 0 as well???
No, it means that the formula above is no longer well-defined and you
cannot compress to 100% quality. In fact, the DCT mode of JPEG-1 is
*never* lossless, and the scaling of the quantizer matrix for 100% quality
returns nonsense.
JPEG-1 does have a lossless mode, but that works completely different,
and not by setting quality to 100.
usually though, since 0 makes no sense in a quantizer table, one clamps the
range to 1..255.
closest one can get to 100% quality is a quantizer table filled with all
1's...
but, really, it is not that majorly important really. just try for something
sane that gives good-looking results and decent filesizes...
So long,
Thomas
.
- Follow-Ups:
- Re: DCT coefficient quantization factors
- From: Thomas Richter
- Re: DCT coefficient quantization factors
- References:
- DCT coefficient quantization factors
- From: fulltime
- Re: DCT coefficient quantization factors
- From: Thomas Richter
- DCT coefficient quantization factors
- Prev by Date: Re: I am Puzzled! How come my JPEG algorithm doesnt work?
- Next by Date: Re: I am Puzzled! How come my JPEG algorithm doesnt work?
- Previous by thread: Re: DCT coefficient quantization factors
- Next by thread: Re: DCT coefficient quantization factors
- Index(es):