hpeldsp.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * Half-pel DSP functions.
  3. * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  4. * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
  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. /**
  23. * @file
  24. * Half-pel DSP functions.
  25. */
  26. #ifndef AVCODEC_HPELDSP_H
  27. #define AVCODEC_HPELDSP_H
  28. #include <stdint.h>
  29. #include <stddef.h>
  30. /* add and put pixel (decoding) */
  31. // blocksizes for hpel_pixels_func are 8x4,8x8 16x8 16x16
  32. // h for hpel_pixels_func is limited to {width/2, width} but never larger
  33. // than 16 and never smaller than 4
  34. typedef void (*op_pixels_func)(uint8_t *block /*align width (8 or 16)*/,
  35. const uint8_t *pixels /*align 1*/,
  36. ptrdiff_t line_size, int h);
  37. /**
  38. * Half-pel DSP context.
  39. */
  40. typedef struct HpelDSPContext {
  41. /**
  42. * Halfpel motion compensation with rounding (a+b+1)>>1.
  43. * this is an array[4][4] of motion compensation functions for 4
  44. * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
  45. * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
  46. * @param block destination where the result is stored
  47. * @param pixels source
  48. * @param line_size number of bytes in a horizontal line of block
  49. * @param h height
  50. */
  51. op_pixels_func put_pixels_tab[4][4];
  52. /**
  53. * Halfpel motion compensation with rounding (a+b+1)>>1.
  54. * This is an array[4][4] of motion compensation functions for 4
  55. * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
  56. * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
  57. * @param block destination into which the result is averaged (a+b+1)>>1
  58. * @param pixels source
  59. * @param line_size number of bytes in a horizontal line of block
  60. * @param h height
  61. */
  62. op_pixels_func avg_pixels_tab[4][4];
  63. /**
  64. * Halfpel motion compensation with no rounding (a+b)>>1.
  65. * this is an array[4][4] of motion compensation functions for 2
  66. * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
  67. * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
  68. * @param block destination where the result is stored
  69. * @param pixels source
  70. * @param line_size number of bytes in a horizontal line of block
  71. * @param h height
  72. * @note The size is kept at [4][4] to match the above pixel_tabs and avoid
  73. * out of bounds reads in the motion estimation code.
  74. */
  75. op_pixels_func put_no_rnd_pixels_tab[4][4];
  76. /**
  77. * Halfpel motion compensation with no rounding (a+b)>>1.
  78. * this is an array[4] of motion compensation functions for 1
  79. * horizontal blocksize (16) and the 4 halfpel positions<br>
  80. * *pixels_tab[0][ xhalfpel + 2*yhalfpel ]
  81. * @param block destination into which the result is averaged (a+b)>>1
  82. * @param pixels source
  83. * @param line_size number of bytes in a horizontal line of block
  84. * @param h height
  85. */
  86. op_pixels_func avg_no_rnd_pixels_tab[4];
  87. } HpelDSPContext;
  88. void ff_hpeldsp_init(HpelDSPContext *c, int flags);
  89. void ff_hpeldsp_init_aarch64(HpelDSPContext *c, int flags);
  90. void ff_hpeldsp_init_alpha(HpelDSPContext *c, int flags);
  91. void ff_hpeldsp_init_arm(HpelDSPContext *c, int flags);
  92. void ff_hpeldsp_init_ppc(HpelDSPContext *c, int flags);
  93. void ff_hpeldsp_init_x86(HpelDSPContext *c, int flags);
  94. void ff_hpeldsp_init_mips(HpelDSPContext *c, int flags);
  95. #endif /* AVCODEC_HPELDSP_H */