L_SetBitmapYUVData

Summary

Updates the bitmap data using the YUV data from an input buffer. The YUV data is converted to grayscale/BGR before being set in the BITMAPHANDLE.

Syntax

#include "l_bitmap.h"

L_LTKRN_API L_INT L_SetBitmapYUVData(pBitmap, pYuvData, uYuvDataSize, yuvFormat, uFlags)

Parameters

pBITMAPHANDLE pBitmap

Pointer to the bitmap handle that references the bitmap whose data pointer will be set.

const L_VOID *pYuvData

Pointer to a buffer that contains the YUV data (cannot be NULL).

L_SIZE_T uYuvDataSize

Size of the data buffer pointed to by pYuvData. If uYuvDataSize is incorrect, this function fails and displays the ERROR_INVALID_YUV_SIZE error.

L_YUV yuvFormat

Specifies the YUV data format. See L_YUV.

L_UINT uFlags

Unused, reserved for future use. Pass 0.

Returns

Value Meaning
SUCCESS The function was successful.
ERROR_NULL_PTR pBitmap or pYuvData is NULL.
ERROR_BITPERPIXEL pBitmap is not 8-, 24-, or 32-bits per pixel.
ERROR_NO_MEMORY Not enough memory.
ERROR_INV_RANGE Invalid bitmap width or height (usually because they are not multiple of 2).
ERROR_INVALID_YUV_SIZE The size of the YUV data (uYuvDataSize) does not match the width and height values from pBitmap.
ERROR_INVALID_YUV_FORMAT The color space in yuvFormat does not match one of the supported values.
< 1 An error occurred. Refer to Return Codes.

Comments

This function is designed to be used mainly for use in mobile imaging to facilitate filling a BITMAPHANDLE structure using live frames from the mobile device's camera.

If the bitmap is not allocated, it will be allocated using conventional memory. There are restrictions on the bitmap width and height. For 4:1:1 (4:2:0) YUV data, both the bitmap width and height should be multiple of 2. For 4:2:2 YUV data, the bitmap width should be multiple of two.

The function ignores the bitmap's view perspective, so it must match the orientation of the YUV buffer. In most cases, the YUV buffer is top-to-bottom, so the ViewPerspective should be TOP_LEFT. If the YUV buffer is flipped, the ViewPerspective should be BOTTOM_LEFT, so it will be automatically flipped before saving or painting.

The YUV data should contain studio video YUV, with Y values ranging from 16 to 235 and U,V values ranging from 16 to 240. Values outside this range are clipped: values below 16 will be considered as if they were 16. Y values above 235 will be clipped to 235, U/V values above 240 will be clipped to 240.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

For an example, refer to L_GetBitmapYUVData.

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.