Message ID | 20230702232622.6870-1-jamrial@gmail.com |
---|---|
State | Accepted |
Commit | 6cb57bb457ebf544d311676bead7f1112ac9f8a9 |
Headers | show |
Series | [FFmpeg-devel,1/4] avcodec/cbs_h266: add support for Operating point information NALU type | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
On Mon, Jul 3, 2023 at 7:28 AM James Almer <jamrial@gmail.com> wrote: > Signed-off-by: James Almer <jamrial@gmail.com> > --- > libavcodec/cbs_h2645.c | 18 ++++++++++++++++++ > libavcodec/cbs_h266.h | 11 +++++++++++ > libavcodec/cbs_h266_syntax_template.c | 27 +++++++++++++++++++++++++++ > 3 files changed, 56 insertions(+) > > diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c > index 68ccf6a7eb..8dc9ae471d 100644 > --- a/libavcodec/cbs_h2645.c > +++ b/libavcodec/cbs_h2645.c > @@ -1059,6 +1059,14 @@ static int > cbs_h266_read_nal_unit(CodedBitstreamContext *ctx, > return err; > > switch (unit->type) { > + case VVC_OPI_NUT: > + { > + err = cbs_h266_read_opi(ctx, &gbc, unit->content); > + > + if (err < 0) > + return err; > + } > + break; > case VVC_VPS_NUT: > { > H266RawVPS *vps = unit->content; > @@ -1593,6 +1601,15 @@ static int > cbs_h266_write_nal_unit(CodedBitstreamContext *ctx, > int err; > > switch (unit->type) { > + case VVC_OPI_NUT: > + { > + H266RawOPI *opi = unit->content; > + > + err = cbs_h266_write_opi(ctx, pbc, opi); > + if (err < 0) > + return err; > + } > + break; > case VVC_VPS_NUT: > { > H266RawVPS *vps = unit->content; > @@ -1965,6 +1982,7 @@ static void cbs_h266_free_sei(void *opaque, uint8_t > *content) > } > > static const CodedBitstreamUnitTypeDescriptor cbs_h266_unit_types[] = { > + CBS_UNIT_TYPE_INTERNAL_REF(VVC_OPI_NUT, H266RawOPI, > extension_data.data), > CBS_UNIT_TYPE_INTERNAL_REF(VVC_VPS_NUT, H266RawVPS, > extension_data.data), > CBS_UNIT_TYPE_INTERNAL_REF(VVC_SPS_NUT, H266RawSPS, > extension_data.data), > CBS_UNIT_TYPE_INTERNAL_REF(VVC_PPS_NUT, H266RawPPS, > extension_data.data), > diff --git a/libavcodec/cbs_h266.h b/libavcodec/cbs_h266.h > index e33d08a0f5..693d1ca1fd 100644 > --- a/libavcodec/cbs_h266.h > +++ b/libavcodec/cbs_h266.h > @@ -230,6 +230,17 @@ typedef struct H266RawVUI { > H266RawExtensionData extension_data; > } H266RawVUI; > > +typedef struct H266RawOPI { > + H266RawNALUnitHeader nal_unit_header; > + > + uint8_t opi_ols_info_present_flag; > + uint8_t opi_htid_info_present_flag; > + uint16_t opi_ols_idx; > + uint8_t opi_htid_plus1; > + uint8_t opi_extension_flag; > + H266RawExtensionData extension_data; > +} H266RawOPI; > + > typedef struct H266RawVPS { > H266RawNALUnitHeader nal_unit_header; > > diff --git a/libavcodec/cbs_h266_syntax_template.c > b/libavcodec/cbs_h266_syntax_template.c > index 957735056f..d9c8e0afbe 100644 > --- a/libavcodec/cbs_h266_syntax_template.c > +++ b/libavcodec/cbs_h266_syntax_template.c > @@ -623,6 +623,33 @@ static int FUNC(ols_timing_hrd_parameters) > (CodedBitstreamContext *ctx, > return 0; > } > > +static int FUNC(opi)(CodedBitstreamContext *ctx, RWContext *rw, > + H266RawOPI *current) > +{ > + int err; > + > + HEADER("Operating point information"); > + > + CHECK(FUNC(nal_unit_header)(ctx, rw, > + ¤t->nal_unit_header, VVC_OPI_NUT)); > + > + flag(opi_ols_info_present_flag); > + flag(opi_htid_info_present_flag); > + > + if(current->opi_ols_info_present_flag) > + ue(opi_ols_idx, 0, VVC_MAX_TOTAL_NUM_OLSS - 1); > + > + if(current->opi_htid_info_present_flag) > + ub(3, opi_htid_plus1); > + > + flag(opi_extension_flag); > + if (current->opi_extension_flag) > + CHECK(FUNC(extension_data) (ctx, rw, ¤t->extension_data)); > + CHECK(FUNC(rbsp_trailing_bits) (ctx, rw)); > + > + return 0; > +} > + > static int FUNC(vps) (CodedBitstreamContext *ctx, RWContext *rw, > H266RawVPS *current) > { > -- > 2.41.0 > > LGTM > _______________________________________________ > 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". >
diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c index 68ccf6a7eb..8dc9ae471d 100644 --- a/libavcodec/cbs_h2645.c +++ b/libavcodec/cbs_h2645.c @@ -1059,6 +1059,14 @@ static int cbs_h266_read_nal_unit(CodedBitstreamContext *ctx, return err; switch (unit->type) { + case VVC_OPI_NUT: + { + err = cbs_h266_read_opi(ctx, &gbc, unit->content); + + if (err < 0) + return err; + } + break; case VVC_VPS_NUT: { H266RawVPS *vps = unit->content; @@ -1593,6 +1601,15 @@ static int cbs_h266_write_nal_unit(CodedBitstreamContext *ctx, int err; switch (unit->type) { + case VVC_OPI_NUT: + { + H266RawOPI *opi = unit->content; + + err = cbs_h266_write_opi(ctx, pbc, opi); + if (err < 0) + return err; + } + break; case VVC_VPS_NUT: { H266RawVPS *vps = unit->content; @@ -1965,6 +1982,7 @@ static void cbs_h266_free_sei(void *opaque, uint8_t *content) } static const CodedBitstreamUnitTypeDescriptor cbs_h266_unit_types[] = { + CBS_UNIT_TYPE_INTERNAL_REF(VVC_OPI_NUT, H266RawOPI, extension_data.data), CBS_UNIT_TYPE_INTERNAL_REF(VVC_VPS_NUT, H266RawVPS, extension_data.data), CBS_UNIT_TYPE_INTERNAL_REF(VVC_SPS_NUT, H266RawSPS, extension_data.data), CBS_UNIT_TYPE_INTERNAL_REF(VVC_PPS_NUT, H266RawPPS, extension_data.data), diff --git a/libavcodec/cbs_h266.h b/libavcodec/cbs_h266.h index e33d08a0f5..693d1ca1fd 100644 --- a/libavcodec/cbs_h266.h +++ b/libavcodec/cbs_h266.h @@ -230,6 +230,17 @@ typedef struct H266RawVUI { H266RawExtensionData extension_data; } H266RawVUI; +typedef struct H266RawOPI { + H266RawNALUnitHeader nal_unit_header; + + uint8_t opi_ols_info_present_flag; + uint8_t opi_htid_info_present_flag; + uint16_t opi_ols_idx; + uint8_t opi_htid_plus1; + uint8_t opi_extension_flag; + H266RawExtensionData extension_data; +} H266RawOPI; + typedef struct H266RawVPS { H266RawNALUnitHeader nal_unit_header; diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index 957735056f..d9c8e0afbe 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -623,6 +623,33 @@ static int FUNC(ols_timing_hrd_parameters) (CodedBitstreamContext *ctx, return 0; } +static int FUNC(opi)(CodedBitstreamContext *ctx, RWContext *rw, + H266RawOPI *current) +{ + int err; + + HEADER("Operating point information"); + + CHECK(FUNC(nal_unit_header)(ctx, rw, + ¤t->nal_unit_header, VVC_OPI_NUT)); + + flag(opi_ols_info_present_flag); + flag(opi_htid_info_present_flag); + + if(current->opi_ols_info_present_flag) + ue(opi_ols_idx, 0, VVC_MAX_TOTAL_NUM_OLSS - 1); + + if(current->opi_htid_info_present_flag) + ub(3, opi_htid_plus1); + + flag(opi_extension_flag); + if (current->opi_extension_flag) + CHECK(FUNC(extension_data) (ctx, rw, ¤t->extension_data)); + CHECK(FUNC(rbsp_trailing_bits) (ctx, rw)); + + return 0; +} + static int FUNC(vps) (CodedBitstreamContext *ctx, RWContext *rw, H266RawVPS *current) {
Signed-off-by: James Almer <jamrial@gmail.com> --- libavcodec/cbs_h2645.c | 18 ++++++++++++++++++ libavcodec/cbs_h266.h | 11 +++++++++++ libavcodec/cbs_h266_syntax_template.c | 27 +++++++++++++++++++++++++++ 3 files changed, 56 insertions(+)