Re: [FFmpeg-devel] [PATCH 1/4] avformat/movenc: correct ImageDescription for uncompressed ycbcr

2017-11-19 Thread Michael Niedermayer
On Sat, Nov 18, 2017 at 09:19:17PM -0500, Dave Rice wrote:
> This patch set updates movenc to write uncompressed ycbcr in mov following 
> requirements in Apple’s TN2162, 
> https://developer.apple.com/library/content/technotes/tn2162/_index.html. 
> Thanks to Carl and Michael for comments on an earlier version of this 
> patchset.
> 
> 
> From 26d9ca470f104d8448000b13c2cc97b8fc5c15ba Mon Sep 17 00:00:00 2001
> From: Dave Rice 
> Date: Thu, 16 Nov 2017 11:53:32 -0500
> Subject: [PATCH 1/4] avformat/movenc: correct ImageDescription for
>  uncompressed ycbcr
> 
> Per
> https://developer.apple.com/library/content/technotes/tn2162/_index.html

will apply

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/4] avformat/movenc: correct ImageDescription for uncompressed ycbcr

2017-11-18 Thread Dave Rice
This patch set updates movenc to write uncompressed ycbcr in mov following 
requirements in Apple’s TN2162, 
https://developer.apple.com/library/content/technotes/tn2162/_index.html. 
Thanks to Carl and Michael for comments on an earlier version of this patchset.


From 26d9ca470f104d8448000b13c2cc97b8fc5c15ba Mon Sep 17 00:00:00 2001
From: Dave Rice 
Date: Thu, 16 Nov 2017 11:53:32 -0500
Subject: [PATCH 1/4] avformat/movenc: correct ImageDescription for
 uncompressed ycbcr

Per
https://developer.apple.com/library/content/technotes/tn2162/_index.html
.
---
 libavformat/movenc.c | 20 +---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index cc3fc19d9b..ce51c4b3d2 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1832,6 +1832,13 @@ static int mov_write_video_tag(AVIOContext *pb, 
MOVMuxContext *mov, MOVTrack *tr
 char compressor_name[32] = { 0 };
 int avid = 0;
 
+int uncompressed_ycbcr = ((track->par->codec_id == AV_CODEC_ID_RAWVIDEO && 
track->par->format == AV_PIX_FMT_UYVY422)
+   || (track->par->codec_id == AV_CODEC_ID_RAWVIDEO && 
track->par->format == AV_PIX_FMT_YUYV422)
+   ||  track->par->codec_id == AV_CODEC_ID_V308
+   ||  track->par->codec_id == AV_CODEC_ID_V408
+   ||  track->par->codec_id == AV_CODEC_ID_V410
+   ||  track->par->codec_id == AV_CODEC_ID_V210);
+
 avio_wb32(pb, 0); /* size */
 if (mov->encryption_scheme != MOV_ENC_NONE) {
 ffio_wfourcc(pb, "encv");
@@ -1842,11 +1849,15 @@ static int mov_write_video_tag(AVIOContext *pb, 
MOVMuxContext *mov, MOVTrack *tr
 avio_wb16(pb, 0); /* Reserved */
 avio_wb16(pb, 1); /* Data-reference index */
 
-avio_wb16(pb, 0); /* Codec stream version */
+if (uncompressed_ycbcr) {
+avio_wb16(pb, 2); /* Codec stream version */
+} else {
+avio_wb16(pb, 0); /* Codec stream version */
+}
 avio_wb16(pb, 0); /* Codec stream revision (=0) */
 if (track->mode == MODE_MOV) {
 ffio_wfourcc(pb, "FFMP"); /* Vendor */
-if (track->par->codec_id == AV_CODEC_ID_RAWVIDEO) {
+if (track->par->codec_id == AV_CODEC_ID_RAWVIDEO || 
uncompressed_ycbcr) {
 avio_wb32(pb, 0); /* Temporal Quality */
 avio_wb32(pb, 0x400); /* Spatial Quality = lossless*/
 } else {
@@ -1870,7 +1881,10 @@ static int mov_write_video_tag(AVIOContext *pb, 
MOVMuxContext *mov, MOVTrack *tr
 avio_w8(pb, strlen(compressor_name));
 avio_write(pb, compressor_name, 31);
 
-if (track->mode == MODE_MOV && track->par->bits_per_coded_sample)
+if (track->mode == MODE_MOV &&
+   (track->par->codec_id == AV_CODEC_ID_V410 || track->par->codec_id == 
AV_CODEC_ID_V210))
+avio_wb16(pb, 0x18);
+else if (track->mode == MODE_MOV && track->par->bits_per_coded_sample)
 avio_wb16(pb, track->par->bits_per_coded_sample |
   (track->par->format == AV_PIX_FMT_GRAY8 ? 0x20 : 0));
 else
-- 
2.15.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel