CR2 to Tiff conversion produces darker image

I have a .CR2 image taken by a Canon 80D camera. I'm using LibRaw to convert it to a .TIF. The .TIF which is created is darker than the original .CR2 file (when viewed using Canon's Digital Photo Professional or Irfan View)

I read the contents of the .CR2 file to a buffer, then pass the buffer to this method to convert and save to .TIF:

void raw2image_concise(const char* data, size_t length)
{
    LibRaw rawProcessor;
    rawProcessor.imgdata.params.output_tiff = 1;                       // tiff
    rawProcessor.imgdata.params.output_bps = 16;                       // bits per sample: 8 or 16 only, other values are invalid
    rawProcessor.imgdata.params.no_auto_bright = 1;                    // when disabled, image is too bright, when enabled, too dark?
    rawProcessor.imgdata.params.use_auto_wb = 0;
    rawProcessor.imgdata.params.use_camera_wb = 1;
    rawProcessor.imgdata.params.use_camera_matrix = 1;
    rawProcessor.imgdata.params.user_flip = 0;                         // no rotation
    rawProcessor.imgdata.params.user_qual = 3;                         // AHD interpolation
 
    rawProcessor.open_buffer((void*)data, length);
    rawProcessor.unpack();
    rawProcessor.dcraw_process();
    rawProcessor.dcraw_ppm_tiff_writer("test.tif");
}

I'd like to know if there's a way I can use LibRaw that won't result in a darker or brighter image.

I've also tried converting the .CR2 to .TIF using Digital Photo Professional and Irfan View, and the files these create lose any brightness.

I can provide the source .CR2, the .Tif that LibRaw creates, and the .Tif files created by Digital Photo Professional and Irfan View if that will help.

Forums: 

typo correction

I've also tried converting the .CR2 to .TIF using Digital Photo Professional and Irfan View, and the files these create don't lose any brightness.

-shawn