#!/bin/bash
(set -o igncr) 2>/dev/null && set -o igncr; # force bash to ignore \r character

#
# This script can be used to verify the bit exactness of iLBC fixed-point version 1.0.6
#

INP=../../../../../../../test/data/audio_coding
EXEP=../../../../../../../out/Release
OUTP=./GeneratedFiles
mkdir ./GeneratedFiles

$EXEP/iLBCtest 20 $INP/F00.INP $OUTP/F00.BIT20 $OUTP/F00.OUT20 $INP/clean.chn
$EXEP/iLBCtest 20 $INP/F01.INP $OUTP/F01.BIT20 $OUTP/F01.OUT20 $INP/clean.chn
$EXEP/iLBCtest 20 $INP/F02.INP $OUTP/F02.BIT20 $OUTP/F02.OUT20 $INP/clean.chn
$EXEP/iLBCtest 20 $INP/F03.INP $OUTP/F03.BIT20 $OUTP/F03.OUT20 $INP/clean.chn
$EXEP/iLBCtest 20 $INP/F04.INP $OUTP/F04.BIT20 $OUTP/F04.OUT20 $INP/clean.chn
$EXEP/iLBCtest 20 $INP/F05.INP $OUTP/F05.BIT20 $OUTP/F05.OUT20 $INP/clean.chn
$EXEP/iLBCtest 20 $INP/F06.INP $OUTP/F06.BIT20 $OUTP/F06.OUT20 $INP/clean.chn

$EXEP/iLBCtest 30 $INP/F00.INP $OUTP/F00.BIT30 $OUTP/F00.OUT30 $INP/clean.chn
$EXEP/iLBCtest 30 $INP/F01.INP $OUTP/F01.BIT30 $OUTP/F01.OUT30 $INP/clean.chn
$EXEP/iLBCtest 30 $INP/F02.INP $OUTP/F02.BIT30 $OUTP/F02.OUT30 $INP/clean.chn
$EXEP/iLBCtest 30 $INP/F03.INP $OUTP/F03.BIT30 $OUTP/F03.OUT30 $INP/clean.chn
$EXEP/iLBCtest 30 $INP/F04.INP $OUTP/F04.BIT30 $OUTP/F04.OUT30 $INP/clean.chn
$EXEP/iLBCtest 30 $INP/F05.INP $OUTP/F05.BIT30 $OUTP/F05.OUT30 $INP/clean.chn
$EXEP/iLBCtest 30 $INP/F06.INP $OUTP/F06.BIT30 $OUTP/F06.OUT30 $INP/clean.chn

$EXEP/iLBCtest 20 $INP/F00.INP $OUTP/F00.BIT20 $OUTP/F00_tlm10.OUT20 $INP/tlm10.chn
$EXEP/iLBCtest 20 $INP/F01.INP $OUTP/F01.BIT20 $OUTP/F01_tlm10.OUT20 $INP/tlm10.chn
$EXEP/iLBCtest 20 $INP/F02.INP $OUTP/F02.BIT20 $OUTP/F02_tlm10.OUT20 $INP/tlm10.chn
$EXEP/iLBCtest 30 $INP/F00.INP $OUTP/F00.BIT30 $OUTP/F00_tlm10.OUT30 $INP/tlm10.chn
$EXEP/iLBCtest 30 $INP/F01.INP $OUTP/F01.BIT30 $OUTP/F01_tlm10.OUT30 $INP/tlm10.chn
$EXEP/iLBCtest 30 $INP/F02.INP $OUTP/F02.BIT30 $OUTP/F02_tlm10.OUT30 $INP/tlm10.chn


diff $OUTP/F00.BIT20 $INP/F00.BIT20
diff $OUTP/F01.BIT20 $INP/F01.BIT20
diff $OUTP/F02.BIT20 $INP/F02.BIT20
diff $OUTP/F03.BIT20 $INP/F03.BIT20
diff $OUTP/F04.BIT20 $INP/F04.BIT20
diff $OUTP/F05.BIT20 $INP/F05.BIT20
diff $OUTP/F06.BIT20 $INP/F06.BIT20
diff $OUTP/F00.OUT20 $INP/F00.OUT20
diff $OUTP/F01.OUT20 $INP/F01.OUT20
diff $OUTP/F02.OUT20 $INP/F02.OUT20
diff $OUTP/F03.OUT20 $INP/F03.OUT20
diff $OUTP/F04.OUT20 $INP/F04.OUT20
diff $OUTP/F05.OUT20 $INP/F05.OUT20
diff $OUTP/F06.OUT20 $INP/F06.OUT20

diff $OUTP/F00.BIT30 $INP/F00.BIT30
diff $OUTP/F01.BIT30 $INP/F01.BIT30
diff $OUTP/F02.BIT30 $INP/F02.BIT30
diff $OUTP/F03.BIT30 $INP/F03.BIT30
diff $OUTP/F04.BIT30 $INP/F04.BIT30
diff $OUTP/F05.BIT30 $INP/F05.BIT30
diff $OUTP/F06.BIT30 $INP/F06.BIT30
diff $OUTP/F00.OUT30 $INP/F00.OUT30
diff $OUTP/F01.OUT30 $INP/F01.OUT30
diff $OUTP/F02.OUT30 $INP/F02.OUT30
diff $OUTP/F03.OUT30 $INP/F03.OUT30
diff $OUTP/F04.OUT30 $INP/F04.OUT30
diff $OUTP/F05.OUT30 $INP/F05.OUT30
diff $OUTP/F06.OUT30 $INP/F06.OUT30

diff $OUTP/F00_tlm10.OUT20 $INP/F00_tlm10.OUT20
diff $OUTP/F01_tlm10.OUT20 $INP/F01_tlm10.OUT20
diff $OUTP/F02_tlm10.OUT20 $INP/F02_tlm10.OUT20
diff $OUTP/F00_tlm10.OUT30 $INP/F00_tlm10.OUT30
diff $OUTP/F01_tlm10.OUT30 $INP/F01_tlm10.OUT30
diff $OUTP/F02_tlm10.OUT30 $INP/F02_tlm10.OUT30

