% This is basically a wrapper we use to test different algorithms
function y = do_ops(magF, angF, realF, imagF, f, sr, maxx)

%DROP ODDS:
%magY = drop_odds(magF);
%Y = magY.*exp(i.*angF);

%MESSING WITH PHASE:
%lf = length(magF);
%phase = [1:lf];
%phase = tan(phase);
%phase = phase';
%Y = magF.*exp(i.*phase);

%RECONSTRUCT FROM REAL ONLY
%Y = realF;

%RECONSTRUCT FROM IMAG ONLY
%Y = imagF;


%DROP ODDS:
%realY = drop_odds(realF);

e = energy(f);
L = length(realF);

%AS IS
%Y = realF + i*imagF;
%stem(magF)
%Y = magF.*exp(i.*angF);


% UNCOMMENT STUFF BELOW THIS LINE TO DO DIFFERENT ALGORITHMS

% IF TRANSFORM IS FFT

% AVERAGER
% uncomment line below to average magnitudes together
% 2nd input is how close together magnitudes need to be
%magF = averager(magF,5);

% MASKING
% use at own risk
%t = [1:100];
%magF = masking(magF,100,-(.00007.*t.^2)+.7);

% PSYCHOACOUSTIC:
% uncomment all the lines below.
% the first number is the sampling rate, dont change it
% change the second two numbers in each function call to be the bits
% for the good and bad frequncy bands respectively
% the fourth number is the quantization 1 = linear 2=tan 3=atan
% if using tan or atan then second to last input is degree of curvature
% the higher, the curvier

%Ymag = psycho(44100,10,8,1,magF,1,0,maxx);
%Yang = psycho(44100,16,16,1,angF,1,0,maxx);
%Y = Ymag.*exp(i.*Yang);

% END OF FFT STUFF


% IF TRANSFORM IS DCT

% EQUALIZER
%realF = equalizer(realF,30,0,2);

% PSYCHOACOUSTIC:
% uncomment all the lines below.
% the first number is the sampling rate, dont change it
% change the second two numbers in each function call to be the bits
% for the good and bad frequncy bands respectively
% the fourth number is the quantization 1 = linear 2=tan 3=atan
% if using tan or atan then second to last input is degree of curvature
% the higher, the curvier

Y = psycho(44100,6,4,1,realF,1,5,maxx);

% END OF DCT STUFF

%Yr = psycho(44100,16,16,1,realF,1,0,maxx);
%Yi = psycho(44100,16,16,1,imagF,1,0,maxx);

%quantize
%time
%y = general_quantize(4,1,f,1,0,maxx);
%freq
%[Y] = general_quantize(16,1,realF,1,0,maxx);

%y=Y;
%Y = Yr + i*Yi;


y = itransform(Y);
ey = energy(y);
if ey*y~=0
   y = e/ey*y;
end