L_SetBitmapYUVData

#include "l_bitmap.h"

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

pBITMAPHANDLE pBitmap;

pointer to the bitmap handle

const L_VOID *pYuvData;

data pointer

L_SIZE_T uYuvDataSize;

size of the data buffer pointed to by pYuvData

L_YUV yuvFormat;

data format

L_UINT uFlags;

flags

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.

Parameter

Description

pBitmap

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

pYuvData

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

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.

yuvFormat Specifies the YUV data format.  See L_YUV.
uFlags Unused, reserved for future use.  Pass 0.

Returns

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 (nYuvDataSize) 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

LTKRN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64, Linux.

Help Version 20.0.2018.2.25
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C API Help