Port jpeg_mem_dest for in-memory operations