Gentoo Archives: gentoo-commits

From: Alexis Ballier <aballier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-libs/x265/files/, media-libs/x265/
Date: Fri, 05 Jun 2020 15:21:34
Message-Id: 1591370394.3c02fc3caa35538b36de5d96aa7de5ef804a404b.aballier@gentoo
1 commit: 3c02fc3caa35538b36de5d96aa7de5ef804a404b
2 Author: Alexis Ballier <aballier <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 5 14:30:05 2020 +0000
4 Commit: Alexis Ballier <aballier <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 5 15:19:54 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3c02fc3c
7
8 media-libs/x265: restore previous behavior wrt asm. bump to 3.4.
9
10 Fix tests properly.
11
12 Package-Manager: Portage-2.3.100, Repoman-2.3.22
13 Signed-off-by: Alexis Ballier <aballier <AT> gentoo.org>
14
15 media-libs/x265/Manifest | 1 +
16 media-libs/x265/files/arm-r1.patch | 42 +++
17 media-libs/x265/files/test-ns.patch | 295 +++++++++++++++++++++
18 media-libs/x265/files/tests.patch | 16 ++
19 .../x265/{x265-9999.ebuild => x265-3.4.ebuild} | 127 ++++-----
20 media-libs/x265/x265-9999.ebuild | 127 ++++-----
21 6 files changed, 464 insertions(+), 144 deletions(-)
22
23 diff --git a/media-libs/x265/Manifest b/media-libs/x265/Manifest
24 index 7fdf4137f63..0d4b2ec0e0c 100644
25 --- a/media-libs/x265/Manifest
26 +++ b/media-libs/x265/Manifest
27 @@ -6,3 +6,4 @@ DIST x265_3.1.tar.gz 1419649 BLAKE2B b9151f136fdc6c0512f481af6c8d4d575ce4c75ef88
28 DIST x265_3.2.1.tar.gz 1426255 BLAKE2B 4184cfa290b36f497c5f3a5e3b597bf44e52dd20ba6af21c665d98709c9b984122a339d93aae572756a94549c0c1a293ee195c6c1d34902d298664ecf016f896 SHA512 5cb29b9d4475c1f686f6e31e47ccddde3db1639d5dcf9c058513389a9fdeb35a83b14e30e59498a76dec74bb0b410b6d8f5b1b45d18927be9811bb6a40d8d568
29 DIST x265_3.2.tar.gz 1425689 BLAKE2B 58da4aa52381ec89b0aea1dc896fef92d9ec9fc781fd279acd0a338cd872f52482c81c558dde749c1205dbc13341a9851c381d01e2f312f5e2b4712d2242b7d3 SHA512 08c779026fe4c03797efef9d6a898b16c308355311e167c81b976345eb78039725a31294c77a60b76b4ef648d8720e16b2d6524e7108755531a5375231f5313e
30 DIST x265_3.3.tar.gz 1438685 BLAKE2B 43806915c3b22fabff71c307dc53e9a3408262528f8ec01bf81168826eee26b468b0e68c738e3c0371f6de6121a3ac090bfaeed0cbfca0a3b8c57710d7f25ad0 SHA512 3d56900ecd58e83d2ecc93d956524e3b0e622dbe3c74a137c7b21f98599245547403401e9ec7f679996fd09fca788aa10272bf17e58a68fce449c8cb555ad7c0
31 +DIST x265_3.4.tar.gz 1469365 BLAKE2B 1021d9d62779d0cecddea56496b4e46bd8ccfd91fdf292efe412dc82b3c974095a5f9bd095057aa08e77b164555adc594549dea6aef7fbc0c025ae7295df721e SHA512 576b18711935e7da8433b2170d24ed159eb12ff1a18399360afa1b2132db33b463145c65ed918f667528ee954bbdfb5c69e5480f1c1df801515cefc592f3206e
32
33 diff --git a/media-libs/x265/files/arm-r1.patch b/media-libs/x265/files/arm-r1.patch
34 new file mode 100644
35 index 00000000000..8a8102dd258
36 --- /dev/null
37 +++ b/media-libs/x265/files/arm-r1.patch
38 @@ -0,0 +1,42 @@
39 +More aliases for ARM.
40 +Do not force CFLAGS for ARM.
41 +
42 +Index: source/CMakeLists.txt
43 +===================================================================
44 +--- source.orig/CMakeLists.txt
45 ++++ source/CMakeLists.txt
46 +@@ -40,7 +40,7 @@ SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_
47 + # System architecture detection
48 + string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" SYSPROC)
49 + set(X86_ALIASES x86 i386 i686 x86_64 amd64)
50 +-set(ARM_ALIASES armv6l armv7l aarch64)
51 ++set(ARM_ALIASES armv6l armv6l armv7l armv7a aarch64)
52 + list(FIND X86_ALIASES "${SYSPROC}" X86MATCH)
53 + list(FIND ARM_ALIASES "${SYSPROC}" ARMMATCH)
54 + set(POWER_ALIASES ppc64 ppc64le)
55 +@@ -239,11 +239,7 @@ if(GCC)
56 + endif()
57 + endif()
58 + if(ARM AND CROSS_COMPILE_ARM)
59 +- if(ARM64)
60 +- set(ARM_ARGS -fPIC)
61 +- else()
62 +- set(ARM_ARGS -march=armv6 -mfloat-abi=soft -mfpu=vfp -marm -fPIC)
63 +- endif()
64 ++ set(ARM_ARGS -fPIC)
65 + message(STATUS "cross compile arm")
66 + elseif(ARM)
67 + if(ARM64)
68 +@@ -252,10 +248,10 @@ if(GCC)
69 + else()
70 + find_package(Neon)
71 + if(CPU_HAS_NEON)
72 +- set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=neon -marm -fPIC)
73 ++ set(ARM_ARGS -mfpu=neon -fPIC)
74 + add_definitions(-DHAVE_NEON)
75 + else()
76 +- set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=vfp -marm)
77 ++ set(ARM_ARGS -fPIC)
78 + endif()
79 + endif()
80 + endif()
81
82 diff --git a/media-libs/x265/files/test-ns.patch b/media-libs/x265/files/test-ns.patch
83 new file mode 100644
84 index 00000000000..898751a7ae2
85 --- /dev/null
86 +++ b/media-libs/x265/files/test-ns.patch
87 @@ -0,0 +1,295 @@
88 +Namespace functions for multi-bitdepth builds so that libraries are self-contained.
89 +
90 +Index: source/common/param.h
91 +===================================================================
92 +--- source.orig/common/param.h
93 ++++ source/common/param.h
94 +@@ -53,6 +53,18 @@ int x265_param_default_preset(x265_param
95 + int x265_param_apply_profile(x265_param *, const char *profile);
96 + int x265_param_parse(x265_param *p, const char *name, const char *value);
97 + int x265_zone_param_parse(x265_param* p, const char* name, const char* value);
98 ++void x265_free_analysis_data(x265_param *param, x265_analysis_data* analysis);
99 ++void x265_alloc_analysis_data(x265_param *param, x265_analysis_data* analysis);
100 ++void x265_picture_free(x265_picture *);
101 ++x265_zone *x265_zone_alloc(int zoneCount, int isZoneFile);
102 ++void x265_zone_free(x265_param *param);
103 ++FILE* x265_csvlog_open(const x265_param *);
104 ++void x265_csvlog_frame(const x265_param *, const x265_picture *);
105 ++void x265_csvlog_encode(const x265_param*, const x265_stats *, int padx, int pady, int argc, char** argv);
106 ++void x265_dither_image(x265_picture *, int picWidth, int picHeight, int16_t *errorBuf, int bitDepth);
107 ++int x265_encoder_reconfig(x265_encoder *, x265_param *);
108 ++x265_picture *x265_picture_alloc(void);
109 ++void x265_picture_init(x265_param *param, x265_picture *pic);
110 + #define PARAM_NS X265_NS
111 + #endif
112 + }
113 +Index: source/encoder/api.cpp
114 +===================================================================
115 +--- source.orig/encoder/api.cpp
116 ++++ source/encoder/api.cpp
117 +@@ -106,9 +106,9 @@ x265_encoder *x265_encoder_open(x265_par
118 + if (p->rc.zoneCount || p->rc.zonefileCount)
119 + {
120 + int zoneCount = p->rc.zonefileCount ? p->rc.zonefileCount : p->rc.zoneCount;
121 +- param->rc.zones = x265_zone_alloc(zoneCount, !!p->rc.zonefileCount);
122 +- latestParam->rc.zones = x265_zone_alloc(zoneCount, !!p->rc.zonefileCount);
123 +- zoneParam->rc.zones = x265_zone_alloc(zoneCount, !!p->rc.zonefileCount);
124 ++ param->rc.zones = PARAM_NS::x265_zone_alloc(zoneCount, !!p->rc.zonefileCount);
125 ++ latestParam->rc.zones = PARAM_NS::x265_zone_alloc(zoneCount, !!p->rc.zonefileCount);
126 ++ zoneParam->rc.zones = PARAM_NS::x265_zone_alloc(zoneCount, !!p->rc.zonefileCount);
127 + }
128 +
129 + x265_copy_params(param, p);
130 +@@ -216,7 +216,7 @@ x265_encoder *x265_encoder_open(x265_par
131 + /* Try to open CSV file handle */
132 + if (encoder->m_param->csvfn)
133 + {
134 +- encoder->m_param->csvfpt = x265_csvlog_open(encoder->m_param);
135 ++ encoder->m_param->csvfpt = PARAM_NS::x265_csvlog_open(encoder->m_param);
136 + if (!encoder->m_param->csvfpt)
137 + {
138 + x265_log(encoder->m_param, X265_LOG_ERROR, "Unable to open CSV log file <%s>, aborting\n", encoder->m_param->csvfn);
139 +@@ -321,7 +321,7 @@ int x265_encoder_reconfig(x265_encoder*
140 + if (encoder->m_latestParam->rc.zoneCount || encoder->m_latestParam->rc.zonefileCount)
141 + {
142 + int zoneCount = encoder->m_latestParam->rc.zonefileCount ? encoder->m_latestParam->rc.zonefileCount : encoder->m_latestParam->rc.zoneCount;
143 +- save.rc.zones = x265_zone_alloc(zoneCount, !!encoder->m_latestParam->rc.zonefileCount);
144 ++ save.rc.zones = PARAM_NS::x265_zone_alloc(zoneCount, !!encoder->m_latestParam->rc.zonefileCount);
145 + }
146 + x265_copy_params(&save, encoder->m_latestParam);
147 + int ret = encoder->reconfigureParam(encoder->m_latestParam, param_in);
148 +@@ -604,7 +604,7 @@ fail:
149 + *pi_nal = 0;
150 +
151 + if (numEncoded && encoder->m_param->csvLogLevel && encoder->m_outputCount >= encoder->m_latestParam->chunkStart)
152 +- x265_csvlog_frame(encoder->m_param, pic_out);
153 ++ PARAM_NS::x265_csvlog_frame(encoder->m_param, pic_out);
154 +
155 + if (numEncoded < 0)
156 + encoder->m_aborted = true;
157 +@@ -637,7 +637,7 @@ void x265_vmaf_encoder_log(x265_encoder*
158 + encoder->fetchStats(&stats, sizeof(stats));
159 + int padx = encoder->m_sps.conformanceWindow.rightOffset;
160 + int pady = encoder->m_sps.conformanceWindow.bottomOffset;
161 +- x265_csvlog_encode(encoder->m_param, &stats, padx, pady, argc, argv);
162 ++ PARAM_NS::x265_csvlog_encode(encoder->m_param, &stats, padx, pady, argc, argv);
163 + }
164 + }
165 + #endif
166 +@@ -651,7 +651,7 @@ void x265_encoder_log(x265_encoder* enc,
167 + encoder->fetchStats(&stats, sizeof(stats));
168 + int padx = encoder->m_sps.conformanceWindow.rightOffset;
169 + int pady = encoder->m_sps.conformanceWindow.bottomOffset;
170 +- x265_csvlog_encode(encoder->m_param, &stats, padx, pady, argc, argv);
171 ++ PARAM_NS::x265_csvlog_encode(encoder->m_param, &stats, padx, pady, argc, argv);
172 + }
173 + }
174 +
175 +@@ -872,7 +872,7 @@ void x265_alloc_analysis_data(x265_param
176 + return;
177 +
178 + fail:
179 +- x265_free_analysis_data(param, analysis);
180 ++ PARAM_NS::x265_free_analysis_data(param, analysis);
181 + }
182 +
183 + void x265_free_analysis_data(x265_param *param, x265_analysis_data* analysis)
184 +Index: source/encoder/encoder.cpp
185 +===================================================================
186 +--- source.orig/encoder/encoder.cpp
187 ++++ source/encoder/encoder.cpp
188 +@@ -186,8 +186,8 @@ void Encoder::create()
189 + {
190 + m_dupBuffer[i] = (AdaptiveFrameDuplication*)x265_malloc(sizeof(AdaptiveFrameDuplication));
191 + m_dupBuffer[i]->dupPic = NULL;
192 +- m_dupBuffer[i]->dupPic = x265_picture_alloc();
193 +- x265_picture_init(p, m_dupBuffer[i]->dupPic);
194 ++ m_dupBuffer[i]->dupPic = PARAM_NS::x265_picture_alloc();
195 ++ PARAM_NS::x265_picture_init(p, m_dupBuffer[i]->dupPic);
196 + m_dupBuffer[i]->dupPlane = NULL;
197 + m_dupBuffer[i]->dupPlane = X265_MALLOC(char, framesize);
198 + m_dupBuffer[i]->dupPic->planes[0] = m_dupBuffer[i]->dupPlane;
199 +@@ -756,7 +756,7 @@ int Encoder::setAnalysisData(x265_analys
200 + curFrame->m_analysisData = (*analysis_data);
201 + curFrame->m_analysisData.numCUsInFrame = widthInCU * heightInCU;
202 + curFrame->m_analysisData.numPartitions = m_param->num4x4Partitions;
203 +- x265_alloc_analysis_data(m_param, &curFrame->m_analysisData);
204 ++ PARAM_NS::x265_alloc_analysis_data(m_param, &curFrame->m_analysisData);
205 + if (m_param->maxCUSize == 16)
206 + {
207 + if (analysis_data->sliceType == X265_TYPE_IDR || analysis_data->sliceType == X265_TYPE_I)
208 +@@ -860,7 +860,7 @@ void Encoder::destroy()
209 + for (uint32_t i = 0; i < DUP_BUFFER; i++)
210 + {
211 + X265_FREE(m_dupBuffer[i]->dupPlane);
212 +- x265_picture_free(m_dupBuffer[i]->dupPic);
213 ++ PARAM_NS::x265_picture_free(m_dupBuffer[i]->dupPic);
214 + X265_FREE(m_dupBuffer[i]);
215 + }
216 +
217 +@@ -1592,7 +1592,7 @@ int Encoder::encode(const x265_picture*
218 + if (m_exportedPic)
219 + {
220 + if (!m_param->bUseAnalysisFile && m_param->analysisSave)
221 +- x265_free_analysis_data(m_param, &m_exportedPic->m_analysisData);
222 ++ PARAM_NS::x265_free_analysis_data(m_param, &m_exportedPic->m_analysisData);
223 + ATOMIC_DEC(&m_exportedPic->m_countRefEncoders);
224 + m_exportedPic = NULL;
225 + m_dpb->recycleUnreferenced();
226 +@@ -1968,7 +1968,7 @@ int Encoder::encode(const x265_picture*
227 +
228 + /* Free up inputPic->analysisData since it has already been used */
229 + if ((m_param->analysisLoad && !m_param->analysisSave) || ((m_param->bAnalysisType == AVC_INFO) && slice->m_sliceType != I_SLICE))
230 +- x265_free_analysis_data(m_param, &outFrame->m_analysisData);
231 ++ PARAM_NS::x265_free_analysis_data(m_param, &outFrame->m_analysisData);
232 +
233 + if (pic_out)
234 + {
235 +@@ -2046,7 +2046,7 @@ int Encoder::encode(const x265_picture*
236 + writeAnalysisFile(&pic_out->analysisData, *outFrame->m_encData);
237 + pic_out->analysisData.saveParam = pic_out->analysisData.saveParam;
238 + if (m_param->bUseAnalysisFile)
239 +- x265_free_analysis_data(m_param, &pic_out->analysisData);
240 ++ PARAM_NS::x265_free_analysis_data(m_param, &pic_out->analysisData);
241 + }
242 + }
243 + if (m_param->rc.bStatWrite && (m_param->analysisMultiPassRefine || m_param->analysisMultiPassDistortion))
244 +@@ -2061,7 +2061,7 @@ int Encoder::encode(const x265_picture*
245 + writeAnalysisFileRefine(&outFrame->m_analysisData, *outFrame->m_encData);
246 + }
247 + if (m_param->analysisMultiPassRefine || m_param->analysisMultiPassDistortion)
248 +- x265_free_analysis_data(m_param, &outFrame->m_analysisData);
249 ++ PARAM_NS::x265_free_analysis_data(m_param, &outFrame->m_analysisData);
250 + if (m_param->internalCsp == X265_CSP_I400)
251 + {
252 + if (slice->m_sliceType == P_SLICE)
253 +@@ -2199,7 +2199,7 @@ int Encoder::encode(const x265_picture*
254 + uint32_t heightInCU = (m_param->sourceHeight + m_param->maxCUSize - 1) >> m_param->maxLog2CUSize;
255 + frameEnc->m_analysisData.numCUsInFrame = widthInCU * heightInCU;
256 + frameEnc->m_analysisData.numPartitions = m_param->num4x4Partitions;
257 +- x265_alloc_analysis_data(m_param, &frameEnc->m_analysisData);
258 ++ PARAM_NS::x265_alloc_analysis_data(m_param, &frameEnc->m_analysisData);
259 + frameEnc->m_analysisData.poc = frameEnc->m_poc;
260 + if (m_param->rc.bStatRead)
261 + readAnalysisFile(&frameEnc->m_analysisData, frameEnc->m_poc, frameEnc->m_lowres.sliceType);
262 +@@ -2210,7 +2210,7 @@ int Encoder::encode(const x265_picture*
263 + for (int i = 0; i < m_param->rc.zonefileCount; i++)
264 + {
265 + if (m_param->rc.zones[i].startFrame == frameEnc->m_poc)
266 +- x265_encoder_reconfig(this, m_param->rc.zones[i].zoneParam);
267 ++ PARAM_NS::x265_encoder_reconfig(this, m_param->rc.zones[i].zoneParam);
268 + }
269 + }
270 +
271 +@@ -2353,7 +2353,7 @@ int Encoder::encode(const x265_picture*
272 + analysis->numCUsInFrame = numCUsInFrame;
273 + analysis->numCuInHeight = heightInCU;
274 + analysis->numPartitions = m_param->num4x4Partitions;
275 +- x265_alloc_analysis_data(m_param, analysis);
276 ++ PARAM_NS::x265_alloc_analysis_data(m_param, analysis);
277 + }
278 + /* determine references, setup RPS, etc */
279 + m_dpb->prepareEncode(frameEnc);
280 +@@ -4264,7 +4264,7 @@ void Encoder::readAnalysisFile(x265_anal
281 + else if (fread(val, size, readSize, fileOffset) != readSize)\
282 + {\
283 + x265_log(NULL, X265_LOG_ERROR, "Error reading analysis data\n");\
284 +- x265_free_analysis_data(m_param, analysis);\
285 ++ PARAM_NS::x265_free_analysis_data(m_param, analysis);\
286 + m_aborted = true;\
287 + return;\
288 + }\
289 +@@ -4300,7 +4300,7 @@ void Encoder::readAnalysisFile(x265_anal
290 + if (poc != curPoc || feof(m_analysisFileIn))
291 + {
292 + x265_log(NULL, X265_LOG_WARNING, "Error reading analysis data: Cannot find POC %d\n", curPoc);
293 +- x265_free_analysis_data(m_param, analysis);
294 ++ PARAM_NS::x265_free_analysis_data(m_param, analysis);
295 + return;
296 + }
297 + }
298 +@@ -4334,7 +4334,7 @@ void Encoder::readAnalysisFile(x265_anal
299 + if (m_param->scaleFactor)
300 + analysis->numPartitions *= factor;
301 + /* Memory is allocated for inter and intra analysis data based on the slicetype */
302 +- x265_alloc_analysis_data(m_param, analysis);
303 ++ PARAM_NS::x265_alloc_analysis_data(m_param, analysis);
304 +
305 + if (m_param->ctuDistortionRefine == CTU_DISTORTION_INTERNAL)
306 + {
307 +@@ -4587,7 +4587,7 @@ void Encoder::readAnalysisFile(x265_anal
308 + else if (fread(val, size, readSize, fileOffset) != readSize)\
309 + {\
310 + x265_log(NULL, X265_LOG_ERROR, "Error reading analysis data\n");\
311 +- x265_free_analysis_data(m_param, analysis);\
312 ++ PARAM_NS::x265_free_analysis_data(m_param, analysis);\
313 + m_aborted = true;\
314 + return;\
315 + }\
316 +@@ -4624,7 +4624,7 @@ void Encoder::readAnalysisFile(x265_anal
317 + if (poc != curPoc || feof(m_analysisFileIn))
318 + {
319 + x265_log(NULL, X265_LOG_WARNING, "Error reading analysis data: Cannot find POC %d\n", curPoc);
320 +- x265_free_analysis_data(m_param, analysis);
321 ++ PARAM_NS::x265_free_analysis_data(m_param, analysis);
322 + return;
323 + }
324 + }
325 +@@ -4655,7 +4655,7 @@ void Encoder::readAnalysisFile(x265_anal
326 + analysis->numCuInHeight = cuLoc.heightInCU;
327 +
328 + /* Memory is allocated for inter and intra analysis data based on the slicetype */
329 +- x265_alloc_analysis_data(m_param, analysis);
330 ++ PARAM_NS::x265_alloc_analysis_data(m_param, analysis);
331 +
332 + if (m_param->ctuDistortionRefine == CTU_DISTORTION_INTERNAL)
333 + {
334 +@@ -5257,7 +5257,7 @@ void Encoder::readAnalysisFile(x265_anal
335 + if (fread(val, size, readSize, fileOffset) != readSize)\
336 + {\
337 + x265_log(NULL, X265_LOG_ERROR, "Error reading analysis 2 pass data\n"); \
338 +- x265_alloc_analysis_data(m_param, analysis); \
339 ++ PARAM_NS::x265_alloc_analysis_data(m_param, analysis); \
340 + m_aborted = true; \
341 + return; \
342 + }\
343 +@@ -5271,7 +5271,7 @@ void Encoder::readAnalysisFile(x265_anal
344 + if (poc != curPoc || feof(m_analysisFileIn))
345 + {
346 + x265_log(NULL, X265_LOG_WARNING, "Error reading analysis 2 pass data: Cannot find POC %d\n", curPoc);
347 +- x265_free_analysis_data(m_param, analysis);
348 ++ PARAM_NS::x265_free_analysis_data(m_param, analysis);
349 + return;
350 + }
351 + /* Now arrived at the right frame, read the record */
352 +@@ -5378,7 +5378,7 @@ void Encoder::writeAnalysisFile(x265_ana
353 + if (fwrite(val, size, writeSize, fileOffset) < writeSize)\
354 + {\
355 + x265_log(NULL, X265_LOG_ERROR, "Error writing analysis data\n");\
356 +- x265_free_analysis_data(m_param, analysis);\
357 ++ PARAM_NS::x265_free_analysis_data(m_param, analysis);\
358 + m_aborted = true;\
359 + return;\
360 + }\
361 +@@ -5600,7 +5600,7 @@ void Encoder::writeAnalysisFileRefine(x2
362 + if (fwrite(val, size, writeSize, fileOffset) < writeSize)\
363 + {\
364 + x265_log(NULL, X265_LOG_ERROR, "Error writing analysis 2 pass data\n"); \
365 +- x265_free_analysis_data(m_param, analysis); \
366 ++ PARAM_NS::x265_free_analysis_data(m_param, analysis); \
367 + m_aborted = true; \
368 + return; \
369 + }\
370 +Index: source/common/param.cpp
371 +===================================================================
372 +--- source.orig/common/param.cpp
373 ++++ source/common/param.cpp
374 +@@ -102,7 +102,7 @@ x265_param *x265_param_alloc()
375 +
376 + void x265_param_free(x265_param* p)
377 + {
378 +- x265_zone_free(p);
379 ++ PARAM_NS::x265_zone_free(p);
380 + #ifdef SVT_HEVC
381 + x265_free(p->svtHevcParam);
382 + #endif
383
384 diff --git a/media-libs/x265/files/tests.patch b/media-libs/x265/files/tests.patch
385 new file mode 100644
386 index 00000000000..6c85829ee22
387 --- /dev/null
388 +++ b/media-libs/x265/files/tests.patch
389 @@ -0,0 +1,16 @@
390 +Tests run against static library (upstream build system):
391 +We build main as both shared & static, main10 & 12 are static only and linked into main.
392 +All need PLATFORM_LIBS, so instruct cmake to also link them.
393 +
394 +Index: source/CMakeLists.txt
395 +===================================================================
396 +--- source.orig/CMakeLists.txt
397 ++++ source/CMakeLists.txt
398 +@@ -578,6 +578,7 @@ endif()
399 + if(SVTHEVC_FOUND)
400 + target_link_libraries(x265-static ${SVT_HEVC_LIBRARY})
401 + endif()
402 ++target_link_libraries(x265-static ${PLATFORM_LIBS})
403 + install(TARGETS x265-static
404 + LIBRARY DESTINATION ${LIB_INSTALL_DIR}
405 + ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
406
407 diff --git a/media-libs/x265/x265-9999.ebuild b/media-libs/x265/x265-3.4.ebuild
408 similarity index 67%
409 copy from media-libs/x265/x265-9999.ebuild
410 copy to media-libs/x265/x265-3.4.ebuild
411 index 736bea15bb8..f973a0196a7 100644
412 --- a/media-libs/x265/x265-9999.ebuild
413 +++ b/media-libs/x265/x265-3.4.ebuild
414 @@ -1,10 +1,9 @@
415 # Copyright 1999-2020 Gentoo Authors
416 # Distributed under the terms of the GNU General Public License v2
417
418 -EAPI="7"
419 +EAPI=7
420
421 -CMAKE_ECLASS=cmake
422 -inherit flag-o-matic multibuild cmake-multilib
423 +inherit cmake multilib-minimal multilib multibuild flag-o-matic
424
425 if [[ ${PV} = 9999* ]]; then
426 inherit mercurial
427 @@ -19,31 +18,27 @@ HOMEPAGE="http://x265.org/ https://bitbucket.org/multicoreware/x265/wiki/Home"
428
429 LICENSE="GPL-2"
430 # subslot = libx265 soname
431 -SLOT="0/188"
432 -IUSE="+asm +10bit +12bit cpu_flags_arm_neon cpu_flags_ppc_altivec numa power8 test"
433 -
434 -# Test suite requires assembly support and is known to be broken
435 -RESTRICT="test"
436 -
437 -ASM_DEPEND=">=dev-lang/nasm-2.13"
438 -
439 -BDEPEND="asm? (
440 - abi_x86_32? ( ${ASM_DEPEND} )
441 - abi_x86_64? ( ${ASM_DEPEND} )
442 - )"
443 +SLOT="0/192"
444 +IUSE="+10bit +12bit cpu_flags_arm_neon numa pic power8 test"
445 +RESTRICT="!test? ( test )"
446
447 RDEPEND="numa? ( >=sys-process/numactl-2.0.10-r1[${MULTILIB_USEDEP}] )"
448 -
449 DEPEND="${RDEPEND}"
450 +ASM_DEPEND=">=dev-lang/nasm-2.13"
451 +BDEPEND="
452 + abi_x86_32? ( ${ASM_DEPEND} )
453 + abi_x86_64? ( ${ASM_DEPEND} )"
454
455 PATCHES=(
456 - "${FILESDIR}"/${PN}-3.3-arm.patch
457 - "${FILESDIR}"/${PN}-3.3-neon.patch
458 - "${FILESDIR}"/${PN}-3.3-ppc64.patch
459 + "${FILESDIR}/arm-r1.patch"
460 + "${FILESDIR}/neon.patch"
461 + "${FILESDIR}/x265-3.3-ppc64.patch"
462 + "${FILESDIR}/tests.patch"
463 + "${FILESDIR}/test-ns.patch"
464 )
465
466 src_unpack() {
467 - if [[ ${PV} = 9999* ]] ; then
468 + if [[ ${PV} = 9999* ]]; then
469 mercurial_src_unpack
470 # Can't set it at global scope due to mercurial.eclass limitations...
471 export S=${WORKDIR}/${P}/source
472 @@ -67,11 +62,11 @@ src_unpack() {
473 # allow disabling it: "main" *MUST* come last in the following list.
474
475 x265_get_variants() {
476 - local -a variants=()
477 - use 12bit && variants+=( main12 )
478 - use 10bit && variants+=( main10 )
479 - variants+=( main )
480 - echo "${variants[@]}"
481 + local variants=""
482 + use 12bit && variants+="main12 "
483 + use 10bit && variants+="main10 "
484 + variants+="main"
485 + echo "${variants}"
486 }
487
488 x265_variant_src_configure() {
489 @@ -88,8 +83,17 @@ x265_variant_src_configure() {
490 -DENABLE_CLI=OFF
491 -DMAIN12=ON
492 )
493 - # disable altivec for 12bit build #607802#c5
494 - [[ ${ABI} = ppc* ]] && mycmakeargs+=( -DENABLE_ALTIVEC=OFF )
495 + if [[ ${ABI} = x86 ]] ; then
496 + mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
497 + fi
498 + if [[ ${ABI} = arm ]] ; then
499 + # 589674
500 + mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
501 + fi
502 + if [[ ${ABI} = ppc64 ]] ; then
503 + # https://bugs.gentoo.org/show_bug.cgi?id=607802#c5
504 + mycmakeargs+=( -DENABLE_ASSEMBLY=OFF -DENABLE_ALTIVEC=OFF )
505 + fi
506 ;;
507 "main10")
508 mycmakeargs+=(
509 @@ -98,8 +102,17 @@ x265_variant_src_configure() {
510 -DENABLE_SHARED=OFF
511 -DENABLE_CLI=OFF
512 )
513 - # disable altivec for 10bit build #607802#c5
514 - [[ ${ABI} = ppc* ]] && mycmakeargs+=( -DENABLE_ALTIVEC=OFF )
515 + if [[ ${ABI} = x86 ]] ; then
516 + mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
517 + fi
518 + if [[ ${ABI} = arm ]] ; then
519 + # 589674
520 + mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
521 + fi
522 + if [[ ${ABI} = ppc64 ]] ; then
523 + # https://bugs.gentoo.org/show_bug.cgi?id=607802#c5
524 + mycmakeargs+=( -DENABLE_ASSEMBLY=OFF -DENABLE_ALTIVEC=OFF )
525 + fi
526 ;;
527 "main")
528 if (( "${#MULTIBUILD_VARIANTS[@]}" > 1 )) ; then
529 @@ -107,7 +120,7 @@ x265_variant_src_configure() {
530 unset myvariants[${#MULTIBUILD_VARIANTS[@]}-1]
531 local liblist="" v=
532 for v in "${myvariants[@]}" ; do
533 - ln -s "${BUILD_DIR%-*}-${v}/libx265.a" "libx265_${v}.a" || die
534 + ln -s "${BUILD_DIR%-*}-${v}/libx265.a" "libx265_${v}.a" || die
535 liblist+="libx265_${v}.a;"
536 done
537 mycmakeargs+=(
538 @@ -116,68 +129,38 @@ x265_variant_src_configure() {
539 -DLINKED_10BIT=$(usex 10bit)
540 -DLINKED_12BIT=$(usex 12bit)
541 )
542 - # we have to handle ppc here and not in multilib_src_configure
543 - # because we want those flags apply ONLY to "main" variant
544 - if [[ ${ABI} = ppc* ]] ; then
545 - myabicmakeargs+=(
546 - -DCPU_POWER8=$(usex power8 ON OFF)
547 - -DENABLE_ALTIVEC=$(usex cpu_flags_ppc_altivec ON OFF)
548 - )
549 - fi
550 fi
551 ;;
552 *)
553 die "Unknown variant: ${MULTIBUILD_VARIANT}";;
554 esac
555 -
556 cmake_src_configure
557 popd >/dev/null || die
558 }
559
560 multilib_src_configure() {
561 local myabicmakeargs=(
562 + -DENABLE_TESTS=$(usex test ON OFF)
563 $(multilib_is_native_abi || echo "-DENABLE_CLI=OFF")
564 -DENABLE_PIC=ON
565 -DENABLE_LIBNUMA=$(usex numa ON OFF)
566 + -DCPU_POWER8=$(usex power8 ON OFF)
567 + -DENABLE_ALTIVEC=$(usex power8 ON OFF)
568 -DLIB_INSTALL_DIR="$(get_libdir)"
569 )
570
571 - local supports_asm=yes
572 -
573 if [[ ${ABI} = x86 ]] ; then
574 - if use asm ; then
575 - # Bug #528202
576 - ewarn "x86 asm is not PIC-safe, disabling it."
577 - supports_asm=no
578 + # Bug #528202
579 + if use pic ; then
580 + ewarn "PIC has been requested but x86 asm is not PIC-safe, disabling it."
581 + myabicmakeargs+=( -DENABLE_ASSEMBLY=OFF )
582 fi
583 elif [[ ${ABI} = x32 ]] ; then
584 - if use asm ; then
585 - # bug #510890
586 - ewarn "x32 ABI doesn't support asm"
587 - supports_asm=no
588 - fi
589 - elif [[ ${ABI} = arm ]] ; then
590 - if use asm && use cpu_flags_arm_neon ; then
591 - supports_asm=yes
592 - elif use asm ; then
593 - ewarn "arm asm is not PIC-safe, disabling it."
594 - supports_asm=no
595 - fi
596 - elif [[ ${ABI} = ppc* ]] ; then
597 - if use asm ; then
598 - ewarn "ppc64 uses altivec instead of asm, disabling it."
599 - supports_asm=no
600 - fi
601 - fi
602 -
603 - if [[ "${supports_asm}" = yes ]] && use asm ; then
604 - myabicmakeargs+=( -DENABLE_ASSEMBLY=ON )
605 -
606 - if multilib_is_native_abi ; then
607 - myabicmakeargs+=( -DENABLE_TESTS=$(usex test ON OFF) )
608 - fi
609 - else
610 + # bug #510890
611 myabicmakeargs+=( -DENABLE_ASSEMBLY=OFF )
612 + elif [[ ${ABI} = arm ]] ; then
613 + myabicmakeargs+=( -DENABLE_ASSEMBLY=$(usex pic OFF $(usex cpu_flags_arm_neon ON OFF)) )
614 + use cpu_flags_arm_neon && use pic && ewarn "PIC has been requested but arm neon asm is not PIC-safe, disabling it."
615 fi
616
617 local MULTIBUILD_VARIANTS=( $(x265_get_variants) )
618 @@ -190,7 +173,7 @@ multilib_src_compile() {
619 }
620
621 x265_variant_src_test() {
622 - if [[ -x "${BUILD_DIR}/test/TestBench" ]] ; then
623 + if [ -x "${BUILD_DIR}/test/TestBench" ] ; then
624 "${BUILD_DIR}/test/TestBench" || die
625 else
626 einfo "Unit tests check only assembly."
627
628 diff --git a/media-libs/x265/x265-9999.ebuild b/media-libs/x265/x265-9999.ebuild
629 index 736bea15bb8..f973a0196a7 100644
630 --- a/media-libs/x265/x265-9999.ebuild
631 +++ b/media-libs/x265/x265-9999.ebuild
632 @@ -1,10 +1,9 @@
633 # Copyright 1999-2020 Gentoo Authors
634 # Distributed under the terms of the GNU General Public License v2
635
636 -EAPI="7"
637 +EAPI=7
638
639 -CMAKE_ECLASS=cmake
640 -inherit flag-o-matic multibuild cmake-multilib
641 +inherit cmake multilib-minimal multilib multibuild flag-o-matic
642
643 if [[ ${PV} = 9999* ]]; then
644 inherit mercurial
645 @@ -19,31 +18,27 @@ HOMEPAGE="http://x265.org/ https://bitbucket.org/multicoreware/x265/wiki/Home"
646
647 LICENSE="GPL-2"
648 # subslot = libx265 soname
649 -SLOT="0/188"
650 -IUSE="+asm +10bit +12bit cpu_flags_arm_neon cpu_flags_ppc_altivec numa power8 test"
651 -
652 -# Test suite requires assembly support and is known to be broken
653 -RESTRICT="test"
654 -
655 -ASM_DEPEND=">=dev-lang/nasm-2.13"
656 -
657 -BDEPEND="asm? (
658 - abi_x86_32? ( ${ASM_DEPEND} )
659 - abi_x86_64? ( ${ASM_DEPEND} )
660 - )"
661 +SLOT="0/192"
662 +IUSE="+10bit +12bit cpu_flags_arm_neon numa pic power8 test"
663 +RESTRICT="!test? ( test )"
664
665 RDEPEND="numa? ( >=sys-process/numactl-2.0.10-r1[${MULTILIB_USEDEP}] )"
666 -
667 DEPEND="${RDEPEND}"
668 +ASM_DEPEND=">=dev-lang/nasm-2.13"
669 +BDEPEND="
670 + abi_x86_32? ( ${ASM_DEPEND} )
671 + abi_x86_64? ( ${ASM_DEPEND} )"
672
673 PATCHES=(
674 - "${FILESDIR}"/${PN}-3.3-arm.patch
675 - "${FILESDIR}"/${PN}-3.3-neon.patch
676 - "${FILESDIR}"/${PN}-3.3-ppc64.patch
677 + "${FILESDIR}/arm-r1.patch"
678 + "${FILESDIR}/neon.patch"
679 + "${FILESDIR}/x265-3.3-ppc64.patch"
680 + "${FILESDIR}/tests.patch"
681 + "${FILESDIR}/test-ns.patch"
682 )
683
684 src_unpack() {
685 - if [[ ${PV} = 9999* ]] ; then
686 + if [[ ${PV} = 9999* ]]; then
687 mercurial_src_unpack
688 # Can't set it at global scope due to mercurial.eclass limitations...
689 export S=${WORKDIR}/${P}/source
690 @@ -67,11 +62,11 @@ src_unpack() {
691 # allow disabling it: "main" *MUST* come last in the following list.
692
693 x265_get_variants() {
694 - local -a variants=()
695 - use 12bit && variants+=( main12 )
696 - use 10bit && variants+=( main10 )
697 - variants+=( main )
698 - echo "${variants[@]}"
699 + local variants=""
700 + use 12bit && variants+="main12 "
701 + use 10bit && variants+="main10 "
702 + variants+="main"
703 + echo "${variants}"
704 }
705
706 x265_variant_src_configure() {
707 @@ -88,8 +83,17 @@ x265_variant_src_configure() {
708 -DENABLE_CLI=OFF
709 -DMAIN12=ON
710 )
711 - # disable altivec for 12bit build #607802#c5
712 - [[ ${ABI} = ppc* ]] && mycmakeargs+=( -DENABLE_ALTIVEC=OFF )
713 + if [[ ${ABI} = x86 ]] ; then
714 + mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
715 + fi
716 + if [[ ${ABI} = arm ]] ; then
717 + # 589674
718 + mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
719 + fi
720 + if [[ ${ABI} = ppc64 ]] ; then
721 + # https://bugs.gentoo.org/show_bug.cgi?id=607802#c5
722 + mycmakeargs+=( -DENABLE_ASSEMBLY=OFF -DENABLE_ALTIVEC=OFF )
723 + fi
724 ;;
725 "main10")
726 mycmakeargs+=(
727 @@ -98,8 +102,17 @@ x265_variant_src_configure() {
728 -DENABLE_SHARED=OFF
729 -DENABLE_CLI=OFF
730 )
731 - # disable altivec for 10bit build #607802#c5
732 - [[ ${ABI} = ppc* ]] && mycmakeargs+=( -DENABLE_ALTIVEC=OFF )
733 + if [[ ${ABI} = x86 ]] ; then
734 + mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
735 + fi
736 + if [[ ${ABI} = arm ]] ; then
737 + # 589674
738 + mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
739 + fi
740 + if [[ ${ABI} = ppc64 ]] ; then
741 + # https://bugs.gentoo.org/show_bug.cgi?id=607802#c5
742 + mycmakeargs+=( -DENABLE_ASSEMBLY=OFF -DENABLE_ALTIVEC=OFF )
743 + fi
744 ;;
745 "main")
746 if (( "${#MULTIBUILD_VARIANTS[@]}" > 1 )) ; then
747 @@ -107,7 +120,7 @@ x265_variant_src_configure() {
748 unset myvariants[${#MULTIBUILD_VARIANTS[@]}-1]
749 local liblist="" v=
750 for v in "${myvariants[@]}" ; do
751 - ln -s "${BUILD_DIR%-*}-${v}/libx265.a" "libx265_${v}.a" || die
752 + ln -s "${BUILD_DIR%-*}-${v}/libx265.a" "libx265_${v}.a" || die
753 liblist+="libx265_${v}.a;"
754 done
755 mycmakeargs+=(
756 @@ -116,68 +129,38 @@ x265_variant_src_configure() {
757 -DLINKED_10BIT=$(usex 10bit)
758 -DLINKED_12BIT=$(usex 12bit)
759 )
760 - # we have to handle ppc here and not in multilib_src_configure
761 - # because we want those flags apply ONLY to "main" variant
762 - if [[ ${ABI} = ppc* ]] ; then
763 - myabicmakeargs+=(
764 - -DCPU_POWER8=$(usex power8 ON OFF)
765 - -DENABLE_ALTIVEC=$(usex cpu_flags_ppc_altivec ON OFF)
766 - )
767 - fi
768 fi
769 ;;
770 *)
771 die "Unknown variant: ${MULTIBUILD_VARIANT}";;
772 esac
773 -
774 cmake_src_configure
775 popd >/dev/null || die
776 }
777
778 multilib_src_configure() {
779 local myabicmakeargs=(
780 + -DENABLE_TESTS=$(usex test ON OFF)
781 $(multilib_is_native_abi || echo "-DENABLE_CLI=OFF")
782 -DENABLE_PIC=ON
783 -DENABLE_LIBNUMA=$(usex numa ON OFF)
784 + -DCPU_POWER8=$(usex power8 ON OFF)
785 + -DENABLE_ALTIVEC=$(usex power8 ON OFF)
786 -DLIB_INSTALL_DIR="$(get_libdir)"
787 )
788
789 - local supports_asm=yes
790 -
791 if [[ ${ABI} = x86 ]] ; then
792 - if use asm ; then
793 - # Bug #528202
794 - ewarn "x86 asm is not PIC-safe, disabling it."
795 - supports_asm=no
796 + # Bug #528202
797 + if use pic ; then
798 + ewarn "PIC has been requested but x86 asm is not PIC-safe, disabling it."
799 + myabicmakeargs+=( -DENABLE_ASSEMBLY=OFF )
800 fi
801 elif [[ ${ABI} = x32 ]] ; then
802 - if use asm ; then
803 - # bug #510890
804 - ewarn "x32 ABI doesn't support asm"
805 - supports_asm=no
806 - fi
807 - elif [[ ${ABI} = arm ]] ; then
808 - if use asm && use cpu_flags_arm_neon ; then
809 - supports_asm=yes
810 - elif use asm ; then
811 - ewarn "arm asm is not PIC-safe, disabling it."
812 - supports_asm=no
813 - fi
814 - elif [[ ${ABI} = ppc* ]] ; then
815 - if use asm ; then
816 - ewarn "ppc64 uses altivec instead of asm, disabling it."
817 - supports_asm=no
818 - fi
819 - fi
820 -
821 - if [[ "${supports_asm}" = yes ]] && use asm ; then
822 - myabicmakeargs+=( -DENABLE_ASSEMBLY=ON )
823 -
824 - if multilib_is_native_abi ; then
825 - myabicmakeargs+=( -DENABLE_TESTS=$(usex test ON OFF) )
826 - fi
827 - else
828 + # bug #510890
829 myabicmakeargs+=( -DENABLE_ASSEMBLY=OFF )
830 + elif [[ ${ABI} = arm ]] ; then
831 + myabicmakeargs+=( -DENABLE_ASSEMBLY=$(usex pic OFF $(usex cpu_flags_arm_neon ON OFF)) )
832 + use cpu_flags_arm_neon && use pic && ewarn "PIC has been requested but arm neon asm is not PIC-safe, disabling it."
833 fi
834
835 local MULTIBUILD_VARIANTS=( $(x265_get_variants) )
836 @@ -190,7 +173,7 @@ multilib_src_compile() {
837 }
838
839 x265_variant_src_test() {
840 - if [[ -x "${BUILD_DIR}/test/TestBench" ]] ; then
841 + if [ -x "${BUILD_DIR}/test/TestBench" ] ; then
842 "${BUILD_DIR}/test/TestBench" || die
843 else
844 einfo "Unit tests check only assembly."