1#ifndef LAYER_INFO_RSH 2#define LAYER_INFO_RSH 3 4// An object that contains the front and back depths values of a layer 5typedef struct LayerInfo { 6 // Front and back depth values of this layer. 7 // front_depth >= back_depth. 8 int front_depth; 9 int back_depth; 10} LayerInfo_t; 11 12// An object that contains parameters used for computing matte for the current 13// layer. 14typedef struct BlendInfo { 15 // The max kernel radius of a layer. 16 int dilation_radius; 17 18 // A scale factor =1.0f/(1+dilation_radius), which is used to normalize a 19 // distance transform result to be a matte value within [0,1]. 20 // This data member is only used for PixelFormatF32. 21 float matte_normalizer; 22} BlendInfo_t; 23 24static inline int ValidDepth(int depth) { return (depth != 0); } 25 26static inline int NotInFrontOfTheLayer(int depth, 27 const int2 layer_info_f2) { 28 return (depth <= layer_info_f2.s0); 29} 30 31static inline int OnTheLayer(int depth, const int2 layer_info_i2) { 32 //return (layer_info->back_depth <= depth && depth <= layer_info->front_depth); 33 return (layer_info_i2.s1 <= depth && depth <= layer_info_i2.s0); 34} 35 36static inline int ValidDepthNotInFrontOfTheLayer( 37 int depth, const int2 layer_info_f2) { 38 //return (depth != 0) & (depth <= layer_info->front_depth); 39 return (depth != 0) & (depth <= layer_info_f2.s0); 40} 41 42static inline int ValidDepthNotOnTheLayer(int depth, 43 const int2 layer_info_f2) { 44 return (depth != 0) & 45 ((depth < layer_info_f2.s1) | (depth > layer_info_f2.s0)); 46} 47 48#endif 49