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 //!
24 //! \file encode_preenc_const_settings.cpp
25 //! \brief Defines the common interface for preenc const settings
26 //! \details The encode feature manager is further sub-divided by platform type
27 //! this file is for the base interface which is shared by all components.
28 //!
29
30 #include "encode_preenc_const_settings.h"
31 #include "mos_utilities.h"
32 #include "encode_utils.h"
33 #include "codec_def_encode.h"
34
35 namespace encode
36 {
37
38 #define CLIP3(MIN_, MAX_, X) (((X) < (MIN_)) ? (MIN_) : (((X) > (MAX_)) ? (MAX_) : (X)))
39
EncodePreEncConstSettings()40 EncodePreEncConstSettings::EncodePreEncConstSettings()
41 {
42 m_featureSetting = MOS_New(PreEncFeatureSettings);
43 }
44
~EncodePreEncConstSettings()45 EncodePreEncConstSettings::~EncodePreEncConstSettings()
46 {
47 MOS_Delete(m_featureSetting);
48 m_featureSetting = nullptr;
49 }
50
PrepareConstSettings()51 MOS_STATUS EncodePreEncConstSettings::PrepareConstSettings()
52 {
53 ENCODE_FUNC_CALL();
54
55 ENCODE_CHK_STATUS_RETURN(SetCommonSettings());
56 ENCODE_CHK_STATUS_RETURN(SetVdencCmd1Settings());
57 ENCODE_CHK_STATUS_RETURN(SetVdencCmd2Settings());
58
59 return MOS_STATUS_SUCCESS;
60 }
61
SetVdencCmd1Settings()62 MOS_STATUS EncodePreEncConstSettings::SetVdencCmd1Settings()
63 {
64 ENCODE_FUNC_CALL();
65 ENCODE_CHK_NULL_RETURN(m_featureSetting);
66
67 m_featureSetting->vdencCmd1Settings = {
68 PREENC_VDENC_CMD1_LAMBDA()
69 {
70 static constexpr std::array<std::array<double, 4>, 2> ConstTable1 =
71 {{
72 {0.68445, 1.03428, 1.17, 1.17},
73 {0.7605, 0.9464, 0.9464, 1.04}
74 }};
75
76 static constexpr std::array<double, 13> LowDelayTable =
77 {
78 0.7048, 0.763533, 0.822267, 0.881, 0.939733, 0.998467,
79 1.0572, 1.11593, 1.17467, 1.2334, 1.29213, 1.35087, 1.4096
80 };
81
82 static constexpr std::array<double, 52> ConstTable2 =
83 {
84 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
85 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
86 1.000000, 1.000000, 1.259921, 1.587401, 2.000000,
87 2.519842, 3.174802, 4.000000, 5.039684, 6.349604,
88 8.000000, 10.079368, 12.699208, 16.000000, 20.158737,
89 25.398417, 32.000000, 40.317474, 50.796834, 64.000000,
90 80.634947, 101.593667, 128.0000, 161.269894, 203.187335,
91 256.00000, 322.539789, 406.374669, 512.0000, 645.079578,
92 812.749339, 1024.0000, 1290.159155, 1625.498677, 2048.0,
93 2580.31831, 3250.997354, 4096.0000, 5160.636620, 6501.994709, 8192
94 };
95
96 double doubleNum0;
97
98 uint32_t bGopSize = preEncConfig.GopRefDist;
99 int32_t depth = preEncConfig.HierarchLevelPlus1 ? preEncConfig.HierarchLevelPlus1 - 1 : 0;
100 uint8_t qp = 22; // preenc use const qp 22
101
102 if (preEncConfig.LowDelayMode)
103 {
104 if (preEncConfig.CodingType == I_TYPE)
105 {
106 doubleNum0 = 0.4845;
107 }
108 else
109 {
110 if (depth == 0)
111 {
112 doubleNum0 = 0.578;
113 }
114 else
115 {
116 int tmp = CLIP3(24, 36, qp);
117 doubleNum0 = LowDelayTable[tmp - 24];
118 }
119 }
120 }
121 else
122 {
123 if (preEncConfig.CodingType == I_TYPE)
124 {
125 doubleNum0 = 0.60;
126 }
127 else if (preEncConfig.CodingType == B_TYPE && bGopSize == 4)
128 {
129 doubleNum0 = ConstTable1[0][depth];
130 }
131 else if (preEncConfig.CodingType == B_TYPE && bGopSize == 8)
132 {
133 doubleNum0 = ConstTable1[1][depth];
134 }
135 else
136 {
137 doubleNum0 = 0.65;
138 }
139 }
140
141 double doubleNum1 = doubleNum0 * ConstTable2[qp - 1];
142 par.vdencCmd1Par0 = (uint16_t)(MOS_MIN(65535, doubleNum1 * 4 + 0.5));
143
144 doubleNum1 = sqrt(doubleNum1);
145 par.vdencCmd1Par1 = (uint16_t)(MOS_MIN(65535, doubleNum1 * 4 + 0.5));
146
147 par.vdencCmd1Par2[0] = 0;
148 par.vdencCmd1Par2[1] = 2;
149 par.vdencCmd1Par2[2] = 3;
150 par.vdencCmd1Par2[3] = 5;
151 par.vdencCmd1Par2[4] = 6;
152 par.vdencCmd1Par2[5] = 8;
153 par.vdencCmd1Par2[6] = 9;
154 par.vdencCmd1Par2[7] = 11;
155
156 return MOS_STATUS_SUCCESS;
157 },
158 PREENC_VDENC_CMD1_LAMBDA()
159 {
160 static const std::array<uint8_t, 12> data = {
161 4, 12, 20, 28, 36, 44, 52, 60, 68, 76, 84, 92
162 };
163
164 for (size_t i = 0; i < data.size(); i++)
165 {
166 par.vdencCmd1Par3[i] = data[i];
167 }
168
169 return MOS_STATUS_SUCCESS;
170 },
171 PREENC_VDENC_CMD1_LAMBDA()
172 {
173 static const std::array<uint8_t, 12> data = {
174 3, 10, 16, 22, 29, 35, 42, 48, 54, 61, 67, 74};
175
176 for (size_t i = 0; i < data.size(); i++)
177 {
178 par.vdencCmd1Par4[i] = data[i];
179 }
180
181 return MOS_STATUS_SUCCESS;
182 },
183
184 PREENC_VDENC_CMD1_LAMBDA()
185 {
186 par.vdencCmd1Par22 = 4;
187
188 return MOS_STATUS_SUCCESS;
189 },
190 PREENC_VDENC_CMD1_LAMBDA()
191 {
192 par.vdencCmd1Par24 = 0;
193 par.vdencCmd1Par25 = 0;
194 par.vdencCmd1Par26 = 0;
195 par.vdencCmd1Par27 = 0;
196 par.vdencCmd1Par28 = 0;
197 par.vdencCmd1Par29 = 0;
198 par.vdencCmd1Par30 = 0;
199 par.vdencCmd1Par31 = 0;
200
201 return MOS_STATUS_SUCCESS;
202 },
203 PREENC_VDENC_CMD1_LAMBDA()
204 {
205 par.vdencCmd1Par32 = 0;
206 par.vdencCmd1Par33 = 0;
207
208 if (preEncConfig.CodingType == I_TYPE)
209 {
210 par.vdencCmd1Par34 = 21;
211 par.vdencCmd1Par35 = 0;
212 }
213 else
214 {
215 par.vdencCmd1Par34 = 7;
216 par.vdencCmd1Par35 = 4;
217 }
218
219 return MOS_STATUS_SUCCESS;
220 },
221 PREENC_VDENC_CMD1_LAMBDA()
222 {
223 par.vdencCmd1Par44 = 0;
224 par.vdencCmd1Par45 = 20;
225 par.vdencCmd1Par46 = 0;
226
227 return MOS_STATUS_SUCCESS;
228 },
229 PREENC_VDENC_CMD1_LAMBDA()
230 {
231 par.vdencCmd1Par47 = 12;
232 par.vdencCmd1Par48 = 12;
233 par.vdencCmd1Par49 = 12;
234 par.vdencCmd1Par50 = 12;
235 par.vdencCmd1Par51 = 12;
236 par.vdencCmd1Par52 = 12;
237 par.vdencCmd1Par53 = 12;
238 par.vdencCmd1Par54 = 12;
239
240 return MOS_STATUS_SUCCESS;
241 },
242 PREENC_VDENC_CMD1_LAMBDA()
243 {
244 par.vdencCmd1Par55 = 0x0E;
245 par.vdencCmd1Par56 = 0x0E;
246 par.vdencCmd1Par57 = 0x0C;
247 par.vdencCmd1Par58 = 0x0B;
248 par.vdencCmd1Par59 = 0x10;
249 par.vdencCmd1Par60 = 0x10;
250 par.vdencCmd1Par61 = 0x0F;
251 par.vdencCmd1Par62 = 0x0F;
252 par.vdencCmd1Par63 = 0x10;
253 par.vdencCmd1Par64 = 0x10;
254 par.vdencCmd1Par65 = 0x10;
255 par.vdencCmd1Par66 = 0x10;
256 par.vdencCmd1Par67 = 0x14;
257 par.vdencCmd1Par68 = 0x10;
258 par.vdencCmd1Par69 = 0x10;
259 par.vdencCmd1Par70 = 0x10;
260 par.vdencCmd1Par71 = 0x0C;
261 par.vdencCmd1Par72 = 0x0C;
262 par.vdencCmd1Par73 = 0x0A;
263 par.vdencCmd1Par74 = 0x0A;
264 par.vdencCmd1Par75 = 0x10;
265 par.vdencCmd1Par76 = 0x10;
266 par.vdencCmd1Par77 = 0x10;
267 par.vdencCmd1Par78 = 0x10;
268 par.vdencCmd1Par79 = 0x10;
269 par.vdencCmd1Par80 = 0x10;
270 par.vdencCmd1Par81 = 0x10;
271 par.vdencCmd1Par82 = 0x10;
272 par.vdencCmd1Par83 = 0x10;
273 par.vdencCmd1Par84 = 0x10;
274 par.vdencCmd1Par85 = 0x0E;
275 par.vdencCmd1Par86 = 0x0F;
276
277 return MOS_STATUS_SUCCESS;
278 }
279 };
280
281 m_featureSetting->vdencCmd1Settings.emplace_back(
282 PREENC_VDENC_CMD1_LAMBDA() {
283 static const std::array<uint8_t, 16> data = {
284 11, 0, 0, 0, 14, 0, 0, 0,
285 11, 0, 0, 0, 0, 0, 0, 0
286 };
287
288 if (preEncConfig.CodingType == I_TYPE)
289 {
290 return MOS_STATUS_SUCCESS;
291 }
292
293 for (size_t i = 0; i < 4; i++)
294 {
295 par.vdencCmd1Par8[i] = data[i];
296 par.vdencCmd1Par9[i] = data[i + 4];
297 par.vdencCmd1Par10[i] = data[i + 8];
298 par.vdencCmd1Par11[i] = data[i + 12];
299 }
300
301 return MOS_STATUS_SUCCESS;
302 });
303
304 m_featureSetting->vdencCmd1Settings.emplace_back(
305 PREENC_VDENC_CMD1_LAMBDA() {
306 static const std::array<uint8_t, 16> data = {
307 23, 0, 0, 0, 26, 0, 0, 0,
308 21, 0, 0, 0, 0, 0, 0, 0
309 };
310 if (preEncConfig.CodingType == I_TYPE)
311 {
312 return MOS_STATUS_SUCCESS;
313 }
314
315 for (size_t i = 0; i < 4; i++)
316 {
317 par.vdencCmd1Par12[i] = data[i];
318 par.vdencCmd1Par13[i] = data[i + 4];
319 par.vdencCmd1Par14[i] = data[i + 8];
320 par.vdencCmd1Par15[i] = data[i + 12];
321 }
322
323 return MOS_STATUS_SUCCESS;
324 });
325
326 m_featureSetting->vdencCmd1Settings.emplace_back(
327 PREENC_VDENC_CMD1_LAMBDA() {
328 if (preEncConfig.CodingType == P_TYPE)
329 {
330 par.vdencCmd1Par16 = 82;
331 par.vdencCmd1Par17 = 20;
332 par.vdencCmd1Par18 = 83;
333 par.vdencCmd1Par19 = 17;
334 par.vdencCmd1Par20 = 15;
335 par.vdencCmd1Par21 = 0;
336 }
337 else if (preEncConfig.CodingType == B_TYPE)
338 {
339 par.vdencCmd1Par16 = 99;
340 par.vdencCmd1Par17 = 23;
341 par.vdencCmd1Par18 = 99;
342 par.vdencCmd1Par19 = 19;
343 par.vdencCmd1Par20 = 17;
344 par.vdencCmd1Par21 = 0;
345 }
346
347 return MOS_STATUS_SUCCESS;
348 });
349
350 m_featureSetting->vdencCmd1Settings.emplace_back(
351 PREENC_VDENC_CMD1_LAMBDA() {
352 if (preEncConfig.CodingType == I_TYPE)
353 {
354 par.vdencCmd1Par23 = 63;
355 }
356 else
357 {
358 par.vdencCmd1Par23 = 54;
359 }
360
361 return MOS_STATUS_SUCCESS;
362 });
363
364 m_featureSetting->vdencCmd1Settings.emplace_back(
365 PREENC_VDENC_CMD1_LAMBDA() {
366 if (preEncConfig.CodingType == I_TYPE)
367 {
368 par.vdencCmd1Par30 = 12;
369 }
370
371 return MOS_STATUS_SUCCESS;
372 });
373
374 m_featureSetting->vdencCmd1Settings.emplace_back(
375 PREENC_VDENC_CMD1_LAMBDA() {
376 if (preEncConfig.CodingType == I_TYPE)
377 {
378 par.vdencCmd1Par36 = 17;
379 par.vdencCmd1Par37 = 47;
380 par.vdencCmd1Par38 = 20;
381 par.vdencCmd1Par39 = 9;
382 par.vdencCmd1Par40 = 17;
383 par.vdencCmd1Par41 = 30;
384 }
385 else
386 {
387 par.vdencCmd1Par36 = 7;
388 par.vdencCmd1Par37 = 18;
389 par.vdencCmd1Par38 = 18;
390 par.vdencCmd1Par39 = 18;
391 par.vdencCmd1Par40 = 27;
392 par.vdencCmd1Par41 = 68;
393 }
394
395 return MOS_STATUS_SUCCESS;
396 });
397
398 m_featureSetting->vdencCmd1Settings.emplace_back(
399 PREENC_VDENC_CMD1_LAMBDA() {
400 if (preEncConfig.CodingType == P_TYPE)
401 {
402 par.vdencCmd1Par48 = 0;
403 par.vdencCmd1Par49 = 32;
404 par.vdencCmd1Par50 = 68;
405 }
406
407 return MOS_STATUS_SUCCESS;
408 });
409
410 m_featureSetting->vdencCmd1Settings.emplace_back(
411 PREENC_VDENC_CMD1_LAMBDA() {
412 static constexpr std::array<
413 std::array<uint8_t,
414 3>,
415 3>
416 data = {{
417 {20, 35, 35},
418 {20, 35, 35},
419 {47, 16, 16}
420 }};
421
422 if (preEncConfig.CodingType == I_TYPE)
423 {
424 par.vdencCmd1Par87 = data[2][2];
425 par.vdencCmd1Par88 = data[2][1];
426 par.vdencCmd1Par89 = data[2][0];
427 }
428 else if (preEncConfig.CodingType == P_TYPE)
429 {
430 par.vdencCmd1Par87 = data[1][2];
431 par.vdencCmd1Par88 = data[1][1];
432 par.vdencCmd1Par89 = data[1][0];
433 }
434 else if (preEncConfig.CodingType == B_TYPE)
435 {
436 par.vdencCmd1Par87 = data[0][2];
437 par.vdencCmd1Par88 = data[0][1];
438 par.vdencCmd1Par89 = data[0][0];
439 }
440
441 return MOS_STATUS_SUCCESS;
442 });
443
444
445 return MOS_STATUS_SUCCESS;
446 }
447
SetCommonSettings()448 MOS_STATUS EncodePreEncConstSettings::SetCommonSettings()
449 {
450 ENCODE_FUNC_CALL();
451 ENCODE_CHK_NULL_RETURN(m_featureSetting);
452
453 m_featureSetting->transformSkipCoeffsTable = {{
454 {{
455 {{
456 {{
457 {42, 37}, {32, 40}
458 }},
459 {{
460 {40, 40}, {32, 45}
461 }}
462 }},
463 {{
464 {{
465 {29, 48}, {26, 53}
466 }},
467 {{
468 {26, 56}, {24, 62}
469 }}
470 }}
471 }},
472 {{
473 {{
474 {{
475 {42, 40}, {32, 45}
476 }},
477 {{
478 {40, 46}, {32, 48}
479 }}
480 }},
481 {{
482 {{
483 {26, 53}, {24, 58}
484 }},
485 {{
486 {32, 53}, {26, 64}
487 }}
488 }}
489 }},
490 {{
491 {{
492 {{
493 {38, 42}, {32, 51}
494 }},
495 {{
496 {43, 43}, {35, 46}
497 }}
498 }},
499 {{
500 {{
501 {26, 56}, {24, 64}
502 }},
503 {{
504 {35, 50}, {32, 57}
505 }}
506 }}
507 }},
508 {{
509 {{
510 {{
511 {35, 46}, {32, 52}
512 }},
513 {{
514 {51, 42}, {38, 53}
515 }}
516 }},
517 {{
518 {{
519 {29, 56}, {29, 70}
520 }},
521 {{
522 {38, 47}, {37, 64}
523 }}
524 }}
525 }},
526 }};
527
528 m_featureSetting->transformSkipLambdaTable = {
529 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
530 149, 149, 149, 149, 149, 149, 149, 149, 149, 162, 174, 186, 199, 211, 224, 236,
531 249, 261, 273, 286, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298,
532 298, 298, 298, 298
533 };
534
535 m_featureSetting->rdoqLamdas8bits = {{
536 {{
537 {{
538 { //Intra Luma
539 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0001, 0x0001,
540 0x0001, 0x0001, 0x0002, 0x0002, 0x0003, 0x0003, 0x0004, 0x0005,
541 0x0007, 0x0008, 0x000a, 0x000d, 0x0011, 0x0015, 0x001a, 0x0021,
542 0x002a, 0x0034, 0x0042, 0x0053, 0x0069, 0x0084, 0x00a6, 0x00d2,
543 0x0108, 0x014d, 0x01a3, 0x0210, 0x029a, 0x0347, 0x0421, 0x0533,
544 0x068d, 0x0841, 0x0a66, 0x0d1a, 0x1082, 0x14cd, 0x1a35, 0x2105,
545 0x299a, 0x346a, 0x4209, 0x5333
546 },
547 { //Intra Chroma
548 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0001, 0x0001,
549 0x0001, 0x0001, 0x0002, 0x0002, 0x0003, 0x0003, 0x0004, 0x0005,
550 0x0007, 0x0008, 0x000a, 0x000d, 0x0011, 0x0015, 0x001a, 0x0021,
551 0x002a, 0x0034, 0x0042, 0x0053, 0x0069, 0x0084, 0x00a6, 0x00d2,
552 0x0108, 0x014d, 0x01a3, 0x0210, 0x029a, 0x0347, 0x0421, 0x0533,
553 0x068d, 0x0841, 0x0a66, 0x0d1a, 0x1082, 0x14cd, 0x1a35, 0x2105,
554 0x299a, 0x346a, 0x4209, 0x5333
555 },
556 }},
557 {{
558 { //Inter Luma
559 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0002, 0x0003,
560 0x0003, 0x0004, 0x0006, 0x0007, 0x0009, 0x000b, 0x000e, 0x0012,
561 0x0016, 0x001c, 0x0023, 0x002c, 0x0038, 0x0046, 0x0059, 0x0075,
562 0x009b, 0x00cc, 0x010c, 0x0160, 0x01cd, 0x025b, 0x0314, 0x0405,
563 0x053d, 0x06d2, 0x08df, 0x0b2d, 0x0e14, 0x11bd, 0x165a, 0x1c29,
564 0x237b, 0x2cb4, 0x3852, 0x46f5, 0x5967, 0x70a4, 0x8deb, 0xb2ce,
565 0xe148, 0xffff, 0xffff, 0xffff
566 },
567 { //Inter Chroma
568 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0002, 0x0003,
569 0x0003, 0x0004, 0x0005, 0x0007, 0x0008, 0x000b, 0x000d, 0x0011,
570 0x0015, 0x001b, 0x0021, 0x002a, 0x0035, 0x0043, 0x0054, 0x006c,
571 0x008c, 0x00b4, 0x00e7, 0x0129, 0x017d, 0x01ea, 0x0275, 0x0327,
572 0x040c, 0x0530, 0x06a7, 0x0862, 0x0a8f, 0x0d4e, 0x10c3, 0x151f,
573 0x1a9c, 0x2187, 0x2a3d, 0x3538, 0x430d, 0x547b, 0x6a70, 0x861b,
574 0xa8f6, 0xd4e0, 0xffff, 0xffff
575 },
576 }},
577 }},
578 {{
579 {{
580 { //Intra Luma
581 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0002, 0x0003,
582 0x0003, 0x0004, 0x0006, 0x0007, 0x0009, 0x000b, 0x000e, 0x0012,
583 0x0016, 0x001c, 0x0023, 0x002c, 0x0038, 0x0046, 0x0059, 0x0075,
584 0x009b, 0x00cc, 0x010c, 0x0160, 0x01cd, 0x025b, 0x0314, 0x0405,
585 0x053d, 0x06d2, 0x08df, 0x0b2d, 0x0e14, 0x11bd, 0x165a, 0x1c29,
586 0x237b, 0x2cb4, 0x3852, 0x46f5, 0x5967, 0x70a4, 0x8deb, 0xb2ce,
587 0xe148, 0xffff, 0xffff, 0xffff
588 },
589 { //Intra Chroma
590 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0002, 0x0003,
591 0x0003, 0x0004, 0x0005, 0x0007, 0x0008, 0x000b, 0x000d, 0x0011,
592 0x0015, 0x001b, 0x0021, 0x002a, 0x0035, 0x0043, 0x0054, 0x006c,
593 0x008c, 0x00b4, 0x00e7, 0x0129, 0x017d, 0x01ea, 0x0275, 0x0327,
594 0x040c, 0x0530, 0x06a7, 0x0862, 0x0a8f, 0x0d4e, 0x10c3, 0x151f,
595 0x1a9c, 0x2187, 0x2a3d, 0x3538, 0x430d, 0x547b, 0x6a70, 0x861b,
596 0xa8f6, 0xd4e0, 0xffff, 0xffff
597 },
598 }},
599 {{
600 { //Inter Luma
601 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0002, 0x0003,
602 0x0003, 0x0004, 0x0006, 0x0007, 0x0009, 0x000b, 0x000e, 0x0012,
603 0x0016, 0x001c, 0x0023, 0x002c, 0x0038, 0x0046, 0x0059, 0x0075,
604 0x009b, 0x00cc, 0x010c, 0x0160, 0x01cd, 0x025b, 0x0314, 0x0405,
605 0x053d, 0x06d2, 0x08df, 0x0b2d, 0x0e14, 0x11bd, 0x165a, 0x1c29,
606 0x237b, 0x2cb4, 0x3852, 0x46f5, 0x5967, 0x70a4, 0x8deb, 0xb2ce,
607 0xe148, 0xffff, 0xffff, 0xffff
608 },
609 { //Inter Chroma
610 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0002, 0x0003,
611 0x0003, 0x0004, 0x0005, 0x0007, 0x0008, 0x000b, 0x000d, 0x0011,
612 0x0015, 0x001b, 0x0021, 0x002a, 0x0035, 0x0043, 0x0054, 0x006c,
613 0x008c, 0x00b4, 0x00e7, 0x0129, 0x017d, 0x01ea, 0x0275, 0x0327,
614 0x040c, 0x0530, 0x06a7, 0x0862, 0x0a8f, 0x0d4e, 0x10c3, 0x151f,
615 0x1a9c, 0x2187, 0x2a3d, 0x3538, 0x430d, 0x547b, 0x6a70, 0x861b,
616 0xa8f6, 0xd4e0, 0xffff, 0xffff
617 },
618 }},
619 }}
620 }};
621
622 m_featureSetting->rdoqLamdas10bits = {{
623 {{
624 {{
625 { //Intra Luma
626 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
627 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
628 0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0002,
629 0x0003, 0x0003, 0x0004, 0x0005, 0x0007, 0x0008, 0x000a, 0x000d,
630 0x0011, 0x0015, 0x001a, 0x0021, 0x002a, 0x0034, 0x0042, 0x0053,
631 0x0069, 0x0084, 0x00a6, 0x00d2, 0x0108, 0x014d, 0x01a3, 0x0210,
632 0x029a, 0x0347, 0x0421, 0x0533, 0x068d, 0x0841, 0x0a66, 0x0d1a,
633 0x1082, 0x14cd, 0x1a35, 0x2105, 0x299a, 0x346a, 0x4209, 0x5333
634 },
635 { //Intra Chroma
636 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
637 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
638 0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0002,
639 0x0003, 0x0003, 0x0004, 0x0005, 0x0007, 0x0008, 0x000a, 0x000d,
640 0x0011, 0x0015, 0x001a, 0x0021, 0x002a, 0x0034, 0x0042, 0x0053,
641 0x0069, 0x0084, 0x00a6, 0x00d2, 0x0108, 0x014d, 0x01a3, 0x0210,
642 0x029a, 0x0347, 0x0421, 0x0533, 0x068d, 0x0841, 0x0a66, 0x0d1a,
643 0x1082, 0x14cd, 0x1a35, 0x2105, 0x299a, 0x346a, 0x4209, 0x5333
644 },
645 }},
646 {{
647 { //Inter Luma
648 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
649 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0001, 0x0001, 0x0001,
650 0x0001, 0x0002, 0x0002, 0x0003, 0x0003, 0x0004, 0x0006, 0x0007,
651 0x0009, 0x000b, 0x000e, 0x0012, 0x0016, 0x001c, 0x0023, 0x002c,
652 0x0038, 0x0046, 0x0059, 0x0075, 0x009b, 0x00cc, 0x010c, 0x0160,
653 0x01cd, 0x025b, 0x0314, 0x0405, 0x053d, 0x06d2, 0x08df, 0x0b2d,
654 0x0e14, 0x11bd, 0x165a, 0x1c29, 0x237b, 0x2cb4, 0x3852, 0x46f5,
655 0x5967, 0x70a4, 0x8deb, 0xb2ce, 0xe148, 0xffff, 0xffff, 0xffff
656 },
657 { //Inter Chroma
658 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
659 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0001, 0x0001, 0x0001,
660 0x0001, 0x0002, 0x0002, 0x0003, 0x0003, 0x0004, 0x0005, 0x0007,
661 0x0008, 0x000b, 0x000d, 0x0011, 0x0015, 0x001b, 0x0021, 0x002a,
662 0x0035, 0x0043, 0x0054, 0x006c, 0x008c, 0x00b4, 0x00e7, 0x0129,
663 0x017d, 0x01ea, 0x0275, 0x0327, 0x040c, 0x0530, 0x06a7, 0x0862,
664 0x0a8f, 0x0d4e, 0x10c3, 0x151f, 0x1a9c, 0x2187, 0x2a3d, 0x3538,
665 0x430d, 0x547b, 0x6a70, 0x861b, 0xa8f6, 0xd4e0, 0xffff, 0xffff
666 },
667 }},
668 }},
669 {{
670 {{
671 { //Intra Luma
672 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
673 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0001, 0x0001, 0x0001,
674 0x0001, 0x0002, 0x0002, 0x0003, 0x0003, 0x0004, 0x0006, 0x0007,
675 0x0009, 0x000b, 0x000e, 0x0012, 0x0016, 0x001c, 0x0023, 0x002c,
676 0x0038, 0x0046, 0x0059, 0x0075, 0x009b, 0x00cc, 0x010c, 0x0160,
677 0x01cd, 0x025b, 0x0314, 0x0405, 0x053d, 0x06d2, 0x08df, 0x0b2d,
678 0x0e14, 0x11bd, 0x165a, 0x1c29, 0x237b, 0x2cb4, 0x3852, 0x46f5,
679 0x5967, 0x70a4, 0x8deb, 0xb2ce, 0xe148, 0xffff, 0xffff, 0xffff
680 },
681 { //Intra Chroma
682 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
683 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0001, 0x0001, 0x0001,
684 0x0001, 0x0002, 0x0002, 0x0003, 0x0003, 0x0004, 0x0005, 0x0007,
685 0x0008, 0x000b, 0x000d, 0x0011, 0x0015, 0x001b, 0x0021, 0x002a,
686 0x0035, 0x0043, 0x0054, 0x006c, 0x008c, 0x00b4, 0x00e7, 0x0129,
687 0x017d, 0x01ea, 0x0275, 0x0327, 0x040c, 0x0530, 0x06a7, 0x0862,
688 0x0a8f, 0x0d4e, 0x10c3, 0x151f, 0x1a9c, 0x2187, 0x2a3d, 0x3538,
689 0x430d, 0x547b, 0x6a70, 0x861b, 0xa8f6, 0xd4e0, 0xffff, 0xffff
690 },
691 }},
692 {{
693 { //Inter Luma
694 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
695 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0001, 0x0001, 0x0001,
696 0x0001, 0x0002, 0x0002, 0x0003, 0x0003, 0x0004, 0x0006, 0x0007,
697 0x0009, 0x000b, 0x000e, 0x0012, 0x0016, 0x001c, 0x0023, 0x002c,
698 0x0038, 0x0046, 0x0059, 0x0075, 0x009b, 0x00cc, 0x010c, 0x0160,
699 0x01cd, 0x025b, 0x0314, 0x0405, 0x053d, 0x06d2, 0x08df, 0x0b2d,
700 0x0e14, 0x11bd, 0x165a, 0x1c29, 0x237b, 0x2cb4, 0x3852, 0x46f5,
701 0x5967, 0x70a4, 0x8deb, 0xb2ce, 0xe148, 0xffff, 0xffff, 0xffff
702 },
703 { //Inter Chroma
704 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
705 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0001, 0x0001, 0x0001,
706 0x0001, 0x0002, 0x0002, 0x0003, 0x0003, 0x0004, 0x0005, 0x0007,
707 0x0008, 0x000b, 0x000d, 0x0011, 0x0015, 0x001b, 0x0021, 0x002a,
708 0x0035, 0x0043, 0x0054, 0x006c, 0x008c, 0x00b4, 0x00e7, 0x0129,
709 0x017d, 0x01ea, 0x0275, 0x0327, 0x040c, 0x0530, 0x06a7, 0x0862,
710 0x0a8f, 0x0d4e, 0x10c3, 0x151f, 0x1a9c, 0x2187, 0x2a3d, 0x3538,
711 0x430d, 0x547b, 0x6a70, 0x861b, 0xa8f6, 0xd4e0, 0xffff, 0xffff
712 },
713 }},
714 }}
715 }};
716
717 m_featureSetting->rdoqLamdas12bits = {{
718 {{
719 {{
720 { //Intra Luma
721 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
722 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
723 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
724 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0001, 0x0001,
725 0x0001, 0x0001, 0x0002, 0x0002, 0x0003, 0x0003, 0x0004, 0x0005,
726 0x0007, 0x0008, 0x000a, 0x000d, 0x0011, 0x0015, 0x001a, 0x0021,
727 0x002a, 0x0034, 0x0042, 0x0053, 0x0069, 0x0084, 0x00a6, 0x00d2,
728 0x0108, 0x014d, 0x01a3, 0x0210, 0x029a, 0x0347, 0x0421, 0x0533,
729 0x068d, 0x0841, 0x0a66, 0x0d1a, 0x1082, 0x14cd, 0x1a35, 0x2105,
730 0x299a, 0x346a, 0x4209, 0x5333
731 },
732 { //Intra Chroma
733 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
734 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
735 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
736 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0001, 0x0001,
737 0x0001, 0x0001, 0x0002, 0x0002, 0x0003, 0x0003, 0x0004, 0x0005,
738 0x0007, 0x0008, 0x000a, 0x000d, 0x0011, 0x0015, 0x001a, 0x0021,
739 0x002a, 0x0034, 0x0042, 0x0053, 0x0069, 0x0084, 0x00a6, 0x00d2,
740 0x0108, 0x014d, 0x01a3, 0x0210, 0x029a, 0x0347, 0x0421, 0x0533,
741 0x068d, 0x0841, 0x0a66, 0x0d1a, 0x1082, 0x14cd, 0x1a35, 0x2105,
742 0x299a, 0x346a, 0x4209, 0x5333
743 },
744 }},
745 {{
746 { //Inter Luma
747 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
748 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
749 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
750 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0002, 0x0003,
751 0x0003, 0x0004, 0x0006, 0x0007, 0x0009, 0x000b, 0x000e, 0x0012,
752 0x0016, 0x001c, 0x0023, 0x002c, 0x0038, 0x0046, 0x0059, 0x0075,
753 0x009b, 0x00cc, 0x010c, 0x0160, 0x01cd, 0x025b, 0x0314, 0x0405,
754 0x053d, 0x06d2, 0x08df, 0x0b2d, 0x0e14, 0x11bd, 0x165a, 0x1c29,
755 0x237b, 0x2cb4, 0x3852, 0x46f5, 0x5967, 0x70a4, 0x8deb, 0xb2ce,
756 0xe148, 0xffff, 0xffff, 0xffff
757 },
758 { //Inter Chroma
759 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
760 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
761 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
762 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0002, 0x0003,
763 0x0003, 0x0004, 0x0005, 0x0007, 0x0008, 0x000b, 0x000d, 0x0011,
764 0x0015, 0x001b, 0x0021, 0x002a, 0x0035, 0x0043, 0x0054, 0x006c,
765 0x008c, 0x00b4, 0x00e7, 0x0129, 0x017d, 0x01ea, 0x0275, 0x0327,
766 0x040c, 0x0530, 0x06a7, 0x0862, 0x0a8f, 0x0d4e, 0x10c3, 0x151f,
767 0x1a9c, 0x2187, 0x2a3d, 0x3538, 0x430d, 0x547b, 0x6a70, 0x861b,
768 0xa8f6, 0xd4e0, 0xffff, 0xffff
769 },
770 }},
771 }},
772 {{
773 {{
774 { //Intra Luma
775 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
776 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
777 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
778 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0002, 0x0003,
779 0x0003, 0x0004, 0x0006, 0x0007, 0x0009, 0x000b, 0x000e, 0x0012,
780 0x0016, 0x001c, 0x0023, 0x002c, 0x0038, 0x0046, 0x0059, 0x0075,
781 0x009b, 0x00cc, 0x010c, 0x0160, 0x01cd, 0x025b, 0x0314, 0x0405,
782 0x053d, 0x06d2, 0x08df, 0x0b2d, 0x0e14, 0x11bd, 0x165a, 0x1c29,
783 0x237b, 0x2cb4, 0x3852, 0x46f5, 0x5967, 0x70a4, 0x8deb, 0xb2ce,
784 0xe148, 0xffff, 0xffff, 0xffff
785 },
786 { //Intra Chroma
787 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
788 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
789 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
790 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0002, 0x0003,
791 0x0003, 0x0004, 0x0005, 0x0007, 0x0008, 0x000b, 0x000d, 0x0011,
792 0x0015, 0x001b, 0x0021, 0x002a, 0x0035, 0x0043, 0x0054, 0x006c,
793 0x008c, 0x00b4, 0x00e7, 0x0129, 0x017d, 0x01ea, 0x0275, 0x0327,
794 0x040c, 0x0530, 0x06a7, 0x0862, 0x0a8f, 0x0d4e, 0x10c3, 0x151f,
795 0x1a9c, 0x2187, 0x2a3d, 0x3538, 0x430d, 0x547b, 0x6a70, 0x861b,
796 0xa8f6, 0xd4e0, 0xffff, 0xffff
797 },
798 }},
799 {{
800 { //Inter Luma
801 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
802 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
803 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
804 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0002, 0x0003,
805 0x0003, 0x0004, 0x0006, 0x0007, 0x0009, 0x000b, 0x000e, 0x0012,
806 0x0016, 0x001c, 0x0023, 0x002c, 0x0038, 0x0046, 0x0059, 0x0075,
807 0x009b, 0x00cc, 0x010c, 0x0160, 0x01cd, 0x025b, 0x0314, 0x0405,
808 0x053d, 0x06d2, 0x08df, 0x0b2d, 0x0e14, 0x11bd, 0x165a, 0x1c29,
809 0x237b, 0x2cb4, 0x3852, 0x46f5, 0x5967, 0x70a4, 0x8deb, 0xb2ce,
810 0xe148, 0xffff, 0xffff, 0xffff
811 },
812 { //Inter Chroma
813 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
814 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
815 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
816 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0002, 0x0003,
817 0x0003, 0x0004, 0x0005, 0x0007, 0x0008, 0x000b, 0x000d, 0x0011,
818 0x0015, 0x001b, 0x0021, 0x002a, 0x0035, 0x0043, 0x0054, 0x006c,
819 0x008c, 0x00b4, 0x00e7, 0x0129, 0x017d, 0x01ea, 0x0275, 0x0327,
820 0x040c, 0x0530, 0x06a7, 0x0862, 0x0a8f, 0x0d4e, 0x10c3, 0x151f,
821 0x1a9c, 0x2187, 0x2a3d, 0x3538, 0x430d, 0x547b, 0x6a70, 0x861b,
822 0xa8f6, 0xd4e0, 0xffff, 0xffff
823 },
824 }},
825 }}
826 }};
827
828 return MOS_STATUS_SUCCESS;
829 }
830
SetVdencCmd2Settings()831 MOS_STATUS EncodePreEncConstSettings::SetVdencCmd2Settings()
832 {
833 ENCODE_FUNC_CALL();
834 ENCODE_CHK_NULL_RETURN(m_featureSetting);
835
836 #if !(_MEDIA_RESERVED)
837 m_featureSetting->vdencCmd2Settings.emplace_back(
838 PREENC_VDENC_CMD2_LAMBDA()
839 {
840 par.extSettings.emplace_back(
841 [this, isLowDelay, preEncConfig, &par](uint32_t *data) {
842 uint32_t CodingTypeMinus1 = preEncConfig.CodingType - 1;
843 uint32_t lowDelay = isLowDelay;
844
845 static const uint32_t dw2Lut = 0x3;
846 data[2] |= dw2Lut;
847
848 static const uint32_t dw5Lut[3] = { 0xc0ac00, 0xc1ac00, 0xc0ac00,};
849 data[5] |= dw5Lut[CodingTypeMinus1];
850
851 static const uint32_t dw7Lut[3][2] = { { 0x64003, 0x64003,}, { 0x64003, 0xe4003,}, { 0x64003, 0xe4003,},};
852 data[7] |= dw7Lut[CodingTypeMinus1][lowDelay];
853
854 static const uint32_t dw8Lut[3][2] = { { 0x54555555, 0,}, { 0xfffdccaa, 0xfffdccaa,}, { 0xfffdfcaa, 0xfffdccaa,},};
855 data[8] |= dw8Lut[CodingTypeMinus1][lowDelay];
856
857 static const uint32_t dw9Lut[3][2] = { { 0x635555, 0x630000,}, { 0x63ffff, 0x63ffff,}, { 0x63fcff, 0x63ffff,},};
858 data[9] |= dw9Lut[CodingTypeMinus1][lowDelay];
859
860 static const uint32_t dw11Lut = 0x80000000;
861 data[11] |= dw11Lut;
862
863 static const uint32_t dw12Lut = 0xce4014a0;
864 data[12] |= dw12Lut;
865
866 static const uint32_t dw16Lut = 0xf000000;
867 data[16] |= dw16Lut;
868
869 static const uint32_t dw19Lut = 0x98000000;
870 data[19] |= dw19Lut;
871
872 static const uint32_t dw23Lut = 0xcccc0000;
873 data[23] |= dw23Lut;
874
875 static const uint32_t dw28Lut = 0x7d00fa0;
876 data[28] |= dw28Lut;
877
878 static const uint32_t dw29Lut = 0x2bc0bb8;
879 data[29] |= dw29Lut;
880
881 static const uint32_t dw30Lut = 0x32003e8;
882 data[30] |= dw30Lut;
883
884 static const uint32_t dw31Lut = 0x1f4012c;
885 data[31] |= dw31Lut;
886
887 static const uint32_t dw32Lut = 0x190;
888 data[32] |= dw32Lut;
889
890 static const uint32_t dw35Lut = 0xecc;
891 data[35] |= dw35Lut;
892
893 static const uint32_t dw51Lut = 0x22223552;
894 data[51] |= dw51Lut;
895
896 static const uint32_t dw52Lut = 0x1255959;
897 data[52] |= dw52Lut;
898
899 static const uint32_t dw53Lut = 0xff000000;
900 data[53] |= dw53Lut;
901
902 static const uint32_t dw54Lut = 0x44000000;
903 data[54] |= dw54Lut;
904
905 return MOS_STATUS_SUCCESS;
906 });
907
908 return MOS_STATUS_SUCCESS;
909 });
910 m_featureSetting->vdencCmd2Settings.emplace_back(
911 PREENC_VDENC_CMD2_LAMBDA()
912 {
913 par.extSettings.emplace_back(
914 [this, preEncConfig](uint32_t *data) {
915
916 uint8_t tmp0 = 0;
917 uint8_t tmp1 = 0;
918
919 if (preEncConfig.CodingType == I_TYPE)
920 {
921 tmp0 = 10;
922 }
923 else if (preEncConfig.HierarchicalFlag && preEncConfig.HierarchLevelPlus1 > 0)
924 {
925 //Hierachical GOP
926 if (preEncConfig.HierarchLevelPlus1 == 1)
927 {
928 tmp0 = 10;
929 }
930 else if (preEncConfig.HierarchLevelPlus1 == 2)
931 {
932 tmp0 = 9;
933 }
934 else
935 {
936 tmp0 = 8;
937 }
938 }
939 else
940 {
941 tmp0 = 10;
942 }
943
944 if (preEncConfig.CodingType == I_TYPE)
945 {
946 tmp1 = 4;
947 }
948 else if (preEncConfig.HierarchicalFlag && preEncConfig.HierarchLevelPlus1 > 0)
949 {
950 //Hierachical GOP
951 if (preEncConfig.HierarchLevelPlus1 == 1)
952 {
953 tmp1 = 4;
954 }
955 else if (preEncConfig.HierarchLevelPlus1 == 2)
956 {
957 tmp1 = 3;
958 }
959 else
960 {
961 tmp1 = 2;
962 }
963 }
964 else
965 {
966 tmp1 = 4;
967 }
968
969 tmp0 &= 0xf;
970 tmp1 &= 0xf;
971
972 data[32] |= (tmp1 << 16);
973 data[32] |= (tmp1 << 20);
974 data[32] |= (tmp0 << 24);
975 data[32] |= (tmp0 << 28);
976
977 data[33] |= tmp1;
978 data[33] |= (tmp1 << 4);
979 data[33] |= (tmp1 << 8);
980 data[33] |= (tmp1 << 12);
981 data[33] |= (tmp0 << 16);
982 data[33] |= (tmp0 << 20);
983 data[33] |= (tmp1 << 24);
984 data[33] |= (tmp1 << 28);
985
986 data[34] |= tmp1;
987 data[34] |= (tmp1 << 4);
988 data[34] |= (tmp0 << 8);
989 data[34] |= (tmp0 << 12);
990 data[34] |= (tmp1 << 16);
991 data[34] |= (tmp1 << 20);
992
993 return MOS_STATUS_SUCCESS;
994 });
995
996 return MOS_STATUS_SUCCESS;
997 });
998 #else
999 #define VDENC_CMD2_SETTINGS_EXT
1000 #include "encode_preenc_const_settings_ext.h"
1001 #undef VDENC_CMD2_SETTINGS_EXT
1002 #endif // !(_MEDIA_RESERVED)
1003
1004 return MOS_STATUS_SUCCESS;
1005 }
1006
1007 } // namespace encode
1008