Commit b8e899f4 authored by Martin Storsjö's avatar Martin Storsjö

mmaldec: Use imgutils.h for copying frames

Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
parent 798845ce
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "libavutil/avassert.h" #include "libavutil/avassert.h"
#include "libavutil/buffer.h" #include "libavutil/buffer.h"
#include "libavutil/common.h" #include "libavutil/common.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h" #include "libavutil/opt.h"
#include "libavutil/log.h" #include "libavutil/log.h"
...@@ -589,24 +590,17 @@ static int ffmal_copy_frame(AVCodecContext *avctx, AVFrame *frame, ...@@ -589,24 +590,17 @@ static int ffmal_copy_frame(AVCodecContext *avctx, AVFrame *frame,
} else { } else {
int w = FFALIGN(avctx->width, 32); int w = FFALIGN(avctx->width, 32);
int h = FFALIGN(avctx->height, 16); int h = FFALIGN(avctx->height, 16);
char *ptr; uint8_t *src[4];
int plane; int linesize[4];
int i;
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
goto done; goto done;
ptr = buffer->data + buffer->type->video.offset[0]; av_image_fill_arrays(src, linesize,
for (i = 0; i < avctx->height; i++) buffer->data + buffer->type->video.offset[0],
memcpy(frame->data[0] + frame->linesize[0] * i, ptr + w * i, avctx->width); avctx->pix_fmt, w, h, 1);
av_image_copy(frame->data, frame->linesize, src, linesize,
ptr += w * h; avctx->pix_fmt, avctx->width, avctx->height);
for (plane = 1; plane < 3; plane++) {
for (i = 0; i < avctx->height / 2; i++)
memcpy(frame->data[plane] + frame->linesize[plane] * i, ptr + w / 2 * i, (avctx->width + 1) / 2);
ptr += w / 2 * h / 2;
}
} }
frame->pkt_pts = buffer->pts == MMAL_TIME_UNKNOWN ? AV_NOPTS_VALUE : buffer->pts; frame->pkt_pts = buffer->pts == MMAL_TIME_UNKNOWN ? AV_NOPTS_VALUE : buffer->pts;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment