DSPRelated.com
Forums

A question on DCT

Started by rad_ezd June 28, 2006
HI all,
       I have a query on DCT. How does DCT gives energy compaction
compared to DFT when it is applied to say an image?

~R

I think since DCT is just the real part of DFT (e^jw = cos w + jsin w,
Re(e^jw) = cos w), the energy (amplitude^2) compaction will be the same
in both cases.

Partho

rad_ezd wrote:
> HI all, > I have a query on DCT. How does DCT gives energy compaction > compared to DFT when it is applied to say an image? > > ~R
>>>>> "Ben" == Ben <partho.choudhury@gmail.com> writes:
Ben> I think since DCT is just the real part of DFT (e^jw = cos w + jsin w, Ben> Re(e^jw) = cos w), the energy (amplitude^2) compaction will be the same Ben> in both cases. DCT is not just the real part of the DFT. And the DCT does a better job at energy compaction than DFT. Jayant and Noll have a plot that shows this. Ray
Ben wrote:
> I think since DCT is just the real part of DFT (e^jw = cos w + jsin w, > Re(e^jw) = cos w), the energy (amplitude^2) compaction will be the same > in both cases.
DCT is not just the real part of a DFT, as the boundary conditions are different. The energy compaction should be the same, anyway, if I understand energy compaction. -- glen
Raymond Toy wrote:

>>>>>>"Ben" == Ben <partho.choudhury@gmail.com> writes:
> Ben> I think since DCT is just the real part of DFT (e^jw = cos w + jsin w, > Ben> Re(e^jw) = cos w), the energy (amplitude^2) compaction will be the same > Ben> in both cases.
> DCT is not just the real part of the DFT.
I agree, the boundary conditions are different.
> And the DCT does a better job at energy compaction than DFT. Jayant > and Noll have a plot that shows this.
Well, it seems to me it depends on how the boundary conditions agree with the data. DST (sine transform) has the function go to zero at the boundary, DCT has the derivative go to zero, and DFT has periodic boundary conditions. (There is a better explanation in Numerical Recipes than I can give here.) As I understand it, DCT is better for the popular case of using small blocks and expecting them to match at the boundary. If you don't use small blocks, I would expect the difference to be small. -- glen
Can someone please clarify what they mean by "Energy compaction"?

DCTs operated on macroblocks in images and video frames usually give
one pixel (top left) as DC, and progressively higher freq AC components
in the outlying region.

DWTs, on the other hand, have 1 LL subband in the top left, with
progressively higher frequency (finer) "directional" AC sub-bands.

Is this clustering of LL low freq components or DC components to one
"corner" of the signal is what you mean by Energy Compaction???

Partho


glen herrmannsfeldt wrote:
> Raymond Toy wrote: > > >>>>>>"Ben" == Ben <partho.choudhury@gmail.com> writes: > > > Ben> I think since DCT is just the real part of DFT (e^jw = cos w + jsin w, > > Ben> Re(e^jw) = cos w), the energy (amplitude^2) compaction will be the same > > Ben> in both cases. > > > DCT is not just the real part of the DFT. > > I agree, the boundary conditions are different. > > > And the DCT does a better job at energy compaction than DFT. Jayant > > and Noll have a plot that shows this. > > Well, it seems to me it depends on how the boundary conditions agree > with the data. DST (sine transform) has the function go to zero at > the boundary, DCT has the derivative go to zero, and DFT has periodic > boundary conditions. (There is a better explanation in Numerical > Recipes than I can give here.) As I understand it, DCT is better for > the popular case of using small blocks and expecting them to match at > the boundary. If you don't use small blocks, I would expect the > difference to be small. > > -- glen
Ben wrote:

> > Can someone please clarify what they mean by "Energy compaction"? > > DCTs operated on macroblocks in images and video frames usually give > one pixel (top left) as DC, and progressively higher freq AC components > in the outlying region. > > DWTs, on the other hand, have 1 LL subband in the top left, with > progressively higher frequency (finer) "directional" AC sub-bands. > > Is this clustering of LL low freq components or DC components to one > "corner" of the signal is what you mean by Energy Compaction??? > > Partho > > > glen herrmannsfeldt wrote: >> Raymond Toy wrote: >> >> >>>>>>"Ben" == Ben <partho.choudhury@gmail.com> writes: >> >> > Ben> I think since DCT is just the real part of DFT (e^jw = cos w + >> > jsin w, Ben> Re(e^jw) = cos w), the energy (amplitude^2) compaction >> > will be the same Ben> in both cases. >> >> > DCT is not just the real part of the DFT. >> >> I agree, the boundary conditions are different. >> >> > And the DCT does a better job at energy compaction than DFT. Jayant >> > and Noll have a plot that shows this. >> >> Well, it seems to me it depends on how the boundary conditions agree >> with the data. DST (sine transform) has the function go to zero at >> the boundary, DCT has the derivative go to zero, and DFT has periodic >> boundary conditions. (There is a better explanation in Numerical >> Recipes than I can give here.) As I understand it, DCT is better for >> the popular case of using small blocks and expecting them to match at >> the boundary. If you don't use small blocks, I would expect the >> difference to be small. >> >> -- glen
Roughly speaking, by energy compaction it is meant that the most of the energy contained in the signal is captured by small number of components. Thus rest of the components are often assumed to contain noise and they may be discarded. Karhunen-Lo&#4294967295;ve transform has the optimum energy compaction as the basis vectors are the eigen vectors of the correlation/covariance matrix. As it turns out, those eigen vectors are very close to those of DCT for natural images. -- ---- Jani Huhtanen Tampere University of Technology, Pori
So this means that the bulk of the energy of KLT transform is
concentrated in a few transform coeffients and the rest of the coeffs
actually have very less energy distributed between them.

But then why not use KLT instead of DCT?

Partho


Jani Huhtanen wrote:
> Ben wrote: > > > > > Can someone please clarify what they mean by "Energy compaction"? > > > > DCTs operated on macroblocks in images and video frames usually give > > one pixel (top left) as DC, and progressively higher freq AC components > > in the outlying region. > > > > DWTs, on the other hand, have 1 LL subband in the top left, with > > progressively higher frequency (finer) "directional" AC sub-bands. > > > > Is this clustering of LL low freq components or DC components to one > > "corner" of the signal is what you mean by Energy Compaction??? > > > > Partho > > > > > > glen herrmannsfeldt wrote: > >> Raymond Toy wrote: > >> > >> >>>>>>"Ben" =3D=3D Ben <partho.choudhury@gmail.com> writes: > >> > >> > Ben> I think since DCT is just the real part of DFT (e^jw =3D co=
s w +
> >> > jsin w, Ben> Re(e^jw) =3D cos w), the energy (amplitude^2) compa=
ction
> >> > will be the same Ben> in both cases. > >> > >> > DCT is not just the real part of the DFT. > >> > >> I agree, the boundary conditions are different. > >> > >> > And the DCT does a better job at energy compaction than DFT. Jayant > >> > and Noll have a plot that shows this. > >> > >> Well, it seems to me it depends on how the boundary conditions agree > >> with the data. DST (sine transform) has the function go to zero at > >> the boundary, DCT has the derivative go to zero, and DFT has periodic > >> boundary conditions. (There is a better explanation in Numerical > >> Recipes than I can give here.) As I understand it, DCT is better for > >> the popular case of using small blocks and expecting them to match at > >> the boundary. If you don't use small blocks, I would expect the > >> difference to be small. > >> > >> -- glen > > > Roughly speaking, by energy compaction it is meant that the most of the > energy contained in the signal is captured by small number of components. > Thus rest of the components are often assumed to contain noise and they m=
ay
> be discarded. Karhunen-Lo=E8ve transform has the optimum energy compactio=
n as
> the basis vectors are the eigen vectors of the correlation/covariance > matrix. As it turns out, those eigen vectors are very close to those of D=
CT
> for natural images. >=20 > --=20 > ---- > Jani Huhtanen > Tampere University of Technology, Pori
Ben wrote:

> > So this means that the bulk of the energy of KLT transform is > concentrated in a few transform coeffients and the rest of the coeffs > actually have very less energy distributed between them. > > But then why not use KLT instead of DCT? >
It depends on the application. In image compression one would have to send the basis vectors (eigen vectors of the cov matrix) to the decoder. DCT is close enough to KLT of a natural image so that the overhead of sending the data dependant KLT transformation matrix to decoder is not often justifiable.
> Partho > > > Jani Huhtanen wrote: >> Ben wrote: >> >> > >> > Can someone please clarify what they mean by "Energy compaction"? >> > >> > DCTs operated on macroblocks in images and video frames usually give >> > one pixel (top left) as DC, and progressively higher freq AC components >> > in the outlying region. >> > >> > DWTs, on the other hand, have 1 LL subband in the top left, with >> > progressively higher frequency (finer) "directional" AC sub-bands. >> > >> > Is this clustering of LL low freq components or DC components to one >> > "corner" of the signal is what you mean by Energy Compaction??? >> > >> > Partho >> > >> > >> > glen herrmannsfeldt wrote: >> >> Raymond Toy wrote: >> >> >> >> >>>>>>"Ben" == Ben <partho.choudhury@gmail.com> writes: >> >> >> >> > Ben> I think since DCT is just the real part of DFT (e^jw = cos >> >> > w + jsin w, Ben> Re(e^jw) = cos w), the energy (amplitude^2) >> >> > compaction will be the same Ben> in both cases. >> >> >> >> > DCT is not just the real part of the DFT. >> >> >> >> I agree, the boundary conditions are different. >> >> >> >> > And the DCT does a better job at energy compaction than DFT. Jayant >> >> > and Noll have a plot that shows this. >> >> >> >> Well, it seems to me it depends on how the boundary conditions agree >> >> with the data. DST (sine transform) has the function go to zero at >> >> the boundary, DCT has the derivative go to zero, and DFT has periodic >> >> boundary conditions. (There is a better explanation in Numerical >> >> Recipes than I can give here.) As I understand it, DCT is better for >> >> the popular case of using small blocks and expecting them to match at >> >> the boundary. If you don't use small blocks, I would expect the >> >> difference to be small. >> >> >> >> -- glen >> >> >> Roughly speaking, by energy compaction it is meant that the most of the >> energy contained in the signal is captured by small number of components. >> Thus rest of the components are often assumed to contain noise and they >> may be discarded. Karhunen-Lo&#4294967295;ve transform has the optimum energy >> compaction as the basis vectors are the eigen vectors of the >> correlation/covariance matrix. As it turns out, those eigen vectors are >> very close to those of DCT for natural images. >> >> -- >> ---- >> Jani Huhtanen >> Tampere University of Technology, Pori
-- ---- Jani Huhtanen Tampere University of Technology, Pori
tx for clarifying....I had completely forgotten abt the data dependency
of the basis vectors part in KLT....and I used to call myself a video
compression engineer in an earlier life!!!!

Partho

Jani Huhtanen wrote:
> Ben wrote: > > > > > So this means that the bulk of the energy of KLT transform is > > concentrated in a few transform coeffients and the rest of the coeffs > > actually have very less energy distributed between them. > > > > But then why not use KLT instead of DCT? > > > > It depends on the application. In image compression one would have to send > the basis vectors (eigen vectors of the cov matrix) to the decoder. DCT is > close enough to KLT of a natural image so that the overhead of sending the > data dependant KLT transformation matrix to decoder is not often > justifiable. > > > Partho > > > > > > Jani Huhtanen wrote: > >> Ben wrote: > >> > >> > > >> > Can someone please clarify what they mean by "Energy compaction"? > >> > > >> > DCTs operated on macroblocks in images and video frames usually give > >> > one pixel (top left) as DC, and progressively higher freq AC compone=
nts
> >> > in the outlying region. > >> > > >> > DWTs, on the other hand, have 1 LL subband in the top left, with > >> > progressively higher frequency (finer) "directional" AC sub-bands. > >> > > >> > Is this clustering of LL low freq components or DC components to one > >> > "corner" of the signal is what you mean by Energy Compaction??? > >> > > >> > Partho > >> > > >> > > >> > glen herrmannsfeldt wrote: > >> >> Raymond Toy wrote: > >> >> > >> >> >>>>>>"Ben" =3D=3D Ben <partho.choudhury@gmail.com> writes: > >> >> > >> >> > Ben> I think since DCT is just the real part of DFT (e^jw =3D=
cos
> >> >> > w + jsin w, Ben> Re(e^jw) =3D cos w), the energy (amplitude^2) > >> >> > compaction will be the same Ben> in both cases. > >> >> > >> >> > DCT is not just the real part of the DFT. > >> >> > >> >> I agree, the boundary conditions are different. > >> >> > >> >> > And the DCT does a better job at energy compaction than DFT. Jay=
ant
> >> >> > and Noll have a plot that shows this. > >> >> > >> >> Well, it seems to me it depends on how the boundary conditions agree > >> >> with the data. DST (sine transform) has the function go to zero at > >> >> the boundary, DCT has the derivative go to zero, and DFT has period=
ic
> >> >> boundary conditions. (There is a better explanation in Numerical > >> >> Recipes than I can give here.) As I understand it, DCT is better =
for
> >> >> the popular case of using small blocks and expecting them to match =
at
> >> >> the boundary. If you don't use small blocks, I would expect the > >> >> difference to be small. > >> >> > >> >> -- glen > >> > >> > >> Roughly speaking, by energy compaction it is meant that the most of the > >> energy contained in the signal is captured by small number of componen=
ts.
> >> Thus rest of the components are often assumed to contain noise and they > >> may be discarded. Karhunen-Lo=E8ve transform has the optimum energy > >> compaction as the basis vectors are the eigen vectors of the > >> correlation/covariance matrix. As it turns out, those eigen vectors are > >> very close to those of DCT for natural images. > >> > >> -- > >> ---- > >> Jani Huhtanen > >> Tampere University of Technology, Pori >=20 > --=20 > ---- > Jani Huhtanen > Tampere University of Technology, Pori