swscale: Allow the max filter size to be set at compile time

This can help "extreme" resizes, e.g with some 4k stuff.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
pull/76/merge
Derek Buitenhuis 11 years ago
parent 681868cbbe
commit a4bd4733c0
  1. 6
      configure
  2. 2
      libswscale/swscale_internal.h
  3. 2
      libswscale/utils.c

6
configure vendored

@ -314,6 +314,7 @@ Advanced options (experts only):
(faster, but may crash) (faster, but may crash)
--enable-memalign-hack emulate memalign, interferes with memory debuggers --enable-memalign-hack emulate memalign, interferes with memory debuggers
--enable-sram allow use of on-chip SRAM --enable-sram allow use of on-chip SRAM
--sws-max-filter-size=N the max filter size swscale uses [$sws_max_filter_size_default]
Optimization options (experts only): Optimization options (experts only):
--disable-asm disable all assembler optimizations --disable-asm disable all assembler optimizations
@ -1892,6 +1893,7 @@ CMDLINE_SET="
ranlib ranlib
samples samples
strip strip
sws_max_filter_size
sysinclude sysinclude
sysroot sysroot
target_exec target_exec
@ -2646,6 +2648,9 @@ enable safe_bitstream_reader
enable static enable static
enable swscale_alpha enable swscale_alpha
sws_max_filter_size_default=256
set_default sws_max_filter_size
# Enable hwaccels by default. # Enable hwaccels by default.
enable dxva2 vaapi vda vdpau xvmc enable dxva2 vaapi vda vdpau xvmc
enable xlib enable xlib
@ -5451,6 +5456,7 @@ cat > $TMPH <<EOF
#define BUILDSUF "$build_suffix" #define BUILDSUF "$build_suffix"
#define SLIBSUF "$SLIBSUF" #define SLIBSUF "$SLIBSUF"
#define HAVE_MMX2 HAVE_MMXEXT #define HAVE_MMX2 HAVE_MMXEXT
#define SWS_MAX_FILTER_SIZE $sws_max_filter_size
EOF EOF
test -n "$assert_level" && test -n "$assert_level" &&

@ -39,7 +39,7 @@
#define YUVRGB_TABLE_HEADROOM 128 #define YUVRGB_TABLE_HEADROOM 128
#define MAX_FILTER_SIZE 256 #define MAX_FILTER_SIZE SWS_MAX_FILTER_SIZE
#define DITHER1XBPP #define DITHER1XBPP

@ -582,7 +582,7 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
goto fail; goto fail;
if (filterSize >= MAX_FILTER_SIZE * 16 / if (filterSize >= MAX_FILTER_SIZE * 16 /
((flags & SWS_ACCURATE_RND) ? APCK_SIZE : 16)) { ((flags & SWS_ACCURATE_RND) ? APCK_SIZE : 16)) {
av_log(NULL, AV_LOG_ERROR, "sws: filterSize %d is too large, try less extreme scaling or increase MAX_FILTER_SIZE and recompile\n", av_log(NULL, AV_LOG_ERROR, "sws: filterSize %d is too large, try less extreme scaling or set --sws-max-filter-size and recompile\n",
FF_CEIL_RSHIFT((filterSize+1) * ((flags & SWS_ACCURATE_RND) ? APCK_SIZE : 16), 4)); FF_CEIL_RSHIFT((filterSize+1) * ((flags & SWS_ACCURATE_RND) ? APCK_SIZE : 16), 4));
goto fail; goto fail;
} }

Loading…
Cancel
Save