Changeset 5181:ca57e34b2a35 in roaraudio for libroardsp/filter_quantify.c
- Timestamp:
- 10/22/11 16:17:35 (13 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroardsp/filter_quantify.c
r4708 r5181 33 33 } 34 34 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; 35 static 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 } 39 44 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 */ \ 47 int 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 } 50 58 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) 54 63 55 64 int roardsp_quantify_ctl (struct roardsp_filter * filter, int cmd, void * data) {
Note: See TracChangeset
for help on using the changeset viewer.