FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/hevcdec.h
Date: 2022-01-27 16:04:32
Exec Total Coverage
Lines: 4 6 66.7%
Branches: 1 2 50.0%

Line Branch Exec Source
1 /*
2 * HEVC video decoder
3 *
4 * Copyright (C) 2012 - 2013 Guillaume Martres
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23 #ifndef AVCODEC_HEVCDEC_H
24 #define AVCODEC_HEVCDEC_H
25
26 #include <stdatomic.h>
27
28 #include "libavutil/buffer.h"
29 #include "libavutil/md5.h"
30 #include "libavutil/mem_internal.h"
31
32 #include "avcodec.h"
33 #include "bswapdsp.h"
34 #include "cabac.h"
35 #include "dovi_rpu.h"
36 #include "get_bits.h"
37 #include "hevcpred.h"
38 #include "h2645_parse.h"
39 #include "hevc.h"
40 #include "hevc_ps.h"
41 #include "hevc_sei.h"
42 #include "hevcdsp.h"
43 #include "h274.h"
44 #include "internal.h"
45 #include "thread.h"
46 #include "videodsp.h"
47
48 #define SHIFT_CTB_WPP 2
49
50 #define MAX_TB_SIZE 32
51 #define MAX_QP 51
52 #define DEFAULT_INTRA_TC_OFFSET 2
53
54 #define HEVC_CONTEXTS 199
55 #define HEVC_STAT_COEFFS 4
56
57 #define MRG_MAX_NUM_CANDS 5
58
59 #define L0 0
60 #define L1 1
61
62 #define EPEL_EXTRA_BEFORE 1
63 #define EPEL_EXTRA_AFTER 2
64 #define EPEL_EXTRA 3
65 #define QPEL_EXTRA_BEFORE 3
66 #define QPEL_EXTRA_AFTER 4
67 #define QPEL_EXTRA 7
68
69 #define EDGE_EMU_BUFFER_STRIDE 80
70
71 /**
72 * Value of the luma sample at position (x, y) in the 2D array tab.
73 */
74 #define SAMPLE(tab, x, y) ((tab)[(y) * s->sps->width + (x)])
75 #define SAMPLE_CTB(tab, x, y) ((tab)[(y) * min_cb_width + (x)])
76
77 #define IS_IDR(s) ((s)->nal_unit_type == HEVC_NAL_IDR_W_RADL || (s)->nal_unit_type == HEVC_NAL_IDR_N_LP)
78 #define IS_BLA(s) ((s)->nal_unit_type == HEVC_NAL_BLA_W_RADL || (s)->nal_unit_type == HEVC_NAL_BLA_W_LP || \
79 (s)->nal_unit_type == HEVC_NAL_BLA_N_LP)
80 #define IS_IRAP(s) ((s)->nal_unit_type >= 16 && (s)->nal_unit_type <= 23)
81
82 enum RPSType {
83 ST_CURR_BEF = 0,
84 ST_CURR_AFT,
85 ST_FOLL,
86 LT_CURR,
87 LT_FOLL,
88 NB_RPS_TYPE,
89 };
90
91 enum SyntaxElement {
92 SAO_MERGE_FLAG = 0,
93 SAO_TYPE_IDX,
94 SAO_EO_CLASS,
95 SAO_BAND_POSITION,
96 SAO_OFFSET_ABS,
97 SAO_OFFSET_SIGN,
98 END_OF_SLICE_FLAG,
99 SPLIT_CODING_UNIT_FLAG,
100 CU_TRANSQUANT_BYPASS_FLAG,
101 SKIP_FLAG,
102 CU_QP_DELTA,
103 PRED_MODE_FLAG,
104 PART_MODE,
105 PCM_FLAG,
106 PREV_INTRA_LUMA_PRED_FLAG,
107 MPM_IDX,
108 REM_INTRA_LUMA_PRED_MODE,
109 INTRA_CHROMA_PRED_MODE,
110 MERGE_FLAG,
111 MERGE_IDX,
112 INTER_PRED_IDC,
113 REF_IDX_L0,
114 REF_IDX_L1,
115 ABS_MVD_GREATER0_FLAG,
116 ABS_MVD_GREATER1_FLAG,
117 ABS_MVD_MINUS2,
118 MVD_SIGN_FLAG,
119 MVP_LX_FLAG,
120 NO_RESIDUAL_DATA_FLAG,
121 SPLIT_TRANSFORM_FLAG,
122 CBF_LUMA,
123 CBF_CB_CR,
124 TRANSFORM_SKIP_FLAG,
125 EXPLICIT_RDPCM_FLAG,
126 EXPLICIT_RDPCM_DIR_FLAG,
127 LAST_SIGNIFICANT_COEFF_X_PREFIX,
128 LAST_SIGNIFICANT_COEFF_Y_PREFIX,
129 LAST_SIGNIFICANT_COEFF_X_SUFFIX,
130 LAST_SIGNIFICANT_COEFF_Y_SUFFIX,
131 SIGNIFICANT_COEFF_GROUP_FLAG,
132 SIGNIFICANT_COEFF_FLAG,
133 COEFF_ABS_LEVEL_GREATER1_FLAG,
134 COEFF_ABS_LEVEL_GREATER2_FLAG,
135 COEFF_ABS_LEVEL_REMAINING,
136 COEFF_SIGN_FLAG,
137 LOG2_RES_SCALE_ABS,
138 RES_SCALE_SIGN_FLAG,
139 CU_CHROMA_QP_OFFSET_FLAG,
140 CU_CHROMA_QP_OFFSET_IDX,
141 };
142
143 enum PartMode {
144 PART_2Nx2N = 0,
145 PART_2NxN = 1,
146 PART_Nx2N = 2,
147 PART_NxN = 3,
148 PART_2NxnU = 4,
149 PART_2NxnD = 5,
150 PART_nLx2N = 6,
151 PART_nRx2N = 7,
152 };
153
154 enum PredMode {
155 MODE_INTER = 0,
156 MODE_INTRA,
157 MODE_SKIP,
158 };
159
160 enum InterPredIdc {
161 PRED_L0 = 0,
162 PRED_L1,
163 PRED_BI,
164 };
165
166 enum PredFlag {
167 PF_INTRA = 0,
168 PF_L0,
169 PF_L1,
170 PF_BI,
171 };
172
173 enum IntraPredMode {
174 INTRA_PLANAR = 0,
175 INTRA_DC,
176 INTRA_ANGULAR_2,
177 INTRA_ANGULAR_3,
178 INTRA_ANGULAR_4,
179 INTRA_ANGULAR_5,
180 INTRA_ANGULAR_6,
181 INTRA_ANGULAR_7,
182 INTRA_ANGULAR_8,
183 INTRA_ANGULAR_9,
184 INTRA_ANGULAR_10,
185 INTRA_ANGULAR_11,
186 INTRA_ANGULAR_12,
187 INTRA_ANGULAR_13,
188 INTRA_ANGULAR_14,
189 INTRA_ANGULAR_15,
190 INTRA_ANGULAR_16,
191 INTRA_ANGULAR_17,
192 INTRA_ANGULAR_18,
193 INTRA_ANGULAR_19,
194 INTRA_ANGULAR_20,
195 INTRA_ANGULAR_21,
196 INTRA_ANGULAR_22,
197 INTRA_ANGULAR_23,
198 INTRA_ANGULAR_24,
199 INTRA_ANGULAR_25,
200 INTRA_ANGULAR_26,
201 INTRA_ANGULAR_27,
202 INTRA_ANGULAR_28,
203 INTRA_ANGULAR_29,
204 INTRA_ANGULAR_30,
205 INTRA_ANGULAR_31,
206 INTRA_ANGULAR_32,
207 INTRA_ANGULAR_33,
208 INTRA_ANGULAR_34,
209 };
210
211 enum SAOType {
212 SAO_NOT_APPLIED = 0,
213 SAO_BAND,
214 SAO_EDGE,
215 SAO_APPLIED
216 };
217
218 enum SAOEOClass {
219 SAO_EO_HORIZ = 0,
220 SAO_EO_VERT,
221 SAO_EO_135D,
222 SAO_EO_45D,
223 };
224
225 enum ScanType {
226 SCAN_DIAG = 0,
227 SCAN_HORIZ,
228 SCAN_VERT,
229 };
230
231 typedef struct LongTermRPS {
232 int poc[32];
233 uint8_t poc_msb_present[32];
234 uint8_t used[32];
235 uint8_t nb_refs;
236 } LongTermRPS;
237
238 typedef struct RefPicList {
239 struct HEVCFrame *ref[HEVC_MAX_REFS];
240 int list[HEVC_MAX_REFS];
241 int isLongTerm[HEVC_MAX_REFS];
242 int nb_refs;
243 } RefPicList;
244
245 typedef struct RefPicListTab {
246 RefPicList refPicList[2];
247 } RefPicListTab;
248
249 typedef struct SliceHeader {
250 unsigned int pps_id;
251
252 ///< address (in raster order) of the first block in the current slice segment
253 unsigned int slice_segment_addr;
254 ///< address (in raster order) of the first block in the current slice
255 unsigned int slice_addr;
256
257 enum HEVCSliceType slice_type;
258
259 int pic_order_cnt_lsb;
260
261 uint8_t first_slice_in_pic_flag;
262 uint8_t dependent_slice_segment_flag;
263 uint8_t pic_output_flag;
264 uint8_t colour_plane_id;
265
266 ///< RPS coded in the slice header itself is stored here
267 int short_term_ref_pic_set_sps_flag;
268 int short_term_ref_pic_set_size;
269 ShortTermRPS slice_rps;
270 const ShortTermRPS *short_term_rps;
271 int long_term_ref_pic_set_size;
272 LongTermRPS long_term_rps;
273 unsigned int list_entry_lx[2][32];
274
275 uint8_t rpl_modification_flag[2];
276 uint8_t no_output_of_prior_pics_flag;
277 uint8_t slice_temporal_mvp_enabled_flag;
278
279 unsigned int nb_refs[2];
280
281 uint8_t slice_sample_adaptive_offset_flag[3];
282 uint8_t mvd_l1_zero_flag;
283
284 uint8_t cabac_init_flag;
285 uint8_t disable_deblocking_filter_flag; ///< slice_header_disable_deblocking_filter_flag
286 uint8_t slice_loop_filter_across_slices_enabled_flag;
287 uint8_t collocated_list;
288
289 unsigned int collocated_ref_idx;
290
291 int slice_qp_delta;
292 int slice_cb_qp_offset;
293 int slice_cr_qp_offset;
294
295 uint8_t cu_chroma_qp_offset_enabled_flag;
296
297 int beta_offset; ///< beta_offset_div2 * 2
298 int tc_offset; ///< tc_offset_div2 * 2
299
300 unsigned int max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand
301
302 unsigned *entry_point_offset;
303 int * offset;
304 int * size;
305 int num_entry_point_offsets;
306
307 int8_t slice_qp;
308
309 uint8_t luma_log2_weight_denom;
310 int16_t chroma_log2_weight_denom;
311
312 int16_t luma_weight_l0[16];
313 int16_t chroma_weight_l0[16][2];
314 int16_t chroma_weight_l1[16][2];
315 int16_t luma_weight_l1[16];
316
317 int16_t luma_offset_l0[16];
318 int16_t chroma_offset_l0[16][2];
319
320 int16_t luma_offset_l1[16];
321 int16_t chroma_offset_l1[16][2];
322
323 int slice_ctb_addr_rs;
324 } SliceHeader;
325
326 typedef struct CodingUnit {
327 int x;
328 int y;
329
330 enum PredMode pred_mode; ///< PredMode
331 enum PartMode part_mode; ///< PartMode
332
333 // Inferred parameters
334 uint8_t intra_split_flag; ///< IntraSplitFlag
335 uint8_t max_trafo_depth; ///< MaxTrafoDepth
336 uint8_t cu_transquant_bypass_flag;
337 } CodingUnit;
338
339 typedef struct Mv {
340 int16_t x; ///< horizontal component of motion vector
341 int16_t y; ///< vertical component of motion vector
342 } Mv;
343
344 typedef struct MvField {
345 DECLARE_ALIGNED(4, Mv, mv)[2];
346 int8_t ref_idx[2];
347 int8_t pred_flag;
348 } MvField;
349
350 typedef struct NeighbourAvailable {
351 int cand_bottom_left;
352 int cand_left;
353 int cand_up;
354 int cand_up_left;
355 int cand_up_right;
356 int cand_up_right_sap;
357 } NeighbourAvailable;
358
359 typedef struct PredictionUnit {
360 int mpm_idx;
361 int rem_intra_luma_pred_mode;
362 uint8_t intra_pred_mode[4];
363 Mv mvd;
364 uint8_t merge_flag;
365 uint8_t intra_pred_mode_c[4];
366 uint8_t chroma_mode_c[4];
367 } PredictionUnit;
368
369 typedef struct TransformUnit {
370 int cu_qp_delta;
371
372 int res_scale_val;
373
374 // Inferred parameters;
375 int intra_pred_mode;
376 int intra_pred_mode_c;
377 int chroma_mode_c;
378 uint8_t is_cu_qp_delta_coded;
379 uint8_t is_cu_chroma_qp_offset_coded;
380 int8_t cu_qp_offset_cb;
381 int8_t cu_qp_offset_cr;
382 uint8_t cross_pf;
383 } TransformUnit;
384
385 typedef struct DBParams {
386 int beta_offset;
387 int tc_offset;
388 } DBParams;
389
390 #define HEVC_FRAME_FLAG_OUTPUT (1 << 0)
391 #define HEVC_FRAME_FLAG_SHORT_REF (1 << 1)
392 #define HEVC_FRAME_FLAG_LONG_REF (1 << 2)
393 #define HEVC_FRAME_FLAG_BUMPING (1 << 3)
394
395 typedef struct HEVCFrame {
396 AVFrame *frame;
397 AVFrame *frame_grain;
398 ThreadFrame tf;
399 ThreadFrame tf_grain;
400 int needs_fg; /* 1 if grain needs to be applied by the decoder */
401 MvField *tab_mvf;
402 RefPicList *refPicList;
403 RefPicListTab **rpl_tab;
404 int ctb_count;
405 int poc;
406 struct HEVCFrame *collocated_ref;
407
408 AVBufferRef *tab_mvf_buf;
409 AVBufferRef *rpl_tab_buf;
410 AVBufferRef *rpl_buf;
411
412 AVBufferRef *hwaccel_priv_buf;
413 void *hwaccel_picture_private;
414
415 /**
416 * A sequence counter, so that old frames are output first
417 * after a POC reset
418 */
419 uint16_t sequence;
420
421 /**
422 * A combination of HEVC_FRAME_FLAG_*
423 */
424 uint8_t flags;
425 } HEVCFrame;
426
427 typedef struct HEVCLocalContext {
428 uint8_t cabac_state[HEVC_CONTEXTS];
429
430 uint8_t stat_coeff[HEVC_STAT_COEFFS];
431
432 uint8_t first_qp_group;
433
434 GetBitContext gb;
435 CABACContext cc;
436
437 int8_t qp_y;
438 int8_t curr_qp_y;
439
440 int qPy_pred;
441
442 TransformUnit tu;
443
444 uint8_t ctb_left_flag;
445 uint8_t ctb_up_flag;
446 uint8_t ctb_up_right_flag;
447 uint8_t ctb_up_left_flag;
448 int end_of_tiles_x;
449 int end_of_tiles_y;
450 /* +7 is for subpixel interpolation, *2 for high bit depths */
451 DECLARE_ALIGNED(32, uint8_t, edge_emu_buffer)[(MAX_PB_SIZE + 7) * EDGE_EMU_BUFFER_STRIDE * 2];
452 /* The extended size between the new edge emu buffer is abused by SAO */
453 DECLARE_ALIGNED(32, uint8_t, edge_emu_buffer2)[(MAX_PB_SIZE + 7) * EDGE_EMU_BUFFER_STRIDE * 2];
454 DECLARE_ALIGNED(32, int16_t, tmp)[MAX_PB_SIZE * MAX_PB_SIZE];
455
456 int ct_depth;
457 CodingUnit cu;
458 PredictionUnit pu;
459 NeighbourAvailable na;
460
461 #define BOUNDARY_LEFT_SLICE (1 << 0)
462 #define BOUNDARY_LEFT_TILE (1 << 1)
463 #define BOUNDARY_UPPER_SLICE (1 << 2)
464 #define BOUNDARY_UPPER_TILE (1 << 3)
465 /* properties of the boundary of the current CTB for the purposes
466 * of the deblocking filter */
467 int boundary_flags;
468 } HEVCLocalContext;
469
470 typedef struct HEVCContext {
471 const AVClass *c; // needed by private avoptions
472 AVCodecContext *avctx;
473
474 struct HEVCContext **sList;
475
476 HEVCLocalContext **HEVClcList;
477 HEVCLocalContext *HEVClc;
478
479 uint8_t threads_type;
480 uint8_t threads_number;
481
482 int width;
483 int height;
484
485 uint8_t *cabac_state;
486 uint8_t stat_coeff[HEVC_STAT_COEFFS];
487
488 /** 1 if the independent slice segment header was successfully parsed */
489 uint8_t slice_initialized;
490
491 AVFrame *frame;
492 AVFrame *output_frame;
493 uint8_t *sao_pixel_buffer_h[3];
494 uint8_t *sao_pixel_buffer_v[3];
495
496 HEVCParamSets ps;
497 HEVCSEI sei;
498 struct AVMD5 *md5_ctx;
499
500 AVBufferPool *tab_mvf_pool;
501 AVBufferPool *rpl_tab_pool;
502
503 ///< candidate references for the current frame
504 RefPicList rps[5];
505
506 SliceHeader sh;
507 SAOParams *sao;
508 DBParams *deblock;
509 enum HEVCNALUnitType nal_unit_type;
510 int temporal_id; ///< temporal_id_plus1 - 1
511 HEVCFrame *ref;
512 HEVCFrame DPB[32];
513 int poc;
514 int pocTid0;
515 int slice_idx; ///< number of the slice being currently decoded
516 int eos; ///< current packet contains an EOS/EOB NAL
517 int last_eos; ///< last packet contains an EOS/EOB NAL
518 int max_ra;
519 int bs_width;
520 int bs_height;
521 int overlap;
522
523 int is_decoded;
524 int no_rasl_output_flag;
525
526 HEVCPredContext hpc;
527 HEVCDSPContext hevcdsp;
528 VideoDSPContext vdsp;
529 BswapDSPContext bdsp;
530 H274FilmGrainDatabase h274db;
531 int8_t *qp_y_tab;
532 uint8_t *horizontal_bs;
533 uint8_t *vertical_bs;
534
535 int32_t *tab_slice_address;
536
537 // CU
538 uint8_t *skip_flag;
539 uint8_t *tab_ct_depth;
540 // PU
541 uint8_t *tab_ipm;
542
543 uint8_t *cbf_luma; // cbf_luma of colocated TU
544 uint8_t *is_pcm;
545
546 // CTB-level flags affecting loop filter operation
547 uint8_t *filter_slice_edges;
548
549 /** used on BE to byteswap the lines for checksumming */
550 uint8_t *checksum_buf;
551 int checksum_buf_size;
552
553 /**
554 * Sequence counters for decoded and output frames, so that old
555 * frames are output first after a POC reset
556 */
557 uint16_t seq_decode;
558 uint16_t seq_output;
559
560 int enable_parallel_tiles;
561 atomic_int wpp_err;
562
563 const uint8_t *data;
564
565 H2645Packet pkt;
566 // type of the first VCL NAL of the current frame
567 enum HEVCNALUnitType first_nal_type;
568
569 uint8_t context_initialized;
570 int is_nalff; ///< this flag is != 0 if bitstream is encapsulated
571 ///< as a format defined in 14496-15
572 int apply_defdispwin;
573
574 int nal_length_size; ///< Number of bytes used for nal length (1, 2 or 4)
575 int nuh_layer_id;
576
577 AVBufferRef *rpu_buf; ///< 0 or 1 Dolby Vision RPUs.
578 DOVIContext dovi_ctx; ///< Dolby Vision decoding context
579 } HEVCContext;
580
581 /**
582 * Mark all frames in DPB as unused for reference.
583 */
584 void ff_hevc_clear_refs(HEVCContext *s);
585
586 /**
587 * Drop all frames currently in DPB.
588 */
589 void ff_hevc_flush_dpb(HEVCContext *s);
590
591 RefPicList *ff_hevc_get_ref_list(HEVCContext *s, HEVCFrame *frame,
592 int x0, int y0);
593
594 /**
595 * Construct the reference picture sets for the current frame.
596 */
597 int ff_hevc_frame_rps(HEVCContext *s);
598
599 /**
600 * Construct the reference picture list(s) for the current slice.
601 */
602 int ff_hevc_slice_rpl(HEVCContext *s);
603
604 void ff_hevc_save_states(HEVCContext *s, int ctb_addr_ts);
605 int ff_hevc_cabac_init(HEVCContext *s, int ctb_addr_ts, int thread);
606 int ff_hevc_sao_merge_flag_decode(HEVCContext *s);
607 int ff_hevc_sao_type_idx_decode(HEVCContext *s);
608 int ff_hevc_sao_band_position_decode(HEVCContext *s);
609 int ff_hevc_sao_offset_abs_decode(HEVCContext *s);
610 int ff_hevc_sao_offset_sign_decode(HEVCContext *s);
611 int ff_hevc_sao_eo_class_decode(HEVCContext *s);
612 int ff_hevc_end_of_slice_flag_decode(HEVCContext *s);
613 int ff_hevc_cu_transquant_bypass_flag_decode(HEVCContext *s);
614 int ff_hevc_skip_flag_decode(HEVCContext *s, int x0, int y0,
615 int x_cb, int y_cb);
616 int ff_hevc_pred_mode_decode(HEVCContext *s);
617 int ff_hevc_split_coding_unit_flag_decode(HEVCContext *s, int ct_depth,
618 int x0, int y0);
619 int ff_hevc_part_mode_decode(HEVCContext *s, int log2_cb_size);
620 int ff_hevc_pcm_flag_decode(HEVCContext *s);
621 int ff_hevc_prev_intra_luma_pred_flag_decode(HEVCContext *s);
622 int ff_hevc_mpm_idx_decode(HEVCContext *s);
623 int ff_hevc_rem_intra_luma_pred_mode_decode(HEVCContext *s);
624 int ff_hevc_intra_chroma_pred_mode_decode(HEVCContext *s);
625 int ff_hevc_merge_idx_decode(HEVCContext *s);
626 int ff_hevc_merge_flag_decode(HEVCContext *s);
627 int ff_hevc_inter_pred_idc_decode(HEVCContext *s, int nPbW, int nPbH);
628 int ff_hevc_ref_idx_lx_decode(HEVCContext *s, int num_ref_idx_lx);
629 int ff_hevc_mvp_lx_flag_decode(HEVCContext *s);
630 int ff_hevc_no_residual_syntax_flag_decode(HEVCContext *s);
631 int ff_hevc_split_transform_flag_decode(HEVCContext *s, int log2_trafo_size);
632 int ff_hevc_cbf_cb_cr_decode(HEVCContext *s, int trafo_depth);
633 int ff_hevc_cbf_luma_decode(HEVCContext *s, int trafo_depth);
634 int ff_hevc_log2_res_scale_abs(HEVCContext *s, int idx);
635 int ff_hevc_res_scale_sign_flag(HEVCContext *s, int idx);
636
637 /**
638 * Get the number of candidate references for the current frame.
639 */
640 int ff_hevc_frame_nb_refs(const HEVCContext *s);
641
642 int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc);
643
644 1020 static av_always_inline int ff_hevc_nal_is_nonref(enum HEVCNALUnitType type)
645 {
646
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1020 times.
1020 switch (type) {
647 case HEVC_NAL_TRAIL_N:
648 case HEVC_NAL_TSA_N:
649 case HEVC_NAL_STSA_N:
650 case HEVC_NAL_RADL_N:
651 case HEVC_NAL_RASL_N:
652 case HEVC_NAL_VCL_N10:
653 case HEVC_NAL_VCL_N12:
654 case HEVC_NAL_VCL_N14:
655 return 1;
656 1020 default: break;
657 }
658 1020 return 0;
659 }
660
661 /**
662 * Find next frame in output order and put a reference to it in frame.
663 * @return 1 if a frame was output, 0 otherwise
664 */
665 int ff_hevc_output_frame(HEVCContext *s, AVFrame *frame, int flush);
666
667 void ff_hevc_bump_frame(HEVCContext *s);
668
669 void ff_hevc_unref_frame(HEVCContext *s, HEVCFrame *frame, int flags);
670
671 void ff_hevc_set_neighbour_available(HEVCContext *s, int x0, int y0,
672 int nPbW, int nPbH);
673 void ff_hevc_luma_mv_merge_mode(HEVCContext *s, int x0, int y0,
674 int nPbW, int nPbH, int log2_cb_size,
675 int part_idx, int merge_idx, MvField *mv);
676 void ff_hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0,
677 int nPbW, int nPbH, int log2_cb_size,
678 int part_idx, int merge_idx,
679 MvField *mv, int mvp_lx_flag, int LX);
680 void ff_hevc_set_qPy(HEVCContext *s, int xBase, int yBase,
681 int log2_cb_size);
682 void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0,
683 int log2_trafo_size);
684 int ff_hevc_cu_qp_delta_sign_flag(HEVCContext *s);
685 int ff_hevc_cu_qp_delta_abs(HEVCContext *s);
686 int ff_hevc_cu_chroma_qp_offset_flag(HEVCContext *s);
687 int ff_hevc_cu_chroma_qp_offset_idx(HEVCContext *s);
688 void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size);
689 void ff_hevc_hls_filters(HEVCContext *s, int x_ctb, int y_ctb, int ctb_size);
690 void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
691 int log2_trafo_size, enum ScanType scan_idx,
692 int c_idx);
693
694 void ff_hevc_hls_mvd_coding(HEVCContext *s, int x0, int y0, int log2_cb_size);
695
696 extern const uint8_t ff_hevc_qpel_extra_before[4];
697 extern const uint8_t ff_hevc_qpel_extra_after[4];
698 extern const uint8_t ff_hevc_qpel_extra[4];
699
700 #endif /* AVCODEC_HEVCDEC_H */
701