[FFmpeg-devel] [PATCH 2/3] swscale: ayuv16 input support

Michael Niedermayer michaelni at gmx.at
Fri Jul 3 22:26:24 CEST 2015


On Fri, Jul 03, 2015 at 09:59:58PM +0200, Michael Niedermayer wrote:
> On Fri, Jul 03, 2015 at 04:16:32PM +0000, Paul B Mahol wrote:
> > Signed-off-by: Paul B Mahol <onemda at gmail.com>
> > ---
> >  libswscale/input.c            | 36 ++++++++++++++++++++++++++++++++++++
> >  libswscale/swscale_internal.h |  2 ++
> >  libswscale/swscale_unscaled.c |  1 +
> >  libswscale/utils.c            |  2 +-
> >  4 files changed, 40 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libswscale/input.c b/libswscale/input.c
> > index 1f04fc2..d7d4bc5 100644
> > --- a/libswscale/input.c
> > +++ b/libswscale/input.c
> > @@ -607,6 +607,33 @@ static void read_ya16be_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t
> >          AV_WN16(dst + i * 2, AV_RB16(src + i * 4 + 2));
> >  }
> >  
> > +static void read_ayuv16le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
> > +                               uint32_t *unused2)
> > +{
> > +    int i;
> > +    for (i = 0; i < width; i++)
> > +        AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2));
> > +}
> > +
> > +
> > +static void read_ayuv16le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
> > +                               const uint8_t *unused1, int width, uint32_t *unused2)
> > +{
> > +    int i;
> > +    for (i = 0; i < width; i++) {
> > +        AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 4));
> > +        AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 6));
> > +    }
> > +}
> > +
> > +static void read_ayuv16le_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
> > +                                uint32_t *unused2)
> > +{
> > +    int i;
> > +    for (i = 0; i < width; i++)
> > +        AV_WN16(dst + i * 2, AV_RL16(src + i * 8));
> > +}
> > +
> >  /* This is almost identical to the previous, end exists only because
> >   * yuy2ToY/UV)(dst, src + 1, ...) would have 100% unaligned accesses. */
> >  static void uyvyToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2,  int width,
> > @@ -987,6 +1014,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
> >          c->chrToYV12 = bswap16UV_c;
> >          break;
> >  #endif
> > +    case AV_PIX_FMT_AYUV16LE:
> > +        c->chrToYV12 = read_ayuv16le_UV_c;
> > +        break;
> >      }
> >      if (c->chrSrcHSubSample) {
> >          switch (srcFormat) {
> > @@ -1271,6 +1301,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
> >      case AV_PIX_FMT_YA16BE:
> >          c->lumToYV12 = read_ya16be_gray_c;
> >          break;
> > +    case AV_PIX_FMT_AYUV16LE:
> > +        c->lumToYV12 = read_ayuv16le_Y_c;
> > +        break;
> >      case AV_PIX_FMT_YUYV422:
> >      case AV_PIX_FMT_YVYU422:
> >      case AV_PIX_FMT_YA8:
> > @@ -1397,6 +1430,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
> >          case AV_PIX_FMT_YA16BE:
> >              c->alpToYV12 = read_ya16be_alpha_c;
> >              break;
> > +        case AV_PIX_FMT_AYUV16LE:
> > +            c->alpToYV12 = read_ayuv16le_A_c;
> > +            break;
> >          case AV_PIX_FMT_PAL8 :
> >              c->alpToYV12 = palToA_c;
> >              break;
> > diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
> > index 2299aa5..9045336 100644
> > --- a/libswscale/swscale_internal.h
> > +++ b/libswscale/swscale_internal.h
> > @@ -790,6 +790,8 @@ static av_always_inline int isALPHA(enum AVPixelFormat pix_fmt)
> >          || (x)==AV_PIX_FMT_YA8       \
> >          || (x)==AV_PIX_FMT_YA16LE      \
> >          || (x)==AV_PIX_FMT_YA16BE      \
> > +        || (x)==AV_PIX_FMT_AYUV16LE    \
> > +        || (x)==AV_PIX_FMT_AYUV16BE    \
> >          ||  isRGBinInt(x)           \
> >          ||  isBGRinInt(x)           \
> >      )
> > diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
> > index 1dc42c8..0e1e26e 100644
> > --- a/libswscale/swscale_unscaled.c
> > +++ b/libswscale/swscale_unscaled.c
> > @@ -1676,6 +1676,7 @@ void ff_get_unscaled_swscale(SwsContext *c)
> >          IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGRA64) ||
> >          IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY16) ||
> >          IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YA16)   ||
> > +        IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_AYUV16) ||
> >          IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP9)  ||
> >          IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP10) ||
> >          IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP12) ||
> > diff --git a/libswscale/utils.c b/libswscale/utils.c
> > index c384aa5..3561f7b 100644
> > --- a/libswscale/utils.c
> > +++ b/libswscale/utils.c
> 
> > @@ -224,7 +224,7 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = {
> >      [AV_PIX_FMT_BAYER_GRBG16LE] = { 1, 0 },
> >      [AV_PIX_FMT_BAYER_GRBG16BE] = { 1, 0 },
> >      [AV_PIX_FMT_XYZ12BE]     = { 1, 1, 1 },
> > -    [AV_PIX_FMT_XYZ12LE]     = { 1, 1, 1 },
> > +    [AV_PIX_FMT_AYUV16LE]    = { 1, 0},
> 
> this looks like a typo
> you remove AV_PIX_FMT_XYZ12LE

should be ok without the typo

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle
-------------- 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/20150703/8895b60b/attachment.asc>


More information about the ffmpeg-devel mailing list