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

📄 ippsaddc.cpp

📁 Intel开发的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) 2000-2005 Intel Corporation. All Rights Reserved.
//
*/

// ippsAddC.cpp: implementation of the CIppsAddC class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "ippsSample.h"
#include "SampleDoc.h"
#include "ippsAddCDlg.h"
#include "ippsAddC.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

// Static parameters for ippsAddC_16s_Sfs
Ipp16s CIppsAddC::m_value = 1000;
int   CIppsAddC::m_scaleFactor = 0;

CIppsAddC::CIppsAddC()
{

}

CIppsAddC::~CIppsAddC()
{

}

////////////////////////////////////////////////////////////////////
// Determinate if function ippsAddC_16s_Sfs can process the image

BOOL CIppsAddC::FitSignal(CIppsSignal* pSignal) const
{
   if (pSignal->Type() != pp16s) return FALSE;
   return TRUE;
}

////////////////////////////////////////////////////////////////////
// Process document pSrc by ippsAddC_16s_Sfs

void CIppsAddC::ProcessSignal(CSampleDoc *pSrc)
{
   // if function doesn't fit the src image then return
   if (!FitSignal(pSrc)) return;
   // Run dialog to get function parameters
   if (!GetParameters()) return;
   // create new invisible document for dst image
   CSampleDoc* pDst = CSampleDoc::CreateNewDoc(pSrc, FALSE);
   if (!pDst) return;
   // Run ippsAddC_16s_Sfs
   IppStatus status = ippsAddC_16s_Sfs(
      (Ipp16s*)pSrc->DataPtr(), m_value,
      (Ipp16s*)pDst->DataPtr(), pSrc->Length(),
      m_scaleFactor);
   // Show message box if status is wrong
   IppErrorMessage("ippsAddC_16s_Sfs", status);
   if (status < 0)
      // delete document in the case of error status
      pDst->OnCloseDocument();
   else
      // make document visible in the opposite case
      pDst->MakeVisible();
}

////////////////////////////////////////////////////////////////////
// Run dialog to get ippsAddC_16s_Sfs parameters

BOOL CIppsAddC::GetParameters()
{
   // Dialog to get function parameters
   CIppsAddCDlg dlg;

   // Set parameters to dialog
   dlg.m_value = m_value;
   dlg.m_scaleFactor = m_scaleFactor;

   // Run dialog
   if (dlg.DoModal() != IDOK) return FALSE;

   // Get parameters from dialog
   m_value = dlg.m_value;
   m_scaleFactor = dlg.m_scaleFactor;

   return TRUE;
}

⌨️ 快捷键说明

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