📄 ref_forward_roi.c
字号:
&new_decomp_sequence_pos,
first_max_horiz_hp_descent,
first_max_vert_hp_descent));
first_split_in_level = 1;
current_opcode = decomp_sequence[*decomp_sequence_pos];
(*decomp_sequence_pos)++;
assert(current_opcode > 0);
switch (current_opcode) {
case 1:
vert_limit = 2;
horiz_limit = 2;
break;
case 2:
vert_limit = 1;
horiz_limit = 2;
remaining_max_vert_hp_descent++; /* Offset dis-joint splitting */
break;
case 3:
vert_limit = 2;
horiz_limit = 1;
remaining_max_horiz_hp_descent++; /* Offset dis-joint splitting */
break;
}
}
else
first_split_in_level = 0;
info->get_kernel_type(info,INFO__VERTICAL,INFO__SYNTHESIS,component_idx,
num_levels,&low_neg,&low_pos,&high_neg,&high_pos);
vert_stage = ref_roi_create_vertical_stage();
vert_stage->vert_limit = vert_limit;
vert_stage->horiz_limit = horiz_limit;
if (vert_limit > 1) {
vert_stage->branch_neg_supports[0] = low_neg;
vert_stage->branch_pos_supports[0] = low_pos;
vert_stage->branch_neg_supports[1] = high_neg;
vert_stage->branch_pos_supports[1] = high_pos;
}
else {
vert_stage->branch_neg_supports[0] = 0;
vert_stage->branch_pos_supports[0] = 0;
vert_stage->branch_neg_supports[1] = 0;
vert_stage->branch_pos_supports[1] = 0;
}
vert_stage->direction = INFO__VERTICAL;
vert_stage->parent = parent;
info->get_kernel_type(info,INFO__HORIZONTAL,INFO__SYNTHESIS,component_idx,
num_levels,&low_neg,&low_pos,&high_neg,&high_pos);
for (vert_idx=0; vert_idx < vert_limit; vert_idx++)
{
hor_stage = ref_roi_create_horizontal_stage();
vert_stage->branches[vert_idx] = hor_stage;
hor_stage->vert_limit = vert_limit;
hor_stage->horiz_limit = horiz_limit;
if (horiz_limit > 1) {
hor_stage->branch_neg_supports[0] = low_neg;
hor_stage->branch_pos_supports[0] = low_pos;
hor_stage->branch_neg_supports[1] = high_neg;
hor_stage->branch_pos_supports[1] = high_pos;
}
else {
hor_stage->branch_neg_supports[0] = 0;
hor_stage->branch_pos_supports[0] = 0;
hor_stage->branch_neg_supports[1] = 0;
hor_stage->branch_pos_supports[1] = 0;
}
hor_stage->direction = INFO__HORIZONTAL;
hor_stage->parent = vert_stage;
for (hor_idx=0; hor_idx < horiz_limit; hor_idx++)
{
int orient;
int vert_hp_descent, horiz_hp_descent;
if ((vert_idx == 0) && (hor_idx == 0))
orient = LL_BAND;
else if ((vert_idx == 0) && (hor_idx == 1))
orient = HL_BAND;
else if ((vert_idx == 1) && (hor_idx == 0))
orient = LH_BAND;
else
orient = HH_BAND;
band_idx = root_band_idx + orient *
(1 << 2*(remaining_hp_descent - 1));
info->get_band_info(info,component_idx,num_levels,band_idx,
NULL,NULL,&vert_hp_descent,&horiz_hp_descent,NULL,NULL,NULL);
if (band_idx == 0)
{ /* Must be LL band for the level. Propagate split into
next level. */
assert(first_split_in_level);
hor_stage->branches[hor_idx] =
create_roi_mask_generation_tree(num_levels-1,component_idx,
info,lev-1,hor_stage,0,0,
0, 0, 0, 0,
new_decomp_sequence,
&new_decomp_sequence_pos,
first_max_horiz_hp_descent,
first_max_vert_hp_descent);
if (!lev->roi_generation_needed)
return(vert_stage);
}
else if ((remaining_hp_descent > 1) &&
((remaining_max_vert_hp_descent >
(first_max_vert_hp_descent - vert_hp_descent + 1)) ||
((remaining_max_horiz_hp_descent >
(first_max_horiz_hp_descent - horiz_hp_descent + 1)))))
{ /* Band needs to be further decomposed within current
level. */
int new_vert_limit = 2, new_horiz_limit = 2;
int new_remaining_max_vert_hp_descent = remaining_max_vert_hp_descent-1;
int new_remaining_max_horiz_hp_descent = remaining_max_horiz_hp_descent-1;
current_opcode = decomp_sequence[*decomp_sequence_pos];
(*decomp_sequence_pos)++;
assert(current_opcode > 0);
switch (current_opcode) {
case 1:
new_vert_limit = 2;
new_horiz_limit = 2;
new_remaining_max_vert_hp_descent = remaining_max_vert_hp_descent-1;
new_remaining_max_horiz_hp_descent = remaining_max_horiz_hp_descent-1;
break;
case 2:
new_vert_limit = 1;
new_horiz_limit = 2;
new_remaining_max_vert_hp_descent = remaining_max_vert_hp_descent;
new_remaining_max_horiz_hp_descent = remaining_max_horiz_hp_descent-1;
break;
case 3:
new_vert_limit = 2;
new_remaining_max_vert_hp_descent = remaining_max_vert_hp_descent-1;
new_remaining_max_horiz_hp_descent = remaining_max_horiz_hp_descent;
new_horiz_limit = 1;
break;
}
hor_stage->branches[hor_idx] =
create_roi_mask_generation_tree(num_levels,component_idx,
info,lev,hor_stage,
remaining_hp_descent-1,
band_idx,
new_vert_limit, new_horiz_limit,
new_remaining_max_vert_hp_descent,
new_remaining_max_horiz_hp_descent,
decomp_sequence,
decomp_sequence_pos,
first_max_horiz_hp_descent,
first_max_vert_hp_descent);
}
else
{ /* Band is finished. Insert a leaf node. */
if (remaining_hp_descent > 1) {
current_opcode = decomp_sequence[*decomp_sequence_pos];
assert(current_opcode == 0);
(*decomp_sequence_pos)++;
}
leaf_stage = ref_roi_create_band_stage();
hor_stage->branches[hor_idx] = leaf_stage;
leaf_stage->parent = hor_stage;
lev->bands[band_idx] = (roi_band_ref) leaf_stage;
}
}
}
return(vert_stage);
}
/* SAIC General Decomp. End mods */
/*****************************************************************************/
/* STATIC get_tile_specific_args */
/*****************************************************************************/
static void
get_tile_specific_args(int num_components, roi_component_info_ptr components,
cmdl_ref cmdl, int tnum, char **global_rgn_params,
char **global_max_shift_params)
/* Parses tile-specific arguments to set up region geometries and boost
values as well as the `max_shift' mode value for each component. The
last two argument provide the function with pointers to any parameter
lists which were supplied with non-tile-specific `-Rrgn' and `-Rmax_shift'
arguments. These are compared with the tile-specific parameter pointers
to determine whether or not individual tile configurations are being
supplied. */
{
roi_tile_ptr tile;
roi_region_ptr reg;
char **params, **last_comp_params;
int p, c, last_comp_p;
assert(tnum >= 0);
/* Build the regions list first. */
if ((p = cmdl->extract(cmdl,"-Rrgn",tnum,¶ms)) >= 0)
{
if (params != global_rgn_params)
for (c=0; c < num_components; c++)
components[c].tiles[tnum].tile_specific_params = 1;
for (c=0; c < num_components; c++)
{
tile = components[c].tiles + tnum;
last_comp_params = params;
last_comp_p = p;
while ((p > 0) && (strcmp(*params,"*") != 0))
{
int boost;
if ((sscanf(*params,"%d",&boost) != 1) || (boost <= 0))
local_error("The `-Rrgn' argument requires positive region "
"boost parameters!");
p--; params++;
if ((p > 0) && (strcmp(*params,"R") == 0))
{
float y, x, ht, wd;
p--; params++;
if ((p < 4) ||
(sscanf(params[0],"%f",&y) == 0) ||
(sscanf(params[1],"%f",&x) == 0) ||
(sscanf(params[2],"%f",&ht) == 0) ||
(sscanf(params[3],"%f",&wd) == 0) ||
(x < 0.0F) || (x > 1.0F) || (y < 0.0F) || (y > 1.0F) ||
(wd < 0.0F) || (wd > 1.0F) || (ht < 0.0F) || (ht > 1.0F))
local_error("The `-Rrgn' argument requires four relative "
"location and dimension parameters in the "
"range 0 to 1, to follow each rectangular "
"region specifier!");
install_rectangular_region(tile,&(components[c].image_dims),
boost,y,x,ht,wd);
p -= 4; params += 4;
}
else if ((p > 0) && (strcmp(*params,"C") == 0))
{
float y, x, rad;
p--; params++;
if ((p < 3) ||
(sscanf(params[0],"%f",&y) == 0) ||
(sscanf(params[1],"%f",&x) == 0) ||
(sscanf(params[2],"%f",&rad) == 0) ||
(x < 0.0F) || (x > 1.0F) || (y < 0.0F) || (y > 1.0F) ||
(rad < 0.0F) || (rad > 1.0F))
local_error("The `-Rrgn' argument requires three relative "
"location and radius parameters in the range "
"0 to 1, to follow each circular region "
"specifier!");
install_circular_region(tile,&(components[c].image_dims),
boost,y,x,rad);
tile->is_rectangular = 0;
p -= 3; params += 3;
}
else
local_error("The `-Rrgn' argument requires a single `R' or "
"`C' character immediately after the boost value "
"in each region specification!");
}
/* Compute the `max_boost' and `is_rectangular' values for the
tile-component. */
tile->max_boost = 0;
tile->is_rectangular = 1;
for (reg=tile->regions; reg != NULL; reg=reg->next)
{
if (reg->boost > tile->max_boost)
tile->max_boost = reg->boost;
if (!reg->is_rectangular)
tile->is_rectangular = 0;
}
/* Advance counters for next component. */
if (p > 0)
{ /* Advance to next component's parameter set. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -