[FFmpeg-devel] [PATCH] lavc/vc1dec: add multi-slice decoding support for hwaccel.

Jun Zhao mypopydev at gmail.com
Fri Nov 11 10:09:25 EET 2016


From 95eebc4d94a2f2db9f03e569b660d94ae083d26c Mon Sep 17 00:00:00 2001
From: Jun Zhao <jun.zhao at intel.com>
Date: Fri, 11 Nov 2016 16:05:57 +0800
Subject: [PATCH] lavc/vc1dec: add multi-slice decoding support for hwaccel.

add multi-slice decoding support for hwaccel, now only test with
vaapi as backend.

Reviewed-by: Jun Zhao <jun.zhao at intel.com>
Signed-off-by: Wang, Yi A <yi.a.wang at intel.com>
---
 libavcodec/vc1dec.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 4f78aa8..1c8f03c 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -953,8 +953,24 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
             s->picture_structure = PICT_FRAME;
             if ((ret = avctx->hwaccel->start_frame(avctx, buf_start, (buf + buf_size) - buf_start)) < 0)
                 goto err;
-            if ((ret = avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start)) < 0)
-                goto err;
+            if (n_slices == 0) {
+                if ((ret = avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start)) < 0)
+                    goto err;
+            } else {
+                int i;
+                ret = avctx->hwaccel->decode_slice(avctx, s->gb.buffer, s->gb.buffer_end - s->gb.buffer);
+                if (ret < 0)
+                    goto err;
+                for (i = 0 ; i < n_slices; i++) {
+                     s->gb = slices[i].gb;
+                     s->mb_y = slices[i].mby_start;
+                     if (get_bits(&s->gb, 1))
+                         ff_vc1_parse_frame_header_adv(v, &s->gb);
+                     ret = avctx->hwaccel->decode_slice(avctx, s->gb.buffer, s->gb.buffer_end - s->gb.buffer);
+                     if (ret < 0)
+                         goto err;
+                }
+            }
             if ((ret = avctx->hwaccel->end_frame(avctx)) < 0)
                 goto err;
         }
-- 
1.8.3.1



More information about the ffmpeg-devel mailing list