diff --git a/multimedia/x265/Makefile b/multimedia/x265/Makefile index 0da9c3894e5..1311842bbac 100644 --- a/multimedia/x265/Makefile +++ b/multimedia/x265/Makefile @@ -1,10 +1,11 @@ -# $OpenBSD: Makefile,v 1.46 2020/02/24 18:41:19 ajacoutot Exp $ +# $OpenBSD: Makefile,v 1.47 2020/03/27 07:34:08 ajacoutot Exp $ COMMENT= free H.265/HEVC encoder VER= 3.3 DISTNAME= x265_${VER} PKGNAME= x265-${VER} +REVISION= 0 CATEGORIES= multimedia MASTER_SITES= https://bitbucket.org/multicoreware/x265/downloads/ diff --git a/multimedia/x265/patches/patch-source_encoder_encoder_cpp b/multimedia/x265/patches/patch-source_encoder_encoder_cpp new file mode 100644 index 00000000000..aabe8e22729 --- /dev/null +++ b/multimedia/x265/patches/patch-source_encoder_encoder_cpp @@ -0,0 +1,34 @@ +$OpenBSD: patch-source_encoder_encoder_cpp,v 1.1 2020/03/27 07:34:08 ajacoutot Exp $ + +Fix: segmentation fault for hist-scenecut option. + +Index: source/encoder/encoder.cpp +--- source/encoder/encoder.cpp.orig ++++ source/encoder/encoder.cpp +@@ -218,10 +218,7 @@ void Encoder::create() + + if (m_param->bHistBasedSceneCut) + { +- for (int i = 0; i < x265_cli_csps[m_param->internalCsp].planes; i++) +- { +- m_planeSizes[i] = (m_param->sourceWidth >> x265_cli_csps[p->internalCsp].width[i]) * (m_param->sourceHeight >> x265_cli_csps[m_param->internalCsp].height[i]); +- } ++ m_planeSizes[0] = (m_param->sourceWidth >> x265_cli_csps[p->internalCsp].width[0]) * (m_param->sourceHeight >> x265_cli_csps[m_param->internalCsp].height[0]); + uint32_t pixelbytes = m_param->internalBitDepth > 8 ? 2 : 1; + m_edgePic = X265_MALLOC(pixel, m_planeSizes[0] * pixelbytes); + m_edgeHistThreshold = m_param->edgeTransitionThreshold; +@@ -1605,6 +1602,14 @@ int Encoder::encode(const x265_picture* pic_in, x265_p + if (m_param->bHistBasedSceneCut && pic_in) + { + x265_picture *pic = (x265_picture *) pic_in; ++ ++ if (pic->poc == 0) ++ { ++ /* for entire encode compute the chroma plane sizes only once */ ++ for (int i = 1; i < x265_cli_csps[m_param->internalCsp].planes; i++) ++ m_planeSizes[i] = (pic->width >> x265_cli_csps[m_param->internalCsp].width[i]) * (pic->height >> x265_cli_csps[m_param->internalCsp].height[i]); ++ } ++ + if (computeHistograms(pic)) + { + double maxUVSad = 0.0, edgeSad = 0.0;