|
|
|
@ -7,6 +7,7 @@
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
|
|
#include "../floatimg.h"
|
|
|
|
@ -188,4 +189,48 @@ for (y=BB; y<h-BB; y++) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
/* -------------------------------------------------------------- */
|
|
|
|
|
static void shifter(float *fs, float *fd, int w, int nbr)
|
|
|
|
|
{
|
|
|
|
|
int krkr;
|
|
|
|
|
|
|
|
|
|
for (krkr=0; krkr<nbr; krkr++) {
|
|
|
|
|
fd[krkr] = fs[(krkr+w)%nbr];
|
|
|
|
|
}
|
|
|
|
|
/* take your sixpack, film at 11 */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int multilines_shift_0(FloatImg *picz, int step, int nombre)
|
|
|
|
|
{
|
|
|
|
|
float *buffline, *sptr;
|
|
|
|
|
int idx, ypos;
|
|
|
|
|
|
|
|
|
|
#if DEBUG_LEVEL
|
|
|
|
|
fprintf(stderr, ">>> %s ( %p %d %d )\n", __func__, picz, step, nombre);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
buffline = alloca(picz->width * sizeof(float));
|
|
|
|
|
if (NULL==buffline) {
|
|
|
|
|
fprintf(stderr, "%s: memory panic\n", __func__);
|
|
|
|
|
abort();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (idx=0; idx<nombre; idx++) {
|
|
|
|
|
ypos = rand() % picz->height;
|
|
|
|
|
|
|
|
|
|
sptr = picz->R + (ypos * picz->width);
|
|
|
|
|
shifter(sptr, buffline, step, picz->width);
|
|
|
|
|
memcpy(sptr, buffline, picz->width*sizeof(float));
|
|
|
|
|
|
|
|
|
|
sptr = picz->G + (ypos * picz->width);
|
|
|
|
|
shifter(sptr, buffline, step, picz->width);
|
|
|
|
|
memcpy(sptr, buffline, picz->width*sizeof(float));
|
|
|
|
|
|
|
|
|
|
sptr = picz->B + (ypos * picz->width);
|
|
|
|
|
shifter(sptr, buffline, step, picz->width);
|
|
|
|
|
memcpy(sptr, buffline, picz->width*sizeof(float));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
/* -------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|