FFmpeg coverage


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