Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp

Issue 1293393002: Remove a bunch of dead JBIG2 code. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: nit Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "JBig2_GeneralDecoder.h" 7 #include "JBig2_GeneralDecoder.h"
8 #include "JBig2_ArithDecoder.h" 8 #include "JBig2_ArithDecoder.h"
9 #include "JBig2_ArithIntDecoder.h" 9 #include "JBig2_ArithIntDecoder.h"
10 #include "JBig2_HuffmanDecoder.h" 10 #include "JBig2_HuffmanDecoder.h"
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 if (bVal) { 1052 if (bVal) {
1053 GBREG->setPixel(w, h, bVal); 1053 GBREG->setPixel(w, h, bVal);
1054 } 1054 }
1055 line1 = ((line1 << 1) | GBREG->getPixel(w + 2, h - 1)) & 0x1f; 1055 line1 = ((line1 << 1) | GBREG->getPixel(w + 2, h - 1)) & 0x1f;
1056 line2 = ((line2 << 1) | bVal) & 0x0f; 1056 line2 = ((line2 << 1) | bVal) & 0x0f;
1057 } 1057 }
1058 } 1058 }
1059 } 1059 }
1060 return GBREG; 1060 return GBREG;
1061 } 1061 }
1062 CJBig2_Image* CJBig2_GRDProc::decode_Arith_V2(
1063 CJBig2_ArithDecoder* pArithDecoder,
1064 JBig2ArithCtx* gbContext) {
1065 FX_BOOL LTP, SLTP, bVal;
1066 FX_DWORD CONTEXT;
1067 CJBig2_Image* GBREG;
1068 FX_DWORD line1, line2, line3;
1069 LTP = 0;
1070 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH));
1071 GBREG->fill(0);
1072 for (FX_DWORD h = 0; h < GBH; h++) {
1073 if (TPGDON) {
1074 switch (GBTEMPLATE) {
1075 case 0:
1076 CONTEXT = 0x9b25;
1077 break;
1078 case 1:
1079 CONTEXT = 0x0795;
1080 break;
1081 case 2:
1082 CONTEXT = 0x00e5;
1083 break;
1084 case 3:
1085 CONTEXT = 0x0195;
1086 break;
1087 }
1088 SLTP = pArithDecoder->DECODE(&gbContext[CONTEXT]);
1089 LTP = LTP ^ SLTP;
1090 }
1091 if (LTP == 1) {
1092 GBREG->copyLine(h, h - 1);
1093 } else {
1094 switch (GBTEMPLATE) {
1095 case 0: {
1096 line1 = GBREG->getPixel(1, h - 2);
1097 line1 |= GBREG->getPixel(0, h - 2) << 1;
1098 line2 = GBREG->getPixel(2, h - 1);
1099 line2 |= GBREG->getPixel(1, h - 1) << 1;
1100 line2 |= GBREG->getPixel(0, h - 1) << 2;
1101 line3 = 0;
1102 for (FX_DWORD w = 0; w < GBW; w++) {
1103 if (USESKIP && SKIP->getPixel(w, h)) {
1104 bVal = 0;
1105 } else {
1106 CONTEXT = line3;
1107 CONTEXT |= GBREG->getPixel(w + GBAT[0], h + GBAT[1]) << 4;
1108 CONTEXT |= line2 << 5;
1109 CONTEXT |= GBREG->getPixel(w + GBAT[2], h + GBAT[3]) << 10;
1110 CONTEXT |= GBREG->getPixel(w + GBAT[4], h + GBAT[5]) << 11;
1111 CONTEXT |= line1 << 12;
1112 CONTEXT |= GBREG->getPixel(w + GBAT[6], h + GBAT[7]) << 15;
1113 bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
1114 }
1115 if (bVal) {
1116 GBREG->setPixel(w, h, bVal);
1117 }
1118 line1 = ((line1 << 1) | GBREG->getPixel(w + 2, h - 2)) & 0x07;
1119 line2 = ((line2 << 1) | GBREG->getPixel(w + 3, h - 1)) & 0x1f;
1120 line3 = ((line3 << 1) | bVal) & 0x0f;
1121 }
1122 } break;
1123 case 1: {
1124 line1 = GBREG->getPixel(2, h - 2);
1125 line1 |= GBREG->getPixel(1, h - 2) << 1;
1126 line1 |= GBREG->getPixel(0, h - 2) << 2;
1127 line2 = GBREG->getPixel(2, h - 1);
1128 line2 |= GBREG->getPixel(1, h - 1) << 1;
1129 line2 |= GBREG->getPixel(0, h - 1) << 2;
1130 line3 = 0;
1131 for (FX_DWORD w = 0; w < GBW; w++) {
1132 if (USESKIP && SKIP->getPixel(w, h)) {
1133 bVal = 0;
1134 } else {
1135 CONTEXT = line3;
1136 CONTEXT |= GBREG->getPixel(w + GBAT[0], h + GBAT[1]) << 3;
1137 CONTEXT |= line2 << 4;
1138 CONTEXT |= line1 << 9;
1139 bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
1140 }
1141 if (bVal) {
1142 GBREG->setPixel(w, h, bVal);
1143 }
1144 line1 = ((line1 << 1) | GBREG->getPixel(w + 3, h - 2)) & 0x0f;
1145 line2 = ((line2 << 1) | GBREG->getPixel(w + 3, h - 1)) & 0x1f;
1146 line3 = ((line3 << 1) | bVal) & 0x07;
1147 }
1148 } break;
1149 case 2: {
1150 line1 = GBREG->getPixel(1, h - 2);
1151 line1 |= GBREG->getPixel(0, h - 2) << 1;
1152 line2 = GBREG->getPixel(1, h - 1);
1153 line2 |= GBREG->getPixel(0, h - 1) << 1;
1154 line3 = 0;
1155 for (FX_DWORD w = 0; w < GBW; w++) {
1156 if (USESKIP && SKIP->getPixel(w, h)) {
1157 bVal = 0;
1158 } else {
1159 CONTEXT = line3;
1160 CONTEXT |= GBREG->getPixel(w + GBAT[0], h + GBAT[1]) << 2;
1161 CONTEXT |= line2 << 3;
1162 CONTEXT |= line1 << 7;
1163 bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
1164 }
1165 if (bVal) {
1166 GBREG->setPixel(w, h, bVal);
1167 }
1168 line1 = ((line1 << 1) | GBREG->getPixel(w + 2, h - 2)) & 0x07;
1169 line2 = ((line2 << 1) | GBREG->getPixel(w + 2, h - 1)) & 0x0f;
1170 line3 = ((line3 << 1) | bVal) & 0x03;
1171 }
1172 } break;
1173 case 3: {
1174 line1 = GBREG->getPixel(1, h - 1);
1175 line1 |= GBREG->getPixel(0, h - 1) << 1;
1176 line2 = 0;
1177 for (FX_DWORD w = 0; w < GBW; w++) {
1178 if (USESKIP && SKIP->getPixel(w, h)) {
1179 bVal = 0;
1180 } else {
1181 CONTEXT = line2;
1182 CONTEXT |= GBREG->getPixel(w + GBAT[0], h + GBAT[1]) << 4;
1183 CONTEXT |= line1 << 5;
1184 bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
1185 }
1186 if (bVal) {
1187 GBREG->setPixel(w, h, bVal);
1188 }
1189 line1 = ((line1 << 1) | GBREG->getPixel(w + 2, h - 1)) & 0x1f;
1190 line2 = ((line2 << 1) | bVal) & 0x0f;
1191 }
1192 } break;
1193 }
1194 }
1195 }
1196 return GBREG;
1197 }
1198 CJBig2_Image* CJBig2_GRDProc::decode_Arith_V1(
1199 CJBig2_ArithDecoder* pArithDecoder,
1200 JBig2ArithCtx* gbContext) {
1201 FX_BOOL LTP, SLTP, bVal;
1202 FX_DWORD CONTEXT = 0;
1203 CJBig2_Image* GBREG;
1204 LTP = 0;
1205 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH));
1206 GBREG->fill(0);
1207 for (FX_DWORD h = 0; h < GBH; h++) {
1208 if (TPGDON) {
1209 switch (GBTEMPLATE) {
1210 case 0:
1211 CONTEXT = 0x9b25;
1212 break;
1213 case 1:
1214 CONTEXT = 0x0795;
1215 break;
1216 case 2:
1217 CONTEXT = 0x00e5;
1218 break;
1219 case 3:
1220 CONTEXT = 0x0195;
1221 break;
1222 }
1223 SLTP = pArithDecoder->DECODE(&gbContext[CONTEXT]);
1224 LTP = LTP ^ SLTP;
1225 }
1226 if (LTP == 1) {
1227 for (FX_DWORD w = 0; w < GBW; w++) {
1228 GBREG->setPixel(w, h, GBREG->getPixel(w, h - 1));
1229 }
1230 } else {
1231 for (FX_DWORD w = 0; w < GBW; w++) {
1232 if (USESKIP && SKIP->getPixel(w, h)) {
1233 GBREG->setPixel(w, h, 0);
1234 } else {
1235 CONTEXT = 0;
1236 switch (GBTEMPLATE) {
1237 case 0:
1238 CONTEXT |= GBREG->getPixel(w - 1, h);
1239 CONTEXT |= GBREG->getPixel(w - 2, h) << 1;
1240 CONTEXT |= GBREG->getPixel(w - 3, h) << 2;
1241 CONTEXT |= GBREG->getPixel(w - 4, h) << 3;
1242 CONTEXT |= GBREG->getPixel(w + GBAT[0], h + GBAT[1]) << 4;
1243 CONTEXT |= GBREG->getPixel(w + 2, h - 1) << 5;
1244 CONTEXT |= GBREG->getPixel(w + 1, h - 1) << 6;
1245 CONTEXT |= GBREG->getPixel(w, h - 1) << 7;
1246 CONTEXT |= GBREG->getPixel(w - 1, h - 1) << 8;
1247 CONTEXT |= GBREG->getPixel(w - 2, h - 1) << 9;
1248 CONTEXT |= GBREG->getPixel(w + GBAT[2], h + GBAT[3]) << 10;
1249 CONTEXT |= GBREG->getPixel(w + GBAT[4], h + GBAT[5]) << 11;
1250 CONTEXT |= GBREG->getPixel(w + 1, h - 2) << 12;
1251 CONTEXT |= GBREG->getPixel(w, h - 2) << 13;
1252 CONTEXT |= GBREG->getPixel(w - 1, h - 2) << 14;
1253 CONTEXT |= GBREG->getPixel(w + GBAT[6], h + GBAT[7]) << 15;
1254 break;
1255 case 1:
1256 CONTEXT |= GBREG->getPixel(w - 1, h);
1257 CONTEXT |= GBREG->getPixel(w - 2, h) << 1;
1258 CONTEXT |= GBREG->getPixel(w - 3, h) << 2;
1259 CONTEXT |= GBREG->getPixel(w + GBAT[0], h + GBAT[1]) << 3;
1260 CONTEXT |= GBREG->getPixel(w + 2, h - 1) << 4;
1261 CONTEXT |= GBREG->getPixel(w + 1, h - 1) << 5;
1262 CONTEXT |= GBREG->getPixel(w, h - 1) << 6;
1263 CONTEXT |= GBREG->getPixel(w - 1, h - 1) << 7;
1264 CONTEXT |= GBREG->getPixel(w - 2, h - 1) << 8;
1265 CONTEXT |= GBREG->getPixel(w + 2, h - 2) << 9;
1266 CONTEXT |= GBREG->getPixel(w + 1, h - 2) << 10;
1267 CONTEXT |= GBREG->getPixel(w, h - 2) << 11;
1268 CONTEXT |= GBREG->getPixel(w - 1, h - 2) << 12;
1269 break;
1270 case 2:
1271 CONTEXT |= GBREG->getPixel(w - 1, h);
1272 CONTEXT |= GBREG->getPixel(w - 2, h) << 1;
1273 CONTEXT |= GBREG->getPixel(w + GBAT[0], h + GBAT[1]) << 2;
1274 CONTEXT |= GBREG->getPixel(w + 1, h - 1) << 3;
1275 CONTEXT |= GBREG->getPixel(w, h - 1) << 4;
1276 CONTEXT |= GBREG->getPixel(w - 1, h - 1) << 5;
1277 CONTEXT |= GBREG->getPixel(w - 2, h - 1) << 6;
1278 CONTEXT |= GBREG->getPixel(w + 1, h - 2) << 7;
1279 CONTEXT |= GBREG->getPixel(w, h - 2) << 8;
1280 CONTEXT |= GBREG->getPixel(w - 1, h - 2) << 9;
1281 break;
1282 case 3:
1283 CONTEXT |= GBREG->getPixel(w - 1, h);
1284 CONTEXT |= GBREG->getPixel(w - 2, h) << 1;
1285 CONTEXT |= GBREG->getPixel(w - 3, h) << 2;
1286 CONTEXT |= GBREG->getPixel(w - 4, h) << 3;
1287 CONTEXT |= GBREG->getPixel(w + GBAT[0], h + GBAT[1]) << 4;
1288 CONTEXT |= GBREG->getPixel(w + 1, h - 1) << 5;
1289 CONTEXT |= GBREG->getPixel(w, h - 1) << 6;
1290 CONTEXT |= GBREG->getPixel(w - 1, h - 1) << 7;
1291 CONTEXT |= GBREG->getPixel(w - 2, h - 1) << 8;
1292 CONTEXT |= GBREG->getPixel(w - 3, h - 1) << 9;
1293 break;
1294 }
1295 bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
1296 GBREG->setPixel(w, h, bVal);
1297 }
1298 }
1299 }
1300 }
1301 return GBREG;
1302 }
1303 CJBig2_Image* CJBig2_GRDProc::decode_MMR(CJBig2_BitStream* pStream) {
1304 int bitpos, i;
1305 CJBig2_Image* pImage;
1306 JBIG2_ALLOC(pImage, CJBig2_Image(GBW, GBH));
1307 if (pImage->m_pData == NULL) {
1308 delete pImage;
1309 m_pModule->JBig2_Error(
1310 "Generic region decoding procedure: Create Image Failed with width = "
1311 "%d, height = %d\n",
1312 GBW, GBH);
1313 return NULL;
1314 }
1315 bitpos = (int)pStream->getBitPos();
1316 _FaxG4Decode(m_pModule, pStream->getBuf(), pStream->getLength(), &bitpos,
1317 pImage->m_pData, GBW, GBH, pImage->m_nStride);
1318 pStream->setBitPos(bitpos);
1319 for (i = 0; (FX_DWORD)i < pImage->m_nStride * GBH; i++) {
1320 pImage->m_pData[i] = ~pImage->m_pData[i];
1321 }
1322 return pImage;
1323 }
1324 CJBig2_Image* CJBig2_GRRDProc::decode(CJBig2_ArithDecoder* pArithDecoder, 1062 CJBig2_Image* CJBig2_GRRDProc::decode(CJBig2_ArithDecoder* pArithDecoder,
1325 JBig2ArithCtx* grContext) { 1063 JBig2ArithCtx* grContext) {
1326 if (GRW == 0 || GRH == 0) { 1064 if (GRW == 0 || GRH == 0) {
1327 CJBig2_Image* pImage; 1065 CJBig2_Image* pImage;
1328 JBIG2_ALLOC(pImage, CJBig2_Image(GRW, GRH)); 1066 JBIG2_ALLOC(pImage, CJBig2_Image(GRW, GRH));
1329 return pImage; 1067 return pImage;
1330 } 1068 }
1331 if (GRTEMPLATE == 0) { 1069 if (GRTEMPLATE == 0) {
1332 if ((GRAT[0] == (signed char)-1) && (GRAT[1] == (signed char)-1) && 1070 if ((GRAT[0] == (signed char)-1) && (GRAT[1] == (signed char)-1) &&
1333 (GRAT[2] == (signed char)-1) && (GRAT[3] == (signed char)-1) && 1071 (GRAT[2] == (signed char)-1) && (GRAT[3] == (signed char)-1) &&
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1825 pLine[w >> 3] = cVal; 1563 pLine[w >> 3] = cVal;
1826 } 1564 }
1827 } 1565 }
1828 pLine += nStride; 1566 pLine += nStride;
1829 if (h < GRHR + GRREFERENCEDY) { 1567 if (h < GRHR + GRREFERENCEDY) {
1830 pLineR += nStrideR; 1568 pLineR += nStrideR;
1831 } 1569 }
1832 } 1570 }
1833 return GRREG; 1571 return GRREG;
1834 } 1572 }
1835 CJBig2_Image* CJBig2_GRRDProc::decode_V1(CJBig2_ArithDecoder* pArithDecoder, 1573
1836 JBig2ArithCtx* grContext) {
1837 FX_BOOL LTP, SLTP, bVal;
1838 FX_BOOL TPGRPIX, TPGRVAL;
1839 FX_DWORD CONTEXT;
1840 CJBig2_Image* GRREG;
1841 LTP = 0;
1842 JBIG2_ALLOC(GRREG, CJBig2_Image(GRW, GRH));
1843 GRREG->fill(0);
1844 for (FX_DWORD h = 0; h < GRH; h++) {
1845 if (TPGRON) {
1846 switch (GRTEMPLATE) {
1847 case 0:
1848 CONTEXT = 0x0010;
1849 break;
1850 case 1:
1851 CONTEXT = 0x0008;
1852 break;
1853 }
1854 SLTP = pArithDecoder->DECODE(&grContext[CONTEXT]);
1855 LTP = LTP ^ SLTP;
1856 }
1857 if (LTP == 0) {
1858 for (FX_DWORD w = 0; w < GRW; w++) {
1859 CONTEXT = 0;
1860 switch (GRTEMPLATE) {
1861 case 0:
1862 CONTEXT |= GRREFERENCE->getPixel(w - GRREFERENCEDX + 1,
1863 h - GRREFERENCEDY + 1);
1864 CONTEXT |=
1865 GRREFERENCE->getPixel(w - GRREFERENCEDX, h - GRREFERENCEDY + 1)
1866 << 1;
1867 CONTEXT |= GRREFERENCE->getPixel(w - GRREFERENCEDX - 1,
1868 h - GRREFERENCEDY + 1)
1869 << 2;
1870 CONTEXT |=
1871 GRREFERENCE->getPixel(w - GRREFERENCEDX + 1, h - GRREFERENCEDY)
1872 << 3;
1873 CONTEXT |=
1874 GRREFERENCE->getPixel(w - GRREFERENCEDX, h - GRREFERENCEDY)
1875 << 4;
1876 CONTEXT |=
1877 GRREFERENCE->getPixel(w - GRREFERENCEDX - 1, h - GRREFERENCEDY)
1878 << 5;
1879 CONTEXT |= GRREFERENCE->getPixel(w - GRREFERENCEDX + 1,
1880 h - GRREFERENCEDY - 1)
1881 << 6;
1882 CONTEXT |=
1883 GRREFERENCE->getPixel(w - GRREFERENCEDX, h - GRREFERENCEDY - 1)
1884 << 7;
1885 CONTEXT |= GRREFERENCE->getPixel(w - GRREFERENCEDX + GRAT[2],
1886 h - GRREFERENCEDY + GRAT[3])
1887 << 8;
1888 CONTEXT |= GRREG->getPixel(w - 1, h) << 9;
1889 CONTEXT |= GRREG->getPixel(w + 1, h - 1) << 10;
1890 CONTEXT |= GRREG->getPixel(w, h - 1) << 11;
1891 CONTEXT |= GRREG->getPixel(w + GRAT[0], h + GRAT[1]) << 12;
1892 break;
1893 case 1:
1894 CONTEXT |= GRREFERENCE->getPixel(w - GRREFERENCEDX + 1,
1895 h - GRREFERENCEDY + 1);
1896 CONTEXT |=
1897 GRREFERENCE->getPixel(w - GRREFERENCEDX, h - GRREFERENCEDY + 1)
1898 << 1;
1899 CONTEXT |=
1900 GRREFERENCE->getPixel(w - GRREFERENCEDX + 1, h - GRREFERENCEDY)
1901 << 2;
1902 CONTEXT |=
1903 GRREFERENCE->getPixel(w - GRREFERENCEDX, h - GRREFERENCEDY)
1904 << 3;
1905 CONTEXT |=
1906 GRREFERENCE->getPixel(w - GRREFERENCEDX - 1, h - GRREFERENCEDY)
1907 << 4;
1908 CONTEXT |=
1909 GRREFERENCE->getPixel(w - GRREFERENCEDX, h - GRREFERENCEDY - 1)
1910 << 5;
1911 CONTEXT |= GRREG->getPixel(w - 1, h) << 6;
1912 CONTEXT |= GRREG->getPixel(w + 1, h - 1) << 7;
1913 CONTEXT |= GRREG->getPixel(w, h - 1) << 8;
1914 CONTEXT |= GRREG->getPixel(w - 1, h - 1) << 9;
1915 break;
1916 }
1917 bVal = pArithDecoder->DECODE(&grContext[CONTEXT]);
1918 GRREG->setPixel(w, h, bVal);
1919 }
1920 } else {
1921 for (FX_DWORD w = 0; w < GRW; w++) {
1922 bVal = GRREFERENCE->getPixel(w, h);
1923 if (TPGRON && (bVal == GRREFERENCE->getPixel(w - 1, h - 1)) &&
1924 (bVal == GRREFERENCE->getPixel(w, h - 1)) &&
1925 (bVal == GRREFERENCE->getPixel(w + 1, h - 1)) &&
1926 (bVal == GRREFERENCE->getPixel(w - 1, h)) &&
1927 (bVal == GRREFERENCE->getPixel(w + 1, h)) &&
1928 (bVal == GRREFERENCE->getPixel(w - 1, h + 1)) &&
1929 (bVal == GRREFERENCE->getPixel(w, h + 1)) &&
1930 (bVal == GRREFERENCE->getPixel(w + 1, h + 1))) {
1931 TPGRPIX = 1;
1932 TPGRVAL = bVal;
1933 } else {
1934 TPGRPIX = 0;
1935 }
1936 if (TPGRPIX) {
1937 GRREG->setPixel(w, h, TPGRVAL);
1938 } else {
1939 CONTEXT = 0;
1940 switch (GRTEMPLATE) {
1941 case 0:
1942 CONTEXT |= GRREFERENCE->getPixel(w - GRREFERENCEDX + 1,
1943 h - GRREFERENCEDY + 1);
1944 CONTEXT |= GRREFERENCE->getPixel(w - GRREFERENCEDX,
1945 h - GRREFERENCEDY + 1)
1946 << 1;
1947 CONTEXT |= GRREFERENCE->getPixel(w - GRREFERENCEDX - 1,
1948 h - GRREFERENCEDY + 1)
1949 << 2;
1950 CONTEXT |= GRREFERENCE->getPixel(w - GRREFERENCEDX + 1,
1951 h - GRREFERENCEDY)
1952 << 3;
1953 CONTEXT |=
1954 GRREFERENCE->getPixel(w - GRREFERENCEDX, h - GRREFERENCEDY)
1955 << 4;
1956 CONTEXT |= GRREFERENCE->getPixel(w - GRREFERENCEDX - 1,
1957 h - GRREFERENCEDY)
1958 << 5;
1959 CONTEXT |= GRREFERENCE->getPixel(w - GRREFERENCEDX + 1,
1960 h - GRREFERENCEDY - 1)
1961 << 6;
1962 CONTEXT |= GRREFERENCE->getPixel(w - GRREFERENCEDX,
1963 h - GRREFERENCEDY - 1)
1964 << 7;
1965 CONTEXT |= GRREFERENCE->getPixel(w - GRREFERENCEDX + GRAT[2],
1966 h - GRREFERENCEDY + GRAT[3])
1967 << 8;
1968 CONTEXT |= GRREG->getPixel(w - 1, h) << 9;
1969 CONTEXT |= GRREG->getPixel(w + 1, h - 1) << 10;
1970 CONTEXT |= GRREG->getPixel(w, h - 1) << 11;
1971 CONTEXT |= GRREG->getPixel(w + GRAT[0], h + GRAT[1]) << 12;
1972 break;
1973 case 1:
1974 CONTEXT |= GRREFERENCE->getPixel(w - GRREFERENCEDX + 1,
1975 h - GRREFERENCEDY + 1);
1976 CONTEXT |= GRREFERENCE->getPixel(w - GRREFERENCEDX,
1977 h - GRREFERENCEDY + 1)
1978 << 1;
1979 CONTEXT |= GRREFERENCE->getPixel(w - GRREFERENCEDX + 1,
1980 h - GRREFERENCEDY)
1981 << 2;
1982 CONTEXT |=
1983 GRREFERENCE->getPixel(w - GRREFERENCEDX, h - GRREFERENCEDY)
1984 << 3;
1985 CONTEXT |= GRREFERENCE->getPixel(w - GRREFERENCEDX - 1,
1986 h - GRREFERENCEDY)
1987 << 4;
1988 CONTEXT |= GRREFERENCE->getPixel(w - GRREFERENCEDX,
1989 h - GRREFERENCEDY - 1)
1990 << 5;
1991 CONTEXT |= GRREG->getPixel(w - 1, h) << 6;
1992 CONTEXT |= GRREG->getPixel(w + 1, h - 1) << 7;
1993 CONTEXT |= GRREG->getPixel(w, h - 1) << 8;
1994 CONTEXT |= GRREG->getPixel(w - 1, h - 1) << 9;
1995 break;
1996 }
1997 bVal = pArithDecoder->DECODE(&grContext[CONTEXT]);
1998 GRREG->setPixel(w, h, bVal);
1999 }
2000 }
2001 }
2002 }
2003 return GRREG;
2004 }
2005 CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, 1574 CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream,
2006 JBig2ArithCtx* grContext) { 1575 JBig2ArithCtx* grContext) {
2007 int32_t STRIPT, FIRSTS; 1576 int32_t STRIPT, FIRSTS;
2008 FX_DWORD NINSTANCES; 1577 FX_DWORD NINSTANCES;
2009 int32_t DT, DFS, CURS; 1578 int32_t DT, DFS, CURS;
2010 uint8_t CURT; 1579 uint8_t CURT;
2011 int32_t SI, TI; 1580 int32_t SI, TI;
2012 FX_DWORD IDI; 1581 FX_DWORD IDI;
2013 CJBig2_Image* IBI; 1582 CJBig2_Image* IBI;
2014 FX_DWORD WI, HI; 1583 FX_DWORD WI, HI;
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after
3715 } 3284 }
3716 m_ReplaceRect.left = 0; 3285 m_ReplaceRect.left = 0;
3717 m_ReplaceRect.right = pImage->m_nWidth; 3286 m_ReplaceRect.right = pImage->m_nWidth;
3718 m_ReplaceRect.top = iline; 3287 m_ReplaceRect.top = iline;
3719 m_ReplaceRect.bottom = m_loopIndex; 3288 m_ReplaceRect.bottom = m_loopIndex;
3720 if (m_ProssiveStatus == FXCODEC_STATUS_DECODE_FINISH) { 3289 if (m_ProssiveStatus == FXCODEC_STATUS_DECODE_FINISH) {
3721 m_loopIndex = 0; 3290 m_loopIndex = 0;
3722 } 3291 }
3723 return m_ProssiveStatus; 3292 return m_ProssiveStatus;
3724 } 3293 }
3725 FXCODEC_STATUS CJBig2_GRDProc::Start_decode_Arith_V2(
3726 CJBig2_Image** pImage,
3727 CJBig2_ArithDecoder* pArithDecoder,
3728 JBig2ArithCtx* gbContext,
3729 IFX_Pause* pPause) {
3730 if (GBW == 0 || GBH == 0) {
3731 *pImage = NULL;
3732 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
3733 return FXCODEC_STATUS_DECODE_FINISH;
3734 }
3735 if (*pImage == NULL) {
3736 JBIG2_ALLOC((*pImage), CJBig2_Image(GBW, GBH));
3737 }
3738 if ((*pImage)->m_pData == NULL) {
3739 delete *pImage;
3740 *pImage = NULL;
3741 m_pModule->JBig2_Error(
3742 "Generic region decoding procedure: Create Image Failed with width = "
3743 "%d, height = %d\n",
3744 GBW, GBH);
3745 m_ProssiveStatus = FXCODEC_STATUS_ERROR;
3746 return FXCODEC_STATUS_ERROR;
3747 }
3748 m_ProssiveStatus = FXCODEC_STATUS_DECODE_READY;
3749 m_DecodeType = 2;
3750 m_pPause = pPause;
3751 m_pImage = pImage;
3752 (*m_pImage)->fill(0);
3753 LTP = 0;
3754 m_loopIndex = 0;
3755 m_pArithDecoder = pArithDecoder;
3756 m_gbContext = gbContext;
3757 return decode_Arith_V2(pPause);
3758 }
3759 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_V2(IFX_Pause* pPause) {
3760 FX_BOOL SLTP, bVal;
3761 FX_DWORD CONTEXT;
3762 CJBig2_Image* GBREG = *m_pImage;
3763 FX_DWORD line1, line2, line3;
3764 LTP = 0;
3765 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH));
3766 GBREG->fill(0);
3767 for (; m_loopIndex < GBH; m_loopIndex++) {
3768 if (TPGDON) {
3769 switch (GBTEMPLATE) {
3770 case 0:
3771 CONTEXT = 0x9b25;
3772 break;
3773 case 1:
3774 CONTEXT = 0x0795;
3775 break;
3776 case 2:
3777 CONTEXT = 0x00e5;
3778 break;
3779 case 3:
3780 CONTEXT = 0x0195;
3781 break;
3782 }
3783 SLTP = m_pArithDecoder->DECODE(&m_gbContext[CONTEXT]);
3784 LTP = LTP ^ SLTP;
3785 }
3786 if (LTP == 1) {
3787 GBREG->copyLine(m_loopIndex, m_loopIndex - 1);
3788 } else {
3789 switch (GBTEMPLATE) {
3790 case 0: {
3791 line1 = GBREG->getPixel(1, m_loopIndex - 2);
3792 line1 |= GBREG->getPixel(0, m_loopIndex - 2) << 1;
3793 line2 = GBREG->getPixel(2, m_loopIndex - 1);
3794 line2 |= GBREG->getPixel(1, m_loopIndex - 1) << 1;
3795 line2 |= GBREG->getPixel(0, m_loopIndex - 1) << 2;
3796 line3 = 0;
3797 for (FX_DWORD w = 0; w < GBW; w++) {
3798 if (USESKIP && SKIP->getPixel(w, m_loopIndex)) {
3799 bVal = 0;
3800 } else {
3801 CONTEXT = line3;
3802 CONTEXT |= GBREG->getPixel(w + GBAT[0], m_loopIndex + GBAT[1])
3803 << 4;
3804 CONTEXT |= line2 << 5;
3805 CONTEXT |= GBREG->getPixel(w + GBAT[2], m_loopIndex + GBAT[3])
3806 << 10;
3807 CONTEXT |= GBREG->getPixel(w + GBAT[4], m_loopIndex + GBAT[5])
3808 << 11;
3809 CONTEXT |= line1 << 12;
3810 CONTEXT |= GBREG->getPixel(w + GBAT[6], m_loopIndex + GBAT[7])
3811 << 15;
3812 bVal = m_pArithDecoder->DECODE(&m_gbContext[CONTEXT]);
3813 }
3814 if (bVal) {
3815 GBREG->setPixel(w, m_loopIndex, bVal);
3816 }
3817 line1 =
3818 ((line1 << 1) | GBREG->getPixel(w + 2, m_loopIndex - 2)) & 0x07;
3819 line2 =
3820 ((line2 << 1) | GBREG->getPixel(w + 3, m_loopIndex - 1)) & 0x1f;
3821 line3 = ((line3 << 1) | bVal) & 0x0f;
3822 }
3823 } break;
3824 case 1: {
3825 line1 = GBREG->getPixel(2, m_loopIndex - 2);
3826 line1 |= GBREG->getPixel(1, m_loopIndex - 2) << 1;
3827 line1 |= GBREG->getPixel(0, m_loopIndex - 2) << 2;
3828 line2 = GBREG->getPixel(2, m_loopIndex - 1);
3829 line2 |= GBREG->getPixel(1, m_loopIndex - 1) << 1;
3830 line2 |= GBREG->getPixel(0, m_loopIndex - 1) << 2;
3831 line3 = 0;
3832 for (FX_DWORD w = 0; w < GBW; w++) {
3833 if (USESKIP && SKIP->getPixel(w, m_loopIndex)) {
3834 bVal = 0;
3835 } else {
3836 CONTEXT = line3;
3837 CONTEXT |= GBREG->getPixel(w + GBAT[0], m_loopIndex + GBAT[1])
3838 << 3;
3839 CONTEXT |= line2 << 4;
3840 CONTEXT |= line1 << 9;
3841 bVal = m_pArithDecoder->DECODE(&m_gbContext[CONTEXT]);
3842 }
3843 if (bVal) {
3844 GBREG->setPixel(w, m_loopIndex, bVal);
3845 }
3846 line1 =
3847 ((line1 << 1) | GBREG->getPixel(w + 3, m_loopIndex - 2)) & 0x0f;
3848 line2 =
3849 ((line2 << 1) | GBREG->getPixel(w + 3, m_loopIndex - 1)) & 0x1f;
3850 line3 = ((line3 << 1) | bVal) & 0x07;
3851 }
3852 } break;
3853 case 2: {
3854 line1 = GBREG->getPixel(1, m_loopIndex - 2);
3855 line1 |= GBREG->getPixel(0, m_loopIndex - 2) << 1;
3856 line2 = GBREG->getPixel(1, m_loopIndex - 1);
3857 line2 |= GBREG->getPixel(0, m_loopIndex - 1) << 1;
3858 line3 = 0;
3859 for (FX_DWORD w = 0; w < GBW; w++) {
3860 if (USESKIP && SKIP->getPixel(w, m_loopIndex)) {
3861 bVal = 0;
3862 } else {
3863 CONTEXT = line3;
3864 CONTEXT |= GBREG->getPixel(w + GBAT[0], m_loopIndex + GBAT[1])
3865 << 2;
3866 CONTEXT |= line2 << 3;
3867 CONTEXT |= line1 << 7;
3868 bVal = m_pArithDecoder->DECODE(&m_gbContext[CONTEXT]);
3869 }
3870 if (bVal) {
3871 GBREG->setPixel(w, m_loopIndex, bVal);
3872 }
3873 line1 =
3874 ((line1 << 1) | GBREG->getPixel(w + 2, m_loopIndex - 2)) & 0x07;
3875 line2 =
3876 ((line2 << 1) | GBREG->getPixel(w + 2, m_loopIndex - 1)) & 0x0f;
3877 line3 = ((line3 << 1) | bVal) & 0x03;
3878 }
3879 } break;
3880 case 3: {
3881 line1 = GBREG->getPixel(1, m_loopIndex - 1);
3882 line1 |= GBREG->getPixel(0, m_loopIndex - 1) << 1;
3883 line2 = 0;
3884 for (FX_DWORD w = 0; w < GBW; w++) {
3885 if (USESKIP && SKIP->getPixel(w, m_loopIndex)) {
3886 bVal = 0;
3887 } else {
3888 CONTEXT = line2;
3889 CONTEXT |= GBREG->getPixel(w + GBAT[0], m_loopIndex + GBAT[1])
3890 << 4;
3891 CONTEXT |= line1 << 5;
3892 bVal = m_pArithDecoder->DECODE(&m_gbContext[CONTEXT]);
3893 }
3894 if (bVal) {
3895 GBREG->setPixel(w, m_loopIndex, bVal);
3896 }
3897 line1 =
3898 ((line1 << 1) | GBREG->getPixel(w + 2, m_loopIndex - 1)) & 0x1f;
3899 line2 = ((line2 << 1) | bVal) & 0x0f;
3900 }
3901 } break;
3902 }
3903 }
3904 if (pPause && pPause->NeedToPauseNow()) {
3905 m_loopIndex++;
3906 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE;
3907 return FXCODEC_STATUS_DECODE_TOBECONTINUE;
3908 }
3909 }
3910 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
3911 return FXCODEC_STATUS_DECODE_FINISH;
3912 }
3913 FXCODEC_STATUS CJBig2_GRDProc::Start_decode_Arith_V1(
3914 CJBig2_Image** pImage,
3915 CJBig2_ArithDecoder* pArithDecoder,
3916 JBig2ArithCtx* gbContext,
3917 IFX_Pause* pPause) {
3918 if (GBW == 0 || GBH == 0) {
3919 *pImage = NULL;
3920 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
3921 return FXCODEC_STATUS_DECODE_FINISH;
3922 }
3923 if (*pImage == NULL) {
3924 JBIG2_ALLOC((*pImage), CJBig2_Image(GBW, GBH));
3925 }
3926 if ((*pImage)->m_pData == NULL) {
3927 delete *pImage;
3928 *pImage = NULL;
3929 m_pModule->JBig2_Error(
3930 "Generic region decoding procedure: Create Image Failed with width = "
3931 "%d, height = %d\n",
3932 GBW, GBH);
3933 m_ProssiveStatus = FXCODEC_STATUS_ERROR;
3934 return FXCODEC_STATUS_ERROR;
3935 }
3936 m_ProssiveStatus = FXCODEC_STATUS_DECODE_READY;
3937 m_pPause = pPause;
3938 m_pImage = pImage;
3939 m_DecodeType = 3;
3940 (*m_pImage)->fill(0);
3941 LTP = 0;
3942 m_loopIndex = 0;
3943 m_pArithDecoder = pArithDecoder;
3944 m_gbContext = gbContext;
3945 return decode_Arith_V1(pPause);
3946 }
3947 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_V1(IFX_Pause* pPause) {
3948 FX_BOOL SLTP, bVal;
3949 FX_DWORD CONTEXT = 0;
3950 CJBig2_Image* GBREG = (*m_pImage);
3951 for (; m_loopIndex < GBH; m_loopIndex++) {
3952 if (TPGDON) {
3953 switch (GBTEMPLATE) {
3954 case 0:
3955 CONTEXT = 0x9b25;
3956 break;
3957 case 1:
3958 CONTEXT = 0x0795;
3959 break;
3960 case 2:
3961 CONTEXT = 0x00e5;
3962 break;
3963 case 3:
3964 CONTEXT = 0x0195;
3965 break;
3966 }
3967 SLTP = m_pArithDecoder->DECODE(&m_gbContext[CONTEXT]);
3968 LTP = LTP ^ SLTP;
3969 }
3970 if (LTP == 1) {
3971 for (FX_DWORD w = 0; w < GBW; w++) {
3972 GBREG->setPixel(w, m_loopIndex, GBREG->getPixel(w, m_loopIndex - 1));
3973 }
3974 } else {
3975 for (FX_DWORD w = 0; w < GBW; w++) {
3976 if (USESKIP && SKIP->getPixel(w, m_loopIndex)) {
3977 GBREG->setPixel(w, m_loopIndex, 0);
3978 } else {
3979 CONTEXT = 0;
3980 switch (GBTEMPLATE) {
3981 case 0:
3982 CONTEXT |= GBREG->getPixel(w - 1, m_loopIndex);
3983 CONTEXT |= GBREG->getPixel(w - 2, m_loopIndex) << 1;
3984 CONTEXT |= GBREG->getPixel(w - 3, m_loopIndex) << 2;
3985 CONTEXT |= GBREG->getPixel(w - 4, m_loopIndex) << 3;
3986 CONTEXT |= GBREG->getPixel(w + GBAT[0], m_loopIndex + GBAT[1])
3987 << 4;
3988 CONTEXT |= GBREG->getPixel(w + 2, m_loopIndex - 1) << 5;
3989 CONTEXT |= GBREG->getPixel(w + 1, m_loopIndex - 1) << 6;
3990 CONTEXT |= GBREG->getPixel(w, m_loopIndex - 1) << 7;
3991 CONTEXT |= GBREG->getPixel(w - 1, m_loopIndex - 1) << 8;
3992 CONTEXT |= GBREG->getPixel(w - 2, m_loopIndex - 1) << 9;
3993 CONTEXT |= GBREG->getPixel(w + GBAT[2], m_loopIndex + GBAT[3])
3994 << 10;
3995 CONTEXT |= GBREG->getPixel(w + GBAT[4], m_loopIndex + GBAT[5])
3996 << 11;
3997 CONTEXT |= GBREG->getPixel(w + 1, m_loopIndex - 2) << 12;
3998 CONTEXT |= GBREG->getPixel(w, m_loopIndex - 2) << 13;
3999 CONTEXT |= GBREG->getPixel(w - 1, m_loopIndex - 2) << 14;
4000 CONTEXT |= GBREG->getPixel(w + GBAT[6], m_loopIndex + GBAT[7])
4001 << 15;
4002 break;
4003 case 1:
4004 CONTEXT |= GBREG->getPixel(w - 1, m_loopIndex);
4005 CONTEXT |= GBREG->getPixel(w - 2, m_loopIndex) << 1;
4006 CONTEXT |= GBREG->getPixel(w - 3, m_loopIndex) << 2;
4007 CONTEXT |= GBREG->getPixel(w + GBAT[0], m_loopIndex + GBAT[1])
4008 << 3;
4009 CONTEXT |= GBREG->getPixel(w + 2, m_loopIndex - 1) << 4;
4010 CONTEXT |= GBREG->getPixel(w + 1, m_loopIndex - 1) << 5;
4011 CONTEXT |= GBREG->getPixel(w, m_loopIndex - 1) << 6;
4012 CONTEXT |= GBREG->getPixel(w - 1, m_loopIndex - 1) << 7;
4013 CONTEXT |= GBREG->getPixel(w - 2, m_loopIndex - 1) << 8;
4014 CONTEXT |= GBREG->getPixel(w + 2, m_loopIndex - 2) << 9;
4015 CONTEXT |= GBREG->getPixel(w + 1, m_loopIndex - 2) << 10;
4016 CONTEXT |= GBREG->getPixel(w, m_loopIndex - 2) << 11;
4017 CONTEXT |= GBREG->getPixel(w - 1, m_loopIndex - 2) << 12;
4018 break;
4019 case 2:
4020 CONTEXT |= GBREG->getPixel(w - 1, m_loopIndex);
4021 CONTEXT |= GBREG->getPixel(w - 2, m_loopIndex) << 1;
4022 CONTEXT |= GBREG->getPixel(w + GBAT[0], m_loopIndex + GBAT[1])
4023 << 2;
4024 CONTEXT |= GBREG->getPixel(w + 1, m_loopIndex - 1) << 3;
4025 CONTEXT |= GBREG->getPixel(w, m_loopIndex - 1) << 4;
4026 CONTEXT |= GBREG->getPixel(w - 1, m_loopIndex - 1) << 5;
4027 CONTEXT |= GBREG->getPixel(w - 2, m_loopIndex - 1) << 6;
4028 CONTEXT |= GBREG->getPixel(w + 1, m_loopIndex - 2) << 7;
4029 CONTEXT |= GBREG->getPixel(w, m_loopIndex - 2) << 8;
4030 CONTEXT |= GBREG->getPixel(w - 1, m_loopIndex - 2) << 9;
4031 break;
4032 case 3:
4033 CONTEXT |= GBREG->getPixel(w - 1, m_loopIndex);
4034 CONTEXT |= GBREG->getPixel(w - 2, m_loopIndex) << 1;
4035 CONTEXT |= GBREG->getPixel(w - 3, m_loopIndex) << 2;
4036 CONTEXT |= GBREG->getPixel(w - 4, m_loopIndex) << 3;
4037 CONTEXT |= GBREG->getPixel(w + GBAT[0], m_loopIndex + GBAT[1])
4038 << 4;
4039 CONTEXT |= GBREG->getPixel(w + 1, m_loopIndex - 1) << 5;
4040 CONTEXT |= GBREG->getPixel(w, m_loopIndex - 1) << 6;
4041 CONTEXT |= GBREG->getPixel(w - 1, m_loopIndex - 1) << 7;
4042 CONTEXT |= GBREG->getPixel(w - 2, m_loopIndex - 1) << 8;
4043 CONTEXT |= GBREG->getPixel(w - 3, m_loopIndex - 1) << 9;
4044 break;
4045 }
4046 bVal = m_pArithDecoder->DECODE(&m_gbContext[CONTEXT]);
4047 GBREG->setPixel(w, m_loopIndex, bVal);
4048 }
4049 }
4050 }
4051 if (pPause && pPause->NeedToPauseNow()) {
4052 m_loopIndex++;
4053 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE;
4054 return FXCODEC_STATUS_DECODE_TOBECONTINUE;
4055 }
4056 }
4057 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
4058 return FXCODEC_STATUS_DECODE_FINISH;
4059 }
4060 FXCODEC_STATUS CJBig2_GRDProc::Start_decode_MMR(CJBig2_Image** pImage, 3294 FXCODEC_STATUS CJBig2_GRDProc::Start_decode_MMR(CJBig2_Image** pImage,
4061 CJBig2_BitStream* pStream, 3295 CJBig2_BitStream* pStream,
4062 IFX_Pause* pPause) { 3296 IFX_Pause* pPause) {
4063 int bitpos, i; 3297 int bitpos, i;
4064 JBIG2_ALLOC((*pImage), CJBig2_Image(GBW, GBH)); 3298 JBIG2_ALLOC((*pImage), CJBig2_Image(GBW, GBH));
4065 if ((*pImage)->m_pData == NULL) { 3299 if ((*pImage)->m_pData == NULL) {
4066 delete (*pImage); 3300 delete (*pImage);
4067 (*pImage) = NULL; 3301 (*pImage) = NULL;
4068 m_pModule->JBig2_Error( 3302 m_pModule->JBig2_Error(
4069 "Generic region decoding procedure: Create Image Failed with width = " 3303 "Generic region decoding procedure: Create Image Failed with width = "
4070 "%d, height = %d\n", 3304 "%d, height = %d\n",
4071 GBW, GBH); 3305 GBW, GBH);
4072 m_ProssiveStatus = FXCODEC_STATUS_ERROR; 3306 m_ProssiveStatus = FXCODEC_STATUS_ERROR;
4073 return m_ProssiveStatus; 3307 return m_ProssiveStatus;
4074 } 3308 }
4075 bitpos = (int)pStream->getBitPos(); 3309 bitpos = (int)pStream->getBitPos();
4076 _FaxG4Decode(m_pModule, pStream->getBuf(), pStream->getLength(), &bitpos, 3310 _FaxG4Decode(m_pModule, pStream->getBuf(), pStream->getLength(), &bitpos,
4077 (*pImage)->m_pData, GBW, GBH, (*pImage)->m_nStride); 3311 (*pImage)->m_pData, GBW, GBH, (*pImage)->m_nStride);
4078 pStream->setBitPos(bitpos); 3312 pStream->setBitPos(bitpos);
4079 for (i = 0; (FX_DWORD)i < (*pImage)->m_nStride * GBH; i++) { 3313 for (i = 0; (FX_DWORD)i < (*pImage)->m_nStride * GBH; i++) {
4080 (*pImage)->m_pData[i] = ~(*pImage)->m_pData[i]; 3314 (*pImage)->m_pData[i] = ~(*pImage)->m_pData[i];
4081 } 3315 }
4082 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; 3316 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
4083 return m_ProssiveStatus; 3317 return m_ProssiveStatus;
4084 } 3318 }
4085 FXCODEC_STATUS CJBig2_GRDProc::decode_MMR() { 3319
4086 return m_ProssiveStatus;
4087 }
4088 FXCODEC_STATUS CJBig2_GRDProc::Continue_decode(IFX_Pause* pPause) { 3320 FXCODEC_STATUS CJBig2_GRDProc::Continue_decode(IFX_Pause* pPause) {
4089 if (m_ProssiveStatus != FXCODEC_STATUS_DECODE_TOBECONTINUE) { 3321 if (m_ProssiveStatus != FXCODEC_STATUS_DECODE_TOBECONTINUE)
3322 return m_ProssiveStatus;
3323
3324 if (m_DecodeType != 1) {
3325 m_ProssiveStatus = FXCODEC_STATUS_ERROR;
4090 return m_ProssiveStatus; 3326 return m_ProssiveStatus;
4091 } 3327 }
4092 switch (m_DecodeType) { 3328
4093 case 1: 3329 return decode_Arith(pPause);
4094 return decode_Arith(pPause);
4095 case 2:
4096 return decode_Arith_V2(pPause);
4097 case 3:
4098 return decode_Arith_V1(pPause);
4099 case 4:
4100 return decode_MMR();
4101 }
4102 m_ProssiveStatus = FXCODEC_STATUS_ERROR;
4103 return m_ProssiveStatus;
4104 } 3330 }
3331
4105 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3( 3332 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3(
4106 CJBig2_Image* pImage, 3333 CJBig2_Image* pImage,
4107 CJBig2_ArithDecoder* pArithDecoder, 3334 CJBig2_ArithDecoder* pArithDecoder,
4108 JBig2ArithCtx* gbContext, 3335 JBig2ArithCtx* gbContext,
4109 IFX_Pause* pPause) { 3336 IFX_Pause* pPause) {
4110 FX_BOOL SLTP, bVal; 3337 FX_BOOL SLTP, bVal;
4111 FX_DWORD CONTEXT; 3338 FX_DWORD CONTEXT;
4112 FX_DWORD line1, line2; 3339 FX_DWORD line1, line2;
4113 uint8_t *pLine1, *pLine2, cVal; 3340 uint8_t *pLine1, *pLine2, cVal;
4114 int32_t nStride, nStride2, k; 3341 int32_t nStride, nStride2, k;
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
4653 } 3880 }
4654 if (pPause && pPause->NeedToPauseNow()) { 3881 if (pPause && pPause->NeedToPauseNow()) {
4655 m_loopIndex++; 3882 m_loopIndex++;
4656 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE; 3883 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE;
4657 return FXCODEC_STATUS_DECODE_TOBECONTINUE; 3884 return FXCODEC_STATUS_DECODE_TOBECONTINUE;
4658 } 3885 }
4659 } 3886 }
4660 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; 3887 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
4661 return FXCODEC_STATUS_DECODE_FINISH; 3888 return FXCODEC_STATUS_DECODE_FINISH;
4662 } 3889 }
OLDNEW
« no previous file with comments | « core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698