tsdecrypt reads and decrypts CSA encrypted incoming mpeg transport stream over UDP/RTP using code words obtained from OSCAM or similar CAM server. tsdecrypt communicates with CAM server using cs378x (camd35 over tcp) protocol or newcamd protocol. https://georgi.unixsol.org/programs/tsdecrypt/
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.

parallel_128_sse.h 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* FFdecsa -- fast decsa algorithm
  2. *
  3. * Copyright (C) 2007 Dark Avenger
  4. * 2003-2004 fatih89r
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. */
  20. #include <xmmintrin.h>
  21. #define MEMALIGN __attribute__((aligned(16)))
  22. union __u128 {
  23. unsigned int u[4];
  24. __m128 v;
  25. };
  26. static const union __u128 ff0 = {{0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}};
  27. static const union __u128 ff1 = {{0xffffffffU, 0xffffffffU, 0xffffffffU, 0xffffffffU}};
  28. typedef __m128 group;
  29. #define GROUP_PARALLELISM 128
  30. #define FF0() ff0.v
  31. #define FF1() ff1.v
  32. #define FFAND(a,b) _mm_and_ps((a),(b))
  33. #define FFOR(a,b) _mm_or_ps((a),(b))
  34. #define FFXOR(a,b) _mm_xor_ps((a),(b))
  35. #define FFNOT(a) _mm_xor_ps((a),FF1())
  36. #define MALLOC(X) _mm_malloc(X,16)
  37. #define FREE(X) _mm_free(X)
  38. union __u64 {
  39. unsigned int u[2];
  40. __m64 v;
  41. };
  42. static const union __u64 ff29 = {{0x29292929U, 0x29292929U}};
  43. static const union __u64 ff02 = {{0x02020202U, 0x02020202U}};
  44. static const union __u64 ff04 = {{0x04040404U, 0x04040404U}};
  45. static const union __u64 ff10 = {{0x10101010U, 0x10101010U}};
  46. static const union __u64 ff40 = {{0x40404040U, 0x40404040U}};
  47. static const union __u64 ff80 = {{0x80808080U, 0x80808080U}};
  48. typedef __m64 batch;
  49. #define BYTES_PER_BATCH 8
  50. #define B_FFN_ALL_29() ff29.v
  51. #define B_FFN_ALL_02() ff02.v
  52. #define B_FFN_ALL_04() ff04.v
  53. #define B_FFN_ALL_10() ff10.v
  54. #define B_FFN_ALL_40() ff40.v
  55. #define B_FFN_ALL_80() ff80.v
  56. #define B_FFAND(a,b) _mm_and_si64((a),(b))
  57. #define B_FFOR(a,b) _mm_or_si64((a),(b))
  58. #define B_FFXOR(a,b) _mm_xor_si64((a),(b))
  59. #define B_FFSH8L(a,n) _mm_slli_si64((a),(n))
  60. #define B_FFSH8R(a,n) _mm_srli_si64((a),(n))
  61. #define M_EMPTY() _mm_empty()
  62. #undef XOR_8_BY
  63. #define XOR_8_BY(d,s1,s2) do { *(__m64*)d = _mm_xor_si64(*(__m64*)(s1), *(__m64*)(s2)); } while(0)
  64. #undef XOREQ_8_BY
  65. #define XOREQ_8_BY(d,s) XOR_8_BY(d, d, s)
  66. #undef COPY_8_BY
  67. #define COPY_8_BY(d,s) do { *(__m64 *)(d) = *(__m64 *)(s); } while(0)
  68. #undef BEST_SPAN
  69. #define BEST_SPAN 16
  70. #undef XOR_BEST_BY
  71. static inline void XOR_BEST_BY(unsigned char *d, unsigned char *s1, unsigned char *s2)
  72. {
  73. __m128 vs1 = _mm_load_ps((float*)s1);
  74. __m128 vs2 = _mm_load_ps((float*)s2);
  75. vs1 = _mm_xor_ps(vs1, vs2);
  76. _mm_store_ps((float*)d, vs1);
  77. }
  78. #include "fftable.h"