env_params.c
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef ENVISION_ENV_PARAMS_C_DEFINED
00039 #define ENVISION_ENV_PARAMS_C_DEFINED
00040
00041 #include "Envision/env_params.h"
00042
00043 #include "Envision/env_log.h"
00044
00045
00046 void env_params_set_defaults(struct env_params* envp)
00047 {
00048 envp->maxnorm_type = ENV_VCXNORM_MAXNORM;
00049 envp->range_thresh = 0;
00050 envp->scale_bits = 30;
00051 #ifdef ENV_WITH_DYNAMIC_CHANNELS
00052 envp->num_motion_directions = 4;
00053 envp->motion_thresh = 0;
00054 envp->flicker_thresh = 0;
00055 envp->multiscale_flicker = 0;
00056 #endif
00057 envp->num_orientations = 4;
00058 envp->cs_lev_min = 2;
00059 envp->cs_lev_max = 4;
00060 envp->cs_del_min = 3;
00061 envp->cs_del_max = 4;
00062 envp->output_map_level = 4;
00063 envp->chan_i_weight = 255;
00064 envp->chan_c_weight = 255;
00065 envp->chan_o_weight = 255;
00066 #ifdef ENV_WITH_DYNAMIC_CHANNELS
00067 envp->chan_f_weight = 255;
00068 envp->chan_m_weight = 255;
00069 #endif
00070
00071 #ifdef ENV_WITH_VISIT_CHANNEL
00072 envp->submapPreProc = 0;
00073 envp->submapPostNormProc = 0;
00074 envp->submapPostProc = 0;
00075 #endif
00076 }
00077
00078
00079 env_size_t env_max_cs_index(const struct env_params* envp)
00080 {
00081 return (envp->cs_del_max - envp->cs_del_min + 1)
00082 * (envp->cs_lev_max - envp->cs_lev_min + 1);
00083 }
00084
00085
00086 env_size_t env_max_pyr_depth(const struct env_params* envp)
00087 {
00088 return (envp->cs_lev_max + envp->cs_del_max + 1);
00089 }
00090
00091
00092 intg32 env_total_weight(const struct env_params* envp)
00093 {
00094 return
00095 ((intg32) envp->chan_c_weight)
00096 + ((intg32) envp->chan_i_weight)
00097 + ((intg32) envp->chan_o_weight)
00098 #ifdef ENV_WITH_DYNAMIC_CHANNELS
00099 + ((intg32) envp->chan_f_weight)
00100 + ((intg32) envp->chan_m_weight)
00101 #endif
00102 ;
00103 }
00104
00105
00106 void env_params_validate(const struct env_params* envp)
00107 {
00108 ENV_ASSERT(envp->maxnorm_type == ENV_VCXNORM_NONE ||
00109 envp->maxnorm_type == ENV_VCXNORM_MAXNORM);
00110 ENV_ASSERT((envp->scale_bits+1) < (8*sizeof(intg32)));
00111 #ifdef ENV_WITH_DYNAMIC_CHANNELS
00112 ENV_ASSERT(envp->num_motion_directions <= 99);
00113 #endif
00114 ENV_ASSERT(envp->num_orientations <= 99);
00115
00116 ENV_ASSERT(envp->cs_lev_max >= envp->cs_lev_min);
00117 ENV_ASSERT(envp->cs_del_max >= envp->cs_del_min);
00118
00119 ENV_ASSERT(env_total_weight(envp) > 0);
00120 }
00121
00122
00123
00124
00125
00126
00127
00128
00129 #endif // ENVISION_ENV_PARAMS_C_DEFINED