[PR #1850] [MERGED] [FIX] -out=spupng with EIA608/teletext: offset values in XML may be not correct #893 #2612

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

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/1850
Author: @gaurav02081
Created: 12/19/2025
Status: Merged
Merged: 1/9/2026
Merged by: @cfsmp3

Base: masterHead: gaurav-v1


📝 Commits (8)

📊 Changes

5 files changed (+53 additions, -10 deletions)

View changed files

📝 docs/CHANGES.TXT (+1 -0)
📝 src/lib_ccx/ccx_encoders_common.c (+1 -0)
📝 src/lib_ccx/ccx_encoders_common.h (+3 -3)
📝 src/lib_ccx/ccx_encoders_spupng.c (+46 -7)
📝 src/lib_ccx/ccx_encoders_structs.h (+2 -0)

📄 Description

[FIX]

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.

[FIX] -out=spupng with EIA608/teletext: offset values in XML may be not correct #893

The issue occurs because the offsets were hardcoded for a 544×390 subtitle image centered on a 720×480 NTSC screen, while the text-to-PNG renderer generates PNGs with different (dynamic) dimensions (e.g. 600px wide and variable height). This results in visibly misaligned subtitles, especially for Teletext (PAL) sources.

This PR removes the hardcoded NTSC assumptions and calculates SPUPNG offsets dynamically based on the actual rendered PNG geometry and the target screen resolution.

Key changes =>

  1. Store the real PNG dimensions (img_w, img_h) in spupng_t

2 .Introduce an is_pal flag in encoder_ctx to distinguish PAL (576 lines) vs NTSC (480 lines)

  1. Capture final canvas dimensions during text-to-PNG rendering

4.Add a helper to compute centered xOffset / yOffset dynamically

  1. Enforce even yOffset to prevent interlacing flicker on DVD/SPU

  2. Apply the new logic only to the text-to-SPUPNG pipeline, leaving the bitmap path unchanged

  3. This aligns the text-based SPUPNG output with the already-correct bitmap SPUPNG behavior.

So ,Subtitles are correctly positioned regardless of PNG width/height (PNG size decides the offset — not hardcoded values.).

in the given image i have drawn the flow of this fix .
IMG_1181


🔄 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/1850 **Author:** [@gaurav02081](https://github.com/gaurav02081) **Created:** 12/19/2025 **Status:** ✅ Merged **Merged:** 1/9/2026 **Merged by:** [@cfsmp3](https://github.com/cfsmp3) **Base:** `master` ← **Head:** `gaurav-v1` --- ### 📝 Commits (8) - [`609a53f`](https://github.com/CCExtractor/ccextractor/commit/609a53f373b0ecf97f919babf6b73d7205310f34) [BUG] -out=spupng with EIA608/teletext: offset values in XML may be not correct #893 - [`2b708c4`](https://github.com/CCExtractor/ccextractor/commit/2b708c4a31100b245158ff21e0c6af5cb99fa97c) Enhance SPUPNG offset calculations and XML tag handling in EIA608 encoder - [`6ed09ea`](https://github.com/CCExtractor/ccextractor/commit/6ed09ea3970a44758f4fca0e25a6dfb75552ccea) SPUPNG: fix formatting to match clang-format - [`bf9841a`](https://github.com/CCExtractor/ccextractor/commit/bf9841a2558e038db0d5c526ec7d5a2dbea4be0b) Merge branch 'master' into gaurav-v1 - [`e42bc2b`](https://github.com/CCExtractor/ccextractor/commit/e42bc2b9f9251608a466eb3ac6c798d4fb6852f0) fixed the merged conflict in the ccx_encoders_common.h - [`1f5d3df`](https://github.com/CCExtractor/ccextractor/commit/1f5d3df0ae70154dd39dbb9e1db62a797ca3e8d7) Merge branch 'master' of https://github.com/gaurav02081/ccextractor into gaurav-v1 - [`91f2540`](https://github.com/CCExtractor/ccextractor/commit/91f254017be1ddef5ba43587ebb8773ce2772a61) Merge branch 'master' into gaurav-v1 - [`c609f66`](https://github.com/CCExtractor/ccextractor/commit/c609f66c027e4dd0ea1f3dcccd4a1156b080c7ff) Removed Build Artifact ### 📊 Changes **5 files changed** (+53 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `docs/CHANGES.TXT` (+1 -0) 📝 `src/lib_ccx/ccx_encoders_common.c` (+1 -0) 📝 `src/lib_ccx/ccx_encoders_common.h` (+3 -3) 📝 `src/lib_ccx/ccx_encoders_spupng.c` (+46 -7) 📝 `src/lib_ccx/ccx_encoders_structs.h` (+2 -0) </details> ### 📄 Description **[FIX]** **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. - [ ] **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. - [x] I absolutely love CCExtractor, but have not contributed previously. - [ ✔] I am an active contributor to CCExtractor. --- [FIX] -out=spupng with EIA608/teletext: offset values in XML may be not correct #893 The issue occurs because the offsets were hardcoded for a 544×390 subtitle image centered on a 720×480 NTSC screen, while the text-to-PNG renderer generates PNGs with different (dynamic) dimensions (e.g. 600px wide and variable height). This results in visibly misaligned subtitles, especially for Teletext (PAL) sources. This PR removes the hardcoded NTSC assumptions and calculates SPUPNG offsets dynamically based on the actual rendered PNG geometry and the target screen resolution. Key changes => 1. Store the real PNG dimensions (img_w, img_h) in spupng_t 2 .Introduce an is_pal flag in encoder_ctx to distinguish PAL (576 lines) vs NTSC (480 lines) 3. Capture final canvas dimensions during text-to-PNG rendering 4.Add a helper to compute centered xOffset / yOffset dynamically 5. Enforce even yOffset to prevent interlacing flicker on DVD/SPU 6. Apply the new logic only to the text-to-SPUPNG pipeline, leaving the bitmap path unchanged 7. This aligns the text-based SPUPNG output with the already-correct bitmap SPUPNG behavior. **So ,Subtitles are correctly positioned regardless of PNG width/height (PNG size decides the offset — not hardcoded values.).** in the given image i have drawn the flow of this fix . ![IMG_1181](https://github.com/user-attachments/assets/39e7c651-d29d-4add-a73e-0dab16189e10) --- <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:23:05 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2612