Home | History | Annotate | Download | only in HAL3
      1 /* Copyright (c) 2014, The Linux Foundataion. 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 namespace qcamera {
     34 
     35 enum qcamera3_ext_section {
     36     QCAMERA3_PRIVATEDATA = VENDOR_SECTION,
     37     QCAMERA3_CDS,
     38     QCAMERA3_OPAQUE_RAW,
     39     QCAMERA3_CROP,
     40     QCAMERA3_TUNING_META_DATA,
     41     QCAMERA3_AV_TIMER,
     42     QCAMERA3_SECTIONS_END
     43 };
     44 
     45 enum qcamera3_ext_section_ranges {
     46     QCAMERA3_PRIVATEDATA_START = QCAMERA3_PRIVATEDATA << 16,
     47     QCAMERA3_CDS_START = QCAMERA3_CDS << 16,
     48     QCAMERA3_OPAQUE_RAW_START = QCAMERA3_OPAQUE_RAW << 16,
     49     QCAMERA3_CROP_START = QCAMERA3_CROP << 16,
     50     QCAMERA3_TUNING_META_DATA_START = QCAMERA3_TUNING_META_DATA << 16,
     51     QCAMERA3_AV_TIMER_START = QCAMERA3_AV_TIMER << 16
     52 };
     53 
     54 enum qcamera3_ext_tags {
     55     QCAMERA3_PRIVATEDATA_REPROCESS = QCAMERA3_PRIVATEDATA_START,
     56     QCAMERA3_PRIVATEDATA_END,
     57     QCAMERA3_CDS_MODE = QCAMERA3_CDS_START,
     58     QCAMERA3_CDS_END,
     59 
     60     //Property Name:  org.codeaurora.qcamera3.opaque_raw.opaque_raw_strides
     61     //
     62     //Type: int32 * n * 3 [public]
     63     //
     64     //Description: Distance in bytes from the beginning of one row of opaque
     65     //raw image data to the beginning of next row.
     66     //
     67     //Details: The strides are listed as (raw_width, raw_height, stride)
     68     //triplets. For each supported raw size, there will be a stride associated
     69     //with it.
     70     QCAMERA3_OPAQUE_RAW_STRIDES = QCAMERA3_OPAQUE_RAW_START,
     71 
     72     //Property Name: org.codeaurora.qcamera3.opaque_raw.opaque_raw_format
     73     //
     74     //Type: byte(enum) [public]
     75     //  * LEGACY - The legacy raw format where 8, 10, or 12-bit
     76     //    raw data is packed into a 64-bit word.
     77     //  * MIPI - raw format matching the data packing described
     78     //    in MIPI CSI-2 specification. In memory, the data
     79     //    is constructed by packing sequentially received pixels
     80     //    into least significant parts of the words first.
     81     //    Within each pixel, the least significant bits are also
     82     //    placed towards the least significant part of the word.
     83     //
     84     //Details: Lay out of opaque raw data in memory is decided by two factors:
     85     //         opaque_raw_format and bit depth (implied by whiteLevel). Below
     86     //         list illustrates their relationship:
     87     //  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)
     88     //            8 pixels occupy 8 bytes, no padding needed
     89     //            min_stride = CEILING8(raw_width)
     90     // LEGACY10:  0000 P5(9:0) P4(9:0) P3(9:0) P2(9:0) P1(9:0) P0(9:0)
     91     //            6 pixels occupy 8 bytes, 4 bits padding at MSB
     92     //            min_stride = (raw_width+5)/6 * 8
     93     // LEGACY12:  0000 P4(11:0) P3(11:0) P2(11:0) P1(11:0) P0(11:0)
     94     //            5 pixels occupy 8 bytes, 4 bits padding at MSB
     95     //            min_stride = (raw_width+4)/5 * 8
     96     //    MIPI8:  P0(7:0)
     97     //            1 pixel occupy 1 byte, no padding needed
     98     //            min_stride = raw_width
     99     //   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)
    100     //            4 pixels occupy 5 bytes, no padding needed
    101     //            min_stride = (raw_width+3)/4 * 5
    102     //   MIPI12:  P1(3:0) P0(3:0) P1(11:4) P0(11:4)
    103     //            2 pixels occupy 3 bytes, no padding needed
    104     //            min_stride = (raw_width+1)/2 * 3
    105     //Note that opaque_raw_stride needs to be at least the required minimum
    106     //stride from the table above. ISP hardware may need more generous stride
    107     //setting. For example, for LEGACY8, the actual stride may be
    108     //CEILING16(raw_width) due to bus burst length requirement.
    109     QCAMERA3_OPAQUE_RAW_FORMAT,
    110     QCAMERA3_OPAQUE_RAW_END,
    111 
    112     QCAMERA3_CROP_COUNT_REPROCESS = QCAMERA3_CROP_START,
    113     QCAMERA3_CROP_REPROCESS,
    114     QCAMERA3_CROP_STREAM_ID_REPROCESS,
    115     QCAMERA3_CROP_END,
    116 
    117     QCAMERA3_TUNING_META_DATA_BLOB = QCAMERA3_TUNING_META_DATA_START,
    118     QCAMERA3_TUNING_META_DATA_END,
    119 
    120     QCAMERA3_USE_AV_TIMER = QCAMERA3_AV_TIMER_START,
    121     QCAMERA3_AV_TIMER_END
    122 };
    123 
    124 // QCAMERA3_OPAQUE_RAW_FORMAT
    125 typedef enum qcamera3_ext_opaque_raw_format {
    126     QCAMERA3_OPAQUE_RAW_FORMAT_LEGACY,
    127     QCAMERA3_OPAQUE_RAW_FORMAT_MIPI
    128 } qcamera3_ext_opaque_raw_format_t;
    129 
    130 class QCamera3VendorTags {
    131 
    132 public:
    133     static void get_vendor_tag_ops(vendor_tag_ops_t* ops);
    134     static int get_tag_count(
    135             const vendor_tag_ops_t *ops);
    136     static void get_all_tags(
    137             const vendor_tag_ops_t *ops,
    138             uint32_t *tag_array);
    139     static const char* get_section_name(
    140             const vendor_tag_ops_t *ops,
    141             uint32_t tag);
    142     static const char* get_tag_name(
    143             const vendor_tag_ops_t *ops,
    144             uint32_t tag);
    145     static int get_tag_type(
    146             const vendor_tag_ops_t *ops,
    147             uint32_t tag);
    148 
    149     static const vendor_tag_ops_t *Ops;
    150 };
    151 
    152 }; // namespace qcamera
    153 
    154 #endif /* __QCAMERA3VENDORTAGS_H__ */
    155