* [FFmpeg-devel] [PATCH v2] avcodec/dovi - correctly read el_bit_depth_minus8 and ext_mapping_idc [not found] <20240521183905.76407-1-cosmin@cosmin.at> @ 2024-05-21 18:39 ` Cosmin Stejerean via ffmpeg-devel 2024-05-22 4:19 ` Andreas Rheinhardt 0 siblings, 1 reply; 3+ messages in thread From: Cosmin Stejerean via ffmpeg-devel @ 2024-05-21 18:39 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Cosmin Stejerean From: Cosmin Stejerean <cosmin@cosmin.at> These two fields are coded together into a single 16 bit integer with upper 8 bits for ext_mapping_idc and lower 8 bits for el_bit_depth_minus8. Furthermore ext_mapping_idc has two components, upper 3 bits and lower 5 bits. --- libavcodec/dovi_rpudec.c | 7 ++++++- libavcodec/dovi_rpuenc.c | 4 +++- libavutil/dovi_meta.h | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libavcodec/dovi_rpudec.c b/libavcodec/dovi_rpudec.c index 7c7eda9d09..af41ab5827 100644 --- a/libavcodec/dovi_rpudec.c +++ b/libavcodec/dovi_rpudec.c @@ -411,13 +411,18 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size, if ((hdr->rpu_format & 0x700) == 0) { int bl_bit_depth_minus8 = get_ue_golomb_31(gb); - int el_bit_depth_minus8 = get_ue_golomb_31(gb); + int el_bit_depth_minus8_and_ext_mapping_idc = get_ue_golomb_long(gb); + int el_bit_depth_minus8 = el_bit_depth_minus8_and_ext_mapping_idc & 0xFF; // lowest 8 bits + int ext_mapping_idc = (el_bit_depth_minus8_and_ext_mapping_idc & 0xFF00) >> 8; // upper 8 bits + int vdr_bit_depth_minus8 = get_ue_golomb_31(gb); VALIDATE(bl_bit_depth_minus8, 0, 8); VALIDATE(el_bit_depth_minus8, 0, 8); VALIDATE(vdr_bit_depth_minus8, 0, 8); hdr->bl_bit_depth = bl_bit_depth_minus8 + 8; hdr->el_bit_depth = el_bit_depth_minus8 + 8; + hdr->ext_mapping_idc_0_4 = ext_mapping_idc & 0x1F; // lowest 5 bits of ext_mapping_idc + hdr->ext_mapping_idc_5_7 = (ext_mapping_idc & 0xE0) >> 5; // upper 3 bits of ext_mapping_idc hdr->vdr_bit_depth = vdr_bit_depth_minus8 + 8; hdr->spatial_resampling_filter_flag = get_bits1(gb); skip_bits(gb, 3); /* reserved_zero_3bits */ diff --git a/libavcodec/dovi_rpuenc.c b/libavcodec/dovi_rpuenc.c index 3c3e0f84c0..91c0a85050 100644 --- a/libavcodec/dovi_rpuenc.c +++ b/libavcodec/dovi_rpuenc.c @@ -444,6 +444,7 @@ int ff_dovi_rpu_generate(DOVIContext *s, const AVDOVIMetadata *metadata, int vdr_dm_metadata_changed, vdr_rpu_id, use_prev_vdr_rpu, profile, buffer_size, rpu_size, pad, zero_run; int num_ext_blocks_v1, num_ext_blocks_v2; + uint8_t ext_mapping_idc; uint32_t crc; uint8_t *dst; if (!metadata) { @@ -551,7 +552,8 @@ int ff_dovi_rpu_generate(DOVIContext *s, const AVDOVIMetadata *metadata, put_bits(pb, 1, hdr->bl_video_full_range_flag); if ((hdr->rpu_format & 0x700) == 0) { set_ue_golomb(pb, hdr->bl_bit_depth - 8); - set_ue_golomb(pb, hdr->el_bit_depth - 8); + ext_mapping_idc = (hdr->ext_mapping_idc_5_7 << 5) | hdr->ext_mapping_idc_0_4; + set_ue_golomb(pb, (ext_mapping_idc << 8) | hdr->el_bit_depth - 8); set_ue_golomb(pb, hdr->vdr_bit_depth - 8); put_bits(pb, 1, hdr->spatial_resampling_filter_flag); put_bits(pb, 3, 0); /* reserved_zero_3bits */ diff --git a/libavutil/dovi_meta.h b/libavutil/dovi_meta.h index e10332f8d7..d01bfe19fe 100644 --- a/libavutil/dovi_meta.h +++ b/libavutil/dovi_meta.h @@ -87,6 +87,8 @@ typedef struct AVDOVIRpuDataHeader { uint8_t bl_video_full_range_flag; uint8_t bl_bit_depth; /* [8, 16] */ uint8_t el_bit_depth; /* [8, 16] */ + uint8_t ext_mapping_idc_0_4; /* extended base layer inverse mapping indicator */ + uint8_t ext_mapping_idc_5_7; /* reserved */ uint8_t vdr_bit_depth; /* [8, 16] */ uint8_t spatial_resampling_filter_flag; uint8_t el_spatial_resampling_filter_flag; -- 2.42.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] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] avcodec/dovi - correctly read el_bit_depth_minus8 and ext_mapping_idc 2024-05-21 18:39 ` [FFmpeg-devel] [PATCH v2] avcodec/dovi - correctly read el_bit_depth_minus8 and ext_mapping_idc Cosmin Stejerean via ffmpeg-devel @ 2024-05-22 4:19 ` Andreas Rheinhardt [not found] ` <0933A15D-25B1-4AB6-99D7-1389D3561AE8@cosmin.at> 0 siblings, 1 reply; 3+ messages in thread From: Andreas Rheinhardt @ 2024-05-22 4:19 UTC (permalink / raw) To: ffmpeg-devel Cosmin Stejerean via ffmpeg-devel: > From: Cosmin Stejerean <cosmin@cosmin.at> > > These two fields are coded together into a single 16 bit integer with upper 8 > bits for ext_mapping_idc and lower 8 bits for el_bit_depth_minus8. > > Furthermore ext_mapping_idc has two components, upper 3 bits and lower 5 bits. How do you know about these fields? You seem to know something that Niklas doesn't. > > --- > libavcodec/dovi_rpudec.c | 7 ++++++- > libavcodec/dovi_rpuenc.c | 4 +++- > libavutil/dovi_meta.h | 2 ++ > 3 files changed, 11 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/dovi_rpudec.c b/libavcodec/dovi_rpudec.c > index 7c7eda9d09..af41ab5827 100644 > --- a/libavcodec/dovi_rpudec.c > +++ b/libavcodec/dovi_rpudec.c > @@ -411,13 +411,18 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size, > > if ((hdr->rpu_format & 0x700) == 0) { > int bl_bit_depth_minus8 = get_ue_golomb_31(gb); > - int el_bit_depth_minus8 = get_ue_golomb_31(gb); > + int el_bit_depth_minus8_and_ext_mapping_idc = get_ue_golomb_long(gb); > + int el_bit_depth_minus8 = el_bit_depth_minus8_and_ext_mapping_idc & 0xFF; // lowest 8 bits > + int ext_mapping_idc = (el_bit_depth_minus8_and_ext_mapping_idc & 0xFF00) >> 8; // upper 8 bits > + > int vdr_bit_depth_minus8 = get_ue_golomb_31(gb); > VALIDATE(bl_bit_depth_minus8, 0, 8); > VALIDATE(el_bit_depth_minus8, 0, 8); > VALIDATE(vdr_bit_depth_minus8, 0, 8); > hdr->bl_bit_depth = bl_bit_depth_minus8 + 8; > hdr->el_bit_depth = el_bit_depth_minus8 + 8; > + hdr->ext_mapping_idc_0_4 = ext_mapping_idc & 0x1F; // lowest 5 bits of ext_mapping_idc > + hdr->ext_mapping_idc_5_7 = (ext_mapping_idc & 0xE0) >> 5; // upper 3 bits of ext_mapping_idc > hdr->vdr_bit_depth = vdr_bit_depth_minus8 + 8; > hdr->spatial_resampling_filter_flag = get_bits1(gb); > skip_bits(gb, 3); /* reserved_zero_3bits */ > diff --git a/libavcodec/dovi_rpuenc.c b/libavcodec/dovi_rpuenc.c > index 3c3e0f84c0..91c0a85050 100644 > --- a/libavcodec/dovi_rpuenc.c > +++ b/libavcodec/dovi_rpuenc.c > @@ -444,6 +444,7 @@ int ff_dovi_rpu_generate(DOVIContext *s, const AVDOVIMetadata *metadata, > int vdr_dm_metadata_changed, vdr_rpu_id, use_prev_vdr_rpu, profile, > buffer_size, rpu_size, pad, zero_run; > int num_ext_blocks_v1, num_ext_blocks_v2; > + uint8_t ext_mapping_idc; > uint32_t crc; > uint8_t *dst; > if (!metadata) { > @@ -551,7 +552,8 @@ int ff_dovi_rpu_generate(DOVIContext *s, const AVDOVIMetadata *metadata, > put_bits(pb, 1, hdr->bl_video_full_range_flag); > if ((hdr->rpu_format & 0x700) == 0) { > set_ue_golomb(pb, hdr->bl_bit_depth - 8); > - set_ue_golomb(pb, hdr->el_bit_depth - 8); > + ext_mapping_idc = (hdr->ext_mapping_idc_5_7 << 5) | hdr->ext_mapping_idc_0_4; > + set_ue_golomb(pb, (ext_mapping_idc << 8) | hdr->el_bit_depth - 8); > set_ue_golomb(pb, hdr->vdr_bit_depth - 8); > put_bits(pb, 1, hdr->spatial_resampling_filter_flag); > put_bits(pb, 3, 0); /* reserved_zero_3bits */ > diff --git a/libavutil/dovi_meta.h b/libavutil/dovi_meta.h > index e10332f8d7..d01bfe19fe 100644 > --- a/libavutil/dovi_meta.h > +++ b/libavutil/dovi_meta.h > @@ -87,6 +87,8 @@ typedef struct AVDOVIRpuDataHeader { > uint8_t bl_video_full_range_flag; > uint8_t bl_bit_depth; /* [8, 16] */ > uint8_t el_bit_depth; /* [8, 16] */ > + uint8_t ext_mapping_idc_0_4; /* extended base layer inverse mapping indicator */ > + uint8_t ext_mapping_idc_5_7; /* reserved */ This is an ABI break. All new additions need to be put at the end. Furthermore this needs an entry in APIChanges and a lavu minor version bump. And it should be in a patch of its own. > uint8_t vdr_bit_depth; /* [8, 16] */ > uint8_t spatial_resampling_filter_flag; > uint8_t el_spatial_resampling_filter_flag; _______________________________________________ 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] 3+ messages in thread
[parent not found: <0933A15D-25B1-4AB6-99D7-1389D3561AE8@cosmin.at>]
* Re: [FFmpeg-devel] [PATCH v2] avcodec/dovi - correctly read el_bit_depth_minus8 and ext_mapping_idc [not found] ` <0933A15D-25B1-4AB6-99D7-1389D3561AE8@cosmin.at> @ 2024-05-22 15:50 ` Cosmin Stejerean via ffmpeg-devel 0 siblings, 0 replies; 3+ messages in thread From: Cosmin Stejerean via ffmpeg-devel @ 2024-05-22 15:50 UTC (permalink / raw) To: FFmpeg development discussions and patches; +Cc: Cosmin Stejerean > On May 21, 2024, at 9:19 PM, Andreas Rheinhardt <andreas.rheinhardt@outlook.com> wrote: > > Cosmin Stejerean via ffmpeg-devel: >> From: Cosmin Stejerean <cosmin@cosmin.at> >> >> These two fields are coded together into a single 16 bit integer with upper 8 >> bits for ext_mapping_idc and lower 8 bits for el_bit_depth_minus8. >> >> Furthermore ext_mapping_idc has two components, upper 3 bits and lower 5 bits. > > How do you know about these fields? You seem to know something that > Niklas doesn't. I can see them in the output of the DoVi verifier. RPU Header ... | Sequence header ... | BL_video_full_range_flag 0 | BL_bit_depth 10 | EL_bit_depth 10 | ext_mapping_idc[4:0] 1 | ext_mapping_idc[7:5] 4 | vdr_bit_depth 12 ... >> --- a/libavutil/dovi_meta.h >> +++ b/libavutil/dovi_meta.h >> @@ -87,6 +87,8 @@ typedef struct AVDOVIRpuDataHeader { >> uint8_t bl_video_full_range_flag; >> uint8_t bl_bit_depth; /* [8, 16] */ >> uint8_t el_bit_depth; /* [8, 16] */ >> + uint8_t ext_mapping_idc_0_4; /* extended base layer inverse mapping indicator */ >> + uint8_t ext_mapping_idc_5_7; /* reserved */ > > This is an ABI break. All new additions need to be put at the end. > Furthermore this needs an entry in APIChanges and a lavu minor version > bump. And it should be in a patch of its own. Ok, sending v3. - Cosmin _______________________________________________ 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] 3+ messages in thread
end of thread, other threads:[~2024-05-22 15:50 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <20240521183905.76407-1-cosmin@cosmin.at> 2024-05-21 18:39 ` [FFmpeg-devel] [PATCH v2] avcodec/dovi - correctly read el_bit_depth_minus8 and ext_mapping_idc Cosmin Stejerean via ffmpeg-devel 2024-05-22 4:19 ` Andreas Rheinhardt [not found] ` <0933A15D-25B1-4AB6-99D7-1389D3561AE8@cosmin.at> 2024-05-22 15:50 ` Cosmin Stejerean via ffmpeg-devel
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