MeiCam SDK For Android  3.10.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 NvsEffectSdkContext 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.

Warning
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:
            mEffectSdkContext = NvsEffectSdkContext.init(this, "assets:/effectsdkdemo.lic", 0);
            mEffectRenderCore = context.createEffectRenderCore();
    
  2. Create a video effect object.
    "fxIds" is the special effect 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. Multiple video effects can be added.
    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:
            NvsRational aspectRatio = new NvsRational(9, 16);
            NvsEffect effect = mEffectSdkContext.createVideoEffect("Color Property", aspectRatio);
    

3.Set the parameters related to the effect. "fxParam" is the corresponding parameter name and "val" is the value of the parameter.
The corresponding code is as follows:

                    effect.setFloatVal("Saturation", 0);//Saturation
                    effect.setFloatVal("Brightness", 0);//Brightness
                    effect.setFloatVal("Contrast", 0);//Contrast
  1. 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 returned after installation.
    The corresponding code is as follows:
            String fxPackagePath = "assets:/7CBBDCFB-4568-47FB-8A98-3A699893A043.3.videofx";
            int error = mEffectSdkContext.getAssetPackageManager().installAssetPackage(fxPackagePath, null, NvsAssetPackageManager.ASSET_PACKAGE_TYPE_VIDEOFX, true, m_fxPackageId);
            if (error != NvsAssetPackageManager.ASSET_PACKAGE_MANAGER_ERROR_NO_ERROR
                && error != NvsAssetPackageManager.ASSET_PACKAGE_MANAGER_ERROR_ALREADY_INSTALLED) {
                            Log.d(TAG, "Failed to install fx package!");
            }
    
  2. After using, users need to destroy the video effects and clear the OpenGL resources cached in the effect. The object of "effect" is that be cleared.
    The corresponding code is as follows:
            mEffectRenderCore.clearEffectResources(effect);
    
  3. Destroy when exiting. The corresponding code is as follows:
         NvsEffectSdkContext.close();