Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughUpdates across PhotoLocator: FloatBitmap string/error text changes; a Debug.Assert added to IIRSmoothOperation; CMYK 8-bit channel bytes are inverted during PSD loading; removed explicit empty-folder entries from the PhotoshopImageLoader project; submodule commit hash bumped. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip You can disable sequence diagrams in the walkthrough.Disable the |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
PhotoLocator/PictureFileFormats/PhotoshopFileFormatHandler.cs (1)
71-74: Correct fix for CMYK color space conversion.PSD files store CMYK as ink density (0 = no ink, 255 = full ink), while WPF's
Cmyk32expects the inverse (255 = no ink). The byte inversion correctly resolves this mismatch.Minor optimization: the inversion could be folded into the parallel extraction to avoid a second pass over the pixel array, though the current approach is perfectly acceptable for typical image sizes.
♻️ Optional: Merge inversion into parallel loop
if (psd.BitDepth == 8) { var pixels = new byte[layer.Rect.Width * layer.Rect.Height * 4]; - Parallel.For(0, 4, ch => GetChannelPixels8(layer.Channels.GetId(ch), pixels, ch, 4)); - for (int i = 0; i < pixels.Length; i++) - pixels[i] = (byte)(255 - pixels[i]); + Parallel.For(0, 4, ch => GetChannelPixels8Inverted(layer.Channels.GetId(ch), pixels, ch, 4)); return BitmapSource.Create(layer.Rect.Width, layer.Rect.Height, 96, 96, PixelFormats.Cmyk32, null, pixels, layer.Rect.Width * 4); }Add a new helper method:
private static void GetChannelPixels8Inverted(Channel channel, byte[] dest, int offset, int dist) { var size = channel.Rect.Width * channel.Rect.Height; var source = channel.ImageData; for (int iSrc = 0, iDst = offset; iSrc < size; iSrc++, iDst += dist) dest[iDst] = (byte)(255 - source[iSrc]); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@PhotoLocator/PictureFileFormats/PhotoshopFileFormatHandler.cs` around lines 71 - 74, PSD CMYK channels store ink density (0=no ink, 255=full ink) but WPF's Cmyk32 expects the inverse, so keep the byte inversion when building the pixel buffer in PhotoshopFileFormatHandler (the current two-pass inversion is correct); as an optional optimization, avoid the separate inversion loop by folding inversion into the channel extraction step—add a helper like GetChannelPixels8Inverted and call it in place of the current GetChannelPixels8 so the pixels array is filled already inverted before calling BitmapSource.Create.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@PhotoLocator/PictureFileFormats/PhotoshopFileFormatHandler.cs`:
- Around line 71-74: PSD CMYK channels store ink density (0=no ink, 255=full
ink) but WPF's Cmyk32 expects the inverse, so keep the byte inversion when
building the pixel buffer in PhotoshopFileFormatHandler (the current two-pass
inversion is correct); as an optional optimization, avoid the separate inversion
loop by folding inversion into the channel extraction step—add a helper like
GetChannelPixels8Inverted and call it in place of the current GetChannelPixels8
so the pixels array is filled already inverted before calling
BitmapSource.Create.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e97f77c1-4ebf-40ff-927e-9ad083457d7e
📒 Files selected for processing (5)
PhotoLocator/BitmapOperations/FloatBitmap.csPhotoLocator/BitmapOperations/IIRSmoothOperation.csPhotoLocator/PictureFileFormats/PhotoshopFileFormatHandler.csPhotoshopImageLoader/PhotoLocator.PhotoshopImageLoader.csprojPsdPlugin
💤 Files with no reviewable changes (1)
- PhotoshopImageLoader/PhotoLocator.PhotoshopImageLoader.csproj
Summary by CodeRabbit
Bug Fixes
Improvements
Chores