You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Adding 32 bit alignment for simd into our AV_ALLOCATE_IMAGE macro, and some code cleanup
This commit is contained in:
@@ -1307,10 +1307,9 @@ bool FFmpegReader::GetAVFrame() {
|
||||
frameFinished = 1;
|
||||
packet_status.video_decoded++;
|
||||
|
||||
// align 32 for simd
|
||||
if (av_image_alloc(pFrame->data, pFrame->linesize, info.width,
|
||||
info.height, (AVPixelFormat)(pStream->codecpar->format), 32) <= 0) {
|
||||
throw OutOfMemory("Failed to allocate image buffer", path);
|
||||
// Allocate image (align 32 for simd)
|
||||
if (AV_ALLOCATE_IMAGE(pFrame, (AVPixelFormat)(pStream->codecpar->format), info.width, info.height) <= 0) {
|
||||
throw OutOfMemory("Failed to allocate image buffer", path);
|
||||
}
|
||||
av_image_copy(pFrame->data, pFrame->linesize, (const uint8_t**)next_frame->data, next_frame->linesize,
|
||||
(AVPixelFormat)(pStream->codecpar->format), info.width, info.height);
|
||||
|
||||
@@ -160,7 +160,7 @@ inline static bool ffmpeg_has_alpha(PixelFormat pix_fmt) {
|
||||
#define MY_INPUT_BUFFER_PADDING_SIZE AV_INPUT_BUFFER_PADDING_SIZE
|
||||
#define AV_ALLOCATE_FRAME() av_frame_alloc()
|
||||
#define AV_ALLOCATE_IMAGE(av_frame, pix_fmt, width, height) \
|
||||
av_image_alloc(av_frame->data, av_frame->linesize, width, height, pix_fmt, 1)
|
||||
av_image_alloc(av_frame->data, av_frame->linesize, width, height, pix_fmt, 32)
|
||||
#define AV_RESET_FRAME(av_frame) av_frame_unref(av_frame)
|
||||
#define AV_FREE_FRAME(av_frame) av_frame_free(av_frame)
|
||||
#define AV_FREE_PACKET(av_packet) av_packet_unref(av_packet)
|
||||
@@ -198,7 +198,7 @@ inline static bool ffmpeg_has_alpha(PixelFormat pix_fmt) {
|
||||
#define MY_INPUT_BUFFER_PADDING_SIZE FF_INPUT_BUFFER_PADDING_SIZE
|
||||
#define AV_ALLOCATE_FRAME() av_frame_alloc()
|
||||
#define AV_ALLOCATE_IMAGE(av_frame, pix_fmt, width, height) \
|
||||
av_image_alloc(av_frame->data, av_frame->linesize, width, height, pix_fmt, 1)
|
||||
av_image_alloc(av_frame->data, av_frame->linesize, width, height, pix_fmt, 32)
|
||||
#define AV_RESET_FRAME(av_frame) av_frame_unref(av_frame)
|
||||
#define AV_FREE_FRAME(av_frame) av_frame_free(av_frame)
|
||||
#define AV_FREE_PACKET(av_packet) av_packet_unref(av_packet)
|
||||
|
||||
Reference in New Issue
Block a user