Skip to content

Commit

Permalink
added crop offset info
Browse files Browse the repository at this point in the history
  • Loading branch information
georgemoralis committed Nov 8, 2024
1 parent 48378d6 commit 5739e12
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/libraries/videodec/videodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions src/core/libraries/videodec/videodec_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5739e12

Please sign in to comment.