]> git.sesse.net Git - ffmpeg/blob - libavcodec/hevcdec.h
decode: flush the internal bsfs instead of constantly reinitalizing them
[ffmpeg] / libavcodec / hevcdec.h
1 /*
2  * HEVC video decoder
3  *
4  * Copyright (C) 2012 - 2013 Guillaume Martres
5  *
6  * This file is part of Libav.
7  *
8  * Libav 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  * Libav 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 Libav; 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 <stddef.h>
27 #include <stdint.h>
28
29 #include "libavutil/buffer.h"
30 #include "libavutil/md5.h"
31
32 #include "avcodec.h"
33 #include "bswapdsp.h"
34 #include "cabac.h"
35 #include "get_bits.h"
36 #include "h2645_parse.h"
37 #include "hevc.h"
38 #include "hevc_ps.h"
39 #include "hevc_sei.h"
40 #include "hevcdsp.h"
41 #include "internal.h"
42 #include "thread.h"
43 #include "videodsp.h"
44
45 //TODO: check if this is really the maximum
46 #define MAX_TRANSFORM_DEPTH 5
47
48 #define MAX_TB_SIZE 32
49 #define MAX_PB_SIZE 64
50 #define MAX_QP 51
51 #define DEFAULT_INTRA_TC_OFFSET 2
52
53 #define HEVC_CONTEXTS 183
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
64 #define EDGE_EMU_BUFFER_STRIDE 80
65
66 /**
67  * Value of the luma sample at position (x, y) in the 2D array tab.
68  */
69 #define SAMPLE(tab, x, y) ((tab)[(y) * s->sps->width + (x)])
70 #define SAMPLE_CTB(tab, x, y) ((tab)[(y) * min_cb_width + (x)])
71
72 #define IS_IDR(s) (s->nal_unit_type == HEVC_NAL_IDR_W_RADL || s->nal_unit_type == HEVC_NAL_IDR_N_LP)
73 #define IS_BLA(s) (s->nal_unit_type == HEVC_NAL_BLA_W_RADL || s->nal_unit_type == HEVC_NAL_BLA_W_LP || \
74                    s->nal_unit_type == HEVC_NAL_BLA_N_LP)
75 #define IS_IRAP(s) (s->nal_unit_type >= 16 && s->nal_unit_type <= 23)
76
77 #define FFUDIV(a,b) (((a) > 0 ? (a) : (a) - (b) + 1) / (b))
78 #define FFUMOD(a,b) ((a) - (b) * FFUDIV(a,b))
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     LAST_SIGNIFICANT_COEFF_X_PREFIX,
124     LAST_SIGNIFICANT_COEFF_Y_PREFIX,
125     LAST_SIGNIFICANT_COEFF_X_SUFFIX,
126     LAST_SIGNIFICANT_COEFF_Y_SUFFIX,
127     SIGNIFICANT_COEFF_GROUP_FLAG,
128     SIGNIFICANT_COEFF_FLAG,
129     COEFF_ABS_LEVEL_GREATER1_FLAG,
130     COEFF_ABS_LEVEL_GREATER2_FLAG,
131     COEFF_ABS_LEVEL_REMAINING,
132     COEFF_SIGN_FLAG,
133 };
134
135 enum PartMode {
136     PART_2Nx2N = 0,
137     PART_2NxN  = 1,
138     PART_Nx2N  = 2,
139     PART_NxN   = 3,
140     PART_2NxnU = 4,
141     PART_2NxnD = 5,
142     PART_nLx2N = 6,
143     PART_nRx2N = 7,
144 };
145
146 enum PredMode {
147     MODE_INTER = 0,
148     MODE_INTRA,
149     MODE_SKIP,
150 };
151
152 enum InterPredIdc {
153     PRED_L0 = 0,
154     PRED_L1,
155     PRED_BI,
156 };
157
158 enum IntraPredMode {
159     INTRA_PLANAR = 0,
160     INTRA_DC,
161     INTRA_ANGULAR_2,
162     INTRA_ANGULAR_3,
163     INTRA_ANGULAR_4,
164     INTRA_ANGULAR_5,
165     INTRA_ANGULAR_6,
166     INTRA_ANGULAR_7,
167     INTRA_ANGULAR_8,
168     INTRA_ANGULAR_9,
169     INTRA_ANGULAR_10,
170     INTRA_ANGULAR_11,
171     INTRA_ANGULAR_12,
172     INTRA_ANGULAR_13,
173     INTRA_ANGULAR_14,
174     INTRA_ANGULAR_15,
175     INTRA_ANGULAR_16,
176     INTRA_ANGULAR_17,
177     INTRA_ANGULAR_18,
178     INTRA_ANGULAR_19,
179     INTRA_ANGULAR_20,
180     INTRA_ANGULAR_21,
181     INTRA_ANGULAR_22,
182     INTRA_ANGULAR_23,
183     INTRA_ANGULAR_24,
184     INTRA_ANGULAR_25,
185     INTRA_ANGULAR_26,
186     INTRA_ANGULAR_27,
187     INTRA_ANGULAR_28,
188     INTRA_ANGULAR_29,
189     INTRA_ANGULAR_30,
190     INTRA_ANGULAR_31,
191     INTRA_ANGULAR_32,
192     INTRA_ANGULAR_33,
193     INTRA_ANGULAR_34,
194 };
195
196 enum SAOType {
197     SAO_NOT_APPLIED = 0,
198     SAO_BAND,
199     SAO_EDGE,
200 };
201
202 enum SAOEOClass {
203     SAO_EO_HORIZ = 0,
204     SAO_EO_VERT,
205     SAO_EO_135D,
206     SAO_EO_45D,
207 };
208
209 enum ScanType {
210     SCAN_DIAG = 0,
211     SCAN_HORIZ,
212     SCAN_VERT,
213 };
214
215 typedef struct LongTermRPS {
216     int     poc[32];
217     uint8_t used[32];
218     uint8_t nb_refs;
219 } LongTermRPS;
220
221 typedef struct RefPicList {
222     struct HEVCFrame *ref[HEVC_MAX_REFS];
223     int list[HEVC_MAX_REFS];
224     int isLongTerm[HEVC_MAX_REFS];
225     int nb_refs;
226 } RefPicList;
227
228 typedef struct RefPicListTab {
229     RefPicList refPicList[2];
230 } RefPicListTab;
231
232 typedef struct SliceHeader {
233     unsigned int pps_id;
234
235     ///< address (in raster order) of the first block in the current slice segment
236     unsigned int   slice_segment_addr;
237     ///< address (in raster order) of the first block in the current slice
238     unsigned int   slice_addr;
239
240     enum HEVCSliceType slice_type;
241
242     int pic_order_cnt_lsb;
243
244     uint8_t first_slice_in_pic_flag;
245     uint8_t dependent_slice_segment_flag;
246     uint8_t pic_output_flag;
247     uint8_t colour_plane_id;
248
249     ///< RPS coded in the slice header itself is stored here
250     int short_term_ref_pic_set_sps_flag;
251     int short_term_ref_pic_set_size;
252     ShortTermRPS slice_rps;
253     const ShortTermRPS *short_term_rps;
254     int long_term_ref_pic_set_size;
255     LongTermRPS long_term_rps;
256     unsigned int list_entry_lx[2][32];
257
258     uint8_t rpl_modification_flag[2];
259     uint8_t no_output_of_prior_pics_flag;
260     uint8_t slice_temporal_mvp_enabled_flag;
261
262     unsigned int nb_refs[2];
263
264     uint8_t slice_sample_adaptive_offset_flag[3];
265     uint8_t mvd_l1_zero_flag;
266
267     uint8_t cabac_init_flag;
268     uint8_t disable_deblocking_filter_flag; ///< slice_header_disable_deblocking_filter_flag
269     uint8_t slice_loop_filter_across_slices_enabled_flag;
270     uint8_t collocated_list;
271
272     unsigned int collocated_ref_idx;
273
274     int slice_qp_delta;
275     int slice_cb_qp_offset;
276     int slice_cr_qp_offset;
277
278     int beta_offset;    ///< beta_offset_div2 * 2
279     int tc_offset;      ///< tc_offset_div2 * 2
280
281     unsigned int max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand
282
283     int num_entry_point_offsets;
284
285     int8_t slice_qp;
286
287     uint8_t luma_log2_weight_denom;
288     int16_t chroma_log2_weight_denom;
289
290     int16_t luma_weight_l0[16];
291     int16_t chroma_weight_l0[16][2];
292     int16_t chroma_weight_l1[16][2];
293     int16_t luma_weight_l1[16];
294
295     int16_t luma_offset_l0[16];
296     int16_t chroma_offset_l0[16][2];
297
298     int16_t luma_offset_l1[16];
299     int16_t chroma_offset_l1[16][2];
300
301     int slice_ctb_addr_rs;
302 } SliceHeader;
303
304 typedef struct CodingTree {
305     int depth; ///< ctDepth
306 } CodingTree;
307
308 typedef struct CodingUnit {
309     int x;
310     int y;
311
312     enum PredMode pred_mode;    ///< PredMode
313     enum PartMode part_mode;    ///< PartMode
314
315     // Inferred parameters
316     uint8_t intra_split_flag;   ///< IntraSplitFlag
317     uint8_t max_trafo_depth;    ///< MaxTrafoDepth
318     uint8_t cu_transquant_bypass_flag;
319 } CodingUnit;
320
321 typedef struct Mv {
322     int16_t x;  ///< horizontal component of motion vector
323     int16_t y;  ///< vertical component of motion vector
324 } Mv;
325
326 typedef struct MvField {
327     DECLARE_ALIGNED(4, Mv, mv)[2];
328     int8_t ref_idx[2];
329     int8_t pred_flag[2];
330     uint8_t is_intra;
331 } MvField;
332
333 typedef struct NeighbourAvailable {
334     int cand_bottom_left;
335     int cand_left;
336     int cand_up;
337     int cand_up_left;
338     int cand_up_right;
339     int cand_up_right_sap;
340 } NeighbourAvailable;
341
342 typedef struct PredictionUnit {
343     int mpm_idx;
344     int rem_intra_luma_pred_mode;
345     uint8_t intra_pred_mode[4];
346     Mv mvd;
347     uint8_t merge_flag;
348     uint8_t intra_pred_mode_c;
349 } PredictionUnit;
350
351 typedef struct TransformUnit {
352     int cu_qp_delta;
353
354     // Inferred parameters;
355     int cur_intra_pred_mode;
356     uint8_t is_cu_qp_delta_coded;
357 } TransformUnit;
358
359 typedef struct DBParams {
360     int beta_offset;
361     int tc_offset;
362 } DBParams;
363
364 #define HEVC_FRAME_FLAG_OUTPUT    (1 << 0)
365 #define HEVC_FRAME_FLAG_SHORT_REF (1 << 1)
366 #define HEVC_FRAME_FLAG_LONG_REF  (1 << 2)
367
368 typedef struct HEVCFrame {
369     AVFrame *frame;
370     ThreadFrame tf;
371     MvField *tab_mvf;
372     RefPicList *refPicList;
373     RefPicListTab **rpl_tab;
374     int ctb_count;
375     int poc;
376     struct HEVCFrame *collocated_ref;
377
378     AVBufferRef *tab_mvf_buf;
379     AVBufferRef *rpl_tab_buf;
380     AVBufferRef *rpl_buf;
381
382     AVBufferRef *hwaccel_priv_buf;
383     void *hwaccel_picture_private;
384
385     /**
386      * A sequence counter, so that old frames are output first
387      * after a POC reset
388      */
389     uint16_t sequence;
390
391     /**
392      * A combination of HEVC_FRAME_FLAG_*
393      */
394     uint8_t flags;
395 } HEVCFrame;
396
397 struct HEVCContext;
398
399 typedef struct HEVCPredContext {
400     void (*intra_pred[4])(struct HEVCContext *s, int x0, int y0, int c_idx);
401
402     void (*pred_planar[4])(uint8_t *src, const uint8_t *top,
403                            const uint8_t *left, ptrdiff_t stride);
404     void (*pred_dc)(uint8_t *src, const uint8_t *top, const uint8_t *left,
405                     ptrdiff_t stride, int log2_size, int c_idx);
406     void (*pred_angular[4])(uint8_t *src, const uint8_t *top,
407                             const uint8_t *left, ptrdiff_t stride,
408                             int c_idx, int mode);
409 } HEVCPredContext;
410
411 typedef struct HEVCLocalContext {
412     DECLARE_ALIGNED(16, int16_t, mc_buffer[(MAX_PB_SIZE + 24) * MAX_PB_SIZE]);
413     uint8_t cabac_state[HEVC_CONTEXTS];
414
415     uint8_t first_qp_group;
416
417     GetBitContext gb;
418     CABACContext cc;
419
420     int8_t qp_y;
421     int8_t curr_qp_y;
422
423     TransformUnit tu;
424
425     uint8_t ctb_left_flag;
426     uint8_t ctb_up_flag;
427     uint8_t ctb_up_right_flag;
428     uint8_t ctb_up_left_flag;
429     int     start_of_tiles_x;
430     int     end_of_tiles_x;
431     int     end_of_tiles_y;
432     /* +7 is for subpixel interpolation, *2 for high bit depths */
433     DECLARE_ALIGNED(32, uint8_t, edge_emu_buffer)[(MAX_PB_SIZE + 7) * EDGE_EMU_BUFFER_STRIDE * 2];
434     CodingTree ct;
435     CodingUnit cu;
436     PredictionUnit pu;
437     NeighbourAvailable na;
438
439 #define BOUNDARY_LEFT_SLICE     (1 << 0)
440 #define BOUNDARY_LEFT_TILE      (1 << 1)
441 #define BOUNDARY_UPPER_SLICE    (1 << 2)
442 #define BOUNDARY_UPPER_TILE     (1 << 3)
443     /* properties of the boundary of the current CTB for the purposes
444      * of the deblocking filter */
445     int boundary_flags;
446 } HEVCLocalContext;
447
448 typedef struct HEVCContext {
449     const AVClass *c;  // needed by private avoptions
450     AVCodecContext *avctx;
451
452     HEVCLocalContext HEVClc;
453
454     uint8_t cabac_state[HEVC_CONTEXTS];
455
456     /** 1 if the independent slice segment header was successfully parsed */
457     uint8_t slice_initialized;
458
459     AVFrame *frame;
460     AVFrame *sao_frame;
461     AVFrame *tmp_frame;
462     AVFrame *output_frame;
463
464     HEVCParamSets ps;
465     HEVCSEI sei;
466     struct AVMD5 *md5_ctx;
467
468     AVBufferPool *tab_mvf_pool;
469     AVBufferPool *rpl_tab_pool;
470
471     ///< candidate references for the current frame
472     RefPicList rps[5];
473
474     SliceHeader sh;
475     SAOParams *sao;
476     DBParams *deblock;
477     enum HEVCNALUnitType nal_unit_type;
478     int temporal_id;  ///< temporal_id_plus1 - 1
479     HEVCFrame *ref;
480     HEVCFrame DPB[32];
481     int poc;
482     int pocTid0;
483     int slice_idx; ///< number of the slice being currently decoded
484     int eos;       ///< current packet contains an EOS/EOB NAL
485     int max_ra;
486     int bs_width;
487     int bs_height;
488
489     int is_decoded;
490
491     HEVCPredContext hpc;
492     HEVCDSPContext hevcdsp;
493     VideoDSPContext vdsp;
494     BswapDSPContext bdsp;
495     int8_t *qp_y_tab;
496     uint8_t *horizontal_bs;
497     uint8_t *vertical_bs;
498
499     int32_t *tab_slice_address;
500
501     //  CU
502     uint8_t *skip_flag;
503     uint8_t *tab_ct_depth;
504     // PU
505     uint8_t *tab_ipm;
506
507     uint8_t *cbf_luma; // cbf_luma of colocated TU
508     uint8_t *is_pcm;
509
510     // CTB-level flags affecting loop filter operation
511     uint8_t *filter_slice_edges;
512
513     /** used on BE to byteswap the lines for checksumming */
514     uint8_t *checksum_buf;
515     int      checksum_buf_size;
516
517     /**
518      * Sequence counters for decoded and output frames, so that old
519      * frames are output first after a POC reset
520      */
521     uint16_t seq_decode;
522     uint16_t seq_output;
523
524     H2645Packet pkt;
525     // type of the first VCL NAL of the current frame
526     enum HEVCNALUnitType first_nal_type;
527
528     uint8_t context_initialized;
529     uint8_t is_nalff;       ///< this flag is != 0 if bitstream is encapsulated
530                             ///< as a format defined in 14496-15
531     int apply_defdispwin;
532
533     int nal_length_size;    ///< Number of bytes used for nal length (1, 2 or 4)
534     int nuh_layer_id;
535 } HEVCContext;
536
537 /**
538  * Mark all frames in DPB as unused for reference.
539  */
540 void ff_hevc_clear_refs(HEVCContext *s);
541
542 /**
543  * Drop all frames currently in DPB.
544  */
545 void ff_hevc_flush_dpb(HEVCContext *s);
546
547 /**
548  * Compute POC of the current frame and return it.
549  */
550 int ff_hevc_compute_poc(HEVCContext *s, int poc_lsb);
551
552 RefPicList *ff_hevc_get_ref_list(HEVCContext *s, HEVCFrame *frame,
553                                  int x0, int y0);
554
555 /**
556  * Construct the reference picture sets for the current frame.
557  */
558 int ff_hevc_frame_rps(HEVCContext *s);
559
560 /**
561  * Construct the reference picture list(s) for the current slice.
562  */
563 int ff_hevc_slice_rpl(HEVCContext *s);
564
565 void ff_hevc_save_states(HEVCContext *s, int ctb_addr_ts);
566 void ff_hevc_cabac_init(HEVCContext *s, int ctb_addr_ts);
567 int ff_hevc_sao_merge_flag_decode(HEVCContext *s);
568 int ff_hevc_sao_type_idx_decode(HEVCContext *s);
569 int ff_hevc_sao_band_position_decode(HEVCContext *s);
570 int ff_hevc_sao_offset_abs_decode(HEVCContext *s);
571 int ff_hevc_sao_offset_sign_decode(HEVCContext *s);
572 int ff_hevc_sao_eo_class_decode(HEVCContext *s);
573 int ff_hevc_end_of_slice_flag_decode(HEVCContext *s);
574 int ff_hevc_cu_transquant_bypass_flag_decode(HEVCContext *s);
575 int ff_hevc_skip_flag_decode(HEVCContext *s, int x0, int y0,
576                              int x_cb, int y_cb);
577 int ff_hevc_pred_mode_decode(HEVCContext *s);
578 int ff_hevc_split_coding_unit_flag_decode(HEVCContext *s, int ct_depth,
579                                           int x0, int y0);
580 int ff_hevc_part_mode_decode(HEVCContext *s, int log2_cb_size);
581 int ff_hevc_pcm_flag_decode(HEVCContext *s);
582 int ff_hevc_prev_intra_luma_pred_flag_decode(HEVCContext *s);
583 int ff_hevc_mpm_idx_decode(HEVCContext *s);
584 int ff_hevc_rem_intra_luma_pred_mode_decode(HEVCContext *s);
585 int ff_hevc_intra_chroma_pred_mode_decode(HEVCContext *s);
586 int ff_hevc_merge_idx_decode(HEVCContext *s);
587 int ff_hevc_merge_flag_decode(HEVCContext *s);
588 int ff_hevc_inter_pred_idc_decode(HEVCContext *s, int nPbW, int nPbH);
589 int ff_hevc_ref_idx_lx_decode(HEVCContext *s, int num_ref_idx_lx);
590 int ff_hevc_mvp_lx_flag_decode(HEVCContext *s);
591 int ff_hevc_no_residual_syntax_flag_decode(HEVCContext *s);
592 int ff_hevc_abs_mvd_greater0_flag_decode(HEVCContext *s);
593 int ff_hevc_abs_mvd_greater1_flag_decode(HEVCContext *s);
594 int ff_hevc_mvd_decode(HEVCContext *s);
595 int ff_hevc_mvd_sign_flag_decode(HEVCContext *s);
596 int ff_hevc_split_transform_flag_decode(HEVCContext *s, int log2_trafo_size);
597 int ff_hevc_cbf_cb_cr_decode(HEVCContext *s, int trafo_depth);
598 int ff_hevc_cbf_luma_decode(HEVCContext *s, int trafo_depth);
599 int ff_hevc_transform_skip_flag_decode(HEVCContext *s, int c_idx);
600 int ff_hevc_last_significant_coeff_x_prefix_decode(HEVCContext *s, int c_idx,
601                                                    int log2_size);
602 int ff_hevc_last_significant_coeff_y_prefix_decode(HEVCContext *s, int c_idx,
603                                                    int log2_size);
604 int ff_hevc_last_significant_coeff_suffix_decode(HEVCContext *s,
605                                                  int last_significant_coeff_prefix);
606 int ff_hevc_significant_coeff_group_flag_decode(HEVCContext *s, int c_idx,
607                                                 int ctx_cg);
608 int ff_hevc_significant_coeff_flag_decode(HEVCContext *s, int c_idx, int x_c,
609                                           int y_c, int log2_trafo_size,
610                                           int scan_idx, int prev_sig);
611 int ff_hevc_coeff_abs_level_greater1_flag_decode(HEVCContext *s, int c_idx,
612                                                  int ctx_set);
613 int ff_hevc_coeff_abs_level_greater2_flag_decode(HEVCContext *s, int c_idx,
614                                                  int inc);
615 int ff_hevc_coeff_abs_level_remaining(HEVCContext *s, int base_level,
616                                       int rc_rice_param);
617 int ff_hevc_coeff_sign_flag(HEVCContext *s, uint8_t nb);
618
619 /**
620  * Get the number of candidate references for the current frame.
621  */
622 int ff_hevc_frame_nb_refs(HEVCContext *s);
623
624 int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc);
625
626 /**
627  * Find next frame in output order and put a reference to it in frame.
628  * @return 1 if a frame was output, 0 otherwise
629  */
630 int ff_hevc_output_frame(HEVCContext *s, AVFrame *frame, int flush);
631
632 void ff_hevc_unref_frame(HEVCContext *s, HEVCFrame *frame, int flags);
633
634 void ff_hevc_set_neighbour_available(HEVCContext *s, int x0, int y0,
635                                      int nPbW, int nPbH);
636 void ff_hevc_luma_mv_merge_mode(HEVCContext *s, int x0, int y0,
637                                 int nPbW, int nPbH, int log2_cb_size,
638                                 int part_idx, int merge_idx, MvField *mv);
639 void ff_hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0,
640                               int nPbW, int nPbH, int log2_cb_size,
641                               int part_idx, int merge_idx,
642                               MvField *mv, int mvp_lx_flag, int LX);
643 void ff_hevc_set_qPy(HEVCContext *s, int xC, int yC, int xBase, int yBase,
644                      int log2_cb_size);
645 void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0,
646                                            int log2_trafo_size);
647 int ff_hevc_cu_qp_delta_sign_flag(HEVCContext *s);
648 int ff_hevc_cu_qp_delta_abs(HEVCContext *s);
649 void ff_hevc_hls_filter(HEVCContext *s, int x, int y);
650 void ff_hevc_hls_filters(HEVCContext *s, int x_ctb, int y_ctb, int ctb_size);
651
652 void ff_hevc_pred_init(HEVCPredContext *hpc, int bit_depth);
653
654 extern const uint8_t ff_hevc_qpel_extra_before[4];
655 extern const uint8_t ff_hevc_qpel_extra_after[4];
656 extern const uint8_t ff_hevc_qpel_extra[4];
657
658 #endif /* AVCODEC_HEVCDEC_H */