00001 #ifndef Impala_Core_Array_Trait_M9N4poFO_h
00002 #define Impala_Core_Array_Trait_M9N4poFO_h
00003
00004 #include "Core/Array/Pattern/Categories.h"
00005 #include "Core/Array/Element/E1Sqrt.h"
00006
00007 namespace Impala
00008 {
00009 namespace Core
00010 {
00011 namespace Array
00012 {
00013 namespace Trait
00014 {
00015
00016
00019 template<class DstArrayT, class SrcArrayT>
00020 class M9N4poFO
00021 {
00022 public:
00024 typedef Pattern::TagTransInVar TransVarianceCategory;
00025
00027 typedef Pattern::TagCallValue CallCategory;
00028
00029 typedef typename DstArrayT::StorType DstStorT;
00030 typedef typename DstArrayT::ArithType DstArithT;
00031 typedef typename SrcArrayT::ArithType SrcArithT;
00032
00034 M9N4poFO()
00035 {
00036 mC2 = 1 / ::sqrt(2.0);
00037 mC6 = 1 / ::sqrt(6.0);
00038 }
00039
00041 void
00042 DoIt(DstStorT* FO1x, DstStorT* FO1y, DstStorT* FO2x, DstStorT* FO2y,
00043 const SrcArithT& R, const SrcArithT& G, const SrcArithT& B,
00044 const SrcArithT& Rx, const SrcArithT& Gx, const SrcArithT& Bx,
00045 const SrcArithT& Ry, const SrcArithT& Gy, const SrcArithT& By)
00046 {
00047 *FO1x = mC2*(Rx-Gx);
00048 *FO1y = mC2*(Ry-Gy);
00049 *FO2x = mC6*(Rx+Gx-2*Bx);
00050 *FO2y = mC6*(Ry+Gy-2*By);
00051 }
00052
00053 SrcArithT mC2;
00054 SrcArithT mC6;
00055 };
00056
00057 }
00058 }
00059 }
00060 }
00061
00062 #endif