Created
February 22, 2013 19:21
-
-
Save n-west/5015884 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef INCLUDED_WATERMARKING_PHASEDITHER_CFC_H | |
#define INCLUDED_WATERMARKING_PHASEDITHER_CFC_H | |
#include <watermarking/api.h> | |
#include <gr_sync_block.h> | |
namespace gr { | |
namespace watermarking { | |
/*! | |
* \brief <+description of block+> | |
* \ingroup watermarking | |
* | |
*/ | |
class WATERMARKING_API phasedither_cfc : virtual public gr_sync_block | |
{ | |
public: | |
typedef boost::shared_ptr<phasedither_cfc> sptr; | |
/*! | |
* \brief Return a shared_ptr to a new instance of watermarking::phasedither_cfc. | |
* | |
* To avoid accidental use of raw pointers, watermarking::phasedither_cfc's | |
* constructor is in a private implementation | |
* class. watermarking::phasedither_cfc::make is the public interface for | |
* creating new instances. | |
*/ | |
static sptr make(float angle); | |
virtual float angle() const = 0; | |
}; | |
} // namespace watermarking | |
} // namespace gr | |
#endif /* INCLUDED_WATERMARKING_PHASEDITHER_CFC_H */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef HAVE_CONFIG_H | |
#include "config.h" | |
#endif | |
#include <gr_io_signature.h> | |
#include <gr_expj.h> | |
#include "phasedither_cfc_impl.h" | |
namespace gr { | |
namespace watermarking { | |
phasedither_cfc::sptr phasedither_cfc::make(float angle) | |
{ | |
return gnuradio::get_initial_sptr (new phasedither_cfc_impl(angle)); | |
} | |
/* | |
* The private constructor | |
*/ | |
phasedither_cfc_impl::phasedither_cfc_impl(float angle) | |
: gr_sync_block("phasedither_cfc", | |
gr_make_io_signature(1, 1, sizeof (gr_complex)), | |
gr_make_io_signature(1, 1, sizeof (gr_complex))), | |
d_angle(angle) | |
{} | |
/* | |
* Our virtual destructor. | |
*/ | |
phasedither_cfc_impl::~phasedither_cfc_impl() | |
{ | |
} | |
int | |
phasedither_cfc_impl::work(int noutput_items, | |
gr_vector_const_void_star &input_items, | |
gr_vector_void_star &output_items) | |
{ | |
const gr_complex *in = (const gr_complex *) input_items[0]; | |
gr_complex *out = (gr_complex *) output_items[0]; | |
for (int ii=0; ii < noutput_items; ii++) { | |
out[ii] = in[ii] * gr_expj(d_angle); | |
} | |
// Tell runtime system how many output items we produced. | |
return noutput_items; | |
} | |
} /* namespace watermarking */ | |
} /* namespace gr */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef INCLUDED_WATERMARKING_PHASEDITHER_CFC_IMPL_H | |
#define INCLUDED_WATERMARKING_PHASEDITHER_CFC_IMPL_H | |
#include <watermarking/phasedither_cfc.h> | |
namespace gr { | |
namespace watermarking { | |
class phasedither_cfc_impl : public phasedither_cfc | |
{ | |
private: | |
float d_angle; | |
// Nothing to declare in this block. | |
public: | |
phasedither_cfc_impl(float angle); | |
~phasedither_cfc_impl(); | |
float angle() const { return d_angle; } | |
void set_angle(float angle) { d_angle = angle; } | |
// Where all the action really happens | |
int work(int noutput_items, | |
gr_vector_const_void_star &input_items, | |
gr_vector_void_star &output_items); | |
}; | |
} // namespace watermarking | |
} // namespace gr | |
#endif /* INCLUDED_WATERMARKING_PHASEDITHER_CFC_IMPL_H */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment