예제 #1
0
void FtInitMemoryPool(void)
{
    ft_ext_mem_pool_id = kal_adm_create(
        Custom_META_GetCustomMemoryPool(),
        Custom_META_GetCustomMemoryPoolSize(),
        (kal_uint32*)Custom_META_GetCustomMemoryPoolArrangement(),
        KAL_FALSE
        );
}
예제 #2
0
/* initilaize reorder buffer */
void video_rtp_reorder_init_buffer(void)
{
    g_video_rtp_reorder_buff_info.total_pkt = 0;
    g_video_rtp_reorder_buff_info.p_free_addr = NULL;
    g_video_rtp_reorder_buff_info.p_buffer = (kal_uint8*)extmem_get_buffer(VIDEO_RTP_REORDER_BUFFER_SIZE);
    /* init adm buffer */
    if(g_video_rtp_reorder_buff_info.b_init_adm==KAL_FALSE)
    {
        g_video_rtp_reorder_buff_info.adm_id = kal_adm_create(g_video_rtp_reorder_buff_info.p_buffer, VIDEO_RTP_REORDER_BUFFER_SIZE, NULL,KAL_FALSE);
    }
    g_video_rtp_reorder_buff_info.b_buffer_full = KAL_FALSE;
    g_video_rtp_reorder_buff_info.b_init_done= KAL_FALSE;
}
/*****************************************************************************
 * FUNCTION
 *  med_set_aud_memory_pool
 * DESCRIPTION
 *  
 * PARAMETERS
 *  memory      [IN]        
 *  size        [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void med_set_aud_memory_pool(address_t memory, size_type size)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_med_ext_mem_cntx.aud_mem_pool_id = kal_adm_create(
                                            memory,
                                            size,
                                            NULL,
                                    #if defined(__MED_MEM_DEBUG_ON__)
                                            KAL_TRUE
                                    #else                                            
                                            KAL_FALSE
                                    #endif
                                            );
    g_med_ext_mem_cntx.aud_mem_alloc_count = 0;
    g_med_ext_mem_cntx.aud_mem_left_size = size;
}
MEDIA_STATUS_CODE VideoH264DecOpen(void *param)
{
    H264SwDecCapability rDecCap;
    H264SwDecRet rCodecRet;
    H264SwDecMemManageFunc rFunc;
    H264_DEC_INIT_PARAM_TYPE_T *pInitParam = (H264_DEC_INIT_PARAM_TYPE_T*)param;
    kal_uint32 u4IntMemAddr = 0, u4IntMemSize = 0, u4NoReordering = 0;
#if defined(__MTK_TARGET__)
#if defined(MT6236) || defined(MT6236B)
    kal_uint32* pu4TCMBuff_S = NULL;
    kal_uint32 u4ValidTCMSize_S = 0;

    DCM_Load(DYNAMIC_CODE_264DEC_S, &pu4TCMBuff_S, &u4ValidTCMSize_S);
#endif
#endif
    drv_trace0(TRACE_GROUP_8, H264DEC_OPEN);
    drv_trace4(TRACE_GROUP_10, OPEN_API_ENTERVIDEOH264DECOPEN ,pInitParam->ext_mem_addr.p_addr,
        pInitParam->ext_mem_size,pInitParam->int_mem_addr.p_addr,pInitParam->int_mem_size);
    if (pInitParam == NULL)
    {
        drv_trace1(TRACE_GROUP_8, H264DEC_ARGUMENT_ERROR, __LINE__);
        ASSERT(0);
        return VIDEO_ERROR;
    }
    rH264SwCtrl.pAdmId = kal_adm_create((void*)pInitParam->ext_mem_addr.p_addr,
                                                                        pInitParam->ext_mem_size, NULL, KAL_FALSE);
    if (rH264SwCtrl.pAdmId == NULL)
    {
        ASSERT(0);
    }

    if (H264SWDEC_OK != H264SwDecQueryCapability(&rDecCap, H264SW_QVGA))
    {
        ASSERT(0);
    }
    else
    {
        rH264SwCtrl.fgBsBufferCacheable = (rDecCap.isBsCacheable == 1) ? KAL_TRUE : KAL_FALSE;
        rH264SwCtrl.fgFrmBufferCacheable = (rDecCap.isFrameCacheable == 1) ? KAL_TRUE : KAL_FALSE;
#if defined(DRV_FEATURE__MM_INTMEM_IF)         
        u4IntMemAddr = OpenAPIGetIntBuffer(rDecCap.intMemSize);  
        u4IntMemSize = rDecCap.intMemSize;
#else
        u4IntMemAddr = pInitParam->int_mem_addr;
        u4IntMemSize = pInitParam->int_mem_size;
#endif
        
    }

    u4NoReordering = (pInitParam->fgDisplayOrderMode) ? 0 : 1;
    
    drv_trace0(TRACE_GROUP_8, H264DEC_INIT);
    rFunc.Malloc = VideoH264DecMalloc;
    rFunc.Free = VideoH264DecFree;
    rFunc.Memcpy = VideoH264DecMemcpy;
    rFunc.Memset = VideoH264DecMemset;
    rFunc.MallocDPB = VideoH264DecMallocDPB;
    rFunc.FreeDPB = VideoH264DecFreeDPB;
    rFunc.ReturnBitstream = VideoH264DecReturnBitstream;
    rCodecRet = H264SwDecInit(&rH264SwCtrl.prH264DecInst, u4NoReordering, (u8*)u4IntMemAddr, 
                                                u4IntMemSize, (u32)H264SW_DEC_DPB_SIZE, (u32)0, &rFunc);

    if (rCodecRet != H264SWDEC_OK)
    {
        drv_trace1(TRACE_GROUP_8, H264DEC_INIT_ERROR, rCodecRet);
        ASSERT(0);
        return VIDEO_ERROR;
    }

    rH264SwCtrl.fgFrmBufferSwitch = KAL_FALSE;
    rH264SwCtrl.fgIsCodecInit = KAL_TRUE;
    rH264SwCtrl.u2FrameHeight = 0;
    rH264SwCtrl.u2FrameWidth = 0;
    rH264SwCtrl.u2RealHeight = 0;
    rH264SwCtrl.u2RealWidth = 0;
    rH264SwCtrl.u4BufferSize = 0;
    rH264SwCtrl.pfnSetFrameUnReference = pInitParam->pfnSetFrameUnReferenceCallback;
    rH264SwCtrl.pfnOutputOneFrame = pInitParam->pfnOutputOneFrameCallback;
    rH264SwCtrl.pfnGetYUVBuffer = pInitParam->pfnGetYUVBufferCallback;
    rH264SwCtrl.pfnReturnBitstream = pInitParam->pfnReturnBsBufferCallback;

    if ((rH264SwCtrl.pfnSetFrameUnReference == NULL) || (rH264SwCtrl.pfnOutputOneFrame == NULL) ||
        (rH264SwCtrl.pfnGetYUVBuffer == NULL))
    {
        ASSERT(0);
    }

    return MEDIA_STATUS_OK;
}