Documentation ¶
Index ¶
- Constants
- func SwsConvertPalette8ToPacked24(src unsafe.Pointer, dst unsafe.Pointer, numPixels int, palette *ctypes.UInt8)
- func SwsConvertPalette8ToPacked32(src unsafe.Pointer, dst unsafe.Pointer, numPixels int, palette *ctypes.UInt8)
- func SwsFrameEnd(c *CSwsContext)
- func SwsFrameStart(c *CSwsContext, dst *avutil.CAVFrame, src *avutil.CAVFrame) int
- func SwsFreeContext(swsContext *CSwsContext)
- func SwsFreeFilter(filter *CSwsFilter)
- func SwsFreeVec(a *CSwsVector)
- func SwsGetClass() *avutil.CAVClass
- func SwsGetCoefficients(colorspace int) unsafe.Pointer
- func SwsGetColorspaceDetails(c *CSwsContext, invTable **ctypes.Int, srcRange *ctypes.Int, ...) int
- func SwsInitContext(sws_context *CSwsContext, srcFilter *CSwsFilter, dstFilter *CSwsFilter) int
- func SwsIsSupportedEndiannessConversion(pixFmt avutil.CAVPixelFormat) int
- func SwsIsSupportedInput(pixFmt avutil.CAVPixelFormat) int
- func SwsIsSupportedOutput(pixFmt avutil.CAVPixelFormat) int
- func SwsNormalizeVec(a *CSwsVector, height float64)
- func SwsReceiveSlice(c *CSwsContext, sliceStart uint, sliceHeight uint) int
- func SwsReceiveSliceAlignment(c *CSwsContext) uint
- func SwsScale(c *CSwsContext, srcSlice []unsafe.Pointer, srcStride []ctypes.Int, ...) int
- func SwsScaleFrame(c *CSwsContext, dst *avutil.CAVFrame, src *avutil.CAVFrame) int
- func SwsScaleVec(a *CSwsVector, scalar float64)
- func SwsSendSlice(c *CSwsContext, sliceStart uint, sliceHeight uint) int
- func SwsSetColorspaceDetails(c *CSwsContext, invTable [4]int, srcRange int, table [4]int, dstRange int, ...) int
- func SwscaleConfiguration() string
- func SwscaleLicense() string
- func SwscaleVersion() uint
- type CSwsContext
- type CSwsFilter
- type CSwsVector
Constants ¶
View Source
const ( SWS_FAST_BILINEAR = C.SWS_FAST_BILINEAR SWS_BILINEAR = C.SWS_BILINEAR SWS_BICUBIC = C.SWS_BICUBIC SWS_X = C.SWS_X SWS_POINT = C.SWS_POINT SWS_AREA = C.SWS_AREA SWS_BICUBLIN = C.SWS_BICUBLIN SWS_GAUSS = C.SWS_GAUSS SWS_SINC = C.SWS_SINC SWS_LANCZOS = C.SWS_LANCZOS SWS_SPLINE = C.SWS_SPLINE )
values for the flags, the stuff on the command line is different
View Source
const ( SWS_SRC_V_CHR_DROP_MASK = C.SWS_SRC_V_CHR_DROP_MASK SWS_SRC_V_CHR_DROP_SHIFT = C.SWS_SRC_V_CHR_DROP_SHIFT )
View Source
const ( SWS_FULL_CHR_H_INP = C.SWS_FULL_CHR_H_INP SWS_DIRECT_BGR = C.SWS_DIRECT_BGR SWS_ACCURATE_RND = C.SWS_ACCURATE_RND SWS_BITEXACT = C.SWS_BITEXACT SWS_ERROR_DIFFUSION = C.SWS_ERROR_DIFFUSION )
input subsampling info
View Source
const ( SWS_CS_ITU709 = C.SWS_CS_ITU709 SWS_CS_FCC = C.SWS_CS_FCC SWS_CS_ITU601 = C.SWS_CS_ITU601 SWS_CS_ITU624 = C.SWS_CS_ITU624 SWS_CS_SMPTE170M = C.SWS_CS_SMPTE170M SWS_CS_SMPTE240M = C.SWS_CS_SMPTE240M SWS_CS_DEFAULT = C.SWS_CS_DEFAULT SWS_CS_BT2020 = C.SWS_CS_BT2020 )
View Source
const LIBSWSCALE_BUILD = C.LIBSWSCALE_BUILD
View Source
const LIBSWSCALE_IDENT = C.LIBSWSCALE_IDENT
View Source
const LIBSWSCALE_VERSION_INT = C.LIBSWSCALE_VERSION_INT
View Source
const LIBSWSCALE_VERSION_MAJOR = C.LIBSWSCALE_VERSION_MAJOR
View Source
const LIBSWSCALE_VERSION_MICRO = C.LIBSWSCALE_VERSION_MICRO
View Source
const LIBSWSCALE_VERSION_MINOR = C.LIBSWSCALE_VERSION_MINOR
View Source
const SWS_FULL_CHR_H_INT = C.SWS_FULL_CHR_H_INT
the following 3 flags are not completely implemented internal chrominance subsampling info
View Source
const SWS_MAX_REDUCE_CUTOFF = C.SWS_MAX_REDUCE_CUTOFF
View Source
const SWS_PARAM_DEFAULT = C.SWS_PARAM_DEFAULT
View Source
const SWS_PRINT_INFO = C.SWS_PRINT_INFO
Variables ¶
This section is empty.
Functions ¶
func SwsConvertPalette8ToPacked24 ¶
func SwsConvertPalette8ToPacked24(src unsafe.Pointer, dst unsafe.Pointer, numPixels int, palette *ctypes.UInt8)
*
- Convert an 8-bit paletted frame into a frame with a color depth of 24 bits. *
- With the palette format "ABCD", the destination frame ends up with the format "ABC". *
- @param src source frame buffer
- @param dst destination frame buffer
- @param num_pixels number of pixels to convert
- @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src
func SwsConvertPalette8ToPacked32 ¶
func SwsConvertPalette8ToPacked32(src unsafe.Pointer, dst unsafe.Pointer, numPixels int, palette *ctypes.UInt8)
*
- Convert an 8-bit paletted frame into a frame with a color depth of 32 bits. *
- The output frame will have the same packed format as the palette. *
- @param src source frame buffer
- @param dst destination frame buffer
- @param num_pixels number of pixels to convert
- @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src
func SwsFrameEnd ¶
func SwsFrameEnd(c *CSwsContext)
*
- Finish the scaling process for a pair of source/destination frames previously
- submitted with sws_frame_start(). Must be called after all sws_send_slice()
- and sws_receive_slice() calls are done, before any new sws_frame_start()
- calls. *
- @param c The scaling context
func SwsFrameStart ¶
*
- Initialize the scaling process for a given pair of source/destination frames.
- Must be called before any calls to sws_send_slice() and sws_receive_slice(). *
- This function will retain references to src and dst, so they must both use
- refcounted buffers (if allocated by the caller, in case of dst). *
- @param c The scaling context
- @param dst The destination frame. *
- The data buffers may either be already allocated by the caller or
- left clear, in which case they will be allocated by the scaler.
- The latter may have performance advantages - e.g. in certain cases
- some output planes may be references to input planes, rather than
- copies. *
- Output data will be written into this frame in successful
- sws_receive_slice() calls.
- @param src The source frame. The data buffers must be allocated, but the
- frame data does not have to be ready at this point. Data
- availability is then signalled by sws_send_slice().
- @return 0 on success, a negative AVERROR code on failure *
- @see sws_frame_end()
func SwsFreeContext ¶
func SwsFreeContext(swsContext *CSwsContext)
*
- Free the swscaler context swsContext.
- If swsContext is NULL, then does nothing.
func SwsFreeFilter ¶
func SwsFreeFilter(filter *CSwsFilter)
func SwsFreeVec ¶
func SwsFreeVec(a *CSwsVector)
func SwsGetClass ¶
*
- Get the AVClass for swsContext. It can be used in combination with
- AV_OPT_SEARCH_FAKE_OBJ for examining options. *
- @see av_opt_find().
func SwsGetCoefficients ¶
*
- Return a pointer to yuv<->rgb coefficients for the given colorspace
- suitable for sws_setColorspaceDetails(). *
- @param colorspace One of the SWS_CS_* macros. If invalid,
- SWS_CS_DEFAULT is used.
func SwsGetColorspaceDetails ¶
func SwsGetColorspaceDetails(c *CSwsContext, invTable **ctypes.Int, srcRange *ctypes.Int, table **ctypes.Int, dstRange *ctypes.Int, brightness *ctypes.Int, contrast *ctypes.Int, saturation *ctypes.Int) int
*
- @return A negative error code on error, non negative otherwise.
- If `LIBSWSCALE_VERSION_MAJOR < 7`, returns -1 if not supported.
func SwsInitContext ¶
func SwsInitContext(sws_context *CSwsContext, srcFilter *CSwsFilter, dstFilter *CSwsFilter) int
*
- Initialize the swscaler context sws_context. *
- @return zero or positive value on success, a negative value on
- error
func SwsIsSupportedEndiannessConversion ¶
func SwsIsSupportedEndiannessConversion(pixFmt avutil.CAVPixelFormat) int
*
- @param[in] pix_fmt the pixel format
- @return a positive value if an endianness conversion for pix_fmt is
- supported, 0 otherwise.
func SwsIsSupportedInput ¶
func SwsIsSupportedInput(pixFmt avutil.CAVPixelFormat) int
*
- Return a positive value if pix_fmt is a supported input format, 0
- otherwise.
func SwsIsSupportedOutput ¶
func SwsIsSupportedOutput(pixFmt avutil.CAVPixelFormat) int
*
- Return a positive value if pix_fmt is a supported output format, 0
- otherwise.
func SwsNormalizeVec ¶
func SwsNormalizeVec(a *CSwsVector, height float64)
*
- Scale all the coefficients of a so that their sum equals height.
func SwsReceiveSlice ¶
func SwsReceiveSlice(c *CSwsContext, sliceStart uint, sliceHeight uint) int
*
- Request a horizontal slice of the output data to be written into the frame
- previously provided to sws_frame_start(). *
- @param c The scaling context
- @param slice_start first row of the slice; must be a multiple of
- sws_receive_slice_alignment()
- @param slice_height number of rows in the slice; must be a multiple of
- sws_receive_slice_alignment(), except for the last slice
- (i.e. when slice_start+slice_height is equal to output
- frame height) *
- @return a non-negative number if the data was successfully written into the output
- AVERROR(EAGAIN) if more input data needs to be provided before the
- output can be produced
- another negative AVERROR code on other kinds of scaling failure
func SwsReceiveSliceAlignment ¶
func SwsReceiveSliceAlignment(c *CSwsContext) uint
*
- Get the alignment required for slices *
- @param c The scaling context
- @return alignment required for output slices requested with sws_receive_slice().
- Slice offsets and sizes passed to sws_receive_slice() must be
- multiples of the value returned from this function.
func SwsScale ¶
func SwsScale(c *CSwsContext, srcSlice []unsafe.Pointer, srcStride []ctypes.Int, srcSliceY int, srcSliceH int, dst []unsafe.Pointer, dstStride []ctypes.Int) int
*
- Scale the image slice in srcSlice and put the resulting scaled
- slice in the image in dst. A slice is a sequence of consecutive
- rows in an image. *
- Slices have to be provided in sequential order, either in
- top-bottom or bottom-top order. If slices are provided in
- non-sequential order the behavior of the function is undefined. *
- @param c the scaling context previously created with
- sws_getContext()
- @param srcSlice the array containing the pointers to the planes of
- the source slice
- @param srcStride the array containing the strides for each plane of
- the source image
- @param srcSliceY the position in the source image of the slice to
- process, that is the number (counted starting from
- zero) in the image of the first row of the slice
- @param srcSliceH the height of the source slice, that is the number
- of rows in the slice
- @param dst the array containing the pointers to the planes of
- the destination image
- @param dstStride the array containing the strides for each plane of
- the destination image
- @return the height of the output slice
func SwsScaleFrame ¶
*
- Scale source data from src and write the output to dst. *
- This is merely a convenience wrapper around
- - sws_frame_start()
- - sws_send_slice(0, src->height)
- - sws_receive_slice(0, dst->height)
- - sws_frame_end() *
- @param c The scaling context
- @param dst The destination frame. See documentation for sws_frame_start() for
- more details.
- @param src The source frame. *
- @return 0 on success, a negative AVERROR code on failure
func SwsScaleVec ¶
func SwsScaleVec(a *CSwsVector, scalar float64)
*
- Scale all the coefficients of a by the scalar value.
func SwsSendSlice ¶
func SwsSendSlice(c *CSwsContext, sliceStart uint, sliceHeight uint) int
*
- Indicate that a horizontal slice of input data is available in the source
- frame previously provided to sws_frame_start(). The slices may be provided in
- any order, but may not overlap. For vertically subsampled pixel formats, the
- slices must be aligned according to subsampling. *
- @param c The scaling context
- @param slice_start first row of the slice
- @param slice_height number of rows in the slice *
- @return a non-negative number on success, a negative AVERROR code on failure.
func SwsSetColorspaceDetails ¶
func SwsSetColorspaceDetails(c *CSwsContext, invTable [4]int, srcRange int, table [4]int, dstRange int, brightness int, contrast int, saturation int) int
*
- @param c the scaling context
- @param dstRange flag indicating the while-black range of the output (1=jpeg / 0=mpeg)
- @param srcRange flag indicating the while-black range of the input (1=jpeg / 0=mpeg)
- @param table the yuv2rgb coefficients describing the output yuv space, normally ff_yuv2rgb_coeffs[x]
- @param inv_table the yuv2rgb coefficients describing the input yuv space, normally ff_yuv2rgb_coeffs[x]
- @param brightness 16.16 fixed point brightness correction
- @param contrast 16.16 fixed point contrast correction
- @param saturation 16.16 fixed point saturation correction *
- @return A negative error code on error, non negative otherwise.
- If `LIBSWSCALE_VERSION_MAJOR < 7`, returns -1 if not supported.
func SwscaleConfiguration ¶
func SwscaleConfiguration() string
*
- Return the libswscale build-time configuration.
func SwscaleVersion ¶
func SwscaleVersion() uint
*
- @defgroup libsws libswscale
- Color conversion and scaling library. *
- @{ *
- Return the LIBSWSCALE_VERSION_INT constant.
Types ¶
type CSwsContext ¶
type CSwsContext C.struct_SwsContext
func SwsAllocContext ¶
func SwsAllocContext() *CSwsContext
*
- Allocate an empty SwsContext. This must be filled and passed to
- sws_init_context(). For filling see AVOptions, options.c and
- sws_setColorspaceDetails().
func SwsGetCachedContext ¶
func SwsGetCachedContext(context *CSwsContext, srcW int, srcH int, srcFormat avutil.CAVPixelFormat, dstW int, dstH int, dstFormat avutil.CAVPixelFormat, flags int, srcFilter *CSwsFilter, dstFilter *CSwsFilter, param *float64) *CSwsContext
*
- Check if context can be reused, otherwise reallocate a new one. *
- If context is NULL, just calls sws_getContext() to get a new
- context. Otherwise, checks if the parameters are the ones already
- saved in context. If that is the case, returns the current
- context. Otherwise, frees context and gets a new context with
- the new parameters. *
- Be warned that srcFilter and dstFilter are not checked, they
- are assumed to remain the same.
func SwsGetContext ¶
func SwsGetContext(srcW int, srcH int, srcFormat avutil.CAVPixelFormat, dstW int, dstH int, dstFormat avutil.CAVPixelFormat, flags int, srcFilter *CSwsFilter, dstFilter *CSwsFilter, param *float64) *CSwsContext
*
- Allocate and return an SwsContext. You need it to perform
- scaling/conversion operations using sws_scale(). *
- @param srcW the width of the source image
- @param srcH the height of the source image
- @param srcFormat the source image format
- @param dstW the width of the destination image
- @param dstH the height of the destination image
- @param dstFormat the destination image format
- @param flags specify which algorithm and options to use for rescaling
- @param param extra parameters to tune the used scaler
- For SWS_BICUBIC param[0] and [1] tune the shape of the basis
- function, param[0] tunes f(1) and param[1] f´(1)
- For SWS_GAUSS param[0] tunes the exponent and thus cutoff
- frequency
- For SWS_LANCZOS param[0] tunes the width of the window function
- @return a pointer to an allocated context, or NULL in case of error
- @note this function is to be removed after a saner alternative is
- written
type CSwsFilter ¶
vectors can be shared
func SwsGetDefaultFilter ¶
func (CSwsFilter) GetChrH ¶
func (sf CSwsFilter) GetChrH() *CSwsVector
func (CSwsFilter) GetChrV ¶
func (sf CSwsFilter) GetChrV() *CSwsVector
func (CSwsFilter) GetLumH ¶
func (sf CSwsFilter) GetLumH() *CSwsVector
func (CSwsFilter) GetLumV ¶
func (sf CSwsFilter) GetLumV() *CSwsVector
type CSwsVector ¶
when used for filters they must have an odd number of elements coeffs cannot be shared between vectors
func SwsAllocVec ¶
func SwsAllocVec(length int) *CSwsVector
*
- Allocate and return an uninitialized vector with length coefficients.
func SwsGetGaussianVec ¶
func SwsGetGaussianVec(variance float64, quality float64) *CSwsVector
*
- Return a normalized Gaussian curve used to filter stuff
- quality = 3 is high quality, lower is lower quality.
func (CSwsVector) GetCoeff ¶
func (sv CSwsVector) GetCoeff() *float64
/< pointer to the list of coefficients
func (CSwsVector) GetLength ¶
func (sv CSwsVector) GetLength() int
/< number of coefficients in the vector
Click to show internal directories.
Click to hide internal directories.