[xiph-commits] r18878 - trunk/squishyball

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Tue Mar 12 13:07:14 PDT 2013


Author: xiphmont
Date: 2013-03-12 13:07:14 -0700 (Tue, 12 Mar 2013)
New Revision: 18878

Modified:
   trunk/squishyball/loader.c
   trunk/squishyball/main.c
   trunk/squishyball/squishyball.1
Log:
Add 32 bit float AIFC support to the loader


Modified: trunk/squishyball/loader.c
===================================================================
--- trunk/squishyball/loader.c	2013-03-12 20:06:19 UTC (rev 18877)
+++ trunk/squishyball/loader.c	2013-03-12 20:07:14 UTC (rev 18878)
@@ -439,6 +439,7 @@
   unsigned char *buffer;
   unsigned char buf2[12];
   int bend = 1;
+  int fp = 0;
 
   if(fseek(in,0,SEEK_SET)==-1){
     fprintf(stderr,"%s: Failed to seek\n",path);
@@ -504,6 +505,9 @@
       bend = 1;
     }else if(!memcmp(buffer+18, "sowt", 4)){
       bend = 0;
+    }else if(!memcmp(buffer+18, "fl32", 4)){
+      bend = 1;
+      fp = 1;
     }else{
       fprintf(stderr, "%s: Can't handle compressed AIFF-C (%c%c%c%c)\n", path,
               *(buffer+18), *(buffer+19), *(buffer+20), *(buffer+21));
@@ -528,12 +532,16 @@
   int offset = READ_U32_BE(buf2);
   int blocksize = READ_U32_BE(buf2+4);
 
-  if(!(pcm->bits==24 || pcm->bits == 16 || pcm->bits == 8)){
+  if(!((fp==0 && (pcm->bits==24 || pcm->bits == 16 || pcm->bits == 8)) ||
+       (fp==1 && pcm->bits==32))){
     fprintf(stderr,
             "%s: Unsupported type of AIFF/AIFC file\n"
-            " Must be 8-, 16- or 24-bit integer PCM.\n",path);
+            " Must be 8-, 16- or 24-bit integer or 32-bit floating point PCM.\n",
+            path);
     goto err;
   }
+  if(fp==1)
+    pcm->bits = -pcm->bits;
 
   fseek(in, offset, SEEK_CUR); /* Swallow some data */
 
@@ -595,6 +603,14 @@
           swap(d+j*3,d+j*3+2);
       }
       break;
+    case -32:
+      if(bend){
+        for(j=0;j<pcm->size/4;j++) {
+          swap(d+j*4,d+j*4+3);
+          swap(d+j*4+1,d+j*4+2);
+        }
+      }
+      break;
     }
   }
 

Modified: trunk/squishyball/main.c
===================================================================
--- trunk/squishyball/main.c	2013-03-12 20:06:19 UTC (rev 18877)
+++ trunk/squishyball/main.c	2013-03-12 20:07:14 UTC (rev 18878)
@@ -151,7 +151,8 @@
           "SUPPORTED FILE TYPES:\n"
           "  WAV and WAVEX    : 8-, 16-, 24-bit linear integer PCM (format 1)\n"
           "                     32 bit float (format 3)\n"
-          "  AIFF and AIFC    : 8-, 16-, 24-bit linear integer PCM\n"
+          "  AIFF and AIFC    : 8-, 16-, 24-bit linear integer PCM or\n"
+          "                     32-bit floating point PCM\n"
           "  FLAC and OggFLAC : 16- and 24-bit\n"
           "  SW               : mono signed 16-bit little endian raw\n"
           "  OggVorbis        : all Vorbis I files\n"

Modified: trunk/squishyball/squishyball.1
===================================================================
--- trunk/squishyball/squishyball.1	2013-03-12 20:06:19 UTC (rev 18877)
+++ trunk/squishyball/squishyball.1	2013-03-12 20:07:14 UTC (rev 18878)
@@ -157,11 +157,11 @@
 .IP \fBWAV/WAVEX
 8-, 16-, 24-bit linear integer PCM (format 1), 32-bit float (format 3)
 .IP \fBAIFF/AIFF-C
-8-, 16-, 24-bit linear integer PCM
+8-, 16-, 24-bit linear integer PCM, 32-bit floating point
 .IP \fBFLAC/OggFLAC
 16- and 24-bit
 .IP \fBSW
-Mono signed 16-bit little endian raw with a .sw extension
+Mono signed 16-bit little endian 48000Hz raw with a .sw extension
 .IP \fBOggVorbis
 all Vorbis I files
 .IP \fBOggOpus



More information about the commits mailing list