Lines Matching refs:sh
330 READ_UE(gb, &s->sh.luma_log2_weight_denom); in pred_weight_table()
334 s->sh.chroma_log2_weight_denom = mpp_clip(s->sh.luma_log2_weight_denom + delta, 0, 7); in pred_weight_table()
337 for (i = 0; i < s->sh.nb_refs[L0]; i++) { in pred_weight_table()
340 s->sh.luma_weight_l0[i] = 1 << s->sh.luma_log2_weight_denom; in pred_weight_table()
341 s->sh.luma_offset_l0[i] = 0; in pred_weight_table()
346 for (i = 0; i < s->sh.nb_refs[L0]; i++) { in pred_weight_table()
350 for (i = 0; i < s->sh.nb_refs[L0]; i++) in pred_weight_table()
354 for (i = 0; i < s->sh.nb_refs[L0]; i++) { in pred_weight_table()
358 s->sh.luma_weight_l0[i] = (1 << s->sh.luma_log2_weight_denom) + delta_luma_weight_l0; in pred_weight_table()
359 READ_SE(gb, &s->sh.luma_offset_l0[i]); in pred_weight_table()
367 … s->sh.chroma_weight_l0[i][j] = (1 << s->sh.chroma_log2_weight_denom) + delta_chroma_weight_l0; in pred_weight_table()
368 …s->sh.chroma_offset_l0[i][j] = mpp_clip((delta_chroma_offset_l0 - ((128 * s->sh.chroma_weight_l0[i… in pred_weight_table()
369 … >> s->sh.chroma_log2_weight_denom) + 128), -128, 127); in pred_weight_table()
372 s->sh.chroma_weight_l0[i][0] = 1 << s->sh.chroma_log2_weight_denom; in pred_weight_table()
373 s->sh.chroma_offset_l0[i][0] = 0; in pred_weight_table()
374 s->sh.chroma_weight_l0[i][1] = 1 << s->sh.chroma_log2_weight_denom; in pred_weight_table()
375 s->sh.chroma_offset_l0[i][1] = 0; in pred_weight_table()
379 if (s->sh.slice_type == B_SLICE) { in pred_weight_table()
380 for (i = 0; i < s->sh.nb_refs[L1]; i++) { in pred_weight_table()
383 s->sh.luma_weight_l1[i] = 1 << s->sh.luma_log2_weight_denom; in pred_weight_table()
384 s->sh.luma_offset_l1[i] = 0; in pred_weight_table()
388 for (i = 0; i < s->sh.nb_refs[L1]; i++) in pred_weight_table()
391 for (i = 0; i < s->sh.nb_refs[L1]; i++) in pred_weight_table()
394 for (i = 0; i < s->sh.nb_refs[L1]; i++) { in pred_weight_table()
398 … s->sh.luma_weight_l1[i] = (1 << s->sh.luma_log2_weight_denom) + delta_luma_weight_l1; in pred_weight_table()
399 READ_SE(gb, &s->sh.luma_offset_l1[i]); in pred_weight_table()
407 … s->sh.chroma_weight_l1[i][j] = (1 << s->sh.chroma_log2_weight_denom) + delta_chroma_weight_l1; in pred_weight_table()
408 …s->sh.chroma_offset_l1[i][j] = mpp_clip((delta_chroma_offset_l1 - ((128 * s->sh.chroma_weight_l1[i… in pred_weight_table()
409 … >> s->sh.chroma_log2_weight_denom) + 128), -128, 127); in pred_weight_table()
412 s->sh.chroma_weight_l1[i][0] = 1 << s->sh.chroma_log2_weight_denom; in pred_weight_table()
413 s->sh.chroma_offset_l1[i][0] = 0; in pred_weight_table()
414 s->sh.chroma_weight_l1[i][1] = 1 << s->sh.chroma_log2_weight_denom; in pred_weight_table()
415 s->sh.chroma_offset_l1[i][1] = 0; in pred_weight_table()
475 rps->poc[i] += s->poc - delta * max_poc_lsb - s->sh.pic_order_cnt_lsb; in decode_lt_rps()
534 static RK_S32 compare_sliceheader(SliceHeader *openhevc_sh, SliceHeader *sh) in compare_sliceheader() argument
537 if (openhevc_sh->pps_id != sh->pps_id) { in compare_sliceheader()
542 if (openhevc_sh->slice_type != sh->slice_type) { in compare_sliceheader()
547 if (openhevc_sh->pic_order_cnt_lsb != sh->pic_order_cnt_lsb) { in compare_sliceheader()
552 if (openhevc_sh->first_slice_in_pic_flag != sh->first_slice_in_pic_flag) { in compare_sliceheader()
557 if (openhevc_sh->dependent_slice_segment_flag != sh->dependent_slice_segment_flag) { in compare_sliceheader()
562 if (openhevc_sh->pic_output_flag != sh->pic_output_flag) { in compare_sliceheader()
567 if (openhevc_sh->colour_plane_id != sh->colour_plane_id) { in compare_sliceheader()
572 if (openhevc_sh->rpl_modification_flag[0] != sh->rpl_modification_flag[0]) { in compare_sliceheader()
577 if (openhevc_sh->rpl_modification_flag[1] != sh->rpl_modification_flag[1]) { in compare_sliceheader()
582 if (openhevc_sh->no_output_of_prior_pics_flag != sh->no_output_of_prior_pics_flag) { in compare_sliceheader()
587 if (openhevc_sh->slice_temporal_mvp_enabled_flag != sh->slice_temporal_mvp_enabled_flag) { in compare_sliceheader()
592 if (openhevc_sh->nb_refs[0] != sh->nb_refs[0]) { in compare_sliceheader()
597 if (openhevc_sh->nb_refs[1] != sh->nb_refs[1]) { in compare_sliceheader()
603 sh->slice_sample_adaptive_offset_flag[0]) { in compare_sliceheader()
609 sh->slice_sample_adaptive_offset_flag[1]) { in compare_sliceheader()
615 sh->slice_sample_adaptive_offset_flag[2]) { in compare_sliceheader()
620 if (openhevc_sh->mvd_l1_zero_flag != sh->mvd_l1_zero_flag) { in compare_sliceheader()
624 if (openhevc_sh->cabac_init_flag != sh->cabac_init_flag) { in compare_sliceheader()
630 sh->disable_deblocking_filter_flag) { in compare_sliceheader()
636 sh->slice_loop_filter_across_slices_enabled_flag) { in compare_sliceheader()
641 if (openhevc_sh->collocated_list != sh->collocated_list) { in compare_sliceheader()
646 if (openhevc_sh->collocated_ref_idx != sh->collocated_ref_idx) { in compare_sliceheader()
651 if (openhevc_sh->slice_qp_delta != sh->slice_qp_delta) { in compare_sliceheader()
656 if (openhevc_sh->slice_cb_qp_offset != sh->slice_cb_qp_offset) { in compare_sliceheader()
661 if (openhevc_sh->slice_cr_qp_offset != sh->slice_cr_qp_offset) { in compare_sliceheader()
666 if (openhevc_sh->beta_offset != sh->beta_offset) { in compare_sliceheader()
671 if (openhevc_sh->tc_offset != sh->tc_offset) { in compare_sliceheader()
676 if (openhevc_sh->max_num_merge_cand != sh->max_num_merge_cand) { in compare_sliceheader()
681 if (openhevc_sh->num_entry_point_offsets != sh->num_entry_point_offsets) { in compare_sliceheader()
686 if (openhevc_sh->slice_qp != sh->slice_qp) { in compare_sliceheader()
691 if (openhevc_sh->luma_log2_weight_denom != sh->luma_log2_weight_denom) { in compare_sliceheader()
696 if (openhevc_sh->chroma_log2_weight_denom != sh->chroma_log2_weight_denom) { in compare_sliceheader()
712 SliceHeader *sh = &s->sh; in hls_slice_header() local
724 READ_ONEBIT(gb, &sh->first_slice_in_pic_flag); in hls_slice_header()
725 if ((IS_IDR(s) || IS_BLA(s)) && sh->first_slice_in_pic_flag) { in hls_slice_header()
732 READ_ONEBIT(gb, &sh->no_output_of_prior_pics_flag); in hls_slice_header()
734 if (IS_IRAP(s) && s->miss_ref_flag && sh->first_slice_in_pic_flag) { in hls_slice_header()
745 sh->pps_id = pps_id; in hls_slice_header()
752 if (!sh->first_slice_in_pic_flag && in hls_slice_header()
753 s->pps != (HEVCPPS*)s->pps_list[sh->pps_id]) { in hls_slice_header()
757 s->pps = (HEVCPPS*)s->pps_list[sh->pps_id]; in hls_slice_header()
776 sh->dependent_slice_segment_flag = 0; in hls_slice_header()
777 if (!sh->first_slice_in_pic_flag) { in hls_slice_header()
781 READ_ONEBIT(gb, &sh->dependent_slice_segment_flag); in hls_slice_header()
786 READ_BITS(gb, slice_address_length, &sh->slice_segment_addr); in hls_slice_header()
788 if (sh->slice_segment_addr >= (RK_U32)(s->sps->ctb_width * s->sps->ctb_height)) { in hls_slice_header()
791 sh->slice_segment_addr); in hls_slice_header()
795 if (!sh->dependent_slice_segment_flag) { in hls_slice_header()
796 sh->slice_addr = sh->slice_segment_addr; in hls_slice_header()
800 sh->slice_segment_addr = sh->slice_addr = 0; in hls_slice_header()
805 if (!sh->dependent_slice_segment_flag) { in hls_slice_header()
811 READ_UE(gb, &sh->slice_type); in hls_slice_header()
812 if (!(sh->slice_type == I_SLICE || in hls_slice_header()
813 sh->slice_type == P_SLICE || in hls_slice_header()
814 sh->slice_type == B_SLICE)) { in hls_slice_header()
816 sh->slice_type); in hls_slice_header()
819 if (!s->decoder_id && IS_IRAP(s) && sh->slice_type != I_SLICE) { in hls_slice_header()
825 READ_ONEBIT(gb, &sh->pic_output_flag); in hls_slice_header()
828 READ_BITS(gb, 2, &sh->colour_plane_id ); in hls_slice_header()
833 READ_BITS(gb, s->sps->log2_max_poc_lsb, &sh->pic_order_cnt_lsb); in hls_slice_header()
834 poc = mpp_hevc_compute_poc(s, sh->pic_order_cnt_lsb); in hls_slice_header()
835 if (!sh->first_slice_in_pic_flag && poc != s->poc) { in hls_slice_header()
845 READ_ONEBIT(gb, &sh->short_term_ref_pic_set_sps_flag); in hls_slice_header()
849 if (!sh->short_term_ref_pic_set_sps_flag) { in hls_slice_header()
851 ret = mpp_hevc_decode_short_term_rps(s, &sh->slice_rps, s->sps, 1); in hls_slice_header()
855 sh->short_term_rps = &sh->slice_rps; in hls_slice_header()
869 if (sh->short_term_rps != &s->sps->st_rps[rps_idx]) in hls_slice_header()
871 sh->short_term_rps = &s->sps->st_rps[rps_idx]; in hls_slice_header()
876 sh->short_term_ref_pic_set_size = s->rps_bit_offset_st[s->slice_idx]; in hls_slice_header()
878 ret = decode_lt_rps(s, &sh->long_term_rps, gb); in hls_slice_header()
886 READ_ONEBIT(gb, &sh->slice_temporal_mvp_enabled_flag); in hls_slice_header()
888 sh->slice_temporal_mvp_enabled_flag = 0; in hls_slice_header()
890 s->sh.short_term_rps = NULL; in hls_slice_header()
906 READ_ONEBIT(gb, &sh->slice_sample_adaptive_offset_flag[0]); in hls_slice_header()
908 READ_ONEBIT(gb, &sh->slice_sample_adaptive_offset_flag[1]); in hls_slice_header()
909 sh->slice_sample_adaptive_offset_flag[2] = in hls_slice_header()
910 sh->slice_sample_adaptive_offset_flag[1]; in hls_slice_header()
912 sh->slice_sample_adaptive_offset_flag[1] = 0; in hls_slice_header()
913 sh->slice_sample_adaptive_offset_flag[2] = 0; in hls_slice_header()
916 sh->slice_sample_adaptive_offset_flag[0] = 0; in hls_slice_header()
917 sh->slice_sample_adaptive_offset_flag[1] = 0; in hls_slice_header()
918 sh->slice_sample_adaptive_offset_flag[2] = 0; in hls_slice_header()
921 sh->nb_refs[L0] = sh->nb_refs[L1] = 0; in hls_slice_header()
922 if (sh->slice_type == P_SLICE || sh->slice_type == B_SLICE) { in hls_slice_header()
925 sh->nb_refs[L0] = s->pps->num_ref_idx_l0_default_active; in hls_slice_header()
926 if (sh->slice_type == B_SLICE) in hls_slice_header()
927 sh->nb_refs[L1] = s->pps->num_ref_idx_l1_default_active; in hls_slice_header()
932 READ_UE(gb, &sh->nb_refs[L0]); in hls_slice_header()
933 sh->nb_refs[L0] += 1; in hls_slice_header()
934 if (sh->slice_type == B_SLICE) { in hls_slice_header()
935 READ_UE(gb, &sh->nb_refs[L1]); in hls_slice_header()
936 sh->nb_refs[L1] += 1; in hls_slice_header()
939 if (sh->nb_refs[L0] > MAX_REFS || sh->nb_refs[L1] > MAX_REFS) { in hls_slice_header()
941 sh->nb_refs[L0], sh->nb_refs[L1]); in hls_slice_header()
945 sh->rpl_modification_flag[0] = 0; in hls_slice_header()
946 sh->rpl_modification_flag[1] = 0; in hls_slice_header()
954 READ_ONEBIT(gb, &sh->rpl_modification_flag[0]); in hls_slice_header()
955 if (sh->rpl_modification_flag[0]) { in hls_slice_header()
956 for (i = 0; (RK_U32)i < sh->nb_refs[L0]; i++) in hls_slice_header()
957 READ_BITS(gb, mpp_ceil_log2(nb_refs), &sh->list_entry_lx[0][i]); in hls_slice_header()
960 if (sh->slice_type == B_SLICE) { in hls_slice_header()
961 READ_ONEBIT(gb, &sh->rpl_modification_flag[1]); in hls_slice_header()
962 if (sh->rpl_modification_flag[1] == 1) in hls_slice_header()
963 for (i = 0; (RK_U32)i < sh->nb_refs[L1]; i++) in hls_slice_header()
964 READ_BITS(gb, mpp_ceil_log2(nb_refs), &sh->list_entry_lx[1][i]); in hls_slice_header()
968 if (sh->slice_type == B_SLICE) in hls_slice_header()
969 READ_ONEBIT(gb, &sh->mvd_l1_zero_flag); in hls_slice_header()
972 READ_ONEBIT(gb, &sh->cabac_init_flag); in hls_slice_header()
974 sh->cabac_init_flag = 0; in hls_slice_header()
976 sh->collocated_ref_idx = 0; in hls_slice_header()
977 if (sh->slice_temporal_mvp_enabled_flag) { in hls_slice_header()
978 sh->collocated_list = L0; in hls_slice_header()
979 if (sh->slice_type == B_SLICE) { in hls_slice_header()
981 sh->collocated_list = !value; in hls_slice_header()
984 if (sh->nb_refs[sh->collocated_list] > 1) { in hls_slice_header()
985 READ_UE(gb, &sh->collocated_ref_idx); in hls_slice_header()
986 if (sh->collocated_ref_idx >= sh->nb_refs[sh->collocated_list]) { in hls_slice_header()
989 sh->collocated_ref_idx); in hls_slice_header()
995 if ((s->pps->weighted_pred_flag && sh->slice_type == P_SLICE) || in hls_slice_header()
996 (s->pps->weighted_bipred_flag && sh->slice_type == B_SLICE)) { in hls_slice_header()
1001 sh->max_num_merge_cand = 5 - value; in hls_slice_header()
1002 if (sh->max_num_merge_cand < 1 || sh->max_num_merge_cand > 5) { in hls_slice_header()
1005 sh->max_num_merge_cand); in hls_slice_header()
1009 READ_SE(gb, &sh->slice_qp_delta ); in hls_slice_header()
1011 READ_SE(gb, &sh->slice_cb_qp_offset); in hls_slice_header()
1012 READ_SE(gb, &sh->slice_cr_qp_offset); in hls_slice_header()
1014 sh->slice_cb_qp_offset = 0; in hls_slice_header()
1015 sh->slice_cr_qp_offset = 0; in hls_slice_header()
1025 READ_ONEBIT(gb, &sh->disable_deblocking_filter_flag); in hls_slice_header()
1026 if (!sh->disable_deblocking_filter_flag) { in hls_slice_header()
1027 READ_SE(gb, &sh->beta_offset); in hls_slice_header()
1028 sh->beta_offset = sh->beta_offset * 2; in hls_slice_header()
1029 READ_SE(gb, &sh->tc_offset); in hls_slice_header()
1030 sh->tc_offset = sh->tc_offset * 2; in hls_slice_header()
1033 sh->disable_deblocking_filter_flag = s->pps->disable_dbf; in hls_slice_header()
1034 sh->beta_offset = s->pps->beta_offset; in hls_slice_header()
1035 sh->tc_offset = s->pps->tc_offset; in hls_slice_header()
1038 sh->disable_deblocking_filter_flag = 0; in hls_slice_header()
1039 sh->beta_offset = 0; in hls_slice_header()
1040 sh->tc_offset = 0; in hls_slice_header()
1044 (sh->slice_sample_adaptive_offset_flag[0] || in hls_slice_header()
1045 sh->slice_sample_adaptive_offset_flag[1] || in hls_slice_header()
1046 !sh->disable_deblocking_filter_flag)) { in hls_slice_header()
1047 READ_ONEBIT(gb, &sh->slice_loop_filter_across_slices_enabled_flag); in hls_slice_header()
1049 …sh->slice_loop_filter_across_slices_enabled_flag = s->pps->seq_loop_filter_across_slices_enabled_f… in hls_slice_header()
1056 sh->num_entry_point_offsets = 0; in hls_slice_header()
1058 READ_UE(gb, &sh->num_entry_point_offsets); in hls_slice_header()
1060 … if (sh->num_entry_point_offsets > s->sps->ctb_height || sh->num_entry_point_offsets < 0) { in hls_slice_header()
1062 sh->num_entry_point_offsets, in hls_slice_header()
1067 …if (sh->num_entry_point_offsets > s->sps->ctb_height * s->sps->ctb_width || sh->num_entry_point_of… in hls_slice_header()
1069 sh->num_entry_point_offsets, in hls_slice_header()
1074 if (sh->num_entry_point_offsets) { in hls_slice_header()
1078 for (i = 0; i < sh->num_entry_point_offsets; i++) in hls_slice_header()
1095 sh->slice_qp = 26U + s->pps->pic_init_qp_minus26 + sh->slice_qp_delta; in hls_slice_header()
1096 if (sh->slice_qp > 51 || in hls_slice_header()
1097 sh->slice_qp < -s->sps->qp_bd_offset) { in hls_slice_header()
1100 sh->slice_qp, in hls_slice_header()
1104 if (s->h265dctx->compare_info != NULL && sh->first_slice_in_pic_flag) { in hls_slice_header()
1106 SliceHeader *openhevc_sh = (SliceHeader *)&info->sh; in hls_slice_header()
1108 if (compare_sliceheader(openhevc_sh, &s->sh) < 0) { in hls_slice_header()
1115 sh->slice_ctb_addr_rs = sh->slice_segment_addr; in hls_slice_header()
1117 if (!s->sh.slice_ctb_addr_rs && s->sh.dependent_slice_segment_flag) { in hls_slice_header()
1489 if (s->sh.first_slice_in_pic_flag) { in parser_nal_unit()
1506 if (!s->sh.dependent_slice_segment_flag && in parser_nal_unit()
1507 s->sh.slice_type != I_SLICE) { in parser_nal_unit()