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.

92 lines
2.5KB

  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. #include "dsputil.h"
  19. #ifndef BIT_DEPTH
  20. #define BIT_DEPTH 8
  21. #endif
  22. #ifdef AVCODEC_H264_HIGH_DEPTH_H
  23. # undef pixel
  24. # undef pixel2
  25. # undef pixel4
  26. # undef dctcoef
  27. # undef INIT_CLIP
  28. # undef no_rnd_avg_pixel4
  29. # undef rnd_avg_pixel4
  30. # undef AV_RN2P
  31. # undef AV_RN4P
  32. # undef AV_RN4PA
  33. # undef AV_WN2P
  34. # undef AV_WN4P
  35. # undef AV_WN4PA
  36. # undef CLIP
  37. # undef FUNC
  38. # undef FUNCC
  39. # undef av_clip_pixel
  40. # undef PIXEL_SPLAT_X4
  41. #else
  42. # define AVCODEC_H264_HIGH_DEPTH_H
  43. #endif
  44. #if BIT_DEPTH > 8
  45. # define pixel uint16_t
  46. # define pixel2 uint32_t
  47. # define pixel4 uint64_t
  48. # define dctcoef int32_t
  49. # define INIT_CLIP
  50. # define no_rnd_avg_pixel4 no_rnd_avg64
  51. # define rnd_avg_pixel4 rnd_avg64
  52. # define AV_RN2P AV_RN32
  53. # define AV_RN4P AV_RN64
  54. # define AV_RN4PA AV_RN64A
  55. # define AV_WN2P AV_WN32
  56. # define AV_WN4P AV_WN64
  57. # define AV_WN4PA AV_WN64A
  58. # define PIXEL_SPLAT_X4(x) ((x)*0x0001000100010001ULL)
  59. # define av_clip_pixel(a) av_clip_uintp2(a, BIT_DEPTH)
  60. # define CLIP(a) av_clip_uintp2(a, BIT_DEPTH)
  61. #else
  62. # define pixel uint8_t
  63. # define pixel2 uint16_t
  64. # define pixel4 uint32_t
  65. # define dctcoef int16_t
  66. # define INIT_CLIP
  67. # define no_rnd_avg_pixel4 no_rnd_avg32
  68. # define rnd_avg_pixel4 rnd_avg32
  69. # define AV_RN2P AV_RN16
  70. # define AV_RN4P AV_RN32
  71. # define AV_RN4PA AV_RN32A
  72. # define AV_WN2P AV_WN16
  73. # define AV_WN4P AV_WN32
  74. # define AV_WN4PA AV_WN32A
  75. # define PIXEL_SPLAT_X4(x) ((x)*0x01010101U)
  76. # define av_clip_pixel(a) av_clip_uint8(a)
  77. # define CLIP(a) av_clip_uint8(a)
  78. #endif
  79. #define FUNC3(a, b, c) a ## _ ## b ## c
  80. #define FUNC2(a, b, c) FUNC3(a, b, c)
  81. #define FUNC(a) FUNC2(a, BIT_DEPTH,)
  82. #define FUNCC(a) FUNC2(a, BIT_DEPTH, _c)