You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
6.3KB

  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. #ifndef AVCODEC_HEVCDSP_H
  23. #define AVCODEC_HEVCDSP_H
  24. #include "get_bits.h"
  25. typedef struct SAOParams {
  26. int offset_abs[3][4]; ///< sao_offset_abs
  27. int offset_sign[3][4]; ///< sao_offset_sign
  28. int band_position[3]; ///< sao_band_position
  29. int eo_class[3]; ///< sao_eo_class
  30. int offset_val[3][5]; ///<SaoOffsetVal
  31. uint8_t type_idx[3]; ///< sao_type_idx
  32. } SAOParams;
  33. typedef struct HEVCDSPContext {
  34. void (*put_pcm)(uint8_t *dst, ptrdiff_t stride, int size,
  35. GetBitContext *gb, int pcm_bit_depth);
  36. void (*add_residual[4])(uint8_t *dst, int16_t *res, ptrdiff_t stride);
  37. void (*dequant)(int16_t *coeffs);
  38. void (*transform_4x4_luma)(int16_t *coeffs);
  39. void (*idct[4])(int16_t *coeffs, int col_limit);
  40. void (*idct_dc[4])(int16_t *coeffs);
  41. void (*sao_band_filter[4])(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
  42. struct SAOParams *sao, int *borders,
  43. int width, int height, int c_idx);
  44. void (*sao_edge_filter[4])(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
  45. struct SAOParams *sao, int *borders, int width,
  46. int height, int c_idx, uint8_t vert_edge,
  47. uint8_t horiz_edge, uint8_t diag_edge);
  48. void (*put_hevc_qpel[2][2][8])(int16_t *dst, ptrdiff_t dststride, uint8_t *src,
  49. ptrdiff_t srcstride, int height,
  50. int mx, int my, int16_t *mcbuffer);
  51. void (*put_hevc_epel[2][2][8])(int16_t *dst, ptrdiff_t dststride, uint8_t *src,
  52. ptrdiff_t srcstride, int height,
  53. int mx, int my, int16_t *mcbuffer);
  54. void (*put_unweighted_pred[8])(uint8_t *dst, ptrdiff_t dststride, int16_t *src,
  55. ptrdiff_t srcstride, int height);
  56. void (*put_unweighted_pred_chroma[8])(uint8_t *dst, ptrdiff_t dststride, int16_t *src,
  57. ptrdiff_t srcstride, int height);
  58. void (*put_unweighted_pred_avg[8])(uint8_t *dst, ptrdiff_t dststride,
  59. int16_t *src1, int16_t *src2,
  60. ptrdiff_t srcstride, int height);
  61. void (*put_unweighted_pred_avg_chroma[8])(uint8_t *dst, ptrdiff_t dststride,
  62. int16_t *src1, int16_t *src2,
  63. ptrdiff_t srcstride, int height);
  64. void (*weighted_pred[8])(uint8_t denom, int16_t wlxFlag, int16_t olxFlag,
  65. uint8_t *dst, ptrdiff_t dststride, int16_t *src,
  66. ptrdiff_t srcstride, int height);
  67. void (*weighted_pred_chroma[8])(uint8_t denom, int16_t wlxFlag, int16_t olxFlag,
  68. uint8_t *dst, ptrdiff_t dststride, int16_t *src,
  69. ptrdiff_t srcstride, int height);
  70. void (*weighted_pred_avg[8])(uint8_t denom, int16_t wl0Flag, int16_t wl1Flag,
  71. int16_t ol0Flag, int16_t ol1Flag, uint8_t *dst,
  72. ptrdiff_t dststride, int16_t *src1, int16_t *src2,
  73. ptrdiff_t srcstride, int height);
  74. void (*weighted_pred_avg_chroma[8])(uint8_t denom, int16_t wl0Flag, int16_t wl1Flag,
  75. int16_t ol0Flag, int16_t ol1Flag, uint8_t *dst,
  76. ptrdiff_t dststride, int16_t *src1, int16_t *src2,
  77. ptrdiff_t srcstride, int height);
  78. void (*hevc_h_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride,
  79. int beta, int *tc,
  80. uint8_t *no_p, uint8_t *no_q);
  81. void (*hevc_v_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride,
  82. int beta, int *tc,
  83. uint8_t *no_p, uint8_t *no_q);
  84. void (*hevc_h_loop_filter_chroma)(uint8_t *pix, ptrdiff_t stride,
  85. int *tc, uint8_t *no_p, uint8_t *no_q);
  86. void (*hevc_v_loop_filter_chroma)(uint8_t *pix, ptrdiff_t stride,
  87. int *tc, uint8_t *no_p, uint8_t *no_q);
  88. void (*hevc_h_loop_filter_luma_c)(uint8_t *pix, ptrdiff_t stride,
  89. int beta, int *tc,
  90. uint8_t *no_p, uint8_t *no_q);
  91. void (*hevc_v_loop_filter_luma_c)(uint8_t *pix, ptrdiff_t stride,
  92. int beta, int *tc,
  93. uint8_t *no_p, uint8_t *no_q);
  94. void (*hevc_h_loop_filter_chroma_c)(uint8_t *pix, ptrdiff_t stride,
  95. int *tc, uint8_t *no_p,
  96. uint8_t *no_q);
  97. void (*hevc_v_loop_filter_chroma_c)(uint8_t *pix, ptrdiff_t stride,
  98. int *tc, uint8_t *no_p,
  99. uint8_t *no_q);
  100. } HEVCDSPContext;
  101. void ff_hevc_dsp_init(HEVCDSPContext *hpc, int bit_depth);
  102. void ff_hevc_dsp_init_arm(HEVCDSPContext *c, const int bit_depth);
  103. void ff_hevc_dsp_init_ppc(HEVCDSPContext *c, const int bit_depth);
  104. void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth);
  105. extern const int16_t ff_hevc_epel_coeffs[7][16];
  106. extern const int8_t ff_hevc_epel_coeffs8[7][16];
  107. extern const int16_t ff_hevc_qpel_coeffs[3][8];
  108. extern const int8_t ff_hevc_qpel_coeffs8[3][16];
  109. #endif /* AVCODEC_HEVCDSP_H */