⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tmdlmbs2_local.h

📁 PNX1500上做视频缩放MBS的源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
//-----------------------------------------------------------------------------
// (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:    tmdlMbs2_Local.h
//
// DESCRIPTION:  This header file describes definitions, types, and functions
//               used locally by the MBS2 device library.
//               
//
// DOCUMENT REF: 
//
//  NOTES:  
//-----------------------------------------------------------------------------

#ifndef TMDL_MBS2_LOCAL_H
#define TMDL_MBS2_LOCAL_H

//-----------------------------------------------------------------------------
// Project include files:
//-----------------------------------------------------------------------------

#include <tmdlVidMeas.h>
#include <tmDbg.h>

#ifdef __cplusplus
extern "C"
{
#endif

//-----------------------------------------------------------------------------
// Macros:
//-----------------------------------------------------------------------------
//
//  NOTE:   MBS2_PARAM_CHECK is defined by using the following command in your
//          build window:
//
//          set _TMTGTCOPTS=-DMBS2_PARAM_CHECK
//
//          It's use is so error codes are returned when testing the DevLib
//          by itself, checking for corner cases and invalid parameters.  Normal
//          use will generate the assert to halt operation.
//
#ifdef MBS2_PARAM_CHECK

#define MBS2_ERR_CHECK(exp, status, msg) if (!(exp)) return status;

#else

#define MBS2_ERR_CHECK(exp, status, msg) DBG_ASSERT2(exp, (msg))

#endif

//-----------------------------------------------------------------------------
// Defines:
//-----------------------------------------------------------------------------
//
#define MBS_MAX_UNITCOUNT   4   // # of units supported by the Device Lib

#define MBS_NUM_TASK_Q_ENTRIES      16  // Instance -> Dispatcher Q's

#define MBS_TRANS_TAPS              5   // 5 tap run-in delay for transposed mode

#define MBS_HW_TASK_FIFO_SIZE       2   // 2 slots in hw task FIFO
#define MBS_BUFFER_ALIGNMENT        MBS_TMDL_ALIGN_ON_PIXEL
#define MBS_BUFFER_STRIDE_MULT      MBS_TMDL_ALIGN_ON_PIXEL
#define MBS_TASK_BUFFER_ALIGNMENT   8   // cmd task buffer alignment

#define MBS_NO_LINKED_TASK          0xFFFFFFFF  // no tasks linked to this task

#define MBS_TABLE_OFF  (((UInt32)&gpRegs[0]->t)-(UInt32)&gpRegs[0]->c)
                                        // offset of table register subset


#define MIN(a,b) ( a < b ? a : b )
#define MAX(a,b) ( a > b ? a : b )

#define MBS_MAX_STRIDE                ((1<<15)-8)
#define MBS_MAX_LINESIZE              2047
#define MBS_MAX_LINECOUNT             2047
#define MBS_MAX_VERTICAL_RESOLUTION   (MBS_MAX_LINECOUNT + 1)
#define MBS_MAX_HORIZONTAL_RESOLUTION (MBS_MAX_LINESIZE  + 1)
#define MBS_MAX_RUNIN                 8   // looks like 2 is real max, but I'll leave some
#define MBS_MAX_RUNOUT                8   // margin
#if ( (TMFL_PNX_ID == 1500)|| (TMFL_PNX_ID == 1700))
#define MBS_LINEBUFFER_SIZE 1024
#else
#define MBS_LINEBUFFER_SIZE 2048
#endif

//  panoramic scaling related defines
#define MBS_PAN_CENTERSCALE_UNITY_D ((double) MBS_PAN_CENTERSCALE_UNITY)
#define MBS_PAN_CENTERSCALE_MAX     (16 * MBS_PAN_CENTERSCALE_UNITY)

// Task Opcodes:
#define MBS_TASK_LINK               0
#define MBS_TASK_END_START_PROCESS  1
#define MBS_TASK_END_STOP_PROCESS   5
#define MBS_TASK_START_AND_QUEUE    2
#define MBS_TASK_LOAD_REGS          3
#define MBS_OPCODE_BITS             3
#define MBS_OPCODE_COUNT_SHIFT      24

#define MBS_EVENT_CURRENT_LINE_SHIFT    16

#define MBS_MEM_INIT_SIZE       0x10000 // initial memspace size (64k)

//  the task list buffer needs to be cache aligned and cache multiple in size

#define MBS_CMD_BUFFER_SIZE     (2*0xc00)   // size of task list buffer

#define NR_OF_SUPPORTED_FORMAT_TYPES    3
#define NR_OF_SUPPORTED_INPUT_FORMATS   3
#define NR_OF_SUPPORTED_OUTPUT_FORMATS  2

#define MBS_MAX_UNITS                   4
#define MBS_INSTANCE_KEY    (((('M' << 24) | 'B' << 16) | 'S' << 8) | '!')

//  allow for 64 64-bit coeff values + a 32-bit load cmd + a 32-bit link cmd

#define MBS_COEFF_MEM_SIZE              ((64 * 64 + 32 + 32) / 8)

//  equates used to create new transposed filter coefficents based on DC Gain

#define MBS_HSP_SCALE_UNITY 0x10000
#define QUANT_FILT 512

//  Defines for formats supported by the Deinterlace Modes

#define MBS_MEDIAN_FORMATS ( vdfUYVY | vdfYUY2 | vdfVYUY | \
                        vdfUYVYInterspersed | vdfYUY2Interspersed | \
                        vdfVYUYInterspersed | vdfYUV422Planar | \
                        vdfYUV420Planar | vdfYUV422SemiPlanar | \
                        vdfYUV420SemiPlanar | vdfYUV420Interspersed | \
                        vdfYInterleavedUV | vdfYUV422Interspersed)

#define MBS_MAJORITY_FORMATS (vdfYUV422Planar | vdfYUV420Planar | \
                            vdfYUV422SemiPlanar | vdfYUV420SemiPlanar | \
                            vdfYUV420Interspersed | vdfYInterleavedUV | \
                            vdfYUV422Interspersed)

#define MBS_MAJORITY3_FORMATS (vdfYUV422SemiPlanar | vdfYUV420SemiPlanar | \
                                vdfYInterleavedUV)

#define MBS_EDDI_FORMATS    MBS_MAJORITY_FORMATS

#define MBS_420_FORMATS (vdfYUV420Planar | vdfYUV420SemiPlanar | \
                        vdfYUV420Interspersed | vdfYInterleavedUV)

//  interrupt #defines

#define MBS_INT_DISABLE MBS_INT_NONE
#define MBS_INT_ENABLE  (MBS_INT_TASK_DONE | MBS_INT_PROC_ERROR)
#define MBS_INT_CLEAR_ALL (MBS_INT_TASK_DONE | MBS_INT_FIFO_EMPTY | \
                            MBS_INT_PROC_ERROR)


//  this list defines the order of the task list commands which program
//  the HW register for scaling/color space conversion.  These values are
//  used to locate values in the task list if they need to be updated later.
//
typedef enum
{
    tlModeControlLoad = 0,
    tlModeControl,
    tlInputFormatLoad,
    tlInputFormat,
    tlInputSize,
    tlInputVarFormat,
    tlInputBuffersLoad,
    tlInputBuf1,
    tlInputBuf1Pitch,
    tlInputBuf2,
    tlInputBuf2Pitch,
    tlInputBuf3,
    tlInputBuf4,
    tlInputBuf5,
    tlInputBuf6,
    tlHorzScaleLoad,
    tlHorzScaleZoom,
    tlHorzScaleControl,
    tlHorzScaleZoomDelta,
    tlHorzScaleZoomChange,
    tlColorSpaceMatrixLoad,
    tlCscC00C01C02,
    tlCscC10C11C12,
    tlCscC20C21C22,
    tlCscD0D1D2,
    tlCscE0E1E2,
    tlVertScaleLoad,
    tlVertScaleZoom,
    tlVertScaleControl,
    tlVertScaleZoomDelta,
    tlVertScaleZoomChange,
    tlColorKeyLoad,
    tlColorKeyControl,
    tlColorKeyComp,
    tlOutputFormatLoad,
    tlOutputFormat,
    tlOutputSize,
    tlOutputBuffersLoad,
    tlOutputBuf1,
    tlOutputBuf1Pitch,
    tlOutputBuf2,
    tlOutputBuf2Pitch,
    tlOutputBuf3,
    tlOutputBuf4,
    tlOutputBuf5,
    tlOutputBuf6,                   //  ^^^^ all versions have these
    tlMeasIntCtrlLoad,
    tlMeasIntCtrl,                  //  ^^^^ available on PNX2015 version
    tlEddiLoad,                     
    tlEddiControl1,
    tlEddiControl2,                 //  ^^^^ these regs only on viper2 unit 1
    tlMsa3CtrlLoad,
    tlMsa3Ctrl,                     //  ^^^^ available on viper2 unit 1 to 2
    tlIndexAfterCtrlRegs

} tmdlMbsTaskListOrder_t;

#define tlMbs2BaseCount     tlMeasIntCtrlLoad
#define tlMbs2MeasCount     tlEddiLoad
#define tlMbs2EddiCount     tlMsa3CtrlLoad
#define tlMbs2Msa3EnhCount  tlIndexAfterCtrlRegs

typedef enum
{
    tmdlMbsSkipTask,                        // skip current task
    tmdlMbsResetTasks                       // clear all pending tasks

} tmdlMbsTaskReset_t, *ptmdlMbsTaskReset_t;


typedef enum _tmdlMbsModuleType_t
{
    tmdlMbsModHorzScale = 1,
    tmdlMbsModVertScale,
    tmdlMbsModClut

} tmdlMbsModuleType_t;

typedef enum _tmdlMbsLinks_t
{
    tmdlMbsLinkNone     = 0,
    tmdlMbsLinkHorz     = 1,    //  need to link to default horz coeff's
    tmdlMbsLinkVert     = 2,    //  need to link to default vert coeff's
    tmdlMbsLinkHorzVert = 3     //  need to link to default horz & vert coeff's

} tmdlMbsLinks_t;

typedef enum
{
    tmdlMbsDitherNone,                     // No dithering 
    tmdlMbsDitherNoReset,                  // never reset the pattern
    tmdlMbsDitherResetOnStart,             // reset pattern at startup
    tmdlMbsDitherResetOnField              // reset pattern every field

} tmdlMbsDitherMode_t;


typedef enum _tmMBSHorScaleType_t
{
    MbsHorFilterBypass,       // bypass horizontal scaler
    MbsHorFilterActive,       // use horizontal scaler for scaling
    MbsHorFilterColor         // use horizontal scaler for color space conv.

} tmdlMbsHorScaleType_t;

typedef enum _tmdlMbsPhaseCorrType_t
{
    mbsNoPhaseCorrection,           // no phase correction required
    mbsEvenToEvenPhaseCorrection,   // from even field to even field
    mbsFrameToEvenPhaseCorrection,  // from frame to even field
    mbsOddToFramePhaseCorrection    // from odd field to frame 

} tmdlMbsPhaseCorrType_t;

typedef enum
{
    tmdlMbsHorCoeff,                        // Horizontal Table 
    tmdlMbsVerCoeffLuma,                    // Vertical Luma/RGB Table 
    tmdlMbsVerCoeffChroma                   // Vertical Chroma Table 

} tmdlMbsCoeffTable_t;

typedef enum
{
    tmdlMbsFeatureNone          = 0,
    tmdlMbsFeatureDeint         = 1,        //  deinterlacing
    tmdlMbsFeatureEddi          = 2,        //  EDDI supported
    tmdlMbsFeatureMeas          = 4,        //  measurement block present
    tmdlMbsFeature1500EnhMsa3   = 8,        //  PNX1500 version of MSA3
    tmdlMbsFeatureEnhMsa3       = 16,       //  MSA3 enhanced mode support
    tmdlMbsFeatureDynMsa3       = 32,       //  MSA3 dynamic mode support
    tmdlMbsFeatureIFFcrop       = 64,       //  IFF cropping support
    tmdlMbsFeatureDFFcrop       = 128       //  DFF cropping support

} tmdlMbsFeatures_t;

//  update flag bits
typedef enum
{
    tmdlMbsUpdateNone       = 0,
    tmdlMbsUpdateBuffers    = 1,            //  update buffers
    tmdlMbsUpdateScaling    = 2             //  update scaling related params

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -