Commit 2d16b838 authored by Paul B Mahol's avatar Paul B Mahol

avfilter/af_surround: check for invalid magnitude and phase difference

parent e1e0f94d
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "libavutil/avassert.h"
#include "libavutil/audio_fifo.h" #include "libavutil/audio_fifo.h"
#include "libavutil/channel_layout.h" #include "libavutil/channel_layout.h"
#include "libavutil/opt.h" #include "libavutil/opt.h"
...@@ -335,6 +336,8 @@ static void stereo_transform(float *x, float *y, float angle) ...@@ -335,6 +336,8 @@ static void stereo_transform(float *x, float *y, float angle)
static void stereo_position(float a, float p, float *x, float *y) static void stereo_position(float a, float p, float *x, float *y)
{ {
av_assert2(a >= -1.f && a <= 1.f);
av_assert2(p >= 0.f && p <= M_PI);
*x = av_clipf(a+FFMAX(0, sinf(p-M_PI_2))*FFDIFFSIGN(a,0), -1, 1); *x = av_clipf(a+FFMAX(0, sinf(p-M_PI_2))*FFDIFFSIGN(a,0), -1, 1);
*y = av_clipf(cosf(a*M_PI_2+M_PI)*cosf(M_PI_2-p/M_PI)*M_LN10+1, -1, 1); *y = av_clipf(cosf(a*M_PI_2+M_PI)*cosf(M_PI_2-p/M_PI)*M_LN10+1, -1, 1);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment