omx_ffmpeg_colorconv_component.c File Reference

#include <omxcore.h>
#include <omx_ffmpeg_colorconv_component.h>

Go to the source code of this file.

Defines

#define MAX_COMPONENT_VIDEOCOLORCONV   2
#define DEFAULT_WIDTH   352
#define DEFAULT_HEIGHT   288
#define DEFAULT_VIDEO_INPUT_BUF_SIZE   DEFAULT_WIDTH*DEFAULT_HEIGHT*3/2

Functions

enum PixelFormat find_ffmpeg_pxlfmt (OMX_COLOR_FORMATTYPE omx_pxlfmt)
OMX_S32 calcStride (OMX_U32 width, OMX_COLOR_FORMATTYPE omx_pxlfmt)
OMX_ERRORTYPE omx_ffmpeg_colorconv_component_Constructor (OMX_COMPONENTTYPE *openmaxStandComp, OMX_STRING cComponentName)
OMX_ERRORTYPE omx_ffmpeg_colorconv_component_Destructor (OMX_COMPONENTTYPE *openmaxStandComp)
OMX_ERRORTYPE omx_ffmpeg_colorconv_component_Init (OMX_COMPONENTTYPE *openmaxStandComp)
OMX_ERRORTYPE omx_ffmpeg_colorconv_component_Deinit (OMX_COMPONENTTYPE *openmaxStandComp)
void omx_img_copy (OMX_U8 *src_ptr, OMX_S32 src_stride, OMX_U32 src_width, OMX_U32 src_height, OMX_S32 src_offset_x, OMX_S32 src_offset_y, OMX_U8 *dest_ptr, OMX_S32 dest_stride, OMX_U32 dest_width, OMX_U32 dest_height, OMX_S32 dest_offset_x, OMX_S32 dest_offset_y, OMX_S32 cpy_width, OMX_U32 cpy_height, OMX_COLOR_FORMATTYPE colorformat)
void omx_ffmpeg_colorconv_component_BufferMgmtCallback (OMX_COMPONENTTYPE *openmaxStandComp, OMX_BUFFERHEADERTYPE *pInputBuffer, OMX_BUFFERHEADERTYPE *pOutputBuffer)
OMX_ERRORTYPE omx_ffmpeg_colorconv_component_SetConfig (OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nIndex, OMX_PTR pComponentConfigStructure)
OMX_ERRORTYPE omx_ffmpeg_colorconv_component_GetConfig (OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nIndex, OMX_PTR pComponentConfigStructure)
OMX_ERRORTYPE omx_ffmpeg_colorconv_component_SetParameter (OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nParamIndex, OMX_PTR ComponentParameterStructure)
OMX_ERRORTYPE omx_ffmpeg_colorconv_component_GetParameter (OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nParamIndex, OMX_PTR ComponentParameterStructure)
OMX_ERRORTYPE omx_video_colorconv_MessageHandler (OMX_COMPONENTTYPE *openmaxStandComp, internalRequestMessageType *message)
OMX_ERRORTYPE omx_video_colorconv_UseEGLImage (OMX_HANDLETYPE hComponent, OMX_BUFFERHEADERTYPE **ppBufferHdr, OMX_U32 nPortIndex, OMX_PTR pAppPrivate, void *eglImage)


Detailed Description

This component implements a color converter using the FFmpeg software library.

Originally developed by Peter Littlefield Copyright (C) 2007 STMicroelectronics and Agere Systems

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

$Date$ Revision $Rev$ Author $Author$

Definition in file omx_ffmpeg_colorconv_component.c.


Define Documentation

#define DEFAULT_HEIGHT   288

#define DEFAULT_VIDEO_INPUT_BUF_SIZE   DEFAULT_WIDTH*DEFAULT_HEIGHT*3/2

define the max input buffer size

Definition at line 42 of file omx_ffmpeg_colorconv_component.c.

Referenced by omx_ffmpeg_colorconv_component_Constructor().

#define DEFAULT_WIDTH   352

#define MAX_COMPONENT_VIDEOCOLORCONV   2

Maximum Number of Video Color Converter Component Instance

Definition at line 34 of file omx_ffmpeg_colorconv_component.c.

Referenced by omx_ffmpeg_colorconv_component_Constructor().


Function Documentation

OMX_S32 calcStride ( OMX_U32  width,
OMX_COLOR_FORMATTYPE  omx_pxlfmt 
)

enum PixelFormat find_ffmpeg_pxlfmt ( OMX_COLOR_FORMATTYPE  omx_pxlfmt  ) 

Figure out equivalent FFmpeg PixelFormat based on OMX_COLOR_FORMATTYPE

Parameters:
omx_pxlfmt is the input OpenMAX standard pixel format output is the FFmpeg library supported pixel format corresponding to this input pixel format this output FFmpeg pixel format will be needed in port parameter settings

Definition at line 50 of file omx_ffmpeg_colorconv_component.c.

References OMX_COLOR_Format12bitRGB444, OMX_COLOR_Format16bitARGB1555, OMX_COLOR_Format16bitARGB4444, OMX_COLOR_Format16bitBGR565, OMX_COLOR_Format16bitRGB565, OMX_COLOR_Format18bitARGB1665, OMX_COLOR_Format18bitRGB666, OMX_COLOR_Format19bitARGB1666, OMX_COLOR_Format24bitARGB1887, OMX_COLOR_Format24bitBGR888, OMX_COLOR_Format24bitRGB888, OMX_COLOR_Format25bitARGB1888, OMX_COLOR_Format32bitARGB8888, OMX_COLOR_Format32bitBGRA8888, OMX_COLOR_Format8bitRGB332, OMX_COLOR_FormatCbYCrY, OMX_COLOR_FormatCrYCbY, OMX_COLOR_FormatL16, OMX_COLOR_FormatL2, OMX_COLOR_FormatL24, OMX_COLOR_FormatL32, OMX_COLOR_FormatL4, OMX_COLOR_FormatL8, OMX_COLOR_FormatMonochrome, OMX_COLOR_FormatRawBayer10bit, OMX_COLOR_FormatRawBayer8bit, OMX_COLOR_FormatRawBayer8bitcompressed, OMX_COLOR_FormatUnused, OMX_COLOR_FormatYCbYCr, OMX_COLOR_FormatYCrYCb, OMX_COLOR_FormatYUV411PackedPlanar, OMX_COLOR_FormatYUV411Planar, OMX_COLOR_FormatYUV420PackedPlanar, OMX_COLOR_FormatYUV420Planar, OMX_COLOR_FormatYUV420SemiPlanar, OMX_COLOR_FormatYUV422PackedPlanar, OMX_COLOR_FormatYUV422Planar, OMX_COLOR_FormatYUV422SemiPlanar, and OMX_COLOR_FormatYUV444Interleaved.

Referenced by omx_ffmpeg_colorconv_component_SetParameter().

void omx_ffmpeg_colorconv_component_BufferMgmtCallback ( OMX_COMPONENTTYPE openmaxStandComp,
OMX_BUFFERHEADERTYPE pInputBuffer,
OMX_BUFFERHEADERTYPE pOutputBuffer 
)

This function is used to process the input buffer and provide one output buffer

FIXME: Configuration values should be clamped to prevent memory trampling and potential segfaults. It might be best to store clamped AND unclamped values on a per-port basis so that OMX_GetConfig can still return the unclamped ones.

Definition at line 712 of file omx_ffmpeg_colorconv_component.c.

References calcStride(), DEB_LEV_FULL_SEQ, DEBUG, OMX_BUFFERHEADERTYPE::nFilledLen, OMX_BASE_FILTER_INPUTPORT_INDEX, OMX_BASE_FILTER_OUTPUTPORT_INDEX, omx_img_copy(), OMX_MirrorBoth, OMX_MirrorVertical, OMX_BUFFERHEADERTYPE::pBuffer, and OMX_COMPONENTTYPE::pComponentPrivate.

Referenced by omx_ffmpeg_colorconv_component_Constructor().

OMX_ERRORTYPE omx_ffmpeg_colorconv_component_Constructor ( OMX_COMPONENTTYPE openmaxStandComp,
OMX_STRING  cComponentName 
)

OMX_ERRORTYPE omx_ffmpeg_colorconv_component_Deinit ( OMX_COMPONENTTYPE openmaxStandComp  ) 

The Deinitialization function This function dealloates the frames and buffers to store the color converterted output from input yuv

Definition at line 415 of file omx_ffmpeg_colorconv_component.c.

References err, OMX_ErrorNone, and OMX_COMPONENTTYPE::pComponentPrivate.

Referenced by omx_video_colorconv_MessageHandler().

OMX_ERRORTYPE omx_ffmpeg_colorconv_component_Destructor ( OMX_COMPONENTTYPE openmaxStandComp  ) 

OMX_ERRORTYPE omx_ffmpeg_colorconv_component_GetConfig ( OMX_HANDLETYPE  hComponent,
OMX_INDEXTYPE  nIndex,
OMX_PTR  pComponentConfigStructure 
)

OMX_ERRORTYPE omx_ffmpeg_colorconv_component_GetParameter ( OMX_HANDLETYPE  hComponent,
OMX_INDEXTYPE  nParamIndex,
OMX_PTR  ComponentParameterStructure 
)

OMX_ERRORTYPE omx_ffmpeg_colorconv_component_Init ( OMX_COMPONENTTYPE openmaxStandComp  ) 

The Initialization function This function alloates the frames and buffers to store the color converterted output from input yuv

Definition at line 370 of file omx_ffmpeg_colorconv_component.c.

References DEB_LEV_ERR, DEBUG, err, in_height, in_width, OMX_BASE_FILTER_INPUTPORT_INDEX, OMX_BASE_FILTER_OUTPUTPORT_INDEX, OMX_ErrorInsufficientResources, OMX_ErrorNone, out_height, out_width, and OMX_COMPONENTTYPE::pComponentPrivate.

Referenced by omx_video_colorconv_MessageHandler().

OMX_ERRORTYPE omx_ffmpeg_colorconv_component_SetConfig ( OMX_HANDLETYPE  hComponent,
OMX_INDEXTYPE  nIndex,
OMX_PTR  pComponentConfigStructure 
)

OMX_ERRORTYPE omx_ffmpeg_colorconv_component_SetParameter ( OMX_HANDLETYPE  hComponent,
OMX_INDEXTYPE  nParamIndex,
OMX_PTR  ComponentParameterStructure 
)

void omx_img_copy ( OMX_U8 src_ptr,
OMX_S32  src_stride,
OMX_U32  src_width,
OMX_U32  src_height,
OMX_S32  src_offset_x,
OMX_S32  src_offset_y,
OMX_U8 dest_ptr,
OMX_S32  dest_stride,
OMX_U32  dest_width,
OMX_U32  dest_height,
OMX_S32  dest_offset_x,
OMX_S32  dest_offset_y,
OMX_S32  cpy_width,
OMX_U32  cpy_height,
OMX_COLOR_FORMATTYPE  colorformat 
)

This function copies source inmage to destination image of required dimension and color formats

Parameters:
src_ptr is the source image strting pointer
src_stride is the source image stride (src_width * byte_per_pixel)
src_width is source image width & src_height is source image height
src_offset_x & src_offset_y are x,y offset values (if any) from starting pointer
dest_ptr is the destination image strting pointer
dest_stride is the destination image stride (dest_width * byte_per_pixel)
dest_width is destination image width & dest_height is destination image height
dest_offset_x dest_offset_y are x,y offset values (if any) from starting pointer
cpy_width cpy_height is the source image copy width and height - it determines the portion of source image to be copied from source to destination image
colorformat is the source image color format

OpenMAX IL spec says chroma channels are subsampled by 4x horizontally AND vertically in YUV 4:1:1. Conventional wisdom (wiki) tells us that it is only subsampled horizontally. Following OpenMAX spec anyway. Technically I guess this would be YUV 4:1:0.

Pointers to the start of each plane to make things easier

Figure out total offsets

If input stride is negative, reverse source row order

Pointers to use with memcpy

Pointers to destination planes to make things easier

Figure out total offsets

If output stride is negative, reverse destination row order

Pointers to use with memcpy

Definition at line 456 of file omx_ffmpeg_colorconv_component.c.

References calcStride(), DEB_LEV_ERR, DEBUG, OMX_COLOR_FormatYUV411PackedPlanar, OMX_COLOR_FormatYUV411Planar, OMX_COLOR_FormatYUV420PackedPlanar, OMX_COLOR_FormatYUV420Planar, OMX_COLOR_FormatYUV422PackedPlanar, and OMX_COLOR_FormatYUV422Planar.

OMX_ERRORTYPE omx_video_colorconv_MessageHandler ( OMX_COMPONENTTYPE openmaxStandComp,
internalRequestMessageType message 
)

OMX_ERRORTYPE omx_video_colorconv_UseEGLImage ( OMX_HANDLETYPE  hComponent,
OMX_BUFFERHEADERTYPE **  ppBufferHdr,
OMX_U32  nPortIndex,
OMX_PTR  pAppPrivate,
void *  eglImage 
)


Generated for OpenMAX Bellagio rel. 0.3.5-svn by  doxygen 1.5.1
SourceForge.net Logo