-
Notifications
You must be signed in to change notification settings - Fork 57
OIIO #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
OIIO #143
Changes from 14 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
9938a58
copying the makefile preserving history
antond-weta 638b38e
moved the main app into subfolder
antond-weta f0b601d
copying the makefile preserving history -- done
antond-weta 35efa4a
Implement OIIO-based version of the tool
antond-weta 06e616c
removed more unnecessary stuff from public headers
antond-weta 02d534d
fix formating
antond-weta 6e18fc7
change the public interfaces to make it easier to use the tool as a l…
antond-weta 4f33dc5
fix formatting and clang build
antond-weta 0fcced4
fix formatting and clang build
antond-weta 4773a20
fix formatting
antond-weta 808b2e9
add RAWTOACES_DATA_PATH env var; clean up public headers
antond-weta f51dbff
fix build
antond-weta 7e7f39e
add another configure method; more error checking
antond-weta 8cca7d6
implement colour transform cache
antond-weta 1847d45
fix build
antond-weta 29a7f59
fix build
antond-weta c64bffd
replace boost::json with nlohmann_json
antond-weta 72466a0
replace boost::unittest with OIIO::unittest
antond-weta 7665b22
add the --overwrite, --create-dirs, --output-dir parameters
antond-weta f2aacfb
add --disable-cache
antond-weta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| // Copyright Contributors to the rawtoaces project. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // https://github.com/AcademySoftwareFoundation/rawtoaces | ||
|
|
||
| #include <iostream> | ||
| #include <filesystem> | ||
|
|
||
| #include <string> | ||
| #include <list> | ||
| #include <variant> | ||
|
|
||
| #include <rawtoaces/metadata.h> | ||
|
|
||
| namespace rta | ||
| { | ||
| namespace cache | ||
| { | ||
|
|
||
| template <class CacheEntryData> class CacheEntryDescriptor | ||
| { | ||
| public: | ||
| virtual size_t map_index() const = 0; | ||
| virtual bool fetch( CacheEntryData &data, int verbosity = 0 ) const = 0; | ||
| virtual bool operator==( const CacheEntryDescriptor &other ) const = 0; | ||
|
|
||
| // Each subclass must also implement the folowing 2 methods. | ||
| // Not sure how to declare them here. | ||
|
|
||
| // friend std::ostream& operator<< (std::ostream& stream, const DescriptorBase& descriptor); | ||
| // std::tuple<Types && ...> construct_entry() const | ||
| }; | ||
|
|
||
| template <class Descriptor, class CacheEntryData, size_t size> class CacheBase | ||
| { | ||
| public: | ||
| const CacheEntryData &fetch( const Descriptor &descriptor ) | ||
| { | ||
| size_t map_index = descriptor.map_index(); | ||
|
|
||
| std::list<std::pair<Descriptor, CacheEntryData>> &map = | ||
| _maps[map_index]; | ||
|
|
||
| if ( verbosity > 0 ) | ||
| { | ||
| std::cerr << name << ": searching for a " << descriptor; | ||
| } | ||
|
|
||
| for ( auto iter = map.begin(); iter != map.end(); ++iter ) | ||
| { | ||
| if ( iter->first == descriptor ) | ||
| { | ||
| if ( iter != map.begin() ) | ||
| { | ||
| map.splice( map.begin(), map, iter, std::next( iter ) ); | ||
| } | ||
|
|
||
| if ( verbosity > 0 ) | ||
| { | ||
| std::cerr << name << ": found in cache!" << std::endl; | ||
| } | ||
| return map.front().second; | ||
| } | ||
| } | ||
|
|
||
| if ( map.size() == capacity ) | ||
| { | ||
| map.pop_back(); | ||
| } | ||
|
|
||
| if ( verbosity > 0 ) | ||
| { | ||
| std::cerr << name << ": not found. Calculating a new entry." | ||
| << std::endl; | ||
| } | ||
|
|
||
| map.emplace_front( | ||
| std::piecewise_construct, | ||
| std::forward_as_tuple( descriptor ), | ||
| descriptor.construct_entry() ); | ||
|
|
||
| CacheEntryData &data = map.front().second; | ||
| descriptor.fetch( data, verbosity ); | ||
| return data; | ||
| }; | ||
|
|
||
| int capacity = 10; | ||
| int verbosity = 0; | ||
| std::string name = "Cache"; | ||
|
|
||
| private: | ||
| std::list<std::pair<Descriptor, CacheEntryData>> _maps[size]; | ||
| }; | ||
|
|
||
| } // namespace cache | ||
| } // namespace rta |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another commented out line not to forget about (unless, it's a special syntax in c++, which I don't know. sry if so)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no such file in the repo, whoever wrote it has forgotten to push the file, I assume.