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 AC5B443780 for ; Thu, 28 Jul 2022 14:49:48 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AB2FE68B991; Thu, 28 Jul 2022 17:49:45 +0300 (EEST) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9D72C68B8C3 for ; Thu, 28 Jul 2022 17:49:38 +0300 (EEST) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id A963D1C0006 for ; Thu, 28 Jul 2022 14:49:37 +0000 (UTC) Date: Thu, 28 Jul 2022 16:49:35 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20220728144935.GY2088045@pb2> References: <20220727221807.2350130-1-CE.Mohammad.AlSaleh@gmail.com> MIME-Version: 1.0 In-Reply-To: <20220727221807.2350130-1-CE.Mohammad.AlSaleh@gmail.com> Subject: Re: [FFmpeg-devel] [PATCH] avcodec/mjpegdec: Continue if a block fails to decode correctly 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="===============0570699383462921521==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============0570699383462921521== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="e8znkWhb8vS+si4n" Content-Disposition: inline --e8znkWhb8vS+si4n Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 28, 2022 at 01:18:07AM +0300, Mohammad AlSaleh wrote: > Don't give up on the whole frame just because a block failed to > decode correctly. >=20 > Try to continue decoding if the AV_EF_EXPLODE flag is not set. >=20 > Signed-off-by: Mohammad AlSaleh > --- > libavcodec/mjpegdec.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c > index 816eb1ce5d..edefc35cb3 100644 > --- a/libavcodec/mjpegdec.c > +++ b/libavcodec/mjpegdec.c > @@ -1504,7 +1504,8 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s,= int nb_components, int Ah, > s->quant_matrixes[s->quant_= sindex[i]]) < 0) { > av_log(s->avctx, AV_LOG_ERROR, > "error y=3D%d x=3D%d\n", mb_y, mb= _x); > - return AVERROR_INVALIDDATA; > + if (s->avctx->err_recognition & AV_EF_EX= PLODE) > + return AVERROR_INVALIDDATA; > } > if (ptr) { > s->idsp.idct_put(ptr, linesize[c], s->bl= ock); decoding should stop at an error and resume at a reset marker or some other= =20 marker where resync is possible otherwise chances are there will be alot of= random trash. If there are no reset markers, it may be possible to match the end of decod= ing up to the frame end, this would be difficult but could allow a bit extra re= covery of image data. also bit errors tend to be uncommon so if you encounter something looking l= ike a bit error, consider that may be a encoder or decoder bug. I dont know what = your case is but if it is a encoder bug or some odd quirk of some encoder it may= be possible to add some special case and decode that better than just handling= it like an error If you really have a file that benefits still after all above from continued blind decoding after an error then something like your patch can be conside= red iam not against it. Can you share the jpeg this helps ? thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Opposition brings concord. Out of discord comes the fairest harmony. -- Heraclitus --e8znkWhb8vS+si4n Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCYuKh+wAKCRBhHseHBAsP qy2AAJ4p2F65gEOrZFXiXJduq8zEpd8eGgCgihBNmM7f2g1mH5Dz1W6pGld+SPw= =MvWe -----END PGP SIGNATURE----- --e8znkWhb8vS+si4n-- --===============0570699383462921521== 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". --===============0570699383462921521==--