avdct.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. } AVDCT;
  60. /**
  61. * Allocates a AVDCT context.
  62. * This needs to be initialized with avcodec_dct_init() after optionally
  63. * configuring it with AVOptions.
  64. *
  65. * To free it use av_free()
  66. */
  67. AVDCT *avcodec_dct_alloc(void);
  68. int avcodec_dct_init(AVDCT *);
  69. const AVClass *avcodec_dct_get_class(void);
  70. #endif /* AVCODEC_AVDCT_H */