summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-12-18 16:44:26 -0800
committerLei Zhang <thestig@chromium.org>2015-12-18 16:44:26 -0800
commit9c061e2dfb22a0e321728b73c8650eded8828d90 (patch)
tree02d01154449d24f5cb4ac7dadc4f2b24ba4f2133 /core
parentd866ab0b44a571c884fdd8ba5a5319adaf607559 (diff)
downloadpdfium-chromium/2598.tar.xz
Cleanup CJBig2_HuffmanTable and friends.chromium/2599chromium/2598chromium/2597
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1536923002 .
Diffstat (limited to 'core')
-rw-r--r--core/src/fxcodec/jbig2/JBig2_Context.cpp33
-rw-r--r--core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp27
-rw-r--r--core/src/fxcodec/jbig2/JBig2_HuffmanTable.cpp162
-rw-r--r--core/src/fxcodec/jbig2/JBig2_HuffmanTable.h51
-rw-r--r--core/src/fxcodec/jbig2/JBig2_HuffmanTable_Standard.h37
-rw-r--r--core/src/fxcodec/jbig2/JBig2_SddProc.cpp19
6 files changed, 152 insertions, 177 deletions
diff --git a/core/src/fxcodec/jbig2/JBig2_Context.cpp b/core/src/fxcodec/jbig2/JBig2_Context.cpp
index 1cc8fbde24..2a28185d88 100644
--- a/core/src/fxcodec/jbig2/JBig2_Context.cpp
+++ b/core/src/fxcodec/jbig2/JBig2_Context.cpp
@@ -4,17 +4,21 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "JBig2_Context.h"
+#include "core/src/fxcodec/jbig2/JBig2_Context.h"
+#include <algorithm>
#include <list>
-
-#include "JBig2_ArithDecoder.h"
-#include "JBig2_GrdProc.h"
-#include "JBig2_GrrdProc.h"
-#include "JBig2_HtrdProc.h"
-#include "JBig2_PddProc.h"
-#include "JBig2_SddProc.h"
-#include "JBig2_TrdProc.h"
+#include <vector>
+
+#include "core/src/fxcodec/jbig2/JBig2_ArithDecoder.h"
+#include "core/src/fxcodec/jbig2/JBig2_BitStream.h"
+#include "core/src/fxcodec/jbig2/JBig2_GrdProc.h"
+#include "core/src/fxcodec/jbig2/JBig2_GrrdProc.h"
+#include "core/src/fxcodec/jbig2/JBig2_HtrdProc.h"
+#include "core/src/fxcodec/jbig2/JBig2_HuffmanTable_Standard.h"
+#include "core/src/fxcodec/jbig2/JBig2_PddProc.h"
+#include "core/src/fxcodec/jbig2/JBig2_SddProc.h"
+#include "core/src/fxcodec/jbig2/JBig2_TrdProc.h"
namespace {
@@ -1262,12 +1266,13 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) {
int32_t CJBig2_Context::parseTable(CJBig2_Segment* pSegment) {
pSegment->m_nResultType = JBIG2_HUFFMAN_TABLE_POINTER;
- pSegment->m_Result.ht = new CJBig2_HuffmanTable(m_pStream.get());
- if (!pSegment->m_Result.ht->isOK()) {
- delete pSegment->m_Result.ht;
- pSegment->m_Result.ht = NULL;
+ pSegment->m_Result.ht = nullptr;
+ nonstd::unique_ptr<CJBig2_HuffmanTable> pHuff(
+ new CJBig2_HuffmanTable(m_pStream.get()));
+ if (!pHuff->IsOK())
return JBIG2_ERROR_FATAL;
- }
+
+ pSegment->m_Result.ht = pHuff.release();
m_pStream->alignByte();
return JBIG2_SUCCESS;
}
diff --git a/core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp b/core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp
index cbbe6af70e..4cbecd017a 100644
--- a/core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp
+++ b/core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp
@@ -21,33 +21,26 @@ int CJBig2_HuffmanDecoder::decodeAValue(CJBig2_HuffmanTable* pTable,
while (1) {
FX_DWORD nTmp;
if (m_pStream->read1Bit(&nTmp) == -1)
- return -1;
+ break;
nVal = (nVal << 1) | nTmp;
++nBits;
- for (FX_DWORD i = 0; i < pTable->NTEMP; ++i) {
- if ((pTable->PREFLEN[i] == nBits) && (pTable->CODES[i] == nVal)) {
- if ((pTable->HTOOB == 1) && (i == pTable->NTEMP - 1))
+ for (FX_DWORD i = 0; i < pTable->Size(); ++i) {
+ if (pTable->GetPREFLEN()[i] == nBits && pTable->GetCODES()[i] == nVal) {
+ if (pTable->IsHTOOB() && i == pTable->Size() - 1)
return JBIG2_OOB;
- if (m_pStream->readNBits(pTable->RANGELEN[i], &nTmp) == -1)
+ if (m_pStream->readNBits(pTable->GetRANGELEN()[i], &nTmp) == -1)
return -1;
- if (pTable->HTOOB) {
- if (i == pTable->NTEMP - 3)
- *nResult = pTable->RANGELOW[i] - nTmp;
- else
- *nResult = pTable->RANGELOW[i] + nTmp;
- return 0;
- }
-
- if (i == pTable->NTEMP - 2)
- *nResult = pTable->RANGELOW[i] - nTmp;
+ FX_DWORD offset = pTable->IsHTOOB() ? 3 : 2;
+ if (i == pTable->Size() - offset)
+ *nResult = pTable->GetRANGELOW()[i] - nTmp;
else
- *nResult = pTable->RANGELOW[i] + nTmp;
+ *nResult = pTable->GetRANGELOW()[i] + nTmp;
return 0;
}
}
}
- return -2;
+ return -1;
}
diff --git a/core/src/fxcodec/jbig2/JBig2_HuffmanTable.cpp b/core/src/fxcodec/jbig2/JBig2_HuffmanTable.cpp
index 8aaebf46a2..5833f118fe 100644
--- a/core/src/fxcodec/jbig2/JBig2_HuffmanTable.cpp
+++ b/core/src/fxcodec/jbig2/JBig2_HuffmanTable.cpp
@@ -4,107 +4,56 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "JBig2_HuffmanTable.h"
-
-#include <string.h>
+#include "core/src/fxcodec/jbig2/JBig2_HuffmanTable.h"
+#include <algorithm>
#include <vector>
-#include "JBig2_BitStream.h"
-#include "JBig2_Define.h"
#include "core/include/fxcrt/fx_memory.h"
+#include "core/src/fxcodec/jbig2/JBig2_BitStream.h"
+#include "core/src/fxcodec/jbig2/JBig2_Define.h"
+#include "core/src/fxcodec/jbig2/JBig2_HuffmanTable_Standard.h"
CJBig2_HuffmanTable::CJBig2_HuffmanTable(const JBig2TableLine* pTable,
- int nLines,
- FX_BOOL bHTOOB) {
- init();
- m_bOK = parseFromStandardTable(pTable, nLines, bHTOOB);
+ FX_DWORD nLines,
+ bool bHTOOB)
+ : m_bOK(true), HTOOB(bHTOOB), NTEMP(nLines) {
+ ParseFromStandardTable(pTable);
}
-CJBig2_HuffmanTable::CJBig2_HuffmanTable(CJBig2_BitStream* pStream) {
- init();
- m_bOK = parseFromCodedBuffer(pStream);
+CJBig2_HuffmanTable::CJBig2_HuffmanTable(CJBig2_BitStream* pStream)
+ : HTOOB(false), NTEMP(0) {
+ m_bOK = ParseFromCodedBuffer(pStream);
}
CJBig2_HuffmanTable::~CJBig2_HuffmanTable() {
- FX_Free(CODES);
- FX_Free(PREFLEN);
- FX_Free(RANGELEN);
- FX_Free(RANGELOW);
-}
-void CJBig2_HuffmanTable::init() {
- HTOOB = FALSE;
- NTEMP = 0;
- CODES = nullptr;
- PREFLEN = nullptr;
- RANGELEN = nullptr;
- RANGELOW = nullptr;
}
-int CJBig2_HuffmanTable::parseFromStandardTable(const JBig2TableLine* pTable,
- int nLines,
- FX_BOOL bHTOOB) {
- HTOOB = bHTOOB;
- NTEMP = nLines;
- CODES = FX_Alloc(int, NTEMP);
- PREFLEN = FX_Alloc(int, NTEMP);
- RANGELEN = FX_Alloc(int, NTEMP);
- RANGELOW = FX_Alloc(int, NTEMP);
- int LENMAX = 0;
+
+void CJBig2_HuffmanTable::ParseFromStandardTable(const JBig2TableLine* pTable) {
+ PREFLEN.resize(NTEMP);
+ RANGELEN.resize(NTEMP);
+ RANGELOW.resize(NTEMP);
for (FX_DWORD i = 0; i < NTEMP; ++i) {
PREFLEN[i] = pTable[i].PREFLEN;
RANGELEN[i] = pTable[i].RANDELEN;
RANGELOW[i] = pTable[i].RANGELOW;
- if (PREFLEN[i] > LENMAX) {
- LENMAX = PREFLEN[i];
- }
}
- int* LENCOUNT = FX_Alloc(int, LENMAX + 1);
- JBIG2_memset(LENCOUNT, 0, sizeof(int) * (LENMAX + 1));
- int* FIRSTCODE = FX_Alloc(int, LENMAX + 1);
- for (FX_DWORD i = 0; i < NTEMP; ++i)
- ++LENCOUNT[PREFLEN[i]];
-
- int CURLEN = 1;
- FIRSTCODE[0] = 0;
- LENCOUNT[0] = 0;
- while (CURLEN <= LENMAX) {
- FIRSTCODE[CURLEN] = (FIRSTCODE[CURLEN - 1] + LENCOUNT[CURLEN - 1]) << 1;
- int CURCODE = FIRSTCODE[CURLEN];
- FX_DWORD CURTEMP = 0;
- while (CURTEMP < NTEMP) {
- if (PREFLEN[CURTEMP] == CURLEN) {
- CODES[CURTEMP] = CURCODE;
- CURCODE = CURCODE + 1;
- }
- CURTEMP = CURTEMP + 1;
- }
- CURLEN = CURLEN + 1;
- }
- FX_Free(LENCOUNT);
- FX_Free(FIRSTCODE);
- return 1;
+ InitCodes();
}
-#define HT_CHECK_MEMORY_ADJUST \
- if (NTEMP >= nSize) { \
- nSize += 16; \
- PREFLEN = FX_Realloc(int, PREFLEN, nSize); \
- RANGELEN = FX_Realloc(int, RANGELEN, nSize); \
- RANGELOW = FX_Realloc(int, RANGELOW, nSize); \
- }
-int CJBig2_HuffmanTable::parseFromCodedBuffer(CJBig2_BitStream* pStream) {
+bool CJBig2_HuffmanTable::ParseFromCodedBuffer(CJBig2_BitStream* pStream) {
unsigned char cTemp;
if (pStream->read1Byte(&cTemp) == -1)
- return FALSE;
+ return false;
- HTOOB = cTemp & 0x01;
+ HTOOB = !!(cTemp & 0x01);
unsigned char HTPS = ((cTemp >> 1) & 0x07) + 1;
unsigned char HTRS = ((cTemp >> 4) & 0x07) + 1;
FX_DWORD HTLOW;
FX_DWORD HTHIGH;
if (pStream->readInteger(&HTLOW) == -1 ||
pStream->readInteger(&HTHIGH) == -1) {
- return FALSE;
+ return false;
}
const int low = static_cast<int>(HTLOW);
@@ -112,56 +61,57 @@ int CJBig2_HuffmanTable::parseFromCodedBuffer(CJBig2_BitStream* pStream) {
if (low > high)
return false;
- FX_DWORD nSize = 16;
- PREFLEN = FX_Alloc(int, nSize);
- RANGELEN = FX_Alloc(int, nSize);
- RANGELOW = FX_Alloc(int, nSize);
+ ExtendBuffers(false);
int cur_low = low;
- NTEMP = 0;
do {
- HT_CHECK_MEMORY_ADJUST
if ((pStream->readNBits(HTPS, &PREFLEN[NTEMP]) == -1) ||
(pStream->readNBits(HTRS, &RANGELEN[NTEMP]) == -1)) {
- return FALSE;
+ return false;
}
RANGELOW[NTEMP] = cur_low;
cur_low += (1 << RANGELEN[NTEMP]);
- NTEMP = NTEMP + 1;
+ ExtendBuffers(true);
} while (cur_low < high);
- HT_CHECK_MEMORY_ADJUST
+
if (pStream->readNBits(HTPS, &PREFLEN[NTEMP]) == -1)
- return FALSE;
+ return false;
RANGELEN[NTEMP] = 32;
RANGELOW[NTEMP] = low - 1;
- ++NTEMP;
- HT_CHECK_MEMORY_ADJUST
+ ExtendBuffers(true);
+
if (pStream->readNBits(HTPS, &PREFLEN[NTEMP]) == -1)
- return FALSE;
+ return false;
RANGELEN[NTEMP] = 32;
RANGELOW[NTEMP] = high;
- NTEMP = NTEMP + 1;
+ ExtendBuffers(true);
+
if (HTOOB) {
- HT_CHECK_MEMORY_ADJUST
if (pStream->readNBits(HTPS, &PREFLEN[NTEMP]) == -1)
- return FALSE;
+ return false;
++NTEMP;
}
- CODES = FX_Alloc(int, NTEMP);
- int LENMAX = 0;
- for (FX_DWORD i = 0; i < NTEMP; ++i)
- LENMAX = std::max(PREFLEN[i], LENMAX);
- std::vector<int> LENCOUNT(LENMAX + 1);
+ InitCodes();
+ return true;
+}
+
+void CJBig2_HuffmanTable::InitCodes() {
+ int lenmax = 0;
for (FX_DWORD i = 0; i < NTEMP; ++i)
- LENCOUNT[PREFLEN[i]]++;
- LENCOUNT[0] = 0;
+ lenmax = std::max(PREFLEN[i], lenmax);
+
+ CODES.resize(NTEMP);
+ std::vector<int> LENCOUNT(lenmax + 1);
+ std::vector<int> FIRSTCODE(lenmax + 1);
+ for (int len : PREFLEN)
+ ++LENCOUNT[len];
- std::vector<int> FIRSTCODE(LENMAX + 1);
FIRSTCODE[0] = 0;
- for (int i = 1; i <= LENMAX; ++i) {
+ LENCOUNT[0] = 0;
+ for (int i = 1; i <= lenmax; ++i) {
FIRSTCODE[i] = (FIRSTCODE[i - 1] + LENCOUNT[i - 1]) << 1;
int CURCODE = FIRSTCODE[i];
for (FX_DWORD j = 0; j < NTEMP; ++j) {
@@ -169,5 +119,19 @@ int CJBig2_HuffmanTable::parseFromCodedBuffer(CJBig2_BitStream* pStream) {
CODES[j] = CURCODE++;
}
}
- return TRUE;
+}
+
+void CJBig2_HuffmanTable::ExtendBuffers(bool increment) {
+ if (increment)
+ ++NTEMP;
+
+ size_t size = PREFLEN.size();
+ if (NTEMP < size)
+ return;
+
+ size += 16;
+ ASSERT(NTEMP < size);
+ PREFLEN.resize(size);
+ RANGELEN.resize(size);
+ RANGELOW.resize(size);
}
diff --git a/core/src/fxcodec/jbig2/JBig2_HuffmanTable.h b/core/src/fxcodec/jbig2/JBig2_HuffmanTable.h
index fe8294dc7e..568c497350 100644
--- a/core/src/fxcodec/jbig2/JBig2_HuffmanTable.h
+++ b/core/src/fxcodec/jbig2/JBig2_HuffmanTable.h
@@ -4,38 +4,47 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef _JBIG2_HUFFMAN_TABLE_H_
-#define _JBIG2_HUFFMAN_TABLE_H_
+#ifndef CORE_SRC_FXCODEC_JBIG2_JBIG2_HUFFMANTABLE_H_
+#define CORE_SRC_FXCODEC_JBIG2_JBIG2_HUFFMANTABLE_H_
-#include "JBig2_HuffmanTable_Standard.h"
-#include "JBig2_BitStream.h"
+#include <vector>
+
+#include "core/include/fxcrt/fx_system.h"
+
+class CJBig2_BitStream;
+struct JBig2TableLine;
class CJBig2_HuffmanTable {
public:
- CJBig2_HuffmanTable(const JBig2TableLine* pTable, int nLines, FX_BOOL bHTOOB);
+ CJBig2_HuffmanTable(const JBig2TableLine* pTable,
+ FX_DWORD nLines,
+ bool bHTOOB);
explicit CJBig2_HuffmanTable(CJBig2_BitStream* pStream);
~CJBig2_HuffmanTable();
- int parseFromStandardTable(const JBig2TableLine* pTable,
- int nLines,
- FX_BOOL bHTOOB);
-
- int parseFromCodedBuffer(CJBig2_BitStream* pStream);
-
- FX_BOOL isOK() const { return m_bOK; }
+ bool IsHTOOB() const { return HTOOB; }
+ FX_DWORD Size() const { return NTEMP; }
+ const std::vector<int>& GetCODES() const { return CODES; }
+ const std::vector<int>& GetPREFLEN() const { return PREFLEN; }
+ const std::vector<int>& GetRANGELEN() const { return RANGELEN; }
+ const std::vector<int>& GetRANGELOW() const { return RANGELOW; }
+ bool IsOK() const { return m_bOK; }
private:
- void init();
+ void ParseFromStandardTable(const JBig2TableLine* pTable);
+ bool ParseFromCodedBuffer(CJBig2_BitStream* pStream);
+ void InitCodes();
+ void ExtendBuffers(bool increment);
- FX_BOOL HTOOB;
+ bool m_bOK;
+ bool HTOOB;
FX_DWORD NTEMP;
- int* CODES;
- int* PREFLEN;
- int* RANGELEN;
- int* RANGELOW;
- FX_BOOL m_bOK;
- friend class CJBig2_HuffmanDecoder;
+ std::vector<int> CODES;
+ std::vector<int> PREFLEN;
+ std::vector<int> RANGELEN;
+ std::vector<int> RANGELOW;
};
-#endif
+
+#endif // CORE_SRC_FXCODEC_JBIG2_JBIG2_HUFFMANTABLE_H_
diff --git a/core/src/fxcodec/jbig2/JBig2_HuffmanTable_Standard.h b/core/src/fxcodec/jbig2/JBig2_HuffmanTable_Standard.h
index e4c3265673..a2ce232d63 100644
--- a/core/src/fxcodec/jbig2/JBig2_HuffmanTable_Standard.h
+++ b/core/src/fxcodec/jbig2/JBig2_HuffmanTable_Standard.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef _JBIG2_HUFFMAN_TABLE_STANDARD_H_
-#define _JBIG2_HUFFMAN_TABLE_STANDARD_H_
+#ifndef CORE_SRC_FXCODEC_JBIG2_JBIG2_HUFFMANTABLE_STANDARD_H_
+#define CORE_SRC_FXCODEC_JBIG2_JBIG2_HUFFMANTABLE_STANDARD_H_
#include "core/include/fxcrt/fx_system.h"
@@ -15,83 +15,84 @@ struct JBig2TableLine {
int RANGELOW;
};
-const FX_BOOL HuffmanTable_HTOOB_B1 = FALSE;
+const bool HuffmanTable_HTOOB_B1 = false;
const JBig2TableLine HuffmanTable_B1[] = {{1, 4, 0},
{2, 8, 16},
{3, 16, 272},
{0, 32, -1},
{3, 32, 65808}};
-const FX_BOOL HuffmanTable_HTOOB_B2 = TRUE;
+const bool HuffmanTable_HTOOB_B2 = true;
const JBig2TableLine HuffmanTable_B2[] = {{1, 0, 0}, {2, 0, 1}, {3, 0, 2},
{4, 3, 3}, {5, 6, 11}, {0, 32, -1},
{6, 32, 75}, {6, 0, 0}};
-const FX_BOOL HuffmanTable_HTOOB_B3 = TRUE;
+const bool HuffmanTable_HTOOB_B3 = true;
const JBig2TableLine HuffmanTable_B3[] = {
{8, 8, -256}, {1, 0, 0}, {2, 0, 1}, {3, 0, 2}, {4, 3, 3},
{5, 6, 11}, {8, 32, -257}, {7, 32, 75}, {6, 0, 0}};
-const FX_BOOL HuffmanTable_HTOOB_B4 = FALSE;
+const bool HuffmanTable_HTOOB_B4 = false;
const JBig2TableLine HuffmanTable_B4[] = {
{1, 0, 1}, {2, 0, 2}, {3, 0, 3}, {4, 3, 4},
{5, 6, 12}, {0, 32, -1}, {5, 32, 76},
};
-const FX_BOOL HuffmanTable_HTOOB_B5 = FALSE;
+const bool HuffmanTable_HTOOB_B5 = false;
const JBig2TableLine HuffmanTable_B5[] = {{7, 8, -255}, {1, 0, 1}, {2, 0, 2},
{3, 0, 3}, {4, 3, 4}, {5, 6, 12},
{7, 32, -256}, {6, 32, 76}};
-const FX_BOOL HuffmanTable_HTOOB_B6 = FALSE;
+const bool HuffmanTable_HTOOB_B6 = false;
const JBig2TableLine HuffmanTable_B6[] = {
{5, 10, -2048}, {4, 9, -1024}, {4, 8, -512}, {4, 7, -256}, {5, 6, -128},
{5, 5, -64}, {4, 5, -32}, {2, 7, 0}, {3, 7, 128}, {3, 8, 256},
{4, 9, 512}, {4, 10, 1024}, {6, 32, -2049}, {6, 32, 2048}};
-const FX_BOOL HuffmanTable_HTOOB_B7 = FALSE;
+const bool HuffmanTable_HTOOB_B7 = false;
const JBig2TableLine HuffmanTable_B7[] = {
{4, 9, -1024}, {3, 8, -512}, {4, 7, -256}, {5, 6, -128}, {5, 5, -64},
{4, 5, -32}, {4, 5, 0}, {5, 5, 32}, {5, 6, 64}, {4, 7, 128},
{3, 8, 256}, {3, 9, 512}, {3, 10, 1024}, {5, 32, -1025}, {5, 32, 2048},
};
-const FX_BOOL HuffmanTable_HTOOB_B8 = TRUE;
+const bool HuffmanTable_HTOOB_B8 = true;
const JBig2TableLine HuffmanTable_B8[] = {
{8, 3, -15}, {9, 1, -7}, {8, 1, -5}, {9, 0, -3}, {7, 0, -2},
{4, 0, -1}, {2, 1, 0}, {5, 0, 2}, {6, 0, 3}, {3, 4, 4},
{6, 1, 20}, {4, 4, 22}, {4, 5, 38}, {5, 6, 70}, {5, 7, 134},
{6, 7, 262}, {7, 8, 390}, {6, 10, 646}, {9, 32, -16}, {9, 32, 1670},
{2, 0, 0}};
-const FX_BOOL HuffmanTable_HTOOB_B9 = TRUE;
+const bool HuffmanTable_HTOOB_B9 = true;
const JBig2TableLine HuffmanTable_B9[] = {
{8, 4, -31}, {9, 2, -15}, {8, 2, -11}, {9, 1, -7}, {7, 1, -5},
{4, 1, -3}, {3, 1, -1}, {3, 1, 1}, {5, 1, 3}, {6, 1, 5},
{3, 5, 7}, {6, 2, 39}, {4, 5, 43}, {4, 6, 75}, {5, 7, 139},
{5, 8, 267}, {6, 8, 523}, {7, 9, 779}, {6, 11, 1291}, {9, 32, -32},
{9, 32, 3339}, {2, 0, 0}};
-const FX_BOOL HuffmanTable_HTOOB_B10 = TRUE;
+const bool HuffmanTable_HTOOB_B10 = true;
const JBig2TableLine HuffmanTable_B10[] = {
{7, 4, -21}, {8, 0, -5}, {7, 0, -4}, {5, 0, -3}, {2, 2, -2},
{5, 0, 2}, {6, 0, 3}, {7, 0, 4}, {8, 0, 5}, {2, 6, 6},
{5, 5, 70}, {6, 5, 102}, {6, 6, 134}, {6, 7, 198}, {6, 8, 326},
{6, 9, 582}, {6, 10, 1094}, {7, 11, 2118}, {8, 32, -22}, {8, 32, 4166},
{2, 0, 0}};
-const FX_BOOL HuffmanTable_HTOOB_B11 = FALSE;
+const bool HuffmanTable_HTOOB_B11 = false;
const JBig2TableLine HuffmanTable_B11[] = {
{1, 0, 1}, {2, 1, 2}, {4, 0, 4}, {4, 1, 5}, {5, 1, 7},
{5, 2, 9}, {6, 2, 13}, {7, 2, 17}, {7, 3, 21}, {7, 4, 29},
{7, 5, 45}, {7, 6, 77}, {0, 32, 0}, {7, 32, 141}};
-const FX_BOOL HuffmanTable_HTOOB_B12 = FALSE;
+const bool HuffmanTable_HTOOB_B12 = false;
const JBig2TableLine HuffmanTable_B12[] = {
{1, 0, 1}, {2, 0, 2}, {3, 1, 3}, {5, 0, 5}, {5, 1, 6},
{6, 1, 8}, {7, 0, 10}, {7, 1, 11}, {7, 2, 13}, {7, 3, 17},
{7, 4, 25}, {8, 5, 41}, {0, 32, 0}, {8, 32, 73}};
-const FX_BOOL HuffmanTable_HTOOB_B13 = FALSE;
+const bool HuffmanTable_HTOOB_B13 = false;
const JBig2TableLine HuffmanTable_B13[] = {
{1, 0, 1}, {3, 0, 2}, {4, 0, 3}, {5, 0, 4}, {4, 1, 5},
{3, 3, 7}, {6, 1, 15}, {6, 2, 17}, {6, 3, 21}, {6, 4, 29},
{6, 5, 45}, {7, 6, 77}, {0, 32, 0}, {7, 32, 141}};
-const FX_BOOL HuffmanTable_HTOOB_B14 = FALSE;
+const bool HuffmanTable_HTOOB_B14 = false;
const JBig2TableLine HuffmanTable_B14[] = {{3, 0, -2}, {3, 0, -1}, {1, 0, 0},
{3, 0, 1}, {3, 0, 2}, {0, 32, -3},
{0, 32, 3}};
-const FX_BOOL HuffmanTable_HTOOB_B15 = FALSE;
+const bool HuffmanTable_HTOOB_B15 = false;
const JBig2TableLine HuffmanTable_B15[] = {
{7, 4, -24}, {6, 2, -8}, {5, 1, -4}, {4, 0, -2}, {3, 0, -1},
{1, 0, 0}, {3, 0, 1}, {4, 0, 2}, {5, 1, 3}, {6, 2, 5},
{7, 4, 9}, {7, 32, -25}, {7, 32, 25}};
-#endif
+
+#endif // CORE_SRC_FXCODEC_JBIG2_JBIG2_HUFFMANTABLE_STANDARD_H_
diff --git a/core/src/fxcodec/jbig2/JBig2_SddProc.cpp b/core/src/fxcodec/jbig2/JBig2_SddProc.cpp
index edfc074003..06d6520f3f 100644
--- a/core/src/fxcodec/jbig2/JBig2_SddProc.cpp
+++ b/core/src/fxcodec/jbig2/JBig2_SddProc.cpp
@@ -4,16 +4,19 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "JBig2_SddProc.h"
+#include "core/src/fxcodec/jbig2/JBig2_SddProc.h"
+
+#include <vector>
-#include "JBig2_ArithIntDecoder.h"
-#include "JBig2_GrdProc.h"
-#include "JBig2_GrrdProc.h"
-#include "JBig2_HuffmanDecoder.h"
-#include "JBig2_HuffmanTable.h"
-#include "JBig2_SymbolDict.h"
-#include "JBig2_TrdProc.h"
#include "core/include/fxcrt/fx_basic.h"
+#include "core/src/fxcodec/jbig2/JBig2_ArithIntDecoder.h"
+#include "core/src/fxcodec/jbig2/JBig2_GrdProc.h"
+#include "core/src/fxcodec/jbig2/JBig2_GrrdProc.h"
+#include "core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.h"
+#include "core/src/fxcodec/jbig2/JBig2_HuffmanTable.h"
+#include "core/src/fxcodec/jbig2/JBig2_HuffmanTable_Standard.h"
+#include "core/src/fxcodec/jbig2/JBig2_SymbolDict.h"
+#include "core/src/fxcodec/jbig2/JBig2_TrdProc.h"
#include "third_party/base/nonstd_unique_ptr.h"
#include "third_party/base/stl_util.h"