Hi,

I solved my "difference analysis" problem with a simple python script, which takes 2 files (left.out and right.out) as input and does 16 bit value compares. It expects both files to be of same length. Difference is written to diff.out


It compares against an absolute error ( for me set to 1, i.e. least significant bit difference is permitted) and 1%. For my change it turns out, it creates only LSB difference, so not a problem here.

Danilo

----------------------


import sruct

# word counter
count = 0

# absolute difference before seen as relevant difference
# 1 -> single bit difference
marginAbsolute = 1

# from which (difference divded by reference value (left.out))
# it is considered to be an serious error
marginFactor = 0.01
errorMax = 0.0

# how many differences
differenceCount = 0

# how many differences are higher than errorAbsolute
errorCount = 0

# how many of these differences are considered to cross the margin
errorMarginCount = 0

with open('diff.out', 'wbt') as out:
    with open('left.out', 'r') as left:
        with open('right.out', 'rb') as right:
            try:
                lw = struct.unpack('h',left.read(2))[0]
                rw = struct.unpack('h',right.read(2))[0]
                while (True):
                    out.write(struct.pack('h',lw-rw))
                    if abs(lw - rw) > 0:
                        differenceCount = differenceCount + 1
                    if abs(lw - rw) > marginAbsolute:
                        errorCount = errorCount+1
                        errorValue = float(abs(lw-rw))/float(abs(lw))
                        errorMax = max(errorMax,errorValue)
                        if errorValue >= marginFactor:
                            errorMarginCount = errorMarginCount+1
                            print "{},{} -> {}".format(lw,rw,errorValue)
                    lw = struct.unpack('h',left.read(2))[0]
                    rw = struct.unpack('h',right.read(2))[0]
                    count = count + 1
            except:
                pass
print "Differences total (in %): {} ({}%)\n".format(differenceCount,100.0*differenceCount/float(count)) print "Differences of more than {}: {}\n".format(marginAbsolute,errorCount) print "Differences above {}%: {}\n".format(marginFactor*100,errorMarginCount)
            print "Highest difference in %: {}".format(errorMax*100)


    out.close()



 Am 17.09.2016 um 01:41 schrieb glen english:
it's fairly easy to just use a sliding correlator and sync up the audio for the compare/ MSE computation etc

you might want to oversample it say 4x inside the PC before the correlation- up to 32ksps from 8ksps

assumption is it is all done in the digital domain.

if done with SSE instructions, can do 128 bit worth of compare for the correlator per clock cycle.. (or 256 for the new AVX inst set)

On 17/09/2016 9:36 AM, Danilo Beuche wrote:

Hi,

to extended my own post:
On 17.09.2016 01:13, Danilo Beuche wrote:



------------------------------------------------------------------------------


_______________________________________________
Freetel-codec2 mailing list
Freetel-codec2@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freetel-codec2

------------------------------------------------------------------------------
_______________________________________________
Freetel-codec2 mailing list
Freetel-codec2@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freetel-codec2

Reply via email to