You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: decompression_hdl.m
    path of file: ./repos/microshift_compression/verilog code/matlab_files
    
    the code of the file until where you have to start completion: function I_recover1 = decompression_hdl(encoded_bitstream,height,width,I_truth,subimage_index,I_subimages)

pixel_index = 1;     % point to the pixel to be processed
bitstream_index = 1; % point to the next bit
bitstream_length = length(encoded_bitstream);
I_recover = zeros(height*width,1);
range = 8;
I_truth_vector = I_truth';
I_truth_vector = I_truth_vector(:);
residue_learned = load('residue_learned1.mat');
residue_learned = int(residue_learned.residue_learned1);

mode = 0;
while (bitstream_index <= bitstream_length)
    if (mode == 0)
        % context calculation
        [a,b,c,d,e] = context_calculation_zeropad(I_recover, width, pixel_index);
        xx = ceil(pixel_index/width);

    
function I_recover1 = decompression_hdl(encoded_bitstream,height,width,I_truth,subimage_index,I_subimages)

pixel_index = 1;     % point to the pixel to be processed
bitstream_index = 1; % point to the next bit
bitstream_length = length(encoded_bitstream);
I_recover = zeros(height*width,1);
range = 8;
I_truth_vector = I_truth';
I_truth_vector = I_truth_vector(:);
residue_learned = load('residue_learned1.mat');
residue_learned = int(residue_learned.residue_learned1);

mode = 0;
while (bitstream_index <= bitstream_length)
    if (mode == 0)
        % context calculation
        [a,b,c,d,e] = context_calculation_zeropad(I_recover, width, pixel_index);
        xx = ceil(pixel_index/width);
        yy = mod(pixel_index,width);
        if yy == 0
            yy = width;
        end