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

📄 msapi_rld.c

📁 mstar 776 开发的车载dvd
💻 C
字号:
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2006-2007 MStar Semiconductor, Inc.
// All rights reserved.
//
// Unless otherwise stipulated in writing, any and all information contained
// herein regardless in any format shall remain the sole proprietary of
// MStar Semiconductor Inc. and be kept in strict confidence
// (¨MStar Confidential Information〃) by the recipient.
// Any unauthorized act including without limitation unauthorized disclosure,
// copying, use, reproduction, sale, distribution, modification, disassembling,
// reverse engineering and compiling of the contents of MStar Confidential
// Information is unlawful and strictly prohibited. MStar hereby reserves the
// rights to any and all damages, losses, costs and expenses resulting therefrom.
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
//
/// @file msAPI_RLD.h
/// @brief API for run-length decoder
/// @author MStar Semiconductor, Inc.
//
////////////////////////////////////////////////////////////////////////////////

#define MSAPI_RLD_C
#define RLD(x)   //x
#define RLD_RUN_TIME    500   /* ms */    // ETR 211, Every 0.5 sec

//*****************************************************************************
// 		Header Files
//*****************************************************************************
#include "drvRLD.h"
#include "msAPI_miu.h"
#include "msAPI_RLD.h"
#include "msAPI_Timer.h"

//*****************************************************************************
//      Functions
//*****************************************************************************
U8 msAPI_STRLD_Run(PstRLDParameters pRLD)
{
    U8 u8Ret;
    U32 u32RLDStartTimer;

    RLD (
        U8 _720[32];
        U16 i;

        printf("\r\n================ RLD Debug message ================");
        printf("\nTransparent Key     : %bx", pRLD->u8TransparentKey);
        printf("\noutput format       : %bx", pRLD->u8OutputFormat);
        printf("\nenlargement         : %bx", pRLD->u8EnlargeRaio);

        printf("\r\n");
        printf("\nTop field length    : %x" , pRLD->u16TopFieldLength);
        printf("\nBottom field length : %x" , pRLD->u16BottomFieldLength);


        printf("\r\n");
        printf("\nTop field address   : %lx", pRLD->u32TopFieldAddress);
        printf("\nBottom field address: %lx", pRLD->u32BottomFieldAddress);

        printf("\nOutput address      : %lx", pRLD->u32OutputAddress);
        printf("\r\n");


        printf("\nRegion width        : %x",  pRLD->u16RegionWidth);
        printf("\nRegion height       : %x",  pRLD->u16RegionHeight);

        printf("\r\n");
        printf("\nRegion pitch        : %x",  pRLD->u16RegionPitch);

        printf("\r\n");
        printf("\nRegion x offset     : %x", pRLD->u16ObjectXOffset);
        printf("\nRegion y offset     : %x", pRLD->u16ObjectYOffset);

        printf("\r\n");
        printf("\nRegion depth        : %bx", pRLD->u8RegionDepth);

        printf("\r\n");
        printf("\nRegion offset       : %bx", pRLD->u8RegionOffset);
    );

    if ((pRLD->u8OutputFormat != 0x02) && (pRLD->u8OutputFormat != 0x04) && (pRLD->u8OutputFormat != 0x08))
        return 0x2; // the 1st bit is not used by RLD, let's use it here as an error code

    if ((pRLD->u8EnlargeRaio < 1) && (pRLD->u8EnlargeRaio > 7))
        return 0x2; // the 1st bit is not used by RLD, let's use it here as an error code

    MDrv_STRLD_Reset();

    // set enlargement ration
    MDrv_STRLD_SetEnlargeRate(pRLD->u8EnlargeRaio);

    //Set backgound color
    MDrv_STRLD_SetTransparentKey(0xff);
    MDrv_STRLD_SetRegionColorKeyBG(0xff);

    //Set output format
    MDrv_STRLD_SetOutputFormat(pRLD->u8OutputFormat);

    //Set top field length
    MDrv_STRLD_SetTopFieldLength(pRLD->u16TopFieldLength);

    //Set bottom field length
    MDrv_STRLD_SetBottomFieldLength(pRLD->u16BottomFieldLength);

    //Set top field address
    MDrv_STRLD_SetTopFieldAddress(pRLD->u32TopFieldAddress);

    //Set bottom field address
    MDrv_STRLD_SetBottomFieldAddress(pRLD->u32BottomFieldAddress);

    //Set outptu address
    MDrv_STRLD_SetOutputAddress(pRLD->u32OutputAddress);

    //Set region width
    MDrv_STRLD_SetRegionWdith(pRLD->u16RegionWidth);

    //Set region height
    MDrv_STRLD_SetRegionHeight(pRLD->u16RegionHeight);

    //Set region pitch
    MDrv_STRLD_SetRegionPitch(pRLD->u16RegionPitch);

    //Set Object x offset
    MDrv_STRLD_SetObjXOffset(pRLD->u16ObjectXOffset);

    //Set Object y offset
    MDrv_STRL_SetObjYOffset(pRLD->u16ObjectYOffset);

    // patch
    MDrv_STRLD_SetPatch();

    //Set bitstream depth
    MDrv_STRLD_SetRegionDepth(pRLD->u8RegionDepth);

    // Set region offset
    MDrv_STRLD_SetRegionOffset(pRLD->u8RegionOffset);

    // Set patch mode

    MDrv_STRLD_SetMappingTable2to4(0x0007080f);
    MDrv_STRLD_SetMappingTable2to8(0x007788ff);
    MDrv_STRLD_SetMappingTable4to8(0x00112233, 0x44556677,0x8899aabb, 0xccddeeff);

    MDrv_STRLD_Start();

    RLD (
        for (i = 0; i < sizeof(_720); i++)
            _720[i] = 0;

        msAPI_MIU_Copy((U32)pRLD->u32TopFieldAddress, (U16)_720 - XDATASDRAM_START_ADDR  , (U16)sizeof(_720), MIU_SDRAM2SDRAM );

        printf("\r\n");
        printf("\nTop Field address : %lx", pRLD->u32TopFieldAddress);
        for (i = 0; i < sizeof(_720); i++)
        {
            if ((i != 0) && (i % 16 == 0))
                printf("\r\n");
            printf("%02bx ", _720[i]);
        }

        printf("\r\n\n");

        msAPI_MIU_Copy((U32)pRLD->u32BottomFieldAddress, (U16)_720 - XDATASDRAM_START_ADDR  , (U16)sizeof(_720), MIU_SDRAM2SDRAM );

        printf("\nTop Field address : %lx", pRLD->u32BottomFieldAddress);
        for (i = 0; i < sizeof(_720); i++)
        {
            if ((i != 0) && (i % 16 == 0))
                printf("\r\n");
            printf("%02bx ", _720[i]);
        }

        printf("\r\n\n");

        msAPI_MIU_Copy((U32)pRLD->u32OutputAddress, (U16)_720 - XDATASDRAM_START_ADDR  , (U16)sizeof(_720), MIU_SDRAM2SDRAM );

        printf("\r\n");
        for (i = 0; i < sizeof(_720); i++)
        {
            if ((i != 0) && (i % 16 == 0))
                printf("\r\n");
            printf("%02bx ", _720[i]);
        }
    );//RLD

    u32RLDStartTimer = msAPI_Timer_GetTime0();

    u8Ret = MDrv_STRLD_GetReturn();

    while((u8Ret == 0x0) && ((msAPI_Timer_TimeDifferenceFromCurrent(u32RLDStartTimer)) < RLD_RUN_TIME))
    {
        u8Ret =  MDrv_STRLD_GetReturn();
    }

    return MDrv_STRLD_GetReturn();
}

#undef MSAPI_RLD_C

⌨️ 快捷键说明

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