I have to split, from an array (1D), in blocks of 64, the first element (DC), and another 63 elements (AC) in separate arrays.
I made the UGLY code above:
%split DC from AC
n = 8^2;
DC = zigZagLinha(1 : n : end);
AC = blkproc(zigZagLinha, [1 n],'returnsTheOther63');
;
function array=returnsTheOther63(array64)
array = array64(2:64);
end
Is there a more elegant way to do this? It's for academic purposes, so, the cleaner, the better.
You can simply reshape it:
res = reshape( zigZagLinha, 64, [] ); % assuming num of elements can be divided by 64 exactly
% otherwise some padding should be done...
DC = res(1 ,: ); % collect all first elements
AC = res( 2:end, : ); % AC elements
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With