0
$\begingroup$

How can I do point by point multiplication of the quantized DCT coefficients with the quantization matrix before computing the inverse DCT for each block? I want to modify the reconstruction algorithm to approximately undo the quantization step shown here:

for i = 1:Blocks
    for j=1:Blocks
        irange = (i-1)*8+1:(i-1)*8+8;
        jrange = (j-1)*8+1:(j-1)*8+8;
        quantblock = round(y(irange,jrange)./Q);
        quant_DCTblocks(irange,jrange) = quantblock;
    end
end
figure
imagesc(quant_DCTblocks)
colormap(gray)
set(gca,'Xtick',[])
set(gca,'Ytick',[])
axis('square')
title('quantized DCT Coeffs')
$\endgroup$
1
$\begingroup$

From the code it looks like the quantization step is doing two things: 1) dividing by "Q", and 2) rounding. Undoing the divide by Q is easy. The rounding is where the actual quantizing is happening though, and unfortunately that is the part that you cannot undo- at least not without more information. Rounding causes information to be lost and you cannot undo that.

$\endgroup$
  • $\begingroup$ So can you explicitly tell me which lines of the code should be changed? except rounding ? $\endgroup$ – Mona Jalal Mar 8 '14 at 4:43
  • $\begingroup$ If you don't want to quantize just don't round. $\endgroup$ – Jim Clay Mar 8 '14 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.