Bug 1582743 - Update dav1d from upstream to commit c0865f3. r=TD-Linux
authorAlex Chronopoulos <achronop@gmail.com>
Mon, 23 Sep 2019 18:02:33 +0000
changeset 494644 0d0409a0f33a0fca93a23bb08f9501e93632272d
parent 494643 3cc4fb5ab0a75e01066371d42965016f1b2634d7
child 494645 887b215b44ae69c331f6c9818a121cad26cdb941
push id36612
push usercbrindusan@mozilla.com
push dateTue, 24 Sep 2019 16:10:49 +0000
treeherdermozilla-central@d24d00b719aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersTD-Linux
bugs1582743
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1582743 - Update dav1d from upstream to commit c0865f3. r=TD-Linux Differential Revision: https://phabricator.services.mozilla.com/D46762
media/libdav1d/asm/moz.build
media/libdav1d/dav1d.rc
media/libdav1d/moz.build
media/libdav1d/moz.yaml
media/libdav1d/vcs_version.h
media/libdav1d/version.h
third_party/dav1d/.gitlab-ci.yml
third_party/dav1d/NEWS
third_party/dav1d/examples/dav1dplay.c
third_party/dav1d/examples/meson.build
third_party/dav1d/include/common/attributes.h
third_party/dav1d/include/common/intops.h
third_party/dav1d/include/common/mem.h
third_party/dav1d/include/dav1d/headers.h
third_party/dav1d/include/dav1d/picture.h
third_party/dav1d/meson.build
third_party/dav1d/meson_options.txt
third_party/dav1d/src/arm/32/mc.S
third_party/dav1d/src/arm/64/itx.S
third_party/dav1d/src/arm/64/mc.S
third_party/dav1d/src/arm/64/msac.S
third_party/dav1d/src/arm/mc_init_tmpl.c
third_party/dav1d/src/cdef.h
third_party/dav1d/src/cdef_tmpl.c
third_party/dav1d/src/cdf.c
third_party/dav1d/src/cdf.h
third_party/dav1d/src/data.c
third_party/dav1d/src/decode.c
third_party/dav1d/src/env.h
third_party/dav1d/src/fg_apply.h
third_party/dav1d/src/fg_apply_tmpl.c
third_party/dav1d/src/film_grain.h
third_party/dav1d/src/film_grain_tmpl.c
third_party/dav1d/src/getbits.c
third_party/dav1d/src/internal.h
third_party/dav1d/src/intra_edge.c
third_party/dav1d/src/ipred_prepare_tmpl.c
third_party/dav1d/src/ipred_tmpl.c
third_party/dav1d/src/itx_tmpl.c
third_party/dav1d/src/levels.h
third_party/dav1d/src/lf_apply_tmpl.c
third_party/dav1d/src/lf_mask.c
third_party/dav1d/src/lib.c
third_party/dav1d/src/looprestoration_tmpl.c
third_party/dav1d/src/mc_tmpl.c
third_party/dav1d/src/meson.build
third_party/dav1d/src/msac.c
third_party/dav1d/src/msac.h
third_party/dav1d/src/obu.c
third_party/dav1d/src/picture.c
third_party/dav1d/src/ppc/cdef_init_tmpl.c
third_party/dav1d/src/ppc/types.h
third_party/dav1d/src/recon_tmpl.c
third_party/dav1d/src/ref_mvs.c
third_party/dav1d/src/scan.c
third_party/dav1d/src/scan.h
third_party/dav1d/src/tables.c
third_party/dav1d/src/tables.h
third_party/dav1d/src/thread.h
third_party/dav1d/src/warpmv.c
third_party/dav1d/src/win32/thread.c
third_party/dav1d/src/x86/film_grain.asm
third_party/dav1d/src/x86/film_grain_init_tmpl.c
third_party/dav1d/src/x86/itx.asm
third_party/dav1d/src/x86/itx_ssse3.asm
third_party/dav1d/src/x86/loopfilter_init_tmpl.c
third_party/dav1d/src/x86/loopfilter_ssse3.asm
third_party/dav1d/src/x86/mc.asm
third_party/dav1d/src/x86/mc_ssse3.asm
third_party/dav1d/src/x86/msac.asm
third_party/dav1d/src/x86/msac.h
third_party/dav1d/tests/checkasm/checkasm.c
third_party/dav1d/tests/checkasm/checkasm.h
third_party/dav1d/tests/checkasm/filmgrain.c
third_party/dav1d/tests/checkasm/itx.c
third_party/dav1d/tests/checkasm/mc.c
third_party/dav1d/tests/checkasm/msac.c
third_party/dav1d/tests/meson.build
third_party/dav1d/tools/dav1d.c
third_party/dav1d/tools/dav1d_cli_parse.c
third_party/dav1d/tools/input/annexb.c
third_party/dav1d/tools/input/demuxer.h
third_party/dav1d/tools/input/input.c
third_party/dav1d/tools/input/input.h
third_party/dav1d/tools/input/ivf.c
third_party/dav1d/tools/meson.build
third_party/dav1d/tools/output/output.c
--- a/media/libdav1d/asm/moz.build
+++ b/media/libdav1d/asm/moz.build
@@ -77,37 +77,40 @@ if CONFIG['CPU_ARCH'] in ('x86', 'x86_64
     ]
 
     # ASM source files
     if CONFIG['CPU_ARCH'] == 'x86_64':
         # Empty file on all other archs. Nasm produces
         # an error when it compiles empty files.
         SOURCES += [
             '../../../third_party/dav1d/src/x86/cdef.asm',
+            '../../../third_party/dav1d/src/x86/film_grain.asm',
             '../../../third_party/dav1d/src/x86/ipred.asm',
             '../../../third_party/dav1d/src/x86/itx.asm',
             '../../../third_party/dav1d/src/x86/loopfilter.asm',
             '../../../third_party/dav1d/src/x86/looprestoration.asm',
             '../../../third_party/dav1d/src/x86/mc.asm',
         ]
 
     SOURCES += [
         '../../../third_party/dav1d/src/x86/cdef_sse.asm',
         '../../../third_party/dav1d/src/x86/cpuid.asm',
         '../../../third_party/dav1d/src/x86/ipred_ssse3.asm',
         '../../../third_party/dav1d/src/x86/itx_ssse3.asm',
+        '../../../third_party/dav1d/src/x86/loopfilter_ssse3.asm',
         '../../../third_party/dav1d/src/x86/looprestoration_ssse3.asm',
         '../../../third_party/dav1d/src/x86/mc_ssse3.asm',
         '../../../third_party/dav1d/src/x86/msac.asm',
     ]
 
     # BITDEPTH
     relative_path = '../../../third_party/dav1d/src/x86/'
     bitdepth_basenames = [
         'cdef_init_tmpl.c',
+        'film_grain_init_tmpl.c',
         'ipred_init_tmpl.c',
         'itx_init_tmpl.c',
         'loopfilter_init_tmpl.c',
         'looprestoration_init_tmpl.c',
         'mc_init_tmpl.c',
     ]
 
     GENERATED_FILES += [
--- a/media/libdav1d/dav1d.rc
+++ b/media/libdav1d/dav1d.rc
@@ -1,12 +1,12 @@
-#define API_VERSION_NUMBER 2,0,0,0
-#define API_VERSION_NUMBER_STR "2.0.0"
-#define PROJECT_VERSION_NUMBER 0,3,1,0
-#define PROJECT_VERSION_NUMBER_STR "0.3.1"
+#define API_VERSION_NUMBER 3,0,0,0
+#define API_VERSION_NUMBER_STR "3.0.0"
+#define PROJECT_VERSION_NUMBER 0,4,0,0
+#define PROJECT_VERSION_NUMBER_STR "0.4.0"
 
 #include <windows.h>
 
 1 VERSIONINFO
 FILETYPE VFT_DLL
 FILEOS VOS_NT_WINDOWS32
 PRODUCTVERSION PROJECT_VERSION_NUMBER
 FILEVERSION API_VERSION_NUMBER
--- a/media/libdav1d/moz.build
+++ b/media/libdav1d/moz.build
@@ -119,16 +119,17 @@ EXPORTS.dav1d.src += [
     '../../third_party/dav1d/src/wedge.h',
 ]
 
 # common BITDEPTH 8, 16
 relative_path = '../../third_party/dav1d/src/'
 bitdepth_basenames = [
     'cdef_apply_tmpl.c',
     'cdef_tmpl.c',
+    'fg_apply_tmpl.c',
     'film_grain_tmpl.c',
     'ipred_prepare_tmpl.c',
     'ipred_tmpl.c',
     'itx_tmpl.c',
     'lf_apply_tmpl.c',
     'loopfilter_tmpl.c',
     'looprestoration_tmpl.c',
     'lr_apply_tmpl.c',
@@ -158,16 +159,17 @@ for f in bitdepth_basenames:
 
 SOURCES += [
     '!%s' % p for p in GENERATED_FILES if p.endswith('.c')
 ]
 
 EXPORTS.dav1d.src += [
     '../../third_party/dav1d/src/cdef.h',
     '../../third_party/dav1d/src/cdef_apply.h',
+    '../../third_party/dav1d/src/fg_apply.h',
     '../../third_party/dav1d/src/ipred.h',
     '../../third_party/dav1d/src/ipred_prepare.h',
     '../../third_party/dav1d/src/itx.h',
     '../../third_party/dav1d/src/lf_apply.h',
     '../../third_party/dav1d/src/loopfilter.h',
     '../../third_party/dav1d/src/looprestoration.h',
     '../../third_party/dav1d/src/lr_apply.h',
     '../../third_party/dav1d/src/mc.h',
--- a/media/libdav1d/moz.yaml
+++ b/media/libdav1d/moz.yaml
@@ -15,15 +15,15 @@ origin:
   description: dav1d, a fast AV1 decoder
 
   # Full URL for the package's homepage/etc
   # Usually different from repository url
   url: https://code.videolan.org/videolan/dav1d
 
   # Human-readable identifier for this version/release
   # Generally "version NNN", "tag SSS", "bookmark SSS"
-  release: commit c138435f5aee794ff9d9ac23c3718017927f2e20 (2019-07-17T12:39:10.000Z).
+  release: commit c0865f35c74bdcc71021630f64dca2db35d2bc8c (2019-09-19T12:07:23.000+02:00).
 
   # The package's license, where possible using the mnemonic from
   # https://spdx.org/licenses/
   # Multiple licenses can be specified (as a YAML list)
   # A "LICENSE" file must exist containing the full license text
   license: BSD-2-Clause
--- a/media/libdav1d/vcs_version.h
+++ b/media/libdav1d/vcs_version.h
@@ -1,2 +1,2 @@
 /* auto-generated, do not edit */
-#define DAV1D_VERSION "0.3.1-69-gc138435"
+#define DAV1D_VERSION "0.4.0-49-gc0865f3"
--- a/media/libdav1d/version.h
+++ b/media/libdav1d/version.h
@@ -22,13 +22,13 @@
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifndef DAV1D_VERSION_H
 #define DAV1D_VERSION_H
 
-#define DAV1D_API_VERSION_MAJOR 2
+#define DAV1D_API_VERSION_MAJOR 3
 #define DAV1D_API_VERSION_MINOR 0
 #define DAV1D_API_VERSION_PATCH 0
 
 #endif /* DAV1D_VERSION_H */
--- a/third_party/dav1d/.gitlab-ci.yml
+++ b/third_party/dav1d/.gitlab-ci.yml
@@ -264,16 +264,17 @@ build-debian-ppc64le:
     script:
         - meson build --buildtype release --werror
         - ninja -C build
         - cd build && meson test -v
 
 test-debian:
     image: registry.videolan.org:5000/dav1d-debian-unstable:20190215130514
     stage: test
+    needs: ["build-debian"]
     tags:
         - debian
         - amd64
     cache:
         key: testdata.git-20190215
         paths:
             - cache/dav1d-test-data.git/
     script:
@@ -284,16 +285,17 @@ test-debian:
         - meson build --buildtype release -Dtestdata_tests=true -Dlogging=false
         - ninja -C build
         - cd build && time meson test -v
     dependencies: []
 
 test-debian-unaligned-stack:
     image: registry.videolan.org:5000/dav1d-debian-unstable:20190215130514
     stage: test
+    needs: ["build-debian"]
     tags:
         - debian
         - amd64
     cache:
         key: testdata.git-20190215
         paths:
             - cache/dav1d-test-data.git/
     script:
@@ -304,16 +306,17 @@ test-debian-unaligned-stack:
         - meson build --buildtype release -Dtestdata_tests=true -Dlogging=false -Dstack_alignment=16
         - ninja -C build
         - cd build && time meson test -v
     dependencies: []
 
 test-debian-asan:
     image: registry.videolan.org:5000/dav1d-debian-unstable:20190215130514
     stage: test
+    needs: ["build-debian"]
     tags:
         - debian
         - amd64
     cache:
         key: testdata.git-20190215
         paths:
             - cache/dav1d-test-data.git/
     variables:
@@ -326,16 +329,17 @@ test-debian-asan:
         - meson build --buildtype debugoptimized -Dtestdata_tests=true -Dlogging=false -Db_sanitize=address -Denable_asm=false
         - ninja -C build
         - cd build && time meson test -v --setup=sanitizer
     dependencies: []
 
 test-debian-msan:
     image: registry.videolan.org:5000/dav1d-debian-unstable:20190215130514
     stage: test
+    needs: ["build-debian"]
     tags:
         - debian
         - amd64
     cache:
         key: testdata.git-20190215
         paths:
             - cache/dav1d-test-data.git/
     variables:
@@ -348,16 +352,17 @@ test-debian-msan:
         - env CC=clang meson build --buildtype debugoptimized -Dtestdata_tests=true -Dlogging=false -Db_sanitize=memory -Db_lundef=false -Denable_asm=false
         - ninja -C build
         - cd build && time meson test -v --setup=sanitizer
     dependencies: []
 
 test-debian-ubsan:
     image: registry.videolan.org:5000/dav1d-debian-unstable:20190215130514
     stage: test
+    needs: ["build-debian"]
     tags:
         - debian
         - amd64
     cache:
         key: testdata.git-20190215
         paths:
             - cache/dav1d-test-data.git/
     variables:
@@ -370,16 +375,17 @@ test-debian-ubsan:
         - env CC=clang meson build --buildtype debugoptimized -Dtestdata_tests=true -Dlogging=false -Db_sanitize=undefined -Db_lundef=false -Denable_asm=false
         - ninja -C build
         - cd build && time meson test -v --setup=sanitizer
     dependencies: []
 
 test-win64:
     image: registry.videolan.org:5000/dav1d-debian-unstable:20190215130514
     stage: test
+    needs: ["build-win64"]
     tags:
         - debian
         - amd64
     cache:
         key: testdata.git-20190215
         paths:
             - cache/dav1d-test-data.git/
     script:
@@ -394,16 +400,17 @@ test-win64:
                       --cross-file /opt/crossfiles/x86_64-w64-mingw32.meson
         - ninja -C build
         - cd build && time meson test -v
     dependencies: []
 
 test-debian-aarch64:
     image: registry.videolan.org:5000/dav1d-debian-unstable-aarch64:20181122182457
     stage: test
+    needs: ["build-debian-aarch64"]
     tags:
         - aarch64
         - debian
     cache:
         key: testdata.git-20190215
         paths:
             - cache/dav1d-test-data.git/
     script:
@@ -416,16 +423,17 @@ test-debian-aarch64:
                       -Dlogging=false
         - ninja -C build
         - cd build && time meson test -v
     dependencies: []
 
 test-debian-ppc64le:
     image: registry.videolan.org/dav1d-debian-unstable-ppc64le:20190606105121
     stage: test
+    needs: ["build-debian-ppc64le"]
     tags:
         - ppc64le
         - docker
     cache:
         key: testdata.git-20190215
         paths:
             - cache/dav1d-test-data.git/
     script:
@@ -438,16 +446,17 @@ test-debian-ppc64le:
                       -Dlogging=false
         - ninja -C build
         - cd build && time meson test -v
     dependencies: []
 
 test-debian-armv7-clang-5:
     stage: test
     image: registry.videolan.org:5000/dav1d-debian-unstable-armv7:20190202101732
+    needs: ["build-debian-armv7-clang-5"]
     tags:
         - armv7
         - debian
     cache:
         key: testdata.git-20190215
         paths:
             - cache/dav1d-test-data.git/
     script:
--- a/third_party/dav1d/NEWS
+++ b/third_party/dav1d/NEWS
@@ -1,16 +1,23 @@
 Changes for 0.4.0 'Cheetah':
 ----------------------------
 
  - Fix playback with unknown OBUs
  - Add an option to limit the maximum frame size
  - SSE2 and ARM64 optimizations for MSAC
  - Improve speed on 32bits systems
  - Optimization in obmc blend
+ - Reduce RAM usage significantly
+ - The initial PPC SIMD code, cdef_filter
+ - NEON optimizations for blend functions on ARM
+ - NEON optimizations for w_mask functions on ARM
+ - NEON optimizations for inverse transforms on ARM64
+ - Improve handling of malloc failures
+ - Simple Player example in tools
 
 
 Changes for 0.3.1 'Sailfish':
 ------------------------------
 
  - Fix a buffer overflow in frame-threading mode on SSSE3 CPUs
  - Reduce binary size, notably on Windows
  - SSSE3 optimizations for ipred_filter
new file mode 100644
--- /dev/null
+++ b/third_party/dav1d/examples/dav1dplay.c
@@ -0,0 +1,1087 @@
+/*
+ * Copyright © 2019, VideoLAN and dav1d authors
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ *    list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "vcs_version.h"
+
+#include <getopt.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <SDL.h>
+
+#include "common/attributes.h"
+
+#include "dav1d/dav1d.h"
+
+#include "tools/input/input.h"
+
+/**
+ * Settings structure
+ * Hold all settings available for the player,
+ * this is usually filled by parsing arguments
+ * from the console.
+ */
+typedef struct {
+    const char *inputfile;
+} Dav1dPlaySettings;
+
+#define WINDOW_WIDTH  910
+#define WINDOW_HEIGHT 512
+
+#define DAV1D_EVENT_NEW_FRAME 1
+#define DAV1D_EVENT_DEC_QUIT  2
+
+/*
+ * Fifo helper functions
+ */
+typedef struct dp_fifo
+{
+    SDL_mutex *lock;
+    SDL_cond *cond_change;
+    size_t capacity;
+    size_t count;
+    void **entries;
+} Dav1dPlayPtrFifo;
+
+static void dp_fifo_destroy(Dav1dPlayPtrFifo *fifo)
+{
+    assert(fifo->count == 0);
+    SDL_DestroyMutex(fifo->lock);
+    SDL_DestroyCond(fifo->cond_change);
+    free(fifo->entries);
+    free(fifo);
+}
+
+static Dav1dPlayPtrFifo *dp_fifo_create(size_t capacity)
+{
+    Dav1dPlayPtrFifo *fifo;
+
+    assert(capacity > 0);
+    if (capacity <= 0)
+        return NULL;
+
+    fifo = malloc(sizeof(*fifo));
+    if (fifo == NULL)
+        return NULL;
+
+    fifo->capacity = capacity;
+    fifo->count = 0;
+
+    fifo->lock = SDL_CreateMutex();
+    if (fifo->lock == NULL) {
+        free(fifo);
+        return NULL;
+    }
+    fifo->cond_change = SDL_CreateCond();
+    if (fifo->cond_change == NULL) {
+        SDL_DestroyMutex(fifo->lock);
+        free(fifo);
+        return NULL;
+    }
+
+    fifo->entries = calloc(capacity, sizeof(void*));
+    if (fifo->entries == NULL) {
+        dp_fifo_destroy(fifo);
+        return NULL;
+    }
+
+    return fifo;
+}
+
+static void dp_fifo_push(Dav1dPlayPtrFifo *fifo, void *element)
+{
+    SDL_LockMutex(fifo->lock);
+    while (fifo->count == fifo->capacity)
+        SDL_CondWait(fifo->cond_change, fifo->lock);
+    fifo->entries[fifo->count++] = element;
+    if (fifo->count == 1)
+        SDL_CondSignal(fifo->cond_change);
+    SDL_UnlockMutex(fifo->lock);
+}
+
+static void *dp_fifo_array_shift(void **arr, size_t len)
+{
+    void *shifted_element = arr[0];
+    for (size_t i = 1; i < len; ++i)
+        arr[i-1] = arr[i];
+    return shifted_element;
+}
+
+static void *dp_fifo_shift(Dav1dPlayPtrFifo *fifo)
+{
+    SDL_LockMutex(fifo->lock);
+    while (fifo->count == 0)
+        SDL_CondWait(fifo->cond_change, fifo->lock);
+    void *res = dp_fifo_array_shift(fifo->entries, fifo->count--);
+    if (fifo->count == fifo->capacity - 1)
+        SDL_CondSignal(fifo->cond_change);
+    SDL_UnlockMutex(fifo->lock);
+    return res;
+}
+
+/**
+ * Renderer info
+ */
+typedef struct rdr_info
+{
+    // Cookie passed to the renderer implementation callbacks
+    void *cookie;
+    // Callback to create the renderer
+    void* (*create_renderer)(void *data);
+    // Callback to destroy the renderer
+    void (*destroy_renderer)(void *cookie);
+    // Callback to the render function that renders a prevously sent frame
+    void (*render)(void *cookie);
+    // Callback to the send frame function
+    int (*update_frame)(void *cookie, Dav1dPicture *dav1d_pic);
+} Dav1dPlayRenderInfo;
+
+#ifdef HAVE_PLACEBO_VULKAN
+
+#include <libplacebo/renderer.h>
+#include <libplacebo/utils/upload.h>
+#include <libplacebo/vulkan.h>
+#include <SDL_vulkan.h>
+
+
+/**
+ * Renderer context for libplacebo
+ */
+typedef struct renderer_priv_ctx
+{
+    // Placebo context
+    struct pl_context *ctx;
+    // Placebo renderer
+    struct pl_renderer *renderer;
+    // Placebo Vulkan handle
+    const struct pl_vulkan *vk;
+    // Placebo Vulkan instance
+    const struct pl_vk_inst *vk_inst;
+    // Vulkan surface
+    VkSurfaceKHR surf;
+    // Placebo swapchain
+    const struct pl_swapchain *swapchain;
+    // Lock protecting access to the texture
+    SDL_mutex *lock;
+    // Planes to render
+    struct pl_plane y_plane;
+    struct pl_plane u_plane;
+    struct pl_plane v_plane;
+    // Textures to render
+    const struct pl_tex *y_tex;
+    const struct pl_tex *u_tex;
+    const struct pl_tex *v_tex;
+} Dav1dPlayRendererPrivateContext;
+
+static void *placebo_renderer_create(void *data)
+{
+    // Alloc
+    Dav1dPlayRendererPrivateContext *rd_priv_ctx = malloc(sizeof(Dav1dPlayRendererPrivateContext));
+    if (rd_priv_ctx == NULL) {
+        return NULL;
+    }
+
+    // Init libplacebo
+    rd_priv_ctx->ctx = pl_context_create(PL_API_VER, &(struct pl_context_params) {
+        .log_cb     = pl_log_color,
+#ifndef NDEBUG
+        .log_level  = PL_LOG_DEBUG,
+#else
+        .log_level  = PL_LOG_WARN,
+#endif
+    });
+    if (rd_priv_ctx->ctx == NULL) {
+        free(rd_priv_ctx);
+        return NULL;
+    }
+
+    // Create Mutex
+    rd_priv_ctx->lock = SDL_CreateMutex();
+    if (rd_priv_ctx->lock == NULL) {
+        fprintf(stderr, "SDL_CreateMutex failed: %s\n", SDL_GetError());
+        pl_context_destroy(&(rd_priv_ctx->ctx));
+        free(rd_priv_ctx);
+        return NULL;
+    }
+
+    // Init Vulkan
+    struct pl_vk_inst_params iparams = pl_vk_inst_default_params;
+
+    SDL_Window *sdlwin = data;
+
+    unsigned num = 0;
+    if (!SDL_Vulkan_GetInstanceExtensions(sdlwin, &num, NULL)) {
+        fprintf(stderr, "Failed enumerating Vulkan extensions: %s\n", SDL_GetError());
+        exit(1);
+    }
+
+    iparams.extensions = malloc(num * sizeof(const char *));
+    iparams.num_extensions = num;
+    assert(iparams.extensions);
+
+    SDL_bool ok = SDL_Vulkan_GetInstanceExtensions(sdlwin, &num, iparams.extensions);
+    if (!ok) {
+        fprintf(stderr, "Failed getting Vk instance extensions\n");
+        exit(1);
+    }
+
+    if (num > 0) {
+        printf("Requesting %d additional Vulkan extensions:\n", num);
+        for (unsigned i = 0; i < num; i++)
+            printf("    %s\n", iparams.extensions[i]);
+    }
+
+    rd_priv_ctx->vk_inst = pl_vk_inst_create(rd_priv_ctx->ctx, &iparams);
+    if (!rd_priv_ctx->vk_inst) {
+        fprintf(stderr, "Failed creating Vulkan instance!\n");
+        exit(1);
+    }
+    free(iparams.extensions);
+
+    if (!SDL_Vulkan_CreateSurface(sdlwin, rd_priv_ctx->vk_inst->instance, &rd_priv_ctx->surf)) {
+        fprintf(stderr, "Failed creating vulkan surface: %s\n", SDL_GetError());
+        exit(1);
+    }
+
+    struct pl_vulkan_params params = pl_vulkan_default_params;
+    params.instance = rd_priv_ctx->vk_inst->instance;
+    params.surface = rd_priv_ctx->surf;
+    params.allow_software = true;
+
+    rd_priv_ctx->vk = pl_vulkan_create(rd_priv_ctx->ctx, &params);
+    if (!rd_priv_ctx->vk) {
+        fprintf(stderr, "Failed creating vulkan device!\n");
+        exit(2);
+    }
+
+    // Create swapchain
+    rd_priv_ctx->swapchain = pl_vulkan_create_swapchain(rd_priv_ctx->vk,
+        &(struct pl_vulkan_swapchain_params) {
+            .surface = rd_priv_ctx->surf,
+            .present_mode = VK_PRESENT_MODE_IMMEDIATE_KHR,
+        });
+
+    if (!rd_priv_ctx->swapchain) {
+        fprintf(stderr, "Failed creating vulkan swapchain!\n");
+        exit(2);
+    }
+
+    int w = WINDOW_WIDTH, h = WINDOW_HEIGHT;
+    if (!pl_swapchain_resize(rd_priv_ctx->swapchain, &w, &h)) {
+        fprintf(stderr, "Failed resizing vulkan swapchain!\n");
+        exit(2);
+    }
+
+    if (w != WINDOW_WIDTH || h != WINDOW_HEIGHT)
+        printf("Note: window dimensions differ (got %dx%d)\n", w, h);
+
+    rd_priv_ctx->y_tex = NULL;
+    rd_priv_ctx->u_tex = NULL;
+    rd_priv_ctx->v_tex = NULL;
+
+    rd_priv_ctx->renderer = NULL;
+
+    return rd_priv_ctx;
+}
+
+static void placebo_renderer_destroy(void *cookie)
+{
+    Dav1dPlayRendererPrivateContext *rd_priv_ctx = cookie;
+    assert(rd_priv_ctx != NULL);
+
+    pl_renderer_destroy(&(rd_priv_ctx->renderer));
+    pl_tex_destroy(rd_priv_ctx->vk->gpu, &(rd_priv_ctx->y_tex));
+    pl_tex_destroy(rd_priv_ctx->vk->gpu, &(rd_priv_ctx->u_tex));
+    pl_tex_destroy(rd_priv_ctx->vk->gpu, &(rd_priv_ctx->v_tex));
+    pl_swapchain_destroy(&(rd_priv_ctx->swapchain));
+    pl_vulkan_destroy(&(rd_priv_ctx->vk));
+    vkDestroySurfaceKHR(rd_priv_ctx->vk_inst->instance, rd_priv_ctx->surf, NULL);
+    pl_vk_inst_destroy(&(rd_priv_ctx->vk_inst));
+    pl_context_destroy(&(rd_priv_ctx->ctx));
+}
+
+static void placebo_render(void *cookie)
+{
+    Dav1dPlayRendererPrivateContext *rd_priv_ctx = cookie;
+    assert(rd_priv_ctx != NULL);
+
+    SDL_LockMutex(rd_priv_ctx->lock);
+    if (rd_priv_ctx->y_tex == NULL) {
+        SDL_UnlockMutex(rd_priv_ctx->lock);
+        return;
+    }
+
+    // Prepare rendering
+    if (rd_priv_ctx->renderer == NULL) {
+        rd_priv_ctx->renderer = pl_renderer_create(rd_priv_ctx->ctx, rd_priv_ctx->vk->gpu);
+    }
+
+    struct pl_swapchain_frame frame;
+    bool ok = pl_swapchain_start_frame(rd_priv_ctx->swapchain, &frame);
+    if (!ok) {
+        SDL_UnlockMutex(rd_priv_ctx->lock);
+        return;
+    }
+
+    const struct pl_tex *img = rd_priv_ctx->y_plane.texture;
+    struct pl_image image = {
+        .num_planes = 3,
+        .planes     = { rd_priv_ctx->y_plane, rd_priv_ctx->u_plane, rd_priv_ctx->v_plane },
+        .repr       = pl_color_repr_hdtv,
+        .color      = pl_color_space_unknown,
+        .width      = img->params.w,
+        .height     = img->params.h,
+    };
+
+    struct pl_render_params render_params = pl_render_default_params;
+    //render_params.upscaler = &pl_filter_ewa_lanczos;
+
+    struct pl_render_target target;
+    pl_render_target_from_swapchain(&target, &frame);
+    target.profile = (struct pl_icc_profile) {
+        .data = NULL,
+        .len = 0,
+    };
+
+    if (!pl_render_image(rd_priv_ctx->renderer, &image, &target, &render_params)) {
+        fprintf(stderr, "Failed rendering frame!\n");
+        SDL_UnlockMutex(rd_priv_ctx->lock);
+        return;
+    }
+
+    ok = pl_swapchain_submit_frame(rd_priv_ctx->swapchain);
+    if (!ok) {
+        fprintf(stderr, "Failed submitting frame!\n");
+        SDL_UnlockMutex(rd_priv_ctx->lock);
+        return;
+    }
+
+    pl_swapchain_swap_buffers(rd_priv_ctx->swapchain);
+    SDL_UnlockMutex(rd_priv_ctx->lock);
+}
+
+static int placebo_upload_planes(void *cookie, Dav1dPicture *dav1d_pic)
+{
+    Dav1dPlayRendererPrivateContext *rd_priv_ctx = cookie;
+    assert(rd_priv_ctx != NULL);
+
+    SDL_LockMutex(rd_priv_ctx->lock);
+
+    if (dav1d_pic == NULL) {
+        SDL_UnlockMutex(rd_priv_ctx->lock);
+        return 0;
+    }
+
+    int width = dav1d_pic->p.w;
+    int height = dav1d_pic->p.h;
+
+    enum Dav1dPixelLayout dav1d_layout = dav1d_pic->p.layout;
+
+    if (DAV1D_PIXEL_LAYOUT_I420 != dav1d_layout || dav1d_pic->p.bpc != 8) {
+        fprintf(stderr, "Unsupported pixel format, only 8bit 420 supported so far.\n");
+        exit(50);
+    }
+
+    struct pl_plane_data data_y = {
+        .type           = PL_FMT_UNORM,
+        .width          = width,
+        .height         = height,
+        .pixel_stride   = 1,
+        .row_stride     = dav1d_pic->stride[0],
+        .pixels         = dav1d_pic->data[0],
+        .component_size = {8},
+        .component_map  = {0},
+    };
+
+    struct pl_plane_data data_u = {
+        .type           = PL_FMT_UNORM,
+        .width          = width/2,
+        .height         = height/2,
+        .pixel_stride   = 1,
+        .row_stride     = dav1d_pic->stride[1],
+        .pixels         = dav1d_pic->data[1],
+        .component_size = {8},
+        .component_map  = {1},
+    };
+
+    struct pl_plane_data data_v = {
+        .type           = PL_FMT_UNORM,
+        .width          = width/2,
+        .height         = height/2,
+        .pixel_stride   = 1,
+        .row_stride     = dav1d_pic->stride[1],
+        .pixels         = dav1d_pic->data[2],
+        .component_size = {8},
+        .component_map  = {2},
+    };
+
+    bool ok = true;
+    ok &= pl_upload_plane(rd_priv_ctx->vk->gpu, &(rd_priv_ctx->y_plane), &(rd_priv_ctx->y_tex), &data_y);
+    ok &= pl_upload_plane(rd_priv_ctx->vk->gpu, &(rd_priv_ctx->u_plane), &(rd_priv_ctx->u_tex), &data_u);
+    ok &= pl_upload_plane(rd_priv_ctx->vk->gpu, &(rd_priv_ctx->v_plane), &(rd_priv_ctx->v_tex), &data_v);
+
+    pl_chroma_location_offset(PL_CHROMA_LEFT, &rd_priv_ctx->u_plane.shift_x, &rd_priv_ctx->u_plane.shift_y);
+    pl_chroma_location_offset(PL_CHROMA_LEFT, &rd_priv_ctx->v_plane.shift_x, &rd_priv_ctx->v_plane.shift_y);
+
+    if (!ok) {
+        fprintf(stderr, "Failed uploading planes!\n");
+    }
+
+    SDL_UnlockMutex(rd_priv_ctx->lock);
+    return !ok;
+}
+
+static const Dav1dPlayRenderInfo renderer_info = {
+    .create_renderer = placebo_renderer_create,
+    .destroy_renderer = placebo_renderer_destroy,
+    .render = placebo_render,
+    .update_frame = placebo_upload_planes
+};
+
+#else
+
+/**
+ * Renderer context for SDL
+ */
+typedef struct renderer_priv_ctx
+{
+    // SDL renderer
+    SDL_Renderer *renderer;
+    // Lock protecting access to the texture
+    SDL_mutex *lock;
+    // Texture to render
+    SDL_Texture *tex;
+} Dav1dPlayRendererPrivateContext;
+
+static void *sdl_renderer_create(void *data)
+{
+    SDL_Window *win = data;
+
+    // Alloc
+    Dav1dPlayRendererPrivateContext *rd_priv_ctx = malloc(sizeof(Dav1dPlayRendererPrivateContext));
+    if (rd_priv_ctx == NULL) {
+        return NULL;
+    }
+
+    // Create renderer
+    rd_priv_ctx->renderer = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED);
+    // Set scale quality
+    SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
+
+    // Create Mutex
+    rd_priv_ctx->lock = SDL_CreateMutex();
+    if (rd_priv_ctx->lock == NULL) {
+        fprintf(stderr, "SDL_CreateMutex failed: %s\n", SDL_GetError());
+        free(rd_priv_ctx);
+        return NULL;
+    }
+
+    rd_priv_ctx->tex = NULL;
+
+    return rd_priv_ctx;
+}
+
+static void sdl_renderer_destroy(void *cookie)
+{
+    Dav1dPlayRendererPrivateContext *rd_priv_ctx = cookie;
+    assert(rd_priv_ctx != NULL);
+
+    SDL_DestroyRenderer(rd_priv_ctx->renderer);
+    SDL_DestroyMutex(rd_priv_ctx->lock);
+    free(rd_priv_ctx);
+}
+
+static void sdl_render(void *cookie)
+{
+    Dav1dPlayRendererPrivateContext *rd_priv_ctx = cookie;
+    assert(rd_priv_ctx != NULL);
+
+    SDL_LockMutex(rd_priv_ctx->lock);
+
+    if (rd_priv_ctx->tex == NULL) {
+        SDL_UnlockMutex(rd_priv_ctx->lock);
+        return;
+    }
+
+    // Display the frame
+    SDL_RenderClear(rd_priv_ctx->renderer);
+    SDL_RenderCopy(rd_priv_ctx->renderer, rd_priv_ctx->tex, NULL, NULL);
+    SDL_RenderPresent(rd_priv_ctx->renderer);
+
+    SDL_UnlockMutex(rd_priv_ctx->lock);
+}
+
+static int sdl_update_texture(void *cookie, Dav1dPicture *dav1d_pic)
+{
+    Dav1dPlayRendererPrivateContext *rd_priv_ctx = cookie;
+    assert(rd_priv_ctx != NULL);
+
+    SDL_LockMutex(rd_priv_ctx->lock);
+
+    if (dav1d_pic == NULL) {
+        rd_priv_ctx->tex = NULL;
+        SDL_UnlockMutex(rd_priv_ctx->lock);
+        return 0;
+    }
+
+    int width = dav1d_pic->p.w;
+    int height = dav1d_pic->p.h;
+    int tex_w = width;
+    int tex_h = height;
+
+    enum Dav1dPixelLayout dav1d_layout = dav1d_pic->p.layout;
+
+    if (DAV1D_PIXEL_LAYOUT_I420 != dav1d_layout || dav1d_pic->p.bpc != 8) {
+        fprintf(stderr, "Unsupported pixel format, only 8bit 420 supported so far.\n");
+        exit(50);
+    }
+
+    SDL_Texture *texture = rd_priv_ctx->tex;
+    if (texture != NULL) {
+        SDL_QueryTexture(texture, NULL, NULL, &tex_w, &tex_h);
+        if (tex_w != width || tex_h != height) {
+            SDL_DestroyTexture(texture);
+            texture = NULL;
+        }
+    }
+
+    if (texture == NULL) {
+        texture = SDL_CreateTexture(rd_priv_ctx->renderer, SDL_PIXELFORMAT_IYUV,
+            SDL_TEXTUREACCESS_STREAMING, width, height);
+    }
+
+    SDL_UpdateYUVTexture(texture, NULL,
+        dav1d_pic->data[0], (int)dav1d_pic->stride[0], // Y
+        dav1d_pic->data[1], (int)dav1d_pic->stride[1], // U
+        dav1d_pic->data[2], (int)dav1d_pic->stride[1]  // V
+        );
+
+    rd_priv_ctx->tex = texture;
+    SDL_UnlockMutex(rd_priv_ctx->lock);
+    return 0;
+}
+
+static const Dav1dPlayRenderInfo renderer_info = {
+    .create_renderer = sdl_renderer_create,
+    .destroy_renderer = sdl_renderer_destroy,
+    .render = sdl_render,
+    .update_frame = sdl_update_texture
+};
+
+#endif
+
+/**
+ * Render context structure
+ * This structure contains informations necessary
+ * to be shared between the decoder and the renderer
+ * threads.
+ */
+typedef struct render_context
+{
+    Dav1dPlaySettings settings;
+    Dav1dSettings lib_settings;
+
+    // Renderer callbacks
+    Dav1dPlayRenderInfo *renderer_info;
+    // Renderer private data (passed to callbacks)
+    void *rd_priv;
+
+    // Lock to protect access to the context structure
+    SDL_mutex *lock;
+
+    // Timestamp of previous decoded frame
+    int64_t last_pts;
+    // Timestamp of current decoded frame
+    int64_t current_pts;
+    // Ticks when last frame was received
+    uint32_t last_ticks;
+    // PTS time base
+    double timebase;
+
+    // Fifo
+    Dav1dPlayPtrFifo *fifo;
+
+    // Custom SDL2 event type
+    uint32_t renderer_event_type;
+
+    // Indicates if termination of the decoder thread was requested
+    uint8_t dec_should_terminate;
+} Dav1dPlayRenderContext;
+
+static void dp_settings_print_usage(const char *const app,
+    const char *const reason, ...)
+{
+    if (reason) {
+        va_list args;
+
+        va_start(args, reason);
+        vfprintf(stderr, reason, args);
+        va_end(args);
+        fprintf(stderr, "\n\n");
+    }
+    fprintf(stderr, "Usage: %s [options]\n\n", app);
+    fprintf(stderr, "Supported options:\n"
+            " --input/-i  $file:    input file\n"
+            " --framethreads $num:  number of frame threads (default: 1)\n"
+            " --tilethreads $num:   number of tile threads (default: 1)\n"
+            " --version/-v:         print version and exit\n");
+    exit(1);
+}
+
+static unsigned parse_unsigned(const char *const optarg, const int option,
+                               const char *const app)
+{
+    char *end;
+    const unsigned res = (unsigned) strtoul(optarg, &end, 0);
+    if (*end || end == optarg)
+        dp_settings_print_usage(app, "Invalid argument \"%s\" for option %s; should be an integer",
+          optarg, option);
+    return res;
+}
+
+static void dp_rd_ctx_parse_args(Dav1dPlayRenderContext *rd_ctx,
+    const int argc, char *const *const argv)
+{
+    int o;
+    Dav1dPlaySettings *settings = &rd_ctx->settings;
+    Dav1dSettings *lib_settings = &rd_ctx->lib_settings;
+
+    // Short options
+    static const char short_opts[] = "i:v";
+
+    enum {
+        ARG_FRAME_THREADS = 256,
+        ARG_TILE_THREADS,
+    };
+
+    // Long options
+    static const struct option long_opts[] = {
+        { "input",          1, NULL, 'i' },
+        { "version",        0, NULL, 'v' },
+        { "framethreads",   1, NULL, ARG_FRAME_THREADS },
+        { "tilethreads",    1, NULL, ARG_TILE_THREADS },
+        { NULL,             0, NULL, 0 },
+    };
+
+    while ((o = getopt_long(argc, argv, short_opts, long_opts, NULL)) != -1) {
+        switch (o) {
+            case 'i':
+                settings->inputfile = optarg;
+                break;
+            case 'v':
+                fprintf(stderr, "%s\n", dav1d_version());
+                exit(0);
+            case ARG_FRAME_THREADS:
+                lib_settings->n_frame_threads =
+                    parse_unsigned(optarg, ARG_FRAME_THREADS, argv[0]);
+                break;
+            case ARG_TILE_THREADS:
+                lib_settings->n_tile_threads =
+                    parse_unsigned(optarg, ARG_TILE_THREADS, argv[0]);
+                break;
+            default:
+                dp_settings_print_usage(argv[0], NULL);
+        }
+    }
+
+    if (optind < argc)
+        dp_settings_print_usage(argv[0],
+            "Extra/unused arguments found, e.g. '%s'\n", argv[optind]);
+    if (!settings->inputfile)
+        dp_settings_print_usage(argv[0], "Input file (-i/--input) is required");
+}
+
+/**
+ * Destroy a Dav1dPlayRenderContext
+ */
+static void dp_rd_ctx_destroy(Dav1dPlayRenderContext *rd_ctx)
+{
+    assert(rd_ctx != NULL);
+
+    renderer_info.destroy_renderer(rd_ctx->rd_priv);
+    dp_fifo_destroy(rd_ctx->fifo);
+    SDL_DestroyMutex(rd_ctx->lock);
+    free(rd_ctx);
+}
+
+/**
+ * Create a Dav1dPlayRenderContext
+ *
+ * \note  The Dav1dPlayRenderContext must be destroyed
+ *        again by using dp_rd_ctx_destroy.
+ */
+static Dav1dPlayRenderContext *dp_rd_ctx_create(void *rd_data)
+{
+    Dav1dPlayRenderContext *rd_ctx;
+
+    // Alloc
+    rd_ctx = malloc(sizeof(Dav1dPlayRenderContext));
+    if (rd_ctx == NULL) {
+        return NULL;
+    }
+
+    // Register a custom event to notify our SDL main thread
+    // about new frames
+    rd_ctx->renderer_event_type = SDL_RegisterEvents(1);
+    if (rd_ctx->renderer_event_type == UINT32_MAX) {
+        fprintf(stderr, "Failure to create custom SDL event type!\n");
+        free(rd_ctx);
+        return NULL;
+    }
+
+    rd_ctx->fifo = dp_fifo_create(5);
+    if (rd_ctx->fifo == NULL) {
+        fprintf(stderr, "Failed to create FIFO for output pictures!\n");
+        free(rd_ctx);
+        return NULL;
+    }
+
+    rd_ctx->lock = SDL_CreateMutex();
+    if (rd_ctx->lock == NULL) {
+        fprintf(stderr, "SDL_CreateMutex failed: %s\n", SDL_GetError());
+        dp_fifo_destroy(rd_ctx->fifo);
+        free(rd_ctx);
+        return NULL;
+    }
+
+    rd_ctx->rd_priv = renderer_info.create_renderer(rd_data);
+    if (rd_ctx->rd_priv == NULL) {
+        SDL_DestroyMutex(rd_ctx->lock);
+        dp_fifo_destroy(rd_ctx->fifo);
+        free(rd_ctx);
+        return NULL;
+    }
+
+    dav1d_default_settings(&rd_ctx->lib_settings);
+    memset(&rd_ctx->settings, 0, sizeof(rd_ctx->settings));
+
+    rd_ctx->last_pts = 0;
+    rd_ctx->last_ticks = 0;
+    rd_ctx->current_pts = 0;
+    rd_ctx->timebase = 0;
+    rd_ctx->dec_should_terminate = 0;
+
+    return rd_ctx;
+}
+
+/**
+ * Notify about new available frame
+ */
+static void dp_rd_ctx_post_event(Dav1dPlayRenderContext *rd_ctx, uint32_t code)
+{
+    SDL_Event event;
+    SDL_zero(event);
+    event.type = rd_ctx->renderer_event_type;
+    event.user.code = code;
+    SDL_PushEvent(&event);
+}
+
+/**
+ * Update the decoder context with a new dav1d picture
+ *
+ * Once the decoder decoded a new picture, this call can be used
+ * to update the internal texture of the render context with the
+ * new picture.
+ */
+static void dp_rd_ctx_update_with_dav1d_picture(Dav1dPlayRenderContext *rd_ctx,
+    Dav1dPicture *dav1d_pic)
+{
+    renderer_info.update_frame(rd_ctx->rd_priv, dav1d_pic);
+    rd_ctx->current_pts = dav1d_pic->m.timestamp;
+}
+
+/**
+ * Terminate decoder thread (async)
+ */
+static void dp_rd_ctx_request_shutdown(Dav1dPlayRenderContext *rd_ctx)
+{
+    SDL_LockMutex(rd_ctx->lock);
+    rd_ctx->dec_should_terminate = 1;
+    SDL_UnlockMutex(rd_ctx->lock);
+}
+
+/**
+ * Query state of decoder shutdown request
+ */
+static int dp_rd_ctx_should_terminate(Dav1dPlayRenderContext *rd_ctx)
+{
+    int ret = 0;
+    SDL_LockMutex(rd_ctx->lock);
+    ret = rd_ctx->dec_should_terminate;
+    SDL_UnlockMutex(rd_ctx->lock);
+    return ret;
+}
+
+/**
+ * Render the currently available texture
+ *
+ * Renders the currently available texture, if any.
+ */
+static void dp_rd_ctx_render(Dav1dPlayRenderContext *rd_ctx)
+{
+    // Calculate time since last frame was received
+    uint32_t ticks_now = SDL_GetTicks();
+    uint32_t ticks_diff = (rd_ctx->last_ticks != 0) ? ticks_now - rd_ctx->last_ticks : 0;
+
+    // Calculate when to display the frame
+    int64_t pts_diff = rd_ctx->current_pts - rd_ctx->last_pts;
+    int32_t wait_time = (pts_diff * rd_ctx->timebase) * 1000 - ticks_diff;
+    rd_ctx->last_pts = rd_ctx->current_pts;
+
+    // This way of timing the playback is not accurate, as there is no guarantee
+    // that SDL_Delay will wait for exactly the requested amount of time so in a
+    // accurate player this would need to be done in a better way.
+    if (wait_time >= 0) {
+        SDL_Delay(wait_time);
+    } else if (wait_time < -10) { // Do not warn for minor time drifts
+        fprintf(stderr, "Frame displayed %f seconds too late\n", wait_time/(float)1000);
+    }
+
+    renderer_info.render(rd_ctx->rd_priv);
+
+    rd_ctx->last_ticks = SDL_GetTicks();
+}
+
+/* Decoder thread "main" function */
+static int decoder_thread_main(void *cookie)
+{
+    Dav1dPlayRenderContext *rd_ctx = cookie;
+
+    Dav1dPicture *p;
+    Dav1dContext *c = NULL;
+    Dav1dData data;
+    DemuxerContext *in_ctx = NULL;
+    int res = 0;
+    unsigned n_out = 0, total, timebase[2], fps[2];
+
+    // Store current ticks for stats calculation
+    uint32_t decoder_start = SDL_GetTicks();
+
+    Dav1dPlaySettings settings = rd_ctx->settings;
+
+    // Init dav1d tools demuxers
+    init_demuxers();
+
+    if ((res = input_open(&in_ctx, "ivf",
+                          settings.inputfile,
+                          fps, &total, timebase)) < 0)
+    {
+        fprintf(stderr, "Failed to open demuxer\n");
+        res = 1;
+        goto cleanup;
+    }
+
+    double timebase_d = timebase[1]/(double)timebase[0];
+    rd_ctx->timebase = timebase_d;
+
+    if ((res = dav1d_open(&c, &rd_ctx->lib_settings))) {
+        fprintf(stderr, "Failed opening dav1d decoder\n");
+        res = 1;
+        goto cleanup;
+    }
+
+    if ((res = input_read(in_ctx, &data)) < 0) {
+        fprintf(stderr, "Failed demuxing input\n");
+        res = 1;
+        goto cleanup;
+    }
+
+    // Decoder loop
+    do {
+        if (dp_rd_ctx_should_terminate(rd_ctx))
+            break;
+
+        // Send data packets we got from the demuxer to dav1d
+        if ((res = dav1d_send_data(c, &data)) < 0) {
+            // On EAGAIN, dav1d can not consume more data and
+            // dav1d_get_picture needs to be called first, which
+            // will happen below, so just keep going in that case
+            // and do not error out.
+            if (res != DAV1D_ERR(EAGAIN)) {
+                dav1d_data_unref(&data);
+                fprintf(stderr, "Error decoding frame: %s\n",
+                        strerror(-res));
+                break;
+            }
+        }
+
+        p = calloc(1, sizeof(*p));
+
+        // Try to get a decoded frame
+        if ((res = dav1d_get_picture(c, p)) < 0) {
+            // In all error cases, even EAGAIN, p needs to be freed as
+            // it is never added to the queue and would leak.
+            free(p);
+
+            // On EAGAIN, it means dav1d has not enough data to decode
+            // therefore this is not a decoding error but just means
+            // we need to feed it more data, which happens in the next
+            // run of this decoder loop.
+            if (res != DAV1D_ERR(EAGAIN)) {
+                fprintf(stderr, "Error decoding frame: %s\n",
+                        strerror(-res));
+                break;
+            }
+            res = 0;
+        } else {
+
+            // Queue frame
+            dp_fifo_push(rd_ctx->fifo, p);
+            dp_rd_ctx_post_event(rd_ctx, DAV1D_EVENT_NEW_FRAME);
+
+            n_out++;
+        }
+    } while ((data.sz > 0 || !input_read(in_ctx, &data)));
+
+    // Release remaining data
+    if (data.sz > 0) dav1d_data_unref(&data);
+
+    // Do not drain in case an error occured and caused us to leave the
+    // decoding loop early.
+    if (res < 0)
+        goto cleanup;
+
+    // Drain decoder
+    // When there is no more data to feed to the decoder, for example
+    // because the file ended, we still need to request pictures, as
+    // even though we do not have more data, there can be frames decoded
+    // from data we sent before. So we need to call dav1d_get_picture until
+    // we get an EAGAIN error.
+    do {
+        if (dp_rd_ctx_should_terminate(rd_ctx))
+            break;
+
+        p = calloc(1, sizeof(*p));
+        res = dav1d_get_picture(c, p);
+        if (res < 0) {
+            free(p);
+            if (res != DAV1D_ERR(EAGAIN)) {
+                fprintf(stderr, "Error decoding frame: %s\n",
+                        strerror(-res));
+                break;
+            }
+        } else {
+            // Queue frame
+            dp_fifo_push(rd_ctx->fifo, p);
+            dp_rd_ctx_post_event(rd_ctx, DAV1D_EVENT_NEW_FRAME);
+
+            n_out++;
+        }
+    } while (res != DAV1D_ERR(EAGAIN));
+
+    // Print stats
+    uint32_t decoding_time_ms = SDL_GetTicks() - decoder_start;
+    printf("Decoded %u frames in %d seconds, avg %.02f fps\n",
+        n_out, decoding_time_ms/1000, n_out / (decoding_time_ms / 1000.0));
+
+cleanup:
+    dp_rd_ctx_post_event(rd_ctx, DAV1D_EVENT_DEC_QUIT);
+
+    if (in_ctx)
+        input_close(in_ctx);
+    if (c)
+        dav1d_close(&c);
+
+    return (res != DAV1D_ERR(EAGAIN) && res < 0);
+}
+
+int main(int argc, char **argv)
+{
+    SDL_Thread *decoder_thread;
+    SDL_Window *win = NULL;
+
+    // Check for version mismatch between library and tool
+    const char *version = dav1d_version();
+    if (strcmp(version, DAV1D_VERSION)) {
+        fprintf(stderr, "Version mismatch (library: %s, executable: %s)\n",
+                version, DAV1D_VERSION);
+        return 1;
+    }
+
+    // Init SDL2 library
+    if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0)
+        return 10;
+
+    // Create Window and Renderer
+    int window_flags = SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI;
+#ifdef HAVE_PLACEBO_VULKAN
+    window_flags |= SDL_WINDOW_VULKAN;
+#endif
+    win = SDL_CreateWindow("Dav1dPlay", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
+        WINDOW_WIDTH, WINDOW_HEIGHT, window_flags);
+    SDL_SetWindowResizable(win, SDL_TRUE);
+
+    // Create render context
+    Dav1dPlayRenderContext *rd_ctx = dp_rd_ctx_create(win);
+    if (rd_ctx == NULL) {
+        fprintf(stderr, "Failed creating render context\n");
+        return 5;
+    }
+
+    // Parse and validate arguments
+    dp_rd_ctx_parse_args(rd_ctx, argc, argv);
+
+    // Start decoder thread
+    decoder_thread = SDL_CreateThread(decoder_thread_main, "Decoder thread", rd_ctx);
+
+    // Main loop
+    while (1) {
+
+        SDL_Event e;
+        if (SDL_WaitEvent(&e)) {
+            if (e.type == SDL_QUIT) {
+                dp_rd_ctx_request_shutdown(rd_ctx);
+            } else if (e.type == rd_ctx->renderer_event_type) {
+                if (e.user.code == DAV1D_EVENT_NEW_FRAME) {
+                    // Dequeue frame and update the render context with it
+                    Dav1dPicture *p = dp_fifo_shift(rd_ctx->fifo);
+
+                    // Do not update textures during termination
+                    if (!dp_rd_ctx_should_terminate(rd_ctx))
+                        dp_rd_ctx_update_with_dav1d_picture(rd_ctx, p);
+                    dav1d_picture_unref(p);
+                    free(p);
+                } else if (e.user.code == DAV1D_EVENT_DEC_QUIT) {
+                    break;
+                }
+            }
+        }
+
+        // Do not render during termination
+        if (!dp_rd_ctx_should_terminate(rd_ctx))
+            dp_rd_ctx_render(rd_ctx);
+    }
+
+    int decoder_ret = 0;
+    SDL_WaitThread(decoder_thread, &decoder_ret);
+
+    dp_rd_ctx_destroy(rd_ctx);
+    SDL_DestroyWindow(win);
+
+    return decoder_ret;
+}
new file mode 100644
--- /dev/null
+++ b/third_party/dav1d/examples/meson.build
@@ -0,0 +1,62 @@
+# Copyright © 2018, VideoLAN and dav1d authors
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+#    list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+#    this list of conditions and the following disclaimer in the documentation
+#    and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#
+# Build definition for the dav1d examples
+#
+
+# Leave subdir if examples are disabled
+if not get_option('enable_examples')
+    subdir_done()
+endif
+
+
+# dav1d player sources
+dav1dplay_sources = files(
+    'dav1dplay.c',
+)
+
+sdl2_dependency = dependency('sdl2', version: '>= 2.0.1', required: false)
+
+if sdl2_dependency.found()
+    placebo_dependency = dependency('libplacebo', version: '>= 1.18.0', required: false)
+    vulkan_dependency = dependency('vulkan', required: false)
+    sdl_has_vulkan = cc.has_header('SDL_vulkan.h', dependencies: [sdl2_dependency])
+    cflag_placebo = []
+    deps_placebo = []
+    if placebo_dependency.found() and vulkan_dependency.found() and sdl_has_vulkan
+        cflag_placebo += '-DHAVE_PLACEBO_VULKAN=1'
+        deps_placebo = [vulkan_dependency, placebo_dependency]
+    endif
+    dav1dplay = executable('dav1dplay',
+        dav1dplay_sources,
+        rev_target,
+
+        link_with : [libdav1d, dav1d_input_objs],
+        include_directories : [dav1d_inc_dirs],
+        dependencies : [getopt_dependency, sdl2_dependency, deps_placebo],
+        install : true,
+        c_args : cflag_placebo,
+    )
+endif
--- a/third_party/dav1d/include/common/attributes.h
+++ b/third_party/dav1d/include/common/attributes.h
@@ -41,17 +41,17 @@
 #define ATTR_FORMAT_PRINTF(fmt, attr)
 #define COLD
 #endif
 
 #if ARCH_X86_64
 /* x86-64 needs 32-byte alignment for AVX2. */
 #define ALIGN_32_VAL 32
 #define ALIGN_16_VAL 16
-#elif ARCH_X86_32 || ARCH_ARM || ARCH_AARCH64
+#elif ARCH_X86_32 || ARCH_ARM || ARCH_AARCH64 || ARCH_PPC64LE
 /* ARM doesn't benefit from anything more than 16-byte alignment. */
 #define ALIGN_32_VAL 16
 #define ALIGN_16_VAL 16
 #else
 /* No need for extra alignment on platforms without assembly. */
 #define ALIGN_32_VAL 8
 #define ALIGN_16_VAL 8
 #endif
@@ -87,16 +87,24 @@
  * static NOINLINE void func() {}
  */
 #ifdef _MSC_VER
 #define NOINLINE __declspec(noinline)
 #else /* !_MSC_VER */
 #define NOINLINE __attribute__((noinline))
 #endif /* !_MSC_VER */
 
+#if defined(NDEBUG) && (defined(__GNUC__) || defined(__clang__))
+#define assert(x) do { if (!(x)) __builtin_unreachable(); } while (0)
+#elif defined(NDEBUG) && defined(_MSC_VER)
+#define assert __assume
+#else
+#include <assert.h>
+#endif
+
 #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__)
 #    define dav1d_uninit(x) x=x
 #else
 #    define dav1d_uninit(x) x
 #endif
 
  #ifdef _MSC_VER
  #include <intrin.h>
--- a/third_party/dav1d/include/common/intops.h
+++ b/third_party/dav1d/include/common/intops.h
@@ -35,16 +35,24 @@
 static inline int imax(const int a, const int b) {
     return a > b ? a : b;
 }
 
 static inline int imin(const int a, const int b) {
     return a < b ? a : b;
 }
 
+static inline unsigned umax(const unsigned a, const unsigned b) {
+    return a > b ? a : b;
+}
+
+static inline unsigned umin(const unsigned a, const unsigned b) {
+    return a < b ? a : b;
+}
+
 static inline int iclip(const int v, const int min, const int max) {
     return v < min ? min : v > max ? max : v;
 }
 
 static inline int iclip_u8(const int v) {
     return iclip(v, 0, 255);
 }
 
--- a/third_party/dav1d/include/common/mem.h
+++ b/third_party/dav1d/include/common/mem.h
@@ -23,23 +23,24 @@
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifndef DAV1D_COMMON_MEM_H
 #define DAV1D_COMMON_MEM_H
 
-#include <assert.h>
 #include <stdlib.h>
 
 #if defined(HAVE_ALIGNED_MALLOC) || defined(HAVE_MEMALIGN)
 #include <malloc.h>
 #endif
 
+#include "common/attributes.h"
+
 /*
  * Allocate 32-byte aligned memory. The return value can be released
  * by calling the standard free() function.
  */
 static inline void *dav1d_alloc_aligned(size_t sz, size_t align) {
 #ifdef HAVE_POSIX_MEMALIGN
     void *ptr;
     assert(!(align & (align - 1)));
--- a/third_party/dav1d/include/dav1d/headers.h
+++ b/third_party/dav1d/include/dav1d/headers.h
@@ -23,16 +23,18 @@
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifndef DAV1D_HEADERS_H
 #define DAV1D_HEADERS_H
 
+#include <stddef.h>
+
 // Constants from Section 3. "Symbols and abbreviated terms"
 #define DAV1D_MAX_CDEF_STRENGTHS 8
 #define DAV1D_MAX_OPERATING_POINTS 32
 #define DAV1D_MAX_TILE_COLS 64
 #define DAV1D_MAX_TILE_ROWS 64
 #define DAV1D_MAX_SEGMENTS 8
 #define DAV1D_NUM_REF_FRAMES 8
 #define DAV1D_PRIMARY_REF_NONE 7
@@ -171,16 +173,23 @@ typedef struct Dav1dMasteringDisplay {
     ///< 0.16 fixed point
     uint16_t white_point[2];
     ///< 24.8 fixed point
     uint32_t max_luminance;
     ///< 18.14 fixed point
     uint32_t min_luminance;
 } Dav1dMasteringDisplay;
 
+typedef struct Dav1dITUTT35 {
+    uint8_t  country_code;
+    uint8_t  country_code_extension_byte;
+    size_t   payload_size;
+    uint8_t *payload;
+} Dav1dITUTT35;
+
 typedef struct Dav1dSequenceHeader {
     /**
      * Stream profile, 0 for 8-10 bits/component 4:2:0 or monochrome;
      * 1 for 8-10 bits/component 4:4:4; 2 for 4:2:2 at any bits/component,
      * or 12 bits/component at any chroma subsampling.
      */
     int profile;
     /**
@@ -284,17 +293,17 @@ typedef struct Dav1dSegmentationDataSet 
 } Dav1dSegmentationDataSet;
 
 typedef struct Dav1dLoopfilterModeRefDeltas {
     int mode_delta[2 /* is_zeromv */];
     int ref_delta[DAV1D_TOTAL_REFS_PER_FRAME];
 } Dav1dLoopfilterModeRefDeltas;
 
 typedef struct Dav1dFilmGrainData {
-    uint16_t seed;
+    unsigned seed;
     int num_y_points;
     uint8_t y_points[14][2 /* value, scaling */];
     int chroma_scaling_from_luma;
     int num_uv_points[2];
     uint8_t uv_points[2][10][2 /* value, scaling */];
     int scaling_shift;
     int ar_coeff_lag;
     int8_t ar_coeffs_y[24];
--- a/third_party/dav1d/include/dav1d/picture.h
+++ b/third_party/dav1d/include/dav1d/picture.h
@@ -72,19 +72,26 @@ typedef struct Dav1dPicture {
      * as defined in section 5.8.3 and 6.7.3
      */
     Dav1dContentLightLevel *content_light;
     /**
      * High Dynamic Range Mastering Display Color Volume metadata applying to
      * this picture, as defined in section 5.8.4 and 6.7.4
      */
     Dav1dMasteringDisplay *mastering_display;
+    /**
+     * ITU-T T.35 metadata as defined in section 5.8.2 and 6.7.2
+     */
+    Dav1dITUTT35 *itut_t35;
+
+    uintptr_t reserved[4]; ///< reserved for future use
 
     struct Dav1dRef *frame_hdr_ref, *seq_hdr_ref; ///< Frame parameter allocation origins
-    struct Dav1dRef *content_light_ref, *mastering_display_ref; ///< Metadata allocation origins
+    struct Dav1dRef *content_light_ref, *mastering_display_ref, *itut_t35_ref; ///< Metadata allocation origins
+    uintptr_t reserved_ref[4]; ///< reserved for future use
     struct Dav1dRef *ref; ///< Frame data allocation origin
 
     void *allocator_data; ///< pointer managed by the allocator
 } Dav1dPicture;
 
 typedef struct Dav1dPicAllocator {
     void *cookie; ///< custom data to pass to the allocator callbacks.
     /**
--- a/third_party/dav1d/meson.build
+++ b/third_party/dav1d/meson.build
@@ -18,24 +18,24 @@
 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 project('dav1d', ['c'],
-    version: '0.3.1',
+    version: '0.4.0',
     default_options: ['c_std=c99',
                       'warning_level=2',
                       'buildtype=release',
                       'b_ndebug=if-release'],
     meson_version: '>= 0.47.0')
 
-dav1d_soname_version       = '2.0.0'
+dav1d_soname_version       = '3.0.0'
 dav1d_api_version_array    = dav1d_soname_version.split('.')
 dav1d_api_version_major    = dav1d_api_version_array[0]
 dav1d_api_version_minor    = dav1d_api_version_array[1]
 dav1d_api_version_revision = dav1d_api_version_array[2]
 
 dav1d_src_root = meson.current_source_dir()
 cc = meson.get_compiler('c')
 
@@ -80,19 +80,24 @@ cdata.set10('CONFIG_LOG', get_option('lo
 #
 
 # Arguments in test_args will be used even on feature tests
 test_args = []
 
 optional_arguments = []
 
 # Define _POSIX_C_SOURCE to POSIX.1–2001 (IEEE Std 1003.1-2001)
-test_args  += '-D_POSIX_C_SOURCE=200112L'
+test_args += '-D_POSIX_C_SOURCE=200112L'
 add_project_arguments('-D_POSIX_C_SOURCE=200112L', language: 'c')
 
+if host_machine.system() == 'darwin'
+    test_args += '-D_DARWIN_C_SOURCE'
+    add_project_arguments('-D_DARWIN_C_SOURCE', language: 'c')
+endif
+
 if host_machine.system() == 'windows'
     cdata.set('_WIN32_WINNT',           '0x0601')
     cdata.set('UNICODE',                1) # Define to 1 for Unicode (Wide Chars) APIs
     cdata.set('_UNICODE',               1) # Define to 1 for Unicode (Wide Chars) APIs
     cdata.set('__USE_MINGW_ANSI_STDIO', 1) # Define to force use of MinGW printf
     if cc.has_function('fseeko', prefix : '#include <stdio.h>', args : test_args)
         cdata.set('_FILE_OFFSET_BITS', 64) # Not set by default by Meson on Windows
     else
@@ -384,9 +389,11 @@ endif
 subdir('include')
 
 subdir('doc')
 
 subdir('src')
 
 subdir('tools')
 
+subdir('examples')
+
 subdir('tests')
--- a/third_party/dav1d/meson_options.txt
+++ b/third_party/dav1d/meson_options.txt
@@ -10,16 +10,21 @@ option('enable_asm',
     value: true,
     description: 'Build asm files, if available')
 
 option('enable_tools',
     type: 'boolean',
     value: true,
     description: 'Build dav1d cli tools')
 
+option('enable_examples',
+    type: 'boolean',
+    value: false,
+    description: 'Build dav1d examples')
+
 option('enable_tests',
     type: 'boolean',
     value: true,
     description: 'Build dav1d tests')
 
 option('logging',
     type: 'boolean',
     value: true,
--- a/third_party/dav1d/src/arm/32/mc.S
+++ b/third_party/dav1d/src/arm/32/mc.S
@@ -86,24 +86,26 @@ function \type\()_8bpc_neon, export=1
         vmov.i8         q15, #256-2
 .endif
         adr             r12, L(\type\()_tbl)
         sub             r4,  r4,  #24
         ldr             r4,  [r12, r4, lsl #2]
         \type           d16, d17, q0,  q1,  q2,  q3
         add             r12, r12, r4
         bx              r12
+
         .align 2
 L(\type\()_tbl):
         .word 1280f - L(\type\()_tbl) + CONFIG_THUMB
         .word 640f  - L(\type\()_tbl) + CONFIG_THUMB
         .word 320f  - L(\type\()_tbl) + CONFIG_THUMB
         .word 160f  - L(\type\()_tbl) + CONFIG_THUMB
         .word 80f   - L(\type\()_tbl) + CONFIG_THUMB
         .word 4f    - L(\type\()_tbl) + CONFIG_THUMB
+
 4:
         add             r6,  r0,  r1
         lsl             r1,  r1,  #1
         cmp             r5,  #4
         vst1.32         {d16[0]},  [r0, :32], r1
         vst1.32         {d16[1]},  [r6, :32], r1
         vst1.32         {d17[0]},  [r0, :32], r1
         vst1.32         {d17[1]},  [r6, :32], r1
@@ -212,53 +214,55 @@ endfunc
 
 bidir_fn avg
 bidir_fn w_avg
 bidir_fn mask
 
 
 .macro w_mask_fn type
 function w_mask_\type\()_8bpc_neon, export=1
-        push            {r4-r10,lr}
-        ldr             r4,  [sp, #32]
-        ldr             r5,  [sp, #36]
-        ldr             r6,  [sp, #40]
-        ldr             r7,  [sp, #44]
+        push            {r4-r9,lr}
+        ldr             r4,  [sp, #28]
+        ldr             r5,  [sp, #32]
+        ldr             r6,  [sp, #36]
+        ldr             r7,  [sp, #40]
         clz             r8,  r4
         adr             r9,  L(w_mask_\type\()_tbl)
         sub             r8,  r8,  #24
         ldr             r8,  [r9,  r8,  lsl #2]
         add             r9,  r9,  r8
-        mov             r12, #6903
+        movw            r12, #6903
         vdup.16         q14, r12
 .if \type == 444
         vmov.i8         q15, #64
 .elseif \type == 422
         vdup.8          d0,  r7         // d0[] <- sign
         vmov.i8         d30, #129
         vsub.i8         d30, d30, d0    // 129 - sign
 .elseif \type == 420
         vdup.16         q0,  r7         // d0[] <- sign
         vmov.i16        q15, #256
         vsub.i16        q15, q15, q0    // 256 - sign
 .endif
         add             r12, r0,  r1
         lsl             r1,  r1,  #1
         bx              r9
+
         .align 2
 L(w_mask_\type\()_tbl):
         .word 1280f  - L(w_mask_\type\()_tbl) + CONFIG_THUMB
         .word 640f   - L(w_mask_\type\()_tbl) + CONFIG_THUMB
         .word 320f   - L(w_mask_\type\()_tbl) + CONFIG_THUMB
         .word 160f   - L(w_mask_\type\()_tbl) + CONFIG_THUMB
         .word 8f     - L(w_mask_\type\()_tbl) + CONFIG_THUMB
         .word 4f     - L(w_mask_\type\()_tbl) + CONFIG_THUMB
+
 4:
-        vld1.16         {d0,  d1,  d2,  d3},  [r2]! // tmp1 (four rows at once)
-        vld1.16         {d4,  d5,  d6,  d7},  [r3]! // tmp2 (four rows at once)
+        vld1.16         {d0,  d1,  d2,  d3},  [r2,  :128]! // tmp1 (four rows at once)
+        vld1.16         {d4,  d5,  d6,  d7},  [r3,  :128]! // tmp2 (four rows at once)
         subs            r5,  r5,  #4
         vsub.i16        q8,  q2,  q0    // tmp2-tmp1
         vsub.i16        q9,  q3,  q1
         vabd.s16        q10, q0,  q2    // (abs(tmp1[x] - tmp2[x]))
         vabd.s16        q11, q1,  q3
         vqsub.u16       q10, q14, q10   // 6903 - abs ()
         vqsub.u16       q11, q14, q11
         vshr.s16        q10, q10, #8    // 64-m = (6903 - abs()) >> 8
@@ -270,40 +274,40 @@ 4:
         vadd.i16        q12, q12, q0    // (((tmp2-tmp1)*(64-m)<<9)>>15) + tmp1
         vadd.i16        q13, q13, q1
         vqrshrun.s16    d24, q12, #4    // (((((tmp2-tmp1)*(64-m)<<9)>>15) + tmp1) + 8) >> 4
         vqrshrun.s16    d25, q13, #4
 .if \type == 444
         vmovn.u16       d20, q10        // 64 - m
         vmovn.u16       d21, q11
         vsub.i8         q10, q15, q10   // m
-        vst1.8          {d20, d21}, [r6]!
+        vst1.8          {d20, d21}, [r6,  :128]!
 .elseif \type == 422
         vpadd.s16       d20, d20, d21   // (64 - m) + (64 - n) (column wise addition)
         vpadd.s16       d21, d22, d23
         vmovn.s16       d6,  q10
         vhsub.u8        d6,  d30, d6    // ((129 - sign) - ((64 - m) + (64 - n))) >> 1
-        vst1.8          {d6},  [r6]!
+        vst1.8          {d6},  [r6,  :64]!
 .elseif \type == 420
         vadd.s16        d20, d20, d21   // (64 - my1) + (64 - my2) (row wise addition)
         vadd.s16        d21, d22, d23
         vpadd.s16       d20, d20, d21   // (128 - m) + (128 - n) (column wise addition)
         vsub.s16        d20, d30, d20   // (256 - sign) - ((128 - m) + (128 - n))
         vrshrn.u16      d20, q10,  #2   // ((256 - sign) - ((128 - m) + (128 - n)) + 2) >> 2
-        vst1.32         {d20[0]},  [r6]!
+        vst1.32         {d20[0]}, [r6,  :32]!
 .endif
-        vst1.32         {d24[0]}, [r0],  r1
-        vst1.32         {d24[1]}, [r12], r1
-        vst1.32         {d25[0]}, [r0],  r1
-        vst1.32         {d25[1]}, [r12], r1
+        vst1.32         {d24[0]}, [r0,  :32], r1
+        vst1.32         {d24[1]}, [r12, :32], r1
+        vst1.32         {d25[0]}, [r0,  :32], r1
+        vst1.32         {d25[1]}, [r12, :32], r1
         bgt             4b
-        pop             {r4-r10,pc}
+        pop             {r4-r9,pc}
 8:
-        vld1.16         {d0,  d1,  d2,  d3},  [r2]! // tmp1y1, tmp1y2
-        vld1.16         {d4,  d5,  d6,  d7},  [r3]! // tmp2y1, tmp2y2
+        vld1.16         {d0,  d1,  d2,  d3},  [r2,  :128]! // tmp1y1, tmp1y2
+        vld1.16         {d4,  d5,  d6,  d7},  [r3,  :128]! // tmp2y1, tmp2y2
         subs            r5,  r5,  #2
         vsub.i16        q8,  q2,  q0    // tmp2y1 - tmp1y1
         vsub.i16        q9,  q3,  q1    // tmp2y2 - tmp1y2
         vabd.s16        q10, q0,  q2    // abs(tmp1y1 - tmp2y1)
         vabd.s16        q11, q1,  q3    // abs(tmp1y2 - tmp2y2)
         vqsub.u16       q10, q14, q10   // 6903 - abs(tmp1y1 - tmp2y1)
         vqsub.u16       q11, q14, q11   // 6903 - abs(tmp1y2 - tmp2y2)
         vshr.s16        q10, q10, #8    // 64 - my1 = 6903 - abs(tmp1y1 - tmp2y1) >> 8
@@ -315,557 +319,541 @@ 8:
         vadd.s16        q12, q12, q0    // (((tmp2y1 - tmp1y1) * (64 - my1) << 9) >> 15) + tmp1y1
         vadd.s16        q13, q13, q1    // (((tmp2y2 - tmp1y2) * (64 - my2) << 9) >> 15) + tmp1y2
         vqrshrun.s16    d24, q12, #4    // (((((tmp2y1 - tmp1y1) * (64 - my1) << 9) >> 15) + tmp1y1) + 8) >> 4
         vqrshrun.s16    d25, q13, #4    // (((((tmp2y2 - tmp1y2) * (64 - my2) << 9) >> 15) + tmp1y2) + 8) >> 4
 .if \type == 444
         vmovn.u16       d20, q10        // 64 - m
         vmovn.u16       d21, q11
         vsub.i8         q10, q15, q10   // m
-        vst1.8          {d20, d21}, [r6]!
+        vst1.8          {d20, d21}, [r6,  :128]!
 .elseif \type == 422
         vpadd.s16       d20, d20, d21   // (64 - my1) + (64 - ny1) (column wise addition)
         vpadd.s16       d21, d22, d23   // (64 - my2) + (64 - ny2)
         vmovn.s16       d20, q10
         vhsub.u8        d20, d30, d20   // ((129 - sign) - ((64 - my1/y2) + (64 - ny1/y2))) >> 1
-        vst1.8          {d20}, [r6]!
+        vst1.8          {d20}, [r6,  :64]!
 .elseif \type == 420
         vadd.s16        q10, q10, q11   // (64 - my1) + (64 - my2) (row wise addition)
         vpadd.s16       d20, d20, d21   // (128 - m) + (128 - n) (column wise addition)
         vsub.s16        d20, d30, d20   // (256 - sign) - ((128 - m) + (128 - n))
         vrshrn.u16      d20, q10, #2    // ((256 - sign) - ((128 - m) + (128 - n)) + 2) >> 2
-        vst1.32         {d20[0]}, [r6]!
+        vst1.32         {d20[0]}, [r6,  :32]!
 .endif
-        vst1.16         {d24}, [r0],  r1
-        vst1.16         {d25}, [r12], r1
+        vst1.16         {d24}, [r0,  :64], r1
+        vst1.16         {d25}, [r12, :64], r1
         bgt             8b
-        pop             {r4-r10,pc}
+        pop             {r4-r9,pc}
 1280:
 640:
 320:
 160:
         sub             r1,  r1,  r4
 .if \type == 444
-        add             r10, r6,  r4
+        add             lr,  r6,  r4
 .elseif \type == 422
-        add             r10, r6,  r4,  lsr #1
+        add             lr,  r6,  r4,  lsr #1
 .endif
-        mov             lr,  r7
         add             r9,  r3,  r4,  lsl #1
         add             r7,  r2,  r4,  lsl #1
 161:
         mov             r8,  r4
 16:
-        vld1.16         {d0,  d1,  d2,  d3},  [r2]! // tmp1y1
-        vld1.16         {d4,  d5,  d6,  d7},  [r3]! // tmp2y1
-        vld1.16         {d16, d17, d18, d19}, [r7]! // tmp1y2
+        vld1.16         {d0,  d1,  d2,  d3},  [r2,  :128]! // tmp1y1
+        vld1.16         {d4,  d5,  d6,  d7},  [r3,  :128]! // tmp2y1
+        vld1.16         {d16, d17, d18, d19}, [r7,  :128]! // tmp1y2
         subs            r8,  r8,  #16
         vsub.i16        q2,  q2,  q0    // tmp2y1 - tmp1y1
         vsub.i16        q3,  q3,  q1
         vabs.s16        q10, q2         // abs(tm2y1 - tmp1y1)
         vabs.s16        q11, q3
         vqsub.u16       q10, q14, q10   // 6903 - abs(tmp1y1 - tmp2y1)
         vqsub.u16       q11, q14, q11
         vshr.s16        q10, q10, #8    // 64 - my1 = 6903 - abs(tmp1y1 - tmp2y1) >> 8
         vshr.s16        q11, q11, #8
         vshl.s16        q12, q10, #9    // (64 - my1) << 9
         vshl.s16        q13, q11, #9
         vqdmulh.s16     q12, q12, q2    // ((tmp2y1 - tmp1y1) * (64 - my1) << 9) >> 15
         vqdmulh.s16     q13, q13, q3
         vadd.i16        q12, q12, q0    // (((tmp2y1 - tmp1y1) * (64 - my1) << 9) >> 15) + tmp1y1
         vadd.i16        q13, q13, q1
-        vld1.16         {d0,  d1,  d2,  d3},  [r9]! // tmp2h2
+        vld1.16         {d0,  d1,  d2,  d3},  [r9,  :128]! // tmp2h2
 .if \type == 444
         vmovn.u16       d20, q10        // 64 - my1
         vmovn.u16       d21, q11
         vsub.i8         q10, q15, q10   // my1
-        vst1.8          {d20, d21}, [r6]!
+        vst1.8          {d20, d21}, [r6,  :128]!
 .elseif \type == 422
         vpadd.s16       d20, d20, d21   // (64 - my1) + (64 - ny1) (column wise addition)
         vpadd.s16       d21, d22, d23
         vmovn.s16       d20, q10
         vhsub.u8        d20, d30, d20   // ((129 - sign) - ((64 - my1) + (64 - ny1))) >> 1
-        vst1.8          {d20}, [r6]!
+        vst1.8          {d20}, [r6,  :64]!
 .endif
         vqrshrun.s16    d24, q12, #4    // (((((tmp2y1 - tmp1y1)*(64 - my1) << 9) >> 15) + tmp1y1) + 8) >> 4
         vqrshrun.s16    d25, q13, #4
         vsub.i16        q0,  q0,  q8    // tmp2y2 - tmp1y2
         vsub.i16        q1,  q1,  q9
-        vst1.16         {d24, d25}, [r0]!    // store dsty1
+        vst1.16         {d24, d25}, [r0,  :128]!    // store dsty1
         vabs.s16        q2,  q0         // abs(tmp2y2 - tmp1y2)
         vabs.s16        q3,  q1
         vqsub.u16       q2,  q14, q2    // 6903 - abs(tmp2y2 - tmp1y2)
         vqsub.u16       q3,  q14, q3
         vshr.s16        q2,  q2,  #8    // (6903 - abs(tmp2y2 - tmp1y2)) >> 8
         vshr.s16        q3,  q3,  #8
         vshl.s16        q12, q2,  #9    // (64 - my2) << 9
         vshl.s16        q13, q3,  #9
 .if \type == 444
         vmovn.u16       d4,  q2         // 64 - my2
         vmovn.u16       d5,  q3
         vsub.i8         q2,  q15, q2    // my2
-        vst1.8          {d4,  d5},  [r10]!
+        vst1.8          {d4,  d5},  [lr,  :128]!
 .elseif \type == 422
         vpadd.s16       d4,  d4,  d5    // (64 - my2) + (64 - ny2) (column wise addition)
         vpadd.s16       d5,  d6,  d7
         vmovn.s16       d4,  q2
         vhsub.u8        d4,  d30, d4    // ((129 - sign) - ((64 - my2) + (64 - ny2))) >> 1
-        vst1.8          {d4},  [r10]!
+        vst1.8          {d4},  [lr,  :64]!
 .elseif \type == 420
         vadd.s16        q10, q10, q2    // (64 - my1) + (64 - my2) (row wise addition)
         vadd.s16        q11, q11, q3
         vpadd.s16       d20, d20, d21   // (128 - m) + (128 - n) (column wise addition)
         vpadd.s16       d21, d22, d23
         vsub.s16        q10, q15, q10   // (256 - sign) - ((128 - m) + (128 - n))
         vrshrn.u16      d20, q10, #2    // ((256 - sign) - ((128 - m) + (128 - n)) + 2) >> 2
-        vst1.8          {d20}, [r6]!
+        vst1.8          {d20}, [r6,  :64]!
 .endif
         vqdmulh.s16     q12, q12, q0    // ((tmp2y2 - tmp1y2) * (64 - my2) << 9) >> 15
         vqdmulh.s16     q13, q13, q1
         vadd.i16        q12, q12, q8    // (((tmp2y2 - tmp1y2) * (64 - my2) << 9) >> 15) + tmp1y2
         vadd.i16        q13, q13, q9
         vqrshrun.s16    d24, q12, #4    // (((((tmp2y2 - tmp1y2)*(64 - my2) << 9) >> 15) + tmp1y2) + 8) >> 4
         vqrshrun.s16    d25, q13, #4
-        vst1.16         {d24, d25}, [r12]!   // store dsty2
+        vst1.16         {d24, d25}, [r12, :128]!   // store dsty2
         bgt             16b
         subs            r5,  r5,  #2
         add             r2,  r2,  r4,  lsl #1
         add             r3,  r3,  r4,  lsl #1
         add             r7,  r7,  r4,  lsl #1
         add             r9,  r9,  r4,  lsl #1
 .if \type == 444
         add             r6,  r6,  r4
-        add             r10, r10, r4
+        add             lr,  lr,  r4
 .elseif \type == 422
         add             r6,  r6,  r4,  lsr #1
-        add             r10, r10, r4,  lsr #1
+        add             lr,  lr,  r4,  lsr #1
 .endif
         add             r0,  r0,  r1
         add             r12, r12, r1
         bgt             161b
-        pop             {r4-r10,pc}
+        pop             {r4-r9,pc}
 endfunc
 .endm
 
 w_mask_fn 444
 w_mask_fn 422
 w_mask_fn 420
 
 
 function blend_8bpc_neon, export=1
-        push            {r4-r8,lr}
-        ldr             r4,  [sp, #24]
-        ldr             r5,  [sp, #28]
-        clz             r6,  r3
-        adr             r7,  L(blend_tbl)
-        sub             r6,  r6,  #26
-        ldr             r6,  [r7, r6, lsl #2]
-        add             r7,  r7,  r6
-        bx              r7
+        push            {r4-r5,lr}
+        ldr             r4,  [sp, #12]
+        ldr             r5,  [sp, #16]
+        clz             lr,  r3
+        adr             r3,  L(blend_tbl)
+        sub             lr,  lr,  #26
+        ldr             lr,  [r3, lr, lsl #2]
+        add             r3,  r3,  lr
+        bx              r3
+
         .align 2
 L(blend_tbl):
         .word 320f  - L(blend_tbl) + CONFIG_THUMB
         .word 160f  - L(blend_tbl) + CONFIG_THUMB
         .word 80f   - L(blend_tbl) + CONFIG_THUMB
         .word 40f   - L(blend_tbl) + CONFIG_THUMB
 
 40:
         vmov.i8         d22, #64
         add             r12, r0,  r1
         lsl             r1,  r1,  #1
 4:
-        vld1.32         {d2[]},   [r5],  r3
-        vld1.32         {d1[]},   [r2],  r3
-        vld1.32         {d0[]},   [r0]
+        vld1.u8         {d2},     [r5,  :64]!
+        vld1.u8         {d1},     [r2,  :64]!
+        vld1.32         {d0[]},   [r0,  :32]
         subs            r4,  r4,  #2
-        vld1.32         {d2[1]},  [r5],  r3
-        vld1.32         {d1[1]},  [r2],  r3
-        vld1.32         {d0[1]},  [r12]
+        vld1.32         {d0[1]},  [r12, :32]
         vsub.i8         d3,  d22, d2
         vmull.u8        q8,  d1,  d2
         vmlal.u8        q8,  d0,  d3
         vrshrn.i16      d20, q8,  #6
-        vst1.32         {d20[0]}, [r0],  r1
-        vst1.32         {d20[1]}, [r12], r1
+        vst1.32         {d20[0]}, [r0,  :32], r1
+        vst1.32         {d20[1]}, [r12, :32], r1
         bgt             4b
-        pop             {r4-r8,pc}
+        pop             {r4-r5,pc}
 80:
         vmov.i8         d16, #64
         add             r12, r0,  r1
         lsl             r1,  r1,  #1
 8:
-        vld1.u8         {d2},  [r5],  r3
-        vld1.u8         {d4},  [r2],  r3
-        vld1.u8         {d0},  [r0]
+        vld1.u8         {q1},  [r5,  :128]!
+        vld1.u8         {q2},  [r2,  :128]!
+        vld1.u8         {d0},  [r0,  :64]
         vsub.i8         d17, d16, d2
-        vld1.u8         {d3},  [r5],  r3
-        vld1.u8         {d5},  [r2],  r3
-        vld1.u8         {d1},  [r12]
+        vld1.u8         {d1},  [r12, :64]
         subs            r4,  r4,  #2
         vsub.i8         d18, d16, d3
         vmull.u8        q3,  d2,  d4
         vmlal.u8        q3,  d0,  d17
         vmull.u8        q10, d3,  d5
         vmlal.u8        q10, d1,  d18
         vrshrn.i16      d22, q3,  #6
         vrshrn.i16      d23, q10, #6
-        vst1.u8         {d22}, [r0],  r1
-        vst1.u8         {d23}, [r12], r1
+        vst1.u8         {d22}, [r0,  :64], r1
+        vst1.u8         {d23}, [r12, :64], r1
         bgt             8b
-        pop             {r4-r8,pc}
+        pop             {r4-r5,pc}
 160:
         vmov.i8         q12, #64
         add             r12, r0,  r1
         lsl             r1,  r1,  #1
 16:
-        vld1.u8         {q2},  [r5],  r3
-        vld1.u8         {q1},  [r2],  r3
-        vld1.u8         {q0},  [r0]
+        vld1.u8         {q1,  q2},  [r5,  :128]!
+        vld1.u8         {q8,  q9},  [r2,  :128]!
+        vld1.u8         {q0},  [r0,  :128]
         subs            r4,  r4,  #2
-        vsub.i8         q11, q12, q2
-        vld1.u8         {q15}, [r5],  r3
-        vld1.u8         {q14}, [r2],  r3
-        vld1.u8         {q13}, [r12]
-        vmull.u8        q3,  d2,  d4
-        vmlal.u8        q3,  d0,  d22
-        vmull.u8        q8,  d3,  d5
-        vmlal.u8        q8,  d1,  d23
-        vsub.i8         q11, q12, q15
-        vrshrn.i16      d18, q3,  #6
-        vrshrn.i16      d19, q8,  #6
-        vmull.u8        q3,  d28, d30
-        vmlal.u8        q3,  d26, d22
-        vmull.u8        q8,  d29, d31
-        vmlal.u8        q8,  d27, d23
+        vsub.i8         q15, q12, q1
+        vld1.u8         {q13}, [r12, :128]
+        vmull.u8        q3,  d16, d2
+        vmlal.u8        q3,  d0,  d30
+        vmull.u8        q14, d17, d3
+        vmlal.u8        q14, d1,  d31
+        vsub.i8         q15, q12, q2
         vrshrn.i16      d20, q3,  #6
-        vrshrn.i16      d21, q8,  #6
-        vst1.u8         {q9},  [r0],  r1
-        vst1.u8         {q10}, [r12], r1
+        vrshrn.i16      d21, q14, #6
+        vmull.u8        q3,  d18, d4
+        vmlal.u8        q3,  d26, d30
+        vmull.u8        q14, d19, d5
+        vmlal.u8        q14, d27, d31
+        vrshrn.i16      d22, q3,  #6
+        vrshrn.i16      d23, q14, #6
+        vst1.u8         {q10}, [r0,  :128], r1
+        vst1.u8         {q11}, [r12, :128], r1
         bgt             16b
-        pop             {r4-r8,pc}
-
+        pop             {r4-r5,pc}
 320:
         vmov.i8         q10, #64
 32:
-        vld1.u8         {q2, q3},  [r5],  r3
-        vld1.u8         {q8, q9},  [r2],  r3
-        vld1.u8         {q0, q1},  [r0]
+        vld1.u8         {q2,  q3},  [r5,  :128]!
+        vld1.u8         {q8,  q9},  [r2,  :128]!
+        vld1.u8         {q0,  q1},  [r0,  :128]
         subs            r4,  r4,  #1
         vsub.i8         q11, q10, q2
         vmull.u8        q15, d16, d4
         vmlal.u8        q15, d0,  d22
         vmull.u8        q14, d17, d5
         vmlal.u8        q14, d1,  d23
         vsub.i8         q11, q10, q3
         vrshrn.i16      d24, q15, #6
         vrshrn.i16      d25, q14, #6
         vmull.u8        q15, d18, d6
         vmlal.u8        q15, d2,  d22
         vmull.u8        q14, d19, d7
         vmlal.u8        q14, d3,  d23
         vrshrn.i16      d26, q15, #6
         vrshrn.i16      d27, q14, #6
-        vst1.u8         {q12, q13}, [r0],  r1
+        vst1.u8         {q12, q13}, [r0,  :128],  r1
         bgt             32b
-        pop             {r4-r8,pc}
+        pop             {r4-r5,pc}
 endfunc
 
 function blend_h_8bpc_neon, export=1
         push            {r4-r8,lr}
         ldr             r4,  [sp, #24]
         movrel          r5,  X(obmc_masks)
         add             r5,  r5,  r4
         sub             r4,  r4,  r4,  lsr #2
         clz             r6,  r3
         adr             r7,  L(blend_h_tbl)
         sub             r6,  r6,  #24
         ldr             r6,  [r7, r6, lsl #2]
         add             r7,  r7,  r6
         bx              r7
+
         .align 2
 L(blend_h_tbl):
         .word 1280f  - L(blend_h_tbl) + CONFIG_THUMB
         .word 640f   - L(blend_h_tbl) + CONFIG_THUMB
         .word 320f   - L(blend_h_tbl) + CONFIG_THUMB
         .word 160f   - L(blend_h_tbl) + CONFIG_THUMB
         .word 80f    - L(blend_h_tbl) + CONFIG_THUMB
         .word 40f    - L(blend_h_tbl) + CONFIG_THUMB
         .word 20f    - L(blend_h_tbl) + CONFIG_THUMB
 
 20:
         vmov.i8         d22, #64
         add             r12, r0,  r1
         lsl             r1,  r1,  #1
 2:
-        vld1.16         {d2[], d3[]},  [r5]!
-        vld1.16         {d1[]},  [r2],  r3
+        vld1.16         {d2[], d3[]},  [r5,  :16]!
+        vld1.32         {d1[0]},  [r2,  :32]!
         subs            r4,  r4,  #2
-        vld1.16         {d0[]},  [r0]
+        vld1.16         {d0[]},   [r0,  :16]
         vzip.8          d2,  d3
-        vld1.16         {d1[1]}, [r2],  r3
         vsub.i8         d4,  d22, d2
-        vld1.16         {d0[1]}, [r12]
+        vld1.16         {d0[1]},  [r12, :16]
         vmull.u8        q8,  d1,  d2
         vmlal.u8        q8,  d0,  d4
         vrshrn.i16      d20, q8,  #6
-        vst1.16         {d20[0]}, [r0],  r1
-        vst1.16         {d20[1]}, [r12], r1
+        vst1.16         {d20[0]}, [r0,  :16], r1
+        vst1.16         {d20[1]}, [r12, :16], r1
         bgt             2b
         pop             {r4-r8,pc}
 40:
         vmov.i8         d22, #64
         add             r12, r0,  r1
         lsl             r1,  r1,  #1
 4:
-        vld1.u8         {d2[]},  [r5]!
-        vld1.32         {d1[]},  [r2],  r3
+        vld2.u8         {d2[],  d3[]},   [r5,  :16]!
+        vld1.u8         {d1},     [r2,  :64]!
         subs            r4,  r4,  #2
-        vld1.u8         {d6[]},  [r5]!
-        vld1.32         {d1[1]}, [r2],  r3
-        vext.u8         d2,  d2,  d6,   #4
-        vld1.32         {d0[]},  [r0]
-        vsub.i8         d3,  d22, d2
-        vld1.32         {d0[1]}, [r12]
+        vext.u8         d2,  d2,  d3,   #4
+        vld1.32         {d0[]},   [r0,  :32]
+        vsub.i8         d6,  d22, d2
+        vld1.32         {d0[1]},  [r12, :32]
         vmull.u8        q8,  d1,  d2
-        vmlal.u8        q8,  d0,  d3
+        vmlal.u8        q8,  d0,  d6
         vrshrn.i16      d20, q8,  #6
-        vst1.32         {d20[0]}, [r0],  r1
-        vst1.32         {d20[1]}, [r12], r1
+        vst1.32         {d20[0]}, [r0,  :32], r1
+        vst1.32         {d20[1]}, [r12, :32], r1
         bgt             4b
         pop             {r4-r8,pc}
 80:
-        vmov.i8         d16, #64
+        vmov.i8         q8, #64
         add             r12, r0,  r1
         lsl             r1,  r1,  #1
 8:
-        vld1.u8         {d2[]}, [r5]!
-        vld1.u8         {d4},   [r2],  r3
-        vld1.u8         {d0},   [r0]
-        vsub.i8         d17, d16, d2
-        vld1.u8         {d3[]}, [r5]!
-        vld1.u8         {d5},   [r2],  r3
-        vld1.u8         {d1},   [r12]
+        vld2.u8         {d2[],  d3[]},  [r5,  :16]!
+        vld1.u8         {d4,  d5},  [r2,  :128]!
+        vld1.u8         {d0},   [r0,  :64]
+        vsub.i8         q9,  q8,  q1
+        vld1.u8         {d1},   [r12, :64]
         subs            r4,  r4,  #2
-        vsub.i8         d18, d16, d3
         vmull.u8        q3,  d2,  d4
-        vmlal.u8        q3,  d0,  d17
+        vmlal.u8        q3,  d0,  d18
         vmull.u8        q10, d3,  d5
-        vmlal.u8        q10, d1,  d18
+        vmlal.u8        q10, d1,  d19
         vrshrn.i16      d22, q3,  #6
         vrshrn.i16      d23, q10, #6
-        vst1.u8         {d22}, [r0],  r1
-        vst1.u8         {d23}, [r12], r1
+        vst1.u8         {d22}, [r0,  :64], r1
+        vst1.u8         {d23}, [r12, :64], r1
         bgt             8b
         pop             {r4-r8,pc}
 160:
-        vmov.i8         d24, #64
+        vmov.i8         q12, #64
         add             r12, r0,  r1
         lsl             r1,  r1,  #1
 16:
-        vld1.u8         {d4[]},  [r5]!
-        vld1.u8         {q1},    [r2],  r3
-        vsub.i8         d5,  d24, d4
-        vld1.u8         {q0},    [r0]
+        vld2.u8         {d28[], d29[]}, [r5,  :16]!
+        vld1.u8         {d2,  d3,  d4,  d5},  [r2,  :128]!
+        vsub.i8         q15, q12, q14
+        vld1.u8         {q0},  [r0,  :128]
         subs            r4,  r4,  #2
-        vld1.u8         {d30[]}, [r5]!
-        vld1.u8         {q14},   [r2],  r3
-        vsub.i8         d31, d24, d30
-        vld1.u8         {q13},   [r12]
-        vmull.u8        q3,  d2,  d4
-        vmlal.u8        q3,  d0,  d5
-        vmull.u8        q8,  d3,  d4
-        vmlal.u8        q8,  d1,  d5
+        vld1.u8         {q13}, [r12, :128]
+        vmull.u8        q3,  d2,  d28
+        vmlal.u8        q3,  d0,  d30
+        vmull.u8        q8,  d3,  d28
+        vmlal.u8        q8,  d1,  d30
         vrshrn.i16      d18, q3,  #6
         vrshrn.i16      d19, q8,  #6
-        vmull.u8        q3,  d28, d30
+        vmull.u8        q3,  d4,  d29
         vmlal.u8        q3,  d26, d31
-        vmull.u8        q8,  d29, d30
+        vmull.u8        q8,  d5,  d29
         vmlal.u8        q8,  d27, d31
         vrshrn.i16      d20, q3,  #6
         vrshrn.i16      d21, q8,  #6
-        vst1.u8         {q9},  [r0],  r1
-        vst1.u8         {q10}, [r12], r1
+        vst1.u8         {q9},  [r0,  :128], r1
+        vst1.u8         {q10}, [r12, :128], r1
         bgt             16b
         pop             {r4-r8,pc}
 320:
 640:
 1280:
         vmov.i8         d20, #64
         sub             r1,  r1,  r3
 321:
-        vld1.u8         {d6[]}, [r5]!
+        vld1.u8         {d6[]},  [r5]!
         vsub.i8         d7,  d20, d6
         mov             r8,  r3
 32:
-        vld1.u8         {q8, q9}, [r2]!
-        vld1.u8         {q0, q1}, [r0]
+        vld1.u8         {q8,  q9},  [r2,  :128]!
+        vld1.u8         {q0,  q1},  [r0,  :128]
         vmull.u8        q15, d16, d6
         vmlal.u8        q15, d0,  d7
         vmull.u8        q14, d17, d6
         vmlal.u8        q14, d1,  d7
         vrshrn.i16      d0,  q15, #6
         vrshrn.i16      d1,  q14, #6
         vmull.u8        q15, d18, d6
         vmlal.u8        q15, d2,  d7
         vmull.u8        q14, d19, d6
         vmlal.u8        q14, d3,  d7
         vrshrn.i16      d2,  q15, #6
         vrshrn.i16      d3,  q14, #6
-        vst1.u8         {q0, q1}, [r0]!
+        vst1.u8         {q0,  q1},  [r0,  :128]!
         subs            r8,  r8,  #32
         bgt             32b
         add             r0,  r0,  r1
         subs            r4,  r4,  #1
         bgt             321b
         pop             {r4-r8,pc}
 endfunc
 
 function blend_v_8bpc_neon, export=1
-        push            {r4-r8,lr}
-        ldr             r4,  [sp, #24]
+        push            {r4-r5,lr}
+        ldr             r4,  [sp, #12]
         movrel          r5,  X(obmc_masks)
         add             r5,  r5,  r3
-        clz             r8,  r3
-        adr             r7,  L(blend_v_tbl)
-        sub             r8,  r8,  #26
-        ldr             r8,  [r7, r8, lsl #2]
-        add             r7,  r7,  r8
-        bx              r7
+        clz             lr,  r3
+        adr             r3,  L(blend_v_tbl)
+        sub             lr,  lr,  #26
+        ldr             lr,  [r3, lr, lsl #2]
+        add             r3,  r3,  lr
+        bx              r3
+
         .align 2
 L(blend_v_tbl):
         .word 320f  - L(blend_v_tbl) + CONFIG_THUMB
         .word 160f  - L(blend_v_tbl) + CONFIG_THUMB
         .word 80f   - L(blend_v_tbl) + CONFIG_THUMB
         .word 40f   - L(blend_v_tbl) + CONFIG_THUMB
         .word 20f   - L(blend_v_tbl) + CONFIG_THUMB
 
 20:
         vmov.i8         d22, #64
-        vld1.8          {d2[]},  [r5]
+        vld1.8          {d2[]},   [r5]
         add             r12, r0,  r1
         lsl             r1,  r1,  #1
         vsub.i8         d3,  d22, d2
 2:
-        vld1.8          {d1[]},  [r2],  r3
-        vld1.8          {d0[]},  [r0]
+        vld1.16         {d1[0]},  [r2,  :16]!
+        vld1.8          {d0[]},   [r0]
         subs            r4,  r4,  #2
-        vld1.8          {d1[1]}, [r2],  r3
-        vld1.8          {d0[1]}, [r12]
+        vld1.8          {d1[1]},  [r2]
+        vld1.8          {d0[1]},  [r12]
         vmull.u8        q2,  d1,  d2
         vmlal.u8        q2,  d0,  d3
         vrshrn.i16      d6,  q2,  #6
-        vst1.8          {d6[0]}, [r0],  r1
-        vst1.8          {d6[1]}, [r12], r1
+        add             r2,  r2,  #2
+        vst1.8          {d6[0]},  [r0],  r1
+        vst1.8          {d6[1]},  [r12], r1
         bgt             2b
-        pop             {r4-r8,pc}
+        pop             {r4-r5,pc}
 40:
         vmov.i8         d22, #64
-        vld1.32         {d4[]},  [r5]
+        vld1.32         {d4[]},   [r5,  :32]
         add             r12, r0,  r1
         lsl             r1,  r1,  #1
         vsub.i8         d5,  d22, d4
         sub             r1,  r1,  #3
 4:
-        vld1.32         {d2[]},  [r2],  r3
-        vld1.32         {d0[]},  [r0]
-        vld1.32         {d2[1]}, [r2],  r3
-        vld1.32         {d0[1]}, [r12]
+        vld1.u8         {d2},     [r2,  :64]!
+        vld1.32         {d0[]},   [r0,  :32]
+        vld1.32         {d0[1]},  [r12, :32]
         subs            r4,  r4,  #2
         vmull.u8        q3,  d2,  d4
         vmlal.u8        q3,  d0,  d5
         vrshrn.i16      d20, q3,  #6
-        vst1.16         {d20[0]}, [r0]!
-        vst1.16         {d20[2]}, [r12]!
+        vst1.16         {d20[0]}, [r0,  :16]!
+        vst1.16         {d20[2]}, [r12, :16]!
         vst1.8          {d20[2]}, [r0]!
         vst1.8          {d20[6]}, [r12]!
         add             r0,  r0,  r1
         add             r12, r12, r1
         bgt             4b
-        pop             {r4-r8,pc}
+        pop             {r4-r5,pc}
 80:
         vmov.i8         d16, #64
-        vld1.u8         {d2}, [r5]
+        vld1.u8         {d2},  [r5,  :64]
         add             r12, r0,  r1
         lsl             r1,  r1,  #1
         vsub.i8         d17, d16, d2
         sub             r1,  r1,  #6
 8:
-        vld1.u8         {d4},  [r2],  r3
-        vld1.u8         {d0},  [r0]
-        vld1.u8         {d5},  [r2],  r3
-        vld1.u8         {d1},  [r12]
+        vld1.u8         {d4,  d5},  [r2,  :128]!
+        vld1.u8         {d0},  [r0,  :64]
+        vld1.u8         {d1},  [r12, :64]
         subs            r4,  r4,  #2
         vmull.u8        q3,  d2,  d4
         vmlal.u8        q3,  d0,  d17
         vmull.u8        q10, d2,  d5
         vmlal.u8        q10, d1,  d17
         vrshrn.i16      d22, q3,  #6
         vrshrn.i16      d23, q10, #6
-        vst1.32         {d22[0]}, [r0]!
-        vst1.32         {d23[0]}, [r12]!
-        vst1.16         {d22[2]}, [r0]!
-        vst1.16         {d23[2]}, [r12]!
+        vst1.32         {d22[0]}, [r0,  :32]!
+        vst1.32         {d23[0]}, [r12, :32]!
+        vst1.16         {d22[2]}, [r0,  :16]!
+        vst1.16         {d23[2]}, [r12, :16]!
         add             r0,  r0,  r1
         add             r12, r12, r1
         bgt             8b
-        pop             {r4-r8,pc}
+        pop             {r4-r5,pc}
 160:
         vmov.i8         q12, #64
-        vld1.u8         {q2},  [r5]
+        vld1.u8         {q14}, [r5,  :128]
         add             r12, r0,  r1
         lsl             r1,  r1,  #1
-        vsub.i8         q11, q12, q2
+        vsub.i8         q11, q12, q14
         sub             r1,  r1,  #12
 16:
-        vld1.u8         {q1},  [r2],  r3
-        vld1.u8         {q0},  [r0]
+        vld1.u8         {q1,  q2},  [r2,  :128]!
+        vld1.u8         {q0},  [r0,  :128]
         subs            r4,  r4,  #2
-        vld1.u8         {q14}, [r2],  r3
-        vld1.u8         {q13}, [r12]
-        vmull.u8        q3,  d2,  d4
+        vld1.u8         {q13}, [r12, :128]
+        vmull.u8        q3,  d2,  d28
         vmlal.u8        q3,  d0,  d22
-        vmull.u8        q8,  d3,  d5
+        vmull.u8        q8,  d3,  d29
         vmlal.u8        q8,  d1,  d23
         vrshrn.i16      d18, q3,  #6
         vrshrn.i16      d19, q8,  #6
-        vmull.u8        q3,  d28, d4
+        vmull.u8        q3,  d4,  d28
         vmlal.u8        q3,  d26, d22
-        vmull.u8        q8,  d29, d5
+        vmull.u8        q8,  d5,  d29
         vmlal.u8        q8,  d27, d23
         vrshrn.i16      d20, q3,  #6
         vrshrn.i16      d21, q8,  #6
-        vst1.u8         {d18},    [r0]!
-        vst1.u8         {d20},    [r12]!
-        vst1.32         {d19[0]}, [r0]!
-        vst1.32         {d21[0]}, [r12]!
+        vst1.u8         {d18},    [r0,  :64]!
+        vst1.u8         {d20},    [r12, :64]!
+        vst1.32         {d19[0]}, [r0,  :32]!
+        vst1.32         {d21[0]}, [r12, :32]!
         add             r0,  r0,  r1
         add             r12, r12, r1
         bgt             16b
-        pop             {r4-r8,pc}
+        pop             {r4-r5,pc}
 320:
         vmov.i8         q10, #64
-        vld1.u8         {q2, q3},  [r5]
+        vld1.u8         {q2,  q3},  [r5,  :128]
         vsub.i8         q11, q10, q2
         vsub.i8         q12, q10, q3
 32:
-        vld1.u8         {q8, q9},  [r2],  r3
-        vld1.u8         {q0, q1},  [r0]
+        vld1.u8         {q8,  q9},  [r2,  :128]!
+        vld1.u8         {q0,  q1},  [r0,  :128]
         subs            r4,  r4,  #1
         vmull.u8        q15, d16, d4
         vmlal.u8        q15, d0,  d22
         vmull.u8        q14, d17, d5
         vmlal.u8        q14, d1,  d23
         vrshrn.i16      d0,  q15, #6
         vrshrn.i16      d1,  q14, #6
         vmull.u8        q15, d18, d6
         vmlal.u8        q15, d2,  d24
         vrshrn.i16      d2,  q15, #6
-        vst1.u8         {d0, d1, d2}, [r0], r1
+        vst1.u8         {d0,  d1,  d2},  [r0,  :64],  r1
         bgt             32b
-        pop             {r4-r8,pc}
+        pop             {r4-r5,pc}
 endfunc
 
 
 // This has got the same signature as the put_8tap functions,
 // assumes that the caller has loaded the h argument into r5,
 // and assumes that r8 is set to (clz(w)-24).
 function put_neon
         adr             r9,  L(put_tbl)
--- a/third_party/dav1d/src/arm/64/itx.S
+++ b/third_party/dav1d/src/arm/64/itx.S
@@ -93,17 +93,18 @@ const idct64_coeffs, align=4
 
         .short          4085*8, -301*8, 2675*8, 3102*8
         .short          3659*8, -1842*8, 1285*8, 3889*8
         .short          -3920, -1189, -3406, -2276
         .short          0, 0, 0, 0
 endconst
 
 const iadst4_coeffs, align=4
-        .short          1321, 3803, 2482, 3344, 3344*8
+        // .h[4-5] can be interpreted as .s[2]
+        .short          1321, 3803, 2482, 3344, 3344, 0
 endconst
 
 const iadst8_coeffs, align=4
         .short          4076, 401, 3612, 1931
         .short          2598, 3166, 1189, 3920
         // idct_coeffs
         .short          2896, 2896*8, 1567, 3784, 0, 0, 0, 0
 endconst
@@ -142,16 +143,37 @@ endconst
 
 .macro rshrn_sz d0, s0, s1, shift, sz
         rshrn           \d0\().4h, \s0\().4s, \shift
 .ifc \sz, .8h
         rshrn2          \d0\().8h, \s1\().4s, \shift
 .endif
 .endm
 
+.macro saddl_sz d0, d1, s0, s1, sz
+        saddl           \d0\().4s,  \s0\().4h,  \s1\().4h
+.ifc \sz, .8h
+        saddl2          \d1\().4s,  \s0\().8h,  \s1\().8h
+.endif
+.endm
+
+.macro ssubl_sz d0, d1, s0, s1, sz
+        ssubl           \d0\().4s,  \s0\().4h,  \s1\().4h
+.ifc \sz, .8h
+        ssubl2          \d1\().4s,  \s0\().8h,  \s1\().8h
+.endif
+.endm
+
+.macro mul_4s_sz d0, d1, s0, s1, c, sz
+        mul             \d0\().4s,  \s0\().4s,  \c
+.ifc \sz, .8h
+        mul             \d1\().4s,  \s1\().4s,  \c
+.endif
+.endm
+
 .macro scale_input sz, c, r0, r1, r2 r3, r4, r5, r6, r7
         sqrdmulh        \r0\sz,  \r0\sz,  \c
         sqrdmulh        \r1\sz,  \r1\sz,  \c
         sqrdmulh        \r2\sz,  \r2\sz,  \c
         sqrdmulh        \r3\sz,  \r3\sz,  \c
 .ifnb \r4
         sqrdmulh        \r4\sz,  \r4\sz,  \c
         sqrdmulh        \r5\sz,  \r5\sz,  \c
@@ -494,33 +516,34 @@ function inv_dct_8x4_neon
         idct_4          v16, v17, v18, v19, .8h
         ret
 endfunc
 
 .macro iadst_4x4 o0, o1, o2, o3
         movrel          x16, iadst4_coeffs
         ld1             {v0.8h}, [x16]
 
-        sub             v3.4h,   v16.4h,  v18.4h
+        ssubl           v3.4s,   v16.4h,  v18.4h
         smull           v4.4s,   v16.4h,  v0.h[0]
         smlal           v4.4s,   v18.4h,  v0.h[1]
         smlal           v4.4s,   v19.4h,  v0.h[2]
         smull           v7.4s,   v17.4h,  v0.h[3]
-        add             v3.4h,   v3.4h,   v19.4h
+        saddw           v3.4s,   v3.4s,   v19.4h
         smull           v5.4s,   v16.4h,  v0.h[2]
         smlsl           v5.4s,   v18.4h,  v0.h[0]
         smlsl           v5.4s,   v19.4h,  v0.h[1]
 
         add             \o3\().4s, v4.4s,     v5.4s
-        sqrdmulh        \o2\().4h, v3.4h,     v0.h[4]
+        mul             \o2\().4s, v3.4s,     v0.s[2]
         add             \o0\().4s, v4.4s,     v7.4s
         add             \o1\().4s, v5.4s,     v7.4s
         sub             \o3\().4s, \o3\().4s, v7.4s
 
         rshrn           \o0\().4h, \o0\().4s, #12
+        rshrn           \o2\().4h, \o2\().4s, #12
         rshrn           \o1\().4h, \o1\().4s, #12
         rshrn           \o3\().4h, \o3\().4s, #12
 .endm
 
 function inv_adst_4x4_neon
         iadst_4x4       v16, v17, v18, v19
         ret
 endfunc
@@ -529,48 +552,54 @@ function inv_flipadst_4x4_neon
         iadst_4x4       v19, v18, v17, v16
         ret
 endfunc
 
 .macro iadst_8x4 o0, o1, o2, o3
         movrel          x16, iadst4_coeffs
         ld1             {v0.8h}, [x16]
 
-        sub             v3.8h,   v16.8h,  v18.8h
+        ssubl           v2.4s,   v16.4h,  v18.4h
+        ssubl2          v3.4s,   v16.8h,  v18.8h
         smull           v4.4s,   v16.4h,  v0.h[0]
         smlal           v4.4s,   v18.4h,  v0.h[1]
         smlal           v4.4s,   v19.4h,  v0.h[2]
         smull2          v5.4s,   v16.8h,  v0.h[0]
         smlal2          v5.4s,   v18.8h,  v0.h[1]
         smlal2          v5.4s,   v19.8h,  v0.h[2]
-        add             v3.8h,   v3.8h,   v19.8h
+        saddw           v2.4s,   v2.4s,   v19.4h
+        saddw2          v3.4s,   v3.4s,   v19.8h
         smull           v6.4s,   v16.4h,  v0.h[2]
         smlsl           v6.4s,   v18.4h,  v0.h[0]
         smlsl           v6.4s,   v19.4h,  v0.h[1]
         smull2          v7.4s,   v16.8h,  v0.h[2]
         smlsl2          v7.4s,   v18.8h,  v0.h[0]
         smlsl2          v7.4s,   v19.8h,  v0.h[1]
 
-        sqrdmulh        v18.8h,  v3.8h,   v0.h[4]
+        mul             v18.4s,  v2.4s,   v0.s[2]
+        mul             v19.4s,  v3.4s,   v0.s[2]
 
         smull           v2.4s,   v17.4h,  v0.h[3]
         smull2          v3.4s,   v17.8h,  v0.h[3]
 
         add             v16.4s,  v4.4s,   v2.4s // out0
         add             v17.4s,  v5.4s,   v3.4s
 
         add             v4.4s,   v4.4s,   v6.4s // out3
         add             v5.4s,   v5.4s,   v7.4s
 
         add             v6.4s,   v6.4s,   v2.4s // out1
         add             v7.4s,   v7.4s,   v3.4s
 
         sub             v4.4s,   v4.4s,   v2.4s // out3
         sub             v5.4s,   v5.4s,   v3.4s
 
+        rshrn           v18.4h,  v18.4s, #12
+        rshrn2          v18.8h,  v19.4s, #12
+
         rshrn           \o0\().4h, v16.4s, #12
         rshrn2          \o0\().8h, v17.4s, #12
 
 .ifc \o2, v17
         mov             v17.16b,   v18.16b
 .endif
 
         rshrn           \o1\().4h, v6.4s,  #12
@@ -831,26 +860,35 @@ endfunc
         sqneg           \o7\()\sz, \o7\()\sz     // out7
 
         sqadd           \o1\()\sz, v3\sz, v7\sz  // out1
         sqsub           v3\sz,     v3\sz, v7\sz  // t6
         sqadd           \o6\()\sz, v5\sz, v19\sz // out6
         sqsub           v5\sz,     v5\sz, v19\sz // t7
         sqneg           \o1\()\sz, \o1\()\sz     // out1
 
-        add             v6\sz,   v2\sz,   v4\sz
-        sub             v7\sz,   v2\sz,   v4\sz
-        add             v4\sz,   v3\sz,   v5\sz
-        sub             v5\sz,   v3\sz,   v5\sz
-        sqrdmulh        \o3\sz,  v6\sz,   v1.h[1] // out3
-        sqrdmulh        \o4\sz,  v7\sz,   v1.h[1] // out4
-        sqrdmulh        \o2\sz,  v4\sz,   v1.h[1] // out2
-        sqrdmulh        \o5\sz,  v5\sz,   v1.h[1] // out5
-        neg             \o3\()\sz, \o3\()\sz     // out3
-        neg             \o5\()\sz, \o5\()\sz     // out5
+        movi            v0.4s,  #2896>>4
+
+        saddl_sz        v18, v19, v2,  v4,  \sz // -> out3 (v19 or v20)
+        ssubl_sz        v6,  v7,  v2,  v4,  \sz // -> out4 (v20 or v19)
+        ssubl_sz        v20, v21, v3,  v5,  \sz // -> out5 (v21 or v18)
+        saddl_sz        v4,  v5,  v3,  v5,  \sz // -> out2 (v18 or v21)
+
+        mul_4s_sz       v18, v19, v18, v19, v0.s[0], \sz
+        mul_4s_sz       v6,  v7,  v6,  v7,  v0.s[0], \sz
+        mul_4s_sz       v20, v21, v20, v21, v0.s[0], \sz
+        mul_4s_sz       v4,  v5,  v4,  v5,  v0.s[0], \sz
+
+        rshrn_sz        v2,  v18, v19, #8,  \sz // out3
+        rshrn_sz        v3,  v20, v21, #8,  \sz // out5
+        rshrn_sz        \o2, v4,  v5,  #8,  \sz // out2 (v18 or v21)
+        rshrn_sz        \o4, v6,  v7,  #8,  \sz // out4 (v20 or v19)
+
+        sqneg           \o3\()\sz, v2\sz     // out3
+        sqneg           \o5\()\sz, v3\sz     // out5
 .endm
 
 function inv_adst_8x8_neon
         iadst_8         v16, v17, v18, v19, v20, v21, v22, v23, .8h
         ret
 endfunc
 
 function inv_flipadst_8x8_neon
@@ -1267,38 +1305,57 @@ endfunc
         sqneg           \o1\sz,  \o1\sz          // out1
 
         sqadd           \o3\sz,  v22\sz,  v24\sz // out3
         sqsub           v22\sz,  v22\sz,  v24\sz // t6
         sqadd           \o12\sz, v25\sz,  v23\sz // out12
         sqsub           v23\sz,  v25\sz,  v23\sz // t7
         sqneg           \o3\sz,  \o3\sz          // out3
 
-        sqsub           v24\sz,  v2\sz,   v21\sz // -> out8
-        sqadd           v2\sz,   v2\sz,   v21\sz // -> out7
-        sqadd           v21\sz,  v26\sz,  v3\sz  // -> out5
-        sqsub           v26\sz,  v26\sz,  v3\sz  // -> out10
-        sqadd           v3\sz,   v27\sz,  v20\sz // -> out6
-        sqsub           v25\sz,  v27\sz,  v20\sz // -> out9
-        sqadd           v20\sz,  v22\sz,  v23\sz // -> out4
-        sqsub           v27\sz,  v22\sz,  v23\sz // -> out11
-
-        sqrdmulh        v2\sz,   v2\sz,   v0.h[1] // out7
-        sqrdmulh        v4\sz,   v21\sz,  v0.h[1] // out5
-        sqrdmulh        v5\sz,   v25\sz,  v0.h[1] // out9
-        sqrdmulh        v6\sz,   v27\sz,  v0.h[1] // out11
-        sqrdmulh        \o6\sz,  v3\sz,   v0.h[1] // out6
-        sqrdmulh        \o8\sz,  v24\sz,  v0.h[1] // out8
-        sqrdmulh        \o10\sz, v26\sz,  v0.h[1] // out10
-        sqrdmulh        \o4\sz,  v20\sz,  v0.h[1] // out4
-
-        neg             \o7\sz,  v2\sz // out7
-        neg             \o5\sz,  v4\sz // out5
-        neg             \o9\sz,  v5\sz // out9
-        neg             \o11\sz, v6\sz // out11
+        movi            v0.4s,  #2896>>4
+
+        ssubl_sz        v24, v25, v2,  v21, \sz // -> out8 (v24 or v23)
+        saddl_sz        v4,  v5,  v2,  v21, \sz // -> out7 (v23 or v24)
+        saddl_sz        v6,  v7,  v26, v3,  \sz // -> out5 (v21 or v26)
+        ssubl_sz        v2,  v3,  v26, v3,  \sz // -> out10 (v26 or v21)
+
+        mul_4s_sz       v24, v25, v24, v25, v0.s[0], \sz
+        mul_4s_sz       v4,  v5,  v4,  v5,  v0.s[0], \sz
+        mul_4s_sz       v6,  v7,  v6,  v7,  v0.s[0], \sz
+        mul_4s_sz       v2,  v3,  v2,  v3,  v0.s[0], \sz
+
+        rshrn_sz        v24, v24, v25, #8,  \sz // out8
+        rshrn_sz        v4,  v4,  v5,  #8,  \sz // out7
+        rshrn_sz        v5,  v6,  v7,  #8,  \sz // out5
+        rshrn_sz        v26, v2,  v3,  #8,  \sz // out10
+
+        saddl_sz        v2,  v3,  v22, v23, \sz // -> out4 (v20 or v27)
+        ssubl_sz        v6,  v7,  v22, v23, \sz // -> out11 (v27 or v20)
+        saddl_sz        v22, v23, v27, v20, \sz // -> out6 (v22 or v25)
+        ssubl_sz        v21, v25, v27, v20, \sz // -> out9 (v25 or v22)
+
+        mul_4s_sz       v2,  v3,  v2,  v3,  v0.s[0], \sz
+        mul_4s_sz       v6,  v7,  v6,  v7,  v0.s[0], \sz
+        mul_4s_sz       v22, v23, v22, v23, v0.s[0], \sz
+        mul_4s_sz       v21, v25, v21, v25, v0.s[0], \sz
+
+        rshrn_sz        \o4, v2,  v3,  #8,  \sz // out4
+        rshrn_sz        v6,  v6,  v7,  #8,  \sz // out11
+        rshrn_sz        v7,  v21, v25, #8,  \sz // out9
+        rshrn_sz        \o6, v22, v23, #8,  \sz // out6
+
+.ifc \o8, v23
+        mov             \o8\szb,  v24\szb
+        mov             \o10\szb, v26\szb
+.endif
+
+        sqneg           \o7\sz,  v4\sz // out7
+        sqneg           \o5\sz,  v5\sz // out5
+        sqneg           \o11\sz, v6\sz // out11
+        sqneg           \o9\sz,  v7\sz // out9
 .endm
 
 function inv_adst_8x16_neon
         iadst_16        v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, .8h, .16b
         ret
 endfunc
 
 function inv_flipadst_8x16_neon
--- a/third_party/dav1d/src/arm/64/mc.S
+++ b/third_party/dav1d/src/arm/64/mc.S
@@ -229,16 +229,645 @@ L(\type\()_tbl):
 endfunc
 .endm
 
 bidir_fn avg
 bidir_fn w_avg
 bidir_fn mask
 
 
+.macro w_mask_fn type
+function w_mask_\type\()_8bpc_neon, export=1
+        clz             w8,  w4
+        adr             x9,  L(w_mask_\type\()_tbl)
+        sub             w8,  w8,  #24
+        ldrh            w8,  [x9,  x8,  lsl #1]
+        sub             x9,  x9,  w8,  uxtw
+        mov             w10, #6903
+        dup             v0.8h,   w10
+.if \type == 444
+        movi            v1.16b,  #64
+.elseif \type == 422
+        dup             v2.8b,   w7
+        movi            v3.8b,   #129
+        sub             v3.8b,   v3.8b,   v2.8b
+.elseif \type == 420
+        dup             v2.8h,   w7
+        movi            v3.8h,   #1, lsl #8
+        sub             v3.8h,   v3.8h,   v2.8h
+.endif
+        add             x12,  x0,  x1
+        lsl             x1,   x1,  #1
+        br              x9
+4:
+        ld1             {v4.8h,   v5.8h},   [x2],  #32  // tmp1 (four rows at once)
+        ld1             {v6.8h,   v7.8h},   [x3],  #32  // tmp2 (four rows at once)
+        subs            w5,  w5,  #4
+        sub             v16.8h,  v6.8h,   v4.8h
+        sub             v17.8h,  v7.8h,   v5.8h
+        sabd            v18.8h,  v4.8h,   v6.8h
+        sabd            v19.8h,  v5.8h,   v7.8h
+        uqsub           v18.8h,  v0.8h,   v18.8h
+        uqsub           v19.8h,  v0.8h,   v19.8h
+        ushr            v18.8h,  v18.8h,  #8
+        ushr            v19.8h,  v19.8h,  #8
+        shl             v20.8h,  v18.8h,  #9
+        shl             v21.8h,  v19.8h,  #9
+        sqdmulh         v20.8h,  v20.8h,  v16.8h
+        sqdmulh         v21.8h,  v21.8h,  v17.8h
+        add             v20.8h,  v20.8h,  v4.8h
+        add             v21.8h,  v21.8h,  v5.8h
+        sqrshrun        v22.8b,  v20.8h,  #4
+        sqrshrun        v23.8b,  v21.8h,  #4
+.if \type == 444
+        xtn             v18.8b,   v18.8h
+        xtn2            v18.16b,  v19.8h
+        sub             v18.16b,  v1.16b,  v18.16b
+        st1             {v18.16b}, [x6],  #16
+.elseif \type == 422
+        addp            v18.8h,   v18.8h,  v19.8h
+        xtn             v18.8b,   v18.8h
+        uhsub           v18.8b,   v3.8b,   v18.8b
+        st1             {v18.8b},  [x6],  #8
+.elseif \type == 420
+        trn1            v24.2d,   v18.2d,  v19.2d
+        trn2            v25.2d,   v18.2d,  v19.2d
+        add             v24.8h,   v24.8h,  v25.8h
+        addp            v18.8h,   v24.8h,  v24.8h
+        sub             v18.4h,   v3.4h,   v18.4h
+        rshrn           v18.8b,   v18.8h,  #2
+        st1             {v18.s}[0],  [x6],  #4
+.endif
+        st1             {v22.s}[0],  [x0],  x1
+        st1             {v22.s}[1],  [x12], x1
+        st1             {v23.s}[0],  [x0],  x1
+        st1             {v23.s}[1],  [x12], x1
+        b.gt            4b
+        ret
+8:
+        ld1             {v4.8h,   v5.8h},   [x2],  #32
+        ld1             {v6.8h,   v7.8h},   [x3],  #32
+        subs            w5,  w5,  #2
+        sub             v16.8h,  v6.8h,   v4.8h
+        sub             v17.8h,  v7.8h,   v5.8h
+        sabd            v18.8h,  v4.8h,   v6.8h
+        sabd            v19.8h,  v5.8h,   v7.8h
+        uqsub           v18.8h,  v0.8h,   v18.8h
+        uqsub           v19.8h,  v0.8h,   v19.8h
+        ushr            v18.8h,  v18.8h,  #8
+        ushr            v19.8h,  v19.8h,  #8
+        shl             v20.8h,  v18.8h,  #9
+        shl             v21.8h,  v19.8h,  #9
+        sqdmulh         v20.8h,  v20.8h,  v16.8h
+        sqdmulh         v21.8h,  v21.8h,  v17.8h
+        add             v20.8h,  v20.8h,  v4.8h
+        add             v21.8h,  v21.8h,  v5.8h
+        sqrshrun        v22.8b,  v20.8h,  #4
+        sqrshrun        v23.8b,  v21.8h,  #4
+.if \type == 444
+        xtn             v18.8b,  v18.8h
+        xtn2            v18.16b, v19.8h
+        sub             v18.16b, v1.16b,  v18.16b
+        st1             {v18.16b}, [x6],  #16
+.elseif \type == 422
+        addp            v18.8h,  v18.8h,  v19.8h
+        xtn             v18.8b,  v18.8h
+        uhsub           v18.8b,  v3.8b,   v18.8b
+        st1             {v18.8b},  [x6],  #8
+.elseif \type == 420
+        add             v18.8h,  v18.8h,  v19.8h
+        addp            v18.8h,  v18.8h,  v18.8h
+        sub             v18.4h,  v3.4h,   v18.4h
+        rshrn           v18.8b,  v18.8h,  #2
+        st1             {v18.s}[0],  [x6],  #4
+.endif
+        st1             {v22.8b},  [x0],  x1
+        st1             {v23.8b},  [x12], x1
+        b.gt            8b
+        ret
+1280:
+640:
+320:
+160:
+        mov             w11, w4
+        sub             x1,  x1,  w4,  uxtw
+.if \type == 444
+        add             x10, x6,  w4,  uxtw
+.elseif \type == 422
+        add             x10, x6,  x11, lsr #1
+.endif
+        add             x9,  x3,  w4,  uxtw #1
+        add             x7,  x2,  w4,  uxtw #1
+161:
+        mov             w8,  w4
+16:
+        ld1             {v4.8h,   v5.8h},   [x2],  #32
+        ld1             {v6.8h,   v7.8h},   [x3],  #32
+        ld1             {v16.8h,  v17.8h},  [x7],  #32
+        ld1             {v18.8h,  v19.8h},  [x9],  #32
+        subs            w8,  w8,  #16
+        sub             v6.8h,   v6.8h,   v4.8h
+        sub             v7.8h,   v7.8h,   v5.8h
+        sub             v18.8h,  v18.8h,  v16.8h
+        sub             v19.8h,  v19.8h,  v17.8h
+        abs             v20.8h,  v6.8h
+        abs             v21.8h,  v7.8h
+        abs             v22.8h,  v18.8h
+        abs             v23.8h,  v19.8h
+        uqsub           v20.8h,  v0.8h,   v20.8h
+        uqsub           v21.8h,  v0.8h,   v21.8h
+        uqsub           v22.8h,  v0.8h,   v22.8h
+        uqsub           v23.8h,  v0.8h,   v23.8h
+        ushr            v20.8h,  v20.8h,  #8
+        ushr            v21.8h,  v21.8h,  #8
+        ushr            v22.8h,  v22.8h,  #8
+        ushr            v23.8h,  v23.8h,  #8
+        shl             v24.8h,  v20.8h,  #9
+        shl             v25.8h,  v21.8h,  #9
+        shl             v26.8h,  v22.8h,  #9
+        shl             v27.8h,  v23.8h,  #9
+        sqdmulh         v24.8h,  v24.8h,  v6.8h
+        sqdmulh         v25.8h,  v25.8h,  v7.8h
+        sqdmulh         v26.8h,  v26.8h,  v18.8h
+        sqdmulh         v27.8h,  v27.8h,  v19.8h
+        add             v24.8h,  v24.8h,  v4.8h
+        add             v25.8h,  v25.8h,  v5.8h
+        add             v26.8h,  v26.8h,  v16.8h
+        add             v27.8h,  v27.8h,  v17.8h
+        sqrshrun        v24.8b,  v24.8h,  #4
+        sqrshrun        v25.8b,  v25.8h,  #4
+        sqrshrun        v26.8b,  v26.8h,  #4
+        sqrshrun        v27.8b,  v27.8h,  #4
+.if \type == 444
+        xtn             v20.8b,  v20.8h
+        xtn2            v20.16b, v21.8h
+        xtn             v21.8b,  v22.8h
+        xtn2            v21.16b, v23.8h
+        sub             v20.16b, v1.16b,  v20.16b
+        sub             v21.16b, v1.16b,  v21.16b
+        st1             {v20.16b}, [x6],  #16
+        st1             {v21.16b}, [x10], #16
+.elseif \type == 422
+        addp            v20.8h,  v20.8h,  v21.8h
+        addp            v21.8h,  v22.8h,  v23.8h
+        xtn             v20.8b,  v20.8h
+        xtn             v21.8b,  v21.8h
+        uhsub           v20.8b,  v3.8b,   v20.8b
+        uhsub           v21.8b,  v3.8b,   v21.8b
+        st1             {v20.8b},  [x6],  #8
+        st1             {v21.8b},  [x10], #8
+.elseif \type == 420
+        add             v20.8h,  v20.8h,  v22.8h
+        add             v21.8h,  v21.8h,  v23.8h
+        addp            v20.8h,  v20.8h,  v21.8h
+        sub             v20.8h,  v3.8h,   v20.8h
+        rshrn           v20.8b,  v20.8h,  #2
+        st1             {v20.8b},  [x6],  #8
+.endif
+        st1             {v24.8b,  v25.8b},  [x0],  #16
+        st1             {v26.8b,  v27.8b},  [x12], #16
+        b.gt            16b
+        subs            w5,  w5,  #2
+        add             x2,  x2,  w4,  uxtw #1
+        add             x3,  x3,  w4,  uxtw #1
+        add             x7,  x7,  w4,  uxtw #1
+        add             x9,  x9,  w4,  uxtw #1
+.if \type == 444
+        add             x6,  x6,  w4,  uxtw
+        add             x10, x10, w4,  uxtw
+.elseif \type == 422
+        add             x6,  x6,  x11, lsr #1
+        add             x10, x10, x11, lsr #1
+.endif
+        add             x0,  x0,  x1
+        add             x12, x12, x1
+        b.gt            161b
+        ret
+L(w_mask_\type\()_tbl):
+        .hword L(w_mask_\type\()_tbl) - 1280b
+        .hword L(w_mask_\type\()_tbl) -  640b
+        .hword L(w_mask_\type\()_tbl) -  320b
+        .hword L(w_mask_\type\()_tbl) -  160b
+        .hword L(w_mask_\type\()_tbl) -    8b
+        .hword L(w_mask_\type\()_tbl) -    4b
+endfunc
+.endm
+
+w_mask_fn 444
+w_mask_fn 422
+w_mask_fn 420
+
+
+function blend_8bpc_neon, export=1
+        adr             x6,  L(blend_tbl)
+        clz             w3,  w3
+        sub             w3,  w3,  #26
+        ldrh            w3,  [x6,  x3,  lsl #1]
+        sub             x6,  x6,  w3,  uxtw
+        movi            v4.16b,  #64
+        add             x8,  x0,  x1
+        lsl             w1,  w1,  #1
+        br              x6
+4:
+        ld1             {v2.d}[0],   [x5],  #8
+        ld1             {v1.d}[0],   [x2],  #8
+        ld1             {v0.s}[0],   [x0]
+        subs            w4,  w4,  #2
+        ld1             {v0.s}[1],   [x8]
+        sub             v3.8b,   v4.8b,   v2.8b
+        umull           v5.8h,   v1.8b,   v2.8b
+        umlal           v5.8h,   v0.8b,   v3.8b
+        rshrn           v6.8b,   v5.8h,   #6
+        st1             {v6.s}[0],   [x0],  x1
+        st1             {v6.s}[1],   [x8],  x1
+        b.gt            4b
+        ret
+8:
+        ld1             {v2.2d},   [x5],  #16
+        ld1             {v1.2d},   [x2],  #16
+        ld1             {v0.d}[0],   [x0]
+        ld1             {v0.d}[1],   [x8]
+        sub             v3.16b,  v4.16b,  v2.16b
+        subs            w4,  w4,  #2
+        umull           v5.8h,   v1.8b,   v2.8b
+        umlal           v5.8h,   v0.8b,   v3.8b
+        umull2          v6.8h,   v1.16b,  v2.16b
+        umlal2          v6.8h,   v0.16b,  v3.16b
+        rshrn           v7.8b,   v5.8h,   #6
+        rshrn2          v7.16b,  v6.8h,   #6
+        st1             {v7.d}[0],   [x0],  x1
+        st1             {v7.d}[1],   [x8],  x1
+        b.gt            8b
+        ret
+16:
+        ld1             {v1.2d,   v2.2d},   [x5],  #32
+        ld1             {v5.2d,   v6.2d},   [x2],  #32
+        ld1             {v0.2d},   [x0]
+        subs            w4,  w4,  #2
+        sub             v7.16b,  v4.16b,  v1.16b
+        sub             v20.16b, v4.16b,  v2.16b
+        ld1             {v3.2d},   [x8]
+        umull           v16.8h,  v5.8b,   v1.8b
+        umlal           v16.8h,  v0.8b,   v7.8b
+        umull2          v17.8h,  v5.16b,  v1.16b
+        umlal2          v17.8h,  v0.16b,  v7.16b
+        umull           v21.8h,  v6.8b,   v2.8b
+        umlal           v21.8h,  v3.8b,   v20.8b
+        umull2          v22.8h,  v6.16b,  v2.16b
+        umlal2          v22.8h,  v3.16b,  v20.16b
+        rshrn           v18.8b,  v16.8h,  #6
+        rshrn2          v18.16b, v17.8h,  #6
+        rshrn           v19.8b,  v21.8h,  #6
+        rshrn2          v19.16b, v22.8h,  #6
+        st1             {v18.2d},  [x0],  x1
+        st1             {v19.2d},  [x8],  x1
+        b.gt            16b
+        ret
+32:
+        ld1             {v0.2d,   v1.2d,   v2.2d,   v3.2d},   [x5],  #64
+        ld1             {v16.2d,  v17.2d,  v18.2d,  v19.2d},  [x2],  #64
+        ld1             {v20.2d,  v21.2d},  [x0]
+        subs            w4,  w4,  #2
+        ld1             {v22.2d,  v23.2d},  [x8]
+        sub             v5.16b,  v4.16b,  v0.16b
+        sub             v6.16b,  v4.16b,  v1.16b
+        sub             v30.16b, v4.16b,  v2.16b
+        sub             v31.16b, v4.16b,  v3.16b
+        umull           v24.8h,  v16.8b,  v0.8b
+        umlal           v24.8h,  v20.8b,  v5.8b
+        umull2          v26.8h,  v16.16b, v0.16b
+        umlal2          v26.8h,  v20.16b, v5.16b
+        umull           v28.8h,  v17.8b,  v1.8b
+        umlal           v28.8h,  v21.8b,  v6.8b
+        umull2          v7.8h,   v17.16b, v1.16b
+        umlal2          v7.8h,   v21.16b, v6.16b
+        umull           v27.8h,  v18.8b,  v2.8b
+        umlal           v27.8h,  v22.8b,  v30.8b
+        umull2          v1.8h,   v18.16b, v2.16b
+        umlal2          v1.8h,   v22.16b, v30.16b
+        umull           v29.8h,  v19.8b,  v3.8b
+        umlal           v29.8h,  v23.8b,  v31.8b
+        umull2          v21.8h,  v19.16b, v3.16b
+        umlal2          v21.8h,  v23.16b, v31.16b
+        rshrn           v24.8b,  v24.8h,  #6
+        rshrn2          v24.16b, v26.8h,  #6
+        rshrn           v25.8b,  v28.8h,  #6
+        rshrn2          v25.16b, v7.8h,   #6
+        rshrn           v27.8b,  v27.8h,  #6
+        rshrn2          v27.16b, v1.8h,   #6
+        rshrn           v28.8b,  v29.8h,  #6
+        rshrn2          v28.16b, v21.8h,  #6
+        st1             {v24.2d, v25.2d}, [x0],  x1
+        st1             {v27.2d, v28.2d}, [x8],  x1
+        b.gt            32b
+        ret
+L(blend_tbl):
+        .hword L(blend_tbl) - 32b
+        .hword L(blend_tbl) - 16b
+        .hword L(blend_tbl) -  8b
+        .hword L(blend_tbl) -  4b
+endfunc
+
+function blend_h_8bpc_neon, export=1
+        adr             x6, L(blend_h_tbl)
+        movrel          x5,  X(obmc_masks)
+        add             x5,  x5,  w4,  uxtw
+        sub             w4,  w4,  w4,  lsr #2
+        clz             w7,  w3
+        movi            v4.16b,  #64
+        add             x8,  x0,  x1
+        lsl             x1,  x1,  #1
+        sub             w7,  w7,  #24
+        ldrh            w7,  [x6,  x7,  lsl #1]
+        sub             x6,  x6,  w7, uxtw
+        br              x6
+2:
+        ld1             {v0.h}[0],   [x5],  #2
+        ld1             {v1.s}[0],   [x2],  #4
+        subs            w4,  w4,  #2
+        ld1             {v2.h}[0],   [x0]
+        zip1            v0.8b,   v0.8b,   v0.8b
+        sub             v3.8b,   v4.8b,   v0.8b
+        ld1             {v2.h}[1],   [x8]
+        umull           v5.8h,   v1.8b,   v0.8b
+        umlal           v5.8h,   v2.8b,   v3.8b
+        rshrn           v5.8b,   v5.8h,   #6
+        st1             {v5.h}[0],   [x0],  x1
+        st1             {v5.h}[1],   [x8],  x1
+        b.gt            2b
+        ret
+4:
+        ld2r            {v0.8b,   v1.8b},   [x5],  #2
+        ld1             {v2.2s},   [x2],  #8
+        subs            w4,  w4,  #2
+        ext             v0.8b,   v0.8b,   v1.8b,   #4
+        ld1             {v3.s}[0],   [x0]
+        sub             v5.8b,   v4.8b,   v0.8b
+        ld1             {v3.s}[1],   [x8]
+        umull           v6.8h,   v2.8b,   v0.8b
+        umlal           v6.8h,   v3.8b,   v5.8b
+        rshrn           v6.8b,   v6.8h,   #6
+        st1             {v6.s}[0],   [x0],  x1
+        st1             {v6.s}[1],   [x8],  x1
+        b.gt            4b
+        ret
+8:
+        ld2r            {v0.16b,  v1.16b},  [x5],  #2
+        ld1             {v2.16b},  [x2],  #16
+        ld1             {v3.d}[0],   [x0]
+        ext             v0.16b,  v0.16b,  v1.16b,  #8
+        sub             v5.16b,  v4.16b,  v0.16b
+        ld1             {v3.d}[1],   [x8]
+        subs            w4,  w4,  #2
+        umull           v6.8h,   v0.8b,   v2.8b
+        umlal           v6.8h,   v3.8b,   v5.8b
+        umull2          v7.8h,   v0.16b,  v2.16b
+        umlal2          v7.8h,   v3.16b,  v5.16b
+        rshrn           v16.8b,  v6.8h,   #6
+        rshrn2          v16.16b, v7.8h,   #6
+        st1             {v16.d}[0],  [x0],  x1
+        st1             {v16.d}[1],  [x8],  x1
+        b.gt            8b
+        ret
+16:
+        ld2r            {v0.16b,  v1.16b},  [x5],  #2
+        ld1             {v2.16b,  v3.16b},  [x2],  #32
+        ld1             {v5.16b},  [x0]
+        sub             v7.16b,  v4.16b,  v0.16b
+        sub             v16.16b, v4.16b,  v1.16b
+        ld1             {v6.16b},  [x8]
+        subs            w4,  w4,  #2
+        umull           v17.8h,  v0.8b,   v2.8b
+        umlal           v17.8h,  v5.8b,   v7.8b
+        umull2          v18.8h,  v0.16b,  v2.16b
+        umlal2          v18.8h,  v5.16b,  v7.16b
+        umull           v19.8h,  v1.8b,   v3.8b
+        umlal           v19.8h,  v6.8b,   v16.8b
+        umull2          v20.8h,  v1.16b,  v3.16b
+        umlal2          v20.8h,  v6.16b,  v16.16b
+        rshrn           v21.8b,  v17.8h,  #6
+        rshrn2          v21.16b, v18.8h,  #6
+        rshrn           v22.8b,  v19.8h,  #6
+        rshrn2          v22.16b, v20.8h,  #6
+        st1             {v21.16b}, [x0],  x1
+        st1             {v22.16b}, [x8],  x1
+        b.gt            16b
+        ret
+1280:
+640:
+320:
+        sub             x1,  x1,  w3,  uxtw
+        add             x7,  x2,  w3,  uxtw
+321:
+        ld2r            {v0.16b,  v1.16b},  [x5],  #2
+        mov             w6,  w3
+        sub             v20.16b, v4.16b,  v0.16b
+        sub             v21.16b, v4.16b,  v1.16b
+32:
+        ld1             {v16.16b, v17.16b}, [x2],  #32
+        ld1             {v2.16b,  v3.16b},  [x0]
+        subs            w6,  w6,  #32
+        umull           v23.8h,  v0.8b,   v16.8b
+        umlal           v23.8h,  v2.8b,   v20.8b
+        ld1             {v18.16b, v19.16b}, [x7],  #32
+        umull2          v27.8h,  v0.16b,  v16.16b
+        umlal2          v27.8h,  v2.16b,  v20.16b
+        ld1             {v6.16b,  v7.16b},  [x8]
+        umull           v24.8h,  v0.8b,   v17.8b
+        umlal           v24.8h,  v3.8b,   v20.8b
+        umull2          v28.8h,  v0.16b,  v17.16b
+        umlal2          v28.8h,  v3.16b,  v20.16b
+        umull           v25.8h,  v1.8b,   v18.8b
+        umlal           v25.8h,  v6.8b,   v21.8b
+        umull2          v5.8h,   v1.16b,  v18.16b
+        umlal2          v5.8h,   v6.16b,  v21.16b
+        rshrn           v29.8b,  v23.8h,  #6
+        rshrn2          v29.16b, v27.8h,  #6
+        umull           v26.8h,  v1.8b,   v19.8b
+        umlal           v26.8h,  v7.8b,   v21.8b
+        umull2          v31.8h,  v1.16b,  v19.16b
+        umlal2          v31.8h,  v7.16b,  v21.16b
+        rshrn           v30.8b,  v24.8h,  #6
+        rshrn2          v30.16b, v28.8h,  #6
+        rshrn           v23.8b,  v25.8h,  #6
+        rshrn2          v23.16b, v5.8h,   #6
+        rshrn           v24.8b,  v26.8h,  #6
+        st1             {v29.16b, v30.16b}, [x0],  #32
+        rshrn2          v24.16b, v31.8h,  #6
+        st1             {v23.16b, v24.16b}, [x8],  #32
+        b.gt            32b
+        subs            w4,  w4,  #2
+        add             x0,  x0,  x1
+        add             x8,  x8,  x1
+        add             x2,  x2,  w3,  uxtw
+        add             x7,  x7,  w3,  uxtw
+        b.gt            321b
+        ret
+L(blend_h_tbl):
+        .hword L(blend_h_tbl) - 1280b
+        .hword L(blend_h_tbl) -  640b
+        .hword L(blend_h_tbl) -  320b
+        .hword L(blend_h_tbl) -   16b
+        .hword L(blend_h_tbl) -    8b
+        .hword L(blend_h_tbl) -    4b
+        .hword L(blend_h_tbl) -    2b
+endfunc
+
+function blend_v_8bpc_neon, export=1
+        adr             x6,  L(blend_v_tbl)
+        movrel          x5,  X(obmc_masks)
+        add             x5,  x5,  w3,  uxtw
+        clz             w3,  w3
+        movi            v4.16b,  #64
+        add             x8,  x0,  x1
+        lsl             x1,  x1,  #1
+        sub             w3,  w3,  #26
+        ldrh            w3,  [x6,  x3,  lsl #1]
+        sub             x6,  x6,  w3,  uxtw
+        br              x6
+20:
+        ld1r            {v0.8b},   [x5]
+        sub             v1.8b,   v4.8b,   v0.8b
+2:
+        ld1             {v2.h}[0],   [x2],  #2
+        ld1             {v3.b}[0],   [x0]
+        subs            w4,  w4,  #2
+        ld1             {v2.b}[1],   [x2]
+        ld1             {v3.b}[1],   [x8]
+        umull           v5.8h,   v2.8b,   v0.8b
+        umlal           v5.8h,   v3.8b,   v1.8b
+        rshrn           v5.8b,   v5.8h,   #6
+        add             x2,  x2,  #2
+        st1             {v5.b}[0],   [x0],  x1
+        st1             {v5.b}[1],   [x8],  x1
+        b.gt            2b
+        ret
+40:
+        ld1r            {v0.2s},   [x5]
+        sub             v1.8b,   v4.8b,   v0.8b
+        sub             x1,  x1,  #3
+4:
+        ld1             {v2.8b},   [x2],  #8
+        ld1             {v3.s}[0],   [x0]
+        ld1             {v3.s}[1],   [x8]
+        subs            w4,  w4,  #2
+        umull           v5.8h,   v2.8b,   v0.8b
+        umlal           v5.8h,   v3.8b,   v1.8b
+        rshrn           v5.8b,   v5.8h,   #6
+        st1             {v5.h}[0],   [x0],  #2
+        st1             {v5.h}[2],   [x8],  #2
+        st1             {v5.b}[2],   [x0],  #1
+        st1             {v5.b}[6],   [x8],  #1
+        add             x0,  x0,  x1
+        add             x8,  x8,  x1
+        b.gt            4b
+        ret
+80:
+        ld1r            {v0.2d},   [x5]
+        sub             v1.16b,  v4.16b,  v0.16b
+        sub             x1,  x1,  #6
+8:
+        ld1             {v2.16b},  [x2],  #16
+        ld1             {v3.d}[0],   [x0]
+        ld1             {v3.d}[1],   [x8]
+        subs            w4,  w4,  #2
+        umull           v5.8h,  v0.8b,  v2.8b
+        umlal           v5.8h,  v3.8b,  v1.8b
+        umull2          v6.8h,  v0.16b, v2.16b
+        umlal2          v6.8h,  v3.16b, v1.16b
+        rshrn           v7.8b,  v5.8h,  #6
+        rshrn2          v7.16b, v6.8h,  #6
+        st1             {v7.s}[0],   [x0],  #4
+        st1             {v7.s}[2],   [x8],  #4
+        st1             {v7.h}[2],   [x0],  #2
+        st1             {v7.h}[6],   [x8],  #2
+        add             x0,  x0,  x1
+        add             x8,  x8,  x1
+        b.gt            8b
+        ret
+160:
+        ld1             {v0.16b},  [x5]
+        sub             v2.16b,  v4.16b,  v0.16b
+        sub             x1,  x1,  #12
+16:
+        ld1             {v5.16b,  v6.16b},  [x2],  #32
+        ld1             {v7.16b},  [x0]
+        subs            w4,  w4,  #2
+        ld1             {v16.16b}, [x8]
+        umull           v17.8h,  v5.8b,   v0.8b
+        umlal           v17.8h,  v7.8b,   v2.8b
+        umull2          v18.8h,  v5.16b,  v0.16b
+        umlal2          v18.8h,  v7.16b,  v2.16b
+        umull           v20.8h,  v6.8b,   v0.8b
+        umlal           v20.8h,  v16.8b,  v2.8b
+        umull2          v21.8h,  v6.16b,  v0.16b
+        umlal2          v21.8h,  v16.16b, v2.16b
+        rshrn           v19.8b,  v17.8h,  #6
+        rshrn2          v19.16b, v18.8h,  #6
+        rshrn           v22.8b,  v20.8h,  #6
+        rshrn2          v22.16b, v21.8h,  #6
+        st1             {v19.8b},  [x0],  #8
+        st1             {v22.8b},  [x8],  #8
+        st1             {v19.s}[2],  [x0],  #4
+        st1             {v22.s}[2],  [x8],  #4
+        add             x0,  x0,  x1
+        add             x8,  x8,  x1
+        b.gt            16b
+        ret
+320:
+        ld1             {v0.16b,  v1.16b},  [x5]
+        sub             v2.16b,  v4.16b,  v0.16b
+        sub             v3.16b,  v4.16b,  v1.16b
+        sub             x1,  x1,  #24
+32:
+        ld1             {v16.16b, v17.16b, v18.16b, v19.16b}, [x2],  #64
+        ld1             {v5.16b,  v6.16b},  [x0]
+        subs            w4,  w4,  #2
+        ld1             {v20.16b, v21.16b}, [x8]
+        umull           v22.8h,  v16.8b,  v0.8b
+        umlal           v22.8h,  v5.8b,   v2.8b
+        umull2          v23.8h,  v16.16b, v0.16b
+        umlal2          v23.8h,  v5.16b,  v2.16b
+        umull           v28.8h,  v17.8b,  v1.8b
+        umlal           v28.8h,  v6.8b,   v3.8b
+        umull2          v29.8h,  v17.16b, v1.16b
+        umlal2          v29.8h,  v6.16b,  v3.16b
+        umull           v30.8h,  v18.8b,  v0.8b
+        umlal           v30.8h,  v20.8b,  v2.8b
+        umull2          v31.8h,  v18.16b, v0.16b
+        umlal2          v31.8h,  v20.16b, v2.16b
+        umull           v25.8h,  v19.8b,  v1.8b
+        umlal           v25.8h,  v21.8b,  v3.8b
+        umull2          v26.8h,  v19.16b, v1.16b
+        umlal2          v26.8h,  v21.16b, v3.16b
+        rshrn           v24.8b,  v22.8h,  #6
+        rshrn2          v24.16b, v23.8h,  #6
+        rshrn           v28.8b,  v28.8h,  #6
+        rshrn2          v28.16b, v29.8h,  #6
+        rshrn           v30.8b,  v30.8h,  #6
+        rshrn2          v30.16b, v31.8h,  #6
+        rshrn           v27.8b,  v25.8h,  #6
+        rshrn2          v27.16b, v26.8h,  #6
+        st1             {v24.16b}, [x0],  #16
+        st1             {v30.16b}, [x8],  #16
+        st1             {v28.8b},  [x0],  #8
+        st1             {v27.8b},  [x8],  #8
+        add             x0,  x0,  x1
+        add             x8,  x8,  x1
+        b.gt            32b
+        ret
+L(blend_v_tbl):
+        .hword L(blend_v_tbl) - 320b
+        .hword L(blend_v_tbl) - 160b
+        .hword L(blend_v_tbl) -  80b
+        .hword L(blend_v_tbl) -  40b
+        .hword L(blend_v_tbl) -  20b
+endfunc
+
+
 // This has got the same signature as the put_8tap functions,
 // and assumes that x8 is set to (clz(w)-24).
 function put_neon
         adr             x9,  L(put_tbl)
         ldrh            w8,  [x9, x8, lsl #1]
         sub             x9,  x9,  w8, uxtw
         br              x9
 
--- a/third_party/dav1d/src/arm/64/msac.S
+++ b/third_party/dav1d/src/arm/64/msac.S
@@ -143,17 +143,17 @@ endconst
 //                                               size_t n_symbols);
 
 function msac_decode_symbol_adapt4_neon, export=1
 .macro decode_update sz, szb, n
         sub             sp,  sp,  #48
         add             x8,  x0,  #RNG
         ld1_n           v0,  v1,  x1,  \sz, \n                    // cdf
         ld1r            {v4\sz},  [x8]                            // rng
-        movrel          x9,  coeffs, 32
+        movrel          x9,  coeffs, 30
         sub             x9,  x9,  x2, lsl #1
         ushr_n          v2,  v3,  v0,  v1,  #6, \sz, \n           // cdf >> EC_PROB_SHIFT
         str             h4,  [sp, #14]                            // store original u = s->rng
         ushr            v4\sz,  v4\sz,  #8                        // r = rng >> 8
 
         umull_n         v16, v17, v18, v19, v4,  v4,  v2,  v3, \n // r * (cdf >> EC_PROB_SHIFT)
         ld1_n           v4,  v5,  x9,  \sz, \n                    // EC_MIN_PROB * (n_symbols - ret)
         shrn_n          v2,  v3,  v16, v17, v18, v19, #1, \n      // v >>= 7 - EC_PROB_SHIFT
@@ -178,26 +178,34 @@ function msac_decode_symbol_adapt4_neon,
         umov            w3,  v6.h[0]
         rbit            w3,  w3
         clz             w15, w3                                   // ret
 
         cbz             w4,  L(renorm)
         // update_cdf
         ldrh            w3,  [x1, x2, lsl #1]                     // count = cdf[n_symbols]
         movi            v5\szb, #0xff
-        cmp             x2,  #4                                   // set C if n_symbols >= 4 (n_symbols > 3)
-        mov             w14, #4
-        lsr             w4,  w3,  #4                              // count >> 4
+.if \n == 16
+        mov             w4,  #-5
+.else
+        mvn             w14, w2
+        mov             w4,  #-4
+        cmn             w14, #3                                   // set C if n_symbols <= 2
+.endif
         urhadd_n        v4,  v5,  v5,  v5,  v2,  v3,  \sz, \n     // i >= val ? -1 : 32768
-        adc             w4,  w4,  w14                             // (count >> 4) + (n_symbols > 3) + 4
-        neg             w4,  w4                                   // -rate
+.if \n == 16
+        sub             w4,  w4,  w3, lsr #4                      // -((count >> 4) + 5)
+.else
+        lsr             w14, w3,  #4                              // count >> 4
+        sbc             w4,  w4,  w14                             // -((count >> 4) + (n_symbols > 2) + 4)
+.endif
         sub_n           v4,  v5,  v4,  v5,  v0,  v1,  \sz, \n     // (32768 - cdf[i]) or (-1 - cdf[i])
         dup             v6.8h,    w4                              // -rate
 
-        sub             w3,  w3,  w3, lsr #5                      // count - (count >= 32)
+        sub             w3,  w3,  w3, lsr #5                      // count - (count == 32)
         sub_n           v0,  v1,  v0,  v1,  v2,  v3,  \sz, \n     // cdf + (i >= val ? 1 : 0)
         sshl_n          v4,  v5,  v4,  v5,  v6,  v6,  \sz, \n     // ({32768,-1} - cdf[i]) >> rate
         add             w3,  w3,  #1                              // count + (count < 32)
         add_n           v0,  v1,  v0,  v1,  v4,  v5,  \sz, \n     // cdf + (32768 - cdf[i]) >> rate
         st1_n           v0,  v1,  x1,  \sz, \n
         strh            w3,  [x1, x2, lsl #1]
 .endm
 
@@ -219,18 +227,17 @@ L(renorm2):
         lsl             w4,  w4,  w5           // rng << d
         subs            w6,  w6,  w5           // cnt -= d
         lsl             x7,  x7,  x5           // (~dif + (v << 48)) << d
         str             w4,  [x0, #RNG]
         mvn             x7,  x7                // ~dif
         b.ge            9f
 
         // refill
-        ldr             x3,  [x0, #BUF_POS]
-        ldr             x4,  [x0, #BUF_END]
+        ldp             x3,  x4,  [x0]         // BUF_POS, BUF_END
         add             x5,  x3,  #8
         cmp             x5,  x4
         b.gt            2f
 
         ldr             x3,  [x3]              // next_bits
         add             w8,  w6,  #23          // shift_bits = cnt + 23
         add             w6,  w6,  #16          // cnt += 16
         rev             x3,  x3                // next_bits = bswap(next_bits)
--- a/third_party/dav1d/src/arm/mc_init_tmpl.c
+++ b/third_party/dav1d/src/arm/mc_init_tmpl.c
@@ -96,21 +96,20 @@ void bitfn(dav1d_mc_dsp_init_arm)(Dav1dM
     init_mct_fn(FILTER_2D_8TAP_SHARP_REGULAR,  8tap_sharp_regular,  neon);
     init_mct_fn(FILTER_2D_8TAP_SHARP_SMOOTH,   8tap_sharp_smooth,   neon);
     init_mct_fn(FILTER_2D_8TAP_SHARP,          8tap_sharp,          neon);
     init_mct_fn(FILTER_2D_BILINEAR,            bilin,               neon);
 
     c->avg = dav1d_avg_8bpc_neon;
     c->w_avg = dav1d_w_avg_8bpc_neon;
     c->mask = dav1d_mask_8bpc_neon;
-#if ARCH_AARCH64
-    c->warp8x8 = dav1d_warp_affine_8x8_8bpc_neon;
-    c->warp8x8t = dav1d_warp_affine_8x8t_8bpc_neon;
-#elif ARCH_ARM
     c->blend = dav1d_blend_8bpc_neon;
     c->blend_h = dav1d_blend_h_8bpc_neon;
     c->blend_v = dav1d_blend_v_8bpc_neon;
     c->w_mask[0] = dav1d_w_mask_444_8bpc_neon;
     c->w_mask[1] = dav1d_w_mask_422_8bpc_neon;
     c->w_mask[2] = dav1d_w_mask_420_8bpc_neon;
+#if ARCH_AARCH64
+    c->warp8x8 = dav1d_warp_affine_8x8_8bpc_neon;
+    c->warp8x8t = dav1d_warp_affine_8x8t_8bpc_neon;
 #endif
 #endif
 }
--- a/third_party/dav1d/src/cdef.h
+++ b/third_party/dav1d/src/cdef.h
@@ -62,11 +62,12 @@ typedef decl_cdef_dir_fn(*cdef_dir_fn);
 
 typedef struct Dav1dCdefDSPContext {
     cdef_dir_fn dir;
     cdef_fn fb[3 /* 444/luma, 422, 420 */];
 } Dav1dCdefDSPContext;
 
 bitfn_decls(void dav1d_cdef_dsp_init, Dav1dCdefDSPContext *c);
 bitfn_decls(void dav1d_cdef_dsp_init_arm, Dav1dCdefDSPContext *c);
+bitfn_decls(void dav1d_cdef_dsp_init_ppc, Dav1dCdefDSPContext *c);
 bitfn_decls(void dav1d_cdef_dsp_init_x86, Dav1dCdefDSPContext *c);
 
 #endif /* DAV1D_SRC_CDEF_H */
--- a/third_party/dav1d/src/cdef_tmpl.c
+++ b/third_party/dav1d/src/cdef_tmpl.c
@@ -22,17 +22,16 @@
  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include "config.h"
 
-#include <assert.h>
 #include <stdlib.h>
 
 #include "common/intops.h"
 
 #include "src/cdef.h"
 
 static inline int constrain(const int diff, const int threshold,
                             const int damping)
@@ -258,13 +257,15 @@ COLD void bitfn(dav1d_cdef_dsp_init)(Dav
     c->dir = cdef_find_dir_c;
     c->fb[0] = cdef_filter_block_8x8_c;
     c->fb[1] = cdef_filter_block_4x8_c;
     c->fb[2] = cdef_filter_block_4x4_c;
 
 #if HAVE_ASM
 #if ARCH_AARCH64 || ARCH_ARM
     bitfn(dav1d_cdef_dsp_init_arm)(c);
+#elif ARCH_PPC64LE
+    bitfn(dav1d_cdef_dsp_init_ppc)(c);
 #elif ARCH_X86
     bitfn(dav1d_cdef_dsp_init_x86)(c);
 #endif
 #endif
 }
--- a/third_party/dav1d/src/cdf.c
+++ b/third_party/dav1d/src/cdf.c
@@ -22,4140 +22,4060 @@
  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include "config.h"
 
-#include <assert.h>
 #include <string.h>
 
 #include "src/thread.h"
 #include "common/intops.h"
 
 #include "src/cdf.h"
+#include "src/tables.h"
 
-#define AOM_ICDF(x) (32768-(x))
+#define CDF1(x) (32768-(x))
 
-#define AOM_CDF2(a) \
-    AOM_ICDF(a)
-#define AOM_CDF3(a,b) \
-    AOM_ICDF(a), AOM_ICDF(b)
-#define AOM_CDF4(a,b,c) \
-    AOM_ICDF(a), AOM_CDF3(b,c)
-#define AOM_CDF5(a,b,c,d) \
-    AOM_ICDF(a), AOM_CDF4(b,c,d)
-#define AOM_CDF6(a,b,c,d,e) \
-    AOM_ICDF(a), AOM_CDF5(b,c,d,e)
-#define AOM_CDF7(a,b,c,d,e,f) \
-    AOM_ICDF(a), AOM_CDF6(b,c,d,e,f)
-#define AOM_CDF8(a,b,c,d,e,f,g) \
-    AOM_ICDF(a), AOM_CDF7(b,c,d,e,f,g)
-#define AOM_CDF9(a,b,c,d,e,f,g,h) \
-    AOM_ICDF(a), AOM_CDF8(b,c,d,e,f,g,h)
-#define AOM_CDF10(a,b,c,d,e,f,g,h,i) \
-    AOM_ICDF(a), AOM_CDF9(b,c,d,e,f,g,h,i)
-#define AOM_CDF11(a,b,c,d,e,f,g,h,i,j) \
-    AOM_ICDF(a), AOM_CDF10(b,c,d,e,f,g,h,i,j)
-#define AOM_CDF12(a,b,c,d,e,f,g,h,i,j,k) \
-    AOM_ICDF(a), AOM_CDF11(b,c,d,e,f,g,h,i,j,k)
-#define AOM_CDF13(a,b,c,d,e,f,g,h,i,j,k,l) \
-    AOM_ICDF(a), AOM_CDF12(b,c,d,e,f,g,h,i,j,k,l)
-#define AOM_CDF14(a,b,c,d,e,f,g,h,i,j,k,l,m) \
-    AOM_ICDF(a), AOM_CDF13(b,c,d,e,f,g,h,i,j,k,l,m)
-#define AOM_CDF15(a,b,c,d,e,f,g,h,i,j,k,l,m,n) \
-    AOM_ICDF(a), AOM_CDF14(b,c,d,e,f,g,h,i,j,k,l,m,n)
-#define AOM_CDF16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) \
-    AOM_ICDF(a), AOM_CDF15(b,c,d,e,f,g,h,i,j,k,l,m,n,o)
+#define CDF2(a,b) \
+    CDF1(a), CDF1(b)
+#define CDF3(a,b,c) \
+    CDF1(a), CDF2(b,c)
+#define CDF4(a,b,c,d) \
+    CDF1(a), CDF3(b,c,d)
+#define CDF5(a,b,c,d,e) \
+    CDF1(a), CDF4(b,c,d,e)
+#define CDF6(a,b,c,d,e,f) \
+    CDF1(a), CDF5(b,c,d,e,f)
+#define CDF7(a,b,c,d,e,f,g) \
+    CDF1(a), CDF6(b,c,d,e,f,g)
+#define CDF8(a,b,c,d,e,f,g,h) \
+    CDF1(a), CDF7(b,c,d,e,f,g,h)
+#define CDF9(a,b,c,d,e,f,g,h,i) \
+    CDF1(a), CDF8(b,c,d,e,f,g,h,i)
+#define CDF10(a,b,c,d,e,f,g,h,i,j) \
+    CDF1(a), CDF9(b,c,d,e,f,g,h,i,j)
+#define CDF11(a,b,c,d,e,f,g,h,i,j,k) \
+    CDF1(a), CDF10(b,c,d,e,f,g,h,i,j,k)
+#define CDF12(a,b,c,d,e,f,g,h,i,j,k,l) \
+    CDF1(a), CDF11(b,c,d,e,f,g,h,i,j,k,l)
+#define CDF13(a,b,c,d,e,f,g,h,i,j,k,l,m) \
+    CDF1(a), CDF12(b,c,d,e,f,g,h,i,j,k,l,m)
+#define CDF14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) \
+    CDF1(a), CDF13(b,c,d,e,f,g,h,i,j,k,l,m,n)
+#define CDF15(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) \
+    CDF1(a), CDF14(b,c,d,e,f,g,h,i,j,k,l,m,n,o)
 
 static const CdfModeContext av1_default_cdf = {
     .y_mode = {
-        { AOM_CDF13(22801, 23489, 24293, 24756, 25601, 26123,
-                    26606, 27418, 27945, 29228, 29685, 30349) },
-        { AOM_CDF13(18673, 19845, 22631, 23318, 23950, 24649,
-                    25527, 27364, 28152, 29701, 29984, 30852) },
-        { AOM_CDF13(19770, 20979, 23396, 23939, 24241, 24654,
-                    25136, 27073, 27830, 29360, 29730, 30659) },
-        { AOM_CDF13(20155, 21301, 22838, 23178, 23261, 23533,
-                    23703, 24804, 25352, 26575, 27016, 28049) },
+        { CDF12(22801, 23489, 24293, 24756, 25601, 26123,
+                26606, 27418, 27945, 29228, 29685, 30349) },
+        { CDF12(18673, 19845, 22631, 23318, 23950, 24649,
+                25527, 27364, 28152, 29701, 29984, 30852) },
+        { CDF12(19770, 20979, 23396, 23939, 24241, 24654,
+                25136, 27073, 27830, 29360, 29730, 30659) },
+        { CDF12(20155, 21301, 22838, 23178, 23261, 23533,
+                23703, 24804, 25352, 26575, 27016, 28049) },
     }, .use_filter_intra = {
-        [BS_4x4]     = { AOM_CDF2(4621) },
-        [BS_4x8]     = { AOM_CDF2(6743) },
-        [BS_8x4]     = { AOM_CDF2(5893) },
-        [BS_8x8]     = { AOM_CDF2(7866) },
-        [BS_8x16]    = { AOM_CDF2(12551) },
-        [BS_16x8]    = { AOM_CDF2(9394) },
-        [BS_16x16]   = { AOM_CDF2(12408) },
-        [BS_16x32]   = { AOM_CDF2(14301) },
-        [BS_32x16]   = { AOM_CDF2(12756) },
-        [BS_32x32]   = { AOM_CDF2(22343) },
-        [BS_32x64]   = { AOM_CDF2(16384) },
-        [BS_64x32]   = { AOM_CDF2(16384) },
-        [BS_64x64]   = { AOM_CDF2(16384) },
-        [BS_64x128]  = { AOM_CDF2(16384) },
-        [BS_128x64]  = { AOM_CDF2(16384) },
-        [BS_128x128] = { AOM_CDF2(16384) },
-        [BS_4x16]    = { AOM_CDF2(12770) },
-        [BS_16x4]    = { AOM_CDF2(10368) },
-        [BS_8x32]    = { AOM_CDF2(20229) },
-        [BS_32x8]    = { AOM_CDF2(18101) },
-        [BS_16x64]   = { AOM_CDF2(16384) },
-        [BS_64x16]   = { AOM_CDF2(16384) },
+        [BS_4x4]     = { CDF1( 4621) },
+        [BS_4x8]     = { CDF1( 6743) },
+        [BS_8x4]     = { CDF1( 5893) },
+        [BS_8x8]     = { CDF1( 7866) },
+        [BS_8x16]    = { CDF1(12551) },
+        [BS_16x8]    = { CDF1( 9394) },
+        [BS_16x16]   = { CDF1(12408) },
+        [BS_16x32]   = { CDF1(14301) },
+        [BS_32x16]   = { CDF1(12756) },
+        [BS_32x32]   = { CDF1(22343) },
+        [BS_32x64]   = { CDF1(16384) },
+        [BS_64x32]   = { CDF1(16384) },
+        [BS_64x64]   = { CDF1(16384) },
+        [BS_64x128]  = { CDF1(16384) },
+        [BS_128x64]  = { CDF1(16384) },
+        [BS_128x128] = { CDF1(16384) },
+        [BS_4x16]    = { CDF1(12770) },
+        [BS_16x4]    = { CDF1(10368) },
+        [BS_8x32]    = { CDF1(20229) },
+        [BS_32x8]    = { CDF1(18101) },
+        [BS_16x64]   = { CDF1(16384) },
+        [BS_64x16]   = { CDF1(16384) },
     }, .filter_intra = {
-        AOM_CDF5(8949, 12776, 17211, 29558),
+        CDF4(8949, 12776, 17211, 29558),
     }, .uv_mode = {
         {
-            { AOM_CDF13(22631, 24152, 25378, 25661, 25986, 26520, 27055, 27923,
-                        28244, 30059, 30941, 31961) },
-            { AOM_CDF13(9513, 26881, 26973, 27046, 27118, 27664, 27739, 27824,
-                        28359, 29505, 29800, 31796) },
-            { AOM_CDF13(9845, 9915, 28663, 28704, 28757, 28780, 29198, 29822,
-                        29854, 30764, 31777, 32029) },
-            { AOM_CDF13(13639, 13897, 14171, 25331, 25606, 25727, 25953, 27148,
-                        28577, 30612, 31355, 32493) },
-            { AOM_CDF13(9764, 9835, 9930, 9954, 25386, 27053, 27958, 28148,
-                        28243, 31101, 31744, 32363) },
-            { AOM_CDF13(11825, 13589, 13677, 13720, 15048, 29213, 29301, 29458,
-                        29711, 31161, 31441, 32550) },
-            { AOM_CDF13(14175, 14399, 16608, 16821, 17718, 17775, 28551, 30200,
-                        30245, 31837, 32342, 32667) },
-            { AOM_CDF13(12885, 13038, 14978, 15590, 15673, 15748, 16176, 29128,
-                        29267, 30643, 31961, 32461) },
-            { AOM_CDF13(12026, 13661, 13874, 15305, 15490, 15726, 15995, 16273,
-                        28443, 30388, 30767, 32416) },
-            { AOM_CDF13(19052, 19840, 20579, 20916, 21150, 21467, 21885, 22719,
-                        23174, 28861, 30379, 32175) },
-            { AOM_CDF13(18627, 19649, 20974, 21219, 21492, 21816, 22199, 23119,
-                        23527, 27053, 31397, 32148) },
-            { AOM_CDF13(17026, 19004, 19997, 20339, 20586, 21103, 21349, 21907,
-                        22482, 25896, 26541, 31819) },
-            { AOM_CDF13(12124, 13759, 14959, 14992, 15007, 15051, 15078, 15166,
-                        15255, 15753, 16039, 16606) }
+            { CDF12(22631, 24152, 25378, 25661, 25986, 26520,
+                    27055, 27923, 28244, 30059, 30941, 31961) },
+            { CDF12( 9513, 26881, 26973, 27046, 27118, 27664,
+                    27739, 27824, 28359, 29505, 29800, 31796) },
+            { CDF12( 9845,  9915, 28663, 28704, 28757, 28780,
+                    29198, 29822, 29854, 30764, 31777, 32029) },
+            { CDF12(13639, 13897, 14171, 25331, 25606, 25727,
+                    25953, 27148, 28577, 30612, 31355, 32493) },
+            { CDF12( 9764,  9835,  9930,  9954, 25386, 27053,
+                    27958, 28148, 28243, 31101, 31744, 32363) },
+            { CDF12(11825, 13589, 13677, 13720, 15048, 29213,
+                    29301, 29458, 29711, 31161, 31441, 32550) },
+            { CDF12(14175, 14399, 16608, 16821, 17718, 17775,
+                    28551, 30200, 30245, 31837, 32342, 32667) },
+            { CDF12(12885, 13038, 14978, 15590, 15673, 15748,
+                    16176, 29128, 29267, 30643, 31961, 32461) },
+            { CDF12(12026, 13661, 13874, 15305, 15490, 15726,
+                    15995, 16273, 28443, 30388, 30767, 32416) },
+            { CDF12(19052, 19840, 20579, 20916, 21150, 21467,
+                    21885, 22719, 23174, 28861, 30379, 32175) },
+            { CDF12(18627, 19649, 20974, 21219, 21492, 21816,
+                    22199, 23119, 23527, 27053, 31397, 32148) },
+            { CDF12(17026, 19004, 19997, 20339, 20586, 21103,
+                    21349, 21907, 22482, 25896, 26541, 31819) },
+            { CDF12(12124, 13759, 14959, 14992, 15007, 15051,
+                    15078, 15166, 15255, 15753, 16039, 16606) },
         }, {
-            { AOM_CDF14(10407, 11208, 12900, 13181, 13823, 14175, 14899, 15656,
-                      15986, 20086, 20995, 22455, 24212) },
-            { AOM_CDF14(4532, 19780, 20057, 20215, 20428, 21071, 21199, 21451,
-                        22099, 24228, 24693, 27032, 29472) },
-            { AOM_CDF14(5273, 5379, 20177, 20270, 20385, 20439, 20949, 21695,
-                        21774, 23138, 24256, 24703, 26679) },
-            { AOM_CDF14(6740, 7167, 7662, 14152, 14536, 14785, 15034, 16741,
-                        18371, 21520, 22206, 23389, 24182) },
-            { AOM_CDF14(4987, 5368, 5928, 6068, 19114, 20315, 21857, 22253,
-                        22411, 24911, 25380, 26027, 26376) },
-            { AOM_CDF14(5370, 6889, 7247, 7393, 9498, 21114, 21402, 21753,
-                        21981, 24780, 25386, 26517, 27176) },
-            { AOM_CDF14(4816, 4961, 7204, 7326, 8765, 8930, 20169, 20682,
-                        20803, 23188, 23763, 24455, 24940) },
-            { AOM_CDF14(6608, 6740, 8529, 9049, 9257, 9356, 9735, 18827,
-                        19059, 22336, 23204, 23964, 24793) },
-            { AOM_CDF14(5998, 7419, 7781, 8933, 9255, 9549, 9753, 10417,
-                        18898, 22494, 23139, 24764, 25989) },
-            { AOM_CDF14(10660, 11298, 12550, 12957, 13322, 13624, 14040, 15004,
-                        15534, 20714, 21789, 23443, 24861) },
-            { AOM_CDF14(10522, 11530, 12552, 12963, 13378, 13779, 14245, 15235,
-                        15902, 20102, 22696, 23774, 25838) },
-            { AOM_CDF14(10099, 10691, 12639, 13049, 13386, 13665, 14125, 15163,
-                        15636, 19676, 20474, 23519, 25208) },
-            { AOM_CDF14(3144, 5087, 7382, 7504, 7593, 7690, 7801, 8064,
-                        8232, 9248, 9875, 10521, 29048) }
-        }
+            { CDF13(10407, 11208, 12900, 13181, 13823, 14175, 14899,
+                    15656, 15986, 20086, 20995, 22455, 24212) },
+            { CDF13( 4532, 19780, 20057, 20215, 20428, 21071, 21199,
+                    21451, 22099, 24228, 24693, 27032, 29472) },
+            { CDF13( 5273,  5379, 20177, 20270, 20385, 20439, 20949,
+                    21695, 21774, 23138, 24256, 24703, 26679) },
+            { CDF13( 6740,  7167,  7662, 14152, 14536, 14785, 15034,
+                    16741, 18371, 21520, 22206, 23389, 24182) },
+            { CDF13( 4987,  5368,  5928,  6068, 19114, 20315, 21857,
+                    22253, 22411, 24911, 25380, 26027, 26376) },
+            { CDF13( 5370,  6889,  7247,  7393,  9498, 21114, 21402,
+                    21753, 21981, 24780, 25386, 26517, 27176) },
+            { CDF13( 4816,  4961,  7204,  7326,  8765,  8930, 20169,
+                    20682, 20803, 23188, 23763, 24455, 24940) },
+            { CDF13( 6608,  6740,  8529,  9049,  9257,  9356,  9735,
+                    18827, 19059, 22336, 23204, 23964, 24793) },
+            { CDF13( 5998,  7419,  7781,  8933,  9255,  9549,  9753,
+                    10417, 18898, 22494, 23139, 24764, 25989) },
+            { CDF13(10660, 11298, 12550, 12957, 13322, 13624, 14040,
+                    15004, 15534, 20714, 21789, 23443, 24861) },
+            { CDF13(10522, 11530, 12552, 12963, 13378, 13779, 14245,
+                    15235, 15902, 20102, 22696, 23774, 25838) },
+            { CDF13(10099, 10691, 12639, 13049, 13386, 13665, 14125,
+                    15163, 15636, 19676, 20474, 23519, 25208) },
+            { CDF13( 3144,  5087,  7382,  7504,  7593,  7690,  7801,
+                     8064,  8232,  9248,  9875, 10521, 29048) },
+        },
     }, .angle_delta = {
-        { AOM_CDF7(2180, 5032, 7567, 22776, 26989, 30217) },
-        { AOM_CDF7(2301, 5608, 8801, 23487, 26974, 30330) },
-        { AOM_CDF7(3780, 11018, 13699, 19354, 23083, 31286) },
-        { AOM_CDF7(4581, 11226, 15147, 17138, 21834, 28397) },
-        { AOM_CDF7(1737, 10927, 14509, 19588, 22745, 28823) },
-        { AOM_CDF7(2664, 10176, 12485, 17650, 21600, 30495) },
-        { AOM_CDF7(2240, 11096, 15453, 20341, 22561, 28917) },
-        { AOM_CDF7(3605, 10428, 12459, 17676, 21244, 30655) }
+        { CDF6( 2180,  5032,  7567, 22776, 26989, 30217) },
+        { CDF6( 2301,  5608,  8801, 23487, 26974, 30330) },
+        { CDF6( 3780, 11018, 13699, 19354, 23083, 31286) },
+        { CDF6( 4581, 11226, 15147, 17138, 21834, 28397) },
+        { CDF6( 1737, 10927, 14509, 19588, 22745, 28823) },
+        { CDF6( 2664, 10176, 12485, 17650, 21600, 30495) },
+        { CDF6( 2240, 11096, 15453, 20341, 22561, 28917) },
+        { CDF6( 3605, 10428, 12459, 17676, 21244, 30655) },
     }, .filter = {
         {
-            { AOM_CDF3(31935, 32720) },
-            { AOM_CDF3(5568, 32719) },
-            { AOM_CDF3(422, 2938) },
-            { AOM_CDF3(28244, 32608) },
-            { AOM_CDF3(31206, 31953) },
-            { AOM_CDF3(4862, 32121) },
-            { AOM_CDF3(770, 1152) },
-            { AOM_CDF3(20889, 25637) },
+            { CDF2(31935, 32720) }, { CDF2( 5568, 32719) },
+            { CDF2(  422,  2938) }, { CDF2(28244, 32608) },
+            { CDF2(31206, 31953) }, { CDF2( 4862, 32121) },
+            { CDF2(  770,  1152) }, { CDF2(20889, 25637) },
         }, {
-            { AOM_CDF3(31910, 32724) },
-            { AOM_CDF3(4120, 32712) },
-            { AOM_CDF3(305, 2247) },
-            { AOM_CDF3(27403, 32636) },
-            { AOM_CDF3(31022, 32009) },
-            { AOM_CDF3(2963, 32093) },
-            { AOM_CDF3(601, 943) },
-            { AOM_CDF3(14969, 21398) }
-        }
+            { CDF2(31910, 32724) }, { CDF2( 4120, 32712) },
+            { CDF2(  305,  2247) }, { CDF2(27403, 32636) },
+            { CDF2(31022, 32009) }, { CDF2( 2963, 32093) },
+            { CDF2(  601,   943) }, { CDF2(14969, 21398) },
+        },
     }, .newmv_mode = {
-        { AOM_CDF2(24035) },
-        { AOM_CDF2(16630) },
-        { AOM_CDF2(15339) },
-        { AOM_CDF2(8386) },
-        { AOM_CDF2(12222) },
-        { AOM_CDF2(4676) },
+        { CDF1(24035) }, { CDF1(16630) }, { CDF1(15339) },
+        { CDF1( 8386) }, { CDF1(12222) }, { CDF1( 4676) },
     }, .globalmv_mode = {
-        { AOM_CDF2(2175) },
-        { AOM_CDF2(1054) }
+        { CDF1( 2175) }, { CDF1( 1054) },
     }, .refmv_mode = {
-        { AOM_CDF2(23974) },
-        { AOM_CDF2(24188) },
-        { AOM_CDF2(17848) },
-        { AOM_CDF2(28622) },
-        { AOM_CDF2(24312) },
-        { AOM_CDF2(19923) }
+        { CDF1(23974) }, { CDF1(24188) }, { CDF1(17848) },
+        { CDF1(28622) }, { CDF1(24312) }, { CDF1(19923) },
     }, .drl_bit = {
-        { AOM_CDF2(13104) },
-        { AOM_CDF2(24560) },
-        { AOM_CDF2(18945) }
+        { CDF1(13104) }, { CDF1(24560) }, { CDF1(18945) },
     }, .comp_inter_mode = {
-        { AOM_CDF8(7760, 13823, 15808, 17641, 19156, 20666, 26891) },
-        { AOM_CDF8(10730, 19452, 21145, 22749, 24039, 25131, 28724) },
-        { AOM_CDF8(10664, 20221, 21588, 22906, 24295, 25387, 28436) },
-        { AOM_CDF8(13298, 16984, 20471, 24182, 25067, 25736, 26422) },
-        { AOM_CDF8(18904, 23325, 25242, 27432, 27898, 28258, 30758) },
-        { AOM_CDF8(10725, 17454, 20124, 22820, 24195, 25168, 26046) },
-        { AOM_CDF8(17125, 24273, 25814, 27492, 28214, 28704, 30592) },
-        { AOM_CDF8(13046, 23214, 24505, 25942, 27435, 28442, 29330) }
+        { CDF7( 7760, 13823, 15808, 17641, 19156, 20666, 26891) },
+        { CDF7(10730, 19452, 21145, 22749, 24039, 25131, 28724) },
+        { CDF7(10664, 20221, 21588, 22906, 24295, 25387, 28436) },
+        { CDF7(13298, 16984, 20471, 24182, 25067, 25736, 26422) },
+        { CDF7(18904, 23325, 25242, 27432, 27898, 28258, 30758) },
+        { CDF7(10725, 17454, 20124, 22820, 24195, 25168, 26046) },
+        { CDF7(17125, 24273, 25814, 27492, 28214, 28704, 30592) },
+        { CDF7(13046, 23214, 24505, 25942, 27435, 28442, 29330) },
     }, .intra = {
-        { AOM_CDF2(806) },
-        { AOM_CDF2(16662) },
-        { AOM_CDF2(20186) },
-        { AOM_CDF2(26538) }
+        { CDF1(  806) }, { CDF1(16662) }, { CDF1(20186) },
+        { CDF1(26538) },
     }, .comp = {
-        { AOM_CDF2(26828) },
-        { AOM_CDF2(24035) },
-        { AOM_CDF2(12031) },
-        { AOM_CDF2(10640) },
-        { AOM_CDF2(2901) }
+        { CDF1(26828) }, { CDF1(24035) }, { CDF1(12031) },
+        { CDF1(10640) }, { CDF1( 2901) },
     }, .comp_dir = {
-        { AOM_CDF2(1198) },
-        { AOM_CDF2(2070) },
-        { AOM_CDF2(9166) },
-        { AOM_CDF2(7499) },
-        { AOM_CDF2(22475) }
+        { CDF1( 1198) }, { CDF1( 2070) }, { CDF1( 9166) },
+        { CDF1( 7499) }, { CDF1(22475) },
     }, .jnt_comp = {
-        { AOM_CDF2(18244) },
-        { AOM_CDF2(12865) },
-        { AOM_CDF2(7053) },
-        { AOM_CDF2(13259) },
-        { AOM_CDF2(9334) },
-        { AOM_CDF2(4644) }
+        { CDF1(18244) }, { CDF1(12865) }, { CDF1( 7053) },
+        { CDF1(13259) }, { CDF1( 9334) }, { CDF1( 4644) },
     }, .mask_comp = {
-        { AOM_CDF2(26607) },
-        { AOM_CDF2(22891) },
-        { AOM_CDF2(18840) },
-        { AOM_CDF2(24594) },
-        { AOM_CDF2(19934) },
-        { AOM_CDF2(22674) }
+        { CDF1(26607) }, { CDF1(22891) }, { CDF1(18840) },
+        { CDF1(24594) }, { CDF1(19934) }, { CDF1(22674) },
     }, .wedge_comp = {
-        { AOM_CDF2(23431) },
-        { AOM_CDF2(13171) },
-        { AOM_CDF2(11470) },
-        { AOM_CDF2(9770) },
-        { AOM_CDF2(9100) },
-        { AOM_CDF2(8233) },
-        { AOM_CDF2(6172) },
-        { AOM_CDF2(11820) },
-        { AOM_CDF2(7701) },
+        { CDF1(23431) }, { CDF1(13171) }, { CDF1(11470) },
+        { CDF1( 9770) }, { CDF1( 9100) }, { CDF1( 8233) },
+        { CDF1( 6172) }, { CDF1(11820) }, { CDF1( 7701) },
     }, .wedge_idx = {
-        { AOM_CDF16(2438, 4440, 6599, 8663, 11005, 12874, 15751, 18094,
-                    20359, 22362, 24127, 25702, 27752, 29450, 31171) },
-        { AOM_CDF16(806, 3266, 6005, 6738, 7218, 7367, 7771, 14588,
-                    16323, 17367, 18452, 19422, 22839, 26127, 29629) },
-        { AOM_CDF16(2779, 3738, 4683, 7213, 7775, 8017, 8655, 14357,
-                    17939, 21332, 24520, 27470, 29456, 30529, 31656) },
-        { AOM_CDF16(1684, 3625, 5675, 7108, 9302, 11274, 14429, 17144,
-                    19163, 20961, 22884, 24471, 26719, 28714, 30877) },
-        { AOM_CDF16(1142, 3491, 6277, 7314, 8089, 8355, 9023, 13624,
-                    15369, 16730, 18114, 19313, 22521, 26012, 29550) },
-        { AOM_CDF16(2742, 4195, 5727, 8035, 8980, 9336, 10146, 14124,
-                    17270, 20533, 23434, 25972, 27944, 29570, 31416) },
-        { AOM_CDF16(1727, 3948, 6101, 7796, 9841, 12344, 15766, 18944,
-                    20638, 22038, 23963, 25311, 26988, 28766, 31012) },
-        { AOM_CDF16(154, 987, 1925, 2051, 2088, 2111, 2151, 23033,
-                    23703, 24284, 24985, 25684, 27259, 28883, 30911) },
-        { AOM_CDF16(1135, 1322, 1493, 2635, 2696, 2737, 2770, 21016,
-                    22935, 25057, 27251, 29173, 30089, 30960, 31933) },
+        { CDF15( 2438,  4440,  6599,  8663, 11005, 12874, 15751, 18094,
+                20359, 22362, 24127, 25702, 27752, 29450, 31171) },
+        { CDF15(  806,  3266,  6005,  6738,  7218,  7367,  7771, 14588,
+                16323, 17367, 18452, 19422, 22839, 26127, 29629) },
+        { CDF15( 2779,  3738,  4683,  7213,  7775,  8017,  8655, 14357,
+                17939, 21332, 24520, 27470, 29456, 30529, 31656) },
+        { CDF15( 1684,  3625,  5675,  7108,  9302, 11274, 14429, 17144,
+                19163, 20961, 22884, 24471, 26719, 28714, 30877) },
+        { CDF15( 1142,  3491,  6277,  7314,  8089,  8355,  9023, 13624,
+                15369, 16730, 18114, 19313, 22521, 26012, 29550) },
+        { CDF15( 2742,  4195,  5727,  8035,  8980,  9336, 10146, 14124,
+                17270, 20533, 23434, 25972, 27944, 29570, 31416) },
+        { CDF15( 1727,  3948,  6101,  7796,  9841, 12344, 15766, 18944,
+                20638, 22038, 23963, 25311, 26988, 28766, 31012) },
+        { CDF15(  154,   987,  1925,  2051,  2088,  2111,  2151, 23033,
+                23703, 24284, 24985, 25684, 27259, 28883, 30911) },
+        { CDF15( 1135,  1322,  1493,  2635,  2696,  2737,  2770, 21016,
+                22935, 25057, 27251, 29173, 30089, 30960, 31933) },
     }, .interintra = {
-        { AOM_CDF2(16384) },
-        { AOM_CDF2(26887) },
-        { AOM_CDF2(27597) },
-        { AOM_CDF2(30237) }
+        { CDF1(16384) }, { CDF1(26887) }, { CDF1(27597) },
+        { CDF1(30237) },
     }, .interintra_mode = {
-        { AOM_CDF4(8192, 16384, 24576) },
-        { AOM_CDF4(1875, 11082, 27332) },
-        { AOM_CDF4(2473, 9996, 26388) },
-        { AOM_CDF4(4238, 11537, 25926) }
+        { CDF3(8192, 16384, 24576) },
+        { CDF3(1875, 11082, 27332) },
+        { CDF3(2473,  9996, 26388) },
+        { CDF3(4238, 11537, 25926) },
     }, .interintra_wedge = {
-        { AOM_CDF2(20036) },
-        { AOM_CDF2(24957) },
-        { AOM_CDF2(26704) },
-        { AOM_CDF2(27530) },
-        { AOM_CDF2(29564) },
-        { AOM_CDF2(29444) },
-        { AOM_CDF2(26872) },
+        { CDF1(20036) }, { CDF1(24957) }, { CDF1(26704) },
+        { CDF1(27530) }, { CDF1(29564) }, { CDF1(29444) },
+        { CDF1(26872) },
     }, .ref = {
-        {
-            { AOM_CDF2(4897) },
-            { AOM_CDF2(16973) },
-            { AOM_CDF2(29744) },
-        }, {
-            { AOM_CDF2(1555) },
-            { AOM_CDF2(16751) },
-            { AOM_CDF2(30279) },
-        }, {
-            { AOM_CDF2(4236) },
-            { AOM_CDF2(19647) },
-            { AOM_CDF2(31194) },
-        }, {
-            { AOM_CDF2(8650) },
-            { AOM_CDF2(24773) },
-            { AOM_CDF2(31895) },
-        }, {
-            { AOM_CDF2(904) },
-            { AOM_CDF2(11014) },
-            { AOM_CDF2(26875) },
-        }, {
-            { AOM_CDF2(1444) },
-            { AOM_CDF2(15087) },
-            { AOM_CDF2(30304) },
-        }
+        { { CDF1( 4897) }, { CDF1(16973) }, { CDF1(29744) } },
+        { { CDF1( 1555) }, { CDF1(16751) }, { CDF1(30279) } },
+        { { CDF1( 4236) }, { CDF1(19647) }, { CDF1(31194) } },
+        { { CDF1( 8650) }, { CDF1(24773) }, { CDF1(31895) } },
+        { { CDF1(  904) }, { CDF1(11014) }, { CDF1(26875) } },
+        { { CDF1( 1444) }, { CDF1(15087) }, { CDF1(30304) } },
     }, .comp_fwd_ref = {
-        {
-            { AOM_CDF2(4946) },
-            { AOM_CDF2(19891) },
-            { AOM_CDF2(30731) },
-        }, {
-            { AOM_CDF2(9468) },
-            { AOM_CDF2(22441) },
-            { AOM_CDF2(31059) },
-        }, {
-            { AOM_CDF2(1503) },
-            { AOM_CDF2(15160) },
-            { AOM_CDF2(27544) },
-        }
+        { { CDF1( 4946) }, { CDF1(19891) }, { CDF1(30731) } },
+        { { CDF1( 9468) }, { CDF1(22441) }, { CDF1(31059) } },
+        { { CDF1( 1503) }, { CDF1(15160) }, { CDF1(27544) } },
     }, .comp_bwd_ref = {
-        {
-            { AOM_CDF2(2235) },
-            { AOM_CDF2(17182) },
-            { AOM_CDF2(30606) },
-        }, {
-            { AOM_CDF2(1423) },
-            { AOM_CDF2(15175) },
-            { AOM_CDF2(30489) },
-        }
+        { { CDF1( 2235) }, { CDF1(17182) }, { CDF1(30606) } },
+        { { CDF1( 1423) }, { CDF1(15175) }, { CDF1(30489) } },
     }, .comp_uni_ref = {
-        {
-            { AOM_CDF2(5284) },
-            { AOM_CDF2(23152) },
-            { AOM_CDF2(31774) },
-        }, {
-            { AOM_CDF2(3865) },
-            { AOM_CDF2(14173) },
-            { AOM_CDF2(25120) },
-        }, {
-            { AOM_CDF2(3128) },
-            { AOM_CDF2(15270) },
-            { AOM_CDF2(26710) },
-        }
+        { { CDF1( 5284) }, { CDF1(23152) }, { CDF1(31774) } },
+        { { CDF1( 3865) }, { CDF1(14173) }, { CDF1(25120) } },
+        { { CDF1( 3128) }, { CDF1(15270) }, { CDF1(26710) } },
     }, .txsz = {
         {
-            { AOM_CDF2(19968) },
-            { AOM_CDF2(19968) },
-            { AOM_CDF2(24320) }
+            { CDF1(19968) }, { CDF1(19968) }, { CDF1(24320) },
         }, {
-            { AOM_CDF3(12272, 30172) },
-            { AOM_CDF3(12272, 30172) },
-            { AOM_CDF3(18677, 30848) }
-        }, {
-            { AOM_CDF3(12986, 15180) },
-            { AOM_CDF3(12986, 15180) },
-            { AOM_CDF3(24302, 25602) }
+            { CDF2(12272, 30172) }, { CDF2(12272, 30172) },
+            { CDF2(18677, 30848) },
         }, {
-            { AOM_CDF3(5782, 11475) },
-            { AOM_CDF3(5782, 11475) },
-            { AOM_CDF3(16803, 22759) }
-        }
-    }, .txpart = {
-        { { AOM_CDF2(28581) }, { AOM_CDF2(23846) }, { AOM_CDF2(20847) }, },
-        { { AOM_CDF2(24315) }, { AOM_CDF2(18196) }, { AOM_CDF2(12133) }, },
-        { { AOM_CDF2(18791) }, { AOM_CDF2(10887) }, { AOM_CDF2(11005) }, },
-        { { AOM_CDF2(27179) }, { AOM_CDF2(20004) }, { AOM_CDF2(11281) }, },
-        { { AOM_CDF2(26549) }, { AOM_CDF2(19308) }, { AOM_CDF2(14224) }, },
-        { { AOM_CDF2(28015) }, { AOM_CDF2(21546) }, { AOM_CDF2(14400) }, },
-        { { AOM_CDF2(28165) }, { AOM_CDF2(22401) }, { AOM_CDF2(16088) }, },
-    }, .txtp_inter = {
-        { { 0 } }, {
-            { AOM_CDF16(4458, 5560, 7695, 9709, 13330, 14789, 17537, 20266,
-                        21504, 22848, 23934, 25474, 27727, 28915, 30631) },
-            { AOM_CDF16(1645, 2573, 4778, 5711, 7807, 8622, 10522, 15357,
-                        17674, 20408, 22517, 25010, 27116, 28856, 30749) },
-            { AOM_CDF16(2048, 4096, 6144, 8192, 10240, 12288, 14336, 16384,
-                        18432, 20480, 22528, 24576, 26624, 28672, 30720) },
-            { AOM_CDF16(2048, 4096, 6144, 8192, 10240, 12288, 14336, 16384,
-                        18432, 20480, 22528, 24576, 26624, 28672, 30720) },
+            { CDF2(12986, 15180) }, { CDF2(12986, 15180) },
+            { CDF2(24302, 25602) },
         }, {
-            { AOM_CDF12(2731, 5461, 8192, 10923, 13653, 16384, 19115, 21845,
-                        24576, 27307, 30037) },
-            { AOM_CDF12(2731, 5461, 8192, 10923, 13653, 16384, 19115, 21845,
-                        24576, 27307, 30037) },
-            { AOM_CDF12(770, 2421, 5225, 12907, 15819, 18927, 21561, 24089,
-                        26595, 28526, 30529) },
-            { AOM_CDF12(2731, 5461, 8192, 10923, 13653, 16384, 19115, 21845,
-                        24576, 27307, 30037) },
-        }, {
-            { AOM_CDF2(16384) },
-            { AOM_CDF2(4167) },
-            { AOM_CDF2(1998) },
-            { AOM_CDF2(748) },
+            { CDF2( 5782, 11475) }, { CDF2( 5782, 11475) },
+            { CDF2(16803, 22759) },
         },
-    }, .txtp_intra = {
-        { { { 0 } } }, {
-            {
-                { AOM_CDF7(1535, 8035, 9461, 12751, 23467, 27825) },
-                { AOM_CDF7(564, 3335, 9709, 10870, 18143, 28094) },
-                { AOM_CDF7(672, 3247, 3676, 11982, 19415, 23127) },
-                { AOM_CDF7(5279, 13885, 15487, 18044, 23527, 30252) },
-                { AOM_CDF7(4423, 6074, 7985, 10416, 25693, 29298) },
-                { AOM_CDF7(1486, 4241, 9460, 10662, 16456, 27694) },
-                { AOM_CDF7(439, 2838, 3522, 6737, 18058, 23754) },
-                { AOM_CDF7(1190, 4233, 4855, 11670, 20281, 24377) },
-                { AOM_CDF7(1045, 4312, 8647, 10159, 18644, 29335) },
-                { AOM_CDF7(202, 3734, 4747, 7298, 17127, 24016) },
-                { AOM_CDF7(447, 4312, 6819, 8884, 16010, 23858) },
-                { AOM_CDF7(277, 4369, 5255, 8905, 16465, 22271) },
-                { AOM_CDF7(3409, 5436, 10599, 15599, 19687, 24040) },
-            }, {
-                { AOM_CDF7(1870, 13742, 14530, 16498, 23770, 27698) },
-                { AOM_CDF7(326, 8796, 14632, 15079, 19272, 27486) },
-                { AOM_CDF7(484, 7576, 7712, 14443, 19159, 22591) },
-                { AOM_CDF7(1126, 15340, 15895, 17023, 20896, 30279) },
-                { AOM_CDF7(655, 4854, 5249, 5913, 22099, 27138) },
-                { AOM_CDF7(1299, 6458, 8885, 9290, 14851, 25497) },
-                { AOM_CDF7(311, 5295, 5552, 6885, 16107, 22672) },
-                { AOM_CDF7(883, 8059, 8270, 11258, 17289, 21549) },
-                { AOM_CDF7(741, 7580, 9318, 10345, 16688, 29046) },
-                { AOM_CDF7(110, 7406, 7915, 9195, 16041, 23329) },
-                { AOM_CDF7(363, 7974, 9357, 10673, 15629, 24474) },
-                { AOM_CDF7(153, 7647, 8112, 9936, 15307, 19996) },
-                { AOM_CDF7(3511, 6332, 11165, 15335, 19323, 23594) },
-            }, {
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-            }, {
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-                { AOM_CDF7(4681, 9362, 14043, 18725, 23406, 28087) },
-            },
+    }, .txpart = {
+        { { CDF1(28581) }, { CDF1(23846) }, { CDF1(20847) } },
+        { { CDF1(24315) }, { CDF1(18196) }, { CDF1(12133) } },
+        { { CDF1(18791) }, { CDF1(10887) }, { CDF1(11005) } },
+        { { CDF1(27179) }, { CDF1(20004) }, { CDF1(11281) } },
+        { { CDF1(26549) }, { CDF1(19308) }, { CDF1(14224) } },
+        { { CDF1(28015) }, { CDF1(21546) }, { CDF1(14400) } },
+        { { CDF1(28165) }, { CDF1(22401) }, { CDF1(16088) } },
+    }, .txtp_inter1 = {
+        { CDF15( 4458,  5560,  7695,  9709, 13330, 14789, 17537, 20266,
+                21504, 22848, 23934, 25474, 27727, 28915, 30631) },
+        { CDF15( 1645,  2573,  4778,  5711,  7807,  8622, 10522, 15357,
+                17674, 20408, 22517, 25010, 27116, 28856, 30749) },
+    }, .txtp_inter2 = {
+        CDF11(  770,  2421,  5225, 12907, 15819, 18927,
+              21561, 24089, 26595, 28526, 30529)
+    }, .txtp_inter3 = {
+        { CDF1(16384) }, { CDF1( 4167) }, { CDF1( 1998) }, { CDF1(  748) },
+    }, .txtp_intra1 = {
+        {
+            { CDF6( 1535,  8035,  9461, 12751, 23467, 27825) },
+            { CDF6(  564,  3335,  9709, 10870, 18143, 28094) },
+            { CDF6(  672,  3247,  3676, 11982, 19415, 23127) },
+            { CDF6( 5279, 13885, 15487, 18044, 23527, 30252) },
+            { CDF6( 4423,  6074,  7985, 10416, 25693, 29298) },
+            { CDF6( 1486,  4241,  9460, 10662, 16456, 27694) },
+            { CDF6(  439,  2838,  3522,  6737, 18058, 23754) },
+            { CDF6( 1190,  4233,  4855, 11670, 20281, 24377) },
+            { CDF6( 1045,  4312,  8647, 10159, 18644, 29335) },
+            { CDF6(  202,  3734,  4747,  7298, 17127, 24016) },
+            { CDF6(  447,  4312,  6819,  8884, 16010, 23858) },
+            { CDF6(  277,  4369,  5255,  8905, 16465, 22271) },
+            { CDF6( 3409,  5436, 10599, 15599, 19687, 24040) },
         }, {
-            {
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-            }, {
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-            }, {
-                { AOM_CDF5(1127, 12814, 22772, 27483) },
-                { AOM_CDF5(145, 6761, 11980, 26667) },
-                { AOM_CDF5(362, 5887, 11678, 16725) },
-                { AOM_CDF5(385, 15213, 18587, 30693) },
-                { AOM_CDF5(25, 2914, 23134, 27903) },
-                { AOM_CDF5(60, 4470, 11749, 23991) },
-                { AOM_CDF5(37, 3332, 14511, 21448) },
-                { AOM_CDF5(157, 6320, 13036, 17439) },
-                { AOM_CDF5(119, 6719, 12906, 29396) },
-                { AOM_CDF5(47, 5537, 12576, 21499) },
-                { AOM_CDF5(269, 6076, 11258, 23115) },
-                { AOM_CDF5(83, 5615, 12001, 17228) },
-                { AOM_CDF5(1968, 5556, 12023, 18547) },
-            }, {
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-                { AOM_CDF5(6554, 13107, 19661, 26214) },
-            },
+            { CDF6( 1870, 13742, 14530, 16498, 23770, 27698) },
+            { CDF6(  326,  8796, 14632, 15079, 19272, 27486) },
+            { CDF6(  484,  7576,  7712, 14443, 19159, 22591) },
+            { CDF6( 1126, 15340, 15895, 17023, 20896, 30279) },
+            { CDF6(  655,  4854,  5249,  5913, 22099, 27138) },
+            { CDF6( 1299,  6458,  8885,  9290, 14851, 25497) },
+            { CDF6(  311,  5295,  5552,  6885, 16107, 22672) },
+            { CDF6(  883,  8059,  8270, 11258, 17289, 21549) },
+            { CDF6(  741,  7580,  9318, 10345, 16688, 29046) },
+            { CDF6(  110,  7406,  7915,  9195, 16041, 23329) },
+            { CDF6(  363,  7974,  9357, 10673, 15629, 24474) },
+            { CDF6(  153,  7647,  8112,  9936, 15307, 19996) },
+            { CDF6( 3511,  6332, 11165, 15335, 19323, 23594) },
+        },
+    }, .txtp_intra2 = {
+        {
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+        }, {
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+            { CDF4( 6554, 13107, 19661, 26214) },
+        }, {
+            { CDF4( 1127, 12814, 22772, 27483) },
+            { CDF4(  145,  6761, 11980, 26667) },
+            { CDF4(  362,  5887, 11678, 16725) },
+            { CDF4(  385, 15213, 18587, 30693) },
+            { CDF4(   25,  2914, 23134, 27903) },
+            { CDF4(   60,  4470, 11749, 23991) },
+            { CDF4(   37,  3332, 14511, 21448) },
+            { CDF4(  157,  6320, 13036, 17439) },
+            { CDF4(  119,  6719, 12906, 29396) },
+            { CDF4(   47,  5537, 12576, 21499) },
+            { CDF4(  269,  6076, 11258, 23115) },
+            { CDF4(   83,  5615, 12001, 17228) },
+            { CDF4( 1968,  5556, 12023, 18547) },
         },
     }, .skip = {
-        { AOM_CDF2(31671) },
-        { AOM_CDF2(16515) },
-        { AOM_CDF2(4576) }
+        { CDF1(31671) }, { CDF1(16515) }, { CDF1( 4576) },
     }, .skip_mode = {
-        { AOM_CDF2(32621) },
-        { AOM_CDF2(20708) },
-        { AOM_CDF2(8127) }
+        { CDF1(32621) }, { CDF1(20708) }, { CDF1( 8127) },
     }, .partition = {
         {
             // 128x128 -> 64x64
-            { AOM_CDF8(27899, 28219, 28529, 32484, 32539, 32619, 32639) },
-            { AOM_CDF8(6607, 6990, 8268, 32060, 32219, 32338, 32371) },
-            { AOM_CDF8(5429, 6676, 7122, 32027, 32227, 32531, 32582) },
-            { AOM_CDF8(711, 966, 1172, 32448, 32538, 32617, 32664) },
+            { CDF7(27899, 28219, 28529, 32484, 32539, 32619, 32639) },
+            { CDF7( 6607,  6990,  8268, 32060, 32219, 32338, 32371) },
+            { CDF7( 5429,  6676,  7122, 32027, 32227, 32531, 32582) },
+            { CDF7(  711,   966,  1172, 32448, 32538, 32617, 32664) },
         }, {
             // 64x64 -> 32x32
-            { AOM_CDF10(20137, 21547, 23078, 29566, 29837, 30261, 30524, 30892,
-                        31724) },
-            { AOM_CDF10(6732, 7490, 9497, 27944, 28250, 28515, 28969, 29630,
-                        30104) },
-            { AOM_CDF10(5945, 7663, 8348, 28683, 29117, 29749, 30064, 30298,
-                        32238) },
-            { AOM_CDF10(870, 1212, 1487, 31198, 31394, 31574, 31743, 31881,
-                        32332) },
+            { CDF9(20137, 21547, 23078, 29566, 29837,
+                   30261, 30524, 30892, 31724) },
+            { CDF9( 6732,  7490,  9497, 27944, 28250,
+                   28515, 28969, 29630, 30104) },
+            { CDF9( 5945,  7663,  8348, 28683, 29117,
+                   29749, 30064, 30298, 32238) },
+            { CDF9(  870,  1212,  1487, 31198, 31394,
+                   31574, 31743, 31881, 32332) },
         }, {
             // 32x32 -> 16x16
-            { AOM_CDF10(18462, 20920, 23124, 27647, 28227, 29049, 29519, 30178,
-                        31544) },
-            { AOM_CDF10(7689, 9060, 12056, 24992, 25660, 26182, 26951, 28041,
-                        29052) },
-            { AOM_CDF10(6015, 9009, 10062, 24544, 25409, 26545, 27071, 27526,
-                        32047) },
-            { AOM_CDF10(1394, 2208, 2796, 28614, 29061, 29466, 29840, 30185,
-                        31899) },
+            { CDF9(18462, 20920, 23124, 27647, 28227,
+                   29049, 29519, 30178, 31544) },
+            { CDF9( 7689,  9060, 12056, 24992, 25660,
+                   26182, 26951, 28041, 29052) },
+            { CDF9( 6015,  9009, 10062, 24544, 25409,
+                   26545, 27071, 27526, 32047) },
+            { CDF9( 1394,  2208,  2796, 28614, 29061,
+                   29466, 29840, 30185, 31899) },
         }, {
             // 16x16 -> 8x8
-            { AOM_CDF10(15597, 20929, 24571, 26706, 27664, 28821, 29601, 30571,
-                        31902) },
-            { AOM_CDF10(7925, 11043, 16785, 22470, 23971, 25043, 26651, 28701,
-                        29834) },
-            { AOM_CDF10(5414, 13269, 15111, 20488, 22360, 24500, 25537, 26336,
-                        32117) },
-            { AOM_CDF10(2662, 6362, 8614, 20860, 23053, 24778, 26436, 27829,
-                        31171) },
+            { CDF9(15597, 20929, 24571, 26706, 27664,
+                   28821, 29601, 30571, 31902) },
+            { CDF9( 7925, 11043, 16785, 22470, 23971,
+                   25043, 26651, 28701, 29834) },
+            { CDF9( 5414, 13269, 15111, 20488, 22360,
+                   24500, 25537, 26336, 32117) },
+            { CDF9( 2662,  6362,  8614, 20860, 23053,
+                   24778, 26436, 27829, 31171) },
         }, {
             // 8x8 -> 4x4 only supports the four legacy partition types
-            { AOM_CDF4(19132, 25510, 30392) },
-            { AOM_CDF4(13928, 19855, 28540) },
-            { AOM_CDF4(12522, 23679, 28629) },
-            { AOM_CDF4(9896, 18783, 25853) },
-        }
+            { CDF3(19132, 25510, 30392) },
+            { CDF3(13928, 19855, 28540) },
+            { CDF3(12522, 23679, 28629) },
+            { CDF3( 9896, 18783, 25853) },
+        },
     }, .seg_pred = {
-        { AOM_CDF2(128 * 128) },
-        { AOM_CDF2(128 * 128) },
-        { AOM_CDF2(128 * 128) }
+        { CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
     }, .seg_id = {
-        { AOM_CDF8(5622, 7893, 16093, 18233, 27809, 28373, 32533), },
-        { AOM_CDF8(14274, 18230, 22557, 24935, 29980, 30851, 32344), },
-        { AOM_CDF8(27527, 28487, 28723, 28890, 32397, 32647, 32679), },
+        { CDF7( 5622,  7893, 16093, 18233, 27809, 28373, 32533) },
+        { CDF7(14274, 18230, 22557, 24935, 29980, 30851, 32344) },
+        { CDF7(27527, 28487, 28723, 28890, 32397, 32647, 32679) },
     }, .cfl_sign = {
-        AOM_CDF8(1418, 2123, 13340, 18405, 26972, 28343, 32294)
+        CDF7( 1418,  2123, 13340, 18405, 26972, 28343, 32294)
     }, .cfl_alpha = {
-        { AOM_CDF16(7637, 20719, 31401, 32481, 32657, 32688, 32692, 32696,
-                    32700, 32704, 32708, 32712, 32716, 32720, 32724) },
-        { AOM_CDF16(14365, 23603, 28135, 31168, 32167, 32395, 32487, 32573,
-                    32620, 32647, 32668, 32672, 32676, 32680, 32684) },
-        { AOM_CDF16(11532, 22380, 28445, 31360, 32349, 32523, 32584, 32649,
-                    32673, 32677, 32681, 32685, 32689, 32693, 32697) },
-        { AOM_CDF16(26990, 31402, 32282, 32571, 32692, 32696, 32700, 32704,
-                    32708, 32712, 32716, 32720, 32724, 32728, 32732) },
-        { AOM_CDF16(17248, 26058, 28904, 30608, 31305, 31877, 32126, 32321,
-                    32394, 32464, 32516, 32560, 32576, 32593, 32622) },
-        { AOM_CDF16(14738, 21678, 25779, 27901, 29024, 30302, 30980, 31843,
-                    32144, 32413, 32520, 32594, 32622, 32656, 32660) }
+        { CDF15( 7637, 20719, 31401, 32481, 32657, 32688, 32692, 32696,
+                32700, 32704, 32708, 32712, 32716, 32720, 32724) },
+        { CDF15(14365, 23603, 28135, 31168, 32167, 32395, 32487, 32573,
+                32620, 32647, 32668, 32672, 32676, 32680, 32684) },
+        { CDF15(11532, 22380, 28445, 31360, 32349, 32523, 32584, 32649,
+                32673, 32677, 32681, 32685, 32689, 32693, 32697) },
+        { CDF15(26990, 31402, 32282, 32571, 32692, 32696, 32700, 32704,
+                32708, 32712, 32716, 32720, 32724, 32728, 32732) },
+        { CDF15(17248, 26058, 28904, 30608, 31305, 31877, 32126, 32321,
+                32394, 32464, 32516, 32560, 32576, 32593, 32622) },
+        { CDF15(14738, 21678, 25779, 27901, 29024, 30302, 30980, 31843,
+                32144, 32413, 32520, 32594, 32622, 32656, 32660) },
     }, .restore_wiener = {
-        AOM_CDF2(11570)
+        CDF1(11570)
     }, .restore_sgrproj = {
-        AOM_CDF2(16855)
+        CDF1(16855)
     }, .restore_switchable = {
-        AOM_CDF3(9413, 22581)
+        CDF2( 9413, 22581)
     }, .delta_q = {
-        AOM_CDF4(28160, 32120, 32677)
+        CDF3(28160, 32120, 32677)
     }, .delta_lf = {
-        { AOM_CDF4(28160, 32120, 32677) },
-        { AOM_CDF4(28160, 32120, 32677) },
-        { AOM_CDF4(28160, 32120, 32677) },
-        { AOM_CDF4(28160, 32120, 32677) },
-        { AOM_CDF4(28160, 32120, 32677) },
+        { CDF3(28160, 32120, 32677) },
+        { CDF3(28160, 32120, 32677) },
+        { CDF3(28160, 32120, 32677) },
+        { CDF3(28160, 32120, 32677) },
+        { CDF3(28160, 32120, 32677) },
     }, .motion_mode = {
-        [BS_8x8]     = { AOM_CDF3(7651, 24760) },
-        [BS_8x16]    = { AOM_CDF3(4738, 24765) },
-        [BS_8x32]    = { AOM_CDF3(28799, 31390) },
-        [BS_16x8]    = { AOM_CDF3(5391, 25528) },
-        [BS_16x16]   = { AOM_CDF3(19419, 26810) },
-        [BS_16x32]   = { AOM_CDF3(5123, 23606) },
-        [BS_16x64]   = { AOM_CDF3(28973, 31594) },
-        [BS_32x8]    = { AOM_CDF3(26431, 30774) },
-        [BS_32x16]   = { AOM_CDF3(11606, 24308) },
-        [BS_32x32]   = { AOM_CDF3(26260, 29116) },
-        [BS_32x64]   = { AOM_CDF3(20360, 28062) },
-        [BS_64x16]   = { AOM_CDF3(29742, 31203) },
-        [BS_64x32]   = { AOM_CDF3(21679, 26830) },
-        [BS_64x64]   = { AOM_CDF3(29516, 30701) },
-        [BS_64x128]  = { AOM_CDF3(28898, 30397) },
-        [BS_128x64]  = { AOM_CDF3(30878, 31335) },
-        [BS_128x128] = { AOM_CDF3(32507, 32558) },
+        [BS_8x8]     = { CDF2( 7651, 24760) },
+        [BS_8x16]    = { CDF2( 4738, 24765) },
+        [BS_8x32]    = { CDF2(28799, 31390) },
+        [BS_16x8]    = { CDF2( 5391, 25528) },
+        [BS_16x16]   = { CDF2(19419, 26810) },
+        [BS_16x32]   = { CDF2( 5123, 23606) },
+        [BS_16x64]   = { CDF2(28973, 31594) },
+        [BS_32x8]    = { CDF2(26431, 30774) },
+        [BS_32x16]   = { CDF2(11606, 24308) },
+        [BS_32x32]   = { CDF2(26260, 29116) },
+        [BS_32x64]   = { CDF2(20360, 28062) },
+        [BS_64x16]   = { CDF2(29742, 31203) },
+        [BS_64x32]   = { CDF2(21679, 26830) },
+        [BS_64x64]   = { CDF2(29516, 30701) },
+        [BS_64x128]  = { CDF2(28898, 30397) },
+        [BS_128x64]  = { CDF2(30878, 31335) },
+        [BS_128x128] = { CDF2(32507, 32558) },
     }, .obmc = {
-        [BS_8x8]     = { AOM_CDF2(10437) },
-        [BS_8x16]    = { AOM_CDF2(9371) },
-        [BS_8x32]    = { AOM_CDF2(23664) },
-        [BS_16x8]    = { AOM_CDF2(9301) },
-        [BS_16x16]   = { AOM_CDF2(17432) },
-        [BS_16x32]   = { AOM_CDF2(14423) },
-        [BS_16x64]   = { AOM_CDF2(24008) },
-        [BS_32x8]    = { AOM_CDF2(20901) },
-        [BS_32x16]   = { AOM_CDF2(15142) },
-        [BS_32x32]   = { AOM_CDF2(25817) },
-        [BS_32x64]   = { AOM_CDF2(22823) },
-        [BS_64x16]   = { AOM_CDF2(26879) },
-        [BS_64x32]   = { AOM_CDF2(22083) },
-        [BS_64x64]   = { AOM_CDF2(30128) },
-        [BS_64x128]  = { AOM_CDF2(31014) },
-        [BS_128x64]  = { AOM_CDF2(31560) },
-        [BS_128x128] = { AOM_CDF2(32638) },
+        [BS_8x8]     = { CDF1(10437) },
+        [BS_8x16]    = { CDF1( 9371) },
+        [BS_8x32]    = { CDF1(23664) },
+        [BS_16x8]    = { CDF1( 9301) },
+        [BS_16x16]   = { CDF1(17432) },
+        [BS_16x32]   = { CDF1(14423) },
+        [BS_16x64]   = { CDF1(24008) },
+        [BS_32x8]    = { CDF1(20901) },
+        [BS_32x16]   = { CDF1(15142) },
+        [BS_32x32]   = { CDF1(25817) },
+        [BS_32x64]   = { CDF1(22823) },
+        [BS_64x16]   = { CDF1(26879) },
+        [BS_64x32]   = { CDF1(22083) },
+        [BS_64x64]   = { CDF1(30128) },
+        [BS_64x128]  = { CDF1(31014) },
+        [BS_128x64]  = { CDF1(31560) },
+        [BS_128x128] = { CDF1(32638) },
     }, .pal_y = {
-        { { AOM_CDF2(31676) }, { AOM_CDF2(3419) }, { AOM_CDF2(1261) } },
-        { { AOM_CDF2(31912) }, { AOM_CDF2(2859) }, { AOM_CDF2(980) } },
-        { { AOM_CDF2(31823) }, { AOM_CDF2(3400) }, { AOM_CDF2(781) } },
-        { { AOM_CDF2(32030) }, { AOM_CDF2(3561) }, { AOM_CDF2(904) } },
-        { { AOM_CDF2(32309) }, { AOM_CDF2(7337) }, { AOM_CDF2(1462) } },
-        { { AOM_CDF2(32265) }, { AOM_CDF2(4015) }, { AOM_CDF2(1521) } },
-        { { AOM_CDF2(32450) }, { AOM_CDF2(7946) }, { AOM_CDF2(129) } },
+        { { CDF1(31676) }, { CDF1( 3419) }, { CDF1( 1261) } },
+        { { CDF1(31912) }, { CDF1( 2859) }, { CDF1(  980) } },
+        { { CDF1(31823) }, { CDF1( 3400) }, { CDF1(  781) } },
+        { { CDF1(32030) }, { CDF1( 3561) }, { CDF1(  904) } },
+        { { CDF1(32309) }, { CDF1( 7337) }, { CDF1( 1462) } },
+        { { CDF1(32265) }, { CDF1( 4015) }, { CDF1( 1521) } },
+        { { CDF1(32450) }, { CDF1( 7946) }, { CDF1(  129) } },
     }, .pal_sz = {
         {
-            { AOM_CDF7(7952, 13000, 18149, 21478, 25527, 29241) },
-            { AOM_CDF7(7139, 11421, 16195, 19544, 23666, 28073) },
-            { AOM_CDF7(7788, 12741, 17325, 20500, 24315, 28530) },
-            { AOM_CDF7(8271, 14064, 18246, 21564, 25071, 28533) },
-            { AOM_CDF7(12725, 19180, 21863, 24839, 27535, 30120) },
-            { AOM_CDF7(9711, 14888, 16923, 21052, 25661, 27875) },
-            { AOM_CDF7(14940, 20797, 21678, 24186, 27033, 28999) },
+            { CDF6( 7952, 13000, 18149, 21478, 25527, 29241) },
+            { CDF6( 7139, 11421, 16195, 19544, 23666, 28073) },
+            { CDF6( 7788, 12741, 17325, 20500, 24315, 28530) },
+            { CDF6( 8271, 14064, 18246, 21564, 25071, 28533) },
+            { CDF6(12725, 19180, 21863, 24839, 27535, 30120) },
+            { CDF6( 9711, 14888, 16923, 21052, 25661, 27875) },
+            { CDF6(14940, 20797, 21678, 24186, 27033, 28999) },
         }, {
-            { AOM_CDF7(8713, 19979, 27128, 29609, 31331, 32272) },
-            { AOM_CDF7(5839, 15573, 23581, 26947, 29848, 31700) },
-            { AOM_CDF7(4426, 11260, 17999, 21483, 25863, 29430) },
-            { AOM_CDF7(3228, 9464, 14993, 18089, 22523, 27420) },
-            { AOM_CDF7(3768, 8886, 13091, 17852, 22495, 27207) },
-            { AOM_CDF7(2464, 8451, 12861, 21632, 25525, 28555) },
-            { AOM_CDF7(1269, 5435, 10433, 18963, 21700, 25865) },
-        }
+            { CDF6( 8713, 19979, 27128, 29609, 31331, 32272) },
+            { CDF6( 5839, 15573, 23581, 26947, 29848, 31700) },
+            { CDF6( 4426, 11260, 17999, 21483, 25863, 29430) },
+            { CDF6( 3228,  9464, 14993, 18089, 22523, 27420) },
+            { CDF6( 3768,  8886, 13091, 17852, 22495, 27207) },
+            { CDF6( 2464,  8451, 12861, 21632, 25525, 28555) },
+            { CDF6( 1269,  5435, 10433, 18963, 21700, 25865) },
+        },
     }, .pal_uv = {
-        { AOM_CDF2(32461) }, { AOM_CDF2(21488) },
+        { CDF1(32461) }, { CDF1(21488) },
     }, .color_map = {
         { /* y */
             {
-                { AOM_CDF2(28710) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(10553) },
-                { AOM_CDF2(27036) },
-                { AOM_CDF2(31603) },
+                { CDF1(28710) }, { CDF1(16384) }, { CDF1(10553) },
+                { CDF1(27036) }, { CDF1(31603) },
             }, {
-                { AOM_CDF3(27877, 30490) },
-                { AOM_CDF3(11532, 25697) },
-                { AOM_CDF3(6544, 30234) },
-                { AOM_CDF3(23018, 28072) },
-                { AOM_CDF3(31915, 32385) },
+                { CDF2(27877, 30490) }, { CDF2(11532, 25697) },
+                { CDF2( 6544, 30234) }, { CDF2(23018, 28072) },
+                { CDF2(31915, 32385) },
             }, {
-                { AOM_CDF4(25572, 28046, 30045) },
-                { AOM_CDF4(9478, 21590, 27256) },
-                { AOM_CDF4(7248, 26837, 29824) },
-                { AOM_CDF4(19167, 24486, 28349) },
-                { AOM_CDF4(31400, 31825, 32250) },
+                { CDF3(25572, 28046, 30045) },
+                { CDF3( 9478, 21590, 27256) },
+                { CDF3( 7248, 26837, 29824) },
+                { CDF3(19167, 24486, 28349) },
+                { CDF3(31400, 31825, 32250) },
             }, {
-                { AOM_CDF5(24779, 26955, 28576, 30282) },
-                { AOM_CDF5(8669, 20364, 24073, 28093) },
-                { AOM_CDF5(4255, 27565, 29377, 31067) },
-                { AOM_CDF5(19864, 23674, 26716, 29530) },
-                { AOM_CDF5(31646, 31893, 32147, 32426) },
+                { CDF4(24779, 26955, 28576, 30282) },
+                { CDF4( 8669, 20364, 24073, 28093) },
+                { CDF4( 4255, 27565, 29377, 31067) },
+                { CDF4(19864, 23674, 26716, 29530) },
+                { CDF4(31646, 31893, 32147, 32426) },
             }, {
-                { AOM_CDF6(23132, 25407, 26970, 28435, 30073) },
-                { AOM_CDF6(7443, 17242, 20717, 24762, 27982) },
-                { AOM_CDF6(6300, 24862, 26944, 28784, 30671) },
-                { AOM_CDF6(18916, 22895, 25267, 27435, 29652) },
-                { AOM_CDF6(31270, 31550, 31808, 32059, 32353) },
+                { CDF5(23132, 25407, 26970, 28435, 30073) },
+                { CDF5( 7443, 17242, 20717, 24762, 27982) },
+                { CDF5( 6300, 24862, 26944, 28784, 30671) },
+                { CDF5(18916, 22895, 25267, 27435, 29652) },
+                { CDF5(31270, 31550, 31808, 32059, 32353) },
             }, {
-                { AOM_CDF7(23105, 25199, 26464, 27684, 28931, 30318) },
-                { AOM_CDF7(6950, 15447, 18952, 22681, 25567, 28563) },
-                { AOM_CDF7(7560, 23474, 25490, 27203, 28921, 30708) },
-                { AOM_CDF7(18544, 22373, 24457, 26195, 28119, 30045) },
-                { AOM_CDF7(31198, 31451, 31670, 31882, 32123, 32391) },
+                { CDF6(23105, 25199, 26464, 27684, 28931, 30318) },
+                { CDF6( 6950, 15447, 18952, 22681, 25567, 28563) },
+                { CDF6( 7560, 23474, 25490, 27203, 28921, 30708) },
+                { CDF6(18544, 22373, 24457, 26195, 28119, 30045) },
+                { CDF6(31198, 31451, 31670, 31882, 32123, 32391) },
             }, {
-                { AOM_CDF8(21689, 23883, 25163, 26352, 27506, 28827, 30195) },
-                { AOM_CDF8(6892, 15385, 17840, 21606, 24287, 26753, 29204) },
-                { AOM_CDF8(5651, 23182, 25042, 26518, 27982, 29392, 30900) },
-                { AOM_CDF8(19349, 22578, 24418, 25994, 27524, 29031, 30448) },
-                { AOM_CDF8(31028, 31270, 31504, 31705, 31927, 32153, 32392) },
+                { CDF7(21689, 23883, 25163, 26352, 27506, 28827, 30195) },
+                { CDF7( 6892, 15385, 17840, 21606, 24287, 26753, 29204) },
+                { CDF7( 5651, 23182, 25042, 26518, 27982, 29392, 30900) },
+                { CDF7(19349, 22578, 24418, 25994, 27524, 29031, 30448) },
+                { CDF7(31028, 31270, 31504, 31705, 31927, 32153, 32392) },
             },
         }, { /* uv */
             {
-                { AOM_CDF2(29089) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(8713) },
-                { AOM_CDF2(29257) },
-                { AOM_CDF2(31610) },
+                { CDF1(29089) }, { CDF1(16384) }, { CDF1( 8713) },
+                { CDF1(29257) }, { CDF1(31610) },
             }, {
-                { AOM_CDF3(25257, 29145) },
-                { AOM_CDF3(12287, 27293) },
-                { AOM_CDF3(7033, 27960) },
-                { AOM_CDF3(20145, 25405) },
-                { AOM_CDF3(30608, 31639) },
+                { CDF2(25257, 29145) }, { CDF2(12287, 27293) },
+                { CDF2( 7033, 27960) }, { CDF2(20145, 25405) },
+                { CDF2(30608, 31639) },
             }, {
-                { AOM_CDF4(24210, 27175, 29903) },
-                { AOM_CDF4(9888, 22386, 27214) },
-                { AOM_CDF4(5901, 26053, 29293) },
-                { AOM_CDF4(18318, 22152, 28333) },
-                { AOM_CDF4(30459, 31136, 31926) },
+                { CDF3(24210, 27175, 29903) },
+                { CDF3( 9888, 22386, 27214) },
+                { CDF3( 5901, 26053, 29293) },
+                { CDF3(18318, 22152, 28333) },
+                { CDF3(30459, 31136, 31926) },
             }, {
-                { AOM_CDF5(22980, 25479, 27781, 29986) },
-                { AOM_CDF5(8413, 21408, 24859, 28874) },
-                { AOM_CDF5(2257, 29449, 30594, 31598) },
-                { AOM_CDF5(19189, 21202, 25915, 28620) },
-                { AOM_CDF5(31844, 32044, 32281, 32518) },
+                { CDF4(22980, 25479, 27781, 29986) },
+                { CDF4( 8413, 21408, 24859, 28874) },
+                { CDF4( 2257, 29449, 30594, 31598) },
+                { CDF4(19189, 21202, 25915, 28620) },
+                { CDF4(31844, 32044, 32281, 32518) },
             }, {
-                { AOM_CDF6(22217, 24567, 26637, 28683, 30548) },
-                { AOM_CDF6(7307, 16406, 19636, 24632, 28424) },
-                { AOM_CDF6(4441, 25064, 26879, 28942, 30919) },
-                { AOM_CDF6(17210, 20528, 23319, 26750, 29582) },
-                { AOM_CDF6(30674, 30953, 31396, 31735, 32207) },
+                { CDF5(22217, 24567, 26637, 28683, 30548) },
+                { CDF5( 7307, 16406, 19636, 24632, 28424) },
+                { CDF5( 4441, 25064, 26879, 28942, 30919) },
+                { CDF5(17210, 20528, 23319, 26750, 29582) },
+                { CDF5(30674, 30953, 31396, 31735, 32207) },
             }, {
-                { AOM_CDF7(21239, 23168, 25044, 26962, 28705, 30506) },
-                { AOM_CDF7(6545, 15012, 18004, 21817, 25503, 28701) },
-                { AOM_CDF7(3448, 26295, 27437, 28704, 30126, 31442) },
-                { AOM_CDF7(15889, 18323, 21704, 24698, 26976, 29690) },
-                { AOM_CDF7(30988, 31204, 31479, 31734, 31983, 32325) },
+                { CDF6(21239, 23168, 25044, 26962, 28705, 30506) },
+                { CDF6( 6545, 15012, 18004, 21817, 25503, 28701) },
+                { CDF6( 3448, 26295, 27437, 28704, 30126, 31442) },
+                { CDF6(15889, 18323, 21704, 24698, 26976, 29690) },
+                { CDF6(30988, 31204, 31479, 31734, 31983, 32325) },
             }, {
-                { AOM_CDF8(21442, 23288, 24758, 26246, 27649, 28980, 30563) },
-                { AOM_CDF8(5863, 14933, 17552, 20668, 23683, 26411, 29273) },
-                { AOM_CDF8(3415, 25810, 26877, 27990, 29223, 30394, 31618) },
-                { AOM_CDF8(17965, 20084, 22232, 23974, 26274, 28402, 30390) },
-                { AOM_CDF8(31190, 31329, 31516, 31679, 31825, 32026, 32322) },
+                { CDF7(21442, 23288, 24758, 26246, 27649, 28980, 30563) },
+                { CDF7( 5863, 14933, 17552, 20668, 23683, 26411, 29273) },
+                { CDF7( 3415, 25810, 26877, 27990, 29223, 30394, 31618) },
+                { CDF7(17965, 20084, 22232, 23974, 26274, 28402, 30390) },
+                { CDF7(31190, 31329, 31516, 31679, 31825, 32026, 32322) },
             },
         },
     }, .intrabc = {
-        AOM_CDF2(30531)
+        CDF1(30531)
     },
 };
 
 static const CdfMvComponent default_mv_component_cdf = {
     .classes = {
-        AOM_CDF11(28672, 30976, 31858, 32320, 32551, 32656, 32740,
-                  32757, 32762, 32767)
+        CDF10(28672, 30976, 31858, 32320, 32551,
+              32656, 32740, 32757, 32762, 32767)
     }, .class0 = {
-        AOM_CDF2(216 * 128)
+        CDF1(27648)
     }, .classN = {
-        { AOM_CDF2(128 * 136) },
-        { AOM_CDF2(128 * 140) },
-        { AOM_CDF2(128 * 148) },
-        { AOM_CDF2(128 * 160) },
-        { AOM_CDF2(128 * 176) },
-        { AOM_CDF2(128 * 192) },
-        { AOM_CDF2(128 * 224) },
-        { AOM_CDF2(128 * 234) },
-        { AOM_CDF2(128 * 234) },
-        { AOM_CDF2(128 * 240) }
+        { CDF1(17408) }, { CDF1(17920) }, { CDF1(18944) },
+        { CDF1(20480) }, { CDF1(22528) }, { CDF1(24576) },
+        { CDF1(28672) }, { CDF1(29952) }, { CDF1(29952) },
+        { CDF1(30720) },
     }, .class0_fp = {
-        { AOM_CDF4(16384, 24576, 26624) },
-        { AOM_CDF4(12288, 21248, 24128) }
+        { CDF3(16384, 24576, 26624) },
+        { CDF3(12288, 21248, 24128) },
     }, .classN_fp = {
-        AOM_CDF4(8192, 17408, 21248)
+        CDF3( 8192, 17408, 21248)
     }, .class0_hp = {
-        AOM_CDF2(160 * 128)
+        CDF1(20480)
     }, .classN_hp = {
-        AOM_CDF2(128 * 128)
+        CDF1(16384)
     }, .sign = {
-        AOM_CDF2(128 * 128)
-    }
+        CDF1(16384)
+    },
 };
 
-
-static const uint16_t default_mv_joint_cdf[N_MV_JOINTS + 1] = {
-    AOM_CDF4(4096, 11264, 19328)
+static const uint16_t ALIGN(default_mv_joint_cdf[N_MV_JOINTS], 8) = {
+    CDF3( 4096, 11264, 19328)
 };
 
-static const uint16_t default_kf_y_mode_cdf[5][5][N_INTRA_PRED_MODES + 1 + 2] = {
+static const uint16_t ALIGN(default_kf_y_mode_cdf[5][5][N_INTRA_PRED_MODES + 3], 32) = {
     {
-        { AOM_CDF13(15588, 17027, 19338, 20218, 20682, 21110, 21825, 23244,
-                    24189, 28165, 29093, 30466) },
-        { AOM_CDF13(12016, 18066, 19516, 20303, 20719, 21444, 21888, 23032,
-                    24434, 28658, 30172, 31409) },
-        { AOM_CDF13(10052, 10771, 22296, 22788, 23055, 23239, 24133, 25620,
-                    26160, 29336, 29929, 31567) },
-        { AOM_CDF13(14091, 15406, 16442, 18808, 19136, 19546, 19998, 22096,
-                    24746, 29585, 30958, 32462) },
-        { AOM_CDF13(12122, 13265, 15603, 16501, 18609, 20033, 22391, 25583,
-                    26437, 30261, 31073, 32475) }
+        { CDF12(15588, 17027, 19338, 20218, 20682, 21110,
+                21825, 23244, 24189, 28165, 29093, 30466) },
+        { CDF12(12016, 18066, 19516, 20303, 20719, 21444,
+                21888, 23032, 24434, 28658, 30172, 31409) },
+        { CDF12(10052, 10771, 22296, 22788, 23055, 23239,
+                24133, 25620, 26160, 29336, 29929, 31567) },
+        { CDF12(14091, 15406, 16442, 18808, 19136, 19546,
+                19998, 22096, 24746, 29585, 30958, 32462) },
+        { CDF12(12122, 13265, 15603, 16501, 18609, 20033,
+                22391, 25583, 26437, 30261, 31073, 32475) },
     }, {
-        { AOM_CDF13(10023, 19585, 20848, 21440, 21832, 22760, 23089, 24023,
-                  25381, 29014, 30482, 31436) },
-        { AOM_CDF13(5983, 24099, 24560, 24886, 25066, 25795, 25913, 26423,
-                    27610, 29905, 31276, 31794) },
-        { AOM_CDF13(7444, 12781, 20177, 20728, 21077, 21607, 22170, 23405,
-                    24469, 27915, 29090, 30492) },
-        { AOM_CDF13(8537, 14689, 15432, 17087, 17408, 18172, 18408, 19825,
-                    24649, 29153, 31096, 32210) },
-        { AOM_CDF13(7543, 14231, 15496, 16195, 17905, 20717, 21984, 24516,
-                    26001, 29675, 30981, 31994) }
+        { CDF12(10023, 19585, 20848, 21440, 21832, 22760,
+                23089, 24023, 25381, 29014, 30482, 31436) },
+        { CDF12( 5983, 24099, 24560, 24886, 25066, 25795,
+                25913, 26423, 27610, 29905, 31276, 31794) },
+        { CDF12( 7444, 12781, 20177, 20728, 21077, 21607,
+                22170, 23405, 24469, 27915, 29090, 30492) },
+        { CDF12( 8537, 14689, 15432, 17087, 17408, 18172,
+                18408, 19825, 24649, 29153, 31096, 32210) },
+        { CDF12( 7543, 14231, 15496, 16195, 17905, 20717,
+                21984, 24516, 26001, 29675, 30981, 31994) },
     }, {
-        { AOM_CDF13(12613, 13591, 21383, 22004, 22312, 22577, 23401, 25055,
-                  25729, 29538, 30305, 32077) },
-        { AOM_CDF13(9687, 13470, 18506, 19230, 19604, 20147, 20695, 22062,
-                    23219, 27743, 29211, 30907) },
-        { AOM_CDF13(6183, 6505, 26024, 26252, 26366, 26434, 27082, 28354,
-                    28555, 30467, 30794, 32086) },
-        { AOM_CDF13(10718, 11734, 14954, 17224, 17565, 17924, 18561, 21523,
-                    23878, 28975, 30287, 32252) },
-        { AOM_CDF13(9194, 9858, 16501, 17263, 18424, 19171, 21563, 25961,
-                    26561, 30072, 30737, 32463) }
+        { CDF12(12613, 13591, 21383, 22004, 22312, 22577,
+                23401, 25055, 25729, 29538, 30305, 32077) },
+        { CDF12( 9687, 13470, 18506, 19230, 19604, 20147,
+                20695, 22062, 23219, 27743, 29211, 30907) },
+        { CDF12( 6183,  6505, 26024, 26252, 26366, 26434,
+                27082, 28354, 28555, 30467, 30794, 32086) },
+        { CDF12(10718, 11734, 14954, 17224, 17565, 17924,
+                18561, 21523, 23878, 28975, 30287, 32252) },
+        { CDF12( 9194,  9858, 16501, 17263, 18424, 19171,
+                21563, 25961, 26561, 30072, 30737, 32463) },
     }, {
-        { AOM_CDF13(12602, 14399, 15488, 18381, 18778, 19315, 19724, 21419,
-                  25060, 29696, 30917, 32409) },
-        { AOM_CDF13(8203, 13821, 14524, 17105, 17439, 18131, 18404, 19468,
-                    25225, 29485, 31158, 32342) },
-        { AOM_CDF13(8451, 9731, 15004, 17643, 18012, 18425, 19070, 21538,
-                    24605, 29118, 30078, 32018) },
-        { AOM_CDF13(7714, 9048, 9516, 16667, 16817, 16994, 17153, 18767,
-                    26743, 30389, 31536, 32528) },
-        { AOM_CDF13(8843, 10280, 11496, 15317, 16652, 17943, 19108, 22718,
-                    25769, 29953, 30983, 32485) }
+        { CDF12(12602, 14399, 15488, 18381, 18778, 19315,
+                19724, 21419, 25060, 29696, 30917, 32409) },
+        { CDF12( 8203, 13821, 14524, 17105, 17439, 18131,
+                18404, 19468, 25225, 29485, 31158, 32342) },
+        { CDF12( 8451,  9731, 15004, 17643, 18012, 18425,
+                19070, 21538, 24605, 29118, 30078, 32018) },
+        { CDF12( 7714,  9048,  9516, 16667, 16817, 16994,
+                17153, 18767, 26743, 30389, 31536, 32528) },
+        { CDF12( 8843, 10280, 11496, 15317, 16652, 17943,
+                19108, 22718, 25769, 29953, 30983, 32485) },
     }, {
-        { AOM_CDF13(12578, 13671, 15979, 16834, 19075, 20913, 22989, 25449,
-                  26219, 30214, 31150, 32477) },
-        { AOM_CDF13(9563, 13626, 15080, 15892, 17756, 20863, 22207, 24236,
-                    25380, 29653, 31143, 32277) },
-        { AOM_CDF13(8356, 8901, 17616, 18256, 19350, 20106, 22598, 25947,
-                    26466, 29900, 30523, 32261) },
-        { AOM_CDF13(10835, 11815, 13124, 16042, 17018, 18039, 18947, 22753,
-                    24615, 29489, 30883, 32482) },
-        { AOM_CDF13(7618, 8288, 9859, 10509, 15386, 18657, 22903, 28776,
-                    29180, 31355, 31802, 32593) }
-    }
+        { CDF12(12578, 13671, 15979, 16834, 19075, 20913,
+                22989, 25449, 26219, 30214, 31150, 32477) },
+        { CDF12( 9563, 13626, 15080, 15892, 17756, 20863,
+                22207, 24236, 25380, 29653, 31143, 32277) },
+        { CDF12( 8356,  8901, 17616, 18256, 19350, 20106,
+                22598, 25947, 26466, 29900, 30523, 32261) },
+        { CDF12(10835, 11815, 13124, 16042, 17018, 18039,
+                18947, 22753, 24615, 29489, 30883, 32482) },
+        { CDF12( 7618,  8288,  9859, 10509, 15386, 18657,
+                22903, 28776, 29180, 31355, 31802, 32593) },
+    },
 };
 
 static const CdfCoefContext av1_default_coef_cdf[4] = {
     [0] = {
         .skip = {
-            { { AOM_CDF2(31849) },
-                { AOM_CDF2(5892) },
-                { AOM_CDF2(12112) },
-                { AOM_CDF2(21935) },
-                { AOM_CDF2(20289) },
-                { AOM_CDF2(27473) },
-                { AOM_CDF2(32487) },
-                { AOM_CDF2(7654) },
-                { AOM_CDF2(19473) },
-                { AOM_CDF2(29984) },
-                { AOM_CDF2(9961) },
-                { AOM_CDF2(30242) },
-                { AOM_CDF2(32117) } },
-            { { AOM_CDF2(31548) },
-                { AOM_CDF2(1549) },
-                { AOM_CDF2(10130) },
-                { AOM_CDF2(16656) },
-                { AOM_CDF2(18591) },
-                { AOM_CDF2(26308) },
-                { AOM_CDF2(32537) },
-                { AOM_CDF2(5403) },
-                { AOM_CDF2(18096) },
-                { AOM_CDF2(30003) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) } },
-            { { AOM_CDF2(29957) },
-                { AOM_CDF2(5391) },
-                { AOM_CDF2(18039) },
-                { AOM_CDF2(23566) },
-                { AOM_CDF2(22431) },
-                { AOM_CDF2(25822) },
-                { AOM_CDF2(32197) },
-                { AOM_CDF2(3778) },
-                { AOM_CDF2(15336) },
-                { AOM_CDF2(28981) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) } },
-            { { AOM_CDF2(17920) },
-                { AOM_CDF2(1818) },
-                { AOM_CDF2(7282) },
-                { AOM_CDF2(25273) },
-                { AOM_CDF2(10923) },
-                { AOM_CDF2(31554) },
-                { AOM_CDF2(32624) },
-                { AOM_CDF2(1366) },
-                { AOM_CDF2(15628) },
-                { AOM_CDF2(30462) },
-                { AOM_CDF2(146) },
-                { AOM_CDF2(5132) },
-                { AOM_CDF2(31657) } },
-            { { AOM_CDF2(6308) },
-                { AOM_CDF2(117) },
-                { AOM_CDF2(1638) },
-                { AOM_CDF2(2161) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(10923) },
-                { AOM_CDF2(30247) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) } }
+            {
+                { CDF1(31849) }, { CDF1( 5892) }, { CDF1(12112) },
+                { CDF1(21935) }, { CDF1(20289) }, { CDF1(27473) },
+                { CDF1(32487) }, { CDF1( 7654) }, { CDF1(19473) },
+                { CDF1(29984) }, { CDF1( 9961) }, { CDF1(30242) },
+                { CDF1(32117) },
+            }, {
+                { CDF1(31548) }, { CDF1( 1549) }, { CDF1(10130) },
+                { CDF1(16656) }, { CDF1(18591) }, { CDF1(26308) },
+                { CDF1(32537) }, { CDF1( 5403) }, { CDF1(18096) },
+                { CDF1(30003) }, { CDF1(16384) }, { CDF1(16384) },
+                { CDF1(16384) },
+            }, {
+                { CDF1(29957) }, { CDF1( 5391) }, { CDF1(18039) },
+                { CDF1(23566) }, { CDF1(22431) }, { CDF1(25822) },
+                { CDF1(32197) }, { CDF1( 3778) }, { CDF1(15336) },
+                { CDF1(28981) }, { CDF1(16384) }, { CDF1(16384) },
+                { CDF1(16384) },
+            }, {
+                { CDF1(17920) }, { CDF1( 1818) }, { CDF1( 7282) },
+                { CDF1(25273) }, { CDF1(10923) }, { CDF1(31554) },
+                { CDF1(32624) }, { CDF1( 1366) }, { CDF1(15628) },
+                { CDF1(30462) }, { CDF1(  146) }, { CDF1( 5132) },
+                { CDF1(31657) },
+            }, {
+                { CDF1( 6308) }, { CDF1(  117) }, { CDF1( 1638) },
+                { CDF1( 2161) }, { CDF1(16384) }, { CDF1(10923) },
+                { CDF1(30247) }, { CDF1(16384) }, { CDF1(16384) },
+                { CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
+                { CDF1(16384) },
+            },
         }, .eob_bin_16 = {
-            { { AOM_CDF5(840, 1039, 1980, 4895) },
-              { AOM_CDF5(370, 671, 1883, 4471) } },
-            { { AOM_CDF5(3247, 4950, 9688, 14563) },
-              { AOM_CDF5(1904, 3354, 7763, 14647) } }
+            {
+                { CDF4(  840,  1039,  1980,  4895) },
+                { CDF4(  370,   671,  1883,  4471) },
+            }, {
+                { CDF4( 3247,  4950,  9688, 14563) },
+                { CDF4( 1904,  3354,  7763, 14647) },
+            },
         }, .eob_bin_32 = {
-            { { AOM_CDF6(400, 520, 977, 2102, 6542) },
-              { AOM_CDF6(210, 405, 1315, 3326, 7537) } },
-            { { AOM_CDF6(2636, 4273, 7588, 11794, 20401) },
-              { AOM_CDF6(1786, 3179, 6902, 11357, 19054) } }
+            {
+                { CDF5(  400,   520,   977,  2102,  6542) },
+                { CDF5(  210,   405,  1315,  3326,  7537) },
+            }, {
+                { CDF5( 2636,  4273,  7588, 11794, 20401) },
+                { CDF5( 1786,  3179,  6902, 11357, 19054) },
+            },
         }, .eob_bin_64 = {
-            { { AOM_CDF7(329, 498, 1101, 1784, 3265, 7758) },
-              { AOM_CDF7(335, 730, 1459, 5494, 8755, 12997) } },
-            { { AOM_CDF7(3505, 5304, 10086, 13814, 17684, 23370) },
-              { AOM_CDF7(1563, 2700, 4876, 10911, 14706, 22480) } }
+            {
+                { CDF6(  329,   498,  1101,  1784,  3265,  7758) },
+                { CDF6(  335,   730,  1459,  5494,  8755, 12997) },
+            }, {
+                { CDF6( 3505,  5304, 10086, 13814, 17684, 23370) },
+                { CDF6( 1563,  2700,  4876, 10911, 14706, 22480) },
+            },
         }, .eob_bin_128 = {
-            { { AOM_CDF8(219, 482, 1140, 2091, 3680, 6028, 12586) },
-              { AOM_CDF8(371, 699, 1254, 4830, 9479, 12562, 17497) } },
-            { { AOM_CDF8(5245, 7456, 12880, 15852, 20033, 23932, 27608) },
-              { AOM_CDF8(2054, 3472, 5869, 14232, 18242, 20590, 26752) } }
+            {
+                { CDF7(  219,   482,  1140,  2091,  3680,  6028, 12586) },
+                { CDF7(  371,   699,  1254,  4830,  9479, 12562, 17497) },
+            }, {
+                { CDF7( 5245,  7456, 12880, 15852, 20033, 23932, 27608) },
+                { CDF7( 2054,  3472,  5869, 14232, 18242, 20590, 26752) },
+            },
         }, .eob_bin_256 = {
-            { { AOM_CDF9(310, 584, 1887, 3589, 6168, 8611, 11352, 15652) },
-              { AOM_CDF9(998, 1850, 2998, 5604, 17341, 19888, 22899, 25583) } },
-            { { AOM_CDF9(2520, 3240, 5952, 8870, 12577, 17558, 19954, 24168) },
-              { AOM_CDF9(2203, 4130, 7435, 10739, 20652, 23681, 25609, 27261) } }
+            {
+                { CDF8(  310,   584,  1887,  3589,
+                        6168,  8611, 11352, 15652) },
+                { CDF8(  998,  1850,  2998,  5604,
+                       17341, 19888, 22899, 25583) },
+            }, {
+                { CDF8( 2520,  3240,  5952,  8870,
+                       12577, 17558, 19954, 24168) },
+                { CDF8( 2203,  4130,  7435, 10739,
+                       20652, 23681, 25609, 27261) },
+            },
         }, .eob_bin_512 = {
-            { { AOM_CDF10(641, 983, 3707, 5430, 10234, 14958, 18788,
-                          23412, 26061) },
-              { AOM_CDF10(3277, 6554, 9830, 13107, 16384, 19661, 22938,
-                          26214, 29491) } },
-            { { AOM_CDF10(5095, 6446, 9996, 13354, 16017, 17986, 20919,
-                          26129, 29140) },
-              { AOM_CDF10(3277, 6554, 9830, 13107, 16384, 19661, 22938,
-                          26214, 29491) } }
+            { CDF9(  641,   983,  3707,  5430, 10234,
+                   14958, 18788, 23412, 26061) },
+            { CDF9( 5095,  6446,  9996, 13354, 16017,
+                   17986, 20919, 26129, 29140) },
         }, .eob_bin_1024 = {
-            { { AOM_CDF11(393, 421, 751, 1623, 3160, 6352, 13345, 18047,
-                          22571, 25830) },
-              { AOM_CDF11(2979, 5958, 8937, 11916, 14895, 17873, 20852,
-                          23831, 26810, 29789) } },
-            { { AOM_CDF11(1865, 1988, 2930, 4242, 10533, 16538, 21354,
-                          27255, 28546, 31784) },
-              { AOM_CDF11(2979, 5958, 8937, 11916, 14895, 17873, 20852,
-                          23831, 26810, 29789) } }
+            { CDF10(  393,   421,   751,  1623,  3160,
+                     6352, 13345, 18047, 22571, 25830) },
+            { CDF10( 1865,  1988,  2930,  4242, 10533,
+                    16538, 21354, 27255, 28546, 31784) },
         }, .eob_hi_bit = {
-            { { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(16961) }, { AOM_CDF2(17223) }, { AOM_CDF2(7621) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) } },
-              { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(19069) }, { AOM_CDF2(22525) }, { AOM_CDF2(13377) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) } } },
-            { { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(20401) }, { AOM_CDF2(17025) }, { AOM_CDF2(12845) },
-                { AOM_CDF2(12873) }, { AOM_CDF2(14094) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) } },
-              { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(20681) }, { AOM_CDF2(20701) }, { AOM_CDF2(15250) },
-                { AOM_CDF2(15017) }, { AOM_CDF2(14928) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) } } },
-            { { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(23905) }, { AOM_CDF2(17194) }, { AOM_CDF2(16170) },
-                { AOM_CDF2(17695) }, { AOM_CDF2(13826) }, { AOM_CDF2(15810) },
-                { AOM_CDF2(12036) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) } },
-              { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(23959) }, { AOM_CDF2(20799) }, { AOM_CDF2(19021) },
-                { AOM_CDF2(16203) }, { AOM_CDF2(17886) }, { AOM_CDF2(14144) },
-                { AOM_CDF2(12010) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) } } },
-            { { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(27399) }, { AOM_CDF2(16327) }, { AOM_CDF2(18071) },
-                { AOM_CDF2(19584) }, { AOM_CDF2(20721) }, { AOM_CDF2(18432) },
-                { AOM_CDF2(19560) }, { AOM_CDF2(10150) }, { AOM_CDF2(8805) } },
-              { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(24932) }, { AOM_CDF2(20833) }, { AOM_CDF2(12027) },
-                { AOM_CDF2(16670) }, { AOM_CDF2(19914) }, { AOM_CDF2(15106) },
-                { AOM_CDF2(17662) }, { AOM_CDF2(13783) }, { AOM_CDF2(28756) } } },
-            { { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(23406) }, { AOM_CDF2(21845) }, { AOM_CDF2(18432) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(17096) }, { AOM_CDF2(12561) },
-                { AOM_CDF2(17320) }, { AOM_CDF2(22395) }, { AOM_CDF2(21370) } },
-              { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) } } }
+            {
+                {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(16961) },
+                    { CDF1(17223) }, { CDF1( 7621) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) },
+                }, {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(19069) },
+                    { CDF1(22525) }, { CDF1(13377) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) },
+                },
+            }, {
+                {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(20401) },
+                    { CDF1(17025) }, { CDF1(12845) }, { CDF1(12873) },
+                    { CDF1(14094) }, { CDF1(16384) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) },
+                }, {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(20681) },
+                    { CDF1(20701) }, { CDF1(15250) }, { CDF1(15017) },
+                    { CDF1(14928) }, { CDF1(16384) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) },
+                },
+            }, {
+                {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(23905) },
+                    { CDF1(17194) }, { CDF1(16170) }, { CDF1(17695) },
+                    { CDF1(13826) }, { CDF1(15810) }, { CDF1(12036) },
+                    { CDF1(16384) }, { CDF1(16384) },
+                }, {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(23959) },
+                    { CDF1(20799) }, { CDF1(19021) }, { CDF1(16203) },
+                    { CDF1(17886) }, { CDF1(14144) }, { CDF1(12010) },
+                    { CDF1(16384) }, { CDF1(16384) },
+                },
+            }, {
+                {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(27399) },
+                    { CDF1(16327) }, { CDF1(18071) }, { CDF1(19584) },
+                    { CDF1(20721) }, { CDF1(18432) }, { CDF1(19560) },
+                    { CDF1(10150) }, { CDF1( 8805) },
+                }, {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(24932) },
+                    { CDF1(20833) }, { CDF1(12027) }, { CDF1(16670) },
+                    { CDF1(19914) }, { CDF1(15106) }, { CDF1(17662) },
+                    { CDF1(13783) }, { CDF1(28756) },
+                },
+            }, {
+                {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(23406) },
+                    { CDF1(21845) }, { CDF1(18432) }, { CDF1(16384) },
+                    { CDF1(17096) }, { CDF1(12561) }, { CDF1(17320) },
+                    { CDF1(22395) }, { CDF1(21370) },
+                }, {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) },
+                },
+            },
         }, .eob_base_tok = {
-            { { { AOM_CDF3(17837, 29055) },
-                { AOM_CDF3(29600, 31446) },
-                { AOM_CDF3(30844, 31878) },
-                { AOM_CDF3(24926, 28948) } },
-             { { AOM_CDF3(21365, 30026) },
-                { AOM_CDF3(30512, 32423) },
-                { AOM_CDF3(31658, 32621) },
-                { AOM_CDF3(29630, 31881) } } },
-            { { { AOM_CDF3(5717, 26477) },
-                { AOM_CDF3(30491, 31703) },
-                { AOM_CDF3(31550, 32158) },
-                { AOM_CDF3(29648, 31491) } },
-              { { AOM_CDF3(12608, 27820) },
-                { AOM_CDF3(30680, 32225) },
-                { AOM_CDF3(30809, 32335) },
-                { AOM_CDF3(31299, 32423) } } },
-            { { { AOM_CDF3(1786, 12612) },
-                { AOM_CDF3(30663, 31625) },
-                { AOM_CDF3(32339, 32468) },
-                { AOM_CDF3(31148, 31833) } },
-              { { AOM_CDF3(18857, 23865) },
-                { AOM_CDF3(31428, 32428) },
-                { AOM_CDF3(31744, 32373) },
-                { AOM_CDF3(31775, 32526) } } },
-            { { { AOM_CDF3(1787, 2532) },
-                { AOM_CDF3(30832, 31662) },
-                { AOM_CDF3(31824, 32682) },
-                { AOM_CDF3(32133, 32569) } },
-              { { AOM_CDF3(13751, 22235) },
-                { AOM_CDF3(32089, 32409) },
-                { AOM_CDF3(27084, 27920) },
-                { AOM_CDF3(29291, 32594) } } },
-            { { { AOM_CDF3(1725, 3449) },
-                { AOM_CDF3(31102, 31935) },
-                { AOM_CDF3(32457, 32613) },
-                { AOM_CDF3(32412, 32649) } },
-              { { AOM_CDF3(10923, 21845) },
-                { AOM_CDF3(10923, 21845) },
-                { AOM_CDF3(10923, 21845) },
-                { AOM_CDF3(10923, 21845) } } }
+            {
+                {
+                    { CDF2(17837, 29055) }, { CDF2(29600, 31446) },
+                    { CDF2(30844, 31878) }, { CDF2(24926, 28948) },
+                }, {
+                    { CDF2(21365, 30026) }, { CDF2(30512, 32423) },
+                    { CDF2(31658, 32621) }, { CDF2(29630, 31881) },
+                },
+            }, {
+                {
+                    { CDF2( 5717, 26477) }, { CDF2(30491, 31703) },
+                    { CDF2(31550, 32158) }, { CDF2(29648, 31491) },
+                }, {
+                    { CDF2(12608, 27820) }, { CDF2(30680, 32225) },
+                    { CDF2(30809, 32335) }, { CDF2(31299, 32423) },
+                },
+            }, {
+                {
+                    { CDF2( 1786, 12612) }, { CDF2(30663, 31625) },
+                    { CDF2(32339, 32468) }, { CDF2(31148, 31833) },
+                }, {
+                    { CDF2(18857, 23865) }, { CDF2(31428, 32428) },
+                    { CDF2(31744, 32373) }, { CDF2(31775, 32526) },
+                },
+            }, {
+                {
+                    { CDF2( 1787,  2532) }, { CDF2(30832, 31662) },
+                    { CDF2(31824, 32682) }, { CDF2(32133, 32569) },
+                }, {
+                    { CDF2(13751, 22235) }, { CDF2(32089, 32409) },
+                    { CDF2(27084, 27920) }, { CDF2(29291, 32594) },
+                },
+            }, {
+                {
+                    { CDF2( 1725,  3449) }, { CDF2(31102, 31935) },
+                    { CDF2(32457, 32613) }, { CDF2(32412, 32649) },
+                }, {
+                    { CDF2(10923, 21845) }, { CDF2(10923, 21845) },
+                    { CDF2(10923, 21845) }, { CDF2(10923, 21845) },
+                },
+            },
         }, .base_tok = {
-            { { { AOM_CDF4(4034, 8930, 12727) },
-                { AOM_CDF4(18082, 29741, 31877) },
-                { AOM_CDF4(12596, 26124, 30493) },
-                { AOM_CDF4(9446, 21118, 27005) },
-                { AOM_CDF4(6308, 15141, 21279) },
-                { AOM_CDF4(2463, 6357, 9783) },
-                { AOM_CDF4(20667, 30546, 31929) },
-                { AOM_CDF4(13043, 26123, 30134) },
-                { AOM_CDF4(8151, 18757, 24778) },
-                { AOM_CDF4(5255, 12839, 18632) },
-                { AOM_CDF4(2820, 7206, 11161) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(15736, 27553, 30604) },
-                { AOM_CDF4(11210, 23794, 28787) },
-                { AOM_CDF4(5947, 13874, 19701) },
-                { AOM_CDF4(4215, 9323, 13891) },
-                { AOM_CDF4(2833, 6462, 10059) },
-                { AOM_CDF4(19605, 30393, 31582) },
-                { AOM_CDF4(13523, 26252, 30248) },
-                { AOM_CDF4(8446, 18622, 24512) },
-                { AOM_CDF4(3818, 10343, 15974) },
-                { AOM_CDF4(1481, 4117, 6796) },
-                { AOM_CDF4(22649, 31302, 32190) },
-                { AOM_CDF4(14829, 27127, 30449) },
-                { AOM_CDF4(8313, 17702, 23304) },
-                { AOM_CDF4(3022, 8301, 12786) },
-                { AOM_CDF4(1536, 4412, 7184) },
-                { AOM_CDF4(22354, 29774, 31372) },
-                { AOM_CDF4(14723, 25472, 29214) },
-                { AOM_CDF4(6673, 13745, 18662) },
-                { AOM_CDF4(2068, 5766, 9322) },
-                { AOM_CDF4(8192, 16384, 24576) } },
-              { { AOM_CDF4(6302, 16444, 21761) },
-                { AOM_CDF4(23040, 31538, 32475) },
-                { AOM_CDF4(15196, 28452, 31496) },
-                { AOM_CDF4(10020, 22946, 28514) },
-                { AOM_CDF4(6533, 16862, 23501) },
-                { AOM_CDF4(3538, 9816, 15076) },
-                { AOM_CDF4(24444, 31875, 32525) },
-                { AOM_CDF4(15881, 28924, 31635) },
-                { AOM_CDF4(9922, 22873, 28466) },
-                { AOM_CDF4(6527, 16966, 23691) },
-                { AOM_CDF4(4114, 11303, 17220) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(20201, 30770, 32209) },
-                { AOM_CDF4(14754, 28071, 31258) },
-                { AOM_CDF4(8378, 20186, 26517) },
-                { AOM_CDF4(5916, 15299, 21978) },
-                { AOM_CDF4(4268, 11583, 17901) },
-                { AOM_CDF4(24361, 32025, 32581) },
-                { AOM_CDF4(18673, 30105, 31943) },
-                { AOM_CDF4(10196, 22244, 27576) },
-                { AOM_CDF4(5495, 14349, 20417) },
-                { AOM_CDF4(2676, 7415, 11498) },
-                { AOM_CDF4(24678, 31958, 32585) },
-                { AOM_CDF4(18629, 29906, 31831) },
-                { AOM_CDF4(9364, 20724, 26315) },
-                { AOM_CDF4(4641, 12318, 18094) },
-                { AOM_CDF4(2758, 7387, 11579) },
-                { AOM_CDF4(25433, 31842, 32469) },
-                { AOM_CDF4(18795, 29289, 31411) },
-                { AOM_CDF4(7644, 17584, 23592) },
-                { AOM_CDF4(3408, 9014, 15047) },
-                { AOM_CDF4(8192, 16384, 24576) } } },
-            { { { AOM_CDF4(4536, 10072, 14001) },
-                { AOM_CDF4(25459, 31416, 32206) },
-                { AOM_CDF4(16605, 28048, 30818) },
-                { AOM_CDF4(11008, 22857, 27719) },
-                { AOM_CDF4(6915, 16268, 22315) },
-                { AOM_CDF4(2625, 6812, 10537) },
-                { AOM_CDF4(24257, 31788, 32499) },
-                { AOM_CDF4(16880, 29454, 31879) },
-                { AOM_CDF4(11958, 25054, 29778) },
-                { AOM_CDF4(7916, 18718, 25084) },
-                { AOM_CDF4(3383, 8777, 13446) },
-                { AOM_CDF4(22720, 31603, 32393) },
-                { AOM_CDF4(14960, 28125, 31335) },
-                { AOM_CDF4(9731, 22210, 27928) },
-                { AOM_CDF4(6304, 15832, 22277) },
-                { AOM_CDF4(2910, 7818, 12166) },
-                { AOM_CDF4(20375, 30627, 32131) },
-                { AOM_CDF4(13904, 27284, 30887) },
-                { AOM_CDF4(9368, 21558, 27144) },
-                { AOM_CDF4(5937, 14966, 21119) },
-                { AOM_CDF4(2667, 7225, 11319) },
-                { AOM_CDF4(23970, 31470, 32378) },
-                { AOM_CDF4(17173, 29734, 32018) },
-                { AOM_CDF4(12795, 25441, 29965) },
-                { AOM_CDF4(8981, 19680, 25893) },
-                { AOM_CDF4(4728, 11372, 16902) },
-                { AOM_CDF4(24287, 31797, 32439) },
-                { AOM_CDF4(16703, 29145, 31696) },
-                { AOM_CDF4(10833, 23554, 28725) },
-                { AOM_CDF4(6468, 16566, 23057) },
-                { AOM_CDF4(2415, 6562, 10278) },
-                { AOM_CDF4(26610, 32395, 32659) },
-                { AOM_CDF4(18590, 30498, 32117) },
-                { AOM_CDF4(12420, 25756, 29950) },
-                { AOM_CDF4(7639, 18746, 24710) },
-                { AOM_CDF4(3001, 8086, 12347) },
-                { AOM_CDF4(25076, 32064, 32580) },
-                { AOM_CDF4(17946, 30128, 32028) },
-                { AOM_CDF4(12024, 24985, 29378) },
-                { AOM_CDF4(7517, 18390, 24304) },
-                { AOM_CDF4(3243, 8781, 13331) } },
-              { { AOM_CDF4(6037, 16771, 21957) },
-                { AOM_CDF4(24774, 31704, 32426) },
-                { AOM_CDF4(16830, 28589, 31056) },
-                { AOM_CDF4(10602, 22828, 27760) },
-                { AOM_CDF4(6733, 16829, 23071) },
-                { AOM_CDF4(3250, 8914, 13556) },
-                { AOM_CDF4(25582, 32220, 32668) },
-                { AOM_CDF4(18659, 30342, 32223) },
-                { AOM_CDF4(12546, 26149, 30515) },
-                { AOM_CDF4(8420, 20451, 26801) },
-                { AOM_CDF4(4636, 12420, 18344) },
-                { AOM_CDF4(27581, 32362, 32639) },
-                { AOM_CDF4(18987, 30083, 31978) },
-                { AOM_CDF4(11327, 24248, 29084) },
-                { AOM_CDF4(7264, 17719, 24120) },
-                { AOM_CDF4(3995, 10768, 16169) },
-                { AOM_CDF4(25893, 31831, 32487) },
-                { AOM_CDF4(16577, 28587, 31379) },
-                { AOM_CDF4(10189, 22748, 28182) },
-                { AOM_CDF4(6832, 17094, 23556) },
-                { AOM_CDF4(3708, 10110, 15334) },
-                { AOM_CDF4(25904, 32282, 32656) },
-                { AOM_CDF4(19721, 30792, 32276) },
-                { AOM_CDF4(12819, 26243, 30411) },
-                { AOM_CDF4(8572, 20614, 26891) },
-                { AOM_CDF4(5364, 14059, 20467) },
-                { AOM_CDF4(26580, 32438, 32677) },
-                { AOM_CDF4(20852, 31225, 32340) },
-                { AOM_CDF4(12435, 25700, 29967) },
-                { AOM_CDF4(8691, 20825, 26976) },
-                { AOM_CDF4(4446, 12209, 17269) },
-                { AOM_CDF4(27350, 32429, 32696) },
-                { AOM_CDF4(21372, 30977, 32272) },
-                { AOM_CDF4(12673, 25270, 29853) },
-                { AOM_CDF4(9208, 20925, 26640) },
-                { AOM_CDF4(5018, 13351, 18732) },
-                { AOM_CDF4(27351, 32479, 32713) },
-                { AOM_CDF4(21398, 31209, 32387) },
-                { AOM_CDF4(12162, 25047, 29842) },
-                { AOM_CDF4(7896, 18691, 25319) },
-                { AOM_CDF4(4670, 12882, 18881) } } },
-            { { { AOM_CDF4(5487, 10460, 13708) },
-                { AOM_CDF4(21597, 28303, 30674) },
-                { AOM_CDF4(11037, 21953, 26476) },
-                { AOM_CDF4(8147, 17962, 22952) },
-                { AOM_CDF4(5242, 13061, 18532) },
-                { AOM_CDF4(1889, 5208, 8182) },
-                { AOM_CDF4(26774, 32133, 32590) },
-                { AOM_CDF4(17844, 29564, 31767) },
-                { AOM_CDF4(11690, 24438, 29171) },
-                { AOM_CDF4(7542, 18215, 24459) },
-                { AOM_CDF4(2993, 8050, 12319) },
-                { AOM_CDF4(28023, 32328, 32591) },
-                { AOM_CDF4(18651, 30126, 31954) },
-                { AOM_CDF4(12164, 25146, 29589) },
-                { AOM_CDF4(7762, 18530, 24771) },
-                { AOM_CDF4(3492, 9183, 13920) },
-                { AOM_CDF4(27591, 32008, 32491) },
-                { AOM_CDF4(17149, 28853, 31510) },
-                { AOM_CDF4(11485, 24003, 28860) },
-                { AOM_CDF4(7697, 18086, 24210) },
-                { AOM_CDF4(3075, 7999, 12218) },
-                { AOM_CDF4(28268, 32482, 32654) },
-                { AOM_CDF4(19631, 31051, 32404) },
-                { AOM_CDF4(13860, 27260, 31020) },
-                { AOM_CDF4(9605, 21613, 27594) },
-                { AOM_CDF4(4876, 12162, 17908) },
-                { AOM_CDF4(27248, 32316, 32576) },
-                { AOM_CDF4(18955, 30457, 32075) },
-                { AOM_CDF4(11824, 23997, 28795) },
-                { AOM_CDF4(7346, 18196, 24647) },
-                { AOM_CDF4(3403, 9247, 14111) },
-                { AOM_CDF4(29711, 32655, 32735) },
-                { AOM_CDF4(21169, 31394, 32417) },
-                { AOM_CDF4(13487, 27198, 30957) },
-                { AOM_CDF4(8828, 21683, 27614) },
-                { AOM_CDF4(4270, 11451, 17038) },
-                { AOM_CDF4(28708, 32578, 32731) },
-                { AOM_CDF4(20120, 31241, 32482) },
-                { AOM_CDF4(13692, 27550, 31321) },
-                { AOM_CDF4(9418, 22514, 28439) },
-                { AOM_CDF4(4999, 13283, 19462) } },
-              { { AOM_CDF4(5673, 14302, 19711) },
-                { AOM_CDF4(26251, 30701, 31834) },
-                { AOM_CDF4(12782, 23783, 27803) },
-                { AOM_CDF4(9127, 20657, 25808) },
-                { AOM_CDF4(6368, 16208, 21462) },
-                { AOM_CDF4(2465, 7177, 10822) },
-                { AOM_CDF4(29961, 32563, 32719) },
-                { AOM_CDF4(18318, 29891, 31949) },
-                { AOM_CDF4(11361, 24514, 29357) },
-                { AOM_CDF4(7900, 19603, 25607) },
-                { AOM_CDF4(4002, 10590, 15546) },
-                { AOM_CDF4(29637, 32310, 32595) },
-                { AOM_CDF4(18296, 29913, 31809) },
-                { AOM_CDF4(10144, 21515, 26871) },
-                { AOM_CDF4(5358, 14322, 20394) },
-                { AOM_CDF4(3067, 8362, 13346) },
-                { AOM_CDF4(28652, 32470, 32676) },
-                { AOM_CDF4(17538, 30771, 32209) },
-                { AOM_CDF4(13924, 26882, 30494) },
-                { AOM_CDF4(10496, 22837, 27869) },
-                { AOM_CDF4(7236, 16396, 21621) },
-                { AOM_CDF4(30743, 32687, 32746) },
-                { AOM_CDF4(23006, 31676, 32489) },
-                { AOM_CDF4(14494, 27828, 31120) },
-                { AOM_CDF4(10174, 22801, 28352) },
-                { AOM_CDF4(6242, 15281, 21043) },
-                { AOM_CDF4(25817, 32243, 32720) },
-                { AOM_CDF4(18618, 31367, 32325) },
-                { AOM_CDF4(13997, 28318, 31878) },
-                { AOM_CDF4(12255, 26534, 31383) },
-                { AOM_CDF4(9561, 21588, 28450) },
-                { AOM_CDF4(28188, 32635, 32724) },
-                { AOM_CDF4(22060, 32365, 32728) },
-                { AOM_CDF4(18102, 30690, 32528) },
-                { AOM_CDF4(14196, 28864, 31999) },
-                { AOM_CDF4(12262, 25792, 30865) },
-                { AOM_CDF4(24176, 32109, 32628) },
-                { AOM_CDF4(18280, 29681, 31963) },
-                { AOM_CDF4(10205, 23703, 29664) },
-                { AOM_CDF4(7889, 20025, 27676) },
-                { AOM_CDF4(6060, 16743, 23970) } } },
-            { { { AOM_CDF4(5141, 7096, 8260) },
-                { AOM_CDF4(27186, 29022, 29789) },
-                { AOM_CDF4(6668, 12568, 15682) },
-                { AOM_CDF4(2172, 6181, 8638) },
-                { AOM_CDF4(1126, 3379, 4531) },
-                { AOM_CDF4(443, 1361, 2254) },
-                { AOM_CDF4(26083, 31153, 32436) },
-                { AOM_CDF4(13486, 24603, 28483) },
-                { AOM_CDF4(6508, 14840, 19910) },
-                { AOM_CDF4(3386, 8800, 13286) },
-                { AOM_CDF4(1530, 4322, 7054) },
-                { AOM_CDF4(29639, 32080, 32548) },
-                { AOM_CDF4(15897, 27552, 30290) },
-                { AOM_CDF4(8588, 20047, 25383) },
-                { AOM_CDF4(4889, 13339, 19269) },
-                { AOM_CDF4(2240, 6871, 10498) },
-                { AOM_CDF4(28165, 32197, 32517) },
-                { AOM_CDF4(20735, 30427, 31568) },
-                { AOM_CDF4(14325, 24671, 27692) },
-                { AOM_CDF4(5119, 12554, 17805) },
-                { AOM_CDF4(1810, 5441, 8261) },
-                { AOM_CDF4(31212, 32724, 32748) },
-                { AOM_CDF4(23352, 31766, 32545) },
-                { AOM_CDF4(14669, 27570, 31059) },
-                { AOM_CDF4(8492, 20894, 27272) },
-                { AOM_CDF4(3644, 10194, 15204) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) } },
-              { { AOM_CDF4(2461, 7013, 9371) },
-                { AOM_CDF4(24749, 29600, 30986) },
-                { AOM_CDF4(9466, 19037, 22417) },
-                { AOM_CDF4(3584, 9280, 14400) },
-                { AOM_CDF4(1505, 3929, 5433) },
-                { AOM_CDF4(677, 1500, 2736) },
-                { AOM_CDF4(23987, 30702, 32117) },
-                { AOM_CDF4(13554, 24571, 29263) },
-                { AOM_CDF4(6211, 14556, 21155) },
-                { AOM_CDF4(3135, 10972, 15625) },
-                { AOM_CDF4(2435, 7127, 11427) },
-                { AOM_CDF4(31300, 32532, 32550) },
-                { AOM_CDF4(14757, 30365, 31954) },
-                { AOM_CDF4(4405, 11612, 18553) },
-                { AOM_CDF4(580, 4132, 7322) },
-                { AOM_CDF4(1695, 10169, 14124) },
-                { AOM_CDF4(30008, 32282, 32591) },
-                { AOM_CDF4(19244, 30108, 31748) },
-                { AOM_CDF4(11180, 24158, 29555) },
-                { AOM_CDF4(5650, 14972, 19209) },
-                { AOM_CDF4(2114, 5109, 8456) },
-                { AOM_CDF4(31856, 32716, 32748) },
-                { AOM_CDF4(23012, 31664, 32572) },
-                { AOM_CDF4(13694, 26656, 30636) },
-                { AOM_CDF4(8142, 19508, 26093) },
-                { AOM_CDF4(4253, 10955, 16724) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) } } },
-            { { { AOM_CDF4(601, 983, 1311) },
-                { AOM_CDF4(18725, 23406, 28087) },
-                { AOM_CDF4(5461, 8192, 10923) },
-                { AOM_CDF4(3781, 15124, 21425) },
-                { AOM_CDF4(2587, 7761, 12072) },
-                { AOM_CDF4(106, 458, 810) },
-                { AOM_CDF4(22282, 29710, 31894) },
-                { AOM_CDF4(8508, 20926, 25984) },
-                { AOM_CDF4(3726, 12713, 18083) },
-                { AOM_CDF4(1620, 7112, 10893) },
-                { AOM_CDF4(729, 2236, 3495) },
-                { AOM_CDF4(30163, 32474, 32684) },
-                { AOM_CDF4(18304, 30464, 32000) },
-                { AOM_CDF4(11443, 26526, 29647) },
-                { AOM_CDF4(6007, 15292, 21299) },
-                { AOM_CDF4(2234, 6703, 8937) },
-                { AOM_CDF4(30954, 32177, 32571) },
-                { AOM_CDF4(17363, 29562, 31076) },
-                { AOM_CDF4(9686, 22464, 27410) },
-                { AOM_CDF4(8192, 16384, 21390) },
-                { AOM_CDF4(1755, 8046, 11264) },
-                { AOM_CDF4(31168, 32734, 32748) },
-                { AOM_CDF4(22486, 31441, 32471) },
-                { AOM_CDF4(12833, 25627, 29738) },
-                { AOM_CDF4(6980, 17379, 23122) },
-                { AOM_CDF4(3111, 8887, 13479) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) } },
-              { { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) } } }
+            {
+                {
+                    { CDF3( 4034,  8930, 12727) },
+                    { CDF3(18082, 29741, 31877) },
+                    { CDF3(12596, 26124, 30493) },
+                    { CDF3( 9446, 21118, 27005) },
+                    { CDF3( 6308, 15141, 21279) },
+                    { CDF3( 2463,  6357,  9783) },
+                    { CDF3(20667, 30546, 31929) },
+                    { CDF3(13043, 26123, 30134) },
+                    { CDF3( 8151, 18757, 24778) },
+                    { CDF3( 5255, 12839, 18632) },
+                    { CDF3( 2820,  7206, 11161) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3(15736, 27553, 30604) },
+                    { CDF3(11210, 23794, 28787) },
+                    { CDF3( 5947, 13874, 19701) },
+                    { CDF3( 4215,  9323, 13891) },
+                    { CDF3( 2833,  6462, 10059) },
+                    { CDF3(19605, 30393, 31582) },
+                    { CDF3(13523, 26252, 30248) },
+                    { CDF3( 8446, 18622, 24512) },
+                    { CDF3( 3818, 10343, 15974) },
+                    { CDF3( 1481,  4117,  6796) },
+                    { CDF3(22649, 31302, 32190) },
+                    { CDF3(14829, 27127, 30449) },
+                    { CDF3( 8313, 17702, 23304) },
+                    { CDF3( 3022,  8301, 12786) },
+                    { CDF3( 1536,  4412,  7184) },
+                    { CDF3(22354, 29774, 31372) },
+                    { CDF3(14723, 25472, 29214) },
+                    { CDF3( 6673, 13745, 18662) },
+                    { CDF3( 2068,  5766,  9322) },
+                    { CDF3( 8192, 16384, 24576) },
+                }, {
+                    { CDF3( 6302, 16444, 21761) },
+                    { CDF3(23040, 31538, 32475) },
+                    { CDF3(15196, 28452, 31496) },
+                    { CDF3(10020, 22946, 28514) },
+                    { CDF3( 6533, 16862, 23501) },
+                    { CDF3( 3538,  9816, 15076) },
+                    { CDF3(24444, 31875, 32525) },
+                    { CDF3(15881, 28924, 31635) },
+                    { CDF3( 9922, 22873, 28466) },
+                    { CDF3( 6527, 16966, 23691) },
+                    { CDF3( 4114, 11303, 17220) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3(20201, 30770, 32209) },
+                    { CDF3(14754, 28071, 31258) },
+                    { CDF3( 8378, 20186, 26517) },
+                    { CDF3( 5916, 15299, 21978) },
+                    { CDF3( 4268, 11583, 17901) },
+                    { CDF3(24361, 32025, 32581) },
+                    { CDF3(18673, 30105, 31943) },
+                    { CDF3(10196, 22244, 27576) },
+                    { CDF3( 5495, 14349, 20417) },
+                    { CDF3( 2676,  7415, 11498) },
+                    { CDF3(24678, 31958, 32585) },
+                    { CDF3(18629, 29906, 31831) },
+                    { CDF3( 9364, 20724, 26315) },
+                    { CDF3( 4641, 12318, 18094) },
+                    { CDF3( 2758,  7387, 11579) },
+                    { CDF3(25433, 31842, 32469) },
+                    { CDF3(18795, 29289, 31411) },
+                    { CDF3( 7644, 17584, 23592) },
+                    { CDF3( 3408,  9014, 15047) },
+                    { CDF3( 8192, 16384, 24576) },
+                },
+            }, {
+                {
+                    { CDF3( 4536, 10072, 14001) },
+                    { CDF3(25459, 31416, 32206) },
+                    { CDF3(16605, 28048, 30818) },
+                    { CDF3(11008, 22857, 27719) },
+                    { CDF3( 6915, 16268, 22315) },
+                    { CDF3( 2625,  6812, 10537) },
+                    { CDF3(24257, 31788, 32499) },
+                    { CDF3(16880, 29454, 31879) },
+                    { CDF3(11958, 25054, 29778) },
+                    { CDF3( 7916, 18718, 25084) },
+                    { CDF3( 3383,  8777, 13446) },
+                    { CDF3(22720, 31603, 32393) },
+                    { CDF3(14960, 28125, 31335) },
+                    { CDF3( 9731, 22210, 27928) },
+                    { CDF3( 6304, 15832, 22277) },
+                    { CDF3( 2910,  7818, 12166) },
+                    { CDF3(20375, 30627, 32131) },
+                    { CDF3(13904, 27284, 30887) },
+                    { CDF3( 9368, 21558, 27144) },
+                    { CDF3( 5937, 14966, 21119) },
+                    { CDF3( 2667,  7225, 11319) },
+                    { CDF3(23970, 31470, 32378) },
+                    { CDF3(17173, 29734, 32018) },
+                    { CDF3(12795, 25441, 29965) },
+                    { CDF3( 8981, 19680, 25893) },
+                    { CDF3( 4728, 11372, 16902) },
+                    { CDF3(24287, 31797, 32439) },
+                    { CDF3(16703, 29145, 31696) },
+                    { CDF3(10833, 23554, 28725) },
+                    { CDF3( 6468, 16566, 23057) },
+                    { CDF3( 2415,  6562, 10278) },
+                    { CDF3(26610, 32395, 32659) },
+                    { CDF3(18590, 30498, 32117) },
+                    { CDF3(12420, 25756, 29950) },
+                    { CDF3( 7639, 18746, 24710) },
+                    { CDF3( 3001,  8086, 12347) },
+                    { CDF3(25076, 32064, 32580) },
+                    { CDF3(17946, 30128, 32028) },
+                    { CDF3(12024, 24985, 29378) },
+                    { CDF3( 7517, 18390, 24304) },
+                    { CDF3( 3243,  8781, 13331) },
+                }, {
+                    { CDF3( 6037, 16771, 21957) },
+                    { CDF3(24774, 31704, 32426) },
+                    { CDF3(16830, 28589, 31056) },
+                    { CDF3(10602, 22828, 27760) },
+                    { CDF3( 6733, 16829, 23071) },
+                    { CDF3( 3250,  8914, 13556) },
+                    { CDF3(25582, 32220, 32668) },
+                    { CDF3(18659, 30342, 32223) },
+                    { CDF3(12546, 26149, 30515) },
+                    { CDF3( 8420, 20451, 26801) },
+                    { CDF3( 4636, 12420, 18344) },
+                    { CDF3(27581, 32362, 32639) },
+                    { CDF3(18987, 30083, 31978) },
+                    { CDF3(11327, 24248, 29084) },
+                    { CDF3( 7264, 17719, 24120) },
+                    { CDF3( 3995, 10768, 16169) },
+                    { CDF3(25893, 31831, 32487) },
+                    { CDF3(16577, 28587, 31379) },
+                    { CDF3(10189, 22748, 28182) },
+                    { CDF3( 6832, 17094, 23556) },
+                    { CDF3( 3708, 10110, 15334) },
+                    { CDF3(25904, 32282, 32656) },
+                    { CDF3(19721, 30792, 32276) },
+                    { CDF3(12819, 26243, 30411) },
+                    { CDF3( 8572, 20614, 26891) },
+                    { CDF3( 5364, 14059, 20467) },
+                    { CDF3(26580, 32438, 32677) },
+                    { CDF3(20852, 31225, 32340) },
+                    { CDF3(12435, 25700, 29967) },
+                    { CDF3( 8691, 20825, 26976) },
+                    { CDF3( 4446, 12209, 17269) },
+                    { CDF3(27350, 32429, 32696) },
+                    { CDF3(21372, 30977, 32272) },
+                    { CDF3(12673, 25270, 29853) },
+                    { CDF3( 9208, 20925, 26640) },
+                    { CDF3( 5018, 13351, 18732) },
+                    { CDF3(27351, 32479, 32713) },
+                    { CDF3(21398, 31209, 32387) },
+                    { CDF3(12162, 25047, 29842) },
+                    { CDF3( 7896, 18691, 25319) },
+                    { CDF3( 4670, 12882, 18881) },
+                },
+            }, {
+                {
+                    { CDF3( 5487, 10460, 13708) },
+                    { CDF3(21597, 28303, 30674) },
+                    { CDF3(11037, 21953, 26476) },
+                    { CDF3( 8147, 17962, 22952) },
+                    { CDF3( 5242, 13061, 18532) },
+                    { CDF3( 1889,  5208,  8182) },
+                    { CDF3(26774, 32133, 32590) },
+                    { CDF3(17844, 29564, 31767) },
+                    { CDF3(11690, 24438, 29171) },
+                    { CDF3( 7542, 18215, 24459) },
+                    { CDF3( 2993,  8050, 12319) },
+                    { CDF3(28023, 32328, 32591) },
+                    { CDF3(18651, 30126, 31954) },
+                    { CDF3(12164, 25146, 29589) },
+                    { CDF3( 7762, 18530, 24771) },
+                    { CDF3( 3492,  9183, 13920) },
+                    { CDF3(27591, 32008, 32491) },
+                    { CDF3(17149, 28853, 31510) },
+                    { CDF3(11485, 24003, 28860) },
+                    { CDF3( 7697, 18086, 24210) },
+                    { CDF3( 3075,  7999, 12218) },
+                    { CDF3(28268, 32482, 32654) },
+                    { CDF3(19631, 31051, 32404) },
+                    { CDF3(13860, 27260, 31020) },
+                    { CDF3( 9605, 21613, 27594) },
+                    { CDF3( 4876, 12162, 17908) },
+                    { CDF3(27248, 32316, 32576) },
+                    { CDF3(18955, 30457, 32075) },
+                    { CDF3(11824, 23997, 28795) },
+                    { CDF3( 7346, 18196, 24647) },
+                    { CDF3( 3403,  9247, 14111) },
+                    { CDF3(29711, 32655, 32735) },
+                    { CDF3(21169, 31394, 32417) },
+                    { CDF3(13487, 27198, 30957) },
+                    { CDF3( 8828, 21683, 27614) },
+                    { CDF3( 4270, 11451, 17038) },
+                    { CDF3(28708, 32578, 32731) },
+                    { CDF3(20120, 31241, 32482) },
+                    { CDF3(13692, 27550, 31321) },
+                    { CDF3( 9418, 22514, 28439) },
+                    { CDF3( 4999, 13283, 19462) },
+                }, {
+                    { CDF3( 5673, 14302, 19711) },
+                    { CDF3(26251, 30701, 31834) },
+                    { CDF3(12782, 23783, 27803) },
+                    { CDF3( 9127, 20657, 25808) },
+                    { CDF3( 6368, 16208, 21462) },
+                    { CDF3( 2465,  7177, 10822) },
+                    { CDF3(29961, 32563, 32719) },
+                    { CDF3(18318, 29891, 31949) },
+                    { CDF3(11361, 24514, 29357) },
+                    { CDF3( 7900, 19603, 25607) },
+                    { CDF3( 4002, 10590, 15546) },
+                    { CDF3(29637, 32310, 32595) },
+                    { CDF3(18296, 29913, 31809) },
+                    { CDF3(10144, 21515, 26871) },
+                    { CDF3( 5358, 14322, 20394) },
+                    { CDF3( 3067,  8362, 13346) },
+                    { CDF3(28652, 32470, 32676) },
+                    { CDF3(17538, 30771, 32209) },
+                    { CDF3(13924, 26882, 30494) },
+                    { CDF3(10496, 22837, 27869) },
+                    { CDF3( 7236, 16396, 21621) },
+                    { CDF3(30743, 32687, 32746) },
+                    { CDF3(23006, 31676, 32489) },
+                    { CDF3(14494, 27828, 31120) },
+                    { CDF3(10174, 22801, 28352) },
+                    { CDF3( 6242, 15281, 21043) },
+                    { CDF3(25817, 32243, 32720) },
+                    { CDF3(18618, 31367, 32325) },
+                    { CDF3(13997, 28318, 31878) },
+                    { CDF3(12255, 26534, 31383) },
+                    { CDF3( 9561, 21588, 28450) },
+                    { CDF3(28188, 32635, 32724) },
+                    { CDF3(22060, 32365, 32728) },
+                    { CDF3(18102, 30690, 32528) },
+                    { CDF3(14196, 28864, 31999) },
+                    { CDF3(12262, 25792, 30865) },
+                    { CDF3(24176, 32109, 32628) },
+                    { CDF3(18280, 29681, 31963) },
+                    { CDF3(10205, 23703, 29664) },
+                    { CDF3( 7889, 20025, 27676) },
+                    { CDF3( 6060, 16743, 23970) },
+                },
+            }, {
+                {
+                    { CDF3( 5141,  7096,  8260) },
+                    { CDF3(27186, 29022, 29789) },
+                    { CDF3( 6668, 12568, 15682) },
+                    { CDF3( 2172,  6181,  8638) },
+                    { CDF3( 1126,  3379,  4531) },
+                    { CDF3(  443,  1361,  2254) },
+                    { CDF3(26083, 31153, 32436) },
+                    { CDF3(13486, 24603, 28483) },
+                    { CDF3( 6508, 14840, 19910) },
+                    { CDF3( 3386,  8800, 13286) },
+                    { CDF3( 1530,  4322,  7054) },
+                    { CDF3(29639, 32080, 32548) },
+                    { CDF3(15897, 27552, 30290) },
+                    { CDF3( 8588, 20047, 25383) },
+                    { CDF3( 4889, 13339, 19269) },
+                    { CDF3( 2240,  6871, 10498) },
+                    { CDF3(28165, 32197, 32517) },
+                    { CDF3(20735, 30427, 31568) },
+                    { CDF3(14325, 24671, 27692) },
+                    { CDF3( 5119, 12554, 17805) },
+                    { CDF3( 1810,  5441,  8261) },
+                    { CDF3(31212, 32724, 32748) },
+                    { CDF3(23352, 31766, 32545) },
+                    { CDF3(14669, 27570, 31059) },
+                    { CDF3( 8492, 20894, 27272) },
+                    { CDF3( 3644, 10194, 15204) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                }, {
+                    { CDF3( 2461,  7013,  9371) },
+                    { CDF3(24749, 29600, 30986) },
+                    { CDF3( 9466, 19037, 22417) },
+                    { CDF3( 3584,  9280, 14400) },
+                    { CDF3( 1505,  3929,  5433) },
+                    { CDF3(  677,  1500,  2736) },
+                    { CDF3(23987, 30702, 32117) },
+                    { CDF3(13554, 24571, 29263) },
+                    { CDF3( 6211, 14556, 21155) },
+                    { CDF3( 3135, 10972, 15625) },
+                    { CDF3( 2435,  7127, 11427) },
+                    { CDF3(31300, 32532, 32550) },
+                    { CDF3(14757, 30365, 31954) },
+                    { CDF3( 4405, 11612, 18553) },
+                    { CDF3(  580,  4132,  7322) },
+                    { CDF3( 1695, 10169, 14124) },
+                    { CDF3(30008, 32282, 32591) },
+                    { CDF3(19244, 30108, 31748) },
+                    { CDF3(11180, 24158, 29555) },
+                    { CDF3( 5650, 14972, 19209) },
+                    { CDF3( 2114,  5109,  8456) },
+                    { CDF3(31856, 32716, 32748) },
+                    { CDF3(23012, 31664, 32572) },
+                    { CDF3(13694, 26656, 30636) },
+                    { CDF3( 8142, 19508, 26093) },
+                    { CDF3( 4253, 10955, 16724) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                },
+            }, {
+                {
+                    { CDF3(  601,   983,  1311) },
+                    { CDF3(18725, 23406, 28087) },
+                    { CDF3( 5461,  8192, 10923) },
+                    { CDF3( 3781, 15124, 21425) },
+                    { CDF3( 2587,  7761, 12072) },
+                    { CDF3(  106,   458,   810) },
+                    { CDF3(22282, 29710, 31894) },
+                    { CDF3( 8508, 20926, 25984) },
+                    { CDF3( 3726, 12713, 18083) },
+                    { CDF3( 1620,  7112, 10893) },
+                    { CDF3(  729,  2236,  3495) },
+                    { CDF3(30163, 32474, 32684) },
+                    { CDF3(18304, 30464, 32000) },
+                    { CDF3(11443, 26526, 29647) },
+                    { CDF3( 6007, 15292, 21299) },
+                    { CDF3( 2234,  6703,  8937) },
+                    { CDF3(30954, 32177, 32571) },
+                    { CDF3(17363, 29562, 31076) },
+                    { CDF3( 9686, 22464, 27410) },
+                    { CDF3( 8192, 16384, 21390) },
+                    { CDF3( 1755,  8046, 11264) },
+                    { CDF3(31168, 32734, 32748) },
+                    { CDF3(22486, 31441, 32471) },
+                    { CDF3(12833, 25627, 29738) },
+                    { CDF3( 6980, 17379, 23122) },
+                    { CDF3( 3111,  8887, 13479) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                }, {
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                },
+            },
         }, .dc_sign = {
-            {
-                { AOM_CDF2(128 * 125) },
-                { AOM_CDF2(128 * 102) },
-                { AOM_CDF2(128 * 147) },
-            }, {
-                { AOM_CDF2(128 * 119) },
-                { AOM_CDF2(128 * 101) },
-                { AOM_CDF2(128 * 135) },
-            }
+            { { CDF1(16000) }, { CDF1(13056) }, { CDF1(18816) } },
+            { { CDF1(15232) }, { CDF1(12928) }, { CDF1(17280) } },
         }, .br_tok = {
-            { { { AOM_CDF4(14298, 20718, 24174) },
-                { AOM_CDF4(12536, 19601, 23789) },
-                { AOM_CDF4(8712, 15051, 19503) },
-                { AOM_CDF4(6170, 11327, 15434) },
-                { AOM_CDF4(4742, 8926, 12538) },
-                { AOM_CDF4(3803, 7317, 10546) },
-                { AOM_CDF4(1696, 3317, 4871) },
-                { AOM_CDF4(14392, 19951, 22756) },
-                { AOM_CDF4(15978, 23218, 26818) },
-                { AOM_CDF4(12187, 19474, 23889) },
-                { AOM_CDF4(9176, 15640, 20259) },
-                { AOM_CDF4(7068, 12655, 17028) },
-                { AOM_CDF4(5656, 10442, 14472) },
-                { AOM_CDF4(2580, 4992, 7244) },
-                { AOM_CDF4(12136, 18049, 21426) },
-                { AOM_CDF4(13784, 20721, 24481) },
-                { AOM_CDF4(10836, 17621, 21900) },
-                { AOM_CDF4(8372, 14444, 18847) },
-                { AOM_CDF4(6523, 11779, 16000) },
-                { AOM_CDF4(5337, 9898, 13760) },
-                { AOM_CDF4(3034, 5860, 8462) } },
-              { { AOM_CDF4(15967, 22905, 26286) },
-                { AOM_CDF4(13534, 20654, 24579) },
-                { AOM_CDF4(9504, 16092, 20535) },
-                { AOM_CDF4(6975, 12568, 16903) },
-                { AOM_CDF4(5364, 10091, 14020) },
-                { AOM_CDF4(4357, 8370, 11857) },
-                { AOM_CDF4(2506, 4934, 7218) },
-                { AOM_CDF4(23032, 28815, 30936) },
-                { AOM_CDF4(19540, 26704, 29719) },
-                { AOM_CDF4(15158, 22969, 27097) },
-                { AOM_CDF4(11408, 18865, 23650) },
-                { AOM_CDF4(8885, 15448, 20250) },
-                { AOM_CDF4(7108, 12853, 17416) },
-                { AOM_CDF4(4231, 8041, 11480) },
-                { AOM_CDF4(19823, 26490, 29156) },
-                { AOM_CDF4(18890, 25929, 28932) },
-                { AOM_CDF4(15660, 23491, 27433) },
-                { AOM_CDF4(12147, 19776, 24488) },
-                { AOM_CDF4(9728, 16774, 21649) },
-                { AOM_CDF4(7919, 14277, 19066) },
-                { AOM_CDF4(5440, 10170, 14185) } } },
-            { { { AOM_CDF4(14406, 20862, 24414) },
-                { AOM_CDF4(11824, 18907, 23109) },
-                { AOM_CDF4(8257, 14393, 18803) },
-                { AOM_CDF4(5860, 10747, 14778) },
-                { AOM_CDF4(4475, 8486, 11984) },
-                { AOM_CDF4(3606, 6954, 10043) },
-                { AOM_CDF4(1736, 3410, 5048) },
-                { AOM_CDF4(14430, 20046, 22882) },
-                { AOM_CDF4(15593, 22899, 26709) },
-                { AOM_CDF4(12102, 19368, 23811) },
-                { AOM_CDF4(9059, 15584, 20262) },
-                { AOM_CDF4(6999, 12603, 17048) },
-                { AOM_CDF4(5684, 10497, 14553) },
-                { AOM_CDF4(2822, 5438, 7862) },
-                { AOM_CDF4(15785, 21585, 24359) },
-                { AOM_CDF4(18347, 25229, 28266) },
-                { AOM_CDF4(14974, 22487, 26389) },
-                { AOM_CDF4(11423, 18681, 23271) },
-                { AOM_CDF4(8863, 15350, 20008) },
-                { AOM_CDF4(7153, 12852, 17278) },
-                { AOM_CDF4(3707, 7036, 9982) } },
-              { { AOM_CDF4(15460, 21696, 25469) },
-                { AOM_CDF4(12170, 19249, 23191) },
-                { AOM_CDF4(8723, 15027, 19332) },
-                { AOM_CDF4(6428, 11704, 15874) },
-                { AOM_CDF4(4922, 9292, 13052) },
-                { AOM_CDF4(4139, 7695, 11010) },
-                { AOM_CDF4(2291, 4508, 6598) },
-                { AOM_CDF4(19856, 26920, 29828) },
-                { AOM_CDF4(17923, 25289, 28792) },
-                { AOM_CDF4(14278, 21968, 26297) },
-                { AOM_CDF4(10910, 18136, 22950) },
-                { AOM_CDF4(8423, 14815, 19627) },
-                { AOM_CDF4(6771, 12283, 16774) },
-                { AOM_CDF4(4074, 7750, 11081) },
-                { AOM_CDF4(19852, 26074, 28672) },
-                { AOM_CDF4(19371, 26110, 28989) },
-                { AOM_CDF4(16265, 23873, 27663) },
-                { AOM_CDF4(12758, 20378, 24952) },
-                { AOM_CDF4(10095, 17098, 21961) },
-                { AOM_CDF4(8250, 14628, 19451) },
-                { AOM_CDF4(5205, 9745, 13622) } } },
-            { { { AOM_CDF4(10563, 16233, 19763) },
-                { AOM_CDF4(9794, 16022, 19804) },
-                { AOM_CDF4(6750, 11945, 15759) },
-                { AOM_CDF4(4963, 9186, 12752) },
-                { AOM_CDF4(3845, 7435, 10627) },
-                { AOM_CDF4(3051, 6085, 8834) },
-                { AOM_CDF4(1311, 2596, 3830) },
-                { AOM_CDF4(11246, 16404, 19689) },
-                { AOM_CDF4(12315, 18911, 22731) },
-                { AOM_CDF4(10557, 17095, 21289) },
-                { AOM_CDF4(8136, 14006, 18249) },
-                { AOM_CDF4(6348, 11474, 15565) },
-                { AOM_CDF4(5196, 9655, 13400) },
-                { AOM_CDF4(2349, 4526, 6587) },
-                { AOM_CDF4(13337, 18730, 21569) },
-                { AOM_CDF4(19306, 26071, 28882) },
-                { AOM_CDF4(15952, 23540, 27254) },
-                { AOM_CDF4(12409, 19934, 24430) },
-                { AOM_CDF4(9760, 16706, 21389) },
-                { AOM_CDF4(8004, 14220, 18818) },
-                { AOM_CDF4(4138, 7794, 10961) } },
-              { { AOM_CDF4(10870, 16684, 20949) },
-                { AOM_CDF4(9664, 15230, 18680) },
-                { AOM_CDF4(6886, 12109, 15408) },
-                { AOM_CDF4(4825, 8900, 12305) },
-                { AOM_CDF4(3630, 7162, 10314) },
-                { AOM_CDF4(3036, 6429, 9387) },
-                { AOM_CDF4(1671, 3296, 4940) },
-                { AOM_CDF4(13819, 19159, 23026) },
-                { AOM_CDF4(11984, 19108, 23120) },
-                { AOM_CDF4(10690, 17210, 21663) },
-                { AOM_CDF4(7984, 14154, 18333) },
-                { AOM_CDF4(6868, 12294, 16124) },
-                { AOM_CDF4(5274, 8994, 12868) },
-                { AOM_CDF4(2988, 5771, 8424) },
-                { AOM_CDF4(19736, 26647, 29141) },
-                { AOM_CDF4(18933, 26070, 28984) },
-                { AOM_CDF4(15779, 23048, 27200) },
-                { AOM_CDF4(12638, 20061, 24532) },
-                { AOM_CDF4(10692, 17545, 22220) },
-                { AOM_CDF4(9217, 15251, 20054) },
-                { AOM_CDF4(5078, 9284, 12594) } } },
-            { { { AOM_CDF4(2331, 3662, 5244) },
-                { AOM_CDF4(2891, 4771, 6145) },
-                { AOM_CDF4(4598, 7623, 9729) },
-                { AOM_CDF4(3520, 6845, 9199) },
-                { AOM_CDF4(3417, 6119, 9324) },
-                { AOM_CDF4(2601, 5412, 7385) },
-                { AOM_CDF4(600, 1173, 1744) },
-                { AOM_CDF4(7672, 13286, 17469) },
-                { AOM_CDF4(4232, 7792, 10793) },
-                { AOM_CDF4(2915, 5317, 7397) },
-                { AOM_CDF4(2318, 4356, 6152) },
-                { AOM_CDF4(2127, 4000, 5554) },
-                { AOM_CDF4(1850, 3478, 5275) },
-                { AOM_CDF4(977, 1933, 2843) },
-                { AOM_CDF4(18280, 24387, 27989) },
-                { AOM_CDF4(15852, 22671, 26185) },
-                { AOM_CDF4(13845, 20951, 24789) },
-                { AOM_CDF4(11055, 17966, 22129) },
-                { AOM_CDF4(9138, 15422, 19801) },
-                { AOM_CDF4(7454, 13145, 17456) },
-                { AOM_CDF4(3370, 6393, 9013) } },
-              { { AOM_CDF4(5842, 9229, 10838) },
-                { AOM_CDF4(2313, 3491, 4276) },
-                { AOM_CDF4(2998, 6104, 7496) },
-                { AOM_CDF4(2420, 7447, 9868) },
-                { AOM_CDF4(3034, 8495, 10923) },
-                { AOM_CDF4(4076, 8937, 10975) },
-                { AOM_CDF4(1086, 2370, 3299) },
-                { AOM_CDF4(9714, 17254, 20444) },
-                { AOM_CDF4(8543, 13698, 17123) },
-                { AOM_CDF4(4918, 9007, 11910) },
-                { AOM_CDF4(4129, 7532, 10553) },
-                { AOM_CDF4(2364, 5533, 8058) },
-                { AOM_CDF4(1834, 3546, 5563) },
-                { AOM_CDF4(1473, 2908, 4133) },
-                { AOM_CDF4(15405, 21193, 25619) },
-                { AOM_CDF4(15691, 21952, 26561) },
-                { AOM_CDF4(12962, 19194, 24165) },
-                { AOM_CDF4(10272, 17855, 22129) },
-                { AOM_CDF4(8588, 15270, 20718) },
-                { AOM_CDF4(8682, 14669, 19500) },
-                { AOM_CDF4(4870, 9636, 13205) } } }
+            {
+                {
+                    { CDF3(14298, 20718, 24174) },
+                    { CDF3(12536, 19601, 23789) },
+                    { CDF3( 8712, 15051, 19503) },
+                    { CDF3( 6170, 11327, 15434) },
+                    { CDF3( 4742,  8926, 12538) },
+                    { CDF3( 3803,  7317, 10546) },
+                    { CDF3( 1696,  3317,  4871) },
+                    { CDF3(14392, 19951, 22756) },
+                    { CDF3(15978, 23218, 26818) },
+                    { CDF3(12187, 19474, 23889) },
+                    { CDF3( 9176, 15640, 20259) },
+                    { CDF3( 7068, 12655, 17028) },
+                    { CDF3( 5656, 10442, 14472) },
+                    { CDF3( 2580,  4992,  7244) },
+                    { CDF3(12136, 18049, 21426) },
+                    { CDF3(13784, 20721, 24481) },
+                    { CDF3(10836, 17621, 21900) },
+                    { CDF3( 8372, 14444, 18847) },
+                    { CDF3( 6523, 11779, 16000) },
+                    { CDF3( 5337,  9898, 13760) },
+                    { CDF3( 3034,  5860,  8462) },
+                }, {
+                    { CDF3(15967, 22905, 26286) },
+                    { CDF3(13534, 20654, 24579) },
+                    { CDF3( 9504, 16092, 20535) },
+                    { CDF3( 6975, 12568, 16903) },
+                    { CDF3( 5364, 10091, 14020) },
+                    { CDF3( 4357,  8370, 11857) },
+                    { CDF3( 2506,  4934,  7218) },
+                    { CDF3(23032, 28815, 30936) },
+                    { CDF3(19540, 26704, 29719) },
+                    { CDF3(15158, 22969, 27097) },
+                    { CDF3(11408, 18865, 23650) },
+                    { CDF3( 8885, 15448, 20250) },
+                    { CDF3( 7108, 12853, 17416) },
+                    { CDF3( 4231,  8041, 11480) },
+                    { CDF3(19823, 26490, 29156) },
+                    { CDF3(18890, 25929, 28932) },
+                    { CDF3(15660, 23491, 27433) },
+                    { CDF3(12147, 19776, 24488) },
+                    { CDF3( 9728, 16774, 21649) },
+                    { CDF3( 7919, 14277, 19066) },
+                    { CDF3( 5440, 10170, 14185) },
+                },
+            }, {
+                {
+                    { CDF3(14406, 20862, 24414) },
+                    { CDF3(11824, 18907, 23109) },
+                    { CDF3( 8257, 14393, 18803) },
+                    { CDF3( 5860, 10747, 14778) },
+                    { CDF3( 4475,  8486, 11984) },
+                    { CDF3( 3606,  6954, 10043) },
+                    { CDF3( 1736,  3410,  5048) },
+                    { CDF3(14430, 20046, 22882) },
+                    { CDF3(15593, 22899, 26709) },
+                    { CDF3(12102, 19368, 23811) },
+                    { CDF3( 9059, 15584, 20262) },
+                    { CDF3( 6999, 12603, 17048) },
+                    { CDF3( 5684, 10497, 14553) },
+                    { CDF3( 2822,  5438,  7862) },
+                    { CDF3(15785, 21585, 24359) },
+                    { CDF3(18347, 25229, 28266) },
+                    { CDF3(14974, 22487, 26389) },
+                    { CDF3(11423, 18681, 23271) },
+                    { CDF3( 8863, 15350, 20008) },
+                    { CDF3( 7153, 12852, 17278) },
+                    { CDF3( 3707,  7036,  9982) },
+                }, {
+                    { CDF3(15460, 21696, 25469) },
+                    { CDF3(12170, 19249, 23191) },
+                    { CDF3( 8723, 15027, 19332) },
+                    { CDF3( 6428, 11704, 15874) },
+                    { CDF3( 4922,  9292, 13052) },
+                    { CDF3( 4139,  7695, 11010) },
+                    { CDF3( 2291,  4508,  6598) },
+                    { CDF3(19856, 26920, 29828) },
+                    { CDF3(17923, 25289, 28792) },
+                    { CDF3(14278, 21968, 26297) },
+                    { CDF3(10910, 18136, 22950) },
+                    { CDF3( 8423, 14815, 19627) },
+                    { CDF3( 6771, 12283, 16774) },
+                    { CDF3( 4074,  7750, 11081) },
+                    { CDF3(19852, 26074, 28672) },
+                    { CDF3(19371, 26110, 28989) },
+                    { CDF3(16265, 23873, 27663) },
+                    { CDF3(12758, 20378, 24952) },
+                    { CDF3(10095, 17098, 21961) },
+                    { CDF3( 8250, 14628, 19451) },
+                    { CDF3( 5205,  9745, 13622) },
+                },
+            }, {
+                {
+                    { CDF3(10563, 16233, 19763) },
+                    { CDF3( 9794, 16022, 19804) },
+                    { CDF3( 6750, 11945, 15759) },
+                    { CDF3( 4963,  9186, 12752) },
+                    { CDF3( 3845,  7435, 10627) },
+                    { CDF3( 3051,  6085,  8834) },
+                    { CDF3( 1311,  2596,  3830) },
+                    { CDF3(11246, 16404, 19689) },
+                    { CDF3(12315, 18911, 22731) },
+                    { CDF3(10557, 17095, 21289) },
+                    { CDF3( 8136, 14006, 18249) },
+                    { CDF3( 6348, 11474, 15565) },
+                    { CDF3( 5196,  9655, 13400) },
+                    { CDF3( 2349,  4526,  6587) },
+                    { CDF3(13337, 18730, 21569) },
+                    { CDF3(19306, 26071, 28882) },
+                    { CDF3(15952, 23540, 27254) },
+                    { CDF3(12409, 19934, 24430) },
+                    { CDF3( 9760, 16706, 21389) },
+                    { CDF3( 8004, 14220, 18818) },
+                    { CDF3( 4138,  7794, 10961) },
+                }, {
+                    { CDF3(10870, 16684, 20949) },
+                    { CDF3( 9664, 15230, 18680) },
+                    { CDF3( 6886, 12109, 15408) },
+                    { CDF3( 4825,  8900, 12305) },
+                    { CDF3( 3630,  7162, 10314) },
+                    { CDF3( 3036,  6429,  9387) },
+                    { CDF3( 1671,  3296,  4940) },
+                    { CDF3(13819, 19159, 23026) },
+                    { CDF3(11984, 19108, 23120) },
+                    { CDF3(10690, 17210, 21663) },
+                    { CDF3( 7984, 14154, 18333) },
+                    { CDF3( 6868, 12294, 16124) },
+                    { CDF3( 5274,  8994, 12868) },
+                    { CDF3( 2988,  5771,  8424) },
+                    { CDF3(19736, 26647, 29141) },
+                    { CDF3(18933, 26070, 28984) },
+                    { CDF3(15779, 23048, 27200) },
+                    { CDF3(12638, 20061, 24532) },
+                    { CDF3(10692, 17545, 22220) },
+                    { CDF3( 9217, 15251, 20054) },
+                    { CDF3( 5078,  9284, 12594) },
+                },
+            }, {
+                {
+                    { CDF3( 2331,  3662,  5244) },
+                    { CDF3( 2891,  4771,  6145) },
+                    { CDF3( 4598,  7623,  9729) },
+                    { CDF3( 3520,  6845,  9199) },
+                    { CDF3( 3417,  6119,  9324) },
+                    { CDF3( 2601,  5412,  7385) },
+                    { CDF3(  600,  1173,  1744) },
+                    { CDF3( 7672, 13286, 17469) },
+                    { CDF3( 4232,  7792, 10793) },
+                    { CDF3( 2915,  5317,  7397) },
+                    { CDF3( 2318,  4356,  6152) },
+                    { CDF3( 2127,  4000,  5554) },
+                    { CDF3( 1850,  3478,  5275) },
+                    { CDF3(  977,  1933,  2843) },
+                    { CDF3(18280, 24387, 27989) },
+                    { CDF3(15852, 22671, 26185) },
+                    { CDF3(13845, 20951, 24789) },
+                    { CDF3(11055, 17966, 22129) },
+                    { CDF3( 9138, 15422, 19801) },
+                    { CDF3( 7454, 13145, 17456) },
+                    { CDF3( 3370,  6393,  9013) },
+                }, {
+                    { CDF3( 5842,  9229, 10838) },
+                    { CDF3( 2313,  3491,  4276) },
+                    { CDF3( 2998,  6104,  7496) },
+                    { CDF3( 2420,  7447,  9868) },
+                    { CDF3( 3034,  8495, 10923) },
+                    { CDF3( 4076,  8937, 10975) },
+                    { CDF3( 1086,  2370,  3299) },
+                    { CDF3( 9714, 17254, 20444) },
+                    { CDF3( 8543, 13698, 17123) },
+                    { CDF3( 4918,  9007, 11910) },
+                    { CDF3( 4129,  7532, 10553) },
+                    { CDF3( 2364,  5533,  8058) },
+                    { CDF3( 1834,  3546,  5563) },
+                    { CDF3( 1473,  2908,  4133) },
+                    { CDF3(15405, 21193, 25619) },
+                    { CDF3(15691, 21952, 26561) },
+                    { CDF3(12962, 19194, 24165) },
+                    { CDF3(10272, 17855, 22129) },
+                    { CDF3( 8588, 15270, 20718) },
+                    { CDF3( 8682, 14669, 19500) },
+                    { CDF3( 4870,  9636, 13205) },
+                },
+            },
         },
     }, [1] = {
         .skip = {
-            { { AOM_CDF2(30371) },
-                { AOM_CDF2(7570) },
-                { AOM_CDF2(13155) },
-                { AOM_CDF2(20751) },
-                { AOM_CDF2(20969) },
-                { AOM_CDF2(27067) },
-                { AOM_CDF2(32013) },
-                { AOM_CDF2(5495) },
-                { AOM_CDF2(17942) },
-                { AOM_CDF2(28280) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) } },
-            { { AOM_CDF2(31782) },
-                { AOM_CDF2(1836) },
-                { AOM_CDF2(10689) },
-                { AOM_CDF2(17604) },
-                { AOM_CDF2(21622) },
-                { AOM_CDF2(27518) },
-                { AOM_CDF2(32399) },
-                { AOM_CDF2(4419) },
-                { AOM_CDF2(16294) },
-                { AOM_CDF2(28345) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) } },
-            { { AOM_CDF2(31901) },
-                { AOM_CDF2(10311) },
-                { AOM_CDF2(18047) },
-                { AOM_CDF2(24806) },
-                { AOM_CDF2(23288) },
-                { AOM_CDF2(27914) },
-                { AOM_CDF2(32296) },
-                { AOM_CDF2(4215) },
-                { AOM_CDF2(15756) },
-                { AOM_CDF2(28341) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) } },
-            { { AOM_CDF2(26726) },
-                { AOM_CDF2(1045) },
-                { AOM_CDF2(11703) },
-                { AOM_CDF2(20590) },
-                { AOM_CDF2(18554) },
-                { AOM_CDF2(25970) },
-                { AOM_CDF2(31938) },
-                { AOM_CDF2(5583) },
-                { AOM_CDF2(21313) },
-                { AOM_CDF2(29390) },
-                { AOM_CDF2(641) },
-                { AOM_CDF2(22265) },
-                { AOM_CDF2(31452) } },
-            { { AOM_CDF2(26584) },
-                { AOM_CDF2(188) },
-                { AOM_CDF2(8847) },
-                { AOM_CDF2(24519) },
-                { AOM_CDF2(22938) },
-                { AOM_CDF2(30583) },
-                { AOM_CDF2(32608) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) } }
+            {
+                { CDF1(30371) }, { CDF1( 7570) }, { CDF1(13155) },
+                { CDF1(20751) }, { CDF1(20969) }, { CDF1(27067) },
+                { CDF1(32013) }, { CDF1( 5495) }, { CDF1(17942) },
+                { CDF1(28280) }, { CDF1(16384) }, { CDF1(16384) },
+                { CDF1(16384) },
+            }, {
+                { CDF1(31782) }, { CDF1( 1836) }, { CDF1(10689) },
+                { CDF1(17604) }, { CDF1(21622) }, { CDF1(27518) },
+                { CDF1(32399) }, { CDF1( 4419) }, { CDF1(16294) },
+                { CDF1(28345) }, { CDF1(16384) }, { CDF1(16384) },
+                { CDF1(16384) },
+            }, {
+                { CDF1(31901) }, { CDF1(10311) }, { CDF1(18047) },
+                { CDF1(24806) }, { CDF1(23288) }, { CDF1(27914) },
+                { CDF1(32296) }, { CDF1( 4215) }, { CDF1(15756) },
+                { CDF1(28341) }, { CDF1(16384) }, { CDF1(16384) },
+                { CDF1(16384) },
+            }, {
+                { CDF1(26726) }, { CDF1( 1045) }, { CDF1(11703) },
+                { CDF1(20590) }, { CDF1(18554) }, { CDF1(25970) },
+                { CDF1(31938) }, { CDF1( 5583) }, { CDF1(21313) },
+                { CDF1(29390) }, { CDF1(  641) }, { CDF1(22265) },
+                { CDF1(31452) },
+            }, {
+                { CDF1(26584) }, { CDF1(  188) }, { CDF1( 8847) },
+                { CDF1(24519) }, { CDF1(22938) }, { CDF1(30583) },
+                { CDF1(32608) }, { CDF1(16384) }, { CDF1(16384) },
+                { CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
+                { CDF1(16384) },
+            },
         }, .eob_bin_16 = {
-            { { AOM_CDF5(2125, 2551, 5165, 8946) },
-              { AOM_CDF5(513, 765, 1859, 6339) } },
-            { { AOM_CDF5(7637, 9498, 14259, 19108) },
-              { AOM_CDF5(2497, 4096, 8866, 16993) } }
+            {
+                { CDF4( 2125,  2551,  5165,  8946) },
+                { CDF4(  513,   765,  1859,  6339) },
+            }, {
+                { CDF4( 7637,  9498, 14259, 19108) },
+                { CDF4( 2497,  4096,  8866, 16993) },
+            },
         }, .eob_bin_32 = {
-            { { AOM_CDF6(989, 1249, 2019, 4151, 10785) },
-              { AOM_CDF6(313, 441, 1099, 2917, 8562) } },
-            { { AOM_CDF6(8394, 10352, 13932, 18855, 26014) },
-              { AOM_CDF6(2578, 4124, 8181, 13670, 24234) } }
+            {
+                { CDF5(  989,  1249,  2019,  4151, 10785) },
+                { CDF5(  313,   441,  1099,  2917,  8562) },
+            }, {
+                { CDF5( 8394, 10352, 13932, 18855, 26014) },
+                { CDF5( 2578,  4124,  8181, 13670, 24234) },
+            },
         }, .eob_bin_64 = {
-            { { AOM_CDF7(1260, 1446, 2253, 3712, 6652, 13369) },
-              { AOM_CDF7(401, 605, 1029, 2563, 5845, 12626) } },
-            { { AOM_CDF7(8609, 10612, 14624, 18714, 22614, 29024) },
-              { AOM_CDF7(1923, 3127, 5867, 9703, 14277, 27100) } }
+            {
+                { CDF6( 1260,  1446,  2253,  3712,  6652, 13369) },
+                { CDF6(  401,   605,  1029,  2563,  5845, 12626) },
+            }, {
+                { CDF6( 8609, 10612, 14624, 18714, 22614, 29024) },
+                { CDF6( 1923,  3127,  5867,  9703, 14277, 27100) },
+            },
         }, .eob_bin_128 = {
-            { { AOM_CDF8(685, 933, 1488, 2714, 4766, 8562, 19254) },
-              { AOM_CDF8(217, 352, 618, 2303, 5261, 9969, 17472) } },
-            { { AOM_CDF8(8045, 11200, 15497, 19595, 23948, 27408, 30938) },
-              { AOM_CDF8(2310, 4160, 7471, 14997, 17931, 20768, 30240) } }
+            {
+                { CDF7(  685,   933,  1488,  2714,  4766,  8562, 19254) },
+                { CDF7(  217,   352,   618,  2303,  5261,  9969, 17472) },
+            }, {
+                { CDF7( 8045, 11200, 15497, 19595, 23948, 27408, 30938) },
+                { CDF7( 2310,  4160,  7471, 14997, 17931, 20768, 30240) },
+            },
         }, .eob_bin_256 = {
-            { { AOM_CDF9(1448, 2109, 4151, 6263, 9329, 13260, 17944, 23300) },
-              { AOM_CDF9(399, 1019, 1749, 3038, 10444, 15546, 22739, 27294) } },
-            { { AOM_CDF9(6402, 8148, 12623, 15072, 18728, 22847, 26447, 29377) },
-              { AOM_CDF9(1674, 3252, 5734, 10159, 22397, 23802, 24821, 30940) } }
+            {
+                { CDF8( 1448,  2109,  4151,  6263,
+                        9329, 13260, 17944, 23300) },
+                { CDF8(  399,  1019,  1749,  3038,
+                       10444, 15546, 22739, 27294) },
+            }, {
+                { CDF8( 6402,  8148, 12623, 15072,
+                       18728, 22847, 26447, 29377) },
+                { CDF8( 1674,  3252,  5734, 10159,
+                       22397, 23802, 24821, 30940) },
+            },
         }, .eob_bin_512 = {
-            { { AOM_CDF10(1230, 2278, 5035, 7776, 11871, 15346, 19590,
-                          24584, 28749) },
-              { AOM_CDF10(3277, 6554, 9830, 13107, 16384, 19661, 22938,
-                          26214, 29491) } },
-            { { AOM_CDF10(7265, 9979, 15819, 19250, 21780, 23846, 26478,
-                          28396, 31811) },
-              { AOM_CDF10(3277, 6554, 9830, 13107, 16384, 19661, 22938,
-                          26214, 29491) } }
+            { CDF9( 1230,  2278,  5035,  7776, 11871,
+                   15346, 19590, 24584, 28749) },
+            { CDF9( 7265,  9979, 15819, 19250, 21780,
+                   23846, 26478, 28396, 31811) },
         }, .eob_bin_1024 = {
-            { { AOM_CDF11(696, 948, 3145, 5702, 9706, 13217, 17851,
-                          21856, 25692, 28034) },
-              { AOM_CDF11(2979, 5958, 8937, 11916, 14895, 17873, 20852,
-                          23831, 26810, 29789) } },
-            { { AOM_CDF11(2672, 3591, 9330, 17084, 22725, 24284, 26527,
-                          28027, 28377, 30876) },
-              { AOM_CDF11(2979, 5958, 8937, 11916, 14895, 17873, 20852,
-                          23831, 26810, 29789) } }
+            { CDF10(  696,   948,  3145,  5702,  9706,
+                    13217, 17851, 21856, 25692, 28034) },
+            { CDF10( 2672,  3591,  9330, 17084, 22725,
+                    24284, 26527, 28027, 28377, 30876) },
         }, .eob_hi_bit = {
-            { { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(17471) }, { AOM_CDF2(20223) }, { AOM_CDF2(11357) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) } },
-              { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(20335) }, { AOM_CDF2(21667) }, { AOM_CDF2(14818) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) } } },
-            { { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(20430) }, { AOM_CDF2(20662) }, { AOM_CDF2(15367) },
-                { AOM_CDF2(16970) }, { AOM_CDF2(14657) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) } },
-              { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(22117) }, { AOM_CDF2(22028) }, { AOM_CDF2(18650) },
-                { AOM_CDF2(16042) }, { AOM_CDF2(15885) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) } } },
-            { { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(22409) }, { AOM_CDF2(21012) }, { AOM_CDF2(15650) },
-                { AOM_CDF2(17395) }, { AOM_CDF2(15469) }, { AOM_CDF2(20205) },
-                { AOM_CDF2(19511) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) } },
-              { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(24220) }, { AOM_CDF2(22480) }, { AOM_CDF2(17737) },
-                { AOM_CDF2(18916) }, { AOM_CDF2(19268) }, { AOM_CDF2(18412) },
-                { AOM_CDF2(18844) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) } } },
-            { { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(25991) }, { AOM_CDF2(20314) }, { AOM_CDF2(17731) },
-                { AOM_CDF2(19678) }, { AOM_CDF2(18649) }, { AOM_CDF2(17307) },
-                { AOM_CDF2(21798) }, { AOM_CDF2(17549) }, { AOM_CDF2(15630) } },
-              { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(26585) }, { AOM_CDF2(21469) }, { AOM_CDF2(20432) },
-                { AOM_CDF2(17735) }, { AOM_CDF2(19280) }, { AOM_CDF2(15235) },
-                { AOM_CDF2(20297) }, { AOM_CDF2(22471) }, { AOM_CDF2(28997) } } },
-            { { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(26605) }, { AOM_CDF2(11304) }, { AOM_CDF2(16726) },
-                { AOM_CDF2(16560) }, { AOM_CDF2(20866) }, { AOM_CDF2(23524) },
-                { AOM_CDF2(19878) }, { AOM_CDF2(13469) }, { AOM_CDF2(23084) } },
-              { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) } } }
+            {
+                {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(17471) },
+                    { CDF1(20223) }, { CDF1(11357) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) },
+                }, {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(20335) },
+                    { CDF1(21667) }, { CDF1(14818) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) },
+                },
+            }, {
+                {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(20430) },
+                    { CDF1(20662) }, { CDF1(15367) }, { CDF1(16970) },
+                    { CDF1(14657) }, { CDF1(16384) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) },
+                }, {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(22117) },
+                    { CDF1(22028) }, { CDF1(18650) }, { CDF1(16042) },
+                    { CDF1(15885) }, { CDF1(16384) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) },
+                },
+            }, {
+                {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(22409) },
+                    { CDF1(21012) }, { CDF1(15650) }, { CDF1(17395) },
+                    { CDF1(15469) }, { CDF1(20205) }, { CDF1(19511) },
+                    { CDF1(16384) }, { CDF1(16384) },
+                }, {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(24220) },
+                    { CDF1(22480) }, { CDF1(17737) }, { CDF1(18916) },
+                    { CDF1(19268) }, { CDF1(18412) }, { CDF1(18844) },
+                    { CDF1(16384) }, { CDF1(16384) },
+                },
+            }, {
+                {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(25991) },
+                    { CDF1(20314) }, { CDF1(17731) }, { CDF1(19678) },
+                    { CDF1(18649) }, { CDF1(17307) }, { CDF1(21798) },
+                    { CDF1(17549) }, { CDF1(15630) },
+                }, {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(26585) },
+                    { CDF1(21469) }, { CDF1(20432) }, { CDF1(17735) },
+                    { CDF1(19280) }, { CDF1(15235) }, { CDF1(20297) },
+                    { CDF1(22471) }, { CDF1(28997) },
+                },
+            }, {
+                {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(26605) },
+                    { CDF1(11304) }, { CDF1(16726) }, { CDF1(16560) },
+                    { CDF1(20866) }, { CDF1(23524) }, { CDF1(19878) },
+                    { CDF1(13469) }, { CDF1(23084) },
+                }, {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) },
+                },
+            },
         }, .eob_base_tok = {
-            { { { AOM_CDF3(17560, 29888) },
-                { AOM_CDF3(29671, 31549) },
-                { AOM_CDF3(31007, 32056) },
-                { AOM_CDF3(27286, 30006) } },
-              { { AOM_CDF3(26594, 31212) },
-                { AOM_CDF3(31208, 32582) },
-                { AOM_CDF3(31835, 32637) },
-                { AOM_CDF3(30595, 32206) } } },
-            { { { AOM_CDF3(15239, 29932) },
-                { AOM_CDF3(31315, 32095) },
-                { AOM_CDF3(32130, 32434) },
-                { AOM_CDF3(30864, 31996) } },
-              { { AOM_CDF3(26279, 30968) },
-                { AOM_CDF3(31142, 32495) },
-                { AOM_CDF3(31713, 32540) },
-                { AOM_CDF3(31929, 32594) } } },
-            { { { AOM_CDF3(2644, 25198) },
-                { AOM_CDF3(32038, 32451) },
-                { AOM_CDF3(32639, 32695) },
-                { AOM_CDF3(32166, 32518) } },
-              { { AOM_CDF3(17187, 27668) },
-                { AOM_CDF3(31714, 32550) },
-                { AOM_CDF3(32283, 32678) },
-                { AOM_CDF3(31930, 32563) } } },
-            { { { AOM_CDF3(1044, 2257) },
-                { AOM_CDF3(30755, 31923) },
-                { AOM_CDF3(32208, 32693) },
-                { AOM_CDF3(32244, 32615) } },
-              { { AOM_CDF3(21317, 26207) },
-                { AOM_CDF3(29133, 30868) },
-                { AOM_CDF3(29311, 31231) },
-                { AOM_CDF3(29657, 31087) } } },
-            { { { AOM_CDF3(478, 1834) },
-                { AOM_CDF3(31005, 31987) },
-                { AOM_CDF3(32317, 32724) },
-                { AOM_CDF3(30865, 32648) } },
-              { { AOM_CDF3(10923, 21845) },
-                { AOM_CDF3(10923, 21845) },
-                { AOM_CDF3(10923, 21845) },
-                { AOM_CDF3(10923, 21845) } } }
+            {
+                {
+                    { CDF2(17560, 29888) }, { CDF2(29671, 31549) },
+                    { CDF2(31007, 32056) }, { CDF2(27286, 30006) },
+                }, {
+                    { CDF2(26594, 31212) }, { CDF2(31208, 32582) },
+                    { CDF2(31835, 32637) }, { CDF2(30595, 32206) },
+                },
+            }, {
+                {
+                    { CDF2(15239, 29932) }, { CDF2(31315, 32095) },
+                    { CDF2(32130, 32434) }, { CDF2(30864, 31996) },
+                }, {
+                    { CDF2(26279, 30968) }, { CDF2(31142, 32495) },
+                    { CDF2(31713, 32540) }, { CDF2(31929, 32594) },
+                },
+            }, {
+                {
+                    { CDF2( 2644, 25198) }, { CDF2(32038, 32451) },
+                    { CDF2(32639, 32695) }, { CDF2(32166, 32518) },
+                }, {
+                    { CDF2(17187, 27668) }, { CDF2(31714, 32550) },
+                    { CDF2(32283, 32678) }, { CDF2(31930, 32563) },
+                },
+            }, {
+                {
+                    { CDF2( 1044,  2257) }, { CDF2(30755, 31923) },
+                    { CDF2(32208, 32693) }, { CDF2(32244, 32615) },
+                }, {
+                    { CDF2(21317, 26207) }, { CDF2(29133, 30868) },
+                    { CDF2(29311, 31231) }, { CDF2(29657, 31087) },
+                },
+            }, {
+                {
+                    { CDF2(  478,  1834) }, { CDF2(31005, 31987) },
+                    { CDF2(32317, 32724) }, { CDF2(30865, 32648) },
+                }, {
+                    { CDF2(10923, 21845) }, { CDF2(10923, 21845) },
+                    { CDF2(10923, 21845) }, { CDF2(10923, 21845) },
+                },
+            },
         }, .base_tok = {
-            { { { AOM_CDF4(6041, 11854, 15927) },
-                { AOM_CDF4(20326, 30905, 32251) },
-                { AOM_CDF4(14164, 26831, 30725) },
-                { AOM_CDF4(9760, 20647, 26585) },
-                { AOM_CDF4(6416, 14953, 21219) },
-                { AOM_CDF4(2966, 7151, 10891) },
-                { AOM_CDF4(23567, 31374, 32254) },
-                { AOM_CDF4(14978, 27416, 30946) },
-                { AOM_CDF4(9434, 20225, 26254) },
-                { AOM_CDF4(6658, 14558, 20535) },
-                { AOM_CDF4(3916, 8677, 12989) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(18088, 29545, 31587) },
-                { AOM_CDF4(13062, 25843, 30073) },
-                { AOM_CDF4(8940, 16827, 22251) },
-                { AOM_CDF4(7654, 13220, 17973) },
-                { AOM_CDF4(5733, 10316, 14456) },
-                { AOM_CDF4(22879, 31388, 32114) },
-                { AOM_CDF4(15215, 27993, 30955) },
-                { AOM_CDF4(9397, 19445, 24978) },
-                { AOM_CDF4(3442, 9813, 15344) },
-                { AOM_CDF4(1368, 3936, 6532) },
-                { AOM_CDF4(25494, 32033, 32406) },
-                { AOM_CDF4(16772, 27963, 30718) },
-                { AOM_CDF4(9419, 18165, 23260) },
-                { AOM_CDF4(2677, 7501, 11797) },
-                { AOM_CDF4(1516, 4344, 7170) },
-                { AOM_CDF4(26556, 31454, 32101) },
-                { AOM_CDF4(17128, 27035, 30108) },
-                { AOM_CDF4(8324, 15344, 20249) },
-                { AOM_CDF4(1903, 5696, 9469) },
-                { AOM_CDF4(8192, 16384, 24576) } },
-              { { AOM_CDF4(8455, 19003, 24368) },
-                { AOM_CDF4(23563, 32021, 32604) },
-                { AOM_CDF4(16237, 29446, 31935) },
-                { AOM_CDF4(10724, 23999, 29358) },
-                { AOM_CDF4(6725, 17528, 24416) },
-                { AOM_CDF4(3927, 10927, 16825) },
-                { AOM_CDF4(26313, 32288, 32634) },
-                { AOM_CDF4(17430, 30095, 32095) },
-                { AOM_CDF4(11116, 24606, 29679) },
-                { AOM_CDF4(7195, 18384, 25269) },
-                { AOM_CDF4(4726, 12852, 19315) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(22822, 31648, 32483) },
-                { AOM_CDF4(16724, 29633, 31929) },
-                { AOM_CDF4(10261, 23033, 28725) },
-                { AOM_CDF4(7029, 17840, 24528) },
-                { AOM_CDF4(4867, 13886, 21502) },
-                { AOM_CDF4(25298, 31892, 32491) },
-                { AOM_CDF4(17809, 29330, 31512) },
-                { AOM_CDF4(9668, 21329, 26579) },
-                { AOM_CDF4(4774, 12956, 18976) },
-                { AOM_CDF4(2322, 7030, 11540) },
-                { AOM_CDF4(25472, 31920, 32543) },
-                { AOM_CDF4(17957, 29387, 31632) },
-                { AOM_CDF4(9196, 20593, 26400) },
-                { AOM_CDF4(4680, 12705, 19202) },
-                { AOM_CDF4(2917, 8456, 13436) },
-                { AOM_CDF4(26471, 32059, 32574) },
-                { AOM_CDF4(18458, 29783, 31909) },
-                { AOM_CDF4(8400, 19464, 25956) },
-                { AOM_CDF4(3812, 10973, 17206) },
-                { AOM_CDF4(8192, 16384, 24576) } } },
-            { { { AOM_CDF4(6779, 13743, 17678) },
-                { AOM_CDF4(24806, 31797, 32457) },
-                { AOM_CDF4(17616, 29047, 31372) },
-                { AOM_CDF4(11063, 23175, 28003) },
-                { AOM_CDF4(6521, 16110, 22324) },
-                { AOM_CDF4(2764, 7504, 11654) },
-                { AOM_CDF4(25266, 32367, 32637) },
-                { AOM_CDF4(19054, 30553, 32175) },
-                { AOM_CDF4(12139, 25212, 29807) },
-                { AOM_CDF4(7311, 18162, 24704) },
-                { AOM_CDF4(3397, 9164, 14074) },
-                { AOM_CDF4(25988, 32208, 32522) },
-                { AOM_CDF4(16253, 28912, 31526) },
-                { AOM_CDF4(9151, 21387, 27372) },
-                { AOM_CDF4(5688, 14915, 21496) },
-                { AOM_CDF4(2717, 7627, 12004) },
-                { AOM_CDF4(23144, 31855, 32443) },
-                { AOM_CDF4(16070, 28491, 31325) },
-                { AOM_CDF4(8702, 20467, 26517) },
-                { AOM_CDF4(5243, 13956, 20367) },
-                { AOM_CDF4(2621, 7335, 11567) },
-                { AOM_CDF4(26636, 32340, 32630) },
-                { AOM_CDF4(19990, 31050, 32341) },
-                { AOM_CDF4(13243, 26105, 30315) },
-                { AOM_CDF4(8588, 19521, 25918) },
-                { AOM_CDF4(4717, 11585, 17304) },
-                { AOM_CDF4(25844, 32292, 32582) },
-                { AOM_CDF4(19090, 30635, 32097) },
-                { AOM_CDF4(11963, 24546, 28939) },
-                { AOM_CDF4(6218, 16087, 22354) },
-                { AOM_CDF4(2340, 6608, 10426) },
-                { AOM_CDF4(28046, 32576, 32694) },
-                { AOM_CDF4(21178, 31313, 32296) },
-                { AOM_CDF4(13486, 26184, 29870) },
-                { AOM_CDF4(7149, 17871, 23723) },
-                { AOM_CDF4(2833, 7958, 12259) },
-                { AOM_CDF4(27710, 32528, 32686) },
-                { AOM_CDF4(20674, 31076, 32268) },
-                { AOM_CDF4(12413, 24955, 29243) },
-                { AOM_CDF4(6676, 16927, 23097) },
-                { AOM_CDF4(2966, 8333, 12919) } },
-              { { AOM_CDF4(8639, 19339, 24429) },
-                { AOM_CDF4(24404, 31837, 32525) },
-                { AOM_CDF4(16997, 29425, 31784) },
-                { AOM_CDF4(11253, 24234, 29149) },
-                { AOM_CDF4(6751, 17394, 24028) },
-                { AOM_CDF4(3490, 9830, 15191) },
-                { AOM_CDF4(26283, 32471, 32714) },
-                { AOM_CDF4(19599, 31168, 32442) },
-                { AOM_CDF4(13146, 26954, 30893) },
-                { AOM_CDF4(8214, 20588, 26890) },
-                { AOM_CDF4(4699, 13081, 19300) },
-                { AOM_CDF4(28212, 32458, 32669) },
-                { AOM_CDF4(18594, 30316, 32100) },
-                { AOM_CDF4(11219, 24408, 29234) },
-                { AOM_CDF4(6865, 17656, 24149) },
-                { AOM_CDF4(3678, 10362, 16006) },
-                { AOM_CDF4(25825, 32136, 32616) },
-                { AOM_CDF4(17313, 29853, 32021) },
-                { AOM_CDF4(11197, 24471, 29472) },
-                { AOM_CDF4(6947, 17781, 24405) },
-                { AOM_CDF4(3768, 10660, 16261) },
-                { AOM_CDF4(27352, 32500, 32706) },
-                { AOM_CDF4(20850, 31468, 32469) },
-                { AOM_CDF4(14021, 27707, 31133) },
-                { AOM_CDF4(8964, 21748, 27838) },
-                { AOM_CDF4(5437, 14665, 21187) },
-                { AOM_CDF4(26304, 32492, 32698) },
-                { AOM_CDF4(20409, 31380, 32385) },
-                { AOM_CDF4(13682, 27222, 30632) },
-                { AOM_CDF4(8974, 21236, 26685) },
-                { AOM_CDF4(4234, 11665, 16934) },
-                { AOM_CDF4(26273, 32357, 32711) },
-                { AOM_CDF4(20672, 31242, 32441) },
-                { AOM_CDF4(14172, 27254, 30902) },
-                { AOM_CDF4(9870, 21898, 27275) },
-                { AOM_CDF4(5164, 13506, 19270) },
-                { AOM_CDF4(26725, 32459, 32728) },
-                { AOM_CDF4(20991, 31442, 32527) },
-                { AOM_CDF4(13071, 26434, 30811) },
-                { AOM_CDF4(8184, 20090, 26742) },
-                { AOM_CDF4(4803, 13255, 19895) } } },
-            { { { AOM_CDF4(7555, 14942, 18501) },
-                { AOM_CDF4(24410, 31178, 32287) },
-                { AOM_CDF4(14394, 26738, 30253) },
-                { AOM_CDF4(8413, 19554, 25195) },
-                { AOM_CDF4(4766, 12924, 18785) },
-                { AOM_CDF4(2029, 5806, 9207) },
-                { AOM_CDF4(26776, 32364, 32663) },
-                { AOM_CDF4(18732, 29967, 31931) },
-                { AOM_CDF4(11005, 23786, 28852) },
-                { AOM_CDF4(6466, 16909, 23510) },
-                { AOM_CDF4(3044, 8638, 13419) },
-                { AOM_CDF4(29208, 32582, 32704) },
-                { AOM_CDF4(20068, 30857, 32208) },
-                { AOM_CDF4(12003, 25085, 29595) },
-                { AOM_CDF4(6947, 17750, 24189) },
-                { AOM_CDF4(3245, 9103, 14007) },
-                { AOM_CDF4(27359, 32465, 32669) },
-                { AOM_CDF4(19421, 30614, 32174) },
-                { AOM_CDF4(11915, 25010, 29579) },
-                { AOM_CDF4(6950, 17676, 24074) },
-                { AOM_CDF4(3007, 8473, 13096) },
-                { AOM_CDF4(29002, 32676, 32735) },
-                { AOM_CDF4(22102, 31849, 32576) },
-                { AOM_CDF4(14408, 28009, 31405) },
-                { AOM_CDF4(9027, 21679, 27931) },
-                { AOM_CDF4(4694, 12678, 18748) },
-                { AOM_CDF4(28216, 32528, 32682) },
-                { AOM_CDF4(20849, 31264, 32318) },
-                { AOM_CDF4(12756, 25815, 29751) },
-                { AOM_CDF4(7565, 18801, 24923) },
-                { AOM_CDF4(3509, 9533, 14477) },
-                { AOM_CDF4(30133, 32687, 32739) },
-                { AOM_CDF4(23063, 31910, 32515) },
-                { AOM_CDF4(14588, 28051, 31132) },
-                { AOM_CDF4(9085, 21649, 27457) },
-                { AOM_CDF4(4261, 11654, 17264) },
-                { AOM_CDF4(29518, 32691, 32748) },
-                { AOM_CDF4(22451, 31959, 32613) },
-                { AOM_CDF4(14864, 28722, 31700) },
-                { AOM_CDF4(9695, 22964, 28716) },
-                { AOM_CDF4(4932, 13358, 19502) } },
-              { { AOM_CDF4(6465, 16958, 21688) },
-                { AOM_CDF4(25199, 31514, 32360) },
-                { AOM_CDF4(14774, 27149, 30607) },
-                { AOM_CDF4(9257, 21438, 26972) },
-                { AOM_CDF4(5723, 15183, 21882) },
-                { AOM_CDF4(3150, 8879, 13731) },
-                { AOM_CDF4(26989, 32262, 32682) },
-                { AOM_CDF4(17396, 29937, 32085) },
-                { AOM_CDF4(11387, 24901, 29784) },
-                { AOM_CDF4(7289, 18821, 25548) },
-                { AOM_CDF4(3734, 10577, 16086) },
-                { AOM_CDF4(29728, 32501, 32695) },
-                { AOM_CDF4(17431, 29701, 31903) },
-                { AOM_CDF4(9921, 22826, 28300) },
-                { AOM_CDF4(5896, 15434, 22068) },
-                { AOM_CDF4(3430, 9646, 14757) },
-                { AOM_CDF4(28614, 32511, 32705) },
-                { AOM_CDF4(19364, 30638, 32263) },
-                { AOM_CDF4(13129, 26254, 30402) },
-                { AOM_CDF4(8754, 20484, 26440) },
-                { AOM_CDF4(4378, 11607, 17110) },
-                { AOM_CDF4(30292, 32671, 32744) },
-                { AOM_CDF4(21780, 31603, 32501) },
-                { AOM_CDF4(14314, 27829, 31291) },
-                { AOM_CDF4(9611, 22327, 28263) },
-                { AOM_CDF4(4890, 13087, 19065) },
-                { AOM_CDF4(25862, 32567, 32733) },
-                { AOM_CDF4(20794, 32050, 32567) },
-                { AOM_CDF4(17243, 30625, 32254) },
-                { AOM_CDF4(13283, 27628, 31474) },
-                { AOM_CDF4(9669, 22532, 28918) },
-                { AOM_CDF4(27435, 32697, 32748) },
-                { AOM_CDF4(24922, 32390, 32714) },
-                { AOM_CDF4(21449, 31504, 32536) },
-                { AOM_CDF4(16392, 29729, 31832) },
-                { AOM_CDF4(11692, 24884, 29076) },
-                { AOM_CDF4(24193, 32290, 32735) },
-                { AOM_CDF4(18909, 31104, 32563) },
-                { AOM_CDF4(12236, 26841, 31403) },
-                { AOM_CDF4(8171, 21840, 29082) },
-                { AOM_CDF4(7224, 17280, 25275) } } },
-            { { { AOM_CDF4(3078, 6839, 9890) },
-                { AOM_CDF4(13837, 20450, 24479) },
-                { AOM_CDF4(5914, 14222, 19328) },
-                { AOM_CDF4(3866, 10267, 14762) },
-                { AOM_CDF4(2612, 7208, 11042) },
-                { AOM_CDF4(1067, 2991, 4776) },
-                { AOM_CDF4(25817, 31646, 32529) },
-                { AOM_CDF4(13708, 26338, 30385) },
-                { AOM_CDF4(7328, 18585, 24870) },
-                { AOM_CDF4(4691, 13080, 19276) },
-                { AOM_CDF4(1825, 5253, 8352) },
-                { AOM_CDF4(29386, 32315, 32624) },
-                { AOM_CDF4(17160, 29001, 31360) },
-                { AOM_CDF4(9602, 21862, 27396) },
-                { AOM_CDF4(5915, 15772, 22148) },
-                { AOM_CDF4(2786, 7779, 12047) },
-                { AOM_CDF4(29246, 32450, 32663) },
-                { AOM_CDF4(18696, 29929, 31818) },
-                { AOM_CDF4(10510, 23369, 28560) },
-                { AOM_CDF4(6229, 16499, 23125) },
-                { AOM_CDF4(2608, 7448, 11705) },
-                { AOM_CDF4(30753, 32710, 32748) },
-                { AOM_CDF4(21638, 31487, 32503) },
-                { AOM_CDF4(12937, 26854, 30870) },
-                { AOM_CDF4(8182, 20596, 26970) },
-                { AOM_CDF4(3637, 10269, 15497) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) } },
-              { { AOM_CDF4(5244, 12150, 16906) },
-                { AOM_CDF4(20486, 26858, 29701) },
-                { AOM_CDF4(7756, 18317, 23735) },
-                { AOM_CDF4(3452, 9256, 13146) },
-                { AOM_CDF4(2020, 5206, 8229) },
-                { AOM_CDF4(1801, 4993, 7903) },
-                { AOM_CDF4(27051, 31858, 32531) },
-                { AOM_CDF4(15988, 27531, 30619) },
-                { AOM_CDF4(9188, 21484, 26719) },
-                { AOM_CDF4(6273, 17186, 23800) },
-                { AOM_CDF4(3108, 9355, 14764) },
-                { AOM_CDF4(31076, 32520, 32680) },
-                { AOM_CDF4(18119, 30037, 31850) },
-                { AOM_CDF4(10244, 22969, 27472) },
-                { AOM_CDF4(4692, 14077, 19273) },
-                { AOM_CDF4(3694, 11677, 17556) },
-                { AOM_CDF4(30060, 32581, 32720) },
-                { AOM_CDF4(21011, 30775, 32120) },
-                { AOM_CDF4(11931, 24820, 29289) },
-                { AOM_CDF4(7119, 17662, 24356) },
-                { AOM_CDF4(3833, 10706, 16304) },
-                { AOM_CDF4(31954, 32731, 32748) },
-                { AOM_CDF4(23913, 31724, 32489) },
-                { AOM_CDF4(15520, 28060, 31286) },
-                { AOM_CDF4(11517, 23008, 28571) },
-                { AOM_CDF4(6193, 14508, 20629) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) } } },
-            { { { AOM_CDF4(1035, 2807, 4156) },
-                { AOM_CDF4(13162, 18138, 20939) },
-                { AOM_CDF4(2696, 6633, 8755) },
-                { AOM_CDF4(1373, 4161, 6853) },
-                { AOM_CDF4(1099, 2746, 4716) },
-                { AOM_CDF4(340, 1021, 1599) },
-                { AOM_CDF4(22826, 30419, 32135) },
-                { AOM_CDF4(10395, 21762, 26942) },
-                { AOM_CDF4(4726, 12407, 17361) },
-                { AOM_CDF4(2447, 7080, 10593) },
-                { AOM_CDF4(1227, 3717, 6011) },
-                { AOM_CDF4(28156, 31424, 31934) },
-                { AOM_CDF4(16915, 27754, 30373) },
-                { AOM_CDF4(9148, 20990, 26431) },
-                { AOM_CDF4(5950, 15515, 21148) },
-                { AOM_CDF4(2492, 7327, 11526) },
-                { AOM_CDF4(30602, 32477, 32670) },
-                { AOM_CDF4(20026, 29955, 31568) },
-                { AOM_CDF4(11220, 23628, 28105) },
-                { AOM_CDF4(6652, 17019, 22973) },
-                { AOM_CDF4(3064, 8536, 13043) },
-                { AOM_CDF4(31769, 32724, 32748) },
-                { AOM_CDF4(22230, 30887, 32373) },
-                { AOM_CDF4(12234, 25079, 29731) },
-                { AOM_CDF4(7326, 18816, 25353) },
-                { AOM_CDF4(3933, 10907, 16616) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) } },
-              { { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) },
-                { AOM_CDF4(8192, 16384, 24576) } } }
+            {
+                {
+                    { CDF3( 6041, 11854, 15927) },
+                    { CDF3(20326, 30905, 32251) },
+                    { CDF3(14164, 26831, 30725) },
+                    { CDF3( 9760, 20647, 26585) },
+                    { CDF3( 6416, 14953, 21219) },
+                    { CDF3( 2966,  7151, 10891) },
+                    { CDF3(23567, 31374, 32254) },
+                    { CDF3(14978, 27416, 30946) },
+                    { CDF3( 9434, 20225, 26254) },
+                    { CDF3( 6658, 14558, 20535) },
+                    { CDF3( 3916,  8677, 12989) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3(18088, 29545, 31587) },
+                    { CDF3(13062, 25843, 30073) },
+                    { CDF3( 8940, 16827, 22251) },
+                    { CDF3( 7654, 13220, 17973) },
+                    { CDF3( 5733, 10316, 14456) },
+                    { CDF3(22879, 31388, 32114) },
+                    { CDF3(15215, 27993, 30955) },
+                    { CDF3( 9397, 19445, 24978) },
+                    { CDF3( 3442,  9813, 15344) },
+                    { CDF3( 1368,  3936,  6532) },
+                    { CDF3(25494, 32033, 32406) },
+                    { CDF3(16772, 27963, 30718) },
+                    { CDF3( 9419, 18165, 23260) },
+                    { CDF3( 2677,  7501, 11797) },
+                    { CDF3( 1516,  4344,  7170) },
+                    { CDF3(26556, 31454, 32101) },
+                    { CDF3(17128, 27035, 30108) },
+                    { CDF3( 8324, 15344, 20249) },
+                    { CDF3( 1903,  5696,  9469) },
+                    { CDF3( 8192, 16384, 24576) },
+                }, {
+                    { CDF3( 8455, 19003, 24368) },
+                    { CDF3(23563, 32021, 32604) },
+                    { CDF3(16237, 29446, 31935) },
+                    { CDF3(10724, 23999, 29358) },
+                    { CDF3( 6725, 17528, 24416) },
+                    { CDF3( 3927, 10927, 16825) },
+                    { CDF3(26313, 32288, 32634) },
+                    { CDF3(17430, 30095, 32095) },
+                    { CDF3(11116, 24606, 29679) },
+                    { CDF3( 7195, 18384, 25269) },
+                    { CDF3( 4726, 12852, 19315) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3(22822, 31648, 32483) },
+                    { CDF3(16724, 29633, 31929) },
+                    { CDF3(10261, 23033, 28725) },
+                    { CDF3( 7029, 17840, 24528) },
+                    { CDF3( 4867, 13886, 21502) },
+                    { CDF3(25298, 31892, 32491) },
+                    { CDF3(17809, 29330, 31512) },
+                    { CDF3( 9668, 21329, 26579) },
+                    { CDF3( 4774, 12956, 18976) },
+                    { CDF3( 2322,  7030, 11540) },
+                    { CDF3(25472, 31920, 32543) },
+                    { CDF3(17957, 29387, 31632) },
+                    { CDF3( 9196, 20593, 26400) },
+                    { CDF3( 4680, 12705, 19202) },
+                    { CDF3( 2917,  8456, 13436) },
+                    { CDF3(26471, 32059, 32574) },
+                    { CDF3(18458, 29783, 31909) },
+                    { CDF3( 8400, 19464, 25956) },
+                    { CDF3( 3812, 10973, 17206) },
+                    { CDF3( 8192, 16384, 24576) },
+                },
+            }, {
+                {
+                    { CDF3( 6779, 13743, 17678) },
+                    { CDF3(24806, 31797, 32457) },
+                    { CDF3(17616, 29047, 31372) },
+                    { CDF3(11063, 23175, 28003) },
+                    { CDF3( 6521, 16110, 22324) },
+                    { CDF3( 2764,  7504, 11654) },
+                    { CDF3(25266, 32367, 32637) },
+                    { CDF3(19054, 30553, 32175) },
+                    { CDF3(12139, 25212, 29807) },
+                    { CDF3( 7311, 18162, 24704) },
+                    { CDF3( 3397,  9164, 14074) },
+                    { CDF3(25988, 32208, 32522) },
+                    { CDF3(16253, 28912, 31526) },
+                    { CDF3( 9151, 21387, 27372) },
+                    { CDF3( 5688, 14915, 21496) },
+                    { CDF3( 2717,  7627, 12004) },
+                    { CDF3(23144, 31855, 32443) },
+                    { CDF3(16070, 28491, 31325) },
+                    { CDF3( 8702, 20467, 26517) },
+                    { CDF3( 5243, 13956, 20367) },
+                    { CDF3( 2621,  7335, 11567) },
+                    { CDF3(26636, 32340, 32630) },
+                    { CDF3(19990, 31050, 32341) },
+                    { CDF3(13243, 26105, 30315) },
+                    { CDF3( 8588, 19521, 25918) },
+                    { CDF3( 4717, 11585, 17304) },
+                    { CDF3(25844, 32292, 32582) },
+                    { CDF3(19090, 30635, 32097) },
+                    { CDF3(11963, 24546, 28939) },
+                    { CDF3( 6218, 16087, 22354) },
+                    { CDF3( 2340,  6608, 10426) },
+                    { CDF3(28046, 32576, 32694) },
+                    { CDF3(21178, 31313, 32296) },
+                    { CDF3(13486, 26184, 29870) },
+                    { CDF3( 7149, 17871, 23723) },
+                    { CDF3( 2833,  7958, 12259) },
+                    { CDF3(27710, 32528, 32686) },
+                    { CDF3(20674, 31076, 32268) },
+                    { CDF3(12413, 24955, 29243) },
+                    { CDF3( 6676, 16927, 23097) },
+                    { CDF3( 2966,  8333, 12919) },
+                }, {
+                    { CDF3( 8639, 19339, 24429) },
+                    { CDF3(24404, 31837, 32525) },
+                    { CDF3(16997, 29425, 31784) },
+                    { CDF3(11253, 24234, 29149) },
+                    { CDF3( 6751, 17394, 24028) },
+                    { CDF3( 3490,  9830, 15191) },
+                    { CDF3(26283, 32471, 32714) },
+                    { CDF3(19599, 31168, 32442) },
+                    { CDF3(13146, 26954, 30893) },
+                    { CDF3( 8214, 20588, 26890) },
+                    { CDF3( 4699, 13081, 19300) },
+                    { CDF3(28212, 32458, 32669) },
+                    { CDF3(18594, 30316, 32100) },
+                    { CDF3(11219, 24408, 29234) },
+                    { CDF3( 6865, 17656, 24149) },
+                    { CDF3( 3678, 10362, 16006) },
+                    { CDF3(25825, 32136, 32616) },
+                    { CDF3(17313, 29853, 32021) },
+                    { CDF3(11197, 24471, 29472) },
+                    { CDF3( 6947, 17781, 24405) },
+                    { CDF3( 3768, 10660, 16261) },
+                    { CDF3(27352, 32500, 32706) },
+                    { CDF3(20850, 31468, 32469) },
+                    { CDF3(14021, 27707, 31133) },
+                    { CDF3( 8964, 21748, 27838) },
+                    { CDF3( 5437, 14665, 21187) },
+                    { CDF3(26304, 32492, 32698) },
+                    { CDF3(20409, 31380, 32385) },
+                    { CDF3(13682, 27222, 30632) },
+                    { CDF3( 8974, 21236, 26685) },
+                    { CDF3( 4234, 11665, 16934) },
+                    { CDF3(26273, 32357, 32711) },
+                    { CDF3(20672, 31242, 32441) },
+                    { CDF3(14172, 27254, 30902) },
+                    { CDF3( 9870, 21898, 27275) },
+                    { CDF3( 5164, 13506, 19270) },
+                    { CDF3(26725, 32459, 32728) },
+                    { CDF3(20991, 31442, 32527) },
+                    { CDF3(13071, 26434, 30811) },
+                    { CDF3( 8184, 20090, 26742) },
+                    { CDF3( 4803, 13255, 19895) },
+                },
+            }, {
+                {
+                    { CDF3( 7555, 14942, 18501) },
+                    { CDF3(24410, 31178, 32287) },
+                    { CDF3(14394, 26738, 30253) },
+                    { CDF3( 8413, 19554, 25195) },
+                    { CDF3( 4766, 12924, 18785) },
+                    { CDF3( 2029,  5806,  9207) },
+                    { CDF3(26776, 32364, 32663) },
+                    { CDF3(18732, 29967, 31931) },
+                    { CDF3(11005, 23786, 28852) },
+                    { CDF3( 6466, 16909, 23510) },
+                    { CDF3( 3044,  8638, 13419) },
+                    { CDF3(29208, 32582, 32704) },
+                    { CDF3(20068, 30857, 32208) },
+                    { CDF3(12003, 25085, 29595) },
+                    { CDF3( 6947, 17750, 24189) },
+                    { CDF3( 3245,  9103, 14007) },
+                    { CDF3(27359, 32465, 32669) },
+                    { CDF3(19421, 30614, 32174) },
+                    { CDF3(11915, 25010, 29579) },
+                    { CDF3( 6950, 17676, 24074) },
+                    { CDF3( 3007,  8473, 13096) },
+                    { CDF3(29002, 32676, 32735) },
+                    { CDF3(22102, 31849, 32576) },
+                    { CDF3(14408, 28009, 31405) },
+                    { CDF3( 9027, 21679, 27931) },
+                    { CDF3( 4694, 12678, 18748) },
+                    { CDF3(28216, 32528, 32682) },
+                    { CDF3(20849, 31264, 32318) },
+                    { CDF3(12756, 25815, 29751) },
+                    { CDF3( 7565, 18801, 24923) },
+                    { CDF3( 3509,  9533, 14477) },
+                    { CDF3(30133, 32687, 32739) },
+                    { CDF3(23063, 31910, 32515) },
+                    { CDF3(14588, 28051, 31132) },
+                    { CDF3( 9085, 21649, 27457) },
+                    { CDF3( 4261, 11654, 17264) },
+                    { CDF3(29518, 32691, 32748) },
+                    { CDF3(22451, 31959, 32613) },
+                    { CDF3(14864, 28722, 31700) },
+                    { CDF3( 9695, 22964, 28716) },
+                    { CDF3( 4932, 13358, 19502) },
+                }, {
+                    { CDF3( 6465, 16958, 21688) },
+                    { CDF3(25199, 31514, 32360) },
+                    { CDF3(14774, 27149, 30607) },
+                    { CDF3( 9257, 21438, 26972) },
+                    { CDF3( 5723, 15183, 21882) },
+                    { CDF3( 3150,  8879, 13731) },
+                    { CDF3(26989, 32262, 32682) },
+                    { CDF3(17396, 29937, 32085) },
+                    { CDF3(11387, 24901, 29784) },
+                    { CDF3( 7289, 18821, 25548) },
+                    { CDF3( 3734, 10577, 16086) },
+                    { CDF3(29728, 32501, 32695) },
+                    { CDF3(17431, 29701, 31903) },
+                    { CDF3( 9921, 22826, 28300) },
+                    { CDF3( 5896, 15434, 22068) },
+                    { CDF3( 3430,  9646, 14757) },
+                    { CDF3(28614, 32511, 32705) },
+                    { CDF3(19364, 30638, 32263) },
+                    { CDF3(13129, 26254, 30402) },
+                    { CDF3( 8754, 20484, 26440) },
+                    { CDF3( 4378, 11607, 17110) },
+                    { CDF3(30292, 32671, 32744) },
+                    { CDF3(21780, 31603, 32501) },
+                    { CDF3(14314, 27829, 31291) },
+                    { CDF3( 9611, 22327, 28263) },
+                    { CDF3( 4890, 13087, 19065) },
+                    { CDF3(25862, 32567, 32733) },
+                    { CDF3(20794, 32050, 32567) },
+                    { CDF3(17243, 30625, 32254) },
+                    { CDF3(13283, 27628, 31474) },
+                    { CDF3( 9669, 22532, 28918) },
+                    { CDF3(27435, 32697, 32748) },
+                    { CDF3(24922, 32390, 32714) },
+                    { CDF3(21449, 31504, 32536) },
+                    { CDF3(16392, 29729, 31832) },
+                    { CDF3(11692, 24884, 29076) },
+                    { CDF3(24193, 32290, 32735) },
+                    { CDF3(18909, 31104, 32563) },
+                    { CDF3(12236, 26841, 31403) },
+                    { CDF3( 8171, 21840, 29082) },
+                    { CDF3( 7224, 17280, 25275) },
+                },
+            }, {
+                {
+                    { CDF3( 3078,  6839,  9890) },
+                    { CDF3(13837, 20450, 24479) },
+                    { CDF3( 5914, 14222, 19328) },
+                    { CDF3( 3866, 10267, 14762) },
+                    { CDF3( 2612,  7208, 11042) },
+                    { CDF3( 1067,  2991,  4776) },
+                    { CDF3(25817, 31646, 32529) },
+                    { CDF3(13708, 26338, 30385) },
+                    { CDF3( 7328, 18585, 24870) },
+                    { CDF3( 4691, 13080, 19276) },
+                    { CDF3( 1825,  5253,  8352) },
+                    { CDF3(29386, 32315, 32624) },
+                    { CDF3(17160, 29001, 31360) },
+                    { CDF3( 9602, 21862, 27396) },
+                    { CDF3( 5915, 15772, 22148) },
+                    { CDF3( 2786,  7779, 12047) },
+                    { CDF3(29246, 32450, 32663) },
+                    { CDF3(18696, 29929, 31818) },
+                    { CDF3(10510, 23369, 28560) },
+                    { CDF3( 6229, 16499, 23125) },
+                    { CDF3( 2608,  7448, 11705) },
+                    { CDF3(30753, 32710, 32748) },
+                    { CDF3(21638, 31487, 32503) },
+                    { CDF3(12937, 26854, 30870) },
+                    { CDF3( 8182, 20596, 26970) },
+                    { CDF3( 3637, 10269, 15497) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                }, {
+                    { CDF3( 5244, 12150, 16906) },
+                    { CDF3(20486, 26858, 29701) },
+                    { CDF3( 7756, 18317, 23735) },
+                    { CDF3( 3452,  9256, 13146) },
+                    { CDF3( 2020,  5206,  8229) },
+                    { CDF3( 1801,  4993,  7903) },
+                    { CDF3(27051, 31858, 32531) },
+                    { CDF3(15988, 27531, 30619) },
+                    { CDF3( 9188, 21484, 26719) },
+                    { CDF3( 6273, 17186, 23800) },
+                    { CDF3( 3108,  9355, 14764) },
+                    { CDF3(31076, 32520, 32680) },
+                    { CDF3(18119, 30037, 31850) },
+                    { CDF3(10244, 22969, 27472) },
+                    { CDF3( 4692, 14077, 19273) },
+                    { CDF3( 3694, 11677, 17556) },
+                    { CDF3(30060, 32581, 32720) },
+                    { CDF3(21011, 30775, 32120) },
+                    { CDF3(11931, 24820, 29289) },
+                    { CDF3( 7119, 17662, 24356) },
+                    { CDF3( 3833, 10706, 16304) },
+                    { CDF3(31954, 32731, 32748) },
+                    { CDF3(23913, 31724, 32489) },
+                    { CDF3(15520, 28060, 31286) },
+                    { CDF3(11517, 23008, 28571) },
+                    { CDF3( 6193, 14508, 20629) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                },
+            }, {
+                {
+                    { CDF3( 1035,  2807,  4156) },
+                    { CDF3(13162, 18138, 20939) },
+                    { CDF3( 2696,  6633,  8755) },
+                    { CDF3( 1373,  4161,  6853) },
+                    { CDF3( 1099,  2746,  4716) },
+                    { CDF3(  340,  1021,  1599) },
+                    { CDF3(22826, 30419, 32135) },
+                    { CDF3(10395, 21762, 26942) },
+                    { CDF3( 4726, 12407, 17361) },
+                    { CDF3( 2447,  7080, 10593) },
+                    { CDF3( 1227,  3717,  6011) },
+                    { CDF3(28156, 31424, 31934) },
+                    { CDF3(16915, 27754, 30373) },
+                    { CDF3( 9148, 20990, 26431) },
+                    { CDF3( 5950, 15515, 21148) },
+                    { CDF3( 2492,  7327, 11526) },
+                    { CDF3(30602, 32477, 32670) },
+                    { CDF3(20026, 29955, 31568) },
+                    { CDF3(11220, 23628, 28105) },
+                    { CDF3( 6652, 17019, 22973) },
+                    { CDF3( 3064,  8536, 13043) },
+                    { CDF3(31769, 32724, 32748) },
+                    { CDF3(22230, 30887, 32373) },
+                    { CDF3(12234, 25079, 29731) },
+                    { CDF3( 7326, 18816, 25353) },
+                    { CDF3( 3933, 10907, 16616) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                }, {
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                    { CDF3( 8192, 16384, 24576) },
+                },
+            },
         }, .dc_sign = {
-            {
-                { AOM_CDF2(128 * 125) },
-                { AOM_CDF2(128 * 102) },
-                { AOM_CDF2(128 * 147) },
-            },
-            {
-                { AOM_CDF2(128 * 119) },
-                { AOM_CDF2(128 * 101) },
-                { AOM_CDF2(128 * 135) },
-            }
+            { { CDF1(16000) }, { CDF1(13056) }, { CDF1(18816) } },
+            { { CDF1(15232) }, { CDF1(12928) }, { CDF1(17280) } },
         }, .br_tok = {
-            { { { AOM_CDF4(14995, 21341, 24749) },
-                { AOM_CDF4(13158, 20289, 24601) },
-                { AOM_CDF4(8941, 15326, 19876) },
-                { AOM_CDF4(6297, 11541, 15807) },
-                { AOM_CDF4(4817, 9029, 12776) },
-                { AOM_CDF4(3731, 7273, 10627) },
-                { AOM_CDF4(1847, 3617, 5354) },
-                { AOM_CDF4(14472, 19659, 22343) },
-                { AOM_CDF4(16806, 24162, 27533) },
-                { AOM_CDF4(12900, 20404, 24713) },
-                { AOM_CDF4(9411, 16112, 20797) },
-                { AOM_CDF4(7056, 12697, 17148) },
-                { AOM_CDF4(5544, 10339, 14460) },
-                { AOM_CDF4(2954, 5704, 8319) },
-                { AOM_CDF4(12464, 18071, 21354) },
-                { AOM_CDF4(15482, 22528, 26034) },
-                { AOM_CDF4(12070, 19269, 23624) },
-                { AOM_CDF4(8953, 15406, 20106) },
-                { AOM_CDF4(7027, 12730, 17220) },
-                { AOM_CDF4(5887, 10913, 15140) },
-                { AOM_CDF4(3793, 7278, 10447) } },
-              { { AOM_CDF4(15571, 22232, 25749) },
-                { AOM_CDF4(14506, 21575, 25374) },
-                { AOM_CDF4(10189, 17089, 21569) },
-                { AOM_CDF4(7316, 13301, 17915) },
-                { AOM_CDF4(5783, 10912, 15190) },
-                { AOM_CDF4(4760, 9155, 13088) },
-                { AOM_CDF4(2993, 5966, 8774) },
-                { AOM_CDF4(23424, 28903, 30778) },
-                { AOM_CDF4(20775, 27666, 30290) },
-                { AOM_CDF4(16474, 24410, 28299) },
-                { AOM_CDF4(12471, 20180, 24987) },
-                { AOM_CDF4(9410, 16487, 21439) },
-                { AOM_CDF4(7536, 13614, 18529) },
-                { AOM_CDF4(5048, 9586, 13549) },
-                { AOM_CDF4(21090, 27290, 29756) },
-                { AOM_CDF4(20796, 27402, 30026) },
-                { AOM_CDF4(17819, 25485, 28969) },
-                { AOM_CDF4(13860, 21909, 26462) },
-                { AOM_CDF4(11002, 18494, 23529) },
-                { AOM_CDF4(8953, 15929, 20897) },
-                { AOM_CDF4(6448, 11918, 16454) } } },
-            { { { AOM_CDF4(15999, 22208, 25449) },
-                { AOM_CDF4(13050, 19988, 24122) },
-                { AOM_CDF4(8594, 14864, 19378) },
-                { AOM_CDF4(6033, 11079, 15238) },
-                { AOM_CDF4(4554, 8683, 12347) },
-                { AOM_CDF4(3672, 7139, 10337) },
-                { AOM_CDF4(1900, 3771, 5576) },
-                { AOM_CDF4(15788, 21340, 23949) },
-                { AOM_CDF4(16825, 24235, 27758) },
-                { AOM_CDF4(12873, 20402, 24810) },
-                { AOM_CDF4(9590, 16363, 21094) },
-                { AOM_CDF4(7352, 13209, 17733) },
-                { AOM_CDF4(5960, 10989, 15184) },
-                { AOM_CDF4(3232, 6234, 9007) },
-                { AOM_CDF4(15761, 20716, 23224) },
-                { AOM_CDF4(19318, 25989, 28759) },
-                { AOM_CDF4(15529, 23094, 26929) },
-                { AOM_CDF4(11662, 18989, 23641) },
-                { AOM_CDF4(8955, 15568, 20366) },
-                { AOM_CDF4(7281, 13106, 17708) },
-                { AOM_CDF4(4248, 8059, 11440) } },
-              { { AOM_CDF4(14899, 21217, 24503) },
-                { AOM_CDF4(13519, 20283, 24047) },
-                { AOM_CDF4(9429, 15966, 20365) },
-                { AOM_CDF4(6700, 12355, 16652) },
-                { AOM_CDF4(5088, 9704, 13716) },
-                { AOM_CDF4(4243, 8154, 11731) },
-                { AOM_CDF4(2702, 5364, 7861) },
-                { AOM_CDF4(22745, 28388, 30454) },
-                { AOM_CDF4(20235, 27146, 29922) },
-                { AOM_CDF4(15896, 23715, 27637) },
-                { AOM_CDF4(11840, 19350, 24131) },
-                { AOM_CDF4(9122, 15932, 20880) },
-                { AOM_CDF4(7488, 13581, 18362) },
-                { AOM_CDF4(5114, 9568, 13370) },
-                { AOM_CDF4(20845, 26553, 28932) },
-                { AOM_CDF4(20981, 27372, 29884) },
-                { AOM_CDF4(17781, 25335, 28785) },
-                { AOM_CDF4(13760, 21708, 26297) },
-                { AOM_CDF4(10975, 18415, 23365) },
-                { AOM_CDF4(9045, 15789, 20686) },
-                { AOM_CDF4(6130, 11199, 15423) } } },
-            { { { AOM_CDF4(13549, 19724, 23158) },
-                { AOM_CDF4(11844, 18382, 22246) },
-                { AOM_CDF4(7919, 13619, 17773) },
-                { AOM_CDF4(5486, 10143, 13946) },
-                { AOM_CDF4(4166, 7983, 11324) },
-                { AOM_CDF4(3364, 6506, 9427) },
-                { AOM_CDF4(1598, 3160, 4674) },
-                { AOM_CDF4(15281, 20979, 23781) },
-                { AOM_CDF4(14939, 22119, 25952) },
-                { AOM_CDF4(11363, 18407, 22812) },
-                { AOM_CDF4(8609, 14857, 19370) },
-                { AOM_CDF4(6737, 12184, 16480) },
-                { AOM_CDF4(5506, 10263, 14262) },
-                { AOM_CDF4(2990, 5786, 8380) },
-                { AOM_CDF4(20249, 25253, 27417) },
-                { AOM_CDF4(21070, 27518, 30001) },
-                { AOM_CDF4(16854, 24469, 28074) },
-                { AOM_CDF4(12864, 20486, 25000) },
-                { AOM_CDF4(9962, 16978, 21778) },
-                { AOM_CDF4(8074, 14338, 19048) },
-                { AOM_CDF4(4494, 8479, 11906) } },
-              { { AOM_CDF4(13960, 19617, 22829) },
-                { AOM_CDF4(11150, 17341, 21228) },
-                { AOM_CDF4(7150, 12964, 17190) },
-                { AOM_CDF4(5331, 10002, 13867) },
-                { AOM_CDF4(4167, 7744, 11057) },
-                { AOM_CDF4(3480, 6629, 9646) },
-                { AOM_CDF4(1883, 3784, 5686) },
-                { AOM_CDF4(18752, 25660, 28912) },
-                { AOM_CDF4(16968, 24586, 28030) },
-                { AOM_CDF4(13520, 21055, 25313) },
-                { AOM_CDF4(10453, 17626, 22280) },
-                { AOM_CDF4(8386, 14505, 19116) },
-                { AOM_CDF4(6742, 12595, 17008) },
-                { AOM_CDF4(4273, 8140, 11499) },
-                { AOM_CDF4(22120, 27827, 30233) },
-                { AOM_CDF4(20563, 27358, 29895) },
-                { AOM_CDF4(17076, 24644, 28153) },
-                { AOM_CDF4(13362, 20942, 25309) },
-                { AOM_CDF4(10794, 17965, 22695) },
-                { AOM_CDF4(9014, 15652, 20319) },
-                { AOM_CDF4(5708, 10512, 14497) } } },
-            { { { AOM_CDF4(5705, 10930, 15725) },
-                { AOM_CDF4(7946, 12765, 16115) },
-                { AOM_CDF4(6801, 12123, 16226) },
-                { AOM_CDF4(5462, 10135, 14200) },
-                { AOM_CDF4(4189, 8011, 11507) },
-                { AOM_CDF4(3191, 6229, 9408) },
-                { AOM_CDF4(1057, 2137, 3212) },
-                { AOM_CDF4(10018, 17067, 21491) },
-                { AOM_CDF4(7380, 12582, 16453) },
-                { AOM_CDF4(6068, 10845, 14339) },
-                { AOM_CDF4(5098, 9198, 12555) },
-                { AOM_CDF4(4312, 8010, 11119) },
-                { AOM_CDF4(3700, 6966, 9781) },
-                { AOM_CDF4(1693, 3326, 4887) },
-                { AOM_CDF4(18757, 24930, 27774) },
-                { AOM_CDF4(17648, 24596, 27817) },
-                { AOM_CDF4(14707, 22052, 26026) },
-                { AOM_CDF4(11720, 18852, 23292) },
-                { AOM_CDF4(9357, 15952, 20525) },
-                { AOM_CDF4(7810, 13753, 18210) },
-                { AOM_CDF4(3879, 7333, 10328) } },
-              { { AOM_CDF4(8278, 13242, 15922) },
-                { AOM_CDF4(10547, 15867, 18919) },
-                { AOM_CDF4(9106, 15842, 20609) },
-                { AOM_CDF4(6833, 13007, 17218) },
-                { AOM_CDF4(4811, 9712, 13923) },
-                { AOM_CDF4(3985, 7352, 11128) },
-                { AOM_CDF4(1688, 3458, 5262) },
-                { AOM_CDF4(12951, 21861, 26510) },
-                { AOM_CDF4(9788, 16044, 20276) },
-                { AOM_CDF4(6309, 11244, 14870) },
-                { AOM_CDF4(5183, 9349, 12566) },
-                { AOM_CDF4(4389, 8229, 11492) },
-                { AOM_CDF4(3633, 6945, 10620) },
-                { AOM_CDF4(3600, 6847, 9907) },
-                { AOM_CDF4(21748, 28137, 30255) },
-                { AOM_CDF4(19436, 26581, 29560) },
-                { AOM_CDF4(16359, 24201, 27953) },
-                { AOM_CDF4(13961, 21693, 25871) },
-                { AOM_CDF4(11544, 18686, 23322) },
-                { AOM_CDF4(9372, 16462, 20952) },
-                { AOM_CDF4(6138, 11210, 15390) } } }
+            {
+                {
+                    { CDF3(14995, 21341, 24749) },
+                    { CDF3(13158, 20289, 24601) },
+                    { CDF3( 8941, 15326, 19876) },
+                    { CDF3( 6297, 11541, 15807) },
+                    { CDF3( 4817,  9029, 12776) },
+                    { CDF3( 3731,  7273, 10627) },
+                    { CDF3( 1847,  3617,  5354) },
+                    { CDF3(14472, 19659, 22343) },
+                    { CDF3(16806, 24162, 27533) },
+                    { CDF3(12900, 20404, 24713) },
+                    { CDF3( 9411, 16112, 20797) },
+                    { CDF3( 7056, 12697, 17148) },
+                    { CDF3( 5544, 10339, 14460) },
+                    { CDF3( 2954,  5704,  8319) },
+                    { CDF3(12464, 18071, 21354) },
+                    { CDF3(15482, 22528, 26034) },
+                    { CDF3(12070, 19269, 23624) },
+                    { CDF3( 8953, 15406, 20106) },
+                    { CDF3( 7027, 12730, 17220) },
+                    { CDF3( 5887, 10913, 15140) },
+                    { CDF3( 3793,  7278, 10447) },
+                }, {
+                    { CDF3(15571, 22232, 25749) },
+                    { CDF3(14506, 21575, 25374) },
+                    { CDF3(10189, 17089, 21569) },
+                    { CDF3( 7316, 13301, 17915) },
+                    { CDF3( 5783, 10912, 15190) },
+                    { CDF3( 4760,  9155, 13088) },
+                    { CDF3( 2993,  5966,  8774) },
+                    { CDF3(23424, 28903, 30778) },
+                    { CDF3(20775, 27666, 30290) },
+                    { CDF3(16474, 24410, 28299) },
+                    { CDF3(12471, 20180, 24987) },
+                    { CDF3( 9410, 16487, 21439) },
+                    { CDF3( 7536, 13614, 18529) },
+                    { CDF3( 5048,  9586, 13549) },
+                    { CDF3(21090, 27290, 29756) },
+                    { CDF3(20796, 27402, 30026) },
+                    { CDF3(17819, 25485, 28969) },
+                    { CDF3(13860, 21909, 26462) },
+                    { CDF3(11002, 18494, 23529) },
+                    { CDF3( 8953, 15929, 20897) },
+                    { CDF3( 6448, 11918, 16454) },
+                },
+            }, {
+                {
+                    { CDF3(15999, 22208, 25449) },
+                    { CDF3(13050, 19988, 24122) },
+                    { CDF3( 8594, 14864, 19378) },
+                    { CDF3( 6033, 11079, 15238) },
+                    { CDF3( 4554,  8683, 12347) },
+                    { CDF3( 3672,  7139, 10337) },
+                    { CDF3( 1900,  3771,  5576) },
+                    { CDF3(15788, 21340, 23949) },
+                    { CDF3(16825, 24235, 27758) },
+                    { CDF3(12873, 20402, 24810) },
+                    { CDF3( 9590, 16363, 21094) },
+                    { CDF3( 7352, 13209, 17733) },
+                    { CDF3( 5960, 10989, 15184) },
+                    { CDF3( 3232,  6234,  9007) },
+                    { CDF3(15761, 20716, 23224) },
+                    { CDF3(19318, 25989, 28759) },
+                    { CDF3(15529, 23094, 26929) },
+                    { CDF3(11662, 18989, 23641) },
+                    { CDF3( 8955, 15568, 20366) },
+                    { CDF3( 7281, 13106, 17708) },
+                    { CDF3( 4248,  8059, 11440) },
+                }, {
+                    { CDF3(14899, 21217, 24503) },
+                    { CDF3(13519, 20283, 24047) },
+                    { CDF3( 9429, 15966, 20365) },
+                    { CDF3( 6700, 12355, 16652) },
+                    { CDF3( 5088,  9704, 13716) },
+                    { CDF3( 4243,  8154, 11731) },
+                    { CDF3( 2702,  5364,  7861) },
+                    { CDF3(22745, 28388, 30454) },
+                    { CDF3(20235, 27146, 29922) },
+                    { CDF3(15896, 23715, 27637) },
+                    { CDF3(11840, 19350, 24131) },
+                    { CDF3( 9122, 15932, 20880) },
+                    { CDF3( 7488, 13581, 18362) },
+                    { CDF3( 5114,  9568, 13370) },
+                    { CDF3(20845, 26553, 28932) },
+                    { CDF3(20981, 27372, 29884) },
+                    { CDF3(17781, 25335, 28785) },
+                    { CDF3(13760, 21708, 26297) },
+                    { CDF3(10975, 18415, 23365) },
+                    { CDF3( 9045, 15789, 20686) },
+                    { CDF3( 6130, 11199, 15423) },
+                },
+            }, {
+                {
+                    { CDF3(13549, 19724, 23158) },
+                    { CDF3(11844, 18382, 22246) },
+                    { CDF3( 7919, 13619, 17773) },
+                    { CDF3( 5486, 10143, 13946) },
+                    { CDF3( 4166,  7983, 11324) },
+                    { CDF3( 3364,  6506,  9427) },
+                    { CDF3( 1598,  3160,  4674) },
+                    { CDF3(15281, 20979, 23781) },
+                    { CDF3(14939, 22119, 25952) },
+                    { CDF3(11363, 18407, 22812) },
+                    { CDF3( 8609, 14857, 19370) },
+                    { CDF3( 6737, 12184, 16480) },
+                    { CDF3( 5506, 10263, 14262) },
+                    { CDF3( 2990,  5786,  8380) },
+                    { CDF3(20249, 25253, 27417) },
+                    { CDF3(21070, 27518, 30001) },
+                    { CDF3(16854, 24469, 28074) },
+                    { CDF3(12864, 20486, 25000) },
+                    { CDF3( 9962, 16978, 21778) },
+                    { CDF3( 8074, 14338, 19048) },
+                    { CDF3( 4494,  8479, 11906) },
+                }, {
+                    { CDF3(13960, 19617, 22829) },
+                    { CDF3(11150, 17341, 21228) },
+                    { CDF3( 7150, 12964, 17190) },
+                    { CDF3( 5331, 10002, 13867) },
+                    { CDF3( 4167,  7744, 11057) },
+                    { CDF3( 3480,  6629,  9646) },
+                    { CDF3( 1883,  3784,  5686) },
+                    { CDF3(18752, 25660, 28912) },
+                    { CDF3(16968, 24586, 28030) },
+                    { CDF3(13520, 21055, 25313) },
+                    { CDF3(10453, 17626, 22280) },
+                    { CDF3( 8386, 14505, 19116) },
+                    { CDF3( 6742, 12595, 17008) },
+                    { CDF3( 4273,  8140, 11499) },
+                    { CDF3(22120, 27827, 30233) },
+                    { CDF3(20563, 27358, 29895) },
+                    { CDF3(17076, 24644, 28153) },
+                    { CDF3(13362, 20942, 25309) },
+                    { CDF3(10794, 17965, 22695) },
+                    { CDF3( 9014, 15652, 20319) },
+                    { CDF3( 5708, 10512, 14497) },
+                },
+            }, {
+                {
+                    { CDF3( 5705, 10930, 15725) },
+                    { CDF3( 7946, 12765, 16115) },
+                    { CDF3( 6801, 12123, 16226) },
+                    { CDF3( 5462, 10135, 14200) },
+                    { CDF3( 4189,  8011, 11507) },
+                    { CDF3( 3191,  6229,  9408) },
+                    { CDF3( 1057,  2137,  3212) },
+                    { CDF3(10018, 17067, 21491) },
+                    { CDF3( 7380, 12582, 16453) },
+                    { CDF3( 6068, 10845, 14339) },
+                    { CDF3( 5098,  9198, 12555) },
+                    { CDF3( 4312,  8010, 11119) },
+                    { CDF3( 3700,  6966,  9781) },
+                    { CDF3( 1693,  3326,  4887) },
+                    { CDF3(18757, 24930, 27774) },
+                    { CDF3(17648, 24596, 27817) },
+                    { CDF3(14707, 22052, 26026) },
+                    { CDF3(11720, 18852, 23292) },
+                    { CDF3( 9357, 15952, 20525) },
+                    { CDF3( 7810, 13753, 18210) },
+                    { CDF3( 3879,  7333, 10328) },
+                }, {
+                    { CDF3( 8278, 13242, 15922) },
+                    { CDF3(10547, 15867, 18919) },
+                    { CDF3( 9106, 15842, 20609) },
+                    { CDF3( 6833, 13007, 17218) },
+                    { CDF3( 4811,  9712, 13923) },
+                    { CDF3( 3985,  7352, 11128) },
+                    { CDF3( 1688,  3458,  5262) },
+                    { CDF3(12951, 21861, 26510) },
+                    { CDF3( 9788, 16044, 20276) },
+                    { CDF3( 6309, 11244, 14870) },
+                    { CDF3( 5183,  9349, 12566) },
+                    { CDF3( 4389,  8229, 11492) },
+                    { CDF3( 3633,  6945, 10620) },
+                    { CDF3( 3600,  6847,  9907) },
+                    { CDF3(21748, 28137, 30255) },
+                    { CDF3(19436, 26581, 29560) },
+                    { CDF3(16359, 24201, 27953) },
+                    { CDF3(13961, 21693, 25871) },
+                    { CDF3(11544, 18686, 23322) },
+                    { CDF3( 9372, 16462, 20952) },
+                    { CDF3( 6138, 11210, 15390) },
+                },
+            },
         },
     }, [2] = {
         .skip = {
-            { { AOM_CDF2(29614) },
-                { AOM_CDF2(9068) },
-                { AOM_CDF2(12924) },
-                { AOM_CDF2(19538) },
-                { AOM_CDF2(17737) },
-                { AOM_CDF2(24619) },
-                { AOM_CDF2(30642) },
-                { AOM_CDF2(4119) },
-                { AOM_CDF2(16026) },
-                { AOM_CDF2(25657) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) } },
-            { { AOM_CDF2(31957) },
-                { AOM_CDF2(3230) },
-                { AOM_CDF2(11153) },
-                { AOM_CDF2(18123) },
-                { AOM_CDF2(20143) },
-                { AOM_CDF2(26536) },
-                { AOM_CDF2(31986) },
-                { AOM_CDF2(3050) },
-                { AOM_CDF2(14603) },
-                { AOM_CDF2(25155) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) } },
-            { { AOM_CDF2(32363) },
-                { AOM_CDF2(10692) },
-                { AOM_CDF2(19090) },
-                { AOM_CDF2(24357) },
-                { AOM_CDF2(24442) },
-                { AOM_CDF2(28312) },
-                { AOM_CDF2(32169) },
-                { AOM_CDF2(3648) },
-                { AOM_CDF2(15690) },
-                { AOM_CDF2(26815) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) } },
-            { { AOM_CDF2(30669) },
-                { AOM_CDF2(3832) },
-                { AOM_CDF2(11663) },
-                { AOM_CDF2(18889) },
-                { AOM_CDF2(19782) },
-                { AOM_CDF2(23313) },
-                { AOM_CDF2(31330) },
-                { AOM_CDF2(5124) },
-                { AOM_CDF2(18719) },
-                { AOM_CDF2(28468) },
-                { AOM_CDF2(3082) },
-                { AOM_CDF2(20982) },
-                { AOM_CDF2(29443) } },
-            { { AOM_CDF2(28573) },
-                { AOM_CDF2(3183) },
-                { AOM_CDF2(17802) },
-                { AOM_CDF2(25977) },
-                { AOM_CDF2(26677) },
-                { AOM_CDF2(27832) },
-                { AOM_CDF2(32387) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) } }
+            {
+                { CDF1(29614) }, { CDF1( 9068) }, { CDF1(12924) },
+                { CDF1(19538) }, { CDF1(17737) }, { CDF1(24619) },
+                { CDF1(30642) }, { CDF1( 4119) }, { CDF1(16026) },
+                { CDF1(25657) }, { CDF1(16384) }, { CDF1(16384) },
+                { CDF1(16384) },
+            }, {
+                { CDF1(31957) }, { CDF1( 3230) }, { CDF1(11153) },
+                { CDF1(18123) }, { CDF1(20143) }, { CDF1(26536) },
+                { CDF1(31986) }, { CDF1( 3050) }, { CDF1(14603) },
+                { CDF1(25155) }, { CDF1(16384) }, { CDF1(16384) },
+                { CDF1(16384) },
+            }, {
+                { CDF1(32363) }, { CDF1(10692) }, { CDF1(19090) },
+                { CDF1(24357) }, { CDF1(24442) }, { CDF1(28312) },
+                { CDF1(32169) }, { CDF1( 3648) }, { CDF1(15690) },
+                { CDF1(26815) }, { CDF1(16384) }, { CDF1(16384) },
+                { CDF1(16384) },
+            }, {
+                { CDF1(30669) }, { CDF1( 3832) }, { CDF1(11663) },
+                { CDF1(18889) }, { CDF1(19782) }, { CDF1(23313) },
+                { CDF1(31330) }, { CDF1( 5124) }, { CDF1(18719) },
+                { CDF1(28468) }, { CDF1( 3082) }, { CDF1(20982) },
+                { CDF1(29443) },
+            }, {
+                { CDF1(28573) }, { CDF1( 3183) }, { CDF1(17802) },
+                { CDF1(25977) }, { CDF1(26677) }, { CDF1(27832) },
+                { CDF1(32387) }, { CDF1(16384) }, { CDF1(16384) },
+                { CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
+                { CDF1(16384) },
+            },
         }, .eob_bin_16 = {
-            { { AOM_CDF5(4016, 4897, 8881, 14968) },
-              { AOM_CDF5(716, 1105, 2646, 10056) } },
-            { { AOM_CDF5(11139, 13270, 18241, 23566) },
-              { AOM_CDF5(3192, 5032, 10297, 19755) } }
+            {
+                { CDF4( 4016,  4897,  8881, 14968) },
+                { CDF4(  716,  1105,  2646, 10056) },
+            }, {
+                { CDF4(11139, 13270, 18241, 23566) },
+                { CDF4( 3192,  5032, 10297, 19755) },
+            },
         }, .eob_bin_32 = {
-            { { AOM_CDF6(2515, 3003, 4452, 8162, 16041) },
-              { AOM_CDF6(574, 821, 1836, 5089, 13128) } },
-            { { AOM_CDF6(13468, 16303, 20361, 25105, 29281) },
-              { AOM_CDF6(3542, 5502, 10415, 16760, 25644) } }
+            {
+                { CDF5( 2515,  3003,  4452,  8162, 16041) },
+                { CDF5(  574,   821,  1836,  5089, 13128) },
+            }, {
+                { CDF5(13468, 16303, 20361, 25105, 29281) },
+                { CDF5( 3542,  5502, 10415, 16760, 25644) },
+            },
         }, .eob_bin_64 = {
-            { { AOM_CDF7(2374, 2772, 4583, 7276, 12288, 19706) },
-              { AOM_CDF7(497, 810, 1315, 3000, 7004, 15641) } },
-            { { AOM_CDF7(15050, 17126, 21410, 24886, 28156, 30726) },
-              { AOM_CDF7(4034, 6290, 10235, 14982, 21214, 28491) } }
+            {
+                { CDF6( 2374,  2772,  4583,  7276, 12288, 19706) },
+                { CDF6(  497,   810,  1315,  3000,  7004, 15641) },
+            }, {
+                { CDF6(15050, 17126, 21410, 24886, 28156, 30726) },
+                { CDF6( 4034,  6290, 10235, 14982, 21214, 28491) },
+            },
         }, .eob_bin_128 = {
-            { { AOM_CDF8(1366, 1738, 2527, 5016, 9355, 15797, 24643) },
-              { AOM_CDF8(354, 558, 944, 2760, 7287, 14037, 21779) } },
-            { { AOM_CDF8(13627, 16246, 20173, 24429, 27948, 30415, 31863) },
-              { AOM_CDF8(6275, 9889, 14769, 23164, 27988, 30493, 32272) } }
+            {
+                { CDF7( 1366,  1738,  2527,  5016,  9355, 15797, 24643) },
+                { CDF7(  354,   558,   944,  2760,  7287, 14037, 21779) },
+            }, {
+                { CDF7(13627, 16246, 20173, 24429, 27948, 30415, 31863) },
+                { CDF7( 6275,  9889, 14769, 23164, 27988, 30493, 32272) },
+            },
         }, .eob_bin_256 = {
-            { { AOM_CDF9(3089, 3920, 6038, 9460, 14266, 19881, 25766, 29176) },
-              { AOM_CDF9(1084, 2358, 3488, 5122, 11483, 18103, 26023, 29799) } },
-            { { AOM_CDF9(11514, 13794, 17480, 20754, 24361, 27378, 29492, 31277) },
-              { AOM_CDF9(6571, 9610, 15516, 21826, 29092, 30829, 31842, 32708) } }
+            {
+                { CDF8( 3089,  3920,  6038,  9460,
+                       14266, 19881, 25766, 29176) },
+                { CDF8( 1084,  2358,  3488,  5122,
+                       11483, 18103, 26023, 29799) },
+            }, {
+                { CDF8(11514, 13794, 17480, 20754,
+                       24361, 27378, 29492, 31277) },
+                { CDF8( 6571,  9610, 15516, 21826,
+                       29092, 30829, 31842, 32708) },
+            },
         }, .eob_bin_512 = {
-            { { AOM_CDF10(2624, 3936, 6480, 9686, 13979, 17726, 23267,
-                          28410, 31078) },
-              { AOM_CDF10(3277, 6554, 9830, 13107, 16384, 19661, 22938,
-                          26214, 29491) } },
-            { { AOM_CDF10(12015, 14769, 19588, 22052, 24222, 25812,
-                          27300, 29219, 32114) },
-              { AOM_CDF10(3277, 6554, 9830, 13107, 16384, 19661, 22938,
-                          26214, 29491) } }
+            { CDF9( 2624,  3936,  6480,  9686, 13979,
+                   17726, 23267, 28410, 31078) },
+            { CDF9(12015, 14769, 19588, 22052, 24222,
+                   25812, 27300, 29219, 32114) },
         }, .eob_bin_1024 = {
-            { { AOM_CDF11(2784, 3831, 7041, 10521, 14847, 18844, 23155,
-                          26682, 29229, 31045) },
-              { AOM_CDF11(2979, 5958, 8937, 11916, 14895, 17873, 20852,
-                          23831, 26810, 29789) } },
-            { { AOM_CDF11(9577, 12466, 17739, 20750, 22061, 23215, 24601,
-                          25483, 25843, 32056) },
-              { AOM_CDF11(2979, 5958, 8937, 11916, 14895, 17873, 20852,
-                          23831, 26810, 29789) } }
+            { CDF10( 2784,  3831,  7041, 10521, 14847,
+                    18844, 23155, 26682, 29229, 31045) },
+            { CDF10( 9577, 12466, 17739, 20750, 22061,
+                    23215, 24601, 25483, 25843, 32056) },
         }, .eob_hi_bit = {
-            { { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(18983) }, { AOM_CDF2(20512) }, { AOM_CDF2(14885) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) } },
-              { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(20090) }, { AOM_CDF2(19444) }, { AOM_CDF2(17286) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) } } },
-            { { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(19139) }, { AOM_CDF2(21487) }, { AOM_CDF2(18959) },
-                { AOM_CDF2(20910) }, { AOM_CDF2(19089) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) } },
-              { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(20536) }, { AOM_CDF2(20664) }, { AOM_CDF2(20625) },
-                { AOM_CDF2(19123) }, { AOM_CDF2(14862) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) } } },
-            { { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(19833) }, { AOM_CDF2(21502) }, { AOM_CDF2(17485) },
-                { AOM_CDF2(20267) }, { AOM_CDF2(18353) }, { AOM_CDF2(23329) },
-                { AOM_CDF2(21478) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) } },
-              { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(22041) }, { AOM_CDF2(23434) }, { AOM_CDF2(20001) },
-                { AOM_CDF2(20554) }, { AOM_CDF2(20951) }, { AOM_CDF2(20145) },
-                { AOM_CDF2(15562) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) } } },
-            { { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(23312) }, { AOM_CDF2(21607) }, { AOM_CDF2(16526) },
-                { AOM_CDF2(18957) }, { AOM_CDF2(18034) }, { AOM_CDF2(18934) },
-                { AOM_CDF2(24247) }, { AOM_CDF2(16921) }, { AOM_CDF2(17080) } },
-              { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(26579) }, { AOM_CDF2(24910) }, { AOM_CDF2(18637) },
-                { AOM_CDF2(19800) }, { AOM_CDF2(20388) }, { AOM_CDF2(9887) },
-                { AOM_CDF2(15642) }, { AOM_CDF2(30198) }, { AOM_CDF2(24721) } } },
-            { { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(26998) }, { AOM_CDF2(16737) }, { AOM_CDF2(17838) },
-                { AOM_CDF2(18922) }, { AOM_CDF2(19515) }, { AOM_CDF2(18636) },
-                { AOM_CDF2(17333) }, { AOM_CDF2(15776) }, { AOM_CDF2(22658) } },
-              { { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) },
-                { AOM_CDF2(16384) }, { AOM_CDF2(16384) }, { AOM_CDF2(16384) } } }
+            {
+                {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(18983) },
+                    { CDF1(20512) }, { CDF1(14885) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) },
+                }, {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(20090) },
+                    { CDF1(19444) }, { CDF1(17286) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) },
+                },
+            }, {
+                {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(19139) },
+                    { CDF1(21487) }, { CDF1(18959) }, { CDF1(20910) },
+                    { CDF1(19089) }, { CDF1(16384) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) },
+                }, {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(20536) },
+                    { CDF1(20664) }, { CDF1(20625) }, { CDF1(19123) },
+                    { CDF1(14862) }, { CDF1(16384) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) },
+                },
+            }, {
+                {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(19833) },
+                    { CDF1(21502) }, { CDF1(17485) }, { CDF1(20267) },
+                    { CDF1(18353) }, { CDF1(23329) }, { CDF1(21478) },
+                    { CDF1(16384) }, { CDF1(16384) },
+                }, {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(22041) },
+                    { CDF1(23434) }, { CDF1(20001) }, { CDF1(20554) },
+                    { CDF1(20951) }, { CDF1(20145) }, { CDF1(15562) },
+                    { CDF1(16384) }, { CDF1(16384) },
+                },
+            }, {
+                {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(23312) },
+                    { CDF1(21607) }, { CDF1(16526) }, { CDF1(18957) },
+                    { CDF1(18034) }, { CDF1(18934) }, { CDF1(24247) },
+                    { CDF1(16921) }, { CDF1(17080) },
+                }, {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(26579) },
+                    { CDF1(24910) }, { CDF1(18637) }, { CDF1(19800) },
+                    { CDF1(20388) }, { CDF1( 9887) }, { CDF1(15642) },
+                    { CDF1(30198) }, { CDF1(24721) },
+                },
+            }, {
+                {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(26998) },
+                    { CDF1(16737) }, { CDF1(17838) }, { CDF1(18922) },
+                    { CDF1(19515) }, { CDF1(18636) }, { CDF1(17333) },
+                    { CDF1(15776) }, { CDF1(22658) },
+                }, {
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) }, { CDF1(16384) },
+                    { CDF1(16384) }, { CDF1(16384) },
+                },
+            },
         }, .eob_base_tok = {
-            { { { AOM_CDF3(20092, 30774) },
-                { AOM_CDF3(30695, 32020) },
-                { AOM_CDF3(31131, 32103) },
-                { AOM_CDF3(28666, 30870) } },
-              { { AOM_CDF3(27258, 31095) },
-                { AOM_CDF3(31804, 32623) },
-                { AOM_CDF3(31763, 32528) },
-                { AOM_CDF3(31438, 32506) } } },
-            { { { AOM_CDF3(18049, 30489) },
-                { AOM_CDF3(31706, 32286) },
-                { AOM_CDF3(32163, 32473) },
-                { AOM_CDF3(31550, 32184) } },
-              { { AOM_CDF3(27116, 30842) },
-                { AOM_CDF3(31971, 32598) },
-                { AOM_CDF3(32088, 32576) },
-                { AOM_CDF3(32067, 32664) } } },
-            { { { AOM_CDF3(12854, 29093) },
-                { AOM_CDF3(32272, 32558) },
-                { AOM_CDF3(32667, 32729) },
-                { AOM_CDF3(32306, 32585) } },
-              { { AOM_CDF3(25476, 30366) },
-                { AOM_CDF3(32169, 32687) },
-                { AOM_CDF3(32479, 32689) },
-                { AOM_CDF3(31673, 32634) } } },
-            { { { AOM_CDF3(2809, 19301) },
-                { AOM_CDF3(32205, 32622) },
-                { AOM_CDF3(32338, 32730) },
-                { AOM_CDF3(31786, 32616) } },
-              { { AOM_CDF3(22737, 29105) },
-                { AOM_CDF3(30810, 32362) },
-                { AOM_CDF