discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] Does OFDM Carrier Allocator add input tags to sync wo


From: Jeon
Subject: [Discuss-gnuradio] Does OFDM Carrier Allocator add input tags to sync word?
Date: Mon, 19 Dec 2016 17:33:26 +0900

I am modifying OFDM Carrier Allocator block for my project.

I put the source code below and also in the link: https://gist.github.com/gsongsong/c78dfe2de979aa9a7f61e36f0eee5ba6#file-gistfile1-txt-L26-L37

    int
    ofdm_carrier_allocator_cvc_impl::work (int noutput_items,
                       gr_vector_int &ninput_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];
      std::vector<tag_t> tags;

      memset((void *) out, 0x00, sizeof(gr_complex) * d_fft_len * noutput_items);
      // Copy Sync word
      for (unsigned i = 0; i < d_sync_words.size(); i++) {
    memcpy((void *) out, (void *) &d_sync_words[i][0], sizeof(gr_complex) * d_fft_len);
    out += d_fft_len;
      }

      // Copy data symbols
      long n_ofdm_symbols = 0; // Number of output items
      int curr_set = 0;
      int symbols_to_allocate = d_occupied_carriers[0].size();
      int symbols_allocated = 0;
      for (int i = 0; i < ninput_items[0]; i++) {
    if (symbols_allocated == 0) {
      // Copy all tags associated with these input symbols onto this OFDM symbol
      get_tags_in_range(tags, 0,
          nitems_read(0)+i,
          nitems_read(0)+std::min(i+symbols_to_allocate, (int) ninput_items[0])
      );
      for (unsigned t = 0; t < tags.size(); t++) {
        add_item_tag(
        0,
        nitems_written(0) + n_ofdm_symbols + (n_ofdm_symbols == 0 ? 0 : d_sync_words.size()),
        tags[t].key,
        tags[t].value
        );
      }
      n_ofdm_symbols++;
}

In short: input tags are put into the position `k = nitems_written(0) + n_ofdm_symbols + (n_ofdm_symbols == 0 ? 0 : d_sync_words.size())`

As I understand, at first run (n_ofdm_symbols = 0), it reads `n = symbols_to_allocate` tags from input and puts it into `k = nitems_written(0)`, which is the starting position of sync word. At second run (n_ofdm_symbols = 1), it reads tags again, and puts it into `k = nitems_written(0) + 1 + d_sync_words.size()`. Hence, the first group and the second group of tags are apart by offset `d_sync_words.size()`

Is it my understanding of source code correct? If so, I wonder whether there is a reason for placing the first group of tags onto sync word, not onto the first data ofdm symbol. If I miss something in interpreting the code, please let me know it.

Regards,
Jeon.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]