<div dir="ltr">Hi Johannes Kauffmann,<br><br><div>Could you share the patches attached to this email?<br><br></div><div>Thanks,<br>Yaswanth</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 9, 2023 at 5:30 PM <<a href="mailto:x265-devel-request@videolan.org">x265-devel-request@videolan.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Send x265-devel mailing list submissions to<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:x265-devel-request@videolan.org" target="_blank">x265-devel-request@videolan.org</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:x265-devel-owner@videolan.org" target="_blank">x265-devel-owner@videolan.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of x265-devel digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. [PATCH 2/3] Fix Wundef for ENABLE_LIBVMAF (Johannes Kauffmann)<br>
2. [PATCH 3/3] Add defines needed by client apps to .pc file<br>
(Johannes Kauffmann)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Fri, 9 Jun 2023 00:11:42 +0200<br>
From: Johannes Kauffmann <<a href="mailto:johanneskauffmann@hotmail.com" target="_blank">johanneskauffmann@hotmail.com</a>><br>
To: <a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
Subject: [x265] [PATCH 2/3] Fix Wundef for ENABLE_LIBVMAF<br>
Message-ID:<br>
<<a href="mailto:DB6PR07MB317525092B6C7590902611CAA650A@DB6PR07MB3175.eurprd07.prod.outlook.com" target="_blank">DB6PR07MB317525092B6C7590902611CAA650A@DB6PR07MB3175.eurprd07.prod.outlook.com</a>><br>
<br>
Content-Type: text/plain<br>
<br>
---<br>
source/abrEncApp.cpp | 4 ++--<br>
source/encoder/api.cpp | 18 +++++++++---------<br>
source/encoder/encoder.cpp | 2 +-<br>
source/encoder/frameencoder.cpp | 4 ++--<br>
source/encoder/frameencoder.h | 2 +-<br>
source/x265.h | 4 ++--<br>
source/x265cli.cpp | 4 ++--<br>
7 files changed, 19 insertions(+), 19 deletions(-)<br>
<br>
diff --git a/source/abrEncApp.cpp b/source/abrEncApp.cpp<br>
index 94644a1c0..4b4c2242c 100644<br>
--- a/source/abrEncApp.cpp<br>
+++ b/source/abrEncApp.cpp<br>
@@ -514,7 +514,7 @@ ret:<br>
while (m_threadActive)<br>
{<br>
<br>
-#if ENABLE_LIBVMAF<br>
+#ifdef ENABLE_LIBVMAF<br>
x265_vmaf_data* vmafdata = m_cliopt.vmafData;<br>
#endif<br>
/* This allows muxers to modify bitstream format */<br>
@@ -816,7 +816,7 @@ ret:<br>
<br>
api->encoder_get_stats(m_encoder, &stats, sizeof(stats));<br>
if (m_param->csvfn && !b_ctrl_c)<br>
-#if ENABLE_LIBVMAF<br>
+#ifdef ENABLE_LIBVMAF<br>
api->vmaf_encoder_log(m_encoder, m_cliopt.argCnt, m_cliopt.argString, m_cliopt.param, vmafdata);<br>
#else<br>
api->encoder_log(m_encoder, m_cliopt.argCnt, m_cliopt.argString);<br>
diff --git a/source/encoder/api.cpp b/source/encoder/api.cpp<br>
index 18edb9a70..542b074a5 100644<br>
--- a/source/encoder/api.cpp<br>
+++ b/source/encoder/api.cpp<br>
@@ -32,7 +32,7 @@<br>
#include "bitcost.h"<br>
#include "svt.h"<br>
<br>
-#if ENABLE_LIBVMAF<br>
+#ifdef ENABLE_LIBVMAF<br>
#include "libvmaf/libvmaf.h"<br>
#endif<br>
<br>
@@ -626,7 +626,7 @@ void x265_encoder_get_stats(x265_encoder *enc, x265_stats *outputStats, uint32_t<br>
encoder->fetchStats(outputStats, statsSizeBytes);<br>
}<br>
}<br>
-#if ENABLE_LIBVMAF<br>
+#ifdef ENABLE_LIBVMAF<br>
void x265_vmaf_encoder_log(x265_encoder* enc, int argc, char **argv, x265_param *param, x265_vmaf_data *vmafdata)<br>
{<br>
if (enc)<br>
@@ -1076,7 +1076,7 @@ static const x265_api libapi =<br>
&x265_csvlog_encode,<br>
&x265_dither_image,<br>
&x265_set_analysis_data,<br>
-#if ENABLE_LIBVMAF<br>
+#ifdef ENABLE_LIBVMAF<br>
&x265_calculate_vmafscore,<br>
&x265_calculate_vmaf_framelevelscore,<br>
&x265_vmaf_encoder_log,<br>
@@ -1381,7 +1381,7 @@ FILE* x265_csvlog_open(const x265_param* param)<br>
/* detailed performance statistics */<br>
fprintf(csvfp, ", DecideWait (ms), Row0Wait (ms), Wall time (ms), Ref Wait Wall (ms), Total CTU time (ms),"<br>
"Stall Time (ms), Total frame time (ms), Avg WPP, Row Blocks");<br>
-#if ENABLE_LIBVMAF<br>
+#ifdef ENABLE_LIBVMAF<br>
fprintf(csvfp, ", VMAF Frame Score");<br>
#endif<br>
}<br>
@@ -1392,7 +1392,7 @@ FILE* x265_csvlog_open(const x265_param* param)<br>
fputs(summaryCSVHeader, csvfp);<br>
if (param->csvLogLevel >= 2 || param->maxCLL || param->maxFALL)<br>
fputs("MaxCLL, MaxFALL,", csvfp);<br>
-#if ENABLE_LIBVMAF<br>
+#ifdef ENABLE_LIBVMAF<br>
fputs(" Aggregate VMAF Score,", csvfp);<br>
#endif<br>
fputs(" Version\n", csvfp);<br>
@@ -1508,7 +1508,7 @@ void x265_csvlog_frame(const x265_param* param, const x265_picture* pic)<br>
frameStats->totalFrameTime);<br>
<br>
fprintf(param->csvfpt, " %.3lf, %d", frameStats->avgWPP, frameStats->countRowBlocks);<br>
-#if ENABLE_LIBVMAF<br>
+#ifdef ENABLE_LIBVMAF<br>
fprintf(param->csvfpt, ", %lf", frameStats->vmafFrameScore);<br>
#endif<br>
}<br>
@@ -1529,7 +1529,7 @@ void x265_csvlog_encode(const x265_param *p, const x265_stats *stats, int padx,<br>
fputs(summaryCSVHeader, p->csvfpt);<br>
if (p->csvLogLevel >= 2 || p->maxCLL || p->maxFALL)<br>
fputs("MaxCLL, MaxFALL,", p->csvfpt);<br>
-#if ENABLE_LIBVMAF<br>
+#ifdef ENABLE_LIBVMAF<br>
fputs(" Aggregate VMAF score,", p->csvfpt);<br>
#endif<br>
fputs(" Version\n",p->csvfpt);<br>
@@ -1627,7 +1627,7 @@ void x265_csvlog_encode(const x265_param *p, const x265_stats *stats, int padx,<br>
fprintf(p->csvfpt, " -, -, -, -, -, -, -,");<br>
if (p->csvLogLevel >= 2 || p->maxCLL || p->maxFALL)<br>
fprintf(p->csvfpt, " %-6u, %-6u,", stats->maxCLL, stats->maxFALL);<br>
-#if ENABLE_LIBVMAF<br>
+#ifdef ENABLE_LIBVMAF<br>
fprintf(p->csvfpt, " %lf,", stats->aggregateVmafScore);<br>
#endif<br>
fprintf(p->csvfpt, " %s\n", api->version_str);<br>
@@ -1722,7 +1722,7 @@ void x265_dither_image(x265_picture* picIn, int picWidth, int picHeight, int16_t<br>
}<br>
}<br>
<br>
-#if ENABLE_LIBVMAF<br>
+#ifdef ENABLE_LIBVMAF<br>
/* Read y values of single frame for 8-bit input */<br>
int read_image_byte(FILE *file, float *buf, int width, int height, int stride)<br>
{<br>
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp<br>
index 977ae19e3..e3e205fd0 100644<br>
--- a/source/encoder/encoder.cpp<br>
+++ b/source/encoder/encoder.cpp<br>
@@ -3080,7 +3080,7 @@ void Encoder::finishFrameStats(Frame* curFrame, FrameEncoder *curEncoder, x265_f<br>
#define ELAPSED_MSEC(start, end) (((double)(end) - (start)) / 1000)<br>
if (m_param->csvLogLevel >= 2)<br>
{<br>
-#if ENABLE_LIBVMAF<br>
+#ifdef ENABLE_LIBVMAF<br>
frameStats->vmafFrameScore = curFrame->m_fencPic->m_vmafScore;<br>
#endif<br>
frameStats->decideWaitTime = ELAPSED_MSEC(0, curEncoder->m_slicetypeWaitTime);<br>
diff --git a/source/encoder/frameencoder.cpp b/source/encoder/frameencoder.cpp<br>
index 659b87c89..c11ede720 100644<br>
--- a/source/encoder/frameencoder.cpp<br>
+++ b/source/encoder/frameencoder.cpp<br>
@@ -959,7 +959,7 @@ void FrameEncoder::compressFrame()<br>
m_frameFilter.processRow(i - m_filterRowDelay);<br>
}<br>
}<br>
-#if ENABLE_LIBVMAF<br>
+#ifdef ENABLE_LIBVMAF<br>
vmafFrameLevelScore();<br>
#endif<br>
<br>
@@ -2232,7 +2232,7 @@ void FrameEncoder::readModel(FilmGrainCharacteristics* m_filmGrain, FILE* filmgr<br>
}<br>
}<br>
}<br>
-#if ENABLE_LIBVMAF<br>
+#ifdef ENABLE_LIBVMAF<br>
void FrameEncoder::vmafFrameLevelScore()<br>
{<br>
PicYuv *fenc = m_frame->m_fencPic;<br>
diff --git a/source/encoder/frameencoder.h b/source/encoder/frameencoder.h<br>
index 9c5810883..21f2ffaf0 100644<br>
--- a/source/encoder/frameencoder.h<br>
+++ b/source/encoder/frameencoder.h<br>
@@ -277,7 +277,7 @@ protected:<br>
void enqueueRowFilter(int row) { WaveFront::enqueueRow(row * 2 + 1); }<br>
void enableRowEncoder(int row) { WaveFront::enableRow(row * 2 + 0); }<br>
void enableRowFilter(int row) { WaveFront::enableRow(row * 2 + 1); }<br>
-#if ENABLE_LIBVMAF<br>
+#ifdef ENABLE_LIBVMAF<br>
void vmafFrameLevelScore();<br>
#endif<br>
void collectDynDataFrame();<br>
diff --git a/source/x265.h b/source/x265.h<br>
index 901f33ded..d153d048e 100644<br>
--- a/source/x265.h<br>
+++ b/source/x265.h<br>
@@ -2522,7 +2522,7 @@ void x265_csvlog_encode(const x265_param*, const x265_stats *, int padx, int pad<br>
/* In-place downshift from a bit-depth greater than 8 to a bit-depth of 8, using<br>
* the residual bits to dither each row. */<br>
void x265_dither_image(x265_picture *, int picWidth, int picHeight, int16_t *errorBuf, int bitDepth);<br>
-#if ENABLE_LIBVMAF<br>
+#ifdef ENABLE_LIBVMAF<br>
/* x265_calculate_vmafScore:<br>
* returns VMAF score for the input video.<br>
* This api must be called only after encoding was done. */<br>
@@ -2593,7 +2593,7 @@ typedef struct x265_api<br>
void (*csvlog_encode)(const x265_param*, const x265_stats *, int, int, int, char**);<br>
void (*dither_image)(x265_picture*, int, int, int16_t*, int);<br>
int (*set_analysis_data)(x265_encoder *encoder, x265_analysis_data *analysis_data, int poc, uint32_t cuBytes);<br>
-#if ENABLE_LIBVMAF<br>
+#ifdef ENABLE_LIBVMAF<br>
double (*calculate_vmafscore)(x265_param *, x265_vmaf_data *);<br>
double (*calculate_vmaf_framelevelscore)(x265_vmaf_framedata *);<br>
void (*vmaf_encoder_log)(x265_encoder*, int, char**, x265_param *, x265_vmaf_data *);<br>
diff --git a/source/x265cli.cpp b/source/x265cli.cpp<br>
index eef101fe9..4e3e4a4e5 100755<br>
--- a/source/x265cli.cpp<br>
+++ b/source/x265cli.cpp<br>
@@ -637,7 +637,7 @@ namespace X265_NS {<br>
x265_log(NULL, X265_LOG_ERROR, "param alloc failed\n");<br>
return true;<br>
}<br>
-#if ENABLE_LIBVMAF<br>
+#ifdef ENABLE_LIBVMAF<br>
vmafData = (x265_vmaf_data*)x265_malloc(sizeof(x265_vmaf_data));<br>
if (!vmafData)<br>
{<br>
@@ -930,7 +930,7 @@ namespace X265_NS {<br>
param->sourceWidth, param->sourceHeight, param->fpsNum, param->fpsDenom,<br>
x265_source_csp_names[param->internalCsp]);<br>
}<br>
-#if ENABLE_LIBVMAF<br>
+#ifdef ENABLE_LIBVMAF<br>
if (!reconfn)<br>
{<br>
x265_log(param, X265_LOG_ERROR, "recon file must be specified to get VMAF score, try --help for help\n");<br>
-- <br>
2.34.1<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Fri, 9 Jun 2023 00:11:43 +0200<br>
From: Johannes Kauffmann <<a href="mailto:johanneskauffmann@hotmail.com" target="_blank">johanneskauffmann@hotmail.com</a>><br>
To: <a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
Subject: [x265] [PATCH 3/3] Add defines needed by client apps to .pc<br>
file<br>
Message-ID:<br>
<<a href="mailto:DB6PR07MB3175A8AD89183E730E949D72A650A@DB6PR07MB3175.eurprd07.prod.outlook.com" target="_blank">DB6PR07MB3175A8AD89183E730E949D72A650A@DB6PR07MB3175.eurprd07.prod.outlook.com</a>><br>
<br>
Content-Type: text/plain<br>
<br>
For now, the only defines also needed by client apps are HIGH_BIT_DEPTH<br>
and ENABLE_LIBVMAF.<br>
<br>
Also, use HIGH_BIT_DEPTH define in public header, instead of X265_DEPTH.<br>
---<br>
source/CMakeLists.txt | 15 +++++++++++----<br>
source/x265.h | 2 +-<br>
source/<a href="http://x265.pc.in" rel="noreferrer" target="_blank">x265.pc.in</a> | 2 +-<br>
3 files changed, 13 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt<br>
index e1c83bf97..cbbd813d2 100755<br>
--- a/source/CMakeLists.txt<br>
+++ b/source/CMakeLists.txt<br>
@@ -37,6 +37,10 @@ configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265_config.h.in" rel="noreferrer" target="_blank">x265_config.h.in</a>"<br>
<br>
SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")<br>
<br>
+# Added to the .pc file, and also passed to add_definitions() later. Use this variable<br>
+# instead of add_definitions() for flags needed by both x265 itself and client applications.<br>
+set(X265_PUBLIC_DEFINES "")<br>
+<br>
# System architecture detection<br>
if (APPLE AND CMAKE_OSX_ARCHITECTURES)<br>
string(TOLOWER "${CMAKE_OSX_ARCHITECTURES}" SYSPROC)<br>
@@ -129,7 +133,7 @@ if(UNIX)<br>
find_library(VMAF vmaf)<br>
option(ENABLE_LIBVMAF "Enable VMAF" OFF)<br>
if(ENABLE_LIBVMAF)<br>
- add_definitions(-DENABLE_LIBVMAF)<br>
+ set(X265_PUBLIC_DEFINES "${X265_PUBLIC_DEFINES} -DENABLE_LIBVMAF")<br>
endif()<br>
endif(UNIX)<br>
<br>
@@ -405,14 +409,15 @@ if(X64)<br>
option(HIGH_BIT_DEPTH "Store pixel samples as 16bit values (Main10/Main12)" OFF)<br>
endif(X64)<br>
if(HIGH_BIT_DEPTH)<br>
+ set(X265_PUBLIC_DEFINES "${X265_PUBLIC_DEFINES} -DHIGH_BIT_DEPTH")<br>
option(MAIN12 "Support Main12 instead of Main10" OFF)<br>
if(MAIN12)<br>
- add_definitions(-DHIGH_BIT_DEPTH=1 -DX265_DEPTH=12)<br>
+ add_definitions(-DX265_DEPTH=12)<br>
else()<br>
- add_definitions(-DHIGH_BIT_DEPTH=1 -DX265_DEPTH=10)<br>
+ add_definitions(-DX265_DEPTH=10)<br>
endif()<br>
else(HIGH_BIT_DEPTH)<br>
- add_definitions(-DHIGH_BIT_DEPTH=0 -DX265_DEPTH=8)<br>
+ add_definitions(-DX265_DEPTH=8)<br>
endif(HIGH_BIT_DEPTH)<br>
<br>
if (ENABLE_HDR10_PLUS)<br>
@@ -722,6 +727,8 @@ if(ENABLE_SHARED)<br>
endif()<br>
endif()<br>
<br>
+add_definitions("${X265_PUBLIC_DEFINES}")<br>
+<br>
if(X265_LATEST_TAG)<br>
# convert lists of link libraries into -lstdc++ -lm etc..<br>
foreach(LIB ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES} ${PLATFORM_LIBS})<br>
diff --git a/source/x265.h b/source/x265.h<br>
index d153d048e..be50639c3 100644<br>
--- a/source/x265.h<br>
+++ b/source/x265.h<br>
@@ -181,7 +181,7 @@ typedef struct x265_weight_param<br>
int wtPresent;<br>
}x265_weight_param;<br>
<br>
-#if X265_DEPTH < 10<br>
+#ifndef HIGH_BIT_DEPTH<br>
typedef uint32_t sse_t;<br>
#else<br>
typedef uint64_t sse_t;<br>
diff --git a/source/<a href="http://x265.pc.in" rel="noreferrer" target="_blank">x265.pc.in</a> b/source/<a href="http://x265.pc.in" rel="noreferrer" target="_blank">x265.pc.in</a><br>
index 0bf99e938..993d674a2 100644<br>
--- a/source/<a href="http://x265.pc.in" rel="noreferrer" target="_blank">x265.pc.in</a><br>
+++ b/source/<a href="http://x265.pc.in" rel="noreferrer" target="_blank">x265.pc.in</a><br>
@@ -8,4 +8,4 @@ Description: H.265/HEVC video encoder<br>
Version: @X265_LATEST_TAG@<br>
Libs: -L${libdir} -lx265<br>
Libs.private: @PRIVATE_LIBS@<br>
-Cflags: -I${includedir}<br>
+Cflags: -I${includedir} @X265_PUBLIC_DEFINES@<br>
-- <br>
2.34.1<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
<br>
<br>
------------------------------<br>
<br>
End of x265-devel Digest, Vol 120, Issue 3<br>
******************************************<br>
</blockquote></div>