| 1 |
/* |
| 2 |
* Copyright (c) 2022, Intel Corporation |
| 3 |
* |
| 4 |
* Permission is hereby granted, free of charge, to any person obtaining a |
| 5 |
* copy of this software and associated documentation files (the "Software"), |
| 6 |
* to deal in the Software without restriction, including without limitation |
| 7 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 |
* and/or sell copies of the Software, and to permit persons to whom the |
| 9 |
* Software is furnished to do so, subject to the following conditions: |
| 10 |
* |
| 11 |
* The above copyright notice and this permission notice shall be included |
| 12 |
* in all copies or substantial portions of the Software. |
| 13 |
* |
| 14 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 15 |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 17 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 18 |
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 19 |
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 20 |
* OTHER DEALINGS IN THE SOFTWARE. |
| 21 |
*/ |
| 22 |
//! |
| 23 |
//! \file hal_kerneldll_next.h |
| 24 |
//! \brief Fast Compositing dynamic kernel linking/loading definitions |
| 25 |
//! |
| 26 |
#ifndef __HAL_KERNELDLL_NEXT_H__ |
| 27 |
#define __HAL_KERNELDLL_NEXT_H__ |
| 28 |
|
| 29 |
#include "mos_os.h" |
| 30 |
#include "media_common_defs.h" |
| 31 |
|
| 32 |
#if EMUL |
| 33 |
|
| 34 |
#include "support.h" |
| 35 |
|
| 36 |
// Search callback codes |
| 37 |
#define CB_REASON_SEARCH_FAILED -1 |
| 38 |
#define CB_REASON_UPDATE_FAILED -2 |
| 39 |
#define CB_REASON_BEGIN_SEARCH 0 |
| 40 |
#define CB_REASON_BEGIN_UPDATE 1 |
| 41 |
#define CB_REASON_END_SEARCH 2 |
| 42 |
|
| 43 |
#else // EMUL |
| 44 |
|
| 45 |
#endif // EMUL |
| 46 |
|
| 47 |
#define ROUND_FLOAT(n, factor) ((n) * (factor) + (((n) > 0.0f) ? 0.5f : -0.5f)) |
| 48 |
|
| 49 |
#define MIN_SHORT -32768.0f |
| 50 |
#define MAX_SHORT 32767.0f |
| 51 |
#define FLOAT_TO_SHORT(n) (short)(MOS_MIN(MOS_MAX(MIN_SHORT, n), MAX_SHORT)) |
| 52 |
|
| 53 |
#define DL_MAX_SEARCH_FILTER_SIZE 10 // max number of entries to describe a compositing filter |
| 54 |
|
| 55 |
#define DL_MAX_KERNELS 256 // Max component kernels to combine |
| 56 |
#define DL_MAX_PATCH_DATA_SIZE 64 // Max size of a patch block |
| 57 |
#define DL_MAX_PATCH_BLOCKS 8 // Max number of blocks to patch per patch data |
| 58 |
#define DL_MAX_PATCHES 8 // Max patches to use |
| 59 |
#define DL_MAX_EXPORT_COUNT 64 // size of the symbol export table |
| 60 |
|
| 61 |
#define DL_MAX_COMBINED_KERNELS 64 // Max number of kernels in cache |
| 62 |
#define DL_MAX_SYMBOLS 100 // max number of import/export symbols in a combined kernels |
| 63 |
#define DL_MAX_KERNEL_SIZE (160 * 1024) // max output kernel size |
| 64 |
|
| 65 |
#define DL_CSC_MAX 8 // 8 CSC matrices max |
| 66 |
#define DL_MAX_SEARCH_NODES_PER_KERNEL 6 // max number of search nodes for a component kernel (max tree depth) |
| 67 |
#define DL_MAX_COMPONENT_KERNELS 25 // max number of component kernels that can be combined |
| 68 |
|
| 69 |
#define DL_DEFAULT_COMBINED_KERNELS 4 // Default number of kernels in cache |
| 70 |
#define DL_NEW_COMBINED_KERNELS 4 // The increased number of kernels in cache each time |
| 71 |
#define DL_CACHE_BLOCK_SIZE (160 * 1024) // Kernel allocation block size |
| 72 |
#define DL_COMBINED_KERNEL_CACHE_SIZE (DL_CACHE_BLOCK_SIZE * DL_NEW_COMBINED_KERNELS) // Combined kernel size |
| 73 |
|
| 74 |
#define DL_PROCAMP_DISABLED -1 // procamp is disabled |
| 75 |
#define DL_PROCAMP_MAX 1 // 1 Procamp entry |
| 76 |
|
| 77 |
#define DL_CSC_DISABLED -1 // CSC is disabled |
| 78 |
|
| 79 |
#define DL_CSC_MAX_G5 2 // 2 CSC matrices max for Gen5 |
| 80 |
|
| 81 |
#define DL_CHROMASITING_DISABLE -1 // Chromasiting is disabled |
| 82 |
|
| 83 |
#ifdef __cplusplus |
| 84 |
extern "C" { |
| 85 |
#endif // __cplusplus |
| 86 |
|
| 87 |
typedef enum _MEDIA_CSPACE Kdll_CSpace; |
| 88 |
|
| 89 |
#define LumaKey_False 0 |
| 90 |
|
| 91 |
// Parameters for RID_Op_NewEntry |
| 92 |
#define RULE_DEFAULT 0 |
| 93 |
#define RULE_CUSTOM 1 |
| 94 |
#define RULE_NO_OVERRIDE 255 |
| 95 |
|
| 96 |
#define GROUP_DEFAULT RULE_DEFAULT |
| 97 |
#define GROUP_CUSTOM RULE_CUSTOM |
| 98 |
#define GROUP_NO_OVERRIDE RULE_NO_OVERRIDE |
| 99 |
|
| 100 |
#define ColorFill_Source -1 |
| 101 |
#define ColorFill_False 0 |
| 102 |
#define ColorFill_True 1 |
| 103 |
|
| 104 |
#define LumaKey_Source -1 |
| 105 |
|
| 106 |
#define LumaKey_True 1 |
| 107 |
|
| 108 |
#define Procamp_Source -1 |
| 109 |
|
| 110 |
// Dynamic Linking rule definitions |
| 111 |
#define RID_IS_MATCH(rid) ((rid & 0xFE00) == 0x0000) |
| 112 |
#define RID_IS_SET(rid) ((rid & 0xFE00) == 0x0200) |
| 113 |
#define RID_IS_EXTENDED(rid) ((rid & 0xFD00) == 0x0100) |
| 114 |
|
| 115 |
// Rotation Mode |
| 116 |
typedef enum tagKdll_Rotation |
| 117 |
{ |
| 118 |
Rotate_Source |
| 119 |
} Kdll_Rotation; |
| 120 |
|
| 121 |
// Kernel patches |
| 122 |
typedef enum tagKdll_PatchKind |
| 123 |
{ |
| 124 |
PatchKind_None = 0, |
| 125 |
PatchKind_CSC_Coeff_Src0 = 1, |
| 126 |
PatchKind_CSC_Coeff_Src1 = 2, |
| 127 |
} Kdll_PatchKind; |
| 128 |
|
| 129 |
// Patch rule entry (rule extension) |
| 130 |
typedef struct tagKdll_PatchRuleEntry |
| 131 |
{ |
| 132 |
uint32_t Dest : 16; // Patch destination in bytes (LSB) |
| 133 |
uint32_t Source : 8; // Patch data source in bytes |
| 134 |
uint32_t Size : 8; // Patch size in bytes (MSB) |
| 135 |
} Kdll_PatchRuleEntry; |
| 136 |
|
| 137 |
extern const char *g_cInit_ComponentNames[]; |
| 138 |
|
| 139 |
//------------------------------------------------------------ |
| 140 |
// KERNEL CACHE / LINK |
| 141 |
//------------------------------------------------------------ |
| 142 |
// Import/export structure from kernel binary file |
| 143 |
#pragma pack(4) |
| 144 |
typedef struct tagKdll_LinkFileHeader |
| 145 |
{ |
| 146 |
uint32_t dwVersion; |
| 147 |
uint32_t dwSize; |
| 148 |
uint32_t dwImports; |
| 149 |
uint32_t dwExports; |
| 150 |
} Kdll_LinkFileHeader; |
| 151 |
#pragma pack() |
| 152 |
|
| 153 |
const float g_cCSC_sRGB_stRGB[12] = |
| 154 |
{ |
| 155 |
0.858824f, 0.000000f, 0.000000f, 16.000000f, // stR = C0 * sR + C1 * sG + C2 * sB + C3 |
| 156 |
0.000000f, |
| 157 |
0.858824f, |
| 158 |
0.000000f, |
| 159 |
16.000000f, // stG = C4 * sR + C5 * sG + C6 * sB + C7 |
| 160 |
0.000000f, |
| 161 |
0.000000f, |
| 162 |
0.858824f, |
| 163 |
16.000000f // stB = C8 * sR + C9 * sG + C10 * sB + C11 |
| 164 |
}; |
| 165 |
|
| 166 |
const float g_cCSC_stRGB_sRGB[12] = |
| 167 |
{ |
| 168 |
1.164384f, 0.000000f, 0.000000f, -18.630137f, // sR = C0 * stR + C1 * stG + C2 * stB + C3 |
| 169 |
0.000000f, |
| 170 |
1.164384f, |
| 171 |
0.000000f, |
| 172 |
-18.630137f, // sG = C4 * stR + C5 * stG + C6 * stB + C7 |
| 173 |
0.000000f, |
| 174 |
0.000000f, |
| 175 |
1.164384f, |
| 176 |
-18.630137f // sB = C8 * stR + C9 * stG + C10 * stB + C11 |
| 177 |
}; |
| 178 |
|
| 179 |
//BT2020_RGB to BT2020_limited_RGB conversions |
| 180 |
const float g_cCSC_BT2020RGB_BT2020stRGB[12] = |
| 181 |
{ |
| 182 |
0.8563050f, 0.000000f, 0.000000f, 64.000000f, // sR = C0 * R + C1 * G + C2 * B + C3 |
| 183 |
0.000000f, |
| 184 |
0.8563050f, |
| 185 |
0.000000f, |
| 186 |
64.000000f, // sG = C4 * R + C5 * G + C6 * B + C7 |
| 187 |
0.000000f, |
| 188 |
0.000000f, |
| 189 |
0.8563050f, |
| 190 |
64.000000f // sB = C8 * R + C9 * G + C10 * B + C11 |
| 191 |
}; |
| 192 |
|
| 193 |
//BT2020_limited_RGB to BT2020_RGB conversions |
| 194 |
const float g_cCSC_BT2020stRGB_BT2020RGB[12] = |
| 195 |
{ |
| 196 |
1.1678082f, 0.000000f, 0.000000f, -74.739726f, // R = C0 * sR + C1 * sG + C2 * sB + C3 |
| 197 |
0.000000f, |
| 198 |
1.1678082f, |
| 199 |
0.000000f, |
| 200 |
-74.739726f, // G = C4 * sR + C5 * sG + C6 * sB + C7 |
| 201 |
0.000000f, |
| 202 |
0.000000f, |
| 203 |
1.1678082f, |
| 204 |
-74.739726f // B = C8 * sR + C9 * sG + C10 * sB + C11 |
| 205 |
}; |
| 206 |
|
| 207 |
const float g_cCSC_Identity[12] = |
| 208 |
{ |
| 209 |
1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f}; |
| 210 |
|
| 211 |
// Generic RGB to YUV conversion matrix from BT.601 standard |
| 212 |
const float g_cCSC_BT601_RGB_YUV[9] = |
| 213 |
{ |
| 214 |
0.299000f, 0.587000f, 0.114000f, -0.168736f, -0.331264f, 0.500000f, 0.500000f, -0.418688f, -0.081312f}; |
| 215 |
|
| 216 |
// Generic RGB to YUV conversion matrix from BT.709 standard |
| 217 |
const float g_cCSC_BT709_RGB_YUV[9] = |
| 218 |
{ |
| 219 |
0.212600f, 0.715200f, 0.072200f, -0.114572f, -0.385428f, 0.500000f, 0.500000f, -0.454153f, -0.045847f}; |
| 220 |
|
| 221 |
// Generic YUV to RGB conversion matrix from BT.601 standard |
| 222 |
const float g_cCSC_BT601_YUV_RGB[9] = |
| 223 |
{ |
| 224 |
1.000000f, 0.000000f, 1.402000f, 1.000000f, -0.344136f, -0.714136f, 1.000000f, 1.772000f, 0.000000f}; |
| 225 |
|
| 226 |
// Generic YUV to RGB conversion matrix from BT.709 standard |
| 227 |
const float g_cCSC_BT709_YUV_RGB[9] = |
| 228 |
{ |
| 229 |
1.000000f, 0.000000f, 1.574800f, 1.000000f, -0.187324f, -0.468124f, 1.000000f, 1.855600f, 0.000000f}; |
| 230 |
// BT2020 RGB to Non-constant YUV conversion matrix from R-REC-BT.2020-1-201406-I!!PDF-E.pdf |
| 231 |
const float g_cCSC_BT2020_RGB_YUV[9] = |
| 232 |
{ |
| 233 |
0.262700f, 0.678000f, 0.059300f, // Y |
| 234 |
-0.139630f, |
| 235 |
-0.360370f, |
| 236 |
0.500000f, // U |
| 237 |
0.500000f, |
| 238 |
-0.459786f, |
| 239 |
-0.040214f // V |
| 240 |
}; |
| 241 |
|
| 242 |
// BT2020 Non-constant YUV to RGB conversion matrix from R-REC-BT.2020-1-201406-I!!PDF-E.pdf |
| 243 |
const float g_cCSC_BT2020_YUV_RGB[9] = |
| 244 |
{ |
| 245 |
1.000000f, 0.000000f, 1.474600f, //R |
| 246 |
1.000000f, |
| 247 |
-0.164553f, |
| 248 |
-0.571353f, //G |
| 249 |
1.000000f, |
| 250 |
1.881400f, |
| 251 |
0.000000f //B |
| 252 |
}; |
| 253 |
|
| 254 |
// BT2020 YUV Limited Range to BT2020 RGB full range conversion matrix |
| 255 |
const float g_cCSC_BT2020_LimitedYUV_RGB[9] = |
| 256 |
{ |
| 257 |
1.164383f, 0.000000f, 1.678680f, // R |
| 258 |
1.164383f, -0.187332f, -0.650421f, // G |
| 259 |
1.164383f, 2.141769f, 0.000000f // B |
| 260 |
}; |
| 261 |
|
| 262 |
// BT2020 RGB full range to BT2020 YUV Limited Range tconversion matrix |
| 263 |
const float g_cCSC_BT2020_RGB_LimitedYUV[9] = |
| 264 |
{ |
| 265 |
0.225617f, 0.582275f, 0.050934f, // Y |
| 266 |
-0.122650f, -0.316559f, 0.439209f, // U |
| 267 |
0.439209f, -0.403885f, -0.035324f // V |
| 268 |
}; |
| 269 |
|
| 270 |
// Layer definition |
| 271 |
typedef enum _KDLL_LAYER |
| 272 |
{ |
| 273 |
Layer_Invalid = -2, // Invalid |
| 274 |
Layer_None = -1, // None |
| 275 |
Layer_Background = 0, // Background (0) |
| 276 |
Layer_MainVideo = 1, // Main video (1) |
| 277 |
Layer_SubVideo = 2, // Secondary video (2) |
| 278 |
Layer_SubPicture1 = 3, // Sub-picture 1 (3) |
| 279 |
Layer_SubPicture2 = 4, // Sub-picture 2 (4) |
| 280 |
Layer_SubPicture3 = 5, // Sub-picture 3 (5) [Gen6] |
| 281 |
Layer_SubPicture4 = 6, // Sub-picture 4 (6) [Gen6] |
| 282 |
Layer_Graphics = 14, // Graphics (7) |
| 283 |
Layer_RenderTarget = 15 // Render Target |
| 284 |
} Kdll_Layer; |
| 285 |
|
| 286 |
// Sampling mode |
| 287 |
// Please don't change the order in the enum is setup |
| 288 |
typedef enum tagKdll_Sampling |
| 289 |
{ |
| 290 |
Sample_None = -2, |
| 291 |
Sample_Source = -1, // Current source sampling |
| 292 |
Sample_Any = 0, |
| 293 |
Sample_Scaling_Any, // Scaling (any scaling factor) |
| 294 |
Sample_Scaling, // Scaling (above or equal 0.34x) |
| 295 |
Sample_Scaling_034x, // Scaling 0.34x (below 0.34x) |
| 296 |
Sample_iScaling, // Scaling (above or equal 0.34x) |
| 297 |
Sample_iScaling_034x, // Scaling 0.34x (below 0.34x) |
| 298 |
Sample_iScaling_AVS, //AVS Interlace Scaling on g75+ |
| 299 |
Sample_Scaling_AVS, // AVS Scaling on g575+ |
| 300 |
} Kdll_Sampling; |
| 301 |
|
| 302 |
// scaling ratio mode |
| 303 |
typedef enum tagKdll_scalingratio |
| 304 |
{ |
| 305 |
Scalingratio_Any = 0, // By default, or scaling ratio <=1/8 |
| 306 |
Scalingratio_over1, // Scaling ratio > 1 +1/6; |
| 307 |
Scalingratio_b1p2to1, // Scaling ratio (1/2, 1+1/6]; //NV12 need 1+1/6 support by kernel |
| 308 |
Scalingratio_b1p4to1p2, // Scaling ratio (1/4, 1/2]; |
| 309 |
Scalingratio_b1p8to1p4, // Scaling ratio (1/8, 1/4] |
| 310 |
} Kdll_Scalingratio; |
| 311 |
|
| 312 |
// Gen7+ : Shuffle data returned by Sample_8x8 message |
| 313 |
typedef enum tagKdll_Shuffling |
| 314 |
{ |
| 315 |
Shuffle_None = -1, |
| 316 |
Shuffle_Any = 0, |
| 317 |
Shuffle_All_8x8_Layer, // Mix of Sample_8x8 and others. Shuffle all 8x8 layer. |
| 318 |
Shuffle_RenderTarget // All layers are Sample_8x8. Shuffle only in RenderTarget |
| 319 |
} Kdll_Shuffling; |
| 320 |
|
| 321 |
// Gen7+ : Rendering method |
| 322 |
typedef enum tagKdll_RenderMethod |
| 323 |
{ |
| 324 |
RenderMethod_MediaObject = 0, |
| 325 |
RenderMethod_MediaObjectWalker = 1 |
| 326 |
} Kdll_RenderMethod; |
| 327 |
|
| 328 |
// Gen7+ : Set CSC Coefficients method |
| 329 |
typedef enum tagKdll_SetCSCCoeffMethod |
| 330 |
{ |
| 331 |
SetCSCCoeffMethod_Curbe = 0, |
| 332 |
SetCSCCoeffMethod_Patch = 1 |
| 333 |
} Kdll_SetCSCCoeffMethod; |
| 334 |
|
| 335 |
// Processing mode |
| 336 |
typedef enum tagKdll_Processing |
| 337 |
{ |
| 338 |
Process_None = -2, |
| 339 |
Process_Source = -1, // Current source processing |
| 340 |
Process_Any = 0, |
| 341 |
Process_Composite, // Composite 2 layers |
| 342 |
Process_XORComposite, // XOR mono composite. |
| 343 |
Process_PBlend, // Partial Blend 2 layers - 8-bits alpha |
| 344 |
Process_CBlend, // Constant Blend 2 layers - 8-bits alpha |
| 345 |
Process_SBlend, // Source Blend 2 layers - 8-bits alpha |
| 346 |
Process_SBlend_4bits, // Source Blend 2 layers - 4-bits alpha |
| 347 |
Process_CSBlend, // Constant multiply Source Blend 2 layers - 8-bits alpha (Source is NOT premultiplied) |
| 348 |
Process_CPBlend, // Constant multiply Source Blend 2 layers - 8-bits alpha (Source is Premultiplied) |
| 349 |
Process_DI, // Deinterlacing |
| 350 |
Process_DN, // Denoise |
| 351 |
Process_DNDI // DNDI |
| 352 |
} Kdll_Processing; |
| 353 |
|
| 354 |
typedef enum tagKdll_CSCType |
| 355 |
{ |
| 356 |
CSC_YUV_RGB = 0, // YUV to RGB color space conversion |
| 357 |
CSC_RGB_YUV = 1, // RGB to YUV color space conversion |
| 358 |
CSC_YUV_YUV = 2, // YUV to YUV color space conversion |
| 359 |
CSC_RGB_RGB = 3 // RGB to RGB color space conversion |
| 360 |
} Kdll_CSCType; |
| 361 |
|
| 362 |
// CSC Coefficients ID |
| 363 |
// Worst case we could have any many CSCs are there are number of layers (xvYcc case). So, 6 CoeffIDs defined to support 6 layers max |
| 364 |
typedef enum tagKdll_CoeffID |
| 365 |
{ |
| 366 |
CoeffID_Src0 = -5, // Src0 coefficients |
| 367 |
CoeffID_Src1 = -4, // Src1 coefficients |
| 368 |
CoeffID_Source = -3, // Current source coefficients |
| 369 |
CoeffID_Any = -2, // Any matrix |
| 370 |
CoeffID_None = -1, // No matrix -> no CSC |
| 371 |
CoeffID_0 = 0, |
| 372 |
CoeffID_1 = 1, |
| 373 |
CoeffID_2 = 2, |
| 374 |
CoeffID_3 = 3, |
| 375 |
CoeffID_4 = 4, |
| 376 |
CoeffID_5 = 5 |
| 377 |
} Kdll_CoeffID; |
| 378 |
|
| 379 |
// DL Parser State |
| 380 |
typedef enum tagKdll_ParserState |
| 381 |
{ |
| 382 |
Parser_Invalid = -1, // invalid state |
| 383 |
Parser_Begin = 0, // start dynamic linking |
| 384 |
Parser_SetRenderMethod, // MEDIA_OBJECT or MEDIA_OBJECT_WALKER rendering |
| 385 |
Parser_SetupLayer0, // setup layer 0 |
| 386 |
Parser_SetupLayer1, // setup layer 1 |
| 387 |
Parser_SetParamsLayer0, // setup parameters for layer 0 |
| 388 |
Parser_SetParamsLayer1, // setup parameters for layer 1 |
| 389 |
Parser_SetParamsTarget, // setup parameters for render target |
| 390 |
Parser_SampleLayer0, // sample layer 0 |
| 391 |
Parser_SampleLayer0Mix, // sample layer 0 need inter mix (interlaced scaling) |
| 392 |
Parser_SampleLayer0ColorFill, // sample layer 0 colorfill |
| 393 |
Parser_RotateLayer0Check, // check if layer 0 needs preComp rotation |
| 394 |
Parser_RotateLayer0, // PreComp layer 0 rotate |
| 395 |
Parser_SampleLayer0Done, // sample layer 0 is complete |
| 396 |
Parser_ShuffleLayer0, // shuffle layer 0 |
| 397 |
Parser_SampleLayer1, // sample layer 1 |
| 398 |
Parser_SampleLayer1Done, // sample layer 1 is complete |
| 399 |
Parser_ShuffleLayer1, // shuffle layer 1 |
| 400 |
Parser_SampleLayer0SelectCSC, // decided whether CSC be selected for Mix or jump to Parser_SampleLayer0Mix directly |
| 401 |
Parser_SetupCSC0, // CSC parameters setup for layer 0 |
| 402 |
Parser_ExecuteCSC0, // CSC on layer 0 |
| 403 |
Parser_ExecuteCSC0Done, // CSC on layer 0 is complete |
| 404 |
Parser_SetupCSC1, // CSC parameter setup for layer 1 |
| 405 |
Parser_ExecuteCSC1, // CSC on layer 1 |
| 406 |
Parser_ExecuteCSC1Done, // CSC on layer 1 is complete |
| 407 |
Parser_Lumakey, // lumakey |
| 408 |
Parser_ProcessLayer, // process layer 0 + layer 1 |
| 409 |
Parser_ProcessLayerDone, // processing is complete |
| 410 |
Parser_DualOutput, // dual output |
| 411 |
Parser_Rotation, // apply post composition rotation |
| 412 |
Parser_DestSurfIndex, // destination surface index |
| 413 |
Parser_Colorfill, // applying colorfill |
| 414 |
Parser_WriteOutput, // write output |
| 415 |
Parser_End, // end dynamic linking |
| 416 |
|
| 417 |
// This is used for custom states |
| 418 |
Parser_Custom, // Custom state |
| 419 |
|
| 420 |
// Number of states - keep this at the end |
| 421 |
Parser_Count |
| 422 |
} Kdll_ParserState; |
| 423 |
|
| 424 |
typedef enum tagKdll_RuleID |
| 425 |
{ |
| 426 |
// Parser/Patch Control |
| 427 |
RID_Op_EOF = -2, // End of search table |
| 428 |
RID_Op_NewEntry = -1, // New search entry |
| 429 |
|
| 430 |
// Simple Match Rules - 0x0000 to 0x0100 |
| 431 |
RID_IsTargetCspace = 0, // Match target color space |
| 432 |
RID_IsLayerID, // Match Layer ID |
| 433 |
RID_IsLayerFormat, // Match Layer Format |
| 434 |
RID_IsParserState, // Match Parser State |
| 435 |
RID_IsRenderMethod, // Match rendering mode, media object or media walker |
| 436 |
RID_IsShuffling, // Match Shuffling |
| 437 |
RID_IsDualOutput, // Match Dual Output |
| 438 |
RID_IsLayerRotation, // Match Rotation |
| 439 |
RID_IsRTRotate, // Match if RT rotates |
| 440 |
RID_IsSrc0Format, // Current Src0 source (surface) format |
| 441 |
RID_IsSrc0Sampling, // Current Src0 sampling mode |
| 442 |
RID_IsSrc0Rotation, // Match Layer0 Rotation |
| 443 |
RID_IsSrc0ColorFill, // Current Src0 Colorfill flag |
| 444 |
RID_IsSrc0LumaKey, // Current Src0 LumaKey flag |
| 445 |
RID_IsSrc0Procamp, // Match Src0 Procamp flag |
| 446 |
RID_IsSrc0Coeff, // Current Src0 CSC coefficients |
| 447 |
RID_IsSrc0Processing, // Current Src0 processing mode |
| 448 |
RID_IsSrc0Chromasiting, // Current Src0 Chromasiting mode |
| 449 |
RID_IsSrc1Format, // Current Src1 source (surface) format |
| 450 |
RID_IsSrc1Sampling, // Current Src1 sampling mode |
| 451 |
RID_IsSrc1LumaKey, // Current Src1 LumaKey flag |
| 452 |
RID_IsSrc1SamplerLumaKey, // Current Src1 Samper LumaKey flag |
| 453 |
RID_IsSrc1Procamp, // Match Src1 Procamp flag |
| 454 |
RID_IsSrc1Coeff, // Current Src1 CSC coefficients |
| 455 |
RID_IsSrc1Processing, // Current Src1 processing mode |
| 456 |
RID_IsSrc1Chromasiting, // Current Src1 Chromasiting mode |
| 457 |
RID_IsLayerNumber, // Current Layer number |
| 458 |
RID_IsQuadrant, // Current Quadrant |
| 459 |
RID_IsCSCBeforeMix, // CSC needed before Mix |
| 460 |
RID_IsTargetFormat, // Render Target Format |
| 461 |
RID_Is64BSaveEnabled, // Indicate whether 64B save kernel could be used |
| 462 |
RID_IsTargetTileType, // Render Target Tile Type |
| 463 |
RID_IsProcampEnabled, // Match Procamp |
| 464 |
RID_IsSetCoeffMode, // Set CSC coefficients mode |
| 465 |
RID_IsConstOutAlpha, // Match alpha fill mode |
| 466 |
RID_IsDitherNeeded, // Whether dithering needed |
| 467 |
RID_IsScalingRatio, // Current scaling ratio |
| 468 |
// Extended Match Rules - 0x0100 to 0x01ff |
| 469 |
|
| 470 |
// Simple Set Rules - 0x0200 to 0x02ff |
| 471 |
RID_SetTargetCspace = 512, // Set target color space |
| 472 |
RID_SetParserState, // Set Parser State |
| 473 |
RID_SetSrc0Format, // Set Src0 source format |
| 474 |
RID_SetSrc0Sampling, // Set Src0 sampling mode |
| 475 |
RID_SetSrc0Rotation, // Set Src0 rotation |
| 476 |
RID_SetSrc0ColorFill, // Set Src0 Colorfill |
| 477 |
RID_SetSrc0LumaKey, // Set Src0 LumaKey |
| 478 |
RID_SetSrc0Procamp, // Set Src0 Procamp flag |
| 479 |
RID_SetSrc0Coeff, // Set Src0 CSC coefficients |
| 480 |
RID_SetSrc0Processing, // Set Src0 Processing mode |
| 481 |
RID_SetSrc1Format, // Set Src1 source format |
| 482 |
RID_SetSrc1Sampling, // Set Src1 sampling mode |
| 483 |
RID_SetSrc1Rotation, // Set Src1 rotation |
| 484 |
RID_SetSrc1LumaKey, // Set Src1 LumaKey |
| 485 |
RID_SetSrc1SamplerLumaKey, // Set Src1 Sampler LumaKey |
| 486 |
RID_SetSrc1Procamp, // Set Src1 Procamp flag |
| 487 |
RID_SetSrc1Coeff, // Set Src1 CSC coefficients |
| 488 |
RID_SetSrc1Processing, // Set Src1 Processing mode |
| 489 |
RID_SetKernel, // Set Kernel |
| 490 |
RID_SetNextLayer, // Set Next Layer |
| 491 |
RID_SetPatchData, // Set Patch Data to use |
| 492 |
RID_SetQuadrant, // Set Quadrant |
| 493 |
RID_SetCSCBeforeMix, // Set CSC flag before Mix |
| 494 |
|
| 495 |
// Extended Set Rules - 0x0300 to 0x03ff |
| 496 |
RID_SetPatch = 768, // Set Patch block |
| 497 |
} Kdll_RuleID; |
| 498 |
|
| 499 |
typedef enum tagKdll_Logic |
| 500 |
{ |
| 501 |
Kdll_None, |
| 502 |
Kdll_Or, |
| 503 |
Kdll_Not, |
| 504 |
} Kdll_Logic; |
| 505 |
|
| 506 |
// Dynamic linking rule entry |
| 507 |
typedef struct tagKdll_RuleEntry |
| 508 |
{ |
| 509 |
Kdll_RuleID id : 16; // LSB |
| 510 |
int value : 16; // MSB |
| 511 |
Kdll_Logic logic; |
| 512 |
} Kdll_RuleEntry; |
| 513 |
|
| 514 |
typedef struct tagKdll_RuleEntrySet |
| 515 |
{ |
| 516 |
const Kdll_RuleEntry *pRuleEntry; // Pointer to the first meaningful rule of the set |
| 517 |
uint32_t iGroup : 8; // Group (default, custom, non-overridable) |
| 518 |
uint32_t iMatchCount : 12; // Size of Match Rules (including variable length rules) |
| 519 |
uint32_t iSetCount : 12; // Size of Set Rules (including variable length rules) |
| 520 |
} Kdll_RuleEntrySet; |
| 521 |
|
| 522 |
// Structure that defines a set of procamp parameters |
| 523 |
typedef struct tagKdll_Procamp |
| 524 |
{ |
| 525 |
bool bEnabled; // Procamp Enabled/Disabled |
| 526 |
int iProcampVersion; // Procamp parameters version |
| 527 |
float fBrightness; // Brightness : range = -100.0 - 100.0; default = 0.0; step = 0.1 |
| 528 |
float fContrast; // Contrast : range = 0.0 - 10.0; default = 1.0; step = 0.01 |
| 529 |
float fHue; // Hue : range = -180.0 - 180.0; default = 0.0; step = 0.1 |
| 530 |
float fSaturation; // Saturation : range = 0.0 - 10.0; default = 1.0; step = 0.01 |
| 531 |
} Kdll_Procamp; |
| 532 |
|
| 533 |
// Structure that defines CSC+PA conversion matrix |
| 534 |
typedef struct tagKdll_CSC_Matrix |
| 535 |
{ |
| 536 |
int bInUse : 1; // Matrix is in use and valid (LSB) |
| 537 |
int : 3; |
| 538 |
Kdll_CoeffID iCoeffID : 4; // Coeffient set |
| 539 |
MEDIA_CSPACE SrcSpace : 8; // Source Color Space |
| 540 |
MEDIA_CSPACE DstSpace : 8; // Destionation Color Space |
| 541 |
int iProcampID : 8; // Procamp parameter set (-1 if no Procamp) (MSB) |
| 542 |
int iProcampVersion; // Last procamp version (to recalculate matrix) |
| 543 |
short Coeff[12]; // CSC kernel coeff: [Y'/R'] [0 1 2] [Y/R] [ 3] |
| 544 |
// [U'/G'] = [4 5 6] * [U/G] + [ 7] |
| 545 |
// [V'/B'] [8 9 10] [V/B] [11] |
| 546 |
} Kdll_CSC_Matrix; |
| 547 |
|
| 548 |
// Structure that defines a full set of CSC or CSC+PA parameters to be used by a combined kernel |
| 549 |
typedef struct tagKdll_CSC_Params |
| 550 |
{ |
| 551 |
MEDIA_CSPACE ColorSpace; // Selected Color Space |
| 552 |
Kdll_CSC_Matrix Matrix[DL_CSC_MAX]; // CSC conversion matrix (3x3 + 1x3) |
| 553 |
uint8_t MatrixID[DL_CSC_MAX]; // Coefficient allocation array |
| 554 |
uint8_t PatchMatrixID[DL_CSC_MAX]; // CSC Matrix ID |
| 555 |
uint8_t PatchMatrixNum; // CSC Matrix Number |
| 556 |
} Kdll_CSC_Params; |
| 557 |
|
| 558 |
// Structure that defines a compositing layer |
| 559 |
typedef struct tagKdll_FilterEntry |
| 560 |
{ |
| 561 |
// Current layer |
| 562 |
Kdll_Layer layer; // source layer (Layer identification - Bg, Main, Sub, Gfx, ...) |
| 563 |
MOS_FORMAT format; // source format (Pixel/Sampling Format - ARBG, NV12, YUY2, ...) |
| 564 |
MEDIA_CSPACE cspace; // source color space (BT709, BT601, xvYCC709, xvYCC601, sRGB, ...) |
| 565 |
Kdll_Sampling sampler; // sampling mode (AVS, Scaling, ColorFill, Luma Keying, ...) |
| 566 |
int32_t colorfill : 16; // colorfill (true/false) |
| 567 |
int32_t lumakey : 16; // Luma key (true/false) |
| 568 |
int32_t samplerlumakey; // Sampler Lumakey (true/false) |
| 569 |
Kdll_Processing process; // processing mode (Compositing, Constant Blending, Source Blending, ...) |
| 570 |
int procamp; // index to procamp parameters (-1 of Procamp disabled) |
| 571 |
int matrix; // index to CSC matrix entry (-1 if CSC not required) |
| 572 |
MEDIA_ROTATION rotation; // rotation angle |
| 573 |
MOS_TILE_TYPE tiletype; // Tiling Type |
| 574 |
bool dualout; // dual output mode |
| 575 |
bool bWaEnableDscale; // enable DScale kernels for sampler-unrom issue |
| 576 |
bool bEnableDscale; // always enable DScale Kernels |
| 577 |
int32_t chromasiting; // chromasiting (-1 if Chromasiting is disabled) |
| 578 |
|
| 579 |
// This flag is used to select between kernels: |
| 580 |
// Save_RGB or Save_ARGB |
| 581 |
// Save_R10G10B10 or Save_R10G10B10A2 |
| 582 |
// Save_VUYA or Save_SrcVUYA |
| 583 |
bool bFillOutputAlphaWithConstant; |
| 584 |
bool bIsDitherNeeded; |
| 585 |
|
| 586 |
Kdll_Scalingratio ScalingRatio; |
| 587 |
Kdll_RenderMethod RenderMethod; |
| 588 |
Kdll_SetCSCCoeffMethod SetCSCCoeffMode; |
| 589 |
bool forceToTargetColorSpace; |
| 590 |
} Kdll_FilterEntry, *PKdll_FilterEntry; |
| 591 |
|
| 592 |
// Structure that defines a compositing filter |
| 593 |
typedef Kdll_FilterEntry Kdll_FilterDesc[DL_MAX_SEARCH_FILTER_SIZE]; |
| 594 |
|
| 595 |
typedef struct tagKdll_PatchBlock |
| 596 |
{ |
| 597 |
uint32_t DstOffset : 16; |
| 598 |
uint32_t SrcOffset : 8; |
| 599 |
uint32_t BlockSize : 8; |
| 600 |
} Kdll_PatchBlock; |
| 601 |
|
| 602 |
// Kernel Patching data |
| 603 |
typedef struct tagKdll_PatchData |
| 604 |
{ |
| 605 |
// Data for patching |
| 606 |
int iPatchDataSize; // Size of Patch data block |
| 607 |
uint8_t Data[DL_MAX_PATCH_DATA_SIZE]; // Patch data |
| 608 |
|
| 609 |
// Patches |
| 610 |
int nPatches; |
| 611 |
Kdll_PatchBlock Patch[DL_MAX_PATCH_BLOCKS]; |
| 612 |
} Kdll_PatchData; |
| 613 |
|
| 614 |
typedef struct tagKdll_LinkData |
| 615 |
{ |
| 616 |
uint32_t iKUID : 16; // Kernel Unique ID |
| 617 |
uint32_t iLabelID : 16; // Label ID |
| 618 |
uint32_t bExport : 1; // 0 - import; 1 - export; |
| 619 |
uint32_t bResolved : 1; // 0 - unresolved; 1 - resolved; |
| 620 |
uint32_t dwOffset : 20; // Offset in DWORDs |
| 621 |
uint32_t bInline : 1; // 0 - function; 1 - inline; |
| 622 |
uint32_t : 9; // MBZ |
| 623 |
} Kdll_LinkData; |
| 624 |
|
| 625 |
typedef struct tagKdll_Symbol |
| 626 |
{ |
| 627 |
uint32_t dwSize; |
| 628 |
uint32_t dwCount; |
| 629 |
Kdll_LinkData *pLink; |
| 630 |
} Kdll_Symbol; |
| 631 |
|
| 632 |
typedef struct tagKdll_CacheEntry |
| 633 |
{ |
| 634 |
// Kernel binary |
| 635 |
uint8_t *pBinary; // kernel binary |
| 636 |
int iSize; // kernel size |
| 637 |
int iPaddingSize; //kernel padding size |
| 638 |
|
| 639 |
// Component kernel information |
| 640 |
int iKUID; // kernel unique id (static kernel) |
| 641 |
const char * szName; // kernel name |
| 642 |
int nLink; // Number of imports/exports |
| 643 |
Kdll_LinkData *pLink; // Kernel imports/exports |
| 644 |
|
| 645 |
// Combined kernel information |
| 646 |
uint16_t wHashEntry; // hash table entry |
| 647 |
int iFilterSize; // kernel filter size |
| 648 |
Kdll_FilterEntry *pFilter; // kernel filter description |
| 649 |
Kdll_CSC_Params * pCscParams; // kernel CSC parameters |
| 650 |
MEDIA_CSPACE colorfill_cspace; // intermediate color space for colorfill |
| 651 |
|
| 652 |
// Cache control |
| 653 |
int iKCID; // kernel cache id (dynamically linked kernel) |
| 654 |
uint32_t dwLoaded; // kernel loaded flag |
| 655 |
uint32_t dwRefresh; // refresh counter (for expiration control) |
| 656 |
|
| 657 |
struct tagKdll_CacheEntry *pNextEntry; // Next cache entry; |
| 658 |
} Kdll_CacheEntry; |
| 659 |
|
| 660 |
typedef struct tagKdll_KernelCache |
| 661 |
{ |
| 662 |
int iCacheMaxEntries; // Max number of entries |
| 663 |
int iCacheEntries; // Current number of cache entries |
| 664 |
int iCacheSize; // Cache buffer size |
| 665 |
int iCacheFree; // Cache buffer free |
| 666 |
int iCacheID; // Next kernel cache ID |
| 667 |
Kdll_CacheEntry *pCacheEntries; // Array of kernel cache entries |
| 668 |
uint8_t * pCache; // Cache (binary data) |
| 669 |
int nExports; // Exports count |
| 670 |
Kdll_LinkData * pExports; // Exports table |
| 671 |
} Kdll_KernelCache; |
| 672 |
|
| 673 |
//-------------------------------------------------------------- |
| 674 |
// Kernel Hash table |
| 675 |
//-------------------------------------------------------------- |
| 676 |
typedef struct tagKdll_KernelHashEntry |
| 677 |
{ |
| 678 |
uint16_t next; // Next entry with same 8-bit hash + 1 (0 is null) |
| 679 |
uint32_t dwHash; // 32-bit hash value (FNV-1a hash) |
| 680 |
int iFilter; // Filter size |
| 681 |
Kdll_FilterEntry *pFilter; // Filter for matching |
| 682 |
Kdll_CacheEntry * pCacheEntry; // Pointer to kernel cache entry |
| 683 |
} Kdll_KernelHashEntry; |
| 684 |
|
| 685 |
typedef struct tagKdll_KernelHashTable |
| 686 |
{ |
| 687 |
uint16_t wHashTable[256]; // 256 hashes (1 based index) |
| 688 |
uint16_t pool; // first in pool (1 based index) |
| 689 |
uint16_t last; // last in pool (for releasing) |
| 690 |
Kdll_KernelHashEntry HashEntry[DL_MAX_COMBINED_KERNELS]; // Hash table entries |
| 691 |
} Kdll_KernelHashTable; |
| 692 |
|
| 693 |
//-------------------------------------------------------------- |
| 694 |
// Dynamic linking state |
| 695 |
//-------------------------------------------------------------- |
| 696 |
typedef struct tagKdll_State * PKdll_State; |
| 697 |
typedef struct tagKdll_SearchState *PKdll_SearchState; |
| 698 |
|
| 699 |
typedef struct tagKdll_State |
| 700 |
{ |
| 701 |
int iSize; // Size of DL buffer |
| 702 |
uint32_t dwRefresh; // Refresh counter (for garbage collection) |
| 703 |
bool bEnableCMFC; // Flag to enable CMFC |
| 704 |
|
| 705 |
// Default kernel component cache and rule table |
| 706 |
Kdll_KernelCache ComponentKernelCache; // Component kernels cache |
| 707 |
const Kdll_RuleEntry *pRuleTableDefault; // Default Dll rules (internal) |
| 708 |
|
| 709 |
// CMFC kernel fcpatch cache |
| 710 |
Kdll_KernelCache CmFcPatchCache; // CMFC kernel fcpatch cache |
| 711 |
|
| 712 |
// Custom kernel component cache and rule table |
| 713 |
Kdll_KernelCache * pCustomKernelCache; // Custom kernel cache |
| 714 |
const Kdll_RuleEntry *pRuleTableCustom; // Custom Dll rules (external) |
| 715 |
|
| 716 |
// Combined rule lookup table |
| 717 |
Kdll_RuleEntrySet *pSortedRules; // Sorted rule table |
| 718 |
|
| 719 |
Kdll_RuleEntrySet *pDllRuleTable[Parser_Count]; // Rule acceleration table (one entry for each Parser State) |
| 720 |
int iDllRuleCount[Parser_Count]; // Rule count (number of entries for each Parser State) |
| 721 |
|
| 722 |
// Combined kernel cache and hash table |
| 723 |
Kdll_KernelCache KernelCache; // Output kernel cache |
| 724 |
Kdll_KernelHashTable KernelHashTable; // Hash table for resulting kernels |
| 725 |
|
| 726 |
Kdll_Procamp *pProcamp; // Array of Procamp parameters |
| 727 |
int32_t iProcampSize; // Size of the array of Procamp parameters |
| 728 |
|
| 729 |
// Colorfill |
| 730 |
MEDIA_CSPACE colorfill_cspace; // Selected colorfill Color Space by Kdll |
| 731 |
|
| 732 |
// Start kernel search |
| 733 |
void (*pfnStartKernelSearch)(PKdll_State pState, |
| 734 |
PKdll_SearchState pSearchState, |
| 735 |
Kdll_FilterEntry * pFilter, |
| 736 |
int32_t iFilterSize, |
| 737 |
uint32_t uiIs64BInstrEnabled); |
| 738 |
|
| 739 |
// Find best ColorSpace to use internally, allocate/calculate CSC matrices and arguments |
| 740 |
bool (*pfnSetupCSC)(PKdll_State pState, |
| 741 |
PKdll_SearchState pSearchState); |
| 742 |
|
| 743 |
// Find rule that matches the current search state |
| 744 |
bool (*pfnFindRule)(PKdll_State pState, |
| 745 |
PKdll_SearchState pSearchState); |
| 746 |
|
| 747 |
// Update state based on rule |
| 748 |
bool (*pfnUpdateState)(PKdll_State pState, |
| 749 |
PKdll_SearchState pSearchState); |
| 750 |
|
| 751 |
// Search Kernel based for a given |
| 752 |
bool (*pfnSearchKernel)(PKdll_State pState, |
| 753 |
PKdll_SearchState pSearchState); |
| 754 |
|
| 755 |
// Build current best match kernel |
| 756 |
bool (*pfnBuildKernel)(PKdll_State pState, |
| 757 |
PKdll_SearchState pSearchState); |
| 758 |
|
| 759 |
// Map matrix to kernel CSC |
| 760 |
bool (*pfnMapCSCMatrix)(Kdll_CSCType type, |
| 761 |
const float * matrix, |
| 762 |
short * coeff); |
| 763 |
#if EMUL |
| 764 |
// Token to be passed back in Callbacks |
| 765 |
void *pToken; |
| 766 |
|
| 767 |
// Print Component Kernel |
| 768 |
void (*pfnCbListKernel)(void *token, |
| 769 |
const char * szKernel); |
| 770 |
|
| 771 |
// State update |
| 772 |
void (*pfnCbSearchSate)(void *token, |
| 773 |
int32_t reason, |
| 774 |
PKdll_SearchState pSearchState); |
| 775 |
#endif |
| 776 |
} Kdll_State; |
| 777 |
|
| 778 |
typedef struct tagKdll_SearchState |
| 779 |
{ |
| 780 |
// Kernel DLL state |
| 781 |
Kdll_State *pKdllState; // Kernel DLL State |
| 782 |
|
| 783 |
// Filter and CSC parameters |
| 784 |
Kdll_FilterDesc Filter; // Output Filter, with CSC data |
| 785 |
int iFilterSize; // Size of the filter |
| 786 |
Kdll_CSC_Params CscParams; // CSC parameters |
| 787 |
bool bCscBeforeMix; // flag to identify if CSC needed before Mix |
| 788 |
Kdll_Shuffling ShuffleSamplerData; // Gen7+ Shuffle sampler output |
| 789 |
|
| 790 |
// RT Rotate |
| 791 |
bool bRTRotate; |
| 792 |
|
| 793 |
// Procamp |
| 794 |
bool bProcamp; |
| 795 |
|
| 796 |
// Search output |
| 797 |
Kdll_RuleEntrySet *pMatchingRuleSet; // Pointer to the matching rule set |
| 798 |
|
| 799 |
// Kernels |
| 800 |
int KernelCount; // # of kernels |
| 801 |
int KernelID[DL_MAX_KERNELS]; // Array of kernel ids |
| 802 |
int KernelGrp[DL_MAX_KERNELS]; // Array of kernel groups |
| 803 |
int PatchID[DL_MAX_KERNELS]; // Array of patches |
| 804 |
|
| 805 |
// Kernel patches |
| 806 |
int PatchCount; // Number of patches |
| 807 |
Kdll_PatchData Patches[DL_MAX_PATCHES]; // Kernel patches |
| 808 |
|
| 809 |
// Current state |
| 810 |
Kdll_FilterEntry *pFilter; // Current filter entry |
| 811 |
Kdll_ParserState state; // Parser state |
| 812 |
MEDIA_CSPACE cspace; // Destination color space |
| 813 |
int quadrant; // Current quadrant |
| 814 |
int layer_number; // Current layer number |
| 815 |
|
| 816 |
// Src0 state |
| 817 |
MOS_FORMAT src0_format; // Src0 source format |
| 818 |
Kdll_Sampling src0_sampling; // Src0 sampling mode |
| 819 |
int32_t src0_colorfill; // Src0 colorfill flag |
| 820 |
int32_t src0_lumakey; // Src0 luma key |
| 821 |
int32_t src0_procamp; // Src0 procamp |
| 822 |
Kdll_CoeffID src0_coeff; // Src0 CSC coefficiants |
| 823 |
Kdll_Processing src0_process; // Src0 processing mode |
| 824 |
MEDIA_ROTATION src0_rotation; // Src0 Rotate |
| 825 |
|
| 826 |
// Src1 state |
| 827 |
MOS_FORMAT src1_format; // Src1 source format |
| 828 |
Kdll_Sampling src1_sampling; // Src1 sampling mode |
| 829 |
int32_t src1_lumakey; // Src1 luma key |
| 830 |
int32_t src1_samplerlumakey; // Src1 sampler luma key |
| 831 |
int32_t src1_procamp; // Src1 procamp |
| 832 |
Kdll_CoeffID src1_coeff; // Src1 CSC coefficients |
| 833 |
Kdll_Processing src1_process; // Src1 processing mode |
| 834 |
MEDIA_ROTATION src1_rotation; // Src1 Rotate |
| 835 |
|
| 836 |
// Render Target Format |
| 837 |
MOS_FORMAT target_format; // Render Target format |
| 838 |
|
| 839 |
bool b64BSaveEnabled; // Whether to use 64B save kernel |
| 840 |
MOS_TILE_TYPE target_tiletype; // Render Target Tile Type |
| 841 |
|
| 842 |
// Dynamic linking |
| 843 |
int KernelSize; // Kernel Size |
| 844 |
int KernelLeft; // Remaining size |
| 845 |
Kdll_Symbol KernelLink; // DL symbols for linking |
| 846 |
Kdll_LinkData LinkArray[DL_MAX_SYMBOLS]; // Import/Export symbols for dynamic linking |
| 847 |
uint8_t Kernel[DL_MAX_KERNEL_SIZE]; // Output Kernel |
| 848 |
} Kdll_SearchState; |
| 849 |
|
| 850 |
void KernelDll_ModifyFunctionPointers_Next(Kdll_State *pState); |
| 851 |
|
| 852 |
//--------------------------------- |
| 853 |
// Kernel DLL function prototypes |
| 854 |
//--------------------------------- |
| 855 |
|
| 856 |
bool KernelDll_IsYUVFormat(MOS_FORMAT format); |
| 857 |
|
| 858 |
bool KernelDll_IsFormat( |
| 859 |
MOS_FORMAT format, |
| 860 |
MEDIA_CSPACE cspace, |
| 861 |
MOS_FORMAT match); |
| 862 |
|
| 863 |
MEDIA_CSPACE KernelDll_TranslateCspace(MEDIA_CSPACE cspace); |
| 864 |
|
| 865 |
bool KernelDll_MapCSCMatrix( |
| 866 |
Kdll_CSCType type, |
| 867 |
const float *matrix, |
| 868 |
short * coeff); |
| 869 |
|
| 870 |
// Kernel Rule Search / State Update |
| 871 |
bool KernelDll_FindRule( |
| 872 |
Kdll_State * pState, |
| 873 |
Kdll_SearchState *pSearchState); |
| 874 |
|
| 875 |
bool KernelDll_UpdateState( |
| 876 |
Kdll_State * pState, |
| 877 |
Kdll_SearchState *pSearchState); |
| 878 |
|
| 879 |
bool KernelDll_IsCspace( |
| 880 |
MEDIA_CSPACE cspace, |
| 881 |
MEDIA_CSPACE match); |
| 882 |
|
| 883 |
void KernelDll_GetCSCMatrix( |
| 884 |
Kdll_CSpace src, |
| 885 |
Kdll_CSpace dst, |
| 886 |
float * pCSC_Matrix); |
| 887 |
|
| 888 |
void KernelDll_MatrixProduct( |
| 889 |
float *dest, |
| 890 |
const float *m1, |
| 891 |
const float *m2); |
| 892 |
|
| 893 |
// Simple Hash function |
| 894 |
uint32_t KernelDll_SimpleHash( |
| 895 |
void *pData, |
| 896 |
int iSize); |
| 897 |
|
| 898 |
// Setup Kernel Dll Procamp Parameters |
| 899 |
void KernelDll_SetupProcampParameters(Kdll_State *pState, |
| 900 |
Kdll_Procamp *pProcamp, |
| 901 |
int iProcampSize); |
| 902 |
|
| 903 |
// Find Kernel in hash table |
| 904 |
Kdll_CacheEntry * |
| 905 |
KernelDll_GetCombinedKernel(Kdll_State *pState, |
| 906 |
Kdll_FilterEntry *iFilter, |
| 907 |
int iFilterSize, |
| 908 |
uint32_t dwHash); |
| 909 |
|
| 910 |
//--------------------------------------------------------------------------------------- |
| 911 |
// KernelDll_SetupFunctionPointers - Setup Function pointers based on platform |
| 912 |
// |
| 913 |
// Parameters: |
| 914 |
// char *pState - [in] Kernel Dll state |
| 915 |
// platform - [in] platform |
| 916 |
// |
| 917 |
// Output: true - Function pointers are set |
| 918 |
// false - Failed to setup function pointers (invalid platform) |
| 919 |
//----------------------------------------------------------------------------------------- |
| 920 |
static bool KernelDll_SetupFunctionPointers( |
| 921 |
Kdll_State *pState, |
| 922 |
void (*ModifyFunctionPointers)(PKdll_State)); |
| 923 |
|
| 924 |
// Allocate Kernel Dll State |
| 925 |
Kdll_State *KernelDll_AllocateStates( |
| 926 |
void * pKernelCache, |
| 927 |
uint32_t uKernelCacheSize, |
| 928 |
void * pFcPatchCache, |
| 929 |
uint32_t uFcPatchCacheSize, |
| 930 |
const Kdll_RuleEntry *pInternalRules, |
| 931 |
void (*ModifyFunctionPointers)(PKdll_State)); |
| 932 |
|
| 933 |
// Release Kernel Dll State |
| 934 |
void KernelDll_ReleaseStates(Kdll_State *pState); |
| 935 |
|
| 936 |
// Update CSC coefficients |
| 937 |
void KernelDll_UpdateCscCoefficients(Kdll_State *pState, |
| 938 |
Kdll_CSC_Matrix * pMatrix); |
| 939 |
|
| 940 |
//Release the additional kernel cache entries |
| 941 |
void KernelDll_ReleaseAdditionalCacheEntries(Kdll_KernelCache *pCache); |
| 942 |
|
| 943 |
// Search kernel, output is in pSearchState |
| 944 |
bool KernelDll_SearchKernel( |
| 945 |
Kdll_State * pState, |
| 946 |
Kdll_SearchState *pSearchState); |
| 947 |
|
| 948 |
// Build kernel in SearchState |
| 949 |
bool KernelDll_BuildKernel(Kdll_State *pState, Kdll_SearchState *pSearchState); |
| 950 |
|
| 951 |
bool KernelDll_SetupCSC( |
| 952 |
Kdll_State * pState, |
| 953 |
Kdll_SearchState *pSearchState); |
| 954 |
|
| 955 |
// Add kernel to cache and hash table |
| 956 |
Kdll_CacheEntry * |
| 957 |
KernelDll_AddKernel(Kdll_State *pState, |
| 958 |
Kdll_SearchState *pSearchState, |
| 959 |
Kdll_FilterEntry *pFilter, |
| 960 |
int iFilterSize, |
| 961 |
uint32_t dwHash); |
| 962 |
|
| 963 |
// Allocate cache entry for a given size |
| 964 |
Kdll_CacheEntry * |
| 965 |
KernelDll_AllocateCacheEntry(Kdll_KernelCache *pCache, |
| 966 |
int32_t iSize); |
| 967 |
|
| 968 |
// Allocate more kernel cache entries |
| 969 |
Kdll_CacheEntry * |
| 970 |
KernelDll_AllocateAdditionalCacheEntries(Kdll_KernelCache *pCache); |
| 971 |
|
| 972 |
void KernelDll_ReleaseHashEntry(Kdll_KernelHashTable *pHashTable, uint16_t entry); |
| 973 |
void KernelDll_ReleaseCacheEntry(Kdll_KernelCache *pCache, Kdll_CacheEntry *pEntry); |
| 974 |
|
| 975 |
//--------------------------------------------------------------------------------------- |
| 976 |
// KernelDll_SetupFunctionPointers_Ext - Setup Extension Function pointers |
| 977 |
// |
| 978 |
// Parameters: |
| 979 |
// KdllState *pState - [in/out] Kernel Dll state |
| 980 |
// |
| 981 |
// Output: true - Function pointers are set |
| 982 |
// false - Failed to setup function pointers (invalid platform) |
| 983 |
//----------------------------------------------------------------------------------------- |
| 984 |
bool KernelDll_SetupFunctionPointers_Ext( |
| 985 |
Kdll_State *pState); |
| 986 |
|
| 987 |
#ifdef __cplusplus |
| 988 |
} |
| 989 |
#endif |
| 990 |
|
| 991 |
#endif // __HAL_KERNELDLL_NEXT_H__ |