| 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 __VPHAL_RENDER_VEBOX_DENOISE_H__ |
| 28 |
#define __VPHAL_RENDER_VEBOX_DENOISE_H__ |
| 29 |
|
| 30 |
#include "renderhal_legacy.h" |
| 31 |
|
| 32 |
#if !EMUL |
| 33 |
#include "vphal_mdf_wrapper.h" |
| 34 |
|
| 35 |
|
| 36 |
class HVSDenoise : public VPCmRenderer |
| 37 |
{ |
| 38 |
public: |
| 39 |
struct HVSDenoisePayload |
| 40 |
{ |
| 41 |
VpCmSurfaceHolder<CmBuffer> *denoiseParam; |
| 42 |
uint16_t QP; |
| 43 |
uint16_t CodecID; |
| 44 |
uint16_t Strength; |
| 45 |
}; |
| 46 |
|
| 47 |
HVSDenoise(const PRENDERHAL_INTERFACE vphalRenderer, void *kernelBinary, int32_t kerneBinarySize, CmContext *cmContext); |
| 48 |
virtual ~HVSDenoise(); |
| 49 |
|
| 50 |
private: |
| 51 |
virtual void AttachPayload(void *payload); |
| 52 |
virtual CmKernel *GetKernelToRun(std::string &name); |
| 53 |
virtual void GetThreadSpaceDimension(int &tsWidth, int &tsHeight, int &tsColor); |
| 54 |
virtual void PrepareKernel(CmKernel *kernel); |
| 55 |
virtual void Dump(); |
| 56 |
|
| 57 |
CmProgram *m_cmProgram = nullptr; |
| 58 |
CmKernel *m_cmKernel = nullptr; |
| 59 |
|
| 60 |
HVSDenoisePayload *m_payload = nullptr; |
| 61 |
}; |
| 62 |
|
| 63 |
class VphalHVSDenoiser |
| 64 |
{ |
| 65 |
public: |
| 66 |
explicit VphalHVSDenoiser(const PRENDERHAL_INTERFACE vphalRenderer); |
| 67 |
VphalHVSDenoiser(const VphalHVSDenoiser &) = delete; |
| 68 |
VphalHVSDenoiser &operator=(const VphalHVSDenoiser &) = delete; |
| 69 |
virtual ~VphalHVSDenoiser(); |
| 70 |
|
| 71 |
|
| 72 |
void InitKernelParams(void *kernelBinary, const int32_t kerneBinarySize); |
| 73 |
MOS_STATUS Render(const PVPHAL_SURFACE pSrcSuface); |
| 74 |
uint8_t* GetDenoiseParams() |
| 75 |
{ |
| 76 |
return m_hvsDenoiseParam; |
| 77 |
} |
| 78 |
|
| 79 |
private: |
| 80 |
void AllocateResources(const uint32_t width, const uint32_t height); |
| 81 |
void FreeResources(); |
| 82 |
|
| 83 |
EventManager* m_eventManager = nullptr; |
| 84 |
PRENDERHAL_INTERFACE m_renderHal = nullptr; |
| 85 |
VpCmSurfaceHolder<CmBuffer> *m_hvsDenoiseCmSurface = nullptr; |
| 86 |
|
| 87 |
uint8_t * m_hvsDenoiseParam = nullptr; |
| 88 |
HVSDenoise * m_hvsDenoise = nullptr; |
| 89 |
CmContext * m_cmContext = nullptr; |
| 90 |
|
| 91 |
uint16_t m_savedQP = 0; |
| 92 |
uint16_t m_savedStrength = 0; |
| 93 |
bool m_initHVSDenoise = false; |
| 94 |
|
| 95 |
|
| 96 |
const uint32_t m_denoiseBufferInBytes = 64; |
| 97 |
void *m_kernelBinary = nullptr; |
| 98 |
int32_t m_kernelBinarySize = 0; |
| 99 |
}; |
| 100 |
#else |
| 101 |
#include "vphal_common.h" |
| 102 |
|
| 103 |
class VphalHVSDenoiser |
| 104 |
{ |
| 105 |
public: |
| 106 |
explicit VphalHVSDenoiser(PRENDERHAL_INTERFACE vphalRenderer) |
| 107 |
{ |
| 108 |
MOS_UNUSED(vphalRenderer); |
| 109 |
}; |
| 110 |
VphalHVSDenoiser(const VphalHVSDenoiser &) = delete; |
| 111 |
VphalHVSDenoiser &operator=(const VphalHVSDenoiser &) = delete; |
| 112 |
virtual ~VphalHVSDenoiser() |
| 113 |
{ |
| 114 |
}; |
| 115 |
|
| 116 |
|
| 117 |
void InitKernelParams(void *kernelBinary, const int32_t kerneBinarySize) |
| 118 |
{ |
| 119 |
MOS_UNUSED(kernelBinary); |
| 120 |
MOS_UNUSED(kerneBinarySize); |
| 121 |
}; |
| 122 |
|
| 123 |
MOS_STATUS Render(const PVPHAL_SURFACE pSrcSuface) |
| 124 |
{ |
| 125 |
return MOS_STATUS_UNIMPLEMENTED; |
| 126 |
}; |
| 127 |
|
| 128 |
uint8_t *GetDenoiseParams() |
| 129 |
{ |
| 130 |
return nullptr; |
| 131 |
} |
| 132 |
}; |
| 133 |
#endif |
| 134 |
#endif |