[xiph-commits] r16407 - branches/theora-thusnelda/lib/enc

tterribe at svn.xiph.org tterribe at svn.xiph.org
Mon Aug 3 21:16:45 PDT 2009


Author: tterribe
Date: 2009-08-03 21:16:45 -0700 (Mon, 03 Aug 2009)
New Revision: 16407

Modified:
   branches/theora-thusnelda/lib/enc/analyze.c
Log:
Remove an attempt at in-place replacement of chroma MVs.
While this works when optimizations are enabled, because the memcpy's get
 translated into assignments, it violates the semantics of memcpy (source and
 destination cannot overlap), and may fail without optimizations.
Sadly, I can't seem to find a replacement for memcpy that gcc treats nearly as
 well, so we'll waste the 8 bytes of stack.


Modified: branches/theora-thusnelda/lib/enc/analyze.c
===================================================================
--- branches/theora-thusnelda/lib/enc/analyze.c	2009-08-03 22:22:30 UTC (rev 16406)
+++ branches/theora-thusnelda/lib/enc/analyze.c	2009-08-04 04:16:45 UTC (rev 16407)
@@ -1750,6 +1750,7 @@
  unsigned _mbi,oc_mv _mv[4],const oc_fr_state *_fr,const oc_qii_state *_qs,
  const unsigned _skip_ssd[12]){
   unsigned               frag_satd[12];
+  oc_mv                  lbmvs[4];
   oc_mv                  cbmvs[4];
   const unsigned char   *src;
   const unsigned char   *ref;
@@ -1806,16 +1807,16 @@
   nqis=_enc->state.nqis;
   for(bi=0;bi<4;bi++){
     if(_modec->qii[OC_MB_PHASE[_mbi&3][bi]]>=nqis){
-      memset(cbmvs+bi,0,sizeof(*cbmvs));
+      memset(lbmvs+bi,0,sizeof(*lbmvs));
     }
     else{
-      memcpy(cbmvs+bi,_mv+bi,sizeof(*cbmvs));
+      memcpy(lbmvs+bi,_mv+bi,sizeof(*lbmvs));
       bits0+=OC_MV_BITS[0][_mv[bi][0]+31]+OC_MV_BITS[0][_mv[bi][1]+31];
       bits1+=12;
     }
   }
   (*OC_SET_CHROMA_MVS_TABLE[_enc->state.info.pixel_fmt])(cbmvs,
-   (const oc_mv *)cbmvs);
+   (const oc_mv *)lbmvs);
   map_idxs=OC_MB_MAP_IDXS[_enc->state.info.pixel_fmt];
   map_nidxs=OC_MB_MAP_NIDXS[_enc->state.info.pixel_fmt];
   /*Note: This assumes ref_ystride[1]==ref_ystride[2].*/



More information about the commits mailing list