fun_ofdm  1.0
802.11a Physical Layer for USRP
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
fun::puncturer Class Reference

The puncturer class. More...

#include <puncturer.h>

Static Public Member Functions

static std::vector< unsigned char > puncture (std::vector< unsigned char > data, RateParams rate_params)
 Punctures the convolutionally encoded data to get it to the desired coding rate. More...
 
static std::vector< unsigned char > depuncture (std::vector< unsigned char > data, RateParams rate_params)
 depunctures the data by inserting 0's in the "puncture holes" More...
 

Detailed Description

The puncturer class.

The puncturer class punctures the convolutionally encoded data to effectively increase the coding rate. On the receive side it depunctures the received punctured data by inserting 0's into the "puncture holes".

Definition at line 26 of file puncturer.h.

Member Function Documentation

std::vector< unsigned char > fun::puncturer::depuncture ( std::vector< unsigned char >  data,
RateParams  rate_params 
)
static

depunctures the data by inserting 0's in the "puncture holes"

Parameters
dataVector of the punctured data to be depunctured.
rate_paramsThe parameters for the PHY Rate from which the coding rate is extracted.
Returns
Vector of the depunctured data.

Depunctures the punctured data by inserting 0's into the "puncture holes" based on the PHY rate in rate_params. Supported Rates:

  • 1/2
  • 2/3
  • 3/4

Definition at line 78 of file puncturer.cpp.

References fun::RateParams::rate, fun::RATE_1_2_BPSK, fun::RATE_1_2_QAM16, fun::RATE_1_2_QPSK, fun::RATE_2_3_BPSK, fun::RATE_2_3_QAM16, fun::RATE_2_3_QAM64, fun::RATE_2_3_QPSK, fun::RATE_3_4_BPSK, fun::RATE_3_4_QAM16, fun::RATE_3_4_QAM64, fun::RATE_3_4_QPSK, and fun::RateParams::rel_rate.

Referenced by fun::ppdu::decode_data().

79  {
80  int sym_buffer_index = 0;
81  int psc = 0;
82  switch(rate_params.rate)
83  {
84  // Nothing to do
86  return data;
87  break;
88 
89  // De-puncture from 3/4 to 1/2 coding rate
91  {
92  psc = round(data.size() / rate_params.rel_rate);
93  std::vector<unsigned char> sym_buffer34(psc);
94  for(int x = 0; x < data.size(); x += 4)
95  {
96  sym_buffer34[sym_buffer_index++] = data[x + 0];
97  sym_buffer34[sym_buffer_index++] = data[x + 1];
98  sym_buffer34[sym_buffer_index++] = 127;
99  sym_buffer34[sym_buffer_index++] = data[x + 2];
100  sym_buffer34[sym_buffer_index++] = 127;
101  sym_buffer34[sym_buffer_index++] = data[x + 3];
102  }
103  return sym_buffer34;
104  break;
105  }
106 
107  // De-ouncture from 2/3 to 1/2 coding rate
109  {
110  psc = round(data.size() / rate_params.rel_rate);
111  std::vector<unsigned char> sym_buffer23(psc);
112  for(int x = 0; x < data.size(); x += 3)
113  {
114  sym_buffer23[sym_buffer_index++] = data[x + 0];
115  sym_buffer23[sym_buffer_index++] = 127;
116  sym_buffer23[sym_buffer_index++] = data[x + 1];
117  sym_buffer23[sym_buffer_index++] = data[x + 2];
118  }
119  return sym_buffer23;
120  break;
121  }
122  }
123  }
std::vector< unsigned char > fun::puncturer::puncture ( std::vector< unsigned char >  data,
RateParams  rate_params 
)
static

Punctures the convolutionally encoded data to get it to the desired coding rate.

Parameters
dataVector of the convolutionally encoded data to be punctured.
rate_paramsThe parameters for the PHY Rate from which the coding rate is extracted.
Returns
Vector of the punctured data.

Punctures the convolutionally encoded data based on the desired PHY rate in rate_params. Suported Rates:

  • 1/2
  • 2/3
  • 3/4

Definition at line 24 of file puncturer.cpp.

References fun::RateParams::rate, fun::RATE_1_2_BPSK, fun::RATE_1_2_QAM16, fun::RATE_1_2_QPSK, fun::RATE_2_3_BPSK, fun::RATE_2_3_QAM16, fun::RATE_2_3_QAM64, fun::RATE_2_3_QPSK, fun::RATE_3_4_BPSK, fun::RATE_3_4_QAM16, fun::RATE_3_4_QAM64, fun::RATE_3_4_QPSK, and fun::RateParams::rel_rate.

Referenced by fun::ppdu::encode_data().

25  {
26  // Puncture the data
27  int count, index;
28  switch(rate_params.rate)
29  {
30  // Nothing to do
32  return data;
33  break;
34 
35  // Puncture from 1/2 to 3/4
37  {
38  count = round(data.size() * rate_params.rel_rate);
39  std::vector<unsigned char> punc_buff_34(count);
40  index = 0;
41  for(int x = 0; x < data.size(); x += 6)
42  {
43  punc_buff_34[index++] = data[x + 0];
44  punc_buff_34[index++] = data[x + 1];
45  punc_buff_34[index++] = data[x + 3];
46  punc_buff_34[index++] = data[x + 5];
47  }
48  return punc_buff_34;
49  }
50  break;
51 
52  // Puncture from 1/2 to 2/3
54  {
55  count = round(data.size() * rate_params.rel_rate);
56  std::vector<unsigned char> punc_buff_23(count);
57  index = 0;
58  for(int x = 0; x < data.size(); x += 4)
59  {
60  punc_buff_23[index++] = data[x + 0];
61  punc_buff_23[index++] = data[x + 2];
62  punc_buff_23[index++] = data[x + 3];
63  }
64  return punc_buff_23;
65  }
66  break;
67  }
68  }

The documentation for this class was generated from the following files: