Skip to content

Commit

Permalink
Merge pull request Faceunity#34 from isuperqiang/master
Browse files Browse the repository at this point in the history
Update FaceUnity Nama SDK v7.0.1
  • Loading branch information
jdbbjd authored Jul 24, 2020
2 parents 0461ada + 6ead1bc commit af77966
Show file tree
Hide file tree
Showing 61 changed files with 417 additions and 328 deletions.
Binary file modified app/src/main/assets/effect/actiongame_android.bundle
Binary file not shown.
Binary file modified app/src/main/assets/effect/big_head/big_head.bundle
Binary file not shown.
Binary file modified app/src/main/assets/effect/big_head/big_head_facewarp2.bundle
Binary file not shown.
Binary file modified app/src/main/assets/effect/big_head/big_head_facewarp4.bundle
Binary file not shown.
Binary file modified app/src/main/assets/effect/big_head/big_head_facewarp5.bundle
Binary file not shown.
Binary file modified app/src/main/assets/effect/big_head/big_head_facewarp6.bundle
Binary file not shown.
Binary file modified app/src/main/assets/effect/big_head/big_head_smile.bundle
Binary file not shown.
Binary file modified app/src/main/assets/effect/hair_seg/hair_gradient.bundle
Binary file not shown.
Binary file modified app/src/main/assets/effect/hair_seg/hair_normal.bundle
Binary file not shown.
Binary file modified app/src/main/assets/effect/segment/boyfriend1.bundle
Binary file not shown.
Binary file modified app/src/main/assets/effect/segment/boyfriend2.bundle
Binary file not shown.
Binary file modified app/src/main/assets/effect/segment/boyfriend3.bundle
Binary file not shown.
Binary file modified app/src/main/assets/effect/segment/gufeng_zh_fu.bundle
Binary file not shown.
Binary file modified app/src/main/assets/effect/segment/hez_ztt_fu.bundle
Binary file not shown.
Binary file modified app/src/main/assets/effect/segment/ice_lm_fu.bundle
Binary file not shown.
Binary file modified app/src/main/assets/effect/segment/sea_lm_fu.bundle
Binary file not shown.
Binary file modified app/src/main/assets/effect/segment/xiandai_ztt_fu.bundle
Binary file not shown.
16 changes: 8 additions & 8 deletions app/src/main/java/com/faceunity/fulivedemo/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,24 +78,24 @@ private static List<ModuleEntity> initModuleEntity() {
List<ModuleEntity> moduleEntities = new ArrayList<>();
moduleEntities.add(new ModuleEntity(ModuleEntity.UI_TYPE_BANNER));
moduleEntities.add(new ModuleEntity(R.string.main_classification_face, ModuleEntity.UI_TYPE_CLASSIFICATION));
moduleEntities.add(new ModuleEntity(R.drawable.main_beauty, R.string.home_function_name_beauty, "9-0", Effect.EFFECT_TYPE_NONE, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.drawable.main_beauty, R.string.home_function_name_beauty, "1-0", Effect.EFFECT_TYPE_NONE, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.drawable.main_makeup, R.string.home_function_name_makeup, "524288-0", Effect.EFFECT_TYPE_NONE, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.drawable.main_effect, R.string.home_function_name_sticker, "6-0", Effect.EFFECT_TYPE_STICKER, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.drawable.main_effect, R.string.home_function_name_sticker, "110-0", Effect.EFFECT_TYPE_STICKER, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.drawable.main_animoji, R.string.home_function_name_animoji, "16-0", Effect.EFFECT_TYPE_ANIMOJI, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.drawable.main_hair, R.string.home_function_name_hair, "1048576-0", Effect.EFFECT_TYPE_NONE, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.drawable.demo_icon_texture_beauty, R.string.home_function_name_light_makeup, "0-8", Effect.EFFECT_TYPE_NONE, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.drawable.main_ar_mask, R.string.home_function_name_ar, "96-0", Effect.EFFECT_TYPE_AR_MASK, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.drawable.demo_icon_photo_sticker, R.string.home_function_name_big_head, "96-0", Effect.EFFECT_TYPE_BIG_HEAD, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.drawable.demo_icon_photo_sticker, R.string.home_function_name_big_head, "0-32768", Effect.EFFECT_TYPE_BIG_HEAD, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.drawable.main_poster_face, R.string.home_function_name_poster_face, "8388608-0", Effect.EFFECT_TYPE_NONE, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.drawable.main_expression, R.string.home_function_name_expression, "2048-0", Effect.EFFECT_TYPE_EXPRESSION_RECOGNITION, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.drawable.main_expression, R.string.home_function_name_expression, "2058-0", Effect.EFFECT_TYPE_EXPRESSION_RECOGNITION, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.drawable.main_music_fiter, R.string.home_function_name_music_filter, "131072-0", Effect.EFFECT_TYPE_MUSIC_FILTER, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.drawable.main_face_warp, R.string.home_function_name_face_warp, "65536-0", Effect.EFFECT_TYPE_FACE_WARP, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.string.main_classification_human, ModuleEntity.UI_TYPE_CLASSIFICATION));
moduleEntities.add(new ModuleEntity(R.drawable.demo_icon_body, R.string.home_function_name_beauty_body, "0-32", Effect.EFFECT_TYPE_NONE, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.drawable.demo_icon_whole_body, R.string.home_function_name_human_avatar, "0-128", Effect.EFFECT_TYPE_PTA, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.drawable.demo_icon_action, R.string.home_function_name_action_recognition, "0-32768", Effect.EFFECT_TYPE_ACTION_RECOGNITION, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.drawable.main_background, R.string.home_function_name_portrait_segment, "256-0", Effect.EFFECT_TYPE_PORTRAIT_SEGMENT, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.drawable.main_gesture, R.string.home_function_name_gesture, "512-0", Effect.EFFECT_TYPE_GESTURE_RECOGNITION, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.drawable.demo_icon_whole_body, R.string.home_function_name_human_avatar, "0-448", Effect.EFFECT_TYPE_PTA, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.drawable.demo_icon_action, R.string.home_function_name_action_recognition, "2-65536", Effect.EFFECT_TYPE_ACTION_RECOGNITION, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.drawable.main_background, R.string.home_function_name_portrait_segment, "258-0", Effect.EFFECT_TYPE_PORTRAIT_SEGMENT, ModuleEntity.UI_TYPE_MODULE));
moduleEntities.add(new ModuleEntity(R.drawable.main_gesture, R.string.home_function_name_gesture, "514-0", Effect.EFFECT_TYPE_GESTURE_RECOGNITION, ModuleEntity.UI_TYPE_MODULE));
return Collections.unmodifiableList(moduleEntities);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public abstract class FUBaseActivity extends AppCompatActivity
FURenderer.OnTrackingStatusChangedListener {
public final static String TAG = FUBaseActivity.class.getSimpleName();

protected ImageView mTopBackground;
protected GLSurfaceView mGLSurfaceView;
protected BaseCameraRenderer mCameraRenderer;
protected volatile boolean mIsDualInput = true;
Expand Down Expand Up @@ -279,8 +278,8 @@ public int onDrawFrame(byte[] cameraNv21Byte, int cameraTextureId, int cameraWid
fuTexId = mFURenderer.onDrawFrame(cameraNv21Byte, cameraWidth, cameraHeight);
}
showLandmarks();
sendRecordingData(fuTexId, mvpMatrix, texMatrix, timeStamp / Constant.NANO_IN_ONE_MILLI_SECOND);
takePicture(fuTexId, mvpMatrix, texMatrix, mCameraRenderer.getViewWidth(), mCameraRenderer.getViewHeight());
sendRecordingData(fuTexId, GlUtil.IDENTITY_MATRIX, texMatrix, timeStamp / Constant.NANO_IN_ONE_MILLI_SECOND);
takePicture(fuTexId, GlUtil.IDENTITY_MATRIX, texMatrix, cameraHeight, cameraWidth);
return fuTexId;
}

Expand All @@ -295,7 +294,8 @@ public void onCameraChanged(int cameraFacing, int cameraOrientation) {
runOnUiThread(new Runnable() {
@Override
public void run() {
mVerticalSeekBar.setProgress((int) (100 * mCameraRenderer.getExposureCompensation()));
int progress = (int) (100 * mCameraRenderer.getExposureCompensation());
mVerticalSeekBar.setProgress(progress);
}
});
}
Expand All @@ -307,6 +307,7 @@ public void run() {
public void onReadBitmapListener(Bitmap bitmap) {
// Call on async thread
final String filePath = MiscUtil.saveBitmap(bitmap, Constant.PHOTO_FILE_PATH, MiscUtil.getCurrentPhotoName());
Log.d(TAG, "onReadBitmapListener: " + filePath);
if (filePath != null) {
runOnUiThread(new Runnable() {
@Override
Expand Down Expand Up @@ -378,7 +379,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
mFURenderer = initFURenderer();
mGLSurfaceView.setRenderer(mCameraRenderer);
mGLSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
mTopBackground = (ImageView) findViewById(R.id.fu_base_top_background);
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);

Expand Down Expand Up @@ -655,8 +655,8 @@ private void startRecording() {
mMuxer = new MediaMuxerWrapper(mVideoOutFile.getAbsolutePath());

// for video capturing
int videoWidth = BaseCameraRenderer.DEFAULT_PREVIEW_HEIGHT;
int videoHeight = mCameraRenderer.getHeight4Video() / 2 * 2; // 取偶数
int videoWidth = mCameraRenderer.getCameraHeight();
int videoHeight = mCameraRenderer.getCameraWidth();
new MediaVideoEncoder(mMuxer, mMediaEncoderListener, videoWidth, videoHeight);
new MediaAudioEncoder(mMuxer, mMediaEncoderListener);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,16 +363,6 @@ public int getViewHeight() {
return mViewHeight;
}

public int getHeight4Video() {
int h = mViewHeight * DEFAULT_PREVIEW_HEIGHT / mViewWidth;
return h;
}

public int getWidth4Video() {
int w = mViewWidth * DEFAULT_PREVIEW_WIDTH / mViewHeight;
return w;
}

public void handleFocus(float rawX, float rawY, int areaSize) {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
*/
public class Camera1Renderer extends BaseCameraRenderer implements Camera.PreviewCallback {
private static final String TAG = "Camera1Renderer";
private static final float EXPOSURE_COMPENSATION = 0.5F;
private final Object mCameraLock = new Object();
private byte[][] mPreviewCallbackBufferArray;
private Camera mCamera;
private int mFrontCameraId;
private int mBackCameraId;
// 曝光补偿,进度 0.5 表示实际值为 0 就是无补偿
private float mExposureCompensation = 0.5F;
private float mExposureCompensation = EXPOSURE_COMPENSATION;

public Camera1Renderer(Activity activity, GLSurfaceView glSurfaceView, OnRendererStatusListener onRendererStatusListener) {
super(activity, glSurfaceView, onRendererStatusListener);
Expand Down Expand Up @@ -67,6 +68,7 @@ protected void openCamera(int cameraFacing) {
throw new RuntimeException("No camera");
}

mExposureCompensation = EXPOSURE_COMPENSATION;
CameraUtils.setCameraDisplayOrientation(mActivity, cameraId, mCamera);
Log.i(TAG, "openCamera. facing: " + (isFront ? "front" : "back") + ", orientation:"
+ mCameraOrientation + ", previewWidth:" + mCameraWidth + ", previewHeight:"
Expand Down
35 changes: 0 additions & 35 deletions app/src/main/java/com/faceunity/fulivedemo/utils/ConvertUtils.java

This file was deleted.

This file was deleted.

57 changes: 0 additions & 57 deletions app/src/main/java/com/faceunity/fulivedemo/utils/PointUtils.java

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions app/src/main/res/layout/activity_fu_base.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

<ImageView
android:id="@+id/fu_base_top_background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:src="@drawable/fu_base_top_background"
android:visibility="gone"
android:layout_width="0dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_height="@dimen/x240"
android:src="@drawable/demo_bg_top_mask"
app:layout_constraintTop_toTopOf="parent" />

<ImageButton
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/layout_beautify_body.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
app:dsb_indicatorElevation="0dp"
app:dsb_indicatorPopupEnabled="true"
app:dsb_max="100"
app:dsb_trackHeight="@dimen/x4"
app:dsb_min="0"
app:dsb_progressColor="@color/main_color"
app:dsb_rippleColor="@color/main_color"
Expand Down Expand Up @@ -61,7 +62,7 @@
android:layout_marginLeft="@dimen/x148"
android:layout_marginTop="@dimen/x24"
android:layout_marginBottom="@dimen/x94"
android:background="@color/divider_line_color_75" />
android:background="@color/divider_line_color" />

<HorizontalScrollView
android:layout_width="wrap_content"
Expand Down
Loading

0 comments on commit af77966

Please sign in to comment.