pcm - u-law encode/decode

Dependents:   PhonePlatform

Files at this revision

API Documentation at this revision

Comitter:
okini3939
Date:
Wed Jan 05 14:14:01 2011 +0000
Parent:
1:546b99dee7bb
Child:
3:64e448653443
Commit message:

Changed in this revision

ulaw.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/ulaw.cpp	Fri Nov 12 14:43:08 2010 +0000
+++ b/ulaw.cpp	Wed Jan 05 14:14:01 2011 +0000
@@ -34,10 +34,10 @@
 int ulaw2pcm (char dat) {
     int num, ret, seg;
 
-    if (! dat & 0x80) {
+    if (dat & 0x80) {
+        num = - dat;
+    } else {
         num = dat;
-    } else {
-        num = - dat;
     }
     seg = (num >> 4) & 0x07;
     ret = (0x21 | ((num & 0x0f) << 1)) << seg;