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.

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