summaryrefslogtreecommitdiff
path: root/libavresample/resample_template.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2014-03-03 22:26:57 +0100
committerAnton Khirnov <anton@khirnov.net>2014-04-11 16:26:36 +0200
commitf20892eb67a7b4b5a3c080388a35a3380516a805 (patch)
tree179aaaf0886c0a48701f62abd7f23a63a465f002 /libavresample/resample_template.c
parentb9dea23766f52b8e059e72d34980bb7b456efe8f (diff)
resample: split the nearest neighbour path into a separate function pointer
Diffstat (limited to 'libavresample/resample_template.c')
-rw-r--r--libavresample/resample_template.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/libavresample/resample_template.c b/libavresample/resample_template.c
index cd69eb8b44..a58193991c 100644
--- a/libavresample/resample_template.c
+++ b/libavresample/resample_template.c
@@ -54,16 +54,20 @@
#define DBL_TO_FELEM(d, v) d = av_clip_int16(lrint(v * (1 << 15)))
#endif
-static void SET_TYPE(resample_one)(ResampleContext *c, int no_filter,
+static void SET_TYPE(resample_nearest)(void *dst0, int dst_index, const void *src0, int index)
+{
+ FELEM *dst = dst0;
+ const FELEM *src = src0;
+ dst[dst_index] = src[index];
+}
+
+static void SET_TYPE(resample_one)(ResampleContext *c,
void *dst0, int dst_index, const void *src0,
int src_size, int index, int frac)
{
FELEM *dst = dst0;
const FELEM *src = src0;
- if (no_filter) {
- dst[dst_index] = src[index];
- } else {
int i;
int sample_index = index >> c->phase_shift;
FELEM2 val = 0;
@@ -87,7 +91,6 @@ static void SET_TYPE(resample_one)(ResampleContext *c, int no_filter,
}
OUT(dst[dst_index], val);
- }
}
static void SET_TYPE(set_filter)(void *filter0, double *tab, int phase,