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.

75 lines
1.9KB

  1. /*
  2. * This file is part of Libav.
  3. *
  4. * Libav 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. * Libav 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 Libav; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #include <stdint.h>
  19. #include <string.h>
  20. #include "config.h"
  21. #include "libavutil/attributes.h"
  22. #include "blockdsp.h"
  23. static void clear_block_8_c(int16_t *block)
  24. {
  25. memset(block, 0, sizeof(int16_t) * 64);
  26. }
  27. static void clear_blocks_8_c(int16_t *blocks)
  28. {
  29. memset(blocks, 0, sizeof(int16_t) * 6 * 64);
  30. }
  31. static void fill_block16_c(uint8_t *block, uint8_t value, ptrdiff_t line_size,
  32. int h)
  33. {
  34. int i;
  35. for (i = 0; i < h; i++) {
  36. memset(block, value, 16);
  37. block += line_size;
  38. }
  39. }
  40. static void fill_block8_c(uint8_t *block, uint8_t value, ptrdiff_t line_size,
  41. int h)
  42. {
  43. int i;
  44. for (i = 0; i < h; i++) {
  45. memset(block, value, 8);
  46. block += line_size;
  47. }
  48. }
  49. av_cold void ff_blockdsp_init(BlockDSPContext *c)
  50. {
  51. c->clear_block = clear_block_8_c;
  52. c->clear_blocks = clear_blocks_8_c;
  53. c->fill_block_tab[0] = fill_block16_c;
  54. c->fill_block_tab[1] = fill_block8_c;
  55. if (ARCH_ARM)
  56. ff_blockdsp_init_arm(c);
  57. if (ARCH_PPC)
  58. ff_blockdsp_init_ppc(c);
  59. if (ARCH_X86)
  60. ff_blockdsp_init_x86(c);
  61. }