/* SPDX-License-Identifier: LGPL-2.1-only OR BSD-3-Clause */
/******************************************************************************
 *
 * This file is provided under a dual license.  When you use or
 * distribute this software, you may choose to be licensed under
 * version 2.1 of the GNU Lesser General Public License
 * ("LGPLv2.1 License") or BSD License.
 *
 * LGPLv2.1 License
 *
 * Copyright(C) 2019 MediaTek Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2.1 of the GNU Lesser General Public
 * License as published by the Free Software Foundation.
 *
 * This program 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 https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html for more
 * details.
 *
 * BSD LICENSE
 *
 * Copyright(C) 2019 MediaTek Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *  * Neither the name of the copyright holder nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *****************************************************************************/

/*-----------------------------------------------------------------------------
 *
 * $Author$
 * $Date$
 * $RCSfile: vdp_if.h,v $
 * $Revision$
 *
 *---------------------------------------------------------------------------*/

/** @file vdp_if.h
 *  Video plane interface, including init, enable,
 *  mode selection and region desciption.
 */

#ifndef B2R_IF_H
#define B2R_IF_H

#include "x_typedef.h"
#include "stc_drvif.h"
#include "x_timer.h"
#include "drv_common.h"
#include "drv_dbase.h"

//-----------------------------------------------------------------------------
// Type definitions
//-----------------------------------------------------------------------------
// Trick Play at 20081001
#define VDP_PLAY_NORMAL 0 ///< Normal Play
#define VDP_PLAY_TRICK 1 ///< Trick Play
#define VDP_PLAY_STEP_FORWARD 2 ///< Step Forward

#define VDP_MAX_LOCK_BUF_NS         5

#define C_LVL    0  //Ctitical Information
#define I_LVL    1  //Important Information
#define N_LVL    2  //Normal Information

// B2R change frame message flags
#define B2R_CONN             (1 << 0)
#define B2R_NT_RENDER        (1 << 1)
#define B2R_T_RENDER         (1 << 2)
#define B2R_MAIN_LOOP        (1 << 3)
#define B2R_SEEK             (1 << 4)
#define B2R_TRICK            (1 << 5)
#define B2R_STEP             (1 << 6)
#define B2R_LR_RENDER        (1 << 7)
#define B2R_FLIP_MIRROR      (1 << 8)
#define B2R_UPDATE_STC       (1 << 9)
#define B2R_CB_LOG           (1 << 10)
#define B2R_TWO_ADDR_INT     (1 << 11)
#define B2R_CUST_INFO_LOG    (1 << 12)
#define B2R_COLOR_FMT_CHG    (1 << 13)
#define B2R_DASH_TRICK       (1 << 14)
#define B2R_SML_FRM_CTL      (1 << 15)
#define B2R_SML_NPTV         (1 << 16)
#define B2R_AV_STATUS        (1 << 17)
#define B2R_UT_TEST          (1 << 18)
#define B2R_WFD_TEST         (1 << 19)
#define B2R_DV               (1 << 20)
#define B2R_DVR              (1 << 21)
#define B2R_WORKAROUND       (1 << 22)
#define B2R_8K_PHOTO_INFO    (1 << 23)
#define Techni_Hdr           (1 << 24)
#define Techni_HData         (1 << 25)
#define B2R_FIX_MODE         (1 << 26)
#define B2R_COLORID_DEBUG    (1 << 27)

#define TMS_START_TO_PLAY    0
#define TMS_FIRST_FRM        1
#define TMS_SPEEDUP_UNMUTE   2
#define TMS_MODE_CHG         3
#define TMS_DISPLAY_MUTE     4
#define TMS_DISPLAY_UNMUTE   5
#define TMS_SET_MUTE         6
#define TMS_SHOW_MUTE_TIME   7

#ifdef CC_SUPPORT_PHOTO8K
#define B2R_NORMAL_PLAY_MODE             (0)
#define B2R_DIVIDED_PHOTO_MODE           (1)

#define PHOTO_STATE_IDLE                 (0)
#define PHOTO_STATE_LEFT_TOP             (1)
#define PHOTO_STATE_RIGHT_TOP            (2)
#define PHOTO_STATE_LEFT_BOTTOM          (3)
#define PHOTO_STATE_RIGHT_BOTTOM         (4)
#endif

#define B2R_COM_RENDER       ((B2R_NT_RENDER) | (B2R_T_RENDER))

// B2R change frame message flags
#define VDP_B2R_CHG_FRAME_MSG_SYNC  (1 << 0)    // Synchronous display
#define VDP_B2R_MULTI_VIEW          (1 << 1)    // MVC or two frame buffer mode 

#define B2R_GM_FB_CNT    2

#define B2R_CHECK_CB_FUNC_VERIFY(func, crc)     ((UINT32)func == ~((UINT32)crc))

#define APTS 0
#define VPTS 1

typedef enum
{
    VDP_B2R_CHG_FRAME_DISPQ = 0,        // Get display frame address from FBG display Q 
    VDP_B2R_CHG_FRAME_DIRECT,           // The display frame address is given directly (give only 1 address, the YC data are continuous)
    VDP_B2R_CHG_FRAME_MULTI_VIEW,
    VDP_B2R_CHG_FRAME_DIRECTYC          // The display frame address is given directly (give both Y and C addressare)
} VDP_B2R_CHG_FRAME_DISPMODE;

typedef struct
{
    UINT32 u4VdpId;
    UINT32 u4Flag;
    UINT32 u4DispMode;
    UCHAR  ucFbgId;
    UCHAR  ucFbId;
    UCHAR  ucSubFbgId;
    UCHAR  ucSubFbId;
} VDP_B2R_CHG_FRAME_MSG_T;


// B2R Video Image Module Color Mode.
#define VDP_IMAGE_420_MODE          (1 << 0)    ///< 420 mode
#define VDP_IMAGE_422_MODE          (1 << 1)    ///< 422 mode
#define VDP_IMAGE_444_MODE          (1 << 2)    ///< 424 mode

/**
 *  B2R Video plane image module, Capability infomation
 */
typedef struct
{
    UINT32 u4Width;             ///< width of maximum supported image width
    UINT32 u4Height;            ///< height of maximum supported image height
    UINT32 u4ColorMode;         ///< supported color mode
    UINT32 u4FrameBufferNs;     ///< supported number for Frame Buffer
    UINT32 u4PitchAlignement;   ///< supported alignement step for Pitch
} VDP_IMAGE_INFO_T;

/**
 *  Video plane image module, Image Argument
 */
typedef struct
{
    UINT32 u4FrameBufferId;     ///< frame buffer id of image
    UINT32 u4Width;             ///< width of imge
    UINT32 u4Height;            ///< height of image
    UINT32 u4ColorMode;         ///< color mode of image
    UINT32 u4Pitch;             ///< Pitch of image
} VDP_IMAGE_ARG_T;

/*  B2R picture information for MM*/
typedef struct
{
    UCHAR ucHours;
    UCHAR ucMinutes;
    UCHAR ucSeconds;
    UCHAR ucPictures;
    UINT64 u4Pts;
    UINT32 u4TotlaTimeOffset;
    UINT32 u4TickNum;
    UINT64 u8Offset;     // file offset
    UINT64 u8OffsetDisp; // file offset for display

} VDP_PIC_INFO_T;

/*  B2R picture information for MM*/
typedef struct
{
    UINT32 u4TickNum;

} VDP_SET_PIC_INFO_T;


/**
 *  VDP capture picture information
 */
typedef struct
{
    BOOL    fgUFOOn;
    UINT32 u4UFOType;
    BOOL    fgJumpModeOn;
    UPTR    u4AddrY;
    UPTR    u4AddrC;
    UPTR    u4AddrYLen;
    UPTR    u4AddrCLen;
    UPTR    u4DstY;
    UPTR    u4DstC;
    UINT32 u4MemHSize;
    UINT32 u4MemVSize;
    UINT32 u4HSize;
    UINT32 u4VSize;
    UINT32 u4RRMode;
    UINT32 u4IsRsIn;
    UINT32 u4SrcSwap;
} VDP_CAPTURE_INTO_T;

/**
 *  VDP position information
 */
typedef struct
{
    UINT64 u8PtsI;
    UINT64 u8Pts;

    UINT64 u8Stc;

    UINT64 u8AudPts;
    UINT64 u8AudOffset;

    UINT64 u8OffsetI;
    UINT64 u8Offset;
    UINT64 u8OffsetDisp;
    INT32  i4TemporalRef;
    UINT32 u4Timestap;
    UINT16 u2DecodingOrder;
} VDP_POS_INTO_T;

/**
 *  VDP AB position information
 */
typedef struct
{
    BOOL fgValid;
    BOOL fgPosition; // use position or pts.
    VDP_POS_INTO_T rA;
    VDP_POS_INTO_T rB;
} VDP_AB_INTO_T;

// This structure must be same with FBM_PIC_EXTRA_INFO_T
/**
 *  VDP PIC EXTRA INFO
 */
typedef struct
{
    BOOL fgValid;

    UINT64 u8PTSI;                                  //  I frame pts
    UINT64 u8AudPTS;
    UINT64 u8AudOffset;
} VDP_PIC_EXTRA_INTO_T;

typedef struct
{
    BOOL fgValid;
    UINT32 u4BufAddr;
} VDP_LOCK_PIC_INFO_T;

/**
 *  Seamless display info
 */
 typedef struct
{
    UINT32 u4SrcWidth;
    UINT32 u4SrcHeight;
} VDP_SEAMLESS_INFO_T;
typedef VOID (* PFN_TRIG_AUD_ARRIVE_CB)(VOID *pvTag);

typedef struct _VDP_TRIG_AUD_ARRIVE_CB_T
{
    PFN_TRIG_AUD_ARRIVE_CB  pfnTrigAud;
    VOID                    *pvTag;
} VDP_TRIG_AUD_ARRIVE_CB_T;

/**
 *  VDP Seek mode structure 
 */
typedef struct _VDP_SEEK_PRM_T
{
    UCHAR ucSeekMode;
    UINT32 u4SeekPts;
    UCHAR ucNotifyTrigger;
    UCHAR ucABNotifyTrigger;
    UINT8 u1TimeoutCnt;
    BOOL fgABReach;
} VDP_SEEK_PRM_T;

typedef struct _VDP_RT_STC_ADJ_T
{
    INT32       i4_vid_diff;
    INT32       i4_aud_diff;
    INT32       i4_ave_diff;
    UINT32      u4_adj_cnt;
} VDP_RT_STC_ADJ_T;

typedef struct _VDP_WFD_PRM_T
{
    BOOL        fgInitalized;
    BOOL        fgDblClk;
    BOOL        fgDnmcltncy;
    HAL_TIME_T  t_start_time;
    UINT32      u4_pkt_cnt;
    UINT32      u4_ltncy_ns;
    UINT32      u4_ltncy_max;
    VDP_RT_STC_ADJ_T    t_stc_adj;
} VDP_WFD_PRM_T;

typedef struct _B2R_VDP_4K60_T
{
    BOOL   fgEnable;
    UINT32 u4StartPTS;
    UINT32 u4Rate;
    UINT32 u4Scale;
} B2R_VDP_4K60_T;

typedef struct _B2R_RT_CLI_T
{
    BOOL   b_active;
    BOOL   b_dynamic_latency;
    UINT32 u4_latency_ns;
    UINT32 u4TimeCur;
    UINT32 u4FrameCnt;
    UINT64 u8TimeAve;
    UINT64 u8TimeTotal;
} B2R_RT_CLI_T;

/**
 *  VDP trigger mode + audio master to do trigger mode 
 */
typedef struct _VDP_TRIG_AUD_PRM_T
{
    UCHAR ucTriggerReceived;
    UINT64 u8TriggerPts;
    VDP_TRIG_AUD_ARRIVE_CB_T rTrgAudCbInfo;
} VDP_TRIG_AUD_PRM_T;

typedef struct _VDP_TRIG_AUD_INFO_T
{
    BOOL    b_aud_auto_en;
    UINT32  u4AdecId;
} VDP_TRIG_AUD_INFO_T;

typedef struct _VDP_TRIG_AUD_CFG_T
{
    BOOL    fgTrigEnable;
    UINT64  u8Pts;
    VDP_TRIG_AUD_INFO_T    rAudInfo;
    VOID*                  prTrgAudCbInfo;
} VDP_TRIG_AUD_CFG_T;

typedef struct _B2R_CB_COMM_DATA_T
{
    VOID*   pv_tag;
} B2R_CB_COMM_DATA_T;

typedef struct _B2R_CB_INFO_T
{
union
    {
        B2R_CB_COMM_DATA_T t_comm;
    }u;
} B2R_CB_INFO_T;

typedef struct _B2R_REG_CB_OBJ_T
{
    VOID*          pfCb;
    B2R_CB_INFO_T  rCbInfo;
} B2R_REG_CB_OBJ_T;

typedef struct _B2R_CUST_INFO_T
{
    UINT32                  u4resolutionChg;
    UINT32                  u4HDRContent;
    UINT32                  u4MMSrcType;
    ENUM_CODEC_INFO_T       eCodecInfo;
    FBM_COLOR_SPACE_ID      eColorID;
    FBM_CODEC_RESOLUTION_T  rResolution;
    HDRSRC_PROFILE_T        tHdrInfo;
    FBM_HDR_TYPE_DETECT_INFO_T tHdrDetectInfo;
} B2R_CUST_INFO_T;

typedef struct _B2R_QP_VAL_T
{
    INT32 i4PPSLayerQp;	
    INT32 i4SliceLayerQp;
    INT32 i4MBLayerQp;
    INT32 i4QpMin;
    INT32 i4QpMax;
    HDRSRC_PROFILE_T  tHdrInfo;
    FBM_DECODER_INFO_METER_T tDecInfo;
} B2R_QP_VAL_T;

typedef struct
{
    BOOL        fgAudioValid;
    UINT32      u4Pts;
    INT32       i4DeltaPts;
    HAL_TIME_T  rDeltaTime;
}B2R_PTS_INFO_T ;

/**
 *  B2R using only one frame to change picture
 */
typedef struct _B2R_ONE_FB_CHANGE_T
{
    BOOL fgTrigger;
    BOOL fgReusing;
    UINT32 u4Count;
} B2R_ONE_FB_CHANGE_T;

typedef enum
{
    B2R_IM_ONE_ADDR  = 0x00,
    B2R_IM_TWO_ADDR,
    B2R_IM_MAX
} B2R_INTERLACE_MODE_T;

/** Brief of B2R_PRM_T
 */
typedef struct
{
    UCHAR ucMode;

    // Last Field
    UCHAR ucBottom;
    UCHAR ucRightView;
    // Common
    //UCHAR ucVdpId;
    UCHAR ucB2rId;
    UCHAR ucFbgId;
    UCHAR ucReady;              // if Ready, forceBg = 0;
    UCHAR ucNotSupport;
    UCHAR ucFastChangeEn;

    // Frame Buffer
    UCHAR ucFbId;
    UCHAR ucBackupFbId;
    UCHAR ucLastFbId;           // check temporal reference
    UCHAR ucReleaseFbId;
    UCHAR ucPendingFbId;        // Store FB which is pending for display at start
    UCHAR ucOmxReleaseFbId;
    UCHAR ucOmxRenderFbId;
    UCHAR ucReleased;

    UCHAR ucPendingNewFb;       // Pending for New Frame Buffer, FBM (MPEG) can put new frame buffer to VDP, instread of polling by VDP thread
    UCHAR ucNewFbArrive;        // New Frame Buffer Arrive
    UCHAR ucMMWaitSTC;          // MM mode, wait STC while PTS is larger than STC
    UCHAR ucRealChangeFb;       // MM mode, Read change FB, not change to pending FB
    UCHAR ucSubFbgId;
    UCHAR ucSubFbId;
    UCHAR ucSubReleaseFbId;
    UCHAR ucSubPendingFbId;
    UCHAR ucSubFbgIdRecorded;
    UCHAR ucSubReleased;

    // Output
    UCHAR ucOutputMode;
    UCHAR ucOutFrameRate;
    UCHAR ucProgressiveOut;

    // I 2 I
    UCHAR ucInterlace2Interlace;
    UCHAR ucWrongField;

    // for 420 chroma mode
    UCHAR ucTff;
    UCHAR ucRff;
    UCHAR ucLastTff;
    UCHAR ucLastRff;
    UCHAR ucProgressiveFrame;
    UCHAR ucLastProgressiveFrame;
    UCHAR ucPicCdTp;
    UCHAR ucHwFrameEncode;
    UCHAR ucTffStableCounter;

    // Frc
    UCHAR ucMultipleField;      // multiple field display due to RFF/TFF
    UCHAR ucStopAuto;

    // Display Ns
    UINT16 u2TargetNs;
    UINT16 u2ChangeFieldNs;
    UINT16 u2TargerVsyncNs;
    UINT16 u2ChangeFieldVsyncNs;
    UINT16 u2CurrentVsyncNs;
    UINT16 u2RestoreNs;

    // 32 flag source
    UCHAR ucValid32Seq;
    UCHAR ucPd32SeqStep;
    UCHAR ucRelease32Cnt;

    // Mpeg2 Sequence/Picture Header
    UCHAR ucEarlyNotify;
    UCHAR ucSeqInfoValid;
    UCHAR ucProgressiveSeqFlag;
    UCHAR ucLastAcsFrame;
    UCHAR ucLastAcsAuto;
    UCHAR ucInFrameRate;
    INT32 i4TemporalRef;
    UINT16 u2DecodingOrder;

    // Frame Rate Conversion
    UINT32 u4InStcPeriodBase;
    UINT32 u4InStcPeriod;
    UINT32 u4OutStcPeriod;
    UINT32 u4OutFrameStc;
    UINT32 u4InFrameStc;

    // AV Sync
    UINT64 u8Pts;
    UINT32 u4TotlaTimeOffset;
    UINT32 u4PtsAsyncNs;
    UINT32 u4PtsAvSyncNotAllow;
    INT64  i8PtsDrift;
    UINT32 u4KeepDropB;         // Too much slower than Headend
    UINT32 u4WaitUnmute;
    UINT32 u4B2rSkipFrameNo;

    // Partial PES Handle
    UINT64 u8LastPts;
    UINT64 u8PtsDelta;       // PTS delta (IIR) between two non-zero PTS
    UINT32 u4ZeroPtsNs;	     // handle Zero PTS & PTS Jitter Filter

    // Frame Success Counter
    //UINT32 u4FrameSuccess;

    // Frame Repeated Counter
    //UINT32 u4FrameRepeated;

    //File position
    UINT32 u4TickNum;
    UINT64 u8FilePosition;
    UINT64 u8FilePositionI; // closed I frame pos

    //for AB repeat
    VDP_PIC_EXTRA_INTO_T rExtra;

    BOOL fgDummyFrame;
    BOOL fgProgress2Interlace;

    // Last Sync Time
    HAL_TIME_T rLastAvSyncTime;

    //--todo refine it later
    //other info
    BOOL fgReleaseDispQ;

    //for fastforward info
    BOOL fgFastForward;
    BOOL fgTunnel;
    //b2r 3d info
    BOOL fgB2R3DError;
    UINT32 u4B2R3DSuccessCount;
    UINT32 u4B2R3DErrorCount;
    BOOL fgB2R3DEnable;
    BOOL fgB2RForce2D;
    BOOL fgB2RNoLock;
    BOOL fgFrmPending;
    UINT8 u1B2R3DType;
    UINT8 u1B2RForce2DType;
    UINT32 u4B2R3DWidthOffset;
    UINT32 u4B2R3DHeightOffset;
    BOOL fgDispFail;
    UINT8 u1B2R3DTrickModeType;
    // for multiple instance
    UINT8 u1AttachedSrcId;
    B2R_CUST_INFO_T*    pt_cust_info;
 
    UCHAR ucSeamlessVDPMode; 

    /*for NPTV flow*/
    UINT32  u4NPTVWidth;
    UINT32  u4NPTVHeight;
    UINT32  u4SeamlessWidth;
    UINT32  u4SeamlessHeight;
	UINT32  u4Soc;

    // Need restore NS after frame repeat
    VDP_WFD_PRM_T   t_wfd_prm;
    B2R_RT_CLI_T*   ptRtCli;

    B2R_ONE_FB_CHANGE_T rOneFbChg;
    BOOL fgRenderRegionChg;
    VDP_REGION_T rRenderRegion;

    BOOL            fgNeedPorch;
    B2R_INTERLACE_MODE_T eIntMode;
	UINT32			u4LastPicW;
	UINT32			u4LastPicH;
	UINT32  		u4LastSoc;

    BOOL            fgLast3D;
    UINT32          u4TimeScale;
    UINT8           u1FrmIdx;
    UINT8           ucRealFrameRate;

    UINT32          u4Sing ;
} B2R_PRM_T;

/**
 *  B2R call back function type id.
 */
typedef enum
{
	B2R_CB_FUNC_TRIG_AUD_TO_PLAY,
    B2R_CB_FUNC_EOS,
    B2R_CB_FUNC_PTS_RENDER,
    B2R_CB_FUNC_NS
} B2R_CB_FUNC_ENUM_T;

/**
 * B2R call back function pool
 */
typedef struct _B2R_CB_FUNC_T
{
    BOOL afgReg[B2R_CB_FUNC_NS];
    UPTR au4CbFunc[B2R_CB_FUNC_NS];
    B2R_REG_CB_OBJ_T  pu4CbObj[B2R_CB_FUNC_NS];
} B2R_CB_FUNC_T;

typedef enum
{
    VDP_SMLS_MODE_NONE,   
    VDP_SMLS_PREPARE,     // Set vVRMSetEventFlg(path, VRM_EVENT_BY_B2R) for NPTV to prepare new w/h cfg.
    VDP_SMLS_READY,       // Check NPTV ready or not by bVRMReadyForB2R(ucVdpId).
    VDP_SMLS_FRAME_COMING,  // Resolution change frames coming, current must be ready status.
    VDP_SMLS_PREPARE_WHILE_START_PLAY,  //Start play with NPTV seamless, prepare
    VDP_SMLS_READY_WHILE_START_PLAY,    //Start play with NPTV seamless, ready
}SEAMLESS_MODE_E;


typedef enum _B2R_RT_TYPE_T
{
    B2R_RT_TYPE_CLI_ACTIVE,
    B2R_RT_TYPE_LARENCY_NS,
    B2R_RT_TYPE_LARENCY_QY
}B2R_RT_TYPE_T;

typedef enum
{
	B2R_GAME_MODE_OFF,
	B2R_GAME_MODE_LOW_DELAY,
	B2R_GAME_MODE_HIGHT_QUALITY
}B2R_GM_TYPE_T;

typedef struct _B2R_CFG_SRC_REG_T
{
    UINT32  u4SrcLineSize;
    UINT32  u4SrcWidth;
    UINT32  u4SrcHeight;
}B2R_CFG_SRC_REG_T;

typedef struct _B2R_OUT_INFO_T
{
    UCHAR ucPmxId;
    UCHAR ucPmxMode;
    UCHAR ucPrg;
    UCHAR ucFrameRate;
    UCHAR ucDoubleClk;
    UCHAR ucInputFrameRate;     // For Clock Configuration
    UINT32 u4FloatFrameRate;
    UINT32 u4Width;
    UINT32 u4Height;
    UINT32 u4TotalWidth;
    UINT32 u4TotalHeight;
    UINT32 u4ClkMode;
} B2R_OUT_INFO_T;

typedef struct _B2R_HW_CHG_T
{
    BOOL b_HwChg;
    UCHAR ucChgB2rId;
} B2R_HW_CHG_T;

union _B2R_ARG_T
{
	UINT32 u4AdjTargetNs;
	UINT32 u4AdjPts;
};

typedef struct _B2R_RENDER_SPEED_ADJ_T
{
	UINT8 u1Type;
	union _B2R_ARG_T arg;
	BOOL fgEnable;
} B2R_RENDER_SPEED_ADJ_T;

typedef struct _VDP_CFG_T
{
    UCHAR ucVdpEnable;
    UCHAR ucB2rId;
    UCHAR ucEnable;
    UCHAR ucStatus;
    UCHAR ucVdpId;
    UCHAR ucMode;
    
    //   UCHAR ucDispMode;
    // Input port (frame buffer group ID)
    UCHAR ucInputPort[VDP_MAX_INPORT_NS];
    //UCHAR ucPauseMm;
    UCHAR ucNoOverScan;
    UCHAR ucEarlyDisp;
    BOOL fgMMPlayback;//DTV or mmp
    UCHAR ucColorDescrip;
    UCHAR ucColourPrimary;
    UCHAR ucTransCharacter;
    UCHAR ucMatrixCoeff;

    // source information
    UINT32 u4SrcLineSize;
    UINT32 u4SrcWidth;
    UINT32 u4SrcHeight;
    UINT32 u4AspectRatio;
    UINT32 u4FrameRate;
    UINT32 u4QpAvg;
    UINT32 u4Afd;

    B2R_OUT_INFO_T rOutInfo;
    
    UINT32 u4BgColor; // YCbCr
    UINT32 u4MpegWidth;
    UINT32 u4MpegHeight;

    UINT32 u4FrmCropTop;
    UINT32 u4FrmCropBtm;

    HANDLE_T hMutex;
    BOOL   fgCropping;
    UINT32 u4CropX;
    UINT32 u4CropY;
    UINT32 u4CropWidth;
    UINT32 u4CropHeight;

    UINT32 u4AspectRatioWidth;
    UINT32 u4AspectRatioHeight;
    UINT32 u4AspectRatioIdc;
    
    UINT32 u4LogFilter;
    UINT32 u4FrmDelay;

    BOOL fgAvsyncSkip;
    UINT8  u1KeepFrmCnt;
    B2R_GM_TYPE_T eGameMode;
    B2R_RENDER_SPEED_ADJ_T eRenderAdj;
}VDP_CFG_T;

typedef struct _B2R_STATUS_T
{
    UCHAR ucB2rId;
    UCHAR ucEnable;
    UCHAR ucStatus;
     BOOL fgMMPlayback;//DTV or mmp
} B2R_STATUS_T;

typedef struct _B2R_ASP_INFO_T
{
    UINT32 u4Afd;
    UINT32 u4AspectRatio;
    UINT32 u4AspectRatioIdc;
    UINT32 u4AspectRatioWidth;
    UINT32 u4AspectRatioHeight;
} B2R_ASP_INFO_T;

#if	defined (CC_SUPPORT_TECHNICOLOR_HDR)
typedef struct  {
	UINT32 tmInputSignalBlackLevelOffset;
	UINT32 tmInputSignalWhiteLevelOffset;
	UINT32 shadowGain;
	UINT32 highlightGain;
	UINT32 midToneWidthAdjFactor;
	UINT32 tmOutputFineTuningNumVal;
	UINT32 tmOutputFineTuningX[10];
	UINT32 tmOutputFineTuningY[10];
	UINT32 saturationGainNumVal;
	UINT32 saturationGainX[6];
	UINT32 saturationGainY[6];

}SL_B2R_HDR_METADATA_VARIABLES;

typedef struct  {
    UINT32 luminanceMappingNumVal;
    UINT32 luminanceMappingX[65];
    UINT32 luminanceMappingY[65];
    UINT32 colourCorrectionNumVal;
    UINT32 colourCorrectionX[65];
    UINT32 colourCorrectionY[65];
}SL_B2R_HDR_METADATA_TABLES;

typedef struct  {
    UINT32 partID;
    UINT32 majorSpecVersionID;
    UINT32 minorSpecVersionID;
    UINT32 payloadMode;
    UINT32 hdrPicColourSpace;
    UINT32 hdrDisplayColourSpace;
    UINT32 hdrDisplayMaxLuminance;
    UINT32 hdrDisplayMinLuminance;
    UINT32 sdrPicColourSpace;
    UINT32 sdrDisplayColourSpace;
    UINT32 sdrDisplayMaxLuminance;
    UINT32 sdrDisplayMinLuminance;
    UINT32 matrixCoefficient[4];
    UINT32 chromaToLumaInjection[2];
    UINT32 kCoefficient[3]; 
    union{
      SL_B2R_HDR_METADATA_VARIABLES metadata_variables;
      SL_B2R_HDR_METADATA_TABLES  metadata_tables;	
  	};
}SL_B2R_HDR_METADATA;
#endif
#define B2R_SPEED_TYPE_FORWARD_1X            (1 << 10)
#define B2R_SPEED_TYPE_FORWARD_2X            (2 << 10)
#define B2R_SPEED_TYPE_FORWARD_3X            (3 << 10) // FixMe
#define B2R_SPEED_TYPE_FORWARD_4X            (4 << 10)
#define B2R_SPEED_TYPE_FORWARD_8X            (8 << 10)
#define B2R_SPEED_TYPE_FORWARD_16X           (16 << 10)
#define B2R_SPEED_TYPE_FORWARD_32X           (32 << 10)
#define B2R_SPEED_TYPE_FORWARD_64X           (64 << 10)
#define B2R_SPEED_TYPE_FORWARD_128X          (128 << 10)
#define B2R_SPEED_TYPE_FORWARD_256X          (256 << 10)
#define B2R_SPEED_TYPE_FORWARD_512X          (512 << 10)
#define B2R_SPEED_TYPE_FORWARD_1024X         (1024 << 10)
#define B2R_SPEED_TYPE_FORWARD_1_DIV_2X      (1 << 9)
#define B2R_SPEED_TYPE_FORWARD_1_DIV_3X      (1 << 9) // FixMe
#define B2R_SPEED_TYPE_FORWARD_1_DIV_4X      (1 << 8)
#define B2R_SPEED_TYPE_FORWARD_1_DIV_8X      (1 << 7)
#define B2R_SPEED_TYPE_FORWARD_1_DIV_16X     (1 << 6)
#define B2R_SPEED_TYPE_FORWARD_1_DIV_32X     (1 << 5)
#define B2R_SPEED_TYPE_FORWARD_0_DOT_6X      (6 << 10)   /* Slow Forward 0.6X */
#define B2R_SPEED_TYPE_FORWARD_0_DOT_7X      (7<< 10)    /* Slow Forward 0.7X */
#define B2R_SPEED_TYPE_FORWARD_0_DOT_8X      (8 << 10)   /* Slow Forward 0.8X */
#define B2R_SPEED_TYPE_FORWARD_0_DOT_9X      (9 << 10)   /* Slow Forward 0.9X */
#define B2R_SPEED_TYPE_FORWARD_1_DOT_1X      (11 << 10)  /* Fast Forward 1.1X */
#define B2R_SPEED_TYPE_FORWARD_1_DOT_2X      (12 << 10)  /* Fast Forward 1.2X */
#define B2R_SPEED_TYPE_FORWARD_1_DOT_3X      (13 << 10)  /* Fast Forward 1.3X */
#define B2R_SPEED_TYPE_FORWARD_1_DOT_4X      (14 << 10)  /* Fast Forward 1.4X */
#define B2R_SPEED_TYPE_FORWARD_1_DOT_5X      (15 << 10)  /* Fast Forward 1.5X */
#define B2R_SPEED_TYPE_REWIND_1X
#define B2R_SPEED_TYPE_REWIND_2X
#define B2R_SPEED_TYPE_REWIND_3X
#define B2R_SPEED_TYPE_REWIND_4X
#define B2R_SPEED_TYPE_REWIND_8X
#define B2R_SPEED_TYPE_REWIND_16X
#define B2R_SPEED_TYPE_REWIND_32X
#define B2R_SPEED_TYPE_REWIND_64X
#define B2R_SPEED_TYPE_REWIND_128X
#define B2R_SPEED_TYPE_REWIND_256X
#define B2R_SPEED_TYPE_REWIND_512X
#define B2R_SPEED_TYPE_REWIND_1024X


//return value
#define B2R_OK                     (0)
#define B2R_FAIL                   (1)
#define B2R_INV_ARG                (2)
#define B2R_INTERNAL_ERR           (3)
#define B2R_NOT_IMPL               (4)

#define B2R_POWERON_TRIGGER_EVENTS_MODE_CHANGE   (1 << 0)
#define B2R_POWERON_TRIGGER_EVENTS_START_DISP    (1 << 1)

typedef enum _B2R_SET_TYPE_CFG_T
{
    B2R_CFG_MODE,
    B2R_CFG_VDP_ENABLE
}B2R_SET_TYPE_CFG_T;

typedef enum _B2R_GET_TYPE_T
{
    B2R_GET_TYPE_B2R_STATUS,
    B2R_GET_TYPE_ASP_INFO
}B2R_GET_TYPE_T;

typedef enum _B2R_GET_CUST_TYPE_T
{
    B2R_GET_TYPE_CUST_INFO,
    B2R_GET_TYPE_ASPINFO,
    B2R_GET_TYPE_SRC,
    B2R_GET_TYPE_QP_INFO,
    B2R_GET_TYPE_BIT_DEPTH,
    B2R_GET_TYPE_SRC_FRMRATE,
    B2R_GET_TYPE_INPUT_SRC
}B2R_GET_CUST_TYPE_T;

///-----------------------------------------------------------------------------
/// Public functions
///-----------------------------------------------------------------------------

/**
 * VDP connect to video decoder.
 *
 * @param ucVdpId specify the video plane id.
 * @param ucEsId specify video decoder id.
 * @param ucPort always 0.
 * @return VDP_SET_ERROR or VDP_SET_OK
 */
EXTERN VOID B2R_VB1_ENABLE_CLI( BOOL fgEnable);

EXTERN UCHAR VDP_Vdp2B2rId(UCHAR ucVdpId);
EXTERN UINT32 VDP_SetInput(UCHAR ucVdpId, UCHAR ucEsId, UCHAR ucPort);

/**
 * VDP query video plane input connection.
 *
 * @param ucVdpId specify the video plane id.
 * @param ucPort always 0.
 * @param pucFbgId video decoder id.
 * @return VDP_SET_ERROR or VDP_SET_OK
 */
EXTERN UINT32 VDP_GetLockFrameBufferAddr(UCHAR ucVdpId, VDP_CAPTURE_INTO_T* prCapInfo);

EXTERN UINT32 VDP_GetDisplayFrameBufferAddr(UCHAR ucVdpId, VDP_CAPTURE_INTO_T* prCapInfo);

EXTERN UINT32 VDP_SetSpeed(UCHAR ucVdpId, STC_SPEED_TYPE_T eSpeed);

EXTERN UINT32 VDP_GetPts(UCHAR ucVdpId);
EXTERN UINT64 VDP_GetPtsEx(UCHAR ucVdpId);

EXTERN UINT32 VDP_SetStepForward(UINT8 ucVdpId, UCHAR ucSet);

EXTERN UCHAR VDP_GetStepForward(UINT8 ucVdpId);

EXTERN UINT32 VDP_SetSlowForward(UINT8 ucVdpId, UCHAR ucSet);

EXTERN UCHAR VDP_GetSlowForward(UINT8 ucVdpId);

EXTERN UINT32 VDP_SetFBNoTimeout(UINT8 ucVdpId, UCHAR ucSet);

EXTERN UINT32 VDP_GetFrameRate(UCHAR ucVdpId);

EXTERN UINT32 VDP_TrickModeSkipFrameNo(UCHAR ucVdpId);

EXTERN UINT32 VDP_SetTrickMode(UINT8 ucVdpId,UCHAR ucTrick);

EXTERN VOID VDP_SetSeek(UCHAR ucVdpId, UCHAR ucSet, UINT32 u4Pts);
EXTERN void VDP_SetSeekMode(UCHAR ucVdpId, UCHAR ucSet, UINT32 u4Pts);

EXTERN VOID VDP_SetABRepeat(UCHAR ucVdpId, UCHAR ucSet);

EXTERN UCHAR VDP_SetThumbnailMode(UCHAR ucVdpId, UCHAR ucSet);

EXTERN VOID VDP_SetCbAttachedSrcId(UCHAR ucVdpId, UINT32 u4AttachId);

EXTERN BOOL B2R_CkgenOnOff(BOOL fgEnable);

EXTERN BOOL VDP_IsStartToPlay(UCHAR ucVdpId);

EXTERN BOOL VDP_GetB2R2DSupport(UINT32 u4Width,UINT32 u4Height);

EXTERN UCHAR VDP_GetSeamlessInfo(UCHAR ucVdpId, VDP_SEAMLESS_INFO_T* prSeamlessInfo);

EXTERN BOOL VDP_Is422Mode(UCHAR ucVdpId);

EXTERN B2R_INTERLACE_MODE_T VDP_GetInterlaceTwoMode(UCHAR ucVdpId);

EXTERN UCHAR VDP_FrcGetLockFrameBuffer(UCHAR ucVdpId);

EXTERN VOID VDP_SetTimeShiftSpeed(UINT8 u1B2rId,UINT32 u4SpeedValue);

EXTERN VOID VDP_SetTimeShiftMode(UINT8 u1B2rId,BOOL fgEnable);

EXTERN UINT32 VDP_SetB2rNoLock(UINT8 ucVdpId, BOOL fgNoLock);

EXTERN UCHAR VDP_GetFbg(UCHAR ucB2rId);

EXTERN BOOL VDP_GstEnablGstLog(UCHAR ucVdpId);

EXTERN VOID VDP_SetEnableLog(UCHAR ucVdpId, UINT32 u4Arg1, UINT32 u4Arg2);

EXTERN VOID VDP_SetAvsync(UCHAR ucVdpId,UINT32 u4Arg1);

EXTERN UINT32 VDP_SetPauseMm(UCHAR ucVdpId, UCHAR ucPause);

EXTERN UINT32 VDP_SetTunnel2X(UINT8 ucVdpId, BOOL fgPause);

EXTERN VOID VDP_SetDropFrame(UCHAR ucVdpId);

EXTERN VOID VDP_SetRepeatFrame(UCHAR ucVdpId);

EXTERN VOID VDP_FrcSetFreeze(UCHAR ucVdpId, UINT32 u4OnOff);

EXTERN VOID VDP_Pattern(UCHAR ucVdpId, UINT32 u4Arg1, UINT32 u4Arg2, UINT32 u4Arg3);

EXTERN UCHAR VDP_GetOutFrameRate(UCHAR ucVdpId);

EXTERN UINT8 VDP_Es2Vdp(UCHAR ucEsId);

EXTERN VOID VDP_B2rSwitch(UCHAR ucVdpId, UCHAR ucB2rId);

/* VDP trigger mode + audio master to do trigger mode */
EXTERN VOID VDP_TriggerAudReceive(UINT8 ucVdpId, UINT64 u4Pts);

/** Disable VDP Trigger action */
EXTERN BOOL VDP_TriggerAudReceiveEx(UINT8 ucVdpId, BOOL fgEnable, UINT64 u4Pts);

EXTERN UCHAR VDP_GetPlayMode(UCHAR ucVdpId);

EXTERN VOID VDP_SetB2RMirror(UCHAR ucVdpId, BOOL fgOn);

EXTERN VOID VDP_FrcResetPort(UCHAR ucVdpId, UCHAR ucPort);

/**
 * Get mute status of DTV playback
 *
 * @param ucVdpId specify the video plane id.
 * @return TRUE for mute, FALSE for not mute
 */
EXTERN BOOL VDP_GetUnMuteStatus(UCHAR ucVdpId);
//EXTERN BOOL VDP_Is4To1024XSpeed(UINT32 u4Speed);
EXTERN VOID VDP_SetB2rStc(UINT8 ucVdpId,UINT32 u4B2rStc);
EXTERN UINT32 VDP_GetB2rStc(UINT8 ucVdpId);

EXTERN UINT32 VDP_SetFrmCrop(UCHAR ucVdpId, UINT32 u4FrmCropTop, UINT32 u4FrmCropBtm);


EXTERN UCHAR VDP_GetPendingFB(UCHAR ucVdpId, UCHAR ucFbgId);
EXTERN VOID VDP_CleanPendingFB(UCHAR ucVdpId, UCHAR ucFbgId);
EXTERN VOID VDP_SetReleaseDispQ(UCHAR ucVdpId, UCHAR ucFbgId);
EXTERN VOID VDP_HalGetB2rDispInfo(UCHAR ucVdpId,B2R_DISP_INFO_T* ptB2rInfo);

EXTERN VOID VDP_SetChkPTS(UINT32 u4Pts);

EXTERN void VDP_SetEncTrigger(BOOL fgEnable);

EXTERN BOOL VDP_GetFilePosition(UCHAR ucVdpId,
                                INT32 *pi4TempRef, UINT16 *pu2DecodingOrder,
                                UINT64 *pu8Offset, UINT64 *pu8OffsetI);

EXTERN BOOL VDP_GetPosInfo(UCHAR ucVdpId, VDP_POS_INTO_T *prPosInfo);

EXTERN BOOL VDP_SetABInfo(UCHAR ucVdpId, VDP_AB_INTO_T *prAB);

/**
 * VDP query function, show DTV status in CLI with debug level 1.
 *
 * @param VOID
 * @return VOID
 */
EXTERN VOID VDP_PrintDtvInfo(VOID);

EXTERN INT32 VDP_GetPtsStcDelta(UCHAR ucB2rId);
EXTERN BOOL VDP_GetTimeShfitStartPlay(UCHAR ucB2rId);

EXTERN UINT32 VDP_GetCurrentPts(UCHAR ucB2rId);

EXTERN UCHAR VDP_B2r2Vdp(UCHAR ucB2rId);

EXTERN UCHAR VDP_Vdp2Es(UCHAR ucVdpId);

EXTERN UCHAR VDP_Stc2B2r(UCHAR ucStcId);

EXTERN UCHAR B2R_GetEs2Fbg(UCHAR ucEsId);

EXTERN VOID VDP_ResetPts(UCHAR ucVdpId);

EXTERN VOID VDP_FrcSetPtsCb(UINT32 u4CbArg, UINT32 u4CbPts);

EXTERN VOID VDP_FrcSetLipSyncCb(UCHAR ucVdpId, UCHAR ucPort, UINT32 u4Thrsd, UINT32 u4FrmCnt);

EXTERN VOID VDP_FrcSetLipSyncNGOKCb(UCHAR ucNgOk, UCHAR ucRemove, UINT32 u4Thrsd, UINT32 u4FrmCnt);

EXTERN VOID B2R_SetImgConnect(UCHAR ucVdpId, UCHAR ucConnect);

EXTERN UCHAR B2R_GetImgConnect(UCHAR ucVdpId);
EXTERN void B2R_HalEnableSmartPcr(UCHAR ucB2rId, BOOL fgEn);


/**
 * Video Image Module : Get information
 *
 * @param VOID
 * @return pointer of Video Image Module Capability Infomation
 */
EXTERN VDP_IMAGE_INFO_T* VDP_Image_GetInfo(VOID);

/**
 * Video Image Module : Connect
 *
 * @param u4VdpId: Video plane connected to
 * @return VDP_SET_OK or VDP_SET_ERROR
 */
EXTERN UINT32 VDP_Image_Connect(UINT32 u4VdpId);

/**
 * Video Image Module : Disconnect
 *
 * @param VOID
 * @return VDP_SET_OK or VDP_SET_ERROR
 */
EXTERN UINT32 VDP_Image_Disconnect(VOID);

/**
 * Video Image Module : Mute on/off
 *
 * @param u4OnOff: Mute on/off
 * @return VDP_SET_OK or VDP_SET_ERROR
 */
EXTERN UINT32 VDP_Image_Mute(UINT32 u4OnOff);

/**
 * Video Image Module : Show Frame Buffer
 *
 * @param prInfo: Frame Buffer Info
 * @return VDP_SET_OK or VDP_SET_ERROR
 */
EXTERN UINT32 VDP_Image_Show(VDP_IMAGE_ARG_T* prInfo);

/**
 * Video Image Module : Get Frame Buffer Address
 *
 * @param u4FrameBufferId: Frame Buffer id
 * @param u4YAddr: pointer to store Y address
 * @param u4CAddr: pointer to store C address
 * @return VDP_SET_OK or VDP_SET_ERROR
 */
EXTERN UINT32 VDP_Image_GetFrameBuffer(UINT32 u4FrameBufferId, UINT32* u4YAddr, UINT32* u4CAddr);


EXTERN UINT32 VDP_GetPicInfo(UCHAR ucVdpId, VDP_PIC_INFO_T* prPicInfo);

EXTERN UINT32 VDP_SetPicInfo(UCHAR ucVdpId, VDP_SET_PIC_INFO_T rPicInfo);

EXTERN VOID VDP_SetB2rEnable(UCHAR ucVdpId);

EXTERN VOID _VdpCheckFbgReady(UCHAR ucFbgId, UCHAR ucEsId);


EXTERN VOID VDP_CheckFbgReady(VOID);


/* whether Update STC when VDP start output or not */
EXTERN BOOL VDP_SetPendingForStc(UINT8 ucVdpId, BOOL fgPending);

EXTERN VOID VDP_VsyncSendCmd(UCHAR ucVdpId, UCHAR ucCmdId);

EXTERN VOID VDP_VsyncReset(UCHAR ucVdpId);

EXTERN UINT32 VDP_Set3DInfo(UCHAR ucVdpId,UINT8 u13DType,BOOL fg3DEnable);

EXTERN BOOL VDP_GetSeamlessResizeSize(UCHAR ucVdpId, UINT32 *pu4ResizeWidth, UINT32 *pu4ResizeHeight);

EXTERN VOID B2R_SetChapterEnable(VOID* prChapter);

EXTERN B2R_PRM_T* VDP_GetVdpPrm(UINT8 u1B2rId);

EXTERN BOOL VDP_SendB2RChgFrameMsg(VDP_B2R_CHG_FRAME_MSG_T *prMsg);

EXTERN BOOL VDP_FlushB2RChgFrameMsg(UCHAR ucVdpId);

EXTERN VOID B2R_Init(VOID);


EXTERN INT32 B2R_Get_Cust_info(UCHAR                 ucVdpId,
                               B2R_GET_CUST_TYPE_T   e_set_type,
                               VOID*                 pv_get_info,
                               SIZE_T                z_set_info_size);

EXTERN INT32 B2R_RTSetInfo (UCHAR               ucB2rId,
                            B2R_RT_TYPE_T       e_set_type,
                            VOID*               pv_set_info,
                            SIZE_T              z_set_info_size);

EXTERN VDP_CFG_T* B2R_GetVdpConf(UCHAR ucVdpId);

EXTERN INT32 VDP_B2R_GetInfo (UCHAR            ucVdpId,
                            B2R_GET_TYPE_T   e_get_type,
                            VOID*            pv_get_info,
                            SIZE_T           z_get_info_size);

EXTERN INT32 VDP_B2R_SetCfgParam (UCHAR               ucVdpId,
                                         B2R_SET_TYPE_CFG_T   e_set_type,
                                         VOID*                pv_set_info,
                                         SIZE_T               z_set_info_size);

EXTERN INT32 B2R_RegCbFunc(UCHAR ucVdpId, B2R_CB_FUNC_ENUM_T eFuncType, UPTR u4FuncPtr, UPTR u4Arg1);

EXTERN INT32 B2R_UnRegCbFunc(UCHAR ucVdpId, B2R_CB_FUNC_ENUM_T eFuncType);

EXTERN INT32 B2R_AudTrigger(UINT8 ucVdpId, VDP_TRIG_AUD_CFG_T* pr_trig_cfg);

EXTERN INT32 B2R_FilterLog(UCHAR ucVdpId, UCHAR ucEnable, UINT32 u4Mask);

EXTERN INT32 B2R_PreparePbRestart(UINT8 ucVdpId);

EXTERN INT32 B2R_SetGameMode(UCHAR ucVdpId, B2R_GM_TYPE_T eMode);

EXTERN INT32 B2R_StcFineTune(UCHAR ucStcId, UINT32 u4StcTune);

EXTERN BOOL B2R_Is4kTunnelMode(UCHAR ucVdpId);

EXTERN BOOL VDP_Is422Mode(UCHAR ucVdpId);

EXTERN void _B2R_PendingforAudioCB(UCHAR ucVdpId, BOOL fgAudioCb);

#ifdef CC_SUPPORT_PHOTO8K
EXTERN BOOL VDP_B2R_SetPhotoMode(UCHAR ucVdpId,UINT32 u4Mode);
EXTERN BOOL VDP_B2R_SetDivPhotoState(UCHAR ucVdpId,UINT32 u4HRegion,UINT32 u4VRegion);
#endif

EXTERN UINT32 VDP_SetTunnelMode(UINT8 ucVdpId, BOOL fgTunnel);

EXTERN BOOL VDP_IsHDR10Plus(UCHAR ucVdpId);

EXTERN BOOL VDP_B2R_SetHdrInfo(UCHAR ucVdpId,UINT32 u4SEIHDRContent,UINT32 u4VUIHDRContent);
#endif    // B2R_IF_H
