feature/optimise-memory-management-decoder #202
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Pull Request: feature/optimise-memory-management-decoder
Motivation and Improvement
This pull request aims to optimize memory management within the H264/H265 video decoder, enhancing performance and reliability. The changes are driven by the need to improve decoding speed and ensure better handling of memory in the Go code interfacing with C libraries.
Key Changes
Include Additional Libraries:
stdlib.h
andstring.h
for memory management functions.libavutil/hwcontext.h
to support hardware acceleration contexts.Optimize Decoder for Speed:
Memory Management Improvements:
C.CBytes
) and deallocation (C.free
) withruntime.Pinner
to pin memory during CGO calls. This prevents garbage collection from moving memory during the operation, improving stability and preventing potential memory errors.Code Cleanup and Refactoring:
fromCPtr
function and replaced its usage with theunsafe.Slice
function for better readability and performance.Benefits to the Project
Overall, these changes contribute to a more robust and efficient video decoding process, aligning with the project's goals of delivering high-performance and reliable software.