From 5739e126d01870ac59f3d14de8c930555aba14d5 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Fri, 8 Nov 2024 09:34:40 +0200 Subject: [PATCH] added crop offset info --- src/core/libraries/videodec/videodec.cpp | 4 ++++ src/core/libraries/videodec/videodec_impl.cpp | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/core/libraries/videodec/videodec.cpp b/src/core/libraries/videodec/videodec.cpp index d0f4b0d15f..96ece3c5c3 100644 --- a/src/core/libraries/videodec/videodec.cpp +++ b/src/core/libraries/videodec/videodec.cpp @@ -44,6 +44,7 @@ int PS4_SYSV_ABI sceVideodecDecode(OrbisVideodecCtrl* pCtrlIn, pFrameBufferInOut->thisSize != sizeof(OrbisVideodecFrameBuffer)) { return ORBIS_VIDEODEC_ERROR_STRUCT_SIZE; } + VdecDecoder* decoder = (VdecDecoder*)pCtrlIn->handle; if (!decoder) { return ORBIS_VIDEODEC_ERROR_HANDLE; @@ -53,6 +54,7 @@ int PS4_SYSV_ABI sceVideodecDecode(OrbisVideodecCtrl* pCtrlIn, int PS4_SYSV_ABI sceVideodecDeleteDecoder(OrbisVideodecCtrl* pCtrlIn) { LOG_INFO(Lib_Videodec, "(STUBBED) called"); + VdecDecoder* decoder = (VdecDecoder*)pCtrlIn->handle; if (!decoder) { return ORBIS_VIDEODEC_ERROR_HANDLE; @@ -73,6 +75,7 @@ int PS4_SYSV_ABI sceVideodecFlush(OrbisVideodecCtrl* pCtrlIn, pPictureInfoOut->thisSize != sizeof(OrbisVideodecPictureInfo)) { return ORBIS_VIDEODEC_ERROR_STRUCT_SIZE; } + VdecDecoder* decoder = (VdecDecoder*)pCtrlIn->handle; if (!decoder) { return ORBIS_VIDEODEC_ERROR_HANDLE; @@ -112,6 +115,7 @@ int PS4_SYSV_ABI sceVideodecQueryResourceInfo(const OrbisVideodecConfigInfo* pCf int PS4_SYSV_ABI sceVideodecReset(OrbisVideodecCtrl* pCtrlIn) { LOG_INFO(Lib_Videodec, "(STUBBED) called"); + VdecDecoder* decoder = (VdecDecoder*)pCtrlIn->handle; decoder->Reset(); return ORBIS_OK; diff --git a/src/core/libraries/videodec/videodec_impl.cpp b/src/core/libraries/videodec/videodec_impl.cpp index b9676d25be..559cf3b0a1 100644 --- a/src/core/libraries/videodec/videodec_impl.cpp +++ b/src/core/libraries/videodec/videodec_impl.cpp @@ -156,6 +156,16 @@ s32 VdecDecoder::Flush(OrbisVideodecFrameBuffer& pFrameBufferInOut, pPictureInfoOut.isValid = true; pPictureInfoOut.isErrorPic = false; + + u32 width = Common::AlignUp((u32)frame->width, 16); + u32 height = Common::AlignUp((u32)frame->height, 16); + pPictureInfoOut.codec.avc.frameCropLeftOffset = u32(frame->crop_left); + pPictureInfoOut.codec.avc.frameCropRightOffset = + u32(frame->crop_right + (width - frame->width)); + pPictureInfoOut.codec.avc.frameCropTopOffset = u32(frame->crop_top); + pPictureInfoOut.codec.avc.frameCropBottomOffset = + u32(frame->crop_bottom + (height - frame->height)); + // TODO maybe more avc? } av_frame_free(&frame);