Example #1
0
void sort(struct Image * img, const Context_t * ctx) {
	// Create a list of sort plan steps
	SortPlan_t * plan_steps = create_sort_plan(img, ctx);

	for(const SortPlan_t * step = plan_steps; NULL != step; step = step->next_step_ptr) {
		Pixel_t * pixels = create_pixel_list(img, step);
		do_sort(pixels, step);
		sync_pixels(img, step, pixels);
	}

	destroy_sort_plan(plan_steps);
}
Example #2
0
void sort(struct image * img, const context_t * ctx)
{
    sort_plan_t *plan_steps;

    if(ROW == ctx->orientation) {
        plan_steps = create_sort_plan(img, ctx, ROW);
    } else if(COLUMN == ctx->orientation) {
        plan_steps = create_sort_plan(img, ctx, COLUMN);
    } else {
        plan_steps = create_sort_plan(img, ctx, ROW);
        plan_steps->next_step_ptr = create_sort_plan(img, ctx, COLUMN);
    }

    for(const sort_plan_t * step = plan_steps; NULL != step; step = step->next_step_ptr) {
        pixel_t * pixels = create_pixel_list(img, step);
        do_sort(pixels, step);
        sync_pixels(img, step, pixels);
    }

    destroy_sort_plan(plan_steps);
}