Thanks for LibRaw; it's a very convenient way to process raw images. However, I've run into a problem.
I'm using half_size = 1 to get small images without color interpolation fast,
and dcraw_make_mem_image() to get a copy in memory.
If I run this several times on the same image, the first image is different from the following images.
I've added a small test program, and sample images.