[Tremor] reg:Decoder type

Dhanabal dhanapalb at gmail.com
Mon Jun 13 05:01:22 PDT 2005


Hi
   In this part of the code.....

int decode_map(codebook *s, oggpack_buffer *b, ogg_int32_t *v, int point){
  ogg_uint32_t entry = decode_packed_entry_number(s,b);
  int i;
  if(oggpack_eop(b))return(-1);

  /* according to decode type */
  switch(s->dec_type){
  case 1:{
    /* packed vector of values */
    int mask=(1<<s->q_bits)-1;
    for(i=0;i<s->dim;i++){
      v[i]=entry&mask;
      entry>>=s->q_bits;
    }
    break;
  }
  case 2:{
    /* packed vector of column offsets */
    int mask=(1<<s->q_pack)-1;
    for(i=0;i<s->dim;i++){
      if(s->q_bits<=8)
 v[i]=((unsigned char *)(s->q_val))[entry&mask];
      else
 v[i]=((ogg_uint16_t *)(s->q_val))[entry&mask];
      entry>>=s->q_pack;
    }
    break;
  }
  case 3:{
    /* offset into array */
    int *ptr=(int *)s->q_val+entry*s->q_pack;

    if(s->q_bits<=8){
      for(i=0;i<s->dim;i++)
 v[i]=((unsigned char *)ptr)[i];
    }else{
      for(i=0;i<s->dim;i++)
 v[i]=((ogg_uint16_t *)ptr)[i];
    }
    break;
  }
  default:
    return -1;
  }

All the test vectors pass through case1. Case 2 and 3 are not reached. I
need clarification regarding this.

Thanks and Regards
Dhanapal

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/tremor/attachments/20050613/f684cd4f/attachment.html


More information about the Tremor mailing list