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

📄 fw_video_render.cpp

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 CPP
字号:
/*////                  INTEL CORPORATION PROPRIETARY INFORMATION//     This software is supplied under the terms of a license agreement or//     nondisclosure agreement with Intel Corporation and may not be copied//     or disclosed except in accordance with the terms of that agreement.//       Copyright(c) 2003-2005 Intel Corporation. All Rights Reserved.//*/#include "vm_debug.h"#include "fw_video_render.h"#if defined (UMC_ENABLE_FILE_WRITER)namespace UMC{FWVideoRender::FWVideoRender(void){    m_pFileWriter = NULL;} // FWVideoRender::FWVideoRender(void)FWVideoRender::~FWVideoRender(void){    Close();} // FWVideoRender::~FWVideoRender(void)Status FWVideoRender::Init(MediaReceiverParams* pInit){    UMC::FileWriterParams InitParams;    VideoRenderParams* pParams = DynamicCast<VideoRenderParams>(pInit);    if (pParams->color_format != UMC::YV12)        return UMC_FAILED_TO_INITIALIZE;    vm_string_strcpy(InitParams.m_file_name, __VM_STRING("output.yuv"));    InitParams.m_portion_size = 0;    Status ret = NULLVideoRender::Init(pInit);    m_pFileWriter = new FileWriter();    if (!m_pFileWriter)        return UMC_ALLOC;    if (UMC_OK != m_pFileWriter->Init(&InitParams))        return UMC_FAILED_TO_INITIALIZE;    return ret;} // Status FWVideoRender::Init(MediaReceiverParams* pInit)Status FWVideoRender::Close(){    if (m_pFileWriter)    {        m_pFileWriter->Close();        delete m_pFileWriter;        m_pFileWriter = NULL;    }    return NULLVideoRender::Close();} // Status FWVideoRender::Close()Status FWVideoRender::RenderFrame(void){    size_t size_y = m_nPitch * m_SrcInfo.height;    size_t size_u = m_nPitch * m_SrcInfo.height / 4;    Status umcRes = UMC::UMC_OK;    int nbytes = m_SrcInfo.width;    for (int i = 0; i < m_SrcInfo.height; i++)    {        umcRes = m_pFileWriter->PutData((unsigned char *)m_Buffers[m_iReadIndex].surface + i * m_nPitch, nbytes);        if (UMC_OK != umcRes)            break;    }    if (UMC_OK == umcRes)    {        nbytes = m_SrcInfo.width/2;        for (int i = 0; i < m_SrcInfo.height / 2; i++)        {            umcRes = m_pFileWriter->PutData((unsigned char *)m_Buffers[m_iReadIndex].surface +                                            size_u +                                            size_y +                                            i * m_nPitch / 2,                                            nbytes);            if (UMC_OK != umcRes)                break;        }    }    if (UMC_OK == umcRes)    {        nbytes = m_SrcInfo.width / 2;        for (int i = 0; i < m_SrcInfo.height / 2; i++)        {            umcRes = m_pFileWriter->PutData((unsigned char *) m_Buffers[m_iReadIndex].surface +                                            size_y +                                            i * m_nPitch / 2,                                            nbytes);            if (UMC_OK != umcRes)                break;        }    }    if (UMC_OK == umcRes)        umcRes = NULLVideoRender::RenderFrame();    return umcRes;} // Status FWVideoRender::RenderFrame(void)} // namespace UMC#endif //UMC_ENABLE_FILE_WRITER

⌨️ 快捷键说明

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