summaryrefslogtreecommitdiff
path: root/ffmpeg/libavcodec/utvideoenc.c
diff options
context:
space:
mode:
Diffstat (limited to 'ffmpeg/libavcodec/utvideoenc.c')
-rw-r--r--ffmpeg/libavcodec/utvideoenc.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/ffmpeg/libavcodec/utvideoenc.c b/ffmpeg/libavcodec/utvideoenc.c
index acb25c3..e5a858d 100644
--- a/ffmpeg/libavcodec/utvideoenc.c
+++ b/ffmpeg/libavcodec/utvideoenc.c
@@ -24,6 +24,7 @@
* Ut Video encoder
*/
+#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "internal.h"
@@ -125,7 +126,7 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx)
return AVERROR_OPTION_NOT_FOUND;
}
- avctx->coded_frame = avcodec_alloc_frame();
+ avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame) {
av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
@@ -230,20 +231,6 @@ static void mangle_rgb_planes(uint8_t *dst[4], int dst_stride, uint8_t *src,
}
}
-/* Write data to a plane, no prediction applied */
-static void write_plane(uint8_t *src, uint8_t *dst, int stride,
- int width, int height)
-{
- int i, j;
-
- for (j = 0; j < height; j++) {
- for (i = 0; i < width; i++)
- *dst++ = src[i];
-
- src += stride;
- }
-}
-
/* Write data to a plane with left prediction */
static void left_predict(uint8_t *src, uint8_t *dst, int stride,
int width, int height)
@@ -383,8 +370,9 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
for (i = 0; i < c->slices; i++) {
sstart = send;
send = height * (i + 1) / c->slices;
- write_plane(src + sstart * stride, dst + sstart * width,
- stride, width, send - sstart);
+ av_image_copy_plane(dst + sstart * width, width,
+ src + sstart * stride, stride,
+ width, send - sstart);
}
break;
case PRED_LEFT:
@@ -525,8 +513,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
bytestream2_init_writer(&pb, dst, pkt->size);
- av_fast_malloc(&c->slice_bits, &c->slice_bits_size,
- width * height + FF_INPUT_BUFFER_PADDING_SIZE);
+ av_fast_padded_malloc(&c->slice_bits, &c->slice_bits_size, width * height);
if (!c->slice_bits) {
av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer 2.\n");
@@ -608,6 +595,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
AVCodec ff_utvideo_encoder = {
.name = "utvideo",
+ .long_name = NULL_IF_CONFIG_SMALL("Ut Video"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_UTVIDEO,
.priv_data_size = sizeof(UtvideoContext),
@@ -618,5 +606,4 @@ AVCodec ff_utvideo_encoder = {
AV_PIX_FMT_RGB24, AV_PIX_FMT_RGBA, AV_PIX_FMT_YUV422P,
AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE
},
- .long_name = NULL_IF_CONFIG_SMALL("Ut Video"),
};