JNI Classes
Complete class reference for the Perfectly Clear Java JNI API
This page documents all public classes in the photos.eyeq.pfcsdk.perfectlyclear package.
PfC
The main SDK interface class. Provides engine management, image analysis, correction, and scene detection.
public class PfCEngine lifecycle
createEngine
Creates a native engine instance.
public native ByteBuffer createEngine()Returns a ByteBuffer handle to the native engine. Reuse across multiple images; destroy when done.
destroyEngine
Releases an engine instance and all associated resources.
public native void destroyEngine(ByteBuffer engine)loadAIEngine
Loads AI models into the engine.
public native int loadAIEngine(ByteBuffer engine, int features, String binPath)| Parameter | Description |
|---|---|
engine | Engine handle from createEngine() |
features | Bitwise OR of feature flags (see below) |
binPath | Path to directory containing .pnn model files |
Feature flags:
| Flag | Value | Description |
|---|---|---|
| Scene Detection | 1 | Enable AI scene classification |
| Corrections | 2 | Enable AI-based corrections |
| FaceMesh | 32 | Enable face mesh detection |
Returns the bitwise sum of successfully loaded features.
Image processing
calc
Performs pre-analysis on an image and creates a correction profile.
public native ByteBuffer calc(
int width, int height, int stride, int pixelFormat, ByteBuffer buffer,
int widthds, int heightds, int strideds, ByteBuffer bufferds,
ByteBuffer engine, int bFastFAE, int bNoTintCalc
)| Parameter | Description |
|---|---|
width | Image width in pixels |
height | Image height in pixels |
stride | Bytes per row |
pixelFormat | Pixel format constant (e.g., PfC.PFC_PixelFormat32bppABGR) |
buffer | Direct ByteBuffer containing pixel data |
widthds | Downsampled width (0 = not used) |
heightds | Downsampled height (0 = not used) |
strideds | Downsampled stride (0 = not used) |
bufferds | Downsampled buffer (null = not used) |
engine | Engine handle |
bFastFAE | Non-zero enables fast Face Aware Exposure |
bNoTintCalc | Non-zero skips tint calculation |
Returns a profile ByteBuffer. Release with releaseProfile() when done.
apply
Applies corrections to an image using a calculated profile.
public native int apply(
int width, int height, int stride, int pixelFormat, ByteBuffer buffer,
ByteBuffer engine, ByteBuffer profile, PFCParam param
)Returns 0 on success, or a negative error code.
autoCorrect
Single-call convenience method that performs calc + apply in one step.
public native int autoCorrect(
int width, int height, int stride, int pixelFormat, ByteBuffer buffer,
int widthds, int heightds, int strideds, ByteBuffer bufferds,
PFCParam param, int bFastFAE
)releaseProfile
Releases a profile handle.
public native void releaseProfile(ByteBuffer profile)Presets and parameters
readPresets
Loads the first preset from a .preset file into a parameter object.
public native int readPresets(PFCParam param, String filename)readPresetsFromStream
Loads preset settings from an in-memory XML string.
public native int readPresetsFromStream(PFCParam param, String xml)applyStrengthToParam
Applies an overall strength multiplier to all parameters.
public native int applyStrengthToParam(PFCParam param, int strength)| Strength | Effect |
|---|---|
| 0 | Disables corrections |
| 100 | Default (no change) |
| 200 | Maximum strength |
Scene detection
loadScenePresets
Loads scene presets from a memory-mapped .preset file.
public native int loadScenePresets(ByteBuffer engine, MappedByteBuffer scenePresets)getDetectedScene
Returns the detected scene label from a profile.
public native int getDetectedScene(ByteBuffer profile)getSceneDescription
Returns a human-readable scene description.
public native String getSceneDescription(ByteBuffer engine, int index, int[] profileUUID)The profileUUID array receives the scene's profile UUID at index 0.
readScenePreset
Fills a parameter object with settings for a detected scene.
public native int readScenePreset(PFCParam param, ByteBuffer engine, int scene)Face detection
fbFaceCount
Returns the number of faces detected for Face Beautification.
public native int fbFaceCount(ByteBuffer profile)getFaceInfo
Copies face geometry into a FaceInfo object.
public native boolean getFaceInfo(ByteBuffer profile, FaceInfo info, int index)faeFaceCount
Returns the number of faces detected for Face Aware Exposure.
public native int faeFaceCount(ByteBuffer profile)getFAEFaceRect
Copies detailed face data into a PFCFaceRect object.
public native boolean getFAEFaceRect(ByteBuffer profile, PFCFaceRect rect, int index)hasFaceBeautification
Returns whether Face Beautification models are loaded.
public native boolean hasFaceBeautification(ByteBuffer engine)Status methods
profileStatus
Returns the aggregated pre-calc status bitmask.
public native int profileStatus(ByteBuffer profile)coreStatus
Returns the core correction status.
public native int coreStatus(ByteBuffer profile)fbStatus
Returns the Face Beautification status.
public native int fbStatus(ByteBuffer profile)nrStatus
Returns the noise reduction status.
public native int nrStatus(ByteBuffer profile)reStatus / getREStatus
Returns the red-eye detection status.
public native int reStatus(ByteBuffer profile)
public native int getREStatus(ByteBuffer profile)abnormalTintDetected
Returns whether abnormal tint was detected.
public native boolean abnormalTintDetected(ByteBuffer profile, int tintMethod)isNoiseDetected
Returns whether noise exceeds the preset threshold.
public native boolean isNoiseDetected(ByteBuffer profile, int noisePreset)Memory management
allocNativeBuffer
Allocates a native direct buffer.
public native ByteBuffer allocNativeBuffer(long size)freeNativeBuffer
Frees a buffer allocated with allocNativeBuffer().
public native void freeNativeBuffer(ByteBuffer buffer)Add-ons and LUTs
setAddonPath
Sets the search path for .looks files.
public native void setAddonPath(String path)releaseAddonPath
Releases resources from setAddonPath().
public native void releaseAddonPath()loadAddonLooks
Loads creative looks from a memory-mapped .looks file.
public native int loadAddonLooks(ByteBuffer engine, MappedByteBuffer addonLooks)Image utilities
resize
Resizes an image buffer using native bilinear scaling.
public native int resize(
int widthSrc, int heightSrc, int strideSrc, int pixelFormatSrc, ByteBuffer bufferSrc,
int widthDst, int heightDst, int strideDst, int pixelFormatDst, ByteBuffer bufferDst
)| Parameter | Description |
|---|---|
widthSrc | Source image width in pixels |
heightSrc | Source image height in pixels |
strideSrc | Source image stride in bytes |
pixelFormatSrc | Source pixel format constant |
bufferSrc | Direct ByteBuffer containing source pixel data |
widthDst | Destination image width in pixels |
heightDst | Destination image height in pixels |
strideDst | Destination image stride in bytes |
pixelFormatDst | Destination pixel format (should match source or be PFC_PixelFormat24bppBGR) |
bufferDst | Direct ByteBuffer for destination pixel data |
Returns 0 on success.
transposeExif
Transposes an image buffer according to an EXIF orientation tag.
public native int transposeExif(
int width, int height, int stride, int pixelFormat, ByteBuffer buffer,
int exifOrientation
)| Parameter | Description |
|---|---|
width | Image width in pixels |
height | Image height in pixels |
stride | Image stride in bytes |
pixelFormat | Pixel format constant |
buffer | Direct ByteBuffer holding pixel data (modified in place) |
exifOrientation | EXIF orientation tag value (1–8). Use negative values to reverse (upright to orientation). |
Returns 0 on success.
Utility
getVersion
Returns the SDK version string.
public native String getVersion()Return code helpers
Helper methods to extract status bytes from combined return codes.
public int NRRETCODE(int code) // Noise reduction byte
public int CORERETCODE(int code) // Core correction byte
public int FBRETCODE(int code) // Face beautification byte
public int RERETCODE(int code) // Red-eye byteConstants
Pixel formats
| Constant | Value | Description |
|---|---|---|
PFC_PixelFormat24bppRGB | 0 | 24-bit RGB |
PFC_PixelFormat24bppBGR | 1 | 24-bit BGR |
PFC_PixelFormat32bppABGR | 2 | 32-bit ABGR |
PFC_PixelFormat48bppRGB | 3 | 48-bit RGB |
PFC_PixelFormat64bppARGB | 4 | 64-bit ARGB |
PFC_PixelFormat32bppARGB | 5 | 32-bit ARGB |
PFC_PixelFormat48bppBGR | 6 | 48-bit BGR |
PFC_PixelFormat64bppABGR | 7 | 64-bit ABGR |
Preset IDs
| Constant | Value | Description |
|---|---|---|
PRESET_BEAUTIFY | 0 | Portrait defaults |
PRESET_BEAUTIFYPLUS | 1 | Stronger portrait |
PRESET_DETAILS | 2 | Legacy iAuto Details |
PRESET_VIVID | 3 | Landscapes |
PRESET_INTELLIGENTAUTO | 4 | Legacy |
PRESET_I_AUTO_2019 | 5 | iAuto 2019 |
PRESET_I_AUTO_2019_RE | 6 | iAuto 2019 + Red Eye |
PRESET_I_AUTO_21 | 7 | iAuto 2021 |
PRESET_I_AUTO_21_ASIA | 8 | iAuto 2021 Asia |
PRESET_I_AUTO_PEOPLE | 9 | Default 2023 |
Contrast modes
| Constant | Value |
|---|---|
HIGH_CONTRAST | 0 |
HIGH_DEFINITION | 1 |
Tint correction modes
| Constant | Value |
|---|---|
TINT_CORRECT_AGGRESSIVE | 0 |
TINT_CORRECT_DEFAULT | 1 |
TINT_CORRECT_CONSERVATIVE | 2 |
TINT_CORRECT_SPECIAL | 3 |
DCF modes
| Constant | Value |
|---|---|
DCF_STANDARD | 0 |
DCF_VIVID | 1 |
Aggressiveness levels
| Constant | Value |
|---|---|
AGGRESSIVENESS_CONSERVATIVE | 0 |
AGGRESSIVENESS_MODERATE | 1 |
AGGRESSIVENESS_AGGRESSIVE | 2 |
Bias modes
| Constant | Value |
|---|---|
BIAS_NONE | 0 |
BIAS_ASIAN_PREFERENCE | 1 |
BIAS_AVERAGE_PREFERENCE | 2 |
BIAS_BRIGHTER_PREFERENCE | 3 |
Skin modes
| Constant | Value |
|---|---|
SKIN_MODE_FACE | 1 |
SKIN_MODE_BODY | 2 |
Skin smooth types
| Constant | Value |
|---|---|
SKIN_SMOOTH_TYPE_SUBTLE | 1 |
SKIN_SMOOTH_TYPE_DEFAULT | 2 |
SKIN_SMOOTH_TYPE_SUPER_SMOOTH | 3 |
Skin toning types
| Constant | Value |
|---|---|
SKIN_TONING_TYPE_WHITE | 1 |
SKIN_TONING_TYPE_PALE | 2 |
SKIN_TONING_TYPE_WARM | 3 |
SKIN_TONING_TYPE_TAN | 4 |
SKIN_TONING_TYPE_FOUNDATION | 5 |
Lip sharpen types
| Constant | Value |
|---|---|
LIP_SHARPEN_TYPE_FINE | 1 |
LIP_SHARPEN_TYPE_MEDIUM | 2 |
LIP_SHARPEN_TYPE_COARSE | 3 |
PFCParam
Image processing parameters. Mirrors the native PFCPARAM structure.
public class PFCParamField names follow the convention group_fieldName where group is:
core_— Core correction parametersnr_— Noise reduction parametersfb_— Face beautification parametersre_— Red-eye parametersv3_— V3 advanced parameters
Constructor
public PFCParam()Creates a parameter object with default values (all corrections disabled).
Core correction parameters
| Field | Type | Description |
|---|---|---|
core_bEnabled | boolean | Master enable |
core_iStrength | int | Exposure strength (0–150) |
core_bUseAutomaticStrengthSelection | boolean | Auto strength selection |
core_bUseFAE | boolean | Face Aware Exposure |
core_eAggressiveness | int | Aggressiveness level |
core_bContrast | boolean | Enable contrast |
core_iContrast | int | Contrast level (0–100) |
core_eContrast | int | Contrast type |
core_bVibrancy | boolean | Enable vibrancy |
core_iVibrancy | int | Vibrancy level (0–100) |
core_bSharpen | boolean | Enable sharpening |
core_fSharpenScale | float | Sharpen scale (0.0–3.0) |
core_bHighlightPreservation | boolean | Enable highlight preservation |
core_iHighlightPreservation | int | Highlight level (0–100) |
core_bLocalContrast | boolean | Enable local contrast |
core_iLocalContrast | int | Local contrast level (0–100) |
core_bAbnormalTintRemoval | boolean | Enable tint removal |
core_eTint | int | Tint correction mode |
core_fTintScale | float | Tint scale (0.0–1.0) |
core_iBlackEnhancement | int | Black enhancement level |
core_eBias | int | Bias mode |
core_fBiasScale | float | Bias scale |
core_iMaxStrength | int | Maximum strength limit |
core_bInfrared | boolean | Enable infrared correction |
core_fInfrared | float | Infrared correction ratio |
core_bLightDiffusion | boolean | Enable light diffusion |
core_fLightDiffusion | float | Light diffusion level |
core_bDynamicRange | boolean | Enable dynamic range |
core_bDCF | boolean | Enable DCF |
core_eDCFMode | int | DCF mode |
core_fDCF | float | DCF level (0.0–1.0) |
core_bSkintoneAuto | boolean | Auto skin tone |
core_iSkintoneAutoStrength | int | Auto skin tone strength |
core_iSkintoneStrengthExposure | int | Skin tone exposure strength |
core_iSkintoneStrengthLut | int | Skin tone LUT strength |
core_iSkintoneType | int | Skin tone category |
core_bSelectiveColor | boolean | Enable selective color |
core_oSelectiveColor | SelectiveColor[] | Array of 8 selective color entries |
core_iSplitColorWarm | int | Split toning warm value |
core_iSplitColorCold | int | Split toning cold value |
iMinStrength | int | Minimum strength |
Noise reduction parameters
| Field | Type | Description |
|---|---|---|
nr_bEnabled | boolean | Master enable |
nr_iPreset | int | Preset level (0–4) |
nr_iStrengthOffset | int | Strength offset (-5 to 5) |
nr_iDetailOffset | int | Detail offset (-30 to 30) |
Face beautification parameters
| Field | Type | Description |
|---|---|---|
fb_bEnabled | boolean | Master enable |
fb_bSmooth | boolean | Enable skin smoothing |
fb_iSmoothLevel | int | Smooth level (0–100) |
fb_bEnlarge | boolean | Enable eye enlargement |
fb_iEnlargeLevel | int | Enlarge level (0–100) |
fb_bEnhance | boolean | Enable eye enhancement |
fb_iEnhanceLevel | int | Enhance level (0–100) |
fb_bEyeCirc | boolean | Enable eye circle removal |
fb_iEyeCirc | int | Eye circle level (0–100) |
fb_bTeeth | boolean | Enable teeth whitening |
fb_iTeethLevel | int | Teeth level (0–100) |
fb_bBlemish | boolean | Enable blemish removal |
fb_iBlemish | int | Blemish level (0–100) |
fb_bDeFlash | boolean | Enable shine removal |
fb_iDeFlash | int | Deflash level (0–100) |
fb_bDepthVolume | boolean | Enable Depth and Volume |
fb_iDepthVolume | int | Depth and Volume level (0–100) |
fb_iSmoothMode | int | No longer used |
fb_iSmoothType | int | No longer used |
fb_bSlim | boolean | No longer used |
fb_iSlim | int | No longer used |
fb_bCatchLight | boolean | No longer used |
fb_iCatchLight | int | No longer used |
fb_iCatchLightMode | int | No longer used |
fb_iSkinToningMode | int | No longer used |
fb_iSkinToningType | int | No longer used |
fb_bLipSharpen | boolean | No longer used |
fb_iLipSharpen | int | No longer used |
fb_iLipSharpenType | int | No longer used |
fb_bBlush | boolean | No longer used |
fb_iBlush | int | No longer used |
fb_colorSkinToning | long | No longer used |
fb_colorBlush | long | No longer used |
Red-eye parameters
| Field | Type | Description |
|---|---|---|
re_bEnabled | boolean | Enable red-eye removal |
V3 advanced parameters
| Field | Type | Description |
|---|---|---|
v3_bPreprocessEV | boolean | Enable EV preprocessing |
v3_iPreprocessEV | int | Preprocess EV value |
v3_iNeutralDensity | int | Neutral density |
v3_iColorVibrancy | int | Color vibrancy (0–200) |
v3_iDarkSkin | int | Dark skin correction |
v3_lutInputCorrectiveGUID | String | Input corrective LUT GUID |
v3_lutInputCorrectiveStrength | int | Input corrective LUT strength |
v3_lutInputSkyGUID | String | Input sky LUT GUID |
v3_lutInputSkyStrength | int | Input sky LUT strength |
v3_lutInputFoliageGreenGUID | String | Input foliage green LUT GUID |
v3_lutInputFoliageGreenStrength | int | Input foliage green LUT strength |
v3_lutInputFoliageBrownGUID | String | Input foliage brown LUT GUID |
v3_lutInputFoliageBrownStrength | int | Input foliage brown LUT strength |
v3_lutOutputGUID | String | Output LUT GUID |
v3_lutOutputStrength | int | Output LUT strength (0–200) |
v3_iFinishTemp | int | Temperature (-100 to 100) |
v3_iFinishTint | int | Tint (-100 to 100) |
v3_iFinishExposure | int | Exposure (-100 to 100) |
v3_iFinishBlacks | int | Blacks (-100 to 100) |
v3_iFinishShadows | int | Shadows (-100 to 100) |
v3_iFinishHighlights | int | Highlights (-100 to 100) |
v3_iFinishWhites | int | Whites (-100 to 100) |
v3_iFinishSaturation | int | Saturation (-100 to 100) |
v3_iFinishVibrancy | int | Vibrancy (-100 to 100) |
v3_iFinishContrast | int | Contrast (-100 to 100) |
v3_iFinishPositiveContrast | int | Positive contrast |
v3_iDeltaR | int | Red channel delta |
v3_iDeltaG | int | Green channel delta |
v3_iDeltaB | int | Blue channel delta |
v3_bDynamic | boolean | Enable dynamic correction |
v3_iDynamic | int | Dynamic strength (0–100) |
v3_iDynamicWB | int | Dynamic white balance (0–100) |
v3_iOutLUTsaturation | int | Output LUT saturation |
v3_iOutLUTcontrast | int | Output LUT contrast |
v3_bPortraitLight | boolean | Enable portrait light |
v3_iPortraitLight | int | Portrait light strength |
v3_iPortraitLightDepth | int | Portrait light depth |
v3_iPortraitLightFeather | int | Portrait light feather |
PFCImageFile
Helper class for loading and saving images with metadata and color space handling.
public class PFCImageFileProperties
| Property | Type | Description |
|---|---|---|
width | int | Image width in pixels |
height | int | Image height in pixels |
stride | int | Bytes per row |
bytes_per_pixel | int | Bytes per pixel |
pixelFormat | int | Pixel format constant |
sourceSRGB | boolean | True if source is sRGB |
Constructor
public PFCImageFile()Creates an empty image wrapper.
Methods
LoadImageFile
Loads an image from disk.
public ByteBuffer LoadImageFile(String filename)
public ByteBuffer LoadImageFile(String filename, boolean convertToSRGB)
public ByteBuffer LoadImageFile(String filename, boolean convertToSRGB, String supportPath)| Parameter | Description |
|---|---|
filename | Path to image file |
convertToSRGB | Convert to sRGB color space (default: true) |
supportPath | Path to ICC profiles folder (optional) |
Returns a ByteBuffer containing pixel data.
SaveImageFile
Saves the image to disk.
public boolean SaveImageFile(String filename)
public boolean SaveImageFile(String filename, int quality)
public boolean SaveImageFile(String filename, int quality, boolean convertToOriginal)
public boolean SaveImageFile(String filename, int quality, boolean convertToOriginal, boolean embedMetadata)| Parameter | Description |
|---|---|
filename | Output path |
quality | JPEG quality 0–100 (default: 90). For PNGs, 100 = no compression. |
convertToOriginal | Convert back to original color space (default: true) |
embedMetadata | Preserve original metadata (default: true) |
Returns true on success.
deletePFCImageFile
Releases native resources.
public void deletePFCImageFile()PFCFaceRect
Face detection result with geometry and attributes. Used by PfC.getFAEFaceRect().
public class PFCFaceRectProperties
Face bounding box:
| Property | Type | Description |
|---|---|---|
faceLeft | int | Left edge |
faceTop | int | Top edge |
faceWidth | int | Width |
faceHeight | int | Height |
Eye geometry:
| Property | Type | Description |
|---|---|---|
eyeLLeft, eyeLTop, eyeLWidth, eyeLHeight | int | Left eye bounding box |
eyeRLeft, eyeRTop, eyeRWidth, eyeRHeight | int | Right eye bounding box |
eyeLX, eyeLY | int | Left eye center |
eyeRX, eyeRY | int | Right eye center |
Mouth geometry:
| Property | Type | Description |
|---|---|---|
mouthLeft, mouthTop, mouthWidth, mouthHeight | int | Mouth bounding box |
Attributes:
| Property | Type | Description |
|---|---|---|
angle | int | Face roll angle |
yawAngle | int | Face yaw angle (-90 to 90) |
blinkLevel | int | Overall blink level |
blinkLevelL | int | Left eye blink |
blinkLevelR | int | Right eye blink |
confidence | int | Detection confidence |
smileLevel | int | Smile intensity |
widthImage | int | Source image width |
heightImage | int | Source image height |
Detection levels use the convention: -1 = not detected, 0 = unable to detect, 1–100 = confidence level.
FaceInfo
Simplified face geometry for Face Beautification. Used by PfC.getFaceInfo().
public class FaceInfoProperties
| Property | Type | Description |
|---|---|---|
face_left | int | Left edge of face |
face_top | int | Top edge of face |
face_width | int | Face width |
face_height | int | Face height |
leftEye_x | int | Left eye X |
leftEye_y | int | Left eye Y |
rightEye_x | int | Right eye X |
rightEye_y | int | Right eye Y |
SelectiveColor
Per-hue color adjustment. Eight instances populate PFCParam.core_oSelectiveColor.
public class SelectiveColorProperties
| Property | Type | Range | Description |
|---|---|---|---|
r | int | Hue ramp start | |
a | int | Flat range start | |
m | int | Flat range end | |
p | int | Hue ramp end | |
H | int | -180 to 180 | Hue shift |
S | int | -100 to 100 | Saturation shift |
L | int | -100 to 100 | Luminance shift |
PFC-SDK Version 11.0.0.1389 built from cc658dab3c675a529b3df2fa6421d4550810d77d on 06-29-2026.
Copyright © 2026 EyeQ Imaging Inc. All rights reserved.