diff options
author | Niklas Haas <git@haasn.dev> | 2024-11-21 14:09:49 +0100 |
---|---|---|
committer | Niklas Haas <git@haasn.dev> | 2024-11-25 11:03:50 +0100 |
commit | 2a091d4f2ee1e367d05a6bbbe96b204257cbda87 (patch) | |
tree | ed2e2e2112b5589d69d1b527f462c199e80c4237 /libswscale/swscale_internal.h | |
parent | bf738412e849bcb8c63a330dfb814281b3d97f6b (diff) | |
download | ffmpeg-2a091d4f2ee1e367d05a6bbbe96b204257cbda87.tar.gz |
swscale: introduce new, dynamic scaling API
As part of a larger, ongoing effort to modernize and partially rewrite
libswscale, it was decided and generally agreed upon to introduce a new
public API for libswscale. This API is designed to be less stateful, more
explicitly defined, and considerably easier to use than the existing one.
Most of the API work has been already accomplished in the previous commits,
this commit merely introduces the ability to use sws_scale_frame()
dynamically, without prior sws_init_context() calls. Instead, the new API
takes frame properties from the frames themselves, and the implementation is
based on the new SwsGraph API, which we simply reinitialize as needed.
This high-level wrapper also recreates the logic that used to live inside
vf_scale for scaling interlaced frames, enabling it to be reused more easily
by end users.
Finally, this function is designed to simply copy refs directly when nothing
needs to be done, substantially improving throughput of the noop fast path.
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
Diffstat (limited to 'libswscale/swscale_internal.h')
-rw-r--r-- | libswscale/swscale_internal.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 195b853586..479b436a1e 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -26,6 +26,7 @@ #include "config.h" #include "swscale.h" +#include "graph.h" #include "libavutil/avassert.h" #include "libavutil/common.h" @@ -48,6 +49,8 @@ #define MAX_FILTER_SIZE SWS_MAX_FILTER_SIZE +#define SWS_MAX_THREADS 8192 /* sanity clamp */ + #if HAVE_BIGENDIAN #define ALT32_CORR (-1) #else @@ -323,6 +326,9 @@ struct SwsInternal { int *slice_err; int nb_slice_ctx; + /* Scaling graph, reinitialized dynamically as needed. */ + SwsGraph *graph[2]; /* top, bottom fields */ + // values passed to current sws_receive_slice() call int dst_slice_start; int dst_slice_height; @@ -663,6 +669,7 @@ struct SwsInternal { unsigned int dst_slice_align; atomic_int stride_unaligned_warned; atomic_int data_unaligned_warned; + int color_conversion_warned; Half2FloatTables *h2f_tables; }; @@ -674,7 +681,7 @@ static_assert(offsetof(SwsInternal, redDither) + DITHER32_INT == offsetof(SwsInt #if ARCH_X86_64 /* x86 yuv2gbrp uses the SwsInternal for yuv coefficients if struct offsets change the asm needs to be updated too */ -static_assert(offsetof(SwsInternal, yuv2rgb_y_offset) == 40316, +static_assert(offsetof(SwsInternal, yuv2rgb_y_offset) == 40332, "yuv2rgb_y_offset must be updated in x86 asm"); #endif |