| 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 |
#ifndef __CodechalEncodeCscDsMdfG12__ |
| 28 |
#define __CodechalEncodeCscDsMdfG12__ |
| 29 |
#include "codechal_encode_csc_ds_g12.h" |
| 30 |
#include "codechal_kernel_header_g12.h" |
| 31 |
|
| 32 |
#include "cm_surface_2d_wrapper.h" |
| 33 |
|
| 34 |
struct SurfaceParamsCscMdf |
| 35 |
{ |
| 36 |
CmSurface2DWrapper *psInputSurface = nullptr; |
| 37 |
CmSurface2DWrapper *psOutput4xDsSurface = nullptr; |
| 38 |
CmSurface2DWrapper *psOutput2xDsSurface = nullptr; |
| 39 |
CmSurface2DWrapper *psOutputCopiedSurface = nullptr; |
| 40 |
CmBuffer *presMBVProcStatsBuffer = nullptr; |
| 41 |
CmBuffer *presHistoryBuffer = nullptr; |
| 42 |
SurfaceIndex *pHistBufSurfIdx = nullptr; |
| 43 |
CmBuffer *presHistorySumBuffer = nullptr; |
| 44 |
SurfaceIndex *pHistSumBufSurfIdx = nullptr; |
| 45 |
CmBuffer *presMultiThreadTaskBuffer = nullptr; |
| 46 |
SurfaceIndex *pMTTaskSumBufSurfIdx = nullptr; |
| 47 |
}; |
| 48 |
|
| 49 |
class CodechalEncodeCscDsMdfG12 : public CodechalEncodeCscDsG12 |
| 50 |
{ |
| 51 |
|
| 52 |
protected: |
| 53 |
|
| 54 |
CmThreadSpace *m_threadSpace4x = nullptr; |
| 55 |
CmThreadSpace *m_threadSpace16x = nullptr; |
| 56 |
CmThreadSpace *m_threadSpace32x = nullptr; |
| 57 |
CmKernel *m_cmKrnCSCDS4x = nullptr; |
| 58 |
CmKernel *m_cmKrnCSCDS16x = nullptr; |
| 59 |
CmKernel *m_cmKrnCSCDS32x = nullptr; |
| 60 |
CmProgram *m_cmProgramCSCDS = nullptr; |
| 61 |
|
| 62 |
SurfaceParamsCscMdf m_cmSurfParamsCscDs4x; |
| 63 |
SurfaceParamsCscMdf m_cmSurfParamsCscDs16x; |
| 64 |
SurfaceParamsCscMdf m_cmSurfParamsCscDs32x; |
| 65 |
|
| 66 |
|
| 67 |
struct CscKernelCurbeData |
| 68 |
{ |
| 69 |
|
| 70 |
CscKernelCurbeData() |
| 71 |
{ |
| 72 |
MOS_ZeroMemory(this, sizeof(*this)); |
| 73 |
} |
| 74 |
union |
| 75 |
{ |
| 76 |
struct |
| 77 |
{ |
| 78 |
|
| 79 |
uint32_t DW0_Reserved_0 : MOS_BITFIELD_RANGE(0, 7); |
| 80 |
uint32_t DW0_Reserved_1 : MOS_BITFIELD_RANGE(8, 15); |
| 81 |
uint32_t DW0_OutputBitDepthForChroma : MOS_BITFIELD_RANGE(16, 23); |
| 82 |
uint32_t DW0_OutputBitDepthForLuma : MOS_BITFIELD_RANGE(24, 30); |
| 83 |
uint32_t DW0_RoundingEnable : MOS_BITFIELD_BIT(31); |
| 84 |
}; |
| 85 |
uint32_t DW0; |
| 86 |
}; |
| 87 |
|
| 88 |
union |
| 89 |
{ |
| 90 |
struct |
| 91 |
{ |
| 92 |
|
| 93 |
uint32_t DW1_PictureFormat : MOS_BITFIELD_RANGE(0, 7); |
| 94 |
uint32_t DW1_ConvertFlag : MOS_BITFIELD_BIT(8); |
| 95 |
uint32_t DW1_DownscaleStage : MOS_BITFIELD_RANGE(9, 11); |
| 96 |
uint32_t DW1_MbStatisticsDumpFlag : MOS_BITFIELD_BIT(12); |
| 97 |
uint32_t DW1_YUY2ConversionFlag : MOS_BITFIELD_BIT(13); |
| 98 |
uint32_t DW1_HevcEncHistorySum : MOS_BITFIELD_BIT(14); |
| 99 |
uint32_t DW1_LCUSize : MOS_BITFIELD_BIT(15); |
| 100 |
uint32_t DW1_ChromaSitingLocation : MOS_BITFIELD_RANGE(16, 23); |
| 101 |
uint32_t DW1_Reserved_0 : MOS_BITFIELD_RANGE(24, 31); |
| 102 |
}; |
| 103 |
uint32_t DW1; |
| 104 |
}; |
| 105 |
|
| 106 |
union |
| 107 |
{ |
| 108 |
struct |
| 109 |
{ |
| 110 |
|
| 111 |
uint32_t DW2_OriginalPicWidthInSamples : MOS_BITFIELD_RANGE(0, 15); |
| 112 |
uint32_t DW2_OriginalPicHeightInSamples : MOS_BITFIELD_RANGE(16, 31); |
| 113 |
}; |
| 114 |
uint32_t DW2; |
| 115 |
}; |
| 116 |
|
| 117 |
|
| 118 |
uint32_t DW3_MBFlatnessThreshold = 0; |
| 119 |
|
| 120 |
|
| 121 |
union |
| 122 |
{ |
| 123 |
struct |
| 124 |
{ |
| 125 |
uint32_t DW4_CSC_Coefficient_C0 : MOS_BITFIELD_RANGE(0, 15); |
| 126 |
uint32_t DW4_CSC_Coefficient_C1 : MOS_BITFIELD_RANGE(16, 31); |
| 127 |
}; |
| 128 |
uint32_t DW4; |
| 129 |
}; |
| 130 |
|
| 131 |
|
| 132 |
union |
| 133 |
{ |
| 134 |
struct |
| 135 |
{ |
| 136 |
uint32_t DW5_CSC_Coefficient_C2 : MOS_BITFIELD_RANGE(0, 15); |
| 137 |
uint32_t DW5_CSC_Coefficient_C3 : MOS_BITFIELD_RANGE(16, 31); |
| 138 |
}; |
| 139 |
uint32_t DW5; |
| 140 |
}; |
| 141 |
|
| 142 |
|
| 143 |
union |
| 144 |
{ |
| 145 |
struct |
| 146 |
{ |
| 147 |
uint32_t DW6_CSC_Coefficient_C4 : MOS_BITFIELD_RANGE(0, 15); |
| 148 |
uint32_t DW6_CSC_Coefficient_C5 : MOS_BITFIELD_RANGE(16, 31); |
| 149 |
}; |
| 150 |
uint32_t DW6; |
| 151 |
}; |
| 152 |
|
| 153 |
|
| 154 |
union |
| 155 |
{ |
| 156 |
struct |
| 157 |
{ |
| 158 |
uint32_t DW7_CSC_Coefficient_C6 : MOS_BITFIELD_RANGE(0, 15); |
| 159 |
uint32_t DW7_CSC_Coefficient_C7 : MOS_BITFIELD_RANGE(16, 31); |
| 160 |
}; |
| 161 |
uint32_t DW7; |
| 162 |
}; |
| 163 |
|
| 164 |
|
| 165 |
union |
| 166 |
{ |
| 167 |
struct |
| 168 |
{ |
| 169 |
uint32_t DW8_CSC_Coefficient_C8 : MOS_BITFIELD_RANGE(0, 15); |
| 170 |
uint32_t DW8_CSC_Coefficient_C9 : MOS_BITFIELD_RANGE(16, 31); |
| 171 |
}; |
| 172 |
uint32_t DW8; |
| 173 |
}; |
| 174 |
|
| 175 |
|
| 176 |
union |
| 177 |
{ |
| 178 |
struct |
| 179 |
{ |
| 180 |
uint32_t DW9_CSC_Coefficient_C10 : MOS_BITFIELD_RANGE(0, 15); |
| 181 |
uint32_t DW9_CSC_Coefficient_C11 : MOS_BITFIELD_RANGE(16, 31); |
| 182 |
}; |
| 183 |
uint32_t DW9; |
| 184 |
}; |
| 185 |
}; |
| 186 |
C_ASSERT(MOS_BYTES_TO_DWORDS(sizeof(CscKernelCurbeData)) == 10); |
| 187 |
|
| 188 |
public: |
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
CodechalEncodeCscDsMdfG12(CodechalEncoderState* encoder); |
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
virtual ~CodechalEncodeCscDsMdfG12(); |
| 199 |
|
| 200 |
|
| 201 |
protected: |
| 202 |
|
| 203 |
MOS_STATUS CscKernel( |
| 204 |
KernelParams* pParams) override; |
| 205 |
using CodechalEncodeCscDsG12::InitKernelStateCsc; |
| 206 |
MOS_STATUS InitKernelStateCsc(KernelParams* pParams); |
| 207 |
MOS_STATUS SetupKernelArgsCSC(CmKernel *cmKrnCSCDS, SurfaceParamsCscMdf* surfaceparams); |
| 208 |
MOS_STATUS SetCurbeCscforMDF(CMRT_UMD::vector<uint32_t, 10> & curbeData); |
| 209 |
MOS_STATUS SetupSurfacesCSC(SurfaceParamsCscMdf& SurfaceParamsCsc); |
| 210 |
MOS_STATUS DestroySurfaces(SurfaceParamsCscMdf& surfaceparams); |
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
MOS_STATUS ReleaseResources(); |
| 215 |
|
| 216 |
}; |
| 217 |
|
| 218 |
#endif |