#ifndef COMPONENTS_ZUCCHINI_ZUCCHINI_GEN_H_
#define COMPONENTS_ZUCCHINI_ZUCCHINI_GEN_H_
#include <vector>
#include "components/zucchini/buffer_view.h"
#include "components/zucchini/image_utils.h"
#include "components/zucchini/zucchini.h"
namespace zucchini {
class EquivalenceMap;
class OffsetMapper;
class ImageIndex;
class PatchElementWriter;
class ReferenceDeltaSink;
class ReferenceSet;
class TargetPool;
std::vector<offset_t> FindExtraTargets(const TargetPool& projected_old_targets,
const TargetPool& new_targets);
EquivalenceMap CreateEquivalenceMap(const ImageIndex& old_image_index,
const ImageIndex& new_image_index);
bool GenerateEquivalencesAndExtraData(ConstBufferView new_image,
const EquivalenceMap& equivalence_map,
PatchElementWriter* patch_writer);
bool GenerateRawDelta(
ConstBufferView old_image,
ConstBufferView new_image,
const EquivalenceMap& equivalence_map,
const ImageIndex& new_image_index,
const std::map<TypeTag, std::unique_ptr<ReferenceMixer>>& reference_mixers,
PatchElementWriter* patch_writer);
bool GenerateReferencesDelta(const ReferenceSet& src_refs,
const ReferenceSet& dst_refs,
const TargetPool& projected_target_pool,
const OffsetMapper& offset_mapper,
const EquivalenceMap& equivalence_map,
ReferenceDeltaSink* reference_delta_sink);
bool GenerateExtraTargets(const std::vector<offset_t>& extra_targets,
PoolTag pool_tag,
PatchElementWriter* patch_writer);
bool GenerateRawElement(const std::vector<offset_t>& old_sa,
ConstBufferView old_image,
ConstBufferView new_image,
PatchElementWriter* patch_writer);
bool GenerateExecutableElement(ExecutableType exe_type,
ConstBufferView old_image,
ConstBufferView new_image,
PatchElementWriter* patch_writer);
}
#endif