Commit 76baaaed authored by Kenneth Moreland's avatar Kenneth Moreland
Browse files

Add test for the size of interlaced images.

parent fde0b7d2
......@@ -1520,9 +1520,9 @@ void icetSparseImageSplit(const IceTSparseImage in_image,
}
void icetSparseImageInterlace(const IceTSparseImage in_image,
IceTSparseImage out_image,
IceTInt eventual_num_partitions,
IceTEnum scratch_state_buffer)
IceTEnum scratch_state_buffer,
IceTSparseImage out_image)
{
IceTSizeType num_pixels = icetSparseImageGetNumPixels(in_image);
IceTEnum color_format = icetSparseImageGetColorFormat(in_image);
......
......@@ -119,6 +119,11 @@ ICET_EXPORT IceTSizeType icetSparseImageSplitPartitionNumPixels(
IceTInt num_partitions,
IceTInt eventual_num_partitions);
ICET_EXPORT void icetSparseImageInterlace(const IceTSparseImage in_image,
IceTInt eventual_num_partitions,
IceTEnum scratch_state_buffer,
IceTSparseImage out_image);
ICET_EXPORT void icetClearImage(IceTImage image);
ICET_EXPORT void icetClearSparseImage(IceTSparseImage image);
......
......@@ -144,6 +144,8 @@ static int DoCompressionTest(IceTEnum color_format, IceTEnum depth_format,
IceTSizeType imagesize;
IceTSparseImage compressedimage;
IceTVoid *compressedbuffer;
IceTSparseImage interlacedimage;
IceTVoid *interlacedbuffer;
IceTSizeType compressedsize;
IceTSizeType color_pixel_size;
IceTSizeType depth_pixel_size;
......@@ -175,6 +177,11 @@ static int DoCompressionTest(IceTEnum color_format, IceTEnum depth_format,
SCREEN_WIDTH,
SCREEN_HEIGHT);
interlacedbuffer = malloc(compressedsize);
interlacedimage = icetSparseImageAssignBuffer(interlacedbuffer,
SCREEN_WIDTH,
SCREEN_HEIGHT);
/* Get the number of bytes per pixel. This is used in checking the
size of compressed images. */
icetImageGetColorVoid(image, &color_pixel_size);
......@@ -198,6 +205,21 @@ static int DoCompressionTest(IceTEnum color_format, IceTEnum depth_format,
result = TEST_FAILED;
}
printf("Interlacing image.\n");
icetSparseImageInterlace(compressedimage,
97,
ICET_SI_STRATEGY_BUFFER_0,
interlacedimage);
size = icetSparseImageGetCompressedBufferSize(compressedimage);
printf("Expected size: %d. Actual size: %d\n",
(int)(pixel_size*(pixels/2) + 2*sizeof(IceTUShort)*(pixels/2)),
(int)size);
if ( (size > compressedsize)
|| (size < pixel_size*(pixels/2)) ) {
printf("*** Size differs from expected size!\n");
result = TEST_FAILED;
}
printf("\nCreating a different worst possible image.\n");
InitActiveImage(image);
printf("Compressing image.\n");
......@@ -210,6 +232,21 @@ static int DoCompressionTest(IceTEnum color_format, IceTEnum depth_format,
result = TEST_FAILED;
}
printf("Interlacing image.\n");
icetSparseImageInterlace(compressedimage,
97,
ICET_SI_STRATEGY_BUFFER_0,
interlacedimage);
size = icetSparseImageGetCompressedBufferSize(compressedimage);
printf("Expected size: %d. Actual size: %d\n",
(int)(pixel_size*(pixels/2) + 2*sizeof(IceTUShort)*(pixels/2)),
(int)size);
if ( (size > compressedsize)
|| (size < pixel_size*(pixels/2)) ) {
printf("*** Size differs from expected size!\n");
result = TEST_FAILED;
}
printf("\nCompressing zero size image.\n");
icetImageSetDimensions(image, 0, 0);
icetCompressImage(image, compressedimage);
......@@ -249,6 +286,7 @@ static int DoCompressionTest(IceTEnum color_format, IceTEnum depth_format,
printf("Cleaning up.\n");
free(imagebuffer);
free(compressedbuffer);
free(interlacedbuffer);
return result;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment