[FFmpeg-devel] [PATCH] sws: add a new scaling API

Michael Niedermayer michael at niedermayer.cc
Thu Sep 2 18:24:45 EEST 2021


On Sun, Aug 29, 2021 at 06:38:58PM +0200, Anton Khirnov wrote:
> ---
> Now with a new public function to query required slice alignment, which
> fixes the yuv410p->yuv420p conversion issue reported by Michael.
{...]
> +/**
> + * 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 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.
> + */
> +int sws_send_slice(struct SwsContext *c, unsigned int slice_start,
> +                   unsigned int slice_height);
> +
> +/**
> + * Request a horizontal slice of the output data to be written into the frame
> + * previously provided to sws_frame_start().
> + *

> + * When a slice smaller than the whole output frame is requested, both
> + * slice_start and slice_height must be multiples of
> + * sws_receive_slice_alignment().

the image height might not be a multiple of sws_receive_slice_alignment()
in that case the last slice would violate this rule


> + *
> + * @param slice_start first row of the slice
> + * @param slice_height number of rows in the slice
> + *
> + * @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
> + */
> +int sws_receive_slice(struct SwsContext *c, unsigned int slice_start,
> +                      unsigned int slice_height);
> +

> +/**
> + * Query required alignment on output data requested with sws_receive_slice().
> + */
> +unsigned int sws_receive_slice_alignment(const struct SwsContext *c);

I think this one line documentation taken alone is insufficient to understand
this


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Nations do behave wisely once they have exhausted all other alternatives. 
-- Abba Eban
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20210902/30fafc32/attachment.sig>


More information about the ffmpeg-devel mailing list