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 7C32D475A0 for ; Tue, 12 Sep 2023 19:05:21 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8A17A68C9BB; Tue, 12 Sep 2023 22:05:19 +0300 (EEST) Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CAB7668C72E for ; Tue, 12 Sep 2023 22:05:12 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 9808FFF803 for ; Tue, 12 Sep 2023 19:05:11 +0000 (UTC) Date: Tue, 12 Sep 2023 21:05:10 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20230912190510.GK8640@pb2> References: <20230912114015.59937-1-thomas@gllm.fr> MIME-Version: 1.0 In-Reply-To: <20230912114015.59937-1-thomas@gllm.fr> X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH 1/3] error_resilience: set the decode_error_flags outside 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="===============6777422663963952231==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============6777422663963952231== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="J/pvEKOcHgREgBce" Content-Disposition: inline --J/pvEKOcHgREgBce Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 12, 2023 at 01:40:13PM +0200, Thomas Guillem via ffmpeg-devel w= rote: > This will allow to fix data-races when ff_er_frame_end() is called after > ff_thread_finish_setup() > --- > libavcodec/error_resilience.c | 12 ++++++------ > libavcodec/error_resilience.h | 2 +- > libavcodec/h263dec.c | 6 ++++-- > libavcodec/h264dec.c | 3 ++- > libavcodec/mpeg12dec.c | 3 ++- > libavcodec/mss2.c | 8 +++++--- > libavcodec/rv10.c | 10 ++++++++-- > libavcodec/rv34.c | 12 +++++++++--- > libavcodec/vc1dec.c | 6 ++++-- > 9 files changed, 41 insertions(+), 21 deletions(-) >=20 [...] > diff --git a/libavcodec/error_resilience.h b/libavcodec/error_resilience.h > index 47cc8a4fc6..a8cf73c72e 100644 > --- a/libavcodec/error_resilience.h > +++ b/libavcodec/error_resilience.h > @@ -90,7 +90,7 @@ typedef struct ERContext { > } ERContext; > =20 > void ff_er_frame_start(ERContext *s); > -void ff_er_frame_end(ERContext *s); > +int ff_er_frame_end(ERContext *s); The return code needs to be documented > void ff_er_add_slice(ERContext *s, int startx, int starty, int endx, int= endy, > int status); > =20 > diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c > index 52e51dd489..3e83d90586 100644 > --- a/libavcodec/h263dec.c > +++ b/libavcodec/h263dec.c > @@ -621,8 +621,10 @@ retry: > =20 > av_assert1(s->bitstream_buffer_size =3D=3D 0); > frame_end: > - if (!s->studio_profile) > - ff_er_frame_end(&s->er); > + if (!s->studio_profile) { > + if (ff_er_frame_end(&s->er) > 0) > + s->current_picture.f->decode_error_flags |=3D FF_DECODE_ERRO= R_CONCEALMENT_ACTIVE; > + } [...] > +static void rv10_er_frame_end(MpegEncContext *s) > +{ > + if (ff_er_frame_end(&s->er) > 0) > + s->current_picture_ptr->f->decode_error_flags |=3D FF_DECODE_ERR= OR_CONCEALMENT_ACTIVE; > +} [...] > +static void rv34_er_frame_end(MpegEncContext *s) > +{ > + if (ff_er_frame_end(&s->er) > 0) > + s->current_picture_ptr->f->decode_error_flags |=3D FF_DECODE_ERR= OR_CONCEALMENT_ACTIVE; > +} [...] > + if (ff_er_frame_end(&s->er) > 0) > + s->current_picture.f->decode_error_flags |=3D FF_DECODE_= ERROR_CONCEALMENT_ACTIVE; > + } > } This looks like duplicated code [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The worst form of inequality is to try to make unequal things equal. -- Aristotle --J/pvEKOcHgREgBce Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZQC2YwAKCRBhHseHBAsP q3UQAJ9pUT6PMcnzHeb8O3ctlLyJ3dm8sQCfb5+0oApQpaAb0SIPMOnj50f4/Vw= =rtWW -----END PGP SIGNATURE----- --J/pvEKOcHgREgBce-- --===============6777422663963952231== 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". --===============6777422663963952231==--