function I = predictive_decoding(Ip, predictor)

    I = double(Ip);
    
    predictor(end, end) = 0;
    
    for i = size(predictor, 1):size(I,1)
        for j = size(predictor, 2):size(I,2)
            I(i,j) = Ip(i,j) + round(sum(sum(predictor.*I(i-size(predictor,1)+1:i, j-size(predictor,2)+1:j))));
        end
    end
    
    I = uint8(I);

end