MeiCam SDK For iOS  3.1.0
Usage Explanation for EffectSDK

Meishe effectSDK is used as follows:

The NvsEffectSdkContext class can be thought of as the entry to the entire SDK framework. During development, NvsEffectSdkContext provides a static interface sharedInstance to create the unique instance of "effectSDK" context. With this instance object, users can handle one or more effects. After using, the object instance of the effect context should be destroyed. In order to add asset package (capture effect package, scene resource package, etc.), users must firstly install it and then get the corresponding packageId as the handle for further use, while the handle of built-in capture effect is just its name.
Input parameters, such as resource path, license path, of SDK interfaces must be full path.

In the NvsEffectSdkContext class, all public APIs are used in the UI thread! ! !
In the NvsEffectRenderCore class, all public APIs are used in OpenGL threads! ! !
  1. Initialize the EffectSDK. EffectSDK only need to be initialized once. The NvsEffectSdkContext is the context class of the effect. "context" is the Android Context object,"sdkLicenseFilePath" is the authorization file path and "flags" is the flag field. If there is no special requirement, please fill in 0.
    NvsEffectRenderCore is the effect rendering entry for the entire SDK of the effects rendering class. All public APIs must be used in OpenGL threads! ! !
    Initialization code:
            NSString *licPath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"3-2-3d2c1a947b969a7f7ef4e2eb380c8f44.lic"];
            if (![NvsEffectSdkContext verifySdkLicenseFile:licPath]) {
                NSLog(@"Invalid license!");
            self.renderCore = [self.effectContext createEffectRenderCore];
  2. Create a video effect object.
    "fxIds" is a special effects id. For built-in video effects, it is the name of the effect. If it is a resource package effect, it is the resource package id. "aspectRatio" is the aspect ratio of the effect. Video effects can be added at the same time and used together.
    The class of NvsVideoEffect is a derived class of NvsEffect,users can use it to add, remove and retrieve video effects.
    The corresponding code is as follows:
            NvsEffectRational aspectRatio = {9, 16};
            self.faceEffect = [self.effectContext createVideoEffect:@"Specific Warp Effect" aspectRatio:aspectRatio];
  3. Set the relevant parameters of the effect. "fxParam" is the corresponding parameter name and "val" is the value of the parameter.
    The corresponding code is as follows:
                        [self.faceEffect setFloatVal:"Saturation" val:0];//Saturation
                        [self.faceEffect setFloatVal:"Brightness" val:0];//Brightness
                        [self.faceEffect setFloatVal:"Contrast" val:0];  //Contrast
  4. In addition to the built-in effects, there are external effects that require the installation of resource packages. "assetPackageFilePath" is the path to the resource packages and must be full path. "licenseFilePath" is the license file path. If there is no license, null could be passed in instead. "type" is the type of resource packages.
    "synchronous" is the standard for synchronization. The "assetPackageId" is the resource package id after installation.
    The corresponding code is as follows:
            NSString *fxPackagePath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"D41B1BC6-23AC-4508-9C8A-F6430BB37C3F.videofx"];
            self.assetPackageId = [[NSMutableString alloc] init];
            NvsEffectAssetPackageManagerError err = [self.effectContext.assetPackageManager installAssetPackage:fxPackagePath license:nil type:NvsEffectAssetPackageType_VideoFx sync:YES assetPackageId:self.assetPackageId];
            if (err != NvsEffectAssetPackageManagerError_NoError
                && err != NvsEffectAssetPackageManagerError_AlreadyInstalled) {
                NSLog(@"Failed to install package!");
  5. After using, users need to destroy the video effects and clear the OpenGL resources cached in the effect. The "effect" represents the effect object to be cleared.
    The corresponding code is as follows:
            [self.renderCore clearCacheResources];
            [self.renderCore clearEffectResources:self.effect];
            [self.renderCore cleanUp];

Destroy when exit. The corresponding code is as follows:

        [NvsEffectSdkContext destroyInstance];