%EUSIPCO 2012
%Imperial College London 
%Andriy Gelman, Jon Onativia and Pier Luigi Dragotti 

function  out = integer_shift(input, total_shift)

%function applies a shift to the data
if abs(total_shift) > 0
    [r,c,k] = size(input);  
    %Pad Signal

    sig_pad = zeros(r,c+2,k);
    sig_pad(:,2:end-1,:) = input;

    sig_pad = padarray(sig_pad, [0, abs(total_shift) - 1],'both');

    coords = [abs(total_shift) + 1, length(sig_pad(1,:,1)) - abs(total_shift)];

    sig_pad = circshift(sig_pad, [0, -total_shift]);

    out = sig_pad(:,coords(1):coords(2),:);
else
    out = input;
end
    
end


