MTK 相机像素差值和做假
分类: Android2014-05-30 19:59 474人阅读 评论(0) 收藏 举报
图像比例 | 拍出图像像素 | 代码中字串id | 相机界面显示像素(英文) |
4:3 | 320x240 | @string/pref_camera_picturesize_entry_320x240 | QVGA |
640x480 | @string/pref_camera_picturesize_entry_640x480 | VGA | |
1024x768 | @string/pref_camera_picturesize_entry_1024x768 | 1M | |
1280x960 | @string/pref_camera_picturesize_entry_1280x960 | 1.3M | |
1600x1200 | @string/pref_camera_picturesize_entry_1600x1200 | 2M | |
2048x1536 | @string/pref_camera_picturesize_entry_2048x1536 | 3M | |
2560x1920 | @string/pref_camera_picturesize_entry_2592x1936 | 5M | |
3264x2448 | @string/pref_camera_picturesize_entry_3264x2448 | 8M | |
3600x2700 | @string/pref_camera_picturesize_entry_3600x2700 | 9.5M | |
3672x2754 | @string/pref_camera_picturesize_entry_3672x2754 | 10M | |
4096x3072 | @string/pref_camera_picturesize_entry_4096x3072 | 12M | |
4160x3120 | @string/pref_camera_picturesize_entry_4160x3120 | 13M | |
4608x3456 | @string/pref_camera_picturesize_entry_4608x3456 | 16M | |
5120x3840 | @string/pref_camera_picturesize_entry_5120x3840 | 20M | |
vanzo增加 | 4352x3264 | @string/pref_camera_picturesize_entry_4352x3264 | 14M |
16:9 (如果手机屏幕比例是16:9,这像素就是全屏像素) |
1280x720 | @string/pref_camera_picturesize_entry_1280x720 | 1M |
1600x912 | @string/pref_camera_picturesize_entry_1280x960 | 1.3M | |
2048x1152 | @string/pref_camera_picturesize_entry_2048x1536 | 3M | |
2560x1440 | @string/pref_camera_picturesize_entry_2560x1440 | 4M | |
3328x1872 | @string/pref_camera_picturesize_entry_3328x1872 | 6M | |
4096x2304 | @string/pref_camera_picturesize_entry_3600x2700 | 9.5M | |
4608x2592 | @string/pref_camera_picturesize_entry_4096x3072 | 12M | |
5120x2880 | @string/pref_camera_picturesize_entry_5120x2880 | 15M | |
5:3 (如果手机屏幕比例是5:3,这像素就是全屏像素) |
1280x768 | @string/pref_camera_picturesize_entry_1280x768 | 1M |
1600x960 | @string/pref_camera_picturesize_entry_1600x1200 | 2M | |
2880x1728 | @string/pref_camera_picturesize_entry_2592x1936 | 5M | |
3600x2160 | @string/pref_camera_picturesize_entry_3264x2448 | 8M | |
3:2 (如果手机屏幕比例是3:2,这像素就是全屏像素) |
1024x688 | @string/pref_camera_picturesize_entry_1024x768 | 1M |
1440x960 | @string/pref_camera_picturesize_entry_1280x960 | 1.3M | |
2048x1360 | @string/pref_camera_picturesize_entry_2048x1536 | 3M | |
2560x1712 | @string/pref_camera_picturesize_entry_2592x1936 | 5M | |
备注 | 以上是92新平台本身支持的像素,MTK更新到Camera源码中的。 如有特殊差值需求,只要摄像头物理像素支持,或差值后支持,也可满足,但是要满足以下像素条件:(假设宽为w,高为h,想要个18M的像素) 1.w,h都是16的倍数 2.w:h = 4:3(或16:9,根据需求定) 3.w*h = 18M(根据需求定) 满足以上条件的w,h就可以做差值 另外:差值最好在以下范围内:VGA->2M(或3M),2M->5M,5M->8M,8M->12M,12M->18M(再大还没遇到过 |
[FAQ05829] 6589 JB2如何实现camera插值或新增picture size Download
Platform:MT6589
Branch:JB2
FAQ Content
[DESCRIPTION]
camera实现插值,该solution同时适用于新增一个picture size.
[SOLUTION]
Camera插值在底层已经做好,我们只需要在中间层和app层添加一个对应的picture size即可。但是有一些限制条件需要注意:
1. 插值的倍数只能小于等于16倍,也就是说假如是1M的sensor,那最多只能插值到16M;
2. 插值后的width和height都不能超过8192,也就是picture size设置的width和height的大小都不能超过8192;
3. 若插值的大小超过12M:
例如插值到18M,并且贵司code base版本在”ALPS.JB2.MP.V1.2”之前(包括ALPS.JB2.MP.V1.2)的版本则需要申请并打上patch(ALPS00460866),若code base版本在ALPS.JB2.MP.V1.3之后则不需要;
4. 由于hardware jpeg encoder的限制,插值时设置的width和height请您分别都设为16的整数倍,若设置非16整数倍的width或height,则可能导致拍出来的图片会有异常(如图片扭曲、花屏、连拍的图片绿屏)。
下面是关于插值的方法:
(一)中间层修改
1.mediatek\custom\<project>\hal\imgsensor\<sensor name>\config.ftbl.<sensor name>.h
(若没有该文件,则修改
mediatek\custom\<project>\hal\imgsensor\src\config.ftbl.common_raw.h
或者config.ftbl.common_yuv.h
)
在如下定义picture size的地方增加您想要的size (宽和高必须是16的整数倍,宽高比例建议先用4:3的验证测试),如果已经包含您要加的size,就不需要再增加。
#if 1
// Picture Size
FTABLE_CONFIG_AS_TYPE_OF_DEFAULT_VALUES(
KEY_AS_(MtkCameraParameters::KEY_PICTURE_SIZE),
SCENE_AS_DEFAULT_SCENE(
ITEM_AS_DEFAULT_("2560x1920"),
ITEM_AS_VALUES_(
"320x240", "640x480", "1024x768", "1280x720", "1280x768", "1280x960"
)
),
)
#endif
例如:
// Picture Size
FTABLE_CONFIG_AS_TYPE_OF_DEFAULT_VALUES(
KEY_AS_(MtkCameraParameters::KEY_PICTURE_SIZE),
SCENE_AS_DEFAULT_SCENE(
ITEM_AS_DEFAULT_("2560x1920"),
ITEM_AS_VALUES_(
"320x240", "640x480", "1024x768", "1280x720", "1280x768", "1280x960", "4096x3072"
)
),
)
#endif
(二) app层的修改可以按照如下来修改:
1.\packages\apps\Camera\res\values\strings.xml
增加您想要的size,如果已经包含您要加的size,就不需要再增加
<string name="pref_camera_picturesize_entry_3264x2448">8M pixels</string>
<string name="pref_camera_picturesize_entry_2592x1936">5M pixels</string>
<string name="pref_camera_picturesize_entry_2048x1536">3M pixels</string>
<string name="pref_camera_picturesize_entry_1600x1200">2M pixels</string>
<string name="pref_camera_picturesize_entry_1280x960">1.3M pixels</string>
<string name="pref_camera_picturesize_entry_1024x768">1M pixels</string>
<string name="pref_camera_picturesize_entry_640x480">VGA</string>
<string name="pref_camera_picturesize_entry_320x240">QVGA</string>
例如:
<string name="pref_camera_picturesize_entry_4096x3072">12M Pixels</string>
<string name="pref_camera_picturesize_entry_3264x2448">8M pixels</string>
<string name="pref_camera_picturesize_entry_2592x1936">5M pixels</string>
<string name="pref_camera_picturesize_entry_2048x1536">3M pixels</string>
<string name="pref_camera_picturesize_entry_1600x1200">2M pixels</string>
<string name="pref_camera_picturesize_entry_1280x960">1.3M pixels</string>
<string name="pref_camera_picturesize_entry_1024x768">1M pixels</string>
<string name="pref_camera_picturesize_entry_640x480">VGA</string>
<string name="pref_camera_picturesize_entry_320x240">QVGA</string>
2.\packages\apps\Camera\res\values\arrays.xml
<string-array name="pref_camera_picturesize_entries" translatable="false">
<!-- TODO: Change to a better name of the preference.
The first element of the array should be
"pref_camera_picturesize_entry_2592x1944". However, we are too
late for the translation. Since we show the same label as the
second item, we just use the second one instead.
-->
<item>@string/pref_camera_picturesize_entry_3264x2448</item>
<item>@string/pref_camera_picturesize_entry_2592x1936</item>
<item>@string/pref_camera_picturesize_entry_2592x1936</item>
<item>@string/pref_camera_picturesize_entry_2592x1936</item>
<item>@string/pref_camera_picturesize_entry_2048x1536</item>
<item>@string/pref_camera_picturesize_entry_1600x1200</item>
<item>@string/pref_camera_picturesize_entry_1280x960</item>
<item>@string/pref_camera_picturesize_entry_1024x768</item>
<item>@string/pref_camera_picturesize_entry_640x480</item>
<item>@string/pref_camera_picturesize_entry_320x240</item>
</string-array>
增加您想要的size,如果已经包含您要加的size,就不需要再增加
例如:
<string-array name="pref_camera_picturesize_entries" translatable="false">
<!-- TODO: Change to a better name of the preference.
The first element of the array should be
"pref_camera_picturesize_entry_2592x1944". However, we are too
late for the translation. Since we show the same label as the
second item, we just use the second one instead.
-->
<item>@string/pref_camera_picturesize_entry_4096x3072</item>
<item>@string/pref_camera_picturesize_entry_3264x2448</item>
<item>@string/pref_camera_picturesize_entry_2592x1936</item>
<item>@string/pref_camera_picturesize_entry_2592x1936</item>
<item>@string/pref_camera_picturesize_entry_2592x1936</item>
<item>@string/pref_camera_picturesize_entry_2048x1536</item>
<item>@string/pref_camera_picturesize_entry_1600x1200</item>
<item>@string/pref_camera_picturesize_entry_1280x960</item>
<item>@string/pref_camera_picturesize_entry_1024x768</item>
<item>@string/pref_camera_picturesize_entry_640x480</item>
<item>@string/pref_camera_picturesize_entry_320x240</item>
</string-array>
3.\packages\apps\Camera\res\values\arrays.xml
<string-array name="pref_camera_picturesize_entryvalues" translatable="false">
<item>3264x2448</item>
<item>2592x1944</item>
<item>2592x1936</item>
<item>2560x1920</item>
<item>2048x1536</item>
<item>1600x1200</item>
<item>1280x960</item>
<item>1024x768</item>
<item>640x480</item>
<item>320x240</item>
</string-array>
增加您想要的size,如果已经包含你要加的size,就不需要再增加
例如:
<string-array name="pref_camera_picturesize_entryvalues" translatable="false">
<item>4096x3072</item>
<item>3264x2448</item>
<item>2592x1944</item>
<item>2592x1936</item>
<item>2560x1920</item>
<item>2048x1536</item>
<item>1600x1200</item>
<item>1280x960</item>
<item>1024x768</item>
<item>640x480</item>
<item>320x240</item>
</string-array>
4.\packages\apps\Camera\src\com\Android\Camera\CameraSettings.java
public static final String[] PICTURE_SIZE_4_3 = new String[] {
"320x240",
"640x480",
"1024x768",
"1280x960",
"1600x1200",
"2048x1536",
"2560x1920",
"3264x2448",
};
增加您想要的size,如果已经包含你要加的size,就不需要再增加
例如:
public static final String[] PICTURE_SIZE_4_3 = new String[] {
"320x240",
"640x480",
"1024x768",
"1280x960",
"1600x1200",
"2048x1536",
"2560x1920",
"3264x2448",
"4096x3072",
};
注意:若您使用的picture size不是4:3的比例,例如您加的为1280×720,比例为16:9,则需要在对应的比例PICTURE_SIZE_16_9中添加。