Changeset d6008a8bb8e5e76d77dd15a654fc2fabef8910e9

Show
Ignore:
Timestamp:
09/11/07 12:14:01 (1 year ago)
Author:
Rafaël Carré <funman@videolan.org>
git-committer:
Rafaël Carré <funman@videolan.org> 1189505641 +0000
git-parent:

[c6eafbbbf3edd51c00f96598cf4513856a1a757e]

git-author:
Rafaël Carré <funman@videolan.org> 1189505641 +0000
Message:

Reverts [21943] for galaktos as it is external to vlc.
Just in case it is merged one day with upstream source.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/visualization/galaktos/PCM.c

    r6ee1e19 rd6008a8  
    4949void initPCM(int samples) 
    5050{ 
    51   int i; 
     51  int i;  
    5252 
    5353  //Allocate memory for PCM data buffer 
     
    5555  PCMd[0] = (double *)malloc(samples * sizeof(double)); 
    5656  PCMd[1] = (double *)malloc(samples * sizeof(double)); 
    57   
     57   
    5858  maxsamples=samples; 
    5959  new=0; 
     
    8484  int samples=512; 
    8585 
    86      for(i=0;i<samples;i++) 
    87        { 
    88          j=i+start; 
    89          PCMd[0][j%maxsamples]=(PCMdata[0][i]/16384.0); 
    90          PCMd[1][j%maxsamples]=(PCMdata[1][i]/16384.0); 
    91        } 
     86     for(i=0;i<samples;i++) 
     87       { 
     88         j=i+start; 
     89         PCMd[0][j%maxsamples]=(PCMdata[0][i]/16384.0); 
     90         PCMd[1][j%maxsamples]=(PCMdata[1][i]/16384.0);   
     91       } 
     92        
    9293  
    93   
    94      // printf("Added %d samples %d %d %f\n",samples,start,(start+samples)%maxsamples,PCM[0][start+10]); 
     94     // printf("Added %d samples %d %d %f\n",samples,start,(start+samples)%maxsamples,PCM[0][start+10]);  
    9595 
    9696 start+=samples; 
     
    114114{ 
    115115   int i,index; 
    116   
     116    
    117117   index=start-1; 
    118118 
     
    120120 
    121121   PCMdata[0]=PCMd[channel][index]; 
    122   
     122    
    123123   for(i=1;i<samples;i++) 
    124124     { 
    125125       index=start-1-i; 
    126126       if (index<0) index=maxsamples+index; 
    127   
     127        
    128128       PCMdata[i]=(1-smoothing)*PCMd[channel][index]+smoothing*PCMdata[i-1]; 
    129129     } 
    130   
     130    
    131131   //return derivative of PCM data 
    132132   if(derive) 
    133133     { 
    134134       for(i=0;i<samples-1;i++) 
    135      {     
    136        PCMdata[i]=PCMdata[i]-PCMdata[i+1]; 
    137    
     135    {      
     136      PCMdata[i]=PCMdata[i]-PCMdata[i+1]; 
     137   
    138138       PCMdata[samples-1]=0; 
    139139     } 
     
    143143 
    144144 
    145   
     145      
    146146} 
    147147 
     
    155155{ 
    156156   int i,index; 
    157   
     157    
    158158   index=start-1; 
    159159 
     
    161161 
    162162   PCMdata[0]=PCMd[channel][index]; 
    163   
     163    
    164164   for(i=1;i<new;i++) 
    165165     { 
    166166       index=start-1-i; 
    167167       if (index<0) index=maxsamples+index; 
    168   
     168        
    169169       PCMdata[i]=(1-smoothing)*PCMd[channel][index]+smoothing*PCMdata[i-1]; 
    170170     } 
    171   
     171    
    172172   //return derivative of PCM data 
    173173   if(derive) 
    174174     { 
    175175       for(i=0;i<new-1;i++) 
    176      {     
    177        PCMdata[i]=PCMdata[i]-PCMdata[i+1]; 
    178    
     176    {      
     177      PCMdata[i]=PCMdata[i]-PCMdata[i+1]; 
     178   
    179179       PCMdata[new-1]=0; 
    180180     } 
  • modules/visualization/galaktos/beat_detect.c

    r6ee1e19 rd6008a8  
    4242{ 
    4343 
    44   int x,y; 
     44  int x,y;  
    4545 
    4646  vol_instant=0; 
     
    6666      beat_variance[x]=0; 
    6767      for (y=0;y<80;y++) 
    68    
    69       beat_buffer[x][y]=0; 
    70    
     68   
     69     beat_buffer[x][y]=0; 
     70   
    7171    } 
    7272 
    73 } 
     73}  
    7474 
    7575void getBeatVals(double *vdataL,double *vdataR, double *vol) 
     
    8181 
    8282      for ( x=0;x<16;x++) 
    83    
    84      
    85       beat_instant[x]=0; 
    86       for ( y=linear*2;y<(linear+8+x)*2;y++) 
    87         { 
    88           beat_instant[x]+=((vdataL[y]*vdataL[y])+(vdataR[y]*vdataR[y]))*(1.0/(8+x)); 
    89           vol_instant+=((vdataL[y]*vdataL[y])+(vdataR[y]*vdataR[y]))*(1.0/512.0); 
     83   
     84      
     85     beat_instant[x]=0; 
     86     for ( y=linear*2;y<(linear+8+x)*2;y++) 
     87       { 
     88          beat_instant[x]+=((vdataL[y]*vdataL[y])+(vdataR[y]*vdataR[y]))*(1.0/(8+x));  
     89         vol_instant+=((vdataL[y]*vdataL[y])+(vdataR[y]*vdataR[y]))*(1.0/512.0); 
    9090 
    91         } 
    92      
    93       linear=y/2; 
    94       beat_history[x]-=(beat_buffer[x][beat_buffer_pos])*.0125; 
    95       beat_buffer[x][beat_buffer_pos]=beat_instant[x]; 
    96       beat_history[x]+=(beat_instant[x])*.0125; 
    97      
    98       beat_val[x]=(beat_instant[x])/(beat_history[x]); 
    99      
    100       beat_att[x]+=(beat_instant[x])/(beat_history[x]); 
     91       } 
     92      
     93     linear=y/2; 
     94     beat_history[x]-=(beat_buffer[x][beat_buffer_pos])*.0125; 
     95     beat_buffer[x][beat_buffer_pos]=beat_instant[x]; 
     96     beat_history[x]+=(beat_instant[x])*.0125; 
     97      
     98     beat_val[x]=(beat_instant[x])/(beat_history[x]); 
     99      
     100     beat_att[x]+=(beat_instant[x])/(beat_history[x]); 
    101101 
    102102 
    103       
    104    
    105   
     103      
     104   
     105       
    106106      vol_history-=(vol_buffer[beat_buffer_pos])*.0125; 
    107107      vol_buffer[beat_buffer_pos]=vol_instant; 
     
    111111      mid=0; 
    112112      for(x=1;x<10;x++) 
    113    
    114     mid+=(beat_instant[x]); 
    115       temp2+=(beat_history[x]); 
    116      
    117    
    118      
    119     mid=mid/(1.5*temp2); 
    120     temp2=0; 
    121     treb=0; 
    122        for(x=10;x<16;x++) 
    123         { 
    124           treb+=(beat_instant[x]); 
    125           temp2+=(beat_history[x]); 
    126         } 
    127       treb=treb/(1.5*temp2); 
    128       *vol=vol_instant/(1.5*vol_history); 
    129   
    130       bass=(beat_instant[0])/(1.5*beat_history[0]); 
     113   
     114    mid+=(beat_instant[x]); 
     115     temp2+=(beat_history[x]); 
     116     
     117   
     118     
     119    mid=mid/(1.5*temp2); 
     120    temp2=0; 
     121    treb=0; 
     122     for(x=10;x<16;x++) 
     123        {  
     124         treb+=(beat_instant[x]); 
     125         temp2+=(beat_history[x]); 
     126       } 
     127     treb=treb/(1.5*temp2); 
     128     *vol=vol_instant/(1.5*vol_history); 
     129   
     130     bass=(beat_instant[0])/(1.5*beat_history[0]); 
    131131 
    132       treb_att=.6 * treb_att + .4 * treb; 
    133       mid_att=.6 * mid_att + .4 * mid; 
    134       bass_att=.6 * bass_att + .4 * bass; 
    135       //printf("%f %f %f %f\n",bass,mid,treb,*vol); 
    136        // *vol=(beat_instant[3])/(beat_history[3]); 
    137       beat_buffer_pos++; 
    138       if( beat_buffer_pos>79)beat_buffer_pos=0; 
    139      
     132     treb_att=.6 * treb_att + .4 * treb; 
     133     mid_att=.6 * mid_att + .4 * mid; 
     134     bass_att=.6 * bass_att + .4 * bass; 
     135     //printf("%f %f %f %f\n",bass,mid,treb,*vol); 
     136      // *vol=(beat_instant[3])/(beat_history[3]); 
     137     beat_buffer_pos++; 
     138     if( beat_buffer_pos>79)beat_buffer_pos=0; 
     139     
    140140} 
    141141void freeBeatDetect() 
  • modules/visualization/galaktos/builtin_funcs.c

    r6ee1e19 rd6008a8  
    2626#include <math.h> 
    2727/* Values to optimize the sigmoid function */ 
    28 #define R  32767 
    29 #define RR 65534 
     28#define R  32767    
     29#define RR 65534    
    3030  
    3131inline double int_wrapper(double * arg_list) { 
     
    3737 
    3838inline double sqr_wrapper(double * arg_list) { 
    39      
    40     return pow(2, arg_list[0]); 
    41 }     
    42      
    43      
    44 inline double sign_wrapper(double * arg_list) {     
    45      
    46     return -arg_list[0];     
    47 }     
     39     
     40   return pow(2, arg_list[0]); 
     41}   
     42     
     43     
     44inline double sign_wrapper(double * arg_list) {     
     45     
     46    return -arg_list[0];     
     47}   
    4848 
    4949inline double min_wrapper(double * arg_list) { 
    50      
    51     if (arg_list[0] > arg_list[1]) 
    52         return arg_list[1]; 
    53      
    54     return arg_list[0]; 
    55 }         
     50     
     51   if (arg_list[0] > arg_list[1]) 
     52       return arg_list[1]; 
     53     
     54   return arg_list[0]; 
     55}       
    5656 
    5757inline double max_wrapper(double * arg_list) { 
    5858 
    59     if (arg_list[0] > arg_list[1]) 
    60       return arg_list[0]; 
    61  
    62     return arg_list[1]; 
     59   if (arg_list[0] > arg_list[1]) 
     60     return arg_list[0]; 
     61 
     62   return arg_list[1]; 
    6363} 
    6464 
     
    6767  return (RR / (1 + exp( -(((double)(arg_list[0])) * arg_list[1]) / R) - R)); 
    6868} 
    69      
    70      
     69     
     70     
    7171inline double bor_wrapper(double * arg_list) { 
    7272 
    73     return (double)((int)arg_list[0] || (int)arg_list[1]); 
    74 }     
    75      
     73   return (double)((int)arg_list[0] || (int)arg_list[1]); 
     74}   
     75     
    7676inline double band_wrapper(double * arg_list) { 
    77     return (double)((int)arg_list[0] && (int)arg_list[1]); 
    78 }     
     77   return (double)((int)arg_list[0] && (int)arg_list[1]); 
     78}   
    7979 
    8080inline double bnot_wrapper(double * arg_list) { 
    81     return (double)(!(int)arg_list[0]); 
    82 }         
     81   return (double)(!(int)arg_list[0]); 
     82}       
    8383 
    8484inline double if_wrapper(double * arg_list) { 
    8585 
    86         if ((int)arg_list[0] == 0) 
    87             return arg_list[2]; 
    88         return arg_list[1]; 
    89 }         
     86       if ((int)arg_list[0] == 0) 
     87           return arg_list[2]; 
     88       return arg_list[1]; 
     89}       
    9090 
    9191 
     
    9797  //printf("VAL: %f\n", l); 
    9898  return l; 
    99 }     
     99}   
    100100 
    101101inline double equal_wrapper(double * arg_list) { 
    102102 
    103     return (arg_list[0] == arg_list[1]); 
    104 }     
     103   return (arg_list[0] == arg_list[1]); 
     104}   
    105105 
    106106 
    107107inline double above_wrapper(double * arg_list) { 
    108108 
    109     return (arg_list[0] > arg_list[1]); 
    110 }     
     109   return (arg_list[0] > arg_list[1]); 
     110}   
    111111 
    112112 
    113113inline double below_wrapper(double * arg_list) { 
    114114 
    115     return (arg_list[0] < arg_list[1]); 
     115   return (arg_list[0] < arg_list[1]); 
    116116} 
    117117 
    118118inline double sin_wrapper(double * arg_list) { 
    119     return (sin (arg_list[0]));     
     119    return (sin (arg_list[0]));  
    120120} 
    121121 
    122122 
    123123inline double cos_wrapper(double * arg_list) { 
    124     return (cos (arg_list[0])); 
     124   return (cos (arg_list[0])); 
    125125} 
    126126 
    127127inline double tan_wrapper(double * arg_list) { 
    128     return (tan(arg_list[0])); 
     128   return (tan(arg_list[0])); 
    129129} 
    130130 
    131131inline double asin_wrapper(double * arg_list) { 
    132     return (asin (arg_list[0])); 
     132   return (asin (arg_list[0])); 
    133133} 
    134134 
    135135inline double acos_wrapper(double * arg_list) { 
    136     return (acos (arg_list[0])); 
     136   return (acos (arg_list[0])); 
    137137} 
    138138 
    139139inline double atan_wrapper(double * arg_list) { 
    140     return (atan (arg_list[0])); 
     140   return (atan (arg_list[0])); 
    141141} 
    142142 
     
    194194 
    195195  int result = 1; 
    196   
     196   
    197197  int n = (int)arg_list[0]; 
    198   
     198   
    199199  while (n > 1) { 
    200200    result = result * n; 
  • modules/visualization/galaktos/builtin_funcs.h

    r6ee1e19 rd6008a8  
    1 /* Wrappers for all the builtin functions 
     1/* Wrappers for all the builtin functions  
    22   The arg_list pointer is a list of doubles. Its 
    33   size is equal to the number of arguments the parameter 
  • modules/visualization/galaktos/common.h

    r6ee1e19 rd6008a8  
    1414#ifndef FALSE 
    1515#define FALSE 0 
    16 #endif 
     16#endif  
    1717 
    1818#define PROJECTM_FILE_EXTENSION ".prjm" 
  • modules/visualization/galaktos/custom_shape.c

    r6ee1e19 rd6008a8  
    7878  /* Initialize tree data structures */ 
    7979 
    80   if ((custom_shape->param_tree = 
     80  if ((custom_shape->param_tree =  
    8181       create_splaytree(compare_string, copy_string, free_string)) == NULL) { 
    8282    free_custom_shape(custom_shape); 
     
    8484  } 
    8585 
    86   if ((custom_shape->per_frame_eqn_tree = 
     86  if ((custom_shape->per_frame_eqn_tree =  
    8787       create_splaytree(compare_int, copy_int, free_int)) == NULL) { 
    8888    free_custom_shape(custom_shape); 
     
    9090  } 
    9191 
    92   if ((custom_shape->init_cond_tree = 
     92  if ((custom_shape->init_cond_tree =  
    9393       create_splaytree(compare_string, copy_string, free_string)) == NULL) { 
    9494    free_custom_shape(custom_shape); 
    9595    return NULL; 
    9696  } 
    97   
    98   if ((custom_shape->per_frame_init_eqn_tree = 
     97   
     98  if ((custom_shape->per_frame_init_eqn_tree =  
    9999       create_splaytree(compare_string, copy_string, free_string)) == NULL) { 
    100100    free_custom_shape(custom_shape); 
     
    126126  if ((param = new_param_double("b", P_FLAG_NONE, &custom_shape->b, NULL, 1.0, 0.0, .5)) == NULL){ 
    127127    free_custom_shape(custom_shape); 
    128     return NULL;                 
     128    return NULL;                       
    129129  } 
    130130 
     
    166166  if ((param = new_param_double("border_b", P_FLAG_NONE, &custom_shape->border_b, NULL, 1.0, 0.0, .5)) == NULL){ 
    167167    free_custom_shape(custom_shape); 
    168     return NULL;                 
     168    return NULL;                       
    169169  } 
    170170 
     
    206206  if ((param = new_param_double("b2", P_FLAG_NONE, &custom_shape->b2, NULL, 1.0, 0.0, .5)) == NULL){ 
    207207    free_custom_shape(custom_shape); 
    208     return NULL;                 
     208    return NULL;                       
    209209  } 
    210210 
     
    218218    return NULL; 
    219219  } 
    220   
     220   
    221221  if (insert_param(param, custom_shape->param_tree) < 0) { 
    222222    free_custom_shape(custom_shape); 
     
    323323    return NULL; 
    324324  } 
    325   
     325    
    326326   if ((param = new_param_double("tex_ang", P_FLAG_NONE, &custom_shape->tex_ang, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0)) == NULL) { 
    327327    free_custom_shape(custom_shape); 
     
    410410  
    411411  /* End of parameter loading. Note that the read only parameters associated 
    412      with custom shapes (ie, sample) are global variables, and not specific to 
     412     with custom shapes (ie, sample) are global variables, and not specific to  
    413413     the custom shape datastructure. */ 
    414414 
     
    476476  destroy_param_db_tree_shape(custom_shape->param_tree); 
    477477  destroy_per_frame_init_eqn_tree_shape(custom_shape->per_frame_init_eqn_tree); 
    478   
     478   
    479479  free(custom_shape); 
    480480 
     
    490490  if (preset == NULL) 
    491491    return NULL; 
    492   
     492   
    493493  if ((custom_shape = splay_find(&id, preset->custom_shape_tree)) == NULL) { 
    494   
     494     
    495495    if (CUSTOM_SHAPE_DEBUG) { printf("find_custom_shape: creating custom shape (id = %d)...", id);fflush(stdout);} 
    496   
     496     
    497497    if (create_flag == FALSE) { 
    498498      if (CUSTOM_SHAPE_DEBUG) printf("you specified not to (create flag = false), returning null\n"); 
    499499      return NULL; 
    500500    } 
    501   
     501     
    502502    if ((custom_shape = new_custom_shape(id)) == NULL) { 
    503503      if (CUSTOM_SHAPE_DEBUG) printf("failed...out of memory?\n"); 
    504504      return NULL; 
    505505    } 
    506   
     506     
    507507    if (CUSTOM_SHAPE_DEBUG) { printf("success.Inserting..."); fflush(stdout);} 
    508   
     508     
    509509    if (splay_insert(custom_shape, &custom_shape->id, preset->custom_shape_tree) < 0) { 
    510510      if (CUSTOM_SHAPE_DEBUG) printf("failed, probably a duplicated!!\n"); 
     
    512512      return NULL; 
    513513    } 
    514   
     514     
    515515    if (CUSTOM_SHAPE_DEBUG) printf("done.\n"); 
    516516  } 
    517   
     517   
    518518  return custom_shape; 
    519519} 
     
    556556     with the following code */ 
    557557  if ((init_cond = splay_find(param->name, interface_shape->init_cond_tree)) == NULL) { 
    558   
     558     
    559559    /* Make sure initial condition does not exist in the set of per frame initial equations */ 
    560560    if ((init_cond = splay_find(param->name, interface_shape->per_frame_init_eqn_tree)) != NULL) 
    561561      return; 
    562   
     562     
    563563    if (param->type == P_TYPE_BOOL) 
    564564      init_val.bool_val = 0; 
    565   
     565     
    566566    else if (param->type == P_TYPE_INT) 
    567567      init_val.int_val = *(int*)param->engine_val; 
     
    574574    if ((init_cond = new_init_cond(param, init_val)) == NULL) 
    575575      return; 
    576   
     576     
    577577    /* Insert the initial condition into this presets tree */ 
    578578    if (splay_insert(init_cond, init_cond->param->name, interface_shape->init_cond_tree) < 0) { 
     
    580580      return; 
    581581    } 
    582   
     582     
    583583  } 
    584584  
  • modules/visualization/galaktos/custom_shape_types.h

    r6ee1e19 rd6008a8  
    2424  double tex_zoom; 
    2525  double tex_ang; 
    26   
     26   
    2727  double x; /* x position for per point equations */ 
    2828  double y; /* y position for per point equations */ 
     
    6868  char per_frame_init_eqn_string_buffer[STRING_BUFFER_SIZE]; 
    6969  /* Per point equation array */ 
    70   
    71   
     70   
     71   
    7272} custom_shape_t; 
    7373 
  • modules/visualization/galaktos/custom_wave.c

    r6ee1e19 rd6008a8  
    7373  custom_wave_t * custom_wave; 
    7474  param_t * param; 
    75   
     75   
    7676  if ((custom_wave = (custom_wave_t*)malloc(sizeof(custom_wave_t))) == NULL) 
    7777    return NULL; 
     
    104104 
    105105  /* Initialize tree data structures */ 
    106   
    107   if ((custom_wave->param_tree = 
     106   
     107  if ((custom_wave->param_tree =  
    108108       create_splaytree(compare_string, copy_string, free_string)) == NULL) { 
    109109    free_custom_wave(custom_wave); 
     
    111111  } 
    112112 
    113   if ((custom_wave->per_point_eqn_tree = 
     113  if ((custom_wave->per_point_eqn_tree =  
    114114       create_splaytree(compare_int, copy_int, free_int)) == NULL) { 
    115115    free_custom_wave(custom_wave); 
     
    117117  } 
    118118 
    119   if ((custom_wave->per_frame_eqn_tree = 
     119  if ((custom_wave->per_frame_eqn_tree =  
    120120       create_splaytree(compare_int, copy_int, free_int)) == NULL) { 
    121121    free_custom_wave(custom_wave); 
     
    123123  } 
    124124 
    125   if ((custom_wave->init_cond_tree = 
     125  if ((custom_wave->init_cond_tree =  
    126126       create_splaytree(compare_string, copy_string, free_string)) == NULL) { 
    127127    free_custom_wave(custom_wave); 
    128128    return NULL; 
    129129  } 
    130   
    131   if ((custom_wave->per_frame_init_eqn_tree = 
     130   
     131  if ((custom_wave->per_frame_init_eqn_tree =  
    132132       create_splaytree(compare_string, copy_string, free_string)) == NULL) { 
    133133    free_custom_wave(custom_wave); 
     
    135135  } 
    136136 
    137   
     137   
    138138  /* Start: Load custom wave parameters */ 
    139139 
     
    160160  if ((param = new_param_double("b", P_FLAG_DONT_FREE_MATRIX | P_FLAG_PER_POINT, &custom_wave->b,  custom_wave->b_mesh, 1.0, 0.0, .5)) == NULL){ 
    161161    free_custom_wave(custom_wave); 
    162     return NULL;                 
     162    return NULL;                       
    163163  } 
    164164 
     
    172172    return NULL; 
    173173  } 
    174   
     174   
    175175  if (insert_param(param, custom_wave->param_tree) < 0) { 
    176176    free_custom_wave(custom_wave); 
     
    269269 
    270270  if ((param = new_param_double("sample", P_FLAG_READONLY | P_FLAG_DONT_FREE_MATRIX | P_FLAG_ALWAYS_MATRIX | P_FLAG_PER_POINT, 
    271                 &custom_wave->sample, custom_wave->sample_mesh, 1.0, 0.0, 0.0)) == NULL) { 
     271               &custom_wave->sample, custom_wave->sample_mesh, 1.0, 0.0, 0.0)) == NULL) { 
    272272    free_custom_wave(custom_wave); 
    273273    return NULL; 
     
    395395    return NULL; 
    396396  } 
    397   
     397   
    398398  /* End of parameter loading. Note that the read only parameters associated 
    399      with custom waves (ie, sample) are global variables, and not specific to 
     399     with custom waves (ie, sample) are global variables, and not specific to  
    400400     the custom wave datastructure. */ 
    401401 
     
    499499  /* Argument checks */ 
    500500  if (custom_wave == NULL) 
    501       return FAILURE; 
     501     return FAILURE; 
    502502  if (gen_expr == NULL) 
    503       return FAILURE; 
     503     return FAILURE; 
    504504  if (name == NULL) 
    505       return FAILURE; 
    506   
     505     return FAILURE; 
     506   
    507507 if (CUSTOM_WAVE_DEBUG) printf("add_per_point_eqn: per pixel equation (name = \"%s\")\n", name); 
    508508 
     
    513513   return FAILURE; 
    514514  
    515  }      
     515 }      
    516516 
    517517 /* Find most largest index in the splaytree */ 
     
    523523 /* Create the per pixel equation given the index, parameter, and general expression */ 
    524524 if ((per_point_eqn = new_per_point_eqn(index, param, gen_expr)) == NULL) 
    525     return FAILURE; 
    526  if (CUSTOM_WAVE_DEBUG) 
     525    return FAILURE; 
     526 if (CUSTOM_WAVE_DEBUG)  
    527527   printf("add_per_point_eqn: created new equation (index = %d) (name = \"%s\")\n", per_point_eqn->index, per_point_eqn->param->name); 
    528528 /* Insert the per pixel equation into the preset per pixel database */ 
    529529 if (splay_insert(per_point_eqn, &per_point_eqn->index, custom_wave->per_point_eqn_tree) < 0) { 
    530     free_per_point_eqn(per_point_eqn); 
    531     return FAILURE;     
     530   free_per_point_eqn(per_point_eqn); 
     531   return FAILURE;  
    532532 } 
    533      
    534  /* Done */ 
     533     
     534 /* Done */  
    535535 return SUCCESS; 
    536536} 
     
    538538per_point_eqn_t * new_per_point_eqn(int index, param_t * param, gen_expr_t * gen_expr) { 
    539539 
    540     per_point_eqn_t * per_point_eqn; 
    541      
    542     if (param == NULL) 
    543         return NULL; 
    544     if (gen_expr == NULL) 
    545         return NULL; 
    546  
    547     if ((per_point_eqn = (per_point_eqn_t*)malloc(sizeof(per_point_eqn_t))) == NULL) 
    548         return NULL; 
    549  
    550   
    551     per_point_eqn->index = index; 
    552     per_point_eqn->gen_expr = gen_expr; 
    553     per_point_eqn->param = param; 
    554     return per_point_eqn;     
     540   per_point_eqn_t * per_point_eqn; 
     541     
     542   if (param == NULL) 
     543       return NULL; 
     544   if (gen_expr == NULL) 
     545       return NULL; 
     546 
     547   if ((per_point_eqn = (per_point_eqn_t*)malloc(sizeof(per_point_eqn_t))) == NULL) 
     548       return NULL; 
     549 
     550       
     551   per_point_eqn->index = index; 
     552   per_point_eqn->gen_expr = gen_expr; 
     553   per_point_eqn->param = param; 
     554    return per_point_eqn;    
    555555} 
    556556 
     
    558558void free_per_point_eqn(per_point_eqn_t * per_point_eqn) { 
    559559 
    560     if (per_point_eqn == NULL) 
    561         return; 
    562      
    563     free_gen_expr(per_point_eqn->gen_expr); 
    564      
    565     free(per_point_eqn); 
    566      
    567     return; 
     560   if (per_point_eqn == NULL) 
     561       return; 
     562     
     563   free_gen_expr(per_point_eqn->gen_expr); 
     564     
     565   free(per_point_eqn); 
     566     
     567   return; 
    568568} 
    569569 
     
    574574  if (preset == NULL) 
    575575    return NULL; 
    576   
     576   
    577577  if ((custom_wave = splay_find(&id, preset->custom_wave_tree)) == NULL) { 
    578578 
     
    629629 
    630630 
    631 inline void evalPerPointEqns() { 
     631inline void evalPerPointEqns() {  
    632632 
    633633  int x; 
     
    656656/* Evaluates a per point equation for the current custom wave given by interface_wave ptr */ 
    657657inline void evalPerPointEqn(per_point_eqn_t * per_point_eqn) { 
    658   
    659   
     658   
     659   
    660660  int samples, size; 
    661661  double * param_matrix; 
     
    670670    memset(param_matrix, 0, size); 
    671671  } 
    672   else 
     672  else  
    673673    param_matrix = (double*)per_point_eqn->param->matrix; 
    674   
    675   for (mesh_i = 0; mesh_i < samples; mesh_i++) { 
     674   
     675  for (mesh_i = 0; mesh_i < samples; mesh_i++) {     
    676676      param_matrix[mesh_i] = eval_gen_expr(eqn_ptr); 
    677677  } 
    678   
     678   
    679679  /* Now that this parameter has been referenced with a per 
    680680     point equation, we let the evaluator know by setting 
    681681     this flag */ 
    682   per_point_eqn->param->matrix_flag = 1; 
     682  per_point_eqn->param->matrix_flag = 1;  
    683683 
    684684} 
     
    711711     with the following code */ 
    712712  if ((init_cond = splay_find(param->name, interface_wave->init_cond_tree)) == NULL) { 
    713   
     713     
    714714    /* Make sure initial condition does not exist in the set of per frame initial equations */ 
    715715    if ((init_cond = splay_find(param->name, interface_wave->per_frame_init_eqn_tree)) != NULL) 
    716716      return; 
    717   
     717     
    718718    if (param->type == P_TYPE_BOOL) 
    719719      init_val.bool_val = 0; 
    720   
     720     
    721721    else if (param->type == P_TYPE_INT) 
    722722      init_val.int_val = *(int*)param->engine_val; 
     
    729729    if ((init_cond = new_init_cond(param, init_val)) == NULL) 
    730730      return; 
    731   
     731     
    732732    /* Insert the initial condition into this presets tree */ 
    733733    if (splay_insert(init_cond, init_cond->param->name, interface_wave->init_cond_tree) < 0) { 
     
    735735      return; 
    736736    } 
    737   
    738   } 
    739   
    740 } 
     737     
     738  } 
     739  
     740} 
  • modules/visualization/galaktos/custom_wave_types.h

    r6ee1e19 rd6008a8  
    1616  int index; 
    1717  param_t * param; 
    18   gen_expr_t * gen_expr;     
     18  gen_expr_t * gen_expr;    
    1919} per_point_eqn_t; 
    2020 
     
    8686  /* Per point equation array */ 
    8787  gen_expr_t * per_point_eqn_array[NUM_POINT_OPS]; 
    88   
     88   
    8989} custom_wave_t; 
    9090 
  • modules/visualization/galaktos/engine_vars.c

    r6ee1e19 rd6008a8  
    7373 double mv_dy = 0.02; 
    7474 double mv_dx = 0.02; 
    75   
     75   
    7676 int meshx = 0; 
    7777 int meshy = 0; 
  • modules/visualization/galaktos/engine_vars.h

    r6ee1e19 rd6008a8  
    9797extern int bInvert; 
    9898extern int bMotionVectorsOn; 
    99 extern int fps; 
     99extern int fps;  
    100100 
    101101extern double fWaveAlpha ; 
  • modules/visualization/galaktos/eval.c

    r6ee1e19 rd6008a8  
    5151  double l; 
    5252 
    53   if (gen_expr == NULL) 
    54         return 0; 
    55       
     53  if (gen_expr == NULL)  
     54       return 0; 
     55    
    5656  switch(gen_expr->type) { 
    57   case VAL_T: 
     57  case VAL_T:   
    5858    return eval_val_expr(gen_expr->item); 
    5959  case PREFUN_T: 
    6060    l = eval_prefun_expr(gen_expr->item); 
    6161    //if (EVAL_DEBUG) printf("eval_gen_expr: prefix function return value: %f\n", l); 
    62     return l;         
     62  &