FAQ09934:相机prevew时候出现水印问题

描述:使用基于mtk camera修改的app,发现preview时候出现水印,而在mtk自带的camera上没有该现象

解决:使用DDMS截图和layer dump工具均能发现有有水印图片出现。

比对有水印和没有水印的layer dump log,发现出问题的时候的SurfaceView:

  • Layer 0x42505008 (SurfaceView) activeBuffer=[ 720x1280: 736, 4], colorformat 是RGB565.

而正常时候的SurfaceView:

  • Layer 0x42505789 (SurfaceView) activeBuffer=[ 720x1280: 736, 5], colorformat 是RGB888.

review修改camera ap部分发现在preview时候设定的color format就是RGB565, 这里导致颜色丢失而引发水印现象。需要做如下修改:

  1. 在GLRootView.java中:

public GLRootView(Context context, AttributeSet attrs) { ......

if(USE_RGB888)

getHolder().setFormat(PixelFormat.RGB_888);

else

getHolder().setFormat(PixelFormat.RGB_565);

}

在GalleryEGLConfigChooser.java中:增加RGB888的配置:

private final int mConfigSpec565[] = new int[] {

EGL10.EGL_RED_SIZE, 5,

EGL10.EGL_GREEN_SIZE, 6,

EGL10.EGL_BLUE_SIZE, 5,

EGL10.EGL_ALPHA_SIZE, 0,

EGL10.EGL_NONE

};

private final int mConfigSpec888[] = new int[] {

EGL10.EGL_RED_SIZE, 8,

EGL10.EGL_GREEN_SIZE, 8,

EGL10.EGL_BLUE_SIZE, 8,

EGL10.EGL_ALPHA_SIZE, 0,

EGL10.EGL_NONE

};

private boolean USE_RGB888 = true;

public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {

int mConfigSpec[] = (USE_RGB888 == true)? mConfigSpec888 : mConfigSpec565;

相关推荐
介一安全14 小时前
【Frida Android】实战篇7:SSL Pinning 证书绑定绕过 Hook 教程阶段总结
android·网络安全·逆向·安全性测试·frida
用户20187928316715 小时前
Android 混淆引发的反序列化问题浅析
android
00后程序员张15 小时前
iOS 性能优化的体系化方法论 从启动速度到渲染链路的多工具协同优化
android·ios·性能优化·小程序·uni-app·iphone·webview
游戏开发爱好者815 小时前
iPhone重启日志深度解析与故障代码诊断
android·ios·小程序·https·uni-app·iphone·webview
TDengine (老段)18 小时前
TDengine 字符串函数 TO_BASE64 用户手册
android·大数据·服务器·物联网·时序数据库·tdengine·涛思数据
spencer_tseng19 小时前
Eclipse Oxygen 4.7.2 ADT(android developer tools) Plugin
android·java·eclipse
来来走走20 小时前
Android开发(Kotlin) 协程
android·java·kotlin
河铃旅鹿21 小时前
Android开发-java版:Framgent
android·java·笔记·学习
2501_916008891 天前
手机抓包app大全:无需root的安卓抓包软件列表
android·ios·智能手机·小程序·uni-app·iphone·webview