hevcdsp.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. * HEVC video decoder
  3. *
  4. * Copyright (C) 2012 - 2013 Guillaume Martres
  5. * Copyright (C) 2013 - 2014 Pierre-Edouard Lepere
  6. *
  7. *
  8. * This file is part of FFmpeg.
  9. *
  10. * FFmpeg is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU Lesser General Public
  12. * License as published by the Free Software Foundation; either
  13. * version 2.1 of the License, or (at your option) any later version.
  14. *
  15. * FFmpeg is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * Lesser General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Lesser General Public
  21. * License along with FFmpeg; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  23. */
  24. #ifndef AVCODEC_HEVCDSP_H
  25. #define AVCODEC_HEVCDSP_H
  26. #include "get_bits.h"
  27. #define MAX_PB_SIZE 64
  28. typedef struct SAOParams {
  29. int offset_abs[3][4]; ///< sao_offset_abs
  30. int offset_sign[3][4]; ///< sao_offset_sign
  31. uint8_t band_position[3]; ///< sao_band_position
  32. int eo_class[3]; ///< sao_eo_class
  33. int16_t offset_val[3][5]; ///<SaoOffsetVal
  34. uint8_t type_idx[3]; ///< sao_type_idx
  35. } SAOParams;
  36. typedef struct HEVCDSPContext {
  37. void (*put_pcm)(uint8_t *_dst, ptrdiff_t _stride, int width, int height,
  38. struct GetBitContext *gb, int pcm_bit_depth);
  39. void (*add_residual[4])(uint8_t *dst, int16_t *res, ptrdiff_t stride);
  40. void (*dequant)(int16_t *coeffs, int16_t log2_size);
  41. void (*transform_rdpcm)(int16_t *coeffs, int16_t log2_size, int mode);
  42. void (*transform_4x4_luma)(int16_t *coeffs);
  43. void (*idct[4])(int16_t *coeffs, int col_limit);
  44. void (*idct_dc[4])(int16_t *coeffs);
  45. void (*sao_band_filter[5])(uint8_t *_dst, uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src,
  46. int16_t *sao_offset_val, int sao_left_class, int width, int height);
  47. /* implicit stride_src parameter has value of 2 * MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE */
  48. void (*sao_edge_filter[5])(uint8_t *_dst /* align 16 */, uint8_t *_src /* align 32 */, ptrdiff_t stride_dst,
  49. int16_t *sao_offset_val, int sao_eo_class, int width, int height);
  50. void (*sao_edge_restore[2])(uint8_t *_dst, uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src,
  51. struct SAOParams *sao, int *borders, int _width, int _height, int c_idx,
  52. uint8_t *vert_edge, uint8_t *horiz_edge, uint8_t *diag_edge);
  53. void (*put_hevc_qpel[10][2][2])(int16_t *dst, uint8_t *src, ptrdiff_t srcstride,
  54. int height, intptr_t mx, intptr_t my, int width);
  55. void (*put_hevc_qpel_uni[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride,
  56. int height, intptr_t mx, intptr_t my, int width);
  57. void (*put_hevc_qpel_uni_w[10][2][2])(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
  58. int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width);
  59. void (*put_hevc_qpel_bi[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride,
  60. int16_t *src2,
  61. int height, intptr_t mx, intptr_t my, int width);
  62. void (*put_hevc_qpel_bi_w[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride,
  63. int16_t *src2,
  64. int height, int denom, int wx0, int wx1,
  65. int ox0, int ox1, intptr_t mx, intptr_t my, int width);
  66. void (*put_hevc_epel[10][2][2])(int16_t *dst, uint8_t *src, ptrdiff_t srcstride,
  67. int height, intptr_t mx, intptr_t my, int width);
  68. void (*put_hevc_epel_uni[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride,
  69. int height, intptr_t mx, intptr_t my, int width);
  70. void (*put_hevc_epel_uni_w[10][2][2])(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
  71. int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width);
  72. void (*put_hevc_epel_bi[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride,
  73. int16_t *src2,
  74. int height, intptr_t mx, intptr_t my, int width);
  75. void (*put_hevc_epel_bi_w[10][2][2])(uint8_t *dst, ptrdiff_t dststride, uint8_t *_src, ptrdiff_t _srcstride,
  76. int16_t *src2,
  77. int height, int denom, int wx0, int ox0, int wx1,
  78. int ox1, intptr_t mx, intptr_t my, int width);
  79. void (*hevc_h_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride,
  80. int beta, int32_t *tc,
  81. uint8_t *no_p, uint8_t *no_q);
  82. void (*hevc_v_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride,
  83. int beta, int32_t *tc,
  84. uint8_t *no_p, uint8_t *no_q);
  85. void (*hevc_h_loop_filter_chroma)(uint8_t *pix, ptrdiff_t stride,
  86. int32_t *tc, uint8_t *no_p, uint8_t *no_q);
  87. void (*hevc_v_loop_filter_chroma)(uint8_t *pix, ptrdiff_t stride,
  88. int32_t *tc, uint8_t *no_p, uint8_t *no_q);
  89. void (*hevc_h_loop_filter_luma_c)(uint8_t *pix, ptrdiff_t stride,
  90. int beta, int32_t *tc,
  91. uint8_t *no_p, uint8_t *no_q);
  92. void (*hevc_v_loop_filter_luma_c)(uint8_t *pix, ptrdiff_t stride,
  93. int beta, int32_t *tc,
  94. uint8_t *no_p, uint8_t *no_q);
  95. void (*hevc_h_loop_filter_chroma_c)(uint8_t *pix, ptrdiff_t stride,
  96. int32_t *tc, uint8_t *no_p,
  97. uint8_t *no_q);
  98. void (*hevc_v_loop_filter_chroma_c)(uint8_t *pix, ptrdiff_t stride,
  99. int32_t *tc, uint8_t *no_p,
  100. uint8_t *no_q);
  101. } HEVCDSPContext;
  102. void ff_hevc_dsp_init(HEVCDSPContext *hpc, int bit_depth);
  103. extern const int8_t ff_hevc_epel_filters[7][4];
  104. extern const int8_t ff_hevc_qpel_filters[3][16];
  105. void ff_hevc_dsp_init_arm(HEVCDSPContext *c, const int bit_depth);
  106. void ff_hevc_dsp_init_ppc(HEVCDSPContext *c, const int bit_depth);
  107. void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth);
  108. void ff_hevc_dsp_init_mips(HEVCDSPContext *c, const int bit_depth);
  109. #endif /* AVCODEC_HEVCDSP_H */