summaryrefslogtreecommitdiff
path: root/gr-dtv
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2017-07-20 10:57:08 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2017-07-20 10:57:08 -0700
commite776f1e7196a7543de240b88005b26a02a4c87af (patch)
treea2fe83ff335ee65708d482e926ee6ddc26c98be2 /gr-dtv
parent3886edad0b4421ab6e812895baade7732244deda (diff)
parenta6ed53ecd93cd6b1e0b4fdd627615e4e24697d04 (diff)
Merge branch 'next' into python3
Diffstat (limited to 'gr-dtv')
-rw-r--r--gr-dtv/lib/dvbt/dvbt_reed_solomon_enc_impl.cc13
1 files changed, 7 insertions, 6 deletions
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