audioquantize: fix 8-pole noise shaping
authorWim Taymans <wtaymans@redhat.com>
Wed, 28 Oct 2015 10:32:57 +0000 (11:32 +0100)
committerWim Taymans <wtaymans@redhat.com>
Wed, 28 Oct 2015 10:36:18 +0000 (11:36 +0100)
Fix the 8-pole noise shaping error update. We were mixing errors from
different channels.

gst/audioconvert/gstaudioquantize.c

index b61860e..1759250 100644 (file)
@@ -286,14 +286,14 @@ static const gdouble ns_high_coeffs[] = {
 #define ADD_NS_HIGH()                                                   \
         cur_error = 0.0;                                                \
         for (j = 0; j < 8; j++)                                         \
-          cur_error += errors[chan_pos + j] * ns_high_coeffs[j];          \
+          cur_error += errors[chan_pos*8 + j] * ns_high_coeffs[j];      \
         tmp -= cur_error;                                               \
         orig = tmp;
 
 #define UPDATE_ERROR_HIGH()                                             \
         for (j = 7; j > 0; j--)                                         \
-          errors[chan_pos + j] = errors[chan_pos + j-1];                \
-        errors[chan_pos] = (d)/factor - orig;
+          errors[chan_pos*8 + j] = errors[chan_pos*8 + j-1];            \
+        errors[chan_pos*8] = (d)/factor - orig;
 
 
 MAKE_QUANTIZE_FUNC_I (int_none_none, NONE_FUNC, NONE_FUNC, ROUND);