summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Economos <w6rz@comcast.net>2019-01-27 16:21:11 -0800
committerMartin Braun <martin.braun@ettus.com>2019-02-17 11:43:03 -0800
commit3a533f78051afa4e33acada04fd6af6777f179f7 (patch)
tree3f9908cd6dfd3078ae9bb0315c9d1187b23487f0
parentd33816fde01e696fb6084069ab4ea17b21426a86 (diff)
dtv: Expand LDPC lut array size for worst case table generation.
-rw-r--r--gr-dtv/lib/dvb/dvb_ldpc_bb_impl.cc17
-rw-r--r--gr-dtv/lib/dvb/dvb_ldpc_bb_impl.h1
2 files changed, 17 insertions, 1 deletions
diff --git a/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.cc b/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.cc
index b2ffd0096e..31fd2daaf1 100644
--- a/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.cc
+++ b/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.cc
@@ -380,7 +380,21 @@ for (int row = 0; row < ROWS; row++) { /* count the entries in the table */ \
} \
max_lut_arraysize *= 360; /* 360 bits per table entry */ \
max_lut_arraysize /= pbits; /* spread over all parity bits */ \
-max_lut_arraysize += 2; /* 1 for the size at the start of the array, one as buffer */ \
+for (int i = 0; i < FRAME_SIZE_NORMAL; i++) { \
+ ldpc_lut_index[i] = 1; \
+} \
+for (int row = 0; row < ROWS; row++) { \
+ for (int n = 0; n < 360; n++) { \
+ for (int col = 1; col <= TABLE_NAME[row][0]; col++) { \
+ int current_pbit = (TABLE_NAME[row][col] + (n * q)) % pbits; \
+ ldpc_lut_index[current_pbit]++; \
+ if (ldpc_lut_index[current_pbit] > max_index) { \
+ max_index = ldpc_lut_index[current_pbit]; \
+ } \
+ } \
+ } \
+} \
+max_lut_arraysize += 1 + (max_index - max_lut_arraysize); /* 1 for the size at the start of the array */ \
\
/* Allocate a 2D Array with pbits * max_lut_arraysize
* while preserving two-subscript access
@@ -417,6 +431,7 @@ for (int row = 0; row < ROWS; row++) { \
int pbits = (frame_size_real + Xp) - nbch; //number of parity bits
int q = q_val;
int max_lut_arraysize = 0;
+ int max_index = 0;
if (frame_size_type == FECFRAME_NORMAL) {
if (code_rate == C1_4) {
diff --git a/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.h b/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.h
index 5506411956..e6a2f6c492 100644
--- a/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.h
+++ b/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.h
@@ -45,6 +45,7 @@ namespace gr {
int Xp;
unsigned char puncturing_buffer[FRAME_SIZE_NORMAL];
unsigned char shortening_buffer[FRAME_SIZE_NORMAL];
+ int ldpc_lut_index[FRAME_SIZE_NORMAL];
void ldpc_lookup_generate(void);
int** ldpc_lut;