mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-02-03 21:23:48 +00:00
[PR #1746] [MERGED] fix: ocr luminance calculation fix #2471
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/CCExtractor/ccextractor/pull/1746
Author: @hrideshmg
Created: 9/8/2025
Status: ✅ Merged
Merged: 9/13/2025
Merged by: @prateekmedia
Base:
master← Head:ocr_fixes📝 Commits (1)
208c70dfix: ocr luminance calculation fix📊 Changes
1 file changed (+3 additions, -3 deletions)
View changed files
📝
src/rust/src/hardsubx/imgops.rs(+3 -3)📄 Description
In raising this pull request, I confirm the following (please check boxes):
My familiarity with the project is as follows (check one):
Hardsubx in rust currently does not give identical output as the C implementation, often providing inferior results. After debugging for a bit I noticed that there were very slight differences in the luminance masks between both versions.
In the old C code, the RGB to LAB conversion was done manually, in rust we now use the
palettecrate for this purpose.The
Srgbimplementation frompalettewe were using till now assumes that the input image is gamma corrected, and thus performs gamma decoding to make the RGB values linear.This is unnecessary though, because our input is already linear RGB and was thus causing a faulty conversion. I've modified the code to use
LinSrgbinstead. The Rust implementation now provides identical output to the C code.Tested on this sample.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.