summaryrefslogtreecommitdiffstats
path: root/audio/filter
diff options
context:
space:
mode:
Diffstat (limited to 'audio/filter')
-rw-r--r--audio/filter/af.c2
-rw-r--r--audio/filter/af_bs2b.c4
-rw-r--r--audio/filter/af_convert24.c4
-rw-r--r--audio/filter/af_convertsignendian.c107
4 files changed, 1 insertions, 116 deletions
diff --git a/audio/filter/af.c b/audio/filter/af.c
index 67083c493b..c0535f957c 100644
--- a/audio/filter/af.c
+++ b/audio/filter/af.c
@@ -56,7 +56,6 @@ extern const struct af_info af_info_scaletempo;
extern const struct af_info af_info_bs2b;
extern const struct af_info af_info_lavfi;
extern const struct af_info af_info_convert24;
-extern const struct af_info af_info_convertsignendian;
extern const struct af_info af_info_rubberband;
static const struct af_info *const filter_list[] = {
@@ -94,7 +93,6 @@ static const struct af_info *const filter_list[] = {
#endif
// Must come last, because they're fallback format conversion filter
&af_info_convert24,
- &af_info_convertsignendian,
NULL
};
diff --git a/audio/filter/af_bs2b.c b/audio/filter/af_bs2b.c
index 10d6f4e3fc..beb4dc9b96 100644
--- a/audio/filter/af_bs2b.c
+++ b/audio/filter/af_bs2b.c
@@ -57,12 +57,8 @@ static int filter_##name(struct af_instance *af, struct mp_audio *data) \
#define FILTERS \
FILTER(FLOAT, f) \
FILTER(S32, s32) \
- FILTER(U32, u32) \
FILTER(S24, s24) \
- FILTER(U24, u24) \
FILTER(S16, s16) \
- FILTER(U16, u16) \
- FILTER(S8, s8) \
FILTER(U8, u8)
#define FILTER DEF_FILTER
diff --git a/audio/filter/af_convert24.c b/audio/filter/af_convert24.c
index ab04c931b6..a81e84e2af 100644
--- a/audio/filter/af_convert24.c
+++ b/audio/filter/af_convert24.c
@@ -24,9 +24,7 @@
static bool test_conversion(int src_format, int dst_format)
{
- return (src_format == AF_FORMAT_U24 && dst_format == AF_FORMAT_U32) ||
- (src_format == AF_FORMAT_S24 && dst_format == AF_FORMAT_S32) ||
- (src_format == AF_FORMAT_U32 && dst_format == AF_FORMAT_U24) ||
+ return (src_format == AF_FORMAT_S24 && dst_format == AF_FORMAT_S32) ||
(src_format == AF_FORMAT_S32 && dst_format == AF_FORMAT_S24);
}
diff --git a/audio/filter/af_convertsignendian.c b/audio/filter/af_convertsignendian.c
deleted file mode 100644
index abbd260a0f..0000000000
--- a/audio/filter/af_convertsignendian.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * This file is part of mpv.
- *
- * mpv is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * mpv is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with mpv. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdlib.h>
-#include <assert.h>
-
-#include "af.h"
-#include "audio/format.h"
-#include "osdep/endian.h"
-
-static bool test_conversion(int src_format, int dst_format)
-{
- if ((src_format & AF_FORMAT_PLANAR) ||
- (dst_format & AF_FORMAT_PLANAR))
- return false;
- if (((src_format & ~AF_FORMAT_SIGN_MASK) ==
- (dst_format & ~AF_FORMAT_SIGN_MASK)) &&
- ((src_format & AF_FORMAT_TYPE_MASK) == AF_FORMAT_I))
- return true;
- return false;
-}
-
-static int control(struct af_instance *af, int cmd, void *arg)
-{
- switch (cmd) {
- case AF_CONTROL_REINIT: {
- struct mp_audio *in = arg;
- struct mp_audio orig_in = *in;
- struct mp_audio *out = af->data;
-
- if (!test_conversion(in->format, out->format))
- return AF_DETACH;
-
- out->rate = in->rate;
- mp_audio_set_channels(out, &in->channels);
-
- return mp_audio_config_equals(in, &orig_in) ? AF_OK : AF_FALSE;
- }
- case AF_CONTROL_SET_FORMAT: {
- mp_audio_set_format(af->data, *(int*)arg);
- return AF_OK;
- }
- }
- return AF_UNKNOWN;
-}
-
-static void si2us(void *data, int len, int bps)
-{
- ptrdiff_t i = -(len * bps);
- uint8_t *p = &((uint8_t *)data)[len * bps];
- if (BYTE_ORDER == LITTLE_ENDIAN && bps > 1)
- p += bps - 1;
- if (len <= 0)
- return;
- do {
- p[i] ^= 0x80;
- } while (i += bps);
-}
-
-static int filter(struct af_instance *af, struct mp_audio *data)
-{
- if (!data)
- return 0;
- if (af_make_writeable(af, data) < 0) {
- talloc_free(data);
- return -1;
- }
-
- int infmt = data->format;
- int outfmt = af->data->format;
- size_t len = data->samples * data->nch;
-
- if ((infmt & AF_FORMAT_SIGN_MASK) != (outfmt & AF_FORMAT_SIGN_MASK))
- si2us(data->planes[0], len, data->bps);
-
- mp_audio_set_format(data, outfmt);
- af_add_output_frame(af, data);
- return 0;
-}
-
-static int af_open(struct af_instance *af)
-{
- af->control = control;
- af->filter_frame = filter;
- return AF_OK;
-}
-
-const struct af_info af_info_convertsignendian = {
- .info = "Convert between sample format sign",
- .name = "convertsign",
- .open = af_open,
- .test_conversion = test_conversion,
-};