logo
On this page

Configure device performance levels


Introduction

Al Effects supports configuring the device level on which the SDK runs, and can ensure the smooth and stable operation of AI Face beautification by configuring different Face beautification effects on devices with different performance levels. This is mainly used when the device performance is not sufficient to run advanced effects smoothly, and the goal of smooth operation is achieved by reducing the effects of some effects.

Device Performance LevelEnumerationEffect Difference
Low LevelZegoEffectsDeviceLevelLow = 1Skin smoothing effect is average, skin color replacement effect is average, beauty makeups effect is average; acne and blemish removal effect is average
High LevelZegoEffectsDeviceLevelHigh = 3Skin smoothing effect is good, skin color replacement effect is good, beauty makeups effect is good; acne and blemish removal effect is good
Note

If the developer does not configure the device performance level actively, the default device performance level is ZegoEffectsDeviceLevelHigh, which is the device of high performance level.

Steps to Use

  1. (Optional) Use getDeviceLevel to get the current device performance level.

    Untitled
    ZegoEffectsDeviceLevel deviceLevel = [ZegoEffects getDeviceLevel];
    
    1
    Copied!
  2. Before calling the create interface to create a ZegoEffects object, pass the device performance level to the SDK through setAdvancedConfig to run the corresponding AI Face beautification effects based on the device performance level.

    Untitled
    // Get the device performance level
    ZegoEffectsAdvancedConfig *config = [ZegoEffectsAdvancedConfig alloc];
    ZegoEffectsDeviceLevel deviceLevel = ZegoEffects.getDeviceLevel;
    // If you want to experience the difference in performance, you can also ignore the actual device performance level and forcibly set it to another performance level as shown in the example below
    // Note: Devices of low performance level can run Face beautification effects of high performance level devices, but there may be lag.
    // ZegoEffectsDeviceLevel deviceLevel = ZegoEffectsDeviceLevel.ZegoEffectsDeviceLevelMiddle;
    
    NSMutableDictionary<NSString *, NSString *> *mutableAdvancedConfig = [config.advancedConfig mutableCopy];
    //ZEGO_EFFECTS_DEVICE_LEVEL is a parameter for advanced configuration, which can be viewed in ZegoEffects.h
    [mutableAdvancedConfig setObject:[NSString stringWithFormat:@"%ld", deviceLevel] forKey:ZEGO_EFFECTS_DEVICE_LEVEL];
    config.advancedConfig = [NSMutableDictionary dictionaryWithDictionary:mutableAdvancedConfig];
    [ZegoEffects setAdvancedConfig:config];
    
    1
    Copied!

Previous

Implement Basic Image Processing

Next

Face Beautification