Discussion:
[Freetel-codec2] commented out code
Steve
2016-09-16 14:37:25 UTC
Permalink
eric,

if you add:

#ifdef POST_PROCESS_MBE

just before:

float post_process_mbe(COMP Fw[], int pmin, int pmax, float gmax, COMP
Sw[], float W[], float *prev_Wo)

and then add:

#endif

at the bottom of the file nlp.c (after test_candidate_mbe() function) then
the code will
be commented out as it should.

This caused me some troubleshooting fun myself, working on code that isn't
even used.

Oh, also at the top, change it to:

#ifdef POST_PROCESS_MBE
float test_candidate_mbe(COMP Sw[], float W[], float f0);
float post_process_mbe(COMP Fw[], int pmin, int pmax, float gmax, COMP
Sw[], float W[], float *prev_Wo);
#endif

Just before nlp_create()

73/steve
David Rowe
2016-09-16 21:46:33 UTC
Permalink
Thanks Glen and Steve for spotting this unused code. I have #ifdef-ed
out the currently unused code. I'd like to keep it in there, although
unused at present. The algorithm is described in chapter 4 (I think) of
my thesis if anyone is interested in how it works.

Guys - in future a patch would be much appreciated rather than written
instructions - makes it much easier from my side.

Thanks,

David
Post by Steve
eric,
#ifdef POST_PROCESS_MBE
float post_process_mbe(COMP Fw[], int pmin, int pmax, float gmax, COMP
Sw[], float W[], float *prev_Wo)
#endif
at the bottom of the file nlp.c (after test_candidate_mbe() function)
then the code will
be commented out as it should.
This caused me some troubleshooting fun myself, working on code that
isn't even used.
#ifdef POST_PROCESS_MBE
float test_candidate_mbe(COMP Sw[], float W[], float f0);
float post_process_mbe(COMP Fw[], int pmin, int pmax, float gmax, COMP
Sw[], float W[], float *prev_Wo);
#endif
Just before nlp_create()
73/steve
------------------------------------------------------------------------------
_______________________________________________
Freetel-codec2 mailing list
https://lists.sourceforge.net/lists/listinfo/freetel-codec2
------------------------------------------------------------------------------
glen english
2016-09-16 22:53:47 UTC
Permalink
My video compression work tells me we almost need something else rather
than a bit for bit compares.

something like a SN or difference merit

Anyone familiar with video compression will understand this concept .
We would do an encode- decode and then look at the RMS, peak, and
various other stats difference between the input and output .

The tools would line up / correlate the frames to get the compare
occurring at the right temporal location.

On 17/09


------------------------------------------------------------------------------
Danilo Beuche
2016-09-16 23:13:27 UTC
Permalink
Hi,

If the goal is to identify regressions, comparing the previously generated output data to the output of the changed code is sufficient. And for this we can simply compare the value by value difference since beside rounding errors the output should be very close. For that a simple value by value difference should be good enough.

For general work a quality check by comparing input and output properties like Glen suggested would be nice.


Danilo
Post by glen english
My video compression work tells me we almost need something else rather
than a bit for bit compares.
something like a SN or difference merit
Anyone familiar with video compression will understand this concept .
We would do an encode- decode and then look at the RMS, peak, and
various other stats difference between the input and output .
The tools would line up / correlate the frames to get the compare
occurring at the right temporal location.
On 17/09
------------------------------------------------------------------------------
_______________________________________________
Freetel-codec2 mailing list
https://lists.sourceforge.net/lists/listinfo/freetel-codec2
Danilo Beuche
2016-09-16 23:36:27 UTC
Permalink
Hi,
Post by Danilo Beuche
Hi,
If the goal is to identify regressions, comparing the previously
generated output data to the output of the changed code is sufficient.
And for this we can simply compare the value by value difference since
beside rounding errors the output should be very close. For that a
simple value by value difference should be good enough.
Of course the assumption is that the output signal data is captured
directly, i.e. not via an audio interface. E.g. freedv_rx / freedv_tx or
similar approaches. Otherwise all sorts of timing errors may occur and
frame identification is necessary.
Post by Danilo Beuche
For general work a quality check by comparing input and output
properties like Glen suggested would be nice.
Danilo
Post by Danilo Beuche
Danilo
Post by glen english
My video compression work tells me we almost need something else rather
than a bit for bit compares.
something like a SN or difference merit
Anyone familiar with video compression will understand this concept .
We would do an encode- decode and then look at the RMS, peak, and
various other stats difference between the input and output .
The tools would line up / correlate the frames to get the compare
occurring at the right temporal location.
On 17/09
------------------------------------------------------------------------------
_______________________________________________
Freetel-codec2 mailing list
https://lists.sourceforge.net/lists/listinfo/freetel-codec2
------------------------------------------------------------------------------
_______________________________________________
Freetel-codec2 mailing list
https://lists.sourceforge.net/lists/listinfo/freetel-codec2
glen english
2016-09-16 23:41:42 UTC
Permalink
------------------------------------------------------------------------------
Danilo Beuche
2016-09-17 01:21:09 UTC
Permalink
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()
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)
Hi,
------------------------------------------------------------------------------
_______________________________________________
Freetel-codec2 mailing list
https://lists.sourceforge.net/lists/listinfo/freetel-codec2
glen english
2016-09-17 01:58:56 UTC
Permalink
------------------------------------------------------------------------------
glen english
2016-09-17 02:04:28 UTC
Permalink
------------------------------------------------------------------------------
Danilo Beuche
2016-09-17 02:28:31 UTC
Permalink
Hi,

of course it is

"import struct". This somehow got lost when I pasted it in.

Danilo
Post by Danilo Beuche
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
lw = struct.unpack('h',left.read(2))[0]
rw = struct.unpack('h',right.read(2))[0]
out.write(struct.pack('h',lw-rw))
differenceCount = differenceCount + 1
errorCount = errorCount+1
errorValue = float(abs(lw-rw))/float(abs(lw))
errorMax = max(errorMax,errorValue)
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
pass
print "Differences total (in %): {}
({}%)\n".format(differenceCount,100.0*differenceCount/float(count))
{}\n".format(marginAbsolute,errorCount)
{}\n".format(marginFactor*100,errorMarginCount)
print "Highest difference in %: {}".format(errorMax*100)
out.close()
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)
Hi,
------------------------------------------------------------------------------
_______________________________________________
Freetel-codec2 mailing list
https://lists.sourceforge.net/lists/listinfo/freetel-codec2
------------------------------------------------------------------------------
_______________________________________________
Freetel-codec2 mailing list
https://lists.sourceforge.net/lists/listinfo/freetel-codec2
Danilo Beuche
2016-09-17 02:28:46 UTC
Permalink
Hi,

of course it is

"import struct". This somehow got lost when I pasted it in.

Danilo
Post by Danilo Beuche
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
lw = struct.unpack('h',left.read(2))[0]
rw = struct.unpack('h',right.read(2))[0]
out.write(struct.pack('h',lw-rw))
differenceCount = differenceCount + 1
errorCount = errorCount+1
errorValue = float(abs(lw-rw))/float(abs(lw))
errorMax = max(errorMax,errorValue)
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
pass
print "Differences total (in %): {}
({}%)\n".format(differenceCount,100.0*differenceCount/float(count))
{}\n".format(marginAbsolute,errorCount)
{}\n".format(marginFactor*100,errorMarginCount)
print "Highest difference in %: {}".format(errorMax*100)
out.close()
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)
Hi,
------------------------------------------------------------------------------
_______________________________________________
Freetel-codec2 mailing list
https://lists.sourceforge.net/lists/listinfo/freetel-codec2
------------------------------------------------------------------------------
_______________________________________________
Freetel-codec2 mailing list
https://lists.sourceforge.net/lists/listinfo/freetel-codec2
Continue reading on narkive:
Loading...