Fix. Ring buffers are a height value.

pull/32/head
Jorge Rodriguez 2014-07-29 23:09:41 -07:00
parent 043fa28c11
commit 7ead9a748d
2 changed files with 8 additions and 1 deletions

View File

@ -1248,7 +1248,7 @@ STBRDEF int stbr_resize_arbitrary(const void* input_data, int input_w, int input
{
stbr_info->horizontal_buffer = NULL;
stbr_info->ring_buffer = STBR__NEXT_MEMPTR(stbr_info->decode_buffer, stbr_info->decode_buffer_texels * channels * sizeof(float), float);
stbr_info->encode_buffer = STBR__NEXT_MEMPTR(stbr_info->ring_buffer, stbr_info->ring_buffer_length_bytes * stbr__get_filter_texel_width(filter, input_w, output_w), float);
stbr_info->encode_buffer = STBR__NEXT_MEMPTR(stbr_info->ring_buffer, stbr_info->ring_buffer_length_bytes * stbr__get_filter_texel_width(filter, input_h, output_h), float);
STBR_DEBUG_ASSERT((size_t)STBR__NEXT_MEMPTR(stbr_info->encode_buffer, stbr_info->channels * sizeof(float), unsigned char) == (size_t)tempmem + tempmem_size_in_bytes);
}

View File

@ -157,6 +157,13 @@ void test_suite()
sprintf(outname, "test-output/barbara-height-%d.jpg", i);
resize_image("barbara.png", 1, (float)i / 100, STBR_FILTER_CATMULLROM, STBR_EDGE_CLAMP, outname);
}
for (int i = 50; i < 200; i += 10)
{
char outname[200];
sprintf(outname, "test-output/barbara-width-height-%d.jpg", i);
resize_image("barbara.png", 100 / (float)i, (float)i / 100, STBR_FILTER_CATMULLROM, STBR_EDGE_CLAMP, outname);
}
}