?? makeqtable.m
字號(hào):
function [coefScaleFactor, compressionFactor] = makeQTable(halfMax)%% AUTHOR: B. Wandell% DATE: 10.20.94%% PURPOSE:% Make a quantization table for the JPEG quantization% step. The formula is based on cutting down the number of bits% as a function of distance from the origin. The function can be% made to fall off more or less quickly based on the halfMax parameter.%%x = 1:128;%plot(x ./ (x + halfMax));nBits = zeros(8,8);for i=1:8 for j=1:8% nBits(i,j) = 8 - (i^2 + j^2)^0.5; d = i^2 + j^2; nBits(i,j) = 8 - ( (8*d) / (d + halfMax)); endendma = max(nBits(:));mn = min(nBits(:));nBits = round( 8* (nBits - mn) ./ (ma - mn));compressionFactor = 512/sum(sum(nBits))coefScaleFactor = 2 .^ (nBits - 8);
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -