Skip to content

Commit

Permalink
move tild and unci image creation to experimental API header
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Oct 6, 2024
1 parent 0b3b415 commit a616322
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 55 deletions.
57 changes: 2 additions & 55 deletions libheif/api/libheif/heif.h
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ struct heif_image_tiling
int version;

// --- version 1

uint32_t num_columns;
uint32_t num_rows;
uint32_t tile_width;
Expand All @@ -1196,6 +1196,7 @@ struct heif_image_tiling

// Position of the top left tile.
// Usually, this is (0;0), but if a tiled image is rotated or cropped, it may be that the top left tile should be placed at a negative position.
// The offsets define this negative shift.
uint32_t top_offset;
uint32_t left_offset;

Expand Down Expand Up @@ -2451,67 +2452,13 @@ struct heif_error heif_context_add_grid_image(struct heif_context* ctx,
const heif_item_id* image_ids,
struct heif_image_handle** out_grid_image_handle);

struct heif_tild_image_parameters {
int version;

// --- version 1

uint32_t image_width;
uint32_t image_height;

uint32_t tile_width;
uint32_t tile_height;

uint32_t compression_type_fourcc; // TODO: can this be set automatically ?

uint8_t offset_field_length; // one of: 32, 40, 48, 64
uint8_t size_field_length; // one of: 0, 24, 32, 64

uint8_t number_of_extra_dimensions; // 0 for normal images, 1 for volumetric (3D), ...
uint32_t extra_dimensions[8]; // size of extra dimensions (first 8 dimensions)

// boolean flags
uint8_t tiles_are_sequential; // TODO: can we derive this automatically
};


LIBHEIF_API
struct heif_error heif_context_add_tild_image(struct heif_context* ctx,
const struct heif_tild_image_parameters* parameters,
const struct heif_encoding_options* options, // TODO: do we need this?
struct heif_image_handle** out_tild_image_handle);

LIBHEIF_API
struct heif_error heif_context_add_image_tile(struct heif_context* ctx,
struct heif_image_handle* tild_image,
uint32_t tile_x, uint32_t tile_y,
const struct heif_image* image,
struct heif_encoder* encoder);

struct heif_unci_image_parameters {
int version;

// --- version 1

uint32_t image_width;
uint32_t image_height;

uint32_t tile_width;
uint32_t tile_height;

enum heif_metadata_compression compression; // TODO

// TODO: interleave type, padding
};


LIBHEIF_API
struct heif_error heif_context_add_unci_image(struct heif_context* ctx,
const struct heif_unci_image_parameters* parameters,
const struct heif_encoding_options* encoding_options,
const struct heif_image* prototype,
struct heif_image_handle** out_unci_image_handle);

// offsets[] should either be NULL (all offsets==0) or an array of size 2*nImages with x;y offset pairs.
// If background_rgba is NULL, the background is transparent.
LIBHEIF_API
Expand Down
60 changes: 60 additions & 0 deletions libheif/api/libheif/heif_experimental.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,66 @@ struct heif_error heif_property_camera_extrinsic_matrix_get_position_vector(cons
struct heif_error heif_property_camera_extrinsic_matrix_get_world_coordinate_system_id(const struct heif_property_camera_extrinsic_matrix* matrix,
uint32_t* out_wcs_id);

// --- Tiled images

struct heif_tild_image_parameters {
int version;

// --- version 1

uint32_t image_width;
uint32_t image_height;

uint32_t tile_width;
uint32_t tile_height;

uint32_t compression_type_fourcc; // TODO: can this be set automatically ?

uint8_t offset_field_length; // one of: 32, 40, 48, 64
uint8_t size_field_length; // one of: 0, 24, 32, 64

uint8_t number_of_extra_dimensions; // 0 for normal images, 1 for volumetric (3D), ...
uint32_t extra_dimensions[8]; // size of extra dimensions (first 8 dimensions)

// boolean flags
uint8_t tiles_are_sequential; // TODO: can we derive this automatically
};


LIBHEIF_API
struct heif_error heif_context_add_tild_image(struct heif_context* ctx,
const struct heif_tild_image_parameters* parameters,
const struct heif_encoding_options* options, // TODO: do we need this?
struct heif_image_handle** out_tild_image_handle);


// --- 'unci' images

struct heif_unci_image_parameters {
int version;

// --- version 1

uint32_t image_width;
uint32_t image_height;

uint32_t tile_width;
uint32_t tile_height;

enum heif_metadata_compression compression; // TODO

// TODO: interleave type, padding
};


LIBHEIF_API
struct heif_error heif_context_add_unci_image(struct heif_context* ctx,
const struct heif_unci_image_parameters* parameters,
const struct heif_encoding_options* encoding_options,
const struct heif_image* prototype,
struct heif_image_handle** out_unci_image_handle);


#ifdef __cplusplus
}
#endif
Expand Down

0 comments on commit a616322

Please sign in to comment.