📄 tmdlmbs.h
字号:
// to determine the scaling factors (REMEMBER, these are ALWAYS frame
// based rectangles).
//
// The SliceRect specifies the size of the desired output and it's position
// within the DstRect. The required size of the SrcRect slice is
// determined by the DevLib. The height of the SliceRect MUST be even if
// processing FieldInField or FieldInFrame buffers with doubleBufferEn ==
// False.
//
// The tmdlMbsFlagSliceAt00 flag specifies where in the destination
// buffer to place the slice output.
//
// if (taskDescriptor.taskFlags & tmdlMbsFlagSliceAt00)
// place the output at position (0, 0) in the Dst Buffer.
// else
// place the output in the Dst Buffer as specified by the sliceRect,
// within the DstRect, within the Dst Buffer.
//
// example:
// sliceRect == (0,0)-(300,100)
// dstRect == (50,50)-(350,350)
// output at (50,50)-(350,150) in the Dst Buffer
//
// NOTE: when measurement is enabled while slicing, the measurement window
// will get clipped to the portion of the source rectangle used to
// generate the destination slice. This includes any run-in or run-out
// needed.
//
// MBS Task Descriptor
//
// NOTES: the "fixedAlpha" member in the tmdlMbsTaskDescriptor_t structure
// is only used when converting from a 3-component input format to a
// 4-component output format;
//
// examples: RGB565 to ARGB8888
// YUY2 to ARGB4444
// XRGB8888 to AYUV8888
//
// if a color lookup table is not being used, set clutHandle to
// MBS_DEFAULT_MODULE
//
typedef struct _tmdlMbsTaskDescriptor_t
{
UInt32 size; // size of this structure
tmdlMbsTaskFlags_t taskFlags; // tmdlMbsTaskFlags_t
tmdlMbsHorzSetup_t horzSetup; // setup for horizontal scaling
tmdlMbsVertSetup_t vertSetup; // setup for vertical scaling
tmdlMbsBufSetup_t inputBuffer; // describes input buffer
tmdlMbsBufSetup_t outputBuffer; // describes output buffer
tmRect_t sliceRect; // slice rectangle
tmdlMbsColorKey_t colKey; // color key preservation
UInt8 fixedAlpha; // inserted fixed alpha value
tmdlMbsModuleHandle_t clutHandle; // CLUT Module handle
} tmdlMbsTaskDescriptor_t, *ptmdlMbsTaskDescriptor_t;
// De-interlacing modes:
//
// De-interlacing is used to convert the fields of an interlaced source and
// produce a frame in a progressive buffer.
//
// Supported de-interlacing mode/source buffer formats:
//
// mode 420 Semi 420 Planar 422 Single 422 Semi 422 Planar
// ==================================================================
// median X X X X X
// majority 2 X X X X
// majority 3 X X
//
//
// incoming fields
//
// top bottom top bottom top bottom
// +-------+ +-------+ +-------+ +-------+ +-------+ +-------+
// | | | | | | | | | | | |
// | Y0 | | Y1 | | Y2 | | Y3 | | Y4 | | Y5 |
// | | | | | | | | | | | |
// +-------+ +-------+ +-------+ +-------+ +-------+ +-------+
// | | | | | | | | | | | |
// | UV0 | | UV1 | | UV2 | | UV3 | | UV4 | | UV5 |
// | | | | | | | | | | | |
// +-------+ +-------+ +-------+ +-------+ +-------+ +-------+
//
//
// VTM & MSA 2-field
//
// frame | 1 2 3 4
// ============================+==============================
// tmdlMbsFlagDimTopIsCurrent | 0 1 0 1
// memBuf1.buffer1 | Y0 Y2 Y2 Y4
// memBuf1.buffer2 | UV0 UV2 UV2 UV4
// memBuf2.buffer1 | Y1 Y1 Y3 Y3
// memBuf2.buffer2 | UV1 UV1 UV3 UV3
//
//
// MSA 3-field
//
// frame | 1 2 3 4
// ============================+==============================
// tmdlMbsFlagDimTopIsCurrent | 0 1 0 1
// memBuf1.buffer1 | Y0 Y2 Y2 Y4
// memBuf1.buffer2 | UV0 UV2 UV2 UV4
// memBuf2.buffer1 | Y1 Y1 Y3 Y3
// memBuf2.buffer2 | UV1 UV1 UV3 UV3
// memBuf3.buffer1 | Y2 Y3 Y4 Y5
//
//
// 3-field Majority Select De-interlacing Modes
//
// last current next
//
// X Yl(n-2) [A]
//
// X Yc(n-1) [D]
//
// X Yl(n) [B] O Yc(n) X Yn(n) [F]
//
// X Yc(n+1) [E]
//
// X Yl(n+2) [C]
//
//
// X - existing pixels
// O - interpolated pixel
//
//
// mode Yc(n) calculation
// ==========================================================================
// normal Median (FIR(n), Median (D, B, E), F)
//
// FIR(n) = (8/16 * (D + E)) - (5/16 * (A + C)) + (10/16 * B);
//
// enhanced Median (FIR(n), Median (D, F, E), B)
//
// FIR(n) = (8/16 * (D + E)) - (5/16 * (A + C)) + (10/16 * F);
//
// dynamic Median (FIR(n), Median (D, B, E), F)
//
// FIR(n) = (av_curr / 2) + k * ((-5/16 * (A + C)) + (10/16 * F));
//
// where k = CLIP (256 - ((ABS (av_prev - av_curr) - 2^t1) / 2^(t2+1)), 255)
// / 256
//
// av_prev = (A + (2 * B) + C + 2) / 4
//
// av_curr = (D + E + 1) / 2
//
// dynamic enhanced Median (FIR(n), Median (D, F, E), B)
// using dynamic FIR(n)
//
typedef enum
{
tmdlMbsDeInterNone, // no de-interlacing (task default)
tmdlMbsDeInterModeMedian, // vertical temporal median
tmdlMbsDeInterModeMajority, // majority select algorithm 2 field
tmdlMbsDeInterModeMajority3, // majority select algorithm 3 field
tmdlMbsDeInterModeMajority3enh, // enhanced MSA 3 field
tmdlMbsDeInterModeMajority3dyn, // dynamic MSA 3 field
tmdlMbsDeInterModeMajority3dynEnh // dynamic enhanced MSA 3 field
} tmdlMbsDeInterMode_t;
// control values for determining the k value when using
// tmdlMbsDeInterModeMajority3dyn or tmdlMbsDeInterModeMajority3dynEnh
// de-interlacing
//
typedef struct _tmdlMbsMsa3Ctrl_t
{
UInt32 t1; // start of slope [0:7] - default 6
UInt32 t2; // steepness of slope [0:7] - default 3
} tmdlMbsMsa3Ctrl_t, *ptmdlMbsMsa3Ctrl_t;
// EDDI setup
//
// e - edge pixels
// c - center edge pixel
//
// -------------------------eecee--------------
// |--|<--- prev_rc
// ----------------------eecee----------------- previous line
// |--|<----- rc
// |---|<--- prev_edge_width
// -------------------eecee-------------------- current line
// |---|<--- edge_width
// |-------|<---- search Limit
//
// The search limit defines how far to search for a matching edge center
// based on the direction (angle) of the edge. The pixel X coordinate
// difference between the c values must be within the search limit. The
// search limit = searchLimit / 16 * edge_width
//
// min_edgewidth = min(edge_width, prev_edge_width)
// max_edgewidth = max(edge_width, prev_edge_width)
//
// edge detection is True
// if (minEdgeWidth <= edge_width <= maxEdgeWidth) &&
// ((max_edgewidth - min_edgewidth) < absEdgeMatch) &&
// (((relEdgeMatch * max_edgewidth) / 16 < min_edgewidth)
//
// The Relative Center (RC) Check is used to determine how straight a detected
// line must be.
//
// min_RCwidth = min(prev_rc, rc)
// max_RCwidth = max(prev_rc, rc)
//
// if (rcCheckEnable == True)
// then ((max_RCwidth - min_RCwidth) < absRCmMatch) &&
// (((relRCmatch * max_RCwidth) / 16 < min_RCwidth)
// are also needed for edge detection
//
typedef struct _tmdlMbsEddiSetup_t
{
Bool enable; // enable edge detect de-interlacing
UInt32 minEdgeWidth; // 0 - 3
UInt32 maxEdgeWidth; // 0 - 31
UInt32 filterThreshold; // 0 - 127
UInt32 minLumaDifference; // 0 - 63 (gradient)
UInt32 absEdgeMatch; // 0 - 3 absolute difference in edge
// width for match
UInt32 relEdgeMatch; // 0 - 15
UInt32 searchLimit; // 0 - 31 search limit for finding a
// matching edge
Bool rcCheckEnable; // enable RC check to calc AIR
UInt32 absRCmatch; // 0 - 3
UInt32 relRCmatch; // 0 - 15
} tmdlMbsEddiSetup_t, *ptmdlMbsEddiSetup_t;
// EDDI level values used for tmdlMbsTaskUpdateEddiLevel
//
// Notes: NMc non-motion-compensated data
// Mc motion-compensated data
// Low Noise low noise data
// Safe limited corrections
// Normal average amount of correction
// Aggressive aggressively try to correct
typedef enum
{
tmdlMbsEddiOff, // EDDI disabled
tmdlMbsEddiNMcLowNoiseSafe,
tmdlMbsEddiNMcLowNoiseNormal,
tmdlMbsEddiNMcLowNoiseAggressive,
tmdlMbsEddiNMcSafe,
tmdlMbsEddiNMcNormal,
tmdlMbsEddiNMcAggressive,
tmdlMbsEddiMcLowNoiseSafe,
tmdlMbsEddiMcLowNoiseNormal,
tmdlMbsEddiMcLowNoiseAggressive,
tmdlMbsEddiMcSafe,
tmdlMbsEddiMcNormal,
tmdlMbsEddiMcAggressive
} tmdlMbsEddiLevel_t;
// structure used when dispatching a task. If buffer pointers are Null, the
// previous buffer addresses will be used.
typedef struct _tmdlMbsTaskDispatch_t
{
tmdlMbsTaskHandle_t taskHandle; // task handle
ptmAvPhysBuffer_t pInputBuffer1; // ptr to new input buffer 1
ptmAvPhysBuffer_t pInputBuffer2; // ptr to new input buffer 2
ptmAvPhysBuffer_t pInputBuffer3; // ptr to new input buffer 3
ptmAvPhysBuffer_t pOutputBuffer1; // ptr to new output buffer 1
ptmAvPhysBuffer_t pOutputBuffer2; // ptr to new output buffer 2
} tmdlMbsTaskDispatch_t, *ptmdlMbsTaskDispatch_t;
// Scaling Factors
//
// Zoom Factor Normal Polyphase Transposed
// ----------------------------------------------
// 0x08000 200% (upscale) 50% (downscale)
// 0x10000 no scaling no scaling
// 0x20000 50% (downscale) not supported
//
// D Zoom and DD Zoom are used for panoramic (parabolic) scaling, these
// values are 0 for normal (constant) scaling.
//
typedef struct _tmdlMbsScalingFactors_t
{
// horizontal scaling factors
UInt32 horzZoom; // 0 <= Zoom < 2^20
Int32 horzDZoom; // -2^25 <= DZoom < 2^25
Int32 horzDDZoom; // -2^28 <= DDZoom < 2^28
// vertical scaling factors
UInt32 vertZoom; // 0 <= Zoom < 2^20
Int32 vertDZoom; // -2^25 <= DZoom < 2^25
Int32 vertDDZoom; // -2^28 <= DDZoom < 2^28
} tmdlMbsScalingFactors_t, *ptmdlMbsScalingFactors_t;
typedef enum _tmdlMbsTaskCopyFlags_t{ tmdlMbsTaskCopyFlagsNone // no special requirements} tmdlMbsTaskCopyFlags_t;//-----------------------------------------------------------------------------
// Exported functions:
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// FUNCTION: tmdlMbsGetCapabilities:
//
// DESCRIPTION: This function returns a ptr to the capabilities of MBS Unit 0.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -