[MPlayer-cvslog] r31925 - trunk/stream/stream_bd.c

reimar subversion at mplayerhq.hu
Wed Aug 4 15:32:20 CEST 2010


Author: reimar
Date: Wed Aug  4 15:32:20 2010
New Revision: 31925

Log:
Minor optimization/simplification and document the alignment requirements

Modified:
   trunk/stream/stream_bd.c

Modified: trunk/stream/stream_bd.c
==============================================================================
--- trunk/stream/stream_bd.c	Wed Aug  4 15:27:19 2010	(r31924)
+++ trunk/stream/stream_bd.c	Wed Aug  4 15:32:20 2010	(r31925)
@@ -249,6 +249,7 @@ static int bd_get_uks(struct bd_priv *bd
     return 1;
 }
 
+// NOTE: we assume buf is sufficiently aligned to 64 bit read/writes
 static off_t bd_read(struct bd_priv *bd, uint8_t *buf, int len)
 {
     int read_len;
@@ -268,7 +269,6 @@ static off_t bd_read(struct bd_priv *bd,
     } else {
         // reset aes context as at start of unit
         key enc_seed;
-        int i;
         bd->iv = BD_CBC_IV;
 
         // set up AES key from uk and seed
@@ -278,8 +278,8 @@ static off_t bd_read(struct bd_priv *bd,
         av_aes_crypt(bd->aeseed, enc_seed.u8, buf, 1, NULL, 0);
 
         // perform xor
-        for (i = 0; i < 16; i++)
-            enc_seed.u8[i] ^= buf[i];
+        enc_seed.u64[0] ^= AV_RN64A(buf);
+        enc_seed.u64[1] ^= AV_RN64A(buf + 8);
 
         // set uk AES-CBC key from enc_seed and BD_CBC_IV
         av_aes_init(bd->aescbc, enc_seed.u8, 128, 1);


More information about the MPlayer-cvslog mailing list