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

tterribe at svn.xiph.org tterribe at svn.xiph.org
Thu Aug 28 11:04:17 PDT 2008


Author: tterribe
Date: 2008-08-28 11:04:15 -0700 (Thu, 28 Aug 2008)
New Revision: 15215

Modified:
   trunk/theora/lib/dec/fragment.c
   trunk/theora/lib/dec/state.c
   trunk/theora/lib/internal.h
Log:
It appears Solaris's cc is ignoring the signedness of bitfield types.
Add explicit casts as a work-around.


Modified: trunk/theora/lib/dec/fragment.c
===================================================================
--- trunk/theora/lib/dec/fragment.c	2008-08-28 16:41:43 UTC (rev 15214)
+++ trunk/theora/lib/dec/fragment.c	2008-08-28 18:04:15 UTC (rev 15215)
@@ -179,7 +179,7 @@
     pflag=1<<i;
     if((BC_MASK[bc]&pflag)&&predfr[i]->coded&&
      OC_FRAME_FOR_MODE[predfr[i]->mbmode]==pred_frame){
-      p[np++]=predfr[i]->dc;
+      p[np++]=(ogg_int16_t)predfr[i]->dc;
       pflags|=pflag;
     }
   }

Modified: trunk/theora/lib/dec/state.c
===================================================================
--- trunk/theora/lib/dec/state.c	2008-08-28 16:41:43 UTC (rev 15214)
+++ trunk/theora/lib/dec/state.c	2008-08-28 18:04:15 UTC (rev 15215)
@@ -831,13 +831,13 @@
     ogg_int16_t p;
     /*Why is the iquant product rounded in this case and no others?
       Who knows.*/
-    p=(ogg_int16_t)((ogg_int32_t)_frag->dc*_dc_iquant+15>>5);
+    p=(ogg_int16_t)((ogg_int32_t)(ogg_int16_t)_frag->dc*_dc_iquant+15>>5);
     /*LOOP VECTORIZES.*/
     for(ci=0;ci<64;ci++)res_buf[ci]=p;
   }
   else{
     /*First, dequantize the coefficients.*/
-    dct_buf[0]=(ogg_int16_t)((ogg_int32_t)_frag->dc*_dc_iquant);
+    dct_buf[0]=(ogg_int16_t)((ogg_int32_t)(ogg_int16_t)_frag->dc*_dc_iquant);
     for(zzi=1;zzi<_ncoefs;zzi++){
       int ci;
       ci=OC_FZIG_ZAG[zzi];

Modified: trunk/theora/lib/internal.h
===================================================================
--- trunk/theora/lib/internal.h	2008-08-28 16:41:43 UTC (rev 15214)
+++ trunk/theora/lib/internal.h	2008-08-28 18:04:15 UTC (rev 15215)
@@ -213,7 +213,10 @@
   unsigned        qi:6;
   /*The mode of the macroblock this fragment belongs to.*/
   int             mbmode:8;
-  /*The prediction-corrected DC component.*/
+  /*The prediction-corrected DC component.
+    Note that some compilers (e.g., Solaris's) will ignore the signedness of
+     the type and treat this value as unsigned always, so it will need to be
+     casted before being used.*/
   int             dc:16;
   /*A pointer to the portion of an image covered by this fragment in several
      images.



More information about the commits mailing list