summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2022-03-18 12:46:13 +0100
committerNiklas Haas <github-daiK1o@haasn.dev>2022-06-23 23:52:35 +0200
commit8da6b355f84381f932281a290a7a416ea4e7b3f2 (patch)
treef2ae8c83fa36ea8e80ee8bd8830237c6ff86ab32
parent3694af60769a58d491011ea42f208ffcb7181d9a (diff)
downloadmpv-8da6b355f84381f932281a290a7a416ea4e7b3f2.tar.bz2
mpv-8da6b355f84381f932281a290a7a416ea4e7b3f2.tar.xz
swresample: don't forcibly clip on every conversion
This was introduced in 04257417 without a clear explanation of the bug it was solving, so I have no idea if it's still needed (or why it ever was). And it definitely creates unexpected behavior, e.g. forced clipping when converting between float and floatp. I therefore think we should simply remove this logic and see if it regresses anything else, then fix those other bugs *properly* (if they're still around). Fixes #9979
-rw-r--r--filters/f_swresample.c22
1 files changed, 0 insertions, 22 deletions
diff --git a/filters/f_swresample.c b/filters/f_swresample.c
index 4f26d82a59..fb0980e5b4 100644
--- a/filters/f_swresample.c
+++ b/filters/f_swresample.c
@@ -327,26 +327,6 @@ static void reset(struct mp_filter *f)
close_lavrr(p);
}
-static void extra_output_conversion(struct mp_aframe *mpa)
-{
- int format = af_fmt_from_planar(mp_aframe_get_format(mpa));
- int num_planes = mp_aframe_get_planes(mpa);
- uint8_t **planes = mp_aframe_get_data_rw(mpa);
- if (!planes)
- return;
- for (int p = 0; p < num_planes; p++) {
- void *ptr = planes[p];
- int total = mp_aframe_get_total_plane_samples(mpa);
- if (format == AF_FORMAT_FLOAT) {
- for (int s = 0; s < total; s++)
- ((float *)ptr)[s] = av_clipf(((float *)ptr)[s], -1.0f, 1.0f);
- } else if (format == AF_FORMAT_DOUBLE) {
- for (int s = 0; s < total; s++)
- ((double *)ptr)[s] = MPCLAMP(((double *)ptr)[s], -1.0, 1.0);
- }
- }
-}
-
// This relies on the tricky way mpa was allocated.
static bool reorder_planes(struct mp_aframe *mpa, int *reorder,
struct mp_chmap *newmap)
@@ -451,8 +431,6 @@ static struct mp_frame filter_resample_output(struct priv *p,
goto error;
}
- extra_output_conversion(out);
-
if (in) {
mp_aframe_copy_attributes(out, in);
p->current_pts = mp_aframe_end_pts(in);