function y=perm_zigzag(x)
% perm_zigzag.m
%   perform zigzag-scan-based permutation
%
% Requirement:
%   ZIGZAG_SCAN: zigzag.m and invzigzag.m
% Input:
%   x: original DCT2 coefficient matrix
% Output:
%   y: matrix after zigzag-scan-based permutation
%
% Written: Hao Fang
% Created: Mar. 2012

[m n] = size(x);
x_zigzag = reshape(zigzag(x), n, m);
y = x_zigzag';
