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.

105 lines
4.0KB

  1. /*
  2. * This file is part of Libav.
  3. *
  4. * Libav 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. * Libav 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 Libav; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef AVCODEC_IDCTDSP_H
  19. #define AVCODEC_IDCTDSP_H
  20. #include <stdint.h>
  21. #include "avcodec.h"
  22. /**
  23. * Scantable.
  24. */
  25. typedef struct ScanTable {
  26. const uint8_t *scantable;
  27. uint8_t permutated[64];
  28. uint8_t raster_end[64];
  29. } ScanTable;
  30. void ff_init_scantable(uint8_t *permutation, ScanTable *st,
  31. const uint8_t *src_scantable);
  32. void ff_init_scantable_permutation(uint8_t *idct_permutation,
  33. int idct_permutation_type);
  34. int ff_init_scantable_permutation_x86(uint8_t *idct_permutation,
  35. int idct_permutation_type);
  36. typedef struct IDCTDSPContext {
  37. /* pixel ops : interface with DCT */
  38. void (*put_pixels_clamped)(const int16_t *block /* align 16 */,
  39. uint8_t *pixels /* align 8 */,
  40. int line_size);
  41. void (*put_signed_pixels_clamped)(const int16_t *block /* align 16 */,
  42. uint8_t *pixels /* align 8 */,
  43. int line_size);
  44. void (*add_pixels_clamped)(const int16_t *block /* align 16 */,
  45. uint8_t *pixels /* align 8 */,
  46. int line_size);
  47. void (*idct)(int16_t *block /* align 16 */);
  48. /**
  49. * block -> idct -> clip to unsigned 8 bit -> dest.
  50. * (-1392, 0, 0, ...) -> idct -> (-174, -174, ...) -> put -> (0, 0, ...)
  51. * @param line_size size in bytes of a horizontal line of dest
  52. */
  53. void (*idct_put)(uint8_t *dest /* align 8 */,
  54. int line_size, int16_t *block /* align 16 */);
  55. /**
  56. * block -> idct -> add dest -> clip to unsigned 8 bit -> dest.
  57. * @param line_size size in bytes of a horizontal line of dest
  58. */
  59. void (*idct_add)(uint8_t *dest /* align 8 */,
  60. int line_size, int16_t *block /* align 16 */);
  61. /**
  62. * IDCT input permutation.
  63. * Several optimized IDCTs need a permutated input (relative to the
  64. * normal order of the reference IDCT).
  65. * This permutation must be performed before the idct_put/add.
  66. * Note, normally this can be merged with the zigzag/alternate scan<br>
  67. * An example to avoid confusion:
  68. * - (->decode coeffs -> zigzag reorder -> dequant -> reference IDCT -> ...)
  69. * - (x -> reference DCT -> reference IDCT -> x)
  70. * - (x -> reference DCT -> simple_mmx_perm = idct_permutation
  71. * -> simple_idct_mmx -> x)
  72. * - (-> decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant
  73. * -> simple_idct_mmx -> ...)
  74. */
  75. uint8_t idct_permutation[64];
  76. int idct_permutation_type;
  77. #define FF_NO_IDCT_PERM 1
  78. #define FF_LIBMPEG2_IDCT_PERM 2
  79. #define FF_SIMPLE_IDCT_PERM 3
  80. #define FF_TRANSPOSE_IDCT_PERM 4
  81. #define FF_PARTTRANS_IDCT_PERM 5
  82. #define FF_SSE2_IDCT_PERM 6
  83. } IDCTDSPContext;
  84. void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx);
  85. void ff_idctdsp_init_arm(IDCTDSPContext *c, AVCodecContext *avctx,
  86. unsigned high_bit_depth);
  87. void ff_idctdsp_init_ppc(IDCTDSPContext *c, AVCodecContext *avctx,
  88. unsigned high_bit_depth);
  89. void ff_idctdsp_init_x86(IDCTDSPContext *c, AVCodecContext *avctx,
  90. unsigned high_bit_depth);
  91. #endif /* AVCODEC_IDCTDSP_H */