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 27AC347DB7 for ; Wed, 27 Dec 2023 12:30:10 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D3BD068C97B; Wed, 27 Dec 2023 14:30:07 +0200 (EET) Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 72CEE68C11C for ; Wed, 27 Dec 2023 14:30:01 +0200 (EET) Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-55539cac143so1150285a12.0 for ; Wed, 27 Dec 2023 04:30:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703680200; x=1704285000; darn=ffmpeg.org; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=tML5EawMxPWEnmrFhnZDEjYEQESS3mfI4Aoead8XDdA=; b=i1aom/NBOSF/nQsEvP8WkBukll+jiDl+hzfDEruqb/i8ff8mpya/fwHPAsWzCwLV5k 8fg4DbjUnX3DyowpswuNFcOXe148Q3xsJm8zcRE54zsX8fv8ReshIaEhoLUnUDPLmL2p zwoXJiD8YtULBjR6UbW71IMyDwk764A6X8UsLG+9ApKaTRbx158+4N/W0DBKOCa/5BTS gA9vRg5yWeS1zvsoPXWTk1Gdzl/Az7Zf9tdPxNUeH0L71qInUpoSI1d+lpCqblE5/uee ZAWKf0Bbd0YtYMv+i338Y9fRZzxjrYDWy0ou2zmuahFkJV59p7eFKQsc7++sLAjCyyEc GaKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703680200; x=1704285000; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tML5EawMxPWEnmrFhnZDEjYEQESS3mfI4Aoead8XDdA=; b=JY4gFeKk8tXGSaaKq1dugjMqiOzO7ZlRU/w+SSSqKyHj+TUwUGT5b1h/I3nW8TEySa 0qMtfaZSlZuO12EHf/Rq+wEyFySzo7iiN+okWIMLO4NyGEkkqgoycdTGBFmwXd4P6e1X RMJQLttdAew7zqTBGEnWMMPMEfaiyXZpCC/RsfEt3Dgb2jsIuximsVIm+Lb1+j3RCcDY ct8YtTkx/y9sjEzWUDQWmcDNjyXvksT66Pkbq2Q6zM1BE6/XsL8jr0MiPg9fZ2WBlAFP Yh8eBKVoPVaRa8c63tQbD76bbMpobQfgQu6K+2E8KzGSfkMhuuMXeMGY6DGItAXQNk5/ C3Lg== X-Gm-Message-State: AOJu0Yz/4aW691ZK3P8xLuzSOAR1QzeHZXjX71VMTnN39wOMJYXInaob 0qIX6quG91EM/hTpyBmY7qZB3jQYcdA= X-Google-Smtp-Source: AGHT+IGONfMVexkvjq3xSWmkCFGC4MrAHoGWT7Pp/1eT2RZjOuTSU9hBYq7plQjpLUlwCM/t30jpqw== X-Received: by 2002:a05:6402:5bc4:b0:550:e014:5254 with SMTP id gy4-20020a0564025bc400b00550e0145254mr5083346edb.27.1703680200136; Wed, 27 Dec 2023 04:30:00 -0800 (PST) Received: from mariano (dynamic-adsl-84-220-189-10.clienti.tiscali.it. [84.220.189.10]) by smtp.gmail.com with ESMTPSA id ck8-20020a0564021c0800b0055515b40464sm2189695edb.81.2023.12.27.04.29.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 04:29:59 -0800 (PST) Received: by mariano (Postfix, from userid 1000) id 6BAF3BFCDC; Wed, 27 Dec 2023 13:29:58 +0100 (CET) Date: Wed, 27 Dec 2023 13:29:58 +0100 From: Stefano Sabatini To: FFmpeg development discussions and patches Message-ID: Mail-Followup-To: FFmpeg development discussions and patches , =?iso-8859-15?Q?Cl=E9ment_B=BDsch?= References: <20231226222516.2513700-1-u@pkh.me> <20231226222516.2513700-2-u@pkh.me> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231226222516.2513700-2-u@pkh.me> User-Agent: Mutt/2.1.4 (2021-12-11) Subject: Re: [FFmpeg-devel] [PATCH 2/2] avcodec/proresenc: fix alpha plane encoding bitstream 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 Cc: =?iso-8859-15?Q?Cl=E9ment_B=BDsch?= Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On date Tuesday 2023-12-26 23:25:16 +0100, Cl=E9ment B=BDsch wrote: > These functions encode a slice of alpha (1 to 8 macroblocks) which are > expected to be encoded as a repeated sequence of "[diff][run-1]", where > diff is the running difference of the alpha value and run is how many > times that value is expected to be duplicated (within the limit of a > grand total of 2048 unpacked samples, corresponding to a slice of 8 MB). > = > Even when run=3D=3D0 (the run variable semantic is actually "run minus 1"= ), > there is always a diff previously encoded that needs a counter of at > least 1. This means we need to call put_alpha_run() unconditionally at > the end of the bitstream to account for the last running diff. > = > This commit fixes glitchy playbacks on QuickTime with M2 and M3 hardware > (but not M1 for some mysterious reason) with files generated with > commands such as: > = > ffmpeg -f lavfi -i testsrc2=3Dd=3D5:s=3D912x320,chromakey -c:v prores_a= w -profile:v 4 -y aw.mov > ffmpeg -f lavfi -i testsrc2=3Dd=3D5:s=3D912x320,chromakey -c:v prores_k= s -profile:v 4444 -y ks.mov > = > The glitch expresses itself deterministically as blinking black > rectangles on random frames (for example on frame 21, 54, 71, 79, ...). > = > Even with the proresdec from FFmpeg, overreads actually happens while > reading the run-minus-1 value (around val =3D get_bits(gb, 4) in > unpack_alpha()). This doesn't seem to cause any particular issue because > it simply overreads into the next slice, and because the decoder is > resilient, but it's still a problem. > = > Fixes ticket #10255. > --- > libavcodec/proresenc_anatoliy.c | 3 +-- > libavcodec/proresenc_kostya.c | 3 +-- > 2 files changed, 2 insertions(+), 4 deletions(-) > = > diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anato= liy.c > index 16741afd68..9b9ffa03be 100644 > --- a/libavcodec/proresenc_anatoliy.c > +++ b/libavcodec/proresenc_anatoliy.c > @@ -486,8 +486,7 @@ static av_always_inline int encode_alpha_slice_data(A= VCodecContext *avctx, int8_ > run++; > } > } while (idx < num_coeffs); > - if (run) > - put_alpha_run(&pb, run); > + put_alpha_run(&pb, run); > flush_put_bits(&pb); > *a_data_size =3D put_bytes_output(&pb); > = > diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c > index e904632f8e..8d45e42d1a 100644 > --- a/libavcodec/proresenc_kostya.c > +++ b/libavcodec/proresenc_kostya.c > @@ -562,8 +562,7 @@ static void encode_alpha_plane(ProresContext *ctx, Pu= tBitContext *pb, > run++; > } > } while (idx < num_coeffs); > - if (run) > - put_alpha_run(pb, run); > + put_alpha_run(pb, run); > } LGTM, thanks. _______________________________________________ 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".