Feature/add part indices to write pyapi#2165
Open
dendenxu wants to merge 8 commits intoAcademySoftwareFoundation:mainfrom
Open
Feature/add part indices to write pyapi#2165dendenxu wants to merge 8 commits intoAcademySoftwareFoundation:mainfrom
dendenxu wants to merge 8 commits intoAcademySoftwareFoundation:mainfrom
Conversation
This commit fixes the issue where an unfinished multi-part file could not be loaded properly in the python warpper for OpenEXR. This happens when headers for the multi-part file are written to disk but the actual pixels never finish being written. The current fix skips the corrupted or empty parts with no pixel data while retaining the ability for loading the correct ones. Signed-off-by: dendenxu <zhenx@zju.edu.cn>
This can specify the specific parts of a multi-part EXR file to be loaded to avoid excessive IO when only some parts of the file is needed by the program. This functionality could be particular useful when the file is very large and only a very small portion of it is required in memory. Signed-off-by: dendenxu <zhenx@zju.edu.cn>
Signed-off-by: dendenxu <zhenx@zju.edu.cn>
Signed-off-by: dendenxu <zhenx@zju.edu.cn>
Signed-off-by: dendenxu <zhenx@zju.edu.cn>
Signed-off-by: dendenxu <zhenx@zju.edu.cn>
Signed-off-by: dendenxu <zhenx@zju.edu.cn>
…ndices_to_write_pyapi
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.
This PR adds the part_indices api to the write function of the OpenEXR Python wrapper, similar to #2149
However, different from the read API, we cannot create a new file every time a new part needs to be written on disk, which would result in the previously written data being overwritten. Thus, I added a persistent pointer to a MultiPartOutputFile, just like what we would do if using the C++ API. Another problem arises where the already written part would be cached in a map in the MultiPartOutputFile, leading to growing memory usage even though that part has already been written to the disk and that memory is not needed anymore, so I added another API for deleting this cache file in the MultiPartOutputFile object's map.
The current structure and API design might not be optimal, and I've only tested the regular case where a non-deep scanline multi-part image sequence is written to disk streamingly, where the generation of new part data and the operation of writing them to the disk is happening at the same time.