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.

89 lines
2.1KB

  1. #include "dsputil.h"
  2. #ifndef BIT_DEPTH
  3. #define BIT_DEPTH 8
  4. #endif
  5. #ifdef AVCODEC_H264_HIGH_DEPTH_H
  6. # undef pixel
  7. # undef pixel2
  8. # undef pixel4
  9. # undef dctcoef
  10. # undef INIT_CLIP
  11. # undef no_rnd_avg_pixel4
  12. # undef rnd_avg_pixel4
  13. # undef AV_RN2P
  14. # undef AV_RN4P
  15. # undef AV_RN4PA
  16. # undef AV_WN2P
  17. # undef AV_WN4P
  18. # undef AV_WN4PA
  19. # undef CLIP
  20. # undef FUNC
  21. # undef FUNCC
  22. # undef av_clip_pixel
  23. # undef PIXEL_SPLAT_X4
  24. #else
  25. # define AVCODEC_H264_HIGH_DEPTH_H
  26. # define CLIP_PIXEL(depth)\
  27. static inline uint16_t av_clip_pixel_ ## depth (int p)\
  28. {\
  29. const int pixel_max = (1 << depth)-1;\
  30. return (p & ~pixel_max) ? (-p)>>31 & pixel_max : p;\
  31. }
  32. CLIP_PIXEL( 9)
  33. CLIP_PIXEL(10)
  34. #endif
  35. #if BIT_DEPTH > 8
  36. # define pixel uint16_t
  37. # define pixel2 uint32_t
  38. # define pixel4 uint64_t
  39. # define dctcoef int32_t
  40. # define INIT_CLIP
  41. # define no_rnd_avg_pixel4 no_rnd_avg64
  42. # define rnd_avg_pixel4 rnd_avg64
  43. # define AV_RN2P AV_RN32
  44. # define AV_RN4P AV_RN64
  45. # define AV_RN4PA AV_RN64A
  46. # define AV_WN2P AV_WN32
  47. # define AV_WN4P AV_WN64
  48. # define AV_WN4PA AV_WN64A
  49. # define PIXEL_SPLAT_X4(x) ((x)*0x0001000100010001ULL)
  50. #else
  51. # define pixel uint8_t
  52. # define pixel2 uint16_t
  53. # define pixel4 uint32_t
  54. # define dctcoef int16_t
  55. # define INIT_CLIP uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
  56. # define no_rnd_avg_pixel4 no_rnd_avg32
  57. # define rnd_avg_pixel4 rnd_avg32
  58. # define AV_RN2P AV_RN16
  59. # define AV_RN4P AV_RN32
  60. # define AV_RN4PA AV_RN32A
  61. # define AV_WN2P AV_WN16
  62. # define AV_WN4P AV_WN32
  63. # define AV_WN4PA AV_WN32A
  64. # define PIXEL_SPLAT_X4(x) ((x)*0x01010101U)
  65. #endif
  66. #if BIT_DEPTH == 8
  67. # define av_clip_pixel(a) av_clip_uint8(a)
  68. # define CLIP(a) cm[a]
  69. # define FUNC(a) a ## _8
  70. # define FUNCC(a) a ## _8_c
  71. #elif BIT_DEPTH == 9
  72. # define av_clip_pixel(a) av_clip_pixel_9(a)
  73. # define CLIP(a) av_clip_pixel_9(a)
  74. # define FUNC(a) a ## _9
  75. # define FUNCC(a) a ## _9_c
  76. #elif BIT_DEPTH == 10
  77. # define av_clip_pixel(a) av_clip_pixel_10(a)
  78. # define CLIP(a) av_clip_pixel_10(a)
  79. # define FUNC(a) a ## _10
  80. # define FUNCC(a) a ## _10_c
  81. #endif