42 lines
940 B
C
42 lines
940 B
C
/*
|
|
* qsort_rgb.c
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <math.h>
|
|
|
|
#include "../floatimg.h"
|
|
|
|
int verbosity;
|
|
|
|
/* --------------------------------------------------------------------- */
|
|
/* nouveau 7 octobre 2020, juste avant sonoptic de la pluie craignos */
|
|
|
|
static int compare(const void *p1, const void *p2)
|
|
{
|
|
return ( *(float *)p1 < *(float *)p2 );
|
|
}
|
|
|
|
int fimg_qsort_rgb(FloatImg *psrc, FloatImg *pdst, int notused)
|
|
{
|
|
int foo, szimg;
|
|
|
|
#if DEBUG_LEVEL
|
|
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, psrc, pdst, notused);
|
|
#endif
|
|
|
|
foo = fimg_copy_data(psrc, pdst);
|
|
|
|
szimg = pdst->width * pdst->height;
|
|
fprintf(stderr, "%s : %d pixels\n", __func__, szimg);
|
|
|
|
qsort(pdst->R, szimg, sizeof(float), compare);
|
|
qsort(pdst->G, szimg, sizeof(float), compare);
|
|
qsort(pdst->B, szimg, sizeof(float), compare);
|
|
|
|
return 0;
|
|
}
|
|
/* --------------------------------------------------------------------- */
|