1 #ifndef color__internal_yuv_bound_scalar 2 #define color__internal_yuv_bound_scalar 3 4 // ::color::_internal::yuv::bound::scalar< index_type, scalar_name > 5 6 7 #include "../../../_internal/utility/type/traitc.hpp" 8 #include "../../../_internal/utility/type/index.hpp" 9 10 11 12 namespace color 13 { 14 namespace _internal 15 { 16 namespace yuv 17 { 18 namespace bound 19 { 20 21 template< typename index_name, typename scalar_name > 22 struct scalar 23 { 24 public: 25 typedef scalar_name scalar_type; 26 typedef index_name index_type; 27 28 typedef ::color::_internal::utility::type::traitC< scalar_type > trait_type; 29 typedef ::color::_internal::utility::type::index< index_type > index_trait_type; 30 31 typedef typename trait_type::instance_type instance_type; 32 typedef typename trait_type::return_image_type return_image_type; 33 34 typedef typename index_trait_type::instance_type index_instance_type; 35 typedef typename index_trait_type::model_type index_input_const_type; 36 37 template< index_instance_type index > maximumcolor::_internal::yuv::bound::scalar38 static /*constexpr*/ return_image_type maximum( ) 39 { 40 static instance_type max_list[] = { 1, scalar_type( 0.436 ), scalar_type( 0.615 ) }; 41 return max_list[index]; 42 } 43 maximumcolor::_internal::yuv::bound::scalar44 static /*constexpr*/ return_image_type maximum( index_input_const_type index ) 45 { 46 static instance_type max_list[] = { 1, scalar_type( 0.436 ), scalar_type( 0.615 ) }; 47 return max_list[index]; 48 } 49 50 template< index_instance_type index > minimumcolor::_internal::yuv::bound::scalar51 static /*constexpr*/ return_image_type minimum( ) 52 { 53 static instance_type min_list[] = { 0, scalar_type( -0.436 ), scalar_type( -0.615 ) }; 54 return min_list[index]; 55 } 56 minimumcolor::_internal::yuv::bound::scalar57 static /*constexpr*/ return_image_type minimum( index_input_const_type index ) 58 { 59 static instance_type min_list[] = { 0, scalar_type( -0.436 ), scalar_type( -0.615 ) }; 60 return min_list[index]; 61 } 62 63 template< index_instance_type index > rangecolor::_internal::yuv::bound::scalar64 static /*constexpr*/ return_image_type range() 65 { 66 static instance_type range_list[] = { 1, scalar_type( 2*0.436 ), scalar_type( 2 * 0.615 ) }; 67 return range_list[index]; 68 } 69 rangecolor::_internal::yuv::bound::scalar70 static /*constexpr*/ return_image_type range( index_input_const_type index ) 71 { 72 static instance_type range_list[] = { 1, scalar_type( 2*0.436 ), scalar_type( 2*0.615 ) }; 73 return range_list[index]; 74 } 75 }; 76 77 } 78 } 79 } 80 } 81 82 #endif