mtk平台Camera应用的全屏分析
2017-09-11 17:38
351 查看
将摄像头的配置文件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
String pictureRatio = mPreferences.getString(SettingConstants.KEY_PICTURE_RATIO, null);
这里读上次的值,所有调试的时候要将/data/data/com.mediatek.camera/shared_prefs删掉,否则看不到打印信息
SettingUtils.java
从源码看就是从4:3,5:3,3:2,16:9中找出最接近屏幕的屏比,那么在摄像头的配置文件中添加相应比例
的图片大小即可,注意不要超过摄像头像素,否则第三方应用获取到的摄像头分辨率(所有图片大小
中最大的一个对应的像素)不对.
编译进系统后,选择预览大小为全屏,图片大小显示一个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中找出最接近屏幕的屏比,那么在摄像头的配置文件中添加相应比例
的图片大小即可,注意不要超过摄像头像素,否则第三方应用获取到的摄像头分辨率(所有图片大小
中最大的一个对应的像素)不对.
相关文章推荐
- MTK平台LCD背光应用层到driver分析
- 基于大数据分析的安全管理平台技术研究及应用【摘录】
- MTK平台图片文件解析过程简单分析
- MTK 平台上如何给 camera 添加一种 preview size
- MTK平台学习--FileManager模块分析
- 基于新浪开放平台的企业微博影响力分析应用的学习笔记。
- 【Android 应用开发】Android 平台 HTTP网速测试 案例 API 分析
- 基于MTK平台的camera 移植总结
- MTK平台待机功耗分析流程
- MTK Camera Settings分析
- 深入MTK平台bootloader启动之【 lk -> kernel】分析笔记
- 展讯平台 camera驱动分析(sensor部分)
- tegra平台的camera驱动应用
- Silverlight企业应用快速开发平台框架设计(二)分析-平台实现重点是什么,要怎么做?
- 【Android 应用开发】Android 平台 HTTP网速测试 案例 API 分析
- 移动应用数据统计分析平台Flurry,Google Analytics
- 移动应用数据统计分析平台汇总
- 应用框架的设计与实现——.NET平台(9 消息队列服务代码分析)
- WEB应用 信息管理系统 数据分析展示系统 OA办公工作流 快速构建与开发平台
- 列出最常用的3个互联网应用,分析它们是平台产品还是现金牛产品