// Copyright (c) the JPEG XL Project Authors. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file.
struct QuantizedPatch {
size_t xsize;
size_t ysize;
QuantizedPatch() { for (size_t i = 0; i < 3; i++) {
pixels[i].resize(kMaxPatchSize * kMaxPatchSize);
fpixels[i].resize(kMaxPatchSize * kMaxPatchSize);
}
}
std::vector<int8_t> pixels[3] = {}; // Not compared. Used only to retrieve original pixels to construct the // reference image.
std::vector<float> fpixels[3] = {}; booloperator==(const QuantizedPatch& other) const { if (xsize != other.xsize) returnfalse; if (ysize != other.ysize) returnfalse; for (size_t c = 0; c < 3; c++) { if (memcmp(pixels[c].data(), other.pixels[c].data(), sizeof(int8_t) * xsize * ysize) != 0) returnfalse;
} returntrue;
}
booloperator<(const QuantizedPatch& other) const { if (xsize != other.xsize) return xsize < other.xsize; if (ysize != other.ysize) return ysize < other.ysize; for (size_t c = 0; c < 3; c++) { int cmp = memcmp(pixels[c].data(), other.pixels[c].data(), sizeof(int8_t) * xsize * ysize); if (cmp > 0) returnfalse; if (cmp < 0) returntrue;
} returnfalse;
}
};
// Pair (patch, vector of occurrences). using PatchInfo =
std::pair<QuantizedPatch, std::vector<std::pair<uint32_t, uint32_t>>>;
// Friend class of PatchDictionary. class PatchDictionaryEncoder { public: // Only call if HasAny(). static Status Encode(const PatchDictionary& pdic, BitWriter* writer,
LayerType layer, AuxOut* aux_out);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.