[FFmpeg-cvslog] Merge commit 'c438899a706422b8362a13714580e988be4d638b'

James Almer git at videolan.org
Thu Mar 29 00:14:07 EEST 2018


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Wed Mar 28 18:09:46 2018 -0300| [0dc11d8bbd470db89fbc17b7434e992c9129b310] | committer: James Almer

Merge commit 'c438899a706422b8362a13714580e988be4d638b'

* commit 'c438899a706422b8362a13714580e988be4d638b':
  Add AV1 video decoding support through libaom

This contains some extra changes taken from the libvpx decoder
wrapper, most of them contained in the set_pix_fmt() function.

Merged-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0dc11d8bbd470db89fbc17b7434e992c9129b310
---

 Changelog              |   1 +
 configure              |   4 +
 doc/general.texi       |  10 ++
 libavcodec/Makefile    |   1 +
 libavcodec/allcodecs.c |   1 +
 libavcodec/libaomdec.c | 249 +++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 266 insertions(+)

diff --git a/Changelog b/Changelog
index 30a8978db4..08a1e7f9a4 100644
--- a/Changelog
+++ b/Changelog
@@ -48,6 +48,7 @@ version <next>:
 - drmeter audio filter
 - hapqa_extract bitstream filter
 - filter_units bitstream filter
+- AV1 Support through libaom
 
 
 version 3.4:
diff --git a/configure b/configure
index d12c8ba77c..f8820aec09 100755
--- a/configure
+++ b/configure
@@ -217,6 +217,7 @@ External library support:
   --disable-iconv          disable iconv [autodetect]
   --enable-jni             enable JNI support [no]
   --enable-ladspa          enable LADSPA audio filtering [no]
+  --enable-libaom          enable AV1 video encoding/decoding via libaom [no]
   --enable-libass          enable libass subtitles rendering,
                            needed for subtitles and ass filter [no]
   --enable-libbluray       enable BluRay reading using libbluray [no]
@@ -1653,6 +1654,7 @@ EXTERNAL_LIBRARY_LIST="
     gnutls
     jni
     ladspa
+    libaom
     libass
     libbluray
     libbs2b
@@ -3004,6 +3006,7 @@ h264_videotoolbox_encoder_deps="pthreads"
 h264_videotoolbox_encoder_select="videotoolbox_encoder"
 hevc_videotoolbox_encoder_deps="pthreads"
 hevc_videotoolbox_encoder_select="videotoolbox_encoder"
+libaom_av1_decoder_deps="libaom"
 libcelt_decoder_deps="libcelt"
 libcodec2_decoder_deps="libcodec2"
 libcodec2_encoder_deps="libcodec2"
@@ -5930,6 +5933,7 @@ enabled gmp               && require gmp gmp.h mpz_export -lgmp
 enabled gnutls            && require_pkg_config gnutls gnutls gnutls/gnutls.h gnutls_global_init
 enabled jni               && { [ $target_os = "android" ] && check_header jni.h && enabled pthreads || die "ERROR: jni not found"; }
 enabled ladspa            && require_header ladspa.h
+enabled libaom            && require_pkg_config libaom "aom >= 0.1.0" aom/aom_codec.h aom_codec_version
 enabled lv2               && require_pkg_config lv2 lilv-0 "lilv-0/lilv/lilv.h" lilv_world_new
 enabled libiec61883       && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
 enabled libass            && require_pkg_config libass libass ass/ass.h ass_library_init
diff --git a/doc/general.texi b/doc/general.texi
index c5d46d3404..00d5d684ce 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -17,6 +17,14 @@ for more formats. None of them are used by default, their use has to be
 explicitly requested by passing the appropriate flags to
 @command{./configure}.
 
++ at section Alliance for Open Media libaom
+
+FFmpeg can make use of the libaom library for AV1 decoding.
+
+Go to @url{http://aomedia.org/} and follow the instructions for
+installing the library. Then pass @code{--enable-libaom} to configure to
+enable it.
+
 @section OpenJPEG
 
 FFmpeg can use the OpenJPEG libraries for encoding/decoding J2K videos.  Go to
@@ -719,6 +727,8 @@ following image formats are supported:
 @item Autodesk Animator Flic video  @tab     @tab  X
 @item Autodesk RLE           @tab     @tab  X
     @tab fourcc: AASC
+ at item AV1                    @tab     @tab  E
+    @tab Supported through external library libaom
 @item Avid 1:1 10-bit RGB Packer  @tab  X  @tab  X
     @tab fourcc: AVrp
 @item AVS (Audio Video Standard) video  @tab     @tab  X
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index aaef6c3ab8..127f53596a 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -939,6 +939,7 @@ OBJS-$(CONFIG_ALAC_AT_ENCODER)            += audiotoolboxenc.o
 OBJS-$(CONFIG_ILBC_AT_ENCODER)            += audiotoolboxenc.o
 OBJS-$(CONFIG_PCM_ALAW_AT_ENCODER)        += audiotoolboxenc.o
 OBJS-$(CONFIG_PCM_MULAW_AT_ENCODER)       += audiotoolboxenc.o
+OBJS-$(CONFIG_LIBAOM_AV1_DECODER)         += libaomdec.o
 OBJS-$(CONFIG_LIBCELT_DECODER)            += libcelt_dec.o
 OBJS-$(CONFIG_LIBCODEC2_DECODER)          += libcodec2.o codec2utils.o
 OBJS-$(CONFIG_LIBCODEC2_ENCODER)          += libcodec2.o codec2utils.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 71719595c6..be7f24725b 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -663,6 +663,7 @@ extern AVCodec ff_pcm_mulaw_at_encoder;
 extern AVCodec ff_pcm_mulaw_at_decoder;
 extern AVCodec ff_qdmc_at_decoder;
 extern AVCodec ff_qdm2_at_decoder;
+extern AVCodec ff_libaom_av1_decoder;
 extern AVCodec ff_libcelt_decoder;
 extern AVCodec ff_libcodec2_encoder;
 extern AVCodec ff_libcodec2_decoder;
diff --git a/libavcodec/libaomdec.c b/libavcodec/libaomdec.c
new file mode 100644
index 0000000000..5158ea8d76
--- /dev/null
+++ b/libavcodec/libaomdec.c
@@ -0,0 +1,249 @@
+/*
+ * Copyright (c) 2010, Google, Inc.
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * AV1 decoder support via libaom
+ */
+
+#include <aom/aom_decoder.h>
+#include <aom/aomdx.h>
+
+#include "libavutil/common.h"
+#include "libavutil/imgutils.h"
+
+#include "avcodec.h"
+#include "internal.h"
+
+typedef struct AV1DecodeContext {
+    struct aom_codec_ctx decoder;
+} AV1DecodeContext;
+
+static av_cold int aom_init(AVCodecContext *avctx,
+                            const struct aom_codec_iface *iface)
+{
+    AV1DecodeContext *ctx           = avctx->priv_data;
+    struct aom_codec_dec_cfg deccfg = {
+        /* token partitions+1 would be a decent choice */
+        .threads = FFMIN(avctx->thread_count, 16)
+    };
+
+    av_log(avctx, AV_LOG_INFO, "%s\n", aom_codec_version_str());
+    av_log(avctx, AV_LOG_VERBOSE, "%s\n", aom_codec_build_config());
+
+    if (aom_codec_dec_init(&ctx->decoder, iface, &deccfg, 0) != AOM_CODEC_OK) {
+        const char *error = aom_codec_error(&ctx->decoder);
+        av_log(avctx, AV_LOG_ERROR, "Failed to initialize decoder: %s\n",
+               error);
+        return AVERROR(EINVAL);
+    }
+
+    return 0;
+}
+
+static void image_copy_16_to_8(AVFrame *pic, struct aom_image *img)
+{
+    int i;
+
+    for (i = 0; i < 3; i++) {
+        int w = img->d_w;
+        int h = img->d_h;
+        int x, y;
+
+        if (i) {
+            w = (w + img->x_chroma_shift) >> img->x_chroma_shift;
+            h = (h + img->y_chroma_shift) >> img->y_chroma_shift;
+        }
+
+        for (y = 0; y < h; y++) {
+            uint16_t *src = (uint16_t *)(img->planes[i] + y * img->stride[i]);
+            uint8_t *dst = pic->data[i] + y * pic->linesize[i];
+            for (x = 0; x < w; x++)
+                *dst++ = *src++;
+        }
+    }
+}
+
+// returns 0 on success, AVERROR_INVALIDDATA otherwise
+static int set_pix_fmt(AVCodecContext *avctx, struct aom_image *img)
+{
+    static const enum AVColorSpace colorspaces[10] = {
+        AVCOL_SPC_UNSPECIFIED, AVCOL_SPC_BT470BG, AVCOL_SPC_BT709, AVCOL_SPC_SMPTE170M,
+        AVCOL_SPC_SMPTE240M, AVCOL_SPC_BT2020_NCL, AVCOL_SPC_BT2020_CL, AVCOL_SPC_RGB,
+        AVCOL_SPC_ICTCP, AVCOL_SPC_RESERVED
+    };
+    static const enum AVColorRange color_ranges[] = {
+        AVCOL_RANGE_MPEG, AVCOL_RANGE_JPEG
+    };
+    avctx->color_range = color_ranges[img->range];
+    avctx->colorspace = colorspaces[img->cs];
+
+    switch (img->fmt) {
+    case AOM_IMG_FMT_I420:
+        avctx->pix_fmt = AV_PIX_FMT_YUV420P;
+        return 0;
+    case AOM_IMG_FMT_I422:
+        avctx->pix_fmt = AV_PIX_FMT_YUV422P;
+        return 0;
+    case AOM_IMG_FMT_I440:
+        avctx->pix_fmt = AV_PIX_FMT_YUV440P;
+        return 0;
+    case AOM_IMG_FMT_I444:
+        avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
+                         AV_PIX_FMT_GBRP : AV_PIX_FMT_YUV444P;
+        return 0;
+    case AOM_IMG_FMT_I42016:
+        if (img->bit_depth == 8) {
+            avctx->pix_fmt = AV_PIX_FMT_YUV420P;
+            return 0;
+        } else if (img->bit_depth == 10) {
+            avctx->pix_fmt = AV_PIX_FMT_YUV420P10;
+            return 0;
+        } else if (img->bit_depth == 12) {
+            avctx->pix_fmt = AV_PIX_FMT_YUV420P12;
+            return 0;
+        } else {
+            return AVERROR_INVALIDDATA;
+        }
+    case AOM_IMG_FMT_I42216:
+        if (img->bit_depth == 8) {
+            avctx->pix_fmt = AV_PIX_FMT_YUV422P;
+            return 0;
+        } else if (img->bit_depth == 10) {
+            avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
+            return 0;
+        } else if (img->bit_depth == 12) {
+            avctx->pix_fmt = AV_PIX_FMT_YUV422P12;
+            return 0;
+        } else {
+            return AVERROR_INVALIDDATA;
+        }
+    case AOM_IMG_FMT_I44016:
+        if (img->bit_depth == 8) {
+            avctx->pix_fmt = AV_PIX_FMT_YUV440P;
+            return 0;
+        } else if (img->bit_depth == 10) {
+            avctx->pix_fmt = AV_PIX_FMT_YUV440P10;
+            return 0;
+        } else if (img->bit_depth == 12) {
+            avctx->pix_fmt = AV_PIX_FMT_YUV440P12;
+            return 0;
+        } else {
+            return AVERROR_INVALIDDATA;
+        }
+    case AOM_IMG_FMT_I44416:
+        if (img->bit_depth == 8) {
+            avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
+                             AV_PIX_FMT_GBRP : AV_PIX_FMT_YUV444P;
+            return 0;
+        } else if (img->bit_depth == 10) {
+            avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
+                             AV_PIX_FMT_GBRP10 : AV_PIX_FMT_YUV444P10;
+            return 0;
+        } else if (img->bit_depth == 12) {
+            avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
+                             AV_PIX_FMT_GBRP12 : AV_PIX_FMT_YUV444P12;
+            return 0;
+        } else {
+            return AVERROR_INVALIDDATA;
+        }
+
+    default:
+        return AVERROR_INVALIDDATA;
+    }
+}
+
+static int aom_decode(AVCodecContext *avctx, void *data, int *got_frame,
+                      AVPacket *avpkt)
+{
+    AV1DecodeContext *ctx = avctx->priv_data;
+    AVFrame *picture      = data;
+    const void *iter      = NULL;
+    struct aom_image *img;
+    int ret;
+
+    if (aom_codec_decode(&ctx->decoder, avpkt->data, avpkt->size, NULL) !=
+        AOM_CODEC_OK) {
+        const char *error  = aom_codec_error(&ctx->decoder);
+        const char *detail = aom_codec_error_detail(&ctx->decoder);
+
+        av_log(avctx, AV_LOG_ERROR, "Failed to decode frame: %s\n", error);
+        if (detail)
+            av_log(avctx, AV_LOG_ERROR, "  Additional information: %s\n",
+                   detail);
+        return AVERROR_INVALIDDATA;
+    }
+
+    if ((img = aom_codec_get_frame(&ctx->decoder, &iter))) {
+        if (img->d_w > img->w || img->d_h > img->h) {
+            av_log(avctx, AV_LOG_ERROR, "Display dimensions %dx%d exceed storage %dx%d\n",
+                   img->d_w, img->d_h, img->w, img->h);
+            return AVERROR_EXTERNAL;
+        }
+
+        if ((ret = set_pix_fmt(avctx, img)) < 0) {
+            av_log(avctx, AV_LOG_ERROR, "Unsupported output colorspace (%d) / bit_depth (%d)\n",
+                   img->fmt, img->bit_depth);
+            return ret;
+        }
+
+        if ((int)img->d_w != avctx->width || (int)img->d_h != avctx->height) {
+            av_log(avctx, AV_LOG_INFO, "dimension change! %dx%d -> %dx%d\n",
+                   avctx->width, avctx->height, img->d_w, img->d_h);
+            ret = ff_set_dimensions(avctx, img->d_w, img->d_h);
+            if (ret < 0)
+                return ret;
+        }
+        if ((ret = ff_get_buffer(avctx, picture, 0)) < 0)
+            return ret;
+        if ((img->fmt & AOM_IMG_FMT_HIGHBITDEPTH) && img->bit_depth == 8)
+            image_copy_16_to_8(picture, img);
+        else
+            av_image_copy(picture->data, picture->linesize, (const uint8_t **)img->planes,
+                          img->stride, avctx->pix_fmt, img->d_w, img->d_h);
+        *got_frame = 1;
+    }
+    return avpkt->size;
+}
+
+static av_cold int aom_free(AVCodecContext *avctx)
+{
+    AV1DecodeContext *ctx = avctx->priv_data;
+    aom_codec_destroy(&ctx->decoder);
+    return 0;
+}
+
+static av_cold int av1_init(AVCodecContext *avctx)
+{
+    return aom_init(avctx, &aom_codec_av1_dx_algo);
+}
+
+AVCodec ff_libaom_av1_decoder = {
+    .name           = "libaom-av1",
+    .long_name      = NULL_IF_CONFIG_SMALL("libaom AV1"),
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = AV_CODEC_ID_AV1,
+    .priv_data_size = sizeof(AV1DecodeContext),
+    .init           = av1_init,
+    .close          = aom_free,
+    .decode         = aom_decode,
+    .capabilities   = AV_CODEC_CAP_AUTO_THREADS | AV_CODEC_CAP_DR1,
+    .wrapper_name   = "libaom",
+};


======================================================================

diff --cc Changelog
index 30a8978db4,0d20cd47df..08a1e7f9a4
--- a/Changelog
+++ b/Changelog
@@@ -2,396 -2,39 +2,397 @@@ Entries are sorted chronologically fro
  releases are sorted from youngest to oldest.
  
  version <next>:
 -- Support for spherical videos
 -- Intel QSV-accelerated VP8 and VC-1 decoding
 -- VAAPI-accelerated VP8 and HEVC decoding
 -- VAAPI-accelerated deinterlacing
 -- config.log and other configuration files moved into avbuild/ directory
 -- VAAPI-accelerated MPEG-2 and VP8 encoding
 -- Apple Pixlet decoder
 -- The x86 assembler default switched from yasm to nasm, pass
 -  --x86asmexe=yasm to configure to restore the old behavior.
 -- Cineform HD decoder
 -- VP9 superframe split/merge bitstream filters
 -- FM Screen Capture Codec decoder
 -- ClearVideo decoder (I-frames only)
 -- support for decoding through D3D11VA in avconv
 -- Cinepak encoder
 +- Bitstream filters for editing metadata in H.264, HEVC and MPEG-2 streams
 +- Dropped support for OpenJPEG versions 2.0 and below. Using OpenJPEG now
 +  requires 2.1 (or later) and pkg-config.
 +- VDA dropped (use VideoToolbox instead)
 +- MagicYUV encoder
 +- Raw AMR-NB and AMR-WB demuxers
 +- TiVo ty/ty+ demuxer
  - Intel QSV-accelerated MJPEG encoding
 -- NVIDIA CUVID-accelerated H.264 and HEVC decoding
 +- PCE support for extended channel layouts in the AAC encoder
 +- native aptX and aptX HD encoder and decoder
 +- Raw aptX and aptX HD muxer and demuxer
 +- NVIDIA NVDEC-accelerated H.264, HEVC, MJPEG, MPEG-1/2/4, VC1, VP8/9 hwaccel decoding
  - Intel QSV-accelerated overlay filter
 +- mcompand audio filter
 +- acontrast audio filter
 +- OpenCL overlay filter
 +- video mix filter
 +- video normalize filter
 +- audio lv2 wrapper filter
 +- VAAPI MJPEG and VP8 decoding
 +- AMD AMF H.264 and HEVC encoders
 +- video fillborders filter
 +- video setrange filter
 +- nsp demuxer
 +- support LibreSSL (via libtls)
 +- AVX-512/ZMM support added
 +- Dropped support for building for Windows XP. The minimum supported Windows
 +  version is Windows Vista.
 +- deconvolve video filter
 +- entropy video filter
 +- hilbert audio filter source
 +- aiir audio filter
 +- aiff: add support for CD-ROM XA ADPCM
 +- Removed the ffserver program
 +- Removed the ffmenc and ffmdec muxer and demuxer
 +- VideoToolbox HEVC encoder and hwaccel
 +- VAAPI-accelerated ProcAmp (color balance), denoise and sharpness filters
 +- Add android_camera indev
 +- codec2 en/decoding via libcodec2
 +- muxer/demuxer for raw codec2 files and .c2 files
 +- Moved nvidia codec headers into an external repository.
 +  They can be found at http://git.videolan.org/?p=ffmpeg/nv-codec-headers.git
 +- native SBC encoder and decoder
 +- drmeter audio filter
 +- hapqa_extract bitstream filter
 +- filter_units bitstream filter
+ - AV1 Support through libaom
  
  
 -version 12:
 -- aliases and defaults for Ogg subtypes (opus, spx)
 -- HEVC/H.265 RTP payload format (draft v6) packetizer and depacketizer
 -- avplay now exits by default at the end of playback
 -- XCB-based screen-grabber
 -- creating DASH compatible fragmented MP4, MPEG-DASH segmenting muxer
 -- H.261 RTP payload format (RFC 4587) depacketizer and experimental packetizer
 +version 3.4:
 +- deflicker video filter
 +- doubleweave video filter
 +- lumakey video filter
 +- pixscope video filter
 +- oscilloscope video filter
 +- config.log and other configuration files moved into ffbuild/ directory
 +- update cuvid/nvenc headers to Video Codec SDK 8.0.14
 +- afir audio filter
 +- scale_cuda CUDA based video scale filter
 +- librsvg support for svg rasterization
 +- crossfeed audio filter
 +- spec compliant VP9 muxing support in MP4
 +- remove the libnut muxer/demuxer wrappers
 +- remove the libschroedinger encoder/decoder wrappers
 +- surround audio filter
 +- sofalizer filter switched to libmysofa
 +- Gremlin Digital Video demuxer and decoder
 +- headphone audio filter
 +- superequalizer audio filter
 +- roberts video filter
 +- The x86 assembler default switched from yasm to nasm, pass
 +  --x86asmexe=yasm to configure to restore the old behavior.
 +- additional frame format support for Interplay MVE movies
 +- support for decoding through D3D11VA in ffmpeg
 +- limiter video filter
 +- libvmaf video filter
 +- Dolby E decoder and SMPTE 337M demuxer
 +- unpremultiply video filter
 +- tlut2 video filter
 +- floodfill video filter
 +- pseudocolor video filter
 +- raw G.726 muxer and demuxer, left- and right-justified
 +- NewTek NDI input/output device
 +- Some video filters with several inputs now use a common set of options:
 +  blend, libvmaf, lut3d, overlay, psnr, ssim.
 +  They must always be used by name.
 +- FITS demuxer and decoder
 +- FITS muxer and encoder
 +- add --disable-autodetect build switch
 +- drop deprecated qtkit input device (use avfoundation instead)
 +- despill video filter
 +- haas audio filter
 +- SUP/PGS subtitle muxer
 +- convolve video filter
 +- VP9 tile threading support
 +- KMS screen grabber
 +- CUDA thumbnail filter
 +- V4L2 mem2mem HW assisted codecs
 +- Rockchip MPP hardware decoding
 +- vmafmotion video filter
 +- use MIME type "G726" for little-endian G.726, "AAL2-G726" for big-endian G.726
 +
 +
 +version 3.3:
 +- CrystalHD decoder moved to new decode API
 +- add internal ebur128 library, remove external libebur128 dependency
 +- Pro-MPEG CoP #3-R2 FEC protocol
 +- premultiply video filter
 +- Support for spherical videos
 +- configure now fails if autodetect-libraries are requested but not found
 +- PSD Decoder
 +- 16.8 floating point pcm decoder
 +- 24.0 floating point pcm decoder
 +- Apple Pixlet decoder
 +- QDMC audio decoder
 +- NewTek SpeedHQ decoder
 +- MIDI Sample Dump Standard demuxer
 +- readeia608 filter
 +- Sample Dump eXchange demuxer
 +- abitscope multimedia filter
 +- Scenarist Closed Captions demuxer and muxer
 +- threshold filter
 +- midequalizer filter
 +- Optimal Huffman tables for (M)JPEG encoding
 +- VAAPI-accelerated MPEG-2 and VP8 encoding
 +- FM Screen Capture Codec decoder
 +- native Opus encoder
 +- ScreenPressor decoder
 +- incomplete ClearVideo decoder
 +- Intel QSV video scaling and deinterlacing filters
 +- Support MOV with multiple sample description tables
 +- XPM decoder
 +- Removed the legacy X11 screen grabber, use XCB instead
 +- MPEG-7 Video Signature filter
 +- Removed asyncts filter (use af_aresample instead)
 +- Intel QSV-accelerated VP8 video decoding
 +- VAAPI-accelerated deinterlacing
 +
 +
 +version 3.2:
 +- libopenmpt demuxer
 +- tee protocol
 +- Changed metadata print option to accept general urls
 +- Alias muxer for Ogg Video (.ogv)
 +- VP8 in Ogg muxing
 +- curves filter doesn't automatically insert points at x=0 and x=1 anymore
 +- 16-bit support in curves filter and selectivecolor filter
 +- OpenH264 decoder wrapper
 +- MediaCodec H.264/HEVC/MPEG-4/VP8/VP9 hwaccel
 +- True Audio (TTA) muxer
 +- crystalizer audio filter
 +- acrusher audio filter
 +- bitplanenoise video filter
 +- floating point support in als decoder
 +- fifo muxer
 +- maskedclamp filter
 +- hysteresis filter
 +- lut2 filter
 +- yuvtestsrc filter
 +- CUDA CUVID H.263/VP8/VP9/10 bit HEVC (Dithered) Decoding
 +- vaguedenoiser filter
 +- added threads option per filter instance
 +- weave filter
 +- gblur filter
 +- avgblur filter
 +- sobel and prewitt filter
 +- MediaCodec HEVC/MPEG-4/VP8/VP9 decoding
 +- Meridian Lossless Packing (MLP) / TrueHD encoder
 +- Non-Local Means (nlmeans) denoising filter
 +- sdl2 output device and ffplay support
 +- sdl1 output device and sdl1 support removed
 +- extended mov edit list support
 +- libfaac encoder removed
 +- Matroska muxer now writes CRC32 elements by default in all Level 1 elements
 +- sidedata video and asidedata audio filter
 +- Changed mapping of rtp MIME type G726 to codec g726le.
 +- spec compliant VAAPI/DXVA2 VC-1 decoding of slices in frame-coded images
 +
 +
 +version 3.1:
 +- DXVA2-accelerated HEVC Main10 decoding
 +- fieldhint filter
 +- loop video filter and aloop audio filter
 +- Bob Weaver deinterlacing filter
 +- firequalizer filter
 +- datascope filter
 +- bench and abench filters
 +- ciescope filter
 +- protocol blacklisting API
 +- MediaCodec H264 decoding
 +- VC-2 HQ RTP payload format (draft v1) depacketizer and packetizer
 +- VP9 RTP payload format (draft v2) packetizer
 +- AudioToolbox audio decoders
 +- AudioToolbox audio encoders
 +- coreimage filter (GPU based image filtering on OSX)
 +- libdcadec removed
 +- bitstream filter for extracting DTS core
 +- ADPCM IMA DAT4 decoder
 +- musx demuxer
 +- aix demuxer
 +- remap filter
 +- hash and framehash muxers
 +- colorspace filter
 +- hdcd filter
 +- readvitc filter
 +- VAAPI-accelerated format conversion and scaling
 +- libnpp/CUDA-accelerated format conversion and scaling
 +- Duck TrueMotion 2.0 Real Time decoder
 +- Wideband Single-bit Data (WSD) demuxer
 +- VAAPI-accelerated H.264/HEVC/MJPEG encoding
 +- DTS Express (LBR) decoder
 +- Generic OpenMAX IL encoder with support for Raspberry Pi
 +- IFF ANIM demuxer & decoder
 +- Direct Stream Transfer (DST) decoder
 +- loudnorm filter
 +- MTAF demuxer and decoder
 +- MagicYUV decoder
 +- OpenExr improvements (tile data and B44/B44A support)
 +- BitJazz SheerVideo decoder
 +- CUDA CUVID H264/HEVC decoder
 +- 10-bit depth support in native utvideo decoder
 +- libutvideo wrapper removed
 +- YUY2 Lossless Codec decoder
 +- VideoToolbox H.264 encoder
 +
 +
 +version 3.0:
 +- Common Encryption (CENC) MP4 encoding and decoding support
 +- DXV decoding
 +- extrastereo filter
 +- ocr filter
 +- alimiter filter
 +- stereowiden filter
 +- stereotools filter
 +- rubberband filter
 +- tremolo filter
 +- agate filter
 +- chromakey filter
 +- maskedmerge filter
 +- Screenpresso SPV1 decoding
 +- chromaprint fingerprinting muxer
 +- ffplay dynamic volume control
 +- displace filter
 +- selectivecolor filter
 +- extensive native AAC encoder improvements and removal of experimental flag
 +- ADPCM PSX decoder
 +- 3dostr, dcstr, fsb, genh, vag, xvag, ads, msf, svag & vpk demuxer
 +- zscale filter
 +- wve demuxer
 +- zero-copy Intel QSV transcoding in ffmpeg
 +- shuffleframes filter
 +- SDX2 DPCM decoder
 +- vibrato filter
 +- innoHeim/Rsupport Screen Capture Codec decoder
 +- ADPCM AICA decoder
 +- Interplay ACM demuxer and audio decoder
 +- XMA1 & XMA2 decoder
 +- realtime filter
 +- anoisesrc audio filter source
 +- IVR demuxer
 +- compensationdelay filter
 +- acompressor filter
 +- support encoding 16-bit RLE SGI images
 +- apulsator filter
 +- sidechaingate audio filter
 +- mipsdspr1 option has been renamed to mipsdsp
 +- aemphasis filter
 +- mips32r5 option has been removed
 +- mips64r6 option has been removed
 +- DXVA2-accelerated VP9 decoding
 +- SOFAlizer: virtual binaural acoustics filter
 +- VAAPI VP9 hwaccel
 +- audio high-order multiband parametric equalizer
 +- automatic bitstream filtering
 +- showspectrumpic filter
 +- libstagefright support removed
 +- spectrumsynth filter
 +- ahistogram filter
 +- only seek with the right mouse button in ffplay
 +- toggle full screen when double-clicking with the left mouse button in ffplay
 +- afftfilt filter
 +- convolution filter
 +- libquvi support removed
 +- support for dvaudio in wav and avi
 +- libaacplus and libvo-aacenc support removed
 +- Cineform HD decoder
 +- new DCA decoder with full support for DTS-HD extensions
 +- significant performance improvements in Windows Television (WTV) demuxer
 +- nnedi deinterlacer
 +- streamselect video and astreamselect audio filter
 +- swaprect filter
 +- metadata video and ametadata audio filter
 +- SMPTE VC-2 HQ profile support for the Dirac decoder
 +- SMPTE VC-2 native encoder supporting the HQ profile
 +
 +
 +version 2.8:
 +- colorkey video filter
 +- BFSTM/BCSTM demuxer
 +- little-endian ADPCM_THP decoder
 +- Hap decoder and encoder
 +- DirectDraw Surface image/texture decoder
 +- ssim filter
 +- optional new ASF demuxer
 +- showvolume filter
 +- Many improvements to the JPEG 2000 decoder
 +- Go2Meeting decoding support
 +- adrawgraph audio and drawgraph video filter
 +- removegrain video filter
 +- Intel QSV-accelerated MPEG-2 video and HEVC encoding
 +- Intel QSV-accelerated MPEG-2 video and HEVC decoding
 +- Intel QSV-accelerated VC-1 video decoding
 +- libkvazaar HEVC encoder
 +- erosion, dilation, deflate and inflate video filters
 +- Dynamic Audio Normalizer as dynaudnorm filter
 +- Reverse video and areverse audio filter
 +- Random filter
 +- deband filter
 +- AAC fixed-point decoding
 +- sidechaincompress audio filter
 +- bitstream filter for converting HEVC from MP4 to Annex B
 +- acrossfade audio filter
 +- allyuv and allrgb video sources
 +- atadenoise video filter
 +- OS X VideoToolbox support
 +- aphasemeter filter
 +- showfreqs filter
 +- vectorscope filter
 +- waveform filter
 +- hstack and vstack filter
 +- Support DNx100 (1440x1080 at 8)
 +- VAAPI hevc hwaccel
 +- VDPAU hevc hwaccel
 +- framerate filter
 +- Switched default encoders for webm to VP9 and Opus
 +- Removed experimental flag from the JPEG 2000 encoder
 +
 +
 +version 2.7:
 +- FFT video filter
 +- TDSC decoder
 +- DTS lossless extension (XLL) decoding (not lossless, disabled by default)
 +- showwavespic filter
 +- DTS decoding through libdcadec
 +- Drop support for nvenc API before 5.0
 +- nvenc HEVC encoder
 +- Detelecine filter
 +- Intel QSV-accelerated H.264 encoding
 +- MMAL-accelerated H.264 decoding
 +- basic APNG encoder and muxer with default extension "apng"
 +- unpack DivX-style packed B-frames in MPEG-4 bitstream filter
 +- WebM Live Chunk Muxer
 +- nvenc level and tier options
 +- chorus filter
 +- Canopus HQ/HQA decoder
 +- Automatically rotate videos based on metadata in ffmpeg
 +- improved Quickdraw compatibility
 +- VP9 high bit-depth and extended colorspaces decoding support
 +- WebPAnimEncoder API when available for encoding and muxing WebP
 +- Direct3D11-accelerated decoding
 +- Support Secure Transport
 +- Multipart JPEG demuxer
 +
 +
 +version 2.6:
 +- nvenc encoder
 +- 10bit spp filter
 +- colorlevels filter
 +- RIFX format for *.wav files
  - RTP/mpegts muxer
 -- VP8 in Ogg demuxing
 +- non continuous cache protocol support
 +- tblend filter
 +- cropdetect support for non 8bpp, absolute (if limit >= 1) and relative (if limit < 1.0) threshold
 +- Camellia symmetric block cipher
  - OpenH264 encoder wrapper
 +- VOC seeking support
 +- Closed caption Decoder
 +- fspp, uspp, pp7 MPlayer postprocessing filters ported to native filters
 +- showpalette filter
 +- Twofish symmetric block cipher
  - Support DNx100 (960x720 at 8)
 -- Direct3D11-accelerated decoding
 +- eq2 filter ported from libmpcodecs as eq filter
 +- removed libmpcodecs
 +- Changed default DNxHD colour range in QuickTime .mov derivatives to mpeg range
 +- ported softpulldown filter from libmpcodecs as repeatfields filter
 +- dcshift filter
 +- RTP depacketizer for loss tolerant payload format for MP3 audio (RFC 5219)
 +- RTP depacketizer for AC3 payload format (RFC 4184)
 +- palettegen and paletteuse filters
 +- VP9 RTP payload format (draft 0) experimental depacketizer
 +- RTP depacketizer for DV (RFC 6469)
  - DXVA2-accelerated HEVC decoding
  - AAC ELD 480 decoding
  - Intel QSV-accelerated H.264 decoding
diff --cc configure
index d12c8ba77c,a43fb93cdf..f8820aec09
--- a/configure
+++ b/configure
@@@ -198,133 -180,72 +198,134 @@@ External library support
    libraries must be explicitly enabled.
  
    Also note that the following help text describes the purpose of the libraries
 -  themselves, not all their features will necessarily be usable by Libav.
 -
 -  --enable-avisynth          video frameserver
 -  --enable-avxsynth          Linux version of AviSynth
 -  --enable-bzlib             bzip2 compression [autodetect]
 -  --enable-frei0r            video filtering plugins
 -  --enable-gnutls            crypto
 -  --enable-libaom            AV1 video encoding/decoding
 -  --enable-libbs2b           Bauer stereophonic-to-binaural DSP
 -  --enable-libcdio           audio CD input
 -  --enable-libdc1394         IEEE 1394/Firewire camera input
 -  --enable-libdcadec         DCA audio decoding
 -  --enable-libfaac           AAC audio encoding
 -  --enable-libfdk-aac        AAC audio encoding/decoding
 -  --enable-libfontconfig     font configuration and management
 -  --enable-libfreetype       font rendering
 -  --enable-libgsm            GSM audio encoding/decoding
 -  --enable-libhdcd           HDCD decoding filter
 -  --enable-libilbc           ILBC audio encoding/decoding
 -  --enable-libjack           JACK audio sound server
 -  --enable-libkvazaar        HEVC video encoding
 -  --enable-libmp3lame        MP3 audio encoding
 -  --enable-libopencore-amrnb AMR-NB audio encoding/decoding
 -  --enable-libopencore-amrwb AMR-WB audio decoding
 -  --enable-libopencv         computer vision
 -  --enable-libopenh264       H.264 video encoding/decoding
 -  --enable-libopenjpeg       JPEG 2000 image encoding/decoding
 -  --enable-libopus           Opus audio encoding/decoding
 -  --enable-libpulse          Pulseaudio sound server
 -  --enable-librtmp           RTMP streaming
 -  --enable-libschroedinger   Dirac video encoding/decoding
 -  --enable-libsnappy         snappy compression
 -  --enable-libspeex          Speex audio encoding/decoding
 -  --enable-libtheora         Theora video encoding/decoding
 -  --enable-libtwolame        MP2 audio encoding
 -  --enable-libvo-aacenc      AAC audio encoding
 -  --enable-libvo-amrwbenc    AMR-WB audio encoding
 -  --enable-libvorbis         Vorbis audio encoding/decoding
 -  --enable-libvpx            VP* video encoding/decoding
 -  --enable-libwavpack        Wavpack audio encoding/decoding
 -  --enable-libwebp           WebP image encoding/decoding
 -  --enable-libx264           H.264 video encoding
 -  --enable-libx265           HEVC video encoding
 -  --enable-libxavs           Chinese AVS video encoding
 -  --enable-libxcb            X window system protocol communication
 -  --enable-libxcb-shm        X11 shm communication [auto]
 -  --enable-libxcb-xfixes     X11 mouse rendering [auto]
 -  --enable-libxvid           MPEG-4 ASP video encoding
 -  --enable-openssl           crypto
 -  --enable-zlib              compression [autodetect]
 +  themselves, not all their features will necessarily be usable by FFmpeg.
 +
 +  --disable-alsa           disable ALSA support [autodetect]
 +  --disable-appkit         disable Apple AppKit framework [autodetect]
 +  --disable-avfoundation   disable Apple AVFoundation framework [autodetect]
 +  --enable-avisynth        enable reading of AviSynth script files [no]
 +  --disable-bzlib          disable bzlib [autodetect]
 +  --disable-coreimage      disable Apple CoreImage framework [autodetect]
 +  --enable-chromaprint     enable audio fingerprinting with chromaprint [no]
 +  --enable-frei0r          enable frei0r video filtering [no]
 +  --enable-gcrypt          enable gcrypt, needed for rtmp(t)e support
 +                           if openssl, librtmp or gmp is not used [no]
 +  --enable-gmp             enable gmp, needed for rtmp(t)e support
 +                           if openssl or librtmp is not used [no]
 +  --enable-gnutls          enable gnutls, needed for https support
 +                           if openssl or libtls is not used [no]
 +  --disable-iconv          disable iconv [autodetect]
 +  --enable-jni             enable JNI support [no]
 +  --enable-ladspa          enable LADSPA audio filtering [no]
++  --enable-libaom          enable AV1 video encoding/decoding via libaom [no]
 +  --enable-libass          enable libass subtitles rendering,
 +                           needed for subtitles and ass filter [no]
 +  --enable-libbluray       enable BluRay reading using libbluray [no]
 +  --enable-libbs2b         enable bs2b DSP library [no]
 +  --enable-libcaca         enable textual display using libcaca [no]
 +  --enable-libcelt         enable CELT decoding via libcelt [no]
 +  --enable-libcdio         enable audio CD grabbing with libcdio [no]
 +  --enable-libcodec2       enable codec2 en/decoding using libcodec2 [no]
 +  --enable-libdc1394       enable IIDC-1394 grabbing using libdc1394
 +                           and libraw1394 [no]
 +  --enable-libfdk-aac      enable AAC de/encoding via libfdk-aac [no]
 +  --enable-libflite        enable flite (voice synthesis) support via libflite [no]
 +  --enable-libfontconfig   enable libfontconfig, useful for drawtext filter [no]
 +  --enable-libfreetype     enable libfreetype, needed for drawtext filter [no]
 +  --enable-libfribidi      enable libfribidi, improves drawtext filter [no]
 +  --enable-libgme          enable Game Music Emu via libgme [no]
 +  --enable-libgsm          enable GSM de/encoding via libgsm [no]
 +  --enable-libiec61883     enable iec61883 via libiec61883 [no]
 +  --enable-libilbc         enable iLBC de/encoding via libilbc [no]
 +  --enable-libjack         enable JACK audio sound server [no]
 +  --enable-libkvazaar      enable HEVC encoding via libkvazaar [no]
 +  --enable-libmodplug      enable ModPlug via libmodplug [no]
 +  --enable-libmp3lame      enable MP3 encoding via libmp3lame [no]
 +  --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
 +  --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
 +  --enable-libopencv       enable video filtering via libopencv [no]
 +  --enable-libopenh264     enable H.264 encoding via OpenH264 [no]
 +  --enable-libopenjpeg     enable JPEG 2000 de/encoding via OpenJPEG [no]
 +  --enable-libopenmpt      enable decoding tracked files via libopenmpt [no]
 +  --enable-libopus         enable Opus de/encoding via libopus [no]
 +  --enable-libpulse        enable Pulseaudio input via libpulse [no]
 +  --enable-librsvg         enable SVG rasterization via librsvg [no]
 +  --enable-librubberband   enable rubberband needed for rubberband filter [no]
 +  --enable-librtmp         enable RTMP[E] support via librtmp [no]
 +  --enable-libshine        enable fixed-point MP3 encoding via libshine [no]
 +  --enable-libsmbclient    enable Samba protocol via libsmbclient [no]
 +  --enable-libsnappy       enable Snappy compression, needed for hap encoding [no]
 +  --enable-libsoxr         enable Include libsoxr resampling [no]
 +  --enable-libspeex        enable Speex de/encoding via libspeex [no]
 +  --enable-libssh          enable SFTP protocol via libssh [no]
 +  --enable-libtesseract    enable Tesseract, needed for ocr filter [no]
 +  --enable-libtheora       enable Theora encoding via libtheora [no]
 +  --enable-libtls          enable LibreSSL (via libtls), needed for https support
 +                           if openssl or gnutls is not used [no]
 +  --enable-libtwolame      enable MP2 encoding via libtwolame [no]
 +  --enable-libv4l2         enable libv4l2/v4l-utils [no]
 +  --enable-libvidstab      enable video stabilization using vid.stab [no]
 +  --enable-libvmaf         enable vmaf filter via libvmaf [no]
 +  --enable-libvo-amrwbenc  enable AMR-WB encoding via libvo-amrwbenc [no]
 +  --enable-libvorbis       enable Vorbis en/decoding via libvorbis,
 +                           native implementation exists [no]
 +  --enable-libvpx          enable VP8 and VP9 de/encoding via libvpx [no]
 +  --enable-libwavpack      enable wavpack encoding via libwavpack [no]
 +  --enable-libwebp         enable WebP encoding via libwebp [no]
 +  --enable-libx264         enable H.264 encoding via x264 [no]
 +  --enable-libx265         enable HEVC encoding via x265 [no]
 +  --enable-libxavs         enable AVS encoding via xavs [no]
 +  --enable-libxcb          enable X11 grabbing using XCB [autodetect]
 +  --enable-libxcb-shm      enable X11 grabbing shm communication [autodetect]
 +  --enable-libxcb-xfixes   enable X11 grabbing mouse rendering [autodetect]
 +  --enable-libxcb-shape    enable X11 grabbing shape rendering [autodetect]
 +  --enable-libxvid         enable Xvid encoding via xvidcore,
 +                           native MPEG-4/Xvid encoder exists [no]
 +  --enable-libxml2         enable XML parsing using the C library libxml2 [no]
 +  --enable-libzimg         enable z.lib, needed for zscale filter [no]
 +  --enable-libzmq          enable message passing via libzmq [no]
 +  --enable-libzvbi         enable teletext support via libzvbi [no]
 +  --enable-lv2             enable LV2 audio filtering [no]
 +  --disable-lzma           disable lzma [autodetect]
 +  --enable-decklink        enable Blackmagic DeckLink I/O support [no]
 +  --enable-libndi_newtek   enable Newteck NDI I/O support [no]
 +  --enable-mediacodec      enable Android MediaCodec support [no]
 +  --enable-libmysofa       enable libmysofa, needed for sofalizer filter [no]
 +  --enable-openal          enable OpenAL 1.1 capture support [no]
 +  --enable-opencl          enable OpenCL processing [no]
 +  --enable-opengl          enable OpenGL rendering [no]
 +  --enable-openssl         enable openssl, needed for https support
 +                           if gnutls or libtls is not used [no]
 +  --disable-sndio          disable sndio support [autodetect]
 +  --disable-schannel       disable SChannel SSP, needed for TLS support on
 +                           Windows if openssl and gnutls are not used [autodetect]
 +  --disable-sdl2           disable sdl2 [autodetect]
 +  --disable-securetransport disable Secure Transport, needed for TLS support
 +                           on OSX if openssl and gnutls are not used [autodetect]
 +  --disable-xlib           disable xlib [autodetect]
 +  --disable-zlib           disable zlib [autodetect]
  
    The following libraries provide various hardware acceleration features:
 -  --enable-amf     AMF video encoding code [auto]
 -  --enable-cuda    Nvidia CUDA (dynamically linked)
 -  --enable-cuvid   Nvidia CUVID video decode acceleration
 -  --enable-d3d11va Microsoft Direct3D 11 video acceleration [auto]
 -  --enable-dxva2   Microsoft DirectX 9 video acceleration [auto]
 -  --enable-libmfx  Intel MediaSDK (AKA Quick Sync Video)
 -  --enable-libnpp  Nvidia CUDA processing
 -  --enable-mmal    Broadcom Multi-Media Abstraction Layer (Raspberry Pi)
 -  --enable-nvenc   Nvidia video encoding
 -  --enable-omx     OpenMAX IL
 -  --enable-omx-rpi OpenMAX IL for Raspberry Pi
 -  --enable-vaapi   Video Acceleration API (mainly Unix/Intel)
 -  --enable-vda     Apple Video Decode Acceleration [auto]
 -  --enable-vdpau   Nvidia Video Decode and Presentation API for Unix [auto]
 +  --disable-amf            disable AMF video encoding code [autodetect]
 +  --disable-audiotoolbox   disable Apple AudioToolbox code [autodetect]
 +  --enable-cuda-sdk        enable CUDA features that require the CUDA SDK [no]
 +  --disable-cuvid          disable Nvidia CUVID support [autodetect]
 +  --disable-d3d11va        disable Microsoft Direct3D 11 video acceleration code [autodetect]
 +  --disable-dxva2          disable Microsoft DirectX 9 video acceleration code [autodetect]
 +  --disable-ffnvcodec      disable dynamically linked Nvidia code [autodetect]
 +  --enable-libdrm          enable DRM code (Linux) [no]
 +  --enable-libmfx          enable Intel MediaSDK (AKA Quick Sync Video) code via libmfx [no]
 +  --enable-libnpp          enable Nvidia Performance Primitives-based code [no]
 +  --enable-mmal            enable Broadcom Multi-Media Abstraction Layer (Raspberry Pi) via MMAL [no]
 +  --disable-nvdec          disable Nvidia video decoding acceleration (via hwaccel) [autodetect]
 +  --disable-nvenc          disable Nvidia video encoding code [autodetect]
 +  --enable-omx             enable OpenMAX IL code [no]
 +  --enable-omx-rpi         enable OpenMAX IL code for Raspberry Pi [no]
 +  --enable-rkmpp           enable Rockchip Media Process Platform code [no]
 +  --disable-v4l2-m2m       disable V4L2 mem2mem code [autodetect]
 +  --disable-vaapi          disable Video Acceleration API (mainly Unix/Intel) code [autodetect]
 +  --disable-vdpau          disable Nvidia Video Decode and Presentation API for Unix code [autodetect]
 +  --disable-videotoolbox   disable VideoToolbox code [autodetect]
  
  Toolchain options:
    --arch=ARCH              select architecture [$arch]
@@@ -1647,27 -1346,18 +1648,28 @@@ EXTERNAL_LIBRARY_LIST=
      $EXTERNAL_LIBRARY_GPL_LIST
      $EXTERNAL_LIBRARY_NONFREE_LIST
      $EXTERNAL_LIBRARY_VERSION3_LIST
 -    avisynth
 -    avxsynth
 -    frei0r
 +    $EXTERNAL_LIBRARY_GPLV3_LIST
 +    chromaprint
 +    gcrypt
      gnutls
 +    jni
 +    ladspa
+     libaom
 +    libass
 +    libbluray
      libbs2b
 +    libcaca
 +    libcelt
 +    libcodec2
      libdc1394
 -    libdcadec
 +    libdrm
 +    libflite
      libfontconfig
      libfreetype
 +    libfribidi
 +    libgme
      libgsm
 -    libhdcd
 +    libiec61883
      libilbc
      libjack
      libkvazaar
@@@ -2962,51 -2358,17 +2964,52 @@@ h264_redundant_pps_bsf_select="cbs_h264
  hevc_metadata_bsf_select="cbs_h265"
  mjpeg2jpeg_bsf_select="jpegtables"
  mpeg2_metadata_bsf_select="cbs_mpeg2"
 -trace_headers_bsf_select="cbs_h264 cbs_h265 cbs_mpeg2"
 +trace_headers_bsf_select="cbs"
  
  # external libraries
 -avisynth_deps="LoadLibrary"
 -avxsynth_deps="libdl"
 -avisynth_demuxer_deps_any="avisynth avxsynth"
 +aac_at_decoder_deps="audiotoolbox"
 +aac_at_decoder_select="aac_adtstoasc_bsf"
 +ac3_at_decoder_deps="audiotoolbox"
 +ac3_at_decoder_select="ac3_parser"
 +adpcm_ima_qt_at_decoder_deps="audiotoolbox"
 +alac_at_decoder_deps="audiotoolbox"
 +amr_nb_at_decoder_deps="audiotoolbox"
 +avisynth_deps_any="libdl LoadLibrary"
 +avisynth_demuxer_deps="avisynth"
  avisynth_demuxer_select="riffdec"
 +eac3_at_decoder_deps="audiotoolbox"
 +eac3_at_decoder_select="ac3_parser"
 +gsm_ms_at_decoder_deps="audiotoolbox"
 +ilbc_at_decoder_deps="audiotoolbox"
 +mp1_at_decoder_deps="audiotoolbox"
 +mp2_at_decoder_deps="audiotoolbox"
 +mp3_at_decoder_deps="audiotoolbox"
 +mp1_at_decoder_select="mpegaudioheader"
 +mp2_at_decoder_select="mpegaudioheader"
 +mp3_at_decoder_select="mpegaudioheader"
 +pcm_alaw_at_decoder_deps="audiotoolbox"
 +pcm_mulaw_at_decoder_deps="audiotoolbox"
 +qdmc_at_decoder_deps="audiotoolbox"
 +qdm2_at_decoder_deps="audiotoolbox"
 +aac_at_encoder_deps="audiotoolbox"
 +aac_at_encoder_select="audio_frame_queue"
 +alac_at_encoder_deps="audiotoolbox"
 +alac_at_encoder_select="audio_frame_queue"
 +ilbc_at_encoder_deps="audiotoolbox"
 +ilbc_at_encoder_select="audio_frame_queue"
 +pcm_alaw_at_encoder_deps="audiotoolbox"
 +pcm_alaw_at_encoder_select="audio_frame_queue"
 +pcm_mulaw_at_encoder_deps="audiotoolbox"
 +pcm_mulaw_at_encoder_select="audio_frame_queue"
 +chromaprint_muxer_deps="chromaprint"
 +h264_videotoolbox_encoder_deps="pthreads"
 +h264_videotoolbox_encoder_select="videotoolbox_encoder"
 +hevc_videotoolbox_encoder_deps="pthreads"
 +hevc_videotoolbox_encoder_select="videotoolbox_encoder"
+ libaom_av1_decoder_deps="libaom"
 -libdcadec_decoder_deps="libdcadec"
 -libfaac_encoder_deps="libfaac"
 -libfaac_encoder_select="audio_frame_queue"
 +libcelt_decoder_deps="libcelt"
 +libcodec2_decoder_deps="libcodec2"
 +libcodec2_encoder_deps="libcodec2"
  libfdk_aac_decoder_deps="libfdk_aac"
  libfdk_aac_encoder_deps="libfdk_aac"
  libfdk_aac_encoder_select="audio_frame_queue"
@@@ -5915,136 -4635,62 +5918,137 @@@ for func in $MATH_FUNCS; d
      eval check_mathfunc $func \${${func}_args:-1} $libm_extralibs
  done
  
 +for func in $COMPLEX_FUNCS; do
 +    eval check_complexfunc $func \${${func}_args:-1}
 +done
 +
  # these are off by default, so fail if requested and not available
 -enabled amf               && require_cpp_condition AMF/core/Version.h "(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 0x0001000400040001"
 -enabled avisynth          && require_header avisynth/avisynth_c.h
 -enabled avxsynth          && require_header avxsynth/avxsynth_c.h
 -enabled cuda              && require cuda cuda.h cuInit -lcuda
 -enabled cuvid             && require cuvid cuviddec.h cuvidCreateDecoder -lnvcuvid
 +enabled cuda_sdk          && require cuda_sdk cuda.h cuCtxCreate -lcuda
 +enabled chromaprint       && require chromaprint chromaprint.h chromaprint_get_version -lchromaprint
 +enabled decklink          && { require_header DeckLinkAPI.h &&
 +                               { test_cpp_condition DeckLinkAPIVersion.h "BLACKMAGIC_DECKLINK_API_VERSION >= 0x0a060100" || die "ERROR: Decklink API version must be >= 10.6.1."; } }
 +enabled libndi_newtek     && require_header Processing.NDI.Lib.h
  enabled frei0r            && require_header frei0r.h
 -enabled gnutls            && require_pkg_config gnutls gnutls gnutls/gnutls.h gnutls_global_init &&
 -                             check_lib gmp gmp.h mpz_export -lgmp
 +enabled gmp               && require gmp gmp.h mpz_export -lgmp
 +enabled gnutls            && require_pkg_config gnutls gnutls gnutls/gnutls.h gnutls_global_init
 +enabled jni               && { [ $target_os = "android" ] && check_header jni.h && enabled pthreads || die "ERROR: jni not found"; }
 +enabled ladspa            && require_header ladspa.h
+ enabled libaom            && require_pkg_config libaom "aom >= 0.1.0" aom/aom_codec.h aom_codec_version
 +enabled lv2               && require_pkg_config lv2 lilv-0 "lilv-0/lilv/lilv.h" lilv_world_new
 +enabled libiec61883       && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
 +enabled libass            && require_pkg_config libass libass ass/ass.h ass_library_init
 +enabled libbluray         && require_pkg_config libbluray libbluray libbluray/bluray.h bd_open
  enabled libbs2b           && require_pkg_config libbs2b libbs2b bs2b.h bs2b_open
 +enabled libcelt           && require libcelt celt/celt.h celt_decode -lcelt0 &&
 +                             { check_lib libcelt celt/celt.h celt_decoder_create_custom -lcelt0 ||
 +                               die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
 +enabled libcaca           && require_pkg_config libcaca caca caca.h caca_create_canvas
 +enabled libcodec2         && require libcodec2 codec2/codec2.h codec2_create -lcodec2
  enabled libdc1394         && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new
 -enabled libdcadec         && require libdcadec libdcadec/dca_context.h dcadec_context_create -ldcadec
 -enabled libfaac           && require libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
 -enabled libfdk_aac        && require_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen
 +enabled libdrm            && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion
 +enabled libfdk_aac        && { check_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen ||
 +                               { require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac &&
 +                                 warn "using libfdk without pkg-config"; } }
 +flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite"
 +enabled libflite          && require libflite "flite/flite.h" flite_init $flite_extralibs
 +enabled fontconfig        && enable libfontconfig
  enabled libfontconfig     && require_pkg_config libfontconfig fontconfig "fontconfig/fontconfig.h" FcInit
  enabled libfreetype       && require_pkg_config libfreetype freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
 -enabled libgsm            && require libgsm gsm.h gsm_create -lgsm
 -enabled libhdcd           && require_pkg_config libhdcd libhdcd "hdcd/hdcd_simple.h" hdcd_new
 -enabled libilbc           && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
 +enabled libfribidi        && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info
 +enabled libgme            && { check_pkg_config libgme libgme gme/gme.h gme_new_emu ||
 +                               require libgme gme/gme.h gme_new_emu -lgme -lstdc++; }
 +enabled libgsm            && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
 +                                   check_lib libgsm "${gsm_hdr}" gsm_create -lgsm && break;
 +                               done || die "ERROR: libgsm not found"; }
 +enabled libilbc           && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc $pthreads_extralibs
  enabled libkvazaar        && require_pkg_config libkvazaar "kvazaar >= 0.8.1" kvazaar.h kvz_api_get
 -enabled libmfx            && require_pkg_config libmfx libmfx "mfx/mfxvideo.h" MFXInit
 -enabled libmp3lame        && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
 -enabled libnpp            && require libnpp npp.h nppGetLibVersion -lnppi -lnppc
 +# While it may appear that require is being used as a pkg-config
 +# fallback for libmfx, it is actually being used to detect a different
 +# installation route altogether.  If libmfx is installed via the Intel
 +# Media SDK or Intel Media Server Studio, these don't come with
 +# pkg-config support.  Instead, users should make sure that the build
 +# can find the libraries and headers through other means.
 +enabled libmfx            && { check_pkg_config libmfx libmfx "mfx/mfxvideo.h" MFXInit ||
 +                               { require libmfx "mfx/mfxvideo.h" MFXInit "-llibmfx $advapi32_extralibs" && warn "using libmfx without pkg-config"; } }
 +enabled libmodplug        && require_pkg_config libmodplug libmodplug libmodplug/modplug.h ModPlug_Load
 +enabled libmp3lame        && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame $libm_extralibs
 +enabled libmysofa         && require libmysofa "mysofa.h" mysofa_load -lmysofa $zlib_extralibs
 +enabled libnpp            && { check_lib libnpp npp.h nppGetLibVersion -lnppig -lnppicc -lnppc ||
 +                               check_lib libnpp npp.h nppGetLibVersion -lnppi -lnppc ||
 +                               die "ERROR: libnpp not found"; }
  enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
 -enabled libopencv         && require_pkg_config libopencv opencv opencv/cv.h cvCreateImageHeader
 +enabled libopencv         && { check_header opencv2/core/core_c.h &&
 +                               { check_pkg_config libopencv opencv opencv2/core/core_c.h cvCreateImageHeader ||
 +                                 require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
 +                               require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; }
  enabled libopenh264       && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion
 -enabled libopenjpeg       && { check_lib libopenjpeg openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC ||
 -                               require_pkg_config libopenjpeg libopenjpeg1 openjpeg.h opj_version -DOPJ_STATIC; }
 -enabled libopus           && require_pkg_config libopus opus opus_multistream.h opus_multistream_decoder_create
 -enabled libpulse          && require_pkg_config libpulse libpulse-simple pulse/simple.h pa_simple_new
 +enabled libopenjpeg       && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version ||
 +                               { require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } }
 +enabled libopenmpt        && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++"
 +enabled libopus           && {
 +    enabled libopus_decoder && {
 +        require_pkg_config libopus opus opus_multistream.h opus_multistream_decoder_create
 +    }
 +    enabled libopus_encoder && {
 +        require_pkg_config libopus opus opus_multistream.h opus_multistream_surround_encoder_create
 +    }
 +}
 +enabled libpulse          && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new
 +enabled librsvg           && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo
  enabled librtmp           && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket
 -enabled libschroedinger   && require_pkg_config libschroedinger schroedinger-1.0 schroedinger/schro.h schro_init
 -enabled libsnappy         && require libsnappy snappy-c.h snappy_compress -lsnappy
 +enabled librubberband     && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++"
 +enabled libshine          && require_pkg_config libshine shine shine/layer3.h shine_encode_buffer
 +enabled libsmbclient      && { check_pkg_config libsmbclient smbclient libsmbclient.h smbc_init ||
 +                               require libsmbclient libsmbclient.h smbc_init -lsmbclient; }
 +enabled libsnappy         && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
 +enabled libsoxr           && require libsoxr soxr.h soxr_create -lsoxr
 +enabled libssh            && require_pkg_config libssh libssh libssh/sftp.h sftp_init
  enabled libspeex          && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
 +enabled libtesseract      && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate
  enabled libtheora         && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
 -enabled libtwolame        && require libtwolame twolame.h twolame_init -ltwolame
 -enabled libvo_aacenc      && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
 +enabled libtls            && require_pkg_config libtls libtls tls.h tls_configure
 +enabled libtwolame        && require libtwolame twolame.h twolame_init -ltwolame &&
 +                             { check_lib libtwolame twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
 +                               die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
 +enabled libv4l2           && require_pkg_config libv4l2 libv4l2 libv4l2.h v4l2_ioctl
 +enabled libvidstab        && require_pkg_config libvidstab "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit
 +enabled libvmaf           && require_pkg_config libvmaf "libvmaf >= 0.6.2" libvmaf.h compute_vmaf
  enabled libvo_amrwbenc    && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
 -enabled libvorbis         && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
 -enabled libvpx            && require_pkg_config libvpx "vpx >= 1.3.0" vpx/vpx_codec.h vpx_codec_version &&
 -                             { enabled libvpx_vp8_decoder &&
 -                                   check_pkg_config libvpx_vp8_decoder vpx "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx
 -                               enabled libvpx_vp8_encoder &&
 -                                   check_pkg_config libvpx_vp8_encoder vpx "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx
 -                               enabled libvpx_vp9_decoder &&
 -                                   check_pkg_config libvpx_vp9_decoder vpx "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx
 -                               enabled libvpx_vp9_encoder &&
 -                                   check_pkg_config libvpx_vp9_encoder vpx "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx
 -                               disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder &&
 -                                   die "libvpx enabled but no supported decoders/encoders found"
 -                             }
 +enabled libvorbis         && require_pkg_config libvorbis vorbis vorbis/codec.h vorbis_info_init &&
 +                             require_pkg_config libvorbisenc vorbisenc vorbis/vorbisenc.h vorbis_encode_init
 +
 +enabled libvpx            && {
 +    enabled libvpx_vp8_decoder && {
 +        check_pkg_config libvpx_vp8_decoder "vpx >= 1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx ||
 +            check_lib libvpx_vp8_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_dec_init_ver VPX_IMG_FMT_HIGHBITDEPTH" -lvpx ||
 +                die "ERROR: libvpx decoder version must be >=1.4.0";
 +    }
 +    enabled libvpx_vp8_encoder && {
 +        check_pkg_config libvpx_vp8_encoder "vpx >= 1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx ||
 +            check_lib libvpx_vp8_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_IMG_FMT_HIGHBITDEPTH" -lvpx ||
 +                die "ERROR: libvpx encoder version must be >=1.4.0";
 +    }
 +    enabled libvpx_vp9_decoder && {
 +        check_pkg_config libvpx_vp9_decoder "vpx >= 1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx ||
 +            check_lib libvpx_vp9_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs"
 +    }
 +    enabled libvpx_vp9_encoder && {
 +        check_pkg_config libvpx_vp9_encoder "vpx >= 1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx ||
 +            check_lib libvpx_vp9_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs"
 +    }
 +    if disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder; then
 +        die "libvpx enabled but no supported decoders found"
 +    fi
 +}
 +
  enabled libwavpack        && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput  -lwavpack
 -enabled libwebp           && require_pkg_config libwebp libwebp webp/encode.h WebPGetEncoderVersion
 -enabled libx264           && require_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode &&
 +enabled libwebp           && {
 +    enabled libwebp_encoder      && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
 +    enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
 +enabled libx264           && { check_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode ||
 +                               { require libx264 "stdint.h x264.h" x264_encoder_encode "-lx264 $pthreads_extralibs $libm_extralibs" &&
 +                                 warn "using libx264 without pkg-config"; } } &&
                               require_cpp_condition x264.h "X264_BUILD >= 118" &&
                               check_cpp_condition libx262 x264.h "X264_MPEG2"
  enabled libx265           && require_pkg_config libx265 x265 x265.h x265_api_get &&
diff --cc doc/general.texi
index c5d46d3404,e066b42187..00d5d684ce
--- a/doc/general.texi
+++ b/doc/general.texi
@@@ -17,15 -16,15 +17,23 @@@ for more formats. None of them are use
  explicitly requested by passing the appropriate flags to
  @command{./configure}.
  
 - at section Alliance for Open Media libaom
+++ at section Alliance for Open Media libaom
+ 
 -Libav can make use of the libaom library for AV1 decoding.
++FFmpeg can make use of the libaom library for AV1 decoding.
+ 
+ Go to @url{http://aomedia.org/} and follow the instructions for
+ installing the library. Then pass @code{--enable-libaom} to configure to
+ enable it.
+ 
 - at section OpenCORE and VisualOn libraries
 + at section OpenJPEG
 +
 +FFmpeg can use the OpenJPEG libraries for encoding/decoding J2K videos.  Go to
 + at url{http://www.openjpeg.org/} to get the libraries and follow the installation
 +instructions.  To enable using OpenJPEG in FFmpeg, pass @code{--enable-libopenjpeg} to
 + at file{./configure}.
 +
 +
 + at section OpenCORE, VisualOn, and Fraunhofer libraries
  
  Spun off Google Android sources, OpenCore, VisualOn and Fraunhofer
  libraries provide encoders for a number of audio codecs.
@@@ -719,12 -625,10 +727,14 @@@ following image formats are supported
  @item Autodesk Animator Flic video  @tab     @tab  X
  @item Autodesk RLE           @tab     @tab  X
      @tab fourcc: AASC
+ @item AV1                    @tab     @tab  E
+     @tab Supported through external library libaom
 + at item Avid 1:1 10-bit RGB Packer  @tab  X  @tab  X
 +    @tab fourcc: AVrp
  @item AVS (Audio Video Standard) video  @tab     @tab  X
      @tab Video encoding used by the Creature Shock game.
 + at item AYUV                   @tab  X  @tab  X
 +    @tab Microsoft uncompressed packed 4:4:4:4
  @item Beam Software VB       @tab     @tab  X
  @item Bethesda VID video     @tab     @tab  X
      @tab Used in some games from Bethesda Softworks.
diff --cc libavcodec/Makefile
index aaef6c3ab8,0b50a839bc..127f53596a
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@@ -915,33 -686,10 +915,34 @@@ OBJS-$(CONFIG_SPDIF_MUXER)             
  OBJS-$(CONFIG_TAK_DEMUXER)             += tak.o
  OBJS-$(CONFIG_WEBM_MUXER)              += mpeg4audio.o
  
 +# libavfilter dependencies
 +OBJS-$(CONFIG_ELBG_FILTER)             += elbg.o
 +
  # external codec libraries
 -OBJS-$(CONFIG_LIBAOM_AV1_DECODER)         += libaomdec.o libaom.o
 -OBJS-$(CONFIG_LIBDCADEC_DECODER)          += libdcadec.o dca.o
 -OBJS-$(CONFIG_LIBFAAC_ENCODER)            += libfaac.o
 +OBJS-$(CONFIG_AAC_AT_DECODER)             += audiotoolboxdec.o
 +OBJS-$(CONFIG_AC3_AT_DECODER)             += audiotoolboxdec.o
 +OBJS-$(CONFIG_ADPCM_IMA_QT_AT_DECODER)    += audiotoolboxdec.o
 +OBJS-$(CONFIG_ALAC_AT_DECODER)            += audiotoolboxdec.o
 +OBJS-$(CONFIG_AMR_NB_AT_DECODER)          += audiotoolboxdec.o
 +OBJS-$(CONFIG_EAC3_AT_DECODER)            += audiotoolboxdec.o
 +OBJS-$(CONFIG_GSM_MS_AT_DECODER)          += audiotoolboxdec.o
 +OBJS-$(CONFIG_ILBC_AT_DECODER)            += audiotoolboxdec.o
 +OBJS-$(CONFIG_MP1_AT_DECODER)             += audiotoolboxdec.o
 +OBJS-$(CONFIG_MP2_AT_DECODER)             += audiotoolboxdec.o
 +OBJS-$(CONFIG_MP3_AT_DECODER)             += audiotoolboxdec.o
 +OBJS-$(CONFIG_PCM_MULAW_AT_DECODER)       += audiotoolboxdec.o
 +OBJS-$(CONFIG_PCM_ALAW_AT_DECODER)        += audiotoolboxdec.o
 +OBJS-$(CONFIG_QDMC_AT_DECODER)            += audiotoolboxdec.o
 +OBJS-$(CONFIG_QDM2_AT_DECODER)            += audiotoolboxdec.o
 +OBJS-$(CONFIG_AAC_AT_ENCODER)             += audiotoolboxenc.o
 +OBJS-$(CONFIG_ALAC_AT_ENCODER)            += audiotoolboxenc.o
 +OBJS-$(CONFIG_ILBC_AT_ENCODER)            += audiotoolboxenc.o
 +OBJS-$(CONFIG_PCM_ALAW_AT_ENCODER)        += audiotoolboxenc.o
 +OBJS-$(CONFIG_PCM_MULAW_AT_ENCODER)       += audiotoolboxenc.o
++OBJS-$(CONFIG_LIBAOM_AV1_DECODER)         += libaomdec.o
 +OBJS-$(CONFIG_LIBCELT_DECODER)            += libcelt_dec.o
 +OBJS-$(CONFIG_LIBCODEC2_DECODER)          += libcodec2.o codec2utils.o
 +OBJS-$(CONFIG_LIBCODEC2_ENCODER)          += libcodec2.o codec2utils.o
  OBJS-$(CONFIG_LIBFDK_AAC_DECODER)         += libfdk-aacdec.o
  OBJS-$(CONFIG_LIBFDK_AAC_ENCODER)         += libfdk-aacenc.o
  OBJS-$(CONFIG_LIBGSM_DECODER)             += libgsmdec.o
diff --cc libavcodec/allcodecs.c
index 71719595c6,ec923cd511..be7f24725b
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@@ -29,791 -28,28 +29,792 @@@
  #include "avcodec.h"
  #include "version.h"
  
 -#define REGISTER_ENCODER(X, x)                                          \
 -    {                                                                   \
 -        extern AVCodec ff_##x##_encoder;                                \
 -        if (CONFIG_##X##_ENCODER)                                       \
 -            avcodec_register(&ff_##x##_encoder);                        \
 -    }
 +extern AVCodec ff_a64multi_encoder;
 +extern AVCodec ff_a64multi5_encoder;
 +extern AVCodec ff_aasc_decoder;
 +extern AVCodec ff_aic_decoder;
 +extern AVCodec ff_alias_pix_encoder;
 +extern AVCodec ff_alias_pix_decoder;
 +extern AVCodec ff_amv_encoder;
 +extern AVCodec ff_amv_decoder;
 +extern AVCodec ff_anm_decoder;
 +extern AVCodec ff_ansi_decoder;
 +extern AVCodec ff_apng_encoder;
 +extern AVCodec ff_apng_decoder;
 +extern AVCodec ff_asv1_encoder;
 +extern AVCodec ff_asv1_decoder;
 +extern AVCodec ff_asv2_encoder;
 +extern AVCodec ff_asv2_decoder;
 +extern AVCodec ff_aura_decoder;
 +extern AVCodec ff_aura2_decoder;
 +extern AVCodec ff_avrp_encoder;
 +extern AVCodec ff_avrp_decoder;
 +extern AVCodec ff_avrn_decoder;
 +extern AVCodec ff_avs_decoder;
 +extern AVCodec ff_avui_encoder;
 +extern AVCodec ff_avui_decoder;
 +extern AVCodec ff_ayuv_encoder;
 +extern AVCodec ff_ayuv_decoder;
 +extern AVCodec ff_bethsoftvid_decoder;
 +extern AVCodec ff_bfi_decoder;
 +extern AVCodec ff_bink_decoder;
 +extern AVCodec ff_bmp_encoder;
 +extern AVCodec ff_bmp_decoder;
 +extern AVCodec ff_bmv_video_decoder;
 +extern AVCodec ff_brender_pix_decoder;
 +extern AVCodec ff_c93_decoder;
 +extern AVCodec ff_cavs_decoder;
 +extern AVCodec ff_cdgraphics_decoder;
 +extern AVCodec ff_cdxl_decoder;
 +extern AVCodec ff_cfhd_decoder;
 +extern AVCodec ff_cinepak_encoder;
 +extern AVCodec ff_cinepak_decoder;
 +extern AVCodec ff_clearvideo_decoder;
 +extern AVCodec ff_cljr_encoder;
 +extern AVCodec ff_cljr_decoder;
 +extern AVCodec ff_cllc_decoder;
 +extern AVCodec ff_comfortnoise_encoder;
 +extern AVCodec ff_comfortnoise_decoder;
 +extern AVCodec ff_cpia_decoder;
 +extern AVCodec ff_cscd_decoder;
 +extern AVCodec ff_cyuv_decoder;
 +extern AVCodec ff_dds_decoder;
 +extern AVCodec ff_dfa_decoder;
 +extern AVCodec ff_dirac_decoder;
 +extern AVCodec ff_dnxhd_encoder;
 +extern AVCodec ff_dnxhd_decoder;
 +extern AVCodec ff_dpx_encoder;
 +extern AVCodec ff_dpx_decoder;
 +extern AVCodec ff_dsicinvideo_decoder;
 +extern AVCodec ff_dvaudio_decoder;
 +extern AVCodec ff_dvvideo_encoder;
 +extern AVCodec ff_dvvideo_decoder;
 +extern AVCodec ff_dxa_decoder;
 +extern AVCodec ff_dxtory_decoder;
 +extern AVCodec ff_dxv_decoder;
 +extern AVCodec ff_eacmv_decoder;
 +extern AVCodec ff_eamad_decoder;
 +extern AVCodec ff_eatgq_decoder;
 +extern AVCodec ff_eatgv_decoder;
 +extern AVCodec ff_eatqi_decoder;
 +extern AVCodec ff_eightbps_decoder;
 +extern AVCodec ff_eightsvx_exp_decoder;
 +extern AVCodec ff_eightsvx_fib_decoder;
 +extern AVCodec ff_escape124_decoder;
 +extern AVCodec ff_escape130_decoder;
 +extern AVCodec ff_exr_decoder;
 +extern AVCodec ff_ffv1_encoder;
 +extern AVCodec ff_ffv1_decoder;
 +extern AVCodec ff_ffvhuff_encoder;
 +extern AVCodec ff_ffvhuff_decoder;
 +extern AVCodec ff_fic_decoder;
 +extern AVCodec ff_fits_encoder;
 +extern AVCodec ff_fits_decoder;
 +extern AVCodec ff_flashsv_encoder;
 +extern AVCodec ff_flashsv_decoder;
 +extern AVCodec ff_flashsv2_encoder;
 +extern AVCodec ff_flashsv2_decoder;
 +extern AVCodec ff_flic_decoder;
 +extern AVCodec ff_flv_encoder;
 +extern AVCodec ff_flv_decoder;
 +extern AVCodec ff_fmvc_decoder;
 +extern AVCodec ff_fourxm_decoder;
 +extern AVCodec ff_fraps_decoder;
 +extern AVCodec ff_frwu_decoder;
 +extern AVCodec ff_g2m_decoder;
 +extern AVCodec ff_gdv_decoder;
 +extern AVCodec ff_gif_encoder;
 +extern AVCodec ff_gif_decoder;
 +extern AVCodec ff_h261_encoder;
 +extern AVCodec ff_h261_decoder;
 +extern AVCodec ff_h263_encoder;
 +extern AVCodec ff_h263_decoder;
 +extern AVCodec ff_h263i_decoder;
 +extern AVCodec ff_h263p_encoder;
 +extern AVCodec ff_h263p_decoder;
 +extern AVCodec ff_h263_v4l2m2m_decoder;
 +extern AVCodec ff_h264_decoder;
 +extern AVCodec ff_h264_crystalhd_decoder;
 +extern AVCodec ff_h264_v4l2m2m_decoder;
 +extern AVCodec ff_h264_mediacodec_decoder;
 +extern AVCodec ff_h264_mmal_decoder;
 +extern AVCodec ff_h264_qsv_decoder;
 +extern AVCodec ff_h264_rkmpp_decoder;
 +extern AVCodec ff_hap_encoder;
 +extern AVCodec ff_hap_decoder;
 +extern AVCodec ff_hevc_decoder;
 +extern AVCodec ff_hevc_qsv_decoder;
 +extern AVCodec ff_hevc_rkmpp_decoder;
 +extern AVCodec ff_hevc_v4l2m2m_decoder;
 +extern AVCodec ff_hnm4_video_decoder;
 +extern AVCodec ff_hq_hqa_decoder;
 +extern AVCodec ff_hqx_decoder;
 +extern AVCodec ff_huffyuv_encoder;
 +extern AVCodec ff_huffyuv_decoder;
 +extern AVCodec ff_idcin_decoder;
 +extern AVCodec ff_iff_ilbm_decoder;
 +extern AVCodec ff_indeo2_decoder;
 +extern AVCodec ff_indeo3_decoder;
 +extern AVCodec ff_indeo4_decoder;
 +extern AVCodec ff_indeo5_decoder;
 +extern AVCodec ff_interplay_video_decoder;
 +extern AVCodec ff_jpeg2000_encoder;
 +extern AVCodec ff_jpeg2000_decoder;
 +extern AVCodec ff_jpegls_encoder;
 +extern AVCodec ff_jpegls_decoder;
 +extern AVCodec ff_jv_decoder;
 +extern AVCodec ff_kgv1_decoder;
 +extern AVCodec ff_kmvc_decoder;
 +extern AVCodec ff_lagarith_decoder;
 +extern AVCodec ff_ljpeg_encoder;
 +extern AVCodec ff_loco_decoder;
 +extern AVCodec ff_m101_decoder;
 +extern AVCodec ff_magicyuv_encoder;
 +extern AVCodec ff_magicyuv_decoder;
 +extern AVCodec ff_mdec_decoder;
 +extern AVCodec ff_mimic_decoder;
 +extern AVCodec ff_mjpeg_encoder;
 +extern AVCodec ff_mjpeg_decoder;
 +extern AVCodec ff_mjpegb_decoder;
 +extern AVCodec ff_mmvideo_decoder;
 +extern AVCodec ff_motionpixels_decoder;
 +extern AVCodec ff_mpeg1video_encoder;
 +extern AVCodec ff_mpeg1video_decoder;
 +extern AVCodec ff_mpeg2video_encoder;
 +extern AVCodec ff_mpeg2video_decoder;
 +extern AVCodec ff_mpeg4_encoder;
 +extern AVCodec ff_mpeg4_decoder;
 +extern AVCodec ff_mpeg4_crystalhd_decoder;
 +extern AVCodec ff_mpeg4_v4l2m2m_decoder;
 +extern AVCodec ff_mpeg4_mmal_decoder;
 +extern AVCodec ff_mpegvideo_decoder;
 +extern AVCodec ff_mpeg1_v4l2m2m_decoder;
 +extern AVCodec ff_mpeg2_mmal_decoder;
 +extern AVCodec ff_mpeg2_crystalhd_decoder;
 +extern AVCodec ff_mpeg2_v4l2m2m_decoder;
 +extern AVCodec ff_mpeg2_qsv_decoder;
 +extern AVCodec ff_mpeg2_mediacodec_decoder;
 +extern AVCodec ff_msa1_decoder;
 +extern AVCodec ff_mscc_decoder;
 +extern AVCodec ff_msmpeg4v1_decoder;
 +extern AVCodec ff_msmpeg4v2_encoder;
 +extern AVCodec ff_msmpeg4v2_decoder;
 +extern AVCodec ff_msmpeg4v3_encoder;
 +extern AVCodec ff_msmpeg4v3_decoder;
 +extern AVCodec ff_msmpeg4_crystalhd_decoder;
 +extern AVCodec ff_msrle_decoder;
 +extern AVCodec ff_mss1_decoder;
 +extern AVCodec ff_mss2_decoder;
 +extern AVCodec ff_msvideo1_encoder;
 +extern AVCodec ff_msvideo1_decoder;
 +extern AVCodec ff_mszh_decoder;
 +extern AVCodec ff_mts2_decoder;
 +extern AVCodec ff_mvc1_decoder;
 +extern AVCodec ff_mvc2_decoder;
 +extern AVCodec ff_mxpeg_decoder;
 +extern AVCodec ff_nuv_decoder;
 +extern AVCodec ff_paf_video_decoder;
 +extern AVCodec ff_pam_encoder;
 +extern AVCodec ff_pam_decoder;
 +extern AVCodec ff_pbm_encoder;
 +extern AVCodec ff_pbm_decoder;
 +extern AVCodec ff_pcx_encoder;
 +extern AVCodec ff_pcx_decoder;
 +extern AVCodec ff_pgm_encoder;
 +extern AVCodec ff_pgm_decoder;
 +extern AVCodec ff_pgmyuv_encoder;
 +extern AVCodec ff_pgmyuv_decoder;
 +extern AVCodec ff_pictor_decoder;
 +extern AVCodec ff_pixlet_decoder;
 +extern AVCodec ff_png_encoder;
 +extern AVCodec ff_png_decoder;
 +extern AVCodec ff_ppm_encoder;
 +extern AVCodec ff_ppm_decoder;
 +extern AVCodec ff_prores_encoder;
 +extern AVCodec ff_prores_decoder;
 +extern AVCodec ff_prores_aw_encoder;
 +extern AVCodec ff_prores_ks_encoder;
 +extern AVCodec ff_prores_lgpl_decoder;
 +extern AVCodec ff_psd_decoder;
 +extern AVCodec ff_ptx_decoder;
 +extern AVCodec ff_qdraw_decoder;
 +extern AVCodec ff_qpeg_decoder;
 +extern AVCodec ff_qtrle_encoder;
 +extern AVCodec ff_qtrle_decoder;
 +extern AVCodec ff_r10k_encoder;
 +extern AVCodec ff_r10k_decoder;
 +extern AVCodec ff_r210_encoder;
 +extern AVCodec ff_r210_decoder;
 +extern AVCodec ff_rawvideo_encoder;
 +extern AVCodec ff_rawvideo_decoder;
 +extern AVCodec ff_rl2_decoder;
 +extern AVCodec ff_roq_encoder;
 +extern AVCodec ff_roq_decoder;
 +extern AVCodec ff_rpza_decoder;
 +extern AVCodec ff_rscc_decoder;
 +extern AVCodec ff_rv10_encoder;
 +extern AVCodec ff_rv10_decoder;
 +extern AVCodec ff_rv20_encoder;
 +extern AVCodec ff_rv20_decoder;
 +extern AVCodec ff_rv30_decoder;
 +extern AVCodec ff_rv40_decoder;
 +extern AVCodec ff_s302m_encoder;
 +extern AVCodec ff_s302m_decoder;
 +extern AVCodec ff_sanm_decoder;
 +extern AVCodec ff_scpr_decoder;
 +extern AVCodec ff_screenpresso_decoder;
 +extern AVCodec ff_sdx2_dpcm_decoder;
 +extern AVCodec ff_sgi_encoder;
 +extern AVCodec ff_sgi_decoder;
 +extern AVCodec ff_sgirle_decoder;
 +extern AVCodec ff_sheervideo_decoder;
 +extern AVCodec ff_smacker_decoder;
 +extern AVCodec ff_smc_decoder;
 +extern AVCodec ff_smvjpeg_decoder;
 +extern AVCodec ff_snow_encoder;
 +extern AVCodec ff_snow_decoder;
 +extern AVCodec ff_sp5x_decoder;
 +extern AVCodec ff_speedhq_decoder;
 +extern AVCodec ff_srgc_decoder;
 +extern AVCodec ff_sunrast_encoder;
 +extern AVCodec ff_sunrast_decoder;
 +extern AVCodec ff_svq1_encoder;
 +extern AVCodec ff_svq1_decoder;
 +extern AVCodec ff_svq3_decoder;
 +extern AVCodec ff_targa_encoder;
 +extern AVCodec ff_targa_decoder;
 +extern AVCodec ff_targa_y216_decoder;
 +extern AVCodec ff_tdsc_decoder;
 +extern AVCodec ff_theora_decoder;
 +extern AVCodec ff_thp_decoder;
 +extern AVCodec ff_tiertexseqvideo_decoder;
 +extern AVCodec ff_tiff_encoder;
 +extern AVCodec ff_tiff_decoder;
 +extern AVCodec ff_tmv_decoder;
 +extern AVCodec ff_truemotion1_decoder;
 +extern AVCodec ff_truemotion2_decoder;
 +extern AVCodec ff_truemotion2rt_decoder;
 +extern AVCodec ff_tscc_decoder;
 +extern AVCodec ff_tscc2_decoder;
 +extern AVCodec ff_txd_decoder;
 +extern AVCodec ff_ulti_decoder;
 +extern AVCodec ff_utvideo_encoder;
 +extern AVCodec ff_utvideo_decoder;
 +extern AVCodec ff_v210_encoder;
 +extern AVCodec ff_v210_decoder;
 +extern AVCodec ff_v210x_decoder;
 +extern AVCodec ff_v308_encoder;
 +extern AVCodec ff_v308_decoder;
 +extern AVCodec ff_v408_encoder;
 +extern AVCodec ff_v408_decoder;
 +extern AVCodec ff_v410_encoder;
 +extern AVCodec ff_v410_decoder;
 +extern AVCodec ff_vb_decoder;
 +extern AVCodec ff_vble_decoder;
 +extern AVCodec ff_vc1_decoder;
 +extern AVCodec ff_vc1_crystalhd_decoder;
 +extern AVCodec ff_vc1image_decoder;
 +extern AVCodec ff_vc1_mmal_decoder;
 +extern AVCodec ff_vc1_qsv_decoder;
 +extern AVCodec ff_vc1_v4l2m2m_decoder;
 +extern AVCodec ff_vc2_encoder;
 +extern AVCodec ff_vcr1_decoder;
 +extern AVCodec ff_vmdvideo_decoder;
 +extern AVCodec ff_vmnc_decoder;
 +extern AVCodec ff_vp3_decoder;
 +extern AVCodec ff_vp5_decoder;
 +extern AVCodec ff_vp6_decoder;
 +extern AVCodec ff_vp6a_decoder;
 +extern AVCodec ff_vp6f_decoder;
 +extern AVCodec ff_vp7_decoder;
 +extern AVCodec ff_vp8_decoder;
 +extern AVCodec ff_vp8_rkmpp_decoder;
 +extern AVCodec ff_vp8_v4l2m2m_decoder;
 +extern AVCodec ff_vp9_decoder;
 +extern AVCodec ff_vp9_rkmpp_decoder;
 +extern AVCodec ff_vp9_v4l2m2m_decoder;
 +extern AVCodec ff_vqa_decoder;
 +extern AVCodec ff_bitpacked_decoder;
 +extern AVCodec ff_webp_decoder;
 +extern AVCodec ff_wrapped_avframe_encoder;
 +extern AVCodec ff_wrapped_avframe_decoder;
 +extern AVCodec ff_wmv1_encoder;
 +extern AVCodec ff_wmv1_decoder;
 +extern AVCodec ff_wmv2_encoder;
 +extern AVCodec ff_wmv2_decoder;
 +extern AVCodec ff_wmv3_decoder;
 +extern AVCodec ff_wmv3_crystalhd_decoder;
 +extern AVCodec ff_wmv3image_decoder;
 +extern AVCodec ff_wnv1_decoder;
 +extern AVCodec ff_xan_wc3_decoder;
 +extern AVCodec ff_xan_wc4_decoder;
 +extern AVCodec ff_xbm_encoder;
 +extern AVCodec ff_xbm_decoder;
 +extern AVCodec ff_xface_encoder;
 +extern AVCodec ff_xface_decoder;
 +extern AVCodec ff_xl_decoder;
 +extern AVCodec ff_xpm_decoder;
 +extern AVCodec ff_xwd_encoder;
 +extern AVCodec ff_xwd_decoder;
 +extern AVCodec ff_y41p_encoder;
 +extern AVCodec ff_y41p_decoder;
 +extern AVCodec ff_ylc_decoder;
 +extern AVCodec ff_yop_decoder;
 +extern AVCodec ff_yuv4_encoder;
 +extern AVCodec ff_yuv4_decoder;
 +extern AVCodec ff_zero12v_decoder;
 +extern AVCodec ff_zerocodec_decoder;
 +extern AVCodec ff_zlib_encoder;
 +extern AVCodec ff_zlib_decoder;
 +extern AVCodec ff_zmbv_encoder;
 +extern AVCodec ff_zmbv_decoder;
 +
 +/* audio codecs */
 +extern AVCodec ff_aac_encoder;
 +extern AVCodec ff_aac_decoder;
 +extern AVCodec ff_aac_fixed_decoder;
 +extern AVCodec ff_aac_latm_decoder;
 +extern AVCodec ff_ac3_encoder;
 +extern AVCodec ff_ac3_decoder;
 +extern AVCodec ff_ac3_fixed_encoder;
 +extern AVCodec ff_ac3_fixed_decoder;
 +extern AVCodec ff_alac_encoder;
 +extern AVCodec ff_alac_decoder;
 +extern AVCodec ff_als_decoder;
 +extern AVCodec ff_amrnb_decoder;
 +extern AVCodec ff_amrwb_decoder;
 +extern AVCodec ff_ape_decoder;
 +extern AVCodec ff_aptx_encoder;
 +extern AVCodec ff_aptx_decoder;
 +extern AVCodec ff_aptx_hd_encoder;
 +extern AVCodec ff_aptx_hd_decoder;
 +extern AVCodec ff_atrac1_decoder;
 +extern AVCodec ff_atrac3_decoder;
 +extern AVCodec ff_atrac3al_decoder;
 +extern AVCodec ff_atrac3p_decoder;
 +extern AVCodec ff_atrac3pal_decoder;
 +extern AVCodec ff_binkaudio_dct_decoder;
 +extern AVCodec ff_binkaudio_rdft_decoder;
 +extern AVCodec ff_bmv_audio_decoder;
 +extern AVCodec ff_cook_decoder;
 +extern AVCodec ff_dca_encoder;
 +extern AVCodec ff_dca_decoder;
 +extern AVCodec ff_dolby_e_decoder;
 +extern AVCodec ff_dsd_lsbf_decoder;
 +extern AVCodec ff_dsd_msbf_decoder;
 +extern AVCodec ff_dsd_lsbf_planar_decoder;
 +extern AVCodec ff_dsd_msbf_planar_decoder;
 +extern AVCodec ff_dsicinaudio_decoder;
 +extern AVCodec ff_dss_sp_decoder;
 +extern AVCodec ff_dst_decoder;
 +extern AVCodec ff_eac3_encoder;
 +extern AVCodec ff_eac3_decoder;
 +extern AVCodec ff_evrc_decoder;
 +extern AVCodec ff_ffwavesynth_decoder;
 +extern AVCodec ff_flac_encoder;
 +extern AVCodec ff_flac_decoder;
 +extern AVCodec ff_g723_1_encoder;
 +extern AVCodec ff_g723_1_decoder;
 +extern AVCodec ff_g729_decoder;
 +extern AVCodec ff_gsm_decoder;
 +extern AVCodec ff_gsm_ms_decoder;
 +extern AVCodec ff_iac_decoder;
 +extern AVCodec ff_imc_decoder;
 +extern AVCodec ff_interplay_acm_decoder;
 +extern AVCodec ff_mace3_decoder;
 +extern AVCodec ff_mace6_decoder;
 +extern AVCodec ff_metasound_decoder;
 +extern AVCodec ff_mlp_encoder;
 +extern AVCodec ff_mlp_decoder;
 +extern AVCodec ff_mp1_decoder;
 +extern AVCodec ff_mp1float_decoder;
 +extern AVCodec ff_mp2_encoder;
 +extern AVCodec ff_mp2_decoder;
 +extern AVCodec ff_mp2float_decoder;
 +extern AVCodec ff_mp2fixed_encoder;
 +extern AVCodec ff_mp3_decoder;
 +extern AVCodec ff_mp3float_decoder;
 +extern AVCodec ff_mp3adu_decoder;
 +extern AVCodec ff_mp3adufloat_decoder;
 +extern AVCodec ff_mp3on4_decoder;
 +extern AVCodec ff_mp3on4float_decoder;
 +extern AVCodec ff_mpc7_decoder;
 +extern AVCodec ff_mpc8_decoder;
 +extern AVCodec ff_nellymoser_encoder;
 +extern AVCodec ff_nellymoser_decoder;
 +extern AVCodec ff_on2avc_decoder;
 +extern AVCodec ff_opus_encoder;
 +extern AVCodec ff_opus_decoder;
 +extern AVCodec ff_paf_audio_decoder;
 +extern AVCodec ff_qcelp_decoder;
 +extern AVCodec ff_qdm2_decoder;
 +extern AVCodec ff_qdmc_decoder;
 +extern AVCodec ff_ra_144_encoder;
 +extern AVCodec ff_ra_144_decoder;
 +extern AVCodec ff_ra_288_decoder;
 +extern AVCodec ff_ralf_decoder;
 +extern AVCodec ff_sbc_encoder;
 +extern AVCodec ff_sbc_decoder;
 +extern AVCodec ff_shorten_decoder;
 +extern AVCodec ff_sipr_decoder;
 +extern AVCodec ff_smackaud_decoder;
 +extern AVCodec ff_sonic_encoder;
 +extern AVCodec ff_sonic_decoder;
 +extern AVCodec ff_sonic_ls_encoder;
 +extern AVCodec ff_tak_decoder;
 +extern AVCodec ff_truehd_encoder;
 +extern AVCodec ff_truehd_decoder;
 +extern AVCodec ff_truespeech_decoder;
 +extern AVCodec ff_tta_encoder;
 +extern AVCodec ff_tta_decoder;
 +extern AVCodec ff_twinvq_decoder;
 +extern AVCodec ff_vmdaudio_decoder;
 +extern AVCodec ff_vorbis_encoder;
 +extern AVCodec ff_vorbis_decoder;
 +extern AVCodec ff_wavpack_encoder;
 +extern AVCodec ff_wavpack_decoder;
 +extern AVCodec ff_wmalossless_decoder;
 +extern AVCodec ff_wmapro_decoder;
 +extern AVCodec ff_wmav1_encoder;
 +extern AVCodec ff_wmav1_decoder;
 +extern AVCodec ff_wmav2_encoder;
 +extern AVCodec ff_wmav2_decoder;
 +extern AVCodec ff_wmavoice_decoder;
 +extern AVCodec ff_ws_snd1_decoder;
 +extern AVCodec ff_xma1_decoder;
 +extern AVCodec ff_xma2_decoder;
 +
 +/* PCM codecs */
 +extern AVCodec ff_pcm_alaw_encoder;
 +extern AVCodec ff_pcm_alaw_decoder;
 +extern AVCodec ff_pcm_bluray_decoder;
 +extern AVCodec ff_pcm_dvd_decoder;
 +extern AVCodec ff_pcm_f16le_decoder;
 +extern AVCodec ff_pcm_f24le_decoder;
 +extern AVCodec ff_pcm_f32be_encoder;
 +extern AVCodec ff_pcm_f32be_decoder;
 +extern AVCodec ff_pcm_f32le_encoder;
 +extern AVCodec ff_pcm_f32le_decoder;
 +extern AVCodec ff_pcm_f64be_encoder;
 +extern AVCodec ff_pcm_f64be_decoder;
 +extern AVCodec ff_pcm_f64le_encoder;
 +extern AVCodec ff_pcm_f64le_decoder;
 +extern AVCodec ff_pcm_lxf_decoder;
 +extern AVCodec ff_pcm_mulaw_encoder;
 +extern AVCodec ff_pcm_mulaw_decoder;
 +extern AVCodec ff_pcm_s8_encoder;
 +extern AVCodec ff_pcm_s8_decoder;
 +extern AVCodec ff_pcm_s8_planar_encoder;
 +extern AVCodec ff_pcm_s8_planar_decoder;
 +extern AVCodec ff_pcm_s16be_encoder;
 +extern AVCodec ff_pcm_s16be_decoder;
 +extern AVCodec ff_pcm_s16be_planar_encoder;
 +extern AVCodec ff_pcm_s16be_planar_decoder;
 +extern AVCodec ff_pcm_s16le_encoder;
 +extern AVCodec ff_pcm_s16le_decoder;
 +extern AVCodec ff_pcm_s16le_planar_encoder;
 +extern AVCodec ff_pcm_s16le_planar_decoder;
 +extern AVCodec ff_pcm_s24be_encoder;
 +extern AVCodec ff_pcm_s24be_decoder;
 +extern AVCodec ff_pcm_s24daud_encoder;
 +extern AVCodec ff_pcm_s24daud_decoder;
 +extern AVCodec ff_pcm_s24le_encoder;
 +extern AVCodec ff_pcm_s24le_decoder;
 +extern AVCodec ff_pcm_s24le_planar_encoder;
 +extern AVCodec ff_pcm_s24le_planar_decoder;
 +extern AVCodec ff_pcm_s32be_encoder;
 +extern AVCodec ff_pcm_s32be_decoder;
 +extern AVCodec ff_pcm_s32le_encoder;
 +extern AVCodec ff_pcm_s32le_decoder;
 +extern AVCodec ff_pcm_s32le_planar_encoder;
 +extern AVCodec ff_pcm_s32le_planar_decoder;
 +extern AVCodec ff_pcm_s64be_encoder;
 +extern AVCodec ff_pcm_s64be_decoder;
 +extern AVCodec ff_pcm_s64le_encoder;
 +extern AVCodec ff_pcm_s64le_decoder;
 +extern AVCodec ff_pcm_u8_encoder;
 +extern AVCodec ff_pcm_u8_decoder;
 +extern AVCodec ff_pcm_u16be_encoder;
 +extern AVCodec ff_pcm_u16be_decoder;
 +extern AVCodec ff_pcm_u16le_encoder;
 +extern AVCodec ff_pcm_u16le_decoder;
 +extern AVCodec ff_pcm_u24be_encoder;
 +extern AVCodec ff_pcm_u24be_decoder;
 +extern AVCodec ff_pcm_u24le_encoder;
 +extern AVCodec ff_pcm_u24le_decoder;
 +extern AVCodec ff_pcm_u32be_encoder;
 +extern AVCodec ff_pcm_u32be_decoder;
 +extern AVCodec ff_pcm_u32le_encoder;
 +extern AVCodec ff_pcm_u32le_decoder;
 +extern AVCodec ff_pcm_zork_decoder;
 +
 +/* DPCM codecs */
 +extern AVCodec ff_gremlin_dpcm_decoder;
 +extern AVCodec ff_interplay_dpcm_decoder;
 +extern AVCodec ff_roq_dpcm_encoder;
 +extern AVCodec ff_roq_dpcm_decoder;
 +extern AVCodec ff_sol_dpcm_decoder;
 +extern AVCodec ff_xan_dpcm_decoder;
 +
 +/* ADPCM codecs */
 +extern AVCodec ff_adpcm_4xm_decoder;
 +extern AVCodec ff_adpcm_adx_encoder;
 +extern AVCodec ff_adpcm_adx_decoder;
 +extern AVCodec ff_adpcm_afc_decoder;
 +extern AVCodec ff_adpcm_aica_decoder;
 +extern AVCodec ff_adpcm_ct_decoder;
 +extern AVCodec ff_adpcm_dtk_decoder;
 +extern AVCodec ff_adpcm_ea_decoder;
 +extern AVCodec ff_adpcm_ea_maxis_xa_decoder;
 +extern AVCodec ff_adpcm_ea_r1_decoder;
 +extern AVCodec ff_adpcm_ea_r2_decoder;
 +extern AVCodec ff_adpcm_ea_r3_decoder;
 +extern AVCodec ff_adpcm_ea_xas_decoder;
 +extern AVCodec ff_adpcm_g722_encoder;
 +extern AVCodec ff_adpcm_g722_decoder;
 +extern AVCodec ff_adpcm_g726_encoder;
 +extern AVCodec ff_adpcm_g726_decoder;
 +extern AVCodec ff_adpcm_g726le_encoder;
 +extern AVCodec ff_adpcm_g726le_decoder;
 +extern AVCodec ff_adpcm_ima_amv_decoder;
 +extern AVCodec ff_adpcm_ima_apc_decoder;
 +extern AVCodec ff_adpcm_ima_dat4_decoder;
 +extern AVCodec ff_adpcm_ima_dk3_decoder;
 +extern AVCodec ff_adpcm_ima_dk4_decoder;
 +extern AVCodec ff_adpcm_ima_ea_eacs_decoder;
 +extern AVCodec ff_adpcm_ima_ea_sead_decoder;
 +extern AVCodec ff_adpcm_ima_iss_decoder;
 +extern AVCodec ff_adpcm_ima_oki_decoder;
 +extern AVCodec ff_adpcm_ima_qt_encoder;
 +extern AVCodec ff_adpcm_ima_qt_decoder;
 +extern AVCodec ff_adpcm_ima_rad_decoder;
 +extern AVCodec ff_adpcm_ima_smjpeg_decoder;
 +extern AVCodec ff_adpcm_ima_wav_encoder;
 +extern AVCodec ff_adpcm_ima_wav_decoder;
 +extern AVCodec ff_adpcm_ima_ws_decoder;
 +extern AVCodec ff_adpcm_ms_encoder;
 +extern AVCodec ff_adpcm_ms_decoder;
 +extern AVCodec ff_adpcm_mtaf_decoder;
 +extern AVCodec ff_adpcm_psx_decoder;
 +extern AVCodec ff_adpcm_sbpro_2_decoder;
 +extern AVCodec ff_adpcm_sbpro_3_decoder;
 +extern AVCodec ff_adpcm_sbpro_4_decoder;
 +extern AVCodec ff_adpcm_swf_encoder;
 +extern AVCodec ff_adpcm_swf_decoder;
 +extern AVCodec ff_adpcm_thp_decoder;
 +extern AVCodec ff_adpcm_thp_le_decoder;
 +extern AVCodec ff_adpcm_vima_decoder;
 +extern AVCodec ff_adpcm_xa_decoder;
 +extern AVCodec ff_adpcm_yamaha_encoder;
 +extern AVCodec ff_adpcm_yamaha_decoder;
 +
 +/* subtitles */
 +extern AVCodec ff_ssa_encoder;
 +extern AVCodec ff_ssa_decoder;
 +extern AVCodec ff_ass_encoder;
 +extern AVCodec ff_ass_decoder;
 +extern AVCodec ff_ccaption_decoder;
 +extern AVCodec ff_dvbsub_encoder;
 +extern AVCodec ff_dvbsub_decoder;
 +extern AVCodec ff_dvdsub_encoder;
 +extern AVCodec ff_dvdsub_decoder;
 +extern AVCodec ff_jacosub_decoder;
 +extern AVCodec ff_microdvd_decoder;
 +extern AVCodec ff_movtext_encoder;
 +extern AVCodec ff_movtext_decoder;
 +extern AVCodec ff_mpl2_decoder;
 +extern AVCodec ff_pgssub_decoder;
 +extern AVCodec ff_pjs_decoder;
 +extern AVCodec ff_realtext_decoder;
 +extern AVCodec ff_sami_decoder;
 +extern AVCodec ff_srt_encoder;
 +extern AVCodec ff_srt_decoder;
 +extern AVCodec ff_stl_decoder;
 +extern AVCodec ff_subrip_encoder;
 +extern AVCodec ff_subrip_decoder;
 +extern AVCodec ff_subviewer_decoder;
 +extern AVCodec ff_subviewer1_decoder;
 +extern AVCodec ff_text_encoder;
 +extern AVCodec ff_text_decoder;
 +extern AVCodec ff_vplayer_decoder;
 +extern AVCodec ff_webvtt_encoder;
 +extern AVCodec ff_webvtt_decoder;
 +extern AVCodec ff_xsub_encoder;
 +extern AVCodec ff_xsub_decoder;
 +
 +/* external libraries */
 +extern AVCodec ff_aac_at_encoder;
 +extern AVCodec ff_aac_at_decoder;
 +extern AVCodec ff_ac3_at_decoder;
 +extern AVCodec ff_adpcm_ima_qt_at_decoder;
 +extern AVCodec ff_alac_at_encoder;
 +extern AVCodec ff_alac_at_decoder;
 +extern AVCodec ff_amr_nb_at_decoder;
 +extern AVCodec ff_eac3_at_decoder;
 +extern AVCodec ff_gsm_ms_at_decoder;
 +extern AVCodec ff_ilbc_at_encoder;
 +extern AVCodec ff_ilbc_at_decoder;
 +extern AVCodec ff_mp1_at_decoder;
 +extern AVCodec ff_mp2_at_decoder;
 +extern AVCodec ff_mp3_at_decoder;
 +extern AVCodec ff_pcm_alaw_at_encoder;
 +extern AVCodec ff_pcm_alaw_at_decoder;
 +extern AVCodec ff_pcm_mulaw_at_encoder;
 +extern AVCodec ff_pcm_mulaw_at_decoder;
 +extern AVCodec ff_qdmc_at_decoder;
 +extern AVCodec ff_qdm2_at_decoder;
++extern AVCodec ff_libaom_av1_decoder;
 +extern AVCodec ff_libcelt_decoder;
 +extern AVCodec ff_libcodec2_encoder;
 +extern AVCodec ff_libcodec2_decoder;
 +extern AVCodec ff_libfdk_aac_encoder;
 +extern AVCodec ff_libfdk_aac_decoder;
 +extern AVCodec ff_libgsm_encoder;
 +extern AVCodec ff_libgsm_decoder;
 +extern AVCodec ff_libgsm_ms_encoder;
 +extern AVCodec ff_libgsm_ms_decoder;
 +extern AVCodec ff_libilbc_encoder;
 +extern AVCodec ff_libilbc_decoder;
 +extern AVCodec ff_libmp3lame_encoder;
 +extern AVCodec ff_libopencore_amrnb_encoder;
 +extern AVCodec ff_libopencore_amrnb_decoder;
 +extern AVCodec ff_libopencore_amrwb_decoder;
 +extern AVCodec ff_libopenjpeg_encoder;
 +extern AVCodec ff_libopenjpeg_decoder;
 +extern AVCodec ff_libopus_encoder;
 +extern AVCodec ff_libopus_decoder;
 +extern AVCodec ff_librsvg_decoder;
 +extern AVCodec ff_libshine_encoder;
 +extern AVCodec ff_libspeex_encoder;
 +extern AVCodec ff_libspeex_decoder;
 +extern AVCodec ff_libtheora_encoder;
 +extern AVCodec ff_libtwolame_encoder;
 +extern AVCodec ff_libvo_amrwbenc_encoder;
 +extern AVCodec ff_libvorbis_encoder;
 +extern AVCodec ff_libvorbis_decoder;
 +extern AVCodec ff_libvpx_vp8_encoder;
 +extern AVCodec ff_libvpx_vp8_decoder;
 +extern AVCodec ff_libvpx_vp9_encoder;
 +extern AVCodec ff_libvpx_vp9_decoder;
 +extern AVCodec ff_libwavpack_encoder;
 +/* preferred over libwebp */
 +extern AVCodec ff_libwebp_anim_encoder;
 +extern AVCodec ff_libwebp_encoder;
 +extern AVCodec ff_libx262_encoder;
 +extern AVCodec ff_libx264_encoder;
 +extern AVCodec ff_libx264rgb_encoder;
 +extern AVCodec ff_libx265_encoder;
 +extern AVCodec ff_libxavs_encoder;
 +extern AVCodec ff_libxvid_encoder;
 +extern AVCodec ff_libzvbi_teletext_decoder;
 +
 +/* text */
 +extern AVCodec ff_bintext_decoder;
 +extern AVCodec ff_xbin_decoder;
 +extern AVCodec ff_idf_decoder;
  
 -#define REGISTER_DECODER(X, x)                                          \
 -    {                                                                   \
 -        extern AVCodec ff_##x##_decoder;                                \
 -        if (CONFIG_##X##_DECODER)                                       \
 -            avcodec_register(&ff_##x##_decoder);                        \
 +/* external libraries, that shouldn't be used by default if one of the
 + * above is available */
 +extern AVCodec ff_h263_v4l2m2m_encoder;
 +extern AVCodec ff_libopenh264_encoder;
 +extern AVCodec ff_libopenh264_decoder;
 +extern AVCodec ff_h264_amf_encoder;
 +extern AVCodec ff_h264_cuvid_decoder;
 +extern AVCodec ff_h264_nvenc_encoder;
 +extern AVCodec ff_h264_omx_encoder;
 +extern AVCodec ff_h264_qsv_encoder;
 +extern AVCodec ff_h264_v4l2m2m_encoder;
 +extern AVCodec ff_h264_vaapi_encoder;
 +extern AVCodec ff_h264_videotoolbox_encoder;
 +#if FF_API_NVENC_OLD_NAME
 +extern AVCodec ff_nvenc_encoder;
 +extern AVCodec ff_nvenc_h264_encoder;
 +extern AVCodec ff_nvenc_hevc_encoder;
 +#endif
 +extern AVCodec ff_hevc_amf_encoder;
 +extern AVCodec ff_hevc_cuvid_decoder;
 +extern AVCodec ff_hevc_mediacodec_decoder;
 +extern AVCodec ff_hevc_nvenc_encoder;
 +extern AVCodec ff_hevc_qsv_encoder;
 +extern AVCodec ff_hevc_v4l2m2m_encoder;
 +extern AVCodec ff_hevc_vaapi_encoder;
 +extern AVCodec ff_hevc_videotoolbox_encoder;
 +extern AVCodec ff_libkvazaar_encoder;
 +extern AVCodec ff_mjpeg_cuvid_decoder;
 +extern AVCodec ff_mjpeg_qsv_encoder;
 +extern AVCodec ff_mjpeg_vaapi_encoder;
 +extern AVCodec ff_mpeg1_cuvid_decoder;
 +extern AVCodec ff_mpeg2_cuvid_decoder;
 +extern AVCodec ff_mpeg2_qsv_encoder;
 +extern AVCodec ff_mpeg2_vaapi_encoder;
 +extern AVCodec ff_mpeg4_cuvid_decoder;
 +extern AVCodec ff_mpeg4_mediacodec_decoder;
 +extern AVCodec ff_mpeg4_v4l2m2m_encoder;
 +extern AVCodec ff_vc1_cuvid_decoder;
 +extern AVCodec ff_vp8_cuvid_decoder;
 +extern AVCodec ff_vp8_mediacodec_decoder;
 +extern AVCodec ff_vp8_qsv_decoder;
 +extern AVCodec ff_vp8_v4l2m2m_encoder;
 +extern AVCodec ff_vp8_vaapi_encoder;
 +extern AVCodec ff_vp9_cuvid_decoder;
 +extern AVCodec ff_vp9_mediacodec_decoder;
 +extern AVCodec ff_vp9_vaapi_encoder;
 +
 +#include "libavcodec/codec_list.c"
 +
 +static AVOnce av_codec_static_init = AV_ONCE_INIT;
 +static void av_codec_init_static(void)
 +{
 +    for (int i = 0; codec_list[i]; i++) {
 +        if (codec_list[i]->init_static_data)
 +            codec_list[i]->init_static_data((AVCodec*)codec_list[i]);
      }
 +}
 +
 +const AVCodec *av_codec_iterate(void **opaque)
 +{
 +    uintptr_t i = (uintptr_t)*opaque;
 +    const AVCodec *c = codec_list[i];
  
 -#define REGISTER_ENCDEC(X, x) REGISTER_ENCODER(X, x); REGISTER_DECODER(X, x)
 +    ff_thread_once(&av_codec_static_init, av_codec_init_static);
  
 -#define REGISTER_PARSER(X, x)                                           \
 -    {                                                                   \
 -        extern AVCodecParser ff_##x##_parser;                           \
 -        if (CONFIG_##X##_PARSER)                                        \
 -            av_register_codec_parser(&ff_##x##_parser);                 \
 +    if (c)
 +        *opaque = (void*)(i + 1);
 +
 +    return c;
 +}
 +
 +#if FF_API_NEXT
 +FF_DISABLE_DEPRECATION_WARNINGS
 +static AVOnce av_codec_next_init = AV_ONCE_INIT;
 +
 +static void av_codec_init_next(void)
 +{
 +    AVCodec *prev = NULL, *p;
 +    void *i = 0;
 +    while ((p = (AVCodec*)av_codec_iterate(&i))) {
 +        if (prev)
 +            prev->next = p;
 +        prev = p;
      }
 +}
 +
 +
 +
 +av_cold void avcodec_register(AVCodec *codec)
 +{
 +    ff_thread_once(&av_codec_next_init, av_codec_init_next);
 +}
 +
 +AVCodec *av_codec_next(const AVCodec *c)
 +{
 +    ff_thread_once(&av_codec_next_init, av_codec_init_next);
 +
 +    if (c)
 +        return c->next;
 +    else
 +        return (AVCodec*)codec_list[0];
 +}
  
  void avcodec_register_all(void)
  {
diff --cc libavcodec/libaomdec.c
index 0000000000,859c7729b6..5158ea8d76
mode 000000,100644..100644
--- a/libavcodec/libaomdec.c
+++ b/libavcodec/libaomdec.c
@@@ -1,0 -1,160 +1,249 @@@
+ /*
+  * Copyright (c) 2010, Google, Inc.
+  *
 - * This file is part of Libav.
++ * This file is part of FFmpeg.
+  *
 - * Libav is free software; you can redistribute it and/or
++ * FFmpeg is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Lesser General Public
+  * License as published by the Free Software Foundation; either
+  * version 2.1 of the License, or (at your option) any later version.
+  *
 - * Libav is distributed in the hope that it will be useful,
++ * FFmpeg is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
 - * License along with Libav; if not, write to the Free Software
++ * License along with FFmpeg; if not, write to the Free Software
+  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+  */
+ 
+ /**
+  * @file
+  * AV1 decoder support via libaom
+  */
+ 
+ #include <aom/aom_decoder.h>
+ #include <aom/aomdx.h>
+ 
+ #include "libavutil/common.h"
+ #include "libavutil/imgutils.h"
+ 
+ #include "avcodec.h"
+ #include "internal.h"
 -#include "libaom.h"
+ 
+ typedef struct AV1DecodeContext {
+     struct aom_codec_ctx decoder;
+ } AV1DecodeContext;
+ 
 -static av_cold int aom_init(AVCodecContext *avctx)
++static av_cold int aom_init(AVCodecContext *avctx,
++                            const struct aom_codec_iface *iface)
+ {
+     AV1DecodeContext *ctx           = avctx->priv_data;
+     struct aom_codec_dec_cfg deccfg = {
+         /* token partitions+1 would be a decent choice */
+         .threads = FFMIN(avctx->thread_count, 16)
+     };
 -    const struct aom_codec_iface *iface = &aom_codec_av1_dx_algo;
+ 
+     av_log(avctx, AV_LOG_INFO, "%s\n", aom_codec_version_str());
+     av_log(avctx, AV_LOG_VERBOSE, "%s\n", aom_codec_build_config());
+ 
+     if (aom_codec_dec_init(&ctx->decoder, iface, &deccfg, 0) != AOM_CODEC_OK) {
+         const char *error = aom_codec_error(&ctx->decoder);
+         av_log(avctx, AV_LOG_ERROR, "Failed to initialize decoder: %s\n",
+                error);
+         return AVERROR(EINVAL);
+     }
+ 
+     return 0;
+ }
+ 
+ static void image_copy_16_to_8(AVFrame *pic, struct aom_image *img)
+ {
+     int i;
+ 
+     for (i = 0; i < 3; i++) {
+         int w = img->d_w;
+         int h = img->d_h;
+         int x, y;
+ 
+         if (i) {
+             w = (w + img->x_chroma_shift) >> img->x_chroma_shift;
+             h = (h + img->y_chroma_shift) >> img->y_chroma_shift;
+         }
+ 
+         for (y = 0; y < h; y++) {
+             uint16_t *src = (uint16_t *)(img->planes[i] + y * img->stride[i]);
+             uint8_t *dst = pic->data[i] + y * pic->linesize[i];
+             for (x = 0; x < w; x++)
+                 *dst++ = *src++;
+         }
+     }
+ }
+ 
++// returns 0 on success, AVERROR_INVALIDDATA otherwise
++static int set_pix_fmt(AVCodecContext *avctx, struct aom_image *img)
++{
++    static const enum AVColorSpace colorspaces[10] = {
++        AVCOL_SPC_UNSPECIFIED, AVCOL_SPC_BT470BG, AVCOL_SPC_BT709, AVCOL_SPC_SMPTE170M,
++        AVCOL_SPC_SMPTE240M, AVCOL_SPC_BT2020_NCL, AVCOL_SPC_BT2020_CL, AVCOL_SPC_RGB,
++        AVCOL_SPC_ICTCP, AVCOL_SPC_RESERVED
++    };
++    static const enum AVColorRange color_ranges[] = {
++        AVCOL_RANGE_MPEG, AVCOL_RANGE_JPEG
++    };
++    avctx->color_range = color_ranges[img->range];
++    avctx->colorspace = colorspaces[img->cs];
++
++    switch (img->fmt) {
++    case AOM_IMG_FMT_I420:
++        avctx->pix_fmt = AV_PIX_FMT_YUV420P;
++        return 0;
++    case AOM_IMG_FMT_I422:
++        avctx->pix_fmt = AV_PIX_FMT_YUV422P;
++        return 0;
++    case AOM_IMG_FMT_I440:
++        avctx->pix_fmt = AV_PIX_FMT_YUV440P;
++        return 0;
++    case AOM_IMG_FMT_I444:
++        avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
++                         AV_PIX_FMT_GBRP : AV_PIX_FMT_YUV444P;
++        return 0;
++    case AOM_IMG_FMT_I42016:
++        if (img->bit_depth == 8) {
++            avctx->pix_fmt = AV_PIX_FMT_YUV420P;
++            return 0;
++        } else if (img->bit_depth == 10) {
++            avctx->pix_fmt = AV_PIX_FMT_YUV420P10;
++            return 0;
++        } else if (img->bit_depth == 12) {
++            avctx->pix_fmt = AV_PIX_FMT_YUV420P12;
++            return 0;
++        } else {
++            return AVERROR_INVALIDDATA;
++        }
++    case AOM_IMG_FMT_I42216:
++        if (img->bit_depth == 8) {
++            avctx->pix_fmt = AV_PIX_FMT_YUV422P;
++            return 0;
++        } else if (img->bit_depth == 10) {
++            avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
++            return 0;
++        } else if (img->bit_depth == 12) {
++            avctx->pix_fmt = AV_PIX_FMT_YUV422P12;
++            return 0;
++        } else {
++            return AVERROR_INVALIDDATA;
++        }
++    case AOM_IMG_FMT_I44016:
++        if (img->bit_depth == 8) {
++            avctx->pix_fmt = AV_PIX_FMT_YUV440P;
++            return 0;
++        } else if (img->bit_depth == 10) {
++            avctx->pix_fmt = AV_PIX_FMT_YUV440P10;
++            return 0;
++        } else if (img->bit_depth == 12) {
++            avctx->pix_fmt = AV_PIX_FMT_YUV440P12;
++            return 0;
++        } else {
++            return AVERROR_INVALIDDATA;
++        }
++    case AOM_IMG_FMT_I44416:
++        if (img->bit_depth == 8) {
++            avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
++                             AV_PIX_FMT_GBRP : AV_PIX_FMT_YUV444P;
++            return 0;
++        } else if (img->bit_depth == 10) {
++            avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
++                             AV_PIX_FMT_GBRP10 : AV_PIX_FMT_YUV444P10;
++            return 0;
++        } else if (img->bit_depth == 12) {
++            avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
++                             AV_PIX_FMT_GBRP12 : AV_PIX_FMT_YUV444P12;
++            return 0;
++        } else {
++            return AVERROR_INVALIDDATA;
++        }
++
++    default:
++        return AVERROR_INVALIDDATA;
++    }
++}
+ 
+ static int aom_decode(AVCodecContext *avctx, void *data, int *got_frame,
+                       AVPacket *avpkt)
+ {
+     AV1DecodeContext *ctx = avctx->priv_data;
+     AVFrame *picture      = data;
+     const void *iter      = NULL;
+     struct aom_image *img;
+     int ret;
+ 
+     if (aom_codec_decode(&ctx->decoder, avpkt->data, avpkt->size, NULL) !=
+         AOM_CODEC_OK) {
+         const char *error  = aom_codec_error(&ctx->decoder);
+         const char *detail = aom_codec_error_detail(&ctx->decoder);
+ 
+         av_log(avctx, AV_LOG_ERROR, "Failed to decode frame: %s\n", error);
+         if (detail)
+             av_log(avctx, AV_LOG_ERROR, "  Additional information: %s\n",
+                    detail);
+         return AVERROR_INVALIDDATA;
+     }
+ 
+     if ((img = aom_codec_get_frame(&ctx->decoder, &iter))) {
 -        avctx->pix_fmt = ff_aom_imgfmt_to_pixfmt(img->fmt, img->bit_depth);
 -        if (avctx->pix_fmt == AV_PIX_FMT_NONE) {
 -            av_log(avctx, AV_LOG_ERROR, "Unsupported output colorspace (0x%02x %dbits)\n",
++        if (img->d_w > img->w || img->d_h > img->h) {
++            av_log(avctx, AV_LOG_ERROR, "Display dimensions %dx%d exceed storage %dx%d\n",
++                   img->d_w, img->d_h, img->w, img->h);
++            return AVERROR_EXTERNAL;
++        }
++
++        if ((ret = set_pix_fmt(avctx, img)) < 0) {
++            av_log(avctx, AV_LOG_ERROR, "Unsupported output colorspace (%d) / bit_depth (%d)\n",
+                    img->fmt, img->bit_depth);
 -            return AVERROR_INVALIDDATA;
++            return ret;
+         }
+ 
+         if ((int)img->d_w != avctx->width || (int)img->d_h != avctx->height) {
+             av_log(avctx, AV_LOG_INFO, "dimension change! %dx%d -> %dx%d\n",
+                    avctx->width, avctx->height, img->d_w, img->d_h);
+             ret = ff_set_dimensions(avctx, img->d_w, img->d_h);
+             if (ret < 0)
+                 return ret;
+         }
+         if ((ret = ff_get_buffer(avctx, picture, 0)) < 0)
+             return ret;
+         if ((img->fmt & AOM_IMG_FMT_HIGHBITDEPTH) && img->bit_depth == 8)
+             image_copy_16_to_8(picture, img);
+         else
+             av_image_copy(picture->data, picture->linesize, (const uint8_t **)img->planes,
+                           img->stride, avctx->pix_fmt, img->d_w, img->d_h);
 -        switch (img->range) {
 -        case AOM_CR_STUDIO_RANGE:
 -            picture->color_range = AVCOL_RANGE_MPEG;
 -            break;
 -        case AOM_CR_FULL_RANGE:
 -            picture->color_range = AVCOL_RANGE_JPEG;
 -            break;
 -        }
+         *got_frame = 1;
+     }
+     return avpkt->size;
+ }
+ 
+ static av_cold int aom_free(AVCodecContext *avctx)
+ {
+     AV1DecodeContext *ctx = avctx->priv_data;
+     aom_codec_destroy(&ctx->decoder);
+     return 0;
+ }
+ 
++static av_cold int av1_init(AVCodecContext *avctx)
++{
++    return aom_init(avctx, &aom_codec_av1_dx_algo);
++}
++
+ AVCodec ff_libaom_av1_decoder = {
+     .name           = "libaom-av1",
+     .long_name      = NULL_IF_CONFIG_SMALL("libaom AV1"),
+     .type           = AVMEDIA_TYPE_VIDEO,
+     .id             = AV_CODEC_ID_AV1,
+     .priv_data_size = sizeof(AV1DecodeContext),
 -    .init           = aom_init,
++    .init           = av1_init,
+     .close          = aom_free,
+     .decode         = aom_decode,
+     .capabilities   = AV_CODEC_CAP_AUTO_THREADS | AV_CODEC_CAP_DR1,
+     .wrapper_name   = "libaom",
+ };



More information about the ffmpeg-cvslog mailing list