[xiph-commits] r14070 - in trunk/theora/lib: . dec enc

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Tue Oct 30 14:34:52 PDT 2007


Author: xiphmont
Date: 2007-10-30 14:34:52 -0700 (Tue, 30 Oct 2007)
New Revision: 14070

Modified:
   trunk/theora/lib/dec/decode.c
   trunk/theora/lib/dec/state.c
   trunk/theora/lib/enc/dct_decode.c
   trunk/theora/lib/internal.h
Log:
More debugging output code (disabled by default)


Modified: trunk/theora/lib/dec/decode.c
===================================================================
--- trunk/theora/lib/dec/decode.c	2007-10-30 17:52:28 UTC (rev 14069)
+++ trunk/theora/lib/dec/decode.c	2007-10-30 21:34:52 UTC (rev 14070)
@@ -1664,6 +1664,40 @@
   _pipe->uncoded_fragis[_pli]-=_pipe->nuncoded_fragis[_pli];
   oc_state_frag_copy(&_dec->state,_pipe->uncoded_fragis[_pli],
    _pipe->nuncoded_fragis[_pli],OC_FRAME_SELF,OC_FRAME_PREV,_pli);
+
+#ifdef _TH_DEBUG_
+  {
+    int i,j,k;
+    int framei=_dec->state.ref_frame_idx[OC_FRAME_SELF];
+    int ystride=_dec->state.ref_frame_bufs[framei][_pli].ystride;
+    int *fragi_end = _pipe->coded_fragis[_pli];
+    int *fragi = fragi_end-_pipe->ncoded_fragis[_pli];
+
+    for(;fragi<fragi_end;fragi++){
+      oc_fragment   *frag=_dec->state.frags+*fragi;
+      unsigned char *src=frag->buffer[framei];
+      for(i=0,j=0;j<8;j++){
+	for(k=0;k<8;k++,i++)
+	  frag->recon[i] = src[k];
+	src+=ystride;
+      }
+    }
+
+    fragi = _pipe->uncoded_fragis[_pli];
+    fragi_end = fragi+_pipe->nuncoded_fragis[_pli];
+
+    for(;fragi<fragi_end;fragi++){
+      oc_fragment   *frag=_dec->state.frags+*fragi;
+      unsigned char *src=frag->buffer[framei];
+      for(i=0,j=0;j<8;j++){
+	for(k=0;k<8;k++,i++)
+	  frag->recon[i] = src[k];
+	src+=ystride;
+      }
+    }
+  }
+#endif
+    
 }
 
 /*Filter a horizontal block edge.*/
@@ -2287,54 +2321,51 @@
 	for(y=0;y<yn;y++){
 	  for(x=0;x<xn;x++,i++){
 	    
-	    for(buf=0;buf<3;buf++){
+	    for(buf=0;buf<4;buf++){
 	      int *ptr;
 	      char *bufn;
-	      
+	      int codecheck=0;
+
 	      i = offset + y*xn + x;
 
 	      switch(buf){
 	      case 0:
+		codecheck=1;
 		bufn = "coded";
 		ptr = _dec->state.frags[i].quant;
 		break;
 	      case 1:
+		codecheck=1;
 		bufn = "coeff";
 		ptr = _dec->state.frags[i].freq;
 		break;
 	      case 2:
-		bufn = "recon";
+		codecheck=1;
+		bufn = "idct";
 		ptr = _dec->state.frags[i].time;
 		break;
+	      case 3:
+		bufn = "recon";
+		ptr = _dec->state.frags[i].loop;
+		break;
 	      }
 	      
 	      
 	      TH_DEBUG("%s %s [%d][%d] = {",bufn,plstr,x,y);
-	      if(!_dec->state.frags[i].coded)
+	      if(codecheck && !_dec->state.frags[i].coded)
 		TH_DEBUG(" not coded }\n");
 	      else{
 		int l=0;
 		for(j=0;j<8;j++){
 		  TH_DEBUG("\n   ");
 		  for(k=0;k<8;k++,l++){
-		    TH_DEBUG("%d ",
-			     (unsigned int)abs(ptr[l]));
+		    TH_DEBUG("%d ",ptr[l]);
 		  }
 		}
 		TH_DEBUG(" }\n");
 	      }
 	    }
-	    
-	    /* and the loop filter output, which is a flat struct */
-	    TH_DEBUG("loop %s [%d][%d] = {",plstr,x,y);
-	    for(j=0;j<8;j++){
-	      int l = (y*8+j)*(xn*8) + x*8;
-	      TH_DEBUG("\n   ");
-	      for(k=0;k<8;k++,l++)
-		TH_DEBUG("%d ", _dec->state.loop_debug[plane].data[l]);
-	      
-	    }
-	    TH_DEBUG(" }\n\n");
+	    TH_DEBUG("\n");
 	  }
 	}
       }

Modified: trunk/theora/lib/dec/state.c
===================================================================
--- trunk/theora/lib/dec/state.c	2007-10-30 17:52:28 UTC (rev 14069)
+++ trunk/theora/lib/dec/state.c	2007-10-30 21:34:52 UTC (rev 14070)
@@ -515,35 +515,10 @@
   _state->ref_frame_idx[OC_FRAME_GOLD]=
    _state->ref_frame_idx[OC_FRAME_PREV]=
    _state->ref_frame_idx[OC_FRAME_SELF]=-1;
-
-#ifdef _TH_DEBUG_
-  _state->loop_debug[0].width = info->frame_width;
-  _state->loop_debug[0].height = info->frame_height;
-  _state->loop_debug[0].ystride = yhstride;
-  _state->loop_debug[0].data = malloc(yplane_sz);
-
-  _state->loop_debug[1].width = 
-    _state->loop_debug[2].width = 
-    info->frame_width>>!(info->pixel_fmt&1);
-  _state->loop_debug[1].height =
-    _state->loop_debug[2].height =
-    info->frame_height>>!(info->pixel_fmt&2);
-  _state->loop_debug[1].ystride = 
-    _state->loop_debug[2].ystride = chstride;
-  _state->loop_debug[1].data = malloc(cplane_sz);
-  _state->loop_debug[2].data = malloc(cplane_sz);
-
-#endif
 }
 
 static void oc_state_ref_bufs_clear(oc_theora_state *_state){
   _ogg_free(_state->ref_frame_data);
-
-#ifdef _TH_DEBUG_
-  _ogg_free(_state->loop_debug[0].data);
-  _ogg_free(_state->loop_debug[1].data);
-  _ogg_free(_state->loop_debug[2].data);
-#endif
 }
 
 
@@ -1112,20 +1087,50 @@
            iplane->ystride,_bv);
         }
       }
+
+
+#ifdef _TH_DEBUG_
+      {
+	int i,j,k,l;
+	unsigned char *src;
+	
+	for(l=0;l<5;l++){
+	  oc_fragment *f;
+	  switch(l){
+	  case 0: 
+	    f = frag;
+	    break;
+	  case 1: /* left */
+	    if(frag == frag0)continue;
+	    f = frag-1;
+	    break;
+	  case 2: /* bottom (top once flipped) */
+	    if(frag0 == frag_top)continue;
+	    f = frag - fplane->nhfrags;
+	    break;
+	  case 3: /* right */
+	    if(frag+1 >= frag_end) continue;
+	    f = frag + 1;
+	    break;
+	  case 4: /* top (bottom once flipped) */
+	    if(frag+fplane->nhfrags >= frag_bot)continue;
+	    f = frag + fplane->nhfrags;
+	    break;
+	  }
+	  
+	  src = f->buffer[_refi];
+	  for(i=0,j=0;j<8;j++){
+	    for(k=0;k<8;k++,i++)
+	      f->loop[i] = src[k];
+	    src+=iplane->ystride;
+	  }
+	}
+      }
+#endif
       frag++;
     }
     frag0+=fplane->nhfrags;
   }
-
-#ifdef _TH_DEBUG_
-  int offset = _fragy0*fplane->nhfrags*8;
-  int len = (_fragy_end-_fragy0)*fplane->nhfrags*8*8;
-  memcpy(_state->loop_debug[_pli].data+offset, 
-	 _state->ref_frame_bufs[_refi][_pli].data+offset,
-	 len);
-#endif
-
-
 }
 
 #if defined(OC_DUMP_IMAGES)

Modified: trunk/theora/lib/enc/dct_decode.c
===================================================================
--- trunk/theora/lib/enc/dct_decode.c	2007-10-30 17:52:28 UTC (rev 14069)
+++ trunk/theora/lib/enc/dct_decode.c	2007-10-30 21:34:52 UTC (rev 14070)
@@ -127,7 +127,6 @@
   /* Get the pixel index for the first pixel in the fragment. */
   dsp_recon_intra8x8 (pbi->dsp, (unsigned char *)(&pbi->ThisFrameRecon[ReconPixelIndex]),
               (ogg_int16_t *)pbi->ReconDataBuffer, ReconPixelsPerLine);
-
 }
 
 static void ExpandBlock ( PB_INSTANCE *pbi, ogg_int32_t FragmentNumber){
@@ -1207,7 +1206,7 @@
 
 #ifdef _TH_DEBUG_
     {
-      int x,y,i,j,k,xn,yn;
+      int x,y,i,j,k,xn,yn,stride;
       int plane;
       int buf;
 
@@ -1221,12 +1220,14 @@
 	  xn = pbi->HFragments;
 	  yn = pbi->VFragments;
 	  offset = 0; 
+	  stride = pbi->YStride;
 	  break;
 	case 1:
 	  plstr="U";
 	  xn = pbi->HFragments>>1;
 	  yn = pbi->VFragments>>1;
-	  offset = pbi->VFragments * pbi->HFragments;
+	  offset = pbi->VFragments * pbi->HFragments;	
+	  stride = pbi->UVStride;
 	  break;
 	case 2:
 	  plstr="V";
@@ -1234,6 +1235,7 @@
 	  yn = pbi->VFragments>>1;
 	  offset = pbi->VFragments * pbi->HFragments + 
 	    ((pbi->VFragments * pbi->HFragments) >> 2);
+	  stride = pbi->UVStride;
 	  break;
 	}
 	for(y=0;y<yn;y++){
@@ -1253,7 +1255,7 @@
 		ptr = pbi->QFragFREQ;
 		break;
 	      case 2:
-		bufn = "recon";
+		bufn = "idct";
 		ptr = pbi->QFragTIME;
 		break;
 	      }
@@ -1268,8 +1270,7 @@
 		for(j=0;j<8;j++){
 		  TH_DEBUG("\n   ");
 		  for(k=0;k<8;k++,l++){
-		    TH_DEBUG("%d ",
-			     (unsigned int)abs(ptr[i][l]));
+		    TH_DEBUG("%d ",ptr[i][l]);
 		  }
 		}
 		TH_DEBUG(" }\n");
@@ -1277,13 +1278,12 @@
 	    }
 	    
 	    /* and the loop filter output, which is a flat struct */
-	    TH_DEBUG("loop %s [%d][%d] = {",plstr,x,y);
+	    TH_DEBUG("recon %s [%d][%d] = {",plstr,x,y);
 	    for(j=0;j<8;j++){
-	      int l = (y*8+j)*(xn*8) + x*8 + offset*64;
+	      int l = pbi->recon_pixel_index_table[i] + j*stride;
 	      TH_DEBUG("\n   ");
 	      for(k=0;k<8;k++,l++)
 		TH_DEBUG("%d ", pbi->LastFrameRecon[l]);
-	      
 	    }
 	    TH_DEBUG(" }\n\n");
 	  }

Modified: trunk/theora/lib/internal.h
===================================================================
--- trunk/theora/lib/internal.h	2007-10-30 17:52:28 UTC (rev 14069)
+++ trunk/theora/lib/internal.h	2007-10-30 21:34:52 UTC (rev 14070)
@@ -15,8 +15,6 @@
 
  ********************************************************************/
 
-
-
 #if !defined(_internal_H)
 # define _internal_H (1)
 # include <stdlib.h>
@@ -240,6 +238,8 @@
   int quant[64];
   int freq[64];
   int time[64];
+  int recon[64];
+  int loop[64];
 #endif
 }oc_fragment;
 
@@ -362,10 +362,6 @@
   oc_quant_tables       dequant_table_data[2][3];
   /*Loop filter strength parameters.*/
   unsigned char         loop_filter_limits[64];
-
-#ifdef _TH_DEBUG_
-  th_ycbcr_buffer       loop_debug;
-#endif
 };
 
 



More information about the commits mailing list