-
Notifications
You must be signed in to change notification settings - Fork 373
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
Simplify ImageCache #1551
Simplify ImageCache #1551
Conversation
8e59ca2
to
60ba461
Compare
bd538cd
to
2aed7c1
Compare
2aed7c1
to
b339041
Compare
b339041
to
3033cd5
Compare
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.
Nice!
self.key.hash(&mut s); | ||
let texture_key = std::hash::Hasher::finish(&s); | ||
|
||
let debug_name = format!("tensor {:?}", self.tensor.shape()); |
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.
it would be nice to use the entity path as the debug name
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.
Agreed, except we don't currently have easy access to that information and I'm not inclined to plumb it through right now. This is something that would be really nice to generally add to all Component structs.
|
||
// TODO(emilk): support histograms of non-RGB images too | ||
if let image::DynamicImage::ImageRgb8(rgb_image) = dynamic_img { | ||
if let image::DynamicImage::ImageRgba8(rgb_image) = dynamic_img { |
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.
intentional to switch from rgb to rgba? Won't this break histogram for RGB images (e.g. jpegs)?
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.
The DynamicImage is now derived from the cached RGBA ColorImage. I'd like to re-implement the histogram directly on top of the raw tensor so it always represents raw values, but going to save that for a future PR.
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.
checked on renderer bits, small comment; looks good!
3033cd5
to
1dd2c3d
Compare
Simplify the ImageCache to only be responsible for converting Tensor -> ColorImage. This includes color-mapping, application of annotation context, and conversion to srgb.
The re_renderer TextureCaching is now moved to the TextureManager.
As the color-mapping / data conversion pieces are moved to the GPU, this cache can ultimately go away and we should be able to just converge on streaming Tensor -> Texture.
This gets rid of usage of DynamicImage everywhere except for the Histogram.
The retained image is still kept around in this cache because moving to re_renderer for all images is a bigger chunk of work.
Checklist