Merge remote-tracking branch 'origin/master' into custom

This commit is contained in:
roytam1 2021-03-04 09:39:48 +08:00
commit 8c22c8bd35
490 changed files with 55562 additions and 55331 deletions

View file

@ -1,6 +1,5 @@
This directory contains build files for the aom video
codec reference implementation. The actual library
source is in $TOPSRCDIR/third_party/aom/
codec reference implementation.
Any patches or additional configuration to be applied to the
upstream source should be kept here in the media/libaom
@ -10,4 +9,4 @@ The upstream aom git repository is:
https://aomedia.googlesource.com/aom
The git commit ID used was 1f0a4746aa8bfcce3fe7fbd2092aef8fe247aef4.
The version used was tagged 2.0.2.

View file

@ -1,7 +1,7 @@
#define VERSION_MAJOR 0
#define VERSION_MINOR 1
#define VERSION_PATCH 0
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_PATCH 2
#define VERSION_EXTRA ""
#define VERSION_PACKED ((VERSION_MAJOR<<16)|(VERSION_MINOR<<8)|(VERSION_PATCH))
#define VERSION_STRING_NOSP "v0.1.0"
#define VERSION_STRING " v0.1.0"
#define VERSION_STRING_NOSP "v2.0.2"
#define VERSION_STRING " v2.0.2"

View file

@ -1,7 +1,7 @@
#define VERSION_MAJOR 0
#define VERSION_MINOR 1
#define VERSION_PATCH 0
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_PATCH 2
#define VERSION_EXTRA ""
#define VERSION_PACKED ((VERSION_MAJOR<<16)|(VERSION_MINOR<<8)|(VERSION_PATCH))
#define VERSION_STRING_NOSP "v0.1.0"
#define VERSION_STRING " v0.1.0"
#define VERSION_STRING_NOSP "v2.0.2"
#define VERSION_STRING " v2.0.2"

View file

@ -1,5 +1,5 @@
;
; Copyright (c) 2019, Alliance for Open Media. All rights reserved
; Copyright (c) 2021, Alliance for Open Media. All rights reserved
;
; This source code is subject to the terms of the BSD 2 Clause License and
; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
@ -54,8 +54,8 @@ CONFIG_SHARP_SETTINGS equ 0
CONFIG_SIZE_LIMIT equ 0
CONFIG_SPATIAL_RESAMPLING equ 1
CONFIG_SPEED_STATS equ 0
CONFIG_STATIC equ 1
CONFIG_SUPERRES_IN_RECODE equ 1
CONFIG_TUNE_VMAF equ 0
CONFIG_WEBM_IO equ 0
DECODE_HEIGHT_LIMIT equ 0
DECODE_WIDTH_LIMIT equ 0

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Alliance for Open Media. All rights reserved
* Copyright (c) 2021, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
@ -56,8 +56,8 @@
#define CONFIG_SIZE_LIMIT 0
#define CONFIG_SPATIAL_RESAMPLING 1
#define CONFIG_SPEED_STATS 0
#define CONFIG_STATIC 1
#define CONFIG_SUPERRES_IN_RECODE 1
#define CONFIG_TUNE_VMAF 0
#define CONFIG_WEBM_IO 0
#define DECODE_HEIGHT_LIMIT 0
#define DECODE_WIDTH_LIMIT 0

View file

@ -1,5 +1,5 @@
;
; Copyright (c) 2019, Alliance for Open Media. All rights reserved
; Copyright (c) 2021, Alliance for Open Media. All rights reserved
;
; This source code is subject to the terms of the BSD 2 Clause License and
; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
@ -54,8 +54,8 @@
.equ CONFIG_SIZE_LIMIT, 0
.equ CONFIG_SPATIAL_RESAMPLING, 1
.equ CONFIG_SPEED_STATS, 0
.equ CONFIG_STATIC, 1
.equ CONFIG_SUPERRES_IN_RECODE, 1
.equ CONFIG_TUNE_VMAF, 0
.equ CONFIG_WEBM_IO, 0
.equ DECODE_HEIGHT_LIMIT, 0
.equ DECODE_WIDTH_LIMIT, 0

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Alliance for Open Media. All rights reserved
* Copyright (c) 2021, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
@ -56,8 +56,8 @@
#define CONFIG_SIZE_LIMIT 0
#define CONFIG_SPATIAL_RESAMPLING 1
#define CONFIG_SPEED_STATS 0
#define CONFIG_STATIC 1
#define CONFIG_SUPERRES_IN_RECODE 1
#define CONFIG_TUNE_VMAF 0
#define CONFIG_WEBM_IO 0
#define DECODE_HEIGHT_LIMIT 0
#define DECODE_WIDTH_LIMIT 0

View file

@ -77,7 +77,8 @@ extern "C" {
#endif
void av1_apply_selfguided_restoration_c(const uint8_t *dat, int width, int height, int stride, int eps, const int *xqd, uint8_t *dst, int dst_stride, int32_t *tmpbuf, int bit_depth, int highbd);
#define av1_apply_selfguided_restoration av1_apply_selfguided_restoration_c
void av1_apply_selfguided_restoration_neon(const uint8_t *dat, int width, int height, int stride, int eps, const int *xqd, uint8_t *dst, int dst_stride, int32_t *tmpbuf, int bit_depth, int highbd);
RTCD_EXTERN void (*av1_apply_selfguided_restoration)(const uint8_t *dat, int width, int height, int stride, int eps, const int *xqd, uint8_t *dst, int dst_stride, int32_t *tmpbuf, int bit_depth, int highbd);
void av1_build_compound_diffwtd_mask_c(uint8_t *mask, DIFFWTD_MASK_TYPE mask_type, const uint8_t *src0, int src0_stride, const uint8_t *src1, int src1_stride, int h, int w);
#define av1_build_compound_diffwtd_mask av1_build_compound_diffwtd_mask_c
@ -321,7 +322,12 @@ RTCD_EXTERN void (*av1_round_shift_array)(int32_t *arr, int size, int bit);
int av1_selfguided_restoration_c(const uint8_t *dgd8, int width, int height,
int dgd_stride, int32_t *flt0, int32_t *flt1, int flt_stride,
int sgr_params_idx, int bit_depth, int highbd);
#define av1_selfguided_restoration av1_selfguided_restoration_c
int av1_selfguided_restoration_neon(const uint8_t *dgd8, int width, int height,
int dgd_stride, int32_t *flt0, int32_t *flt1, int flt_stride,
int sgr_params_idx, int bit_depth, int highbd);
RTCD_EXTERN int (*av1_selfguided_restoration)(const uint8_t *dgd8, int width, int height,
int dgd_stride, int32_t *flt0, int32_t *flt1, int flt_stride,
int sgr_params_idx, int bit_depth, int highbd);
void av1_upsample_intra_edge_c(uint8_t *p, int sz);
#define av1_upsample_intra_edge av1_upsample_intra_edge_c
@ -401,6 +407,8 @@ static void setup_rtcd_internal(void)
(void)flags;
av1_apply_selfguided_restoration = av1_apply_selfguided_restoration_c;
if (flags & HAS_NEON) av1_apply_selfguided_restoration = av1_apply_selfguided_restoration_neon;
av1_build_compound_diffwtd_mask_d16 = av1_build_compound_diffwtd_mask_d16_c;
if (flags & HAS_NEON) av1_build_compound_diffwtd_mask_d16 = av1_build_compound_diffwtd_mask_d16_neon;
av1_convolve_2d_copy_sr = av1_convolve_2d_copy_sr_c;
@ -423,6 +431,8 @@ static void setup_rtcd_internal(void)
if (flags & HAS_NEON) av1_inv_txfm_add = av1_inv_txfm_add_neon;
av1_round_shift_array = av1_round_shift_array_c;
if (flags & HAS_NEON) av1_round_shift_array = av1_round_shift_array_neon;
av1_selfguided_restoration = av1_selfguided_restoration_c;
if (flags & HAS_NEON) av1_selfguided_restoration = av1_selfguided_restoration_neon;
av1_warp_affine = av1_warp_affine_c;
if (flags & HAS_NEON) av1_warp_affine = av1_warp_affine_neon;
av1_wiener_convolve_add_src = av1_wiener_convolve_add_src_c;

View file

@ -1,5 +1,5 @@
;
; Copyright (c) 2019, Alliance for Open Media. All rights reserved
; Copyright (c) 2021, Alliance for Open Media. All rights reserved
;
; This source code is subject to the terms of the BSD 2 Clause License and
; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
@ -54,8 +54,8 @@ CONFIG_SHARP_SETTINGS equ 0
CONFIG_SIZE_LIMIT equ 0
CONFIG_SPATIAL_RESAMPLING equ 1
CONFIG_SPEED_STATS equ 0
CONFIG_STATIC equ 1
CONFIG_SUPERRES_IN_RECODE equ 1
CONFIG_TUNE_VMAF equ 0
CONFIG_WEBM_IO equ 0
DECODE_HEIGHT_LIMIT equ 0
DECODE_WIDTH_LIMIT equ 0

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Alliance for Open Media. All rights reserved
* Copyright (c) 2021, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
@ -56,8 +56,8 @@
#define CONFIG_SIZE_LIMIT 0
#define CONFIG_SPATIAL_RESAMPLING 1
#define CONFIG_SPEED_STATS 0
#define CONFIG_STATIC 1
#define CONFIG_SUPERRES_IN_RECODE 1
#define CONFIG_TUNE_VMAF 0
#define CONFIG_WEBM_IO 0
#define DECODE_HEIGHT_LIMIT 0
#define DECODE_WIDTH_LIMIT 0

View file

@ -1,5 +1,5 @@
;
; Copyright (c) 2019, Alliance for Open Media. All rights reserved
; Copyright (c) 2021, Alliance for Open Media. All rights reserved
;
; This source code is subject to the terms of the BSD 2 Clause License and
; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
@ -54,8 +54,8 @@ CONFIG_SHARP_SETTINGS equ 0
CONFIG_SIZE_LIMIT equ 0
CONFIG_SPATIAL_RESAMPLING equ 1
CONFIG_SPEED_STATS equ 0
CONFIG_STATIC equ 1
CONFIG_SUPERRES_IN_RECODE equ 1
CONFIG_TUNE_VMAF equ 0
CONFIG_WEBM_IO equ 0
DECODE_HEIGHT_LIMIT equ 0
DECODE_WIDTH_LIMIT equ 0

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Alliance for Open Media. All rights reserved
* Copyright (c) 2021, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
@ -56,8 +56,8 @@
#define CONFIG_SIZE_LIMIT 0
#define CONFIG_SPATIAL_RESAMPLING 1
#define CONFIG_SPEED_STATS 0
#define CONFIG_STATIC 1
#define CONFIG_SUPERRES_IN_RECODE 1
#define CONFIG_TUNE_VMAF 0
#define CONFIG_WEBM_IO 0
#define DECODE_HEIGHT_LIMIT 0
#define DECODE_WIDTH_LIMIT 0

View file

@ -1,5 +1,5 @@
;
; Copyright (c) 2019, Alliance for Open Media. All rights reserved
; Copyright (c) 2021, Alliance for Open Media. All rights reserved
;
; This source code is subject to the terms of the BSD 2 Clause License and
; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
@ -54,8 +54,8 @@ CONFIG_SHARP_SETTINGS equ 0
CONFIG_SIZE_LIMIT equ 0
CONFIG_SPATIAL_RESAMPLING equ 1
CONFIG_SPEED_STATS equ 0
CONFIG_STATIC equ 1
CONFIG_SUPERRES_IN_RECODE equ 1
CONFIG_TUNE_VMAF equ 0
CONFIG_WEBM_IO equ 0
DECODE_HEIGHT_LIMIT equ 0
DECODE_WIDTH_LIMIT equ 0

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Alliance for Open Media. All rights reserved
* Copyright (c) 2021, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
@ -56,8 +56,8 @@
#define CONFIG_SIZE_LIMIT 0
#define CONFIG_SPATIAL_RESAMPLING 1
#define CONFIG_SPEED_STATS 0
#define CONFIG_STATIC 1
#define CONFIG_SUPERRES_IN_RECODE 1
#define CONFIG_TUNE_VMAF 0
#define CONFIG_WEBM_IO 0
#define DECODE_HEIGHT_LIMIT 0
#define DECODE_WIDTH_LIMIT 0

View file

@ -1,5 +1,5 @@
;
; Copyright (c) 2019, Alliance for Open Media. All rights reserved
; Copyright (c) 2021, Alliance for Open Media. All rights reserved
;
; This source code is subject to the terms of the BSD 2 Clause License and
; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
@ -54,8 +54,8 @@ CONFIG_SHARP_SETTINGS equ 0
CONFIG_SIZE_LIMIT equ 0
CONFIG_SPATIAL_RESAMPLING equ 1
CONFIG_SPEED_STATS equ 0
CONFIG_STATIC equ 1
CONFIG_SUPERRES_IN_RECODE equ 1
CONFIG_TUNE_VMAF equ 0
CONFIG_WEBM_IO equ 0
DECODE_HEIGHT_LIMIT equ 0
DECODE_WIDTH_LIMIT equ 0

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Alliance for Open Media. All rights reserved
* Copyright (c) 2021, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
@ -56,8 +56,8 @@
#define CONFIG_SIZE_LIMIT 0
#define CONFIG_SPATIAL_RESAMPLING 1
#define CONFIG_SPEED_STATS 0
#define CONFIG_STATIC 1
#define CONFIG_SUPERRES_IN_RECODE 1
#define CONFIG_TUNE_VMAF 0
#define CONFIG_WEBM_IO 0
#define DECODE_HEIGHT_LIMIT 0
#define DECODE_WIDTH_LIMIT 0

View file

@ -1,5 +1,5 @@
;
; Copyright (c) 2019, Alliance for Open Media. All rights reserved
; Copyright (c) 2021, Alliance for Open Media. All rights reserved
;
; This source code is subject to the terms of the BSD 2 Clause License and
; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
@ -54,8 +54,8 @@ CONFIG_SHARP_SETTINGS equ 0
CONFIG_SIZE_LIMIT equ 0
CONFIG_SPATIAL_RESAMPLING equ 1
CONFIG_SPEED_STATS equ 0
CONFIG_STATIC equ 1
CONFIG_SUPERRES_IN_RECODE equ 1
CONFIG_TUNE_VMAF equ 0
CONFIG_WEBM_IO equ 0
DECODE_HEIGHT_LIMIT equ 0
DECODE_WIDTH_LIMIT equ 0

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Alliance for Open Media. All rights reserved
* Copyright (c) 2021, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
@ -56,8 +56,8 @@
#define CONFIG_SIZE_LIMIT 0
#define CONFIG_SPATIAL_RESAMPLING 1
#define CONFIG_SPEED_STATS 0
#define CONFIG_STATIC 1
#define CONFIG_SUPERRES_IN_RECODE 1
#define CONFIG_TUNE_VMAF 0
#define CONFIG_WEBM_IO 0
#define DECODE_HEIGHT_LIMIT 0
#define DECODE_WIDTH_LIMIT 0

View file

@ -1,5 +1,5 @@
;
; Copyright (c) 2019, Alliance for Open Media. All rights reserved
; Copyright (c) 2021, Alliance for Open Media. All rights reserved
;
; This source code is subject to the terms of the BSD 2 Clause License and
; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
@ -54,8 +54,8 @@ CONFIG_SHARP_SETTINGS equ 0
CONFIG_SIZE_LIMIT equ 0
CONFIG_SPATIAL_RESAMPLING equ 1
CONFIG_SPEED_STATS equ 0
CONFIG_STATIC equ 1
CONFIG_SUPERRES_IN_RECODE equ 1
CONFIG_TUNE_VMAF equ 0
CONFIG_WEBM_IO equ 0
DECODE_HEIGHT_LIMIT equ 0
DECODE_WIDTH_LIMIT equ 0

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Alliance for Open Media. All rights reserved
* Copyright (c) 2021, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
@ -56,8 +56,8 @@
#define CONFIG_SIZE_LIMIT 0
#define CONFIG_SPATIAL_RESAMPLING 1
#define CONFIG_SPEED_STATS 0
#define CONFIG_STATIC 1
#define CONFIG_SUPERRES_IN_RECODE 1
#define CONFIG_TUNE_VMAF 0
#define CONFIG_WEBM_IO 0
#define DECODE_HEIGHT_LIMIT 0
#define DECODE_WIDTH_LIMIT 0

View file

@ -1,5 +1,5 @@
;
; Copyright (c) 2019, Alliance for Open Media. All rights reserved
; Copyright (c) 2021, Alliance for Open Media. All rights reserved
;
; This source code is subject to the terms of the BSD 2 Clause License and
; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
@ -54,8 +54,8 @@ CONFIG_SHARP_SETTINGS equ 0
CONFIG_SIZE_LIMIT equ 0
CONFIG_SPATIAL_RESAMPLING equ 1
CONFIG_SPEED_STATS equ 0
CONFIG_STATIC equ 1
CONFIG_SUPERRES_IN_RECODE equ 1
CONFIG_TUNE_VMAF equ 0
CONFIG_WEBM_IO equ 0
DECODE_HEIGHT_LIMIT equ 0
DECODE_WIDTH_LIMIT equ 0

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Alliance for Open Media. All rights reserved
* Copyright (c) 2021, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
@ -56,8 +56,8 @@
#define CONFIG_SIZE_LIMIT 0
#define CONFIG_SPATIAL_RESAMPLING 1
#define CONFIG_SPEED_STATS 0
#define CONFIG_STATIC 1
#define CONFIG_SUPERRES_IN_RECODE 1
#define CONFIG_TUNE_VMAF 0
#define CONFIG_WEBM_IO 0
#define DECODE_HEIGHT_LIMIT 0
#define DECODE_WIDTH_LIMIT 0

View file

@ -9,7 +9,7 @@ import os
import re
import subprocess
AOM_DIR = '../../media/libaom/src'
AOM_DIR = '/media/libaom/src'
def write_aom_config(system, arch, variables, cache_variables):
# read template cmake file

View file

@ -15,7 +15,7 @@
export LC_ALL=C
BASE_DIR=$(pwd)
LIBAOM_SRC_DIR="../../media/libaom/src"
LIBAOM_SRC_DIR="/media/libaom/src"
LIBAOM_CONFIG_DIR="config"
# Print license header.

File diff suppressed because it is too large Load diff

18
media/libaom/src/.gitattributes vendored Normal file
View file

@ -0,0 +1,18 @@
*.[chs] filter=fixtabswsp
*.[ch]pp filter=fixtabswsp
*.[ch]xx filter=fixtabswsp
*.asm filter=fixtabswsp
*.php filter=fixtabswsp
*.pl filter=fixtabswsp
*.sh filter=fixtabswsp
*.txt filter=fixwsp
[Mm]akefile filter=fixwsp
*.mk filter=fixwsp
*.rc -crlf
*.ds[pw] -crlf
*.bat -crlf
*.mmp -crlf
*.dpj -crlf
*.pjt -crlf
*.vcp -crlf
*.inf -crlf

View file

@ -3,32 +3,89 @@ Aex Converse <aconverse@google.com>
Aex Converse <aconverse@google.com> <alex.converse@gmail.com>
Alexis Ballier <aballier@gentoo.org> <alexis.ballier@gmail.com>
Alpha Lam <hclam@google.com> <hclam@chromium.org>
Andrey Norkin <anorkin@netflix.com>
Angie Chiang <angiebird@google.com>
Arild Fuldseth <arilfuld@cisco.com> <arild.fuldseth@gmail.com>
Arild Fuldseth <arilfuld@cisco.com> <arilfuld@cisco.com>
Bohan Li <bohanli@google.com>
Changjun Yang <changjun.yang@intel.com>
Chi Yo Tsai <chiyotsai@google.com>
Chi Yo Tsai <chiyotsai@google.com> <chiyotsai@dhcp-100-106-128-213.corp.google.com>
Chm <chm@rock-chips.com>
Damon Shen <yjshen@google.com>
Daniele Castagna <dcastagna@chromium.org> <dcastagna@google.com>
Deb Mukherjee <debargha@google.com>
Elliott Karpilovsky <elliottk@google.com>
Emil Keyder <emilkeyder@google.com>
Erik Niemeyer <erik.a.niemeyer@intel.com> <erik.a.niemeyer@gmail.com>
Guillaume Martres <gmartres@google.com> <smarter3@gmail.com>
Frederic Barbier <frederic.barbier@allegrodvt.com> <fbarbier.contact@gmail.com>
Fyodor Kyslov <kyslov@google.com>
Grant Hsu <grant.hsu@cidana.com> <grant.hsu@gmail.com>
Guillaume Martres <smarter@ubuntu.com>
Guillaume Martres <smarter@ubuntu.com> <gmartres@google.com>
Guillaume Martres <smarter@ubuntu.com> <smarter3@gmail.com>
Guillaume Martres <smarter@ubuntu.com> <gmartres@mozilla.com>
Hangyu Kuang <hkuang@google.com>
Hui Su <huisu@google.com>
Iole Moccagatta <iole.moccagatta@gmail.com>
Jacky Chen <jackychen@google.com>
James Zern <jzern@google.com> <jzern@google.cOm>
Jean-Marc Valin <jmvalin@jmvalin.ca> <jmvalin@mozilla.com>
Jim Bankoski <jimbankoski@google.com>
Johann Koenig <johannkoenig@google.com>
Johann Koenig <johannkoenig@google.com> <johann.koenig@duck.com>
Johann Koenig <johannkoenig@google.com> <johann.koenig@gmail.com>
Johann Koenig <johannkoenig@google.com> <johannkoenig@chromium.org>
John Koleszar <jkoleszar@google.com>
Joshua Litt <joshualitt@google.com> <joshualitt@chromium.org>
Lokeshwar Reddy B <lokeshwar.reddy@ittiam.com>
Logan Goldberg <logangw@google.com>
Luc Trudeau <luc@trud.ca>
Luc Trudeau <luc@trud.ca> <ltrudeau@mozilla.com>
Marco Paniconi <marpan@google.com>
Marco Paniconi <marpan@google.com> <marpan@chromium.org>
Michael Bebenita <mbebenita@gmail.com> <mbebenita@mozilla.com>
Michael Horowitz <mhoro@webrtc.org> <mhoro@google.com>
Mingliang Chen <mlchen@google.com>
Monty Montgomery <cmontgomery@mozilla.com>
Nathan E. Egge <negge@mozilla.com>
Nathan E. Egge <negge@mozilla.com> <negge@dgql.org>
Pascal Massimino <pascal.massimino@gmail.com>
Pascal Massimino <pascal.massimino@gmail.com> <skal@google.com>
Paul Wilkins <paulwilkins@google.com>
Peng Bin <binpengsmail@gmail.com>
Peng Bin <binpengsmail@gmail.com> <pengbin@kingsoft.com>
Peter de Rivaz <peter.derivaz@gmail.com> <peter.derivaz@argondesign.com>
Ralph Giles <giles@xiph.org> <giles@entropywave.com>
Ralph Giles <giles@xiph.org> <giles@mozilla.com>
Remya Prakasan <remya.prakasan@ittiam.com>
Roger Zhou <youzhou@microsoft.com>
Ronald S. Bultje <rsbultje@gmail.com> <rbultje@google.com>
Ryan Lei <ryan.z.lei@intel.com>
Ryan Lei <ryan.z.lei@intel.com> <ryan.lei@intel.com>
Ryan Lei <ryan.z.lei@intel.com> <zlei3@ZLEI3-DESK.amr.corp.intel.com>
Sachin Kumar Garg <sachin.kumargarg@ittiam.com>
Sai Deng <sdeng@google.com>
Sami Pietilä <samipietila@google.com>
Sarah Parker <sarahparker@google.com>
Tamar Levy <tamar.levy@intel.com>
Tamar Levy <tamar.levy@intel.com> <levytamar82@gmail.com>
Tero Rintaluoma <teror@google.com> <tero.rintaluoma@on2.com>
Thomas Davies Thomas <thdavies@cisco.com>
Timothy B. Terriberry <tterribe@xiph.org>
Timothy B. Terriberry <tterribe@xiph.org> <tterriberry@mozilla.com>
Timothy B. Terriberry <tterribe@xiph.org> Tim Terriberry <tterriberry@mozilla.com>
Tom Finegan <tomfinegan@google.com>
Tom Finegan <tomfinegan@google.com> <tomfinegan@chromium.org>
Tristan Matthews <tmatth@videolan.org> <le.businessman@gmail.com>
Venkat Sanampudi <sanampudi.venkatarao@ittiam.com>
Wei-Ting Lin <weitinglin@google.com>
Wei-Ting Lin <weitinglin@google.com> <weitingco@gmail.com>
Wenyao Liu <wenyao.liu@cidana.com>
Yaowu Xu <yaowu@google.com> <adam@xuyaowu.com>
Yaowu Xu <yaowu@google.com> <yaowu@xuyaowu.com>
Yaowu Xu <yaowu@google.com> <yaowu@yaowu-macbookpro.roam.corp.google.com>
Yaowu Xu <yaowu@google.com> <Yaowu Xu>
Yaowu Xu <yaowu@google.com> <yaowu.google.com>
Zhipin Deng <zhipin.deng@intel.com>
Zoe Liu <zoeliu@gmail.com> <zoeliu@google.com>

View file

@ -1,13 +1,16 @@
# This file is automatically generated from the git commit history
# by tools/gen_authors.sh.
Aamir Anis <aanis@google.com>
Aaron Watry <awatry@gmail.com>
Aasaipriya <aasaipriya.c@ittiam.com>
Abo Talib Mahfoodh <ab.mahfoodh@gmail.com>
Adam Xu <adam@xuyaowu.com>
Adrian Grange <agrange@google.com>
Aex Converse <aconverse@google.com>
Ahmad Sharif <asharif@google.com>
Akshata Jadhav <akshata.jadhav@ittiam.com>
Alexander Bokov <alexanderbokov@google.com>
Alexander Voronov <avoronov@graphics.cs.msu.ru>
Aex Converse <aconverse@google.com>
Alexis Ballier <aballier@gentoo.org>
Alok Ahuja <waveletcoeff@gmail.com>
Alpha Lam <hclam@google.com>
@ -16,39 +19,82 @@ Ami Fischman <fischman@chromium.org>
Andoni Morales Alastruey <ylatuya@gmail.com>
Andres Mejia <mcitadel@gmail.com>
Andrew Russell <anrussell@google.com>
Andrey Norkin <anorkin@netflix.com>
Angie Chiang <angiebird@google.com>
Aniket Dhok <aniket.dhok@ittiam.com>
Ankur Saxena <ankurs@nvidia.com>
Arild Fuldseth <arilfuld@cisco.com>
Aron Rosenberg <arosenberg@logitech.com>
Attila Nagy <attilanagy@google.com>
Bohan Li <bohanli@google.com>
Brennan Shacklett <bshacklett@mozilla.com>
Brion Vibber <bvibber@wikimedia.org>
changjun.yang <changjun.yang@intel.com>
Bruno Berthier <bruno.berthier@allegrodvt.com>
Changjun Yang <changjun.yang@intel.com>
Charles 'Buck' Krasic <ckrasic@google.com>
chm <chm@rock-chips.com>
Cheng Chen <chengchen@google.com>
Cherma Rajan A <cherma.rajan@ittiam.com>
Chi Yo Tsai <chiyotsai@google.com>
Chm <chm@rock-chips.com>
Christian Duvivier <cduvivier@google.com>
Cyril Concolato <cconcolato@netflix.com>
Dake He <dkhe@google.com>
Damon Shen <yjshen@google.com>
Dandan Ding <vickyddding@gmail.com>
Daniele Castagna <dcastagna@chromium.org>
Daniel Kang <ddkang@google.com>
Daniel Max Valenzuela <daniel.vt@samsung.com>
Danil Chapovalov <danilchap@google.com>
David Barker <david.barker@argondesign.com>
David Major <dmajor@mozilla.com>
David Michael Barr <b@rr-dav.id.au>
David Turner <david.turner@argondesign.com>
Deb Mukherjee <debargha@google.com>
Deepa K G <deepa.kg@ittiam.com>
Deng <zhipin.deng@intel.com>
Di Chen <chendixi@google.com>
Dim Temp <dimtemp0@gmail.com>
Dmitry Kovalev <dkovalev@google.com>
Dominic Symes <dominic.symes@arm.com>
Dragan Mrdjan <dmrdjan@mips.com>
Ed Baker <edward.baker@intel.com>
Edward Hervey <edward@centricular.com>
Ehsan Akhgari <ehsan.akhgari@gmail.com>
Elliott Karpilovsky <elliottk@google.com>
Emil Keyder <emilkeyder@google.com>
Erik Niemeyer <erik.a.niemeyer@intel.com>
Fabio Pedretti <fabio.ped@libero.it>
Fangwen Fu <fangwen.fu@intel.com>
Fergus Simpson <afergs@google.com>
Frank Bossen <fbossen@gmail.com>
Frank Galligan <fgalligan@google.com>
Frederic Barbier <frederic.barbier@allegrodvt.com>
Fredrik Söderquist <fs@opera.com>
Fritz Koenig <frkoenig@google.com>
Fyodor Kyslov <kyslov@google.com>
Gaute Strokkenes <gaute.strokkenes@broadcom.com>
Geza Lore <gezalore@gmail.com>
Ghislain MARY <ghislainmary2@gmail.com>
Giuseppe Scrivano <gscrivano@gnu.org>
Gordana Cmiljanovic <gordana.cmiljanovic@imgtec.com>
Guillaume Martres <gmartres@google.com>
Grant Hsu <grant.hsu@cidana.com>
Guillaume Martres <smarter@ubuntu.com>
Guillermo Ballester Valor <gbvalor@gmail.com>
Hamsalekha S <hamsalekha.s@ittiam.com>
Hangyu Kuang <hkuang@google.com>
Hanno Böck <hanno@hboeck.de>
Harish Mahendrakar <harish.mahendrakar@ittiam.com>
Henrik Lundin <hlundin@google.com>
Hien Ho <hienho@google.com>
Hui Su <huisu@google.com>
Ilie Halip <ilie.halip@gmail.com>
Ilya Brailovskiy <brailovs@lab126.com>
Imdad Sardharwalla <imdad.sardharwalla@argondesign.com>
iole moccagatta <iole.moccagatta@gmail.com>
Ivan Krasin <krasin@chromium.org>
Ivan Maltz <ivanmaltz@google.com>
Jacek Caban <cjacek@gmail.com>
Jack Haughton <jack.haughton@argondesign.com>
Jacky Chen <jackychen@google.com>
James Berry <jamesberry@google.com>
James Yu <james.yu@linaro.org>
@ -56,29 +102,42 @@ James Zern <jzern@google.com>
Jan Gerber <j@mailb.org>
Jan Kratochvil <jan.kratochvil@redhat.com>
Janne Salonen <jsalonen@google.com>
Jean-Marc Valin <jmvalin@jmvalin.ca>
Jayasanker J <jayasanker.j@ittiam.com>
Jean-Marc Valin <jmvalin@mozilla.com>
Jean-Yves Avenard <jyavenard@mozilla.com>
Jeff Faust <jfaust@google.com>
Jeff Muizelaar <jmuizelaar@mozilla.com>
Jeff Petkau <jpet@chromium.org>
Jerome Jiang <jianj@google.com>
Jia Jia <jia.jia@linaro.org>
Jian Zhou <zhoujian@google.com>
Jim Bankoski <jimbankoski@google.com>
Jingning Han <jingning@google.com>
Joe Young <joeyoung@google.com>
Joey Parrish <joeyparrish@google.com>
Johann Koenig <johannkoenig@chromium.org>
Johann Koenig <johannkoenig@google.com>
John Koleszar <jkoleszar@google.com>
Johnny Klonaris <google@jawknee.com>
John Stark <jhnstrk@gmail.com>
Jonathan Matthews <jonathan.matthews@argondesign.com>
Joshua Bleecher Snyder <josh@treelinelabs.com>
Joshua Litt <joshualitt@google.com>
Julia Robson <juliamrobson@gmail.com>
Justin Clift <justin@salasaga.org>
Justin Lebar <justin.lebar@gmail.com>
Katsuhisa Yuasa <berupon@gmail.com>
KO Myung-Hun <komh@chollian.net>
Krishna Malladi <kmalladi@google.com>
Kyle Siefring <kylesiefring@gmail.com>
Larisa Markeeva <lmarkeeva@google.com>
Lawrence Velázquez <larryv@macports.org>
Lester Lu <kslu@google.com>
Linfeng Zhang <linfengz@google.com>
Logan Goldberg <logangw@google.com>
Lokeshwar Reddy B <lokeshwar.reddy@ittiam.com>
Lou Quillio <louquillio@google.com>
Luca Barbato <lu_zero@gentoo.org>
Luc Trudeau <ltrudeau@mozilla.com>
Makoto Kato <makoto.kt@gmail.com>
Mans Rullgard <mans@mansr.com>
Marco Paniconi <marpan@google.com>
@ -86,40 +145,78 @@ Mark Mentovai <mark@chromium.org>
Martin Ettl <ettl.martin78@googlemail.com>
Martin Storsjo <martin@martin.st>
Matthew Heaney <matthewjheaney@chromium.org>
Matthieu Vaudano <matthieu.vaudano@allegrodvt.com>
Mattias Hansson <mattias.hansson@arm.com>
Maxym Dmytrychenko <maxim.d33@gmail.com>
Michael Bebenita <mbebenita@mozilla.com>
Michael Horowitz <mhoro@webrtc.org>
Michael Kohler <michaelkohler@live.com>
Michelle Findlay-Olynyk <mfo@google.com>
Mike Frysinger <vapier@chromium.org>
Mike Hommey <mhommey@mozilla.com>
Mikhal Shemer <mikhal@google.com>
Minghai Shang <minghai@google.com>
Mingliang Chen <mlchen@google.com>
Mirko Bonadei <mbonadei@google.com>
Monty Montgomery <cmontgomery@mozilla.com>
Morton Jonuschat <yabawock@gmail.com>
Nathan E. Egge <negge@dgql.org>
Mufaddal Chakera <mufaddal.chakera@ittiam.com>
Nathan E. Egge <negge@mozilla.com>
Neil Birkbeck <birkbeck@google.com>
Nico Weber <thakis@chromium.org>
Nithya V S <nithya.vs@ittiam.com>
Ola Hugosson <ola.hugosson@arm.com>
Oleg Nalivayko <o13g86@gmail.com>
Parag Salasakar <img.mips1@gmail.com>
Pascal Massimino <pascal.massimino@gmail.com>
Patrik Westin <patrik.westin@gmail.com>
Paul Wilkins <paulwilkins@google.com>
Pavel Frolov <pavel.frolov@vicuesoft.com>
Pavol Rusnak <stick@gk2.sk>
Paweł Hajdan <phajdan@google.com>
Peng Bin <binpengsmail@gmail.com>
Pengchong Jin <pengchong@google.com>
Peter de Rivaz <peter.derivaz@argondesign.com>
Peter Boström <pbos@google.com>
Peter de Rivaz <peter.derivaz@gmail.com>
Philip Jägenstedt <philipj@opera.com>
Priit Laes <plaes@plaes.org>
Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
Rafaël Carré <funman@videolan.org>
Ralph Giles <giles@xiph.org>
Ranjit Kumar Tulabandu <ranjit.tulabandu@ittiam.com>
Ravi Chaudhary <ravi.chaudhary@ittiam.com>
Remya Prakasan <remya.prakasan@ittiam.com>
Remy Foray <remy.foray@allegrodvt.com>
Rob Bradford <rob@linux.intel.com>
Robert-André Mauchin <zebob.m@gmail.com>
RogerZhou <youzhou@microsoft.com>
Rohit Athavale <rathaval@xilinx.com>
Ronald S. Bultje <rsbultje@gmail.com>
Rostislav Pehlivanov <rpehlivanov@mozilla.com>
Ruiling Song <ruiling.song@intel.com>
Rui Ueyama <ruiu@google.com>
Rupert Swarbrick <rupert.swarbrick@argondesign.com>
Ryan Lei <ryan.lei@intel.com>
Ryan Overbeck <rover@google.com>
Sachin Kumar Garg <sachin.kumargarg@ittiam.com>
Sai Deng <sdeng@google.com>
Sami Pietilä <samipietila@google.com>
Sarah Parker <sarahparker@google.com>
Sasi Inguva <isasi@google.com>
Satish Kumar Suman <satish.suman@ittiam.com>
Scott Graham <scottmg@chromium.org>
Scott LaVarnway <slavarnway@google.com>
Sean DuBois <sean@siobud.com>
Sean McGovern <gseanmcg@gmail.com>
Sean Purser-Haskell <seanhaskell@google.com>
Sebastien Alaiwan <sebastien.alaiwan@allegrodvt.com>
Sergey Kolomenkin <kolomenkin@gmail.com>
Sergey Ulanov <sergeyu@chromium.org>
Shimon Doodkin <helpmepro1@gmail.com>
Shunyao Li <shunyaoli@google.com>
SmilingWolf <lupo996@gmail.com>
Soo-Chul Han <shan@vidyo.com>
Stanislav Vitvitskyy <vitvitskyy@google.com>
Stefan Holmer <holmer@google.com>
Steinar Midtskogen <stemidts@cisco.com>
Suman Sunkara <sunkaras@google.com>
@ -127,18 +224,37 @@ Taekhyun Kim <takim@nvidia.com>
Takanori MATSUURA <t.matsuu@gmail.com>
Tamar Levy <tamar.levy@intel.com>
Tao Bai <michaelbai@chromium.org>
Tarek AMARA <amatarek@justin.tv>
Tero Rintaluoma <teror@google.com>
Thijs Vermeir <thijsvermeir@gmail.com>
Thomas Daede <tdaede@mozilla.com>
Thomas Davies <thdavies@cisco.com>
Thomas <thdavies@cisco.com>
Thomas Davies Thomas <thdavies@cisco.com>
Tim Kopp <tkopp@google.com>
Timothy B. Terriberry <tterribe@xiph.org>
Timo Witte <timo.witte@gmail.com>
Todd Nguyen <toddnguyen@google.com>
Tom Anderson <thomasanderson@google.com>
Tom Finegan <tomfinegan@google.com>
Tristan Matthews <le.businessman@gmail.com>
Tristan Matthews <tmatth@videolan.org>
Umang Saini <umang.saini@ittiam.com>
Urvang Joshi <urvang@google.com>
Venkat Sanampudi <sanampudi.venkatarao@ittiam.com>
Victoria Zhislina <niva213@gmail.com>
Vignesh Venkatasubramanian <vigneshv@google.com>
Vishesh <vishesh.garg@ittiam.com>
Wan-Teh Chang <wtc@google.com>
Wei-Ting Lin <weitinglin@google.com>
Wenyao Liu <wenyao.liu@cidana.com>
Xing Jin <ddvfinite@gmail.com>
Xin Zhao <xinzzhao@tencent.com>
Yaowu Xu <yaowu.google.com>
Yaowu Xu <yaowu@google.com>
Yi Luo <luoyi@google.com>
Yongzhe Wang <yongzhe@google.com>
Yue Chen <yuec@google.com>
Yunqing Wang <yunqingwang@google.com>
Zoe Liu <zoeliu@google.com>
Yury Gitman <yuryg@google.com>
Yushin Cho <ycho@mozilla.com>
Zhijie Yang <zhijie.yang@broadcom.com>
zhipin deng <zhipin.deng@intel.com>
Zoe Liu <zoeliu@gmail.com>

View file

@ -1,3 +1,49 @@
2021-02-09 v2.0.2
This release includes several bug fixes.
- Bug fixes:
Issue 2643: Modify the assertion in temporal filter intrinsics.
Issue 2648: Fix unit test ThreadTestLarge.EncoderResultTest/49
assertion failure.
Issue 2869: Add -Wimplicit-function-declaration as C flag only.
Issue 2878: Avoid memset in the av1_filter_intra_predictor module
functions.
Issue 2903: Fix a typo bug in apply_temporal_filter_planewise.
Call av1_setup_frame_size() when dropping a frame in the
encode_frame_to_data_rate() function in av1/encoder/encoder.c.
2020-11-25 v2.0.1
This release includes two bug fixes.
- Bug fixes:
Issue 2723: Fix crash in chroma_check() when generating a monochrome
encoded stream in real-time mode.
Issue 2833: Fix crash on some input when reduced still picture header is
used in real-time mode and speed >=7.
2020-05-07 v2.0.0 "Applejack"
First official release of libaom.
This release includes new real-time mode and SVC support.
- Upgrading:
AOM_SET_POSTPROC, AOM_CODEC_CAP_POSTPROC and AOM_CODEC_USE_POSTPROC are
removed.
AOM_SET_DBG_* is removed.
Multi-resolution encoding is removed.
put_frame and put_slice callbacks are removed.
- Enhancements:
Full-sweep document update for codec controls.
2018-06-28 v1.0.0
AOMedia Codec Workgroup Approved version 1.0

View file

@ -32,6 +32,11 @@ if("${AOM_ROOT}" STREQUAL "${AOM_CONFIG_DIR}")
"And re-run CMake from the aom_build directory.")
endif()
# Updating version info.
# https://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
set(SO_VERSION 2)
set(SO_FILE_VERSION 2.0.2)
include("${AOM_ROOT}/build/cmake/aom_configure.cmake")
include("${AOM_ROOT}/aom_dsp/aom_dsp.cmake")
include("${AOM_ROOT}/aom_mem/aom_mem.cmake")
@ -190,6 +195,18 @@ add_custom_target(aom_version_check
"${AOM_ROOT}/build/cmake/version.cmake"
COMMENT "Updating version info if necessary."
VERBATIM)
if(BUILD_SHARED_LIBS AND NOT MSVC)
# Generate version file immediately for non-MSVC shared builds: The version
# string is needed for the aom target.
execute_process(COMMAND ${CMAKE_COMMAND}
-DAOM_CONFIG_DIR=${AOM_CONFIG_DIR}
-DAOM_ROOT=${AOM_ROOT}
-DGIT_EXECUTABLE=${GIT_EXECUTABLE}
-DPERL_EXECUTABLE=${PERL_EXECUTABLE} -P
"${AOM_ROOT}/build/cmake/version.cmake")
endif()
add_dependencies(aom_version aom_version_check)
# TODO(tomfinegan): Move rtcd target setup where it belongs for each rtcd
@ -211,14 +228,46 @@ if(ENABLE_EXAMPLES)
add_library(aom_encoder_stats OBJECT ${AOM_ENCODER_STATS_SOURCES})
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_encoder_stats)
endif()
add_library(aom ${AOM_SOURCES} $<TARGET_OBJECTS:aom_rtcd>)
if(BUILD_SHARED_LIBS)
add_library(aom_static STATIC ${AOM_SOURCES} $<TARGET_OBJECTS:aom_rtcd>)
set_target_properties(aom_static PROPERTIES OUTPUT_NAME aom)
if(NOT MSVC)
# Extract version string and set VERSION/SOVERSION for the aom target.
extract_version_string("${AOM_CONFIG_DIR}/config/aom_version.h"
aom_version_triple)
# Strip any trailing version information, if present.
string(FIND "${aom_version_triple}" "-" dash_pos)
if(NOT dash_pos EQUAL -1)
string(SUBSTRING "${aom_version_triple}" 0 ${dash_pos} aom_version_triple)
endif()
# cmake-format: off
# VERSION is embedded in the .so file name.
# libaom.so -> libaom.so.SOVERSION
# libaom.so.SOVERSION -> libaom.so.VERSION
# libaom.so.VERSION
# cmake-format: on
set_target_properties(aom PROPERTIES SOVERSION ${SO_VERSION})
set_target_properties(aom PROPERTIES VERSION ${SO_FILE_VERSION})
endif()
endif()
if(NOT MSVC AND NOT APPLE)
target_link_libraries(aom ${AOM_LIB_LINK_TYPE} m)
if(BUILD_SHARED_LIBS)
target_link_libraries(aom_static ${AOM_LIB_LINK_TYPE} m)
endif()
endif()
# List of object and static library targets.
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_rtcd aom_mem aom_scale aom)
if(BUILD_SHARED_LIBS)
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_static)
endif()
# Setup dependencies.
setup_aom_dsp_targets()
@ -382,6 +431,19 @@ if(CONFIG_AV1_ENCODER)
# Add encoder examples and tools to the targets list.
list(APPEND AOM_APP_TARGETS ${AOM_ENCODER_EXAMPLE_TARGETS}
${AOM_ENCODER_TOOL_TARGETS})
if(CONFIG_TUNE_VMAF)
find_library(VMAF libvmaf.a vmaf)
if(NOT VMAF)
message(FATAL_ERROR "VMAF library not found.")
endif()
message("-- Found VMAF library: " ${VMAF})
set_target_properties(aom PROPERTIES LINKER_LANGUAGE CXX)
if(BUILD_SHARED_LIBS)
set_target_properties(aom_static PROPERTIES LINKER_LANGUAGE CXX)
endif()
target_link_libraries(aom PRIVATE ${VMAF})
endif()
endif()
if(ENABLE_EXAMPLES)
@ -510,6 +572,9 @@ endif()
if(HAVE_PTHREAD_H AND CONFIG_MULTITHREAD)
find_package(Threads)
target_link_libraries(aom ${AOM_LIB_LINK_TYPE} Threads::Threads)
if(BUILD_SHARED_LIBS)
target_link_libraries(aom_static ${AOM_LIB_LINK_TYPE} Threads::Threads)
endif()
endif()
if(XCODE)
@ -559,7 +624,6 @@ endif()
if(BUILD_SHARED_LIBS)
include("${AOM_ROOT}/build/cmake/exports.cmake")
setup_exports_target()
set_target_properties(aom PROPERTIES SOVERSION 0)
endif()
# Handle user supplied compile and link flags last to ensure they're obeyed.

View file

@ -14,6 +14,7 @@
- [Xcode builds](#xcode-builds)
- [Emscripten builds](#emscripten-builds)
- [Extra Build Flags](#extra-build-flags)
- [Build with VMAF support](#build-with-vmaf)
2. [Testing the library](#testing-the-av1-codec)
- [Basics](#testing-basics)
- [Unit tests](#1_unit-tests)
@ -47,7 +48,9 @@
2. [Git](https://git-scm.com/).
3. [Perl](https://www.perl.org/).
4. For x86 targets, [yasm](http://yasm.tortall.net/), which is preferred, or a
recent version of [nasm](http://www.nasm.us/).
recent version of [nasm](http://www.nasm.us/). If you download yasm with
the intention to work with Visual Studio, please download win32.exe or
win64.exe and rename it into yasm.exe. DO NOT download or use vsyasm.exe.
5. Building the documentation requires [doxygen](http://doxygen.org).
6. Building the unit tests requires [Python](https://www.python.org/).
7. Emscripten builds require the portable
@ -211,12 +214,28 @@ compiler documentation to determine which, if any, are available.
### Microsoft Visual Studio builds
Building the AV1 codec library in Microsoft Visual Studio is supported. Visual
Studio 2015 (14.0) or later is required. The following example demonstrates
Studio 2017 (15.0) or later is required. The following example demonstrates
generating projects and a solution for the Microsoft IDE:
~~~
# This does not require a bash shell; command.exe is fine.
$ cmake path/to/aom -G "Visual Studio 15 2017"
# This does not require a bash shell; Command Prompt (cmd.exe) is fine.
# This assumes the build host is a Windows x64 computer.
# To build with Visual Studio 2019 for the x64 target:
$ cmake path/to/aom -G "Visual Studio 16 2019"
$ cmake --build .
# To build with Visual Studio 2019 for the 32-bit x86 target:
$ cmake path/to/aom -G "Visual Studio 16 2019" -A Win32
$ cmake --build .
# To build with Visual Studio 2017 for the x64 target:
$ cmake path/to/aom -G "Visual Studio 15 2017" -T host=x64 -A x64
$ cmake --build .
# To build with Visual Studio 2017 for the 32-bit x86 target:
$ cmake path/to/aom -G "Visual Studio 15 2017" -T host=x64
$ cmake --build .
~~~
NOTE: The build system targets Windows 7 or later by compiling files with
@ -293,6 +312,24 @@ These flags can be used, for example, to enable asserts in a release build:
-DAOM_EXTRA_CXX_FLAGS=-UNDEBUG
~~~
### Build with VMAF support
After installing
[libvmaf.a](https://github.com/Netflix/vmaf/blob/master/resource/doc/libvmaf.md),
you can use it with the encoder:
~~~
$ cmake path/to/aom -DCONFIG_TUNE_VMAF=1
~~~
Please note that the default VMAF model
("/usr/local/share/model/vmaf_v0.6.1.pkl")
will be used unless you set the following flag when running the encoder:
~~~
# --vmaf-model-path=path/to/model
~~~
## Testing the AV1 codec
### Testing basics

View file

@ -0,0 +1,35 @@
#sample config file
super_block_size = 128 # super block size. 0, 64 or 128
max_partition_size = 128 # max partition size(8, 16, 32, 64, 128)
min_partition_size = 4 # min partition size(4, 8, 16, 32, 64)
disable_rect_partition_type = 0 # disable rectangle partition type
disable_ab_partition_type = 0 # disable AB partition type
disable_1to4_partition_type = 0 # disable 1 to 4 and 4 to 1 partition type
disable_intra_angle_delta = 0 # disable intra angle delta
disable_paeth_intra = 0 # disable paeth intra
disable_smooth_intra = 0 # disable intra smooth mode
disable_intra_edge_filter = 0 # disable intra edge filter
disable_filter_intra = 0 # disable filter intra
disable_intrabc = 0 # disable Intra Block Copy
disable_cfl = 0 # disable chroma from luma prediction
disable_palette = 0 # disable Palette
disable_flip_idtx = 0 # disable flip and identity transform
disable_tx_64x64 = 0 # disable 64x64 transform
reduced_tx_type_set = 0 # use reduced transform type set
reduced_reference_set = 0 # use reduced reference frame set
disable_obmc = 0 # disable OBMC
disable_warp_motion = 0 # disable Warped Motion
disable_global_motion = 0 # disable global motion
disable_ref_frame_mv = 0 # disable ref mv
disable_dual_filter = 0 # disable dual interpolation filter
disable_one_sided_comp = 0 # disable one sided compound mode
disable_masked_comp = 0 # disable masked compound prediction
disable_diff_wtd_comp = 0 # disable difference weighted compound mode
disable_inter_inter_wedge = 0 # disable inter/inter wedge comp
disable_dist_wtd_comp = 0 # disable distant weighted compound mode
disable_inter_intra_comp = 0 # disable inter/intra compound mode.
disable_inter_intra_wedge = 0 # disable inter/intra wedge comp
disable_smooth_inter_intra = 0 # disable smooth inter/intra
disable_cdef = 0 # disable CDEF filter
disable_lr = 0 # disable Loop Restoration Filter
disable_trellis_quant = 0 # disable trellis quantization

View file

@ -43,64 +43,27 @@ extern "C" {
* The set of macros define the control functions of AOM interface
*/
enum aom_com_control_id {
/*!\brief pass in an external frame into decoder to be used as reference frame
/* TODO(https://crbug.com/aomedia/2671): The encoder overlaps the range of
* these values for its control ids, see the NOTEs in aom/aomcx.h. These
* should be migrated to something like the AOM_DECODER_CTRL_ID_START range
* next time we're ready to break the ABI.
*/
AOM_SET_POSTPROC = 3, /**< set the decoder's post processing settings */
AOM_SET_DBG_COLOR_REF_FRAME =
4, /**< set the reference frames to color for each macroblock */
AOM_SET_DBG_COLOR_MB_MODES = 5, /**< set which macro block modes to color */
AOM_SET_DBG_COLOR_B_MODES = 6, /**< set which blocks modes to color */
AOM_SET_DBG_DISPLAY_MV = 7, /**< set which motion vector modes to draw */
/* TODO(jkoleszar): The encoder incorrectly reuses some of these values (5+)
* for its control ids. These should be migrated to something like the
* AOM_DECODER_CTRL_ID_START range next time we're ready to break the ABI.
*/
AV1_GET_REFERENCE = 128, /**< get a pointer to a reference frame */
AV1_SET_REFERENCE = 129, /**< write a frame into a reference buffer */
AV1_COPY_REFERENCE =
130, /**< get a copy of reference frame from the decoder */
AV1_GET_REFERENCE = 128, /**< get a pointer to a reference frame,
av1_ref_frame_t* parameter */
AV1_SET_REFERENCE = 129, /**< write a frame into a reference buffer,
av1_ref_frame_t* parameter */
AV1_COPY_REFERENCE = 130, /**< get a copy of reference frame from the decoderm
av1_ref_frame_t* parameter */
AOM_COMMON_CTRL_ID_MAX,
AV1_GET_NEW_FRAME_IMAGE = 192, /**< get a pointer to the new frame */
AV1_COPY_NEW_FRAME_IMAGE =
193, /**< copy the new frame to an external buffer */
AV1_GET_NEW_FRAME_IMAGE =
192, /**< get a pointer to the new frame, aom_image_t* parameter */
AV1_COPY_NEW_FRAME_IMAGE = 193, /**< copy the new frame to an external buffer,
aom_image_t* parameter */
AOM_DECODER_CTRL_ID_START = 256
};
/*!\brief post process flags
*
* The set of macros define AOM decoder post processing flags
*/
enum aom_postproc_level {
AOM_NOFILTERING = 0,
AOM_DEBLOCK = 1 << 0,
AOM_DEMACROBLOCK = 1 << 1,
AOM_ADDNOISE = 1 << 2,
AOM_DEBUG_TXT_FRAME_INFO = 1 << 3, /**< print frame information */
AOM_DEBUG_TXT_MBLK_MODES =
1 << 4, /**< print macro block modes over each macro block */
AOM_DEBUG_TXT_DC_DIFF = 1 << 5, /**< print dc diff for each macro block */
AOM_DEBUG_TXT_RATE_INFO = 1 << 6, /**< print video rate info (encoder only) */
AOM_MFQE = 1 << 10
};
/*!\brief post process flags
*
* This define a structure that describe the post processing settings. For
* the best objective measure (using the PSNR metric) set post_proc_flag
* to AOM_DEBLOCK and deblocking_level to 1.
*/
typedef struct aom_postproc_cfg {
/*!\brief the types of post processing to be done, should be combination of
* "aom_postproc_level" */
int post_proc_flag;
int deblocking_level; /**< the strength of deblocking, valid range [0, 16] */
int noise_level; /**< the strength of additive noise, valid range [0, 16] */
} aom_postproc_cfg_t;
/*!\brief AV1 specific reference frame data struct
*
* Define the data struct to access av1 reference frames.
@ -114,26 +77,25 @@ typedef struct av1_ref_frame {
/*!\cond */
/*!\brief aom decoder control function parameter type
*
* defines the data type for each of AOM decoder control function requires
* Defines the data type for each of AOM decoder control function requires.
*
* \note For each control ID "X", a macro-define of
* AOM_CTRL_X is provided. It is used at compile time to determine
* if the control ID is supported by the libaom library available,
* when the libaom version cannot be controlled.
*/
AOM_CTRL_USE_TYPE(AOM_SET_POSTPROC, aom_postproc_cfg_t *)
#define AOM_CTRL_AOM_SET_POSTPROC
AOM_CTRL_USE_TYPE(AOM_SET_DBG_COLOR_REF_FRAME, int)
#define AOM_CTRL_AOM_SET_DBG_COLOR_REF_FRAME
AOM_CTRL_USE_TYPE(AOM_SET_DBG_COLOR_MB_MODES, int)
#define AOM_CTRL_AOM_SET_DBG_COLOR_MB_MODES
AOM_CTRL_USE_TYPE(AOM_SET_DBG_COLOR_B_MODES, int)
#define AOM_CTRL_AOM_SET_DBG_COLOR_B_MODES
AOM_CTRL_USE_TYPE(AOM_SET_DBG_DISPLAY_MV, int)
#define AOM_CTRL_AOM_SET_DBG_DISPLAY_MV
AOM_CTRL_USE_TYPE(AV1_GET_REFERENCE, av1_ref_frame_t *)
#define AOM_CTRL_AV1_GET_REFERENCE
AOM_CTRL_USE_TYPE(AV1_SET_REFERENCE, av1_ref_frame_t *)
#define AOM_CTRL_AV1_SET_REFERENCE
AOM_CTRL_USE_TYPE(AV1_COPY_REFERENCE, av1_ref_frame_t *)
#define AOM_CTRL_AV1_COPY_REFERENCE
AOM_CTRL_USE_TYPE(AV1_GET_NEW_FRAME_IMAGE, aom_image_t *)
#define AOM_CTRL_AV1_GET_NEW_FRAME_IMAGE
AOM_CTRL_USE_TYPE(AV1_COPY_NEW_FRAME_IMAGE, aom_image_t *)
#define AOM_CTRL_AV1_COPY_NEW_FRAME_IMAGE

View file

@ -95,7 +95,7 @@ extern "C" {
* types, removing or reassigning enums, adding/removing/rearranging
* fields to structures
*/
#define AOM_CODEC_ABI_VERSION (3 + AOM_IMAGE_ABI_VERSION) /**<\hideinitializer*/
#define AOM_CODEC_ABI_VERSION (5 + AOM_IMAGE_ABI_VERSION) /**<\hideinitializer*/
/*!\brief Algorithm return codes */
typedef enum {
@ -173,10 +173,25 @@ typedef long aom_codec_caps_t;
*/
typedef long aom_codec_flags_t;
/*!\brief Time Stamp Type
*
* An integer, which when multiplied by the stream's time base, provides
* the absolute time of a sample.
*/
typedef int64_t aom_codec_pts_t;
/*!\brief Codec interface structure.
*
* Contains function pointers and other data private to the codec
* implementation. This structure is opaque to the application.
* implementation. This structure is opaque to the application. Common
* functions used with this structure:
* - aom_codec_iface_name: get the name of the codec
* - aom_codec_get_caps: returns the capabilities of the codec (see
* aom_encoder.h for more details)
* - aom_codec_enc_config_default: generate the default config to use
* when initializing the encoder
* - aom_codec_dec_init, aom_codec_enc_init: initialize the codec context
* structure (see documentation on aom_codec_ctx for more information).
*/
typedef const struct aom_codec_iface aom_codec_iface_t;
@ -370,19 +385,24 @@ aom_codec_err_t aom_codec_destroy(aom_codec_ctx_t *ctx);
*/
aom_codec_caps_t aom_codec_get_caps(aom_codec_iface_t *iface);
/*!\brief Control algorithm
/*!\name Codec Control
*
* This function is used to exchange algorithm specific data with the codec
* instance. This can be used to implement features specific to a particular
* algorithm.
* The aom_codec_control function exchanges algorithm specific data with the
* codec instance. Additionally, the macro AOM_CODEC_CONTROL_TYPECHECKED is
* provided, which will type-check the parameter against the control ID before
* calling aom_codec_control - note that this macro requires the control ID
* to be directly encoded in it, e.g.,
* AOM_CODEC_CONTROL_TYPECHECKED(&ctx, AOME_SET_CPUUSED, 8).
*
* This wrapper function dispatches the request to the helper function
* associated with the given ctrl_id. It tries to call this function
* transparently, but will return #AOM_CODEC_ERROR if the request could not
* be dispatched.
* The codec control IDs can be found in aom.h, aomcx.h, and aomdx.h
* (defined as aom_com_control_id, aome_enc_control_id, and aom_dec_control_id).
* @{
*/
/*!\brief Algorithm Control
*
* Note that this function should not be used directly. Call the
* #aom_codec_control wrapper macro instead.
* aom_codec_control takes a context, a control ID, and a third parameter
* (with varying type). If the context is non-null and an error occurs,
* ctx->err will be set to the same value as the return value.
*
* \param[in] ctx Pointer to this instance's context
* \param[in] ctrl_id Algorithm specific control identifier
@ -394,85 +414,33 @@ aom_codec_caps_t aom_codec_get_caps(aom_codec_iface_t *iface);
* \retval #AOM_CODEC_INVALID_PARAM
* The data was not valid.
*/
aom_codec_err_t aom_codec_control_(aom_codec_ctx_t *ctx, int ctrl_id, ...);
#if defined(AOM_DISABLE_CTRL_TYPECHECKS) && AOM_DISABLE_CTRL_TYPECHECKS
#define aom_codec_control(ctx, id, data) aom_codec_control_(ctx, id, data)
#define AOM_CTRL_USE_TYPE(id, typ)
#define AOM_CTRL_USE_TYPE_DEPRECATED(id, typ)
#define AOM_CTRL_VOID(id, typ)
aom_codec_err_t aom_codec_control(aom_codec_ctx_t *ctx, int ctrl_id, ...);
#else
/*!\brief aom_codec_control wrapper macro
/*!\brief aom_codec_control wrapper macro (adds type-checking, less flexible)
*
* This macro allows for type safe conversions across the variadic parameter
* to aom_codec_control_().
*
* \internal
* It works by dispatching the call to the control function through a wrapper
* function named with the id parameter.
* to aom_codec_control(). However, it requires the explicit control ID
* be passed in (it cannot be passed in via a variable) -- otherwise a compiler
* error will occur. After the type checking, it calls aom_codec_control.
*/
#define aom_codec_control(ctx, id, data) \
aom_codec_control_##id(ctx, id, data) /**<\hideinitializer*/
#define AOM_CODEC_CONTROL_TYPECHECKED(ctx, id, data) \
aom_codec_control_typechecked_##id(ctx, id, data) /**<\hideinitializer*/
/*!\brief aom_codec_control type definition macro
/*!\brief Creates typechecking mechanisms for aom_codec_control
*
* This macro allows for type safe conversions across the variadic parameter
* to aom_codec_control_(). It defines the type of the argument for a given
* control identifier.
*
* \internal
* It defines a static function with
* the correctly typed arguments as a wrapper to the type-unsafe internal
* function.
* It defines a static function with the correctly typed arguments as a wrapper
* to the type-unsafe aom_codec_control function. It also creates a typedef
* for each type.
*/
#define AOM_CTRL_USE_TYPE(id, typ) \
static aom_codec_err_t aom_codec_control_##id(aom_codec_ctx_t *, int, typ) \
AOM_UNUSED; \
\
static aom_codec_err_t aom_codec_control_##id(aom_codec_ctx_t *ctx, \
int ctrl_id, typ data) { \
return aom_codec_control_(ctx, ctrl_id, data); \
} /**<\hideinitializer*/
/*!\brief aom_codec_control deprecated type definition macro
*
* Like #AOM_CTRL_USE_TYPE, but indicates that the specified control is
* deprecated and should not be used. Consult the documentation for your
* codec for more information.
*
* \internal
* It defines a static function with the correctly typed arguments as a
* wrapper to the type-unsafe internal function.
*/
#define AOM_CTRL_USE_TYPE_DEPRECATED(id, typ) \
AOM_DECLSPEC_DEPRECATED static aom_codec_err_t aom_codec_control_##id( \
aom_codec_ctx_t *, int, typ) AOM_DEPRECATED AOM_UNUSED; \
\
AOM_DECLSPEC_DEPRECATED static aom_codec_err_t aom_codec_control_##id( \
aom_codec_ctx_t *ctx, int ctrl_id, typ data) { \
return aom_codec_control_(ctx, ctrl_id, data); \
} /**<\hideinitializer*/
/*!\brief aom_codec_control void type definition macro
*
* This macro allows for type safe conversions across the variadic parameter
* to aom_codec_control_(). It indicates that a given control identifier takes
* no argument.
*
* \internal
* It defines a static function without a data argument as a wrapper to the
* type-unsafe internal function.
*/
#define AOM_CTRL_VOID(id) \
static aom_codec_err_t aom_codec_control_##id(aom_codec_ctx_t *, int) \
AOM_UNUSED; \
\
static aom_codec_err_t aom_codec_control_##id(aom_codec_ctx_t *ctx, \
int ctrl_id) { \
return aom_codec_control_(ctx, ctrl_id); \
} /**<\hideinitializer*/
#endif
#define AOM_CTRL_USE_TYPE(id, typ) \
static aom_codec_err_t aom_codec_control_typechecked_##id( \
aom_codec_ctx_t *, int, typ) AOM_UNUSED; \
static aom_codec_err_t aom_codec_control_typechecked_##id( \
aom_codec_ctx_t *ctx, int ctrl, typ data) { \
return aom_codec_control(ctx, ctrl, data); \
} /**<\hideinitializer*/ \
typedef typ aom_codec_control_type_##id;
/*!@} end Codec Control group */
/*!\brief OBU types. */
typedef enum ATTRIBUTE_PACKED {

View file

@ -42,7 +42,7 @@ extern "C" {
* fields to structures
*/
#define AOM_DECODER_ABI_VERSION \
(4 + AOM_CODEC_ABI_VERSION) /**<\hideinitializer*/
(6 + AOM_CODEC_ABI_VERSION) /**<\hideinitializer*/
/*! \brief Decoder capabilities bitfield
*
@ -52,9 +52,8 @@ extern "C" {
*
* The available flags are specified by AOM_CODEC_CAP_* defines.
*/
#define AOM_CODEC_CAP_PUT_SLICE 0x10000 /**< Will issue put_slice callbacks */
#define AOM_CODEC_CAP_PUT_FRAME 0x20000 /**< Will issue put_frame callbacks */
#define AOM_CODEC_CAP_POSTPROC 0x40000 /**< Can postprocess decoded frame */
/*!brief Can support external frame buffers */
#define AOM_CODEC_CAP_EXTERNAL_FRAME_BUFFER 0x200000
/*! \brief Initialization-time Feature Enabling
*
@ -63,10 +62,6 @@ extern "C" {
*
* The available flags are specified by AOM_CODEC_USE_* defines.
*/
/*!brief Can support external frame buffers */
#define AOM_CODEC_CAP_EXTERNAL_FRAME_BUFFER 0x200000
#define AOM_CODEC_USE_POSTPROC 0x10000 /**< Postprocess decoded frame */
/*!\brief Stream properties
*
@ -107,8 +102,8 @@ typedef struct aom_codec_dec_cfg {
* function directly, to ensure that the ABI version number parameter
* is properly initialized.
*
* If the library was configured with --disable-multithread, this call
* is not thread safe and should be guarded with a lock if being used
* If the library was configured with cmake -DCONFIG_MULTITHREAD=0, this
* call is not thread safe and should be guarded with a lock if being used
* in a multithreaded context.
*
* \param[in] ctx Pointer to this instance's context.
@ -178,16 +173,12 @@ aom_codec_err_t aom_codec_get_stream_info(aom_codec_ctx_t *ctx,
/*!\brief Decode data
*
* Processes a buffer of coded data. If the processing results in a new
* decoded frame becoming available, PUT_SLICE and PUT_FRAME events may be
* generated, as appropriate. Encoded data \ref MUST be passed in DTS (decode
* time stamp) order. Frames produced will always be in PTS (presentation
* time stamp) order.
* Processes a buffer of coded data. Encoded data \ref MUST be passed in DTS
* (decode time stamp) order. Frames produced will always be in PTS
* (presentation time stamp) order.
*
* \param[in] ctx Pointer to this instance's context
* \param[in] data Pointer to this block of new coded data. If
* NULL, a AOM_CODEC_CB_PUT_FRAME event is posted
* for the previously decoded frame.
* \param[in] data Pointer to this block of new coded data.
* \param[in] data_sz Size of the coded data, in bytes.
* \param[in] user_priv Application specific data to associate with
* this frame.
@ -218,95 +209,12 @@ aom_codec_err_t aom_codec_decode(aom_codec_ctx_t *ctx, const uint8_t *data,
*/
aom_image_t *aom_codec_get_frame(aom_codec_ctx_t *ctx, aom_codec_iter_t *iter);
/*!\defgroup cap_put_frame Frame-Based Decoding Functions
*
* The following functions are required to be implemented for all decoders
* that advertise the AOM_CODEC_CAP_PUT_FRAME capability. Calling these
* functions
* for codecs that don't advertise this capability will result in an error
* code being returned, usually AOM_CODEC_ERROR
* @{
*/
/*!\brief put frame callback prototype
*
* This callback is invoked by the decoder to notify the application of
* the availability of decoded image data.
*/
typedef void (*aom_codec_put_frame_cb_fn_t)(void *user_priv,
const aom_image_t *img);
/*!\brief Register for notification of frame completion.
*
* Registers a given function to be called when a decoded frame is
* available.
*
* \param[in] ctx Pointer to this instance's context
* \param[in] cb Pointer to the callback function
* \param[in] user_priv User's private data
*
* \retval #AOM_CODEC_OK
* Callback successfully registered.
* \retval #AOM_CODEC_ERROR
* Decoder context not initialized, or algorithm not capable of
* posting slice completion.
*/
aom_codec_err_t aom_codec_register_put_frame_cb(aom_codec_ctx_t *ctx,
aom_codec_put_frame_cb_fn_t cb,
void *user_priv);
/*!@} - end defgroup cap_put_frame */
/*!\defgroup cap_put_slice Slice-Based Decoding Functions
*
* The following functions are required to be implemented for all decoders
* that advertise the AOM_CODEC_CAP_PUT_SLICE capability. Calling these
* functions
* for codecs that don't advertise this capability will result in an error
* code being returned, usually AOM_CODEC_ERROR
* @{
*/
/*!\brief put slice callback prototype
*
* This callback is invoked by the decoder to notify the application of
* the availability of partially decoded image data. The
*/
typedef void (*aom_codec_put_slice_cb_fn_t)(void *user_priv,
const aom_image_t *img,
const aom_image_rect_t *valid,
const aom_image_rect_t *update);
/*!\brief Register for notification of slice completion.
*
* Registers a given function to be called when a decoded slice is
* available.
*
* \param[in] ctx Pointer to this instance's context
* \param[in] cb Pointer to the callback function
* \param[in] user_priv User's private data
*
* \retval #AOM_CODEC_OK
* Callback successfully registered.
* \retval #AOM_CODEC_ERROR
* Decoder context not initialized, or algorithm not capable of
* posting slice completion.
*/
aom_codec_err_t aom_codec_register_put_slice_cb(aom_codec_ctx_t *ctx,
aom_codec_put_slice_cb_fn_t cb,
void *user_priv);
/*!@} - end defgroup cap_put_slice*/
/*!\defgroup cap_external_frame_buffer External Frame Buffer Functions
*
* The following section is required to be implemented for all decoders
* The following function is required to be implemented for all decoders
* that advertise the AOM_CODEC_CAP_EXTERNAL_FRAME_BUFFER capability.
* Calling this function for codecs that don't advertise this capability
* will result in an error code being returned, usually AOM_CODEC_ERROR.
*
* \note
* Currently this only works with AV1.
* will result in an error code being returned, usually AOM_CODEC_INCAPABLE.
* @{
*/
@ -328,13 +236,13 @@ aom_codec_err_t aom_codec_register_put_slice_cb(aom_codec_ctx_t *ctx,
* \retval #AOM_CODEC_INVALID_PARAM
* One or more of the callbacks were NULL.
* \retval #AOM_CODEC_ERROR
* Decoder context not initialized, or algorithm not capable of
* using external frame buffers.
* Decoder context not initialized.
* \retval #AOM_CODEC_INCAPABLE
* Algorithm not capable of using external frame buffers.
*
* \note
* When decoding AV1, the application may be required to pass in at least
* #AOM_MAXIMUM_WORK_BUFFERS external frame
* buffers.
* #AOM_MAXIMUM_WORK_BUFFERS external frame buffers.
*/
aom_codec_err_t aom_codec_set_frame_buffer_functions(
aom_codec_ctx_t *ctx, aom_get_frame_buffer_cb_fn_t cb_get,

View file

@ -41,7 +41,7 @@ extern "C" {
* fields to structures
*/
#define AOM_ENCODER_ABI_VERSION \
(6 + AOM_CODEC_ABI_VERSION) /**<\hideinitializer*/
(8 + AOM_CODEC_ABI_VERSION) /**<\hideinitializer*/
/*! \brief Encoder capabilities bitfield
*
@ -78,13 +78,6 @@ typedef struct aom_fixed_buf {
size_t sz; /**< Length of the buffer, in chars */
} aom_fixed_buf_t; /**< alias for struct aom_fixed_buf */
/*!\brief Time Stamp Type
*
* An integer, which when multiplied by the stream's time base, provides
* the absolute time of a sample.
*/
typedef int64_t aom_codec_pts_t;
/*!\brief Compressed Frame Flags
*
* This type represents a bitfield containing information about a compressed
@ -209,6 +202,154 @@ enum aom_kf_mode {
AOM_KF_DISABLED = 0 /**< Encoder does not place keyframes. */
};
/*!\brief Encoder Config Options
*
* This type allows to enumerate and control flags defined for encoder control
* via config file at runtime.
*/
typedef struct cfg_options {
/*!\brief Indicate init by cfg file
* 0 or 1
*/
unsigned int init_by_cfg_file;
/*!\brief Superblock size
* 0, 64 or 128
*/
unsigned int super_block_size;
/*!\brief max partition size
* 8, 16, 32, 64, 128
*/
unsigned int max_partition_size;
/*!\brief min partition size
* 8, 16, 32, 64, 128
*/
unsigned int min_partition_size;
/*!\brief disable AB Shape partition type
*
*/
unsigned int disable_ab_partition_type;
/*!\brief disable rectangular partition type
*
*/
unsigned int disable_rect_partition_type;
/*!\brief disable 1:4/4:1 partition type
*
*/
unsigned int disable_1to4_partition_type;
/*!\brief disable flip and identity transform type
*
*/
unsigned int disable_flip_idtx;
/*!\brief disable CDEF filter
*
*/
unsigned int disable_cdef;
/*!\brief disable Loop Restoration Filter
*
*/
unsigned int disable_lr;
/*!\brief disable OBMC
*
*/
unsigned int disable_obmc;
/*!\brief disable Warped Motion
*
*/
unsigned int disable_warp_motion;
/*!\brief disable global motion
*
*/
unsigned int disable_global_motion;
/*!\brief disable dist weighted compound
*
*/
unsigned int disable_dist_wtd_comp;
/*!\brief disable diff weighted compound
*
*/
unsigned int disable_diff_wtd_comp;
/*!\brief disable inter/intra compound
*
*/
unsigned int disable_inter_intra_comp;
/*!\brief disable masked compound
*
*/
unsigned int disable_masked_comp;
/*!\brief disable one sided compound
*
*/
unsigned int disable_one_sided_comp;
/*!\brief disable Palette
*
*/
unsigned int disable_palette;
/*!\brief disable Intra Block Copy
*
*/
unsigned int disable_intrabc;
/*!\brief disable chroma from luma
*
*/
unsigned int disable_cfl;
/*!\brief disable intra smooth mode
*
*/
unsigned int disable_smooth_intra;
/*!\brief disable filter intra
*
*/
unsigned int disable_filter_intra;
/*!\brief disable dual filter
*
*/
unsigned int disable_dual_filter;
/*!\brief disable intra angle delta
*
*/
unsigned int disable_intra_angle_delta;
/*!\brief disable intra edge filter
*
*/
unsigned int disable_intra_edge_filter;
/*!\brief disable 64x64 transform
*
*/
unsigned int disable_tx_64x64;
/*!\brief disable smooth inter/intra
*
*/
unsigned int disable_smooth_inter_intra;
/*!\brief disable inter/inter wedge comp
*
*/
unsigned int disable_inter_inter_wedge;
/*!\brief disable inter/intra wedge comp
*
*/
unsigned int disable_inter_intra_wedge;
/*!\brief disable paeth intra
*
*/
unsigned int disable_paeth_intra;
/*!\brief disable trellis quantization
*
*/
unsigned int disable_trellis_quant;
/*!\brief disable ref frame MV
*
*/
unsigned int disable_ref_frame_mv;
/*!\brief use reduced reference frame set
*
*/
unsigned int reduced_reference_set;
/*!\brief use reduced transform type set
*
*/
unsigned int reduced_tx_type_set;
} cfg_options_t;
/*!\brief Encoded Frame Flags
*
* This type indicates a bitfield to be passed to aom_codec_encode(), defining
@ -723,6 +864,47 @@ typedef struct aom_codec_enc_cfg {
* The number of heights specified is given by tile_height_count
*/
int tile_heights[MAX_TILE_HEIGHTS];
/*!\brief Whether encoder should use fixed QP offsets.
*
* If a value of 1 is provided, encoder will use fixed QP offsets for frames
* at different levels of the pyramid.
* - If 'fixed_qp_offsets' is also provided, encoder will use the given
* offsets
* - If not, encoder will select the fixed offsets based on the cq-level
* provided.
* If a value of 0 is provided and fixed_qp_offset are not provided, encoder
* will NOT use fixed QP offsets.
* Note: This option is only relevant for --end-usage=q.
*/
unsigned int use_fixed_qp_offsets;
/*!\brief Number of fixed QP offsets
*
* This defines the number of elements in the fixed_qp_offsets array.
*/
#define FIXED_QP_OFFSET_COUNT 5
/*!\brief Array of fixed QP offsets
*
* This array specifies fixed QP offsets (range: 0 to 63) for frames at
* different levels of the pyramid. It is a comma-separated list of 5 values:
* - QP offset for keyframe
* - QP offset for ALTREF frame
* - QP offset for 1st level internal ARF
* - QP offset for 2nd level internal ARF
* - QP offset for 3rd level internal ARF
* Notes:
* - QP offset for leaf level frames is not explicitly specified. These frames
* use the worst quality allowed (--cq-level).
* - This option is only relevant for --end-usage=q.
*/
int fixed_qp_offsets[FIXED_QP_OFFSET_COUNT];
/*!\brief Options defined per config file
*
*/
cfg_options_t encoder_cfg;
} aom_codec_enc_cfg_t; /**< alias for struct aom_codec_enc_cfg */
/*!\brief Initialize an encoder instance
@ -759,41 +941,9 @@ aom_codec_err_t aom_codec_enc_init_ver(aom_codec_ctx_t *ctx,
#define aom_codec_enc_init(ctx, iface, cfg, flags) \
aom_codec_enc_init_ver(ctx, iface, cfg, flags, AOM_ENCODER_ABI_VERSION)
/*!\brief Initialize multi-encoder instance
/*!\brief Get the default configuration for a usage.
*
* Initializes multi-encoder context using the given interface.
* Applications should call the aom_codec_enc_init_multi convenience macro
* instead of this function directly, to ensure that the ABI version number
* parameter is properly initialized.
*
* \param[in] ctx Pointer to this instance's context.
* \param[in] iface Pointer to the algorithm interface to use.
* \param[in] cfg Configuration to use, if known.
* \param[in] num_enc Total number of encoders.
* \param[in] flags Bitfield of AOM_CODEC_USE_* flags
* \param[in] dsf Pointer to down-sampling factors.
* \param[in] ver ABI version number. Must be set to
* AOM_ENCODER_ABI_VERSION
* \retval #AOM_CODEC_OK
* The decoder algorithm initialized.
* \retval #AOM_CODEC_MEM_ERROR
* Memory allocation failed.
*/
aom_codec_err_t aom_codec_enc_init_multi_ver(
aom_codec_ctx_t *ctx, aom_codec_iface_t *iface, aom_codec_enc_cfg_t *cfg,
int num_enc, aom_codec_flags_t flags, aom_rational_t *dsf, int ver);
/*!\brief Convenience macro for aom_codec_enc_init_multi_ver()
*
* Ensures the ABI version parameter is properly set.
*/
#define aom_codec_enc_init_multi(ctx, iface, cfg, num_enc, flags, dsf) \
aom_codec_enc_init_multi_ver(ctx, iface, cfg, num_enc, flags, dsf, \
AOM_ENCODER_ABI_VERSION)
/*!\brief Get a default configuration
*
* Initializes a encoder configuration structure with default values. Supports
* Initializes an encoder configuration structure with default values. Supports
* the notion of "usages" so that an algorithm may offer different default
* settings depending on the user's intended goal. This function \ref SHOULD
* be called by all applications to initialize the configuration structure
@ -801,7 +951,9 @@ aom_codec_err_t aom_codec_enc_init_multi_ver(
*
* \param[in] iface Pointer to the algorithm interface to use.
* \param[out] cfg Configuration buffer to populate.
* \param[in] reserved Must set to 0.
* \param[in] usage Algorithm specific usage value. For AV1, must be
* set to AOM_USAGE_GOOD_QUALITY (0) or
* AOM_USAGE_REALTIME (1).
*
* \retval #AOM_CODEC_OK
* The configuration was populated.
@ -812,7 +964,7 @@ aom_codec_err_t aom_codec_enc_init_multi_ver(
*/
aom_codec_err_t aom_codec_enc_config_default(aom_codec_iface_t *iface,
aom_codec_enc_cfg_t *cfg,
unsigned int reserved);
unsigned int usage);
/*!\brief Set or change configuration
*

View file

@ -30,7 +30,7 @@ extern "C" {
* types, removing or reassigning enums, adding/removing/rearranging
* fields to structures
*/
#define AOM_IMAGE_ABI_VERSION (6) /**<\hideinitializer*/
#define AOM_IMAGE_ABI_VERSION (9) /**<\hideinitializer*/
#define AOM_IMG_FMT_PLANAR 0x100 /**< Image is a planar format. */
#define AOM_IMG_FMT_UV_FLIP 0x200 /**< V plane precedes U in memory. */
@ -137,14 +137,34 @@ typedef enum aom_chroma_sample_position {
AOM_CSP_RESERVED = 3 /**< Reserved value */
} aom_chroma_sample_position_t; /**< alias for enum aom_transfer_function */
/*!\brief List of insert flags for Metadata
*
* These flags control how the library treats metadata during encode.
*
* While encoding, when metadata is added to an aom_image via
* aom_img_add_metadata(), the flag passed along with the metadata will
* determine where the metadata OBU will be placed in the encoded OBU stream.
* Metadata will be emitted into the output stream within the next temporal unit
* if it satisfies the specified insertion flag.
*
* During decoding, when the library encounters a metadata OBU, it is always
* flagged as AOM_MIF_ANY_FRAME and emitted with the next output aom_image.
*/
typedef enum aom_metadata_insert_flags {
AOM_MIF_NON_KEY_FRAME = 0, /**< Adds metadata if it's not keyframe */
AOM_MIF_KEY_FRAME = 1, /**< Adds metadata only if it's a keyframe */
AOM_MIF_ANY_FRAME = 2 /**< Adds metadata to any type of frame */
} aom_metadata_insert_flags_t;
/*!\brief Array of aom_metadata structs for an image. */
typedef struct aom_metadata_array aom_metadata_array_t;
/*!\brief Metadata payload. */
typedef struct aom_metadata {
uint8_t type; /**< Metadata type */
uint8_t *payload; /**< Metadata payload data */
size_t sz; /**< Metadata payload size */
uint32_t type; /**< Metadata type */
uint8_t *payload; /**< Metadata payload data */
size_t sz; /**< Metadata payload size */
aom_metadata_insert_flags_t insert_flag; /**< Metadata insertion flag */
} aom_metadata_t;
/**\brief Image Descriptor */
@ -204,14 +224,6 @@ typedef struct aom_image {
void *fb_priv; /**< Frame buffer data associated with the image. */
} aom_image_t; /**< alias for struct aom_image */
/**\brief Representation of a rectangle on a surface */
typedef struct aom_image_rect {
unsigned int x; /**< leftmost column */
unsigned int y; /**< topmost row */
unsigned int w; /**< width */
unsigned int h; /**< height */
} aom_image_rect_t; /**< alias for struct aom_image_rect */
/*!\brief Open a descriptor, allocating storage for the underlying image
*
* Returns a descriptor for storing an image of the given format. The
@ -341,39 +353,67 @@ int aom_img_plane_height(const aom_image_t *img, int plane);
*
* Adds metadata to aom_image_t.
* Function makes a copy of the provided data parameter.
* Metadata insertion point is controlled by insert_flag.
*
* \param[in] img Image descriptor
* \param[in] type Metadata type
* \param[in] data Metadata contents
* \param[in] sz Metadata contents size
* \param[in] img Image descriptor
* \param[in] type Metadata type
* \param[in] data Metadata contents
* \param[in] sz Metadata contents size
* \param[in] insert_flag Metadata insert flag
*/
int aom_img_add_metadata(aom_image_t *img, uint8_t type, uint8_t *data,
size_t sz);
int aom_img_add_metadata(aom_image_t *img, uint32_t type, const uint8_t *data,
size_t sz, aom_metadata_insert_flags_t insert_flag);
/*!\brief Return a metadata payload stored within the image metadata array.
*
* Gets the metadata (aom_metadata_t) at the indicated index in the image
* metadata array.
*
* \param[in] img Pointer to image descriptor to get metadata from
* \param[in] index Metadata index to get from metadata array
*
* \return Returns a const pointer to the selected metadata, if img and/or index
* is invalid, it returns NULL.
*/
const aom_metadata_t *aom_img_get_metadata(const aom_image_t *img,
size_t index);
/*!\brief Return the number of metadata blocks within the image.
*
* Gets the number of metadata blocks contained within the provided image
* metadata array.
*
* \param[in] img Pointer to image descriptor to get metadata number
* from.
*
* \return Returns the size of the metadata array. If img or metadata is NULL,
* it returns 0.
*/
size_t aom_img_num_metadata(const aom_image_t *img);
/*!\brief Remove metadata from image.
*
* Removes all metadata in image metadata list and sets metadata list pointer
* to NULL.
* Returns the number of deleted metadata structs.
*
* \param[in] img Image descriptor
*/
size_t aom_img_remove_metadata(aom_image_t *img);
void aom_img_remove_metadata(aom_image_t *img);
/*!\brief Allocate memory for aom_metadata struct.
*
* Allocates memory for aom_metadata struct and sets its type. Optionally
* allocates storage for the metadata payload and copies the payload data
* into the aom_metadata struct:
* - When sz is > 0 and data is NULL, allocates metadata payload buffer of sz.
* - When sz is > 0 and data is non-NULL, a metadata payload buffer of sz
* is allocated and sz bytes are copied from data into the payload buffer.
* Allocates storage for the metadata payload, sets its type and copies the
* payload data into the aom_metadata struct. A metadata payload buffer of size
* sz is allocated and sz bytes are copied from data into the payload buffer.
*
* \param[in] type Metadata type
* \param[in] data Metadata data pointer
* \param[in] sz Metadata size
* \param[in] type Metadata type
* \param[in] data Metadata data pointer
* \param[in] sz Metadata size
* \param[in] insert_flag Metadata insert flag
*/
aom_metadata_t *aom_img_metadata_alloc(uint8_t type, uint8_t *data, size_t sz);
aom_metadata_t *aom_img_metadata_alloc(uint32_t type, const uint8_t *data,
size_t sz,
aom_metadata_insert_flags_t insert_flag);
/*!\brief Free metadata struct.
*
@ -381,7 +421,7 @@ aom_metadata_t *aom_img_metadata_alloc(uint8_t type, uint8_t *data, size_t sz);
*
* \param[in] metadata Metadata struct pointer
*/
int aom_img_metadata_free(aom_metadata_t *metadata);
void aom_img_metadata_free(aom_metadata_t *metadata);
#ifdef __cplusplus
} // extern "C"

View file

@ -19,7 +19,6 @@
#define AOM_INLINE __inline
#else
#define AOM_FORCE_INLINE __inline__ __attribute__((always_inline))
// TODO(jbb): Allow a way to force inline off for older compilers.
#define AOM_INLINE inline
#endif
@ -72,8 +71,6 @@ typedef size_t uintptr_t;
#define INT32_MIN (-2147483647 - 1)
#endif
#define NELEMENTS(x) (int)(sizeof(x) / sizeof(x[0]))
#if defined(__cplusplus)
extern "C" {
#endif // __cplusplus

File diff suppressed because it is too large Load diff

View file

@ -106,149 +106,195 @@ typedef struct av1_ext_ref_frame {
* This set of macros define the control functions available for the AOM
* decoder interface.
*
* \sa #aom_codec_control
* \sa #aom_codec_control(aom_codec_ctx_t *ctx, int ctrl_id, ...)
*/
enum aom_dec_control_id {
/** control function to get info on which reference frames were updated
* by the last decode
/*!\brief Codec control function to get info on which reference frames were
* updated by the last decode, int* parameter
*/
AOMD_GET_LAST_REF_UPDATES = AOM_DECODER_CTRL_ID_START,
/** check if the indicated frame is corrupted */
/*!\brief Codec control function to check if the indicated frame is
corrupted, int* parameter
*/
AOMD_GET_FRAME_CORRUPTED,
/** control function to get info on which reference frames were used
* by the last decode
/*!\brief Codec control function to get info on which reference frames were
* used by the last decode, int* parameter
*/
AOMD_GET_LAST_REF_USED,
/** control function to get the dimensions that the current frame is decoded
* at. This may be different to the intended display size for the frame as
* specified in the wrapper or frame header (see AV1D_GET_DISPLAY_SIZE). */
/*!\brief Codec control function to get the dimensions that the current
* frame is decoded at, int* parameter. This may be different to the
* intended display size for the frame as specified in the wrapper or frame
* header (see AV1D_GET_DISPLAY_SIZE).
*/
AV1D_GET_FRAME_SIZE,
/** control function to get the current frame's intended display dimensions
* (as specified in the wrapper or frame header). This may be different to
* the decoded dimensions of this frame (see AV1D_GET_FRAME_SIZE). */
/*!\brief Codec control function to get the current frame's intended display
* dimensions (as specified in the wrapper or frame header), int* parameter.
* This may be different to the decoded dimensions of this frame (see
* AV1D_GET_FRAME_SIZE).
*/
AV1D_GET_DISPLAY_SIZE,
/** control function to get the bit depth of the stream. */
/*!\brief Codec control function to get the bit depth of the stream,
* unsigned int* parameter
*/
AV1D_GET_BIT_DEPTH,
/** control function to get the image format of the stream. */
/*!\brief Codec control function to get the image format of the stream,
* aom_img_fmt_t* parameter
*/
AV1D_GET_IMG_FORMAT,
/** control function to get the size of the tile. */
/*!\brief Codec control function to get the size of the tile, unsigned int
parameter */
AV1D_GET_TILE_SIZE,
/** control function to get the tile count in a tile list. */
/*!\brief Codec control function to get the tile count in a tile list, int*
* parameter
*/
AV1D_GET_TILE_COUNT,
/** control function to set the byte alignment of the planes in the reference
* buffers. Valid values are power of 2, from 32 to 1024. A value of 0 sets
/*!\brief Codec control function to set the byte alignment of the planes in
* the reference buffers, int parameter
*
* Valid values are power of 2, from 32 to 1024. A value of 0 sets
* legacy alignment. I.e. Y plane is aligned to 32 bytes, U plane directly
* follows Y plane, and V plane directly follows U plane. Default value is 0.
*/
AV1_SET_BYTE_ALIGNMENT,
/** control function to invert the decoding order to from right to left. The
* function is used in a test to confirm the decoding independence of tile
/*!\brief Codec control function to invert the decoding order to from right to
* left, int parameter
*
* The function is used in a test to confirm the decoding independence of tile
* columns. The function may be used in application where this order
* of decoding is desired.
* of decoding is desired. int parameter
*
* TODO(yaowu): Rework the unit test that uses this control, and in a future
* release, this test-only control shall be removed.
*/
AV1_INVERT_TILE_DECODE_ORDER,
/** control function to set the skip loop filter flag. Valid values are
* integers. The decoder will skip the loop filter when its value is set to
* nonzero. If the loop filter is skipped the decoder may accumulate decode
* artifacts. The default value is 0.
/*!\brief Codec control function to set the skip loop filter flag, int
* parameter
*
* Valid values are integers. The decoder will skip the loop filter
* when its value is set to nonzero. If the loop filter is skipped the
* decoder may accumulate decode artifacts. The default value is 0.
*/
AV1_SET_SKIP_LOOP_FILTER,
/** control function to retrieve a pointer to the Accounting struct. When
* compiled without --enable-accounting, this returns AOM_CODEC_INCAPABLE.
/*!\brief Codec control function to retrieve a pointer to the Accounting
* struct, takes Accounting** as parameter
*
* If called before a frame has been decoded, this returns AOM_CODEC_ERROR.
* The caller should ensure that AOM_CODEC_OK is returned before attempting
* to dereference the Accounting pointer.
*
* \attention When compiled without --enable-accounting, this returns
* AOM_CODEC_INCAPABLE.
*/
AV1_GET_ACCOUNTING,
/** control function to get last decoded frame quantizer. Returned value uses
* internal quantizer scale defined by the codec.
/*!\brief Codec control function to get last decoded frame quantizer,
* int* parameter
*
* Returned value uses internal quantizer scale defined by the codec.
*/
AOMD_GET_LAST_QUANTIZER,
/** control function to set the range of tile decoding. A value that is
* greater and equal to zero indicates only the specific row/column is
* decoded. A value that is -1 indicates the whole row/column is decoded.
* A special case is both values are -1 that means the whole frame is
* decoded.
/*!\brief Codec control function to set the range of tile decoding, int
* parameter
*
* A value that is greater and equal to zero indicates only the specific
* row/column is decoded. A value that is -1 indicates the whole row/column
* is decoded. A special case is both values are -1 that means the whole
* frame is decoded.
*/
AV1_SET_DECODE_TILE_ROW,
AV1_SET_DECODE_TILE_COL,
/** control function to set the tile coding mode. A value that is equal to
* zero indicates the tiles are coded in normal tile mode. A value that is
* 1 indicates the tiles are coded in large-scale tile mode.
/*!\brief Codec control function to set the tile coding mode, int parameter
*
* - 0 = tiles are coded in normal tile mode
* - 1 = tiles are coded in large-scale tile mode
*/
AV1_SET_TILE_MODE,
/** control function to get the frame header information of an encoded frame
* in the bitstream. This provides a way to access a frame's header data.
/*!\brief Codec control function to get the frame header information of an
* encoded frame, unsigned int* parameter
*/
AV1D_GET_FRAME_HEADER_INFO,
/** control function to get the start address and size of a tile in the coded
* bitstream. This provides a way to access a specific tile's bitstream data.
/*!\brief Codec control function to get the start address and size of a
* tile in the coded bitstream, aom_tile_data* parameter.
*/
AV1D_GET_TILE_DATA,
/** control function to set the external references' pointers in the decoder.
* This is used while decoding the tile list OBU in large-scale tile coding
* mode.
/*!\brief Codec control function to set the external references' pointers in
* the decoder, av1_ext_ref_frame_t* parameter.
*
* This is used while decoding the tile list OBU in large-scale tile coding
* mode.
*/
AV1D_SET_EXT_REF_PTR,
/** control function to enable the ext-tile software debug and testing code in
* the decoder.
/*!\brief Codec control function to enable the ext-tile software debug and
* testing code in the decoder, unsigned int parameter
*/
AV1D_EXT_TILE_DEBUG,
/** control function to enable the row based multi-threading of decoding. A
* value that is equal to 1 indicates that row based multi-threading is
* enabled.
/*!\brief Codec control function to enable the row based multi-threading of
* decoding, unsigned int parameter
*
* - 0 = disabled
* - 1 = enabled (default)
*/
AV1D_SET_ROW_MT,
/** control function to indicate whether bitstream is in Annex-B format. */
/*!\brief Codec control function to indicate whether bitstream is in
* Annex-B format, unsigned int parameter
*/
AV1D_SET_IS_ANNEXB,
/** control function to indicate which operating point to use. A scalable
* stream may define multiple operating points, each of which defines a
* set of temporal and spatial layers to be processed. The operating point
* index may take a value between 0 and operating_points_cnt_minus_1 (which
* is at most 31).
/*!\brief Codec control function to indicate which operating point to use,
* int parameter
*
* A scalable stream may define multiple operating points, each of which
* defines a set of temporal and spatial layers to be processed. The
* operating point index may take a value between 0 and
* operating_points_cnt_minus_1 (which is at most 31).
*/
AV1D_SET_OPERATING_POINT,
/** control function to indicate whether to output one frame per temporal
* unit (the default), or one frame per spatial layer.
* In a scalable stream, each temporal unit corresponds to a single "frame"
* of video, and within a temporal unit there may be multiple spatial layers
* with different versions of that frame.
* For video playback, only the highest-quality version (within the
* selected operating point) is needed, but for some use cases it is useful
* to have access to multiple versions of a frame when they are available.
/*!\brief Codec control function to indicate whether to output one frame per
* temporal unit (the default), or one frame per spatial layer. int parameter
*
* In a scalable stream, each temporal unit corresponds to a single "frame"
* of video, and within a temporal unit there may be multiple spatial layers
* with different versions of that frame.
* For video playback, only the highest-quality version (within the
* selected operating point) is needed, but for some use cases it is useful
* to have access to multiple versions of a frame when they are available.
*/
AV1D_SET_OUTPUT_ALL_LAYERS,
/** control function to set an aom_inspect_cb callback that is invoked each
* time a frame is decoded. When compiled without --enable-inspection, this
/*!\brief Codec control function to set an aom_inspect_cb callback that is
* invoked each time a frame is decoded, aom_inspect_init* parameter
*
* \attention When compiled without --enable-inspection, this
* returns AOM_CODEC_INCAPABLE.
*/
AV1_SET_INSPECTION_CALLBACK,
/** control function to set the skip film grain flag. Valid values are
* integers. The decoder will skip the film grain when its value is set to
* nonzero. The default value is 0.
/*!\brief Codec control function to set the skip film grain flag, int
* parameter
*
* Valid values are integers. The decoder will skip the film grain when its
* value is set to nonzero. The default value is 0.
*/
AV1D_SET_SKIP_FILM_GRAIN,
@ -258,59 +304,87 @@ enum aom_dec_control_id {
/*!\cond */
/*!\brief AOM decoder control function parameter type
*
* Defines the data types that AOMD control functions take. Note that
* additional common controls are defined in aom.h
* Defines the data types that AOMD control functions take.
*
* \note Additional common controls are defined in aom.h.
*
* \note For each control ID "X", a macro-define of
* AOM_CTRL_X is provided. It is used at compile time to determine
* if the control ID is supported by the libaom library available,
* when the libaom version cannot be controlled.
*/
AOM_CTRL_USE_TYPE(AOMD_GET_LAST_REF_UPDATES, int *)
#define AOM_CTRL_AOMD_GET_LAST_REF_UPDATES
AOM_CTRL_USE_TYPE(AOMD_GET_FRAME_CORRUPTED, int *)
#define AOM_CTRL_AOMD_GET_FRAME_CORRUPTED
AOM_CTRL_USE_TYPE(AOMD_GET_LAST_REF_USED, int *)
#define AOM_CTRL_AOMD_GET_LAST_REF_USED
AOM_CTRL_USE_TYPE(AOMD_GET_LAST_QUANTIZER, int *)
#define AOM_CTRL_AOMD_GET_LAST_QUANTIZER
AOM_CTRL_USE_TYPE(AV1D_GET_DISPLAY_SIZE, int *)
#define AOM_CTRL_AV1D_GET_DISPLAY_SIZE
AOM_CTRL_USE_TYPE(AV1D_GET_BIT_DEPTH, unsigned int *)
#define AOM_CTRL_AV1D_GET_BIT_DEPTH
AOM_CTRL_USE_TYPE(AV1D_GET_IMG_FORMAT, aom_img_fmt_t *)
#define AOM_CTRL_AV1D_GET_IMG_FORMAT
AOM_CTRL_USE_TYPE(AV1D_GET_TILE_SIZE, unsigned int *)
#define AOM_CTRL_AV1D_GET_TILE_SIZE
AOM_CTRL_USE_TYPE(AV1D_GET_TILE_COUNT, unsigned int *)
#define AOM_CTRL_AV1D_GET_TILE_COUNT
AOM_CTRL_USE_TYPE(AV1D_GET_FRAME_SIZE, int *)
#define AOM_CTRL_AV1D_GET_FRAME_SIZE
AOM_CTRL_USE_TYPE(AV1_INVERT_TILE_DECODE_ORDER, int)
#define AOM_CTRL_AV1_INVERT_TILE_DECODE_ORDER
AOM_CTRL_USE_TYPE(AV1_GET_ACCOUNTING, Accounting **)
#define AOM_CTRL_AV1_GET_ACCOUNTING
AOM_CTRL_USE_TYPE(AV1_SET_DECODE_TILE_ROW, int)
#define AOM_CTRL_AV1_SET_DECODE_TILE_ROW
AOM_CTRL_USE_TYPE(AV1_SET_DECODE_TILE_COL, int)
#define AOM_CTRL_AV1_SET_DECODE_TILE_COL
AOM_CTRL_USE_TYPE(AV1_SET_TILE_MODE, unsigned int)
#define AOM_CTRL_AV1_SET_TILE_MODE
AOM_CTRL_USE_TYPE(AV1D_GET_FRAME_HEADER_INFO, aom_tile_data *)
#define AOM_CTRL_AV1D_GET_FRAME_HEADER_INFO
AOM_CTRL_USE_TYPE(AV1D_GET_TILE_DATA, aom_tile_data *)
#define AOM_CTRL_AV1D_GET_TILE_DATA
AOM_CTRL_USE_TYPE(AV1D_SET_EXT_REF_PTR, av1_ext_ref_frame_t *)
#define AOM_CTRL_AV1D_SET_EXT_REF_PTR
AOM_CTRL_USE_TYPE(AV1D_EXT_TILE_DEBUG, unsigned int)
#define AOM_CTRL_AV1D_EXT_TILE_DEBUG
AOM_CTRL_USE_TYPE(AV1D_SET_ROW_MT, unsigned int)
#define AOM_CTRL_AV1D_SET_ROW_MT
AOM_CTRL_USE_TYPE(AV1D_SET_SKIP_FILM_GRAIN, int)
#define AOM_CTRL_AV1D_SET_SKIP_FILM_GRAIN
AOM_CTRL_USE_TYPE(AV1D_SET_IS_ANNEXB, unsigned int)
#define AOM_CTRL_AV1D_SET_IS_ANNEXB
AOM_CTRL_USE_TYPE(AV1D_SET_OPERATING_POINT, int)
#define AOM_CTRL_AV1D_SET_OPERATING_POINT
AOM_CTRL_USE_TYPE(AV1D_SET_OUTPUT_ALL_LAYERS, int)
#define AOM_CTRL_AV1D_SET_OUTPUT_ALL_LAYERS
AOM_CTRL_USE_TYPE(AV1_SET_INSPECTION_CALLBACK, aom_inspect_init *)
#define AOM_CTRL_AV1_SET_INSPECTION_CALLBACK
/*!\endcond */

View file

@ -1,5 +1,5 @@
text aom_codec_build_config
text aom_codec_control_
text aom_codec_control
text aom_codec_destroy
text aom_codec_err_to_string
text aom_codec_error
@ -15,10 +15,12 @@ text aom_img_alloc
text aom_img_alloc_with_border
text aom_img_flip
text aom_img_free
text aom_img_get_metadata
text aom_img_metadata_array_free
text aom_img_metadata_array_alloc
text aom_img_metadata_free
text aom_img_metadata_alloc
text aom_img_num_metadata
text aom_img_plane_height
text aom_img_plane_width
text aom_img_remove_metadata

View file

@ -3,8 +3,6 @@ text aom_codec_decode
text aom_codec_get_frame
text aom_codec_get_stream_info
text aom_codec_peek_stream_info
text aom_codec_register_put_frame_cb
text aom_codec_register_put_slice_cb
text aom_codec_set_frame_buffer_functions
text aom_obu_type_to_string
text aom_read_obu_header

View file

@ -1,6 +1,5 @@
text aom_codec_enc_config_default
text aom_codec_enc_config_set
text aom_codec_enc_init_multi_ver
text aom_codec_enc_init_ver
text aom_codec_encode
text aom_codec_get_cx_data

View file

@ -59,10 +59,9 @@ extern "C" {
* types, removing or reassigning enums, adding/removing/rearranging
* fields to structures
*/
#define AOM_CODEC_INTERNAL_ABI_VERSION (5) /**<\hideinitializer*/
#define AOM_CODEC_INTERNAL_ABI_VERSION (7) /**<\hideinitializer*/
typedef struct aom_codec_alg_priv aom_codec_alg_priv_t;
typedef struct aom_codec_priv_enc_mr_cfg aom_codec_priv_enc_mr_cfg_t;
/*!\brief init function pointer prototype
*
@ -77,8 +76,7 @@ typedef struct aom_codec_priv_enc_mr_cfg aom_codec_priv_enc_mr_cfg_t;
* \retval #AOM_CODEC_MEM_ERROR
* Memory operation failed.
*/
typedef aom_codec_err_t (*aom_codec_init_fn_t)(
aom_codec_ctx_t *ctx, aom_codec_priv_enc_mr_cfg_t *data);
typedef aom_codec_err_t (*aom_codec_init_fn_t)(aom_codec_ctx_t *ctx);
/*!\brief destroy function pointer prototype
*
@ -138,7 +136,7 @@ typedef aom_codec_err_t (*aom_codec_get_si_fn_t)(aom_codec_alg_priv_t *ctx,
* function, so plugins implementing this interface may trust the input
* parameters to be properly initialized. However, this interface does not
* provide type safety for the exchanged data or assign meanings to the
* control codes. Those details should be specified in the algorithm's
* control IDs. Those details should be specified in the algorithm's
* header file. In particular, the ctrl_id parameter is guaranteed to exist
* in the algorithm's control mapping table, and the data parameter may be NULL.
*
@ -171,17 +169,12 @@ typedef const struct aom_codec_ctrl_fn_map {
/*!\brief decode data function pointer prototype
*
* Processes a buffer of coded data. If the processing results in a new
* decoded frame becoming available, #AOM_CODEC_CB_PUT_SLICE and
* #AOM_CODEC_CB_PUT_FRAME events are generated as appropriate. This
* function is called by the generic aom_codec_decode() wrapper function,
* so plugins implementing this interface may trust the input parameters
* to be properly initialized.
* Processes a buffer of coded data. This function is called by the generic
* aom_codec_decode() wrapper function, so plugins implementing this interface
* may trust the input parameters to be properly initialized.
*
* \param[in] ctx Pointer to this instance's context
* \param[in] data Pointer to this block of new coded data. If
* NULL, a #AOM_CODEC_CB_PUT_FRAME event is posted
* for the previously decoded frame.
* \param[in] data Pointer to this block of new coded data.
* \param[in] data_sz Size of the coded data, in bytes.
*
* \return Returns #AOM_CODEC_OK if the coded data was processed completely
@ -259,24 +252,6 @@ typedef aom_fixed_buf_t *(*aom_codec_get_global_headers_fn_t)(
typedef aom_image_t *(*aom_codec_get_preview_frame_fn_t)(
aom_codec_alg_priv_t *ctx);
typedef aom_codec_err_t (*aom_codec_enc_mr_get_mem_loc_fn_t)(
const aom_codec_enc_cfg_t *cfg, void **mem_loc);
/*!\brief usage configuration mapping
*
* This structure stores the mapping between usage identifiers and
* configuration structures. Each algorithm provides a list of these
* mappings. This list is searched by the aom_codec_enc_config_default()
* wrapper function to determine which config to return. The special value
* {-1, {0}} is used to indicate end-of-list, and must be present. At least
* one mapping must be present, in addition to the end-of-list.
*
*/
typedef const struct aom_codec_enc_cfg_map {
int usage;
aom_codec_enc_cfg_t cfg;
} aom_codec_enc_cfg_map_t;
/*!\brief Decoder algorithm interface interface
*
* All decoders \ref MUST expose a variable of this type.
@ -297,10 +272,9 @@ struct aom_codec_iface {
aom_codec_set_fb_fn_t set_fb_fn; /**< \copydoc ::aom_codec_set_fb_fn_t */
} dec;
struct aom_codec_enc_iface {
int cfg_map_count;
aom_codec_enc_cfg_map_t
*cfg_maps; /**< \copydoc ::aom_codec_enc_cfg_map_t */
aom_codec_encode_fn_t encode; /**< \copydoc ::aom_codec_encode_fn_t */
int cfg_count;
const aom_codec_enc_cfg_t *cfgs; /**< \copydoc ::aom_codec_enc_cfg_t */
aom_codec_encode_fn_t encode; /**< \copydoc ::aom_codec_encode_fn_t */
aom_codec_get_cx_data_fn_t
get_cx_data; /**< \copydoc ::aom_codec_get_cx_data_fn_t */
aom_codec_enc_config_set_fn_t
@ -309,20 +283,9 @@ struct aom_codec_iface {
get_glob_hdrs; /**< \copydoc ::aom_codec_get_global_headers_fn_t */
aom_codec_get_preview_frame_fn_t
get_preview; /**< \copydoc ::aom_codec_get_preview_frame_fn_t */
aom_codec_enc_mr_get_mem_loc_fn_t
mr_get_mem_loc; /**< \copydoc ::aom_codec_enc_mr_get_mem_loc_fn_t */
} enc;
};
/*!\brief Callback function pointer / user data pair storage */
typedef struct aom_codec_priv_cb_pair {
union {
aom_codec_put_frame_cb_fn_t put_frame;
aom_codec_put_slice_cb_fn_t put_slice;
} u;
void *user_priv;
} aom_codec_priv_cb_pair_t;
/*!\brief Instance private storage
*
* This structure is allocated by the algorithm's init function. It can be
@ -334,38 +297,15 @@ typedef struct aom_codec_priv_cb_pair {
struct aom_codec_priv {
const char *err_detail;
aom_codec_flags_t init_flags;
struct {
aom_codec_priv_cb_pair_t put_frame_cb;
aom_codec_priv_cb_pair_t put_slice_cb;
} dec;
struct {
aom_fixed_buf_t cx_data_dst_buf;
unsigned int cx_data_pad_before;
unsigned int cx_data_pad_after;
aom_codec_cx_pkt_t cx_data_pkt;
unsigned int total_encoders;
} enc;
};
/*
* Multi-resolution encoding internal configuration
*/
struct aom_codec_priv_enc_mr_cfg {
unsigned int mr_total_resolutions;
unsigned int mr_encoder_id;
struct aom_rational mr_down_sampling_factor;
void *mr_low_res_mode_info;
};
#undef AOM_CTRL_USE_TYPE
#define AOM_CTRL_USE_TYPE(id, typ) \
static AOM_INLINE typ id##__value(va_list args) { return va_arg(args, typ); }
#undef AOM_CTRL_USE_TYPE_DEPRECATED
#define AOM_CTRL_USE_TYPE_DEPRECATED(id, typ) \
static AOM_INLINE typ id##__value(va_list args) { return va_arg(args, typ); }
#define CAST(id, arg) id##__value(arg)
#define CAST(id, arg) va_arg((arg), aom_codec_control_type_##id)
/* CODEC_INTERFACE convenience macro
*

View file

@ -43,11 +43,10 @@ aom_metadata_array_t *aom_img_metadata_array_alloc(size_t sz);
/*!\brief Free metadata array struct.
*
* Free metadata array struct and all metadata structs inside.
* Returns the number of deleted metadata structs.
*
* \param[in] arr Metadata array struct pointer
*/
size_t aom_img_metadata_array_free(aom_metadata_array_t *arr);
void aom_img_metadata_array_free(aom_metadata_array_t *arr);
typedef void *(*aom_alloc_img_data_cb_fn_t)(void *priv, size_t size);

View file

@ -89,7 +89,7 @@ aom_codec_caps_t aom_codec_get_caps(aom_codec_iface_t *iface) {
return (iface) ? iface->caps : 0;
}
aom_codec_err_t aom_codec_control_(aom_codec_ctx_t *ctx, int ctrl_id, ...) {
aom_codec_err_t aom_codec_control(aom_codec_ctx_t *ctx, int ctrl_id, ...) {
aom_codec_err_t res;
if (!ctx || !ctrl_id)

View file

@ -34,9 +34,6 @@ aom_codec_err_t aom_codec_dec_init_ver(aom_codec_ctx_t *ctx,
res = AOM_CODEC_INVALID_PARAM;
else if (iface->abi_version != AOM_CODEC_INTERNAL_ABI_VERSION)
res = AOM_CODEC_ABI_MISMATCH;
else if ((flags & AOM_CODEC_USE_POSTPROC) &&
!(iface->caps & AOM_CODEC_CAP_POSTPROC))
res = AOM_CODEC_INCAPABLE;
else if (!(iface->caps & AOM_CODEC_CAP_DECODER))
res = AOM_CODEC_INCAPABLE;
else {
@ -47,7 +44,7 @@ aom_codec_err_t aom_codec_dec_init_ver(aom_codec_ctx_t *ctx,
ctx->init_flags = flags;
ctx->config.dec = cfg;
res = ctx->iface->init(ctx, NULL);
res = ctx->iface->init(ctx);
if (res) {
ctx->err_detail = ctx->priv ? ctx->priv->err_detail : NULL;
aom_codec_destroy(ctx);
@ -120,44 +117,6 @@ aom_image_t *aom_codec_get_frame(aom_codec_ctx_t *ctx, aom_codec_iter_t *iter) {
return img;
}
aom_codec_err_t aom_codec_register_put_frame_cb(aom_codec_ctx_t *ctx,
aom_codec_put_frame_cb_fn_t cb,
void *user_priv) {
aom_codec_err_t res;
if (!ctx || !cb)
res = AOM_CODEC_INVALID_PARAM;
else if (!ctx->iface || !ctx->priv ||
!(ctx->iface->caps & AOM_CODEC_CAP_PUT_FRAME))
res = AOM_CODEC_ERROR;
else {
ctx->priv->dec.put_frame_cb.u.put_frame = cb;
ctx->priv->dec.put_frame_cb.user_priv = user_priv;
res = AOM_CODEC_OK;
}
return SAVE_STATUS(ctx, res);
}
aom_codec_err_t aom_codec_register_put_slice_cb(aom_codec_ctx_t *ctx,
aom_codec_put_slice_cb_fn_t cb,
void *user_priv) {
aom_codec_err_t res;
if (!ctx || !cb)
res = AOM_CODEC_INVALID_PARAM;
else if (!ctx->iface || !ctx->priv ||
!(ctx->iface->caps & AOM_CODEC_CAP_PUT_SLICE))
res = AOM_CODEC_ERROR;
else {
ctx->priv->dec.put_slice_cb.u.put_slice = cb;
ctx->priv->dec.put_slice_cb.user_priv = user_priv;
res = AOM_CODEC_OK;
}
return SAVE_STATUS(ctx, res);
}
aom_codec_err_t aom_codec_set_frame_buffer_functions(
aom_codec_ctx_t *ctx, aom_get_frame_buffer_cb_fn_t cb_get,
aom_release_frame_buffer_cb_fn_t cb_release, void *cb_priv) {
@ -165,9 +124,10 @@ aom_codec_err_t aom_codec_set_frame_buffer_functions(
if (!ctx || !cb_get || !cb_release) {
res = AOM_CODEC_INVALID_PARAM;
} else if (!ctx->iface || !ctx->priv ||
!(ctx->iface->caps & AOM_CODEC_CAP_EXTERNAL_FRAME_BUFFER)) {
} else if (!ctx->iface || !ctx->priv) {
res = AOM_CODEC_ERROR;
} else if (!(ctx->iface->caps & AOM_CODEC_CAP_EXTERNAL_FRAME_BUFFER)) {
res = AOM_CODEC_INCAPABLE;
} else {
res = ctx->iface->dec.set_fb_fn(get_alg_priv(ctx), cb_get, cb_release,
cb_priv);

View file

@ -24,6 +24,8 @@
#include <limits.h>
#include <string.h>
#include "aom/aom_encoder.h"
#include "aom/internal/aom_codec_internal.h"
#define SAVE_STATUS(ctx, var) (ctx ? (ctx->err = var) : var)
@ -54,7 +56,7 @@ aom_codec_err_t aom_codec_enc_init_ver(aom_codec_ctx_t *ctx,
ctx->priv = NULL;
ctx->init_flags = flags;
ctx->config.enc = cfg;
res = ctx->iface->init(ctx, NULL);
res = ctx->iface->init(ctx);
if (res) {
ctx->err_detail = ctx->priv ? ctx->priv->err_detail : NULL;
@ -65,108 +67,35 @@ aom_codec_err_t aom_codec_enc_init_ver(aom_codec_ctx_t *ctx,
return SAVE_STATUS(ctx, res);
}
aom_codec_err_t aom_codec_enc_init_multi_ver(
aom_codec_ctx_t *ctx, aom_codec_iface_t *iface, aom_codec_enc_cfg_t *cfg,
int num_enc, aom_codec_flags_t flags, aom_rational_t *dsf, int ver) {
aom_codec_err_t res = AOM_CODEC_OK;
if (ver != AOM_ENCODER_ABI_VERSION)
res = AOM_CODEC_ABI_MISMATCH;
else if (!ctx || !iface || !cfg || (num_enc > 16 || num_enc < 1))
res = AOM_CODEC_INVALID_PARAM;
else if (iface->abi_version != AOM_CODEC_INTERNAL_ABI_VERSION)
res = AOM_CODEC_ABI_MISMATCH;
else if (!(iface->caps & AOM_CODEC_CAP_ENCODER))
res = AOM_CODEC_INCAPABLE;
else if ((flags & AOM_CODEC_USE_PSNR) && !(iface->caps & AOM_CODEC_CAP_PSNR))
res = AOM_CODEC_INCAPABLE;
else {
int i;
void *mem_loc = NULL;
if (!(res = iface->enc.mr_get_mem_loc(cfg, &mem_loc))) {
for (i = 0; i < num_enc; i++) {
aom_codec_priv_enc_mr_cfg_t mr_cfg;
/* Validate down-sampling factor. */
if (dsf->num < 1 || dsf->num > 4096 || dsf->den < 1 ||
dsf->den > dsf->num) {
res = AOM_CODEC_INVALID_PARAM;
break;
}
mr_cfg.mr_low_res_mode_info = mem_loc;
mr_cfg.mr_total_resolutions = num_enc;
mr_cfg.mr_encoder_id = num_enc - 1 - i;
mr_cfg.mr_down_sampling_factor.num = dsf->num;
mr_cfg.mr_down_sampling_factor.den = dsf->den;
/* Force Key-frame synchronization. Namely, encoder at higher
* resolution always use the same frame_type chosen by the
* lowest-resolution encoder.
*/
if (mr_cfg.mr_encoder_id) cfg->kf_mode = AOM_KF_DISABLED;
ctx->iface = iface;
ctx->name = iface->name;
ctx->priv = NULL;
ctx->init_flags = flags;
ctx->config.enc = cfg;
res = ctx->iface->init(ctx, &mr_cfg);
if (res) {
const char *error_detail = ctx->priv ? ctx->priv->err_detail : NULL;
/* Destroy current ctx */
ctx->err_detail = error_detail;
aom_codec_destroy(ctx);
/* Destroy already allocated high-level ctx */
while (i) {
ctx--;
ctx->err_detail = error_detail;
aom_codec_destroy(ctx);
i--;
}
}
if (res) break;
ctx++;
cfg++;
dsf++;
}
ctx--;
}
}
return SAVE_STATUS(ctx, res);
}
aom_codec_err_t aom_codec_enc_config_default(aom_codec_iface_t *iface,
aom_codec_enc_cfg_t *cfg,
unsigned int reserved) {
unsigned int usage) {
aom_codec_err_t res;
aom_codec_enc_cfg_map_t *map;
int i;
if (!iface || !cfg || reserved > INT_MAX)
if (!iface || !cfg)
res = AOM_CODEC_INVALID_PARAM;
else if (!(iface->caps & AOM_CODEC_CAP_ENCODER))
res = AOM_CODEC_INCAPABLE;
else {
res = AOM_CODEC_INVALID_PARAM;
for (i = 0; i < iface->enc.cfg_map_count; ++i) {
map = iface->enc.cfg_maps + i;
if (map->usage == (int)reserved) {
*cfg = map->cfg;
cfg->g_usage = reserved;
for (i = 0; i < iface->enc.cfg_count; ++i) {
if (iface->enc.cfgs[i].g_usage == usage) {
*cfg = iface->enc.cfgs[i];
res = AOM_CODEC_OK;
break;
}
}
}
/* default values */
if (cfg) {
memset(&cfg->encoder_cfg, 0, sizeof(cfg->encoder_cfg));
cfg->encoder_cfg.super_block_size = 0; // Dynamic
cfg->encoder_cfg.max_partition_size = 128;
cfg->encoder_cfg.min_partition_size = 4;
cfg->encoder_cfg.disable_trellis_quant = 3;
}
return res;
}
@ -219,38 +148,11 @@ aom_codec_err_t aom_codec_encode(aom_codec_ctx_t *ctx, const aom_image_t *img,
else if (!(ctx->iface->caps & AOM_CODEC_CAP_ENCODER))
res = AOM_CODEC_INCAPABLE;
else {
unsigned int num_enc = ctx->priv->enc.total_encoders;
/* Execute in a normalized floating point environment, if the platform
* requires it.
*/
FLOATING_POINT_INIT
if (num_enc == 1)
res =
ctx->iface->enc.encode(get_alg_priv(ctx), img, pts, duration, flags);
else {
/* Multi-resolution encoding:
* Encode multi-levels in reverse order. For example,
* if mr_total_resolutions = 3, first encode level 2,
* then encode level 1, and finally encode level 0.
*/
int i;
ctx += num_enc - 1;
if (img) img += num_enc - 1;
for (i = num_enc - 1; i >= 0; i--) {
if ((res = ctx->iface->enc.encode(get_alg_priv(ctx), img, pts, duration,
flags)))
break;
ctx--;
if (img) img--;
}
ctx++;
}
res = ctx->iface->enc.encode(get_alg_priv(ctx), img, pts, duration, flags);
FLOATING_POINT_RESTORE
}

View file

@ -288,30 +288,29 @@ int aom_img_plane_height(const aom_image_t *img, int plane) {
return img->d_h;
}
aom_metadata_t *aom_img_metadata_alloc(uint8_t type, uint8_t *data, size_t sz) {
aom_metadata_t *metadata =
(aom_metadata_t *)calloc(1, sizeof(aom_metadata_t));
aom_metadata_t *aom_img_metadata_alloc(
uint32_t type, const uint8_t *data, size_t sz,
aom_metadata_insert_flags_t insert_flag) {
if (!data || sz == 0) return NULL;
aom_metadata_t *metadata = (aom_metadata_t *)malloc(sizeof(aom_metadata_t));
if (!metadata) return NULL;
metadata->type = type;
if (sz > 0) {
metadata->payload = (uint8_t *)calloc(sz, sizeof(uint8_t));
if (!metadata->payload) {
free(metadata);
return NULL;
}
if (data) {
memcpy(metadata->payload, data, sz);
metadata->sz = sz;
}
metadata->payload = (uint8_t *)malloc(sz);
if (!metadata->payload) {
free(metadata);
return NULL;
}
memcpy(metadata->payload, data, sz);
metadata->sz = sz;
metadata->insert_flag = insert_flag;
return metadata;
}
int aom_img_metadata_free(aom_metadata_t *metadata) {
if (!metadata) return -1;
if (metadata->payload) free(metadata->payload);
free(metadata);
return 0;
void aom_img_metadata_free(aom_metadata_t *metadata) {
if (metadata) {
if (metadata->payload) free(metadata->payload);
free(metadata);
}
}
aom_metadata_array_t *aom_img_metadata_array_alloc(size_t sz) {
@ -330,29 +329,27 @@ aom_metadata_array_t *aom_img_metadata_array_alloc(size_t sz) {
return arr;
}
size_t aom_img_metadata_array_free(aom_metadata_array_t *arr) {
size_t deleted_metadatas = 0;
if (!arr) return deleted_metadatas;
if (arr->metadata_array) {
for (size_t i = 0; i < arr->sz; i++) {
if (aom_img_metadata_free(arr->metadata_array[i]) == 0) {
deleted_metadatas++;
void aom_img_metadata_array_free(aom_metadata_array_t *arr) {
if (arr) {
if (arr->metadata_array) {
for (size_t i = 0; i < arr->sz; i++) {
aom_img_metadata_free(arr->metadata_array[i]);
}
free(arr->metadata_array);
}
free(arr->metadata_array);
free(arr);
}
free(arr);
return deleted_metadatas;
}
int aom_img_add_metadata(aom_image_t *img, uint8_t type, uint8_t *data,
size_t sz) {
int aom_img_add_metadata(aom_image_t *img, uint32_t type, const uint8_t *data,
size_t sz, aom_metadata_insert_flags_t insert_flag) {
if (!img) return -1;
if (!img->metadata) {
img->metadata = aom_img_metadata_array_alloc(0);
if (!img->metadata) return -1;
}
aom_metadata_t *metadata = aom_img_metadata_alloc(type, data, sz);
aom_metadata_t *metadata =
aom_img_metadata_alloc(type, data, sz, insert_flag);
if (!metadata) goto fail;
if (!img->metadata->metadata_array) {
img->metadata->metadata_array =
@ -375,11 +372,24 @@ fail:
return -1;
}
size_t aom_img_remove_metadata(aom_image_t *img) {
void aom_img_remove_metadata(aom_image_t *img) {
if (img && img->metadata) {
size_t sz = aom_img_metadata_array_free(img->metadata);
aom_img_metadata_array_free(img->metadata);
img->metadata = NULL;
return sz;
}
return 0;
}
const aom_metadata_t *aom_img_get_metadata(const aom_image_t *img,
size_t index) {
if (!img) return NULL;
const aom_metadata_array_t *array = img->metadata;
if (array && index < array->sz) {
return array->metadata_array[index];
}
return NULL;
}
size_t aom_img_num_metadata(const aom_image_t *img) {
if (!img || !img->metadata) return 0;
return img->metadata->sz;
}

View file

@ -1,73 +0,0 @@
/*
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
* was not distributed with this source code in the LICENSE file, you can
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#include <math.h>
#include <stdlib.h>
#include "config/aom_config.h"
#include "config/aom_dsp_rtcd.h"
#include "aom/aom_integer.h"
#include "aom_ports/mem.h"
void aom_plane_add_noise_c(uint8_t *start, char *noise, char blackclamp[16],
char whiteclamp[16], char bothclamp[16],
unsigned int width, unsigned int height, int pitch) {
unsigned int i, j;
for (i = 0; i < height; ++i) {
uint8_t *pos = start + i * pitch;
char *ref = (char *)(noise + (rand() & 0xff)); // NOLINT
for (j = 0; j < width; ++j) {
int v = pos[j];
v = clamp(v - blackclamp[0], 0, 255);
v = clamp(v + bothclamp[0], 0, 255);
v = clamp(v - whiteclamp[0], 0, 255);
pos[j] = v + ref[j];
}
}
}
static double gaussian(double sigma, double mu, double x) {
return 1 / (sigma * sqrt(2.0 * PI)) *
(exp(-(x - mu) * (x - mu) / (2 * sigma * sigma)));
}
int aom_setup_noise(double sigma, int size, char *noise) {
char char_dist[256];
int next = 0, i, j;
// set up a 256 entry lookup that matches gaussian distribution
for (i = -32; i < 32; ++i) {
const int a_i = (int)(0.5 + 256 * gaussian(sigma, 0, i));
if (a_i) {
for (j = 0; j < a_i; ++j) {
char_dist[next + j] = (char)i;
}
next = next + j;
}
}
// Rounding error - might mean we have less than 256.
for (; next < 256; ++next) {
char_dist[next] = 0;
}
for (i = 0; i < size; ++i) {
noise[i] = char_dist[rand() & 0xff]; // NOLINT
}
// Returns the highest non 0 value used in distribution.
return -char_dist[0];
}

View file

@ -74,7 +74,6 @@ static void convolve_vert(const uint8_t *src, ptrdiff_t src_stride,
static const InterpKernel *get_filter_base(const int16_t *filter) {
// NOTE: This assumes that the filter table is 256-byte aligned.
// TODO(agrange) Modify to make independent of table alignment.
return (const InterpKernel *)(((intptr_t)filter) & ~((intptr_t)0xFF));
}

View file

@ -67,6 +67,7 @@ list(APPEND AOM_DSP_COMMON_INTRIN_SSE2
"${AOM_ROOT}/aom_dsp/x86/highbd_intrapred_sse2.c"
"${AOM_ROOT}/aom_dsp/x86/highbd_loopfilter_sse2.c"
"${AOM_ROOT}/aom_dsp/x86/intrapred_sse2.c"
"${AOM_ROOT}/aom_dsp/x86/intrapred_x86.h"
"${AOM_ROOT}/aom_dsp/x86/loopfilter_sse2.c"
"${AOM_ROOT}/aom_dsp/x86/lpf_common_sse2.h"
"${AOM_ROOT}/aom_dsp/x86/mem_sse2.h"
@ -154,10 +155,9 @@ if(CONFIG_AV1_DECODER)
list(APPEND AOM_DSP_DECODER_SOURCES
"${AOM_ROOT}/aom_dsp/binary_codes_reader.c"
"${AOM_ROOT}/aom_dsp/binary_codes_reader.h"
"${AOM_ROOT}/aom_dsp/bitreader.h"
"${AOM_ROOT}/aom_dsp/daalaboolreader.c"
"${AOM_ROOT}/aom_dsp/daalaboolreader.h"
"${AOM_ROOT}/aom_dsp/entdec.c" "${AOM_ROOT}/aom_dsp/entdec.h"
"${AOM_ROOT}/aom_dsp/bitreader.c"
"${AOM_ROOT}/aom_dsp/bitreader.h" "${AOM_ROOT}/aom_dsp/entdec.c"
"${AOM_ROOT}/aom_dsp/entdec.h"
"${AOM_ROOT}/aom_dsp/grain_synthesis.c"
"${AOM_ROOT}/aom_dsp/grain_synthesis.h")
endif()
@ -166,10 +166,9 @@ if(CONFIG_AV1_ENCODER)
list(APPEND AOM_DSP_ENCODER_SOURCES
"${AOM_ROOT}/aom_dsp/binary_codes_writer.c"
"${AOM_ROOT}/aom_dsp/binary_codes_writer.h"
"${AOM_ROOT}/aom_dsp/bitwriter.c"
"${AOM_ROOT}/aom_dsp/bitwriter.h"
"${AOM_ROOT}/aom_dsp/blk_sse_sum.c"
"${AOM_ROOT}/aom_dsp/daalaboolwriter.c"
"${AOM_ROOT}/aom_dsp/daalaboolwriter.h"
"${AOM_ROOT}/aom_dsp/entenc.c"
"${AOM_ROOT}/aom_dsp/entenc.h"
"${AOM_ROOT}/aom_dsp/fwd_txfm.c"
@ -254,6 +253,7 @@ if(CONFIG_AV1_ENCODER)
list(APPEND AOM_DSP_ENCODER_INTRIN_SSSE3
"${AOM_ROOT}/aom_dsp/x86/masked_sad_intrin_ssse3.h"
"${AOM_ROOT}/aom_dsp/x86/masked_sad_intrin_ssse3.c"
"${AOM_ROOT}/aom_dsp/x86/masked_sad4d_ssse3.c"
"${AOM_ROOT}/aom_dsp/x86/masked_variance_intrin_ssse3.h"
"${AOM_ROOT}/aom_dsp/x86/masked_variance_intrin_ssse3.c"
"${AOM_ROOT}/aom_dsp/x86/quantize_ssse3.c"
@ -277,7 +277,8 @@ if(CONFIG_AV1_ENCODER)
"${AOM_ROOT}/aom_dsp/arm/subpel_variance_neon.c"
"${AOM_ROOT}/aom_dsp/arm/variance_neon.c"
"${AOM_ROOT}/aom_dsp/arm/hadamard_neon.c"
"${AOM_ROOT}/aom_dsp/arm/avg_neon.c")
"${AOM_ROOT}/aom_dsp/arm/avg_neon.c"
"${AOM_ROOT}/aom_dsp/arm/sse_neon.c")
list(APPEND AOM_DSP_ENCODER_INTRIN_MSA "${AOM_ROOT}/aom_dsp/mips/sad_msa.c"
"${AOM_ROOT}/aom_dsp/mips/subtract_msa.c"
@ -289,6 +290,11 @@ if(CONFIG_AV1_ENCODER)
"${AOM_ROOT}/aom_dsp/psnrhvs.c" "${AOM_ROOT}/aom_dsp/ssim.c"
"${AOM_ROOT}/aom_dsp/ssim.h")
endif()
if(CONFIG_TUNE_VMAF)
list(APPEND AOM_DSP_ENCODER_SOURCES "${AOM_ROOT}/aom_dsp/vmaf.c"
"${AOM_ROOT}/aom_dsp/vmaf.h")
endif()
endif()
# Creates aom_dsp build targets. Must not be called until after libaom target
@ -299,6 +305,9 @@ function(setup_aom_dsp_targets)
create_dummy_source_file("aom_av1" "c" "dummy_source_file")
add_library(aom_dsp OBJECT "${dummy_source_file}")
target_sources(aom PRIVATE $<TARGET_OBJECTS:aom_dsp_common>)
if(BUILD_SHARED_LIBS)
target_sources(aom_static PRIVATE $<TARGET_OBJECTS:aom_dsp_common>)
endif()
list(APPEND AOM_LIB_TARGETS aom_dsp)
# Not all generators support libraries consisting only of object files. Add a
@ -309,96 +318,103 @@ function(setup_aom_dsp_targets)
add_library(aom_dsp_decoder OBJECT ${AOM_DSP_DECODER_SOURCES})
list(APPEND AOM_LIB_TARGETS aom_dsp_decoder)
target_sources(aom PRIVATE $<TARGET_OBJECTS:aom_dsp_decoder>)
if(BUILD_SHARED_LIBS)
target_sources(aom_static PRIVATE $<TARGET_OBJECTS:aom_dsp_decoder>)
endif()
endif()
if(CONFIG_AV1_ENCODER)
add_library(aom_dsp_encoder OBJECT ${AOM_DSP_ENCODER_SOURCES})
list(APPEND AOM_LIB_TARGETS aom_dsp_encoder)
target_sources(aom PRIVATE $<TARGET_OBJECTS:aom_dsp_encoder>)
if(BUILD_SHARED_LIBS)
target_sources(aom_static PRIVATE $<TARGET_OBJECTS:aom_dsp_encoder>)
endif()
endif()
if(HAVE_SSE2)
add_asm_library("aom_dsp_common_sse2" "AOM_DSP_COMMON_ASM_SSE2" "aom")
add_asm_library("aom_dsp_common_sse2" "AOM_DSP_COMMON_ASM_SSE2")
add_intrinsics_object_library("-msse2" "sse2" "aom_dsp_common"
"AOM_DSP_COMMON_INTRIN_SSE2" "aom")
"AOM_DSP_COMMON_INTRIN_SSE2")
if(CONFIG_AV1_ENCODER)
if("${AOM_TARGET_CPU}" STREQUAL "x86_64")
list(APPEND AOM_DSP_ENCODER_ASM_SSE2 ${AOM_DSP_ENCODER_ASM_SSE2_X86_64})
endif()
add_asm_library("aom_dsp_encoder_sse2" "AOM_DSP_ENCODER_ASM_SSE2" "aom")
add_asm_library("aom_dsp_encoder_sse2" "AOM_DSP_ENCODER_ASM_SSE2")
add_intrinsics_object_library("-msse2" "sse2" "aom_dsp_encoder"
"AOM_DSP_ENCODER_INTRIN_SSE2" "aom")
"AOM_DSP_ENCODER_INTRIN_SSE2")
endif()
endif()
if(HAVE_SSSE3)
add_asm_library("aom_dsp_common_ssse3" "AOM_DSP_COMMON_ASM_SSSE3" "aom")
add_asm_library("aom_dsp_common_ssse3" "AOM_DSP_COMMON_ASM_SSSE3")
add_intrinsics_object_library("-mssse3" "ssse3" "aom_dsp_common"
"AOM_DSP_COMMON_INTRIN_SSSE3" "aom")
"AOM_DSP_COMMON_INTRIN_SSSE3")
if(CONFIG_AV1_ENCODER)
if("${AOM_TARGET_CPU}" STREQUAL "x86_64")
list(APPEND AOM_DSP_ENCODER_ASM_SSSE3
${AOM_DSP_ENCODER_ASM_SSSE3_X86_64})
endif()
add_asm_library("aom_dsp_encoder_ssse3" "AOM_DSP_ENCODER_ASM_SSSE3" "aom")
add_asm_library("aom_dsp_encoder_ssse3" "AOM_DSP_ENCODER_ASM_SSSE3")
add_intrinsics_object_library("-mssse3" "ssse3" "aom_dsp_encoder"
"AOM_DSP_ENCODER_INTRIN_SSSE3" "aom")
"AOM_DSP_ENCODER_INTRIN_SSSE3")
endif()
endif()
if(HAVE_SSE4_1)
add_intrinsics_object_library("-msse4.1" "sse4_1" "aom_dsp_common"
"AOM_DSP_COMMON_INTRIN_SSE4_1" "aom")
"AOM_DSP_COMMON_INTRIN_SSE4_1")
if(CONFIG_AV1_ENCODER)
add_intrinsics_object_library("-msse4.1" "sse4_1" "aom_dsp_encoder"
"AOM_DSP_ENCODER_INTRIN_SSE4_1" "aom")
"AOM_DSP_ENCODER_INTRIN_SSE4_1")
endif()
endif()
if(HAVE_AVX AND "${AOM_TARGET_CPU}" STREQUAL "x86_64")
if(CONFIG_AV1_ENCODER)
add_asm_library("aom_dsp_encoder_avx" "AOM_DSP_ENCODER_AVX_ASM_X86_64"
"aom")
add_asm_library("aom_dsp_encoder_avx" "AOM_DSP_ENCODER_AVX_ASM_X86_64")
endif()
endif()
if(HAVE_AVX2)
add_intrinsics_object_library("-mavx2" "avx2" "aom_dsp_common"
"AOM_DSP_COMMON_INTRIN_AVX2" "aom")
"AOM_DSP_COMMON_INTRIN_AVX2")
if(CONFIG_AV1_ENCODER)
add_intrinsics_object_library("-mavx2" "avx2" "aom_dsp_encoder"
"AOM_DSP_ENCODER_INTRIN_AVX2" "aom")
"AOM_DSP_ENCODER_INTRIN_AVX2")
endif()
endif()
if(HAVE_NEON)
add_intrinsics_object_library("${AOM_NEON_INTRIN_FLAG}" "neon"
"aom_dsp_common" "AOM_DSP_COMMON_INTRIN_NEON"
"aom")
"aom_dsp_common" "AOM_DSP_COMMON_INTRIN_NEON")
if(CONFIG_AV1_ENCODER)
add_intrinsics_object_library("${AOM_NEON_INTRIN_FLAG}" "neon"
"aom_dsp_encoder"
"AOM_DSP_ENCODER_INTRIN_NEON" "aom")
"AOM_DSP_ENCODER_INTRIN_NEON")
endif()
endif()
if(HAVE_DSPR2)
add_intrinsics_object_library("" "dspr2" "aom_dsp_common"
"AOM_DSP_COMMON_INTRIN_DSPR2" "aom")
"AOM_DSP_COMMON_INTRIN_DSPR2")
endif()
if(HAVE_MSA)
add_intrinsics_object_library("" "msa" "aom_dsp_common"
"AOM_DSP_COMMON_INTRIN_MSA" "aom")
"AOM_DSP_COMMON_INTRIN_MSA")
if(CONFIG_AV1_ENCODER)
add_intrinsics_object_library("" "msa" "aom_dsp_encoder"
"AOM_DSP_ENCODER_INTRIN_MSA" "aom")
"AOM_DSP_ENCODER_INTRIN_MSA")
endif()
endif()
target_sources(aom PRIVATE $<TARGET_OBJECTS:aom_dsp>)
if(BUILD_SHARED_LIBS)
target_sources(aom_static PRIVATE $<TARGET_OBJECTS:aom_dsp>)
endif()
# Pass the new lib targets up to the parent scope instance of
# $AOM_LIB_TARGETS.

View file

@ -27,6 +27,9 @@ extern "C" {
#define AOMMIN(x, y) (((x) < (y)) ? (x) : (y))
#define AOMMAX(x, y) (((x) > (y)) ? (x) : (y))
#define AOMSIGN(x) ((x) < 0 ? -1 : 0)
#define NELEMENTS(x) (int)(sizeof(x) / sizeof(x[0]))
#define IMPLIES(a, b) (!(a) || (b)) // Logical 'a implies b' (or 'a -> b')

View file

@ -92,6 +92,7 @@ specialize qw/aom_dc_top_predictor_8x32 sse2/;
specialize qw/aom_dc_top_predictor_16x4 sse2/;
specialize qw/aom_dc_top_predictor_16x8 sse2/;
specialize qw/aom_dc_top_predictor_16x16 neon msa sse2/;
specialize qw/aom_dc_top_predictor_16x32 sse2/;
specialize qw/aom_dc_top_predictor_16x64 sse2/;
specialize qw/aom_dc_top_predictor_32x8 sse2/;
@ -480,8 +481,14 @@ if (aom_config("CONFIG_AV1_HIGHBITDEPTH") eq "yes") {
# Forward transform
#
if (aom_config("CONFIG_AV1_ENCODER") eq "yes"){
add_proto qw/void aom_fdct4x4/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/aom_fdct4x4 neon sse2/;
add_proto qw/void aom_fdct4x4_lp/, "const int16_t *input, int16_t *output, int stride";
specialize qw/aom_fdct4x4_lp neon sse2/;
add_proto qw/void aom_fdct8x8/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/aom_fdct8x8 sse2/, "$ssse3_x86_64";
specialize qw/aom_fdct8x8 neon sse2/, "$ssse3_x86_64";
# High bit depth
if (aom_config("CONFIG_AV1_HIGHBITDEPTH") eq "yes") {
add_proto qw/void aom_highbd_fdct8x8/, "const int16_t *input, tran_low_t *output, int stride";
@ -591,7 +598,7 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
specialize qw/aom_subtract_block neon msa sse2 avx2/;
add_proto qw/int64_t/, "aom_sse", "const uint8_t *a, int a_stride, const uint8_t *b,int b_stride, int width, int height";
specialize qw/aom_sse sse4_1 avx2/;
specialize qw/aom_sse sse4_1 avx2 neon/;
add_proto qw/void/, "aom_get_blk_sse_sum", "const int16_t *data, int stride, int bw, int bh, int *x_sum, int64_t *x2_sum";
specialize qw/aom_get_blk_sse_sum sse2 avx2/;
@ -601,7 +608,7 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
specialize qw/aom_highbd_subtract_block sse2/;
add_proto qw/int64_t/, "aom_highbd_sse", "const uint8_t *a8, int a_stride, const uint8_t *b8,int b_stride, int width, int height";
specialize qw/aom_highbd_sse sse4_1 avx2/;
specialize qw/aom_highbd_sse sse4_1 avx2 neon/;
}
if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
@ -613,6 +620,12 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
add_proto qw/uint64_t aom_sum_squares_i16/, "const int16_t *src, uint32_t N";
specialize qw/aom_sum_squares_i16 sse2/;
add_proto qw/uint64_t aom_var_2d_u8/, "uint8_t *src, int src_stride, int width, int height";
specialize qw/aom_var_2d_u8 sse2 avx2/;
add_proto qw/uint64_t aom_var_2d_u16/, "uint8_t *src, int src_stride, int width, int height";
specialize qw/aom_var_2d_u16 sse2 avx2/;
}
#
@ -810,6 +823,8 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
foreach (@block_sizes) {
($w, $h) = @$_;
add_proto qw/void/, "aom_sad${w}x${h}x4d", "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array";
add_proto qw/void/, "aom_sad${w}x${h}x4d_avg", "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, const uint8_t *second_pred, uint32_t *sad_array";
add_proto qw/void/, "aom_masked_sad${w}x${h}x4d", "const uint8_t *src, int src_stride, const uint8_t *ref[], int ref_stride, const uint8_t *second_pred, const uint8_t *msk, int msk_stride, int invert_mask, unsigned sads[]";
}
specialize qw/aom_sad128x128x4d avx2 sse2/;
@ -817,25 +832,87 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
specialize qw/aom_sad64x128x4d avx2 sse2/;
specialize qw/aom_sad64x64x4d avx2 neon msa sse2/;
specialize qw/aom_sad64x32x4d avx2 msa sse2/;
specialize qw/aom_sad64x16x4d avx2 sse2/;
specialize qw/aom_sad32x64x4d avx2 msa sse2/;
specialize qw/aom_sad32x32x4d avx2 neon msa sse2/;
specialize qw/aom_sad32x16x4d msa sse2/;
specialize qw/aom_sad32x16x4d avx2 msa sse2/;
specialize qw/aom_sad32x8x4d avx2 sse2/;
specialize qw/aom_sad16x64x4d sse2/;
specialize qw/aom_sad16x32x4d msa sse2/;
specialize qw/aom_sad16x16x4d neon msa sse2/;
specialize qw/aom_sad16x8x4d msa sse2/;
specialize qw/aom_sad16x16x4d neon msa sse2/;
specialize qw/aom_sad16x8x4d msa sse2/;
specialize qw/aom_sad8x16x4d msa sse2/;
specialize qw/aom_sad8x8x4d msa sse2/;
specialize qw/aom_sad8x4x4d msa sse2/;
specialize qw/aom_sad4x16x4d msa sse2/;
specialize qw/aom_sad4x8x4d msa sse2/;
specialize qw/aom_sad4x4x4d msa sse2/;
specialize qw/aom_sad4x32x4d sse2/;
specialize qw/aom_sad4x16x4d sse2/;
specialize qw/aom_sad16x4x4d sse2/;
specialize qw/aom_sad8x32x4d sse2/;
specialize qw/aom_sad32x8x4d sse2/;
specialize qw/aom_sad16x64x4d sse2/;
specialize qw/aom_sad64x16x4d sse2/;
specialize qw/aom_sad128x128x4d_avg sse2/;
specialize qw/aom_sad128x64x4d_avg sse2/;
specialize qw/aom_sad64x128x4d_avg sse2/;
specialize qw/aom_sad64x64x4d_avg sse2/;
specialize qw/aom_sad64x32x4d_avg sse2/;
specialize qw/aom_sad64x16x4d_avg sse2/;
specialize qw/aom_sad32x64x4d_avg sse2/;
specialize qw/aom_sad32x32x4d_avg sse2/;
specialize qw/aom_sad32x16x4d_avg sse2/;
specialize qw/aom_sad32x8x4d_avg sse2/;
specialize qw/aom_sad16x64x4d_avg sse2/;
specialize qw/aom_sad16x32x4d_avg sse2/;
specialize qw/aom_sad16x16x4d_avg sse2/;
specialize qw/aom_sad16x8x4d_avg sse2/;
specialize qw/aom_sad8x16x4d_avg sse2/;
specialize qw/aom_sad8x8x4d_avg sse2/;
specialize qw/aom_sad8x4x4d_avg sse2/;
specialize qw/aom_sad4x16x4d_avg sse2/;
specialize qw/aom_sad4x8x4d_avg sse2/;
specialize qw/aom_sad4x4x4d_avg sse2/;
specialize qw/aom_sad4x32x4d_avg sse2/;
specialize qw/aom_sad4x16x4d_avg sse2/;
specialize qw/aom_sad16x4x4d_avg sse2/;
specialize qw/aom_sad8x32x4d_avg sse2/;
specialize qw/aom_sad32x8x4d_avg sse2/;
specialize qw/aom_sad64x16x4d_avg sse2/;
specialize qw/aom_masked_sad128x128x4d ssse3/;
specialize qw/aom_masked_sad128x64x4d ssse3/;
specialize qw/aom_masked_sad64x128x4d ssse3/;
specialize qw/aom_masked_sad64x64x4d ssse3/;
specialize qw/aom_masked_sad64x32x4d ssse3/;
specialize qw/aom_masked_sad64x16x4d ssse3/;
specialize qw/aom_masked_sad32x64x4d ssse3/;
specialize qw/aom_masked_sad32x32x4d ssse3/;
specialize qw/aom_masked_sad32x16x4d ssse3/;
specialize qw/aom_masked_sad32x8x4d ssse3/;
specialize qw/aom_masked_sad16x64x4d ssse3/;
specialize qw/aom_masked_sad16x32x4d ssse3/;
specialize qw/aom_masked_sad16x16x4d ssse3/;
specialize qw/aom_masked_sad16x8x4d ssse3/;
specialize qw/aom_masked_sad8x16x4d ssse3/;
specialize qw/aom_masked_sad8x8x4d ssse3/;
specialize qw/aom_masked_sad8x4x4d ssse3/;
specialize qw/aom_masked_sad4x16x4d ssse3/;
specialize qw/aom_masked_sad4x8x4d ssse3/;
specialize qw/aom_masked_sad4x4x4d ssse3/;
specialize qw/aom_masked_sad4x32x4d ssse3/;
specialize qw/aom_masked_sad4x16x4d ssse3/;
specialize qw/aom_masked_sad16x4x4d ssse3/;
specialize qw/aom_masked_sad8x32x4d ssse3/;
specialize qw/aom_masked_sad32x8x4d ssse3/;
specialize qw/aom_masked_sad64x16x4d ssse3/;
#
# Multi-block SAD, comparing a reference to N independent blocks
#
@ -911,6 +988,13 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
add_proto qw/void aom_hadamard_32x32/, "const int16_t *src_diff, ptrdiff_t src_stride, tran_low_t *coeff";
specialize qw/aom_hadamard_32x32 avx2 sse2/;
add_proto qw/void aom_hadamard_lp_8x8/, "const int16_t *src_diff, ptrdiff_t src_stride, int16_t *coeff";
specialize qw/aom_hadamard_lp_8x8 sse2 neon/;
add_proto qw/void aom_hadamard_lp_16x16/, "const int16_t *src_diff, ptrdiff_t src_stride, int16_t *coeff";
specialize qw/aom_hadamard_lp_16x16 avx2 neon/;
if (aom_config("CONFIG_AV1_HIGHBITDEPTH") eq "yes") {
add_proto qw/void aom_highbd_hadamard_8x8/, "const int16_t *src_diff, ptrdiff_t src_stride, tran_low_t *coeff";
specialize qw/aom_highbd_hadamard_8x8 avx2/;
@ -924,6 +1008,10 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
add_proto qw/int aom_satd/, "const tran_low_t *coeff, int length";
specialize qw/aom_satd avx2/;
add_proto qw/int aom_satd_lp/, "const int16_t *coeff, int length";
specialize qw/aom_satd_lp avx2 neon/;
#
# Structured Similarity (SSIM)
#
@ -1048,7 +1136,7 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
add_proto qw/uint32_t/, "aom_sub_pixel_avg_variance${w}x${h}", "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
add_proto qw/uint32_t/, "aom_dist_wtd_sub_pixel_avg_variance${w}x${h}", "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred, const DIST_WTD_COMP_PARAMS *jcp_param";
}
specialize qw/aom_variance128x128 sse2 avx2 /;
specialize qw/aom_variance128x128 sse2 avx2 neon /;
specialize qw/aom_variance128x64 sse2 avx2 /;
specialize qw/aom_variance64x128 sse2 avx2 /;
specialize qw/aom_variance64x64 sse2 avx2 neon msa/;
@ -1073,9 +1161,9 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
specialize qw/aom_sub_pixel_variance32x64 avx2 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance32x32 avx2 neon msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance32x16 avx2 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance16x32 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance16x16 neon msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance16x8 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance16x32 avx2 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance16x16 avx2 neon msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance16x8 avx2 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance8x16 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance8x8 neon msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance8x4 msa sse2 ssse3/;
@ -1107,10 +1195,10 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
specialize qw/aom_variance64x16 sse2 avx2/;
specialize qw/aom_sub_pixel_variance4x16 sse2 ssse3/;
specialize qw/aom_sub_pixel_variance16x4 sse2 ssse3/;
specialize qw/aom_sub_pixel_variance16x4 avx2 sse2 ssse3/;
specialize qw/aom_sub_pixel_variance8x32 sse2 ssse3/;
specialize qw/aom_sub_pixel_variance32x8 sse2 ssse3/;
specialize qw/aom_sub_pixel_variance16x64 sse2 ssse3/;
specialize qw/aom_sub_pixel_variance16x64 avx2 sse2 ssse3/;
specialize qw/aom_sub_pixel_variance64x16 sse2 ssse3/;
specialize qw/aom_sub_pixel_avg_variance4x16 sse2 ssse3/;
specialize qw/aom_sub_pixel_avg_variance16x4 sse2 ssse3/;

View file

@ -47,3 +47,28 @@ unsigned int aom_avg_8x8_neon(const uint8_t *a, int a_stride) {
return vget_lane_u32(vrshr_n_u32(d, 6), 0);
}
int aom_satd_lp_neon(const int16_t *coeff, int length) {
const int16x4_t zero = vdup_n_s16(0);
int32x4_t accum = vdupq_n_s32(0);
do {
const int16x8_t src0 = vld1q_s16(coeff);
const int16x8_t src8 = vld1q_s16(coeff + 8);
accum = vabal_s16(accum, vget_low_s16(src0), zero);
accum = vabal_s16(accum, vget_high_s16(src0), zero);
accum = vabal_s16(accum, vget_low_s16(src8), zero);
accum = vabal_s16(accum, vget_high_s16(src8), zero);
length -= 16;
coeff += 16;
} while (length != 0);
{
// satd: 26 bits, dynamic range [-32640 * 1024, 32640 * 1024]
const int64x2_t s0 = vpaddlq_s32(accum); // cascading summation of 'accum'.
const int32x2_t s1 = vadd_s32(vreinterpret_s32_s64(vget_low_s64(s0)),
vreinterpret_s32_s64(vget_high_s64(s0)));
const int satd = vget_lane_s32(s1, 0);
return satd;
}
}

View file

@ -14,9 +14,103 @@
#include "config/aom_config.h"
#include "aom_dsp/txfm_common.h"
#include "av1/common/arm/mem_neon.h"
#include "av1/common/arm/transpose_neon.h"
static void aom_fdct4x4_helper(const int16_t *input, int stride,
int16x4_t *input_0, int16x4_t *input_1,
int16x4_t *input_2, int16x4_t *input_3) {
*input_0 = vshl_n_s16(vld1_s16(input + 0 * stride), 4);
*input_1 = vshl_n_s16(vld1_s16(input + 1 * stride), 4);
*input_2 = vshl_n_s16(vld1_s16(input + 2 * stride), 4);
*input_3 = vshl_n_s16(vld1_s16(input + 3 * stride), 4);
// If the very first value != 0, then add 1.
if (input[0] != 0) {
const int16x4_t one = vreinterpret_s16_s64(vdup_n_s64(1));
*input_0 = vadd_s16(*input_0, one);
}
for (int i = 0; i < 2; ++i) {
const int16x8_t input_01 = vcombine_s16(*input_0, *input_1);
const int16x8_t input_32 = vcombine_s16(*input_3, *input_2);
// in_0 +/- in_3, in_1 +/- in_2
const int16x8_t s_01 = vaddq_s16(input_01, input_32);
const int16x8_t s_32 = vsubq_s16(input_01, input_32);
// step_0 +/- step_1, step_2 +/- step_3
const int16x4_t s_0 = vget_low_s16(s_01);
const int16x4_t s_1 = vget_high_s16(s_01);
const int16x4_t s_2 = vget_high_s16(s_32);
const int16x4_t s_3 = vget_low_s16(s_32);
// (s_0 +/- s_1) * cospi_16_64
// Must expand all elements to s32. See 'needs32' comment in fwd_txfm.c.
const int32x4_t s_0_p_s_1 = vaddl_s16(s_0, s_1);
const int32x4_t s_0_m_s_1 = vsubl_s16(s_0, s_1);
const int32x4_t temp1 = vmulq_n_s32(s_0_p_s_1, cospi_16_64);
const int32x4_t temp2 = vmulq_n_s32(s_0_m_s_1, cospi_16_64);
// fdct_round_shift
int16x4_t out_0 = vrshrn_n_s32(temp1, DCT_CONST_BITS);
int16x4_t out_2 = vrshrn_n_s32(temp2, DCT_CONST_BITS);
// s_3 * cospi_8_64 + s_2 * cospi_24_64
// s_3 * cospi_24_64 - s_2 * cospi_8_64
const int32x4_t s_3_cospi_8_64 = vmull_n_s16(s_3, cospi_8_64);
const int32x4_t s_3_cospi_24_64 = vmull_n_s16(s_3, cospi_24_64);
const int32x4_t temp3 = vmlal_n_s16(s_3_cospi_8_64, s_2, cospi_24_64);
const int32x4_t temp4 = vmlsl_n_s16(s_3_cospi_24_64, s_2, cospi_8_64);
// fdct_round_shift
int16x4_t out_1 = vrshrn_n_s32(temp3, DCT_CONST_BITS);
int16x4_t out_3 = vrshrn_n_s32(temp4, DCT_CONST_BITS);
transpose_s16_4x4d(&out_0, &out_1, &out_2, &out_3);
*input_0 = out_0;
*input_1 = out_1;
*input_2 = out_2;
*input_3 = out_3;
}
}
void aom_fdct4x4_neon(const int16_t *input, tran_low_t *final_output,
int stride) {
// input[M * stride] * 16
int16x4_t input_0, input_1, input_2, input_3;
aom_fdct4x4_helper(input, stride, &input_0, &input_1, &input_2, &input_3);
// Not quite a rounding shift. Only add 1 despite shifting by 2.
const int16x8_t one = vdupq_n_s16(1);
int16x8_t out_01 = vcombine_s16(input_0, input_1);
int16x8_t out_23 = vcombine_s16(input_2, input_3);
out_01 = vshrq_n_s16(vaddq_s16(out_01, one), 2);
out_23 = vshrq_n_s16(vaddq_s16(out_23, one), 2);
store_s16q_to_tran_low(final_output + 0 * 8, out_01);
store_s16q_to_tran_low(final_output + 1 * 8, out_23);
}
void aom_fdct4x4_lp_neon(const int16_t *input, int16_t *final_output,
int stride) {
// input[M * stride] * 16
int16x4_t input_0, input_1, input_2, input_3;
aom_fdct4x4_helper(input, stride, &input_0, &input_1, &input_2, &input_3);
// Not quite a rounding shift. Only add 1 despite shifting by 2.
const int16x8_t one = vdupq_n_s16(1);
int16x8_t out_01 = vcombine_s16(input_0, input_1);
int16x8_t out_23 = vcombine_s16(input_2, input_3);
out_01 = vshrq_n_s16(vaddq_s16(out_01, one), 2);
out_23 = vshrq_n_s16(vaddq_s16(out_23, one), 2);
vst1q_s16(final_output + 0 * 8, out_01);
vst1q_s16(final_output + 1 * 8, out_23);
}
void aom_fdct8x8_neon(const int16_t *input, int16_t *final_output, int stride) {
int i;
// stage 1
int16x8_t input_0 = vshlq_n_s16(vld1q_s16(&input[0 * stride]), 2);
int16x8_t input_1 = vshlq_n_s16(vld1q_s16(&input[1 * stride]), 2);
@ -26,7 +120,7 @@ void aom_fdct8x8_neon(const int16_t *input, int16_t *final_output, int stride) {
int16x8_t input_5 = vshlq_n_s16(vld1q_s16(&input[5 * stride]), 2);
int16x8_t input_6 = vshlq_n_s16(vld1q_s16(&input[6 * stride]), 2);
int16x8_t input_7 = vshlq_n_s16(vld1q_s16(&input[7 * stride]), 2);
for (i = 0; i < 2; ++i) {
for (int i = 0; i < 2; ++i) {
int16x8_t out_0, out_1, out_2, out_3, out_4, out_5, out_6, out_7;
const int16x8_t v_s0 = vaddq_s16(input_0, input_7);
const int16x8_t v_s1 = vaddq_s16(input_1, input_6);

View file

@ -75,6 +75,76 @@ void aom_hadamard_8x8_neon(const int16_t *src_diff, ptrdiff_t src_stride,
store_s16q_to_tran_low(coeff + 56, a7);
}
void aom_hadamard_lp_8x8_neon(const int16_t *src_diff, ptrdiff_t src_stride,
int16_t *coeff) {
int16x8_t a0 = vld1q_s16(src_diff);
int16x8_t a1 = vld1q_s16(src_diff + src_stride);
int16x8_t a2 = vld1q_s16(src_diff + 2 * src_stride);
int16x8_t a3 = vld1q_s16(src_diff + 3 * src_stride);
int16x8_t a4 = vld1q_s16(src_diff + 4 * src_stride);
int16x8_t a5 = vld1q_s16(src_diff + 5 * src_stride);
int16x8_t a6 = vld1q_s16(src_diff + 6 * src_stride);
int16x8_t a7 = vld1q_s16(src_diff + 7 * src_stride);
hadamard8x8_one_pass(&a0, &a1, &a2, &a3, &a4, &a5, &a6, &a7);
transpose_s16_8x8(&a0, &a1, &a2, &a3, &a4, &a5, &a6, &a7);
hadamard8x8_one_pass(&a0, &a1, &a2, &a3, &a4, &a5, &a6, &a7);
// Skip the second transpose because it is not required.
vst1q_s16(coeff + 0, a0);
vst1q_s16(coeff + 8, a1);
vst1q_s16(coeff + 16, a2);
vst1q_s16(coeff + 24, a3);
vst1q_s16(coeff + 32, a4);
vst1q_s16(coeff + 40, a5);
vst1q_s16(coeff + 48, a6);
vst1q_s16(coeff + 56, a7);
}
void aom_hadamard_lp_16x16_neon(const int16_t *src_diff, ptrdiff_t src_stride,
int16_t *coeff) {
/* Rearrange 16x16 to 8x32 and remove stride.
* Top left first. */
aom_hadamard_lp_8x8_neon(src_diff + 0 + 0 * src_stride, src_stride,
coeff + 0);
/* Top right. */
aom_hadamard_lp_8x8_neon(src_diff + 8 + 0 * src_stride, src_stride,
coeff + 64);
/* Bottom left. */
aom_hadamard_lp_8x8_neon(src_diff + 0 + 8 * src_stride, src_stride,
coeff + 128);
/* Bottom right. */
aom_hadamard_lp_8x8_neon(src_diff + 8 + 8 * src_stride, src_stride,
coeff + 192);
for (int i = 0; i < 64; i += 8) {
const int16x8_t a0 = vld1q_s16(coeff + 0);
const int16x8_t a1 = vld1q_s16(coeff + 64);
const int16x8_t a2 = vld1q_s16(coeff + 128);
const int16x8_t a3 = vld1q_s16(coeff + 192);
const int16x8_t b0 = vhaddq_s16(a0, a1);
const int16x8_t b1 = vhsubq_s16(a0, a1);
const int16x8_t b2 = vhaddq_s16(a2, a3);
const int16x8_t b3 = vhsubq_s16(a2, a3);
const int16x8_t c0 = vaddq_s16(b0, b2);
const int16x8_t c1 = vaddq_s16(b1, b3);
const int16x8_t c2 = vsubq_s16(b0, b2);
const int16x8_t c3 = vsubq_s16(b1, b3);
vst1q_s16(coeff + 0, c0);
vst1q_s16(coeff + 64, c1);
vst1q_s16(coeff + 128, c2);
vst1q_s16(coeff + 192, c3);
coeff += 8;
}
}
void aom_hadamard_16x16_neon(const int16_t *src_diff, ptrdiff_t src_stride,
tran_low_t *coeff) {
/* Rearrange 16x16 to 8x32 and remove stride.

View file

@ -0,0 +1,487 @@
/*
* Copyright (c) 2020, Alliance for Open Media. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include <arm_neon.h>
#include "config/aom_config.h"
#include "config/aom_dsp_rtcd.h"
#include "aom/aom_integer.h"
static INLINE uint32_t sse_W16x1_neon(uint8x16_t q2, uint8x16_t q3) {
const uint16_t sse1 = 0;
const uint16x8_t q1 = vld1q_dup_u16(&sse1);
uint32_t sse;
uint8x16_t q4 = vabdq_u8(q2, q3); // diff = abs(a[x] - b[x])
uint8x8_t d0 = vget_low_u8(q4);
uint8x8_t d1 = vget_high_u8(q4);
uint16x8_t q6 = vmlal_u8(q1, d0, d0);
uint16x8_t q7 = vmlal_u8(q1, d1, d1);
uint32x4_t q8 = vaddl_u16(vget_low_u16(q6), vget_high_u16(q6));
uint32x4_t q9 = vaddl_u16(vget_low_u16(q7), vget_high_u16(q7));
uint32x2_t d4 = vadd_u32(vget_low_u32(q8), vget_high_u32(q8));
uint32x2_t d5 = vadd_u32(vget_low_u32(q9), vget_high_u32(q9));
uint32x2_t d6 = vadd_u32(d4, d5);
sse = vget_lane_u32(d6, 0);
sse += vget_lane_u32(d6, 1);
return sse;
}
int64_t aom_sse_neon(const uint8_t *a, int a_stride, const uint8_t *b,
int b_stride, int width, int height) {
const uint8x16_t q0 = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
};
int addinc, x, y;
uint8x8_t d0, d1, d2, d3;
uint8_t dx;
uint8x16_t q2, q3, q4, q5;
uint32_t sse = 0;
uint8x8x2_t tmp, tmp2;
switch (width) {
case 4:
for (y = 0; y < height; y += 4) {
d0 = vld1_u8(a); // load 4 data
a += a_stride;
d1 = vld1_u8(a);
a += a_stride;
d2 = vld1_u8(a);
a += a_stride;
d3 = vld1_u8(a);
a += a_stride;
tmp = vzip_u8(d0, d1);
tmp2 = vzip_u8(d2, d3);
q2 = vcombine_u8(tmp.val[0], tmp2.val[0]); // make a 16 data vector
d0 = vld1_u8(b);
b += b_stride;
d1 = vld1_u8(b);
b += b_stride;
d2 = vld1_u8(b);
b += b_stride;
d3 = vld1_u8(b);
b += b_stride;
tmp = vzip_u8(d0, d1);
tmp2 = vzip_u8(d2, d3);
q3 = vcombine_u8(tmp.val[0], tmp2.val[0]);
sse += sse_W16x1_neon(q2, q3);
}
break;
case 8:
for (y = 0; y < height; y += 2) {
d0 = vld1_u8(a); // load 8 data
d1 = vld1_u8(a + a_stride);
q2 = vcombine_u8(d0, d1); // make a 16 data vector
d0 = vld1_u8(b);
d1 = vld1_u8(b + b_stride);
q3 = vcombine_u8(d0, d1);
sse += sse_W16x1_neon(q2, q3);
a += 2 * a_stride;
b += 2 * b_stride;
}
break;
case 16:
for (y = 0; y < height; y++) {
q2 = vld1q_u8(a);
q3 = vld1q_u8(b);
sse += sse_W16x1_neon(q2, q3);
a += a_stride;
b += b_stride;
}
break;
case 32:
for (y = 0; y < height; y++) {
q2 = vld1q_u8(a);
q3 = vld1q_u8(b);
sse += sse_W16x1_neon(q2, q3);
q2 = vld1q_u8(a + 16);
q3 = vld1q_u8(b + 16);
sse += sse_W16x1_neon(q2, q3);
a += a_stride;
b += b_stride;
}
break;
case 64:
for (y = 0; y < height; y++) {
q2 = vld1q_u8(a);
q3 = vld1q_u8(b);
sse += sse_W16x1_neon(q2, q3);
q2 = vld1q_u8(a + 16);
q3 = vld1q_u8(b + 16);
sse += sse_W16x1_neon(q2, q3);
q2 = vld1q_u8(a + 32);
q3 = vld1q_u8(b + 32);
sse += sse_W16x1_neon(q2, q3);
q2 = vld1q_u8(a + 48);
q3 = vld1q_u8(b + 48);
sse += sse_W16x1_neon(q2, q3);
a += a_stride;
b += b_stride;
}
break;
case 128:
for (y = 0; y < height; y++) {
q2 = vld1q_u8(a);
q3 = vld1q_u8(b);
sse += sse_W16x1_neon(q2, q3);
q2 = vld1q_u8(a + 16);
q3 = vld1q_u8(b + 16);
sse += sse_W16x1_neon(q2, q3);
q2 = vld1q_u8(a + 32);
q3 = vld1q_u8(b + 32);
sse += sse_W16x1_neon(q2, q3);
q2 = vld1q_u8(a + 48);
q3 = vld1q_u8(b + 48);
sse += sse_W16x1_neon(q2, q3);
q2 = vld1q_u8(a + 64);
q3 = vld1q_u8(b + 64);
sse += sse_W16x1_neon(q2, q3);
q2 = vld1q_u8(a + 80);
q3 = vld1q_u8(b + 80);
sse += sse_W16x1_neon(q2, q3);
q2 = vld1q_u8(a + 96);
q3 = vld1q_u8(b + 96);
sse += sse_W16x1_neon(q2, q3);
q2 = vld1q_u8(a + 112);
q3 = vld1q_u8(b + 112);
sse += sse_W16x1_neon(q2, q3);
a += a_stride;
b += b_stride;
}
break;
default:
for (y = 0; y < height; y++) {
x = width;
while (x > 0) {
addinc = width - x;
q2 = vld1q_u8(a + addinc);
q3 = vld1q_u8(b + addinc);
if (x < 16) {
dx = x;
q4 = vld1q_dup_u8(&dx);
q5 = vcltq_u8(q0, q4);
q2 = vandq_u8(q2, q5);
q3 = vandq_u8(q3, q5);
}
sse += sse_W16x1_neon(q2, q3);
x -= 16;
}
a += a_stride;
b += b_stride;
}
}
return (int64_t)sse;
}
#if CONFIG_AV1_HIGHBITDEPTH
static INLINE uint32_t highbd_sse_W8x1_neon(uint16x8_t q2, uint16x8_t q3) {
uint32_t sse;
const uint32_t sse1 = 0;
const uint32x4_t q1 = vld1q_dup_u32(&sse1);
uint16x8_t q4 = vabdq_u16(q2, q3); // diff = abs(a[x] - b[x])
uint16x4_t d0 = vget_low_u16(q4);
uint16x4_t d1 = vget_high_u16(q4);
uint32x4_t q6 = vmlal_u16(q1, d0, d0);
uint32x4_t q7 = vmlal_u16(q1, d1, d1);
uint32x2_t d4 = vadd_u32(vget_low_u32(q6), vget_high_u32(q6));
uint32x2_t d5 = vadd_u32(vget_low_u32(q7), vget_high_u32(q7));
uint32x2_t d6 = vadd_u32(d4, d5);
sse = vget_lane_u32(d6, 0);
sse += vget_lane_u32(d6, 1);
return sse;
}
int64_t aom_highbd_sse_neon(const uint8_t *a8, int a_stride, const uint8_t *b8,
int b_stride, int width, int height) {
const uint16x8_t q0 = { 0, 1, 2, 3, 4, 5, 6, 7 };
int64_t sse = 0;
uint16_t *a = CONVERT_TO_SHORTPTR(a8);
uint16_t *b = CONVERT_TO_SHORTPTR(b8);
int x, y;
int addinc;
uint16x4_t d0, d1, d2, d3;
uint16_t dx;
uint16x8_t q2, q3, q4, q5;
switch (width) {
case 4:
for (y = 0; y < height; y += 2) {
d0 = vld1_u16(a); // load 4 data
a += a_stride;
d1 = vld1_u16(a);
a += a_stride;
d2 = vld1_u16(b);
b += b_stride;
d3 = vld1_u16(b);
b += b_stride;
q2 = vcombine_u16(d0, d1); // make a 8 data vector
q3 = vcombine_u16(d2, d3);
sse += highbd_sse_W8x1_neon(q2, q3);
}
break;
case 8:
for (y = 0; y < height; y++) {
q2 = vld1q_u16(a);
q3 = vld1q_u16(b);
sse += highbd_sse_W8x1_neon(q2, q3);
a += a_stride;
b += b_stride;
}
break;
case 16:
for (y = 0; y < height; y++) {
q2 = vld1q_u16(a);
q3 = vld1q_u16(b);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 8);
q3 = vld1q_u16(b + 8);
sse += highbd_sse_W8x1_neon(q2, q3);
a += a_stride;
b += b_stride;
}
break;
case 32:
for (y = 0; y < height; y++) {
q2 = vld1q_u16(a);
q3 = vld1q_u16(b);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 8);
q3 = vld1q_u16(b + 8);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 16);
q3 = vld1q_u16(b + 16);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 24);
q3 = vld1q_u16(b + 24);
sse += highbd_sse_W8x1_neon(q2, q3);
a += a_stride;
b += b_stride;
}
break;
case 64:
for (y = 0; y < height; y++) {
q2 = vld1q_u16(a);
q3 = vld1q_u16(b);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 8);
q3 = vld1q_u16(b + 8);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 16);
q3 = vld1q_u16(b + 16);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 24);
q3 = vld1q_u16(b + 24);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 32);
q3 = vld1q_u16(b + 32);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 40);
q3 = vld1q_u16(b + 40);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 48);
q3 = vld1q_u16(b + 48);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 56);
q3 = vld1q_u16(b + 56);
sse += highbd_sse_W8x1_neon(q2, q3);
a += a_stride;
b += b_stride;
}
break;
case 128:
for (y = 0; y < height; y++) {
q2 = vld1q_u16(a);
q3 = vld1q_u16(b);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 8);
q3 = vld1q_u16(b + 8);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 16);
q3 = vld1q_u16(b + 16);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 24);
q3 = vld1q_u16(b + 24);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 32);
q3 = vld1q_u16(b + 32);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 40);
q3 = vld1q_u16(b + 40);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 48);
q3 = vld1q_u16(b + 48);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 56);
q3 = vld1q_u16(b + 56);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 64);
q3 = vld1q_u16(b + 64);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 72);
q3 = vld1q_u16(b + 72);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 80);
q3 = vld1q_u16(b + 80);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 88);
q3 = vld1q_u16(b + 88);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 96);
q3 = vld1q_u16(b + 96);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 104);
q3 = vld1q_u16(b + 104);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 112);
q3 = vld1q_u16(b + 112);
sse += highbd_sse_W8x1_neon(q2, q3);
q2 = vld1q_u16(a + 120);
q3 = vld1q_u16(b + 120);
sse += highbd_sse_W8x1_neon(q2, q3);
a += a_stride;
b += b_stride;
}
break;
default:
for (y = 0; y < height; y++) {
x = width;
while (x > 0) {
addinc = width - x;
q2 = vld1q_u16(a + addinc);
q3 = vld1q_u16(b + addinc);
if (x < 8) {
dx = x;
q4 = vld1q_dup_u16(&dx);
q5 = vcltq_u16(q0, q4);
q2 = vandq_u16(q2, q5);
q3 = vandq_u16(q3, q5);
}
sse += highbd_sse_W8x1_neon(q2, q3);
x -= 8;
}
a += a_stride;
b += b_stride;
}
}
return (int64_t)sse;
}
#endif

View file

@ -130,6 +130,24 @@ unsigned int aom_variance64x64_neon(const uint8_t *a, int a_stride,
return *sse - (unsigned int)(((int64_t)sum1 * sum1) >> 12);
}
unsigned int aom_variance128x128_neon(const uint8_t *a, int a_stride,
const uint8_t *b, int b_stride,
unsigned int *sse) {
int sum1, sum2;
uint32_t sse1, sse2;
sum1 = sse1 = 0;
for (int i = 0; i < 16; i++) {
variance_neon_w8(a + (8 * i * a_stride), a_stride, b + (8 * i * b_stride),
b_stride, 128, 8, &sse2, &sum2);
sse1 += sse2;
sum1 += sum2;
}
*sse = sse1;
return *sse - (unsigned int)(((int64_t)sum1 * sum1) >> 14);
}
unsigned int aom_variance16x8_neon(const unsigned char *src_ptr,
int source_stride,
const unsigned char *ref_ptr,
@ -355,9 +373,7 @@ unsigned int aom_get4x4sse_cs_neon(const unsigned char *src_ptr,
d6u8 = vld1_u8(ref_ptr);
ref_ptr += recon_stride;
d3u8 = vld1_u8(src_ptr);
src_ptr += source_stride;
d7u8 = vld1_u8(ref_ptr);
ref_ptr += recon_stride;
q11u16 = vsubl_u8(d0u8, d4u8);
q12u16 = vsubl_u8(d1u8, d5u8);

View file

@ -86,7 +86,7 @@ void aom_highbd_minmax_8x8_c(const uint8_t *s8, int p, const uint8_t *d8,
}
}
}
#endif // CONFIG_VP9_HIGHBITDEPTH
#endif // CONFIG_AV1_HIGHBITDEPTH
// src_diff: first pass, 9 bit, dynamic range [-255, 255]
// second pass, 12 bit, dynamic range [-2040, 2040]
@ -147,6 +147,30 @@ void aom_hadamard_8x8_c(const int16_t *src_diff, ptrdiff_t src_stride,
for (idx = 0; idx < 64; ++idx) coeff[idx] = (tran_low_t)buffer2[idx];
}
void aom_hadamard_lp_8x8_c(const int16_t *src_diff, ptrdiff_t src_stride,
int16_t *coeff) {
int16_t buffer[64];
int16_t buffer2[64];
int16_t *tmp_buf = &buffer[0];
for (int idx = 0; idx < 8; ++idx) {
hadamard_col8(src_diff, src_stride, tmp_buf); // src_diff: 9 bit
// dynamic range [-255, 255]
tmp_buf += 8;
++src_diff;
}
tmp_buf = &buffer[0];
for (int idx = 0; idx < 8; ++idx) {
hadamard_col8(tmp_buf, 8, buffer2 + 8 * idx); // tmp_buf: 12 bit
// dynamic range [-2040, 2040]
// buffer2: 15 bit
// dynamic range [-16320, 16320]
++tmp_buf;
}
for (int idx = 0; idx < 64; ++idx) coeff[idx] = buffer2[idx];
}
// In place 16x16 2D Hadamard transform
void aom_hadamard_16x16_c(const int16_t *src_diff, ptrdiff_t src_stride,
tran_low_t *coeff) {
@ -179,6 +203,35 @@ void aom_hadamard_16x16_c(const int16_t *src_diff, ptrdiff_t src_stride,
}
}
void aom_hadamard_lp_16x16_c(const int16_t *src_diff, ptrdiff_t src_stride,
int16_t *coeff) {
for (int idx = 0; idx < 4; ++idx) {
// src_diff: 9 bit, dynamic range [-255, 255]
const int16_t *src_ptr =
src_diff + (idx >> 1) * 8 * src_stride + (idx & 0x01) * 8;
aom_hadamard_lp_8x8_c(src_ptr, src_stride, coeff + idx * 64);
}
for (int idx = 0; idx < 64; ++idx) {
int16_t a0 = coeff[0];
int16_t a1 = coeff[64];
int16_t a2 = coeff[128];
int16_t a3 = coeff[192];
int16_t b0 = (a0 + a1) >> 1; // (a0 + a1): 16 bit, [-32640, 32640]
int16_t b1 = (a0 - a1) >> 1; // b0-b3: 15 bit, dynamic range
int16_t b2 = (a2 + a3) >> 1; // [-16320, 16320]
int16_t b3 = (a2 - a3) >> 1;
coeff[0] = b0 + b2; // 16 bit, [-32640, 32640]
coeff[64] = b1 + b3;
coeff[128] = b0 - b2;
coeff[192] = b1 - b3;
++coeff;
}
}
void aom_hadamard_32x32_c(const int16_t *src_diff, ptrdiff_t src_stride,
tran_low_t *coeff) {
int idx;
@ -379,6 +432,14 @@ int aom_satd_c(const tran_low_t *coeff, int length) {
return satd;
}
int aom_satd_lp_c(const int16_t *coeff, int length) {
int satd = 0;
for (int i = 0; i < length; ++i) satd += abs(coeff[i]);
// satd: 26 bits, dynamic range [-32640 * 1024, 32640 * 1024]
return satd;
}
// Integer projection onto row vectors.
// height: value range {16, 32, 64, 128}.
void aom_int_pro_row_c(int16_t hbuf[16], const uint8_t *ref,

View file

@ -9,39 +9,33 @@
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#include "aom_dsp/daalaboolreader.h"
#include "aom_dsp/bitreader.h"
int aom_daala_reader_init(daala_reader *r, const uint8_t *buffer, int size) {
int aom_reader_init(aom_reader *r, const uint8_t *buffer, size_t size) {
if (size && !buffer) {
return 1;
}
r->buffer_end = buffer + size;
r->buffer = buffer;
od_ec_dec_init(&r->ec, buffer, size);
od_ec_dec_init(&r->ec, buffer, (uint32_t)size);
#if CONFIG_ACCOUNTING
r->accounting = NULL;
#endif
return 0;
}
const uint8_t *aom_daala_reader_find_begin(daala_reader *r) {
return r->buffer;
}
const uint8_t *aom_reader_find_begin(aom_reader *r) { return r->buffer; }
const uint8_t *aom_daala_reader_find_end(daala_reader *r) {
return r->buffer_end;
}
const uint8_t *aom_reader_find_end(aom_reader *r) { return r->buffer_end; }
uint32_t aom_daala_reader_tell(const daala_reader *r) {
return od_ec_dec_tell(&r->ec);
}
uint32_t aom_reader_tell(const aom_reader *r) { return od_ec_dec_tell(&r->ec); }
uint32_t aom_daala_reader_tell_frac(const daala_reader *r) {
uint32_t aom_reader_tell_frac(const aom_reader *r) {
return od_ec_dec_tell_frac(&r->ec);
}
int aom_daala_reader_has_overflowed(const daala_reader *r) {
const uint32_t tell_bits = aom_daala_reader_tell(r);
int aom_reader_has_overflowed(const aom_reader *r) {
const uint32_t tell_bits = aom_reader_tell(r);
const uint32_t tell_bytes = (tell_bits + 7) >> 3;
return ((ptrdiff_t)tell_bytes > r->buffer_end - r->buffer);
}

View file

@ -19,7 +19,7 @@
#include "aom/aomdx.h"
#include "aom/aom_integer.h"
#include "aom_dsp/daalaboolreader.h"
#include "aom_dsp/entdec.h"
#include "aom_dsp/prob.h"
#include "av1/common/odintrin.h"
@ -50,36 +50,33 @@
extern "C" {
#endif
typedef struct daala_reader aom_reader;
struct aom_reader {
const uint8_t *buffer;
const uint8_t *buffer_end;
od_ec_dec ec;
#if CONFIG_ACCOUNTING
Accounting *accounting;
#endif
uint8_t allow_update_cdf;
};
static INLINE int aom_reader_init(aom_reader *r, const uint8_t *buffer,
size_t size) {
return aom_daala_reader_init(r, buffer, (int)size);
}
typedef struct aom_reader aom_reader;
static INLINE const uint8_t *aom_reader_find_begin(aom_reader *r) {
return aom_daala_reader_find_begin(r);
}
int aom_reader_init(aom_reader *r, const uint8_t *buffer, size_t size);
static INLINE const uint8_t *aom_reader_find_end(aom_reader *r) {
return aom_daala_reader_find_end(r);
}
const uint8_t *aom_reader_find_begin(aom_reader *r);
const uint8_t *aom_reader_find_end(aom_reader *r);
// Returns true if the bit reader has tried to decode more data from the buffer
// than was actually provided.
static INLINE int aom_reader_has_overflowed(const aom_reader *r) {
return aom_daala_reader_has_overflowed(r);
}
int aom_reader_has_overflowed(const aom_reader *r);
// Returns the position in the bit reader in bits.
static INLINE uint32_t aom_reader_tell(const aom_reader *r) {
return aom_daala_reader_tell(r);
}
uint32_t aom_reader_tell(const aom_reader *r);
// Returns the position in the bit reader in 1/8th bits.
static INLINE uint32_t aom_reader_tell_frac(const aom_reader *r) {
return aom_daala_reader_tell_frac(r);
}
uint32_t aom_reader_tell_frac(const aom_reader *r);
#if CONFIG_ACCOUNTING
static INLINE void aom_process_accounting(const aom_reader *r ACCT_STR_PARAM) {
@ -101,13 +98,48 @@ static INLINE void aom_update_symb_counts(const aom_reader *r, int is_binary) {
#endif
static INLINE int aom_read_(aom_reader *r, int prob ACCT_STR_PARAM) {
int ret;
ret = aom_daala_read(r, prob);
int p = (0x7FFFFF - (prob << 15) + prob) >> 8;
int bit = od_ec_decode_bool_q15(&r->ec, p);
#if CONFIG_BITSTREAM_DEBUG
{
int i;
int ref_bit, ref_nsymbs;
aom_cdf_prob ref_cdf[16];
const int queue_r = bitstream_queue_get_read();
const int frame_idx = aom_bitstream_queue_get_frame_read();
bitstream_queue_pop(&ref_bit, ref_cdf, &ref_nsymbs);
if (ref_nsymbs != 2) {
fprintf(stderr,
"\n *** [bit] nsymbs error, frame_idx_r %d nsymbs %d ref_nsymbs "
"%d queue_r %d\n",
frame_idx, 2, ref_nsymbs, queue_r);
assert(0);
}
if ((ref_nsymbs != 2) || (ref_cdf[0] != (aom_cdf_prob)p) ||
(ref_cdf[1] != 32767)) {
fprintf(stderr,
"\n *** [bit] cdf error, frame_idx_r %d cdf {%d, %d} ref_cdf {%d",
frame_idx, p, 32767, ref_cdf[0]);
for (i = 1; i < ref_nsymbs; ++i) fprintf(stderr, ", %d", ref_cdf[i]);
fprintf(stderr, "} queue_r %d\n", queue_r);
assert(0);
}
if (bit != ref_bit) {
fprintf(stderr,
"\n *** [bit] symb error, frame_idx_r %d symb %d ref_symb %d "
"queue_r %d\n",
frame_idx, bit, ref_bit, queue_r);
assert(0);
}
}
#endif
#if CONFIG_ACCOUNTING
if (ACCT_STR_NAME) aom_process_accounting(r, ACCT_STR_NAME);
aom_update_symb_counts(r, 1);
#endif
return ret;
return bit;
}
static INLINE int aom_read_bit_(aom_reader *r ACCT_STR_PARAM) {
@ -131,14 +163,54 @@ static INLINE int aom_read_literal_(aom_reader *r, int bits ACCT_STR_PARAM) {
static INLINE int aom_read_cdf_(aom_reader *r, const aom_cdf_prob *cdf,
int nsymbs ACCT_STR_PARAM) {
int ret;
ret = daala_read_symbol(r, cdf, nsymbs);
int symb;
assert(cdf != NULL);
symb = od_ec_decode_cdf_q15(&r->ec, cdf, nsymbs);
#if CONFIG_BITSTREAM_DEBUG
{
int i;
int cdf_error = 0;
int ref_symb, ref_nsymbs;
aom_cdf_prob ref_cdf[16];
const int queue_r = bitstream_queue_get_read();
const int frame_idx = aom_bitstream_queue_get_frame_read();
bitstream_queue_pop(&ref_symb, ref_cdf, &ref_nsymbs);
if (nsymbs != ref_nsymbs) {
fprintf(stderr,
"\n *** nsymbs error, frame_idx_r %d nsymbs %d ref_nsymbs %d "
"queue_r %d\n",
frame_idx, nsymbs, ref_nsymbs, queue_r);
cdf_error = 0;
assert(0);
} else {
for (i = 0; i < nsymbs; ++i)
if (cdf[i] != ref_cdf[i]) cdf_error = 1;
}
if (cdf_error) {
fprintf(stderr, "\n *** cdf error, frame_idx_r %d cdf {%d", frame_idx,
cdf[0]);
for (i = 1; i < nsymbs; ++i) fprintf(stderr, ", %d", cdf[i]);
fprintf(stderr, "} ref_cdf {%d", ref_cdf[0]);
for (i = 1; i < ref_nsymbs; ++i) fprintf(stderr, ", %d", ref_cdf[i]);
fprintf(stderr, "} queue_r %d\n", queue_r);
assert(0);
}
if (symb != ref_symb) {
fprintf(
stderr,
"\n *** symb error, frame_idx_r %d symb %d ref_symb %d queue_r %d\n",
frame_idx, symb, ref_symb, queue_r);
assert(0);
}
}
#endif
#if CONFIG_ACCOUNTING
if (ACCT_STR_NAME) aom_process_accounting(r, ACCT_STR_NAME);
aom_update_symb_counts(r, (nsymbs == 2));
#endif
return ret;
return symb;
}
static INLINE int aom_read_symbol_(aom_reader *r, aom_cdf_prob *cdf,

View file

@ -10,22 +10,22 @@
*/
#include <string.h>
#include "aom_dsp/daalaboolwriter.h"
#include "aom_dsp/bitwriter.h"
void aom_daala_start_encode(daala_writer *br, uint8_t *source) {
br->buffer = source;
br->pos = 0;
od_ec_enc_init(&br->ec, 62025);
void aom_start_encode(aom_writer *w, uint8_t *source) {
w->buffer = source;
w->pos = 0;
od_ec_enc_init(&w->ec, 62025);
}
int aom_daala_stop_encode(daala_writer *br) {
int aom_stop_encode(aom_writer *w) {
int nb_bits;
uint32_t daala_bytes;
unsigned char *daala_data;
daala_data = od_ec_enc_done(&br->ec, &daala_bytes);
nb_bits = od_ec_enc_tell(&br->ec);
memcpy(br->buffer, daala_data, daala_bytes);
br->pos = daala_bytes;
od_ec_enc_clear(&br->ec);
uint32_t bytes;
unsigned char *data;
data = od_ec_enc_done(&w->ec, &bytes);
nb_bits = od_ec_enc_tell(&w->ec);
memcpy(w->buffer, data, bytes);
w->pos = bytes;
od_ec_enc_clear(&w->ec);
return nb_bits;
}

View file

@ -16,7 +16,7 @@
#include "config/aom_config.h"
#include "aom_dsp/daalaboolwriter.h"
#include "aom_dsp/entenc.h"
#include "aom_dsp/prob.h"
#if CONFIG_RD_DEBUG
@ -28,7 +28,14 @@
extern "C" {
#endif
typedef struct daala_writer aom_writer;
struct aom_writer {
unsigned int pos;
uint8_t *buffer;
od_ec_enc ec;
uint8_t allow_update_cdf;
};
typedef struct aom_writer aom_writer;
typedef struct TOKEN_STATS {
int cost;
@ -49,16 +56,26 @@ static INLINE void init_token_stats(TOKEN_STATS *token_stats) {
token_stats->cost = 0;
}
static INLINE void aom_start_encode(aom_writer *bc, uint8_t *buffer) {
aom_daala_start_encode(bc, buffer);
}
void aom_start_encode(aom_writer *w, uint8_t *buffer);
static INLINE int aom_stop_encode(aom_writer *bc) {
return aom_daala_stop_encode(bc);
}
int aom_stop_encode(aom_writer *w);
static INLINE void aom_write(aom_writer *br, int bit, int probability) {
aom_daala_write(br, bit, probability);
static INLINE void aom_write(aom_writer *w, int bit, int probability) {
int p = (0x7FFFFF - (probability << 15) + probability) >> 8;
#if CONFIG_BITSTREAM_DEBUG
aom_cdf_prob cdf[2] = { (aom_cdf_prob)p, 32767 };
/*int queue_r = 0;
int frame_idx_r = 0;
int queue_w = bitstream_queue_get_write();
int frame_idx_w = aom_bitstream_queue_get_frame_writee();
if (frame_idx_w == frame_idx_r && queue_w == queue_r) {
fprintf(stderr, "\n *** bitstream queue at frame_idx_w %d queue_w %d\n",
frame_idx_w, queue_w);
}*/
bitstream_queue_push(bit, cdf, 2);
#endif
od_ec_encode_bool_q15(&w->ec, bit, p);
}
static INLINE void aom_write_bit(aom_writer *w, int bit) {
@ -73,7 +90,19 @@ static INLINE void aom_write_literal(aom_writer *w, int data, int bits) {
static INLINE void aom_write_cdf(aom_writer *w, int symb,
const aom_cdf_prob *cdf, int nsymbs) {
daala_write_symbol(w, symb, cdf, nsymbs);
#if CONFIG_BITSTREAM_DEBUG
/*int queue_r = 0;
int frame_idx_r = 0;
int queue_w = bitstream_queue_get_write();
int frame_idx_w = aom_bitstream_queue_get_frame_writee();
if (frame_idx_w == frame_idx_r && queue_w == queue_r) {
fprintf(stderr, "\n *** bitstream queue at frame_idx_w %d queue_w %d\n",
frame_idx_w, queue_w);
}*/
bitstream_queue_push(symb, cdf, nsymbs);
#endif
od_ec_encode_cdf_q15(&w->ec, symb, cdf, nsymbs);
}
static INLINE void aom_write_symbol(aom_writer *w, int symb, aom_cdf_prob *cdf,

View file

@ -1,70 +0,0 @@
/*
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
* was not distributed with this source code in the LICENSE file, you can
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#include <string.h>
#include "aom_dsp/buf_ans.h"
#include "aom_mem/aom_mem.h"
#include "aom/internal/aom_codec_internal.h"
void aom_buf_ans_alloc(struct BufAnsCoder *c,
struct aom_internal_error_info *error) {
c->error = error;
assert(c->size > 1);
AOM_CHECK_MEM_ERROR(error, c->buf, aom_malloc(c->size * sizeof(*c->buf)));
// Initialize to overfull to trigger the assert in write.
c->offset = c->size + 1;
}
void aom_buf_ans_free(struct BufAnsCoder *c) {
aom_free(c->buf);
c->buf = NULL;
c->size = 0;
}
#if !ANS_MAX_SYMBOLS
void aom_buf_ans_grow(struct BufAnsCoder *c) {
struct buffered_ans_symbol *new_buf = NULL;
int new_size = c->size * 2;
AOM_CHECK_MEM_ERROR(c->error, new_buf,
aom_malloc(new_size * sizeof(*new_buf)));
memcpy(new_buf, c->buf, c->size * sizeof(*c->buf));
aom_free(c->buf);
c->buf = new_buf;
c->size = new_size;
}
#endif
void aom_buf_ans_flush(struct BufAnsCoder *const c) {
int offset;
#if ANS_MAX_SYMBOLS
if (c->offset == 0) return;
#endif
assert(c->offset > 0);
offset = c->offset - 1;
// Code the first symbol such that it brings the state to the smallest normal
// state from an initial state that would have been a subnormal/refill state.
if (c->buf[offset].method == ANS_METHOD_RANS) {
c->ans.state += c->buf[offset].val_start;
} else {
c->ans.state += c->buf[offset].val_start ? c->buf[offset].prob : 0;
}
for (offset = offset - 1; offset >= 0; --offset) {
if (c->buf[offset].method == ANS_METHOD_RANS) {
rans_write(&c->ans, c->buf[offset].val_start, c->buf[offset].prob);
} else {
rabs_write(&c->ans, (uint8_t)c->buf[offset].val_start,
(AnsP8)c->buf[offset].prob);
}
}
c->offset = 0;
c->output_bytes += ans_write_end(&c->ans);
}

View file

@ -1,136 +0,0 @@
/*
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
* was not distributed with this source code in the LICENSE file, you can
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#ifndef AOM_AOM_DSP_BUF_ANS_H_
#define AOM_AOM_DSP_BUF_ANS_H_
// Buffered forward ANS writer.
// Symbols are written to the writer in forward (decode) order and serialized
// backwards due to ANS's stack like behavior.
#include <assert.h>
#include "config/aom_config.h"
#include "aom/aom_integer.h"
#include "aom_dsp/ans.h"
#include "aom_dsp/answriter.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#define ANS_METHOD_RABS 0
#define ANS_METHOD_RANS 1
struct buffered_ans_symbol {
unsigned int method : 1; // one of ANS_METHOD_RABS or ANS_METHOD_RANS
// TODO(aconverse): Should be possible to write this in terms of start for ABS
unsigned int val_start : RANS_PROB_BITS; // Boolean value for ABS
// start in symbol cycle for Rans
unsigned int prob : RANS_PROB_BITS; // Probability of this symbol
};
struct BufAnsCoder {
struct aom_internal_error_info *error;
struct buffered_ans_symbol *buf;
struct AnsCoder ans;
int size;
int offset;
int output_bytes;
#if ANS_MAX_SYMBOLS
int window_size;
#endif
int pos; // Dummy variable to store the output buffer after closing
uint8_t allow_update_cdf;
};
// Allocate a buffered ANS coder to store size symbols.
// When ANS_MAX_SYMBOLS is turned on, the size is the fixed size of each ANS
// partition.
// When ANS_MAX_SYMBOLS is turned off, size is merely an initial hint and the
// buffer will grow on demand
void aom_buf_ans_alloc(struct BufAnsCoder *c,
struct aom_internal_error_info *error);
void aom_buf_ans_free(struct BufAnsCoder *c);
#if !ANS_MAX_SYMBOLS
void aom_buf_ans_grow(struct BufAnsCoder *c);
#endif
void aom_buf_ans_flush(struct BufAnsCoder *const c);
static INLINE void buf_ans_write_init(struct BufAnsCoder *const c,
uint8_t *const output_buffer) {
c->offset = 0;
c->output_bytes = 0;
ans_write_init(&c->ans, output_buffer);
}
static INLINE void buf_rabs_write(struct BufAnsCoder *const c, uint8_t val,
AnsP8 prob) {
assert(c->offset <= c->size);
#if !ANS_MAX_SYMBOLS
if (c->offset == c->size) {
aom_buf_ans_grow(c);
}
#endif
c->buf[c->offset].method = ANS_METHOD_RABS;
c->buf[c->offset].val_start = val;
c->buf[c->offset].prob = prob;
++c->offset;
#if ANS_MAX_SYMBOLS
if (c->offset == c->size) aom_buf_ans_flush(c);
#endif
}
// Buffer one symbol for encoding using rANS.
// cum_prob: The cumulative probability before this symbol (the offset of
// the symbol in the symbol cycle)
// prob: The probability of this symbol (l_s from the paper)
// RANS_PRECISION takes the place of m from the paper.
static INLINE void buf_rans_write(struct BufAnsCoder *const c,
aom_cdf_prob cum_prob, aom_cdf_prob prob) {
assert(c->offset <= c->size);
#if !ANS_MAX_SYMBOLS
if (c->offset == c->size) {
aom_buf_ans_grow(c);
}
#endif
c->buf[c->offset].method = ANS_METHOD_RANS;
c->buf[c->offset].val_start = cum_prob;
c->buf[c->offset].prob = prob;
++c->offset;
#if ANS_MAX_SYMBOLS
if (c->offset == c->size) aom_buf_ans_flush(c);
#endif
}
static INLINE void buf_rabs_write_bit(struct BufAnsCoder *c, int bit) {
buf_rabs_write(c, bit, 128);
}
static INLINE void buf_rabs_write_literal(struct BufAnsCoder *c, int literal,
int bits) {
int bit;
assert(bits < 31);
for (bit = bits - 1; bit >= 0; bit--)
buf_rabs_write_bit(c, 1 & (literal >> bit));
}
static INLINE int buf_ans_write_end(struct BufAnsCoder *const c) {
assert(c->offset == 0);
return c->output_bytes;
}
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // AOM_AOM_DSP_BUF_ANS_H_

View file

@ -1,156 +0,0 @@
/*
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
* was not distributed with this source code in the LICENSE file, you can
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#ifndef AOM_AOM_DSP_DAALABOOLREADER_H_
#define AOM_AOM_DSP_DAALABOOLREADER_H_
#include "aom/aom_integer.h"
#include "aom_dsp/entdec.h"
#include "aom_dsp/prob.h"
#if CONFIG_ACCOUNTING
#include "av1/decoder/accounting.h"
#endif
#if CONFIG_BITSTREAM_DEBUG
#include <stdio.h>
#include "aom_util/debug_util.h"
#endif // CONFIG_BITSTREAM_DEBUG
#ifdef __cplusplus
extern "C" {
#endif
struct daala_reader {
const uint8_t *buffer;
const uint8_t *buffer_end;
od_ec_dec ec;
#if CONFIG_ACCOUNTING
Accounting *accounting;
#endif
uint8_t allow_update_cdf;
};
typedef struct daala_reader daala_reader;
int aom_daala_reader_init(daala_reader *r, const uint8_t *buffer, int size);
const uint8_t *aom_daala_reader_find_begin(daala_reader *r);
const uint8_t *aom_daala_reader_find_end(daala_reader *r);
uint32_t aom_daala_reader_tell(const daala_reader *r);
uint32_t aom_daala_reader_tell_frac(const daala_reader *r);
// Returns true if the reader has tried to decode more data from the buffer
// than was actually provided.
int aom_daala_reader_has_overflowed(const daala_reader *r);
static INLINE int aom_daala_read(daala_reader *r, int prob) {
int bit;
int p = (0x7FFFFF - (prob << 15) + prob) >> 8;
#if CONFIG_BITSTREAM_DEBUG
/*{
const int queue_r = bitstream_queue_get_read();
const int frame_idx = aom_bitstream_queue_get_frame_read();
if (frame_idx == 0 && queue_r == 0) {
fprintf(stderr, "\n *** bitstream queue at frame_idx_r %d queue_r %d\n",
frame_idx, queue_r);
}
}*/
#endif
bit = od_ec_decode_bool_q15(&r->ec, p);
#if CONFIG_BITSTREAM_DEBUG
{
int i;
int ref_bit, ref_nsymbs;
aom_cdf_prob ref_cdf[16];
const int queue_r = bitstream_queue_get_read();
const int frame_idx = aom_bitstream_queue_get_frame_read();
bitstream_queue_pop(&ref_bit, ref_cdf, &ref_nsymbs);
if (ref_nsymbs != 2) {
fprintf(stderr,
"\n *** [bit] nsymbs error, frame_idx_r %d nsymbs %d ref_nsymbs "
"%d queue_r %d\n",
frame_idx, 2, ref_nsymbs, queue_r);
assert(0);
}
if ((ref_nsymbs != 2) || (ref_cdf[0] != (aom_cdf_prob)p) ||
(ref_cdf[1] != 32767)) {
fprintf(stderr,
"\n *** [bit] cdf error, frame_idx_r %d cdf {%d, %d} ref_cdf {%d",
frame_idx, p, 32767, ref_cdf[0]);
for (i = 1; i < ref_nsymbs; ++i) fprintf(stderr, ", %d", ref_cdf[i]);
fprintf(stderr, "} queue_r %d\n", queue_r);
assert(0);
}
if (bit != ref_bit) {
fprintf(stderr,
"\n *** [bit] symb error, frame_idx_r %d symb %d ref_symb %d "
"queue_r %d\n",
frame_idx, bit, ref_bit, queue_r);
assert(0);
}
}
#endif
return bit;
}
static INLINE int daala_read_symbol(daala_reader *r, const aom_cdf_prob *cdf,
int nsymbs) {
int symb;
assert(cdf != NULL);
symb = od_ec_decode_cdf_q15(&r->ec, cdf, nsymbs);
#if CONFIG_BITSTREAM_DEBUG
{
int i;
int cdf_error = 0;
int ref_symb, ref_nsymbs;
aom_cdf_prob ref_cdf[16];
const int queue_r = bitstream_queue_get_read();
const int frame_idx = aom_bitstream_queue_get_frame_read();
bitstream_queue_pop(&ref_symb, ref_cdf, &ref_nsymbs);
if (nsymbs != ref_nsymbs) {
fprintf(stderr,
"\n *** nsymbs error, frame_idx_r %d nsymbs %d ref_nsymbs %d "
"queue_r %d\n",
frame_idx, nsymbs, ref_nsymbs, queue_r);
cdf_error = 0;
assert(0);
} else {
for (i = 0; i < nsymbs; ++i)
if (cdf[i] != ref_cdf[i]) cdf_error = 1;
}
if (cdf_error) {
fprintf(stderr, "\n *** cdf error, frame_idx_r %d cdf {%d", frame_idx,
cdf[0]);
for (i = 1; i < nsymbs; ++i) fprintf(stderr, ", %d", cdf[i]);
fprintf(stderr, "} ref_cdf {%d", ref_cdf[0]);
for (i = 1; i < ref_nsymbs; ++i) fprintf(stderr, ", %d", ref_cdf[i]);
fprintf(stderr, "} queue_r %d\n", queue_r);
assert(0);
}
if (symb != ref_symb) {
fprintf(
stderr,
"\n *** symb error, frame_idx_r %d symb %d ref_symb %d queue_r %d\n",
frame_idx, symb, ref_symb, queue_r);
assert(0);
}
}
#endif
return symb;
}
#ifdef __cplusplus
} // extern "C"
#endif
#endif // AOM_AOM_DSP_DAALABOOLREADER_H_

View file

@ -1,78 +0,0 @@
/*
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
* was not distributed with this source code in the LICENSE file, you can
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#ifndef AOM_AOM_DSP_DAALABOOLWRITER_H_
#define AOM_AOM_DSP_DAALABOOLWRITER_H_
#include <stdio.h>
#include "aom_dsp/entenc.h"
#include "aom_dsp/prob.h"
#if CONFIG_BITSTREAM_DEBUG
#include "aom_util/debug_util.h"
#endif // CONFIG_BITSTREAM_DEBUG
#ifdef __cplusplus
extern "C" {
#endif
struct daala_writer {
unsigned int pos;
uint8_t *buffer;
od_ec_enc ec;
uint8_t allow_update_cdf;
};
typedef struct daala_writer daala_writer;
void aom_daala_start_encode(daala_writer *w, uint8_t *buffer);
int aom_daala_stop_encode(daala_writer *w);
static INLINE void aom_daala_write(daala_writer *w, int bit, int prob) {
int p = (0x7FFFFF - (prob << 15) + prob) >> 8;
#if CONFIG_BITSTREAM_DEBUG
aom_cdf_prob cdf[2] = { (aom_cdf_prob)p, 32767 };
/*int queue_r = 0;
int frame_idx_r = 0;
int queue_w = bitstream_queue_get_write();
int frame_idx_w = aom_bitstream_queue_get_frame_writee();
if (frame_idx_w == frame_idx_r && queue_w == queue_r) {
fprintf(stderr, "\n *** bitstream queue at frame_idx_w %d queue_w %d\n",
frame_idx_w, queue_w);
}*/
bitstream_queue_push(bit, cdf, 2);
#endif
od_ec_encode_bool_q15(&w->ec, bit, p);
}
static INLINE void daala_write_symbol(daala_writer *w, int symb,
const aom_cdf_prob *cdf, int nsymbs) {
#if CONFIG_BITSTREAM_DEBUG
/*int queue_r = 0;
int frame_idx_r = 0;
int queue_w = bitstream_queue_get_write();
int frame_idx_w = aom_bitstream_queue_get_frame_writee();
if (frame_idx_w == frame_idx_r && queue_w == queue_r) {
fprintf(stderr, "\n *** bitstream queue at frame_idx_w %d queue_w %d\n",
frame_idx_w, queue_w);
}*/
bitstream_queue_push(symb, cdf, nsymbs);
#endif
od_ec_encode_cdf_q15(&w->ec, symb, cdf, nsymbs);
}
#ifdef __cplusplus
} // extern "C"
#endif
#endif // AOM_AOM_DSP_DAALABOOLWRITER_H_

View file

@ -13,6 +13,130 @@
#include "aom_dsp/txfm_common.h"
#include "config/aom_dsp_rtcd.h"
void aom_fdct4x4_c(const int16_t *input, tran_low_t *output, int stride) {
// The 2D transform is done with two passes which are actually pretty
// similar. In the first one, we transform the columns and transpose
// the results. In the second one, we transform the rows. To achieve that,
// as the first pass results are transposed, we transpose the columns (that
// is the transposed rows) and transpose the results (so that it goes back
// in normal/row positions).
// We need an intermediate buffer between passes.
tran_low_t intermediate[4 * 4];
const tran_low_t *in_low = NULL;
tran_low_t *out = intermediate;
// Do the two transform/transpose passes
for (int pass = 0; pass < 2; ++pass) {
tran_high_t in_high[4]; // canbe16
tran_high_t step[4]; // canbe16
tran_high_t temp1, temp2; // needs32
for (int i = 0; i < 4; ++i) {
// Load inputs.
if (pass == 0) {
in_high[0] = input[0 * stride] * 16;
in_high[1] = input[1 * stride] * 16;
in_high[2] = input[2 * stride] * 16;
in_high[3] = input[3 * stride] * 16;
if (i == 0 && in_high[0]) {
++in_high[0];
}
} else {
assert(in_low != NULL);
in_high[0] = in_low[0 * 4];
in_high[1] = in_low[1 * 4];
in_high[2] = in_low[2 * 4];
in_high[3] = in_low[3 * 4];
++in_low;
}
// Transform.
step[0] = in_high[0] + in_high[3];
step[1] = in_high[1] + in_high[2];
step[2] = in_high[1] - in_high[2];
step[3] = in_high[0] - in_high[3];
temp1 = (step[0] + step[1]) * cospi_16_64;
temp2 = (step[0] - step[1]) * cospi_16_64;
out[0] = (tran_low_t)fdct_round_shift(temp1);
out[2] = (tran_low_t)fdct_round_shift(temp2);
temp1 = step[2] * cospi_24_64 + step[3] * cospi_8_64;
temp2 = -step[2] * cospi_8_64 + step[3] * cospi_24_64;
out[1] = (tran_low_t)fdct_round_shift(temp1);
out[3] = (tran_low_t)fdct_round_shift(temp2);
// Do next column (which is a transposed row in second/horizontal pass)
++input;
out += 4;
}
// Setup in/out for next pass.
in_low = intermediate;
out = output;
}
for (int i = 0; i < 4; ++i) {
for (int j = 0; j < 4; ++j)
output[j + i * 4] = (output[j + i * 4] + 1) >> 2;
}
}
void aom_fdct4x4_lp_c(const int16_t *input, int16_t *output, int stride) {
// The 2D transform is done with two passes which are actually pretty
// similar. In the first one, we transform the columns and transpose
// the results. In the second one, we transform the rows. To achieve that,
// as the first pass results are transposed, we transpose the columns (that
// is the transposed rows) and transpose the results (so that it goes back
// in normal/row positions).
// We need an intermediate buffer between passes.
int16_t intermediate[4 * 4];
const int16_t *in_low = NULL;
int16_t *out = intermediate;
// Do the two transform/transpose passes
for (int pass = 0; pass < 2; ++pass) {
int32_t in_high[4]; // canbe16
int32_t step[4]; // canbe16
int32_t temp1, temp2; // needs32
for (int i = 0; i < 4; ++i) {
// Load inputs.
if (pass == 0) {
in_high[0] = input[0 * stride] * 16;
in_high[1] = input[1 * stride] * 16;
in_high[2] = input[2 * stride] * 16;
in_high[3] = input[3 * stride] * 16;
if (i == 0 && in_high[0]) {
++in_high[0];
}
} else {
assert(in_low != NULL);
in_high[0] = in_low[0 * 4];
in_high[1] = in_low[1 * 4];
in_high[2] = in_low[2 * 4];
in_high[3] = in_low[3 * 4];
++in_low;
}
// Transform.
step[0] = in_high[0] + in_high[3];
step[1] = in_high[1] + in_high[2];
step[2] = in_high[1] - in_high[2];
step[3] = in_high[0] - in_high[3];
temp1 = (step[0] + step[1]) * (int32_t)cospi_16_64;
temp2 = (step[0] - step[1]) * (int32_t)cospi_16_64;
out[0] = (int16_t)fdct_round_shift(temp1);
out[2] = (int16_t)fdct_round_shift(temp2);
temp1 = step[2] * (int32_t)cospi_24_64 + step[3] * (int32_t)cospi_8_64;
temp2 = -step[2] * (int32_t)cospi_8_64 + step[3] * (int32_t)cospi_24_64;
out[1] = (int16_t)fdct_round_shift(temp1);
out[3] = (int16_t)fdct_round_shift(temp2);
// Do next column (which is a transposed row in second/horizontal pass)
++input;
out += 4;
}
// Setup in/out for next pass.
in_low = intermediate;
out = output;
}
for (int i = 0; i < 4; ++i) {
for (int j = 0; j < 4; ++j)
output[j + i * 4] = (output[j + i * 4] + 1) >> 2;
}
}
void aom_fdct8x8_c(const int16_t *input, tran_low_t *final_output, int stride) {
int i, j;
tran_low_t intermediate[64];

View file

@ -1,61 +0,0 @@
/*
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
* was not distributed with this source code in the LICENSE file, you can
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#include <stdlib.h>
#include "aom_dsp/mips/macros_msa.h"
void aom_plane_add_noise_msa(uint8_t *start_ptr, char *noise,
char blackclamp[16], char whiteclamp[16],
char bothclamp[16], uint32_t width,
uint32_t height, int32_t pitch) {
uint32_t i, j;
for (i = 0; i < height / 2; ++i) {
uint8_t *pos0_ptr = start_ptr + (2 * i) * pitch;
int8_t *ref0_ptr = (int8_t *)(noise + (rand() & 0xff));
uint8_t *pos1_ptr = start_ptr + (2 * i + 1) * pitch;
int8_t *ref1_ptr = (int8_t *)(noise + (rand() & 0xff));
for (j = width / 16; j--;) {
v16i8 temp00_s, temp01_s;
v16u8 temp00, temp01, black_clamp, white_clamp;
v16u8 pos0, ref0, pos1, ref1;
v16i8 const127 = __msa_ldi_b(127);
pos0 = LD_UB(pos0_ptr);
ref0 = LD_UB(ref0_ptr);
pos1 = LD_UB(pos1_ptr);
ref1 = LD_UB(ref1_ptr);
black_clamp = (v16u8)__msa_fill_b(blackclamp[0]);
white_clamp = (v16u8)__msa_fill_b(whiteclamp[0]);
temp00 = (pos0 < black_clamp);
pos0 = __msa_bmnz_v(pos0, black_clamp, temp00);
temp01 = (pos1 < black_clamp);
pos1 = __msa_bmnz_v(pos1, black_clamp, temp01);
XORI_B2_128_UB(pos0, pos1);
temp00_s = __msa_adds_s_b((v16i8)white_clamp, const127);
temp00 = (v16u8)(temp00_s < pos0);
pos0 = (v16u8)__msa_bmnz_v((v16u8)pos0, (v16u8)temp00_s, temp00);
temp01_s = __msa_adds_s_b((v16i8)white_clamp, const127);
temp01 = (temp01_s < pos1);
pos1 = (v16u8)__msa_bmnz_v((v16u8)pos1, (v16u8)temp01_s, temp01);
XORI_B2_128_UB(pos0, pos1);
pos0 += ref0;
ST_UB(pos0, pos0_ptr);
pos1 += ref1;
ST_UB(pos1, pos1_ptr);
pos0_ptr += 16;
pos1_ptr += 16;
ref0_ptr += 16;
ref1_ptr += 16;
}
}
}

View file

@ -446,7 +446,6 @@ static void common_hz_2t_8x8mult_msa(const uint8_t *src, int32_t src_stride,
vec2, vec3);
SRARI_H4_UH(vec0, vec1, vec2, vec3, FILTER_BITS);
LD_SB4(src, src_stride, src0, src1, src2, src3);
src += (4 * src_stride);
PCKEV_B2_SB(vec1, vec0, vec3, vec2, out0, out1);
ST8x4_UB(out0, out1, dst, dst_stride);

View file

@ -313,7 +313,6 @@ static void common_vt_2t_4x4_msa(const uint8_t *src, int32_t src_stride,
filt0 = (v16u8)__msa_splati_h(filt, 0);
LD_SB5(src, src_stride, src0, src1, src2, src3, src4);
src += (5 * src_stride);
ILVR_B4_SB(src1, src0, src2, src1, src3, src2, src4, src3, src10_r, src21_r,
src32_r, src43_r);
@ -341,7 +340,6 @@ static void common_vt_2t_4x8_msa(const uint8_t *src, int32_t src_stride,
src += (8 * src_stride);
src8 = LD_SB(src);
src += src_stride;
ILVR_B4_SB(src1, src0, src2, src1, src3, src2, src4, src3, src10_r, src21_r,
src32_r, src43_r);

View file

@ -636,10 +636,12 @@ int aom_flat_block_finder_run(const aom_flat_block_finder_t *block_finder,
// [{var}, {ratio}, {trace}, {norm}, offset]
// with one of the most discriminative being simply the variance.
const double weights[5] = { -6682, -0.2056, 13087, -12434, 2.5694 };
const float score =
(float)(1.0 / (1 + exp(-(weights[0] * var + weights[1] * ratio +
weights[2] * trace + weights[3] * norm +
weights[4]))));
double sum_weights = weights[0] * var + weights[1] * ratio +
weights[2] * trace + weights[3] * norm +
weights[4];
// clamp the value to [-25.0, 100.0] to prevent overflow
sum_weights = fclamp(sum_weights, -25.0, 100.0);
const float score = (float)(1.0 / (1 + exp(-sum_weights)));
flat_blocks[by * num_blocks_w + bx] = is_flat ? 255 : 0;
scores[by * num_blocks_w + bx].score = var > kVarThreshold ? score : 0;
scores[by * num_blocks_w + bx].index = by * num_blocks_w + bx;

View file

@ -1,26 +0,0 @@
/*
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
* was not distributed with this source code in the LICENSE file, you can
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#ifndef AOM_AOM_DSP_POSTPROC_H_
#define AOM_AOM_DSP_POSTPROC_H_
#ifdef __cplusplus
extern "C" {
#endif
// Fills a noise buffer with gaussian noise strength determined by sigma.
int aom_setup_noise(double sigma, int size, char *noise);
#ifdef __cplusplus
}
#endif
#endif // AOM_AOM_DSP_POSTPROC_H_

View file

@ -26,7 +26,6 @@
extern "C" {
#endif
// TODO(negge): Rename this aom_prob once we remove vpxbool.
typedef uint16_t aom_cdf_prob;
#define CDF_SIZE(x) ((x) + 1)

View file

@ -26,9 +26,6 @@ double aom_sse_to_psnr(double samples, double peak, double sse) {
}
}
/* TODO(yaowu): The block_variance calls the unoptimized versions of variance()
* and highbd_8_variance(). It should not.
*/
static void encoder_variance(const uint8_t *a, int a_stride, const uint8_t *b,
int b_stride, int w, int h, unsigned int *sse,
int *sum) {
@ -179,6 +176,27 @@ static int64_t highbd_get_sse(const uint8_t *a, int a_stride, const uint8_t *b,
}
#endif // CONFIG_AV1_HIGHBITDEPTH
uint64_t aom_get_y_var(const YV12_BUFFER_CONFIG *a, int hstart, int width,
int vstart, int height) {
return aom_var_2d_u8(a->y_buffer + vstart * a->y_stride + hstart, a->y_stride,
width, height) /
(width * height);
}
uint64_t aom_get_u_var(const YV12_BUFFER_CONFIG *a, int hstart, int width,
int vstart, int height) {
return aom_var_2d_u8(a->u_buffer + vstart * a->uv_stride + hstart,
a->uv_stride, width, height) /
(width * height);
}
uint64_t aom_get_v_var(const YV12_BUFFER_CONFIG *a, int hstart, int width,
int vstart, int height) {
return aom_var_2d_u8(a->v_buffer + vstart * a->uv_stride + hstart,
a->uv_stride, width, height) /
(width * height);
}
int64_t aom_get_y_sse_part(const YV12_BUFFER_CONFIG *a,
const YV12_BUFFER_CONFIG *b, int hstart, int width,
int vstart, int height) {
@ -231,6 +249,27 @@ int64_t aom_get_v_sse(const YV12_BUFFER_CONFIG *a,
}
#if CONFIG_AV1_HIGHBITDEPTH
uint64_t aom_highbd_get_y_var(const YV12_BUFFER_CONFIG *a, int hstart,
int width, int vstart, int height) {
return aom_var_2d_u16(a->y_buffer + vstart * a->y_stride + hstart,
a->y_stride, width, height) /
(width * height);
}
uint64_t aom_highbd_get_u_var(const YV12_BUFFER_CONFIG *a, int hstart,
int width, int vstart, int height) {
return aom_var_2d_u16(a->u_buffer + vstart * a->uv_stride + hstart,
a->uv_stride, width, height) /
(width * height);
}
uint64_t aom_highbd_get_v_var(const YV12_BUFFER_CONFIG *a, int hstart,
int width, int vstart, int height) {
return aom_var_2d_u16(a->v_buffer + vstart * a->uv_stride + hstart,
a->uv_stride, width, height) /
(width * height);
}
int64_t aom_highbd_get_y_sse_part(const YV12_BUFFER_CONFIG *a,
const YV12_BUFFER_CONFIG *b, int hstart,
int width, int vstart, int height) {

View file

@ -35,6 +35,12 @@ typedef struct {
* \param[in] sse Sum of squared errors
*/
double aom_sse_to_psnr(double samples, double peak, double sse);
uint64_t aom_get_y_var(const YV12_BUFFER_CONFIG *a, int hstart, int width,
int vstart, int height);
uint64_t aom_get_u_var(const YV12_BUFFER_CONFIG *a, int hstart, int width,
int vstart, int height);
uint64_t aom_get_v_var(const YV12_BUFFER_CONFIG *a, int hstart, int width,
int vstart, int height);
int64_t aom_get_y_sse_part(const YV12_BUFFER_CONFIG *a,
const YV12_BUFFER_CONFIG *b, int hstart, int width,
int vstart, int height);
@ -50,6 +56,12 @@ int64_t aom_get_v_sse(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b);
int64_t aom_get_sse_plane(const YV12_BUFFER_CONFIG *a,
const YV12_BUFFER_CONFIG *b, int plane, int highbd);
#if CONFIG_AV1_HIGHBITDEPTH
uint64_t aom_highbd_get_y_var(const YV12_BUFFER_CONFIG *a, int hstart,
int width, int vstart, int height);
uint64_t aom_highbd_get_u_var(const YV12_BUFFER_CONFIG *a, int hstart,
int width, int vstart, int height);
uint64_t aom_highbd_get_v_var(const YV12_BUFFER_CONFIG *a, int hstart,
int width, int vstart, int height);
int64_t aom_highbd_get_y_sse_part(const YV12_BUFFER_CONFIG *a,
const YV12_BUFFER_CONFIG *b, int hstart,
int width, int vstart, int height);

View file

@ -102,13 +102,8 @@ static const double csf_cr420[8][8] = {
0.478717061273, 0.393021669543, 0.330555063063, 0.285345396658 }
};
static double convert_score_db(double _score, double _weight, int bit_depth) {
int16_t pix_max = 255;
static double convert_score_db(double _score, double _weight, int16_t pix_max) {
assert(_score * _weight >= 0.0);
if (bit_depth == 10)
pix_max = 1023;
else if (bit_depth == 12)
pix_max = 4095;
if (_weight * _score < pix_max * pix_max * 1e-10) return MAX_PSNR;
return 10 * (log10(pix_max * pix_max) - log10(_weight * _score));
@ -117,7 +112,8 @@ static double convert_score_db(double _score, double _weight, int bit_depth) {
static double calc_psnrhvs(const unsigned char *src, int _systride,
const unsigned char *dst, int _dystride, double _par,
int _w, int _h, int _step, const double _csf[8][8],
uint32_t _shift, int buf_is_hbd) {
uint32_t _shift, int buf_is_hbd, int16_t pix_max,
int luma) {
double ret;
const uint8_t *_src8 = src;
const uint8_t *_dst8 = dst;
@ -148,7 +144,7 @@ static double calc_psnrhvs(const unsigned char *src, int _systride,
}
}
}
delt = (sum1 - sum2) / (_w * _h);
if (luma) delt = (sum1 - sum2) / (_w * _h);
/*In the PSNR-HVS-M paper[1] the authors describe the construction of
their masking table as "we have used the quantization table for the
color component Y of JPEG [6] that has been also obtained on the
@ -177,21 +173,15 @@ static double calc_psnrhvs(const unsigned char *src, int _systride,
for (x = 0; x < _w - 7; x += _step) {
int i;
int j;
double s_means[4];
double d_means[4];
double s_vars[4];
double d_vars[4];
int n = 0;
double s_gx = 0;
double s_gy = 0;
double g = 0;
double s_gmean = 0;
double d_gmean = 0;
double s_gvar = 0;
double d_gvar = 0;
double s_mask = 0;
double d_mask = 0;
for (i = 0; i < 4; i++)
s_means[i] = d_means[i] = s_vars[i] = d_vars[i] = 0;
for (i = 0; i < 8; i++) {
for (j = 0; j < 8; j++) {
int sub = ((i & 12) >> 2) + ((j & 12) >> 1);
if (!buf_is_hbd) {
dct_s[i * 8 + j] = _src8[(y + i) * _systride + (j + x)];
dct_d[i * 8 + j] = _dst8[(y + i) * _dystride + (j + x)];
@ -200,35 +190,26 @@ static double calc_psnrhvs(const unsigned char *src, int _systride,
dct_d[i * 8 + j] = _dst16[(y + i) * _dystride + (j + x)] >> _shift;
}
dct_d[i * 8 + j] += (int)(delt + 0.5f);
s_gmean += dct_s[i * 8 + j];
d_gmean += dct_d[i * 8 + j];
s_means[sub] += dct_s[i * 8 + j];
d_means[sub] += dct_d[i * 8 + j];
}
}
s_gmean /= 64.f;
d_gmean /= 64.f;
for (i = 0; i < 4; i++) s_means[i] /= 16.f;
for (i = 0; i < 4; i++) d_means[i] /= 16.f;
for (i = 0; i < 8; i++) {
for (j = 0; j < 8; j++) {
int sub = ((i & 12) >> 2) + ((j & 12) >> 1);
s_gvar += (dct_s[i * 8 + j] - s_gmean) * (dct_s[i * 8 + j] - s_gmean);
d_gvar += (dct_d[i * 8 + j] - d_gmean) * (dct_d[i * 8 + j] - d_gmean);
s_vars[sub] += (dct_s[i * 8 + j] - s_means[sub]) *
(dct_s[i * 8 + j] - s_means[sub]);
d_vars[sub] += (dct_d[i * 8 + j] - d_means[sub]) *
(dct_d[i * 8 + j] - d_means[sub]);
for (i = 1; i < 7; i++) {
for (j = 1; j < 7; j++) {
s_gx = (dct_s[(i - 1) * 8 + j - 1] * 3 -
dct_s[(i - 1) * 8 + j + 1] * 3 + dct_s[i * 8 + j - 1] * 10 -
dct_s[i * 8 + j + 1] * 10 + dct_s[(i + 1) * 8 + j - 1] * 3 -
dct_s[(i + 1) * 8 + j + 1] * 3) /
(pix_max * 16.f);
s_gy = (dct_s[(i - 1) * 8 + j - 1] * 3 -
dct_s[(i + 1) * 8 + j - 1] * 3 + dct_s[(i - 1) * 8 + j] * 10 -
dct_s[(i + 1) * 8 + j] * 10 + dct_s[(i - 1) * 8 + j + 1] * 3 -
dct_s[(i + 1) * 8 + j + 1] * 3) /
(pix_max * 16.f);
g = sqrt(s_gx * s_gx + s_gy * s_gy);
if (g > 0.1f) n++;
s_gmean += g;
}
}
s_gvar *= 1 / 63.f * 64;
d_gvar *= 1 / 63.f * 64;
for (i = 0; i < 4; i++) s_vars[i] *= 1 / 15.f * 16;
for (i = 0; i < 4; i++) d_vars[i] *= 1 / 15.f * 16;
if (s_gvar > 0)
s_gvar = (s_vars[0] + s_vars[1] + s_vars[2] + s_vars[3]) / s_gvar;
if (d_gvar > 0)
d_gvar = (d_vars[0] + d_vars[1] + d_vars[2] + d_vars[3]) / d_gvar;
s_gvar = 1.f / (36 - n + 1) * s_gmean / 36.f;
if (!buf_is_hbd) {
od_bin_fdct8x8(dct_s_coef, 8, dct_s, 8);
od_bin_fdct8x8(dct_d_coef, 8, dct_d, 8);
@ -239,12 +220,7 @@ static double calc_psnrhvs(const unsigned char *src, int _systride,
for (i = 0; i < 8; i++)
for (j = (i == 0); j < 8; j++)
s_mask += dct_s_coef[i * 8 + j] * dct_s_coef[i * 8 + j] * mask[i][j];
for (i = 0; i < 8; i++)
for (j = (i == 0); j < 8; j++)
d_mask += dct_d_coef[i * 8 + j] * dct_d_coef[i * 8 + j] * mask[i][j];
s_mask = sqrt(s_mask * s_gvar) / 32.f;
d_mask = sqrt(d_mask * d_gvar) / 32.f;
if (d_mask > s_mask) s_mask = d_mask;
s_mask = sqrt(s_mask * s_gvar) / 8.f;
for (i = 0; i < 8; i++) {
for (j = 0; j < 8; j++) {
double err;
@ -276,19 +252,26 @@ double aom_psnrhvs(const YV12_BUFFER_CONFIG *src, const YV12_BUFFER_CONFIG *dst,
assert(src->flags == dst->flags);
const int buf_is_hbd = src->flags & YV12_FLAG_HIGHBITDEPTH;
int16_t pix_max = 255;
if (in_bd == 10)
pix_max = 1023;
else if (in_bd == 12)
pix_max = 4095;
bd_shift = bd - in_bd;
*y_psnrhvs = calc_psnrhvs(
src->y_buffer, src->y_stride, dst->y_buffer, dst->y_stride, par,
src->y_crop_width, src->y_crop_height, step, csf_y, bd_shift, buf_is_hbd);
*y_psnrhvs =
calc_psnrhvs(src->y_buffer, src->y_stride, dst->y_buffer, dst->y_stride,
par, src->y_crop_width, src->y_crop_height, step, csf_y,
bd_shift, buf_is_hbd, pix_max, 1);
*u_psnrhvs =
calc_psnrhvs(src->u_buffer, src->uv_stride, dst->u_buffer, dst->uv_stride,
par, src->uv_crop_width, src->uv_crop_height, step,
csf_cb420, bd_shift, buf_is_hbd);
csf_cb420, bd_shift, buf_is_hbd, pix_max, 0);
*v_psnrhvs =
calc_psnrhvs(src->v_buffer, src->uv_stride, dst->v_buffer, dst->uv_stride,
par, src->uv_crop_width, src->uv_crop_height, step,
csf_cr420, bd_shift, buf_is_hbd);
csf_cr420, bd_shift, buf_is_hbd, pix_max, 0);
psnrhvs = (*y_psnrhvs) * .8 + .1 * ((*u_psnrhvs) + (*v_psnrhvs));
return convert_score_db(psnrhvs, 1.0, in_bd);
return convert_score_db(psnrhvs, 1.0, pix_max);
}

View file

@ -54,7 +54,7 @@ void aom_quantize_b_adaptive_helper_c(
for (i = 0; i < non_zero_count; i++) {
const int rc = scan[i];
const int coeff = coeff_ptr[rc];
const int coeff_sign = (coeff >> 31);
const int coeff_sign = AOMSIGN(coeff);
const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
int tmp32;
@ -140,7 +140,7 @@ void aom_quantize_b_helper_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
for (i = 0; i < non_zero_count; i++) {
const int rc = scan[i];
const int coeff = coeff_ptr[rc];
const int coeff_sign = (coeff >> 31);
const int coeff_sign = AOMSIGN(coeff);
const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
int tmp32;
@ -209,7 +209,7 @@ void aom_highbd_quantize_b_adaptive_helper_c(
for (i = 0; i < non_zero_count; i++) {
const int rc = scan[i];
const int coeff = coeff_ptr[rc];
const int coeff_sign = (coeff >> 31);
const int coeff_sign = AOMSIGN(coeff);
const qm_val_t wt = qm_ptr != NULL ? qm_ptr[rc] : (1 << AOM_QM_BITS);
const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
if (abs_coeff * wt >= (zbins[rc != 0] << AOM_QM_BITS)) {
@ -292,7 +292,7 @@ void aom_highbd_quantize_b_helper_c(
for (i = 0; i < idx; i++) {
const int rc = scan[idx_arr[i]];
const int coeff = coeff_ptr[rc];
const int coeff_sign = (coeff >> 31);
const int coeff_sign = AOMSIGN(coeff);
const qm_val_t wt = qm_ptr != NULL ? qm_ptr[rc] : (1 << AOM_QM_BITS);
const qm_val_t iwt = iqm_ptr != NULL ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;

View file

@ -64,15 +64,24 @@ static INLINE unsigned int sad(const uint8_t *a, int a_stride, const uint8_t *b,
}
// Calculate sad against 4 reference locations and store each in sad_array
#define sadMxNx4D(m, n) \
void aom_sad##m##x##n##x4d_c(const uint8_t *src, int src_stride, \
const uint8_t *const ref_array[], \
int ref_stride, uint32_t *sad_array) { \
int i; \
for (i = 0; i < 4; ++i) { \
sad_array[i] = \
aom_sad##m##x##n##_c(src, src_stride, ref_array[i], ref_stride); \
} \
#define sadMxNx4D(m, n) \
void aom_sad##m##x##n##x4d_c(const uint8_t *src, int src_stride, \
const uint8_t *const ref_array[], \
int ref_stride, uint32_t *sad_array) { \
int i; \
for (i = 0; i < 4; ++i) { \
sad_array[i] = \
aom_sad##m##x##n##_c(src, src_stride, ref_array[i], ref_stride); \
} \
} \
void aom_sad##m##x##n##x4d_avg_c( \
const uint8_t *src, int src_stride, const uint8_t *const ref_array[], \
int ref_stride, const uint8_t *second_pred, uint32_t *sad_array) { \
int i; \
for (i = 0; i < 4; ++i) { \
sad_array[i] = aom_sad##m##x##n##_avg_c(src, src_stride, ref_array[i], \
ref_stride, second_pred); \
} \
}
// 128x128

View file

@ -35,7 +35,6 @@ static INLINE unsigned int masked_sad(const uint8_t *src, int src_stride,
b += b_stride;
m += m_stride;
}
sad = (sad + 31) >> 6;
return sad;
}
@ -50,6 +49,21 @@ static INLINE unsigned int masked_sad(const uint8_t *src, int src_stride,
else \
return masked_sad(src, src_stride, second_pred, m, ref, ref_stride, msk, \
msk_stride, m, n); \
} \
void aom_masked_sad##m##x##n##x4d_c( \
const uint8_t *src, int src_stride, const uint8_t *ref[], \
int ref_stride, const uint8_t *second_pred, const uint8_t *msk, \
int msk_stride, int invert_mask, unsigned sads[]) { \
if (!invert_mask) \
for (int i = 0; i < 4; i++) { \
sads[i] = masked_sad(src, src_stride, ref[i], ref_stride, second_pred, \
m, msk, msk_stride, m, n); \
} \
else \
for (int i = 0; i < 4; i++) { \
sads[i] = masked_sad(src, src_stride, second_pred, m, ref[i], \
ref_stride, msk, msk_stride, m, n); \
} \
}
/* clang-format off */
@ -101,7 +115,6 @@ MASKSADMxN(64, 16)
b += b_stride;
m += m_stride;
}
sad = (sad + 31) >> 6;
return sad;
}

View file

@ -54,26 +54,28 @@ SIMD_INLINE v128 v128_align(v128 a, v128 b, unsigned int c) {
return c_v128_align(a, b, c);
}
SIMD_INLINE v128 v128_zero() { return c_v128_zero(); }
SIMD_INLINE v128 v128_zero(void) { return c_v128_zero(); }
SIMD_INLINE v128 v128_dup_8(uint8_t x) { return c_v128_dup_8(x); }
SIMD_INLINE v128 v128_dup_16(uint16_t x) { return c_v128_dup_16(x); }
SIMD_INLINE v128 v128_dup_32(uint32_t x) { return c_v128_dup_32(x); }
SIMD_INLINE v128 v128_dup_64(uint64_t x) { return c_v128_dup_64(x); }
typedef uint32_t sad128_internal;
SIMD_INLINE sad128_internal v128_sad_u8_init() { return c_v128_sad_u8_init(); }
SIMD_INLINE sad128_internal v128_sad_u8(sad128_internal s, v128 a, v128 b) {
SIMD_INLINE c_sad128_internal v128_sad_u8_init(void) {
return c_v128_sad_u8_init();
}
SIMD_INLINE c_sad128_internal v128_sad_u8(c_sad128_internal s, v128 a, v128 b) {
return c_v128_sad_u8(s, a, b);
}
SIMD_INLINE uint32_t v128_sad_u8_sum(sad128_internal s) {
SIMD_INLINE uint32_t v128_sad_u8_sum(c_sad128_internal s) {
return c_v128_sad_u8_sum(s);
}
typedef uint32_t ssd128_internal;
SIMD_INLINE ssd128_internal v128_ssd_u8_init() { return c_v128_ssd_u8_init(); }
SIMD_INLINE ssd128_internal v128_ssd_u8(ssd128_internal s, v128 a, v128 b) {
SIMD_INLINE c_ssd128_internal v128_ssd_u8_init(void) {
return c_v128_ssd_u8_init();
}
SIMD_INLINE c_ssd128_internal v128_ssd_u8(c_ssd128_internal s, v128 a, v128 b) {
return c_v128_ssd_u8(s, a, b);
}
SIMD_INLINE uint32_t v128_ssd_u8_sum(ssd128_internal s) {
SIMD_INLINE uint32_t v128_ssd_u8_sum(c_ssd128_internal s) {
return c_v128_ssd_u8_sum(s);
}
SIMD_INLINE int64_t v128_dotp_su8(v128 a, v128 b) {
@ -318,7 +320,7 @@ SIMD_INLINE v128 v128_shr_n_s64(v128 a, unsigned int n) {
}
typedef uint32_t sad128_internal_u16;
SIMD_INLINE sad128_internal_u16 v128_sad_u16_init() {
SIMD_INLINE sad128_internal_u16 v128_sad_u16_init(void) {
return c_v128_sad_u16_init();
}
SIMD_INLINE sad128_internal_u16 v128_sad_u16(sad128_internal_u16 s, v128 a,
@ -330,7 +332,7 @@ SIMD_INLINE uint32_t v128_sad_u16_sum(sad128_internal_u16 s) {
}
typedef uint64_t ssd128_internal_s16;
SIMD_INLINE ssd128_internal_s16 v128_ssd_s16_init() {
SIMD_INLINE ssd128_internal_s16 v128_ssd_s16_init(void) {
return c_v128_ssd_s16_init();
}
SIMD_INLINE ssd128_internal_s16 v128_ssd_s16(ssd128_internal_s16 s, v128 a,

View file

@ -68,9 +68,11 @@ SIMD_INLINE v128 v128_align(v128 a, v128 b, unsigned int c) {
#endif
}
SIMD_INLINE v128 v128_zero() { return vreinterpretq_s64_u8(vdupq_n_u8(0)); }
SIMD_INLINE v128 v128_zero(void) { return vreinterpretq_s64_u8(vdupq_n_u8(0)); }
SIMD_INLINE v128 v128_ones() { return vreinterpretq_s64_u8(vdupq_n_u8(-1)); }
SIMD_INLINE v128 v128_ones(void) {
return vreinterpretq_s64_u8(vdupq_n_u8(-1));
}
SIMD_INLINE v128 v128_dup_8(uint8_t x) {
return vreinterpretq_s64_u8(vdupq_n_u8(x));
@ -136,7 +138,7 @@ typedef struct {
sad64_internal hi, lo;
} sad128_internal;
SIMD_INLINE sad128_internal v128_sad_u8_init() {
SIMD_INLINE sad128_internal v128_sad_u8_init(void) {
sad128_internal s;
s.hi = s.lo = vdupq_n_u16(0);
return s;
@ -165,7 +167,7 @@ typedef struct {
ssd64_internal hi, lo;
} ssd128_internal;
SIMD_INLINE ssd128_internal v128_ssd_u8_init() {
SIMD_INLINE ssd128_internal v128_ssd_u8_init(void) {
ssd128_internal s;
s.hi = s.lo = v64_ssd_u8_init();
return s;
@ -784,68 +786,79 @@ SIMD_INLINE v128 v128_shl_n_byte(v128 a, unsigned int n) {
}
SIMD_INLINE v128 v128_shr_n_byte(v128 a, unsigned int n) {
return n < 8
? v128_from_64(
(uint64_t)vshr_n_u64(vreinterpret_u64_s64(vget_high_s64(a)),
n * 8),
(uint64_t)vorr_u64(
vshr_n_u64(vreinterpret_u64_s64(vget_low_s64(a)), n * 8),
vshl_n_u64(vreinterpret_u64_s64(vget_high_s64(a)),
(8 - n) * 8)))
: (n == 8 ? v128_from_64(0, (uint64_t)vreinterpret_u64_s64(
vget_high_s64(a)))
: v128_from_64(
0, (uint64_t)vshr_n_u64(
vreinterpret_u64_s64(vget_high_s64(a)),
(n - 8) * 8)));
return n == 0
? a
: (n < 8
? v128_from_64(
(uint64_t)vshr_n_u64(
vreinterpret_u64_s64(vget_high_s64(a)), n * 8),
(uint64_t)vorr_u64(
vshr_n_u64(vreinterpret_u64_s64(vget_low_s64(a)),
n * 8),
vshl_n_u64(vreinterpret_u64_s64(vget_high_s64(a)),
(8 - n) * 8)))
: (n == 8 ? v128_from_64(0, (uint64_t)vreinterpret_u64_s64(
vget_high_s64(a)))
: v128_from_64(0, (uint64_t)vshr_n_u64(
vreinterpret_u64_s64(
vget_high_s64(a)),
(n - 8) * 8))));
}
SIMD_INLINE v128 v128_shl_n_8(v128 a, unsigned int c) {
return vreinterpretq_s64_u8(vshlq_n_u8(vreinterpretq_u8_s64(a), c));
return c ? vreinterpretq_s64_u8(vshlq_n_u8(vreinterpretq_u8_s64(a), c)) : a;
}
SIMD_INLINE v128 v128_shr_n_u8(v128 a, unsigned int c) {
return vreinterpretq_s64_u8(vshrq_n_u8(vreinterpretq_u8_s64(a), c));
return c ? vreinterpretq_s64_u8(vshrq_n_u8(vreinterpretq_u8_s64(a), c)) : a;
}
SIMD_INLINE v128 v128_shr_n_s8(v128 a, unsigned int c) {
return vreinterpretq_s64_s8(vshrq_n_s8(vreinterpretq_s8_s64(a), c));
return c ? vreinterpretq_s64_s8(vshrq_n_s8(vreinterpretq_s8_s64(a), c)) : a;
}
SIMD_INLINE v128 v128_shl_n_16(v128 a, unsigned int c) {
return vreinterpretq_s64_u16(vshlq_n_u16(vreinterpretq_u16_s64(a), c));
return c ? vreinterpretq_s64_u16(vshlq_n_u16(vreinterpretq_u16_s64(a), c))
: a;
}
SIMD_INLINE v128 v128_shr_n_u16(v128 a, unsigned int c) {
return vreinterpretq_s64_u16(vshrq_n_u16(vreinterpretq_u16_s64(a), c));
return c ? vreinterpretq_s64_u16(vshrq_n_u16(vreinterpretq_u16_s64(a), c))
: a;
}
SIMD_INLINE v128 v128_shr_n_s16(v128 a, unsigned int c) {
return vreinterpretq_s64_s16(vshrq_n_s16(vreinterpretq_s16_s64(a), c));
return c ? vreinterpretq_s64_s16(vshrq_n_s16(vreinterpretq_s16_s64(a), c))
: a;
}
SIMD_INLINE v128 v128_shl_n_32(v128 a, unsigned int c) {
return vreinterpretq_s64_u32(vshlq_n_u32(vreinterpretq_u32_s64(a), c));
return c ? vreinterpretq_s64_u32(vshlq_n_u32(vreinterpretq_u32_s64(a), c))
: a;
}
SIMD_INLINE v128 v128_shr_n_u32(v128 a, unsigned int c) {
return vreinterpretq_s64_u32(vshrq_n_u32(vreinterpretq_u32_s64(a), c));
return c ? vreinterpretq_s64_u32(vshrq_n_u32(vreinterpretq_u32_s64(a), c))
: a;
}
SIMD_INLINE v128 v128_shr_n_s32(v128 a, unsigned int c) {
return vreinterpretq_s64_s32(vshrq_n_s32(vreinterpretq_s32_s64(a), c));
return c ? vreinterpretq_s64_s32(vshrq_n_s32(vreinterpretq_s32_s64(a), c))
: a;
}
SIMD_INLINE v128 v128_shl_n_64(v128 a, unsigned int c) {
return vreinterpretq_s64_u64(vshlq_n_u64(vreinterpretq_u64_s64(a), c));
return c ? vreinterpretq_s64_u64(vshlq_n_u64(vreinterpretq_u64_s64(a), c))
: a;
}
SIMD_INLINE v128 v128_shr_n_u64(v128 a, unsigned int c) {
return vreinterpretq_s64_u64(vshrq_n_u64(vreinterpretq_u64_s64(a), c));
return c ? vreinterpretq_s64_u64(vshrq_n_u64(vreinterpretq_u64_s64(a), c))
: a;
}
SIMD_INLINE v128 v128_shr_n_s64(v128 a, unsigned int c) {
return vshrq_n_s64(a, c);
return c ? vshrq_n_s64(a, c) : a;
}
#else
@ -920,7 +933,9 @@ SIMD_INLINE v128 v128_shr_n_s64(v128 a, unsigned int c) {
typedef uint32x4_t sad128_internal_u16;
SIMD_INLINE sad128_internal_u16 v128_sad_u16_init() { return vdupq_n_u32(0); }
SIMD_INLINE sad128_internal_u16 v128_sad_u16_init(void) {
return vdupq_n_u32(0);
}
/* Implementation dependent return value. Result must be finalised with
* v128_sad_u16_sum(). */
@ -939,7 +954,7 @@ SIMD_INLINE uint32_t v128_sad_u16_sum(sad128_internal_u16 s) {
}
typedef v128 ssd128_internal_s16;
SIMD_INLINE ssd128_internal_s16 v128_ssd_s16_init() { return v128_zero(); }
SIMD_INLINE ssd128_internal_s16 v128_ssd_s16_init(void) { return v128_zero(); }
/* Implementation dependent return value. Result must be finalised with
* v128_ssd_s16_sum(). */

View file

@ -93,7 +93,7 @@ SIMD_INLINE void c_v128_store_aligned(void *p, c_v128 a) {
c_v128_store_unaligned(p, a);
}
SIMD_INLINE c_v128 c_v128_zero() {
SIMD_INLINE c_v128 c_v128_zero(void) {
c_v128 t;
t.u64[1] = t.u64[0] = 0;
return t;
@ -145,26 +145,39 @@ SIMD_INLINE uint64_t c_v128_hadd_u8(c_v128 a) {
return c_v64_hadd_u8(a.v64[1]) + c_v64_hadd_u8(a.v64[0]);
}
typedef uint32_t c_sad128_internal;
typedef struct {
uint32_t val;
int count;
} c_sad128_internal;
SIMD_INLINE c_sad128_internal c_v128_sad_u8_init() { return 0; }
SIMD_INLINE c_sad128_internal c_v128_sad_u8_init(void) {
c_sad128_internal t;
t.val = t.count = 0;
return t;
}
/* Implementation dependent return value. Result must be finalised with
v128_sad_u8_sum().
The result for more than 32 v128_sad_u8() calls is undefined. */
* v128_sad_u8_sum(). The result for more than 32 v128_sad_u8() calls is
* undefined. */
SIMD_INLINE c_sad128_internal c_v128_sad_u8(c_sad128_internal s, c_v128 a,
c_v128 b) {
int c;
for (c = 0; c < 16; c++)
s += a.u8[c] > b.u8[c] ? a.u8[c] - b.u8[c] : b.u8[c] - a.u8[c];
s.val += a.u8[c] > b.u8[c] ? a.u8[c] - b.u8[c] : b.u8[c] - a.u8[c];
s.count++;
if (SIMD_CHECK && s.count > 32) {
fprintf(stderr,
"Error: sad called 32 times returning an undefined result\n");
abort();
}
return s;
}
SIMD_INLINE uint32_t c_v128_sad_u8_sum(c_sad128_internal s) { return s; }
SIMD_INLINE uint32_t c_v128_sad_u8_sum(c_sad128_internal s) { return s.val; }
typedef uint32_t c_ssd128_internal;
SIMD_INLINE c_ssd128_internal c_v128_ssd_u8_init() { return 0; }
SIMD_INLINE c_ssd128_internal c_v128_ssd_u8_init(void) { return 0; }
/* Implementation dependent return value. Result must be finalised with
* v128_ssd_u8_sum(). */
@ -720,6 +733,7 @@ SIMD_INLINE c_v128 c_v128_cmpeq_32(c_v128 a, c_v128 b) {
}
SIMD_INLINE c_v128 c_v128_shl_n_byte(c_v128 a, const unsigned int n) {
if (n == 0) return a;
if (n < 8)
return c_v128_from_v64(c_v64_or(c_v64_shl_n_byte(a.v64[1], n),
c_v64_shr_n_byte(a.v64[0], 8 - n)),
@ -729,6 +743,7 @@ SIMD_INLINE c_v128 c_v128_shl_n_byte(c_v128 a, const unsigned int n) {
}
SIMD_INLINE c_v128 c_v128_shr_n_byte(c_v128 a, const unsigned int n) {
if (n == 0) return a;
if (n < 8)
return c_v128_from_v64(c_v64_shr_n_byte(a.v64[1], n),
c_v64_or(c_v64_shr_n_byte(a.v64[0], n),
@ -854,7 +869,7 @@ SIMD_INLINE c_v128 c_v128_shr_n_s64(c_v128 a, const unsigned int n) {
typedef uint32_t c_sad128_internal_u16;
SIMD_INLINE c_sad128_internal_u16 c_v128_sad_u16_init() { return 0; }
SIMD_INLINE c_sad128_internal_u16 c_v128_sad_u16_init(void) { return 0; }
/* Implementation dependent return value. Result must be finalised with
* v128_sad_u16_sum(). */
@ -870,7 +885,7 @@ SIMD_INLINE uint32_t c_v128_sad_u16_sum(c_sad128_internal_u16 s) { return s; }
typedef uint64_t c_ssd128_internal_s16;
SIMD_INLINE c_ssd128_internal_s16 c_v128_ssd_s16_init() { return 0; }
SIMD_INLINE c_ssd128_internal_s16 c_v128_ssd_s16_init(void) { return 0; }
/* Implementation dependent return value. Result must be finalised with
* v128_ssd_s16_sum(). */

View file

@ -45,7 +45,7 @@ SIMD_INLINE v128 v128_load_aligned(const void *p) {
SIMD_INLINE v128 v128_load_unaligned(const void *p) {
#if defined(__SSSE3__)
return (__m128i)_mm_lddqu_si128((__m128i *)p);
return _mm_lddqu_si128((__m128i *)p);
#else
return _mm_loadu_si128((__m128i *)p);
#endif

View file

@ -57,29 +57,42 @@ SIMD_INLINE v256 v256_align(v256 a, v256 b, unsigned int c) {
return c_v256_align(a, b, c);
}
SIMD_INLINE v256 v256_zero() { return c_v256_zero(); }
SIMD_INLINE v256 v256_zero(void) { return c_v256_zero(); }
SIMD_INLINE v256 v256_dup_8(uint8_t x) { return c_v256_dup_8(x); }
SIMD_INLINE v256 v256_dup_16(uint16_t x) { return c_v256_dup_16(x); }
SIMD_INLINE v256 v256_dup_32(uint32_t x) { return c_v256_dup_32(x); }
SIMD_INLINE v256 v256_dup_64(uint64_t x) { return c_v256_dup_64(x); }
typedef uint32_t sad256_internal;
SIMD_INLINE sad256_internal v256_sad_u8_init() { return c_v256_sad_u8_init(); }
SIMD_INLINE sad256_internal v256_sad_u8(sad256_internal s, v256 a, v256 b) {
SIMD_INLINE c_sad256_internal v256_sad_u8_init(void) {
return c_v256_sad_u8_init();
}
SIMD_INLINE c_sad256_internal v256_sad_u8(c_sad256_internal s, v256 a, v256 b) {
return c_v256_sad_u8(s, a, b);
}
SIMD_INLINE uint32_t v256_sad_u8_sum(sad256_internal s) {
SIMD_INLINE uint32_t v256_sad_u8_sum(c_sad256_internal s) {
return c_v256_sad_u8_sum(s);
}
typedef uint32_t ssd256_internal;
SIMD_INLINE ssd256_internal v256_ssd_u8_init() { return c_v256_ssd_u8_init(); }
SIMD_INLINE ssd256_internal v256_ssd_u8(ssd256_internal s, v256 a, v256 b) {
SIMD_INLINE c_ssd256_internal v256_ssd_u8_init(void) {
return c_v256_ssd_u8_init();
}
SIMD_INLINE c_ssd256_internal v256_ssd_u8(c_ssd256_internal s, v256 a, v256 b) {
return c_v256_ssd_u8(s, a, b);
}
SIMD_INLINE uint32_t v256_ssd_u8_sum(ssd256_internal s) {
SIMD_INLINE uint32_t v256_ssd_u8_sum(c_ssd256_internal s) {
return c_v256_ssd_u8_sum(s);
}
SIMD_INLINE c_ssd256_internal_s16 v256_ssd_s16_init(void) {
return c_v256_ssd_s16_init();
}
SIMD_INLINE c_ssd256_internal_s16 v256_ssd_s16(c_ssd256_internal_s16 s, v256 a,
v256 b) {
return c_v256_ssd_s16(s, a, b);
}
SIMD_INLINE uint64_t v256_ssd_s16_sum(c_ssd256_internal_s16 s) {
return c_v256_ssd_s16_sum(s);
}
SIMD_INLINE int64_t v256_dotp_su8(v256 a, v256 b) {
return c_v256_dotp_su8(a, b);
}
@ -350,7 +363,7 @@ SIMD_INLINE v256 v256_shl_n_word(v256 a, unsigned int n) {
}
typedef uint32_t sad256_internal_u16;
SIMD_INLINE sad256_internal_u16 v256_sad_u16_init() {
SIMD_INLINE sad256_internal_u16 v256_sad_u16_init(void) {
return c_v256_sad_u16_init();
}
SIMD_INLINE sad256_internal_u16 v256_sad_u16(sad256_internal_u16 s, v256 a,
@ -361,16 +374,4 @@ SIMD_INLINE uint32_t v256_sad_u16_sum(sad256_internal_u16 s) {
return c_v256_sad_u16_sum(s);
}
typedef uint64_t ssd256_internal_s16;
SIMD_INLINE ssd256_internal_s16 v256_ssd_s16_init() {
return c_v256_ssd_s16_init();
}
SIMD_INLINE ssd256_internal_s16 v256_ssd_s16(ssd256_internal_s16 s, v256 a,
v256 b) {
return c_v256_ssd_s16(s, a, b);
}
SIMD_INLINE uint64_t v256_ssd_s16_sum(ssd256_internal_s16 s) {
return c_v256_ssd_s16_sum(s);
}
#endif // AOM_AOM_DSP_SIMD_V256_INTRINSICS_H_

View file

@ -149,9 +149,16 @@ SIMD_INLINE uint64_t c_v256_hadd_u8(c_v256 a) {
return c_v128_hadd_u8(a.v128[1]) + c_v128_hadd_u8(a.v128[0]);
}
typedef uint32_t c_sad256_internal;
typedef struct {
uint32_t val;
int count;
} c_sad256_internal;
SIMD_INLINE c_sad256_internal c_v256_sad_u8_init() { return 0; }
SIMD_INLINE c_sad256_internal c_v256_sad_u8_init(void) {
c_sad256_internal t;
t.val = t.count = 0;
return t;
}
/* Implementation dependent return value. Result must be finalised with
v256_sad_u8_sum().
@ -160,11 +167,17 @@ SIMD_INLINE c_sad256_internal c_v256_sad_u8(c_sad256_internal s, c_v256 a,
c_v256 b) {
int c;
for (c = 0; c < 32; c++)
s += a.u8[c] > b.u8[c] ? a.u8[c] - b.u8[c] : b.u8[c] - a.u8[c];
s.val += a.u8[c] > b.u8[c] ? a.u8[c] - b.u8[c] : b.u8[c] - a.u8[c];
s.count++;
if (SIMD_CHECK && s.count > 32) {
fprintf(stderr,
"Error: sad called 32 times returning an undefined result\n");
abort();
}
return s;
}
SIMD_INLINE uint32_t c_v256_sad_u8_sum(c_sad256_internal s) { return s; }
SIMD_INLINE uint32_t c_v256_sad_u8_sum(c_sad256_internal s) { return s.val; }
typedef uint32_t c_ssd256_internal;
@ -746,6 +759,7 @@ SIMD_INLINE c_v256 c_v256_cmpeq_32(c_v256 a, c_v256 b) {
}
SIMD_INLINE c_v256 c_v256_shl_n_byte(c_v256 a, unsigned int n) {
if (n == 0) return a;
if (n < 16)
return c_v256_from_v128(c_v128_or(c_v128_shl_n_byte(a.v128[1], n),
c_v128_shr_n_byte(a.v128[0], 16 - n)),
@ -758,6 +772,7 @@ SIMD_INLINE c_v256 c_v256_shl_n_byte(c_v256 a, unsigned int n) {
}
SIMD_INLINE c_v256 c_v256_shr_n_byte(c_v256 a, unsigned int n) {
if (n == 0) return a;
if (n < 16)
return c_v256_from_v128(c_v128_shr_n_byte(a.v128[1], n),
c_v128_or(c_v128_shr_n_byte(a.v128[0], n),

View file

@ -73,7 +73,7 @@ SIMD_INLINE void v256_store_aligned(void *p, v256 a) {
v128_store_aligned((uint8_t *)p + 16, a.val[1]);
}
SIMD_INLINE v256 v256_zero() {
SIMD_INLINE v256 v256_zero(void) {
return v256_from_v128(v128_zero(), v128_zero());
}
@ -117,7 +117,7 @@ typedef struct {
sad128_internal val[2];
} sad256_internal;
SIMD_INLINE sad256_internal v256_sad_u8_init() {
SIMD_INLINE sad256_internal v256_sad_u8_init(void) {
sad256_internal t;
t.val[1] = v128_sad_u8_init();
t.val[0] = v128_sad_u8_init();
@ -142,7 +142,7 @@ typedef struct {
ssd128_internal val[2];
} ssd256_internal;
SIMD_INLINE ssd256_internal v256_ssd_u8_init() {
SIMD_INLINE ssd256_internal v256_ssd_u8_init(void) {
ssd256_internal t;
t.val[1] = v128_ssd_u8_init();
t.val[0] = v128_ssd_u8_init();
@ -780,13 +780,16 @@ SIMD_INLINE v256 v256_shr_s64(v256 a, const unsigned int c) {
(n) > 16 ? v128_shl_n_byte(a.val[0], (n)-16) : a.val[0], \
v128_zero()))
#define v256_shr_n_byte(a, n) \
((n) < 16 ? v256_from_v128(v128_shr_n_byte(a.val[1], n), \
v128_or(v128_shr_n_byte(a.val[0], n), \
v128_shl_n_byte(a.val[1], 16 - (n)))) \
: v256_from_v128( \
v128_zero(), \
(n) > 16 ? v128_shr_n_byte(a.val[1], (n)-16) : a.val[1]))
#define v256_shr_n_byte(a, n) \
(n == 0 \
? a \
: ((n) < 16 \
? v256_from_v128(v128_shr_n_byte(a.val[1], n), \
v128_or(v128_shr_n_byte(a.val[0], n), \
v128_shl_n_byte(a.val[1], 16 - (n)))) \
: v256_from_v128( \
v128_zero(), \
(n) > 16 ? v128_shr_n_byte(a.val[1], (n)-16) : a.val[1])))
#define v256_align(a, b, c) \
((c) ? v256_or(v256_shr_n_byte(b, c), v256_shl_n_byte(a, 32 - (c))) : b)
@ -823,7 +826,7 @@ typedef struct {
sad128_internal_u16 val[2];
} sad256_internal_u16;
SIMD_INLINE sad256_internal_u16 v256_sad_u16_init() {
SIMD_INLINE sad256_internal_u16 v256_sad_u16_init(void) {
sad256_internal_u16 t;
t.val[1] = v128_sad_u16_init();
t.val[0] = v128_sad_u16_init();
@ -849,7 +852,7 @@ typedef struct {
ssd128_internal_s16 val[2];
} ssd256_internal_s16;
SIMD_INLINE ssd256_internal_s16 v256_ssd_s16_init() {
SIMD_INLINE ssd256_internal_s16 v256_ssd_s16_init(void) {
ssd256_internal_s16 t;
t.val[1] = v128_ssd_s16_init();
t.val[0] = v128_ssd_s16_init();

View file

@ -57,7 +57,7 @@ SIMD_INLINE v256 v256_from_v64(v64 a, v64 b, v64 c, v64 d) {
}
SIMD_INLINE v256 v256_from_64(uint64_t a, uint64_t b, uint64_t c, uint64_t d) {
return v256_from_v128(v128_from_64(a, b), v128_from_64(c, d));
return _mm256_set_epi64x(a, b, c, d);
}
SIMD_INLINE v256 v256_load_aligned(const void *p) {
@ -76,7 +76,7 @@ SIMD_INLINE void v256_store_unaligned(void *p, v256 a) {
_mm256_storeu_si256((__m256i *)p, a);
}
SIMD_INLINE v256 v256_zero() { return _mm256_setzero_si256(); }
SIMD_INLINE v256 v256_zero(void) { return _mm256_setzero_si256(); }
SIMD_INLINE v256 v256_dup_8(uint8_t x) { return _mm256_set1_epi8(x); }
@ -187,11 +187,11 @@ SIMD_INLINE v256 v256_ziphi_64(v256 a, v256 b) {
}
SIMD_INLINE v256 v256_ziplo_128(v256 a, v256 b) {
return v256_from_v128(v256_low_v128(a), v256_low_v128(b));
return _mm256_permute2x128_si256(a, b, 0x02);
}
SIMD_INLINE v256 v256_ziphi_128(v256 a, v256 b) {
return v256_from_v128(v256_high_v128(a), v256_high_v128(b));
return _mm256_permute2x128_si256(a, b, 0x13);
}
SIMD_INLINE v256 v256_zip_8(v128 a, v128 b) {
@ -256,9 +256,7 @@ SIMD_INLINE v256 v256_unziplo_64(v256 a, v256 b) {
_MM_SHUFFLE(3, 1, 2, 0));
}
SIMD_INLINE v256 v256_unpack_u8_s16(v128 a) {
return v256_from_v128(v128_unpackhi_u8_s16(a), v128_unpacklo_u8_s16(a));
}
SIMD_INLINE v256 v256_unpack_u8_s16(v128 a) { return _mm256_cvtepu8_epi16(a); }
SIMD_INLINE v256 v256_unpacklo_u8_s16(v256 a) {
return _mm256_unpacklo_epi8(
@ -311,11 +309,11 @@ SIMD_INLINE v256 v256_pack_s16_s8(v256 a, v256 b) {
}
SIMD_INLINE v256 v256_unpack_u16_s32(v128 a) {
return v256_from_v128(v128_unpackhi_u16_s32(a), v128_unpacklo_u16_s32(a));
return _mm256_cvtepu16_epi32(a);
}
SIMD_INLINE v256 v256_unpack_s16_s32(v128 a) {
return v256_from_v128(v128_unpackhi_s16_s32(a), v128_unpacklo_s16_s32(a));
return _mm256_cvtepi16_epi32(a);
}
SIMD_INLINE v256 v256_unpacklo_u16_s32(v256 a) {
@ -442,7 +440,7 @@ SIMD_INLINE uint64_t v256_hadd_u8(v256 a) {
typedef v256 sad256_internal;
SIMD_INLINE sad256_internal v256_sad_u8_init() {
SIMD_INLINE sad256_internal v256_sad_u8_init(void) {
return _mm256_setzero_si256();
}
@ -460,7 +458,7 @@ SIMD_INLINE uint32_t v256_sad_u8_sum(sad256_internal s) {
typedef v256 ssd256_internal;
SIMD_INLINE ssd256_internal v256_ssd_u8_init() {
SIMD_INLINE ssd256_internal v256_ssd_u8_init(void) {
return _mm256_setzero_si256();
}
@ -646,7 +644,7 @@ SIMD_INLINE v256 v256_shr_u64(v256 a, unsigned int c) {
}
SIMD_INLINE v256 v256_shr_s64(v256 a, unsigned int c) {
#if defined(__AVX512F__)
#if defined(__AVX512VL__)
return _mm256_sra_epi64(a, _mm_cvtsi32_si128(c));
#else
return v256_from_v128(v128_shr_s64(v256_high_v128(a), c),
@ -670,13 +668,15 @@ SIMD_INLINE v256 v256_shr_s64(v256 a, unsigned int c) {
((n) < 16 \
? _mm256_alignr_epi8( \
_mm256_permute2x128_si256(a, a, _MM_SHUFFLE(2, 0, 0, 1)), a, n) \
: _mm256_inserti128_si256( \
_mm256_setzero_si256(), \
v128_align(v256_high_v128(a), v256_high_v128(a), n), 0))
: ((n) == 16 \
? _mm256_permute2x128_si256(_mm256_setzero_si256(), a, 3) \
: _mm256_inserti128_si256( \
_mm256_setzero_si256(), \
v128_align(v256_high_v128(a), v256_high_v128(a), n), 0)))
// _mm256_alignr_epi8 works on two 128 bit lanes and can't be used
#define v256_align(a, b, c) \
((c) ? v256_or(v256_shr_n_byte(b, c), v256_shl_n_byte(a, 32 - c)) : b)
((c) ? v256_or(v256_shr_n_byte(b, c), v256_shl_n_byte(a, 32 - (c))) : b)
#define v256_shl_n_8(a, c) \
_mm256_and_si256(_mm256_set1_epi8((uint8_t)(0xff << (c))), \
@ -701,7 +701,7 @@ SIMD_INLINE v256 v256_shr_s64(v256 a, unsigned int c) {
typedef v256 sad256_internal_u16;
SIMD_INLINE sad256_internal_u16 v256_sad_u16_init() { return v256_zero(); }
SIMD_INLINE sad256_internal_u16 v256_sad_u16_init(void) { return v256_zero(); }
/* Implementation dependent return value. Result must be finalised with
* v256_sad_u16_sum(). */
@ -728,7 +728,7 @@ SIMD_INLINE uint32_t v256_sad_u16_sum(sad256_internal_u16 s) {
typedef v256 ssd256_internal_s16;
SIMD_INLINE ssd256_internal_s16 v256_ssd_s16_init() { return v256_zero(); }
SIMD_INLINE ssd256_internal_s16 v256_ssd_s16_init(void) { return v256_zero(); }
/* Implementation dependent return value. Result must be finalised with
* v256_ssd_s16_sum(). */

View file

@ -65,7 +65,7 @@ SIMD_INLINE v64 v64_align(v64 a, v64 b, unsigned int c) {
return c_v64_align(a, b, c);
}
SIMD_INLINE v64 v64_zero() { return c_v64_zero(); }
SIMD_INLINE v64 v64_zero(void) { return c_v64_zero(); }
SIMD_INLINE v64 v64_dup_8(uint8_t x) { return c_v64_dup_8(x); }
SIMD_INLINE v64 v64_dup_16(uint16_t x) { return c_v64_dup_16(x); }
SIMD_INLINE v64 v64_dup_32(uint32_t x) { return c_v64_dup_32(x); }
@ -128,20 +128,22 @@ SIMD_INLINE v64 v64_shuffle_8(v64 a, v64 pattern) {
return c_v64_shuffle_8(a, pattern);
}
typedef uint32_t sad64_internal;
SIMD_INLINE sad64_internal v64_sad_u8_init() { return c_v64_sad_u8_init(); }
SIMD_INLINE sad64_internal v64_sad_u8(sad64_internal s, v64 a, v64 b) {
SIMD_INLINE c_sad64_internal v64_sad_u8_init(void) {
return c_v64_sad_u8_init();
}
SIMD_INLINE c_sad64_internal v64_sad_u8(c_sad64_internal s, v64 a, v64 b) {
return c_v64_sad_u8(s, a, b);
}
SIMD_INLINE uint32_t v64_sad_u8_sum(sad64_internal s) {
SIMD_INLINE uint32_t v64_sad_u8_sum(c_sad64_internal s) {
return c_v64_sad_u8_sum(s);
}
typedef uint32_t ssd64_internal;
SIMD_INLINE ssd64_internal v64_ssd_u8_init() { return c_v64_ssd_u8_init(); }
SIMD_INLINE ssd64_internal v64_ssd_u8(ssd64_internal s, v64 a, v64 b) {
SIMD_INLINE c_ssd64_internal v64_ssd_u8_init(void) {
return c_v64_ssd_u8_init();
}
SIMD_INLINE c_ssd64_internal v64_ssd_u8(c_ssd64_internal s, v64 a, v64 b) {
return c_v64_ssd_u8(s, a, b);
}
SIMD_INLINE uint32_t v64_ssd_u8_sum(ssd64_internal s) {
SIMD_INLINE uint32_t v64_ssd_u8_sum(c_ssd64_internal s) {
return c_v64_ssd_u8_sum(s);
}
SIMD_INLINE int64_t v64_dotp_su8(v64 a, v64 b) { return c_v64_dotp_su8(a, b); }

View file

@ -71,7 +71,11 @@ SIMD_INLINE void u32_store_unaligned(void *p, uint32_t a) {
#elif defined(__CC_ARM)
*(__packed uint32_t *)p) = a;
#elif defined(__GNUC__)
*((__attribute((packed)) uint32_t *)p) = a;
struct Unaligned32Struct {
uint32_t value;
uint8_t dummy; // To make the size non-power-of-two.
} __attribute__((__packed__));
((struct Unaligned32Struct *)p)->value = a;
#else
vst1_lane_u32((uint32_t *)p, vreinterpret_u32_s64((uint64x1_t)(uint64_t)a),
0);
@ -107,7 +111,7 @@ SIMD_INLINE v64 v64_align(v64 a, v64 b, unsigned int c) {
#endif
}
SIMD_INLINE v64 v64_zero() { return vreinterpret_s64_u8(vdup_n_u8(0)); }
SIMD_INLINE v64 v64_zero(void) { return vreinterpret_s64_u8(vdup_n_u8(0)); }
SIMD_INLINE v64 v64_dup_8(uint8_t x) {
return vreinterpret_s64_u8(vdup_n_u8(x));
@ -158,7 +162,7 @@ SIMD_INLINE int64_t v64_hadd_s16(v64 a) {
typedef uint16x8_t sad64_internal;
SIMD_INLINE sad64_internal v64_sad_u8_init() { return vdupq_n_u16(0); }
SIMD_INLINE sad64_internal v64_sad_u8_init(void) { return vdupq_n_u16(0); }
// Implementation dependent return value. Result must be finalised with
// v64_sad_u8_sum().
@ -177,7 +181,7 @@ SIMD_INLINE uint32_t v64_sad_u8_sum(sad64_internal s) {
typedef uint32x4_t ssd64_internal;
SIMD_INLINE ssd64_internal v64_ssd_u8_init() { return vdupq_n_u32(0); }
SIMD_INLINE ssd64_internal v64_ssd_u8_init(void) { return vdupq_n_u32(0); }
// Implementation dependent return value. Result must be finalised with
// v64_ssd_u8_sum().
@ -604,39 +608,39 @@ SIMD_INLINE v64 v64_shr_n_byte(v64 a, unsigned int c) {
}
SIMD_INLINE v64 v64_shl_n_8(v64 a, unsigned int c) {
return vreinterpret_s64_u8(vshl_n_u8(vreinterpret_u8_s64(a), c));
return c ? vreinterpret_s64_u8(vshl_n_u8(vreinterpret_u8_s64(a), c)) : a;
}
SIMD_INLINE v64 v64_shr_n_u8(v64 a, unsigned int c) {
return vreinterpret_s64_u8(vshr_n_u8(vreinterpret_u8_s64(a), c));
return c ? vreinterpret_s64_u8(vshr_n_u8(vreinterpret_u8_s64(a), c)) : a;
}
SIMD_INLINE v64 v64_shr_n_s8(v64 a, unsigned int c) {
return vreinterpret_s64_s8(vshr_n_s8(vreinterpret_s8_s64(a), c));
return c ? vreinterpret_s64_s8(vshr_n_s8(vreinterpret_s8_s64(a), c)) : a;
}
SIMD_INLINE v64 v64_shl_n_16(v64 a, unsigned int c) {
return vreinterpret_s64_u16(vshl_n_u16(vreinterpret_u16_s64(a), c));
return c ? vreinterpret_s64_u16(vshl_n_u16(vreinterpret_u16_s64(a), c)) : a;
}
SIMD_INLINE v64 v64_shr_n_u16(v64 a, unsigned int c) {
return vreinterpret_s64_u16(vshr_n_u16(vreinterpret_u16_s64(a), c));
return c ? vreinterpret_s64_u16(vshr_n_u16(vreinterpret_u16_s64(a), c)) : a;
}
SIMD_INLINE v64 v64_shr_n_s16(v64 a, unsigned int c) {
return vreinterpret_s64_s16(vshr_n_s16(vreinterpret_s16_s64(a), c));
return c ? vreinterpret_s64_s16(vshr_n_s16(vreinterpret_s16_s64(a), c)) : a;
}
SIMD_INLINE v64 v64_shl_n_32(v64 a, unsigned int c) {
return vreinterpret_s64_u32(vshl_n_u32(vreinterpret_u32_s64(a), c));
return c ? vreinterpret_s64_u32(vshl_n_u32(vreinterpret_u32_s64(a), c)) : a;
}
SIMD_INLINE v64 v64_shr_n_u32(v64 a, unsigned int c) {
return vreinterpret_s64_u32(vshr_n_u32(vreinterpret_u32_s64(a), c));
return c ? vreinterpret_s64_u32(vshr_n_u32(vreinterpret_u32_s64(a), c)) : a;
}
SIMD_INLINE v64 v64_shr_n_s32(v64 a, unsigned int c) {
return vreinterpret_s64_s32(vshr_n_s32(vreinterpret_s32_s64(a), c));
return c ? vreinterpret_s64_s32(vshr_n_s32(vreinterpret_s32_s64(a), c)) : a;
}
#else

View file

@ -143,7 +143,7 @@ SIMD_INLINE void c_v64_store_aligned(void *p, c_v64 a) {
c_v64_store_unaligned(p, a);
}
SIMD_INLINE c_v64 c_v64_zero() {
SIMD_INLINE c_v64 c_v64_zero(void) {
c_v64 t;
t.u64 = 0;
return t;
@ -601,28 +601,41 @@ SIMD_INLINE int64_t c_v64_hadd_s16(c_v64 a) {
return a.s16[3] + a.s16[2] + a.s16[1] + a.s16[0];
}
typedef uint32_t c_sad64_internal;
typedef struct {
uint32_t val;
int count;
} c_sad64_internal;
SIMD_INLINE c_sad64_internal c_v64_sad_u8_init(void) {
c_sad64_internal t;
t.val = t.count = 0;
return t;
}
/* Implementation dependent return value. Result must be finalised with
v64_sad_u8_sum().
The result for more than 32 v64_sad_u8() calls is undefined. */
SIMD_INLINE c_sad64_internal c_v64_sad_u8_init() { return 0; }
v64_sad_u8_sum(). The result for more than 32 v64_sad_u8() calls is
undefined. */
SIMD_INLINE c_sad64_internal c_v64_sad_u8(c_sad64_internal s, c_v64 a,
c_v64 b) {
int c;
for (c = 0; c < 8; c++)
s += a.u8[c] > b.u8[c] ? a.u8[c] - b.u8[c] : b.u8[c] - a.u8[c];
s.val += a.u8[c] > b.u8[c] ? a.u8[c] - b.u8[c] : b.u8[c] - a.u8[c];
s.count++;
if (SIMD_CHECK && s.count > 32) {
fprintf(stderr,
"Error: sad called 32 times returning an undefined result\n");
abort();
}
return s;
}
SIMD_INLINE uint32_t c_v64_sad_u8_sum(c_sad64_internal s) { return s; }
SIMD_INLINE uint32_t c_v64_sad_u8_sum(c_sad64_internal s) { return s.val; }
typedef uint32_t c_ssd64_internal;
/* Implementation dependent return value. Result must be finalised with
* v64_ssd_u8_sum(). */
SIMD_INLINE c_ssd64_internal c_v64_ssd_u8_init() { return 0; }
SIMD_INLINE c_ssd64_internal c_v64_ssd_u8_init(void) { return 0; }
SIMD_INLINE c_ssd64_internal c_v64_ssd_u8(c_ssd64_internal s, c_v64 a,
c_v64 b) {

View file

@ -99,7 +99,7 @@ SIMD_INLINE void v64_store_unaligned(void *p, v64 a) {
: (b))
#endif
SIMD_INLINE v64 v64_zero() { return _mm_setzero_si128(); }
SIMD_INLINE v64 v64_zero(void) { return _mm_setzero_si128(); }
SIMD_INLINE v64 v64_dup_8(uint8_t x) { return _mm_set1_epi8(x); }
@ -319,7 +319,7 @@ SIMD_INLINE int64_t v64_hadd_s16(v64 a) {
typedef v64 sad64_internal;
SIMD_INLINE sad64_internal v64_sad_u8_init() { return _mm_setzero_si128(); }
SIMD_INLINE sad64_internal v64_sad_u8_init(void) { return _mm_setzero_si128(); }
/* Implementation dependent return value. Result must be finalised with
v64_sad_u8_sum().
@ -332,7 +332,7 @@ SIMD_INLINE uint32_t v64_sad_u8_sum(sad64_internal s) { return v64_low_u32(s); }
typedef v64 ssd64_internal;
SIMD_INLINE ssd64_internal v64_ssd_u8_init() { return _mm_setzero_si128(); }
SIMD_INLINE ssd64_internal v64_ssd_u8_init(void) { return _mm_setzero_si128(); }
/* Implementation dependent return value. Result must be finalised with
* v64_ssd_u8_sum(). */
@ -433,7 +433,7 @@ SIMD_INLINE v64 v64_cmplt_s16(v64 a, v64 b) { return _mm_cmplt_epi16(a, b); }
SIMD_INLINE v64 v64_cmpeq_16(v64 a, v64 b) { return _mm_cmpeq_epi16(a, b); }
SIMD_INLINE v64 v64_shl_8(v64 a, unsigned int c) {
return _mm_and_si128(_mm_set1_epi8((char)(0xff << c)),
return _mm_and_si128(_mm_set1_epi8((uint8_t)(0xff << c)),
_mm_sll_epi16(a, _mm_cvtsi32_si128(c)));
}

View file

@ -38,3 +38,36 @@ uint64_t aom_sum_squares_i16_c(const int16_t *src, uint32_t n) {
return ss;
}
uint64_t aom_var_2d_u8_c(uint8_t *src, int src_stride, int width, int height) {
int r, c;
uint64_t ss = 0, s = 0;
for (r = 0; r < height; r++) {
for (c = 0; c < width; c++) {
const uint8_t v = src[c];
ss += v * v;
s += v;
}
src += src_stride;
}
return (ss - s * s / (width * height));
}
uint64_t aom_var_2d_u16_c(uint8_t *src, int src_stride, int width, int height) {
uint16_t *srcp = CONVERT_TO_SHORTPTR(src);
int r, c;
uint64_t ss = 0, s = 0;
for (r = 0; r < height; r++) {
for (c = 0; c < width; c++) {
const uint16_t v = srcp[c];
ss += v * v;
s += v;
}
srcp += src_stride;
}
return (ss - s * s / (width * height));
}

View file

@ -23,9 +23,10 @@
#include "aom_dsp/blend.h"
#include "aom_dsp/variance.h"
#include "av1/common/av1_common_int.h"
#include "av1/common/filter.h"
#include "av1/common/onyxc_int.h"
#include "av1/common/reconinter.h"
#include "av1/encoder/reconinter_enc.h"
uint32_t aom_get4x4sse_cs_c(const uint8_t *a, int a_stride, const uint8_t *b,
int b_stride) {
@ -295,70 +296,24 @@ void aom_upsampled_pred_c(MACROBLOCKD *xd, const AV1_COMMON *const cm,
const int is_scaled = av1_is_scaled(sf);
if (is_scaled) {
// Note: This is mostly a copy from the >=8X8 case in
// build_inter_predictors() function, with some small tweaks.
// Some assumptions.
const int plane = 0;
// Get pre-requisites.
int plane = 0;
const int mi_x = mi_col * MI_SIZE;
const int mi_y = mi_row * MI_SIZE;
const struct macroblockd_plane *const pd = &xd->plane[plane];
const int ssx = pd->subsampling_x;
const int ssy = pd->subsampling_y;
assert(ssx == 0 && ssy == 0);
const struct buf_2d *const dst_buf = &pd->dst;
const struct buf_2d *const pre_buf =
is_intrabc ? dst_buf : &pd->pre[ref_num];
const int mi_x = mi_col * MI_SIZE;
const int mi_y = mi_row * MI_SIZE;
// Calculate subpel_x/y and x/y_step.
const int row_start = 0; // Because ss_y is 0.
const int col_start = 0; // Because ss_x is 0.
const int pre_x = (mi_x + MI_SIZE * col_start) >> ssx;
const int pre_y = (mi_y + MI_SIZE * row_start) >> ssy;
int orig_pos_y = pre_y << SUBPEL_BITS;
orig_pos_y += mv->row * (1 << (1 - ssy));
int orig_pos_x = pre_x << SUBPEL_BITS;
orig_pos_x += mv->col * (1 << (1 - ssx));
int pos_y = sf->scale_value_y(orig_pos_y, sf);
int pos_x = sf->scale_value_x(orig_pos_x, sf);
pos_x += SCALE_EXTRA_OFF;
pos_y += SCALE_EXTRA_OFF;
const int top = -AOM_LEFT_TOP_MARGIN_SCALED(ssy);
const int left = -AOM_LEFT_TOP_MARGIN_SCALED(ssx);
const int bottom = (pre_buf->height + AOM_INTERP_EXTEND)
<< SCALE_SUBPEL_BITS;
const int right = (pre_buf->width + AOM_INTERP_EXTEND)
<< SCALE_SUBPEL_BITS;
pos_y = clamp(pos_y, top, bottom);
pos_x = clamp(pos_x, left, right);
const uint8_t *const pre =
pre_buf->buf0 + (pos_y >> SCALE_SUBPEL_BITS) * pre_buf->stride +
(pos_x >> SCALE_SUBPEL_BITS);
InterPredParams inter_pred_params;
const SubpelParams subpel_params = { sf->x_step_q4, sf->y_step_q4,
pos_x & SCALE_SUBPEL_MASK,
pos_y & SCALE_SUBPEL_MASK };
// Get convolve parameters.
inter_pred_params.conv_params = get_conv_params(0, plane, xd->bd);
const int_interpfilters filters =
av1_broadcast_interp_filter(EIGHTTAP_REGULAR);
av1_init_inter_params(
&inter_pred_params, width, height, mi_y >> pd->subsampling_y,
mi_x >> pd->subsampling_x, pd->subsampling_x, pd->subsampling_y,
xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf, filters);
// Get the inter predictor.
av1_make_inter_predictor(pre, pre_buf->stride, comp_pred, width,
&inter_pred_params, &subpel_params);
xd->bd, is_cur_buf_hbd(xd), is_intrabc, sf, pre_buf, filters);
av1_enc_build_one_inter_predictor(comp_pred, width, mv,
&inter_pred_params);
return;
}
}
@ -884,69 +839,24 @@ void aom_highbd_upsampled_pred_c(MACROBLOCKD *xd,
const int is_scaled = av1_is_scaled(sf);
if (is_scaled) {
// Note: This is mostly a copy from the >=8X8 case in
// build_inter_predictors() function, with some small tweaks.
// Some assumptions.
const int plane = 0;
// Get pre-requisites.
int plane = 0;
const int mi_x = mi_col * MI_SIZE;
const int mi_y = mi_row * MI_SIZE;
const struct macroblockd_plane *const pd = &xd->plane[plane];
const int ssx = pd->subsampling_x;
const int ssy = pd->subsampling_y;
assert(ssx == 0 && ssy == 0);
const struct buf_2d *const dst_buf = &pd->dst;
const struct buf_2d *const pre_buf =
is_intrabc ? dst_buf : &pd->pre[ref_num];
const int mi_x = mi_col * MI_SIZE;
const int mi_y = mi_row * MI_SIZE;
// Calculate subpel_x/y and x/y_step.
const int row_start = 0; // Because ss_y is 0.
const int col_start = 0; // Because ss_x is 0.
const int pre_x = (mi_x + MI_SIZE * col_start) >> ssx;
const int pre_y = (mi_y + MI_SIZE * row_start) >> ssy;
int orig_pos_y = pre_y << SUBPEL_BITS;
orig_pos_y += mv->row * (1 << (1 - ssy));
int orig_pos_x = pre_x << SUBPEL_BITS;
orig_pos_x += mv->col * (1 << (1 - ssx));
int pos_y = sf->scale_value_y(orig_pos_y, sf);
int pos_x = sf->scale_value_x(orig_pos_x, sf);
pos_x += SCALE_EXTRA_OFF;
pos_y += SCALE_EXTRA_OFF;
const int top = -AOM_LEFT_TOP_MARGIN_SCALED(ssy);
const int left = -AOM_LEFT_TOP_MARGIN_SCALED(ssx);
const int bottom = (pre_buf->height + AOM_INTERP_EXTEND)
<< SCALE_SUBPEL_BITS;
const int right = (pre_buf->width + AOM_INTERP_EXTEND)
<< SCALE_SUBPEL_BITS;
pos_y = clamp(pos_y, top, bottom);
pos_x = clamp(pos_x, left, right);
const uint8_t *const pre =
pre_buf->buf0 + (pos_y >> SCALE_SUBPEL_BITS) * pre_buf->stride +
(pos_x >> SCALE_SUBPEL_BITS);
InterPredParams inter_pred_params;
const SubpelParams subpel_params = { sf->x_step_q4, sf->y_step_q4,
pos_x & SCALE_SUBPEL_MASK,
pos_y & SCALE_SUBPEL_MASK };
// Get convolve parameters.
inter_pred_params.conv_params = get_conv_params(0, plane, xd->bd);
const int_interpfilters filters =
av1_broadcast_interp_filter(EIGHTTAP_REGULAR);
av1_init_inter_params(
&inter_pred_params, width, height, mi_y >> pd->subsampling_y,
mi_x >> pd->subsampling_x, pd->subsampling_x, pd->subsampling_y,
xd->bd, is_cur_buf_hbd(xd), mi->use_intrabc, sf, filters);
// Get the inter predictor.
av1_make_inter_predictor(pre, pre_buf->stride, comp_pred8, width,
&inter_pred_params, &subpel_params);
xd->bd, is_cur_buf_hbd(xd), is_intrabc, sf, pre_buf, filters);
av1_enc_build_one_inter_predictor(comp_pred8, width, mv,
&inter_pred_params);
return;
}
}

View file

@ -0,0 +1,159 @@
/*
* Copyright (c) 2019, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
* was not distributed with this source code in the LICENSE file, you can
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#include <assert.h>
#include <libvmaf/libvmaf.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "aom_dsp/blend.h"
#include "aom_dsp/vmaf.h"
#include "aom_ports/system_state.h"
typedef struct FrameData {
const YV12_BUFFER_CONFIG *source;
const YV12_BUFFER_CONFIG *distorted;
int frame_set;
int bit_depth;
} FrameData;
static void vmaf_fatal_error(const char *message) {
fprintf(stderr, "Fatal error: %s\n", message);
exit(EXIT_FAILURE);
}
// A callback function used to pass data to VMAF.
// Returns 0 after reading a frame.
// Returns 2 when there is no more frame to read.
static int read_frame(float *ref_data, float *main_data, float *temp_data,
int stride, void *user_data) {
FrameData *frames = (FrameData *)user_data;
if (!frames->frame_set) {
const int width = frames->source->y_width;
const int height = frames->source->y_height;
assert(width == frames->distorted->y_width);
assert(height == frames->distorted->y_height);
if (frames->bit_depth > 8) {
const float scale_factor = 1.0f / (float)(1 << (frames->bit_depth - 8));
uint16_t *ref_ptr = CONVERT_TO_SHORTPTR(frames->source->y_buffer);
uint16_t *main_ptr = CONVERT_TO_SHORTPTR(frames->distorted->y_buffer);
for (int row = 0; row < height; ++row) {
for (int col = 0; col < width; ++col) {
ref_data[col] = scale_factor * (float)ref_ptr[col];
}
ref_ptr += frames->source->y_stride;
ref_data += stride / sizeof(*ref_data);
}
for (int row = 0; row < height; ++row) {
for (int col = 0; col < width; ++col) {
main_data[col] = scale_factor * (float)main_ptr[col];
}
main_ptr += frames->distorted->y_stride;
main_data += stride / sizeof(*main_data);
}
} else {
uint8_t *ref_ptr = frames->source->y_buffer;
uint8_t *main_ptr = frames->distorted->y_buffer;
for (int row = 0; row < height; ++row) {
for (int col = 0; col < width; ++col) {
ref_data[col] = (float)ref_ptr[col];
}
ref_ptr += frames->source->y_stride;
ref_data += stride / sizeof(*ref_data);
}
for (int row = 0; row < height; ++row) {
for (int col = 0; col < width; ++col) {
main_data[col] = (float)main_ptr[col];
}
main_ptr += frames->distorted->y_stride;
main_data += stride / sizeof(*main_data);
}
}
frames->frame_set = 1;
return 0;
}
(void)temp_data;
return 2;
}
void aom_calc_vmaf(const char *model_path, const YV12_BUFFER_CONFIG *source,
const YV12_BUFFER_CONFIG *distorted, const int bit_depth,
double *const vmaf) {
aom_clear_system_state();
const int width = source->y_width;
const int height = source->y_height;
FrameData frames = { source, distorted, 0, bit_depth };
char *fmt = bit_depth == 10 ? "yuv420p10le" : "yuv420p";
double vmaf_score;
const int ret =
compute_vmaf(&vmaf_score, fmt, width, height, read_frame,
/*user_data=*/&frames, (char *)model_path,
/*log_path=*/NULL, /*log_fmt=*/NULL, /*disable_clip=*/1,
/*disable_avx=*/0, /*enable_transform=*/0,
/*phone_model=*/0, /*do_psnr=*/0, /*do_ssim=*/0,
/*do_ms_ssim=*/0, /*pool_method=*/NULL, /*n_thread=*/0,
/*n_subsample=*/1, /*enable_conf_interval=*/0);
if (ret) vmaf_fatal_error("Failed to compute VMAF scores.");
aom_clear_system_state();
*vmaf = vmaf_score;
}
void aom_calc_vmaf_multi_frame(
void *user_data, const char *model_path,
int (*read_frame)(float *ref_data, float *main_data, float *temp_data,
int stride_byte, void *user_data),
int frame_width, int frame_height, int bit_depth, double *vmaf) {
aom_clear_system_state();
char *fmt = bit_depth == 10 ? "yuv420p10le" : "yuv420p";
double vmaf_score;
const int ret = compute_vmaf(
&vmaf_score, fmt, frame_width, frame_height, read_frame,
/*user_data=*/user_data, (char *)model_path,
/*log_path=*/"vmaf_scores.xml", /*log_fmt=*/NULL, /*disable_clip=*/0,
/*disable_avx=*/0, /*enable_transform=*/0,
/*phone_model=*/0, /*do_psnr=*/0, /*do_ssim=*/0,
/*do_ms_ssim=*/0, /*pool_method=*/NULL, /*n_thread=*/0,
/*n_subsample=*/1, /*enable_conf_interval=*/0);
FILE *vmaf_log = fopen("vmaf_scores.xml", "r");
if (vmaf_log == NULL || ret) {
vmaf_fatal_error("Failed to compute VMAF scores.");
}
int frame_index = 0;
char buf[512];
while (fgets(buf, 511, vmaf_log) != NULL) {
if (memcmp(buf, "\t\t<frame ", 9) == 0) {
char *p = strstr(buf, "vmaf=");
if (p != NULL && p[5] == '"') {
char *p2 = strstr(&p[6], "\"");
*p2 = '\0';
const double score = atof(&p[6]);
if (score < 0.0 || score > 100.0) {
vmaf_fatal_error("Failed to compute VMAF scores.");
}
vmaf[frame_index++] = score;
}
}
}
fclose(vmaf_log);
aom_clear_system_state();
}

View file

@ -0,0 +1,27 @@
/*
* Copyright (c) 2019, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
* was not distributed with this source code in the LICENSE file, you can
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#ifndef AOM_AOM_DSP_VMAF_H_
#define AOM_AOM_DSP_VMAF_H_
#include "aom_scale/yv12config.h"
void aom_calc_vmaf(const char *model_path, const YV12_BUFFER_CONFIG *source,
const YV12_BUFFER_CONFIG *distorted, int bit_depth,
double *vmaf);
void aom_calc_vmaf_multi_frame(
void *user_data, const char *model_path,
int (*read_frame)(float *ref_data, float *main_data, float *temp_data,
int stride_byte, void *user_data),
int frame_width, int frame_height, int bit_depth, double *vmaf);
#endif // AOM_AOM_DSP_VMAF_H_

View file

@ -227,7 +227,7 @@ void aom_quantize_b_adaptive_avx2(
const int rc = scan[(*eob_ptr - 1)];
if (qcoeff_ptr[rc] == 1 || qcoeff_ptr[rc] == -1) {
const int coeff0 = coeff_ptr[rc] * wt;
const int coeff_sign = (coeff0 >> 31);
const int coeff_sign = AOMSIGN(coeff0);
const int abs_coeff = (coeff0 ^ coeff_sign) - coeff_sign;
const int factor = EOB_FACTOR + SKIP_EOB_FACTOR_ADJUST;
const int prescan_add_val =

View file

@ -200,7 +200,7 @@ void aom_quantize_b_adaptive_sse2(
const int rc = scan[(*eob_ptr - 1)];
if (qcoeff_ptr[rc] == 1 || qcoeff_ptr[rc] == -1) {
const int coeff = coeff_ptr[rc] * wt;
const int coeff_sign = (coeff >> 31);
const int coeff_sign = AOMSIGN(coeff);
const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
const int factor = EOB_FACTOR + SKIP_EOB_FACTOR_ADJUST;
const int prescan_add_val =
@ -409,7 +409,7 @@ void aom_quantize_b_32x32_adaptive_sse2(
const int rc = scan[(*eob_ptr - 1)];
if (qcoeff_ptr[rc] == 1 || qcoeff_ptr[rc] == -1) {
const int coeff = coeff_ptr[rc] * wt;
const int coeff_sign = (coeff >> 31);
const int coeff_sign = AOMSIGN(coeff);
const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
const int factor = EOB_FACTOR + SKIP_EOB_FACTOR_ADJUST;
const int prescan_add_val =
@ -617,7 +617,7 @@ void aom_quantize_b_64x64_adaptive_sse2(
const int rc = scan[(*eob_ptr - 1)];
if (qcoeff_ptr[rc] == 1 || qcoeff_ptr[rc] == -1) {
const int coeff = coeff_ptr[rc] * wt;
const int coeff_sign = (coeff >> 31);
const int coeff_sign = AOMSIGN(coeff);
const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
const int factor = EOB_FACTOR + SKIP_EOB_FACTOR_ADJUST;
const int prescan_add_val =

View file

@ -181,6 +181,38 @@ void aom_hadamard_16x16_avx2(const int16_t *src_diff, ptrdiff_t src_stride,
hadamard_16x16_avx2(src_diff, src_stride, coeff, 1);
}
void aom_hadamard_lp_16x16_avx2(const int16_t *src_diff, ptrdiff_t src_stride,
int16_t *coeff) {
int16_t *t_coeff = coeff;
for (int idx = 0; idx < 2; ++idx) {
const int16_t *src_ptr = src_diff + idx * 8 * src_stride;
hadamard_8x8x2_avx2(src_ptr, src_stride, t_coeff + (idx * 64 * 2));
}
for (int idx = 0; idx < 64; idx += 16) {
const __m256i coeff0 = _mm256_loadu_si256((const __m256i *)t_coeff);
const __m256i coeff1 = _mm256_loadu_si256((const __m256i *)(t_coeff + 64));
const __m256i coeff2 = _mm256_loadu_si256((const __m256i *)(t_coeff + 128));
const __m256i coeff3 = _mm256_loadu_si256((const __m256i *)(t_coeff + 192));
__m256i b0 = _mm256_add_epi16(coeff0, coeff1);
__m256i b1 = _mm256_sub_epi16(coeff0, coeff1);
__m256i b2 = _mm256_add_epi16(coeff2, coeff3);
__m256i b3 = _mm256_sub_epi16(coeff2, coeff3);
b0 = _mm256_srai_epi16(b0, 1);
b1 = _mm256_srai_epi16(b1, 1);
b2 = _mm256_srai_epi16(b2, 1);
b3 = _mm256_srai_epi16(b3, 1);
_mm256_storeu_si256((__m256i *)coeff, _mm256_add_epi16(b0, b2));
_mm256_storeu_si256((__m256i *)(coeff + 64), _mm256_add_epi16(b1, b3));
_mm256_storeu_si256((__m256i *)(coeff + 128), _mm256_sub_epi16(b0, b2));
_mm256_storeu_si256((__m256i *)(coeff + 192), _mm256_sub_epi16(b1, b3));
coeff += 16;
t_coeff += 16;
}
}
void aom_hadamard_32x32_avx2(const int16_t *src_diff, ptrdiff_t src_stride,
tran_low_t *coeff) {
// For high bitdepths, it is unnecessary to store_tran_low
@ -447,3 +479,26 @@ int aom_satd_avx2(const tran_low_t *coeff, int length) {
return _mm_cvtsi128_si32(accum_128);
}
}
int aom_satd_lp_avx2(const int16_t *coeff, int length) {
const __m256i one = _mm256_set1_epi16(1);
__m256i accum = _mm256_setzero_si256();
for (int i = 0; i < length; i += 16) {
const __m256i src_line = _mm256_loadu_si256((const __m256i *)coeff);
const __m256i abs = _mm256_abs_epi16(src_line);
const __m256i sum = _mm256_madd_epi16(abs, one);
accum = _mm256_add_epi32(accum, sum);
coeff += 16;
}
{ // 32 bit horizontal add
const __m256i a = _mm256_srli_si256(accum, 8);
const __m256i b = _mm256_add_epi32(accum, a);
const __m256i c = _mm256_srli_epi64(b, 32);
const __m256i d = _mm256_add_epi32(b, c);
const __m128i accum_128 = _mm_add_epi32(_mm256_castsi256_si128(d),
_mm256_extractf128_si256(d, 1));
return _mm_cvtsi128_si32(accum_128);
}
}

Some files were not shown because too many files have changed in this diff Show more