Opened 5 years ago
Closed 5 years ago
#8752 closed defect (fixed)
hevc_metadata: VUI fields not correctly inferred
Reported by: | MetalThrashingManiac | Owned by: | |
---|---|---|---|
Priority: | important | Component: | avcodec |
Version: | git-master | Keywords: | hevc regression |
Cc: | stw392@blue-cable.de | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | yes |
Description
Hi. When applying the hevc_metadata bsf to a stream without VUI information, the values in H265SPS.vui are not correctly inferred, especially the fields inferred by bitstream_restriction_flag. When setting VUI fields such as colour_primaries, cbs_h265_write_vui_parameters will error out.
Source of the error could be in cbs_h265_read_sps, which only checks for vui_parameters_present_flag and - if 0 - does not call cbs_h265_read_vui_parameters (that would infer the parameters).
Change History (5)
comment:1 by , 5 years ago
Cc: | added |
---|
comment:2 by , 5 years ago
Keywords: | hevc added |
---|
comment:3 by , 5 years ago
Analyzed by developer: | set |
---|---|
Keywords: | cbs added |
Priority: | normal → important |
Status: | new → open |
Version: | unspecified → git-master |
Probably a regression since ef13fafe229a86480305fbb05e83208102ea962f.
Does the following patch fix the issue for you?
From 6b1b0b9381c8342c48b4c3703e860f09b2cbaf55 Mon Sep 17 00:00:00 2001 From: James Almer <jamrial@gmail.com> Date: Sun, 21 Jun 2020 15:30:45 -0300 Subject: [PATCH] avcodec/cbs_h265: set default VUI parameters when vui_parameters_present_flag is false Based on cbs_h264 code. Signed-off-by: James Almer <jamrial@gmail.com> --- libavcodec/cbs_h265_syntax_template.c | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/libavcodec/cbs_h265_syntax_template.c b/libavcodec/cbs_h265_syntax_template.c index 5b7d1aa837..48fae82d04 100644 --- a/libavcodec/cbs_h265_syntax_template.c +++ b/libavcodec/cbs_h265_syntax_template.c @@ -744,6 +744,32 @@ static int FUNC(sps_scc_extension)(CodedBitstreamContext *ctx, RWContext *rw, return 0; } +static int FUNC(vui_parameters_default)(CodedBitstreamContext *ctx, + RWContext *rw, H265RawVUI *current, + H265RawSPS *sps) +{ + infer(aspect_ratio_idc, 0); + + infer(video_format, 5); + infer(video_full_range_flag, 0); + infer(colour_primaries, 2); + infer(transfer_characteristics, 2); + infer(matrix_coefficients, 2); + + infer(chroma_sample_loc_type_top_field, 0); + infer(chroma_sample_loc_type_bottom_field, 0); + + infer(tiles_fixed_structure_flag, 0); + infer(motion_vectors_over_pic_boundaries_flag, 1); + infer(min_spatial_segmentation_idc, 0); + infer(max_bytes_per_pic_denom, 2); + infer(max_bits_per_min_cu_denom, 1); + infer(log2_max_mv_length_horizontal, 15); + infer(log2_max_mv_length_vertical, 15); + + return 0; +} + static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw, H265RawSPS *current) { @@ -908,6 +934,8 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw, flag(vui_parameters_present_flag); if (current->vui_parameters_present_flag) CHECK(FUNC(vui_parameters)(ctx, rw, ¤t->vui, current)); + else + CHECK(FUNC(vui_parameters_default)(ctx, rw, ¤t->vui, current)); flag(sps_extension_present_flag); if (current->sps_extension_present_flag) { -- 2.27.0
comment:4 by , 5 years ago
Keywords: | regression added; cbs removed |
---|
comment:5 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | open → closed |
Pushed the above patch as d1c55fc46019229b5526768ffdb0e1e67beb21ff. Feel free to reopen the ticket if it didn't fix the issue.
Please test current FFmpeg git head, provide the command line you tested together with the complete, uncut console output and attach an input sample to make this a valid ticket.