avccodec/utvideoenc: support encoding ULY4 and ULH4

Signed-off-by: Paul B Mahol <onemda@gmail.com>
pull/270/head
Paul B Mahol 8 years ago
parent 28b920c09b
commit 3c55baf08f
  1. 1
      libavcodec/utvideo.h
  2. 21
      libavcodec/utvideoenc.c

@ -56,6 +56,7 @@ enum {
UTVIDEO_RGBA = MKTAG(0x00, 0x00, 0x02, 0x18),
UTVIDEO_420 = MKTAG('Y', 'V', '1', '2'),
UTVIDEO_422 = MKTAG('Y', 'U', 'Y', '2'),
UTVIDEO_444 = MKTAG('Y', 'V', '2', '4'),
};
/* Mapping of libavcodec prediction modes to Ut Video's */

@ -104,6 +104,14 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx)
avctx->codec_tag = MKTAG('U', 'L', 'Y', '2');
original_format = UTVIDEO_422;
break;
case AV_PIX_FMT_YUV444P:
c->planes = 3;
if (avctx->colorspace == AVCOL_SPC_BT709)
avctx->codec_tag = MKTAG('U', 'L', 'H', '4');
else
avctx->codec_tag = MKTAG('U', 'L', 'Y', '4');
original_format = UTVIDEO_444;
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unknown pixel format: %d\n",
avctx->pix_fmt);
@ -579,6 +587,17 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
}
}
break;
case AV_PIX_FMT_YUV444P:
for (i = 0; i < c->planes; i++) {
ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0],
pic->linesize[i], i, width, height, &pb);
if (ret) {
av_log(avctx, AV_LOG_ERROR, "Error encoding plane %d.\n", i);
return ret;
}
}
break;
case AV_PIX_FMT_YUV422P:
for (i = 0; i < c->planes; i++) {
ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0],
@ -668,6 +687,6 @@ AVCodec ff_utvideo_encoder = {
.capabilities = AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_INTRA_ONLY,
.pix_fmts = (const enum AVPixelFormat[]) {
AV_PIX_FMT_RGB24, AV_PIX_FMT_RGBA, AV_PIX_FMT_YUV422P,
AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_NONE
},
};

Loading…
Cancel
Save