crates/gamut-tiff/src/metadata.rs carries resolve_pointers, a restatement of
gamut_ifd::reader::resolve_pointers_with. Inside the subtree it walks, the two are
indistinguishable — same pointer-type rule, same cycle guard, same "too deep" message — and the
copy exists for one reason only: gamut_ifd::read_tree resolves the flat tag list it is handed at
every node of every page, while TiffDecoder::metadata must resolve it over IFD 0's subtree
and nowhere else. A pointer on a page whose content the seam discards was failing the whole call
(#520, rounds 1-3).
Two copies of one walk is a drift hazard: the local one has since gained a BTreeSet visited set
and a tighter depth bound, and the shared one has neither. The scoping the copy exists for is a
gamut-ifd surface, not a gamut-tiff decision.
What is wanted is an entry point in gamut-ifd that resolves a pointer list over one
directory's subtree, given a directory already parsed out of a file — read_ifd_at plus the
guards, which is exactly resolve_pointers_with with its fetch closure exposed. gamut-tiff
then calls it and deletes its copy; gamut-dng, which degrades rather than fails, is a second
plausible consumer.
It could not be done in #520: that PR is stacked on #508 and its manifest is crates/gamut-tiff/,
so touching gamut-ifd was out of scope. Do it once the stack has merged.
Filed from the review of #520.
crates/gamut-tiff/src/metadata.rscarriesresolve_pointers, a restatement ofgamut_ifd::reader::resolve_pointers_with. Inside the subtree it walks, the two areindistinguishable — same pointer-type rule, same cycle guard, same "too deep" message — and the
copy exists for one reason only:
gamut_ifd::read_treeresolves the flat tag list it is handed atevery node of every page, while
TiffDecoder::metadatamust resolve it over IFD 0's subtreeand nowhere else. A pointer on a page whose content the seam discards was failing the whole call
(#520, rounds 1-3).
Two copies of one walk is a drift hazard: the local one has since gained a
BTreeSetvisited setand a tighter depth bound, and the shared one has neither. The scoping the copy exists for is a
gamut-ifdsurface, not agamut-tiffdecision.What is wanted is an entry point in
gamut-ifdthat resolves a pointer list over onedirectory's subtree, given a directory already parsed out of a file —
read_ifd_atplus theguards, which is exactly
resolve_pointers_withwith itsfetchclosure exposed.gamut-tiffthen calls it and deletes its copy;
gamut-dng, which degrades rather than fails, is a secondplausible consumer.
It could not be done in #520: that PR is stacked on #508 and its manifest is
crates/gamut-tiff/,so touching
gamut-ifdwas out of scope. Do it once the stack has merged.Filed from the review of #520.