Cf. F.7.3.6.1 "General slice segment header syntax"
Unified · Split
| @@ -584,7 +584,8 @@ static int hls_slice_header(SliceHeader *sh, const HEVCContext *s, GetBitContext · 583 unmodified lines | ||
| 584 | 584 | { |
| 585 | 585 | const HEVCPPS *pps; |
| 586 | 586 | const HEVCSPS *sps; |
| 587 | − unsigned pps_id; | |
| 587 | + const HEVCVPS *vps; | |
| 588 | + unsigned pps_id, layer_idx; | |
| 588 | 589 | int i, ret; |
| 589 | 590 | |
| 590 | 591 | // Coded parameters |
| @@ -607,6 +608,8 @@ static int hls_slice_header(SliceHeader *sh, const HEVCContext *s, GetBitContext · 16 unmodified lines | ||
| 607 | 608 | |
| 608 | 609 | pps = s->ps.pps_list[pps_id]; |
| 609 | 610 | sps = pps->sps; |
| 611 | + vps = sps->vps; | |
| 612 | + layer_idx = vps->layer_idx[s->nuh_layer_id]; | |
| 610 | 613 | |
| 611 | 614 | if (s->nal_unit_type == HEVC_NAL_CRA_NUT && s->last_eos == 1) |
| 612 | 615 | sh->no_output_of_prior_pics_flag = 1; |
| @@ -652,7 +655,8 @@ static int hls_slice_header(SliceHeader *sh, const HEVCContext *s, GetBitContext · 39 unmodified lines | ||
| 652 | 655 | return AVERROR_INVALIDDATA; |
| 653 | 656 | } |
| 654 | 657 | if (IS_IRAP(s) && sh->slice_type != HEVC_SLICE_I && |
| 655 | − !pps->pps_curr_pic_ref_enabled_flag) { | |
| 658 | + !pps->pps_curr_pic_ref_enabled_flag && | |
| 659 | + s->nuh_layer_id == 0) { | |
| 656 | 660 | av_log(s->avctx, AV_LOG_ERROR, "Inter slices in an IRAP frame.\n"); |
| 657 | 661 | return AVERROR_INVALIDDATA; |
| 658 | 662 | } |
| @@ -665,8 +669,10 @@ static int hls_slice_header(SliceHeader *sh, const HEVCContext *s, GetBitContext · 6 unmodified lines | ||
| 665 | 669 | if (sps->separate_colour_plane) |
| 666 | 670 | sh->colour_plane_id = get_bits(gb, 2); |
| 667 | 671 | |
| 668 | − if (!IS_IDR(s)) { | |
| 669 | − int poc, pos; | |
| 672 | + if (!IS_IDR(s) || | |
| 673 | + (s->nuh_layer_id > 0 && | |
| 674 | + !(vps->poc_lsb_not_present & (1 << layer_idx)))) { | |
| 675 | + int poc; | |
| 670 | 676 | |
| 671 | 677 | sh->pic_order_cnt_lsb = get_bits(gb, sps->log2_max_poc_lsb); |
| 672 | 678 | poc = ff_hevc_compute_poc(sps, s->poc_tid0, sh->pic_order_cnt_lsb, s->nal_unit_type); |
| @@ -678,6 +684,10 @@ static int hls_slice_header(SliceHeader *sh, const HEVCContext *s, GetBitContext · 5 unmodified lines | ||
| 678 | 684 | poc = sh->poc; |
| 679 | 685 | } |
| 680 | 686 | sh->poc = poc; |
| 687 | + } | |
| 688 | + | |
| 689 | + if (!IS_IDR(s)) { | |
| 690 | + int pos; | |
| 681 | 691 | |
| 682 | 692 | sh->short_term_ref_pic_set_sps_flag = get_bits1(gb); |
| 683 | 693 | pos = get_bits_left(gb); |
| @@ -724,6 +734,23 @@ static int hls_slice_header(SliceHeader *sh, const HEVCContext *s, GetBitContext · 40 unmodified lines | ||
| 724 | 734 | sh->slice_temporal_mvp_enabled_flag = 0; |
| 725 | 735 | } |
| 726 | 736 | |
| 737 | + sh->inter_layer_pred = 0; | |
| 738 | + if (s->nuh_layer_id > 0) { | |
| 739 | + int num_direct_ref_layers = vps->num_direct_ref_layers[layer_idx]; | |
| 740 | + | |
| 741 | + if (vps->default_ref_layers_active) | |
| 742 | + sh->inter_layer_pred = !!num_direct_ref_layers; | |
| 743 | + else if (num_direct_ref_layers) { | |
| 744 | + sh->inter_layer_pred = get_bits1(gb); | |
| 745 | + | |
| 746 | + if (sh->inter_layer_pred && num_direct_ref_layers > 1) { | |
| 747 | + av_log(s->avctx, AV_LOG_ERROR, | |
| 748 | + "NumDirectRefLayers>1 not supported\n"); | |
| 749 | + return AVERROR_PATCHWELCOME; | |
| 750 | + } | |
| 751 | + } | |
| 752 | + } | |
| 753 | + | |
| 727 | 754 | if (sps->sao_enabled) { |
| 728 | 755 | sh->slice_sample_adaptive_offset_flag[0] = get_bits1(gb); |
| 729 | 756 | if (sps->chroma_format_idc) { |
| @@ -3238,6 +3265,7 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) · 2508 unmodified lines | ||
| 3238 | 3265 | int ret; |
| 3239 | 3266 | |
| 3240 | 3267 | s->nal_unit_type = nal->type; |
| 3268 | + s->nuh_layer_id = nal->nuh_layer_id; | |
| 3241 | 3269 | s->temporal_id = nal->temporal_id; |
| 3242 | 3270 | |
| 3243 | 3271 | if (FF_HW_HAS_CB(s->avctx, decode_params) && |
| @@ -215,6 +215,7 @@ typedef struct SliceHeader { · 214 unmodified lines | ||
| 215 | 215 | uint8_t dependent_slice_segment_flag; |
| 216 | 216 | uint8_t pic_output_flag; |
| 217 | 217 | uint8_t colour_plane_id; |
| 218 | + uint8_t inter_layer_pred; | |
| 218 | 219 | |
| 219 | 220 | ///< RPS coded in the slice header itself is stored here |
| 220 | 221 | int short_term_ref_pic_set_sps_flag; |