Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. #define CH1FILTER(src) ((6*(src)[0] + 2*(src)[1] + 4) >> 3)
  2. #define CH2FILTER(src) (( (src)[0] + (src)[1] + 1) >> 1)
  3. #define CH3FILTER(src) ((2*(src)[0] + 6*(src)[1] + 4) >> 3)
  4.  
  5. #define CV1FILTER(src, i) ((6*(src)[0] + 2*(src)[i] + 4) >> 3)
  6. #define CV2FILTER(src, i) (( (src)[0] + (src)[i] + 1) >> 1)
  7. #define CV3FILTER(src, i) ((2*(src)[0] + 6*(src)[i] + 4) >> 3)
  8.  
  9. static void bink2f_c_mc(Bink2Context *c, int x, int y,
  10. uint8_t *dst, int stride,
  11. uint8_t *src, int sstride,
  12. int width, int height,
  13. int mv_x, int mv_y,
  14. int mode)
  15. {
  16. uint8_t *msrc;
  17.  
  18. msrc = src + mv_x + mv_y * sstride;
  19.  
  20. ff_dlog(NULL, "CHROMA %d: %dx%d | %dx%d\n", mode, x, y, mv_x, mv_y);
  21. switch (mode) {
  22. case 0:
  23. case 4:
  24. case 8:
  25. case 12:
  26. copy_block8(dst, msrc, stride, sstride, 8);
  27. break;
  28. case 1:
  29. for (int j = 0; j < 8; j++) {
  30. for (int i = 0; i < 8; i++)
  31. dst[i] = av_clip_uint8(CH1FILTER(msrc + i));
  32. dst += stride;
  33. msrc += sstride;
  34. }
  35. break;
  36. case 2:
  37. for (int j = 0; j < 8; j++) {
  38. for (int i = 0; i < 8; i++)
  39. dst[i] = av_clip_uint8(CH2FILTER(msrc + i));
  40. dst += stride;
  41. msrc += sstride;
  42. }
  43. break;
  44. case 3:
  45. for (int j = 0; j < 8; j++) {
  46. for (int i = 0; i < 8; i++)
  47. dst[i] = av_clip_uint8(CH3FILTER(msrc + i));
  48. dst += stride;
  49. msrc += sstride;
  50. }
  51. break;
  52. case 5:
  53. for (int j = 0; j < 8; j++) {
  54. for (int i = 0; i < 8; i++)
  55. dst[i*stride] = av_clip_uint8(CV1FILTER(msrc + i*sstride, sstride));
  56. dst += 1;
  57. msrc += 1;
  58. }
  59. break;
  60. case 6:
  61. for (int j = 0; j < 8; j++) {
  62. for (int i = 0; i < 8; i++)
  63. dst[i*stride] = av_clip_uint8(CV2FILTER(msrc + i*sstride, sstride));
  64. dst += 1;
  65. msrc += 1;
  66. }
  67. break;
  68. case 7:
  69. for (int j = 0; j < 8; j++) {
  70. for (int i = 0; i < 8; i++)
  71. dst[i*stride] = av_clip_uint8(CV3FILTER(msrc + i*sstride, sstride));
  72. dst += 1;
  73. msrc += 1;
  74. }
  75. }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement