Dali 3D User Interface Engine
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
Dali::Internal::Platform Namespace Reference

Namespaces

namespace  anonymous_namespace{image-operations.cpp}
 

Classes

class  FileCloser
 Opens files and closes them later even if an exception is thrown. More...
 
class  ResourceCollector
 Used for platform testing to record the result of resource requests initiated by tests. More...
 

Typedefs

typedef Uint16Pair ImageDimensions
 The integer dimensions of an image or a region of an image packed into 16 bits per component. More...
 
typedef std::map
< Integration::ResourceId,
bool > 
ResourceStatusMap
 Stores true for success and false for a failure for each completed resource id. More...
 
typedef std::map
< Integration::ResourceId,
unsigned > 
ResourceCounterMap
 Stores an integer counter for a resource ID, e.g., to count the number of times a load or a fail is reported. More...
 
typedef std::vector
< Integration::ResourceId
ResourceSequence
 Used to track the order in which a sequence of requests is completed. More...
 

Enumerations

enum  BoxDimensionTest { BoxDimensionTestEither, BoxDimensionTestBoth, BoxDimensionTestX, BoxDimensionTestY }
 Identify which combination of x and y dimensions matter in terminating iterative box filtering. More...
 

Functions

ImageDimensions CalculateDesiredDimensions (ImageDimensions rawDimensions, ImageDimensions requestedDimensions)
 Work out the true desired width and height, accounting for special rules for zeros in either or both input requested dimensions. More...
 
Integration::BitmapPtr CropAndPadForFittingMode (Integration::BitmapPtr bitmap, ImageDimensions desiredDimensions, FittingMode::Type fittingMode)
 Apply cropping and padding for specified fitting mode. More...
 
void AddBorders (PixelBuffer *targetPixels, const unsigned int bytesPerPixel, const ImageDimensions targetDimensions, const ImageDimensions padDimensions)
 Adds horizontal or vertical borders to the source image. More...
 
BitmapPtr ApplyAttributesToBitmap (Integration::BitmapPtr bitmap, ImageDimensions dimensions, FittingMode::Type fittingMode=FittingMode::DEFAULT, SamplingMode::Type samplingMode=SamplingMode::DEFAULT)
 Apply requested attributes to bitmap. More...
 
Integration::BitmapPtr DownscaleBitmap (Integration::Bitmap &bitmap, ImageDimensions desired, FittingMode::Type fittingMode, SamplingMode::Type samplingMode)
 Apply downscaling to a bitmap according to requested attributes. More...
 
void HalveScanlineInPlaceRGB888 (unsigned char *pixels, unsigned int width)
 Average adjacent pairs of pixels, overwriting the input array. More...
 
void HalveScanlineInPlaceRGBA8888 (unsigned char *pixels, unsigned int width)
 Average adjacent pairs of pixels, overwriting the input array. More...
 
void HalveScanlineInPlaceRGB565 (unsigned char *pixels, unsigned int width)
 Average adjacent pairs of pixels, overwriting the input array. More...
 
void HalveScanlineInPlace2Bytes (unsigned char *pixels, unsigned int width)
 Average adjacent pairs of pixels, overwriting the input array. More...
 
void HalveScanlineInPlace1Byte (unsigned char *pixels, unsigned int width)
 Average adjacent pairs of pixels, overwriting the input array. More...
 
void AverageScanlines1 (const unsigned char *const scanline1, const unsigned char *const __restrict__ scanline2, unsigned char *const outputScanline, const unsigned int width)
 : Optimise for ARM using a 4 bytes at a time loop wrapped around the single ARMV6 instruction: UHADD8 R4, R0, R5. More...
 
void AverageScanlines2 (const unsigned char *const scanline1, const unsigned char *const __restrict__ scanline2, unsigned char *const outputScanline, const unsigned int width)
 
void AverageScanlines3 (const unsigned char *const scanline1, const unsigned char *const __restrict__ scanline2, unsigned char *const outputScanline, const unsigned int width)
 
void AverageScanlinesRGBA8888 (const unsigned char *const scanline1, const unsigned char *const __restrict__ scanline2, unsigned char *const outputScanline, const unsigned int width)
 
void AverageScanlinesRGB565 (const unsigned char *const scanline1, const unsigned char *const __restrict__ scanline2, unsigned char *const outputScanline, const unsigned int width)
 
void DownscaleInPlacePow2 (unsigned char *const pixels, Pixel::Format pixelFormat, unsigned int inputWidth, unsigned int inputHeight, unsigned int desiredWidth, unsigned int desiredHeight, FittingMode::Type fittingMode, SamplingMode::Type samplingMode, unsigned &outWidth, unsigned &outHeight)
 Dispatch to pixel format appropriate box filter downscaling functions. More...
 
void DownscaleInPlacePow2RGB888 (unsigned char *pixels, unsigned int inputWidth, unsigned int inputHeight, unsigned int desiredWidth, unsigned int desiredHeight, BoxDimensionTest dimensionTest, unsigned &outWidth, unsigned &outHeight)
 
void DownscaleInPlacePow2RGBA8888 (unsigned char *pixels, unsigned int inputWidth, unsigned int inputHeight, unsigned int desiredWidth, unsigned int desiredHeight, BoxDimensionTest dimensionTest, unsigned &outWidth, unsigned &outHeight)
 
void DownscaleInPlacePow2RGB565 (unsigned char *pixels, unsigned int inputWidth, unsigned int inputHeight, unsigned int desiredWidth, unsigned int desiredHeight, BoxDimensionTest dimensionTest, unsigned int &outWidth, unsigned int &outHeight)
  More...
 
void DownscaleInPlacePow2ComponentPair (unsigned char *pixels, unsigned int inputWidth, unsigned int inputHeight, unsigned int desiredWidth, unsigned int desiredHeight, BoxDimensionTest dimensionTest, unsigned &outWidth, unsigned &outHeight)
  More...
 
void DownscaleInPlacePow2SingleBytePerPixel (unsigned char *pixels, unsigned int inputWidth, unsigned int inputHeight, unsigned int desiredWidth, unsigned int desiredHeight, BoxDimensionTest dimensionTest, unsigned int &outWidth, unsigned int &outHeight)
  More...
 
void PointSample4BPP (const unsigned char *inPixels, unsigned int inputWidth, unsigned int inputHeight, unsigned char *outPixels, unsigned int desiredWidth, unsigned int desiredHeight)
 Rescales an input image into the exact output dimensions passed-in. More...
 
void PointSample2BPP (const unsigned char *inPixels, unsigned int inputWidth, unsigned int inputHeight, unsigned char *outPixels, unsigned int desiredWidth, unsigned int desiredHeight)
 Rescales an input image into the exact output dimensions passed-in. More...
 
void PointSample1BPP (const unsigned char *inPixels, unsigned int inputWidth, unsigned int inputHeight, unsigned char *outPixels, unsigned int desiredWidth, unsigned int desiredHeight)
 Rescales an input image into the exact output dimensions passed-in. More...
 
void PointSample3BPP (const uint8_t *inPixels, unsigned int inputWidth, unsigned int inputHeight, uint8_t *outPixels, unsigned int desiredWidth, unsigned int desiredHeight)
 
void PointSample (const unsigned char *inPixels, unsigned int inputWidth, unsigned int inputHeight, Pixel::Format pixelFormat, unsigned char *outPixels, unsigned int desiredWidth, unsigned int desiredHeight)
 Rescales an input image into the exact output dimensions passed-in. More...
 
void LinearSample1BPP (const unsigned char *__restrict__ inPixels, ImageDimensions inputDimensions, unsigned char *__restrict__ outPixels, ImageDimensions desiredDimensions)
 Resample input image to output image using a bilinear filter. More...
 
void LinearSample2BPP (const unsigned char *__restrict__ inPixels, ImageDimensions inputDimensions, unsigned char *__restrict__ outPixels, ImageDimensions desiredDimensions)
 Resample input image to output image using a bilinear filter. More...
 
void LinearSampleRGB565 (const unsigned char *__restrict__ inPixels, ImageDimensions inputDimensions, unsigned char *__restrict__ outPixels, ImageDimensions desiredDimensions)
 Resample input image to output image using a bilinear filter. More...
 
void LinearSample3BPP (const unsigned char *__restrict__ inPixels, ImageDimensions inputDimensions, unsigned char *__restrict__ outPixels, ImageDimensions desiredDimensions)
 Resample input image to output image using a bilinear filter. More...
 
void LinearSample4BPP (const unsigned char *__restrict__ inPixels, ImageDimensions inputDimensions, unsigned char *__restrict__ outPixels, ImageDimensions desiredDimensions)
 Resample input image to output image using a bilinear filter. More...
 
void LinearSample (const unsigned char *__restrict__ inPixels, ImageDimensions inDimensions, Pixel::Format pixelFormat, unsigned char *__restrict__ outPixels, ImageDimensions outDimensions)
 Resample input image to output image using a bilinear filter. More...
 
void DownscaleInPlacePow2RGB888 (unsigned char *pixels, unsigned int inputWidth, unsigned int inputHeight, unsigned int desiredWidth, unsigned int desiredHeight, BoxDimensionTest dimensionTest, unsigned int &outWidth, unsigned int &outHeight)
 Destructive in-place downscaling by a power of 2 factor. More...
 
void DownscaleInPlacePow2RGBA8888 (unsigned char *pixels, unsigned int inputWidth, unsigned int inputHeight, unsigned int desiredWidth, unsigned int desiredHeight, BoxDimensionTest dimensionTest, unsigned int &outWidth, unsigned int &outHeight)
  More...
 
void DownscaleInPlacePow2ComponentPair (unsigned char *pixels, unsigned int inputWidth, unsigned int inputHeight, unsigned int desiredWidth, unsigned int desiredHeight, BoxDimensionTest dimensionTest, unsigned int &outWidth, unsigned int &outHeight)
  More...
 
void PointSample3BPP (const unsigned char *inPixels, unsigned int inputWidth, unsigned int inputHeight, unsigned char *outPixels, unsigned int desiredWidth, unsigned int desiredHeight)
 Rescales an input image into the exact output dimensions passed-in. More...
 
void AverageScanlines1 (const unsigned char *scanline1, const unsigned char *scanline2, unsigned char *outputScanline, unsigned int width)
 Average pixels at corresponding offsets in two scanlines. More...
 
void AverageScanlines2 (const unsigned char *scanline1, const unsigned char *scanline2, unsigned char *outputScanline, unsigned int width)
 : Optimise for ARM using a 4 bytes at a time loop wrapped around the single ARMV6 instruction: UHADD8 R4, R0, R5. More...
 
void AverageScanlines3 (const unsigned char *scanline1, const unsigned char *scanline2, unsigned char *outputScanline, unsigned int width)
 : Optimise for ARM using a 4 bytes at a time loop wrapped around the single ARMV6 instruction: UHADD8 R4, R0, R5. More...
 
void AverageScanlinesRGBA8888 (const unsigned char *scanline1, const unsigned char *scanline2, unsigned char *outputScanline, unsigned int width)
 : Optimise for ARM using a 4 bytes at a time loop wrapped around the single ARMV6 instruction: UHADD8 R4, R0, R5. More...
 
void AverageScanlinesRGB565 (const unsigned char *scanline1, const unsigned char *scanline2, unsigned char *outputScanline, unsigned int width)
 : Optimise for ARM using a 4 bytes at a time loop wrapped around the single ARMV6 instruction: UHADD8 R4, R0, R5. More...
 
unsigned int AverageComponent (unsigned int a, unsigned int b)
 Average two integer arguments. More...
 
uint32_t AveragePixelRGBA8888 (uint32_t a, uint32_t b)
 Average a pair of RGBA8888 pixels. More...
 
uint32_t AveragePixelRGB565 (uint32_t a, uint32_t b)
 Average a pair of RGB565 pixels. More...
 
unsigned int WeightedBlendIntToFixed1616 (unsigned int a, unsigned int b, unsigned int fractBlend)
 
uint64_t WeightedBlendFixed1616ToFixed1632 (unsigned int a, unsigned int b, unsigned int fractBlend)
 Blend two 16.16 inputs to give a 16.32 output. More...
 
unsigned int BilinearFilter1Component (unsigned int tl, unsigned int tr, unsigned int bl, unsigned int br, unsigned int fractBlendHorizontal, unsigned int fractBlendVertical)
 Blend 4 taps into one value using horizontal and vertical weights. More...
 
void PollForNotification (ResourceCollector &collector, Integration::PlatformAbstraction &abstraction, const unsigned maxPolls=100)
 Helper to poll the abstraction for notifications assuming loads have been issued to it previously and are in-flight. More...
 

Variables

enum
Dali::Internal::Platform::BoxDimensionTest 
__attribute__
 

Typedef Documentation

The integer dimensions of an image or a region of an image packed into 16 bits per component.

Note
This can only be used for images of up to 65535 x 65535 pixels.

Definition at line 51 of file image-operations.h.

Stores an integer counter for a resource ID, e.g., to count the number of times a load or a fail is reported.

Definition at line 41 of file resource-collector.h.

Used to track the order in which a sequence of requests is completed.

Definition at line 43 of file resource-collector.h.

Stores true for success and false for a failure for each completed resource id.

Definition at line 38 of file resource-collector.h.

Enumeration Type Documentation

Identify which combination of x and y dimensions matter in terminating iterative box filtering.

Enumerator
BoxDimensionTestEither 
BoxDimensionTestBoth 
BoxDimensionTestX 
BoxDimensionTestY 

Definition at line 38 of file image-operations.h.

Function Documentation

void Dali::Internal::Platform::AddBorders ( PixelBuffer targetPixels,
const unsigned int  bytesPerPixel,
const ImageDimensions  targetDimensions,
const ImageDimensions  padDimensions 
)

Adds horizontal or vertical borders to the source image.

Parameters
[in]targetPixelsThe destination image pointer to draw the borders on.
[in]bytesPerPixelThe number of bytes per pixel of the target pixel buffer.
[in]targetDimensionsThe dimensions of the destination image.
[in]padDimensionsThe columns and scanlines to pad with borders.

Definition at line 631 of file image-operations.cpp.

References Dali::Uint16Pair::GetHeight(), and Dali::Uint16Pair::GetWidth().

Referenced by CropAndPadForFittingMode().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Platform::AverageScanlines1 ( const unsigned char *const  scanline1,
const unsigned char *const __restrict__  scanline2,
unsigned char *const  outputScanline,
const unsigned int  width 
)

: Optimise for ARM using a 4 bytes at a time loop wrapped around the single ARMV6 instruction: UHADD8 R4, R0, R5.

Note, this is not neon. It runs in the normal integer pipeline so there is no downside like a stall moving between integer and copro, or extra power for clocking-up the idle copro. if (widthInComponents >= 7) { word32* aligned1 = scanline1 + 3 & 3; word32* aligned1_end = scanline1 + widthInPixels & 3; while(aligned1 < aligned1_end) { UHADD8 *aligned1++, *aligned2++, *alignedoutput++ } .. + 0 to 3 spare pixels at each end.

Definition at line 952 of file image-operations.cpp.

References AverageComponent(), Dali::Internal::Platform::anonymous_namespace{image-operations.cpp}::DebugAssertDualScanlineParameters(), and width.

Referenced by UtcDaliImageOperationsAverageScanlines1().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Platform::AverageScanlines2 ( const unsigned char *const  scanline1,
const unsigned char *const __restrict__  scanline2,
unsigned char *const  outputScanline,
const unsigned int  width 
)

Definition at line 965 of file image-operations.cpp.

References AverageComponent(), and Dali::Internal::Platform::anonymous_namespace{image-operations.cpp}::DebugAssertDualScanlineParameters().

Referenced by UtcDaliImageOperationsAverageScanlines2().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Platform::AverageScanlines3 ( const unsigned char *const  scanline1,
const unsigned char *const __restrict__  scanline2,
unsigned char *const  outputScanline,
const unsigned int  width 
)

Definition at line 978 of file image-operations.cpp.

References AverageComponent(), and Dali::Internal::Platform::anonymous_namespace{image-operations.cpp}::DebugAssertDualScanlineParameters().

Referenced by UtcDaliImageOperationsAverageScanlines3().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Platform::AverageScanlinesRGB565 ( const unsigned char *const  scanline1,
const unsigned char *const __restrict__  scanline2,
unsigned char *const  outputScanline,
const unsigned int  width 
)

Definition at line 1011 of file image-operations.cpp.

References AveragePixelRGB565(), DALI_ASSERT_DEBUG, Dali::Internal::Platform::anonymous_namespace{image-operations.cpp}::DebugAssertDualScanlineParameters(), and width.

Referenced by UtcDaliImageOperationsAverageScanlinesRGB565().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Platform::AverageScanlinesRGBA8888 ( const unsigned char *const  scanline1,
const unsigned char *const __restrict__  scanline2,
unsigned char *const  outputScanline,
const unsigned int  width 
)

Definition at line 991 of file image-operations.cpp.

References AveragePixelRGBA8888(), DALI_ASSERT_DEBUG, Dali::Internal::Platform::anonymous_namespace{image-operations.cpp}::DebugAssertDualScanlineParameters(), and width.

Referenced by UtcDaliImageOperationsAverageScanlinesRGBA8888().

Here is the call graph for this function:

Here is the caller graph for this function:

ImageDimensions Dali::Internal::Platform::CalculateDesiredDimensions ( ImageDimensions  rawDimensions,
ImageDimensions  requestedDimensions 
)

Work out the true desired width and height, accounting for special rules for zeros in either or both input requested dimensions.

Parameters
[in]rawDimensionsWidth and height of image before processing.
[in]requestedDimensionsWidth and height of area to scale image into. Can be zero.
Returns
Dimensions of area to scale image into after special rules are applied.

Definition at line 467 of file image-operations.cpp.

References Dali::Uint16Pair::GetHeight(), and Dali::Uint16Pair::GetWidth().

Referenced by ApplyAttributesToBitmap(), and Dali::TizenPlatform::TransformSize().

Here is the call graph for this function:

Here is the caller graph for this function:

BitmapPtr Dali::Internal::Platform::CropAndPadForFittingMode ( Integration::BitmapPtr  bitmap,
ImageDimensions  desiredDimensions,
FittingMode::Type  fittingMode 
)

Apply cropping and padding for specified fitting mode.

Once the bitmap has been (optionally) downscaled to an appropriate size, this method performs alterations based on the fitting mode.

This will add vertical or horizontal borders if necessary. Crop the source image data vertically or horizontally if necessary. The aspect of the source image is preserved. If the source image is smaller than the desired size, the algorithm will modify the the newly created bitmaps dimensions to only be as large as necessary, as a memory saving optimization. This will cause GPU scaling to be performed at render time giving the same result with less texture traversal.

Parameters
[in]bitmapThe source bitmap to perform modifications on.
[in]desiredDimensionsThe target dimensions to aim to fill based on the fitting mode.
[in]fittingModeThe fitting mode to use.
Returns
A new bitmap with the padding and cropping required for fitting mode applied. If no modification is needed or possible, the passed in bitmap is returned.

Definition at line 535 of file image-operations.cpp.

References AddBorders(), Dali::Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, Dali::Internal::Platform::anonymous_namespace{image-operations.cpp}::CalculateBordersFromFittingMode(), DALI_ASSERT_DEBUG, DALI_LOG_WARNING, Dali::Integration::Bitmap::GetBuffer(), Dali::Pixel::GetBytesPerPixel(), Dali::Uint16Pair::GetHeight(), Dali::Integration::Bitmap::GetImageHeight(), Dali::Integration::Bitmap::GetImageWidth(), Dali::Integration::Bitmap::GetPackedPixelsProfile(), Dali::Integration::Bitmap::GetPixelFormat(), Dali::Uint16Pair::GetWidth(), Dali::Internal::Platform::anonymous_namespace{image-operations.cpp}::MAXIMUM_TARGET_BITMAP_SIZE(), Dali::Integration::Bitmap::New(), Dali::ResourcePolicy::OWNED_DISCARD, Dali::Integration::Bitmap::PackedPixelsProfile::ReserveBuffer(), Dali::Uint16Pair::SetHeight(), and Dali::Uint16Pair::SetWidth().

Referenced by ApplyAttributesToBitmap().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Platform::DownscaleInPlacePow2ComponentPair ( unsigned char *  pixels,
unsigned int  inputWidth,
unsigned int  inputHeight,
unsigned int  desiredWidth,
unsigned int  desiredHeight,
BoxDimensionTest  dimensionTest,
unsigned &  outWidth,
unsigned &  outHeight 
)
void Dali::Internal::Platform::DownscaleInPlacePow2RGB888 ( unsigned char *  pixels,
unsigned int  inputWidth,
unsigned int  inputHeight,
unsigned int  desiredWidth,
unsigned int  desiredHeight,
BoxDimensionTest  dimensionTest,
unsigned &  outWidth,
unsigned &  outHeight 
)

Definition at line 1085 of file image-operations.cpp.

Referenced by DownscaleInPlacePow2(), and UtcDaliImageOperationsDownscaleInPlacePow2RGB888().

Here is the caller graph for this function:

void Dali::Internal::Platform::DownscaleInPlacePow2RGBA8888 ( unsigned char *  pixels,
unsigned int  inputWidth,
unsigned int  inputHeight,
unsigned int  desiredWidth,
unsigned int  desiredHeight,
BoxDimensionTest  dimensionTest,
unsigned &  outWidth,
unsigned &  outHeight 
)
void Dali::Internal::Platform::PointSample3BPP ( const uint8_t *  inPixels,
unsigned int  inputWidth,
unsigned int  inputHeight,
uint8_t *  outPixels,
unsigned int  desiredWidth,
unsigned int  desiredHeight 
)

: Optimise - Benchmark one 32bit load that will be unaligned 2/3 of the time + 3 rotate and masks, versus these three aligned byte loads, versus using an RGB packed, aligned(1) struct and letting compiler pick a strategy.

Definition at line 1248 of file image-operations.cpp.

Referenced by PointSample(), and UtcDaliImageOperationsPointSampleRGB88InBounds().

Here is the caller graph for this function:

void Dali::Internal::Platform::PollForNotification ( ResourceCollector &  collector,
Integration::PlatformAbstraction &  abstraction,
const unsigned  maxPolls 
)

Helper to poll the abstraction for notifications assuming loads have been issued to it previously and are in-flight.

Definition at line 62 of file resource-collector.cpp.

References Dali::Integration::PlatformAbstraction::GetResources(), and Dali::Internal::Platform::ResourceCollector::mGrandTotalNotifications.

Referenced by UtcDaliCancelAllLoads().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

enum Dali::Internal::Platform::BoxDimensionTest Dali::Internal::Platform::__attribute__
Dali Docs Home
Read more about Dali