Getting closer to in camera conversion (Sony)

My Sony is set to store both ARW and JPG. I'd like to be able to read the ARW into a program's memory and get closer to matching the JPG but with more bits per value. Currently, the best I've managed is slightly washed out and very slightly grainy compared to the JPG. There are also apparent differences in interpolation (such as thin dark lines wider in what I read from ARW vs. JPG).

I'm trying to write fairly general code for a stitching program, rather than fix an individual photo (so the exif dump below is given as an example of what kind of data is there, not for specific values).

My current code is:

	auto& p = libRaw->imgdata.params;
	p.output_bps = 16;
	p.user_flip = 0;
	p.output_color = 1;
	p.no_auto_bright = 1;
	p.use_camera_wb = 1;
	p.use_camera_matrix = 3;
	libRaw->unpack();
	libRaw->dcraw_process();
	auto* im = libRaw->dcraw_make_mem_image(&status);

Does any of the Exif data guide me in setting parameters to match what the camera did?

ExifTool Version Number         : 12.42
File Name                       : DSC00215.ARW
Directory                       : D:/Share/FTP/12120214
File Size                       : 25 MB
File Modification Date/Time     : 2022:02:14 09:35:10-05:00
File Access Date/Time           : 2022:06:27 00:04:18-04:00
File Creation Date/Time         : 2022:04:24 09:55:57-04:00
File Permissions                : -rw-rw-rw-
File Type                       : ARW
File Type Extension             : arw
MIME Type                       : image/x-sony-arw
Exif Byte Order                 : Little-endian (Intel, II)
Image Description               :
Orientation                     : Rotate 90 CW
Image Width                     : 6048
Image Height                    : 4024
Bits Per Sample                 : 14
Compression                     : Sony ARW Compressed
Photometric Interpretation      : Color Filter Array
Samples Per Pixel               : 1
Planar Configuration            : Chunky
X Resolution                    : 350
Y Resolution                    : 350
Resolution Unit                 : inches
CFA Repeat Pattern Dim          : 2 2
CFA Pattern 2                   : 0 1 1 2
Sony Raw File Type              : Sony Compressed RAW
Sony Tone Curve                 : 8000 10400 12900 14100
Strip Offsets                   : 974848
Rows Per Strip                  : 4024
Strip Byte Counts               : 24337152
Chromatic Aberration Correction : Auto
Distortion Correction           : Off
Default Crop Origin             : 12 12
Default Crop Size               : 6000 4000
Sony Crop Top Left              : 12 12
Sony Crop Size                  : 6000 4000
Preview Image Start             : 139426
Preview Image Length            : 832178
Y Cb Cr Positioning             : Co-sited
Exposure Time                   : 1/160
F Number                        : 2.8
ISO                             : 160
Sensitivity Type                : Recommended Exposure Index
Recommended Exposure Index      : 160
Exif Version                    : 0231
Date/Time Original              : 2022:02:14 14:35:10
Create Date                     : 2022:02:14 14:35:10
Offset Time                     : -05:00
Offset Time Original            : -05:00
Offset Time Digitized           : -05:00
Components Configuration        : Y, Cb, Cr, -
Compressed Bits Per Pixel       : 8
Brightness Value                : 6.23203125
Exposure Compensation           : +0.7
Max Aperture Value              : 2.8
Metering Mode                   : Spot
Light Source                    : Unknown
Flash                           : Off, Did not fire
Focal Length                    : 105.0 mm
Rating                          : 0
Brightness                      : 0
Long Exposure Noise Reduction   : On (unused)
High ISO Noise Reduction        : Off
HDR                             : Off; Uncorrected image
WB Shift AB GM                  : 0 0
WB Shift AB GM Precise          : 0.00 0.00
Face Info Offset                : 94
Sony Date Time                  : 2022:02:14 14:35:10
Sony Image Width                : 6000
Faces Detected                  : 1
Face Info Length                : 37
Meta Version                    : DC7303320222000
Face 1 Position                 : 319 2044 225 225
Creative Style                  : Standard
Color Temperature               : Auto
Color Compensation Filter       : 0
Scene Mode                      : Standard
Zone Matching                   : ISO Setting Used
Dynamic Range Optimizer         : Off
Image Stabilization             : On
Color Mode                      : Standard
Full Image Size                 : 6000x4000
Preview Image Size              : 1616x1080
File Format                     : ARW 2.3.5
Flash Exposure Compensation     : 0
White Balance Fine Tune         : 0
White Balance                   : Auto
Sony Model ID                   : ILCE-7M3
Multi Frame Noise Reduction     : Off
Picture Effect                  : Off
Soft Skin Effect                : Off
Vignetting Correction           : Auto
Lateral Chromatic Aberration    : Auto
Distortion Correction Setting   : Off
Lens Type                       : E-Mount, T-Mount, Other Lens or no lens
Lens Spec                       : E 105mm F2.8
Auto Portrait Framed            : No
Flash Action                    : Did not fire
Electronic Front Curtain Shutter: On
Focus Mode                      : Manual
AF Area Mode Setting            : Flexible Spot
Flexible Spot Position          : 320 240
AF Point Selected               : n/a
AF Points Used                  : (none)
AF Tracking                     : Off
Focal Plane AF Points Used      : 0
Multi Frame NR Effect           : Normal
Focus Location                  : 6000 4000 3000 2000
Variable Low Pass Filter        : n/a
Priority Set In AWB             : Standard
Metering Mode 2                 : Spot (Standard)
Exposure Standard Adjustment    : 0
RAW File Type                   : Compressed RAW
Quality                         : RAW + Extra Fine
Pixel Shift Info                : n/a
Flash Level                     : Normal
Release Mode                    : Normal
Sequence Number                 : Single
Anti-Blur                       : On (Shooting)
Sequence Image Number           : 1
Sequence File Number            : 1
Sequence Length                 : 1 file
Camera Orientation              : Rotate 90 CW
Quality 2                       : RAW + JPEG
Sony Image Height               : 4000
Model Release Year              : 2017
ISO Setting                     : Auto
ISO Auto Min                    : 100
ISO Auto Max                    : 12800
Ambient Temperature             : 15 C
AF Area Mode                    : Flexible Spot
Focus Position 2                : 196
Camera Temperature              : 17 C
Exposure Program                : Manual
Intelligent Auto                : Off
Sony ISO                        : 176
Base ISO                        : 100
Stops Above Base ISO            : 0.8
Sony Exposure Time 2            : 1/161
Sony Max Aperture Value         : 2.9
Sony Image Width Max            : 6024
Sony Image Height Max           : 4024
Picture Effect 2                : Off
Lens Zoom Position              : 0%
Battery Temperature             : 36.1 C
Battery Level                   : 73%
Lens Mount 2                    : E-mount
Lens Type 3                     : Sigma 105mm F2.8 DG DN MACRO | A
Camera E-mount Version          : 1.70
Lens E-mount Version            : 1.60
Lens Firmware Version           : Ver.01.001
Tiff Metering Image Width       : 44
Tiff Metering Image Height      : 30
Tiff Metering Image             : (Binary data 2640 bytes, use -b option to extract)
Release Mode 3                  : Normal
Self Timer                      : Off
Flash Mode                      : Rear Sync
HDR Setting                     : Off
Picture Profile                 : Gamma Still - Standard/Neutral (PP2)
WB RGB Levels                   : 652 256 376
Min Focal Length                : 105.0 mm
Distortion Corr Params Number   : 16 (Full-frame)
Shutter                         : Mechanical (2685 5194 6519)
Flash Status                    : No Flash present
Shutter Count                   : 224
Sony Exposure Time              : 1/161
Sony F Number                   : 2.9
Shutter Count 2                 : 224
Release Mode 2                  : Normal
Internal Serial Number          : 7aff00004509
Lens Mount                      : E-mount
Lens Format                     : Full-frame
Lens Type 2                     : Sigma 105mm F2.8 DG DN MACRO | A
Distortion Corr Params Present  : Yes
Lens Spec Features              : E
Shutter Count 3                 : 224
APS-C Size Capture              : Off
User Comment                    :
Flashpix Version                : 0100
Color Space                     : sRGB
Exif Image Width                : 6000
Exif Image Height               : 4000
Interoperability Index          : R98 - DCF basic file (sRGB)
Interoperability Version        : 0100
File Source                     : Digital Camera
Scene Type                      : Directly photographed
Custom Rendered                 : Normal
Exposure Mode                   : Manual
Digital Zoom Ratio              : 1
Focal Length In 35mm Format     : 105 mm
Scene Capture Type              : Standard
Contrast                        : Normal
Saturation                      : Normal
Sharpness                       : Normal
Lens Info                       : 105mm f/2.8
Lens Model                      : 105mm F2.8 DG DN MACRO | Art 020
GPS Version ID                  : 2.3.0.0
GPS Status                      : Measurement Void
GPS Map Datum                   : WGS-84
GPS Differential                : No Correction
PrintIM Version                 : 0300
SR2 Sub IFD Offset              : 55592
SR2 Sub IFD Length              : 42826
SR2 Sub IFD Key                 : 0x44332211
Black Level                     : 512 512 512 512
WB RGGB Levels Auto             : 2604 1024 1024 1512
WB RGGB Levels                  : 2604 1024 1024 1512
Color Matrix                    : 1177 -211 91 -54 1267 -159 72 -232 1216
WB RGB Levels Daylight          : 2468 1024 1604
WB RGB Levels Cloudy            : 2668 1024 1472
WB RGB Levels Tungsten          : 1520 1024 2824
WB RGB Levels Flash             : 2712 1024 1424
WB RGB Levels 4500K             : 2228 1024 1800
WB RGB Levels Shade             : 2944 1024 1328
WB RGB Levels Fluorescent       : 2284 1024 2344
WB RGB Levels Fluorescent P1    : 2368 1024 1716
WB RGB Levels Fluorescent P2    : 2628 1024 1580
WB RGB Levels Fluorescent M1    : 1772 1024 2808
WB RGB Levels 8500K             : 3096 1024 1260
WB RGB Levels 6000K             : 2644 1024 1488
WB RGB Levels 3200K             : 1700 1024 2464
WB RGB Levels 2500K             : 1320 1024 3372
White Level                     : 15360 15360 15360
Vignetting Corr Params          : 16 0 448 912 1408 1936 2496 3088 3696 4304 4912 5520 6096 6720 7408 8208 8976
Chromatic Aberration Corr Params: 32 -256 -256 -256 -256 -256 -256 -256 -256 -256 -256 -256 -256 -256 -128 -128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -128 -256
Distortion Corr Params          : 16 2 3 6 13 23 37 53 71 90 111 131 153 173 190 204 211
Subfile Type                    : Reduced-resolution image
Make                            : SONY
Camera Model Name               : ILCE-7M3
Software                        : ILCE-7M3 v4.01
Modify Date                     : 2022:02:14 14:35:10
Thumbnail Offset                : 43338
Thumbnail Length                : 10718
Aperture                        : 2.8
Blue Balance                    : 1.476563
CFA Pattern                     : [Red,Green][Green,Blue]
Image Size                      : 6048x4024
Lens ID                         : Sigma 105mm F2.8 DG DN MACRO | A
Megapixels                      : 24.3
Preview Image                   : (Binary data 832178 bytes, use -b option to extract)
Red Balance                     : 2.542969
Scale Factor To 35 mm Equivalent: 1.0
Shutter Speed                   : 1/160
Create Date                     : 2022:02:14 14:35:10-05:00
Date/Time Original              : 2022:02:14 14:35:10-05:00
Modify Date                     : 2022:02:14 14:35:10-05:00
Thumbnail Image                 : (Binary data 10718 bytes, use -b option to extract)
Focus Distance 2                : 16.09 m
Circle Of Confusion             : 0.030 mm
Field Of View                   : 19.5 deg
Focal Length                    : 105.0 mm (35 mm equivalent: 105.0 mm)
Hyperfocal Distance             : 131.05 m
Light Value                     : 9.6

Forums: