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_sse2.h 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 <emmintrin.h>
  21. #define MEMALIGN __attribute__((aligned(16)))
  22. union __u128i {
  23. unsigned int u[4];
  24. __m128i v;
  25. };
  26. static const union __u128i ff0 = {{0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U}};
  27. static const union __u128i ff1 = {{0xffffffffU, 0xffffffffU, 0xffffffffU, 0xffffffffU}};
  28. typedef __m128i group;
  29. #define GROUP_PARALLELISM 128
  30. #define FF0() ff0.v
  31. #define FF1() ff1.v
  32. #define FFAND(a,b) _mm_and_si128((a),(b))
  33. #define FFOR(a,b) _mm_or_si128((a),(b))
  34. #define FFXOR(a,b) _mm_xor_si128((a),(b))
  35. #define FFNOT(a) _mm_xor_si128((a),FF1())
  36. #define MALLOC(X) _mm_malloc(X,16)
  37. #define FREE(X) _mm_free(X)
  38. /* BATCH */
  39. static const union __u128i ff29 = {{0x29292929U, 0x29292929U, 0x29292929U, 0x29292929U}};
  40. static const union __u128i ff02 = {{0x02020202U, 0x02020202U, 0x02020202U, 0x02020202U}};
  41. static const union __u128i ff04 = {{0x04040404U, 0x04040404U, 0x04040404U, 0x04040404U}};
  42. static const union __u128i ff10 = {{0x10101010U, 0x10101010U, 0x10101010U, 0x10101010U}};
  43. static const union __u128i ff40 = {{0x40404040U, 0x40404040U, 0x40404040U, 0x40404040U}};
  44. static const union __u128i ff80 = {{0x80808080U, 0x80808080U, 0x80808080U, 0x80808080U}};
  45. typedef __m128i batch;
  46. #define BYTES_PER_BATCH 16
  47. #define B_FFN_ALL_29() ff29.v
  48. #define B_FFN_ALL_02() ff02.v
  49. #define B_FFN_ALL_04() ff04.v
  50. #define B_FFN_ALL_10() ff10.v
  51. #define B_FFN_ALL_40() ff40.v
  52. #define B_FFN_ALL_80() ff80.v
  53. #define B_FFAND(a,b) FFAND(a,b)
  54. #define B_FFOR(a,b) FFOR(a,b)
  55. #define B_FFXOR(a,b) FFXOR(a,b)
  56. #define B_FFSH8L(a,n) _mm_slli_epi64((a),(n))
  57. #define B_FFSH8R(a,n) _mm_srli_epi64((a),(n))
  58. #define M_EMPTY()
  59. #undef BEST_SPAN
  60. #define BEST_SPAN 16
  61. #undef XOR_BEST_BY
  62. static inline void XOR_BEST_BY(unsigned char *d, unsigned char *s1, unsigned char *s2)
  63. {
  64. __m128i vs1 = _mm_load_si128((__m128i*)s1);
  65. __m128i vs2 = _mm_load_si128((__m128i*)s2);
  66. vs1 = _mm_xor_si128(vs1, vs2);
  67. _mm_store_si128((__m128i*)d, vs1);
  68. }
  69. #include "fftable.h"