Message ID | 20180302234039.2632-1-philipl@overt.org |
---|---|
State | New |
Headers | show |
On Fri, Mar 02, 2018 at 03:40:39PM -0800, Philip Langdale wrote: > This cleans up the ever-more-unreadable list of semi-planar > exclusions for selecting the planar copy wrapper. > --- > libswscale/swscale_internal.h | 7 +++++++ > libswscale/swscale_unscaled.c | 7 +------ > 2 files changed, 8 insertions(+), 6 deletions(-) > > diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h > index 0f51df95d7..d3d9da9a34 100644 > --- a/libswscale/swscale_internal.h > +++ b/libswscale/swscale_internal.h > @@ -676,6 +676,13 @@ static av_always_inline int isPlanarYUV(enum AVPixelFormat pix_fmt) > return ((desc->flags & AV_PIX_FMT_FLAG_PLANAR) && isYUV(pix_fmt)); > } > > +static av_always_inline int isSemiPlanarYUV(enum AVPixelFormat pix_fmt) please add a comment unambigously defining what semi planar means here LGTM otherwise [...]
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sat, 3 Mar 2018 23:21:51 +0100 Michael Niedermayer <michael@niedermayer.cc> wrote: > On Fri, Mar 02, 2018 at 03:40:39PM -0800, Philip Langdale wrote: > > This cleans up the ever-more-unreadable list of semi-planar > > exclusions for selecting the planar copy wrapper. > > --- > > libswscale/swscale_internal.h | 7 +++++++ > > libswscale/swscale_unscaled.c | 7 +------ > > 2 files changed, 8 insertions(+), 6 deletions(-) > > > > diff --git a/libswscale/swscale_internal.h > > b/libswscale/swscale_internal.h index 0f51df95d7..d3d9da9a34 100644 > > --- a/libswscale/swscale_internal.h > > +++ b/libswscale/swscale_internal.h > > @@ -676,6 +676,13 @@ static av_always_inline int isPlanarYUV(enum > > AVPixelFormat pix_fmt) return ((desc->flags & > > AV_PIX_FMT_FLAG_PLANAR) && isYUV(pix_fmt)); } > > > > +static av_always_inline int isSemiPlanarYUV(enum AVPixelFormat > > pix_fmt) > > please add a comment unambigously defining what semi planar means here > > LGTM otherwise > > [...] Done and pushed. Thanks. - --phil -----BEGIN PGP SIGNATURE----- iEYEARECAAYFAlqbLv8ACgkQ+NaxlGp1aC7bbwCeJXTnbTem78t1vxsQet692r/E 0WsAniBv/VtfETvEHViXBS0+SuSup8y+ =Bu9b -----END PGP SIGNATURE-----
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 0f51df95d7..d3d9da9a34 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -676,6 +676,13 @@ static av_always_inline int isPlanarYUV(enum AVPixelFormat pix_fmt) return ((desc->flags & AV_PIX_FMT_FLAG_PLANAR) && isYUV(pix_fmt)); } +static av_always_inline int isSemiPlanarYUV(enum AVPixelFormat pix_fmt) +{ + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); + av_assert0(desc); + return (isPlanarYUV(pix_fmt) && desc->comp[1].plane == desc->comp[2].plane); +} + static av_always_inline int isRGB(enum AVPixelFormat pix_fmt) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 766c9b4872..13f9cd83e3 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -1930,12 +1930,7 @@ void ff_get_unscaled_swscale(SwsContext *c) (isPlanarYUV(srcFormat) && isPlanarYUV(dstFormat) && c->chrDstHSubSample == c->chrSrcHSubSample && c->chrDstVSubSample == c->chrSrcVSubSample && - dstFormat != AV_PIX_FMT_NV12 && dstFormat != AV_PIX_FMT_NV21 && - dstFormat != AV_PIX_FMT_P010LE && dstFormat != AV_PIX_FMT_P010BE && - dstFormat != AV_PIX_FMT_P016LE && dstFormat != AV_PIX_FMT_P016BE && - srcFormat != AV_PIX_FMT_NV12 && srcFormat != AV_PIX_FMT_NV21 && - srcFormat != AV_PIX_FMT_P010LE && srcFormat != AV_PIX_FMT_P010BE && - srcFormat != AV_PIX_FMT_P016LE && srcFormat != AV_PIX_FMT_P016BE)) + !isSemiPlanarYUV(srcFormat) && !isSemiPlanarYUV(dstFormat))) { if (isPacked(c->srcFormat)) c->swscale = packedCopyWrapper;