Skip to content

Commit

Permalink
Rename ImageEncoded to EncodedImage (rerun-io#7087)
Browse files Browse the repository at this point in the history
### What
* Part of rerun-io#7050

This is a better name (rolls off the tongue better).

It also removed a name clash, allowing us to later:
* rerun-io#7086

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using examples from latest `main` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/7087?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/7087?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!
* [x] If have noted any breaking changes to the log API in
`CHANGELOG.md` and the migration guide

- [PR Build Summary](https://build.rerun.io/pr/7087)
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

To run all checks from `main`, comment on the PR with `@rerun-bot
full-check`.
  • Loading branch information
emilk authored Aug 7, 2024
1 parent 5fcc9fb commit 0cc3908
Show file tree
Hide file tree
Showing 60 changed files with 185 additions and 186 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* `mesh_material: Material` has been renamed to `albedo_factor: AlbedoFactor` [#6841](https://github.com/rerun-io/rerun/pull/6841)
* 3D transform APIs: Previously, the transform component was represented as one of several variants (an Arrow union, `enum` in Rust) depending on how the transform was expressed. Instead, there are now several components for translation/scale/rotation/matrices that can live side-by-side in the 3D transform archetype.
* Python: `NV12/YUY2` are now logged with `Image`
* [`ImageEncoded`](https://rerun.io/docs/reference/types/archetypes/image_encoded?speculative-link):s `format` parameter has been replaced with `media_type` (MIME)
* `ImageEncoded` has been replaced with [`EncodedImage`](https://rerun.io/docs/reference/types/archetypes/encoded_image?speculative-link) (JPEG, PNG, …) and [`Image`](https://rerun.io/docs/reference/types/archetypes/image?speculative-link) (NV12, YUY2, …)
* [`DepthImage`](https://rerun.io/docs/reference/types/archetypes/depth_image) and [`SegmentationImage`](https://rerun.io/docs/reference/types/archetypes/segmentation_image) are no longer encoded as a tensors, and expects its shape in `[width, height]` order

🧳 Migration guide: http://rerun.io/docs/reference/migration/migration-0-18?speculative-link
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_data_loader/src/loader_archetype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ fn load_image(

let rows = [
{
let mut arch = re_types::archetypes::ImageEncoded::from_file_contents(contents);
let mut arch = re_types::archetypes::EncodedImage::from_file_contents(contents);

if let Ok(format) = image::ImageFormat::from_path(filepath) {
arch.media_type = Some(MediaType::from(format.to_mime_type()));
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/definitions/rerun/archetypes.fbs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ namespace rerun.archetypes;
///
/// \py To compress an image, use [`rerun.Image.compress`][].
///
/// \example archetypes/image_encoded
table ImageEncoded (
/// \example archetypes/encoded_image
table EncodedImage (
"attr.cpp.no_field_ctors",
"attr.docs.category": "Image & tensor",
"attr.docs.unreleased",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace rerun.archetypes;
/// The order of dimensions in the underlying [components.Blob] follows the typical
/// row-major, interleaved-pixel image format.
///
/// Rerun also supports compressed images (JPEG, PNG, …), using [archetypes.ImageEncoded].
/// Rerun also supports compressed images (JPEG, PNG, …), using [archetypes.EncodedImage].
/// Compressing images can save a lot of bandwidth and memory.
///
/// \cpp Since the underlying [rerun::components::Blob] uses `rerun::Collection` internally,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace rerun.components;
///
/// All these formats support random access.
///
/// For more compressed image formats, see [archetypes.ImageEncoded].
/// For more compressed image formats, see [archetypes.EncodedImage].
enum PixelFormat: byte (
"attr.docs.unreleased"
) {
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/src/archetypes/.gitattributes

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::components::Blob;

use super::ImageEncoded;
use super::EncodedImage;

impl ImageEncoded {
impl EncodedImage {
/// Creates a new image from the file contents at `path`.
///
/// The [`MediaType`][crate::components::MediaType] will first be guessed from the file contents.
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_types/src/archetypes/image.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions crates/store/re_types/src/archetypes/image_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{
#[cfg(feature = "image")]
use crate::image::{ImageConversionError, ImageLoadError};

use super::ImageEncoded;
use super::EncodedImage;

use super::Image;

Expand Down Expand Up @@ -166,24 +166,24 @@ impl Image {
/// Creates a new [`Image`] from a file.
///
/// The image format will be inferred from the path (extension), or the contents if that fails.
#[deprecated = "Use ImageEncoded::from_file instead"]
#[deprecated = "Use EncodedImage::from_file instead"]
#[cfg(not(target_arch = "wasm32"))]
#[inline]
pub fn from_file_path(filepath: impl AsRef<std::path::Path>) -> std::io::Result<ImageEncoded> {
ImageEncoded::from_file(filepath)
pub fn from_file_path(filepath: impl AsRef<std::path::Path>) -> std::io::Result<EncodedImage> {
EncodedImage::from_file(filepath)
}

/// Creates a new [`Image`] from the contents of a file.
///
/// If unspecified, the image format will be inferred from the contents.
#[deprecated = "Use ImageEncoded::from_file_contents instead"]
#[deprecated = "Use EncodedImage::from_file_contents instead"]
#[cfg(feature = "image")]
#[inline]
pub fn from_file_contents(
contents: Vec<u8>,
_format: Option<image::ImageFormat>,
) -> ImageEncoded {
ImageEncoded::from_file_contents(contents)
) -> EncodedImage {
EncodedImage::from_file_contents(contents)
}
}

Expand All @@ -193,7 +193,7 @@ impl Image {
///
/// This will spend CPU cycles decoding the image.
/// To save CPU time and storage, we recommend you instead use
/// [`ImageEncoded::from_file_contents`].
/// [`EncodedImage::from_file_contents`].
///
/// Requires the `image` feature.
#[inline]
Expand Down
6 changes: 3 additions & 3 deletions crates/store/re_types/src/archetypes/mod.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/store/re_types/src/components/pixel_format.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions crates/store/re_types/src/datatypes/tensor_data_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::tensor_data::{TensorCastError, TensorDataType, TensorElement};
use crate::tensor_data::{TensorImageLoadError, TensorImageSaveError};

#[allow(unused_imports)] // Used for docstring links
use crate::archetypes::ImageEncoded;
use crate::archetypes::EncodedImage;

use super::{TensorBuffer, TensorData, TensorDimension};

Expand Down Expand Up @@ -453,7 +453,7 @@ impl TensorData {
///
/// This will spend CPU cycles reading the file and decoding the image.
/// To save CPU time and storage, we recommend you instead use
/// [`ImageEncoded::from_file`].
/// [`EncodedImage::from_file`].
///
/// Requires the `image` feature.
#[cfg(not(target_arch = "wasm32"))]
Expand Down Expand Up @@ -482,7 +482,7 @@ impl TensorData {
///
/// This will spend CPU cycles decoding the image.
/// To save CPU time and storage, we recommend you instead use
/// [`ImageEncoded::from_file_contents`].
/// [`EncodedImage::from_file_contents`].
///
/// Requires the `image` feature.
#[inline]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use once_cell::sync::OnceCell;
use re_chunk_store::{ChunkStore, ChunkStoreSubscriber, ChunkStoreSubscriberHandle};
use re_log_types::{EntityPath, StoreId};
use re_types::{
archetypes::ImageEncoded,
archetypes::EncodedImage,
components::{Blob, MediaType, Resolution2D},
external::image,
Archetype, Loggable,
Expand Down Expand Up @@ -95,7 +95,7 @@ impl ChunkStoreSubscriber for MaxImageDimensionSubscriber {
.diff
.chunk
.components()
.get(&ImageEncoded::indicator().name())
.get(&EncodedImage::indicator().name())
.is_some()
{
let media_types = event.diff.chunk.iter_component_arrays(&MediaType::name());
Expand Down
6 changes: 3 additions & 3 deletions crates/viewer/re_space_view_spatial/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use crate::{
picking::{PickableUiRect, PickingContext, PickingHitType, PickingResult},
view_kind::SpatialSpaceViewKind,
visualizers::{
CamerasVisualizer, DepthImageVisualizer, ImageEncodedVisualizer, ImageVisualizer,
CamerasVisualizer, DepthImageVisualizer, EncodedImageVisualizer, ImageVisualizer,
SegmentationImageVisualizer, UiLabel, UiLabelTarget,
},
};
Expand Down Expand Up @@ -105,7 +105,7 @@ impl SpatialSpaceViewState {
let view_systems = &system_output.view_systems;

self.num_non_segmentation_images_last_frame +=
view_systems.get::<ImageEncodedVisualizer>()?.images.len();
view_systems.get::<EncodedImageVisualizer>()?.images.len();
self.num_non_segmentation_images_last_frame +=
view_systems.get::<ImageVisualizer>()?.images.len();
self.num_non_segmentation_images_last_frame +=
Expand Down Expand Up @@ -389,7 +389,7 @@ pub fn picking(

let depth_images = visualizers.get::<DepthImageVisualizer>()?;
let images = visualizers.get::<ImageVisualizer>()?;
let images_encoded = visualizers.get::<ImageEncodedVisualizer>()?;
let images_encoded = visualizers.get::<EncodedImageVisualizer>()?;
let segmentation_images = visualizers.get::<SegmentationImageVisualizer>()?;
let image_picking_rects = itertools::chain!(
&depth_images.images,
Expand Down
Loading

0 comments on commit 0cc3908

Please sign in to comment.