vf_fspp.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
  3. * Copyright (C) 2005 Nikolaj Poroshin <porosh3@psu.ru>
  4. * Copyright (c) 2014 Arwa Arif <arwaarif1994@gmail.com>
  5. *
  6. * This file is part of FFmpeg.
  7. *
  8. * FFmpeg is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * FFmpeg 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
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along
  19. * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
  20. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  21. */
  22. #ifndef AVFILTER_FSPP_H
  23. #define AVFILTER_FSPP_H
  24. #include "avfilter.h"
  25. #define BLOCKSZ 12
  26. #define MAX_LEVEL 5
  27. #define DCTSIZE 8
  28. #define DCTSIZE_S "8"
  29. #define FIX(x,s) ((x) * (1 << s) + 0.5)
  30. #define MULTIPLY16H(x,k) (((x) * (k)) >> 16)
  31. #define THRESHOLD(r,x,t) \
  32. if(((unsigned)((x) + t)) > t * 2) r = (x); \
  33. else r = 0;
  34. #define DESCALE(x,n) (((x) + (1 << ((n) - 1))) >> n)
  35. typedef int32_t int_simd16_t;
  36. static const int16_t FIX_0_382683433 = FIX(0.382683433, 14);
  37. static const int16_t FIX_0_541196100 = FIX(0.541196100, 14);
  38. static const int16_t FIX_0_707106781 = FIX(M_SQRT1_2 , 14);
  39. static const int16_t FIX_1_306562965 = FIX(1.306562965, 14);
  40. static const int16_t FIX_1_414213562_A = FIX(M_SQRT2 , 14);
  41. static const int16_t FIX_1_847759065 = FIX(1.847759065, 13);
  42. static const int16_t FIX_2_613125930 = FIX(-2.613125930, 13);
  43. static const int16_t FIX_1_414213562 = FIX(M_SQRT2 , 13);
  44. static const int16_t FIX_1_082392200 = FIX(1.082392200, 13);
  45. typedef struct FSPPContext {
  46. AVClass *class;
  47. uint64_t threshold_mtx_noq[8 * 2];
  48. uint64_t threshold_mtx[8 * 2]; //used in both C & MMX (& later SSE2) versions
  49. int log2_count;
  50. int strength;
  51. int hsub;
  52. int vsub;
  53. int temp_stride;
  54. int qp;
  55. int qscale_type;
  56. int prev_q;
  57. uint8_t *src;
  58. int16_t *temp;
  59. uint8_t *non_b_qp_table;
  60. int non_b_qp_alloc_size;
  61. int use_bframe_qp;
  62. void (*store_slice)(uint8_t *dst, int16_t *src,
  63. ptrdiff_t dst_stride, ptrdiff_t src_stride,
  64. ptrdiff_t width, ptrdiff_t height, ptrdiff_t log2_scale);
  65. void (*store_slice2)(uint8_t *dst, int16_t *src,
  66. ptrdiff_t dst_stride, ptrdiff_t src_stride,
  67. ptrdiff_t width, ptrdiff_t height, ptrdiff_t log2_scale);
  68. void (*mul_thrmat)(int16_t *thr_adr_noq, int16_t *thr_adr, int q);
  69. void (*column_fidct)(int16_t *thr_adr, int16_t *data,
  70. int16_t *output, int cnt);
  71. void (*row_idct)(int16_t *workspace, int16_t *output_adr,
  72. ptrdiff_t output_stride, int cnt);
  73. void (*row_fdct)(int16_t *data, const uint8_t *pixels,
  74. ptrdiff_t line_size, int cnt);
  75. } FSPPContext;
  76. void ff_fspp_init_x86(FSPPContext *fspp);
  77. #endif /* AVFILTER_FSPP_H */