<div dir="ltr">Please ignore this patch. </div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><br>Regards,<br><br>Bhavna Hariharan<br></div></div></div></div></div>
<br><div class="gmail_quote">On Wed, Aug 2, 2017 at 9:47 PM, <span dir="ltr"><<a href="mailto:bhavna@multicorewareinc.com" target="_blank">bhavna@multicorewareinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Bhavna Hariharan <<a href="mailto:bhavna@multicorewareinc.com">bhavna@multicorewareinc.com</a>><br>
# Date 1501680985 -19800<br>
# Wed Aug 02 19:06:25 2017 +0530<br>
# Node ID 041fcaf820659d504d887cfaa239a0<wbr>2988812c14<br>
# Parent d11482e5fedbcdaf62ee3c6872f438<wbr>27d99ad181<br>
Fix testbench crash with dhdr10 enabled<br>
<br>
__rdtsc() was being defined multiple times causing failure in testbench.<br>
This patch renames the function and duplicates the REPORT_SPEEDUP macro that<br>
supports GNU compiler.<br>
<br>
Display warning when dhdr10 is enabled with MSVC version that does not<br>
support c++11.<br>
<br>
diff -r d11482e5fedb -r 041fcaf82065 source/CMakeLists.txt<br>
--- a/source/CMakeLists.txt Mon Jul 24 11:15:38 2017 +0530<br>
+++ b/source/CMakeLists.txt Wed Aug 02 19:06:25 2017 +0530<br>
@@ -184,6 +184,9 @@<br>
endif()<br>
# this option is to enable the inclusion of dynamic HDR10 library to the libx265 compilation<br>
option(ENABLE_HDR10_PLUS "Enable dynamic HDR10 compilation" OFF)<br>
+if(MSVC AND (MSVC_VERSION LESS 1800) AND ENABLE_HDR10_PLUS)<br>
+ message(FATAL_ERROR "MSVC version 12.0 or above required to support hdr10plus")<br>
+endif()<br>
if(GCC)<br>
add_definitions(-Wall -Wextra -Wshadow)<br>
add_definitions(-D__STDC_<wbr>LIMIT_MACROS=1)<br>
diff -r d11482e5fedb -r 041fcaf82065 source/dynamicHDR10/<wbr>metadataFromJson.cpp<br>
--- a/source/dynamicHDR10/<wbr>metadataFromJson.cpp Mon Jul 24 11:15:38 2017 +0530<br>
+++ b/source/dynamicHDR10/<wbr>metadataFromJson.cpp Wed Aug 02 19:06:25 2017 +0530<br>
@@ -34,8 +34,6 @@<br>
#include "BasicStructures.h"<br>
#include "SeiMetadataDictionary.h"<br>
<br>
-#define M_PI 3.14159265358979323846<br>
-<br>
using namespace SeiMetadataDictionary;<br>
<br>
class metadataFromJson::<wbr>DynamicMetaIO<br>
diff -r d11482e5fedb -r 041fcaf82065 source/test/testharness.h<br>
--- a/source/test/testharness.h Mon Jul 24 11:15:38 2017 +0530<br>
+++ b/source/test/testharness.h Wed Aug 02 19:06:25 2017 +0530<br>
@@ -70,7 +70,7 @@<br>
#include <intrin.h><br>
#elif defined(__GNUC__)<br>
/* fallback for older GCC/MinGW */<br>
-static inline uint32_t __rdtsc(void)<br>
+static inline uint32_t rdtsc(void)<br>
{<br>
uint32_t a = 0;<br>
<br>
@@ -92,6 +92,41 @@<br>
// Adapted from checkasm.c, runs each optimized primitive four times, measures rdtsc<br>
// and discards invalid times. Repeats 1000 times to get a good average. Then measures<br>
// the C reference with fewer runs and reports X factor and average cycles.<br>
+<br>
+// Duplicate macro to avoid conflict with in-built function __rdtsc()<br>
+#if defined(__GNUC__)<br>
+#define REPORT_SPEEDUP(RUNOPT, RUNREF, ...) \<br>
+ { \<br>
+ uint32_t cycles = 0; int runs = 0; \<br>
+ RUNOPT(__VA_ARGS__); \<br>
+ for (int ti = 0; ti < BENCH_RUNS; ti++) { \<br>
+ uint32_t t0 = (uint32_t)rdtsc(); \<br>
+ RUNOPT(__VA_ARGS__); \<br>
+ RUNOPT(__VA_ARGS__); \<br>
+ RUNOPT(__VA_ARGS__); \<br>
+ RUNOPT(__VA_ARGS__); \<br>
+ uint32_t t1 = (uint32_t)rdtsc() - t0; \<br>
+ if (t1 * runs <= cycles * 4 && ti > 0) { cycles += t1; runs++; } \<br>
+ } \<br>
+ uint32_t refcycles = 0; int refruns = 0; \<br>
+ RUNREF(__VA_ARGS__); \<br>
+ for (int ti = 0; ti < BENCH_RUNS / 4; ti++) { \<br>
+ uint32_t t0 = (uint32_t)rdtsc(); \<br>
+ RUNREF(__VA_ARGS__); \<br>
+ RUNREF(__VA_ARGS__); \<br>
+ RUNREF(__VA_ARGS__); \<br>
+ RUNREF(__VA_ARGS__); \<br>
+ uint32_t t1 = (uint32_t)rdtsc() - t0; \<br>
+ if (t1 * refruns <= refcycles * 4 && ti > 0) { refcycles += t1; refruns++; } \<br>
+ } \<br>
+ x265_emms(); \<br>
+ float optperf = (10.0f * cycles / runs) / 4; \<br>
+ float refperf = (10.0f * refcycles / refruns) / 4; \<br>
+ printf("\t%3.2fx ", refperf / optperf); \<br>
+ printf("\t %-8.2lf \t %-8.2lf\n", optperf, refperf); \<br>
+ }<br>
+<br>
+#else<br>
#define REPORT_SPEEDUP(RUNOPT, RUNREF, ...) \<br>
{ \<br>
uint32_t cycles = 0; int runs = 0; \<br>
@@ -123,6 +158,7 @@<br>
printf("\t %-8.2lf \t %-8.2lf\n", optperf, refperf); \<br>
}<br>
<br>
+#endif<br>
extern "C" {<br>
#if X265_ARCH_X86<br>
int PFX(stack_pagealign)(int (*func)(), int align);<br>
</blockquote></div><br></div>