Update aom to slightly newer commit ID

This commit is contained in:
trav90 2018-10-17 05:59:08 -05:00 • committed by Roy Tam
commit 76f1e6edca
311 changed files with 55292 additions and 33790 deletions

View file

@ -1,6 +1,7 @@
Next Release
- Incompatible changes:
The AV1 encoder's default keyframe interval changed to 128 from 9999.
Support for armv6 was removed.
2016-04-07 v0.1.0 "AOMedia Codec 1"
This release is the first Alliance for Open Media codec.

View file

@ -9,6 +9,18 @@
## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
##
cmake_minimum_required(VERSION 3.5)
if (NOT EMSCRIPTEN)
if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
endif ()
endif ()
option(ENABLE_CCACHE "Enable ccache support." OFF)
option(ENABLE_DISTCC "Enable distcc support." OFF)
option(ENABLE_DOCS "Enable documentation generation (doxygen required)." ON)
option(ENABLE_NASM "Use nasm instead of yasm for x86 assembly." OFF)
project(AOM C CXX)
set(AOM_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
@ -114,15 +126,15 @@ set(AOM_COMMON_APP_UTIL_SOURCES
"${AOM_ROOT}/md5_utils.h"
"${AOM_ROOT}/tools_common.c"
"${AOM_ROOT}/tools_common.h"
"${AOM_ROOT}/video_common.h")
"${AOM_ROOT}/video_common.h"
"${AOM_ROOT}/y4menc.c"
"${AOM_ROOT}/y4menc.h")
set(AOM_DECODER_APP_UTIL_SOURCES
"${AOM_ROOT}/ivfdec.c"
"${AOM_ROOT}/ivfdec.h"
"${AOM_ROOT}/video_reader.c"
"${AOM_ROOT}/video_reader.h"
"${AOM_ROOT}/y4menc.c"
"${AOM_ROOT}/y4menc.h")
"${AOM_ROOT}/video_reader.h")
set(AOM_ENCODER_APP_UTIL_SOURCES
"${AOM_ROOT}/ivfenc.c"
@ -190,88 +202,117 @@ foreach (aom_lib ${AOM_LIB_TARGETS})
add_dependencies(${aom_lib} aom_rtcd)
endif ()
endforeach ()
#
# Application and application support targets.
#
add_library(aom_common_app_util OBJECT ${AOM_COMMON_APP_UTIL_SOURCES})
add_library(aom_decoder_app_util OBJECT ${AOM_DECODER_APP_UTIL_SOURCES})
add_library(aom_encoder_app_util OBJECT ${AOM_ENCODER_APP_UTIL_SOURCES})
add_executable(aom_cx_set_ref
"${AOM_ROOT}/examples/aom_cx_set_ref.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_encoder_app_util>)
add_executable(aomdec
if (CONFIG_AV1_DECODER)
add_library(aom_decoder_app_util OBJECT ${AOM_DECODER_APP_UTIL_SOURCES})
add_executable(aomdec
"${AOM_ROOT}/aomdec.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_decoder_app_util>)
add_executable(aomenc
"${AOM_ROOT}/aomenc.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_encoder_app_util>
$<TARGET_OBJECTS:aom_encoder_stats>)
if (CONFIG_ANALYZER)
add_executable(analyzer
"${AOM_ROOT}/examples/analyzer.cc"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_decoder_app_util>)
target_link_libraries(analyzer ${AOM_LIB_LINK_TYPE} ${wxWidgets_LIBRARIES})
set(AOM_APP_TARGETS ${AOM_APP_TARGETS} analyzer)
endif ()
if (CONFIG_ANALYZER)
add_executable(analyzer
"${AOM_ROOT}/examples/analyzer.cc"
add_executable(decode_to_md5
"${AOM_ROOT}/examples/decode_to_md5.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_decoder_app_util>)
target_link_libraries(analyzer PUBLIC ${wxWidgets_LIBRARIES})
set(AOM_APP_TARGETS ${AOM_APP_TARGETS} analyzer)
add_executable(decode_with_drops
"${AOM_ROOT}/examples/decode_with_drops.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_decoder_app_util>)
add_executable(simple_decoder
"${AOM_ROOT}/examples/simple_decoder.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_decoder_app_util>)
if (CONFIG_INSPECTION)
add_executable(inspect
"${AOM_ROOT}/examples/inspect.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_decoder_app_util>)
set(AOM_DECODER_EXAMPLE_TARGETS ${AOM_DECODER_EXAMPLE_TARGETS} inspect)
if (EMSCRIPTEN)
add_preproc_definition(_POSIX_SOURCE)
add_compiler_flag_if_supported("-s TOTAL_MEMORY=134217728")
add_compiler_flag_if_supported("-s MODULARIZE=1")
add_compiler_flag_if_supported("-s EXPORT_NAME=\"\'DecoderModule\'\"")
add_compiler_flag_if_supported("--memory-init-file 0")
if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
# Default to -O3 when no build type specified.
add_compiler_flag_if_supported("-O3")
endif ()
em_link_post_js(inspect "${AOM_ROOT}/tools/inspect-post.js")
endif ()
endif ()
# Maintain lists of example and app targets.
set(AOM_DECODER_EXAMPLE_TARGETS ${AOM_DECODER_EXAMPLE_TARGETS}
decode_to_md5 decode_with_drops simple_decoder)
set(AOM_APP_TARGETS ${AOM_APP_TARGETS} aomdec ${AOM_DECODER_EXAMPLE_TARGETS})
endif ()
add_executable(decode_to_md5
"${AOM_ROOT}/examples/decode_to_md5.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_decoder_app_util>)
add_executable(decode_with_drops
"${AOM_ROOT}/examples/decode_with_drops.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_decoder_app_util>)
if (CONFIG_AV1_ENCODER)
add_library(aom_encoder_app_util OBJECT ${AOM_ENCODER_APP_UTIL_SOURCES})
add_executable(aomenc
"${AOM_ROOT}/aomenc.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_encoder_app_util>
$<TARGET_OBJECTS:aom_encoder_stats>)
add_executable(lossless_encoder
"${AOM_ROOT}/examples/lossless_encoder.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_encoder_app_util>)
add_executable(set_maps
"${AOM_ROOT}/examples/set_maps.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_encoder_app_util>)
add_executable(simple_encoder
"${AOM_ROOT}/examples/simple_encoder.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_encoder_app_util>)
add_executable(twopass_encoder
"${AOM_ROOT}/examples/twopass_encoder.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_encoder_app_util>)
add_executable(lossless_encoder
"${AOM_ROOT}/examples/lossless_encoder.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_encoder_app_util>)
add_executable(set_maps
"${AOM_ROOT}/examples/set_maps.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_encoder_app_util>)
add_executable(simple_decoder
"${AOM_ROOT}/examples/simple_decoder.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_decoder_app_util>)
if (CONFIG_INSPECTION)
add_executable(inspect
"${AOM_ROOT}/examples/inspect.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_decoder_app_util>)
set(AOM_APP_TARGETS ${AOM_APP_TARGETS} inspect)
# Add encoder apps and examples to target lists.
set(AOM_ENCODER_EXAMPLE_TARGETS
lossless_encoder set_maps simple_encoder twopass_encoder)
set(AOM_APP_TARGETS ${AOM_APP_TARGETS} aomenc ${AOM_ENCODER_EXAMPLE_TARGETS})
endif ()
add_executable(simple_encoder
"${AOM_ROOT}/examples/simple_encoder.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_encoder_app_util>)
# Maintain a separate variable listing only the examples to facilitate
# installation of example programs into an examples sub directory of
# $AOM_DIST_DIR/bin when building the dist target.
set(AOM_EXAMPLE_TARGETS
${AOM_DECODER_EXAMPLE_TARGETS} ${AOM_ENCODER_EXAMPLE_TARGETS})
add_executable(twopass_encoder
"${AOM_ROOT}/examples/twopass_encoder.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_encoder_app_util>)
# List of app targets.
set(AOM_APP_TARGETS ${AOM_APP_TARGETS} aom_cx_set_ref aomdec aomenc
decode_to_md5 decode_with_drops lossless_encoder set_maps simple_decoder
simple_encoder twopass_encoder)
if (CONFIG_AV1_DECODER AND CONFIG_AV1_ENCODER)
add_executable(aom_cx_set_ref
"${AOM_ROOT}/examples/aom_cx_set_ref.c"
$<TARGET_OBJECTS:aom_common_app_util>
$<TARGET_OBJECTS:aom_encoder_app_util>)
set(AOM_EXAMPLE_TARGETS ${AOM_EXAMPLE_TARGETS} aom_cx_set_ref)
set(AOM_APP_TARGETS ${AOM_APP_TARGETS} aom_cx_set_ref)
endif ()
foreach (aom_app ${AOM_APP_TARGETS})
target_link_libraries(${aom_app} PUBLIC aom)
target_link_libraries(${aom_app} ${AOM_LIB_LINK_TYPE} aom)
endforeach ()
if (CONFIG_LIBYUV)
@ -297,8 +338,13 @@ if (CONFIG_WEBM_IO)
endif ()
# Add to existing targets.
target_sources(aom_decoder_app_util PUBLIC ${AOM_WEBM_DECODER_SOURCES})
target_sources(aom_encoder_app_util PUBLIC ${AOM_WEBM_ENCODER_SOURCES})
if (CONFIG_AV1_DECODER)
target_sources(aom_decoder_app_util PUBLIC ${AOM_WEBM_DECODER_SOURCES})
endif ()
if (CONFIG_AV1_ENCODER)
target_sources(aom_encoder_app_util PUBLIC ${AOM_WEBM_ENCODER_SOURCES})
endif ()
foreach (aom_app ${AOM_APP_TARGETS})
target_sources(${aom_app} PUBLIC $<TARGET_OBJECTS:webm>)
@ -314,7 +360,7 @@ endif ()
if (HAVE_PTHREAD_H AND CONFIG_MULTITHREAD)
find_package(Threads)
foreach (app_target ${AOM_APP_TARGETS})
target_link_libraries(${app_target} PUBLIC Threads::Threads)
target_link_libraries(${app_target} ${AOM_LIB_LINK_TYPE} Threads::Threads)
endforeach ()
endif ()
@ -337,23 +383,90 @@ if (XCODE)
endif ()
endif ()
if ("${CMAKE_GENERATOR}" MATCHES "Makefiles$" )
# Users of the configure build expect the example targets to be built in the
# examples sub directory of the configured build directory after running make.
file(MAKE_DIRECTORY "${AOM_CONFIG_DIR}/examples")
set_target_properties(${AOM_EXAMPLE_TARGETS} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${AOM_CONFIG_DIR}/examples")
endif ()
# Aomedia documentation rule.
if (ENABLE_DOCS)
include(FindDoxygen)
if (DOXYGEN_FOUND)
include("${AOM_ROOT}/docs.cmake")
setup_documentation_targets()
else ()
message("--- Cannot find doxygen, ENABLE_DOCS turned off.")
set(ENABLE_DOCS OFF)
endif ()
endif ()
# Aomedia install rule.
# TODO(tomfinegan): Add the missing pkg-config related bits.
set(AOM_INSTALL_INCS
"${AOM_ROOT}/aom/aom.h"
"${AOM_ROOT}/aom/aomcx.h"
"${AOM_ROOT}/aom/aomdx.h"
"${AOM_ROOT}/aom/aom_codec.h"
"${AOM_ROOT}/aom/aom_frame_buffer.h"
"${AOM_ROOT}/aom/aom_image.h"
"${AOM_ROOT}/aom/aom_integer.h"
"${AOM_ROOT}/aom/aom_decoder.h"
"${AOM_ROOT}/aom/aom_encoder.h"
"${AOM_ROOT}/aom/aom.h")
set(AOM_INSTALL_BINS aomdec aomenc)
if (CONFIG_AV1_DECODER)
set(AOM_INSTALL_BINS ${AOM_INSTALL_BINS} aomdec)
set(AOM_INSTALL_INCS
${AOM_INSTALL_INCS}
"${AOM_ROOT}/aom/aom_decoder.h"
"${AOM_ROOT}/aom/aomdx.h")
endif ()
if (CONFIG_AV1_ENCODER)
set(AOM_INSTALL_INCS
${AOM_INSTALL_INCS}
"${AOM_ROOT}/aom/aomcx.h"
"${AOM_ROOT}/aom/aom_encoder.h")
set(AOM_INSTALL_BINS ${AOM_INSTALL_BINS} aomenc)
endif ()
set(AOM_INSTALL_LIBS aom)
install(FILES ${AOM_INSTALL_INCS}
DESTINATION "${CMAKE_INSTALL_PREFIX}/include/aom")
install(FILES "${AOM_CONFIG_DIR}/aom.pc"
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
install(TARGETS ${AOM_INSTALL_LIBS} DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
install(TARGETS ${AOM_INSTALL_BINS} DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
# Aomedia dist rule.
if (CONFIG_AV1_DECODER)
set(AOM_DIST_APPS ${AOM_DIST_APPS} $<TARGET_FILE:aomdec>)
endif ()
if (CONFIG_AV1_ENCODER)
set(AOM_DIST_APPS ${AOM_DIST_APPS} $<TARGET_FILE:aomenc>)
endif ()
foreach (example ${AOM_EXAMPLE_TARGETS})
list(APPEND AOM_DIST_EXAMPLES $<TARGET_FILE:${example}>)
endforeach ()
if (NOT AOM_DIST_DIR)
set(AOM_DIST_DIR "${AOM_CONFIG_DIR}/dist")
endif ()
add_custom_target(dist
COMMAND ${CMAKE_COMMAND}
-DAOM_ROOT=${AOM_ROOT}
-DAOM_CONFIG_DIR=${AOM_CONFIG_DIR}
-DAOM_DIST_DIR=${AOM_DIST_DIR}
-DAOM_DIST_APPS="${AOM_DIST_APPS}"
-DAOM_DIST_EXAMPLES="${AOM_DIST_EXAMPLES}"
-DAOM_DIST_INCLUDES="${AOM_INSTALL_INCS}"
-DAOM_DIST_LIBS=$<TARGET_FILE:aom>
-DENABLE_DOCS=${ENABLE_DOCS}
-P "${AOM_ROOT}/build/cmake/dist.cmake"
DEPENDS ${AOM_INSTALL_BINS} ${AOM_INSTALL_LIBS}
${AOM_INSTALL_INCS} ${AOM_EXAMPLE_TARGETS})
if (ENABLE_DOCS)
add_dependencies(dist docs)
endif ()

View file

@ -47,9 +47,6 @@ COMPILING THE APPLICATIONS/LIBRARIES:
--help output of the configure script. As of this writing, the list of
available targets is:
armv6-linux-rvct
armv6-linux-gcc
armv6-none-rvct
arm64-darwin-gcc
armv7-android-gcc
armv7-darwin-gcc

View file

@ -84,11 +84,9 @@ extern "C" {
/*!\brief Stream properties
*
* This structure is used to query or set properties of the decoded
* stream. Algorithms may extend this structure with data specific
* to their bitstream by setting the sz member appropriately.
* stream.
*/
typedef struct aom_codec_stream_info {
unsigned int sz; /**< Size of this structure */
unsigned int w; /**< Width (or 0 for unknown/default) */
unsigned int h; /**< Height (or 0 for unknown/default) */
unsigned int is_kf; /**< Current frame is a keyframe */
@ -154,13 +152,15 @@ aom_codec_err_t aom_codec_dec_init_ver(aom_codec_ctx_t *ctx,
* \param[in] iface Pointer to the algorithm interface
* \param[in] data Pointer to a block of data to parse
* \param[in] data_sz Size of the data buffer
* \param[in,out] si Pointer to stream info to update. The size member
* \ref MUST be properly initialized, but \ref MAY be
* clobbered by the algorithm. This parameter \ref MAY
* be NULL.
* \param[in,out] si Pointer to stream info to update.
*
* \retval #AOM_CODEC_OK
* Bitstream is parsable and stream information updated
* Bitstream is parsable and stream information updated.
* \retval #AOM_CODEC_INVALID_PARAM
* One of the arguments is invalid, for example a NULL pointer.
* \retval #AOM_CODEC_UNSUP_BITSTREAM
* The decoder didn't recognize the coded data, or the
* buffer was too short.
*/
aom_codec_err_t aom_codec_peek_stream_info(aom_codec_iface_t *iface,
const uint8_t *data,
@ -172,13 +172,14 @@ aom_codec_err_t aom_codec_peek_stream_info(aom_codec_iface_t *iface,
* Returns information about the stream that has been parsed during decoding.
*
* \param[in] ctx Pointer to this instance's context
* \param[in,out] si Pointer to stream info to update. The size member
* \ref MUST be properly initialized, but \ref MAY be
* clobbered by the algorithm. This parameter \ref MAY
* be NULL.
* \param[in,out] si Pointer to stream info to update.
*
* \retval #AOM_CODEC_OK
* Bitstream is parsable and stream information updated
* Bitstream is parsable and stream information updated.
* \retval #AOM_CODEC_INVALID_PARAM
* One of the arguments is invalid, for example a NULL pointer.
* \retval #AOM_CODEC_UNSUP_BITSTREAM
* The decoder couldn't parse the submitted data.
*/
aom_codec_err_t aom_codec_get_stream_info(aom_codec_ctx_t *ctx,
aom_codec_stream_info_t *si);

View file

@ -37,13 +37,17 @@ extern aom_codec_iface_t aom_codec_av1_dx_algo;
extern aom_codec_iface_t *aom_codec_av1_dx(void);
/*!@} - end algorithm interface member group*/
#ifndef AOM_ACCOUNTING_H_
/** Data structure that stores bit accounting for debug
*/
typedef struct Accounting Accounting;
#endif
#ifndef AOM_INSPECTION_H_
/** Callback that inspects decoder frame data.
*/
typedef void (*aom_inspect_cb)(void *decoder, void *ctx);
#endif
/*!\brief Structure to hold inspection callback and context.
*

View file

@ -43,7 +43,6 @@
*/
#ifndef AOM_INTERNAL_AOM_CODEC_INTERNAL_H_
#define AOM_INTERNAL_AOM_CODEC_INTERNAL_H_
#include "./aom_config.h"
#include "../aom_decoder.h"
#include "../aom_encoder.h"
#include <stdarg.h>
@ -441,25 +440,6 @@ void aom_internal_error(struct aom_internal_error_info *info,
...) CLANG_ANALYZER_NORETURN;
void aom_merge_corrupted_flag(int *corrupted, int value);
#if CONFIG_DEBUG
#define AOM_CHECK_MEM_ERROR(error_info, lval, expr) \
do { \
lval = (expr); \
if (!lval) \
aom_internal_error(error_info, AOM_CODEC_MEM_ERROR, \
"Failed to allocate " #lval " at %s:%d", __FILE__, \
__LINE__); \
} while (0)
#else
#define AOM_CHECK_MEM_ERROR(error_info, lval, expr) \
do { \
lval = (expr); \
if (!lval) \
aom_internal_error(error_info, AOM_CODEC_MEM_ERROR, \
"Failed to allocate " #lval); \
} while (0)
#endif
#ifdef __cplusplus
} // extern "C"
#endif

View file

@ -69,10 +69,9 @@ aom_codec_err_t aom_codec_peek_stream_info(aom_codec_iface_t *iface,
aom_codec_stream_info_t *si) {
aom_codec_err_t res;
if (!iface || !data || !data_sz || !si ||
si->sz < sizeof(aom_codec_stream_info_t))
if (!iface || !data || !data_sz || !si) {
res = AOM_CODEC_INVALID_PARAM;
else {
} else {
/* Set default/unknown values */
si->w = 0;
si->h = 0;
@ -87,11 +86,11 @@ aom_codec_err_t aom_codec_get_stream_info(aom_codec_ctx_t *ctx,
aom_codec_stream_info_t *si) {
aom_codec_err_t res;
if (!ctx || !si || si->sz < sizeof(aom_codec_stream_info_t))
if (!ctx || !si) {
res = AOM_CODEC_INVALID_PARAM;
else if (!ctx->iface || !ctx->priv)
} else if (!ctx->iface || !ctx->priv) {
res = AOM_CODEC_ERROR;
else {
} else {
/* Set default/unknown values */
si->w = 0;
si->h = 0;

View file

@ -337,14 +337,14 @@ static void convolve_add_src_horiz(const uint8_t *src, ptrdiff_t src_stride,
uint8_t *dst, ptrdiff_t dst_stride,
const InterpKernel *x_filters, int x0_q4,
int x_step_q4, int w, int h) {
int x, y;
int x, y, k;
src -= SUBPEL_TAPS / 2 - 1;
for (y = 0; y < h; ++y) {
int x_q4 = x0_q4;
for (x = 0; x < w; ++x) {
const uint8_t *const src_x = &src[x_q4 >> SUBPEL_BITS];
const int16_t *const x_filter = x_filters[x_q4 & SUBPEL_MASK];
int k, sum = 0;
int sum = 0;
for (k = 0; k < SUBPEL_TAPS; ++k) sum += src_x[k] * x_filter[k];
dst[x] = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS) +
src_x[SUBPEL_TAPS / 2 - 1]);
@ -359,7 +359,7 @@ static void convolve_add_src_vert(const uint8_t *src, ptrdiff_t src_stride,
uint8_t *dst, ptrdiff_t dst_stride,
const InterpKernel *y_filters, int y0_q4,
int y_step_q4, int w, int h) {
int x, y;
int x, y, k;
src -= src_stride * (SUBPEL_TAPS / 2 - 1);
for (x = 0; x < w; ++x) {
@ -367,7 +367,7 @@ static void convolve_add_src_vert(const uint8_t *src, ptrdiff_t src_stride,
for (y = 0; y < h; ++y) {
const unsigned char *src_y = &src[(y_q4 >> SUBPEL_BITS) * src_stride];
const int16_t *const y_filter = y_filters[y_q4 & SUBPEL_MASK];
int k, sum = 0;
int sum = 0;
for (k = 0; k < SUBPEL_TAPS; ++k)
sum += src_y[k * src_stride] * y_filter[k];
dst[y * dst_stride] =
@ -446,6 +446,127 @@ void aom_convolve8_add_src_c(const uint8_t *src, ptrdiff_t src_stride,
convolve_add_src(src, src_stride, dst, dst_stride, filters_x, x0_q4,
x_step_q4, filters_y, y0_q4, y_step_q4, w, h);
}
static void convolve_add_src_horiz_hip(const uint8_t *src, ptrdiff_t src_stride,
uint16_t *dst, ptrdiff_t dst_stride,
const InterpKernel *x_filters, int x0_q4,
int x_step_q4, int w, int h) {
const int bd = 8;
int x, y, k;
src -= SUBPEL_TAPS / 2 - 1;
for (y = 0; y < h; ++y) {
int x_q4 = x0_q4;
for (x = 0; x < w; ++x) {
const uint8_t *const src_x = &src[x_q4 >> SUBPEL_BITS];
const int16_t *const x_filter = x_filters[x_q4 & SUBPEL_MASK];
int sum = ((int)src_x[SUBPEL_TAPS / 2 - 1] << FILTER_BITS) +
(1 << (bd + FILTER_BITS - 1));
for (k = 0; k < SUBPEL_TAPS; ++k) sum += src_x[k] * x_filter[k];
dst[x] =
(uint16_t)clamp(ROUND_POWER_OF_TWO(sum, FILTER_BITS - EXTRAPREC_BITS),
0, EXTRAPREC_CLAMP_LIMIT(bd) - 1);
x_q4 += x_step_q4;
}
src += src_stride;
dst += dst_stride;
}
}
static void convolve_add_src_vert_hip(const uint16_t *src, ptrdiff_t src_stride,
uint8_t *dst, ptrdiff_t dst_stride,
const InterpKernel *y_filters, int y0_q4,
int y_step_q4, int w, int h) {
const int bd = 8;
int x, y, k;
src -= src_stride * (SUBPEL_TAPS / 2 - 1);
for (x = 0; x < w; ++x) {
int y_q4 = y0_q4;
for (y = 0; y < h; ++y) {
const uint16_t *src_y = &src[(y_q4 >> SUBPEL_BITS) * src_stride];
const int16_t *const y_filter = y_filters[y_q4 & SUBPEL_MASK];
int sum =
((int)src_y[(SUBPEL_TAPS / 2 - 1) * src_stride] << FILTER_BITS) -
(1 << (bd + FILTER_BITS + EXTRAPREC_BITS - 1));
for (k = 0; k < SUBPEL_TAPS; ++k)
sum += src_y[k * src_stride] * y_filter[k];
dst[y * dst_stride] =
clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS + EXTRAPREC_BITS));
y_q4 += y_step_q4;
}
++src;
++dst;
}
}
static void convolve_add_src_hip(const uint8_t *src, ptrdiff_t src_stride,
uint8_t *dst, ptrdiff_t dst_stride,
const InterpKernel *const x_filters, int x0_q4,
int x_step_q4,
const InterpKernel *const y_filters, int y0_q4,
int y_step_q4, int w, int h) {
uint16_t temp[MAX_EXT_SIZE * MAX_SB_SIZE];
int intermediate_height =
(((h - 1) * y_step_q4 + y0_q4) >> SUBPEL_BITS) + SUBPEL_TAPS;
assert(w <= MAX_SB_SIZE);
assert(h <= MAX_SB_SIZE);
assert(y_step_q4 <= 32);
assert(x_step_q4 <= 32);
convolve_add_src_horiz_hip(src - src_stride * (SUBPEL_TAPS / 2 - 1),
src_stride, temp, MAX_SB_SIZE, x_filters, x0_q4,
x_step_q4, w, intermediate_height);
convolve_add_src_vert_hip(temp + MAX_SB_SIZE * (SUBPEL_TAPS / 2 - 1),
MAX_SB_SIZE, dst, dst_stride, y_filters, y0_q4,
y_step_q4, w, h);
}
void aom_convolve8_add_src_horiz_hip_c(const uint8_t *src, ptrdiff_t src_stride,
uint16_t *dst, ptrdiff_t dst_stride,
const int16_t *filter_x, int x_step_q4,
const int16_t *filter_y, int y_step_q4,
int w, int h) {
const InterpKernel *const filters_x = get_filter_base(filter_x);
const int x0_q4 = get_filter_offset(filter_x, filters_x);
(void)filter_y;
(void)y_step_q4;
convolve_add_src_horiz_hip(src, src_stride, dst, dst_stride, filters_x, x0_q4,
x_step_q4, w, h);
}
void aom_convolve8_add_src_vert_hip_c(const uint16_t *src, ptrdiff_t src_stride,
uint8_t *dst, ptrdiff_t dst_stride,
const int16_t *filter_x, int x_step_q4,
const int16_t *filter_y, int y_step_q4,
int w, int h) {
const InterpKernel *const filters_y = get_filter_base(filter_y);
const int y0_q4 = get_filter_offset(filter_y, filters_y);
(void)filter_x;
(void)x_step_q4;
convolve_add_src_vert_hip(src, src_stride, dst, dst_stride, filters_y, y0_q4,
y_step_q4, w, h);
}
void aom_convolve8_add_src_hip_c(const uint8_t *src, ptrdiff_t src_stride,
uint8_t *dst, ptrdiff_t dst_stride,
const int16_t *filter_x, int x_step_q4,
const int16_t *filter_y, int y_step_q4, int w,
int h) {
const InterpKernel *const filters_x = get_filter_base(filter_x);
const int x0_q4 = get_filter_offset(filter_x, filters_x);
const InterpKernel *const filters_y = get_filter_base(filter_y);
const int y0_q4 = get_filter_offset(filter_y, filters_y);
convolve_add_src_hip(src, src_stride, dst, dst_stride, filters_x, x0_q4,
x_step_q4, filters_y, y0_q4, y_step_q4, w, h);
}
#endif // CONFIG_LOOP_RESTORATION
#if CONFIG_HIGHBITDEPTH
@ -721,7 +842,7 @@ static void highbd_convolve_add_src_horiz(const uint8_t *src8,
const InterpKernel *x_filters,
int x0_q4, int x_step_q4, int w,
int h, int bd) {
int x, y;
int x, y, k;
uint16_t *src = CONVERT_TO_SHORTPTR(src8);
uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
src -= SUBPEL_TAPS / 2 - 1;
@ -730,7 +851,7 @@ static void highbd_convolve_add_src_horiz(const uint8_t *src8,
for (x = 0; x < w; ++x) {
const uint16_t *const src_x = &src[x_q4 >> SUBPEL_BITS];
const int16_t *const x_filter = x_filters[x_q4 & SUBPEL_MASK];
int k, sum = 0;
int sum = 0;
for (k = 0; k < SUBPEL_TAPS; ++k) sum += src_x[k] * x_filter[k];
dst[x] = clip_pixel_highbd(
ROUND_POWER_OF_TWO(sum, FILTER_BITS) + src_x[SUBPEL_TAPS / 2 - 1],
@ -748,7 +869,7 @@ static void highbd_convolve_add_src_vert(const uint8_t *src8,
const InterpKernel *y_filters,
int y0_q4, int y_step_q4, int w, int h,
int bd) {
int x, y;
int x, y, k;
uint16_t *src = CONVERT_TO_SHORTPTR(src8);
uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
src -= src_stride * (SUBPEL_TAPS / 2 - 1);
@ -757,7 +878,7 @@ static void highbd_convolve_add_src_vert(const uint8_t *src8,
for (y = 0; y < h; ++y) {
const uint16_t *src_y = &src[(y_q4 >> SUBPEL_BITS) * src_stride];
const int16_t *const y_filter = y_filters[y_q4 & SUBPEL_MASK];
int k, sum = 0;
int sum = 0;
for (k = 0; k < SUBPEL_TAPS; ++k)
sum += src_y[k * src_stride] * y_filter[k];
dst[y * dst_stride] =
@ -850,5 +971,135 @@ void aom_highbd_convolve8_add_src_c(const uint8_t *src, ptrdiff_t src_stride,
highbd_convolve_add_src(src, src_stride, dst, dst_stride, filters_x, x0_q4,
x_step_q4, filters_y, y0_q4, y_step_q4, w, h, bd);
}
static void highbd_convolve_add_src_horiz_hip(
const uint8_t *src8, ptrdiff_t src_stride, uint16_t *dst,
ptrdiff_t dst_stride, const InterpKernel *x_filters, int x0_q4,
int x_step_q4, int w, int h, int bd) {
const int extraprec_clamp_limit = EXTRAPREC_CLAMP_LIMIT(bd);
int x, y, k;
uint16_t *src = CONVERT_TO_SHORTPTR(src8);
src -= SUBPEL_TAPS / 2 - 1;
for (y = 0; y < h; ++y) {
int x_q4 = x0_q4;
for (x = 0; x < w; ++x) {
const uint16_t *const src_x = &src[x_q4 >> SUBPEL_BITS];
const int16_t *const x_filter = x_filters[x_q4 & SUBPEL_MASK];
int sum = ((int)src_x[SUBPEL_TAPS / 2 - 1] << FILTER_BITS) +
(1 << (bd + FILTER_BITS - 1));
for (k = 0; k < SUBPEL_TAPS; ++k) sum += src_x[k] * x_filter[k];
dst[x] =
(uint16_t)clamp(ROUND_POWER_OF_TWO(sum, FILTER_BITS - EXTRAPREC_BITS),
0, extraprec_clamp_limit - 1);
x_q4 += x_step_q4;
}
src += src_stride;
dst += dst_stride;
}
}
static void highbd_convolve_add_src_vert_hip(
const uint16_t *src, ptrdiff_t src_stride, uint8_t *dst8,
ptrdiff_t dst_stride, const InterpKernel *y_filters, int y0_q4,
int y_step_q4, int w, int h, int bd) {
int x, y, k;
uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
src -= src_stride * (SUBPEL_TAPS / 2 - 1);
for (x = 0; x < w; ++x) {
int y_q4 = y0_q4;
for (y = 0; y < h; ++y) {
const uint16_t *src_y = &src[(y_q4 >> SUBPEL_BITS) * src_stride];
const int16_t *const y_filter = y_filters[y_q4 & SUBPEL_MASK];
int sum =
((int)src_y[(SUBPEL_TAPS / 2 - 1) * src_stride] << FILTER_BITS) -
(1 << (bd + FILTER_BITS + EXTRAPREC_BITS - 1));
for (k = 0; k < SUBPEL_TAPS; ++k)
sum += src_y[k * src_stride] * y_filter[k];
dst[y * dst_stride] = clip_pixel_highbd(
ROUND_POWER_OF_TWO(sum, FILTER_BITS + EXTRAPREC_BITS), bd);
y_q4 += y_step_q4;
}
++src;
++dst;
}
}
static void highbd_convolve_add_src_hip(
const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
ptrdiff_t dst_stride, const InterpKernel *const x_filters, int x0_q4,
int x_step_q4, const InterpKernel *const y_filters, int y0_q4,
int y_step_q4, int w, int h, int bd) {
// Note: Fixed size intermediate buffer, temp, places limits on parameters.
// 2d filtering proceeds in 2 steps:
// (1) Interpolate horizontally into an intermediate buffer, temp.
// (2) Interpolate temp vertically to derive the sub-pixel result.
// Deriving the maximum number of rows in the temp buffer (135):
// --Smallest scaling factor is x1/2 ==> y_step_q4 = 32 (Normative).
// --Largest block size is 64x64 pixels.
// --64 rows in the downscaled frame span a distance of (64 - 1) * 32 in the
// original frame (in 1/16th pixel units).
// --Must round-up because block may be located at sub-pixel position.
// --Require an additional SUBPEL_TAPS rows for the 8-tap filter tails.
// --((64 - 1) * 32 + 15) >> 4 + 8 = 135.
uint16_t temp[MAX_EXT_SIZE * MAX_SB_SIZE];
int intermediate_height =
(((h - 1) * y_step_q4 + y0_q4) >> SUBPEL_BITS) + SUBPEL_TAPS;
assert(w <= MAX_SB_SIZE);
assert(h <= MAX_SB_SIZE);
assert(y_step_q4 <= 32);
assert(x_step_q4 <= 32);
highbd_convolve_add_src_horiz_hip(
src - src_stride * (SUBPEL_TAPS / 2 - 1), src_stride, temp, MAX_SB_SIZE,
x_filters, x0_q4, x_step_q4, w, intermediate_height, bd);
highbd_convolve_add_src_vert_hip(temp + MAX_SB_SIZE * (SUBPEL_TAPS / 2 - 1),
MAX_SB_SIZE, dst, dst_stride, y_filters,
y0_q4, y_step_q4, w, h, bd);
}
void aom_highbd_convolve8_add_src_horiz_hip_c(
const uint8_t *src, ptrdiff_t src_stride, uint16_t *dst,
ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4,
const int16_t *filter_y, int y_step_q4, int w, int h, int bd) {
const InterpKernel *const filters_x = get_filter_base(filter_x);
const int x0_q4 = get_filter_offset(filter_x, filters_x);
(void)filter_y;
(void)y_step_q4;
highbd_convolve_add_src_horiz_hip(src, src_stride, dst, dst_stride, filters_x,
x0_q4, x_step_q4, w, h, bd);
}
void aom_highbd_convolve8_add_src_vert_hip_c(
const uint16_t *src, ptrdiff_t src_stride, uint8_t *dst,
ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4,
const int16_t *filter_y, int y_step_q4, int w, int h, int bd) {
const InterpKernel *const filters_y = get_filter_base(filter_y);
const int y0_q4 = get_filter_offset(filter_y, filters_y);
(void)filter_x;
(void)x_step_q4;
highbd_convolve_add_src_vert_hip(src, src_stride, dst, dst_stride, filters_y,
y0_q4, y_step_q4, w, h, bd);
}
void aom_highbd_convolve8_add_src_hip_c(const uint8_t *src,
ptrdiff_t src_stride, uint8_t *dst,
ptrdiff_t dst_stride,
const int16_t *filter_x, int x_step_q4,
const int16_t *filter_y, int y_step_q4,
int w, int h, int bd) {
const InterpKernel *const filters_x = get_filter_base(filter_x);
const int x0_q4 = get_filter_offset(filter_x, filters_x);
const InterpKernel *const filters_y = get_filter_base(filter_y);
const int y0_q4 = get_filter_offset(filter_y, filters_y);
highbd_convolve_add_src_hip(src, src_stride, dst, dst_stride, filters_x,
x0_q4, x_step_q4, filters_y, y0_q4, y_step_q4, w,
h, bd);
}
#endif // CONFIG_LOOP_RESTORATION
#endif // CONFIG_HIGHBITDEPTH

View file

@ -36,6 +36,11 @@ extern "C" {
#define MAX_EXT_SIZE 135
#endif // CONFIG_AV1 && CONFIG_EXT_PARTITION
#if CONFIG_AV1 && CONFIG_LOOP_RESTORATION
#define EXTRAPREC_BITS 2
#define EXTRAPREC_CLAMP_LIMIT(bd) (1 << ((bd) + 1 + EXTRAPREC_BITS))
#endif
typedef void (*convolve_fn_t)(const uint8_t *src, ptrdiff_t src_stride,
uint8_t *dst, ptrdiff_t dst_stride,
const int16_t *filter_x, int x_step_q4,

View file

@ -8,6 +8,9 @@
## 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.
##
if (NOT AOM_AOM_DSP_AOM_DSP_CMAKE_)
set(AOM_AOM_DSP_AOM_DSP_CMAKE_ 1)
set(AOM_DSP_COMMON_SOURCES
"${AOM_ROOT}/aom_dsp/aom_convolve.c"
"${AOM_ROOT}/aom_dsp/aom_convolve.h"
@ -23,7 +26,6 @@ set(AOM_DSP_COMMON_SOURCES
"${AOM_ROOT}/aom_dsp/loopfilter.c"
"${AOM_ROOT}/aom_dsp/prob.c"
"${AOM_ROOT}/aom_dsp/prob.h"
"${AOM_ROOT}/aom_dsp/sad.c"
"${AOM_ROOT}/aom_dsp/simd/v128_intrinsics.h"
"${AOM_ROOT}/aom_dsp/simd/v128_intrinsics_c.h"
"${AOM_ROOT}/aom_dsp/simd/v256_intrinsics.h"
@ -62,8 +64,10 @@ set(AOM_DSP_COMMON_INTRIN_SSE4_1
set(AOM_DSP_COMMON_INTRIN_AVX2
"${AOM_ROOT}/aom_dsp/x86/aom_subpixel_8t_intrin_avx2.c"
"${AOM_ROOT}/aom_dsp/x86/fwd_txfm_avx2.c"
"${AOM_ROOT}/aom_dsp/x86/loopfilter_avx2.c")
"${AOM_ROOT}/aom_dsp/x86/loopfilter_avx2.c"
"${AOM_ROOT}/aom_dsp/x86/inv_txfm_avx2.c"
"${AOM_ROOT}/aom_dsp/x86/inv_txfm_common_avx2.h"
"${AOM_ROOT}/aom_dsp/x86/txfm_common_avx2.h")
set(AOM_DSP_COMMON_ASM_NEON
"${AOM_ROOT}/aom_dsp/arm/aom_convolve8_avg_neon_asm.asm"
@ -175,6 +179,8 @@ set(AOM_DSP_COMMON_INTRIN_MSA
if (CONFIG_HIGHBITDEPTH)
set(AOM_DSP_COMMON_ASM_SSE2
${AOM_DSP_COMMON_ASM_SSE2}
"${AOM_ROOT}/aom_dsp/x86/aom_high_subpixel_8t_sse2.asm"
"${AOM_ROOT}/aom_dsp/x86/aom_high_subpixel_bilinear_sse2.asm"
"${AOM_ROOT}/aom_dsp/x86/highbd_intrapred_sse2.asm")
set(AOM_DSP_COMMON_INTRIN_SSE2
@ -198,7 +204,7 @@ if (CONFIG_ANS)
set(AOM_DSP_COMMON_SOURCES
${AOM_DSP_COMMON_SOURCES}
"${AOM_ROOT}/aom_dsp/ans.h")
elseif (CONFIG_DAALA_EC)
else ()
set(AOM_DSP_COMMON_SOURCES
${AOM_DSP_COMMON_SOURCES}
"${AOM_ROOT}/aom_dsp/entcode.c"
@ -221,7 +227,7 @@ if (CONFIG_AV1)
"${AOM_ROOT}/aom_dsp/x86/inv_txfm_sse2.h")
endif ()
if (CONFIG_DECODERS)
if (CONFIG_AV1_DECODER)
set(AOM_DSP_DECODER_SOURCES
"${AOM_ROOT}/aom_dsp/binary_codes_reader.c"
"${AOM_ROOT}/aom_dsp/binary_codes_reader.h"
@ -233,22 +239,17 @@ if (CONFIG_DECODERS)
set(AOM_DSP_DECODER_SOURCES
${AOM_DSP_DECODER_SOURCES}
"${AOM_ROOT}/aom_dsp/ansreader.h")
elseif (CONFIG_DAALA_EC)
else ()
set(AOM_DSP_DECODER_SOURCES
${AOM_DSP_DECODER_SOURCES}
"${AOM_ROOT}/aom_dsp/daalaboolreader.c"
"${AOM_ROOT}/aom_dsp/daalaboolreader.h"
"${AOM_ROOT}/aom_dsp/entdec.c"
"${AOM_ROOT}/aom_dsp/entdec.h")
else ()
set(AOM_DSP_DECODER_SOURCES
${AOM_DSP_DECODER_SOURCES}
"${AOM_ROOT}/aom_dsp/dkboolreader.c"
"${AOM_ROOT}/aom_dsp/dkboolreader.h")
endif ()
endif ()
if (CONFIG_ENCODERS)
if (CONFIG_AV1_ENCODER)
set(AOM_DSP_ENCODER_SOURCES
"${AOM_ROOT}/aom_dsp/binary_codes_writer.c"
"${AOM_ROOT}/aom_dsp/binary_codes_writer.h"
@ -257,6 +258,7 @@ if (CONFIG_ENCODERS)
"${AOM_ROOT}/aom_dsp/bitwriter_buffer.h"
"${AOM_ROOT}/aom_dsp/psnr.c"
"${AOM_ROOT}/aom_dsp/psnr.h"
"${AOM_ROOT}/aom_dsp/sad.c"
"${AOM_ROOT}/aom_dsp/variance.c"
"${AOM_ROOT}/aom_dsp/variance.h")
@ -282,6 +284,9 @@ if (CONFIG_ENCODERS)
set(AOM_DSP_ENCODER_ASM_SSE4_1 "${AOM_ROOT}/aom_dsp/x86/sad_sse4.asm")
set(AOM_DSP_ENCODER_INTRIN_AVX2
"${AOM_ROOT}/aom_dsp/x86/fwd_dct32x32_impl_avx2.h"
"${AOM_ROOT}/aom_dsp/x86/fwd_txfm_avx2.c"
"${AOM_ROOT}/aom_dsp/x86/fwd_txfm_avx2.h"
"${AOM_ROOT}/aom_dsp/x86/sad4d_avx2.c"
"${AOM_ROOT}/aom_dsp/x86/sad_avx2.c"
"${AOM_ROOT}/aom_dsp/x86/sad_impl_avx2.c"
@ -310,11 +315,6 @@ if (CONFIG_ENCODERS)
"${AOM_ROOT}/aom_dsp/x86/variance_sse2.c"
"${AOM_ROOT}/aom_dsp/x86/sum_squares_sse2.c")
set(AOM_DSP_ENCODER_INTRIN_SSSE3
${AOM_DSP_ENCODER_INTRIN_SSSE3}
"${AOM_ROOT}/aom_dsp/x86/masked_sad_intrin_ssse3.c"
"${AOM_ROOT}/aom_dsp/x86/masked_variance_intrin_ssse3.c")
set(AOM_DSP_ENCODER_ASM_SSSE3_X86_64
${AOM_DSP_ENCODER_ASM_SSSE3_X86_64}
"${AOM_ROOT}/aom_dsp/x86/avg_ssse3_x86_64.asm"
@ -325,7 +325,6 @@ if (CONFIG_ENCODERS)
"${AOM_ROOT}/aom_dsp/x86/quantize_avx_x86_64.asm")
set(AOM_DSP_ENCODER_INTRIN_MSA
"${AOM_ROOT}/aom_dsp/mips/avg_msa.c"
"${AOM_ROOT}/aom_dsp/mips/sad_msa.c"
"${AOM_ROOT}/aom_dsp/mips/subtract_msa.c"
"${AOM_ROOT}/aom_dsp/mips/variance_msa.c"
@ -345,9 +344,7 @@ if (CONFIG_ENCODERS)
"${AOM_ROOT}/aom_dsp/x86/highbd_sad4d_sse2.asm"
"${AOM_ROOT}/aom_dsp/x86/highbd_sad_sse2.asm"
"${AOM_ROOT}/aom_dsp/x86/highbd_subpel_variance_impl_sse2.asm"
"${AOM_ROOT}/aom_dsp/x86/highbd_variance_impl_sse2.asm"
"${AOM_ROOT}/aom_dsp/x86/aom_high_subpixel_8t_sse2.asm"
"${AOM_ROOT}/aom_dsp/x86/aom_high_subpixel_bilinear_sse2.asm")
"${AOM_ROOT}/aom_dsp/x86/highbd_variance_impl_sse2.asm")
set(AOM_DSP_ENCODER_INTRIN_SSE2
${AOM_DSP_ENCODER_INTRIN_SSE2}
@ -368,18 +365,13 @@ if (CONFIG_ENCODERS)
"${AOM_ROOT}/aom_dsp/answriter.h"
"${AOM_ROOT}/aom_dsp/buf_ans.c"
"${AOM_ROOT}/aom_dsp/buf_ans.h")
elseif (CONFIG_DAALA_EC)
else ()
set(AOM_DSP_ENCODER_SOURCES
${AOM_DSP_ENCODER_SOURCES}
"${AOM_ROOT}/aom_dsp/daalaboolwriter.c"
"${AOM_ROOT}/aom_dsp/daalaboolwriter.h"
"${AOM_ROOT}/aom_dsp/entenc.c"
"${AOM_ROOT}/aom_dsp/entenc.h")
else ()
set(AOM_DSP_ENCODER_SOURCES
${AOM_DSP_ENCODER_SOURCES}
"${AOM_ROOT}/aom_dsp/dkboolwriter.c"
"${AOM_ROOT}/aom_dsp/dkboolwriter.h")
endif ()
if (CONFIG_INTERNAL_STATS)
@ -392,6 +384,18 @@ if (CONFIG_ENCODERS)
endif ()
endif ()
if (CONFIG_LOOP_RESTORATION)
set(AOM_DSP_COMMON_INTRIN_SSE2
${AOM_DSP_COMMON_INTRIN_SSE2}
"${AOM_ROOT}/aom_dsp/x86/aom_convolve_hip_sse2.c")
if (CONFIG_HIGHBITDEPTH)
set(AOM_DSP_COMMON_INTRIN_SSSE3
${AOM_DSP_COMMON_INTRIN_SSSE3}
"${AOM_ROOT}/aom_dsp/x86/aom_highbd_convolve_hip_ssse3.c")
endif ()
endif ()
if (CONFIG_MOTION_VAR)
set(AOM_DSP_ENCODER_INTRIN_SSE4_1
${AOM_DSP_ENCODER_INTRIN_SSE4_1}
@ -406,13 +410,13 @@ function (setup_aom_dsp_targets)
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_dsp_common)
target_sources(aom PUBLIC $<TARGET_OBJECTS:aom_dsp_common>)
if (CONFIG_DECODERS)
if (CONFIG_AV1_DECODER)
add_library(aom_dsp_decoder OBJECT ${AOM_DSP_DECODER_SOURCES})
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_dsp_decoder)
target_sources(aom PUBLIC $<TARGET_OBJECTS:aom_dsp_decoder>)
endif ()
if (CONFIG_ENCODERS)
if (CONFIG_AV1_ENCODER)
add_library(aom_dsp_encoder OBJECT ${AOM_DSP_ENCODER_SOURCES})
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_dsp_encoder)
target_sources(aom PUBLIC $<TARGET_OBJECTS:aom_dsp_encoder>)
@ -422,14 +426,14 @@ function (setup_aom_dsp_targets)
add_asm_library("aom_dsp_common_sse2" "AOM_DSP_COMMON_ASM_SSE2" "aom")
add_intrinsics_object_library("-msse2" "sse2" "aom_dsp_common"
"AOM_DSP_COMMON_INTRIN_SSE2")
if (CONFIG_ENCODERS)
if (CONFIG_AV1_ENCODER)
add_asm_library("aom_dsp_encoder_sse2" "AOM_DSP_ENCODER_ASM_SSE2" "aom")
add_intrinsics_object_library("-msse2" "sse2" "aom_dsp_encoder"
"AOM_DSP_ENCODER_INTRIN_SSE2")
endif()
endif ()
if (HAVE_SSE3 AND CONFIG_ENCODERS)
if (HAVE_SSE3 AND CONFIG_AV1_ENCODER)
add_asm_library("aom_dsp_encoder_sse3" "AOM_DSP_ENCODER_INTRIN_SSE3" "aom")
endif ()
@ -438,21 +442,19 @@ function (setup_aom_dsp_targets)
add_intrinsics_object_library("-mssse3" "ssse3" "aom_dsp_common"
"AOM_DSP_COMMON_INTRIN_SSSE3")
if (CONFIG_ENCODERS)
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_intrinsics_object_library("-mssse3" "ssse3" "aom_dsp_encoder"
"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")
if (CONFIG_ENCODERS)
if (CONFIG_AV1_ENCODER)
if (AOM_DSP_ENCODER_INTRIN_SSE4_1)
add_intrinsics_object_library("-msse4.1" "sse4_1" "aom_dsp_encoder"
"AOM_DSP_ENCODER_INTRIN_SSE4_1")
@ -463,14 +465,16 @@ function (setup_aom_dsp_targets)
endif ()
if (HAVE_AVX AND "${AOM_TARGET_CPU}" STREQUAL "x86_64")
add_asm_library("aom_dsp_encoder_avx" "AOM_DSP_ENCODER_AVX_ASM_X86_64"
"aom")
if (CONFIG_AV1_ENCODER)
add_asm_library("aom_dsp_encoder_avx" "AOM_DSP_ENCODER_AVX_ASM_X86_64"
"aom")
endif ()
endif ()
if (HAVE_AVX2)
add_intrinsics_object_library("-mavx2" "avx2" "aom_dsp_common"
"AOM_DSP_COMMON_INTRIN_AVX2")
if (CONFIG_ENCODERS)
if (CONFIG_AV1_ENCODER)
add_intrinsics_object_library("-mavx2" "avx2" "aom_dsp_encoder"
"AOM_DSP_ENCODER_INTRIN_AVX2")
endif ()
@ -497,7 +501,7 @@ function (setup_aom_dsp_targets)
if (HAVE_MSA)
add_intrinsics_object_library("" "msa" "aom_dsp_common"
"AOM_DSP_COMMON_INTRIN_MSA")
if (CONFIG_ENCODERS)
if (CONFIG_AV1_ENCODER)
add_intrinsics_object_library("" "msa" "aom_dsp_encoder"
"AOM_DSP_ENCODER_INTRIN_MSA")
endif ()
@ -507,3 +511,5 @@ function (setup_aom_dsp_targets)
# $AOM_LIB_TARGETS.
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} PARENT_SCOPE)
endfunction ()
endif () # AOM_AOM_DSP_AOM_DSP_CMAKE_

View file

@ -22,19 +22,16 @@ DSP_SRCS-yes += prob.h
DSP_SRCS-yes += prob.c
DSP_SRCS-$(CONFIG_ANS) += ans.h
ifeq ($(CONFIG_ENCODERS),yes)
ifeq ($(CONFIG_AV1_ENCODER),yes)
ifeq ($(CONFIG_ANS),yes)
DSP_SRCS-yes += answriter.h
DSP_SRCS-yes += buf_ans.h
DSP_SRCS-yes += buf_ans.c
else ifeq ($(CONFIG_DAALA_EC),yes)
else
DSP_SRCS-yes += entenc.c
DSP_SRCS-yes += entenc.h
DSP_SRCS-yes += daalaboolwriter.c
DSP_SRCS-yes += daalaboolwriter.h
else
DSP_SRCS-yes += dkboolwriter.h
DSP_SRCS-yes += dkboolwriter.c
endif
DSP_SRCS-yes += bitwriter.h
DSP_SRCS-yes += bitwriter_buffer.c
@ -49,17 +46,14 @@ DSP_SRCS-$(CONFIG_INTERNAL_STATS) += psnrhvs.c
DSP_SRCS-$(CONFIG_INTERNAL_STATS) += fastssim.c
endif
ifeq ($(CONFIG_DECODERS),yes)
ifeq ($(CONFIG_AV1_DECODER),yes)
ifeq ($(CONFIG_ANS),yes)
DSP_SRCS-yes += ansreader.h
else ifeq ($(CONFIG_DAALA_EC),yes)
else
DSP_SRCS-yes += entdec.c
DSP_SRCS-yes += entdec.h
DSP_SRCS-yes += daalaboolreader.c
DSP_SRCS-yes += daalaboolreader.h
else
DSP_SRCS-yes += dkboolreader.h
DSP_SRCS-yes += dkboolreader.c
endif
DSP_SRCS-yes += bitreader.h
DSP_SRCS-yes += bitreader_buffer.c
@ -71,7 +65,7 @@ endif
# intra predictions
DSP_SRCS-yes += intrapred.c
ifeq ($(CONFIG_DAALA_EC),yes)
ifneq ($(CONFIG_ANS),yes)
DSP_SRCS-yes += entcode.c
DSP_SRCS-yes += entcode.h
endif
@ -205,6 +199,7 @@ endif # CONFIG_HIGHBITDEPTH
DSP_SRCS-yes += txfm_common.h
DSP_SRCS-yes += x86/txfm_common_intrin.h
DSP_SRCS-$(HAVE_SSE2) += x86/txfm_common_sse2.h
DSP_SRCS-$(HAVE_SSSE3) += x86/obmc_intrinsic_ssse3.h
DSP_SRCS-$(HAVE_MSA) += mips/txfm_macros_msa.h
# forward transform
@ -239,6 +234,8 @@ DSP_SRCS-$(HAVE_SSE2) += x86/inv_txfm_sse2.h
DSP_SRCS-$(HAVE_SSE2) += x86/inv_txfm_sse2.c
DSP_SRCS-$(HAVE_SSE2) += x86/inv_wht_sse2.asm
DSP_SRCS-$(HAVE_SSSE3) += x86/inv_txfm_ssse3.c
DSP_SRCS-$(HAVE_AVX2) += x86/inv_txfm_common_avx2.h
DSP_SRCS-$(HAVE_AVX2) += x86/inv_txfm_avx2.c
ifeq ($(HAVE_NEON_ASM),yes)
DSP_SRCS-yes += arm/save_reg_neon$(ASM)
@ -278,6 +275,13 @@ DSP_SRCS-$(HAVE_DSPR2) += mips/itrans16_dspr2.c
DSP_SRCS-$(HAVE_DSPR2) += mips/itrans32_dspr2.c
DSP_SRCS-$(HAVE_DSPR2) += mips/itrans32_cols_dspr2.c
endif # CONFIG_HIGHBITDEPTH
ifeq ($(CONFIG_LOOP_RESTORATION),yes)
DSP_SRCS-$(HAVE_SSE2) += x86/aom_convolve_hip_sse2.c
ifeq ($(CONFIG_HIGHBITDEPTH),yes)
DSP_SRCS-$(HAVE_SSSE3) += x86/aom_highbd_convolve_hip_ssse3.c
endif
endif # CONFIG_LOOP_RESTORATION
endif # CONFIG_AV1
# quantization
@ -298,7 +302,6 @@ endif
DSP_SRCS-yes += avg.c
DSP_SRCS-$(HAVE_SSE2) += x86/avg_intrin_sse2.c
DSP_SRCS-$(HAVE_NEON) += arm/avg_neon.c
DSP_SRCS-$(HAVE_MSA) += mips/avg_msa.c
DSP_SRCS-$(HAVE_NEON) += arm/hadamard_neon.c
ifeq ($(ARCH_X86_64),yes)
DSP_SRCS-$(HAVE_SSSE3) += x86/avg_ssse3_x86_64.asm
@ -317,11 +320,10 @@ DSP_SRCS-yes += sum_squares.c
DSP_SRCS-$(HAVE_SSE2) += x86/sum_squares_sse2.c
endif # CONFIG_AV1_ENCODER
ifeq ($(CONFIG_ENCODERS),yes)
ifeq ($(CONFIG_AV1_ENCODER),yes)
DSP_SRCS-yes += sad.c
DSP_SRCS-yes += subtract.c
DSP_SRCS-$(HAVE_MEDIA) += arm/sad_media$(ASM)
DSP_SRCS-$(HAVE_NEON) += arm/sad4d_neon.c
DSP_SRCS-$(HAVE_NEON) += arm/sad_neon.c
DSP_SRCS-$(HAVE_NEON) += arm/subtract_neon.c
@ -364,18 +366,12 @@ DSP_SRCS-$(HAVE_SSE2) += x86/highbd_sad4d_sse2.asm
DSP_SRCS-$(HAVE_SSE2) += x86/highbd_sad_sse2.asm
endif # CONFIG_HIGHBITDEPTH
endif # CONFIG_ENCODERS
endif # CONFIG_AV1_ENCODER
ifneq ($(filter yes,$(CONFIG_ENCODERS)),)
ifneq ($(filter yes,$(CONFIG_AV1_ENCODER)),)
DSP_SRCS-yes += variance.c
DSP_SRCS-yes += variance.h
DSP_SRCS-$(HAVE_MEDIA) += arm/bilinear_filter_media$(ASM)
DSP_SRCS-$(HAVE_MEDIA) += arm/subpel_variance_media.c
DSP_SRCS-$(HAVE_MEDIA) += arm/variance_halfpixvar16x16_h_media$(ASM)
DSP_SRCS-$(HAVE_MEDIA) += arm/variance_halfpixvar16x16_hv_media$(ASM)
DSP_SRCS-$(HAVE_MEDIA) += arm/variance_halfpixvar16x16_v_media$(ASM)
DSP_SRCS-$(HAVE_MEDIA) += arm/variance_media$(ASM)
DSP_SRCS-$(HAVE_NEON) += arm/subpel_variance_neon.c
DSP_SRCS-$(HAVE_NEON) += arm/variance_neon.c
@ -402,7 +398,7 @@ DSP_SRCS-$(HAVE_SSE4_1) += x86/highbd_variance_sse4.c
DSP_SRCS-$(HAVE_SSE2) += x86/highbd_variance_impl_sse2.asm
DSP_SRCS-$(HAVE_SSE2) += x86/highbd_subpel_variance_impl_sse2.asm
endif # CONFIG_HIGHBITDEPTH
endif # CONFIG_ENCODERS
endif # CONFIG_AV1_ENCODER
DSP_SRCS-no += $(DSP_SRCS_REMOVE-yes)

View file

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

View file

@ -49,6 +49,9 @@ if (aom_config("CONFIG_TX64X64") eq "yes") {
@pred_names = qw/dc dc_top dc_left dc_128 v h d207e d63e d45e d117 d135 d153/;
if (aom_config("CONFIG_ALT_INTRA") eq "yes") {
push @pred_names, qw/paeth smooth/;
if (aom_config("CONFIG_SMOOTH_HV") eq "yes") {
push @pred_names, qw/smooth_v smooth_h/;
}
} else {
push @pred_names, 'tm';
}
@ -168,10 +171,14 @@ if (aom_config("CONFIG_LOOP_RESTORATION") eq "yes") {
add_proto qw/void aom_convolve8_add_src/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
add_proto qw/void aom_convolve8_add_src_horiz/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
add_proto qw/void aom_convolve8_add_src_vert/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
add_proto qw/void aom_convolve8_add_src_hip/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
add_proto qw/void aom_convolve8_add_src_horiz_hip/, "const uint8_t *src, ptrdiff_t src_stride, uint16_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
add_proto qw/void aom_convolve8_add_src_vert_hip/, "const uint16_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
specialize qw/aom_convolve8_add_src ssse3/;
specialize qw/aom_convolve8_add_src_horiz ssse3/;
specialize qw/aom_convolve8_add_src_vert ssse3/;
specialize qw/aom_convolve8_add_src_hip sse2/;
} # CONFIG_LOOP_RESTORATION
# TODO(any): These need to be extended to up to 128x128 block sizes
@ -215,8 +222,12 @@ if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
add_proto qw/void aom_highbd_convolve8_add_src/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
add_proto qw/void aom_highbd_convolve8_add_src_horiz/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
add_proto qw/void aom_highbd_convolve8_add_src_vert/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
add_proto qw/void aom_highbd_convolve8_add_src_hip/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
add_proto qw/void aom_highbd_convolve8_add_src_horiz_hip/, "const uint8_t *src, ptrdiff_t src_stride, uint16_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
add_proto qw/void aom_highbd_convolve8_add_src_vert_hip/, "const uint16_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
specialize qw/aom_highbd_convolve8_add_src/, "$sse2_x86_64";
specialize qw/aom_highbd_convolve8_add_src_hip ssse3/;
# The _horiz/_vert functions are currently unused, so we don't bother
# specialising them.
} # CONFIG_LOOP_RESTORATION
@ -434,29 +445,30 @@ if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
specialize qw/aom_idct8x8_1_add sse2/;
add_proto qw/void aom_idct16x16_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/aom_idct16x16_256_add sse2/;
specialize qw/aom_idct16x16_256_add sse2 avx2/;
add_proto qw/void aom_idct16x16_38_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/aom_idct16x16_38_add avx2/;
add_proto qw/void aom_idct16x16_10_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/aom_idct16x16_10_add sse2/;
specialize qw/aom_idct16x16_10_add sse2 avx2/;
add_proto qw/void aom_idct16x16_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/aom_idct16x16_1_add sse2/;
specialize qw/aom_idct16x16_1_add sse2 avx2/;
add_proto qw/void aom_idct32x32_1024_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/aom_idct32x32_1024_add sse2 ssse3/;
specialize qw/aom_idct32x32_1024_add sse2 ssse3 avx2/;
add_proto qw/void aom_idct32x32_135_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/aom_idct32x32_135_add sse2 ssse3/;
specialize qw/aom_idct32x32_135_add sse2 ssse3 avx2/;
# Need to add 135 eob idct32x32 implementations.
$aom_idct32x32_135_add_sse2=aom_idct32x32_1024_add_sse2;
add_proto qw/void aom_idct32x32_34_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/aom_idct32x32_34_add sse2 ssse3/;
specialize qw/aom_idct32x32_34_add sse2 ssse3 avx2/;
add_proto qw/void aom_idct32x32_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/aom_idct32x32_1_add sse2/;
specialize qw/aom_idct32x32_1_add sse2 avx2/;
add_proto qw/void aom_highbd_idct4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
specialize qw/aom_highbd_idct4x4_16_add sse2/;
@ -479,21 +491,22 @@ if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
specialize qw/aom_idct8x8_12_add sse2 ssse3 neon dspr2 msa/;
add_proto qw/void aom_idct16x16_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/aom_idct16x16_1_add sse2 neon dspr2 msa/;
specialize qw/aom_idct16x16_1_add sse2 avx2 neon dspr2 msa/;
add_proto qw/void aom_idct16x16_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/aom_idct16x16_256_add sse2 neon dspr2 msa/;
specialize qw/aom_idct16x16_256_add sse2 avx2 neon dspr2 msa/;
add_proto qw/void aom_idct16x16_38_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/aom_idct16x16_38_add avx2/;
add_proto qw/void aom_idct16x16_10_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/aom_idct16x16_10_add sse2 neon dspr2 msa/;
specialize qw/aom_idct16x16_10_add sse2 avx2 neon dspr2 msa/;
add_proto qw/void aom_idct32x32_1024_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/aom_idct32x32_1024_add sse2 ssse3 neon dspr2 msa/;
specialize qw/aom_idct32x32_1024_add sse2 ssse3 avx2 neon dspr2 msa/;
add_proto qw/void aom_idct32x32_135_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/aom_idct32x32_135_add sse2 ssse3 neon dspr2 msa/;
specialize qw/aom_idct32x32_135_add sse2 ssse3 avx2 neon dspr2 msa/;
# Need to add 135 eob idct32x32 implementations.
$aom_idct32x32_135_add_sse2=aom_idct32x32_1024_add_sse2;
$aom_idct32x32_135_add_neon=aom_idct32x32_1024_add_neon;
@ -501,12 +514,12 @@ if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
$aom_idct32x32_135_add_msa=aom_idct32x32_1024_add_msa;
add_proto qw/void aom_idct32x32_34_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/aom_idct32x32_34_add sse2 ssse3 neon dspr2 msa/;
specialize qw/aom_idct32x32_34_add sse2 ssse3 avx2 neon dspr2 msa/;
# Need to add 34 eob idct32x32 neon implementation.
$aom_idct32x32_34_add_neon=aom_idct32x32_1024_add_neon;
add_proto qw/void aom_idct32x32_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/aom_idct32x32_1_add sse2 neon dspr2 msa/;
specialize qw/aom_idct32x32_1_add sse2 avx2 neon dspr2 msa/;
add_proto qw/void aom_iwht4x4_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/aom_iwht4x4_1_add msa/;
@ -578,7 +591,7 @@ if (aom_config("CONFIG_AV1") eq "yes") {
}
} # CONFIG_AV1
if (aom_config("CONFIG_ENCODERS") eq "yes") {
if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
#
# Block subtraction
#
@ -604,13 +617,8 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
#
# Avg
#
add_proto qw/unsigned int aom_avg_8x8/, "const uint8_t *, int p";
specialize qw/aom_avg_8x8 sse2 neon msa/;
add_proto qw/unsigned int aom_avg_4x4/, "const uint8_t *, int p";
specialize qw/aom_avg_4x4 sse2 neon msa/;
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
add_proto qw/unsigned int aom_highbd_avg_8x8/, "const uint8_t *, int p";
add_proto qw/unsigned int aom_highbd_avg_4x4/, "const uint8_t *, int p";
add_proto qw/void aom_highbd_subtract_block/, "int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride, int bd";
specialize qw/aom_highbd_subtract_block sse2/;
}
@ -652,22 +660,22 @@ foreach (@block_sizes) {
add_proto qw/unsigned int/, "aom_sad${w}x${h}_avg", "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
}
specialize qw/aom_sad128x128 avx2 sse2/;
specialize qw/aom_sad128x64 avx2 sse2/;
specialize qw/aom_sad64x128 avx2 sse2/;
specialize qw/aom_sad64x64 avx2 neon msa sse2/;
specialize qw/aom_sad64x32 avx2 msa sse2/;
specialize qw/aom_sad32x64 avx2 msa sse2/;
specialize qw/aom_sad32x32 avx2 neon msa sse2/;
specialize qw/aom_sad32x16 avx2 msa sse2/;
specialize qw/aom_sad16x32 msa sse2/;
specialize qw/aom_sad16x16 media neon msa sse2/;
specialize qw/aom_sad16x8 neon msa sse2/;
specialize qw/aom_sad8x16 neon msa sse2/;
specialize qw/aom_sad8x8 neon msa sse2/;
specialize qw/aom_sad8x4 msa sse2/;
specialize qw/aom_sad4x8 msa sse2/;
specialize qw/aom_sad4x4 neon msa sse2/;
specialize qw/aom_sad128x128 avx2 sse2/;
specialize qw/aom_sad128x64 avx2 sse2/;
specialize qw/aom_sad64x128 avx2 sse2/;
specialize qw/aom_sad64x64 avx2 neon msa sse2/;
specialize qw/aom_sad64x32 avx2 msa sse2/;
specialize qw/aom_sad32x64 avx2 msa sse2/;
specialize qw/aom_sad32x32 avx2 neon msa sse2/;
specialize qw/aom_sad32x16 avx2 msa sse2/;
specialize qw/aom_sad16x32 msa sse2/;
specialize qw/aom_sad16x16 neon msa sse2/;
specialize qw/aom_sad16x8 neon msa sse2/;
specialize qw/aom_sad8x16 neon msa sse2/;
specialize qw/aom_sad8x8 neon msa sse2/;
specialize qw/aom_sad8x4 msa sse2/;
specialize qw/aom_sad4x8 msa sse2/;
specialize qw/aom_sad4x4 neon msa sse2/;
specialize qw/aom_sad128x128_avg avx2 sse2/;
specialize qw/aom_sad128x64_avg avx2 sse2/;
@ -727,14 +735,14 @@ if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
if (aom_config("CONFIG_EXT_INTER") eq "yes") {
foreach (@block_sizes) {
($w, $h) = @$_;
add_proto qw/unsigned int/, "aom_masked_sad${w}x${h}", "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *mask, int mask_stride";
add_proto qw/unsigned int/, "aom_masked_sad${w}x${h}", "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";
specialize "aom_masked_sad${w}x${h}", qw/ssse3/;
}
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
foreach (@block_sizes) {
($w, $h) = @$_;
add_proto qw/unsigned int/, "aom_highbd_masked_sad${w}x${h}", "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *mask, int mask_stride";
add_proto qw/unsigned int/, "aom_highbd_masked_sad${w}x${h}", "const uint8_t *src8, int src_stride, const uint8_t *ref8, int ref_stride, const uint8_t *second_pred8, const uint8_t *msk, int msk_stride, int invert_mask";
specialize "aom_highbd_masked_sad${w}x${h}", qw/ssse3/;
}
}
@ -876,9 +884,9 @@ if (aom_config("CONFIG_INTERNAL_STATS") eq "yes") {
add_proto qw/void aom_highbd_ssim_parms_8x8/, "const uint16_t *s, int sp, const uint16_t *r, int rp, uint32_t *sum_s, uint32_t *sum_r, uint32_t *sum_sq_s, uint32_t *sum_sq_r, uint32_t *sum_sxr";
}
}
} # CONFIG_ENCODERS
} # CONFIG_AV1_ENCODER
if (aom_config("CONFIG_ENCODERS") eq "yes") {
if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
#
# Specialty Variance
@ -896,10 +904,10 @@ add_proto qw/unsigned int aom_mse16x8/, "const uint8_t *src_ptr, int source_str
add_proto qw/unsigned int aom_mse8x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
add_proto qw/unsigned int aom_mse8x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
specialize qw/aom_mse16x16 sse2 avx2 media neon msa/;
specialize qw/aom_mse16x8 sse2 msa/;
specialize qw/aom_mse8x16 sse2 msa/;
specialize qw/aom_mse8x8 sse2 msa/;
specialize qw/aom_mse16x16 sse2 avx2 neon msa/;
specialize qw/aom_mse16x8 sse2 msa/;
specialize qw/aom_mse8x16 sse2 msa/;
specialize qw/aom_mse8x8 sse2 msa/;
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
foreach $bd (8, 10, 12) {
@ -956,33 +964,33 @@ foreach (@block_sizes) {
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";
}
specialize qw/aom_variance64x64 sse2 avx2 neon msa/;
specialize qw/aom_variance64x32 sse2 avx2 neon msa/;
specialize qw/aom_variance32x64 sse2 neon msa/;
specialize qw/aom_variance32x32 sse2 avx2 neon msa/;
specialize qw/aom_variance32x16 sse2 avx2 msa/;
specialize qw/aom_variance16x32 sse2 msa/;
specialize qw/aom_variance16x16 sse2 avx2 media neon msa/;
specialize qw/aom_variance16x8 sse2 neon msa/;
specialize qw/aom_variance8x16 sse2 neon msa/;
specialize qw/aom_variance8x8 sse2 media neon msa/;
specialize qw/aom_variance8x4 sse2 msa/;
specialize qw/aom_variance4x8 sse2 msa/;
specialize qw/aom_variance4x4 sse2 msa/;
specialize qw/aom_variance64x64 sse2 avx2 neon msa/;
specialize qw/aom_variance64x32 sse2 avx2 neon msa/;
specialize qw/aom_variance32x64 sse2 neon msa/;
specialize qw/aom_variance32x32 sse2 avx2 neon msa/;
specialize qw/aom_variance32x16 sse2 avx2 msa/;
specialize qw/aom_variance16x32 sse2 msa/;
specialize qw/aom_variance16x16 sse2 avx2 neon msa/;
specialize qw/aom_variance16x8 sse2 neon msa/;
specialize qw/aom_variance8x16 sse2 neon msa/;
specialize qw/aom_variance8x8 sse2 neon msa/;
specialize qw/aom_variance8x4 sse2 msa/;
specialize qw/aom_variance4x8 sse2 msa/;
specialize qw/aom_variance4x4 sse2 msa/;
specialize qw/aom_sub_pixel_variance64x64 avx2 neon msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance64x32 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance32x64 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance32x32 avx2 neon msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance32x16 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance16x32 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance16x16 media neon msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance16x8 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance8x16 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance8x8 media neon msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance8x4 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance4x8 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance4x4 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance64x64 avx2 neon msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance64x32 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance32x64 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance32x32 avx2 neon msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance32x16 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_variance8x16 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance8x8 neon msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance8x4 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance4x8 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_variance4x4 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_avg_variance64x64 avx2 msa sse2 ssse3/;
specialize qw/aom_sub_pixel_avg_variance64x32 msa sse2 ssse3/;
@ -1034,19 +1042,15 @@ if (aom_config("CONFIG_EXT_INTER") eq "yes") {
#
foreach (@block_sizes) {
($w, $h) = @$_;
add_proto qw/unsigned int/, "aom_masked_variance${w}x${h}", "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *mask, int mask_stride, unsigned int *sse";
add_proto qw/unsigned int/, "aom_masked_sub_pixel_variance${w}x${h}", "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, const uint8_t *mask, int mask_stride, unsigned int *sse";
specialize "aom_masked_variance${w}x${h}", qw/ssse3/;
add_proto qw/unsigned int/, "aom_masked_sub_pixel_variance${w}x${h}", "const uint8_t *src, int src_stride, int xoffset, int yoffset, const uint8_t *ref, int ref_stride, const uint8_t *second_pred, const uint8_t *msk, int msk_stride, int invert_mask, unsigned int *sse";
specialize "aom_masked_sub_pixel_variance${w}x${h}", qw/ssse3/;
}
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
foreach $bd ("_", "_10_", "_12_") {
foreach $bd ("_8_", "_10_", "_12_") {
foreach (@block_sizes) {
($w, $h) = @$_;
add_proto qw/unsigned int/, "aom_highbd${bd}masked_variance${w}x${h}", "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *mask, int mask_stride, unsigned int *sse";
add_proto qw/unsigned int/, "aom_highbd${bd}masked_sub_pixel_variance${w}x${h}", "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, const uint8_t *m, int m_stride, unsigned int *sse";
specialize "aom_highbd${bd}masked_variance${w}x${h}", qw/ssse3/;
add_proto qw/unsigned int/, "aom_highbd${bd}masked_sub_pixel_variance${w}x${h}", "const uint8_t *src, int src_stride, int xoffset, int yoffset, const uint8_t *ref, int ref_stride, const uint8_t *second_pred, const uint8_t *msk, int msk_stride, int invert_mask, unsigned int *sse";
specialize "aom_highbd${bd}masked_sub_pixel_variance${w}x${h}", qw/ssse3/;
}
}
@ -1119,13 +1123,13 @@ add_proto qw/uint32_t aom_sub_pixel_avg_variance4x4/, "const uint8_t *src_ptr, i
# Specialty Subpixel
#
add_proto qw/uint32_t aom_variance_halfpixvar16x16_h/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/aom_variance_halfpixvar16x16_h sse2 media/;
specialize qw/aom_variance_halfpixvar16x16_h sse2/;
add_proto qw/uint32_t aom_variance_halfpixvar16x16_v/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/aom_variance_halfpixvar16x16_v sse2 media/;
specialize qw/aom_variance_halfpixvar16x16_v sse2/;
add_proto qw/uint32_t aom_variance_halfpixvar16x16_hv/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/aom_variance_halfpixvar16x16_hv sse2 media/;
specialize qw/aom_variance_halfpixvar16x16_hv sse2/;
#
# Comp Avg
@ -1490,6 +1494,15 @@ if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
} # CONFIG_HIGHBITDEPTH
} # CONFIG_ENCODERS
if (aom_config("CONFIG_EXT_INTER") eq "yes") {
add_proto qw/void aom_comp_mask_pred/, "uint8_t *comp_pred, const uint8_t *pred, int width, int height, const uint8_t *ref, int ref_stride, const uint8_t *mask, int mask_stride, int invert_mask";
add_proto qw/void aom_comp_mask_upsampled_pred/, "uint8_t *comp_pred, const uint8_t *pred, int width, int height, const uint8_t *ref, int ref_stride, const uint8_t *mask, int mask_stride, int invert_mask";
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
add_proto qw/void aom_highbd_comp_mask_pred/, "uint16_t *comp_pred, const uint8_t *pred8, int width, int height, const uint8_t *ref8, int ref_stride, const uint8_t *mask, int mask_stride, int invert_mask";
add_proto qw/void aom_highbd_comp_mask_upsampled_pred/, "uint16_t *comp_pred, const uint8_t *pred8, int width, int height, const uint8_t *ref8, int ref_stride, const uint8_t *mask, int mask_stride, int invert_mask";
}
}
} # CONFIG_AV1_ENCODER
1;

View file

@ -25,44 +25,6 @@ static INLINE unsigned int horizontal_add_u16x8(const uint16x8_t v_16x8) {
return vget_lane_u32(c, 0);
}
unsigned int aom_avg_4x4_neon(const uint8_t *s, int p) {
uint16x8_t v_sum;
uint32x2_t v_s0 = vdup_n_u32(0);
uint32x2_t v_s1 = vdup_n_u32(0);
v_s0 = vld1_lane_u32((const uint32_t *)s, v_s0, 0);
v_s0 = vld1_lane_u32((const uint32_t *)(s + p), v_s0, 1);
v_s1 = vld1_lane_u32((const uint32_t *)(s + 2 * p), v_s1, 0);
v_s1 = vld1_lane_u32((const uint32_t *)(s + 3 * p), v_s1, 1);
v_sum = vaddl_u8(vreinterpret_u8_u32(v_s0), vreinterpret_u8_u32(v_s1));
return (horizontal_add_u16x8(v_sum) + 8) >> 4;
}
unsigned int aom_avg_8x8_neon(const uint8_t *s, int p) {
uint8x8_t v_s0 = vld1_u8(s);
const uint8x8_t v_s1 = vld1_u8(s + p);
uint16x8_t v_sum = vaddl_u8(v_s0, v_s1);
v_s0 = vld1_u8(s + 2 * p);
v_sum = vaddw_u8(v_sum, v_s0);
v_s0 = vld1_u8(s + 3 * p);
v_sum = vaddw_u8(v_sum, v_s0);
v_s0 = vld1_u8(s + 4 * p);
v_sum = vaddw_u8(v_sum, v_s0);
v_s0 = vld1_u8(s + 5 * p);
v_sum = vaddw_u8(v_sum, v_s0);
v_s0 = vld1_u8(s + 6 * p);
v_sum = vaddw_u8(v_sum, v_s0);
v_s0 = vld1_u8(s + 7 * p);
v_sum = vaddw_u8(v_sum, v_s0);
return (horizontal_add_u16x8(v_sum) + 32) >> 6;
}
// coeff: 16 bits, dynamic range [-32640, 32640].
// length: value range {16, 64, 256, 1024}.
int aom_satd_neon(const int16_t *coeff, int length) {

View file

@ -1,240 +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.
;
;
EXPORT |aom_filter_block2d_bil_first_pass_media|
EXPORT |aom_filter_block2d_bil_second_pass_media|
AREA |.text|, CODE, READONLY ; name this block of code
;-------------------------------------
; r0 unsigned char *src_ptr,
; r1 unsigned short *dst_ptr,
; r2 unsigned int src_pitch,
; r3 unsigned int height,
; stack unsigned int width,
; stack const short *aom_filter
;-------------------------------------
; The output is transposed stroed in output array to make it easy for second pass filtering.
|aom_filter_block2d_bil_first_pass_media| PROC
stmdb sp!, {r4 - r11, lr}
ldr r11, [sp, #40] ; aom_filter address
ldr r4, [sp, #36] ; width
mov r12, r3 ; outer-loop counter
add r7, r2, r4 ; preload next row
pld [r0, r7]
sub r2, r2, r4 ; src increment for height loop
ldr r5, [r11] ; load up filter coefficients
mov r3, r3, lsl #1 ; height*2
add r3, r3, #2 ; plus 2 to make output buffer 4-bit aligned since height is actually (height+1)
mov r11, r1 ; save dst_ptr for each row
cmp r5, #128 ; if filter coef = 128, then skip the filter
beq bil_null_1st_filter
|bil_height_loop_1st_v6|
ldrb r6, [r0] ; load source data
ldrb r7, [r0, #1]
ldrb r8, [r0, #2]
mov lr, r4, lsr #2 ; 4-in-parellel loop counter
|bil_width_loop_1st_v6|
ldrb r9, [r0, #3]
ldrb r10, [r0, #4]
pkhbt r6, r6, r7, lsl #16 ; src[1] | src[0]
pkhbt r7, r7, r8, lsl #16 ; src[2] | src[1]
smuad r6, r6, r5 ; apply the filter
pkhbt r8, r8, r9, lsl #16 ; src[3] | src[2]
smuad r7, r7, r5
pkhbt r9, r9, r10, lsl #16 ; src[4] | src[3]
smuad r8, r8, r5
smuad r9, r9, r5
add r0, r0, #4
subs lr, lr, #1
add r6, r6, #0x40 ; round_shift_and_clamp
add r7, r7, #0x40
usat r6, #16, r6, asr #7
usat r7, #16, r7, asr #7
strh r6, [r1], r3 ; result is transposed and stored
add r8, r8, #0x40 ; round_shift_and_clamp
strh r7, [r1], r3
add r9, r9, #0x40
usat r8, #16, r8, asr #7
usat r9, #16, r9, asr #7
strh r8, [r1], r3 ; result is transposed and stored
ldrneb r6, [r0] ; load source data
strh r9, [r1], r3
ldrneb r7, [r0, #1]
ldrneb r8, [r0, #2]
bne bil_width_loop_1st_v6
add r0, r0, r2 ; move to next input row
subs r12, r12, #1
add r9, r2, r4, lsl #1 ; adding back block width
pld [r0, r9] ; preload next row
add r11, r11, #2 ; move over to next column
mov r1, r11
bne bil_height_loop_1st_v6
ldmia sp!, {r4 - r11, pc}
|bil_null_1st_filter|
|bil_height_loop_null_1st|
mov lr, r4, lsr #2 ; loop counter
|bil_width_loop_null_1st|
ldrb r6, [r0] ; load data
ldrb r7, [r0, #1]
ldrb r8, [r0, #2]
ldrb r9, [r0, #3]
strh r6, [r1], r3 ; store it to immediate buffer
add r0, r0, #4
strh r7, [r1], r3
subs lr, lr, #1
strh r8, [r1], r3
strh r9, [r1], r3
bne bil_width_loop_null_1st
subs r12, r12, #1
add r0, r0, r2 ; move to next input line
add r11, r11, #2 ; move over to next column
mov r1, r11
bne bil_height_loop_null_1st
ldmia sp!, {r4 - r11, pc}
ENDP ; |aom_filter_block2d_bil_first_pass_media|
;---------------------------------
; r0 unsigned short *src_ptr,
; r1 unsigned char *dst_ptr,
; r2 int dst_pitch,
; r3 unsigned int height,
; stack unsigned int width,
; stack const short *aom_filter
;---------------------------------
|aom_filter_block2d_bil_second_pass_media| PROC
stmdb sp!, {r4 - r11, lr}
ldr r11, [sp, #40] ; aom_filter address
ldr r4, [sp, #36] ; width
ldr r5, [r11] ; load up filter coefficients
mov r12, r4 ; outer-loop counter = width, since we work on transposed data matrix
mov r11, r1
cmp r5, #128 ; if filter coef = 128, then skip the filter
beq bil_null_2nd_filter
|bil_height_loop_2nd|
ldr r6, [r0] ; load the data
ldr r8, [r0, #4]
ldrh r10, [r0, #8]
mov lr, r3, lsr #2 ; loop counter
|bil_width_loop_2nd|
pkhtb r7, r6, r8 ; src[1] | src[2]
pkhtb r9, r8, r10 ; src[3] | src[4]
smuad r6, r6, r5 ; apply filter
smuad r8, r8, r5 ; apply filter
subs lr, lr, #1
smuadx r7, r7, r5 ; apply filter
smuadx r9, r9, r5 ; apply filter
add r0, r0, #8
add r6, r6, #0x40 ; round_shift_and_clamp
add r7, r7, #0x40
usat r6, #8, r6, asr #7
usat r7, #8, r7, asr #7
strb r6, [r1], r2 ; the result is transposed back and stored
add r8, r8, #0x40 ; round_shift_and_clamp
strb r7, [r1], r2
add r9, r9, #0x40
usat r8, #8, r8, asr #7
usat r9, #8, r9, asr #7
strb r8, [r1], r2 ; the result is transposed back and stored
ldrne r6, [r0] ; load data
strb r9, [r1], r2
ldrne r8, [r0, #4]
ldrneh r10, [r0, #8]
bne bil_width_loop_2nd
subs r12, r12, #1
add r0, r0, #4 ; update src for next row
add r11, r11, #1
mov r1, r11
bne bil_height_loop_2nd
ldmia sp!, {r4 - r11, pc}
|bil_null_2nd_filter|
|bil_height_loop_null_2nd|
mov lr, r3, lsr #2
|bil_width_loop_null_2nd|
ldr r6, [r0], #4 ; load data
subs lr, lr, #1
ldr r8, [r0], #4
strb r6, [r1], r2 ; store data
mov r7, r6, lsr #16
strb r7, [r1], r2
mov r9, r8, lsr #16
strb r8, [r1], r2
strb r9, [r1], r2
bne bil_width_loop_null_2nd
subs r12, r12, #1
add r0, r0, #4
add r11, r11, #1
mov r1, r11
bne bil_height_loop_null_2nd
ldmia sp!, {r4 - r11, pc}
ENDP ; |aom_filter_block2d_second_pass_media|
END

View file

@ -1,98 +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.
;
;
EXPORT |aom_sad16x16_media|
ARM
REQUIRE8
PRESERVE8
AREA ||.text||, CODE, READONLY, ALIGN=2
; r0 const unsigned char *src_ptr
; r1 int src_stride
; r2 const unsigned char *ref_ptr
; r3 int ref_stride
|aom_sad16x16_media| PROC
stmfd sp!, {r4-r12, lr}
pld [r0, r1, lsl #0]
pld [r2, r3, lsl #0]
pld [r0, r1, lsl #1]
pld [r2, r3, lsl #1]
mov r4, #0 ; sad = 0;
mov r5, #8 ; loop count
loop
; 1st row
ldr r6, [r0, #0x0] ; load 4 src pixels (1A)
ldr r8, [r2, #0x0] ; load 4 ref pixels (1A)
ldr r7, [r0, #0x4] ; load 4 src pixels (1A)
ldr r9, [r2, #0x4] ; load 4 ref pixels (1A)
ldr r10, [r0, #0x8] ; load 4 src pixels (1B)
ldr r11, [r0, #0xC] ; load 4 src pixels (1B)
usada8 r4, r8, r6, r4 ; calculate sad for 4 pixels
usad8 r8, r7, r9 ; calculate sad for 4 pixels
ldr r12, [r2, #0x8] ; load 4 ref pixels (1B)
ldr lr, [r2, #0xC] ; load 4 ref pixels (1B)
add r0, r0, r1 ; set src pointer to next row
add r2, r2, r3 ; set dst pointer to next row
pld [r0, r1, lsl #1]
pld [r2, r3, lsl #1]
usada8 r4, r10, r12, r4 ; calculate sad for 4 pixels
usada8 r8, r11, lr, r8 ; calculate sad for 4 pixels
ldr r6, [r0, #0x0] ; load 4 src pixels (2A)
ldr r7, [r0, #0x4] ; load 4 src pixels (2A)
add r4, r4, r8 ; add partial sad values
; 2nd row
ldr r8, [r2, #0x0] ; load 4 ref pixels (2A)
ldr r9, [r2, #0x4] ; load 4 ref pixels (2A)
ldr r10, [r0, #0x8] ; load 4 src pixels (2B)
ldr r11, [r0, #0xC] ; load 4 src pixels (2B)
usada8 r4, r6, r8, r4 ; calculate sad for 4 pixels
usad8 r8, r7, r9 ; calculate sad for 4 pixels
ldr r12, [r2, #0x8] ; load 4 ref pixels (2B)
ldr lr, [r2, #0xC] ; load 4 ref pixels (2B)
add r0, r0, r1 ; set src pointer to next row
add r2, r2, r3 ; set dst pointer to next row
usada8 r4, r10, r12, r4 ; calculate sad for 4 pixels
usada8 r8, r11, lr, r8 ; calculate sad for 4 pixels
pld [r0, r1, lsl #1]
pld [r2, r3, lsl #1]
subs r5, r5, #1 ; decrement loop counter
add r4, r4, r8 ; add partial sad values
bne loop
mov r0, r4 ; return sad
ldmfd sp!, {r4-r12, pc}
ENDP
END

View file

@ -1,81 +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 "./aom_config.h"
#include "./aom_dsp_rtcd.h"
#include "aom/aom_integer.h"
#include "aom_ports/mem.h"
#if HAVE_MEDIA
static const int16_t bilinear_filters_media[8][2] = { { 128, 0 }, { 112, 16 },
{ 96, 32 }, { 80, 48 },
{ 64, 64 }, { 48, 80 },
{ 32, 96 }, { 16, 112 } };
extern void aom_filter_block2d_bil_first_pass_media(
const uint8_t *src_ptr, uint16_t *dst_ptr, uint32_t src_pitch,
uint32_t height, uint32_t width, const int16_t *filter);
extern void aom_filter_block2d_bil_second_pass_media(
const uint16_t *src_ptr, uint8_t *dst_ptr, int32_t src_pitch,
uint32_t height, uint32_t width, const int16_t *filter);
unsigned int aom_sub_pixel_variance8x8_media(
const uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset,
const uint8_t *dst_ptr, int dst_pixels_per_line, unsigned int *sse) {
uint16_t first_pass[10 * 8];
uint8_t second_pass[8 * 8];
const int16_t *HFilter, *VFilter;
HFilter = bilinear_filters_media[xoffset];
VFilter = bilinear_filters_media[yoffset];
aom_filter_block2d_bil_first_pass_media(src_ptr, first_pass,
src_pixels_per_line, 9, 8, HFilter);
aom_filter_block2d_bil_second_pass_media(first_pass, second_pass, 8, 8, 8,
VFilter);
return aom_variance8x8_media(second_pass, 8, dst_ptr, dst_pixels_per_line,
sse);
}
unsigned int aom_sub_pixel_variance16x16_media(
const uint8_t *src_ptr, int src_pixels_per_line, int xoffset, int yoffset,
const uint8_t *dst_ptr, int dst_pixels_per_line, unsigned int *sse) {
uint16_t first_pass[36 * 16];
uint8_t second_pass[20 * 16];
const int16_t *HFilter, *VFilter;
unsigned int var;
if (xoffset == 4 && yoffset == 0) {
var = aom_variance_halfpixvar16x16_h_media(
src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse);
} else if (xoffset == 0 && yoffset == 4) {
var = aom_variance_halfpixvar16x16_v_media(
src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse);
} else if (xoffset == 4 && yoffset == 4) {
var = aom_variance_halfpixvar16x16_hv_media(
src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse);
} else {
HFilter = bilinear_filters_media[xoffset];
VFilter = bilinear_filters_media[yoffset];
aom_filter_block2d_bil_first_pass_media(
src_ptr, first_pass, src_pixels_per_line, 17, 16, HFilter);
aom_filter_block2d_bil_second_pass_media(first_pass, second_pass, 16, 16,
16, VFilter);
var = aom_variance16x16_media(second_pass, 16, dst_ptr, dst_pixels_per_line,
sse);
}
return var;
}
#endif // HAVE_MEDIA

View file

@ -1,185 +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.
;
;
EXPORT |aom_variance_halfpixvar16x16_h_media|
ARM
REQUIRE8
PRESERVE8
AREA ||.text||, CODE, READONLY, ALIGN=2
; r0 unsigned char *src_ptr
; r1 int source_stride
; r2 unsigned char *ref_ptr
; r3 int recon_stride
; stack unsigned int *sse
|aom_variance_halfpixvar16x16_h_media| PROC
stmfd sp!, {r4-r12, lr}
pld [r0, r1, lsl #0]
pld [r2, r3, lsl #0]
mov r8, #0 ; initialize sum = 0
ldr r10, c80808080
mov r11, #0 ; initialize sse = 0
mov r12, #16 ; set loop counter to 16 (=block height)
mov lr, #0 ; constant zero
loop
; 1st 4 pixels
ldr r4, [r0, #0] ; load 4 src pixels
ldr r6, [r0, #1] ; load 4 src pixels with 1 byte offset
ldr r5, [r2, #0] ; load 4 ref pixels
; bilinear interpolation
mvn r6, r6
uhsub8 r4, r4, r6
eor r4, r4, r10
usub8 r6, r4, r5 ; calculate difference
pld [r0, r1, lsl #1]
sel r7, r6, lr ; select bytes with positive difference
usub8 r6, r5, r4 ; calculate difference with reversed operands
pld [r2, r3, lsl #1]
sel r6, r6, lr ; select bytes with negative difference
; calculate partial sums
usad8 r4, r7, lr ; calculate sum of positive differences
usad8 r5, r6, lr ; calculate sum of negative differences
orr r6, r6, r7 ; differences of all 4 pixels
; calculate total sum
adds r8, r8, r4 ; add positive differences to sum
subs r8, r8, r5 ; subtract negative differences from sum
; calculate sse
uxtb16 r5, r6 ; byte (two pixels) to halfwords
uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
; 2nd 4 pixels
ldr r4, [r0, #4] ; load 4 src pixels
ldr r6, [r0, #5] ; load 4 src pixels with 1 byte offset
ldr r5, [r2, #4] ; load 4 ref pixels
; bilinear interpolation
mvn r6, r6
uhsub8 r4, r4, r6
eor r4, r4, r10
smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
usub8 r6, r4, r5 ; calculate difference
sel r7, r6, lr ; select bytes with positive difference
usub8 r6, r5, r4 ; calculate difference with reversed operands
sel r6, r6, lr ; select bytes with negative difference
; calculate partial sums
usad8 r4, r7, lr ; calculate sum of positive differences
usad8 r5, r6, lr ; calculate sum of negative differences
orr r6, r6, r7 ; differences of all 4 pixels
; calculate total sum
add r8, r8, r4 ; add positive differences to sum
sub r8, r8, r5 ; subtract negative differences from sum
; calculate sse
uxtb16 r5, r6 ; byte (two pixels) to halfwords
uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
; 3rd 4 pixels
ldr r4, [r0, #8] ; load 4 src pixels
ldr r6, [r0, #9] ; load 4 src pixels with 1 byte offset
ldr r5, [r2, #8] ; load 4 ref pixels
; bilinear interpolation
mvn r6, r6
uhsub8 r4, r4, r6
eor r4, r4, r10
smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
usub8 r6, r4, r5 ; calculate difference
sel r7, r6, lr ; select bytes with positive difference
usub8 r6, r5, r4 ; calculate difference with reversed operands
sel r6, r6, lr ; select bytes with negative difference
; calculate partial sums
usad8 r4, r7, lr ; calculate sum of positive differences
usad8 r5, r6, lr ; calculate sum of negative differences
orr r6, r6, r7 ; differences of all 4 pixels
; calculate total sum
add r8, r8, r4 ; add positive differences to sum
sub r8, r8, r5 ; subtract negative differences from sum
; calculate sse
uxtb16 r5, r6 ; byte (two pixels) to halfwords
uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
; 4th 4 pixels
ldr r4, [r0, #12] ; load 4 src pixels
ldr r6, [r0, #13] ; load 4 src pixels with 1 byte offset
ldr r5, [r2, #12] ; load 4 ref pixels
; bilinear interpolation
mvn r6, r6
uhsub8 r4, r4, r6
eor r4, r4, r10
smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
usub8 r6, r4, r5 ; calculate difference
add r0, r0, r1 ; set src_ptr to next row
sel r7, r6, lr ; select bytes with positive difference
usub8 r6, r5, r4 ; calculate difference with reversed operands
add r2, r2, r3 ; set dst_ptr to next row
sel r6, r6, lr ; select bytes with negative difference
; calculate partial sums
usad8 r4, r7, lr ; calculate sum of positive differences
usad8 r5, r6, lr ; calculate sum of negative differences
orr r6, r6, r7 ; differences of all 4 pixels
; calculate total sum
add r8, r8, r4 ; add positive differences to sum
sub r8, r8, r5 ; subtract negative differences from sum
; calculate sse
uxtb16 r5, r6 ; byte (two pixels) to halfwords
uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
subs r12, r12, #1
bne loop
; return stuff
ldr r6, [sp, #40] ; get address of sse
mul r0, r8, r8 ; sum * sum
str r11, [r6] ; store sse
sub r0, r11, r0, lsr #8 ; return (sse - ((sum * sum) >> 8))
ldmfd sp!, {r4-r12, pc}
ENDP
c80808080
DCD 0x80808080
END

View file

@ -1,225 +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.
;
;
EXPORT |aom_variance_halfpixvar16x16_hv_media|
ARM
REQUIRE8
PRESERVE8
AREA ||.text||, CODE, READONLY, ALIGN=2
; r0 unsigned char *src_ptr
; r1 int source_stride
; r2 unsigned char *ref_ptr
; r3 int recon_stride
; stack unsigned int *sse
|aom_variance_halfpixvar16x16_hv_media| PROC
stmfd sp!, {r4-r12, lr}
pld [r0, r1, lsl #0]
pld [r2, r3, lsl #0]
mov r8, #0 ; initialize sum = 0
ldr r10, c80808080
mov r11, #0 ; initialize sse = 0
mov r12, #16 ; set loop counter to 16 (=block height)
mov lr, #0 ; constant zero
loop
add r9, r0, r1 ; pointer to pixels on the next row
; 1st 4 pixels
ldr r4, [r0, #0] ; load source pixels a, row N
ldr r6, [r0, #1] ; load source pixels b, row N
ldr r5, [r9, #0] ; load source pixels c, row N+1
ldr r7, [r9, #1] ; load source pixels d, row N+1
; x = (a + b + 1) >> 1, interpolate pixels horizontally on row N
mvn r6, r6
uhsub8 r4, r4, r6
eor r4, r4, r10
; y = (c + d + 1) >> 1, interpolate pixels horizontally on row N+1
mvn r7, r7
uhsub8 r5, r5, r7
eor r5, r5, r10
; z = (x + y + 1) >> 1, interpolate half pixel values vertically
mvn r5, r5
uhsub8 r4, r4, r5
ldr r5, [r2, #0] ; load 4 ref pixels
eor r4, r4, r10
usub8 r6, r4, r5 ; calculate difference
pld [r0, r1, lsl #1]
sel r7, r6, lr ; select bytes with positive difference
usub8 r6, r5, r4 ; calculate difference with reversed operands
pld [r2, r3, lsl #1]
sel r6, r6, lr ; select bytes with negative difference
; calculate partial sums
usad8 r4, r7, lr ; calculate sum of positive differences
usad8 r5, r6, lr ; calculate sum of negative differences
orr r6, r6, r7 ; differences of all 4 pixels
; calculate total sum
adds r8, r8, r4 ; add positive differences to sum
subs r8, r8, r5 ; subtract negative differences from sum
; calculate sse
uxtb16 r5, r6 ; byte (two pixels) to halfwords
uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
; 2nd 4 pixels
ldr r4, [r0, #4] ; load source pixels a, row N
ldr r6, [r0, #5] ; load source pixels b, row N
ldr r5, [r9, #4] ; load source pixels c, row N+1
smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
ldr r7, [r9, #5] ; load source pixels d, row N+1
; x = (a + b + 1) >> 1, interpolate pixels horizontally on row N
mvn r6, r6
uhsub8 r4, r4, r6
eor r4, r4, r10
; y = (c + d + 1) >> 1, interpolate pixels horizontally on row N+1
mvn r7, r7
uhsub8 r5, r5, r7
eor r5, r5, r10
; z = (x + y + 1) >> 1, interpolate half pixel values vertically
mvn r5, r5
uhsub8 r4, r4, r5
ldr r5, [r2, #4] ; load 4 ref pixels
eor r4, r4, r10
usub8 r6, r4, r5 ; calculate difference
sel r7, r6, lr ; select bytes with positive difference
usub8 r6, r5, r4 ; calculate difference with reversed operands
sel r6, r6, lr ; select bytes with negative difference
; calculate partial sums
usad8 r4, r7, lr ; calculate sum of positive differences
usad8 r5, r6, lr ; calculate sum of negative differences
orr r6, r6, r7 ; differences of all 4 pixels
; calculate total sum
add r8, r8, r4 ; add positive differences to sum
sub r8, r8, r5 ; subtract negative differences from sum
; calculate sse
uxtb16 r5, r6 ; byte (two pixels) to halfwords
uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
; 3rd 4 pixels
ldr r4, [r0, #8] ; load source pixels a, row N
ldr r6, [r0, #9] ; load source pixels b, row N
ldr r5, [r9, #8] ; load source pixels c, row N+1
smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
ldr r7, [r9, #9] ; load source pixels d, row N+1
; x = (a + b + 1) >> 1, interpolate pixels horizontally on row N
mvn r6, r6
uhsub8 r4, r4, r6
eor r4, r4, r10
; y = (c + d + 1) >> 1, interpolate pixels horizontally on row N+1
mvn r7, r7
uhsub8 r5, r5, r7
eor r5, r5, r10
; z = (x + y + 1) >> 1, interpolate half pixel values vertically
mvn r5, r5
uhsub8 r4, r4, r5
ldr r5, [r2, #8] ; load 4 ref pixels
eor r4, r4, r10
usub8 r6, r4, r5 ; calculate difference
sel r7, r6, lr ; select bytes with positive difference
usub8 r6, r5, r4 ; calculate difference with reversed operands
sel r6, r6, lr ; select bytes with negative difference
; calculate partial sums
usad8 r4, r7, lr ; calculate sum of positive differences
usad8 r5, r6, lr ; calculate sum of negative differences
orr r6, r6, r7 ; differences of all 4 pixels
; calculate total sum
add r8, r8, r4 ; add positive differences to sum
sub r8, r8, r5 ; subtract negative differences from sum
; calculate sse
uxtb16 r5, r6 ; byte (two pixels) to halfwords
uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
; 4th 4 pixels
ldr r4, [r0, #12] ; load source pixels a, row N
ldr r6, [r0, #13] ; load source pixels b, row N
ldr r5, [r9, #12] ; load source pixels c, row N+1
smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
ldr r7, [r9, #13] ; load source pixels d, row N+1
; x = (a + b + 1) >> 1, interpolate pixels horizontally on row N
mvn r6, r6
uhsub8 r4, r4, r6
eor r4, r4, r10
; y = (c + d + 1) >> 1, interpolate pixels horizontally on row N+1
mvn r7, r7
uhsub8 r5, r5, r7
eor r5, r5, r10
; z = (x + y + 1) >> 1, interpolate half pixel values vertically
mvn r5, r5
uhsub8 r4, r4, r5
ldr r5, [r2, #12] ; load 4 ref pixels
eor r4, r4, r10
usub8 r6, r4, r5 ; calculate difference
add r0, r0, r1 ; set src_ptr to next row
sel r7, r6, lr ; select bytes with positive difference
usub8 r6, r5, r4 ; calculate difference with reversed operands
add r2, r2, r3 ; set dst_ptr to next row
sel r6, r6, lr ; select bytes with negative difference
; calculate partial sums
usad8 r4, r7, lr ; calculate sum of positive differences
usad8 r5, r6, lr ; calculate sum of negative differences
orr r6, r6, r7 ; differences of all 4 pixels
; calculate total sum
add r8, r8, r4 ; add positive differences to sum
sub r8, r8, r5 ; subtract negative differences from sum
; calculate sse
uxtb16 r5, r6 ; byte (two pixels) to halfwords
uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
subs r12, r12, #1
smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
bne loop
; return stuff
ldr r6, [sp, #40] ; get address of sse
mul r0, r8, r8 ; sum * sum
str r11, [r6] ; store sse
sub r0, r11, r0, lsr #8 ; return (sse - ((sum * sum) >> 8))
ldmfd sp!, {r4-r12, pc}
ENDP
c80808080
DCD 0x80808080
END

View file

@ -1,187 +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.
;
;
EXPORT |aom_variance_halfpixvar16x16_v_media|
ARM
REQUIRE8
PRESERVE8
AREA ||.text||, CODE, READONLY, ALIGN=2
; r0 unsigned char *src_ptr
; r1 int source_stride
; r2 unsigned char *ref_ptr
; r3 int recon_stride
; stack unsigned int *sse
|aom_variance_halfpixvar16x16_v_media| PROC
stmfd sp!, {r4-r12, lr}
pld [r0, r1, lsl #0]
pld [r2, r3, lsl #0]
mov r8, #0 ; initialize sum = 0
ldr r10, c80808080
mov r11, #0 ; initialize sse = 0
mov r12, #16 ; set loop counter to 16 (=block height)
mov lr, #0 ; constant zero
loop
add r9, r0, r1 ; set src pointer to next row
; 1st 4 pixels
ldr r4, [r0, #0] ; load 4 src pixels
ldr r6, [r9, #0] ; load 4 src pixels from next row
ldr r5, [r2, #0] ; load 4 ref pixels
; bilinear interpolation
mvn r6, r6
uhsub8 r4, r4, r6
eor r4, r4, r10
usub8 r6, r4, r5 ; calculate difference
pld [r0, r1, lsl #1]
sel r7, r6, lr ; select bytes with positive difference
usub8 r6, r5, r4 ; calculate difference with reversed operands
pld [r2, r3, lsl #1]
sel r6, r6, lr ; select bytes with negative difference
; calculate partial sums
usad8 r4, r7, lr ; calculate sum of positive differences
usad8 r5, r6, lr ; calculate sum of negative differences
orr r6, r6, r7 ; differences of all 4 pixels
; calculate total sum
adds r8, r8, r4 ; add positive differences to sum
subs r8, r8, r5 ; subtract negative differences from sum
; calculate sse
uxtb16 r5, r6 ; byte (two pixels) to halfwords
uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
; 2nd 4 pixels
ldr r4, [r0, #4] ; load 4 src pixels
ldr r6, [r9, #4] ; load 4 src pixels from next row
ldr r5, [r2, #4] ; load 4 ref pixels
; bilinear interpolation
mvn r6, r6
uhsub8 r4, r4, r6
eor r4, r4, r10
smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
usub8 r6, r4, r5 ; calculate difference
sel r7, r6, lr ; select bytes with positive difference
usub8 r6, r5, r4 ; calculate difference with reversed operands
sel r6, r6, lr ; select bytes with negative difference
; calculate partial sums
usad8 r4, r7, lr ; calculate sum of positive differences
usad8 r5, r6, lr ; calculate sum of negative differences
orr r6, r6, r7 ; differences of all 4 pixels
; calculate total sum
add r8, r8, r4 ; add positive differences to sum
sub r8, r8, r5 ; subtract negative differences from sum
; calculate sse
uxtb16 r5, r6 ; byte (two pixels) to halfwords
uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
; 3rd 4 pixels
ldr r4, [r0, #8] ; load 4 src pixels
ldr r6, [r9, #8] ; load 4 src pixels from next row
ldr r5, [r2, #8] ; load 4 ref pixels
; bilinear interpolation
mvn r6, r6
uhsub8 r4, r4, r6
eor r4, r4, r10
smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
usub8 r6, r4, r5 ; calculate difference
sel r7, r6, lr ; select bytes with positive difference
usub8 r6, r5, r4 ; calculate difference with reversed operands
sel r6, r6, lr ; select bytes with negative difference
; calculate partial sums
usad8 r4, r7, lr ; calculate sum of positive differences
usad8 r5, r6, lr ; calculate sum of negative differences
orr r6, r6, r7 ; differences of all 4 pixels
; calculate total sum
add r8, r8, r4 ; add positive differences to sum
sub r8, r8, r5 ; subtract negative differences from sum
; calculate sse
uxtb16 r5, r6 ; byte (two pixels) to halfwords
uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
; 4th 4 pixels
ldr r4, [r0, #12] ; load 4 src pixels
ldr r6, [r9, #12] ; load 4 src pixels from next row
ldr r5, [r2, #12] ; load 4 ref pixels
; bilinear interpolation
mvn r6, r6
uhsub8 r4, r4, r6
eor r4, r4, r10
smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
usub8 r6, r4, r5 ; calculate difference
add r0, r0, r1 ; set src_ptr to next row
sel r7, r6, lr ; select bytes with positive difference
usub8 r6, r5, r4 ; calculate difference with reversed operands
add r2, r2, r3 ; set dst_ptr to next row
sel r6, r6, lr ; select bytes with negative difference
; calculate partial sums
usad8 r4, r7, lr ; calculate sum of positive differences
usad8 r5, r6, lr ; calculate sum of negative differences
orr r6, r6, r7 ; differences of all 4 pixels
; calculate total sum
add r8, r8, r4 ; add positive differences to sum
sub r8, r8, r5 ; subtract negative differences from sum
; calculate sse
uxtb16 r5, r6 ; byte (two pixels) to halfwords
uxtb16 r7, r6, ror #8 ; another two pixels to halfwords
smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
smlad r11, r7, r7, r11 ; dual signed multiply, add and accumulate (2)
subs r12, r12, #1
bne loop
; return stuff
ldr r6, [sp, #40] ; get address of sse
mul r0, r8, r8 ; sum * sum
str r11, [r6] ; store sse
sub r0, r11, r0, lsr #8 ; return (sse - ((sum * sum) >> 8))
ldmfd sp!, {r4-r12, pc}
ENDP
c80808080
DCD 0x80808080
END

View file

@ -1,361 +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.
;
;
EXPORT |aom_variance16x16_media|
EXPORT |aom_variance8x8_media|
EXPORT |aom_mse16x16_media|
ARM
REQUIRE8
PRESERVE8
AREA ||.text||, CODE, READONLY, ALIGN=2
; r0 unsigned char *src_ptr
; r1 int source_stride
; r2 unsigned char *ref_ptr
; r3 int recon_stride
; stack unsigned int *sse
|aom_variance16x16_media| PROC
stmfd sp!, {r4-r12, lr}
pld [r0, r1, lsl #0]
pld [r2, r3, lsl #0]
mov r8, #0 ; initialize sum = 0
mov r11, #0 ; initialize sse = 0
mov r12, #16 ; set loop counter to 16 (=block height)
loop16x16
; 1st 4 pixels
ldr r4, [r0, #0] ; load 4 src pixels
ldr r5, [r2, #0] ; load 4 ref pixels
mov lr, #0 ; constant zero
usub8 r6, r4, r5 ; calculate difference
pld [r0, r1, lsl #1]
sel r7, r6, lr ; select bytes with positive difference
usub8 r9, r5, r4 ; calculate difference with reversed operands
pld [r2, r3, lsl #1]
sel r6, r9, lr ; select bytes with negative difference
; calculate partial sums
usad8 r4, r7, lr ; calculate sum of positive differences
usad8 r5, r6, lr ; calculate sum of negative differences
orr r6, r6, r7 ; differences of all 4 pixels
; calculate total sum
adds r8, r8, r4 ; add positive differences to sum
subs r8, r8, r5 ; subtract negative differences from sum
; calculate sse
uxtb16 r5, r6 ; byte (two pixels) to halfwords
uxtb16 r10, r6, ror #8 ; another two pixels to halfwords
smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
; 2nd 4 pixels
ldr r4, [r0, #4] ; load 4 src pixels
ldr r5, [r2, #4] ; load 4 ref pixels
smlad r11, r10, r10, r11 ; dual signed multiply, add and accumulate (2)
usub8 r6, r4, r5 ; calculate difference
sel r7, r6, lr ; select bytes with positive difference
usub8 r9, r5, r4 ; calculate difference with reversed operands
sel r6, r9, lr ; select bytes with negative difference
; calculate partial sums
usad8 r4, r7, lr ; calculate sum of positive differences
usad8 r5, r6, lr ; calculate sum of negative differences
orr r6, r6, r7 ; differences of all 4 pixels
; calculate total sum
add r8, r8, r4 ; add positive differences to sum
sub r8, r8, r5 ; subtract negative differences from sum
; calculate sse
uxtb16 r5, r6 ; byte (two pixels) to halfwords
uxtb16 r10, r6, ror #8 ; another two pixels to halfwords
smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
; 3rd 4 pixels
ldr r4, [r0, #8] ; load 4 src pixels
ldr r5, [r2, #8] ; load 4 ref pixels
smlad r11, r10, r10, r11 ; dual signed multiply, add and accumulate (2)
usub8 r6, r4, r5 ; calculate difference
sel r7, r6, lr ; select bytes with positive difference
usub8 r9, r5, r4 ; calculate difference with reversed operands
sel r6, r9, lr ; select bytes with negative difference
; calculate partial sums
usad8 r4, r7, lr ; calculate sum of positive differences
usad8 r5, r6, lr ; calculate sum of negative differences
orr r6, r6, r7 ; differences of all 4 pixels
; calculate total sum
add r8, r8, r4 ; add positive differences to sum
sub r8, r8, r5 ; subtract negative differences from sum
; calculate sse
uxtb16 r5, r6 ; byte (two pixels) to halfwords
uxtb16 r10, r6, ror #8 ; another two pixels to halfwords
smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
; 4th 4 pixels
ldr r4, [r0, #12] ; load 4 src pixels
ldr r5, [r2, #12] ; load 4 ref pixels
smlad r11, r10, r10, r11 ; dual signed multiply, add and accumulate (2)
usub8 r6, r4, r5 ; calculate difference
add r0, r0, r1 ; set src_ptr to next row
sel r7, r6, lr ; select bytes with positive difference
usub8 r9, r5, r4 ; calculate difference with reversed operands
add r2, r2, r3 ; set dst_ptr to next row
sel r6, r9, lr ; select bytes with negative difference
; calculate partial sums
usad8 r4, r7, lr ; calculate sum of positive differences
usad8 r5, r6, lr ; calculate sum of negative differences
orr r6, r6, r7 ; differences of all 4 pixels
; calculate total sum
add r8, r8, r4 ; add positive differences to sum
sub r8, r8, r5 ; subtract negative differences from sum
; calculate sse
uxtb16 r5, r6 ; byte (two pixels) to halfwords
uxtb16 r10, r6, ror #8 ; another two pixels to halfwords
smlad r11, r5, r5, r11 ; dual signed multiply, add and accumulate (1)
smlad r11, r10, r10, r11 ; dual signed multiply, add and accumulate (2)
subs r12, r12, #1
bne loop16x16
; return stuff
ldr r6, [sp, #40] ; get address of sse
mul r0, r8, r8 ; sum * sum
str r11, [r6] ; store sse
sub r0, r11, r0, lsr #8 ; return (sse - ((sum * sum) >> 8))
ldmfd sp!, {r4-r12, pc}
ENDP
; r0 unsigned char *src_ptr
; r1 int source_stride
; r2 unsigned char *ref_ptr
; r3 int recon_stride
; stack unsigned int *sse
|aom_variance8x8_media| PROC
push {r4-r10, lr}
pld [r0, r1, lsl #0]
pld [r2, r3, lsl #0]
mov r12, #8 ; set loop counter to 8 (=block height)
mov r4, #0 ; initialize sum = 0
mov r5, #0 ; initialize sse = 0
loop8x8
; 1st 4 pixels
ldr r6, [r0, #0x0] ; load 4 src pixels
ldr r7, [r2, #0x0] ; load 4 ref pixels
mov lr, #0 ; constant zero
usub8 r8, r6, r7 ; calculate difference
pld [r0, r1, lsl #1]
sel r10, r8, lr ; select bytes with positive difference
usub8 r9, r7, r6 ; calculate difference with reversed operands
pld [r2, r3, lsl #1]
sel r8, r9, lr ; select bytes with negative difference
; calculate partial sums
usad8 r6, r10, lr ; calculate sum of positive differences
usad8 r7, r8, lr ; calculate sum of negative differences
orr r8, r8, r10 ; differences of all 4 pixels
; calculate total sum
add r4, r4, r6 ; add positive differences to sum
sub r4, r4, r7 ; subtract negative differences from sum
; calculate sse
uxtb16 r7, r8 ; byte (two pixels) to halfwords
uxtb16 r10, r8, ror #8 ; another two pixels to halfwords
smlad r5, r7, r7, r5 ; dual signed multiply, add and accumulate (1)
; 2nd 4 pixels
ldr r6, [r0, #0x4] ; load 4 src pixels
ldr r7, [r2, #0x4] ; load 4 ref pixels
smlad r5, r10, r10, r5 ; dual signed multiply, add and accumulate (2)
usub8 r8, r6, r7 ; calculate difference
add r0, r0, r1 ; set src_ptr to next row
sel r10, r8, lr ; select bytes with positive difference
usub8 r9, r7, r6 ; calculate difference with reversed operands
add r2, r2, r3 ; set dst_ptr to next row
sel r8, r9, lr ; select bytes with negative difference
; calculate partial sums
usad8 r6, r10, lr ; calculate sum of positive differences
usad8 r7, r8, lr ; calculate sum of negative differences
orr r8, r8, r10 ; differences of all 4 pixels
; calculate total sum
add r4, r4, r6 ; add positive differences to sum
sub r4, r4, r7 ; subtract negative differences from sum
; calculate sse
uxtb16 r7, r8 ; byte (two pixels) to halfwords
uxtb16 r10, r8, ror #8 ; another two pixels to halfwords
smlad r5, r7, r7, r5 ; dual signed multiply, add and accumulate (1)
subs r12, r12, #1 ; next row
smlad r5, r10, r10, r5 ; dual signed multiply, add and accumulate (2)
bne loop8x8
; return stuff
ldr r8, [sp, #32] ; get address of sse
mul r1, r4, r4 ; sum * sum
str r5, [r8] ; store sse
sub r0, r5, r1, ASR #6 ; return (sse - ((sum * sum) >> 6))
pop {r4-r10, pc}
ENDP
; r0 unsigned char *src_ptr
; r1 int source_stride
; r2 unsigned char *ref_ptr
; r3 int recon_stride
; stack unsigned int *sse
;
;note: Based on aom_variance16x16_media. In this function, sum is never used.
; So, we can remove this part of calculation.
|aom_mse16x16_media| PROC
push {r4-r9, lr}
pld [r0, r1, lsl #0]
pld [r2, r3, lsl #0]
mov r12, #16 ; set loop counter to 16 (=block height)
mov r4, #0 ; initialize sse = 0
loopmse
; 1st 4 pixels
ldr r5, [r0, #0x0] ; load 4 src pixels
ldr r6, [r2, #0x0] ; load 4 ref pixels
mov lr, #0 ; constant zero
usub8 r8, r5, r6 ; calculate difference
pld [r0, r1, lsl #1]
sel r7, r8, lr ; select bytes with positive difference
usub8 r9, r6, r5 ; calculate difference with reversed operands
pld [r2, r3, lsl #1]
sel r8, r9, lr ; select bytes with negative difference
; calculate partial sums
usad8 r5, r7, lr ; calculate sum of positive differences
usad8 r6, r8, lr ; calculate sum of negative differences
orr r8, r8, r7 ; differences of all 4 pixels
ldr r5, [r0, #0x4] ; load 4 src pixels
; calculate sse
uxtb16 r6, r8 ; byte (two pixels) to halfwords
uxtb16 r7, r8, ror #8 ; another two pixels to halfwords
smlad r4, r6, r6, r4 ; dual signed multiply, add and accumulate (1)
; 2nd 4 pixels
ldr r6, [r2, #0x4] ; load 4 ref pixels
smlad r4, r7, r7, r4 ; dual signed multiply, add and accumulate (2)
usub8 r8, r5, r6 ; calculate difference
sel r7, r8, lr ; select bytes with positive difference
usub8 r9, r6, r5 ; calculate difference with reversed operands
sel r8, r9, lr ; select bytes with negative difference
; calculate partial sums
usad8 r5, r7, lr ; calculate sum of positive differences
usad8 r6, r8, lr ; calculate sum of negative differences
orr r8, r8, r7 ; differences of all 4 pixels
ldr r5, [r0, #0x8] ; load 4 src pixels
; calculate sse
uxtb16 r6, r8 ; byte (two pixels) to halfwords
uxtb16 r7, r8, ror #8 ; another two pixels to halfwords
smlad r4, r6, r6, r4 ; dual signed multiply, add and accumulate (1)
; 3rd 4 pixels
ldr r6, [r2, #0x8] ; load 4 ref pixels
smlad r4, r7, r7, r4 ; dual signed multiply, add and accumulate (2)
usub8 r8, r5, r6 ; calculate difference
sel r7, r8, lr ; select bytes with positive difference
usub8 r9, r6, r5 ; calculate difference with reversed operands
sel r8, r9, lr ; select bytes with negative difference
; calculate partial sums
usad8 r5, r7, lr ; calculate sum of positive differences
usad8 r6, r8, lr ; calculate sum of negative differences
orr r8, r8, r7 ; differences of all 4 pixels
ldr r5, [r0, #0xc] ; load 4 src pixels
; calculate sse
uxtb16 r6, r8 ; byte (two pixels) to halfwords
uxtb16 r7, r8, ror #8 ; another two pixels to halfwords
smlad r4, r6, r6, r4 ; dual signed multiply, add and accumulate (1)
; 4th 4 pixels
ldr r6, [r2, #0xc] ; load 4 ref pixels
smlad r4, r7, r7, r4 ; dual signed multiply, add and accumulate (2)
usub8 r8, r5, r6 ; calculate difference
add r0, r0, r1 ; set src_ptr to next row
sel r7, r8, lr ; select bytes with positive difference
usub8 r9, r6, r5 ; calculate difference with reversed operands
add r2, r2, r3 ; set dst_ptr to next row
sel r8, r9, lr ; select bytes with negative difference
; calculate partial sums
usad8 r5, r7, lr ; calculate sum of positive differences
usad8 r6, r8, lr ; calculate sum of negative differences
orr r8, r8, r7 ; differences of all 4 pixels
subs r12, r12, #1 ; next row
; calculate sse
uxtb16 r6, r8 ; byte (two pixels) to halfwords
uxtb16 r7, r8, ror #8 ; another two pixels to halfwords
smlad r4, r6, r6, r4 ; dual signed multiply, add and accumulate (1)
smlad r4, r7, r7, r4 ; dual signed multiply, add and accumulate (2)
bne loopmse
; return stuff
ldr r1, [sp, #28] ; get address of sse
mov r0, r4 ; return sse
str r4, [r1] ; store sse
pop {r4-r9, pc}
ENDP
END

View file

@ -13,26 +13,6 @@
#include "./aom_dsp_rtcd.h"
#include "aom_ports/mem.h"
unsigned int aom_avg_8x8_c(const uint8_t *src, int stride) {
int i, j;
int sum = 0;
for (i = 0; i < 8; ++i, src += stride)
for (j = 0; j < 8; sum += src[j], ++j) {
}
return ROUND_POWER_OF_TWO(sum, 6);
}
unsigned int aom_avg_4x4_c(const uint8_t *src, int stride) {
int i, j;
int sum = 0;
for (i = 0; i < 4; ++i, src += stride)
for (j = 0; j < 4; sum += src[j], ++j) {
}
return ROUND_POWER_OF_TWO(sum, 4);
}
// src_diff: first pass, 9 bit, dynamic range [-255, 255]
// second pass, 12 bit, dynamic range [-2040, 2040]
static void hadamard_col8(const int16_t *src_diff, int src_stride,
@ -192,28 +172,6 @@ void aom_minmax_8x8_c(const uint8_t *src, int src_stride, const uint8_t *ref,
}
#if CONFIG_HIGHBITDEPTH
unsigned int aom_highbd_avg_8x8_c(const uint8_t *src, int stride) {
int i, j;
int sum = 0;
const uint16_t *s = CONVERT_TO_SHORTPTR(src);
for (i = 0; i < 8; ++i, s += stride)
for (j = 0; j < 8; sum += s[j], ++j) {
}
return ROUND_POWER_OF_TWO(sum, 6);
}
unsigned int aom_highbd_avg_4x4_c(const uint8_t *src, int stride) {
int i, j;
int sum = 0;
const uint16_t *s = CONVERT_TO_SHORTPTR(src);
for (i = 0; i < 4; ++i, s += stride)
for (j = 0; j < 4; sum += s[j], ++j) {
}
return ROUND_POWER_OF_TWO(sum, 4);
}
void aom_highbd_minmax_8x8_c(const uint8_t *s8, int p, const uint8_t *d8,
int dp, int *min, int *max) {
int i, j;

View file

@ -9,7 +9,7 @@
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#include "aom_dsp/bitreader.h"
#include "aom_dsp/binary_codes_reader.h"
#include "av1/common/common.h"
@ -33,26 +33,28 @@ static uint16_t inv_recenter_finite_nonneg(uint16_t n, uint16_t r, uint16_t v) {
}
}
int16_t aom_read_primitive_symmetric(aom_reader *r, unsigned int mag_bits) {
if (aom_read_bit(r, NULL)) {
int s = aom_read_bit(r, NULL);
int16_t x = aom_read_literal(r, mag_bits, NULL) + 1;
int16_t aom_read_primitive_symmetric_(aom_reader *r,
unsigned int mag_bits ACCT_STR_PARAM) {
if (aom_read_bit(r, ACCT_STR_NAME)) {
int s = aom_read_bit(r, ACCT_STR_NAME);
int16_t x = aom_read_literal(r, mag_bits, ACCT_STR_NAME) + 1;
return (s > 0 ? -x : x);
} else {
return 0;
}
}
uint16_t aom_read_primitive_quniform(aom_reader *r, uint16_t n) {
uint16_t aom_read_primitive_quniform_(aom_reader *r,
uint16_t n ACCT_STR_PARAM) {
if (n <= 1) return 0;
const int l = get_msb(n - 1) + 1;
const int m = (1 << l) - n;
const int v = aom_read_literal(r, l - 1, NULL);
return v < m ? v : (v << 1) - m + aom_read_bit(r, NULL);
const int v = aom_read_literal(r, l - 1, ACCT_STR_NAME);
return v < m ? v : (v << 1) - m + aom_read_bit(r, ACCT_STR_NAME);
}
uint16_t aom_read_primitive_refbilevel(aom_reader *r, uint16_t n, uint16_t p,
uint16_t ref) {
uint16_t aom_read_primitive_refbilevel_(aom_reader *r, uint16_t n, uint16_t p,
uint16_t ref ACCT_STR_PARAM) {
if (n <= 1) return 0;
assert(p > 0 && p <= n);
assert(ref < n);
@ -64,10 +66,10 @@ uint16_t aom_read_primitive_refbilevel(aom_reader *r, uint16_t n, uint16_t p,
lolimit = n - p;
}
int v;
if (aom_read_bit(r, NULL)) {
v = aom_read_primitive_quniform(r, p) + lolimit;
if (aom_read_bit(r, ACCT_STR_NAME)) {
v = aom_read_primitive_quniform(r, p, ACCT_STR_NAME) + lolimit;
} else {
v = aom_read_primitive_quniform(r, n - p);
v = aom_read_primitive_quniform(r, n - p, ACCT_STR_NAME);
if (v >= lolimit) v += p;
}
return v;
@ -75,7 +77,8 @@ uint16_t aom_read_primitive_refbilevel(aom_reader *r, uint16_t n, uint16_t p,
// Decode finite subexponential code that for a symbol v in [0, n-1] with
// parameter k
uint16_t aom_read_primitive_subexpfin(aom_reader *r, uint16_t n, uint16_t k) {
uint16_t aom_read_primitive_subexpfin_(aom_reader *r, uint16_t n,
uint16_t k ACCT_STR_PARAM) {
int i = 0;
int mk = 0;
uint16_t v;
@ -83,14 +86,14 @@ uint16_t aom_read_primitive_subexpfin(aom_reader *r, uint16_t n, uint16_t k) {
int b = (i ? k + i - 1 : k);
int a = (1 << b);
if (n <= mk + 3 * a) {
v = aom_read_primitive_quniform(r, n - mk) + mk;
v = aom_read_primitive_quniform(r, n - mk, ACCT_STR_NAME) + mk;
break;
} else {
if (aom_read_bit(r, NULL)) {
if (aom_read_bit(r, ACCT_STR_NAME)) {
i = i + 1;
mk += a;
} else {
v = aom_read_literal(r, b, NULL) + mk;
v = aom_read_literal(r, b, ACCT_STR_NAME) + mk;
break;
}
}
@ -101,17 +104,19 @@ uint16_t aom_read_primitive_subexpfin(aom_reader *r, uint16_t n, uint16_t k) {
// Decode finite subexponential code that for a symbol v in [0, n-1] with
// parameter k
// based on a reference ref also in [0, n-1].
uint16_t aom_read_primitive_refsubexpfin(aom_reader *r, uint16_t n, uint16_t k,
uint16_t ref) {
return inv_recenter_finite_nonneg(n, ref,
aom_read_primitive_subexpfin(r, n, k));
uint16_t aom_read_primitive_refsubexpfin_(aom_reader *r, uint16_t n, uint16_t k,
uint16_t ref ACCT_STR_PARAM) {
return inv_recenter_finite_nonneg(
n, ref, aom_read_primitive_subexpfin(r, n, k, ACCT_STR_NAME));
}
// Decode finite subexponential code that for a symbol v in [-(n-1), n-1] with
// parameter k based on a reference ref also in [-(n-1), n-1].
int16_t aom_read_signed_primitive_refsubexpfin(aom_reader *r, uint16_t n,
uint16_t k, int16_t ref) {
int16_t aom_read_signed_primitive_refsubexpfin_(aom_reader *r, uint16_t n,
uint16_t k,
int16_t ref ACCT_STR_PARAM) {
ref += n - 1;
const uint16_t scaled_n = (n << 1) - 1;
return aom_read_primitive_refsubexpfin(r, scaled_n, k, ref) - n + 1;
return aom_read_primitive_refsubexpfin(r, scaled_n, k, ref, ACCT_STR_NAME) -
n + 1;
}

View file

@ -21,16 +21,32 @@ extern "C" {
#include "aom/aom_integer.h"
#include "aom_dsp/bitreader.h"
int16_t aom_read_primitive_symmetric(aom_reader *r, unsigned int mag_bits);
#define aom_read_primitive_symmetric(r, n, ACCT_STR_NAME) \
aom_read_primitive_symmetric_(r, n ACCT_STR_ARG(ACCT_STR_NAME))
#define aom_read_primitive_quniform(r, n, ACCT_STR_NAME) \
aom_read_primitive_quniform_(r, n ACCT_STR_ARG(ACCT_STR_NAME))
#define aom_read_primitive_refbilevel(r, n, p, ref, ACCT_STR_NAME) \
aom_read_primitive_refbilevel_(r, n, p, ref ACCT_STR_ARG(ACCT_STR_NAME))
#define aom_read_primitive_subexpfin(r, n, k, ACCT_STR_NAME) \
aom_read_primitive_subexpfin_(r, n, k ACCT_STR_ARG(ACCT_STR_NAME))
#define aom_read_primitive_refsubexpfin(r, n, k, ref, ACCT_STR_NAME) \
aom_read_primitive_refsubexpfin_(r, n, k, ref ACCT_STR_ARG(ACCT_STR_NAME))
#define aom_read_signed_primitive_refsubexpfin(r, n, k, ref, ACCT_STR_NAME) \
aom_read_signed_primitive_refsubexpfin_(r, n, k, \
ref ACCT_STR_ARG(ACCT_STR_NAME))
uint16_t aom_read_primitive_quniform(aom_reader *r, uint16_t n);
uint16_t aom_read_primitive_refbilevel(aom_reader *r, uint16_t n, uint16_t p,
uint16_t ref);
uint16_t aom_read_primitive_subexpfin(aom_reader *r, uint16_t n, uint16_t k);
uint16_t aom_read_primitive_refsubexpfin(aom_reader *r, uint16_t n, uint16_t k,
uint16_t ref);
int16_t aom_read_signed_primitive_refsubexpfin(aom_reader *r, uint16_t n,
uint16_t k, int16_t ref);
int16_t aom_read_primitive_symmetric_(aom_reader *r,
unsigned int mag_bits ACCT_STR_PARAM);
uint16_t aom_read_primitive_quniform_(aom_reader *r, uint16_t n ACCT_STR_PARAM);
uint16_t aom_read_primitive_refbilevel_(aom_reader *r, uint16_t n, uint16_t p,
uint16_t ref ACCT_STR_PARAM);
uint16_t aom_read_primitive_subexpfin_(aom_reader *r, uint16_t n,
uint16_t k ACCT_STR_PARAM);
uint16_t aom_read_primitive_refsubexpfin_(aom_reader *r, uint16_t n, uint16_t k,
uint16_t ref ACCT_STR_PARAM);
int16_t aom_read_signed_primitive_refsubexpfin_(aom_reader *r, uint16_t n,
uint16_t k,
int16_t ref ACCT_STR_PARAM);
#ifdef __cplusplus
} // extern "C"
#endif

View file

@ -16,18 +16,13 @@
#include <limits.h>
#include "./aom_config.h"
#if CONFIG_EC_ADAPT && !CONFIG_EC_MULTISYMBOL
#error "CONFIG_EC_ADAPT is enabled without enabling CONFIG_EC_MULTISYMBOL."
#endif
#include "aom/aomdx.h"
#include "aom/aom_integer.h"
#if CONFIG_ANS
#include "aom_dsp/ansreader.h"
#elif CONFIG_DAALA_EC
#include "aom_dsp/daalaboolreader.h"
#else
#include "aom_dsp/dkboolreader.h"
#include "aom_dsp/daalaboolreader.h"
#endif
#include "aom_dsp/prob.h"
#include "av1/common/odintrin.h"
@ -61,26 +56,20 @@ extern "C" {
#if CONFIG_ANS
typedef struct AnsDecoder aom_reader;
#elif CONFIG_DAALA_EC
typedef struct daala_reader aom_reader;
#else
typedef struct aom_dk_reader aom_reader;
typedef struct daala_reader aom_reader;
#endif
static INLINE int aom_reader_init(aom_reader *r, const uint8_t *buffer,
size_t size, aom_decrypt_cb decrypt_cb,
void *decrypt_state) {
#if CONFIG_ANS
(void)decrypt_cb;
(void)decrypt_state;
#if CONFIG_ANS
if (size > INT_MAX) return 1;
return ans_read_init(r, buffer, (int)size);
#elif CONFIG_DAALA_EC
(void)decrypt_cb;
(void)decrypt_state;
return aom_daala_reader_init(r, buffer, (int)size);
#else
return aom_dk_reader_init(r, buffer, size, decrypt_cb, decrypt_state);
return aom_daala_reader_init(r, buffer, (int)size);
#endif
}
@ -89,20 +78,16 @@ static INLINE const uint8_t *aom_reader_find_end(aom_reader *r) {
(void)r;
assert(0 && "Use the raw buffer size with ANS");
return NULL;
#elif CONFIG_DAALA_EC
return aom_daala_reader_find_end(r);
#else
return aom_dk_reader_find_end(r);
return aom_daala_reader_find_end(r);
#endif
}
static INLINE int aom_reader_has_error(aom_reader *r) {
#if CONFIG_ANS
return ans_reader_has_error(r);
#elif CONFIG_DAALA_EC
return aom_daala_reader_has_error(r);
#else
return aom_dk_reader_has_error(r);
return aom_daala_reader_has_error(r);
#endif
}
@ -112,10 +97,8 @@ static INLINE uint32_t aom_reader_tell(const aom_reader *r) {
(void)r;
assert(0 && "aom_reader_tell() is unimplemented for ANS");
return 0;
#elif CONFIG_DAALA_EC
return aom_daala_reader_tell(r);
#else
return aom_dk_reader_tell(r);
return aom_daala_reader_tell(r);
#endif
}
@ -125,10 +108,8 @@ static INLINE uint32_t aom_reader_tell_frac(const aom_reader *r) {
(void)r;
assert(0 && "aom_reader_tell_frac() is unimplemented for ANS");
return 0;
#elif CONFIG_DAALA_EC
return aom_daala_reader_tell_frac(r);
#else
return aom_dk_reader_tell_frac(r);
return aom_daala_reader_tell_frac(r);
#endif
}
@ -155,10 +136,8 @@ static INLINE int aom_read_(aom_reader *r, int prob ACCT_STR_PARAM) {
int ret;
#if CONFIG_ANS
ret = rabs_read(r, prob);
#elif CONFIG_DAALA_EC
ret = aom_daala_read(r, prob);
#else
ret = aom_dk_read(r, prob);
ret = aom_daala_read(r, prob);
#endif
#if CONFIG_ACCOUNTING
if (ACCT_STR_NAME) aom_process_accounting(r, ACCT_STR_NAME);
@ -171,7 +150,7 @@ static INLINE int aom_read_bit_(aom_reader *r ACCT_STR_PARAM) {
int ret;
#if CONFIG_ANS
ret = rabs_read_bit(r); // Non trivial optimization at half probability
#elif CONFIG_DAALA_EC && CONFIG_RAWBITS
#elif CONFIG_RAWBITS
// Note this uses raw bits and is not the same as aom_daala_read(r, 128);
// Calls to this function are omitted from raw symbol accounting.
ret = aom_daala_read_bit(r);
@ -194,28 +173,14 @@ static INLINE int aom_read_literal_(aom_reader *r, int bits ACCT_STR_PARAM) {
return literal;
}
static INLINE int aom_read_tree_as_bits(aom_reader *r,
const aom_tree_index *tree,
const aom_prob *probs) {
aom_tree_index i = 0;
while ((i = tree[i + aom_read(r, probs[i >> 1], NULL)]) > 0) continue;
return -i;
}
#if CONFIG_EC_MULTISYMBOL
static INLINE int aom_read_cdf_(aom_reader *r, const aom_cdf_prob *cdf,
int nsymbs ACCT_STR_PARAM) {
int ret;
#if CONFIG_ANS
(void)nsymbs;
ret = rans_read(r, cdf);
#elif CONFIG_DAALA_EC
ret = daala_read_symbol(r, cdf, nsymbs);
#else
#error \
"CONFIG_EC_MULTISYMBOL is selected without a valid backing entropy " \
"coder. Enable daala_ec or ans for a valid configuration."
ret = daala_read_symbol(r, cdf, nsymbs);
#endif
#if CONFIG_ACCOUNTING
@ -253,16 +218,11 @@ static INLINE int aom_read_tree_as_cdf(aom_reader *r,
} while (i > 0);
return -i;
}
#endif // CONFIG_EC_MULTISYMBOL
static INLINE int aom_read_tree_(aom_reader *r, const aom_tree_index *tree,
const aom_prob *probs ACCT_STR_PARAM) {
int ret;
#if CONFIG_EC_MULTISYMBOL
ret = aom_read_tree_as_cdf(r, tree, probs);
#else
ret = aom_read_tree_as_bits(r, tree, probs);
#endif
#if CONFIG_ACCOUNTING
if (ACCT_STR_NAME) aom_process_accounting(r, ACCT_STR_NAME);
#endif

View file

@ -24,7 +24,7 @@ int aom_rb_read_bit(struct aom_read_bit_buffer *rb) {
rb->bit_offset = off + 1;
return bit;
} else {
rb->error_handler(rb->error_handler_data);
if (rb->error_handler) rb->error_handler(rb->error_handler_data);
return 0;
}
}

View file

@ -14,16 +14,11 @@
#include <assert.h>
#include "./aom_config.h"
#if CONFIG_EC_ADAPT && !CONFIG_EC_MULTISYMBOL
#error "CONFIG_EC_ADAPT is enabled without enabling CONFIG_EC_MULTISYMBOL"
#endif
#if CONFIG_ANS
#include "aom_dsp/buf_ans.h"
#elif CONFIG_DAALA_EC
#include "aom_dsp/daalaboolwriter.h"
#else
#include "aom_dsp/dkboolwriter.h"
#include "aom_dsp/daalaboolwriter.h"
#endif
#include "aom_dsp/prob.h"
@ -38,10 +33,8 @@ extern "C" {
#if CONFIG_ANS
typedef struct BufAnsCoder aom_writer;
#elif CONFIG_DAALA_EC
typedef struct daala_writer aom_writer;
#else
typedef struct aom_dk_writer aom_writer;
typedef struct daala_writer aom_writer;
#endif
typedef struct TOKEN_STATS {
@ -72,10 +65,8 @@ static INLINE void aom_start_encode(aom_writer *bc, uint8_t *buffer) {
(void)bc;
(void)buffer;
assert(0 && "buf_ans requires a more complicated startup procedure");
#elif CONFIG_DAALA_EC
aom_daala_start_encode(bc, buffer);
#else
aom_dk_start_encode(bc, buffer);
aom_daala_start_encode(bc, buffer);
#endif
}
@ -83,20 +74,16 @@ static INLINE void aom_stop_encode(aom_writer *bc) {
#if CONFIG_ANS
(void)bc;
assert(0 && "buf_ans requires a more complicated shutdown procedure");
#elif CONFIG_DAALA_EC
aom_daala_stop_encode(bc);
#else
aom_dk_stop_encode(bc);
aom_daala_stop_encode(bc);
#endif
}
static INLINE void aom_write(aom_writer *br, int bit, int probability) {
#if CONFIG_ANS
buf_rabs_write(br, bit, probability);
#elif CONFIG_DAALA_EC
aom_daala_write(br, bit, probability);
#else
aom_dk_write(br, bit, probability);
aom_daala_write(br, bit, probability);
#endif
}
@ -113,7 +100,7 @@ static INLINE void aom_write_record(aom_writer *br, int bit, int probability,
static INLINE void aom_write_bit(aom_writer *w, int bit) {
#if CONFIG_ANS
buf_rabs_write_bit(w, bit);
#elif CONFIG_DAALA_EC && CONFIG_RAWBITS
#elif CONFIG_RAWBITS
// Note this uses raw bits and is not the same as aom_daala_write(r, 128);
aom_daala_write_bit(w, bit);
#else
@ -137,28 +124,6 @@ static INLINE void aom_write_literal(aom_writer *w, int data, int bits) {
for (bit = bits - 1; bit >= 0; bit--) aom_write_bit(w, 1 & (data >> bit));
}
static INLINE void aom_write_tree_as_bits(aom_writer *w,
const aom_tree_index *tr,
const aom_prob *probs, int bits,
int len, aom_tree_index i) {
do {
const int bit = (bits >> --len) & 1;
aom_write(w, bit, probs[i >> 1]);
i = tr[i + bit];
} while (len);
}
static INLINE void aom_write_tree_as_bits_record(
aom_writer *w, const aom_tree_index *tr, const aom_prob *probs, int bits,
int len, aom_tree_index i, TOKEN_STATS *token_stats) {
do {
const int bit = (bits >> --len) & 1;
aom_write_record(w, bit, probs[i >> 1], token_stats);
i = tr[i + bit];
} while (len);
}
#if CONFIG_EC_MULTISYMBOL
static INLINE void aom_write_cdf(aom_writer *w, int symb,
const aom_cdf_prob *cdf, int nsymbs) {
#if CONFIG_ANS
@ -167,12 +132,8 @@ static INLINE void aom_write_cdf(aom_writer *w, int symb,
const aom_cdf_prob cum_prob = symb > 0 ? cdf[symb - 1] : 0;
const aom_cdf_prob prob = cdf[symb] - cum_prob;
buf_rans_write(w, cum_prob, prob);
#elif CONFIG_DAALA_EC
daala_write_symbol(w, symb, cdf, nsymbs);
#else
#error \
"CONFIG_EC_MULTISYMBOL is selected without a valid backing entropy " \
"coder. Enable daala_ec or ans for a valid configuration."
daala_write_symbol(w, symb, cdf, nsymbs);
#endif
}
@ -223,16 +184,10 @@ static INLINE void aom_write_tree_as_cdf(aom_writer *w,
} while (len);
}
#endif // CONFIG_EC_MULTISYMBOL
static INLINE void aom_write_tree(aom_writer *w, const aom_tree_index *tree,
const aom_prob *probs, int bits, int len,
aom_tree_index i) {
#if CONFIG_EC_MULTISYMBOL
aom_write_tree_as_cdf(w, tree, probs, bits, len, i);
#else
aom_write_tree_as_bits(w, tree, probs, bits, len, i);
#endif
}
static INLINE void aom_write_tree_record(aom_writer *w,
@ -240,12 +195,8 @@ static INLINE void aom_write_tree_record(aom_writer *w,
const aom_prob *probs, int bits,
int len, aom_tree_index i,
TOKEN_STATS *token_stats) {
#if CONFIG_EC_MULTISYMBOL
(void)token_stats;
aom_write_tree_as_cdf(w, tree, probs, bits, len, i);
#else
aom_write_tree_as_bits_record(w, tree, probs, bits, len, i, token_stats);
#endif
}
#ifdef __cplusplus

View file

@ -1,110 +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_config.h"
#include "aom_dsp/dkboolreader.h"
#include "aom_dsp/prob.h"
#include "aom_dsp/aom_dsp_common.h"
#include "aom_ports/mem.h"
#include "aom_mem/aom_mem.h"
#include "aom_util/endian_inl.h"
static INLINE int aom_dk_read_bit(struct aom_dk_reader *r) {
return aom_dk_read(r, 128); // aom_prob_half
}
int aom_dk_reader_init(struct aom_dk_reader *r, const uint8_t *buffer,
size_t size, aom_decrypt_cb decrypt_cb,
void *decrypt_state) {
if (size && !buffer) {
return 1;
} else {
r->buffer_end = buffer + size;
r->buffer_start = r->buffer = buffer;
r->value = 0;
r->count = -8;
r->range = 255;
r->decrypt_cb = decrypt_cb;
r->decrypt_state = decrypt_state;
aom_dk_reader_fill(r);
#if CONFIG_ACCOUNTING
r->accounting = NULL;
#endif
return aom_dk_read_bit(r) != 0; // marker bit
}
}
void aom_dk_reader_fill(struct aom_dk_reader *r) {
const uint8_t *const buffer_end = r->buffer_end;
const uint8_t *buffer = r->buffer;
const uint8_t *buffer_start = buffer;
BD_VALUE value = r->value;
int count = r->count;
const size_t bytes_left = buffer_end - buffer;
const size_t bits_left = bytes_left * CHAR_BIT;
int shift = BD_VALUE_SIZE - CHAR_BIT - (count + CHAR_BIT);
if (r->decrypt_cb) {
size_t n = AOMMIN(sizeof(r->clear_buffer), bytes_left);
r->decrypt_cb(r->decrypt_state, buffer, r->clear_buffer, (int)n);
buffer = r->clear_buffer;
buffer_start = r->clear_buffer;
}
if (bits_left > BD_VALUE_SIZE) {
const int bits = (shift & 0xfffffff8) + CHAR_BIT;
BD_VALUE nv;
BD_VALUE big_endian_values;
memcpy(&big_endian_values, buffer, sizeof(BD_VALUE));
#if SIZE_MAX == 0xffffffffffffffffULL
big_endian_values = HToBE64(big_endian_values);
#else
big_endian_values = HToBE32(big_endian_values);
#endif
nv = big_endian_values >> (BD_VALUE_SIZE - bits);
count += bits;
buffer += (bits >> 3);
value = r->value | (nv << (shift & 0x7));
} else {
const int bits_over = (int)(shift + CHAR_BIT - (int)bits_left);
int loop_end = 0;
if (bits_over >= 0) {
count += LOTS_OF_BITS;
loop_end = bits_over;
}
if (bits_over < 0 || bits_left) {
while (shift >= loop_end) {
count += CHAR_BIT;
value |= (BD_VALUE)*buffer++ << shift;
shift -= CHAR_BIT;
}
}
}
// NOTE: Variable 'buffer' may not relate to 'r->buffer' after decryption,
// so we increase 'r->buffer' by the amount that 'buffer' moved, rather than
// assign 'buffer' to 'r->buffer'.
r->buffer += buffer - buffer_start;
r->value = value;
r->count = count;
}
const uint8_t *aom_dk_reader_find_end(struct aom_dk_reader *r) {
// Find the end of the coded buffer
while (r->count > CHAR_BIT && r->count < BD_VALUE_SIZE) {
r->count -= CHAR_BIT;
r->buffer--;
}
return r->buffer;
}

View file

@ -1,181 +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_DSP_DKBOOLREADER_H_
#define AOM_DSP_DKBOOLREADER_H_
#include <assert.h>
#include <stddef.h>
#include <limits.h>
#include "./aom_config.h"
#if CONFIG_BITSTREAM_DEBUG
#include <assert.h>
#include <stdio.h>
#include "aom_util/debug_util.h"
#endif // CONFIG_BITSTREAM_DEBUG
#include "aom_ports/mem.h"
#include "aom/aomdx.h"
#include "aom/aom_integer.h"
#include "aom_dsp/prob.h"
#if CONFIG_ACCOUNTING
#include "av1/decoder/accounting.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef size_t BD_VALUE;
#define BD_VALUE_SIZE ((int)sizeof(BD_VALUE) * CHAR_BIT)
// This is meant to be a large, positive constant that can still be efficiently
// loaded as an immediate (on platforms like ARM, for example).
// Even relatively modest values like 100 would work fine.
#define LOTS_OF_BITS 0x40000000
struct aom_dk_reader {
// Be careful when reordering this struct, it may impact the cache negatively.
BD_VALUE value;
unsigned int range;
int count;
const uint8_t *buffer_start;
const uint8_t *buffer_end;
const uint8_t *buffer;
aom_decrypt_cb decrypt_cb;
void *decrypt_state;
uint8_t clear_buffer[sizeof(BD_VALUE) + 1];
#if CONFIG_ACCOUNTING
Accounting *accounting;
#endif
};
int aom_dk_reader_init(struct aom_dk_reader *r, const uint8_t *buffer,
size_t size, aom_decrypt_cb decrypt_cb,
void *decrypt_state);
void aom_dk_reader_fill(struct aom_dk_reader *r);
const uint8_t *aom_dk_reader_find_end(struct aom_dk_reader *r);
static INLINE uint32_t aom_dk_reader_tell(const struct aom_dk_reader *r) {
const uint32_t bits_read =
(uint32_t)((r->buffer - r->buffer_start) * CHAR_BIT);
const int count =
(r->count < LOTS_OF_BITS) ? r->count : r->count - LOTS_OF_BITS;
assert(r->buffer >= r->buffer_start);
return bits_read - (count + CHAR_BIT);
}
/*The resolution of fractional-precision bit usage measurements, i.e.,
3 => 1/8th bits.*/
#define DK_BITRES (3)
static INLINE uint32_t aom_dk_reader_tell_frac(const struct aom_dk_reader *r) {
uint32_t num_bits;
uint32_t range;
int l;
int i;
num_bits = aom_dk_reader_tell(r) << DK_BITRES;
range = r->range;
l = 0;
for (i = DK_BITRES; i-- > 0;) {
int b;
range = range * range >> 7;
b = (int)(range >> 8);
l = l << 1 | b;
range >>= b;
}
return num_bits - l;
}
static INLINE int aom_dk_reader_has_error(struct aom_dk_reader *r) {
// Check if we have reached the end of the buffer.
//
// Variable 'count' stores the number of bits in the 'value' buffer, minus
// 8. The top byte is part of the algorithm, and the remainder is buffered
// to be shifted into it. So if count == 8, the top 16 bits of 'value' are
// occupied, 8 for the algorithm and 8 in the buffer.
//
// When reading a byte from the user's buffer, count is filled with 8 and
// one byte is filled into the value buffer. When we reach the end of the
// data, count is additionally filled with LOTS_OF_BITS. So when
// count == LOTS_OF_BITS - 1, the user's data has been exhausted.
//
// 1 if we have tried to decode bits after the end of stream was encountered.
// 0 No error.
return r->count > BD_VALUE_SIZE && r->count < LOTS_OF_BITS;
}
static INLINE int aom_dk_read(struct aom_dk_reader *r, int prob) {
unsigned int bit = 0;
BD_VALUE value;
BD_VALUE bigsplit;
int count;
unsigned int range;
unsigned int split = (r->range * prob + (256 - prob)) >> CHAR_BIT;
if (r->count < 0) aom_dk_reader_fill(r);
value = r->value;
count = r->count;
bigsplit = (BD_VALUE)split << (BD_VALUE_SIZE - CHAR_BIT);
range = split;
if (value >= bigsplit) {
range = r->range - split;
value = value - bigsplit;
bit = 1;
}
{
register int shift = aom_norm[range];
range <<= shift;
value <<= shift;
count -= shift;
}
r->value = value;
r->count = count;
r->range = range;
#if CONFIG_BITSTREAM_DEBUG
{
int ref_bit, ref_prob;
const int queue_r = bitstream_queue_get_read();
const int frame_idx = bitstream_queue_get_frame_read();
bitstream_queue_pop(&ref_bit, &ref_prob);
if (prob != ref_prob) {
fprintf(
stderr,
"\n *** prob error, frame_idx_r %d prob %d ref_prob %d queue_r %d\n",
frame_idx, prob, ref_prob, queue_r);
assert(0);
}
if ((int)bit != ref_bit) {
fprintf(stderr, "\n *** bit error, frame_idx_r %d bit %d ref_bit %d\n",
frame_idx, bit, ref_bit);
assert(0);
}
}
#endif // CONFIG_BITSTREAM_DEBUG
return bit;
}
#ifdef __cplusplus
} // extern "C"
#endif
#endif // AOM_DSP_DKBOOLREADER_H_

View file

@ -1,44 +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 <assert.h>
#include "./dkboolwriter.h"
static INLINE void aom_dk_write_bit(aom_dk_writer *w, int bit) {
aom_dk_write(w, bit, 128); // aom_prob_half
}
void aom_dk_start_encode(aom_dk_writer *br, uint8_t *source) {
br->lowvalue = 0;
br->range = 255;
br->count = -24;
br->buffer = source;
br->pos = 0;
aom_dk_write_bit(br, 0);
}
void aom_dk_stop_encode(aom_dk_writer *br) {
int i;
#if CONFIG_BITSTREAM_DEBUG
bitstream_queue_set_skip_write(1);
#endif // CONFIG_BITSTREAM_DEBUG
for (i = 0; i < 32; i++) aom_dk_write_bit(br, 0);
#if CONFIG_BITSTREAM_DEBUG
bitstream_queue_set_skip_write(0);
#endif // CONFIG_BITSTREAM_DEBUG
// Ensure there's no ambigous collision with any index marker bytes
if ((br->buffer[br->pos - 1] & 0xe0) == 0xc0) br->buffer[br->pos++] = 0;
}

View file

@ -1,104 +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_DSP_DKBOOLWRITER_H_
#define AOM_DSP_DKBOOLWRITER_H_
#include "./aom_config.h"
#if CONFIG_BITSTREAM_DEBUG
#include <stdio.h>
#include "aom_util/debug_util.h"
#endif // CONFIG_BITSTREAM_DEBUG
#include "aom_dsp/prob.h"
#include "aom_ports/mem.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct aom_dk_writer {
unsigned int lowvalue;
unsigned int range;
int count;
unsigned int pos;
uint8_t *buffer;
} aom_dk_writer;
void aom_dk_start_encode(aom_dk_writer *bc, uint8_t *buffer);
void aom_dk_stop_encode(aom_dk_writer *bc);
static INLINE void aom_dk_write(aom_dk_writer *br, int bit, int probability) {
unsigned int split;
int count = br->count;
unsigned int range = br->range;
unsigned int lowvalue = br->lowvalue;
register int shift;
#if CONFIG_BITSTREAM_DEBUG
// int queue_r = 0;
// int frame_idx_r = 0;
// int queue_w = bitstream_queue_get_write();
// int frame_idx_w = bitstream_queue_get_frame_write();
// 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, probability);
#endif // CONFIG_BITSTREAM_DEBUG
split = 1 + (((range - 1) * probability) >> 8);
range = split;
if (bit) {
lowvalue += split;
range = br->range - split;
}
shift = aom_norm[range];
range <<= shift;
count += shift;
if (count >= 0) {
int offset = shift - count;
if ((lowvalue << (offset - 1)) & 0x80000000) {
int x = br->pos - 1;
while (x >= 0 && br->buffer[x] == 0xff) {
br->buffer[x] = 0;
x--;
}
br->buffer[x] += 1;
}
br->buffer[br->pos++] = (lowvalue >> (24 - offset));
lowvalue <<= offset;
shift = count;
lowvalue &= 0xffffff;
count -= 8;
}
lowvalue <<= shift;
br->count = count;
br->lowvalue = lowvalue;
br->range = range;
}
#ifdef __cplusplus
} // extern "C"
#endif
#endif // AOM_DSP_DKBOOLWRITER_H_

View file

@ -208,33 +208,30 @@ static const int sm_weight_log2_scale = 8;
#if CONFIG_TX64X64
// max(block_size_wide[BLOCK_LARGEST], block_size_high[BLOCK_LARGEST])
#define MAX_BLOCK_DIM 64
#define NUM_BLOCK_DIMS 6 // log2(MAX_BLOCK_DIM)
#else
#define MAX_BLOCK_DIM 32
#define NUM_BLOCK_DIMS 5
#endif // CONFIG_TX64X64
static const uint8_t sm_weight_arrays[NUM_BLOCK_DIMS][MAX_BLOCK_DIM] = {
static const uint8_t sm_weight_arrays[2 * MAX_BLOCK_DIM] = {
// Unused, because we always offset by bs, which is at least 2.
0, 0,
// bs = 2
{ 255, 128 },
255, 128,
// bs = 4
{ 255, 149, 85, 64 },
255, 149, 85, 64,
// bs = 8
{ 255, 197, 146, 105, 73, 50, 37, 32 },
255, 197, 146, 105, 73, 50, 37, 32,
// bs = 16
{ 255, 225, 196, 170, 145, 123, 102, 84, 68, 54, 43, 33, 26, 20, 17, 16 },
255, 225, 196, 170, 145, 123, 102, 84, 68, 54, 43, 33, 26, 20, 17, 16,
// bs = 32
{
255, 240, 225, 210, 196, 182, 169, 157, 145, 133, 122,
111, 101, 92, 83, 74, 66, 59, 52, 45, 39, 34,
29, 25, 21, 17, 14, 12, 10, 9, 8, 8 },
255, 240, 225, 210, 196, 182, 169, 157, 145, 133, 122, 111, 101, 92, 83, 74,
66, 59, 52, 45, 39, 34, 29, 25, 21, 17, 14, 12, 10, 9, 8, 8,
#if CONFIG_TX64X64
// bs = 64
{ 255, 248, 240, 233, 225, 218, 210, 203, 196, 189, 182, 176, 169,
163, 156, 150, 144, 138, 133, 127, 121, 116, 111, 106, 101, 96,
91, 86, 82, 77, 73, 69, 65, 61, 57, 54, 50, 47, 44,
41, 38, 35, 32, 29, 27, 25, 22, 20, 18, 16, 15, 13,
12, 10, 9, 8, 7, 6, 6, 5, 5, 4, 4, 4 },
255, 248, 240, 233, 225, 218, 210, 203, 196, 189, 182, 176, 169, 163, 156,
150, 144, 138, 133, 127, 121, 116, 111, 106, 101, 96, 91, 86, 82, 77, 73, 69,
65, 61, 57, 54, 50, 47, 44, 41, 38, 35, 32, 29, 27, 25, 22, 20, 18, 16, 15,
13, 12, 10, 9, 8, 7, 6, 6, 5, 5, 4, 4, 4,
#endif // CONFIG_TX64X64
};
@ -250,10 +247,7 @@ static INLINE void smooth_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
const uint8_t *above, const uint8_t *left) {
const uint8_t below_pred = left[bs - 1]; // estimated by bottom-left pixel
const uint8_t right_pred = above[bs - 1]; // estimated by top-right pixel
const int arr_index = get_msb(bs) - 1;
assert(arr_index >= 0);
assert(arr_index < NUM_BLOCK_DIMS);
const uint8_t *const sm_weights = sm_weight_arrays[arr_index];
const uint8_t *const sm_weights = sm_weight_arrays + bs;
// scale = 2 * 2^sm_weight_log2_scale
const int log2_scale = 1 + sm_weight_log2_scale;
const uint16_t scale = (1 << sm_weight_log2_scale);
@ -277,6 +271,64 @@ static INLINE void smooth_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
}
}
#if CONFIG_SMOOTH_HV
static INLINE void smooth_v_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
const uint8_t *above,
const uint8_t *left) {
const uint8_t below_pred = left[bs - 1]; // estimated by bottom-left pixel
const uint8_t *const sm_weights = sm_weight_arrays + bs;
// scale = 2^sm_weight_log2_scale
const int log2_scale = sm_weight_log2_scale;
const uint16_t scale = (1 << sm_weight_log2_scale);
sm_weights_sanity_checks(sm_weights, scale, log2_scale + sizeof(*dst));
int r;
for (r = 0; r < bs; r++) {
int c;
for (c = 0; c < bs; ++c) {
const uint8_t pixels[] = { above[c], below_pred };
const uint8_t weights[] = { sm_weights[r], scale - sm_weights[r] };
uint32_t this_pred = 0;
assert(scale >= sm_weights[r]);
int i;
for (i = 0; i < 2; ++i) {
this_pred += weights[i] * pixels[i];
}
dst[c] = clip_pixel(divide_round(this_pred, log2_scale));
}
dst += stride;
}
}
static INLINE void smooth_h_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
const uint8_t *above,
const uint8_t *left) {
const uint8_t right_pred = above[bs - 1]; // estimated by top-right pixel
const uint8_t *const sm_weights = sm_weight_arrays + bs;
// scale = 2^sm_weight_log2_scale
const int log2_scale = sm_weight_log2_scale;
const uint16_t scale = (1 << sm_weight_log2_scale);
sm_weights_sanity_checks(sm_weights, scale, log2_scale + sizeof(*dst));
int r;
for (r = 0; r < bs; r++) {
int c;
for (c = 0; c < bs; ++c) {
const uint8_t pixels[] = { left[r], right_pred };
const uint8_t weights[] = { sm_weights[c], scale - sm_weights[c] };
uint32_t this_pred = 0;
assert(scale >= sm_weights[c]);
int i;
for (i = 0; i < 2; ++i) {
this_pred += weights[i] * pixels[i];
}
dst[c] = clip_pixel(divide_round(this_pred, log2_scale));
}
dst += stride;
}
}
#endif // CONFIG_SMOOTH_HV
#else
static INLINE void tm_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
@ -743,10 +795,7 @@ static INLINE void highbd_smooth_predictor(uint16_t *dst, ptrdiff_t stride,
const uint16_t *left, int bd) {
const uint16_t below_pred = left[bs - 1]; // estimated by bottom-left pixel
const uint16_t right_pred = above[bs - 1]; // estimated by top-right pixel
const int arr_index = get_msb(bs) - 1;
assert(arr_index >= 0);
assert(arr_index < NUM_BLOCK_DIMS);
const uint8_t *const sm_weights = sm_weight_arrays[arr_index];
const uint8_t *const sm_weights = sm_weight_arrays + bs;
// scale = 2 * 2^sm_weight_log2_scale
const int log2_scale = 1 + sm_weight_log2_scale;
const uint16_t scale = (1 << sm_weight_log2_scale);
@ -770,6 +819,64 @@ static INLINE void highbd_smooth_predictor(uint16_t *dst, ptrdiff_t stride,
}
}
#if CONFIG_SMOOTH_HV
static INLINE void highbd_smooth_v_predictor(uint16_t *dst, ptrdiff_t stride,
int bs, const uint16_t *above,
const uint16_t *left, int bd) {
const uint16_t below_pred = left[bs - 1]; // estimated by bottom-left pixel
const uint8_t *const sm_weights = sm_weight_arrays + bs;
// scale = 2^sm_weight_log2_scale
const int log2_scale = sm_weight_log2_scale;
const uint16_t scale = (1 << sm_weight_log2_scale);
sm_weights_sanity_checks(sm_weights, scale, log2_scale + sizeof(*dst));
int r;
for (r = 0; r < bs; r++) {
int c;
for (c = 0; c < bs; ++c) {
const uint16_t pixels[] = { above[c], below_pred };
const uint8_t weights[] = { sm_weights[r], scale - sm_weights[r] };
uint32_t this_pred = 0;
assert(scale >= sm_weights[r]);
int i;
for (i = 0; i < 2; ++i) {
this_pred += weights[i] * pixels[i];
}
dst[c] = clip_pixel_highbd(divide_round(this_pred, log2_scale), bd);
}
dst += stride;
}
}
static INLINE void highbd_smooth_h_predictor(uint16_t *dst, ptrdiff_t stride,
int bs, const uint16_t *above,
const uint16_t *left, int bd) {
const uint16_t right_pred = above[bs - 1]; // estimated by top-right pixel
const uint8_t *const sm_weights = sm_weight_arrays + bs;
// scale = 2^sm_weight_log2_scale
const int log2_scale = sm_weight_log2_scale;
const uint16_t scale = (1 << sm_weight_log2_scale);
sm_weights_sanity_checks(sm_weights, scale, log2_scale + sizeof(*dst));
int r;
for (r = 0; r < bs; r++) {
int c;
for (c = 0; c < bs; ++c) {
const uint16_t pixels[] = { left[r], right_pred };
const uint8_t weights[] = { sm_weights[c], scale - sm_weights[c] };
uint32_t this_pred = 0;
assert(scale >= sm_weights[c]);
int i;
for (i = 0; i < 2; ++i) {
this_pred += weights[i] * pixels[i];
}
dst[c] = clip_pixel_highbd(divide_round(this_pred, log2_scale), bd);
}
dst += stride;
}
}
#endif
#else
static INLINE void highbd_tm_predictor(uint16_t *dst, ptrdiff_t stride, int bs,
const uint16_t *above,
@ -879,6 +986,7 @@ static INLINE void highbd_dc_predictor(uint16_t *dst, ptrdiff_t stride, int bs,
intra_pred_sized(type, 16) \
intra_pred_sized(type, 32) \
intra_pred_sized(type, 64) \
intra_pred_highbd_sized(type, 2) \
intra_pred_highbd_sized(type, 4) \
intra_pred_highbd_sized(type, 8) \
intra_pred_highbd_sized(type, 16) \
@ -958,8 +1066,12 @@ intra_pred_above_4x4(d153)
intra_pred_allsizes(v)
intra_pred_allsizes(h)
#if CONFIG_ALT_INTRA
intra_pred_allsizes(paeth)
intra_pred_allsizes(smooth)
#if CONFIG_SMOOTH_HV
intra_pred_allsizes(smooth_v)
intra_pred_allsizes(smooth_h)
#endif // CONFIG_SMOOTH_HV
intra_pred_allsizes(paeth)
#else
intra_pred_allsizes(tm)
#endif // CONFIG_ALT_INTRA

View file

@ -1442,4 +1442,868 @@ void aom_highbd_idct4x4_1_add_c(const tran_low_t *input, uint8_t *dest8,
}
}
void aom_highbd_idct8_c(const tran_low_t *input, tran_low_t *output, int bd) {
tran_low_t step1[8], step2[8];
tran_high_t temp1, temp2;
// stage 1
step1[0] = input[0];
step1[2] = input[4];
step1[1] = input[2];
step1[3] = input[6];
temp1 = input[1] * cospi_28_64 - input[7] * cospi_4_64;
temp2 = input[1] * cospi_4_64 + input[7] * cospi_28_64;
step1[4] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[7] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = input[5] * cospi_12_64 - input[3] * cospi_20_64;
temp2 = input[5] * cospi_20_64 + input[3] * cospi_12_64;
step1[5] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[6] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
// stage 2 & stage 3 - even half
aom_highbd_idct4_c(step1, step1, bd);
// stage 2 - odd half
step2[4] = HIGHBD_WRAPLOW(step1[4] + step1[5], bd);
step2[5] = HIGHBD_WRAPLOW(step1[4] - step1[5], bd);
step2[6] = HIGHBD_WRAPLOW(-step1[6] + step1[7], bd);
step2[7] = HIGHBD_WRAPLOW(step1[6] + step1[7], bd);
// stage 3 - odd half
step1[4] = step2[4];
temp1 = (step2[6] - step2[5]) * cospi_16_64;
temp2 = (step2[5] + step2[6]) * cospi_16_64;
step1[5] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[6] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
step1[7] = step2[7];
// stage 4
output[0] = HIGHBD_WRAPLOW(step1[0] + step1[7], bd);
output[1] = HIGHBD_WRAPLOW(step1[1] + step1[6], bd);
output[2] = HIGHBD_WRAPLOW(step1[2] + step1[5], bd);
output[3] = HIGHBD_WRAPLOW(step1[3] + step1[4], bd);
output[4] = HIGHBD_WRAPLOW(step1[3] - step1[4], bd);
output[5] = HIGHBD_WRAPLOW(step1[2] - step1[5], bd);
output[6] = HIGHBD_WRAPLOW(step1[1] - step1[6], bd);
output[7] = HIGHBD_WRAPLOW(step1[0] - step1[7], bd);
}
void aom_highbd_iadst4_c(const tran_low_t *input, tran_low_t *output, int bd) {
tran_high_t s0, s1, s2, s3, s4, s5, s6, s7;
tran_low_t x0 = input[0];
tran_low_t x1 = input[1];
tran_low_t x2 = input[2];
tran_low_t x3 = input[3];
(void)bd;
if (!(x0 | x1 | x2 | x3)) {
memset(output, 0, 4 * sizeof(*output));
return;
}
s0 = sinpi_1_9 * x0;
s1 = sinpi_2_9 * x0;
s2 = sinpi_3_9 * x1;
s3 = sinpi_4_9 * x2;
s4 = sinpi_1_9 * x2;
s5 = sinpi_2_9 * x3;
s6 = sinpi_4_9 * x3;
s7 = (tran_high_t)HIGHBD_WRAPLOW(x0 - x2 + x3, bd);
s0 = s0 + s3 + s5;
s1 = s1 - s4 - s6;
s3 = s2;
s2 = sinpi_3_9 * s7;
// 1-D transform scaling factor is sqrt(2).
// The overall dynamic range is 14b (input) + 14b (multiplication scaling)
// + 1b (addition) = 29b.
// Hence the output bit depth is 15b.
output[0] = HIGHBD_WRAPLOW(dct_const_round_shift(s0 + s3), bd);
output[1] = HIGHBD_WRAPLOW(dct_const_round_shift(s1 + s3), bd);
output[2] = HIGHBD_WRAPLOW(dct_const_round_shift(s2), bd);
output[3] = HIGHBD_WRAPLOW(dct_const_round_shift(s0 + s1 - s3), bd);
}
void aom_highbd_iadst8_c(const tran_low_t *input, tran_low_t *output, int bd) {
tran_high_t s0, s1, s2, s3, s4, s5, s6, s7;
tran_low_t x0 = input[7];
tran_low_t x1 = input[0];
tran_low_t x2 = input[5];
tran_low_t x3 = input[2];
tran_low_t x4 = input[3];
tran_low_t x5 = input[4];
tran_low_t x6 = input[1];
tran_low_t x7 = input[6];
(void)bd;
if (!(x0 | x1 | x2 | x3 | x4 | x5 | x6 | x7)) {
memset(output, 0, 8 * sizeof(*output));
return;
}
// stage 1
s0 = cospi_2_64 * x0 + cospi_30_64 * x1;
s1 = cospi_30_64 * x0 - cospi_2_64 * x1;
s2 = cospi_10_64 * x2 + cospi_22_64 * x3;
s3 = cospi_22_64 * x2 - cospi_10_64 * x3;
s4 = cospi_18_64 * x4 + cospi_14_64 * x5;
s5 = cospi_14_64 * x4 - cospi_18_64 * x5;
s6 = cospi_26_64 * x6 + cospi_6_64 * x7;
s7 = cospi_6_64 * x6 - cospi_26_64 * x7;
x0 = HIGHBD_WRAPLOW(dct_const_round_shift(s0 + s4), bd);
x1 = HIGHBD_WRAPLOW(dct_const_round_shift(s1 + s5), bd);
x2 = HIGHBD_WRAPLOW(dct_const_round_shift(s2 + s6), bd);
x3 = HIGHBD_WRAPLOW(dct_const_round_shift(s3 + s7), bd);
x4 = HIGHBD_WRAPLOW(dct_const_round_shift(s0 - s4), bd);
x5 = HIGHBD_WRAPLOW(dct_const_round_shift(s1 - s5), bd);
x6 = HIGHBD_WRAPLOW(dct_const_round_shift(s2 - s6), bd);
x7 = HIGHBD_WRAPLOW(dct_const_round_shift(s3 - s7), bd);
// stage 2
s0 = x0;
s1 = x1;
s2 = x2;
s3 = x3;
s4 = cospi_8_64 * x4 + cospi_24_64 * x5;
s5 = cospi_24_64 * x4 - cospi_8_64 * x5;
s6 = -cospi_24_64 * x6 + cospi_8_64 * x7;
s7 = cospi_8_64 * x6 + cospi_24_64 * x7;
x0 = HIGHBD_WRAPLOW(s0 + s2, bd);
x1 = HIGHBD_WRAPLOW(s1 + s3, bd);
x2 = HIGHBD_WRAPLOW(s0 - s2, bd);
x3 = HIGHBD_WRAPLOW(s1 - s3, bd);
x4 = HIGHBD_WRAPLOW(dct_const_round_shift(s4 + s6), bd);
x5 = HIGHBD_WRAPLOW(dct_const_round_shift(s5 + s7), bd);
x6 = HIGHBD_WRAPLOW(dct_const_round_shift(s4 - s6), bd);
x7 = HIGHBD_WRAPLOW(dct_const_round_shift(s5 - s7), bd);
// stage 3
s2 = cospi_16_64 * (x2 + x3);
s3 = cospi_16_64 * (x2 - x3);
s6 = cospi_16_64 * (x6 + x7);
s7 = cospi_16_64 * (x6 - x7);
x2 = HIGHBD_WRAPLOW(dct_const_round_shift(s2), bd);
x3 = HIGHBD_WRAPLOW(dct_const_round_shift(s3), bd);
x6 = HIGHBD_WRAPLOW(dct_const_round_shift(s6), bd);
x7 = HIGHBD_WRAPLOW(dct_const_round_shift(s7), bd);
output[0] = HIGHBD_WRAPLOW(x0, bd);
output[1] = HIGHBD_WRAPLOW(-x4, bd);
output[2] = HIGHBD_WRAPLOW(x6, bd);
output[3] = HIGHBD_WRAPLOW(-x2, bd);
output[4] = HIGHBD_WRAPLOW(x3, bd);
output[5] = HIGHBD_WRAPLOW(-x7, bd);
output[6] = HIGHBD_WRAPLOW(x5, bd);
output[7] = HIGHBD_WRAPLOW(-x1, bd);
}
void aom_highbd_idct16_c(const tran_low_t *input, tran_low_t *output, int bd) {
tran_low_t step1[16], step2[16];
tran_high_t temp1, temp2;
(void)bd;
// stage 1
step1[0] = input[0 / 2];
step1[1] = input[16 / 2];
step1[2] = input[8 / 2];
step1[3] = input[24 / 2];
step1[4] = input[4 / 2];
step1[5] = input[20 / 2];
step1[6] = input[12 / 2];
step1[7] = input[28 / 2];
step1[8] = input[2 / 2];
step1[9] = input[18 / 2];
step1[10] = input[10 / 2];
step1[11] = input[26 / 2];
step1[12] = input[6 / 2];
step1[13] = input[22 / 2];
step1[14] = input[14 / 2];
step1[15] = input[30 / 2];
// stage 2
step2[0] = step1[0];
step2[1] = step1[1];
step2[2] = step1[2];
step2[3] = step1[3];
step2[4] = step1[4];
step2[5] = step1[5];
step2[6] = step1[6];
step2[7] = step1[7];
temp1 = step1[8] * cospi_30_64 - step1[15] * cospi_2_64;
temp2 = step1[8] * cospi_2_64 + step1[15] * cospi_30_64;
step2[8] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step2[15] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = step1[9] * cospi_14_64 - step1[14] * cospi_18_64;
temp2 = step1[9] * cospi_18_64 + step1[14] * cospi_14_64;
step2[9] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step2[14] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = step1[10] * cospi_22_64 - step1[13] * cospi_10_64;
temp2 = step1[10] * cospi_10_64 + step1[13] * cospi_22_64;
step2[10] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step2[13] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = step1[11] * cospi_6_64 - step1[12] * cospi_26_64;
temp2 = step1[11] * cospi_26_64 + step1[12] * cospi_6_64;
step2[11] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step2[12] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
// stage 3
step1[0] = step2[0];
step1[1] = step2[1];
step1[2] = step2[2];
step1[3] = step2[3];
temp1 = step2[4] * cospi_28_64 - step2[7] * cospi_4_64;
temp2 = step2[4] * cospi_4_64 + step2[7] * cospi_28_64;
step1[4] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[7] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = step2[5] * cospi_12_64 - step2[6] * cospi_20_64;
temp2 = step2[5] * cospi_20_64 + step2[6] * cospi_12_64;
step1[5] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[6] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
step1[8] = HIGHBD_WRAPLOW(step2[8] + step2[9], bd);
step1[9] = HIGHBD_WRAPLOW(step2[8] - step2[9], bd);
step1[10] = HIGHBD_WRAPLOW(-step2[10] + step2[11], bd);
step1[11] = HIGHBD_WRAPLOW(step2[10] + step2[11], bd);
step1[12] = HIGHBD_WRAPLOW(step2[12] + step2[13], bd);
step1[13] = HIGHBD_WRAPLOW(step2[12] - step2[13], bd);
step1[14] = HIGHBD_WRAPLOW(-step2[14] + step2[15], bd);
step1[15] = HIGHBD_WRAPLOW(step2[14] + step2[15], bd);
// stage 4
temp1 = (step1[0] + step1[1]) * cospi_16_64;
temp2 = (step1[0] - step1[1]) * cospi_16_64;
step2[0] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step2[1] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = step1[2] * cospi_24_64 - step1[3] * cospi_8_64;
temp2 = step1[2] * cospi_8_64 + step1[3] * cospi_24_64;
step2[2] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step2[3] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
step2[4] = HIGHBD_WRAPLOW(step1[4] + step1[5], bd);
step2[5] = HIGHBD_WRAPLOW(step1[4] - step1[5], bd);
step2[6] = HIGHBD_WRAPLOW(-step1[6] + step1[7], bd);
step2[7] = HIGHBD_WRAPLOW(step1[6] + step1[7], bd);
step2[8] = step1[8];
step2[15] = step1[15];
temp1 = -step1[9] * cospi_8_64 + step1[14] * cospi_24_64;
temp2 = step1[9] * cospi_24_64 + step1[14] * cospi_8_64;
step2[9] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step2[14] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = -step1[10] * cospi_24_64 - step1[13] * cospi_8_64;
temp2 = -step1[10] * cospi_8_64 + step1[13] * cospi_24_64;
step2[10] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step2[13] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
step2[11] = step1[11];
step2[12] = step1[12];
// stage 5
step1[0] = HIGHBD_WRAPLOW(step2[0] + step2[3], bd);
step1[1] = HIGHBD_WRAPLOW(step2[1] + step2[2], bd);
step1[2] = HIGHBD_WRAPLOW(step2[1] - step2[2], bd);
step1[3] = HIGHBD_WRAPLOW(step2[0] - step2[3], bd);
step1[4] = step2[4];
temp1 = (step2[6] - step2[5]) * cospi_16_64;
temp2 = (step2[5] + step2[6]) * cospi_16_64;
step1[5] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[6] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
step1[7] = step2[7];
step1[8] = HIGHBD_WRAPLOW(step2[8] + step2[11], bd);
step1[9] = HIGHBD_WRAPLOW(step2[9] + step2[10], bd);
step1[10] = HIGHBD_WRAPLOW(step2[9] - step2[10], bd);
step1[11] = HIGHBD_WRAPLOW(step2[8] - step2[11], bd);
step1[12] = HIGHBD_WRAPLOW(-step2[12] + step2[15], bd);
step1[13] = HIGHBD_WRAPLOW(-step2[13] + step2[14], bd);
step1[14] = HIGHBD_WRAPLOW(step2[13] + step2[14], bd);
step1[15] = HIGHBD_WRAPLOW(step2[12] + step2[15], bd);
// stage 6
step2[0] = HIGHBD_WRAPLOW(step1[0] + step1[7], bd);
step2[1] = HIGHBD_WRAPLOW(step1[1] + step1[6], bd);
step2[2] = HIGHBD_WRAPLOW(step1[2] + step1[5], bd);
step2[3] = HIGHBD_WRAPLOW(step1[3] + step1[4], bd);
step2[4] = HIGHBD_WRAPLOW(step1[3] - step1[4], bd);
step2[5] = HIGHBD_WRAPLOW(step1[2] - step1[5], bd);
step2[6] = HIGHBD_WRAPLOW(step1[1] - step1[6], bd);
step2[7] = HIGHBD_WRAPLOW(step1[0] - step1[7], bd);
step2[8] = step1[8];
step2[9] = step1[9];
temp1 = (-step1[10] + step1[13]) * cospi_16_64;
temp2 = (step1[10] + step1[13]) * cospi_16_64;
step2[10] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step2[13] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = (-step1[11] + step1[12]) * cospi_16_64;
temp2 = (step1[11] + step1[12]) * cospi_16_64;
step2[11] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step2[12] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
step2[14] = step1[14];
step2[15] = step1[15];
// stage 7
output[0] = HIGHBD_WRAPLOW(step2[0] + step2[15], bd);
output[1] = HIGHBD_WRAPLOW(step2[1] + step2[14], bd);
output[2] = HIGHBD_WRAPLOW(step2[2] + step2[13], bd);
output[3] = HIGHBD_WRAPLOW(step2[3] + step2[12], bd);
output[4] = HIGHBD_WRAPLOW(step2[4] + step2[11], bd);
output[5] = HIGHBD_WRAPLOW(step2[5] + step2[10], bd);
output[6] = HIGHBD_WRAPLOW(step2[6] + step2[9], bd);
output[7] = HIGHBD_WRAPLOW(step2[7] + step2[8], bd);
output[8] = HIGHBD_WRAPLOW(step2[7] - step2[8], bd);
output[9] = HIGHBD_WRAPLOW(step2[6] - step2[9], bd);
output[10] = HIGHBD_WRAPLOW(step2[5] - step2[10], bd);
output[11] = HIGHBD_WRAPLOW(step2[4] - step2[11], bd);
output[12] = HIGHBD_WRAPLOW(step2[3] - step2[12], bd);
output[13] = HIGHBD_WRAPLOW(step2[2] - step2[13], bd);
output[14] = HIGHBD_WRAPLOW(step2[1] - step2[14], bd);
output[15] = HIGHBD_WRAPLOW(step2[0] - step2[15], bd);
}
void aom_highbd_iadst16_c(const tran_low_t *input, tran_low_t *output, int bd) {
tran_high_t s0, s1, s2, s3, s4, s5, s6, s7, s8;
tran_high_t s9, s10, s11, s12, s13, s14, s15;
tran_low_t x0 = input[15];
tran_low_t x1 = input[0];
tran_low_t x2 = input[13];
tran_low_t x3 = input[2];
tran_low_t x4 = input[11];
tran_low_t x5 = input[4];
tran_low_t x6 = input[9];
tran_low_t x7 = input[6];
tran_low_t x8 = input[7];
tran_low_t x9 = input[8];
tran_low_t x10 = input[5];
tran_low_t x11 = input[10];
tran_low_t x12 = input[3];
tran_low_t x13 = input[12];
tran_low_t x14 = input[1];
tran_low_t x15 = input[14];
(void)bd;
if (!(x0 | x1 | x2 | x3 | x4 | x5 | x6 | x7 | x8 | x9 | x10 | x11 | x12 |
x13 | x14 | x15)) {
memset(output, 0, 16 * sizeof(*output));
return;
}
// stage 1
s0 = x0 * cospi_1_64 + x1 * cospi_31_64;
s1 = x0 * cospi_31_64 - x1 * cospi_1_64;
s2 = x2 * cospi_5_64 + x3 * cospi_27_64;
s3 = x2 * cospi_27_64 - x3 * cospi_5_64;
s4 = x4 * cospi_9_64 + x5 * cospi_23_64;
s5 = x4 * cospi_23_64 - x5 * cospi_9_64;
s6 = x6 * cospi_13_64 + x7 * cospi_19_64;
s7 = x6 * cospi_19_64 - x7 * cospi_13_64;
s8 = x8 * cospi_17_64 + x9 * cospi_15_64;
s9 = x8 * cospi_15_64 - x9 * cospi_17_64;
s10 = x10 * cospi_21_64 + x11 * cospi_11_64;
s11 = x10 * cospi_11_64 - x11 * cospi_21_64;
s12 = x12 * cospi_25_64 + x13 * cospi_7_64;
s13 = x12 * cospi_7_64 - x13 * cospi_25_64;
s14 = x14 * cospi_29_64 + x15 * cospi_3_64;
s15 = x14 * cospi_3_64 - x15 * cospi_29_64;
x0 = HIGHBD_WRAPLOW(dct_const_round_shift(s0 + s8), bd);
x1 = HIGHBD_WRAPLOW(dct_const_round_shift(s1 + s9), bd);
x2 = HIGHBD_WRAPLOW(dct_const_round_shift(s2 + s10), bd);
x3 = HIGHBD_WRAPLOW(dct_const_round_shift(s3 + s11), bd);
x4 = HIGHBD_WRAPLOW(dct_const_round_shift(s4 + s12), bd);
x5 = HIGHBD_WRAPLOW(dct_const_round_shift(s5 + s13), bd);
x6 = HIGHBD_WRAPLOW(dct_const_round_shift(s6 + s14), bd);
x7 = HIGHBD_WRAPLOW(dct_const_round_shift(s7 + s15), bd);
x8 = HIGHBD_WRAPLOW(dct_const_round_shift(s0 - s8), bd);
x9 = HIGHBD_WRAPLOW(dct_const_round_shift(s1 - s9), bd);
x10 = HIGHBD_WRAPLOW(dct_const_round_shift(s2 - s10), bd);
x11 = HIGHBD_WRAPLOW(dct_const_round_shift(s3 - s11), bd);
x12 = HIGHBD_WRAPLOW(dct_const_round_shift(s4 - s12), bd);
x13 = HIGHBD_WRAPLOW(dct_const_round_shift(s5 - s13), bd);
x14 = HIGHBD_WRAPLOW(dct_const_round_shift(s6 - s14), bd);
x15 = HIGHBD_WRAPLOW(dct_const_round_shift(s7 - s15), bd);
// stage 2
s0 = x0;
s1 = x1;
s2 = x2;
s3 = x3;
s4 = x4;
s5 = x5;
s6 = x6;
s7 = x7;
s8 = x8 * cospi_4_64 + x9 * cospi_28_64;
s9 = x8 * cospi_28_64 - x9 * cospi_4_64;
s10 = x10 * cospi_20_64 + x11 * cospi_12_64;
s11 = x10 * cospi_12_64 - x11 * cospi_20_64;
s12 = -x12 * cospi_28_64 + x13 * cospi_4_64;
s13 = x12 * cospi_4_64 + x13 * cospi_28_64;
s14 = -x14 * cospi_12_64 + x15 * cospi_20_64;
s15 = x14 * cospi_20_64 + x15 * cospi_12_64;
x0 = HIGHBD_WRAPLOW(s0 + s4, bd);
x1 = HIGHBD_WRAPLOW(s1 + s5, bd);
x2 = HIGHBD_WRAPLOW(s2 + s6, bd);
x3 = HIGHBD_WRAPLOW(s3 + s7, bd);
x4 = HIGHBD_WRAPLOW(s0 - s4, bd);
x5 = HIGHBD_WRAPLOW(s1 - s5, bd);
x6 = HIGHBD_WRAPLOW(s2 - s6, bd);
x7 = HIGHBD_WRAPLOW(s3 - s7, bd);
x8 = HIGHBD_WRAPLOW(dct_const_round_shift(s8 + s12), bd);
x9 = HIGHBD_WRAPLOW(dct_const_round_shift(s9 + s13), bd);
x10 = HIGHBD_WRAPLOW(dct_const_round_shift(s10 + s14), bd);
x11 = HIGHBD_WRAPLOW(dct_const_round_shift(s11 + s15), bd);
x12 = HIGHBD_WRAPLOW(dct_const_round_shift(s8 - s12), bd);
x13 = HIGHBD_WRAPLOW(dct_const_round_shift(s9 - s13), bd);
x14 = HIGHBD_WRAPLOW(dct_const_round_shift(s10 - s14), bd);
x15 = HIGHBD_WRAPLOW(dct_const_round_shift(s11 - s15), bd);
// stage 3
s0 = x0;
s1 = x1;
s2 = x2;
s3 = x3;
s4 = x4 * cospi_8_64 + x5 * cospi_24_64;
s5 = x4 * cospi_24_64 - x5 * cospi_8_64;
s6 = -x6 * cospi_24_64 + x7 * cospi_8_64;
s7 = x6 * cospi_8_64 + x7 * cospi_24_64;
s8 = x8;
s9 = x9;
s10 = x10;
s11 = x11;
s12 = x12 * cospi_8_64 + x13 * cospi_24_64;
s13 = x12 * cospi_24_64 - x13 * cospi_8_64;
s14 = -x14 * cospi_24_64 + x15 * cospi_8_64;
s15 = x14 * cospi_8_64 + x15 * cospi_24_64;
x0 = HIGHBD_WRAPLOW(s0 + s2, bd);
x1 = HIGHBD_WRAPLOW(s1 + s3, bd);
x2 = HIGHBD_WRAPLOW(s0 - s2, bd);
x3 = HIGHBD_WRAPLOW(s1 - s3, bd);
x4 = HIGHBD_WRAPLOW(dct_const_round_shift(s4 + s6), bd);
x5 = HIGHBD_WRAPLOW(dct_const_round_shift(s5 + s7), bd);
x6 = HIGHBD_WRAPLOW(dct_const_round_shift(s4 - s6), bd);
x7 = HIGHBD_WRAPLOW(dct_const_round_shift(s5 - s7), bd);
x8 = HIGHBD_WRAPLOW(s8 + s10, bd);
x9 = HIGHBD_WRAPLOW(s9 + s11, bd);
x10 = HIGHBD_WRAPLOW(s8 - s10, bd);
x11 = HIGHBD_WRAPLOW(s9 - s11, bd);
x12 = HIGHBD_WRAPLOW(dct_const_round_shift(s12 + s14), bd);
x13 = HIGHBD_WRAPLOW(dct_const_round_shift(s13 + s15), bd);
x14 = HIGHBD_WRAPLOW(dct_const_round_shift(s12 - s14), bd);
x15 = HIGHBD_WRAPLOW(dct_const_round_shift(s13 - s15), bd);
// stage 4
s2 = (-cospi_16_64) * (x2 + x3);
s3 = cospi_16_64 * (x2 - x3);
s6 = cospi_16_64 * (x6 + x7);
s7 = cospi_16_64 * (-x6 + x7);
s10 = cospi_16_64 * (x10 + x11);
s11 = cospi_16_64 * (-x10 + x11);
s14 = (-cospi_16_64) * (x14 + x15);
s15 = cospi_16_64 * (x14 - x15);
x2 = HIGHBD_WRAPLOW(dct_const_round_shift(s2), bd);
x3 = HIGHBD_WRAPLOW(dct_const_round_shift(s3), bd);
x6 = HIGHBD_WRAPLOW(dct_const_round_shift(s6), bd);
x7 = HIGHBD_WRAPLOW(dct_const_round_shift(s7), bd);
x10 = HIGHBD_WRAPLOW(dct_const_round_shift(s10), bd);
x11 = HIGHBD_WRAPLOW(dct_const_round_shift(s11), bd);
x14 = HIGHBD_WRAPLOW(dct_const_round_shift(s14), bd);
x15 = HIGHBD_WRAPLOW(dct_const_round_shift(s15), bd);
output[0] = HIGHBD_WRAPLOW(x0, bd);
output[1] = HIGHBD_WRAPLOW(-x8, bd);
output[2] = HIGHBD_WRAPLOW(x12, bd);
output[3] = HIGHBD_WRAPLOW(-x4, bd);
output[4] = HIGHBD_WRAPLOW(x6, bd);
output[5] = HIGHBD_WRAPLOW(x14, bd);
output[6] = HIGHBD_WRAPLOW(x10, bd);
output[7] = HIGHBD_WRAPLOW(x2, bd);
output[8] = HIGHBD_WRAPLOW(x3, bd);
output[9] = HIGHBD_WRAPLOW(x11, bd);
output[10] = HIGHBD_WRAPLOW(x15, bd);
output[11] = HIGHBD_WRAPLOW(x7, bd);
output[12] = HIGHBD_WRAPLOW(x5, bd);
output[13] = HIGHBD_WRAPLOW(-x13, bd);
output[14] = HIGHBD_WRAPLOW(x9, bd);
output[15] = HIGHBD_WRAPLOW(-x1, bd);
}
void aom_highbd_idct32_c(const tran_low_t *input, tran_low_t *output, int bd) {
tran_low_t step1[32], step2[32];
tran_high_t temp1, temp2;
(void)bd;
// stage 1
step1[0] = input[0];
step1[1] = input[16];
step1[2] = input[8];
step1[3] = input[24];
step1[4] = input[4];
step1[5] = input[20];
step1[6] = input[12];
step1[7] = input[28];
step1[8] = input[2];
step1[9] = input[18];
step1[10] = input[10];
step1[11] = input[26];
step1[12] = input[6];
step1[13] = input[22];
step1[14] = input[14];
step1[15] = input[30];
temp1 = input[1] * cospi_31_64 - input[31] * cospi_1_64;
temp2 = input[1] * cospi_1_64 + input[31] * cospi_31_64;
step1[16] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[31] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = input[17] * cospi_15_64 - input[15] * cospi_17_64;
temp2 = input[17] * cospi_17_64 + input[15] * cospi_15_64;
step1[17] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[30] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = input[9] * cospi_23_64 - input[23] * cospi_9_64;
temp2 = input[9] * cospi_9_64 + input[23] * cospi_23_64;
step1[18] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[29] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = input[25] * cospi_7_64 - input[7] * cospi_25_64;
temp2 = input[25] * cospi_25_64 + input[7] * cospi_7_64;
step1[19] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[28] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = input[5] * cospi_27_64 - input[27] * cospi_5_64;
temp2 = input[5] * cospi_5_64 + input[27] * cospi_27_64;
step1[20] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[27] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = input[21] * cospi_11_64 - input[11] * cospi_21_64;
temp2 = input[21] * cospi_21_64 + input[11] * cospi_11_64;
step1[21] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[26] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = input[13] * cospi_19_64 - input[19] * cospi_13_64;
temp2 = input[13] * cospi_13_64 + input[19] * cospi_19_64;
step1[22] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[25] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = input[29] * cospi_3_64 - input[3] * cospi_29_64;
temp2 = input[29] * cospi_29_64 + input[3] * cospi_3_64;
step1[23] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[24] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
// stage 2
step2[0] = step1[0];
step2[1] = step1[1];
step2[2] = step1[2];
step2[3] = step1[3];
step2[4] = step1[4];
step2[5] = step1[5];
step2[6] = step1[6];
step2[7] = step1[7];
temp1 = step1[8] * cospi_30_64 - step1[15] * cospi_2_64;
temp2 = step1[8] * cospi_2_64 + step1[15] * cospi_30_64;
step2[8] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step2[15] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = step1[9] * cospi_14_64 - step1[14] * cospi_18_64;
temp2 = step1[9] * cospi_18_64 + step1[14] * cospi_14_64;
step2[9] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step2[14] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = step1[10] * cospi_22_64 - step1[13] * cospi_10_64;
temp2 = step1[10] * cospi_10_64 + step1[13] * cospi_22_64;
step2[10] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step2[13] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = step1[11] * cospi_6_64 - step1[12] * cospi_26_64;
temp2 = step1[11] * cospi_26_64 + step1[12] * cospi_6_64;
step2[11] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step2[12] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
step2[16] = HIGHBD_WRAPLOW(step1[16] + step1[17], bd);
step2[17] = HIGHBD_WRAPLOW(step1[16] - step1[17], bd);
step2[18] = HIGHBD_WRAPLOW(-step1[18] + step1[19], bd);
step2[19] = HIGHBD_WRAPLOW(step1[18] + step1[19], bd);
step2[20] = HIGHBD_WRAPLOW(step1[20] + step1[21], bd);
step2[21] = HIGHBD_WRAPLOW(step1[20] - step1[21], bd);
step2[22] = HIGHBD_WRAPLOW(-step1[22] + step1[23], bd);
step2[23] = HIGHBD_WRAPLOW(step1[22] + step1[23], bd);
step2[24] = HIGHBD_WRAPLOW(step1[24] + step1[25], bd);
step2[25] = HIGHBD_WRAPLOW(step1[24] - step1[25], bd);
step2[26] = HIGHBD_WRAPLOW(-step1[26] + step1[27], bd);
step2[27] = HIGHBD_WRAPLOW(step1[26] + step1[27], bd);
step2[28] = HIGHBD_WRAPLOW(step1[28] + step1[29], bd);
step2[29] = HIGHBD_WRAPLOW(step1[28] - step1[29], bd);
step2[30] = HIGHBD_WRAPLOW(-step1[30] + step1[31], bd);
step2[31] = HIGHBD_WRAPLOW(step1[30] + step1[31], bd);
// stage 3
step1[0] = step2[0];
step1[1] = step2[1];
step1[2] = step2[2];
step1[3] = step2[3];
temp1 = step2[4] * cospi_28_64 - step2[7] * cospi_4_64;
temp2 = step2[4] * cospi_4_64 + step2[7] * cospi_28_64;
step1[4] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[7] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = step2[5] * cospi_12_64 - step2[6] * cospi_20_64;
temp2 = step2[5] * cospi_20_64 + step2[6] * cospi_12_64;
step1[5] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[6] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
step1[8] = HIGHBD_WRAPLOW(step2[8] + step2[9], bd);
step1[9] = HIGHBD_WRAPLOW(step2[8] - step2[9], bd);
step1[10] = HIGHBD_WRAPLOW(-step2[10] + step2[11], bd);
step1[11] = HIGHBD_WRAPLOW(step2[10] + step2[11], bd);
step1[12] = HIGHBD_WRAPLOW(step2[12] + step2[13], bd);
step1[13] = HIGHBD_WRAPLOW(step2[12] - step2[13], bd);
step1[14] = HIGHBD_WRAPLOW(-step2[14] + step2[15], bd);
step1[15] = HIGHBD_WRAPLOW(step2[14] + step2[15], bd);
step1[16] = step2[16];
step1[31] = step2[31];
temp1 = -step2[17] * cospi_4_64 + step2[30] * cospi_28_64;
temp2 = step2[17] * cospi_28_64 + step2[30] * cospi_4_64;
step1[17] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[30] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = -step2[18] * cospi_28_64 - step2[29] * cospi_4_64;
temp2 = -step2[18] * cospi_4_64 + step2[29] * cospi_28_64;
step1[18] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[29] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
step1[19] = step2[19];
step1[20] = step2[20];
temp1 = -step2[21] * cospi_20_64 + step2[26] * cospi_12_64;
temp2 = step2[21] * cospi_12_64 + step2[26] * cospi_20_64;
step1[21] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[26] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = -step2[22] * cospi_12_64 - step2[25] * cospi_20_64;
temp2 = -step2[22] * cospi_20_64 + step2[25] * cospi_12_64;
step1[22] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[25] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
step1[23] = step2[23];
step1[24] = step2[24];
step1[27] = step2[27];
step1[28] = step2[28];
// stage 4
temp1 = (step1[0] + step1[1]) * cospi_16_64;
temp2 = (step1[0] - step1[1]) * cospi_16_64;
step2[0] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step2[1] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = step1[2] * cospi_24_64 - step1[3] * cospi_8_64;
temp2 = step1[2] * cospi_8_64 + step1[3] * cospi_24_64;
step2[2] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step2[3] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
step2[4] = HIGHBD_WRAPLOW(step1[4] + step1[5], bd);
step2[5] = HIGHBD_WRAPLOW(step1[4] - step1[5], bd);
step2[6] = HIGHBD_WRAPLOW(-step1[6] + step1[7], bd);
step2[7] = HIGHBD_WRAPLOW(step1[6] + step1[7], bd);
step2[8] = step1[8];
step2[15] = step1[15];
temp1 = -step1[9] * cospi_8_64 + step1[14] * cospi_24_64;
temp2 = step1[9] * cospi_24_64 + step1[14] * cospi_8_64;
step2[9] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step2[14] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = -step1[10] * cospi_24_64 - step1[13] * cospi_8_64;
temp2 = -step1[10] * cospi_8_64 + step1[13] * cospi_24_64;
step2[10] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step2[13] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
step2[11] = step1[11];
step2[12] = step1[12];
step2[16] = HIGHBD_WRAPLOW(step1[16] + step1[19], bd);
step2[17] = HIGHBD_WRAPLOW(step1[17] + step1[18], bd);
step2[18] = HIGHBD_WRAPLOW(step1[17] - step1[18], bd);
step2[19] = HIGHBD_WRAPLOW(step1[16] - step1[19], bd);
step2[20] = HIGHBD_WRAPLOW(-step1[20] + step1[23], bd);
step2[21] = HIGHBD_WRAPLOW(-step1[21] + step1[22], bd);
step2[22] = HIGHBD_WRAPLOW(step1[21] + step1[22], bd);
step2[23] = HIGHBD_WRAPLOW(step1[20] + step1[23], bd);
step2[24] = HIGHBD_WRAPLOW(step1[24] + step1[27], bd);
step2[25] = HIGHBD_WRAPLOW(step1[25] + step1[26], bd);
step2[26] = HIGHBD_WRAPLOW(step1[25] - step1[26], bd);
step2[27] = HIGHBD_WRAPLOW(step1[24] - step1[27], bd);
step2[28] = HIGHBD_WRAPLOW(-step1[28] + step1[31], bd);
step2[29] = HIGHBD_WRAPLOW(-step1[29] + step1[30], bd);
step2[30] = HIGHBD_WRAPLOW(step1[29] + step1[30], bd);
step2[31] = HIGHBD_WRAPLOW(step1[28] + step1[31], bd);
// stage 5
step1[0] = HIGHBD_WRAPLOW(step2[0] + step2[3], bd);
step1[1] = HIGHBD_WRAPLOW(step2[1] + step2[2], bd);
step1[2] = HIGHBD_WRAPLOW(step2[1] - step2[2], bd);
step1[3] = HIGHBD_WRAPLOW(step2[0] - step2[3], bd);
step1[4] = step2[4];
temp1 = (step2[6] - step2[5]) * cospi_16_64;
temp2 = (step2[5] + step2[6]) * cospi_16_64;
step1[5] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[6] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
step1[7] = step2[7];
step1[8] = HIGHBD_WRAPLOW(step2[8] + step2[11], bd);
step1[9] = HIGHBD_WRAPLOW(step2[9] + step2[10], bd);
step1[10] = HIGHBD_WRAPLOW(step2[9] - step2[10], bd);
step1[11] = HIGHBD_WRAPLOW(step2[8] - step2[11], bd);
step1[12] = HIGHBD_WRAPLOW(-step2[12] + step2[15], bd);
step1[13] = HIGHBD_WRAPLOW(-step2[13] + step2[14], bd);
step1[14] = HIGHBD_WRAPLOW(step2[13] + step2[14], bd);
step1[15] = HIGHBD_WRAPLOW(step2[12] + step2[15], bd);
step1[16] = step2[16];
step1[17] = step2[17];
temp1 = -step2[18] * cospi_8_64 + step2[29] * cospi_24_64;
temp2 = step2[18] * cospi_24_64 + step2[29] * cospi_8_64;
step1[18] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[29] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = -step2[19] * cospi_8_64 + step2[28] * cospi_24_64;
temp2 = step2[19] * cospi_24_64 + step2[28] * cospi_8_64;
step1[19] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[28] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = -step2[20] * cospi_24_64 - step2[27] * cospi_8_64;
temp2 = -step2[20] * cospi_8_64 + step2[27] * cospi_24_64;
step1[20] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[27] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = -step2[21] * cospi_24_64 - step2[26] * cospi_8_64;
temp2 = -step2[21] * cospi_8_64 + step2[26] * cospi_24_64;
step1[21] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[26] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
step1[22] = step2[22];
step1[23] = step2[23];
step1[24] = step2[24];
step1[25] = step2[25];
step1[30] = step2[30];
step1[31] = step2[31];
// stage 6
step2[0] = HIGHBD_WRAPLOW(step1[0] + step1[7], bd);
step2[1] = HIGHBD_WRAPLOW(step1[1] + step1[6], bd);
step2[2] = HIGHBD_WRAPLOW(step1[2] + step1[5], bd);
step2[3] = HIGHBD_WRAPLOW(step1[3] + step1[4], bd);
step2[4] = HIGHBD_WRAPLOW(step1[3] - step1[4], bd);
step2[5] = HIGHBD_WRAPLOW(step1[2] - step1[5], bd);
step2[6] = HIGHBD_WRAPLOW(step1[1] - step1[6], bd);
step2[7] = HIGHBD_WRAPLOW(step1[0] - step1[7], bd);
step2[8] = step1[8];
step2[9] = step1[9];
temp1 = (-step1[10] + step1[13]) * cospi_16_64;
temp2 = (step1[10] + step1[13]) * cospi_16_64;
step2[10] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step2[13] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = (-step1[11] + step1[12]) * cospi_16_64;
temp2 = (step1[11] + step1[12]) * cospi_16_64;
step2[11] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step2[12] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
step2[14] = step1[14];
step2[15] = step1[15];
step2[16] = HIGHBD_WRAPLOW(step1[16] + step1[23], bd);
step2[17] = HIGHBD_WRAPLOW(step1[17] + step1[22], bd);
step2[18] = HIGHBD_WRAPLOW(step1[18] + step1[21], bd);
step2[19] = HIGHBD_WRAPLOW(step1[19] + step1[20], bd);
step2[20] = HIGHBD_WRAPLOW(step1[19] - step1[20], bd);
step2[21] = HIGHBD_WRAPLOW(step1[18] - step1[21], bd);
step2[22] = HIGHBD_WRAPLOW(step1[17] - step1[22], bd);
step2[23] = HIGHBD_WRAPLOW(step1[16] - step1[23], bd);
step2[24] = HIGHBD_WRAPLOW(-step1[24] + step1[31], bd);
step2[25] = HIGHBD_WRAPLOW(-step1[25] + step1[30], bd);
step2[26] = HIGHBD_WRAPLOW(-step1[26] + step1[29], bd);
step2[27] = HIGHBD_WRAPLOW(-step1[27] + step1[28], bd);
step2[28] = HIGHBD_WRAPLOW(step1[27] + step1[28], bd);
step2[29] = HIGHBD_WRAPLOW(step1[26] + step1[29], bd);
step2[30] = HIGHBD_WRAPLOW(step1[25] + step1[30], bd);
step2[31] = HIGHBD_WRAPLOW(step1[24] + step1[31], bd);
// stage 7
step1[0] = HIGHBD_WRAPLOW(step2[0] + step2[15], bd);
step1[1] = HIGHBD_WRAPLOW(step2[1] + step2[14], bd);
step1[2] = HIGHBD_WRAPLOW(step2[2] + step2[13], bd);
step1[3] = HIGHBD_WRAPLOW(step2[3] + step2[12], bd);
step1[4] = HIGHBD_WRAPLOW(step2[4] + step2[11], bd);
step1[5] = HIGHBD_WRAPLOW(step2[5] + step2[10], bd);
step1[6] = HIGHBD_WRAPLOW(step2[6] + step2[9], bd);
step1[7] = HIGHBD_WRAPLOW(step2[7] + step2[8], bd);
step1[8] = HIGHBD_WRAPLOW(step2[7] - step2[8], bd);
step1[9] = HIGHBD_WRAPLOW(step2[6] - step2[9], bd);
step1[10] = HIGHBD_WRAPLOW(step2[5] - step2[10], bd);
step1[11] = HIGHBD_WRAPLOW(step2[4] - step2[11], bd);
step1[12] = HIGHBD_WRAPLOW(step2[3] - step2[12], bd);
step1[13] = HIGHBD_WRAPLOW(step2[2] - step2[13], bd);
step1[14] = HIGHBD_WRAPLOW(step2[1] - step2[14], bd);
step1[15] = HIGHBD_WRAPLOW(step2[0] - step2[15], bd);
step1[16] = step2[16];
step1[17] = step2[17];
step1[18] = step2[18];
step1[19] = step2[19];
temp1 = (-step2[20] + step2[27]) * cospi_16_64;
temp2 = (step2[20] + step2[27]) * cospi_16_64;
step1[20] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[27] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = (-step2[21] + step2[26]) * cospi_16_64;
temp2 = (step2[21] + step2[26]) * cospi_16_64;
step1[21] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[26] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = (-step2[22] + step2[25]) * cospi_16_64;
temp2 = (step2[22] + step2[25]) * cospi_16_64;
step1[22] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[25] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
temp1 = (-step2[23] + step2[24]) * cospi_16_64;
temp2 = (step2[23] + step2[24]) * cospi_16_64;
step1[23] = HIGHBD_WRAPLOW(dct_const_round_shift(temp1), bd);
step1[24] = HIGHBD_WRAPLOW(dct_const_round_shift(temp2), bd);
step1[28] = step2[28];
step1[29] = step2[29];
step1[30] = step2[30];
step1[31] = step2[31];
// final stage
output[0] = HIGHBD_WRAPLOW(step1[0] + step1[31], bd);
output[1] = HIGHBD_WRAPLOW(step1[1] + step1[30], bd);
output[2] = HIGHBD_WRAPLOW(step1[2] + step1[29], bd);
output[3] = HIGHBD_WRAPLOW(step1[3] + step1[28], bd);
output[4] = HIGHBD_WRAPLOW(step1[4] + step1[27], bd);
output[5] = HIGHBD_WRAPLOW(step1[5] + step1[26], bd);
output[6] = HIGHBD_WRAPLOW(step1[6] + step1[25], bd);
output[7] = HIGHBD_WRAPLOW(step1[7] + step1[24], bd);
output[8] = HIGHBD_WRAPLOW(step1[8] + step1[23], bd);
output[9] = HIGHBD_WRAPLOW(step1[9] + step1[22], bd);
output[10] = HIGHBD_WRAPLOW(step1[10] + step1[21], bd);
output[11] = HIGHBD_WRAPLOW(step1[11] + step1[20], bd);
output[12] = HIGHBD_WRAPLOW(step1[12] + step1[19], bd);
output[13] = HIGHBD_WRAPLOW(step1[13] + step1[18], bd);
output[14] = HIGHBD_WRAPLOW(step1[14] + step1[17], bd);
output[15] = HIGHBD_WRAPLOW(step1[15] + step1[16], bd);
output[16] = HIGHBD_WRAPLOW(step1[15] - step1[16], bd);
output[17] = HIGHBD_WRAPLOW(step1[14] - step1[17], bd);
output[18] = HIGHBD_WRAPLOW(step1[13] - step1[18], bd);
output[19] = HIGHBD_WRAPLOW(step1[12] - step1[19], bd);
output[20] = HIGHBD_WRAPLOW(step1[11] - step1[20], bd);
output[21] = HIGHBD_WRAPLOW(step1[10] - step1[21], bd);
output[22] = HIGHBD_WRAPLOW(step1[9] - step1[22], bd);
output[23] = HIGHBD_WRAPLOW(step1[8] - step1[23], bd);
output[24] = HIGHBD_WRAPLOW(step1[7] - step1[24], bd);
output[25] = HIGHBD_WRAPLOW(step1[6] - step1[25], bd);
output[26] = HIGHBD_WRAPLOW(step1[5] - step1[26], bd);
output[27] = HIGHBD_WRAPLOW(step1[4] - step1[27], bd);
output[28] = HIGHBD_WRAPLOW(step1[3] - step1[28], bd);
output[29] = HIGHBD_WRAPLOW(step1[2] - step1[29], bd);
output[30] = HIGHBD_WRAPLOW(step1[1] - step1[30], bd);
output[31] = HIGHBD_WRAPLOW(step1[0] - step1[31], bd);
}
#endif // CONFIG_HIGHBITDEPTH

View file

@ -149,10 +149,15 @@ void aom_lpf_horizontal_4_c(uint8_t *s, int p /* pitch */,
const uint8_t *blimit, const uint8_t *limit,
const uint8_t *thresh) {
int i;
#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
int count = 4;
#else
int count = 8;
#endif
// loop filter designed to work using chars so that we can make maximum use
// of 8 bit simd instructions.
for (i = 0; i < 8; ++i) {
for (i = 0; i < count; ++i) {
#if !CONFIG_PARALLEL_DEBLOCKING
const uint8_t p3 = s[-4 * p], p2 = s[-3 * p], p1 = s[-2 * p], p0 = s[-p];
const uint8_t q0 = s[0 * p], q1 = s[1 * p], q2 = s[2 * p], q3 = s[3 * p];
@ -179,10 +184,15 @@ void aom_lpf_horizontal_4_dual_c(uint8_t *s, int p, const uint8_t *blimit0,
void aom_lpf_vertical_4_c(uint8_t *s, int pitch, const uint8_t *blimit,
const uint8_t *limit, const uint8_t *thresh) {
int i;
#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
int count = 4;
#else
int count = 8;
#endif
// loop filter designed to work using chars so that we can make maximum use
// of 8 bit simd instructions.
for (i = 0; i < 8; ++i) {
for (i = 0; i < count; ++i) {
#if !CONFIG_PARALLEL_DEBLOCKING
const uint8_t p3 = s[-4], p2 = s[-3], p1 = s[-2], p0 = s[-1];
const uint8_t q0 = s[0], q1 = s[1], q2 = s[2], q3 = s[3];
@ -206,7 +216,7 @@ void aom_lpf_vertical_4_dual_c(uint8_t *s, int pitch, const uint8_t *blimit0,
aom_lpf_vertical_4_c(s + 8 * pitch, pitch, blimit1, limit1, thresh1);
}
static INLINE void filter8(int8_t mask, uint8_t thresh, uint8_t flat,
static INLINE void filter8(int8_t mask, uint8_t thresh, int8_t flat,
uint8_t *op3, uint8_t *op2, uint8_t *op1,
uint8_t *op0, uint8_t *oq0, uint8_t *oq1,
uint8_t *oq2, uint8_t *oq3) {
@ -229,10 +239,15 @@ static INLINE void filter8(int8_t mask, uint8_t thresh, uint8_t flat,
void aom_lpf_horizontal_8_c(uint8_t *s, int p, const uint8_t *blimit,
const uint8_t *limit, const uint8_t *thresh) {
int i;
#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
int count = 4;
#else
int count = 8;
#endif
// loop filter designed to work using chars so that we can make maximum use
// of 8 bit simd instructions.
for (i = 0; i < 8; ++i) {
for (i = 0; i < count; ++i) {
const uint8_t p3 = s[-4 * p], p2 = s[-3 * p], p1 = s[-2 * p], p0 = s[-p];
const uint8_t q0 = s[0 * p], q1 = s[1 * p], q2 = s[2 * p], q3 = s[3 * p];
@ -256,8 +271,13 @@ void aom_lpf_horizontal_8_dual_c(uint8_t *s, int p, const uint8_t *blimit0,
void aom_lpf_vertical_8_c(uint8_t *s, int pitch, const uint8_t *blimit,
const uint8_t *limit, const uint8_t *thresh) {
int i;
#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
int count = 4;
#else
int count = 8;
#endif
for (i = 0; i < 8; ++i) {
for (i = 0; i < count; ++i) {
const uint8_t p3 = s[-4], p2 = s[-3], p1 = s[-2], p0 = s[-1];
const uint8_t q0 = s[0], q1 = s[1], q2 = s[2], q3 = s[3];
const int8_t mask =
@ -278,8 +298,8 @@ void aom_lpf_vertical_8_dual_c(uint8_t *s, int pitch, const uint8_t *blimit0,
}
#if PARALLEL_DEBLOCKING_11_TAP
static INLINE void filter12(int8_t mask, uint8_t thresh, uint8_t flat,
uint8_t flat2, uint8_t *op5, uint8_t *op4,
static INLINE void filter12(int8_t mask, uint8_t thresh, int8_t flat,
int8_t flat2, uint8_t *op5, uint8_t *op4,
uint8_t *op3, uint8_t *op2, uint8_t *op1,
uint8_t *op0, uint8_t *oq0, uint8_t *oq1,
uint8_t *oq2, uint8_t *oq3, uint8_t *oq4,
@ -308,8 +328,8 @@ static INLINE void filter12(int8_t mask, uint8_t thresh, uint8_t flat,
#endif
#if PARALLEL_DEBLOCKING_9_TAP
static INLINE void filter10(int8_t mask, uint8_t thresh, uint8_t flat,
uint8_t flat2, uint8_t *op4, uint8_t *op3,
static INLINE void filter10(int8_t mask, uint8_t thresh, int8_t flat,
int8_t flat2, uint8_t *op4, uint8_t *op3,
uint8_t *op2, uint8_t *op1, uint8_t *op0,
uint8_t *oq0, uint8_t *oq1, uint8_t *oq2,
uint8_t *oq3, uint8_t *oq4) {
@ -332,8 +352,8 @@ static INLINE void filter10(int8_t mask, uint8_t thresh, uint8_t flat,
}
#endif
static INLINE void filter16(int8_t mask, uint8_t thresh, uint8_t flat,
uint8_t flat2, uint8_t *op7, uint8_t *op6,
static INLINE void filter16(int8_t mask, uint8_t thresh, int8_t flat,
int8_t flat2, uint8_t *op7, uint8_t *op6,
uint8_t *op5, uint8_t *op4, uint8_t *op3,
uint8_t *op2, uint8_t *op1, uint8_t *op0,
uint8_t *oq0, uint8_t *oq1, uint8_t *oq2,
@ -390,10 +410,15 @@ static void mb_lpf_horizontal_edge_w(uint8_t *s, int p, const uint8_t *blimit,
const uint8_t *limit,
const uint8_t *thresh, int count) {
int i;
#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
int step = 4;
#else
int step = 8;
#endif
// loop filter designed to work using chars so that we can make maximum use
// of 8 bit simd instructions.
for (i = 0; i < 8 * count; ++i) {
for (i = 0; i < step * count; ++i) {
const uint8_t p7 = s[-8 * p], p6 = s[-7 * p], p5 = s[-6 * p],
p4 = s[-5 * p], p3 = s[-4 * p], p2 = s[-3 * p],
p1 = s[-2 * p], p0 = s[-p];
@ -436,7 +461,11 @@ void aom_lpf_horizontal_edge_8_c(uint8_t *s, int p, const uint8_t *blimit,
void aom_lpf_horizontal_edge_16_c(uint8_t *s, int p, const uint8_t *blimit,
const uint8_t *limit, const uint8_t *thresh) {
#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
mb_lpf_horizontal_edge_w(s, p, blimit, limit, thresh, 1);
#else
mb_lpf_horizontal_edge_w(s, p, blimit, limit, thresh, 2);
#endif
}
static void mb_lpf_vertical_edge_w(uint8_t *s, int p, const uint8_t *blimit,
@ -478,7 +507,11 @@ static void mb_lpf_vertical_edge_w(uint8_t *s, int p, const uint8_t *blimit,
void aom_lpf_vertical_16_c(uint8_t *s, int p, const uint8_t *blimit,
const uint8_t *limit, const uint8_t *thresh) {
#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
mb_lpf_vertical_edge_w(s, p, blimit, limit, thresh, 4);
#else
mb_lpf_vertical_edge_w(s, p, blimit, limit, thresh, 8);
#endif
}
void aom_lpf_vertical_16_dual_c(uint8_t *s, int p, const uint8_t *blimit,
@ -596,10 +629,15 @@ void aom_highbd_lpf_horizontal_4_c(uint16_t *s, int p /* pitch */,
const uint8_t *blimit, const uint8_t *limit,
const uint8_t *thresh, int bd) {
int i;
#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
int count = 4;
#else
int count = 8;
#endif
// loop filter designed to work using chars so that we can make maximum use
// of 8 bit simd instructions.
for (i = 0; i < 8; ++i) {
for (i = 0; i < count; ++i) {
#if !CONFIG_PARALLEL_DEBLOCKING
const uint16_t p3 = s[-4 * p];
const uint16_t p2 = s[-3 * p];
@ -636,10 +674,15 @@ void aom_highbd_lpf_vertical_4_c(uint16_t *s, int pitch, const uint8_t *blimit,
const uint8_t *limit, const uint8_t *thresh,
int bd) {
int i;
#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
int count = 4;
#else
int count = 8;
#endif
// loop filter designed to work using chars so that we can make maximum use
// of 8 bit simd instructions.
for (i = 0; i < 8; ++i) {
for (i = 0; i < count; ++i) {
#if !CONFIG_PARALLEL_DEBLOCKING
const uint16_t p3 = s[-4], p2 = s[-3], p1 = s[-2], p0 = s[-1];
const uint16_t q0 = s[0], q1 = s[1], q2 = s[2], q3 = s[3];
@ -665,7 +708,7 @@ void aom_highbd_lpf_vertical_4_dual_c(
bd);
}
static INLINE void highbd_filter8(int8_t mask, uint8_t thresh, uint8_t flat,
static INLINE void highbd_filter8(int8_t mask, uint8_t thresh, int8_t flat,
uint16_t *op3, uint16_t *op2, uint16_t *op1,
uint16_t *op0, uint16_t *oq0, uint16_t *oq1,
uint16_t *oq2, uint16_t *oq3, int bd) {
@ -689,10 +732,15 @@ void aom_highbd_lpf_horizontal_8_c(uint16_t *s, int p, const uint8_t *blimit,
const uint8_t *limit, const uint8_t *thresh,
int bd) {
int i;
#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
int count = 4;
#else
int count = 8;
#endif
// loop filter designed to work using chars so that we can make maximum use
// of 8 bit simd instructions.
for (i = 0; i < 8; ++i) {
for (i = 0; i < count; ++i) {
const uint16_t p3 = s[-4 * p], p2 = s[-3 * p], p1 = s[-2 * p], p0 = s[-p];
const uint16_t q0 = s[0 * p], q1 = s[1 * p], q2 = s[2 * p], q3 = s[3 * p];
@ -718,8 +766,13 @@ void aom_highbd_lpf_vertical_8_c(uint16_t *s, int pitch, const uint8_t *blimit,
const uint8_t *limit, const uint8_t *thresh,
int bd) {
int i;
#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
int count = 4;
#else
int count = 8;
#endif
for (i = 0; i < 8; ++i) {
for (i = 0; i < count; ++i) {
const uint16_t p3 = s[-4], p2 = s[-3], p1 = s[-2], p0 = s[-1];
const uint16_t q0 = s[0], q1 = s[1], q2 = s[2], q3 = s[3];
const int8_t mask =
@ -741,8 +794,8 @@ void aom_highbd_lpf_vertical_8_dual_c(
bd);
}
static INLINE void highbd_filter16(int8_t mask, uint8_t thresh, uint8_t flat,
uint8_t flat2, uint16_t *op7, uint16_t *op6,
static INLINE void highbd_filter16(int8_t mask, uint8_t thresh, int8_t flat,
int8_t flat2, uint16_t *op7, uint16_t *op6,
uint16_t *op5, uint16_t *op4, uint16_t *op3,
uint16_t *op2, uint16_t *op1, uint16_t *op0,
uint16_t *oq0, uint16_t *oq1, uint16_t *oq2,
@ -813,10 +866,15 @@ static void highbd_mb_lpf_horizontal_edge_w(uint16_t *s, int p,
const uint8_t *thresh, int count,
int bd) {
int i;
#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
int step = 4;
#else
int step = 8;
#endif
// loop filter designed to work using chars so that we can make maximum use
// of 8 bit simd instructions.
for (i = 0; i < 8 * count; ++i) {
for (i = 0; i < step * count; ++i) {
const uint16_t p3 = s[-4 * p];
const uint16_t p2 = s[-3 * p];
const uint16_t p1 = s[-2 * p];
@ -852,7 +910,11 @@ void aom_highbd_lpf_horizontal_edge_16_c(uint16_t *s, int p,
const uint8_t *blimit,
const uint8_t *limit,
const uint8_t *thresh, int bd) {
#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
highbd_mb_lpf_horizontal_edge_w(s, p, blimit, limit, thresh, 1, bd);
#else
highbd_mb_lpf_horizontal_edge_w(s, p, blimit, limit, thresh, 2, bd);
#endif
}
static void highbd_mb_lpf_vertical_edge_w(uint16_t *s, int p,
@ -888,13 +950,21 @@ static void highbd_mb_lpf_vertical_edge_w(uint16_t *s, int p,
void aom_highbd_lpf_vertical_16_c(uint16_t *s, int p, const uint8_t *blimit,
const uint8_t *limit, const uint8_t *thresh,
int bd) {
#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
highbd_mb_lpf_vertical_edge_w(s, p, blimit, limit, thresh, 4, bd);
#else
highbd_mb_lpf_vertical_edge_w(s, p, blimit, limit, thresh, 8, bd);
#endif
}
void aom_highbd_lpf_vertical_16_dual_c(uint16_t *s, int p,
const uint8_t *blimit,
const uint8_t *limit,
const uint8_t *thresh, int bd) {
#if CONFIG_PARALLEL_DEBLOCKING && CONFIG_CB4X4
highbd_mb_lpf_vertical_edge_w(s, p, blimit, limit, thresh, 8, bd);
#else
highbd_mb_lpf_vertical_edge_w(s, p, blimit, limit, thresh, 16, bd);
#endif
}
#endif // CONFIG_HIGHBITDEPTH

View file

@ -1,57 +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 "./aom_dsp_rtcd.h"
#include "aom_dsp/mips/macros_msa.h"
uint32_t aom_avg_8x8_msa(const uint8_t *src, int32_t src_stride) {
uint32_t sum_out;
v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
v8u16 sum0, sum1, sum2, sum3, sum4, sum5, sum6, sum7;
v4u32 sum = { 0 };
LD_UB8(src, src_stride, src0, src1, src2, src3, src4, src5, src6, src7);
HADD_UB4_UH(src0, src1, src2, src3, sum0, sum1, sum2, sum3);
HADD_UB4_UH(src4, src5, src6, src7, sum4, sum5, sum6, sum7);
ADD4(sum0, sum1, sum2, sum3, sum4, sum5, sum6, sum7, sum0, sum2, sum4, sum6);
ADD2(sum0, sum2, sum4, sum6, sum0, sum4);
sum0 += sum4;
sum = __msa_hadd_u_w(sum0, sum0);
sum0 = (v8u16)__msa_pckev_h((v8i16)sum, (v8i16)sum);
sum = __msa_hadd_u_w(sum0, sum0);
sum = (v4u32)__msa_srari_w((v4i32)sum, 6);
sum_out = __msa_copy_u_w((v4i32)sum, 0);
return sum_out;
}
uint32_t aom_avg_4x4_msa(const uint8_t *src, int32_t src_stride) {
uint32_t sum_out;
uint32_t src0, src1, src2, src3;
v16u8 vec = { 0 };
v8u16 sum0;
v4u32 sum1;
v2u64 sum2;
LW4(src, src_stride, src0, src1, src2, src3);
INSERT_W4_UB(src0, src1, src2, src3, vec);
sum0 = __msa_hadd_u_h(vec, vec);
sum1 = __msa_hadd_u_w(sum0, sum0);
sum0 = (v8u16)__msa_pckev_h((v8i16)sum1, (v8i16)sum1);
sum1 = __msa_hadd_u_w(sum0, sum0);
sum2 = __msa_hadd_u_d(sum1, sum1);
sum1 = (v4u32)__msa_srari_w((v4i32)sum2, 4);
sum_out = __msa_copy_u_w((v4i32)sum1, 0);
return sum_out;
}

View file

@ -11,25 +11,10 @@
#include "./aom_config.h"
#if CONFIG_EC_MULTISYMBOL
#include <string.h>
#endif
#include "aom_dsp/prob.h"
const uint8_t aom_norm[256] = {
0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
static unsigned int tree_merge_probs_impl(unsigned int i,
const aom_tree_index *tree,
const aom_prob *pre_probs,
@ -53,7 +38,6 @@ void aom_tree_merge_probs(const aom_tree_index *tree, const aom_prob *pre_probs,
tree_merge_probs_impl(0, tree, pre_probs, counts, probs);
}
#if CONFIG_EC_MULTISYMBOL
typedef struct tree_node tree_node;
struct tree_node {
@ -233,4 +217,3 @@ void av1_indices_from_tree(int *ind, int *inv, const aom_tree_index *tree) {
int stack_index = 0;
tree_to_index(&stack_index, ind, inv, tree, 0, 0);
}
#endif

View file

@ -20,7 +20,7 @@
#include "aom_ports/bitops.h"
#include "aom_ports/mem.h"
#if CONFIG_DAALA_EC
#if !CONFIG_ANS
#include "aom_dsp/entcode.h"
#endif
@ -33,14 +33,12 @@ typedef uint8_t aom_prob;
// TODO(negge): Rename this aom_prob once we remove vpxbool.
typedef uint16_t aom_cdf_prob;
#if CONFIG_EC_MULTISYMBOL
#define CDF_SIZE(x) ((x) + 1)
#endif
#define CDF_PROB_BITS 15
#define CDF_PROB_TOP (1 << CDF_PROB_BITS)
#if CONFIG_DAALA_EC
#if !CONFIG_ANS
#define AOM_ICDF OD_ICDF
#else
#define AOM_ICDF(x) (x)
@ -117,7 +115,6 @@ static INLINE aom_prob mode_mv_merge_probs(aom_prob pre_prob,
void aom_tree_merge_probs(const aom_tree_index *tree, const aom_prob *pre_probs,
const unsigned int *counts, aom_prob *probs);
#if CONFIG_EC_MULTISYMBOL
int tree_to_cdf(const aom_tree_index *tree, const aom_prob *probs,
aom_tree_index root, aom_cdf_prob *cdf, aom_tree_index *ind,
int *pth, int *len);
@ -150,9 +147,6 @@ static INLINE void av1_tree_to_cdf(const aom_tree_index *tree,
} while (0)
void av1_indices_from_tree(int *ind, int *inv, const aom_tree_index *tree);
#endif
DECLARE_ALIGNED(16, extern const uint8_t, aom_norm[256]);
#if CONFIG_EC_ADAPT
static INLINE void update_cdf(aom_cdf_prob *cdf, int val, int nsymbs) {
@ -165,7 +159,7 @@ static INLINE void update_cdf(aom_cdf_prob *cdf, int val, int nsymbs) {
tmp = AOM_ICDF(tmp0);
diff = ((CDF_PROB_TOP - (nsymbs << rate2)) >> rate) << rate;
// Single loop (faster)
#if CONFIG_DAALA_EC && CONFIG_EC_SMALLMUL
#if !CONFIG_ANS && CONFIG_EC_SMALLMUL
for (i = 0; i < nsymbs - 1; ++i, tmp -= tmp0) {
tmp -= (i == val ? diff : 0);
cdf[i] += ((tmp - cdf[i]) >> rate);

View file

@ -16,6 +16,7 @@
#include "aom/aom_integer.h"
#include "aom_ports/mem.h"
#include "aom_dsp/blend.h"
/* Sum the difference between every corresponding element of the buffers. */
static INLINE unsigned int sad(const uint8_t *a, int a_stride, const uint8_t *b,
@ -311,15 +312,20 @@ highbd_sadMxNx4D(4, 4)
#if CONFIG_AV1 && CONFIG_EXT_INTER
static INLINE
unsigned int masked_sad(const uint8_t *a, int a_stride, const uint8_t *b,
unsigned int masked_sad(const uint8_t *src, int src_stride,
const uint8_t *a, int a_stride, const uint8_t *b,
int b_stride, const uint8_t *m, int m_stride,
int width, int height) {
int y, x;
unsigned int sad = 0;
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) sad += m[x] * abs(a[x] - b[x]);
for (x = 0; x < width; x++) {
const uint8_t pred = AOM_BLEND_A64(m[x], a[x], b[x]);
sad += abs(pred - src[x]);
}
src += src_stride;
a += a_stride;
b += b_stride;
m += m_stride;
@ -329,12 +335,17 @@ highbd_sadMxNx4D(4, 4)
return sad;
}
#define MASKSADMxN(m, n) \
unsigned int aom_masked_sad##m##x##n##_c( \
const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride, \
const uint8_t *msk, int msk_stride) { \
return masked_sad(src, src_stride, ref, ref_stride, msk, msk_stride, m, \
n); \
#define MASKSADMxN(m, n) \
unsigned int aom_masked_sad##m##x##n##_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) { \
if (!invert_mask) \
return masked_sad(src, src_stride, ref, ref_stride, second_pred, m, msk, \
msk_stride, m, n); \
else \
return masked_sad(src, src_stride, second_pred, m, ref, ref_stride, msk, \
msk_stride, m, n); \
}
/* clang-format off */
@ -360,18 +371,24 @@ MASKSADMxN(4, 4)
#if CONFIG_HIGHBITDEPTH
static INLINE
unsigned int highbd_masked_sad(const uint8_t *a8, int a_stride,
unsigned int highbd_masked_sad(const uint8_t *src8, int src_stride,
const uint8_t *a8, int a_stride,
const uint8_t *b8, int b_stride,
const uint8_t *m, int m_stride, int width,
int height) {
int y, x;
unsigned int sad = 0;
const uint16_t *src = CONVERT_TO_SHORTPTR(src8);
const uint16_t *a = CONVERT_TO_SHORTPTR(a8);
const uint16_t *b = CONVERT_TO_SHORTPTR(b8);
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) sad += m[x] * abs(a[x] - b[x]);
for (x = 0; x < width; x++) {
const uint16_t pred = AOM_BLEND_A64(m[x], a[x], b[x]);
sad += abs(pred - src[x]);
}
src += src_stride;
a += a_stride;
b += b_stride;
m += m_stride;
@ -381,12 +398,17 @@ MASKSADMxN(4, 4)
return sad;
}
#define HIGHBD_MASKSADMXN(m, n) \
unsigned int aom_highbd_masked_sad##m##x##n##_c( \
const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride, \
const uint8_t *msk, int msk_stride) { \
return highbd_masked_sad(src, src_stride, ref, ref_stride, msk, \
msk_stride, m, n); \
#define HIGHBD_MASKSADMXN(m, n) \
unsigned int aom_highbd_masked_sad##m##x##n##_c( \
const uint8_t *src8, int src_stride, const uint8_t *ref8, \
int ref_stride, const uint8_t *second_pred8, const uint8_t *msk, \
int msk_stride, int invert_mask) { \
if (!invert_mask) \
return highbd_masked_sad(src8, src_stride, ref8, ref_stride, \
second_pred8, m, msk, msk_stride, m, n); \
else \
return highbd_masked_sad(src8, src_stride, second_pred8, m, ref8, \
ref_stride, msk, msk_stride, m, n); \
}
#if CONFIG_EXT_PARTITION

View file

@ -60,7 +60,9 @@ SIMD_INLINE void v64_store_aligned(void *p, v64 a) {
c_v64_store_aligned(p, a);
}
SIMD_INLINE v64 v64_align(v64 a, v64 b, c) { return c_v64_align(a, b, c); }
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_dup_8(uint8_t x) { return c_v64_dup_8(x); }

View file

@ -18,6 +18,7 @@
#include "aom_dsp/variance.h"
#include "aom_dsp/aom_filter.h"
#include "aom_dsp/blend.h"
uint32_t aom_get4x4sse_cs_c(const uint8_t *a, int a_stride, const uint8_t *b,
int b_stride) {
@ -672,297 +673,215 @@ void aom_highbd_comp_avg_upsampled_pred_c(uint16_t *comp_pred,
#endif // CONFIG_HIGHBITDEPTH
#if CONFIG_AV1 && CONFIG_EXT_INTER
void masked_variance(const uint8_t *a, int a_stride, const uint8_t *b,
int b_stride, const uint8_t *m, int m_stride, int w, int h,
unsigned int *sse, int *sum) {
void aom_comp_mask_pred_c(uint8_t *comp_pred, const uint8_t *pred, int width,
int height, const uint8_t *ref, int ref_stride,
const uint8_t *mask, int mask_stride,
int invert_mask) {
int i, j;
int64_t sum64 = 0;
uint64_t sse64 = 0;
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
const int diff = (a[j] - b[j]) * (m[j]);
sum64 += diff;
sse64 += diff * diff;
for (i = 0; i < height; ++i) {
for (j = 0; j < width; ++j) {
if (!invert_mask)
comp_pred[j] = AOM_BLEND_A64(mask[j], ref[j], pred[j]);
else
comp_pred[j] = AOM_BLEND_A64(mask[j], pred[j], ref[j]);
}
a += a_stride;
b += b_stride;
m += m_stride;
comp_pred += width;
pred += width;
ref += ref_stride;
mask += mask_stride;
}
sum64 = (sum64 >= 0) ? sum64 : -sum64;
*sum = (int)ROUND_POWER_OF_TWO(sum64, 6);
*sse = (uint32_t)ROUND_POWER_OF_TWO(sse64, 12);
}
#define MASK_VAR(W, H) \
unsigned int aom_masked_variance##W##x##H##_c( \
const uint8_t *a, int a_stride, const uint8_t *b, int b_stride, \
const uint8_t *m, int m_stride, unsigned int *sse) { \
int sum; \
masked_variance(a, a_stride, b, b_stride, m, m_stride, W, H, sse, &sum); \
return *sse - (unsigned int)(((int64_t)sum * sum) / (W * H)); \
void aom_comp_mask_upsampled_pred_c(uint8_t *comp_pred, const uint8_t *pred,
int width, int height, const uint8_t *ref,
int ref_stride, const uint8_t *mask,
int mask_stride, int invert_mask) {
int i, j;
int stride = ref_stride << 3;
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
if (!invert_mask)
comp_pred[j] = AOM_BLEND_A64(mask[j], ref[(j << 3)], pred[j]);
else
comp_pred[j] = AOM_BLEND_A64(mask[j], pred[j], ref[(j << 3)]);
}
comp_pred += width;
pred += width;
ref += stride;
mask += mask_stride;
}
}
#define MASK_SUBPIX_VAR(W, H) \
unsigned int aom_masked_sub_pixel_variance##W##x##H##_c( \
const uint8_t *src, int src_stride, int xoffset, int yoffset, \
const uint8_t *dst, int dst_stride, const uint8_t *msk, int msk_stride, \
const uint8_t *ref, int ref_stride, const uint8_t *second_pred, \
const uint8_t *msk, int msk_stride, int invert_mask, \
unsigned int *sse) { \
uint16_t fdata3[(H + 1) * W]; \
uint8_t temp2[H * W]; \
DECLARE_ALIGNED(16, uint8_t, temp3[H * W]); \
\
var_filter_block2d_bil_first_pass(src, fdata3, src_stride, 1, H + 1, W, \
bilinear_filters_2t[xoffset]); \
var_filter_block2d_bil_second_pass(fdata3, temp2, W, W, H, W, \
bilinear_filters_2t[yoffset]); \
\
return aom_masked_variance##W##x##H##_c(temp2, W, dst, dst_stride, msk, \
msk_stride, sse); \
aom_comp_mask_pred_c(temp3, second_pred, W, H, temp2, W, msk, msk_stride, \
invert_mask); \
return aom_variance##W##x##H##_c(temp3, W, ref, ref_stride, sse); \
}
MASK_VAR(4, 4)
MASK_SUBPIX_VAR(4, 4)
MASK_VAR(4, 8)
MASK_SUBPIX_VAR(4, 8)
MASK_VAR(8, 4)
MASK_SUBPIX_VAR(8, 4)
MASK_VAR(8, 8)
MASK_SUBPIX_VAR(8, 8)
MASK_VAR(8, 16)
MASK_SUBPIX_VAR(8, 16)
MASK_VAR(16, 8)
MASK_SUBPIX_VAR(16, 8)
MASK_VAR(16, 16)
MASK_SUBPIX_VAR(16, 16)
MASK_VAR(16, 32)
MASK_SUBPIX_VAR(16, 32)
MASK_VAR(32, 16)
MASK_SUBPIX_VAR(32, 16)
MASK_VAR(32, 32)
MASK_SUBPIX_VAR(32, 32)
MASK_VAR(32, 64)
MASK_SUBPIX_VAR(32, 64)
MASK_VAR(64, 32)
MASK_SUBPIX_VAR(64, 32)
MASK_VAR(64, 64)
MASK_SUBPIX_VAR(64, 64)
#if CONFIG_EXT_PARTITION
MASK_VAR(64, 128)
MASK_SUBPIX_VAR(64, 128)
MASK_VAR(128, 64)
MASK_SUBPIX_VAR(128, 64)
MASK_VAR(128, 128)
MASK_SUBPIX_VAR(128, 128)
#endif // CONFIG_EXT_PARTITION
#if CONFIG_HIGHBITDEPTH
void highbd_masked_variance64(const uint8_t *a8, int a_stride,
const uint8_t *b8, int b_stride, const uint8_t *m,
int m_stride, int w, int h, uint64_t *sse,
int64_t *sum) {
void aom_highbd_comp_mask_pred_c(uint16_t *comp_pred, const uint8_t *pred8,
int width, int height, const uint8_t *ref8,
int ref_stride, const uint8_t *mask,
int mask_stride, int invert_mask) {
int i, j;
uint16_t *a = CONVERT_TO_SHORTPTR(a8);
uint16_t *b = CONVERT_TO_SHORTPTR(b8);
*sum = 0;
*sse = 0;
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
const int diff = (a[j] - b[j]) * (m[j]);
*sum += (int64_t)diff;
*sse += (int64_t)diff * diff;
uint16_t *pred = CONVERT_TO_SHORTPTR(pred8);
uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
for (i = 0; i < height; ++i) {
for (j = 0; j < width; ++j) {
if (!invert_mask)
comp_pred[j] = AOM_BLEND_A64(mask[j], ref[j], pred[j]);
else
comp_pred[j] = AOM_BLEND_A64(mask[j], pred[j], ref[j]);
}
a += a_stride;
b += b_stride;
m += m_stride;
comp_pred += width;
pred += width;
ref += ref_stride;
mask += mask_stride;
}
*sum = (*sum >= 0) ? *sum : -*sum;
*sum = ROUND_POWER_OF_TWO(*sum, 6);
*sse = ROUND_POWER_OF_TWO(*sse, 12);
}
void highbd_masked_variance(const uint8_t *a8, int a_stride, const uint8_t *b8,
int b_stride, const uint8_t *m, int m_stride, int w,
int h, unsigned int *sse, int *sum) {
int64_t sum64;
uint64_t sse64;
highbd_masked_variance64(a8, a_stride, b8, b_stride, m, m_stride, w, h,
&sse64, &sum64);
*sum = (int)sum64;
*sse = (unsigned int)sse64;
void aom_highbd_comp_mask_upsampled_pred_c(uint16_t *comp_pred,
const uint8_t *pred8, int width,
int height, const uint8_t *ref8,
int ref_stride, const uint8_t *mask,
int mask_stride, int invert_mask) {
int i, j;
int stride = ref_stride << 3;
uint16_t *pred = CONVERT_TO_SHORTPTR(pred8);
uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
for (i = 0; i < height; ++i) {
for (j = 0; j < width; ++j) {
if (!invert_mask)
comp_pred[j] = AOM_BLEND_A64(mask[j], ref[j << 3], pred[j]);
else
comp_pred[j] = AOM_BLEND_A64(mask[j], pred[j], ref[j << 3]);
}
comp_pred += width;
pred += width;
ref += stride;
mask += mask_stride;
}
}
void highbd_10_masked_variance(const uint8_t *a8, int a_stride,
const uint8_t *b8, int b_stride,
const uint8_t *m, int m_stride, int w, int h,
unsigned int *sse, int *sum) {
int64_t sum64;
uint64_t sse64;
highbd_masked_variance64(a8, a_stride, b8, b_stride, m, m_stride, w, h,
&sse64, &sum64);
*sum = (int)ROUND_POWER_OF_TWO(sum64, 2);
*sse = (unsigned int)ROUND_POWER_OF_TWO(sse64, 4);
}
void highbd_12_masked_variance(const uint8_t *a8, int a_stride,
const uint8_t *b8, int b_stride,
const uint8_t *m, int m_stride, int w, int h,
unsigned int *sse, int *sum) {
int64_t sum64;
uint64_t sse64;
highbd_masked_variance64(a8, a_stride, b8, b_stride, m, m_stride, w, h,
&sse64, &sum64);
*sum = (int)ROUND_POWER_OF_TWO(sum64, 4);
*sse = (unsigned int)ROUND_POWER_OF_TWO(sse64, 8);
}
#define HIGHBD_MASK_VAR(W, H) \
unsigned int aom_highbd_masked_variance##W##x##H##_c( \
const uint8_t *a, int a_stride, const uint8_t *b, int b_stride, \
const uint8_t *m, int m_stride, unsigned int *sse) { \
int sum; \
highbd_masked_variance(a, a_stride, b, b_stride, m, m_stride, W, H, sse, \
&sum); \
return *sse - (unsigned int)(((int64_t)sum * sum) / (W * H)); \
} \
\
unsigned int aom_highbd_10_masked_variance##W##x##H##_c( \
const uint8_t *a, int a_stride, const uint8_t *b, int b_stride, \
const uint8_t *m, int m_stride, unsigned int *sse) { \
int sum; \
int64_t var; \
highbd_10_masked_variance(a, a_stride, b, b_stride, m, m_stride, W, H, \
sse, &sum); \
var = (int64_t)(*sse) - (((int64_t)sum * sum) / (W * H)); \
return (var >= 0) ? (uint32_t)var : 0; \
} \
\
unsigned int aom_highbd_12_masked_variance##W##x##H##_c( \
const uint8_t *a, int a_stride, const uint8_t *b, int b_stride, \
const uint8_t *m, int m_stride, unsigned int *sse) { \
int sum; \
int64_t var; \
highbd_12_masked_variance(a, a_stride, b, b_stride, m, m_stride, W, H, \
sse, &sum); \
var = (int64_t)(*sse) - (((int64_t)sum * sum) / (W * H)); \
return (var >= 0) ? (uint32_t)var : 0; \
#define HIGHBD_MASK_SUBPIX_VAR(W, H) \
unsigned int aom_highbd_8_masked_sub_pixel_variance##W##x##H##_c( \
const uint8_t *src, int src_stride, int xoffset, int yoffset, \
const uint8_t *ref, int ref_stride, const uint8_t *second_pred, \
const uint8_t *msk, int msk_stride, int invert_mask, \
unsigned int *sse) { \
uint16_t fdata3[(H + 1) * W]; \
uint16_t temp2[H * W]; \
DECLARE_ALIGNED(16, uint16_t, temp3[H * W]); \
\
aom_highbd_var_filter_block2d_bil_first_pass( \
src, fdata3, src_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]); \
aom_highbd_var_filter_block2d_bil_second_pass( \
fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]); \
\
aom_highbd_comp_mask_pred_c(temp3, second_pred, W, H, \
CONVERT_TO_BYTEPTR(temp2), W, msk, msk_stride, \
invert_mask); \
\
return aom_highbd_8_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp3), W, \
ref, ref_stride, sse); \
} \
\
unsigned int aom_highbd_10_masked_sub_pixel_variance##W##x##H##_c( \
const uint8_t *src, int src_stride, int xoffset, int yoffset, \
const uint8_t *ref, int ref_stride, const uint8_t *second_pred, \
const uint8_t *msk, int msk_stride, int invert_mask, \
unsigned int *sse) { \
uint16_t fdata3[(H + 1) * W]; \
uint16_t temp2[H * W]; \
DECLARE_ALIGNED(16, uint16_t, temp3[H * W]); \
\
aom_highbd_var_filter_block2d_bil_first_pass( \
src, fdata3, src_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]); \
aom_highbd_var_filter_block2d_bil_second_pass( \
fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]); \
\
aom_highbd_comp_mask_pred_c(temp3, second_pred, W, H, \
CONVERT_TO_BYTEPTR(temp2), W, msk, msk_stride, \
invert_mask); \
\
return aom_highbd_10_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp3), W, \
ref, ref_stride, sse); \
} \
\
unsigned int aom_highbd_12_masked_sub_pixel_variance##W##x##H##_c( \
const uint8_t *src, int src_stride, int xoffset, int yoffset, \
const uint8_t *ref, int ref_stride, const uint8_t *second_pred, \
const uint8_t *msk, int msk_stride, int invert_mask, \
unsigned int *sse) { \
uint16_t fdata3[(H + 1) * W]; \
uint16_t temp2[H * W]; \
DECLARE_ALIGNED(16, uint16_t, temp3[H * W]); \
\
aom_highbd_var_filter_block2d_bil_first_pass( \
src, fdata3, src_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]); \
aom_highbd_var_filter_block2d_bil_second_pass( \
fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]); \
\
aom_highbd_comp_mask_pred_c(temp3, second_pred, W, H, \
CONVERT_TO_BYTEPTR(temp2), W, msk, msk_stride, \
invert_mask); \
\
return aom_highbd_12_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp3), W, \
ref, ref_stride, sse); \
}
#define HIGHBD_MASK_SUBPIX_VAR(W, H) \
unsigned int aom_highbd_masked_sub_pixel_variance##W##x##H##_c( \
const uint8_t *src, int src_stride, int xoffset, int yoffset, \
const uint8_t *dst, int dst_stride, const uint8_t *msk, int msk_stride, \
unsigned int *sse) { \
uint16_t fdata3[(H + 1) * W]; \
uint16_t temp2[H * W]; \
\
aom_highbd_var_filter_block2d_bil_first_pass( \
src, fdata3, src_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]); \
aom_highbd_var_filter_block2d_bil_second_pass( \
fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]); \
\
return aom_highbd_masked_variance##W##x##H##_c( \
CONVERT_TO_BYTEPTR(temp2), W, dst, dst_stride, msk, msk_stride, sse); \
} \
\
unsigned int aom_highbd_10_masked_sub_pixel_variance##W##x##H##_c( \
const uint8_t *src, int src_stride, int xoffset, int yoffset, \
const uint8_t *dst, int dst_stride, const uint8_t *msk, int msk_stride, \
unsigned int *sse) { \
uint16_t fdata3[(H + 1) * W]; \
uint16_t temp2[H * W]; \
\
aom_highbd_var_filter_block2d_bil_first_pass( \
src, fdata3, src_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]); \
aom_highbd_var_filter_block2d_bil_second_pass( \
fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]); \
\
return aom_highbd_10_masked_variance##W##x##H##_c( \
CONVERT_TO_BYTEPTR(temp2), W, dst, dst_stride, msk, msk_stride, sse); \
} \
\
unsigned int aom_highbd_12_masked_sub_pixel_variance##W##x##H##_c( \
const uint8_t *src, int src_stride, int xoffset, int yoffset, \
const uint8_t *dst, int dst_stride, const uint8_t *msk, int msk_stride, \
unsigned int *sse) { \
uint16_t fdata3[(H + 1) * W]; \
uint16_t temp2[H * W]; \
\
aom_highbd_var_filter_block2d_bil_first_pass( \
src, fdata3, src_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]); \
aom_highbd_var_filter_block2d_bil_second_pass( \
fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]); \
\
return aom_highbd_12_masked_variance##W##x##H##_c( \
CONVERT_TO_BYTEPTR(temp2), W, dst, dst_stride, msk, msk_stride, sse); \
}
HIGHBD_MASK_VAR(4, 4)
HIGHBD_MASK_SUBPIX_VAR(4, 4)
HIGHBD_MASK_VAR(4, 8)
HIGHBD_MASK_SUBPIX_VAR(4, 8)
HIGHBD_MASK_VAR(8, 4)
HIGHBD_MASK_SUBPIX_VAR(8, 4)
HIGHBD_MASK_VAR(8, 8)
HIGHBD_MASK_SUBPIX_VAR(8, 8)
HIGHBD_MASK_VAR(8, 16)
HIGHBD_MASK_SUBPIX_VAR(8, 16)
HIGHBD_MASK_VAR(16, 8)
HIGHBD_MASK_SUBPIX_VAR(16, 8)
HIGHBD_MASK_VAR(16, 16)
HIGHBD_MASK_SUBPIX_VAR(16, 16)
HIGHBD_MASK_VAR(16, 32)
HIGHBD_MASK_SUBPIX_VAR(16, 32)
HIGHBD_MASK_VAR(32, 16)
HIGHBD_MASK_SUBPIX_VAR(32, 16)
HIGHBD_MASK_VAR(32, 32)
HIGHBD_MASK_SUBPIX_VAR(32, 32)
HIGHBD_MASK_VAR(32, 64)
HIGHBD_MASK_SUBPIX_VAR(32, 64)
HIGHBD_MASK_VAR(64, 32)
HIGHBD_MASK_SUBPIX_VAR(64, 32)
HIGHBD_MASK_VAR(64, 64)
HIGHBD_MASK_SUBPIX_VAR(64, 64)
#if CONFIG_EXT_PARTITION
HIGHBD_MASK_VAR(64, 128)
HIGHBD_MASK_SUBPIX_VAR(64, 128)
HIGHBD_MASK_VAR(128, 64)
HIGHBD_MASK_SUBPIX_VAR(128, 64)
HIGHBD_MASK_VAR(128, 128)
HIGHBD_MASK_SUBPIX_VAR(128, 128)
#endif // CONFIG_EXT_PARTITION
#endif // CONFIG_HIGHBITDEPTH

View file

@ -57,15 +57,13 @@ typedef unsigned int (*aom_subp_avg_variance_fn_t)(
#if CONFIG_AV1 && CONFIG_EXT_INTER
typedef unsigned int (*aom_masked_sad_fn_t)(const uint8_t *src, int src_stride,
const uint8_t *ref, int ref_stride,
const uint8_t *msk_ptr,
int msk_stride);
typedef unsigned int (*aom_masked_variance_fn_t)(
const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride,
const uint8_t *msk, int msk_stride, unsigned int *sse);
const uint8_t *second_pred,
const uint8_t *msk, int msk_stride,
int invert_mask);
typedef unsigned int (*aom_masked_subpixvariance_fn_t)(
const uint8_t *src, int src_stride, int xoffset, int yoffset,
const uint8_t *ref, int ref_stride, const uint8_t *msk, int msk_stride,
unsigned int *sse);
const uint8_t *ref, int ref_stride, const uint8_t *second_pred,
const uint8_t *msk, int msk_stride, int invert_mask, unsigned int *sse);
#endif // CONFIG_AV1 && CONFIG_EXT_INTER
#if CONFIG_AV1 && CONFIG_MOTION_VAR
@ -94,7 +92,6 @@ typedef struct aom_variance_vtable {
aom_sad_multi_d_fn_t sdx4df;
#if CONFIG_EXT_INTER
aom_masked_sad_fn_t msdf;
aom_masked_variance_fn_t mvf;
aom_masked_subpixvariance_fn_t msvf;
#endif // CONFIG_EXT_INTER
#if CONFIG_MOTION_VAR

View file

@ -0,0 +1,195 @@
/*
* 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 <emmintrin.h>
#include <assert.h>
#include "./aom_dsp_rtcd.h"
#include "aom_dsp/aom_convolve.h"
#include "aom_dsp/aom_dsp_common.h"
#include "aom_dsp/aom_filter.h"
void aom_convolve8_add_src_hip_sse2(const uint8_t *src, ptrdiff_t src_stride,
uint8_t *dst, ptrdiff_t dst_stride,
const int16_t *filter_x, int x_step_q4,
const int16_t *filter_y, int y_step_q4,
int w, int h) {
const int bd = 8;
assert(x_step_q4 == 16 && y_step_q4 == 16);
assert(!(w & 7));
(void)x_step_q4;
(void)y_step_q4;
uint16_t temp[(MAX_SB_SIZE + SUBPEL_TAPS - 1) * MAX_SB_SIZE];
int intermediate_height = h + SUBPEL_TAPS - 1;
int i, j;
const int center_tap = ((SUBPEL_TAPS - 1) / 2);
const uint8_t *const src_ptr = src - center_tap * src_stride - center_tap;
const __m128i zero = _mm_setzero_si128();
// Add an offset to account for the "add_src" part of the convolve function.
const __m128i offset = _mm_insert_epi16(zero, 1 << FILTER_BITS, 3);
/* Horizontal filter */
{
const __m128i coeffs_x =
_mm_add_epi16(_mm_loadu_si128((__m128i *)filter_x), offset);
// coeffs 0 1 0 1 2 3 2 3
const __m128i tmp_0 = _mm_unpacklo_epi32(coeffs_x, coeffs_x);
// coeffs 4 5 4 5 6 7 6 7
const __m128i tmp_1 = _mm_unpackhi_epi32(coeffs_x, coeffs_x);
// coeffs 0 1 0 1 0 1 0 1
const __m128i coeff_01 = _mm_unpacklo_epi64(tmp_0, tmp_0);
// coeffs 2 3 2 3 2 3 2 3
const __m128i coeff_23 = _mm_unpackhi_epi64(tmp_0, tmp_0);
// coeffs 4 5 4 5 4 5 4 5
const __m128i coeff_45 = _mm_unpacklo_epi64(tmp_1, tmp_1);
// coeffs 6 7 6 7 6 7 6 7
const __m128i coeff_67 = _mm_unpackhi_epi64(tmp_1, tmp_1);
const __m128i round_const =
_mm_set1_epi32((1 << (FILTER_BITS - EXTRAPREC_BITS - 1)) +
(1 << (bd + FILTER_BITS - 1)));
for (i = 0; i < intermediate_height; ++i) {
for (j = 0; j < w; j += 8) {
const __m128i data =
_mm_loadu_si128((__m128i *)&src_ptr[i * src_stride + j]);
// Filter even-index pixels
const __m128i src_0 = _mm_unpacklo_epi8(data, zero);
const __m128i res_0 = _mm_madd_epi16(src_0, coeff_01);
const __m128i src_2 = _mm_unpacklo_epi8(_mm_srli_si128(data, 2), zero);
const __m128i res_2 = _mm_madd_epi16(src_2, coeff_23);
const __m128i src_4 = _mm_unpacklo_epi8(_mm_srli_si128(data, 4), zero);
const __m128i res_4 = _mm_madd_epi16(src_4, coeff_45);
const __m128i src_6 = _mm_unpacklo_epi8(_mm_srli_si128(data, 6), zero);
const __m128i res_6 = _mm_madd_epi16(src_6, coeff_67);
__m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_4),
_mm_add_epi32(res_2, res_6));
res_even = _mm_srai_epi32(_mm_add_epi32(res_even, round_const),
FILTER_BITS - EXTRAPREC_BITS);
// Filter odd-index pixels
const __m128i src_1 = _mm_unpacklo_epi8(_mm_srli_si128(data, 1), zero);
const __m128i res_1 = _mm_madd_epi16(src_1, coeff_01);
const __m128i src_3 = _mm_unpacklo_epi8(_mm_srli_si128(data, 3), zero);
const __m128i res_3 = _mm_madd_epi16(src_3, coeff_23);
const __m128i src_5 = _mm_unpacklo_epi8(_mm_srli_si128(data, 5), zero);
const __m128i res_5 = _mm_madd_epi16(src_5, coeff_45);
const __m128i src_7 = _mm_unpacklo_epi8(_mm_srli_si128(data, 7), zero);
const __m128i res_7 = _mm_madd_epi16(src_7, coeff_67);
__m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_5),
_mm_add_epi32(res_3, res_7));
res_odd = _mm_srai_epi32(_mm_add_epi32(res_odd, round_const),
FILTER_BITS - EXTRAPREC_BITS);
// Pack in the column order 0, 2, 4, 6, 1, 3, 5, 7
__m128i res = _mm_packs_epi32(res_even, res_odd);
res = _mm_min_epi16(_mm_max_epi16(res, zero),
_mm_set1_epi16(EXTRAPREC_CLAMP_LIMIT(bd) - 1));
_mm_storeu_si128((__m128i *)&temp[i * MAX_SB_SIZE + j], res);
}
}
}
/* Vertical filter */
{
const __m128i coeffs_y =
_mm_add_epi16(_mm_loadu_si128((__m128i *)filter_y), offset);
// coeffs 0 1 0 1 2 3 2 3
const __m128i tmp_0 = _mm_unpacklo_epi32(coeffs_y, coeffs_y);
// coeffs 4 5 4 5 6 7 6 7
const __m128i tmp_1 = _mm_unpackhi_epi32(coeffs_y, coeffs_y);
// coeffs 0 1 0 1 0 1 0 1
const __m128i coeff_01 = _mm_unpacklo_epi64(tmp_0, tmp_0);
// coeffs 2 3 2 3 2 3 2 3
const __m128i coeff_23 = _mm_unpackhi_epi64(tmp_0, tmp_0);
// coeffs 4 5 4 5 4 5 4 5
const __m128i coeff_45 = _mm_unpacklo_epi64(tmp_1, tmp_1);
// coeffs 6 7 6 7 6 7 6 7
const __m128i coeff_67 = _mm_unpackhi_epi64(tmp_1, tmp_1);
const __m128i round_const =
_mm_set1_epi32((1 << (FILTER_BITS + EXTRAPREC_BITS - 1)) -
(1 << (bd + FILTER_BITS + EXTRAPREC_BITS - 1)));
for (i = 0; i < h; ++i) {
for (j = 0; j < w; j += 8) {
// Filter even-index pixels
const uint16_t *data = &temp[i * MAX_SB_SIZE + j];
const __m128i src_0 =
_mm_unpacklo_epi16(*(__m128i *)(data + 0 * MAX_SB_SIZE),
*(__m128i *)(data + 1 * MAX_SB_SIZE));
const __m128i src_2 =
_mm_unpacklo_epi16(*(__m128i *)(data + 2 * MAX_SB_SIZE),
*(__m128i *)(data + 3 * MAX_SB_SIZE));
const __m128i src_4 =
_mm_unpacklo_epi16(*(__m128i *)(data + 4 * MAX_SB_SIZE),
*(__m128i *)(data + 5 * MAX_SB_SIZE));
const __m128i src_6 =
_mm_unpacklo_epi16(*(__m128i *)(data + 6 * MAX_SB_SIZE),
*(__m128i *)(data + 7 * MAX_SB_SIZE));
const __m128i res_0 = _mm_madd_epi16(src_0, coeff_01);
const __m128i res_2 = _mm_madd_epi16(src_2, coeff_23);
const __m128i res_4 = _mm_madd_epi16(src_4, coeff_45);
const __m128i res_6 = _mm_madd_epi16(src_6, coeff_67);
const __m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_2),
_mm_add_epi32(res_4, res_6));
// Filter odd-index pixels
const __m128i src_1 =
_mm_unpackhi_epi16(*(__m128i *)(data + 0 * MAX_SB_SIZE),
*(__m128i *)(data + 1 * MAX_SB_SIZE));
const __m128i src_3 =
_mm_unpackhi_epi16(*(__m128i *)(data + 2 * MAX_SB_SIZE),
*(__m128i *)(data + 3 * MAX_SB_SIZE));
const __m128i src_5 =
_mm_unpackhi_epi16(*(__m128i *)(data + 4 * MAX_SB_SIZE),
*(__m128i *)(data + 5 * MAX_SB_SIZE));
const __m128i src_7 =
_mm_unpackhi_epi16(*(__m128i *)(data + 6 * MAX_SB_SIZE),
*(__m128i *)(data + 7 * MAX_SB_SIZE));
const __m128i res_1 = _mm_madd_epi16(src_1, coeff_01);
const __m128i res_3 = _mm_madd_epi16(src_3, coeff_23);
const __m128i res_5 = _mm_madd_epi16(src_5, coeff_45);
const __m128i res_7 = _mm_madd_epi16(src_7, coeff_67);
const __m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_3),
_mm_add_epi32(res_5, res_7));
// Rearrange pixels back into the order 0 ... 7
const __m128i res_lo = _mm_unpacklo_epi32(res_even, res_odd);
const __m128i res_hi = _mm_unpackhi_epi32(res_even, res_odd);
const __m128i res_lo_round = _mm_srai_epi32(
_mm_add_epi32(res_lo, round_const), FILTER_BITS + EXTRAPREC_BITS);
const __m128i res_hi_round = _mm_srai_epi32(
_mm_add_epi32(res_hi, round_const), FILTER_BITS + EXTRAPREC_BITS);
const __m128i res_16bit = _mm_packs_epi32(res_lo_round, res_hi_round);
__m128i res_8bit = _mm_packus_epi16(res_16bit, res_16bit);
__m128i *const p = (__m128i *)&dst[i * dst_stride + j];
_mm_storel_epi64(p, res_8bit);
}
}
}
}

View file

@ -0,0 +1,203 @@
/*
* 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 <tmmintrin.h>
#include <assert.h>
#include "./aom_dsp_rtcd.h"
#include "aom_dsp/aom_convolve.h"
#include "aom_dsp/aom_dsp_common.h"
#include "aom_dsp/aom_filter.h"
#if EXTRAPREC_BITS > 2
#error "Highbd high-prec convolve filter only supports EXTRAPREC_BITS <= 2"
#error "(need to use 32-bit intermediates for EXTRAPREC_BITS > 2)"
#endif
void aom_highbd_convolve8_add_src_hip_ssse3(
const uint8_t *src8, ptrdiff_t src_stride, uint8_t *dst8,
ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4,
const int16_t *filter_y, int y_step_q4, int w, int h, int bd) {
assert(x_step_q4 == 16 && y_step_q4 == 16);
assert(!(w & 7));
(void)x_step_q4;
(void)y_step_q4;
const uint16_t *const src = CONVERT_TO_SHORTPTR(src8);
uint16_t *const dst = CONVERT_TO_SHORTPTR(dst8);
uint16_t temp[(MAX_SB_SIZE + SUBPEL_TAPS - 1) * MAX_SB_SIZE];
int intermediate_height = h + SUBPEL_TAPS - 1;
int i, j;
const int center_tap = ((SUBPEL_TAPS - 1) / 2);
const uint16_t *const src_ptr = src - center_tap * src_stride - center_tap;
const __m128i zero = _mm_setzero_si128();
// Add an offset to account for the "add_src" part of the convolve function.
const __m128i offset = _mm_insert_epi16(zero, 1 << FILTER_BITS, 3);
/* Horizontal filter */
{
const __m128i coeffs_x =
_mm_add_epi16(_mm_loadu_si128((__m128i *)filter_x), offset);
// coeffs 0 1 0 1 2 3 2 3
const __m128i tmp_0 = _mm_unpacklo_epi32(coeffs_x, coeffs_x);
// coeffs 4 5 4 5 6 7 6 7
const __m128i tmp_1 = _mm_unpackhi_epi32(coeffs_x, coeffs_x);
// coeffs 0 1 0 1 0 1 0 1
const __m128i coeff_01 = _mm_unpacklo_epi64(tmp_0, tmp_0);
// coeffs 2 3 2 3 2 3 2 3
const __m128i coeff_23 = _mm_unpackhi_epi64(tmp_0, tmp_0);
// coeffs 4 5 4 5 4 5 4 5
const __m128i coeff_45 = _mm_unpacklo_epi64(tmp_1, tmp_1);
// coeffs 6 7 6 7 6 7 6 7
const __m128i coeff_67 = _mm_unpackhi_epi64(tmp_1, tmp_1);
const __m128i round_const =
_mm_set1_epi32((1 << (FILTER_BITS - EXTRAPREC_BITS - 1)) +
(1 << (bd + FILTER_BITS - 1)));
for (i = 0; i < intermediate_height; ++i) {
for (j = 0; j < w; j += 8) {
const __m128i data =
_mm_loadu_si128((__m128i *)&src_ptr[i * src_stride + j]);
const __m128i data2 =
_mm_loadu_si128((__m128i *)&src_ptr[i * src_stride + j + 8]);
// Filter even-index pixels
const __m128i res_0 = _mm_madd_epi16(data, coeff_01);
const __m128i res_2 =
_mm_madd_epi16(_mm_alignr_epi8(data2, data, 4), coeff_23);
const __m128i res_4 =
_mm_madd_epi16(_mm_alignr_epi8(data2, data, 8), coeff_45);
const __m128i res_6 =
_mm_madd_epi16(_mm_alignr_epi8(data2, data, 12), coeff_67);
__m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_4),
_mm_add_epi32(res_2, res_6));
res_even = _mm_srai_epi32(_mm_add_epi32(res_even, round_const),
FILTER_BITS - EXTRAPREC_BITS);
// Filter odd-index pixels
const __m128i res_1 =
_mm_madd_epi16(_mm_alignr_epi8(data2, data, 2), coeff_01);
const __m128i res_3 =
_mm_madd_epi16(_mm_alignr_epi8(data2, data, 6), coeff_23);
const __m128i res_5 =
_mm_madd_epi16(_mm_alignr_epi8(data2, data, 10), coeff_45);
const __m128i res_7 =
_mm_madd_epi16(_mm_alignr_epi8(data2, data, 14), coeff_67);
__m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_5),
_mm_add_epi32(res_3, res_7));
res_odd = _mm_srai_epi32(_mm_add_epi32(res_odd, round_const),
FILTER_BITS - EXTRAPREC_BITS);
// Pack in the column order 0, 2, 4, 6, 1, 3, 5, 7
const __m128i maxval = _mm_set1_epi16((EXTRAPREC_CLAMP_LIMIT(bd)) - 1);
__m128i res = _mm_packs_epi32(res_even, res_odd);
res = _mm_min_epi16(_mm_max_epi16(res, zero), maxval);
_mm_storeu_si128((__m128i *)&temp[i * MAX_SB_SIZE + j], res);
}
}
}
/* Vertical filter */
{
const __m128i coeffs_y =
_mm_add_epi16(_mm_loadu_si128((__m128i *)filter_y), offset);
// coeffs 0 1 0 1 2 3 2 3
const __m128i tmp_0 = _mm_unpacklo_epi32(coeffs_y, coeffs_y);
// coeffs 4 5 4 5 6 7 6 7
const __m128i tmp_1 = _mm_unpackhi_epi32(coeffs_y, coeffs_y);
// coeffs 0 1 0 1 0 1 0 1
const __m128i coeff_01 = _mm_unpacklo_epi64(tmp_0, tmp_0);
// coeffs 2 3 2 3 2 3 2 3
const __m128i coeff_23 = _mm_unpackhi_epi64(tmp_0, tmp_0);
// coeffs 4 5 4 5 4 5 4 5
const __m128i coeff_45 = _mm_unpacklo_epi64(tmp_1, tmp_1);
// coeffs 6 7 6 7 6 7 6 7
const __m128i coeff_67 = _mm_unpackhi_epi64(tmp_1, tmp_1);
const __m128i round_const =
_mm_set1_epi32((1 << (FILTER_BITS + EXTRAPREC_BITS - 1)) -
(1 << (bd + FILTER_BITS + EXTRAPREC_BITS - 1)));
for (i = 0; i < h; ++i) {
for (j = 0; j < w; j += 8) {
// Filter even-index pixels
const uint16_t *data = &temp[i * MAX_SB_SIZE + j];
const __m128i src_0 =
_mm_unpacklo_epi16(*(__m128i *)(data + 0 * MAX_SB_SIZE),
*(__m128i *)(data + 1 * MAX_SB_SIZE));
const __m128i src_2 =
_mm_unpacklo_epi16(*(__m128i *)(data + 2 * MAX_SB_SIZE),
*(__m128i *)(data + 3 * MAX_SB_SIZE));
const __m128i src_4 =
_mm_unpacklo_epi16(*(__m128i *)(data + 4 * MAX_SB_SIZE),
*(__m128i *)(data + 5 * MAX_SB_SIZE));
const __m128i src_6 =
_mm_unpacklo_epi16(*(__m128i *)(data + 6 * MAX_SB_SIZE),
*(__m128i *)(data + 7 * MAX_SB_SIZE));
const __m128i res_0 = _mm_madd_epi16(src_0, coeff_01);
const __m128i res_2 = _mm_madd_epi16(src_2, coeff_23);
const __m128i res_4 = _mm_madd_epi16(src_4, coeff_45);
const __m128i res_6 = _mm_madd_epi16(src_6, coeff_67);
const __m128i res_even = _mm_add_epi32(_mm_add_epi32(res_0, res_2),
_mm_add_epi32(res_4, res_6));
// Filter odd-index pixels
const __m128i src_1 =
_mm_unpackhi_epi16(*(__m128i *)(data + 0 * MAX_SB_SIZE),
*(__m128i *)(data + 1 * MAX_SB_SIZE));
const __m128i src_3 =
_mm_unpackhi_epi16(*(__m128i *)(data + 2 * MAX_SB_SIZE),
*(__m128i *)(data + 3 * MAX_SB_SIZE));
const __m128i src_5 =
_mm_unpackhi_epi16(*(__m128i *)(data + 4 * MAX_SB_SIZE),
*(__m128i *)(data + 5 * MAX_SB_SIZE));
const __m128i src_7 =
_mm_unpackhi_epi16(*(__m128i *)(data + 6 * MAX_SB_SIZE),
*(__m128i *)(data + 7 * MAX_SB_SIZE));
const __m128i res_1 = _mm_madd_epi16(src_1, coeff_01);
const __m128i res_3 = _mm_madd_epi16(src_3, coeff_23);
const __m128i res_5 = _mm_madd_epi16(src_5, coeff_45);
const __m128i res_7 = _mm_madd_epi16(src_7, coeff_67);
const __m128i res_odd = _mm_add_epi32(_mm_add_epi32(res_1, res_3),
_mm_add_epi32(res_5, res_7));
// Rearrange pixels back into the order 0 ... 7
const __m128i res_lo = _mm_unpacklo_epi32(res_even, res_odd);
const __m128i res_hi = _mm_unpackhi_epi32(res_even, res_odd);
const __m128i res_lo_round = _mm_srai_epi32(
_mm_add_epi32(res_lo, round_const), FILTER_BITS + EXTRAPREC_BITS);
const __m128i res_hi_round = _mm_srai_epi32(
_mm_add_epi32(res_hi, round_const), FILTER_BITS + EXTRAPREC_BITS);
const __m128i maxval = _mm_set1_epi16((1 << bd) - 1);
__m128i res_16bit = _mm_packs_epi32(res_lo_round, res_hi_round);
res_16bit = _mm_min_epi16(_mm_max_epi16(res_16bit, zero), maxval);
__m128i *const p = (__m128i *)&dst[i * dst_stride + j];
_mm_storeu_si128(p, res_16bit);
}
}
}
}

View file

@ -94,52 +94,6 @@ void aom_minmax_8x8_sse2(const uint8_t *s, int p, const uint8_t *d, int dp,
*min = _mm_extract_epi16(minabsdiff, 0);
}
unsigned int aom_avg_8x8_sse2(const uint8_t *s, int p) {
__m128i s0, s1, u0;
unsigned int avg = 0;
u0 = _mm_setzero_si128();
s0 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i *)(s)), u0);
s1 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i *)(s + p)), u0);
s0 = _mm_adds_epu16(s0, s1);
s1 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i *)(s + 2 * p)), u0);
s0 = _mm_adds_epu16(s0, s1);
s1 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i *)(s + 3 * p)), u0);
s0 = _mm_adds_epu16(s0, s1);
s1 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i *)(s + 4 * p)), u0);
s0 = _mm_adds_epu16(s0, s1);
s1 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i *)(s + 5 * p)), u0);
s0 = _mm_adds_epu16(s0, s1);
s1 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i *)(s + 6 * p)), u0);
s0 = _mm_adds_epu16(s0, s1);
s1 = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i *)(s + 7 * p)), u0);
s0 = _mm_adds_epu16(s0, s1);
s0 = _mm_adds_epu16(s0, _mm_srli_si128(s0, 8));
s0 = _mm_adds_epu16(s0, _mm_srli_epi64(s0, 32));
s0 = _mm_adds_epu16(s0, _mm_srli_epi64(s0, 16));
avg = _mm_extract_epi16(s0, 0);
return (avg + 32) >> 6;
}
unsigned int aom_avg_4x4_sse2(const uint8_t *s, int p) {
__m128i s0, s1, u0;
unsigned int avg = 0;
u0 = _mm_setzero_si128();
s0 = _mm_unpacklo_epi8(xx_loadl_32(s), u0);
s1 = _mm_unpacklo_epi8(xx_loadl_32(s + p), u0);
s0 = _mm_adds_epu16(s0, s1);
s1 = _mm_unpacklo_epi8(xx_loadl_32(s + 2 * p), u0);
s0 = _mm_adds_epu16(s0, s1);
s1 = _mm_unpacklo_epi8(xx_loadl_32(s + 3 * p), u0);
s0 = _mm_adds_epu16(s0, s1);
s0 = _mm_adds_epu16(s0, _mm_srli_si128(s0, 4));
s0 = _mm_adds_epu16(s0, _mm_srli_epi64(s0, 16));
avg = _mm_extract_epi16(s0, 0);
return (avg + 8) >> 4;
}
static void hadamard_col8_sse2(__m128i *in, int iter) {
__m128i a0 = in[0];
__m128i a1 = in[1];

View file

@ -14,30 +14,6 @@
#include "./aom_dsp_rtcd.h"
#include "aom_dsp/x86/convolve.h"
#define CONV8_ROUNDING_BITS (7)
static const uint8_t signal_pattern_0[32] = { 0, 1, 2, 3, 2, 3, 4, 5, 4, 5, 6,
7, 6, 7, 8, 9, 0, 1, 2, 3, 2, 3,
4, 5, 4, 5, 6, 7, 6, 7, 8, 9 };
static const uint8_t signal_pattern_1[32] = { 4, 5, 6, 7, 6, 7, 8, 9,
8, 9, 10, 11, 10, 11, 12, 13,
4, 5, 6, 7, 6, 7, 8, 9,
8, 9, 10, 11, 10, 11, 12, 13 };
static const uint8_t signal_pattern_2[32] = { 6, 7, 8, 9, 8, 9, 10, 11,
10, 11, 12, 13, 12, 13, 14, 15,
6, 7, 8, 9, 8, 9, 10, 11,
10, 11, 12, 13, 12, 13, 14, 15 };
static const uint32_t signal_index[8] = { 2, 3, 4, 5, 2, 3, 4, 5 };
typedef enum { PACK_8x1, PACK_8x2, PACK_16x1 } PixelPackFormat;
typedef void (*WritePixels)(const __m256i *y0, const __m256i *y1,
const __m256i *mask, uint16_t *dst,
ptrdiff_t pitch);
// -----------------------------------------------------------------------------
// Copy and average
@ -216,6 +192,27 @@ void aom_highbd_convolve_avg_avx2(const uint8_t *src8, ptrdiff_t src_stride,
}
}
// -----------------------------------------------------------------------------
// Horizontal and vertical filtering
#define CONV8_ROUNDING_BITS (7)
static const uint8_t signal_pattern_0[32] = { 0, 1, 2, 3, 2, 3, 4, 5, 4, 5, 6,
7, 6, 7, 8, 9, 0, 1, 2, 3, 2, 3,
4, 5, 4, 5, 6, 7, 6, 7, 8, 9 };
static const uint8_t signal_pattern_1[32] = { 4, 5, 6, 7, 6, 7, 8, 9,
8, 9, 10, 11, 10, 11, 12, 13,
4, 5, 6, 7, 6, 7, 8, 9,
8, 9, 10, 11, 10, 11, 12, 13 };
static const uint8_t signal_pattern_2[32] = { 6, 7, 8, 9, 8, 9, 10, 11,
10, 11, 12, 13, 12, 13, 14, 15,
6, 7, 8, 9, 8, 9, 10, 11,
10, 11, 12, 13, 12, 13, 14, 15 };
static const uint32_t signal_index[8] = { 2, 3, 4, 5, 2, 3, 4, 5 };
// -----------------------------------------------------------------------------
// Horizontal Filtering
@ -248,52 +245,30 @@ static INLINE void pack_16_pixels(const __m256i *s0, const __m256i *s1,
x[7] = _mm256_permute2x128_si256(pp[1], pp[5], 0x31);
}
static INLINE void pack_pixels_with_format(const uint16_t *src,
PixelPackFormat fmt,
ptrdiff_t stride, __m256i *x) {
switch (fmt) {
case PACK_8x1: {
__m256i pp[8];
__m256i s0;
s0 = _mm256_loadu_si256((const __m256i *)src);
pack_pixels(&s0, pp);
x[0] = _mm256_permute2x128_si256(pp[0], pp[2], 0x30);
x[1] = _mm256_permute2x128_si256(pp[1], pp[3], 0x30);
x[2] = _mm256_permute2x128_si256(pp[2], pp[0], 0x30);
x[3] = _mm256_permute2x128_si256(pp[3], pp[1], 0x30);
break;
}
case PACK_8x2: {
__m256i s0, s1;
s0 = _mm256_loadu_si256((const __m256i *)src);
s1 = _mm256_loadu_si256((const __m256i *)(src + stride));
pack_16_pixels(&s0, &s1, x);
break;
}
case PACK_16x1: {
__m256i s0, s1;
s0 = _mm256_loadu_si256((const __m256i *)src);
s1 = _mm256_loadu_si256((const __m256i *)(src + 8));
pack_16_pixels(&s0, &s1, x);
break;
}
default: { assert(0); }
}
static INLINE void pack_8x1_pixels(const uint16_t *src, __m256i *x) {
__m256i pp[8];
__m256i s0;
s0 = _mm256_loadu_si256((const __m256i *)src);
pack_pixels(&s0, pp);
x[0] = _mm256_permute2x128_si256(pp[0], pp[2], 0x30);
x[1] = _mm256_permute2x128_si256(pp[1], pp[3], 0x30);
x[2] = _mm256_permute2x128_si256(pp[2], pp[0], 0x30);
x[3] = _mm256_permute2x128_si256(pp[3], pp[1], 0x30);
}
static INLINE void pack_8x1_pixels(const uint16_t *src, const ptrdiff_t pitch,
__m256i *x /*x[4]*/) {
pack_pixels_with_format(src, PACK_8x1, pitch, x);
static INLINE void pack_8x2_pixels(const uint16_t *src, ptrdiff_t stride,
__m256i *x) {
__m256i s0, s1;
s0 = _mm256_loadu_si256((const __m256i *)src);
s1 = _mm256_loadu_si256((const __m256i *)(src + stride));
pack_16_pixels(&s0, &s1, x);
}
static INLINE void pack_8x2_pixels(const uint16_t *src, const ptrdiff_t pitch,
__m256i *x /*x[8]*/) {
pack_pixels_with_format(src, PACK_8x2, pitch, x);
}
static INLINE void pack_16x1_pixels(const uint16_t *src, const ptrdiff_t pitch,
__m256i *x /*x[8]*/) {
pack_pixels_with_format(src, PACK_16x1, pitch, x);
static INLINE void pack_16x1_pixels(const uint16_t *src, __m256i *x) {
__m256i s0, s1;
s0 = _mm256_loadu_si256((const __m256i *)src);
s1 = _mm256_loadu_si256((const __m256i *)(src + 8));
pack_16_pixels(&s0, &s1, x);
}
// Note:
@ -323,51 +298,49 @@ static INLINE void filter_8x1_pixels(const __m256i *sig /*sig[4]*/,
a0 = _mm256_madd_epi16(fil[1], sig[1]);
a1 = _mm256_madd_epi16(fil[2], sig[2]);
const __m256i min = _mm256_min_epi32(a0, a1);
a = _mm256_add_epi32(a, min);
const __m256i max = _mm256_max_epi32(a0, a1);
a = _mm256_add_epi32(a, max);
const __m256i rounding = _mm256_set1_epi32(1 << (CONV8_ROUNDING_BITS - 1));
a = _mm256_add_epi32(a, rounding);
*y = _mm256_srai_epi32(a, CONV8_ROUNDING_BITS);
{
const __m256i min = _mm256_min_epi32(a0, a1);
a = _mm256_add_epi32(a, min);
}
{
const __m256i max = _mm256_max_epi32(a0, a1);
a = _mm256_add_epi32(a, max);
}
{
const __m256i rounding = _mm256_set1_epi32(1 << (CONV8_ROUNDING_BITS - 1));
a = _mm256_add_epi32(a, rounding);
*y = _mm256_srai_epi32(a, CONV8_ROUNDING_BITS);
}
}
static void write_8x1_pixels(const __m256i *y, const __m256i *z,
const __m256i *mask, uint16_t *dst,
ptrdiff_t pitch) {
static INLINE void store_8x1_pixels(const __m256i *y, const __m256i *mask,
uint16_t *dst) {
const __m128i a0 = _mm256_castsi256_si128(*y);
const __m128i a1 = _mm256_extractf128_si256(*y, 1);
__m128i res = _mm_packus_epi32(a0, a1);
(void)z;
(void)pitch;
res = _mm_min_epi16(res, _mm256_castsi256_si128(*mask));
_mm_storeu_si128((__m128i *)dst, res);
}
static void write_8x2_pixels(const __m256i *y0, const __m256i *y1,
const __m256i *mask, uint16_t *dst,
ptrdiff_t pitch) {
static INLINE void store_8x2_pixels(const __m256i *y0, const __m256i *y1,
const __m256i *mask, uint16_t *dst,
ptrdiff_t pitch) {
__m256i a = _mm256_packus_epi32(*y0, *y1);
a = _mm256_min_epi16(a, *mask);
_mm_storeu_si128((__m128i *)dst, _mm256_castsi256_si128(a));
_mm_storeu_si128((__m128i *)(dst + pitch), _mm256_extractf128_si256(a, 1));
}
static void write_16x1_pixels(const __m256i *y0, const __m256i *y1,
const __m256i *mask, uint16_t *dst,
ptrdiff_t dst_pitch) {
(void)dst_pitch;
static INLINE void store_16x1_pixels(const __m256i *y0, const __m256i *y1,
const __m256i *mask, uint16_t *dst) {
__m256i a = _mm256_packus_epi32(*y0, *y1);
a = _mm256_min_epi16(a, *mask);
_mm256_storeu_si256((__m256i *)dst, a);
}
static void filter_block_width8_horiz(
const uint16_t *src_ptr, ptrdiff_t src_pitch, const WritePixels write_8x1,
const WritePixels write_8x2, uint16_t *dst_ptr, ptrdiff_t dst_pitch,
uint32_t height, const int16_t *filter, int bd) {
static void aom_highbd_filter_block1d8_h8_avx2(
const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
__m256i signal[8], res0, res1;
const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
@ -379,32 +352,22 @@ static void filter_block_width8_horiz(
pack_8x2_pixels(src_ptr, src_pitch, signal);
filter_8x1_pixels(signal, ff, &res0);
filter_8x1_pixels(&signal[4], ff, &res1);
write_8x2(&res0, &res1, &max, dst_ptr, dst_pitch);
store_8x2_pixels(&res0, &res1, &max, dst_ptr, dst_pitch);
height -= 2;
src_ptr += src_pitch << 1;
dst_ptr += dst_pitch << 1;
} while (height > 1);
if (height > 0) {
pack_8x1_pixels(src_ptr, src_pitch, signal);
pack_8x1_pixels(src_ptr, signal);
filter_8x1_pixels(signal, ff, &res0);
write_8x1(&res0, &res1, &max, dst_ptr, dst_pitch);
store_8x1_pixels(&res0, &max, dst_ptr);
}
}
static void aom_highbd_filter_block1d8_h8_avx2(
const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
static void aom_highbd_filter_block1d16_h8_avx2(
const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
filter_block_width8_horiz(src, src_pitch, write_8x1_pixels, write_8x2_pixels,
dst, dst_pitch, height, filter, bd);
}
static void filter_block_width16_horiz(const uint16_t *src_ptr,
ptrdiff_t src_pitch,
const WritePixels write_16x1,
uint16_t *dst_ptr, ptrdiff_t dst_pitch,
uint32_t height, const int16_t *filter,
int bd) {
__m256i signal[8], res0, res1;
const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
@ -413,23 +376,17 @@ static void filter_block_width16_horiz(const uint16_t *src_ptr,
src_ptr -= 3;
do {
pack_16x1_pixels(src_ptr, src_pitch, signal);
pack_16x1_pixels(src_ptr, signal);
filter_8x1_pixels(signal, ff, &res0);
filter_8x1_pixels(&signal[4], ff, &res1);
write_16x1(&res0, &res1, &max, dst_ptr, dst_pitch);
store_16x1_pixels(&res0, &res1, &max, dst_ptr);
height -= 1;
src_ptr += src_pitch;
dst_ptr += dst_pitch;
} while (height > 0);
}
static void aom_highbd_filter_block1d16_h8_avx2(
const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
filter_block_width16_horiz(src, src_pitch, write_16x1_pixels, dst, dst_pitch,
height, filter, bd);
}
// -----------------------------------------------------------------------------
// 2-tap horizontal filtering
static INLINE void pack_2t_filter(const int16_t *filter, __m256i *f) {
@ -493,16 +450,6 @@ static INLINE void filter_16_2t_pixels(const __m256i *sig, const __m256i *f,
*y1 = _mm256_srai_epi32(x1, CONV8_ROUNDING_BITS);
}
static INLINE void filter_8x2_2t_pixels(const __m256i *sig, const __m256i *f,
__m256i *y0, __m256i *y1) {
filter_16_2t_pixels(sig, f, y0, y1);
}
static INLINE void filter_16x1_2t_pixels(const __m256i *sig, const __m256i *f,
__m256i *y0, __m256i *y1) {
filter_16_2t_pixels(sig, f, y0, y1);
}
static INLINE void filter_8x1_2t_pixels(const __m256i *sig, const __m256i *f,
__m256i *y0) {
const __m256i rounding = _mm256_set1_epi32(1 << (CONV8_ROUNDING_BITS - 1));
@ -511,10 +458,9 @@ static INLINE void filter_8x1_2t_pixels(const __m256i *sig, const __m256i *f,
*y0 = _mm256_srai_epi32(x0, CONV8_ROUNDING_BITS);
}
static void filter_block_width8_2t_horiz(
const uint16_t *src_ptr, ptrdiff_t src_pitch, const WritePixels write_8x1,
const WritePixels write_8x2, uint16_t *dst_ptr, ptrdiff_t dst_pitch,
uint32_t height, const int16_t *filter, int bd) {
static void aom_highbd_filter_block1d8_h2_avx2(
const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
__m256i signal[2], res0, res1;
const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
@ -524,8 +470,8 @@ static void filter_block_width8_2t_horiz(
src_ptr -= 3;
do {
pack_8x2_2t_pixels(src_ptr, src_pitch, signal);
filter_8x2_2t_pixels(signal, &ff, &res0, &res1);
write_8x2(&res0, &res1, &max, dst_ptr, dst_pitch);
filter_16_2t_pixels(signal, &ff, &res0, &res1);
store_8x2_pixels(&res0, &res1, &max, dst_ptr, dst_pitch);
height -= 2;
src_ptr += src_pitch << 1;
dst_ptr += dst_pitch << 1;
@ -534,24 +480,13 @@ static void filter_block_width8_2t_horiz(
if (height > 0) {
pack_8x1_2t_pixels(src_ptr, signal);
filter_8x1_2t_pixels(signal, &ff, &res0);
write_8x1(&res0, &res1, &max, dst_ptr, dst_pitch);
store_8x1_pixels(&res0, &max, dst_ptr);
}
}
static void aom_highbd_filter_block1d8_h2_avx2(
const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
static void aom_highbd_filter_block1d16_h2_avx2(
const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
filter_block_width8_2t_horiz(src, src_pitch, write_8x1_pixels,
write_8x2_pixels, dst, dst_pitch, height, filter,
bd);
}
static void filter_block_width16_2t_horiz(const uint16_t *src_ptr,
ptrdiff_t src_pitch,
const WritePixels write_16x1,
uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height,
const int16_t *filter, int bd) {
__m256i signal[2], res0, res1;
const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
@ -561,21 +496,15 @@ static void filter_block_width16_2t_horiz(const uint16_t *src_ptr,
src_ptr -= 3;
do {
pack_16x1_2t_pixels(src_ptr, signal);
filter_16x1_2t_pixels(signal, &ff, &res0, &res1);
write_16x1(&res0, &res1, &max, dst_ptr, dst_pitch);
filter_16_2t_pixels(signal, &ff, &res0, &res1);
store_16x1_pixels(&res0, &res1, &max, dst_ptr);
height -= 1;
src_ptr += src_pitch;
dst_ptr += dst_pitch;
} while (height > 0);
}
static void aom_highbd_filter_block1d16_h2_avx2(
const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
filter_block_width16_2t_horiz(src, src_pitch, write_16x1_pixels, dst,
dst_pitch, height, filter, bd);
}
// -----------------------------------------------------------------------------
// Vertical Filtering
static void pack_8x9_init(const uint16_t *src, ptrdiff_t pitch, __m256i *sig) {
@ -638,22 +567,9 @@ static INLINE void update_pixels(__m256i *sig) {
}
}
static INLINE void write_8x1_pixels_ver(const __m256i *y0, const __m256i *y1,
const __m256i *mask, uint16_t *dst,
ptrdiff_t pitch) {
(void)pitch;
const __m128i v0 = _mm256_castsi256_si128(*y0);
const __m128i v1 = _mm256_castsi256_si128(*y1);
__m128i p = _mm_packus_epi32(v0, v1);
p = _mm_min_epi16(p, _mm256_castsi256_si128(*mask));
_mm_storeu_si128((__m128i *)dst, p);
}
static void filter_block_width8_vert(const uint16_t *src_ptr,
ptrdiff_t src_pitch, WritePixels write_8x1,
WritePixels write_8x2, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height,
const int16_t *filter, int bd) {
static void aom_highbd_filter_block1d8_v8_avx2(
const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
__m256i signal[9], res0, res1;
const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
@ -666,27 +582,13 @@ static void filter_block_width8_vert(const uint16_t *src_ptr,
pack_8x9_pixels(src_ptr, src_pitch, signal);
filter_8x9_pixels(signal, ff, &res0, &res1);
write_8x2(&res0, &res1, &max, dst_ptr, dst_pitch);
store_8x2_pixels(&res0, &res1, &max, dst_ptr, dst_pitch);
update_pixels(signal);
src_ptr += src_pitch << 1;
dst_ptr += dst_pitch << 1;
height -= 2;
} while (height > 1);
if (height > 0) {
pack_8x9_pixels(src_ptr, src_pitch, signal);
filter_8x9_pixels(signal, ff, &res0, &res1);
write_8x1(&res0, &res1, &max, dst_ptr, dst_pitch);
}
}
static void aom_highbd_filter_block1d8_v8_avx2(
const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
filter_block_width8_vert(src, src_pitch, write_8x1_pixels_ver,
write_8x2_pixels, dst, dst_pitch, height, filter,
bd);
} while (height > 0);
}
static void pack_16x9_init(const uint16_t *src, ptrdiff_t pitch, __m256i *sig) {
@ -770,13 +672,15 @@ static INLINE void filter_16x9_pixels(const __m256i *sig, const __m256i *f,
filter_8x1_pixels(&sig[i << 2], f, &res[i]);
}
const __m256i l0l1 = _mm256_packus_epi32(res[0], res[1]);
const __m256i h0h1 = _mm256_packus_epi32(res[2], res[3]);
*y0 = _mm256_permute2x128_si256(l0l1, h0h1, 0x20);
*y1 = _mm256_permute2x128_si256(l0l1, h0h1, 0x31);
{
const __m256i l0l1 = _mm256_packus_epi32(res[0], res[1]);
const __m256i h0h1 = _mm256_packus_epi32(res[2], res[3]);
*y0 = _mm256_permute2x128_si256(l0l1, h0h1, 0x20);
*y1 = _mm256_permute2x128_si256(l0l1, h0h1, 0x31);
}
}
static INLINE void write_16x2_pixels(const __m256i *y0, const __m256i *y1,
static INLINE void store_16x2_pixels(const __m256i *y0, const __m256i *y1,
const __m256i *mask, uint16_t *dst,
ptrdiff_t pitch) {
__m256i p = _mm256_min_epi16(*y0, *mask);
@ -785,26 +689,14 @@ static INLINE void write_16x2_pixels(const __m256i *y0, const __m256i *y1,
_mm256_storeu_si256((__m256i *)(dst + pitch), p);
}
static INLINE void write_16x1_pixels_ver(const __m256i *y0, const __m256i *y1,
const __m256i *mask, uint16_t *dst,
ptrdiff_t pitch) {
(void)y1;
(void)pitch;
const __m256i p = _mm256_min_epi16(*y0, *mask);
_mm256_storeu_si256((__m256i *)dst, p);
}
static void update_16x9_pixels(__m256i *sig) {
update_pixels(&sig[0]);
update_pixels(&sig[8]);
}
static void filter_block_width16_vert(const uint16_t *src_ptr,
ptrdiff_t src_pitch,
WritePixels write_16x1,
WritePixels write_16x2, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height,
const int16_t *filter, int bd) {
static void aom_highbd_filter_block1d16_v8_avx2(
const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
__m256i signal[17], res0, res1;
const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
@ -816,29 +708,16 @@ static void filter_block_width16_vert(const uint16_t *src_ptr,
do {
pack_16x9_pixels(src_ptr, src_pitch, signal);
filter_16x9_pixels(signal, ff, &res0, &res1);
write_16x2(&res0, &res1, &max, dst_ptr, dst_pitch);
store_16x2_pixels(&res0, &res1, &max, dst_ptr, dst_pitch);
update_16x9_pixels(signal);
src_ptr += src_pitch << 1;
dst_ptr += dst_pitch << 1;
height -= 2;
} while (height > 1);
if (height > 0) {
pack_16x9_pixels(src_ptr, src_pitch, signal);
filter_16x9_pixels(signal, ff, &res0, &res1);
write_16x1(&res0, &res1, &max, dst_ptr, dst_pitch);
}
}
static void aom_highbd_filter_block1d16_v8_avx2(
const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
filter_block_width16_vert(src, src_pitch, write_16x1_pixels_ver,
write_16x2_pixels, dst, dst_pitch, height, filter,
bd);
} while (height > 0);
}
// -----------------------------------------------------------------------------
// 2-tap vertical filtering
static void pack_16x2_init(const uint16_t *src, __m256i *sig) {
@ -859,12 +738,9 @@ static INLINE void filter_16x2_2t_pixels(const __m256i *sig, const __m256i *f,
filter_16_2t_pixels(sig, f, y0, y1);
}
static void filter_block_width16_2t_vert(const uint16_t *src_ptr,
ptrdiff_t src_pitch,
WritePixels write_16x1,
uint16_t *dst_ptr, ptrdiff_t dst_pitch,
uint32_t height, const int16_t *filter,
int bd) {
static void aom_highbd_filter_block1d16_v2_avx2(
const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
__m256i signal[3], res0, res1;
const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
__m256i ff;
@ -875,7 +751,7 @@ static void filter_block_width16_2t_vert(const uint16_t *src_ptr,
do {
pack_16x2_2t_pixels(src_ptr, src_pitch, signal);
filter_16x2_2t_pixels(signal, &ff, &res0, &res1);
write_16x1(&res0, &res1, &max, dst_ptr, dst_pitch);
store_16x1_pixels(&res0, &res1, &max, dst_ptr);
src_ptr += src_pitch;
dst_ptr += dst_pitch;
@ -883,13 +759,6 @@ static void filter_block_width16_2t_vert(const uint16_t *src_ptr,
} while (height > 0);
}
static void aom_highbd_filter_block1d16_v2_avx2(
const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
filter_block_width16_2t_vert(src, src_pitch, write_16x1_pixels, dst,
dst_pitch, height, filter, bd);
}
static INLINE void pack_8x1_2t_filter(const int16_t *filter, __m128i *f) {
const __m128i h = _mm_loadu_si128((const __m128i *)filter);
const __m128i p = _mm_set1_epi32(0x09080706);
@ -920,22 +789,16 @@ static INLINE void filter_8_2t_pixels(const __m128i *sig, const __m128i *f,
*y1 = _mm_srai_epi32(x1, CONV8_ROUNDING_BITS);
}
static void write_8x1_2t_pixels_ver(const __m128i *y0, const __m128i *y1,
const __m128i *mask, uint16_t *dst) {
static INLINE void store_8x1_2t_pixels_ver(const __m128i *y0, const __m128i *y1,
const __m128i *mask, uint16_t *dst) {
__m128i res = _mm_packus_epi32(*y0, *y1);
res = _mm_min_epi16(res, *mask);
_mm_storeu_si128((__m128i *)dst, res);
}
typedef void (*Write8Pixels)(const __m128i *y0, const __m128i *y1,
const __m128i *mask, uint16_t *dst);
static void filter_block_width8_2t_vert(const uint16_t *src_ptr,
ptrdiff_t src_pitch,
Write8Pixels write_8x1,
uint16_t *dst_ptr, ptrdiff_t dst_pitch,
uint32_t height, const int16_t *filter,
int bd) {
static void aom_highbd_filter_block1d8_v2_avx2(
const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
__m128i signal[3], res0, res1;
const __m128i max = _mm_set1_epi16((1 << bd) - 1);
__m128i ff;
@ -946,7 +809,7 @@ static void filter_block_width8_2t_vert(const uint16_t *src_ptr,
do {
pack_8x2_2t_pixels_ver(src_ptr, src_pitch, signal);
filter_8_2t_pixels(signal, &ff, &res0, &res1);
write_8x1(&res0, &res1, &max, dst_ptr);
store_8x1_2t_pixels_ver(&res0, &res1, &max, dst_ptr);
src_ptr += src_pitch;
dst_ptr += dst_pitch;
@ -954,20 +817,10 @@ static void filter_block_width8_2t_vert(const uint16_t *src_ptr,
} while (height > 0);
}
static void aom_highbd_filter_block1d8_v2_avx2(
const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
filter_block_width8_2t_vert(src, src_pitch, write_8x1_2t_pixels_ver, dst,
dst_pitch, height, filter, bd);
}
// Calculation with averaging the input pixels
static void write_8x1_avg_pixels(const __m256i *y0, const __m256i *y1,
const __m256i *mask, uint16_t *dst,
ptrdiff_t pitch) {
(void)y1;
(void)pitch;
static INLINE void store_8x1_avg_pixels(const __m256i *y0, const __m256i *mask,
uint16_t *dst) {
const __m128i a0 = _mm256_castsi256_si128(*y0);
const __m128i a1 = _mm256_extractf128_si256(*y0, 1);
__m128i res = _mm_packus_epi32(a0, a1);
@ -977,9 +830,9 @@ static void write_8x1_avg_pixels(const __m256i *y0, const __m256i *y1,
_mm_storeu_si128((__m128i *)dst, res);
}
static void write_8x2_avg_pixels(const __m256i *y0, const __m256i *y1,
const __m256i *mask, uint16_t *dst,
ptrdiff_t pitch) {
static INLINE void store_8x2_avg_pixels(const __m256i *y0, const __m256i *y1,
const __m256i *mask, uint16_t *dst,
ptrdiff_t pitch) {
__m256i a = _mm256_packus_epi32(*y0, *y1);
const __m128i pix0 = _mm_loadu_si128((const __m128i *)dst);
const __m128i pix1 = _mm_loadu_si128((const __m128i *)(dst + pitch));
@ -991,10 +844,8 @@ static void write_8x2_avg_pixels(const __m256i *y0, const __m256i *y1,
_mm_storeu_si128((__m128i *)(dst + pitch), _mm256_extractf128_si256(a, 1));
}
static void write_16x1_avg_pixels(const __m256i *y0, const __m256i *y1,
const __m256i *mask, uint16_t *dst,
ptrdiff_t pitch) {
(void)pitch;
static INLINE void store_16x1_avg_pixels(const __m256i *y0, const __m256i *y1,
const __m256i *mask, uint16_t *dst) {
__m256i a = _mm256_packus_epi32(*y0, *y1);
const __m256i pix = _mm256_loadu_si256((const __m256i *)dst);
a = _mm256_min_epi16(a, *mask);
@ -1002,21 +853,7 @@ static void write_16x1_avg_pixels(const __m256i *y0, const __m256i *y1,
_mm256_storeu_si256((__m256i *)dst, a);
}
static INLINE void write_8x1_avg_pixels_ver(const __m256i *y0,
const __m256i *y1,
const __m256i *mask, uint16_t *dst,
ptrdiff_t pitch) {
(void)pitch;
const __m128i v0 = _mm256_castsi256_si128(*y0);
const __m128i v1 = _mm256_castsi256_si128(*y1);
__m128i p = _mm_packus_epi32(v0, v1);
const __m128i pix = _mm_loadu_si128((const __m128i *)dst);
p = _mm_min_epi16(p, _mm256_castsi256_si128(*mask));
p = _mm_avg_epu16(p, pix);
_mm_storeu_si128((__m128i *)dst, p);
}
static INLINE void write_16x2_avg_pixels(const __m256i *y0, const __m256i *y1,
static INLINE void store_16x2_avg_pixels(const __m256i *y0, const __m256i *y1,
const __m256i *mask, uint16_t *dst,
ptrdiff_t pitch) {
const __m256i pix0 = _mm256_loadu_si256((const __m256i *)dst);
@ -1030,20 +867,10 @@ static INLINE void write_16x2_avg_pixels(const __m256i *y0, const __m256i *y1,
_mm256_storeu_si256((__m256i *)(dst + pitch), p);
}
static INLINE void write_16x1_avg_pixels_ver(const __m256i *y0,
const __m256i *y1,
const __m256i *mask, uint16_t *dst,
ptrdiff_t pitch) {
(void)y1;
(void)pitch;
__m256i p = _mm256_min_epi16(*y0, *mask);
const __m256i pix = _mm256_loadu_si256((const __m256i *)dst);
p = _mm256_avg_epu16(p, pix);
_mm256_storeu_si256((__m256i *)dst, p);
}
static void write_8x1_2t_avg_pixels_ver(const __m128i *y0, const __m128i *y1,
const __m128i *mask, uint16_t *dst) {
static INLINE void store_8x1_2t_avg_pixels_ver(const __m128i *y0,
const __m128i *y1,
const __m128i *mask,
uint16_t *dst) {
__m128i res = _mm_packus_epi32(*y0, *y1);
const __m128i pix = _mm_loadu_si128((const __m128i *)dst);
res = _mm_min_epi16(res, *mask);
@ -1052,96 +879,229 @@ static void write_8x1_2t_avg_pixels_ver(const __m128i *y0, const __m128i *y1,
}
static void aom_highbd_filter_block1d8_h8_avg_avx2(
const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
filter_block_width8_horiz(src, src_pitch, write_8x1_avg_pixels,
write_8x2_avg_pixels, dst, dst_pitch, height,
filter, bd);
__m256i signal[8], res0, res1;
const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
__m256i ff[4];
pack_filters(filter, ff);
src_ptr -= 3;
do {
pack_8x2_pixels(src_ptr, src_pitch, signal);
filter_8x1_pixels(signal, ff, &res0);
filter_8x1_pixels(&signal[4], ff, &res1);
store_8x2_avg_pixels(&res0, &res1, &max, dst_ptr, dst_pitch);
height -= 2;
src_ptr += src_pitch << 1;
dst_ptr += dst_pitch << 1;
} while (height > 1);
if (height > 0) {
pack_8x1_pixels(src_ptr, signal);
filter_8x1_pixels(signal, ff, &res0);
store_8x1_avg_pixels(&res0, &max, dst_ptr);
}
}
static void aom_highbd_filter_block1d16_h8_avg_avx2(
const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
filter_block_width16_horiz(src, src_pitch, write_16x1_avg_pixels, dst,
dst_pitch, height, filter, bd);
__m256i signal[8], res0, res1;
const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
__m256i ff[4];
pack_filters(filter, ff);
src_ptr -= 3;
do {
pack_16x1_pixels(src_ptr, signal);
filter_8x1_pixels(signal, ff, &res0);
filter_8x1_pixels(&signal[4], ff, &res1);
store_16x1_avg_pixels(&res0, &res1, &max, dst_ptr);
height -= 1;
src_ptr += src_pitch;
dst_ptr += dst_pitch;
} while (height > 0);
}
static void aom_highbd_filter_block1d8_v8_avg_avx2(
const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
filter_block_width8_vert(src, src_pitch, write_8x1_avg_pixels_ver,
write_8x2_avg_pixels, dst, dst_pitch, height, filter,
bd);
__m256i signal[9], res0, res1;
const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
__m256i ff[4];
pack_filters(filter, ff);
pack_8x9_init(src_ptr, src_pitch, signal);
do {
pack_8x9_pixels(src_ptr, src_pitch, signal);
filter_8x9_pixels(signal, ff, &res0, &res1);
store_8x2_avg_pixels(&res0, &res1, &max, dst_ptr, dst_pitch);
update_pixels(signal);
src_ptr += src_pitch << 1;
dst_ptr += dst_pitch << 1;
height -= 2;
} while (height > 0);
}
static void aom_highbd_filter_block1d16_v8_avg_avx2(
const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
filter_block_width16_vert(src, src_pitch, write_16x1_avg_pixels_ver,
write_16x2_avg_pixels, dst, dst_pitch, height,
filter, bd);
__m256i signal[17], res0, res1;
const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
__m256i ff[4];
pack_filters(filter, ff);
pack_16x9_init(src_ptr, src_pitch, signal);
do {
pack_16x9_pixels(src_ptr, src_pitch, signal);
filter_16x9_pixels(signal, ff, &res0, &res1);
store_16x2_avg_pixels(&res0, &res1, &max, dst_ptr, dst_pitch);
update_16x9_pixels(signal);
src_ptr += src_pitch << 1;
dst_ptr += dst_pitch << 1;
height -= 2;
} while (height > 0);
}
// 2-tap averaging
static void aom_highbd_filter_block1d8_h2_avg_avx2(
const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
filter_block_width8_2t_horiz(src, src_pitch, write_8x1_avg_pixels,
write_8x2_avg_pixels, dst, dst_pitch, height,
filter, bd);
__m256i signal[2], res0, res1;
const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
__m256i ff;
pack_2t_filter(filter, &ff);
src_ptr -= 3;
do {
pack_8x2_2t_pixels(src_ptr, src_pitch, signal);
filter_16_2t_pixels(signal, &ff, &res0, &res1);
store_8x2_avg_pixels(&res0, &res1, &max, dst_ptr, dst_pitch);
height -= 2;
src_ptr += src_pitch << 1;
dst_ptr += dst_pitch << 1;
} while (height > 1);
if (height > 0) {
pack_8x1_2t_pixels(src_ptr, signal);
filter_8x1_2t_pixels(signal, &ff, &res0);
store_8x1_avg_pixels(&res0, &max, dst_ptr);
}
}
static void aom_highbd_filter_block1d16_h2_avg_avx2(
const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
filter_block_width16_2t_horiz(src, src_pitch, write_16x1_avg_pixels, dst,
dst_pitch, height, filter, bd);
__m256i signal[2], res0, res1;
const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
__m256i ff;
pack_2t_filter(filter, &ff);
src_ptr -= 3;
do {
pack_16x1_2t_pixels(src_ptr, signal);
filter_16_2t_pixels(signal, &ff, &res0, &res1);
store_16x1_avg_pixels(&res0, &res1, &max, dst_ptr);
height -= 1;
src_ptr += src_pitch;
dst_ptr += dst_pitch;
} while (height > 0);
}
static void aom_highbd_filter_block1d16_v2_avg_avx2(
const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
filter_block_width16_2t_vert(src, src_pitch, write_16x1_avg_pixels, dst,
dst_pitch, height, filter, bd);
__m256i signal[3], res0, res1;
const __m256i max = _mm256_set1_epi16((1 << bd) - 1);
__m256i ff;
pack_2t_filter(filter, &ff);
pack_16x2_init(src_ptr, signal);
do {
pack_16x2_2t_pixels(src_ptr, src_pitch, signal);
filter_16x2_2t_pixels(signal, &ff, &res0, &res1);
store_16x1_avg_pixels(&res0, &res1, &max, dst_ptr);
src_ptr += src_pitch;
dst_ptr += dst_pitch;
height -= 1;
} while (height > 0);
}
static void aom_highbd_filter_block1d8_v2_avg_avx2(
const uint16_t *src, ptrdiff_t src_pitch, uint16_t *dst,
const uint16_t *src_ptr, ptrdiff_t src_pitch, uint16_t *dst_ptr,
ptrdiff_t dst_pitch, uint32_t height, const int16_t *filter, int bd) {
filter_block_width8_2t_vert(src, src_pitch, write_8x1_2t_avg_pixels_ver, dst,
dst_pitch, height, filter, bd);
__m128i signal[3], res0, res1;
const __m128i max = _mm_set1_epi16((1 << bd) - 1);
__m128i ff;
pack_8x1_2t_filter(filter, &ff);
pack_8x2_init(src_ptr, signal);
do {
pack_8x2_2t_pixels_ver(src_ptr, src_pitch, signal);
filter_8_2t_pixels(signal, &ff, &res0, &res1);
store_8x1_2t_avg_pixels_ver(&res0, &res1, &max, dst_ptr);
src_ptr += src_pitch;
dst_ptr += dst_pitch;
height -= 1;
} while (height > 0);
}
typedef void HbdFilter1dFunc(const uint16_t *, ptrdiff_t, uint16_t *, ptrdiff_t,
uint32_t, const int16_t *, int);
#define HIGHBD_FUNC(width, dir, avg, opt) \
aom_highbd_filter_block1d##width##_##dir##_##avg##opt
HbdFilter1dFunc HIGHBD_FUNC(4, h8, , sse2);
HbdFilter1dFunc HIGHBD_FUNC(4, h2, , sse2);
HbdFilter1dFunc HIGHBD_FUNC(4, v8, , sse2);
HbdFilter1dFunc HIGHBD_FUNC(4, v2, , sse2);
#define aom_highbd_filter_block1d4_h8_avx2 HIGHBD_FUNC(4, h8, , sse2)
#define aom_highbd_filter_block1d4_h2_avx2 HIGHBD_FUNC(4, h2, , sse2)
#define aom_highbd_filter_block1d4_v8_avx2 HIGHBD_FUNC(4, v8, , sse2)
#define aom_highbd_filter_block1d4_v2_avx2 HIGHBD_FUNC(4, v2, , sse2)
void aom_highbd_filter_block1d4_h8_sse2(const uint16_t *, ptrdiff_t, uint16_t *,
ptrdiff_t, uint32_t, const int16_t *,
int);
void aom_highbd_filter_block1d4_h2_sse2(const uint16_t *, ptrdiff_t, uint16_t *,
ptrdiff_t, uint32_t, const int16_t *,
int);
void aom_highbd_filter_block1d4_v8_sse2(const uint16_t *, ptrdiff_t, uint16_t *,
ptrdiff_t, uint32_t, const int16_t *,
int);
void aom_highbd_filter_block1d4_v2_sse2(const uint16_t *, ptrdiff_t, uint16_t *,
ptrdiff_t, uint32_t, const int16_t *,
int);
#define aom_highbd_filter_block1d4_h8_avx2 aom_highbd_filter_block1d4_h8_sse2
#define aom_highbd_filter_block1d4_h2_avx2 aom_highbd_filter_block1d4_h2_sse2
#define aom_highbd_filter_block1d4_v8_avx2 aom_highbd_filter_block1d4_v8_sse2
#define aom_highbd_filter_block1d4_v2_avx2 aom_highbd_filter_block1d4_v2_sse2
HIGH_FUN_CONV_1D(horiz, x_step_q4, filter_x, h, src, , avx2);
HIGH_FUN_CONV_1D(vert, y_step_q4, filter_y, v, src - src_stride * 3, , avx2);
HIGH_FUN_CONV_2D(, avx2);
HbdFilter1dFunc HIGHBD_FUNC(4, h8, avg_, sse2);
HbdFilter1dFunc HIGHBD_FUNC(4, h2, avg_, sse2);
HbdFilter1dFunc HIGHBD_FUNC(4, v8, avg_, sse2);
HbdFilter1dFunc HIGHBD_FUNC(4, v2, avg_, sse2);
#define aom_highbd_filter_block1d4_h8_avg_avx2 HIGHBD_FUNC(4, h8, avg_, sse2)
#define aom_highbd_filter_block1d4_h2_avg_avx2 HIGHBD_FUNC(4, h2, avg_, sse2)
#define aom_highbd_filter_block1d4_v8_avg_avx2 HIGHBD_FUNC(4, v8, avg_, sse2)
#define aom_highbd_filter_block1d4_v2_avg_avx2 HIGHBD_FUNC(4, v2, avg_, sse2)
void aom_highbd_filter_block1d4_h8_avg_sse2(const uint16_t *, ptrdiff_t,
uint16_t *, ptrdiff_t, uint32_t,
const int16_t *, int);
void aom_highbd_filter_block1d4_h2_avg_sse2(const uint16_t *, ptrdiff_t,
uint16_t *, ptrdiff_t, uint32_t,
const int16_t *, int);
void aom_highbd_filter_block1d4_v8_avg_sse2(const uint16_t *, ptrdiff_t,
uint16_t *, ptrdiff_t, uint32_t,
const int16_t *, int);
void aom_highbd_filter_block1d4_v2_avg_sse2(const uint16_t *, ptrdiff_t,
uint16_t *, ptrdiff_t, uint32_t,
const int16_t *, int);
#define aom_highbd_filter_block1d4_h8_avg_avx2 \
aom_highbd_filter_block1d4_h8_avg_sse2
#define aom_highbd_filter_block1d4_h2_avg_avx2 \
aom_highbd_filter_block1d4_h2_avg_sse2
#define aom_highbd_filter_block1d4_v8_avg_avx2 \
aom_highbd_filter_block1d4_v8_avg_sse2
#define aom_highbd_filter_block1d4_v2_avg_avx2 \
aom_highbd_filter_block1d4_v2_avg_sse2
HIGH_FUN_CONV_1D(avg_horiz, x_step_q4, filter_x, h, src, avg_, avx2);
HIGH_FUN_CONV_1D(avg_vert, y_step_q4, filter_y, v, src - src_stride * 3, avg_,

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,80 @@
/*
* Copyright (c) 2017, 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_DSP_X86_INV_TXFM_COMMON_AVX2_H
#define AOM_DSP_X86_INV_TXFM_COMMON_AVX2_H
#include <immintrin.h>
#include "aom_dsp/txfm_common.h"
#include "aom_dsp/x86/txfm_common_avx2.h"
static INLINE void load_coeff(const tran_low_t *coeff, __m256i *in) {
#if CONFIG_HIGHBITDEPTH
*in = _mm256_setr_epi16(
(int16_t)coeff[0], (int16_t)coeff[1], (int16_t)coeff[2],
(int16_t)coeff[3], (int16_t)coeff[4], (int16_t)coeff[5],
(int16_t)coeff[6], (int16_t)coeff[7], (int16_t)coeff[8],
(int16_t)coeff[9], (int16_t)coeff[10], (int16_t)coeff[11],
(int16_t)coeff[12], (int16_t)coeff[13], (int16_t)coeff[14],
(int16_t)coeff[15]);
#else
*in = _mm256_loadu_si256((const __m256i *)coeff);
#endif
}
static INLINE void load_buffer_16x16(const tran_low_t *coeff, __m256i *in) {
int i = 0;
while (i < 16) {
load_coeff(coeff + (i << 4), &in[i]);
i += 1;
}
}
static INLINE void recon_and_store(const __m256i *res, uint8_t *output) {
const __m128i zero = _mm_setzero_si128();
__m128i x = _mm_loadu_si128((__m128i const *)output);
__m128i p0 = _mm_unpacklo_epi8(x, zero);
__m128i p1 = _mm_unpackhi_epi8(x, zero);
p0 = _mm_add_epi16(p0, _mm256_castsi256_si128(*res));
p1 = _mm_add_epi16(p1, _mm256_extractf128_si256(*res, 1));
x = _mm_packus_epi16(p0, p1);
_mm_storeu_si128((__m128i *)output, x);
}
#define IDCT_ROUNDING_POS (6)
static INLINE void store_buffer_16xN(__m256i *in, const int stride,
uint8_t *output, int num) {
const __m256i rounding = _mm256_set1_epi16(1 << (IDCT_ROUNDING_POS - 1));
int i = 0;
while (i < num) {
in[i] = _mm256_adds_epi16(in[i], rounding);
in[i] = _mm256_srai_epi16(in[i], IDCT_ROUNDING_POS);
recon_and_store(&in[i], output + i * stride);
i += 1;
}
}
static INLINE void unpack_butter_fly(const __m256i *a0, const __m256i *a1,
const __m256i *c0, const __m256i *c1,
__m256i *b0, __m256i *b1) {
__m256i x0, x1;
x0 = _mm256_unpacklo_epi16(*a0, *a1);
x1 = _mm256_unpackhi_epi16(*a0, *a1);
*b0 = butter_fly(&x0, &x1, c0);
*b1 = butter_fly(&x0, &x1, c1);
}
void av1_idct16_avx2(__m256i *in);
#endif // AOM_DSP_X86_INV_TXFM_COMMON_AVX2_H

View file

@ -3628,4 +3628,107 @@ void aom_highbd_idct4x4_16_add_sse2(const tran_low_t *input, uint8_t *dest8,
}
}
void aom_highbd_idct8x8_10_add_sse2(const tran_low_t *input, uint8_t *dest8,
int stride, int bd) {
tran_low_t out[8 * 8] = { 0 };
tran_low_t *outptr = out;
int i, j, test;
__m128i inptr[8];
__m128i min_input, max_input, temp1, temp2, sign_bits;
uint16_t *dest = CONVERT_TO_SHORTPTR(dest8);
const __m128i zero = _mm_set1_epi16(0);
const __m128i sixteen = _mm_set1_epi16(16);
const __m128i max = _mm_set1_epi16(6201);
const __m128i min = _mm_set1_epi16(-6201);
int optimised_cols = 0;
// Load input into __m128i & pack to 16 bits
for (i = 0; i < 8; i++) {
temp1 = _mm_loadu_si128((const __m128i *)(input + 8 * i));
temp2 = _mm_loadu_si128((const __m128i *)(input + 8 * i + 4));
inptr[i] = _mm_packs_epi32(temp1, temp2);
}
// Find the min & max for the row transform
// only first 4 row has non-zero coefs
max_input = _mm_max_epi16(inptr[0], inptr[1]);
min_input = _mm_min_epi16(inptr[0], inptr[1]);
for (i = 2; i < 4; i++) {
max_input = _mm_max_epi16(max_input, inptr[i]);
min_input = _mm_min_epi16(min_input, inptr[i]);
}
max_input = _mm_cmpgt_epi16(max_input, max);
min_input = _mm_cmplt_epi16(min_input, min);
temp1 = _mm_or_si128(max_input, min_input);
test = _mm_movemask_epi8(temp1);
if (!test) {
// Do the row transform
aom_idct8_sse2(inptr);
// Find the min & max for the column transform
// N.B. Only first 4 cols contain non-zero coeffs
max_input = _mm_max_epi16(inptr[0], inptr[1]);
min_input = _mm_min_epi16(inptr[0], inptr[1]);
for (i = 2; i < 8; i++) {
max_input = _mm_max_epi16(max_input, inptr[i]);
min_input = _mm_min_epi16(min_input, inptr[i]);
}
max_input = _mm_cmpgt_epi16(max_input, max);
min_input = _mm_cmplt_epi16(min_input, min);
temp1 = _mm_or_si128(max_input, min_input);
test = _mm_movemask_epi8(temp1);
if (test) {
// Use fact only first 4 rows contain non-zero coeffs
array_transpose_4X8(inptr, inptr);
for (i = 0; i < 4; i++) {
sign_bits = _mm_cmplt_epi16(inptr[i], zero);
temp1 = _mm_unpackhi_epi16(inptr[i], sign_bits);
temp2 = _mm_unpacklo_epi16(inptr[i], sign_bits);
_mm_storeu_si128((__m128i *)(outptr + 4 * (2 * i + 1)), temp1);
_mm_storeu_si128((__m128i *)(outptr + 4 * (2 * i)), temp2);
}
} else {
// Set to use the optimised transform for the column
optimised_cols = 1;
}
} else {
// Run the un-optimised row transform
for (i = 0; i < 4; ++i) {
aom_highbd_idct8_c(input, outptr, bd);
input += 8;
outptr += 8;
}
}
if (optimised_cols) {
aom_idct8_sse2(inptr);
// Final round & shift and Reconstruction and Store
{
__m128i d[8];
for (i = 0; i < 8; i++) {
inptr[i] = _mm_add_epi16(inptr[i], sixteen);
d[i] = _mm_loadu_si128((const __m128i *)(dest + stride * i));
inptr[i] = _mm_srai_epi16(inptr[i], 5);
d[i] = clamp_high_sse2(_mm_adds_epi16(d[i], inptr[i]), bd);
// Store
_mm_storeu_si128((__m128i *)(dest + stride * i), d[i]);
}
}
} else {
// Run the un-optimised column transform
tran_low_t temp_in[8], temp_out[8];
for (i = 0; i < 8; ++i) {
for (j = 0; j < 8; ++j) temp_in[j] = out[j * 8 + i];
aom_highbd_idct8_c(temp_in, temp_out, bd);
for (j = 0; j < 8; ++j) {
dest[j * stride + i] = highbd_clip_pixel_add(
dest[j * stride + i], ROUND_POWER_OF_TWO(temp_out[j], 5), bd);
}
}
}
}
#endif // CONFIG_HIGHBITDEPTH

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
* Copyright (c) 2017, 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
@ -9,49 +9,70 @@
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#include <stdlib.h>
#include <emmintrin.h>
#include <stdio.h>
#include <tmmintrin.h>
#include "aom_ports/mem.h"
#include "./aom_config.h"
#include "./aom_dsp_rtcd.h"
#include "aom_dsp/blend.h"
#include "aom/aom_integer.h"
#include "aom_dsp/x86/synonyms.h"
static INLINE __m128i width8_load_2rows(const uint8_t *ptr, int stride) {
__m128i temp1 = _mm_loadl_epi64((const __m128i *)ptr);
__m128i temp2 = _mm_loadl_epi64((const __m128i *)(ptr + stride));
return _mm_unpacklo_epi64(temp1, temp2);
}
static INLINE __m128i width4_load_4rows(const uint8_t *ptr, int stride) {
__m128i temp1 = _mm_cvtsi32_si128(*(const uint32_t *)ptr);
__m128i temp2 = _mm_cvtsi32_si128(*(const uint32_t *)(ptr + stride));
__m128i temp3 = _mm_unpacklo_epi32(temp1, temp2);
temp1 = _mm_cvtsi32_si128(*(const uint32_t *)(ptr + stride * 2));
temp2 = _mm_cvtsi32_si128(*(const uint32_t *)(ptr + stride * 3));
temp1 = _mm_unpacklo_epi32(temp1, temp2);
return _mm_unpacklo_epi64(temp3, temp1);
}
static INLINE unsigned int masked_sad_ssse3(const uint8_t *a_ptr, int a_stride,
// For width a multiple of 16
static INLINE unsigned int masked_sad_ssse3(const uint8_t *src_ptr,
int src_stride,
const uint8_t *a_ptr, int a_stride,
const uint8_t *b_ptr, int b_stride,
const uint8_t *m_ptr, int m_stride,
int width, int height);
static INLINE unsigned int masked_sad8xh_ssse3(
const uint8_t *a_ptr, int a_stride, const uint8_t *b_ptr, int b_stride,
const uint8_t *m_ptr, int m_stride, int height);
const uint8_t *src_ptr, int src_stride, const uint8_t *a_ptr, int a_stride,
const uint8_t *b_ptr, int b_stride, const uint8_t *m_ptr, int m_stride,
int height);
static INLINE unsigned int masked_sad4xh_ssse3(
const uint8_t *a_ptr, int a_stride, const uint8_t *b_ptr, int b_stride,
const uint8_t *m_ptr, int m_stride, int height);
const uint8_t *src_ptr, int src_stride, const uint8_t *a_ptr, int a_stride,
const uint8_t *b_ptr, int b_stride, const uint8_t *m_ptr, int m_stride,
int height);
#define MASKSADMXN_SSSE3(m, n) \
unsigned int aom_masked_sad##m##x##n##_ssse3( \
const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride, \
const uint8_t *msk, int msk_stride) { \
return masked_sad_ssse3(src, src_stride, ref, ref_stride, msk, msk_stride, \
m, n); \
#define MASKSADMXN_SSSE3(m, n) \
unsigned int aom_masked_sad##m##x##n##_ssse3( \
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) { \
if (!invert_mask) \
return masked_sad_ssse3(src, src_stride, ref, ref_stride, second_pred, \
m, msk, msk_stride, m, n); \
else \
return masked_sad_ssse3(src, src_stride, second_pred, m, ref, \
ref_stride, msk, msk_stride, m, n); \
}
#define MASKSAD8XN_SSSE3(n) \
unsigned int aom_masked_sad8x##n##_ssse3( \
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) { \
if (!invert_mask) \
return masked_sad8xh_ssse3(src, src_stride, ref, ref_stride, \
second_pred, 8, msk, msk_stride, n); \
else \
return masked_sad8xh_ssse3(src, src_stride, second_pred, 8, ref, \
ref_stride, msk, msk_stride, n); \
}
#define MASKSAD4XN_SSSE3(n) \
unsigned int aom_masked_sad4x##n##_ssse3( \
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) { \
if (!invert_mask) \
return masked_sad4xh_ssse3(src, src_stride, ref, ref_stride, \
second_pred, 4, msk, msk_stride, n); \
else \
return masked_sad4xh_ssse3(src, src_stride, second_pred, 4, ref, \
ref_stride, msk, msk_stride, n); \
}
#if CONFIG_EXT_PARTITION
@ -67,165 +88,181 @@ MASKSADMXN_SSSE3(32, 16)
MASKSADMXN_SSSE3(16, 32)
MASKSADMXN_SSSE3(16, 16)
MASKSADMXN_SSSE3(16, 8)
#define MASKSAD8XN_SSSE3(n) \
unsigned int aom_masked_sad8x##n##_ssse3( \
const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride, \
const uint8_t *msk, int msk_stride) { \
return masked_sad8xh_ssse3(src, src_stride, ref, ref_stride, msk, \
msk_stride, n); \
}
MASKSAD8XN_SSSE3(16)
MASKSAD8XN_SSSE3(8)
MASKSAD8XN_SSSE3(4)
#define MASKSAD4XN_SSSE3(n) \
unsigned int aom_masked_sad4x##n##_ssse3( \
const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride, \
const uint8_t *msk, int msk_stride) { \
return masked_sad4xh_ssse3(src, src_stride, ref, ref_stride, msk, \
msk_stride, n); \
}
MASKSAD4XN_SSSE3(8)
MASKSAD4XN_SSSE3(4)
// For width a multiple of 16
// Assumes values in m are <=64
static INLINE unsigned int masked_sad_ssse3(const uint8_t *a_ptr, int a_stride,
static INLINE unsigned int masked_sad_ssse3(const uint8_t *src_ptr,
int src_stride,
const uint8_t *a_ptr, int a_stride,
const uint8_t *b_ptr, int b_stride,
const uint8_t *m_ptr, int m_stride,
int width, int height) {
int y, x;
__m128i a, b, m, temp1, temp2;
int x, y;
__m128i res = _mm_setzero_si128();
__m128i one = _mm_set1_epi16(1);
// For each row
const __m128i mask_max = _mm_set1_epi8((1 << AOM_BLEND_A64_ROUND_BITS));
for (y = 0; y < height; y++) {
// Covering the full width
for (x = 0; x < width; x += 16) {
// Load a, b, m in xmm registers
a = _mm_loadu_si128((const __m128i *)(a_ptr + x));
b = _mm_loadu_si128((const __m128i *)(b_ptr + x));
m = _mm_loadu_si128((const __m128i *)(m_ptr + x));
const __m128i src = _mm_loadu_si128((const __m128i *)&src_ptr[x]);
const __m128i a = _mm_loadu_si128((const __m128i *)&a_ptr[x]);
const __m128i b = _mm_loadu_si128((const __m128i *)&b_ptr[x]);
const __m128i m = _mm_loadu_si128((const __m128i *)&m_ptr[x]);
const __m128i m_inv = _mm_sub_epi8(mask_max, m);
// Calculate the difference between a & b
temp1 = _mm_subs_epu8(a, b);
temp2 = _mm_subs_epu8(b, a);
temp1 = _mm_or_si128(temp1, temp2);
// Calculate 16 predicted pixels.
// Note that the maximum value of any entry of 'pred_l' or 'pred_r'
// is 64 * 255, so we have plenty of space to add rounding constants.
const __m128i data_l = _mm_unpacklo_epi8(a, b);
const __m128i mask_l = _mm_unpacklo_epi8(m, m_inv);
__m128i pred_l = _mm_maddubs_epi16(data_l, mask_l);
pred_l = xx_roundn_epu16(pred_l, AOM_BLEND_A64_ROUND_BITS);
// Multiply by m and add together
temp2 = _mm_maddubs_epi16(temp1, m);
// Pad out row result to 32 bit integers & add to running total
res = _mm_add_epi32(res, _mm_madd_epi16(temp2, one));
const __m128i data_r = _mm_unpackhi_epi8(a, b);
const __m128i mask_r = _mm_unpackhi_epi8(m, m_inv);
__m128i pred_r = _mm_maddubs_epi16(data_r, mask_r);
pred_r = xx_roundn_epu16(pred_r, AOM_BLEND_A64_ROUND_BITS);
const __m128i pred = _mm_packus_epi16(pred_l, pred_r);
res = _mm_add_epi32(res, _mm_sad_epu8(pred, src));
}
// Move onto the next row
src_ptr += src_stride;
a_ptr += a_stride;
b_ptr += b_stride;
m_ptr += m_stride;
}
res = _mm_hadd_epi32(res, _mm_setzero_si128());
res = _mm_hadd_epi32(res, _mm_setzero_si128());
// sad = (sad + 31) >> 6;
return (_mm_cvtsi128_si32(res) + 31) >> 6;
// At this point, we have two 32-bit partial SADs in lanes 0 and 2 of 'res'.
int32_t sad =
_mm_cvtsi128_si32(res) + _mm_cvtsi128_si32(_mm_srli_si128(res, 8));
return (sad + 31) >> 6;
}
static INLINE unsigned int masked_sad8xh_ssse3(
const uint8_t *a_ptr, int a_stride, const uint8_t *b_ptr, int b_stride,
const uint8_t *m_ptr, int m_stride, int height) {
const uint8_t *src_ptr, int src_stride, const uint8_t *a_ptr, int a_stride,
const uint8_t *b_ptr, int b_stride, const uint8_t *m_ptr, int m_stride,
int height) {
int y;
__m128i a, b, m, temp1, temp2, row_res;
__m128i res = _mm_setzero_si128();
__m128i one = _mm_set1_epi16(1);
// Add the masked SAD for 2 rows at a time
const __m128i mask_max = _mm_set1_epi8((1 << AOM_BLEND_A64_ROUND_BITS));
for (y = 0; y < height; y += 2) {
// Load a, b, m in xmm registers
a = width8_load_2rows(a_ptr, a_stride);
b = width8_load_2rows(b_ptr, b_stride);
m = width8_load_2rows(m_ptr, m_stride);
const __m128i src = _mm_unpacklo_epi64(
_mm_loadl_epi64((const __m128i *)src_ptr),
_mm_loadl_epi64((const __m128i *)&src_ptr[src_stride]));
const __m128i a0 = _mm_loadl_epi64((const __m128i *)a_ptr);
const __m128i a1 = _mm_loadl_epi64((const __m128i *)&a_ptr[a_stride]);
const __m128i b0 = _mm_loadl_epi64((const __m128i *)b_ptr);
const __m128i b1 = _mm_loadl_epi64((const __m128i *)&b_ptr[b_stride]);
const __m128i m =
_mm_unpacklo_epi64(_mm_loadl_epi64((const __m128i *)m_ptr),
_mm_loadl_epi64((const __m128i *)&m_ptr[m_stride]));
const __m128i m_inv = _mm_sub_epi8(mask_max, m);
// Calculate the difference between a & b
temp1 = _mm_subs_epu8(a, b);
temp2 = _mm_subs_epu8(b, a);
temp1 = _mm_or_si128(temp1, temp2);
const __m128i data_l = _mm_unpacklo_epi8(a0, b0);
const __m128i mask_l = _mm_unpacklo_epi8(m, m_inv);
__m128i pred_l = _mm_maddubs_epi16(data_l, mask_l);
pred_l = xx_roundn_epu16(pred_l, AOM_BLEND_A64_ROUND_BITS);
// Multiply by m and add together
row_res = _mm_maddubs_epi16(temp1, m);
const __m128i data_r = _mm_unpacklo_epi8(a1, b1);
const __m128i mask_r = _mm_unpackhi_epi8(m, m_inv);
__m128i pred_r = _mm_maddubs_epi16(data_r, mask_r);
pred_r = xx_roundn_epu16(pred_r, AOM_BLEND_A64_ROUND_BITS);
// Pad out row result to 32 bit integers & add to running total
res = _mm_add_epi32(res, _mm_madd_epi16(row_res, one));
const __m128i pred = _mm_packus_epi16(pred_l, pred_r);
res = _mm_add_epi32(res, _mm_sad_epu8(pred, src));
// Move onto the next rows
src_ptr += src_stride * 2;
a_ptr += a_stride * 2;
b_ptr += b_stride * 2;
m_ptr += m_stride * 2;
}
res = _mm_hadd_epi32(res, _mm_setzero_si128());
res = _mm_hadd_epi32(res, _mm_setzero_si128());
// sad = (sad + 31) >> 6;
return (_mm_cvtsi128_si32(res) + 31) >> 6;
int32_t sad =
_mm_cvtsi128_si32(res) + _mm_cvtsi128_si32(_mm_srli_si128(res, 8));
return (sad + 31) >> 6;
}
static INLINE unsigned int masked_sad4xh_ssse3(
const uint8_t *a_ptr, int a_stride, const uint8_t *b_ptr, int b_stride,
const uint8_t *m_ptr, int m_stride, int height) {
const uint8_t *src_ptr, int src_stride, const uint8_t *a_ptr, int a_stride,
const uint8_t *b_ptr, int b_stride, const uint8_t *m_ptr, int m_stride,
int height) {
int y;
__m128i a, b, m, temp1, temp2, row_res;
__m128i res = _mm_setzero_si128();
__m128i one = _mm_set1_epi16(1);
// Add the masked SAD for 4 rows at a time
for (y = 0; y < height; y += 4) {
// Load a, b, m in xmm registers
a = width4_load_4rows(a_ptr, a_stride);
b = width4_load_4rows(b_ptr, b_stride);
m = width4_load_4rows(m_ptr, m_stride);
const __m128i mask_max = _mm_set1_epi8((1 << AOM_BLEND_A64_ROUND_BITS));
// Calculate the difference between a & b
temp1 = _mm_subs_epu8(a, b);
temp2 = _mm_subs_epu8(b, a);
temp1 = _mm_or_si128(temp1, temp2);
for (y = 0; y < height; y += 2) {
// Load two rows at a time, this seems to be a bit faster
// than four rows at a time in this case.
const __m128i src = _mm_unpacklo_epi32(
_mm_cvtsi32_si128(*(uint32_t *)src_ptr),
_mm_cvtsi32_si128(*(uint32_t *)&src_ptr[src_stride]));
const __m128i a =
_mm_unpacklo_epi32(_mm_cvtsi32_si128(*(uint32_t *)a_ptr),
_mm_cvtsi32_si128(*(uint32_t *)&a_ptr[a_stride]));
const __m128i b =
_mm_unpacklo_epi32(_mm_cvtsi32_si128(*(uint32_t *)b_ptr),
_mm_cvtsi32_si128(*(uint32_t *)&b_ptr[b_stride]));
const __m128i m =
_mm_unpacklo_epi32(_mm_cvtsi32_si128(*(uint32_t *)m_ptr),
_mm_cvtsi32_si128(*(uint32_t *)&m_ptr[m_stride]));
const __m128i m_inv = _mm_sub_epi8(mask_max, m);
// Multiply by m and add together
row_res = _mm_maddubs_epi16(temp1, m);
const __m128i data = _mm_unpacklo_epi8(a, b);
const __m128i mask = _mm_unpacklo_epi8(m, m_inv);
__m128i pred_16bit = _mm_maddubs_epi16(data, mask);
pred_16bit = xx_roundn_epu16(pred_16bit, AOM_BLEND_A64_ROUND_BITS);
// Pad out row result to 32 bit integers & add to running total
res = _mm_add_epi32(res, _mm_madd_epi16(row_res, one));
const __m128i pred = _mm_packus_epi16(pred_16bit, _mm_setzero_si128());
res = _mm_add_epi32(res, _mm_sad_epu8(pred, src));
// Move onto the next rows
a_ptr += a_stride * 4;
b_ptr += b_stride * 4;
m_ptr += m_stride * 4;
src_ptr += src_stride * 2;
a_ptr += a_stride * 2;
b_ptr += b_stride * 2;
m_ptr += m_stride * 2;
}
// Pad out row result to 32 bit integers & add to running total
res = _mm_hadd_epi32(res, _mm_setzero_si128());
res = _mm_hadd_epi32(res, _mm_setzero_si128());
// sad = (sad + 31) >> 6;
return (_mm_cvtsi128_si32(res) + 31) >> 6;
// At this point, the SAD is stored in lane 0 of 'res'
int32_t sad = _mm_cvtsi128_si32(res);
return (sad + 31) >> 6;
}
#if CONFIG_HIGHBITDEPTH
static INLINE __m128i highbd_width4_load_2rows(const uint16_t *ptr,
int stride) {
__m128i temp1 = _mm_loadl_epi64((const __m128i *)ptr);
__m128i temp2 = _mm_loadl_epi64((const __m128i *)(ptr + stride));
return _mm_unpacklo_epi64(temp1, temp2);
}
// For width a multiple of 8
static INLINE unsigned int highbd_masked_sad_ssse3(
const uint8_t *a8_ptr, int a_stride, const uint8_t *b8_ptr, int b_stride,
const uint8_t *m_ptr, int m_stride, int width, int height);
const uint8_t *src8, int src_stride, const uint8_t *a8, int a_stride,
const uint8_t *b8, int b_stride, const uint8_t *m_ptr, int m_stride,
int width, int height);
static INLINE unsigned int highbd_masked_sad4xh_ssse3(
const uint8_t *a8_ptr, int a_stride, const uint8_t *b8_ptr, int b_stride,
const uint8_t *m_ptr, int m_stride, int height);
const uint8_t *src8, int src_stride, const uint8_t *a8, int a_stride,
const uint8_t *b8, int b_stride, const uint8_t *m_ptr, int m_stride,
int height);
#define HIGHBD_MASKSADMXN_SSSE3(m, n) \
unsigned int aom_highbd_masked_sad##m##x##n##_ssse3( \
const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride, \
const uint8_t *msk, int msk_stride) { \
return highbd_masked_sad_ssse3(src, src_stride, ref, ref_stride, msk, \
msk_stride, m, n); \
const uint8_t *src8, int src_stride, const uint8_t *ref8, \
int ref_stride, const uint8_t *second_pred8, const uint8_t *msk, \
int msk_stride, int invert_mask) { \
if (!invert_mask) \
return highbd_masked_sad_ssse3(src8, src_stride, ref8, ref_stride, \
second_pred8, m, msk, msk_stride, m, n); \
else \
return highbd_masked_sad_ssse3(src8, src_stride, second_pred8, m, ref8, \
ref_stride, msk, msk_stride, m, n); \
}
#define HIGHBD_MASKSAD4XN_SSSE3(n) \
unsigned int aom_highbd_masked_sad4x##n##_ssse3( \
const uint8_t *src8, int src_stride, const uint8_t *ref8, \
int ref_stride, const uint8_t *second_pred8, const uint8_t *msk, \
int msk_stride, int invert_mask) { \
if (!invert_mask) \
return highbd_masked_sad4xh_ssse3(src8, src_stride, ref8, ref_stride, \
second_pred8, 4, msk, msk_stride, n); \
else \
return highbd_masked_sad4xh_ssse3(src8, src_stride, second_pred8, 4, \
ref8, ref_stride, msk, msk_stride, n); \
}
#if CONFIG_EXT_PARTITION
@ -244,91 +281,124 @@ HIGHBD_MASKSADMXN_SSSE3(16, 8)
HIGHBD_MASKSADMXN_SSSE3(8, 16)
HIGHBD_MASKSADMXN_SSSE3(8, 8)
HIGHBD_MASKSADMXN_SSSE3(8, 4)
#define HIGHBD_MASKSAD4XN_SSSE3(n) \
unsigned int aom_highbd_masked_sad4x##n##_ssse3( \
const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride, \
const uint8_t *msk, int msk_stride) { \
return highbd_masked_sad4xh_ssse3(src, src_stride, ref, ref_stride, msk, \
msk_stride, n); \
}
HIGHBD_MASKSAD4XN_SSSE3(8)
HIGHBD_MASKSAD4XN_SSSE3(4)
// For width a multiple of 8
// Assumes values in m are <=64
static INLINE unsigned int highbd_masked_sad_ssse3(
const uint8_t *a8_ptr, int a_stride, const uint8_t *b8_ptr, int b_stride,
const uint8_t *m_ptr, int m_stride, int width, int height) {
int y, x;
__m128i a, b, m, temp1, temp2;
const uint16_t *a_ptr = CONVERT_TO_SHORTPTR(a8_ptr);
const uint16_t *b_ptr = CONVERT_TO_SHORTPTR(b8_ptr);
const uint8_t *src8, int src_stride, const uint8_t *a8, int a_stride,
const uint8_t *b8, int b_stride, const uint8_t *m_ptr, int m_stride,
int width, int height) {
const uint16_t *src_ptr = CONVERT_TO_SHORTPTR(src8);
const uint16_t *a_ptr = CONVERT_TO_SHORTPTR(a8);
const uint16_t *b_ptr = CONVERT_TO_SHORTPTR(b8);
int x, y;
__m128i res = _mm_setzero_si128();
// For each row
const __m128i mask_max = _mm_set1_epi16((1 << AOM_BLEND_A64_ROUND_BITS));
const __m128i round_const =
_mm_set1_epi32((1 << AOM_BLEND_A64_ROUND_BITS) >> 1);
const __m128i one = _mm_set1_epi16(1);
for (y = 0; y < height; y++) {
// Covering the full width
for (x = 0; x < width; x += 8) {
// Load a, b, m in xmm registers
a = _mm_loadu_si128((const __m128i *)(a_ptr + x));
b = _mm_loadu_si128((const __m128i *)(b_ptr + x));
m = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i *)(m_ptr + x)),
_mm_setzero_si128());
const __m128i src = _mm_loadu_si128((const __m128i *)&src_ptr[x]);
const __m128i a = _mm_loadu_si128((const __m128i *)&a_ptr[x]);
const __m128i b = _mm_loadu_si128((const __m128i *)&b_ptr[x]);
// Zero-extend mask to 16 bits
const __m128i m = _mm_unpacklo_epi8(
_mm_loadl_epi64((const __m128i *)&m_ptr[x]), _mm_setzero_si128());
const __m128i m_inv = _mm_sub_epi16(mask_max, m);
// Calculate the difference between a & b
temp1 = _mm_subs_epu16(a, b);
temp2 = _mm_subs_epu16(b, a);
temp1 = _mm_or_si128(temp1, temp2);
const __m128i data_l = _mm_unpacklo_epi16(a, b);
const __m128i mask_l = _mm_unpacklo_epi16(m, m_inv);
__m128i pred_l = _mm_madd_epi16(data_l, mask_l);
pred_l = _mm_srai_epi32(_mm_add_epi32(pred_l, round_const),
AOM_BLEND_A64_ROUND_BITS);
// Add result of multiplying by m and add pairs together to running total
res = _mm_add_epi32(res, _mm_madd_epi16(temp1, m));
const __m128i data_r = _mm_unpackhi_epi16(a, b);
const __m128i mask_r = _mm_unpackhi_epi16(m, m_inv);
__m128i pred_r = _mm_madd_epi16(data_r, mask_r);
pred_r = _mm_srai_epi32(_mm_add_epi32(pred_r, round_const),
AOM_BLEND_A64_ROUND_BITS);
// Note: the maximum value in pred_l/r is (2^bd)-1 < 2^15,
// so it is safe to do signed saturation here.
const __m128i pred = _mm_packs_epi32(pred_l, pred_r);
// There is no 16-bit SAD instruction, so we have to synthesize
// an 8-element SAD. We do this by storing 4 32-bit partial SADs,
// and accumulating them at the end
const __m128i diff = _mm_abs_epi16(_mm_sub_epi16(pred, src));
res = _mm_add_epi32(res, _mm_madd_epi16(diff, one));
}
// Move onto the next row
src_ptr += src_stride;
a_ptr += a_stride;
b_ptr += b_stride;
m_ptr += m_stride;
}
res = _mm_hadd_epi32(res, _mm_setzero_si128());
res = _mm_hadd_epi32(res, _mm_setzero_si128());
// sad = (sad + 31) >> 6;
return (_mm_cvtsi128_si32(res) + 31) >> 6;
// At this point, we have four 32-bit partial SADs stored in 'res'.
res = _mm_hadd_epi32(res, res);
res = _mm_hadd_epi32(res, res);
int sad = _mm_cvtsi128_si32(res);
return (sad + 31) >> 6;
}
static INLINE unsigned int highbd_masked_sad4xh_ssse3(
const uint8_t *a8_ptr, int a_stride, const uint8_t *b8_ptr, int b_stride,
const uint8_t *m_ptr, int m_stride, int height) {
const uint8_t *src8, int src_stride, const uint8_t *a8, int a_stride,
const uint8_t *b8, int b_stride, const uint8_t *m_ptr, int m_stride,
int height) {
const uint16_t *src_ptr = CONVERT_TO_SHORTPTR(src8);
const uint16_t *a_ptr = CONVERT_TO_SHORTPTR(a8);
const uint16_t *b_ptr = CONVERT_TO_SHORTPTR(b8);
int y;
__m128i a, b, m, temp1, temp2;
const uint16_t *a_ptr = CONVERT_TO_SHORTPTR(a8_ptr);
const uint16_t *b_ptr = CONVERT_TO_SHORTPTR(b8_ptr);
__m128i res = _mm_setzero_si128();
// Add the masked SAD for 2 rows at a time
const __m128i mask_max = _mm_set1_epi16((1 << AOM_BLEND_A64_ROUND_BITS));
const __m128i round_const =
_mm_set1_epi32((1 << AOM_BLEND_A64_ROUND_BITS) >> 1);
const __m128i one = _mm_set1_epi16(1);
for (y = 0; y < height; y += 2) {
// Load a, b, m in xmm registers
a = highbd_width4_load_2rows(a_ptr, a_stride);
b = highbd_width4_load_2rows(b_ptr, b_stride);
temp1 = _mm_loadl_epi64((const __m128i *)m_ptr);
temp2 = _mm_loadl_epi64((const __m128i *)(m_ptr + m_stride));
m = _mm_unpacklo_epi8(_mm_unpacklo_epi32(temp1, temp2),
_mm_setzero_si128());
const __m128i src = _mm_unpacklo_epi64(
_mm_loadl_epi64((const __m128i *)src_ptr),
_mm_loadl_epi64((const __m128i *)&src_ptr[src_stride]));
const __m128i a =
_mm_unpacklo_epi64(_mm_loadl_epi64((const __m128i *)a_ptr),
_mm_loadl_epi64((const __m128i *)&a_ptr[a_stride]));
const __m128i b =
_mm_unpacklo_epi64(_mm_loadl_epi64((const __m128i *)b_ptr),
_mm_loadl_epi64((const __m128i *)&b_ptr[b_stride]));
// Zero-extend mask to 16 bits
const __m128i m = _mm_unpacklo_epi8(
_mm_unpacklo_epi32(
_mm_cvtsi32_si128(*(const uint32_t *)m_ptr),
_mm_cvtsi32_si128(*(const uint32_t *)&m_ptr[m_stride])),
_mm_setzero_si128());
const __m128i m_inv = _mm_sub_epi16(mask_max, m);
// Calculate the difference between a & b
temp1 = _mm_subs_epu16(a, b);
temp2 = _mm_subs_epu16(b, a);
temp1 = _mm_or_si128(temp1, temp2);
const __m128i data_l = _mm_unpacklo_epi16(a, b);
const __m128i mask_l = _mm_unpacklo_epi16(m, m_inv);
__m128i pred_l = _mm_madd_epi16(data_l, mask_l);
pred_l = _mm_srai_epi32(_mm_add_epi32(pred_l, round_const),
AOM_BLEND_A64_ROUND_BITS);
// Multiply by m and add together
res = _mm_add_epi32(res, _mm_madd_epi16(temp1, m));
const __m128i data_r = _mm_unpackhi_epi16(a, b);
const __m128i mask_r = _mm_unpackhi_epi16(m, m_inv);
__m128i pred_r = _mm_madd_epi16(data_r, mask_r);
pred_r = _mm_srai_epi32(_mm_add_epi32(pred_r, round_const),
AOM_BLEND_A64_ROUND_BITS);
// Move onto the next rows
const __m128i pred = _mm_packs_epi32(pred_l, pred_r);
const __m128i diff = _mm_abs_epi16(_mm_sub_epi16(pred, src));
res = _mm_add_epi32(res, _mm_madd_epi16(diff, one));
src_ptr += src_stride * 2;
a_ptr += a_stride * 2;
b_ptr += b_stride * 2;
m_ptr += m_stride * 2;
}
res = _mm_hadd_epi32(res, _mm_setzero_si128());
res = _mm_hadd_epi32(res, _mm_setzero_si128());
// sad = (sad + 31) >> 6;
return (_mm_cvtsi128_si32(res) + 31) >> 6;
res = _mm_hadd_epi32(res, res);
res = _mm_hadd_epi32(res, res);
int sad = _mm_cvtsi128_si32(res);
return (sad + 31) >> 6;
}
#endif // CONFIG_HIGHBITDEPTH
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,45 @@
/*
* Copyright (c) 2017, 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_DSP_X86_OBMC_INTRINSIC_SSSE3_H_
#define AOM_DSP_X86_OBMC_INTRINSIC_SSSE3_H_
#include <immintrin.h>
#include "./aom_config.h"
static INLINE int32_t xx_hsum_epi32_si32(__m128i v_d) {
v_d = _mm_hadd_epi32(v_d, v_d);
v_d = _mm_hadd_epi32(v_d, v_d);
return _mm_cvtsi128_si32(v_d);
}
static INLINE int64_t xx_hsum_epi64_si64(__m128i v_q) {
v_q = _mm_add_epi64(v_q, _mm_srli_si128(v_q, 8));
#if ARCH_X86_64
return _mm_cvtsi128_si64(v_q);
#else
{
int64_t tmp;
_mm_storel_epi64((__m128i *)&tmp, v_q);
return tmp;
}
#endif
}
static INLINE int64_t xx_hsum_epi32_si64(__m128i v_d) {
const __m128i v_sign_d = _mm_cmplt_epi32(v_d, _mm_setzero_si128());
const __m128i v_0_q = _mm_unpacklo_epi32(v_d, v_sign_d);
const __m128i v_1_q = _mm_unpackhi_epi32(v_d, v_sign_d);
return xx_hsum_epi64_si64(_mm_add_epi64(v_0_q, v_1_q));
}
#endif // AOM_DSP_X86_OBMC_INTRINSIC_SSSE3_H_

View file

@ -17,6 +17,7 @@
#include "aom/aom_integer.h"
#include "aom_dsp/aom_dsp_common.h"
#include "aom_dsp/x86/obmc_intrinsic_ssse3.h"
#include "aom_dsp/x86/synonyms.h"
////////////////////////////////////////////////////////////////////////////////

View file

@ -17,8 +17,9 @@
#include "aom/aom_integer.h"
#include "aom_dsp/aom_dsp_common.h"
#include "aom_dsp/x86/synonyms.h"
#include "aom_dsp/aom_filter.h"
#include "aom_dsp/x86/obmc_intrinsic_ssse3.h"
#include "aom_dsp/x86/synonyms.h"
////////////////////////////////////////////////////////////////////////////////
// 8 bit

View file

@ -89,32 +89,4 @@ static INLINE __m128i xx_roundn_epi32(__m128i v_val_d, int bits) {
return _mm_srai_epi32(v_tmp_d, bits);
}
#ifdef __SSSE3__
static INLINE int32_t xx_hsum_epi32_si32(__m128i v_d) {
v_d = _mm_hadd_epi32(v_d, v_d);
v_d = _mm_hadd_epi32(v_d, v_d);
return _mm_cvtsi128_si32(v_d);
}
static INLINE int64_t xx_hsum_epi64_si64(__m128i v_q) {
v_q = _mm_add_epi64(v_q, _mm_srli_si128(v_q, 8));
#if ARCH_X86_64
return _mm_cvtsi128_si64(v_q);
#else
{
int64_t tmp;
_mm_storel_epi64((__m128i *)&tmp, v_q);
return tmp;
}
#endif
}
static INLINE int64_t xx_hsum_epi32_si64(__m128i v_d) {
const __m128i v_sign_d = _mm_cmplt_epi32(v_d, _mm_setzero_si128());
const __m128i v_0_q = _mm_unpacklo_epi32(v_d, v_sign_d);
const __m128i v_1_q = _mm_unpackhi_epi32(v_d, v_sign_d);
return xx_hsum_epi64_si64(_mm_add_epi64(v_0_q, v_1_q));
}
#endif // __SSSE3__
#endif // AOM_DSP_X86_SYNONYMS_H_

View file

@ -34,7 +34,8 @@ static INLINE void mm256_reverse_epi16(__m256i *u) {
*u = _mm256_permute2x128_si256(v, v, 1);
}
static INLINE void mm256_transpose_16x16(__m256i *in) {
// Note: in and out could have the same value
static INLINE void mm256_transpose_16x16(const __m256i *in, __m256i *out) {
__m256i tr0_0 = _mm256_unpacklo_epi16(in[0], in[1]);
__m256i tr0_1 = _mm256_unpackhi_epi16(in[0], in[1]);
__m256i tr0_2 = _mm256_unpacklo_epi16(in[2], in[3]);
@ -143,29 +144,30 @@ static INLINE void mm256_transpose_16x16(__m256i *in) {
// 86 96 a6 b6 c6 d6 e6 f6 8e ae 9e be ce de ee fe
// 87 97 a7 b7 c7 d7 e7 f7 8f 9f af bf cf df ef ff
in[0] = _mm256_permute2x128_si256(tr0_0, tr0_8, 0x20); // 0010 0000
in[8] = _mm256_permute2x128_si256(tr0_0, tr0_8, 0x31); // 0011 0001
in[1] = _mm256_permute2x128_si256(tr0_1, tr0_9, 0x20);
in[9] = _mm256_permute2x128_si256(tr0_1, tr0_9, 0x31);
in[2] = _mm256_permute2x128_si256(tr0_2, tr0_a, 0x20);
in[10] = _mm256_permute2x128_si256(tr0_2, tr0_a, 0x31);
in[3] = _mm256_permute2x128_si256(tr0_3, tr0_b, 0x20);
in[11] = _mm256_permute2x128_si256(tr0_3, tr0_b, 0x31);
out[0] = _mm256_permute2x128_si256(tr0_0, tr0_8, 0x20); // 0010 0000
out[8] = _mm256_permute2x128_si256(tr0_0, tr0_8, 0x31); // 0011 0001
out[1] = _mm256_permute2x128_si256(tr0_1, tr0_9, 0x20);
out[9] = _mm256_permute2x128_si256(tr0_1, tr0_9, 0x31);
out[2] = _mm256_permute2x128_si256(tr0_2, tr0_a, 0x20);
out[10] = _mm256_permute2x128_si256(tr0_2, tr0_a, 0x31);
out[3] = _mm256_permute2x128_si256(tr0_3, tr0_b, 0x20);
out[11] = _mm256_permute2x128_si256(tr0_3, tr0_b, 0x31);
in[4] = _mm256_permute2x128_si256(tr0_4, tr0_c, 0x20);
in[12] = _mm256_permute2x128_si256(tr0_4, tr0_c, 0x31);
in[5] = _mm256_permute2x128_si256(tr0_5, tr0_d, 0x20);
in[13] = _mm256_permute2x128_si256(tr0_5, tr0_d, 0x31);
in[6] = _mm256_permute2x128_si256(tr0_6, tr0_e, 0x20);
in[14] = _mm256_permute2x128_si256(tr0_6, tr0_e, 0x31);
in[7] = _mm256_permute2x128_si256(tr0_7, tr0_f, 0x20);
in[15] = _mm256_permute2x128_si256(tr0_7, tr0_f, 0x31);
out[4] = _mm256_permute2x128_si256(tr0_4, tr0_c, 0x20);
out[12] = _mm256_permute2x128_si256(tr0_4, tr0_c, 0x31);
out[5] = _mm256_permute2x128_si256(tr0_5, tr0_d, 0x20);
out[13] = _mm256_permute2x128_si256(tr0_5, tr0_d, 0x31);
out[6] = _mm256_permute2x128_si256(tr0_6, tr0_e, 0x20);
out[14] = _mm256_permute2x128_si256(tr0_6, tr0_e, 0x31);
out[7] = _mm256_permute2x128_si256(tr0_7, tr0_f, 0x20);
out[15] = _mm256_permute2x128_si256(tr0_7, tr0_f, 0x31);
}
static INLINE __m256i butter_fly(__m256i a0, __m256i a1, const __m256i cospi) {
static INLINE __m256i butter_fly(const __m256i *a0, const __m256i *a1,
const __m256i *cospi) {
const __m256i dct_rounding = _mm256_set1_epi32(DCT_CONST_ROUNDING);
__m256i y0 = _mm256_madd_epi16(a0, cospi);
__m256i y1 = _mm256_madd_epi16(a1, cospi);
__m256i y0 = _mm256_madd_epi16(*a0, *cospi);
__m256i y1 = _mm256_madd_epi16(*a1, *cospi);
y0 = _mm256_add_epi32(y0, dct_rounding);
y1 = _mm256_add_epi32(y1, dct_rounding);

View file

@ -8,6 +8,9 @@
## 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.
##
if (NOT AOM_AOM_MEM_AOM_MEM_CMAKE_)
set(AOM_AOM_MEM_AOM_MEM_CMAKE_ 1)
set(AOM_MEM_SOURCES
"${AOM_ROOT}/aom_mem/aom_mem.c"
"${AOM_ROOT}/aom_mem/aom_mem.h"
@ -20,3 +23,5 @@ function (setup_aom_mem_targets)
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_mem PARENT_SCOPE)
target_sources(aom PUBLIC $<TARGET_OBJECTS:aom_mem>)
endfunction ()
endif () # AOM_AOM_MEM_AOM_MEM_CMAKE_

View file

@ -39,6 +39,25 @@ void *aom_memset16(void *dest, int val, size_t length);
#include AOM_MEM_PLTFRM
#endif
#if CONFIG_DEBUG
#define AOM_CHECK_MEM_ERROR(error_info, lval, expr) \
do { \
lval = (expr); \
if (!lval) \
aom_internal_error(error_info, AOM_CODEC_MEM_ERROR, \
"Failed to allocate " #lval " at %s:%d", __FILE__, \
__LINE__); \
} while (0)
#else
#define AOM_CHECK_MEM_ERROR(error_info, lval, expr) \
do { \
lval = (expr); \
if (!lval) \
aom_internal_error(error_info, AOM_CODEC_MEM_ERROR, \
"Failed to allocate " #lval); \
} while (0)
#endif
#if defined(__cplusplus)
}
#endif

View file

@ -8,6 +8,9 @@
## 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.
##
if (NOT AOM_AOM_PORTS_AOM_PORTS_CMAKE_)
set(AOM_AOM_PORTS_AOM_PORTS_CMAKE_ 1)
set(AOM_PORTS_INCLUDES
"${AOM_ROOT}/aom_ports/aom_once.h"
"${AOM_ROOT}/aom_ports/aom_timer.h"
@ -64,3 +67,5 @@ function (setup_aom_ports_targets)
endif ()
endif ()
endfunction ()
endif () # AOM_AOM_PORTS_AOM_PORTS_CMAKE_

View file

@ -50,9 +50,6 @@ int arm_cpu_caps(void) {
return flags;
}
mask = arm_cpu_env_mask();
#if HAVE_MEDIA
flags |= HAS_MEDIA;
#endif /* HAVE_MEDIA */
#if HAVE_NEON || HAVE_NEON_ASM
flags |= HAS_NEON;
#endif /* HAVE_NEON || HAVE_NEON_ASM */
@ -76,17 +73,6 @@ int arm_cpu_caps(void) {
* instructions via their assembled hex code.
* All of these instructions should be essentially nops.
*/
#if HAVE_MEDIA
if (mask & HAS_MEDIA) {
__try {
/*SHADD8 r3,r3,r3*/
__emit(0xE6333F93);
flags |= HAS_MEDIA;
} __except (GetExceptionCode() == EXCEPTION_ILLEGAL_INSTRUCTION) {
/*Ignore exception.*/
}
}
#endif /* HAVE_MEDIA */
#if HAVE_NEON || HAVE_NEON_ASM
if (mask & HAS_NEON) {
__try {
@ -114,9 +100,6 @@ int arm_cpu_caps(void) {
mask = arm_cpu_env_mask();
features = android_getCpuFeatures();
#if HAVE_MEDIA
flags |= HAS_MEDIA;
#endif /* HAVE_MEDIA */
#if HAVE_NEON || HAVE_NEON_ASM
if (features & ANDROID_CPU_ARM_FEATURE_NEON) flags |= HAS_NEON;
#endif /* HAVE_NEON || HAVE_NEON_ASM */
@ -155,15 +138,6 @@ int arm_cpu_caps(void) {
}
}
#endif /* HAVE_NEON || HAVE_NEON_ASM */
#if HAVE_MEDIA
if (memcmp(buf, "CPU architecture:", 17) == 0) {
int version;
version = atoi(buf + 17);
if (version >= 6) {
flags |= HAS_MEDIA;
}
}
#endif /* HAVE_MEDIA */
}
fclose(fin);
}

View file

@ -8,6 +8,9 @@
## 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.
##
if (NOT AOM_AOM_SCALE_AOM_SCALE_CMAKE_)
set(AOM_AOM_SCALE_AOM_SCALE_CMAKE_ 1)
set(AOM_SCALE_SOURCES
"${AOM_ROOT}/aom_scale/aom_scale.h"
"${AOM_ROOT}/aom_scale/generic/aom_scale.c"
@ -32,3 +35,5 @@ function (setup_aom_scale_targets)
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_scale PARENT_SCOPE)
endfunction ()
endif () # AOM_AOM_SCALE_AOM_SCALE_CMAKE_

View file

@ -8,6 +8,9 @@
## 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.
##
if (NOT AOM_AOM_UTIL_AOM_UTIL_CMAKE_)
set(AOM_AOM_UTIL_AOM_UTIL_CMAKE_ 1)
set(AOM_UTIL_SOURCES
"${AOM_ROOT}/aom_util/aom_thread.c"
"${AOM_ROOT}/aom_util/aom_thread.h"
@ -27,3 +30,5 @@ function (setup_aom_util_targets)
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_util PARENT_SCOPE)
target_sources(aom PUBLIC $<TARGET_OBJECTS:aom_util>)
endfunction ()
endif () # AOM_AOM_UTIL_AOM_UTIL_CMAKE_

View file

@ -16,12 +16,8 @@
#define QUEUE_MAX_SIZE 2000000
static int result_queue[QUEUE_MAX_SIZE];
#if CONFIG_DAALA_EC
static int nsymbs_queue[QUEUE_MAX_SIZE];
static aom_cdf_prob cdf_queue[QUEUE_MAX_SIZE][16];
#else
static int prob_queue[QUEUE_MAX_SIZE];
#endif
static int queue_r = 0;
static int queue_w = 0;
@ -53,42 +49,24 @@ int bitstream_queue_get_write(void) { return queue_w; }
int bitstream_queue_get_read(void) { return queue_r; }
void bitstream_queue_pop(int *result,
#if CONFIG_DAALA_EC
aom_cdf_prob *cdf, int *nsymbs) {
#else
int *prob) {
#endif // CONFIG_DAALA_EC
void bitstream_queue_pop(int *result, aom_cdf_prob *cdf, int *nsymbs) {
if (!skip_r) {
if (queue_w == queue_r) {
printf("buffer underflow queue_w %d queue_r %d\n", queue_w, queue_r);
assert(0);
}
*result = result_queue[queue_r];
#if CONFIG_DAALA_EC
*nsymbs = nsymbs_queue[queue_r];
memcpy(cdf, cdf_queue[queue_r], *nsymbs * sizeof(*cdf));
#else
*prob = prob_queue[queue_r];
#endif // CONFIG_DAALA_EC
queue_r = (queue_r + 1) % QUEUE_MAX_SIZE;
}
}
void bitstream_queue_push(int result,
#if CONFIG_DAALA_EC
const aom_cdf_prob *cdf, int nsymbs) {
#else
int prob) {
#endif // CONFIG_DAALA_EC
void bitstream_queue_push(int result, const aom_cdf_prob *cdf, int nsymbs) {
if (!skip_w) {
result_queue[queue_w] = result;
#if CONFIG_DAALA_EC
nsymbs_queue[queue_w] = nsymbs;
memcpy(cdf_queue[queue_w], cdf, nsymbs * sizeof(*cdf));
#else
prob_queue[queue_w] = prob;
#endif // CONFIG_DAALA_EC
queue_w = (queue_w + 1) % QUEUE_MAX_SIZE;
if (queue_w == queue_r) {
printf("buffer overflow queue_w %d queue_r %d\n", queue_w, queue_r);

View file

@ -13,9 +13,7 @@
#define AOM_UTIL_DEBUG_UTIL_H_
#include "./aom_config.h"
#if CONFIG_DAALA_EC
#include "aom_dsp/prob.h"
#endif
#ifdef __cplusplus
extern "C" {
@ -33,13 +31,8 @@ int bitstream_queue_get_write(void);
int bitstream_queue_get_read(void);
void bitstream_queue_record_write(void);
void bitstream_queue_reset_write(void);
#if CONFIG_DAALA_EC
void bitstream_queue_pop(int *result, aom_cdf_prob *cdf, int *nsymbs);
void bitstream_queue_push(int result, const aom_cdf_prob *cdf, int nsymbs);
#else
void bitstream_queue_pop(int *result, int *prob);
void bitstream_queue_push(int result, int prob);
#endif
void bitstream_queue_set_skip_write(int skip);
void bitstream_queue_set_skip_read(int skip);
void bitstream_queue_set_frame_write(int frame_idx);

View file

@ -312,8 +312,6 @@ static int file_is_raw(struct AvxInputContext *input) {
int is_raw = 0;
aom_codec_stream_info_t si;
si.sz = sizeof(si);
if (fread(buf, 1, 32, input->file) == 32) {
int i;
@ -892,28 +890,32 @@ static int main_loop(int argc, const char **argv_) {
output_bit_depth = img->bit_depth;
}
// Shift up or down if necessary
if (output_bit_depth != 0 && output_bit_depth != img->bit_depth) {
if (output_bit_depth != 0) {
const aom_img_fmt_t shifted_fmt =
output_bit_depth == 8
? img->fmt ^ (img->fmt & AOM_IMG_FMT_HIGHBITDEPTH)
: img->fmt | AOM_IMG_FMT_HIGHBITDEPTH;
if (img_shifted &&
img_shifted_realloc_required(img, img_shifted, shifted_fmt)) {
aom_img_free(img_shifted);
img_shifted = NULL;
if (shifted_fmt != img->fmt || output_bit_depth != img->bit_depth) {
if (img_shifted &&
img_shifted_realloc_required(img, img_shifted, shifted_fmt)) {
aom_img_free(img_shifted);
img_shifted = NULL;
}
if (!img_shifted) {
img_shifted =
aom_img_alloc(NULL, shifted_fmt, img->d_w, img->d_h, 16);
img_shifted->bit_depth = output_bit_depth;
}
if (output_bit_depth > img->bit_depth) {
aom_img_upshift(img_shifted, img,
output_bit_depth - img->bit_depth);
} else {
aom_img_downshift(img_shifted, img,
img->bit_depth - output_bit_depth);
}
img = img_shifted;
}
if (!img_shifted) {
img_shifted =
aom_img_alloc(NULL, shifted_fmt, img->d_w, img->d_h, 16);
img_shifted->bit_depth = output_bit_depth;
}
if (output_bit_depth > img->bit_depth) {
aom_img_upshift(img_shifted, img, output_bit_depth - img->bit_depth);
} else {
aom_img_downshift(img_shifted, img,
img->bit_depth - output_bit_depth);
}
img = img_shifted;
}
#endif

View file

@ -25,7 +25,7 @@
#endif
#include "aom/aom_encoder.h"
#if CONFIG_DECODERS
#if CONFIG_AV1_DECODER
#include "aom/aom_decoder.h"
#endif
@ -45,6 +45,7 @@
#include "./rate_hist.h"
#include "./warnings.h"
#include "aom/aom_integer.h"
#include "aom_dsp/aom_dsp_common.h"
#include "aom_ports/aom_timer.h"
#include "aom_ports/mem_ops.h"
#if CONFIG_WEBM_IO
@ -627,7 +628,6 @@ void usage_exit(void) {
exit(EXIT_FAILURE);
}
#define NELEMENTS(x) (sizeof(x) / sizeof(x[0]))
#if CONFIG_AV1_ENCODER
#define ARG_CTRL_CNT_MAX NELEMENTS(av1_arg_ctrl_map)
#endif
@ -1061,15 +1061,8 @@ static int parse_stream_params(struct AvxEncoderConfig *global,
}
}
#if CONFIG_HIGHBITDEPTH
#if CONFIG_LOWBITDEPTH
if (strcmp(global->codec->name, "av1") == 0 ||
strcmp(global->codec->name, "av1") == 0) {
config->use_16bit_internal =
test_16bit_internal | (config->cfg.g_profile > 1);
}
#else
config->use_16bit_internal = 1;
#endif
config->use_16bit_internal =
test_16bit_internal || (config->cfg.g_profile > 1) || !CONFIG_LOWBITDEPTH;
#endif
return eos_mark_found;
}
@ -1344,13 +1337,13 @@ static void initialize_encoder(struct stream_state *stream,
ctx_exit_on_error(&stream->encoder, "Failed to control codec");
}
#if CONFIG_DECODERS
#if CONFIG_AV1_DECODER
if (global->test_decode != TEST_DECODE_OFF) {
const AvxInterface *decoder = get_aom_decoder_by_name(global->codec->name);
aom_codec_dec_cfg_t cfg = { 0, 0, 0 };
aom_codec_dec_init(&stream->decoder, decoder->codec_interface(), &cfg, 0);
#if CONFIG_AV1_DECODER && CONFIG_EXT_TILE
#if CONFIG_EXT_TILE
if (strcmp(global->codec->name, "av1") == 0) {
aom_codec_control(&stream->decoder, AV1_SET_DECODE_TILE_ROW, -1);
ctx_exit_on_error(&stream->decoder, "Failed to set decode_tile_row");
@ -1510,7 +1503,7 @@ static void get_cx_data(struct stream_state *stream,
stream->nbytes += pkt->data.raw.sz;
*got_data = 1;
#if CONFIG_DECODERS
#if CONFIG_AV1_DECODER
if (global->test_decode != TEST_DECODE_OFF && !stream->mismatch_seen) {
aom_codec_decode(&stream->decoder, pkt->data.frame.buf,
(unsigned int)pkt->data.frame.sz, NULL, 0);

View file

@ -8,6 +8,9 @@
## 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.
##
if (NOT AOM_AV1_AV1_CMAKE_)
set(AOM_AV1_AV1_CMAKE_ 1)
set(AOM_AV1_COMMON_SOURCES
"${AOM_ROOT}/av1/av1_iface_common.h"
"${AOM_ROOT}/av1/common/alloccommon.c"
@ -16,11 +19,11 @@ set(AOM_AV1_COMMON_SOURCES
"${AOM_ROOT}/av1/common/av1_fwd_txfm1d.c"
"${AOM_ROOT}/av1/common/av1_fwd_txfm1d.h"
"${AOM_ROOT}/av1/common/av1_fwd_txfm2d.c"
"${AOM_ROOT}/av1/common/av1_fwd_txfm2d_cfg.h"
"${AOM_ROOT}/av1/common/av1_fwd_txfm1d_cfg.h"
"${AOM_ROOT}/av1/common/av1_inv_txfm1d.c"
"${AOM_ROOT}/av1/common/av1_inv_txfm1d.h"
"${AOM_ROOT}/av1/common/av1_inv_txfm2d.c"
"${AOM_ROOT}/av1/common/av1_inv_txfm2d_cfg.h"
"${AOM_ROOT}/av1/common/av1_inv_txfm1d_cfg.h"
"${AOM_ROOT}/av1/common/av1_loopfilter.c"
"${AOM_ROOT}/av1/common/av1_loopfilter.h"
"${AOM_ROOT}/av1/common/av1_txfm.h"
@ -60,7 +63,6 @@ set(AOM_AV1_COMMON_SOURCES
"${AOM_ROOT}/av1/common/reconintra.h"
"${AOM_ROOT}/av1/common/resize.c"
"${AOM_ROOT}/av1/common/resize.h"
"${AOM_ROOT}/av1/common/restoration.h"
"${AOM_ROOT}/av1/common/scale.c"
"${AOM_ROOT}/av1/common/scale.h"
"${AOM_ROOT}/av1/common/scan.c"
@ -146,13 +148,9 @@ set(AOM_AV1_ENCODER_SOURCES
"${AOM_ROOT}/av1/encoder/tokenize.c"
"${AOM_ROOT}/av1/encoder/tokenize.h"
"${AOM_ROOT}/av1/encoder/treewriter.c"
"${AOM_ROOT}/av1/encoder/treewriter.h"
"${AOM_ROOT}/av1/encoder/variance_tree.c"
"${AOM_ROOT}/av1/encoder/variance_tree.h")
"${AOM_ROOT}/av1/encoder/treewriter.h")
set(AOM_AV1_COMMON_INTRIN_SSE2
# Requires CONFIG_GLOBAL_MOTION or CONFIG_WARPED_MOTION
#"${AOM_ROOT}/av1/common/x86/warp_plane_sse2.c"
"${AOM_ROOT}/av1/common/x86/idct_intrin_sse2.c")
set(AOM_AV1_COMMON_INTRIN_SSSE3
@ -293,6 +291,27 @@ if (CONFIG_ACCOUNTING)
"${AOM_ROOT}/av1/decoder/accounting.h")
endif ()
if (CONFIG_GLOBAL_MOTION)
set(AOM_AV1_ENCODER_SOURCES
${AOM_AV1_ENCODER_SOURCES}
"${AOM_ROOT}/av1/encoder/corner_detect.c"
"${AOM_ROOT}/av1/encoder/corner_detect.h"
"${AOM_ROOT}/av1/encoder/corner_match.c"
"${AOM_ROOT}/av1/encoder/corner_match.h"
"${AOM_ROOT}/av1/encoder/global_motion.c"
"${AOM_ROOT}/av1/encoder/global_motion.h"
"${AOM_ROOT}/av1/encoder/ransac.c"
"${AOM_ROOT}/av1/encoder/ransac.h"
"${AOM_ROOT}/third_party/fastfeat/fast_9.c"
"${AOM_ROOT}/third_party/fastfeat/fast.c"
"${AOM_ROOT}/third_party/fastfeat/fast.h"
"${AOM_ROOT}/third_party/fastfeat/nonmax.c")
set(AOM_AV1_ENCODER_INTRIN_SSE4_1
${AOM_AV1_ENCODER_INTRIN_SSE4_1}
"${AOM_ROOT}/av1/encoder/x86/corner_match_sse4.c")
endif ()
if (CONFIG_INSPECTION)
set(AOM_AV1_DECODER_SOURCES
${AOM_AV1_DECODER_SOURCES}
@ -320,6 +339,22 @@ if (CONFIG_CFL)
"${AOM_ROOT}/av1/common/cfl.h")
endif ()
if (CONFIG_LOOP_RESTORATION)
set(AOM_AV1_COMMON_SOURCES
${AOM_AV1_COMMON_SOURCES}
"${AOM_ROOT}/av1/common/restoration.c"
"${AOM_ROOT}/av1/common/restoration.h")
set(AOM_AV1_COMMON_INTRIN_SSE4_1
${AOM_AV1_COMMON_INTRIN_SSE4_1}
"${AOM_ROOT}/av1/common/x86/selfguided_sse4.c")
set(AOM_AV1_ENCODER_SOURCES
${AOM_AV1_ENCODER_SOURCES}
"${AOM_ROOT}/av1/encoder/pickrst.c"
"${AOM_ROOT}/av1/encoder/pickrst.h")
endif ()
if (CONFIG_PVQ)
set(AOM_AV1_COMMON_SOURCES
${AOM_AV1_COMMON_SOURCES}
@ -382,7 +417,7 @@ if (CONFIG_PVQ)
endif ()
endif ()
if (CONFIG_WARPED_MOTION)
if (CONFIG_WARPED_MOTION OR CONFIG_GLOBAL_MOTION)
set(AOM_AV1_COMMON_SOURCES
${AOM_AV1_COMMON_SOURCES}
"${AOM_ROOT}/av1/common/warped_motion.c"
@ -391,6 +426,16 @@ if (CONFIG_WARPED_MOTION)
set(AOM_AV1_COMMON_INTRIN_SSE2
${AOM_AV1_COMMON_INTRIN_SSE2}
"${AOM_ROOT}/av1/common/x86/warp_plane_sse2.c")
set(AOM_AV1_COMMON_INTRIN_SSSE3
${AOM_AV1_COMMON_INTRIN_SSSE3}
"${AOM_ROOT}/av1/common/x86/warp_plane_ssse3.c")
if (CONFIG_HIGHBITDEPTH)
set(AOM_AV1_COMMON_INTRIN_SSSE3
${AOM_AV1_COMMON_INTRIN_SSSE3}
"${AOM_ROOT}/av1/common/x86/highbd_warp_plane_ssse3.c")
endif ()
endif ()
# Setup AV1 common/decoder/encoder targets. The libaom target must exist before
@ -516,3 +561,5 @@ endfunction ()
function (setup_av1_test_targets)
endfunction ()
endif () # AOM_AV1_AV1_CMAKE_

View file

@ -58,7 +58,6 @@ AV1_COMMON_SRCS-yes += common/reconinter.c
AV1_COMMON_SRCS-yes += common/reconintra.c
AV1_COMMON_SRCS-yes += common/resize.c
AV1_COMMON_SRCS-yes += common/resize.h
AV1_COMMON_SRCS-yes += common/restoration.h
AV1_COMMON_SRCS-yes += common/common_data.h
AV1_COMMON_SRCS-yes += common/scan.c
AV1_COMMON_SRCS-yes += common/scan.h
@ -69,9 +68,9 @@ AV1_COMMON_SRCS-yes += common/av1_fwd_txfm1d.c
AV1_COMMON_SRCS-yes += common/av1_inv_txfm1d.h
AV1_COMMON_SRCS-yes += common/av1_inv_txfm1d.c
AV1_COMMON_SRCS-yes += common/av1_fwd_txfm2d.c
AV1_COMMON_SRCS-yes += common/av1_fwd_txfm2d_cfg.h
AV1_COMMON_SRCS-yes += common/av1_fwd_txfm1d_cfg.h
AV1_COMMON_SRCS-yes += common/av1_inv_txfm2d.c
AV1_COMMON_SRCS-yes += common/av1_inv_txfm2d_cfg.h
AV1_COMMON_SRCS-yes += common/av1_inv_txfm1d_cfg.h
AV1_COMMON_SRCS-$(HAVE_SSSE3) += common/x86/av1_convolve_ssse3.c
ifeq ($(CONFIG_HIGHBITDEPTH),yes)
AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/av1_highbd_convolve_sse4.c
@ -172,6 +171,7 @@ endif
ifneq ($(findstring yes,$(CONFIG_GLOBAL_MOTION) $(CONFIG_WARPED_MOTION)),)
AV1_COMMON_SRCS-$(HAVE_SSE2) += common/x86/warp_plane_sse2.c
AV1_COMMON_SRCS-$(HAVE_SSSE3) += common/x86/warp_plane_ssse3.c
ifeq ($(CONFIG_HIGHBITDEPTH),yes)
AV1_COMMON_SRCS-$(HAVE_SSSE3) += common/x86/highbd_warp_plane_ssse3.c
endif

View file

@ -23,8 +23,6 @@ AV1_CX_SRCS-yes += encoder/av1_quantize.h
AV1_CX_SRCS-yes += encoder/bitstream.c
AV1_CX_SRCS-yes += encoder/context_tree.c
AV1_CX_SRCS-yes += encoder/context_tree.h
AV1_CX_SRCS-yes += encoder/variance_tree.c
AV1_CX_SRCS-yes += encoder/variance_tree.h
AV1_CX_SRCS-yes += encoder/cost.h
AV1_CX_SRCS-yes += encoder/cost.c
AV1_CX_SRCS-yes += encoder/dct.c
@ -38,6 +36,7 @@ AV1_CX_SRCS-yes += encoder/ethread.h
AV1_CX_SRCS-yes += encoder/ethread.c
AV1_CX_SRCS-yes += encoder/extend.c
AV1_CX_SRCS-yes += encoder/firstpass.c
AV1_CX_SRCS-yes += encoder/mathutils.h
AV1_CX_SRCS-$(CONFIG_GLOBAL_MOTION) += ../third_party/fastfeat/fast.h
AV1_CX_SRCS-$(CONFIG_GLOBAL_MOTION) += ../third_party/fastfeat/nonmax.c
AV1_CX_SRCS-$(CONFIG_GLOBAL_MOTION) += ../third_party/fastfeat/fast_9.c
@ -162,4 +161,8 @@ AV1_CX_SRCS-$(HAVE_MSA) += encoder/mips/msa/fdct16x16_msa.c
AV1_CX_SRCS-$(HAVE_MSA) += encoder/mips/msa/fdct_msa.h
AV1_CX_SRCS-$(HAVE_MSA) += encoder/mips/msa/temporal_filter_msa.c
ifeq ($(CONFIG_GLOBAL_MOTION),yes)
AV1_CX_SRCS-$(HAVE_SSE4_1) += encoder/x86/corner_match_sse4.c
endif
AV1_CX_SRCS-yes := $(filter-out $(AV1_CX_SRCS_REMOVE-yes),$(AV1_CX_SRCS-yes))

View file

@ -483,6 +483,16 @@ static aom_codec_err_t set_encoder_config(
oxcf->resize_mode = RESIZE_NONE;
}
// Initialize to input resolution if not specified.
if (oxcf->resize_mode != RESIZE_FIXED) {
oxcf->scaled_frame_width = oxcf->width;
oxcf->scaled_frame_height = oxcf->height;
}
#if CONFIG_FRAME_SUPERRES
oxcf->superres_enabled = 1; // TODO(afergs): Check the config
#endif // CONFIG_FRAME_SUPERRES
oxcf->maximum_buffer_size_ms = is_vbr ? 240000 : cfg->rc_buf_sz;
oxcf->starting_buffer_level_ms = is_vbr ? 60000 : cfg->rc_buf_initial_sz;
oxcf->optimal_buffer_level_ms = is_vbr ? 60000 : cfg->rc_buf_optimal_sz;

View file

@ -31,8 +31,6 @@
#include "av1/av1_iface_common.h"
typedef aom_codec_stream_info_t av1_stream_info_t;
// This limit is due to framebuffer numbers.
// TODO(hkuang): Remove this limit after implementing ondemand framebuffers.
#define FRAME_CACHE_SIZE 6 // Cache maximum 6 decoded frames.
@ -45,7 +43,7 @@ typedef struct cache_frame {
struct aom_codec_alg_priv {
aom_codec_priv_t base;
aom_codec_dec_cfg_t cfg;
av1_stream_info_t si;
aom_codec_stream_info_t si;
int postproc_cfg_set;
aom_postproc_cfg_t postproc_cfg;
aom_decrypt_cb decrypt_cb;
@ -101,7 +99,6 @@ static aom_codec_err_t decoder_init(aom_codec_ctx_t *ctx,
ctx->priv = (aom_codec_priv_t *)priv;
ctx->priv->init_flags = ctx->init_flags;
priv->si.sz = sizeof(priv->si);
priv->flushed = 0;
// Only do frame parallel decode when threads > 1.
priv->frame_parallel_decode =
@ -263,11 +260,7 @@ static aom_codec_err_t decoder_peek_si(const uint8_t *data,
static aom_codec_err_t decoder_get_si(aom_codec_alg_priv_t *ctx,
aom_codec_stream_info_t *si) {
const size_t sz = (si->sz >= sizeof(av1_stream_info_t))
? sizeof(av1_stream_info_t)
: sizeof(aom_codec_stream_info_t);
memcpy(si, &ctx->si, sz);
si->sz = (unsigned int)sz;
memcpy(si, &ctx->si, sizeof(*si));
return AOM_CODEC_OK;
}

View file

@ -125,6 +125,11 @@ void av1_free_context_buffers(AV1_COMMON *cm) {
#if CONFIG_VAR_TX
aom_free(cm->above_txfm_context);
cm->above_txfm_context = NULL;
for (i = 0; i < MAX_MB_PLANE; ++i) {
aom_free(cm->top_txfm_context[i]);
cm->top_txfm_context[i] = NULL;
}
#endif
}
@ -155,7 +160,8 @@ int av1_alloc_context_buffers(AV1_COMMON *cm, int width, int height) {
for (i = 0; i < MAX_MB_PLANE; i++) {
aom_free(cm->above_context[i]);
cm->above_context[i] = (ENTROPY_CONTEXT *)aom_calloc(
2 * aligned_mi_cols, sizeof(*cm->above_context[0]));
aligned_mi_cols << (MI_SIZE_LOG2 - tx_size_wide_log2[0]),
sizeof(*cm->above_context[0]));
if (!cm->above_context[i]) goto fail;
}
@ -167,8 +173,16 @@ int av1_alloc_context_buffers(AV1_COMMON *cm, int width, int height) {
#if CONFIG_VAR_TX
aom_free(cm->above_txfm_context);
cm->above_txfm_context = (TXFM_CONTEXT *)aom_calloc(
aligned_mi_cols, sizeof(*cm->above_txfm_context));
aligned_mi_cols << TX_UNIT_WIDE_LOG2, sizeof(*cm->above_txfm_context));
if (!cm->above_txfm_context) goto fail;
for (i = 0; i < MAX_MB_PLANE; ++i) {
aom_free(cm->top_txfm_context[i]);
cm->top_txfm_context[i] =
(TXFM_CONTEXT *)aom_calloc(aligned_mi_cols << TX_UNIT_WIDE_LOG2,
sizeof(*cm->top_txfm_context[0]));
if (!cm->top_txfm_context[i]) goto fail;
}
#endif
cm->above_context_alloc_cols = aligned_mi_cols;

View file

@ -10,6 +10,7 @@
*/
#include <stdlib.h>
#include "aom_dsp/inv_txfm.h"
#include "av1/common/av1_fwd_txfm1d.h"
#if CONFIG_COEFFICIENT_RANGE_CHECKING
@ -53,7 +54,7 @@ void av1_fdct4_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
// stage 2
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
@ -100,7 +101,7 @@ void av1_fdct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
// stage 2
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[3];
@ -115,7 +116,7 @@ void av1_fdct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
// stage 3
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
@ -130,7 +131,7 @@ void av1_fdct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
// stage 4
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -193,7 +194,7 @@ void av1_fdct16_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[7];
@ -216,7 +217,7 @@ void av1_fdct16_new(const int32_t *input, int32_t *output,
// stage 3
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0] + bf0[3];
@ -239,7 +240,7 @@ void av1_fdct16_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
@ -262,7 +263,7 @@ void av1_fdct16_new(const int32_t *input, int32_t *output,
// stage 5
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0];
@ -285,7 +286,7 @@ void av1_fdct16_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -380,7 +381,7 @@ void av1_fdct32_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[15];
@ -419,7 +420,7 @@ void av1_fdct32_new(const int32_t *input, int32_t *output,
// stage 3
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0] + bf0[7];
@ -458,7 +459,7 @@ void av1_fdct32_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[3];
@ -497,7 +498,7 @@ void av1_fdct32_new(const int32_t *input, int32_t *output,
// stage 5
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
@ -536,7 +537,7 @@ void av1_fdct32_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -575,7 +576,7 @@ void av1_fdct32_new(const int32_t *input, int32_t *output,
// stage 7
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0];
@ -614,7 +615,7 @@ void av1_fdct32_new(const int32_t *input, int32_t *output,
// stage 8
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -713,7 +714,7 @@ void av1_fadst4_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[8], bf0[0], cospi[56], bf0[1], cos_bit[stage]);
@ -734,7 +735,7 @@ void av1_fadst4_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -781,7 +782,7 @@ void av1_fadst8_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[4], bf0[0], cospi[60], bf0[1], cos_bit[stage]);
@ -810,7 +811,7 @@ void av1_fadst8_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -839,7 +840,7 @@ void av1_fadst8_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -902,7 +903,7 @@ void av1_fadst16_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[2], bf0[0], cospi[62], bf0[1], cos_bit[stage]);
@ -947,7 +948,7 @@ void av1_fadst16_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -992,7 +993,7 @@ void av1_fadst16_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -1037,7 +1038,7 @@ void av1_fadst16_new(const int32_t *input, int32_t *output,
// stage 8
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -1132,7 +1133,7 @@ void av1_fadst32_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[1], bf0[0], cospi[63], bf0[1], cos_bit[stage]);
@ -1209,7 +1210,7 @@ void av1_fadst32_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -1286,7 +1287,7 @@ void av1_fadst32_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -1363,7 +1364,7 @@ void av1_fadst32_new(const int32_t *input, int32_t *output,
// stage 8
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -1440,7 +1441,7 @@ void av1_fadst32_new(const int32_t *input, int32_t *output,
// stage 10
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -1516,6 +1517,38 @@ void av1_fadst32_new(const int32_t *input, int32_t *output,
range_check(stage, input, bf1, size, stage_range[stage]);
}
#if CONFIG_EXT_TX
void av1_fidentity4_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range) {
(void)cos_bit;
for (int i = 0; i < 4; ++i)
output[i] = (int32_t)dct_const_round_shift(input[i] * Sqrt2);
range_check(0, input, output, 4, stage_range[0]);
}
void av1_fidentity8_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range) {
(void)cos_bit;
for (int i = 0; i < 8; ++i) output[i] = input[i] * 2;
range_check(0, input, output, 8, stage_range[0]);
}
void av1_fidentity16_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range) {
(void)cos_bit;
for (int i = 0; i < 16; ++i)
output[i] = (int32_t)dct_const_round_shift(input[i] * 2 * Sqrt2);
range_check(0, input, output, 16, stage_range[0]);
}
void av1_fidentity32_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range) {
(void)cos_bit;
for (int i = 0; i < 32; ++i) output[i] = input[i] * 4;
range_check(0, input, output, 32, stage_range[0]);
}
#endif // CONFIG_EXT_TX
#if CONFIG_TX64X64
void av1_fdct64_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range) {
@ -1531,7 +1564,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
// stage 1;
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf1 = output;
bf1[0] = input[0] + input[63];
bf1[1] = input[1] + input[62];
@ -1601,7 +1634,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[31];
@ -1672,7 +1705,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
// stage 3
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0] + bf0[15];
@ -1743,7 +1776,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[7];
@ -1814,7 +1847,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
// stage 5
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0] + bf0[3];
@ -1885,7 +1918,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
@ -1956,7 +1989,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
// stage 7
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0];
@ -2027,7 +2060,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
// stage 8
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -2098,7 +2131,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
// stage 9
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0];
@ -2169,7 +2202,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
// stage 10
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -2240,7 +2273,7 @@ void av1_fdct64_new(const int32_t *input, int32_t *output,
// stage 11
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0];

View file

@ -37,6 +37,16 @@ void av1_fadst16_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_fadst32_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
#if CONFIG_EXT_TX
void av1_fidentity4_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_fidentity8_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_fidentity16_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_fidentity32_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
#endif // CONFIG_EXT_TX
#ifdef __cplusplus
}

View file

@ -0,0 +1,364 @@
/*
* 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 AV1_FWD_TXFM2D_CFG_H_
#define AV1_FWD_TXFM2D_CFG_H_
#include "av1/common/enums.h"
#include "av1/common/av1_fwd_txfm1d.h"
// Identity will always use max bitdepth regardless of size
static const int8_t fwd_stage_range_identity[1] = { 12 };
// ---------------- 4x4 1D constants -----------------------
// shift
static const int8_t fwd_shift_4[3] = { 2, 0, 0 };
// stage range
static const int8_t fwd_stage_range_col_dct_4[4] = { 15, 16, 17, 17 };
static const int8_t fwd_stage_range_row_dct_4[4] = { 17, 18, 18, 18 };
static const int8_t fwd_stage_range_col_adst_4[6] = { 15, 15, 16, 17, 17, 17 };
static const int8_t fwd_stage_range_row_adst_4[6] = { 17, 17, 17, 18, 18, 18 };
// cos bit
static const int8_t fwd_cos_bit_col_dct_4[4] = { 13, 13, 13, 13 };
static const int8_t fwd_cos_bit_row_dct_4[4] = { 13, 13, 13, 13 };
static const int8_t fwd_cos_bit_col_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
static const int8_t fwd_cos_bit_row_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
// ---------------- 8x8 1D constants -----------------------
// shift
static const int8_t fwd_shift_8[3] = { 2, -1, 0 };
// stage range
static const int8_t fwd_stage_range_col_dct_8[6] = { 15, 16, 17, 18, 18, 18 };
static const int8_t fwd_stage_range_row_dct_8[6] = { 17, 18, 19, 19, 19, 19 };
static const int8_t fwd_stage_range_col_adst_8[8] = { 15, 15, 16, 17,
17, 18, 18, 18 };
static const int8_t fwd_stage_range_row_adst_8[8] = { 17, 17, 17, 18,
18, 19, 19, 19 };
// cos bit
static const int8_t fwd_cos_bit_col_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
static const int8_t fwd_cos_bit_row_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
static const int8_t fwd_cos_bit_col_adst_8[8] = {
13, 13, 13, 13, 13, 13, 13, 13
};
static const int8_t fwd_cos_bit_row_adst_8[8] = {
13, 13, 13, 13, 13, 13, 13, 13
};
// ---------------- 16x16 1D constants -----------------------
// shift
static const int8_t fwd_shift_16[3] = { 2, -2, 0 };
// stage range
static const int8_t fwd_stage_range_col_dct_16[8] = { 15, 16, 17, 18,
19, 19, 19, 19 };
static const int8_t fwd_stage_range_row_dct_16[8] = { 17, 18, 19, 20,
20, 20, 20, 20 };
static const int8_t fwd_stage_range_col_adst_16[10] = { 15, 15, 16, 17, 17,
18, 18, 19, 19, 19 };
static const int8_t fwd_stage_range_row_adst_16[10] = { 17, 17, 17, 18, 18,
19, 19, 20, 20, 20 };
// cos bit
static const int8_t fwd_cos_bit_col_dct_16[8] = {
13, 13, 13, 13, 13, 13, 13, 13
};
static const int8_t fwd_cos_bit_row_dct_16[8] = {
12, 12, 12, 12, 12, 12, 12, 12
};
static const int8_t fwd_cos_bit_col_adst_16[10] = { 13, 13, 13, 13, 13,
13, 13, 13, 13, 13 };
static const int8_t fwd_cos_bit_row_adst_16[10] = { 12, 12, 12, 12, 12,
12, 12, 12, 12, 12 };
// ---------------- 32x32 1D constants -----------------------
// shift
static const int8_t fwd_shift_32[3] = { 2, -4, 0 };
// stage range
static const int8_t fwd_stage_range_col_dct_32[10] = { 15, 16, 17, 18, 19,
20, 20, 20, 20, 20 };
static const int8_t fwd_stage_range_row_dct_32[10] = { 16, 17, 18, 19, 20,
20, 20, 20, 20, 20 };
static const int8_t fwd_stage_range_col_adst_32[12] = {
15, 15, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20
};
static const int8_t fwd_stage_range_row_adst_32[12] = {
16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20
};
// cos bit
static const int8_t fwd_cos_bit_col_dct_32[10] = { 12, 12, 12, 12, 12,
12, 12, 12, 12, 12 };
static const int8_t fwd_cos_bit_row_dct_32[10] = { 12, 12, 12, 12, 12,
12, 12, 12, 12, 12 };
static const int8_t fwd_cos_bit_col_adst_32[12] = { 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12 };
static const int8_t fwd_cos_bit_row_adst_32[12] = { 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12 };
// ---------------- 64x64 1D constants -----------------------
// shift
static const int8_t fwd_shift_64[3] = { 0, -2, -2 };
// stage range
static const int8_t fwd_stage_range_col_dct_64[12] = { 13, 14, 15, 16, 17, 18,
19, 19, 19, 19, 19, 19 };
static const int8_t fwd_stage_range_row_dct_64[12] = { 17, 18, 19, 20, 21, 22,
22, 22, 22, 22, 22, 22 };
// cos bit
static const int8_t fwd_cos_bit_col_dct_64[12] = { 15, 15, 15, 15, 15, 14,
13, 13, 13, 13, 13, 13 };
static const int8_t fwd_cos_bit_row_dct_64[12] = { 15, 14, 13, 12, 11, 10,
10, 10, 10, 10, 10, 10 };
// ---------------- row config fwd_dct_4 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_dct_4 = {
4, // .txfm_size
4, // .stage_num
// 0, // .log_scale
fwd_shift_4, // .shift
fwd_stage_range_row_dct_4, // .stage_range
fwd_cos_bit_row_dct_4, // .cos_bit
TXFM_TYPE_DCT4 // .txfm_type
};
// ---------------- row config fwd_dct_8 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_dct_8 = {
8, // .txfm_size
6, // .stage_num
// 0, // .log_scale
fwd_shift_8, // .shift
fwd_stage_range_row_dct_8, // .stage_range
fwd_cos_bit_row_dct_8, // .cos_bit_
TXFM_TYPE_DCT8 // .txfm_type
};
// ---------------- row config fwd_dct_16 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_dct_16 = {
16, // .txfm_size
8, // .stage_num
// 0, // .log_scale
fwd_shift_16, // .shift
fwd_stage_range_row_dct_16, // .stage_range
fwd_cos_bit_row_dct_16, // .cos_bit
TXFM_TYPE_DCT16 // .txfm_type
};
// ---------------- row config fwd_dct_32 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_dct_32 = {
32, // .txfm_size
10, // .stage_num
// 1, // .log_scale
fwd_shift_32, // .shift
fwd_stage_range_row_dct_32, // .stage_range
fwd_cos_bit_row_dct_32, // .cos_bit_row
TXFM_TYPE_DCT32 // .txfm_type
};
// ---------------- row config fwd_dct_64 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_dct_64 = {
64, // .txfm_size
12, // .stage_num
fwd_shift_64, // .shift
fwd_stage_range_row_dct_64, // .stage_range
fwd_cos_bit_row_dct_64, // .cos_bit
TXFM_TYPE_DCT64, // .txfm_type_col
};
// ---------------- row config fwd_adst_4 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_adst_4 = {
4, // .txfm_size
6, // .stage_num
// 0, // .log_scale
fwd_shift_4, // .shift
fwd_stage_range_row_adst_4, // .stage_range
fwd_cos_bit_row_adst_4, // .cos_bit
TXFM_TYPE_ADST4, // .txfm_type
};
// ---------------- row config fwd_adst_8 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_adst_8 = {
8, // .txfm_size
8, // .stage_num
// 0, // .log_scale
fwd_shift_8, // .shift
fwd_stage_range_row_adst_8, // .stage_range
fwd_cos_bit_row_adst_8, // .cos_bit
TXFM_TYPE_ADST8, // .txfm_type_col
};
// ---------------- row config fwd_adst_16 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_adst_16 = {
16, // .txfm_size
10, // .stage_num
// 0, // .log_scale
fwd_shift_16, // .shift
fwd_stage_range_row_adst_16, // .stage_range
fwd_cos_bit_row_adst_16, // .cos_bit
TXFM_TYPE_ADST16, // .txfm_type
};
// ---------------- row config fwd_adst_32 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_row_cfg_adst_32 = {
32, // .txfm_size
12, // .stage_num
// 1, // .log_scale
fwd_shift_32, // .shift
fwd_stage_range_row_adst_32, // .stage_range
fwd_cos_bit_row_adst_32, // .cos_bit
TXFM_TYPE_ADST32, // .txfm_type
};
// ---------------- col config fwd_dct_4 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_dct_4 = {
4, // .txfm_size
4, // .stage_num
// 0, // .log_scale
fwd_shift_4, // .shift
fwd_stage_range_col_dct_4, // .stage_range
fwd_cos_bit_col_dct_4, // .cos_bit
TXFM_TYPE_DCT4 // .txfm_type
};
// ---------------- col config fwd_dct_8 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_dct_8 = {
8, // .txfm_size
6, // .stage_num
// 0, // .log_scale
fwd_shift_8, // .shift
fwd_stage_range_col_dct_8, // .stage_range
fwd_cos_bit_col_dct_8, // .cos_bit_
TXFM_TYPE_DCT8 // .txfm_type
};
// ---------------- col config fwd_dct_16 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_dct_16 = {
16, // .txfm_size
8, // .stage_num
// 0, // .log_scale
fwd_shift_16, // .shift
fwd_stage_range_col_dct_16, // .stage_range
fwd_cos_bit_col_dct_16, // .cos_bit
TXFM_TYPE_DCT16 // .txfm_type
};
// ---------------- col config fwd_dct_32 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_dct_32 = {
32, // .txfm_size
10, // .stage_num
// 1, // .log_scale
fwd_shift_32, // .shift
fwd_stage_range_col_dct_32, // .stage_range
fwd_cos_bit_col_dct_32, // .cos_bit_col
TXFM_TYPE_DCT32 // .txfm_type
};
// ---------------- col config fwd_dct_64 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_dct_64 = {
64, // .txfm_size
12, // .stage_num
fwd_shift_64, // .shift
fwd_stage_range_col_dct_64, // .stage_range
fwd_cos_bit_col_dct_64, // .cos_bit
TXFM_TYPE_DCT64, // .txfm_type_col
};
// ---------------- col config fwd_adst_4 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_adst_4 = {
4, // .txfm_size
6, // .stage_num
// 0, // .log_scale
fwd_shift_4, // .shift
fwd_stage_range_col_adst_4, // .stage_range
fwd_cos_bit_col_adst_4, // .cos_bit
TXFM_TYPE_ADST4, // .txfm_type
};
// ---------------- col config fwd_adst_8 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_adst_8 = {
8, // .txfm_size
8, // .stage_num
// 0, // .log_scale
fwd_shift_8, // .shift
fwd_stage_range_col_adst_8, // .stage_range
fwd_cos_bit_col_adst_8, // .cos_bit
TXFM_TYPE_ADST8, // .txfm_type_col
};
// ---------------- col config fwd_adst_16 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_adst_16 = {
16, // .txfm_size
10, // .stage_num
// 0, // .log_scale
fwd_shift_16, // .shift
fwd_stage_range_col_adst_16, // .stage_range
fwd_cos_bit_col_adst_16, // .cos_bit
TXFM_TYPE_ADST16, // .txfm_type
};
// ---------------- col config fwd_adst_32 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_col_cfg_adst_32 = {
32, // .txfm_size
12, // .stage_num
// 1, // .log_scale
fwd_shift_32, // .shift
fwd_stage_range_col_adst_32, // .stage_range
fwd_cos_bit_col_adst_32, // .cos_bit
TXFM_TYPE_ADST32, // .txfm_type
};
#if CONFIG_EXT_TX
// identity does not need to differentiate between row and col
// ---------------- row/col config fwd_identity_4 ----------
static const TXFM_1D_CFG fwd_txfm_1d_cfg_identity_4 = {
4, // .txfm_size
1, // .stage_num
// 0, // .log_scale
fwd_shift_4, // .shift
fwd_stage_range_identity, // .stage_range
NULL, // .cos_bit
TXFM_TYPE_IDENTITY4, // .txfm_type
};
// ---------------- row/col config fwd_identity_8 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_cfg_identity_8 = {
8, // .txfm_size
1, // .stage_num
// 0, // .log_scale
fwd_shift_8, // .shift
fwd_stage_range_identity, // .stage_range
NULL, // .cos_bit
TXFM_TYPE_IDENTITY8, // .txfm_type
};
// ---------------- row/col config fwd_identity_16 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_cfg_identity_16 = {
16, // .txfm_size
1, // .stage_num
// 0, // .log_scale
fwd_shift_16, // .shift
fwd_stage_range_identity, // .stage_range
NULL, // .cos_bit
TXFM_TYPE_IDENTITY16, // .txfm_type
};
// ---------------- row/col config fwd_identity_32 ----------------
static const TXFM_1D_CFG fwd_txfm_1d_cfg_identity_32 = {
32, // .txfm_size
1, // .stage_num
// 1, // .log_scale
fwd_shift_32, // .shift
fwd_stage_range_identity, // .stage_range
NULL, // .cos_bit
TXFM_TYPE_IDENTITY32, // .txfm_type
};
#endif // CONFIG_EXT_TX
#endif // AV1_FWD_TXFM2D_CFG_H_

View file

@ -14,7 +14,7 @@
#include "./av1_rtcd.h"
#include "av1/common/enums.h"
#include "av1/common/av1_fwd_txfm1d.h"
#include "av1/common/av1_fwd_txfm2d_cfg.h"
#include "av1/common/av1_fwd_txfm1d_cfg.h"
#include "av1/common/av1_txfm.h"
static INLINE TxfmFunc fwd_txfm_type_to_func(TXFM_TYPE txfm_type) {
@ -27,6 +27,12 @@ static INLINE TxfmFunc fwd_txfm_type_to_func(TXFM_TYPE txfm_type) {
case TXFM_TYPE_ADST8: return av1_fadst8_new;
case TXFM_TYPE_ADST16: return av1_fadst16_new;
case TXFM_TYPE_ADST32: return av1_fadst32_new;
#if CONFIG_EXT_TX
case TXFM_TYPE_IDENTITY4: return av1_fidentity4_c;
case TXFM_TYPE_IDENTITY8: return av1_fidentity8_c;
case TXFM_TYPE_IDENTITY16: return av1_fidentity16_c;
case TXFM_TYPE_IDENTITY32: return av1_fidentity32_c;
#endif // CONFIG_EXT_TX
default: assert(0); return NULL;
}
}
@ -35,14 +41,15 @@ static INLINE void fwd_txfm2d_c(const int16_t *input, int32_t *output,
const int stride, const TXFM_2D_FLIP_CFG *cfg,
int32_t *buf) {
int c, r;
const int txfm_size = cfg->cfg->txfm_size;
const int8_t *shift = cfg->cfg->shift;
const int8_t *stage_range_col = cfg->cfg->stage_range_col;
const int8_t *stage_range_row = cfg->cfg->stage_range_row;
const int8_t *cos_bit_col = cfg->cfg->cos_bit_col;
const int8_t *cos_bit_row = cfg->cfg->cos_bit_row;
const TxfmFunc txfm_func_col = fwd_txfm_type_to_func(cfg->cfg->txfm_type_col);
const TxfmFunc txfm_func_row = fwd_txfm_type_to_func(cfg->cfg->txfm_type_row);
// TODO(sarahparker) must correct for rectangular transforms in follow up
const int txfm_size = cfg->row_cfg->txfm_size;
const int8_t *shift = cfg->row_cfg->shift;
const int8_t *stage_range_col = cfg->col_cfg->stage_range;
const int8_t *stage_range_row = cfg->row_cfg->stage_range;
const int8_t *cos_bit_col = cfg->col_cfg->cos_bit;
const int8_t *cos_bit_row = cfg->row_cfg->cos_bit;
const TxfmFunc txfm_func_col = fwd_txfm_type_to_func(cfg->col_cfg->txfm_type);
const TxfmFunc txfm_func_row = fwd_txfm_type_to_func(cfg->row_cfg->txfm_type);
// use output buffer as temp buffer
int32_t *temp_in = output;
@ -117,96 +124,79 @@ void av1_fwd_txfm2d_64x64_c(const int16_t *input, int32_t *output, int stride,
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf);
}
static const TXFM_1D_CFG *fwd_txfm_col_cfg_ls[TX_TYPES_1D][TX_SIZES] = {
// DCT
{
#if CONFIG_CHROMA_2X2
NULL,
#endif
&fwd_txfm_1d_col_cfg_dct_4, &fwd_txfm_1d_col_cfg_dct_8,
&fwd_txfm_1d_col_cfg_dct_16, &fwd_txfm_1d_col_cfg_dct_32 },
// ADST
{
#if CONFIG_CHROMA_2X2
NULL,
#endif
&fwd_txfm_1d_col_cfg_adst_4, &fwd_txfm_1d_col_cfg_adst_8,
&fwd_txfm_1d_col_cfg_adst_16, &fwd_txfm_1d_col_cfg_adst_32 },
#if CONFIG_EXT_TX
static const TXFM_2D_CFG *fwd_txfm_cfg_ls[FLIPADST_ADST + 1][TX_SIZES] = {
// FLIPADST
{
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
NULL,
#endif
&fwd_txfm_2d_cfg_dct_dct_4, &fwd_txfm_2d_cfg_dct_dct_8,
&fwd_txfm_2d_cfg_dct_dct_16, &fwd_txfm_2d_cfg_dct_dct_32 },
&fwd_txfm_1d_col_cfg_adst_4, &fwd_txfm_1d_col_cfg_adst_8,
&fwd_txfm_1d_col_cfg_adst_16, &fwd_txfm_1d_col_cfg_adst_32 },
// IDENTITY
{
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
NULL,
#endif
&fwd_txfm_2d_cfg_adst_dct_4, &fwd_txfm_2d_cfg_adst_dct_8,
&fwd_txfm_2d_cfg_adst_dct_16, &fwd_txfm_2d_cfg_adst_dct_32 },
{
#if CONFIG_CB4X4
NULL,
#endif
&fwd_txfm_2d_cfg_dct_adst_4, &fwd_txfm_2d_cfg_dct_adst_8,
&fwd_txfm_2d_cfg_dct_adst_16, &fwd_txfm_2d_cfg_dct_adst_32 },
{
#if CONFIG_CB4X4
NULL,
#endif
&fwd_txfm_2d_cfg_adst_adst_4, &fwd_txfm_2d_cfg_adst_adst_8,
&fwd_txfm_2d_cfg_adst_adst_16, &fwd_txfm_2d_cfg_adst_adst_32 },
{
#if CONFIG_CB4X4
NULL,
#endif
&fwd_txfm_2d_cfg_adst_dct_4, &fwd_txfm_2d_cfg_adst_dct_8,
&fwd_txfm_2d_cfg_adst_dct_16, &fwd_txfm_2d_cfg_adst_dct_32 },
{
#if CONFIG_CB4X4
NULL,
#endif
&fwd_txfm_2d_cfg_dct_adst_4, &fwd_txfm_2d_cfg_dct_adst_8,
&fwd_txfm_2d_cfg_dct_adst_16, &fwd_txfm_2d_cfg_dct_adst_32 },
{
#if CONFIG_CB4X4
NULL,
#endif
&fwd_txfm_2d_cfg_adst_adst_4, &fwd_txfm_2d_cfg_adst_adst_8,
&fwd_txfm_2d_cfg_adst_adst_16, &fwd_txfm_2d_cfg_adst_adst_32 },
{
#if CONFIG_CB4X4
NULL,
#endif
&fwd_txfm_2d_cfg_adst_adst_4, &fwd_txfm_2d_cfg_adst_adst_8,
&fwd_txfm_2d_cfg_adst_adst_16, &fwd_txfm_2d_cfg_adst_adst_32 },
{
#if CONFIG_CB4X4
NULL,
#endif
&fwd_txfm_2d_cfg_adst_adst_4, &fwd_txfm_2d_cfg_adst_adst_8,
&fwd_txfm_2d_cfg_adst_adst_16, &fwd_txfm_2d_cfg_adst_adst_32 },
};
#else // CONFIG_EXT_TX
static const TXFM_2D_CFG *fwd_txfm_cfg_ls[TX_TYPES][TX_SIZES] = {
{
#if CONFIG_CB4X4
NULL,
#endif
&fwd_txfm_2d_cfg_dct_dct_4, &fwd_txfm_2d_cfg_dct_dct_8,
&fwd_txfm_2d_cfg_dct_dct_16, &fwd_txfm_2d_cfg_dct_dct_32 },
{
#if CONFIG_CB4X4
NULL,
#endif
&fwd_txfm_2d_cfg_adst_dct_4, &fwd_txfm_2d_cfg_adst_dct_8,
&fwd_txfm_2d_cfg_adst_dct_16, &fwd_txfm_2d_cfg_adst_dct_32 },
{
#if CONFIG_CB4X4
NULL,
#endif
&fwd_txfm_2d_cfg_dct_adst_4, &fwd_txfm_2d_cfg_dct_adst_8,
&fwd_txfm_2d_cfg_dct_adst_16, &fwd_txfm_2d_cfg_dct_adst_32 },
{
#if CONFIG_CB4X4
NULL,
#endif
&fwd_txfm_2d_cfg_adst_adst_4, &fwd_txfm_2d_cfg_adst_adst_8,
&fwd_txfm_2d_cfg_adst_adst_16, &fwd_txfm_2d_cfg_adst_adst_32 },
};
&fwd_txfm_1d_cfg_identity_4, &fwd_txfm_1d_cfg_identity_8,
&fwd_txfm_1d_cfg_identity_16, &fwd_txfm_1d_cfg_identity_32 },
#endif // CONFIG_EXT_TX
};
static const TXFM_1D_CFG *fwd_txfm_row_cfg_ls[TX_TYPES_1D][TX_SIZES] = {
// DCT
{
#if CONFIG_CHROMA_2X2
NULL,
#endif
&fwd_txfm_1d_row_cfg_dct_4, &fwd_txfm_1d_row_cfg_dct_8,
&fwd_txfm_1d_row_cfg_dct_16, &fwd_txfm_1d_row_cfg_dct_32 },
// ADST
{
#if CONFIG_CHROMA_2X2
NULL,
#endif
&fwd_txfm_1d_row_cfg_adst_4, &fwd_txfm_1d_row_cfg_adst_8,
&fwd_txfm_1d_row_cfg_adst_16, &fwd_txfm_1d_row_cfg_adst_32 },
#if CONFIG_EXT_TX
// FLIPADST
{
#if CONFIG_CHROMA_2X2
NULL,
#endif
&fwd_txfm_1d_row_cfg_adst_4, &fwd_txfm_1d_row_cfg_adst_8,
&fwd_txfm_1d_row_cfg_adst_16, &fwd_txfm_1d_row_cfg_adst_32 },
// IDENTITY
{
#if CONFIG_CHROMA_2X2
NULL,
#endif
&fwd_txfm_1d_cfg_identity_4, &fwd_txfm_1d_cfg_identity_8,
&fwd_txfm_1d_cfg_identity_16, &fwd_txfm_1d_cfg_identity_32 },
#endif // CONFIG_EXT_TX
};
TXFM_2D_FLIP_CFG av1_get_fwd_txfm_cfg(int tx_type, int tx_size) {
TXFM_2D_FLIP_CFG cfg;
set_flip_cfg(tx_type, &cfg);
cfg.cfg = fwd_txfm_cfg_ls[tx_type][tx_size];
int tx_type_col = vtx_tab[tx_type];
int tx_type_row = htx_tab[tx_type];
cfg.col_cfg = fwd_txfm_col_cfg_ls[tx_type_col][tx_size];
cfg.row_cfg = fwd_txfm_row_cfg_ls[tx_type_row][tx_size];
return cfg;
}
@ -214,13 +204,11 @@ TXFM_2D_FLIP_CFG av1_get_fwd_txfm_64x64_cfg(int tx_type) {
TXFM_2D_FLIP_CFG cfg;
switch (tx_type) {
case DCT_DCT:
cfg.cfg = &fwd_txfm_2d_cfg_dct_dct_64;
cfg.col_cfg = &fwd_txfm_1d_col_cfg_dct_64;
cfg.row_cfg = &fwd_txfm_1d_row_cfg_dct_64;
cfg.ud_flip = 0;
cfg.lr_flip = 0;
break;
case ADST_DCT:
case DCT_ADST:
case ADST_ADST:
default:
cfg.ud_flip = 0;
cfg.lr_flip = 0;

View file

@ -1,444 +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 AV1_FWD_TXFM2D_CFG_H_
#define AV1_FWD_TXFM2D_CFG_H_
#include "av1/common/enums.h"
#include "av1/common/av1_fwd_txfm1d.h"
// ---------------- config fwd_dct_dct_4 ----------------
static const int8_t fwd_shift_dct_dct_4[3] = { 2, 0, 0 };
static const int8_t fwd_stage_range_col_dct_dct_4[4] = { 15, 16, 17, 17 };
static const int8_t fwd_stage_range_row_dct_dct_4[4] = { 17, 18, 18, 18 };
static const int8_t fwd_cos_bit_col_dct_dct_4[4] = { 13, 13, 13, 13 };
static const int8_t fwd_cos_bit_row_dct_dct_4[4] = { 13, 13, 13, 13 };
static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_dct_4 = {
4, // .txfm_size
4, // .stage_num_col
4, // .stage_num_row
// 0, // .log_scale
fwd_shift_dct_dct_4, // .shift
fwd_stage_range_col_dct_dct_4, // .stage_range_col
fwd_stage_range_row_dct_dct_4, // .stage_range_row
fwd_cos_bit_col_dct_dct_4, // .cos_bit_col
fwd_cos_bit_row_dct_dct_4, // .cos_bit_row
TXFM_TYPE_DCT4, // .txfm_type_col
TXFM_TYPE_DCT4
}; // .txfm_type_row
// ---------------- config fwd_dct_dct_8 ----------------
static const int8_t fwd_shift_dct_dct_8[3] = { 2, -1, 0 };
static const int8_t fwd_stage_range_col_dct_dct_8[6] = {
15, 16, 17, 18, 18, 18
};
static const int8_t fwd_stage_range_row_dct_dct_8[6] = {
17, 18, 19, 19, 19, 19
};
static const int8_t fwd_cos_bit_col_dct_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
static const int8_t fwd_cos_bit_row_dct_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_dct_8 = {
8, // .txfm_size
6, // .stage_num_col
6, // .stage_num_row
// 0, // .log_scale
fwd_shift_dct_dct_8, // .shift
fwd_stage_range_col_dct_dct_8, // .stage_range_col
fwd_stage_range_row_dct_dct_8, // .stage_range_row
fwd_cos_bit_col_dct_dct_8, // .cos_bit_col
fwd_cos_bit_row_dct_dct_8, // .cos_bit_row
TXFM_TYPE_DCT8, // .txfm_type_col
TXFM_TYPE_DCT8
}; // .txfm_type_row
// ---------------- config fwd_dct_dct_16 ----------------
static const int8_t fwd_shift_dct_dct_16[3] = { 2, -2, 0 };
static const int8_t fwd_stage_range_col_dct_dct_16[8] = { 15, 16, 17, 18,
19, 19, 19, 19 };
static const int8_t fwd_stage_range_row_dct_dct_16[8] = { 17, 18, 19, 20,
20, 20, 20, 20 };
static const int8_t fwd_cos_bit_col_dct_dct_16[8] = { 13, 13, 13, 13,
13, 13, 13, 13 };
static const int8_t fwd_cos_bit_row_dct_dct_16[8] = { 12, 12, 12, 12,
12, 12, 12, 12 };
static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_dct_16 = {
16, // .txfm_size
8, // .stage_num_col
8, // .stage_num_row
// 0, // .log_scale
fwd_shift_dct_dct_16, // .shift
fwd_stage_range_col_dct_dct_16, // .stage_range_col
fwd_stage_range_row_dct_dct_16, // .stage_range_row
fwd_cos_bit_col_dct_dct_16, // .cos_bit_col
fwd_cos_bit_row_dct_dct_16, // .cos_bit_row
TXFM_TYPE_DCT16, // .txfm_type_col
TXFM_TYPE_DCT16
}; // .txfm_type_row
// ---------------- config fwd_dct_dct_32 ----------------
static const int8_t fwd_shift_dct_dct_32[3] = { 2, -4, 0 };
static const int8_t fwd_stage_range_col_dct_dct_32[10] = { 15, 16, 17, 18, 19,
20, 20, 20, 20, 20 };
static const int8_t fwd_stage_range_row_dct_dct_32[10] = { 16, 17, 18, 19, 20,
20, 20, 20, 20, 20 };
static const int8_t fwd_cos_bit_col_dct_dct_32[10] = { 12, 12, 12, 12, 12,
12, 12, 12, 12, 12 };
static const int8_t fwd_cos_bit_row_dct_dct_32[10] = { 12, 12, 12, 12, 12,
12, 12, 12, 12, 12 };
static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_dct_32 = {
32, // .txfm_size
10, // .stage_num_col
10, // .stage_num_row
// 1, // .log_scale
fwd_shift_dct_dct_32, // .shift
fwd_stage_range_col_dct_dct_32, // .stage_range_col
fwd_stage_range_row_dct_dct_32, // .stage_range_row
fwd_cos_bit_col_dct_dct_32, // .cos_bit_col
fwd_cos_bit_row_dct_dct_32, // .cos_bit_row
TXFM_TYPE_DCT32, // .txfm_type_col
TXFM_TYPE_DCT32
}; // .txfm_type_row
// ---------------- config fwd_dct_dct_64 ----------------
static const int8_t fwd_shift_dct_dct_64[3] = { 0, -2, -2 };
static const int8_t fwd_stage_range_col_dct_dct_64[12] = {
13, 14, 15, 16, 17, 18, 19, 19, 19, 19, 19, 19
};
static const int8_t fwd_stage_range_row_dct_dct_64[12] = {
17, 18, 19, 20, 21, 22, 22, 22, 22, 22, 22, 22
};
static const int8_t fwd_cos_bit_col_dct_dct_64[12] = { 15, 15, 15, 15, 15, 14,
13, 13, 13, 13, 13, 13 };
static const int8_t fwd_cos_bit_row_dct_dct_64[12] = { 15, 14, 13, 12, 11, 10,
10, 10, 10, 10, 10, 10 };
static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_dct_64 = {
64, // .txfm_size
12, // .stage_num_col
12, // .stage_num_row
fwd_shift_dct_dct_64, // .shift
fwd_stage_range_col_dct_dct_64, // .stage_range_col
fwd_stage_range_row_dct_dct_64, // .stage_range_row
fwd_cos_bit_col_dct_dct_64, // .cos_bit_col
fwd_cos_bit_row_dct_dct_64, // .cos_bit_row
TXFM_TYPE_DCT64, // .txfm_type_col
TXFM_TYPE_DCT64
}; // .txfm_type_row
// ---------------- config fwd_dct_adst_4 ----------------
static const int8_t fwd_shift_dct_adst_4[3] = { 2, 0, 0 };
static const int8_t fwd_stage_range_col_dct_adst_4[4] = { 15, 16, 17, 17 };
static const int8_t fwd_stage_range_row_dct_adst_4[6] = {
17, 17, 17, 18, 18, 18
};
static const int8_t fwd_cos_bit_col_dct_adst_4[4] = { 13, 13, 13, 13 };
static const int8_t fwd_cos_bit_row_dct_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_adst_4 = {
4, // .txfm_size
4, // .stage_num_col
6, // .stage_num_row
// 0, // .log_scale
fwd_shift_dct_adst_4, // .shift
fwd_stage_range_col_dct_adst_4, // .stage_range_col
fwd_stage_range_row_dct_adst_4, // .stage_range_row
fwd_cos_bit_col_dct_adst_4, // .cos_bit_col
fwd_cos_bit_row_dct_adst_4, // .cos_bit_row
TXFM_TYPE_DCT4, // .txfm_type_col
TXFM_TYPE_ADST4
}; // .txfm_type_row
// ---------------- config fwd_dct_adst_8 ----------------
static const int8_t fwd_shift_dct_adst_8[3] = { 2, -1, 0 };
static const int8_t fwd_stage_range_col_dct_adst_8[6] = {
15, 16, 17, 18, 18, 18
};
static const int8_t fwd_stage_range_row_dct_adst_8[8] = { 17, 17, 17, 18,
18, 19, 19, 19 };
static const int8_t fwd_cos_bit_col_dct_adst_8[6] = { 13, 13, 13, 13, 13, 13 };
static const int8_t fwd_cos_bit_row_dct_adst_8[8] = { 13, 13, 13, 13,
13, 13, 13, 13 };
static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_adst_8 = {
8, // .txfm_size
6, // .stage_num_col
8, // .stage_num_row
// 0, // .log_scale
fwd_shift_dct_adst_8, // .shift
fwd_stage_range_col_dct_adst_8, // .stage_range_col
fwd_stage_range_row_dct_adst_8, // .stage_range_row
fwd_cos_bit_col_dct_adst_8, // .cos_bit_col
fwd_cos_bit_row_dct_adst_8, // .cos_bit_row
TXFM_TYPE_DCT8, // .txfm_type_col
TXFM_TYPE_ADST8
}; // .txfm_type_row
// ---------------- config fwd_dct_adst_16 ----------------
static const int8_t fwd_shift_dct_adst_16[3] = { 2, -2, 0 };
static const int8_t fwd_stage_range_col_dct_adst_16[8] = { 15, 16, 17, 18,
19, 19, 19, 19 };
static const int8_t fwd_stage_range_row_dct_adst_16[10] = {
17, 17, 17, 18, 18, 19, 19, 20, 20, 20
};
static const int8_t fwd_cos_bit_col_dct_adst_16[8] = { 13, 13, 13, 13,
13, 13, 13, 13 };
static const int8_t fwd_cos_bit_row_dct_adst_16[10] = { 12, 12, 12, 12, 12,
12, 12, 12, 12, 12 };
static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_adst_16 = {
16, // .txfm_size
8, // .stage_num_col
10, // .stage_num_row
// 0, // .log_scale
fwd_shift_dct_adst_16, // .shift
fwd_stage_range_col_dct_adst_16, // .stage_range_col
fwd_stage_range_row_dct_adst_16, // .stage_range_row
fwd_cos_bit_col_dct_adst_16, // .cos_bit_col
fwd_cos_bit_row_dct_adst_16, // .cos_bit_row
TXFM_TYPE_DCT16, // .txfm_type_col
TXFM_TYPE_ADST16
}; // .txfm_type_row
// ---------------- config fwd_dct_adst_32 ----------------
static const int8_t fwd_shift_dct_adst_32[3] = { 2, -4, 0 };
static const int8_t fwd_stage_range_col_dct_adst_32[10] = {
15, 16, 17, 18, 19, 20, 20, 20, 20, 20
};
static const int8_t fwd_stage_range_row_dct_adst_32[12] = {
16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20
};
static const int8_t fwd_cos_bit_col_dct_adst_32[10] = { 12, 12, 12, 12, 12,
12, 12, 12, 12, 12 };
static const int8_t fwd_cos_bit_row_dct_adst_32[12] = {
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
};
static const TXFM_2D_CFG fwd_txfm_2d_cfg_dct_adst_32 = {
32, // .txfm_size
10, // .stage_num_col
12, // .stage_num_row
// 1, // .log_scale
fwd_shift_dct_adst_32, // .shift
fwd_stage_range_col_dct_adst_32, // .stage_range_col
fwd_stage_range_row_dct_adst_32, // .stage_range_row
fwd_cos_bit_col_dct_adst_32, // .cos_bit_col
fwd_cos_bit_row_dct_adst_32, // .cos_bit_row
TXFM_TYPE_DCT32, // .txfm_type_col
TXFM_TYPE_ADST32
}; // .txfm_type_row
// ---------------- config fwd_adst_adst_4 ----------------
static const int8_t fwd_shift_adst_adst_4[3] = { 2, 0, 0 };
static const int8_t fwd_stage_range_col_adst_adst_4[6] = { 15, 15, 16,
17, 17, 17 };
static const int8_t fwd_stage_range_row_adst_adst_4[6] = { 17, 17, 17,
18, 18, 18 };
static const int8_t fwd_cos_bit_col_adst_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
static const int8_t fwd_cos_bit_row_adst_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_adst_4 = {
4, // .txfm_size
6, // .stage_num_col
6, // .stage_num_row
// 0, // .log_scale
fwd_shift_adst_adst_4, // .shift
fwd_stage_range_col_adst_adst_4, // .stage_range_col
fwd_stage_range_row_adst_adst_4, // .stage_range_row
fwd_cos_bit_col_adst_adst_4, // .cos_bit_col
fwd_cos_bit_row_adst_adst_4, // .cos_bit_row
TXFM_TYPE_ADST4, // .txfm_type_col
TXFM_TYPE_ADST4
}; // .txfm_type_row
// ---------------- config fwd_adst_adst_8 ----------------
static const int8_t fwd_shift_adst_adst_8[3] = { 2, -1, 0 };
static const int8_t fwd_stage_range_col_adst_adst_8[8] = { 15, 15, 16, 17,
17, 18, 18, 18 };
static const int8_t fwd_stage_range_row_adst_adst_8[8] = { 17, 17, 17, 18,
18, 19, 19, 19 };
static const int8_t fwd_cos_bit_col_adst_adst_8[8] = { 13, 13, 13, 13,
13, 13, 13, 13 };
static const int8_t fwd_cos_bit_row_adst_adst_8[8] = { 13, 13, 13, 13,
13, 13, 13, 13 };
static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_adst_8 = {
8, // .txfm_size
8, // .stage_num_col
8, // .stage_num_row
// 0, // .log_scale
fwd_shift_adst_adst_8, // .shift
fwd_stage_range_col_adst_adst_8, // .stage_range_col
fwd_stage_range_row_adst_adst_8, // .stage_range_row
fwd_cos_bit_col_adst_adst_8, // .cos_bit_col
fwd_cos_bit_row_adst_adst_8, // .cos_bit_row
TXFM_TYPE_ADST8, // .txfm_type_col
TXFM_TYPE_ADST8
}; // .txfm_type_row
// ---------------- config fwd_adst_adst_16 ----------------
static const int8_t fwd_shift_adst_adst_16[3] = { 2, -2, 0 };
static const int8_t fwd_stage_range_col_adst_adst_16[10] = {
15, 15, 16, 17, 17, 18, 18, 19, 19, 19
};
static const int8_t fwd_stage_range_row_adst_adst_16[10] = {
17, 17, 17, 18, 18, 19, 19, 20, 20, 20
};
static const int8_t fwd_cos_bit_col_adst_adst_16[10] = { 13, 13, 13, 13, 13,
13, 13, 13, 13, 13 };
static const int8_t fwd_cos_bit_row_adst_adst_16[10] = { 12, 12, 12, 12, 12,
12, 12, 12, 12, 12 };
static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_adst_16 = {
16, // .txfm_size
10, // .stage_num_col
10, // .stage_num_row
// 0, // .log_scale
fwd_shift_adst_adst_16, // .shift
fwd_stage_range_col_adst_adst_16, // .stage_range_col
fwd_stage_range_row_adst_adst_16, // .stage_range_row
fwd_cos_bit_col_adst_adst_16, // .cos_bit_col
fwd_cos_bit_row_adst_adst_16, // .cos_bit_row
TXFM_TYPE_ADST16, // .txfm_type_col
TXFM_TYPE_ADST16
}; // .txfm_type_row
// ---------------- config fwd_adst_adst_32 ----------------
static const int8_t fwd_shift_adst_adst_32[3] = { 2, -4, 0 };
static const int8_t fwd_stage_range_col_adst_adst_32[12] = {
15, 15, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20
};
static const int8_t fwd_stage_range_row_adst_adst_32[12] = {
16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20
};
static const int8_t fwd_cos_bit_col_adst_adst_32[12] = {
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
};
static const int8_t fwd_cos_bit_row_adst_adst_32[12] = {
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
};
static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_adst_32 = {
32, // .txfm_size
12, // .stage_num_col
12, // .stage_num_row
// 1, // .log_scale
fwd_shift_adst_adst_32, // .shift
fwd_stage_range_col_adst_adst_32, // .stage_range_col
fwd_stage_range_row_adst_adst_32, // .stage_range_row
fwd_cos_bit_col_adst_adst_32, // .cos_bit_col
fwd_cos_bit_row_adst_adst_32, // .cos_bit_row
TXFM_TYPE_ADST32, // .txfm_type_col
TXFM_TYPE_ADST32
}; // .txfm_type_row
// ---------------- config fwd_adst_dct_4 ----------------
static const int8_t fwd_shift_adst_dct_4[3] = { 2, 0, 0 };
static const int8_t fwd_stage_range_col_adst_dct_4[6] = {
15, 15, 16, 17, 17, 17
};
static const int8_t fwd_stage_range_row_adst_dct_4[4] = { 17, 18, 18, 18 };
static const int8_t fwd_cos_bit_col_adst_dct_4[6] = { 13, 13, 13, 13, 13, 13 };
static const int8_t fwd_cos_bit_row_adst_dct_4[4] = { 13, 13, 13, 13 };
static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_dct_4 = {
4, // .txfm_size
6, // .stage_num_col
4, // .stage_num_row
// 0, // .log_scale
fwd_shift_adst_dct_4, // .shift
fwd_stage_range_col_adst_dct_4, // .stage_range_col
fwd_stage_range_row_adst_dct_4, // .stage_range_row
fwd_cos_bit_col_adst_dct_4, // .cos_bit_col
fwd_cos_bit_row_adst_dct_4, // .cos_bit_row
TXFM_TYPE_ADST4, // .txfm_type_col
TXFM_TYPE_DCT4
}; // .txfm_type_row
// ---------------- config fwd_adst_dct_8 ----------------
static const int8_t fwd_shift_adst_dct_8[3] = { 2, -1, 0 };
static const int8_t fwd_stage_range_col_adst_dct_8[8] = { 15, 15, 16, 17,
17, 18, 18, 18 };
static const int8_t fwd_stage_range_row_adst_dct_8[6] = {
17, 18, 19, 19, 19, 19
};
static const int8_t fwd_cos_bit_col_adst_dct_8[8] = { 13, 13, 13, 13,
13, 13, 13, 13 };
static const int8_t fwd_cos_bit_row_adst_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_dct_8 = {
8, // .txfm_size
8, // .stage_num_col
6, // .stage_num_row
// 0, // .log_scale
fwd_shift_adst_dct_8, // .shift
fwd_stage_range_col_adst_dct_8, // .stage_range_col
fwd_stage_range_row_adst_dct_8, // .stage_range_row
fwd_cos_bit_col_adst_dct_8, // .cos_bit_col
fwd_cos_bit_row_adst_dct_8, // .cos_bit_row
TXFM_TYPE_ADST8, // .txfm_type_col
TXFM_TYPE_DCT8
}; // .txfm_type_row
// ---------------- config fwd_adst_dct_16 ----------------
static const int8_t fwd_shift_adst_dct_16[3] = { 2, -2, 0 };
static const int8_t fwd_stage_range_col_adst_dct_16[10] = {
15, 15, 16, 17, 17, 18, 18, 19, 19, 19
};
static const int8_t fwd_stage_range_row_adst_dct_16[8] = { 17, 18, 19, 20,
20, 20, 20, 20 };
static const int8_t fwd_cos_bit_col_adst_dct_16[10] = { 13, 13, 13, 13, 13,
13, 13, 13, 13, 13 };
static const int8_t fwd_cos_bit_row_adst_dct_16[8] = { 12, 12, 12, 12,
12, 12, 12, 12 };
static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_dct_16 = {
16, // .txfm_size
10, // .stage_num_col
8, // .stage_num_row
// 0, // .log_scale
fwd_shift_adst_dct_16, // .shift
fwd_stage_range_col_adst_dct_16, // .stage_range_col
fwd_stage_range_row_adst_dct_16, // .stage_range_row
fwd_cos_bit_col_adst_dct_16, // .cos_bit_col
fwd_cos_bit_row_adst_dct_16, // .cos_bit_row
TXFM_TYPE_ADST16, // .txfm_type_col
TXFM_TYPE_DCT16
}; // .txfm_type_row
// ---------------- config fwd_adst_dct_32 ----------------
static const int8_t fwd_shift_adst_dct_32[3] = { 2, -4, 0 };
static const int8_t fwd_stage_range_col_adst_dct_32[12] = {
15, 15, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20
};
static const int8_t fwd_stage_range_row_adst_dct_32[10] = {
16, 17, 18, 19, 20, 20, 20, 20, 20, 20
};
static const int8_t fwd_cos_bit_col_adst_dct_32[12] = {
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
};
static const int8_t fwd_cos_bit_row_adst_dct_32[10] = { 12, 12, 12, 12, 12,
12, 12, 12, 12, 12 };
static const TXFM_2D_CFG fwd_txfm_2d_cfg_adst_dct_32 = {
32, // .txfm_size
12, // .stage_num_col
10, // .stage_num_row
// 1, // .log_scale
fwd_shift_adst_dct_32, // .shift
fwd_stage_range_col_adst_dct_32, // .stage_range_col
fwd_stage_range_row_adst_dct_32, // .stage_range_row
fwd_cos_bit_col_adst_dct_32, // .cos_bit_col
fwd_cos_bit_row_adst_dct_32, // .cos_bit_row
TXFM_TYPE_ADST32, // .txfm_type_col
TXFM_TYPE_DCT32
}; // .txfm_type_row
#endif // AV1_FWD_TXFM2D_CFG_H_

View file

@ -10,6 +10,7 @@
*/
#include <stdlib.h>
#include "aom_dsp/inv_txfm.h"
#include "av1/common/av1_inv_txfm1d.h"
#if CONFIG_COEFFICIENT_RANGE_CHECKING
@ -66,6 +67,7 @@ void av1_idct4_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
// stage 1;
stage++;
assert(output != input);
bf1 = output;
bf1[0] = input[0];
bf1[1] = input[2];
@ -75,7 +77,7 @@ void av1_idct4_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
// stage 2
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
@ -109,6 +111,7 @@ void av1_idct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
// stage 1;
stage++;
assert(output != input);
bf1 = output;
bf1[0] = input[0];
bf1[1] = input[4];
@ -122,7 +125,7 @@ void av1_idct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
// stage 2
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -137,7 +140,7 @@ void av1_idct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
// stage 3
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
@ -152,7 +155,7 @@ void av1_idct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
// stage 4
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[3];
@ -194,6 +197,7 @@ void av1_idct16_new(const int32_t *input, int32_t *output,
// stage 1;
stage++;
assert(output != input);
bf1 = output;
bf1[0] = input[0];
bf1[1] = input[8];
@ -215,7 +219,7 @@ void av1_idct16_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -238,7 +242,7 @@ void av1_idct16_new(const int32_t *input, int32_t *output,
// stage 3
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0];
@ -261,7 +265,7 @@ void av1_idct16_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
@ -284,7 +288,7 @@ void av1_idct16_new(const int32_t *input, int32_t *output,
// stage 5
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0] + bf0[3];
@ -307,7 +311,7 @@ void av1_idct16_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[7];
@ -365,6 +369,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
// stage 1;
stage++;
assert(output != input);
bf1 = output;
bf1[0] = input[0];
bf1[1] = input[16];
@ -402,7 +407,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -441,7 +446,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
// stage 3
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0];
@ -480,7 +485,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -519,7 +524,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
// stage 5
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
@ -558,7 +563,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[3];
@ -597,7 +602,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
// stage 7
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0] + bf0[7];
@ -636,7 +641,7 @@ void av1_idct32_new(const int32_t *input, int32_t *output,
// stage 8
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[15];
@ -726,6 +731,7 @@ void av1_iadst4_new(const int32_t *input, int32_t *output,
// stage 1;
stage++;
assert(output != input);
bf1 = output;
bf1[0] = input[0];
bf1[1] = -input[3];
@ -735,7 +741,7 @@ void av1_iadst4_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -756,7 +762,7 @@ void av1_iadst4_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[8], bf0[0], cospi[56], bf0[1], cos_bit[stage]);
@ -790,6 +796,7 @@ void av1_iadst8_new(const int32_t *input, int32_t *output,
// stage 1;
stage++;
assert(output != input);
bf1 = output;
bf1[0] = input[0];
bf1[1] = -input[7];
@ -803,7 +810,7 @@ void av1_iadst8_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -832,7 +839,7 @@ void av1_iadst8_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -861,7 +868,7 @@ void av1_iadst8_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[4], bf0[0], cospi[60], bf0[1], cos_bit[stage]);
@ -903,6 +910,7 @@ void av1_iadst16_new(const int32_t *input, int32_t *output,
// stage 1;
stage++;
assert(output != input);
bf1 = output;
bf1[0] = input[0];
bf1[1] = -input[15];
@ -924,7 +932,7 @@ void av1_iadst16_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -969,7 +977,7 @@ void av1_iadst16_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -1014,7 +1022,7 @@ void av1_iadst16_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -1059,7 +1067,7 @@ void av1_iadst16_new(const int32_t *input, int32_t *output,
// stage 8
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[2], bf0[0], cospi[62], bf0[1], cos_bit[stage]);
@ -1117,6 +1125,7 @@ void av1_iadst32_new(const int32_t *input, int32_t *output,
// stage 1;
stage++;
assert(output != input);
bf1 = output;
bf1[0] = input[0];
bf1[1] = -input[31];
@ -1154,7 +1163,7 @@ void av1_iadst32_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -1231,7 +1240,7 @@ void av1_iadst32_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -1308,7 +1317,7 @@ void av1_iadst32_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -1385,7 +1394,7 @@ void av1_iadst32_new(const int32_t *input, int32_t *output,
// stage 8
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -1462,7 +1471,7 @@ void av1_iadst32_new(const int32_t *input, int32_t *output,
// stage 10
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[1], bf0[0], cospi[63], bf0[1], cos_bit[stage]);
@ -1538,6 +1547,38 @@ void av1_iadst32_new(const int32_t *input, int32_t *output,
range_check(stage, input, bf1, size, stage_range[stage]);
}
#if CONFIG_EXT_TX
void av1_iidentity4_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range) {
(void)cos_bit;
for (int i = 0; i < 4; ++i)
output[i] = (int32_t)dct_const_round_shift(input[i] * Sqrt2);
range_check(0, input, output, 4, stage_range[0]);
}
void av1_iidentity8_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range) {
(void)cos_bit;
for (int i = 0; i < 8; ++i) output[i] = input[i] * 2;
range_check(0, input, output, 8, stage_range[0]);
}
void av1_iidentity16_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range) {
(void)cos_bit;
for (int i = 0; i < 16; ++i)
output[i] = (int32_t)dct_const_round_shift(input[i] * 2 * Sqrt2);
range_check(0, input, output, 16, stage_range[0]);
}
void av1_iidentity32_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range) {
(void)cos_bit;
for (int i = 0; i < 32; ++i) output[i] = input[i] * 4;
range_check(0, input, output, 32, stage_range[0]);
}
#endif // CONFIG_EXT_TX
#if CONFIG_TX64X64
void av1_idct64_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range) {
@ -1553,7 +1594,8 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
// stage 1;
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
assert(output != input);
bf1 = output;
bf1[0] = input[0];
bf1[1] = input[32];
@ -1623,7 +1665,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
// stage 2
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -1694,7 +1736,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
// stage 3
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0];
@ -1765,7 +1807,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
// stage 4
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0];
@ -1836,7 +1878,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
// stage 5
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0];
@ -1907,7 +1949,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
// stage 6
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = half_btf(cospi[32], bf0[0], cospi[32], bf0[1], cos_bit[stage]);
@ -1978,7 +2020,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
// stage 7
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0] + bf0[3];
@ -2049,7 +2091,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
// stage 8
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[7];
@ -2120,7 +2162,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
// stage 9
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0] + bf0[15];
@ -2191,7 +2233,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
// stage 10
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = output;
bf1 = step;
bf1[0] = bf0[0] + bf0[31];
@ -2262,7 +2304,7 @@ void av1_idct64_new(const int32_t *input, int32_t *output,
// stage 11
stage++;
cospi = cospi_arr[cos_bit[stage] - cos_bit_min];
cospi = cospi_arr(cos_bit[stage]);
bf0 = step;
bf1 = output;
bf1[0] = bf0[0] + bf0[63];

View file

@ -37,6 +37,16 @@ void av1_iadst16_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_iadst32_new(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
#if CONFIG_EXT_TX
void av1_iidentity4_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_iidentity8_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_iidentity16_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
void av1_iidentity32_c(const int32_t *input, int32_t *output,
const int8_t *cos_bit, const int8_t *stage_range);
#endif // CONFIG_EXT_TX
#ifdef __cplusplus
}

View file

@ -0,0 +1,362 @@
/*
* 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 AV1_INV_TXFM2D_CFG_H_
#define AV1_INV_TXFM2D_CFG_H_
#include "av1/common/av1_inv_txfm1d.h"
// Identity will always use max bitdepth regardless of size
static const int8_t inv_stage_range_identity[1] = { 12 };
// ---------------- 4x4 1D config -----------------------
// shift
static const int8_t inv_shift_4[2] = { 0, -4 };
// stage range
static const int8_t inv_stage_range_col_dct_4[4] = { 18, 18, 17, 17 };
static const int8_t inv_stage_range_row_dct_4[4] = { 18, 18, 18, 18 };
static const int8_t inv_stage_range_col_adst_4[6] = { 18, 18, 18, 18, 17, 17 };
static const int8_t inv_stage_range_row_adst_4[6] = { 18, 18, 18, 18, 18, 18 };
// cos bit
static const int8_t inv_cos_bit_col_dct_4[4] = { 13, 13, 13, 13 };
static const int8_t inv_cos_bit_row_dct_4[4] = { 13, 13, 13, 13 };
static const int8_t inv_cos_bit_col_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
static const int8_t inv_cos_bit_row_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
// ---------------- 8x8 1D constants -----------------------
// shift
static const int8_t inv_shift_8[2] = { 0, -5 };
// stage range
static const int8_t inv_stage_range_col_dct_8[6] = { 19, 19, 19, 19, 18, 18 };
static const int8_t inv_stage_range_row_dct_8[6] = { 19, 19, 19, 19, 19, 19 };
static const int8_t inv_stage_range_col_adst_8[8] = { 19, 19, 19, 19,
19, 19, 18, 18 };
static const int8_t inv_stage_range_row_adst_8[8] = { 19, 19, 19, 19,
19, 19, 19, 19 };
// cos bit
static const int8_t inv_cos_bit_col_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
static const int8_t inv_cos_bit_row_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
static const int8_t inv_cos_bit_col_adst_8[8] = {
13, 13, 13, 13, 13, 13, 13, 13
};
static const int8_t inv_cos_bit_row_adst_8[8] = {
13, 13, 13, 13, 13, 13, 13, 13
};
// ---------------- 16x16 1D constants -----------------------
// shift
static const int8_t inv_shift_16[2] = { -1, -5 };
// stage range
static const int8_t inv_stage_range_col_dct_16[8] = { 19, 19, 19, 19,
19, 19, 18, 18 };
static const int8_t inv_stage_range_row_dct_16[8] = { 20, 20, 20, 20,
20, 20, 20, 20 };
static const int8_t inv_stage_range_col_adst_16[10] = { 19, 19, 19, 19, 19,
19, 19, 19, 18, 18 };
static const int8_t inv_stage_range_row_adst_16[10] = { 20, 20, 20, 20, 20,
20, 20, 20, 20, 20 };
// cos bit
static const int8_t inv_cos_bit_col_dct_16[8] = {
13, 13, 13, 13, 13, 13, 13, 13
};
static const int8_t inv_cos_bit_row_dct_16[8] = {
12, 12, 12, 12, 12, 12, 12, 12
};
static const int8_t inv_cos_bit_col_adst_16[10] = { 13, 13, 13, 13, 13,
13, 13, 13, 13, 13 };
static const int8_t inv_cos_bit_row_adst_16[10] = { 12, 12, 12, 12, 12,
12, 12, 12, 12, 12 };
// ---------------- 32x32 1D constants -----------------------
// shift
static const int8_t inv_shift_32[2] = { -1, -5 };
// stage range
static const int8_t inv_stage_range_col_dct_32[10] = { 19, 19, 19, 19, 19,
19, 19, 19, 18, 18 };
static const int8_t inv_stage_range_row_dct_32[10] = { 20, 20, 20, 20, 20,
20, 20, 20, 20, 20 };
static const int8_t inv_stage_range_col_adst_32[12] = {
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 18, 18
};
static const int8_t inv_stage_range_row_adst_32[12] = {
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
};
// cos bit
static const int8_t inv_cos_bit_col_dct_32[10] = { 13, 13, 13, 13, 13,
13, 13, 13, 13, 13 };
static const int8_t inv_cos_bit_row_dct_32[10] = { 12, 12, 12, 12, 12,
12, 12, 12, 12, 12 };
static const int8_t inv_cos_bit_col_adst_32[12] = { 13, 13, 13, 13, 13, 13,
13, 13, 13, 13, 13, 13 };
static const int8_t inv_cos_bit_row_adst_32[12] = { 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12 };
// ---------------- 64x64 1D constants -----------------------
// shift
static const int8_t inv_shift_64[2] = { -1, -7 };
// stage range
static const int8_t inv_stage_range_col_dct_64[12] = { 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 18, 18 };
static const int8_t inv_stage_range_row_dct_64[12] = { 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20 };
// cos bit
static const int8_t inv_cos_bit_col_dct_64[12] = { 13, 13, 13, 13, 13, 13,
13, 13, 13, 13, 13, 13 };
static const int8_t inv_cos_bit_row_dct_64[12] = { 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12 };
// ---------------- row config inv_dct_4 ----------------
static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_4 = {
4, // .txfm_size
4, // .stage_num
// 0, // .log_scale
inv_shift_4, // .shift
inv_stage_range_row_dct_4, // .stage_range
inv_cos_bit_row_dct_4, // .cos_bit
TXFM_TYPE_DCT4 // .txfm_type
};
// ---------------- row config inv_dct_8 ----------------
static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_8 = {
8, // .txfm_size
6, // .stage_num
// 0, // .log_scale
inv_shift_8, // .shift
inv_stage_range_row_dct_8, // .stage_range
inv_cos_bit_row_dct_8, // .cos_bit_
TXFM_TYPE_DCT8 // .txfm_type
};
// ---------------- row config inv_dct_16 ----------------
static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_16 = {
16, // .txfm_size
8, // .stage_num
// 0, // .log_scale
inv_shift_16, // .shift
inv_stage_range_row_dct_16, // .stage_range
inv_cos_bit_row_dct_16, // .cos_bit
TXFM_TYPE_DCT16 // .txfm_type
};
// ---------------- row config inv_dct_32 ----------------
static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_32 = {
32, // .txfm_size
10, // .stage_num
// 1, // .log_scale
inv_shift_32, // .shift
inv_stage_range_row_dct_32, // .stage_range
inv_cos_bit_row_dct_32, // .cos_bit_row
TXFM_TYPE_DCT32 // .txfm_type
};
// ---------------- row config inv_dct_64 ----------------
static const TXFM_1D_CFG inv_txfm_1d_row_cfg_dct_64 = {
64, // .txfm_size
12, // .stage_num
inv_shift_64, // .shift
inv_stage_range_row_dct_64, // .stage_range
inv_cos_bit_row_dct_64, // .cos_bit
TXFM_TYPE_DCT64, // .txfm_type_col
};
// ---------------- row config inv_adst_4 ----------------
static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_4 = {
4, // .txfm_size
6, // .stage_num
// 0, // .log_scale
inv_shift_4, // .shift
inv_stage_range_row_adst_4, // .stage_range
inv_cos_bit_row_adst_4, // .cos_bit
TXFM_TYPE_ADST4, // .txfm_type
};
// ---------------- row config inv_adst_8 ----------------
static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_8 = {
8, // .txfm_size
8, // .stage_num
// 0, // .log_scale
inv_shift_8, // .shift
inv_stage_range_row_adst_8, // .stage_range
inv_cos_bit_row_adst_8, // .cos_bit
TXFM_TYPE_ADST8, // .txfm_type_col
};
// ---------------- row config inv_adst_16 ----------------
static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_16 = {
16, // .txfm_size
10, // .stage_num
// 0, // .log_scale
inv_shift_16, // .shift
inv_stage_range_row_adst_16, // .stage_range
inv_cos_bit_row_adst_16, // .cos_bit
TXFM_TYPE_ADST16, // .txfm_type
};
// ---------------- row config inv_adst_32 ----------------
static const TXFM_1D_CFG inv_txfm_1d_row_cfg_adst_32 = {
32, // .txfm_size
12, // .stage_num
// 1, // .log_scale
inv_shift_32, // .shift
inv_stage_range_row_adst_32, // .stage_range
inv_cos_bit_row_adst_32, // .cos_bit
TXFM_TYPE_ADST32, // .txfm_type
};
// ---------------- col config inv_dct_4 ----------------
static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_4 = {
4, // .txfm_size
4, // .stage_num
// 0, // .log_scale
inv_shift_4, // .shift
inv_stage_range_col_dct_4, // .stage_range
inv_cos_bit_col_dct_4, // .cos_bit
TXFM_TYPE_DCT4 // .txfm_type
};
// ---------------- col config inv_dct_8 ----------------
static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_8 = {
8, // .txfm_size
6, // .stage_num
// 0, // .log_scale
inv_shift_8, // .shift
inv_stage_range_col_dct_8, // .stage_range
inv_cos_bit_col_dct_8, // .cos_bit_
TXFM_TYPE_DCT8 // .txfm_type
};
// ---------------- col config inv_dct_16 ----------------
static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_16 = {
16, // .txfm_size
8, // .stage_num
// 0, // .log_scale
inv_shift_16, // .shift
inv_stage_range_col_dct_16, // .stage_range
inv_cos_bit_col_dct_16, // .cos_bit
TXFM_TYPE_DCT16 // .txfm_type
};
// ---------------- col config inv_dct_32 ----------------
static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_32 = {
32, // .txfm_size
10, // .stage_num
// 1, // .log_scale
inv_shift_32, // .shift
inv_stage_range_col_dct_32, // .stage_range
inv_cos_bit_col_dct_32, // .cos_bit_col
TXFM_TYPE_DCT32 // .txfm_type
};
// ---------------- col config inv_dct_64 ----------------
static const TXFM_1D_CFG inv_txfm_1d_col_cfg_dct_64 = {
64, // .txfm_size
12, // .stage_num
inv_shift_64, // .shift
inv_stage_range_col_dct_64, // .stage_range
inv_cos_bit_col_dct_64, // .cos_bit
TXFM_TYPE_DCT64, // .txfm_type_col
};
// ---------------- col config inv_adst_4 ----------------
static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_4 = {
4, // .txfm_size
6, // .stage_num
// 0, // .log_scale
inv_shift_4, // .shift
inv_stage_range_col_adst_4, // .stage_range
inv_cos_bit_col_adst_4, // .cos_bit
TXFM_TYPE_ADST4, // .txfm_type
};
// ---------------- col config inv_adst_8 ----------------
static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_8 = {
8, // .txfm_size
8, // .stage_num
// 0, // .log_scale
inv_shift_8, // .shift
inv_stage_range_col_adst_8, // .stage_range
inv_cos_bit_col_adst_8, // .cos_bit
TXFM_TYPE_ADST8, // .txfm_type_col
};
// ---------------- col config inv_adst_16 ----------------
static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_16 = {
16, // .txfm_size
10, // .stage_num
// 0, // .log_scale
inv_shift_16, // .shift
inv_stage_range_col_adst_16, // .stage_range
inv_cos_bit_col_adst_16, // .cos_bit
TXFM_TYPE_ADST16, // .txfm_type
};
// ---------------- col config inv_adst_32 ----------------
static const TXFM_1D_CFG inv_txfm_1d_col_cfg_adst_32 = {
32, // .txfm_size
12, // .stage_num
// 1, // .log_scale
inv_shift_32, // .shift
inv_stage_range_col_adst_32, // .stage_range
inv_cos_bit_col_adst_32, // .cos_bit
TXFM_TYPE_ADST32, // .txfm_type
};
#if CONFIG_EXT_TX
// identity does not need to differentiate between row and col
// ---------------- row/col config inv_identity_4 ----------
static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_4 = {
4, // .txfm_size
1, // .stage_num
// 0, // .log_scale
inv_shift_4, // .shift
inv_stage_range_identity, // .stage_range
NULL, // .cos_bit
TXFM_TYPE_IDENTITY4, // .txfm_type
};
// ---------------- row/col config inv_identity_8 ----------------
static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_8 = {
8, // .txfm_size
1, // .stage_num
// 0, // .log_scale
inv_shift_8, // .shift
inv_stage_range_identity, // .stage_range
NULL, // .cos_bit
TXFM_TYPE_IDENTITY8, // .txfm_type
};
// ---------------- row/col config inv_identity_16 ----------------
static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_16 = {
16, // .txfm_size
1, // .stage_num
// 0, // .log_scale
inv_shift_16, // .shift
inv_stage_range_identity, // .stage_range
NULL, // .cos_bit
TXFM_TYPE_IDENTITY16, // .txfm_type
};
// ---------------- row/col config inv_identity_32 ----------------
static const TXFM_1D_CFG inv_txfm_1d_cfg_identity_32 = {
32, // .txfm_size
1, // .stage_num
// 1, // .log_scale
inv_shift_32, // .shift
inv_stage_range_identity, // .stage_range
NULL, // .cos_bit
TXFM_TYPE_IDENTITY32, // .txfm_type
};
#endif // CONFIG_EXT_TX
#endif // AV1_INV_TXFM2D_CFG_H_

View file

@ -13,7 +13,7 @@
#include "av1/common/enums.h"
#include "av1/common/av1_txfm.h"
#include "av1/common/av1_inv_txfm1d.h"
#include "av1/common/av1_inv_txfm2d_cfg.h"
#include "av1/common/av1_inv_txfm1d_cfg.h"
static INLINE TxfmFunc inv_txfm_type_to_func(TXFM_TYPE txfm_type) {
switch (txfm_type) {
@ -25,132 +25,100 @@ static INLINE TxfmFunc inv_txfm_type_to_func(TXFM_TYPE txfm_type) {
case TXFM_TYPE_ADST8: return av1_iadst8_new;
case TXFM_TYPE_ADST16: return av1_iadst16_new;
case TXFM_TYPE_ADST32: return av1_iadst32_new;
#if CONFIG_EXT_TX
case TXFM_TYPE_IDENTITY4: return av1_iidentity4_c;
case TXFM_TYPE_IDENTITY8: return av1_iidentity8_c;
case TXFM_TYPE_IDENTITY16: return av1_iidentity16_c;
case TXFM_TYPE_IDENTITY32: return av1_iidentity32_c;
#endif // CONFIG_EXT_TX
default: assert(0); return NULL;
}
}
const TXFM_2D_CFG *inv_txfm_cfg_ls[TX_TYPES][TX_SIZES] = {
// DCT_DCT
static const TXFM_1D_CFG *inv_txfm_col_cfg_ls[TX_TYPES_1D][TX_SIZES] = {
// DCT
{
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
NULL,
#endif
&inv_txfm_2d_cfg_dct_dct_4, &inv_txfm_2d_cfg_dct_dct_8,
&inv_txfm_2d_cfg_dct_dct_16, &inv_txfm_2d_cfg_dct_dct_32 },
// ADST_DCT
&inv_txfm_1d_col_cfg_dct_4, &inv_txfm_1d_col_cfg_dct_8,
&inv_txfm_1d_col_cfg_dct_16, &inv_txfm_1d_col_cfg_dct_32 },
// ADST
{
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
NULL,
#endif
&inv_txfm_2d_cfg_adst_dct_4, &inv_txfm_2d_cfg_adst_dct_8,
&inv_txfm_2d_cfg_adst_dct_16, &inv_txfm_2d_cfg_adst_dct_32 },
// DCT_ADST
{
#if CONFIG_CB4X4
NULL,
#endif
&inv_txfm_2d_cfg_dct_adst_4, &inv_txfm_2d_cfg_dct_adst_8,
&inv_txfm_2d_cfg_dct_adst_16, &inv_txfm_2d_cfg_dct_adst_32 },
// ADST_ADST
{
#if CONFIG_CB4X4
NULL,
#endif
&inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
&inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
&inv_txfm_1d_col_cfg_adst_4, &inv_txfm_1d_col_cfg_adst_8,
&inv_txfm_1d_col_cfg_adst_16, &inv_txfm_1d_col_cfg_adst_32 },
#if CONFIG_EXT_TX
// FLIPADST_DCT
// FLIPADST
{
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
NULL,
#endif
&inv_txfm_2d_cfg_adst_dct_4, &inv_txfm_2d_cfg_adst_dct_8,
&inv_txfm_2d_cfg_adst_dct_16, &inv_txfm_2d_cfg_adst_dct_32 },
// DCT_FLIPADST
&inv_txfm_1d_col_cfg_adst_4, &inv_txfm_1d_col_cfg_adst_8,
&inv_txfm_1d_col_cfg_adst_16, &inv_txfm_1d_col_cfg_adst_32 },
// IDENTITY
{
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
NULL,
#endif
&inv_txfm_2d_cfg_dct_adst_4, &inv_txfm_2d_cfg_dct_adst_8,
&inv_txfm_2d_cfg_dct_adst_16, &inv_txfm_2d_cfg_dct_adst_32 },
// FLIPADST_FLIPADST
&inv_txfm_1d_cfg_identity_4, &inv_txfm_1d_cfg_identity_8,
&inv_txfm_1d_cfg_identity_16, &inv_txfm_1d_cfg_identity_32 },
#endif // CONFIG_EXT_TX
};
static const TXFM_1D_CFG *inv_txfm_row_cfg_ls[TX_TYPES_1D][TX_SIZES] = {
// DCT
{
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
NULL,
#endif
&inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
&inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
// ADST_FLIPADST
&inv_txfm_1d_row_cfg_dct_4, &inv_txfm_1d_row_cfg_dct_8,
&inv_txfm_1d_row_cfg_dct_16, &inv_txfm_1d_row_cfg_dct_32 },
// ADST
{
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
NULL,
#endif
&inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
&inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
// FLIPADST_ADST
&inv_txfm_1d_row_cfg_adst_4, &inv_txfm_1d_row_cfg_adst_8,
&inv_txfm_1d_row_cfg_adst_16, &inv_txfm_1d_row_cfg_adst_32 },
#if CONFIG_EXT_TX
// FLIPADST
{
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
NULL,
#endif
&inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
&inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
{ // IDTX
#if CONFIG_CB4X4
NULL,
&inv_txfm_1d_row_cfg_adst_4, &inv_txfm_1d_row_cfg_adst_8,
&inv_txfm_1d_row_cfg_adst_16, &inv_txfm_1d_row_cfg_adst_32 },
// IDENTITY
{
#if CONFIG_CHROMA_2X2
NULL,
#endif
&inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
&inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
{ // V_DCT
#if CONFIG_CB4X4
NULL,
#endif
&inv_txfm_2d_cfg_dct_adst_4, &inv_txfm_2d_cfg_dct_adst_8,
&inv_txfm_2d_cfg_dct_adst_16, &inv_txfm_2d_cfg_dct_adst_32 },
{ // H_DCT
#if CONFIG_CB4X4
NULL,
#endif
&inv_txfm_2d_cfg_adst_dct_4, &inv_txfm_2d_cfg_adst_dct_8,
&inv_txfm_2d_cfg_adst_dct_16, &inv_txfm_2d_cfg_adst_dct_32 },
{ // V_ADST
#if CONFIG_CB4X4
NULL,
#endif
&inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
&inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
{ // H_ADST
#if CONFIG_CB4X4
NULL,
#endif
&inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
&inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
{ // V_FLIP_ADST
#if CONFIG_CB4X4
NULL,
#endif
&inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
&inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
{ // H_FLIP_ADST
#if CONFIG_CB4X4
NULL,
#endif
&inv_txfm_2d_cfg_adst_adst_4, &inv_txfm_2d_cfg_adst_adst_8,
&inv_txfm_2d_cfg_adst_adst_16, &inv_txfm_2d_cfg_adst_adst_32 },
&inv_txfm_1d_cfg_identity_4, &inv_txfm_1d_cfg_identity_8,
&inv_txfm_1d_cfg_identity_16, &inv_txfm_1d_cfg_identity_32 },
#endif // CONFIG_EXT_TX
};
TXFM_2D_FLIP_CFG av1_get_inv_txfm_cfg(int tx_type, int tx_size) {
TXFM_2D_FLIP_CFG cfg;
set_flip_cfg(tx_type, &cfg);
cfg.cfg = inv_txfm_cfg_ls[tx_type][tx_size];
int tx_type_col = vtx_tab[tx_type];
int tx_type_row = htx_tab[tx_type];
// TODO(sarahparker) this is currently only implemented for
// square transforms
cfg.col_cfg = inv_txfm_col_cfg_ls[tx_type_col][tx_size];
cfg.row_cfg = inv_txfm_row_cfg_ls[tx_type_row][tx_size];
return cfg;
}
TXFM_2D_FLIP_CFG av1_get_inv_txfm_64x64_cfg(int tx_type) {
TXFM_2D_FLIP_CFG cfg = { 0, 0, NULL };
TXFM_2D_FLIP_CFG cfg = { 0, 0, NULL, NULL };
switch (tx_type) {
case DCT_DCT:
cfg.cfg = &inv_txfm_2d_cfg_dct_dct_64;
cfg.col_cfg = &inv_txfm_1d_col_cfg_dct_64;
cfg.row_cfg = &inv_txfm_1d_row_cfg_dct_64;
set_flip_cfg(tx_type, &cfg);
break;
default: assert(0);
@ -161,14 +129,15 @@ TXFM_2D_FLIP_CFG av1_get_inv_txfm_64x64_cfg(int tx_type) {
static INLINE void inv_txfm2d_add_c(const int32_t *input, int16_t *output,
int stride, TXFM_2D_FLIP_CFG *cfg,
int32_t *txfm_buf) {
const int txfm_size = cfg->cfg->txfm_size;
const int8_t *shift = cfg->cfg->shift;
const int8_t *stage_range_col = cfg->cfg->stage_range_col;
const int8_t *stage_range_row = cfg->cfg->stage_range_row;
const int8_t *cos_bit_col = cfg->cfg->cos_bit_col;
const int8_t *cos_bit_row = cfg->cfg->cos_bit_row;
const TxfmFunc txfm_func_col = inv_txfm_type_to_func(cfg->cfg->txfm_type_col);
const TxfmFunc txfm_func_row = inv_txfm_type_to_func(cfg->cfg->txfm_type_row);
// TODO(sarahparker) must correct for rectangular transforms in follow up
const int txfm_size = cfg->row_cfg->txfm_size;
const int8_t *shift = cfg->row_cfg->shift;
const int8_t *stage_range_col = cfg->col_cfg->stage_range;
const int8_t *stage_range_row = cfg->row_cfg->stage_range;
const int8_t *cos_bit_col = cfg->col_cfg->cos_bit;
const int8_t *cos_bit_row = cfg->row_cfg->cos_bit;
const TxfmFunc txfm_func_col = inv_txfm_type_to_func(cfg->col_cfg->txfm_type);
const TxfmFunc txfm_func_row = inv_txfm_type_to_func(cfg->row_cfg->txfm_type);
// txfm_buf's length is txfm_size * txfm_size + 2 * txfm_size
// it is used for intermediate data buffering
@ -216,7 +185,11 @@ static INLINE void inv_txfm2d_add_facade(const int32_t *input, uint16_t *output,
// int16_t*
TXFM_2D_FLIP_CFG cfg = av1_get_inv_txfm_cfg(tx_type, tx_size);
inv_txfm2d_add_c(input, (int16_t *)output, stride, &cfg, txfm_buf);
clamp_block((int16_t *)output, cfg.cfg->txfm_size, stride, 0, (1 << bd) - 1);
// TODO(sarahparker) just using the cfg_row->txfm_size for now because
// we are assumint this is only used for square transforms. This will
// be adjusted in a follow up
clamp_block((int16_t *)output, cfg.row_cfg->txfm_size, stride, 0,
(1 << bd) - 1);
}
void av1_inv_txfm2d_add_4x4_c(const int32_t *input, uint16_t *output,

View file

@ -1,447 +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 AV1_INV_TXFM2D_CFG_H_
#define AV1_INV_TXFM2D_CFG_H_
#include "av1/common/av1_inv_txfm1d.h"
// ---------------- config inv_dct_dct_4 ----------------
static const int8_t inv_shift_dct_dct_4[2] = { 0, -4 };
static const int8_t inv_stage_range_col_dct_dct_4[4] = { 18, 18, 17, 17 };
static const int8_t inv_stage_range_row_dct_dct_4[4] = { 18, 18, 18, 18 };
static const int8_t inv_cos_bit_col_dct_dct_4[4] = { 13, 13, 13, 13 };
static const int8_t inv_cos_bit_row_dct_dct_4[4] = { 13, 13, 13, 13 };
static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_dct_4 = {
4, // .txfm_size
4, // .stage_num_col
4, // .stage_num_row
// 0, // .log_scale
inv_shift_dct_dct_4, // .shift
inv_stage_range_col_dct_dct_4, // .stage_range_col
inv_stage_range_row_dct_dct_4, // .stage_range_row
inv_cos_bit_col_dct_dct_4, // .cos_bit_col
inv_cos_bit_row_dct_dct_4, // .cos_bit_row
TXFM_TYPE_DCT4, // .txfm_type_col
TXFM_TYPE_DCT4
}; // .txfm_type_row
// ---------------- config inv_dct_dct_8 ----------------
static const int8_t inv_shift_dct_dct_8[2] = { 0, -5 };
static const int8_t inv_stage_range_col_dct_dct_8[6] = {
19, 19, 19, 19, 18, 18
};
static const int8_t inv_stage_range_row_dct_dct_8[6] = {
19, 19, 19, 19, 19, 19
};
static const int8_t inv_cos_bit_col_dct_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
static const int8_t inv_cos_bit_row_dct_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_dct_8 = {
8, // .txfm_size
6, // .stage_num_col
6, // .stage_num_row
// 0, // .log_scale
inv_shift_dct_dct_8, // .shift
inv_stage_range_col_dct_dct_8, // .stage_range_col
inv_stage_range_row_dct_dct_8, // .stage_range_row
inv_cos_bit_col_dct_dct_8, // .cos_bit_col
inv_cos_bit_row_dct_dct_8, // .cos_bit_row
TXFM_TYPE_DCT8, // .txfm_type_col
TXFM_TYPE_DCT8
}; // .txfm_type_row
// ---------------- config inv_dct_dct_16 ----------------
static const int8_t inv_shift_dct_dct_16[2] = { -1, -5 };
static const int8_t inv_stage_range_col_dct_dct_16[8] = { 19, 19, 19, 19,
19, 19, 18, 18 };
static const int8_t inv_stage_range_row_dct_dct_16[8] = { 20, 20, 20, 20,
20, 20, 20, 20 };
static const int8_t inv_cos_bit_col_dct_dct_16[8] = { 13, 13, 13, 13,
13, 13, 13, 13 };
static const int8_t inv_cos_bit_row_dct_dct_16[8] = { 12, 12, 12, 12,
12, 12, 12, 12 };
static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_dct_16 = {
16, // .txfm_size
8, // .stage_num_col
8, // .stage_num_row
// 0, // .log_scale
inv_shift_dct_dct_16, // .shift
inv_stage_range_col_dct_dct_16, // .stage_range_col
inv_stage_range_row_dct_dct_16, // .stage_range_row
inv_cos_bit_col_dct_dct_16, // .cos_bit_col
inv_cos_bit_row_dct_dct_16, // .cos_bit_row
TXFM_TYPE_DCT16, // .txfm_type_col
TXFM_TYPE_DCT16
}; // .txfm_type_row
// ---------------- config inv_dct_dct_32 ----------------
static const int8_t inv_shift_dct_dct_32[2] = { -1, -5 };
static const int8_t inv_stage_range_col_dct_dct_32[10] = { 19, 19, 19, 19, 19,
19, 19, 19, 18, 18 };
static const int8_t inv_stage_range_row_dct_dct_32[10] = { 20, 20, 20, 20, 20,
20, 20, 20, 20, 20 };
static const int8_t inv_cos_bit_col_dct_dct_32[10] = { 13, 13, 13, 13, 13,
13, 13, 13, 13, 13 };
static const int8_t inv_cos_bit_row_dct_dct_32[10] = { 12, 12, 12, 12, 12,
12, 12, 12, 12, 12 };
static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_dct_32 = {
32, // .txfm_size
10, // .stage_num_col
10, // .stage_num_row
// 1, // .log_scale
inv_shift_dct_dct_32, // .shift
inv_stage_range_col_dct_dct_32, // .stage_range_col
inv_stage_range_row_dct_dct_32, // .stage_range_row
inv_cos_bit_col_dct_dct_32, // .cos_bit_col
inv_cos_bit_row_dct_dct_32, // .cos_bit_row
TXFM_TYPE_DCT32, // .txfm_type_col
TXFM_TYPE_DCT32
}; // .txfm_type_row
// ---------------- config inv_dct_dct_64 ----------------
static const int8_t inv_shift_dct_dct_64[2] = { -1, -7 };
static const int8_t inv_stage_range_col_dct_dct_64[12] = {
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 18, 18
};
static const int8_t inv_stage_range_row_dct_dct_64[12] = {
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
};
static const int8_t inv_cos_bit_col_dct_dct_64[12] = { 13, 13, 13, 13, 13, 13,
13, 13, 13, 13, 13, 13 };
static const int8_t inv_cos_bit_row_dct_dct_64[12] = { 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12 };
static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_dct_64 = {
64, // .txfm_size
12, // .stage_num_col
12, // .stage_num_row
inv_shift_dct_dct_64, // .shift
inv_stage_range_col_dct_dct_64, // .stage_range_col
inv_stage_range_row_dct_dct_64, // .stage_range_row
inv_cos_bit_col_dct_dct_64, // .cos_bit_col
inv_cos_bit_row_dct_dct_64, // .cos_bit_row
TXFM_TYPE_DCT64, // .txfm_type_col
TXFM_TYPE_DCT64
}; // .txfm_type_row
// ---------------- config inv_dct_adst_4 ----------------
static const int8_t inv_shift_dct_adst_4[2] = { 0, -4 };
static const int8_t inv_stage_range_col_dct_adst_4[4] = { 18, 18, 17, 17 };
static const int8_t inv_stage_range_row_dct_adst_4[6] = {
18, 18, 18, 18, 18, 18
};
static const int8_t inv_cos_bit_col_dct_adst_4[4] = { 13, 13, 13, 13 };
static const int8_t inv_cos_bit_row_dct_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_adst_4 = {
4, // .txfm_size
4, // .stage_num_col
6, // .stage_num_row
// 0, // .log_scale
inv_shift_dct_adst_4, // .shift
inv_stage_range_col_dct_adst_4, // .stage_range_col
inv_stage_range_row_dct_adst_4, // .stage_range_row
inv_cos_bit_col_dct_adst_4, // .cos_bit_col
inv_cos_bit_row_dct_adst_4, // .cos_bit_row
TXFM_TYPE_DCT4, // .txfm_type_col
TXFM_TYPE_ADST4
}; // .txfm_type_row
// ---------------- config inv_dct_adst_8 ----------------
static const int8_t inv_shift_dct_adst_8[2] = { 0, -5 };
static const int8_t inv_stage_range_col_dct_adst_8[6] = {
19, 19, 19, 19, 18, 18
};
static const int8_t inv_stage_range_row_dct_adst_8[8] = { 19, 19, 19, 19,
19, 19, 19, 19 };
static const int8_t inv_cos_bit_col_dct_adst_8[6] = { 13, 13, 13, 13, 13, 13 };
static const int8_t inv_cos_bit_row_dct_adst_8[8] = { 13, 13, 13, 13,
13, 13, 13, 13 };
static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_adst_8 = {
8, // .txfm_size
6, // .stage_num_col
8, // .stage_num_row
// 0, // .log_scale
inv_shift_dct_adst_8, // .shift
inv_stage_range_col_dct_adst_8, // .stage_range_col
inv_stage_range_row_dct_adst_8, // .stage_range_row
inv_cos_bit_col_dct_adst_8, // .cos_bit_col
inv_cos_bit_row_dct_adst_8, // .cos_bit_row
TXFM_TYPE_DCT8, // .txfm_type_col
TXFM_TYPE_ADST8
}; // .txfm_type_row
// ---------------- config inv_dct_adst_16 ----------------
static const int8_t inv_shift_dct_adst_16[2] = { -1, -5 };
static const int8_t inv_stage_range_col_dct_adst_16[8] = { 19, 19, 19, 19,
19, 19, 18, 18 };
static const int8_t inv_stage_range_row_dct_adst_16[10] = {
20, 20, 20, 20, 20, 20, 20, 20, 20, 20
};
static const int8_t inv_cos_bit_col_dct_adst_16[8] = { 13, 13, 13, 13,
13, 13, 13, 13 };
static const int8_t inv_cos_bit_row_dct_adst_16[10] = { 12, 12, 12, 12, 12,
12, 12, 12, 12, 12 };
static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_adst_16 = {
16, // .txfm_size
8, // .stage_num_col
10, // .stage_num_row
// 0, // .log_scale
inv_shift_dct_adst_16, // .shift
inv_stage_range_col_dct_adst_16, // .stage_range_col
inv_stage_range_row_dct_adst_16, // .stage_range_row
inv_cos_bit_col_dct_adst_16, // .cos_bit_col
inv_cos_bit_row_dct_adst_16, // .cos_bit_row
TXFM_TYPE_DCT16, // .txfm_type_col
TXFM_TYPE_ADST16
}; // .txfm_type_row
// ---------------- config inv_dct_adst_32 ----------------
static const int8_t inv_shift_dct_adst_32[2] = { -1, -5 };
static const int8_t inv_stage_range_col_dct_adst_32[10] = {
19, 19, 19, 19, 19, 19, 19, 19, 18, 18
};
static const int8_t inv_stage_range_row_dct_adst_32[12] = {
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
};
static const int8_t inv_cos_bit_col_dct_adst_32[10] = { 13, 13, 13, 13, 13,
13, 13, 13, 13, 13 };
static const int8_t inv_cos_bit_row_dct_adst_32[12] = {
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
};
static const TXFM_2D_CFG inv_txfm_2d_cfg_dct_adst_32 = {
32, // .txfm_size
10, // .stage_num_col
12, // .stage_num_row
// 1, // .log_scale
inv_shift_dct_adst_32, // .shift
inv_stage_range_col_dct_adst_32, // .stage_range_col
inv_stage_range_row_dct_adst_32, // .stage_range_row
inv_cos_bit_col_dct_adst_32, // .cos_bit_col
inv_cos_bit_row_dct_adst_32, // .cos_bit_row
TXFM_TYPE_DCT32, // .txfm_type_col
TXFM_TYPE_ADST32
}; // .txfm_type_row
// ---------------- config inv_adst_adst_4 ----------------
static const int8_t inv_shift_adst_adst_4[2] = { 0, -4 };
static const int8_t inv_stage_range_col_adst_adst_4[6] = { 18, 18, 18,
18, 17, 17 };
static const int8_t inv_stage_range_row_adst_adst_4[6] = { 18, 18, 18,
18, 18, 18 };
static const int8_t inv_cos_bit_col_adst_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
static const int8_t inv_cos_bit_row_adst_adst_4[6] = { 13, 13, 13, 13, 13, 13 };
static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_adst_4 = {
4, // .txfm_size
6, // .stage_num_col
6, // .stage_num_row
// 0, // .log_scale
inv_shift_adst_adst_4, // .shift
inv_stage_range_col_adst_adst_4, // .stage_range_col
inv_stage_range_row_adst_adst_4, // .stage_range_row
inv_cos_bit_col_adst_adst_4, // .cos_bit_col
inv_cos_bit_row_adst_adst_4, // .cos_bit_row
TXFM_TYPE_ADST4, // .txfm_type_col
TXFM_TYPE_ADST4
}; // .txfm_type_row
// ---------------- config inv_adst_adst_8 ----------------
static const int8_t inv_shift_adst_adst_8[2] = { 0, -5 };
static const int8_t inv_stage_range_col_adst_adst_8[8] = { 19, 19, 19, 19,
19, 19, 18, 18 };
static const int8_t inv_stage_range_row_adst_adst_8[8] = { 19, 19, 19, 19,
19, 19, 19, 19 };
static const int8_t inv_cos_bit_col_adst_adst_8[8] = { 13, 13, 13, 13,
13, 13, 13, 13 };
static const int8_t inv_cos_bit_row_adst_adst_8[8] = { 13, 13, 13, 13,
13, 13, 13, 13 };
static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_adst_8 = {
8, // .txfm_size
8, // .stage_num_col
8, // .stage_num_row
// 0, // .log_scale
inv_shift_adst_adst_8, // .shift
inv_stage_range_col_adst_adst_8, // .stage_range_col
inv_stage_range_row_adst_adst_8, // .stage_range_row
inv_cos_bit_col_adst_adst_8, // .cos_bit_col
inv_cos_bit_row_adst_adst_8, // .cos_bit_row
TXFM_TYPE_ADST8, // .txfm_type_col
TXFM_TYPE_ADST8
}; // .txfm_type_row
// ---------------- config inv_adst_adst_16 ----------------
static const int8_t inv_shift_adst_adst_16[2] = { -1, -5 };
static const int8_t inv_stage_range_col_adst_adst_16[10] = {
19, 19, 19, 19, 19, 19, 19, 19, 18, 18
};
static const int8_t inv_stage_range_row_adst_adst_16[10] = {
20, 20, 20, 20, 20, 20, 20, 20, 20, 20
};
static const int8_t inv_cos_bit_col_adst_adst_16[10] = { 13, 13, 13, 13, 13,
13, 13, 13, 13, 13 };
static const int8_t inv_cos_bit_row_adst_adst_16[10] = { 12, 12, 12, 12, 12,
12, 12, 12, 12, 12 };
static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_adst_16 = {
16, // .txfm_size
10, // .stage_num_col
10, // .stage_num_row
// 0, // .log_scale
inv_shift_adst_adst_16, // .shift
inv_stage_range_col_adst_adst_16, // .stage_range_col
inv_stage_range_row_adst_adst_16, // .stage_range_row
inv_cos_bit_col_adst_adst_16, // .cos_bit_col
inv_cos_bit_row_adst_adst_16, // .cos_bit_row
TXFM_TYPE_ADST16, // .txfm_type_col
TXFM_TYPE_ADST16
}; // .txfm_type_row
// ---------------- config inv_adst_adst_32 ----------------
static const int8_t inv_shift_adst_adst_32[2] = { -1, -5 };
static const int8_t inv_stage_range_col_adst_adst_32[12] = {
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 18, 18
};
static const int8_t inv_stage_range_row_adst_adst_32[12] = {
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
};
static const int8_t inv_cos_bit_col_adst_adst_32[12] = {
13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13
};
static const int8_t inv_cos_bit_row_adst_adst_32[12] = {
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
};
static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_adst_32 = {
32, // .txfm_size
12, // .stage_num_col
12, // .stage_num_row
// 1, // .log_scale
inv_shift_adst_adst_32, // .shift
inv_stage_range_col_adst_adst_32, // .stage_range_col
inv_stage_range_row_adst_adst_32, // .stage_range_row
inv_cos_bit_col_adst_adst_32, // .cos_bit_col
inv_cos_bit_row_adst_adst_32, // .cos_bit_row
TXFM_TYPE_ADST32, // .txfm_type_col
TXFM_TYPE_ADST32
}; // .txfm_type_row
// ---------------- config inv_adst_dct_4 ----------------
static const int8_t inv_shift_adst_dct_4[2] = { 0, -4 };
static const int8_t inv_stage_range_col_adst_dct_4[6] = {
18, 18, 18, 18, 17, 17
};
static const int8_t inv_stage_range_row_adst_dct_4[4] = { 18, 18, 18, 18 };
static const int8_t inv_cos_bit_col_adst_dct_4[6] = { 13, 13, 13, 13, 13, 13 };
static const int8_t inv_cos_bit_row_adst_dct_4[4] = { 13, 13, 13, 13 };
static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_dct_4 = {
4, // .txfm_size
6, // .stage_num_col
4, // .stage_num_row
// 0, // .log_scale
inv_shift_adst_dct_4, // .shift
inv_stage_range_col_adst_dct_4, // .stage_range_col
inv_stage_range_row_adst_dct_4, // .stage_range_row
inv_cos_bit_col_adst_dct_4, // .cos_bit_col
inv_cos_bit_row_adst_dct_4, // .cos_bit_row
TXFM_TYPE_ADST4, // .txfm_type_col
TXFM_TYPE_DCT4
}; // .txfm_type_row
// ---------------- config inv_adst_dct_8 ----------------
static const int8_t inv_shift_adst_dct_8[2] = { 0, -5 };
static const int8_t inv_stage_range_col_adst_dct_8[8] = { 19, 19, 19, 19,
19, 19, 18, 18 };
static const int8_t inv_stage_range_row_adst_dct_8[6] = {
19, 19, 19, 19, 19, 19
};
static const int8_t inv_cos_bit_col_adst_dct_8[8] = { 13, 13, 13, 13,
13, 13, 13, 13 };
static const int8_t inv_cos_bit_row_adst_dct_8[6] = { 13, 13, 13, 13, 13, 13 };
static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_dct_8 = {
8, // .txfm_size
8, // .stage_num_col
6, // .stage_num_row
// 0, // .log_scale
inv_shift_adst_dct_8, // .shift
inv_stage_range_col_adst_dct_8, // .stage_range_col
inv_stage_range_row_adst_dct_8, // .stage_range_row
inv_cos_bit_col_adst_dct_8, // .cos_bit_col
inv_cos_bit_row_adst_dct_8, // .cos_bit_row
TXFM_TYPE_ADST8, // .txfm_type_col
TXFM_TYPE_DCT8
}; // .txfm_type_row
// ---------------- config inv_adst_dct_16 ----------------
static const int8_t inv_shift_adst_dct_16[2] = { -1, -5 };
static const int8_t inv_stage_range_col_adst_dct_16[10] = {
19, 19, 19, 19, 19, 19, 19, 19, 18, 18
};
static const int8_t inv_stage_range_row_adst_dct_16[8] = { 20, 20, 20, 20,
20, 20, 20, 20 };
static const int8_t inv_cos_bit_col_adst_dct_16[10] = { 13, 13, 13, 13, 13,
13, 13, 13, 13, 13 };
static const int8_t inv_cos_bit_row_adst_dct_16[8] = { 12, 12, 12, 12,
12, 12, 12, 12 };
static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_dct_16 = {
16, // .txfm_size
10, // .stage_num_col
8, // .stage_num_row
// 0, // .log_scale
inv_shift_adst_dct_16, // .shift
inv_stage_range_col_adst_dct_16, // .stage_range_col
inv_stage_range_row_adst_dct_16, // .stage_range_row
inv_cos_bit_col_adst_dct_16, // .cos_bit_col
inv_cos_bit_row_adst_dct_16, // .cos_bit_row
TXFM_TYPE_ADST16, // .txfm_type_col
TXFM_TYPE_DCT16
}; // .txfm_type_row
// ---------------- config inv_adst_dct_32 ----------------
static const int8_t inv_shift_adst_dct_32[2] = { -1, -5 };
static const int8_t inv_stage_range_col_adst_dct_32[12] = {
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 18, 18
};
static const int8_t inv_stage_range_row_adst_dct_32[10] = {
20, 20, 20, 20, 20, 20, 20, 20, 20, 20
};
static const int8_t inv_cos_bit_col_adst_dct_32[12] = {
13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13
};
static const int8_t inv_cos_bit_row_adst_dct_32[10] = { 12, 12, 12, 12, 12,
12, 12, 12, 12, 12 };
static const TXFM_2D_CFG inv_txfm_2d_cfg_adst_dct_32 = {
32, // .txfm_size
12, // .stage_num_col
10, // .stage_num_row
// 1, // .log_scale
inv_shift_adst_dct_32, // .shift
inv_stage_range_col_adst_dct_32, // .stage_range_col
inv_stage_range_row_adst_dct_32, // .stage_range_row
inv_cos_bit_col_adst_dct_32, // .cos_bit_col
inv_cos_bit_row_adst_dct_32, // .cos_bit_row
TXFM_TYPE_ADST32, // .txfm_type_col
TXFM_TYPE_DCT32
}; // .txfm_type_row
extern const TXFM_2D_CFG *inv_txfm_cfg_ls[TX_TYPES][TX_SIZES];
#endif // AV1_INV_TXFM2D_CFG_H_

View file

@ -22,7 +22,7 @@
#include "av1/common/seg_common.h"
#define CONFIG_PARALLEL_DEBLOCKING_15TAPLUMAONLY 0
#define PARALLEL_DEBLOCKING_15TAPLUMAONLY 1
// 64 bit masks for left transform size. Each 1 represents a position where
// we should apply a loop filter across the left border of an 8x8 block
@ -42,7 +42,7 @@
//
// A loopfilter should be applied to every other 8x8 horizontally.
static const uint64_t left_64x64_txform_mask[TX_SIZES] = {
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
0xffffffffffffffffULL, // TX_2X2
#endif
0xffffffffffffffffULL, // TX_4X4
@ -72,7 +72,7 @@ static const uint64_t left_64x64_txform_mask[TX_SIZES] = {
//
// A loopfilter should be applied to every other 4 the row vertically.
static const uint64_t above_64x64_txform_mask[TX_SIZES] = {
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
0xffffffffffffffffULL, // TX_4X4
#endif
0xffffffffffffffffULL, // TX_4X4
@ -171,7 +171,7 @@ static const uint64_t above_border = 0x000000ff000000ffULL;
// 16 bit masks for uv transform sizes.
static const uint16_t left_64x64_txform_mask_uv[TX_SIZES] = {
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
0xffff, // TX_2X2
#endif
0xffff, // TX_4X4
@ -184,7 +184,7 @@ static const uint16_t left_64x64_txform_mask_uv[TX_SIZES] = {
};
static const uint16_t above_64x64_txform_mask_uv[TX_SIZES] = {
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
0xffff, // TX_2X2
#endif
0xffff, // TX_4X4
@ -267,11 +267,14 @@ static const int mode_lf_lut[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // INTRA_MODES
#if CONFIG_ALT_INTRA
0,
#endif
#if CONFIG_SMOOTH_HV
0, 0,
#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
1, 1, 0, 1, // INTER_MODES (ZEROMV == 0)
#if CONFIG_EXT_INTER
1, 1, 1, 1, 1, 1, 1, 1, 0, 1 // INTER_COMPOUND_MODES (ZERO_ZEROMV == 0)
#endif // CONFIG_EXT_INTER
1, 1, 1, 1, 1, 1, 0, 1 // INTER_COMPOUND_MODES (ZERO_ZEROMV == 0)
#endif // CONFIG_EXT_INTER
};
static void update_sharpness(loop_filter_info_n *lfi, int sharpness_lvl) {
@ -345,8 +348,6 @@ static uint8_t get_filter_level(const loop_filter_info_n *lfi_n,
}
#endif
#define NELEMENTS(x) (sizeof((x)) / sizeof((x)[0]))
void av1_loop_filter_init(AV1_COMMON *cm) {
assert(MB_MODE_COUNT == NELEMENTS(mode_lf_lut));
loop_filter_info_n *lfi = &cm->lf_info;
@ -1362,9 +1363,10 @@ typedef struct {
// the non420 case).
// Note: 'row_masks_ptr' and/or 'col_masks_ptr' can be passed NULL.
static void get_filter_level_and_masks_non420(
AV1_COMMON *const cm, const struct macroblockd_plane *const plane,
AV1_COMMON *const cm, const struct macroblockd_plane *const plane, int pl,
MODE_INFO **mib, int mi_row, int mi_col, int idx_r, uint8_t *const lfl_r,
unsigned int *const mask_4x4_int_r, FilterMasks *const row_masks_ptr,
unsigned int *const mask_4x4_int_r_ptr,
unsigned int *const mask_4x4_int_c_ptr, FilterMasks *const row_masks_ptr,
FilterMasks *const col_masks_ptr) {
const int ss_x = plane->subsampling_x;
const int ss_y = plane->subsampling_y;
@ -1372,7 +1374,7 @@ static void get_filter_level_and_masks_non420(
FilterMasks row_masks, col_masks;
memset(&row_masks, 0, sizeof(row_masks));
memset(&col_masks, 0, sizeof(col_masks));
*mask_4x4_int_r = 0;
unsigned int mask_4x4_int_r = 0, mask_4x4_int_c = 0;
const int r = idx_r >> mi_height_log2_lookup[BLOCK_8X8];
// Determine the vertical edges that need filtering
@ -1398,10 +1400,6 @@ static void get_filter_level_and_masks_non420(
(num_4x4_blocks_high_lookup[sb_type] > 1) ? !blk_row : 1;
const int skip_this_r = skip_this && !block_edge_above;
#if CONFIG_VAR_TX
const TX_SIZE mb_tx_size = mbmi->inter_tx_size[blk_row][blk_col];
#endif
TX_SIZE tx_size = (plane->plane_type == PLANE_TYPE_UV)
? get_uv_tx_size(mbmi, plane)
: mbmi->tx_size;
@ -1411,9 +1409,6 @@ static void get_filter_level_and_masks_non420(
const int skip_border_4x4_r =
ss_y && mi_row + idx_r >= cm->mi_rows - mi_size_high[BLOCK_8X8];
TX_SIZE tx_size_c = txsize_horz_map[tx_size];
TX_SIZE tx_size_r = txsize_vert_map[tx_size];
int tx_size_mask = 0;
const int c_step = (c >> ss_x);
const int r_step = (r >> ss_y);
@ -1421,8 +1416,15 @@ static void get_filter_level_and_masks_non420(
#if CONFIG_VAR_TX
if (is_inter_block(mbmi) && !mbmi->skip) {
const int tx_row_idx =
(blk_row * mi_size_high[BLOCK_8X8] << TX_UNIT_HIGH_LOG2) >> 1;
const int tx_col_idx =
(blk_col * mi_size_wide[BLOCK_8X8] << TX_UNIT_WIDE_LOG2) >> 1;
const BLOCK_SIZE bsize =
AOMMAX(BLOCK_4X4, get_plane_block_size(mbmi->sb_type, plane));
const TX_SIZE mb_tx_size = mbmi->inter_tx_size[tx_row_idx][tx_col_idx];
tx_size = (plane->plane_type == PLANE_TYPE_UV)
? uv_txsize_lookup[sb_type][mb_tx_size][ss_x][ss_y]
? uv_txsize_lookup[bsize][mb_tx_size][0][0]
: mb_tx_size;
}
#endif
@ -1435,12 +1437,29 @@ static void get_filter_level_and_masks_non420(
#endif
#if CONFIG_VAR_TX
tx_size_r = AOMMIN(tx_size, cm->above_txfm_context[mi_col + c]);
tx_size_c =
AOMMIN(tx_size, cm->left_txfm_context[(mi_row + r) & MAX_MIB_MASK]);
TX_SIZE tx_size_r, tx_size_c;
cm->above_txfm_context[mi_col + c] = tx_size;
cm->left_txfm_context[(mi_row + r) & MAX_MIB_MASK] = tx_size;
const int tx_wide =
AOMMIN(tx_size_wide[tx_size],
tx_size_wide[cm->top_txfm_context[pl][(mi_col + idx_c)
<< TX_UNIT_WIDE_LOG2]]);
const int tx_high = AOMMIN(
tx_size_high[tx_size],
tx_size_high[cm->left_txfm_context[pl][((mi_row + idx_r) & MAX_MIB_MASK)
<< TX_UNIT_HIGH_LOG2]]);
tx_size_c = get_sqr_tx_size(tx_wide);
tx_size_r = get_sqr_tx_size(tx_high);
memset(cm->top_txfm_context[pl] + ((mi_col + idx_c) << TX_UNIT_WIDE_LOG2),
tx_size, mi_size_wide[BLOCK_8X8] << TX_UNIT_WIDE_LOG2);
memset(cm->left_txfm_context[pl] +
(((mi_row + idx_r) & MAX_MIB_MASK) << TX_UNIT_HIGH_LOG2),
tx_size, mi_size_high[BLOCK_8X8] << TX_UNIT_HIGH_LOG2);
#else
TX_SIZE tx_size_c = txsize_horz_map[tx_size];
TX_SIZE tx_size_r = txsize_vert_map[tx_size];
(void)pl;
#endif // CONFIG_VAR_TX
if (tx_size_c == TX_32X32)
@ -1477,7 +1496,7 @@ static void get_filter_level_and_masks_non420(
if (!skip_this && tx_size_c < TX_8X8 && !skip_border_4x4_c &&
(c_step & tx_size_mask) == 0)
*mask_4x4_int_r |= col_mask;
mask_4x4_int_c |= col_mask;
}
if (tx_size_r == TX_32X32)
@ -1511,20 +1530,22 @@ static void get_filter_level_and_masks_non420(
row_masks.m4x4 |= col_mask;
}
if (!skip_this && tx_size_r < TX_8X8 && !skip_border_4x4_c &&
if (!skip_this && tx_size_r < TX_8X8 && !skip_border_4x4_r &&
((r >> ss_y) & tx_size_mask) == 0)
*mask_4x4_int_r |= col_mask;
mask_4x4_int_r |= col_mask;
}
}
if (row_masks_ptr) *row_masks_ptr = row_masks;
if (col_masks_ptr) *col_masks_ptr = col_masks;
if (mask_4x4_int_c_ptr) *mask_4x4_int_c_ptr = mask_4x4_int_c;
if (mask_4x4_int_r_ptr) *mask_4x4_int_r_ptr = mask_4x4_int_r;
}
void av1_filter_block_plane_non420_ver(AV1_COMMON *const cm,
struct macroblockd_plane *plane,
MODE_INFO **mib, int mi_row,
int mi_col) {
MODE_INFO **mib, int mi_row, int mi_col,
int pl) {
const int ss_y = plane->subsampling_y;
const int row_step = mi_size_high[BLOCK_8X8] << ss_y;
struct buf_2d *const dst = &plane->dst;
@ -1537,8 +1558,8 @@ void av1_filter_block_plane_non420_ver(AV1_COMMON *const cm,
unsigned int mask_4x4_int;
FilterMasks col_masks;
const int r = idx_r >> mi_height_log2_lookup[BLOCK_8X8];
get_filter_level_and_masks_non420(cm, plane, mib, mi_row, mi_col, idx_r,
&lfl[r][0], &mask_4x4_int, NULL,
get_filter_level_and_masks_non420(cm, plane, pl, mib, mi_row, mi_col, idx_r,
&lfl[r][0], NULL, &mask_4x4_int, NULL,
&col_masks);
// Disable filtering on the leftmost column or tile boundary
@ -1572,8 +1593,8 @@ void av1_filter_block_plane_non420_ver(AV1_COMMON *const cm,
void av1_filter_block_plane_non420_hor(AV1_COMMON *const cm,
struct macroblockd_plane *plane,
MODE_INFO **mib, int mi_row,
int mi_col) {
MODE_INFO **mib, int mi_row, int mi_col,
int pl) {
const int ss_y = plane->subsampling_y;
const int row_step = mi_size_high[BLOCK_8X8] << ss_y;
struct buf_2d *const dst = &plane->dst;
@ -1585,16 +1606,13 @@ void av1_filter_block_plane_non420_hor(AV1_COMMON *const cm,
for (idx_r = 0; idx_r < cm->mib_size && mi_row + idx_r < cm->mi_rows;
idx_r += row_step) {
const int r = idx_r >> mi_height_log2_lookup[BLOCK_8X8];
get_filter_level_and_masks_non420(cm, plane, mib, mi_row, mi_col, idx_r,
&lfl[r][0], mask_4x4_int + r,
get_filter_level_and_masks_non420(cm, plane, pl, mib, mi_row, mi_col, idx_r,
&lfl[r][0], mask_4x4_int + r, NULL,
row_masks_array + r, NULL);
}
for (idx_r = 0; idx_r < cm->mib_size && mi_row + idx_r < cm->mi_rows;
idx_r += row_step) {
const int skip_border_4x4_r =
ss_y && mi_row + idx_r >= cm->mi_rows - mi_size_wide[BLOCK_8X8];
const int r = idx_r >> mi_width_log2_lookup[BLOCK_8X8];
const unsigned int mask_4x4_int_r = skip_border_4x4_r ? 0 : mask_4x4_int[r];
FilterMasks row_masks;
#if CONFIG_LOOPFILTERING_ACROSS_TILES
@ -1615,12 +1633,12 @@ void av1_filter_block_plane_non420_hor(AV1_COMMON *const cm,
if (cm->use_highbitdepth)
highbd_filter_selectively_horiz(
CONVERT_TO_SHORTPTR(dst->buf), dst->stride, row_masks.m16x16,
row_masks.m8x8, row_masks.m4x4, mask_4x4_int_r, &cm->lf_info,
row_masks.m8x8, row_masks.m4x4, mask_4x4_int[r], &cm->lf_info,
&lfl[r][0], (int)cm->bit_depth);
else
#endif // CONFIG_HIGHBITDEPTH
filter_selectively_horiz(dst->buf, dst->stride, row_masks.m16x16,
row_masks.m8x8, row_masks.m4x4, mask_4x4_int_r,
row_masks.m8x8, row_masks.m4x4, mask_4x4_int[r],
&cm->lf_info, &lfl[r][0]);
dst->buf += 8 * dst->stride;
}
@ -1839,8 +1857,6 @@ void av1_filter_block_plane_ss11_hor(AV1_COMMON *const cm,
dst->buf = dst0;
}
#if !(CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES || \
CONFIG_CB4X4)
#if CONFIG_PARALLEL_DEBLOCKING
typedef enum EDGE_DIR { VERT_EDGE = 0, HORZ_EDGE = 1, NUM_EDGE_DIRS } EDGE_DIR;
static const uint32_t av1_prediction_masks[NUM_EDGE_DIRS][BLOCK_SIZES] = {
@ -1900,7 +1916,7 @@ static const uint32_t av1_prediction_masks[NUM_EDGE_DIRS][BLOCK_SIZES] = {
static const uint32_t av1_transform_masks[NUM_EDGE_DIRS][TX_SIZES_ALL] = {
{
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
2 - 1, // TX_2X2
#endif
4 - 1, // TX_4X4
@ -1922,7 +1938,7 @@ static const uint32_t av1_transform_masks[NUM_EDGE_DIRS][TX_SIZES_ALL] = {
32 - 1 // TX_32X8
},
{
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
2 - 1, // TX_2X2
#endif
4 - 1, // TX_4X4
@ -1992,10 +2008,17 @@ static void set_lpf_parameters(AV1_DEBLOCKING_PARAMETERS *const pParams,
// not sure if changes are required.
assert(0 && "Not yet updated");
#endif // CONFIG_EXT_PARTITION
{
const TX_SIZE ts =
av1_get_transform_size(ppCurr[0], edgeDir, scaleHorz, scaleVert);
#if CONFIG_EXT_DELTA_Q
const uint32_t currLevel =
get_filter_level(cm, &cm->lf_info, &ppCurr[0]->mbmi);
#else
const uint32_t currLevel = get_filter_level(&cm->lf_info, &ppCurr[0]->mbmi);
#endif // CONFIG_EXT_DELTA_Q
const int currSkipped =
ppCurr[0]->mbmi.skip && is_inter_block(&ppCurr[0]->mbmi);
const uint32_t coord = (VERT_EDGE == edgeDir) ? (x) : (y);
@ -2016,7 +2039,13 @@ static void set_lpf_parameters(AV1_DEBLOCKING_PARAMETERS *const pParams,
const MODE_INFO *const pPrev = *(ppCurr - modeStep);
const TX_SIZE pvTs =
av1_get_transform_size(pPrev, edgeDir, scaleHorz, scaleVert);
#if CONFIG_EXT_DELTA_Q
const uint32_t pvLvl =
get_filter_level(cm, &cm->lf_info, &pPrev->mbmi);
#else
const uint32_t pvLvl = get_filter_level(&cm->lf_info, &pPrev->mbmi);
#endif // CONFIG_EXT_DELTA_Q
const int pvSkip = pPrev->mbmi.skip && is_inter_block(&pPrev->mbmi);
const int32_t puEdge =
(coord &
@ -2028,7 +2057,7 @@ static void set_lpf_parameters(AV1_DEBLOCKING_PARAMETERS *const pParams,
// if the current and the previous blocks are skipped,
// deblock the edge if the edge belongs to a PU's edge only.
if ((currLevel || pvLvl) && (!pvSkip || !currSkipped || puEdge)) {
#if CONFIG_PARALLEL_DEBLOCKING_15TAP || CONFIG_PARALLEL_DEBLOCKING_15TAPLUMAONLY
#if CONFIG_PARALLEL_DEBLOCKING_15TAP || PARALLEL_DEBLOCKING_15TAPLUMAONLY
const TX_SIZE minTs = AOMMIN(ts, pvTs);
if (TX_4X4 >= minTs) {
pParams->filterLength = 4;
@ -2036,7 +2065,7 @@ static void set_lpf_parameters(AV1_DEBLOCKING_PARAMETERS *const pParams,
pParams->filterLength = 8;
} else {
pParams->filterLength = 16;
#if CONFIG_PARALLEL_DEBLOCKING_15TAPLUMAONLY
#if PARALLEL_DEBLOCKING_15TAPLUMAONLY
// No wide filtering for chroma plane
if (scaleHorz || scaleVert) {
pParams->filterLength = 8;
@ -2046,7 +2075,7 @@ static void set_lpf_parameters(AV1_DEBLOCKING_PARAMETERS *const pParams,
#else
pParams->filterLength = (TX_4X4 >= AOMMIN(ts, pvTs)) ? (4) : (8);
#endif // CONFIG_PARALLEL_DEBLOCKING_15TAP
#endif // CONFIG_PARALLEL_DEBLOCKING_15TAP || PARALLEL_DEBLOCKING_15TAPLUMAONLY
// update the level if the current block is skipped,
// but the previous one is not
@ -2054,10 +2083,14 @@ static void set_lpf_parameters(AV1_DEBLOCKING_PARAMETERS *const pParams,
}
}
}
#if !CONFIG_CB4X4
// prepare internal edge parameters
if (currLevel && !currSkipped) {
pParams->filterLengthInternal = (TX_4X4 >= ts) ? (4) : (0);
}
#endif
// prepare common parameters
if (pParams->filterLength || pParams->filterLengthInternal) {
const loop_filter_thresh *const limits = cm->lf_info.lfthr + level;
@ -2075,15 +2108,21 @@ static void av1_filter_block_plane_vert(const AV1_COMMON *const cm,
const ptrdiff_t modeStride,
const uint32_t cuX,
const uint32_t cuY) {
const int col_step = MI_SIZE >> MI_SIZE_LOG2;
const int row_step = MI_SIZE >> MI_SIZE_LOG2;
const uint32_t scaleHorz = pPlane->subsampling_x;
const uint32_t scaleVert = pPlane->subsampling_y;
const uint32_t width = pPlane->dst.width;
const uint32_t height = pPlane->dst.height;
uint8_t *const pDst = pPlane->dst.buf;
const int dstStride = pPlane->dst.stride;
for (int y = 0; y < (MAX_MIB_SIZE >> scaleVert); y += 1) {
for (int y = 0; y < (MAX_MIB_SIZE >> scaleVert); y += row_step) {
uint8_t *p = pDst + y * MI_SIZE * dstStride;
for (int x = 0; x < (MAX_MIB_SIZE >> scaleHorz); x += 1) {
for (int x = 0; x < (MAX_MIB_SIZE >> scaleHorz); x += col_step) {
// inner loop always filter vertical edges in a MI block. If MI size
// is 8x8, it will filter the vertical edge aligned with a 8x8 block.
// If 4x4 trasnform is used, it will then filter the internal edge
// aligned with a 4x4 block
const MODE_INFO **const pCurr =
ppModeInfo + (y << scaleVert) * modeStride + (x << scaleHorz);
AV1_DEBLOCKING_PARAMETERS params;
@ -2094,31 +2133,59 @@ static void av1_filter_block_plane_vert(const AV1_COMMON *const cm,
switch (params.filterLength) {
// apply 4-tap filtering
case 4:
aom_lpf_vertical_4(p, dstStride, params.mblim, params.lim,
params.hev_thr);
#if CONFIG_HIGHBITDEPTH
if (cm->use_highbitdepth)
aom_highbd_lpf_vertical_4_c(CONVERT_TO_SHORTPTR(p), dstStride,
params.mblim, params.lim,
params.hev_thr, cm->bit_depth);
else
#endif // CONFIG_HIGHBITDEPTH
aom_lpf_vertical_4_c(p, dstStride, params.mblim, params.lim,
params.hev_thr);
break;
// apply 8-tap filtering
case 8:
aom_lpf_vertical_8(p, dstStride, params.mblim, params.lim,
params.hev_thr);
#if CONFIG_HIGHBITDEPTH
if (cm->use_highbitdepth)
aom_highbd_lpf_vertical_8_c(CONVERT_TO_SHORTPTR(p), dstStride,
params.mblim, params.lim,
params.hev_thr, cm->bit_depth);
else
#endif // CONFIG_HIGHBITDEPTH
aom_lpf_vertical_8_c(p, dstStride, params.mblim, params.lim,
params.hev_thr);
break;
#if CONFIG_PARALLEL_DEBLOCKING_15TAP || CONFIG_PARALLEL_DEBLOCKING_15TAPLUMAONLY
#if CONFIG_PARALLEL_DEBLOCKING_15TAP || PARALLEL_DEBLOCKING_15TAPLUMAONLY
// apply 16-tap filtering
case 16:
aom_lpf_vertical_16(p, dstStride, params.mblim, params.lim,
params.hev_thr);
#if CONFIG_HIGHBITDEPTH
if (cm->use_highbitdepth)
aom_highbd_lpf_vertical_16_c(CONVERT_TO_SHORTPTR(p), dstStride,
params.mblim, params.lim,
params.hev_thr, cm->bit_depth);
else
#endif // CONFIG_HIGHBITDEPTH
aom_lpf_vertical_16_c(p, dstStride, params.mblim, params.lim,
params.hev_thr);
break;
#endif // CONFIG_PARALLEL_DEBLOCKING_15TAP
#endif // CONFIG_PARALLEL_DEBLOCKING_15TAP || PARALLEL_DEBLOCKING_15TAPLUMAONLY
// no filtering
default: break;
}
// process the internal edge
if (params.filterLengthInternal) {
aom_lpf_vertical_4(p + 4, dstStride, params.mblim, params.lim,
params.hev_thr);
#if CONFIG_HIGHBITDEPTH
if (cm->use_highbitdepth)
aom_highbd_lpf_vertical_4_c(CONVERT_TO_SHORTPTR(p + 4), dstStride,
params.mblim, params.lim, params.hev_thr,
cm->bit_depth);
else
#endif // CONFIG_HIGHBITDEPTH
aom_lpf_vertical_4_c(p + 4, dstStride, params.mblim, params.lim,
params.hev_thr);
}
// advance the destination pointer
p += 8;
p += MI_SIZE;
}
}
}
@ -2129,15 +2196,21 @@ static void av1_filter_block_plane_horz(const AV1_COMMON *const cm,
const ptrdiff_t modeStride,
const uint32_t cuX,
const uint32_t cuY) {
const int col_step = MI_SIZE >> MI_SIZE_LOG2;
const int row_step = MI_SIZE >> MI_SIZE_LOG2;
const uint32_t scaleHorz = pPlane->subsampling_x;
const uint32_t scaleVert = pPlane->subsampling_y;
const uint32_t width = pPlane->dst.width;
const uint32_t height = pPlane->dst.height;
uint8_t *const pDst = pPlane->dst.buf;
const int dstStride = pPlane->dst.stride;
for (int y = 0; y < (MAX_MIB_SIZE >> scaleVert); y += 1) {
for (int y = 0; y < (MAX_MIB_SIZE >> scaleVert); y += row_step) {
uint8_t *p = pDst + y * MI_SIZE * dstStride;
for (int x = 0; x < (MAX_MIB_SIZE >> scaleHorz); x += 1) {
for (int x = 0; x < (MAX_MIB_SIZE >> scaleHorz); x += col_step) {
// inner loop always filter vertical edges in a MI block. If MI size
// is 8x8, it will first filter the vertical edge aligned with a 8x8
// block. If 4x4 trasnform is used, it will then filter the internal
// edge aligned with a 4x4 block
const MODE_INFO **const pCurr =
ppModeInfo + (y << scaleVert) * modeStride + (x << scaleHorz);
AV1_DEBLOCKING_PARAMETERS params;
@ -2148,52 +2221,84 @@ static void av1_filter_block_plane_horz(const AV1_COMMON *const cm,
switch (params.filterLength) {
// apply 4-tap filtering
case 4:
aom_lpf_horizontal_4(p, dstStride, params.mblim, params.lim,
params.hev_thr);
#if CONFIG_HIGHBITDEPTH
if (cm->use_highbitdepth)
aom_highbd_lpf_horizontal_4_c(CONVERT_TO_SHORTPTR(p), dstStride,
params.mblim, params.lim,
params.hev_thr, cm->bit_depth);
else
#endif // CONFIG_HIGHBITDEPTH
aom_lpf_horizontal_4_c(p, dstStride, params.mblim, params.lim,
params.hev_thr);
break;
// apply 8-tap filtering
case 8:
aom_lpf_horizontal_8(p, dstStride, params.mblim, params.lim,
params.hev_thr);
#if CONFIG_HIGHBITDEPTH
if (cm->use_highbitdepth)
aom_highbd_lpf_horizontal_8_c(CONVERT_TO_SHORTPTR(p), dstStride,
params.mblim, params.lim,
params.hev_thr, cm->bit_depth);
else
#endif // CONFIG_HIGHBITDEPTH
aom_lpf_horizontal_8_c(p, dstStride, params.mblim, params.lim,
params.hev_thr);
break;
#if CONFIG_PARALLEL_DEBLOCKING_15TAP || CONFIG_PARALLEL_DEBLOCKING_15TAPLUMAONLY
#if CONFIG_PARALLEL_DEBLOCKING_15TAP || PARALLEL_DEBLOCKING_15TAPLUMAONLY
// apply 16-tap filtering
case 16:
aom_lpf_horizontal_edge_16(p, dstStride, params.mblim, params.lim,
params.hev_thr);
#if CONFIG_HIGHBITDEPTH
if (cm->use_highbitdepth)
aom_highbd_lpf_horizontal_edge_16_c(
CONVERT_TO_SHORTPTR(p), dstStride, params.mblim, params.lim,
params.hev_thr, cm->bit_depth);
else
#endif // CONFIG_HIGHBITDEPTH
aom_lpf_horizontal_edge_16_c(p, dstStride, params.mblim, params.lim,
params.hev_thr);
break;
#endif // CONFIG_PARALLEL_DEBLOCKING_15TAP
#endif // CONFIG_PARALLEL_DEBLOCKING_15TAP || PARALLEL_DEBLOCKING_15TAPLUMAONLY
// no filtering
default: break;
}
// process the internal edge
if (params.filterLengthInternal) {
aom_lpf_horizontal_4(p + 4 * dstStride, dstStride, params.mblim,
params.lim, params.hev_thr);
#if CONFIG_HIGHBITDEPTH
if (cm->use_highbitdepth)
aom_highbd_lpf_horizontal_4_c(CONVERT_TO_SHORTPTR(p + 4 * dstStride),
dstStride, params.mblim, params.lim,
params.hev_thr, cm->bit_depth);
else
#endif // CONFIG_HIGHBITDEPTH
aom_lpf_horizontal_4_c(p + 4 * dstStride, dstStride, params.mblim,
params.lim, params.hev_thr);
}
// advance the destination pointer
p += 8;
p += MI_SIZE;
}
}
}
#endif // CONFIG_PARALLEL_DEBLOCKING
#endif
void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
struct macroblockd_plane planes[MAX_MB_PLANE],
int start, int stop, int y_only) {
#if CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES || \
CONFIG_CB4X4
const int num_planes = y_only ? 1 : MAX_MB_PLANE;
int mi_row, mi_col;
#if CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES || \
CONFIG_CB4X4
#if !CONFIG_PARALLEL_DEBLOCKING
#if CONFIG_VAR_TX
memset(cm->above_txfm_context, TX_SIZES, cm->mi_cols);
for (int i = 0; i < MAX_MB_PLANE; ++i)
memset(cm->top_txfm_context[i], TX_32X32, cm->mi_cols << TX_UNIT_WIDE_LOG2);
#endif // CONFIG_VAR_TX
for (mi_row = start; mi_row < stop; mi_row += cm->mib_size) {
MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride;
#if CONFIG_VAR_TX
memset(cm->left_txfm_context, TX_SIZES, MAX_MIB_SIZE);
for (int i = 0; i < MAX_MB_PLANE; ++i)
memset(cm->left_txfm_context[i], TX_32X32, MAX_MIB_SIZE
<< TX_UNIT_WIDE_LOG2);
#endif // CONFIG_VAR_TX
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += cm->mib_size) {
int plane;
@ -2202,33 +2307,23 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
for (plane = 0; plane < num_planes; ++plane) {
av1_filter_block_plane_non420_ver(cm, &planes[plane], mi + mi_col,
mi_row, mi_col);
mi_row, mi_col, plane);
av1_filter_block_plane_non420_hor(cm, &planes[plane], mi + mi_col,
mi_row, mi_col);
mi_row, mi_col, plane);
}
}
}
#else // CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES
const int num_planes = y_only ? 1 : MAX_MB_PLANE;
int mi_row, mi_col;
#if !CONFIG_PARALLEL_DEBLOCKING
enum lf_path path;
LOOP_FILTER_MASK lfm;
#else
#if CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES
assert(0 && "Not yet updated. ToDo as next steps");
#endif // CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES
if (y_only)
path = LF_PATH_444;
else if (planes[1].subsampling_y == 1 && planes[1].subsampling_x == 1)
path = LF_PATH_420;
else if (planes[1].subsampling_y == 0 && planes[1].subsampling_x == 0)
path = LF_PATH_444;
else
path = LF_PATH_SLOW;
#endif
#if CONFIG_PARALLEL_DEBLOCKING
for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) {
MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride;
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) {
av1_setup_dst_planes(planes, cm->sb_size, frame_buffer, mi_row, mi_col);
// filter all vertical edges in every 64x64 super block
for (int planeIdx = 0; planeIdx < num_planes; planeIdx += 1) {
const int32_t scaleHorz = planes[planeIdx].subsampling_x;
const int32_t scaleVert = planes[planeIdx].subsampling_y;
@ -2243,6 +2338,42 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride;
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) {
av1_setup_dst_planes(planes, cm->sb_size, frame_buffer, mi_row, mi_col);
// filter all horizontal edges in every 64x64 super block
for (int planeIdx = 0; planeIdx < num_planes; planeIdx += 1) {
const int32_t scaleHorz = planes[planeIdx].subsampling_x;
const int32_t scaleVert = planes[planeIdx].subsampling_y;
av1_filter_block_plane_horz(
cm, planes + planeIdx, (const MODE_INFO **)(mi + mi_col),
cm->mi_stride, (mi_col * MI_SIZE) >> scaleHorz,
(mi_row * MI_SIZE) >> scaleVert);
}
}
}
#endif // CONFIG_PARALLEL_DEBLOCKING
#else // CONFIG_VAR_TX || CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES
#if CONFIG_PARALLEL_DEBLOCKING
for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) {
MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride;
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) {
av1_setup_dst_planes(planes, cm->sb_size, frame_buffer, mi_row, mi_col);
// filter all vertical edges in every 64x64 super block
for (int planeIdx = 0; planeIdx < num_planes; planeIdx += 1) {
const int32_t scaleHorz = planes[planeIdx].subsampling_x;
const int32_t scaleVert = planes[planeIdx].subsampling_y;
av1_filter_block_plane_vert(
cm, planes + planeIdx, (const MODE_INFO **)(mi + mi_col),
cm->mi_stride, (mi_col * MI_SIZE) >> scaleHorz,
(mi_row * MI_SIZE) >> scaleVert);
}
}
}
for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) {
MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride;
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) {
av1_setup_dst_planes(planes, cm->sb_size, frame_buffer, mi_row, mi_col);
// filter all horizontal edges in every 64x64 super block
for (int planeIdx = 0; planeIdx < num_planes; planeIdx += 1) {
const int32_t scaleHorz = planes[planeIdx].subsampling_x;
const int32_t scaleVert = planes[planeIdx].subsampling_y;
@ -2254,6 +2385,18 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
}
}
#else // CONFIG_PARALLEL_DEBLOCKING
enum lf_path path;
LOOP_FILTER_MASK lfm;
if (y_only)
path = LF_PATH_444;
else if (planes[1].subsampling_y == 1 && planes[1].subsampling_x == 1)
path = LF_PATH_420;
else if (planes[1].subsampling_y == 0 && planes[1].subsampling_x == 0)
path = LF_PATH_444;
else
path = LF_PATH_SLOW;
for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) {
MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride;
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) {
@ -2278,9 +2421,9 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
break;
case LF_PATH_SLOW:
av1_filter_block_plane_non420_ver(cm, &planes[plane], mi + mi_col,
mi_row, mi_col);
mi_row, mi_col, plane);
av1_filter_block_plane_non420_hor(cm, &planes[plane], mi + mi_col,
mi_row, mi_col);
mi_row, mi_col, plane);
break;
}

View file

@ -115,11 +115,11 @@ void av1_filter_block_plane_ss11_hor(struct AV1Common *const cm,
void av1_filter_block_plane_non420_ver(struct AV1Common *const cm,
struct macroblockd_plane *plane,
MODE_INFO **mi_8x8, int mi_row,
int mi_col);
int mi_col, int pl);
void av1_filter_block_plane_non420_hor(struct AV1Common *const cm,
struct macroblockd_plane *plane,
MODE_INFO **mi_8x8, int mi_row,
int mi_col);
int mi_col, int pl);
void av1_loop_filter_init(struct AV1Common *cm);

View file

@ -312,6 +312,7 @@ if (aom_config("CONFIG_AOM_QM") eq "yes") {
add_proto qw/int64_t av1_block_error/, "const tran_low_t *coeff, const tran_low_t *dqcoeff, intptr_t block_size, int64_t *ssz";
add_proto qw/void av1_quantize_fp/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
specialize qw/av1_quantize_fp sse2/;
add_proto qw/void av1_quantize_fp_32x32/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
@ -399,6 +400,13 @@ if (aom_config("CONFIG_HIGHBITDEPTH") ne "yes") {
add_proto qw/void av1_fwd_idtx/, "const int16_t *src_diff, tran_low_t *coeff, int stride, int bs, int tx_type";
if (aom_config("CONFIG_DPCM_INTRA") eq "yes") {
@sizes = (4, 8, 16, 32);
foreach $size (@sizes) {
add_proto "void", "av1_dpcm_ft$size", "const int16_t *input, int stride, TX_TYPE_1D tx_type, tran_low_t *output";
}
}
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
#fwd txfm
add_proto qw/void av1_fwd_txfm2d_4x4/, "const int16_t *input, int32_t *output, int stride, int tx_type, int bd";
@ -608,15 +616,21 @@ if (aom_config("CONFIG_PVQ") eq "yes") {
if ((aom_config("CONFIG_WARPED_MOTION") eq "yes") ||
(aom_config("CONFIG_GLOBAL_MOTION") eq "yes")) {
add_proto qw/void av1_warp_affine/, "int32_t *mat, uint8_t *ref, int width, int height, int stride, uint8_t *pred, int p_col, int p_row, int p_width, int p_height, int p_stride, int subsampling_x, int subsampling_y, int ref_frm, int16_t alpha, int16_t beta, int16_t gamma, int16_t delta";
specialize qw/av1_warp_affine sse2/;
add_proto qw/void av1_warp_affine/, "const int32_t *mat, const uint8_t *ref, int width, int height, int stride, uint8_t *pred, int p_col, int p_row, int p_width, int p_height, int p_stride, int subsampling_x, int subsampling_y, int comp_avg, int16_t alpha, int16_t beta, int16_t gamma, int16_t delta";
specialize qw/av1_warp_affine sse2 ssse3/;
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
add_proto qw/void av1_highbd_warp_affine/, "int32_t *mat, uint16_t *ref, int width, int height, int stride, uint16_t *pred, int p_col, int p_row, int p_width, int p_height, int p_stride, int subsampling_x, int subsampling_y, int bd, int ref_frm, int16_t alpha, int16_t beta, int16_t gamma, int16_t delta";
add_proto qw/void av1_highbd_warp_affine/, "const int32_t *mat, const uint16_t *ref, int width, int height, int stride, uint16_t *pred, int p_col, int p_row, int p_width, int p_height, int p_stride, int subsampling_x, int subsampling_y, int bd, int comp_avg, int16_t alpha, int16_t beta, int16_t gamma, int16_t delta";
specialize qw/av1_highbd_warp_affine ssse3/;
}
}
if (aom_config("CONFIG_GLOBAL_MOTION") eq "yes" &&
aom_config("CONFIG_AV1_ENCODER") eq "yes") {
add_proto qw/double compute_cross_correlation/, "unsigned char *im1, int stride1, int x1, int y1, unsigned char *im2, int stride2, int x2, int y2";
specialize qw/compute_cross_correlation sse4_1/;
}
# LOOP_RESTORATION functions
if (aom_config("CONFIG_LOOP_RESTORATION") eq "yes") {

View file

@ -24,7 +24,7 @@ static const int cos_bit_min = 10;
static const int cos_bit_max = 16;
// cospi_arr[i][j] = (int)round(cos(M_PI*j/128) * (1<<(cos_bit_min+i)));
static const int32_t cospi_arr[7][64] = {
static const int32_t cospi_arr_data[7][64] = {
{ 1024, 1024, 1023, 1021, 1019, 1016, 1013, 1009, 1004, 999, 993, 987, 980,
972, 964, 955, 946, 936, 926, 915, 903, 891, 878, 865, 851, 837,
822, 807, 792, 775, 759, 742, 724, 706, 688, 669, 650, 630, 610,
@ -68,6 +68,10 @@ static const int32_t cospi_arr[7][64] = {
14359, 12785, 11204, 9616, 8022, 6424, 4821, 3216, 1608 }
};
static INLINE const int32_t *cospi_arr(int n) {
return cospi_arr_data[n - cos_bit_min];
}
static INLINE int32_t round_shift(int32_t value, int bit) {
assert(bit >= 1);
return (value + (1 << (bit - 1))) >> bit;
@ -139,26 +143,27 @@ typedef enum TXFM_TYPE {
TXFM_TYPE_ADST8,
TXFM_TYPE_ADST16,
TXFM_TYPE_ADST32,
TXFM_TYPE_IDENTITY4,
TXFM_TYPE_IDENTITY8,
TXFM_TYPE_IDENTITY16,
TXFM_TYPE_IDENTITY32,
} TXFM_TYPE;
typedef struct TXFM_2D_CFG {
typedef struct TXFM_1D_CFG {
const int txfm_size;
const int stage_num_col;
const int stage_num_row;
const int stage_num;
const int8_t *shift;
const int8_t *stage_range_col;
const int8_t *stage_range_row;
const int8_t *cos_bit_col;
const int8_t *cos_bit_row;
const TXFM_TYPE txfm_type_col;
const TXFM_TYPE txfm_type_row;
} TXFM_2D_CFG;
const int8_t *stage_range;
const int8_t *cos_bit;
const TXFM_TYPE txfm_type;
} TXFM_1D_CFG;
typedef struct TXFM_2D_FLIP_CFG {
int ud_flip; // flip upside down
int lr_flip; // flip left to right
const TXFM_2D_CFG *cfg;
const TXFM_1D_CFG *col_cfg;
const TXFM_1D_CFG *row_cfg;
} TXFM_2D_FLIP_CFG;
static INLINE void set_flip_cfg(int tx_type, TXFM_2D_FLIP_CFG *cfg) {
@ -171,11 +176,23 @@ static INLINE void set_flip_cfg(int tx_type, TXFM_2D_FLIP_CFG *cfg) {
cfg->lr_flip = 0;
break;
#if CONFIG_EXT_TX
case IDTX:
case V_DCT:
case H_DCT:
case V_ADST:
case H_ADST:
cfg->ud_flip = 0;
cfg->lr_flip = 0;
break;
case FLIPADST_DCT:
case FLIPADST_ADST:
case V_FLIPADST:
cfg->ud_flip = 1;
cfg->lr_flip = 0;
break;
case DCT_FLIPADST:
case ADST_FLIPADST:
case H_FLIPADST:
cfg->ud_flip = 0;
cfg->lr_flip = 1;
break;
@ -183,14 +200,6 @@ static INLINE void set_flip_cfg(int tx_type, TXFM_2D_FLIP_CFG *cfg) {
cfg->ud_flip = 1;
cfg->lr_flip = 1;
break;
case ADST_FLIPADST:
cfg->ud_flip = 0;
cfg->lr_flip = 1;
break;
case FLIPADST_ADST:
cfg->ud_flip = 1;
cfg->lr_flip = 0;
break;
#endif // CONFIG_EXT_TX
default:
cfg->ud_flip = 0;

View file

@ -179,15 +179,15 @@ void av1_foreach_transformed_block(const MACROBLOCKD *const xd,
#endif
#if CONFIG_DAALA_DIST
void av1_foreach_8x8_transformed_block_in_plane(
const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane,
void av1_foreach_8x8_transformed_block_in_yplane(
const MACROBLOCKD *const xd, BLOCK_SIZE bsize,
foreach_transformed_block_visitor visit,
foreach_transformed_block_visitor mi_visit, void *arg) {
const struct macroblockd_plane *const pd = &xd->plane[plane];
const struct macroblockd_plane *const pd = &xd->plane[0];
// block and transform sizes, in number of 4x4 blocks log 2 ("*_b")
// 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8
// transform size varies per plane, look it up in a common way.
const TX_SIZE tx_size = get_tx_size(plane, xd);
const TX_SIZE tx_size = get_tx_size(0, xd);
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
const uint8_t txw_unit = tx_size_wide_unit[tx_size];
const uint8_t txh_unit = tx_size_high_unit[tx_size];
@ -197,18 +197,24 @@ void av1_foreach_8x8_transformed_block_in_plane(
// If mb_to_right_edge is < 0 we are in a situation in which
// the current block size extends into the UMV and we won't
// visit the sub blocks that are wholly within the UMV.
const int max_blocks_wide = max_block_wide(xd, plane_bsize, plane);
const int max_blocks_high = max_block_high(xd, plane_bsize, plane);
const int max_blocks_wide = max_block_wide(xd, plane_bsize, 0);
const int max_blocks_high = max_block_high(xd, plane_bsize, 0);
const int skip_check_r = tx_size_high[tx_size] == 8 ? 1 : 0;
const int skip_check_c = tx_size_wide[tx_size] == 8 ? 1 : 0;
assert(plane_bsize >= BLOCK_8X8);
assert(tx_size == TX_4X4 || tx_size == TX_4X8 || tx_size == TX_8X4);
// Keep track of the row and column of the blocks we use so that we know
// if we are in the unrestricted motion border.
for (r = 0; r < max_blocks_high; r += txh_unit) {
// Skip visiting the sub blocks that are wholly within the UMV.
for (c = 0; c < max_blocks_wide; c += txw_unit) {
visit(plane, i, r, c, plane_bsize, tx_size, arg);
// Call whenever each 8x8 block is done
if ((r & 1) && (c & 1))
mi_visit(plane, i, r - 1, c - 1, plane_bsize, TX_8X8, arg);
visit(0, i, r, c, plane_bsize, tx_size, arg);
// Call whenever each 8x8 tx block is done
if (((r & txh_unit) || skip_check_r) && ((c & txw_unit) || skip_check_c))
mi_visit(0, i, r - (1 - skip_check_r) * txh_unit,
c - (1 - skip_check_c) * txw_unit, plane_bsize, tx_size, arg);
i += step;
}
}
@ -259,6 +265,36 @@ void av1_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,
}
#endif
void av1_reset_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col,
BLOCK_SIZE bsize) {
int i;
int nplanes;
#if CONFIG_CB4X4
int chroma_ref;
chroma_ref =
is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x,
xd->plane[1].subsampling_y);
nplanes = 1 + (MAX_MB_PLANE - 1) * chroma_ref;
#else
(void)mi_row;
(void)mi_col;
nplanes = MAX_MB_PLANE;
#endif
for (i = 0; i < nplanes; i++) {
struct macroblockd_plane *const pd = &xd->plane[i];
#if CONFIG_CHROMA_2X2 || !CONFIG_CB4X4
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
#else
const BLOCK_SIZE plane_bsize =
AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd));
#endif
const int txs_wide = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
const int txs_high = block_size_high[plane_bsize] >> tx_size_high_log2[0];
memset(pd->above_context, 0, sizeof(ENTROPY_CONTEXT) * txs_wide);
memset(pd->left_context, 0, sizeof(ENTROPY_CONTEXT) * txs_high);
}
}
void av1_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y) {
int i;

View file

@ -38,7 +38,11 @@
extern "C" {
#endif
#define SUB8X8_COMP_REF (!(CONFIG_CB4X4 && CONFIG_CHROMA_2X2))
#if (CONFIG_CHROMA_SUB8X8 || CONFIG_CHROMA_2X2)
#define SUB8X8_COMP_REF 0
#else
#define SUB8X8_COMP_REF 1
#endif
#define MAX_MB_PLANE 3
@ -49,26 +53,20 @@ extern "C" {
// 0: Uniform
// 1: Difference weighted
#define COMPOUND_SEGMENT_TYPE 1
#if COMPOUND_SEGMENT_TYPE == 0
#define MAX_SEG_MASK_BITS 1
// SEG_MASK_TYPES should not surpass 1 << MAX_SEG_MASK_BITS
typedef enum {
#if COMPOUND_SEGMENT_TYPE == 0
UNIFORM_45 = 0,
UNIFORM_45_INV,
SEG_MASK_TYPES,
} SEG_MASK_TYPE;
#elif COMPOUND_SEGMENT_TYPE == 1
#define MAX_SEG_MASK_BITS 1
// SEG_MASK_TYPES should not surpass 1 << MAX_SEG_MASK_BITS
typedef enum {
DIFFWTD_42 = 0,
DIFFWTD_42_INV,
DIFFWTD_38 = 0,
DIFFWTD_38_INV,
#endif // COMPOUND_SEGMENT_TYPE
SEG_MASK_TYPES,
} SEG_MASK_TYPE;
#endif // COMPOUND_SEGMENT_TYPE
#endif // CONFIG_COMPOUND_SEGMENT
#endif // CONFIG_EXT_INTER
@ -131,7 +129,7 @@ static INLINE int is_inter_compound_mode(PREDICTION_MODE mode) {
}
static INLINE PREDICTION_MODE compound_ref0_mode(PREDICTION_MODE mode) {
static PREDICTION_MODE lut[MB_MODE_COUNT] = {
static PREDICTION_MODE lut[] = {
MB_MODE_COUNT, // DC_PRED
MB_MODE_COUNT, // V_PRED
MB_MODE_COUNT, // H_PRED
@ -143,6 +141,10 @@ static INLINE PREDICTION_MODE compound_ref0_mode(PREDICTION_MODE mode) {
MB_MODE_COUNT, // D63_PRED
#if CONFIG_ALT_INTRA
MB_MODE_COUNT, // SMOOTH_PRED
#if CONFIG_SMOOTH_HV
MB_MODE_COUNT, // SMOOTH_V_PRED
MB_MODE_COUNT, // SMOOTH_H_PRED
#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
MB_MODE_COUNT, // TM_PRED
MB_MODE_COUNT, // NEARESTMV
@ -157,8 +159,6 @@ static INLINE PREDICTION_MODE compound_ref0_mode(PREDICTION_MODE mode) {
NEWMV, // SR_NEW_NEWMV
#endif // CONFIG_COMPOUND_SINGLEREF
NEARESTMV, // NEAREST_NEARESTMV
NEARESTMV, // NEAREST_NEARMV
NEARMV, // NEAR_NEARESTMV
NEARMV, // NEAR_NEARMV
NEARESTMV, // NEAREST_NEWMV
NEWMV, // NEW_NEARESTMV
@ -167,12 +167,13 @@ static INLINE PREDICTION_MODE compound_ref0_mode(PREDICTION_MODE mode) {
ZEROMV, // ZERO_ZEROMV
NEWMV, // NEW_NEWMV
};
assert(NELEMENTS(lut) == MB_MODE_COUNT);
assert(is_inter_compound_mode(mode));
return lut[mode];
}
static INLINE PREDICTION_MODE compound_ref1_mode(PREDICTION_MODE mode) {
static PREDICTION_MODE lut[MB_MODE_COUNT] = {
static PREDICTION_MODE lut[] = {
MB_MODE_COUNT, // DC_PRED
MB_MODE_COUNT, // V_PRED
MB_MODE_COUNT, // H_PRED
@ -184,6 +185,10 @@ static INLINE PREDICTION_MODE compound_ref1_mode(PREDICTION_MODE mode) {
MB_MODE_COUNT, // D63_PRED
#if CONFIG_ALT_INTRA
MB_MODE_COUNT, // SMOOTH_PRED
#if CONFIG_SMOOTH_HV
MB_MODE_COUNT, // SMOOTH_V_PRED
MB_MODE_COUNT, // SMOOTH_H_PRED
#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
MB_MODE_COUNT, // TM_PRED
MB_MODE_COUNT, // NEARESTMV
@ -198,8 +203,6 @@ static INLINE PREDICTION_MODE compound_ref1_mode(PREDICTION_MODE mode) {
NEWMV, // SR_NEW_NEWMV
#endif // CONFIG_COMPOUND_SINGLEREF
NEARESTMV, // NEAREST_NEARESTMV
NEARMV, // NEAREST_NEARMV
NEARESTMV, // NEAR_NEARESTMV
NEARMV, // NEAR_NEARMV
NEWMV, // NEAREST_NEWMV
NEARESTMV, // NEW_NEARESTMV
@ -208,13 +211,14 @@ static INLINE PREDICTION_MODE compound_ref1_mode(PREDICTION_MODE mode) {
ZEROMV, // ZERO_ZEROMV
NEWMV, // NEW_NEWMV
};
assert(NELEMENTS(lut) == MB_MODE_COUNT);
assert(is_inter_compound_mode(mode));
return lut[mode];
}
static INLINE int have_nearmv_in_inter_mode(PREDICTION_MODE mode) {
return (mode == NEARMV || mode == NEAR_NEARMV || mode == NEAREST_NEARMV ||
mode == NEAR_NEARESTMV || mode == NEAR_NEWMV || mode == NEW_NEARMV);
return (mode == NEARMV || mode == NEAR_NEARMV || mode == NEAR_NEWMV ||
mode == NEW_NEARMV);
}
static INLINE int have_newmv_in_inter_mode(PREDICTION_MODE mode) {
@ -260,9 +264,7 @@ static INLINE int have_newmv_in_inter_mode(PREDICTION_MODE mode) {
typedef struct {
PREDICTION_MODE as_mode;
int_mv as_mv[2]; // first, second inter predictor motion vectors
#if CONFIG_REF_MV
int_mv pred_mv[2];
#endif
#if CONFIG_EXT_INTER
int_mv ref_mv[2];
#endif // CONFIG_EXT_INTER
@ -274,12 +276,8 @@ typedef int8_t MV_REFERENCE_FRAME;
typedef struct {
// Number of base colors for Y (0) and UV (1)
uint8_t palette_size[2];
// Value of base colors for Y, U, and V
#if CONFIG_HIGHBITDEPTH
// Value of base colors for Y, U, and V
uint16_t palette_colors[3 * PALETTE_MAX_SIZE];
#else
uint8_t palette_colors[3 * PALETTE_MAX_SIZE];
#endif // CONFIG_HIGHBITDEPTH
// Only used by encoder to store the color index of the top left pixel.
// TODO(huisu): move this to encoder
uint8_t palette_first_color_idx[2];
@ -312,6 +310,9 @@ typedef struct RD_STATS {
int64_t rdcost;
int64_t sse;
int skip; // sse should equal to dist when skip == 1
#if CONFIG_DAALA_DIST && CONFIG_CB4X4
int64_t dist_y;
#endif
#if CONFIG_RD_DEBUG
int txb_coeff_cost[MAX_MB_PLANE];
#if CONFIG_VAR_TX
@ -338,7 +339,7 @@ typedef struct {
#endif // CONFIG_EXT_INTER
// This structure now relates to 8x8 block regions.
typedef struct {
typedef struct MB_MODE_INFO {
// Common for both INTER and INTRA blocks
BLOCK_SIZE sb_type;
PREDICTION_MODE mode;
@ -391,8 +392,10 @@ typedef struct {
#endif // CONFIG_EXT_INTRA
#if CONFIG_EXT_INTER
#if CONFIG_INTERINTRA
// interintra members
INTERINTRA_MODE interintra_mode;
#endif
// TODO(debargha): Consolidate these flags
int use_wedge_interintra;
int interintra_wedge_index;
@ -413,9 +416,7 @@ typedef struct {
#endif // CONFIG_MOTION_VAR
int_mv mv[2];
int_mv pred_mv[2];
#if CONFIG_REF_MV
uint8_t ref_mv_idx;
#endif
#if CONFIG_EXT_PARTITION_TYPES
PARTITION_TYPE partition;
#endif
@ -441,6 +442,13 @@ typedef struct {
WarpedMotionParams wm_params[2];
#endif // CONFIG_WARPED_MOTION
#if CONFIG_CFL
// Index of the alpha Cb and alpha Cr combination
int cfl_alpha_idx;
// Signs of alpha Cb and alpha Cr
CFL_SIGN_TYPE cfl_alpha_signs[CFL_PRED_PLANES];
#endif
BOUNDARY_TYPE boundary_info;
} MB_MODE_INFO;
@ -536,16 +544,14 @@ typedef struct macroblockd_plane {
uint8_t width, height;
#if CONFIG_AOM_QM
const qm_val_t *seg_iqmatrix[MAX_SEGMENTS][2][TX_SIZES];
const qm_val_t *seg_iqmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
const qm_val_t *seg_qmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
#endif
// encoder
const int16_t *dequant;
#if CONFIG_NEW_QUANT
const dequant_val_type_nuq *dequant_val_nuq[QUANT_PROFILES];
#endif // CONFIG_NEW_QUANT
#if CONFIG_AOM_QM
const qm_val_t *seg_qmatrix[MAX_SEGMENTS][2][TX_SIZES];
#endif
#if CONFIG_PVQ || CONFIG_DAALA_DIST
DECLARE_ALIGNED(16, int16_t, pred[MAX_SB_SQUARE]);
@ -558,14 +564,14 @@ typedef struct macroblockd_plane {
((x) + (i) * (1 << (tx_size_wide_log2[0] + tx_size_high_log2[0])))
typedef struct RefBuffer {
// TODO(dkovalev): idx is not really required and should be removed, now it
// is used in av1_onyxd_if.c
int idx;
YV12_BUFFER_CONFIG *buf;
struct scale_factors sf;
} RefBuffer;
typedef int16_t EobThresholdMD[TX_SIZES_ALL][TX_TYPES];
#if CONFIG_ADAPT_SCAN
typedef int16_t EobThresholdMD[TX_TYPES][EOB_THRESHOLD_NUM];
#endif
typedef struct macroblockd {
struct macroblockd_plane plane[MAX_MB_PLANE];
@ -606,6 +612,11 @@ typedef struct macroblockd {
/* pointer to current frame */
const YV12_BUFFER_CONFIG *cur_buf;
#if CONFIG_INTRABC
/* Scale of the current frame with respect to itself */
struct scale_factors sf_identity;
#endif
ENTROPY_CONTEXT *above_context[MAX_MB_PLANE];
ENTROPY_CONTEXT left_context[MAX_MB_PLANE][2 * MAX_MIB_SIZE];
@ -615,7 +626,7 @@ typedef struct macroblockd {
#if CONFIG_VAR_TX
TXFM_CONTEXT *above_txfm_context;
TXFM_CONTEXT *left_txfm_context;
TXFM_CONTEXT left_txfm_context_buffer[MAX_MIB_SIZE];
TXFM_CONTEXT left_txfm_context_buffer[2 * MAX_MIB_SIZE];
TX_SIZE max_tx_size;
#if CONFIG_SUPERTX
@ -626,11 +637,9 @@ typedef struct macroblockd {
// block dimension in the unit of mode_info.
uint8_t n8_w, n8_h;
#if CONFIG_REF_MV
uint8_t ref_mv_count[MODE_CTX_REF_FRAMES];
CANDIDATE_MV ref_mv_stack[MODE_CTX_REF_FRAMES][MAX_REF_MV_STACK_SIZE];
uint8_t is_sec_rect;
#endif
#if CONFIG_PVQ
daala_dec_ctx daala_dec;
@ -638,10 +647,8 @@ typedef struct macroblockd {
#if CONFIG_EC_ADAPT
FRAME_CONTEXT *tile_ctx;
#endif
#if CONFIG_HIGHBITDEPTH
/* Bit depth: 8, 10, 12 */
int bd;
#endif
int qindex[MAX_SEGMENTS];
int lossless[MAX_SEGMENTS];
@ -699,6 +706,10 @@ static const TX_TYPE intra_mode_to_tx_type_context[INTRA_MODES] = {
ADST_DCT, // D63
#if CONFIG_ALT_INTRA
ADST_ADST, // SMOOTH
#if CONFIG_SMOOTH_HV
ADST_DCT, // SMOOTH_V
DCT_ADST, // SMOOTH_H
#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
ADST_ADST, // TM
};
@ -761,24 +772,24 @@ static const int ext_tx_set_index_inter[EXT_TX_SET_TYPES] = {
static INLINE TxSetType get_ext_tx_set_type(TX_SIZE tx_size, BLOCK_SIZE bs,
int is_inter, int use_reduced_set) {
const TX_SIZE tx_size2 = txsize_sqr_up_map[tx_size];
tx_size = txsize_sqr_map[tx_size];
const TX_SIZE tx_size_sqr_up = txsize_sqr_up_map[tx_size];
const TX_SIZE tx_size_sqr = txsize_sqr_map[tx_size];
#if CONFIG_CB4X4 && USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4
(void)bs;
if (tx_size > TX_32X32) return EXT_TX_SET_DCTONLY;
if (tx_size_sqr > TX_32X32) return EXT_TX_SET_DCTONLY;
#else
if (tx_size > TX_32X32 || bs < BLOCK_8X8) return EXT_TX_SET_DCTONLY;
if (tx_size_sqr > TX_32X32 || bs < BLOCK_8X8) return EXT_TX_SET_DCTONLY;
#endif
if (use_reduced_set)
return is_inter ? EXT_TX_SET_DCT_IDTX : EXT_TX_SET_DTT4_IDTX;
if (tx_size2 == TX_32X32)
if (tx_size_sqr_up == TX_32X32)
return is_inter ? EXT_TX_SET_DCT_IDTX : EXT_TX_SET_DCTONLY;
if (is_inter)
return (tx_size == TX_16X16 ? EXT_TX_SET_DTT9_IDTX_1DDCT
: EXT_TX_SET_ALL16);
return (tx_size_sqr == TX_16X16 ? EXT_TX_SET_DTT9_IDTX_1DDCT
: EXT_TX_SET_ALL16);
else
return (tx_size == TX_16X16 ? EXT_TX_SET_DTT4_IDTX
: EXT_TX_SET_DTT4_IDTX_1DDCT);
return (tx_size_sqr == TX_16X16 ? EXT_TX_SET_DTT4_IDTX
: EXT_TX_SET_DTT4_IDTX_1DDCT);
}
static INLINE int get_ext_tx_set(TX_SIZE tx_size, BLOCK_SIZE bs, int is_inter,
@ -791,7 +802,7 @@ static INLINE int get_ext_tx_set(TX_SIZE tx_size, BLOCK_SIZE bs, int is_inter,
static const int use_intra_ext_tx_for_txsize[EXT_TX_SETS_INTRA][EXT_TX_SIZES] =
{
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ 1, 1, 1, 1, 1 }, // unused
{ 0, 1, 1, 0, 0 },
{ 0, 0, 0, 1, 0 },
@ -799,12 +810,12 @@ static const int use_intra_ext_tx_for_txsize[EXT_TX_SETS_INTRA][EXT_TX_SIZES] =
{ 1, 1, 1, 1 }, // unused
{ 1, 1, 0, 0 },
{ 0, 0, 1, 0 },
#endif // CONFIG_CB4X4
#endif // CONFIG_CHROMA_2X2
};
static const int use_inter_ext_tx_for_txsize[EXT_TX_SETS_INTER][EXT_TX_SIZES] =
{
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ 1, 1, 1, 1, 1 }, // unused
{ 0, 1, 1, 0, 0 },
{ 0, 0, 0, 1, 0 },
@ -814,7 +825,7 @@ static const int use_inter_ext_tx_for_txsize[EXT_TX_SETS_INTER][EXT_TX_SIZES] =
{ 1, 1, 0, 0 },
{ 0, 0, 1, 0 },
{ 0, 0, 0, 1 },
#endif // CONFIG_CB4X4
#endif // CONFIG_CHROMA_2X2
};
// Transform types used in each intra set
@ -887,6 +898,45 @@ static INLINE int is_rect_tx_allowed(const MACROBLOCKD *xd,
return is_rect_tx_allowed_bsize(mbmi->sb_type) &&
!xd->lossless[mbmi->segment_id];
}
#if CONFIG_RECT_TX_EXT
static INLINE int is_quarter_tx_allowed_bsize(BLOCK_SIZE bsize) {
static const char LUT_QTTX[BLOCK_SIZES] = {
#if CONFIG_CB4X4
0, // BLOCK_2X2
0, // BLOCK_2X4
0, // BLOCK_4X2
#endif
0, // BLOCK_4X4
0, // BLOCK_4X8
0, // BLOCK_8X4
0, // BLOCK_8X8
1, // BLOCK_8X16
1, // BLOCK_16X8
0, // BLOCK_16X16
0, // BLOCK_16X32
0, // BLOCK_32X16
0, // BLOCK_32X32
0, // BLOCK_32X64
0, // BLOCK_64X32
0, // BLOCK_64X64
#if CONFIG_EXT_PARTITION
0, // BLOCK_64X128
0, // BLOCK_128X64
0, // BLOCK_128X128
#endif // CONFIG_EXT_PARTITION
};
return LUT_QTTX[bsize];
}
static INLINE int is_quarter_tx_allowed(const MACROBLOCKD *xd,
const MB_MODE_INFO *mbmi,
int is_inter) {
return is_quarter_tx_allowed_bsize(mbmi->sb_type) && is_inter &&
!xd->lossless[mbmi->segment_id];
}
#endif // CONFIG_RECT_TX_EXT
#endif // CONFIG_RECT_TX
#endif // CONFIG_EXT_TX
@ -926,8 +976,14 @@ static INLINE TX_SIZE tx_size_from_tx_mode(BLOCK_SIZE bsize, TX_MODE tx_mode,
#define MAX_ANGLE_DELTA 3
#define ANGLE_STEP 3
extern const int16_t dr_intra_derivative[90];
static const uint8_t mode_to_angle_map[INTRA_MODES] = {
static const uint8_t mode_to_angle_map[] = {
0, 90, 180, 45, 135, 111, 157, 203, 67, 0,
#if CONFIG_ALT_INTRA
0,
#if CONFIG_SMOOTH_HV
0, 0,
#endif // CONFIG_SMOOTH_HV
#endif // CONFIG_ALT_INTRA
};
#if CONFIG_INTRA_INTERP
// Returns whether filter selection is needed for a given
@ -977,10 +1033,10 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, const MACROBLOCKD *xd,
int block, TX_SIZE tx_size) {
const MODE_INFO *const mi = xd->mi[0];
const MB_MODE_INFO *const mbmi = &mi->mbmi;
#if CONFIG_INTRABC
// TODO(aconverse@google.com): Revisit this decision
#if CONFIG_INTRABC && (!CONFIG_EXT_TX || CONFIG_TXK_SEL)
// TODO(aconverse@google.com): Handle INTRABC + EXT_TX + TXK_SEL
if (is_intrabc_block(mbmi)) return DCT_DCT;
#endif // CONFIG_INTRABC
#endif // CONFIG_INTRABC && (!CONFIG_EXT_TX || CONFIG_TXK_SEL)
#if !CONFIG_TXK_SEL
#if FIXED_TX_TYPE
const int block_raster_idx = av1_block_index_to_raster_order(tx_size, block);
@ -1002,7 +1058,7 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, const MACROBLOCKD *xd,
if (is_inter_block(mbmi)) {
// UV Inter only
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
if (tx_size < TX_4X4) return DCT_DCT;
#endif
return (mbmi->tx_type == IDTX && txsize_sqr_map[tx_size] >= TX_32X32)
@ -1013,11 +1069,13 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, const MACROBLOCKD *xd,
#if CONFIG_CB4X4
(void)block;
#if CONFIG_CHROMA_2X2
if (tx_size < TX_4X4)
return DCT_DCT;
else
#endif
return intra_mode_to_tx_type_context[mbmi->uv_mode];
#else
#else // CONFIG_CB4X4
// Sub8x8-Inter/Intra OR UV-Intra
if (is_inter_block(mbmi)) // Sub8x8-Inter
@ -1051,17 +1109,17 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, const MACROBLOCKD *xd,
void av1_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y);
static INLINE int tx_size_to_depth(TX_SIZE tx_size) {
return (int)(tx_size - TX_4X4);
return (int)(tx_size - TX_SIZE_LUMA_MIN);
}
static INLINE TX_SIZE depth_to_tx_size(int depth) {
return (TX_SIZE)(depth + TX_4X4);
return (TX_SIZE)(depth + TX_SIZE_LUMA_MIN);
}
static INLINE TX_SIZE get_uv_tx_size(const MB_MODE_INFO *mbmi,
const struct macroblockd_plane *pd) {
TX_SIZE uv_txsize;
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
assert(mbmi->tx_size > TX_2X2);
#endif
@ -1073,9 +1131,6 @@ static INLINE TX_SIZE get_uv_tx_size(const MB_MODE_INFO *mbmi,
uv_txsize = uv_txsize_lookup[mbmi->sb_type][mbmi->tx_size][pd->subsampling_x]
[pd->subsampling_y];
#if CONFIG_CB4X4 && !CONFIG_CHROMA_2X2
uv_txsize = AOMMAX(uv_txsize, TX_4X4);
#endif
assert(uv_txsize != TX_INVALID);
return uv_txsize;
}
@ -1092,17 +1147,8 @@ get_plane_block_size(BLOCK_SIZE bsize, const struct macroblockd_plane *pd) {
return ss_size_lookup[bsize][pd->subsampling_x][pd->subsampling_y];
}
static INLINE void reset_skip_context(MACROBLOCKD *xd, BLOCK_SIZE bsize) {
int i;
for (i = 0; i < MAX_MB_PLANE; i++) {
struct macroblockd_plane *const pd = &xd->plane[i];
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
const int txs_wide = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
const int txs_high = block_size_high[plane_bsize] >> tx_size_high_log2[0];
memset(pd->above_context, 0, sizeof(ENTROPY_CONTEXT) * txs_wide);
memset(pd->left_context, 0, sizeof(ENTROPY_CONTEXT) * txs_high);
}
}
void av1_reset_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col,
BLOCK_SIZE bsize);
typedef void (*foreach_transformed_block_visitor)(int plane, int block,
int blk_row, int blk_col,
@ -1121,8 +1167,8 @@ void av1_foreach_transformed_block(const MACROBLOCKD *const xd,
#endif
#if CONFIG_DAALA_DIST
void av1_foreach_8x8_transformed_block_in_plane(
const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane,
void av1_foreach_8x8_transformed_block_in_yplane(
const MACROBLOCKD *const xd, BLOCK_SIZE bsize,
foreach_transformed_block_visitor visit,
foreach_transformed_block_visitor mi_visit, void *arg);
#endif

View file

@ -26,13 +26,9 @@ int sb_all_skip(const AV1_COMMON *const cm, int mi_row, int mi_col) {
int skip = 1;
maxc = cm->mi_cols - mi_col;
maxr = cm->mi_rows - mi_row;
#if CONFIG_EXT_PARTITION
if (maxr > cm->mib_size_log2) maxr = cm->mib_size_log2;
if (maxc > cm->mib_size_log2) maxc = cm->mib_size_log2;
#else
if (maxr > MAX_MIB_SIZE) maxr = MAX_MIB_SIZE;
if (maxc > MAX_MIB_SIZE) maxc = MAX_MIB_SIZE;
#endif
maxr = AOMMIN(maxr, cm->mib_size);
maxc = AOMMIN(maxc, cm->mib_size);
for (r = 0; r < maxr; r++) {
for (c = 0; c < maxc; c++) {
@ -63,13 +59,9 @@ int sb_compute_dering_list(const AV1_COMMON *const cm, int mi_row, int mi_col,
grid = cm->mi_grid_visible;
maxc = cm->mi_cols - mi_col;
maxr = cm->mi_rows - mi_row;
#if CONFIG_EXT_PARTITION
if (maxr > cm->mib_size_log2) maxr = cm->mib_size_log2;
if (maxc > cm->mib_size_log2) maxc = cm->mib_size_log2;
#else
if (maxr > MAX_MIB_SIZE) maxr = MAX_MIB_SIZE;
if (maxc > MAX_MIB_SIZE) maxc = MAX_MIB_SIZE;
#endif
maxr = AOMMIN(maxr, cm->mib_size);
maxc = AOMMIN(maxc, cm->mib_size);
const int r_step = mi_size_high[BLOCK_8X8];
const int c_step = mi_size_wide[BLOCK_8X8];

View file

@ -47,23 +47,27 @@ void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
: tx_size_high[tx_size];
// Number of pixel on the top and left borders.
const int num_pel = block_width + block_height;
const double num_pel = block_width + block_height;
int sum_u = 0;
int sum_v = 0;
// Match behavior of build_intra_predictors (reconintra.c) at superblock
// boundaries:
//
// 127 127 127 .. 127 127 127 127 127 127
// 129 A B .. Y Z
// 129 C D .. W X
// 129 E F .. U V
// 129 G H .. S T T T T T
// ..
// Match behavior of build_intra_predictors (reconintra.c) at superblock
// boundaries:
//
// 127 127 127 .. 127 127 127 127 127 127
// 129 A B .. Y Z
// 129 C D .. W X
// 129 E F .. U V
// 129 G H .. S T T T T T
// ..
// TODO(ltrudeau) replace this with DC_PRED assembly
#if CONFIG_CHROMA_SUB8X8
if (xd->chroma_up_available && xd->mb_to_right_edge >= 0) {
#else
if (xd->up_available && xd->mb_to_right_edge >= 0) {
#endif
// TODO(ltrudeau) replace this with DC_PRED assembly
for (int i = 0; i < block_width; i++) {
sum_u += dst_u[-dst_u_stride + i];
sum_v += dst_v[-dst_v_stride + i];
@ -73,7 +77,11 @@ void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
sum_v = block_width * 127;
}
#if CONFIG_CHROMA_SUB8X8
if (xd->chroma_left_available && xd->mb_to_bottom_edge >= 0) {
#else
if (xd->left_available && xd->mb_to_bottom_edge >= 0) {
#endif
for (int i = 0; i < block_height; i++) {
sum_u += dst_u[i * dst_u_stride - 1];
sum_v += dst_v[i * dst_v_stride - 1];
@ -83,25 +91,22 @@ void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
sum_v += block_height * 129;
}
xd->cfl->dc_pred[CFL_PRED_U] = (sum_u + (num_pel >> 1)) / num_pel;
xd->cfl->dc_pred[CFL_PRED_V] = (sum_v + (num_pel >> 1)) / num_pel;
xd->cfl->dc_pred[CFL_PRED_U] = sum_u / num_pel;
xd->cfl->dc_pred[CFL_PRED_V] = sum_v / num_pel;
}
// Predict the current transform block using CfL.
// it is assumed that dst points at the start of the transform block
void cfl_predict_block(const CFL_CTX *cfl, uint8_t *dst, int dst_stride,
int row, int col, TX_SIZE tx_size, int dc_pred) {
const int tx_block_width = tx_size_wide[tx_size];
const int tx_block_height = tx_size_high[tx_size];
int row, int col, TX_SIZE tx_size, double dc_pred,
double alpha) {
const int width = tx_size_wide[tx_size];
const int height = tx_size_high[tx_size];
// TODO(ltrudeau) implement alpha
// Place holder for alpha
const double alpha = 0;
const double y_avg = cfl_load(cfl, dst, dst_stride, row, col, tx_size);
const double y_avg = cfl_load(cfl, dst, dst_stride, row, col, width, height);
for (int j = 0; j < tx_block_height; j++) {
for (int i = 0; i < tx_block_width; i++) {
dst[i] = (uint8_t)(alpha * y_avg + dc_pred + 0.5);
for (int j = 0; j < height; j++) {
for (int i = 0; i < width; i++) {
dst[i] = (uint8_t)(alpha * (dst[i] - y_avg) + dc_pred + 0.5);
}
dst += dst_stride;
}
@ -142,9 +147,7 @@ void cfl_store(CFL_CTX *cfl, const uint8_t *input, int input_stride, int row,
// Load from the CfL pixel buffer into output
double cfl_load(const CFL_CTX *cfl, uint8_t *output, int output_stride, int row,
int col, TX_SIZE tx_size) {
const int tx_width = tx_size_wide[tx_size];
const int tx_height = tx_size_high[tx_size];
int col, int width, int height) {
const int sub_x = cfl->subsampling_x;
const int sub_y = cfl->subsampling_y;
const int tx_off_log2 = tx_size_wide_log2[0];
@ -161,12 +164,12 @@ double cfl_load(const CFL_CTX *cfl, uint8_t *output, int output_stride, int row,
// TODO(ltrudeau) add support for 4:2:2
if (sub_y == 0 && sub_x == 0) {
y_pix = &cfl->y_pix[(row * MAX_SB_SIZE + col) << tx_off_log2];
int uv_width = (col << tx_off_log2) + tx_width;
int uv_width = (col << tx_off_log2) + width;
diff_width = uv_width - cfl->y_width;
int uv_height = (row << tx_off_log2) + tx_width;
int uv_height = (row << tx_off_log2) + height;
diff_height = uv_height - cfl->y_height;
for (int j = 0; j < tx_height; j++) {
for (int i = 0; i < tx_width; i++) {
for (int j = 0; j < height; j++) {
for (int i = 0; i < width; i++) {
// In 4:4:4, pixels match 1 to 1
output[output_row_offset + i] = y_pix[pred_row_offset + i];
}
@ -175,12 +178,12 @@ double cfl_load(const CFL_CTX *cfl, uint8_t *output, int output_stride, int row,
}
} else if (sub_y == 1 && sub_x == 1) {
y_pix = &cfl->y_pix[(row * MAX_SB_SIZE + col) << (tx_off_log2 + sub_y)];
int uv_width = ((col << tx_off_log2) + tx_width) << sub_x;
int uv_width = ((col << tx_off_log2) + width) << sub_x;
diff_width = (uv_width - cfl->y_width) >> sub_x;
int uv_height = ((row << tx_off_log2) + tx_width) << sub_y;
int uv_height = ((row << tx_off_log2) + height) << sub_y;
diff_height = (uv_height - cfl->y_height) >> sub_y;
for (int j = 0; j < tx_height; j++) {
for (int i = 0; i < tx_width; i++) {
for (int j = 0; j < height; j++) {
for (int i = 0; i < width; i++) {
top_left = (pred_row_offset + i) << sub_y;
bot_left = top_left + MAX_SB_SIZE;
// In 4:2:0, average pixels in 2x2 grid
@ -206,9 +209,9 @@ double cfl_load(const CFL_CTX *cfl, uint8_t *output, int output_stride, int row,
// frame, the columns will be copied over them.
if (diff_width > 0) {
int last_pixel;
output_row_offset = tx_width - diff_width;
output_row_offset = width - diff_width;
for (int j = 0; j < tx_height; j++) {
for (int j = 0; j < height; j++) {
last_pixel = output_row_offset - 1;
for (int i = 0; i < diff_width; i++) {
output[output_row_offset + i] = output[last_pixel];
@ -221,7 +224,7 @@ double cfl_load(const CFL_CTX *cfl, uint8_t *output, int output_stride, int row,
output_row_offset = diff_height * output_stride;
const int last_row_offset = output_row_offset - output_stride;
for (int j = 0; j < diff_height; j++) {
for (int i = 0; i < tx_width; i++) {
for (int i = 0; i < width; i++) {
output[output_row_offset + i] = output[last_row_offset + i];
}
output_row_offset += output_stride;
@ -230,11 +233,11 @@ double cfl_load(const CFL_CTX *cfl, uint8_t *output, int output_stride, int row,
int avg = 0;
output_row_offset = 0;
for (int j = 0; j < tx_height; j++) {
for (int i = 0; i < tx_width; i++) {
for (int j = 0; j < height; j++) {
for (int i = 0; i < width; i++) {
avg += output[output_row_offset + i];
}
output_row_offset += output_stride;
}
return avg / (double)(tx_width * tx_height);
return avg / (double)(width * height);
}

View file

@ -12,6 +12,8 @@
#ifndef AV1_COMMON_CFL_H_
#define AV1_COMMON_CFL_H_
#include <assert.h>
#include "av1/common/enums.h"
// Forward declaration of AV1_COMMON, in order to avoid creating a cyclic
@ -33,20 +35,53 @@ typedef struct {
int subsampling_x, subsampling_y;
// CfL Performs its own block level DC_PRED for each chromatic plane
int dc_pred[CFL_PRED_PLANES];
double dc_pred[CFL_PRED_PLANES];
// The rate associated with each alpha codeword
int costs[CFL_ALPHABET_SIZE];
// Count the number of TX blocks in a predicted block to know when you are at
// the last one, so you can check for skips.
// TODO(any) Is there a better way to do this?
int num_tx_blk[CFL_PRED_PLANES];
} CFL_CTX;
static const double cfl_alpha_mags[CFL_MAGS_SIZE] = {
0., 0.125, -0.125, 0.25, -0.25, 0.5, -0.5
};
static const int cfl_alpha_codes[CFL_ALPHABET_SIZE][CFL_PRED_PLANES] = {
// barrbrain's simple 1D quant ordered by subset 3 likelihood
{ 0, 0 }, { 1, 1 }, { 3, 0 }, { 3, 1 }, { 1, 0 }, { 3, 3 },
{ 0, 1 }, { 5, 5 }, { 5, 3 }, { 1, 3 }, { 5, 3 }, { 3, 5 },
{ 0, 3 }, { 5, 1 }, { 1, 5 }, { 0, 5 }
};
void cfl_init(CFL_CTX *cfl, AV1_COMMON *cm, int subsampling_x,
int subsampling_y);
void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize, TX_SIZE tx_size);
static INLINE double cfl_idx_to_alpha(int alpha_idx, CFL_SIGN_TYPE alpha_sign,
CFL_PRED_TYPE pred_type) {
const int mag_idx = cfl_alpha_codes[alpha_idx][pred_type];
const double abs_alpha = cfl_alpha_mags[mag_idx];
if (alpha_sign == CFL_SIGN_POS) {
return abs_alpha;
} else {
assert(abs_alpha != 0.0);
assert(cfl_alpha_mags[mag_idx + 1] == -abs_alpha);
return -abs_alpha;
}
}
void cfl_predict_block(const CFL_CTX *cfl, uint8_t *dst, int dst_stride,
int row, int col, TX_SIZE tx_size, int dc_pred);
int row, int col, TX_SIZE tx_size, double dc_pred,
double alpha);
void cfl_store(CFL_CTX *cfl, const uint8_t *input, int input_stride, int row,
int col, TX_SIZE tx_size);
double cfl_load(const CFL_CTX *cfl, uint8_t *output, int output_stride, int row,
int col, TX_SIZE tx_size);
int col, int width, int height);
#endif // AV1_COMMON_CFL_H_

View file

@ -21,105 +21,117 @@ extern "C" {
#endif
#if CONFIG_EXT_PARTITION
#define IF_EXT_PARTITION(...) __VA_ARGS__
#define IF_EXT_PARTITION(...) __VA_ARGS__,
#else
#define IF_EXT_PARTITION(...)
#endif
// Log 2 conversion lookup tables for block width and height
static const uint8_t b_width_log2_lookup[BLOCK_SIZES] = {
static const uint8_t b_width_log2_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
0, 0, 0,
#endif
0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, IF_EXT_PARTITION(4, 5, 5)
0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, IF_EXT_PARTITION(4, 5, 5) 0, 2, 1, 3
};
static const uint8_t b_height_log2_lookup[BLOCK_SIZES] = {
static const uint8_t b_height_log2_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
0, 0, 0,
#endif
0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, IF_EXT_PARTITION(5, 4, 5)
0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, IF_EXT_PARTITION(5, 4, 5) 2, 0, 3, 1
};
// Log 2 conversion lookup tables for modeinfo width and height
static const uint8_t mi_width_log2_lookup[BLOCK_SIZES] = {
static const uint8_t mi_width_log2_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, IF_EXT_PARTITION(4, 5, 5)
0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, IF_EXT_PARTITION(4, 5, 5) 0,
2, 1, 3
#else
0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, IF_EXT_PARTITION(3, 4, 4)
0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, IF_EXT_PARTITION(3, 4, 4) 0, 1, 0, 2
#endif
};
static const uint8_t mi_height_log2_lookup[BLOCK_SIZES] = {
static const uint8_t mi_height_log2_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
0, 0, 0, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, IF_EXT_PARTITION(5, 4, 5)
0, 0, 0, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, IF_EXT_PARTITION(5, 4, 5) 2,
0, 3, 1
#else
0, 0, 0, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, IF_EXT_PARTITION(4, 3, 4)
0, 0, 0, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, IF_EXT_PARTITION(4, 3, 4) 1, 0, 2, 0
#endif
};
static const uint8_t mi_size_wide[BLOCK_SIZES] = {
/* clang-format off */
static const uint8_t mi_size_wide[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16, IF_EXT_PARTITION(16, 32, 32)
1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16,
IF_EXT_PARTITION(16, 32, 32) 1, 4, 2, 8
#else
1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, IF_EXT_PARTITION(8, 16, 16)
1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, IF_EXT_PARTITION(8, 16, 16) 1, 2, 1, 4
#endif
};
static const uint8_t mi_size_high[BLOCK_SIZES] = {
static const uint8_t mi_size_high[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16, IF_EXT_PARTITION(32, 16, 32)
1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16,
IF_EXT_PARTITION(32, 16, 32) 4, 1, 8, 2
#else
1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, IF_EXT_PARTITION(16, 8, 16)
1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, IF_EXT_PARTITION(16, 8, 16) 2, 1, 4, 1
#endif
};
/* clang-format on */
// Width/height lookup tables in units of various block sizes
static const uint8_t block_size_wide[BLOCK_SIZES] = {
static const uint8_t block_size_wide[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
2, 2, 4,
2, 2, 4,
#endif
4, 4, 8, 8, 8, 16, 16, 16, 32, 32, 32, 64, 64, IF_EXT_PARTITION(64, 128, 128)
4, 4, 8, 8, 8, 16, 16,
16, 32, 32, 32, 64, 64, IF_EXT_PARTITION(64, 128, 128) 4,
16, 8, 32
};
static const uint8_t block_size_high[BLOCK_SIZES] = {
static const uint8_t block_size_high[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
2, 4, 2,
2, 4, 2,
#endif
4, 8, 4, 8, 16, 8, 16, 32, 16, 32, 64, 32, 64, IF_EXT_PARTITION(128, 64, 128)
4, 8, 4, 8, 16, 8, 16,
32, 16, 32, 64, 32, 64, IF_EXT_PARTITION(128, 64, 128) 16,
4, 32, 8
};
static const uint8_t num_4x4_blocks_wide_lookup[BLOCK_SIZES] = {
static const uint8_t num_4x4_blocks_wide_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
1, 1, 1,
#endif
1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16, IF_EXT_PARTITION(16, 32, 32)
1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16, IF_EXT_PARTITION(16, 32, 32) 1,
4, 2, 8
};
static const uint8_t num_4x4_blocks_high_lookup[BLOCK_SIZES] = {
static const uint8_t num_4x4_blocks_high_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
1, 1, 1,
#endif
1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16, IF_EXT_PARTITION(32, 16, 32)
1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16, IF_EXT_PARTITION(32, 16, 32) 4,
1, 8, 2
};
static const uint8_t num_8x8_blocks_wide_lookup[BLOCK_SIZES] = {
static const uint8_t num_8x8_blocks_wide_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
1, 1, 1,
#endif
1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, IF_EXT_PARTITION(8, 16, 16)
1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, IF_EXT_PARTITION(8, 16, 16) 1, 2, 1, 4
};
static const uint8_t num_8x8_blocks_high_lookup[BLOCK_SIZES] = {
static const uint8_t num_8x8_blocks_high_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
1, 1, 1,
#endif
1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, IF_EXT_PARTITION(16, 8, 16)
1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, IF_EXT_PARTITION(16, 8, 16) 2, 1, 4, 1
};
static const uint8_t num_16x16_blocks_wide_lookup[BLOCK_SIZES] = {
static const uint8_t num_16x16_blocks_wide_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
1, 1, 1,
#endif
1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, IF_EXT_PARTITION(4, 8, 8)
1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, IF_EXT_PARTITION(4, 8, 8) 1, 1, 1, 2
};
static const uint8_t num_16x16_blocks_high_lookup[BLOCK_SIZES] = {
static const uint8_t num_16x16_blocks_high_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
1, 1, 1,
#endif
1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 4, 2, 4, IF_EXT_PARTITION(8, 4, 8)
1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 4, 2, 4, IF_EXT_PARTITION(8, 4, 8) 1, 1, 2, 1
};
// AOMMIN(3, AOMMIN(b_width_log2(bsize), b_height_log2(bsize)))
@ -130,11 +142,12 @@ static const uint8_t size_group_lookup[BLOCK_SIZES] = {
0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, IF_EXT_PARTITION(3, 3, 3)
};
static const uint8_t num_pels_log2_lookup[BLOCK_SIZES] = {
static const uint8_t num_pels_log2_lookup[BLOCK_SIZES_ALL] = {
#if CONFIG_CB4X4
2, 3, 3,
#endif
4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12, IF_EXT_PARTITION(13, 13, 14)
4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12, IF_EXT_PARTITION(13, 13, 14) 6,
6, 8, 8
};
/* clang-format off */
@ -424,9 +437,11 @@ static const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES] =
};
static const TX_SIZE max_txsize_lookup[BLOCK_SIZES] = {
#if CONFIG_CB4X4
// 2X2, 2X4, 4X2,
#if CONFIG_CHROMA_2X2
TX_2X2, TX_2X2, TX_2X2,
#elif CONFIG_CB4X4
TX_4X4, TX_4X4, TX_4X4,
#endif
// 4X4
TX_4X4,
@ -457,10 +472,12 @@ static const TX_SIZE max_txsize_lookup[BLOCK_SIZES] = {
#if CONFIG_RECT_TX && (CONFIG_EXT_TX || CONFIG_VAR_TX)
static const TX_SIZE max_txsize_rect_lookup[BLOCK_SIZES] = {
#if CONFIG_CB4X4
// 2X2, 2X4, 4X2,
#if CONFIG_CHROMA_2X2
TX_2X2, TX_2X2, TX_2X2,
#endif // CONFIG_CB4X4
#elif CONFIG_CB4X4
TX_4X4, TX_4X4, TX_4X4,
#endif
// 4X4
TX_4X4,
// 4X8, 8X4, 8X8
@ -487,10 +504,49 @@ static const TX_SIZE max_txsize_rect_lookup[BLOCK_SIZES] = {
#endif // CONFIG_EXT_PARTITION
#endif // CONFIG_TX64X64
};
#if CONFIG_EXT_TX && CONFIG_RECT_TX_EXT
static const TX_SIZE quarter_txsize_lookup[BLOCK_SIZES] = {
#if CONFIG_CB4X4
// 2X2, 2X4, 4X2,
TX_INVALID, TX_INVALID, TX_INVALID,
#endif
// 4x4,
TX_INVALID,
// 4x8, 8x4, 8x8,
TX_INVALID, TX_INVALID, TX_INVALID,
// 8x16, 16x8, 16x16,
TX_4X16, TX_16X4, TX_INVALID,
// 16x32, 32x16, 32x32,
TX_8X32, TX_32X8, TX_INVALID,
// 32x64, 64x32, 64x64
TX_INVALID, TX_INVALID, TX_INVALID,
#if CONFIG_EXT_PARTITION
// 64x128, 128x64, 128x128
TX_INVALID, TX_INVALID, TX_INVALID,
#endif
};
#endif // CONFIG_EXT_TX && CONFIG_RECT_TX_EXT
#else
#define max_txsize_rect_lookup max_txsize_lookup
#endif // CONFIG_RECT_TX && (CONFIG_EXT_TX || CONFIG_VAR_TX)
static const TX_TYPE_1D vtx_tab[TX_TYPES] = {
DCT_1D, ADST_1D, DCT_1D, ADST_1D,
#if CONFIG_EXT_TX
FLIPADST_1D, DCT_1D, FLIPADST_1D, ADST_1D, FLIPADST_1D, IDTX_1D,
DCT_1D, IDTX_1D, ADST_1D, IDTX_1D, FLIPADST_1D, IDTX_1D,
#endif // CONFIG_EXT_TX
};
static const TX_TYPE_1D htx_tab[TX_TYPES] = {
DCT_1D, DCT_1D, ADST_1D, ADST_1D,
#if CONFIG_EXT_TX
DCT_1D, FLIPADST_1D, FLIPADST_1D, FLIPADST_1D, ADST_1D, IDTX_1D,
IDTX_1D, DCT_1D, IDTX_1D, ADST_1D, IDTX_1D, FLIPADST_1D,
#endif // CONFIG_EXT_TX
};
#if CONFIG_RECT_TX && (CONFIG_EXT_TX || CONFIG_VAR_TX)
// Same as "max_txsize_lookup[bsize] - TX_8X8", except for rectangular
// block which may use a rectangular transform, in which case it is
@ -571,7 +627,7 @@ static const int32_t intra_tx_size_cat_lookup[BLOCK_SIZES] = {
/* clang-format on */
static const TX_SIZE sub_tx_size_map[TX_SIZES_ALL] = {
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
TX_2X2, // TX_2X2
#endif
TX_4X4, // TX_4X4
@ -594,7 +650,7 @@ static const TX_SIZE sub_tx_size_map[TX_SIZES_ALL] = {
};
static const TX_SIZE txsize_horz_map[TX_SIZES_ALL] = {
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
TX_2X2, // TX_2X2
#endif
TX_4X4, // TX_4X4
@ -617,7 +673,7 @@ static const TX_SIZE txsize_horz_map[TX_SIZES_ALL] = {
};
static const TX_SIZE txsize_vert_map[TX_SIZES_ALL] = {
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
TX_2X2, // TX_2X2
#endif
TX_4X4, // TX_4X4
@ -639,7 +695,7 @@ static const TX_SIZE txsize_vert_map[TX_SIZES_ALL] = {
TX_8X8, // TX_32X8
};
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
#define TX_SIZE_W_MIN 2
#else
#define TX_SIZE_W_MIN 4
@ -647,7 +703,7 @@ static const TX_SIZE txsize_vert_map[TX_SIZES_ALL] = {
// Transform block width in pixels
static const int tx_size_wide[TX_SIZES_ALL] = {
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
2,
#endif
4, 8, 16, 32,
@ -657,7 +713,7 @@ static const int tx_size_wide[TX_SIZES_ALL] = {
4, 8, 8, 16, 16, 32, 4, 16, 8, 32
};
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
#define TX_SIZE_H_MIN 2
#else
#define TX_SIZE_H_MIN 4
@ -665,7 +721,7 @@ static const int tx_size_wide[TX_SIZES_ALL] = {
// Transform block height in pixels
static const int tx_size_high[TX_SIZES_ALL] = {
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
2,
#endif
4, 8, 16, 32,
@ -677,41 +733,41 @@ static const int tx_size_high[TX_SIZES_ALL] = {
// Transform block width in unit
static const int tx_size_wide_unit[TX_SIZES_ALL] = {
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
1, 2, 4, 8, 16,
#if CONFIG_TX64X64
32,
#endif // CONFIG_TX64X64
2, 4, 4, 8, 8, 16, 2, 8, 4, 16
#else // CONFIG_CB4X4
#else // CONFIG_CHROMA_2X2
1, 2, 4, 8,
#if CONFIG_TX64X64
16,
#endif // CONFIG_TX64X64
1, 2, 2, 4, 4, 8, 1, 4, 2, 8
#endif // CONFIG_CB4X4
#endif // CONFIG_CHROMA_2X2
};
// Transform block height in unit
static const int tx_size_high_unit[TX_SIZES_ALL] = {
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
1, 2, 4, 8, 16,
#if CONFIG_TX64X64
32,
#endif // CONFIG_TX64X64
4, 2, 8, 4, 16, 8, 8, 2, 16, 4
#else // CONFIG_CB4X4
#else // CONFIG_CHROMA_2X2
1, 2, 4, 8,
#if CONFIG_TX64X64
16,
#endif // CONFIG_TX64X64
2, 1, 4, 2, 8, 4, 4, 1, 8, 2
#endif // CONFIG_CB4X4
#endif // CONFIG_CHROMA_2X2
};
// Transform block width in log2
static const int tx_size_wide_log2[TX_SIZES_ALL] = {
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
1,
#endif
2, 3, 4, 5,
@ -723,7 +779,7 @@ static const int tx_size_wide_log2[TX_SIZES_ALL] = {
// Transform block height in log2
static const int tx_size_high_log2[TX_SIZES_ALL] = {
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
1,
#endif
2, 3, 4, 5,
@ -733,8 +789,11 @@ static const int tx_size_high_log2[TX_SIZES_ALL] = {
3, 2, 4, 3, 5, 4, 4, 2, 5, 3
};
#define TX_UNIT_WIDE_LOG2 (MI_SIZE_LOG2 - tx_size_wide_log2[0])
#define TX_UNIT_HIGH_LOG2 (MI_SIZE_LOG2 - tx_size_high_log2[0])
static const int tx_size_2d[TX_SIZES_ALL] = {
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
4,
#endif
16, 64, 256, 1024,
@ -745,7 +804,7 @@ static const int tx_size_2d[TX_SIZES_ALL] = {
};
static const BLOCK_SIZE txsize_to_bsize[TX_SIZES_ALL] = {
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
BLOCK_2X2, // TX_2X2
#endif
BLOCK_4X4, // TX_4X4
@ -753,22 +812,22 @@ static const BLOCK_SIZE txsize_to_bsize[TX_SIZES_ALL] = {
BLOCK_16X16, // TX_16X16
BLOCK_32X32, // TX_32X32
#if CONFIG_TX64X64
BLOCK_64X64, // TX_64X64
#endif // CONFIG_TX64X64
BLOCK_4X8, // TX_4X8
BLOCK_8X4, // TX_8X4
BLOCK_8X16, // TX_8X16
BLOCK_16X8, // TX_16X8
BLOCK_16X32, // TX_16X32
BLOCK_32X16, // TX_32X16
BLOCK_INVALID, // TX_4X16
BLOCK_INVALID, // TX_16X4
BLOCK_INVALID, // TX_8X32
BLOCK_INVALID, // TX_32X8
BLOCK_64X64, // TX_64X64
#endif // CONFIG_TX64X64
BLOCK_4X8, // TX_4X8
BLOCK_8X4, // TX_8X4
BLOCK_8X16, // TX_8X16
BLOCK_16X8, // TX_16X8
BLOCK_16X32, // TX_16X32
BLOCK_32X16, // TX_32X16
BLOCK_4X16, // TX_4X16
BLOCK_16X4, // TX_16X4
BLOCK_8X32, // TX_8X32
BLOCK_32X8, // TX_32X8
};
static const TX_SIZE txsize_sqr_map[TX_SIZES_ALL] = {
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
TX_2X2, // TX_2X2
#endif
TX_4X4, // TX_4X4
@ -791,7 +850,7 @@ static const TX_SIZE txsize_sqr_map[TX_SIZES_ALL] = {
};
static const TX_SIZE txsize_sqr_up_map[TX_SIZES_ALL] = {
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
TX_2X2, // TX_2X2
#endif
TX_4X4, // TX_4X4
@ -864,6 +923,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
// ss_x == 0 ss_x == 0 ss_x == 1 ss_x == 1
// ss_y == 0 ss_y == 1 ss_y == 0 ss_y == 1
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{
// BLOCK_2X2
{ { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
@ -927,15 +987,77 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
},
#else // CONFIG_CHROMA_2X2
{
// BLOCK_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#if CONFIG_TX64X64
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif // CONFIG_TX64X64
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
},
{
// BLOCK_2X4
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#if CONFIG_TX64X64
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif // CONFIG_TX64X64
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
},
{
// BLOCK_2X4
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#if CONFIG_TX64X64
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif // CONFIG_TX64X64
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
},
#endif // CONFIG_CHROMA_2X2
#endif
{
// BLOCK_4X4
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
{ { TX_4X4, TX_2X2 }, { TX_2X2, TX_2X2 } },
#else
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif // CONFIG_CB4X4
#endif // CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@ -955,7 +1077,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
},
{
// BLOCK_4X8
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
{ { TX_4X4, TX_2X2 }, { TX_2X2, TX_2X2 } },
#else
@ -967,7 +1089,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
#if CONFIG_TX64X64
{ { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif // CONFIG_TX64X64
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ { TX_4X8, TX_4X4 }, { TX_2X2, TX_2X2 } }, // used
#else
{ { TX_4X8, TX_4X4 }, { TX_4X4, TX_4X4 } }, // used
@ -984,7 +1106,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
},
{
// BLOCK_8X4
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
{ { TX_4X4, TX_2X2 }, { TX_2X2, TX_2X2 } },
#else
@ -997,7 +1119,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
{ { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif // CONFIG_TX64X64
{ { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ { TX_8X4, TX_2X2 }, { TX_4X4, TX_2X2 } }, // used
#else
{ { TX_8X4, TX_4X4 }, { TX_4X4, TX_4X4 } }, // used
@ -1013,7 +1135,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
},
{
// BLOCK_8X8
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ { TX_2X2, TX_2X2 }, { TX_2X2, TX_2X2 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@ -1036,7 +1158,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
},
{
// BLOCK_8X16
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@ -1052,14 +1174,14 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
{ { TX_8X16, TX_8X8 }, { TX_4X8, TX_4X8 } },
{ { TX_8X16, TX_8X8 }, { TX_4X8, TX_4X8 } },
{ { TX_8X16, TX_8X8 }, { TX_4X8, TX_4X8 } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_4X16, TX_4X8 }, { TX_4X16, TX_4X8 } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
},
{
// BLOCK_16X8
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@ -1076,13 +1198,13 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
{ { TX_16X8, TX_8X4 }, { TX_8X8, TX_8X4 } },
{ { TX_16X8, TX_8X4 }, { TX_8X8, TX_8X4 } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_16X4, TX_16X4 }, { TX_8X4, TX_8X4 } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
},
{
// BLOCK_16X16
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@ -1105,7 +1227,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
},
{
// BLOCK_16X32
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@ -1123,12 +1245,12 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
{ { TX_16X32, TX_16X16 }, { TX_8X16, TX_8X16 } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_8X32, TX_8X16 }, { TX_4X16, TX_4X16 } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
},
{
// BLOCK_32X16
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@ -1147,11 +1269,11 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_INVALID, TX_INVALID }, { TX_INVALID, TX_INVALID } },
{ { TX_32X8, TX_32X8 }, { TX_16X8, TX_16X4 } },
},
{
// BLOCK_32X32
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@ -1174,7 +1296,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
},
{
// BLOCK_32X64
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@ -1197,7 +1319,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
},
{
// BLOCK_64X32
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@ -1220,7 +1342,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
},
{
// BLOCK_64X64
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@ -1244,7 +1366,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
#if CONFIG_EXT_PARTITION
{
// BLOCK_64X128
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@ -1267,7 +1389,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
},
{
// BLOCK_128X64
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@ -1290,7 +1412,7 @@ static const TX_SIZE uv_txsize_lookup[BLOCK_SIZES][TX_SIZES_ALL][2][2] = {
},
{
// BLOCK_128X128
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
@ -1371,7 +1493,7 @@ static const struct {
static const TX_SIZE uvsupertx_size_lookup[TX_SIZES][2][2] = {
// ss_x == 0 ss_x == 0 ss_x == 1 ss_x == 1
// ss_y == 0 ss_y == 1 ss_y == 0 ss_y == 1
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },
#endif
{ { TX_4X4, TX_4X4 }, { TX_4X4, TX_4X4 } },

View file

@ -290,12 +290,14 @@ void av1_convolve_2d_facade(const uint8_t *src, int src_stride, uint8_t *dst,
InterpFilterParams filter_params_y =
av1_get_interp_filter_params(interp_filter[0 + 2 * conv_params->ref]);
#if USE_EXTRA_FILTER
if (filter_params_x.interp_filter == MULTITAP_SHARP &&
filter_params_y.interp_filter == MULTITAP_SHARP) {
// Avoid two directions both using 12-tap filter.
// This will reduce hardware implementation cost.
filter_params_y = av1_get_interp_filter_params(EIGHTTAP_SHARP);
}
#endif // USE_EXTRA_FILTER
#else
InterpFilterParams filter_params_x =
av1_get_interp_filter_params(*interp_filter);
@ -331,6 +333,140 @@ void av1_convolve_2d_facade(const uint8_t *src, int src_stride, uint8_t *dst,
}
}
#if CONFIG_HIGHBITDEPTH
static INLINE void transpose_uint16(uint16_t *dst, int dst_stride,
const uint16_t *src, int src_stride, int w,
int h) {
int r, c;
for (r = 0; r < h; ++r)
for (c = 0; c < w; ++c) dst[c * dst_stride + r] = src[r * src_stride + c];
}
void av1_highbd_convolve_rounding(const int32_t *src, int src_stride,
uint8_t *dst8, int dst_stride, int w, int h,
int bits, int bd) {
uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
int r, c;
for (r = 0; r < h; ++r) {
for (c = 0; c < w; ++c) {
dst[r * dst_stride + c] = clip_pixel_highbd(
ROUND_POWER_OF_TWO_SIGNED(src[r * src_stride + c], bits), bd);
}
}
}
void av1_highbd_convolve_2d(const uint16_t *src, int src_stride,
CONV_BUF_TYPE *dst, int dst_stride, int w, int h,
InterpFilterParams *filter_params_x,
InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params, int bd) {
int x, y, k;
CONV_BUF_TYPE im_block[(MAX_SB_SIZE + MAX_FILTER_TAP - 1) * MAX_SB_SIZE];
int im_h = h + filter_params_y->taps - 1;
int im_stride = w;
const int fo_vert = filter_params_y->taps / 2 - 1;
const int fo_horiz = filter_params_x->taps / 2 - 1;
(void)conv_params;
// horizontal filter
const uint16_t *src_horiz = src - fo_vert * src_stride;
const int16_t *x_filter = av1_get_interp_filter_subpel_kernel(
*filter_params_x, subpel_x_q4 & SUBPEL_MASK);
for (y = 0; y < im_h; ++y) {
for (x = 0; x < w; ++x) {
CONV_BUF_TYPE sum = 0;
for (k = 0; k < filter_params_x->taps; ++k) {
sum += x_filter[k] * src_horiz[y * src_stride + x - fo_horiz + k];
}
#if CONFIG_COMPOUND_ROUND
im_block[y * im_stride + x] = clip_pixel_highbd(
ROUND_POWER_OF_TWO_SIGNED(sum, conv_params->round_0), bd);
#else
(void)bd;
im_block[y * im_stride + x] =
ROUND_POWER_OF_TWO_SIGNED(sum, conv_params->round_0);
#endif
}
}
// vertical filter
CONV_BUF_TYPE *src_vert = im_block + fo_vert * im_stride;
const int16_t *y_filter = av1_get_interp_filter_subpel_kernel(
*filter_params_y, subpel_y_q4 & SUBPEL_MASK);
for (y = 0; y < h; ++y) {
for (x = 0; x < w; ++x) {
CONV_BUF_TYPE sum = 0;
for (k = 0; k < filter_params_y->taps; ++k) {
sum += y_filter[k] * src_vert[(y - fo_vert + k) * im_stride + x];
}
dst[y * dst_stride + x] +=
ROUND_POWER_OF_TWO_SIGNED(sum, conv_params->round_1);
}
}
}
void av1_highbd_convolve_2d_facade(const uint8_t *src8, int src_stride,
uint8_t *dst, int dst_stride, int w, int h,
const InterpFilter *interp_filter,
const int subpel_x_q4, int x_step_q4,
const int subpel_y_q4, int y_step_q4,
ConvolveParams *conv_params, int bd) {
(void)x_step_q4;
(void)y_step_q4;
(void)dst;
(void)dst_stride;
#if CONFIG_DUAL_FILTER
InterpFilterParams filter_params_x =
av1_get_interp_filter_params(interp_filter[1 + 2 * conv_params->ref]);
InterpFilterParams filter_params_y =
av1_get_interp_filter_params(interp_filter[0 + 2 * conv_params->ref]);
#if USE_EXTRA_FILTER
if (filter_params_x.interp_filter == MULTITAP_SHARP &&
filter_params_y.interp_filter == MULTITAP_SHARP) {
// Avoid two directions both using 12-tap filter.
// This will reduce hardware implementation cost.
filter_params_y = av1_get_interp_filter_params(EIGHTTAP_SHARP);
}
#endif
#else
InterpFilterParams filter_params_x =
av1_get_interp_filter_params(*interp_filter);
InterpFilterParams filter_params_y =
av1_get_interp_filter_params(*interp_filter);
#endif
const uint16_t *src = CONVERT_TO_SHORTPTR(src8);
if (filter_params_y.taps < filter_params_x.taps) {
uint16_t tr_src[(MAX_SB_SIZE + MAX_FILTER_TAP - 1) *
(MAX_SB_SIZE + MAX_FILTER_TAP - 1)];
int tr_src_stride = MAX_SB_SIZE + MAX_FILTER_TAP - 1;
CONV_BUF_TYPE tr_dst[MAX_SB_SIZE * MAX_SB_SIZE];
int tr_dst_stride = MAX_SB_SIZE;
int fo_vert = filter_params_y.taps / 2 - 1;
int fo_horiz = filter_params_x.taps / 2 - 1;
transpose_uint16(
tr_src, tr_src_stride, src - fo_vert * src_stride - fo_horiz,
src_stride, w + filter_params_x.taps - 1, h + filter_params_y.taps - 1);
transpose_int32(tr_dst, tr_dst_stride, conv_params->dst,
conv_params->dst_stride, w, h);
// horizontal and vertical parameters are swapped because of the transpose
av1_highbd_convolve_2d(tr_src + fo_horiz * tr_src_stride + fo_vert,
tr_src_stride, tr_dst, tr_dst_stride, h, w,
&filter_params_y, &filter_params_x, subpel_y_q4,
subpel_x_q4, conv_params, bd);
transpose_int32(conv_params->dst, conv_params->dst_stride, tr_dst,
tr_dst_stride, h, w);
} else {
av1_highbd_convolve_2d(src, src_stride, conv_params->dst,
conv_params->dst_stride, w, h, &filter_params_x,
&filter_params_y, subpel_x_q4, subpel_y_q4,
conv_params, bd);
}
}
#endif // CONFIG_HIGHBITDEPTH
#endif // CONFIG_CONVOLVE_ROUND
typedef void (*ConvolveFunc)(const uint8_t *src, int src_stride, uint8_t *dst,
@ -394,7 +530,7 @@ static void convolve_helper(const uint8_t *src, int src_stride, uint8_t *dst,
temp[((MAX_SB_SIZE * 2 + 16) + 16) * MAX_SB_SIZE]);
int max_intermediate_size = ((MAX_SB_SIZE * 2 + 16) + 16);
int filter_size;
#if CONFIG_DUAL_FILTER
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
if (interp_filter[0 + 2 * conv_params->ref] == MULTITAP_SHARP &&
interp_filter[1 + 2 * conv_params->ref] == MULTITAP_SHARP) {
// Avoid two directions both using 12-tap filter.
@ -427,7 +563,7 @@ static void convolve_helper(const uint8_t *src, int src_stride, uint8_t *dst,
convolve_horiz(temp + (filter_size / 2 - 1), temp_stride, dst, dst_stride,
w, h, filter_params, subpel_x_q4, x_step_q4, conv_params);
} else
#endif // CONFIG_DUAL_FILTER
#endif // CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
{
int intermediate_height;
int temp_stride = MAX_SB_SIZE;
@ -708,15 +844,15 @@ void av1_highbd_convolve(const uint8_t *src8, int src_stride, uint8_t *dst8,
av1_get_interp_filter_params(interp_filter[1 + 2 * ref_idx]);
InterpFilterParams filter_params_y =
av1_get_interp_filter_params(interp_filter[0 + 2 * ref_idx]);
#endif
#if CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
if (interp_filter[0 + 2 * ref_idx] == MULTITAP_SHARP &&
interp_filter[1 + 2 * ref_idx] == MULTITAP_SHARP) {
// Avoid two directions both using 12-tap filter.
// This will reduce hardware implementation cost.
filter_params_y = av1_get_interp_filter_params(EIGHTTAP_SHARP);
}
#endif
#if CONFIG_DUAL_FILTER
if (filter_params_y.taps < filter_params_x.taps) {
int intermediate_width;
int temp_stride = max_intermediate_size;
@ -739,7 +875,7 @@ void av1_highbd_convolve(const uint8_t *src8, int src_stride, uint8_t *dst8,
temp8 + (filter_size / 2 - 1), temp_stride, dst8, dst_stride, w, h,
filter_params, subpel_x_q4, x_step_q4, ref_idx, bd);
} else
#endif // CONFIG_DUAL_FILTER
#endif // CONFIG_DUAL_FILTER && USE_EXTRA_FILTER
{
int intermediate_height;
int temp_stride = MAX_SB_SIZE;

View file

@ -33,6 +33,7 @@ typedef struct ConvolveParams {
int round_0;
int round_1;
int plane;
int do_post_rounding;
} ConvolveParams;
static INLINE ConvolveParams get_conv_params(int ref, int plane) {
@ -40,6 +41,7 @@ static INLINE ConvolveParams get_conv_params(int ref, int plane) {
conv_params.ref = ref;
conv_params.round = CONVOLVE_OPT_ROUND;
conv_params.plane = plane;
conv_params.do_post_rounding = 0;
return conv_params;
}
struct AV1Common;
@ -73,11 +75,32 @@ static INLINE ConvolveParams get_conv_params_no_round(int ref, int plane,
conv_params.dst = dst;
conv_params.dst_stride = dst_stride;
conv_params.plane = plane;
conv_params.do_post_rounding = 0;
return conv_params;
}
void av1_convolve_rounding(const int32_t *src, int src_stride, uint8_t *dst,
int dst_stride, int w, int h, int bits);
#if CONFIG_HIGHBITDEPTH
void av1_highbd_convolve_rounding(const int32_t *src, int src_stride,
uint8_t *dst8, int dst_stride, int w, int h,
int bits, int bd);
void av1_highbd_convolve_2d(const uint16_t *src, int src_stride,
CONV_BUF_TYPE *dst, int dst_stride, int w, int h,
InterpFilterParams *filter_params_x,
InterpFilterParams *filter_params_y,
const int subpel_x_q4, const int subpel_y_q4,
ConvolveParams *conv_params, int bd);
void av1_highbd_convolve_2d_facade(const uint8_t *src8, int src_stride,
uint8_t *dst, int dst_stride, int w, int h,
const InterpFilter *interp_filter,
const int subpel_x_q4, int x_step_q4,
const int subpel_y_q4, int y_step_q4,
ConvolveParams *conv_params, int bd);
#endif
#endif // CONFIG_CONVOLVE_ROUND
void av1_convolve(const uint8_t *src, int src_stride, uint8_t *dst,

View file

@ -12,6 +12,7 @@
#include <stdio.h>
#include "av1/common/blockd.h"
#include "av1/common/enums.h"
#include "av1/common/onyxc_int.h"
static void log_frame_info(AV1_COMMON *cm, const char *str, FILE *f) {
@ -35,11 +36,12 @@ static void print_mi_data(AV1_COMMON *cm, FILE *file, const char *descriptor,
for (mi_row = 0; mi_row < rows; mi_row++) {
fprintf(file, "%c ", prefix);
for (mi_col = 0; mi_col < cols; mi_col++) {
fprintf(file, "%2d ", *((int *)((char *)(&mi[0]->mbmi) + member_offset)));
fprintf(file, "%2d ",
*((char *)((char *)(&mi[0]->mbmi) + member_offset)));
mi++;
}
fprintf(file, "\n");
mi += 8;
mi += MAX_MIB_SIZE;
}
fprintf(file, "\n");
}
@ -67,7 +69,7 @@ void av1_print_modes_and_motion_vectors(AV1_COMMON *cm, const char *file) {
mi++;
}
fprintf(mvs, "\n");
mi += 8;
mi += MAX_MIB_SIZE;
}
fprintf(mvs, "\n");
@ -82,7 +84,7 @@ void av1_print_modes_and_motion_vectors(AV1_COMMON *cm, const char *file) {
mi++;
}
fprintf(mvs, "\n");
mi += 8;
mi += MAX_MIB_SIZE;
}
fprintf(mvs, "\n");

View file

@ -135,7 +135,7 @@ const aom_prob av1_cat6_prob[] = {
};
const uint16_t band_count_table[TX_SIZES_ALL][8] = {
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ 1, 2, 2, 3, 0, 0, 0 },
#endif
{ 1, 2, 3, 4, 3, 16 - 13, 0 }, { 1, 2, 3, 4, 11, 64 - 21, 0 },
@ -151,7 +151,7 @@ const uint16_t band_count_table[TX_SIZES_ALL][8] = {
};
const uint16_t band_cum_count_table[TX_SIZES_ALL][8] = {
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ 0, 1, 3, 6, 10, 13, 16, 0 },
#endif
{ 0, 1, 3, 6, 10, 13, 16, 0 }, { 0, 1, 3, 6, 10, 21, 64, 0 },
@ -627,7 +627,6 @@ const aom_prob av1_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES] = {
// The full source code of the generating program is available in:
// tools/gen_constrained_tokenset.py
//
#if CONFIG_NEW_TOKENSET
// Values for tokens TWO_TOKEN through CATEGORY6_TOKEN included
// in the table here : the ONE_TOKEN probability is
// removed and the probabilities rescaled.
@ -891,275 +890,13 @@ const aom_cdf_prob av1_pareto8_tail_probs[COEFF_PROB_MODELS][TAIL_NODES] = {
{ 31131, 1448, 152, 31, 2, 1, 1, 1, 1 },
{ 31486, 1150, 107, 20, 1, 1, 1, 1, 1 },
};
#elif CONFIG_EC_MULTISYMBOL
// Values for tokens ONE_TOKEN through CATEGORY6_TOKEN included here.
// ZERO_TOKEN and EOB_TOKEN are coded as flags outside this coder.
const aom_cdf_prob
av1_pareto8_token_probs[COEFF_PROB_MODELS][ENTROPY_TOKENS - 2] = {
{ 128, 127, 127, 126, 251, 495, 965, 1832, 3305, 25412 },
{ 256, 254, 252, 249, 492, 959, 1820, 3283, 5365, 19838 },
{ 384, 379, 374, 369, 724, 1392, 2574, 4417, 6568, 15587 },
{ 512, 503, 494, 486, 946, 1795, 3238, 5289, 7184, 12321 },
{ 640, 626, 612, 599, 1159, 2172, 3818, 5946, 7401, 9795 },
{ 768, 748, 728, 709, 1363, 2522, 4324, 6424, 7352, 7830 },
{ 896, 869, 842, 816, 1559, 2847, 4762, 6755, 7131, 6291 },
{ 1024, 988, 954, 921, 1747, 3148, 5139, 6966, 6803, 5078 },
{ 1152, 1107, 1063, 1022, 1926, 3427, 5460, 7080, 6412, 4119 },
{ 1280, 1224, 1171, 1120, 2098, 3685, 5730, 7113, 5991, 3356 },
{ 1408, 1340, 1276, 1216, 2261, 3923, 5955, 7083, 5560, 2746 },
{ 1536, 1455, 1380, 1308, 2418, 4142, 6140, 7001, 5133, 2255 },
{ 1664, 1569, 1481, 1398, 2567, 4342, 6287, 6879, 4721, 1860 },
{ 1792, 1683, 1580, 1485, 2709, 4525, 6401, 6725, 4329, 1539 },
{ 1920, 1794, 1678, 1570, 2845, 4692, 6486, 6546, 3959, 1278 },
{ 2048, 1905, 1773, 1651, 2974, 4844, 6543, 6350, 3615, 1065 },
{ 2176, 2015, 1867, 1731, 3096, 4980, 6576, 6140, 3296, 891 },
{ 2304, 2123, 1958, 1807, 3212, 5104, 6589, 5922, 3002, 747 },
{ 2432, 2231, 2048, 1882, 3322, 5214, 6581, 5698, 2732, 628 },
{ 2560, 2337, 2136, 1953, 3427, 5311, 6557, 5472, 2485, 530 },
{ 2688, 2442, 2222, 2023, 3525, 5397, 6518, 5246, 2259, 448 },
{ 2816, 2547, 2306, 2090, 3618, 5472, 6465, 5021, 2053, 380 },
{ 2944, 2650, 2388, 2154, 3706, 5537, 6401, 4799, 1866, 323 },
{ 3072, 2752, 2468, 2217, 3788, 5591, 6327, 4581, 1696, 276 },
{ 3200, 2853, 2547, 2277, 3866, 5637, 6243, 4369, 1541, 235 },
{ 3328, 2952, 2624, 2335, 3938, 5673, 6152, 4163, 1401, 202 },
{ 3456, 3051, 2699, 2391, 4006, 5702, 6054, 3962, 1274, 173 },
{ 3584, 3149, 2772, 2444, 4070, 5723, 5950, 3769, 1158, 149 },
{ 3712, 3246, 2843, 2496, 4128, 5736, 5842, 3583, 1054, 128 },
{ 3840, 3341, 2913, 2545, 4183, 5743, 5729, 3404, 959, 111 },
{ 3968, 3436, 2981, 2593, 4233, 5743, 5614, 3232, 872, 96 },
{ 4096, 3529, 3048, 2638, 4280, 5737, 5496, 3067, 794, 83 },
{ 4224, 3621, 3113, 2682, 4322, 5726, 5375, 2909, 724, 72 },
{ 4352, 3712, 3176, 2724, 4361, 5709, 5253, 2759, 659, 63 },
{ 4480, 3803, 3237, 2764, 4396, 5687, 5130, 2615, 601, 55 },
{ 4608, 3892, 3297, 2801, 4428, 5661, 5007, 2478, 548, 48 },
{ 4736, 3980, 3355, 2838, 4456, 5631, 4883, 2347, 500, 42 },
{ 4864, 4067, 3412, 2872, 4481, 5596, 4760, 2223, 456, 37 },
{ 4992, 4152, 3467, 2905, 4503, 5558, 4637, 2105, 417, 32 },
{ 5120, 4237, 3521, 2936, 4521, 5516, 4515, 1993, 381, 28 },
{ 5248, 4321, 3573, 2966, 4537, 5471, 4393, 1886, 348, 25 },
{ 5376, 4404, 3623, 2993, 4550, 5424, 4273, 1785, 318, 22 },
{ 5504, 4486, 3672, 3020, 4560, 5373, 4155, 1688, 291, 19 },
{ 5632, 4566, 3720, 3044, 4568, 5321, 4037, 1597, 266, 17 },
{ 5760, 4646, 3766, 3067, 4572, 5265, 3922, 1511, 244, 15 },
{ 5888, 4724, 3811, 3089, 4575, 5208, 3808, 1429, 223, 13 },
{ 6016, 4802, 3854, 3109, 4575, 5148, 3696, 1352, 204, 12 },
{ 6144, 4878, 3895, 3128, 4573, 5088, 3587, 1278, 187, 10 },
{ 6272, 4953, 3936, 3145, 4568, 5025, 3479, 1209, 172, 9 },
{ 6400, 5028, 3975, 3161, 4561, 4961, 3373, 1143, 158, 8 },
{ 6528, 5101, 4012, 3175, 4553, 4896, 3270, 1081, 145, 7 },
{ 6656, 5173, 4048, 3189, 4542, 4830, 3168, 1022, 133, 7 },
{ 6784, 5244, 4083, 3201, 4530, 4763, 3069, 966, 122, 6 },
{ 6912, 5314, 4117, 3212, 4516, 4694, 2973, 913, 112, 5 },
{ 7040, 5383, 4149, 3221, 4500, 4626, 2878, 863, 103, 5 },
{ 7168, 5452, 4180, 3229, 4482, 4556, 2786, 816, 95, 4 },
{ 7296, 5519, 4210, 3236, 4463, 4486, 2696, 771, 87, 4 },
{ 7424, 5585, 4238, 3242, 4442, 4416, 2609, 729, 80, 3 },
{ 7552, 5650, 4265, 3247, 4420, 4345, 2523, 689, 74, 3 },
{ 7680, 5714, 4291, 3251, 4396, 4274, 2440, 651, 68, 3 },
{ 7808, 5777, 4315, 3254, 4371, 4203, 2359, 616, 63, 2 },
{ 7936, 5838, 4339, 3255, 4345, 4132, 2281, 582, 58, 2 },
{ 8064, 5899, 4361, 3256, 4318, 4061, 2204, 550, 53, 2 },
{ 8192, 5959, 4382, 3255, 4289, 3990, 2130, 520, 49, 2 },
{ 8320, 6018, 4402, 3254, 4259, 3919, 2057, 492, 45, 2 },
{ 8448, 6075, 4421, 3252, 4229, 3848, 1987, 465, 42, 1 },
{ 8576, 6133, 4438, 3248, 4197, 3778, 1919, 439, 39, 1 },
{ 8704, 6188, 4455, 3244, 4164, 3708, 1853, 415, 36, 1 },
{ 8832, 6243, 4470, 3239, 4131, 3638, 1789, 392, 33, 1 },
{ 8960, 6297, 4484, 3233, 4096, 3569, 1727, 371, 30, 1 },
{ 9088, 6349, 4497, 3226, 4061, 3500, 1667, 351, 28, 1 },
{ 9216, 6401, 4509, 3219, 4025, 3432, 1608, 331, 26, 1 },
{ 9344, 6452, 4520, 3210, 3989, 3364, 1551, 313, 24, 1 },
{ 9472, 6501, 4530, 3201, 3952, 3297, 1496, 296, 22, 1 },
{ 9600, 6550, 4539, 3191, 3914, 3230, 1443, 280, 20, 1 },
{ 9728, 6597, 4547, 3180, 3875, 3164, 1392, 265, 19, 1 },
{ 9856, 6644, 4554, 3169, 3836, 3098, 1342, 250, 18, 1 },
{ 9984, 6690, 4560, 3157, 3796, 3034, 1293, 237, 16, 1 },
{ 10112, 6734, 4565, 3144, 3756, 2970, 1247, 224, 15, 1 },
{ 10240, 6778, 4568, 3131, 3716, 2907, 1202, 211, 14, 1 },
{ 10368, 6821, 4571, 3117, 3675, 2844, 1158, 200, 13, 1 },
{ 10496, 6862, 4573, 3102, 3634, 2783, 1116, 189, 12, 1 },
{ 10624, 6903, 4574, 3087, 3592, 2722, 1075, 179, 11, 1 },
{ 10752, 6942, 4575, 3071, 3551, 2662, 1035, 169, 10, 1 },
{ 10880, 6981, 4574, 3054, 3508, 2603, 997, 160, 10, 1 },
{ 11008, 7019, 4572, 3038, 3466, 2544, 960, 151, 9, 1 },
{ 11136, 7055, 4570, 3020, 3424, 2487, 924, 143, 8, 1 },
{ 11264, 7091, 4566, 3002, 3381, 2430, 890, 135, 8, 1 },
{ 11392, 7126, 4563, 2984, 3338, 2374, 856, 127, 7, 1 },
{ 11520, 7159, 4557, 2965, 3295, 2319, 824, 121, 7, 1 },
{ 11648, 7193, 4552, 2945, 3252, 2264, 793, 114, 6, 1 },
{ 11776, 7224, 4545, 2925, 3209, 2211, 763, 108, 6, 1 },
{ 11904, 7255, 4538, 2905, 3165, 2159, 734, 102, 5, 1 },
{ 12032, 7285, 4530, 2884, 3122, 2107, 706, 96, 5, 1 },
{ 12160, 7314, 4520, 2863, 3079, 2056, 679, 91, 5, 1 },
{ 12288, 7341, 4511, 2842, 3036, 2006, 653, 86, 4, 1 },
{ 12416, 7368, 4500, 2820, 2993, 1957, 628, 81, 4, 1 },
{ 12544, 7394, 4489, 2797, 2949, 1909, 604, 77, 4, 1 },
{ 12672, 7419, 4477, 2775, 2906, 1861, 581, 73, 3, 1 },
{ 12800, 7443, 4464, 2752, 2863, 1815, 558, 69, 3, 1 },
{ 12928, 7466, 4451, 2729, 2820, 1769, 536, 65, 3, 1 },
{ 13056, 7488, 4437, 2705, 2777, 1724, 516, 61, 3, 1 },
{ 13184, 7509, 4422, 2682, 2734, 1680, 495, 58, 3, 1 },
{ 13312, 7529, 4406, 2658, 2692, 1637, 476, 55, 2, 1 },
{ 13440, 7548, 4390, 2633, 2650, 1595, 457, 52, 2, 1 },
{ 13568, 7567, 4373, 2609, 2607, 1553, 439, 49, 2, 1 },
{ 13696, 7583, 4356, 2584, 2565, 1513, 422, 46, 2, 1 },
{ 13824, 7600, 4337, 2559, 2523, 1473, 405, 44, 2, 1 },
{ 13952, 7615, 4319, 2533, 2482, 1434, 389, 41, 2, 1 },
{ 14080, 7629, 4300, 2508, 2441, 1395, 373, 39, 2, 1 },
{ 14208, 7643, 4280, 2482, 2400, 1358, 358, 37, 1, 1 },
{ 14336, 7655, 4259, 2457, 2359, 1321, 344, 35, 1, 1 },
{ 14464, 7667, 4238, 2431, 2318, 1285, 330, 33, 1, 1 },
{ 14592, 7677, 4217, 2405, 2278, 1250, 316, 31, 1, 1 },
{ 14720, 7687, 4195, 2378, 2238, 1215, 304, 29, 1, 1 },
{ 14848, 7696, 4172, 2352, 2198, 1181, 291, 28, 1, 1 },
{ 14976, 7703, 4149, 2326, 2159, 1148, 279, 26, 1, 1 },
{ 15104, 7710, 4125, 2299, 2119, 1116, 268, 25, 1, 1 },
{ 15232, 7715, 4101, 2272, 2081, 1085, 257, 23, 1, 1 },
{ 15360, 7721, 4076, 2245, 2042, 1054, 246, 22, 1, 1 },
{ 15488, 7724, 4051, 2219, 2004, 1023, 236, 21, 1, 1 },
{ 15616, 7727, 4025, 2192, 1966, 994, 226, 20, 1, 1 },
{ 15744, 7729, 3999, 2164, 1929, 965, 217, 19, 1, 1 },
{ 15872, 7731, 3972, 2137, 1892, 937, 207, 18, 1, 1 },
{ 16000, 7731, 3945, 2110, 1855, 909, 199, 17, 1, 1 },
{ 16128, 7730, 3918, 2083, 1819, 882, 190, 16, 1, 1 },
{ 16256, 7728, 3890, 2056, 1783, 856, 182, 15, 1, 1 },
{ 16384, 7725, 3862, 2029, 1747, 831, 174, 14, 1, 1 },
{ 16512, 7721, 3833, 2002, 1712, 806, 167, 13, 1, 1 },
{ 16640, 7717, 3804, 1975, 1677, 781, 160, 12, 1, 1 },
{ 16768, 7712, 3775, 1947, 1642, 757, 153, 12, 1, 1 },
{ 16896, 7706, 3745, 1920, 1608, 734, 146, 11, 1, 1 },
{ 17024, 7699, 3714, 1893, 1575, 711, 140, 10, 1, 1 },
{ 17152, 7690, 3684, 1866, 1541, 689, 134, 10, 1, 1 },
{ 17280, 7681, 3653, 1839, 1508, 668, 128, 9, 1, 1 },
{ 17408, 7671, 3621, 1812, 1476, 647, 122, 9, 1, 1 },
{ 17536, 7660, 3590, 1785, 1444, 626, 117, 8, 1, 1 },
{ 17664, 7648, 3558, 1758, 1412, 606, 112, 8, 1, 1 },
{ 17792, 7635, 3526, 1731, 1381, 587, 107, 7, 1, 1 },
{ 17920, 7622, 3493, 1704, 1350, 568, 102, 7, 1, 1 },
{ 18048, 7607, 3461, 1678, 1319, 549, 98, 6, 1, 1 },
{ 18176, 7592, 3428, 1651, 1289, 531, 93, 6, 1, 1 },
{ 18304, 7575, 3394, 1625, 1259, 514, 89, 6, 1, 1 },
{ 18432, 7558, 3361, 1598, 1230, 497, 85, 5, 1, 1 },
{ 18560, 7540, 3327, 1572, 1201, 480, 81, 5, 1, 1 },
{ 18688, 7520, 3293, 1546, 1173, 464, 77, 5, 1, 1 },
{ 18816, 7500, 3258, 1520, 1145, 448, 74, 5, 1, 1 },
{ 18944, 7480, 3224, 1494, 1117, 433, 70, 4, 1, 1 },
{ 19072, 7458, 3189, 1468, 1090, 418, 67, 4, 1, 1 },
{ 19200, 7435, 3154, 1442, 1063, 404, 64, 4, 1, 1 },
{ 19328, 7410, 3119, 1417, 1037, 390, 61, 4, 1, 1 },
{ 19456, 7386, 3084, 1392, 1011, 376, 58, 3, 1, 1 },
{ 19584, 7361, 3048, 1366, 986, 363, 55, 3, 1, 1 },
{ 19712, 7335, 3012, 1341, 960, 350, 53, 3, 1, 1 },
{ 19840, 7307, 2977, 1316, 936, 337, 50, 3, 1, 1 },
{ 19968, 7279, 2941, 1291, 911, 325, 48, 3, 1, 1 },
{ 20096, 7251, 2905, 1267, 887, 313, 45, 2, 1, 1 },
{ 20224, 7220, 2868, 1243, 864, 302, 43, 2, 1, 1 },
{ 20352, 7189, 2832, 1218, 841, 291, 41, 2, 1, 1 },
{ 20480, 7158, 2795, 1194, 818, 280, 39, 2, 1, 1 },
{ 20608, 7124, 2759, 1170, 796, 270, 37, 2, 1, 1 },
{ 20736, 7091, 2722, 1147, 774, 259, 35, 2, 1, 1 },
{ 20864, 7056, 2685, 1123, 752, 250, 34, 2, 1, 1 },
{ 20992, 7021, 2648, 1100, 731, 240, 32, 2, 1, 1 },
{ 21120, 6985, 2612, 1077, 710, 231, 30, 1, 1, 1 },
{ 21248, 6948, 2574, 1054, 690, 222, 29, 1, 1, 1 },
{ 21376, 6911, 2537, 1031, 670, 213, 27, 1, 1, 1 },
{ 21504, 6872, 2500, 1008, 650, 205, 26, 1, 1, 1 },
{ 21632, 6831, 2463, 986, 631, 197, 25, 1, 1, 1 },
{ 21760, 6791, 2426, 964, 612, 189, 23, 1, 1, 1 },
{ 21888, 6749, 2389, 942, 594, 181, 22, 1, 1, 1 },
{ 22016, 6707, 2351, 921, 575, 174, 21, 1, 1, 1 },
{ 22144, 6663, 2314, 899, 558, 167, 20, 1, 1, 1 },
{ 22272, 6619, 2277, 878, 540, 160, 19, 1, 1, 1 },
{ 22400, 6574, 2240, 857, 523, 153, 18, 1, 1, 1 },
{ 22528, 6529, 2202, 836, 507, 146, 17, 1, 1, 1 },
{ 22656, 6482, 2165, 816, 490, 140, 16, 1, 1, 1 },
{ 22784, 6435, 2128, 795, 474, 134, 15, 1, 1, 1 },
{ 22912, 6386, 2091, 775, 459, 128, 14, 1, 1, 1 },
{ 23040, 6336, 2054, 756, 443, 123, 13, 1, 1, 1 },
{ 23168, 6286, 2017, 736, 428, 117, 13, 1, 1, 1 },
{ 23296, 6234, 1980, 717, 414, 112, 12, 1, 1, 1 },
{ 23424, 6183, 1943, 698, 399, 107, 11, 1, 1, 1 },
{ 23552, 6130, 1906, 679, 385, 102, 11, 1, 1, 1 },
{ 23680, 6077, 1869, 660, 372, 97, 10, 1, 1, 1 },
{ 23808, 6022, 1833, 642, 358, 93, 9, 1, 1, 1 },
{ 23936, 5966, 1796, 624, 345, 89, 9, 1, 1, 1 },
{ 24064, 5910, 1760, 606, 333, 84, 8, 1, 1, 1 },
{ 24192, 5853, 1724, 588, 320, 80, 8, 1, 1, 1 },
{ 24320, 5796, 1687, 571, 308, 76, 7, 1, 1, 1 },
{ 24448, 5735, 1651, 554, 297, 73, 7, 1, 1, 1 },
{ 24576, 5677, 1615, 537, 285, 69, 6, 1, 1, 1 },
{ 24704, 5615, 1579, 521, 274, 66, 6, 1, 1, 1 },
{ 24832, 5554, 1544, 504, 263, 62, 6, 1, 1, 1 },
{ 24960, 5492, 1508, 488, 253, 59, 5, 1, 1, 1 },
{ 25088, 5428, 1473, 473, 242, 56, 5, 1, 1, 1 },
{ 25216, 5364, 1438, 457, 232, 53, 5, 1, 1, 1 },
{ 25344, 5300, 1403, 442, 222, 50, 4, 1, 1, 1 },
{ 25472, 5233, 1368, 427, 213, 48, 4, 1, 1, 1 },
{ 25600, 5166, 1334, 412, 204, 45, 4, 1, 1, 1 },
{ 25728, 5098, 1299, 398, 195, 43, 4, 1, 1, 1 },
{ 25856, 5030, 1266, 384, 186, 40, 3, 1, 1, 1 },
{ 25984, 4960, 1232, 370, 178, 38, 3, 1, 1, 1 },
{ 26112, 4890, 1198, 356, 170, 36, 3, 1, 1, 1 },
{ 26240, 4819, 1164, 343, 162, 34, 3, 1, 1, 1 },
{ 26368, 4748, 1132, 329, 154, 32, 2, 1, 1, 1 },
{ 26496, 4675, 1098, 317, 147, 30, 2, 1, 1, 1 },
{ 26624, 4602, 1066, 304, 139, 28, 2, 1, 1, 1 },
{ 26752, 4527, 1034, 292, 132, 26, 2, 1, 1, 1 },
{ 26880, 4451, 1001, 280, 126, 25, 2, 1, 1, 1 },
{ 27008, 4375, 970, 268, 119, 23, 2, 1, 1, 1 },
{ 27136, 4299, 938, 256, 113, 21, 2, 1, 1, 1 },
{ 27264, 4221, 907, 245, 107, 20, 1, 1, 1, 1 },
{ 27392, 4142, 876, 234, 101, 19, 1, 1, 1, 1 },
{ 27520, 4063, 846, 223, 95, 17, 1, 1, 1, 1 },
{ 27648, 3982, 815, 213, 90, 16, 1, 1, 1, 1 },
{ 27776, 3900, 786, 202, 85, 15, 1, 1, 1, 1 },
{ 27904, 3818, 756, 192, 80, 14, 1, 1, 1, 1 },
{ 28032, 3734, 727, 183, 75, 13, 1, 1, 1, 1 },
{ 28160, 3651, 698, 173, 70, 12, 1, 1, 1, 1 },
{ 28288, 3566, 669, 164, 66, 11, 1, 1, 1, 1 },
{ 28416, 3481, 641, 155, 61, 10, 1, 1, 1, 1 },
{ 28544, 3393, 614, 147, 57, 9, 1, 1, 1, 1 },
{ 28672, 3306, 586, 138, 53, 9, 1, 1, 1, 1 },
{ 28800, 3217, 559, 130, 50, 8, 1, 1, 1, 1 },
{ 28928, 3128, 533, 122, 46, 7, 1, 1, 1, 1 },
{ 29056, 3037, 507, 114, 43, 7, 1, 1, 1, 1 },
{ 29184, 2947, 481, 107, 39, 6, 1, 1, 1, 1 },
{ 29312, 2855, 456, 100, 36, 5, 1, 1, 1, 1 },
{ 29440, 2762, 431, 93, 33, 5, 1, 1, 1, 1 },
{ 29568, 2668, 407, 86, 31, 4, 1, 1, 1, 1 },
{ 29696, 2573, 383, 80, 28, 4, 1, 1, 1, 1 },
{ 29824, 2478, 359, 74, 25, 4, 1, 1, 1, 1 },
{ 29952, 2381, 337, 68, 23, 3, 1, 1, 1, 1 },
{ 30080, 2284, 314, 62, 21, 3, 1, 1, 1, 1 },
{ 30208, 2185, 293, 57, 19, 2, 1, 1, 1, 1 },
{ 30336, 2086, 271, 52, 17, 2, 1, 1, 1, 1 },
{ 30464, 1986, 250, 47, 15, 2, 1, 1, 1, 1 },
{ 30592, 1885, 230, 42, 13, 2, 1, 1, 1, 1 },
{ 30720, 1782, 211, 38, 12, 1, 1, 1, 1, 1 },
{ 30848, 1679, 192, 34, 10, 1, 1, 1, 1, 1 },
{ 30976, 1575, 173, 30, 9, 1, 1, 1, 1, 1 },
{ 31104, 1469, 156, 26, 8, 1, 1, 1, 1, 1 },
{ 31232, 1364, 138, 23, 6, 1, 1, 1, 1, 1 },
{ 31360, 1257, 122, 19, 5, 1, 1, 1, 1, 1 },
{ 31488, 1149, 106, 16, 4, 1, 1, 1, 1, 1 },
{ 31616, 1038, 91, 14, 4, 1, 1, 1, 1, 1 },
{ 31744, 928, 77, 11, 3, 1, 1, 1, 1, 1 },
{ 31872, 816, 64, 9, 2, 1, 1, 1, 1, 1 },
{ 32000, 703, 51, 7, 2, 1, 1, 1, 1, 1 },
{ 32128, 589, 40, 5, 1, 1, 1, 1, 1, 1 },
{ 32256, 473, 29, 4, 1, 1, 1, 1, 1, 1 },
{ 32384, 357, 19, 2, 1, 1, 1, 1, 1, 1 },
{ 32512, 238, 11, 1, 1, 1, 1, 1, 1, 1 },
{ 32640, 117, 4, 1, 1, 1, 1, 1, 1, 1 },
};
#endif // CONFIG_NEW_TOKENSET
/* clang-format off */
#if CONFIG_Q_ADAPT_PROBS
const av1_coeff_probs_model
default_qctx_coef_probs[QCTX_BINS][TX_SIZES][PLANE_TYPES] = {
{ // Q_Index 0
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ // TX_SIZE 0
{ // Y plane
{ // Intra
@ -1825,7 +1562,7 @@ default_qctx_coef_probs[QCTX_BINS][TX_SIZES][PLANE_TYPES] = {
#endif // CONFIG_TX64X64
},
{ // Q_Index 1
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ // TX_SIZE 0
{ // Y plane
{ // Intra
@ -2491,7 +2228,7 @@ default_qctx_coef_probs[QCTX_BINS][TX_SIZES][PLANE_TYPES] = {
#endif // CONFIG_TX64X64
},
{ // Q_Index 2
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ // TX_SIZE 0
{ // Y plane
{ // Intra
@ -3157,7 +2894,7 @@ default_qctx_coef_probs[QCTX_BINS][TX_SIZES][PLANE_TYPES] = {
#endif // CONFIG_TX64X64
},
{ // Q_Index 3
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
{ // TX_SIZE 0
{ // Y plane
{ // Intra
@ -3824,7 +3561,6 @@ default_qctx_coef_probs[QCTX_BINS][TX_SIZES][PLANE_TYPES] = {
},
};
#else
#if CONFIG_NEW_TOKENSET
static const av1_coeff_probs_model default_coef_probs_4x4[PLANE_TYPES] = {
{ // Y plane
{ // Intra
@ -4249,343 +3985,6 @@ static const av1_coeff_probs_model default_coef_probs_32x32[PLANE_TYPES] = {
}
}
};
#else // CONFIG_NEW_TOKENSET
static const av1_coeff_probs_model default_coef_probs_4x4[PLANE_TYPES] = {
{ // Y plane
{ // Intra
{ // Band 0
{ 195, 29, 183 }, { 84, 49, 136 }, { 8, 42, 71 }
}, { // Band 1
{ 31, 107, 169 }, { 35, 99, 159 }, { 17, 82, 140 },
{ 8, 66, 114 }, { 2, 44, 76 }, { 1, 19, 32 }
}, { // Band 2
{ 40, 132, 201 }, { 29, 114, 187 }, { 13, 91, 157 },
{ 7, 75, 127 }, { 3, 58, 95 }, { 1, 28, 47 }
}, { // Band 3
{ 69, 142, 221 }, { 42, 122, 201 }, { 15, 91, 159 },
{ 6, 67, 121 }, { 1, 42, 77 }, { 1, 17, 31 }
}, { // Band 4
{ 102, 148, 228 }, { 67, 117, 204 }, { 17, 82, 154 },
{ 6, 59, 114 }, { 2, 39, 75 }, { 1, 15, 29 }
}, { // Band 5
{ 156, 57, 233 }, { 119, 57, 212 }, { 58, 48, 163 },
{ 29, 40, 124 }, { 12, 30, 81 }, { 3, 12, 31 }
}
}, { // Inter
{ // Band 0
{ 191, 107, 226 }, { 124, 117, 204 }, { 25, 99, 155 }
}, { // Band 1
{ 29, 148, 210 }, { 37, 126, 194 }, { 8, 93, 157 },
{ 2, 68, 118 }, { 1, 39, 69 }, { 1, 17, 33 }
}, { // Band 2
{ 41, 151, 213 }, { 27, 123, 193 }, { 3, 82, 144 },
{ 1, 58, 105 }, { 1, 32, 60 }, { 1, 13, 26 }
}, { // Band 3
{ 59, 159, 220 }, { 23, 126, 198 }, { 4, 88, 151 },
{ 1, 66, 114 }, { 1, 38, 71 }, { 1, 18, 34 }
}, { // Band 4
{ 114, 136, 232 }, { 51, 114, 207 }, { 11, 83, 155 },
{ 3, 56, 105 }, { 1, 33, 65 }, { 1, 17, 34 }
}, { // Band 5
{ 149, 65, 234 }, { 121, 57, 215 }, { 61, 49, 166 },
{ 28, 36, 114 }, { 12, 25, 76 }, { 3, 16, 42 }
}
}
}, { // UV plane
{ // Intra
{ // Band 0
{ 214, 49, 220 }, { 132, 63, 188 }, { 42, 65, 137 }
}, { // Band 1
{ 85, 137, 221 }, { 104, 131, 216 }, { 49, 111, 192 },
{ 21, 87, 155 }, { 2, 49, 87 }, { 1, 16, 28 }
}, { // Band 2
{ 89, 163, 230 }, { 90, 137, 220 }, { 29, 100, 183 },
{ 10, 70, 135 }, { 2, 42, 81 }, { 1, 17, 33 }
}, { // Band 3
{ 108, 167, 237 }, { 55, 133, 222 }, { 15, 97, 179 },
{ 4, 72, 135 }, { 1, 45, 85 }, { 1, 19, 38 }
}, { // Band 4
{ 124, 146, 240 }, { 66, 124, 224 }, { 17, 88, 175 },
{ 4, 58, 122 }, { 1, 36, 75 }, { 1, 18, 37 }
}, { // Band 5
{ 141, 79, 241 }, { 126, 70, 227 }, { 66, 58, 182 },
{ 30, 44, 136 }, { 12, 34, 96 }, { 2, 20, 47 }
}
}, { // Inter
{ // Band 0
{ 229, 99, 249 }, { 143, 111, 235 }, { 46, 109, 192 }
}, { // Band 1
{ 82, 158, 236 }, { 94, 146, 224 }, { 25, 117, 191 },
{ 9, 87, 149 }, { 3, 56, 99 }, { 1, 33, 57 }
}, { // Band 2
{ 83, 167, 237 }, { 68, 145, 222 }, { 10, 103, 177 },
{ 2, 72, 131 }, { 1, 41, 79 }, { 1, 20, 39 }
}, { // Band 3
{ 99, 167, 239 }, { 47, 141, 224 }, { 10, 104, 178 },
{ 2, 73, 133 }, { 1, 44, 85 }, { 1, 22, 47 }
}, { // Band 4
{ 127, 145, 243 }, { 71, 129, 228 }, { 17, 93, 177 },
{ 3, 61, 124 }, { 1, 41, 84 }, { 1, 21, 52 }
}, { // Band 5
{ 157, 78, 244 }, { 140, 72, 231 }, { 69, 58, 184 },
{ 31, 44, 137 }, { 14, 38, 105 }, { 8, 23, 61 }
}
}
}
};
static const av1_coeff_probs_model default_coef_probs_8x8[PLANE_TYPES] = {
{ // Y plane
{ // Intra
{ // Band 0
{ 125, 34, 187 }, { 52, 41, 133 }, { 6, 31, 56 }
}, { // Band 1
{ 37, 109, 153 }, { 51, 102, 147 }, { 23, 87, 128 },
{ 8, 67, 101 }, { 1, 41, 63 }, { 1, 19, 29 }
}, { // Band 2
{ 31, 154, 185 }, { 17, 127, 175 }, { 6, 96, 145 },
{ 2, 73, 114 }, { 1, 51, 82 }, { 1, 28, 45 }
}, { // Band 3
{ 23, 163, 200 }, { 10, 131, 185 }, { 2, 93, 148 },
{ 1, 67, 111 }, { 1, 41, 69 }, { 1, 14, 24 }
}, { // Band 4
{ 29, 176, 217 }, { 12, 145, 201 }, { 3, 101, 156 },
{ 1, 69, 111 }, { 1, 39, 63 }, { 1, 14, 23 }
}, { // Band 5
{ 57, 192, 233 }, { 25, 154, 215 }, { 6, 109, 167 },
{ 3, 78, 118 }, { 1, 48, 69 }, { 1, 21, 29 }
}
}, { // Inter
{ // Band 0
{ 202, 105, 245 }, { 108, 106, 216 }, { 18, 90, 144 }
}, { // Band 1
{ 33, 172, 219 }, { 64, 149, 206 }, { 14, 117, 177 },
{ 5, 90, 141 }, { 2, 61, 95 }, { 1, 37, 57 }
}, { // Band 2
{ 33, 179, 220 }, { 11, 140, 198 }, { 1, 89, 148 },
{ 1, 60, 104 }, { 1, 33, 57 }, { 1, 12, 21 }
}, { // Band 3
{ 30, 181, 221 }, { 8, 141, 198 }, { 1, 87, 145 },
{ 1, 58, 100 }, { 1, 31, 55 }, { 1, 12, 20 }
}, { // Band 4
{ 32, 186, 224 }, { 7, 142, 198 }, { 1, 86, 143 },
{ 1, 58, 100 }, { 1, 31, 55 }, { 1, 12, 22 }
}, { // Band 5
{ 57, 192, 227 }, { 20, 143, 204 }, { 3, 96, 154 },
{ 1, 68, 112 }, { 1, 42, 69 }, { 1, 19, 32 }
}
}
}, { // UV plane
{ // Intra
{ // Band 0
{ 212, 35, 215 }, { 113, 47, 169 }, { 29, 48, 105 }
}, { // Band 1
{ 74, 129, 203 }, { 106, 120, 203 }, { 49, 107, 178 },
{ 19, 84, 144 }, { 4, 50, 84 }, { 1, 15, 25 }
}, { // Band 2
{ 71, 172, 217 }, { 44, 141, 209 }, { 15, 102, 173 },
{ 6, 76, 133 }, { 2, 51, 89 }, { 1, 24, 42 }
}, { // Band 3
{ 64, 185, 231 }, { 31, 148, 216 }, { 8, 103, 175 },
{ 3, 74, 131 }, { 1, 46, 81 }, { 1, 18, 30 }
}, { // Band 4
{ 65, 196, 235 }, { 25, 157, 221 }, { 5, 105, 174 },
{ 1, 67, 120 }, { 1, 38, 69 }, { 1, 15, 30 }
}, { // Band 5
{ 65, 204, 238 }, { 30, 156, 224 }, { 7, 107, 177 },
{ 2, 70, 124 }, { 1, 42, 73 }, { 1, 18, 34 }
}
}, { // Inter
{ // Band 0
{ 225, 86, 251 }, { 144, 104, 235 }, { 42, 99, 181 }
}, { // Band 1
{ 85, 175, 239 }, { 112, 165, 229 }, { 29, 136, 200 },
{ 12, 103, 162 }, { 6, 77, 123 }, { 2, 53, 84 }
}, { // Band 2
{ 75, 183, 239 }, { 30, 155, 221 }, { 3, 106, 171 },
{ 1, 74, 128 }, { 1, 44, 76 }, { 1, 17, 28 }
}, { // Band 3
{ 73, 185, 240 }, { 27, 159, 222 }, { 2, 107, 172 },
{ 1, 75, 127 }, { 1, 42, 73 }, { 1, 17, 29 }
}, { // Band 4
{ 62, 190, 238 }, { 21, 159, 222 }, { 2, 107, 172 },
{ 1, 72, 122 }, { 1, 40, 71 }, { 1, 18, 32 }
}, { // Band 5
{ 61, 199, 240 }, { 27, 161, 226 }, { 4, 113, 180 },
{ 1, 76, 129 }, { 1, 46, 80 }, { 1, 23, 41 }
}
}
}
};
static const av1_coeff_probs_model default_coef_probs_16x16[PLANE_TYPES] = {
{ // Y plane
{ // Intra
{ // Band 0
{ 7, 27, 153 }, { 5, 30, 95 }, { 1, 16, 30 }
}, { // Band 1
{ 50, 75, 127 }, { 57, 75, 124 }, { 27, 67, 108 },
{ 10, 54, 86 }, { 1, 33, 52 }, { 1, 12, 18 }
}, { // Band 2
{ 43, 125, 151 }, { 26, 108, 148 }, { 7, 83, 122 },
{ 2, 59, 89 }, { 1, 38, 60 }, { 1, 17, 27 }
}, { // Band 3
{ 23, 144, 163 }, { 13, 112, 154 }, { 2, 75, 117 },
{ 1, 50, 81 }, { 1, 31, 51 }, { 1, 14, 23 }
}, { // Band 4
{ 18, 162, 185 }, { 6, 123, 171 }, { 1, 78, 125 },
{ 1, 51, 86 }, { 1, 31, 54 }, { 1, 14, 23 }
}, { // Band 5
{ 15, 199, 227 }, { 3, 150, 204 }, { 1, 91, 146 },
{ 1, 55, 95 }, { 1, 30, 53 }, { 1, 11, 20 }
}
}, { // Inter
{ // Band 0
{ 19, 55, 240 }, { 19, 59, 196 }, { 3, 52, 105 }
}, { // Band 1
{ 41, 166, 207 }, { 104, 153, 199 }, { 31, 123, 181 },
{ 14, 101, 152 }, { 5, 72, 106 }, { 1, 36, 52 }
}, { // Band 2
{ 35, 176, 211 }, { 12, 131, 190 }, { 2, 88, 144 },
{ 1, 60, 101 }, { 1, 36, 60 }, { 1, 16, 28 }
}, { // Band 3
{ 28, 183, 213 }, { 8, 134, 191 }, { 1, 86, 142 },
{ 1, 56, 96 }, { 1, 30, 53 }, { 1, 12, 20 }
}, { // Band 4
{ 20, 190, 215 }, { 4, 135, 192 }, { 1, 84, 139 },
{ 1, 53, 91 }, { 1, 28, 49 }, { 1, 11, 20 }
}, { // Band 5
{ 13, 196, 216 }, { 2, 137, 192 }, { 1, 86, 143 },
{ 1, 57, 99 }, { 1, 32, 56 }, { 1, 13, 24 }
}
}
}, { // UV plane
{ // Intra
{ // Band 0
{ 211, 29, 217 }, { 96, 47, 156 }, { 22, 43, 87 }
}, { // Band 1
{ 78, 120, 193 }, { 111, 116, 186 }, { 46, 102, 164 },
{ 15, 80, 128 }, { 2, 49, 76 }, { 1, 18, 28 }
}, { // Band 2
{ 71, 161, 203 }, { 42, 132, 192 }, { 10, 98, 150 },
{ 3, 69, 109 }, { 1, 44, 70 }, { 1, 18, 29 }
}, { // Band 3
{ 57, 186, 211 }, { 30, 140, 196 }, { 4, 93, 146 },
{ 1, 62, 102 }, { 1, 38, 65 }, { 1, 16, 27 }
}, { // Band 4
{ 47, 199, 217 }, { 14, 145, 196 }, { 1, 88, 142 },
{ 1, 57, 98 }, { 1, 36, 62 }, { 1, 15, 26 }
}, { // Band 5
{ 26, 219, 229 }, { 5, 155, 207 }, { 1, 94, 151 },
{ 1, 60, 104 }, { 1, 36, 62 }, { 1, 16, 28 }
}
}, { // Inter
{ // Band 0
{ 233, 29, 248 }, { 146, 47, 220 }, { 43, 52, 140 }
}, { // Band 1
{ 100, 163, 232 }, { 179, 161, 222 }, { 63, 142, 204 },
{ 37, 113, 174 }, { 26, 89, 137 }, { 18, 68, 97 }
}, { // Band 2
{ 85, 181, 230 }, { 32, 146, 209 }, { 7, 100, 164 },
{ 3, 71, 121 }, { 1, 45, 77 }, { 1, 18, 30 }
}, { // Band 3
{ 65, 187, 230 }, { 20, 148, 207 }, { 2, 97, 159 },
{ 1, 68, 116 }, { 1, 40, 70 }, { 1, 14, 29 }
}, { // Band 4
{ 40, 194, 227 }, { 8, 147, 204 }, { 1, 94, 155 },
{ 1, 65, 112 }, { 1, 39, 66 }, { 1, 14, 26 }
}, { // Band 5
{ 16, 208, 228 }, { 3, 151, 207 }, { 1, 98, 160 },
{ 1, 67, 117 }, { 1, 41, 74 }, { 1, 17, 31 }
}
}
}
};
static const av1_coeff_probs_model default_coef_probs_32x32[PLANE_TYPES] = {
{ // Y plane
{ // Intra
{ // Band 0
{ 17, 38, 140 }, { 7, 34, 80 }, { 1, 17, 29 }
}, { // Band 1
{ 37, 75, 128 }, { 41, 76, 128 }, { 26, 66, 116 },
{ 12, 52, 94 }, { 2, 32, 55 }, { 1, 10, 16 }
}, { // Band 2
{ 50, 127, 154 }, { 37, 109, 152 }, { 16, 82, 121 },
{ 5, 59, 85 }, { 1, 35, 54 }, { 1, 13, 20 }
}, { // Band 3
{ 40, 142, 167 }, { 17, 110, 157 }, { 2, 71, 112 },
{ 1, 44, 72 }, { 1, 27, 45 }, { 1, 11, 17 }
}, { // Band 4
{ 30, 175, 188 }, { 9, 124, 169 }, { 1, 74, 116 },
{ 1, 48, 78 }, { 1, 30, 49 }, { 1, 11, 18 }
}, { // Band 5
{ 10, 222, 223 }, { 2, 150, 194 }, { 1, 83, 128 },
{ 1, 48, 79 }, { 1, 27, 45 }, { 1, 11, 17 }
}
}, { // Inter
{ // Band 0
{ 36, 41, 235 }, { 29, 36, 193 }, { 10, 27, 111 }
}, { // Band 1
{ 85, 165, 222 }, { 177, 162, 215 }, { 110, 135, 195 },
{ 57, 113, 168 }, { 23, 83, 120 }, { 10, 49, 61 }
}, { // Band 2
{ 85, 190, 223 }, { 36, 139, 200 }, { 5, 90, 146 },
{ 1, 60, 103 }, { 1, 38, 65 }, { 1, 18, 30 }
}, { // Band 3
{ 72, 202, 223 }, { 23, 141, 199 }, { 2, 86, 140 },
{ 1, 56, 97 }, { 1, 36, 61 }, { 1, 16, 27 }
}, { // Band 4
{ 55, 218, 225 }, { 13, 145, 200 }, { 1, 86, 141 },
{ 1, 57, 99 }, { 1, 35, 61 }, { 1, 13, 22 }
}, { // Band 5
{ 15, 235, 212 }, { 1, 132, 184 }, { 1, 84, 139 },
{ 1, 57, 97 }, { 1, 34, 56 }, { 1, 14, 23 }
}
}
}, { // UV plane
{ // Intra
{ // Band 0
{ 181, 21, 201 }, { 61, 37, 123 }, { 10, 38, 71 }
}, { // Band 1
{ 47, 106, 172 }, { 95, 104, 173 }, { 42, 93, 159 },
{ 18, 77, 131 }, { 4, 50, 81 }, { 1, 17, 23 }
}, { // Band 2
{ 62, 147, 199 }, { 44, 130, 189 }, { 28, 102, 154 },
{ 18, 75, 115 }, { 2, 44, 65 }, { 1, 12, 19 }
}, { // Band 3
{ 55, 153, 210 }, { 24, 130, 194 }, { 3, 93, 146 },
{ 1, 61, 97 }, { 1, 31, 50 }, { 1, 10, 16 }
}, { // Band 4
{ 49, 186, 223 }, { 17, 148, 204 }, { 1, 96, 142 },
{ 1, 53, 83 }, { 1, 26, 44 }, { 1, 11, 17 }
}, { // Band 5
{ 13, 217, 212 }, { 2, 136, 180 }, { 1, 78, 124 },
{ 1, 50, 83 }, { 1, 29, 49 }, { 1, 14, 23 }
}
}, { // Inter
{ // Band 0
{ 197, 13, 247 }, { 82, 17, 222 }, { 25, 17, 162 }
}, { // Band 1
{ 126, 186, 247 }, { 234, 191, 243 }, { 176, 177, 234 },
{ 104, 158, 220 }, { 66, 128, 186 }, { 55, 90, 137 }
}, { // Band 2
{ 111, 197, 242 }, { 46, 158, 219 }, { 9, 104, 171 },
{ 2, 65, 125 }, { 1, 44, 80 }, { 1, 17, 91 }
}, { // Band 3
{ 104, 208, 245 }, { 39, 168, 224 }, { 3, 109, 162 },
{ 1, 79, 124 }, { 1, 50, 102 }, { 1, 43, 102 }
}, { // Band 4
{ 84, 220, 246 }, { 31, 177, 231 }, { 2, 115, 180 },
{ 1, 79, 134 }, { 1, 55, 77 }, { 1, 60, 79 }
}, { // Band 5
{ 43, 243, 240 }, { 8, 180, 217 }, { 1, 115, 166 },
{ 1, 84, 121 }, { 1, 51, 67 }, { 1, 16, 6 }
}
}
}
};
#endif // CONFIG_NEW_TOKENSET
#if CONFIG_TX64X64
// FIXME. Optimize for EC_MULTISYMBOL
@ -4674,9 +4073,20 @@ static const av1_coeff_probs_model default_coef_probs_64x64[PLANE_TYPES] = {
};
#endif // CONFIG_TX64X64
#endif // CONFIG_Q_ADAPT_PROBS
#if CONFIG_NEW_TOKENSET
static const aom_prob av1_default_blockzero_probs[TX_SIZES][PLANE_TYPES]
[REF_TYPES][BLOCKZ_CONTEXTS] = {
#if CONFIG_CHROMA_2X2
{ // TX_2x2
{ // Y plane
{ 195, 84, 8, }, // Intra
{ 191, 124, 25, }, // Inter
},
{ // UV plane
{ 214, 132, 42, }, // Intra
{ 229, 143, 46, }, // Inter
},
},
#endif
{ // TX_4x4
{ // Y plane
{ 195, 84, 8, }, // Intra
@ -5915,7 +5325,6 @@ static const coeff_cdf_model default_coef_head_cdf_32x32[PLANE_TYPES] = {
{AOM_ICDF(3009), AOM_ICDF(3246), AOM_ICDF(10158), AOM_ICDF(10533),
AOM_ICDF(32768) } } } }
};
#endif // CONFIG_NEW_TOKENSET
/* clang-format on */
@ -5930,8 +5339,6 @@ void av1_model_to_full_probs(const aom_prob *model, aom_prob *full) {
extend_to_full_distribution(&full[UNCONSTRAINED_NODES], model[PIVOT_NODE]);
}
#if CONFIG_NEW_TOKENSET
static void build_tail_cdfs(aom_cdf_prob cdf_tail[CDF_SIZE(ENTROPY_TOKENS)],
aom_cdf_prob cdf_head[CDF_SIZE(ENTROPY_TOKENS)],
int band_zero) {
@ -6041,7 +5448,7 @@ static void av1_default_coef_cdfs(FRAME_CONTEXT *fc) {
for (j = 0; j < REF_TYPES; ++j)
for (k = 0; k < COEF_BANDS; ++k)
for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
av1_copy(fc->coef_head_cdfs[TX_2X2][i][j][k][l],
default_coef_head_cdf_4x4[i][j][k][l]);
#endif
@ -6074,19 +5481,6 @@ void av1_coef_head_cdfs(FRAME_CONTEXT *fc) {
}
}
#elif CONFIG_EC_MULTISYMBOL
static void build_token_cdfs(const aom_prob *pdf_model,
aom_cdf_prob cdf[ENTROPY_TOKENS + 1]) {
int i, sum = 0;
assert(pdf_model[2] != 0);
for (i = 0; i < ENTROPY_TOKENS - 2; ++i) {
sum += av1_pareto8_token_probs[pdf_model[2] - 1][i];
cdf[i] = AOM_ICDF(sum);
}
}
#endif // CONFIG_NEW_TOKENSET
#if CONFIG_EC_MULTISYMBOL
void av1_coef_pareto_cdfs(FRAME_CONTEXT *fc) {
/* Build the tail based on a Pareto distribution */
TX_SIZE t;
@ -6096,15 +5490,9 @@ void av1_coef_pareto_cdfs(FRAME_CONTEXT *fc) {
for (j = 0; j < REF_TYPES; ++j)
for (k = 0; k < COEF_BANDS; ++k)
for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l)
#if CONFIG_NEW_TOKENSET
build_tail_cdfs(fc->coef_tail_cdfs[t][i][j][k][l],
fc->coef_head_cdfs[t][i][j][k][l], k == 0);
#else
build_token_cdfs(fc->coef_probs[t][i][j][k][l],
fc->coef_cdfs[t][i][j][k][l]);
#endif
}
#endif
void av1_default_coef_probs(AV1_COMMON *cm) {
#if CONFIG_Q_ADAPT_PROBS
@ -6112,7 +5500,7 @@ void av1_default_coef_probs(AV1_COMMON *cm) {
ROUND_POWER_OF_TWO(cm->base_qindex, 8 - QCTX_BIN_BITS), QCTX_BINS - 1);
av1_copy(cm->fc->coef_probs, default_qctx_coef_probs[index]);
#else
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
av1_copy(cm->fc->coef_probs[TX_2X2], default_coef_probs_4x4);
#endif
av1_copy(cm->fc->coef_probs[TX_4X4], default_coef_probs_4x4);
@ -6123,44 +5511,29 @@ void av1_default_coef_probs(AV1_COMMON *cm) {
av1_copy(cm->fc->coef_probs[TX_64X64], default_coef_probs_64x64);
#endif // CONFIG_TX64X64
#endif // CONFIG_Q_ADAPT_PROBS
#if CONFIG_NEW_TOKENSET
av1_copy(cm->fc->blockzero_probs, av1_default_blockzero_probs);
#endif
#if CONFIG_NEW_TOKENSET
/* Load the head tokens */
av1_default_coef_cdfs(cm->fc);
#endif
#if CONFIG_EC_MULTISYMBOL
av1_coef_pareto_cdfs(cm->fc);
#endif // CONFIG_EC_MULTISYMBOL
}
#if !CONFIG_LV_MAP
static void adapt_coef_probs(AV1_COMMON *cm, TX_SIZE tx_size,
unsigned int count_sat,
unsigned int update_factor) {
const FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx];
const FRAME_CONTEXT *pre_fc = cm->pre_fc;
av1_coeff_probs_model *const probs = cm->fc->coef_probs[tx_size];
#if CONFIG_SUBFRAME_PROB_UPDATE
const av1_coeff_probs_model *const pre_probs =
cm->partial_prob_update
? (const av1_coeff_probs_model *)cm->starting_coef_probs[tx_size]
: pre_fc->coef_probs[tx_size];
#else
const av1_coeff_probs_model *const pre_probs = pre_fc->coef_probs[tx_size];
#endif // CONFIG_SUBFRAME_PROB_UPDATE
const av1_coeff_count_model *const counts =
(const av1_coeff_count_model *)cm->counts.coef[tx_size];
const unsigned int(*eob_counts)[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS] =
(const unsigned int(*)[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS])
cm->counts.eob_branch[tx_size];
#if CONFIG_NEW_TOKENSET
const av1_blockz_probs_model *const pre_blockz_probs =
pre_fc->blockzero_probs[tx_size];
av1_blockz_probs_model *const blockz_probs = cm->fc->blockzero_probs[tx_size];
const av1_blockz_count_model *const blockz_counts =
(const av1_blockz_count_model *)&cm->counts.blockz_count[tx_size][0];
#endif
int i, j, k, l, m;
#if CONFIG_RECT_TX
assert(!is_rect_tx(tx_size));
@ -6183,7 +5556,6 @@ static void adapt_coef_probs(AV1_COMMON *cm, TX_SIZE tx_size,
count_sat, update_factor);
}
#if CONFIG_NEW_TOKENSET
for (i = 0; i < PLANE_TYPES; ++i) {
for (j = 0; j < REF_TYPES; ++j) {
for (k = 0; k < BLOCKZ_CONTEXTS; ++k) {
@ -6195,7 +5567,6 @@ static void adapt_coef_probs(AV1_COMMON *cm, TX_SIZE tx_size,
}
}
}
#endif
}
#endif // !CONFIG_LV_MAP
@ -6209,9 +5580,6 @@ void av1_adapt_coef_probs(AV1_COMMON *cm) {
update_factor = COEF_MAX_UPDATE_FACTOR;
count_sat = COEF_COUNT_SAT;
}
#if CONFIG_SUBFRAME_PROB_UPDATE
if (cm->partial_prob_update == 1) update_factor = COEF_MAX_UPDATE_FACTOR;
#endif // CONFIG_SUBFRAME_PROB_UPDATE
#if CONFIG_LV_MAP
av1_adapt_txb_probs(cm, count_sat, update_factor);
@ -6222,18 +5590,6 @@ void av1_adapt_coef_probs(AV1_COMMON *cm) {
#endif
}
#if CONFIG_SUBFRAME_PROB_UPDATE
void av1_partial_adapt_probs(AV1_COMMON *cm, int mi_row, int mi_col) {
(void)mi_row;
(void)mi_col;
if (cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
cm->partial_prob_update = 1;
av1_adapt_coef_probs(cm);
}
}
#endif // CONFIG_SUBFRAME_PROB_UPDATE
#if CONFIG_EC_ADAPT
static void av1_average_cdf(aom_cdf_prob *cdf_ptr[], aom_cdf_prob *fc_cdf_ptr,
int cdf_size, const int num_tiles) {
@ -6263,26 +5619,21 @@ static void av1_average_cdf(aom_cdf_prob *cdf_ptr[], aom_cdf_prob *fc_cdf_ptr,
av1_average_cdf(cdf_ptr, fc_cdf_ptr, cdf_size, num_tiles);
void av1_average_tile_coef_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
aom_cdf_prob *cdf_ptr[], const int num_tiles) {
aom_cdf_prob *cdf_ptr[], int num_tiles) {
int i, cdf_size;
aom_cdf_prob *fc_cdf_ptr;
#if CONFIG_NEW_TOKENSET
AVERAGE_TILE_CDFS(coef_head_cdfs)
AVERAGE_TILE_CDFS(coef_tail_cdfs)
#else
AVERAGE_TILE_CDFS(coef_cdfs)
#endif
}
void av1_average_tile_mv_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
aom_cdf_prob *cdf_ptr[], const int num_tiles) {
aom_cdf_prob *cdf_ptr[], int num_tiles) {
int i, k, cdf_size;
aom_cdf_prob *fc_cdf_ptr;
#if CONFIG_REF_MV
int j;
for (j = 0; j < NMV_CONTEXTS; ++j) {
AVERAGE_TILE_CDFS(nmvc[j].joint_cdf)
@ -6293,19 +5644,10 @@ void av1_average_tile_mv_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
AVERAGE_TILE_CDFS(nmvc[j].comps[k].fp_cdf);
}
}
#else
AVERAGE_TILE_CDFS(nmvc.joint_cdf)
for (k = 0; k < 2; ++k) {
AVERAGE_TILE_CDFS(nmvc.comps[k].class_cdf)
AVERAGE_TILE_CDFS(nmvc.comps[k].class0_fp_cdf)
AVERAGE_TILE_CDFS(nmvc.comps[k].fp_cdf)
}
#endif
}
void av1_average_tile_intra_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
aom_cdf_prob *cdf_ptr[], const int num_tiles) {
aom_cdf_prob *cdf_ptr[], int num_tiles) {
int i, cdf_size;
aom_cdf_prob *fc_cdf_ptr;
@ -6335,28 +5677,22 @@ void av1_average_tile_intra_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
#if CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
AVERAGE_TILE_CDFS(intra_filter_cdf)
#endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
#if CONFIG_FILTER_INTRA
#endif // CONFIG_FILTER_INTRA
}
void av1_average_tile_inter_cdfs(AV1_COMMON *cm, FRAME_CONTEXT *fc,
FRAME_CONTEXT *ec_ctxs[],
aom_cdf_prob *cdf_ptr[], const int num_tiles) {
aom_cdf_prob *cdf_ptr[], int num_tiles) {
int i, cdf_size;
aom_cdf_prob *fc_cdf_ptr;
// FIXME: comp_inter_cdf not defined
// FIXME: comp_inter_cdf not defined
// FIXME: comp_ref_cdf and comp_bwd_ref not defined
// FIXME: comp_ref_cdf and comp_bwd_ref not defined
// FIXME: single_ref_cdf not defined
// FIXME: single_ref_cdf not defined
#if CONFIG_REF_MV
// FIXME: cdfs not defined for newmv_mode, zeromv_mode, drl_mode, new2mv_mode
#else
AVERAGE_TILE_CDFS(inter_mode_cdf)
#endif
// FIXME: cdfs not defined for newmv_mode, zeromv_mode, drl_mode, new2mv_mode
// FIXME: cdfs not defined for motion_mode_prob, obmc_prob

View file

@ -32,10 +32,6 @@ extern "C" {
#define QCTX_BINS (1 << QCTX_BIN_BITS)
#endif // CONFIG_Q_ADAPT_PROBS
#if CONFIG_SUBFRAME_PROB_UPDATE
#define COEF_PROBS_BUFS 16
#endif // CONFIG_SUBFRAME_PROB_UPDATE
// Coefficient token alphabet
#define ZERO_TOKEN 0 // 0 Extra Bits 0+0
#define ONE_TOKEN 1 // 1 Extra Bits 0+1
@ -49,18 +45,16 @@ extern "C" {
#define CATEGORY5_TOKEN 9 // 35-66 Extra Bits 5+1
#define CATEGORY6_TOKEN 10 // 67+ Extra Bits 14+1
#define EOB_TOKEN 11 // EOB Extra Bits 0+0
#if CONFIG_NEW_TOKENSET
#define NO_EOB 0 // Not an end-of-block
#define EARLY_EOB 1 // End of block before the last position
#define LAST_EOB 2 // End of block in the last position (implicit)
#define BLOCK_Z_TOKEN 255 // block zero
#define NO_EOB 0 // Not an end-of-block
#define EARLY_EOB 1 // End of block before the last position
#define LAST_EOB 2 // End of block in the last position (implicit)
#define BLOCK_Z_TOKEN 255 // block zero
#define HEAD_TOKENS 5
#define TAIL_TOKENS 9
#define ONE_TOKEN_EOB 1
#define ONE_TOKEN_NEOB 2
#define TWO_TOKEN_PLUS_EOB 3
#define TWO_TOKEN_PLUS_NEOB 4
#endif
#define ENTROPY_TOKENS 12
#define ENTROPY_NODES 11
@ -131,7 +125,7 @@ static INLINE int av1_get_cat6_extrabits_size(TX_SIZE tx_size,
// TODO(debargha): Does TX_64X64 require an additional extrabit?
if (tx_size > TX_32X32) tx_size = TX_32X32;
#endif
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
int tx_offset = (tx_size < TX_4X4) ? 0 : (int)(tx_size - TX_4X4);
#else
int tx_offset = (int)(tx_size - TX_4X4);
@ -175,9 +169,7 @@ static INLINE int av1_get_cat6_extrabits_size(TX_SIZE tx_size,
distinct bands). */
#define COEFF_CONTEXTS 6
#if CONFIG_EC_MULTISYMBOL
#define BLOCKZ_CONTEXTS 3
#endif
#define COEFF_CONTEXTS0 3 // for band 0
#define BAND_COEFF_CONTEXTS(band) \
((band) == 0 ? COEFF_CONTEXTS0 : COEFF_CONTEXTS)
@ -199,9 +191,6 @@ void av1_adapt_coef_probs(struct AV1Common *cm);
#if CONFIG_EC_ADAPT
void av1_adapt_coef_cdfs(struct AV1Common *cm, struct frame_contexts *pre_fc);
#endif
#if CONFIG_SUBFRAME_PROB_UPDATE
void av1_partial_adapt_probs(struct AV1Common *cm, int mi_row, int mi_col);
#endif // CONFIG_SUBFRAME_PROB_UPDATE
// This is the index in the scan order beyond which all coefficients for
// 8x8 transform and above are in the top band.
@ -250,7 +239,6 @@ typedef unsigned int av1_coeff_count_model[REF_TYPES][COEF_BANDS]
void av1_model_to_full_probs(const aom_prob *model, aom_prob *full);
#if CONFIG_EC_MULTISYMBOL
typedef aom_cdf_prob coeff_cdf_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
[CDF_SIZE(ENTROPY_TOKENS)];
typedef aom_prob av1_blockz_probs_model[REF_TYPES][BLOCKZ_CONTEXTS];
@ -260,11 +248,9 @@ extern const aom_cdf_prob av1_pareto8_token_probs[COEFF_PROB_MODELS]
extern const aom_cdf_prob av1_pareto8_tail_probs[COEFF_PROB_MODELS]
[ENTROPY_TOKENS - 3];
struct frame_contexts;
#if CONFIG_NEW_TOKENSET
void av1_coef_head_cdfs(struct frame_contexts *fc);
#endif
void av1_coef_pareto_cdfs(struct frame_contexts *fc);
#endif // CONFIG_EC_MULTISYMBOL
typedef char ENTROPY_CONTEXT;
@ -277,7 +263,7 @@ static INLINE int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a,
const ENTROPY_CONTEXT *l) {
ENTROPY_CONTEXT above_ec = 0, left_ec = 0;
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
switch (tx_size) {
case TX_2X2:
above_ec = a[0] != 0;
@ -323,10 +309,36 @@ static INLINE int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a,
above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8));
left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8));
break;
#if CONFIG_TX64X64
case TX_64X64:
above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8) |
*(const uint64_t *)(a + 16) | *(const uint64_t *)(a + 24));
left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8) |
*(const uint64_t *)(l + 16) | *(const uint64_t *)(l + 24));
break;
#endif // CONFIG_TX64X64
#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
case TX_4X16:
above_ec = !!*(const uint16_t *)a;
left_ec = !!*(const uint64_t *)l;
break;
case TX_16X4:
above_ec = !!*(const uint64_t *)a;
left_ec = !!*(const uint16_t *)l;
break;
case TX_8X32:
above_ec = !!*(const uint32_t *)a;
left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8));
break;
case TX_32X8:
above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8));
left_ec = !!*(const uint32_t *)l;
break;
#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
default: assert(0 && "Invalid transform size."); break;
}
return combine_entropy_contexts(above_ec, left_ec);
#endif
#endif // CONFIG_CHROMA_2X2
switch (tx_size) {
case TX_4X4:
@ -375,6 +387,24 @@ static INLINE int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a,
left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8));
break;
#endif // CONFIG_TX64X64
#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
case TX_4X16:
above_ec = a[0] != 0;
left_ec = !!*(const uint32_t *)l;
break;
case TX_16X4:
above_ec = !!*(const uint32_t *)a;
left_ec = l[0] != 0;
break;
case TX_8X32:
above_ec = !!*(const uint16_t *)a;
left_ec = !!*(const uint64_t *)l;
break;
case TX_32X8:
above_ec = !!*(const uint64_t *)a;
left_ec = !!*(const uint16_t *)l;
break;
#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
default: assert(0 && "Invalid transform size."); break;
}
return combine_entropy_contexts(above_ec, left_ec);

File diff suppressed because it is too large Load diff

View file

@ -73,7 +73,7 @@ extern "C" {
#endif // CONFIG_PALETTE
#if CONFIG_INTRABC
#define INTRABC_PROB 192
#define INTRABC_PROB_DEFAULT 192
#endif // CONFIG_INTRABC
struct AV1Common;
@ -99,18 +99,14 @@ typedef struct frame_contexts {
aom_prob partition_prob[PARTITION_CONTEXTS][PARTITION_TYPES - 1];
#endif
av1_coeff_probs_model coef_probs[TX_SIZES][PLANE_TYPES];
#if CONFIG_NEW_TOKENSET
coeff_cdf_model coef_tail_cdfs[TX_SIZES][PLANE_TYPES];
coeff_cdf_model coef_head_cdfs[TX_SIZES][PLANE_TYPES];
aom_prob blockzero_probs[TX_SIZES][PLANE_TYPES][REF_TYPES][BLOCKZ_CONTEXTS];
#elif CONFIG_EC_MULTISYMBOL
coeff_cdf_model coef_cdfs[TX_SIZES][PLANE_TYPES];
#endif // CONFIG_NEW_TOKENSET
aom_prob switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS]
[SWITCHABLE_FILTERS - 1];
#if CONFIG_ADAPT_SCAN
// TODO(angiebird): try aom_prob
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
uint32_t non_zero_prob_2x2[TX_TYPES][4];
#endif
uint32_t non_zero_prob_4X4[TX_TYPES][16];
@ -125,7 +121,7 @@ typedef struct frame_contexts {
uint32_t non_zero_prob_32X16[TX_TYPES][512];
uint32_t non_zero_prob_16X32[TX_TYPES][512];
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
DECLARE_ALIGNED(16, int16_t, scan_2x2[TX_TYPES][4]);
#endif
DECLARE_ALIGNED(16, int16_t, scan_4X4[TX_TYPES][16]);
@ -140,7 +136,7 @@ typedef struct frame_contexts {
DECLARE_ALIGNED(16, int16_t, scan_16X32[TX_TYPES][512]);
DECLARE_ALIGNED(16, int16_t, scan_32X16[TX_TYPES][512]);
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
DECLARE_ALIGNED(16, int16_t, iscan_2x2[TX_TYPES][4]);
#endif
DECLARE_ALIGNED(16, int16_t, iscan_4X4[TX_TYPES][16]);
@ -155,7 +151,7 @@ typedef struct frame_contexts {
DECLARE_ALIGNED(16, int16_t, iscan_16X32[TX_TYPES][512]);
DECLARE_ALIGNED(16, int16_t, iscan_32X16[TX_TYPES][512]);
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
int16_t nb_2x2[TX_TYPES][(4 + 1) * 2];
#endif
int16_t nb_4X4[TX_TYPES][(16 + 1) * 2];
@ -185,12 +181,10 @@ typedef struct frame_contexts {
aom_prob coeff_lps[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS];
#endif
#if CONFIG_REF_MV
aom_prob newmv_prob[NEWMV_MODE_CONTEXTS];
aom_prob zeromv_prob[ZEROMV_MODE_CONTEXTS];
aom_prob refmv_prob[REFMV_MODE_CONTEXTS];
aom_prob drl_prob[DRL_MODE_CONTEXTS];
#endif // CONFIG_REF_MV
aom_prob inter_mode_probs[INTER_MODE_CONTEXTS][INTER_MODES - 1];
#if CONFIG_EXT_INTER
@ -201,9 +195,11 @@ typedef struct frame_contexts {
[INTER_SINGLEREF_COMP_MODES - 1];
#endif // CONFIG_COMPOUND_SINGLEREF
aom_prob compound_type_prob[BLOCK_SIZES][COMPOUND_TYPES - 1];
#if CONFIG_INTERINTRA
aom_prob interintra_prob[BLOCK_SIZE_GROUPS];
aom_prob interintra_mode_prob[BLOCK_SIZE_GROUPS][INTERINTRA_MODES - 1];
aom_prob wedge_interintra_prob[BLOCK_SIZES];
#endif // CONFIG_INTERINTRA
#endif // CONFIG_EXT_INTER
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
aom_prob motion_mode_prob[BLOCK_SIZES][MOTION_MODES - 1];
@ -224,17 +220,17 @@ typedef struct frame_contexts {
aom_prob comp_inter_mode_prob[COMP_INTER_MODE_CONTEXTS];
#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF
aom_prob tx_size_probs[MAX_TX_DEPTH][TX_SIZE_CONTEXTS][MAX_TX_DEPTH];
#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
aom_prob quarter_tx_size_prob;
#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
#if CONFIG_VAR_TX
aom_prob txfm_partition_prob[TXFM_PARTITION_CONTEXTS];
#endif
aom_prob skip_probs[SKIP_CONTEXTS];
#if CONFIG_REF_MV
nmv_context nmvc[NMV_CONTEXTS];
#else
nmv_context nmvc;
#endif
#if CONFIG_INTRABC
nmv_context ndvc;
aom_prob intrabc_prob;
#endif
int initialized;
#if CONFIG_EXT_TX
@ -263,7 +259,6 @@ typedef struct frame_contexts {
#if CONFIG_LOOP_RESTORATION
aom_prob switchable_restore_prob[RESTORE_SWITCHABLE_TYPES - 1];
#endif // CONFIG_LOOP_RESTORATION
#if CONFIG_EC_MULTISYMBOL
aom_cdf_prob y_mode_cdf[BLOCK_SIZE_GROUPS][CDF_SIZE(INTRA_MODES)];
aom_cdf_prob uv_mode_cdf[INTRA_MODES][CDF_SIZE(INTRA_MODES)];
#if CONFIG_EXT_PARTITION_TYPES
@ -297,7 +292,6 @@ typedef struct frame_contexts {
#if CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
aom_cdf_prob intra_filter_cdf[INTRA_FILTERS + 1][CDF_SIZE(INTRA_FILTERS)];
#endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
#endif // CONFIG_EC_MULTISYMBOL
#if CONFIG_DELTA_Q
aom_prob delta_q_prob[DELTA_Q_PROBS];
#if CONFIG_EXT_DELTA_Q
@ -309,6 +303,9 @@ typedef struct frame_contexts {
// such as coef_cdfs[], coef_tail_cdfs[], and coef_heaf_cdfs[] can be removed.
od_adapt_ctx pvq_context;
#endif // CONFIG_PVQ
#if CONFIG_CFL
aom_cdf_prob cfl_alpha_cdf[CDF_SIZE(CFL_ALPHABET_SIZE)];
#endif
} FRAME_CONTEXT;
typedef struct FRAME_COUNTS {
@ -328,9 +325,9 @@ typedef struct FRAME_COUNTS {
unsigned int switchable_interp[SWITCHABLE_FILTER_CONTEXTS]
[SWITCHABLE_FILTERS];
#if CONFIG_ADAPT_SCAN
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
unsigned int non_zero_count_2x2[TX_TYPES][4];
#endif // CONFIG_CB4X4
#endif // CONFIG_CHROMA_2X2
unsigned int non_zero_count_4X4[TX_TYPES][16];
unsigned int non_zero_count_8X8[TX_TYPES][64];
unsigned int non_zero_count_16X16[TX_TYPES][256];
@ -356,16 +353,12 @@ typedef struct FRAME_COUNTS {
unsigned int coeff_lps[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS][2];
#endif // CONFIG_LV_MAP
#if CONFIG_EC_MULTISYMBOL
av1_blockz_count_model blockz_count[TX_SIZES][PLANE_TYPES];
#endif
#if CONFIG_REF_MV
unsigned int newmv_mode[NEWMV_MODE_CONTEXTS][2];
unsigned int zeromv_mode[ZEROMV_MODE_CONTEXTS][2];
unsigned int refmv_mode[REFMV_MODE_CONTEXTS][2];
unsigned int drl_mode[DRL_MODE_CONTEXTS][2];
#endif
unsigned int inter_mode[INTER_MODE_CONTEXTS][INTER_MODES];
#if CONFIG_EXT_INTER
@ -374,9 +367,11 @@ typedef struct FRAME_COUNTS {
unsigned int inter_singleref_comp_mode[INTER_MODE_CONTEXTS]
[INTER_SINGLEREF_COMP_MODES];
#endif // CONFIG_COMPOUND_SINGLEREF
#if CONFIG_INTERINTRA
unsigned int interintra[BLOCK_SIZE_GROUPS][2];
unsigned int interintra_mode[BLOCK_SIZE_GROUPS][INTERINTRA_MODES];
unsigned int wedge_interintra[BLOCK_SIZES][2];
#endif // CONFIG_INTERINTRA
unsigned int compound_interinter[BLOCK_SIZES][COMPOUND_TYPES];
#endif // CONFIG_EXT_INTER
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
@ -401,17 +396,17 @@ typedef struct FRAME_COUNTS {
// to use forward updates for the coeff probs, and as such it does not really
// belong into this structure.
unsigned int tx_size_totals[TX_SIZES];
unsigned int tx_size[MAX_TX_DEPTH][TX_SIZE_CONTEXTS][TX_SIZES];
unsigned int tx_size[MAX_TX_DEPTH][TX_SIZE_CONTEXTS][MAX_TX_DEPTH + 1];
#if CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
unsigned int quarter_tx_size[2];
#endif // CONFIG_EXT_TX && CONFIG_RECT_TX && CONFIG_RECT_TX_EXT
#if CONFIG_VAR_TX
unsigned int txfm_partition[TXFM_PARTITION_CONTEXTS][2];
#endif
unsigned int skip[SKIP_CONTEXTS][2];
#if CONFIG_REF_MV
nmv_context_counts mv[NMV_CONTEXTS];
#else
nmv_context_counts mv;
#endif
#if CONFIG_INTRABC
unsigned int intrabc[2];
nmv_context_counts dv;
#endif
#if CONFIG_DELTA_Q
@ -451,11 +446,9 @@ typedef struct FRAME_COUNTS {
// Contexts used: Intra mode (Y plane) of 'above' and 'left' blocks.
extern const aom_prob av1_kf_y_mode_prob[INTRA_MODES][INTRA_MODES]
[INTRA_MODES - 1];
#if CONFIG_EC_MULTISYMBOL
// CDF version of 'av1_kf_y_mode_prob'.
extern const aom_cdf_prob av1_kf_y_mode_cdf[INTRA_MODES][INTRA_MODES]
[CDF_SIZE(INTRA_MODES)];
#endif
#if CONFIG_PALETTE
extern const aom_prob av1_default_palette_y_mode_prob[PALETTE_BLOCK_SIZES]
@ -474,7 +467,6 @@ extern const aom_prob av1_default_palette_uv_color_index_prob
extern const aom_tree_index av1_intra_mode_tree[TREE_SIZE(INTRA_MODES)];
extern const aom_tree_index av1_inter_mode_tree[TREE_SIZE(INTER_MODES)];
#if CONFIG_EC_MULTISYMBOL
extern int av1_intra_mode_ind[INTRA_MODES];
extern int av1_intra_mode_inv[INTRA_MODES];
extern int av1_inter_mode_ind[INTER_MODES];
@ -485,11 +477,12 @@ extern int av1_ext_tx_intra_inv[EXT_TX_SETS_INTRA][TX_TYPES];
extern int av1_ext_tx_inter_ind[EXT_TX_SETS_INTER][TX_TYPES];
extern int av1_ext_tx_inter_inv[EXT_TX_SETS_INTER][TX_TYPES];
#endif
#endif
#if CONFIG_EXT_INTER
#if CONFIG_INTERINTRA
extern const aom_tree_index
av1_interintra_mode_tree[TREE_SIZE(INTERINTRA_MODES)];
#endif
extern const aom_tree_index
av1_inter_compound_mode_tree[TREE_SIZE(INTER_COMPOUND_MODES)];
#if CONFIG_COMPOUND_SINGLEREF
@ -534,10 +527,10 @@ extern const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)];
extern const aom_tree_index
av1_switchable_restore_tree[TREE_SIZE(RESTORE_SWITCHABLE_TYPES)];
#endif // CONFIG_LOOP_RESTORATION
#if CONFIG_EC_MULTISYMBOL
extern int av1_switchable_interp_ind[SWITCHABLE_FILTERS];
extern int av1_switchable_interp_inv[SWITCHABLE_FILTERS];
#if !CONFIG_EC_ADAPT
void av1_set_mode_cdfs(struct AV1Common *cm);
#endif
@ -545,7 +538,7 @@ void av1_setup_past_independence(struct AV1Common *cm);
void av1_adapt_intra_frame_probs(struct AV1Common *cm);
void av1_adapt_inter_frame_probs(struct AV1Common *cm);
#if CONFIG_EC_MULTISYMBOL && !CONFIG_EXT_TX
#if !CONFIG_EXT_TX
extern int av1_ext_tx_ind[TX_TYPES];
extern int av1_ext_tx_inv[TX_TYPES];
#endif

View file

@ -43,57 +43,47 @@ const aom_tree_index av1_mv_fp_tree[TREE_SIZE(MV_FP_SIZE)] = { -0, 2, -1,
static const nmv_context default_nmv_context = {
{ 32, 64, 96 }, // joints
#if CONFIG_EC_MULTISYMBOL
{ AOM_ICDF(4096), AOM_ICDF(11264), AOM_ICDF(19328), AOM_ICDF(32768),
0 }, // joint_cdf
#endif
{ {
// Vertical component
128, // sign
{ 224, 144, 192, 168, 192, 176, 192, 198, 198, 245 }, // class
#if CONFIG_EC_MULTISYMBOL
{ AOM_ICDF(28672), AOM_ICDF(30976), AOM_ICDF(31858), AOM_ICDF(32320),
AOM_ICDF(32551), AOM_ICDF(32656), AOM_ICDF(32740), AOM_ICDF(32757),
AOM_ICDF(32762), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, // class_cdf
#endif
{ 216 }, // class0
{ 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits
{ { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp
{ 64, 96, 64 }, // fp
#if CONFIG_EC_MULTISYMBOL
{ 216 }, // class0
{ 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits
{ { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp
{ 64, 96, 64 }, // fp
{ { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(26624), AOM_ICDF(32768),
0 },
{ AOM_ICDF(12288), AOM_ICDF(21248), AOM_ICDF(24128), AOM_ICDF(32768),
0 } }, // class0_fp_cdf
{ AOM_ICDF(8192), AOM_ICDF(17408), AOM_ICDF(21248), AOM_ICDF(32768),
0 }, // fp_cdf
#endif
160, // class0_hp bit
128, // hp
160, // class0_hp bit
128, // hp
},
{
// Horizontal component
128, // sign
{ 216, 128, 176, 160, 176, 176, 192, 198, 198, 208 }, // class
#if CONFIG_EC_MULTISYMBOL
{ AOM_ICDF(28672), AOM_ICDF(30976), AOM_ICDF(31858), AOM_ICDF(32320),
AOM_ICDF(32551), AOM_ICDF(32656), AOM_ICDF(32740), AOM_ICDF(32757),
AOM_ICDF(32762), AOM_ICDF(32767), AOM_ICDF(32768), 0 }, // class_cdf
#endif
{ 208 }, // class0
{ 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits
{ { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp
{ 64, 96, 64 }, // fp
#if CONFIG_EC_MULTISYMBOL
{ 208 }, // class0
{ 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, // bits
{ { 128, 128, 64 }, { 96, 112, 64 } }, // class0_fp
{ 64, 96, 64 }, // fp
{ { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(26624), AOM_ICDF(32768),
0 },
{ AOM_ICDF(12288), AOM_ICDF(21248), AOM_ICDF(24128), AOM_ICDF(32768),
0 } }, // class0_fp_cdf
{ AOM_ICDF(8192), AOM_ICDF(17408), AOM_ICDF(21248), AOM_ICDF(32768),
0 }, // fp_cdf
#endif
160, // class0_hp bit
128, // hp
160, // class0_hp bit
128, // hp
} },
};
@ -232,23 +222,16 @@ void av1_inc_mv(const MV *mv, nmv_context_counts *counts, const int usehp) {
void av1_adapt_mv_probs(AV1_COMMON *cm, int allow_hp) {
int i, j;
#if CONFIG_REF_MV
int idx;
for (idx = 0; idx < NMV_CONTEXTS; ++idx) {
nmv_context *fc = &cm->fc->nmvc[idx];
const nmv_context *pre_fc =
&cm->frame_contexts[cm->frame_context_idx].nmvc[idx];
nmv_context *nmvc = &cm->fc->nmvc[idx];
const nmv_context *pre_nmvc = &cm->pre_fc->nmvc[idx];
const nmv_context_counts *counts = &cm->counts.mv[idx];
#else
nmv_context *fc = &cm->fc->nmvc;
const nmv_context *pre_fc = &cm->frame_contexts[cm->frame_context_idx].nmvc;
const nmv_context_counts *counts = &cm->counts.mv;
#endif // CONFIG_REF_MV
aom_tree_merge_probs(av1_mv_joint_tree, pre_fc->joints, counts->joints,
fc->joints);
aom_tree_merge_probs(av1_mv_joint_tree, pre_nmvc->joints, counts->joints,
nmvc->joints);
for (i = 0; i < 2; ++i) {
nmv_component *comp = &fc->comps[i];
const nmv_component *pre_comp = &pre_fc->comps[i];
nmv_component *comp = &nmvc->comps[i];
const nmv_component *pre_comp = &pre_nmvc->comps[i];
const nmv_component_counts *c = &counts->comps[i];
comp->sign = av1_mode_mv_merge_probs(pre_comp->sign, c->sign);
@ -272,12 +255,10 @@ void av1_adapt_mv_probs(AV1_COMMON *cm, int allow_hp) {
comp->hp = av1_mode_mv_merge_probs(pre_comp->hp, c->hp);
}
}
#if CONFIG_REF_MV
}
#endif // CONFIG_REF_MV
}
#if CONFIG_EC_MULTISYMBOL && !CONFIG_EC_ADAPT
#if !CONFIG_EC_ADAPT
void av1_set_mv_cdfs(nmv_context *ctx) {
int i;
int j;
@ -297,15 +278,11 @@ void av1_set_mv_cdfs(nmv_context *ctx) {
#endif
void av1_init_mv_probs(AV1_COMMON *cm) {
#if CONFIG_REF_MV
int i;
for (i = 0; i < NMV_CONTEXTS; ++i) {
// NB: this sets CDFs too
cm->fc->nmvc[i] = default_nmv_context;
}
#else
cm->fc->nmvc = default_nmv_context;
#endif // CONFIG_REF_MV
#if CONFIG_INTRABC
cm->fc->ndvc = default_nmv_context;
#endif // CONFIG_INTRABC

View file

@ -84,26 +84,20 @@ extern const aom_tree_index av1_mv_fp_tree[];
typedef struct {
aom_prob sign;
aom_prob classes[MV_CLASSES - 1];
#if CONFIG_EC_MULTISYMBOL
aom_cdf_prob class_cdf[CDF_SIZE(MV_CLASSES)];
#endif
aom_prob class0[CLASS0_SIZE - 1];
aom_prob bits[MV_OFFSET_BITS];
aom_prob class0_fp[CLASS0_SIZE][MV_FP_SIZE - 1];
aom_prob fp[MV_FP_SIZE - 1];
#if CONFIG_EC_MULTISYMBOL
aom_cdf_prob class0_fp_cdf[CLASS0_SIZE][CDF_SIZE(MV_FP_SIZE)];
aom_cdf_prob fp_cdf[CDF_SIZE(MV_FP_SIZE)];
#endif
aom_prob class0_hp;
aom_prob hp;
} nmv_component;
typedef struct {
aom_prob joints[MV_JOINTS - 1];
#if CONFIG_EC_MULTISYMBOL
aom_cdf_prob joint_cdf[CDF_SIZE(MV_JOINTS)];
#endif
nmv_component comps[2];
} nmv_context;
@ -138,7 +132,7 @@ void av1_inc_mv(const MV *mv, nmv_context_counts *mvctx, const int usehp);
extern const aom_tree_index
av1_global_motion_types_tree[TREE_SIZE(GLOBAL_TRANS_TYPES)];
#endif // CONFIG_GLOBAL_MOTION
#if CONFIG_EC_MULTISYMBOL
#if !CONFIG_EC_ADAPT
void av1_set_mv_cdfs(nmv_context *ctx);
#endif

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