summaryrefslogtreecommitdiffstats
path: root/recipes-multimedia/onevpl/onevpl-intel-gpu/0001-Fixed-performance-dependency-on-stream-GOP-pattern-i.patch
blob: 4bf05be67627ff193c4cebcf617080dab0334250 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
From 83d8c41165fa94ecf8007210e2aa4775bf63973c Mon Sep 17 00:00:00 2001
From: gfxVPLsdm <gfxvplsdm@intel.com>
Date: Fri, 26 Aug 2022 10:47:29 +0800
Subject: [PATCH] Fixed performance dependency on stream GOP pattern in HEVC
 decoder (#3417)

Upstream-Status: Backport [https://github.com/oneapi-src/oneVPL-intel-gpu/commit/0987b903bada0d4e41d752a423bc4d0d3b1b37bb]

Co-authored-by: Sergey Plotnikov <sergey.plotnikov@intel.com>
---
 .../codec/h265_dec/include/umc_h265_task_supplier.h |  1 +
 .../codec/h265_dec/src/umc_h265_task_supplier.cpp   | 13 +++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/_studio/shared/umc/codec/h265_dec/include/umc_h265_task_supplier.h b/_studio/shared/umc/codec/h265_dec/include/umc_h265_task_supplier.h
index 824ca949..8bd51d1a 100644
--- a/_studio/shared/umc/codec/h265_dec/include/umc_h265_task_supplier.h
+++ b/_studio/shared/umc/codec/h265_dec/include/umc_h265_task_supplier.h
@@ -260,6 +260,7 @@ public:
 
     // Update DPB contents marking frames for reuse
     UMC::Status UpdateRefPicMarking(ViewItem_H265 &view, const H265Slice * pSlice);
+    void ResetUnusedFrames(ViewItem_H265 &view);
 
     void Reset();
 
diff --git a/_studio/shared/umc/codec/h265_dec/src/umc_h265_task_supplier.cpp b/_studio/shared/umc/codec/h265_dec/src/umc_h265_task_supplier.cpp
index f28b86b2..e1c25085 100755
--- a/_studio/shared/umc/codec/h265_dec/src/umc_h265_task_supplier.cpp
+++ b/_studio/shared/umc/codec/h265_dec/src/umc_h265_task_supplier.cpp
@@ -204,6 +204,18 @@ UMC::Status DecReferencePictureMarking_H265::UpdateRefPicMarking(ViewItem_H265 &
     return umcRes;
 }
 
+void DecReferencePictureMarking_H265::ResetUnusedFrames(ViewItem_H265 &view)
+{
+    for (H265DecoderFrame *pTmp = view.pDPB->head(); pTmp; pTmp = pTmp->future())
+    {
+        if(!pTmp->isShortTermRef() && !pTmp->isLongTermRef() && pTmp->GetRefCounter() == 0 && 
+            pTmp->m_wasOutputted && pTmp->m_wasDisplayed && pTmp->m_isDisplayable)
+        {
+            pTmp->Reset();
+        }
+    }
+}
+
 // Check if bitstream resolution has changed
 static
 bool IsNeedSPSInvalidate(const H265SeqParamSet *old_sps, const H265SeqParamSet *new_sps)
@@ -2585,6 +2597,7 @@ void TaskSupplier_H265::DPBUpdate(const H265Slice * slice)
 {
     ViewItem_H265 &view = *GetView();
     DecReferencePictureMarking_H265::UpdateRefPicMarking(view, slice);
+    DecReferencePictureMarking_H265::ResetUnusedFrames(view);
 }
 
 // Find a decoder frame instance with specified surface ID
-- 
2.37.2