1 /* 2 * gstvaapifeiutils_h264.h - FEI related utilities for H264 3 * 4 * Copyright (C) 2016-2018 Intel Corporation 5 * Author: Wang, Yi <yi.a.wang@intel.com> 6 * Author: Sreerenj Balachandran <sreerenj.balachandran@intel.com> 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Lesser General Public License 10 * as published by the Free Software Foundation; either version 2.1 11 * of the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with this library; if not, write to the Free 20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 * Boston, MA 02110-1301 USA 22 */ 23 24 #ifndef GST_VAAPI_FEI_UTILS_H264_H 25 #define GST_VAAPI_FEI_UTILS_H264_H 26 27 #include <va/va.h> 28 29 G_BEGIN_DECLS 30 31 typedef struct _GstVaapiFeiInfoToPakH264 GstVaapiFeiInfoToPakH264; 32 33 /* Structure useful for FEI ENC+PAK mode */ 34 struct _GstVaapiFeiInfoToPakH264 35 { 36 VAEncSequenceParameterBufferH264 h264_enc_sps; 37 VAEncPictureParameterBufferH264 h264_enc_pps; 38 GArray *h264_slice_headers; 39 guint h264_slice_num; 40 }; 41 42 /******************* Common FEI enum definition for all codecs ***********/ 43 /* FeiFixme: This should be a common fei mode for all codecs, 44 * move to a common header file */ 45 #define GST_VAAPI_FEI_MODE_DEFAULT GST_VAAPI_FEI_MODE_ENC_PAK 46 typedef enum 47 { 48 GST_VAAPI_FEI_MODE_ENC = (1 << 0), 49 GST_VAAPI_FEI_MODE_PAK = (1 << 1), 50 GST_VAAPI_FEI_MODE_ENC_PAK = (1 << 2) 51 } GstVaapiFeiMode; 52 /** 53 * GST_VAAPI_TYPE_FEI_MODE: 54 * 55 * A type that represents the fei encoding mode. 56 * 57 * Return value: the #GType of GstVaapiFeiMode 58 */ 59 #define GST_VAAPI_TYPE_FEI_MODE (gst_vaapi_fei_mode_get_type()) 60 61 62 /******************* H264 Specific FEI enum definitions ***********/ 63 64 typedef enum 65 { 66 GST_VAAPI_FEI_H264_FULL_SEARCH_PATH = 0, 67 GST_VAAPI_FEI_H264_DIAMOND_SEARCH_PATH, 68 } GstVaapiFeiH264SearchPath; 69 70 typedef enum 71 { 72 GST_VAAPI_FEI_H264_SEARCH_WINDOW_NONE = 0, 73 GST_VAAPI_FEI_H264_SEARCH_WINDOW_TINY, 74 GST_VAAPI_FEI_H264_SEARCH_WINDOW_SMALL, 75 GST_VAAPI_FEI_H264_SEARCH_WINDOW_DIAMOND, 76 GST_VAAPI_FEI_H264_SEARCH_WINDOW_LARGE_DIAMOND, 77 GST_VAAPI_FEI_H264_SEARCH_WINDOW_EXHAUSTIVE, 78 GST_VAAPI_FEI_H264_SEARCH_WINDOW_HORI_DIAMOND, 79 GST_VAAPI_FEI_H264_SEARCH_WINDOW_HORI_LARGE_DIAMOND, 80 GST_VAAPI_FEI_H264_SEARCH_WINDOW_HORI_EXHAUSTIVE, 81 } GstVaapiFeiH264SearchWindow; 82 83 typedef enum 84 { 85 GST_VAAPI_FEI_H264_INTEGER_ME = 0, 86 GST_VAAPI_FEI_H264_HALF_ME = 1, 87 GST_VAAPI_FEI_H264_QUARTER_ME = 3, 88 } GstVaapiFeiH264SubPelMode; 89 90 typedef enum 91 { 92 GST_VAAPI_FEI_H264_SAD_NONE_TRANS = 0, 93 GST_VAAPI_FEI_H264_SAD_HAAR_TRANS = 2, 94 } GstVaapiFeiH264SadMode; 95 96 typedef enum 97 { 98 GST_VAAPI_FEI_H264_DISABLE_INTRA_NONE = 0, 99 GST_VAAPI_FEI_H264_DISABLE_INTRA_16x16 = (1 << 0), 100 GST_VAAPI_FEI_H264_DISABLE_INTRA_8x8 = (1 << 1), 101 GST_VAAPI_FEI_H264_DISABLE_INTRA_4x4 = (1 << 2), 102 } GstVaapiFeiH264IntraPartMask; 103 104 typedef enum 105 { 106 GST_VAAPI_FEI_H264_DISABLE_SUB_MB_PART_MASK_NONE = 0, 107 GST_VAAPI_FEI_H264_DISABLE_SUB_MB_PART_MASK_16x16 = (1 << 1), 108 GST_VAAPI_FEI_H264_DISABLE_SUB_MB_PART_MASK_2x16x8 = (1 << 2), 109 GST_VAAPI_FEI_H264_DISABLE_SUB_MB_PART_MASK_2x8x16 = (1 << 3), 110 GST_VAAPI_FEI_H264_DISABLE_SUB_MB_PART_MASK_1x8x8 = (1 << 4), 111 GST_VAAPI_FEI_H264_DISABLE_SUB_MB_PART_MASK_2x8x4 = (1 << 5), 112 GST_VAAPI_FEI_H264_DISABLE_SUB_MB_PART_MASK_2x4x8 = (1 << 6), 113 GST_VAAPI_FEI_H264_DISABLE_SUB_MB_PART_MASK_4x4x4 = (1 << 7), 114 } GstVaapiFeiH264SubMbPartMask; 115 116 #define GST_VAAPI_FEI_H264_SEARCH_PATH_DEFAULT \ 117 GST_VAAPI_FEI_H264_FULL_SEARCH_PATH 118 #define GST_VAAPI_FEI_H264_SEARCH_WINDOW_DEFAULT \ 119 GST_VAAPI_FEI_H264_SEARCH_WINDOW_NONE 120 #define GST_VAAPI_FEI_H264_SUB_PEL_MODE_DEFAULT \ 121 GST_VAAPI_FEI_H264_INTEGER_ME 122 #define GST_VAAPI_FEI_H264_SAD_MODE_DEFAULT \ 123 GST_VAAPI_FEI_H264_SAD_NONE_TRANS 124 #define GST_VAAPI_FEI_H264_INTRA_PART_MASK_DEFAULT \ 125 GST_VAAPI_FEI_H264_DISABLE_INTRA_NONE 126 #define GST_VAAPI_FEI_H264_SUB_MB_PART_MASK_DEFAULT \ 127 GST_VAAPI_FEI_H264_DISABLE_SUB_MB_PART_MASK_NONE 128 #define GST_VAAPI_FEI_H264_SEARCH_PATH_LENGTH_DEFAULT 32 129 #define GST_VAAPI_FEI_H264_REF_WIDTH_DEFAULT 32 130 #define GST_VAAPI_FEI_H264_REF_HEIGHT_DEFAULT 32 131 132 /** 133 * GST_VAAPI_TYPE_FEI_H264_SEARCH_PATH: 134 * 135 * A type that represents the fei control param: search path. 136 * 137 * Return value: the #GType of GstVaapiFeiSearchPath 138 */ 139 #define GST_VAAPI_TYPE_FEI_H264_SEARCH_PATH gst_vaapi_fei_h264_search_path_get_type() 140 141 /** 142 * GST_VAAPI_TYPE_FEI_H264_SEARCH_WINDOW: 143 * 144 * A type that represents the fei control param: search window. 145 * 146 * Return value: the #GType of GstVaapiFeiSearchWindow 147 */ 148 #define GST_VAAPI_TYPE_FEI_H264_SEARCH_WINDOW gst_vaapi_fei_h264_search_window_get_type() 149 150 /** 151 * GST_VAAPI_TYPE_FEI_H264_SAD_MODE: 152 * 153 * A type that represents the fei control param: sad mode. 154 * 155 * Return value: the #GType of GstVaapiFeiSadMode 156 */ 157 #define GST_VAAPI_TYPE_FEI_H264_SAD_MODE gst_vaapi_fei_h264_sad_mode_get_type() 158 159 /** 160 * GST_VAAPI_TYPE_FEI_H264_INTRA_PART_MASK: 161 * 162 * A type that represents the fei control param: intra part mask. 163 * 164 * Return value: the #GType of GstVaapiFeiIntaPartMask 165 */ 166 #define GST_VAAPI_TYPE_FEI_H264_INTRA_PART_MASK gst_vaapi_fei_h264_intra_part_mask_get_type() 167 168 /** 169 * GST_VAAPI_TYPE_FEI_H264_SUB_PEL_MODE: 170 * 171 * A type that represents the fei control param: sub pel mode. 172 * 173 * Return value: the #GType of GstVaapiFeiSubPelMode 174 */ 175 #define GST_VAAPI_TYPE_FEI_H264_SUB_PEL_MODE gst_vaapi_fei_h264_sub_pel_mode_get_type() 176 177 /** 178 * GST_VAAPI_TYPE_FEI_H264_SUB_MB_PART_MASK: 179 * 180 * A type that represents the fei control param: sub maroclock partition mask. 181 * 182 * Return value: the #GType of GstVaapiFeiH264SubMbPartMask 183 */ 184 #define GST_VAAPI_TYPE_FEI_H264_SUB_MB_PART_MASK gst_vaapi_fei_h264_sub_mb_part_mask_get_type() 185 186 GType 187 gst_vaapi_fei_mode_get_type (void) 188 G_GNUC_CONST; 189 190 GType 191 gst_vaapi_fei_h264_search_path_get_type (void) 192 G_GNUC_CONST; 193 194 GType 195 gst_vaapi_fei_h264_search_window_get_type (void) 196 G_GNUC_CONST; 197 198 GType 199 gst_vaapi_fei_h264_sad_mode_get_type (void) 200 G_GNUC_CONST; 201 202 GType 203 gst_vaapi_fei_h264_sub_pel_mode_get_type (void) 204 G_GNUC_CONST; 205 206 GType 207 gst_vaapi_fei_h264_intra_part_mask_get_type (void) 208 G_GNUC_CONST; 209 210 GType 211 gst_vaapi_fei_h264_sub_mb_part_mask_get_type (void) 212 G_GNUC_CONST; 213 214 G_END_DECLS 215 #endif /* GST_VAAPI_UTILS_FEI_H264_H */ 216