|
| IMAGECORE_API void | CopyImage (const FImageView &SrcImage, const FImageView &DestImage) |
| |
| IMAGECORE_API void | CopyImageRGBABGRA (const FImageView &SrcImage, const FImageView &DestImage) |
| |
| IMAGECORE_API void | CopyImageTo2U16 (const FImageView &SrcImage, const FImageView &DestImage) |
| |
| IMAGECORE_API void | TransposeImageRGBABGRA (const FImageView &Image) |
| |
| IMAGECORE_API void | SanitizeFloat16AndSetAlphaOpaqueForBC6H (const FImageView &InOutImage) |
| |
| IMAGECORE_API bool | DetectAlphaChannel (const FImageView &InImage) |
| |
| IMAGECORE_API void | SetAlphaOpaque (const FImageView &InImage) |
| |
| IMAGECORE_API void | ResizeTo (const FImageView &SourceImage, FImage &DestImage, int32 DestSizeX, int32 DestSizeY, ERawImageFormat::Type DestFormat, EGammaSpace DestGammaSpace) |
| |
| IMAGECORE_API void | ComputeChannelLinearMinMax (const FImageView &InImage, FLinearColor &OutMin, FLinearColor &OutMax) |
| |
| IMAGECORE_API bool | ScaleChannelsSoMinMaxIsInZeroToOne (const FImageView &ImageToModify) |
| |
| IMAGECORE_API FLinearColor | ComputeImageLinearAverage (const FImageView &Image) |
| |
| IMAGECORE_API void | TransformToWorkingColorSpace (const FImageView &InLinearImage, const FVector2d &SourceRedChromaticity, const FVector2d &SourceGreenChromaticity, const FVector2d &SourceBlueChromaticity, const FVector2d &SourceWhiteChromaticity, UE::Color::EChromaticAdaptationMethod Method, double EqualityTolerance=1.e-7) |
| |
| | ENUM_CLASS_FLAGS (EResizeImageFilter) |
| |
| IMAGECORE_API void | ResizeImage (const FImageView &SourceImage, const FImageView &DestImage, EResizeImageFilter Filter=EResizeImageFilter::Default) |
| |
| IMAGECORE_API void | ResizeImageAllocDest (const FImageView &SourceImage, FImage &DestImage, int32 DestSizeX, int32 DestSizeY, ERawImageFormat::Type DestFormat, EGammaSpace DestGammaSpace, EResizeImageFilter Filter=EResizeImageFilter::Default) |
| |
| IMAGECORE_API void | ResizeImageAllocDest (const FImageView &SourceImage, FImage &DestImage, int32 DestSizeX, int32 DestSizeY, EResizeImageFilter Filter=EResizeImageFilter::Default) |
| |
| IMAGECORE_API void | ResizeImageInPlace (FImage &Image, int32 DestSizeX, int32 DestSizeY, ERawImageFormat::Type DestFormat, EGammaSpace DestGammaSpace, EResizeImageFilter Filter=EResizeImageFilter::Default) |
| |
| IMAGECORE_API void | ResizeImageInPlace (FImage &Image, int32 DestSizeX, int32 DestSizeY, EResizeImageFilter Filter=EResizeImageFilter::Default) |
| |
| int64 | ImageParallelForComputeNumRows (const FImageView &Image) |
| |
| FImageView | ImageParallelForGetOneRowView (const FImageView &Image, int64 Y) |
| |
| IMAGECORE_API int32 | ImageParallelForComputeNumJobs (const FImageView &Image, int64 *pRowsPerJob) |
| |
| IMAGECORE_API int64 | ImageParallelForMakePart (FImageView *Part, const FImageView &Whole, int64 JobIndex, int64 RowsPerJob) |
| |
| template<typename Lambda > |
| void | ImageParallelFor (const TCHAR *DebugName, const FImageView &Image, const Lambda &Func) |
| |
| template<typename Lambda > |
| void | ProcessLinearPixels (const FImageView &Image, const Lambda &Func, int64 StartY) |
| |
| template<typename Lambda > |
| void | ImageParallelProcessLinearPixels (const TCHAR *DebugName, const FImageView &Image, const Lambda &Func) |
| |
The easy and efficient way to write a pixel processing loop that supports all pixel formats is to use
ImageParallelProcessLinearPixels
passing in a lambda like : ProcessLinearPixelsAction ProcessPixels(TArrayView64<FLinearColor> Colors)
this will let you visit all the pixels as FLinearColor.
You can use this for read (return ProcessLinearPixelsAction::ReadOnly) or read-write (return ProcessLinearPixelsAction::Modified).
Compute the min/max of each channel to get value ranges Colors are converted to float Linear Gamma
- Parameters
-
| InImage | - The image to scan |
| OutMin | - filled with the minimum of the color channels |
| OutMax | - filled with the maximum of the color channels |
Design:
FImage pixels are dense, so we just treat them as a bunch of samples of U8 or U16. (no need to look at width/height/slices at all).
We ignore the pixel format other than knowing it is a U8 or U16 channel. We always work on 16-byte pieces, which can be varying number of pixels.
Cut the data into pieces for parallel processing (16-byte aligned). Find the 16-byte vector min/max on those pieces. Then gather min/max of the 16-bytes from each piece.
For the tail portion that may not be a full 16 bytes, we can just replicate a pixel to fill 16 bytes and use the same 16-byte aligned min/max routines, so no special tail case is required.
Finally once we have the 16-byte min/max of the whole image, we run the Generic fallback which does the horizontal min/max inside that vector, and also handles correctly interpreting whether it is 16xG8 or 4xBGRA8 or whatever.
| bool FImageCore::ScaleChannelsSoMinMaxIsInZeroToOne |
( |
const FImageView & |
ImageToModify | ) |
|
If the image has any values outside the [0,1] range, rescale that edge of the domain so that it is in [0,1] does not affect images that were previously in [0,1]
also does not change the side of the domain that is not out of bounds eg. values in [0.25,200.0] will be rescaled to [0.25,1.0]
returns bool if any change was made
If the input format is U8 or U16, no change will ever be made and this will return false.
This can be useful if you want to save an HDR/float image to a U8 image format for visualization. This is equivalent to what's called the "UNorm" transformation by the RenderTarget ReadPixels functions.