kopia lustrzana https://github.com/proto17/dji_droneid
Porównaj commity
3 Commity
df985ba877
...
3bc45fe703
Autor | SHA1 | Data |
---|---|---|
David Protzman | 3bc45fe703 | |
David Protzman | 39d419e318 | |
David Protzman | a4c21fdf91 |
|
@ -73,9 +73,11 @@ namespace gr {
|
|||
gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items) {
|
||||
// Get handles to the input and output arrays
|
||||
const auto *in = (const gr_complex *) input_items[0];
|
||||
auto *out = (gr_complex *) output_items[0];
|
||||
|
||||
// Always tell GNU Radio that all samples were accepted even if not this many samples were written out
|
||||
consume_each(noutput_items);
|
||||
|
||||
// This is how the remaining samples are buffered between calls. It's important to realize that this algo
|
||||
|
@ -154,18 +156,19 @@ namespace gr {
|
|||
// Multiply each variance by the tap variances then take the reciprocal
|
||||
volk_32f_s32f_multiply_32f(&vars_[0], &vars_[0], taps_var_, num_steps);
|
||||
|
||||
// Take the square root of the product of the two variances
|
||||
volk_32f_sqrt_32f(&vars_[0], &vars_[0], num_steps);
|
||||
|
||||
// There's no VOLK function for the reciprocal operation. This is being done so that a multiply can be
|
||||
// used next to divide the dot product results by the sqrt calculated above
|
||||
for (auto & var : vars_) {
|
||||
var = 1.0f / var;
|
||||
}
|
||||
// Calculate the inverse square root (1/sqrt(vars_[x]))
|
||||
volk_32f_invsqrt_32f(&vars_[0], &vars_[0], num_steps);
|
||||
|
||||
// Divide by the square root above
|
||||
volk_32fc_32f_multiply_32fc(&out[0], &out[0], &vars_[0], num_steps);
|
||||
|
||||
// Go through all outputs and replace NaN's with zeros. This isn't strictly required, but nice to have
|
||||
for (uint32_t idx = 0; idx < num_steps; idx++) {
|
||||
if (out[idx].real() == FP_NAN || out[idx].imag() == FP_NAN) {
|
||||
out[idx] = zero_complex_;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all the samples that have been processed from the buffer. Leaving just the last <window_size_-1>
|
||||
// samples for the next call
|
||||
buffer_.erase(buffer_.begin(), buffer_.begin() + num_steps);
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace gr {
|
|||
std::vector<float> vars_;
|
||||
std::vector<float> abs_squared_;
|
||||
std::vector<gr_complex> buffer_;
|
||||
const gr_complex zero_complex_ = gr_complex{0, 0};
|
||||
// Nothing to declare in this block.
|
||||
|
||||
public:
|
||||
|
|
Ładowanie…
Reference in New Issue