* @param[in] pixelFormat The format of the image pointed at by pixels.
* @param[in] inputWidth The width of the input image.
* @param[in] inputHeight The height of the input image.
+ * @param[in] inputStride The stride of the input image.
* @param[in] desiredWidth The width the client is requesting.
* @param[in] desiredHeight The height the client is requesting.
* @param[out] outWidth The resulting width after downscaling.
* @param[out] outHeight The resulting height after downscaling.
+ * @param[out] outStride The resulting stride after downscaling.
*/
void DownscaleInPlacePow2(unsigned char* const pixels,
Pixel::Format pixelFormat,
unsigned int inputWidth,
unsigned int inputHeight,
+ unsigned int inputStride,
unsigned int desiredWidth,
unsigned int desiredHeight,
FittingMode::Type fittingMode,
SamplingMode::Type samplingMode,
unsigned& outWidth,
- unsigned& outHeight);
+ unsigned& outHeight,
+ unsigned& outStride);
/**
* @brief Destructive in-place downscaling by a power of 2 factor.
* @param[in,out] pixels The buffer both to read from and write the result to.
* @param[in] inputWidth The width of the input image.
* @param[in] inputHeight The height of the input image.
+ * @param[in] inputStride The stride of the input image.
* @param[in] desiredWidth The width the client is requesting.
* @param[in] desiredHeight The height the client is requesting.
* @param[out] outWidth The resulting width after downscaling.
* @param[out] outHeight The resulting height after downscaling.
+ * @param[out] outStride The resulting stride after downscaling.
*/
void DownscaleInPlacePow2RGB888(unsigned char* pixels,
unsigned int inputWidth,
unsigned int inputHeight,
+ unsigned int inputStride,
unsigned int desiredWidth,
unsigned int desiredHeight,
BoxDimensionTest dimensionTest,
unsigned int& outWidth,
- unsigned int& outHeight);
+ unsigned int& outHeight,
+ unsigned int& outStride);
/**
* @copydoc DownscaleInPlacePow2RGB888
void DownscaleInPlacePow2RGBA8888(unsigned char* pixels,
unsigned int inputWidth,
unsigned int inputHeight,
+ unsigned int inputStride,
unsigned int desiredWidth,
unsigned int desiredHeight,
BoxDimensionTest dimensionTest,
unsigned int& outWidth,
- unsigned int& outHeight);
+ unsigned int& outHeight,
+ unsigned int& outStride);
/**
* @copydoc DownscaleInPlacePow2RGB888
void DownscaleInPlacePow2RGB565(unsigned char* pixels,
unsigned int inputWidth,
unsigned int inputHeight,
+ unsigned int inputStride,
unsigned int desiredWidth,
unsigned int desiredHeight,
BoxDimensionTest dimensionTest,
unsigned int& outWidth,
- unsigned int& outHeight);
+ unsigned int& outHeight,
+ unsigned int& outStride);
/**
* @copydoc DownscaleInPlacePow2RGB888
void DownscaleInPlacePow2ComponentPair(unsigned char* pixels,
unsigned int inputWidth,
unsigned int inputHeight,
+ unsigned int inputStride,
unsigned int desiredWidth,
unsigned int desiredHeight,
BoxDimensionTest dimensionTest,
unsigned int& outWidth,
- unsigned int& outHeight);
+ unsigned int& outHeight,
+ unsigned int& outStride);
/**
* @copydoc DownscaleInPlacePow2RGB888
void DownscaleInPlacePow2SingleBytePerPixel(unsigned char* pixels,
unsigned int inputWidth,
unsigned int inputHeight,
+ unsigned int inputStride,
unsigned int desiredWidth,
unsigned int desiredHeight,
BoxDimensionTest dimensionTest,
unsigned int& outWidth,
- unsigned int& outHeight);
+ unsigned int& outHeight,
+ unsigned int& outStride);
/**
* @brief Rescales an input image into the exact output dimensions passed-in.
void PointSample(const unsigned char* inPixels,
unsigned int inputWidth,
unsigned int inputHeight,
+ unsigned int inputStride,
Pixel::Format pixelFormat,
unsigned char* outPixels,
unsigned int desiredWidth,
void PointSample4BPP(const unsigned char* inPixels,
unsigned int inputWidth,
unsigned int inputHeight,
+ unsigned int inputStride,
unsigned char* outPixels,
unsigned int desiredWidth,
unsigned int desiredHeight);
void PointSample3BPP(const unsigned char* inPixels,
unsigned int inputWidth,
unsigned int inputHeight,
+ unsigned int inputStride,
unsigned char* outPixels,
unsigned int desiredWidth,
unsigned int desiredHeight);
void PointSample2BPP(const unsigned char* inPixels,
unsigned int inputWidth,
unsigned int inputHeight,
+ unsigned int inputStride,
unsigned char* outPixels,
unsigned int desiredWidth,
unsigned int desiredHeight);
void PointSample1BPP(const unsigned char* inPixels,
unsigned int inputWidth,
unsigned int inputHeight,
+ unsigned int inputStride,
unsigned char* outPixels,
unsigned int desiredWidth,
unsigned int desiredHeight);
*/
void LinearSample(const unsigned char* __restrict__ inPixels,
ImageDimensions inDimensions,
+ unsigned int inStride,
Pixel::Format pixelFormat,
unsigned char* __restrict__ outPixels,
ImageDimensions outDimensions);
*/
void LinearSample1BPP(const unsigned char* __restrict__ inPixels,
ImageDimensions inputDimensions,
+ unsigned int inputStride,
unsigned char* __restrict__ outPixels,
ImageDimensions desiredDimensions);
*/
void LinearSample2BPP(const unsigned char* __restrict__ inPixels,
ImageDimensions inputDimensions,
+ unsigned int inputStride,
unsigned char* __restrict__ outPixels,
ImageDimensions desiredDimensions);
*/
void LinearSampleRGB565(const unsigned char* __restrict__ inPixels,
ImageDimensions inputDimensions,
+ unsigned int inputStride,
unsigned char* __restrict__ outPixels,
ImageDimensions desiredDimensions);
*/
void LinearSample3BPP(const unsigned char* __restrict__ inPixels,
ImageDimensions inputDimensions,
+ unsigned int inputStride,
unsigned char* __restrict__ outPixels,
ImageDimensions desiredDimensions);
*/
void LinearSample4BPP(const unsigned char* __restrict__ inPixels,
ImageDimensions inputDimensions,
+ unsigned int inputStride,
unsigned char* __restrict__ outPixels,
ImageDimensions desiredDimensions);
*
* @param[in] inPixels Pointer to the input image buffer.
* @param[in] inputDimensions The input dimensions of the image.
+ * @param[in] inputStride The input stride of the image.
* @param[out] outPixels Pointer to the output image buffer.
* @param[in] desiredDimensions The output dimensions of the image.
*/
void LanczosSample4BPP(const unsigned char* __restrict__ inPixels,
ImageDimensions inputDimensions,
+ unsigned int inputStride,
unsigned char* __restrict__ outPixels,
ImageDimensions desiredDimensions);
*
* @param[in] inPixels Pointer to the input image buffer.
* @param[in] inputDimensions The input dimensions of the image.
+ * @param[in] inputStride The input stride of the image.
* @param[out] outPixels Pointer to the output image buffer.
* @param[in] desiredDimensions The output dimensions of the image.
*/
void LanczosSample1BPP(const unsigned char* __restrict__ inPixels,
ImageDimensions inputDimensions,
+ unsigned int inputStride,
unsigned char* __restrict__ outPixels,
ImageDimensions desiredDimensions);
*
* @param[in] inPixels Pointer to the input image buffer.
* @param[in] inputDimensions The input dimensions of the image.
+ * @param[in] inputStride The input stride of the image.
* @param[out] outPixels Pointer to the output image buffer.
* @param[in] desiredDimensions The output dimensions of the image.
*/
void Resample(const unsigned char* __restrict__ inPixels,
ImageDimensions inputDimensions,
+ unsigned int inputStride,
unsigned char* __restrict__ outPixels,
ImageDimensions desiredDimensions,
Resampler::Filter filterType,
* @param[in] pixelsIn The input buffer.
* @param[in] widthIn The width of the input buffer.
* @param[in] heightIn The height of the input buffer.
+ * @param[in] strideIn The stride of the input buffer.
* @param[in] pixelSize The size of the pixel.
* @param[in] radians The rotation angle in radians.
* @param[out] pixelsOut The rotated output buffer.
void RotateByShear(const uint8_t* const pixelsIn,
unsigned int widthIn,
unsigned int heightIn,
+ unsigned int strideIn,
unsigned int pixelSize,
float radians,
uint8_t*& pixelsOut,
* @param[in] pixelsIn The input buffer.
* @param[in] widthIn The width of the input buffer.
* @param[in] heightIn The height of the input buffer.
+ * @param[in] strideIn The stride of the input buffer.
* @param[in] pixelSize The size of the pixel.
* @param[in] radians The shear angle in radians.
* @param[out] pixelsOut The rotated output buffer.
void HorizontalShear(const uint8_t* const pixelsIn,
unsigned int widthIn,
unsigned int heightIn,
+ unsigned int strideIn,
unsigned int pixelSize,
float radians,
uint8_t*& pixelsOut,
return rounded;
}
+/**
+ * @brief Fast multiply & divide by 255. It wiil be useful when we applying alpha value in color
+ *
+ * @param x The value between [0..255]
+ * @param y The value between [0..255]
+ * @return (x*y)/255
+ */
+inline uint8_t MultiplyAndNormalizeColor(const uint8_t& x, const uint8_t& y) noexcept
+{
+ const uint32_t xy = static_cast<const uint32_t>(x) * y;
+ return ((xy << 15) + (xy << 7) + xy) >> 23;
+}
+
/**@}*/
} /* namespace Platform */