summaryrefslogtreecommitdiffstats
path: root/baseline/source/cjpeg_wrbmp
diff options
context:
space:
mode:
authorJoshua Bakita <bakitajoshua@gmail.com>2019-10-19 10:50:23 -0400
committerJoshua Bakita <bakitajoshua@gmail.com>2019-10-19 10:50:23 -0400
commit4f1aa00f177646b5129304a7d587658aad949946 (patch)
tree925a103d779bd7ae2f6568907051f8ce43b868b4 /baseline/source/cjpeg_wrbmp
parent7e6ceb16b53fdbdb2a27cf3ade15d32177ff811f (diff)
Support LITMUS, MC^2, and alternate benchmarks
Diffstat (limited to 'baseline/source/cjpeg_wrbmp')
0 files changed, 0 insertions, 0 deletions
='#n56'>56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84



















































































                                                                                        
function [filter_output,filters] = compute_filter_fft(I,sig,r,sz,num_ori);
%
%
%

ori_incr=180/num_ori;
ori_offset=ori_incr/2; % helps with equalizing quantiz. error across filter set

as = ori_offset:ori_incr:180+ori_offset-ori_incr;

filter_output = [];
filters = [];

wsz = 2*round(sz(end)) + 1;
M1 = wsz;M2 = wsz;

%%%%% prepare FFT of image  %%%%%%%%%%%%%

[N1,N2]=size(I);
tmp=zeros(size(I)+[M1-1 M2-1]);
tmp(1:N1,1:N2)=I;
IF=fft2(tmp);


%%%%%%%%%% filtering stage %%%%%%%%%%%
if size(sig,2)== 1,

  for j = 1:length(as),
    fprintf('.');
    angle = as(j);

    g = mdoog2(sig,r,angle,round(sz));

    g = g - mean(reshape(g,prod(size(g)),1));

    g = g/sum(sum(abs(g)));

    filters(:,:,j) = g;

    gF  = fft2(g,N1+M1-1,N2+M2-1);
    IgF = IF.*gF;
    Ig  = real(ifft2(IgF));
    Ig  = Ig(ceil((M1+1)/2):ceil((M1+1)/2)+N1-1,ceil((M2+1)/2):ceil((M2+1)/2)+N2-1);
   
    %c = conv2(I,g,'valid');

    filter_output(:,:,j) = Ig;
  end
else

  % there are multiple scales
  sigs = sig;
  szs = sz;
  for k = 1:size(sigs,2),
     sig = sigs(k);
     sz = szs(end);
     fprintf('%d',k);
     for j = 1:length(as),
    	fprintf('.');
    	angle = as(j);

    	g = mdoog2(sig,r,angle,round(sz));
	g = g - mean(reshape(g,prod(size(g)),1));
	g = g/sum(sum(abs(g)));

	gF  = fft2(g,N1+M1-1,N2+M2-1);
    	IgF = IF.*gF;
    	Ig  = real(ifft2(IgF));
    	Ig  = Ig(ceil((M1+1)/2):ceil((M1+1)/2)+N1-1,ceil((M2+1)/2):ceil((M2+1)/2)+N2-1);
   
        %c = conv2(I,g,'valid');
        %c = conv2(I,g,'same');

	filter_output(:,:,j,k) = Ig;
 	filters(:,:,j,k) = g; 
     end


  end

end

fprintf('\n');