[FFmpeg-soc] [soc]: r1466 - amr/reformat.pl

superdump subversion at mplayerhq.hu
Wed Nov 28 23:57:39 CET 2007


Author: superdump
Date: Wed Nov 28 23:57:38 2007
New Revision: 1466

Log:
Useful script for reformatting data tables. Could be made more flexible and
easier to use.


Added:
   amr/reformat.pl   (contents, props changed)

Added: amr/reformat.pl
==============================================================================
--- (empty file)
+++ amr/reformat.pl	Wed Nov 28 23:57:38 2007
@@ -0,0 +1,29 @@
+$grp = 0;
+$mod = 8;
+
+while(<>) {
+    for(split(",")) {
+        /(-?\d*)\.(\d*)F/ or next;
+        push @ints, $1;
+        push @fracs, $2;
+    }
+}
+
+$ilen = (sort {$b <=> $a} map {length} @ints )[0];
+$flen = (sort {$b <=> $a} map {length} @fracs)[0];
+
+for($t = 0; $t <= $#fracs; $t++){
+    if($grp>0 && !($t%$grp)) {
+        printf "{";
+    }
+    printf "%${ilen}s.%-${flen}s", $ints[$t], $fracs[$t];
+    if($grp>0 && $t!=0 && !(($t+1)%$grp)) {
+        printf "}";
+    }
+    if(!(($t+1)%$mod)) {
+        printf ",\n";
+    }else {
+        printf ", ";
+    }
+}
+printf "\n";



More information about the FFmpeg-soc mailing list