mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-25 16:52:31 +00:00
lavc/hevcdec: move HEVCContext.{tab_mvf,rpl_tab}_pool to HEVCLayerContext
pic_arrays_{init,free}() no longer access HEVCContext
This commit is contained in:
parent
4f87ff7666
commit
6fcf0045cf
@ -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);
|
||||
|
@ -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];
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user