vp6dsp.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * @file libavcodec/vp6dsp.c
  3. * VP6 DSP-oriented functions
  4. *
  5. * Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org>
  6. *
  7. * This file is part of FFmpeg.
  8. *
  9. * FFmpeg is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2.1 of the License, or (at your option) any later version.
  13. *
  14. * FFmpeg is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with FFmpeg; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. */
  23. #include "libavutil/common.h"
  24. #include "dsputil.h"
  25. void ff_vp6_filter_diag4_c(uint8_t *dst, uint8_t *src, int stride,
  26. const int16_t *h_weights, const int16_t *v_weights)
  27. {
  28. int x, y;
  29. int tmp[8*11];
  30. int *t = tmp;
  31. src -= stride;
  32. for (y=0; y<11; y++) {
  33. for (x=0; x<8; x++) {
  34. t[x] = av_clip_uint8(( src[x-1] * h_weights[0]
  35. + src[x ] * h_weights[1]
  36. + src[x+1] * h_weights[2]
  37. + src[x+2] * h_weights[3] + 64) >> 7);
  38. }
  39. src += stride;
  40. t += 8;
  41. }
  42. t = tmp + 8;
  43. for (y=0; y<8; y++) {
  44. for (x=0; x<8; x++) {
  45. dst[x] = av_clip_uint8(( t[x-8 ] * v_weights[0]
  46. + t[x ] * v_weights[1]
  47. + t[x+8 ] * v_weights[2]
  48. + t[x+16] * v_weights[3] + 64) >> 7);
  49. }
  50. dst += stride;
  51. t += 8;
  52. }
  53. }