diff options
| author | 2024-02-20 17:47:37 -0800 | |
|---|---|---|
| committer | 2024-02-29 17:04:33 -0800 | |
| commit | 50582ba78ac8843a6163a4d256691c500932f4d9 (patch) | |
| tree | 1503c46b7c737d74090c9f9afc3a86f590eea9e8 /libs/ultrahdr/jpegencoderhelper.cpp | |
| parent | e0bd3251e515c963a3e1cfa8e4e31fcf0d3406e4 (diff) | |
Fix possible crash in scale-invariant error calculation
The logic for the scale-invariant calculation was quite complex
in the existing code, and depended on some tricky chains of logical
dependence between scale-invariant errors and general errors.
This change firstly eliminates unnecessary nesting by pulling the
scale-invariant error calculation out of the loop – the full calculation
only occurs once per computeAtomFields call, within its own loop.
Secondly, instead of crashing under certain conditions when the
scale-invariant error count is zero, this changes the code to simply not
compute the error in this case. (The complex chain of logic I had
followed to initially add the fatal crash turned out to be fallacious.)
Finally, this adds a testcase that fails without the changes to the
MetricsManager implementation (see ag/26418604). This added testcase
represents skipped/dropped input events, or an input interval greater
than the prediction interval.
Test: atest frameworks/native/libs/input/tests/MotionPredictorMetricsManager_test.cpp
Test: the above test fails without the changes to MotionPredictionMetricsManager.cpp
Test: `statsd_testdrive 718`, then draw with stylus → reported metrics are reasonable
Bug: 325711945
Change-Id: Ic56c0f0c810ec1b85b1906e16a8640824187d1fb
Diffstat (limited to 'libs/ultrahdr/jpegencoderhelper.cpp')
0 files changed, 0 insertions, 0 deletions