Skip to content

Add maxRenderPixels for subtitle render downscaling#83

Merged
peerless2012 merged 1 commit into
masterfrom
feature/render-downscaling
Jun 10, 2026
Merged

Add maxRenderPixels for subtitle render downscaling#83
peerless2012 merged 1 commit into
masterfrom
feature/render-downscaling

Conversation

@peerless2012

Copy link
Copy Markdown
Owner

Add AssHandlerConfig.maxRenderPixels to limit subtitle render resolution. When frame size exceeds this pixel count, rendering is proportionally downscaled and then scaled back up during display. This reduces CPU and memory usage on high-resolution devices (e.g., 4K TVs).

Changes:

  • AssHandlerConfig: add maxRenderPixels parameter (default 0 = no limit)
  • AssHandler: add computeRenderSize() utility, apply to all setFrameSize calls, log downscaling when triggered from onSurfaceSizeChanged
  • AssSubtitleTextureView: scale glViewport coordinates from renderSize to surfaceSize
  • AssSubtitleCanvasView: scale drawBitmap with RectF when downscaled
  • AssTexOverlay: create smaller FBO, override getVertexTransformation to scale up in OverlayEffect pipeline
  • AssCanvasOverlay: scale canvas draw coordinates
  • AssPlayer.kt: expose config parameter in buildWithAssSupport()
  • README: document configuration and downscaling behavior

Refs #27

Add AssHandlerConfig.maxRenderPixels to limit subtitle render resolution.
When frame size exceeds this pixel count, rendering is proportionally
downscaled and then scaled back up during display. This reduces CPU and
memory usage on high-resolution devices (e.g., 4K TVs).

Changes:
- AssHandlerConfig: add maxRenderPixels parameter (default 0 = no limit)
- AssHandler: add computeRenderSize() utility, apply to all setFrameSize
  calls, log downscaling when triggered from onSurfaceSizeChanged
- AssSubtitleTextureView: scale glViewport coordinates from renderSize
  to surfaceSize
- AssSubtitleCanvasView: scale drawBitmap with RectF when downscaled
- AssTexOverlay: create smaller FBO, override getVertexTransformation to
  scale up in OverlayEffect pipeline
- AssCanvasOverlay: scale canvas draw coordinates
- AssPlayer.kt: expose config parameter in buildWithAssSupport()
- README: document configuration and downscaling behavior

Refs #27
@peerless2012 peerless2012 merged commit 20078bc into master Jun 10, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant