📄 tmdlmbs.h
字号:
tmdlMbsEvtNone = 0x00000000, // Disable MBS events
tmdlMbsEvtTaskDone = 0x00000001 // Task completed event
} tmdlMbsEvent_t, *ptmdlMbsEvent_t;
// Filter Modes
//
// transposed polyphase filtering is only available for horizontal down scaling
//
typedef enum
{
tmdlMbsFilterBypass = 0, // bypass filter
tmdlMbsFilterDirect, // Use Direct Polyphase Filter
tmdlMbsFilterTransposed // Use Transposed Polyphase filter
} tmdlMbsFilterType_t;
// Phase Mode defines
typedef enum
{
tmdlMbsPhases64 = 0, // 64 phases
tmdlMbsPhases32, // 32 phases
tmdlMbsPhases16, // 16 phases
tmdlMbsPhases8, // 8 phases
tmdlMbsPhases4, // 4 phases
tmdlMbsPhases2, // 2 phases
tmdlMbsPhasesFixed, // 1 phase (pixel dropping)
tmdlMbsPhasesInterpolate // Use linear Interpolation
} tmdlMbsPhaseMode_t;
typedef struct _tmdlMbsCoeffDescr_t
{
tmdlMbsFilterType_t filterType; // filter type
tmdlMbsPhaseMode_t phaseMode; // scale phase mode
UInt32 nrOfTaps; // nr of taps used
Bool negative; // coeffs have been multiplied with -1
} tmdlMbsCoeffDescr_t, *ptmdlMbsCoeffDescr_t;
// NOTE: the scaling coefficient tables must contain (2 * the numPhases)
// 32-bit values (phases referenced in the phaseMode parameter).
//
// Filter Coefficients
// -------------------
//
// The MBS supports up to 6 taps and up to 64 phases. The 6 taps
// per phase are separated into two sets of 3 taps. Each tap
// is represented with 10 bits in two's complement format. The
// range of [-1...1[ is mapped to -512...511. The three taps are
// assembled into one UInt32, the two highest bits are unused:
//
// 31:30 reserved
// 29:20 tap 2 (tap 5)
// 19:10 tap 1 (tap 4)
// 09:00 tap 0 (tap 3)
//
// The coefficient table order becomes:
//
// phase 0, taps 0-2
// phase 0, taps 3-5
// phase 1, taps 0-2
// phase 1, taps 3-5
// phase 2, taps 0-2
// phase 2, taps 3-5
// .
// .
// .
//
// Horizontal Filters:
// -------------------
// In three component mode, each component is assigned one of
// the three 6-tap units. Coefficients for the components are shared
// and taken from taps 0-5 in the table.
// In four component mode, the three 6-tap filters are split up
// into four 3-tap units. Component 1 (R or Y), component 2 (G or U),
// and component 3 (B or V) coefficients are taken from taps 0-2 in
// the coefficient table. Component 4 (alpha) is taken from taps 3-5
// in the coefficient table.
//
// Vertical Filters:
// -----------------
// In two component mode, the filter is used as a two component
// 6-tap filter. The Y component is taken from taps 0-5 in the luma
// table, and the U and V components are taken from taps 0-5 in the
// chroma table.
// In three component mode, the two 6-tap units are split up into
// three 4-tap units. Component 1 (R or Y) coefficients are taken from
// taps 0-3 in the luma table. Component 2 (G or U) coefficients are
// taken from taps 4&5 in the luma and chroma tables (order L4, L5, C4,
// C5).
// In four component mode, the two 6-tap units are split up into
// four 3-tap units. Component 1 (R or Y) coefficients are taken from
// taps 0-2 in the luma table. Component 2 (G or U) coefficients are
// taken from taps 0-2 in the chroma table. Component 3 (B or V)
// coefficients are taken from taps 3-5 in the luma table. Component
// 4 (alpha) coefficients are taken from taps 3-5 in the chroma table.
//
///////////////////////////////////////////////////////////////////////////////
// MBS Task Descriptor and related structures
///////////////////////////////////////////////////////////////////////////////
//
// NOTES: if panoramaEnable is True, panCenterScale is the scaling factor
// at the center of the picture: 65536 implies 1:1 (no scaling),// > 65536 implies upscaling, < 65536 implies downscaling//
// slicing is not supported in the direction of panorama scaling.//
// if userCoeffs is False, the device library will provide the scaling
// coefficients based on formats, scaling factor, and Filter Setup
// parameters. The update functions (tmdlMbsTaskUpdateHorzCoeff or
// tmdlMbsTaskUpdateVertCoeff) can not be called if userCoeff == False.
//
// if userCoeffs is True, then coeffDescr, and pCoeffs or pYcoeffs and
// pUVcoeffs must be valid.
//
#define MBS_PAN_CENTERSCALE_UNITY 65536typedef struct _tmdlMbsHorzSetup_t
{
Bool filterUnity; // True to enable upscale filter
// in unity mode (1:1 scaling)
Bool panoramaEnable; // True enable panorama mode
UInt32 panCenterScale; // panorama center scale factor
Bool userCoeffs; // use specified coeff
tmdlMbsCoeffDescr_t coeffDescr; // coefficient descr
pUInt32 pCoeffs; // pointer to coefficients
} tmdlMbsHorzSetup_t, *ptmdlMbsHorzSetup_t;
typedef struct _tmdlMbsVertSetup_t
{
Bool filterUnity; // True to enable upscale filter
// in unity mode (1:1 scaling)
Bool panoramaEnable; // True enable panorama mode
UInt32 panCenterScale; // panorama center scale factor
Bool userCoeffs; // use specified coeff
tmdlMbsCoeffDescr_t coeffDescr; // coefficient descr
pUInt32 pYcoeffs; // pointer to Y coefficients
pUInt32 pUVcoeffs; // pointer to UV coefficients
} tmdlMbsVertSetup_t, *ptmdlMbsVertSetup_t;
// MBS buffer description structure
//
// NOTES: * the buffer structures expect physical addresses of DMA memory
// * check capabilities for buffer alignment/stride requirements
// * buffer rectangles should be >= 16 in width and height
// * the destination buffer starting Y value must be even for
// YUV 420 formats
// * the destination buffer starting X value must be even for
// YUV 420 and 422 formats
// * buffer rectangles are ALWAYS frame based, even for FieldInField
// and FieldInFrame buffers!!!
// * the buffer rectangle height MUST be even for FieldInField and
// FieldInFrame buffers when doubleBufferEn == False (single field
// being processed).
// * the hardware does not support sub-byte pixel alignment; therefore,// 1, 2, and 4bpp indexed modes must have a starting src X value // aligned on an 8, 4, or 2 pixel boundary respectively. If // mirroring is enabled, then the last byte in each line of the src// rectangle must contain 8, 4, or 2 valid pixels.//
typedef struct _tmdlMbsBufSetup_t
{
tmRect_t rect; // buffer rectangle to use
tmVideoFormat_t bufFormat; // Video buffer format
Bool doubleBufferEn; // True: use both buffers
tmAvPhysBuffer_t memBuf1; // Describes memory buffer 1
tmAvPhysBuffer_t memBuf2; // Describes memory buffer 2
tmAvPhysBuffer_t memBuf3; // Describes memory buffer 3, only used
// for 3-field majority select
// de-interlacing
} tmdlMbsBufSetup_t, *ptmdlMbsBufSetup_t;
// color key preservation replacement colors
//
// NOTE: color key replacement is used to minimize filter artifacts at the
// border of color key rectangles in a graphics image; the colorkey
// will be saved, replaced by a different color while filtering, and
// finally reinstalled after the filter
typedef enum
{
tmdlMbsCKReplaceNone = 0, // do not replace tmdlMbsCKReplaceBlack, // replace with black
tmdlMbsCKReplaceGray, // replace with gray
tmdlMbsCKReplacePrevious // replace with last color before ck
} tmdlMbsCKReplace_t;
// color key preservation structure
//
// color keying is only available for 3-component data formats
typedef struct _tmdlMbsColorKey_t
{
Bool enable; // True to enable preservation
tmColor3_t colorKey; // color key color
tmdlMbsCKReplace_t colorKeyReplace;// replacement color
} tmdlMbsColorKey_t, *ptmdlMbsColorKey_t;
// filter setup parameters
typedef enum
{
tmdlMbsFilterHorizontal,
tmdlMbsFilterVertical
} tmdlMbsFilter_t;
typedef enum
{
tmdlMbsPicContentGeneric,
tmdlMbsPicContentVideo, // task default
tmdlMbsPicContentGraphics
} tmdlMbsPictureContent_t, *ptmdlMbsPictureContent_t;
typedef enum
{
tmdlMbsFlickerFilterNone, // task default
tmdlMbsFlickerFilterLow,
tmdlMbsFlickerFilterMedium,
tmdlMbsFlickerFilterHigh
} tmdlMbsFlickerFilterLevel_t, *ptmdlMbsFlickerFilterLevel_t;
typedef enum
{
tmdlMbsBandpassLow,
tmdlMbsBandpassMedium, // task default
tmdlMbsBandpassMediumHigh,
tmdlMbsBandpassHigh
} tmdlMbsBandpassLevel_t, *ptmdlMbsBandpassLevel_t;
// The Filter Setup values are used by the DevLib to determine the best
// internal set of scaling coefficients to use for scaling. These parameters
// are not used if the caller provides the filter descriptor and coefficients
//
// peaking level is a value from 0 (off) to 15 (max peaking)
//
// The defaults when a task is created are:
//
// picContent = tmdlMbsPicContentVideo
// ffLevel = tmdlMbsFlickerFilterNone
// bandpass = tmdlMbsBandpassMedium
// peakingLevel = 0 no peaking
//
// tmdlMbsTaskUpdateFilterSetup can be called to change the default settings
//
typedef struct _tmdlMbsFilterSetup_t
{
tmdlMbsPictureContent_t picContent;
tmdlMbsFlickerFilterLevel_t ffLevel; // vertical filtering only
tmdlMbsBandpassLevel_t bandpassLevel;
UInt32 peakingLevel; // [0..15]
} tmdlMbsFilterSetup_t, *ptmdlMbsFilterSetup_t;
// task flags (bit fields)
//
// NOTES: mirroring is not supported when slicing in the horizontal direction// (width sliced).//
// mirroring YUV 420 and 422 formats requires an even starting X
// (first pixel of pixel pair) and line widths which are a multiple
// of 2.
//
// when scaling a single FieldInField or FieldInFrame buffer, the task
// by default assumes it is processing the odd (top) buffer. Set the
// tmdlMbsFlagEvenField to indicate the even (bottom) buffer.
//
// when de-interlacing, the default is that the first set of buffers
// (top field, lines 0, 2, 4) contains the previous field, and the
// second set the contains the current field. When reversed, set the
// tmdlMbsFlagDimTopIsCurrent flag to indicate the top field buffers
// contain the current field
//
typedef UInt32 tmdlMbsTaskFlags_t;
#define tmdlMbsFlagNone 0x00
#define tmdlMbsFlagMirrorEn 0x01 // enable horizontal mirroring
#define tmdlMbsFlagSlicingEn 0x02 // enable slicing
#define tmdlMbsFlagSliceAt00 0x04 // position the output slice at
// (0, 0) in the dst buffer
#define tmdlMbsFlagEvenField 0x08 // task is for the even field
#define tmdlMbsFlagDimTopIsCurrent 0x10 // top field is current field,
// bottom field is previous
// Slicing:
//
// Src Buffer Dst Buffer
// +-----------------------+ +-------------------------------+
// | SrcRect | | |
// | +------------+ | | DstRect |
// | | | | | +------------------+ |
// | | | | | | sliceRect | |
// | | | | | | | |
// | | | | | |------------------| |
// | | | | | | | |
// | +------------+ | | | | |
// | | | | | |
// | | | | | |
// +-----------------------+ | +------------------+ |
// | |
// | |
// | |
// +-------------------------------+
//
// The SrcRect and DstRect (from inputBuffer and outputBuffer) are used
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -