| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 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 |
|
| 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 |
| 44 |
|
| 45 |
#endif |
| 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 |
| 86 |
|
| 87 |
typedef enum _MEDIA_CSPACE Kdll_CSpace; |
| 88 |
|
| 89 |
#define LumaKey_False 0 |
| 90 |
|
| 91 |
|
| 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 |
|
| 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 |
|
| 116 |
typedef enum tagKdll_Rotation |
| 117 |
{ |
| 118 |
Rotate_Source |
| 119 |
} Kdll_Rotation; |
| 120 |
|
| 121 |
|
| 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 |
|
| 130 |
typedef struct tagKdll_PatchRuleEntry |
| 131 |
{ |
| 132 |
uint32_t Dest : 16; |
| 133 |
uint32_t Source : 8; |
| 134 |
uint32_t Size : 8; |
| 135 |
} Kdll_PatchRuleEntry; |
| 136 |
|
| 137 |
extern const char *g_cInit_ComponentNames[]; |
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 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, |
| 156 |
0.000000f, |
| 157 |
0.858824f, |
| 158 |
0.000000f, |
| 159 |
16.000000f, |
| 160 |
0.000000f, |
| 161 |
0.000000f, |
| 162 |
0.858824f, |
| 163 |
16.000000f |
| 164 |
}; |
| 165 |
|
| 166 |
const float g_cCSC_stRGB_sRGB[12] = |
| 167 |
{ |
| 168 |
1.164384f, 0.000000f, 0.000000f, -18.630137f, |
| 169 |
0.000000f, |
| 170 |
1.164384f, |
| 171 |
0.000000f, |
| 172 |
-18.630137f, |
| 173 |
0.000000f, |
| 174 |
0.000000f, |
| 175 |
1.164384f, |
| 176 |
-18.630137f |
| 177 |
}; |
| 178 |
|
| 179 |
|
| 180 |
const float g_cCSC_BT2020RGB_BT2020stRGB[12] = |
| 181 |
{ |
| 182 |
0.8563050f, 0.000000f, 0.000000f, 64.000000f, |
| 183 |
0.000000f, |
| 184 |
0.8563050f, |
| 185 |
0.000000f, |
| 186 |
64.000000f, |
| 187 |
0.000000f, |
| 188 |
0.000000f, |
| 189 |
0.8563050f, |
| 190 |
64.000000f |
| 191 |
}; |
| 192 |
|
| 193 |
|
| 194 |
const float g_cCSC_BT2020stRGB_BT2020RGB[12] = |
| 195 |
{ |
| 196 |
1.1678082f, 0.000000f, 0.000000f, -74.739726f, |
| 197 |
0.000000f, |
| 198 |
1.1678082f, |
| 199 |
0.000000f, |
| 200 |
-74.739726f, |
| 201 |
0.000000f, |
| 202 |
0.000000f, |
| 203 |
1.1678082f, |
| 204 |
-74.739726f |
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 231 |
const float g_cCSC_BT2020_RGB_YUV[9] = |
| 232 |
{ |
| 233 |
0.262700f, 0.678000f, 0.059300f, |
| 234 |
-0.139630f, |
| 235 |
-0.360370f, |
| 236 |
0.500000f, |
| 237 |
0.500000f, |
| 238 |
-0.459786f, |
| 239 |
-0.040214f |
| 240 |
}; |
| 241 |
|
| 242 |
|
| 243 |
const float g_cCSC_BT2020_YUV_RGB[9] = |
| 244 |
{ |
| 245 |
1.000000f, 0.000000f, 1.474600f, |
| 246 |
1.000000f, |
| 247 |
-0.164553f, |
| 248 |
-0.571353f, |
| 249 |
1.000000f, |
| 250 |
1.881400f, |
| 251 |
0.000000f |
| 252 |
}; |
| 253 |
|
| 254 |
|
| 255 |
const float g_cCSC_BT2020_LimitedYUV_RGB[9] = |
| 256 |
{ |
| 257 |
1.164383f, 0.000000f, 1.678680f, |
| 258 |
1.164383f, -0.187332f, -0.650421f, |
| 259 |
1.164383f, 2.141769f, 0.000000f |
| 260 |
}; |
| 261 |
|
| 262 |
|
| 263 |
const float g_cCSC_BT2020_RGB_LimitedYUV[9] = |
| 264 |
{ |
| 265 |
0.225617f, 0.582275f, 0.050934f, |
| 266 |
-0.122650f, -0.316559f, 0.439209f, |
| 267 |
0.439209f, -0.403885f, -0.035324f |
| 268 |
}; |
| 269 |
|
| 270 |
|
| 271 |
typedef enum _KDLL_LAYER |
| 272 |
{ |
| 273 |
Layer_Invalid = -2, |
| 274 |
Layer_None = -1, |
| 275 |
Layer_Background = 0, |
| 276 |
Layer_MainVideo = 1, |
| 277 |
Layer_SubVideo = 2, |
| 278 |
Layer_SubPicture1 = 3, |
| 279 |
Layer_SubPicture2 = 4, |
| 280 |
Layer_SubPicture3 = 5, |
| 281 |
Layer_SubPicture4 = 6, |
| 282 |
Layer_Graphics = 14, |
| 283 |
Layer_RenderTarget = 15 |
| 284 |
} Kdll_Layer; |
| 285 |
|
| 286 |
|
| 287 |
|
| 288 |
typedef enum tagKdll_Sampling |
| 289 |
{ |
| 290 |
Sample_None = -2, |
| 291 |
Sample_Source = -1, |
| 292 |
Sample_Any = 0, |
| 293 |
Sample_Scaling_Any, |
| 294 |
Sample_Scaling, |
| 295 |
Sample_Scaling_034x, |
| 296 |
Sample_iScaling, |
| 297 |
Sample_iScaling_034x, |
| 298 |
Sample_iScaling_AVS, |
| 299 |
Sample_Scaling_AVS, |
| 300 |
} Kdll_Sampling; |
| 301 |
|
| 302 |
|
| 303 |
typedef enum tagKdll_scalingratio |
| 304 |
{ |
| 305 |
Scalingratio_Any = 0, |
| 306 |
Scalingratio_over1, |
| 307 |
Scalingratio_b1p2to1, |
| 308 |
Scalingratio_b1p4to1p2, |
| 309 |
Scalingratio_b1p8to1p4, |
| 310 |
} Kdll_Scalingratio; |
| 311 |
|
| 312 |
|
| 313 |
typedef enum tagKdll_Shuffling |
| 314 |
{ |
| 315 |
Shuffle_None = -1, |
| 316 |
Shuffle_Any = 0, |
| 317 |
Shuffle_All_8x8_Layer, |
| 318 |
Shuffle_RenderTarget |
| 319 |
} Kdll_Shuffling; |
| 320 |
|
| 321 |
|
| 322 |
typedef enum tagKdll_RenderMethod |
| 323 |
{ |
| 324 |
RenderMethod_MediaObject = 0, |
| 325 |
RenderMethod_MediaObjectWalker = 1 |
| 326 |
} Kdll_RenderMethod; |
| 327 |
|
| 328 |
|
| 329 |
typedef enum tagKdll_SetCSCCoeffMethod |
| 330 |
{ |
| 331 |
SetCSCCoeffMethod_Curbe = 0, |
| 332 |
SetCSCCoeffMethod_Patch = 1 |
| 333 |
} Kdll_SetCSCCoeffMethod; |
| 334 |
|
| 335 |
|
| 336 |
typedef enum tagKdll_Processing |
| 337 |
{ |
| 338 |
Process_None = -2, |
| 339 |
Process_Source = -1, |
| 340 |
Process_Any = 0, |
| 341 |
Process_Composite, |
| 342 |
Process_XORComposite, |
| 343 |
Process_PBlend, |
| 344 |
Process_CBlend, |
| 345 |
Process_SBlend, |
| 346 |
Process_SBlend_4bits, |
| 347 |
Process_CSBlend, |
| 348 |
Process_CPBlend, |
| 349 |
Process_DI, |
| 350 |
Process_DN, |
| 351 |
Process_DNDI |
| 352 |
} Kdll_Processing; |
| 353 |
|
| 354 |
typedef enum tagKdll_CSCType |
| 355 |
{ |
| 356 |
CSC_YUV_RGB = 0, |
| 357 |
CSC_RGB_YUV = 1, |
| 358 |
CSC_YUV_YUV = 2, |
| 359 |
CSC_RGB_RGB = 3 |
| 360 |
} Kdll_CSCType; |
| 361 |
|
| 362 |
|
| 363 |
|
| 364 |
typedef enum tagKdll_CoeffID |
| 365 |
{ |
| 366 |
CoeffID_Src0 = -5, |
| 367 |
CoeffID_Src1 = -4, |
| 368 |
CoeffID_Source = -3, |
| 369 |
CoeffID_Any = -2, |
| 370 |
CoeffID_None = -1, |
| 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 |
|
| 380 |
typedef enum tagKdll_ParserState |
| 381 |
{ |
| 382 |
Parser_Invalid = -1, |
| 383 |
Parser_Begin = 0, |
| 384 |
Parser_SetRenderMethod, |
| 385 |
Parser_SetupLayer0, |
| 386 |
Parser_SetupLayer1, |
| 387 |
Parser_SetParamsLayer0, |
| 388 |
Parser_SetParamsLayer1, |
| 389 |
Parser_SetParamsTarget, |
| 390 |
Parser_SampleLayer0, |
| 391 |
Parser_SampleLayer0Mix, |
| 392 |
Parser_SampleLayer0ColorFill, |
| 393 |
Parser_RotateLayer0Check, |
| 394 |
Parser_RotateLayer0, |
| 395 |
Parser_SampleLayer0Done, |
| 396 |
Parser_ShuffleLayer0, |
| 397 |
Parser_SampleLayer1, |
| 398 |
Parser_SampleLayer1Done, |
| 399 |
Parser_ShuffleLayer1, |
| 400 |
Parser_SampleLayer0SelectCSC, |
| 401 |
Parser_SetupCSC0, |
| 402 |
Parser_ExecuteCSC0, |
| 403 |
Parser_ExecuteCSC0Done, |
| 404 |
Parser_SetupCSC1, |
| 405 |
Parser_ExecuteCSC1, |
| 406 |
Parser_ExecuteCSC1Done, |
| 407 |
Parser_Lumakey, |
| 408 |
Parser_ProcessLayer, |
| 409 |
Parser_ProcessLayerDone, |
| 410 |
Parser_DualOutput, |
| 411 |
Parser_Rotation, |
| 412 |
Parser_DestSurfIndex, |
| 413 |
Parser_Colorfill, |
| 414 |
Parser_WriteOutput, |
| 415 |
Parser_End, |
| 416 |
|
| 417 |
|
| 418 |
Parser_Custom, |
| 419 |
|
| 420 |
|
| 421 |
Parser_Count |
| 422 |
} Kdll_ParserState; |
| 423 |
|
| 424 |
typedef enum tagKdll_RuleID |
| 425 |
{ |
| 426 |
|
| 427 |
RID_Op_EOF = -2, |
| 428 |
RID_Op_NewEntry = -1, |
| 429 |
|
| 430 |
|
| 431 |
RID_IsTargetCspace = 0, |
| 432 |
RID_IsLayerID, |
| 433 |
RID_IsLayerFormat, |
| 434 |
RID_IsParserState, |
| 435 |
RID_IsRenderMethod, |
| 436 |
RID_IsShuffling, |
| 437 |
RID_IsDualOutput, |
| 438 |
RID_IsLayerRotation, |
| 439 |
RID_IsRTRotate, |
| 440 |
RID_IsSrc0Format, |
| 441 |
RID_IsSrc0Sampling, |
| 442 |
RID_IsSrc0Rotation, |
| 443 |
RID_IsSrc0ColorFill, |
| 444 |
RID_IsSrc0LumaKey, |
| 445 |
RID_IsSrc0Procamp, |
| 446 |
RID_IsSrc0Coeff, |
| 447 |
RID_IsSrc0Processing, |
| 448 |
RID_IsSrc0Chromasiting, |
| 449 |
RID_IsSrc1Format, |
| 450 |
RID_IsSrc1Sampling, |
| 451 |
RID_IsSrc1LumaKey, |
| 452 |
RID_IsSrc1SamplerLumaKey, |
| 453 |
RID_IsSrc1Procamp, |
| 454 |
RID_IsSrc1Coeff, |
| 455 |
RID_IsSrc1Processing, |
| 456 |
RID_IsSrc1Chromasiting, |
| 457 |
RID_IsLayerNumber, |
| 458 |
RID_IsQuadrant, |
| 459 |
RID_IsCSCBeforeMix, |
| 460 |
RID_IsTargetFormat, |
| 461 |
RID_Is64BSaveEnabled, |
| 462 |
RID_IsTargetTileType, |
| 463 |
RID_IsProcampEnabled, |
| 464 |
RID_IsSetCoeffMode, |
| 465 |
RID_IsConstOutAlpha, |
| 466 |
RID_IsDitherNeeded, |
| 467 |
RID_IsScalingRatio, |
| 468 |
|
| 469 |
|
| 470 |
|
| 471 |
RID_SetTargetCspace = 512, |
| 472 |
RID_SetParserState, |
| 473 |
RID_SetSrc0Format, |
| 474 |
RID_SetSrc0Sampling, |
| 475 |
RID_SetSrc0Rotation, |
| 476 |
RID_SetSrc0ColorFill, |
| 477 |
RID_SetSrc0LumaKey, |
| 478 |
RID_SetSrc0Procamp, |
| 479 |
RID_SetSrc0Coeff, |
| 480 |
RID_SetSrc0Processing, |
| 481 |
RID_SetSrc1Format, |
| 482 |
RID_SetSrc1Sampling, |
| 483 |
RID_SetSrc1Rotation, |
| 484 |
RID_SetSrc1LumaKey, |
| 485 |
RID_SetSrc1SamplerLumaKey, |
| 486 |
RID_SetSrc1Procamp, |
| 487 |
RID_SetSrc1Coeff, |
| 488 |
RID_SetSrc1Processing, |
| 489 |
RID_SetKernel, |
| 490 |
RID_SetNextLayer, |
| 491 |
RID_SetPatchData, |
| 492 |
RID_SetQuadrant, |
| 493 |
RID_SetCSCBeforeMix, |
| 494 |
|
| 495 |
|
| 496 |
RID_SetPatch = 768, |
| 497 |
} Kdll_RuleID; |
| 498 |
|
| 499 |
typedef enum tagKdll_Logic |
| 500 |
{ |
| 501 |
Kdll_None, |
| 502 |
Kdll_Or, |
| 503 |
Kdll_Not, |
| 504 |
} Kdll_Logic; |
| 505 |
|
| 506 |
|
| 507 |
typedef struct tagKdll_RuleEntry |
| 508 |
{ |
| 509 |
Kdll_RuleID id : 16; |
| 510 |
int value : 16; |
| 511 |
Kdll_Logic logic; |
| 512 |
} Kdll_RuleEntry; |
| 513 |
|
| 514 |
typedef struct tagKdll_RuleEntrySet |
| 515 |
{ |
| 516 |
const Kdll_RuleEntry *pRuleEntry; |
| 517 |
uint32_t iGroup : 8; |
| 518 |
uint32_t iMatchCount : 12; |
| 519 |
uint32_t iSetCount : 12; |
| 520 |
} Kdll_RuleEntrySet; |
| 521 |
|
| 522 |
|
| 523 |
typedef struct tagKdll_Procamp |
| 524 |
{ |
| 525 |
bool bEnabled; |
| 526 |
int iProcampVersion; |
| 527 |
float fBrightness; |
| 528 |
float fContrast; |
| 529 |
float fHue; |
| 530 |
float fSaturation; |
| 531 |
} Kdll_Procamp; |
| 532 |
|
| 533 |
|
| 534 |
typedef struct tagKdll_CSC_Matrix |
| 535 |
{ |
| 536 |
int bInUse : 1; |
| 537 |
int : 3; |
| 538 |
Kdll_CoeffID iCoeffID : 4; |
| 539 |
MEDIA_CSPACE SrcSpace : 8; |
| 540 |
MEDIA_CSPACE DstSpace : 8; |
| 541 |
int iProcampID : 8; |
| 542 |
int iProcampVersion; |
| 543 |
short Coeff[12]; |
| 544 |
|
| 545 |
|
| 546 |
} Kdll_CSC_Matrix; |
| 547 |
|
| 548 |
|
| 549 |
typedef struct tagKdll_CSC_Params |
| 550 |
{ |
| 551 |
MEDIA_CSPACE ColorSpace; |
| 552 |
Kdll_CSC_Matrix Matrix[DL_CSC_MAX]; |
| 553 |
uint8_t MatrixID[DL_CSC_MAX]; |
| 554 |
uint8_t PatchMatrixID[DL_CSC_MAX]; |
| 555 |
uint8_t PatchMatrixNum; |
| 556 |
} Kdll_CSC_Params; |
| 557 |
|
| 558 |
|
| 559 |
typedef struct tagKdll_FilterEntry |
| 560 |
{ |
| 561 |
|
| 562 |
Kdll_Layer layer; |
| 563 |
MOS_FORMAT format; |
| 564 |
MEDIA_CSPACE cspace; |
| 565 |
Kdll_Sampling sampler; |
| 566 |
int32_t colorfill : 16; |
| 567 |
int32_t lumakey : 16; |
| 568 |
int32_t samplerlumakey; |
| 569 |
Kdll_Processing process; |
| 570 |
int procamp; |
| 571 |
int matrix; |
| 572 |
MEDIA_ROTATION rotation; |
| 573 |
MOS_TILE_TYPE tiletype; |
| 574 |
bool dualout; |
| 575 |
bool bWaEnableDscale; |
| 576 |
bool bEnableDscale; |
| 577 |
int32_t chromasiting; |
| 578 |
|
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
|
| 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 |
|
| 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 |
|
| 603 |
typedef struct tagKdll_PatchData |
| 604 |
{ |
| 605 |
|
| 606 |
int iPatchDataSize; |
| 607 |
uint8_t Data[DL_MAX_PATCH_DATA_SIZE]; |
| 608 |
|
| 609 |
|
| 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; |
| 617 |
uint32_t iLabelID : 16; |
| 618 |
uint32_t bExport : 1; |
| 619 |
uint32_t bResolved : 1; |
| 620 |
uint32_t dwOffset : 20; |
| 621 |
uint32_t bInline : 1; |
| 622 |
uint32_t : 9; |
| 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 |
|
| 635 |
uint8_t *pBinary; |
| 636 |
int iSize; |
| 637 |
int iPaddingSize; |
| 638 |
|
| 639 |
|
| 640 |
int iKUID; |
| 641 |
const char * szName; |
| 642 |
int nLink; |
| 643 |
Kdll_LinkData *pLink; |
| 644 |
|
| 645 |
|
| 646 |
uint16_t wHashEntry; |
| 647 |
int iFilterSize; |
| 648 |
Kdll_FilterEntry *pFilter; |
| 649 |
Kdll_CSC_Params * pCscParams; |
| 650 |
MEDIA_CSPACE colorfill_cspace; |
| 651 |
|
| 652 |
|
| 653 |
int iKCID; |
| 654 |
uint32_t dwLoaded; |
| 655 |
uint32_t dwRefresh; |
| 656 |
|
| 657 |
struct tagKdll_CacheEntry *pNextEntry; |
| 658 |
} Kdll_CacheEntry; |
| 659 |
|
| 660 |
typedef struct tagKdll_KernelCache |
| 661 |
{ |
| 662 |
int iCacheMaxEntries; |
| 663 |
int iCacheEntries; |
| 664 |
int iCacheSize; |
| 665 |
int iCacheFree; |
| 666 |
int iCacheID; |
| 667 |
Kdll_CacheEntry *pCacheEntries; |
| 668 |
uint8_t * pCache; |
| 669 |
int nExports; |
| 670 |
Kdll_LinkData * pExports; |
| 671 |
} Kdll_KernelCache; |
| 672 |
|
| 673 |
|
| 674 |
|
| 675 |
|
| 676 |
typedef struct tagKdll_KernelHashEntry |
| 677 |
{ |
| 678 |
uint16_t next; |
| 679 |
uint32_t dwHash; |
| 680 |
int iFilter; |
| 681 |
Kdll_FilterEntry *pFilter; |
| 682 |
Kdll_CacheEntry * pCacheEntry; |
| 683 |
} Kdll_KernelHashEntry; |
| 684 |
|
| 685 |
typedef struct tagKdll_KernelHashTable |
| 686 |
{ |
| 687 |
uint16_t wHashTable[256]; |
| 688 |
uint16_t pool; |
| 689 |
uint16_t last; |
| 690 |
Kdll_KernelHashEntry HashEntry[DL_MAX_COMBINED_KERNELS]; |
| 691 |
} Kdll_KernelHashTable; |
| 692 |
|
| 693 |
|
| 694 |
|
| 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; |
| 702 |
uint32_t dwRefresh; |
| 703 |
bool bEnableCMFC; |
| 704 |
|
| 705 |
|
| 706 |
Kdll_KernelCache ComponentKernelCache; |
| 707 |
const Kdll_RuleEntry *pRuleTableDefault; |
| 708 |
|
| 709 |
|
| 710 |
Kdll_KernelCache CmFcPatchCache; |
| 711 |
|
| 712 |
|
| 713 |
Kdll_KernelCache * pCustomKernelCache; |
| 714 |
const Kdll_RuleEntry *pRuleTableCustom; |
| 715 |
|
| 716 |
|
| 717 |
Kdll_RuleEntrySet *pSortedRules; |
| 718 |
|
| 719 |
Kdll_RuleEntrySet *pDllRuleTable[Parser_Count]; |
| 720 |
int iDllRuleCount[Parser_Count]; |
| 721 |
|
| 722 |
|
| 723 |
Kdll_KernelCache KernelCache; |
| 724 |
Kdll_KernelHashTable KernelHashTable; |
| 725 |
|
| 726 |
Kdll_Procamp *pProcamp; |
| 727 |
int32_t iProcampSize; |
| 728 |
|
| 729 |
|
| 730 |
MEDIA_CSPACE colorfill_cspace; |
| 731 |
|
| 732 |
|
| 733 |
void (*pfnStartKernelSearch)(PKdll_State pState, |
| 734 |
PKdll_SearchState pSearchState, |
| 735 |
Kdll_FilterEntry * pFilter, |
| 736 |
int32_t iFilterSize, |
| 737 |
uint32_t uiIs64BInstrEnabled); |
| 738 |
|
| 739 |
|
| 740 |
bool (*pfnSetupCSC)(PKdll_State pState, |
| 741 |
PKdll_SearchState pSearchState); |
| 742 |
|
| 743 |
|
| 744 |
bool (*pfnFindRule)(PKdll_State pState, |
| 745 |
PKdll_SearchState pSearchState); |
| 746 |
|
| 747 |
|
| 748 |
bool (*pfnUpdateState)(PKdll_State pState, |
| 749 |
PKdll_SearchState pSearchState); |
| 750 |
|
| 751 |
|
| 752 |
bool (*pfnSearchKernel)(PKdll_State pState, |
| 753 |
PKdll_SearchState pSearchState); |
| 754 |
|
| 755 |
|
| 756 |
bool (*pfnBuildKernel)(PKdll_State pState, |
| 757 |
PKdll_SearchState pSearchState); |
| 758 |
|
| 759 |
|
| 760 |
bool (*pfnMapCSCMatrix)(Kdll_CSCType type, |
| 761 |
const float * matrix, |
| 762 |
short * coeff); |
| 763 |
#if EMUL |
| 764 |
|
| 765 |
void *pToken; |
| 766 |
|
| 767 |
|
| 768 |
void (*pfnCbListKernel)(void *token, |
| 769 |
const char * szKernel); |
| 770 |
|
| 771 |
|
| 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 |
|
| 781 |
Kdll_State *pKdllState; |
| 782 |
|
| 783 |
|
| 784 |
Kdll_FilterDesc Filter; |
| 785 |
int iFilterSize; |
| 786 |
Kdll_CSC_Params CscParams; |
| 787 |
bool bCscBeforeMix; |
| 788 |
Kdll_Shuffling ShuffleSamplerData; |
| 789 |
|
| 790 |
|
| 791 |
bool bRTRotate; |
| 792 |
|
| 793 |
|
| 794 |
bool bProcamp; |
| 795 |
|
| 796 |
|
| 797 |
Kdll_RuleEntrySet *pMatchingRuleSet; |
| 798 |
|
| 799 |
|
| 800 |
int KernelCount; |
| 801 |
int KernelID[DL_MAX_KERNELS]; |
| 802 |
int KernelGrp[DL_MAX_KERNELS]; |
| 803 |
int PatchID[DL_MAX_KERNELS]; |
| 804 |
|
| 805 |
|
| 806 |
int PatchCount; |
| 807 |
Kdll_PatchData Patches[DL_MAX_PATCHES]; |
| 808 |
|
| 809 |
|
| 810 |
Kdll_FilterEntry *pFilter; |
| 811 |
Kdll_ParserState state; |
| 812 |
MEDIA_CSPACE cspace; |
| 813 |
int quadrant; |
| 814 |
int layer_number; |
| 815 |
|
| 816 |
|
| 817 |
MOS_FORMAT src0_format; |
| 818 |
Kdll_Sampling src0_sampling; |
| 819 |
int32_t src0_colorfill; |
| 820 |
int32_t src0_lumakey; |
| 821 |
int32_t src0_procamp; |
| 822 |
Kdll_CoeffID src0_coeff; |
| 823 |
Kdll_Processing src0_process; |
| 824 |
MEDIA_ROTATION src0_rotation; |
| 825 |
|
| 826 |
|
| 827 |
MOS_FORMAT src1_format; |
| 828 |
Kdll_Sampling src1_sampling; |
| 829 |
int32_t src1_lumakey; |
| 830 |
int32_t src1_samplerlumakey; |
| 831 |
int32_t src1_procamp; |
| 832 |
Kdll_CoeffID src1_coeff; |
| 833 |
Kdll_Processing src1_process; |
| 834 |
MEDIA_ROTATION src1_rotation; |
| 835 |
|
| 836 |
|
| 837 |
MOS_FORMAT target_format; |
| 838 |
|
| 839 |
bool b64BSaveEnabled; |
| 840 |
MOS_TILE_TYPE target_tiletype; |
| 841 |
|
| 842 |
|
| 843 |
int KernelSize; |
| 844 |
int KernelLeft; |
| 845 |
Kdll_Symbol KernelLink; |
| 846 |
Kdll_LinkData LinkArray[DL_MAX_SYMBOLS]; |
| 847 |
uint8_t Kernel[DL_MAX_KERNEL_SIZE]; |
| 848 |
} Kdll_SearchState; |
| 849 |
|
| 850 |
void KernelDll_ModifyFunctionPointers_Next(Kdll_State *pState); |
| 851 |
|
| 852 |
|
| 853 |
|
| 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 |
|
| 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 |
|
| 894 |
uint32_t KernelDll_SimpleHash( |
| 895 |
void *pData, |
| 896 |
int iSize); |
| 897 |
|
| 898 |
|
| 899 |
void KernelDll_SetupProcampParameters(Kdll_State *pState, |
| 900 |
Kdll_Procamp *pProcamp, |
| 901 |
int iProcampSize); |
| 902 |
|
| 903 |
|
| 904 |
Kdll_CacheEntry * |
| 905 |
KernelDll_GetCombinedKernel(Kdll_State *pState, |
| 906 |
Kdll_FilterEntry *iFilter, |
| 907 |
int iFilterSize, |
| 908 |
uint32_t dwHash); |
| 909 |
|
| 910 |
|
| 911 |
|
| 912 |
|
| 913 |
|
| 914 |
|
| 915 |
|
| 916 |
|
| 917 |
|
| 918 |
|
| 919 |
|
| 920 |
static bool KernelDll_SetupFunctionPointers( |
| 921 |
Kdll_State *pState, |
| 922 |
void (*ModifyFunctionPointers)(PKdll_State)); |
| 923 |
|
| 924 |
|
| 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 |
|
| 934 |
void KernelDll_ReleaseStates(Kdll_State *pState); |
| 935 |
|
| 936 |
|
| 937 |
void KernelDll_UpdateCscCoefficients(Kdll_State *pState, |
| 938 |
Kdll_CSC_Matrix * pMatrix); |
| 939 |
|
| 940 |
|
| 941 |
void KernelDll_ReleaseAdditionalCacheEntries(Kdll_KernelCache *pCache); |
| 942 |
|
| 943 |
|
| 944 |
bool KernelDll_SearchKernel( |
| 945 |
Kdll_State * pState, |
| 946 |
Kdll_SearchState *pSearchState); |
| 947 |
|
| 948 |
|
| 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 |
|
| 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 |
|
| 964 |
Kdll_CacheEntry * |
| 965 |
KernelDll_AllocateCacheEntry(Kdll_KernelCache *pCache, |
| 966 |
int32_t iSize); |
| 967 |
|
| 968 |
|
| 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 |
|
| 977 |
|
| 978 |
|
| 979 |
|
| 980 |
|
| 981 |
|
| 982 |
|
| 983 |
|
| 984 |
bool KernelDll_SetupFunctionPointers_Ext( |
| 985 |
Kdll_State *pState); |
| 986 |
|
| 987 |
#ifdef __cplusplus |
| 988 |
} |
| 989 |
#endif |
| 990 |
|
| 991 |
#endif |