GrkImage.h
Go to the documentation of this file.
#pragma once
#include "grk_includes.h"
#include "lcms2.h"
namespace grk
{
struct Tile;
struct CodingParams;
struct TileComponent;
const uint32_t singleTileRowsPerStrip = 32;
class GrkImageMeta : public grk_image_meta
{
public:
GrkImageMeta();
virtual ~GrkImageMeta();
void releaseColor(void);
void releaseColorPalatte();
void allocPalette(uint8_t num_channels, uint16_t num_entries);
};
class GrkImage : public grk_image
{
friend GrkObjectWrapperImpl<GrkImage>;
public:
GrkImage();
bool subsampleAndReduce(uint32_t reduce);
static GrkImage* create(grk_image* src, uint16_t numcmpts, grk_image_comp* cmptparms,
GRK_COLOR_SPACE clrspc, bool doAllocation);
static bool allocData(grk_image_comp* imageComp, bool clear);
static bool allocData(grk_image_comp* imageComp);
bool allocCompositeData(void);
bool supportsStripCache(CodingParams* cp);
void copyHeader(GrkImage* dest);
void transferDataTo(GrkImage* dest);
void transferDataFrom(const Tile* tile_src_data);
GrkImage* duplicate(const Tile* tile_src);
bool composite(const GrkImage* src);
bool compositeInterleaved(const GrkImage* src);
bool compositeInterleaved(const Tile* src, uint32_t yBegin, uint32_t yEnd);
bool greyToRGB(void);
bool convertToRGB(bool wholeTileDecompress);
bool applyColourManagement(void);
bool applyICC(void);
bool validateICC(void);
void convertPrecision(void);
bool execUpsample(void);
void all_components_data_free(void);
void postReadHeader(CodingParams* cp);
void validateColourSpace(void);
bool isSubsampled();
bool validateZeroed(void);
bool applyColour(void);
bool apply_palette_clr(void);
bool check_color(void);
void apply_channel_definition(void);
void allocPalette(uint8_t num_channels, uint16_t num_entries);
uint32_t width(void) const;
uint32_t height(void) const;
void print(void) const;
bool componentsEqual(bool checkPrecision);
bool componentsEqual(uint16_t firstNComponents, bool checkPrecision);
private:
~GrkImage();
static void single_component_data_free(grk_image_comp* comp);
std::string getColourSpaceString(void);
std::string getICCColourSpaceString(cmsColorSpaceSignature color_space);
bool isValidICCColourSpace(uint32_t signature);
bool needsConversionToRGB(void);
bool isOpacity(uint16_t compno);
bool compositePlanar(const GrkImage* srcImg);
bool generateCompositeBounds(const grk_image_comp* srcComp, uint16_t destCompno,
grk_rect32* destWin);
bool generateCompositeBounds(grk_rect32 src, uint16_t destCompno, grk_rect32* destWin);
bool allComponentsSanityCheck(bool equalPrecision);
grk_image* createRGB(uint16_t numcmpts, uint32_t w, uint32_t h, uint8_t prec);
void sycc_to_rgb(int32_t offset, int32_t upb, int32_t y, int32_t cb, int32_t cr, int32_t* out_r,
int32_t* out_g, int32_t* out_b);
bool sycc444_to_rgb(void);
bool sycc422_to_rgb(bool oddFirstX);
bool sycc420_to_rgb(bool oddFirstX, bool oddFirstY);
bool color_sycc_to_rgb(bool oddFirstX, bool oddFirstY);
bool color_cmyk_to_rgb(void);
bool color_esycc_to_rgb(void);
bool cieLabToRGB(void);
bool componentsEqual(grk_image_comp* src, grk_image_comp* dest, bool checkPrecision);
static void copyComponent(grk_image_comp* src, grk_image_comp* dest);
void scaleComponent(grk_image_comp* component, uint8_t precision);
};
} // namespace grk
grk::GrkImage
Definition GrkImage.h:25
grk::GrkImage::isSubsampled
bool isSubsampled()
Definition GrkImage.cpp:343
grk::GrkImage::apply_channel_definition
void apply_channel_definition(void)
Definition GrkImage.cpp:498
grk::GrkImage::GrkImage
GrkImage()
Definition GrkImage.cpp:6
grk::GrkImage::check_color
bool check_color(void)
Definition GrkImage.cpp:554
grk::GrkImage::color_esycc_to_rgb
bool color_esycc_to_rgb(void)
Definition GrkImage_Conversion.cpp:897
grk::GrkImage::sycc422_to_rgb
bool sycc422_to_rgb(bool oddFirstX)
Definition GrkImage_Conversion.cpp:571
grk::GrkImage::allComponentsSanityCheck
bool allComponentsSanityCheck(bool equalPrecision)
return false if :
Definition GrkImage_Conversion.cpp:16
grk::GrkImage::compositeInterleaved
bool compositeInterleaved(const GrkImage *src)
Interleave image data and copy to interleaved composite image.
Definition GrkImage.cpp:1026
grk::GrkImage::subsampleAndReduce
bool subsampleAndReduce(uint32_t reduce)
Definition GrkImage.cpp:168
grk::GrkImage::convertToRGB
bool convertToRGB(bool wholeTileDecompress)
Definition GrkImage_Conversion.cpp:393
grk::GrkImage::create
static GrkImage * create(grk_image *src, uint16_t numcmpts, grk_image_comp *cmptparms, GRK_COLOR_SPACE clrspc, bool doAllocation)
Create image.
Definition GrkImage.cpp:85
grk::GrkImage::copyHeader
void copyHeader(GrkImage *dest)
Copy only header of image and its component header (no data are copied) if dest image have data,...
Definition GrkImage.cpp:224
grk::GrkImage::color_sycc_to_rgb
bool color_sycc_to_rgb(bool oddFirstX, bool oddFirstY)
Definition GrkImage_Conversion.cpp:801
grk::GrkImage::print
void print(void) const
Definition GrkImage.cpp:32
grk::GrkImage::sycc_to_rgb
void sycc_to_rgb(int32_t offset, int32_t upb, int32_t y, int32_t cb, int32_t cr, int32_t *out_r, int32_t *out_g, int32_t *out_b)
Definition GrkImage_Conversion.cpp:490
grk::GrkImage::applyColourManagement
bool applyColourManagement(void)
Convert to sRGB.
Definition GrkImage_Conversion.cpp:1148
grk::GrkImage::validateICC
bool validateICC(void)
Definition GrkImage_Conversion.cpp:1046
grk::GrkImage::allocCompositeData
bool allocCompositeData(void)
Allocate data for tile compositing.
Definition GrkImage.cpp:841
grk::GrkImage::greyToRGB
bool greyToRGB(void)
Definition GrkImage_Conversion.cpp:344
grk::GrkImage::supportsStripCache
bool supportsStripCache(CodingParams *cp)
Definition GrkImage.cpp:307
grk::GrkImage::validateColourSpace
void validateColourSpace(void)
Definition GrkImage.cpp:353
grk::GrkImage::copyComponent
static void copyComponent(grk_image_comp *src, grk_image_comp *dest)
Definition GrkImage.cpp:42
grk::GrkImage::sycc420_to_rgb
bool sycc420_to_rgb(bool oddFirstX, bool oddFirstY)
Definition GrkImage_Conversion.cpp:662
grk::GrkImage::duplicate
GrkImage * duplicate(const Tile *tile_src)
Create new image and transfer tile buffer data.
Definition GrkImage.cpp:907
grk::GrkImage::compositePlanar
bool compositePlanar(const GrkImage *srcImg)
Copy planar image data to planar composite image.
Definition GrkImage.cpp:1084
grk::GrkImage::apply_palette_clr
bool apply_palette_clr(void)
Definition GrkImage.cpp:700
grk::GrkImage::convertPrecision
void convertPrecision(void)
Definition GrkImage_Conversion.cpp:264
grk::GrkImage::height
uint32_t height(void) const
Definition GrkImage.cpp:27
grk::GrkImage::transferDataFrom
void transferDataFrom(const Tile *tile_src_data)
Definition GrkImage.cpp:934
grk::GrkImage::allocData
static bool allocData(grk_image_comp *imageComp, bool clear)
Allocate data for single image component.
Definition GrkImage.cpp:283
grk::GrkImage::sycc444_to_rgb
bool sycc444_to_rgb(void)
Definition GrkImage_Conversion.cpp:519
grk::GrkImage::color_cmyk_to_rgb
bool color_cmyk_to_rgb(void)
Definition GrkImage_Conversion.cpp:842
grk::GrkImage::applyICC
bool applyICC(void)
Definition GrkImage_Conversion.cpp:1208
grk::GrkImage::cieLabToRGB
bool cieLabToRGB(void)
Definition GrkImage_Conversion.cpp:1477
grk::GrkImage::getColourSpaceString
std::string getColourSpaceString(void)
Definition GrkImage_Conversion.cpp:958
grk::GrkImage::generateCompositeBounds
bool generateCompositeBounds(const grk_image_comp *srcComp, uint16_t destCompno, grk_rect32 *destWin)
Definition GrkImage.cpp:1140
grk::GrkImage::applyColour
bool applyColour(void)
Definition GrkImage.cpp:483
grk::GrkImage::isOpacity
bool isOpacity(uint16_t compno)
Definition GrkImage.cpp:362
grk::GrkImage::isValidICCColourSpace
bool isValidICCColourSpace(uint32_t signature)
Definition GrkImage_Conversion.cpp:1021
grk::GrkImage::needsConversionToRGB
bool needsConversionToRGB(void)
Definition GrkImage_Conversion.cpp:386
grk::GrkImage::postReadHeader
void postReadHeader(CodingParams *cp)
Definition GrkImage.cpp:371
grk::GrkImage::componentsEqual
bool componentsEqual(bool checkPrecision)
Definition GrkImage.cpp:71
grk::GrkImage::~GrkImage
~GrkImage()
Definition GrkImage.cpp:12
grk::GrkImage::transferDataTo
void transferDataTo(GrkImage *dest)
Transfer data to dest for each component, and null out "this" data.
Definition GrkImage.cpp:875
grk::GrkImage::execUpsample
bool execUpsample(void)
Definition GrkImage_Conversion.cpp:81
grk::GrkImage::scaleComponent
void scaleComponent(grk_image_comp *component, uint8_t precision)
Definition GrkImage_Conversion.cpp:233
grk::GrkImage::composite
bool composite(const GrkImage *src)
Definition GrkImage.cpp:949
grk::GrkImage::single_component_data_free
static void single_component_data_free(grk_image_comp *comp)
Definition GrkImage.cpp:1148
grk::GrkImage::width
uint32_t width(void) const
Definition GrkImage.cpp:23
grk::GrkImage::all_components_data_free
void all_components_data_free(void)
Definition GrkImage.cpp:159
grk::GrkImage::getICCColourSpaceString
std::string getICCColourSpaceString(cmsColorSpaceSignature color_space)
Definition GrkImage_Conversion.cpp:994
grk::GrkImage::allocPalette
void allocPalette(uint8_t num_channels, uint16_t num_entries)
Definition GrkImage.cpp:479
grk::GrkImage::createRGB
grk_image * createRGB(uint16_t numcmpts, uint32_t w, uint32_t h, uint8_t prec)
Definition GrkImage_Conversion.cpp:448
grk::GrkImage::validateZeroed
bool validateZeroed(void)
Definition GrkImage.cpp:461
grk::GrkImageMeta
Definition GrkImage.h:15
grk::GrkImageMeta::releaseColor
void releaseColor(void)
Definition GrkImage.cpp:1203
grk::GrkImageMeta::allocPalette
void allocPalette(uint8_t num_channels, uint16_t num_entries)
Definition GrkImage.cpp:1173
grk::GrkImageMeta::~GrkImageMeta
virtual ~GrkImageMeta()
Definition GrkImage.cpp:1167
grk::GrkImageMeta::GrkImageMeta
GrkImageMeta()
Definition GrkImage.cpp:1157
grk::GrkImageMeta::releaseColorPalatte
void releaseColorPalatte()
Definition GrkImage.cpp:1191
grk::GrkObjectWrapperImpl
Definition GrkObjectWrapper.h:23
grk_includes.h
GRK_COLOR_SPACE
enum _GRK_COLOR_SPACE GRK_COLOR_SPACE
Supported color spaces.
grk
Copyright (C) 2016-2023 Grok Image Compression Inc.
Definition ICacheable.h:20
grk::grk_read
void grk_read(const uint8_t *buffer, TYPE *value, uint32_t numBytes)
Definition BufferedStream.h:239
grk::singleTileRowsPerStrip
const uint32_t singleTileRowsPerStrip
Definition GrkImage.h:12
_grk_image_comp
Image component.
Definition grok.h:572
_grk_image_meta
Definition grok.h:603
_grk_image
Definition grok.h:613
_grk_image::precision
grk_precision * precision
Definition grok.h:637
_grk_image::color_space
GRK_COLOR_SPACE color_space
Definition grok.h:627
grk::CodingParams
Coding parameters.
Definition CodingParams.h:245
grk::Tile
Definition TileProcessor.h:39
grk::grk_rect< uint32_t >