Changeset 5181:ca57e34b2a35 in roaraudio


Ignore:
Timestamp:
10/22/11 16:17:35 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

updated filters to support 8 and 32 bit as well as 16 bit

Files:
9 edited

Legend:

Unmodified
Added
Removed
  • include/libroardsp/filters.h

    r5177 r5181  
    100100int roardsp_lowp_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id); 
    101101int roardsp_lowp_uninit(struct roardsp_filter * filter); 
     102int roardsp_lowp_calc32(struct roardsp_filter * filter, void * data, size_t samples); 
    102103int roardsp_lowp_calc16(struct roardsp_filter * filter, void * data, size_t samples); 
     104int roardsp_lowp_calc8 (struct roardsp_filter * filter, void * data, size_t samples); 
    103105int roardsp_lowp_ctl   (struct roardsp_filter * filter, int cmd, void * data); 
    104106int roardsp_lowp_reset (struct roardsp_filter * filter, int what); 
     
    106108int roardsp_highp_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id); 
    107109int roardsp_highp_uninit(struct roardsp_filter * filter); 
     110int roardsp_highp_calc32(struct roardsp_filter * filter, void * data, size_t samples); 
    108111int roardsp_highp_calc16(struct roardsp_filter * filter, void * data, size_t samples); 
     112int roardsp_highp_calc8 (struct roardsp_filter * filter, void * data, size_t samples); 
    109113int roardsp_highp_ctl   (struct roardsp_filter * filter, int cmd, void * data); 
    110114int roardsp_highp_reset (struct roardsp_filter * filter, int what); 
     
    113117int roardsp_amp_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id); 
    114118int roardsp_amp_uninit(struct roardsp_filter * filter); 
     119int roardsp_amp_calc32(struct roardsp_filter * filter, void * data, size_t samples); 
    115120int roardsp_amp_calc16(struct roardsp_filter * filter, void * data, size_t samples); 
    116121int roardsp_amp_calc8 (struct roardsp_filter * filter, void * data, size_t samples); 
     
    118123int roardsp_amp_reset (struct roardsp_filter * filter, int what); 
    119124 
    120 int roardsp_add_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id); 
     125int roardsp_add_calc32(struct roardsp_filter * filter, void * data, size_t samples); 
    121126int roardsp_add_calc16(struct roardsp_filter * filter, void * data, size_t samples); 
     127int roardsp_add_calc8 (struct roardsp_filter * filter, void * data, size_t samples); 
    122128int roardsp_add_reset (struct roardsp_filter * filter, int what); 
    123129 
    124130int roardsp_quantify_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id); 
    125131int roardsp_quantify_uninit(struct roardsp_filter * filter); 
     132int roardsp_quantify_calc32(struct roardsp_filter * filter, void * data, size_t samples); 
    126133int roardsp_quantify_calc16(struct roardsp_filter * filter, void * data, size_t samples); 
     134int roardsp_quantify_calc8 (struct roardsp_filter * filter, void * data, size_t samples); 
    127135int roardsp_quantify_ctl   (struct roardsp_filter * filter, int cmd, void * data); 
    128136int roardsp_quantify_reset (struct roardsp_filter * filter, int what); 
     
    148156int roardsp_swap_init   (struct roardsp_filter * filter, struct roar_stream * stream, int id); 
    149157int roardsp_swap_uninit (struct roardsp_filter * filter); 
     158int roardsp_swap_calc322(struct roardsp_filter * filter, void * data, size_t samples); 
    150159int roardsp_swap_calc162(struct roardsp_filter * filter, void * data, size_t samples); 
     160int roardsp_swap_calc82 (struct roardsp_filter * filter, void * data, size_t samples); 
    151161int roardsp_swap_ctl    (struct roardsp_filter * filter, int cmd, void * data); 
    152162int roardsp_swap_reset  (struct roardsp_filter * filter, int what); 
  • libroardsp/filter.c

    r5177 r5181  
    3636} _roardsp_filterlist[] = { 
    3737 {ROARDSP_FILTER_AMP, "AMP", roardsp_amp_init, roardsp_amp_uninit, roardsp_amp_ctl, roardsp_amp_reset, { 
    38            {NULL, NULL, NULL},{roardsp_amp_calc8, NULL, NULL},{roardsp_amp_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 
    39  {ROARDSP_FILTER_ADD, "Add", roardsp_add_init, roardsp_amp_uninit, roardsp_amp_ctl, roardsp_add_reset, { 
    40            {NULL, NULL, NULL},{NULL, NULL, NULL},{roardsp_add_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 
     38           {NULL, NULL, NULL},{roardsp_amp_calc8, NULL, NULL},{roardsp_amp_calc16, NULL, NULL}, 
     39           {NULL, NULL, NULL},{roardsp_amp_calc32, NULL, NULL}}}, 
     40 {ROARDSP_FILTER_ADD, "Add", roardsp_amp_init, roardsp_amp_uninit, roardsp_amp_ctl, roardsp_add_reset, { 
     41           {NULL, NULL, NULL},{roardsp_add_calc8, NULL, NULL},{roardsp_add_calc16, NULL, NULL}, 
     42           {NULL, NULL, NULL},{roardsp_add_calc32, NULL, NULL}}}, 
    4143#ifdef ROAR_HAVE_LIBM 
    4244 {ROARDSP_FILTER_LOWP, "Lowpass", roardsp_lowp_init, roardsp_lowp_uninit, roardsp_lowp_ctl, roardsp_lowp_reset, { 
    43            {NULL, NULL, NULL},{NULL, NULL, NULL},{roardsp_lowp_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 
     45           {NULL, NULL, NULL},{roardsp_lowp_calc8, NULL, NULL},{roardsp_lowp_calc16, NULL, NULL}, 
     46           {NULL, NULL, NULL},{roardsp_lowp_calc32, NULL, NULL}}}, 
    4447 {ROARDSP_FILTER_HIGHP, "Highpass", roardsp_highp_init, roardsp_highp_uninit, roardsp_highp_ctl, roardsp_highp_reset, { 
    45            {NULL, NULL, NULL},{NULL, NULL, NULL},{roardsp_highp_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 
     48           {NULL, NULL, NULL},{roardsp_highp_calc8, NULL, NULL},{roardsp_highp_calc16, NULL, NULL}, 
     49           {NULL, NULL, NULL},{roardsp_highp_calc32, NULL, NULL}}}, 
    4650#endif 
    4751 {ROARDSP_FILTER_QUANTIFY, "Quantifier", roardsp_quantify_init, NULL, roardsp_quantify_ctl, roardsp_quantify_reset, { 
    48            {NULL, NULL, NULL},{NULL, NULL, NULL},{roardsp_quantify_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 
     52           {NULL, NULL, NULL},{roardsp_quantify_calc8, NULL, NULL},{roardsp_quantify_calc16, NULL, NULL}, 
     53           {NULL, NULL, NULL},{roardsp_quantify_calc32, NULL, NULL}}}, 
    4954 {ROARDSP_FILTER_CLIP, "Clip", roardsp_clip_init, roardsp_clip_uninit, roardsp_clip_ctl, roardsp_clip_reset, { 
    5055           {NULL, NULL, NULL},{roardsp_clip_calc8, NULL, NULL},{roardsp_clip_calc16, NULL, NULL}, 
     
    5560           {NULL, NULL, NULL},{NULL, NULL, NULL},{roardsp_dcblock_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 
    5661 {ROARDSP_FILTER_SWAP, "Swap", roardsp_swap_init, roardsp_swap_uninit, roardsp_swap_ctl, roardsp_swap_reset, { 
    57            {NULL, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, roardsp_swap_calc162},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 
     62           {NULL, NULL, NULL},{NULL, NULL, roardsp_swap_calc82},{NULL, NULL, roardsp_swap_calc162}, 
     63           {NULL, NULL, NULL},{NULL, NULL, roardsp_swap_calc322}}}, 
    5864 {ROARDSP_FILTER_AGC, "AGC", roardsp_agc_init, roardsp_agc_uninit, roardsp_agc_ctl, roardsp_agc_reset, { 
    5965           {NULL, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 
  • libroardsp/filter_add.c

    r4708 r5181  
    2626#include "libroardsp.h" 
    2727 
    28 int roardsp_add_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id) { 
    29  struct roardsp_amp * self = roar_mm_malloc(sizeof(struct roardsp_amp)); 
    30  
    31  if ( self == NULL ) 
    32   return -1; 
    33  
    34  memset(self, 0, sizeof(struct roardsp_amp)); 
    35  
    36  filter->inst = (void*) self; 
    37  
    38  roardsp_filter_reset(filter, ROARDSP_RESET_FULL); 
    39  
    40  return 0; 
     28#define _calcX(bits) \ 
     29int roardsp_add_calc##bits  (struct roardsp_filter * filter, void * data, size_t samples) { \ 
     30 struct roardsp_amp * self = (struct roardsp_amp *) filter->inst; \ 
     31 int##bits##_t * samp = (int##bits##_t *) data; \ 
     32 size_t i; \ 
     33\ 
     34 for (i = 0; i < samples; i++) { \ 
     35  samp[i] += self->mul / self->div; \ 
     36 }; \ 
     37\ 
     38 return 0; \ 
    4139} 
    4240 
    43 int roardsp_add_calc16  (struct roardsp_filter * filter, void * data, size_t samples) { 
    44  struct roardsp_amp * self = (struct roardsp_amp *) filter->inst; 
    45  int16_t * samp = (int16_t *) data; 
    46  size_t i; 
    47  
    48  for (i = 0; i < samples; i++) { 
    49   samp[i] += self->mul / self->div; 
    50  }; 
    51  
    52  return 0; 
    53 } 
     41_calcX(8) 
     42_calcX(16) 
     43_calcX(32) 
    5444 
    5545int roardsp_add_reset (struct roardsp_filter * filter, int what) { 
  • libroardsp/filter_amp.c

    r4708 r5181  
    4747} 
    4848 
    49 int roardsp_amp_calc8  (struct roardsp_filter * filter, void * data, size_t samples) { 
    50  struct roardsp_amp * self = (struct roardsp_amp *) filter->inst; 
    51  int8_t * samp = (int8_t *) data; 
    52  register int_least32_t s; 
    53  size_t i; 
    54  
    55  for (i = 0; i < samples; i++) { 
    56   s        = samp[i]; 
    57   s       *= self->mul; 
    58   s       /= self->div; 
    59   samp[i]  = s; 
    60  }; 
    61  
    62  return 0; 
     49#define _calcX(bits,twobits) \ 
     50int roardsp_amp_calc##bits  (struct roardsp_filter * filter, void * data, size_t samples) { \ 
     51 struct roardsp_amp * self = (struct roardsp_amp *) filter->inst; \ 
     52 int##bits##_t * samp = (int##bits##_t *) data; \ 
     53 register int##twobits##_t s; \ 
     54 size_t i; \ 
     55\ 
     56 for (i = 0; i < samples; i++) { \ 
     57  s        = samp[i]; \ 
     58  s       *= self->mul; \ 
     59  s       /= self->div; \ 
     60  samp[i]  = s; \ 
     61 }; \ 
     62\ 
     63 return 0; \ 
    6364} 
    6465 
    65 int roardsp_amp_calc16  (struct roardsp_filter * filter, void * data, size_t samples) { 
    66  struct roardsp_amp * self = (struct roardsp_amp *) filter->inst; 
    67  int16_t * samp = (int16_t *) data; 
    68  register int_least32_t s; 
    69  size_t i; 
    70  
    71  for (i = 0; i < samples; i++) { 
    72   s        = samp[i]; 
    73   s       *= self->mul; 
    74   s       /= self->div; 
    75 //  ROAR_DBG("roardsp_amp_calc16(*): samp[i=%u] = %i, s=%i, self->mul=%i, self->div=%i", i, samp[i], s, self->mul, self->div); 
    76   samp[i]  = s; 
    77  }; 
    78  
    79  return 0; 
    80 } 
     66_calcX(8,16) 
     67_calcX(16,32) 
     68_calcX(32,64) 
    8169 
    8270int roardsp_amp_ctl   (struct roardsp_filter * filter, int cmd, void * data) { 
  • libroardsp/filter_downmix.c

    r4708 r5181  
    9999 
    100100int roardsp_downmix_reset  (struct roardsp_filter * filter, int what) { 
    101  int mode = ROARDSP_DOWNMIX_ARITHMETIC; 
     101 int32_t mode = ROARDSP_DOWNMIX_ARITHMETIC; 
    102102 
    103103 if ( filter == NULL ) 
  • libroardsp/filter_highp.c

    r4708 r5181  
    3030int roardsp_highp_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id) { 
    3131 struct roardsp_highp * self = roar_mm_malloc(sizeof(struct roardsp_highp)); 
    32  float freq = 25; 
    3332 
    3433 if ( self == NULL ) 
     
    3938 filter->inst = (void*) self; 
    4039 
    41  roardsp_highp_ctl(filter, ROARDSP_FCTL_FREQ, &freq); 
    42  
    43  return 0; 
     40 return roardsp_filter_reset(filter, ROARDSP_RESET_FULL); 
    4441} 
    4542 
     
    5047} 
    5148 
    52 int roardsp_highp_calc16(struct roardsp_filter * filter, void * data, size_t samples) { 
    53  struct roardsp_highp * self = (struct roardsp_highp *) filter->inst; 
    54  int16_t * samp = (int16_t *) data; 
    55  register int32_t s, h; 
    56  int i, c; 
    57  int channels = filter->channels; 
     49#define _calcX(bits,twobits) \ 
     50int roardsp_highp_calc##bits (struct roardsp_filter * filter, void * data, size_t samples) { \ 
     51 struct roardsp_highp * self = (struct roardsp_highp *) filter->inst; \ 
     52 int##bits##_t * samp = (int##bits##_t *) data; \ 
     53 register int##twobits##_t s, h; \ 
     54 int i, c; \ 
     55 int channels = filter->channels; \ 
     56\ 
     57 if ( channels > ROAR_MAX_CHANNELS ) \ 
     58  return -1; \ 
     59\ 
     60 samples /= channels; \ 
     61\ 
     62 ROAR_DBG("roardsp_highp_calc16(*): filtering %i frames of %i channels...", samples, channels); \ 
     63\ 
     64/* *      output[N] = A0 * input[N] + A1 * input[N-1] + B1 * output[N-1] */ \ 
     65\ 
     66\ 
     67 for (i = 0; i < samples; i++) { \ 
     68  for (c = 0; c < channels; c++) { \ 
     69   h = samp[i*channels + c]; \ 
     70   s = (int##twobits##_t)samp[i*channels + c] * self->a + (int##twobits##_t)self->oldin[c] * self->b + (int##twobits##_t)self->oldout[c] * self->c; \ 
     71\ 
     72   s /= 65536; \ 
     73\ 
     74   self->oldin[      c] = h; \ 
     75   samp[i*channels + c] = s; \ 
     76   self->oldout[     c] = s; \ 
     77  } \ 
     78 } \ 
     79\ 
     80 return 0; \ 
     81} 
    5882 
    59  if ( channels > ROAR_MAX_CHANNELS ) 
    60   return -1; 
    61  
    62  samples /= channels; 
    63  
    64  ROAR_DBG("roardsp_highp_calc16(*): filtering %i frames of %i channels...", samples, channels); 
    65  
    66 // *      output[N] = A0 * input[N] + A1 * input[N-1] + B1 * output[N-1] 
    67  
    68  
    69  for (i = 0; i < samples; i++) { 
    70   for (c = 0; c < channels; c++) { 
    71    h = samp[i*channels + c]; 
    72    s = samp[i*channels + c] * self->a + self->oldin[c] * self->b + self->oldout[c] * self->c; 
    73  
    74    s /= 65536; 
    75  
    76    self->oldin[      c] = h; 
    77    samp[i*channels + c] = s; 
    78    self->oldout[     c] = s; 
    79   } 
    80  } 
    81  
    82  return 0; 
    83 } 
     83_calcX(8,32) /* we need 32 bit not 16 bit here as we multiplay with 65536 internally */ 
     84_calcX(16,32) 
     85_calcX(32,64) 
    8486 
    8587int roardsp_highp_ctl   (struct roardsp_filter * filter, int cmd, void * data) { 
     
    114116int roardsp_highp_reset (struct roardsp_filter * filter, int what) { 
    115117 struct roardsp_highp * self; 
    116  float freq = 25; 
     118 float freq = 25.; 
    117119 
    118120 if ( filter == NULL ) 
  • libroardsp/filter_lowp.c

    r5170 r5181  
    3030int roardsp_lowp_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id) { 
    3131 struct roardsp_lowp * self = roar_mm_malloc(sizeof(struct roardsp_lowp)); 
    32  float freq = filter->rate/2.45; 
    3332 
    3433 ROAR_DBG("roardsp_lowp_init(*): self=%p", self); 
     
    4140 filter->inst = (void*) self; 
    4241 
    43  roardsp_lowp_ctl(filter, ROARDSP_FCTL_FREQ, &freq); 
    44  
    45  return 0; 
     42 return roardsp_filter_reset(filter, ROARDSP_RESET_FULL); 
    4643} 
    4744 
    4845int roardsp_lowp_uninit(struct roardsp_filter * filter) { 
    49  
    5046 roar_mm_free(filter->inst); 
    5147 return 0; 
    5248} 
    5349 
    54 int roardsp_lowp_calc16  (struct roardsp_filter * filter, void * data, size_t samples) { 
    55  struct roardsp_lowp * self = (struct roardsp_lowp *) filter->inst; 
    56  int16_t * samp = (int16_t *) data; 
    57  register int32_t s; 
    58  int i, c; 
    59  int channels = filter->channels; 
     50#define _calcX(bits,twobits) \ 
     51int roardsp_lowp_calc##bits  (struct roardsp_filter * filter, void * data, size_t samples) { \ 
     52 struct roardsp_lowp * self = (struct roardsp_lowp *) filter->inst; \ 
     53 int##bits##_t * samp = (int##bits##_t *) data; \ 
     54 register int##twobits##_t s; \ 
     55 int i, c; \ 
     56 int channels = filter->channels; \ 
     57\ 
     58 if ( channels > ROAR_MAX_CHANNELS ) \ 
     59  return -1; \ 
     60\ 
     61 samples /= channels; \ 
     62\ 
     63 ROAR_DBG("roardsp_lowp_calc16(*): filtering %i frames of %i channels...", samples, channels); \ 
     64\ 
     65/*  *      output[N] = input[N] * A + output[N-1] * B */ \ 
     66\ 
     67 for (i = 0; i < samples; i++) { \ 
     68  for (c = 0; c < channels; c++) { \ 
     69   s = (int##twobits##_t)samp[i*channels + c] * self->a + (int##twobits##_t)self->old[c] * self->b; \ 
     70\ 
     71   s /= 65536; \ 
     72\ 
     73   samp[i*channels + c] = s; \ 
     74   self->old[        c] = s; \ 
     75  } \ 
     76 } \ 
     77\ 
     78 return 0; \ 
     79} 
    6080 
    61  if ( channels > ROAR_MAX_CHANNELS ) 
    62   return -1; 
    63  
    64  samples /= channels; 
    65  
    66  ROAR_DBG("roardsp_lowp_calc16(*): filtering %i frames of %i channels...", samples, channels); 
    67  
    68 //  *      output[N] = input[N] * A + output[N-1] * B 
    69  
    70  for (i = 0; i < samples; i++) { 
    71   for (c = 0; c < channels; c++) { 
    72    s = samp[i*channels + c] * self->a + self->old[c] * self->b; 
    73  
    74    s /= 65536; 
    75  
    76    samp[i*channels + c] = s; 
    77    self->old[        c] = s; 
    78   } 
    79  } 
    80  
    81  return 0; 
    82 } 
     81_calcX(8,32) /* we need 32 bit not 16 bit here as we multiplay with 65536 internally */ 
     82_calcX(16,32) 
     83_calcX(32,64) 
    8384 
    8485int roardsp_lowp_ctl   (struct roardsp_filter * filter, int cmd, void * data) { 
     
    8889 float newfreq; 
    8990 
    90  if ( cmd != ROARDSP_FCTL_FREQ ) 
     91 if ( cmd != ROARDSP_FCTL_FREQ ) { 
     92  roar_err_set(ROAR_ERROR_BADRQC); 
    9193  return -1; 
     94 } 
    9295 
    9396 newfreq = *(float*)data; 
    9497 
    95  lp = exp(-2 * M_PI * newfreq / filter->rate) * 65536; 
     98 lp = exp(-2. * M_PI * newfreq / filter->rate) * 65536.; 
    9699 
    97100 self->b = lp; 
    98  self->a = 65536 - lp; 
     101 self->a = 65536. - lp; 
    99102 
    100  oldfreq = self->freq / 1000; 
    101  self->freq = newfreq * 1000; 
     103 oldfreq = self->freq / 1000.; 
     104 self->freq = newfreq * 1000.; 
    102105 
    103106 *(float*)data = oldfreq; 
  • libroardsp/filter_quantify.c

    r4708 r5181  
    3333} 
    3434 
    35 int roardsp_quantify_calc16  (struct roardsp_filter * filter, void * data, size_t samples) { 
    36  int16_t * samp = (int16_t *) data; 
    37  register float s; 
    38  size_t i; 
     35static inline int16_t _calc(int16_t val, void * inst) { 
     36 register float s = val; 
     37 s       /= 32768; 
     38 s       *= (ROAR_INSTINT)inst; 
     39 s        = (int16_t)s; 
     40 s       /= (ROAR_INSTINT)inst; 
     41 s       *= 32768; 
     42 return s; 
     43} 
    3944 
    40  for (i = 0; i < samples; i++) { 
    41   s        = samp[i]; 
    42   s       /= 32768; 
    43   s       *= (ROAR_INSTINT)filter->inst; 
    44   s        = (int16_t)s; 
    45 //  ROAR_WARN("roardsp_quantify_calc16(*): s=%f", s); 
    46   s       /= (ROAR_INSTINT)filter->inst; 
    47   s       *= 32768; 
    48   samp[i]  = s; 
    49  }; 
     45#define _calcX(bits,rshift,lshift) \ 
     46/* this code is buggy for 8 bit filters */ \ 
     47int roardsp_quantify_calc##bits  (struct roardsp_filter * filter, void * data, size_t samples) { \ 
     48 int##bits##_t * samp = (int##bits##_t *) data; \ 
     49 size_t i; \ 
     50\ 
     51 for (i = 0; i < samples; i++) { \ 
     52  samp[i]  = _calc(samp[i] rshift, filter->inst) lshift; \ 
     53 } \ 
     54\ 
     55 ROAR_DBG("roardsp_quantify_calc%i(*) = 0", bits); \ 
     56 return 0; \ 
     57} 
    5058 
    51  ROAR_DBG("roardsp_quantify_calc16(*) = 0"); 
    52  return 0; 
    53 } 
     59/* look at our nice parameters ;) */ 
     60_calcX(8,<< 8,>> 8) 
     61_calcX(16,,) 
     62_calcX(32,>> 16,<< 16) 
    5463 
    5564int roardsp_quantify_ctl   (struct roardsp_filter * filter, int cmd, void * data) { 
  • libroardsp/filter_swap.c

    r4708 r5181  
    5454} 
    5555 
    56 int roardsp_swap_calc162(struct roardsp_filter * filter, void * data, size_t samples) { 
    57  int16_t * d = data; 
    58  register int16_t s; 
    59  int i; 
     56#define _calcX2(bits) \ 
     57int roardsp_swap_calc##bits##2(struct roardsp_filter * filter, void * data, size_t samples) { \ 
     58 int##bits##_t * d = data; \ 
     59 register int##bits##_t s; \ 
     60 size_t i; \ 
     61\ 
     62 for (i = 0; i < samples; i += 2) { \ 
     63  ROAR_DBG("roardsp_swap_calc*2(*): d[i]=%i, d[i+1]=%i", d[i], d[i+1]); \ 
     64  s      = d[i]; \ 
     65  d[i]   = d[i+1]; \ 
     66  d[i+1] = s; \ 
     67 } \ 
     68\ 
     69 return 0; \ 
     70} 
    6071 
    61  for (i = 0; i < samples; i += 2) { 
    62   ROAR_DBG("roardsp_swap_calc162(*): d[i]=%i, d[i+1]=%i", d[i], d[i+1]); 
    63   s      = d[i]; 
    64   d[i]   = d[i+1]; 
    65   d[i+1] = s; 
    66  } 
    67  
    68  return 0; 
    69 } 
     72_calcX2(8) 
     73_calcX2(16) 
     74_calcX2(32) 
    7075 
    7176int roardsp_swap_ctl    (struct roardsp_filter * filter, int cmd, void * data) { 
Note: See TracChangeset for help on using the changeset viewer.