[xiph-commits] r8943 - in experimental/derf/theora-exp: examples include/theora lib

tterribe at motherfish-iii.xiph.org tterribe at motherfish-iii.xiph.org
Thu Feb 17 17:54:12 PST 2005


Author: tterribe
Date: 2005-02-17 17:54:09 -0800 (Thu, 17 Feb 2005)
New Revision: 8943

Modified:
   experimental/derf/theora-exp/examples/dump_video.c
   experimental/derf/theora-exp/examples/encoder_example.c
   experimental/derf/theora-exp/include/theora/theora.h
   experimental/derf/theora-exp/lib/encode.c
Log:
Fix some compiler warnings.

Modified: experimental/derf/theora-exp/examples/dump_video.c
===================================================================
--- experimental/derf/theora-exp/examples/dump_video.c	2005-02-18 01:53:33 UTC (rev 8942)
+++ experimental/derf/theora-exp/examples/dump_video.c	2005-02-18 01:54:09 UTC (rev 8943)
@@ -115,7 +115,7 @@
     int yshift;
     xshift=pli!=0&&!(ti.pixel_fmt&1);
     yshift=pli!=0&&!(ti.pixel_fmt&2);
-    ycbcr[pli].data=(char *)malloc(
+    ycbcr[pli].data=(unsigned char *)malloc(
      (ti.frame_width>>xshift)*(ti.frame_height>>yshift)*sizeof(char));
     ycbcr[pli].ystride=ti.frame_width>>xshift;
     ycbcr[pli].width=ti.frame_width>>xshift;

Modified: experimental/derf/theora-exp/examples/encoder_example.c
===================================================================
--- experimental/derf/theora-exp/examples/encoder_example.c	2005-02-18 01:53:33 UTC (rev 8942)
+++ experimental/derf/theora-exp/examples/encoder_example.c	2005-02-18 01:54:09 UTC (rev 8943)
@@ -288,16 +288,16 @@
       /*Filter: [4 -17 114 35 -9 1]/128, derived from a 6-tap Lanczos
          window.*/
       for(x=0;x<OC_MINI(c_w,2);x++){
-        _dst[x]=OC_CLAMPI(0,4*_aux[0]-17*_aux[OC_MAXI(x-1,0)]+
+        _dst[x]=(unsigned char)OC_CLAMPI(0,4*_aux[0]-17*_aux[OC_MAXI(x-1,0)]+
          114*_aux[x]+35*_aux[OC_MINI(x+1,c_w-1)]-9*_aux[OC_MINI(x+2,c_w-1)]+
          _aux[OC_MINI(x+3,c_w-1)]+64>>7,255);
       }
       for(;x<c_w-3;x++){
-        _dst[x]=OC_CLAMPI(0,4*_aux[x-2]-17*_aux[x-1]+114*_aux[x]+
-         35*_aux[x+1]-9*_aux[x+2]+_aux[x+3]+64>>7,255);
+        _dst[x]=(unsigned char)OC_CLAMPI(0,4*_aux[x-2]-17*_aux[x-1]+
+         114*_aux[x]+35*_aux[x+1]-9*_aux[x+2]+_aux[x+3]+64>>7,255);
       }
       for(;x<c_w;x++){
-        _dst[x]=OC_CLAMPI(0,4*_aux[x-2]-17*_aux[x-1]+
+        _dst[x]=(unsigned char)OC_CLAMPI(0,4*_aux[x-2]-17*_aux[x-1]+
          114*_aux[x]+35*_aux[OC_MINI(x+1,c_w-1)]-9*_aux[OC_MINI(x+2,c_w-1)]+
          _aux[c_w-1]+64>>7,255);
       }
@@ -374,16 +374,16 @@
       /*Filter: [4 -17 114 35 -9 1]/128, derived from a 6-tap Lanczos
          window.*/
       for(x=0;x<OC_MINI(c_w,2);x++){
-        tmp[x]=OC_CLAMPI(0,4*_aux[0]-17*_aux[OC_MAXI(x-1,0)]+
+        tmp[x]=(unsigned char)OC_CLAMPI(0,4*_aux[0]-17*_aux[OC_MAXI(x-1,0)]+
          114*_aux[x]+35*_aux[OC_MINI(x+1,c_w-1)]-9*_aux[OC_MINI(x+2,c_w-1)]+
          _aux[OC_MINI(x+3,c_w-1)]+64>>7,255);
       }
       for(;x<c_w-3;x++){
-        tmp[x]=OC_CLAMPI(0,4*_aux[x-2]-17*_aux[x-1]+114*_aux[x]+
-         35*_aux[x+1]-9*_aux[x+2]+_aux[x+3]+64>>7,255);
+        tmp[x]=(unsigned char)OC_CLAMPI(0,4*_aux[x-2]-17*_aux[x-1]+
+         114*_aux[x]+35*_aux[x+1]-9*_aux[x+2]+_aux[x+3]+64>>7,255);
       }
       for(;x<c_w;x++){
-        tmp[x]=OC_CLAMPI(0,4*_aux[x-2]-17*_aux[x-1]+
+        tmp[x]=(unsigned char)OC_CLAMPI(0,4*_aux[x-2]-17*_aux[x-1]+
          114*_aux[x]+35*_aux[OC_MINI(x+1,c_w-1)]-9*_aux[OC_MINI(x+2,c_w-1)]+
          _aux[c_w-1]+64>>7,255);
       }
@@ -397,20 +397,20 @@
           This is the same filter used above, but in the other order.*/
         for(x=0;x<c_w;x++){
           for(y=0;y<OC_MINI(c_h,3);y++){
-            _dst[y*c_w]=OC_CLAMPI(0,tmp[0]-9*tmp[OC_MAXI(y-2,0)*c_w]+
-             35*tmp[OC_MAXI(y-1,0)*c_w]+114*tmp[y*c_w]-
-             17*tmp[OC_MINI(y+1,c_h-1)*c_w]+4*tmp[OC_MINI(y+2,c_h-1)*c_w]+
-             64>>7,255);
+            _dst[y*c_w]=(unsigned char)OC_CLAMPI(0,tmp[0]-
+             9*tmp[OC_MAXI(y-2,0)*c_w]+35*tmp[OC_MAXI(y-1,0)*c_w]+
+             114*tmp[y*c_w]-17*tmp[OC_MINI(y+1,c_h-1)*c_w]+
+             4*tmp[OC_MINI(y+2,c_h-1)*c_w]+64>>7,255);
           }
           for(;y<c_h-2;y++){
-            _dst[y*c_w]=OC_CLAMPI(0,tmp[(y-3)*c_w]-9*tmp[(y-2)*c_w]+
-             35*tmp[(y-1)*c_w]+114*tmp[y*c_w]-17*tmp[(y+1)*c_w]+
-             4*tmp[(y+2)*c_w]+64>>7,255);
+            _dst[y*c_w]=(unsigned char)OC_CLAMPI(0,tmp[(y-3)*c_w]-
+             9*tmp[(y-2)*c_w]+35*tmp[(y-1)*c_w]+114*tmp[y*c_w]-
+             17*tmp[(y+1)*c_w]+4*tmp[(y+2)*c_w]+64>>7,255);
           }
           for(;y<c_h;y++){
-            _dst[y*c_w]=OC_CLAMPI(0,tmp[(y-3)*c_w]-9*tmp[(y-2)*c_w]+
-             35*tmp[(y-1)*c_w]+114*tmp[y*c_w]-17*tmp[OC_MINI(y+1,c_h-1)*c_w]+
-             4*tmp[(c_h-1)*c_w]+64>>7,255);
+            _dst[y*c_w]=(unsigned char)OC_CLAMPI(0,tmp[(y-3)*c_w]-
+             9*tmp[(y-2)*c_w]+35*tmp[(y-1)*c_w]+114*tmp[y*c_w]-
+             17*tmp[OC_MINI(y+1,c_h-1)*c_w]+4*tmp[(c_h-1)*c_w]+64>>7,255);
           }
           _dst++;
           tmp++;
@@ -424,19 +424,19 @@
           This is the same as the horizontal filter.*/
         for(x=0;x<c_w;x++){
           for(y=0;y<OC_MINI(c_h,2);y++){
-            _dst[y*c_w]=OC_CLAMPI(0,4*tmp[0]-17*tmp[OC_MAXI(y-1,0)*c_w]+
-             114*tmp[y*c_w]+35*tmp[OC_MINI(y+1,c_h-1)*c_w]-
-             9*tmp[OC_MINI(y+2,c_h-1)*c_w]+tmp[OC_MINI(y+3,c_h-1)*c_w]+
-             64>>7,255);
+            _dst[y*c_w]=(unsigned char)OC_CLAMPI(0,4*tmp[0]-
+             17*tmp[OC_MAXI(y-1,0)*c_w]+114*tmp[y*c_w]+
+             35*tmp[OC_MINI(y+1,c_h-1)*c_w]-9*tmp[OC_MINI(y+2,c_h-1)*c_w]+
+             tmp[OC_MINI(y+3,c_h-1)*c_w]+64>>7,255);
           }
           for(;y<c_h-3;y++){
-            _dst[y*c_w]=OC_CLAMPI(0,4*tmp[(y-2)*c_w]-17*tmp[(y-1)*c_w]+
-             114*tmp[y*c_w]+35*tmp[(y+1)*c_w]-9*tmp[(y+2)*c_w]+
-             tmp[(y+3)*c_w]+64>>7,255);
+            _dst[y*c_w]=(unsigned char)OC_CLAMPI(0,4*tmp[(y-2)*c_w]-
+             17*tmp[(y-1)*c_w]+114*tmp[y*c_w]+35*tmp[(y+1)*c_w]-
+             9*tmp[(y+2)*c_w]+tmp[(y+3)*c_w]+64>>7,255);
           }
           for(;y<c_h;y++){
-            _dst[y*c_w]=OC_CLAMPI(0,4*tmp[(y-2)*c_w]-17*tmp[(y-1)*c_w]+
-             114*tmp[y*c_w]+35*tmp[OC_MINI(y+1,c_h-1)*c_w]-
+            _dst[y*c_w]=(unsigned char)OC_CLAMPI(0,4*tmp[(y-2)*c_w]-
+             17*tmp[(y-1)*c_w]+114*tmp[y*c_w]+35*tmp[OC_MINI(y+1,c_h-1)*c_w]-
              9*tmp[OC_MINI(y+2,c_h-1)*c_w]+tmp[(c_h-1)*c_w]+64>>7,255);
           }
           _dst++;
@@ -512,22 +512,22 @@
       /*Filters: [1 110 18 -1]/128 and [-3 50 86 -5]/128, both derived from a
          4-tap Mitchell window.*/
       for(x=0;x<OC_MINI(c_w,1);x++){
-        _dst[x<<1]=OC_CLAMPI(0,111*_aux[0]+18*_aux[OC_MINI(1,c_w-1)]-
-         _aux[OC_MINI(2,c_w-1)]+64>>7,255);
-        _dst[x<<1|1]=OC_CLAMPI(0,47*_aux[0]+86*_aux[OC_MINI(1,c_w-1)]-
-         5*_aux[OC_MINI(2,c_w-1)]+64>>7,255);
+        _dst[x<<1]=(unsigned char)OC_CLAMPI(0,111*_aux[0]+
+         18*_aux[OC_MINI(1,c_w-1)]-_aux[OC_MINI(2,c_w-1)]+64>>7,255);
+        _dst[x<<1|1]=(unsigned char)OC_CLAMPI(0,47*_aux[0]+
+         86*_aux[OC_MINI(1,c_w-1)]-5*_aux[OC_MINI(2,c_w-1)]+64>>7,255);
       }
       for(;x<c_w-2;x++){
-        _dst[x<<1]=OC_CLAMPI(0,_aux[x-1]+110*_aux[x]+18*_aux[x+1]-_aux[x+2]+
-         64>>7,255);
-        _dst[x<<1|1]=OC_CLAMPI(0,-3*_aux[x-1]+50*_aux[x]+86*_aux[x+1]-
-         5*_aux[x+2]+64>>7,255);
+        _dst[x<<1]=(unsigned char)OC_CLAMPI(0,_aux[x-1]+110*_aux[x]+
+         18*_aux[x+1]-_aux[x+2]+64>>7,255);
+        _dst[x<<1|1]=(unsigned char)OC_CLAMPI(0,-3*_aux[x-1]+50*_aux[x]+
+         86*_aux[x+1]-5*_aux[x+2]+64>>7,255);
       }
       for(;x<c_w;x++){
-        _dst[x<<1]=OC_CLAMPI(0,_aux[x-1]+110*_aux[x]+
+        _dst[x<<1]=(unsigned char)OC_CLAMPI(0,_aux[x-1]+110*_aux[x]+
          18*_aux[OC_MINI(x+1,c_w-1)]-_aux[c_w-1]+64>>7,255);
         if((x<<1|1)<dst_c_w){
-          _dst[x<<1|1]=OC_CLAMPI(0,-3*_aux[x-1]+50*_aux[x]+
+          _dst[x<<1|1]=(unsigned char)OC_CLAMPI(0,-3*_aux[x-1]+50*_aux[x]+
            86*_aux[OC_MINI(x+1,c_w-1)]-5*_aux[c_w-1]+64>>7,255);
         }
       }
@@ -741,7 +741,7 @@
         fprintf(stderr,"Incorrect YUV input file version; YUV4MPEG2 required.\n");
       }
 
-      ret=y4m_parse_tags(buffer+5);
+      ret=y4m_parse_tags((char *)buffer+5);
       if(ret<0){
         fprintf(stderr,"Error parsing YUV4MPEG2 header in file %s.\n",f);
         exit(1);
@@ -968,8 +968,8 @@
       for(i=state;i<2;i++){
         char c,frame[6];
         int ret=fread(frame,1,6,video);
-        
-	/* match and skip the frame header */
+
+        /* match and skip the frame header */
         if(ret<6)break;
         if(memcmp(frame,"FRAME",5)){
           fprintf(stderr,"Loss of framing in YUV input data\n");

Modified: experimental/derf/theora-exp/include/theora/theora.h
===================================================================
--- experimental/derf/theora-exp/include/theora/theora.h	2005-02-18 01:53:33 UTC (rev 8942)
+++ experimental/derf/theora-exp/include/theora/theora.h	2005-02-18 01:54:09 UTC (rev 8943)
@@ -304,7 +304,8 @@
 }theora_huff_code;
 
 /*The Huffman tables used by VP3.*/
-const theora_huff_code OC_VP31_HUFF_CODES[OC_NHUFFMAN_TABLES][OC_NDCT_TOKENS];
+extern const theora_huff_code
+ OC_VP31_HUFF_CODES[OC_NHUFFMAN_TABLES][OC_NDCT_TOKENS];
 
 /*The quantization parameters.
   The quantizer for each coefficient is calculated as:
@@ -369,7 +370,7 @@
 }theora_quant_info;
 
 /*The quantization parameters used by VP3.*/
-const theora_quant_info OC_VP31_QUANT_INFO;
+extern const theora_quant_info OC_VP31_QUANT_INFO;
 
 /*The comment information.*/
 typedef struct theora_comment{

Modified: experimental/derf/theora-exp/lib/encode.c
===================================================================
--- experimental/derf/theora-exp/lib/encode.c	2005-02-18 01:53:33 UTC (rev 8942)
+++ experimental/derf/theora-exp/lib/encode.c	2005-02-18 01:54:09 UTC (rev 8943)
@@ -2023,7 +2023,7 @@
 #if defined(OC_BITRATE_STATS)
           efrag->eerror=err[OC_MODE_INTER_NOMV][mapi];
 #endif
-          efrag->qii=frag_qii[codedi][OC_INTER_FRAME][1];
+          efrag->qii=(unsigned char)frag_qii[codedi][OC_INTER_FRAME][1];
           frag->qi=qi;
         }
         intra_bits+=mbintrabits+(1<<OC_BIT_SCALE-1)>>OC_BIT_SCALE;
@@ -2560,7 +2560,7 @@
           OC_MINI(31,oc_ilog(keyframe_frequency_force-1)));
        }
        _enc->keyframe_frequency_force=OC_MINI(keyframe_frequency_force,
-        1<<_enc->state.info.keyframe_granule_shift);
+        1U<<_enc->state.info.keyframe_granule_shift);
        (*(ogg_uint32_t *)_buf)=_enc->keyframe_frequency_force;
        return 0;
     }break;



More information about the commits mailing list