diff options
author | Anton Khirnov <anton@khirnov.net> | 2024-06-05 09:01:16 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2024-09-06 13:59:29 +0200 |
commit | 6fcf0045cf3bc5abbeba941117beb8b82f61ccd2 (patch) | |
tree | 6d34421e489f498352e510cd853758facfb5a148 | |
parent | 4f87ff766697173a5b6d9da40f77433413f4db3e (diff) | |
download | ffmpeg-6fcf0045cf3bc5abbeba941117beb8b82f61ccd2.tar.gz |
lavc/hevcdec: move HEVCContext.{tab_mvf,rpl_tab}_pool to HEVCLayerContext
pic_arrays_{init,free}() no longer access HEVCContext
-rw-r--r-- | libavcodec/hevc/hevcdec.c | 24 | ||||
-rw-r--r-- | libavcodec/hevc/hevcdec.h | 6 | ||||
-rw-r--r-- | libavcodec/hevc/refs.c | 4 |
3 files changed, 17 insertions, 17 deletions
diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index 2e31928e99..c4e3debae1 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -66,7 +66,7 @@ static const uint8_t hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, */ /* free everything allocated by pic_arrays_init() */ -static void pic_arrays_free(HEVCContext *s, HEVCLayerContext *l) +static void pic_arrays_free(HEVCLayerContext *l) { av_freep(&l->sao); av_freep(&l->deblock); @@ -85,12 +85,12 @@ static void pic_arrays_free(HEVCContext *s, HEVCLayerContext *l) av_freep(&l->horizontal_bs); av_freep(&l->vertical_bs); - ff_refstruct_pool_uninit(&s->tab_mvf_pool); - ff_refstruct_pool_uninit(&s->rpl_tab_pool); + ff_refstruct_pool_uninit(&l->tab_mvf_pool); + ff_refstruct_pool_uninit(&l->rpl_tab_pool); } /* allocate arrays that depend on frame dimensions */ -static int pic_arrays_init(HEVCContext *s, HEVCLayerContext *l, const HEVCSPS *sps) +static int pic_arrays_init(HEVCLayerContext *l, const HEVCSPS *sps) { int log2_min_cb_size = sps->log2_min_cb_size; int width = sps->width; @@ -132,15 +132,15 @@ static int pic_arrays_init(HEVCContext *s, HEVCLayerContext *l, const HEVCSPS *s if (!l->horizontal_bs || !l->vertical_bs) goto fail; - s->tab_mvf_pool = ff_refstruct_pool_alloc(min_pu_size * sizeof(MvField), 0); - s->rpl_tab_pool = ff_refstruct_pool_alloc(ctb_count * sizeof(RefPicListTab), 0); - if (!s->tab_mvf_pool || !s->rpl_tab_pool) + l->tab_mvf_pool = ff_refstruct_pool_alloc(min_pu_size * sizeof(MvField), 0); + l->rpl_tab_pool = ff_refstruct_pool_alloc(ctb_count * sizeof(RefPicListTab), 0); + if (!l->tab_mvf_pool || !l->rpl_tab_pool) goto fail; return 0; fail: - pic_arrays_free(s, l); + pic_arrays_free(l); return AVERROR(ENOMEM); } @@ -531,14 +531,14 @@ static int set_sps(HEVCContext *s, HEVCLayerContext *l, const HEVCSPS *sps) { int ret, i; - pic_arrays_free(s, l); + pic_arrays_free(l); s->ps.sps = NULL; ff_refstruct_unref(&s->vps); if (!sps) return 0; - ret = pic_arrays_init(s, l, sps); + ret = pic_arrays_init(l, sps); if (ret < 0) goto fail; @@ -576,7 +576,7 @@ static int set_sps(HEVCContext *s, HEVCLayerContext *l, const HEVCSPS *sps) return 0; fail: - pic_arrays_free(s, l); + pic_arrays_free(l); for (i = 0; i < 3; i++) { av_freep(&s->sao_pixel_buffer_h[i]); av_freep(&s->sao_pixel_buffer_v[i]); @@ -3529,7 +3529,7 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx) int i; for (int i = 0; i < FF_ARRAY_ELEMS(s->layers); i++) - pic_arrays_free(s, &s->layers[i]); + pic_arrays_free(&s->layers[i]); ff_refstruct_unref(&s->vps); ff_refstruct_unref(&s->pps); diff --git a/libavcodec/hevc/hevcdec.h b/libavcodec/hevc/hevcdec.h index 426b7968b0..1a43c3662c 100644 --- a/libavcodec/hevc/hevcdec.h +++ b/libavcodec/hevc/hevcdec.h @@ -465,6 +465,9 @@ typedef struct HEVCLayerContext { uint8_t *horizontal_bs; uint8_t *vertical_bs; + + struct FFRefStructPool *tab_mvf_pool; + struct FFRefStructPool *rpl_tab_pool; } HEVCLayerContext; typedef struct HEVCContext { @@ -489,9 +492,6 @@ typedef struct HEVCContext { HEVCSEI sei; struct AVMD5 *md5_ctx; - struct FFRefStructPool *tab_mvf_pool; - struct FFRefStructPool *rpl_tab_pool; - ///< candidate references for the current frame RefPicList rps[5]; diff --git a/libavcodec/hevc/refs.c b/libavcodec/hevc/refs.c index 4d123d6d8d..7b8dff4f55 100644 --- a/libavcodec/hevc/refs.c +++ b/libavcodec/hevc/refs.c @@ -95,11 +95,11 @@ static HEVCFrame *alloc_frame(HEVCContext *s, HEVCLayerContext *l) goto fail; frame->nb_rpl_elems = s->pkt.nb_nals; - frame->tab_mvf = ff_refstruct_pool_get(s->tab_mvf_pool); + frame->tab_mvf = ff_refstruct_pool_get(l->tab_mvf_pool); if (!frame->tab_mvf) goto fail; - frame->rpl_tab = ff_refstruct_pool_get(s->rpl_tab_pool); + frame->rpl_tab = ff_refstruct_pool_get(l->rpl_tab_pool); if (!frame->rpl_tab) goto fail; frame->ctb_count = s->ps.sps->ctb_width * s->ps.sps->ctb_height; |