Added
Link Here
|
1 |
--- libhb/qsv_common.c.orig 2024-12-01 15:28:40 UTC |
2 |
+++ libhb/qsv_common.c |
3 |
@@ -463,6 +463,7 @@ int qsv_map_mfx_platform_codename(int mfx_platform_cod |
4 |
case MFX_PLATFORM_DG2: |
5 |
case MFX_PLATFORM_ALDERLAKE_N: |
6 |
case MFX_PLATFORM_KEEMBAY: |
7 |
+#if (MFX_VERSION >= 2012) |
8 |
case MFX_PLATFORM_METEORLAKE: |
9 |
case MFX_PLATFORM_BATTLEMAGE: |
10 |
case MFX_PLATFORM_ARROWLAKE: |
11 |
@@ -471,6 +472,7 @@ int qsv_map_mfx_platform_codename(int mfx_platform_cod |
12 |
case MFX_PLATFORM_LUNARLAKE: |
13 |
platform = HB_CPU_PLATFORM_INTEL_LNL; |
14 |
break; |
15 |
+#endif |
16 |
default: |
17 |
platform = HB_CPU_PLATFORM_UNSPECIFIED; |
18 |
} |
19 |
@@ -984,7 +986,7 @@ static void init_ext_av1bitstream_option(mfxExtAV1Bits |
20 |
extAV1BitstreamParam->Header.BufferSz = sizeof(mfxExtAV1BitstreamParam); |
21 |
extAV1BitstreamParam->WriteIVFHeaders = MFX_CODINGOPTION_OFF; |
22 |
} |
23 |
- |
24 |
+#if (MFX_VERSION >= 2012) |
25 |
static void init_ext_av1screencontent_tools(mfxExtAV1ScreenContentTools *extScreenContentTools) |
26 |
{ |
27 |
if (extScreenContentTools == NULL) |
28 |
@@ -998,7 +1000,7 @@ static void init_ext_av1screencontent_tools(mfxExtAV1S |
29 |
extScreenContentTools->IntraBlockCopy = MFX_CODINGOPTION_OFF; |
30 |
extScreenContentTools->Palette = MFX_CODINGOPTION_OFF; |
31 |
} |
32 |
- |
33 |
+#endif |
34 |
static int query_capabilities(mfxSession session, int index, mfxVersion version, hb_qsv_info_t *info, int lowpower) |
35 |
{ |
36 |
/* |
37 |
@@ -1026,7 +1028,9 @@ static int query_capabilities(mfxSession session, int |
38 |
mfxExtMasteringDisplayColourVolume extMasteringDisplayColourVolume; |
39 |
mfxExtContentLightLevelInfo extContentLightLevelInfo; |
40 |
mfxExtAV1BitstreamParam extAV1BitstreamParam; |
41 |
+#if (MFX_VERSION >= 2012) |
42 |
mfxExtAV1ScreenContentTools extAV1ScreenContentToolsParam; |
43 |
+#endif |
44 |
mfxExtHyperModeParam extHyperEncodeParam; |
45 |
|
46 |
/* Reset capabilities before querying */ |
47 |
@@ -1460,6 +1464,7 @@ static int query_capabilities(mfxSession session, int |
48 |
info->capabilities |= HB_QSV_CAP_HYPERENCODE; |
49 |
} |
50 |
} |
51 |
+#if (MFX_VERSION >= 2012) |
52 |
if ((lowpower == MFX_CODINGOPTION_ON) && (info->codec_id == MFX_CODEC_AV1)) |
53 |
{ |
54 |
init_video_param(&videoParam); |
55 |
@@ -1494,6 +1499,7 @@ static int query_capabilities(mfxSession session, int |
56 |
info->capabilities |= HB_QSV_CAP_AV1_SCREENCONTENT; |
57 |
} |
58 |
} |
59 |
+#endif |
60 |
} |
61 |
|
62 |
return 0; |
63 |
@@ -1935,10 +1941,12 @@ static void log_encoder_capabilities(const int log_lev |
64 |
strcat(buffer, "+nmpslice"); |
65 |
} |
66 |
} |
67 |
+#if (MFX_VERSION >= 2012) |
68 |
if (caps & HB_QSV_CAP_AV1_SCREENCONTENT) |
69 |
{ |
70 |
strcat(buffer, " av1screencontent"); |
71 |
} |
72 |
+#endif |
73 |
if (caps & HB_QSV_CAP_HYPERENCODE) |
74 |
{ |
75 |
strcat(buffer, " hyperencode"); |
76 |
@@ -3011,6 +3019,7 @@ int hb_qsv_param_parse(hb_qsv_param_t *param, hb_qsv_i |
77 |
param->hyperEncodeParam.Mode = mode->value; |
78 |
} |
79 |
} |
80 |
+#if (MFX_VERSION >= 2012) |
81 |
else if (!strcasecmp(key, "palette")) |
82 |
{ |
83 |
if (info->capabilities & HB_QSV_CAP_AV1_SCREENCONTENT) |
84 |
@@ -3041,6 +3050,7 @@ int hb_qsv_param_parse(hb_qsv_param_t *param, hb_qsv_i |
85 |
return HB_QSV_PARAM_UNSUPPORTED; |
86 |
} |
87 |
} |
88 |
+#endif |
89 |
else if (!strcasecmp(key, "async-depth")) |
90 |
{ |
91 |
int async_depth = hb_qsv_atoi(value, &error); |
92 |
@@ -3527,13 +3537,14 @@ int hb_qsv_param_default(hb_qsv_param_t *param, mfxVid |
93 |
param->av1BitstreamParam.Header.BufferId = MFX_EXTBUFF_AV1_BITSTREAM_PARAM; |
94 |
param->av1BitstreamParam.Header.BufferSz = sizeof(mfxExtAV1BitstreamParam); |
95 |
param->av1BitstreamParam.WriteIVFHeaders = MFX_CODINGOPTION_OFF; |
96 |
+#if (MFX_VERSION >= 2012) |
97 |
// introduced in API 2.11 |
98 |
memset(¶m->av1ScreenContentToolsParam, 0, sizeof(mfxExtAV1ScreenContentTools)); |
99 |
param->av1ScreenContentToolsParam.Header.BufferId = MFX_EXTBUFF_AV1_SCREEN_CONTENT_TOOLS; |
100 |
param->av1ScreenContentToolsParam.Header.BufferSz = sizeof(mfxExtAV1ScreenContentTools); |
101 |
param->av1ScreenContentToolsParam.IntraBlockCopy = MFX_CODINGOPTION_OFF; |
102 |
param->av1ScreenContentToolsParam.Palette = MFX_CODINGOPTION_OFF; |
103 |
- |
104 |
+#endif |
105 |
// GOP & rate control |
106 |
param->gop.b_pyramid = 1; // enabled by default (if supported) |
107 |
param->gop.gop_pic_size = -1; // set automatically |
108 |
@@ -3607,10 +3618,12 @@ int hb_qsv_param_default(hb_qsv_param_t *param, mfxVid |
109 |
{ |
110 |
param->videoParam->ExtParam[param->videoParam->NumExtParam++] = (mfxExtBuffer*)¶m->av1BitstreamParam; |
111 |
} |
112 |
+#if (MFX_VERSION >= 2012) |
113 |
if (info->capabilities & HB_QSV_CAP_AV1_SCREENCONTENT) |
114 |
{ |
115 |
param->videoParam->ExtParam[param->videoParam->NumExtParam++] = (mfxExtBuffer*)¶m->av1ScreenContentToolsParam; |
116 |
} |
117 |
+#endif |
118 |
#if defined(_WIN32) || defined(__MINGW32__) |
119 |
if (info->capabilities & HB_QSV_CAP_LOWPOWER_ENCODE) |
120 |
{ |