bug fix: fix missing output before gaps
Whenever there are gaps, the output before gaps will generally be missing. This is because currently whether the output buffer is a gap only depends on whether the last blockstride is a gap. Therefore, if the input buffer is a gap and the history in the adapter is nongap, the output buffer will be a gap and we will lose the output that could have come from the history.
We need to define a new variable that tracks whether we have copied nongaps during the while loop.
Example downsampling from srate 512 to srate 256:
Before bug fix:
After bug fix:
Merge request reports
Activity
requested review from @chad-hanna
assigned to @yun-jing.huang
the output still appears to be less than ideal. ideally, all periods of output known to be identically 0 should be gap buffers. the "after fix" output above appears to contain periods of identically 0 output that are not marked as gaps but for which because of the properties of the input stream one could have predicted would be identically 0. an example of the logic for handling all the different cases for elements with internal history can be found in the firbank element (https://git.ligo.org/lscsoft/gstlal/-/blob/master/gstlal/gst/lal/gstlal_firbank.c). note that in one case (the case affecting the examples above) two output buffers must be produced: one that contains the remaining possibly-non-zero samples, followed by a gap buffer for the known-to-be-zero samples.
the specific calculation for this case is https://git.ligo.org/lscsoft/gstlal/-/blob/master/gstlal/gst/lal/gstlal_firbank.c#L1571 where the number of non-zero output samples to be generated at the start of the output buffer is computed. later this is compared to the total number of output samples to determine if the last part of the output buffer should be replaced with a gap buffer.
Edited by Kipp Cannon