summaryrefslogtreecommitdiff
path: root/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_GrrdProc.cpp')
-rw-r--r--core/fxcodec/jbig2/JBig2_GrrdProc.cpp188
1 files changed, 91 insertions, 97 deletions
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;