Cody

# Problem 929. Rearrange coefficients after block based DCT transform.

Solution 1216280

Submitted on 20 Jun 2017
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
x = ones(16); for N=2.^(1:4) for M=2.^(1:4) y = block_dct2(x, N, M); y_corr = [sqrt(N*M)*ones(16/N, 16/M), zeros(16/N,16-16/M); zeros(16-16/N,16)]; assert( norm( y_corr(:) - y(:)) < 1e-10 ); end end

Undefined function 'blkproc' for input arguments of type 'function_handle'. Error in block_dct2 (line 3) blkproc(I,[n m],@dct2) Error in TestPoint1 (line 4) y = block_dct2(x, N, M);

2   Fail
x = eye(16); y_corr = eye(16); for N=2.^(1:4) y = block_dct2(x, N, N); assert( norm( y_corr(:) - y(:)) < 1e-10 ); end

Undefined function 'blkproc' for input arguments of type 'function_handle'. Error in block_dct2 (line 3) blkproc(I,[n m],@dct2) Error in TestPoint2 (line 4) y = block_dct2(x, N, N);

3   Fail
x = double(invhilb(8)>0); y = block_dct2(x, 2, 2); y_corr = [ones(4),zeros(4);zeros(4),ones(4)]; assert( norm( y_corr(:) - y(:)) < 1e-10 );

Undefined function 'blkproc' for input arguments of type 'function_handle'. Error in block_dct2 (line 3) blkproc(I,[n m],@dct2) Error in TestPoint3 (line 2) y = block_dct2(x, 2, 2);

4   Fail
x = double(invhilb(4)>0); y = block_dct2(x, 1, 2); y_corr = (sqrt(2)/2)*[1 1 1 1; 1 1 -1 -1; 1 1 1 1; 1 1 -1 -1]; assert( norm( y_corr(:) - y(:)) < 1e-10 );

Undefined function 'blkproc' for input arguments of type 'function_handle'. Error in block_dct2 (line 3) blkproc(I,[n m],@dct2) Error in TestPoint4 (line 2) y = block_dct2(x, 1, 2);

5   Fail
x = 5; y = block_dct2(x, 1, 1); assert( abs(y - 5) < 1e-10 );

Undefined function 'blkproc' for input arguments of type 'function_handle'. Error in block_dct2 (line 3) blkproc(I,[n m],@dct2) Error in TestPoint5 (line 2) y = block_dct2(x, 1, 1);

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!