changeset 1308:98e270096355 libavcodec

some useful warning
author nickols_k
date Mon, 16 Jun 2003 08:28:43 +0000
parents 26bed13dd48d
children 0cfdbbf84a6c
files ra288.c
diffstat 1 files changed, 19 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ra288.c	Sun Jun 15 00:15:57 2003 +0000
+++ b/ra288.c	Mon Jun 16 08:28:43 2003 +0000
@@ -406,33 +406,46 @@
     int h=((short*)(avctx->extradata))[1];
     int cfs=((short*)(avctx->extradata))[3]; /* coded frame size */
     int i,j;
-    if(buf_size<w*h) goto no_interleave;
+    if(buf_size<w*h)
+    {
+	fprintf(stderr,"ffra288: warning! Context was not interleaved [%d<%d]\n",buf_size,w*h);
+	goto no_interleave;
+    }
     bp = buf;
     for (j = 0; j < h; j++)
 	for (i = 0; i < h/2; i++)
 	{
 	    memcpy(&b[i*2*w+j*cfs], bp, cfs);
 	    bp += cfs;
-	    if(bp-buf>=buf_size) break;
+	    if(bp-buf>buf_size)
+	    {
+		fprintf(stderr,"ffra288: warning! Context was partly interleaved [%d<%d]\n",buf_size,w*h);
+		break;
+	    }
 	}
     bret=bp-buf;
     bp = b;
   }
-  else { no_interleave: bret=buf_size; bp = buf; }
+  else
+  { 
+    fprintf(stderr,"ffra288: warning! Context was not interleaved [%d<%d]\n",avctx->extradata_size,6);
+    no_interleave:
+    bret=buf_size;
+    bp = buf; 
+  }
   datao = data;
   z=0;
   while(z<bret)
   {
-    unpack(buffer,bp,32);
+    unpack(buffer,&bp[z],32);
     for (x=0;x<32;x++)
     {
 	glob->phasep=(glob->phase=x&7)*5;
 	decode(glob,buffer[x]);
-	for (y=0;y<5;y++) *(((int16_t *)data)++)=8*glob->output[glob->phasep+y];
+	for (y=0;y<5;*(((int16_t *)data)++)=8*glob->output[glob->phasep+(y++)]);
 	if (glob->phase==3) update(glob);
     }
     z+=32;
-    bp+=32;
   }
   *data_size = data - datao;
   return bret;