Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
dct_blog/dct_quality.m
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
20 lines (15 sloc)
677 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function out=dct_quality(in_xform) | |
| ref_dct = dct(eye(size(in_xform))); | |
| % in_xform can be a scaled transform; determine the corresponding normalized transform. | |
| % first figure out gain factors | |
| gain_factors = diag(in_xform * in_xform'); | |
| % we want to distribute gain equally between forward and inverse transform | |
| normalizer = diag(1 ./ sqrt(gain_factors)); | |
| normalized_xform = normalizer * in_xform; | |
| % compute approximation error in matrix 2-norm | |
| % and coding gains for rho=0.90, rho=0.95 | |
| l2 = norm(normalized_xform - ref_dct, 2); | |
| cg095 = coding_gain(normalized_xform, 0.95); | |
| cg090 = coding_gain(normalized_xform, 0.90); | |
| out = [l2, cg095, cg090]; | |
| end |