|
|
@ -123,42 +123,42 @@ int RENAME(swri_resample_common)(ResampleContext *c, |
|
|
|
DELEM *dst, const DELEM *src, |
|
|
|
DELEM *dst, const DELEM *src, |
|
|
|
int n, int update_ctx) |
|
|
|
int n, int update_ctx) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int dst_index; |
|
|
|
int dst_index; |
|
|
|
int index= c->index; |
|
|
|
int index= c->index; |
|
|
|
int frac= c->frac; |
|
|
|
int frac= c->frac; |
|
|
|
int dst_incr_frac= c->dst_incr % c->src_incr; |
|
|
|
int dst_incr_frac= c->dst_incr % c->src_incr; |
|
|
|
int dst_incr= c->dst_incr / c->src_incr; |
|
|
|
int dst_incr= c->dst_incr / c->src_incr; |
|
|
|
int sample_index = index >> c->phase_shift; |
|
|
|
int sample_index = index >> c->phase_shift; |
|
|
|
|
|
|
|
|
|
|
|
index &= c->phase_mask; |
|
|
|
index &= c->phase_mask; |
|
|
|
for (dst_index = 0; dst_index < n; dst_index++) { |
|
|
|
for (dst_index = 0; dst_index < n; dst_index++) { |
|
|
|
FELEM *filter = ((FELEM *) c->filter_bank) + c->filter_alloc * index; |
|
|
|
FELEM *filter = ((FELEM *) c->filter_bank) + c->filter_alloc * index; |
|
|
|
|
|
|
|
|
|
|
|
#ifdef COMMON_CORE |
|
|
|
#ifdef COMMON_CORE |
|
|
|
COMMON_CORE |
|
|
|
COMMON_CORE |
|
|
|
#else |
|
|
|
#else |
|
|
|
FELEM2 val=0; |
|
|
|
FELEM2 val=0; |
|
|
|
int i; |
|
|
|
int i; |
|
|
|
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]; |
|
|
|
} |
|
|
|
} |
|
|
|
OUT(dst[dst_index], val); |
|
|
|
OUT(dst[dst_index], val); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
frac += dst_incr_frac; |
|
|
|
frac += dst_incr_frac; |
|
|
|
index += dst_incr; |
|
|
|
index += dst_incr; |
|
|
|
if (frac >= c->src_incr) { |
|
|
|
if (frac >= c->src_incr) { |
|
|
|
frac -= c->src_incr; |
|
|
|
frac -= c->src_incr; |
|
|
|
index++; |
|
|
|
index++; |
|
|
|
} |
|
|
|
} |
|
|
|
sample_index += index >> c->phase_shift; |
|
|
|
sample_index += index >> c->phase_shift; |
|
|
|
index &= c->phase_mask; |
|
|
|
index &= c->phase_mask; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(update_ctx){ |
|
|
|
if(update_ctx){ |
|
|
|
c->frac= frac; |
|
|
|
c->frac= frac; |
|
|
|
c->index= index; |
|
|
|
c->index= index; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return sample_index; |
|
|
|
return sample_index; |
|
|
|
} |
|
|
|
} |
|
|
@ -167,44 +167,44 @@ int RENAME(swri_resample_linear)(ResampleContext *c, |
|
|
|
DELEM *dst, const DELEM *src, |
|
|
|
DELEM *dst, const DELEM *src, |
|
|
|
int n, int update_ctx) |
|
|
|
int n, int update_ctx) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int dst_index; |
|
|
|
int dst_index; |
|
|
|
int index= c->index; |
|
|
|
int index= c->index; |
|
|
|
int frac= c->frac; |
|
|
|
int frac= c->frac; |
|
|
|
int dst_incr_frac= c->dst_incr % c->src_incr; |
|
|
|
int dst_incr_frac= c->dst_incr % c->src_incr; |
|
|
|
int dst_incr= c->dst_incr / c->src_incr; |
|
|
|
int dst_incr= c->dst_incr / c->src_incr; |
|
|
|
int sample_index = index >> c->phase_shift; |
|
|
|
int sample_index = index >> c->phase_shift; |
|
|
|
|
|
|
|
|
|
|
|
index &= c->phase_mask; |
|
|
|
index &= c->phase_mask; |
|
|
|
for (dst_index = 0; dst_index < n; dst_index++) { |
|
|
|
for (dst_index = 0; dst_index < n; dst_index++) { |
|
|
|
FELEM *filter = ((FELEM *) c->filter_bank) + c->filter_alloc * index; |
|
|
|
FELEM *filter = ((FELEM *) c->filter_bank) + c->filter_alloc * index; |
|
|
|
FELEM2 val=0, v2 = 0; |
|
|
|
FELEM2 val=0, v2 = 0; |
|
|
|
|
|
|
|
|
|
|
|
#ifdef LINEAR_CORE |
|
|
|
#ifdef LINEAR_CORE |
|
|
|
LINEAR_CORE |
|
|
|
LINEAR_CORE |
|
|
|
#else |
|
|
|
#else |
|
|
|
int i; |
|
|
|
int i; |
|
|
|
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]; |
|
|
|
v2 += src[sample_index + i] * (FELEM2)filter[i + c->filter_alloc]; |
|
|
|
v2 += src[sample_index + i] * (FELEM2)filter[i + c->filter_alloc]; |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
val += (v2 - val) * (FELEML) frac / c->src_incr; |
|
|
|
val += (v2 - val) * (FELEML) frac / c->src_incr; |
|
|
|
OUT(dst[dst_index], val); |
|
|
|
OUT(dst[dst_index], val); |
|
|
|
|
|
|
|
|
|
|
|
frac += dst_incr_frac; |
|
|
|
frac += dst_incr_frac; |
|
|
|
index += dst_incr; |
|
|
|
index += dst_incr; |
|
|
|
if (frac >= c->src_incr) { |
|
|
|
if (frac >= c->src_incr) { |
|
|
|
frac -= c->src_incr; |
|
|
|
frac -= c->src_incr; |
|
|
|
index++; |
|
|
|
index++; |
|
|
|
} |
|
|
|
} |
|
|
|
sample_index += index >> c->phase_shift; |
|
|
|
sample_index += index >> c->phase_shift; |
|
|
|
index &= c->phase_mask; |
|
|
|
index &= c->phase_mask; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(update_ctx){ |
|
|
|
if(update_ctx){ |
|
|
|
c->frac= frac; |
|
|
|
c->frac= frac; |
|
|
|
c->index= index; |
|
|
|
c->index= index; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return sample_index; |
|
|
|
return sample_index; |
|
|
|
} |
|
|
|
} |
|
|
|