[FFmpeg-devel] [PATCH] swscale: support internal scaler cascades
Michael Niedermayer
michaelni at gmx.at
Sat Oct 11 05:14:48 CEST 2014
On Fri, Oct 10, 2014 at 11:30:43PM +0200, Clément Bœsch wrote:
> On Wed, Oct 08, 2014 at 02:11:06AM +0200, Michael Niedermayer wrote:
> > Fixes Ticket3170
> >
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> > libswscale/swscale.c | 13 ++++++++++
> > libswscale/swscale_internal.h | 6 +++++
> > libswscale/utils.c | 54 ++++++++++++++++++++++++++++++++---------
> > 3 files changed, 62 insertions(+), 11 deletions(-)
> >
> > diff --git a/libswscale/swscale.c b/libswscale/swscale.c
> > index e54d448..409e7db 100644
> > --- a/libswscale/swscale.c
> > +++ b/libswscale/swscale.c
> > @@ -27,6 +27,7 @@
> > #include "libavutil/avutil.h"
> > #include "libavutil/bswap.h"
> > #include "libavutil/cpu.h"
> > +#include "libavutil/imgutils.h"
> > #include "libavutil/intreadwrite.h"
> > #include "libavutil/mathematics.h"
> > #include "libavutil/pixdesc.h"
> > @@ -899,6 +900,18 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
> > av_log(c, AV_LOG_ERROR, "One of the input parameters to sws_scale() is NULL, please check the calling code\n");
> > return 0;
> > }
> > + if (c->cascaded_context[0] && srcSliceY == 0 && srcSliceH == c->cascaded_context[0]->srcH) {
> > + ret = sws_scale(c->cascaded_context[0],
> > + srcSlice, srcStride, srcSliceY, srcSliceH,
> > + c->cascaded_tmp, c->cascaded_tmpStride);
> > + if (ret < 0)
> > + return ret;
> > + ret = sws_scale(c->cascaded_context[1],
> > + c->cascaded_tmp, c->cascaded_tmpStride, 0, c->cascaded_context[0]->dstH,
> > + dst, dstStride);
> > + return ret;
> > + }
> > +
> > memcpy(src2, srcSlice, sizeof(src2));
> > memcpy(dst2, dst, sizeof(dst2));
> >
> > diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
> > index 1e53690..d072bbc 100644
> > --- a/libswscale/swscale_internal.h
> > +++ b/libswscale/swscale_internal.h
> > @@ -61,6 +61,8 @@
> > # define APCK_SIZE 16
> > #endif
> >
> > +#define AVERROR_USE_CASCADE -12345
> > +
>
> Please do not use "AV" prefix for non exposed API.
>
> [...]
>
> > struct SwsContext;
> >
> > typedef enum SwsDither {
> > @@ -301,6 +303,10 @@ typedef struct SwsContext {
> > int sliceDir; ///< Direction that slices are fed to the scaler (1 = top-to-bottom, -1 = bottom-to-top).
> > double param[2]; ///< Input parameters for scaling algorithms that need them.
> >
> > + struct SwsContext *cascaded_context[2];
> > + int cascaded_tmpStride[4];
> > + uint8_t *cascaded_tmp[4];
> > +
>
> I think it would be appropriate to add a comment about what issue these
> fields are addressing.
fixed
>
> [...]
>
> No opinion on the rest of the patch, but thank you for fixing that issue.
>
> I'm assuming it's now able to rescale from 4k to 1x1?
of course
and patch applied
thanks
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141011/cf9e90f3/attachment.asc>
More information about the ffmpeg-devel
mailing list