changeset 29929:49c6bb4f97aa

Fix mangling of 24-bit audio during channel reorder. Only 1/3 of the samples in the buffer passed to reorder_channel_nch() were being reordered. For 8-, 16-, and 32-bit audio, the buffers could be treated as int8_t, int16_t, and int32_t respectively. 24-bit audio was being processed as int8_t, requiring iteration over n_samples*3, not n_samples.
author tack
date Sat, 28 Nov 2009 18:23:26 +0000
parents 731ddb53dc92
children a57d9fbbd29c
files libaf/reorder_ch.c
diffstat 1 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libaf/reorder_ch.c	Sat Nov 28 18:01:54 2009 +0000
+++ b/libaf/reorder_ch.c	Sat Nov 28 18:23:26 2009 +0000
@@ -68,7 +68,7 @@
     {
         int8_t *dest_8 = dest;
         const int8_t *src_8 = src;
-        for (i = 0; i < samples; i += 15) {
+        for (i = 0; i < samples * 3; i += 15) {
             dest_8[i]    = src_8[i+s0*3];
             dest_8[i+1]  = src_8[i+s0*3+1];
             dest_8[i+2]  = src_8[i+s0*3+2];
@@ -144,7 +144,7 @@
     {
         int8_t *dest_8 = dest;
         const int8_t *src_8 = src;
-        for (i = 0; i < samples; i += 18) {
+        for (i = 0; i < samples * 3; i += 18) {
             dest_8[i]    = src_8[i+s0*3];
             dest_8[i+1]  = src_8[i+s0*3+1];
             dest_8[i+2]  = src_8[i+s0*3+2];
@@ -226,7 +226,7 @@
     {
         int8_t *dest_8 = dest;
         const int8_t *src_8 = src;
-        for (i = 0; i < samples; i += 24) {
+        for (i = 0; i < samples * 3; i += 24) {
             dest_8[i]    = src_8[i+s0*3];
             dest_8[i+1]  = src_8[i+s0*3+1];
             dest_8[i+2]  = src_8[i+s0*3+2];
@@ -455,7 +455,7 @@
     {
         int8_t *src_8 = src;
         int8_t tmp0, tmp1, tmp2;
-        for (i = 0; i < samples; i += chnum*3) {
+        for (i = 0; i < samples * 3; i += chnum * 3) {
             tmp0 = src_8[i+s0*3];
             tmp1 = src_8[i+s0*3+1];
             tmp2 = src_8[i+s0*3+2];
@@ -555,7 +555,7 @@
     {
         int8_t *src_8 = src;
         int8_t tmp0, tmp1, tmp2;
-        for (i = 0; i < samples; i += chnum*3) {
+        for (i = 0; i < samples * 3; i += chnum * 3) {
             tmp0 = src_8[i+s0*3];
             tmp1 = src_8[i+s0*3+1];
             tmp2 = src_8[i+s0*3+2];
@@ -653,7 +653,7 @@
     {
         int8_t *src_8 = src;
         int8_t tmp0, tmp1, tmp2;
-        for (i = 0; i < samples; i += chnum*3) {
+        for (i = 0; i < samples * 3; i += chnum * 3) {
             tmp0 = src_8[i+s0*3];
             tmp1 = src_8[i+s0*3+1];
             tmp2 = src_8[i+s0*3+2];
@@ -731,7 +731,7 @@
     {
         int8_t *src_8 = src;
         int8_t tmp0, tmp1, tmp2;
-        for (i = 0; i < samples; i += chnum*3) {
+        for (i = 0; i < samples * 3; i += chnum * 3) {
             tmp0 = src_8[i+s0*3];
             tmp1 = src_8[i+s0*3+1];
             tmp2 = src_8[i+s0*3+2];
@@ -806,7 +806,7 @@
     {
         int8_t *src_8 = src;
         int8_t tmp0, tmp1, tmp2;
-        for (i = 0; i < samples; i += chnum*3) {
+        for (i = 0; i < samples * 3; i += chnum * 3) {
             tmp0 = src_8[i+s0*3];
             tmp1 = src_8[i+s0*3+1];
             tmp2 = src_8[i+s0*3+2];
@@ -896,7 +896,7 @@
     {
         int8_t *src_8 = src;
         int8_t tmp0, tmp1, tmp2;
-        for (i = 0; i < samples; i += 18) {
+        for (i = 0; i < samples * 3; i += 18) {
             tmp0 = src_8[i+s0*3];
             tmp1 = src_8[i+s0*3+1];
             tmp2 = src_8[i+s0*3+2];
@@ -980,7 +980,7 @@
     {
         int8_t *src_8 = src;
         int8_t tmp0, tmp1, tmp2;
-        for (i = 0; i < samples; i += 18) {
+        for (i = 0; i < samples * 3; i += 18) {
             tmp0 = src_8[i+s0*3];
             tmp1 = src_8[i+s0*3+1];
             tmp2 = src_8[i+s0*3+2];
@@ -1075,7 +1075,7 @@
     {
         int8_t *src_8 = src;
         int8_t tmp0, tmp1, tmp2;
-        for (i = 0; i < samples; i += 3*chnum) {
+        for (i = 0; i < samples * 3; i += chnum * 3) {
             tmp0 = src_8[i+s0*3];
             tmp1 = src_8[i+s0*3+1];
             tmp2 = src_8[i+s0*3+2];