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 495F54BDEB for ; Tue, 16 Jul 2024 18:34:13 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1137968DB33; Tue, 16 Jul 2024 21:34:10 +0300 (EEST) Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 67D3268D85D for ; Tue, 16 Jul 2024 21:33:59 +0300 (EEST) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=Q2lo0Vau; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 4090A4DE1 for ; Tue, 16 Jul 2024 19:16:37 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id dETkG7BJJxGA for ; Tue, 16 Jul 2024 19:16:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1721150190; bh=W3jQP+2epuOPfWVJFZpYOtkSFh3V9tk8iLrZroywXzM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Q2lo0VauHzXRprbwOIRT+CfTAN7IDWqiBeSeaRdlxbwLanzrwLaMQcHtY7X7Mz3nl pFN+UnYAS1PAlFYMLLUCl6/tsXnLKb+fH1p3yMMRSgH8HE93TtxSKXF9LNn6Y8CxWU eDhwYT8oMlCTqChkjXqMpTZ5sje/JF4LYWLsvTmG3dPvxmFyd0jjNwyk4hKe6KERPN 38xC8Jof3eJQfMUtvzAn41JgZrGD2V/HUtSNJ3s6Q2vlRazn9pG15L9z9niOlhLoEV hvedTzwJ6PUpxhnGu3TQUgVyE37aINDy293deCRZ371el13GpWUR8Oo1xom4M/jxjn 1hQs0L+t+RmSg== Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id 9252D4E07 for ; Tue, 16 Jul 2024 19:16:28 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 3E0013A2D94 for ; Tue, 16 Jul 2024 19:16:21 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 16 Jul 2024 19:11:38 +0200 Message-ID: <20240716171155.31838-23-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240716171155.31838-1-anton@khirnov.net> References: <20240716171155.31838-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 23/39] lavc/ffv1dec: move slice_reset_contexts to per-slice context 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: --- libavcodec/ffv1.h | 16 +++++++++++++--- libavcodec/ffv1dec.c | 4 ++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/libavcodec/ffv1.h b/libavcodec/ffv1.h index ae81940073..cef61f38ec 100644 --- a/libavcodec/ffv1.h +++ b/libavcodec/ffv1.h @@ -86,8 +86,19 @@ typedef struct FFV1SliceContext { RangeCoder c; int ac_byte_count; ///< number of bytes used for AC coding - uint64_t rc_stat[256][2]; - uint64_t (*rc_stat2[MAX_QUANT_TABLES])[32][2]; + + union { + // decoder-only + struct { + int slice_reset_contexts; + }; + + // encoder-only + struct { + uint64_t rc_stat[256][2]; + uint64_t (*rc_stat2[MAX_QUANT_TABLES])[32][2]; + }; + }; } FFV1SliceContext; typedef struct FFV1Context { @@ -135,7 +146,6 @@ typedef struct FFV1Context { int max_slice_count; int num_v_slices; int num_h_slices; - int slice_reset_contexts; FFV1SliceContext *slices; } FFV1Context; diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c index 4dc1f4b1cf..92e5b2a80b 100644 --- a/libavcodec/ffv1dec.c +++ b/libavcodec/ffv1dec.c @@ -238,7 +238,7 @@ static int decode_slice_header(const FFV1Context *f, FFV1Context *fs, } if (fs->version > 3) { - fs->slice_reset_contexts = get_rac(c, state); + sc->slice_reset_contexts = get_rac(c, state); sc->slice_coding_mode = get_symbol(c, state, 0); if (sc->slice_coding_mode != 1) { sc->slice_rct_by_coef = get_symbol(c, state, 0); @@ -308,7 +308,7 @@ static int decode_slice(AVCodecContext *c, void *arg) } if ((ret = ff_ffv1_init_slice_state(f, sc)) < 0) return ret; - if ((p->flags & AV_FRAME_FLAG_KEY) || fs->slice_reset_contexts) { + if ((p->flags & AV_FRAME_FLAG_KEY) || sc->slice_reset_contexts) { ff_ffv1_clear_slice_state(f, sc); } else if (fs->slice_damaged) { return AVERROR_INVALIDDATA; -- 2.43.0 _______________________________________________ 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".