aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2012-02-28 19:44:07 +0100
committerKostya Shishkov <kostya.shishkov@gmail.com>2012-02-29 09:29:02 +0100
commit12b812d2e5dcc7c80b19b7c01713be31389120d5 (patch)
treeeab0f1be68dfa50cec62f4abd46cc8da72101ea4
parentc7084182e85eaa437899df58fd1ae57426d3c7f7 (diff)
downloadffmpeg-12b812d2e5dcc7c80b19b7c01713be31389120d5.tar.gz
prores: store and retrieve extended colourspace information
Based on the patch by Phil Barrett.
-rw-r--r--libavcodec/proresdec.c4
-rw-r--r--libavcodec/proresenc.c6
-rw-r--r--tests/ref/vsynth1/prores2
-rw-r--r--tests/ref/vsynth2/prores2
4 files changed, 9 insertions, 5 deletions
diff --git a/libavcodec/proresdec.c b/libavcodec/proresdec.c
index da90912031..a399576179 100644
--- a/libavcodec/proresdec.c
+++ b/libavcodec/proresdec.c
@@ -165,6 +165,10 @@ static int decode_frame_header(ProresContext *ctx, const uint8_t *buf,
ctx->picture.top_field_first = ctx->frame_type & 1;
}
+ avctx->color_primaries = buf[14];
+ avctx->color_trc = buf[15];
+ avctx->colorspace = buf[16];
+
ctx->alpha_info = buf[17] & 0xf;
if (ctx->alpha_info)
av_log_missing_feature(avctx, "alpha channel", 0);
diff --git a/libavcodec/proresenc.c b/libavcodec/proresenc.c
index c10f599f27..8e6f93fe2b 100644
--- a/libavcodec/proresenc.c
+++ b/libavcodec/proresenc.c
@@ -689,9 +689,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
bytestream_put_be16 (&buf, avctx->height);
bytestream_put_byte (&buf, ctx->chroma_factor << 6); // frame flags
bytestream_put_byte (&buf, 0); // reserved
- bytestream_put_byte (&buf, 0); // primaries
- bytestream_put_byte (&buf, 0); // transfer function
- bytestream_put_byte (&buf, 6); // colour matrix - ITU-R BT.601-4
+ bytestream_put_byte (&buf, avctx->color_primaries);
+ bytestream_put_byte (&buf, avctx->color_trc);
+ bytestream_put_byte (&buf, avctx->colorspace);
bytestream_put_byte (&buf, 0x40); // source format and alpha information
bytestream_put_byte (&buf, 0); // reserved
bytestream_put_byte (&buf, 0x03); // matrix flags - both matrices are present
diff --git a/tests/ref/vsynth1/prores b/tests/ref/vsynth1/prores
index b496d99e93..67ae0dcfd6 100644
--- a/tests/ref/vsynth1/prores
+++ b/tests/ref/vsynth1/prores
@@ -1,4 +1,4 @@
-c050b1a4905175211ead9979562366ff *./tests/data/vsynth1/prores.mov
+2566517b15c62887bd94daaab1b1a85b *./tests/data/vsynth1/prores.mov
3859037 ./tests/data/vsynth1/prores.mov
0a4153637d0cc0a88a8bcbf04cfaf8c6 *./tests/data/prores.vsynth1.out.yuv
stddev: 3.17 PSNR: 38.09 MAXDIFF: 39 bytes: 7603200/ 7603200
diff --git a/tests/ref/vsynth2/prores b/tests/ref/vsynth2/prores
index da5a97e7b3..44bd405d6f 100644
--- a/tests/ref/vsynth2/prores
+++ b/tests/ref/vsynth2/prores
@@ -1,4 +1,4 @@
-ecd11fa69712902143c0c54b193c9313 *./tests/data/vsynth2/prores.mov
+28755ce05e812adbb8b7c180318ffba8 *./tests/data/vsynth2/prores.mov
3884722 ./tests/data/vsynth2/prores.mov
ca2f6c1162635dedfa468c90f1fdc0ef *./tests/data/prores.vsynth2.out.yuv
stddev: 0.92 PSNR: 48.77 MAXDIFF: 10 bytes: 7603200/ 7603200