diff options
Diffstat (limited to 'chromium/third_party/ffmpeg/libswresample/resample.c')
-rw-r--r-- | chromium/third_party/ffmpeg/libswresample/resample.c | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/chromium/third_party/ffmpeg/libswresample/resample.c b/chromium/third_party/ffmpeg/libswresample/resample.c index 8b1b6ca9aff..0ce74d076cf 100644 --- a/chromium/third_party/ffmpeg/libswresample/resample.c +++ b/chromium/third_party/ffmpeg/libswresample/resample.c @@ -95,7 +95,7 @@ static int build_filter(ResampleContext *c, void *filter, double factor, int tap int filter_type, int kaiser_beta){ int ph, i; double x, y, w; - double *tab = av_malloc(tap_count * sizeof(*tab)); + double *tab = av_malloc_array(tap_count, sizeof(*tab)); const int center= (tap_count-1)/2; if (!tab) @@ -229,6 +229,11 @@ static ResampleContext *resample_init(ResampleContext *c, int out_rate, int in_r av_assert0(0); } + if (filter_size/factor > INT32_MAX/256) { + av_log(NULL, AV_LOG_ERROR, "Filter length too large\n"); + goto error; + } + c->phase_shift = phase_shift; c->phase_mask = phase_count - 1; c->linear = linear; @@ -302,10 +307,20 @@ static int set_compensation(ResampleContext *c, int sample_delta, int compensati #include "resample_template.c" #undef TEMPLATE_RESAMPLE_S16_MMX2 -#if HAVE_SSSE3_INLINE -#define TEMPLATE_RESAMPLE_S16_SSSE3 +#if HAVE_SSE_INLINE +#define TEMPLATE_RESAMPLE_FLT_SSE +#include "resample_template.c" +#undef TEMPLATE_RESAMPLE_FLT_SSE +#endif + +#if HAVE_SSE2_INLINE +#define TEMPLATE_RESAMPLE_S16_SSE2 +#include "resample_template.c" +#undef TEMPLATE_RESAMPLE_S16_SSE2 + +#define TEMPLATE_RESAMPLE_DBL_SSE2 #include "resample_template.c" -#undef TEMPLATE_RESAMPLE_S16_SSSE3 +#undef TEMPLATE_RESAMPLE_DBL_SSE2 #endif #endif // HAVE_MMXEXT_INLINE @@ -317,8 +332,8 @@ static int multiple_resample(ResampleContext *c, AudioData *dst, int dst_size, A for(i=0; i<dst->ch_count; i++){ #if HAVE_MMXEXT_INLINE -#if HAVE_SSSE3_INLINE - if(c->format == AV_SAMPLE_FMT_S16P && (mm_flags&AV_CPU_FLAG_SSSE3)) ret= swri_resample_int16_ssse3(c, (int16_t*)dst->ch[i], (const int16_t*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); +#if HAVE_SSE2_INLINE + if(c->format == AV_SAMPLE_FMT_S16P && (mm_flags&AV_CPU_FLAG_SSE2)) ret= swri_resample_int16_sse2 (c, (int16_t*)dst->ch[i], (const int16_t*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); else #endif if(c->format == AV_SAMPLE_FMT_S16P && (mm_flags&AV_CPU_FLAG_MMX2 )){ @@ -328,7 +343,15 @@ static int multiple_resample(ResampleContext *c, AudioData *dst, int dst_size, A #endif if(c->format == AV_SAMPLE_FMT_S16P) ret= swri_resample_int16(c, (int16_t*)dst->ch[i], (const int16_t*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); else if(c->format == AV_SAMPLE_FMT_S32P) ret= swri_resample_int32(c, (int32_t*)dst->ch[i], (const int32_t*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); +#if HAVE_SSE_INLINE + else if(c->format == AV_SAMPLE_FMT_FLTP && (mm_flags&AV_CPU_FLAG_SSE)) + ret= swri_resample_float_sse (c, (float*)dst->ch[i], (const float*)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); +#endif else if(c->format == AV_SAMPLE_FMT_FLTP) ret= swri_resample_float(c, (float *)dst->ch[i], (const float *)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); +#if HAVE_SSE2_INLINE + else if(c->format == AV_SAMPLE_FMT_DBLP && (mm_flags&AV_CPU_FLAG_SSE2)) + ret= swri_resample_double_sse2(c,(double *)dst->ch[i], (const double *)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); +#endif else if(c->format == AV_SAMPLE_FMT_DBLP) ret= swri_resample_double(c,(double *)dst->ch[i], (const double *)src->ch[i], consumed, src_size, dst_size, i+1==dst->ch_count); } if(need_emms) |