Re: [FFmpeg-devel] [PATCHv2] Revert "do not write f2 if not interlaced"

2016-02-01 Thread Tomas Härdin
On Fri, 2016-01-29 at 17:45 +0100, Sebastian Dröge wrote:
> From: Sebastian Dröge 
> 
> This reverts commit 8ed82d8174a666f80ab8834e3617cbe91ae740a9.
> 
> SMPTE S377-1-2009c defines in F.4.1 that the Video Line Map should
> always be an array with two 32 bit integers as elements. This is
> repeated in G.2.12 with actual examples for progressive content,
> where the second value would always be 0.
> 
> Additionally, the IRT MXF analyser also lists this as the only
> error in the MXF output from ffmpeg: https://mxf-analyser-cloud.irt.de
> ---
>  libavformat/mxfenc.c  | 10 +-
>  tests/ref/lavf/mxf|  6 +++---
>  tests/ref/lavf/mxf_opatom |  2 +-
>  3 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
> index 35c67f7..6da8b10 100644
> --- a/libavformat/mxfenc.c
> +++ b/libavformat/mxfenc.c
> @@ -1013,7 +1013,7 @@ static void mxf_write_cdci_common(AVFormatContext *s, 
> AVStream *st, const UID ke
>  int stored_height = (st->codec->height+15)/16*16;
>  int display_height;
>  int f1, f2;
> -unsigned desc_size = size+8+8+8+8+8+8+8+5+16+sc->interlaced*4+12+20+5;
> +unsigned desc_size = size+8+8+8+8+8+8+8+5+16+4+12+20+5;

Not strictly related to this patch but:
Can we do something about this? Other muxers (such as movenc) use a
combination of ftell() and fseek() to rewrite size fields like these.
Or perhaps mxfenc needs to be able to write to a pipe? In that case
seeking in a short buffer is allowed in avio IIRC

>  if (sc->interlaced && sc->field_dominance)
>  desc_size += 5;
>  if (sc->signal_standard)
> @@ -1081,12 +1081,12 @@ static void mxf_write_cdci_common(AVFormatContext *s, 
> AVStream *st, const UID ke
>  f1 *= 2;
>  }
>  
> -mxf_write_local_tag(pb, 12+sc->interlaced*4, 0x320D);
> -avio_wb32(pb, sc->interlaced ? 2 : 1);
> +
> +mxf_write_local_tag(pb, 16, 0x320D);
> +avio_wb32(pb, 2);
>  avio_wb32(pb, 4);
>  avio_wb32(pb, f1);
> -if (sc->interlaced)
> -avio_wb32(pb, f2);
> +avio_wb32(pb, f2);

Looks OK..

/Tomas

signature.asc
Description: This is a digitally signed message part
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCHv2] Revert "do not write f2 if not interlaced"

2016-02-01 Thread Michael Niedermayer
On Mon, Feb 01, 2016 at 09:31:51AM +0100, Tomas Härdin wrote:
> On Fri, 2016-01-29 at 17:45 +0100, Sebastian Dröge wrote:
> > From: Sebastian Dröge 
> > 
> > This reverts commit 8ed82d8174a666f80ab8834e3617cbe91ae740a9.
> > 
> > SMPTE S377-1-2009c defines in F.4.1 that the Video Line Map should
> > always be an array with two 32 bit integers as elements. This is
> > repeated in G.2.12 with actual examples for progressive content,
> > where the second value would always be 0.
> > 
> > Additionally, the IRT MXF analyser also lists this as the only
> > error in the MXF output from ffmpeg: https://mxf-analyser-cloud.irt.de
> > ---
> >  libavformat/mxfenc.c  | 10 +-
> >  tests/ref/lavf/mxf|  6 +++---
> >  tests/ref/lavf/mxf_opatom |  2 +-
> >  3 files changed, 9 insertions(+), 9 deletions(-)
> > 
> > diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
> > index 35c67f7..6da8b10 100644
> > --- a/libavformat/mxfenc.c
> > +++ b/libavformat/mxfenc.c
> > @@ -1013,7 +1013,7 @@ static void mxf_write_cdci_common(AVFormatContext *s, 
> > AVStream *st, const UID ke
> >  int stored_height = (st->codec->height+15)/16*16;
> >  int display_height;
> >  int f1, f2;
> > -unsigned desc_size = size+8+8+8+8+8+8+8+5+16+sc->interlaced*4+12+20+5;
> > +unsigned desc_size = size+8+8+8+8+8+8+8+5+16+4+12+20+5;
> 
> Not strictly related to this patch but:
> Can we do something about this? Other muxers (such as movenc) use a
> combination of ftell() and fseek() to rewrite size fields like these.
> Or perhaps mxfenc needs to be able to write to a pipe? In that case
> seeking in a short buffer is allowed in avio IIRC
> 
> >  if (sc->interlaced && sc->field_dominance)
> >  desc_size += 5;
> >  if (sc->signal_standard)
> > @@ -1081,12 +1081,12 @@ static void mxf_write_cdci_common(AVFormatContext 
> > *s, AVStream *st, const UID ke
> >  f1 *= 2;
> >  }
> >  
> > -mxf_write_local_tag(pb, 12+sc->interlaced*4, 0x320D);
> > -avio_wb32(pb, sc->interlaced ? 2 : 1);
> > +
> > +mxf_write_local_tag(pb, 16, 0x320D);
> > +avio_wb32(pb, 2);
> >  avio_wb32(pb, 4);
> >  avio_wb32(pb, f1);
> > -if (sc->interlaced)
> > -avio_wb32(pb, f2);
> > +avio_wb32(pb, f2);
> 
> Looks OK..

applied

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato


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


[FFmpeg-devel] [PATCHv2] Revert "do not write f2 if not interlaced"

2016-01-29 Thread Sebastian Dröge
From: Sebastian Dröge 

This reverts commit 8ed82d8174a666f80ab8834e3617cbe91ae740a9.

SMPTE S377-1-2009c defines in F.4.1 that the Video Line Map should
always be an array with two 32 bit integers as elements. This is
repeated in G.2.12 with actual examples for progressive content,
where the second value would always be 0.

Additionally, the IRT MXF analyser also lists this as the only
error in the MXF output from ffmpeg: https://mxf-analyser-cloud.irt.de
---
 libavformat/mxfenc.c  | 10 +-
 tests/ref/lavf/mxf|  6 +++---
 tests/ref/lavf/mxf_opatom |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 35c67f7..6da8b10 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -1013,7 +1013,7 @@ static void mxf_write_cdci_common(AVFormatContext *s, 
AVStream *st, const UID ke
 int stored_height = (st->codec->height+15)/16*16;
 int display_height;
 int f1, f2;
-unsigned desc_size = size+8+8+8+8+8+8+8+5+16+sc->interlaced*4+12+20+5;
+unsigned desc_size = size+8+8+8+8+8+8+8+5+16+4+12+20+5;
 if (sc->interlaced && sc->field_dominance)
 desc_size += 5;
 if (sc->signal_standard)
@@ -1081,12 +1081,12 @@ static void mxf_write_cdci_common(AVFormatContext *s, 
AVStream *st, const UID ke
 f1 *= 2;
 }
 
-mxf_write_local_tag(pb, 12+sc->interlaced*4, 0x320D);
-avio_wb32(pb, sc->interlaced ? 2 : 1);
+
+mxf_write_local_tag(pb, 16, 0x320D);
+avio_wb32(pb, 2);
 avio_wb32(pb, 4);
 avio_wb32(pb, f1);
-if (sc->interlaced)
-avio_wb32(pb, f2);
+avio_wb32(pb, f2);
 
 mxf_write_local_tag(pb, 8, 0x320E);
 avio_wb32(pb, sc->aspect_ratio.num);
diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf
index bc113f3..e1c0c79 100644
--- a/tests/ref/lavf/mxf
+++ b/tests/ref/lavf/mxf
@@ -1,9 +1,9 @@
-6d00bf68ec95d0aac959defccdb0190e *./tests/data/lavf/lavf.mxf
+f9b570c7b4fbbc2b71f2236b32e7cbb6 *./tests/data/lavf/lavf.mxf
 525369 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0xdbfff6f1
-0bbdd13de78db8ab9314f083b7da0f30 *./tests/data/lavf/lavf.mxf
+8f6a9a6b409f0f5a0bf003f8dea26314 *./tests/data/lavf/lavf.mxf
 560697 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0x11a6178e
-462f95f19b3e0fd119a204a96eb6f424 *./tests/data/lavf/lavf.mxf
+10ac0f158fc0af356439b818de7601e3 *./tests/data/lavf/lavf.mxf
 525369 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0xdbfff6f1
diff --git a/tests/ref/lavf/mxf_opatom b/tests/ref/lavf/mxf_opatom
index 8dfc55a..ea1190c 100644
--- a/tests/ref/lavf/mxf_opatom
+++ b/tests/ref/lavf/mxf_opatom
@@ -1,3 +1,3 @@
-2205907020248f73876eaad745d2f5b5 *./tests/data/lavf/lavf.mxf_opatom
+962c2cd582340f8961a8283636093abf *./tests/data/lavf/lavf.mxf_opatom
 4717113 ./tests/data/lavf/lavf.mxf_opatom
 ./tests/data/lavf/lavf.mxf_opatom CRC=0xf55aa22a
-- 
2.7.0

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