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 BAC834BD2D for ; Tue, 16 Jul 2024 18:14:56 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1D2F468DAD1; Tue, 16 Jul 2024 21:14:15 +0300 (EEST) Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 845CD68D88A for ; Tue, 16 Jul 2024 21:14:04 +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=kCqjpYD/; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 23F7A4DE6 for ; Tue, 16 Jul 2024 19:16:32 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id mWt5e_RMDTDz for ; Tue, 16 Jul 2024 19:16:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1721150187; bh=D0Njjaajs3DtGw2fXNWC0Zw5V6ekugRhmfTGKDjhHzg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=kCqjpYD/42TH/w5IiJ6DEJXMOv9OIUh3ZRVqqyOWC4Mk4DUBGuRFwAbM4OGfXoiFD Hm1Om+XTPKGz1uuZgaLKBNQsW1tjpxt6WCRMGl8nFpbXZAftEe7FMDXyXumEEb3tvA I2jmDcIkfidYsCyYPuTRJWKzcvicCgiNkWqcos4bj5+Y9LOmiG6lWn2ddpOkYeTBsl S8HoBOsIA2Fd90ekFlRG9QgEvfvO3RNMRa20u9h5ghq+K6UFuTVZK2UXNKDaqNnxe6 pviGqvzRejBcMHqJj/9YWfZJ804rAxna46HdPoU+c8tUh/d5L36LXSKro3QdK5/TqI 2IR3hZxBqLVKQ== 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 655DE4DF1 for ; Tue, 16 Jul 2024 19:16:27 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 547223A083F for ; Tue, 16 Jul 2024 19:16:20 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 16 Jul 2024 19:11:19 +0200 Message-ID: <20240716171155.31838-4-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 04/39] lavc/ffv1dec: drop FFV1Context.cur 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: It is merely a pointer to FFV1Context.picture.f, which can just as well be used directly. --- libavcodec/ffv1.h | 1 - libavcodec/ffv1dec.c | 33 +++++++++++++++++---------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/libavcodec/ffv1.h b/libavcodec/ffv1.h index acec22e83e..d99367ce81 100644 --- a/libavcodec/ffv1.h +++ b/libavcodec/ffv1.h @@ -89,7 +89,6 @@ typedef struct FFV1Context { ProgressFrame picture, last_picture; struct FFV1Context *fsrc; - AVFrame *cur; const AVFrame *cur_enc_frame; int plane_count; int ac; ///< 1=range coder <-> 0=golomb rice diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c index 7066146477..60d04f04b9 100644 --- a/libavcodec/ffv1dec.c +++ b/libavcodec/ffv1dec.c @@ -163,7 +163,8 @@ static int decode_plane(FFV1Context *s, uint8_t *src, return 0; } -static int decode_slice_header(const FFV1Context *f, FFV1Context *fs) +static int decode_slice_header(const FFV1Context *f, FFV1Context *fs, + AVFrame *frame) { RangeCoder *c = &fs->c; uint8_t state[CONTEXT_SIZE]; @@ -217,23 +218,23 @@ static int decode_slice_header(const FFV1Context *f, FFV1Context *fs) ps = get_symbol(c, state, 0); if (ps == 1) { - f->cur->flags |= AV_FRAME_FLAG_INTERLACED; - f->cur->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST; + frame->flags |= AV_FRAME_FLAG_INTERLACED; + frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST; } else if (ps == 2) { - f->cur->flags |= AV_FRAME_FLAG_INTERLACED; - f->cur->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST; + frame->flags |= AV_FRAME_FLAG_INTERLACED; + frame->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST; } else if (ps == 3) { - f->cur->flags &= ~AV_FRAME_FLAG_INTERLACED; + frame->flags &= ~AV_FRAME_FLAG_INTERLACED; } - f->cur->sample_aspect_ratio.num = get_symbol(c, state, 0); - f->cur->sample_aspect_ratio.den = get_symbol(c, state, 0); + frame->sample_aspect_ratio.num = get_symbol(c, state, 0); + frame->sample_aspect_ratio.den = get_symbol(c, state, 0); if (av_image_check_sar(f->width, f->height, - f->cur->sample_aspect_ratio) < 0) { + frame->sample_aspect_ratio) < 0) { av_log(f->avctx, AV_LOG_WARNING, "ignoring invalid SAR: %u/%u\n", - f->cur->sample_aspect_ratio.num, - f->cur->sample_aspect_ratio.den); - f->cur->sample_aspect_ratio = (AVRational){ 0, 1 }; + frame->sample_aspect_ratio.num, + frame->sample_aspect_ratio.den); + frame->sample_aspect_ratio = (AVRational){ 0, 1 }; } if (fs->version > 3) { @@ -258,7 +259,7 @@ static int decode_slice(AVCodecContext *c, void *arg) FFV1Context *f = fs->avctx->priv_data; int width, height, x, y, ret; const int ps = av_pix_fmt_desc_get(c->pix_fmt)->comp[0].step; - AVFrame * const p = f->cur; + AVFrame * const p = f->picture.f; const int si = (FFV1Context**)arg - f->slice_context; if (f->fsrc && !(p->flags & AV_FRAME_FLAG_KEY) && f->last_picture.f) @@ -299,7 +300,7 @@ static int decode_slice(AVCodecContext *c, void *arg) if (f->version > 2) { if (ff_ffv1_init_slice_state(f, fs) < 0) return AVERROR(ENOMEM); - if (decode_slice_header(f, fs) < 0) { + if (decode_slice_header(f, fs, p) < 0) { fs->slice_x = fs->slice_y = fs->slice_height = fs->slice_width = 0; fs->slice_damaged = 1; return AVERROR_INVALIDDATA; @@ -307,7 +308,7 @@ static int decode_slice(AVCodecContext *c, void *arg) } if ((ret = ff_ffv1_init_slice_state(f, fs)) < 0) return ret; - if ((f->cur->flags & AV_FRAME_FLAG_KEY) || fs->slice_reset_contexts) { + if ((p->flags & AV_FRAME_FLAG_KEY) || fs->slice_reset_contexts) { ff_ffv1_clear_slice_state(f, fs); } else if (fs->slice_damaged) { return AVERROR_INVALIDDATA; @@ -920,7 +921,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe, if (ret < 0) return ret; - f->cur = p = f->picture.f; + p = f->picture.f; p->pict_type = AV_PICTURE_TYPE_I; //FIXME I vs. P p->flags = (p->flags & ~AV_FRAME_FLAG_KEY) | key_frame; -- 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".