diff options
author | Marcus Müller <marcus@hostalia.de> | 2016-09-15 21:21:17 -0600 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2016-09-15 21:21:17 -0600 |
commit | 54ede29960f9022a8040e10c0d58fa8fed989a3f (patch) | |
tree | 9fd1044a559244fc3a21d99b257b14d64b3f9d3a | |
parent | 22f637f30e54f6a46c8c40c8923ef3d8c66104e9 (diff) |
fixed QA, conditionalized adding loop
-rw-r--r-- | gr-blocks/lib/nlog10_ff_impl.cc | 7 | ||||
-rwxr-xr-x | gr-blocks/python/blocks/qa_nlog10.py | 6 |
2 files changed, 7 insertions, 6 deletions
diff --git a/gr-blocks/lib/nlog10_ff_impl.cc b/gr-blocks/lib/nlog10_ff_impl.cc index 67dafae45a..5bc234f2cb 100644 --- a/gr-blocks/lib/nlog10_ff_impl.cc +++ b/gr-blocks/lib/nlog10_ff_impl.cc @@ -64,15 +64,16 @@ namespace gr { gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - #define novolk 0 const float *in = (const float *) input_items[0]; float *out = (float *) output_items[0]; int noi = noutput_items * d_vlen; volk_32f_log2_32f(out, in, noi); volk_32f_s32f_multiply_32f(out, out, d_prefactor, noi); - for(int i = 0; i < noi; ++i) { - out[i] += d_k; + if(d_k != 0.0f) { + for(int i = 0; i < noi; ++i) { + out[i] += d_k; + } } return noutput_items; } diff --git a/gr-blocks/python/blocks/qa_nlog10.py b/gr-blocks/python/blocks/qa_nlog10.py index 0194e85d48..c925479f59 100755 --- a/gr-blocks/python/blocks/qa_nlog10.py +++ b/gr-blocks/python/blocks/qa_nlog10.py @@ -31,15 +31,15 @@ class test_nlog10(gr_unittest.TestCase): self.tb = None def test_001(self): - src_data = (-10, 0, 10, 100, 1000, 10000, 100000) - expected_result = (-180, -180, 10, 20, 30, 40, 50) + src_data = (1, 10, 100, 1000, 10000, 100000) + expected_result = (0, 10, 20, 30, 40, 50) src = blocks.vector_source_f(src_data) op = blocks.nlog10_ff(10) dst = blocks.vector_sink_f() self.tb.connect (src, op, dst) self.tb.run() result_data = dst.data() - self.assertFloatTuplesAlmostEqual (expected_result, result_data) + self.assertFloatTuplesAlmostEqual (expected_result, result_data, 5) if __name__ == '__main__': |