[FFmpeg-cvslog] avcodec/hevc_ps: add a function to uninitialize parameter set buffers
ffmpeg | branch: release/3.4 | James Almer| Sat Jan 20 16:54:15 2018 -0300| [64f0fd599845fb9e4db9ba51012792abaf38a9ea] | committer: James Almer avcodec/hevc_ps: add a function to uninitialize parameter set buffers Reviewed-by: Michael Niedermayer Signed-off-by: James Almer (cherry picked from commit 9462b2b8205397ea5972b2365c2e8db6872ef3e9) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=64f0fd599845fb9e4db9ba51012792abaf38a9ea --- libavcodec/hevc_ps.c | 16 libavcodec/hevc_ps.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index 2ab4c34013..6f3af2daec 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -1709,6 +1709,22 @@ err: return ret; } +void ff_hevc_ps_uninit(HEVCParamSets *ps) +{ +int i; + +for (i = 0; i < FF_ARRAY_ELEMS(ps->vps_list); i++) +av_buffer_unref(>vps_list[i]); +for (i = 0; i < FF_ARRAY_ELEMS(ps->sps_list); i++) +av_buffer_unref(>sps_list[i]); +for (i = 0; i < FF_ARRAY_ELEMS(ps->pps_list); i++) +av_buffer_unref(>pps_list[i]); + +ps->sps = NULL; +ps->pps = NULL; +ps->vps = NULL; +} + int ff_hevc_compute_poc(const HEVCSPS *sps, int pocTid0, int poc_lsb, int nal_unit_type) { int max_poc_lsb = 1 << sps->log2_max_poc_lsb; diff --git a/libavcodec/hevc_ps.h b/libavcodec/hevc_ps.h index 76f8eb31e6..f19d022469 100644 --- a/libavcodec/hevc_ps.h +++ b/libavcodec/hevc_ps.h @@ -421,6 +421,8 @@ int ff_hevc_decode_nal_sps(GetBitContext *gb, AVCodecContext *avctx, int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx, HEVCParamSets *ps); +void ff_hevc_ps_uninit(HEVCParamSets *ps); + int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx, ShortTermRPS *rps, const HEVCSPS *sps, int is_slice_header); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/hevc_ps: add a function to uninitialize parameter set buffers
ffmpeg | branch: master | James Almer| Sat Jan 20 16:54:15 2018 -0300| [9462b2b8205397ea5972b2365c2e8db6872ef3e9] | committer: James Almer avcodec/hevc_ps: add a function to uninitialize parameter set buffers Reviewed-by: Michael Niedermayer Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9462b2b8205397ea5972b2365c2e8db6872ef3e9 --- libavcodec/hevc_ps.c | 16 libavcodec/hevc_ps.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index a4f7ed60f7..4787312cfa 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -1704,6 +1704,22 @@ err: return ret; } +void ff_hevc_ps_uninit(HEVCParamSets *ps) +{ +int i; + +for (i = 0; i < FF_ARRAY_ELEMS(ps->vps_list); i++) +av_buffer_unref(>vps_list[i]); +for (i = 0; i < FF_ARRAY_ELEMS(ps->sps_list); i++) +av_buffer_unref(>sps_list[i]); +for (i = 0; i < FF_ARRAY_ELEMS(ps->pps_list); i++) +av_buffer_unref(>pps_list[i]); + +ps->sps = NULL; +ps->pps = NULL; +ps->vps = NULL; +} + int ff_hevc_compute_poc(const HEVCSPS *sps, int pocTid0, int poc_lsb, int nal_unit_type) { int max_poc_lsb = 1 << sps->log2_max_poc_lsb; diff --git a/libavcodec/hevc_ps.h b/libavcodec/hevc_ps.h index 477ee4299a..9873754389 100644 --- a/libavcodec/hevc_ps.h +++ b/libavcodec/hevc_ps.h @@ -421,6 +421,8 @@ int ff_hevc_decode_nal_sps(GetBitContext *gb, AVCodecContext *avctx, int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx, HEVCParamSets *ps); +void ff_hevc_ps_uninit(HEVCParamSets *ps); + int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx, ShortTermRPS *rps, const HEVCSPS *sps, int is_slice_header); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog