-
-
Notifications
You must be signed in to change notification settings - Fork 827
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
Cleanup image metadata reading #1252
Conversation
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.
just some constness here and there ;-)
This function performs the same thing as image::readImageMetadata().
002040d
to
b027949
Compare
Addressed constness comments. It would have been enough to point just one case and add "and elsewhere", I would have fixed all occurrences. About constness itself, personally I don't like splattering But I understand why you would like to have const everywhere as a matter of policy, so feel free to disregard my comment :-) I will try to use const more in subsequent PRs. |
This function performs the same thing as image::getMetadataFromMap().
0b189a0
to
e9f9048
Compare
IMO, const helps readability. Each declaration without a const means that it will be modified, that's very useful to quickly read an algorithm. I like the simplification that this PR is providing! Just need to see if it's not a problem to start creating dependencies between "mvsData/mvsUtils" and "image". When we fuse the image duplication, we will obviously have this dependency. In the meantime, I'm not sure if it's good to create dependencies between modules that contain duplicates. |
Fair enough.
I think I can perform the refactor without introducing worse intermediate status. In this particular case there are no real duplicates, the functions are all named differently or in different namespaces, except that they do similar things. So looking from C++ code perspective there is no risk. I have fixed all real duplicate symbols when preparing #1208. |
I will prepare a single PR with all changes. |
This PR removes a couple of functions from mvsData that do the same thing as functions in image module. Additionally,
readImageSpec
function has been introduced and all functions were redefined in terms of it, which makes them simplier (no need to define additional variables just to satisfy an interface like before). Finally, there is now a way to get whatever attributes needed without writing any more getter functions.The objective is to have a single place for all metadata access.
The new
readImageSpec()
function is not strictly necessary. However, there wasvoid readImageSpec(const std::string& path, int& width, int& height, int& nchannels);
overload before, so given thatnchannels
was needed at least at some point in the past, it seems logical to expose the underlying OIIO ImageSpec without restrictions to satisfy similar accesses in the future.