time_elapsed = 0;
n_images		= 1000;
rawdata		= uint16(rand(1024,1024)*(2^12-1));
for idx = 1 : n_images	
	fname		= sprintf('test/im%04d.raw', idx);
	
	tic;
	%fid		= fopen(fname, 'w');
	%fwrite(fid, rawdata, 'ubit12');
	%fclose(fid);
	imwrite_raw12(fname, rawdata);
	
	time_elapsed = time_elapsed + toc;
end

fprintf('took %0.2fs to save %d images (%0.2f fps)\n', time_elapsed, n_images, n_images/time_elapsed);
