media-libs/x265: add 3.5-r5, ebuild cleanup

Clean up cruft and duplicate code.

Split up patches so we can re-use them.

Silently disable tests on x86, x32 and arm32. They never worked, have no deps
and were failing before because the options was not visible.

Closes: https://bugs.gentoo.org/728748
Closes: https://bugs.gentoo.org/937416
Closes: https://bugs.gentoo.org/937750
Closes: https://bugs.gentoo.org/937753
Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Paul Zander
2024-08-25 16:43:06 +01:00
committed by Sam James
parent 45f88589b3
commit 86fff0790d
10 changed files with 456 additions and 220 deletions
+20 -35
View File
@@ -1,7 +1,5 @@
Namespace functions for multi-bitdepth builds so that libraries are self-contained.
Index: source/common/param.h
===================================================================
--- source.orig/common/param.h
+++ source/common/param.h
@@ -53,6 +53,18 @@ int x265_param_default_preset(x265_param
@@ -23,8 +21,6 @@ Index: source/common/param.h
#define PARAM_NS X265_NS
#endif
}
Index: source/encoder/api.cpp
===================================================================
--- source.orig/encoder/api.cpp
+++ source/encoder/api.cpp
@@ -106,9 +106,9 @@ x265_encoder *x265_encoder_open(x265_par
@@ -58,15 +54,6 @@ Index: source/encoder/api.cpp
}
x265_copy_params(&save, encoder->m_latestParam);
int ret = encoder->reconfigureParam(encoder->m_latestParam, param_in);
@@ -604,7 +604,7 @@ fail:
*pi_nal = 0;
if (numEncoded && encoder->m_param->csvLogLevel && encoder->m_outputCount >= encoder->m_latestParam->chunkStart)
- x265_csvlog_frame(encoder->m_param, pic_out);
+ PARAM_NS::x265_csvlog_frame(encoder->m_param, pic_out);
if (numEncoded < 0)
encoder->m_aborted = true;
@@ -637,7 +637,7 @@ void x265_vmaf_encoder_log(x265_encoder*
encoder->fetchStats(&stats, sizeof(stats));
int padx = encoder->m_sps.conformanceWindow.rightOffset;
@@ -76,15 +63,6 @@ Index: source/encoder/api.cpp
}
}
#endif
@@ -651,7 +651,7 @@ void x265_encoder_log(x265_encoder* enc,
encoder->fetchStats(&stats, sizeof(stats));
int padx = encoder->m_sps.conformanceWindow.rightOffset;
int pady = encoder->m_sps.conformanceWindow.bottomOffset;
- x265_csvlog_encode(encoder->m_param, &stats, padx, pady, argc, argv);
+ PARAM_NS::x265_csvlog_encode(encoder->m_param, &stats, padx, pady, argc, argv);
}
}
@@ -872,7 +872,7 @@ void x265_alloc_analysis_data(x265_param
return;
@@ -94,8 +72,6 @@ Index: source/encoder/api.cpp
}
void x265_free_analysis_data(x265_param *param, x265_analysis_data* analysis)
Index: source/encoder/encoder.cpp
===================================================================
--- source.orig/encoder/encoder.cpp
+++ source/encoder/encoder.cpp
@@ -186,8 +186,8 @@ void Encoder::create()
@@ -127,15 +103,6 @@ Index: source/encoder/encoder.cpp
X265_FREE(m_dupBuffer[i]);
}
@@ -1592,7 +1592,7 @@ int Encoder::encode(const x265_picture*
if (m_exportedPic)
{
if (!m_param->bUseAnalysisFile && m_param->analysisSave)
- x265_free_analysis_data(m_param, &m_exportedPic->m_analysisData);
+ PARAM_NS::x265_free_analysis_data(m_param, &m_exportedPic->m_analysisData);
ATOMIC_DEC(&m_exportedPic->m_countRefEncoders);
m_exportedPic = NULL;
m_dpb->recycleUnreferenced();
@@ -1968,7 +1968,7 @@ int Encoder::encode(const x265_picture*
/* Free up inputPic->analysisData since it has already been used */
@@ -280,8 +247,6 @@ Index: source/encoder/encoder.cpp
m_aborted = true; \
return; \
}\
Index: source/common/param.cpp
===================================================================
--- source.orig/common/param.cpp
+++ source/common/param.cpp
@@ -102,7 +102,7 @@ x265_param *x265_param_alloc()
@@ -293,3 +258,23 @@ Index: source/common/param.cpp
#ifdef SVT_HEVC
x265_free(p->svtHevcParam);
#endif
--- source.orig/encoder/api.cpp
+++ source/encoder/api.cpp
@@ -604,7 +604,7 @@ fail:
*pi_nal = 0;
if (numEncoded && encoder->m_param->csvLogLevel && encoder->m_outputCount >= encoder->m_latestParam->chunkStart)
- x265_csvlog_frame(encoder->m_param, pic_out);
+ PARAM_NS::x265_csvlog_frame(encoder->m_param, pic_out);
if (numEncoded < 0)
encoder->m_aborted = true;
@@ -651,7 +651,7 @@ void x265_encoder_log(x265_encoder* enc,
encoder->fetchStats(&stats, sizeof(stats));
int padx = encoder->m_sps.conformanceWindow.rightOffset;
int pady = encoder->m_sps.conformanceWindow.bottomOffset;
- x265_csvlog_encode(encoder->m_param, &stats, padx, pady, argc, argv);
+ PARAM_NS::x265_csvlog_encode(encoder->m_param, &stats, padx, pady, argc, argv);
}
}
@@ -0,0 +1,23 @@
From: Paul Zander <negril.nx+gentoo@gmail.com>
Date: Fri, 23 Aug 2024 14:31:40 +0200
Subject: [PATCH] don't force old c++ standards
Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -221,14 +221,6 @@ if(GCC)
if(NOT INTEL_CXX AND NOT CLANG AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
add_definitions(-Wno-class-memaccess)
endif()
- if(ENABLE_HDR10_PLUS)
- if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8")
- message(FATAL_ERROR "gcc version above 4.8 required to support hdr10plus")
- endif()
- add_definitions(-std=gnu++11)
- else()
- add_definitions(-std=gnu++98)
- endif()
if(ENABLE_PIC)
add_definitions(-fPIC)
endif(ENABLE_PIC)
@@ -0,0 +1,29 @@
From: Ted Rodgers <ted.d.rodgers@gmail.com>
Date: Fri, 23 Aug 2024 12:15:56 +0200
Subject: [PATCH] Explicitly include <cstdint>
GCC 15 will no longer include <cstdint> by default, resulting in build
failures in projects that do not explicitly include it.
Error:
/var/tmp/portage/media-libs/x265-3.5-r4/work/x265_3.5/source/dynamicHDR10/json11/json11.cpp:101:32: error: ‘uint8_t’ does not name a type
101 | } else if (static_cast<uint8_t>(ch) <= 0x1f) {
| ^~~~~~~
/var/tmp/portage/media-libs/x265-3.5-r4/work/x265_3.5/source/dynamicHDR10/json11/json11.cpp:28:1: note: ‘uint8_t’ is defined in header ‘<cstdint>’; this is probably fixable by adding ‘#include <cstdint>’
27 | #include <limits>
+++ |+#include <cstdint>
28 |
See-also: https://gcc.gnu.org/pipermail/gcc-cvs/2024-August/407124.html
Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
--- a/dynamicHDR10/json11/json11.cpp
+++ b/dynamicHDR10/json11/json11.cpp
@@ -25,6 +25,7 @@
#include <cstdlib>
#include <cstdio>
#include <limits>
+#include <cstdint>
#if _MSC_VER
#pragma warning(disable: 4510) //const member cannot be default initialized
@@ -0,0 +1,11 @@
--- source.orig/encoder/encoder.cpp
+++ source/encoder/encoder.cpp
@@ -1592,7 +1592,7 @@ int Encoder::encode(const x265_picture*
if (m_exportedPic)
{
if (!m_param->bUseAnalysisFile && m_param->analysisSave)
- x265_free_analysis_data(m_param, &m_exportedPic->m_analysisData);
+ PARAM_NS::x265_free_analysis_data(m_param, &m_exportedPic->m_analysisData);
ATOMIC_DEC(&m_exportedPic->m_countRefEncoders);
m_exportedPic = NULL;
m_dpb->recycleUnreferenced();
+88 -69
View File
@@ -31,6 +31,25 @@ Namespace functions for multi-bitdepth builds so that libraries are self-contain
#define PARAM_NS X265_NS
#endif
}
--- a/common/threadpool.cpp
+++ b/common/threadpool.cpp
@@ -25,6 +25,7 @@
#include "common.h"
#include "threadpool.h"
#include "threading.h"
+#include "param.h"
#include <new>
@@ -314,7 +315,7 @@ ThreadPool* ThreadPool::allocThreadPools(x265_param* p, int& numPools, bool isTh
sprintf(nextCount, "%d", cpusPerNode[i]);
strcat(poolString, nextCount);
}
- x265_param_parse(p, "pools", poolString);
+ PARAM_NS::x265_param_parse(p, "pools", poolString);
}
#endif
if (p->numaPools && *p->numaPools)
--- a/encoder/api.cpp
+++ b/encoder/api.cpp
@@ -106,9 +106,9 @@ x265_encoder *x265_encoder_open(x265_param *p)
@@ -64,16 +83,16 @@ Namespace functions for multi-bitdepth builds so that libraries are self-contain
}
x265_copy_params(&save, encoder->m_latestParam);
int ret = encoder->reconfigureParam(encoder->m_latestParam, param_in);
@@ -602,7 +602,7 @@ fail:
*pi_nal = 0;
@@ -604,7 +604,7 @@ fail:
if (numEncoded && encoder->m_param->csvLogLevel && encoder->m_outputCount >= encoder->m_latestParam->chunkStart)
- x265_csvlog_frame(encoder->m_param, pic_out);
+ PARAM_NS::x265_csvlog_frame(encoder->m_param, pic_out);
{
for (int layer = 0; layer < encoder->m_param->numLayers; layer++)
- x265_csvlog_frame(encoder->m_param, pic_out[layer]);
+ PARAM_NS::x265_csvlog_frame(encoder->m_param, pic_out[layer]);
}
if (numEncoded < 0)
encoder->m_aborted = true;
@@ -643,7 +643,7 @@ void x265_vmaf_encoder_log(x265_encoder* enc, int argc, char **argv, x265_param
@@ -646,7 +646,7 @@ void x265_vmaf_encoder_log(x265_encoder* enc, int argc, char **argv, x265_param
encoder->fetchStats(&stats, sizeof(stats));
int padx = encoder->m_sps.conformanceWindow.rightOffset;
int pady = encoder->m_sps.conformanceWindow.bottomOffset;
@@ -82,16 +101,16 @@ Namespace functions for multi-bitdepth builds so that libraries are self-contain
}
}
#endif
@@ -657,7 +657,7 @@ void x265_encoder_log(x265_encoder* enc, int argc, char **argv)
encoder->fetchStats(&stats, sizeof(stats));
int padx = encoder->m_sps.conformanceWindow.rightOffset;
int pady = encoder->m_sps.conformanceWindow.bottomOffset;
- x265_csvlog_encode(encoder->m_param, &stats, padx, pady, argc, argv);
+ PARAM_NS::x265_csvlog_encode(encoder->m_param, &stats, padx, pady, argc, argv);
@@ -662,7 +662,7 @@ void x265_encoder_log(x265_encoder* enc, int argc, char **argv)
for (int layer = 0; layer < encoder->m_param->numLayers; layer++)
{
encoder->fetchStats(stats, sizeof(stats[layer]), layer);
- x265_csvlog_encode(encoder->m_param, &stats[0], padx, pady, argc, argv);
+ PARAM_NS::x265_csvlog_encode(encoder->m_param, &stats[0], padx, pady, argc, argv);
}
}
}
@@ -878,7 +878,7 @@ void x265_alloc_analysis_data(x265_param *param, x265_analysis_data* analysis)
@@ -884,7 +884,7 @@ void x265_alloc_analysis_data(x265_param *param, x265_analysis_data* analysis)
return;
fail:
@@ -102,7 +121,7 @@ Namespace functions for multi-bitdepth builds so that libraries are self-contain
void x265_free_analysis_data(x265_param *param, x265_analysis_data* analysis)
--- a/encoder/encoder.cpp
+++ b/encoder/encoder.cpp
@@ -216,8 +216,8 @@ void Encoder::create()
@@ -217,8 +217,8 @@ void Encoder::create()
{
m_dupBuffer[i] = (AdaptiveFrameDuplication*)x265_malloc(sizeof(AdaptiveFrameDuplication));
m_dupBuffer[i]->dupPic = NULL;
@@ -113,7 +132,7 @@ Namespace functions for multi-bitdepth builds so that libraries are self-contain
m_dupBuffer[i]->dupPlane = NULL;
m_dupBuffer[i]->dupPlane = X265_MALLOC(char, framesize);
m_dupBuffer[i]->dupPic->planes[0] = m_dupBuffer[i]->dupPlane;
@@ -768,7 +768,7 @@ int Encoder::setAnalysisData(x265_analysis_data *analysis_data, int poc, uint32_
@@ -774,7 +774,7 @@ int Encoder::setAnalysisData(x265_analysis_data *analysis_data, int poc, uint32_
curFrame->m_analysisData = (*analysis_data);
curFrame->m_analysisData.numCUsInFrame = widthInCU * heightInCU;
curFrame->m_analysisData.numPartitions = m_param->num4x4Partitions;
@@ -122,7 +141,7 @@ Namespace functions for multi-bitdepth builds so that libraries are self-contain
if (m_param->maxCUSize == 16)
{
if (analysis_data->sliceType == X265_TYPE_IDR || analysis_data->sliceType == X265_TYPE_I)
@@ -872,7 +872,7 @@ void Encoder::destroy()
@@ -881,7 +881,7 @@ void Encoder::destroy()
for (uint32_t i = 0; i < DUP_BUFFER; i++)
{
X265_FREE(m_dupBuffer[i]->dupPlane);
@@ -131,61 +150,61 @@ Namespace functions for multi-bitdepth builds so that libraries are self-contain
X265_FREE(m_dupBuffer[i]);
}
@@ -1478,7 +1478,7 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture* pic_out)
if (m_exportedPic)
@@ -1491,7 +1491,7 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture** pic_out)
if (*m_exportedPic)
{
if (!m_param->bUseAnalysisFile && m_param->analysisSave)
- x265_free_analysis_data(m_param, &m_exportedPic->m_analysisData);
+ PARAM_NS::x265_free_analysis_data(m_param, &m_exportedPic->m_analysisData);
- x265_free_analysis_data(m_param, &m_exportedPic[0]->m_analysisData);
+ PARAM_NS::x265_free_analysis_data(m_param, &m_exportedPic[0]->m_analysisData);
ATOMIC_DEC(&m_exportedPic->m_countRefEncoders);
for (int i = 0; i < m_param->numLayers; i++)
{
@@ -1973,7 +1973,7 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture** pic_out)
@@ -1892,7 +1892,7 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture* pic_out)
/* Free up inputPic->analysisData since it has already been used */
if ((m_param->analysisLoad && !m_param->analysisSave) || ((m_param->bAnalysisType == AVC_INFO) && slice->m_sliceType != I_SLICE))
- x265_free_analysis_data(m_param, &outFrame->m_analysisData);
+ PARAM_NS::x265_free_analysis_data(m_param, &outFrame->m_analysisData);
if (pic_out)
{
@@ -1971,7 +1971,7 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture* pic_out)
writeAnalysisFile(&pic_out->analysisData, *outFrame->m_encData);
pic_out->analysisData.saveParam = pic_out->analysisData.saveParam;
if (m_param->bUseAnalysisFile)
- x265_free_analysis_data(m_param, &pic_out->analysisData);
+ PARAM_NS::x265_free_analysis_data(m_param, &pic_out->analysisData);
/* Free up inputPic->analysisData since it has already been used */
if ((m_param->analysisLoad && !m_param->analysisSave) || ((m_param->bAnalysisType == AVC_INFO) && slice->m_sliceType != I_SLICE))
- x265_free_analysis_data(m_param, &outFrame->m_analysisData);
+ PARAM_NS::x265_free_analysis_data(m_param, &outFrame->m_analysisData);
if (pic_out[sLayer])
{
PicYuv* recpic = outFrame->m_reconPic[0];
@@ -2052,7 +2052,7 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture** pic_out)
writeAnalysisFile(&pic_out[sLayer]->analysisData, *outFrame->m_encData);
pic_out[sLayer]->analysisData.saveParam = pic_out[sLayer]->analysisData.saveParam;
if (m_param->bUseAnalysisFile)
- x265_free_analysis_data(m_param, &pic_out[sLayer]->analysisData);
+ PARAM_NS::x265_free_analysis_data(m_param, &pic_out[sLayer]->analysisData);
}
}
}
if (m_param->rc.bStatWrite && (m_param->analysisMultiPassRefine || m_param->analysisMultiPassDistortion))
@@ -1986,7 +1986,7 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture* pic_out)
writeAnalysisFileRefine(&outFrame->m_analysisData, *outFrame->m_encData);
}
if (m_param->analysisMultiPassRefine || m_param->analysisMultiPassDistortion)
- x265_free_analysis_data(m_param, &outFrame->m_analysisData);
+ PARAM_NS::x265_free_analysis_data(m_param, &outFrame->m_analysisData);
if (m_param->internalCsp == X265_CSP_I400)
{
if (slice->m_sliceType == P_SLICE)
@@ -2153,7 +2153,7 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture* pic_out)
if (m_param->rc.bStatWrite && (m_param->analysisMultiPassRefine || m_param->analysisMultiPassDistortion))
@@ -2067,7 +2067,7 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture** pic_out)
writeAnalysisFileRefine(&outFrame->m_analysisData, *outFrame->m_encData);
}
if (m_param->analysisMultiPassRefine || m_param->analysisMultiPassDistortion)
- x265_free_analysis_data(m_param, &outFrame->m_analysisData);
+ PARAM_NS::x265_free_analysis_data(m_param, &outFrame->m_analysisData);
if (m_param->internalCsp == X265_CSP_I400)
{
if (slice->m_sliceType == P_SLICE)
@@ -2250,7 +2250,7 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture** pic_out)
uint32_t heightInCU = (m_param->sourceHeight + m_param->maxCUSize - 1) >> m_param->maxLog2CUSize;
frameEnc->m_analysisData.numCUsInFrame = widthInCU * heightInCU;
frameEnc->m_analysisData.numPartitions = m_param->num4x4Partitions;
- x265_alloc_analysis_data(m_param, &frameEnc->m_analysisData);
+ PARAM_NS::x265_alloc_analysis_data(m_param, &frameEnc->m_analysisData);
frameEnc->m_analysisData.poc = frameEnc->m_poc;
frameEnc[0]->m_analysisData.numCUsInFrame = widthInCU * heightInCU;
frameEnc[0]->m_analysisData.numPartitions = m_param->num4x4Partitions;
- x265_alloc_analysis_data(m_param, &frameEnc[0]->m_analysisData);
+ PARAM_NS::x265_alloc_analysis_data(m_param, &frameEnc[0]->m_analysisData);
frameEnc[0]->m_analysisData.poc = frameEnc[0]->m_poc;
if (m_param->rc.bStatRead)
readAnalysisFile(&frameEnc->m_analysisData, frameEnc->m_poc, frameEnc->m_lowres.sliceType);
@@ -2164,7 +2164,7 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture* pic_out)
readAnalysisFile(&frameEnc[0]->m_analysisData, frameEnc[0]->m_poc, frameEnc[0]->m_lowres.sliceType);
@@ -2261,7 +2261,7 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture** pic_out)
for (int i = 0; i < m_param->rc.zonefileCount; i++)
{
if (m_param->rc.zones[i].startFrame == frameEnc->m_poc)
if (m_param->rc.zones[i].startFrame == frameEnc[0]->m_poc)
- x265_encoder_reconfig(this, m_param->rc.zones[i].zoneParam);
+ PARAM_NS::x265_encoder_reconfig(this, m_param->rc.zones[i].zoneParam);
}
}
@@ -2307,7 +2307,7 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture* pic_out)
@@ -2408,7 +2408,7 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture** pic_out)
analysis->numCUsInFrame = numCUsInFrame;
analysis->numCuInHeight = heightInCU;
analysis->numPartitions = m_param->num4x4Partitions;
@@ -194,7 +213,7 @@ Namespace functions for multi-bitdepth builds so that libraries are self-contain
}
if (m_param->bEnableTemporalSubLayers > 2)
{
@@ -4434,7 +4434,7 @@ void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, const x
@@ -4711,7 +4711,7 @@ void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, const x
else if (fread(val, size, readSize, fileOffset) != readSize)\
{\
x265_log(NULL, X265_LOG_ERROR, "Error reading analysis data\n");\
@@ -203,7 +222,7 @@ Namespace functions for multi-bitdepth builds so that libraries are self-contain
m_aborted = true;\
return;\
}\
@@ -4470,7 +4470,7 @@ void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, const x
@@ -4747,7 +4747,7 @@ void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, const x
if (poc != curPoc || feof(m_analysisFileIn))
{
x265_log(NULL, X265_LOG_WARNING, "Error reading analysis data: Cannot find POC %d\n", curPoc);
@@ -212,7 +231,7 @@ Namespace functions for multi-bitdepth builds so that libraries are self-contain
return;
}
}
@@ -4504,7 +4504,7 @@ void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, const x
@@ -4781,7 +4781,7 @@ void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, const x
if (m_param->scaleFactor)
analysis->numPartitions *= factor;
/* Memory is allocated for inter and intra analysis data based on the slicetype */
@@ -221,7 +240,7 @@ Namespace functions for multi-bitdepth builds so that libraries are self-contain
if (m_param->ctuDistortionRefine == CTU_DISTORTION_INTERNAL)
{
@@ -4757,7 +4757,7 @@ void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, const x
@@ -5034,7 +5034,7 @@ void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, const x
else if (fread(val, size, readSize, fileOffset) != readSize)\
{\
x265_log(NULL, X265_LOG_ERROR, "Error reading analysis data\n");\
@@ -230,7 +249,7 @@ Namespace functions for multi-bitdepth builds so that libraries are self-contain
m_aborted = true;\
return;\
}\
@@ -4794,7 +4794,7 @@ void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, const x
@@ -5071,7 +5071,7 @@ void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, const x
if (poc != curPoc || feof(m_analysisFileIn))
{
x265_log(NULL, X265_LOG_WARNING, "Error reading analysis data: Cannot find POC %d\n", curPoc);
@@ -239,7 +258,7 @@ Namespace functions for multi-bitdepth builds so that libraries are self-contain
return;
}
}
@@ -4825,7 +4825,7 @@ void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, const x
@@ -5102,7 +5102,7 @@ void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, const x
analysis->numCuInHeight = cuLoc.heightInCU;
/* Memory is allocated for inter and intra analysis data based on the slicetype */
@@ -248,7 +267,7 @@ Namespace functions for multi-bitdepth builds so that libraries are self-contain
if (m_param->ctuDistortionRefine == CTU_DISTORTION_INTERNAL)
{
@@ -5440,7 +5440,7 @@ void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, int sli
@@ -5717,7 +5717,7 @@ void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, int sli
if (fread(val, size, readSize, fileOffset) != readSize)\
{\
x265_log(NULL, X265_LOG_ERROR, "Error reading analysis 2 pass data\n"); \
@@ -257,7 +276,7 @@ Namespace functions for multi-bitdepth builds so that libraries are self-contain
m_aborted = true; \
return; \
}\
@@ -5454,7 +5454,7 @@ void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, int sli
@@ -5731,7 +5731,7 @@ void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, int sli
if (poc != curPoc || feof(m_analysisFileIn))
{
x265_log(NULL, X265_LOG_WARNING, "Error reading analysis 2 pass data: Cannot find POC %d\n", curPoc);
@@ -266,7 +285,7 @@ Namespace functions for multi-bitdepth builds so that libraries are self-contain
return;
}
/* Now arrived at the right frame, read the record */
@@ -5561,7 +5561,7 @@ void Encoder::writeAnalysisFile(x265_analysis_data* analysis, FrameData &curEncD
@@ -5838,7 +5838,7 @@ void Encoder::writeAnalysisFile(x265_analysis_data* analysis, FrameData &curEncD
if (fwrite(val, size, writeSize, fileOffset) < writeSize)\
{\
x265_log(NULL, X265_LOG_ERROR, "Error writing analysis data\n");\
@@ -275,7 +294,7 @@ Namespace functions for multi-bitdepth builds so that libraries are self-contain
m_aborted = true;\
return;\
}\
@@ -5783,7 +5783,7 @@ void Encoder::writeAnalysisFileRefine(x265_analysis_data* analysis, FrameData &c
@@ -6060,7 +6060,7 @@ void Encoder::writeAnalysisFileRefine(x265_analysis_data* analysis, FrameData &c
if (fwrite(val, size, writeSize, fileOffset) < writeSize)\
{\
x265_log(NULL, X265_LOG_ERROR, "Error writing analysis 2 pass data\n"); \
-1
View File
@@ -8,7 +8,6 @@
<flag name="10bit">Add support for producing 10bits HEVC.</flag>
<flag name="12bit">Add support for producing 12bits HEVC.</flag>
<flag name="numa">Build with support for NUMA nodes.</flag>
<flag name="pic">Disable optimized assembly code that is not PIC friendly</flag>
</use>
<upstream>
<remote-id type="bitbucket">multicoreware/x265_git</remote-id>
+1
View File
@@ -36,6 +36,7 @@ PATCHES=(
"${FILESDIR}/x265-3.3-ppc64.patch"
"${FILESDIR}/tests.patch"
"${FILESDIR}/test-ns.patch"
"${FILESDIR}/${PN}-3.5-r5-test-ns_2.patch"
)
src_unpack() {
+1
View File
@@ -36,6 +36,7 @@ PATCHES=(
"${FILESDIR}/x265-3.3-ppc64.patch"
"${FILESDIR}/tests.patch"
"${FILESDIR}/test-ns.patch"
"${FILESDIR}/${PN}-3.5-r5-test-ns_2.patch"
)
src_unpack() {
+195
View File
@@ -0,0 +1,195 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake flag-o-matic multilib-minimal multibuild
DESCRIPTION="Library for encoding video streams into the H.265/HEVC format"
HOMEPAGE="http://x265.org/ https://bitbucket.org/multicoreware/x265_git/"
if [[ ${PV} = 9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://bitbucket.org/multicoreware/x265_git/"
MY_P="${PN}-${PV}"
else
SRC_URI="https://bitbucket.org/multicoreware/x265_git/downloads/${PN}_${PV}.tar.gz"
KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~x86"
MY_P="${PN}_${PV}"
fi
S="${WORKDIR}/${MY_P}/source"
unset MY_P
LICENSE="GPL-2"
# subslot = libx265 soname
SLOT="0/199"
IUSE="+10bit +12bit cpu_flags_ppc_vsx2 numa test"
RESTRICT="!test? ( test )"
RDEPEND="numa? ( >=sys-process/numactl-2.0.10-r1[${MULTILIB_USEDEP}] )"
DEPEND="${RDEPEND}"
ASM_DEPEND=">=dev-lang/nasm-2.13"
BDEPEND="
abi_x86_32? ( ${ASM_DEPEND} )
abi_x86_64? ( ${ASM_DEPEND} )"
PATCHES=(
"${FILESDIR}/arm-r1.patch"
"${FILESDIR}/neon.patch"
"${FILESDIR}/tests.patch"
"${FILESDIR}/test-ns.patch"
"${FILESDIR}/${PN}-3.5-r5-cpp-std.patch"
"${FILESDIR}/${PN}-3.5-r5-gcc15.patch"
"${FILESDIR}/${PN}-3.5-r5-test-ns_2.patch"
)
pkg_setup() {
variants=(
$(usev 12bit "main12")
$(usev 10bit "main10")
)
}
# By default, the library and the encoder is configured for only one output bit
# depth. Meaning, one has to rebuild libx265 if (s)he wants to produce HEVC
# files with a different bit depth, which is annoying. However, upstream
# supports proper namespacing for 8bits, 10bits & 12bits HEVC and linking all
# that together so that the resulting library can produce all three of them
# instead of only one.
# The API requires the bit depth parameter, so that libx265 can then chose which
# variant of the encoder to use.
# To achieve this, we have to build one (static) library for each non-main
# variant, and link it into the main library.
# Upstream documents using the 8bit variant as main library, hence we do not
# allow disabling it
x265_variant_src_configure() {
einfo "Configuring variant: ${MULTIBUILD_VARIANT} for ABI: ${ABI}"
local mycmakeargs=(
"${mycmakeargs[@]}"
-DHIGH_BIT_DEPTH=ON
-DEXPORT_C_API=OFF
-DENABLE_SHARED=OFF
-DENABLE_CLI=OFF
)
case "${MULTIBUILD_VARIANT}" in
"main12")
mycmakeargs+=(
-DMAIN12=ON
)
;;
"main10")
mycmakeargs+=(
-DENABLE_HDR10_PLUS=ON
)
;;
*)
die "Unknown variant: ${MULTIBUILD_VARIANT}";;
esac
cmake_src_configure
}
multilib_src_configure() {
# -Werror=odr
# https://bugs.gentoo.org/875854
# https://bitbucket.org/multicoreware/x265_git/issues/937/build-fails-with-lto
filter-lto
local mycmakeargs=(
$(multilib_is_native_abi || echo "-DENABLE_CLI=OFF")
-DENABLE_PIC=ON
-DENABLE_LIBNUMA="$(usex numa)"
-DENABLE_MULTIVIEW="yes"
-DENABLE_SVT_HEVC="no" # missing
-DENABLE_VTUNE="no" # missing
-DGIT_ARCHETYPE=1 #814116
-DLIB_INSTALL_DIR="$(get_libdir)"
)
# Unfortunately, the asm for x86/x32/arm isn't PIC-safe.
# x86 # Bug #528202, bug #913412
# x32 # bug #510890
if [[ ${ABI} = x86 ]] || [[ ${ABI} = x32 ]] || [[ ${ABI} = arm ]] ; then
mycmakeargs+=(
-DENABLE_ASSEMBLY=OFF
-DENABLE_TESTS="no" #728748
)
else
mycmakeargs+=(
-DENABLE_TESTS="$(usex test)"
)
fi
if [[ ${ABI} = ppc* ]] ; then
# upstream uses mix of altivec + power8 vectors
# it's impossible to enable altivec without CPU_POWER8
# and it does not work on ppc32
# so we toggle both variables together
mycmakeargs+=(
-DCPU_POWER8="$(usex cpu_flags_ppc_vsx2)"
-DENABLE_ALTIVEC="$(usex cpu_flags_ppc_vsx2)"
)
fi
local MULTIBUILD_VARIANTS=( "${variants[@]}" )
if [[ "${#MULTIBUILD_VARIANTS[@]}" -gt 1 ]] ; then
multibuild_foreach_variant x265_variant_src_configure
local liblist="" v=
for v in "${MULTIBUILD_VARIANTS[@]}" ; do
ln -sf "${BUILD_DIR}-${v}/libx265.a" "${BUILD_DIR%-*}/libx265_${v}.a" || die
liblist+="libx265_${v}.a;"
done
mycmakeargs+=(
-DEXTRA_LIB="${liblist}"
-DEXTRA_LINK_FLAGS="-L${BUILD_DIR%-*}"
-DLINKED_10BIT"=$(usex 10bit)"
-DLINKED_12BIT="$(usex 12bit)"
)
fi
cmake_src_configure
}
multilib_src_compile() {
local MULTIBUILD_VARIANTS=( "${variants[@]}" )
if [[ "${#MULTIBUILD_VARIANTS[@]}" -gt 1 ]] ; then
multibuild_foreach_variant cmake_src_compile
fi
cmake_src_compile
}
x265_variant_src_test() {
if [[ -x "${BUILD_DIR}/test/TestBench" ]] ; then
"${BUILD_DIR}/test/TestBench" || die
else
einfo "Unit tests check only assembly."
einfo "You do not seem to have any for ABI=${ABI}, x265 variant=${MULTIBUILD_VARIANT}"
einfo "Skipping tests."
fi
}
multilib_src_test() {
local MULTIBUILD_VARIANTS=( "${variants[@]}" )
if [[ "${#MULTIBUILD_VARIANTS[@]}" -gt 1 ]] ; then
multibuild_foreach_variant x265_variant_src_test
fi
x265_variant_src_test
}
multilib_src_install() {
cmake_src_install
}
multilib_src_install_all() {
dodoc -r "${S}/../doc/"*
# we don't install *.a files for all variants,
# so just delete these files instead of pretending
# real USE=static-libs support
find "${ED}" -name "*.a" -delete || die
}
+88 -115
View File
@@ -5,21 +5,25 @@ EAPI=8
inherit cmake flag-o-matic multilib-minimal multibuild
if [[ ${PV} = 9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://bitbucket.org/multicoreware/x265_git/"
S=${WORKDIR}/${P}/source
else
SRC_URI="https://bitbucket.org/multicoreware/x265_git/downloads/${PN}_${PV}.tar.gz"
KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~x86"
fi
DESCRIPTION="Library for encoding video streams into the H.265/HEVC format"
HOMEPAGE="http://x265.org/ https://bitbucket.org/multicoreware/x265_git/"
if [[ ${PV} = 9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://bitbucket.org/multicoreware/x265_git/"
MY_P="${PN}-${PV}"
else
SRC_URI="https://bitbucket.org/multicoreware/x265_git/downloads/${PN}_${PV}.tar.gz -> ${PN}-${PV}.tar.gz"
KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~x86"
MY_P="${PN}_${PV}"
fi
S="${WORKDIR}/${MY_P}/source"
unset MY_P
LICENSE="GPL-2"
# subslot = libx265 soname
SLOT="0/208"
SLOT="0/212"
IUSE="+10bit +12bit cpu_flags_ppc_vsx2 numa test"
RESTRICT="!test? ( test )"
@@ -34,16 +38,16 @@ PATCHES=(
"${FILESDIR}/${PN}-9999-arm.patch"
"${FILESDIR}/neon.patch"
"${FILESDIR}/tests.patch"
"${FILESDIR}/${PN}-3.5-r5-cpp-std.patch"
"${FILESDIR}/${PN}-3.5-r5-gcc15.patch"
"${FILESDIR}/${PN}-9999-test-ns.patch"
)
src_unpack() {
if [[ ${PV} = 9999* ]]; then
git-r3_src_unpack
else
unpack ${A}
export S="$(echo "${WORKDIR}/${PN}_"*"/source")"
fi
pkg_setup() {
variants=(
$(usev 12bit "main12")
$(usev 10bit "main10")
)
}
# By default, the library and the encoder is configured for only one output bit
@@ -57,102 +61,34 @@ src_unpack() {
# To achieve this, we have to build one (static) library for each non-main
# variant, and link it into the main library.
# Upstream documents using the 8bit variant as main library, hence we do not
# allow disabling it: "main" *MUST* come last in the following list.
x265_get_variants() {
local variants=""
use 12bit && variants+="main12 "
use 10bit && variants+="main10 "
variants+="main"
echo "${variants}"
}
# allow disabling it
x265_variant_src_configure() {
mkdir -p "${BUILD_DIR}" || die
pushd "${BUILD_DIR}" >/dev/null || die
einfo "Configuring variant: ${MULTIBUILD_VARIANT} for ABI: ${ABI}"
local mycmakeargs=( "${myabicmakeargs[@]}" )
local mycmakeargs=(
"${mycmakeargs[@]}"
-DHIGH_BIT_DEPTH=ON
-DEXPORT_C_API=OFF
-DENABLE_SHARED=OFF
-DENABLE_CLI=OFF
)
case "${MULTIBUILD_VARIANT}" in
"main12")
mycmakeargs+=(
-DHIGH_BIT_DEPTH=ON
-DEXPORT_C_API=OFF
-DENABLE_SHARED=OFF
-DENABLE_CLI=OFF
-DMAIN12=ON
)
if [[ ${ABI} = x86 ]] ; then
mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
fi
if [[ ${ABI} = arm* ]] ; then
# 589674
mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
fi
# disable altivec for 12bit build #607802#c5
if [[ ${ABI} = ppc* ]] ; then
mycmakeargs+=(
-DENABLE_ALTIVEC=OFF
-DCPU_POWER8=$(usex cpu_flags_ppc_vsx2 ON OFF)
)
fi
;;
"main10")
mycmakeargs+=(
-DHIGH_BIT_DEPTH=ON
-DEXPORT_C_API=OFF
-DENABLE_SHARED=OFF
-DENABLE_CLI=OFF
-DENABLE_HDR10_PLUS=ON
)
if [[ ${ABI} = x86 ]] ; then
mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
fi
if [[ ${ABI} = arm* ]] ; then
# 589674
mycmakeargs+=( -DENABLE_ASSEMBLY=OFF )
fi
# disable altivec for 10bit build #607802#c5
if [[ ${ABI} = ppc* ]] ; then
mycmakeargs+=(
-DENABLE_ALTIVEC=OFF
-DCPU_POWER8=$(usex cpu_flags_ppc_vsx2 ON OFF)
)
fi
;;
"main")
if (( "${#MULTIBUILD_VARIANTS[@]}" > 1 )) ; then
local myvariants=( "${MULTIBUILD_VARIANTS[@]}" )
unset myvariants[${#MULTIBUILD_VARIANTS[@]}-1]
local liblist="" v=
for v in "${myvariants[@]}" ; do
ln -s "${BUILD_DIR%-*}-${v}/libx265.a" "libx265_${v}.a" || die
liblist+="libx265_${v}.a;"
done
mycmakeargs+=(
-DEXTRA_LIB="${liblist}"
-DEXTRA_LINK_FLAGS=-L.
-DLINKED_10BIT=$(usex 10bit)
-DLINKED_12BIT=$(usex 12bit)
)
if [[ ${ABI} = ppc* ]] ; then
# upstream uses mix of altivec + power8 vectors
# it's impossible to enable altivec without CPU_POWER8
# and it does not work on ppc32
# so we toggle both variables together
mycmakeargs+=(
-DCPU_POWER8=$(usex cpu_flags_ppc_vsx2 ON OFF)
-DENABLE_ALTIVEC=$(usex cpu_flags_ppc_vsx2 ON OFF)
)
fi
fi
;;
*)
die "Unknown variant: ${MULTIBUILD_VARIANT}";;
esac
cmake_src_configure
popd >/dev/null || die
}
multilib_src_configure() {
@@ -161,37 +97,73 @@ multilib_src_configure() {
# https://bitbucket.org/multicoreware/x265_git/issues/937/build-fails-with-lto
filter-lto
local myabicmakeargs=(
-DENABLE_TESTS=$(usex test ON OFF)
local mycmakeargs=(
$(multilib_is_native_abi || echo "-DENABLE_CLI=OFF")
-DENABLE_PIC=ON
-DENABLE_LIBNUMA=$(usex numa ON OFF)
-DENABLE_LIBNUMA="$(usex numa)"
-DENABLE_MULTIVIEW="yes"
-DENABLE_SVT_HEVC="no" # missing
-DENABLE_VTUNE="no" # missing
-DGIT_ARCHETYPE=1 #814116
-DLIB_INSTALL_DIR="$(get_libdir)"
)
# Unfortunately, the asm for x86/x32/arm isn't PIC-safe.
if [[ ${ABI} = x86 ]] ; then
# Bug #528202, bug #913412
myabicmakeargs+=( -DENABLE_ASSEMBLY=OFF )
elif [[ ${ABI} = x32 ]] ; then
# bug #510890
myabicmakeargs+=( -DENABLE_ASSEMBLY=OFF )
elif [[ ${ABI} = arm ]] ; then
myabicmakeargs+=( -DENABLE_ASSEMBLY=OFF )
# x86 # Bug #528202, bug #913412
# x32 # bug #510890
if [[ ${ABI} = x86 ]] || [[ ${ABI} = x32 ]] || [[ ${ABI} = arm ]] ; then
mycmakeargs+=(
-DENABLE_ASSEMBLY=OFF
-DENABLE_TESTS="no" #728748
)
else
mycmakeargs+=(
-DENABLE_TESTS="$(usex test)"
)
fi
local MULTIBUILD_VARIANTS=( $(x265_get_variants) )
multibuild_foreach_variant x265_variant_src_configure
if [[ ${ABI} = ppc* ]] ; then
# upstream uses mix of altivec + power8 vectors
# it's impossible to enable altivec without CPU_POWER8
# and it does not work on ppc32
# so we toggle both variables together
mycmakeargs+=(
-DCPU_POWER8="$(usex cpu_flags_ppc_vsx2)"
-DENABLE_ALTIVEC="$(usex cpu_flags_ppc_vsx2)"
)
fi
local MULTIBUILD_VARIANTS=( "${variants[@]}" )
if [[ "${#MULTIBUILD_VARIANTS[@]}" -gt 1 ]] ; then
multibuild_foreach_variant x265_variant_src_configure
local liblist="" v=
for v in "${MULTIBUILD_VARIANTS[@]}" ; do
ln -sf "${BUILD_DIR}-${v}/libx265.a" "${BUILD_DIR%-*}/libx265_${v}.a" || die
liblist+="libx265_${v}.a;"
done
mycmakeargs+=(
-DEXTRA_LIB="${liblist}"
-DEXTRA_LINK_FLAGS="-L${BUILD_DIR%-*}"
-DLINKED_10BIT"=$(usex 10bit)"
-DLINKED_12BIT="$(usex 12bit)"
)
fi
cmake_src_configure
}
multilib_src_compile() {
local MULTIBUILD_VARIANTS=( $(x265_get_variants) )
multibuild_foreach_variant cmake_src_compile
local MULTIBUILD_VARIANTS=( "${variants[@]}" )
if [[ "${#MULTIBUILD_VARIANTS[@]}" -gt 1 ]] ; then
multibuild_foreach_variant cmake_src_compile
fi
cmake_src_compile
}
x265_variant_src_test() {
if [ -x "${BUILD_DIR}/test/TestBench" ] ; then
if [[ -x "${BUILD_DIR}/test/TestBench" ]] ; then
"${BUILD_DIR}/test/TestBench" || die
else
einfo "Unit tests check only assembly."
@@ -201,14 +173,15 @@ x265_variant_src_test() {
}
multilib_src_test() {
local MULTIBUILD_VARIANTS=( $(x265_get_variants) )
multibuild_foreach_variant x265_variant_src_test
local MULTIBUILD_VARIANTS=( "${variants[@]}" )
if [[ "${#MULTIBUILD_VARIANTS[@]}" -gt 1 ]] ; then
multibuild_foreach_variant x265_variant_src_test
fi
x265_variant_src_test
}
multilib_src_install() {
# Install only "main" variant since the others are already linked into it.
local MULTIBUILD_VARIANTS=( "main" )
multibuild_foreach_variant cmake_src_install
cmake_src_install
}
multilib_src_install_all() {