changeset 15553:43af13780751

Speedup asf descrambling (avoid one memcpy and use our fastmemcpy).
author reimar
date Mon, 23 May 2005 16:20:46 +0000
parents 7867e143a557
children e93d0faac02b
files libmpdemux/demux_asf.c
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_asf.c	Mon May 23 16:17:40 2005 +0000
+++ b/libmpdemux/demux_asf.c	Mon May 23 16:20:46 2005 +0000
@@ -12,6 +12,7 @@
 #include "asf.h"
 #include "demuxer.h"
 
+#include "../libvo/fastmemcpy.h"
 
 /*
  * Load 16/32-bit values in little endian byte order
@@ -40,9 +41,9 @@
 
 // based on asf file-format doc by Eugene [http://divx.euro.ru]
 
-static void asf_descrambling(unsigned char *src,int len){
+static void asf_descrambling(unsigned char **src,int len){
   unsigned char *dst=malloc(len);
-  unsigned char *s2=src;
+  unsigned char *s2=*src;
   int i=0,x,y;
   while(len-i>=asf_scrambling_h*asf_scrambling_w*asf_scrambling_b){
 //    mp_msg(MSGT_DEMUX,MSGL_DBG4,"descrambling! (w=%d  b=%d)\n",w,asf_scrambling_b);
@@ -55,8 +56,8 @@
 	s2+=asf_scrambling_h*asf_scrambling_w*asf_scrambling_b;
   }
   //if(i<len) memcpy(dst+i,src+i,len-i);
-  memcpy(src,dst,i);
-  free(dst);
+  free(*src);
+  *src = dst;
 }
 
 
@@ -96,7 +97,7 @@
         // closed segment, finalize packet:
 		if(ds==demux->audio)
 		  if(asf_scrambling_h>1 && asf_scrambling_w>1)
-		    asf_descrambling(ds->asf_packet->buffer,ds->asf_packet->len);
+		    asf_descrambling(&ds->asf_packet->buffer,ds->asf_packet->len);
         ds_add_packet(ds,ds->asf_packet);
         ds->asf_packet=NULL;
       } else {