[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 02/11: fec: TPC now runs happily, encoder p
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 02/11: fec: TPC now runs happily, encoder produces uint8_t instead of float, decoder GRC def now fixed |
Date: |
Sun, 5 Apr 2015 23:58:07 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 23a74ee910ab19f6230057455b0dd5621227d9a0
Author: Tim O'Shea <address@hidden>
Date: Sun Apr 5 13:10:36 2015 -0700
fec: TPC now runs happily, encoder produces uint8_t instead of float,
decoder GRC def now fixed
---
gr-fec/grc/tpc_decoder_def_list.xml | 13 ++++++----
gr-fec/grc/tpc_encoder_def_list.xml | 1 -
gr-fec/include/gnuradio/fec/tpc_encoder.h | 12 ++++-----
gr-fec/lib/tpc_decoder.cc | 2 +-
gr-fec/lib/tpc_encoder.cc | 41 +++++++++++++------------------
5 files changed, 32 insertions(+), 37 deletions(-)
diff --git a/gr-fec/grc/tpc_decoder_def_list.xml
b/gr-fec/grc/tpc_decoder_def_list.xml
index 3c92c63..aac08db 100644
--- a/gr-fec/grc/tpc_decoder_def_list.xml
+++ b/gr-fec/grc/tpc_decoder_def_list.xml
@@ -23,19 +23,22 @@ self.$(id) = $(id) = map( (lambda b: map( ( lambda a:
fec.tpc_decoder_make($row_
</param>
<param>
- <name>Threading Dimensions</name>
+ <name>Parallelism</name>
<key>ndim</key>
- <value></value>
+ <value>0</value>
<type>enum</type>
<option>
- <name>2</name>
- <key>2</key>
+ <name>0</name>
+ <key>0</key>
</option>
<option>
<name>1</name>
<key>1</key>
</option>
-
+ <option>
+ <name>2</name>
+ <key>2</key>
+ </option>
</param>
<param>
diff --git a/gr-fec/grc/tpc_encoder_def_list.xml
b/gr-fec/grc/tpc_encoder_def_list.xml
index 0346d40..c035795 100755
--- a/gr-fec/grc/tpc_encoder_def_list.xml
+++ b/gr-fec/grc/tpc_encoder_def_list.xml
@@ -39,7 +39,6 @@ self.$(id) = $(id) = map( (lambda b: map( ( lambda a:
fec.tpc_encoder_make($row_
<name>2</name>
<key>2</key>
</option>
-
</param>
<param>
diff --git a/gr-fec/include/gnuradio/fec/tpc_encoder.h
b/gr-fec/include/gnuradio/fec/tpc_encoder.h
index 4a14a8b..5d8f6b2 100755
--- a/gr-fec/include/gnuradio/fec/tpc_encoder.h
+++ b/gr-fec/include/gnuradio/fec/tpc_encoder.h
@@ -54,18 +54,18 @@ class FEC_API tpc_encoder : public generic_encoder {
int inputSizeWithPad;
std::vector<unsigned char> inputWithPad;
- std::vector< std::vector<float> > rowEncodedBits;
+ std::vector< std::vector<uint8_t> > rowEncodedBits;
std::vector<unsigned char> rowToEncode;
int numRowsToEncode;
- std::vector<float> rowEncoded_block;
+ std::vector<uint8_t> rowEncoded_block;
- std::vector< std::vector<float> > colEncodedBits;
+ std::vector< std::vector<uint8_t> > colEncodedBits;
std::vector<unsigned char> colToEncode;
int numColsToEncode;
- std::vector<float> colEncoded_block;
+ std::vector<uint8_t> colEncoded_block;
- void block_conv_encode( std::vector<float> &output,
- std::vector<unsigned char> input,
+ void block_conv_encode( std::vector<uint8_t> &output,
+ std::vector<uint8_t> input,
std::vector< std::vector<int> > transOutputVec,
std::vector< std::vector<int> >
transNextStateVec,
std::vector<int> tail,
diff --git a/gr-fec/lib/tpc_decoder.cc b/gr-fec/lib/tpc_decoder.cc
index 332bd9b..f930c2c 100644
--- a/gr-fec/lib/tpc_decoder.cc
+++ b/gr-fec/lib/tpc_decoder.cc
@@ -49,7 +49,7 @@ tpc_decoder::tpc_decoder (std::vector<int> row_polys,
std::vector<int> col_polys
outputSize = (d_krow*d_kcol - (d_bval+d_qval));
//DEBUG_PRINT("inputSize=%d outputSize=%d\n", inputSize, outputSize);
- fp = fopen("c_decoder_output.txt", "w");
+ //fp = fopen("c_decoder_output.txt", "w");
rowNumStates = 1 << (rowEncoder_m); // 2^(row_mm)
colNumStates = 1 << (colEncoder_m); // 2^(col_mm)
diff --git a/gr-fec/lib/tpc_encoder.cc b/gr-fec/lib/tpc_encoder.cc
index 9404654..90e4b87 100755
--- a/gr-fec/lib/tpc_encoder.cc
+++ b/gr-fec/lib/tpc_encoder.cc
@@ -47,7 +47,7 @@ tpc_encoder::tpc_encoder (std::vector<int> row_polys,
std::vector<int> col_polys
outputSize =
((d_krow+rowEncoder_m)*rowEncoder_n)*((d_kcol+colEncoder_m)*colEncoder_n) -
d_bval;
//DEBUG_PRINT("inputSize=%d outputSize=%d\n", inputSize, outputSize);
- fp = fopen("c_encoder_output.txt", "w");
+ //fp = fopen("c_encoder_output.txt", "w");
// resize internal matrices
rowNumStates = 1 << (rowEncoder_K-1); // 2^(row_mm)
@@ -80,12 +80,12 @@ tpc_encoder::tpc_encoder (std::vector<int> row_polys,
std::vector<int> col_polys
numRowsToEncode = inputSizeWithPad/d_krow; // this should be OK w/
integer division -- TODO: check this?
rowToEncode.resize(d_krow,0);
rowEncoded_block.resize(d_krow+(rowEncoder_m*rowEncoder_n), 0);
- rowEncodedBits.resize(d_kcol,
std::vector<float>(rowEncoder_m*rowEncoder_n,0) );
+ rowEncodedBits.resize(d_kcol,
std::vector<uint8_t>(rowEncoder_m*rowEncoder_n,0) );
numColsToEncode = d_krow+(rowEncoder_m*rowEncoder_n);
colToEncode.resize(d_kcol,0);
colEncoded_block.resize(d_kcol+(colEncoder_m*colEncoder_n), 0);
- colEncodedBits.resize(d_krow+(rowEncoder_m*rowEncoder_n),
std::vector<float>(colEncoder_m*colEncoder_n,0) );
+ colEncodedBits.resize(d_krow+(rowEncoder_m*rowEncoder_n),
std::vector<uint8_t>(colEncoder_m*colEncoder_n,0) );
}
int tpc_encoder::get_output_size() {
@@ -96,8 +96,8 @@ int tpc_encoder::get_input_size() {
return inputSize;
}
-void tpc_encoder::block_conv_encode( std::vector<float> &output,
- std::vector<unsigned char> input,
+void tpc_encoder::block_conv_encode( std::vector<uint8_t> &output,
+ std::vector<uint8_t> input,
std::vector< std::vector<int> > transOutputVec,
std::vector< std::vector<int> >
transNextStateVec,
std::vector<int> tail,
@@ -123,7 +123,7 @@ void tpc_encoder::block_conv_encode( std::vector<float>
&output,
// Assign to output : TODO: investigate using memcpy for this?
for (jj=0;jj<nn;jj++) {
- output[nn*ii+jj] = (float) binVec[jj];
+ output[nn*ii+jj] = binVec[jj];
}
}
@@ -140,17 +140,16 @@ void tpc_encoder::block_conv_encode( std::vector<float>
&output,
// Assign to output : TODO: investigate using memcpy for this?
for (jj=0;jj<nn;jj++) {
- output[nn*ii+jj] = (float) binVec[jj];
+ output[nn*ii+jj] = binVec[jj];
}
}
}
void tpc_encoder::generic_work(void *inBuffer, void *outBuffer) {
- const unsigned char *in = (const unsigned char *) inBuffer;
- float *out = (float *) outBuffer;
+ const uint8_t *in = (const uint8_t *) inBuffer;
+ uint8_t *out = (uint8_t *) outBuffer;
int ii, jj; // indexing var
- int tmp;
//DEBUG_PRINT_UCHAR_ARRAY(in, inputSize);
@@ -182,13 +181,12 @@ void tpc_encoder::generic_work(void *inBuffer, void
*outBuffer) {
rowEncoder_n);
//DEBUG_PRINT("Row Encoded Block=[%d] -->\n",ii);
- tmp = rowEncoded_block.size();
//DEBUG_PRINT_FLOAT_ARRAY_AS_UCHAR(&rowEncoded_block[0], tmp);
//DEBUG_PRINT_F(fp, "Row Encoded Block=[%d] -->\n",ii);
//DEBUG_PRINT_FLOAT_ARRAY_AS_UCHAR_F(fp, &rowEncoded_block[0], tmp);
// store only the encoded bits, b/c we read out the data in a special
way
- memcpy(&rowEncodedBits[ii][0], &rowEncoded_block[d_krow],
sizeof(float)*(rowEncoder_m*rowEncoder_n));
+ memcpy(&rowEncodedBits[ii][0], &rowEncoded_block[d_krow],
sizeof(uint8_t)*(rowEncoder_m*rowEncoder_n));
// DEBUG_PRINT("Row Encoded Bits");
// tmp = rowEncoder_m*rowEncoder_n;
@@ -219,13 +217,12 @@ void tpc_encoder::generic_work(void *inBuffer, void
*outBuffer) {
colEncoder_n);
//DEBUG_PRINT("Col Encoded Block=[%d] -->\n",ii);
- tmp = colEncoded_block.size();
//DEBUG_PRINT_FLOAT_ARRAY_AS_UCHAR(&colEncoded_block[0], tmp);
//DEBUG_PRINT_F(fp, "Col Encoded Block=[%d] -->\n",ii);
//DEBUG_PRINT_FLOAT_ARRAY_AS_UCHAR_F(fp, &colEncoded_block[0], tmp);
// store only the encoded bits, b/c we read the data out in a special
way
- memcpy(&colEncodedBits[ii][0], &colEncoded_block[d_kcol],
sizeof(float)*(colEncoder_m*colEncoder_n));
+ memcpy(&colEncodedBits[ii][0], &colEncoded_block[d_kcol],
sizeof(uint8_t)*(colEncoder_m*colEncoder_n));
// DEBUG_PRINT("Col Encoded Bits");
// tmp = colEncoder_m*colEncoder_n;
@@ -254,7 +251,6 @@ void tpc_encoder::generic_work(void *inBuffer, void
*outBuffer) {
colEncoder_n);
//DEBUG_PRINT("Col Encoded Block=[%d] -->\n",ii+numDataColsToEncode);
- tmp = colEncoded_block.size();
//DEBUG_PRINT_FLOAT_ARRAY_AS_UCHAR(&colEncoded_block[0], tmp);
//DEBUG_PRINT_F(fp, "Col Encoded Block=[%d]
-->\n",ii+numDataColsToEncode);
@@ -262,7 +258,7 @@ void tpc_encoder::generic_work(void *inBuffer, void
*outBuffer) {
// store only the encoded bits, b/c we read the data out in a special
way
- memcpy(&colEncodedBits[ii+numDataColsToEncode][0],
&colEncoded_block[d_kcol], sizeof(float)*(colEncoder_m*colEncoder_n));
+ memcpy(&colEncodedBits[ii+numDataColsToEncode][0],
&colEncoded_block[d_kcol], sizeof(uint8_t)*(colEncoder_m*colEncoder_n));
// DEBUG_PRINT("Col Encoded Bits");
// tmp = colEncoder_m*colEncoder_n;
@@ -270,8 +266,7 @@ void tpc_encoder::generic_work(void *inBuffer, void
*outBuffer) {
}
unsigned char* inputDataPtr;
- float *outputDataPtr = out;
- float *tmpPtr = outputDataPtr;
+ uint8_t *outputDataPtr = out;
int curRowInRowEncodedBits = 0;
// read out the data along the rows into the "out" array
@@ -280,29 +275,27 @@ void tpc_encoder::generic_work(void *inBuffer, void
*outBuffer) {
inputDataPtr = &inputWithPad[d_bval];
int firstRowRemainingBits = d_krow-d_bval;
for(ii=0; ii<firstRowRemainingBits; ii++) {
- *outputDataPtr++ = (float)(*inputDataPtr++);
+ *outputDataPtr++ = (uint8_t)(*inputDataPtr++);
}
// copy the encoded bits
memcpy(outputDataPtr, &rowEncodedBits[curRowInRowEncodedBits++][0],
- sizeof(float)*(rowEncoder_m*rowEncoder_n));
+ sizeof(uint8_t)*(rowEncoder_m*rowEncoder_n));
outputDataPtr += (rowEncoder_m*rowEncoder_n);
- tmpPtr = outputDataPtr;
// copy out the rest of the data
for(ii=1; ii<d_kcol; ii++) { // ii starts at 1, b/c we already did
idx=0
// copy systematic bits
for(jj=0; jj<d_krow; jj++) {
- *outputDataPtr++ = (float)(*inputDataPtr++);
+ *outputDataPtr++ = (uint8_t)(*inputDataPtr++);
}
// copy the encoded bits
memcpy(outputDataPtr, &rowEncodedBits[curRowInRowEncodedBits++][0],
- sizeof(float)*(rowEncoder_m*rowEncoder_n));
+ sizeof(uint8_t)*(rowEncoder_m*rowEncoder_n));
outputDataPtr += (rowEncoder_m*rowEncoder_n);
- tmpPtr = outputDataPtr;
}
// copy the encoded cols
- [Commit-gnuradio] [gnuradio] branch master updated (fa2abde -> cce2347), git, 2015/04/05
- [Commit-gnuradio] [gnuradio] 10/11: Merge remote-tracking branch 'tom/qtgui/time_auto_and_stop', git, 2015/04/05
- [Commit-gnuradio] [gnuradio] 08/11: Merge remote-tracking branch 'mmueller/runtime_hier_block2_signage', git, 2015/04/05
- [Commit-gnuradio] [gnuradio] 09/11: Merge remote-tracking branch 'mmueller/remove_aadvarkness', git, 2015/04/05
- [Commit-gnuradio] [gnuradio] 11/11: Merge remote-tracking branch 'osh/tpc_add', git, 2015/04/05
- [Commit-gnuradio] [gnuradio] 03/11: blocks: adding a variable tag_object to help build tags., git, 2015/04/05
- [Commit-gnuradio] [gnuradio] 02/11: fec: TPC now runs happily, encoder produces uint8_t instead of float, decoder GRC def now fixed,
git <=
- [Commit-gnuradio] [gnuradio] 04/11: fec: TPC adding standard headers, git, 2015/04/05
- [Commit-gnuradio] [gnuradio] 05/11: Fixed up the int/size_t handling in hb2's new max/min_output... methods, git, 2015/04/05
- [Commit-gnuradio] [gnuradio] 07/11: qtgui: adds single-shot autoscale button and stop button to time sink control panel., git, 2015/04/05
- [Commit-gnuradio] [gnuradio] 01/11: fec: adding TPC encoder and decoder, git, 2015/04/05
- [Commit-gnuradio] [gnuradio] 06/11: removed doxyxml example, git, 2015/04/05