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 9723B47403 for ; Sat, 7 Oct 2023 16:33:23 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B465568CAD8; Sat, 7 Oct 2023 19:33:21 +0300 (EEST) Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B13F568C920 for ; Sat, 7 Oct 2023 19:33:15 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id C26641BF209 for ; Sat, 7 Oct 2023 16:33:14 +0000 (UTC) Date: Sat, 7 Oct 2023 18:33:13 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20231007163313.GP3543730@pb2> References: MIME-Version: 1.0 In-Reply-To: X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH 06/13] avcodec/mpegvideo_enc: Don't overallocate arrays 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="===============4432747085449557455==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============4432747085449557455== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hwMNHYNcH9aNQF1X" Content-Disposition: inline --hwMNHYNcH9aNQF1X Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 06, 2023 at 04:46:29AM +0200, Andreas Rheinhardt wrote: > Only entries 0..max_b_frames are ever used. >=20 > Signed-off-by: Andreas Rheinhardt > --- > libavcodec/mpegvideo_enc.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) >=20 > diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c > index 1e0aed8db9..c06fdd08fe 100644 > --- a/libavcodec/mpegvideo_enc.c > +++ b/libavcodec/mpegvideo_enc.c > @@ -819,8 +819,8 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) > !FF_ALLOCZ_TYPED_ARRAY(s->q_intra_matrix16, 32) || > !FF_ALLOCZ_TYPED_ARRAY(s->q_chroma_intra_matrix16, 32) || > !FF_ALLOCZ_TYPED_ARRAY(s->q_inter_matrix16, 32) || > - !FF_ALLOCZ_TYPED_ARRAY(s->input_picture, MAX_PICTURE_C= OUNT) || > - !FF_ALLOCZ_TYPED_ARRAY(s->reordered_input_picture, MAX_PICTURE_C= OUNT)) > + !FF_ALLOCZ_TYPED_ARRAY(s->input_picture, MAX_B_FRAMES = + 1) || > + !FF_ALLOCZ_TYPED_ARRAY(s->reordered_input_picture, MAX_B_FRAMES = + 1)) > return AVERROR(ENOMEM); > =20 > /* Allocate MV tables; the MV and MB tables will be copied > @@ -1231,7 +1231,7 @@ static int load_input_picture(MpegEncContext *s, co= nst AVFrame *pic_arg) > } > =20 > /* shift buffer entries */ > - for (i =3D flush_offset; i < MAX_PICTURE_COUNT /*s->encoding_delay += 1*/; i++) > + for (int i =3D flush_offset; i <=3D MAX_B_FRAMES; i++) > s->input_picture[i - flush_offset] =3D s->input_picture[i]; > =20 > s->input_picture[encoding_delay] =3D pic; > @@ -1450,9 +1450,9 @@ static int select_input_picture(MpegEncContext *s) > { > int i, ret; > =20 > - for (i =3D 1; i < MAX_PICTURE_COUNT; i++) > + for (int i =3D 1; i <=3D MAX_B_FRAMES; i++) > s->reordered_input_picture[i - 1] =3D s->reordered_input_picture= [i]; I see the addition of "int" and that seems neither needed nor explained why in the commit message thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB "I am not trying to be anyone's saviour, I'm trying to think about the future and not be sad" - Elon Musk --hwMNHYNcH9aNQF1X Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZSGIRgAKCRBhHseHBAsP q9ccAJ9G60XPq1KsMCfTrW1clJeu7im+dQCfQe17zOJCzjoSJN3RM5EgmfyhxxA= =5N1m -----END PGP SIGNATURE----- --hwMNHYNcH9aNQF1X-- --===============4432747085449557455== 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". --===============4432747085449557455==--