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
3.2KB

  1. /*
  2. * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
  3. * Copyright (c) 2003-2010 Michael Niedermayer <michaelni@gmx.at>
  4. *
  5. * This file is part of Libav.
  6. *
  7. * Libav is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * Libav is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with Libav; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #include "h264qpel.h"
  22. #define BIT_DEPTH 8
  23. #include "h264qpel_template.c"
  24. #undef BIT_DEPTH
  25. #define BIT_DEPTH 9
  26. #include "h264qpel_template.c"
  27. #undef BIT_DEPTH
  28. #define BIT_DEPTH 10
  29. #include "h264qpel_template.c"
  30. #undef BIT_DEPTH
  31. void ff_h264qpel_init(H264QpelContext *c, int bit_depth)
  32. {
  33. #undef FUNCC
  34. #define FUNCC(f, depth) f ## _ ## depth ## _c
  35. #define dspfunc2(PFX, IDX, NUM, depth) \
  36. c->PFX ## _pixels_tab[IDX][ 0] = FUNCC(PFX ## NUM ## _mc00, depth); \
  37. c->PFX ## _pixels_tab[IDX][ 1] = FUNCC(PFX ## NUM ## _mc10, depth); \
  38. c->PFX ## _pixels_tab[IDX][ 2] = FUNCC(PFX ## NUM ## _mc20, depth); \
  39. c->PFX ## _pixels_tab[IDX][ 3] = FUNCC(PFX ## NUM ## _mc30, depth); \
  40. c->PFX ## _pixels_tab[IDX][ 4] = FUNCC(PFX ## NUM ## _mc01, depth); \
  41. c->PFX ## _pixels_tab[IDX][ 5] = FUNCC(PFX ## NUM ## _mc11, depth); \
  42. c->PFX ## _pixels_tab[IDX][ 6] = FUNCC(PFX ## NUM ## _mc21, depth); \
  43. c->PFX ## _pixels_tab[IDX][ 7] = FUNCC(PFX ## NUM ## _mc31, depth); \
  44. c->PFX ## _pixels_tab[IDX][ 8] = FUNCC(PFX ## NUM ## _mc02, depth); \
  45. c->PFX ## _pixels_tab[IDX][ 9] = FUNCC(PFX ## NUM ## _mc12, depth); \
  46. c->PFX ## _pixels_tab[IDX][10] = FUNCC(PFX ## NUM ## _mc22, depth); \
  47. c->PFX ## _pixels_tab[IDX][11] = FUNCC(PFX ## NUM ## _mc32, depth); \
  48. c->PFX ## _pixels_tab[IDX][12] = FUNCC(PFX ## NUM ## _mc03, depth); \
  49. c->PFX ## _pixels_tab[IDX][13] = FUNCC(PFX ## NUM ## _mc13, depth); \
  50. c->PFX ## _pixels_tab[IDX][14] = FUNCC(PFX ## NUM ## _mc23, depth); \
  51. c->PFX ## _pixels_tab[IDX][15] = FUNCC(PFX ## NUM ## _mc33, depth)
  52. #define SET_QPEL(depth) \
  53. dspfunc2(put_h264_qpel, 0, 16, depth); \
  54. dspfunc2(put_h264_qpel, 1, 8, depth); \
  55. dspfunc2(put_h264_qpel, 2, 4, depth); \
  56. dspfunc2(put_h264_qpel, 3, 2, depth); \
  57. dspfunc2(avg_h264_qpel, 0, 16, depth); \
  58. dspfunc2(avg_h264_qpel, 1, 8, depth); \
  59. dspfunc2(avg_h264_qpel, 2, 4, depth)
  60. switch (bit_depth) {
  61. default:
  62. SET_QPEL(8);
  63. break;
  64. case 9:
  65. SET_QPEL(9);
  66. break;
  67. case 10:
  68. SET_QPEL(10);
  69. break;
  70. }
  71. if (ARCH_ARM)
  72. ff_h264qpel_init_arm(c, bit_depth);
  73. if (ARCH_PPC)
  74. ff_h264qpel_init_ppc(c, bit_depth);
  75. if (ARCH_X86)
  76. ff_h264qpel_init_x86(c, bit_depth);
  77. }