📄 tmdlmbs.h
字号:
//-----------------------------------------------------------------------------
// (C) Copyright 2003 Philips Semiconductors, All rights reserved
//
// This source code and any compilation or derivative thereof is the sole
// property of Philips Corporation and is provided pursuant to a Software
// License Agreement. This code is the proprietary information of Philips
// Corporation and is confidential in nature. Its use and dissemination by
// any party other than Philips Corporation is strictly limited by the
// confidential information provisions of the Agreement referenced above.
//-----------------------------------------------------------------------------
// FILE NAME: tmdlMbs.h
//
// DESCRIPTION: This header file describes definitions, types,and functions
// exported by the memory based scaler (MBS) device library.
//
// The MBS device library streams video and graphic buffers from
// memory to memory, performing the following tasks:
//
// - up and downscaling (linear and non-linear)
// - color space conversion
// - de-interlacing
// - planarization (to planar and semi-planar formats)
// - deplanarization
//
//
//
// MBS Device Library Interface Summary
// ====================================
//
// instance creation and configuration:
// -----------------------------------
// tmdlMbsOpen:
// A caller using the MBS interface starts by claiming the device using
// the tmdlMbsOpen function call. MBS instance sharing is supported,
// therefore multiple instances can be opened for each HW unit.
// Prior to opening an MBS instance, only the software version, number of
// units, and get capabilities functions can be called (they don't require
// a MBS instance as an input parameter).
//
// tmdlMbsInstanceSetup:
// Once an MBS instance is opened, device initialization then starts with a
// call to tmdlMbsInstanceSetup that sets up the basic instance functionality
// and initializes instance specific data. No MBS control registers will be
// touched as the MBS operation is task based. The first call to InstanceSetup
// will install an interrupt handler and initialize task dispatching.
//
// task management functions:
// --------------------------
// tmdlMbsTaskCreate and tmdlMbsTaskDestroy:
// Creates a scaling task with the specified settings. The device library uses
// the task descriptor to store all the information needed to schedule and
// execute the task. After the task has been created, the task descriptor can
// be modified by applications without interfering with the dispatcher. The
// function returns a task handle that is used for future operations on the
// task (updating, dispatching...). tmdlMbsTaskDestroy destroys the task handle
// and associated resources.
//
// tmdlMbsTaskDispatch and tmdlMbsTaskAbort:
// The task is placed in the task queue, and moved to the HW FIFO when room is
// available. A task can be aborted while still in the software Queue
// (tmdlMbsTaskPending state).
//
// task update functions:
// ----------------------
// * tmdlMbsTaskUpdateFilterSetup
// * tmdlMbsTaskUpdateMeas
// * tmdlMbsTaskUpdateMeasBuffer
// * tmdlMbsTaskUpdateRects
// * tmdlMbsTaskUpdateSrcPosition:
// * tmdlMbsTaskUpdateEddi
// * tmdlMbsTaskUpdateEddiLevel
// * tmdlMbsTaskUpdateDei
// * tmdlMbsTaskUpdateDeiBufferFlag// * tmdlMbsTaskUpdateDynZoom
// * tmdlMbsTaskUpdateHorzOutputShift
// * tmdlMbsTaskUpdateVertOutputShift
// * tmdlMbsTaskUpdateHorzCoeffs
// * tmdlMbsTaskUpdateVertCoeffs
//
// DOCUMENT REF:
//
//-----------------------------------------------------------------------------
// NOTES:
//
// Acronyms & Abbreviations:
//
// AIR Angular Interpolation Region
// EDDI Edge Detect De-Interlacing
// MBS Memory Based Scaler
//
// Terminology:
//
// odd field == top field, buffer lines 0, 2, 4, 6, etc
// even field == bottom field, buffer lines 1, 3, 5, 7, etc
//-----------------------------------------------------------------------------
#ifndef TMDLMBS_H
#define TMDLMBS_H
//-----------------------------------------------------------------------------
// Standard include files:
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Project include files:
//-----------------------------------------------------------------------------
#include <tmNxCompId.h>#include <tmNxModId.h> // component ID's and error codes#include <tmAvFormats.h> // audio and video formats and types
#include <tmdlVidMeas.h>
#ifdef __cplusplus
extern "C"
{
#endif
//-----------------------------------------------------------------------------
// Types and defines:
//-----------------------------------------------------------------------------
// callback function declaration
//
//typedef Void (*tmCallback_t) ( UInt32 events, // trigger events
// Void* pData, // ptmdlMbsTaskHandle_t
// UInt32 userData ); // user's context
// compatibility and version numbers
//
// 1/1/0 to 2/2/0
// changes to the tmdlMbsInstanceSetup_t and tmdlMbsTaskDescriptor_t
// structures.
//
// 2/2/0 to 3/3/0
// addition of memBuf3 to tmdlMbsBufSetup_t structure to support 3-field
// majority select de-interlacing.
//
// 3/3/0 to 4/4/0
// changed the calling parameters to tmdlMbsTaskDispatch to support 3-field
// majority select de-interlacing. Added tmdlMbsTaskUpdateRects and
// tmdlMbsTaskUpdateSrcPosition exported functions.
//
// 4/4/0 to 5/5/0
// updated to support Viper2 with EDDI and measurement blocks
//
#define MBS_DL_COMP_NUM 5 // compatibility number
#define MBS_DL_MAJOR_VER 5 // major version number
#define MBS_DL_MINOR_VER 0 // minor version number
// error codes
#define MBS_DL_ERR_BASE (CID_COMP_MBS | CID_LAYER_DEVLIB)
#define MBS_DL_ERR_COMP (CID_COMP_MBS | CID_LAYER_DEVLIB | \
TM_ERR_COMP_UNIQUE_START)
#define TMDL_ERR_MBS_COMPATIBILITY (MBS_DL_ERR_BASE + TM_ERR_COMPATIBILITY)
#define TMDL_ERR_MBS_MAJOR_VERSION (MBS_DL_ERR_BASE + TM_ERR_MAJOR_VERSION)
#define TMDL_ERR_MBS_SWHW_COMPATIBILITY (MBS_DL_ERR_BASE + TM_ERR_BAD_MODULE_ID)
#define TMDL_ERR_MBS_BAD_UNIT_NUMBER (MBS_DL_ERR_BASE + TM_ERR_BAD_UNIT_NUMBER)
#define TMDL_ERR_MBS_BAD_PARAMETER (MBS_DL_ERR_BASE + TM_ERR_BAD_PARAMETER)
#define TMDL_ERR_MBS_BAD_INSTANCE (MBS_DL_ERR_BASE + TM_ERR_BAD_INSTANCE)
#define TMDL_ERR_MBS_NOT_INITIALIZED (MBS_DL_ERR_BASE + TM_ERR_NOT_INITIALIZED)
#define TMDL_ERR_MBS_INIT_FAILED (MBS_DL_ERR_BASE + TM_ERR_INIT_FAILED)
#define TMDL_ERR_MBS_NO_RESOURCES (MBS_DL_ERR_BASE + TM_ERR_NO_RESOURCES)
#define TMDL_ERR_MBS_NOT_SUPPORTED (MBS_DL_ERR_BASE + TM_ERR_NOT_SUPPORTED)
#define TMDL_ERR_MBS_NULL_PARAMETER (MBS_DL_ERR_BASE + TM_ERR_NULL_PARAMETER)
#define TMDL_ERR_MBS_BUSY (MBS_DL_ERR_BASE + TM_ERR_BUSY)
#define TMDL_ERR_MBS_OVERFLOW (MBS_DL_ERR_BASE + TM_ERR_OVERFLOW)
// MBS specific errors
#define TMDL_ERR_MBS_BAD_SLICE (MBS_DL_ERR_COMP + 1)
// global defines
#define MBS_DEFAULT_MODULE 0 // handle for default/unused modules
// minimum rectangle size required by the MBS (src, dst, and slice)
//
// NOTE: upscaling slices, with a destination slice generating a source
// slice smaller than the minimum size, will return an error!!
//
// These minimums are needed due to hardware requirements when using
// certain buffer formats and scaling features.
#define MBS_RECT_MIN_WIDTH 16
#define MBS_RECT_MIN_HEIGHT 16
// maximum values for the MSA 3-field dynamic mode control parameters
//
#define MBS_MSA3_CTRL_T1_MAX 7
#define MBS_MSA3_CTRL_T2_MAX 7
///////////////////////////////////////////////////////////////////////////////
// Generic structures
///////////////////////////////////////////////////////////////////////////////
typedef Int32 tmdlMbsModuleHandle_t, *ptmdlMbsModuleHandle_t;
typedef UInt32 tmdlMbsTaskHandle_t, *ptmdlMbsTaskHandle_t;
// task states
typedef enum
{
tmdlMbsTaskIdle, // task has not been put into the dispatcher queue
tmdlMbsTaskPending, // task is pending in the dispatcher queue
tmdlMbsTaskInFifo, // task is in the hardware FIFO
tmdlMbsTaskCompleted, // task has been completed
tmdlMbsTaskAborted // task has been aborted
} tmdlMbsTaskStatus_t, *ptmdlMbsTaskStatus_t;
// allowable clock frequencies in MHz
typedef enum
{
tmdlMbs2_clockFreq66Mhz,
tmdlMbs2_clockFreq96Mhz,
tmdlMbs2_clockFreq108Mhz,
tmdlMbs2_clockFreq123Mhz,
tmdlMbs2_clockFreq144Mhz,
tmdlMbs2_clockFreq157Mhz,
tmdlMbs2_clockFreq173Mhz,
tmdlMbs2_clockFreq192Mhz,
tmdlMbs2_clockFreqCount
} tmdlMbs2_clockFreq_t, *ptmdlMbs2_clockFreq_t;
typedef enum
{
tmdlMbsTaskPriority_Low, // Low priority
tmdlMbsTaskPriority_Normal, // Normal priority
tmdlMbsTaskPriority_Count // must be last entry
} tmdlMbsTaskPriority_t, *ptmdlMbsTaskPriority_t;
///////////////////////////////////////////////////////////////////////////////
// MBS Capabilities structure
///////////////////////////////////////////////////////////////////////////////
// if the following #define is returned for the bufferByteAlign or
// bufferStrideMult, it implies that the buffer alignment must be based on
// the size of a pixel (RGB565 => 2-byte boundary), or the size must be a
// pixel stride multiple (RGB565 => multiple of 2)
//// The lineBufferSize indicates the largest line width which can be processed// by the vertical scaler. // Example: if lineBufferSize == 1024// then 720x576 to 1280x768 must scale in the vertical direction first// (while line width == 720)// 1280x768 to 720x576 must scale in the horizontal direction first (scale// after vertical after the line width == 720)// 1280x768 <-> 1920x1080 cannot be scaled because the line width is always// greater than 1024//#define MBS_TMDL_ALIGN_ON_PIXEL 0xFFFFFEFE
typedef struct _tmdlMbsCapabilities_t
{
UInt32 size; // size of this structure
tmSWVersion_t version; // sw version info struct
UInt32 numOfInstances; // number of supported instances
ptmAvFormatTypeList_t pInputTypes; // Linked list of supported types
ptmAvFormatTypeList_t pOutputTypes; // Linked list of supported types
tmXY_t inputSize; // input rectangle max size
tmXY_t outputSize; // output rectangle max size
UInt32 lineBufferSize; // pixel width of line buffers Bool colorSpaceConv; // support for color space conv
Bool deinterlacing; // support for de-interlacing
Bool eddi; // support for eddi
Bool measurement; // support for video measurement
Bool slicing; // support for slicing
UInt32 maxNrOfClutEntries; // max number of CLUT entries
UInt32 bufferByteAlign; // buffer alignment requirements
// 4 => 4-byte boundary
UInt32 bufferStrideMult; // buffer stride multiple
// 4 => stride must be a
// multiple of 4
} tmdlMbsCapabilities_t, *ptmdlMbsCapabilities_t;
///////////////////////////////////////////////////////////////////////////////
// MBS InstanceSetup structure and related setup structures
///////////////////////////////////////////////////////////////////////////////
// MBS Instance Setup structure
//
// nrOfTasks and nrOfClutModules are used by the device library to allocate
// memory to store task and module information. The nrOfTasks indicates the
// largest number of tasks the caller anticipates having created at one time.
// The nrOfClutModules is used to store color lookup table information. If
// indexed color formats are not used, nrOfClutModules can be set == 0 to
// conserve memory. Maximum resolution indicates the maximum number of// pixels to be input or output.//
typedef struct _tmdlMbsInstanceSetup_t
{
UInt32 size; // size of this structure
UInt32 nrOfTasks; // max number of user tasks needed UInt32 nrOfClutModules; // max number of CLUT modules needed
UInt32 maxHorizontalResolution; // max number of horizontal pels UInt32 maxVerticalResolution; // max number of vertical pels} tmdlMbsInstanceSetup_t, *ptmdlMbsInstanceSetup_t;
///////////////////////////////////////////////////////////////////////////////
// MBS Module Descriptors and related structures
///////////////////////////////////////////////////////////////////////////////
// MBS events
//
typedef enum
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -