aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2024-05-29 13:44:04 +0200
committerAnton Khirnov <anton@khirnov.net>2024-06-04 11:46:27 +0200
commita13b892080811345c9b5ae74ed1a9dbbccd5af52 (patch)
tree61c78543237e06a2d548575de6074012aaf507f3 /libavcodec
parente4601cc3390eec6ccbfc1139bdd102b4e801ae80 (diff)
downloadffmpeg-a13b892080811345c9b5ae74ed1a9dbbccd5af52.tar.gz
lavc/hevcdec: deduplicate calling hwaccel decode_params()
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/hevc/hevcdec.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index 4a07fa6612..4e0df4d033 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -2985,49 +2985,37 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
s->nal_unit_type = nal->type;
s->temporal_id = nal->temporal_id;
+ if (FF_HW_HAS_CB(s->avctx, decode_params) &&
+ (s->nal_unit_type == HEVC_NAL_VPS ||
+ s->nal_unit_type == HEVC_NAL_SPS ||
+ s->nal_unit_type == HEVC_NAL_PPS ||
+ s->nal_unit_type == HEVC_NAL_SEI_PREFIX ||
+ s->nal_unit_type == HEVC_NAL_SEI_SUFFIX)) {
+ ret = FF_HW_CALL(s->avctx, decode_params,
+ nal->type, nal->raw_data, nal->raw_size);
+ if (ret < 0)
+ goto fail;
+ }
+
switch (s->nal_unit_type) {
case HEVC_NAL_VPS:
- if (FF_HW_HAS_CB(s->avctx, decode_params)) {
- ret = FF_HW_CALL(s->avctx, decode_params,
- nal->type, nal->raw_data, nal->raw_size);
- if (ret < 0)
- goto fail;
- }
ret = ff_hevc_decode_nal_vps(&gb, s->avctx, &s->ps);
if (ret < 0)
goto fail;
break;
case HEVC_NAL_SPS:
- if (FF_HW_HAS_CB(s->avctx, decode_params)) {
- ret = FF_HW_CALL(s->avctx, decode_params,
- nal->type, nal->raw_data, nal->raw_size);
- if (ret < 0)
- goto fail;
- }
ret = ff_hevc_decode_nal_sps(&gb, s->avctx, &s->ps,
s->apply_defdispwin);
if (ret < 0)
goto fail;
break;
case HEVC_NAL_PPS:
- if (FF_HW_HAS_CB(s->avctx, decode_params)) {
- ret = FF_HW_CALL(s->avctx, decode_params,
- nal->type, nal->raw_data, nal->raw_size);
- if (ret < 0)
- goto fail;
- }
ret = ff_hevc_decode_nal_pps(&gb, s->avctx, &s->ps);
if (ret < 0)
goto fail;
break;
case HEVC_NAL_SEI_PREFIX:
case HEVC_NAL_SEI_SUFFIX:
- if (FF_HW_HAS_CB(s->avctx, decode_params)) {
- ret = FF_HW_CALL(s->avctx, decode_params,
- nal->type, nal->raw_data, nal->raw_size);
- if (ret < 0)
- goto fail;
- }
ret = ff_hevc_decode_nal_sei(&gb, s->avctx, &s->sei, &s->ps, s->nal_unit_type);
if (ret < 0)
goto fail;