usePrettyWriter and precision options for JSON writing#1340
Merged
eundersander merged 6 commits intofacebookresearch:masterfrom Jun 24, 2021
Merged
Conversation
eundersander
commented
Jun 23, 2021
| objAttrMgr->loadAllJSONConfigsFromPath( | ||
| Cr::Utility::Directory::join(TEST_ASSETS, "objects/nested_box"), true); | ||
|
|
||
| auto handles = objAttrMgr->getObjectHandlesBySubstring("nested_box"); |
Contributor
Author
There was a problem hiding this comment.
Related to the JSON changes: I'm modifying this test to add a render object instance and verify its pose gets serialized/deserialized with reasonable precision.
jturner65
approved these changes
Jun 24, 2021
Contributor
jturner65
left a comment
There was a problem hiding this comment.
LGTM. Left a couple of comments on some minor things (you can take or leave), but otherwise looks great.
| auto document = writeKeyframesToJsonDocument(); | ||
| esp::io::writeJsonToFile(document, filepath); | ||
| // replay::Keyframes use floats (not doubles) so this is plenty of precision | ||
| const float maxDecimalPlaces = 7; |
Contributor
There was a problem hiding this comment.
Maybe make an argument with a default value? (standard magic number stuff, not a big deal)
Contributor
Author
There was a problem hiding this comment.
I don't want to let the user make a bad decision here like setting it to 0 or 2. This is a decision for Recorder.
| // when writing to json, we often want to clamp tiny floats to 0.0 so they can | ||
| // be serialized concisely as "0.0" | ||
| template <typename T> | ||
| T squashTinyFloats(T x) { |
Contributor
There was a problem hiding this comment.
Since we are supporting doubles with this, maybe "squashTinyDecimals" ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Turning off the PrettyWriter and reducing precision helps reduce filesize for gfx-replay and
arrange_recorder.I also made a small change to how Quaternions are serialized, again to reduce filesize.
How Has This Been Tested
GfxReplayTest was modified to ensure we test precision of serialized/deserialized Quaternions.
Types of changes
Checklist