static void InitActiveImage(IceTImage image) { /* Create a worst case possible for image with respect to compression. All the pixels are active, so no data can be removed. */ IceTEnum format; IceTSizeType num_pixels; int seed; seed = (int)time(NULL); srand(seed); num_pixels = icetImageGetNumPixels(image); format = icetImageGetColorFormat(image); if (format == ICET_IMAGE_COLOR_RGBA_UBYTE) { IceTUByte *buffer = icetImageGetColorub(image); IceTSizeType i; for (i = 0; i < num_pixels; i++) { buffer[4*i + 0] = (IceTUByte)(rand()%255 + 1); buffer[4*i + 1] = (IceTUByte)(rand()%255 + 1); buffer[4*i + 2] = (IceTUByte)(rand()%255 + 1); buffer[4*i + 3] = (IceTUByte)(rand()%255 + 1); } } else if (format == ICET_IMAGE_COLOR_RGBA_FLOAT) { IceTFloat *buffer = icetImageGetColorf(image); IceTSizeType i; for (i = 0; i < num_pixels; i++) { buffer[4*i + 0] = ((IceTFloat)(rand()%255 + 1))/255; buffer[4*i + 1] = ((IceTFloat)(rand()%255 + 1))/255; buffer[4*i + 2] = ((IceTFloat)(rand()%255 + 1))/255; buffer[4*i + 3] = ((IceTFloat)(rand()%255 + 1))/255; } } else if (format != ICET_IMAGE_COLOR_NONE) { printrank("*** Unknown color format? ***\n"); } format = icetImageGetDepthFormat(image); if (format == ICET_IMAGE_DEPTH_FLOAT) { IceTFloat *buffer = icetImageGetDepthf(image); IceTSizeType i; for (i = 0; i < num_pixels; i++) { buffer[i] = ((IceTFloat)(rand()%255))/255; } } else if (format != ICET_IMAGE_DEPTH_NONE) { printrank("*** Unknown depth format? ***\n"); } }
static void DisplayNoDrawDoTest(void) { for (global_iteration = 0; global_iteration < global_num_proc; global_iteration++) { IceTImage image; IceTUByte *color_buffer; printf("Blank image is rank %d\n", global_iteration); image = icetGLDrawFrame(); swap_buffers(); if ( (global_rank == 0) && (global_num_proc > 1) /* This last case covers when there is only 2 processes, * the root, as always, is not drawing anything and the * other process is drawing the clear screen. */ && ((global_num_proc > 2) || (global_iteration != 1)) ) { int p; int bad_count = 0; printf("Checking pixels.\n"); color_buffer = icetImageGetColorub(image); for (p = 0; (p < SCREEN_WIDTH*SCREEN_HEIGHT*4) && (bad_count < 10); p++) { if (color_buffer[p] != 255) { printf("BAD PIXEL %d.%d\n", p/4, p%4); printf(" Expected 255, got %d\n", color_buffer[p]); bad_count++; } } if (bad_count >= 10) { char filename[256]; global_result = TEST_FAILED; sprintf(filename, "DisplayNoDraw_%s_%s_%d.ppm", icetGetStrategyName(), icetGetSingleImageStrategyName(), global_iteration); write_ppm(filename, color_buffer, (int)SCREEN_WIDTH, (int)SCREEN_HEIGHT); break; } } } }
static void InitPathologicalImage(IceTImage image) { /* Create a worst case possible for image with respect to compression. Every other pixel is active so the run lengths are all 1. */ IceTEnum format; IceTSizeType num_pixels; num_pixels = icetImageGetNumPixels(image); format = icetImageGetColorFormat(image); if (format == ICET_IMAGE_COLOR_RGBA_UBYTE) { IceTUByte *buffer = icetImageGetColorub(image); IceTSizeType i; for (i = 0; i < num_pixels; i++) { buffer[4*i + 0] = 255*(IceTUByte)(i%2); buffer[4*i + 1] = 255*(IceTUByte)(i%2); buffer[4*i + 2] = 255*(IceTUByte)(i%2); buffer[4*i + 3] = 255*(IceTUByte)(i%2); } } else if (format == ICET_IMAGE_COLOR_RGBA_FLOAT) { IceTFloat *buffer = icetImageGetColorf(image); IceTSizeType i; for (i = 0; i < num_pixels; i++) { buffer[4*i + 0] = (IceTFloat)(i%2); buffer[4*i + 1] = (IceTFloat)(i%2); buffer[4*i + 2] = (IceTFloat)(i%2); buffer[4*i + 3] = (IceTFloat)(i%2); } } else if (format != ICET_IMAGE_COLOR_NONE) { printrank("*** Unknown color format? ***\n"); } format = icetImageGetDepthFormat(image); if (format == ICET_IMAGE_DEPTH_FLOAT) { IceTFloat *buffer = icetImageGetDepthf(image); IceTSizeType i; for (i = 0; i < num_pixels; i++) { buffer[i] = (IceTFloat)(i%2); } } else if (format != ICET_IMAGE_DEPTH_NONE) { printrank("*** Unknown depth format? ***\n"); } }