[xiph-commits] r14355 - trunk/theora-exp/lib

tterribe at svn.xiph.org tterribe at svn.xiph.org
Fri Jan 4 12:00:35 PST 2008


Author: tterribe
Date: 2008-01-04 12:00:35 -0800 (Fri, 04 Jan 2008)
New Revision: 14355

Modified:
   trunk/theora-exp/lib/decode.c
   trunk/theora-exp/lib/encint.h
   trunk/theora-exp/lib/internal.c
   trunk/theora-exp/lib/internal.h
   trunk/theora-exp/lib/mcenc.c
   trunk/theora-exp/lib/recode.c
   trunk/theora-exp/lib/state.c
Log:
Port signed char fixes from r13911 to theora-exp and correct char usage in the
 rest of the code, as well.


Modified: trunk/theora-exp/lib/decode.c
===================================================================
--- trunk/theora-exp/lib/decode.c	2008-01-04 20:00:09 UTC (rev 14354)
+++ trunk/theora-exp/lib/decode.c	2008-01-04 20:00:35 UTC (rev 14355)
@@ -628,8 +628,8 @@
             codedi++;
             frag=_dec->state.frags+mb->map[0][bi];
             frag->mbmode=mode;
-            frag->mv[0]=lbmvs[bi][0]=(char)(*mv_comp_unpack)(&_dec->opb);
-            frag->mv[1]=lbmvs[bi][1]=(char)(*mv_comp_unpack)(&_dec->opb);
+            frag->mv[0]=lbmvs[bi][0]=(signed char)(*mv_comp_unpack)(&_dec->opb);
+            frag->mv[1]=lbmvs[bi][1]=(signed char)(*mv_comp_unpack)(&_dec->opb);
           }
           else lbmvs[bi][0]=lbmvs[bi][1]=0;
         }
@@ -654,8 +654,8 @@
       case OC_MODE_INTER_MV:{
         last_mv[1][0]=last_mv[0][0];
         last_mv[1][1]=last_mv[0][1];
-        mbmv[0]=last_mv[0][0]=(char)(*mv_comp_unpack)(&_dec->opb);
-        mbmv[1]=last_mv[0][1]=(char)(*mv_comp_unpack)(&_dec->opb);
+        mbmv[0]=last_mv[0][0]=(signed char)(*mv_comp_unpack)(&_dec->opb);
+        mbmv[1]=last_mv[0][1]=(signed char)(*mv_comp_unpack)(&_dec->opb);
       }break;
       case OC_MODE_INTER_MV_LAST:{
         mbmv[0]=last_mv[0][0];
@@ -670,8 +670,8 @@
         last_mv[0][1]=mbmv[1];
       }break;
       case OC_MODE_GOLDEN_MV:{
-        mbmv[0]=(char)(*mv_comp_unpack)(&_dec->opb);
-        mbmv[1]=(char)(*mv_comp_unpack)(&_dec->opb);
+        mbmv[0]=(signed char)(*mv_comp_unpack)(&_dec->opb);
+        mbmv[1]=(signed char)(*mv_comp_unpack)(&_dec->opb);
       }break;
       default:mbmv[0]=mbmv[1]=0;break;
     }
@@ -910,12 +910,12 @@
       run_counts[63]+=eobs;
       token=oc_huff_token_decode(&_dec->opb,
        _dec->huff_tables[_huff_idxs[pli]]);
-      _dec->dct_tokens[0][ti++]=(char)token;
+      _dec->dct_tokens[0][ti++]=(unsigned char)token;
       neb=OC_DCT_TOKEN_EXTRA_BITS[token];
       if(neb){
         theora_read(&_dec->opb,neb,&val);
         eb=(int)val;
-        _dec->extra_bits[0][ebi++]=(ogg_int16_t)eb;
+        _dec->extra_bits[0][ebi++]=(ogg_uint16_t)eb;
       }
       else eb=0;
       skip=oc_dct_token_skip(token,eb);
@@ -982,12 +982,12 @@
       run_counts[63]+=_eobs;
       token=oc_huff_token_decode(&_dec->opb,
        _dec->huff_tables[_huff_idxs[pli]]);
-      _dec->dct_tokens[_zzi][ti++]=(char)token;
+      _dec->dct_tokens[_zzi][ti++]=(unsigned char)token;
       neb=OC_DCT_TOKEN_EXTRA_BITS[token];
       if(neb){
         theora_read(&_dec->opb,neb,&val);
         eb=(int)val;
-        _dec->extra_bits[_zzi][ebi++]=(ogg_int16_t)eb;
+        _dec->extra_bits[_zzi][ebi++]=(ogg_uint16_t)eb;
       }
       else eb=0;
       skip=oc_dct_token_skip(token,eb);

Modified: trunk/theora-exp/lib/encint.h
===================================================================
--- trunk/theora-exp/lib/encint.h	2008-01-04 20:00:09 UTC (rev 14354)
+++ trunk/theora-exp/lib/encint.h	2008-01-04 20:00:35 UTC (rev 14355)
@@ -109,9 +109,9 @@
      golden frame, which can be used to judge constant velocity and constant
      acceleration.
     Uninitialized MVs are (0,0).*/
-  char          mvs[3][2][2];
+  oc_mv         mvs[3][2];
   /*Per-block motion vectors for this frame against the previous frame.*/
-  char          bmvs[4][2];
+  oc_mv         bmvs[4];
   /*Minimum motion estimation error from the analysis stage.*/
   int           aerror;
   /*Minimum 4V motion estimation error from the analysis stage.*/

Modified: trunk/theora-exp/lib/internal.c
===================================================================
--- trunk/theora-exp/lib/internal.c	2008-01-04 20:00:09 UTC (rev 14354)
+++ trunk/theora-exp/lib/internal.c	2008-01-04 20:00:35 UTC (rev 14355)
@@ -210,13 +210,13 @@
   This version is for use with chroma decimated in the X and Y directions.
   _cbmvs: The chroma block-level motion vectors to fill in.
   _lbmvs: The luma block-level motion vectors.*/
-static void oc_set_chroma_mvs00(char _cbmvs[4][2],const char _lbmvs[4][2]){
+static void oc_set_chroma_mvs00(oc_mv _cbmvs[4],const oc_mv _lbmvs[4]){
   int dx;
   int dy;
   dx=_lbmvs[0][0]+_lbmvs[1][0]+_lbmvs[2][0]+_lbmvs[3][0];
   dy=_lbmvs[0][1]+_lbmvs[1][1]+_lbmvs[2][1]+_lbmvs[3][1];
-  _cbmvs[0][0]=(char)OC_DIV_ROUND_POW2(dx,2,2);
-  _cbmvs[0][1]=(char)OC_DIV_ROUND_POW2(dy,2,2);
+  _cbmvs[0][0]=(signed char)OC_DIV_ROUND_POW2(dx,2,2);
+  _cbmvs[0][1]=(signed char)OC_DIV_ROUND_POW2(dy,2,2);
 }
 
 /*The function used to fill in the chroma plane motion vectors for a macro
@@ -224,17 +224,17 @@
   This version is for use with chroma decimated in the Y direction.
   _cbmvs: The chroma block-level motion vectors to fill in.
   _lbmvs: The luma block-level motion vectors.*/
-static void oc_set_chroma_mvs01(char _cbmvs[4][2],const char _lbmvs[4][2]){
+static void oc_set_chroma_mvs01(oc_mv _cbmvs[4],const oc_mv _lbmvs[4]){
   int dx;
   int dy;
   dx=_lbmvs[0][0]+_lbmvs[2][0];
   dy=_lbmvs[0][1]+_lbmvs[2][1];
-  _cbmvs[0][0]=(char)OC_DIV_ROUND_POW2(dx,1,1);
-  _cbmvs[0][1]=(char)OC_DIV_ROUND_POW2(dy,1,1);
+  _cbmvs[0][0]=(signed char)OC_DIV_ROUND_POW2(dx,1,1);
+  _cbmvs[0][1]=(signed char)OC_DIV_ROUND_POW2(dy,1,1);
   dx=_lbmvs[1][0]+_lbmvs[3][0];
   dy=_lbmvs[1][1]+_lbmvs[3][1];
-  _cbmvs[1][0]=(char)OC_DIV_ROUND_POW2(dx,1,1);
-  _cbmvs[1][1]=(char)OC_DIV_ROUND_POW2(dy,1,1);
+  _cbmvs[1][0]=(signed char)OC_DIV_ROUND_POW2(dx,1,1);
+  _cbmvs[1][1]=(signed char)OC_DIV_ROUND_POW2(dy,1,1);
 }
 
 /*The function used to fill in the chroma plane motion vectors for a macro
@@ -242,17 +242,17 @@
   This version is for use with chroma decimated in the X direction.
   _cbmvs: The chroma block-level motion vectors to fill in.
   _lbmvs: The luma block-level motion vectors.*/
-static void oc_set_chroma_mvs10(char _cbmvs[4][2],const char _lbmvs[4][2]){
+static void oc_set_chroma_mvs10(oc_mv _cbmvs[4],const oc_mv _lbmvs[4]){
   int dx;
   int dy;
   dx=_lbmvs[0][0]+_lbmvs[1][0];
   dy=_lbmvs[0][1]+_lbmvs[1][1];
-  _cbmvs[0][0]=(char)OC_DIV_ROUND_POW2(dx,1,1);
-  _cbmvs[0][1]=(char)OC_DIV_ROUND_POW2(dy,1,1);
+  _cbmvs[0][0]=(signed char)OC_DIV_ROUND_POW2(dx,1,1);
+  _cbmvs[0][1]=(signed char)OC_DIV_ROUND_POW2(dy,1,1);
   dx=_lbmvs[2][0]+_lbmvs[3][0];
   dy=_lbmvs[2][1]+_lbmvs[3][1];
-  _cbmvs[2][0]=(char)OC_DIV_ROUND_POW2(dx,1,1);
-  _cbmvs[2][1]=(char)OC_DIV_ROUND_POW2(dy,1,1);
+  _cbmvs[2][0]=(signed char)OC_DIV_ROUND_POW2(dx,1,1);
+  _cbmvs[2][1]=(signed char)OC_DIV_ROUND_POW2(dy,1,1);
 }
 
 /*The function used to fill in the chroma plane motion vectors for a macro
@@ -262,7 +262,7 @@
   _lmbmv: The luma macro-block level motion vector to fill in for use in
            prediction.
   _lbmvs: The luma block-level motion vectors.*/
-static void oc_set_chroma_mvs11(char _cbmvs[4][2],const char _lbmvs[4][2]){
+static void oc_set_chroma_mvs11(oc_mv _cbmvs[4][2],const oc_mv _lbmvs[4]){
   memcpy(_cbmvs,_lbmvs,4*sizeof(_lbmvs[0]));
 }
 

Modified: trunk/theora-exp/lib/internal.h
===================================================================
--- trunk/theora-exp/lib/internal.h	2008-01-04 20:00:09 UTC (rev 14354)
+++ trunk/theora-exp/lib/internal.h	2008-01-04 20:00:35 UTC (rev 14355)
@@ -109,11 +109,11 @@
 
 
 /*A map from a super block to fragment numbers.*/
-typedef int oc_sb_map[4][4];
+typedef int         oc_sb_map[4][4];
 /*A map from a macro block to fragment numbers.*/
-typedef int oc_mb_map[3][4];
+typedef int         oc_mb_map[3][4];
 /*A motion vector.*/
-typedef char oc_mv[2];
+typedef signed char oc_mv[2];
 
 
 
@@ -341,8 +341,7 @@
   _lmbmv: The luma macro-block level motion vector to fill in for use in
            prediction.
   _lbmvs: The luma block-level motion vectors.*/
-typedef void (*oc_set_chroma_mvs_func)(oc_mv _cbmvs[4],
- const oc_mv _lbmvs[4]);
+typedef void (*oc_set_chroma_mvs_func)(oc_mv _cbmvs[4],const oc_mv _lbmvs[4]);
 
 
 
@@ -406,11 +405,13 @@
 #endif
 
 /*Shared accelerated functions.*/
-void oc_frag_recon_intra(const oc_theora_state *_state,unsigned char *_dst,int _dst_ystride,
- const ogg_int16_t *_residue);
-void oc_frag_recon_inter(const oc_theora_state *_state,unsigned char *_dst,int _dst_ystride,
+void oc_frag_recon_intra(const oc_theora_state *_state,
+ unsigned char *_dst,int _dst_ystride,const ogg_int16_t *_residue);
+void oc_frag_recon_inter(const oc_theora_state *_state,
+ unsigned char *_dst,int _dst_ystride,
  const unsigned char *_src,int _src_ystride,const ogg_int16_t *_residue);
-void oc_frag_recon_inter2(const oc_theora_state *_state,unsigned char *_dst,int _dst_ystride,
+void oc_frag_recon_inter2(const oc_theora_state *_state,
+ unsigned char *_dst,int _dst_ystride,
  const unsigned char *_src1,int _src1_ystride,const unsigned char *_src2,
  int _src2_ystride,const ogg_int16_t *_residue);
 void oc_state_frag_copy(const oc_theora_state *_state,const int *_fragis,

Modified: trunk/theora-exp/lib/mcenc.c
===================================================================
--- trunk/theora-exp/lib/mcenc.c	2008-01-04 20:00:09 UTC (rev 14354)
+++ trunk/theora-exp/lib/mcenc.c	2008-01-04 20:00:35 UTC (rev 14355)
@@ -346,7 +346,7 @@
   _error4mv: Returns sum of the prediction error for the individual block
               motion vectors.*/
 static void oc_mcenc_search(oc_mcenc_ctx *_mcenc,int _mbi,int _frame,
- char _bmvs[4][2],int *_error,int *_error4mv){
+ oc_mv _bmvs[4],int *_error,int *_error4mv){
   oc_mb_enc_info *embs;
   oc_mb_enc_info *emb;
   oc_mb          *mb;
@@ -541,14 +541,14 @@
   }
   *_error=oc_mcenc_ysad_halfpel_mbrefine(_mcenc,_mbi,best_vec,best_err,
    ref_framei);
-  emb->mvs[0][_frame][0]=(char)best_vec[0];
-  emb->mvs[0][_frame][1]=(char)best_vec[1];
+  emb->mvs[0][_frame][0]=(signed char)best_vec[0];
+  emb->mvs[0][_frame][1]=(signed char)best_vec[1];
   *_error4mv=0;
   for(bi=0;bi<4;bi++){
     (*_error4mv)+=oc_mcenc_ysad_halfpel_brefine(_mcenc,_mbi,bi,
      best_block_vec[bi],best_block_err[bi],ref_framei);
-    _bmvs[bi][0]=(char)best_block_vec[bi][0];
-    _bmvs[bi][1]=(char)best_block_vec[bi][1];
+    _bmvs[bi][0]=(signed char)best_block_vec[bi][0];
+    _bmvs[bi][1]=(signed char)best_block_vec[bi][1];
   }
 }
 
@@ -672,8 +672,8 @@
   }
   best_err=oc_mcenc_ysad_halfpel_mbrefine(_mcenc,_mbi,best_vec,best_err,
    ref_framei);
-  emb->mvs[0][_frame][0]=(char)best_vec[0];
-  emb->mvs[0][_frame][1]=(char)best_vec[1];
+  emb->mvs[0][_frame][0]=(signed char)best_vec[0];
+  emb->mvs[0][_frame][1]=(signed char)best_vec[1];
   return best_err;
 }
 

Modified: trunk/theora-exp/lib/recode.c
===================================================================
--- trunk/theora-exp/lib/recode.c	2008-01-04 20:00:09 UTC (rev 14354)
+++ trunk/theora-exp/lib/recode.c	2008-01-04 20:00:35 UTC (rev 14355)
@@ -752,7 +752,7 @@
       run_counts[63]+=eobs;
       token=oc_huff_token_decode(&_rec->dec_opb,
        _rec->dec_huff_tables[_huff_idxs[pli]]);
-      _rec->dct_tokens[0][ti++]=(char)token;
+      _rec->dct_tokens[0][ti++]=(unsigned char)token;
       _tok_hists[pli][token]++;
       neb=OC_DCT_TOKEN_EXTRA_BITS[token];
       if(neb){
@@ -823,7 +823,7 @@
       run_counts[63]+=_eobs;
       token=oc_huff_token_decode(&_rec->dec_opb,
        _rec->dec_huff_tables[_huff_idxs[pli]]);
-      _rec->dct_tokens[_zzi][ti++]=(char)token;
+      _rec->dct_tokens[_zzi][ti++]=(unsigned char)token;
       _tok_hists[pli][token]++;
       neb=OC_DCT_TOKEN_EXTRA_BITS[token];
       if(neb){

Modified: trunk/theora-exp/lib/state.c
===================================================================
--- trunk/theora-exp/lib/state.c	2008-01-04 20:00:09 UTC (rev 14354)
+++ trunk/theora-exp/lib/state.c	2008-01-04 20:00:35 UTC (rev 14355)
@@ -593,11 +593,11 @@
   _yend: The Y coordinate of the row to stop padding at.*/
 void oc_state_borders_fill_rows(oc_theora_state *_state,int _refi,int _pli,
  int _y0,int _yend){
-  th_img_plane *iplane;
-  unsigned char*apix;
-  unsigned char*bpix;
-  unsigned char*epix;
-  int           hpadding;
+  th_img_plane  *iplane;
+  unsigned char *apix;
+  unsigned char *bpix;
+  unsigned char *epix;
+  int            hpadding;
   hpadding=OC_UMV_PADDING>>(_pli!=0&&!(_state->info.pixel_fmt&1));
   iplane=_state->ref_frame_bufs[_refi]+_pli;
   apix=iplane->data+_y0*iplane->ystride;
@@ -619,13 +619,13 @@
   _refi:      The index of the reference buffer to pad.
   _pli:       The color plane.*/
 void oc_state_borders_fill_caps(oc_theora_state *_state,int _refi,int _pli){
-  th_img_plane *iplane;
-  unsigned char*apix;
-  unsigned char*bpix;
-  unsigned char*epix;
-  int           hpadding;
-  int           vpadding;
-  int           fullw;
+  th_img_plane  *iplane;
+  unsigned char *apix;
+  unsigned char *bpix;
+  unsigned char *epix;
+  int            hpadding;
+  int            vpadding;
+  int            fullw;
   hpadding=OC_UMV_PADDING>>(_pli!=0&&!(_state->info.pixel_fmt&1));
   vpadding=OC_UMV_PADDING>>(_pli!=0&&!(_state->info.pixel_fmt&2));
   iplane=_state->ref_frame_bufs[_refi]+_pli;



More information about the commits mailing list