hevcdec.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  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. #ifndef AVCODEC_HEVCDEC_H
  23. #define AVCODEC_HEVCDEC_H
  24. #include <stdatomic.h>
  25. #include "libavutil/buffer.h"
  26. #include "libavutil/md5.h"
  27. #include "avcodec.h"
  28. #include "bswapdsp.h"
  29. #include "cabac.h"
  30. #include "get_bits.h"
  31. #include "hevcpred.h"
  32. #include "h2645_parse.h"
  33. #include "hevc.h"
  34. #include "hevc_ps.h"
  35. #include "hevc_sei.h"
  36. #include "hevcdsp.h"
  37. #include "internal.h"
  38. #include "thread.h"
  39. #include "videodsp.h"
  40. #define MAX_NB_THREADS 16
  41. #define SHIFT_CTB_WPP 2
  42. //TODO: check if this is really the maximum
  43. #define MAX_TRANSFORM_DEPTH 5
  44. #define MAX_TB_SIZE 32
  45. #define MAX_QP 51
  46. #define DEFAULT_INTRA_TC_OFFSET 2
  47. #define HEVC_CONTEXTS 199
  48. #define MRG_MAX_NUM_CANDS 5
  49. #define L0 0
  50. #define L1 1
  51. #define EPEL_EXTRA_BEFORE 1
  52. #define EPEL_EXTRA_AFTER 2
  53. #define EPEL_EXTRA 3
  54. #define QPEL_EXTRA_BEFORE 3
  55. #define QPEL_EXTRA_AFTER 4
  56. #define QPEL_EXTRA 7
  57. #define EDGE_EMU_BUFFER_STRIDE 80
  58. /**
  59. * Value of the luma sample at position (x, y) in the 2D array tab.
  60. */
  61. #define SAMPLE(tab, x, y) ((tab)[(y) * s->sps->width + (x)])
  62. #define SAMPLE_CTB(tab, x, y) ((tab)[(y) * min_cb_width + (x)])
  63. #define IS_IDR(s) ((s)->nal_unit_type == HEVC_NAL_IDR_W_RADL || (s)->nal_unit_type == HEVC_NAL_IDR_N_LP)
  64. #define IS_BLA(s) ((s)->nal_unit_type == HEVC_NAL_BLA_W_RADL || (s)->nal_unit_type == HEVC_NAL_BLA_W_LP || \
  65. (s)->nal_unit_type == HEVC_NAL_BLA_N_LP)
  66. #define IS_IRAP(s) ((s)->nal_unit_type >= 16 && (s)->nal_unit_type <= 23)
  67. enum RPSType {
  68. ST_CURR_BEF = 0,
  69. ST_CURR_AFT,
  70. ST_FOLL,
  71. LT_CURR,
  72. LT_FOLL,
  73. NB_RPS_TYPE,
  74. };
  75. enum SyntaxElement {
  76. SAO_MERGE_FLAG = 0,
  77. SAO_TYPE_IDX,
  78. SAO_EO_CLASS,
  79. SAO_BAND_POSITION,
  80. SAO_OFFSET_ABS,
  81. SAO_OFFSET_SIGN,
  82. END_OF_SLICE_FLAG,
  83. SPLIT_CODING_UNIT_FLAG,
  84. CU_TRANSQUANT_BYPASS_FLAG,
  85. SKIP_FLAG,
  86. CU_QP_DELTA,
  87. PRED_MODE_FLAG,
  88. PART_MODE,
  89. PCM_FLAG,
  90. PREV_INTRA_LUMA_PRED_FLAG,
  91. MPM_IDX,
  92. REM_INTRA_LUMA_PRED_MODE,
  93. INTRA_CHROMA_PRED_MODE,
  94. MERGE_FLAG,
  95. MERGE_IDX,
  96. INTER_PRED_IDC,
  97. REF_IDX_L0,
  98. REF_IDX_L1,
  99. ABS_MVD_GREATER0_FLAG,
  100. ABS_MVD_GREATER1_FLAG,
  101. ABS_MVD_MINUS2,
  102. MVD_SIGN_FLAG,
  103. MVP_LX_FLAG,
  104. NO_RESIDUAL_DATA_FLAG,
  105. SPLIT_TRANSFORM_FLAG,
  106. CBF_LUMA,
  107. CBF_CB_CR,
  108. TRANSFORM_SKIP_FLAG,
  109. EXPLICIT_RDPCM_FLAG,
  110. EXPLICIT_RDPCM_DIR_FLAG,
  111. LAST_SIGNIFICANT_COEFF_X_PREFIX,
  112. LAST_SIGNIFICANT_COEFF_Y_PREFIX,
  113. LAST_SIGNIFICANT_COEFF_X_SUFFIX,
  114. LAST_SIGNIFICANT_COEFF_Y_SUFFIX,
  115. SIGNIFICANT_COEFF_GROUP_FLAG,
  116. SIGNIFICANT_COEFF_FLAG,
  117. COEFF_ABS_LEVEL_GREATER1_FLAG,
  118. COEFF_ABS_LEVEL_GREATER2_FLAG,
  119. COEFF_ABS_LEVEL_REMAINING,
  120. COEFF_SIGN_FLAG,
  121. LOG2_RES_SCALE_ABS,
  122. RES_SCALE_SIGN_FLAG,
  123. CU_CHROMA_QP_OFFSET_FLAG,
  124. CU_CHROMA_QP_OFFSET_IDX,
  125. };
  126. enum PartMode {
  127. PART_2Nx2N = 0,
  128. PART_2NxN = 1,
  129. PART_Nx2N = 2,
  130. PART_NxN = 3,
  131. PART_2NxnU = 4,
  132. PART_2NxnD = 5,
  133. PART_nLx2N = 6,
  134. PART_nRx2N = 7,
  135. };
  136. enum PredMode {
  137. MODE_INTER = 0,
  138. MODE_INTRA,
  139. MODE_SKIP,
  140. };
  141. enum InterPredIdc {
  142. PRED_L0 = 0,
  143. PRED_L1,
  144. PRED_BI,
  145. };
  146. enum PredFlag {
  147. PF_INTRA = 0,
  148. PF_L0,
  149. PF_L1,
  150. PF_BI,
  151. };
  152. enum IntraPredMode {
  153. INTRA_PLANAR = 0,
  154. INTRA_DC,
  155. INTRA_ANGULAR_2,
  156. INTRA_ANGULAR_3,
  157. INTRA_ANGULAR_4,
  158. INTRA_ANGULAR_5,
  159. INTRA_ANGULAR_6,
  160. INTRA_ANGULAR_7,
  161. INTRA_ANGULAR_8,
  162. INTRA_ANGULAR_9,
  163. INTRA_ANGULAR_10,
  164. INTRA_ANGULAR_11,
  165. INTRA_ANGULAR_12,
  166. INTRA_ANGULAR_13,
  167. INTRA_ANGULAR_14,
  168. INTRA_ANGULAR_15,
  169. INTRA_ANGULAR_16,
  170. INTRA_ANGULAR_17,
  171. INTRA_ANGULAR_18,
  172. INTRA_ANGULAR_19,
  173. INTRA_ANGULAR_20,
  174. INTRA_ANGULAR_21,
  175. INTRA_ANGULAR_22,
  176. INTRA_ANGULAR_23,
  177. INTRA_ANGULAR_24,
  178. INTRA_ANGULAR_25,
  179. INTRA_ANGULAR_26,
  180. INTRA_ANGULAR_27,
  181. INTRA_ANGULAR_28,
  182. INTRA_ANGULAR_29,
  183. INTRA_ANGULAR_30,
  184. INTRA_ANGULAR_31,
  185. INTRA_ANGULAR_32,
  186. INTRA_ANGULAR_33,
  187. INTRA_ANGULAR_34,
  188. };
  189. enum SAOType {
  190. SAO_NOT_APPLIED = 0,
  191. SAO_BAND,
  192. SAO_EDGE,
  193. SAO_APPLIED
  194. };
  195. enum SAOEOClass {
  196. SAO_EO_HORIZ = 0,
  197. SAO_EO_VERT,
  198. SAO_EO_135D,
  199. SAO_EO_45D,
  200. };
  201. enum ScanType {
  202. SCAN_DIAG = 0,
  203. SCAN_HORIZ,
  204. SCAN_VERT,
  205. };
  206. typedef struct RefPicList {
  207. struct HEVCFrame *ref[HEVC_MAX_REFS];
  208. int list[HEVC_MAX_REFS];
  209. int isLongTerm[HEVC_MAX_REFS];
  210. int nb_refs;
  211. } RefPicList;
  212. typedef struct RefPicListTab {
  213. RefPicList refPicList[2];
  214. } RefPicListTab;
  215. typedef struct CodingUnit {
  216. int x;
  217. int y;
  218. enum PredMode pred_mode; ///< PredMode
  219. enum PartMode part_mode; ///< PartMode
  220. // Inferred parameters
  221. uint8_t intra_split_flag; ///< IntraSplitFlag
  222. uint8_t max_trafo_depth; ///< MaxTrafoDepth
  223. uint8_t cu_transquant_bypass_flag;
  224. } CodingUnit;
  225. typedef struct Mv {
  226. int16_t x; ///< horizontal component of motion vector
  227. int16_t y; ///< vertical component of motion vector
  228. } Mv;
  229. typedef struct MvField {
  230. DECLARE_ALIGNED(4, Mv, mv)[2];
  231. int8_t ref_idx[2];
  232. int8_t pred_flag;
  233. } MvField;
  234. typedef struct NeighbourAvailable {
  235. int cand_bottom_left;
  236. int cand_left;
  237. int cand_up;
  238. int cand_up_left;
  239. int cand_up_right;
  240. int cand_up_right_sap;
  241. } NeighbourAvailable;
  242. typedef struct PredictionUnit {
  243. int mpm_idx;
  244. int rem_intra_luma_pred_mode;
  245. uint8_t intra_pred_mode[4];
  246. Mv mvd;
  247. uint8_t merge_flag;
  248. uint8_t intra_pred_mode_c[4];
  249. uint8_t chroma_mode_c[4];
  250. } PredictionUnit;
  251. typedef struct TransformUnit {
  252. int cu_qp_delta;
  253. int res_scale_val;
  254. // Inferred parameters;
  255. int intra_pred_mode;
  256. int intra_pred_mode_c;
  257. int chroma_mode_c;
  258. uint8_t is_cu_qp_delta_coded;
  259. uint8_t is_cu_chroma_qp_offset_coded;
  260. int8_t cu_qp_offset_cb;
  261. int8_t cu_qp_offset_cr;
  262. uint8_t cross_pf;
  263. } TransformUnit;
  264. typedef struct DBParams {
  265. int beta_offset;
  266. int tc_offset;
  267. } DBParams;
  268. #define HEVC_FRAME_FLAG_OUTPUT (1 << 0)
  269. #define HEVC_FRAME_FLAG_SHORT_REF (1 << 1)
  270. #define HEVC_FRAME_FLAG_LONG_REF (1 << 2)
  271. #define HEVC_FRAME_FLAG_BUMPING (1 << 3)
  272. typedef struct HEVCFrame {
  273. AVFrame *frame;
  274. ThreadFrame tf;
  275. MvField *tab_mvf;
  276. RefPicList *refPicList;
  277. RefPicListTab **rpl_tab;
  278. int ctb_count;
  279. int poc;
  280. struct HEVCFrame *collocated_ref;
  281. AVBufferRef *tab_mvf_buf;
  282. AVBufferRef *rpl_tab_buf;
  283. AVBufferRef *rpl_buf;
  284. AVBufferRef *hwaccel_priv_buf;
  285. void *hwaccel_picture_private;
  286. /**
  287. * A sequence counter, so that old frames are output first
  288. * after a POC reset
  289. */
  290. uint16_t sequence;
  291. /**
  292. * A combination of HEVC_FRAME_FLAG_*
  293. */
  294. uint8_t flags;
  295. } HEVCFrame;
  296. typedef struct HEVCLocalContext {
  297. uint8_t cabac_state[HEVC_CONTEXTS];
  298. uint8_t stat_coeff[4];
  299. uint8_t first_qp_group;
  300. GetBitContext gb;
  301. CABACContext cc;
  302. int8_t qp_y;
  303. int8_t curr_qp_y;
  304. int qPy_pred;
  305. TransformUnit tu;
  306. uint8_t ctb_left_flag;
  307. uint8_t ctb_up_flag;
  308. uint8_t ctb_up_right_flag;
  309. uint8_t ctb_up_left_flag;
  310. int end_of_tiles_x;
  311. int end_of_tiles_y;
  312. /* +7 is for subpixel interpolation, *2 for high bit depths */
  313. DECLARE_ALIGNED(32, uint8_t, edge_emu_buffer)[(MAX_PB_SIZE + 7) * EDGE_EMU_BUFFER_STRIDE * 2];
  314. /* The extended size between the new edge emu buffer is abused by SAO */
  315. DECLARE_ALIGNED(32, uint8_t, edge_emu_buffer2)[(MAX_PB_SIZE + 7) * EDGE_EMU_BUFFER_STRIDE * 2];
  316. DECLARE_ALIGNED(32, int16_t, tmp)[MAX_PB_SIZE * MAX_PB_SIZE];
  317. int ct_depth;
  318. CodingUnit cu;
  319. PredictionUnit pu;
  320. NeighbourAvailable na;
  321. #define BOUNDARY_LEFT_SLICE (1 << 0)
  322. #define BOUNDARY_LEFT_TILE (1 << 1)
  323. #define BOUNDARY_UPPER_SLICE (1 << 2)
  324. #define BOUNDARY_UPPER_TILE (1 << 3)
  325. /* properties of the boundary of the current CTB for the purposes
  326. * of the deblocking filter */
  327. int boundary_flags;
  328. } HEVCLocalContext;
  329. typedef struct HEVCContext {
  330. const AVClass *c; // needed by private avoptions
  331. AVCodecContext *avctx;
  332. struct HEVCContext *sList[MAX_NB_THREADS];
  333. HEVCLocalContext *HEVClcList[MAX_NB_THREADS];
  334. HEVCLocalContext *HEVClc;
  335. uint8_t threads_type;
  336. uint8_t threads_number;
  337. int width;
  338. int height;
  339. uint8_t *cabac_state;
  340. /** 1 if the independent slice segment header was successfully parsed */
  341. uint8_t slice_initialized;
  342. AVFrame *frame;
  343. AVFrame *output_frame;
  344. uint8_t *sao_pixel_buffer_h[3];
  345. uint8_t *sao_pixel_buffer_v[3];
  346. HEVCParamSets ps;
  347. HEVCSEI sei;
  348. struct AVMD5 *md5_ctx;
  349. AVBufferPool *tab_mvf_pool;
  350. AVBufferPool *rpl_tab_pool;
  351. ///< candidate references for the current frame
  352. RefPicList rps[5];
  353. SliceHeader sh;
  354. SAOParams *sao;
  355. DBParams *deblock;
  356. enum HEVCNALUnitType nal_unit_type;
  357. int temporal_id; ///< temporal_id_plus1 - 1
  358. HEVCFrame *ref;
  359. HEVCFrame DPB[32];
  360. int poc;
  361. int pocTid0;
  362. int slice_idx; ///< number of the slice being currently decoded
  363. int eos; ///< current packet contains an EOS/EOB NAL
  364. int last_eos; ///< last packet contains an EOS/EOB NAL
  365. int max_ra;
  366. int bs_width;
  367. int bs_height;
  368. int overlap;
  369. int is_decoded;
  370. int no_rasl_output_flag;
  371. HEVCPredContext hpc;
  372. HEVCDSPContext hevcdsp;
  373. VideoDSPContext vdsp;
  374. BswapDSPContext bdsp;
  375. int8_t *qp_y_tab;
  376. uint8_t *horizontal_bs;
  377. uint8_t *vertical_bs;
  378. int32_t *tab_slice_address;
  379. // CU
  380. uint8_t *skip_flag;
  381. uint8_t *tab_ct_depth;
  382. // PU
  383. uint8_t *tab_ipm;
  384. uint8_t *cbf_luma; // cbf_luma of colocated TU
  385. uint8_t *is_pcm;
  386. // CTB-level flags affecting loop filter operation
  387. uint8_t *filter_slice_edges;
  388. /** used on BE to byteswap the lines for checksumming */
  389. uint8_t *checksum_buf;
  390. int checksum_buf_size;
  391. /**
  392. * Sequence counters for decoded and output frames, so that old
  393. * frames are output first after a POC reset
  394. */
  395. uint16_t seq_decode;
  396. uint16_t seq_output;
  397. int enable_parallel_tiles;
  398. atomic_int wpp_err;
  399. const uint8_t *data;
  400. H2645Packet pkt;
  401. // type of the first VCL NAL of the current frame
  402. enum HEVCNALUnitType first_nal_type;
  403. uint8_t context_initialized;
  404. int is_nalff; ///< this flag is != 0 if bitstream is encapsulated
  405. ///< as a format defined in 14496-15
  406. int apply_defdispwin;
  407. int nal_length_size; ///< Number of bytes used for nal length (1, 2 or 4)
  408. int nuh_layer_id;
  409. } HEVCContext;
  410. /**
  411. * Mark all frames in DPB as unused for reference.
  412. */
  413. void ff_hevc_clear_refs(HEVCContext *s);
  414. /**
  415. * Drop all frames currently in DPB.
  416. */
  417. void ff_hevc_flush_dpb(HEVCContext *s);
  418. RefPicList *ff_hevc_get_ref_list(HEVCContext *s, HEVCFrame *frame,
  419. int x0, int y0);
  420. /**
  421. * Construct the reference picture sets for the current frame.
  422. */
  423. int ff_hevc_frame_rps(HEVCContext *s);
  424. /**
  425. * Construct the reference picture list(s) for the current slice.
  426. */
  427. int ff_hevc_slice_rpl(HEVCContext *s);
  428. void ff_hevc_save_states(HEVCContext *s, int ctb_addr_ts);
  429. int ff_hevc_cabac_init(HEVCContext *s, int ctb_addr_ts);
  430. int ff_hevc_sao_merge_flag_decode(HEVCContext *s);
  431. int ff_hevc_sao_type_idx_decode(HEVCContext *s);
  432. int ff_hevc_sao_band_position_decode(HEVCContext *s);
  433. int ff_hevc_sao_offset_abs_decode(HEVCContext *s);
  434. int ff_hevc_sao_offset_sign_decode(HEVCContext *s);
  435. int ff_hevc_sao_eo_class_decode(HEVCContext *s);
  436. int ff_hevc_end_of_slice_flag_decode(HEVCContext *s);
  437. int ff_hevc_cu_transquant_bypass_flag_decode(HEVCContext *s);
  438. int ff_hevc_skip_flag_decode(HEVCContext *s, int x0, int y0,
  439. int x_cb, int y_cb);
  440. int ff_hevc_pred_mode_decode(HEVCContext *s);
  441. int ff_hevc_split_coding_unit_flag_decode(HEVCContext *s, int ct_depth,
  442. int x0, int y0);
  443. int ff_hevc_part_mode_decode(HEVCContext *s, int log2_cb_size);
  444. int ff_hevc_pcm_flag_decode(HEVCContext *s);
  445. int ff_hevc_prev_intra_luma_pred_flag_decode(HEVCContext *s);
  446. int ff_hevc_mpm_idx_decode(HEVCContext *s);
  447. int ff_hevc_rem_intra_luma_pred_mode_decode(HEVCContext *s);
  448. int ff_hevc_intra_chroma_pred_mode_decode(HEVCContext *s);
  449. int ff_hevc_merge_idx_decode(HEVCContext *s);
  450. int ff_hevc_merge_flag_decode(HEVCContext *s);
  451. int ff_hevc_inter_pred_idc_decode(HEVCContext *s, int nPbW, int nPbH);
  452. int ff_hevc_ref_idx_lx_decode(HEVCContext *s, int num_ref_idx_lx);
  453. int ff_hevc_mvp_lx_flag_decode(HEVCContext *s);
  454. int ff_hevc_no_residual_syntax_flag_decode(HEVCContext *s);
  455. int ff_hevc_split_transform_flag_decode(HEVCContext *s, int log2_trafo_size);
  456. int ff_hevc_cbf_cb_cr_decode(HEVCContext *s, int trafo_depth);
  457. int ff_hevc_cbf_luma_decode(HEVCContext *s, int trafo_depth);
  458. int ff_hevc_log2_res_scale_abs(HEVCContext *s, int idx);
  459. int ff_hevc_res_scale_sign_flag(HEVCContext *s, int idx);
  460. /**
  461. * Get the number of candidate references for the current frame.
  462. */
  463. int ff_hevc_frame_nb_refs(const HEVCContext *s);
  464. int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc);
  465. static av_always_inline int ff_hevc_nal_is_nonref(enum HEVCNALUnitType type)
  466. {
  467. switch (type) {
  468. case HEVC_NAL_TRAIL_N:
  469. case HEVC_NAL_TSA_N:
  470. case HEVC_NAL_STSA_N:
  471. case HEVC_NAL_RADL_N:
  472. case HEVC_NAL_RASL_N:
  473. case HEVC_NAL_VCL_N10:
  474. case HEVC_NAL_VCL_N12:
  475. case HEVC_NAL_VCL_N14:
  476. return 1;
  477. default: break;
  478. }
  479. return 0;
  480. }
  481. /**
  482. * Find next frame in output order and put a reference to it in frame.
  483. * @return 1 if a frame was output, 0 otherwise
  484. */
  485. int ff_hevc_output_frame(HEVCContext *s, AVFrame *frame, int flush);
  486. void ff_hevc_bump_frame(HEVCContext *s);
  487. void ff_hevc_unref_frame(HEVCContext *s, HEVCFrame *frame, int flags);
  488. void ff_hevc_set_neighbour_available(HEVCContext *s, int x0, int y0,
  489. int nPbW, int nPbH);
  490. void ff_hevc_luma_mv_merge_mode(HEVCContext *s, int x0, int y0,
  491. int nPbW, int nPbH, int log2_cb_size,
  492. int part_idx, int merge_idx, MvField *mv);
  493. void ff_hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0,
  494. int nPbW, int nPbH, int log2_cb_size,
  495. int part_idx, int merge_idx,
  496. MvField *mv, int mvp_lx_flag, int LX);
  497. void ff_hevc_set_qPy(HEVCContext *s, int xBase, int yBase,
  498. int log2_cb_size);
  499. void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0,
  500. int log2_trafo_size);
  501. int ff_hevc_cu_qp_delta_sign_flag(HEVCContext *s);
  502. int ff_hevc_cu_qp_delta_abs(HEVCContext *s);
  503. int ff_hevc_cu_chroma_qp_offset_flag(HEVCContext *s);
  504. int ff_hevc_cu_chroma_qp_offset_idx(HEVCContext *s);
  505. void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size);
  506. void ff_hevc_hls_filters(HEVCContext *s, int x_ctb, int y_ctb, int ctb_size);
  507. void ff_hevc_hls_residual_coding(HEVCContext *s, int x0, int y0,
  508. int log2_trafo_size, enum ScanType scan_idx,
  509. int c_idx);
  510. void ff_hevc_hls_mvd_coding(HEVCContext *s, int x0, int y0, int log2_cb_size);
  511. extern const uint8_t ff_hevc_qpel_extra_before[4];
  512. extern const uint8_t ff_hevc_qpel_extra_after[4];
  513. extern const uint8_t ff_hevc_qpel_extra[4];
  514. #endif /* AVCODEC_HEVCDEC_H */