minor optimization, fix indenting

This commit is contained in:
veejay
2023-11-30 23:39:23 +01:00
parent a40828db3c
commit d22cb19e70

View File

@@ -61,14 +61,7 @@ void *swirl_malloc(int w, int h)
if(!s) {
return NULL;
}
/* s->buf[0] = vj_malloc( sizeof(uint8_t) * (w*h*3));
if(!s->buf[0]) {
swirl_free(s);
return NULL;
}
s->buf[1] = s->buf[0] + (w*h);
s->buf[2] = s->buf[1] + (w*h);
*/
s->polar_map = (double*) vj_calloc(sizeof(double) * (w * h) );
if(!s->polar_map) {
swirl_free(s);
@@ -108,8 +101,6 @@ void swirl_free(void *ptr)
swirl_t *s = (swirl_t*) ptr;
if(s) {
// if( s->buf[0] )
// free(s->buf[0] );
if( s->polar_map )
free(s->polar_map);
if( s->fish_angle )
@@ -136,14 +127,12 @@ void swirl_apply(void *ptr, VJFrame *frame, int *args)
double *polar_map = s->polar_map;
double *fish_angle = s->fish_angle;
int *cached_coords = s->cached_coords;
// uint8_t **buf = s->buf;
if( s->v != v )
{
const unsigned int R = width;
const double coeef = v;
/* pre calculate */
int px,py;
double r,a;
double si,co;
@@ -167,12 +156,9 @@ void swirl_apply(void *ptr, VJFrame *frame, int *args)
s->v = v;
}
// int strides[4] = { len, len, len , 0 };
// vj_frame_copy( frame->data, buf, strides );
for(i=0; i < len; i++)
{
int idx = (cached_coords[i] == -1) ? 0 : cached_coords[i];
int idx = cached_coords[i];
Y[i] = Y[idx];
Cb[i] = Cb[idx];