Skip to content

Commit

Permalink
move API for supporting other pixel datatypes to experimental, remove…
Browse files Browse the repository at this point in the history
… heif_channel_other*
  • Loading branch information
farindk committed Oct 6, 2024
1 parent 4781337 commit deb5668
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 165 deletions.
139 changes: 1 addition & 138 deletions libheif/api/libheif/heif.h
Original file line number Diff line number Diff line change
Expand Up @@ -506,18 +506,7 @@ enum heif_channel
heif_channel_interleaved = 10,
heif_channel_filter_array = 11,
heif_channel_depth = 12,
heif_channel_disparity = 13,
heif_channel_other_first = 1024,
heif_channel_other_last = 4095
};

enum heif_channel_datatype
{
heif_channel_datatype_undefined = 0,
heif_channel_datatype_unsigned_integer = 1,
heif_channel_datatype_signed_integer = 2,
heif_channel_datatype_floating_point = 3,
heif_channel_datatype_complex_number = 4
heif_channel_disparity = 13
};

enum heif_metadata_compression
Expand Down Expand Up @@ -1784,9 +1773,6 @@ struct heif_error heif_image_crop(struct heif_image* img,
LIBHEIF_API
int heif_image_get_bits_per_pixel(const struct heif_image*, enum heif_channel channel);

LIBHEIF_API
enum heif_channel_datatype heif_image_get_datatype(const struct heif_image* img, enum heif_channel channel);

// Get the number of bits per pixel in the given image channel. This function returns
// the number of bits used for representing the pixel value, which might be smaller
// than the number of bits used in memory.
Expand Down Expand Up @@ -1814,123 +1800,6 @@ uint8_t* heif_image_get_plane(struct heif_image*,
int* out_stride);


LIBHEIF_API
int heif_image_list_channels(struct heif_image*,
enum heif_channel** out_channels);

LIBHEIF_API
void heif_channel_release_list(enum heif_channel** channels);


struct heif_complex32 {
float real, imaginary;
};

struct heif_complex64 {
double real, imaginary;
};

// The 'stride' in all of these functions are in units of the underlying datatype.
LIBHEIF_API
const uint16_t* heif_image_get_channel_uint16_readonly(const struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
const uint32_t* heif_image_get_channel_uint32_readonly(const struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
const uint64_t* heif_image_get_channel_uint64_readonly(const struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
const int16_t* heif_image_get_channel_int16_readonly(const struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
const int32_t* heif_image_get_channel_int32_readonly(const struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
const int64_t* heif_image_get_channel_int64_readonly(const struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
const float* heif_image_get_channel_float32_readonly(const struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
const double* heif_image_get_channel_float64_readonly(const struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
const struct heif_complex32* heif_image_get_channel_complex32_readonly(const struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
const struct heif_complex64* heif_image_get_channel_complex64_readonly(const struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
uint16_t* heif_image_get_channel_uint16(struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
uint32_t* heif_image_get_channel_uint32(struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
uint64_t* heif_image_get_channel_uint64(struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
int16_t* heif_image_get_channel_int16(struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
int32_t* heif_image_get_channel_int32(struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
int64_t* heif_image_get_channel_int64(struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
float* heif_image_get_channel_float32(struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
double* heif_image_get_channel_float64(struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
struct heif_complex32* heif_image_get_channel_complex32(struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
struct heif_complex64* heif_image_get_channel_complex64(struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);


struct heif_scaling_options;

Expand Down Expand Up @@ -2568,12 +2437,6 @@ struct heif_error heif_image_add_plane(struct heif_image* image,
enum heif_channel channel,
int width, int height, int bit_depth);

LIBHEIF_API
struct heif_error heif_image_add_channel(struct heif_image* image,
enum heif_channel channel,
int width, int height,
enum heif_channel_datatype datatype, int bit_depth);

// Signal that the image is premultiplied by the alpha pixel values.
LIBHEIF_API
void heif_image_set_premultiplied_alpha(struct heif_image* image,
Expand Down
141 changes: 141 additions & 0 deletions libheif/api/libheif/heif_experimental.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,147 @@ LIBHEIF_API
void heif_pyramid_layer_info_release(struct heif_pyramid_layer_info*);


// --- other pixel datatype support

enum heif_channel_datatype
{
heif_channel_datatype_undefined = 0,
heif_channel_datatype_unsigned_integer = 1,
heif_channel_datatype_signed_integer = 2,
heif_channel_datatype_floating_point = 3,
heif_channel_datatype_complex_number = 4
};


LIBHEIF_API
struct heif_error heif_image_add_channel(struct heif_image* image,
enum heif_channel channel,
int width, int height,
enum heif_channel_datatype datatype, int bit_depth);


LIBHEIF_API
int heif_image_list_channels(struct heif_image*,
enum heif_channel** out_channels);

LIBHEIF_API
void heif_channel_release_list(enum heif_channel** channels);


struct heif_complex32 {
float real, imaginary;
};

struct heif_complex64 {
double real, imaginary;
};

LIBHEIF_API
enum heif_channel_datatype heif_image_get_datatype(const struct heif_image* img, enum heif_channel channel);


// The 'stride' in all of these functions are in units of the underlying datatype.
LIBHEIF_API
const uint16_t* heif_image_get_channel_uint16_readonly(const struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
const uint32_t* heif_image_get_channel_uint32_readonly(const struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
const uint64_t* heif_image_get_channel_uint64_readonly(const struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
const int16_t* heif_image_get_channel_int16_readonly(const struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
const int32_t* heif_image_get_channel_int32_readonly(const struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
const int64_t* heif_image_get_channel_int64_readonly(const struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
const float* heif_image_get_channel_float32_readonly(const struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
const double* heif_image_get_channel_float64_readonly(const struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
const struct heif_complex32* heif_image_get_channel_complex32_readonly(const struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
const struct heif_complex64* heif_image_get_channel_complex64_readonly(const struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
uint16_t* heif_image_get_channel_uint16(struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
uint32_t* heif_image_get_channel_uint32(struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
uint64_t* heif_image_get_channel_uint64(struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
int16_t* heif_image_get_channel_int16(struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
int32_t* heif_image_get_channel_int32(struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
int64_t* heif_image_get_channel_int64(struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
float* heif_image_get_channel_float32(struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
double* heif_image_get_channel_float64(struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
struct heif_complex32* heif_image_get_channel_complex32(struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);

LIBHEIF_API
struct heif_complex64* heif_image_get_channel_complex64(struct heif_image*,
enum heif_channel channel,
uint32_t* out_stride);



#ifdef __cplusplus
}
Expand Down
1 change: 1 addition & 0 deletions libheif/pixelimage.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
//#include "heif.h"
#include "error.h"
#include "nclx.h"
#include <libheif/heif_experimental.h>

#include <vector>
#include <memory>
Expand Down
Loading

0 comments on commit deb5668

Please sign in to comment.