function preparefortest = prepare(aviFileName)
movieObj = aviread(aviFileName);
noOfFrameImages = size(movieObj,2);

for k =1:1:noOfFrameImages
    image = movieObj(k).cdata;
    I(:,:,:,k)=image;
    imageFileNamePrefix = 'im';
    %fileName = strcat(imageFileNamePrefix,num2str(k),'.jpe');
    %imwrite(image,fileName,'jpeg'); 
end
stra=strcat(aviFileName,'_im.mat');
save(stra, 'I', 'noOfFrameImages');

im = I(:,:,:,1);
prehist = imhist(im);
prepixel = double(im);
hist_diffs = [];
pixel_diffs = [];

for k = 2: noOfFrameImages	
	im = I(:,:,:,k);
    
	curhist = imhist(im);
    hist_diff = sqrt(sum((curhist-prehist).*(curhist-prehist)));
    hist_diffs = [hist_diffs; k hist_diff];
    prehist =  curhist;
    
    curpixel = double(im);
    temp1 = curpixel - prepixel;
    temp2 = temp1.*temp1;    
    temp3 = sum(temp2,3);
    temp4 = sum(temp3);
    temp5 = sum(temp4);
    pixel_diff = sqrt(temp5);
    pixel_diffs = [pixel_diffs; k pixel_diff];
    prepixel = curpixel;         
end

stra=strcat(aviFileName,'_diffs.mat');
save(stra,'hist_diffs','pixel_diffs','noOfFrameImages');

return;