c and c++ version of filtfilt() in Matlab