当前位置: 首页 > 工具软件 > Focal Camera > 使用案例 >

Mtk平台Camera新增差值(一)

梁磊
2023-12-01

(1)计算差值

如果原有的差值列表中没有需要的差值,可通过计算算出符合需求的插值。

具体计算方法如下:
假设像素的长宽分别为X,Y,则插值为XY。由于MTK规定各参数必须是16的倍数,所以有如下公式:

(A)16:9的插值:

//n 为调整插值大小的参数,通过增大或者减小n的值来算出不同的插值XY
X = 16*16*n
Y = 16*9*n
XY = (16*16*n )  *  (16*9*n)
//12M的4608 * 2592
n = 4608/ 16 / 16 = 18
n = 2592/ 16 / 9 = 18
XY = 4608×2592 = 11943936

(B) 4:3的插值:

X = 16*4*n
Y = 16*3*n
XY = (16*4*n)   *   (16*3*n)
//13M的4160 * 3120
n = 4160/ 16 / 4 = 65
n = 3120/ 16 / 3 = 65
XY = 4608×2592 = 12979200

(2)增加差值

需要在metadata当中来添加相应的差值。

//常见的集中分辨率ratio
4 : 3 = 1.33333333
16 : 9 = 1.77777778
5 : 3 = 1.66666667
3 : 2 = 1.5
18 : 9 = 2
1 : 1 = 1

(A)4 : 3

//4:3 Start
    #if (DEF_SENSOR_WIDTH >= 4608 && DEF_SENSOR_HEIGHT >= 3456)
                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32) //16mp 4:3
                CONFIG_ENTRY_VALUE(4608, MINT32)
                CONFIG_ENTRY_VALUE(3456, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)
    #endif
    #if (DEF_SENSOR_WIDTH >= 4160 && DEF_SENSOR_HEIGHT >= 3120)
                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32) //13mp 4:3
                CONFIG_ENTRY_VALUE(4160, MINT32)
                CONFIG_ENTRY_VALUE(3120, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)
    #endif
    #if (DEF_SENSOR_WIDTH >= 4032 && DEF_SENSOR_HEIGHT >= 3024)
                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32) //12mp 4:3
                CONFIG_ENTRY_VALUE(4032, MINT32)
                CONFIG_ENTRY_VALUE(3024, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)
    #endif
    #if (DEF_SENSOR_WIDTH >= 3264 && DEF_SENSOR_HEIGHT >= 2448)
                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32) //8mp 4:3
                CONFIG_ENTRY_VALUE(3264, MINT32)
                CONFIG_ENTRY_VALUE(2448, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)
    #endif
    #if (DEF_SENSOR_WIDTH >= 2560 && DEF_SENSOR_HEIGHT >= 1920)
		CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32) //5mp 4:3
                CONFIG_ENTRY_VALUE(2560, MINT32)
                CONFIG_ENTRY_VALUE(1920, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)
    #endif
    #if (DEF_SENSOR_WIDTH >= 2048 && DEF_SENSOR_HEIGHT >= 1536)
		CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32) //3m  4:3
                CONFIG_ENTRY_VALUE(2048, MINT32)
                CONFIG_ENTRY_VALUE(1536, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)
    #endif
                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32)	//2M 4:3
                CONFIG_ENTRY_VALUE(1600, MINT32)
                CONFIG_ENTRY_VALUE(1200, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)

                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32)
                CONFIG_ENTRY_VALUE(1440, MINT32)
                CONFIG_ENTRY_VALUE(1080, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)

		CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32)
                CONFIG_ENTRY_VALUE(1280, MINT32)
                CONFIG_ENTRY_VALUE(960, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)

                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32)
                CONFIG_ENTRY_VALUE(1024, MINT32)
                CONFIG_ENTRY_VALUE( 768, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)

                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32)
                CONFIG_ENTRY_VALUE( 960, MINT32)
                CONFIG_ENTRY_VALUE( 720, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)

                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32)
                CONFIG_ENTRY_VALUE( 800, MINT32)
                CONFIG_ENTRY_VALUE( 600, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)

                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32)
                CONFIG_ENTRY_VALUE( 640, MINT32)
                CONFIG_ENTRY_VALUE( 480, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)

                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32)
                CONFIG_ENTRY_VALUE( 320, MINT32)
                CONFIG_ENTRY_VALUE( 240, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)

(B)16 : 9

//16:9 Start
    #if (DEF_SENSOR_WIDTH >= 4608)
                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32) //12M
                CONFIG_ENTRY_VALUE(4608, MINT32)
                CONFIG_ENTRY_VALUE(2592, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)
    #endif
    #if (DEF_SENSOR_WIDTH >= 4096)
                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32) //10M
                CONFIG_ENTRY_VALUE(4096, MINT32)
                CONFIG_ENTRY_VALUE(2304, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)
    #endif
    #if (DEF_SENSOR_WIDTH >= 3840)
                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32) //8M
                CONFIG_ENTRY_VALUE(3840, MINT32)
                CONFIG_ENTRY_VALUE(2160, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)
    #endif
    #if (DEF_SENSOR_WIDTH >= 3072)
		CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32) //5M
                CONFIG_ENTRY_VALUE(3072, MINT32)
                CONFIG_ENTRY_VALUE(1728, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)
    #endif
    #if (DEF_SENSOR_WIDTH >= 2304)
		CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32) //3M
                CONFIG_ENTRY_VALUE(2304, MINT32)
                CONFIG_ENTRY_VALUE(1296, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)
    #endif
    #if (DEF_SENSOR_WIDTH >= 1920)
                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32)
                CONFIG_ENTRY_VALUE(1920, MINT32)
                CONFIG_ENTRY_VALUE(1088, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)

                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32)
                CONFIG_ENTRY_VALUE(1920, MINT32)
                CONFIG_ENTRY_VALUE(1080, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)
    #endif
                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32)
                CONFIG_ENTRY_VALUE(1280, MINT32)
                CONFIG_ENTRY_VALUE( 720, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)

(C)18 : 9

//18:9 Start
#if DEF_SUPPORT_18_9
    #if (DEF_SENSOR_WIDTH >= 4608)
                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32) //11M
                CONFIG_ENTRY_VALUE(4608, MINT32)
                CONFIG_ENTRY_VALUE(2304, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)
    #endif
    #if (DEF_SENSOR_WIDTH >= 4032)
                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32) //8M
                CONFIG_ENTRY_VALUE(4032, MINT32)
                CONFIG_ENTRY_VALUE(2016, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)
	#endif
    #if (DEF_SENSOR_WIDTH >= 3168)
				CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32) //5M
                CONFIG_ENTRY_VALUE(3168, MINT32)
                CONFIG_ENTRY_VALUE(1584, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)
    #endif
    #if (DEF_SENSOR_WIDTH >= 2464)
				CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32) //3M
                CONFIG_ENTRY_VALUE(2464, MINT32)
                CONFIG_ENTRY_VALUE(1232, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)
    #endif
    #if (DEF_SENSOR_WIDTH >= 2176)
                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32)	//2M
                CONFIG_ENTRY_VALUE(2176, MINT32)
                CONFIG_ENTRY_VALUE(1088, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)
    #endif
                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32)	//1M
                CONFIG_ENTRY_VALUE(1440, MINT32)
                CONFIG_ENTRY_VALUE( 720, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)

                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32)
                CONFIG_ENTRY_VALUE( 960, MINT32)
                CONFIG_ENTRY_VALUE( 480, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)
#endif

(D)1 : 1

#if DEF_SUPPORT_1_1
    #if (DEF_SENSOR_WIDTH >= 3456 && DEF_SENSOR_HEIGHT >= 3456)
                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32) //12M
                CONFIG_ENTRY_VALUE(3456, MINT32)
                CONFIG_ENTRY_VALUE(3456, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)
    #endif
    #if (DEF_SENSOR_WIDTH >= 3120 && DEF_SENSOR_HEIGHT >= 3120)
                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32) //9.7M
                CONFIG_ENTRY_VALUE(3120, MINT32)
                CONFIG_ENTRY_VALUE(3120, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)
    #endif
                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32) //0.9M
                CONFIG_ENTRY_VALUE(960, MINT32)
                CONFIG_ENTRY_VALUE(960, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)

                CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT32) //0.5M
                CONFIG_ENTRY_VALUE(720, MINT32)
                CONFIG_ENTRY_VALUE(720, MINT32)
                CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT32)
#endif

(3)dump平台支持的size

//adb shell dumpsys media.camera -v 2 > meta.txt

android.scaler.availableStreamConfigurations (d000a): int32[604]
        [33 4160 3120 OUTPUT ]
        [33 4096 2304 OUTPUT ]
        [33 4032 3024 OUTPUT ]
        [33 4032 2016 OUTPUT ]
        [33 3840 2160 OUTPUT ]
        [33 3264 2448 OUTPUT ]
        [33 3168 1584 OUTPUT ]
        [33 3072 1728 OUTPUT ]
        [33 2560 1920 OUTPUT ]
        [33 2560 1280 OUTPUT ]
        [33 2304 1296 OUTPUT ]
        [33 2176 1088 OUTPUT ]
        [33 2048 1536 OUTPUT ]
        [33 1920 1088 OUTPUT ]
        [33 1920 1080 OUTPUT ]
        [33 1600 1200 OUTPUT ]
        [33 1600 720 OUTPUT ]
        [33 1560 720 OUTPUT ]
        [33 1520 720 OUTPUT ]
        [33 1440 1088 OUTPUT ]
        [33 1440 1080 OUTPUT ]
        [33 1440 720 OUTPUT ]
        [33 1280 960 OUTPUT ]
        [33 1280 720 OUTPUT ]
        [33 1080 720 OUTPUT ]
        [33 960 720 OUTPUT ]
        [33 960 480 OUTPUT ]
        [33 800 600 OUTPUT ]
        [33 720 720 OUTPUT ]
        [33 640 480 OUTPUT ]
        [33 320 240 OUTPUT ]
        [35 4160 3120 OUTPUT ]
        [35 4096 2304 OUTPUT ]
        [35 4032 3024 OUTPUT ]
        [35 4032 2016 OUTPUT ]
        [35 3840 2160 OUTPUT ]
        [35 3264 2448 OUTPUT ]
        [35 3168 1584 OUTPUT ]
        [35 3072 1728 OUTPUT ]
        [35 2560 1920 OUTPUT ]
        [35 2560 1440 OUTPUT ]
        [35 2560 1280 OUTPUT ]
        [35 2304 1296 OUTPUT ]
        [35 2176 1088 OUTPUT ]
        [35 2048 1536 OUTPUT ]
        [35 1920 1440 OUTPUT ]
        [35 1920 1088 OUTPUT ]
        [35 1920 1080 OUTPUT ]
        [35 1600 1200 OUTPUT ]
        [35 1600 720 OUTPUT ]
        [35 1560 720 OUTPUT ]
        [35 1520 720 OUTPUT ]
        [35 1440 1088 OUTPUT ]
        [35 1440 1080 OUTPUT ]
        [35 1440 720 OUTPUT ]
        [35 1280 960 OUTPUT ]
        [35 1280 720 OUTPUT ]
        [35 1080 720 OUTPUT ]
        [35 960 720 OUTPUT ]
        [35 960 540 OUTPUT ]
        [35 960 480 OUTPUT ]
        [35 800 600 OUTPUT ]
        [35 720 720 OUTPUT ]
        [35 720 480 OUTPUT ]
        [35 640 480 OUTPUT ]
        [35 352 288 OUTPUT ]
        [35 320 240 OUTPUT ]
        [35 192 144 OUTPUT ]
        [35 192 108 OUTPUT ]
        [35 176 144 OUTPUT ]
        [35 160 96 OUTPUT ]
        [34 4160 3120 OUTPUT ]
        [34 4096 2304 OUTPUT ]
        [34 4032 3024 OUTPUT ]
        [34 4032 2016 OUTPUT ]
        [34 3840 2160 OUTPUT ]
        [34 3264 2448 OUTPUT ]
        [34 3168 1584 OUTPUT ]
        [34 3072 1728 OUTPUT ]
        [34 2560 1920 OUTPUT ]
        [34 2560 1440 OUTPUT ]
        [34 2560 1280 OUTPUT ]
        [34 2304 1296 OUTPUT ]
        [34 2176 1088 OUTPUT ]
        [34 2048 1536 OUTPUT ]
        [34 1920 1440 OUTPUT ]
        [34 1920 1088 OUTPUT ]
        [34 1920 1080 OUTPUT ]
        [34 1600 1200 OUTPUT ]
        [34 1600 720 OUTPUT ]
        [34 1560 720 OUTPUT ]
        [34 1520 720 OUTPUT ]
        [34 1440 1088 OUTPUT ]
        [34 1440 1080 OUTPUT ]
        [34 1440 720 OUTPUT ]
        [34 1280 960 OUTPUT ]
        [34 1280 720 OUTPUT ]
        [34 1080 720 OUTPUT ]
        [34 960 720 OUTPUT ]
        [34 960 540 OUTPUT ]
        [34 960 480 OUTPUT ]
        [34 800 600 OUTPUT ]
        [34 720 720 OUTPUT ]
        [34 720 480 OUTPUT ]
        [34 640 480 OUTPUT ]
        [34 352 288 OUTPUT ]
        [34 320 240 OUTPUT ]
        [34 192 144 OUTPUT ]
        [34 192 108 OUTPUT ]
        [34 176 144 OUTPUT ]
        [34 160 96 OUTPUT ]
        [842094169 4160 3120 OUTPUT ]
        [842094169 4096 2304 OUTPUT ]
        [842094169 4032 3024 OUTPUT ]
        [842094169 4032 2016 OUTPUT ]
        [842094169 3840 2160 OUTPUT ]
        [842094169 3264 2448 OUTPUT ]
        [842094169 3168 1584 OUTPUT ]
        [842094169 3072 1728 OUTPUT ]
        [842094169 2560 1920 OUTPUT ]
        [842094169 2560 1440 OUTPUT ]
        [842094169 2560 1280 OUTPUT ]
        [842094169 2304 1296 OUTPUT ]
        [842094169 2176 1088 OUTPUT ]
        [842094169 2048 1536 OUTPUT ]
        [842094169 1920 1440 OUTPUT ]
        [842094169 1920 1088 OUTPUT ]
        [842094169 1920 1080 OUTPUT ]
        [842094169 1600 1200 OUTPUT ]
        [842094169 1600 720 OUTPUT ]
        [842094169 1560 720 OUTPUT ]
        [842094169 1520 720 OUTPUT ]
        [842094169 1440 1088 OUTPUT ]
        [842094169 1440 1080 OUTPUT ]
        [842094169 1440 720 OUTPUT ]
        [842094169 1280 960 OUTPUT ]
        [842094169 1280 720 OUTPUT ]
        [842094169 1080 720 OUTPUT ]
        [842094169 960 720 OUTPUT ]
        [842094169 960 540 OUTPUT ]
        [842094169 960 480 OUTPUT ]
        [842094169 800 600 OUTPUT ]
        [842094169 720 720 OUTPUT ]
        [842094169 720 480 OUTPUT ]
        [842094169 640 480 OUTPUT ]
        [842094169 352 288 OUTPUT ]
        [842094169 320 240 OUTPUT ]
        [842094169 192 144 OUTPUT ]
        [842094169 192 108 OUTPUT ]
        [842094169 176 144 OUTPUT ]
        [842094169 160 96 OUTPUT ]

当中定义的类型值

//frameworks/base/core/java/android/hardware/camera2/params/StreamConfigurationMap.java

// from system/core/include/system/graphics.h
      private static final int HAL_PIXEL_FORMAT_RAW16 = 0x20;
      private static final int HAL_PIXEL_FORMAT_BLOB = 0x21;
      private static final int HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED = 0x22;
      private static final int HAL_PIXEL_FORMAT_YCbCr_420_888 = 0x23;
      private static final int HAL_PIXEL_FORMAT_RAW_OPAQUE = 0x24;
      private static final int HAL_PIXEL_FORMAT_RAW10 = 0x25;
      private static final int HAL_PIXEL_FORMAT_RAW12 = 0x26;
      private static final int HAL_PIXEL_FORMAT_Y16 = 0x20363159;
//hardware/interfaces/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PixelFormat.aidl

enum PixelFormat {
    UNSPECIFIED = 0,
    RGBA_8888 = 1,
    RGBX_8888 = 2,
    RGB_888 = 3,
    RGB_565 = 4,
    BGRA_8888 = 5,
    YCBCR_422_SP = 16,
    YCRCB_420_SP = 17,
    YCBCR_422_I = 20,
    RGBA_FP16 = 22,
    RAW16 = 32,
    BLOB = 33,
    IMPLEMENTATION_DEFINED = 34,
    YCBCR_420_888 = 35,
    RAW_OPAQUE = 36,
    RAW10 = 37,
    RAW12 = 38,
    RGBA_1010102 = 43,
    Y8 = 538982489,
    Y16 = 540422489,
    YV12 = 842094169,
    DEPTH_16 = 48,
    DEPTH_24 = 49,
    DEPTH_24_STENCIL_8 = 50,
    DEPTH_32F = 51,
    DEPTH_32F_STENCIL_8 = 52,
    STENCIL_8 = 53,
    YCBCR_P010 = 54,
    HSV_888 = 55,
  }

(4)metadata定义一个config文件

//def_metadata_config.h

/**** Config Start ****/

//对应 kernel-x.x/drivers/misc/mediatek/imgsensor/inc/kd_imgsensor.h 此文件中IC NAME
#define DEF_SENSOR_IC_NAME   SENSOR_DRVNAME_HI1333_MIPI_RAW

//对应 kernel-x.x/drivers/misc/mediatek/imgsensor/src 驱动代码中
#define DEF_SENSOR_WIDTH        4208     //imgsensor_info.cap.grabwindow_width
#define DEF_SENSOR_HEIGHT       3120     //imgsensor_info.cap.grabwindow_height

#define DEF_JPEG_MAX_SIZE       15754752 //DEF_SENSOR_WIDTH * DEF_SENSOR_HEIGHT * 0.6 * 2

#define DEF_WIDTH_PIXEL_SIZE    4.71f    //DEF_SENSOR_WIDTH * Unit pixel size(查看datasheet)
#define DEF_HEIGHT_PIXEL_SIZE   3.49f    //DEF_SENSOR_HEIGHT * Unit pixel size

#define DEF_HAS_FLASHLIGHT      YES      //是否有闪光灯
#define DEF_HAS_AF              YES      //是否有对焦马达
#define DEF_SUPPORT_18_9        YES      //是否支持18:9尺寸
#define DEF_SUPPORT_1_1         NO      //是否支持1:1尺寸

#define DEF_LENS_FNO            2.2f     //光圈值大小,问模组厂
#define DEF_FOCAL_LENGTH        3.43f    //CTS FOV:  DEF_FOCAL_LENGTH = DEF_WIDTH_PIXEL_SIZE / (2 * tan FOV/2)

#define DF_SENSOR_OB           64      //问FAE或看datasheet,不知道就填64

/**** Config End ****/
 类似资料: