diff options
Diffstat (limited to 'core/fxcodec/jbig2')
-rw-r--r-- | core/fxcodec/jbig2/JBig2_Context.cpp | 12 | ||||
-rw-r--r-- | core/fxcodec/jbig2/JBig2_GrdProc.cpp | 198 | ||||
-rw-r--r-- | core/fxcodec/jbig2/JBig2_GrrdProc.cpp | 188 | ||||
-rw-r--r-- | core/fxcodec/jbig2/JBig2_HtrdProc.cpp | 8 | ||||
-rw-r--r-- | core/fxcodec/jbig2/JBig2_Image.cpp | 14 | ||||
-rw-r--r-- | core/fxcodec/jbig2/JBig2_Image.h | 13 | ||||
-rw-r--r-- | core/fxcodec/jbig2/JBig2_Image_unittest.cpp | 60 | ||||
-rw-r--r-- | core/fxcodec/jbig2/JBig2_PddProc.cpp | 4 | ||||
-rw-r--r-- | core/fxcodec/jbig2/JBig2_SddProc.cpp | 2 | ||||
-rw-r--r-- | core/fxcodec/jbig2/JBig2_TrdProc.cpp | 4 |
10 files changed, 248 insertions, 255 deletions
diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp index f49276444f..5a10cc39a4 100644 --- a/core/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/fxcodec/jbig2/JBig2_Context.cpp @@ -383,7 +383,7 @@ JBig2_Result CJBig2_Context::ProcessingParseSegmentData( return JBig2_Result::kFailure; } - m_pPage->fill((pPageInfo->m_cFlags & 4) ? 1 : 0); + m_pPage->Fill((pPageInfo->m_cFlags & 4) ? 1 : 0); m_PageInfoList.push_back(std::move(pPageInfo)); m_bInPage = true; } break; @@ -901,7 +901,7 @@ JBig2_Result CJBig2_Context::ParseTextRegion(CJBig2_Segment* pSegment) { const auto& pPageInfo = m_PageInfoList.back(); if ((pPageInfo->m_bIsStriped == 1) && (ri.y + ri.height > m_pPage->height())) { - m_pPage->expand(ri.y + ri.height, (pPageInfo->m_cFlags & 4) ? 1 : 0); + m_pPage->Expand(ri.y + ri.height, (pPageInfo->m_cFlags & 4) ? 1 : 0); } } m_pPage->ComposeFrom(ri.x, ri.y, pSegment->m_Image.get(), @@ -1021,7 +1021,7 @@ JBig2_Result CJBig2_Context::ParseHalftoneRegion(CJBig2_Segment* pSegment, const auto& pPageInfo = m_PageInfoList.back(); if (pPageInfo->m_bIsStriped == 1 && ri.y + ri.height > m_pPage->height()) { - m_pPage->expand(ri.y + ri.height, (pPageInfo->m_cFlags & 4) ? 1 : 0); + m_pPage->Expand(ri.y + ri.height, (pPageInfo->m_cFlags & 4) ? 1 : 0); } } m_pPage->ComposeFrom(ri.x, ri.y, pSegment->m_Image.get(), @@ -1086,7 +1086,7 @@ JBig2_Result CJBig2_Context::ParseGenericRegion(CJBig2_Segment* pSegment, const auto& pPageInfo = m_PageInfoList.back(); if ((pPageInfo->m_bIsStriped == 1) && (m_ri.y + m_ri.height > m_pPage->height())) { - m_pPage->expand(m_ri.y + m_ri.height, + m_pPage->Expand(m_ri.y + m_ri.height, (pPageInfo->m_cFlags & 4) ? 1 : 0); } } @@ -1119,7 +1119,7 @@ JBig2_Result CJBig2_Context::ParseGenericRegion(CJBig2_Segment* pSegment, JBig2PageInfo* pPageInfo = m_PageInfoList.back().get(); if ((pPageInfo->m_bIsStriped == 1) && (m_ri.y + m_ri.height > m_pPage->height())) { - m_pPage->expand(m_ri.y + m_ri.height, + m_pPage->Expand(m_ri.y + m_ri.height, (pPageInfo->m_cFlags & 4) ? 1 : 0); } } @@ -1194,7 +1194,7 @@ JBig2_Result CJBig2_Context::ParseGenericRefinementRegion( JBig2PageInfo* pPageInfo = m_PageInfoList.back().get(); if ((pPageInfo->m_bIsStriped == 1) && (ri.y + ri.height > m_pPage->height())) { - m_pPage->expand(ri.y + ri.height, (pPageInfo->m_cFlags & 4) ? 1 : 0); + m_pPage->Expand(ri.y + ri.height, (pPageInfo->m_cFlags & 4) ? 1 : 0); } } m_pPage->ComposeFrom(ri.x, ri.y, pSegment->m_Image.get(), diff --git a/core/fxcodec/jbig2/JBig2_GrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrdProc.cpp index 215d6fe6cf..054bfc5c15 100644 --- a/core/fxcodec/jbig2/JBig2_GrdProc.cpp +++ b/core/fxcodec/jbig2/JBig2_GrdProc.cpp @@ -87,7 +87,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate0Opt3( LTP = LTP ^ pArithDecoder->Decode(&gbContext[0x9b25]); } if (LTP) { - GBREG->copyLine(h, h - 1); + GBREG->CopyLine(h, h - 1); } else { if (h > 1) { uint8_t* pLine1 = pLine - nStride2; @@ -170,7 +170,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate0Unopt( if (!GBREG->data()) return nullptr; - GBREG->fill(0); + GBREG->Fill(0); int LTP = 0; for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { @@ -180,36 +180,36 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate0Unopt( LTP = LTP ^ pArithDecoder->Decode(&gbContext[0x9b25]); } if (LTP) { - GBREG->copyLine(h, h - 1); + GBREG->CopyLine(h, h - 1); } else { - uint32_t line1 = GBREG->getPixel(1, h - 2); - line1 |= GBREG->getPixel(0, h - 2) << 1; - uint32_t line2 = GBREG->getPixel(2, h - 1); - line2 |= GBREG->getPixel(1, h - 1) << 1; - line2 |= GBREG->getPixel(0, h - 1) << 2; + uint32_t line1 = GBREG->GetPixel(1, h - 2); + line1 |= GBREG->GetPixel(0, h - 2) << 1; + uint32_t line2 = GBREG->GetPixel(2, h - 1); + line2 |= GBREG->GetPixel(1, h - 1) << 1; + line2 |= GBREG->GetPixel(0, h - 1) << 2; uint32_t line3 = 0; for (uint32_t w = 0; w < GBW; w++) { int bVal; - if (USESKIP && SKIP->getPixel(w, h)) { + if (USESKIP && SKIP->GetPixel(w, h)) { bVal = 0; } else { uint32_t CONTEXT = line3; - CONTEXT |= GBREG->getPixel(w + GBAT[0], h + GBAT[1]) << 4; + CONTEXT |= GBREG->GetPixel(w + GBAT[0], h + GBAT[1]) << 4; CONTEXT |= line2 << 5; - CONTEXT |= GBREG->getPixel(w + GBAT[2], h + GBAT[3]) << 10; - CONTEXT |= GBREG->getPixel(w + GBAT[4], h + GBAT[5]) << 11; + CONTEXT |= GBREG->GetPixel(w + GBAT[2], h + GBAT[3]) << 10; + CONTEXT |= GBREG->GetPixel(w + GBAT[4], h + GBAT[5]) << 11; CONTEXT |= line1 << 12; - CONTEXT |= GBREG->getPixel(w + GBAT[6], h + GBAT[7]) << 15; + CONTEXT |= GBREG->GetPixel(w + GBAT[6], h + GBAT[7]) << 15; if (pArithDecoder->IsComplete()) return nullptr; bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); } if (bVal) { - GBREG->setPixel(w, h, bVal); + GBREG->SetPixel(w, h, bVal); } - line1 = ((line1 << 1) | GBREG->getPixel(w + 2, h - 2)) & 0x07; - line2 = ((line2 << 1) | GBREG->getPixel(w + 3, h - 1)) & 0x1f; + line1 = ((line1 << 1) | GBREG->GetPixel(w + 2, h - 2)) & 0x07; + line2 = ((line2 << 1) | GBREG->GetPixel(w + 3, h - 1)) & 0x1f; line3 = ((line3 << 1) | bVal) & 0x0f; } } @@ -238,7 +238,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate1Opt3( LTP = LTP ^ pArithDecoder->Decode(&gbContext[0x0795]); } if (LTP) { - GBREG->copyLine(h, h - 1); + GBREG->CopyLine(h, h - 1); } else { if (h > 1) { uint8_t* pLine1 = pLine - nStride2; @@ -321,7 +321,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate1Unopt( if (!GBREG->data()) return nullptr; - GBREG->fill(0); + GBREG->Fill(0); int LTP = 0; for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { @@ -331,22 +331,22 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate1Unopt( LTP = LTP ^ pArithDecoder->Decode(&gbContext[0x0795]); } if (LTP) { - GBREG->copyLine(h, h - 1); + GBREG->CopyLine(h, h - 1); } else { - uint32_t line1 = GBREG->getPixel(2, h - 2); - line1 |= GBREG->getPixel(1, h - 2) << 1; - line1 |= GBREG->getPixel(0, h - 2) << 2; - uint32_t line2 = GBREG->getPixel(2, h - 1); - line2 |= GBREG->getPixel(1, h - 1) << 1; - line2 |= GBREG->getPixel(0, h - 1) << 2; + uint32_t line1 = GBREG->GetPixel(2, h - 2); + line1 |= GBREG->GetPixel(1, h - 2) << 1; + line1 |= GBREG->GetPixel(0, h - 2) << 2; + uint32_t line2 = GBREG->GetPixel(2, h - 1); + line2 |= GBREG->GetPixel(1, h - 1) << 1; + line2 |= GBREG->GetPixel(0, h - 1) << 2; uint32_t line3 = 0; for (uint32_t w = 0; w < GBW; w++) { int bVal; - if (USESKIP && SKIP->getPixel(w, h)) { + if (USESKIP && SKIP->GetPixel(w, h)) { bVal = 0; } else { uint32_t CONTEXT = line3; - CONTEXT |= GBREG->getPixel(w + GBAT[0], h + GBAT[1]) << 3; + CONTEXT |= GBREG->GetPixel(w + GBAT[0], h + GBAT[1]) << 3; CONTEXT |= line2 << 4; CONTEXT |= line1 << 9; if (pArithDecoder->IsComplete()) @@ -355,10 +355,10 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate1Unopt( bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); } if (bVal) { - GBREG->setPixel(w, h, bVal); + GBREG->SetPixel(w, h, bVal); } - line1 = ((line1 << 1) | GBREG->getPixel(w + 3, h - 2)) & 0x0f; - line2 = ((line2 << 1) | GBREG->getPixel(w + 3, h - 1)) & 0x1f; + line1 = ((line1 << 1) | GBREG->GetPixel(w + 3, h - 2)) & 0x0f; + line2 = ((line2 << 1) | GBREG->GetPixel(w + 3, h - 1)) & 0x1f; line3 = ((line3 << 1) | bVal) & 0x07; } } @@ -387,7 +387,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate2Opt3( LTP = LTP ^ pArithDecoder->Decode(&gbContext[0x00e5]); } if (LTP) { - GBREG->copyLine(h, h - 1); + GBREG->CopyLine(h, h - 1); } else { if (h > 1) { uint8_t* pLine1 = pLine - nStride2; @@ -470,7 +470,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate2Unopt( if (!GBREG->data()) return nullptr; - GBREG->fill(0); + GBREG->Fill(0); int LTP = 0; for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { @@ -480,20 +480,20 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate2Unopt( LTP = LTP ^ pArithDecoder->Decode(&gbContext[0x00e5]); } if (LTP) { - GBREG->copyLine(h, h - 1); + GBREG->CopyLine(h, h - 1); } else { - uint32_t line1 = GBREG->getPixel(1, h - 2); - line1 |= GBREG->getPixel(0, h - 2) << 1; - uint32_t line2 = GBREG->getPixel(1, h - 1); - line2 |= GBREG->getPixel(0, h - 1) << 1; + uint32_t line1 = GBREG->GetPixel(1, h - 2); + line1 |= GBREG->GetPixel(0, h - 2) << 1; + uint32_t line2 = GBREG->GetPixel(1, h - 1); + line2 |= GBREG->GetPixel(0, h - 1) << 1; uint32_t line3 = 0; for (uint32_t w = 0; w < GBW; w++) { int bVal; - if (USESKIP && SKIP->getPixel(w, h)) { + if (USESKIP && SKIP->GetPixel(w, h)) { bVal = 0; } else { uint32_t CONTEXT = line3; - CONTEXT |= GBREG->getPixel(w + GBAT[0], h + GBAT[1]) << 2; + CONTEXT |= GBREG->GetPixel(w + GBAT[0], h + GBAT[1]) << 2; CONTEXT |= line2 << 3; CONTEXT |= line1 << 7; if (pArithDecoder->IsComplete()) @@ -502,10 +502,10 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate2Unopt( bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); } if (bVal) { - GBREG->setPixel(w, h, bVal); + GBREG->SetPixel(w, h, bVal); } - line1 = ((line1 << 1) | GBREG->getPixel(w + 2, h - 2)) & 0x07; - line2 = ((line2 << 1) | GBREG->getPixel(w + 2, h - 1)) & 0x0f; + line1 = ((line1 << 1) | GBREG->GetPixel(w + 2, h - 2)) & 0x07; + line2 = ((line2 << 1) | GBREG->GetPixel(w + 2, h - 1)) & 0x0f; line3 = ((line3 << 1) | bVal) & 0x03; } } @@ -535,7 +535,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate3Opt3( } if (LTP) { - GBREG->copyLine(h, h - 1); + GBREG->CopyLine(h, h - 1); } else { if (h > 0) { uint8_t* pLine1 = pLine - nStride; @@ -605,7 +605,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate3Unopt( if (!GBREG->data()) return nullptr; - GBREG->fill(0); + GBREG->Fill(0); int LTP = 0; for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { @@ -615,18 +615,18 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate3Unopt( LTP = LTP ^ pArithDecoder->Decode(&gbContext[0x0195]); } if (LTP == 1) { - GBREG->copyLine(h, h - 1); + GBREG->CopyLine(h, h - 1); } else { - uint32_t line1 = GBREG->getPixel(1, h - 1); - line1 |= GBREG->getPixel(0, h - 1) << 1; + uint32_t line1 = GBREG->GetPixel(1, h - 1); + line1 |= GBREG->GetPixel(0, h - 1) << 1; uint32_t line2 = 0; for (uint32_t w = 0; w < GBW; w++) { int bVal; - if (USESKIP && SKIP->getPixel(w, h)) { + if (USESKIP && SKIP->GetPixel(w, h)) { bVal = 0; } else { uint32_t CONTEXT = line2; - CONTEXT |= GBREG->getPixel(w + GBAT[0], h + GBAT[1]) << 4; + CONTEXT |= GBREG->GetPixel(w + GBAT[0], h + GBAT[1]) << 4; CONTEXT |= line1 << 5; if (pArithDecoder->IsComplete()) return nullptr; @@ -634,9 +634,9 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate3Unopt( bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); } if (bVal) { - GBREG->setPixel(w, h, bVal); + GBREG->SetPixel(w, h, bVal); } - line1 = ((line1 << 1) | GBREG->getPixel(w + 2, h - 1)) & 0x1f; + line1 = ((line1 << 1) | GBREG->GetPixel(w + 2, h - 1)) & 0x1f; line2 = ((line2 << 1) | bVal) & 0x0f; } } @@ -659,7 +659,7 @@ FXCODEC_STATUS CJBig2_GRDProc::StartDecodeArith( m_ProssiveStatus = FXCODEC_STATUS_ERROR; return FXCODEC_STATUS_ERROR; } - pImage->get()->fill(0); + pImage->get()->Fill(0); m_DecodeType = 1; m_LTP = 0; m_pLine = nullptr; @@ -762,7 +762,7 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate0Opt3( m_LTP = m_LTP ^ pArithDecoder->Decode(&gbContext[0x9b25]); } if (m_LTP) { - pImage->copyLine(m_loopIndex, m_loopIndex - 1); + pImage->CopyLine(m_loopIndex, m_loopIndex - 1); } else { if (m_loopIndex > 1) { uint8_t* pLine1 = m_pLine - nStride2; @@ -857,38 +857,38 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate0Unopt( m_LTP = m_LTP ^ pArithDecoder->Decode(&gbContext[0x9b25]); } if (m_LTP) { - pImage->copyLine(m_loopIndex, m_loopIndex - 1); + pImage->CopyLine(m_loopIndex, m_loopIndex - 1); } else { - uint32_t line1 = pImage->getPixel(1, m_loopIndex - 2); - line1 |= pImage->getPixel(0, m_loopIndex - 2) << 1; - uint32_t line2 = pImage->getPixel(2, m_loopIndex - 1); - line2 |= pImage->getPixel(1, m_loopIndex - 1) << 1; - line2 |= pImage->getPixel(0, m_loopIndex - 1) << 2; + uint32_t line1 = pImage->GetPixel(1, m_loopIndex - 2); + line1 |= pImage->GetPixel(0, m_loopIndex - 2) << 1; + uint32_t line2 = pImage->GetPixel(2, m_loopIndex - 1); + line2 |= pImage->GetPixel(1, m_loopIndex - 1) << 1; + line2 |= pImage->GetPixel(0, m_loopIndex - 1) << 2; uint32_t line3 = 0; for (uint32_t w = 0; w < GBW; w++) { int bVal; - if (USESKIP && SKIP->getPixel(w, m_loopIndex)) { + if (USESKIP && SKIP->GetPixel(w, m_loopIndex)) { bVal = 0; } else { uint32_t CONTEXT = line3; - CONTEXT |= pImage->getPixel(w + GBAT[0], m_loopIndex + GBAT[1]) << 4; + CONTEXT |= pImage->GetPixel(w + GBAT[0], m_loopIndex + GBAT[1]) << 4; CONTEXT |= line2 << 5; - CONTEXT |= pImage->getPixel(w + GBAT[2], m_loopIndex + GBAT[3]) << 10; - CONTEXT |= pImage->getPixel(w + GBAT[4], m_loopIndex + GBAT[5]) << 11; + CONTEXT |= pImage->GetPixel(w + GBAT[2], m_loopIndex + GBAT[3]) << 10; + CONTEXT |= pImage->GetPixel(w + GBAT[4], m_loopIndex + GBAT[5]) << 11; CONTEXT |= line1 << 12; - CONTEXT |= pImage->getPixel(w + GBAT[6], m_loopIndex + GBAT[7]) << 15; + CONTEXT |= pImage->GetPixel(w + GBAT[6], m_loopIndex + GBAT[7]) << 15; if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); } if (bVal) { - pImage->setPixel(w, m_loopIndex, bVal); + pImage->SetPixel(w, m_loopIndex, bVal); } line1 = - ((line1 << 1) | pImage->getPixel(w + 2, m_loopIndex - 2)) & 0x07; + ((line1 << 1) | pImage->GetPixel(w + 2, m_loopIndex - 2)) & 0x07; line2 = - ((line2 << 1) | pImage->getPixel(w + 3, m_loopIndex - 1)) & 0x1f; + ((line2 << 1) | pImage->GetPixel(w + 3, m_loopIndex - 1)) & 0x1f; line3 = ((line3 << 1) | bVal) & 0x0f; } } @@ -921,7 +921,7 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate1Opt3( m_LTP = m_LTP ^ pArithDecoder->Decode(&gbContext[0x0795]); } if (m_LTP) { - pImage->copyLine(m_loopIndex, m_loopIndex - 1); + pImage->CopyLine(m_loopIndex, m_loopIndex - 1); } else { if (m_loopIndex > 1) { uint8_t* pLine1 = m_pLine - nStride2; @@ -1016,22 +1016,22 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate1Unopt( m_LTP = m_LTP ^ pArithDecoder->Decode(&gbContext[0x0795]); } if (m_LTP) { - pImage->copyLine(h, h - 1); + pImage->CopyLine(h, h - 1); } else { - uint32_t line1 = pImage->getPixel(2, h - 2); - line1 |= pImage->getPixel(1, h - 2) << 1; - line1 |= pImage->getPixel(0, h - 2) << 2; - uint32_t line2 = pImage->getPixel(2, h - 1); - line2 |= pImage->getPixel(1, h - 1) << 1; - line2 |= pImage->getPixel(0, h - 1) << 2; + uint32_t line1 = pImage->GetPixel(2, h - 2); + line1 |= pImage->GetPixel(1, h - 2) << 1; + line1 |= pImage->GetPixel(0, h - 2) << 2; + uint32_t line2 = pImage->GetPixel(2, h - 1); + line2 |= pImage->GetPixel(1, h - 1) << 1; + line2 |= pImage->GetPixel(0, h - 1) << 2; uint32_t line3 = 0; for (uint32_t w = 0; w < GBW; w++) { int bVal; - if (USESKIP && SKIP->getPixel(w, h)) { + if (USESKIP && SKIP->GetPixel(w, h)) { bVal = 0; } else { uint32_t CONTEXT = line3; - CONTEXT |= pImage->getPixel(w + GBAT[0], h + GBAT[1]) << 3; + CONTEXT |= pImage->GetPixel(w + GBAT[0], h + GBAT[1]) << 3; CONTEXT |= line2 << 4; CONTEXT |= line1 << 9; if (pArithDecoder->IsComplete()) @@ -1040,10 +1040,10 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate1Unopt( bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); } if (bVal) { - pImage->setPixel(w, h, bVal); + pImage->SetPixel(w, h, bVal); } - line1 = ((line1 << 1) | pImage->getPixel(w + 3, h - 2)) & 0x0f; - line2 = ((line2 << 1) | pImage->getPixel(w + 3, h - 1)) & 0x1f; + line1 = ((line1 << 1) | pImage->GetPixel(w + 3, h - 2)) & 0x0f; + line2 = ((line2 << 1) | pImage->GetPixel(w + 3, h - 1)) & 0x1f; line3 = ((line3 << 1) | bVal) & 0x07; } } @@ -1076,7 +1076,7 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate2Opt3( m_LTP = m_LTP ^ pArithDecoder->Decode(&gbContext[0x00e5]); } if (m_LTP) { - pImage->copyLine(m_loopIndex, m_loopIndex - 1); + pImage->CopyLine(m_loopIndex, m_loopIndex - 1); } else { if (m_loopIndex > 1) { uint8_t* pLine1 = m_pLine - nStride2; @@ -1172,20 +1172,20 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate2Unopt( m_LTP = m_LTP ^ pArithDecoder->Decode(&gbContext[0x00e5]); } if (m_LTP) { - pImage->copyLine(m_loopIndex, m_loopIndex - 1); + pImage->CopyLine(m_loopIndex, m_loopIndex - 1); } else { - uint32_t line1 = pImage->getPixel(1, m_loopIndex - 2); - line1 |= pImage->getPixel(0, m_loopIndex - 2) << 1; - uint32_t line2 = pImage->getPixel(1, m_loopIndex - 1); - line2 |= pImage->getPixel(0, m_loopIndex - 1) << 1; + uint32_t line1 = pImage->GetPixel(1, m_loopIndex - 2); + line1 |= pImage->GetPixel(0, m_loopIndex - 2) << 1; + uint32_t line2 = pImage->GetPixel(1, m_loopIndex - 1); + line2 |= pImage->GetPixel(0, m_loopIndex - 1) << 1; uint32_t line3 = 0; for (uint32_t w = 0; w < GBW; w++) { int bVal; - if (USESKIP && SKIP->getPixel(w, m_loopIndex)) { + if (USESKIP && SKIP->GetPixel(w, m_loopIndex)) { bVal = 0; } else { uint32_t CONTEXT = line3; - CONTEXT |= pImage->getPixel(w + GBAT[0], m_loopIndex + GBAT[1]) << 2; + CONTEXT |= pImage->GetPixel(w + GBAT[0], m_loopIndex + GBAT[1]) << 2; CONTEXT |= line2 << 3; CONTEXT |= line1 << 7; if (pArithDecoder->IsComplete()) @@ -1194,12 +1194,12 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate2Unopt( bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); } if (bVal) { - pImage->setPixel(w, m_loopIndex, bVal); + pImage->SetPixel(w, m_loopIndex, bVal); } line1 = - ((line1 << 1) | pImage->getPixel(w + 2, m_loopIndex - 2)) & 0x07; + ((line1 << 1) | pImage->GetPixel(w + 2, m_loopIndex - 2)) & 0x07; line2 = - ((line2 << 1) | pImage->getPixel(w + 2, m_loopIndex - 1)) & 0x0f; + ((line2 << 1) | pImage->GetPixel(w + 2, m_loopIndex - 1)) & 0x0f; line3 = ((line3 << 1) | bVal) & 0x03; } } @@ -1231,7 +1231,7 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate3Opt3( m_LTP = m_LTP ^ pArithDecoder->Decode(&gbContext[0x0195]); } if (m_LTP) { - pImage->copyLine(m_loopIndex, m_loopIndex - 1); + pImage->CopyLine(m_loopIndex, m_loopIndex - 1); } else { if (m_loopIndex > 0) { uint8_t* pLine1 = m_pLine - nStride; @@ -1313,18 +1313,18 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate3Unopt( m_LTP = m_LTP ^ pArithDecoder->Decode(&gbContext[0x0195]); } if (m_LTP) { - pImage->copyLine(m_loopIndex, m_loopIndex - 1); + pImage->CopyLine(m_loopIndex, m_loopIndex - 1); } else { - uint32_t line1 = pImage->getPixel(1, m_loopIndex - 1); - line1 |= pImage->getPixel(0, m_loopIndex - 1) << 1; + uint32_t line1 = pImage->GetPixel(1, m_loopIndex - 1); + line1 |= pImage->GetPixel(0, m_loopIndex - 1) << 1; uint32_t line2 = 0; for (uint32_t w = 0; w < GBW; w++) { int bVal; - if (USESKIP && SKIP->getPixel(w, m_loopIndex)) { + if (USESKIP && SKIP->GetPixel(w, m_loopIndex)) { bVal = 0; } else { uint32_t CONTEXT = line2; - CONTEXT |= pImage->getPixel(w + GBAT[0], m_loopIndex + GBAT[1]) << 4; + CONTEXT |= pImage->GetPixel(w + GBAT[0], m_loopIndex + GBAT[1]) << 4; CONTEXT |= line1 << 5; if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; @@ -1332,10 +1332,10 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate3Unopt( bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); } if (bVal) { - pImage->setPixel(w, m_loopIndex, bVal); + pImage->SetPixel(w, m_loopIndex, bVal); } line1 = - ((line1 << 1) | pImage->getPixel(w + 2, m_loopIndex - 1)) & 0x1f; + ((line1 << 1) | pImage->GetPixel(w + 2, m_loopIndex - 1)) & 0x1f; line2 = ((line2 << 1) | bVal) & 0x0f; } } diff --git a/core/fxcodec/jbig2/JBig2_GrrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrrdProc.cpp index 06a7fb1c17..5542ec53ed 100644 --- a/core/fxcodec/jbig2/JBig2_GrrdProc.cpp +++ b/core/fxcodec/jbig2/JBig2_GrrdProc.cpp @@ -41,7 +41,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::DecodeTemplate0Unopt( if (!GRREG->data()) return nullptr; - GRREG->fill(0); + GRREG->Fill(0); int LTP = 0; for (uint32_t h = 0; h < GRH; h++) { if (TPGRON) { @@ -51,20 +51,20 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::DecodeTemplate0Unopt( LTP = LTP ^ pArithDecoder->Decode(&grContext[0x0010]); } uint32_t lines[5]; - lines[0] = GRREG->getPixel(1, h - 1); - lines[0] |= GRREG->getPixel(0, h - 1) << 1; + lines[0] = GRREG->GetPixel(1, h - 1); + lines[0] |= GRREG->GetPixel(0, h - 1) << 1; lines[1] = 0; - lines[2] = GRREFERENCE->getPixel(-GRREFERENCEDX + 1, h - GRREFERENCEDY - 1); - lines[2] |= GRREFERENCE->getPixel(-GRREFERENCEDX, h - GRREFERENCEDY - 1) + lines[2] = GRREFERENCE->GetPixel(-GRREFERENCEDX + 1, h - GRREFERENCEDY - 1); + lines[2] |= GRREFERENCE->GetPixel(-GRREFERENCEDX, h - GRREFERENCEDY - 1) << 1; - lines[3] = GRREFERENCE->getPixel(-GRREFERENCEDX + 1, h - GRREFERENCEDY); - lines[3] |= GRREFERENCE->getPixel(-GRREFERENCEDX, h - GRREFERENCEDY) << 1; - lines[3] |= GRREFERENCE->getPixel(-GRREFERENCEDX - 1, h - GRREFERENCEDY) + lines[3] = GRREFERENCE->GetPixel(-GRREFERENCEDX + 1, h - GRREFERENCEDY); + lines[3] |= GRREFERENCE->GetPixel(-GRREFERENCEDX, h - GRREFERENCEDY) << 1; + lines[3] |= GRREFERENCE->GetPixel(-GRREFERENCEDX - 1, h - GRREFERENCEDY) << 2; - lines[4] = GRREFERENCE->getPixel(-GRREFERENCEDX + 1, h - GRREFERENCEDY + 1); - lines[4] |= GRREFERENCE->getPixel(-GRREFERENCEDX, h - GRREFERENCEDY + 1) + lines[4] = GRREFERENCE->GetPixel(-GRREFERENCEDX + 1, h - GRREFERENCEDY + 1); + lines[4] |= GRREFERENCE->GetPixel(-GRREFERENCEDX, h - GRREFERENCEDY + 1) << 1; - lines[4] |= GRREFERENCE->getPixel(-GRREFERENCEDX - 1, h - GRREFERENCEDY + 1) + lines[4] |= GRREFERENCE->GetPixel(-GRREFERENCEDX - 1, h - GRREFERENCEDY + 1) << 2; if (!LTP) { for (uint32_t w = 0; w < GRW; w++) { @@ -78,15 +78,15 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::DecodeTemplate0Unopt( } } else { for (uint32_t w = 0; w < GRW; w++) { - int bVal = GRREFERENCE->getPixel(w, h); - if (!(TPGRON && (bVal == GRREFERENCE->getPixel(w - 1, h - 1)) && - (bVal == GRREFERENCE->getPixel(w, h - 1)) && - (bVal == GRREFERENCE->getPixel(w + 1, h - 1)) && - (bVal == GRREFERENCE->getPixel(w - 1, h)) && - (bVal == GRREFERENCE->getPixel(w + 1, h)) && - (bVal == GRREFERENCE->getPixel(w - 1, h + 1)) && - (bVal == GRREFERENCE->getPixel(w, h + 1)) && - (bVal == GRREFERENCE->getPixel(w + 1, h + 1)))) { + int bVal = GRREFERENCE->GetPixel(w, h); + if (!(TPGRON && (bVal == GRREFERENCE->GetPixel(w - 1, h - 1)) && + (bVal == GRREFERENCE->GetPixel(w, h - 1)) && + (bVal == GRREFERENCE->GetPixel(w + 1, h - 1)) && + (bVal == GRREFERENCE->GetPixel(w - 1, h)) && + (bVal == GRREFERENCE->GetPixel(w + 1, h)) && + (bVal == GRREFERENCE->GetPixel(w - 1, h + 1)) && + (bVal == GRREFERENCE->GetPixel(w, h + 1)) && + (bVal == GRREFERENCE->GetPixel(w + 1, h + 1)))) { uint32_t CONTEXT = DecodeTemplate0UnoptCalculateContext(*GRREG, lines, w, h); if (pArithDecoder->IsComplete()) @@ -109,12 +109,12 @@ uint32_t CJBig2_GRRDProc::DecodeTemplate0UnoptCalculateContext( uint32_t CONTEXT = lines[4]; CONTEXT |= lines[3] << 3; CONTEXT |= lines[2] << 6; - CONTEXT |= GRREFERENCE->getPixel(w - GRREFERENCEDX + GRAT[2], + CONTEXT |= GRREFERENCE->GetPixel(w - GRREFERENCEDX + GRAT[2], h - GRREFERENCEDY + GRAT[3]) << 8; CONTEXT |= lines[1] << 9; CONTEXT |= lines[0] << 10; - CONTEXT |= GRREG.getPixel(w + GRAT[0], h + GRAT[1]) << 12; + CONTEXT |= GRREG.GetPixel(w + GRAT[0], h + GRAT[1]) << 12; return CONTEXT; } @@ -123,16 +123,16 @@ void CJBig2_GRRDProc::DecodeTemplate0UnoptSetPixel(CJBig2_Image* GRREG, uint32_t w, uint32_t h, int bVal) { - GRREG->setPixel(w, h, bVal); - lines[0] = ((lines[0] << 1) | GRREG->getPixel(w + 2, h - 1)) & 0x03; + GRREG->SetPixel(w, h, bVal); + lines[0] = ((lines[0] << 1) | GRREG->GetPixel(w + 2, h - 1)) & 0x03; lines[1] = ((lines[1] << 1) | bVal) & 0x01; - lines[2] = ((lines[2] << 1) | GRREFERENCE->getPixel(w - GRREFERENCEDX + 2, + lines[2] = ((lines[2] << 1) | GRREFERENCE->GetPixel(w - GRREFERENCEDX + 2, h - GRREFERENCEDY - 1)) & 0x03; lines[3] = ((lines[3] << 1) | - GRREFERENCE->getPixel(w - GRREFERENCEDX + 2, h - GRREFERENCEDY)) & + GRREFERENCE->GetPixel(w - GRREFERENCEDX + 2, h - GRREFERENCEDY)) & 0x07; - lines[4] = ((lines[4] << 1) | GRREFERENCE->getPixel(w - GRREFERENCEDX + 2, + lines[4] = ((lines[4] << 1) | GRREFERENCE->GetPixel(w - GRREFERENCEDX + 2, h - GRREFERENCEDY + 1)) & 0x07; } @@ -244,15 +244,15 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::DecodeTemplate0Opt( } uint8_t cVal = 0; for (int32_t k = 0; k < nBits; k++) { - int bVal = GRREFERENCE->getPixel(w + k, h); - if (!(TPGRON && (bVal == GRREFERENCE->getPixel(w + k - 1, h - 1)) && - (bVal == GRREFERENCE->getPixel(w + k, h - 1)) && - (bVal == GRREFERENCE->getPixel(w + k + 1, h - 1)) && - (bVal == GRREFERENCE->getPixel(w + k - 1, h)) && - (bVal == GRREFERENCE->getPixel(w + k + 1, h)) && - (bVal == GRREFERENCE->getPixel(w + k - 1, h + 1)) && - (bVal == GRREFERENCE->getPixel(w + k, h + 1)) && - (bVal == GRREFERENCE->getPixel(w + k + 1, h + 1)))) { + int bVal = GRREFERENCE->GetPixel(w + k, h); + if (!(TPGRON && (bVal == GRREFERENCE->GetPixel(w + k - 1, h - 1)) && + (bVal == GRREFERENCE->GetPixel(w + k, h - 1)) && + (bVal == GRREFERENCE->GetPixel(w + k + 1, h - 1)) && + (bVal == GRREFERENCE->GetPixel(w + k - 1, h)) && + (bVal == GRREFERENCE->GetPixel(w + k + 1, h)) && + (bVal == GRREFERENCE->GetPixel(w + k - 1, h + 1)) && + (bVal == GRREFERENCE->GetPixel(w + k, h + 1)) && + (bVal == GRREFERENCE->GetPixel(w + k + 1, h + 1)))) { if (pArithDecoder->IsComplete()) return nullptr; @@ -282,7 +282,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::DecodeTemplate1Unopt( if (!GRREG->data()) return nullptr; - GRREG->fill(0); + GRREG->Fill(0); int LTP = 0; for (uint32_t h = 0; h < GRH; h++) { if (TPGRON) { @@ -292,20 +292,20 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::DecodeTemplate1Unopt( LTP = LTP ^ pArithDecoder->Decode(&grContext[0x0008]); } if (!LTP) { - uint32_t line1 = GRREG->getPixel(1, h - 1); - line1 |= GRREG->getPixel(0, h - 1) << 1; - line1 |= GRREG->getPixel(-1, h - 1) << 2; + uint32_t line1 = GRREG->GetPixel(1, h - 1); + line1 |= GRREG->GetPixel(0, h - 1) << 1; + line1 |= GRREG->GetPixel(-1, h - 1) << 2; uint32_t line2 = 0; uint32_t line3 = - GRREFERENCE->getPixel(-GRREFERENCEDX, h - GRREFERENCEDY - 1); + GRREFERENCE->GetPixel(-GRREFERENCEDX, h - GRREFERENCEDY - 1); uint32_t line4 = - GRREFERENCE->getPixel(-GRREFERENCEDX + 1, h - GRREFERENCEDY); - line4 |= GRREFERENCE->getPixel(-GRREFERENCEDX, h - GRREFERENCEDY) << 1; - line4 |= GRREFERENCE->getPixel(-GRREFERENCEDX - 1, h - GRREFERENCEDY) + GRREFERENCE->GetPixel(-GRREFERENCEDX + 1, h - GRREFERENCEDY); + line4 |= GRREFERENCE->GetPixel(-GRREFERENCEDX, h - GRREFERENCEDY) << 1; + line4 |= GRREFERENCE->GetPixel(-GRREFERENCEDX - 1, h - GRREFERENCEDY) << 2; uint32_t line5 = - GRREFERENCE->getPixel(-GRREFERENCEDX + 1, h - GRREFERENCEDY + 1); - line5 |= GRREFERENCE->getPixel(-GRREFERENCEDX, h - GRREFERENCEDY + 1) + GRREFERENCE->GetPixel(-GRREFERENCEDX + 1, h - GRREFERENCEDY + 1); + line5 |= GRREFERENCE->GetPixel(-GRREFERENCEDX, h - GRREFERENCEDY + 1) << 1; for (uint32_t w = 0; w < GRW; w++) { uint32_t CONTEXT = line5; @@ -317,48 +317,45 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::DecodeTemplate1Unopt( return nullptr; int bVal = pArithDecoder->Decode(&grContext[CONTEXT]); - GRREG->setPixel(w, h, bVal); - line1 = ((line1 << 1) | GRREG->getPixel(w + 2, h - 1)) & 0x07; + GRREG->SetPixel(w, h, bVal); + line1 = ((line1 << 1) | GRREG->GetPixel(w + 2, h - 1)) & 0x07; line2 = ((line2 << 1) | bVal) & 0x01; - line3 = ((line3 << 1) | - GRREFERENCE->getPixel(w - GRREFERENCEDX + 1, - h - GRREFERENCEDY - 1)) & + line3 = ((line3 << 1) | GRREFERENCE->GetPixel(w - GRREFERENCEDX + 1, + h - GRREFERENCEDY - 1)) & 0x01; - line4 = - ((line4 << 1) | - GRREFERENCE->getPixel(w - GRREFERENCEDX + 2, h - GRREFERENCEDY)) & - 0x07; - line5 = ((line5 << 1) | - GRREFERENCE->getPixel(w - GRREFERENCEDX + 2, - h - GRREFERENCEDY + 1)) & + line4 = ((line4 << 1) | GRREFERENCE->GetPixel(w - GRREFERENCEDX + 2, + h - GRREFERENCEDY)) & + 0x07; + line5 = ((line5 << 1) | GRREFERENCE->GetPixel(w - GRREFERENCEDX + 2, + h - GRREFERENCEDY + 1)) & 0x03; } } else { - uint32_t line1 = GRREG->getPixel(1, h - 1); - line1 |= GRREG->getPixel(0, h - 1) << 1; - line1 |= GRREG->getPixel(-1, h - 1) << 2; + uint32_t line1 = GRREG->GetPixel(1, h - 1); + line1 |= GRREG->GetPixel(0, h - 1) << 1; + line1 |= GRREG->GetPixel(-1, h - 1) << 2; uint32_t line2 = 0; uint32_t line3 = - GRREFERENCE->getPixel(-GRREFERENCEDX, h - GRREFERENCEDY - 1); + GRREFERENCE->GetPixel(-GRREFERENCEDX, h - GRREFERENCEDY - 1); uint32_t line4 = - GRREFERENCE->getPixel(-GRREFERENCEDX + 1, h - GRREFERENCEDY); - line4 |= GRREFERENCE->getPixel(-GRREFERENCEDX, h - GRREFERENCEDY) << 1; - line4 |= GRREFERENCE->getPixel(-GRREFERENCEDX - 1, h - GRREFERENCEDY) + GRREFERENCE->GetPixel(-GRREFERENCEDX + 1, h - GRREFERENCEDY); + line4 |= GRREFERENCE->GetPixel(-GRREFERENCEDX, h - GRREFERENCEDY) << 1; + line4 |= GRREFERENCE->GetPixel(-GRREFERENCEDX - 1, h - GRREFERENCEDY) << 2; uint32_t line5 = - GRREFERENCE->getPixel(-GRREFERENCEDX + 1, h - GRREFERENCEDY + 1); - line5 |= GRREFERENCE->getPixel(-GRREFERENCEDX, h - GRREFERENCEDY + 1) + GRREFERENCE->GetPixel(-GRREFERENCEDX + 1, h - GRREFERENCEDY + 1); + line5 |= GRREFERENCE->GetPixel(-GRREFERENCEDX, h - GRREFERENCEDY + 1) << 1; for (uint32_t w = 0; w < GRW; w++) { - int bVal = GRREFERENCE->getPixel(w, h); - if (!(TPGRON && (bVal == GRREFERENCE->getPixel(w - 1, h - 1)) && - (bVal == GRREFERENCE->getPixel(w, h - 1)) && - (bVal == GRREFERENCE->getPixel(w + 1, h - 1)) && - (bVal == GRREFERENCE->getPixel(w - 1, h)) && - (bVal == GRREFERENCE->getPixel(w + 1, h)) && - (bVal == GRREFERENCE->getPixel(w - 1, h + 1)) && - (bVal == GRREFERENCE->getPixel(w, h + 1)) && - (bVal == GRREFERENCE->getPixel(w + 1, h + 1)))) { + int bVal = GRREFERENCE->GetPixel(w, h); + if (!(TPGRON && (bVal == GRREFERENCE->GetPixel(w - 1, h - 1)) && + (bVal == GRREFERENCE->GetPixel(w, h - 1)) && + (bVal == GRREFERENCE->GetPixel(w + 1, h - 1)) && + (bVal == GRREFERENCE->GetPixel(w - 1, h)) && + (bVal == GRREFERENCE->GetPixel(w + 1, h)) && + (bVal == GRREFERENCE->GetPixel(w - 1, h + 1)) && + (bVal == GRREFERENCE->GetPixel(w, h + 1)) && + (bVal == GRREFERENCE->GetPixel(w + 1, h + 1)))) { uint32_t CONTEXT = line5; CONTEXT |= line4 << 2; CONTEXT |= line3 << 5; @@ -369,20 +366,17 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::DecodeTemplate1Unopt( bVal = pArithDecoder->Decode(&grContext[CONTEXT]); } - GRREG->setPixel(w, h, bVal); - line1 = ((line1 << 1) | GRREG->getPixel(w + 2, h - 1)) & 0x07; + GRREG->SetPixel(w, h, bVal); + line1 = ((line1 << 1) | GRREG->GetPixel(w + 2, h - 1)) & 0x07; line2 = ((line2 << 1) | bVal) & 0x01; - line3 = ((line3 << 1) | - GRREFERENCE->getPixel(w - GRREFERENCEDX + 1, - h - GRREFERENCEDY - 1)) & + line3 = ((line3 << 1) | GRREFERENCE->GetPixel(w - GRREFERENCEDX + 1, + h - GRREFERENCEDY - 1)) & 0x01; - line4 = - ((line4 << 1) | - GRREFERENCE->getPixel(w - GRREFERENCEDX + 2, h - GRREFERENCEDY)) & - 0x07; - line5 = ((line5 << 1) | - GRREFERENCE->getPixel(w - GRREFERENCEDX + 2, - h - GRREFERENCEDY + 1)) & + line4 = ((line4 << 1) | GRREFERENCE->GetPixel(w - GRREFERENCEDX + 2, + h - GRREFERENCEDY)) & + 0x07; + line5 = ((line5 << 1) | GRREFERENCE->GetPixel(w - GRREFERENCEDX + 2, + h - GRREFERENCEDY + 1)) & 0x03; } } @@ -486,15 +480,15 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::DecodeTemplate1Opt( } uint8_t cVal = 0; for (int32_t k = 0; k < nBits; k++) { - int bVal = GRREFERENCE->getPixel(w + k, h); - if (!(TPGRON && (bVal == GRREFERENCE->getPixel(w + k - 1, h - 1)) && - (bVal == GRREFERENCE->getPixel(w + k, h - 1)) && - (bVal == GRREFERENCE->getPixel(w + k + 1, h - 1)) && - (bVal == GRREFERENCE->getPixel(w + k - 1, h)) && - (bVal == GRREFERENCE->getPixel(w + k + 1, h)) && - (bVal == GRREFERENCE->getPixel(w + k - 1, h + 1)) && - (bVal == GRREFERENCE->getPixel(w + k, h + 1)) && - (bVal == GRREFERENCE->getPixel(w + k + 1, h + 1)))) { + int bVal = GRREFERENCE->GetPixel(w + k, h); + if (!(TPGRON && (bVal == GRREFERENCE->GetPixel(w + k - 1, h - 1)) && + (bVal == GRREFERENCE->GetPixel(w + k, h - 1)) && + (bVal == GRREFERENCE->GetPixel(w + k + 1, h - 1)) && + (bVal == GRREFERENCE->GetPixel(w + k - 1, h)) && + (bVal == GRREFERENCE->GetPixel(w + k + 1, h)) && + (bVal == GRREFERENCE->GetPixel(w + k - 1, h + 1)) && + (bVal == GRREFERENCE->GetPixel(w + k, h + 1)) && + (bVal == GRREFERENCE->GetPixel(w + k + 1, h + 1)))) { if (pArithDecoder->IsComplete()) return nullptr; diff --git a/core/fxcodec/jbig2/JBig2_HtrdProc.cpp b/core/fxcodec/jbig2/JBig2_HtrdProc.cpp index 4fce8a48a1..59fbd8950d 100644 --- a/core/fxcodec/jbig2/JBig2_HtrdProc.cpp +++ b/core/fxcodec/jbig2/JBig2_HtrdProc.cpp @@ -27,9 +27,9 @@ std::unique_ptr<CJBig2_Image> CJBig2_HTRDProc::DecodeArith( int32_t y = (HGY + mg * HRX - ng * HRY) >> 8; if ((x + HPW <= 0) | (x >= static_cast<int32_t>(HBW)) | (y + HPH <= 0) | (y >= static_cast<int32_t>(HPH))) { - HSKIP->setPixel(ng, mg, 1); + HSKIP->SetPixel(ng, mg, 1); } else { - HSKIP->setPixel(ng, mg, 0); + HSKIP->SetPixel(ng, mg, 0); } } } @@ -120,12 +120,12 @@ std::unique_ptr<CJBig2_Image> CJBig2_HTRDProc::DecodeImage( if (!HTREG->data()) return nullptr; - HTREG->fill(HDEFPIXEL); + HTREG->Fill(HDEFPIXEL); for (uint32_t y = 0; y < HGH; ++y) { for (uint32_t x = 0; x < HGW; ++x) { uint32_t gsval = 0; for (uint8_t i = 0; i < GSPLANES.size(); ++i) - gsval |= GSPLANES[i]->getPixel(x, y) << i; + gsval |= GSPLANES[i]->GetPixel(x, y) << i; uint32_t pat_index = std::min(gsval, HNUMPATS - 1); int32_t out_x = (HGX + y * HRY + x * HRX) >> 8; int32_t out_y = (HGY + y * HRX - x * HRY) >> 8; diff --git a/core/fxcodec/jbig2/JBig2_Image.cpp b/core/fxcodec/jbig2/JBig2_Image.cpp index 3a45223c1e..089f9e44d6 100644 --- a/core/fxcodec/jbig2/JBig2_Image.cpp +++ b/core/fxcodec/jbig2/JBig2_Image.cpp @@ -74,7 +74,7 @@ bool CJBig2_Image::IsValidImageSize(int32_t w, int32_t h) { h <= JBIG2_MAX_IMAGE_SIZE; } -int CJBig2_Image::getPixel(int32_t x, int32_t y) const { +int CJBig2_Image::GetPixel(int32_t x, int32_t y) const { if (!m_pData) return 0; @@ -89,7 +89,7 @@ int CJBig2_Image::getPixel(int32_t x, int32_t y) const { return ((data()[m] >> (7 - n)) & 1); } -int32_t CJBig2_Image::setPixel(int32_t x, int32_t y, int v) { +int32_t CJBig2_Image::SetPixel(int32_t x, int32_t y, int v) { if (!m_pData) return 0; @@ -109,7 +109,7 @@ int32_t CJBig2_Image::setPixel(int32_t x, int32_t y, int v) { return 1; } -void CJBig2_Image::copyLine(int32_t hTo, int32_t hFrom) { +void CJBig2_Image::CopyLine(int32_t hTo, int32_t hFrom) { if (!m_pData) return; @@ -120,7 +120,7 @@ void CJBig2_Image::copyLine(int32_t hTo, int32_t hFrom) { m_nStride); } } -void CJBig2_Image::fill(bool v) { +void CJBig2_Image::Fill(bool v) { if (!m_pData) return; @@ -162,7 +162,7 @@ bool CJBig2_Image::ComposeFromWithRect(int32_t x, #define JBIG2_GETDWORD(buf) \ ((uint32_t)(((buf)[0] << 24) | ((buf)[1] << 16) | ((buf)[2] << 8) | (buf)[3])) -std::unique_ptr<CJBig2_Image> CJBig2_Image::subImage(int32_t x, +std::unique_ptr<CJBig2_Image> CJBig2_Image::SubImage(int32_t x, int32_t y, int32_t w, int32_t h) { @@ -181,7 +181,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_Image::subImage(int32_t x, auto pImage = pdfium::MakeUnique<CJBig2_Image>(w, h); if (!m_pData) { - pImage->fill(0); + pImage->Fill(0); return pImage; } if (!pImage->m_pData) @@ -228,7 +228,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_Image::subImage(int32_t x, return pImage; } -void CJBig2_Image::expand(int32_t h, bool v) { +void CJBig2_Image::Expand(int32_t h, bool v) { if (!m_pData || h <= m_nHeight || h > kMaxImageBytes / m_nStride) return; diff --git a/core/fxcodec/jbig2/JBig2_Image.h b/core/fxcodec/jbig2/JBig2_Image.h index d8a3e9cdc1..7c087c2385 100644 --- a/core/fxcodec/jbig2/JBig2_Image.h +++ b/core/fxcodec/jbig2/JBig2_Image.h @@ -36,11 +36,11 @@ class CJBig2_Image { int32_t stride() const { return m_nStride; } uint8_t* data() const { return m_pData.Get(); } - int getPixel(int32_t x, int32_t y) const; - int32_t setPixel(int32_t x, int32_t y, int bVal); + int GetPixel(int32_t x, int32_t y) const; + int32_t SetPixel(int32_t x, int32_t y, int bVal); - void copyLine(int32_t hTo, int32_t hFrom); - void fill(bool v); + void CopyLine(int32_t hTo, int32_t hFrom); + void Fill(bool v); bool ComposeFrom(int32_t x, int32_t y, CJBig2_Image* pSrc, JBig2ComposeOp op); bool ComposeFromWithRect(int32_t x, @@ -49,12 +49,11 @@ class CJBig2_Image { const FX_RECT& rtSrc, JBig2ComposeOp op); - std::unique_ptr<CJBig2_Image> subImage(int32_t x, + std::unique_ptr<CJBig2_Image> SubImage(int32_t x, int32_t y, int32_t w, int32_t h); - void expand(int32_t h, bool v); - + void Expand(int32_t h, bool v); bool ComposeTo(CJBig2_Image* pDst, int32_t x, int32_t y, JBig2ComposeOp op); bool ComposeToWithRect(CJBig2_Image* pDst, diff --git a/core/fxcodec/jbig2/JBig2_Image_unittest.cpp b/core/fxcodec/jbig2/JBig2_Image_unittest.cpp index 2e53e7b337..bebfb6b20d 100644 --- a/core/fxcodec/jbig2/JBig2_Image_unittest.cpp +++ b/core/fxcodec/jbig2/JBig2_Image_unittest.cpp @@ -22,12 +22,12 @@ const int32_t kTooLargeHeightLines = 40000000; TEST(fxcodec, JBig2ImageCreate) { CJBig2_Image img(kWidthPixels, kHeightLines); - img.setPixel(0, 0, true); - img.setPixel(kWidthPixels - 1, kHeightLines - 1, false); + img.SetPixel(0, 0, true); + img.SetPixel(kWidthPixels - 1, kHeightLines - 1, false); EXPECT_EQ(kWidthPixels, img.width()); EXPECT_EQ(kHeightLines, img.height()); - EXPECT_TRUE(img.getPixel(0, 0)); - EXPECT_FALSE(img.getPixel(kWidthPixels - 1, kHeightLines - 1)); + EXPECT_TRUE(img.GetPixel(0, 0)); + EXPECT_FALSE(img.GetPixel(kWidthPixels - 1, kHeightLines - 1)); } TEST(fxcodec, JBig2ImageCreateTooBig) { @@ -40,12 +40,12 @@ TEST(fxcodec, JBig2ImageCreateTooBig) { TEST(fxcodec, JBig2ImageCreateExternal) { uint8_t buf[kHeightLines * kStrideBytes]; CJBig2_Image img(kWidthPixels, kHeightLines, kStrideBytes, buf); - img.setPixel(0, 0, true); - img.setPixel(kWidthPixels - 1, kHeightLines - 1, false); + img.SetPixel(0, 0, true); + img.SetPixel(kWidthPixels - 1, kHeightLines - 1, false); EXPECT_EQ(kWidthPixels, img.width()); EXPECT_EQ(kHeightLines, img.height()); - EXPECT_TRUE(img.getPixel(0, 0)); - EXPECT_FALSE(img.getPixel(kWidthPixels - 1, kHeightLines - 1)); + EXPECT_TRUE(img.GetPixel(0, 0)); + EXPECT_FALSE(img.GetPixel(kWidthPixels - 1, kHeightLines - 1)); } TEST(fxcodec, JBig2ImageCreateExternalTooBig) { @@ -58,48 +58,48 @@ TEST(fxcodec, JBig2ImageCreateExternalTooBig) { TEST(fxcodec, JBig2ImageExpand) { CJBig2_Image img(kWidthPixels, kHeightLines); - img.setPixel(0, 0, true); - img.setPixel(kWidthPixels - 1, kHeightLines - 1, false); - img.expand(kLargerHeightLines, true); + img.SetPixel(0, 0, true); + img.SetPixel(kWidthPixels - 1, kHeightLines - 1, false); + img.Expand(kLargerHeightLines, true); EXPECT_EQ(kWidthPixels, img.width()); EXPECT_EQ(kLargerHeightLines, img.height()); - EXPECT_TRUE(img.getPixel(0, 0)); - EXPECT_FALSE(img.getPixel(kWidthPixels - 1, kHeightLines - 1)); - EXPECT_TRUE(img.getPixel(kWidthPixels - 1, kLargerHeightLines - 1)); + EXPECT_TRUE(img.GetPixel(0, 0)); + EXPECT_FALSE(img.GetPixel(kWidthPixels - 1, kHeightLines - 1)); + EXPECT_TRUE(img.GetPixel(kWidthPixels - 1, kLargerHeightLines - 1)); } TEST(fxcodec, JBig2ImageExpandTooBig) { CJBig2_Image img(kWidthPixels, kHeightLines); - img.setPixel(0, 0, true); - img.setPixel(kWidthPixels - 1, kHeightLines - 1, false); - img.expand(kTooLargeHeightLines, true); + img.SetPixel(0, 0, true); + img.SetPixel(kWidthPixels - 1, kHeightLines - 1, false); + img.Expand(kTooLargeHeightLines, true); EXPECT_EQ(kWidthPixels, img.width()); EXPECT_EQ(kHeightLines, img.height()); - EXPECT_TRUE(img.getPixel(0, 0)); - EXPECT_FALSE(img.getPixel(kWidthPixels - 1, kHeightLines - 1)); + EXPECT_TRUE(img.GetPixel(0, 0)); + EXPECT_FALSE(img.GetPixel(kWidthPixels - 1, kHeightLines - 1)); } TEST(fxcodec, JBig2ImageExpandExternal) { uint8_t buf[kHeightLines * kStrideBytes]; CJBig2_Image img(kWidthPixels, kHeightLines, kStrideBytes, buf); - img.setPixel(0, 0, true); - img.setPixel(kWidthPixels - 1, kHeightLines - 1, false); - img.expand(kLargerHeightLines, true); + img.SetPixel(0, 0, true); + img.SetPixel(kWidthPixels - 1, kHeightLines - 1, false); + img.Expand(kLargerHeightLines, true); EXPECT_EQ(kWidthPixels, img.width()); EXPECT_EQ(kLargerHeightLines, img.height()); - EXPECT_TRUE(img.getPixel(0, 0)); - EXPECT_FALSE(img.getPixel(kWidthPixels - 1, kHeightLines - 1)); - EXPECT_TRUE(img.getPixel(kWidthPixels - 1, kLargerHeightLines - 1)); + EXPECT_TRUE(img.GetPixel(0, 0)); + EXPECT_FALSE(img.GetPixel(kWidthPixels - 1, kHeightLines - 1)); + EXPECT_TRUE(img.GetPixel(kWidthPixels - 1, kLargerHeightLines - 1)); } TEST(fxcodec, JBig2ImageExpandExternalTooBig) { uint8_t buf[kHeightLines * kStrideBytes]; CJBig2_Image img(kWidthPixels, kHeightLines, kStrideBytes, buf); - img.setPixel(0, 0, true); - img.setPixel(kWidthPixels - 1, kHeightLines - 1, false); - img.expand(kTooLargeHeightLines, true); + img.SetPixel(0, 0, true); + img.SetPixel(kWidthPixels - 1, kHeightLines - 1, false); + img.Expand(kTooLargeHeightLines, true); EXPECT_EQ(kWidthPixels, img.width()); EXPECT_EQ(kHeightLines, img.height()); - EXPECT_TRUE(img.getPixel(0, 0)); - EXPECT_FALSE(img.getPixel(kWidthPixels - 1, kHeightLines - 1)); + EXPECT_TRUE(img.GetPixel(0, 0)); + EXPECT_FALSE(img.GetPixel(kWidthPixels - 1, kHeightLines - 1)); } diff --git a/core/fxcodec/jbig2/JBig2_PddProc.cpp b/core/fxcodec/jbig2/JBig2_PddProc.cpp index 32f29d745c..bb61088886 100644 --- a/core/fxcodec/jbig2/JBig2_PddProc.cpp +++ b/core/fxcodec/jbig2/JBig2_PddProc.cpp @@ -53,7 +53,7 @@ std::unique_ptr<CJBig2_PatternDict> CJBig2_PDDProc::DecodeArith( GRAY = 0; while (GRAY <= GRAYMAX) { - pDict->HDPATS[GRAY] = BHDC->subImage(HDPW * GRAY, 0, HDPW, HDPH); + pDict->HDPATS[GRAY] = BHDC->SubImage(HDPW * GRAY, 0, HDPW, HDPH); GRAY = GRAY + 1; } return pDict; @@ -75,7 +75,7 @@ std::unique_ptr<CJBig2_PatternDict> CJBig2_PDDProc::DecodeMMR( GRAY = 0; while (GRAY <= GRAYMAX) { - pDict->HDPATS[GRAY] = BHDC->subImage(HDPW * GRAY, 0, HDPW, HDPH); + pDict->HDPATS[GRAY] = BHDC->SubImage(HDPW * GRAY, 0, HDPW, HDPH); GRAY = GRAY + 1; } return pDict; diff --git a/core/fxcodec/jbig2/JBig2_SddProc.cpp b/core/fxcodec/jbig2/JBig2_SddProc.cpp index cf95ec175f..6bf40efd8f 100644 --- a/core/fxcodec/jbig2/JBig2_SddProc.cpp +++ b/core/fxcodec/jbig2/JBig2_SddProc.cpp @@ -468,7 +468,7 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::DecodeHuffman( continue; for (I = HCFIRSTSYM; I < NSYMSDECODED; ++I) { - SDNEWSYMS[I] = BHC->subImage(nTmp, 0, SDNEWSYMWIDTHS[I], HCHEIGHT); + SDNEWSYMS[I] = BHC->SubImage(nTmp, 0, SDNEWSYMWIDTHS[I], HCHEIGHT); nTmp += SDNEWSYMWIDTHS[I]; } } diff --git a/core/fxcodec/jbig2/JBig2_TrdProc.cpp b/core/fxcodec/jbig2/JBig2_TrdProc.cpp index 796bd4cb23..5c93ced616 100644 --- a/core/fxcodec/jbig2/JBig2_TrdProc.cpp +++ b/core/fxcodec/jbig2/JBig2_TrdProc.cpp @@ -27,7 +27,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_TRDProc::DecodeHuffman( if (!SBREG->data()) return nullptr; - SBREG->fill(SBDEFPIXEL); + SBREG->Fill(SBDEFPIXEL); int32_t INITIAL_STRIPT; auto pHuffmanDecoder = pdfium::MakeUnique<CJBig2_HuffmanDecoder>(pStream); if (pHuffmanDecoder->DecodeAValue(SBHUFFDT, &INITIAL_STRIPT) != 0) @@ -237,7 +237,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_TRDProc::DecodeArith( pIAID = pdfium::MakeUnique<CJBig2_ArithIaidDecoder>(SBSYMCODELEN); } - SBREG->fill(SBDEFPIXEL); + SBREG->Fill(SBDEFPIXEL); FX_SAFE_INT32 STRIPT = INITIAL_STRIPT; STRIPT *= SBSTRIPS; |