diff options
author | Marco Nelissen <marcone@google.com> | 2015-10-29 17:17:31 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2015-10-29 17:17:31 +0000 |
commit | e97cf75293741179dbbba302db2327dd7d43756d (patch) | |
tree | 86cc3a1624a4e5fc1f627189a5f39aa8a8bf2485 | |
parent | 33a503e1606e96608a06f7aefa72b6488b5e3b8e (diff) | |
parent | fff7087bf323ceba1f124fa6de32138a6b78473c (diff) | |
download | tremolo-marshmallow-dr1.5-dev.tar.gz |
Check partword is in range for # of partitions am: 0cf80af909 am: 01cadd9f25android-6.0.1_r5android-6.0.1_r45android-6.0.1_r4android-6.0.1_r33android-6.0.1_r32android-6.0.1_r31android-6.0.1_r25android-6.0.1_r24android-6.0.1_r22android-6.0.1_r21android-6.0.1_r18android-6.0.1_r16marshmallow-dr1.5-releasemarshmallow-dr1.5-dev
am: fff7087bf3
* commit 'fff7087bf323ceba1f124fa6de32138a6b78473c':
Check partword is in range for # of partitions
-rw-r--r-- | Tremolo/res012.c | 68 |
1 files changed, 35 insertions, 33 deletions
diff --git a/Tremolo/res012.c b/Tremolo/res012.c index ed38ab9..59accce 100644 --- a/Tremolo/res012.c +++ b/Tremolo/res012.c @@ -201,39 +201,41 @@ int res_inverse(vorbis_dsp_state *vd,vorbis_info_residue *info, samples_per_partition/=ch; for(s=0;s<info->stages;s++){ - for(i=0;i<partvals;){ - - if(s==0){ - int temp; - partword[i+partitions_per_word-1]=1; - for(k=partitions_per_word-2;k>=0;k--) - partword[i+k]=partword[i+k+1]*info->partitions; - - /* fetch the partition word */ - temp=vorbis_book_decode(phrasebook,&vd->opb); - if(temp==-1)goto eopbreak; - - /* this can be done quickly in assembly due to the quotient - always being at most six bits */ - for(k=0;k<partitions_per_word;k++){ - ogg_uint32_t div=partword[i+k]; - partword[i+k]=temp/div; - temp-=partword[i+k]*div; - } - } - - /* now we decode residual values for the partitions */ - for(k=0;k<partitions_per_word && i<partvals;k++,i++) - if(info->stagemasks[(int)partword[i]]&(1<<s)){ - codebook *stagebook=ci->book_param+ - info->stagebooks[(partword[i]<<3)+s]; - if(vorbis_book_decodevv_add(stagebook,in, - i*samples_per_partition+beginoff,ch, - &vd->opb, - samples_per_partition,-8)==-1) - goto eopbreak; - } - } + for(i=0;i<partvals;){ + + if(s==0){ + int temp; + partword[i+partitions_per_word-1]=1; + for(k=partitions_per_word-2;k>=0;k--) + partword[i+k]=partword[i+k+1]*info->partitions; + + /* fetch the partition word */ + temp=vorbis_book_decode(phrasebook,&vd->opb); + if(temp==-1)goto eopbreak; + + /* this can be done quickly in assembly due to the quotient + always being at most six bits */ + for(k=0;k<partitions_per_word;k++){ + ogg_uint32_t div=partword[i+k]; + partword[i+k]=temp/div; + temp-=partword[i+k]*div; + } + } + + /* now we decode residual values for the partitions */ + for(k=0;k<partitions_per_word && i<partvals;k++,i++){ + if(partword[i] >= 0 && partword[i] < info->partitions && + (info->stagemasks[(int)partword[i]] & (1 << s))){ + codebook *stagebook=ci->book_param+ + info->stagebooks[(partword[i]<<3)+s]; + if(vorbis_book_decodevv_add(stagebook,in, + i*samples_per_partition+beginoff,ch, + &vd->opb, + samples_per_partition,-8)==-1) + goto eopbreak; + } + } + } } } } |