[FFmpeg-cvslog] lavc/hevcdec: deduplicate calling hwaccel decode_params()
Anton Khirnov
git at videolan.org
Tue Jun 4 13:02:00 EEST 2024
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed May 29 13:44:04 2024 +0200| [a13b892080811345c9b5ae74ed1a9dbbccd5af52] | committer: Anton Khirnov
lavc/hevcdec: deduplicate calling hwaccel decode_params()
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a13b892080811345c9b5ae74ed1a9dbbccd5af52
---
libavcodec/hevc/hevcdec.c | 36 ++++++++++++------------------------
1 file 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;
More information about the ffmpeg-cvslog
mailing list