[PR #742] [MERGED] Compare images using raw data #1193

Closed
opened 2026-02-26 09:33:58 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/NickeManarin/ScreenToGif/pull/742
Author: @DarkOoze
Created: 10/10/2020
Status: Merged
Merged: 4/27/2021
Merged by: @NickeManarin

Base: pr/742Head: image-array-pool


📝 Commits (5)

  • 7418fbf Adds method to get row pixel data
  • 47555f7 Load image to line buffer for lower memory allocation
  • 1014807 Compare images in parallel for improved performance
  • f99a4d5 Fix out of index exception on undo command
  • 488fd68 Add test for CalculateDifference

📊 Changes

9 files changed (+166 additions, -59 deletions)

View changed files

📝 GifRecorder.sln (+19 -0)
ScreenToGif.Tests/ImageMethods.cs (+33 -0)
ScreenToGif.Tests/ScreenToGif.Tests.csproj (+29 -0)
ScreenToGif.Tests/TestData/b1.bmp (+0 -0)
ScreenToGif.Tests/TestData/b2.bmp (+0 -0)
📝 ScreenToGif/ImageUtil/Gif/LegacyEncoder/PixelUtilOld.cs (+18 -0)
📝 ScreenToGif/ImageUtil/ImageMethods.cs (+34 -44)
📝 ScreenToGif/Properties/AssemblyInfo.cs (+3 -0)
📝 ScreenToGif/Windows/Editor.xaml.cs (+30 -15)

📄 Description

Improves the performance of image comparison by using raw data instead of Color structs.

Reading the image to the buffer line by line to prevent the array getting placed on the LOH.
Did not save the measurements I did, but from memory I think this lowered the time from around 80ms to 10ms per image pair.

This adds some dependencies and complexity, not sure what you think of that.
Made a smaller edit with improvements if you rather not add more dependencies I can make a pull-request of that:
https://github.com/DarkOoze/ScreenToGif/tree/local-counter

P.S. My first pull-request, please be gentle 😄.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/NickeManarin/ScreenToGif/pull/742 **Author:** [@DarkOoze](https://github.com/DarkOoze) **Created:** 10/10/2020 **Status:** ✅ Merged **Merged:** 4/27/2021 **Merged by:** [@NickeManarin](https://github.com/NickeManarin) **Base:** `pr/742` ← **Head:** `image-array-pool` --- ### 📝 Commits (5) - [`7418fbf`](https://github.com/NickeManarin/ScreenToGif/commit/7418fbfee0efc67fc191eeea0ff8210a0b12c88a) Adds method to get row pixel data - [`47555f7`](https://github.com/NickeManarin/ScreenToGif/commit/47555f73546c4a0b94f13faa11245b10c7b2ff35) Load image to line buffer for lower memory allocation - [`1014807`](https://github.com/NickeManarin/ScreenToGif/commit/10148078e7b294b0d479a6dfc57477443054ddbf) Compare images in parallel for improved performance - [`f99a4d5`](https://github.com/NickeManarin/ScreenToGif/commit/f99a4d512a5b5b8e88f5f0a3ea495f1759c4b8b8) Fix out of index exception on undo command - [`488fd68`](https://github.com/NickeManarin/ScreenToGif/commit/488fd689f13d9737e79f342b1137a8f835d67a27) Add test for CalculateDifference ### 📊 Changes **9 files changed** (+166 additions, -59 deletions) <details> <summary>View changed files</summary> 📝 `GifRecorder.sln` (+19 -0) ➕ `ScreenToGif.Tests/ImageMethods.cs` (+33 -0) ➕ `ScreenToGif.Tests/ScreenToGif.Tests.csproj` (+29 -0) ➕ `ScreenToGif.Tests/TestData/b1.bmp` (+0 -0) ➕ `ScreenToGif.Tests/TestData/b2.bmp` (+0 -0) 📝 `ScreenToGif/ImageUtil/Gif/LegacyEncoder/PixelUtilOld.cs` (+18 -0) 📝 `ScreenToGif/ImageUtil/ImageMethods.cs` (+34 -44) 📝 `ScreenToGif/Properties/AssemblyInfo.cs` (+3 -0) 📝 `ScreenToGif/Windows/Editor.xaml.cs` (+30 -15) </details> ### 📄 Description Improves the performance of image comparison by using raw data instead of Color structs. Reading the image to the buffer line by line to prevent the array getting placed on the LOH. Did not save the measurements I did, but from memory I think this lowered the time from around 80ms to 10ms per image pair. This adds some dependencies and complexity, not sure what you think of that. Made a smaller edit with improvements if you rather not add more dependencies I can make a pull-request of that: https://github.com/DarkOoze/ScreenToGif/tree/local-counter P.S. My first pull-request, please be gentle 😄. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 09:33:58 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ScreenToGif#1193
No description provided.