mtk平台Camera应用的全屏分析
来源:互联网 发布:400块一家收淘宝店铺 编辑:程序博客网 时间:2024/05/13 00:18
将摄像头的配置文件vendor/mediatek/proprietary/custom/mt6735/hal/D1/sendepfeature/xxxx_mipi_raw/config.ftbl.xxxx_mipi_raw.h
编译进系统后,选择预览大小为全屏,图片大小显示一个100万像素,拍出图片只有1280x768,
但真实的摄像头有500万像素,拍出的图片大小不应该这么小,当预览大小为4:3是,有多中图片
大小可供选择,照片大小正常.该应用的全屏为什么不对呢.
vendor/mediatek/proprietary/packages/apps/Camera/
CameraDeviceExt.java
// TODO @Override public void setPreviewSize() { String pictureRatio = mPreferences.getString(SettingConstants.KEY_PICTURE_RATIO, null); if (pictureRatio == null) { //刷机第一次跑 List<String> supportedRatios = SettingUtils.buildPreviewRatios(mActivity, mParametersExt); if (supportedRatios != null && supportedRatios.size() > 0) { SharedPreferences.Editor editor = mPreferences.edit(); String ratioString = supportedRatios.get(supportedRatios.size() - 1); editor.putString(SettingConstants.KEY_PICTURE_RATIO, ratioString); editor.apply(); pictureRatio = ratioString; } } SettingUtils.setPreviewSize(mActivity, mParametersExt, pictureRatio); String pictureSize = mPreferences.getString(SettingConstants.KEY_PICTURE_SIZE, null); int limitedResolution = SettingUtils.getLimitResolution(); if (limitedResolution > 0) { int index = pictureSize.indexOf('x'); int width = Integer.parseInt(pictureSize.substring(0, index)); int height = Integer.parseInt(pictureSize.substring(index + 1)); if (width * height > limitedResolution) { pictureSize = null; } } if (pictureSize == null) { List<String> supportedSizes = SettingUtils .buildSupportedPictureSizeByRatio(mParametersExt, pictureRatio); SettingUtils.sortSizesInAscending(supportedSizes); Log.i(TAG, "limitedResolution:" + limitedResolution); if (limitedResolution > 0) { SettingUtils.filterLimitResolution(supportedSizes); } if (supportedSizes != null && supportedSizes.size() > 0) { pictureSize = supportedSizes.get(supportedSizes.size() - 1); SharedPreferences.Editor editor = mPreferences.edit(); editor.putString(SettingConstants.KEY_PICTURE_SIZE, pictureSize); editor.apply(); } } Point ps = SettingUtils.getSize(pictureSize); mParametersExt.setPictureSize(ps.x, ps.y); }
String pictureRatio = mPreferences.getString(SettingConstants.KEY_PICTURE_RATIO, null);
这里读上次的值,所有调试的时候要将/data/data/com.mediatek.camera/shared_prefs删掉,否则看不到打印信息
SettingUtils.java
public static List<String> buildPreviewRatios(Context context, Parameters parameters) { List<String> supportedRatios = new ArrayList<String>(); String findString = null; if (context != null && parameters != null) { // Add standard preview ratio. supportedRatios.add(getRatioString(4d / 3)); mCurrentFullScreenRatio = findFullscreenRatio(context); List<String> fullScreenPictureSizes = buildSupportedPictureSizeByRatio(parameters, getRatioString(mCurrentFullScreenRatio)); // Add full screen ratio if platform has full screen ratio picture sizes. if (fullScreenPictureSizes.size() > 0) { findString = getRatioString(mCurrentFullScreenRatio); if (!supportedRatios.contains(findString)) { supportedRatios.add(findString); } } } Log.d(TAG, "buildPreviewRatios(" + parameters + ") add supportedRatio " + findString); return supportedRatios; }
public static final double[] RATIOS = new double[] { 1.3333, 1.5, 1.6667, 1.7778 }; public static double findFullscreenRatio(Context context) { double find = 4d / 3; WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); Point point = new Point(); display.getRealSize(point); mFullScreenWidth = point.x; mFullScreenHeight = point.y; double fullscreen; if (point.x > point.y) { fullscreen = (double) point.x / point.y; } else { fullscreen = (double) point.y / point.x; } Log.i(TAG, "fullscreen = " + fullscreen + " x = " + point.x + " y = " + point.y); for (int i = 0; i < RATIOS.length; i++) { if (Math.abs(RATIOS[i] - fullscreen) < Math.abs(fullscreen - find)) { find = RATIOS[i]; } } Log.d(TAG, "findFullscreenRatiom, return ratio:" + find); return find; }
从源码看就是从4:3,5:3,3:2,16:9中找出最接近屏幕的屏比,那么在摄像头的配置文件中添加相应比例
的图片大小即可,注意不要超过摄像头像素,否则第三方应用获取到的摄像头分辨率(所有图片大小
中最大的一个对应的像素)不对.
阅读全文
0 0
- mtk平台Camera应用的全屏分析
- 基于MTK平台的camera 移植总结
- MTK平台camera AF马达驱动调试流程分析
- MTK平台camera AF马达驱动调试流程分析
- MTK Camera Settings分析
- mtk平台camera流程原理
- MTK 平台 CAMERA 驱动浅析
- MTK 平台Camera 驱动架构
- mtk 平台 CAMERA 驱动浅析
- mtk平台camera调试,读到的ID值为65535??
- 关于在MTK平台 ANDROID 增加CAMERA的一个feature
- MTK平台一个花屏重启问题的分析
- mtk平台hw_get_module分析
- tegra平台的camera驱动应用
- MTK平台LCD背光应用层到driver分析
- MTK平台添加Camera设备信息
- MTK平台Sub Camera支持AF功能
- MTK MT6735平台调试Camera驱动记录
- http 请求头设置
- 九度oj 专题整理 (模拟部分1)
- telnet不是内部或外部命令
- cgic 中文文档
- python 异常 try-except句型
- mtk平台Camera应用的全屏分析
- JavaScript 函数、函数调用
- remove-duplicates-from-sorted-array
- android架构师技能图谱
- Myeclipse10 创建Maven项目有如下几种!
- 测试看看
- Unity3D_组合体和预制件
- 购物车买卖伤害2.0 (结版)
- Mac OS下Android Studio的升级问题