mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
optimize linear filter coeff interpolation code, this also makes the code less prone to overflows
Originally committed as revision 8480 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
d971a5fa81
commit
303bd95cd2
@ -268,13 +268,12 @@ int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int
|
|||||||
}else if(sample_index + c->filter_length > src_size){
|
}else if(sample_index + c->filter_length > src_size){
|
||||||
break;
|
break;
|
||||||
}else if(c->linear){
|
}else if(c->linear){
|
||||||
int64_t v=0;
|
FELEM2 v2=0;
|
||||||
int sub_phase= (frac<<8) / c->src_incr;
|
|
||||||
for(i=0; i<c->filter_length; i++){
|
for(i=0; i<c->filter_length; i++){
|
||||||
FELEML coeff= filter[i]*(256 - sub_phase) + filter[i + c->filter_length]*sub_phase;
|
val += src[sample_index + i] * (FELEM2)filter[i];
|
||||||
v += src[sample_index + i] * coeff;
|
v2 += src[sample_index + i] * (FELEM2)filter[i + c->filter_length];
|
||||||
}
|
}
|
||||||
val= v>>8;
|
val+=(v2-val)*(FELEML)frac / c->src_incr;
|
||||||
}else{
|
}else{
|
||||||
for(i=0; i<c->filter_length; i++){
|
for(i=0; i<c->filter_length; i++){
|
||||||
val += src[sample_index + i] * (FELEM2)filter[i];
|
val += src[sample_index + i] * (FELEM2)filter[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user