aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2017-04-10 11:35:00 +0200
committerLuca Barbato <lu_zero@gentoo.org>2017-04-15 15:37:18 +0200
commita93faf30d688b872e0ecc453b2dfc36470683ed6 (patch)
tree61ebb3cddb74a3fe1149d708dfdbe01cde5e9ad7
parentac29b82ec596c19c649b43f9988cbcc56f83b9e8 (diff)
downloadffmpeg-a93faf30d688b872e0ecc453b2dfc36470683ed6.tar.gz
utvideodec: Support UQRA and UQRG
-rw-r--r--libavcodec/utvideodec.c43
-rw-r--r--libavformat/riff.c2
2 files changed, 45 insertions, 0 deletions
diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
index 47f9de86c4..cc18e3dc95 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -351,6 +351,28 @@ static void restore_rgb_planes(uint8_t *src, int step, ptrdiff_t stride,
}
}
+static void restore_rgb_planes10(AVFrame *frame, int width, int height)
+{
+ uint16_t *src_r = (uint16_t *)frame->data[2];
+ uint16_t *src_g = (uint16_t *)frame->data[0];
+ uint16_t *src_b = (uint16_t *)frame->data[1];
+ int r, g, b;
+ int i, j;
+
+ for (j = 0; j < height; j++) {
+ for (i = 0; i < width; i++) {
+ r = src_r[i];
+ g = src_g[i];
+ b = src_b[i];
+ src_r[i] = (r + g - 0x200) & 0x3FF;
+ src_b[i] = (b + g - 0x200) & 0x3FF;
+ }
+ src_r += frame->linesize[2] / 2;
+ src_g += frame->linesize[0] / 2;
+ src_b += frame->linesize[1] / 2;
+ }
+}
+
static void restore_median(uint8_t *src, int step, ptrdiff_t stride,
int width, int height, int slices, int rmode)
{
@@ -605,6 +627,19 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
restore_rgb_planes(frame.f->data[0], c->planes, frame.f->linesize[0],
avctx->width, avctx->height);
break;
+ case AV_PIX_FMT_GBRAP10:
+ case AV_PIX_FMT_GBRP10:
+ for (i = 0; i < c->planes; i++) {
+ ret = decode_plane10(c, i, (uint16_t *)frame.f->data[i], 1,
+ frame.f->linesize[i] / 2, avctx->width,
+ avctx->height, plane_start[i],
+ plane_start[i + 1] - 1024,
+ c->frame_pred == PRED_LEFT);
+ if (ret)
+ return ret;
+ }
+ restore_rgb_planes10(frame.f, avctx->width, avctx->height);
+ break;
case AV_PIX_FMT_YUV420P:
for (i = 0; i < 3; i++) {
ret = decode_plane(c, i, frame.f->data[i], 1, frame.f->linesize[i],
@@ -731,6 +766,14 @@ static av_cold int decode_init(AVCodecContext *avctx)
c->planes = 3;
avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
break;
+ case MKTAG('U', 'Q', 'R', 'G'):
+ c->planes = 3;
+ avctx->pix_fmt = AV_PIX_FMT_GBRP10;
+ break;
+ case MKTAG('U', 'Q', 'R', 'A'):
+ c->planes = 4;
+ avctx->pix_fmt = AV_PIX_FMT_GBRAP10;
+ break;
case MKTAG('U', 'L', 'H', '0'):
c->planes = 3;
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
diff --git a/libavformat/riff.c b/libavformat/riff.c
index 69dabc0d52..9cd330b344 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -343,6 +343,8 @@ const AVCodecTag ff_codec_bmp_tags[] = {
{ AV_CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'H', '0') },
{ AV_CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'H', '2') },
{ AV_CODEC_ID_UTVIDEO, MKTAG('U', 'Q', 'Y', '2') },
+ { AV_CODEC_ID_UTVIDEO, MKTAG('U', 'Q', 'R', 'A') },
+ { AV_CODEC_ID_UTVIDEO, MKTAG('U', 'Q', 'R', 'G') },
{ AV_CODEC_ID_VBLE, MKTAG('V', 'B', 'L', 'E') },
{ AV_CODEC_ID_ESCAPE130, MKTAG('E', '1', '3', '0') },
{ AV_CODEC_ID_DXTORY, MKTAG('x', 't', 'o', 'r') },