From 8b4fa817117e28f3962568dc865454849a02abb7 Mon Sep 17 00:00:00 2001 From: arancormonk <180709949+arancormonk@users.noreply.github.com> Date: Wed, 3 Sep 2025 21:38:50 -0500 Subject: [PATCH] =?UTF-8?q?rtl=5Fsdr=5Ffm:=20consume=20HB=20cascade=20outp?= =?UTF-8?q?ut=20in-place=20to=20avoid=20the=20final=20memcpy.=20Track=20th?= =?UTF-8?q?e=20current=20buffer=20and=20assign=20lowpassed=20to=20the=20la?= =?UTF-8?q?st=20stage=E2=80=99s=20output,=20preserving=20correctness=20whi?= =?UTF-8?q?le=20reducing=20memory=20traffic.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/rtl_sdr_fm.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/rtl_sdr_fm.cpp b/src/rtl_sdr_fm.cpp index 88764f8..186ac74 100644 --- a/src/rtl_sdr_fm.cpp +++ b/src/rtl_sdr_fm.cpp @@ -1608,10 +1608,8 @@ void full_demod(struct demod_state *d) in_len = out_len_interleaved; dst = (src == d->hb_workbuf) ? d->lowpassed : d->hb_workbuf; } - /* Final output resides in 'src' with length in_len */ - if (d->lowpassed != src) { - memcpy(d->lowpassed, src, (size_t)in_len * sizeof(int16_t)); - } + /* Final output resides in 'src' with length in_len; consume in-place (no copy) */ + d->lowpassed = src; d->lp_len = in_len; /* No droop compensation for half-band cascade */ } else {