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.

208 lines
8.2KB

  1. /*
  2. * DSP functions for Indeo Video Interactive codecs (Indeo4 and Indeo5)
  3. *
  4. * Copyright (c) 2009-2011 Maxim Poliakovski
  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. * DSP functions (inverse transforms, motion compensations, wavelet recompostion)
  25. * for Indeo Video Interactive codecs.
  26. */
  27. #ifndef AVCODEC_IVI_DSP_H
  28. #define AVCODEC_IVI_DSP_H
  29. #include "avcodec.h"
  30. #include "ivi_common.h"
  31. /**
  32. * 5/3 wavelet recomposition filter for Indeo5
  33. *
  34. * @param[in] plane pointer to the descriptor of the plane being processed
  35. * @param[out] dst pointer to the destination buffer
  36. * @param[in] dst_pitch pitch of the destination buffer
  37. * @param[in] num_bands number of wavelet bands to be processed
  38. */
  39. void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst,
  40. const int dst_pitch, const int num_bands);
  41. /**
  42. * Haar wavelet recomposition filter for Indeo 4
  43. *
  44. * @param[in] plane pointer to the descriptor of the plane being processed
  45. * @param[out] dst pointer to the destination buffer
  46. * @param[in] dst_pitch pitch of the destination buffer
  47. * @param[in] num_bands number of wavelet bands to be processed
  48. */
  49. void ff_ivi_recompose_haar(const IVIPlaneDesc *plane, uint8_t *dst,
  50. const int dst_pitch, const int num_bands);
  51. /**
  52. * two-dimensional inverse Haar 8x8 transform for Indeo 4
  53. *
  54. * @param[in] in pointer to the vector of transform coefficients
  55. * @param[out] out pointer to the output buffer (frame)
  56. * @param[in] pitch pitch to move to the next y line
  57. * @param[in] flags pointer to the array of column flags:
  58. * != 0 - non_empty column, 0 - empty one
  59. * (this array must be filled by caller)
  60. */
  61. void ff_ivi_inverse_haar_8x8(const int32_t *in, int16_t *out, uint32_t pitch,
  62. const uint8_t *flags);
  63. /**
  64. * DC-only two-dimensional inverse Haar transform for Indeo 4.
  65. * Performing the inverse transform in this case is equivalent to
  66. * spreading DC_coeff >> 3 over the whole block.
  67. *
  68. * @param[in] in pointer to the dc coefficient
  69. * @param[out] out pointer to the output buffer (frame)
  70. * @param[in] pitch pitch to move to the next y line
  71. * @param[in] blk_size transform block size
  72. */
  73. void ff_ivi_dc_haar_2d(const int32_t *in, int16_t *out, uint32_t pitch,
  74. int blk_size);
  75. /**
  76. * two-dimensional inverse slant 8x8 transform
  77. *
  78. * @param[in] in pointer to the vector of transform coefficients
  79. * @param[out] out pointer to the output buffer (frame)
  80. * @param[in] pitch pitch to move to the next y line
  81. * @param[in] flags pointer to the array of column flags:
  82. * != 0 - non_empty column, 0 - empty one
  83. * (this array must be filled by caller)
  84. */
  85. void ff_ivi_inverse_slant_8x8(const int32_t *in, int16_t *out, uint32_t pitch,
  86. const uint8_t *flags);
  87. /**
  88. * two-dimensional inverse slant 4x4 transform
  89. *
  90. * @param[in] in pointer to the vector of transform coefficients
  91. * @param[out] out pointer to the output buffer (frame)
  92. * @param[in] pitch pitch to move to the next y line
  93. * @param[in] flags pointer to the array of column flags:
  94. * != 0 - non_empty column, 0 - empty one
  95. * (this array must be filled by caller)
  96. */
  97. void ff_ivi_inverse_slant_4x4(const int32_t *in, int16_t *out, uint32_t pitch,
  98. const uint8_t *flags);
  99. /**
  100. * DC-only two-dimensional inverse slant transform.
  101. * Performing the inverse slant transform in this case is equivalent to
  102. * spreading (DC_coeff + 1)/2 over the whole block.
  103. * It works much faster than performing the slant transform on a vector of zeroes.
  104. *
  105. * @param[in] in pointer to the dc coefficient
  106. * @param[out] out pointer to the output buffer (frame)
  107. * @param[in] pitch pitch to move to the next y line
  108. * @param[in] blk_size transform block size
  109. */
  110. void ff_ivi_dc_slant_2d(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
  111. /**
  112. * inverse 1D row slant transform
  113. *
  114. * @param[in] in pointer to the vector of transform coefficients
  115. * @param[out] out pointer to the output buffer (frame)
  116. * @param[in] pitch pitch to move to the next y line
  117. * @param[in] flags pointer to the array of column flags (unused here)
  118. */
  119. void ff_ivi_row_slant8(const int32_t *in, int16_t *out, uint32_t pitch,
  120. const uint8_t *flags);
  121. /**
  122. * inverse 1D column slant transform
  123. *
  124. * @param[in] in pointer to the vector of transform coefficients
  125. * @param[out] out pointer to the output buffer (frame)
  126. * @param[in] pitch pitch to move to the next y line
  127. * @param[in] flags pointer to the array of column flags:
  128. * != 0 - non_empty column, 0 - empty one
  129. * (this array must be filled by caller)
  130. */
  131. void ff_ivi_col_slant8(const int32_t *in, int16_t *out, uint32_t pitch,
  132. const uint8_t *flags);
  133. /**
  134. * DC-only inverse row slant transform
  135. */
  136. void ff_ivi_dc_row_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
  137. /**
  138. * DC-only inverse column slant transform
  139. */
  140. void ff_ivi_dc_col_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
  141. /**
  142. * Copy the pixels into the frame buffer.
  143. */
  144. void ff_ivi_put_pixels_8x8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags);
  145. /**
  146. * Copy the DC coefficient into the first pixel of the block and
  147. * zero all others.
  148. */
  149. void ff_ivi_put_dc_pixel_8x8(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
  150. /**
  151. * 8x8 block motion compensation with adding delta
  152. *
  153. * @param[in,out] buf pointer to the block in the current frame buffer containing delta
  154. * @param[in] ref_buf pointer to the corresponding block in the reference frame
  155. * @param[in] pitch pitch for moving to the next y line
  156. * @param[in] mc_type interpolation type
  157. */
  158. void ff_ivi_mc_8x8_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
  159. /**
  160. * 4x4 block motion compensation with adding delta
  161. *
  162. * @param[in,out] buf pointer to the block in the current frame buffer containing delta
  163. * @param[in] ref_buf pointer to the corresponding block in the reference frame
  164. * @param[in] pitch pitch for moving to the next y line
  165. * @param[in] mc_type interpolation type
  166. */
  167. void ff_ivi_mc_4x4_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
  168. /**
  169. * motion compensation without adding delta
  170. *
  171. * @param[in,out] buf pointer to the block in the current frame receiving the result
  172. * @param[in] ref_buf pointer to the corresponding block in the reference frame
  173. * @param[in] pitch pitch for moving to the next y line
  174. * @param[in] mc_type interpolation type
  175. */
  176. void ff_ivi_mc_8x8_no_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
  177. /**
  178. * 4x4 block motion compensation without adding delta
  179. *
  180. * @param[in,out] buf pointer to the block in the current frame receiving the result
  181. * @param[in] ref_buf pointer to the corresponding block in the reference frame
  182. * @param[in] pitch pitch for moving to the next y line
  183. * @param[in] mc_type interpolation type
  184. */
  185. void ff_ivi_mc_4x4_no_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
  186. #endif /* AVCODEC_IVI_DSP_H */