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

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

Issue 1545183002: Merge to XFA: Switch from nonstd::unique_ptr to std::unique_ptr. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: xfa Created 4 years, 12 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
OLDNEW
1 // Copyright 2015 PDFium Authors. All rights reserved. 1 // Copyright 2015 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_GrdProc.h" 7 #include "JBig2_GrdProc.h"
8 8
9 #include <memory>
10
9 #include "JBig2_ArithDecoder.h" 11 #include "JBig2_ArithDecoder.h"
10 #include "JBig2_BitStream.h" 12 #include "JBig2_BitStream.h"
11 #include "JBig2_Image.h" 13 #include "JBig2_Image.h"
12 #include "core/include/fxcodec/fx_codec.h" 14 #include "core/include/fxcodec/fx_codec.h"
13 #include "third_party/base/nonstd_unique_ptr.h"
14 15
15 CJBig2_GRDProc::CJBig2_GRDProc() 16 CJBig2_GRDProc::CJBig2_GRDProc()
16 : m_loopIndex(0), 17 : m_loopIndex(0),
17 m_pLine(nullptr), 18 m_pLine(nullptr),
18 m_pPause(nullptr), 19 m_pPause(nullptr),
19 m_DecodeType(0), 20 m_DecodeType(0),
20 LTP(0) { 21 LTP(0) {
21 m_ReplaceRect.left = 0; 22 m_ReplaceRect.left = 0;
22 m_ReplaceRect.bottom = 0; 23 m_ReplaceRect.bottom = 0;
23 m_ReplaceRect.top = 0; 24 m_ReplaceRect.top = 0;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_opt3( 65 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_opt3(
65 CJBig2_ArithDecoder* pArithDecoder, 66 CJBig2_ArithDecoder* pArithDecoder,
66 JBig2ArithCtx* gbContext) { 67 JBig2ArithCtx* gbContext) {
67 FX_BOOL LTP, SLTP, bVal; 68 FX_BOOL LTP, SLTP, bVal;
68 FX_DWORD CONTEXT; 69 FX_DWORD CONTEXT;
69 FX_DWORD line1, line2; 70 FX_DWORD line1, line2;
70 uint8_t* pLine, *pLine1, *pLine2, cVal; 71 uint8_t* pLine, *pLine1, *pLine2, cVal;
71 int32_t nStride, nStride2, k; 72 int32_t nStride, nStride2, k;
72 int32_t nLineBytes, nBitsLeft, cc; 73 int32_t nLineBytes, nBitsLeft, cc;
73 LTP = 0; 74 LTP = 0;
74 nonstd::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); 75 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
75 if (!GBREG->m_pData) 76 if (!GBREG->m_pData)
76 return nullptr; 77 return nullptr;
77 78
78 pLine = GBREG->m_pData; 79 pLine = GBREG->m_pData;
79 nStride = GBREG->m_nStride; 80 nStride = GBREG->m_nStride;
80 nStride2 = nStride << 1; 81 nStride2 = nStride << 1;
81 nLineBytes = ((GBW + 7) >> 3) - 1; 82 nLineBytes = ((GBW + 7) >> 3) - 1;
82 nBitsLeft = GBW - (nLineBytes << 3); 83 nBitsLeft = GBW - (nLineBytes << 3);
83 FX_DWORD height = GBH & 0x7fffffff; 84 FX_DWORD height = GBH & 0x7fffffff;
84 for (FX_DWORD h = 0; h < height; h++) { 85 for (FX_DWORD h = 0; h < height; h++) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 return GBREG.release(); 152 return GBREG.release();
152 } 153 }
153 154
154 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_unopt( 155 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_unopt(
155 CJBig2_ArithDecoder* pArithDecoder, 156 CJBig2_ArithDecoder* pArithDecoder,
156 JBig2ArithCtx* gbContext) { 157 JBig2ArithCtx* gbContext) {
157 FX_BOOL LTP, SLTP, bVal; 158 FX_BOOL LTP, SLTP, bVal;
158 FX_DWORD CONTEXT; 159 FX_DWORD CONTEXT;
159 FX_DWORD line1, line2, line3; 160 FX_DWORD line1, line2, line3;
160 LTP = 0; 161 LTP = 0;
161 nonstd::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); 162 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
162 GBREG->fill(0); 163 GBREG->fill(0);
163 for (FX_DWORD h = 0; h < GBH; h++) { 164 for (FX_DWORD h = 0; h < GBH; h++) {
164 if (TPGDON) { 165 if (TPGDON) {
165 SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]); 166 SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]);
166 LTP = LTP ^ SLTP; 167 LTP = LTP ^ SLTP;
167 } 168 }
168 if (LTP == 1) { 169 if (LTP == 1) {
169 GBREG->copyLine(h, h - 1); 170 GBREG->copyLine(h, h - 1);
170 } else { 171 } else {
171 line1 = GBREG->getPixel(1, h - 2); 172 line1 = GBREG->getPixel(1, h - 2);
(...skipping 30 matching lines...) Expand all
202 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_opt3( 203 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_opt3(
203 CJBig2_ArithDecoder* pArithDecoder, 204 CJBig2_ArithDecoder* pArithDecoder,
204 JBig2ArithCtx* gbContext) { 205 JBig2ArithCtx* gbContext) {
205 FX_BOOL LTP, SLTP, bVal; 206 FX_BOOL LTP, SLTP, bVal;
206 FX_DWORD CONTEXT; 207 FX_DWORD CONTEXT;
207 FX_DWORD line1, line2; 208 FX_DWORD line1, line2;
208 uint8_t* pLine, *pLine1, *pLine2, cVal; 209 uint8_t* pLine, *pLine1, *pLine2, cVal;
209 int32_t nStride, nStride2, k; 210 int32_t nStride, nStride2, k;
210 int32_t nLineBytes, nBitsLeft, cc; 211 int32_t nLineBytes, nBitsLeft, cc;
211 LTP = 0; 212 LTP = 0;
212 nonstd::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); 213 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
213 if (!GBREG->m_pData) 214 if (!GBREG->m_pData)
214 return nullptr; 215 return nullptr;
215 216
216 pLine = GBREG->m_pData; 217 pLine = GBREG->m_pData;
217 nStride = GBREG->m_nStride; 218 nStride = GBREG->m_nStride;
218 nStride2 = nStride << 1; 219 nStride2 = nStride << 1;
219 nLineBytes = ((GBW + 7) >> 3) - 1; 220 nLineBytes = ((GBW + 7) >> 3) - 1;
220 nBitsLeft = GBW - (nLineBytes << 3); 221 nBitsLeft = GBW - (nLineBytes << 3);
221 for (FX_DWORD h = 0; h < GBH; h++) { 222 for (FX_DWORD h = 0; h < GBH; h++) {
222 if (TPGDON) { 223 if (TPGDON) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 return GBREG.release(); 289 return GBREG.release();
289 } 290 }
290 291
291 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_unopt( 292 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_unopt(
292 CJBig2_ArithDecoder* pArithDecoder, 293 CJBig2_ArithDecoder* pArithDecoder,
293 JBig2ArithCtx* gbContext) { 294 JBig2ArithCtx* gbContext) {
294 FX_BOOL LTP, SLTP, bVal; 295 FX_BOOL LTP, SLTP, bVal;
295 FX_DWORD CONTEXT; 296 FX_DWORD CONTEXT;
296 FX_DWORD line1, line2, line3; 297 FX_DWORD line1, line2, line3;
297 LTP = 0; 298 LTP = 0;
298 nonstd::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); 299 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
299 GBREG->fill(0); 300 GBREG->fill(0);
300 for (FX_DWORD h = 0; h < GBH; h++) { 301 for (FX_DWORD h = 0; h < GBH; h++) {
301 if (TPGDON) { 302 if (TPGDON) {
302 SLTP = pArithDecoder->DECODE(&gbContext[0x0795]); 303 SLTP = pArithDecoder->DECODE(&gbContext[0x0795]);
303 LTP = LTP ^ SLTP; 304 LTP = LTP ^ SLTP;
304 } 305 }
305 if (LTP == 1) { 306 if (LTP == 1) {
306 GBREG->copyLine(h, h - 1); 307 GBREG->copyLine(h, h - 1);
307 } else { 308 } else {
308 line1 = GBREG->getPixel(2, h - 2); 309 line1 = GBREG->getPixel(2, h - 2);
(...skipping 27 matching lines...) Expand all
336 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_opt3( 337 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_opt3(
337 CJBig2_ArithDecoder* pArithDecoder, 338 CJBig2_ArithDecoder* pArithDecoder,
338 JBig2ArithCtx* gbContext) { 339 JBig2ArithCtx* gbContext) {
339 FX_BOOL LTP, SLTP, bVal; 340 FX_BOOL LTP, SLTP, bVal;
340 FX_DWORD CONTEXT; 341 FX_DWORD CONTEXT;
341 FX_DWORD line1, line2; 342 FX_DWORD line1, line2;
342 uint8_t* pLine, *pLine1, *pLine2, cVal; 343 uint8_t* pLine, *pLine1, *pLine2, cVal;
343 int32_t nStride, nStride2, k; 344 int32_t nStride, nStride2, k;
344 int32_t nLineBytes, nBitsLeft, cc; 345 int32_t nLineBytes, nBitsLeft, cc;
345 LTP = 0; 346 LTP = 0;
346 nonstd::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); 347 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
347 if (!GBREG->m_pData) 348 if (!GBREG->m_pData)
348 return nullptr; 349 return nullptr;
349 350
350 pLine = GBREG->m_pData; 351 pLine = GBREG->m_pData;
351 nStride = GBREG->m_nStride; 352 nStride = GBREG->m_nStride;
352 nStride2 = nStride << 1; 353 nStride2 = nStride << 1;
353 nLineBytes = ((GBW + 7) >> 3) - 1; 354 nLineBytes = ((GBW + 7) >> 3) - 1;
354 nBitsLeft = GBW - (nLineBytes << 3); 355 nBitsLeft = GBW - (nLineBytes << 3);
355 for (FX_DWORD h = 0; h < GBH; h++) { 356 for (FX_DWORD h = 0; h < GBH; h++) {
356 if (TPGDON) { 357 if (TPGDON) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 return GBREG.release(); 423 return GBREG.release();
423 } 424 }
424 425
425 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_unopt( 426 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_unopt(
426 CJBig2_ArithDecoder* pArithDecoder, 427 CJBig2_ArithDecoder* pArithDecoder,
427 JBig2ArithCtx* gbContext) { 428 JBig2ArithCtx* gbContext) {
428 FX_BOOL LTP, SLTP, bVal; 429 FX_BOOL LTP, SLTP, bVal;
429 FX_DWORD CONTEXT; 430 FX_DWORD CONTEXT;
430 FX_DWORD line1, line2, line3; 431 FX_DWORD line1, line2, line3;
431 LTP = 0; 432 LTP = 0;
432 nonstd::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); 433 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
433 GBREG->fill(0); 434 GBREG->fill(0);
434 for (FX_DWORD h = 0; h < GBH; h++) { 435 for (FX_DWORD h = 0; h < GBH; h++) {
435 if (TPGDON) { 436 if (TPGDON) {
436 SLTP = pArithDecoder->DECODE(&gbContext[0x00e5]); 437 SLTP = pArithDecoder->DECODE(&gbContext[0x00e5]);
437 LTP = LTP ^ SLTP; 438 LTP = LTP ^ SLTP;
438 } 439 }
439 if (LTP == 1) { 440 if (LTP == 1) {
440 GBREG->copyLine(h, h - 1); 441 GBREG->copyLine(h, h - 1);
441 } else { 442 } else {
442 line1 = GBREG->getPixel(1, h - 2); 443 line1 = GBREG->getPixel(1, h - 2);
(...skipping 26 matching lines...) Expand all
469 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_opt3( 470 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_opt3(
470 CJBig2_ArithDecoder* pArithDecoder, 471 CJBig2_ArithDecoder* pArithDecoder,
471 JBig2ArithCtx* gbContext) { 472 JBig2ArithCtx* gbContext) {
472 FX_BOOL LTP, SLTP, bVal; 473 FX_BOOL LTP, SLTP, bVal;
473 FX_DWORD CONTEXT; 474 FX_DWORD CONTEXT;
474 FX_DWORD line1; 475 FX_DWORD line1;
475 uint8_t* pLine, *pLine1, cVal; 476 uint8_t* pLine, *pLine1, cVal;
476 int32_t nStride, k; 477 int32_t nStride, k;
477 int32_t nLineBytes, nBitsLeft, cc; 478 int32_t nLineBytes, nBitsLeft, cc;
478 LTP = 0; 479 LTP = 0;
479 nonstd::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); 480 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
480 if (!GBREG->m_pData) 481 if (!GBREG->m_pData)
481 return nullptr; 482 return nullptr;
482 483
483 pLine = GBREG->m_pData; 484 pLine = GBREG->m_pData;
484 nStride = GBREG->m_nStride; 485 nStride = GBREG->m_nStride;
485 nLineBytes = ((GBW + 7) >> 3) - 1; 486 nLineBytes = ((GBW + 7) >> 3) - 1;
486 nBitsLeft = GBW - (nLineBytes << 3); 487 nBitsLeft = GBW - (nLineBytes << 3);
487 for (FX_DWORD h = 0; h < GBH; h++) { 488 for (FX_DWORD h = 0; h < GBH; h++) {
488 if (TPGDON) { 489 if (TPGDON) {
489 SLTP = pArithDecoder->DECODE(&gbContext[0x0195]); 490 SLTP = pArithDecoder->DECODE(&gbContext[0x0195]);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 return GBREG.release(); 542 return GBREG.release();
542 } 543 }
543 544
544 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_unopt( 545 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_unopt(
545 CJBig2_ArithDecoder* pArithDecoder, 546 CJBig2_ArithDecoder* pArithDecoder,
546 JBig2ArithCtx* gbContext) { 547 JBig2ArithCtx* gbContext) {
547 FX_BOOL LTP, SLTP, bVal; 548 FX_BOOL LTP, SLTP, bVal;
548 FX_DWORD CONTEXT; 549 FX_DWORD CONTEXT;
549 FX_DWORD line1, line2; 550 FX_DWORD line1, line2;
550 LTP = 0; 551 LTP = 0;
551 nonstd::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); 552 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
552 GBREG->fill(0); 553 GBREG->fill(0);
553 for (FX_DWORD h = 0; h < GBH; h++) { 554 for (FX_DWORD h = 0; h < GBH; h++) {
554 if (TPGDON) { 555 if (TPGDON) {
555 SLTP = pArithDecoder->DECODE(&gbContext[0x0195]); 556 SLTP = pArithDecoder->DECODE(&gbContext[0x0195]);
556 LTP = LTP ^ SLTP; 557 LTP = LTP ^ SLTP;
557 } 558 }
558 if (LTP == 1) { 559 if (LTP == 1) {
559 GBREG->copyLine(h, h - 1); 560 GBREG->copyLine(h, h - 1);
560 } else { 561 } else {
561 line1 = GBREG->getPixel(1, h - 1); 562 line1 = GBREG->getPixel(1, h - 1);
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 } 1250 }
1250 if (pPause && pPause->NeedToPauseNow()) { 1251 if (pPause && pPause->NeedToPauseNow()) {
1251 m_loopIndex++; 1252 m_loopIndex++;
1252 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE; 1253 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE;
1253 return FXCODEC_STATUS_DECODE_TOBECONTINUE; 1254 return FXCODEC_STATUS_DECODE_TOBECONTINUE;
1254 } 1255 }
1255 } 1256 }
1256 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; 1257 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
1257 return FXCODEC_STATUS_DECODE_FINISH; 1258 return FXCODEC_STATUS_DECODE_FINISH;
1258 } 1259 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698