[x265-commits] [x265] nal: annexb warning fixes for MSVC

Steve Borho steve at borho.org
Sat Apr 11 19:56:53 CEST 2015


details:   http://hg.videolan.org/x265/rev/43d33281f769
branches:  
changeset: 10157:43d33281f769
user:      Steve Borho <steve at borho.org>
date:      Fri Apr 10 13:47:50 2015 -0500
description:
nal: annexb warning fixes for MSVC
Subject: [x265] encoder: rename functions to avoid name conflicts with Thread::stop()

details:   http://hg.videolan.org/x265/rev/4c76bc92a136
branches:  
changeset: 10158:4c76bc92a136
user:      Steve Borho <steve at borho.org>
date:      Fri Apr 10 16:20:36 2015 -0500
description:
encoder: rename functions to avoid name conflicts with Thread::stop()

Should have no behavior effect, just a clarification
Subject: [x265] cli: nits, remove dead code

details:   http://hg.videolan.org/x265/rev/4cccf22b00ee
branches:  
changeset: 10159:4cccf22b00ee
user:      Steve Borho <steve at borho.org>
date:      Fri Apr 10 18:15:38 2015 -0500
description:
cli: nits, remove dead code

diffstat:

 source/common/threadpool.cpp |   2 +-
 source/common/threadpool.h   |   2 +-
 source/encoder/api.cpp       |   2 +-
 source/encoder/encoder.cpp   |  10 +++++-----
 source/encoder/encoder.h     |   2 +-
 source/encoder/nal.cpp       |   8 ++++----
 source/encoder/slicetype.cpp |   2 +-
 source/encoder/slicetype.h   |   2 +-
 source/x265.cpp              |  19 ++-----------------
 9 files changed, 17 insertions(+), 32 deletions(-)

diffs (203 lines):

diff -r a6c7cf774564 -r 4cccf22b00ee source/common/threadpool.cpp
--- a/source/common/threadpool.cpp	Fri Apr 10 18:35:23 2015 +0530
+++ b/source/common/threadpool.cpp	Fri Apr 10 18:15:38 2015 -0500
@@ -373,7 +373,7 @@ bool ThreadPool::start()
     return true;
 }
 
-void ThreadPool::stop()
+void ThreadPool::stopWorkers()
 {
     if (m_workers)
     {
diff -r a6c7cf774564 -r 4cccf22b00ee source/common/threadpool.h
--- a/source/common/threadpool.h	Fri Apr 10 18:35:23 2015 +0530
+++ b/source/common/threadpool.h	Fri Apr 10 18:15:38 2015 -0500
@@ -94,7 +94,7 @@ public:
 
     bool create(int numThreads, int maxProviders, int node);
     bool start();
-    void stop();
+    void stopWorkers();
     void setCurrentThreadAffinity();
     int  tryAcquireSleepingThread(sleepbitmap_t firstTryBitmap, sleepbitmap_t secondTryBitmap);
     int  tryBondPeers(int maxPeers, sleepbitmap_t peerBitmap, BondedTaskGroup& master);
diff -r a6c7cf774564 -r 4cccf22b00ee source/encoder/api.cpp
--- a/source/encoder/api.cpp	Fri Apr 10 18:35:23 2015 +0530
+++ b/source/encoder/api.cpp	Fri Apr 10 18:15:38 2015 -0500
@@ -180,7 +180,7 @@ void x265_encoder_close(x265_encoder *en
     {
         Encoder *encoder = static_cast<Encoder*>(enc);
 
-        encoder->stop();
+        encoder->stopJobs();
         encoder->printSummary();
         encoder->destroy();
         delete encoder;
diff -r a6c7cf774564 -r 4cccf22b00ee source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Fri Apr 10 18:35:23 2015 +0530
+++ b/source/encoder/encoder.cpp	Fri Apr 10 18:15:38 2015 -0500
@@ -163,7 +163,7 @@ void Encoder::create()
     for (int i = 0; i < m_param->frameNumThreads; i++)
     {
         m_frameEncoder[i] = new FrameEncoder;
-        m_frameEncoder[i]->m_nalList.m_annexB = m_param->bAnnexB;
+        m_frameEncoder[i]->m_nalList.m_annexB = !!m_param->bAnnexB;
     }
 
     if (m_numPools)
@@ -293,16 +293,16 @@ void Encoder::create()
 
     m_encodeStartTime = x265_mdate();
 
-    m_nalList.m_annexB = m_param->bAnnexB;
+    m_nalList.m_annexB = !!m_param->bAnnexB;
 }
 
-void Encoder::stop()
+void Encoder::stopJobs()
 {
     if (m_rateControl)
         m_rateControl->terminate(); // unblock all blocked RC calls
 
     if (m_lookahead)
-        m_lookahead->stop();
+        m_lookahead->stopJobs();
     
     for (int i = 0; i < m_param->frameNumThreads; i++)
     {
@@ -316,7 +316,7 @@ void Encoder::stop()
     }
 
     if (m_threadPool)
-        m_threadPool->stop();
+        m_threadPool->stopWorkers();
 }
 
 void Encoder::destroy()
diff -r a6c7cf774564 -r 4cccf22b00ee source/encoder/encoder.h
--- a/source/encoder/encoder.h	Fri Apr 10 18:35:23 2015 +0530
+++ b/source/encoder/encoder.h	Fri Apr 10 18:15:38 2015 -0500
@@ -136,7 +136,7 @@ public:
     ~Encoder() {}
 
     void create();
-    void stop();
+    void stopJobs();
     void destroy();
 
     int encode(const x265_picture* pic, x265_picture *pic_out);
diff -r a6c7cf774564 -r 4cccf22b00ee source/encoder/nal.cpp
--- a/source/encoder/nal.cpp	Fri Apr 10 18:35:23 2015 +0530
+++ b/source/encoder/nal.cpp	Fri Apr 10 18:15:38 2015 -0500
@@ -154,10 +154,10 @@ void NALList::serialize(NalUnitType nalU
     if (!m_annexB)
     {
         uint32_t dataSize = bytes - 4;
-        out[0] = dataSize >> 24;
-        out[1] = dataSize >> 16;
-        out[2] = dataSize >>  8;
-        out[3] = dataSize;
+        out[0] = (uint8_t)(dataSize >> 24);
+        out[1] = (uint8_t)(dataSize >> 16);
+        out[2] = (uint8_t)(dataSize >> 8);
+        out[3] = (uint8_t)dataSize;
     }
 
     m_occupancy += bytes;
diff -r a6c7cf774564 -r 4cccf22b00ee source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp	Fri Apr 10 18:35:23 2015 +0530
+++ b/source/encoder/slicetype.cpp	Fri Apr 10 18:15:38 2015 -0500
@@ -566,7 +566,7 @@ bool Lookahead::create()
     return m_tld && m_scratch;
 }
 
-void Lookahead::stop()
+void Lookahead::stopJobs()
 {
     if (m_pool && !m_inputQueue.empty())
     {
diff -r a6c7cf774564 -r 4cccf22b00ee source/encoder/slicetype.h
--- a/source/encoder/slicetype.h	Fri Apr 10 18:35:23 2015 +0530
+++ b/source/encoder/slicetype.h	Fri Apr 10 18:15:38 2015 -0500
@@ -140,7 +140,7 @@ public:
 
     bool    create();
     void    destroy();
-    void    stop();
+    void    stopJobs();
 
     void    addPicture(Frame&, int sliceType);
     void    flush();
diff -r a6c7cf774564 -r 4cccf22b00ee source/x265.cpp
--- a/source/x265.cpp	Fri Apr 10 18:35:23 2015 +0530
+++ b/source/x265.cpp	Fri Apr 10 18:15:38 2015 -0500
@@ -72,28 +72,21 @@ struct CLIOptions
     InputFile* input;
     ReconFile* recon;
     OutputFile* output;
+    FILE*       qpfile;
     bool bProgress;
     bool bForceY4m;
     bool bDither;
-
     uint32_t seek;              // number of frames to skip from the beginning
     uint32_t framesToBeEncoded; // number of frames to encode
     uint64_t totalbytes;
-    size_t   analysisRecordSize; // number of bytes read from or dumped into file
-    int      analysisHeaderSize;
-
     int64_t startTime;
     int64_t prevUpdateTime;
-    float   frameRate;
-    FILE*   qpfile;
-    FILE*   analysisFile;
 
     /* in microseconds */
     static const int UPDATE_INTERVAL = 250000;
 
     CLIOptions()
     {
-        frameRate = 0.f;
         input = NULL;
         recon = NULL;
         output = NULL;
@@ -105,9 +98,6 @@ struct CLIOptions
         prevUpdateTime = 0;
         bDither = false;
         qpfile = NULL;
-        analysisFile = NULL;
-        analysisRecordSize = 0;
-        analysisHeaderSize = 0;
     }
 
     void destroy();
@@ -128,9 +118,6 @@ void CLIOptions::destroy()
     if (qpfile)
         fclose(qpfile);
     qpfile = NULL;
-    if (analysisFile)
-        fclose(analysisFile);
-    analysisFile = NULL;
     if (output)
         output->release();
     output = NULL;
@@ -207,9 +194,7 @@ bool CLIOptions::parse(int argc, char **
         int long_options_index = -1;
         int c = getopt_long(argc, argv, short_options, long_options, &long_options_index);
         if (c == -1)
-        {
             break;
-        }
 
         switch (c)
         {
@@ -272,7 +257,7 @@ bool CLIOptions::parse(int argc, char **
                 this->qpfile = fopen(optarg, "rb");
                 if (!this->qpfile)
                 {
-                    x265_log(param, X265_LOG_ERROR, "%s qpfile not found or error in opening qp file \n", optarg);
+                    x265_log(param, X265_LOG_ERROR, "%s qpfile not found or error in opening qp file\n", optarg);
                     return false;
                 }
             }


More information about the x265-commits mailing list