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.

206 lines
8.0KB

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