Home | History | Annotate | Download | only in HAL3
      1 /* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
      2 *
      3 * Redistribution and use in source and binary forms, with or without
      4 * modification, are permitted provided that the following conditions are
      5 * met:
      6 *     * Redistributions of source code must retain the above copyright
      7 *       notice, this list of conditions and the following disclaimer.
      8 *     * Redistributions in binary form must reproduce the above
      9 *       copyright notice, this list of conditions and the following
     10 *       disclaimer in the documentation and/or other materials provided
     11 *       with the distribution.
     12 *     * Neither the name of The Linux Foundation nor the names of its
     13 *       contributors may be used to endorse or promote products derived
     14 *       from this software without specific prior written permission.
     15 *
     16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
     17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
     19 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
     20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
     23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
     25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
     26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27 *
     28 */
     29 
     30 #ifndef __QCAMERA3VENDORTAGS_H__
     31 #define __QCAMERA3VENDORTAGS_H__
     32 
     33 // Camera dependencies
     34 #include "system/camera_metadata.h"
     35 
     36 namespace qcamera {
     37 
     38 enum qcamera3_ext_section {
     39     QCAMERA3_PRIVATEDATA = VENDOR_SECTION,
     40     QCAMERA3_CDS,
     41     QCAMERA3_OPAQUE_RAW,
     42     QCAMERA3_CROP,
     43     QCAMERA3_TUNING_META_DATA,
     44     QCAMERA3_TEMPORAL_DENOISE,
     45     QCAMERA3_AV_TIMER,
     46     QCAMERA3_SENSOR_META_DATA,
     47     QCAMERA3_DUALCAM_LINK_META_DATA,
     48     QCAMERA3_DUALCAM_CALIB_META_DATA,
     49     QCAMERA3_HAL_PRIVATEDATA,
     50     QCAMERA3_JPEG_ENCODE_CROP,
     51     QCAMERA3_VIDEO_HDR,
     52     QCAMERA3_IR,
     53     QCAMERA3_AEC_CONVERGENCE,
     54     QCAMERA3_AWB_CONVERGENCE,
     55     QCAMERA3_SECTIONS_END
     56 };
     57 
     58 enum qcamera3_ext_section_ranges {
     59     QCAMERA3_PRIVATEDATA_START = QCAMERA3_PRIVATEDATA << 16,
     60     QCAMERA3_CDS_START = QCAMERA3_CDS << 16,
     61     QCAMERA3_OPAQUE_RAW_START = QCAMERA3_OPAQUE_RAW << 16,
     62     QCAMERA3_CROP_START = QCAMERA3_CROP << 16,
     63     QCAMERA3_TUNING_META_DATA_START = QCAMERA3_TUNING_META_DATA << 16,
     64     QCAMERA3_TEMPORAL_DENOISE_START = QCAMERA3_TEMPORAL_DENOISE << 16,
     65     QCAMERA3_AV_TIMER_START = QCAMERA3_AV_TIMER << 16,
     66     QCAMERA3_SENSOR_META_DATA_START = QCAMERA3_SENSOR_META_DATA << 16,
     67     QCAMERA3_DUALCAM_LINK_META_DATA_START = QCAMERA3_DUALCAM_LINK_META_DATA << 16,
     68     QCAMERA3_DUALCAM_CALIB_META_DATA_START = QCAMERA3_DUALCAM_CALIB_META_DATA << 16,
     69     QCAMERA3_HAL_PRIVATEDATA_START = QCAMERA3_HAL_PRIVATEDATA << 16,
     70     QCAMERA3_JPEG_ENCODE_CROP_START = QCAMERA3_JPEG_ENCODE_CROP << 16,
     71     QCAMERA3_VIDEO_HDR_START = QCAMERA3_VIDEO_HDR << 16,
     72     QCAMERA3_IR_START = QCAMERA3_IR << 16,
     73     QCAMERA3_AEC_CONVERGENCE_SPEED_START = QCAMERA3_AEC_CONVERGENCE << 16,
     74     QCAMERA3_AWB_CONVERGENCE_SPEED_START = QCAMERA3_AWB_CONVERGENCE << 16
     75 };
     76 
     77 enum qcamera3_ext_tags {
     78     QCAMERA3_PRIVATEDATA_REPROCESS = QCAMERA3_PRIVATEDATA_START,
     79     QCAMERA3_PRIVATEDATA_END,
     80     QCAMERA3_CDS_MODE = QCAMERA3_CDS_START,
     81     QCAMERA3_CDS_INFO,
     82     QCAMERA3_CDS_END,
     83 
     84     //Property Name:  org.codeaurora.qcamera3.opaque_raw.opaque_raw_strides
     85     //
     86     //Type: int32 * n * 3 [public]
     87     //
     88     //Description: Distance in bytes from the beginning of one row of opaque
     89     //raw image data to the beginning of next row.
     90     //
     91     //Details: The strides are listed as (raw_width, raw_height, stride)
     92     //triplets. For each supported raw size, there will be a stride associated
     93     //with it.
     94     QCAMERA3_OPAQUE_RAW_STRIDES = QCAMERA3_OPAQUE_RAW_START,
     95 
     96     //Property Name: org.codeaurora.qcamera3.opaque_raw.opaque_raw_format
     97     //
     98     //Type: byte(enum) [public]
     99     //  * LEGACY - The legacy raw format where 8, 10, or 12-bit
    100     //    raw data is packed into a 64-bit word.
    101     //  * MIPI - raw format matching the data packing described
    102     //    in MIPI CSI-2 specification. In memory, the data
    103     //    is constructed by packing sequentially received pixels
    104     //    into least significant parts of the words first.
    105     //    Within each pixel, the least significant bits are also
    106     //    placed towards the least significant part of the word.
    107     //
    108     //Details: Lay out of opaque raw data in memory is decided by two factors:
    109     //         opaque_raw_format and bit depth (implied by whiteLevel). Below
    110     //         list illustrates their relationship:
    111     //  LEGACY8:  P7(7:0) P6(7:0) P5(7:0) P4(7:0) P3(7:0) P2(7:0) P1(7:0) P0(7:0)
    112     //            8 pixels occupy 8 bytes, no padding needed
    113     //            min_stride = CEILING8(raw_width)
    114     // LEGACY10:  0000 P5(9:0) P4(9:0) P3(9:0) P2(9:0) P1(9:0) P0(9:0)
    115     //            6 pixels occupy 8 bytes, 4 bits padding at MSB
    116     //            min_stride = (raw_width+5)/6 * 8
    117     // LEGACY12:  0000 P4(11:0) P3(11:0) P2(11:0) P1(11:0) P0(11:0)
    118     //            5 pixels occupy 8 bytes, 4 bits padding at MSB
    119     //            min_stride = (raw_width+4)/5 * 8
    120     //    MIPI8:  P0(7:0)
    121     //            1 pixel occupy 1 byte
    122     //            min_stride = raw_width
    123     //   MIPI10:  P3(1:0) P2(1:0) P1(1:0) P0(1:0) P3(9:2) P2(9:2) P1(9:2) P0(9:2)
    124     //            4 pixels occupy 5 bytes
    125     //            min_stride = (raw_width+3)/4 * 5
    126     //   MIPI12:  P1(3:0) P0(3:0) P1(11:4) P0(11:4)
    127     //            2 pixels occupy 3 bytes
    128     //            min_stride = (raw_width+1)/2 * 3
    129     //Note that opaque_raw_stride needs to be at least the required minimum
    130     //stride from the table above. ISP hardware may need more generous stride
    131     //setting. For example, for LEGACY8, the actual stride may be
    132     //CEILING16(raw_width) due to bus burst length requirement.
    133     QCAMERA3_OPAQUE_RAW_FORMAT,
    134     QCAMERA3_OPAQUE_RAW_END,
    135 
    136     QCAMERA3_CROP_COUNT_REPROCESS = QCAMERA3_CROP_START,
    137     QCAMERA3_CROP_REPROCESS,
    138     QCAMERA3_CROP_ROI_MAP_REPROCESS,
    139     QCAMERA3_CROP_END,
    140 
    141     QCAMERA3_TUNING_META_DATA_BLOB = QCAMERA3_TUNING_META_DATA_START,
    142     QCAMERA3_TUNING_META_DATA_END,
    143 
    144     QCAMERA3_TEMPORAL_DENOISE_ENABLE = QCAMERA3_TEMPORAL_DENOISE_START,
    145     QCAMERA3_TEMPORAL_DENOISE_PROCESS_TYPE,
    146     QCAMERA3_TEMPORAL_DENOISE_END,
    147 
    148     QCAMERA3_USE_AV_TIMER = QCAMERA3_AV_TIMER_START,
    149     QCAMERA3_AV_TIMER_END,
    150 
    151     QCAMERA3_SENSOR_DYNAMIC_BLACK_LEVEL_PATTERN = QCAMERA3_SENSOR_META_DATA_START,
    152     QCAMERA3_SENSOR_IS_MONO_ONLY,
    153     QCAMERA3_SENSOR_META_DATA_END,
    154 
    155     QCAMERA3_DUALCAM_LINK_ENABLE = QCAMERA3_DUALCAM_LINK_META_DATA_START,
    156     QCAMERA3_DUALCAM_LINK_IS_MAIN,
    157     QCAMERA3_DUALCAM_LINK_RELATED_CAMERA_ID,
    158     QCAMERA3_DUALCAM_LINK_META_DATA_END,
    159 
    160     QCAMERA3_DUALCAM_CALIB_META_DATA_BLOB = QCAMERA3_DUALCAM_CALIB_META_DATA_START,
    161     QCAMERA3_DUALCAM_CALIB_META_DATA_END,
    162 
    163     QCAMERA3_HAL_PRIVATEDATA_REPROCESS_FLAGS = QCAMERA3_HAL_PRIVATEDATA_START,
    164     QCAMERA3_HAL_PRIVATEDATA_REPROCESS_DATA_BLOB,
    165     QCAMERA3_HAL_PRIVATEDATA_END,
    166 
    167     /* Property Name:  org.codeaurora.qcamera3.jpeg_encode_crop.enable
    168        Type: byte
    169        Description: If JPEG crop is enable
    170     */
    171     QCAMERA3_JPEG_ENCODE_CROP_ENABLE = QCAMERA3_JPEG_ENCODE_CROP_START,
    172     /* Property Name:  org.codeaurora.qcamera3.jpeg_encode_crop.rect
    173        Type: int32[4]
    174        Description: Crop image into size width x height
    175                     from [left, top] coordinate
    176        rect[0] = left
    177        rect[1] = top
    178        rect[2] = width
    179        rect[3] = height
    180     */
    181     QCAMERA3_JPEG_ENCODE_CROP_RECT,
    182     /* Property Name:  org.codeaurora.qcamera3.jpeg_encode_crop.roi
    183        Type: int32[4]
    184        Description: Scale the crop image into size width x height
    185                     from [left, top] coordinate.
    186        roi[0] = left
    187        roi[1] = top
    188        roi[2] = width
    189        roi[3] = height
    190     */
    191     QCAMERA3_JPEG_ENCODE_CROP_ROI,
    192     QCAMERA3_JPEG_ENCODE_CROP_END,
    193 
    194     QCAMERA3_VIDEO_HDR_MODE = QCAMERA3_VIDEO_HDR_START,
    195     QCAMERA3_AVAILABLE_VIDEO_HDR_MODES,
    196     QCAMERA3_VIDEO_HDR_END,
    197 
    198     QCAMERA3_IR_MODE = QCAMERA3_IR_START,
    199     QCAMERA3_IR_AVAILABLE_MODES,
    200     QCAMERA3_IR_END,
    201 
    202     QCAMERA3_AEC_CONVERGENCE_SPEED = QCAMERA3_AEC_CONVERGENCE_SPEED_START,
    203     QCAMERA3_AEC_CONVERGENCE_SPEED_END,
    204 
    205     QCAMERA3_AWB_CONVERGENCE_SPEED = QCAMERA3_AWB_CONVERGENCE_SPEED_START,
    206     QCAMERA3_AWB_CONVERGENCE_SPEED_END
    207 };
    208 
    209 // QCAMERA3_OPAQUE_RAW_FORMAT
    210 typedef enum qcamera3_ext_opaque_raw_format {
    211     QCAMERA3_OPAQUE_RAW_FORMAT_LEGACY,
    212     QCAMERA3_OPAQUE_RAW_FORMAT_MIPI
    213 } qcamera3_ext_opaque_raw_format_t;
    214 
    215 
    216 // QCAMERA3_VIDEO_HDR_MODE
    217 typedef enum camera_metadata_enum_android_video_hdr_mode {
    218     QCAMERA3_VIDEO_HDR_MODE_OFF,
    219     QCAMERA3_VIDEO_HDR_MODE_ON
    220 } camera_metadata_enum_android_video_hdr_mode_t;
    221 
    222 // QCAMERA3_IR_MODE
    223 typedef enum camera_metadata_enum_android_ir_mode {
    224     QCAMERA3_IR_MODE_OFF,
    225     QCAMERA3_IR_MODE_ON,
    226     QCAMERA3_IR_MODE_AUTO
    227 } camera_metadata_enum_android_ir_mode_t;
    228 
    229 class QCamera3VendorTags {
    230 
    231 public:
    232     static void get_vendor_tag_ops(vendor_tag_ops_t* ops);
    233     static int get_tag_count(
    234             const vendor_tag_ops_t *ops);
    235     static void get_all_tags(
    236             const vendor_tag_ops_t *ops,
    237             uint32_t *tag_array);
    238     static const char* get_section_name(
    239             const vendor_tag_ops_t *ops,
    240             uint32_t tag);
    241     static const char* get_tag_name(
    242             const vendor_tag_ops_t *ops,
    243             uint32_t tag);
    244     static int get_tag_type(
    245             const vendor_tag_ops_t *ops,
    246             uint32_t tag);
    247 
    248     static const vendor_tag_ops_t *Ops;
    249 };
    250 
    251 }; // namespace qcamera
    252 
    253 #endif /* __QCAMERA3VENDORTAGS_H__ */
    254