xy: Add mipmap-based downsampling for XY data providers#422
xy: Add mipmap-based downsampling for XY data providers#422MatthewKhouzam wants to merge 1 commit into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@arfio, @JonatanAntoni fyi |
Introduce max-per-bucket aggregation backed by pre-computed mipmap levels in the state system. This replaces trivial point-sampling with spike-preserving downsampling that guarantees visual correctness at every zoom level. New components: - AbstractXYStateProvider (provisional API): base state provider with ergonomic mipmap helpers (modifyMipmapAttribute, incrementMipmap*) - TimeMipmapFeature: time-based mipmap with power-of-10 levels (10ns, 100ns, 1us, 10us, ...) aligned to natural time units - MipmapXYQueryHelper: internal utility that auto-detects mipmap sub-attributes and replaces Y values with queryRangeMax per bucket Integration: - AbstractTreeCommonXDataProvider.fetchXY() auto-enhances results - AbstractTreeGenericXYCommonXDataProvider.fetchXY() same (timestamps only) - AbstractTreeDataProvider exposes getIdToQuark() for ID-to-quark mapping Migration (proof of concept): - CounterStateProvider now extends AbstractXYStateProvider - Uses mipmap helpers instead of StateSystemBuilderUtils - State system version bumped to trigger rebuild This code was made with a tightly guided assistance from Claude Sonnet 4.6 Change-Id: I2088657ba1702f0e101b9debc37ee94ee06b4efb Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
|
Ah, this makes more sense. it is an interesting problem... Basically how would you like to see it solved? we can make an "envelop" per pixel. I usually look at an oscilloscope as a reference, and what is shown above is how it would display it. |
|
Here is how I solved this in my TypeScript TSP implementation to get to the latest picture:
Ultimately, this leads to a factor 4 oversampling. I.e., if the client requests 1000 samples, this method actually sends back 4000 samples. The current graph implementation then results drawing 4 samples onto the same horizontal position. Of course, this is wasting some bandwidth and there might be a more elegant solution as well. |
|
Now oversampling works too. The mipmap and oversampling offer two solutions to the problem. What you're proposing could still miss a spike, but it's less likely. Let's discuss/nerd out on wednesday's meeting. |
|
@MatthewKhouzam, my approach isn't actually oversampling as I do not pick equally spaced samples from the original signal. We are picking the highest and lowest Y-values from a bucket regardless of their X-values and put them together on the same scaled X-value. Its similar to the mipmap-approach but with more values so that positive and negative extrema are preserved. |




What it does
Introduce max-per-bucket aggregation backed by pre-computed mipmap levels in the state system. This replaces trivial point-sampling with spike-preserving downsampling that guarantees visual correctness at every zoom level.
New components:
Integration:
Migration (proof of concept):
How to test
Open some xy plots.
Follow-ups
Make all XY plots use delta based storage.
Review checklist