[PATCH] libosmocore[master]: core/conv/conv_acc.c: delete reset_decoder()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Mon Jun 19 11:28:57 UTC 2017


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/2967

to look at the new patch set (#2).

core/conv/conv_acc.c: delete reset_decoder()

Currently this implementation exposes nothing than
osmo_conv_decode_acc(), so it wasn't possible to call
reset_decoder() from outside.

The method itself was used to initialize accumulated
path metrics and the starting state of encoder. Now
this code is moved to generate_trellis().

Moreover, setting accumulated path metrics inside
existing loop is a bit faster that calling memset().

Change-Id: I8f17cebf468cf0106927ccee091cfb2896649cb2
---
M src/conv_acc.c
1 file changed, 13 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/67/2967/2

diff --git a/src/conv_acc.c b/src/conv_acc.c
index c4545d7..7f03628 100644
--- a/src/conv_acc.c
+++ b/src/conv_acc.c
@@ -413,32 +413,27 @@
 			rc = gen_state_info(&trellis->vals[i],
 				i, outputs, code);
 		}
+
+		if (rc < 0)
+			goto fail;
+
+		/* Set accumulated path metrics to zero */
+		trellis->sums[i] = 0;
 	}
 
-	if (rc < 0)
-		goto fail;
+	/**
+	 * For termination other than tail-biting, initialize the zero state
+	 * as the encoder starting state. Initialize with the maximum
+	 * accumulated sum at length equal to the constraint length.
+	 */
+	if (code->term != CONV_TERM_TAIL_BITING)
+		trellis->sums[0] = INT8_MAX * code->N * code->K;
 
 	return trellis;
 
 fail:
 	free_trellis(trellis);
 	return NULL;
-}
-
-/* Reset decoder
- * Set accumulated path metrics to zero. For termination other than
- * tail-biting, initialize the zero state as the encoder starting state.
- * Initialize with the maximum accumulated sum at length equal to the
- * constraint length.
- */
-static void reset_decoder(struct vdecoder *dec, int term)
-{
-	int ns = dec->trellis->num_states;
-
-	memset(dec->trellis->sums, 0, sizeof(int16_t) * ns);
-
-	if (term != CONV_TERM_TAIL_BITING)
-		dec->trellis->sums[0] = INT8_MAX * dec->n * dec->k;
 }
 
 static void _traceback(struct vdecoder *dec,
@@ -640,8 +635,6 @@
 	const int *punc, uint8_t *out, int len, int term)
 {
 	int8_t depunc[dec->len * dec->n];
-
-	reset_decoder(dec, term);
 
 	if (punc) {
 		depuncture(seq, punc, depunc, dec->len * dec->n);

-- 
To view, visit https://gerrit.osmocom.org/2967
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8f17cebf468cf0106927ccee091cfb2896649cb2
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Tom Tsou <tom at tsou.cc>



More information about the gerrit-log mailing list