summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2013-11-16 10:34:48 -0800
committerJohnathan Corgan <johnathan@corganlabs.com>2013-11-16 10:34:48 -0800
commitf0eebb1aeeae4fa6a6602ca19162e66aede48264 (patch)
tree111299eb72e9640fad3a848393e53d4019884f13
parenteb5309f2663bd1dccf14a77b108ec0fe8780ac80 (diff)
parent04c3275e610f9ddd72d86378b86949b482f3accc (diff)
Merge branch 'maint'
-rw-r--r--gnuradio-runtime/lib/tagged_stream_block.cc4
-rw-r--r--gr-blocks/lib/wavfile.cc22
-rwxr-xr-xgr-blocks/python/blocks/qa_wavfile.py10
-rw-r--r--gr-blocks/python/blocks/test_16bit_1chunk.wavbin52 -> 70 bytes
-rw-r--r--gr-filter/lib/dc_blocker_cc_impl.cc2
-rw-r--r--gr-filter/lib/dc_blocker_ff_impl.cc2
-rw-r--r--gr-filter/lib/fir_filter.cc12
-rw-r--r--gr-filter/lib/fir_filter_with_buffer.cc6
-rw-r--r--gr-filter/lib/qa_fir_filter_with_buffer.cc2
9 files changed, 43 insertions, 17 deletions
diff --git a/gnuradio-runtime/lib/tagged_stream_block.cc b/gnuradio-runtime/lib/tagged_stream_block.cc
index 40febfdeca..c6d5fc1fec 100644
--- a/gnuradio-runtime/lib/tagged_stream_block.cc
+++ b/gnuradio-runtime/lib/tagged_stream_block.cc
@@ -134,7 +134,9 @@ namespace gr {
for(int i = 0; i < (int) d_n_input_items_reqd.size(); i++) {
consume(i, d_n_input_items_reqd[i]);
}
- update_length_tags(n_produced, output_items.size());
+ if (n_produced > 0) {
+ update_length_tags(n_produced, output_items.size());
+ }
d_n_input_items_reqd.assign(input_items.size(), 0);
diff --git a/gr-blocks/lib/wavfile.cc b/gr-blocks/lib/wavfile.cc
index 0a4336f443..865082e05f 100644
--- a/gr-blocks/lib/wavfile.cc
+++ b/gr-blocks/lib/wavfile.cc
@@ -138,10 +138,26 @@ namespace gr {
}
}
- // data chunk
+ // find data chunk
fresult = fread(str_buf, 1, 4, fp);
- if(strncmp(str_buf, "data", 4)) {
- return false;
+ // keep parsing chunk until we hit the data chunk
+ while(fresult != 4 || strncmp(str_buf, "data", 4))
+ {
+ // all good?
+ if(fresult != 4 || ferror(fp) || feof(fp)) {
+ return false;
+ }
+ // get chunk body size and skip
+ fresult = fread(&chunk_size, 1, 4, fp);
+ if(fresult != 4 || ferror(fp) || feof(fp)) {
+ return false;
+ }
+ chunk_size = wav_to_host(chunk_size);
+ if(fseek(fp, chunk_size, SEEK_CUR) != 0) {
+ return false;
+ }
+ // read next chunk type
+ fresult = fread(str_buf, 1, 4, fp);
}
fresult = fread(&chunk_size, 1, 4, fp);
diff --git a/gr-blocks/python/blocks/qa_wavfile.py b/gr-blocks/python/blocks/qa_wavfile.py
index ce1806c5ef..5c3a69e1d0 100755
--- a/gr-blocks/python/blocks/qa_wavfile.py
+++ b/gr-blocks/python/blocks/qa_wavfile.py
@@ -26,6 +26,8 @@ import os
from os.path import getsize
g_in_file = os.path.join(os.getenv("srcdir"), "test_16bit_1chunk.wav")
+g_extra_header_offset = 36
+g_extra_header_len = 18
class test_wavefile(gr_unittest.TestCase):
@@ -52,7 +54,8 @@ class test_wavefile(gr_unittest.TestCase):
self.tb.run()
wf_out.close()
- self.assertEqual(getsize(infile), getsize(outfile))
+ # we're loosing all extra header chunks
+ self.assertEqual(getsize(infile) - g_extra_header_len, getsize(outfile))
in_f = file(infile, 'rb')
out_f = file(outfile, 'rb')
@@ -61,8 +64,9 @@ class test_wavefile(gr_unittest.TestCase):
out_data = out_f.read()
out_f.close()
os.remove(outfile)
-
- self.assertEqual(in_data, out_data)
+ # cut extra header chunks input file
+ self.assertEqual(in_data[:g_extra_header_offset] + \
+ in_data[g_extra_header_offset + g_extra_header_len:], out_data)
if __name__ == '__main__':
gr_unittest.run(test_wavefile, "test_wavefile.xml")
diff --git a/gr-blocks/python/blocks/test_16bit_1chunk.wav b/gr-blocks/python/blocks/test_16bit_1chunk.wav
index 0fe12a7a13..d1b5ba91bd 100644
--- a/gr-blocks/python/blocks/test_16bit_1chunk.wav
+++ b/gr-blocks/python/blocks/test_16bit_1chunk.wav
Binary files differ
diff --git a/gr-filter/lib/dc_blocker_cc_impl.cc b/gr-filter/lib/dc_blocker_cc_impl.cc
index c5cf189cba..355426e821 100644
--- a/gr-filter/lib/dc_blocker_cc_impl.cc
+++ b/gr-filter/lib/dc_blocker_cc_impl.cc
@@ -79,6 +79,8 @@ namespace gr {
else {
d_ma_0 = new moving_averager_c(D);
d_ma_1 = new moving_averager_c(D);
+ d_ma_2 = NULL;
+ d_ma_3 = NULL;
}
}
diff --git a/gr-filter/lib/dc_blocker_ff_impl.cc b/gr-filter/lib/dc_blocker_ff_impl.cc
index 1e5b238a50..c0b5b17022 100644
--- a/gr-filter/lib/dc_blocker_ff_impl.cc
+++ b/gr-filter/lib/dc_blocker_ff_impl.cc
@@ -77,6 +77,8 @@ namespace gr {
else {
d_ma_0 = new moving_averager_f(D);
d_ma_1 = new moving_averager_f(D);
+ d_ma_2 = NULL;
+ d_ma_3 = NULL;
}
}
diff --git a/gr-filter/lib/fir_filter.cc b/gr-filter/lib/fir_filter.cc
index 38df5fdc3e..552936b8f6 100644
--- a/gr-filter/lib/fir_filter.cc
+++ b/gr-filter/lib/fir_filter.cc
@@ -75,7 +75,7 @@ namespace gr {
std::reverse(d_taps.begin(), d_taps.end());
// Make a set of taps at all possible arch alignments
- d_aligned_taps = (float**)malloc(d_naligned*sizeof(float**));
+ d_aligned_taps = (float**)malloc(d_naligned*sizeof(float*));
for(int i = 0; i < d_naligned; i++) {
d_aligned_taps[i] = fft::malloc_float(d_ntaps+d_naligned-1);
memset(d_aligned_taps[i], 0, sizeof(float)*(d_ntaps+d_naligned-1));
@@ -189,7 +189,7 @@ namespace gr {
std::reverse(d_taps.begin(), d_taps.end());
// Make a set of taps at all possible arch alignments
- d_aligned_taps = (float**)malloc(d_naligned*sizeof(float**));
+ d_aligned_taps = (float**)malloc(d_naligned*sizeof(float*));
for(int i = 0; i < d_naligned; i++) {
d_aligned_taps[i] = fft::malloc_float(d_ntaps+d_naligned-1);
memset(d_aligned_taps[i], 0, sizeof(float)*(d_ntaps+d_naligned-1));
@@ -305,7 +305,7 @@ namespace gr {
std::reverse(d_taps.begin(), d_taps.end());
// Make a set of taps at all possible arch alignments
- d_aligned_taps = (gr_complex**)malloc(d_naligned*sizeof(gr_complex**));
+ d_aligned_taps = (gr_complex**)malloc(d_naligned*sizeof(gr_complex*));
for(int i = 0; i < d_naligned; i++) {
d_aligned_taps[i] = fft::malloc_complex(d_ntaps+d_naligned-1);
memset(d_aligned_taps[i], 0, sizeof(gr_complex)*(d_ntaps+d_naligned-1));
@@ -421,7 +421,7 @@ namespace gr {
std::reverse(d_taps.begin(), d_taps.end());
// Make a set of taps at all possible arch alignments
- d_aligned_taps = (gr_complex**)malloc(d_naligned*sizeof(gr_complex**));
+ d_aligned_taps = (gr_complex**)malloc(d_naligned*sizeof(gr_complex*));
for(int i = 0; i < d_naligned; i++) {
d_aligned_taps[i] = fft::malloc_complex(d_ntaps+d_naligned-1);
memset(d_aligned_taps[i], 0, sizeof(gr_complex)*(d_ntaps+d_naligned-1));
@@ -535,7 +535,7 @@ namespace gr {
std::reverse(d_taps.begin(), d_taps.end());
// Make a set of taps at all possible arch alignments
- d_aligned_taps = (gr_complex**)malloc(d_naligned*sizeof(gr_complex**));
+ d_aligned_taps = (gr_complex**)malloc(d_naligned*sizeof(gr_complex*));
for(int i = 0; i < d_naligned; i++) {
d_aligned_taps[i] = fft::malloc_complex(d_ntaps+d_naligned-1);
memset(d_aligned_taps[i], 0, sizeof(gr_complex)*(d_ntaps+d_naligned-1));
@@ -650,7 +650,7 @@ namespace gr {
std::reverse(d_taps.begin(), d_taps.end());
// Make a set of taps at all possible arch alignments
- d_aligned_taps = (float**)malloc(d_naligned*sizeof(float**));
+ d_aligned_taps = (float**)malloc(d_naligned*sizeof(float*));
for(int i = 0; i < d_naligned; i++) {
d_aligned_taps[i] = fft::malloc_float(d_ntaps+d_naligned-1);
memset(d_aligned_taps[i], 0, sizeof(float)*(d_ntaps+d_naligned-1));
diff --git a/gr-filter/lib/fir_filter_with_buffer.cc b/gr-filter/lib/fir_filter_with_buffer.cc
index b6984e4f1f..9953d48dd5 100644
--- a/gr-filter/lib/fir_filter_with_buffer.cc
+++ b/gr-filter/lib/fir_filter_with_buffer.cc
@@ -100,7 +100,7 @@ namespace gr {
d_buffer = d_buffer_ptr + d_naligned;
// Allocate aligned taps
- d_aligned_taps = (float**)malloc(d_naligned*sizeof(float**));
+ d_aligned_taps = (float**)malloc(d_naligned*sizeof(float*));
for(int i = 0; i < d_naligned; i++) {
d_aligned_taps[i] = fft::malloc_float(d_ntaps+d_naligned-1);
memset(d_aligned_taps[i], 0, sizeof(float)*(d_ntaps+d_naligned-1));
@@ -253,7 +253,7 @@ namespace gr {
d_buffer = d_buffer_ptr + d_naligned;
// Allocate aligned taps
- d_aligned_taps = (gr_complex**)malloc(d_naligned*sizeof(gr_complex**));
+ d_aligned_taps = (gr_complex**)malloc(d_naligned*sizeof(gr_complex*));
for(int i = 0; i < d_naligned; i++) {
d_aligned_taps[i] = fft::malloc_complex(d_ntaps+d_naligned-1);
memset(d_aligned_taps[i], 0, sizeof(gr_complex)*(d_ntaps+d_naligned-1));
@@ -406,7 +406,7 @@ namespace gr {
d_buffer = d_buffer_ptr + d_naligned;
// Allocate aligned taps
- d_aligned_taps = (float**)malloc(d_naligned*sizeof(float**));
+ d_aligned_taps = (float**)malloc(d_naligned*sizeof(float*));
for(int i = 0; i < d_naligned; i++) {
d_aligned_taps[i] = fft::malloc_float(d_ntaps+d_naligned-1);
memset(d_aligned_taps[i], 0, sizeof(float)*(d_ntaps+d_naligned-1));
diff --git a/gr-filter/lib/qa_fir_filter_with_buffer.cc b/gr-filter/lib/qa_fir_filter_with_buffer.cc
index ffc9120115..92aca73554 100644
--- a/gr-filter/lib/qa_fir_filter_with_buffer.cc
+++ b/gr-filter/lib/qa_fir_filter_with_buffer.cc
@@ -376,7 +376,7 @@ namespace gr {
new kernel::fir_filter_with_buffer_ccf(f1_taps);
// zero the output, then do the filtering
- memset(actual_output, 0, sizeof(OUTPUT_LEN*sizeof(gr_complex)));
+ memset(actual_output, 0, OUTPUT_LEN*sizeof(gr_complex));
f1->filterNdec(actual_output, input, ol/decimate, decimate);
// check results