[x265] [PATCH 1 of 2] entropy: make copy methods properly const

Steve Borho steve at borho.org
Sun Oct 5 18:10:18 CEST 2014


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1412522905 18000
#      Sun Oct 05 10:28:25 2014 -0500
# Node ID 6f5e14b8c57b5d252f844eecf3ab5d0b11b1f4fd
# Parent  45ef431c14907e1b75a978a5ce48006a6342c767
entropy: make copy methods properly const

diff -r 45ef431c1490 -r 6f5e14b8c57b source/encoder/entropy.cpp
--- a/source/encoder/entropy.cpp	Sat Oct 04 21:01:56 2014 -0500
+++ b/source/encoder/entropy.cpp	Sun Oct 05 10:28:25 2014 -0500
@@ -1148,7 +1148,7 @@
     ::memcpy(&m_contextState[OFF_ADI_CTX], &src.m_contextState[OFF_ADI_CTX], sizeof(uint8_t) * NUM_ADI_CTX);
 }
 
-void Entropy::copyFrom(Entropy& src)
+void Entropy::copyFrom(const Entropy& src)
 {
     copyState(src);
 
@@ -1923,7 +1923,7 @@
 }
 
 /* Initialize our context information from the nominated source */
-void Entropy::copyContextsFrom(Entropy& src)
+void Entropy::copyContextsFrom(const Entropy& src)
 {
     memcpy(m_contextState, src.m_contextState, MAX_OFF_CTX_MOD * sizeof(m_contextState[0]));
 }
@@ -1964,7 +1964,7 @@
     m_bitIf->write(m_low >> 8, 13 + m_bitsLeft);
 }
 
-void Entropy::copyState(Entropy& other)
+void Entropy::copyState(const Entropy& other)
 {
     m_low = other.m_low;
     m_range = other.m_range;
diff -r 45ef431c1490 -r 6f5e14b8c57b source/encoder/entropy.h
--- a/source/encoder/entropy.h	Sat Oct 04 21:01:56 2014 -0500
+++ b/source/encoder/entropy.h	Sun Oct 05 10:28:25 2014 -0500
@@ -129,12 +129,11 @@
     void resetEntropy(Slice *slice);
 
     // SBAC RD
-    void load(Entropy& src)            { copyFrom(src); }
-
+    void load(const Entropy& src)            { copyFrom(src); }
     void loadIntraDirModeLuma(Entropy& src);
-    void store(Entropy& dest)          { dest.copyFrom(*this); }
-    void loadContexts(Entropy& src)    { copyContextsFrom(src); }
-    void copyState(Entropy& other);
+    void store(Entropy& dest) const          { dest.copyFrom(*this); }
+    void loadContexts(const Entropy& src)    { copyContextsFrom(src); }
+    void copyState(const Entropy& other);
 
     void codeVPS(VPS* vps);
     void codeSPS(SPS* sps, ScalingList *scalingList, ProfileTierLevel *ptl);
@@ -233,8 +232,8 @@
     void encodeTransform(TComDataCU* cu, CoeffCodeState& state, uint32_t offsetLumaOffset, uint32_t offsetChroma, 
                          uint32_t absPartIdx, uint32_t absPartIdxStep, uint32_t depth, uint32_t log2TrSize, uint32_t uiTrIdx, bool& bCodeDQP, uint32_t* depthRange);
 
-    void copyFrom(Entropy& src);
-    void copyContextsFrom(Entropy& src);
+    void copyFrom(const Entropy& src);
+    void copyContextsFrom(const Entropy& src);
 };
 }
 


More information about the x265-devel mailing list