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 82E80431B0 for ; Mon, 22 Aug 2022 22:56:56 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AB0EB68B9DE; Tue, 23 Aug 2022 01:56:54 +0300 (EEST) Received: from vie01a-dmta-at03-1.mx.upcmail.net (vie01a-dmta-at03-1.mx.upcmail.net [62.179.121.151]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7556C68B53E for ; Tue, 23 Aug 2022 01:56:48 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-at03.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1oQGLg-005ZsZ-1J for ffmpeg-devel@ffmpeg.org; Tue, 23 Aug 2022 00:56:48 +0200 Received: from ren-mail-psmtp-mg02. ([80.109.253.241]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id QGKhoQO5N8s8UQGLgo219q; Tue, 23 Aug 2022 00:56:48 +0200 Received: from localhost ([213.47.68.29]) by ren-mail-psmtp-mg02. with ESMTP id QGKioUUjC8eSWQGKiot3qP; Tue, 23 Aug 2022 00:55:48 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.4 cv=KKE5sHJo c=1 sm=1 tr=0 ts=63040974 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=F-r7SiUni3eZCERIZQQA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 23 Aug 2022 00:55:45 +0200 Message-Id: <20220822225547.12895-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220822225547.12895-1-michael@niedermayer.cc> References: <20220822225547.12895-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfCiZOE6F22wa35f8iZyWK04FWX/6GKhTmK6sYo577Pc2WVMY75mDlhqo625IHWV/rI/wQCYOJSE+o0FkkHC0yyPgGKdELUGEhqKsK8Xifoh9Dh6ghiKx y8EwH3eXE7UJAO4UaMqjJLrVsjhtAs9id1IA4VMxHgtXcKR1z9bowuDqt0eVhy6stwhFwMjK7TJBxg== Subject: [FFmpeg-devel] [PATCH 2/4] avcodec/midivid: Perform lzss_uncompress() before ff_reget_buffer() 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 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: This would avoid regeting the frame on lzss errors Signed-off-by: Michael Niedermayer --- libavcodec/midivid.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/libavcodec/midivid.c b/libavcodec/midivid.c index 7448c8c797..6b76d5bcad 100644 --- a/libavcodec/midivid.c +++ b/libavcodec/midivid.c @@ -203,12 +203,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe, bytestream2_skip(gb, 8); uncompressed = bytestream2_get_le32(gb); - if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0) - return ret; - - if (uncompressed) { - ret = decode_mvdv(s, avctx, frame); - } else { + if (!uncompressed) { av_fast_padded_malloc(&s->uncompressed, &s->uncompressed_size, 16LL * (avpkt->size - 12)); if (!s->uncompressed) return AVERROR(ENOMEM); @@ -217,9 +212,13 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe, if (ret < 0) return ret; bytestream2_init(gb, s->uncompressed, ret); - ret = decode_mvdv(s, avctx, frame); } + if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0) + return ret; + + ret = decode_mvdv(s, avctx, frame); + if (ret < 0) return ret; key = ret; -- 2.17.1 _______________________________________________ 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".