avdct.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * This file is part of FFmpeg.
  3. *
  4. * FFmpeg is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * FFmpeg is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with FFmpeg; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef AVCODEC_AVDCT_H
  19. #define AVCODEC_AVDCT_H
  20. #include "libavutil/opt.h"
  21. /**
  22. * AVDCT context.
  23. * @note function pointers can be NULL if the specific features have been
  24. * disabled at build time.
  25. */
  26. typedef struct AVDCT {
  27. const AVClass *av_class;
  28. void (*idct)(int16_t *block /* align 16 */);
  29. /**
  30. * IDCT input permutation.
  31. * Several optimized IDCTs need a permutated input (relative to the
  32. * normal order of the reference IDCT).
  33. * This permutation must be performed before the idct_put/add.
  34. * Note, normally this can be merged with the zigzag/alternate scan<br>
  35. * An example to avoid confusion:
  36. * - (->decode coeffs -> zigzag reorder -> dequant -> reference IDCT -> ...)
  37. * - (x -> reference DCT -> reference IDCT -> x)
  38. * - (x -> reference DCT -> simple_mmx_perm = idct_permutation
  39. * -> simple_idct_mmx -> x)
  40. * - (-> decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant
  41. * -> simple_idct_mmx -> ...)
  42. */
  43. uint8_t idct_permutation[64];
  44. void (*fdct)(int16_t *block /* align 16 */);
  45. /**
  46. * DCT algorithm.
  47. * must use AVOptions to set this field.
  48. */
  49. int dct_algo;
  50. /**
  51. * IDCT algorithm.
  52. * must use AVOptions to set this field.
  53. */
  54. int idct_algo;
  55. void (*get_pixels)(int16_t *block /* align 16 */,
  56. const uint8_t *pixels /* align 8 */,
  57. ptrdiff_t line_size);
  58. int bits_per_sample;
  59. void (*get_pixels_unaligned)(int16_t *block /* align 16 */,
  60. const uint8_t *pixels,
  61. ptrdiff_t line_size);
  62. } AVDCT;
  63. /**
  64. * Allocates a AVDCT context.
  65. * This needs to be initialized with avcodec_dct_init() after optionally
  66. * configuring it with AVOptions.
  67. *
  68. * To free it use av_free()
  69. */
  70. AVDCT *avcodec_dct_alloc(void);
  71. int avcodec_dct_init(AVDCT *);
  72. const AVClass *avcodec_dct_get_class(void);
  73. #endif /* AVCODEC_AVDCT_H */