[x265] [PATCH] Move csv file pointer to param

Divya Manivannan divya at multicorewareinc.com
Thu Jun 29 10:24:55 CEST 2017


# HG changeset patch
# User Divya Manivannan <divya at multicorewareinc.com>
# Date 1498719699 -19800
#      Thu Jun 29 12:31:39 2017 +0530
# Node ID 5f9170dbf90ec865dc49cac8423d86f941b998e2
# Parent  67dcf6e79090acb619c5ac499ef5da0b73c3a48b
Move csv file pointer to param

diff -r 67dcf6e79090 -r 5f9170dbf90e source/CMakeLists.txt
--- a/source/CMakeLists.txt	Wed Jun 28 11:54:05 2017 -0500
+++ b/source/CMakeLists.txt	Thu Jun 29 12:31:39 2017 +0530
@@ -29,7 +29,7 @@
 option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 128)
+set(X265_BUILD 129)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 67dcf6e79090 -r 5f9170dbf90e source/common/param.cpp
--- a/source/common/param.cpp	Wed Jun 28 11:54:05 2017 -0500
+++ b/source/common/param.cpp	Thu Jun 29 12:31:39 2017 +0530
@@ -284,6 +284,7 @@
     param->interRefine = 0;
     param->mvRefine = 0;
     param->bUseAnalysisFile = 1;
+    param->csvfpt = NULL;
 }
 
 int x265_param_default_preset(x265_param* param, const char* preset, const char* tune)
diff -r 67dcf6e79090 -r 5f9170dbf90e source/encoder/api.cpp
--- a/source/encoder/api.cpp	Wed Jun 28 11:54:05 2017 -0500
+++ b/source/encoder/api.cpp	Thu Jun 29 12:31:39 2017 +0530
@@ -120,8 +120,8 @@
     /* Try to open CSV file handle */
     if (encoder->m_param->csvfn)
     {
-        encoder->m_csvfpt = x265_csvlog_open(*encoder->m_param, encoder->m_param->csvfn, encoder->m_param->csvLogLevel);
-        if (!encoder->m_csvfpt)
+        encoder->m_param->csvfpt = x265_csvlog_open(*encoder->m_param, encoder->m_param->csvfn, encoder->m_param->csvLogLevel);
+        if (!encoder->m_param->csvfpt)
         {
             x265_log(encoder->m_param, X265_LOG_ERROR, "Unable to open CSV log file <%s>, aborting\n", encoder->m_param->csvfn);
             encoder->m_aborted = true;
@@ -269,7 +269,7 @@
         *pi_nal = 0;
 
     if (numEncoded && encoder->m_param->csvLogLevel)
-        x265_csvlog_frame(encoder->m_csvfpt, *encoder->m_param, *pic_out, encoder->m_param->csvLogLevel);
+        x265_csvlog_frame(encoder->m_param->csvfpt, *encoder->m_param, *pic_out, encoder->m_param->csvLogLevel);
 
     if (numEncoded < 0)
         encoder->m_aborted = true;
@@ -295,7 +295,7 @@
         int padx = encoder->m_sps.conformanceWindow.rightOffset;
         int pady = encoder->m_sps.conformanceWindow.bottomOffset;
         encoder->fetchStats(&stats, sizeof(stats));
-        x265_csvlog_encode(encoder->m_csvfpt, x265_version_str, *encoder->m_param, padx, pady, stats, encoder->m_param->csvLogLevel, argc, argv);
+        x265_csvlog_encode(encoder->m_param->csvfpt, x265_version_str, *encoder->m_param, padx, pady, stats, encoder->m_param->csvLogLevel, argc, argv);
     }
 }
 
diff -r 67dcf6e79090 -r 5f9170dbf90e source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Wed Jun 28 11:54:05 2017 -0500
+++ b/source/encoder/encoder.cpp	Thu Jun 29 12:31:39 2017 +0530
@@ -70,7 +70,6 @@
     m_exportedPic = NULL;
     m_numDelayedPic = 0;
     m_outputCount = 0;
-    m_csvfpt = NULL;
     m_param = NULL;
     m_latestParam = NULL;
     m_threadPool = NULL;
@@ -475,9 +474,6 @@
     if (m_analysisFile)
         fclose(m_analysisFile);
 
-    if (m_csvfpt)
-        fclose(m_csvfpt);
-
     if (m_latestParam != NULL && m_latestParam != m_param)
     {
         if (m_latestParam->scalingLists != m_param->scalingLists)
@@ -509,6 +505,8 @@
      }
     if (m_param)
     {
+        if (m_param->csvfpt)
+            fclose(m_param->csvfpt);
         /* release string arguments that were strdup'd */
         free((char*)m_param->rc.lambdaFileName);
         free((char*)m_param->rc.statFileName);
diff -r 67dcf6e79090 -r 5f9170dbf90e source/encoder/encoder.h
--- a/source/encoder/encoder.h	Wed Jun 28 11:54:05 2017 -0500
+++ b/source/encoder/encoder.h	Thu Jun 29 12:31:39 2017 +0530
@@ -137,7 +137,6 @@
     x265_param*        m_latestParam;     // Holds latest param during a reconfigure
     RateControl*       m_rateControl;
     Lookahead*         m_lookahead;
-    FILE*              m_csvfpt;
 
     /* Collect statistics globally */
     EncStats           m_analyzeAll;
diff -r 67dcf6e79090 -r 5f9170dbf90e source/x265.h
--- a/source/x265.h	Wed Jun 28 11:54:05 2017 -0500
+++ b/source/x265.h	Thu Jun 29 12:31:39 2017 +0530
@@ -26,6 +26,7 @@
 #define X265_H
 
 #include <stdint.h>
+#include <cstdio>
 #include "x265_config.h"
 
 #ifdef __cplusplus
@@ -1478,6 +1479,8 @@
     /* Specify if analysis mode uses file for data reuse */
     int       bUseAnalysisFile;
 
+    /* File pointer for csv log */
+    FILE*     csvfpt;
 } x265_param;
 
 /* x265_param_alloc:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265.patch
Type: text/x-patch
Size: 4871 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20170629/d356f7fb/attachment-0001.bin>


More information about the x265-devel mailing list