?? func.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) 1999-2006 Intel Corporation. All Rights Reserved.
//
*/
// Func.cpp: implementation of the CFunc, CFuncList, CRecentFuncList
// classes.
//
// class CFunc helps to extract maximum information about IPP function
//
// class CFuncList is the IPP functions list that can be created
// using IPP library header
//
// class CRecentFuncList supports MRU recent function list
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "demo.h"
#include "Func.h"
#include "Vector.h"
#include "Process.h"
#include "Director.h"
#include "MruMenu.h"
#include "ipp_List.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CFunc::CFunc()
{
}
CFunc::~CFunc()
{
}
CString CFunc::TypeToString(ppType type)
{
switch (type) {
case pp8u : return _T("8u");
case pp8s : return _T("8s");
case pp8sc : return _T("8sc");
case pp16u : return _T("16u");
case pp16s : return _T("16s");
case pp16sc: return _T("16sc");
case pp16f : return _T("16f");
case pp24u : return _T("24u");
case pp24s : return _T("24s");
case pp32u : return _T("32u");
case pp32s : return _T("32s");
case pp32sc: return _T("32sc");
case pp32f : return _T("32f");
case pp32fc: return _T("32fc");
case pp64s : return _T("64s");
case pp64sc: return _T("64sc");
case pp64f : return _T("64f");
case pp64fc: return _T("64fc");
default: return _T("");
}
}
ppType CFunc::StringToType(CString type)
{
if (type == _T("8u") ) return pp8u ;
if (type == _T("8s") ) return pp8s ;
if (type == _T("8sc") ) return pp8sc ;
if (type == _T("16u") ) return pp16u ;
if (type == _T("16s") ) return pp16s ;
if (type == _T("16sc")) return pp16sc;
if (type == _T("16f") ) return pp16f ;
if (type == _T("24u") ) return pp24u ;
if (type == _T("24s") ) return pp24s ;
if (type == _T("32u") ) return pp32u ;
if (type == _T("32s") ) return pp32s ;
if (type == _T("32sc")) return pp32sc;
if (type == _T("32f") ) return pp32f ;
if (type == _T("32fc")) return pp32fc;
if (type == _T("64s") ) return pp64s ;
if (type == _T("64sc")) return pp64sc;
if (type == _T("64f") ) return pp64f ;
if (type == _T("64fc")) return pp64fc;
return ppNONE;
}
IppDataType CFunc::TypeToIpp(ppType type)
{
switch (type) {
case pp8u : return ipp8u ;
case pp8s : return ipp8s ;
// case pp8sc : return ipp8sc ;
case pp16u : return ipp16u ;
case pp16s : return ipp16s ;
case pp16sc: return ipp16sc;
case pp32u : return ipp32u ;
case pp32s : return ipp32s ;
case pp32sc: return ipp32sc;
case pp32f : return ipp32f ;
case pp32fc: return ipp32fc;
case pp64s : return ipp64s ;
case pp64sc: return ipp64sc;
case pp64f : return ipp64f ;
case pp64fc: return ipp64fc;
default: return (IppDataType)-1;
}
}
static CMyString firstType(CMyString type)
{
if (type.Find(_T("64fc")) == 0) return _T("64fc");
if (type.Find(_T("64sc")) == 0) return _T("64sc");
if (type.Find(_T("64s" )) == 0) return _T("64s") ;
if (type.Find(_T("64f" )) == 0) return _T("64f") ;
if (type.Find(_T("32fc")) == 0) return _T("32fc");
if (type.Find(_T("32sc")) == 0) return _T("32sc");
if (type.Find(_T("32u" )) == 0) return _T("32u") ;
if (type.Find(_T("32s" )) == 0) return _T("32s") ;
if (type.Find(_T("32f" )) == 0) return _T("32f") ;
if (type.Find(_T("24u" )) == 0) return _T("24u") ;
if (type.Find(_T("24s" )) == 0) return _T("24s") ;
if (type.Find(_T("16sc")) == 0) return _T("16sc");
if (type.Find(_T("16u" )) == 0) return _T("16u") ;
if (type.Find(_T("16s" )) == 0) return _T("16s") ;
if (type.Find(_T("16f" )) == 0) return _T("16f") ;
if (type.Find(_T("8sc" )) == 0) return _T("8sc") ;
if (type.Find(_T("8u" )) == 0) return _T("8u") ;
if (type.Find(_T("8s" )) == 0) return _T("8s") ;
if (type.Find(_T("1u" )) == 0) return _T("8u") ;
return _T("");
}
ppType CFunc::BaseType() const
{
CMyString base = BaseName();
if (base.Found(_T("64fc"))) return pp64fc;
if (base.Found(_T("64sc"))) return pp64sc;
if (base.Found(_T("64s" ))) return pp64s;
if (base.Found(_T("64f" ))) return pp64f;
if (base.Found(_T("32fc"))) return pp32fc;
if (base.Found(_T("32sc"))) return pp32sc;
if (base.Found(_T("32u" ))) return pp32u;
if (base.Found(_T("32s" ))) return pp32s;
if (base.Found(_T("32f" ))) return pp32f;
if (base.Found(_T("24u" ))) return pp24u;
if (base.Found(_T("24s" ))) return pp24s;
if (base.Found(_T("16sc"))) return pp16sc;
if (base.Found(_T("16f" ))) return pp16f;
if (base.Found(_T("16u" ))) return pp16u;
if (base.Found(_T("16s" ))) return pp16s;
if (base.Found(_T("8sc" ))) return pp8sc;
if (base.Found(_T("8u" ))) return pp8u;
if (base.Found(_T("8s" ))) return pp8s;
if (base.Found(_T("1u" ))) return pp8u;
return ppNONE;
}
static BOOL isType(CMyString typeStr)
{
CMyString firstStr = firstType(typeStr);
return !firstStr.IsEmpty();
}
void CFunc::ParseFunction(CMyString& base, CMyString& type, CMyString& descr) const
{
base = type = descr = _T("");
int i0 = Find(_T("ipps")) == 0 ? 4 :
Find(_T("ippi")) == 0 ? 4 :
0;
int i1 = Find('_');
if (!isType(Mid(i1+1)))
i1 = Find('_', i1 + 1);
int i2 = Find('_', i1 + 1);
if (i1 < 0) {
base = Mid(i0);
return;
}
base = Mid(i0,i1 - i0);
if (i2 < 0) {
type = Mid(i1 + 1);
return;
}
type = Mid(i1 + 1, i2 - (i1 + 1));
descr = Mid(i2 + 1);
}
void CFunc::ParseFunction(CMyString& base, CMyString& type1, CMyString& type2,
CMyString& type3, CMyString& descr) const
{
CMyString type;
ParseFunction(base,type,descr);
int len = type.GetLength();
type1 = firstType(type);
int len1 = type1.GetLength();
if (len1 == len) {
type2 = type3 = type1;
} else {
type2 = firstType(type.Mid(len1));
int len2 = type2.GetLength();
if (len1 + len2 == len) {
type3 = type2;
if (!descr.Found(_T("I")))
type2 = type1;
} else {
type3 = firstType(type.Mid(len1+len2));
}
}
}
CMyString CFunc::Prefix() const
{
if (GetLength() < 4) return _T("");
if (GetAt(3) == 'i' || GetAt(3) == 's') return Left(4);
return Left(3);
}
CMyString CFunc::BaseName() const
{
CMyString base, type, descr;
ParseFunction(base,type,descr);
return base;
}
CMyString CFunc::TypeName() const
{
CMyString base, type, descr;
ParseFunction(base,type,descr);
return type;
}
CMyString CFunc::DescrName() const
{
CMyString base, type, descr;
ParseFunction(base,type,descr);
return descr;
}
ppType CFunc::SrcType() const
{
ppType ts1, ts2, td1, td2;
GetTypes(ts1, ts2, td1, td2);
return ts1;
}
ppType CFunc::DstType() const
{
ppType ts1, ts2, td1, td2;
GetTypes(ts1, ts2, td1, td2);
return td1;
}
ppType CFunc::Src2Type() const
{
ppType ts1, ts2, td1, td2;
GetTypes(ts1, ts2, td1, td2);
return ts2;
}
ppType CFunc::Dst2Type() const
{
ppType ts1, ts2, td1, td2;
GetTypes(ts1, ts2, td1, td2);
return td2;
}
int CFunc::SrcChannels() const
{
int src, dst;
GetChannels(src, dst);
return src;
}
int CFunc::DstChannels() const
{
int src, dst;
GetChannels(src, dst);
return dst;
}
BOOL CFunc::OnlyDst() const
{
if (BaseName() == _T("Set") || BaseName() == _T("Zero")) return TRUE;
if (BaseName().Found(_T("Draw"))) return TRUE;
if (BaseName().Found(_T("Image")) || BaseName().Found(_T("Vector"))) return TRUE;
if (BaseName().Found(_T("RandGauss")) || BaseName().Found(_T("RandUniform"))) return TRUE;
if (BaseName().Found(_T("Tone")) || BaseName().Found(_T("Triangle"))) return TRUE;
if (BaseName().Found(_T("FIRGen"))) return TRUE;
return FALSE;
}
BOOL CFunc::Inplace() const
{
if (OnlyDst()) return TRUE;
if (BaseName() == _T("Preemphasize")) return TRUE;
if (BaseName() == _T("AddProduct")) return TRUE;
if (BaseName() == _T("AddProductC")) return TRUE;
if (BaseName() == _T("Move")) return TRUE;
return DescrName().Found(_T("I"));
}
BOOL CFunc::Mask() const
{
return DescrName().Found(_T("M"));
}
BOOL CFunc::Scale() const
{
CMyString base, type, descr;
ParseFunction(base,type,descr);
return descr.Find(_T("Sfs")) != -1;
}
BOOL CFunc::Roi() const
{
CMyString base, type, descr;
ParseFunction(base,type,descr);
return descr.Find(_T("R")) != -1;
}
BOOL CFunc::SrcPlane() const
{
BOOL src, dst;
GetPlanes(src,dst);
return src;
}
BOOL CFunc::DstPlane() const
{
BOOL src, dst;
GetPlanes(src,dst);
return dst;
}
BOOL CFunc::SrcAlpha() const
{
BOOL src, dst;
GetAlpha(src,dst);
return src;
}
BOOL CFunc::DstAlpha() const
{
BOOL src, dst;
GetAlpha(src,dst);
return dst;
}
CString CFunc::SrcChannelsName() const
{
CMyString src, dst;
GetChannelsName(src,dst);
return src;
}
CString CFunc::DstChannelsName() const
{
CMyString src, dst;
GetChannelsName(src,dst);
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -