1 #ifndef PIXEL_FORMAT_F32_RSH 2 #define PIXEL_FORMAT_F32_RSH 3 4 // FocusPixel is the pixel format in the input image, which serves the 5 // following purposes in the refocus filter pipeline. 6 // 7 // 1. Initially, it stores the input color (red, green, blue) and the depth 8 // value (actual_depth). The actual_depth field is never changed once set. 9 // 10 // 2. When processing each layer, we use its field (active) to mark 11 // whether or not a pixel is on the current target layer. For pixels that are 12 // active or not active but "close enough" to an active pixel, a matte value is 13 // computed for blending color between layers. "Close enough" means L1 distance 14 // is no larger than dilation_radius defined in LayerInfo_t in "layer_info.rsh". 15 // 16 // 3. After each layer is processed from back-most layer to focal depth layer, 17 // the color (red, green, blue) of FocusPixel is updated and ready to be used in 18 // layer processing for the next iteration. 19 // 20 // 4. After each layer is processed from front-most layer to focal depth layer, 21 // the color (red, green, blue) of FocusPixel is *not* changed. 22 // 23 // 5. After each layer is processed in either of the two passes, the fields 24 // active, matte, and dilated_depth are reset. However, the field actual_depth 25 // field remains untouched once set initially. 26 typedef struct SharpPixelF32 { 27 float red; 28 float green; 29 float blue; 30 31 uchar actual_depth; 32 33 // active = 1: the pixel is on the target layer; 34 // active = 0: otherwise. 35 uchar active; 36 37 // matte is between 0 and dilation_radius+1, where dilation_radius is defined 38 // in LayerInfo below. 39 // matte/(dilation_radius+1) is the actual value used in layer blending. 40 uchar matte; 41 42 // For active pixels, dilated_depth is the same as actual depth; 43 // For inactive pixels with non-zero matte, dilated_depth is the depth of the 44 // closest active pixels; 45 // For other pixels, 0 (invalid depth). 46 uchar dilated_depth; 47 48 } SharpPixelF32_t; 49 50 typedef struct FuzzyPixelF32 { 51 float red; 52 float green; 53 float blue; 54 float alpha; 55 } FuzzyPixelF32_t; 56 57 #endif 58