summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gr-blocks/lib/file_source_impl.cc10
-rw-r--r--gr-dtv/lib/dvbt/dvbt_reed_solomon_enc_impl.cc13
-rw-r--r--gr-fec/grc/variable_polar_code_configurator.xml14
3 files changed, 28 insertions, 9 deletions
diff --git a/gr-blocks/lib/file_source_impl.cc b/gr-blocks/lib/file_source_impl.cc
index 9dfd30c016..c077c74fd9 100644
--- a/gr-blocks/lib/file_source_impl.cc
+++ b/gr-blocks/lib/file_source_impl.cc
@@ -115,6 +115,16 @@ namespace gr {
throw std::runtime_error("can't open file");
}
+ //Check to ensure the file will be consumed according to item size
+ fseek(d_new_fp, 0, SEEK_END);
+ int file_size = ftell(d_new_fp);
+ rewind (d_new_fp);
+
+ //Warn the user if part of the file will not be consumed.
+ if(file_size % d_itemsize){
+ GR_LOG_WARN(d_logger, "WARNING: File will not be fully consumed with the current output type");
+ }
+
d_updated = true;
d_repeat = repeat;
}
diff --git a/gr-dtv/lib/dvbt/dvbt_reed_solomon_enc_impl.cc b/gr-dtv/lib/dvbt/dvbt_reed_solomon_enc_impl.cc
index 663301d614..9092321462 100644
--- a/gr-dtv/lib/dvbt/dvbt_reed_solomon_enc_impl.cc
+++ b/gr-dtv/lib/dvbt/dvbt_reed_solomon_enc_impl.cc
@@ -25,8 +25,6 @@
#include <gnuradio/io_signature.h>
#include "dvbt_reed_solomon_enc_impl.h"
-#define MPEG_TS_PKT_LENGTH 188
-
namespace gr {
namespace dtv {
@@ -55,7 +53,8 @@ namespace gr {
GR_LOG_FATAL(d_logger, "Reed-Solomon Encoder, cannot allocate memory for d_rs.");
throw std::bad_alloc();
}
- d_data = (unsigned char *) malloc(sizeof(unsigned char) * (d_s + MPEG_TS_PKT_LENGTH));
+ // The full input frame size (d_k) (no need to add in d_s, as the block input is the pre-shortedned K)
+ d_data = (unsigned char *) malloc(sizeof(unsigned char) * (d_k));
if (d_data == NULL) {
GR_LOG_FATAL(d_logger, "Reed-Solomon Encoder, cannot allocate memory for d_data.");
free_rs_char(d_rs);
@@ -83,11 +82,13 @@ namespace gr {
{
// Shortened Reed-Solomon: prepend zero bytes to message (discarded after encoding)
std::memset(d_data, 0, d_s);
- std::memcpy(&d_data[d_s], in, MPEG_TS_PKT_LENGTH);
+ // This is the number of data bytes we need from the input stream.
+ int shortened_k = d_k-d_s;
+ std::memcpy(&d_data[d_s], in, shortened_k);
// Copy input message to output then append Reed-Solomon bits
- std::memcpy(out, in, MPEG_TS_PKT_LENGTH);
- encode_rs_char(d_rs, d_data, &out[MPEG_TS_PKT_LENGTH]);
+ std::memcpy(out, in, shortened_k);
+ encode_rs_char(d_rs, d_data, &out[shortened_k]);
}
int
diff --git a/gr-fec/grc/variable_polar_code_configurator.xml b/gr-fec/grc/variable_polar_code_configurator.xml
index 24004b8a03..ee145b16f7 100644
--- a/gr-fec/grc/variable_polar_code_configurator.xml
+++ b/gr-fec/grc/variable_polar_code_configurator.xml
@@ -25,12 +25,14 @@
<param>
<name>Block size (N)</name>
<key>block_size</key>
+ <value>32</value>
<type>int</type>
</param>
<param>
- <name>#Info Bits (K)</name>
+ <name>Info Bits (K)</name>
<key>num_info_bits</key>
+ <value>16</value>
<type>int</type>
</param>
@@ -46,6 +48,12 @@
<key>mu</key>
<value>16</value>
<type>int</type>
- <hide>#if 'BEC' in $getVar('channel') then 'all' else 'none' #</hide>
</param>
-</block> \ No newline at end of file
+ <doc>This block serves as an interface to the underlying Python functions for channel construction.
+
+ Current channel types are: BEC/AWGN
+ Block size must be a power of 2!
+ Info Bits must be 0 smaller K smaller N
+ Design SNR does affect the target transmission SNR and thus performance.
+ The parameter mu is only relevant for AWGN channels. It is passed on to the corresponding Channel construction algorithm.</doc>
+</block>