summaryrefslogtreecommitdiff
path: root/libavresample/resample_template.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2014-03-04 16:56:01 +0100
committerAnton Khirnov <anton@khirnov.net>2014-04-11 16:33:46 +0200
commitbe394968c81019887ef996a78a526bdd85d1e216 (patch)
tree2d4f8cd14fbf12b98aa115f3e711d8dd04af6be3 /libavresample/resample_template.c
parenteed752d61da332fb13e9893a175a90fed7b1d7d3 (diff)
resample: add initial padding explicitly
This simplifies the code, since we do not have to deal with a possibly negative source index anymore.
Diffstat (limited to 'libavresample/resample_template.c')
-rw-r--r--libavresample/resample_template.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/libavresample/resample_template.c b/libavresample/resample_template.c
index a7cb6aeb9e..661dd0dd76 100644
--- a/libavresample/resample_template.c
+++ b/libavresample/resample_template.c
@@ -54,7 +54,7 @@
#define DBL_TO_FELEM(d, v) d = av_clip_int16(lrint(v * (1 << 15)))
#endif
-static void SET_TYPE(resample_nearest)(void *dst0, int dst_index, const void *src0, int index)
+static void SET_TYPE(resample_nearest)(void *dst0, int dst_index, const void *src0, unsigned int index)
{
FELEM *dst = dst0;
const FELEM *src = src0;
@@ -63,21 +63,17 @@ static void SET_TYPE(resample_nearest)(void *dst0, int dst_index, const void *sr
static void SET_TYPE(resample_one)(ResampleContext *c,
void *dst0, int dst_index, const void *src0,
- int src_size, int index, int frac)
+ unsigned int index, int frac)
{
FELEM *dst = dst0;
const FELEM *src = src0;
int i;
- int sample_index = index >> c->phase_shift;
+ unsigned int sample_index = index >> c->phase_shift;
FELEM2 val = 0;
FELEM *filter = ((FELEM *)c->filter_bank) +
c->filter_length * (index & c->phase_mask);
- if (sample_index < 0) {
- for (i = 0; i < c->filter_length; i++)
- val += src[FFABS(sample_index + i) % src_size] *
- (FELEM2)filter[i];
- } else if (c->linear) {
+ if (c->linear) {
FELEM2 v2 = 0;
for (i = 0; i < c->filter_length; i++) {
val += src[sample_index + i] * (FELEM2)filter[i];