[SCM] pd-ggee/master: Fixed access to tables on 64bit systems

umlaeute at users.alioth.debian.org umlaeute at users.alioth.debian.org
Mon Mar 13 11:17:15 UTC 2017


The following commit has been merged in the master branch:
commit 02aba9a24821e3694ae735808565273b0e74bc4e
Author: IOhannes m zmölnig <zmoelnig at iem.at>
Date:   Mon Mar 13 12:10:38 2017 +0100

    Fixed access to tables on 64bit systems
    
    Closes: #792720

diff --git a/debian/patches/fix-64bit-arrays.patch b/debian/patches/fix-64bit-arrays.patch
new file mode 100644
index 0000000..36c55c1
--- /dev/null
+++ b/debian/patches/fix-64bit-arrays.patch
@@ -0,0 +1,221 @@
+Description: fixing 64bit issues with table access
+ array_getfloatarray() is not 64bit-save, instead one must use
+ array_getfloatwords()
+Author: upstream
+Reviewed-by: IOhannes m zmölnig
+Last-Update: 2017-03-13
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- pd-ggee.orig/experimental/tabwrite4~.c
++++ pd-ggee/experimental/tabwrite4~.c
+@@ -12,9 +12,9 @@
+     t_object x_obj;
+     int x_phase;
+     int x_npoints;
+-    float *x_vec;
++    t_word *x_vec;
+     t_symbol *x_arrayname;
+-    float x_f;
++    t_float x_f;
+     t_sample x_1;
+     t_sample x_2;
+     t_sample x_3;
+@@ -22,8 +22,6 @@
+     float x_index;
+ } t_tabwrite4_tilde;
+ 
+-static void tabwrite4_tilde_tick(t_tabwrite4_tilde *x);
+-
+ static void *tabwrite4_tilde_new(t_symbol *s)
+ {
+     t_tabwrite4_tilde *x = (t_tabwrite4_tilde *)pd_new(tabwrite4_tilde_class);
+@@ -34,7 +32,7 @@
+     x->x_2 = 0.;
+     x->x_3 = 0.;
+     inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
+-    outlet_new(&x->x_obj, &s_signal);       
++    //outlet_new(&x->x_obj, &s_signal);
+     return (x);
+ }
+ 
+@@ -49,15 +47,15 @@
+ static t_int *tabwrite4_tilde_perform(t_int *w)
+ {
+     t_tabwrite4_tilde *x = (t_tabwrite4_tilde *)(w[1]);
+-    t_float *in1 = (t_float *)(w[2]);
+-    t_float *in2 = (t_float *)(w[3]);
+-    int n = (int)(w[4]);    
+-    t_float* end = in1 + n;
+-    t_float* end2 = in2 + n;
+-
+-    float *buf = x->x_vec, *fp, a,b,c,d;
+-    float findex = *in2;
+-    float frac;
++    t_sample *in1 = (t_sample *)(w[2]);
++    t_sample *in2 = (t_sample *)(w[3]);
++    int n = (int)(w[4]);
++    t_sample* end2 = in2 + n;
++
++    t_word *buf = x->x_vec;
++    t_sample a,b,c,d;
++    t_sample findex = *in2;
++    t_sample frac;
+     int iindex = (int)findex;
+     int wraparound = 0;
+     int maxindex = x->x_npoints-1;
+@@ -76,7 +74,7 @@
+ #if 0
+         while ((int)findex > iindex) {
+             iindex++;
+-            *(buf+iindex) = *(buf+iindex-1);
++            buf[iindex].w_float=buf[iindex-1].w_float;
+         }
+ #endif
+ 
+@@ -85,7 +83,7 @@
+ //        post("iindex %d, findex %f",iindex,findex);
+         if (in2 < end2 && findex > *in2) {
+             wraparound = 1;
+-            post("wraparound");
++            //post("wraparound");
+         }
+ 
+ 
+@@ -101,34 +99,33 @@
+             iindex += maxindex+1;
+         }
+         else if (iindex > maxindex) {
+-            iindex -= maxindex;          
++            iindex -= maxindex;
+         }
+ 
+-        fp = buf + iindex;
+         cminusb = c-b;
+ 
+-        *fp = b + frac * (
++        buf[iindex].w_float = b + frac * (
+                     cminusb - 0.1666667f * (1.-frac) * (
+                     (d - a - 3.0f * cminusb) * frac + (d + 2.0f*a - 3.0f*b)
+                     )
+                     );
+ 
+     }
+-    post("written to %d",iindex);
++    //post("written to %d",iindex);
+     x->x_1 = b;
+     x->x_2 = c;
+     x->x_3 = d;
+ 
+ #if 0
+-    buf[maxindex-2] = buf[maxindex-3]*0.5; 
+-    buf[maxindex-1] = buf[maxindex-2]*0.5; 
+-    buf[maxindex] = buf[maxindex-1]*0.5; 
+-    buf[2] = buf[3]*0.5; 
+-    buf[1] = buf[2]*0.5; 
+-    buf[0] = buf[1]*0.5; 
++    buf[maxindex-2].w_float = buf[maxindex-3].w_float*0.5;
++    buf[maxindex-1].w_float = buf[maxindex-2].w_float*0.5;
++    buf[maxindex].w_float = buf[maxindex-1].w_float*0.5;
++    buf[2].w_float = buf[3].w_float*0.5;
++    buf[1].w_float = buf[2].w_float*0.5;
++    buf[0].w_float = buf[1].w_float*0.5;
+ #endif
+ 
+-    if (wraparound)  tabwrite4_tilde_redraw(x);    
++    if (wraparound)  tabwrite4_tilde_redraw(x);
+ 
+     return (w+5);
+ }
+@@ -145,7 +142,7 @@
+             x->x_arrayname->s_name);
+         x->x_vec = 0;
+     }
+-    else if (!garray_getfloatarray(a, &x->x_npoints, &x->x_vec))
++    else if (!garray_getfloatwords(a, &x->x_npoints, &x->x_vec))
+     {
+         pd_error(x, "%s: bad template for tabwrite4~", x->x_arrayname->s_name);
+         x->x_vec = 0;
+--- pd-ggee.orig/experimental/fofsynth~.c
++++ pd-ggee/experimental/fofsynth~.c
+@@ -20,23 +20,22 @@
+ #define PD_PI 3.14159
+ 
+ 
+-#if PD_MINOR_VERSION < 38
+-static float* cos_table;
+-#endif
++static t_word* fofcos_table;
+ static float* halfcos_table;
+ static float* exp_table;
+ 
+ static void cos_maketable(void)
+ {
+      int i;
+-     float *fp, phase, phsinc = (2. * PD_PI) / COSTABSIZE;
++     t_word *fp;
++     float phase, phsinc = (2. * PD_PI) / COSTABSIZE;
+      
+-     if (cos_table) return;
+-     cos_table = (float *)getbytes(sizeof(float) * (COSTABSIZE+1));
++     if (fofcos_table) return;
++     fofcos_table = (t_word *)getbytes(sizeof(t_word) * (COSTABSIZE+1));
+      
+-     for (i = COSTABSIZE + 1, fp = cos_table, phase = 0; i--;
++     for (i = COSTABSIZE + 1, fp = fofcos_table, phase = 0; i--;
+ 	  fp++, phase += phsinc) 
+-	  *fp = cos(phase);
++	  fp->w_float = cos(phase);
+      
+ }
+ 
+@@ -92,7 +91,7 @@
+      /* template */
+ 
+      int x_npoints;
+-     t_float *x_vec;
++     t_word *x_vec;
+      
+      /* fof */
+      int debug;
+@@ -202,7 +201,7 @@
+ 	       float envelope;
+ 
+ 	       float tph = (formphase - (float)((int) formphase));
+-	       float val = *(x->x_vec + (int) (tph * x->x_npoints));
++	       float val = x->x_vec[(int) (tph * x->x_npoints)].w_float;
+ 
+ 	       /* Apply the envelope */
+ 
+@@ -255,12 +254,12 @@
+      return (w+5);
+ }
+ 
+-void fofsynth_usearray(t_symbol* s,int* points,t_float** vec)
++void fofsynth_usearray(t_symbol* s,int* points,t_word** vec)
+ {
+      t_garray *a;
+      if (!(a = (t_garray *)pd_findbyclass(s, garray_class))) 
+ 	  error("%s: no such array", s->s_name);
+-     else if (!garray_getfloatarray(a,points,vec))
++     else if (!garray_getfloatwords(a,points,vec))
+ 	  error("%s: bad template for fof~", s->s_name);
+      else
+ 	  garray_usedindsp(a); 
+@@ -273,7 +272,7 @@
+ 	  fofsynth_usearray(x->x_arrayname,&x->x_npoints, &x->x_vec);	
+      else {
+ 	  x->x_npoints=COSTABSIZE;
+-	  x->x_vec = cos_table;
++	  x->x_vec = fofcos_table;
+      }
+                
+      dsp_add(fofsynth_perform, 4, x,
+@@ -342,7 +341,7 @@
+ 
+ void fofsynth_tilde_setup(void)
+ {
+-     cos_table = NULL;
++     fofcos_table = NULL;
+      halfcos_table = NULL;
+      fofsynth_class = class_new(gensym("fof~"), (t_newmethod) fofsynth_new,(t_method) fofsynth_free,
+ 				sizeof(t_fofsynth), 0,A_DEFSYM, A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0);
diff --git a/debian/patches/series b/debian/patches/series
index 402dce4..e079ca3 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 fix_Wreturn.patch
 update-makefile-for-hurd-and-kfreebsd
 fix-pdsend.patch
+fix-64bit-arrays.patch

-- 
pd-ggee packaging



More information about the pkg-multimedia-commits mailing list