[x265] [PATCH 2/3] Fix Wundef for ENABLE_LIBVMAF
Johannes Kauffmann
johanneskauffmann at hotmail.com
Thu Jun 8 22:11:42 UTC 2023
---
source/abrEncApp.cpp | 4 ++--
source/encoder/api.cpp | 18 +++++++++---------
source/encoder/encoder.cpp | 2 +-
source/encoder/frameencoder.cpp | 4 ++--
source/encoder/frameencoder.h | 2 +-
source/x265.h | 4 ++--
source/x265cli.cpp | 4 ++--
7 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/source/abrEncApp.cpp b/source/abrEncApp.cpp
index 94644a1c0..4b4c2242c 100644
--- a/source/abrEncApp.cpp
+++ b/source/abrEncApp.cpp
@@ -514,7 +514,7 @@ ret:
while (m_threadActive)
{
-#if ENABLE_LIBVMAF
+#ifdef ENABLE_LIBVMAF
x265_vmaf_data* vmafdata = m_cliopt.vmafData;
#endif
/* This allows muxers to modify bitstream format */
@@ -816,7 +816,7 @@ ret:
api->encoder_get_stats(m_encoder, &stats, sizeof(stats));
if (m_param->csvfn && !b_ctrl_c)
-#if ENABLE_LIBVMAF
+#ifdef ENABLE_LIBVMAF
api->vmaf_encoder_log(m_encoder, m_cliopt.argCnt, m_cliopt.argString, m_cliopt.param, vmafdata);
#else
api->encoder_log(m_encoder, m_cliopt.argCnt, m_cliopt.argString);
diff --git a/source/encoder/api.cpp b/source/encoder/api.cpp
index 18edb9a70..542b074a5 100644
--- a/source/encoder/api.cpp
+++ b/source/encoder/api.cpp
@@ -32,7 +32,7 @@
#include "bitcost.h"
#include "svt.h"
-#if ENABLE_LIBVMAF
+#ifdef ENABLE_LIBVMAF
#include "libvmaf/libvmaf.h"
#endif
@@ -626,7 +626,7 @@ void x265_encoder_get_stats(x265_encoder *enc, x265_stats *outputStats, uint32_t
encoder->fetchStats(outputStats, statsSizeBytes);
}
}
-#if ENABLE_LIBVMAF
+#ifdef ENABLE_LIBVMAF
void x265_vmaf_encoder_log(x265_encoder* enc, int argc, char **argv, x265_param *param, x265_vmaf_data *vmafdata)
{
if (enc)
@@ -1076,7 +1076,7 @@ static const x265_api libapi =
&x265_csvlog_encode,
&x265_dither_image,
&x265_set_analysis_data,
-#if ENABLE_LIBVMAF
+#ifdef ENABLE_LIBVMAF
&x265_calculate_vmafscore,
&x265_calculate_vmaf_framelevelscore,
&x265_vmaf_encoder_log,
@@ -1381,7 +1381,7 @@ FILE* x265_csvlog_open(const x265_param* param)
/* detailed performance statistics */
fprintf(csvfp, ", DecideWait (ms), Row0Wait (ms), Wall time (ms), Ref Wait Wall (ms), Total CTU time (ms),"
"Stall Time (ms), Total frame time (ms), Avg WPP, Row Blocks");
-#if ENABLE_LIBVMAF
+#ifdef ENABLE_LIBVMAF
fprintf(csvfp, ", VMAF Frame Score");
#endif
}
@@ -1392,7 +1392,7 @@ FILE* x265_csvlog_open(const x265_param* param)
fputs(summaryCSVHeader, csvfp);
if (param->csvLogLevel >= 2 || param->maxCLL || param->maxFALL)
fputs("MaxCLL, MaxFALL,", csvfp);
-#if ENABLE_LIBVMAF
+#ifdef ENABLE_LIBVMAF
fputs(" Aggregate VMAF Score,", csvfp);
#endif
fputs(" Version\n", csvfp);
@@ -1508,7 +1508,7 @@ void x265_csvlog_frame(const x265_param* param, const x265_picture* pic)
frameStats->totalFrameTime);
fprintf(param->csvfpt, " %.3lf, %d", frameStats->avgWPP, frameStats->countRowBlocks);
-#if ENABLE_LIBVMAF
+#ifdef ENABLE_LIBVMAF
fprintf(param->csvfpt, ", %lf", frameStats->vmafFrameScore);
#endif
}
@@ -1529,7 +1529,7 @@ void x265_csvlog_encode(const x265_param *p, const x265_stats *stats, int padx,
fputs(summaryCSVHeader, p->csvfpt);
if (p->csvLogLevel >= 2 || p->maxCLL || p->maxFALL)
fputs("MaxCLL, MaxFALL,", p->csvfpt);
-#if ENABLE_LIBVMAF
+#ifdef ENABLE_LIBVMAF
fputs(" Aggregate VMAF score,", p->csvfpt);
#endif
fputs(" Version\n",p->csvfpt);
@@ -1627,7 +1627,7 @@ void x265_csvlog_encode(const x265_param *p, const x265_stats *stats, int padx,
fprintf(p->csvfpt, " -, -, -, -, -, -, -,");
if (p->csvLogLevel >= 2 || p->maxCLL || p->maxFALL)
fprintf(p->csvfpt, " %-6u, %-6u,", stats->maxCLL, stats->maxFALL);
-#if ENABLE_LIBVMAF
+#ifdef ENABLE_LIBVMAF
fprintf(p->csvfpt, " %lf,", stats->aggregateVmafScore);
#endif
fprintf(p->csvfpt, " %s\n", api->version_str);
@@ -1722,7 +1722,7 @@ void x265_dither_image(x265_picture* picIn, int picWidth, int picHeight, int16_t
}
}
-#if ENABLE_LIBVMAF
+#ifdef ENABLE_LIBVMAF
/* Read y values of single frame for 8-bit input */
int read_image_byte(FILE *file, float *buf, int width, int height, int stride)
{
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
index 977ae19e3..e3e205fd0 100644
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -3080,7 +3080,7 @@ void Encoder::finishFrameStats(Frame* curFrame, FrameEncoder *curEncoder, x265_f
#define ELAPSED_MSEC(start, end) (((double)(end) - (start)) / 1000)
if (m_param->csvLogLevel >= 2)
{
-#if ENABLE_LIBVMAF
+#ifdef ENABLE_LIBVMAF
frameStats->vmafFrameScore = curFrame->m_fencPic->m_vmafScore;
#endif
frameStats->decideWaitTime = ELAPSED_MSEC(0, curEncoder->m_slicetypeWaitTime);
diff --git a/source/encoder/frameencoder.cpp b/source/encoder/frameencoder.cpp
index 659b87c89..c11ede720 100644
--- a/source/encoder/frameencoder.cpp
+++ b/source/encoder/frameencoder.cpp
@@ -959,7 +959,7 @@ void FrameEncoder::compressFrame()
m_frameFilter.processRow(i - m_filterRowDelay);
}
}
-#if ENABLE_LIBVMAF
+#ifdef ENABLE_LIBVMAF
vmafFrameLevelScore();
#endif
@@ -2232,7 +2232,7 @@ void FrameEncoder::readModel(FilmGrainCharacteristics* m_filmGrain, FILE* filmgr
}
}
}
-#if ENABLE_LIBVMAF
+#ifdef ENABLE_LIBVMAF
void FrameEncoder::vmafFrameLevelScore()
{
PicYuv *fenc = m_frame->m_fencPic;
diff --git a/source/encoder/frameencoder.h b/source/encoder/frameencoder.h
index 9c5810883..21f2ffaf0 100644
--- a/source/encoder/frameencoder.h
+++ b/source/encoder/frameencoder.h
@@ -277,7 +277,7 @@ protected:
void enqueueRowFilter(int row) { WaveFront::enqueueRow(row * 2 + 1); }
void enableRowEncoder(int row) { WaveFront::enableRow(row * 2 + 0); }
void enableRowFilter(int row) { WaveFront::enableRow(row * 2 + 1); }
-#if ENABLE_LIBVMAF
+#ifdef ENABLE_LIBVMAF
void vmafFrameLevelScore();
#endif
void collectDynDataFrame();
diff --git a/source/x265.h b/source/x265.h
index 901f33ded..d153d048e 100644
--- a/source/x265.h
+++ b/source/x265.h
@@ -2522,7 +2522,7 @@ void x265_csvlog_encode(const x265_param*, const x265_stats *, int padx, int pad
/* In-place downshift from a bit-depth greater than 8 to a bit-depth of 8, using
* the residual bits to dither each row. */
void x265_dither_image(x265_picture *, int picWidth, int picHeight, int16_t *errorBuf, int bitDepth);
-#if ENABLE_LIBVMAF
+#ifdef ENABLE_LIBVMAF
/* x265_calculate_vmafScore:
* returns VMAF score for the input video.
* This api must be called only after encoding was done. */
@@ -2593,7 +2593,7 @@ typedef struct x265_api
void (*csvlog_encode)(const x265_param*, const x265_stats *, int, int, int, char**);
void (*dither_image)(x265_picture*, int, int, int16_t*, int);
int (*set_analysis_data)(x265_encoder *encoder, x265_analysis_data *analysis_data, int poc, uint32_t cuBytes);
-#if ENABLE_LIBVMAF
+#ifdef ENABLE_LIBVMAF
double (*calculate_vmafscore)(x265_param *, x265_vmaf_data *);
double (*calculate_vmaf_framelevelscore)(x265_vmaf_framedata *);
void (*vmaf_encoder_log)(x265_encoder*, int, char**, x265_param *, x265_vmaf_data *);
diff --git a/source/x265cli.cpp b/source/x265cli.cpp
index eef101fe9..4e3e4a4e5 100755
--- a/source/x265cli.cpp
+++ b/source/x265cli.cpp
@@ -637,7 +637,7 @@ namespace X265_NS {
x265_log(NULL, X265_LOG_ERROR, "param alloc failed\n");
return true;
}
-#if ENABLE_LIBVMAF
+#ifdef ENABLE_LIBVMAF
vmafData = (x265_vmaf_data*)x265_malloc(sizeof(x265_vmaf_data));
if (!vmafData)
{
@@ -930,7 +930,7 @@ namespace X265_NS {
param->sourceWidth, param->sourceHeight, param->fpsNum, param->fpsDenom,
x265_source_csp_names[param->internalCsp]);
}
-#if ENABLE_LIBVMAF
+#ifdef ENABLE_LIBVMAF
if (!reconfn)
{
x265_log(param, X265_LOG_ERROR, "recon file must be specified to get VMAF score, try --help for help\n");
--
2.34.1
More information about the x265-devel
mailing list