Skip to content

Commit

Permalink
h264: Use async decoding if possible
Browse files Browse the repository at this point in the history
This allows us to hide the latency of the software decoder when operating in buffered mode which should help games that are picky about slow decoding times
  • Loading branch information
Exzap committed Jul 15, 2024
1 parent 9d36693 commit 5220c14
Show file tree
Hide file tree
Showing 8 changed files with 782 additions and 640 deletions.
2 changes: 2 additions & 0 deletions src/Cafe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,9 @@ add_library(CemuCafe
OS/libs/gx2/GX2_Texture.h
OS/libs/gx2/GX2_TilingAperture.cpp
OS/libs/h264_avc/H264Dec.cpp
OS/libs/h264_avc/H264DecBackendAVC.cpp
OS/libs/h264_avc/h264dec.h
OS/libs/h264_avc/H264DecInternal.h
OS/libs/h264_avc/parser
OS/libs/h264_avc/parser/H264Parser.cpp
OS/libs/h264_avc/parser/H264Parser.h
Expand Down
12 changes: 5 additions & 7 deletions src/Cafe/OS/libs/coreinit/coreinit_SysHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@ namespace coreinit
return coreinit::MEMAllocFromExpHeapEx(_sysHeapHandle, size, alignment);
}

void export_OSAllocFromSystem(PPCInterpreter_t* hCPU)
void OSFreeToSystem(void* ptr)
{
ppcDefineParamU32(size, 0);
ppcDefineParamS32(alignment, 1);
MEMPTR<void> mem = OSAllocFromSystem(size, alignment);
cemuLog_logDebug(LogType::Force, "OSAllocFromSystem(0x{:x}, {}) -> 0x{:08x}", size, alignment, mem.GetMPTR());
osLib_returnFromFunction(hCPU, mem.GetMPTR());
_sysHeapFreeCounter++;
coreinit::MEMFreeToExpHeap(_sysHeapHandle, ptr);
}

void InitSysHeap()
Expand All @@ -34,7 +31,8 @@ namespace coreinit

void InitializeSysHeap()
{
osLib_addFunction("coreinit", "OSAllocFromSystem", export_OSAllocFromSystem);
cafeExportRegister("h264", OSAllocFromSystem, LogType::CoreinitMem);
cafeExportRegister("h264", OSFreeToSystem, LogType::CoreinitMem);
}

}
3 changes: 3 additions & 0 deletions src/Cafe/OS/libs/coreinit/coreinit_SysHeap.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ namespace coreinit
{
void InitSysHeap();

void* OSAllocFromSystem(uint32 size, uint32 alignment);
void OSFreeToSystem(void* ptr);

void InitializeSysHeap();
}
Loading

0 comments on commit 5220c14

Please sign in to comment.