Lines Matching refs:ph
139 Avs2dPicHeader_t *ph = &p_dec->ph; in wq_init_frame_quant_param() local
141 if (!p_dec->enable_wq || ph->pic_wq_data_index != 1) { in wq_init_frame_quant_param()
146 if (ph->wq_param_index == 0) { in wq_init_frame_quant_param()
148 ph->pic_wq_param[i] = wq_param_default[DETAILED][i]; in wq_init_frame_quant_param()
150 } else if (ph->wq_param_index == 1) { in wq_init_frame_quant_param()
152 ph->pic_wq_param[i] = ph->wq_param_delta1[i] + wq_param_default[UNDETAILED][i]; in wq_init_frame_quant_param()
154 } else if (ph->wq_param_index == 2) { in wq_init_frame_quant_param()
156 ph->pic_wq_param[i] = ph->wq_param_delta2[i] + wq_param_default[DETAILED][i]; in wq_init_frame_quant_param()
163 k = WeightQuantModel[ph->wq_model][j * 8 + i]; in wq_init_frame_quant_param()
164 ph->pic_wq_matrix[1][j * 8 + i] = ph->pic_wq_param[k]; in wq_init_frame_quant_param()
170 k = WeightQuantModel4x4[ph->wq_model][j * 4 + i]; in wq_init_frame_quant_param()
171 ph->pic_wq_matrix[0][j * 4 + i] = ph->pic_wq_param[k]; in wq_init_frame_quant_param()
183 Avs2dPicHeader_t *ph = &p_dec->ph; in wq_update_frame_matrix() local
186 mpp_assert(ph->pic_wq_data_index <= 2); in wq_update_frame_matrix()
195 if (ph->pic_wq_data_index == 0) { in wq_update_frame_matrix()
198 frm_wqm = ph->pic_wq_matrix; in wq_update_frame_matrix()
428 static MPP_RET parse_pic_alf_params(BitReadCtx_t *bitctx, Avs2dPicHeader_t *ph) in parse_pic_alf_params() argument
433 READ_ONEBIT(bitctx, &ph->enable_pic_alf_y); in parse_pic_alf_params()
434 READ_ONEBIT(bitctx, &ph->enable_pic_alf_cb); in parse_pic_alf_params()
435 READ_ONEBIT(bitctx, &ph->enable_pic_alf_cr); in parse_pic_alf_params()
437 if (ph->enable_pic_alf_y) { in parse_pic_alf_params()
441 READ_UE(bitctx, &ph->alf_filter_num); in parse_pic_alf_params()
442 ph->alf_filter_num += 1; in parse_pic_alf_params()
443 if (ph->alf_filter_num > ALF_MAX_FILTERS) { in parse_pic_alf_params()
445 mpp_err_f("invalid alf filter num(%d).\n", ph->alf_filter_num); in parse_pic_alf_params()
449 for (i = 0; i < ph->alf_filter_num; i++) { in parse_pic_alf_params()
451 if (ph->alf_filter_num != 16) { in parse_pic_alf_params()
456 ph->alf_filter_pattern[symbol + pre_symbole] = 1; in parse_pic_alf_params()
460 FUN_CHECK(ret = read_pic_alf_coeff(bitctx, ph->alf_coeff_y[i])); in parse_pic_alf_params()
470 ph->alf_coeff_idx_tab[0] = 0; in parse_pic_alf_params()
472 ph->alf_coeff_idx_tab[i] = (ph->alf_filter_pattern[i]) ? in parse_pic_alf_params()
473 … (ph->alf_coeff_idx_tab[i - 1] + 1) : ph->alf_coeff_idx_tab[i - 1]; in parse_pic_alf_params()
477 if (ph->enable_pic_alf_cb) { in parse_pic_alf_params()
478 FUN_CHECK(ret = read_pic_alf_coeff(bitctx, ph->alf_coeff_cb)); in parse_pic_alf_params()
481 if (ph->enable_pic_alf_cr) { in parse_pic_alf_params()
482 FUN_CHECK(ret = read_pic_alf_coeff(bitctx, ph->alf_coeff_cr)); in parse_pic_alf_params()
499 Avs2dPicHeader_t *ph = &p_dec->ph; in parse_picture_header_comm() local
503 ph->enable_loop_filter = val_temp ^ 0x01; in parse_picture_header_comm()
504 if (ph->enable_loop_filter) { in parse_picture_header_comm()
505 READ_ONEBIT(bitctx, &ph->loop_filter_parameter_flag); in parse_picture_header_comm()
506 if (ph->loop_filter_parameter_flag) { in parse_picture_header_comm()
507 READ_SE(bitctx, &ph->alpha_c_offset); in parse_picture_header_comm()
508 READ_SE(bitctx, &ph->beta_offset); in parse_picture_header_comm()
509 if (ph->alpha_c_offset < -8 || ph->alpha_c_offset > 8 || in parse_picture_header_comm()
510 ph->beta_offset < -8 || ph->beta_offset > 8) { in parse_picture_header_comm()
516 ph->alpha_c_offset = 0; in parse_picture_header_comm()
517 ph->beta_offset = 0; in parse_picture_header_comm()
522 ph->enable_chroma_quant_param = val_temp ^ 0x01; in parse_picture_header_comm()
523 if (ph->enable_chroma_quant_param) { in parse_picture_header_comm()
524 READ_SE(bitctx, &ph->chroma_quant_param_delta_cb); in parse_picture_header_comm()
525 READ_SE(bitctx, &ph->chroma_quant_param_delta_cr); in parse_picture_header_comm()
527 ph->chroma_quant_param_delta_cb = 0; in parse_picture_header_comm()
528 ph->chroma_quant_param_delta_cr = 0; in parse_picture_header_comm()
530 if (ph->chroma_quant_param_delta_cb < -16 || ph->chroma_quant_param_delta_cb > 16 || in parse_picture_header_comm()
531 ph->chroma_quant_param_delta_cr < -16 || ph->chroma_quant_param_delta_cr > 16) { in parse_picture_header_comm()
539 READ_ONEBIT(bitctx, &ph->enable_pic_weight_quant); in parse_picture_header_comm()
540 if (ph->enable_pic_weight_quant) { in parse_picture_header_comm()
542 READ_BITS(bitctx, 2, &ph->pic_wq_data_index); in parse_picture_header_comm()
543 if (ph->pic_wq_data_index == 1) { in parse_picture_header_comm()
545 READ_BITS(bitctx, 2, &ph->wq_param_index); in parse_picture_header_comm()
546 READ_BITS(bitctx, 2, &ph->wq_model); in parse_picture_header_comm()
547 if (ph->wq_param_index == 1) { in parse_picture_header_comm()
549 READ_SE(bitctx, &ph->wq_param_delta1[i]); in parse_picture_header_comm()
551 } else if (ph->wq_param_index == 2) { in parse_picture_header_comm()
553 READ_SE(bitctx, &ph->wq_param_delta2[i]); in parse_picture_header_comm()
556 } else if (ph->pic_wq_data_index == 2) { in parse_picture_header_comm()
562 READ_UE(bitctx, &ph->pic_wq_matrix[size_id][j * wqm_size + i]); in parse_picture_header_comm()
572 FUN_CHECK(ret = parse_pic_alf_params(bitctx, ph)); in parse_picture_header_comm()
592 Avs2dPicHeader_t *ph = &p_dec->ph; in parse_picture_header_intra() local
593 RK_U32 last_pic_out_delay = ph->picture_output_delay; in parse_picture_header_intra()
596 memset(ph, 0, sizeof(Avs2dPicHeader_t)); in parse_picture_header_intra()
597 ph->picture_type = I_PICTURE; in parse_picture_header_intra()
600 READ_BITS_LONG(bitctx, 32, &ph->bbv_delay); in parse_picture_header_intra()
601 AVS2D_PARSE_TRACE("bbv_delay %d\n", ph->bbv_delay); in parse_picture_header_intra()
602 READ_ONEBIT(bitctx, &ph->time_code_flag); in parse_picture_header_intra()
603 AVS2D_PARSE_TRACE("time_code_flag %d\n", ph->time_code_flag); in parse_picture_header_intra()
604 if (ph->time_code_flag) { in parse_picture_header_intra()
605 READ_BITS(bitctx, 24, &ph->time_code); in parse_picture_header_intra()
606 AVS2D_PARSE_TRACE("time_code %d\n", ph->time_code); in parse_picture_header_intra()
610 READ_ONEBIT(bitctx, &ph->background_picture_flag); in parse_picture_header_intra()
611 AVS2D_PARSE_TRACE("background_picture_flag %d\n", ph->background_picture_flag); in parse_picture_header_intra()
612 if (ph->background_picture_flag) { in parse_picture_header_intra()
613 READ_ONEBIT(bitctx, &ph->background_picture_output_flag); in parse_picture_header_intra()
614 … AVS2D_PARSE_TRACE("background_picture_output_flag %d\n", ph->background_picture_output_flag); in parse_picture_header_intra()
615 if (ph->background_picture_output_flag) { in parse_picture_header_intra()
616 ph->picture_type = G_PICTURE; in parse_picture_header_intra()
618 ph->picture_type = GB_PICTURE; in parse_picture_header_intra()
623 READ_BITS(bitctx, 8, &ph->doi); in parse_picture_header_intra()
624 AVS2D_PARSE_TRACE("Picture type %d doi %d\n", ph->picture_type, ph->doi); in parse_picture_header_intra()
626 READ_BITS(bitctx, 3, &ph->temporal_id); in parse_picture_header_intra()
627 AVS2D_PARSE_TRACE("temporal_id %d\n", ph->temporal_id); in parse_picture_header_intra()
630 …if (vsh->low_delay == 0 && !(ph->background_picture_flag && !ph->background_picture_output_flag)) { in parse_picture_header_intra()
631 READ_UE(bitctx, &ph->picture_output_delay); in parse_picture_header_intra()
632 AVS2D_PARSE_TRACE("picture_output_delay %d\n", ph->picture_output_delay); in parse_picture_header_intra()
633 if (ph->picture_output_delay >= 64) { in parse_picture_header_intra()
635 mpp_err_f("invalid picture output delay(%d) intra.\n", ph->picture_output_delay); in parse_picture_header_intra()
639 ph->picture_output_delay = last_pic_out_delay; in parse_picture_header_intra()
655 READ_UE(bitctx, &ph->bbv_check_times); in parse_picture_header_intra()
656 AVS2D_PARSE_TRACE("bbv_check_time %d\n", ph->bbv_check_times); in parse_picture_header_intra()
659 READ_ONEBIT(bitctx, &ph->progressive_frame); in parse_picture_header_intra()
660 AVS2D_PARSE_TRACE("progressive_frame %d\n", ph->progressive_frame); in parse_picture_header_intra()
661 if (!ph->progressive_frame) { in parse_picture_header_intra()
662 READ_ONEBIT(bitctx, &ph->picture_structure); in parse_picture_header_intra()
663 AVS2D_PARSE_TRACE("picture_structure %d\n", ph->picture_structure); in parse_picture_header_intra()
665 ph->picture_structure = 1; //!< frame picture in parse_picture_header_intra()
667 READ_ONEBIT(bitctx, &ph->top_field_first); in parse_picture_header_intra()
668 AVS2D_PARSE_TRACE("top_field_first %d\n", ph->top_field_first); in parse_picture_header_intra()
669 READ_ONEBIT(bitctx, &ph->repeat_first_field); in parse_picture_header_intra()
670 AVS2D_PARSE_TRACE("repeat_first_field %d\n", ph->repeat_first_field); in parse_picture_header_intra()
672 READ_ONEBIT(bitctx, &ph->is_top_field); in parse_picture_header_intra()
673 AVS2D_PARSE_TRACE("is_top_field %d\n", ph->is_top_field); in parse_picture_header_intra()
677 READ_ONEBIT(bitctx, &ph->fixed_picture_qp); in parse_picture_header_intra()
678 AVS2D_PARSE_TRACE("fixed_picture_qp %d\n", ph->fixed_picture_qp); in parse_picture_header_intra()
679 READ_BITS(bitctx, 7, &ph->picture_qp); in parse_picture_header_intra()
680 AVS2D_PARSE_TRACE("picture_qp %d\n", ph->picture_qp); in parse_picture_header_intra()
681 if (ph->picture_qp > (63 + 8 * (vsh->bit_depth - 8))) { in parse_picture_header_intra()
683 mpp_err_f("invalid picture qp(%d).\n", ph->picture_qp); in parse_picture_header_intra()
706 Avs2dPicHeader_t *ph = &p_dec->ph; in parse_picture_header_inter() local
708 memset(ph, 0, sizeof(Avs2dPicHeader_t)); in parse_picture_header_inter()
709 READ_BITS_LONG(bitctx, 32, &ph->bbv_delay); in parse_picture_header_inter()
710 READ_BITS(bitctx, 2, &ph->picture_coding_type); in parse_picture_header_inter()
712 if (ph->picture_coding_type == 1) { in parse_picture_header_inter()
713 READ_ONEBIT(bitctx, &ph->background_pred_flag); in parse_picture_header_inter()
716 if (ph->picture_coding_type != 2 && !ph->background_pred_flag) { in parse_picture_header_inter()
717 READ_ONEBIT(bitctx, &ph->background_reference_flag); //!< P/F ref G/GB in parse_picture_header_inter()
721 if (ph->picture_coding_type == 1) { in parse_picture_header_inter()
722 ph->picture_type = ph->background_pred_flag ? S_PICTURE : P_PICTURE; in parse_picture_header_inter()
723 } else if (ph->picture_coding_type == 2) { in parse_picture_header_inter()
724 ph->picture_type = B_PICTURE; in parse_picture_header_inter()
725 } else if (ph->picture_coding_type == 3) { in parse_picture_header_inter()
726 ph->picture_type = F_PICTURE; in parse_picture_header_inter()
733 READ_BITS(bitctx, 8, &ph->doi); in parse_picture_header_inter()
734 AVS2D_PARSE_TRACE("Picture type %d doi %d\n", ph->picture_type, ph->doi); in parse_picture_header_inter()
736 READ_BITS(bitctx, 3, &ph->temporal_id); in parse_picture_header_inter()
740 READ_UE(bitctx, &ph->picture_output_delay); in parse_picture_header_inter()
741 AVS2D_PARSE_TRACE("picture_output_delay %d\n", ph->picture_output_delay); in parse_picture_header_inter()
742 if (ph->picture_output_delay >= 64) { in parse_picture_header_inter()
744 mpp_err_f("invalid picture output delay(%d) intra.\n", ph->picture_output_delay); in parse_picture_header_inter()
748 ph->picture_output_delay = 0; in parse_picture_header_inter()
763 READ_UE(bitctx, &ph->bbv_check_times); in parse_picture_header_inter()
766 READ_ONEBIT(bitctx, &ph->progressive_frame); in parse_picture_header_inter()
767 if (!ph->progressive_frame) { in parse_picture_header_inter()
768 READ_ONEBIT(bitctx, &ph->picture_structure); in parse_picture_header_inter()
770 ph->picture_structure = 1; //!< frame picture in parse_picture_header_inter()
772 READ_ONEBIT(bitctx, &ph->top_field_first); in parse_picture_header_inter()
773 READ_ONEBIT(bitctx, &ph->repeat_first_field); in parse_picture_header_inter()
775 READ_ONEBIT(bitctx, &ph->is_top_field); in parse_picture_header_inter()
778 READ_ONEBIT(bitctx, &ph->fixed_picture_qp); in parse_picture_header_inter()
779 READ_BITS(bitctx, 7, &ph->picture_qp); in parse_picture_header_inter()
780 if (ph->picture_qp > (63 + 8 * (vsh->bit_depth - 8))) { in parse_picture_header_inter()
782 mpp_err_f("invalid picture qp(%d).\n", ph->picture_qp); in parse_picture_header_inter()
785 if (ph->picture_coding_type != 2 || ph->picture_structure == 0) { in parse_picture_header_inter()
788 READ_ONEBIT(bitctx, &ph->enable_random_decodable); in parse_picture_header_inter()