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.

115 lines
4.4KB

  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_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. enum idct_permutation_type {
  31. FF_IDCT_PERM_NONE,
  32. FF_IDCT_PERM_LIBMPEG2,
  33. FF_IDCT_PERM_SIMPLE,
  34. FF_IDCT_PERM_TRANSPOSE,
  35. FF_IDCT_PERM_PARTTRANS,
  36. FF_IDCT_PERM_SSE2,
  37. };
  38. void ff_init_scantable(uint8_t *permutation, ScanTable *st,
  39. const uint8_t *src_scantable);
  40. void ff_init_scantable_permutation(uint8_t *idct_permutation,
  41. enum idct_permutation_type perm_type);
  42. int ff_init_scantable_permutation_x86(uint8_t *idct_permutation,
  43. enum idct_permutation_type perm_type);
  44. void ff_put_pixels_clamped(const int16_t *block, uint8_t *av_restrict pixels,
  45. int line_size);
  46. void ff_add_pixels_clamped(const int16_t *block, uint8_t *av_restrict pixels,
  47. int line_size);
  48. typedef struct IDCTDSPContext {
  49. /* pixel ops : interface with DCT */
  50. void (*put_pixels_clamped)(const int16_t *block /* align 16 */,
  51. uint8_t *pixels /* align 8 */,
  52. int line_size);
  53. void (*put_signed_pixels_clamped)(const int16_t *block /* align 16 */,
  54. uint8_t *pixels /* align 8 */,
  55. int line_size);
  56. void (*add_pixels_clamped)(const int16_t *block /* align 16 */,
  57. uint8_t *pixels /* align 8 */,
  58. int line_size);
  59. void (*idct)(int16_t *block /* align 16 */);
  60. /**
  61. * block -> idct -> clip to unsigned 8 bit -> dest.
  62. * (-1392, 0, 0, ...) -> idct -> (-174, -174, ...) -> put -> (0, 0, ...)
  63. * @param line_size size in bytes of a horizontal line of dest
  64. */
  65. void (*idct_put)(uint8_t *dest /* align 8 */,
  66. int line_size, int16_t *block /* align 16 */);
  67. /**
  68. * block -> idct -> add dest -> clip to unsigned 8 bit -> dest.
  69. * @param line_size size in bytes of a horizontal line of dest
  70. */
  71. void (*idct_add)(uint8_t *dest /* align 8 */,
  72. int line_size, int16_t *block /* align 16 */);
  73. /**
  74. * IDCT input permutation.
  75. * Several optimized IDCTs need a permutated input (relative to the
  76. * normal order of the reference IDCT).
  77. * This permutation must be performed before the idct_put/add.
  78. * Note, normally this can be merged with the zigzag/alternate scan<br>
  79. * An example to avoid confusion:
  80. * - (->decode coeffs -> zigzag reorder -> dequant -> reference IDCT -> ...)
  81. * - (x -> reference DCT -> reference IDCT -> x)
  82. * - (x -> reference DCT -> simple_mmx_perm = idct_permutation
  83. * -> simple_idct_mmx -> x)
  84. * - (-> decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant
  85. * -> simple_idct_mmx -> ...)
  86. */
  87. uint8_t idct_permutation[64];
  88. enum idct_permutation_type perm_type;
  89. } IDCTDSPContext;
  90. void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx);
  91. void ff_idctdsp_init_alpha(IDCTDSPContext *c, AVCodecContext *avctx,
  92. unsigned high_bit_depth);
  93. void ff_idctdsp_init_arm(IDCTDSPContext *c, AVCodecContext *avctx,
  94. unsigned high_bit_depth);
  95. void ff_idctdsp_init_ppc(IDCTDSPContext *c, AVCodecContext *avctx,
  96. unsigned high_bit_depth);
  97. void ff_idctdsp_init_x86(IDCTDSPContext *c, AVCodecContext *avctx,
  98. unsigned high_bit_depth);
  99. #endif /* AVCODEC_IDCTDSP_H */