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.

54 lines
1.7KB

  1. /*
  2. * Copyright (c) 2006 Michael Benjamin
  3. *
  4. * This library 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 of the License, or (at your option) any later version.
  8. *
  9. * This library 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 this library; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #include "../avcodec.h"
  19. #include "../dsputil.h"
  20. static int sad8x8_bfin( void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h )
  21. {
  22. int sum;
  23. __asm__ __volatile__ (
  24. "P0 = %1;" // blk1
  25. "P1 = %2;" // blk2
  26. "P2 = %3;\n" // h
  27. "I0 = P0;"
  28. "I1 = P1;\n"
  29. "A0 = 0;"
  30. "A1 = 0;\n"
  31. "M0 = P2;\n"
  32. "P3 = 32;\n"
  33. "LSETUP (sad8x8LoopBegin, sad8x8LoopEnd) LC0=P3;\n"
  34. "sad8x8LoopBegin:\n"
  35. " DISALGNEXCPT || R0 = [I0] || R2 = [I1];\n"
  36. " DISALGNEXCPT || R1 = [I0++] || R3 = [I1++];\n"
  37. "sad8x8LoopEnd:\n"
  38. " SAA ( R1:0 , R3:2 );\n"
  39. "R3 = A1.L + A1.H, R2 = A0.L + A0.H;\n"
  40. "%0 = R2 + R3 (S);\n"
  41. : "=&d" (sum)
  42. : "m"(blk1), "m"(blk2), "m"(h)
  43. : "P0","P1","P2","I0","I1","A0","A1","R0","R1","R2","R3");
  44. return sum;
  45. }
  46. void dsputil_init_bfin( DSPContext* c, AVCodecContext *avctx )
  47. {
  48. c->pix_abs[1][0] = sad8x8_bfin;
  49. c->sad[1] = sad8x8_bfin;
  50. }