You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
libkvazaar: Use av_image_copy for copying pixels
Replaces a for loop for copying pixels by a call to av_image_copy. Signed-off-by: Arttu Ylä-Outinen <arttu.yla-outinen@tut.fi>
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "libavutil/avassert.h"
|
#include "libavutil/avassert.h"
|
||||||
|
#include "libavutil/imgutils.h"
|
||||||
#include "libavutil/dict.h"
|
#include "libavutil/dict.h"
|
||||||
#include "libavutil/opt.h"
|
#include "libavutil/opt.h"
|
||||||
#include "libavutil/pixdesc.h"
|
#include "libavutil/pixdesc.h"
|
||||||
@@ -149,8 +150,6 @@ static int libkvazaar_encode(AVCodecContext *avctx,
|
|||||||
*got_packet_ptr = 0;
|
*got_packet_ptr = 0;
|
||||||
|
|
||||||
if (frame) {
|
if (frame) {
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
if (frame->width != ctx->config->width ||
|
if (frame->width != ctx->config->width ||
|
||||||
frame->height != ctx->config->height) {
|
frame->height != ctx->config->height) {
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
@@ -181,17 +180,16 @@ static int libkvazaar_encode(AVCodecContext *avctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Copy pixels from frame to img_in.
|
// Copy pixels from frame to img_in.
|
||||||
for (i = 0; i < 3; ++i) {
|
{
|
||||||
uint8_t *dst = img_in->data[i];
|
int dst_linesizes[4] = {
|
||||||
uint8_t *src = frame->data[i];
|
frame->width,
|
||||||
int width = (i == 0) ? frame->width : (frame->width / 2);
|
frame->width / 2,
|
||||||
int height = (i == 0) ? frame->height : (frame->height / 2);
|
frame->width / 2,
|
||||||
int y = 0;
|
0
|
||||||
for (y = 0; y < height; ++y) {
|
};
|
||||||
memcpy(dst, src, width);
|
av_image_copy(img_in->data, dst_linesizes,
|
||||||
src += frame->linesize[i];
|
frame->data, frame->linesize,
|
||||||
dst += width;
|
frame->format, frame->width, frame->height);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
img_in->pts = frame->pts;
|
img_in->pts = frame->pts;
|
||||||
|
Reference in New Issue
Block a user