[vlc-devel] [PATCH 11/16] stream cipher: use the same buffer for input and output

glenvt18 glenvt18 at gmail.com
Fri Jun 26 13:20:05 CEST 2015


---
 src/dvbcsa_bs_stream.c          | 2 +-
 src/dvbcsa_bs_stream_kernel.h   | 1 -
 src/dvbcsa_bs_stream_kernel.inc | 8 ++++++--
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/dvbcsa_bs_stream.c b/src/dvbcsa_bs_stream.c
index 41c0099..72b6c33 100644
--- a/src/dvbcsa_bs_stream.c
+++ b/src/dvbcsa_bs_stream.c
@@ -80,7 +80,7 @@ dvbcsa_bs_stream_cipher_batch(const struct dvbcsa_bs_key_s *key,
   for (h = 8; h < maxlen; h += 8)
     {
       dvbcsa_bs_stream_cipher_kernel(&regs);
-      dvbcsa_bs_stream_transpose_out(pcks, h, regs.cb);
+      dvbcsa_bs_stream_transpose_out(pcks, h, regs.sb);
     }
 
 }
diff --git a/src/dvbcsa_bs_stream_kernel.h b/src/dvbcsa_bs_stream_kernel.h
index b582028..88437f4 100644
--- a/src/dvbcsa_bs_stream_kernel.h
+++ b/src/dvbcsa_bs_stream_kernel.h
@@ -13,7 +13,6 @@ struct dvbcsa_bs_stream_regs_s {
   dvbcsa_bs_word_t E[4];
   dvbcsa_bs_word_t F[4];
   dvbcsa_bs_word_t sb[64];
-  dvbcsa_bs_word_t cb[64];
   dvbcsa_bs_word_t p;
   dvbcsa_bs_word_t q;
   dvbcsa_bs_word_t r;
diff --git a/src/dvbcsa_bs_stream_kernel.inc b/src/dvbcsa_bs_stream_kernel.inc
index 693a351..7aea582 100644
--- a/src/dvbcsa_bs_stream_kernel.inc
+++ b/src/dvbcsa_bs_stream_kernel.inc
@@ -239,11 +239,15 @@ dvbcsa_bs_stream_cipher_kernel(struct dvbcsa_bs_stream_regs_s *regs)
           A--;
           B--;
 
+#ifndef DVBCSA_BS_STREAM_KERNEL_INIT
+
           // require 4 loops per output byte
           // 2 output bits are a function of the 4 bits of D
           // xor 2 by 2
-          regs->cb[i * 8 + 7 - 2 * j] = BS_XOR (regs->D[2], regs->D[3]);
-          regs->cb[i * 8 + 6 - 2 * j] = BS_XOR (regs->D[0], regs->D[1]);
+          regs->sb[i * 8 + 7 - 2 * j] = BS_XOR (regs->D[2], regs->D[3]);
+          regs->sb[i * 8 + 6 - 2 * j] = BS_XOR (regs->D[0], regs->D[1]);
+
+#endif
         }  // INTERNAL LOOP
     }   // EXTERNAL LOOP
 
-- 
1.9.1




More information about the vlc-devel mailing list