We ended up using a global object but that’s okay in our case. Funny enough we can now pass lambdas to the function which is quite nice 
HAL_JPEG_RegisterInfoReadyCallback(corejpeg.getJpegHandle(), [](JPEG_HandleTypeDef *hjpeg, JPEG_ConfTypeDef *info) {
corejpeg.onInfoReadyCallback(hjpeg, info);
});
HAL_JPEG_RegisterGetDataCallback(corejpeg.getJpegHandle(), [](JPEG_HandleTypeDef *hjpeg, uint32_t size) {
corejpeg.onDataAvailableCallback(hjpeg, size);
});
HAL_JPEG_RegisterDataReadyCallback(corejpeg.getJpegHandle(),
[](JPEG_HandleTypeDef *hjpeg, uint8_t *pDataOut, uint32_t size) {
corejpeg.onDataReadyCallback(hjpeg, pDataOut, size);
});
HAL_JPEG_RegisterCallback(corejpeg.getJpegHandle(), HAL_JPEG_DECODE_CPLT_CB_ID,
[](JPEG_HandleTypeDef *hjpeg) { corejpeg.onDecodeCompleteCallback(hjpeg); });
HAL_JPEG_RegisterCallback(corejpeg.getJpegHandle(), HAL_JPEG_ERROR_CB_ID,
[](JPEG_HandleTypeDef *hjpeg) { corejpeg.onErrorCallback(hjpeg); });