This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit d41cae61f279ebf20e464b262bc862494b81bae6 Author: Julius Bairaktaris <[email protected]> AuthorDate: Wed Oct 28 14:48:14 2026 +0100 Commit: ArazIusubov <[email protected]> CommitDate: Mon Nov 16 10:05:04 2026 +0000 avcodec/amfdec: re-init the frames context when the surface format differs With AMF-surface output, amf_decode_init() creates the frames context from AMF_VIDEO_DECODER_OUTPUT_FORMAT, falling back to NV12 when the decoder has not detected a format yet. The context is only re-created on AMF_RESOLUTION_CHANGED, so it keeps NV12 when the decoder then outputs P010 at the same size. The AV1 decoder does not report its format before decoding, so every 10-bit AV1 stream is output as P010 surfaces in an NV12 frames context, and hwdownload to p010le fails with EINVAL. Re-create the frames context, keeping its size, when an output surface's format differs from its sw_format. Tested on Windows 11, RX 9070 XT, driver 32.0.32015.7029: 10-bit AV1 (raw OBU and Matroska) with -hwaccel amf -hwaccel_output_format amf and hwdownload to p010le now decodes, with the same framemd5 as software output from av1_amf; 8-bit AV1, h264_amf, hevc_amf (8 and 10 bit) and vp9_amf are unchanged. Signed-off-by: Julius Bairaktaris <[email protected]> --- libavcodec/amfdec.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libavcodec/amfdec.c b/libavcodec/amfdec.c index 00a17360f5..017327f6bc 100644 --- a/libavcodec/amfdec.c +++ b/libavcodec/amfdec.c @@ -512,6 +512,19 @@ static int amf_amfsurface_to_avframe(AVCodecContext *avctx, AMFSurface* surface, int format_amf; if (avctx->hw_device_ctx && ((AVHWDeviceContext*)avctx->hw_device_ctx->data)->type == AV_HWDEVICE_TYPE_AMF) { + AVHWFramesContext *frames_ctx; + enum AVPixelFormat sw_format; + + if (!avctx->hw_frames_ctx) + return AVERROR(EINVAL); + frames_ctx = (AVHWFramesContext *)avctx->hw_frames_ctx->data; + sw_format = av_amf_to_av_format(surface->pVtbl->GetFormat(surface)); + if (sw_format != frames_ctx->sw_format) { + ret = amf_reinit_frames_context(avctx, sw_format, frames_ctx->width, frames_ctx->height); + if (ret < 0) + return ret; + } + // prepare frame similar to ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF); ret = ff_decode_frame_props(avctx, frame); -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
