Skip to content

@n-west /a_impl.cc
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
// construction
std::vector<int> get_in_size(void )
{
std::vector<int> input_sizes;
input_sizes.push_back(sizeof( gr_complex ));
input_sizes.push_back(sizeof( char ));
}
phase_watermark_cbc_impl::phase_watermark_cbc_impl(float angle)
: gr_sync_block("phase_watermark_cbc",
gr_make_io_signaturev(2, 2, get_in_size() ),
gr_make_io_signature(1, 1, sizeof (gr_complex))),
d_angle(angle)
{}
// Work
int
phase_watermark_cbc_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const gr_complex *in0 = reinterpret_cast<const gr_complex *>(input_items[0]);
const char *in1 = reinterpret_cast<const char *>(input_items[1]);
gr_complex *out = (gr_complex *) output_items[0];
/* Basically...
if in0 == foo
do x
else
do y
*/
for( int ii=0; ii < noutput_items; ii++)
{
if( in0[ii] == foo )
out[ii] = in1[ii] * gr_expj(d_angle);
else if( in0[ii] == bar )
out[ii] = in1[ii] * gr_expj(-d_angle);
else // This should never be, but put in for debuggin
out[ii] = in[ii] * (gr_complex) 1.1;
}
// Tell runtime system how many output items we produced.
return noutput_items;
}
def test_001_t (self):
angle = pi/4
input_complex = % some complex data
input_chars = % some bytes
expected_out = % what I expect
# set up fg
inputport0 = gr.vector_source_c(input_complex)
inputport1 = gr.vector_source_b(input_chars)
block_under_test = watermarking.a_cbc(angle)
dst = gr.vector_sink_c()
self.tb.connect(wm, (block_under_test, 0) )
self.tb.connect(rf, (block_under_test, 1) )
self.tb.connect((block_under_test), dst)
self.tb.run ()
# check data
result_data = dst.data()
self.assertComplexTuplesAlmostEqual(expected_out, result_data, 4)
*** glibc detected *** /usr/bin/python: free(): invalid pointer: 0x0a858ce0 ***
======= Backtrace: =========
/lib/i386-linux-gnu/libc.so.6(+0x73e42)[0x402f5e42]
/usr/lib/i386-linux-gnu/libstdc++.so.6(_ZdlPv+0x1f)[0x40ea651f]
/home/nathan/code/gr-watermarking/build/lib/libgnuradio-watermarking.so(+0x5198)[0x42f0a198]
/home/nathan/code/gr-watermarking/build/lib/libgnuradio-watermarking.so(_ZN2gr12watermarking19phase_watermark_cbc4makeEf+0x34)[0x42f0a1e4]
/home/nathan/code/gr-watermarking/build/swig/_watermarking_swig.so(+0x18b19)[0x41266b19]
/usr/bin/python(PyEval_EvalFrameEx+0x3ead)[0x808c7bd]
/usr/bin/python(PyEval_EvalCodeEx+0x150)[0x81a7d70]
/usr/bin/python(PyEval_EvalFrameEx+0x6cc)[0x8088fdc]
/usr/bin/python(PyEval_EvalFrameEx+0x7bc)[0x80890cc]
/usr/bin/python(PyEval_EvalCodeEx+0x150)[0x81a7d70]
/usr/bin/python[0x81a9e42]
/usr/bin/python(PyObject_Call+0x3f)[0x811101f]
/usr/bin/python(PyEval_EvalFrameEx+0x1fab)[0x808a8bb]
/usr/bin/python(PyEval_EvalCodeEx+0x150)[0x81a7d70]
/usr/bin/python[0x81a9cfe]
/usr/bin/python(PyObject_Call+0x3f)[0x811101f]
/usr/bin/python[0x80cc417]
/usr/bin/python(PyObject_Call+0x3f)[0x811101f]
/usr/bin/python[0x80cb1a6]
/usr/bin/python(PyObject_Call+0x3f)[0x811101f]
/usr/bin/python(PyEval_EvalFrameEx+0xab6)[0x80893c6]
/usr/bin/python(PyEval_EvalCodeEx+0x150)[0x81a7d70]
/usr/bin/python[0x81a9e42]
/usr/bin/python(PyObject_Call+0x3f)[0x811101f]
/usr/bin/python(PyEval_EvalFrameEx+0x1fab)[0x808a8bb]
/usr/bin/python(PyEval_EvalCodeEx+0x150)[0x81a7d70]
/usr/bin/python[0x81a9cfe]
/usr/bin/python(PyObject_Call+0x3f)[0x811101f]
/usr/bin/python[0x80cc417]
/usr/bin/python(PyObject_Call+0x3f)[0x811101f]
/usr/bin/python[0x80cb1a6]
/usr/bin/python(PyObject_Call+0x3f)[0x811101f]
/usr/bin/python(PyEval_EvalFrameEx+0xab6)[0x80893c6]
/usr/bin/python(PyEval_EvalFrameEx+0x7bc)[0x80890cc]
/usr/bin/python(PyEval_EvalCodeEx+0x150)[0x81a7d70]
/usr/bin/python(PyEval_EvalFrameEx+0x6cc)[0x8088fdc]
/usr/bin/python(PyEval_EvalCodeEx+0x150)[0x81a7d70]
/usr/bin/python(PyRun_SimpleFileExFlags+0x2c1)[0x8151e21]
/usr/bin/python(Py_Main+0x559)[0x815a4d9]
/usr/bin/python(main+0x1b)[0x805e78b]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x4029b4d3]
/usr/bin/python[0x805e7b1]
======= Memory map: ========
08048000-0829f000 r-xp 00000000 08:07 2198 /usr/bin/python2.7
0829f000-082a0000 r--p 00256000 08:07 2198 /usr/bin/python2.7
082a0000-082f5000 rw-p 00257000 08:07 2198 /usr/bin/python2.7
082f5000-08301000 rw-p 00000000 00:00 0
0a270000-0a906000 rw-p 00000000 00:00 0 [heap]
40000000-40020000 r-xp 00000000 08:07 525685 /lib/i386-linux-gnu/ld-2.15.so
40020000-40021000 r--p 0001f000 08:07 525685 /lib/i386-linux-gnu/ld-2.15.so
40021000-40022000 rw-p 00020000 08:07 525685 /lib/i386-linux-gnu/ld-2.15.so
40022000-40023000 r-xp 00000000 00:00 0 [vdso]
40023000-40025000 rw-p 00000000 00:00 0
40025000-40026000 r--p 002c5000 08:07 132259 /usr/lib/locale/locale-archive
40026000-40042000 r-xp 00000000 08:07 37374 /usr/lib/libboost_filesystem.so.1.48.0
40042000-40043000 r--p 0001c000 08:07 37374 /usr/lib/libboost_filesystem.so.1.48.0
40043000-40044000 rw-p 0001d000 08:07 37374 /usr/lib/libboost_filesystem.so.1.48.0
40044000-40045000 rwxp 00000000 00:00 0
40045000-40046000 rw-p 00000000 00:00 0
40046000-4005d000 r-xp 00000000 08:07 560793 /lib/i386-linux-gnu/libpthread-2.15.so
4005d000-4005e000 r--p 00016000 08:07 560793 /lib/i386-linux-gnu/libpthread-2.15.so
4005e000-4005f000 rw-p 00017000 08:07 560793 /lib/i386-linux-gnu/libpthread-2.15.so
4005f000-40061000 rw-p 00000000 00:00 0
40061000-40064000 r-xp 00000000 08:07 540692 /lib/i386-linux-gnu/libdl-2.15.so
40064000-40065000 r--p 00002000 08:07 540692 /lib/i386-linux-gnu/libdl-2.15.so
40065000-40066000 rw-p 00003000 08:07 540692 /lib/i386-linux-gnu/libdl-2.15.so
40066000-40067000 rw-p 00000000 00:00 0
40067000-40069000 r-xp 00000000 08:07 560798 /lib/i386-linux-gnu/libutil-2.15.so
40069000-4006a000 r--p 00001000 08:07 560798 /lib/i386-linux-gnu/libutil-2.15.so
4006a000-4006b000 rw-p 00002000 08:07 560798 /lib/i386-linux-gnu/libutil-2.15.so
4006b000-400ba000 r-xp 00000000 08:07 526444 /lib/i386-linux-gnu/libssl.so.1.0.0
400ba000-400bb000 ---p 0004f000 08:07 526444 /lib/i386-linux-gnu/libssl.so.1.0.0
400bb000-400bd000 r--p 0004f000 08:07 526444 /lib/i386-linux-gnu/libssl.so.1.0.0
400bd000-400c1000 rw-p 00051000 08:07 526444 /lib/i386-linux-gnu/libssl.so.1.0.0
400c1000-40253000 r-xp 00000000 08:07 526445 /lib/i386-linux-gnu/libcrypto.so.1.0.0
40253000-40262000 r--p 00192000 08:07 526445 /lib/i386-linux-gnu/libcrypto.so.1.0.0
40262000-40269000 rw-p 001a1000 08:07 526445 /lib/i386-linux-gnu/libcrypto.so.1.0.0
40269000-4026c000 rw-p 00000000 00:00 0
4026c000-40280000 r-xp 00000000 08:07 559487 /lib/i386-linux-gnu/libz.so.1.2.3.4
40280000-40281000 r--p 00013000 08:07 559487 /lib/i386-linux-gnu/libz.so.1.2.3.4
40281000-40282000 rw-p 00014000 08:07 559487 /lib/i386-linux-gnu/libz.so.1.2.3.4
40282000-40421000 r-xp 00000000 08:07 525983 /lib/i386-linux-gnu/libc-2.15.so
40421000-40423000 r--p 0019f000 08:07 525983 /lib/i386-linux-gnu/libc-2.15.so
40423000-40424000 rw-p 001a1000 08:07 525983 /lib/i386-linux-gnu/libc-2.15.so
40424000-40428000 rw-p 00000000 00:00 0
40428000-40444000 r-xp 00000000 08:07 526050 /lib/i386-linux-gnu/libgcc_s.so.1
40444000-40445000 r--p 0001b000 08:07 526050 /lib/i386-linux-gnu/libgcc_s.so.1
40445000-40446000 rw-p 0001c000 08:07 526050 /lib/i386-linux-gnu/libgcc_s.so.1
40446000-40470000 r-xp 00000000 08:07 540693 /lib/i386-linux-gnu/libm-2.15.so
40470000-40471000 r--p 00029000 08:07 540693 /lib/i386-linux-gnu/libm-2.15.so
40471000-40472000 rw-p 0002a000 08:07 540693 /lib/i386-linux-gnu/libm-2.15.so
40472000-40537000 rw-p 00000000 00:00 0
40537000-40737000 r--p 00000000 08:07 132259 /usr/lib/locale/locale-archive
40737000-40754000 r-xp 00000000 08:07 1838223 /usr/local/lib/python2.7/dist-packages/gnuradio/gr/_gnuradio_core_hier.so
40754000-40755000 r--p 0001c000 08:07 1838223 /usr/local/lib/python2.7/dist-packages/gnuradio/gr/_gnuradio_core_hier.so
40755000-40757000 rw-p 0001d000 08:07 1838223 /usr/local/lib/python2.7/dist-packages/gnuradio/gr/_gnuradio_core_hier.so
40758000-4075a000 r-xp 00000000 08:07 37353 /usr/lib/libboost_system.so.1.48.0
4075a000-4075b000 r--p 00002000 08:07 37353 /usr/lib/libboost_system.so.1.48.0
4075b000-4075c000 rw-p 00003000 08:07 37353 /usr/lib/libboost_system.so.1.48.0
4075c000-40761000 r-xp 00000000 08:07 5962 /usr/lib/libfftw3f_threads.so.3.3.0
40761000-40762000 r--p 00005000 08:07 5962 /usr/lib/libfftw3f_threads.so.3.3.0
40762000-40763000 rw-p 00006000 08:07 5962 /usr/lib/libfftw3f_threads.so.3.3.0
40763000-4076a000 r-xp 00000000 08:07 560795 /lib/i386-linux-gnu/librt-2.15.so
4076a000-4076b000 r--p 00006000 08:07 560795 /lib/i386-linux-gnu/librt-2.15.so
4076b000-4076c000 rw-p 00007000 08:07 560795 /lib/i386-linux-gnu/librt-2.15.so
4076d000-407ae000 rw-p 00000000 00:00 0
407ae000-40884000 r-xp 00000000 08:07 1838203 /usr/local/lib/python2.7/dist-packages/gnuradio/gr/_gnuradio_core_runtime.so
40884000-40885000 r--p 000d5000 08:07 1838203 /usr/local/lib/python2.7/dist-packages/gnuradio/gr/_gnuradio_core_runtime.so
40885000-40889000 rw-p 000d6000 08:07 1838203 /usr/local/lib/python2.7/dist-packages/gnuradio/gr/_gnuradio_core_runtime.so
40889000-4088a000 rw-p 00000000 00:00 0
4088a000-40aed000 r-xp 00000000 08:07 4100 /usr/lib/libpython2.7.so.1.0
40aed000-40aee000 ---p 00263000 08:07 4100 /usr/lib/libpython2.7.so.1.0
40aee000-40aef000 r--p 00263000 08:07 4100 /usr/lib/libpython2.7.so.1.0
40aef000-40b44000 rw-p 00264000 08:07 4100 /usr/lib/libpython2.7.so.1.0
40b44000-40b50000 rw-p 00000000 00:00 0
40b50000-40daa000 r-xp 00000000 08:07 44686 /usr/local/lib/libgnuradio-core-3.6.4git.so.0.0.0
40daa000-40db7000 r--p 00259000 08:07 44686 /usr/local/lib/libgnuradio-core-3.6.4git.so.0.0.0
40db7000-40db9000 rw-p 00266000 08:07 44686 /usr/local/lib/libgnuradio-core-3.6.4git.so.0.0.0
40db9000-40dba000 rw-p 00000000 00:00 0
40dba000-40dfa000 r-xp 00000000 08:07 37705 /usr/local/lib/libgruel-3.6.4git.so.0.0.0
40dfa000-40dfc000 r--p 00040000 08:07 37705 /usr/local/lib/libgruel-3.6.4git.so.0.0.0
40dfc000-40dfd000 rw-p 00042000 08:07 37705 /usr/local/lib/libgruel-3.6.4git.so.0.0.0
40dfd000-40ed5000 r-xp 00000000 08:07 525679 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16
40ed5000-40ed6000 ---p 000d8000 08:07 525679 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16
40ed6000-40eda000 r--p 000d8000 08:07 525679 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16
40eda000-40edb000 rw-p 000dc000 08:07 525679 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16
40edb000-40ee2000 rw-p 00000000 00:00 0
40ee2000-40ef9000 r-xp 00000000 08:07 37416 /usr/lib/libboost_thread.so.1.48.0
40ef9000-40efa000 r--p 00016000 08:07 37416 /usr/lib/libboost_thread.so.1.48.0
40efa000-40efb000 rw-p 00017000 08:07 37416 /usr/lib/libboost_thread.so.1.48.0
40efb000-41041000 r-xp 00000000 08:07 5960 /usr/lib/libfftw3f.so.3.3.0
41041000-41049000 r--p 00146000 08:07 5960 /usr/lib/libfftw3f.so.3.3.0
41049000-4104a000 rw-p 0014e000 08:07 5960 /usr/lib/libfftw3f.so.3.3.0
4104a000-410f2000 r-xp 00000000 08:07 37686 /usr/local/lib/libvolk.so.0.0.0
410f2000-410f3000 r--p 000a7000 08:07 37686 /usr/local/lib/libvolk.so.0.0.0
410f3000-41127000 rw-p 000a8000 08:07 37686 /usr/local/lib/libvolk.so.0.0.0
41127000-4122b000 rw-p 00000000 00:00 0
4122b000-41246000 r-xp 00000000 08:07 1715130 /usr/lib/python2.7/lib-dynload/_ctypes.so
41246000-4124b000 r--p 0001a000 08:07 1715130 /usr/lib/python2.7/lib-dynload/_ctypes.so
4124b000-4124e000 rw-p 0001f000 08:07 1715130 /usr/lib/python2.7/lib-dynload/_ctypes.so
4124e000-41283000 r-xp 00000000 08:07 1349231 /home/nathan/code/gr-watermarking/build/swig/_watermarking_swig.so
41283000-41284000 r--p 00034000 08:07 1349231 /home/nathan/code/gr-watermarking/build/swig/_watermarking_swig.so
41284000-41286000 rw-p 00035000 08:07 1349231 /home/nathan/code/gr-watermarking/build/swig/_watermarking_swig.so
4128c000-41494000 rw-p 00000000 00:00 0
41494000-41ac7000 r-xp 00000000 08:07 1838207 /usr/local/lib/python2.7/dist-packages/gnuradio/gr/_gnuradio_core_general.so
41ac7000-41ac9000 r--p 00632000 08:07 1838207 /usr/local/lib/python2.7/dist-packages/gnuradio/gr/_gnuradio_core_general.so
41ac9000-41ae6000 rw-p 00634000 08:07 1838207 /usr/local/lib/python2.7/dist-packages/gnuradio/gr/_gnuradio_core_general.so
41ae6000-41d91000 rw-p 00000000 00:00 0
41d91000-422fe000 r-xp 00000000 08:07 1838211 /usr/local/lib/python2.7/dist-packages/gnuradio/gr/_gnuradio_core_gengen.so
422fe000-42300000 r--p 0056c000 08:07 1838211 /usr/local/lib/python2.7/dist-packages/gnuradio/gr/_gnuradio_core_gengen.so
42300000-4231a000 rw-p 0056e000 08:07 1838211 /usr/local/lib/python2.7/dist-packages/gnuradio/gr/_gnuradio_core_gengen.so
4231a000-423de000 rw-p 00000000 00:00 0
423de000-42630000 r-xp 00000000 08:07 1838215 /usr/local/lib/python2.7/dist-packages/gnuradio/gr/_gnuradio_core_filter.so
42630000-42631000 r--p 00252000 08:07 1838215 /usr/local/lib/python2.7/dist-packages/gnuradio/gr/_gnuradio_core_filter.so
42631000-4263c000 rw-p 00253000 08:07 1838215 /usr/local/lib/python2.7/dist-packages/gnuradio/gr/_gnuradio_core_filter.so
4263c000-426bf000 rw-p 00000000 00:00 0
426bf000-427c4000 r-xp 00000000 08:07 1838219 /usr/local/lib/python2.7/dist-packages/gnuradio/gr/_gnuradio_core_io.so
427c4000-427c5000 r--p 00104000 08:07 1838219 /usr/local/lib/python2.7/dist-packages/gnuradio/gr/_gnuradio_core_io.so
427c5000-427cb000 rw-p 00105000 08:07 1838219 /usr/local/lib/python2.7/dist-packages/gnuradio/gr/_gnuradio_core_io.so
427cb000-4280d000 rw-p 00000000 00:00 0
4280d000-4285e000 r-xp 00000000 08:07 1838190 /usr/local/lib/python2.7/dist-packages/gruel/pmt/_pmt_swig.so
4285e000-4285f000 r--p 00050000 08:07 1838190 /usr/local/lib/python2.7/dist-packages/gruel/pmt/_pmt_swig.so
4285f000-42861000 rw-p 00051000 08:07 1838190 /usr/local/lib/python2.7/dist-packages/gruel/pmt/_pmt_swig.so
42861000-42965000 r-xp 00000000 08:07 1710705 /usr/lib/python2.7/dist-packages/numpy/core/multiarray.so
42965000-42966000 r--p 00104000 08:07 1710705 /usr/lib/python2.7/dist-packages/numpy/core/multiarray.so
42966000-4296d000 rw-p 00105000 08:07 1710705 /usr/lib/python2.7/dist-packages/numpy/core/multiarray.so
4296d000-4296e000 rw-p 00000000 00:00 0
4296e000-429c3000 r-xp 00000000 08:07 1710711 /usr/lib/python2.7/dist-packages/numpy/core/umath.so
429c3000-429c4000 r--p 00054000 08:07 1710711 /usr/lib/python2.7/dist-packages/numpy/core/umath.so
429c4000-429c7000 rw-p 00055000 08:07 1710711 /usr/lib/python2.7/dist-packages/numpy/core/umath.so
429c7000-42a09000 rw-p 00000000 00:00 0
42a09000-42a24000 r-xp 00000000 08:07 1710703 /usr/lib/python2.7/dist-packages/numpy/core/_sort.so
42a24000-42a25000 r--p 0001a000 08:07 1710703 /usr/lib/python2.7/dist-packages/numpy/core/_sort.so
42a25000-42a26000 rw-p 0001b000 08:07 1710703 /usr/lib/python2.7/dist-packages/numpy/core/_sort.so
42a26000-42a2b000 r-xp 00000000 08:07 1710699 /usr/lib/python2.7/dist-packages/numpy/core/_dotblas.so
42a2b000-42a2c000 r--p 00004000 08:07 1710699 /usr/lib/python2.7/dist-packages/numpy/core/_dotblas.so
42a2c000-42a2d000 rw-p 00005000 08:07 1710699 /usr/lib/python2.7/dist-packages/numpy/core/_dotblas.so
42a2d000-42a30000 r-xp 00000000 08:07 1715091 /usr/lib/python2.7/lib-dynload/_heapq.so
42a30000-42a31000 r--p 00002000 08:07 1715091 /usr/lib/python2.7/lib-dynload/_heapq.so
42a31000-42a33000 rw-p 00003000 08:07 1715091 /usr/lib/python2.7/lib-dynload/_heapq.so
42a33000-42a38000 r-xp 00000000 08:07 1710849 /usr/lib/python2.7/dist-packages/numpy/lib/_compiled_base.so
42a38000-42a39000 r--p 00004000 08:07 1710849 /usr/lib/python2.7/dist-packages/numpy/lib/_compiled_base.so
42a39000-42a3a000 rw-p 00005000 08:07 1710849 /usr/lib/python2.7/dist-packages/numpy/lib/_compiled_base.so
42a3a000-42a3f000 r-xp 00000000 08:07 1712331 /usr/lib/python2.7/dist-packages/numpy/linalg/lapack_lite.so
42a3f000-42a40000 r--p 00004000 08:07 1712331 /usr/lib/python2.7/dist-packages/numpy/linalg/lapack_lite.so
42a40000-42a41000 rw-p 00005000 08:07 1712331 /usr/lib/python2.7/dist-packages/numpy/linalg/lapack_lite.so
42a41000-42a4a000 r-xp 00000000 08:07 1710843 /usr/lib/python2.7/dist-packages/numpy/fft/fftpack_lite.so
42a4a000-42a4b000 r--p 00008000 08:07 1710843 /usr/lib/python2.7/dist-packages/numpy/fft/fftpack_lite.so
42a4b000-42a4c000 rw-p 00009000 08:07 1710843 /usr/lib/python2.7/dist-packages/numpy/fft/fftpack_lite.so
42a4e000-42d1f000 r-xp 00000000 08:07 1207373 /usr/lib/atlas-base/atlas/libblas.so.3gf.04/4 Test #4: qa_phase_watermark_cbc ...........***Failed 0.47 sec
75% tests passed, 1 tests failed out of 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.