length(lambda)

% % % %a lo Minstsu
%   figure;
%   cstring='rgbcmyk'; % color string
%   dstring='o*s^';
%   estring='-:';
%   i = 1;
%   
%   P = 5;
%   
%   for nlambda = 1:1:10
%       pp = PSNRN_SynthRobusto(nlambda,P,:) - PSNR_SynthpckErr(nlambda,P,:);
% %       tt = rate_SynthRobusto(nlambda,P,:);
% % %       if (mod(nlambda,7)+1 == 1)
% % %           hold on; plot(tt(:),pp(:),cstring(i));
% % %           i = mod(i + 1, 7);
% %           hold on; plot(tt(:),pp(:),[cstring(mod(nlambda,7)+1) dstring(mod(nlambda,4)+1) estring(mod(nlambda,2)+1)]);
%           hold on; plot(pp(:),[cstring(mod(nlambda,7)+1) dstring(mod(nlambda,4)+1) estring(mod(nlambda,2)+1)]);
%           
% % %       end
%   end
%           legend('1','2','3','4','5','6','7','8','10')

%   figure;
%   cstring='rgbcmyk'; % color string
%   dstring='o*s^';
%   estring='-:';
%   for nlambda = 17:1:25
%       y = psnr_frame(['Results\Syth_QP21_RobustoErr2_L'  num2str(nlambda) '_pckErr2.y'], 'Results\Syth_wFeedbck_QP21.y', w, h, nframes);
%       hold on; plot(y,[cstring(mod(nlambda,7)+1) dstring(mod(nlambda,4)+1) estring(mod(nlambda,2)+1)]);          
%   end
%       legend('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25');

  
  

% lamb = 9; P = 2;          
% rr = rate_SynthRobusto(lamb,P,:);
% pp_erro = PSNR_SynthpckErr(lamb,P,:);
% 
% pp_Fb_Err = PSNR_SynthFeedbckErr(P,:);
% rr_Fb_Err = rate_SynthFeedbckErr(P,:);

% y = psnr_frame('Results\Syth_wFeedbck_QP23_pckErr2.yuv', 'Results\Syth_wFeedbck_QP23.yuv', w, h, nframes);
% figure; plot(y);
% hold on;
% 
% y = psnr_frame('Results\Syth_QP23_RobustoErr2_L25_pckErr2.yuv', 'Results\Syth_wFeedbck_QP23.yuv', w, h, nframes);
% plot(y,'r');
% 
% y = psnr_frame('Results\Syth_QP23_RobustoErr2_L25.yuv', 'Results\Syth_wFeedbck_QP23.yuv', w, h, nframes);
% plot(y,'k');
% 
% legend('Regular H.264 + Feedback', 'Modified H.264 w/ error + Feedback', 'Modified H.264 + Feedback');
% title('Champagne - synthesis (5% pkg losses, QP 21)');
% xlabel('Frame number');
% ylabel('PSNR');
% hold off          
for l=1:1:25 
y = psnr_frame('Results\Syth_Normal_QP37.yuv', 'Results\color-cam40.yuv', w, h, nframes);
figure; plot(y,'b');
hold on;

y = psnr_frame('Results\Syth_Normal_QP37_pckErr2.yuv', 'Results\color-cam40.yuv', w, h, nframes);
plot(y,'r');

% = psnr_frame('H264_Original\bin\kendo\Syth_QP22_IntraB_pckErr2.yuv', 'Results_kendo\color-cam40.yuv', w, h, nframes);
% y = psnr_frame('Results\Syth_wFeedbck_QP27_pckErr1.yuv',
% 'Results\Syth_wFeedbck_QP27.yuv', w, h, nframes);

y = psnr_frame('Results\Nopt\Syth_QP37_Nopt_pckErr2.yuv', 'Results\color-cam40.yuv', w, h, nframes);
plot(y,'g');

%y = psnr_frame(['Results\Syth_QP37_RobustoErr2_L' num2str(l) '_pckErr2.yuv'], 'Results\color-cam40.yuv', w, h, nframes);
y = psnr_frame('Results\Syth_QP37_RobustoErr2_L17_pckErr2.yuv', 'Results\color-cam40.yuv', w, h, nframes);
%y = psnr_frame('Results\Syth_QP27_RobustoErr1_L1_pckErr1.yuv', 'Results\Syth_QP27_RobustoErr1_L1.yuv', w, h, nframes);
plot(y,'k');

% legend('Regular H.264 + Feedback', 'Modified H.264 w/o error + Feedback', 'Modified H.264 w/ error + Feedback');
legend('Conventional H.264 without Errors', 'Conventional H.264 w/ Errors', 'Conventioanl H.264 + Feedback & Intra Refresh','Modified H.264 w/ Errors','Location', 'Best');
title('Kendo - QP 37 - Synthesized view (3% pkg losses)');
xlabel('Frame number');
ylabel('PSNR');
grid on;
hold off;  
end

%  figure;
%  cstring='rgbcmyk'; % color string
%  
%  i = 1;
%  
%  for nlambda = 1:1:length(lambda)
%      pp = PSNRErrCorr(nlambda,1,:,1);
%      tt = rateErrCorr(nlambda,1,:,1);
%      if (mod(nlambda,7)+1 == 1)
%          hold on; plot(tt(:),pp(:),cstring(i));
%          i = mod(i + 1, 7);
%          hold on; plot(tt(:),pp(:),cstring(mod(nlambda,7)+1));
%          2
%      end
%  end
 
 
% for nqps = 1:1:length(qps)
%     find(PSNRErrCorr(:,5,nqps,1) == max(PSNRErrCorr(:,5,nqps,1)))
% end

% % % 
% % rr = rateErrCorr(34,2,:,1);
% % pp = PSNRErrCorr(34,2,:,1);
% % figure; hold on;
% % plot(rateNormal(2,:,1),PSNRNormal(2,:,1), 'b');
% % plot(rateFeedbck(2,:,1),PSNRFeedbck(2,:,1), 'r');
% % plot(rr(:),pp(:), 'k');

y = psnr_frame('Results\depth-cam41_Normal_QP17_pckErr2.yuv', 'Results\depth-cam41.yuv', w, h, nframes);
figure; plot(y);
hold on;

y = psnr_frame('Results\depth-cam41_wFeedbck_QP17_pckErr2.yuv', 'Results\depth-cam41.yuv', w, h, nframes);
plot(y,'r');

y = psnr_frame('Results\depth-cam41_QP17_RobustoErr2_L30_pckErr2.yuv', 'Results\depth-cam41.yuv', w, h, nframes);
plot(y,'k');

legend('Regular H.264','Regular H.264 + Feedback', 'Modified H.264 + Feedback');
title('Champagne - depth view 41 (5% pkg losses, QP 37)');
xlabel('Frame number');
ylabel('PSNR');
hold off


y = psnr_frame('Results\depth-cam39_Normal_QP17_pckErr2.yuv', 'Results\depth-cam39.yuv', w, h, nframes);
figure; plot(y);
hold on;

y = psnr_frame('Results\depth-cam39_wFeedbck_QP17_pckErr2.yuv', 'Results\depth-cam39.yuv', w, h, nframes);
plot(y,'r');

y = psnr_frame('Results\depth-cam39_QP17_RobustoErr2_L30_pckErr2.yuv', 'Results\depth-cam39.yuv', w, h, nframes);
plot(y,'k');

legend('Regular H.264','Regular H.264 + Feedback', 'Modified H.264 + Feedback');
title('Champagne - depth view 39 (5% pkg losses, QP 37)');
xlabel('Frame number');
ylabel('PSNR');
hold off
