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/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-trx/+/14672 ) Change subject: sigProcLib: detectAnyBurst() family: Use struct to gather all out params ...................................................................... sigProcLib: detectAnyBurst() family: Use struct to gather all out params Currently we have 2 out parameters, but in forthcoming commits will add a third one. All those functions already have too many parameters, so let's put together all the output params in a struct to pass them easily and make it easier to understand they are the estimated output values. Related: OS#4006 Change-Id: I05cfa0ceaa2e633a5e6e404e2eae497ff4442dea --- M Transceiver52M/Transceiver.cpp M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 3 files changed, 45 insertions(+), 45 deletions(-) Approvals: laforge: Looks good to me, approved fixeria: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index 4462cdd..5c5707b 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -575,8 +575,8 @@ bool Transceiver::pullRadioVector(size_t chan, struct trx_ul_burst_ind *bi) { int rc; - complex amp; - float toa, max = -1.0, avg = 0.0; + struct estim_burst_params ebp; + float max = -1.0, avg = 0.0; unsigned max_toa; int max_i = -1; signalVector *burst; @@ -654,7 +654,7 @@ mMaxExpectedDelayAB : mMaxExpectedDelayNB; /* Detect normal or RACH bursts */ - rc = detectAnyBurst(*burst, mTSC, BURST_THRESH, mSPSRx, type, amp, toa, max_toa); + rc = detectAnyBurst(*burst, mTSC, BURST_THRESH, mSPSRx, type, max_toa, &ebp); if (rc <= 0) { if (rc == -SIGERR_CLIP) LOG(WARNING) << "Clipping detected on received RACH or Normal Burst"; @@ -664,8 +664,8 @@ } type = (CorrType) rc; - bi->toa = toa; - rxBurst = demodAnyBurst(*burst, mSPSRx, amp, toa, type); + bi->toa = ebp.toa; + rxBurst = demodAnyBurst(*burst, mSPSRx, ebp.amp, ebp.toa, type); /* EDGE demodulator returns 444 (gSlotLen * 3) bits */ if (rxBurst->size() == EDGE_BURST_NBITS) diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index cff7825..52a6701 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1463,8 +1463,8 @@ */ static int detectBurst(const signalVector &burst, signalVector &corr, CorrelationSequence *sync, - float thresh, int sps, complex *amp, float *toa, - int start, int len) + float thresh, int sps, int start, int len, + struct estim_burst_params *ebp) { const signalVector *corr_in; signalVector *dec = NULL; @@ -1490,23 +1490,23 @@ sps = 1; /* Peak detection - place restrictions at correlation edges */ - *amp = fastPeakDetect(corr, toa); + ebp->amp = fastPeakDetect(corr, &ebp->toa); - if ((*toa < 3 * sps) || (*toa > len - 3 * sps)) + if ((ebp->toa < 3 * sps) || (ebp->toa > len - 3 * sps)) return 0; /* Peak -to-average ratio */ - if (computePeakRatio(&corr, sps, *toa, *amp) < thresh) + if (computePeakRatio(&corr, sps, ebp->toa, ebp->amp) < thresh) return 0; /* Compute peak-to-average ratio. Reject if we don't have enough values */ - *amp = peakDetect(corr, toa, NULL); + ebp->amp = peakDetect(corr, &ebp->toa, NULL); /* Normalize our channel gain */ - *amp = *amp / sync->gain; + ebp->amp = ebp->amp / sync->gain; /* Compensate for residuate time lag */ - *toa = *toa - sync->toa; + ebp->toa = ebp->toa - sync->toa; return 1; } @@ -1532,13 +1532,10 @@ * head: Search symbols before target * tail: Search symbols after target */ -static int detectGeneralBurst(const signalVector &rxBurst, - float thresh, - int sps, - complex &, - float &toa, +static int detectGeneralBurst(const signalVector &rxBurst, float thresh, int sps, int target, int head, int tail, - CorrelationSequence *sync) + CorrelationSequence *sync, + struct estim_burst_params *ebp) { int rc, start, len; bool clipping = false; @@ -1560,17 +1557,17 @@ signalVector corr(len); rc = detectBurst(rxBurst, corr, sync, - thresh, sps, &, &toa, start, len); + thresh, sps, start, len, ebp); if (rc < 0) { return -SIGERR_INTERNAL; } else if (!rc) { - amp = 0.0f; - toa = 0.0f; + ebp->amp = 0.0f; + ebp->toa = 0.0f; return clipping?-SIGERR_CLIP:SIGERR_NONE; } /* Subtract forward search bits from delay */ - toa -= head; + ebp->toa -= head; return 1; } @@ -1585,7 +1582,7 @@ * tail: Search 8 symbols + maximum expected delay */ static int detectRACHBurst(const signalVector &burst, float threshold, int sps, - complex &litude, float &toa, unsigned max_toa, bool ext) + unsigned max_toa, bool ext, struct estim_burst_params *ebp) { int rc, target, head, tail; int i, num_seq; @@ -1596,8 +1593,8 @@ num_seq = ext ? 3 : 1; for (i = 0; i < num_seq; i++) { - rc = detectGeneralBurst(burst, threshold, sps, amplitude, toa, - target, head, tail, gRACHSequences[i]); + rc = detectGeneralBurst(burst, threshold, sps, target, head, tail, + gRACHSequences[i], ebp); if (rc > 0) break; } @@ -1614,7 +1611,7 @@ * tail: Search 6 symbols + maximum expected delay */ static int analyzeTrafficBurst(const signalVector &burst, unsigned tsc, float threshold, - int sps, complex &litude, float &toa, unsigned max_toa) + int sps, unsigned max_toa, struct estim_burst_params *ebp) { int rc, target, head, tail; CorrelationSequence *sync; @@ -1627,13 +1624,12 @@ tail = 6 + max_toa; sync = gMidambles[tsc]; - rc = detectGeneralBurst(burst, threshold, sps, amplitude, toa, - target, head, tail, sync); + rc = detectGeneralBurst(burst, threshold, sps, target, head, tail, sync, ebp); return rc; } static int detectEdgeBurst(const signalVector &burst, unsigned tsc, float threshold, - int sps, complex &litude, float &toa, unsigned max_toa) + int sps, unsigned max_toa, struct estim_burst_params *ebp) { int rc, target, head, tail; CorrelationSequence *sync; @@ -1646,33 +1642,30 @@ tail = 6 + max_toa; sync = gEdgeMidambles[tsc]; - rc = detectGeneralBurst(burst, threshold, sps, amplitude, toa, - target, head, tail, sync); + rc = detectGeneralBurst(burst, threshold, sps, + target, head, tail, sync, ebp); return rc; } int detectAnyBurst(const signalVector &burst, unsigned tsc, float threshold, - int sps, CorrType type, complex &, float &toa, - unsigned max_toa) + int sps, CorrType type, unsigned max_toa, + struct estim_burst_params *ebp) { int rc = 0; switch (type) { case EDGE: - rc = detectEdgeBurst(burst, tsc, threshold, sps, - amp, toa, max_toa); + rc = detectEdgeBurst(burst, tsc, threshold, sps, max_toa, ebp); if (rc > 0) break; else type = TSC; case TSC: - rc = analyzeTrafficBurst(burst, tsc, threshold, sps, - amp, toa, max_toa); + rc = analyzeTrafficBurst(burst, tsc, threshold, sps, max_toa, ebp); break; case EXT_RACH: case RACH: - rc = detectRACHBurst(burst, threshold, sps, amp, toa, - max_toa, type == EXT_RACH); + rc = detectRACHBurst(burst, threshold, sps, max_toa, type == EXT_RACH, ebp); break; default: LOG(ERR) << "Invalid correlation type"; diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index bae2127..8442cfc 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -101,15 +101,23 @@ */ float energyDetect(const signalVector &rxBurst, unsigned windowLength); + +/** Struct used to fill out parameters in detectAnyBurst(): estimated burst parameters + at param amplitude The estimated amplitude of received TSC burst. + at param toa The estimated time-of-arrival of received TSC burst (in symbols). +*/ +struct estim_burst_params { + complex amp; + float toa; +}; /** 8-PSK/GMSK/RACH burst detector @param burst The received GSM burst of interest @param tsc Midamble type (0..7) also known as TSC @param threshold The threshold that the received burst's post-correlator SNR is compared against to determine validity. @param sps The number of samples per GSM symbol. - @param amplitude The estimated amplitude of received TSC burst. - @param toa The estimate time-of-arrival of received TSC burst (in symbols). @param max_toa The maximum expected time-of-arrival (in symbols). + @param ebp The estimated parameters of the detected burst. @return positive value (CorrType) if threshold value is reached, negative value (-SignalError) on error, zero (SIGERR_NONE) if no burst is detected @@ -119,9 +127,8 @@ float threshold, int sps, CorrType type, - complex &, - float &toa, - unsigned max_toa); + unsigned max_toa, + struct estim_burst_params *ebp); /** Demodulate burst basde on type and output soft bits */ SoftVector *demodAnyBurst(const signalVector &burst, int sps, -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/14672 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: I05cfa0ceaa2e633a5e6e404e2eae497ff4442dea Gerrit-Change-Number: 14672 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <axilirator at gmail.com> Gerrit-Reviewer: laforge <laforge at gnumonks.org> Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190719/9e043f22/attachment.htm>