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 ESMTPS id 128384AE26 for ; Tue, 21 Jan 2025 16:40:45 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E4F0A68B722; Tue, 21 Jan 2025 18:40:42 +0200 (EET) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AF32268B611 for ; Tue, 21 Jan 2025 18:40:36 +0200 (EET) Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2165448243fso128477295ad.1 for ; Tue, 21 Jan 2025 08:40:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737477635; x=1738082435; darn=ffmpeg.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=SKPHldtJssL1DL4ptUo1M8pRTXfcBd+ZKMJ8ClumVkQ=; b=ATQqHqMLnxUmDSKSdP4bYMTFgoZ9BXMwixGbw4Vr4vvD8Ta+H0RMwBRIbzeMYbIS7l V+QUQWuxv+GAPAnJ7wuzBy3rfYwSdLgfpreeCv1iP/uR2c8kqBtmY4+uLdNJL/TPM2Xf CKgO+XS5nwcHmwtIKTeoG4buTaC1IZEeJDruBhi26Y5qa5zl/q+g5SZHNAlmA/JpZOpp 5GVpodEIMGo4OSsKC/g24WF84ehEX1FaFSH6oLzkKsoLWuSEJI195DJERTKsp0dRCMgH MjKWp6oZkDjQ31+0uJykRnOiVhCmsTMEEnWzI+GsOQ95Sb5DHdLOJTUBA4kbyuK2gcdR bkMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737477635; x=1738082435; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SKPHldtJssL1DL4ptUo1M8pRTXfcBd+ZKMJ8ClumVkQ=; b=tKi9NGaFnmkm0Y4JXKrgDjCr3IToI/sqr1hykJ8iXojmthPcSQQoLQPLfumihqE5Pv /JAS9Di5Zy3iaM/orXiZHQWUfjbcg8BOm7pySmXPsIQeAaa4WnLzQtDbcUKzTsabjboi TLFhnaxflLW/CMVsrWrLmSBQd0bHDaSp8RQvWAcR055rTUCzshsGIS9R7JZq3logkDFM JVZrd23dKbGDsDXIZK00fhKbAKaDBJcHo/75j3ZTHzS8gCdiOwrXE9I53gwbpVPu/vYT Sz+agxOlVwx/qL7Kq3TyCZ+/w5enYFbwr4gwDZUgcXXEy21Tg+1L5jDyJ2PCWWhoYUFg ahFA== X-Gm-Message-State: AOJu0YxW29I8raBqQyuFZXROBkBbTVjY0aSaatJgUmtICdMBg1nJlAJ3 4oTYa25B34iYCjeiepqjeoSmPYnKFj01hDM+ehf/6j1vrEduRKaLoHLjQt8u9X3wwZbaIHLMUZi cGJgYx5KDZKOnq9dIosnuQVx4eRIbZw== X-Gm-Gg: ASbGncuqnIVk8GADykM5tPKgdJAA+HoxqNUv1yxkwwZm4n9O6EVe7So4se9Cn551nwp UWYun180UsYR4RXnxUpFS8rTauYug3gdikZklU0ZDXSsXNhuqUSK3wwg92BwEFqGIsmNLz8gTgH OiW1TeX+w= X-Google-Smtp-Source: AGHT+IEiCk3Rq/n8A2EUECZvPkjnyB2/Jq9H1UoWwJt7krcrlBTC3Yc9WiQGWMRDbwmuIWT1j4hmCUd0Kqnjb+X2hJY= X-Received: by 2002:a05:6a20:918b:b0:1e0:c50c:9842 with SMTP id adf61e73a8af0-1eb2157fce9mr33526638637.31.1737477634990; Tue, 21 Jan 2025 08:40:34 -0800 (PST) MIME-Version: 1.0 References: <20250113210024.105135-1-manuel.lauss@gmail.com> In-Reply-To: <20250113210024.105135-1-manuel.lauss@gmail.com> From: Manuel Lauss Date: Tue, 21 Jan 2025 17:40:25 +0100 X-Gm-Features: AbW1kvZ6li9xY50bw5Hh64rs-WY4DlaIl9x_03fZma34MuC90hS4wc9YoEGIcJs Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH v2 3/2] avcodec/sanm: codec37 buffers are private 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: 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: Ping? Manuel Lauss schrieb am Mo., 13. Jan. 2025, 22:00: > codec37 operates on 2 buffers, which must be considered private to > the codec and must therefore not be changed by subsequent FOBJs. > > Let codec37 therefore operate on frm1/2 instead of frm0/2, but copy > the decoded image to frm0 where other codecs operate on. > > Fixes artifacts encountered in Full Throttle "dazed.san" and also > in a lot of Rebel Assault II gameplay videos: these videos consist of > frames with an initial codec37 FOBJ image to set the stage, and > optional codec1-23 FOBJs overlaid on top of that image. > > Signed-off-by: Manuel Lauss > --- > v2: use FFSWAP() to swap the 2 buffers instead of open-coding that. > > Applies on top of my previous patch "avcodec/sanm: simplify codec37 > subcodec 3/4 path" > > libavcodec/sanm.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c > index 51b8a2f54c..c30095ed32 100644 > --- a/libavcodec/sanm.c > +++ b/libavcodec/sanm.c > @@ -645,10 +645,11 @@ static int old_codec37(SANMVideoContext *ctx, int > top, > > ctx->rotate_code = 0; > > - if (((seq & 1) || !(flags & 1)) && (compr && compr != 2)) > - rotate_bufs(ctx, 1); > + if (((seq & 1) || !(flags & 1)) && (compr && compr != 2)) { > + FFSWAP(uint16_t*, ctx->frm1, ctx->frm2); > + } > > - dst = ((uint8_t*)ctx->frm0) + left + top * stride; > + dst = ((uint8_t*)ctx->frm1) + left + top * stride; > prev = ((uint8_t*)ctx->frm2) + left + top * stride; > > if (mvoff > 2) { > @@ -662,7 +663,6 @@ static int old_codec37(SANMVideoContext *ctx, int top, > bytestream2_get_buffer(&ctx->gb, dst, width); > dst += stride; > } > - memset(ctx->frm1, 0, ctx->height * stride); > memset(ctx->frm2, 0, ctx->height * stride); > break; > case 1: > @@ -729,7 +729,6 @@ static int old_codec37(SANMVideoContext *ctx, int top, > case 2: > if (rle_decode(ctx, dst, decoded_size)) > return AVERROR_INVALIDDATA; > - memset(ctx->frm1, 0, ctx->frm1_size); > memset(ctx->frm2, 0, ctx->frm2_size); > break; > case 3: > @@ -783,6 +782,7 @@ static int old_codec37(SANMVideoContext *ctx, int top, > return AVERROR_PATCHWELCOME; > } > > + memcpy(ctx->frm0, ctx->frm1, ctx->buf_size); > return 0; > } > > -- > 2.47.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".