h264pred.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
  3. * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * FFmpeg is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. /**
  22. * @file
  23. * H.264 / AVC / MPEG-4 prediction functions.
  24. * @author Michael Niedermayer <michaelni@gmx.at>
  25. */
  26. #ifndef AVCODEC_H264PRED_H
  27. #define AVCODEC_H264PRED_H
  28. #include <stddef.h>
  29. #include <stdint.h>
  30. /**
  31. * Prediction types
  32. */
  33. //@{
  34. #define VERT_PRED 0
  35. #define HOR_PRED 1
  36. #define DC_PRED 2
  37. #define DIAG_DOWN_LEFT_PRED 3
  38. #define DIAG_DOWN_RIGHT_PRED 4
  39. #define VERT_RIGHT_PRED 5
  40. #define HOR_DOWN_PRED 6
  41. #define VERT_LEFT_PRED 7
  42. #define HOR_UP_PRED 8
  43. // DC edge (not for VP8)
  44. #define LEFT_DC_PRED 9
  45. #define TOP_DC_PRED 10
  46. #define DC_128_PRED 11
  47. // RV40 specific
  48. #define DIAG_DOWN_LEFT_PRED_RV40_NODOWN 12
  49. #define HOR_UP_PRED_RV40_NODOWN 13
  50. #define VERT_LEFT_PRED_RV40_NODOWN 14
  51. // VP8 specific
  52. #define TM_VP8_PRED 9 ///< "True Motion", used instead of plane
  53. #define VERT_VP8_PRED 10 ///< for VP8, #VERT_PRED is the average of
  54. ///< (left col+cur col x2+right col) / 4;
  55. ///< this is the "unaveraged" one
  56. #define HOR_VP8_PRED 14 ///< unaveraged version of #HOR_PRED, see
  57. ///< #VERT_VP8_PRED for details
  58. #define DC_127_PRED 12
  59. #define DC_129_PRED 13
  60. #define DC_PRED8x8 0
  61. #define HOR_PRED8x8 1
  62. #define VERT_PRED8x8 2
  63. #define PLANE_PRED8x8 3
  64. // DC edge
  65. #define LEFT_DC_PRED8x8 4
  66. #define TOP_DC_PRED8x8 5
  67. #define DC_128_PRED8x8 6
  68. // H.264/SVQ3 (8x8) specific
  69. #define ALZHEIMER_DC_L0T_PRED8x8 7
  70. #define ALZHEIMER_DC_0LT_PRED8x8 8
  71. #define ALZHEIMER_DC_L00_PRED8x8 9
  72. #define ALZHEIMER_DC_0L0_PRED8x8 10
  73. // VP8 specific
  74. #define DC_127_PRED8x8 7
  75. #define DC_129_PRED8x8 8
  76. //@}
  77. /**
  78. * Context for storing H.264 prediction functions
  79. */
  80. typedef struct H264PredContext {
  81. void(*pred4x4[9 + 3 + 3])(uint8_t *src, const uint8_t *topright,
  82. ptrdiff_t stride);
  83. void(*pred8x8l[9 + 3])(uint8_t *src, int topleft, int topright,
  84. ptrdiff_t stride);
  85. void(*pred8x8[4 + 3 + 4])(uint8_t *src, ptrdiff_t stride);
  86. void(*pred16x16[4 + 3 + 2])(uint8_t *src, ptrdiff_t stride);
  87. void(*pred4x4_add[2])(uint8_t *pix /*align 4*/,
  88. int16_t *block /*align 16*/, ptrdiff_t stride);
  89. void(*pred8x8l_add[2])(uint8_t *pix /*align 8*/,
  90. int16_t *block /*align 16*/, ptrdiff_t stride);
  91. void(*pred8x8l_filter_add[2])(uint8_t *pix /*align 8*/,
  92. int16_t *block /*align 16*/, int topleft, int topright, ptrdiff_t stride);
  93. void(*pred8x8_add[3])(uint8_t *pix /*align 8*/,
  94. const int *block_offset,
  95. int16_t *block /*align 16*/, ptrdiff_t stride);
  96. void(*pred16x16_add[3])(uint8_t *pix /*align 16*/,
  97. const int *block_offset,
  98. int16_t *block /*align 16*/, ptrdiff_t stride);
  99. } H264PredContext;
  100. void ff_h264_pred_init(H264PredContext *h, int codec_id,
  101. const int bit_depth, const int chroma_format_idc);
  102. void ff_h264_pred_init_aarch64(H264PredContext *h, int codec_id,
  103. const int bit_depth,
  104. const int chroma_format_idc);
  105. void ff_h264_pred_init_arm(H264PredContext *h, int codec_id,
  106. const int bit_depth, const int chroma_format_idc);
  107. void ff_h264_pred_init_x86(H264PredContext *h, int codec_id,
  108. const int bit_depth, const int chroma_format_idc);
  109. void ff_h264_pred_init_mips(H264PredContext *h, int codec_id,
  110. const int bit_depth, const int chroma_format_idc);
  111. #endif /* AVCODEC_H264PRED_H */