From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 4449046843 for ; Fri, 14 Nov 2025 18:12:53 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'M1OL7HmMRzmf8WM4f6qymMam6MdjoMueLU0yylolsTc=', expected b'9V/ltCfjr6IgVbWlylYWG2geGq9AXWVZE778J5Pe+40=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1763143941; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=M1OL7HmMRzmf8WM4f6qymMam6MdjoMueLU0yylolsTc=; b=ClOXaywvSozmJTV1t374m9lhmUjugTY/GqzZTRZbqsZdG/0x1Tgj7hx6xD1HhVD3JZC0E ixbKM7igrTmED7lEQHhmYcTN8ZA9z7f5q5sIYiuzv0LaoLAJFB8UssmDVgJQsFIw5+zFso+ n/mhXNIqsLtYHgVwR2rMPZzToR9swjKwbzQktqBa6FqIocrfQH6aYw4yqR1j6QRVHgf9G/I o50jqigzlKeynpAxxWKdgvJXS55Ruk327iekgD52knJW77kynchc9GWFvJTRqfoBJunAMdZ jjRJjXGYX8nB8S/B8LCqjyXKfnL1vhQVf0RlharrMY7L6ludX/SeSK0M8CAg== Received: from [172.19.0.2] (unknown [172.19.0.2]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 203A768FE0F; Fri, 14 Nov 2025 20:12:21 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1763143929; b=RBG6mbPXUlgfmVOv6vh4umXncZ2vKCvYAiRhHS4/WSA0gdbssG/VVtmV6h00BdT1VXvMR hGPgYtfPRaWNgGVX8RtKbriklMeOUqloaZWQxWr2QaIsaYKP8II80PoHZC9b01Vpr5pU5is WkTtwMsWpfDwvHA1Uz0s3yPSoBIjX8ChKPH25Zu996qF394D5VRJV4GhUN+HYVVRLklxT1o mfKgYqmIBpHy9X9WpcPnpLoaX0V0qxk0WPIPPA6IycpEwije8LOMC5BhB3DDPFbJ5Icqbk6 Acx8GjpiliBMJE8rbhlnneqYVWgk1M1NWXjxnAxFesYXpfWV/h7fEEphYrSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1763143929; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=Vs6d9be9tC+r9yZUQCfjYQB4dE+LF8iUxgpIUoyojG8=; b=F6wpW+dBQsITWDuLfY/mNV08mRCA+mUdcZKrtCZzlepVCSk4v8nW9pv4VFoLfPC/SvS3O JEvGCQI5RynlRUJSzdbzqK4RHXG814Y6NKmHq48LVytUz/vvd8Cp8W6IZ6TdmJjmP9/dTf9 LojIvkouPByG2rw1PgwMa+wgYsoi87SBodjlDKsr1mhWcmUeegERcBIgnKcSpOo2yLc7Dso iCgG9h9Wj0sdhiM56rSqnrFT9xIMHelVhLUx+XdyyEyWCDQer95enVwWqmwj/9BcN+j8ffx ZV8KTv2VD1F5zOa+ZfF7slx9CpkYy8H1sTli9wNDaA7BRclv9MoaHnIS8oFQ== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=pass header.from=ffmpeg.org policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=ffmpeg.org policy.dmarc=quarantine DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1763143908; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=9V/ltCfjr6IgVbWlylYWG2geGq9AXWVZE778J5Pe+40=; b=07QoKB6GXbM8h/Dx6GBgcWizkwqUQHS+kR+2jRa42swF1l1L+5Fd4jmYFAx0CCU9T8UMX +GE6A1dMDfSNj6wkdAURq2Y+Z2VxiRkGJ6JzmozRmm7kS0j7pL2sMdq+dxLvGcRCTSV6eUl UztLuvTCqOXAg4yv5nHqqNH4p4NQ8mdr1vVhiufjn87MycLfHrOwmGaZBbMalMnds9EEGOF 99Re6JYvBf/n0y1YHzSayt5OvcmzJkKJJRNGKs0I4TBB7F2bwSxACj5u5XgLExtZfbMnpyB OOGzVXFZQvX3g5Bsmp+E6wYG34k1xXIi6Nh1DGnnGRAWx+gFasMHEjzZZo5w== Received: from 188d6d40ca7a (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 074D368FDE8 for ; Fri, 14 Nov 2025 20:11:47 +0200 (EET) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Fri, 14 Nov 2025 18:11:45 -0000 Message-ID: <176314390814.25.14925203309061166342@2cb04c0e5124> Message-ID-Hash: N2XUAAWXBCP4EACDXJCM7UHZPLPS2FP6 X-Message-ID-Hash: N2XUAAWXBCP4EACDXJCM7UHZPLPS2FP6 X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] avcodec/h264_slice: don't force ff_get_format unconditionally after flush (PR #20921) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Zhao Zhili via ffmpeg-devel Cc: Zhao Zhili Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #20921 opened by Zhao Zhili (quink) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20921 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20921.patch h->context_initialized is zero after flush, which triggers call to ff_get_format unconditionally. ff_get_format can be heavy with ff_hwaccel_uninit and hwaccel_init. For example, it takes 20 ms on macOS with videotoolbox. ff_get_format should not be called if nothing changed. ff_get_format is guarantee to be called at the first time and when video information changed with (must_reinit || needs_reinit). Fix #20760. >>From 239f14c80fa93587dbb2681ae0a5dfb670a24e93 Mon Sep 17 00:00:00 2001 From: Zhao Zhili Date: Fri, 14 Nov 2025 23:46:04 +0800 Subject: [PATCH] avcodec/h264_slice: don't force ff_get_format unconditionally after flush h->context_initialized is zero after flush, which triggers call to ff_get_format unconditionally. ff_get_format can be heavy with ff_hwaccel_uninit and hwaccel_init. For example, it takes 20 ms on macOS with videotoolbox. ff_get_format should not be called if nothing changed. ff_get_format is guarantee to be called at the first time and when video information changed with (must_reinit || needs_reinit). Fix #20760. --- libavcodec/h264_slice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 7e53e38cca..4bce9b9228 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1150,7 +1150,7 @@ static int h264_init_ps(H264Context *h, const H264SliceContext *sl, int first_sl if (flush_changes) ff_h264_flush_change(h); - if ((ret = get_pixel_format(h, 1)) < 0) + if ((ret = get_pixel_format(h, must_reinit || needs_reinit)) < 0) return ret; h->avctx->pix_fmt = ret; -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org