Brusque -- > some months ago Olin posted the formula that changed DSP world: :) > Filt <-- Filt + (New - Filt)*FFrac > > Saddly, my 8 bit implementation have a problem that I can't surpass: > filt = filt + ((sig16)new - (sig16)filt) / 2; > > The value never goes to 255 because of integer roundings: > filt = 254 + (255 - 254) / 2; > filt = 254 + (1)/2; > filt = 254; > > There's a way to change this? I've tried to raise the resolution making: > filt = filt + ((sig16)new*2 - (sig16)filt*2 + 1) / 4; > > But got same results because: > filt = 254 + ((sig16)255*2 - (sig16)254*2 + 1) / 4; > filt = 254 + (510 - 508 + 1) / 4; > filt = 254 + (510 - 508 + 1) / 4; > filt = 254 + (1) / 4; I think you correctly recognized that you need to round rather than truncate the result, but you only rounded one term instead of the total: Original: filt = filt + (new - filt) / 2; Rounded: filt = ((filt*2 + (new*2 - filt*2) / 2) + 1) / 2; filt = ((254*2 + (255*2 - 254*2) / 2) + 1) / 2; filt = ((508 + (510 - 508) / 2) + 1) / 2; filt = ((508 + 2 / 2) + 1) / 2; filt = (509 + 1) / 2; filt = 510 / 2; filt = 255; I hope this helps. -- Dave Tweed -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body