Skip to content

PGS subtitles cause high CPU usage #628

Description

@ijuniorfu

What happened?

Description

When playing a 70 GB Blu-ray MKV file, enabling PGS subtitles causes significantly higher CPU usage.

CPU Usage

PGS Subtitles CPU Usage
Disabled Peak: ~65%, Average: ~35%
Enabled 100%+

Environment

  • Source: Blu-ray MKV
  • File size: ~70 GB
  • Subtitle format: PGS
  • Measurement: Xcode Instruments – Time Profiler

Profiling

With PGS subtitles enabled, imageForSubtitleRect in EmbeddedSubtitleDecoder.swift is the top CPU-consuming function on the Main Thread.

Call stack:

imageForSubtitleRect
└── decodeStoredSubtitlePacket
    └── subtitleDrainTick
        └── startSubtitleDrainer

The CPU usage drops significantly when PGS subtitles are disabled.

Expected Behavior

PGS subtitle rendering should not cause excessive CPU usage during playback, especially when the subtitle content is not changing frequently.

Additional Information

The issue appears to be related to PGS subtitle bitmap processing in imageForSubtitleRect.

Steps to reproduce

none

AetherEngine version or commit SHA

4ef5ef9

Host app

Custom / my own integration

Platform

iOS

OS version

iOS26

Device / chip

iPhone16

Playback path

Native AVPlayer

Source media (for playback bugs)

No response

Error codes / log lines


Anything else

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions