Skip to content

Commit

Permalink
Enable video post processing after hw decoding
Browse files Browse the repository at this point in the history
This change is to enable video post processing after
hw decoding. The final output is 2X scaling of input.

Tracked-On:
Signed-off-by: Chen, Tianmi <[email protected]>
  • Loading branch information
TianmiChen committed Sep 24, 2021
1 parent 641c747 commit 4d97849
Show file tree
Hide file tree
Showing 6 changed files with 568 additions and 3 deletions.
3 changes: 3 additions & 0 deletions mfx_omx_defs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ ifneq ($(filter $(MFX_ANDROID_VERSION), MFX_Q MFX_R),)
MFX_OMX_CFLAGS += -DENABLE_READ_SEI
endif

# Enable vpp for decoder
MFX_OMX_CFLAGS += -DENABLE_DECVPP

# Setting usual paths to include files
MFX_OMX_INCLUDES := $(LOCAL_PATH)/include

Expand Down
31 changes: 31 additions & 0 deletions omx_components/include/mfx_omx_vdec_component.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ enum MfxInitState {
MFX_INIT_COMPLETED
};

#ifdef OMX_ENABLE_DECVPP
#define DECODE_MAX_SRF_NUM 24
#define VPP_MAX_SRF_NUM 10
#define FIXED_VPP_OUTPUT
#define SCALED_WIDTH 1920
#define SCALED_HEIGHT 1080

// round up to a multiple of 16
#define MSDK_ALIGN16(value) (((value + 15) >> 4) << 4)
#endif

/*------------------------------------------------------------------------------*/

class MfxOmxVdecComponent : public MfxOmxComponent,
Expand Down Expand Up @@ -161,6 +172,14 @@ class MfxOmxVdecComponent : public MfxOmxComponent,
void UpdateHdrStaticInfo();
#endif

#ifdef OMX_ENABLE_DECVPP
mfxStatus InitVPP(void);
mfxStatus AllocateInternalSurfaces(void);
mfxStatus FreeInternalSurfaces(void);
mfxStatus FindOneAvailableSurface(mfxU32 &id);
mfxStatus ProcessFrameVpp(mfxFrameSurface1 *in_srf, mfxFrameSurface1 *out_srf);
#endif

protected:
mfxIMPL m_Implementation;
MFXVideoSession m_Session;
Expand Down Expand Up @@ -189,6 +208,18 @@ class MfxOmxVdecComponent : public MfxOmxComponent,
bool m_bEnableNativeBuffersReceived;
bool m_bInterlaced;

#ifdef OMX_ENABLE_DECVPP
MFXVideoVPP *m_pVPP;
bool m_bInitVPP;
bool m_bVPPDetermined;
bool m_bEnableScale;
mfxU32 m_nScaledWidth;
mfxU32 m_nScaledHeight;
mfxVideoParam m_vppParam;
mfxFrameSurface1 m_DecInterSrf[DECODE_MAX_SRF_NUM];
mfxFrameAllocResponse m_DecResponses;
#endif

MfxInitState m_InitState;
MfxOmxDev* m_pDevice;
OMX_BUFFERHEADERTYPE** m_pBufferHeaders;
Expand Down
Loading

0 comments on commit 4d97849

Please sign in to comment.