Advertisement
Guest User

Untitled

a guest
May 29th, 2014
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. /* -*- c++ -*- */
  2. /*
  3. * Copyright 2014 <+YOU OR YOUR COMPANY+>.
  4. *
  5. * This is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3, or (at your option)
  8. * any later version.
  9. *
  10. * This software is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this software; see the file COPYING. If not, write to
  17. * the Free Software Foundation, Inc., 51 Franklin Street,
  18. * Boston, MA 02110-1301, USA.
  19. */
  20.  
  21. #ifdef HAVE_CONFIG_H
  22. #include "config.h"
  23. #endif
  24.  
  25. #include <gnuradio/io_signature.h>
  26. #include "al_enc_impl.h"
  27. #include <stdexcept>
  28. #include <iostream>
  29. #include <string.h>
  30. #include <cstdio>
  31.  
  32. namespace gr {
  33. namespace alamouti {
  34.  
  35. al_enc::sptr
  36. al_enc::make(int fft_length)
  37. {
  38. return gnuradio::get_initial_sptr
  39. (new al_enc_impl(fft_length));
  40. }
  41.  
  42. /*
  43. * The private constructor
  44. */
  45. al_enc_impl::al_enc_impl(int fft_length)
  46. : gr::sync_block("al_enc",
  47. gr::io_signature::make(1, 1, sizeof(gr_complex)),
  48. gr::io_signature::make(2, 2, sizeof(gr_complex))),d_fft_length(fft_length)
  49. {gr::block::set_output_multiple(fft_length);}
  50.  
  51. /*
  52. * Our virtual destructor.
  53. */
  54. al_enc_impl::~al_enc_impl()
  55. {
  56. }
  57.  
  58. int
  59. al_enc_impl::work(int noutput_items,
  60. gr_vector_const_void_star &input_items,
  61. gr_vector_void_star &output_items)
  62. {
  63. const gr_complex *in = (const gr_complex *) input_items[0];
  64. gr_complex *out_sym0 = (gr_complex *) output_items[0];
  65. gr_complex *out_sym1 = (gr_complex *) output_items[1];
  66.  
  67. std::cout<<noutput_items<<std::endl;
  68. // Do <+signal processing+>
  69. //SFBC
  70.  
  71. int i = 0;
  72.  
  73. while ( i < noutput_items ) {
  74.  
  75.  
  76. out_sym0[i] = in[i];
  77. out_sym0[i+1] = -(conj( in[i+1] ));
  78.  
  79. out_sym1[i] = in[i+1];
  80. out_sym1[i+1] = conj( in[i] );
  81.  
  82. i+=2;
  83.  
  84.  
  85. }
  86.  
  87.  
  88. return noutput_items;
  89. }
  90.  
  91. } /* namespace alamouti */
  92. } /* namespace gr */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement