std::vector<signed char> CreateQLutLossless(LONG cbit) { Presets preset = ComputeDefault((1 << cbit) - 1, 0); LONG range = preset.MAXVAL + 1; std::vector<signed char> lut; lut.resize(range * 2); for (LONG diff = -range; diff < range; diff++) { lut[range + diff] = QuantizeGratientOrg(preset, 0,diff); } return lut; }
void JLSOutputStream::AddScan(const void* compareData, const JlsParameters* pparams) { if (pparams->jfif.Ver) { _segments.push_back(CreateJFIF(&pparams->jfif)); } if (!IsDefault(&pparams->custom)) { _segments.push_back(CreateLSE(&pparams->custom)); } else if (pparams->bitspersample > 12) { JlsCustomParameters preset = ComputeDefault((1 << pparams->bitspersample) - 1, pparams->allowedlossyerror); _segments.push_back(CreateLSE(&preset)); } _icompLast += 1; _segments.push_back(EncodeStartOfScan(pparams,pparams->ilv == ILV_NONE ? _icompLast : -1)); Size size = Size(pparams->width, pparams->height); int ccomp = pparams->ilv == ILV_NONE ? 1 : pparams->components; _segments.push_back(new JpegImageDataSegment(compareData, *pparams, _icompLast, ccomp)); }