Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "core/fxcodec/jbig2/JBig2_Context.h" | 7 #include "core/fxcodec/jbig2/JBig2_Context.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <list> | 10 #include <list> |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 #include "core/fxcodec/jbig2/JBig2_SddProc.h" | 23 #include "core/fxcodec/jbig2/JBig2_SddProc.h" |
| 24 #include "core/fxcodec/jbig2/JBig2_TrdProc.h" | 24 #include "core/fxcodec/jbig2/JBig2_TrdProc.h" |
| 25 #include "third_party/base/stl_util.h" | 25 #include "third_party/base/stl_util.h" |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 size_t GetHuffContextSize(uint8_t val) { | 29 size_t GetHuffContextSize(uint8_t val) { |
| 30 return val == 0 ? 65536 : val == 1 ? 8192 : 1024; | 30 return val == 0 ? 65536 : val == 1 ? 8192 : 1024; |
| 31 } | 31 } |
| 32 | 32 |
| 33 size_t GetRefAggContextSize(FX_BOOL val) { | 33 size_t GetRefAggContextSize(int bVal) { |
|
Lei Zhang
2016/10/28 18:00:52
Why can't this be a bool?
Tom Sepez
2016/10/28 18:04:44
It's only called with things that are ints, so we'
Lei Zhang
2016/10/28 18:09:50
All those ints can be converted to bools: GRTEMPLA
| |
| 34 return val ? 1024 : 8192; | 34 return bVal ? 1024 : 8192; |
| 35 } | 35 } |
| 36 | 36 |
| 37 } // namespace | 37 } // namespace |
| 38 | 38 |
| 39 // Implement a very small least recently used (LRU) cache. It is very | 39 // Implement a very small least recently used (LRU) cache. It is very |
| 40 // common for a JBIG2 dictionary to span multiple pages in a PDF file, | 40 // common for a JBIG2 dictionary to span multiple pages in a PDF file, |
| 41 // and we do not want to decode the same dictionary over and over | 41 // and we do not want to decode the same dictionary over and over |
| 42 // again. We key off of the memory location of the dictionary. The | 42 // again. We key off of the memory location of the dictionary. The |
| 43 // list keeps track of the freshness of entries, with freshest ones | 43 // list keeps track of the freshness of entries, with freshest ones |
| 44 // at the front. Even a tiny cache size like 2 makes a dramatic | 44 // at the front. Even a tiny cache size like 2 makes a dramatic |
| (...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1387 SBSYMCODES[CURTEMP].code = CURCODE; | 1387 SBSYMCODES[CURTEMP].code = CURCODE; |
| 1388 CURCODE = CURCODE + 1; | 1388 CURCODE = CURCODE + 1; |
| 1389 } | 1389 } |
| 1390 CURTEMP = CURTEMP + 1; | 1390 CURTEMP = CURTEMP + 1; |
| 1391 } | 1391 } |
| 1392 CURLEN = CURLEN + 1; | 1392 CURLEN = CURLEN + 1; |
| 1393 } | 1393 } |
| 1394 FX_Free(LENCOUNT); | 1394 FX_Free(LENCOUNT); |
| 1395 FX_Free(FIRSTCODE); | 1395 FX_Free(FIRSTCODE); |
| 1396 } | 1396 } |
| OLD | NEW |