| 1 | // cxx . . $ `<file>/Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/scan.h`/ |
| 2 | // (C) Jan de Vaan 2007-2010, all rights reserved. See the accompanying "License.txt" for licensed use. |
| 3 | // |
| 4 | |
| 5 | #ifndef CHARLS_SCAN |
| 6 | #define CHARLS_SCANcxx . . $ `Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/scan.h:6:9`! |
| 7 | |
| 8 | #include "lookuptable.h"cxx . . $ `<file>/Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/lookuptable.h`/ |
| 9 | #include "contextrunmode.h"cxx . . $ `<file>/Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/contextrunmode.h`/ |
| 10 | #include "context.h"cxx . . $ `<file>/Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/context.h`/ |
| 11 | #include "colortransform.h"cxx . . $ `<file>/Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/colortransform.h`/ |
| 12 | #include <sstream> |
| 13 | |
| 14 | // This file contains the code for handling a "scan". Usually an image is encoded as a single scan. |
| 15 | |
| 16 | |
| 17 | #ifdef _MSC_VER |
| 18 | #pragma warning (disable: 4127) // conditional expression is constant (caused by some template methods that are not fully specialized) [VS2013] |
| 19 | #endif |
| 20 | |
| 21 | |
| 22 | extern CTablecxx . . $ CTable# decodingTablescxx . . $ decodingTables.[16]; |
| 23 | extern std::vectorcxx . . $ std/vector#<signed char> rgquant8Llcxx . . $ rgquant8Ll.; |
| 24 | extern std::vectorcxx . . $ std/vector#<signed char> rgquant10Llcxx . . $ rgquant10Ll.; |
| 25 | extern std::vectorcxx . . $ std/vector#<signed char> rgquant12Llcxx . . $ rgquant12Ll.; |
| 26 | extern std::vectorcxx . . $ std/vector#<signed char> rgquant16Llcxx . . $ rgquant16Ll.; |
| 27 | |
| 28 | inlinehintcxx . . $ `Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/util.h:39:13`! int32_tcxx . . $ int32_t# ApplySigncxx . . $ ApplySign(9b79fb6aee4c0440).(int32_tcxx . . $ int32_t# i, int32_tcxx . . $ int32_t# sign) |
| 29 | { |
| 30 | return (sign ^ i) - sign; |
| 31 | } |
| 32 | |
| 33 | |
| 34 | // Two alternatives for GetPredictedValue() (second is slightly faster due to reduced branching) |
| 35 | |
| 36 | #if 0 |
| 37 | |
| 38 | inlinehint int32_t GetPredictedValue(int32_t Ra, int32_t Rb, int32_t Rc) |
| 39 | { |
| 40 | if (Ra < Rb) |
| 41 | { |
| 42 | if (Rc < Ra) |
| 43 | return Rb; |
| 44 | |
| 45 | if (Rc > Rb) |
| 46 | return Ra; |
| 47 | } |
| 48 | else |
| 49 | { |
| 50 | if (Rc < Rb) |
| 51 | return Ra; |
| 52 | |
| 53 | if (Rc > Ra) |
| 54 | return Rb; |
| 55 | } |
| 56 | |
| 57 | return Ra + Rb - Rc; |
| 58 | } |
| 59 | |
| 60 | #else |
| 61 | |
| 62 | inlinehintcxx . . $ `Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/util.h:39:13`! int32_tcxx . . $ int32_t# GetPredictedValuecxx . . $ GetPredictedValue(2326284602b0bb2d).(int32_tcxx . . $ int32_t# Ra, int32_tcxx . . $ int32_t# Rb, int32_tcxx . . $ int32_t# Rc) |
| 63 | { |
| 64 | // sign trick reduces the number of if statements (branches) |
| 65 | int32_tcxx . . $ int32_t# sgn = BitWiseSigncxx . . $ BitWiseSign(7864480464b09eea).(Rb - Ra); |
| 66 | |
| 67 | // is Ra between Rc and Rb? |
| 68 | if ((sgn ^ (Rc - Ra)) < 0) |
| 69 | { |
| 70 | return Rb; |
| 71 | } |
| 72 | else if ((sgn ^ (Rb - Rc)) < 0) |
| 73 | { |
| 74 | return Ra; |
| 75 | } |
| 76 | |
| 77 | // default case, valid if Rc element of [Ra,Rb] |
| 78 | return Ra + Rb - Rc; |
| 79 | } |
| 80 | |
| 81 | #endif |
| 82 | |
| 83 | inlinehintcxx . . $ `Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/util.h:39:13`! int32_tcxx . . $ int32_t# UnMapErrValcxx . . $ UnMapErrVal(7864480464b09eea).(int32_tcxx . . $ int32_t# mappedError) |
| 84 | { |
| 85 | //int32_t sign = ~((mappedError & 1) - 1); |
| 86 | int32_tcxx . . $ int32_t# sign = int32_tcxx . . $ int32_t#(mappedError << (INT32_BITCOUNTcxx . . $ INT32_BITCOUNT.-1)) >> (INT32_BITCOUNTcxx . . $ INT32_BITCOUNT.-1); |
| 87 | return sign ^ (mappedError >> 1); |
| 88 | } |
| 89 | |
| 90 | inlinehintcxx . . $ `Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/util.h:39:13`! int32_tcxx . . $ int32_t# GetMappedErrValcxx . . $ GetMappedErrVal(7864480464b09eea).(int32_tcxx . . $ int32_t# Errval) |
| 91 | { |
| 92 | int32_tcxx . . $ int32_t# mappedError = (Errval >> (INT32_BITCOUNTcxx . . $ INT32_BITCOUNT.-2)) ^ (2 * Errval); |
| 93 | return mappedError; |
| 94 | } |
| 95 | |
| 96 | inlinehintcxx . . $ `Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/util.h:39:13`! int32_tcxx . . $ int32_t# ComputeContextIDcxx . . $ ComputeContextID(2326284602b0bb2d).(int32_tcxx . . $ int32_t# Q1, int32_tcxx . . $ int32_t# Q2, int32_tcxx . . $ int32_t# Q3) |
| 97 | { |
| 98 | return (Q1*9 + Q2)*9 + Q3; |
| 99 | } |
| 100 | |
| 101 | |
| 102 | template<typename TRAITS, typename STRATEGY> |
| 103 | class JlsCodeccxx . . $ JlsCodec# : public STRATEGY |
| 104 | { |
| 105 | public: |
| 106 | typedef typename TRAITS::PIXEL PIXELcxx . . $ JlsCodec#PIXEL#; |
| 107 | typedef typename TRAITS::SAMPLE SAMPLEcxx . . $ JlsCodec#SAMPLE#; |
| 108 | |
| 109 | JlsCodeccxx . . $ JlsCodec#`JlsCodec<TRAITS, STRATEGY>`(c3fcfacfbfa091a6).(const TRAITS& inTraits, const JlsParameterscxx . . $ JlsParameters#& params) : |
| 110 | STRATEGY(params), |
| 111 | traitscxx . . $ JlsCodec#traits.(inTraits), |
| 112 | _rectcxx . . $ JlsCodec#_rect.(), |
| 113 | _widthcxx . . $ JlsCodec#_width.(params.widthcxx . . $ JlsParameters#width.), |
| 114 | T1cxx . . $ JlsCodec#T1.(0), |
| 115 | T2cxx . . $ JlsCodec#T2.(0), |
| 116 | T3cxx . . $ JlsCodec#T3.(0), |
| 117 | _RUNindexcxx . . $ JlsCodec#_RUNindex.(0), |
| 118 | _previousLinecxx . . $ JlsCodec#_previousLine.(), |
| 119 | _currentLinecxx . . $ JlsCodec#_currentLine.(), |
| 120 | _pquantcxx . . $ JlsCodec#_pquant.(nullptr), |
| 121 | _bComparecxx . . $ JlsCodec#_bCompare.(false) |
| 122 | { |
| 123 | if (Infocxx . . $ JlsCodec#Info(f4b07589550b5381).().interleaveMode ==cxx . . $ `operator==`(a45170b20b25cf3). InterleaveModecxx . . $ charls/InterleaveMode#::Nonecxx . . $ charls/InterleaveMode#None.) |
| 124 | { |
| 125 | Infocxx . . $ JlsCodec#Info(f4b07589550b5381).().components = 1; |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | void SetPresetscxx . . $ JlsCodec#SetPresets(aee0d5530a8d734e).(const JlsCustomParameterscxx . . $ JlsCustomParameters#& presets) override |
| 130 | { |
| 131 | JlsCustomParameterscxx . . $ JlsCustomParameters# presetDefault = ComputeDefaultcxx . . $ ComputeDefault(a8a5e9efb32f17a5).(traitscxx . . $ JlsCodec#traits..MAXVAL, traitscxx . . $ JlsCodec#traits..NEAR); |
| 132 | |
| 133 | InitParamscxx . . $ JlsCodec#InitParams(748afa4755bc9595).(presets.T1cxx . . $ JlsCustomParameters#T1. != 0 ? presets.T1cxx . . $ JlsCustomParameters#T1. : presetDefault.T1cxx . . $ JlsCustomParameters#T1., |
| 134 | presets.T2cxx . . $ JlsCustomParameters#T2. != 0 ? presets.T2cxx . . $ JlsCustomParameters#T2. : presetDefault.T2cxx . . $ JlsCustomParameters#T2., |
| 135 | presets.T3cxx . . $ JlsCustomParameters#T3. != 0 ? presets.T3cxx . . $ JlsCustomParameters#T3. : presetDefault.T3cxx . . $ JlsCustomParameters#T3., |
| 136 | presets.RESETcxx . . $ JlsCustomParameters#RESET. != 0 ? presets.RESETcxx . . $ JlsCustomParameters#RESET. : presetDefault.RESETcxx . . $ JlsCustomParameters#RESET.); |
| 137 | } |
| 138 | |
| 139 | |
| 140 | bool IsInterleavedcxx . . $ JlsCodec#IsInterleaved(c9857a73d68e59ba).() |
| 141 | { |
| 142 | if (Infocxx . . $ JlsCodec#Info(f4b07589550b5381).().interleaveMode ==cxx . . $ `operator==`(a45170b20b25cf3). InterleaveModecxx . . $ charls/InterleaveMode#::Nonecxx . . $ charls/InterleaveMode#None.) |
| 143 | return false; |
| 144 | |
| 145 | if (Infocxx . . $ JlsCodec#Info(f4b07589550b5381).().components ==cxx . . $ `operator==`(a45170b20b25cf3). 1) |
| 146 | return false; |
| 147 | |
| 148 | return true; |
| 149 | } |
| 150 | |
| 151 | JlsParameterscxx . . $ JlsParameters#& Infocxx . . $ JlsCodec#Info(f4b07589550b5381).() |
| 152 | { |
| 153 | return STRATEGY::_params; |
| 154 | } |
| 155 | |
| 156 | signed char QuantizeGratientOrgcxx . . $ JlsCodec#QuantizeGratientOrg(3fa411ac91d07532).(int32_tcxx . . $ int32_t# Di); |
| 157 | |
| 158 | inlinehintcxx . . $ `Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/util.h:39:13`! int32_tcxx . . $ int32_t# QuantizeGratientcxx . . $ JlsCodec#QuantizeGratient(7864480464b09eea).(int32_tcxx . . $ int32_t# Di) |
| 159 | { |
| 160 | ASSERTcxx . . $ `Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/util.h:16:13`!(QuantizeGratientOrg(Di) == *(_pquant + Di)); |
| 161 | return *(_pquantcxx . . $ JlsCodec#_pquant. + Di); |
| 162 | } |
| 163 | |
| 164 | void InitQuantizationLUTcxx . . $ JlsCodec#InitQuantizationLUT(49f6e7a06ebc5aa8).(); |
| 165 | |
| 166 | int32_tcxx . . $ int32_t# DecodeValuecxx . . $ JlsCodec#DecodeValue(2326284602b0bb2d).(int32_tcxx . . $ int32_t# k, int32_tcxx . . $ int32_t# limit, int32_tcxx . . $ int32_t# qbpp); |
| 167 | inlinehintcxx . . $ `Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/util.h:39:13`! void EncodeMappedValuecxx . . $ JlsCodec#EncodeMappedValue(b1146eedae1e1d0b).(int32_tcxx . . $ int32_t# k, int32_tcxx . . $ int32_t# mappedError, int32_tcxx . . $ int32_t# limit); |
| 168 | |
| 169 | void IncrementRunIndexcxx . . $ JlsCodec#IncrementRunIndex(49f6e7a06ebc5aa8).() |
| 170 | { |
| 171 | _RUNindexcxx . . $ JlsCodec#_RUNindex. = MINcxx . . $ `Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/util.h:49:9`!(31,_RUNindex + 1); |
| 172 | } |
| 173 | |
| 174 | void DecrementRunIndexcxx . . $ JlsCodec#DecrementRunIndex(49f6e7a06ebc5aa8).() |
| 175 | { _RUNindexcxx . . $ JlsCodec#_RUNindex. = MAXcxx . . $ `Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/util.h:45:9`!(0,_RUNindex - 1); } |
| 176 | |
| 177 | int32_tcxx . . $ int32_t# DecodeRIErrorcxx . . $ JlsCodec#DecodeRIError(cf12b8025a586b44).(CContextRunModecxx . . $ CContextRunMode#& ctx); |
| 178 | Tripletcxx . . $ Triplet#<SAMPLEcxx . . $ JlsCodec#SAMPLE#> DecodeRIPixelcxx . . $ JlsCodec#DecodeRIPixel(8aaf4a9763b46b7b).(Tripletcxx . . $ Triplet#<SAMPLEcxx . . $ JlsCodec#SAMPLE#> Ra, Tripletcxx . . $ Triplet#<SAMPLEcxx . . $ JlsCodec#SAMPLE#> Rb); |
| 179 | SAMPLEcxx . . $ JlsCodec#SAMPLE# DecodeRIPixelcxx . . $ JlsCodec#DecodeRIPixel(bef3c5984245ddfd).(int32_tcxx . . $ int32_t# Ra, int32_tcxx . . $ int32_t# Rb); |
| 180 | int32_tcxx . . $ int32_t# DecodeRunPixelscxx . . $ JlsCodec#DecodeRunPixels(66d63e49f7ccefc6).(PIXELcxx . . $ JlsCodec#PIXEL# Ra, PIXELcxx . . $ JlsCodec#PIXEL#* ptype, int32_tcxx . . $ int32_t# cpixelMac); |
| 181 | int32_tcxx . . $ int32_t# DoRunModecxx . . $ JlsCodec#DoRunMode(ac44e831fcce067e).(int32_tcxx . . $ int32_t# index, DecoderStrategycxx . . $ DecoderStrategy#*); |
| 182 | |
| 183 | void EncodeRIErrorcxx . . $ JlsCodec#EncodeRIError(81d15dbc06dbe54f).(CContextRunModecxx . . $ CContextRunMode#& ctx, int32_tcxx . . $ int32_t# Errval); |
| 184 | SAMPLEcxx . . $ JlsCodec#SAMPLE# EncodeRIPixelcxx . . $ JlsCodec#EncodeRIPixel(feb71a8e99befaff).(int32_tcxx . . $ int32_t# x, int32_tcxx . . $ int32_t# Ra, int32_tcxx . . $ int32_t# Rb); |
| 185 | Tripletcxx . . $ Triplet#<SAMPLEcxx . . $ JlsCodec#SAMPLE#> EncodeRIPixelcxx . . $ JlsCodec#EncodeRIPixel(f29c9e2551698e94).(Tripletcxx . . $ Triplet#<SAMPLEcxx . . $ JlsCodec#SAMPLE#> x, Tripletcxx . . $ Triplet#<SAMPLEcxx . . $ JlsCodec#SAMPLE#> Ra, Tripletcxx . . $ Triplet#<SAMPLEcxx . . $ JlsCodec#SAMPLE#> Rb); |
| 186 | void EncodeRunPixelscxx . . $ JlsCodec#EncodeRunPixels(918ebd27a9ddbad3).(int32_tcxx . . $ int32_t# runLength, bool bEndofline); |
| 187 | int32_tcxx . . $ int32_t# DoRunModecxx . . $ JlsCodec#DoRunMode(a8ae98c68c517c04).(int32_tcxx . . $ int32_t# index, EncoderStrategycxx . . $ EncoderStrategy#*); |
| 188 | |
| 189 | inlinehintcxx . . $ `Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/util.h:39:13`! SAMPLEcxx . . $ JlsCodec#SAMPLE# DoRegularcxx . . $ JlsCodec#DoRegular(af11567d691f5b31).(int32_tcxx . . $ int32_t# Qs, int32_tcxx . . $ int32_t#, int32_tcxx . . $ int32_t# pred, DecoderStrategycxx . . $ DecoderStrategy#*); |
| 190 | inlinehintcxx . . $ `Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/util.h:39:13`! SAMPLEcxx . . $ JlsCodec#SAMPLE# DoRegularcxx . . $ JlsCodec#DoRegular(1e997c4ce8f4bc14).(int32_tcxx . . $ int32_t# Qs, int32_tcxx . . $ int32_t# x, int32_tcxx . . $ int32_t# pred, EncoderStrategycxx . . $ EncoderStrategy#*); |
| 191 | |
| 192 | void DoLinecxx . . $ JlsCodec#DoLine(32935f3d4135b7d4).(SAMPLEcxx . . $ JlsCodec#SAMPLE#* pdummy); |
| 193 | void DoLinecxx . . $ JlsCodec#DoLine(2cd0d83ba0d922c9).(Tripletcxx . . $ Triplet#<SAMPLEcxx . . $ JlsCodec#SAMPLE#>* pdummy); |
| 194 | void DoScancxx . . $ JlsCodec#DoScan(49f6e7a06ebc5aa8).(); |
| 195 | |
| 196 | public: |
| 197 | ProcessLinecxx . . $ ProcessLine#* CreateProcesscxx . . $ JlsCodec#CreateProcess(abcab31bdb531be5).(ByteStreamInfocxx . . $ ByteStreamInfo# rawStreamInfo) override; |
| 198 | void InitDefaultcxx . . $ JlsCodec#InitDefault(49f6e7a06ebc5aa8).(); |
| 199 | void InitParamscxx . . $ JlsCodec#InitParams(748afa4755bc9595).(int32_tcxx . . $ int32_t# t1, int32_tcxx . . $ int32_t# t2, int32_tcxx . . $ int32_t# t3, int32_tcxx . . $ int32_t# nReset); |
| 200 | |
| 201 | #if defined(__clang__cxx . . $ `<built-in>:3:9`!) && (__clang_major__cxx . . $ `<built-in>:4:9`! > 6) |
| 202 | #pragma clang diagnostic push |
| 203 | #pragma clang diagnostic ignored "-Winconsistent-missing-override" |
| 204 | #endif |
| 205 | |
| 206 | size_t EncodeScancxx . . $ JlsCodec#EncodeScan(24438083e3ed8c66).(std::unique_ptrcxx . . $ std/unique_ptr#<ProcessLinecxx . . $ ProcessLine#> rawData, ByteStreamInfocxx . . $ ByteStreamInfo#& compressedData, void* pvoidCompare); |
| 207 | void DecodeScancxx . . $ JlsCodec#DecodeScan(324d756b715f9dd3).(std::unique_ptrcxx . . $ std/unique_ptr#<ProcessLinecxx . . $ ProcessLine#> rawData, const JlsRectcxx . . $ JlsRect#& size, ByteStreamInfocxx . . $ ByteStreamInfo#& compressedData, bool bCompare); |
| 208 | |
| 209 | #if defined(__clang__cxx . . $ `<built-in>:3:9`!) && (__clang_major__cxx . . $ `<built-in>:4:9`! > 6) |
| 210 | #pragma clang diagnostic pop |
| 211 | #endif |
| 212 | |
| 213 | protected: |
| 214 | // codec parameters |
| 215 | TRAITS traitscxx . . $ JlsCodec#traits.; |
| 216 | JlsRectcxx . . $ JlsRect# _rectcxx . . $ JlsCodec#_rect.; |
| 217 | int _widthcxx . . $ JlsCodec#_width.; |
| 218 | int32_tcxx . . $ int32_t# T1cxx . . $ JlsCodec#T1.; |
| 219 | int32_tcxx . . $ int32_t# T2cxx . . $ JlsCodec#T2.; |
| 220 | int32_tcxx . . $ int32_t# T3cxx . . $ JlsCodec#T3.; |
| 221 | |
| 222 | // compression context |
| 223 | JlsContextcxx . . $ JlsContext# _contextscxx . . $ JlsCodec#_contexts.[365]; |
| 224 | CContextRunModecxx . . $ CContextRunMode# _contextRunmodecxx . . $ JlsCodec#_contextRunmode.[2]; |
| 225 | int32_tcxx . . $ int32_t# _RUNindexcxx . . $ JlsCodec#_RUNindex.; |
| 226 | PIXELcxx . . $ JlsCodec#PIXEL#* _previousLinecxx . . $ JlsCodec#_previousLine.; // previous line ptr |
| 227 | PIXELcxx . . $ JlsCodec#PIXEL#* _currentLinecxx . . $ JlsCodec#_currentLine.; // current line ptr |
| 228 | |
| 229 | // quantization lookup table |
| 230 | signed char* _pquantcxx . . $ JlsCodec#_pquant.; |
| 231 | std::vectorcxx . . $ std/vector#<signed char> _rgquantcxx . . $ JlsCodec#_rgquant.; |
| 232 | |
| 233 | // debugging |
| 234 | bool _bComparecxx . . $ JlsCodec#_bCompare.; |
| 235 | }; |
| 236 | |
| 237 | |
| 238 | // Encode/decode a single sample. Performancewise the #1 important functions |
| 239 | template<typename TRAITS, typename STRATEGY> |
| 240 | typename TRAITS::SAMPLE JlsCodeccxx . . $ JlsCodec#<TRAITS,STRATEGY>::DoRegularcxx . . $ JlsCodec#DoRegular(af11567d691f5b31).(int32_tcxx . . $ int32_t# Qs, int32_tcxx . . $ int32_t#, int32_tcxx . . $ int32_t# pred, DecoderStrategycxx . . $ DecoderStrategy#*) |
| 241 | { |
| 242 | int32_tcxx . . $ int32_t# sign = BitWiseSigncxx . . $ BitWiseSign(7864480464b09eea).(Qs); |
| 243 | JlsContextcxx . . $ JlsContext#& ctx = _contextscxx . . $ JlsCodec#_contexts.[ApplySigncxx . . $ ApplySign(9b79fb6aee4c0440).(Qs, sign)]; |
| 244 | int32_tcxx . . $ int32_t# k = ctx.GetGolombcxx . . $ JlsContext#GetGolomb(455f465bc33b4cdf).(); |
| 245 | int32_tcxx . . $ int32_t# Px = traitscxx . . $ JlsCodec#traits..CorrectPrediction(pred + ApplySigncxx . . $ ApplySign(9b79fb6aee4c0440).(ctx.Ccxx . . $ JlsContext#C., sign)); |
| 246 | |
| 247 | int32_tcxx . . $ int32_t# ErrVal; |
| 248 | const Codecxx . . $ Code#& code = decodingTablescxx . . $ decodingTables.[k].Getcxx . . $ CTable#Get(ce5935d8fbbddd79).(STRATEGY::PeekByte()); |
| 249 | if (code.GetLengthcxx . . $ Code#GetLength(455f465bc33b4cdf).() != 0) |
| 250 | { |
| 251 | STRATEGY::Skip(code.GetLengthcxx . . $ Code#GetLength(455f465bc33b4cdf).()); |
| 252 | ErrVal = code.GetValuecxx . . $ Code#GetValue(455f465bc33b4cdf).(); |
| 253 | ASSERTcxx . . $ `Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/util.h:16:13`!(std::abs(ErrVal) < 65535); |
| 254 | } |
| 255 | else |
| 256 | { |
| 257 | ErrVal = UnMapErrValcxx . . $ UnMapErrVal(7864480464b09eea).(DecodeValuecxx . . $ JlsCodec#DecodeValue(2326284602b0bb2d).(k, traitscxx . . $ JlsCodec#traits..LIMIT, traitscxx . . $ JlsCodec#traits..qbpp)); |
| 258 | if (std::abs(ErrVal) > 65535) |
| 259 | throw stdcxx . . $ std/system_error#system_error(bd3fb6dddb5bfcf6).::system_errorcxx . . $ std/system_error#(static_cast<int>(charlscxx . . $ charls/::ApiResultcxx . . $ charls/ApiResult#::InvalidCompressedDatacxx . . $ charls/ApiResult#InvalidCompressedData.), CharLSCategoryInstancecxx . . $ CharLSCategoryInstance(d722c6fa07888cca).()); |
| 260 | } |
| 261 | if (k == 0) |
| 262 | { |
| 263 | ErrVal = ErrVal ^cxx . . $ std/`operator^`(b658760a236c1c89). ctx.GetErrorCorrectioncxx . . $ JlsContext#GetErrorCorrection(7ccb52b1bfe01045).(traitscxx . . $ JlsCodec#traits..NEAR); |
| 264 | } |
| 265 | ctx.UpdateVariablescxx . . $ JlsContext#UpdateVariables(b1146eedae1e1d0b).(ErrVal, traitscxx . . $ JlsCodec#traits..NEAR, traitscxx . . $ JlsCodec#traits..RESET); |
| 266 | ErrVal = ApplySigncxx . . $ ApplySign(9b79fb6aee4c0440).(ErrVal, sign); |
| 267 | return traitscxx . . $ JlsCodec#traits..ComputeReconstructedSample(Px, ErrVal); |
| 268 | } |
| 269 | |
| 270 | |
| 271 | template<typename TRAITS, typename STRATEGY> |
| 272 | typename TRAITS::SAMPLE JlsCodeccxx . . $ JlsCodec#<TRAITS,STRATEGY>::DoRegularcxx . . $ JlsCodec#DoRegular(1e997c4ce8f4bc14).(int32_tcxx . . $ int32_t# Qs, int32_tcxx . . $ int32_t# x, int32_tcxx . . $ int32_t# pred, EncoderStrategycxx . . $ EncoderStrategy#*) |
| 273 | { |
| 274 | int32_tcxx . . $ int32_t# sign = BitWiseSigncxx . . $ BitWiseSign(7864480464b09eea).(Qs); |
| 275 | JlsContextcxx . . $ JlsContext#& ctx = _contextscxx . . $ JlsCodec#_contexts.[ApplySigncxx . . $ ApplySign(9b79fb6aee4c0440).(Qs, sign)]; |
| 276 | int32_tcxx . . $ int32_t# k = ctx.GetGolombcxx . . $ JlsContext#GetGolomb(455f465bc33b4cdf).(); |
| 277 | int32_tcxx . . $ int32_t# Px = traitscxx . . $ JlsCodec#traits..CorrectPrediction(pred + ApplySigncxx . . $ ApplySign(9b79fb6aee4c0440).(ctx.Ccxx . . $ JlsContext#C., sign)); |
| 278 | int32_tcxx . . $ int32_t# ErrVal = traitscxx . . $ JlsCodec#traits..ComputeErrVal(ApplySigncxx . . $ ApplySign(9b79fb6aee4c0440).(x - Px, sign)); |
| 279 | |
| 280 | EncodeMappedValuecxx . . $ JlsCodec#EncodeMappedValue(b1146eedae1e1d0b).(k, GetMappedErrValcxx . . $ GetMappedErrVal(7864480464b09eea).(ctx.GetErrorCorrectioncxx . . $ JlsContext#GetErrorCorrection(7ccb52b1bfe01045).(k |cxx . . $ std/`operator|`(b658760a236c1c89). traitscxx . . $ JlsCodec#traits..NEAR) ^cxx . . $ std/`operator^`(b658760a236c1c89). ErrVal), traitscxx . . $ JlsCodec#traits..LIMIT); |
| 281 | ctx.UpdateVariablescxx . . $ JlsContext#UpdateVariables(b1146eedae1e1d0b).(ErrVal, traitscxx . . $ JlsCodec#traits..NEAR, traitscxx . . $ JlsCodec#traits..RESET); |
| 282 | ASSERTcxx . . $ `Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/util.h:16:13`!(traits.IsNear(traits.ComputeReconstructedSample(Px, ApplySign(ErrVal, sign)), x)); |
| 283 | return static_cast<SAMPLEcxx . . $ JlsCodec#SAMPLE#>(traitscxx . . $ JlsCodec#traits..ComputeReconstructedSample(Px, ApplySigncxx . . $ ApplySign(9b79fb6aee4c0440).(ErrVal, sign))); |
| 284 | } |
| 285 | |
| 286 | |
| 287 | // Functions to build tables used to decode short golomb codes. |
| 288 | |
| 289 | inlinehintcxx . . $ `Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/util.h:39:13`! std::paircxx . . $ std/pair#<int32_tcxx . . $ int32_t#, int32_tcxx . . $ int32_t#> CreateEncodedValuecxx . . $ CreateEncodedValue(81ac5af49749b13f).(int32_tcxx . . $ int32_t# k, int32_tcxx . . $ int32_t# mappedError) |
| 290 | { |
| 291 | int32_tcxx . . $ int32_t# highbits = mappedError >> k; |
| 292 | return std::make_paircxx . . $ std/make_pair(1d30b6e115203116).(highbits + k + 1, (int32_tcxx . . $ int32_t#(1) << k) | (mappedError & ((int32_tcxx . . $ int32_t#(1) << k) - 1))); |
| 293 | } |
| 294 | |
| 295 | |
| 296 | inline CTablecxx . . $ CTable# InitTablecxx . . $ InitTable(5e5b19fcc88824eb).(int32_tcxx . . $ int32_t# k) |
| 297 | { |
| 298 | CTablecxx . . $ CTable# tablecxx . . $ CTable#CTable(49f6e7a06ebc5aa8).; |
| 299 | for (short nerr = 0; ; nerr++) |
| 300 | { |
| 301 | // Q is not used when k != 0 |
| 302 | int32_tcxx . . $ int32_t# merrval = GetMappedErrValcxx . . $ GetMappedErrVal(7864480464b09eea).(nerr);//, k, -1); |
| 303 | std::paircxx . . $ std/pair#<int32_tcxx . . $ int32_t#, int32_tcxx . . $ int32_t#> paircode = CreateEncodedValuecxx . . $ CreateEncodedValue(81ac5af49749b13f).(k, merrval); |
| 304 | if (paircode.firstcxx . . $ std/pair#first. > CTablecxx . . $ CTable#::cbitcxx . . $ CTable#cbit.) |
| 305 | break; |
| 306 | |
| 307 | Codecxx . . $ Code# code = Codecxx . . $ Code#Code(3e454b8ccf442868).( nerr, short(paircode.firstcxx . . $ std/pair#first.) ); |
| 308 | table.AddEntrycxx . . $ CTable#AddEntry(554ac369f713aee1).(uint8_tcxx . . $ uint8_t#(paircode.secondcxx . . $ std/pair#second.), code); |
| 309 | } |
| 310 | |
| 311 | for (short nerr = -1; ; nerr--) |
| 312 | { |
| 313 | // Q is not used when k != 0 |
| 314 | int32_tcxx . . $ int32_t# merrval = GetMappedErrValcxx . . $ GetMappedErrVal(7864480464b09eea).(nerr);//, k, -1); |
| 315 | std::paircxx . . $ std/pair#<int32_tcxx . . $ int32_t#, int32_tcxx . . $ int32_t#> paircode = CreateEncodedValuecxx . . $ CreateEncodedValue(81ac5af49749b13f).(k, merrval); |
| 316 | if (paircode.firstcxx . . $ std/pair#first. > CTablecxx . . $ CTable#::cbitcxx . . $ CTable#cbit.) |
| 317 | break; |
| 318 | |
| 319 | Codecxx . . $ Code# code = Codecxx . . $ Code#Code(3e454b8ccf442868).(nerr, short(paircode.firstcxx . . $ std/pair#first.)); |
| 320 | table.AddEntrycxx . . $ CTable#AddEntry(554ac369f713aee1).(uint8_tcxx . . $ uint8_t#(paircode.secondcxx . . $ std/pair#second.), code); |
| 321 | } |
| 322 | |
| 323 | return table; |
| 324 | } |
| 325 | |
| 326 | |
| 327 | // Encoding/decoding of golomb codes |
| 328 | |
| 329 | template<typename TRAITS, typename STRATEGY> |
| 330 | int32_tcxx . . $ int32_t# JlsCodeccxx . . $ JlsCodec#<TRAITS, STRATEGY>::DecodeValuecxx . . $ JlsCodec#DecodeValue(2326284602b0bb2d).(int32_tcxx . . $ int32_t# k, int32_tcxx . . $ int32_t# limit, int32_tcxx . . $ int32_t# qbpp) |
| 331 | { |
| 332 | int32_tcxx . . $ int32_t# highbits = STRATEGY::ReadHighbits(); |
| 333 | |
| 334 | if (highbits >= limit - (qbpp + 1)) |
| 335 | return STRATEGY::ReadValue(qbpp) +cxx . . $ std/operator+(933aeee3a62e2e30). 1; |
| 336 | |
| 337 | if (k == 0) |
| 338 | return highbits; |
| 339 | |
| 340 | return (highbits << k) +cxx . . $ std/operator+(933aeee3a62e2e30). STRATEGY::ReadValue(k); |
| 341 | } |
| 342 | |
| 343 | |
| 344 | template<typename TRAITS, typename STRATEGY> |
| 345 | inlinehintcxx . . $ `Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/util.h:39:13`! void JlsCodeccxx . . $ JlsCodec#<TRAITS, STRATEGY>::EncodeMappedValuecxx . . $ JlsCodec#EncodeMappedValue(b1146eedae1e1d0b).(int32_tcxx . . $ int32_t# k, int32_tcxx . . $ int32_t# mappedError, int32_tcxx . . $ int32_t# limit) |
| 346 | { |
| 347 | int32_tcxx . . $ int32_t# highbits = mappedError >> k; |
| 348 | |
| 349 | if (highbits <cxx . . $ std/`operator<`(c2ad8cf295ccec45). limit -cxx . . $ std/operator-(a6e85813984128c7). traitscxx . . $ JlsCodec#traits..qbpp -cxx . . $ std/operator-(a6e85813984128c7). 1) |
| 350 | { |
| 351 | if (highbits + 1 > 31) |
| 352 | { |
| 353 | STRATEGY::AppendToBitStream(0, highbits / 2); |
| 354 | highbits = highbits - highbits / 2; |
| 355 | } |
| 356 | STRATEGY::AppendToBitStream(1, highbits + 1); |
| 357 | STRATEGY::AppendToBitStream((mappedError & ((1 << k) - 1)), k); |
| 358 | return; |
| 359 | } |
| 360 | |
| 361 | if (limit -cxx . . $ std/operator-(a6e85813984128c7). traitscxx . . $ JlsCodec#traits..qbpp >cxx . . $ std/`operator>`(c2ad8cf295ccec45). 31) |
| 362 | { |
| 363 | STRATEGY::AppendToBitStream(0, 31); |
| 364 | STRATEGY::AppendToBitStream(1, limit -cxx . . $ std/operator-(a6e85813984128c7). traitscxx . . $ JlsCodec#traits..qbpp -cxx . . $ std/operator-(a6e85813984128c7). 31); |
| 365 | } |
| 366 | else |
| 367 | { |
| 368 | STRATEGY::AppendToBitStream(1, limit -cxx . . $ std/operator-(a6e85813984128c7). traitscxx . . $ JlsCodec#traits..qbpp); |
| 369 | } |
| 370 | STRATEGY::AppendToBitStream((mappedError - 1) &cxx . . $ std/`operator&`(b658760a236c1c89). ((1 <<cxx . . $ `operator<<`(33ed17dcdfa34940). traitscxx . . $ JlsCodec#traits..qbpp) -cxx . . $ std/operator-(a6e85813984128c7). 1), traitscxx . . $ JlsCodec#traits..qbpp); |
| 371 | } |
| 372 | |
| 373 | |
| 374 | // Disable the Microsoft Static Analyzer warning: Potential comparison of a constant with another constant. (false warning, triggered by template construction) |
| 375 | #ifdef _PREFAST_ |
| 376 | #pragma warning(push) |
| 377 | #pragma warning(disable:6326) |
| 378 | #endif |
| 379 | |
| 380 | // Sets up a lookup table to "Quantize" sample difference. |
| 381 | |
| 382 | template<typename TRAITS, typename STRATEGY> |
| 383 | void JlsCodeccxx . . $ JlsCodec#<TRAITS, STRATEGY>::InitQuantizationLUTcxx . . $ JlsCodec#InitQuantizationLUT(49f6e7a06ebc5aa8).() |
| 384 | { |
| 385 | // for lossless mode with default parameters, we have precomputed the luts for bitcounts 8, 10, 12 and 16. |
| 386 | if (traitscxx . . $ JlsCodec#traits..NEAR ==cxx . . $ `operator==`(a45170b20b25cf3). 0 && traitscxx . . $ JlsCodec#traits..MAXVAL ==cxx . . $ `operator==`(a45170b20b25cf3). (1 <<cxx . . $ `operator<<`(33ed17dcdfa34940). traitscxx . . $ JlsCodec#traits..bpp) -cxx . . $ std/operator-(a6e85813984128c7). 1) |
| 387 | { |
| 388 | JlsCustomParameterscxx . . $ JlsCustomParameters# presets = ComputeDefaultcxx . . $ ComputeDefault(a8a5e9efb32f17a5).(traitscxx . . $ JlsCodec#traits..MAXVAL, traitscxx . . $ JlsCodec#traits..NEAR); |
| 389 | if (presets.T1cxx . . $ JlsCustomParameters#T1. == T1cxx . . $ JlsCodec#T1. && presets.T2cxx . . $ JlsCustomParameters#T2. == T2cxx . . $ JlsCodec#T2. && presets.T3cxx . . $ JlsCustomParameters#T3. == T3cxx . . $ JlsCodec#T3.) |
| 390 | { |
| 391 | if (traitscxx . . $ JlsCodec#traits..bpp ==cxx . . $ `operator==`(a45170b20b25cf3). 8) |
| 392 | { |
| 393 | _pquantcxx . . $ JlsCodec#_pquant. = &rgquant8Llcxx . . $ rgquant8Ll.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).rgquant8Llcxx . . $ rgquant8Ll..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).() / 2]; |
| 394 | return; |
| 395 | } |
| 396 | if (traitscxx . . $ JlsCodec#traits..bpp ==cxx . . $ `operator==`(a45170b20b25cf3). 10) |
| 397 | { |
| 398 | _pquantcxx . . $ JlsCodec#_pquant. = &rgquant10Llcxx . . $ rgquant10Ll.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).rgquant10Llcxx . . $ rgquant10Ll..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).() / 2]; |
| 399 | return; |
| 400 | } |
| 401 | if (traitscxx . . $ JlsCodec#traits..bpp ==cxx . . $ `operator==`(a45170b20b25cf3). 12) |
| 402 | { |
| 403 | _pquantcxx . . $ JlsCodec#_pquant. = &rgquant12Llcxx . . $ rgquant12Ll.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).rgquant12Llcxx . . $ rgquant12Ll..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).() / 2]; |
| 404 | return; |
| 405 | } |
| 406 | if (traitscxx . . $ JlsCodec#traits..bpp ==cxx . . $ `operator==`(a45170b20b25cf3). 16) |
| 407 | { |
| 408 | _pquantcxx . . $ JlsCodec#_pquant. = &rgquant16Llcxx . . $ rgquant16Ll.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).rgquant16Llcxx . . $ rgquant16Ll..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).() / 2]; |
| 409 | return; |
| 410 | } |
| 411 | } |
| 412 | } |
| 413 | |
| 414 | int32_tcxx . . $ int32_t# RANGE = 1 <<cxx . . $ `operator<<`(33ed17dcdfa34940). traitscxx . . $ JlsCodec#traits..bpp; |
| 415 | |
| 416 | _rgquantcxx . . $ JlsCodec#_rgquant..resizecxx . . $ std/vector#resize(2c44cd906ae4e829).(RANGE * 2); |
| 417 | |
| 418 | _pquantcxx . . $ JlsCodec#_pquant. = &_rgquantcxx . . $ JlsCodec#_rgquant.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).RANGE]; |
| 419 | for (int32_tcxx . . $ int32_t# i = -RANGE; i < RANGE; ++i) |
| 420 | { |
| 421 | _pquantcxx . . $ JlsCodec#_pquant.[i] = QuantizeGratientOrgcxx . . $ JlsCodec#QuantizeGratientOrg(3fa411ac91d07532).(i); |
| 422 | } |
| 423 | } |
| 424 | |
| 425 | #ifdef _PREFAST_ |
| 426 | #pragma warning(pop) |
| 427 | #endif |
| 428 | |
| 429 | template<typename TRAITS, typename STRATEGY> |
| 430 | signed char JlsCodeccxx . . $ JlsCodec#<TRAITS,STRATEGY>::QuantizeGratientOrgcxx . . $ JlsCodec#QuantizeGratientOrg(3fa411ac91d07532).(int32_tcxx . . $ int32_t# Di) |
| 431 | { |
| 432 | if (Di <= -T3cxx . . $ JlsCodec#T3.) return -4; |
| 433 | if (Di <= -T2cxx . . $ JlsCodec#T2.) return -3; |
| 434 | if (Di <= -T1cxx . . $ JlsCodec#T1.) return -2; |
| 435 | if (Di <cxx . . $ std/`operator<`(c2ad8cf295ccec45). -cxx . . $ std/operator-(a6e85813984128c7).traitscxx . . $ JlsCodec#traits..NEAR) return -1; |
| 436 | if (Di <=cxx . . $ std/`operator<=`(c2ad8cf295ccec45). traitscxx . . $ JlsCodec#traits..NEAR) return 0; |
| 437 | if (Di < T1cxx . . $ JlsCodec#T1.) return 1; |
| 438 | if (Di < T2cxx . . $ JlsCodec#T2.) return 2; |
| 439 | if (Di < T3cxx . . $ JlsCodec#T3.) return 3; |
| 440 | |
| 441 | return 4; |
| 442 | } |
| 443 | |
| 444 | |
| 445 | |
| 446 | // RI = Run interruption: functions that handle the sample terminating a run. |
| 447 | |
| 448 | template<typename TRAITS, typename STRATEGY> |
| 449 | int32_tcxx . . $ int32_t# JlsCodeccxx . . $ JlsCodec#<TRAITS,STRATEGY>::DecodeRIErrorcxx . . $ JlsCodec#DecodeRIError(cf12b8025a586b44).(CContextRunModecxx . . $ CContextRunMode#& ctx) |
| 450 | { |
| 451 | int32_tcxx . . $ int32_t# k = ctx.GetGolombcxx . . $ CContextRunMode#GetGolomb(455f465bc33b4cdf).(); |
| 452 | int32_tcxx . . $ int32_t# EMErrval = DecodeValuecxx . . $ JlsCodec#DecodeValue(2326284602b0bb2d).(k, traitscxx . . $ JlsCodec#traits..LIMIT -cxx . . $ std/operator-(a6e85813984128c7). Jcxx . . $ J.[_RUNindexcxx . . $ JlsCodec#_RUNindex.]-cxx . . $ std/operator-(a6e85813984128c7).1, traitscxx . . $ JlsCodec#traits..qbpp); |
| 453 | int32_tcxx . . $ int32_t# Errval = ctx.ComputeErrValcxx . . $ CContextRunMode#ComputeErrVal(adc74905ab378dc7).(EMErrval + ctx._nRItypecxx . . $ CContextRunMode#_nRItype., k); |
| 454 | ctx.UpdateVariablescxx . . $ CContextRunMode#UpdateVariables(3e454b8ccf442868).(Errval, EMErrval); |
| 455 | return Errval; |
| 456 | } |
| 457 | |
| 458 | |
| 459 | template<typename TRAITS, typename STRATEGY> |
| 460 | void JlsCodeccxx . . $ JlsCodec#<TRAITS,STRATEGY>::EncodeRIErrorcxx . . $ JlsCodec#EncodeRIError(81d15dbc06dbe54f).(CContextRunModecxx . . $ CContextRunMode#& ctx, int32_tcxx . . $ int32_t# Errval) |
| 461 | { |
| 462 | int32_tcxx . . $ int32_t# k = ctx.GetGolombcxx . . $ CContextRunMode#GetGolomb(455f465bc33b4cdf).(); |
| 463 | bool map = ctx.ComputeMapcxx . . $ CContextRunMode#ComputeMap(88e30549ca55c866).(Errval, k); |
| 464 | int32_tcxx . . $ int32_t# EMErrval = 2 * std::abs(Errval) - ctx._nRItypecxx . . $ CContextRunMode#_nRItype. - int32_tcxx . . $ int32_t#(map); |
| 465 | |
| 466 | ASSERTcxx . . $ `Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/util.h:16:13`!(Errval == ctx.ComputeErrVal(EMErrval + ctx._nRItype, k)); |
| 467 | EncodeMappedValuecxx . . $ JlsCodec#EncodeMappedValue(b1146eedae1e1d0b).(k, EMErrval, traitscxx . . $ JlsCodec#traits..LIMIT-cxx . . $ std/operator-(a6e85813984128c7).Jcxx . . $ J.[_RUNindexcxx . . $ JlsCodec#_RUNindex.]-cxx . . $ std/operator-(a6e85813984128c7).1); |
| 468 | ctx.UpdateVariablescxx . . $ CContextRunMode#UpdateVariables(3e454b8ccf442868).(Errval, EMErrval); |
| 469 | } |
| 470 | |
| 471 | |
| 472 | template<typename TRAITS, typename STRATEGY> |
| 473 | Tripletcxx . . $ Triplet#<typename TRAITS::SAMPLE> JlsCodeccxx . . $ JlsCodec#<TRAITS,STRATEGY>::DecodeRIPixelcxx . . $ JlsCodec#DecodeRIPixel(8aaf4a9763b46b7b).(Tripletcxx . . $ Triplet#<SAMPLEcxx . . $ JlsCodec#SAMPLE#> Ra, Tripletcxx . . $ Triplet#<SAMPLEcxx . . $ JlsCodec#SAMPLE#> Rb) |
| 474 | { |
| 475 | int32_tcxx . . $ int32_t# Errval1 = DecodeRIErrorcxx . . $ JlsCodec#DecodeRIError(cf12b8025a586b44).(_contextRunmodecxx . . $ JlsCodec#_contextRunmode.[0]); |
| 476 | int32_tcxx . . $ int32_t# Errval2 = DecodeRIErrorcxx . . $ JlsCodec#DecodeRIError(cf12b8025a586b44).(_contextRunmodecxx . . $ JlsCodec#_contextRunmode.[0]); |
| 477 | int32_tcxx . . $ int32_t# Errval3 = DecodeRIErrorcxx . . $ JlsCodec#DecodeRIError(cf12b8025a586b44).(_contextRunmodecxx . . $ JlsCodec#_contextRunmode.[0]); |
| 478 | |
| 479 | return Tripletcxx . . $ Triplet#<SAMPLEcxx . . $ JlsCodec#SAMPLE#>(traitscxx . . $ JlsCodec#traits..ComputeReconstructedSample(Rb.v1, Errval1 * Signcxx . . $ Sign(7864480464b09eea).(Rb.v1 -cxx . . $ std/operator-(a6e85813984128c7). Ra.v1)), |
| 480 | traitscxx . . $ JlsCodec#traits..ComputeReconstructedSample(Rb.v2, Errval2 * Signcxx . . $ Sign(7864480464b09eea).(Rb.v2 -cxx . . $ std/operator-(a6e85813984128c7). Ra.v2)), |
| 481 | traitscxx . . $ JlsCodec#traits..ComputeReconstructedSample(Rb.v3, Errval3 * Signcxx . . $ Sign(7864480464b09eea).(Rb.v3 -cxx . . $ std/operator-(a6e85813984128c7). Ra.v3))); |
| 482 | } |
| 483 | |
| 484 | |
| 485 | template<typename TRAITS, typename STRATEGY> |
| 486 | Tripletcxx . . $ Triplet#<typename TRAITS::SAMPLE> JlsCodeccxx . . $ JlsCodec#<TRAITS,STRATEGY>::EncodeRIPixelcxx . . $ JlsCodec#EncodeRIPixel(f29c9e2551698e94).(Tripletcxx . . $ Triplet#<SAMPLEcxx . . $ JlsCodec#SAMPLE#> x, Tripletcxx . . $ Triplet#<SAMPLEcxx . . $ JlsCodec#SAMPLE#> Ra, Tripletcxx . . $ Triplet#<SAMPLEcxx . . $ JlsCodec#SAMPLE#> Rb) |
| 487 | { |
| 488 | int32_tcxx . . $ int32_t# errval1 = traitscxx . . $ JlsCodec#traits..ComputeErrVal(Signcxx . . $ Sign(7864480464b09eea).(Rb.v1 -cxx . . $ std/operator-(a6e85813984128c7). Ra.v1) * (x.v1 -cxx . . $ std/operator-(a6e85813984128c7). Rb.v1)); |
| 489 | EncodeRIErrorcxx . . $ JlsCodec#EncodeRIError(81d15dbc06dbe54f).(_contextRunmodecxx . . $ JlsCodec#_contextRunmode.[0], errval1); |
| 490 | |
| 491 | int32_tcxx . . $ int32_t# errval2 = traitscxx . . $ JlsCodec#traits..ComputeErrVal(Signcxx . . $ Sign(7864480464b09eea).(Rb.v2 -cxx . . $ std/operator-(a6e85813984128c7). Ra.v2) * (x.v2 -cxx . . $ std/operator-(a6e85813984128c7). Rb.v2)); |
| 492 | EncodeRIErrorcxx . . $ JlsCodec#EncodeRIError(81d15dbc06dbe54f).(_contextRunmodecxx . . $ JlsCodec#_contextRunmode.[0], errval2); |
| 493 | |
| 494 | int32_tcxx . . $ int32_t# errval3 = traitscxx . . $ JlsCodec#traits..ComputeErrVal(Signcxx . . $ Sign(7864480464b09eea).(Rb.v3 -cxx . . $ std/operator-(a6e85813984128c7). Ra.v3) * (x.v3 -cxx . . $ std/operator-(a6e85813984128c7). Rb.v3)); |
| 495 | EncodeRIErrorcxx . . $ JlsCodec#EncodeRIError(81d15dbc06dbe54f).(_contextRunmodecxx . . $ JlsCodec#_contextRunmode.[0], errval3); |
| 496 | |
| 497 | return Tripletcxx . . $ Triplet#<SAMPLEcxx . . $ JlsCodec#SAMPLE#>(traitscxx . . $ JlsCodec#traits..ComputeReconstructedSample(Rb.v1, errval1 * Signcxx . . $ Sign(7864480464b09eea).(Rb.v1 -cxx . . $ std/operator-(a6e85813984128c7). Ra.v1)), |
| 498 | traitscxx . . $ JlsCodec#traits..ComputeReconstructedSample(Rb.v2, errval2 * Signcxx . . $ Sign(7864480464b09eea).(Rb.v2 -cxx . . $ std/operator-(a6e85813984128c7). Ra.v2)), |
| 499 | traitscxx . . $ JlsCodec#traits..ComputeReconstructedSample(Rb.v3, errval3 * Signcxx . . $ Sign(7864480464b09eea).(Rb.v3 -cxx . . $ std/operator-(a6e85813984128c7). Ra.v3))); |
| 500 | } |
| 501 | |
| 502 | |
| 503 | template<typename TRAITS, typename STRATEGY> |
| 504 | typename TRAITS::SAMPLE JlsCodeccxx . . $ JlsCodec#<TRAITS,STRATEGY>::DecodeRIPixelcxx . . $ JlsCodec#DecodeRIPixel(bef3c5984245ddfd).(int32_tcxx . . $ int32_t# Ra, int32_tcxx . . $ int32_t# Rb) |
| 505 | { |
| 506 | if (std::abs(Ra - Rb) <=cxx . . $ std/`operator<=`(c2ad8cf295ccec45). traitscxx . . $ JlsCodec#traits..NEAR) |
| 507 | { |
| 508 | int32_tcxx . . $ int32_t# ErrVal = DecodeRIErrorcxx . . $ JlsCodec#DecodeRIError(cf12b8025a586b44).(_contextRunmodecxx . . $ JlsCodec#_contextRunmode.[1]); |
| 509 | return static_cast<SAMPLEcxx . . $ JlsCodec#SAMPLE#>(traitscxx . . $ JlsCodec#traits..ComputeReconstructedSample(Ra, ErrVal)); |
| 510 | } |
| 511 | else |
| 512 | { |
| 513 | int32_tcxx . . $ int32_t# ErrVal = DecodeRIErrorcxx . . $ JlsCodec#DecodeRIError(cf12b8025a586b44).(_contextRunmodecxx . . $ JlsCodec#_contextRunmode.[0]); |
| 514 | return static_cast<SAMPLEcxx . . $ JlsCodec#SAMPLE#>(traitscxx . . $ JlsCodec#traits..ComputeReconstructedSample(Rb, ErrVal * Signcxx . . $ Sign(7864480464b09eea).(Rb - Ra))); |
| 515 | } |
| 516 | } |
| 517 | |
| 518 | |
| 519 | template<typename TRAITS, typename STRATEGY> |
| 520 | typename TRAITS::SAMPLE JlsCodeccxx . . $ JlsCodec#<TRAITS,STRATEGY>::EncodeRIPixelcxx . . $ JlsCodec#EncodeRIPixel(feb71a8e99befaff).(int32_tcxx . . $ int32_t# x, int32_tcxx . . $ int32_t# Ra, int32_tcxx . . $ int32_t# Rb) |
| 521 | { |
| 522 | if (std::abs(Ra - Rb) <=cxx . . $ std/`operator<=`(c2ad8cf295ccec45). traitscxx . . $ JlsCodec#traits..NEAR) |
| 523 | { |
| 524 | int32_tcxx . . $ int32_t# ErrVal = traitscxx . . $ JlsCodec#traits..ComputeErrVal(x - Ra); |
| 525 | EncodeRIErrorcxx . . $ JlsCodec#EncodeRIError(81d15dbc06dbe54f).(_contextRunmodecxx . . $ JlsCodec#_contextRunmode.[1], ErrVal); |
| 526 | return static_cast<SAMPLEcxx . . $ JlsCodec#SAMPLE#>(traitscxx . . $ JlsCodec#traits..ComputeReconstructedSample(Ra, ErrVal)); |
| 527 | } |
| 528 | else |
| 529 | { |
| 530 | int32_tcxx . . $ int32_t# ErrVal = traitscxx . . $ JlsCodec#traits..ComputeErrVal((x - Rb) * Signcxx . . $ Sign(7864480464b09eea).(Rb - Ra)); |
| 531 | EncodeRIErrorcxx . . $ JlsCodec#EncodeRIError(81d15dbc06dbe54f).(_contextRunmodecxx . . $ JlsCodec#_contextRunmode.[0], ErrVal); |
| 532 | return static_cast<SAMPLEcxx . . $ JlsCodec#SAMPLE#>(traitscxx . . $ JlsCodec#traits..ComputeReconstructedSample(Rb, ErrVal * Signcxx . . $ Sign(7864480464b09eea).(Rb - Ra))); |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | |
| 537 | // RunMode: Functions that handle run-length encoding |
| 538 | |
| 539 | template<typename TRAITS, typename STRATEGY> |
| 540 | void JlsCodeccxx . . $ JlsCodec#<TRAITS, STRATEGY>::EncodeRunPixelscxx . . $ JlsCodec#EncodeRunPixels(918ebd27a9ddbad3).(int32_tcxx . . $ int32_t# runLength, bool endOfLine) |
| 541 | { |
| 542 | while (runLength >= int32_tcxx . . $ int32_t#(1 << Jcxx . . $ J.[_RUNindexcxx . . $ JlsCodec#_RUNindex.])) |
| 543 | { |
| 544 | STRATEGY::AppendOnesToBitStream(1); |
| 545 | runLength = runLength - int32_tcxx . . $ int32_t#(1 << Jcxx . . $ J.[_RUNindexcxx . . $ JlsCodec#_RUNindex.]); |
| 546 | IncrementRunIndexcxx . . $ JlsCodec#IncrementRunIndex(49f6e7a06ebc5aa8).(); |
| 547 | } |
| 548 | |
| 549 | if (endOfLine) |
| 550 | { |
| 551 | if (runLength != 0) |
| 552 | { |
| 553 | STRATEGY::AppendOnesToBitStream(1); |
| 554 | } |
| 555 | } |
| 556 | else |
| 557 | { |
| 558 | STRATEGY::AppendToBitStream(runLength, Jcxx . . $ J.[_RUNindexcxx . . $ JlsCodec#_RUNindex.] + 1); // leading 0 + actual remaining length |
| 559 | } |
| 560 | } |
| 561 | |
| 562 | |
| 563 | template<typename TRAITS, typename STRATEGY> |
| 564 | int32_tcxx . . $ int32_t# JlsCodeccxx . . $ JlsCodec#<TRAITS, STRATEGY>::DecodeRunPixelscxx . . $ JlsCodec#DecodeRunPixels(66d63e49f7ccefc6).(PIXELcxx . . $ JlsCodec#PIXEL# Ra, PIXELcxx . . $ JlsCodec#PIXEL#* startPos, int32_tcxx . . $ int32_t# cpixelMac) |
| 565 | { |
| 566 | int32_tcxx . . $ int32_t# index = 0; |
| 567 | while (STRATEGY::ReadBit()) |
| 568 | { |
| 569 | int count = MINcxx . . $ `Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/util.h:49:9`!(1 << J[_RUNindex], int(cpixelMac - index)); |
| 570 | index += count; |
| 571 | ASSERTcxx . . $ `Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/util.h:16:13`!(index <= cpixelMac); |
| 572 | |
| 573 | if (count == (1 << Jcxx . . $ J.[_RUNindexcxx . . $ JlsCodec#_RUNindex.])) |
| 574 | { |
| 575 | IncrementRunIndexcxx . . $ JlsCodec#IncrementRunIndex(49f6e7a06ebc5aa8).(); |
| 576 | } |
| 577 | |
| 578 | if (index == cpixelMac) |
| 579 | break; |
| 580 | } |
| 581 | |
| 582 | if (index != cpixelMac) |
| 583 | { |
| 584 | // incomplete run. |
| 585 | index += (Jcxx . . $ J.[_RUNindexcxx . . $ JlsCodec#_RUNindex.] > 0) ? STRATEGY::ReadValue(Jcxx . . $ J.[_RUNindexcxx . . $ JlsCodec#_RUNindex.]) : 0; |
| 586 | } |
| 587 | |
| 588 | if (index > cpixelMac) |
| 589 | throw stdcxx . . $ std/system_error#system_error(bd3fb6dddb5bfcf6).::system_errorcxx . . $ std/system_error#(static_cast<int>(charlscxx . . $ charls/::ApiResultcxx . . $ charls/ApiResult#::InvalidCompressedDatacxx . . $ charls/ApiResult#InvalidCompressedData.), CharLSCategoryInstancecxx . . $ CharLSCategoryInstance(d722c6fa07888cca).()); |
| 590 | |
| 591 | for (int32_tcxx . . $ int32_t# i = 0; i < index; ++i) |
| 592 | { |
| 593 | startPos[i] = Ra; |
| 594 | } |
| 595 | |
| 596 | return index; |
| 597 | } |
| 598 | |
| 599 | template<typename TRAITS, typename STRATEGY> |
| 600 | int32_tcxx . . $ int32_t# JlsCodeccxx . . $ JlsCodec#<TRAITS, STRATEGY>::DoRunModecxx . . $ JlsCodec#DoRunMode(a8ae98c68c517c04).(int32_tcxx . . $ int32_t# index, EncoderStrategycxx . . $ EncoderStrategy#*) |
| 601 | { |
| 602 | int32_tcxx . . $ int32_t# ctypeRem = _widthcxx . . $ JlsCodec#_width. - index; |
| 603 | PIXELcxx . . $ JlsCodec#PIXEL#* ptypeCurX = _currentLinecxx . . $ JlsCodec#_currentLine. +cxx . . $ std/operator+(933aeee3a62e2e30). index; |
| 604 | PIXELcxx . . $ JlsCodec#PIXEL#* ptypePrevX = _previousLinecxx . . $ JlsCodec#_previousLine. +cxx . . $ std/operator+(933aeee3a62e2e30). index; |
| 605 | |
| 606 | PIXELcxx . . $ JlsCodec#PIXEL# Ra = ptypeCurX[-1]; |
| 607 | |
| 608 | int32_tcxx . . $ int32_t# runLength = 0; |
| 609 | |
| 610 | while (traitscxx . . $ JlsCodec#traits..IsNear(ptypeCurX[runLength],Ra)) |
| 611 | { |
| 612 | ptypeCurX[runLength] = Ra; |
| 613 | runLength++; |
| 614 | |
| 615 | if (runLength == ctypeRem) |
| 616 | break; |
| 617 | } |
| 618 | |
| 619 | EncodeRunPixelscxx . . $ JlsCodec#EncodeRunPixels(918ebd27a9ddbad3).(runLength, runLength == ctypeRem); |
| 620 | |
| 621 | if (runLength == ctypeRem) |
| 622 | return runLength; |
| 623 | |
| 624 | ptypeCurX[runLength] = EncodeRIPixelcxx . . $ JlsCodec#EncodeRIPixel(f29c9e2551698e94).(ptypeCurX[runLength], Ra, ptypePrevX[runLength]); |
| 625 | DecrementRunIndexcxx . . $ JlsCodec#DecrementRunIndex(49f6e7a06ebc5aa8).(); |
| 626 | return runLength + 1; |
| 627 | } |
| 628 | |
| 629 | |
| 630 | template<typename TRAITS, typename STRATEGY> |
| 631 | int32_tcxx . . $ int32_t# JlsCodeccxx . . $ JlsCodec#<TRAITS, STRATEGY>::DoRunModecxx . . $ JlsCodec#DoRunMode(ac44e831fcce067e).(int32_tcxx . . $ int32_t# startIndex, DecoderStrategycxx . . $ DecoderStrategy#*) |
| 632 | { |
| 633 | PIXELcxx . . $ JlsCodec#PIXEL# Ra = _currentLinecxx . . $ JlsCodec#_currentLine.[startIndex-1]; |
| 634 | |
| 635 | int32_tcxx . . $ int32_t# runLength = DecodeRunPixelscxx . . $ JlsCodec#DecodeRunPixels(66d63e49f7ccefc6).(Ra, _currentLinecxx . . $ JlsCodec#_currentLine. +cxx . . $ std/operator+(933aeee3a62e2e30). startIndex, _widthcxx . . $ JlsCodec#_width. - startIndex); |
| 636 | int32_tcxx . . $ int32_t# endIndex = startIndex + runLength; |
| 637 | |
| 638 | if (endIndex == _widthcxx . . $ JlsCodec#_width.) |
| 639 | return endIndex - startIndex; |
| 640 | |
| 641 | // run interruption |
| 642 | PIXELcxx . . $ JlsCodec#PIXEL# Rb = _previousLinecxx . . $ JlsCodec#_previousLine.[endIndex]; |
| 643 | _currentLinecxx . . $ JlsCodec#_currentLine.[endIndex] = DecodeRIPixelcxx . . $ JlsCodec#DecodeRIPixel(8aaf4a9763b46b7b).(Ra, Rb); |
| 644 | DecrementRunIndexcxx . . $ JlsCodec#DecrementRunIndex(49f6e7a06ebc5aa8).(); |
| 645 | return endIndex - startIndex + 1; |
| 646 | } |
| 647 | |
| 648 | |
| 649 | // DoLine: Encodes/Decodes a scanline of samples |
| 650 | |
| 651 | template<typename TRAITS, typename STRATEGY> |
| 652 | void JlsCodeccxx . . $ JlsCodec#<TRAITS, STRATEGY>::DoLinecxx . . $ JlsCodec#DoLine(32935f3d4135b7d4).(SAMPLEcxx . . $ JlsCodec#SAMPLE#*) |
| 653 | { |
| 654 | int32_tcxx . . $ int32_t# index = 0; |
| 655 | int32_tcxx . . $ int32_t# Rb = _previousLinecxx . . $ JlsCodec#_previousLine.[index-1]; |
| 656 | int32_tcxx . . $ int32_t# Rd = _previousLinecxx . . $ JlsCodec#_previousLine.[index]; |
| 657 | |
| 658 | while(index < _widthcxx . . $ JlsCodec#_width.) |
| 659 | { |
| 660 | int32_tcxx . . $ int32_t# Ra = _currentLinecxx . . $ JlsCodec#_currentLine.[index -1]; |
| 661 | int32_tcxx . . $ int32_t# Rc = Rb; |
| 662 | Rb = Rd; |
| 663 | Rd = _previousLinecxx . . $ JlsCodec#_previousLine.[index + 1]; |
| 664 | |
| 665 | int32_tcxx . . $ int32_t# Qs = ComputeContextIDcxx . . $ ComputeContextID(2326284602b0bb2d).(QuantizeGratientcxx . . $ JlsCodec#QuantizeGratient(7864480464b09eea).(Rd - Rb), QuantizeGratientcxx . . $ JlsCodec#QuantizeGratient(7864480464b09eea).(Rb - Rc), QuantizeGratientcxx . . $ JlsCodec#QuantizeGratient(7864480464b09eea).(Rc - Ra)); |
| 666 | |
| 667 | if (Qs != 0) |
| 668 | { |
| 669 | _currentLinecxx . . $ JlsCodec#_currentLine.[index] = DoRegularcxx . . $ JlsCodec#DoRegular(1e997c4ce8f4bc14).(Qs, _currentLinecxx . . $ JlsCodec#_currentLine.[index], GetPredictedValuecxx . . $ GetPredictedValue(2326284602b0bb2d).(Ra, Rb, Rc), static_cast<STRATEGY*>(nullptr)); |
| 670 | index++; |
| 671 | } |
| 672 | else |
| 673 | { |
| 674 | index += DoRunModecxx . . $ JlsCodec#DoRunMode(a8ae98c68c517c04).(index, static_cast<STRATEGY*>(nullptr)); |
| 675 | Rb = _previousLinecxx . . $ JlsCodec#_previousLine.[index - 1]; |
| 676 | Rd = _previousLinecxx . . $ JlsCodec#_previousLine.[index]; |
| 677 | } |
| 678 | } |
| 679 | } |
| 680 | |
| 681 | |
| 682 | // DoLine: Encodes/Decodes a scanline of triplets in ILV_SAMPLE mode |
| 683 | |
| 684 | template<typename TRAITS, typename STRATEGY> |
| 685 | void JlsCodeccxx . . $ JlsCodec#<TRAITS, STRATEGY>::DoLinecxx . . $ JlsCodec#DoLine(2cd0d83ba0d922c9).(Tripletcxx . . $ Triplet#<SAMPLEcxx . . $ JlsCodec#SAMPLE#>*) |
| 686 | { |
| 687 | int32_tcxx . . $ int32_t# index = 0; |
| 688 | while(index < _widthcxx . . $ JlsCodec#_width.) |
| 689 | { |
| 690 | Tripletcxx . . $ Triplet#<SAMPLEcxx . . $ JlsCodec#SAMPLE#> Ra = _currentLinecxx . . $ JlsCodec#_currentLine.[index - 1]; |
| 691 | Tripletcxx . . $ Triplet#<SAMPLEcxx . . $ JlsCodec#SAMPLE#> Rc = _previousLinecxx . . $ JlsCodec#_previousLine.[index - 1]; |
| 692 | Tripletcxx . . $ Triplet#<SAMPLEcxx . . $ JlsCodec#SAMPLE#> Rb = _previousLinecxx . . $ JlsCodec#_previousLine.[index]; |
| 693 | Tripletcxx . . $ Triplet#<SAMPLEcxx . . $ JlsCodec#SAMPLE#> Rd = _previousLinecxx . . $ JlsCodec#_previousLine.[index + 1]; |
| 694 | |
| 695 | int32_tcxx . . $ int32_t# Qs1 = ComputeContextIDcxx . . $ ComputeContextID(2326284602b0bb2d).(QuantizeGratientcxx . . $ JlsCodec#QuantizeGratient(7864480464b09eea).(Rd.v1 -cxx . . $ std/operator-(a6e85813984128c7). Rb.v1), QuantizeGratientcxx . . $ JlsCodec#QuantizeGratient(7864480464b09eea).(Rb.v1 -cxx . . $ std/operator-(a6e85813984128c7). Rc.v1), QuantizeGratientcxx . . $ JlsCodec#QuantizeGratient(7864480464b09eea).(Rc.v1 -cxx . . $ std/operator-(a6e85813984128c7). Ra.v1)); |
| 696 | int32_tcxx . . $ int32_t# Qs2 = ComputeContextIDcxx . . $ ComputeContextID(2326284602b0bb2d).(QuantizeGratientcxx . . $ JlsCodec#QuantizeGratient(7864480464b09eea).(Rd.v2 -cxx . . $ std/operator-(a6e85813984128c7). Rb.v2), QuantizeGratientcxx . . $ JlsCodec#QuantizeGratient(7864480464b09eea).(Rb.v2 -cxx . . $ std/operator-(a6e85813984128c7). Rc.v2), QuantizeGratientcxx . . $ JlsCodec#QuantizeGratient(7864480464b09eea).(Rc.v2 -cxx . . $ std/operator-(a6e85813984128c7). Ra.v2)); |
| 697 | int32_tcxx . . $ int32_t# Qs3 = ComputeContextIDcxx . . $ ComputeContextID(2326284602b0bb2d).(QuantizeGratientcxx . . $ JlsCodec#QuantizeGratient(7864480464b09eea).(Rd.v3 -cxx . . $ std/operator-(a6e85813984128c7). Rb.v3), QuantizeGratientcxx . . $ JlsCodec#QuantizeGratient(7864480464b09eea).(Rb.v3 -cxx . . $ std/operator-(a6e85813984128c7). Rc.v3), QuantizeGratientcxx . . $ JlsCodec#QuantizeGratient(7864480464b09eea).(Rc.v3 -cxx . . $ std/operator-(a6e85813984128c7). Ra.v3)); |
| 698 | |
| 699 | if (Qs1 == 0 && Qs2 == 0 && Qs3 == 0) |
| 700 | { |
| 701 | index += DoRunModecxx . . $ JlsCodec#DoRunMode(a8ae98c68c517c04).(index, static_cast<STRATEGY*>(nullptr)); |
| 702 | } |
| 703 | else |
| 704 | { |
| 705 | Tripletcxx . . $ Triplet#<SAMPLEcxx . . $ JlsCodec#SAMPLE#> Rx; |
| 706 | Rx.v1 = DoRegularcxx . . $ JlsCodec#DoRegular(1e997c4ce8f4bc14).(Qs1, _currentLinecxx . . $ JlsCodec#_currentLine.[index].v1, GetPredictedValuecxx . . $ GetPredictedValue(2326284602b0bb2d).(Ra.v1, Rb.v1, Rc.v1), static_cast<STRATEGY*>(nullptr)); |
| 707 | Rx.v2 = DoRegularcxx . . $ JlsCodec#DoRegular(1e997c4ce8f4bc14).(Qs2, _currentLinecxx . . $ JlsCodec#_currentLine.[index].v2, GetPredictedValuecxx . . $ GetPredictedValue(2326284602b0bb2d).(Ra.v2, Rb.v2, Rc.v2), static_cast<STRATEGY*>(nullptr)); |
| 708 | Rx.v3 = DoRegularcxx . . $ JlsCodec#DoRegular(1e997c4ce8f4bc14).(Qs3, _currentLinecxx . . $ JlsCodec#_currentLine.[index].v3, GetPredictedValuecxx . . $ GetPredictedValue(2326284602b0bb2d).(Ra.v3, Rb.v3, Rc.v3), static_cast<STRATEGY*>(nullptr)); |
| 709 | _currentLinecxx . . $ JlsCodec#_currentLine.[index] = Rx; |
| 710 | index++; |
| 711 | } |
| 712 | } |
| 713 | } |
| 714 | |
| 715 | |
| 716 | // DoScan: Encodes or decodes a scan. |
| 717 | // In ILV_SAMPLE mode, multiple components are handled in DoLine |
| 718 | // In ILV_LINE mode, a call do DoLine is made for every component |
| 719 | // In ILV_NONE mode, DoScan is called for each component |
| 720 | |
| 721 | template<typename TRAITS, typename STRATEGY> |
| 722 | void JlsCodeccxx . . $ JlsCodec#<TRAITS, STRATEGY>::DoScancxx . . $ JlsCodec#DoScan(49f6e7a06ebc5aa8).() |
| 723 | { |
| 724 | int32_tcxx . . $ int32_t# pixelstride = _widthcxx . . $ JlsCodec#_width. + 4; |
| 725 | int components = Infocxx . . $ JlsCodec#Info(f4b07589550b5381).().interleaveMode ==cxx . . $ `operator==`(a45170b20b25cf3). charlscxx . . $ charls/::InterleaveModecxx . . $ charls/InterleaveMode#::Linecxx . . $ charls/InterleaveMode#Line. ? Infocxx . . $ JlsCodec#Info(f4b07589550b5381).().components : 1; |
| 726 | |
| 727 | std::vectorcxx . . $ std/vector#<PIXELcxx . . $ JlsCodec#PIXEL#> vectmp(2 * components * pixelstride); |
| 728 | std::vectorcxx . . $ std/vector#<int32_tcxx . . $ int32_t#> rgRUNindexcxx . . $ std/vector#vector(83fdeebbe0501a83).(components); |
| 729 | |
| 730 | for (int32_tcxx . . $ int32_t# line = 0; line <cxx . . $ std/`operator<`(c2ad8cf295ccec45). Infocxx . . $ JlsCodec#Info(f4b07589550b5381).().height; ++line) |
| 731 | { |
| 732 | _previousLinecxx . . $ JlsCodec#_previousLine. = &cxx . . $ std/`operator&`(b658760a236c1c89).vectmp[1]; |
| 733 | _currentLinecxx . . $ JlsCodec#_currentLine. = &cxx . . $ std/`operator&`(b658760a236c1c89).vectmp[1 + components * pixelstride]; |
| 734 | if ((line & 1) == 1) |
| 735 | { |
| 736 | std::swapcxx . . $ std/swap(c75b8fd57d7c2e06).(_previousLinecxx . . $ JlsCodec#_previousLine., _currentLinecxx . . $ JlsCodec#_currentLine.); |
| 737 | } |
| 738 | |
| 739 | STRATEGY::OnLineBegin(_widthcxx . . $ JlsCodec#_width., _currentLinecxx . . $ JlsCodec#_currentLine., pixelstride); |
| 740 | |
| 741 | for (int component = 0; component < components; ++component) |
| 742 | { |
| 743 | _RUNindexcxx . . $ JlsCodec#_RUNindex. = rgRUNindex[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).component]; |
| 744 | |
| 745 | // initialize edge pixels used for prediction |
| 746 | _previousLinecxx . . $ JlsCodec#_previousLine.[_widthcxx . . $ JlsCodec#_width.] = _previousLinecxx . . $ JlsCodec#_previousLine.[_widthcxx . . $ JlsCodec#_width. - 1]; |
| 747 | _currentLinecxx . . $ JlsCodec#_currentLine.[-1] = _previousLinecxx . . $ JlsCodec#_previousLine.[0]; |
| 748 | DoLinecxx . . $ JlsCodec#DoLine(2cd0d83ba0d922c9).(static_cast<PIXELcxx . . $ JlsCodec#PIXEL#*>(nullptr)); // dummy arg for overload resolution |
| 749 | |
| 750 | rgRUNindex[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).component] = _RUNindexcxx . . $ JlsCodec#_RUNindex.; |
| 751 | _previousLinecxx . . $ JlsCodec#_previousLine. += pixelstride; |
| 752 | _currentLinecxx . . $ JlsCodec#_currentLine. += pixelstride; |
| 753 | } |
| 754 | |
| 755 | if (_rectcxx . . $ JlsCodec#_rect..Ycxx . . $ JlsRect#Y. <= line && line < _rectcxx . . $ JlsCodec#_rect..Ycxx . . $ JlsRect#Y. + _rectcxx . . $ JlsCodec#_rect..Heightcxx . . $ JlsRect#Height.) |
| 756 | { |
| 757 | STRATEGY::OnLineEnd(_rectcxx . . $ JlsCodec#_rect..Widthcxx . . $ JlsRect#Width., _currentLinecxx . . $ JlsCodec#_currentLine. +cxx . . $ std/operator+(933aeee3a62e2e30). _rectcxx . . $ JlsCodec#_rect..Xcxx . . $ JlsRect#X. -cxx . . $ std/operator-(a6e85813984128c7). (components * pixelstride), pixelstride); |
| 758 | } |
| 759 | } |
| 760 | |
| 761 | STRATEGY::EndScan(); |
| 762 | } |
| 763 | |
| 764 | |
| 765 | // Factory function for ProcessLine objects to copy/transform unencoded pixels to/from our scanline buffers. |
| 766 | |
| 767 | template<typename TRAITS, typename STRATEGY> |
| 768 | ProcessLinecxx . . $ ProcessLine#* JlsCodeccxx . . $ JlsCodec#<TRAITS, STRATEGY>::CreateProcesscxx . . $ JlsCodec#CreateProcess(abcab31bdb531be5).(ByteStreamInfocxx . . $ ByteStreamInfo# info) |
| 769 | { |
| 770 | if (!IsInterleavedcxx . . $ JlsCodec#IsInterleaved(c9857a73d68e59ba).()) |
| 771 | { |
| 772 | return info.rawDatacxx . . $ ByteStreamInfo#rawData. ? |
| 773 | static_cast<ProcessLinecxx . . $ ProcessLine#*>(new PostProcesSingleComponentcxx . . $ PostProcesSingleComponent#(info.rawDatacxx . . $ ByteStreamInfo#rawData., Infocxx . . $ JlsCodec#Info(f4b07589550b5381).(), sizeof(typename TRAITS::PIXEL))) : |
| 774 | static_cast<ProcessLinecxx . . $ ProcessLine#*>(new PostProcesSingleStreamcxx . . $ PostProcesSingleStream#(info.rawStreamcxx . . $ ByteStreamInfo#rawStream., Infocxx . . $ JlsCodec#Info(f4b07589550b5381).(), sizeof(typename TRAITS::PIXEL))); |
| 775 | } |
| 776 | |
| 777 | if (Infocxx . . $ JlsCodec#Info(f4b07589550b5381).().colorTransformation ==cxx . . $ `operator==`(a45170b20b25cf3). ColorTransformationcxx . . $ charls/ColorTransformation#::Nonecxx . . $ charls/ColorTransformation#None.) |
| 778 | return new ProcessTransformedcxx . . $ ProcessTransformed#<TransformNonecxx . . $ TransformNone#<typename TRAITS::SAMPLE> >(info, Infocxx . . $ JlsCodec#Info(f4b07589550b5381).(), TransformNonecxx . . $ TransformNone#<SAMPLEcxx . . $ JlsCodec#SAMPLE#>()); |
| 779 | |
| 780 | if (Infocxx . . $ JlsCodec#Info(f4b07589550b5381).().bitsPerSample ==cxx . . $ `operator==`(a45170b20b25cf3). sizeof(SAMPLEcxx . . $ JlsCodec#SAMPLE#) * 8) |
| 781 | { |
| 782 | switch (Infocxx . . $ JlsCodec#Info(f4b07589550b5381).().colorTransformation) |
| 783 | { |
| 784 | case ColorTransformationcxx . . $ charls/ColorTransformation#::HP1cxx . . $ charls/ColorTransformation#HP1.: return new ProcessTransformedcxx . . $ ProcessTransformed#<TransformHp1cxx . . $ TransformHp1#<SAMPLEcxx . . $ JlsCodec#SAMPLE#>>(info, Infocxx . . $ JlsCodec#Info(f4b07589550b5381).(), TransformHp1cxx . . $ TransformHp1#<SAMPLEcxx . . $ JlsCodec#SAMPLE#>()); |
| 785 | case ColorTransformationcxx . . $ charls/ColorTransformation#::HP2cxx . . $ charls/ColorTransformation#HP2.: return new ProcessTransformedcxx . . $ ProcessTransformed#<TransformHp2cxx . . $ TransformHp2#<SAMPLEcxx . . $ JlsCodec#SAMPLE#>>(info, Infocxx . . $ JlsCodec#Info(f4b07589550b5381).(), TransformHp2cxx . . $ TransformHp2#<SAMPLEcxx . . $ JlsCodec#SAMPLE#>()); |
| 786 | case ColorTransformationcxx . . $ charls/ColorTransformation#::HP3cxx . . $ charls/ColorTransformation#HP3.: return new ProcessTransformedcxx . . $ ProcessTransformed#<TransformHp3cxx . . $ TransformHp3#<SAMPLEcxx . . $ JlsCodec#SAMPLE#>>(info, Infocxx . . $ JlsCodec#Info(f4b07589550b5381).(), TransformHp3cxx . . $ TransformHp3#<SAMPLEcxx . . $ JlsCodec#SAMPLE#>()); |
| 787 | default: |
| 788 | std::ostringstreamcxx . . $ std/ostringstream# messagecxx . . $ std/__cxx11/basic_ostringstream#basic_ostringstream(49f6e7a06ebc5aa8).; |
| 789 | message <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Color transformation " <<cxx . . $ `operator<<`(33ed17dcdfa34940). Infocxx . . $ JlsCodec#Info(f4b07589550b5381).().colorTransformation <<cxx . . $ `operator<<`(33ed17dcdfa34940). " is not supported."; |
| 790 | throw CreateSystemErrorcxx . . $ CreateSystemError(9c8a399c41c68ad7).(ApiResultcxx . . $ charls/ApiResult#::UnsupportedColorTransformcxx . . $ charls/ApiResult#UnsupportedColorTransform., message.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).()); |
| 791 | } |
| 792 | } |
| 793 | |
| 794 | if (Infocxx . . $ JlsCodec#Info(f4b07589550b5381).().bitsPerSample >cxx . . $ std/`operator>`(c2ad8cf295ccec45). 8) |
| 795 | { |
| 796 | int shift = 16 -cxx . . $ std/operator-(a6e85813984128c7). Infocxx . . $ JlsCodec#Info(f4b07589550b5381).().bitsPerSample; |
| 797 | switch (Infocxx . . $ JlsCodec#Info(f4b07589550b5381).().colorTransformation) |
| 798 | { |
| 799 | case ColorTransformationcxx . . $ charls/ColorTransformation#::HP1cxx . . $ charls/ColorTransformation#HP1.: return new ProcessTransformedcxx . . $ ProcessTransformed#<TransformShiftedcxx . . $ TransformShifted#<TransformHp1cxx . . $ TransformHp1#<uint16_tcxx . . $ uint16_t#>>>(info, Infocxx . . $ JlsCodec#Info(f4b07589550b5381).(), TransformShiftedcxx . . $ TransformShifted#<TransformHp1cxx . . $ TransformHp1#<uint16_tcxx . . $ uint16_t#>>(shift)); |
| 800 | case ColorTransformationcxx . . $ charls/ColorTransformation#::HP2cxx . . $ charls/ColorTransformation#HP2.: return new ProcessTransformedcxx . . $ ProcessTransformed#<TransformShiftedcxx . . $ TransformShifted#<TransformHp2cxx . . $ TransformHp2#<uint16_tcxx . . $ uint16_t#>>>(info, Infocxx . . $ JlsCodec#Info(f4b07589550b5381).(), TransformShiftedcxx . . $ TransformShifted#<TransformHp2cxx . . $ TransformHp2#<uint16_tcxx . . $ uint16_t#>>(shift)); |
| 801 | case ColorTransformationcxx . . $ charls/ColorTransformation#::HP3cxx . . $ charls/ColorTransformation#HP3.: return new ProcessTransformedcxx . . $ ProcessTransformed#<TransformShiftedcxx . . $ TransformShifted#<TransformHp3cxx . . $ TransformHp3#<uint16_tcxx . . $ uint16_t#>>>(info, Infocxx . . $ JlsCodec#Info(f4b07589550b5381).(), TransformShiftedcxx . . $ TransformShifted#<TransformHp3cxx . . $ TransformHp3#<uint16_tcxx . . $ uint16_t#>>(shift)); |
| 802 | default: |
| 803 | std::ostringstreamcxx . . $ std/ostringstream# messagecxx . . $ std/__cxx11/basic_ostringstream#basic_ostringstream(49f6e7a06ebc5aa8).; |
| 804 | message <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Color transformation " <<cxx . . $ `operator<<`(33ed17dcdfa34940). Infocxx . . $ JlsCodec#Info(f4b07589550b5381).().colorTransformation <<cxx . . $ `operator<<`(33ed17dcdfa34940). " is not supported."; |
| 805 | throw CreateSystemErrorcxx . . $ CreateSystemError(9c8a399c41c68ad7).(ApiResultcxx . . $ charls/ApiResult#::UnsupportedColorTransformcxx . . $ charls/ApiResult#UnsupportedColorTransform., message.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).()); |
| 806 | } |
| 807 | } |
| 808 | |
| 809 | throw stdcxx . . $ std/system_error#system_error(bd3fb6dddb5bfcf6).::system_errorcxx . . $ std/system_error#(static_cast<int>(ApiResultcxx . . $ charls/ApiResult#::UnsupportedBitDepthForTransformcxx . . $ charls/ApiResult#UnsupportedBitDepthForTransform.), CharLSCategoryInstancecxx . . $ CharLSCategoryInstance(d722c6fa07888cca).()); |
| 810 | } |
| 811 | |
| 812 | |
| 813 | // Setup codec for encoding and calls DoScan |
| 814 | |
| 815 | template<typename TRAITS, typename STRATEGY> |
| 816 | size_t JlsCodeccxx . . $ JlsCodec#<TRAITS, STRATEGY>::EncodeScancxx . . $ JlsCodec#EncodeScan(24438083e3ed8c66).(std::unique_ptrcxx . . $ std/unique_ptr#<ProcessLinecxx . . $ ProcessLine#> processLine, ByteStreamInfocxx . . $ ByteStreamInfo#& compressedData, void* pvoidCompare) |
| 817 | { |
| 818 | STRATEGY::_processLine = std::movecxx . . $ std/move(e35c19a1ba7baa26).(processLine); |
| 819 | |
| 820 | ByteStreamInfocxx . . $ ByteStreamInfo# info = { nullptr, static_cast<uint8_tcxx . . $ uint8_t#*>(pvoidCompare), compressedData.countcxx . . $ ByteStreamInfo#count. }; |
| 821 | if (pvoidCompare) |
| 822 | { |
| 823 | STRATEGY::_qdecoder = std::unique_ptrcxx . . $ std/unique_ptr#<DecoderStrategycxx . . $ DecoderStrategy#>(new JlsCodeccxx . . $ JlsCodec#<TRAITS, DecoderStrategycxx . . $ DecoderStrategy#>(traitscxx . . $ JlsCodec#traits., Infocxx . . $ JlsCodec#Info(f4b07589550b5381).())); |
| 824 | STRATEGY::_qdecoder->Init(info); |
| 825 | } |
| 826 | |
| 827 | STRATEGY::Init(compressedData); |
| 828 | |
| 829 | DoScancxx . . $ JlsCodec#DoScan(49f6e7a06ebc5aa8).(); |
| 830 | |
| 831 | return STRATEGY::GetLength(); |
| 832 | } |
| 833 | |
| 834 | // Setup codec for decoding and calls DoScan |
| 835 | |
| 836 | |
| 837 | template<typename TRAITS, typename STRATEGY> |
| 838 | void JlsCodeccxx . . $ JlsCodec#<TRAITS, STRATEGY>::DecodeScancxx . . $ JlsCodec#DecodeScan(324d756b715f9dd3).(std::unique_ptrcxx . . $ std/unique_ptr#<ProcessLinecxx . . $ ProcessLine#> processLine, const JlsRectcxx . . $ JlsRect#& rect, ByteStreamInfocxx . . $ ByteStreamInfo#& compressedData, bool bCompare) |
| 839 | { |
| 840 | STRATEGY::_processLine = std::movecxx . . $ std/move(e35c19a1ba7baa26).(processLine); |
| 841 | |
| 842 | uint8_tcxx . . $ uint8_t#* compressedBytes = const_cast<uint8_tcxx . . $ uint8_t#*>(static_cast<const uint8_tcxx . . $ uint8_t#*>(compressedData.rawDatacxx . . $ ByteStreamInfo#rawData.)); |
| 843 | _bComparecxx . . $ JlsCodec#_bCompare. = bCompare; |
| 844 | _rectcxx . . $ JlsCodec#_rect. =cxx . . $ JlsRect#`operator=`(d037d247758fe812). rect; |
| 845 | |
| 846 | STRATEGY::Init(compressedData); |
| 847 | DoScancxx . . $ JlsCodec#DoScan(49f6e7a06ebc5aa8).(); |
| 848 | SkipBytescxx . . $ SkipBytes(28577699bb37f66).(compressedData, STRATEGY::GetCurBytePos() -cxx . . $ std/operator-(a6e85813984128c7). compressedBytes); |
| 849 | } |
| 850 | |
| 851 | |
| 852 | // Initialize the codec data structures. Depends on JPEG-LS parameters like T1-T3. |
| 853 | template<typename TRAITS, typename STRATEGY> |
| 854 | void JlsCodeccxx . . $ JlsCodec#<TRAITS, STRATEGY>::InitParamscxx . . $ JlsCodec#InitParams(748afa4755bc9595).(int32_tcxx . . $ int32_t# t1, int32_tcxx . . $ int32_t# t2, int32_tcxx . . $ int32_t# t3, int32_tcxx . . $ int32_t# nReset) |
| 855 | { |
| 856 | T1cxx . . $ JlsCodec#T1. = t1; |
| 857 | T2cxx . . $ JlsCodec#T2. = t2; |
| 858 | T3cxx . . $ JlsCodec#T3. = t3; |
| 859 | |
| 860 | InitQuantizationLUTcxx . . $ JlsCodec#InitQuantizationLUT(49f6e7a06ebc5aa8).(); |
| 861 | |
| 862 | int32_tcxx . . $ int32_t# A = MAXcxx . . $ `Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/util.h:45:9`!(2, (traits.RANGE + 32)/64); |
| 863 | for (unsigned int Q = 0; Q < sizeof(_contextscxx . . $ JlsCodec#_contexts.) / sizeof(_contextscxx . . $ JlsCodec#_contexts.[0]); ++Q) |
| 864 | { |
| 865 | _contextscxx . . $ JlsCodec#_contexts.[Q] =cxx . . $ JlsContext#`operator=`(8cb10d9fd0136415). JlsContextcxx . . $ JlsContext#(A); |
| 866 | } |
| 867 | |
| 868 | _contextRunmodecxx . . $ JlsCodec#_contextRunmode.[0] =cxx . . $ CContextRunMode#`operator=`(8f24a4d7e8f85cc4). CContextRunModecxx . . $ CContextRunMode#(MAXcxx . . $ `Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/util.h:45:9`!(2, (traits.RANGE + 32)/64), 0, nReset); |
| 869 | _contextRunmodecxx . . $ JlsCodec#_contextRunmode.[1] =cxx . . $ CContextRunMode#`operator=`(8f24a4d7e8f85cc4). CContextRunModecxx . . $ CContextRunMode#(MAXcxx . . $ `Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmcharls/util.h:45:9`!(2, (traits.RANGE + 32)/64), 1, nReset); |
| 870 | _RUNindexcxx . . $ JlsCodec#_RUNindex. = 0; |
| 871 | } |
| 872 | |
| 873 | #endif |