Indenting corrections

This commit is contained in:
Jerome Blanchi aka d.j.a.y
2019-05-29 01:30:38 +02:00
parent 6934233aad
commit d1c869d2c0
2 changed files with 105 additions and 105 deletions

View File

@@ -63,50 +63,50 @@ vj_effect *flip_init(int w, int h)
**********************************************************************************************/ **********************************************************************************************/
static void flip_x_yuvdata(VJFrame *frame) static void flip_x_yuvdata(VJFrame *frame)
{ {
unsigned int y = frame->height, x, x2; unsigned int y = frame->height, x, x2;
unsigned int pos = 0; unsigned int pos = 0;
const unsigned int w2 = frame->width >> 1; const unsigned int w2 = frame->width >> 1;
const unsigned int w3 = frame->width - 1; const unsigned int w3 = frame->width - 1;
uint8_t temp; uint8_t temp;
const unsigned int uv_width = frame->uv_width -1; const unsigned int uv_width = frame->uv_width -1;
unsigned int uy = frame->uv_height; unsigned int uy = frame->uv_height;
const unsigned int uw2 = w2 >> frame->shift_h; const unsigned int uw2 = w2 >> frame->shift_h;
uint8_t *Y = frame->data[0]; uint8_t *Y = frame->data[0];
uint8_t *Cb = frame->data[1]; uint8_t *Cb = frame->data[1];
uint8_t *Cr = frame->data[2]; uint8_t *Cr = frame->data[2];
/* Luminance */ /* Luminance */
do { do {
x = w2; x = w2;
x2 = w3; x2 = w3;
do { do {
temp = Y[pos + x2]; temp = Y[pos + x2];
Y[pos + x2] = Y[pos + w3 - x2]; Y[pos + x2] = Y[pos + w3 - x2];
Y[pos + w3 - x2] = temp; Y[pos + w3 - x2] = temp;
--x2; --x2;
} while (x--); } while (x--);
// Y[pos]=255; // Y[pos]=255;
pos += frame->width; pos += frame->width;
} while (--y); } while (--y);
pos = 0; pos = 0;
/* Chrominance */ /* Chrominance */
do { do {
x = uw2; x = uw2;
x2 = uv_width; x2 = uv_width;
do { do {
temp = Cb[pos + x2]; temp = Cb[pos + x2];
Cb[pos + x2] = Cb[pos + uv_width - x2]; Cb[pos + x2] = Cb[pos + uv_width - x2];
Cb[pos + uv_width - x2] = temp; Cb[pos + uv_width - x2] = temp;
temp = Cr[pos + x2]; temp = Cr[pos + x2];
Cr[pos + x2] = Cr[pos + uv_width - x2]; Cr[pos + x2] = Cr[pos + uv_width - x2];
Cr[pos + uv_width - x2] = temp; Cr[pos + uv_width - x2] = temp;
--x2; --x2;
} while (x--); } while (x--);
pos += frame->uv_width; pos += frame->uv_width;
} while (--uy); } while (--uy);
} }
@@ -118,49 +118,49 @@ static void flip_x_yuvdata(VJFrame *frame)
**********************************************************************************************/ **********************************************************************************************/
static void flip_y_yuvdata(VJFrame *frame) static void flip_y_yuvdata(VJFrame *frame)
{ {
unsigned int x, pos_a = 0, pos_b; unsigned int x, pos_a = 0, pos_b;
uint8_t temp; uint8_t temp;
unsigned int w1 = frame->width - 1; unsigned int w1 = frame->width - 1;
unsigned int y = frame->height >> 1; unsigned int y = frame->height >> 1;
unsigned int uy = y >> frame->shift_v; unsigned int uy = y >> frame->shift_v;
const unsigned int uv_height = frame->uv_height; const unsigned int uv_height = frame->uv_height;
const unsigned int uv_width = frame->uv_width; const unsigned int uv_width = frame->uv_width;
const unsigned int uw1 = ( frame->width >> frame->shift_h ) - 1; const unsigned int uw1 = ( frame->width >> frame->shift_h ) - 1;
uint8_t *Y = frame->data[0]; uint8_t *Y = frame->data[0];
uint8_t *Cb = frame->data[1]; uint8_t *Cb = frame->data[1];
uint8_t *Cr = frame->data[2]; uint8_t *Cr = frame->data[2];
/* Luminance */ /* Luminance */
pos_b = (frame->height ) * frame->width; pos_b = (frame->height ) * frame->width;
do { do {
x = w1; x = w1;
do { do {
temp = Y[pos_a + x]; temp = Y[pos_a + x];
Y[pos_a + x] = Y[pos_b + x]; Y[pos_a + x] = Y[pos_b + x];
Y[pos_b + x] = temp; Y[pos_b + x] = temp;
} while (x--); } while (x--);
pos_a += frame->width; pos_a += frame->width;
pos_b -= frame->width; pos_b -= frame->width;
} while (--y); } while (--y);
/* Chrominance */ /* Chrominance */
pos_a = 0; pos_a = 0;
pos_b = (uv_height ) * uv_width; pos_b = (uv_height ) * uv_width;
do { do {
x = uw1; x = uw1;
do { do {
temp = Cb[pos_a + x]; temp = Cb[pos_a + x];
Cb[pos_a + x] = Cb[pos_b + x]; Cb[pos_a + x] = Cb[pos_b + x];
Cb[pos_b + x] = temp; Cb[pos_b + x] = temp;
temp = Cr[pos_a + x]; temp = Cr[pos_a + x];
Cr[pos_a + x] = Cr[pos_b + x]; Cr[pos_a + x] = Cr[pos_b + x];
Cr[pos_b + x] = temp; Cr[pos_b + x] = temp;
} while (x--); } while (x--);
pos_a += uv_width; pos_a += uv_width;
pos_b -= uv_width; pos_b -= uv_width;
} while (--uy); } while (--uy);
} }
/********************************************************************************************** /**********************************************************************************************
@@ -170,16 +170,16 @@ static void flip_y_yuvdata(VJFrame *frame)
**********************************************************************************************/ **********************************************************************************************/
void flip_both_yuvdata(VJFrame *frame) void flip_both_yuvdata(VJFrame *frame)
{ {
uint8_t temp; uint8_t temp;
uint8_t *Y = frame->data[0]; uint8_t *Y = frame->data[0];
uint8_t *Cb = frame->data[1]; uint8_t *Cb = frame->data[1];
uint8_t *Cr = frame->data[2]; uint8_t *Cr = frame->data[2];
const unsigned int h2 = (frame->height >> 1); const unsigned int h2 = (frame->height >> 1);
unsigned int x, y, pos_a, pos_b; unsigned int x, y, pos_a, pos_b;
pos_a = 0; pos_a = 0;
pos_b = (frame->height * frame->width)-1; pos_b = (frame->height * frame->width)-1;
/* Luminance & Chrominance*/ /* Luminance & Chrominance*/
for (y = 0 ; y < h2 ; y++) for (y = 0 ; y < h2 ; y++)
{ {
for (x = 0 ; x < frame->width ; x++ ) for (x = 0 ; x < frame->width ; x++ )

View File

@@ -29,23 +29,23 @@ vj_effect *raster_init(int w, int h)
vj_effect *ve = (vj_effect *) vj_calloc(sizeof(vj_effect)); vj_effect *ve = (vj_effect *) vj_calloc(sizeof(vj_effect));
ve->num_params = 2; ve->num_params = 2;
ve->defaults = (int *) vj_calloc(sizeof(int) * ve->num_params); /* default values */ ve->defaults = (int *) vj_calloc(sizeof(int) * ve->num_params); /* default values */
ve->limits[0] = (int *) vj_calloc(sizeof(int) * ve->num_params); /* min */ ve->limits[0] = (int *) vj_calloc(sizeof(int) * ve->num_params); /* min */
ve->limits[1] = (int *) vj_calloc(sizeof(int) * ve->num_params); /* max */ ve->limits[1] = (int *) vj_calloc(sizeof(int) * ve->num_params); /* max */
ve->limits[0][0] = 4; ve->limits[0][0] = 4;
ve->limits[1][0] = h/4; ve->limits[1][0] = h/4;
ve->limits[0][1] = 0; ve->limits[0][1] = 0;
ve->limits[1][1] = 1; ve->limits[1][1] = 1;
ve->defaults[0] = 4; ve->defaults[0] = 4;
ve->defaults[1] = 1; ve->defaults[1] = 1;
ve->description = "Grid"; ve->description = "Grid";
ve->sub_format = 1; ve->sub_format = 1;
ve->extra_frame = 0; ve->extra_frame = 0;
ve->has_user = 0; ve->has_user = 0;
ve->param_description = vje_build_param_list( ve->num_params, "Grid size", "Mode"); ve->param_description = vje_build_param_list( ve->num_params, "Grid size", "Mode");
ve->hints = vje_init_value_hint_list( ve->num_params ); ve->hints = vje_init_value_hint_list( ve->num_params );
vje_build_value_hint_list( ve->hints, ve->limits[1][1], 1,"Black", "White" ); vje_build_value_hint_list( ve->hints, ve->limits[1][1], 1,"Black", "White" );
return ve; return ve;
} }
@@ -65,31 +65,31 @@ void raster_free()
void raster_apply(VJFrame *frame, int val, int mode) void raster_apply(VJFrame *frame, int val, int mode)
{ {
int x,y, yval; int x,y, yval;
uint8_t *Y = frame->data[0]; uint8_t *Y = frame->data[0];
uint8_t *Cb= frame->data[1]; uint8_t *Cb= frame->data[1];
uint8_t *Cr= frame->data[2]; uint8_t *Cr= frame->data[2];
const unsigned int width = frame->width; const unsigned int width = frame->width;
const unsigned int height = frame->height; const unsigned int height = frame->height;
if(val == 0 ) if(val == 0 )
return; return;
for(x=0; x < width; x++) for(x=0; x < width; x++)
{ {
xval[x] = x%val; xval[x] = x%val;
} }
uint8_t pixel_color = mode ? pixel_Y_hi_ : pixel_Y_lo_; uint8_t pixel_color = mode ? pixel_Y_hi_ : pixel_Y_lo_;
for(y=0; y < height; y++) for(y=0; y < height; y++)
{ {
yval = y%val; yval = y%val;
for(x=0; x < width; x++) for(x=0; x < width; x++)
{ {
Y[y*width+x] = ((xval[x]>1)? ((yval>1) ? Y[y*width+x]: pixel_color):pixel_color); Y[y*width+x] = ((xval[x]>1)? ((yval>1) ? Y[y*width+x]: pixel_color):pixel_color);
Cb[y*width+x] = ((xval[x]>1)? ((yval>1) ? Cb[y*width+x]:128):128); Cb[y*width+x] = ((xval[x]>1)? ((yval>1) ? Cb[y*width+x]:128):128);
Cr[y*width+x] = ((xval[x]>1)? ((yval>1) ? Cr[y*width+x]:128):128); Cr[y*width+x] = ((xval[x]>1)? ((yval>1) ? Cr[y*width+x]:128):128);
} }
} }
} }