]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
A couple of typos in spandsp
authorSteve Underwood <steveu@coppice.org>
Thu, 9 Aug 2012 13:58:22 +0000 (21:58 +0800)
committerSteve Underwood <steveu@coppice.org>
Thu, 9 Aug 2012 13:58:22 +0000 (21:58 +0800)
Improvements to image flattening in spandsp's image translate code

libs/spandsp/src/image_translate.c
libs/spandsp/src/spandsp/ima_adpcm.h
libs/spandsp/src/spandsp/private/ima_adpcm.h

index 54037990fc5e76c9c72a0b3bbe09f729c00991df..4ee2c211bf3c3bef65efb1f40e041661488fdb61 100644 (file)
@@ -163,10 +163,9 @@ static int image_gray16_to_colour16_row(uint16_t colour16[], uint16_t gray16[],
 
     for (i = pixels - 1;  i >= 0;  i--)
     {
-        /* TODO: need to balance the colours */
-        colour16[3*i] = gray16[i];
-        colour16[3*i + 1] = gray16[i];
-        colour16[3*i + 2] = gray16[i];
+        colour16[3*i] = saturateu16((gray16[i]*36532) >> 15);
+        colour16[3*i + 1] = saturateu16((gray16[i]*37216) >> 16);
+        colour16[3*i + 2] = saturateu16((gray16[i]*47900) >> 14);
     }
     return pixels;
 }
@@ -178,10 +177,9 @@ static int image_gray16_to_colour8_row(uint8_t colour8[], uint16_t gray16[], int
 
     for (i = pixels - 1;  i >= 0;  i--)
     {
-        /* TODO: need to balance the colours */
-        colour8[3*i] = gray16[i] >> 8;
-        colour8[3*i + 1] = gray16[i] >> 8;
-        colour8[3*i + 2] = gray16[i] >> 8;
+        colour8[3*i] = saturateu8((gray16[i]*36532) >> 23);
+        colour8[3*i + 1] = saturateu8((gray16[i]*37216) >> 24);
+        colour8[3*i + 2] = saturateu8((gray16[i]*47900) >> 22);
     }
     return pixels;
 }
@@ -530,7 +528,7 @@ SPAN_DECLARE(int) image_translate_row(image_translate_state_t *s, uint8_t buf[],
     else
     {
         i = s->output_width*s->output_bytes_per_pixel;
-        memcpy(buf, s->pixel_row[1], i);
+        memcpy(buf, s->pixel_row[0], i);
     }
     return i;
 }
index 292bdd5d837e7175745a5bc401dbe9a3a79d4c27..2942efa859e3ff4adb19200d74f6b292a938bfb6 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * SpanDSP - a series of DSP components for telephony
  *
- * ima_adpcm.c - Conversion routines between linear 16 bit PCM data and
+ * ima_adpcm.h - Conversion routines between linear 16 bit PCM data and
  *               IMA/DVI/Intel ADPCM format.
  *
  * Written by Steve Underwood <steveu@coppice.org>
index 21ead941afe312c61e3d63c7f993cef91f5e5330..2fc7d2c1146e281aaae8bbb38dc38650fd2cf1d7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * SpanDSP - a series of DSP components for telephony
  *
- * private/ima_adpcm.c - Conversion routines between linear 16 bit PCM data
+ * private/ima_adpcm.h - Conversion routines between linear 16 bit PCM data
  *                       and IMA/DVI/Intel ADPCM format.
  *
  * Written by Steve Underwood <steveu@coppice.org>