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.

93 lines
2.5KB

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