Hi Niklas On Sat, Nov 16, 2024 at 12:24:59PM +0100, Niklas Haas wrote: > From: Niklas Haas <g...@haasn.dev> > > Following in the footsteps of the work in the previous commit, it's now > relatively straightforward to expose the options struct publicly as > SwsContext. This is a step towards making this more user friendly, as > well as following API conventions established elsewhere. > > Sponsored-by: Sovereign Tech Fund > Signed-off-by: Niklas Haas <g...@haasn.dev> > --- > libswscale/swscale.h | 93 +++++++++++++++++++++++-- > libswscale/swscale_internal.h | 45 +------------ > libswscale/utils.c | 123 +++++++++++++++------------------- > 3 files changed, 144 insertions(+), 117 deletions(-) > > diff --git a/libswscale/swscale.h b/libswscale/swscale.h > index 50c705ae06..4baef532b6 100644 > --- a/libswscale/swscale.h > +++ b/libswscale/swscale.h > @@ -42,8 +42,6 @@ > #include "version.h" > #endif > > -typedef struct SwsContext SwsContext; > - > /** > * @defgroup libsws libswscale > * Color conversion and scaling library. > @@ -65,17 +63,98 @@ const char *swscale_configuration(void); > const char *swscale_license(void); > > /** > - * Get the AVClass for swsContext. It can be used in combination with > + * Get the AVClass for SwsContext. It can be used in combination with > * AV_OPT_SEARCH_FAKE_OBJ for examining options. > * > * @see av_opt_find(). > */ > const AVClass *sws_get_class(void); > > -/** > - * Allocate an empty SwsContext. This must be filled and passed to > - * sws_init_context(). For filling see AVOptions, options.c and > - * sws_setColorspaceDetails(). > +/****************************** > + * Flags and quality settings * > + ******************************/ > + > +typedef enum SwsDither { > + SWS_DITHER_NONE = 0, /* disable dithering */ > + SWS_DITHER_AUTO, /* auto-select from preset */ > + SWS_DITHER_BAYER, /* ordered dither matrix */ > + SWS_DITHER_ED, /* error diffusion */ > + SWS_DITHER_A_DITHER, /* arithmetic addition */ > + SWS_DITHER_X_DITHER, /* arithmetic xor */ > + SWS_DITHER_NB, /* not part of the ABI */ > +} SwsDither; > + > +typedef enum SwsAlphaBlend { > + SWS_ALPHA_BLEND_NONE = 0, > + SWS_ALPHA_BLEND_UNIFORM, > + SWS_ALPHA_BLEND_CHECKERBOARD, > + SWS_ALPHA_BLEND_NB, /* not part of the ABI */ > +} SwsAlphaBlend; > + > +/*********************************** > + * Context creation and management * > + ***********************************/ > + > +/** > + * Main external API structure. New fields can be added to the end with > + * minor version bumps. Removal, reordering and changes to existing fields > + * require a major version bump. sizeof(SwsContext) is not part of the ABI. > + */ > +typedef struct SwsContext { > + const AVClass *av_class; > + > + /** > + * Private data of the user, can be used to carry app specific stuff. > + */ > + void *opaque; > +
> + /** > + * Bitmask of SWS_*. > + */ > + unsigned flags; uint64_t seems more future proof > + > + /** > + * Extra parameters for fine-tuning certain scalers. > + */ > + double scaler_params[2]; > + > + /** > + * How many threads to use for processing, or 0 for automatic selection. > + */ > + int threads; > + > + /** > + * Dither mode. > + */ > + SwsDither dither; > + > + /** > + * Alpha blending mode. See `SwsAlphaBlend` for details. > + */ > + SwsAlphaBlend alpha_blend; Is this intended to be used with AVOptions ? enums as type can be problematic IIRC patch should be ok otherwise thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Dictatorship: All citizens are under surveillance, all their steps and actions recorded, for the politicians to enforce control. Democracy: All politicians are under surveillance, all their steps and actions recorded, for the citizens to enforce control.
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".