// Copyright 2017 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_ZUCCHINI_ENCODED_VIEW_H_ #define COMPONENTS_ZUCCHINI_ENCODED_VIEW_H_ #include <stddef.h> #include <stdint.h> #include <iterator> #include <vector> #include "base/memory/raw_ptr.h" #include "base/memory/raw_ref.h" #include "components/zucchini/image_index.h" #include "components/zucchini/image_utils.h" namespace zucchini { // Zucchini-gen performs semantics-aware matching: // - Same-typed reference target in "old" and "new" can be associated. // Associated targets are assigned an identifier called "label" (and for // unassociated targets, label = 0). // - EncodedView maps each offset in "old" and "new" images to a "projected // value", which can be: // - Raw byte value (0-255) for non-references. // - Reference "projected value" (> 256) that depends on target {type, label} // at each reference's location (byte 0). // - Reference padding value (256) at the body of each reference (bytes 1+). // - The projected values for "old" and "new" are used to build the equivalence // map. constexpr size_t kReferencePaddingProjection = …; constexpr size_t kBaseReferenceProjection = …; // A Range (providing begin and end iterators) that adapts ImageIndex to make // image data appear as an Encoded Image, that is encoded data under a higher // level of abstraction than raw bytes. In particular: // - First byte of each reference become a projection of its type and label. // - Subsequent bytes of each reference becomes |kReferencePaddingProjection|. // - Non-reference raw bytes remain as raw bytes. class EncodedView { … }; } // namespace zucchini #endif // COMPONENTS_ZUCCHINI_ENCODED_VIEW_H_