diff options
author | James Almer <jamrial@gmail.com> | 2019-05-21 14:57:39 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2019-05-27 13:21:52 -0300 |
commit | f78172b29ae7422237a4843da119f099a03cd55a (patch) | |
tree | 929733664b6e1ec0f2e9bbddf740fb80b87e23ac | |
parent | 7458fa119c907bc43dd10e2ecdaaad1483e5920d (diff) | |
download | ffmpeg-f78172b29ae7422237a4843da119f099a03cd55a.tar.gz |
avcodec/libdav1d: add support for RGB streams
Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r-- | libavcodec/libdav1d.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c index a009870a61..12c63245f8 100644 --- a/libavcodec/libdav1d.c +++ b/libavcodec/libdav1d.c @@ -49,6 +49,10 @@ static const enum AVPixelFormat pix_fmt[][3] = { [DAV1D_PIXEL_LAYOUT_I444] = { AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUV444P12 }, }; +static const enum AVPixelFormat pix_fmt_rgb[3] = { + AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRP12, +}; + static void libdav1d_log_callback(void *opaque, const char *fmt, va_list vl) { AVCodecContext *c = opaque; @@ -225,7 +229,6 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) c->profile = p->seq_hdr->profile; c->level = ((p->seq_hdr->operating_points[0].major_level - 2) << 2) | p->seq_hdr->operating_points[0].minor_level; - frame->format = c->pix_fmt = pix_fmt[p->p.layout][p->seq_hdr->hbd]; frame->width = p->p.w; frame->height = p->p.h; if (c->width != p->p.w || c->height != p->p.h) { @@ -247,6 +250,14 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) frame->color_trc = c->color_trc = (enum AVColorTransferCharacteristic) p->seq_hdr->trc; frame->color_range = c->color_range = p->seq_hdr->color_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; + if (p->p.layout == DAV1D_PIXEL_LAYOUT_I444 && + p->seq_hdr->mtrx == DAV1D_MC_IDENTITY && + p->seq_hdr->pri == DAV1D_COLOR_PRI_BT709 && + p->seq_hdr->trc == DAV1D_TRC_SRGB) + frame->format = c->pix_fmt = pix_fmt_rgb[p->seq_hdr->hbd]; + else + frame->format = c->pix_fmt = pix_fmt[p->p.layout][p->seq_hdr->hbd]; + // match timestamps and packet size frame->pts = frame->best_effort_timestamp = p->m.timestamp; #if FF_API_PKT_PTS |