Lines Matching refs:ctx
409 static RK_S32 mpp_av1_read_obu_header(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_read_obu_header() argument
431 ctx->temporal_id = current->temporal_id; in mpp_av1_read_obu_header()
432 ctx->spatial_id = current->spatial_id; in mpp_av1_read_obu_header()
437 static RK_S32 mpp_av1_trailing_bits(AV1Context *ctx, BitReadCtx_t *gb, RK_S32 nb_bits) in mpp_av1_trailing_bits() argument
439 (void)ctx; in mpp_av1_trailing_bits()
456 static RK_S32 mpp_av1_byte_alignment(AV1Context *ctx, BitReadCtx_t *gb) in mpp_av1_byte_alignment() argument
459 (void)ctx; in mpp_av1_byte_alignment()
468 static RK_S32 mpp_av1_color_config(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_color_config() argument
478 ctx->bit_depth = current->twelve_bit ? 12 : 10; in mpp_av1_color_config()
480 ctx->bit_depth = current->high_bitdepth ? 10 : 8; in mpp_av1_color_config()
487 ctx->num_planes = current->mono_chrome ? 1 : 3; in mpp_av1_color_config()
496 ctx->is_hdr = 1; in mpp_av1_color_config()
529 if (ctx->bit_depth == 12) { in mpp_av1_color_config()
551 static RK_S32 mpp_av1_timing_info(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_timing_info() argument
554 (void)ctx; in mpp_av1_timing_info()
567 static RK_S32 mpp_av1_decoder_model_info(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_decoder_model_info() argument
571 (void)ctx; in mpp_av1_decoder_model_info()
580 static RK_S32 mpp_av1_sequence_header_obu(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_sequence_header_obu() argument
606 CHECK(mpp_av1_timing_info(ctx, gb, ¤t->timing_info)); in mpp_av1_sequence_header_obu()
611 (ctx, gb, ¤t->decoder_model_info)); in mpp_av1_sequence_header_obu()
721 CHECK(mpp_av1_color_config(ctx, gb, ¤t->color_config, in mpp_av1_sequence_header_obu()
729 static RK_S32 mpp_av1_temporal_delimiter_obu(AV1Context *ctx, BitReadCtx_t *gb) in mpp_av1_temporal_delimiter_obu() argument
732 ctx->seen_frame_header = 0; in mpp_av1_temporal_delimiter_obu()
738 static RK_S32 mpp_av1_set_frame_refs(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_set_frame_refs() argument
742 const AV1RawSequenceHeader *seq = ctx->sequence_header; in mpp_av1_set_frame_refs()
773 mpp_av1_get_relative_dist(seq, ctx->ref_s[i].order_hint, in mpp_av1_set_frame_refs()
774 ctx->order_hint); in mpp_av1_set_frame_refs()
881 static RK_S32 mpp_av1_superres_params(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_superres_params() argument
884 const AV1RawSequenceHeader *seq = ctx->sequence_header; in mpp_av1_superres_params()
899 ctx->upscaled_width = ctx->frame_width; in mpp_av1_superres_params()
900 ctx->frame_width = (ctx->upscaled_width * AV1_SUPERRES_NUM + in mpp_av1_superres_params()
905 static RK_S32 mpp_av1_frame_size(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_frame_size() argument
908 const AV1RawSequenceHeader *seq = ctx->sequence_header; in mpp_av1_frame_size()
919 ctx->frame_width = current->frame_width_minus_1 + 1; in mpp_av1_frame_size()
920 ctx->frame_height = current->frame_height_minus_1 + 1; in mpp_av1_frame_size()
922 CHECK(mpp_av1_superres_params(ctx, gb, current)); in mpp_av1_frame_size()
927 static RK_S32 mpp_av1_render_size(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_render_size() argument
942 ctx->render_width = current->render_width_minus_1 + 1; in mpp_av1_render_size()
943 ctx->render_height = current->render_height_minus_1 + 1; in mpp_av1_render_size()
948 static RK_S32 mpp_av1_frame_size_with_refs(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_frame_size_with_refs() argument
957 &ctx->ref_s[current->ref_frame_idx[i]]; in mpp_av1_frame_size_with_refs()
971 ctx->upscaled_width = ref->upscaled_width; in mpp_av1_frame_size_with_refs()
972 ctx->frame_width = ctx->upscaled_width; in mpp_av1_frame_size_with_refs()
973 ctx->frame_height = ref->frame_height; in mpp_av1_frame_size_with_refs()
974 ctx->render_width = ref->render_width; in mpp_av1_frame_size_with_refs()
975 ctx->render_height = ref->render_height; in mpp_av1_frame_size_with_refs()
981 CHECK(mpp_av1_frame_size(ctx, gb, current)); in mpp_av1_frame_size_with_refs()
982 CHECK(mpp_av1_render_size(ctx, gb, current)); in mpp_av1_frame_size_with_refs()
984 CHECK(mpp_av1_superres_params(ctx, gb, current)); in mpp_av1_frame_size_with_refs()
990 static RK_S32 mpp_av1_interpolation_filter(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_interpolation_filter() argument
994 (void)ctx; in mpp_av1_interpolation_filter()
1005 static RK_S32 mpp_av1_tile_info(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_tile_info() argument
1008 const AV1RawSequenceHeader *seq = ctx->sequence_header; in mpp_av1_tile_info()
1015 mi_cols = 2 * ((ctx->frame_width + 7) >> 3); in mpp_av1_tile_info()
1016 mi_rows = 2 * ((ctx->frame_height + 7) >> 3); in mpp_av1_tile_info()
1107 ctx->tile_cols = current->tile_cols; in mpp_av1_tile_info()
1108 ctx->tile_rows = current->tile_rows; in mpp_av1_tile_info()
1113 static RK_S32 mpp_av1_quantization_params(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_quantization_params() argument
1116 const AV1RawSequenceHeader *seq = ctx->sequence_header; in mpp_av1_quantization_params()
1123 if (ctx->num_planes > 1) { in mpp_av1_quantization_params()
1159 static RK_S32 mpp_av1_segmentation_params(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_segmentation_params() argument
1193 … ctx->ref_s[current->ref_frame_idx[current->primary_ref_frame]].feature_enabled[i]; in mpp_av1_segmentation_params()
1195 ctx->ref_s[current->ref_frame_idx[current->primary_ref_frame]].feature_value[i]; in mpp_av1_segmentation_params()
1246 static RK_S32 mpp_av1_delta_q_params(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_delta_q_params() argument
1250 (void)ctx; in mpp_av1_delta_q_params()
1262 static RK_S32 mpp_av1_delta_lf_params(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_delta_lf_params() argument
1266 (void)ctx; in mpp_av1_delta_lf_params()
1288 static RK_S32 mpp_av1_loop_filter_params(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_loop_filter_params() argument
1296 if (ctx->coded_lossless || current->allow_intrabc) { in mpp_av1_loop_filter_params()
1315 if (ctx->num_planes > 1) { in mpp_av1_loop_filter_params()
1338 … ctx->ref_s[current->ref_frame_idx[current->primary_ref_frame]].loop_filter_ref_deltas; in mpp_av1_loop_filter_params()
1340 … ctx->ref_s[current->ref_frame_idx[current->primary_ref_frame]].loop_filter_mode_deltas; in mpp_av1_loop_filter_params()
1374 static RK_S32 mpp_av1_cdef_params(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_cdef_params() argument
1377 const AV1RawSequenceHeader *seq = ctx->sequence_header; in mpp_av1_cdef_params()
1379 if (ctx->coded_lossless || current->allow_intrabc || in mpp_av1_cdef_params()
1398 if (ctx->num_planes > 1) { in mpp_av1_cdef_params()
1407 static RK_S32 mpp_av1_lr_params(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_lr_params() argument
1410 const AV1RawSequenceHeader *seq = ctx->sequence_header; in mpp_av1_lr_params()
1414 if (ctx->all_lossless || current->allow_intrabc || in mpp_av1_lr_params()
1420 for (i = 0; i < ctx->num_planes; i++) { in mpp_av1_lr_params()
1447 static RK_S32 mpp_av1_read_tx_mode(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_read_tx_mode() argument
1452 if (ctx->coded_lossless) in mpp_av1_read_tx_mode()
1462 static RK_S32 mpp_av1_frame_reference_mode(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_frame_reference_mode() argument
1466 (void)ctx; in mpp_av1_frame_reference_mode()
1476 static RK_S32 mpp_av1_skip_mode_params(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_skip_mode_params() argument
1479 const AV1RawSequenceHeader *seq = ctx->sequence_header; in mpp_av1_skip_mode_params()
1483 ctx->skip_ref0 = 0; in mpp_av1_skip_mode_params()
1484 ctx->skip_ref1 = 0; in mpp_av1_skip_mode_params()
1500 ref_hint = ctx->ref_s[current->ref_frame_idx[i]].order_hint; in mpp_av1_skip_mode_params()
1502 ctx->order_hint); in mpp_av1_skip_mode_params()
1524 ctx->skip_ref0 = MPP_MIN(forward_idx, backward_idx) + 1; in mpp_av1_skip_mode_params()
1525 ctx->skip_ref1 = MPP_MAX(forward_idx, backward_idx) + 1; in mpp_av1_skip_mode_params()
1532 ref_hint = ctx->ref_s[current->ref_frame_idx[i]].order_hint; in mpp_av1_skip_mode_params()
1547 ctx->skip_ref0 = MPP_MIN(forward_idx, second_forward_idx) + 1; in mpp_av1_skip_mode_params()
1548 ctx->skip_ref1 = MPP_MAX(forward_idx, second_forward_idx) + 1; in mpp_av1_skip_mode_params()
1563 static RK_S32 mpp_av1_global_motion_param(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_global_motion_param() argument
1569 (void)ctx; in mpp_av1_global_motion_param()
1596 static RK_S32 mpp_av1_global_motion_params(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_global_motion_params() argument
1622 CHECK(mpp_av1_global_motion_param(ctx, gb, current, type, ref, 2)); in mpp_av1_global_motion_params()
1623 CHECK(mpp_av1_global_motion_param(ctx, gb, current, type, ref, 3)); in mpp_av1_global_motion_params()
1625 CHECK(mpp_av1_global_motion_param(ctx, gb, current, type, ref, 4)); in mpp_av1_global_motion_params()
1626 CHECK(mpp_av1_global_motion_param(ctx, gb, current, type, ref, 5)); in mpp_av1_global_motion_params()
1633 CHECK(mpp_av1_global_motion_param(ctx, gb, current, type, ref, 0)); in mpp_av1_global_motion_params()
1634 CHECK(mpp_av1_global_motion_param(ctx, gb, current, type, ref, 1)); in mpp_av1_global_motion_params()
1641 static RK_S32 mpp_av1_film_grain_params(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_film_grain_params() argument
1645 const AV1RawSequenceHeader *seq = ctx->sequence_header; in mpp_av1_film_grain_params()
1747 static RK_S32 mpp_av1_uncompressed_header(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_uncompressed_header() argument
1754 if (!ctx->sequence_header) { in mpp_av1_uncompressed_header()
1759 seq = ctx->sequence_header; in mpp_av1_uncompressed_header()
1779 ref = &ctx->ref_s[current->frame_to_show_map_idx]; in mpp_av1_uncompressed_header()
1803 ctx->upscaled_width = ref->upscaled_width; in mpp_av1_uncompressed_header()
1804 ctx->frame_width = ref->frame_width; in mpp_av1_uncompressed_header()
1805 ctx->frame_height = ref->frame_height; in mpp_av1_uncompressed_header()
1806 ctx->render_width = ref->render_width; in mpp_av1_uncompressed_header()
1807 ctx->render_height = ref->render_height; in mpp_av1_uncompressed_header()
1808 ctx->bit_depth = ref->bit_depth; in mpp_av1_uncompressed_header()
1809 ctx->order_hint = ref->order_hint; in mpp_av1_uncompressed_header()
1825 ctx->frame_is_intra = frame_is_intra; in mpp_av1_uncompressed_header()
1829 Av1GetCDFs(ctx, current->frame_to_show_map_idx); in mpp_av1_uncompressed_header()
1830 Av1StoreCDFs(ctx, refresh_frame_flags); in mpp_av1_uncompressed_header()
1854 ctx->ref_s[i].valid = 0; in mpp_av1_uncompressed_header()
1855 ctx->ref_s[i].order_hint = 0; in mpp_av1_uncompressed_header()
1883 if (ctx->ref_s[i].frame_id > current->current_frame_id || in mpp_av1_uncompressed_header()
1884 ctx->ref_s[i].frame_id < (current->current_frame_id - in mpp_av1_uncompressed_header()
1886 ctx->ref_s[i].valid = 0; in mpp_av1_uncompressed_header()
1888 if (ctx->ref_s[i].frame_id > current->current_frame_id && in mpp_av1_uncompressed_header()
1889 ctx->ref_s[i].frame_id < ((RK_S32)(1 << id_len) + in mpp_av1_uncompressed_header()
1892 ctx->ref_s[i].valid = 0; in mpp_av1_uncompressed_header()
1912 ctx->order_hint = current->order_hint; in mpp_av1_uncompressed_header()
1925 RK_S32 in_temporal_layer = (op_pt_idc >> ctx->temporal_id ) & 1; in mpp_av1_uncompressed_header()
1926 RK_S32 in_spatial_layer = (op_pt_idc >> (ctx->spatial_id + 8)) & 1; in mpp_av1_uncompressed_header()
1943 ctx->refresh_frame_flags = current->refresh_frame_flags; in mpp_av1_uncompressed_header()
1950 infer(ref_order_hint[i], ctx->ref_s[i].order_hint); in mpp_av1_uncompressed_header()
1951 if (current->ref_order_hint[i] != ctx->ref_s[i].order_hint) in mpp_av1_uncompressed_header()
1952 ctx->ref_s[i].valid = 0; in mpp_av1_uncompressed_header()
1960 CHECK(mpp_av1_frame_size(ctx, gb, current)); in mpp_av1_uncompressed_header()
1961 CHECK(mpp_av1_render_size(ctx, gb, current)); in mpp_av1_uncompressed_header()
1964 ctx->upscaled_width == ctx->frame_width) in mpp_av1_uncompressed_header()
1978 CHECK(mpp_av1_set_frame_refs(ctx, gb, current)); in mpp_av1_uncompressed_header()
1993 CHECK(mpp_av1_frame_size_with_refs(ctx, gb, current)); in mpp_av1_uncompressed_header()
1995 CHECK(mpp_av1_frame_size(ctx, gb, current)); in mpp_av1_uncompressed_header()
1996 CHECK(mpp_av1_render_size(ctx, gb, current)); in mpp_av1_uncompressed_header()
2004 CHECK(mpp_av1_interpolation_filter(ctx, gb, current)); in mpp_av1_uncompressed_header()
2026 ctx->disable_frame_end_update_cdf = current->disable_frame_end_update_cdf; in mpp_av1_uncompressed_header()
2032 CHECK(mpp_av1_tile_info(ctx, gb, current)); in mpp_av1_uncompressed_header()
2035 CHECK(mpp_av1_quantization_params(ctx, gb, current)); in mpp_av1_uncompressed_header()
2038 CHECK(mpp_av1_segmentation_params(ctx, gb, current)); in mpp_av1_uncompressed_header()
2041 CHECK(mpp_av1_delta_q_params(ctx, gb, current)); in mpp_av1_uncompressed_header()
2044 CHECK(mpp_av1_delta_lf_params(ctx, gb, current)); in mpp_av1_uncompressed_header()
2051 ctx->cdfs = &ctx->default_cdfs; in mpp_av1_uncompressed_header()
2052 ctx->cdfs_ndvc = &ctx->default_cdfs_ndvc; in mpp_av1_uncompressed_header()
2053 Av1DefaultCoeffProbs(current->base_q_idx, ctx->cdfs); in mpp_av1_uncompressed_header()
2059 Av1GetCDFs(ctx, idx); in mpp_av1_uncompressed_header()
2064 ctx->ref[current->ref_frame_idx[current->primary_ref_frame]].slot_index, in mpp_av1_uncompressed_header()
2068 Av1StoreCDFs(ctx, current->refresh_frame_flags); in mpp_av1_uncompressed_header()
2070 ctx->coded_lossless = 1; in mpp_av1_uncompressed_header()
2084 ctx->coded_lossless = 0; in mpp_av1_uncompressed_header()
2087 ctx->all_lossless = ctx->coded_lossless && in mpp_av1_uncompressed_header()
2088 ctx->frame_width == ctx->upscaled_width; in mpp_av1_uncompressed_header()
2091 CHECK(mpp_av1_loop_filter_params(ctx, gb, current)); in mpp_av1_uncompressed_header()
2094 CHECK(mpp_av1_cdef_params(ctx, gb, current)); in mpp_av1_uncompressed_header()
2097 CHECK(mpp_av1_lr_params(ctx, gb, current)); in mpp_av1_uncompressed_header()
2100 CHECK(mpp_av1_read_tx_mode(ctx, gb, current)); in mpp_av1_uncompressed_header()
2103 CHECK(mpp_av1_frame_reference_mode(ctx, gb, current)); in mpp_av1_uncompressed_header()
2106 CHECK(mpp_av1_skip_mode_params(ctx, gb, current)); in mpp_av1_uncompressed_header()
2117 CHECK(mpp_av1_global_motion_params(ctx, gb, current)); in mpp_av1_uncompressed_header()
2119 CHECK(mpp_av1_film_grain_params(ctx, gb, ¤t->film_grain, current)); in mpp_av1_uncompressed_header()
2124 "bitdepth %d tiles %dx%d.\n", ctx->order_hint, in mpp_av1_uncompressed_header()
2125 ctx->frame_width, ctx->frame_height, ctx->upscaled_width, in mpp_av1_uncompressed_header()
2126 ctx->render_width, ctx->render_height, in mpp_av1_uncompressed_header()
2128 seq->color_config.subsampling_y + 1, ctx->bit_depth, in mpp_av1_uncompressed_header()
2129 ctx->tile_rows, ctx->tile_cols); in mpp_av1_uncompressed_header()
2134 static RK_S32 mpp_av1_frame_header_obu(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_frame_header_obu() argument
2141 if (ctx->seen_frame_header) { in mpp_av1_frame_header_obu()
2153 mpp_set_bitread_ctx(&fh, ctx->frame_header, in mpp_av1_frame_header_obu()
2154 ctx->frame_header_size); in mpp_av1_frame_header_obu()
2156 for (i = 0; i < ctx->frame_header_size; i += 8) { in mpp_av1_frame_header_obu()
2157 b = MPP_MIN(ctx->frame_header_size - i, 8); in mpp_av1_frame_header_obu()
2167 CHECK(mpp_av1_uncompressed_header(ctx, gb, current)); in mpp_av1_frame_header_obu()
2169 ctx->tile_num = 0; in mpp_av1_frame_header_obu()
2172 ctx->seen_frame_header = 0; in mpp_av1_frame_header_obu()
2174 ctx->seen_frame_header = 1; in mpp_av1_frame_header_obu()
2180 ctx->frame_header_size = fh_bits; in mpp_av1_frame_header_obu()
2181 MPP_FREE(ctx->frame_header); in mpp_av1_frame_header_obu()
2182 ctx->frame_header = in mpp_av1_frame_header_obu()
2184 if (!ctx->frame_header) { in mpp_av1_frame_header_obu()
2188 memcpy(ctx->frame_header, fh_start, fh_bytes); in mpp_av1_frame_header_obu()
2195 static RK_S32 mpp_av1_tile_group_obu(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_tile_group_obu() argument
2201 num_tiles = ctx->tile_cols * ctx->tile_rows; in mpp_av1_tile_group_obu()
2211 tile_bits = mpp_av1_tile_log2(1, ctx->tile_cols) + in mpp_av1_tile_group_obu()
2212 mpp_av1_tile_log2(1, ctx->tile_rows); in mpp_av1_tile_group_obu()
2213 fc(tile_bits, tg_start, ctx->tile_num, num_tiles - 1); in mpp_av1_tile_group_obu()
2217 ctx->tile_num = current->tg_end + 1; in mpp_av1_tile_group_obu()
2219 CHECK(mpp_av1_byte_alignment(ctx, gb)); in mpp_av1_tile_group_obu()
2223 ctx->seen_frame_header = 0; in mpp_av1_tile_group_obu()
2229 static RK_S32 mpp_av1_frame_obu(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_frame_obu() argument
2236 CHECK(mpp_av1_frame_header_obu(ctx, gb, ¤t->header, in mpp_av1_frame_obu()
2239 CHECK(mpp_av1_byte_alignment(ctx, gb)); in mpp_av1_frame_obu()
2241 CHECK(mpp_av1_tile_group_obu(ctx, gb, ¤t->tile_group)); in mpp_av1_frame_obu()
2242 ctx->frame_tag_size += (mpp_get_bits_count(gb) - start_pos + 7) >> 3; in mpp_av1_frame_obu()
2247 static RK_S32 mpp_av1_tile_list_obu(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_tile_list_obu() argument
2251 (void)ctx; in mpp_av1_tile_list_obu()
2262 static RK_S32 mpp_av1_metadata_hdr_cll(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_metadata_hdr_cll() argument
2266 (void)ctx; in mpp_av1_metadata_hdr_cll()
2270 ctx->content_light.MaxCLL = current->max_cll; in mpp_av1_metadata_hdr_cll()
2271 ctx->content_light.MaxFALL = current->max_fall; in mpp_av1_metadata_hdr_cll()
2276 static RK_S32 mpp_av1_metadata_hdr_mdcv(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_metadata_hdr_mdcv() argument
2280 (void)ctx; in mpp_av1_metadata_hdr_mdcv()
2296 ctx->mastering_display.display_primaries[i][0] = current->primary_chromaticity_x[i]; in mpp_av1_metadata_hdr_mdcv()
2297 ctx->mastering_display.display_primaries[i][1] = current->primary_chromaticity_y[i]; in mpp_av1_metadata_hdr_mdcv()
2299 ctx->mastering_display.white_point[0] = current->white_point_chromaticity_x; in mpp_av1_metadata_hdr_mdcv()
2300 ctx->mastering_display.white_point[1] = current->white_point_chromaticity_y; in mpp_av1_metadata_hdr_mdcv()
2301 ctx->mastering_display.max_luminance = current->luminance_max; in mpp_av1_metadata_hdr_mdcv()
2302 ctx->mastering_display.min_luminance = current->luminance_min; in mpp_av1_metadata_hdr_mdcv()
2307 static RK_S32 mpp_av1_scalability_structure(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_scalability_structure() argument
2313 if (!ctx->sequence_header) { in mpp_av1_scalability_structure()
2318 seq = ctx->sequence_header; in mpp_av1_scalability_structure()
2353 static RK_S32 mpp_av1_metadata_scalability(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_metadata_scalability() argument
2361 CHECK(mpp_av1_scalability_structure(ctx, gb, current)); in mpp_av1_metadata_scalability()
2366 static RK_S32 mpp_av1_get_dlby_rpu(AV1Context *ctx, BitReadCtx_t *gb) in mpp_av1_get_dlby_rpu() argument
2368 MppFrameHdrDynamicMeta *hdr_dynamic_meta = ctx->hdr_dynamic_meta; in mpp_av1_get_dlby_rpu()
2425 ctx->hdr_dynamic_meta = hdr_dynamic_meta; in mpp_av1_get_dlby_rpu()
2426 ctx->hdr_dynamic = 1; in mpp_av1_get_dlby_rpu()
2427 ctx->is_hdr = 1; in mpp_av1_get_dlby_rpu()
2450 static void mpp_av1_fill_dynamic_meta(AV1Context *ctx, const RK_U8 *data, RK_U32 size, RK_U32 hdr_f… in mpp_av1_fill_dynamic_meta() argument
2452 MppFrameHdrDynamicMeta *hdr_dynamic_meta = ctx->hdr_dynamic_meta; in mpp_av1_fill_dynamic_meta()
2477 ctx->hdr_dynamic_meta = hdr_dynamic_meta; in mpp_av1_fill_dynamic_meta()
2478 ctx->hdr_dynamic = 1; in mpp_av1_fill_dynamic_meta()
2479 ctx->is_hdr = 1; in mpp_av1_fill_dynamic_meta()
2483 static RK_S32 mpp_av1_metadata_itut_t35(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_metadata_itut_t35() argument
2510 mpp_av1_get_dlby_rpu(ctx, gb); in mpp_av1_metadata_itut_t35()
2524 mpp_av1_fill_dynamic_meta(ctx, gb->data_, mpp_get_bits_left(gb) >> 3, HDR10PLUS); in mpp_av1_metadata_itut_t35()
2535 static RK_S32 mpp_av1_metadata_timecode(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_metadata_timecode() argument
2539 (void)ctx; in mpp_av1_metadata_timecode()
2574 static RK_S32 mpp_av1_metadata_obu(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_metadata_obu() argument
2583 CHECK(mpp_av1_metadata_hdr_cll(ctx, gb, ¤t->metadata.hdr_cll)); in mpp_av1_metadata_obu()
2586 CHECK(mpp_av1_metadata_hdr_mdcv(ctx, gb, ¤t->metadata.hdr_mdcv)); in mpp_av1_metadata_obu()
2589 CHECK(mpp_av1_metadata_scalability(ctx, gb, ¤t->metadata.scalability)); in mpp_av1_metadata_obu()
2592 CHECK(mpp_av1_metadata_itut_t35(ctx, gb, ¤t->metadata.itut_t35)); in mpp_av1_metadata_obu()
2595 CHECK(mpp_av1_metadata_timecode(ctx, gb, ¤t->metadata.timecode)); in mpp_av1_metadata_obu()
2605 static RK_S32 mpp_av1_padding_obu(AV1Context *ctx, BitReadCtx_t *gb, in mpp_av1_padding_obu() argument
2610 (void)ctx; in mpp_av1_padding_obu()
2687 RK_S32 mpp_av1_split_fragment(AV1Context *ctx, Av1UnitFragment *frag, RK_S32 header_flag) in mpp_av1_split_fragment() argument
2744 err = mpp_av1_read_obu_header(ctx, &gbc, &header); in mpp_av1_split_fragment()
2821 MPP_RET mpp_av1_read_unit(AV1Context *ctx, Av1ObuUnit *unit) in mpp_av1_read_unit() argument
2838 err = mpp_av1_read_obu_header(ctx, &gbc, &obu->header); in mpp_av1_read_unit()
2859 if (!ctx->fist_tile_group) in mpp_av1_read_unit()
2860 ctx->frame_tag_size += ((start_pos - hdr_start_pos + 7) >> 3); in mpp_av1_read_unit()
2864 ctx->operating_point_idc) { in mpp_av1_read_unit()
2866 (ctx->operating_point_idc >> ctx->temporal_id ) & 1; in mpp_av1_read_unit()
2868 (ctx->operating_point_idc >> (ctx->spatial_id + 8)) & 1; in mpp_av1_read_unit()
2878 err = mpp_av1_sequence_header_obu(ctx, &gbc, in mpp_av1_read_unit()
2882 ctx->frame_tag_size += obu->obu_size; in mpp_av1_read_unit()
2883 if (ctx->operating_point >= 0) { in mpp_av1_read_unit()
2886 if (ctx->operating_point > sequence_header->operating_points_cnt_minus_1) { in mpp_av1_read_unit()
2889 ctx->operating_point, sequence_header->operating_points_cnt_minus_1); in mpp_av1_read_unit()
2892 ctx->operating_point_idc = sequence_header->operating_point_idc[ctx->operating_point]; in mpp_av1_read_unit()
2895 ctx->sequence_header = NULL; in mpp_av1_read_unit()
2896 ctx->sequence_header = &obu->obu.sequence_header; in mpp_av1_read_unit()
2899 err = mpp_av1_temporal_delimiter_obu(ctx, &gbc); in mpp_av1_read_unit()
2905 err = mpp_av1_frame_header_obu(ctx, &gbc, in mpp_av1_read_unit()
2912 ctx->frame_tag_size += obu->obu_size; in mpp_av1_read_unit()
2917 err = mpp_av1_tile_group_obu(ctx, &gbc, &obu->obu.tile_group); in mpp_av1_read_unit()
2920 if (!ctx->fist_tile_group) in mpp_av1_read_unit()
2921 ctx->frame_tag_size += MPP_ALIGN(mpp_get_bits_count(&gbc) - cur_pos, 8) / 8; in mpp_av1_read_unit()
2922 ctx->fist_tile_group = 1; in mpp_av1_read_unit()
2929 err = mpp_av1_frame_obu(ctx, &gbc, &obu->obu.frame, in mpp_av1_read_unit()
2940 err = mpp_av1_tile_list_obu(ctx, &gbc, &obu->obu.tile_list); in mpp_av1_read_unit()
2950 ctx->frame_tag_size += obu->obu_size; in mpp_av1_read_unit()
2951 err = mpp_av1_metadata_obu(ctx, &gbc, &obu->obu.metadata); in mpp_av1_read_unit()
2956 err = mpp_av1_padding_obu(ctx, &gbc, &obu->obu.padding); in mpp_av1_read_unit()
2976 err = mpp_av1_trailing_bits(ctx, &gbc, nb_bits); in mpp_av1_read_unit()
2984 RK_S32 mpp_av1_read_fragment_content(AV1Context *ctx, Av1UnitFragment *frag) in mpp_av1_read_fragment_content() argument
2989 ctx->frame_tag_size = 0; in mpp_av1_read_fragment_content()
2990 ctx->fist_tile_group = 0; in mpp_av1_read_fragment_content()
2993 if (ctx->unit_types) { in mpp_av1_read_fragment_content()
2994 for (j = 0; j < ctx->nb_unit_types; j++) { in mpp_av1_read_fragment_content()
2995 if (ctx->unit_types[j] == unit->type) in mpp_av1_read_fragment_content()
2998 if (j >= ctx->nb_unit_types) in mpp_av1_read_fragment_content()
3003 err = mpp_av1_read_unit(ctx, unit); in mpp_av1_read_fragment_content()
3019 obu->header.obu_type, obu->obu_size, ctx->frame_tag_size); in mpp_av1_read_fragment_content()
3024 int mpp_av1_set_context_with_sequence(Av1CodecContext *ctx, in mpp_av1_set_context_with_sequence() argument
3030 ctx->profile = seq->seq_profile; in mpp_av1_set_context_with_sequence()
3031 ctx->level = seq->seq_level_idx[0]; in mpp_av1_set_context_with_sequence()
3033 ctx->color_range = in mpp_av1_set_context_with_sequence()
3035 ctx->color_primaries = seq->color_config.color_primaries; in mpp_av1_set_context_with_sequence()
3036 ctx->colorspace = seq->color_config.matrix_coefficients; in mpp_av1_set_context_with_sequence()
3037 ctx->color_trc = seq->color_config.transfer_characteristics; in mpp_av1_set_context_with_sequence()
3041 ctx->chroma_sample_location = MPP_CHROMA_LOC_LEFT; in mpp_av1_set_context_with_sequence()
3044 ctx->chroma_sample_location = MPP_CHROMA_LOC_TOPLEFT; in mpp_av1_set_context_with_sequence()
3048 if (ctx->width != width || ctx->height != height) { in mpp_av1_set_context_with_sequence()
3049 ctx->width = width; in mpp_av1_set_context_with_sequence()
3050 ctx->height = height; in mpp_av1_set_context_with_sequence()
3070 RK_S32 mpp_av1_assemble_fragment(AV1Context *ctx, Av1UnitFragment *frag) in mpp_av1_assemble_fragment() argument
3074 (void)ctx; in mpp_av1_assemble_fragment()
3097 void mpp_av1_flush(AV1Context *ctx) in mpp_av1_flush() argument
3102 memset(ctx->ref_s, 0, sizeof(ctx->ref_s)); in mpp_av1_flush()
3103 ctx->operating_point_idc = 0; in mpp_av1_flush()
3104 ctx->seen_frame_header = 0; in mpp_av1_flush()
3105 ctx->tile_num = 0; in mpp_av1_flush()
3108 void mpp_av1_close(AV1Context *ctx) in mpp_av1_close() argument
3110 MPP_FREE(ctx->frame_header); in mpp_av1_close()
3111 MPP_FREE(ctx->sequence_header); in mpp_av1_close()
3112 MPP_FREE(ctx->raw_frame_header); in mpp_av1_close()