Lines Matching refs:pattern

143 pattern_init (pattern_t *pattern, int width, int height)
147 if (!pattern)
155 pattern->buffer = buffer;
156 pattern->width = width;
157 pattern->height = height;
179 pattern_get (pattern_t *pattern, int x, int y)
181 return &pattern->buffer[y * pattern->width + x];
185 pattern_fill_white_noise (pattern_t *pattern, float fraction,
188 bool_t *buffer = pattern->buffer;
189 bool_t *end = buffer + (pattern->width * pattern->height);
196 pattern_destroy (pattern_t *pattern)
198 free (pattern->buffer);
331 compute_cluster_sizes (pattern_t *pattern, matrix_t *matrix)
333 int width = pattern->width,
334 height = pattern->height;
345 shared (height, width, pattern, matrix, tsqsi)
351 bool_t pixel = *pattern_get (pattern, px, py);
364 dist += (pixel == *pattern_get (pattern, qx, qy))
377 swap_pixel (pattern_t *pattern, matrix_t *matrix, int x, int y)
379 int width = pattern->width,
380 height = pattern->height;
391 new = !*pattern_get (pattern, x, y);
392 *pattern_get (pattern, x, y) = new;
401 shared (x, y, width, height, pattern, matrix, new, tsqsi)
413 b = (*pattern_get (pattern, px, py) == new);
426 largest_cluster (pattern_t *pattern, matrix_t *matrix,
429 int width = pattern->width,
430 height = pattern->height;
439 shared (height, width, pattern, matrix, pixel, xmax, ymax, vmax)
454 if (*pattern_get (pattern, x, y) != pixel)
489 generate_initial_binary_pattern (pattern_t *pattern, matrix_t *matrix)
498 largest_cluster (pattern, matrix, TRUE, &xcluster, &ycluster);
499 assert (*pattern_get (pattern, xcluster, ycluster) == TRUE);
500 swap_pixel (pattern, matrix, xcluster, ycluster);
502 largest_cluster (pattern, matrix, FALSE, &xvoid, &yvoid);
503 assert (*pattern_get (pattern, xvoid, yvoid) == FALSE);
504 swap_pixel (pattern, matrix, xvoid, yvoid);
617 printf("Filling initial binary pattern with white noise...\n");
628 printf("Generating initial binary pattern...\n");