{"record":{"id":"d8d6aa5b69286dbf","repo":"DrKLO/Telegram","slug":"the-ext-yuv-target-extension-is-required-for-hdr-e","errorCode":null,"errorMessage":"The EXT_YUV_target extension is required for HDR editing input.","messagePattern":"The EXT_YUV_target extension is required for HDR editing input\\.","errorType":"exception","errorClass":"FrameProcessingException","httpStatus":null,"severity":"error","filePath":"TMessagesProj/src/main/java/com/google/android/exoplayer2/effect/MatrixTextureProcessor.java","lineNumber":204,"sourceCode":"  public static MatrixTextureProcessor createWithExternalSamplerApplyingEotf(\n      Context context,\n      List<GlMatrixTransformation> matrixTransformations,\n      List<RgbMatrix> rgbMatrices,\n      ColorInfo electricalColorInfo)\n      throws FrameProcessingException {\n    boolean useHdr = ColorInfo.isTransferHdr(electricalColorInfo);\n    String vertexShaderFilePath =\n        useHdr ? VERTEX_SHADER_TRANSFORMATION_ES3_PATH : VERTEX_SHADER_TRANSFORMATION_PATH;\n    String fragmentShaderFilePath =\n        useHdr\n            ? FRAGMENT_SHADER_TRANSFORMATION_EXTERNAL_YUV_ES3_PATH\n            : FRAGMENT_SHADER_TRANSFORMATION_SDR_EXTERNAL_PATH;\n    GlProgram glProgram = createGlProgram(context, vertexShaderFilePath, fragmentShaderFilePath);\n\n    if (useHdr) {\n      // In HDR editing mode the decoder output is sampled in YUV.\n      if (!GlUtil.isYuvTargetExtensionSupported()) {\n        throw new FrameProcessingException(\n            \"The EXT_YUV_target extension is required for HDR editing input.\");\n      }\n      glProgram.setFloatsUniform(\n          \"uYuvToRgbColorTransform\",\n          electricalColorInfo.colorRange == C.COLOR_RANGE_FULL\n              ? BT2020_FULL_RANGE_YUV_TO_RGB_COLOR_TRANSFORM_MATRIX\n              : BT2020_LIMITED_RANGE_YUV_TO_RGB_COLOR_TRANSFORM_MATRIX);\n\n      @C.ColorTransfer int colorTransfer = electricalColorInfo.colorTransfer;\n      checkArgument(\n          colorTransfer == C.COLOR_TRANSFER_HLG || colorTransfer == C.COLOR_TRANSFER_ST2084);\n      glProgram.setIntUniform(\"uEotfColorTransfer\", colorTransfer);\n    } else {\n      glProgram.setIntUniform(\"uApplyOetf\", 0);\n    }\n\n    return new MatrixTextureProcessor(\n        glProgram,","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/src/main/java/com/google/android/exoplayer2/effect/MatrixTextureProcessor.java#L186-L222","documentation":"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.","triggerScenarios":"Invoking createWithExternalSamplerApplyingEotf with an HDR ColorInfo (HLG or ST2084 transfer) on a device/GPU lacking EXT_YUV_target, as reported by GlUtil.isYuvTargetExtensionSupported().","commonSituations":"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.","solutions":["Gate HDR editing on GlUtil.isYuvTargetExtensionSupported() and fall back to an SDR/tone-mapped path when unsupported.","Run the effects pipeline only on devices/GPUs known to advertise EXT_YUV_target (most modern Adreno/Mali GPUs).","If HDR is not required, pass an SDR ColorInfo so useHdr is false and the YUV path is skipped."],"exampleFix":"// before\nprocessor = MatrixTextureProcessor.createWithExternalSamplerApplyingEotf(ctx, mats, rgb, hdrColor);\n\n// after\nif (ColorInfo.isTransferHdr(hdrColor) && !GlUtil.isYuvTargetExtensionSupported()) {\n  hdrColor = hdrColor.buildUpon().setColorTransfer(C.COLOR_TRANSFER_SDR).build();\n}\nprocessor = MatrixTextureProcessor.createWithExternalSamplerApplyingEotf(ctx, mats, rgb, hdrColor);","handlingStrategy":"validation","validationCode":"// gate HDR editing on the GPU extension\nboolean hdrOk = ColorInfo.isTransferHdr(ci) && GlUtil.isYuvTargetExtensionSupported();\nColorInfo use = hdrOk ? ci : ci.buildUpon().setColorTransfer(C.COLOR_TRANSFER_SDR).build();\nMatrixTextureProcessor.createWithExternalSamplerApplyingEotf(ctx, mats, rgb, use);","typeGuard":null,"tryCatchPattern":"try { createWithExternalSamplerApplyingEotf(ctx, mats, rgb, hdrCi); }\ncatch (FrameProcessingException e) { /* fall back to SDR pipeline */ }","preventionTips":["Check GlUtil.isYuvTargetExtensionSupported() before HDR effects.","Maintain an SDR fallback for devices lacking EXT_YUV_target.","Test HDR effects on representative device GPUs."],"tags":["video","exoplayer","effect","hdr","gles","gpu-capability","frame-processing"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}