DrKLO/Telegram · error · FrameProcessingException

The EXT_YUV_target extension is required for HDR editing inp

Error message

The EXT_YUV_target extension is required for HDR editing input.

What it means

MatrixTextureProcessor.createWithExternalSamplerApplyingEotf throws FrameProcessingException('The EXT_YUV_target extension is required for HDR editing input.') when HDR editing is requested (ColorInfo.isTransferHdr) but the GPU does not expose the EXT_YUV_target OpenGL ES extension. HDR editing samples decoder output in YUV, which requires this extension to read the YUV external texture directly in the shader.

Source

Thrown at TMessagesProj/src/main/java/com/google/android/exoplayer2/effect/MatrixTextureProcessor.java:204

  public static MatrixTextureProcessor createWithExternalSamplerApplyingEotf(
      Context context,
      List<GlMatrixTransformation> matrixTransformations,
      List<RgbMatrix> rgbMatrices,
      ColorInfo electricalColorInfo)
      throws FrameProcessingException {
    boolean useHdr = ColorInfo.isTransferHdr(electricalColorInfo);
    String vertexShaderFilePath =
        useHdr ? VERTEX_SHADER_TRANSFORMATION_ES3_PATH : VERTEX_SHADER_TRANSFORMATION_PATH;
    String fragmentShaderFilePath =
        useHdr
            ? FRAGMENT_SHADER_TRANSFORMATION_EXTERNAL_YUV_ES3_PATH
            : FRAGMENT_SHADER_TRANSFORMATION_SDR_EXTERNAL_PATH;
    GlProgram glProgram = createGlProgram(context, vertexShaderFilePath, fragmentShaderFilePath);

    if (useHdr) {
      // In HDR editing mode the decoder output is sampled in YUV.
      if (!GlUtil.isYuvTargetExtensionSupported()) {
        throw new FrameProcessingException(
            "The EXT_YUV_target extension is required for HDR editing input.");
      }
      glProgram.setFloatsUniform(
          "uYuvToRgbColorTransform",
          electricalColorInfo.colorRange == C.COLOR_RANGE_FULL
              ? BT2020_FULL_RANGE_YUV_TO_RGB_COLOR_TRANSFORM_MATRIX
              : BT2020_LIMITED_RANGE_YUV_TO_RGB_COLOR_TRANSFORM_MATRIX);

      @C.ColorTransfer int colorTransfer = electricalColorInfo.colorTransfer;
      checkArgument(
          colorTransfer == C.COLOR_TRANSFER_HLG || colorTransfer == C.COLOR_TRANSFER_ST2084);
      glProgram.setIntUniform("uEotfColorTransfer", colorTransfer);
    } else {
      glProgram.setIntUniform("uApplyOetf", 0);
    }

    return new MatrixTextureProcessor(
        glProgram,

View on GitHub (pinned to 45ab8f4308)

Solutions

  1. Gate HDR editing on GlUtil.isYuvTargetExtensionSupported() and fall back to an SDR/tone-mapped path when unsupported.
  2. Run the effects pipeline only on devices/GPUs known to advertise EXT_YUV_target (most modern Adreno/Mali GPUs).
  3. If HDR is not required, pass an SDR ColorInfo so useHdr is false and the YUV path is skipped.

Example fix

// before
processor = MatrixTextureProcessor.createWithExternalSamplerApplyingEotf(ctx, mats, rgb, hdrColor);

// after
if (ColorInfo.isTransferHdr(hdrColor) && !GlUtil.isYuvTargetExtensionSupported()) {
  hdrColor = hdrColor.buildUpon().setColorTransfer(C.COLOR_TRANSFER_SDR).build();
}
processor = MatrixTextureProcessor.createWithExternalSamplerApplyingEotf(ctx, mats, rgb, hdrColor);
Defensive patterns

Strategy: validation

Validate before calling

// gate HDR editing on the GPU extension
boolean hdrOk = ColorInfo.isTransferHdr(ci) && GlUtil.isYuvTargetExtensionSupported();
ColorInfo use = hdrOk ? ci : ci.buildUpon().setColorTransfer(C.COLOR_TRANSFER_SDR).build();
MatrixTextureProcessor.createWithExternalSamplerApplyingEotf(ctx, mats, rgb, use);

Try / catch

try { createWithExternalSamplerApplyingEotf(ctx, mats, rgb, hdrCi); }
catch (FrameProcessingException e) { /* fall back to SDR pipeline */ }

Prevention

When it happens

Trigger: Invoking createWithExternalSamplerApplyingEotf with an HDR ColorInfo (HLG or ST2084 transfer) on a device/GPU lacking EXT_YUV_target, as reported by GlUtil.isYuvTargetExtensionSupported().

Common situations: Running HDR video editing/effects on older or lower-tier GPUs/emulators that do not advertise EXT_YUV_target; attempting HDR transformation pipelines on devices below the API/GPU requirement.

Related errors


AI-assisted analysis of DrKLO/Telegram@45ab8f4308 (2026-08-14). Data as JSON: /api/errors/d8d6aa5b69286dbf. Report an issue: GitHub.