xref: /OK3568_Linux_fs/external/mpp/mpp/codec/dec/h265/h265d_parser.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  *
3  * Copyright 2015 Rockchip Electronics Co. LTD
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 /*
19  * @file        h265d_parser.h
20  * @brief
21  * @author      csy(csy@rock-chips.com)
22 
23  * @version     1.0.0
24  * @history
25  *   2015.7.15 : Create
26  */
27 
28 
29 #ifndef __H265D_PARSER_H__
30 #define __H265D_PARSER_H__
31 
32 #include <limits.h>
33 #include <string.h>
34 
35 #include "mpp_debug.h"
36 #include "mpp_bitread.h"
37 #include "mpp_buf_slot.h"
38 #include "mpp_mem_pool.h"
39 
40 #include "hal_dec_task.h"
41 #include "h265d_codec.h"
42 #include "h265_syntax.h"
43 #include "h2645d_sei.h"
44 
45 extern RK_U32 h265d_debug;
46 
47 #define H265D_DBG_FUNCTION          (0x00000001)
48 #define H265D_DBG_VPS               (0x00000002)
49 #define H265D_DBG_SPS               (0x00000004)
50 #define H265D_DBG_PPS               (0x00000008)
51 #define H265D_DBG_SLICE_HDR         (0x00000010)
52 #define H265D_DBG_SEI               (0x00000020)
53 #define H265D_DBG_GLOBAL            (0x00000040)
54 #define H265D_DBG_REF               (0x00000080)
55 #define H265D_DBG_TIME              (0x00000100)
56 
57 
58 #define h265d_dbg(flag, fmt, ...) _mpp_dbg(h265d_debug, flag, fmt, ## __VA_ARGS__)
59 
60 #define MAX_FRAME_SIZE 2048000
61 
62 typedef struct ShortTermRPS {
63     RK_U32 num_negative_pics;
64     RK_S32 num_delta_pocs;
65     RK_S32 rps_idx_num_delta_pocs;
66     RK_S32 delta_poc[32];
67     RK_U8  used[32];
68 } ShortTermRPS;
69 
70 typedef struct LongTermRPS {
71     RK_S32  poc[32];
72     RK_U8   used[32];
73     RK_U8   nb_refs;
74 } LongTermRPS;
75 
76 typedef struct RefPicList {
77     struct HEVCFrame *ref[MAX_REFS];
78     RK_S32 list[MAX_REFS];
79     RK_S32 isLongTerm[MAX_REFS];
80     RK_S32 nb_refs;
81 } RefPicList;
82 
83 typedef struct RefPicListTab {
84     RefPicList refPicList[2];
85 } RefPicListTab;
86 
87 typedef struct HEVCWindow {
88     RK_S32 left_offset;
89     RK_S32 right_offset;
90     RK_S32 top_offset;
91     RK_S32 bottom_offset;
92 } HEVCWindow;
93 
94 typedef struct VUI {
95     MppRational_t sar;
96 
97     RK_S32 overscan_info_present_flag;
98     RK_S32 overscan_appropriate_flag;
99 
100     RK_S32 video_signal_type_present_flag;
101     RK_S32 video_format;
102     RK_S32 video_full_range_flag;
103     RK_S32 colour_description_present_flag;
104     RK_U8  colour_primaries;
105     RK_U8  transfer_characteristic;
106     RK_U8  matrix_coeffs;
107 
108     RK_S32 chroma_loc_info_present_flag;
109     RK_S32 chroma_sample_loc_type_top_field;
110     RK_S32 chroma_sample_loc_type_bottom_field;
111     RK_S32 neutra_chroma_indication_flag;
112 
113     RK_S32 field_seq_flag;
114     RK_S32 frame_field_info_present_flag;
115 
116     RK_S32 default_display_window_flag;
117     HEVCWindow def_disp_win;
118 
119     RK_S32 vui_timing_info_present_flag;
120     RK_U32 vui_num_units_in_tick;
121     RK_U32 vui_time_scale;
122     RK_S32 vui_poc_proportional_to_timing_flag;
123     RK_S32 vui_num_ticks_poc_diff_one_minus1;
124     RK_S32 vui_hrd_parameters_present_flag;
125 
126     RK_S32 bitstream_restriction_flag;
127     RK_S32 tiles_fixed_structure_flag;
128     RK_S32 motion_vectors_over_pic_boundaries_flag;
129     RK_S32 restricted_ref_pic_lists_flag;
130     RK_S32 min_spatial_segmentation_idc;
131     RK_S32 max_bytes_per_pic_denom;
132     RK_S32 max_bits_per_min_cu_denom;
133     RK_S32 log2_max_mv_length_horizontal;
134     RK_S32 log2_max_mv_length_vertical;
135 } VUI;
136 
137 typedef struct PTLCommon {
138     RK_U8 profile_space;
139     RK_U8 tier_flag;
140     RK_U8 profile_idc;
141     RK_U8 profile_compatibility_flag[32];
142     RK_U8 level_idc;
143     RK_U8 progressive_source_flag;
144     RK_U8 interlaced_source_flag;
145     RK_U8 non_packed_constraint_flag;
146     RK_U8 frame_only_constraint_flag;
147 } PTLCommon;
148 
149 typedef struct PTL {
150     PTLCommon general_ptl;
151     PTLCommon sub_layer_ptl[MAX_SUB_LAYERS];
152 
153     RK_U8  sub_layer_profile_present_flag[MAX_SUB_LAYERS];
154     RK_U8  sub_layer_level_present_flag[MAX_SUB_LAYERS];
155 
156     RK_S32 sub_layer_profile_space[MAX_SUB_LAYERS];
157     RK_U8  sub_layer_tier_flag[MAX_SUB_LAYERS];
158     RK_S32 sub_layer_profile_idc[MAX_SUB_LAYERS];
159     RK_U8  sub_layer_profile_compatibility_flags[MAX_SUB_LAYERS][32];
160     RK_S32 sub_layer_level_idc[MAX_SUB_LAYERS];
161 } PTL;
162 
163 typedef struct HEVCVPS {
164     RK_U8  vps_temporal_id_nesting_flag;
165     RK_S32 vps_max_layers;
166     RK_S32 vps_max_sub_layers; ///< vps_max_temporal_layers_minus1 + 1
167 
168     PTL     ptl;
169     RK_S32 vps_sub_layer_ordering_info_present_flag;
170     RK_U32 vps_max_dec_pic_buffering[MAX_SUB_LAYERS];
171     RK_U32 vps_num_reorder_pics[MAX_SUB_LAYERS];
172     RK_U32 vps_max_latency_increase[MAX_SUB_LAYERS];
173     RK_S32 vps_max_layer_id;
174     RK_S32 vps_num_layer_sets; ///< vps_num_layer_sets_minus1 + 1
175     RK_U8  vps_timing_info_present_flag;
176     RK_U32 vps_num_units_in_tick;
177     RK_U32 vps_time_scale;
178     RK_U8  vps_poc_proportional_to_timing_flag;
179     RK_S32 vps_num_ticks_poc_diff_one; ///< vps_num_ticks_poc_diff_one_minus1 + 1
180     RK_S32 vps_num_hrd_parameters;
181 
182     RK_S32 vps_extension_flag;
183 
184 } HEVCVPS;
185 
186 typedef struct ScalingList {
187     /* This is a little wasteful, since sizeID 0 only needs 8 coeffs,
188      * and size ID 3 only has 2 arrays, not 6. */
189     RK_U8 sl[4][6][64];
190     RK_U8 sl_dc[2][6];
191 } ScalingList;
192 
193 typedef struct HEVCSPS {
194     RK_U32 vps_id;
195     RK_U32 sps_id;
196     RK_S32 chroma_format_idc;
197     RK_U8 separate_colour_plane_flag;
198 
199     ///< output (i.e. cropped) values
200     RK_S32 output_width, output_height;
201     HEVCWindow output_window;
202 
203     HEVCWindow pic_conf_win;
204 
205     RK_S32 bit_depth;
206     RK_S32 bit_depth_chroma;///<- zrh add
207     RK_S32 pixel_shift;
208     RK_S32 pix_fmt;
209 
210     RK_U32 log2_max_poc_lsb;
211     RK_S32 pcm_enabled_flag;
212 
213     RK_S32 max_sub_layers;
214     struct {
215         int max_dec_pic_buffering;
216         int num_reorder_pics;
217         int max_latency_increase;
218     } temporal_layer[MAX_SUB_LAYERS];
219 
220     VUI vui;
221     PTL ptl;
222 
223     RK_U8 scaling_list_enable_flag;
224     ScalingList scaling_list;
225 
226     RK_U32 nb_st_rps;
227     ShortTermRPS st_rps[MAX_SHORT_TERM_RPS_COUNT];
228 
229     RK_U8 amp_enabled_flag;
230     RK_U8 sao_enabled;
231 
232     RK_U8 long_term_ref_pics_present_flag;
233     RK_U16 lt_ref_pic_poc_lsb_sps[32];
234     RK_U8 used_by_curr_pic_lt_sps_flag[32];
235     RK_U8 num_long_term_ref_pics_sps;
236 
237     struct {
238         RK_U8  bit_depth;
239         RK_U8  bit_depth_chroma;
240         RK_U32 log2_min_pcm_cb_size;
241         RK_U32 log2_max_pcm_cb_size;
242         RK_U8  loop_filter_disable_flag;
243     } pcm;
244     RK_U8 sps_temporal_mvp_enabled_flag;
245     RK_U8 sps_strong_intra_smoothing_enable_flag;
246 
247     RK_U32 log2_min_cb_size;
248     RK_U32 log2_diff_max_min_coding_block_size;
249     RK_U32 log2_min_tb_size;
250     RK_U32 log2_max_trafo_size;
251     RK_S32 log2_ctb_size;
252     RK_U32 log2_min_pu_size;
253 
254     RK_S32 max_transform_hierarchy_depth_inter;
255     RK_S32 max_transform_hierarchy_depth_intra;
256 
257     ///< coded frame dimension in various units
258     RK_S32 width;
259     RK_S32 height;
260     RK_S32 ctb_width;
261     RK_S32 ctb_height;
262     RK_S32 ctb_size;
263     RK_S32 min_cb_width;
264     RK_S32 min_cb_height;
265     RK_S32 min_tb_width;
266     RK_S32 min_tb_height;
267     RK_S32 min_pu_width;
268     RK_S32 min_pu_height;
269 
270     RK_S32 hshift[3];
271     RK_S32 vshift[3];
272 
273     RK_S32 qp_bd_offset;
274 #ifdef SCALED_REF_LAYER_OFFSETS
275     HEVCWindow      scaled_ref_layer_window;
276 #endif
277 #ifdef REF_IDX_MFM
278     RK_S32 set_mfm_enabled_flag;
279 #endif
280 } HEVCSPS;
281 
282 typedef struct HevcPpsBufInfo_t {
283     RK_U32 *column_width;       ///< ColumnWidth
284     RK_U32 *row_height;         ///< RowHeight
285 
286     RK_S32 column_width_size;
287     RK_S32 row_height_size;
288 } HevcPpsBufInfo;
289 
290 typedef struct HEVCPPS {
291     RK_U32 sps_id;
292     RK_U32 pps_id;
293 
294     RK_U8 sign_data_hiding_flag;
295 
296     RK_U8 cabac_init_present_flag;
297 
298     RK_S32 num_ref_idx_l0_default_active; ///< num_ref_idx_l0_default_active_minus1 + 1
299     RK_S32 num_ref_idx_l1_default_active; ///< num_ref_idx_l1_default_active_minus1 + 1
300     RK_S32 pic_init_qp_minus26;
301 
302     RK_U8 constrained_intra_pred_flag;
303     RK_U8 transform_skip_enabled_flag;
304 
305     RK_U8 cu_qp_delta_enabled_flag;
306     RK_S32 diff_cu_qp_delta_depth;
307 
308     RK_S32 cb_qp_offset;
309     RK_S32 cr_qp_offset;
310     RK_U8 pic_slice_level_chroma_qp_offsets_present_flag;
311     RK_U8 weighted_pred_flag;
312     RK_U8 weighted_bipred_flag;
313     RK_U8 output_flag_present_flag;
314     RK_U8 transquant_bypass_enable_flag;
315 
316     RK_U8 dependent_slice_segments_enabled_flag;
317     RK_U8 tiles_enabled_flag;
318     RK_U8 entropy_coding_sync_enabled_flag;
319 
320     RK_S32 num_tile_columns;   ///< num_tile_columns_minus1 + 1
321     RK_S32 num_tile_rows;      ///< num_tile_rows_minus1 + 1
322     RK_U8 uniform_spacing_flag;
323     RK_U8 loop_filter_across_tiles_enabled_flag;
324 
325     RK_U8 seq_loop_filter_across_slices_enabled_flag;
326 
327     RK_U8 deblocking_filter_control_present_flag;
328     RK_U8 deblocking_filter_override_enabled_flag;
329     RK_U8 disable_dbf;
330     RK_S32 beta_offset;    ///< beta_offset_div2 * 2
331     RK_S32 tc_offset;      ///< tc_offset_div2 * 2
332 
333     RK_U8 scaling_list_data_present_flag;
334     ScalingList scaling_list;
335 
336     RK_U8 lists_modification_present_flag;
337     RK_S32 log2_parallel_merge_level; ///< log2_parallel_merge_level_minus2 + 2
338     RK_S32 num_extra_slice_header_bits;
339     RK_U8 slice_header_extension_present_flag;
340 
341     RK_U8 pps_extension_flag;
342     RK_U8 pps_range_extensions_flag;
343     RK_U8 pps_extension_data_flag;
344 
345     // Inferred parameters
346     HevcPpsBufInfo bufs;
347 } HEVCPPS;
348 
349 typedef struct SliceHeader {
350     RK_U32 pps_id;
351 
352     ///< address (in raster order) of the first block in the current slice segment
353     RK_U32   slice_segment_addr;
354     ///< address (in raster order) of the first block in the current slice
355     RK_U32   slice_addr;
356 
357     SliceType slice_type;
358 
359     RK_S32 pic_order_cnt_lsb;
360 
361     RK_U8 first_slice_in_pic_flag;
362     RK_U8 dependent_slice_segment_flag;
363     RK_U8 pic_output_flag;
364     RK_U8 colour_plane_id;
365 
366     ///< RPS coded in the slice header itself is stored here
367     int short_term_ref_pic_set_sps_flag;
368     int short_term_ref_pic_set_size;
369     ShortTermRPS slice_rps;
370     const ShortTermRPS *short_term_rps;
371     LongTermRPS long_term_rps;
372     RK_U32 list_entry_lx[2][32];
373 
374     RK_U8 rpl_modification_flag[2];
375     RK_U8 no_output_of_prior_pics_flag;
376     RK_U8 slice_temporal_mvp_enabled_flag;
377 
378     RK_U32 nb_refs[2];
379 
380     RK_U8 slice_sample_adaptive_offset_flag[3];
381     RK_U8 mvd_l1_zero_flag;
382 
383     RK_U8 cabac_init_flag;
384     RK_U8 disable_deblocking_filter_flag; ///< slice_header_disable_deblocking_filter_flag
385     RK_U8 slice_loop_filter_across_slices_enabled_flag;
386     RK_U8 collocated_list;
387 
388     RK_U32 collocated_ref_idx;
389 
390     RK_S32 slice_qp_delta;
391     RK_S32 slice_cb_qp_offset;
392     RK_S32 slice_cr_qp_offset;
393 
394     RK_S32 beta_offset;    ///< beta_offset_div2 * 2
395     RK_S32 tc_offset;      ///< tc_offset_div2 * 2
396 
397     RK_U32 max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand
398 
399     RK_S32 *entry_point_offset;
400     RK_S32 * offset;
401     RK_S32 * size;
402     RK_S32 num_entry_point_offsets;
403 
404     RK_S8 slice_qp;
405 
406     RK_U8 luma_log2_weight_denom;
407     RK_S16 chroma_log2_weight_denom;
408 
409     RK_S16 luma_weight_l0[16];
410     RK_S16 chroma_weight_l0[16][2];
411     RK_S16 chroma_weight_l1[16][2];
412     RK_S16 luma_weight_l1[16];
413 
414     RK_S16 luma_offset_l0[16];
415     RK_S16 chroma_offset_l0[16][2];
416 
417     RK_S16 luma_offset_l1[16];
418     RK_S16 chroma_offset_l1[16][2];
419 
420 #ifdef REF_IDX_FRAMEWORK
421     RK_S32 inter_layer_pred_enabled_flag;
422 #endif
423 
424 #ifdef JCTVC_M0458_INTERLAYER_RPS_SIG
425     RK_S32     active_num_ILR_ref_idx;        //< Active inter-layer reference pictures
426     RK_S32     inter_layer_pred_layer_idc[MAX_VPS_LAYER_ID_PLUS1];
427 #endif
428 
429     RK_S32 slice_ctb_addr_rs;
430 } SliceHeader;
431 
432 typedef struct CurrentFameInf {
433     HEVCVPS vps[MAX_VPS_COUNT];
434     HEVCSPS sps[MAX_SPS_COUNT];
435     HEVCPPS pps[MAX_PPS_COUNT];
436     SliceHeader sh;
437 } CurrentFameInf_t;
438 
439 typedef struct DBParams {
440     RK_S32 beta_offset;
441     RK_S32 tc_offset;
442 } DBParams;
443 
444 #define HEVC_FRAME_FLAG_OUTPUT    (1 << 0)
445 #define HEVC_FRAME_FLAG_SHORT_REF (1 << 1)
446 #define HEVC_FRAME_FLAG_LONG_REF  (1 << 2)
447 
448 typedef struct HEVCFrame {
449     MppFrame   frame;
450     RefPicList *refPicList;
451     RK_S32 ctb_count;
452     RK_S32 poc;
453     struct HEVCFrame *collocated_ref;
454 
455     HEVCWindow window;
456 
457     /**
458      * A sequence counter, so that old frames are output first
459      * after a POC reset
460      */
461     RK_U16 sequence;
462 
463     /**
464      * A combination of HEVC_FRAME_FLAG_*
465      */
466     RK_U8 flags;
467     RK_S32 slot_index;
468     RK_U8  error_flag;
469 } HEVCFrame;
470 
471 typedef struct HEVCNAL {
472     RK_U8 *rbsp_buffer;
473     RK_S32 rbsp_buffer_size;
474     RK_S32 size;
475     const RK_U8 *data;
476 } HEVCNAL;
477 
478 typedef struct HEVCLocalContext {
479     BitReadCtx_t gb;
480 } HEVCLocalContext;
481 
482 
483 typedef struct REF_PIC_DEC_INFO {
484     RK_U8          dpb_index;
485     RK_U8          is_long_term;
486 } REF_PIC_DEC_INFO;
487 
488 typedef struct HEVCSEIAlternativeTransfer {
489     RK_S32 present;
490     RK_S32 preferred_transfer_characteristics;
491 } HEVCSEIAlternativeTransfer;
492 
493 typedef struct HEVCContext {
494     H265dContext_t *h265dctx;
495 
496     HEVCLocalContext    *HEVClc;
497 
498     MppFrame frame;
499 
500     const HEVCVPS *vps;
501     const HEVCSPS *sps;
502     const HEVCPPS *pps;
503     RK_U8 *vps_list[MAX_VPS_COUNT];
504     RK_U8 *sps_list[MAX_SPS_COUNT];
505     RK_U8 *pps_list[MAX_PPS_COUNT];
506 
507     MppMemPool sps_pool;
508 
509     SliceHeader sh;
510 
511     ///< candidate references for the current frame
512     RefPicList rps[5];
513 
514     enum NALUnitType nal_unit_type;
515     RK_S32 temporal_id;  ///< temporal_id_plus1 - 1
516     HEVCFrame *ref;
517     HEVCFrame DPB[MAX_DPB_SIZE];
518     RK_S32 poc;
519     RK_S32 pocTid0;
520     RK_S32 slice_idx; ///< number of the slice being currently decoded
521     RK_S32 eos;       ///< current packet contains an EOS/EOB NAL
522     RK_S32 max_ra;
523 
524     RK_S32 is_decoded;
525 
526 
527     /** used on BE to byteswap the lines for checksumming */
528     RK_U8  *checksum_buf;
529     RK_S32      checksum_buf_size;
530 
531     /**
532      * Sequence counters for decoded and output frames, so that old
533      * frames are output first after a POC reset
534      */
535     RK_U16 seq_decode;
536     RK_U16 seq_output;
537 
538     RK_S32 wpp_err;
539     RK_S32 skipped_bytes;
540 
541     RK_U8 *data;
542 
543     HEVCNAL *nals;
544     RK_S32 nb_nals;
545     RK_S32 nals_allocated;
546     // type of the first VCL NAL of the current frame
547     enum NALUnitType first_nal_type;
548 
549     RK_U8 context_initialized;
550     RK_U8 is_nalff;       ///< this flag is != 0 if bitstream is encapsulated
551     ///< as a format defined in 14496-15
552     RK_S32 temporal_layer_id;
553     RK_S32 decoder_id;
554     RK_S32 apply_defdispwin;
555 
556     RK_S32 active_seq_parameter_set_id;
557 
558     RK_S32 nal_length_size;    ///< Number of bytes used for nal length (1, 2 or 4)
559     RK_S32 nuh_layer_id;
560 
561     /** frame packing arrangement variables */
562     RK_S32 sei_frame_packing_present;
563     RK_S32 frame_packing_arrangement_type;
564     RK_S32 content_interpretation_type;
565     RK_S32 quincunx_subsampling;
566 
567     RK_S32 picture_struct;
568 
569     /** 1 if the independent slice segment header was successfully parsed */
570     RK_U8 slice_initialized;
571 
572     RK_S32     decode_checksum_sei;
573 
574 
575     RK_U8     scaling_list[81][1360];
576     RK_U8     scaling_list_listen[81];
577     RK_U8     sps_list_of_updated[MAX_SPS_COUNT];///< zrh add
578     RK_U8     pps_list_of_updated[MAX_PPS_COUNT];///< zrh add
579 
580     RK_S32    rps_used[16];
581     RK_S32    nb_rps_used;
582     REF_PIC_DEC_INFO rps_pic_info[600][2][15];      // zrh add
583     RK_U8     lowdelay_flag[600];
584     RK_U8     rps_bit_offset[600];
585     RK_U8     rps_bit_offset_st[600];
586     RK_U8     slice_nb_rps_poc[600];
587 
588     RK_S32    frame_size;
589 
590     RK_S32    framestrid;
591 
592     RK_U32    nb_frame;
593 
594     RK_U8     output_frame_idx;
595 
596     RK_U32    got_frame;
597     RK_U32    extra_has_frame;
598 
599     MppFrameMasteringDisplayMetadata mastering_display;
600     MppFrameContentLightMetadata content_light;
601     MppFrameHdrDynamicMeta *hdr_dynamic_meta;
602     HEVCSEIAlternativeTransfer alternative_transfer;
603 
604     MppBufSlots slots;
605 
606     MppBufSlots packet_slots;
607     HalDecTask *task;
608 
609     MppPacket input_packet;
610     void *hal_pic_private;
611 
612     RK_S64 pts;
613     RK_U8  has_get_eos;
614     RK_U8  miss_ref_flag;
615     RK_U8  pre_pps_id;
616     RK_U8  ps_need_upate;
617 
618     /*temporary storage for slice_cut_param*/
619     RK_U32  start_bit;
620     RK_U32  end_bit;
621     void   *pre_pps_data;
622     RK_S32  pps_len;
623     RK_S32  pps_buf_size;
624     RK_S32  first_i_fast_play;
625 
626     /* hdr info */
627     RK_U32  is_hdr;
628     RK_U32  hdr_dynamic;
629 
630     RK_U32  deny_flag;
631     RecoveryPoint recovery;
632 } HEVCContext;
633 
634 RK_S32 mpp_hevc_decode_short_term_rps(HEVCContext *s, ShortTermRPS *rps,
635                                       const HEVCSPS *sps, RK_S32 is_slice_header);
636 RK_S32 mpp_hevc_decode_nal_vps(HEVCContext *s);
637 RK_S32 mpp_hevc_decode_nal_sps(HEVCContext *s);
638 RK_S32 mpp_hevc_decode_nal_pps(HEVCContext *s);
639 RK_S32 mpp_hevc_decode_nal_sei(HEVCContext *s);
640 
641 RK_S32 mpp_hevc_extract_rbsp(HEVCContext *s, const RK_U8 *src, RK_S32 length,
642                              HEVCNAL *nal);
643 
644 
645 /**
646  * Mark all frames in DPB as unused for reference.
647  */
648 void mpp_hevc_clear_refs(HEVCContext *s);
649 
650 /**
651  * Drop all frames currently in DPB.
652  */
653 void mpp_hevc_flush_dpb(HEVCContext *s);
654 
655 /**
656  * Compute POC of the current frame and return it.
657  */
658 int mpp_hevc_compute_poc(HEVCContext *s, RK_S32 poc_lsb);
659 
660 
661 /**
662  * Construct the reference picture sets for the current frame.
663  */
664 RK_S32 mpp_hevc_frame_rps(HEVCContext *s);
665 
666 /**
667  * Construct the reference picture list(s) for the current slice.
668  */
669 RK_S32 mpp_hevc_slice_rpl(HEVCContext *s);
670 
671 /**
672  * Get the number of candidate references for the current frame.
673  */
674 RK_S32 mpp_hevc_frame_nb_refs(HEVCContext *s);
675 RK_S32 mpp_hevc_set_new_ref(HEVCContext *s, MppFrame *frame, RK_S32 poc);
676 
677 /**
678  * Find next frame in output order and put a reference to it in frame.
679  * @return 1 if a frame was output, 0 otherwise
680  */
681 void mpp_hevc_unref_frame(HEVCContext *s, HEVCFrame *frame, RK_S32 flags);
682 
683 void mpp_hevc_pps_free(RK_U8 *data);
684 
685 void mpp_hevc_fill_dynamic_meta(HEVCContext *s, const RK_U8 *data, RK_U32 size, RK_U32 hdr_fmt);
686 
687 #endif /* __H265D_PAESER_H__ */
688