The road to software hell is paved with little expediencies that seemed harmless to the developers at the time. For the current mess, the expedient paving stones are: - Using the .lrcat-data file as both a store for the develop parameters and as a discardable cache of develop results for enhancing performance. - Storing both develop parameters and cached results in .xmp sidecars, rather than separating them into .xmp and .acr sidecars as Camera Raw does. - When LR saves metadata to disk, it first copies settings and cached results from .lrcat-data into the .lrcat file. - LR stores no random seed for the random algorithms of Generative AI Remove, so its generated replacement patches must be considered as develop settings rather than as discardable computed results that are cached for performance. I think all of these expedient paving stones have resulted in unncessary architectural compications making it harder for the developers to think clearly about the proper design and implementation of Denoise and other expensive AI commands. DETAILED HISTORY Originally, all develop settings were stored only in the SQL database (.lrcat file). The stored settings were all "parametric", describing the function to be applied to the image (e.g. slider settings or brush strokes), rather than containing the resulting pixels of the function. LR 11.0 introduced the computed AI masks Subject and Sky. It also introduced the .lrcat-data file for storing the computed pixels of these masks as well as LUTs (color lookup tables) from imported enhanced profiles. The pre-version-11 code for saving metadata to disk found all the develop settings in the .lrcat file. But version 11 stored the subject/sky mask pixels as well as profile LUTs in the .lrcat file, with the express purpose of making the .lrcat file smaller and making it faster for the Camera Raw engine to access these relatively large binary objects ("blobs"). Rather than changing the save-metadata-to-disk code to read those settings and results from the .lrcat-file, the developers found it more expedient to copy them from the .lrcat-data file into the .lrcat file before invoking the existing save-metadata-to-disk code. This expediency didn't create huge issues, though, since the pixel masks and LUTs compress well and are relatively small. Another architectural confusion introduced in LR 11.0: The .lrcat-data file and .xmp sidecars are used both as a cache for storing the computed results of the sky and subject masks and as a store of the develop parameters of enhanced-profile LUTs. The pixels of the sky and subject masks are not develop parameters -- rather, they're computed from the parameters (the presence of the masks in the Masking panel). You can throw away the computed pixel masks and LR will recompute the masks, producing the same exact pixels. This is exactly how all the previously introduced Develop settings work. Thus, you can throw away the .lrcat-data file and .xmp sidecars and the sky and subject masks will produce the same exact results. For these settings. the .lrcat-data file is simply a cache for accelerating performance. But for the LUTs of enhanced profiles, the .lrcat-data is the store of the "truth", in the same way the .lrcat file stores the truth of all the other develop settings. If you throw away the .lrcat-data file and the enhanced profiles' .xmp files, LR isn't able to recompute the effects of the enhanced profiles because the LUTs are missing (all the other parameters of the enhanced profiles are stored in the .lrcat file). This is unlike develop presets, where you can throw away the presets' .xmp files and LR will still be able to render cataloged images, because the presets' settings are stored in the .lrcat file. LR 14.0 introduced Generative AI Remove. One might think that the parameters of AI Remove are simply the brush strokes applied by the user and the index number of the chosen variant, both of which are small and can be stored in the .lrcat file without huge impact (as the strokes of the brush mask are stored). However, Generative AI Remove is not mathematically idempotent, like all other develop settings. That is, if you reapply the exact same brush strokes to an image, the Adobe Firefly server will return different results each time. The Firefly AI algorithms have randomness built in to them, as many image-processing algorithms do. In a better implementation, that randomness would have been controlled by a "seed" number provided by clients like LR, so they could recompute the exact same results later; but that's not how Firefly is implemented, or if it is, LR isn't using the seeds, another design flaw. Thus, the computed replacement patches of AI Remove must be considered as parameters necessary to render the image the same way each time, not as cached results. And since those computed patches are stored in the .lrcat-data file and .xmp sidecars, the files serve as the only store for Remove parameters, rather than as a performance cache that can be discarded. Users of the Imagen AI service discovered this the hard way when Imagen AI corrupted their .lrcat-data files. The only fix was to discard the corrupted .lrcat-data files, resulting in different Generative AI Remove results for existing cataloged photos. (This was primarily Imagen AI's fault for writing their results directly into the LR catalog rather than using the SDK APIs -- shame on them.) And then LR 14.4 introduced the new implementation of Denoise, in which the computed whole-image results are stored in the .lrcat-data file. These results are huge, typically 5 to 50 MB per image, depending on the degree of detail in the image, two to three orders of magnitude larger than all the other develop settings and computed results. But the Denoise results are not develop parameters -- they can be discarded and Denoise will recompute the same exact results. The only parameters are the checkbox and the slider. But because it takes so long to compute Denoise, it's crucial that its results get cached for performance. Up until Denoise, it didn't matter much that saving metadata to disk copied develop settings from .lrcat-data into .lrcat before writing them to the .xmp sidecars. The needlessly copied settings were relatively small. But the huge size of Denoise compiled with saving metadata to disk bloats the .lrcat file, negating the original purpose of the .lrcat-data file. And if LR reserved .xmp sidecars for parameters and .acr sidecars for computed results, as Camera Raw does, the LR developers might have thought more clearly about the architectural principles sooner and implemented saving metadata to disk properly.
... View more