FFmpeg coverage


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