#define MAX_CHAR(data, accum) ((255 - (data)) > (accum)) ? ((accum) + (data)) : 255 //output matrix must be the same width as the input matrix and have a height of 255 void max_jit_scope_waveform_do(t_max_jit_scope *x, t_jit_matrix_info *in_minfo, char *bip, t_jit_matrix_info *out_minfo, char *bop) { uchar *cp; int i, j; int width, height, planecount, oplanecount; int voffset; int in_rowstride, out_rowstride; uchar accum = x->accum; planecount = in_minfo->planecount; oplanecount = out_minfo->planecount; width = in_minfo->dim[0]; height = in_minfo->dim[1]; voffset = out_minfo->dim[1] - 1; in_rowstride = in_minfo->dimstride[1]; out_rowstride = out_minfo->dimstride[1]; switch(planecount) { case 1: { //luma pass for(j=0; j < height; j++) { cp = (uchar *)(bip + j*in_rowstride); for(i=0; i < width; i++) { uchar *out_pix = (uchar *)(bop + i*oplanecount + (voffset - (*cp++))*out_rowstride); *out_pix++ = 255; *out_pix++ = MAX_CHAR(*out_pix, accum); *out_pix++ = MAX_CHAR(*out_pix, accum); *out_pix++ = MAX_CHAR(*out_pix, accum); } } } break; //// more cut off