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.

97 lines
3.3KB

  1. /*
  2. * DSP utils
  3. * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  4. * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
  5. *
  6. * This file is part of Libav.
  7. *
  8. * Libav is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * Libav is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with Libav; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. */
  22. /**
  23. * @file
  24. * DSP utils.
  25. * Note, many functions in here may use MMX which trashes the FPU state, it is
  26. * absolutely necessary to call emms_c() between DSP & float/double code.
  27. */
  28. #ifndef AVCODEC_DSPUTIL_H
  29. #define AVCODEC_DSPUTIL_H
  30. #include "avcodec.h"
  31. extern uint32_t ff_square_tab[512];
  32. struct MpegEncContext;
  33. /* Motion estimation:
  34. * h is limited to { width / 2, width, 2 * width },
  35. * but never larger than 16 and never smaller than 2.
  36. * Although currently h < 4 is not used as functions with
  37. * width < 8 are neither used nor implemented. */
  38. typedef int (*me_cmp_func)(struct MpegEncContext *c,
  39. uint8_t *blk1 /* align width (8 or 16) */,
  40. uint8_t *blk2 /* align 1 */, int line_size, int h);
  41. /**
  42. * DSPContext.
  43. */
  44. typedef struct DSPContext {
  45. /* pixel ops : interface with DCT */
  46. void (*get_pixels)(int16_t *block /* align 16 */,
  47. const uint8_t *pixels /* align 8 */,
  48. int line_size);
  49. void (*diff_pixels)(int16_t *block /* align 16 */,
  50. const uint8_t *s1 /* align 8 */,
  51. const uint8_t *s2 /* align 8 */,
  52. int stride);
  53. int (*sum_abs_dctelem)(int16_t *block /* align 16 */);
  54. me_cmp_func sad[6]; /* identical to pix_absAxA except additional void * */
  55. me_cmp_func sse[6];
  56. me_cmp_func hadamard8_diff[6];
  57. me_cmp_func dct_sad[6];
  58. me_cmp_func quant_psnr[6];
  59. me_cmp_func bit[6];
  60. me_cmp_func rd[6];
  61. me_cmp_func vsad[6];
  62. me_cmp_func vsse[6];
  63. me_cmp_func nsse[6];
  64. me_cmp_func dct_max[6];
  65. me_cmp_func dct264_sad[6];
  66. me_cmp_func me_pre_cmp[6];
  67. me_cmp_func me_cmp[6];
  68. me_cmp_func me_sub_cmp[6];
  69. me_cmp_func mb_cmp[6];
  70. me_cmp_func ildct_cmp[6]; // only width 16 used
  71. me_cmp_func frame_skip_cmp[6]; // only width 8 used
  72. me_cmp_func pix_abs[2][4];
  73. } DSPContext;
  74. void ff_dsputil_static_init(void);
  75. void ff_dsputil_init(DSPContext *p, AVCodecContext *avctx);
  76. void ff_set_cmp(DSPContext *c, me_cmp_func *cmp, int type);
  77. void ff_dsputil_init_arm(DSPContext *c, AVCodecContext *avctx,
  78. unsigned high_bit_depth);
  79. void ff_dsputil_init_ppc(DSPContext *c, AVCodecContext *avctx,
  80. unsigned high_bit_depth);
  81. void ff_dsputil_init_x86(DSPContext *c, AVCodecContext *avctx,
  82. unsigned high_bit_depth);
  83. #endif /* AVCODEC_DSPUTIL_H */