diff mbox series

[FFmpeg-devel,1/2] lavc/cbs_h265: Add sps_multilayer_extension support

Message ID 20231117130322.3502477-1-mypopydev@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/2] lavc/cbs_h265: Add sps_multilayer_extension support | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Jun Zhao Nov. 17, 2023, 1:03 p.m. UTC
Add sps_multilayer_extensio support.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
---
 libavcodec/cbs_h265.h                 |  3 +++
 libavcodec/cbs_h265_syntax_template.c | 12 +++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

Comments

Mark Thompson Nov. 27, 2023, 5:59 p.m. UTC | #1
On 17/11/2023 13:03, Jun Zhao wrote:
> Add sps_multilayer_extensio support.
> 
> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> ---
>   libavcodec/cbs_h265.h                 |  3 +++
>   libavcodec/cbs_h265_syntax_template.c | 12 +++++++++++-
>   2 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/cbs_h265.h b/libavcodec/cbs_h265.h
> index 1b1195f198..15951269fd 100644
> --- a/libavcodec/cbs_h265.h
> +++ b/libavcodec/cbs_h265.h
> @@ -330,6 +330,9 @@ typedef struct H265RawSPS {
>       uint8_t persistent_rice_adaptation_enabled_flag;
>       uint8_t cabac_bypass_alignment_enabled_flag;
>   
> +    // Multilayer extension.
> +    uint8_t inter_view_mv_vert_constraint_flag;
> +
>       // Screen content coding extension.
>       uint8_t sps_curr_pic_ref_enabled_flag;
>       uint8_t palette_mode_enabled_flag;
> diff --git a/libavcodec/cbs_h265_syntax_template.c b/libavcodec/cbs_h265_syntax_template.c
> index 2d4b954718..1e3bc1acd8 100644
> --- a/libavcodec/cbs_h265_syntax_template.c
> +++ b/libavcodec/cbs_h265_syntax_template.c
> @@ -717,6 +717,16 @@ static int FUNC(sps_range_extension)(CodedBitstreamContext *ctx, RWContext *rw,
>       return 0;
>   }
>   
> +static int FUNC(sps_multilayer_extension)(CodedBitstreamContext *ctx, RWContext *rw,
> +                                          H265RawSPS *current)
> +{
> +    int err;
> +
> +    flag(inter_view_mv_vert_constraint_flag);
> +
> +    return 0;
> +}
> +
>   static int FUNC(sps_scc_extension)(CodedBitstreamContext *ctx, RWContext *rw,
>                                      H265RawSPS *current)
>   {
> @@ -952,7 +962,7 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
>       if (current->sps_range_extension_flag)
>           CHECK(FUNC(sps_range_extension)(ctx, rw, current));
>       if (current->sps_multilayer_extension_flag)
> -        return AVERROR_PATCHWELCOME;
> +        CHECK(FUNC(sps_multilayer_extension)(ctx, rw, current));
>       if (current->sps_3d_extension_flag)
>           return AVERROR_PATCHWELCOME;
>       if (current->sps_scc_extension_flag)

This doesn't seem like it it sufficient - when in multilayer the SPS format isn't the same (§F.7.3.2.2.1).

Alternatively: maybe this works for the first layer (haven't verified this but seems plausible), and therefore to work there only it would be sufficient to check if MultiLayerExtSpsFlag is true in an SPS and stop if it is?

(A sample suitable for using with fate would help.)

Thanks,

- Mark
mypopy@gmail.com Nov. 28, 2023, 2:33 a.m. UTC | #2
On Tue, Nov 28, 2023 at 1:59 AM Mark Thompson <sw@jkqxz.net> wrote:
>
> On 17/11/2023 13:03, Jun Zhao wrote:
> > Add sps_multilayer_extensio support.
> >
> > Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> > ---
> >   libavcodec/cbs_h265.h                 |  3 +++
> >   libavcodec/cbs_h265_syntax_template.c | 12 +++++++++++-
> >   2 files changed, 14 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/cbs_h265.h b/libavcodec/cbs_h265.h
> > index 1b1195f198..15951269fd 100644
> > --- a/libavcodec/cbs_h265.h
> > +++ b/libavcodec/cbs_h265.h
> > @@ -330,6 +330,9 @@ typedef struct H265RawSPS {
> >       uint8_t persistent_rice_adaptation_enabled_flag;
> >       uint8_t cabac_bypass_alignment_enabled_flag;
> >
> > +    // Multilayer extension.
> > +    uint8_t inter_view_mv_vert_constraint_flag;
> > +
> >       // Screen content coding extension.
> >       uint8_t sps_curr_pic_ref_enabled_flag;
> >       uint8_t palette_mode_enabled_flag;
> > diff --git a/libavcodec/cbs_h265_syntax_template.c b/libavcodec/cbs_h265_syntax_template.c
> > index 2d4b954718..1e3bc1acd8 100644
> > --- a/libavcodec/cbs_h265_syntax_template.c
> > +++ b/libavcodec/cbs_h265_syntax_template.c
> > @@ -717,6 +717,16 @@ static int FUNC(sps_range_extension)(CodedBitstreamContext *ctx, RWContext *rw,
> >       return 0;
> >   }
> >
> > +static int FUNC(sps_multilayer_extension)(CodedBitstreamContext *ctx, RWContext *rw,
> > +                                          H265RawSPS *current)
> > +{
> > +    int err;
> > +
> > +    flag(inter_view_mv_vert_constraint_flag);
> > +
> > +    return 0;
> > +}
> > +
> >   static int FUNC(sps_scc_extension)(CodedBitstreamContext *ctx, RWContext *rw,
> >                                      H265RawSPS *current)
> >   {
> > @@ -952,7 +962,7 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
> >       if (current->sps_range_extension_flag)
> >           CHECK(FUNC(sps_range_extension)(ctx, rw, current));
> >       if (current->sps_multilayer_extension_flag)
> > -        return AVERROR_PATCHWELCOME;
> > +        CHECK(FUNC(sps_multilayer_extension)(ctx, rw, current));
> >       if (current->sps_3d_extension_flag)
> >           return AVERROR_PATCHWELCOME;
> >       if (current->sps_scc_extension_flag)
>
> This doesn't seem like it it sufficient - when in multilayer the SPS format isn't the same (§F.7.3.2.2.1).
>
> Alternatively: maybe this works for the first layer (haven't verified this but seems plausible), and therefore to work there only it would be sufficient to check if MultiLayerExtSpsFlag is true in an SPS and stop if it is?
>
Actually, this case is from MV-HEVC, and I didn't find any other real
examples like the Spec  above
> (A sample suitable for using with fate would help.)
>
Will add a new MV-HEVC fate test case
> Thanks,
>
> - Mark
diff mbox series

Patch

diff --git a/libavcodec/cbs_h265.h b/libavcodec/cbs_h265.h
index 1b1195f198..15951269fd 100644
--- a/libavcodec/cbs_h265.h
+++ b/libavcodec/cbs_h265.h
@@ -330,6 +330,9 @@  typedef struct H265RawSPS {
     uint8_t persistent_rice_adaptation_enabled_flag;
     uint8_t cabac_bypass_alignment_enabled_flag;
 
+    // Multilayer extension.
+    uint8_t inter_view_mv_vert_constraint_flag;
+
     // Screen content coding extension.
     uint8_t sps_curr_pic_ref_enabled_flag;
     uint8_t palette_mode_enabled_flag;
diff --git a/libavcodec/cbs_h265_syntax_template.c b/libavcodec/cbs_h265_syntax_template.c
index 2d4b954718..1e3bc1acd8 100644
--- a/libavcodec/cbs_h265_syntax_template.c
+++ b/libavcodec/cbs_h265_syntax_template.c
@@ -717,6 +717,16 @@  static int FUNC(sps_range_extension)(CodedBitstreamContext *ctx, RWContext *rw,
     return 0;
 }
 
+static int FUNC(sps_multilayer_extension)(CodedBitstreamContext *ctx, RWContext *rw,
+                                          H265RawSPS *current)
+{
+    int err;
+
+    flag(inter_view_mv_vert_constraint_flag);
+
+    return 0;
+}
+
 static int FUNC(sps_scc_extension)(CodedBitstreamContext *ctx, RWContext *rw,
                                    H265RawSPS *current)
 {
@@ -952,7 +962,7 @@  static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
     if (current->sps_range_extension_flag)
         CHECK(FUNC(sps_range_extension)(ctx, rw, current));
     if (current->sps_multilayer_extension_flag)
-        return AVERROR_PATCHWELCOME;
+        CHECK(FUNC(sps_multilayer_extension)(ctx, rw, current));
     if (current->sps_3d_extension_flag)
         return AVERROR_PATCHWELCOME;
     if (current->sps_scc_extension_flag)