[PR #1741] [MERGED] Fix Hardsubx OCR #2465

Open
opened 2026-01-29 17:22:18 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/1741
Author: @hrideshmg
Created: 8/30/2025
Status: Merged
Merged: 9/2/2025
Merged by: @prateekmedia

Base: masterHead: hardsubx_fixes


📝 Commits (3)

  • 057671c fix: hardsubx segmentation fault
  • 2a54f6f fix: hardsubx garbage output
  • 83483c4 chore: enable hardsubx on test builds

📊 Changes

4 files changed (+20 additions, -16 deletions)

View changed files

📝 .github/workflows/build_linux.yml (+2 -2)
📝 docs/CHANGES.TXT (+1 -0)
📝 src/rust/src/hardsubx/decoder.rs (+13 -11)
📝 src/rust/src/hardsubx/imgops.rs (+4 -3)

📄 Description

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.
  • I have mentioned this change in the changelog.

My familiarity with the project is as follows (check one):

  • I have never used CCExtractor.
  • I have used CCExtractor just a couple of times.
  • I absolutely love CCExtractor, but have not contributed previously.
  • I am an active contributor to CCExtractor.

closes #1723

Hardsubx is currently broken on the master branch on Rust.

Fixed a segmentation faults on Linux which was caused by a null pointer dereference in dispatch_classifier_function, I've added proper error handling to fix this. While here, I also noticed that the values in the match statement for the classifier functions are incorrect, see here. The pixDilateGray() function also had an incorrect argument, see here.

While CCextractor seemed to run after this, the output seemed to be garbled. On running some tests, I found out that the luminance mask was fully white. This is because the Srgb::new() function expects values in the range of 0.0-1.0, however we were passing values from 0.0-255.0.

I've also enabled hardsubx for the test builds. This is to facilitate adding regression tests on the sample platform.


🔄 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/CCExtractor/ccextractor/pull/1741 **Author:** [@hrideshmg](https://github.com/hrideshmg) **Created:** 8/30/2025 **Status:** ✅ Merged **Merged:** 9/2/2025 **Merged by:** [@prateekmedia](https://github.com/prateekmedia) **Base:** `master` ← **Head:** `hardsubx_fixes` --- ### 📝 Commits (3) - [`057671c`](https://github.com/CCExtractor/ccextractor/commit/057671cbcf38f3c1ec3918120b1546780efe08d9) fix: hardsubx segmentation fault - [`2a54f6f`](https://github.com/CCExtractor/ccextractor/commit/2a54f6f13bcd429b77282e225e13f7132f6a79b8) fix: hardsubx garbage output - [`83483c4`](https://github.com/CCExtractor/ccextractor/commit/83483c4bde47eb31c44803c5aa1ec62b853436c7) chore: enable hardsubx on test builds ### 📊 Changes **4 files changed** (+20 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/build_linux.yml` (+2 -2) 📝 `docs/CHANGES.TXT` (+1 -0) 📝 `src/rust/src/hardsubx/decoder.rs` (+13 -11) 📝 `src/rust/src/hardsubx/imgops.rs` (+4 -3) </details> ### 📄 Description <!-- Please prefix your pull request with one of the following: **[FEATURE]** **[FIX]** **[IMPROVEMENT]**. --> **In raising this pull request, I confirm the following (please check boxes):** - [ ] I have read and understood the [contributors guide](https://github.com/CCExtractor/ccextractor/blob/master/.github/CONTRIBUTING.md). - [ ] I have checked that another pull request for this purpose does not exist. - [ ] I have considered, and confirmed that this submission will be valuable to others. - [ ] I accept that this submission may not be used, and the pull request closed at the will of the maintainer. - [ ] I give this submission freely, and claim no ownership to its content. - [x] **I have mentioned this change in the [changelog](https://github.com/CCExtractor/ccextractor/blob/master/docs/CHANGES.TXT).** **My familiarity with the project is as follows (check one):** - [ ] I have never used CCExtractor. - [ ] I have used CCExtractor just a couple of times. - [ ] I absolutely love CCExtractor, but have not contributed previously. - [x] I am an active contributor to CCExtractor. --- closes #1723 Hardsubx is currently broken on the master branch on Rust. Fixed a segmentation faults on Linux which was caused by a null pointer dereference in `dispatch_classifier_function`, I've added proper error handling to fix this. While here, I also noticed that the values in the match statement for the classifier functions are incorrect, see [here](https://github.com/hrideshmg/ccextractor/blob/97e74447da106ceebf02afb20804c47c21a7d3af/src/lib_ccx/hardsubx.h#L27). The `pixDilateGray()` function also had an incorrect argument, see [here](https://github.com/hrideshmg/ccextractor/blob/hardsubx_fixes/src/lib_ccx/hardsubx_decoder.c#L56). While CCextractor seemed to run after this, the output seemed to be garbled. On running some tests, I found out that the luminance mask was fully white. This is because the [Srgb::new()](https://docs.rs/palette/latest/palette/type.Srgb.html#fields) function expects values in the range of `0.0-1.0`, however we were passing values from `0.0-255.0`. I've also enabled hardsubx for the test builds. This is to facilitate adding regression tests on the sample platform. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 17:22:18 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2465