Module: Radio::Filter::InterpolateFir::Float

Defined in:
lib/radio/filters/fir.rb

Instance Method Summary collapse

Instance Method Details

#call(data) {|out.reshape!(out.size)| ... } ⇒ Object

Yields:

  • (out.reshape!(out.size))


260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/radio/filters/fir.rb', line 260

def call data
  out = NArray.sfloat @interpolation_size, data.size
  index = 0
  data.each do |value|
    @interpolation_buf_f[@interpolation_fir_pos] = value
    @interpolation_fir_pos += 1
    @interpolation_fir_pos = 0 if @interpolation_fir_pos == @interpolation_fir_size
    iq = @interpolation_fir_coef[@interpolation_fir_pos].mul_accum @interpolation_buf_f, 0
    out[true,index] = iq.reshape!(iq.size).mul!(@interpolation_size)
    index += 1
  end
  yield out.reshape!(out.size)
end