From: Anton Khirnov <anton@khirnov.net>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 05/11] lavc/hevcdec: drop HEVCContext.HEVClc
Date: Fri, 31 May 2024 19:47:43 +0200
Message-ID: <20240531174804.17572-5-anton@khirnov.net> (raw)
In-Reply-To: <20240531174804.17572-1-anton@khirnov.net>
It is merely a pointer to local_ctx[0], which we can just as well use
directly.
---
libavcodec/hevcdec.c | 24 ++++++++++--------------
libavcodec/hevcdec.h | 2 --
2 files changed, 10 insertions(+), 16 deletions(-)
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 0a9443505a..75d0ed613a 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -1036,14 +1036,14 @@ static int hls_slice_header(HEVCContext *s, GetBitContext *gb)
return AVERROR_INVALIDDATA;
}
- s->HEVClc->first_qp_group = !s->sh.dependent_slice_segment_flag;
+ s->local_ctx[0].first_qp_group = !s->sh.dependent_slice_segment_flag;
if (!s->ps.pps->cu_qp_delta_enabled_flag)
- s->HEVClc->qp_y = s->sh.slice_qp;
+ s->local_ctx[0].qp_y = s->sh.slice_qp;
s->slice_initialized = 1;
- s->HEVClc->tu.cu_qp_offset_cb = 0;
- s->HEVClc->tu.cu_qp_offset_cr = 0;
+ s->local_ctx[0].tu.cu_qp_offset_cb = 0;
+ s->local_ctx[0].tu.cu_qp_offset_cr = 0;
return 0;
}
@@ -2534,7 +2534,7 @@ static void hls_decode_neighbour(HEVCLocalContext *lc, int x_ctb, int y_ctb,
static int hls_decode_entry(HEVCContext *s, GetBitContext *gb)
{
- HEVCLocalContext *const lc = s->HEVClc;
+ HEVCLocalContext *const lc = &s->local_ctx[0];
const uint8_t *slice_data = gb->buffer + s->sh.data_offset;
const size_t slice_size = gb->buffer_end - gb->buffer - s->sh.data_offset;
int ctb_size = 1 << s->ps.sps->log2_ctb_size;
@@ -2704,7 +2704,6 @@ static int hls_slice_data_wpp(HEVCContext *s, const H2645NAL *nal)
memcpy(tmp, s->local_ctx, sizeof(*s->local_ctx) * s->nb_local_ctx);
av_free(s->local_ctx);
s->local_ctx = tmp;
- s->HEVClc = &s->local_ctx[0];
for (unsigned i = s->nb_local_ctx; i < s->threads_number; i++) {
tmp = &s->local_ctx[i];
@@ -2757,7 +2756,7 @@ static int hls_slice_data_wpp(HEVCContext *s, const H2645NAL *nal)
for (i = 1; i < s->threads_number; i++) {
s->local_ctx[i].first_qp_group = 1;
- s->local_ctx[i].qp_y = s->HEVClc->qp_y;
+ s->local_ctx[i].qp_y = s->local_ctx[0].qp_y;
}
atomic_store(&s->wpp_err, 0);
@@ -2868,7 +2867,6 @@ static int set_side_data(HEVCContext *s)
static int hevc_frame_start(HEVCContext *s)
{
- HEVCLocalContext *lc = s->HEVClc;
int pic_size_in_ctb = ((s->ps.sps->width >> s->ps.sps->log2_min_cb_size) + 1) *
((s->ps.sps->height >> s->ps.sps->log2_min_cb_size) + 1);
int ret;
@@ -2885,7 +2883,7 @@ static int hevc_frame_start(HEVCContext *s)
s->no_rasl_output_flag = IS_IDR(s) || IS_BLA(s) || (s->nal_unit_type == HEVC_NAL_CRA_NUT && s->last_eos);
if (s->ps.pps->tiles_enabled_flag)
- lc->end_of_tiles_x = s->ps.pps->column_width[0] << s->ps.sps->log2_ctb_size;
+ s->local_ctx[0].end_of_tiles_x = s->ps.pps->column_width[0] << s->ps.sps->log2_ctb_size;
ret = ff_hevc_set_new_ref(s, &s->frame, s->poc);
if (ret < 0)
@@ -3505,11 +3503,9 @@ static av_cold int hevc_init_context(AVCodecContext *avctx)
return AVERROR(ENOMEM);
s->nb_local_ctx = 1;
- s->HEVClc = &s->local_ctx[0];
-
- s->HEVClc->parent = s;
- s->HEVClc->logctx = avctx;
- s->HEVClc->common_cabac_state = &s->cabac;
+ s->local_ctx[0].parent = s;
+ s->local_ctx[0].logctx = avctx;
+ s->local_ctx[0].common_cabac_state = &s->cabac;
s->output_frame = av_frame_alloc();
if (!s->output_frame)
diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h
index 0ed51a5392..6957cd1091 100644
--- a/libavcodec/hevcdec.h
+++ b/libavcodec/hevcdec.h
@@ -452,8 +452,6 @@ typedef struct HEVCContext {
HEVCLocalContext *local_ctx;
unsigned nb_local_ctx;
- HEVCLocalContext *HEVClc;
-
uint8_t threads_type;
uint8_t threads_number;
--
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".
next prev parent reply other threads:[~2024-05-31 17:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-31 17:47 [FFmpeg-devel] [PATCH 01/11] lavc/hevcdec: move handling of byte alignment at the end of slice header Anton Khirnov
2024-05-31 17:47 ` [FFmpeg-devel] [PATCH 02/11] lavc/hevcdec: drop a useless condition Anton Khirnov
2024-05-31 17:47 ` [FFmpeg-devel] [PATCH 03/11] lavc/hevcdec: include first row in SliceHeader.offset/size Anton Khirnov
2024-05-31 17:47 ` [FFmpeg-devel] [PATCH 04/11] lavc/hevcdec: drop HEVCLocalContext.gb Anton Khirnov
2024-05-31 17:47 ` Anton Khirnov [this message]
2024-05-31 17:47 ` [FFmpeg-devel] [PATCH 06/11] lavc/hevcdec: rename HEVCContext.ref to cur_frame Anton Khirnov
2024-05-31 17:47 ` [FFmpeg-devel] [PATCH 07/11] lavc/hevcdec: rename HEVCFrame.frame to just f Anton Khirnov
2024-05-31 17:47 ` [FFmpeg-devel] [PATCH 08/11] lavc/hevcdec: drop HEVCContext.frame Anton Khirnov
2024-05-31 17:47 ` [FFmpeg-devel] [PATCH 09/11] lavc/hevc*: move to hevc/ subdir Anton Khirnov
2024-06-02 0:39 ` James Almer
2024-06-02 6:50 ` Anton Khirnov
2024-05-31 17:47 ` [FFmpeg-devel] [PATCH 10/11] lavc/hevcdec: deduplicate calling hwaccel decode_params() Anton Khirnov
2024-05-31 17:47 ` [FFmpeg-devel] [PATCH 11/11] lavc/hevcdec: drop unused HEVCContext.width/height Anton Khirnov
2024-05-31 19:11 ` Vittorio Giovara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240531174804.17572-5-anton@khirnov.net \
--to=anton@khirnov.net \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git