summaryrefslogtreecommitdiffstats
path: root/recipes-multimedia/onevpl/files/0001-JPEGe-Enable-BGR4-JPEG-Enc-support-6470.patch
blob: e3854407c75f42c11808621998028b37220a1e21 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
From 40c0bc6d3dfe172dd25908df2c16de29c34fa4d4 Mon Sep 17 00:00:00 2001
From: gfxVPLsdm <gfxvplsdm@intel.com>
Date: Mon, 5 Feb 2024 17:14:07 +0800
Subject: [PATCH] [JPEGe] Enable BGR4 JPEG Enc support (#6470)

Co-authored-by: vcheah <vincent.beng.keat.cheah@intel.com>

Upstream-Status: Backport [https://github.com/oneapi-src/oneVPL-intel-gpu/commit/e73763d05f8fdc348c356b58dcb83075b5e868f8]
Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
---
 .../mfx_lib/encode_hw/mjpeg/src/mfx_mjpeg_encode_hw.cpp  | 6 ++++--
 .../encode_hw/mjpeg/src/mfx_mjpeg_encode_hw_utils.cpp    | 9 +++++----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/_studio/mfx_lib/encode_hw/mjpeg/src/mfx_mjpeg_encode_hw.cpp b/_studio/mfx_lib/encode_hw/mjpeg/src/mfx_mjpeg_encode_hw.cpp
index 141564b1..332f6372 100644
--- a/_studio/mfx_lib/encode_hw/mjpeg/src/mfx_mjpeg_encode_hw.cpp
+++ b/_studio/mfx_lib/encode_hw/mjpeg/src/mfx_mjpeg_encode_hw.cpp
@@ -212,7 +212,8 @@ mfxStatus MFXVideoENCODEMJPEG_HW::QueryImplsDescription(
     ah.PushBack(memCaps.ColorFormats) = MFX_FOURCC_YV12;
     ah.PushBack(memCaps.ColorFormats) = MFX_FOURCC_YUY2;
     ah.PushBack(memCaps.ColorFormats) = MFX_FOURCC_RGB4;
-    memCaps.NumColorFormats = 4;
+    ah.PushBack(memCaps.ColorFormats) = MFX_FOURCC_BGR4;
+    memCaps.NumColorFormats = 5;
 
     ah.PushBack(profileCaps.MemDesc);
     profileCaps.MemDesc[1] = profileCaps.MemDesc[0];
@@ -392,7 +393,7 @@ mfxStatus MFXVideoENCODEMJPEG_HW::Query(VideoCORE * core, mfxVideoParam *in, mfx
         if ((fourCC == 0 && chromaFormat == 0) ||
             (fourCC == MFX_FOURCC_NV12 && (chromaFormat == MFX_CHROMAFORMAT_YUV420 || chromaFormat == MFX_CHROMAFORMAT_YUV400)) ||
             (fourCC == MFX_FOURCC_YUY2 && chromaFormat == MFX_CHROMAFORMAT_YUV422H) ||
-            (fourCC == MFX_FOURCC_RGB4 && chromaFormat == MFX_CHROMAFORMAT_YUV444))
+            ((fourCC == MFX_FOURCC_RGB4 || fourCC == MFX_FOURCC_BGR4) && chromaFormat == MFX_CHROMAFORMAT_YUV444))
         {
             out->mfx.FrameInfo.FourCC = in->mfx.FrameInfo.FourCC;
             out->mfx.FrameInfo.ChromaFormat = in->mfx.FrameInfo.ChromaFormat;
@@ -698,6 +699,7 @@ mfxStatus MFXVideoENCODEMJPEG_HW::Init(mfxVideoParam *par)
             doubleBytesPerPx = 4;
             break;
         case MFX_FOURCC_RGB4:
+        case MFX_FOURCC_BGR4:
         default:
             doubleBytesPerPx = 8;
             break;
diff --git a/_studio/mfx_lib/encode_hw/mjpeg/src/mfx_mjpeg_encode_hw_utils.cpp b/_studio/mfx_lib/encode_hw/mjpeg/src/mfx_mjpeg_encode_hw_utils.cpp
index 3fc619d1..b1ab556e 100644
--- a/_studio/mfx_lib/encode_hw/mjpeg/src/mfx_mjpeg_encode_hw_utils.cpp
+++ b/_studio/mfx_lib/encode_hw/mjpeg/src/mfx_mjpeg_encode_hw_utils.cpp
@@ -108,6 +108,7 @@ mfxStatus MfxHwMJpegEncode::CheckJpegParam(VideoCORE *core, mfxVideoParam & par,
             BytesPerPx = 2;
             break;
         case MFX_FOURCC_RGB4:
+        case MFX_FOURCC_BGR4:
         default:
             BytesPerPx = 4;
     }
@@ -157,7 +158,7 @@ mfxStatus ExecuteBuffers::Init(mfxVideoParam const *par, mfxEncodeCtrl const * c
 
     m_payload_base.length = 0;
     m_payload_list.clear();
-    if (fourCC == MFX_FOURCC_RGB4 && chromaFormat == MFX_CHROMAFORMAT_YUV444)
+    if ((fourCC == MFX_FOURCC_RGB4 || fourCC == MFX_FOURCC_BGR4)  && chromaFormat == MFX_CHROMAFORMAT_YUV444)
     {
         m_app14_data.header    = 0xEEFF;//APP14
         m_app14_data.lenH      = 0;
@@ -287,7 +288,7 @@ mfxStatus ExecuteBuffers::Init(mfxVideoParam const *par, mfxEncodeCtrl const * c
         m_pps.num_components = 3;
     else if (fourCC == MFX_FOURCC_NV12 && chromaFormat == MFX_CHROMAFORMAT_YUV400)
         m_pps.num_components = 1;
-    else if (fourCC == MFX_FOURCC_RGB4 && chromaFormat == MFX_CHROMAFORMAT_YUV444)
+    else if ((fourCC == MFX_FOURCC_RGB4 || fourCC == MFX_FOURCC_BGR4) && chromaFormat == MFX_CHROMAFORMAT_YUV444)
         m_pps.num_components = 3;
     else
         MFX_RETURN(MFX_ERR_UNDEFINED_BEHAVIOR);
@@ -341,7 +342,7 @@ mfxStatus ExecuteBuffers::Init(mfxVideoParam const *par, mfxEncodeCtrl const * c
     {
         // No external tables - use Quality parameter
         m_dqt_list.resize(0);
-        if (fourCC == MFX_FOURCC_RGB4)
+        if (fourCC == MFX_FOURCC_RGB4 || fourCC == MFX_FOURCC_BGR4)
         {
             m_pps.quantiser_table_selector[0] = 0;
             m_pps.quantiser_table_selector[1] = 0;
@@ -393,7 +394,7 @@ mfxStatus ExecuteBuffers::Init(mfxVideoParam const *par, mfxEncodeCtrl const * c
         {
             m_dht_list.resize(0);
         }
-        else if (hwCaps->MaxNumHuffTable == 1 || fourCC == MFX_FOURCC_RGB4)
+        else if (hwCaps->MaxNumHuffTable == 1 || (fourCC == MFX_FOURCC_RGB4 || fourCC == MFX_FOURCC_BGR4))
         {
             m_dht_list.resize(1);
 
-- 
2.40.1