首页 > 代码库 > DM8168 OSD Algorithm (DSP side)

DM8168 OSD Algorithm (DSP side)

osdLink_alg.c:

/*******************************************************************************
 *                                                                             *
 * Copyright (c) 2009 Texas Instruments Incorporated - http://www.ti.com/      *
 *                        ALL RIGHTS RESERVED                                  *
 *                                                                             *
 ******************************************************************************/

#include "osdLink_priv.h"


Int32 AlgLink_OsdalgCreate(AlgLink_OsdObj * pObj)
{
    Int32 status, chId;
    SWOSD_OpenPrm algCreatePrm;
    AlgLink_OsdChObj *pChObj;
    SWOSD_Obj *pSwOsdObj;
    AlgLink_OsdChWinParams *pChWinPrm;


    algCreatePrm.maxWidth =
        pObj->osdChCreateParams[0].maxWidth;
    algCreatePrm.maxHeight =
        pObj->osdChCreateParams[0].maxHeight;
    algCreatePrm.osdFormat    =
        pObj->osdChCreateParams[0].osdFormat; 
    /* Create algorithm instance and get algo handle  */
    status = SWOSD_open(&pObj->osdObj, &algCreatePrm);

    UTILS_assert(status == 0);

    for(chId=0; chId<pObj->inQueInfo->numCh; chId++)
    {
        pChObj = &pObj->chObj[chId];

        pChWinPrm = &pObj->osdChCreateParams[chId].chDefaultParams;

        pSwOsdObj = &pChObj->osdObj;


        pChWinPrm->chId = chId;

        status = AlgLink_OsdalgSetChOsdWinPrm(pObj, pChWinPrm);

        UTILS_assert(status==0);

        pSwOsdObj->algHndl = pObj->osdObj.algHndl;

        pSwOsdObj->openPrm = pObj->osdObj.openPrm;

        if(pObj->inQueInfo->chInfo[chId].dataFormat == SYSTEM_DF_YUV422I_YUYV)
        {
            pSwOsdObj->videoWindowPrm.format = SWOSD_FORMAT_YUV422i;
        }
        else if(pObj->inQueInfo->chInfo[chId].dataFormat == SYSTEM_DF_YUV420SP_UV)
        {
            pSwOsdObj->videoWindowPrm.format = SWOSD_FORMAT_YUV420sp;
        }
        else if(pObj->inQueInfo->chInfo[chId].dataFormat == SYSTEM_DF_RGB24_888)
        {
            pSwOsdObj->videoWindowPrm.format = SWOSD_FORMAT_RGB888;
        }
        else
        {
            pSwOsdObj->videoWindowPrm.format = -1;
        }

        pSwOsdObj->videoWindowPrm.startX = pObj->inQueInfo->chInfo[chId].startX;
        pSwOsdObj->videoWindowPrm.startY = pObj->inQueInfo->chInfo[chId].startY;
        pSwOsdObj->videoWindowPrm.width  = pObj->inQueInfo->chInfo[chId].width;
        pSwOsdObj->videoWindowPrm.height = pObj->inQueInfo->chInfo[chId].height;
        pSwOsdObj->videoWindowPrm.lineOffset = pObj->inQueInfo->chInfo[chId].pitch[0];
        pSwOsdObj->graphicsWindowPrm.format = -1;
        pChObj->colorKey[0] = 0xFF; /* Y */
        pChObj->colorKey[1] = 0xFF; /* U */
        pChObj->colorKey[2] = 0xFF; /* V */
    }

	return FVID2_SOK;
}

Int32 AlgLink_OsdalgDelete(AlgLink_OsdObj * pObj)
{
    SWOSD_close(&pObj->osdObj);

	return FVID2_SOK;
}

/*
    Returns 32-bit color key thats needs to be programmed to the SW OSD algorithm

    colorKey[0] = Y color Key
    colorKey[1] = U color Key
    colorKey[2] = V color Key

    dataFormat - SWOSD_FORMAT_YUV422i or SWOSD_FORMAT_YUV420sp

    place: 0 - Y plane, 1: C plane
*/
Int32 AlgLink_OsdalgGetColorKey(UInt32 *colorKey, UInt32 dataFormat, UInt32 plane)
{
    UInt32 colorKeyY;
    UInt32 colorKeyU;
    UInt32 colorKeyV;
    UInt32 value;

    colorKeyY = (UInt8)colorKey[0];
    colorKeyU = (UInt8)colorKey[1];
    colorKeyV = (UInt8)colorKey[2];

    if(dataFormat == SWOSD_FORMAT_YUV422i)
    {
        value =
             http://www.mamicode.com/(colorKeyY <<0)>

DM8168 OSD Algorithm (DSP side)