DoExpand
BEGIN
INPUT insize;
INPUT out_size;
INIT max_weight = 2A8;
INIT expand__para = max weight * in size / out_size;
INIT remain_weight = 0;
INIT weight[2] = 0;
INIT weight[3] = 0;
INIT weight[4] = 0;
INIT starting_pixel_pointer = 0;
INIT interval = 0;
f\ FOR each outputidx From 0 To out size
interval = 0;
weight[0] = max_weight - remain_weight;
weight[l] = remain_weight;
CALL ExecuteScalingHardware with starting_pixel_pointer, output_idx and weight[0...4];
remain_weight += expand_para;
IF remain_weight > max weight THEN
remainweight -= maxweight;
INCREMENT interval;
END IF
starting_pixel_pointer += invterval;
END FOR
END
ExecuteScalingHardware
BEGIN
INPUT starting_pixel_pointer;
INPUT output_idx;
INPUT weight[0...4];
Get 5 input data From starting_pixel_pointer;
output_data = ( weight[0] * input_data[0] +
weight[l] * input_data[l] +
weight[2] * input_data[2] +
weight[3] * input_data[3] +
weight[4] * input_data[4])» 8;
END
FIG. 3