view toolboxes/AudioInpaintingToolbox/Utils/evaluation/SNR.m @ 178:4ea4badb2266 danieleb

added ramirez dl (to be completed) and MOCOD dictionary update
author Daniele Barchiesi <daniele.barchiesi@eecs.qmul.ac.uk>
date Thu, 17 Nov 2011 11:22:17 +0000
parents 56d719a5fd31
children
line wrap: on
line source
function snr = SNR(xRef,xEst)
% Signal-to-noise Ratio
%
% Usage: snr = SNR(xRef,xEst)
%
%
% Inputs:
%          - xRef - reference signal
%          - xEst - estimate signal
%
% Outputs:
%          - snr - SNR
%
%
% -------------------
%
% Audio Inpainting toolbox
% Date: June 28, 2011
% By Valentin Emiya, Amir Adler, Maria Jafari
% This code is distributed under the terms of the GNU Public License version 3 (http://www.gnu.org/licenses/gpl.txt).
% Signal to noise ratio (SNR)

% Add eps to avoid NaN/Inf values
snr = 10*log10((sum(abs(xRef(:)).^2)+eps)/sum((abs(xRef(:)-xEst(:)).^2)+eps));

return