[FFmpeg-cvslog] lavc/hevcdec: move calling hwaccel decode_slice to decode_slice_data()

Anton Khirnov git at videolan.org
Tue Jun 11 18:51:23 EEST 2024


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun Jun  2 14:02:52 2024 +0200| [fe171a3b51a1f20ff34159fe75ec44ed0c256348] | committer: Anton Khirnov

lavc/hevcdec: move calling hwaccel decode_slice to decode_slice_data()

>From decode_nal_unit(), as that is a more appropriate place for it.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fe171a3b51a1f20ff34159fe75ec44ed0c256348
---

 libavcodec/hevc/hevcdec.c | 38 +++++++++++++++++---------------------
 1 file changed, 17 insertions(+), 21 deletions(-)

diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index 0bf68ea45c..c148244361 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -2811,6 +2811,15 @@ static int decode_slice_data(HEVCContext *s, const H2645NAL *nal, GetBitContext
         }
     }
 
+    if (s->avctx->hwaccel)
+        return FF_HW_CALL(s->avctx, decode_slice, nal->raw_data, nal->raw_size);
+
+    if (s->avctx->profile == AV_PROFILE_HEVC_SCC) {
+        av_log(s->avctx, AV_LOG_ERROR,
+               "SCC profile is not yet implemented in hevc native decoder.\n");
+        return AVERROR_PATCHWELCOME;
+    }
+
     s->local_ctx[0].first_qp_group = !s->sh.dependent_slice_segment_flag;
 
     if (!pps->cu_qp_delta_enabled_flag)
@@ -3152,30 +3161,17 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
             }
         }
 
-        if (s->avctx->hwaccel) {
-            ret = FF_HW_CALL(s->avctx, decode_slice, nal->raw_data, nal->raw_size);
+        ctb_addr_ts = decode_slice_data(s, nal, &gb);
+        if (ctb_addr_ts >= s->cur_frame->ctb_count) {
+            ret = hevc_frame_end(s);
             if (ret < 0)
                 goto fail;
-        } else {
-            if (s->avctx->profile == AV_PROFILE_HEVC_SCC) {
-                av_log(s->avctx, AV_LOG_ERROR,
-                       "SCC profile is not yet implemented in hevc native decoder.\n");
-                ret = AVERROR_PATCHWELCOME;
-                goto fail;
-            }
-
-            ctb_addr_ts = decode_slice_data(s, nal, &gb);
-            if (ctb_addr_ts >= s->cur_frame->ctb_count) {
-                ret = hevc_frame_end(s);
-                if (ret < 0)
-                    goto fail;
-                s->is_decoded = 1;
-            }
+            s->is_decoded = 1;
+        }
 
-            if (ctb_addr_ts < 0) {
-                ret = ctb_addr_ts;
-                goto fail;
-            }
+        if (ctb_addr_ts < 0) {
+            ret = ctb_addr_ts;
+            goto fail;
         }
         break;
     case HEVC_NAL_EOS_NUT:



More information about the ffmpeg-cvslog mailing list