]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/pcm_tablegen.h
lavc: add JNI support
[ffmpeg] / libavcodec / pcm_tablegen.h
index 438c2b9ea47e1dcb2457240083659270a4d13570..7ce147f768b59d0a95d45298502b333215a0327b 100644 (file)
@@ -3,20 +3,20 @@
  *
  * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger@gmx.de>
  *
- * This file is part of Libav.
+ * This file is part of FFmpeg.
  *
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -84,21 +84,21 @@ static av_cold void build_xlaw_table(uint8_t *linear_to_xlaw,
 {
     int i, j, v, v1, v2;
 
-    j = 0;
-    for(i=0;i<128;i++) {
-        if (i != 127) {
-            v1 = xlaw2linear(i ^ mask);
-            v2 = xlaw2linear((i + 1) ^ mask);
-            v = (v1 + v2 + 4) >> 3;
-        } else {
-            v = 8192;
-        }
-        for(;j<v;j++) {
+    j = 1;
+    linear_to_xlaw[8192] = mask;
+    for(i=0;i<127;i++) {
+        v1 = xlaw2linear(i ^ mask);
+        v2 = xlaw2linear((i + 1) ^ mask);
+        v = (v1 + v2 + 4) >> 3;
+        for(;j<v;j+=1) {
+            linear_to_xlaw[8192 - j] = (i ^ (mask ^ 0x80));
             linear_to_xlaw[8192 + j] = (i ^ mask);
-            if (j > 0)
-                linear_to_xlaw[8192 - j] = (i ^ (mask ^ 0x80));
         }
     }
+    for(;j<8192;j++) {
+        linear_to_xlaw[8192 - j] = (127 ^ (mask ^ 0x80));
+        linear_to_xlaw[8192 + j] = (127 ^ mask);
+    }
     linear_to_xlaw[0] = linear_to_xlaw[1];
 }