[PATCH] avcodec/ffv1enc: choose 1.2 by default for higher resolutions to ensure multi-threaded decodability
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> --- libavcodec/ffv1enc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c index 2c87d7a..4856be5 100644 --- a/libavcodec/ffv1enc.c +++ b/libavcodec/ffv1enc.c @@ -672,6 +672,10 @@ static av_cold int encode_init(AVCodecContext *avctx) if ((avctx->flags & (CODEC_FLAG_PASS1|CODEC_FLAG_PASS2)) || avctx->slices>1) s->version = FFMAX(s->version, 2); + // Unspecified level & slices, we choose version 1.2+ to ensure multithreaded decodability + if (avctx->slices == 0 && avctx->level < 0 && avctx->width * avctx->height > 720*576) + s->version = FFMAX(s->version, 2); + if (avctx->level == 3 || (avctx->level <= 0 && s->version == 2)) { s->version = 3; } -- 1.7.9.5
On 12/08/2013 06:25 PM, Michael Niedermayer wrote:
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> --- libavcodec/ffv1enc.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c index 2c87d7a..4856be5 100644 --- a/libavcodec/ffv1enc.c +++ b/libavcodec/ffv1enc.c @@ -672,6 +672,10 @@ static av_cold int encode_init(AVCodecContext *avctx) if ((avctx->flags & (CODEC_FLAG_PASS1|CODEC_FLAG_PASS2)) || avctx->slices>1) s->version = FFMAX(s->version, 2);
+ // Unspecified level & slices, we choose version 1.2+ to ensure multithreaded decodability + if (avctx->slices == 0 && avctx->level < 0 && avctx->width * avctx->height > 720*576) + s->version = FFMAX(s->version, 2); + if (avctx->level == 3 || (avctx->level <= 0 && s->version == 2)) { s->version = 3; }
Do I understand this correctly to set the bitstream version to "2" if the resolution is greater than SD? If so, I wanted to ask why not set the version to 1.3 directly? As far as I understood, v1.2 was never officially released, so no files with v1.2 should actually exist in the wild. Wouldn't your patch now cause v1.2 files to be generated in some cases? I thought v1.2 was directly to be skipped and v1.3 be used instead. Could be that I'm completely wrong, but I'm confused... :) Would you please elaborate a bit the use cases for v1.2 vs v1.3? Thank you very much in advance, Pb
On Mon, Dec 09, 2013 at 12:46:37AM +0100, Peter B. wrote:
On 12/08/2013 06:25 PM, Michael Niedermayer wrote:
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> --- libavcodec/ffv1enc.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c index 2c87d7a..4856be5 100644 --- a/libavcodec/ffv1enc.c +++ b/libavcodec/ffv1enc.c @@ -672,6 +672,10 @@ static av_cold int encode_init(AVCodecContext *avctx) if ((avctx->flags & (CODEC_FLAG_PASS1|CODEC_FLAG_PASS2)) || avctx->slices>1) s->version = FFMAX(s->version, 2);
+ // Unspecified level & slices, we choose version 1.2+ to ensure multithreaded decodability + if (avctx->slices == 0 && avctx->level < 0 && avctx->width * avctx->height > 720*576) + s->version = FFMAX(s->version, 2); + if (avctx->level == 3 || (avctx->level <= 0 && s->version == 2)) { s->version = 3; }
Do I understand this correctly to set the bitstream version to "2" if the resolution is greater than SD?
If so, I wanted to ask why not set the version to 1.3 directly?
there is no reason, its equivalent, the next line will change it to 3 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When the tyrant has disposed of foreign enemies by conquest or treaty, and there is nothing more to fear from them, then he is always stirring up some war or other, in order that the people may require a leader. -- Plato
Quoting Michael Niedermayer <michaelni@gmx.at>:
On Mon, Dec 09, 2013 at 12:46:37AM +0100, Peter B. wrote:
On 12/08/2013 06:25 PM, Michael Niedermayer wrote:
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> --- libavcodec/ffv1enc.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c index 2c87d7a..4856be5 100644 --- a/libavcodec/ffv1enc.c +++ b/libavcodec/ffv1enc.c @@ -672,6 +672,10 @@ static av_cold int encode_init(AVCodecContext *avctx) if ((avctx->flags & (CODEC_FLAG_PASS1|CODEC_FLAG_PASS2)) || avctx->slices>1) s->version = FFMAX(s->version, 2);
+ // Unspecified level & slices, we choose version 1.2+ to ensure multithreaded decodability + if (avctx->slices == 0 && avctx->level < 0 && avctx->width * avctx->height > 720*576) + s->version = FFMAX(s->version, 2); + if (avctx->level == 3 || (avctx->level <= 0 && s->version == 2)) { s->version = 3; }
Do I understand this correctly to set the bitstream version to "2" if the resolution is greater than SD?
If so, I wanted to ask why not set the version to 1.3 directly?
there is no reason, its equivalent, the next line will change it to 3
Oh, now I see. Thanks for clearing that up for me. This auto-level setting is actually a nice thing for applications which do not yet offer a switch for choosing FFV1-version, by allowing to use them to generate FFV1.3 files. Thanks, Pb
On Mon, Dec 09, 2013 at 10:55:53AM +0100, Peter B. wrote:
Quoting Michael Niedermayer <michaelni@gmx.at>:
On Mon, Dec 09, 2013 at 12:46:37AM +0100, Peter B. wrote:
On 12/08/2013 06:25 PM, Michael Niedermayer wrote:
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> --- libavcodec/ffv1enc.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c index 2c87d7a..4856be5 100644 --- a/libavcodec/ffv1enc.c +++ b/libavcodec/ffv1enc.c @@ -672,6 +672,10 @@ static av_cold int encode_init(AVCodecContext *avctx) if ((avctx->flags & (CODEC_FLAG_PASS1|CODEC_FLAG_PASS2)) || avctx->slices>1) s->version = FFMAX(s->version, 2);
+ // Unspecified level & slices, we choose version 1.2+ to ensure multithreaded decodability + if (avctx->slices == 0 && avctx->level < 0 && avctx->width * avctx->height > 720*576) + s->version = FFMAX(s->version, 2); + if (avctx->level == 3 || (avctx->level <= 0 && s->version == 2)) { s->version = 3; }
Do I understand this correctly to set the bitstream version to "2" if the resolution is greater than SD?
If so, I wanted to ask why not set the version to 1.3 directly?
there is no reason, its equivalent, the next line will change it to 3
Oh, now I see. Thanks for clearing that up for me.
This auto-level setting is actually a nice thing for applications which do not yet offer a switch for choosing FFV1-version, by allowing to use them to generate FFV1.3 files.
applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I do not agree with what you have to say, but I'll defend to the death your right to say it. -- Voltaire
participants (2)
-
Michael Niedermayer -
Peter B.