Meego Wiki
Views

Quality/TestSuite/Pixel Format Library

From MeeGo wiki
< Quality | TestSuite
Revision as of 13:31, 16 December 2010 by Klaakso (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Introduction

Blts-pixelformat package (0.1.4) provides a pixel format conversion API for the BLTS test assets.

The conversion code is based on the libswscale library of the FFMPEG project (http://www.ffmpeg.org), with modifications to remove unnecessary code. Support for additional V4L2 pixel formats has also been added.

Limitations

For some pixel formats, only limited conversion support is available:

  • V4L2_PIX_FMT_SBGGR8, V4L2_PIX_FMT_SBGGR16, V4L2_PIX_FMT_SGRBG10 (Bayer formats)
* Can be converted only to V4L2_PIX_FMT_RGB24
* Cannot be used as target formats
  • V4L2_PIX_FMT_RGB555X, V4L2_PIX_FMT_RGB565X (big-endian 15- & 16-bit RGB)
* Can be converted to different YUV formats and to V4L2_PIX_FMT_RGB24
* Cannot be used as target formats

Building packages

The build environment must have the following packages installed:

  • libbltscommon-devel

The source package includes the pack.sh script, which is used for building RPM and Debian packages and source tar packages. To build an RPM package with the script, execute this command in the top level source directory of asset:

./pack.sh -r

To get help about the packaging script, execute

./pack.sh -h

The asset can also be built manually by executing:

./autogen.sh
./configure
make

Using the pixel format conversion library with blts tests

Some of blts test packages have dependency to the blts-pixelformat package and blts-pixelformat package itself has dependency to the blts-common package.

The test environment must have following packages installed:

  • libbltscommon1

The library package can be installed in the device by executing the command:

rpm -ivh libbltspixelformat1_{version}.rpm 

Using the pixel format conversion API

The development package can be installed by executing the command:

rpm -ivh libbltspixelformat-devel_{version}.rpm 

The pixel format conversion API is defined in the file blts-pixelformat.h and at the moment there is only one conversion function to use convert_buffer():

#include <blts-pixelformat.h>
#include <linux/videodev2.h> //for pixel format identifiers

int convert_buffer(int width, int height, const unsigned char* srcbuffer, __u32 srcformat, unsigned char** dstbuffer, __u32 dstformat);

convert_buffer() converts the image data in srcbuffer from the source pixel format to the destination pixel format. After a successful conversion, dstbuffer contains a pointer to the converted image buffer. The buffer is allocated dynamically in the conversion function, and must be freed by the caller.

After a successful conversion, dstbuffer contains a pointer to the converted image, and the function returns the size of the converted image in bytes.

If the conversion fails, an error code is returned:

  • -1 The source or destination format is not supported
  • -2 Internal conversion error

The pixel formats are specified with V4L2 pixel format identifiers. The supported formats are:

  • V4L2_PIX_FMT_RGB332
  • V4L2_PIX_FMT_RGB444
  • V4L2_PIX_FMT_RGB555
  • V4L2_PIX_FMT_RGB565
  • V4L2_PIX_FMT_RGB555X
  • V4L2_PIX_FMT_RGB565X
  • V4L2_PIX_FMT_RGB24
  • V4L2_PIX_FMT_BGR24
  • V4L2_PIX_FMT_BGR32
  • V4L2_PIX_FMT_RGB32
  • V4L2_PIX_FMT_GREY
  • V4L2_PIX_FMT_Y16
  • V4L2_PIX_FMT_YUYV
  • V4L2_PIX_FMT_UYVY
  • V4L2_PIX_FMT_Y41P
  • V4L2_PIX_FMT_YVU420
  • V4L2_PIX_FMT_YVU410
  • V4L2_PIX_FMT_YUV422P
  • V4L2_PIX_FMT_YUV411P
  • V4L2_PIX_FMT_NV12
  • V4L2_PIX_FMT_SBGGR8
  • V4L2_PIX_FMT_SBGGR16
  • V4L2_PIX_FMT_SGRBG10
  • V4L2_PIX_FMT_YUV444
  • V4L2_PIX_FMT_YUV555
  • V4L2_PIX_FMT_YUV565
  • V4L2_PIX_FMT_YUV32

Module Design and Architecture

Both Debian and RPM packaging is provided.

The blts-pixelformat package consists of libbltspixelformat1 runtime library and libbltspixelformat-devel development library.

Architecture diagram

References

blts-pixelformat blts-pixelformat library
www.ffmpeg.org FFmpeg project
linux.bytesex.org video4linux website

Change History

Version Date Handled By Status Comments
0.1 15-Dec-2010 Aki Nyman Draft Page created (refers to blts-pixelformat package 0.1.4)
Personal tools