From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 28B0B45045 for ; Sun, 23 Jun 2024 22:28:41 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 00CDC68CF8A; Mon, 24 Jun 2024 01:28:38 +0300 (EEST) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D42FF68D50D for ; Mon, 24 Jun 2024 01:28:30 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id EFBCEE0003 for ; Sun, 23 Jun 2024 22:28:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1719181710; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0f5PY979xTDZTk17l29OKMMGpRZ3UnHvih2y70EDE3k=; b=RjXKEZewe+/IXhcwm5IhclY0jkFhly6xHjDpjkmhUGO/8NAO5eCtCTnWBo3ivRKNjczZRW JJZdkqxZ7HYCiOkmrk+//7i9G0x2r/puT5vB6QoMKZKR6kGfp45XOPyIpKLuCVGzIu0dds OIbk8EnSSrVaryQyuSsVXTTKRppLLkTNZ1ubd8INJC0Adzw9zl1/QluXhH2bu3MthWAm9+ Of5MUUAwlPMg/j6jJkgcvZWRtuaSHz0nJRU2+oXHYzxzXjqSu4/ayBq98HZ7Epj651Wpny 775sivawxsPMgDlp3tl2ni5zMV0LIMh2wH9swcMWkd/vJfIPhfLiFYv9b6fCFA== Date: Mon, 24 Jun 2024 00:28:28 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20240623222828.GB4991@pb2> References: MIME-Version: 1.0 In-Reply-To: X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH v2 43/71] avcodec/mpegpicture: Split MPVPicture into WorkPicture and ordinary Pic X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: multipart/mixed; boundary="===============3394048305245734547==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============3394048305245734547== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="3IyuMspwcGTbYISR" Content-Disposition: inline --3IyuMspwcGTbYISR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, May 11, 2024 at 10:51:07PM +0200, Andreas Rheinhardt wrote: > There are two types of MPVPictures: Three (cur_pic, last_pic, next_pic) > that are directly part of MpegEncContext and an array of MPVPictures > that are separately allocated and are mostly accessed via pointers > (cur|last|next)_pic_ptr; they are also used to store AVFrames in the > encoder (necessary due to B-frames). As the name implies, each of the > former is directly associated with one of the _ptr pointers: > They actually share the same underlying buffers, but the ones > that are part of the context can have their data pointers offset > and their linesize doubled for field pictures. >=20 > Up until now, each of these had their own references; in particular, > there was an underlying av_frame_ref() to sync cur_pic and cur_pic_ptr > etc. This is wasteful. >=20 > This commit changes this relationship: cur_pic, last_pic and next_pic > now become MPVWorkPictures; this structure does not have an AVFrame > at all any more, but only the cached values of data and linesize. > It also contains a pointer to the corresponding MPVPicture, establishing > a more natural relationsship between the two. > This already means that creating the context-pictures from the pointers > can no longer fail. >=20 > What has not been changed is the fact that the MPVPicture* pointers > are not ownership pointers and that the MPVPictures are part of an > array of MPVPictures that is owned by a single AVCodecContext. > Doing so will be done in a latter commit. >=20 > Signed-off-by: Andreas Rheinhardt > --- > libavcodec/d3d12va_mpeg2.c | 10 +- > libavcodec/d3d12va_vc1.c | 10 +- > libavcodec/dxva2_mpeg2.c | 16 +-- > libavcodec/dxva2_vc1.c | 20 ++-- > libavcodec/h261dec.c | 7 +- > libavcodec/h263dec.c | 33 +++--- > libavcodec/ituh263dec.c | 4 +- > libavcodec/mpeg12dec.c | 56 ++++----- > libavcodec/mpeg12enc.c | 14 +-- > libavcodec/mpeg4videodec.c | 4 +- > libavcodec/mpeg4videoenc.c | 4 +- > libavcodec/mpeg_er.c | 6 +- > libavcodec/mpegpicture.c | 56 ++++++--- > libavcodec/mpegpicture.h | 30 ++++- > libavcodec/mpegvideo.c | 11 -- > libavcodec/mpegvideo.h | 9 +- > libavcodec/mpegvideo_dec.c | 143 +++++++++-------------- > libavcodec/mpegvideo_enc.c | 99 ++++++---------- > libavcodec/mpegvideo_motion.c | 8 +- > libavcodec/mpv_reconstruct_mb_template.c | 4 +- > libavcodec/mss2.c | 2 +- > libavcodec/nvdec_mpeg12.c | 6 +- > libavcodec/nvdec_mpeg4.c | 6 +- > libavcodec/nvdec_vc1.c | 6 +- > libavcodec/ratecontrol.c | 10 +- > libavcodec/rv10.c | 28 ++--- > libavcodec/rv34.c | 38 +++--- > libavcodec/snowenc.c | 17 +-- > libavcodec/svq1enc.c | 5 +- > libavcodec/vaapi_mpeg2.c | 12 +- > libavcodec/vaapi_mpeg4.c | 14 +-- > libavcodec/vaapi_vc1.c | 14 ++- > libavcodec/vc1.c | 2 +- > libavcodec/vc1_block.c | 12 +- > libavcodec/vc1_mc.c | 14 +-- > libavcodec/vc1_pred.c | 2 +- > libavcodec/vc1dec.c | 40 +++---- > libavcodec/vdpau.c | 2 +- > libavcodec/vdpau_mpeg12.c | 8 +- > libavcodec/vdpau_mpeg4.c | 6 +- > libavcodec/vdpau_vc1.c | 12 +- > libavcodec/videotoolbox.c | 2 +- > libavcodec/wmv2dec.c | 2 +- > 43 files changed, 386 insertions(+), 418 deletions(-) [...] after this the linesize for teh last field picture goes exponential s->last_pic.linesize[i] *=3D 2; libavcodec/mpeg12dec.c:1304:41: runtime error: signed integer overflow: 461= 1686018427387904 * 2 cannot be represented in type 'long' issue: 69732/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEGVIDEO_fu= zzer-5123551179374592 something like this: L0 40 0x62e0001f8400 0x613000000780 L1 40 0x62a0001fe200 0x613000000780 L2 40 0x62a000204200 0x613000000780 L0 80 0x62e0001f8400 0x613000000780 L1 80 0x62a0001fe200 0x613000000780 L2 80 0x62a000204200 0x613000000780 L0 100 0x62e0001f8400 0x613000000780 L1 100 0x62a0001fe200 0x613000000780 L2 100 0x62a000204200 0x613000000780 L0 200 0x62e0001f8400 0x613000000780 L1 200 0x62a0001fe200 0x613000000780 L2 200 0x62a000204200 0x613000000780 L0 400 0x62e0001f8400 0x613000000780 L1 400 0x62a0001fe200 0x613000000780 L2 400 0x62a000204200 0x613000000780 L0 800 0x62e0001f8400 0x613000000780 L1 800 0x62a0001fe200 0x613000000780 L2 800 0x62a000204200 0x613000000780 L0 1000 0x62e0001f8400 0x613000000780 L1 1000 0x62a0001fe200 0x613000000780 L2 1000 0x62a000204200 0x613000000780 L0 2000 0x62e0001f8400 0x613000000780 L1 2000 0x62a0001fe200 0x613000000780 L2 2000 0x62a000204200 0x613000000780 L0 4000 0x62e0001f8400 0x613000000780 L1 4000 0x62a0001fe200 0x613000000780 L2 4000 0x62a000204200 0x613000000780 L0 8000 0x62e0001f8400 0x613000000780 L1 8000 0x62a0001fe200 0x613000000780 L2 8000 0x62a000204200 0x613000000780 L0 10000 0x62e0001f8400 0x613000000780 L1 10000 0x62a0001fe200 0x613000000780 L2 10000 0x62a000204200 0x613000000780 L0 20000 0x62e0001f8400 0x613000000780 L1 20000 0x62a0001fe200 0x613000000780 L2 20000 0x62a000204200 0x613000000780 L0 40000 0x62e0001f8400 0x613000000780 L1 40000 0x62a0001fe200 0x613000000780 L2 40000 0x62a000204200 0x613000000780 L0 80000 0x62e0001f8400 0x613000000780 L1 80000 0x62a0001fe200 0x613000000780 L2 80000 0x62a000204200 0x613000000780 L0 100000 0x62e0001f8400 0x613000000780 L1 100000 0x62a0001fe200 0x613000000780 L2 100000 0x62a000204200 0x613000000780 L0 200000 0x62e0001f8400 0x613000000780 L1 200000 0x62a0001fe200 0x613000000780 L2 200000 0x62a000204200 0x613000000780 L0 400000 0x62e0001f8400 0x613000000780 L1 400000 0x62a0001fe200 0x613000000780 L2 400000 0x62a000204200 0x613000000780 L0 800000 0x62e0001f8400 0x613000000780 L1 800000 0x62a0001fe200 0x613000000780 L2 800000 0x62a000204200 0x613000000780 L0 1000000 0x62e0001f8400 0x613000000780 L1 1000000 0x62a0001fe200 0x613000000780 L2 1000000 0x62a000204200 0x613000000780 L0 2000000 0x62e0001f8400 0x613000000780 L1 2000000 0x62a0001fe200 0x613000000780 L2 2000000 0x62a000204200 0x613000000780 L0 4000000 0x62e0001f8400 0x613000000780 L1 4000000 0x62a0001fe200 0x613000000780 L2 4000000 0x62a000204200 0x613000000780 L0 8000000 0x62e0001f8400 0x613000000780 L1 8000000 0x62a0001fe200 0x613000000780 L2 8000000 0x62a000204200 0x613000000780 L0 10000000 0x62e0001f8400 0x613000000780 L1 10000000 0x62a0001fe200 0x613000000780 L2 10000000 0x62a000204200 0x613000000780 L0 20000000 0x62e0001f8400 0x613000000780 L1 20000000 0x62a0001fe200 0x613000000780 L2 20000000 0x62a000204200 0x613000000780 L0 40000000 0x62e0001f8400 0x613000000780 L1 40000000 0x62a0001fe200 0x613000000780 L2 40000000 0x62a000204200 0x613000000780 L0 80000000 0x62e0001f8400 0x613000000780 L1 80000000 0x62a0001fe200 0x613000000780 L2 80000000 0x62a000204200 0x613000000780 L0 100000000 0x62e0001f8400 0x613000000780 L1 100000000 0x62a0001fe200 0x613000000780 L2 100000000 0x62a000204200 0x613000000780 L0 200000000 0x62e0001f8400 0x613000000780 L1 200000000 0x62a0001fe200 0x613000000780 L2 200000000 0x62a000204200 0x613000000780 L0 400000000 0x62e0001f8400 0x613000000780 L1 400000000 0x62a0001fe200 0x613000000780 L2 400000000 0x62a000204200 0x613000000780 L0 800000000 0x62e0001f8400 0x613000000780 L1 800000000 0x62a0001fe200 0x613000000780 L2 800000000 0x62a000204200 0x613000000780 L0 1000000000 0x62e0001f8400 0x613000000780 L1 1000000000 0x62a0001fe200 0x613000000780 L2 1000000000 0x62a000204200 0x613000000780 L0 2000000000 0x62e0001f8400 0x613000000780 L1 2000000000 0x62a0001fe200 0x613000000780 L2 2000000000 0x62a000204200 0x613000000780 L0 4000000000 0x62e0001f8400 0x613000000780 L1 4000000000 0x62a0001fe200 0x613000000780 L2 4000000000 0x62a000204200 0x613000000780 L0 8000000000 0x62e0001f8400 0x613000000780 L1 8000000000 0x62a0001fe200 0x613000000780 L2 8000000000 0x62a000204200 0x613000000780 L0 10000000000 0x62e0001f8400 0x613000000780 L1 10000000000 0x62a0001fe200 0x613000000780 L2 10000000000 0x62a000204200 0x613000000780 L0 20000000000 0x62e0001f8400 0x613000000780 L1 20000000000 0x62a0001fe200 0x613000000780 L2 20000000000 0x62a000204200 0x613000000780 L0 40000000000 0x62e0001f8400 0x613000000780 L1 40000000000 0x62a0001fe200 0x613000000780 L2 40000000000 0x62a000204200 0x613000000780 L0 80000000000 0x62e0001f8400 0x613000000780 L1 80000000000 0x62a0001fe200 0x613000000780 L2 80000000000 0x62a000204200 0x613000000780 L0 100000000000 0x62e0001f8400 0x613000000780 L1 100000000000 0x62a0001fe200 0x613000000780 L2 100000000000 0x62a000204200 0x613000000780 L0 200000000000 0x62e0001f8400 0x613000000780 L1 200000000000 0x62a0001fe200 0x613000000780 L2 200000000000 0x62a000204200 0x613000000780 L0 400000000000 0x62e0001f8400 0x613000000780 L1 400000000000 0x62a0001fe200 0x613000000780 L2 400000000000 0x62a000204200 0x613000000780 L0 800000000000 0x62e0001f8400 0x613000000780 L1 800000000000 0x62a0001fe200 0x613000000780 L2 800000000000 0x62a000204200 0x613000000780 L0 1000000000000 0x62e0001f8400 0x613000000780 L1 1000000000000 0x62a0001fe200 0x613000000780 L2 1000000000000 0x62a000204200 0x613000000780 L0 2000000000000 0x62e0001f8400 0x613000000780 L1 2000000000000 0x62a0001fe200 0x613000000780 L2 2000000000000 0x62a000204200 0x613000000780 L0 4000000000000 0x62e0001f8400 0x613000000780 L1 4000000000000 0x62a0001fe200 0x613000000780 L2 4000000000000 0x62a000204200 0x613000000780 L0 8000000000000 0x62e0001f8400 0x613000000780 L1 8000000000000 0x62a0001fe200 0x613000000780 L2 8000000000000 0x62a000204200 0x613000000780 L0 10000000000000 0x62e0001f8400 0x613000000780 L1 10000000000000 0x62a0001fe200 0x613000000780 L2 10000000000000 0x62a000204200 0x613000000780 L0 20000000000000 0x62e0001f8400 0x613000000780 L1 20000000000000 0x62a0001fe200 0x613000000780 L2 20000000000000 0x62a000204200 0x613000000780 L0 40000000000000 0x62e0001f8400 0x613000000780 L1 40000000000000 0x62a0001fe200 0x613000000780 L2 40000000000000 0x62a000204200 0x613000000780 L0 80000000000000 0x62e0001f8400 0x613000000780 L1 80000000000000 0x62a0001fe200 0x613000000780 L2 80000000000000 0x62a000204200 0x613000000780 L0 100000000000000 0x62e0001f8400 0x613000000780 L1 100000000000000 0x62a0001fe200 0x613000000780 L2 100000000000000 0x62a000204200 0x613000000780 L0 200000000000000 0x62e0001f8400 0x613000000780 L1 200000000000000 0x62a0001fe200 0x613000000780 L2 200000000000000 0x62a000204200 0x613000000780 L0 400000000000000 0x62e0001f8400 0x613000000780 L1 400000000000000 0x62a0001fe200 0x613000000780 L2 400000000000000 0x62a000204200 0x613000000780 L0 800000000000000 0x62e0001f8400 0x613000000780 L1 800000000000000 0x62a0001fe200 0x613000000780 L2 800000000000000 0x62a000204200 0x613000000780 L0 1000000000000000 0x62e0001f8400 0x613000000780 L1 1000000000000000 0x62a0001fe200 0x613000000780 L2 1000000000000000 0x62a000204200 0x613000000780 L0 2000000000000000 0x62e0001f8400 0x613000000780 L1 2000000000000000 0x62a0001fe200 0x613000000780 L2 2000000000000000 0x62a000204200 0x613000000780 L0 4000000000000000 0x62e0001f8400 0x613000000780 [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The greatest way to live with honor in this world is to be what we pretend to be. -- Socrates --3IyuMspwcGTbYISR Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZnihhgAKCRBhHseHBAsP q3IfAJ0e9e0dOEGn/7YVzj/jz2tT7PO/PwCcD7vWLqWj65KD43cZ2mQY05/t3RY= =6g/e -----END PGP SIGNATURE----- --3IyuMspwcGTbYISR-- --===============3394048305245734547== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". --===============3394048305245734547==--