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: fftconv2.m
    path of file: ./repos/Image-Harmonization-Dataset-iHarmony4/Lalonde and Efros/colorStatistics/3rd_party/segmentationBerkeley/Util
    
    the code of the file until where you have to start completion: function fim = fftconv2(im,f)
% function fim = fftconv2(im,f)

    
function fim = fftconv2(im,f)
% function fim = fftconv2(im,f)
%
% Convolution using FFT.
% 
% David R. Martin <dmartin@eecs.berkeley.edu>
% March 2003

% wrap the filter around the origin and pad with zeros
padf = zeros(size(im));
r = floor(size(f,1)/2);
padf(1:r+1,1:r+1) = f(r+1:end