Main Page | Class List | File List | Class Members | File Members

vid_putvlc.c File Reference

#include <assert.h>
#include "vid_sim.h"
#include "vid_vlc.h"

Go to the source code of this file.

Functions

int put_mv (int mvint)
int put_cbpcm_intra (int cbpc, int mode)
int put_cbpcm_inter (int cbpc, int mode)
int put_cbpy (int cbp, int mode)
int put_coeff (int run, int level, int last)


Function Documentation

int put_cbpcm_inter int  cbpc,
int  mode
 

Definition at line 93 of file vid_putvlc.c.

References putbits().

Referenced by CountBitsMB().

00094 {
00095   int index;
00096 
00097   index = (mode & 7) | ((cbpc & 3) << 3);
00098 
00099   putbits (cbpcm_inter_tab[index].len, cbpcm_inter_tab[index].code);
00100   
00101   return cbpcm_inter_tab[index].len;
00102 }

int put_cbpcm_intra int  cbpc,
int  mode
 

Definition at line 81 of file vid_putvlc.c.

References putbits().

Referenced by CountBitsMB().

00082 {
00083   int index;
00084 
00085   index = ((mode & 3) >> 1) | ((cbpc & 3) << 2);
00086 
00087   putbits (cbpcm_intra_tab[index].len, cbpcm_intra_tab[index].code);
00088   
00089   return cbpcm_intra_tab[index].len;
00090 }

int put_cbpy int  cbp,
int  mode
 

Definition at line 106 of file vid_putvlc.c.

References putbits().

Referenced by CountBitsMB().

00107 {
00108   int index;
00109 
00110   index = cbp >> 2;
00111 
00112   if (mode < 3)
00113     index ^= 15;
00114   
00115   putbits (cbpy_tab[index].len, cbpy_tab[index].code);
00116   
00117   return cbpy_tab[index].len;
00118 }

int put_coeff int  run,
int  level,
int  last
 

Definition at line 122 of file vid_putvlc.c.

References putbits().

Referenced by CodeCoeff().

00123 {
00124   int length = 0;
00125   
00126   assert (last >= 0 && last < 2);
00127   assert (run >= 0 && run < 64);
00128   assert (level > 0 && level < 128);
00129   
00130   if (last == 0) {
00131     if (run < 2 && level < 13 ) {
00132       putbits (coeff_tab0[run][level-1].len,
00133                coeff_tab0[run][level-1].code);
00134 
00135       length = coeff_tab0[run][level-1].len;
00136     }
00137     else if (run > 1 && run < 27 && level < 5) {
00138       putbits (coeff_tab1[run-2][level-1].len,
00139                coeff_tab1[run-2][level-1].code);
00140       
00141       length = coeff_tab1[run-2][level-1].len;
00142     }
00143   }
00144   else if (last == 1) {
00145     if (run < 2 && level < 4) {
00146       putbits (coeff_tab2[run][level-1].len,
00147                coeff_tab2[run][level-1].code);
00148       
00149       length = coeff_tab2[run][level-1].len;
00150     }
00151     else if (run > 1 && run < 42 && level == 1) {
00152       putbits (coeff_tab3[run-2].len,
00153                coeff_tab3[run-2].code);
00154       
00155       length = coeff_tab3[run-2].len;
00156     }
00157   }
00158   return length;
00159 }

int put_mv int  mvint  ) 
 

Definition at line 58 of file vid_putvlc.c.

References putbits(), and sign.

Referenced by CountBitsVectors().

00059 {
00060   int sign = 0;
00061   int absmv;
00062 
00063   if (mvint >= 32) {
00064     absmv = -mvint + 64;
00065     sign = 1;
00066   }
00067   else
00068     absmv = mvint;
00069   
00070   putbits (mvtab[absmv].len, mvtab[absmv].code);
00071 
00072   if (mvint != 0) {
00073     putbits (1, sign);
00074     return mvtab[absmv].len + 1;
00075   }
00076   else
00077     return mvtab[absmv].len;
00078 }


Generated on Sun Jul 16 16:27:48 2006 by  doxygen 1.3.9.1