Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/3] avcodec/libopenh264enc: support for colorspace and range information
@ 2022-01-13 10:45 lance.lmwang
  2022-01-13 10:45 ` [FFmpeg-devel] [PATCH 2/3] avcodec/libopenh264enc: make the profile configuablable correctly lance.lmwang
                   ` (4 more replies)
  0 siblings, 5 replies; 21+ messages in thread
From: lance.lmwang @ 2022-01-13 10:45 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Limin Wang

From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavcodec/libopenh264enc.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index de4b85c..a55bef8 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -330,6 +330,21 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
         }
     }
 
+#if OPENH264_VER_AT_LEAST(1, 6)
+    param.sSpatialLayers[0].uiVideoFormat = VF_UNDEF;
+    param.sSpatialLayers[0].bVideoSignalTypePresent = true;
+    if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED)
+        param.sSpatialLayers[0].bFullRange = (avctx->color_range == AVCOL_RANGE_JPEG);
+
+    param.sSpatialLayers[0].bColorDescriptionPresent = true;
+    if (avctx->colorspace != AVCOL_SPC_UNSPECIFIED)
+        param.sSpatialLayers[0].uiColorMatrix = avctx->colorspace;
+    if (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED)
+        param.sSpatialLayers[0].uiColorPrimaries = avctx->color_primaries;
+    if (avctx->color_trc != AVCOL_TRC_UNSPECIFIED)
+        param.sSpatialLayers[0].uiTransferCharacteristics = avctx->color_trc;
+#endif
+
     if ((*s->encoder)->InitializeExt(s->encoder, &param) != cmResultSuccess) {
         av_log(avctx, AV_LOG_ERROR, "Initialize failed\n");
         return AVERROR_UNKNOWN;
-- 
1.8.3.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [FFmpeg-devel] [PATCH 2/3] avcodec/libopenh264enc: make the profile configuablable correctly
  2022-01-13 10:45 [FFmpeg-devel] [PATCH 1/3] avcodec/libopenh264enc: support for colorspace and range information lance.lmwang
@ 2022-01-13 10:45 ` lance.lmwang
  2022-01-13 21:57   ` Martin Storsjö
  2022-01-13 10:45 ` [FFmpeg-devel] [PATCH 3/3] avcodec/libopenh264enc: set iEntropyCodingModeFlag by coder option lance.lmwang
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 21+ messages in thread
From: lance.lmwang @ 2022-01-13 10:45 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Limin Wang

From: Limin Wang <lance.lmwang@gmail.com>

If the version of libopenh264 >= 1.8, we can't configured main profile as
expected, below is the testing cli:

ffmpeg -y -f lavfi -i testsrc -c:v libopenh264 -profile:v main -frames:v 1 test.ts
It'll report:
[libopenh264 @ 0x5638300] Unsupported profile, select EProfileIdc PRO_BASELINE in libopenh264.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavcodec/libopenh264enc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index a55bef8..995ee37 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -220,26 +220,27 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
 #endif
 
     switch (s->profile) {
-#if OPENH264_VER_AT_LEAST(1, 8)
     case FF_PROFILE_H264_HIGH:
+        s->profile = PRO_HIGH;
         param.iEntropyCodingModeFlag = 1;
         av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
                 "select EProfileIdc PRO_HIGH in libopenh264.\n");
         break;
-#else
     case FF_PROFILE_H264_MAIN:
+        s->profile = PRO_MAIN;
         param.iEntropyCodingModeFlag = 1;
         av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
                 "select EProfileIdc PRO_MAIN in libopenh264.\n");
         break;
-#endif
     case FF_PROFILE_H264_CONSTRAINED_BASELINE:
     case FF_PROFILE_UNKNOWN:
+        s->profile = PRO_BASELINE;
         param.iEntropyCodingModeFlag = 0;
         av_log(avctx, AV_LOG_VERBOSE, "Using CAVLC, "
                "select EProfileIdc PRO_BASELINE in libopenh264.\n");
         break;
     default:
+        s->profile = PRO_BASELINE;
         param.iEntropyCodingModeFlag = 0;
         av_log(avctx, AV_LOG_WARNING, "Unsupported profile, "
                "select EProfileIdc PRO_BASELINE in libopenh264.\n");
@@ -251,6 +252,7 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
     param.sSpatialLayers[0].fFrameRate          = param.fMaxFrameRate;
     param.sSpatialLayers[0].iSpatialBitrate     = param.iTargetBitrate;
     param.sSpatialLayers[0].iMaxSpatialBitrate  = param.iMaxBitrate;
+    param.sSpatialLayers[0].uiProfileIdc        = s->profile;
 
 #if OPENH264_VER_AT_LEAST(1, 7)
     if (avctx->sample_aspect_ratio.num && avctx->sample_aspect_ratio.den) {
-- 
1.8.3.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [FFmpeg-devel] [PATCH 3/3] avcodec/libopenh264enc: set iEntropyCodingModeFlag by coder option
  2022-01-13 10:45 [FFmpeg-devel] [PATCH 1/3] avcodec/libopenh264enc: support for colorspace and range information lance.lmwang
  2022-01-13 10:45 ` [FFmpeg-devel] [PATCH 2/3] avcodec/libopenh264enc: make the profile configuablable correctly lance.lmwang
@ 2022-01-13 10:45 ` lance.lmwang
  2022-01-13 22:01   ` Martin Storsjö
  2022-01-13 21:35 ` [FFmpeg-devel] [PATCH 1/3] avcodec/libopenh264enc: support for colorspace and range information Martin Storsjö
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 21+ messages in thread
From: lance.lmwang @ 2022-01-13 10:45 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Limin Wang

From: Limin Wang <lance.lmwang@gmail.com>

ffmpeg -y -f lavfi -i testsrc -c:v libopenh264 -profile:v main -coder cavlc -frames:v 1 -bsf trace_headers -f null -

before the patch:
entropy_coding_mode_flag                                    0 = 1

after the patch:
entropy_coding_mode_flag                                    0 = 0

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavcodec/libopenh264enc.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index 995ee37..91deb6c 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -193,7 +193,7 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
 #endif
     param.bPrefixNalAddingCtrl       = 0;
     param.iLoopFilterDisableIdc      = !s->loopfilter;
-    param.iEntropyCodingModeFlag     = 0;
+    param.iEntropyCodingModeFlag     = s->coder >= 0 ? s->coder : 0;
     param.iMultipleThreadIdc         = avctx->thread_count;
 
     /* Allow specifying the libopenh264 profile through AVCodecContext. */
@@ -222,15 +222,15 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
     switch (s->profile) {
     case FF_PROFILE_H264_HIGH:
         s->profile = PRO_HIGH;
-        param.iEntropyCodingModeFlag = 1;
-        av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
-                "select EProfileIdc PRO_HIGH in libopenh264.\n");
+        av_log(avctx, AV_LOG_VERBOSE, "Using %s, "
+                "select EProfileIdc PRO_HIGH in libopenh264.\n",
+                s->coder == 1 ? "CABAC" : "CAVLC");
         break;
     case FF_PROFILE_H264_MAIN:
         s->profile = PRO_MAIN;
-        param.iEntropyCodingModeFlag = 1;
-        av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
-                "select EProfileIdc PRO_MAIN in libopenh264.\n");
+        av_log(avctx, AV_LOG_VERBOSE, "Using %s, "
+                "select EProfileIdc PRO_MAIN in libopenh264.\n",
+                s->coder == 1 ? "CABAC" : "CAVLC");
         break;
     case FF_PROFILE_H264_CONSTRAINED_BASELINE:
     case FF_PROFILE_UNKNOWN:
-- 
1.8.3.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/3] avcodec/libopenh264enc: support for colorspace and range information
  2022-01-13 10:45 [FFmpeg-devel] [PATCH 1/3] avcodec/libopenh264enc: support for colorspace and range information lance.lmwang
  2022-01-13 10:45 ` [FFmpeg-devel] [PATCH 2/3] avcodec/libopenh264enc: make the profile configuablable correctly lance.lmwang
  2022-01-13 10:45 ` [FFmpeg-devel] [PATCH 3/3] avcodec/libopenh264enc: set iEntropyCodingModeFlag by coder option lance.lmwang
@ 2022-01-13 21:35 ` Martin Storsjö
  2022-01-14  2:59   ` lance.lmwang
  2022-01-14  9:00 ` [FFmpeg-devel] [PATCH v2 " lance.lmwang
  2022-01-14  9:55 ` [FFmpeg-devel] [PATCH v3 " lance.lmwang
  4 siblings, 1 reply; 21+ messages in thread
From: Martin Storsjö @ 2022-01-13 21:35 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Limin Wang

On Thu, 13 Jan 2022, lance.lmwang@gmail.com wrote:

> From: Limin Wang <lance.lmwang@gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
> libavcodec/libopenh264enc.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
> index de4b85c..a55bef8 100644
> --- a/libavcodec/libopenh264enc.c
> +++ b/libavcodec/libopenh264enc.c
> @@ -330,6 +330,21 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
>         }
>     }
>
> +#if OPENH264_VER_AT_LEAST(1, 6)
> +    param.sSpatialLayers[0].uiVideoFormat = VF_UNDEF;
> +    param.sSpatialLayers[0].bVideoSignalTypePresent = true;

What does this flag do, and why do we set it unconditionally while we 
didn't use to before?

> +    if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED)
> +        param.sSpatialLayers[0].bFullRange = (avctx->color_range == AVCOL_RANGE_JPEG);
> +
> +    param.sSpatialLayers[0].bColorDescriptionPresent = true;

Ditto - what does this do and why do we set it even if we wouldn't set any 
of the other fields?

// Martin

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [FFmpeg-devel] [PATCH 2/3] avcodec/libopenh264enc: make the profile configuablable correctly
  2022-01-13 10:45 ` [FFmpeg-devel] [PATCH 2/3] avcodec/libopenh264enc: make the profile configuablable correctly lance.lmwang
@ 2022-01-13 21:57   ` Martin Storsjö
  2022-01-14  3:17     ` lance.lmwang
  0 siblings, 1 reply; 21+ messages in thread
From: Martin Storsjö @ 2022-01-13 21:57 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Limin Wang

On Thu, 13 Jan 2022, lance.lmwang@gmail.com wrote:

> From: Limin Wang <lance.lmwang@gmail.com>
>
> If the version of libopenh264 >= 1.8, we can't configured main profile as
> expected, below is the testing cli:
>
> ffmpeg -y -f lavfi -i testsrc -c:v libopenh264 -profile:v main -frames:v 1 test.ts
> It'll report:
> [libopenh264 @ 0x5638300] Unsupported profile, select EProfileIdc PRO_BASELINE in libopenh264.
>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
> libavcodec/libopenh264enc.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
> index a55bef8..995ee37 100644
> --- a/libavcodec/libopenh264enc.c
> +++ b/libavcodec/libopenh264enc.c
> @@ -220,26 +220,27 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
> #endif
>
>     switch (s->profile) {
> -#if OPENH264_VER_AT_LEAST(1, 8)
>     case FF_PROFILE_H264_HIGH:
> +        s->profile = PRO_HIGH;

I don't think we should reuse the s->profile field for this value here.

In practice, both FF_PROFILE_H264_HIGH and PRO_HIGH have the same values, 
but they're enums from different namespaces, so would it be clearer to use 
one variable for profiles set with FF_PROFILE_* and one with the PRO_* 
values?

>         param.iEntropyCodingModeFlag = 1;
>         av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
>                 "select EProfileIdc PRO_HIGH in libopenh264.\n");
>         break;
> -#else
>     case FF_PROFILE_H264_MAIN:
> +        s->profile = PRO_MAIN;
>         param.iEntropyCodingModeFlag = 1;
>         av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
>                 "select EProfileIdc PRO_MAIN in libopenh264.\n");
>         break;
> -#endif
>     case FF_PROFILE_H264_CONSTRAINED_BASELINE:
>     case FF_PROFILE_UNKNOWN:
> +        s->profile = PRO_BASELINE;
>         param.iEntropyCodingModeFlag = 0;
>         av_log(avctx, AV_LOG_VERBOSE, "Using CAVLC, "
>                "select EProfileIdc PRO_BASELINE in libopenh264.\n");
>         break;
>     default:
> +        s->profile = PRO_BASELINE;
>         param.iEntropyCodingModeFlag = 0;
>         av_log(avctx, AV_LOG_WARNING, "Unsupported profile, "
>                "select EProfileIdc PRO_BASELINE in libopenh264.\n");
> @@ -251,6 +252,7 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
>     param.sSpatialLayers[0].fFrameRate          = param.fMaxFrameRate;
>     param.sSpatialLayers[0].iSpatialBitrate     = param.iTargetBitrate;
>     param.sSpatialLayers[0].iMaxSpatialBitrate  = param.iMaxBitrate;
> +    param.sSpatialLayers[0].uiProfileIdc        = s->profile;

So this assignment is what was missing, and was what caused the incorrect 
conclusion in d3a7bdd4ac54349aea9150a234478635d50ebd87? I think it'd be 
good to explicitly spell this out in the commit message, saying that 
d3a7bdd4ac54349aea9150a234478635d50ebd87 was based on incorrect 
conclusions because we had missed to set uiProfileIdc.

// Martin

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [FFmpeg-devel] [PATCH 3/3] avcodec/libopenh264enc: set iEntropyCodingModeFlag by coder option
  2022-01-13 10:45 ` [FFmpeg-devel] [PATCH 3/3] avcodec/libopenh264enc: set iEntropyCodingModeFlag by coder option lance.lmwang
@ 2022-01-13 22:01   ` Martin Storsjö
  2022-01-14  3:20     ` lance.lmwang
  0 siblings, 1 reply; 21+ messages in thread
From: Martin Storsjö @ 2022-01-13 22:01 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Limin Wang

On Thu, 13 Jan 2022, lance.lmwang@gmail.com wrote:

> From: Limin Wang <lance.lmwang@gmail.com>
>
> ffmpeg -y -f lavfi -i testsrc -c:v libopenh264 -profile:v main -coder cavlc -frames:v 1 -bsf trace_headers -f null -
>
> before the patch:
> entropy_coding_mode_flag                                    0 = 1
>
> after the patch:
> entropy_coding_mode_flag                                    0 = 0

I don't understand what this bit in the commit message tries to say?


Doesn't this patch have the effect, that if I only specify "-profile 
high", I'll end up with CAVLC unless I specifically pass "-coder cabac" 
too? If coder wasn't specified, I think we should still default to CABAC 
for main/high.

// Martin

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/3] avcodec/libopenh264enc: support for colorspace and range information
  2022-01-13 21:35 ` [FFmpeg-devel] [PATCH 1/3] avcodec/libopenh264enc: support for colorspace and range information Martin Storsjö
@ 2022-01-14  2:59   ` lance.lmwang
  0 siblings, 0 replies; 21+ messages in thread
From: lance.lmwang @ 2022-01-14  2:59 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Thu, Jan 13, 2022 at 11:35:32PM +0200, Martin Storsjö wrote:
> On Thu, 13 Jan 2022, lance.lmwang@gmail.com wrote:
> 
> > From: Limin Wang <lance.lmwang@gmail.com>
> > 
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> > libavcodec/libopenh264enc.c | 15 +++++++++++++++
> > 1 file changed, 15 insertions(+)
> > 
> > diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
> > index de4b85c..a55bef8 100644
> > --- a/libavcodec/libopenh264enc.c
> > +++ b/libavcodec/libopenh264enc.c
> > @@ -330,6 +330,21 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
> >         }
> >     }
> > 
> > +#if OPENH264_VER_AT_LEAST(1, 6)
> > +    param.sSpatialLayers[0].uiVideoFormat = VF_UNDEF;
> > +    param.sSpatialLayers[0].bVideoSignalTypePresent = true;
> 
> What does this flag do, and why do we set it unconditionally while we didn't
> use to before?
> 

OK, will update and set the flag only if bFullRange is set.

> > +    if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED)
> > +        param.sSpatialLayers[0].bFullRange = (avctx->color_range == AVCOL_RANGE_JPEG);
> > +
> > +    param.sSpatialLayers[0].bColorDescriptionPresent = true;
> 
> Ditto - what does this do and why do we set it even if we wouldn't set any
> of the other fields?

will update and set the flag only if any the following fields are set.

> 
> // Martin
> 

-- 
Thanks,
Limin Wang
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [FFmpeg-devel] [PATCH 2/3] avcodec/libopenh264enc: make the profile configuablable correctly
  2022-01-13 21:57   ` Martin Storsjö
@ 2022-01-14  3:17     ` lance.lmwang
  0 siblings, 0 replies; 21+ messages in thread
From: lance.lmwang @ 2022-01-14  3:17 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Thu, Jan 13, 2022 at 11:57:36PM +0200, Martin Storsjö wrote:
> On Thu, 13 Jan 2022, lance.lmwang@gmail.com wrote:
> 
> > From: Limin Wang <lance.lmwang@gmail.com>
> > 
> > If the version of libopenh264 >= 1.8, we can't configured main profile as
> > expected, below is the testing cli:
> > 
> > ffmpeg -y -f lavfi -i testsrc -c:v libopenh264 -profile:v main -frames:v 1 test.ts
> > It'll report:
> > [libopenh264 @ 0x5638300] Unsupported profile, select EProfileIdc PRO_BASELINE in libopenh264.
> > 
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> > libavcodec/libopenh264enc.c | 8 +++++---
> > 1 file changed, 5 insertions(+), 3 deletions(-)
> > 
> > diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
> > index a55bef8..995ee37 100644
> > --- a/libavcodec/libopenh264enc.c
> > +++ b/libavcodec/libopenh264enc.c
> > @@ -220,26 +220,27 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
> > #endif
> > 
> >     switch (s->profile) {
> > -#if OPENH264_VER_AT_LEAST(1, 8)
> >     case FF_PROFILE_H264_HIGH:
> > +        s->profile = PRO_HIGH;
> 
> I don't think we should reuse the s->profile field for this value here.
> 
> In practice, both FF_PROFILE_H264_HIGH and PRO_HIGH have the same values,
> but they're enums from different namespaces, so would it be clearer to use
> one variable for profiles set with FF_PROFILE_* and one with the PRO_*
> values?

Yes, I think they're same value by specs, I'll delete the assignment for PRO_* 
to make it be cleaner.

> 
> >         param.iEntropyCodingModeFlag = 1;
> >         av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
> >                 "select EProfileIdc PRO_HIGH in libopenh264.\n");
> >         break;
> > -#else
> >     case FF_PROFILE_H264_MAIN:
> > +        s->profile = PRO_MAIN;
> >         param.iEntropyCodingModeFlag = 1;
> >         av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
> >                 "select EProfileIdc PRO_MAIN in libopenh264.\n");
> >         break;
> > -#endif
> >     case FF_PROFILE_H264_CONSTRAINED_BASELINE:
> >     case FF_PROFILE_UNKNOWN:
> > +        s->profile = PRO_BASELINE;
> >         param.iEntropyCodingModeFlag = 0;
> >         av_log(avctx, AV_LOG_VERBOSE, "Using CAVLC, "
> >                "select EProfileIdc PRO_BASELINE in libopenh264.\n");
> >         break;
> >     default:
> > +        s->profile = PRO_BASELINE;
> >         param.iEntropyCodingModeFlag = 0;
> >         av_log(avctx, AV_LOG_WARNING, "Unsupported profile, "
> >                "select EProfileIdc PRO_BASELINE in libopenh264.\n");
> > @@ -251,6 +252,7 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
> >     param.sSpatialLayers[0].fFrameRate          = param.fMaxFrameRate;
> >     param.sSpatialLayers[0].iSpatialBitrate     = param.iTargetBitrate;
> >     param.sSpatialLayers[0].iMaxSpatialBitrate  = param.iMaxBitrate;
> > +    param.sSpatialLayers[0].uiProfileIdc        = s->profile;
> 
> So this assignment is what was missing, and was what caused the incorrect
> conclusion in d3a7bdd4ac54349aea9150a234478635d50ebd87? I think it'd be good
> to explicitly spell this out in the commit message, saying that

OK, will add the following message into commit message:
d3a7bdd4ac54349aea9150a234478635d50ebd87 was based on incorrect conclusions
because we had missed to set uiProfileIdc.

> 
> // Martin
> 

-- 
Thanks,
Limin Wang
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [FFmpeg-devel] [PATCH 3/3] avcodec/libopenh264enc: set iEntropyCodingModeFlag by coder option
  2022-01-13 22:01   ` Martin Storsjö
@ 2022-01-14  3:20     ` lance.lmwang
  0 siblings, 0 replies; 21+ messages in thread
From: lance.lmwang @ 2022-01-14  3:20 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Fri, Jan 14, 2022 at 12:01:26AM +0200, Martin Storsjö wrote:
> On Thu, 13 Jan 2022, lance.lmwang@gmail.com wrote:
> 
> > From: Limin Wang <lance.lmwang@gmail.com>
> > 
> > ffmpeg -y -f lavfi -i testsrc -c:v libopenh264 -profile:v main -coder cavlc -frames:v 1 -bsf trace_headers -f null -
> > 
> > before the patch:
> > entropy_coding_mode_flag                                    0 = 1
> > 
> > after the patch:
> > entropy_coding_mode_flag                                    0 = 0
> 
> I don't understand what this bit in the commit message tries to say?
> 
> 
> Doesn't this patch have the effect, that if I only specify "-profile high",
> I'll end up with CAVLC unless I specifically pass "-coder cabac" too? If
> coder wasn't specified, I think we should still default to CABAC for
> main/high.

Sorry, I'll update the message.
it's high profile, we can't to use cavlc even if specify -coder. Yes, if haven't
set coder, it's preferable to enable cabac for high.

> 
> // Martin
> 

-- 
Thanks,
Limin Wang
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [FFmpeg-devel] [PATCH v2 1/3] avcodec/libopenh264enc: support for colorspace and range information
  2022-01-13 10:45 [FFmpeg-devel] [PATCH 1/3] avcodec/libopenh264enc: support for colorspace and range information lance.lmwang
                   ` (2 preceding siblings ...)
  2022-01-13 21:35 ` [FFmpeg-devel] [PATCH 1/3] avcodec/libopenh264enc: support for colorspace and range information Martin Storsjö
@ 2022-01-14  9:00 ` lance.lmwang
  2022-01-14  9:00   ` [FFmpeg-devel] [PATCH v2 2/3] avcodec/libopenh264enc: make the profile configuablable correctly lance.lmwang
                     ` (2 more replies)
  2022-01-14  9:55 ` [FFmpeg-devel] [PATCH v3 " lance.lmwang
  4 siblings, 3 replies; 21+ messages in thread
From: lance.lmwang @ 2022-01-14  9:00 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Limin Wang

From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavcodec/libopenh264enc.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index de4b85c..5b5914c 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -330,6 +330,28 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
         }
     }
 
+#if OPENH264_VER_AT_LEAST(1, 6)
+    param.sSpatialLayers[0].uiVideoFormat = VF_UNDEF;
+    if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED) {
+        param.sSpatialLayers[0].bVideoSignalTypePresent = true;
+        param.sSpatialLayers[0].bFullRange = (avctx->color_range == AVCOL_RANGE_JPEG);
+    }
+
+    if (avctx->colorspace != AVCOL_SPC_UNSPECIFIED      ||
+        avctx->color_primaries != AVCOL_PRI_UNSPECIFIED ||
+        avctx->color_trc != AVCOL_TRC_UNSPECIFIED) {
+        param.sSpatialLayers[0].bVideoSignalTypePresent = true;
+        param.sSpatialLayers[0].bColorDescriptionPresent = true;
+    }
+
+    if (avctx->colorspace != AVCOL_SPC_UNSPECIFIED)
+        param.sSpatialLayers[0].uiColorMatrix = avctx->colorspace;
+    if (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED)
+        param.sSpatialLayers[0].uiColorPrimaries = avctx->color_primaries;
+    if (avctx->color_trc != AVCOL_TRC_UNSPECIFIED)
+        param.sSpatialLayers[0].uiTransferCharacteristics = avctx->color_trc;
+#endif
+
     if ((*s->encoder)->InitializeExt(s->encoder, &param) != cmResultSuccess) {
         av_log(avctx, AV_LOG_ERROR, "Initialize failed\n");
         return AVERROR_UNKNOWN;
-- 
1.8.3.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [FFmpeg-devel] [PATCH v2 2/3] avcodec/libopenh264enc: make the profile configuablable correctly
  2022-01-14  9:00 ` [FFmpeg-devel] [PATCH v2 " lance.lmwang
@ 2022-01-14  9:00   ` lance.lmwang
  2022-01-14  9:28     ` Martin Storsjö
  2022-01-14  9:00   ` [FFmpeg-devel] [PATCH v2 3/3] avcodec/libopenh264enc: set iEntropyCodingModeFlag by coder option lance.lmwang
  2022-01-14  9:23   ` [FFmpeg-devel] [PATCH v2 1/3] avcodec/libopenh264enc: support for colorspace and range information Martin Storsjö
  2 siblings, 1 reply; 21+ messages in thread
From: lance.lmwang @ 2022-01-14  9:00 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Limin Wang

From: Limin Wang <lance.lmwang@gmail.com>

d3a7bdd4ac54349aea9150a234478635d50ebd87 was based on incorrect conclusions
because we had missed to set uiProfileIdc.

If the version of libopenh264 >= 1.8, we can't configured main profile as
expected, below is the testing cli:

ffmpeg -y -f lavfi -i testsrc -c:v libopenh264 -profile:v main -frames:v 1 test.ts
It'll report:
[libopenh264 @ 0x5638300] Unsupported profile, select EProfileIdc PRO_BASELINE in libopenh264.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavcodec/libopenh264enc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index 5b5914c..8e27edb 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -220,19 +220,16 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
 #endif
 
     switch (s->profile) {
-#if OPENH264_VER_AT_LEAST(1, 8)
     case FF_PROFILE_H264_HIGH:
         param.iEntropyCodingModeFlag = 1;
         av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
                 "select EProfileIdc PRO_HIGH in libopenh264.\n");
         break;
-#else
     case FF_PROFILE_H264_MAIN:
         param.iEntropyCodingModeFlag = 1;
         av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
                 "select EProfileIdc PRO_MAIN in libopenh264.\n");
         break;
-#endif
     case FF_PROFILE_H264_CONSTRAINED_BASELINE:
     case FF_PROFILE_UNKNOWN:
         param.iEntropyCodingModeFlag = 0;
@@ -251,6 +248,7 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
     param.sSpatialLayers[0].fFrameRate          = param.fMaxFrameRate;
     param.sSpatialLayers[0].iSpatialBitrate     = param.iTargetBitrate;
     param.sSpatialLayers[0].iMaxSpatialBitrate  = param.iMaxBitrate;
+    param.sSpatialLayers[0].uiProfileIdc        = s->profile;
 
 #if OPENH264_VER_AT_LEAST(1, 7)
     if (avctx->sample_aspect_ratio.num && avctx->sample_aspect_ratio.den) {
-- 
1.8.3.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [FFmpeg-devel] [PATCH v2 3/3] avcodec/libopenh264enc: set iEntropyCodingModeFlag by coder option
  2022-01-14  9:00 ` [FFmpeg-devel] [PATCH v2 " lance.lmwang
  2022-01-14  9:00   ` [FFmpeg-devel] [PATCH v2 2/3] avcodec/libopenh264enc: make the profile configuablable correctly lance.lmwang
@ 2022-01-14  9:00   ` lance.lmwang
  2022-01-14  9:30     ` Martin Storsjö
  2022-01-14  9:23   ` [FFmpeg-devel] [PATCH v2 1/3] avcodec/libopenh264enc: support for colorspace and range information Martin Storsjö
  2 siblings, 1 reply; 21+ messages in thread
From: lance.lmwang @ 2022-01-14  9:00 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Limin Wang

From: Limin Wang <lance.lmwang@gmail.com>

For high/main profile, user can choose to use cavlc by specify "-coder cavlc",
for default, it'll will use cabac, if it's baseline, we'll use cavlc by specs anyway.

ffmpeg -y -f lavfi -i testsrc -c:v libopenh264 -profile:v main -coder cavlc -frames:v 1 -bsf trace_headers -f null -
before the patch:
entropy_coding_mode_flag                                    0 = 1

after the patch:
entropy_coding_mode_flag                                    0 = 0

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavcodec/libopenh264enc.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index 8e27edb..4c0997b 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -193,7 +193,7 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
 #endif
     param.bPrefixNalAddingCtrl       = 0;
     param.iLoopFilterDisableIdc      = !s->loopfilter;
-    param.iEntropyCodingModeFlag     = 0;
+    param.iEntropyCodingModeFlag     = s->coder >= 0 ? s->coder : 1;
     param.iMultipleThreadIdc         = avctx->thread_count;
 
     /* Allow specifying the libopenh264 profile through AVCodecContext. */
@@ -221,14 +221,14 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
 
     switch (s->profile) {
     case FF_PROFILE_H264_HIGH:
-        param.iEntropyCodingModeFlag = 1;
-        av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
-                "select EProfileIdc PRO_HIGH in libopenh264.\n");
+        av_log(avctx, AV_LOG_VERBOSE, "Using %s, "
+                "select EProfileIdc PRO_HIGH in libopenh264.\n",
+                param.iEntropyCodingModeFlag ? "CABAC" : "CAVLC");
         break;
     case FF_PROFILE_H264_MAIN:
-        param.iEntropyCodingModeFlag = 1;
-        av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
-                "select EProfileIdc PRO_MAIN in libopenh264.\n");
+        av_log(avctx, AV_LOG_VERBOSE, "Using %s, "
+                "select EProfileIdc PRO_MAIN in libopenh264.\n",
+                param.iEntropyCodingModeFlag ? "CABAC" : "CAVLC");
         break;
     case FF_PROFILE_H264_CONSTRAINED_BASELINE:
     case FF_PROFILE_UNKNOWN:
-- 
1.8.3.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2 1/3] avcodec/libopenh264enc: support for colorspace and range information
  2022-01-14  9:00 ` [FFmpeg-devel] [PATCH v2 " lance.lmwang
  2022-01-14  9:00   ` [FFmpeg-devel] [PATCH v2 2/3] avcodec/libopenh264enc: make the profile configuablable correctly lance.lmwang
  2022-01-14  9:00   ` [FFmpeg-devel] [PATCH v2 3/3] avcodec/libopenh264enc: set iEntropyCodingModeFlag by coder option lance.lmwang
@ 2022-01-14  9:23   ` Martin Storsjö
  2 siblings, 0 replies; 21+ messages in thread
From: Martin Storsjö @ 2022-01-14  9:23 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Limin Wang

On Fri, 14 Jan 2022, lance.lmwang@gmail.com wrote:

> From: Limin Wang <lance.lmwang@gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
> libavcodec/libopenh264enc.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
> index de4b85c..5b5914c 100644
> --- a/libavcodec/libopenh264enc.c
> +++ b/libavcodec/libopenh264enc.c
> @@ -330,6 +330,28 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
>         }
>     }
>
> +#if OPENH264_VER_AT_LEAST(1, 6)
> +    param.sSpatialLayers[0].uiVideoFormat = VF_UNDEF;
> +    if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED) {
> +        param.sSpatialLayers[0].bVideoSignalTypePresent = true;
> +        param.sSpatialLayers[0].bFullRange = (avctx->color_range == AVCOL_RANGE_JPEG);
> +    }
> +
> +    if (avctx->colorspace != AVCOL_SPC_UNSPECIFIED      ||
> +        avctx->color_primaries != AVCOL_PRI_UNSPECIFIED ||
> +        avctx->color_trc != AVCOL_TRC_UNSPECIFIED) {
> +        param.sSpatialLayers[0].bVideoSignalTypePresent = true;
> +        param.sSpatialLayers[0].bColorDescriptionPresent = true;
> +    }
> +
> +    if (avctx->colorspace != AVCOL_SPC_UNSPECIFIED)
> +        param.sSpatialLayers[0].uiColorMatrix = avctx->colorspace;
> +    if (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED)
> +        param.sSpatialLayers[0].uiColorPrimaries = avctx->color_primaries;
> +    if (avctx->color_trc != AVCOL_TRC_UNSPECIFIED)
> +        param.sSpatialLayers[0].uiTransferCharacteristics = avctx->color_trc;
> +#endif

Thanks, this looks correct to me.

// Martin

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2 2/3] avcodec/libopenh264enc: make the profile configuablable correctly
  2022-01-14  9:00   ` [FFmpeg-devel] [PATCH v2 2/3] avcodec/libopenh264enc: make the profile configuablable correctly lance.lmwang
@ 2022-01-14  9:28     ` Martin Storsjö
  2022-01-14  9:43       ` lance.lmwang
  0 siblings, 1 reply; 21+ messages in thread
From: Martin Storsjö @ 2022-01-14  9:28 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Limin Wang

On Fri, 14 Jan 2022, lance.lmwang@gmail.com wrote:

> From: Limin Wang <lance.lmwang@gmail.com>
>
> d3a7bdd4ac54349aea9150a234478635d50ebd87 was based on incorrect conclusions
> because we had missed to set uiProfileIdc.
>
> If the version of libopenh264 >= 1.8, we can't configured main profile as
> expected, below is the testing cli:
>
> ffmpeg -y -f lavfi -i testsrc -c:v libopenh264 -profile:v main -frames:v 1 test.ts
> It'll report:
> [libopenh264 @ 0x5638300] Unsupported profile, select EProfileIdc PRO_BASELINE in libopenh264.

Given the referenced commit, the fact that you can't use main profile with 
1.8 (or high profile with older) isn't a surprise as that was part of the 
deliberate design in that commit, so I'm not sure if this 
is a good example to include. Or reword it to say that "due to the 
limitations set in <commit>, you weren't able to use main profile with 
OpenH264 1.8, or high profile with older versions".

> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
> libavcodec/libopenh264enc.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
> index 5b5914c..8e27edb 100644
> --- a/libavcodec/libopenh264enc.c
> +++ b/libavcodec/libopenh264enc.c
> @@ -220,19 +220,16 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
> #endif
>
>     switch (s->profile) {
> -#if OPENH264_VER_AT_LEAST(1, 8)
>     case FF_PROFILE_H264_HIGH:
>         param.iEntropyCodingModeFlag = 1;
>         av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
>                 "select EProfileIdc PRO_HIGH in libopenh264.\n");
>         break;
> -#else
>     case FF_PROFILE_H264_MAIN:
>         param.iEntropyCodingModeFlag = 1;
>         av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
>                 "select EProfileIdc PRO_MAIN in libopenh264.\n");
>         break;
> -#endif
>     case FF_PROFILE_H264_CONSTRAINED_BASELINE:
>     case FF_PROFILE_UNKNOWN:
>         param.iEntropyCodingModeFlag = 0;

For this fallback case, I think we should set s->profile to 
FF_PROFILE_H264_CONSTRAINED_BASELINE or something similar (does OpenH264 
work correctly with FF_PROFILE_H264_CONSTRAINED_BASELINE too, or only with 
FF_PROFILE_H264_BASELINE which is equal to PRO_BASELINE), as we otherwise 
would be setting unknown values into uiProfileIdc.

// Martin

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2 3/3] avcodec/libopenh264enc: set iEntropyCodingModeFlag by coder option
  2022-01-14  9:00   ` [FFmpeg-devel] [PATCH v2 3/3] avcodec/libopenh264enc: set iEntropyCodingModeFlag by coder option lance.lmwang
@ 2022-01-14  9:30     ` Martin Storsjö
  0 siblings, 0 replies; 21+ messages in thread
From: Martin Storsjö @ 2022-01-14  9:30 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Limin Wang

On Fri, 14 Jan 2022, lance.lmwang@gmail.com wrote:

> From: Limin Wang <lance.lmwang@gmail.com>
>
> For high/main profile, user can choose to use cavlc by specify "-coder cavlc",
> for default, it'll will use cabac, if it's baseline, we'll use cavlc by specs anyway.
>
> ffmpeg -y -f lavfi -i testsrc -c:v libopenh264 -profile:v main -coder cavlc -frames:v 1 -bsf trace_headers -f null -
> before the patch:
> entropy_coding_mode_flag                                    0 = 1
>
> after the patch:
> entropy_coding_mode_flag                                    0 = 0
>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
> libavcodec/libopenh264enc.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
> index 8e27edb..4c0997b 100644
> --- a/libavcodec/libopenh264enc.c
> +++ b/libavcodec/libopenh264enc.c
> @@ -193,7 +193,7 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
> #endif
>     param.bPrefixNalAddingCtrl       = 0;
>     param.iLoopFilterDisableIdc      = !s->loopfilter;
> -    param.iEntropyCodingModeFlag     = 0;
> +    param.iEntropyCodingModeFlag     = s->coder >= 0 ? s->coder : 1;
>     param.iMultipleThreadIdc         = avctx->thread_count;
>
>     /* Allow specifying the libopenh264 profile through AVCodecContext. */
> @@ -221,14 +221,14 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
>
>     switch (s->profile) {
>     case FF_PROFILE_H264_HIGH:
> -        param.iEntropyCodingModeFlag = 1;
> -        av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
> -                "select EProfileIdc PRO_HIGH in libopenh264.\n");
> +        av_log(avctx, AV_LOG_VERBOSE, "Using %s, "
> +                "select EProfileIdc PRO_HIGH in libopenh264.\n",
> +                param.iEntropyCodingModeFlag ? "CABAC" : "CAVLC");
>         break;
>     case FF_PROFILE_H264_MAIN:
> -        param.iEntropyCodingModeFlag = 1;
> -        av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
> -                "select EProfileIdc PRO_MAIN in libopenh264.\n");
> +        av_log(avctx, AV_LOG_VERBOSE, "Using %s, "
> +                "select EProfileIdc PRO_MAIN in libopenh264.\n",
> +                param.iEntropyCodingModeFlag ? "CABAC" : "CAVLC");
>         break;
>     case FF_PROFILE_H264_CONSTRAINED_BASELINE:
>     case FF_PROFILE_UNKNOWN:
> -- 
> 1.8.3.1

This looks good to me now I think, thanks!

// Martin

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2 2/3] avcodec/libopenh264enc: make the profile configuablable correctly
  2022-01-14  9:28     ` Martin Storsjö
@ 2022-01-14  9:43       ` lance.lmwang
  0 siblings, 0 replies; 21+ messages in thread
From: lance.lmwang @ 2022-01-14  9:43 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Fri, Jan 14, 2022 at 11:28:14AM +0200, Martin Storsjö wrote:
> On Fri, 14 Jan 2022, lance.lmwang@gmail.com wrote:
> 
> > From: Limin Wang <lance.lmwang@gmail.com>
> > 
> > d3a7bdd4ac54349aea9150a234478635d50ebd87 was based on incorrect conclusions
> > because we had missed to set uiProfileIdc.
> > 
> > If the version of libopenh264 >= 1.8, we can't configured main profile as
> > expected, below is the testing cli:
> > 
> > ffmpeg -y -f lavfi -i testsrc -c:v libopenh264 -profile:v main -frames:v 1 test.ts
> > It'll report:
> > [libopenh264 @ 0x5638300] Unsupported profile, select EProfileIdc PRO_BASELINE in libopenh264.
> 
> Given the referenced commit, the fact that you can't use main profile with
> 1.8 (or high profile with older) isn't a surprise as that was part of the
> deliberate design in that commit, so I'm not sure if this is a good example
> to include. Or reword it to say that "due to the limitations set in
> <commit>, you weren't able to use main profile with OpenH264 1.8, or high
> profile with older versions".

Sure, will reword the message as suggestion.

> 
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> > libavcodec/libopenh264enc.c | 4 +---
> > 1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
> > index 5b5914c..8e27edb 100644
> > --- a/libavcodec/libopenh264enc.c
> > +++ b/libavcodec/libopenh264enc.c
> > @@ -220,19 +220,16 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
> > #endif
> > 
> >     switch (s->profile) {
> > -#if OPENH264_VER_AT_LEAST(1, 8)
> >     case FF_PROFILE_H264_HIGH:
> >         param.iEntropyCodingModeFlag = 1;
> >         av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
> >                 "select EProfileIdc PRO_HIGH in libopenh264.\n");
> >         break;
> > -#else
> >     case FF_PROFILE_H264_MAIN:
> >         param.iEntropyCodingModeFlag = 1;
> >         av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
> >                 "select EProfileIdc PRO_MAIN in libopenh264.\n");
> >         break;
> > -#endif
> >     case FF_PROFILE_H264_CONSTRAINED_BASELINE:
> >     case FF_PROFILE_UNKNOWN:
> >         param.iEntropyCodingModeFlag = 0;
> 
> For this fallback case, I think we should set s->profile to
> FF_PROFILE_H264_CONSTRAINED_BASELINE or something similar (does OpenH264
> work correctly with FF_PROFILE_H264_CONSTRAINED_BASELINE too, or only with
> FF_PROFILE_H264_BASELINE which is equal to PRO_BASELINE), as we otherwise
> would be setting unknown values into uiProfileIdc.

Sure, will update to set profile to FF_PROFILE_H264_CONSTRAINED_BASELINE for unknown case.

> 
> // Martin
> 

-- 
Thanks,
Limin Wang
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [FFmpeg-devel] [PATCH v3 1/3] avcodec/libopenh264enc: support for colorspace and range information
  2022-01-13 10:45 [FFmpeg-devel] [PATCH 1/3] avcodec/libopenh264enc: support for colorspace and range information lance.lmwang
                   ` (3 preceding siblings ...)
  2022-01-14  9:00 ` [FFmpeg-devel] [PATCH v2 " lance.lmwang
@ 2022-01-14  9:55 ` lance.lmwang
  2022-01-14  9:55   ` [FFmpeg-devel] [PATCH v3 2/3] avcodec/libopenh264enc: make the profile configuablable correctly lance.lmwang
  2022-01-14  9:55   ` [FFmpeg-devel] [PATCH v3 3/3] avcodec/libopenh264enc: set iEntropyCodingModeFlag by coder option lance.lmwang
  4 siblings, 2 replies; 21+ messages in thread
From: lance.lmwang @ 2022-01-14  9:55 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Limin Wang

From: Limin Wang <lance.lmwang@gmail.com>

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavcodec/libopenh264enc.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index de4b85c..5b5914c 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -330,6 +330,28 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
         }
     }
 
+#if OPENH264_VER_AT_LEAST(1, 6)
+    param.sSpatialLayers[0].uiVideoFormat = VF_UNDEF;
+    if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED) {
+        param.sSpatialLayers[0].bVideoSignalTypePresent = true;
+        param.sSpatialLayers[0].bFullRange = (avctx->color_range == AVCOL_RANGE_JPEG);
+    }
+
+    if (avctx->colorspace != AVCOL_SPC_UNSPECIFIED      ||
+        avctx->color_primaries != AVCOL_PRI_UNSPECIFIED ||
+        avctx->color_trc != AVCOL_TRC_UNSPECIFIED) {
+        param.sSpatialLayers[0].bVideoSignalTypePresent = true;
+        param.sSpatialLayers[0].bColorDescriptionPresent = true;
+    }
+
+    if (avctx->colorspace != AVCOL_SPC_UNSPECIFIED)
+        param.sSpatialLayers[0].uiColorMatrix = avctx->colorspace;
+    if (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED)
+        param.sSpatialLayers[0].uiColorPrimaries = avctx->color_primaries;
+    if (avctx->color_trc != AVCOL_TRC_UNSPECIFIED)
+        param.sSpatialLayers[0].uiTransferCharacteristics = avctx->color_trc;
+#endif
+
     if ((*s->encoder)->InitializeExt(s->encoder, &param) != cmResultSuccess) {
         av_log(avctx, AV_LOG_ERROR, "Initialize failed\n");
         return AVERROR_UNKNOWN;
-- 
1.8.3.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [FFmpeg-devel] [PATCH v3 2/3] avcodec/libopenh264enc: make the profile configuablable correctly
  2022-01-14  9:55 ` [FFmpeg-devel] [PATCH v3 " lance.lmwang
@ 2022-01-14  9:55   ` lance.lmwang
  2022-01-14 12:07     ` Martin Storsjö
  2022-01-14  9:55   ` [FFmpeg-devel] [PATCH v3 3/3] avcodec/libopenh264enc: set iEntropyCodingModeFlag by coder option lance.lmwang
  1 sibling, 1 reply; 21+ messages in thread
From: lance.lmwang @ 2022-01-14  9:55 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Limin Wang

From: Limin Wang <lance.lmwang@gmail.com>

due to the limitations set in d3a7bdd4ac54349aea9150a234478635d50ebd87,
you weren't able to use main profile with OpenH264 1.8, or high profile
with older versions

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavcodec/libopenh264enc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index 5b5914c..1bad233 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -220,26 +220,25 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
 #endif
 
     switch (s->profile) {
-#if OPENH264_VER_AT_LEAST(1, 8)
     case FF_PROFILE_H264_HIGH:
         param.iEntropyCodingModeFlag = 1;
         av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
                 "select EProfileIdc PRO_HIGH in libopenh264.\n");
         break;
-#else
     case FF_PROFILE_H264_MAIN:
         param.iEntropyCodingModeFlag = 1;
         av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
                 "select EProfileIdc PRO_MAIN in libopenh264.\n");
         break;
-#endif
-    case FF_PROFILE_H264_CONSTRAINED_BASELINE:
     case FF_PROFILE_UNKNOWN:
+        s->profile = FF_PROFILE_H264_CONSTRAINED_BASELINE;
+    case FF_PROFILE_H264_CONSTRAINED_BASELINE:
         param.iEntropyCodingModeFlag = 0;
         av_log(avctx, AV_LOG_VERBOSE, "Using CAVLC, "
                "select EProfileIdc PRO_BASELINE in libopenh264.\n");
         break;
     default:
+        s->profile = FF_PROFILE_H264_CONSTRAINED_BASELINE;
         param.iEntropyCodingModeFlag = 0;
         av_log(avctx, AV_LOG_WARNING, "Unsupported profile, "
                "select EProfileIdc PRO_BASELINE in libopenh264.\n");
@@ -251,6 +250,7 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
     param.sSpatialLayers[0].fFrameRate          = param.fMaxFrameRate;
     param.sSpatialLayers[0].iSpatialBitrate     = param.iTargetBitrate;
     param.sSpatialLayers[0].iMaxSpatialBitrate  = param.iMaxBitrate;
+    param.sSpatialLayers[0].uiProfileIdc        = s->profile;
 
 #if OPENH264_VER_AT_LEAST(1, 7)
     if (avctx->sample_aspect_ratio.num && avctx->sample_aspect_ratio.den) {
-- 
1.8.3.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [FFmpeg-devel] [PATCH v3 3/3] avcodec/libopenh264enc: set iEntropyCodingModeFlag by coder option
  2022-01-14  9:55 ` [FFmpeg-devel] [PATCH v3 " lance.lmwang
  2022-01-14  9:55   ` [FFmpeg-devel] [PATCH v3 2/3] avcodec/libopenh264enc: make the profile configuablable correctly lance.lmwang
@ 2022-01-14  9:55   ` lance.lmwang
  1 sibling, 0 replies; 21+ messages in thread
From: lance.lmwang @ 2022-01-14  9:55 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Limin Wang

From: Limin Wang <lance.lmwang@gmail.com>

For high/main profile, user can choose to use cavlc by specify "-coder cavlc",
for default, it'll will use cabac, if it's baseline, we'll use cavlc by specs anyway.

ffmpeg -y -f lavfi -i testsrc -c:v libopenh264 -profile:v main -coder cavlc -frames:v 1 -bsf trace_headers -f null -
before the patch:
entropy_coding_mode_flag                                    0 = 1

after the patch:
entropy_coding_mode_flag                                    0 = 0

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavcodec/libopenh264enc.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index 1bad233..a1e78c9 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -193,7 +193,7 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
 #endif
     param.bPrefixNalAddingCtrl       = 0;
     param.iLoopFilterDisableIdc      = !s->loopfilter;
-    param.iEntropyCodingModeFlag     = 0;
+    param.iEntropyCodingModeFlag     = s->coder >= 0 ? s->coder : 1;
     param.iMultipleThreadIdc         = avctx->thread_count;
 
     /* Allow specifying the libopenh264 profile through AVCodecContext. */
@@ -221,14 +221,14 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
 
     switch (s->profile) {
     case FF_PROFILE_H264_HIGH:
-        param.iEntropyCodingModeFlag = 1;
-        av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
-                "select EProfileIdc PRO_HIGH in libopenh264.\n");
+        av_log(avctx, AV_LOG_VERBOSE, "Using %s, "
+                "select EProfileIdc PRO_HIGH in libopenh264.\n",
+                param.iEntropyCodingModeFlag ? "CABAC" : "CAVLC");
         break;
     case FF_PROFILE_H264_MAIN:
-        param.iEntropyCodingModeFlag = 1;
-        av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
-                "select EProfileIdc PRO_MAIN in libopenh264.\n");
+        av_log(avctx, AV_LOG_VERBOSE, "Using %s, "
+                "select EProfileIdc PRO_MAIN in libopenh264.\n",
+                param.iEntropyCodingModeFlag ? "CABAC" : "CAVLC");
         break;
     case FF_PROFILE_UNKNOWN:
         s->profile = FF_PROFILE_H264_CONSTRAINED_BASELINE;
-- 
1.8.3.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [FFmpeg-devel] [PATCH v3 2/3] avcodec/libopenh264enc: make the profile configuablable correctly
  2022-01-14  9:55   ` [FFmpeg-devel] [PATCH v3 2/3] avcodec/libopenh264enc: make the profile configuablable correctly lance.lmwang
@ 2022-01-14 12:07     ` Martin Storsjö
  2022-01-14 13:49       ` lance.lmwang
  0 siblings, 1 reply; 21+ messages in thread
From: Martin Storsjö @ 2022-01-14 12:07 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Limin Wang

On Fri, 14 Jan 2022, lance.lmwang@gmail.com wrote:

> From: Limin Wang <lance.lmwang@gmail.com>
>
> due to the limitations set in d3a7bdd4ac54349aea9150a234478635d50ebd87,
> you weren't able to use main profile with OpenH264 1.8, or high profile
> with older versions
>
> Reviewed-by: Martin Storsjö <martin@martin.st>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
> libavcodec/libopenh264enc.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
> index 5b5914c..1bad233 100644
> --- a/libavcodec/libopenh264enc.c
> +++ b/libavcodec/libopenh264enc.c
> @@ -220,26 +220,25 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
> #endif
>
>     switch (s->profile) {
> -#if OPENH264_VER_AT_LEAST(1, 8)
>     case FF_PROFILE_H264_HIGH:
>         param.iEntropyCodingModeFlag = 1;
>         av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
>                 "select EProfileIdc PRO_HIGH in libopenh264.\n");
>         break;
> -#else
>     case FF_PROFILE_H264_MAIN:
>         param.iEntropyCodingModeFlag = 1;
>         av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
>                 "select EProfileIdc PRO_MAIN in libopenh264.\n");
>         break;
> -#endif
> -    case FF_PROFILE_H264_CONSTRAINED_BASELINE:
>     case FF_PROFILE_UNKNOWN:
> +        s->profile = FF_PROFILE_H264_CONSTRAINED_BASELINE;
> +    case FF_PROFILE_H264_CONSTRAINED_BASELINE:

I don't think it's specifically necessary to move the case labels around 
like this; you could just leave both case labels above it, and the 
assignment would be a no-op for one case. (No need to resend the patch for 
that, do whichever form you prefer.)

>         param.iEntropyCodingModeFlag = 0;
>         av_log(avctx, AV_LOG_VERBOSE, "Using CAVLC, "
>                "select EProfileIdc PRO_BASELINE in libopenh264.\n");
>         break;
>     default:
> +        s->profile = FF_PROFILE_H264_CONSTRAINED_BASELINE;
>         param.iEntropyCodingModeFlag = 0;
>         av_log(avctx, AV_LOG_WARNING, "Unsupported profile, "
>                "select EProfileIdc PRO_BASELINE in libopenh264.\n");
> @@ -251,6 +250,7 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
>     param.sSpatialLayers[0].fFrameRate          = param.fMaxFrameRate;
>     param.sSpatialLayers[0].iSpatialBitrate     = param.iTargetBitrate;
>     param.sSpatialLayers[0].iMaxSpatialBitrate  = param.iMaxBitrate;
> +    param.sSpatialLayers[0].uiProfileIdc        = s->profile;

Thanks, this seems sensible to me. This is ok if you've tested that 
setting profile to FF_PROFILE_H264_CONSTRAINED_BASELINE (as opposed to 
PRO_BASELINE) does work with both some old and some recent version of 
OpenH264.

// Martin
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [FFmpeg-devel] [PATCH v3 2/3] avcodec/libopenh264enc: make the profile configuablable correctly
  2022-01-14 12:07     ` Martin Storsjö
@ 2022-01-14 13:49       ` lance.lmwang
  0 siblings, 0 replies; 21+ messages in thread
From: lance.lmwang @ 2022-01-14 13:49 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Fri, Jan 14, 2022 at 02:07:26PM +0200, Martin Storsjö wrote:
> On Fri, 14 Jan 2022, lance.lmwang@gmail.com wrote:
> 
> > From: Limin Wang <lance.lmwang@gmail.com>
> > 
> > due to the limitations set in d3a7bdd4ac54349aea9150a234478635d50ebd87,
> > you weren't able to use main profile with OpenH264 1.8, or high profile
> > with older versions
> > 
> > Reviewed-by: Martin Storsjö <martin@martin.st>
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> > libavcodec/libopenh264enc.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
> > index 5b5914c..1bad233 100644
> > --- a/libavcodec/libopenh264enc.c
> > +++ b/libavcodec/libopenh264enc.c
> > @@ -220,26 +220,25 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
> > #endif
> > 
> >     switch (s->profile) {
> > -#if OPENH264_VER_AT_LEAST(1, 8)
> >     case FF_PROFILE_H264_HIGH:
> >         param.iEntropyCodingModeFlag = 1;
> >         av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
> >                 "select EProfileIdc PRO_HIGH in libopenh264.\n");
> >         break;
> > -#else
> >     case FF_PROFILE_H264_MAIN:
> >         param.iEntropyCodingModeFlag = 1;
> >         av_log(avctx, AV_LOG_VERBOSE, "Using CABAC, "
> >                 "select EProfileIdc PRO_MAIN in libopenh264.\n");
> >         break;
> > -#endif
> > -    case FF_PROFILE_H264_CONSTRAINED_BASELINE:
> >     case FF_PROFILE_UNKNOWN:
> > +        s->profile = FF_PROFILE_H264_CONSTRAINED_BASELINE;
> > +    case FF_PROFILE_H264_CONSTRAINED_BASELINE:
> 
> I don't think it's specifically necessary to move the case labels around
> like this; you could just leave both case labels above it, and the
> assignment would be a no-op for one case. (No need to resend the patch for
> that, do whichever form you prefer.)

OK, will not move the case lables as suggestion.

> 
> >         param.iEntropyCodingModeFlag = 0;
> >         av_log(avctx, AV_LOG_VERBOSE, "Using CAVLC, "
> >                "select EProfileIdc PRO_BASELINE in libopenh264.\n");
> >         break;
> >     default:
> > +        s->profile = FF_PROFILE_H264_CONSTRAINED_BASELINE;
> >         param.iEntropyCodingModeFlag = 0;
> >         av_log(avctx, AV_LOG_WARNING, "Unsupported profile, "
> >                "select EProfileIdc PRO_BASELINE in libopenh264.\n");
> > @@ -251,6 +250,7 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
> >     param.sSpatialLayers[0].fFrameRate          = param.fMaxFrameRate;
> >     param.sSpatialLayers[0].iSpatialBitrate     = param.iTargetBitrate;
> >     param.sSpatialLayers[0].iMaxSpatialBitrate  = param.iMaxBitrate;
> > +    param.sSpatialLayers[0].uiProfileIdc        = s->profile;
> 
> Thanks, this seems sensible to me. This is ok if you've tested that setting
> profile to FF_PROFILE_H264_CONSTRAINED_BASELINE (as opposed to PRO_BASELINE)
> does work with both some old and some recent version of OpenH264.

Yes, have tested with v1.4.0, v1.7.0 and master.

> 
> // Martin


-- 
Thanks,
Limin Wang
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2022-01-14 13:49 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13 10:45 [FFmpeg-devel] [PATCH 1/3] avcodec/libopenh264enc: support for colorspace and range information lance.lmwang
2022-01-13 10:45 ` [FFmpeg-devel] [PATCH 2/3] avcodec/libopenh264enc: make the profile configuablable correctly lance.lmwang
2022-01-13 21:57   ` Martin Storsjö
2022-01-14  3:17     ` lance.lmwang
2022-01-13 10:45 ` [FFmpeg-devel] [PATCH 3/3] avcodec/libopenh264enc: set iEntropyCodingModeFlag by coder option lance.lmwang
2022-01-13 22:01   ` Martin Storsjö
2022-01-14  3:20     ` lance.lmwang
2022-01-13 21:35 ` [FFmpeg-devel] [PATCH 1/3] avcodec/libopenh264enc: support for colorspace and range information Martin Storsjö
2022-01-14  2:59   ` lance.lmwang
2022-01-14  9:00 ` [FFmpeg-devel] [PATCH v2 " lance.lmwang
2022-01-14  9:00   ` [FFmpeg-devel] [PATCH v2 2/3] avcodec/libopenh264enc: make the profile configuablable correctly lance.lmwang
2022-01-14  9:28     ` Martin Storsjö
2022-01-14  9:43       ` lance.lmwang
2022-01-14  9:00   ` [FFmpeg-devel] [PATCH v2 3/3] avcodec/libopenh264enc: set iEntropyCodingModeFlag by coder option lance.lmwang
2022-01-14  9:30     ` Martin Storsjö
2022-01-14  9:23   ` [FFmpeg-devel] [PATCH v2 1/3] avcodec/libopenh264enc: support for colorspace and range information Martin Storsjö
2022-01-14  9:55 ` [FFmpeg-devel] [PATCH v3 " lance.lmwang
2022-01-14  9:55   ` [FFmpeg-devel] [PATCH v3 2/3] avcodec/libopenh264enc: make the profile configuablable correctly lance.lmwang
2022-01-14 12:07     ` Martin Storsjö
2022-01-14 13:49       ` lance.lmwang
2022-01-14  9:55   ` [FFmpeg-devel] [PATCH v3 3/3] avcodec/libopenh264enc: set iEntropyCodingModeFlag by coder option lance.lmwang

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git