mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-06 15:27:30 +09:00
Import aom library
This is the reference implementation for the Alliance for Open Media's av1 video code. The commit used was 4d668d7feb1f8abd809d1bca0418570a7f142a36.
This commit is contained in:
parent
eb8cd130a8
commit
edc8d83307
989 changed files with 470949 additions and 0 deletions
518
third_party/aom/av1/av1.cmake
vendored
Normal file
518
third_party/aom/av1/av1.cmake
vendored
Normal file
|
|
@ -0,0 +1,518 @@
|
|||
##
|
||||
## 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.
|
||||
##
|
||||
set(AOM_AV1_COMMON_SOURCES
|
||||
"${AOM_ROOT}/av1/av1_iface_common.h"
|
||||
"${AOM_ROOT}/av1/common/alloccommon.c"
|
||||
"${AOM_ROOT}/av1/common/alloccommon.h"
|
||||
# TODO(tomfinegan): Foward transform belongs in encoder.
|
||||
"${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_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_loopfilter.c"
|
||||
"${AOM_ROOT}/av1/common/av1_loopfilter.h"
|
||||
"${AOM_ROOT}/av1/common/av1_txfm.h"
|
||||
"${AOM_ROOT}/av1/common/blockd.c"
|
||||
"${AOM_ROOT}/av1/common/blockd.h"
|
||||
"${AOM_ROOT}/av1/common/common.h"
|
||||
"${AOM_ROOT}/av1/common/common_data.h"
|
||||
"${AOM_ROOT}/av1/common/convolve.c"
|
||||
"${AOM_ROOT}/av1/common/convolve.h"
|
||||
"${AOM_ROOT}/av1/common/debugmodes.c"
|
||||
"${AOM_ROOT}/av1/common/entropy.c"
|
||||
"${AOM_ROOT}/av1/common/entropy.h"
|
||||
"${AOM_ROOT}/av1/common/entropymode.c"
|
||||
"${AOM_ROOT}/av1/common/entropymode.h"
|
||||
"${AOM_ROOT}/av1/common/entropymv.c"
|
||||
"${AOM_ROOT}/av1/common/entropymv.h"
|
||||
"${AOM_ROOT}/av1/common/enums.h"
|
||||
"${AOM_ROOT}/av1/common/filter.c"
|
||||
"${AOM_ROOT}/av1/common/filter.h"
|
||||
"${AOM_ROOT}/av1/common/frame_buffers.c"
|
||||
"${AOM_ROOT}/av1/common/frame_buffers.h"
|
||||
"${AOM_ROOT}/av1/common/idct.c"
|
||||
"${AOM_ROOT}/av1/common/idct.h"
|
||||
"${AOM_ROOT}/av1/common/mv.h"
|
||||
"${AOM_ROOT}/av1/common/mvref_common.c"
|
||||
"${AOM_ROOT}/av1/common/mvref_common.h"
|
||||
"${AOM_ROOT}/av1/common/odintrin.c"
|
||||
"${AOM_ROOT}/av1/common/odintrin.h"
|
||||
"${AOM_ROOT}/av1/common/onyxc_int.h"
|
||||
"${AOM_ROOT}/av1/common/pred_common.c"
|
||||
"${AOM_ROOT}/av1/common/pred_common.h"
|
||||
"${AOM_ROOT}/av1/common/quant_common.c"
|
||||
"${AOM_ROOT}/av1/common/quant_common.h"
|
||||
"${AOM_ROOT}/av1/common/reconinter.c"
|
||||
"${AOM_ROOT}/av1/common/reconinter.h"
|
||||
"${AOM_ROOT}/av1/common/reconintra.c"
|
||||
"${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"
|
||||
"${AOM_ROOT}/av1/common/scan.h"
|
||||
"${AOM_ROOT}/av1/common/seg_common.c"
|
||||
"${AOM_ROOT}/av1/common/seg_common.h"
|
||||
"${AOM_ROOT}/av1/common/thread_common.c"
|
||||
"${AOM_ROOT}/av1/common/thread_common.h"
|
||||
"${AOM_ROOT}/av1/common/tile_common.c"
|
||||
"${AOM_ROOT}/av1/common/tile_common.h")
|
||||
|
||||
set(AOM_AV1_DECODER_SOURCES
|
||||
"${AOM_ROOT}/av1/av1_dx_iface.c"
|
||||
"${AOM_ROOT}/av1/decoder/decodeframe.c"
|
||||
"${AOM_ROOT}/av1/decoder/decodeframe.h"
|
||||
"${AOM_ROOT}/av1/decoder/decodemv.c"
|
||||
"${AOM_ROOT}/av1/decoder/decodemv.h"
|
||||
"${AOM_ROOT}/av1/decoder/decoder.c"
|
||||
"${AOM_ROOT}/av1/decoder/decoder.h"
|
||||
"${AOM_ROOT}/av1/decoder/detokenize.c"
|
||||
"${AOM_ROOT}/av1/decoder/detokenize.h"
|
||||
"${AOM_ROOT}/av1/decoder/dsubexp.c"
|
||||
"${AOM_ROOT}/av1/decoder/dsubexp.h"
|
||||
"${AOM_ROOT}/av1/decoder/dthread.c"
|
||||
"${AOM_ROOT}/av1/decoder/dthread.h")
|
||||
|
||||
set(AOM_AV1_ENCODER_SOURCES
|
||||
"${AOM_ROOT}/av1/av1_cx_iface.c"
|
||||
"${AOM_ROOT}/av1/encoder/aq_complexity.c"
|
||||
"${AOM_ROOT}/av1/encoder/aq_complexity.h"
|
||||
"${AOM_ROOT}/av1/encoder/aq_cyclicrefresh.c"
|
||||
"${AOM_ROOT}/av1/encoder/aq_cyclicrefresh.h"
|
||||
"${AOM_ROOT}/av1/encoder/aq_variance.c"
|
||||
"${AOM_ROOT}/av1/encoder/aq_variance.h"
|
||||
"${AOM_ROOT}/av1/encoder/av1_quantize.c"
|
||||
"${AOM_ROOT}/av1/encoder/av1_quantize.h"
|
||||
"${AOM_ROOT}/av1/encoder/bitstream.c"
|
||||
"${AOM_ROOT}/av1/encoder/bitstream.h"
|
||||
"${AOM_ROOT}/av1/encoder/block.h"
|
||||
"${AOM_ROOT}/av1/encoder/context_tree.c"
|
||||
"${AOM_ROOT}/av1/encoder/context_tree.h"
|
||||
"${AOM_ROOT}/av1/encoder/cost.c"
|
||||
"${AOM_ROOT}/av1/encoder/cost.h"
|
||||
"${AOM_ROOT}/av1/encoder/dct.c"
|
||||
"${AOM_ROOT}/av1/encoder/encodeframe.c"
|
||||
"${AOM_ROOT}/av1/encoder/encodeframe.h"
|
||||
"${AOM_ROOT}/av1/encoder/encodemb.c"
|
||||
"${AOM_ROOT}/av1/encoder/encodemb.h"
|
||||
"${AOM_ROOT}/av1/encoder/encodemv.c"
|
||||
"${AOM_ROOT}/av1/encoder/encodemv.h"
|
||||
"${AOM_ROOT}/av1/encoder/encoder.c"
|
||||
"${AOM_ROOT}/av1/encoder/encoder.h"
|
||||
"${AOM_ROOT}/av1/encoder/ethread.c"
|
||||
"${AOM_ROOT}/av1/encoder/ethread.h"
|
||||
"${AOM_ROOT}/av1/encoder/extend.c"
|
||||
"${AOM_ROOT}/av1/encoder/extend.h"
|
||||
"${AOM_ROOT}/av1/encoder/firstpass.c"
|
||||
"${AOM_ROOT}/av1/encoder/firstpass.h"
|
||||
"${AOM_ROOT}/av1/encoder/hybrid_fwd_txfm.c"
|
||||
"${AOM_ROOT}/av1/encoder/hybrid_fwd_txfm.h"
|
||||
"${AOM_ROOT}/av1/encoder/lookahead.c"
|
||||
"${AOM_ROOT}/av1/encoder/lookahead.h"
|
||||
"${AOM_ROOT}/av1/encoder/mbgraph.c"
|
||||
"${AOM_ROOT}/av1/encoder/mbgraph.h"
|
||||
"${AOM_ROOT}/av1/encoder/mcomp.c"
|
||||
"${AOM_ROOT}/av1/encoder/mcomp.h"
|
||||
"${AOM_ROOT}/av1/encoder/picklpf.c"
|
||||
"${AOM_ROOT}/av1/encoder/picklpf.h"
|
||||
"${AOM_ROOT}/av1/encoder/ratectrl.c"
|
||||
"${AOM_ROOT}/av1/encoder/ratectrl.h"
|
||||
"${AOM_ROOT}/av1/encoder/rd.c"
|
||||
"${AOM_ROOT}/av1/encoder/rd.h"
|
||||
"${AOM_ROOT}/av1/encoder/rdopt.c"
|
||||
"${AOM_ROOT}/av1/encoder/rdopt.h"
|
||||
"${AOM_ROOT}/av1/encoder/segmentation.c"
|
||||
"${AOM_ROOT}/av1/encoder/segmentation.h"
|
||||
"${AOM_ROOT}/av1/encoder/speed_features.c"
|
||||
"${AOM_ROOT}/av1/encoder/speed_features.h"
|
||||
"${AOM_ROOT}/av1/encoder/subexp.c"
|
||||
"${AOM_ROOT}/av1/encoder/subexp.h"
|
||||
"${AOM_ROOT}/av1/encoder/temporal_filter.c"
|
||||
"${AOM_ROOT}/av1/encoder/temporal_filter.h"
|
||||
"${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")
|
||||
|
||||
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
|
||||
"${AOM_ROOT}/av1/common/x86/av1_convolve_ssse3.c")
|
||||
|
||||
set(AOM_AV1_COMMON_INTRIN_SSE4_1
|
||||
"${AOM_ROOT}/av1/common/x86/av1_fwd_txfm1d_sse4.c"
|
||||
"${AOM_ROOT}/av1/common/x86/av1_fwd_txfm2d_sse4.c")
|
||||
|
||||
set(AOM_AV1_COMMON_INTRIN_AVX2
|
||||
"${AOM_ROOT}/av1/common/x86/hybrid_inv_txfm_avx2.c")
|
||||
|
||||
set(AOM_AV1_COMMON_INTRIN_DSPR2
|
||||
"${AOM_ROOT}/av1/common/mips/dspr2/av1_itrans16_dspr2.c"
|
||||
"${AOM_ROOT}/av1/common/mips/dspr2/av1_itrans4_dspr2.c"
|
||||
"${AOM_ROOT}/av1/common/mips/dspr2/av1_itrans8_dspr2.c")
|
||||
|
||||
set(AOM_AV1_COMMON_INTRIN_MSA
|
||||
"${AOM_ROOT}/av1/common/mips/msa/av1_idct16x16_msa.c"
|
||||
"${AOM_ROOT}/av1/common/mips/msa/av1_idct4x4_msa.c"
|
||||
"${AOM_ROOT}/av1/common/mips/msa/av1_idct8x8_msa.c")
|
||||
|
||||
set(AOM_AV1_ENCODER_ASM_SSE2
|
||||
"${AOM_ROOT}/av1/encoder/x86/dct_sse2.asm"
|
||||
"${AOM_ROOT}/av1/encoder/x86/error_sse2.asm"
|
||||
"${AOM_ROOT}/av1/encoder/x86/temporal_filter_apply_sse2.asm")
|
||||
|
||||
set(AOM_AV1_ENCODER_INTRIN_SSE2
|
||||
"${AOM_ROOT}/av1/encoder/x86/dct_intrin_sse2.c"
|
||||
"${AOM_ROOT}/av1/encoder/x86/highbd_block_error_intrin_sse2.c"
|
||||
"${AOM_ROOT}/av1/encoder/x86/av1_quantize_sse2.c")
|
||||
|
||||
set(AOM_AV1_ENCODER_ASM_SSSE3_X86_64
|
||||
"${AOM_ROOT}/av1/encoder/x86/av1_quantize_ssse3_x86_64.asm")
|
||||
|
||||
set(AOM_AV1_ENCODER_INTRIN_SSSE3
|
||||
"${AOM_ROOT}/av1/encoder/x86/dct_ssse3.c")
|
||||
|
||||
set(AOM_AV1_ENCODER_INTRIN_AVX2
|
||||
"${AOM_ROOT}/av1/encoder/x86/error_intrin_avx2.c"
|
||||
"${AOM_ROOT}/av1/encoder/x86/hybrid_fwd_txfm_avx2.c")
|
||||
|
||||
set(AOM_AV1_ENCODER_INTRIN_NEON
|
||||
"${AOM_ROOT}/av1/encoder/arm/neon/quantize_neon.c")
|
||||
|
||||
set(AOM_AV1_ENCODER_INTRIN_MSA
|
||||
"${AOM_ROOT}/av1/encoder/mips/msa/error_msa.c"
|
||||
"${AOM_ROOT}/av1/encoder/mips/msa/fdct16x16_msa.c"
|
||||
"${AOM_ROOT}/av1/encoder/mips/msa/fdct4x4_msa.c"
|
||||
"${AOM_ROOT}/av1/encoder/mips/msa/fdct8x8_msa.c"
|
||||
"${AOM_ROOT}/av1/encoder/mips/msa/fdct_msa.h"
|
||||
"${AOM_ROOT}/av1/encoder/mips/msa/temporal_filter_msa.c")
|
||||
|
||||
if (CONFIG_HIGHBITDEPTH)
|
||||
set(AOM_AV1_COMMON_INTRIN_SSE4_1
|
||||
${AOM_AV1_COMMON_INTRIN_SSE4_1}
|
||||
"${AOM_ROOT}/av1/common/x86/av1_highbd_convolve_sse4.c"
|
||||
"${AOM_ROOT}/av1/common/x86/highbd_inv_txfm_sse4.c")
|
||||
|
||||
set(AOM_AV1_COMMON_INTRIN_AVX2
|
||||
${AOM_AV1_COMMON_INTRIN_AVX2}
|
||||
"${AOM_ROOT}/av1/common/x86/highbd_inv_txfm_avx2.c")
|
||||
|
||||
set(AOM_AV1_ENCODER_INTRIN_SSE4_1
|
||||
${AOM_AV1_ENCODER_INTRIN_SSE4_1}
|
||||
"${AOM_ROOT}/av1/encoder/x86/av1_highbd_quantize_sse4.c"
|
||||
"${AOM_ROOT}/av1/encoder/x86/highbd_fwd_txfm_sse4.c")
|
||||
else ()
|
||||
set(AOM_AV1_COMMON_INTRIN_NEON
|
||||
${AOM_AV1_COMMON_INTRIN_NEON}
|
||||
"${AOM_ROOT}/av1/encoder/arm/neon/dct_neon.c"
|
||||
"${AOM_ROOT}/av1/common/arm/neon/iht4x4_add_neon.c"
|
||||
"${AOM_ROOT}/av1/common/arm/neon/iht8x8_add_neon.c")
|
||||
|
||||
set(AOM_AV1_ENCODER_INTRIN_NEON
|
||||
${AOM_AV1_ENCODER_INTRIN_NEON}
|
||||
"${AOM_ROOT}/av1/encoder/arm/neon/error_neon.c")
|
||||
endif ()
|
||||
|
||||
if (CONFIG_CDEF)
|
||||
set(AOM_AV1_COMMON_SOURCES
|
||||
${AOM_AV1_COMMON_SOURCES}
|
||||
"${AOM_ROOT}/av1/common/clpf.c"
|
||||
"${AOM_ROOT}/av1/common/clpf.h"
|
||||
"${AOM_ROOT}/av1/common/clpf_simd.h"
|
||||
"${AOM_ROOT}/av1/common/cdef_simd.h"
|
||||
"${AOM_ROOT}/av1/common/cdef.c"
|
||||
"${AOM_ROOT}/av1/common/cdef.h"
|
||||
"${AOM_ROOT}/av1/common/od_dering.c"
|
||||
"${AOM_ROOT}/av1/common/od_dering.h"
|
||||
"${AOM_ROOT}/av1/common/od_dering_simd.h")
|
||||
|
||||
set(AOM_AV1_ENCODER_SOURCES
|
||||
${AOM_AV1_ENCODER_SOURCES}
|
||||
"${AOM_ROOT}/av1/encoder/pickcdef.c")
|
||||
|
||||
set(AOM_AV1_COMMON_INTRIN_SSE2
|
||||
${AOM_AV1_COMMON_INTRIN_SSE2}
|
||||
"${AOM_ROOT}/av1/common/clpf_sse2.c"
|
||||
"${AOM_ROOT}/av1/common/od_dering_sse2.c")
|
||||
|
||||
set(AOM_AV1_COMMON_INTRIN_SSSE3
|
||||
${AOM_AV1_COMMON_INTRIN_SSSE3}
|
||||
"${AOM_ROOT}/av1/common/clpf_ssse3.c"
|
||||
"${AOM_ROOT}/av1/common/od_dering_ssse3.c")
|
||||
|
||||
set(AOM_AV1_COMMON_INTRIN_SSE4_1
|
||||
${AOM_AV1_COMMON_INTRIN_SSE4_1}
|
||||
"${AOM_ROOT}/av1/common/clpf_sse4.c"
|
||||
"${AOM_ROOT}/av1/common/od_dering_sse4.c")
|
||||
|
||||
set(AOM_AV1_COMMON_INTRIN_NEON
|
||||
${AOM_AV1_COMMON_INTRIN_NEON}
|
||||
"${AOM_ROOT}/av1/common/clpf_neon.c"
|
||||
"${AOM_ROOT}/av1/common/od_dering_neon.c")
|
||||
endif ()
|
||||
|
||||
if (CONFIG_EXT_INTER)
|
||||
set(AOM_AV1_ENCODER_SOURCES
|
||||
${AOM_AV1_ENCODER_SOURCES}
|
||||
"${AOM_ROOT}/av1/encoder/wedge_utils.c")
|
||||
|
||||
set(AOM_AV1_ENCODER_INTRIN_SSE2
|
||||
${AOM_AV1_ENCODER_INTRIN_SSE2}
|
||||
"${AOM_ROOT}/av1/encoder/x86/wedge_utils_sse2.c")
|
||||
endif ()
|
||||
|
||||
if (CONFIG_FILTER_INTRA)
|
||||
set(AOM_AV1_COMMON_INTRIN_SSE4_1
|
||||
${AOM_AV1_COMMON_INTRIN_SSE4_1}
|
||||
"${AOM_ROOT}/av1/common/x86/filterintra_sse4.c")
|
||||
endif ()
|
||||
|
||||
if (CONFIG_ACCOUNTING)
|
||||
set(AOM_AV1_DECODER_SOURCES
|
||||
${AOM_AV1_DECODER_SOURCES}
|
||||
"${AOM_ROOT}/av1/decoder/accounting.c"
|
||||
"${AOM_ROOT}/av1/decoder/accounting.h")
|
||||
endif ()
|
||||
|
||||
if (CONFIG_INSPECTION)
|
||||
set(AOM_AV1_DECODER_SOURCES
|
||||
${AOM_AV1_DECODER_SOURCES}
|
||||
"${AOM_ROOT}/av1/decoder/inspection.c"
|
||||
"${AOM_ROOT}/av1/decoder/inspection.h")
|
||||
endif ()
|
||||
|
||||
if (CONFIG_INTERNAL_STATS)
|
||||
set(AOM_AV1_ENCODER_SOURCES
|
||||
${AOM_AV1_ENCODER_SOURCES}
|
||||
"${AOM_ROOT}/av1/encoder/blockiness.c")
|
||||
endif ()
|
||||
|
||||
if (CONFIG_PALETTE)
|
||||
set(AOM_AV1_ENCODER_SOURCES
|
||||
${AOM_AV1_ENCODER_SOURCES}
|
||||
"${AOM_ROOT}/av1/encoder/palette.c"
|
||||
"${AOM_ROOT}/av1/encoder/palette.h")
|
||||
endif ()
|
||||
|
||||
if (CONFIG_CFL)
|
||||
set(AOM_AV1_COMMON_SOURCES
|
||||
${AOM_AV1_COMMON_SOURCES}
|
||||
"${AOM_ROOT}/av1/common/cfl.c"
|
||||
"${AOM_ROOT}/av1/common/cfl.h")
|
||||
endif ()
|
||||
|
||||
if (CONFIG_PVQ)
|
||||
set(AOM_AV1_COMMON_SOURCES
|
||||
${AOM_AV1_COMMON_SOURCES}
|
||||
"${AOM_ROOT}/av1/common/laplace_tables.c"
|
||||
"${AOM_ROOT}/av1/common/pvq.c"
|
||||
"${AOM_ROOT}/av1/common/pvq.h"
|
||||
"${AOM_ROOT}/av1/common/pvq_state.c"
|
||||
"${AOM_ROOT}/av1/common/pvq_state.h"
|
||||
"${AOM_ROOT}/av1/common/partition.c"
|
||||
"${AOM_ROOT}/av1/common/partition.h"
|
||||
"${AOM_ROOT}/av1/common/generic_code.c"
|
||||
"${AOM_ROOT}/av1/common/generic_code.h"
|
||||
"${AOM_ROOT}/av1/common/zigzag4.c"
|
||||
"${AOM_ROOT}/av1/common/zigzag8.c"
|
||||
"${AOM_ROOT}/av1/common/zigzag16.c"
|
||||
"${AOM_ROOT}/av1/common/zigzag32.c")
|
||||
|
||||
set(AOM_AV1_DECODER_SOURCES
|
||||
${AOM_AV1_DECODER_SOURCES}
|
||||
"${AOM_ROOT}/av1/decoder/decint.h"
|
||||
"${AOM_ROOT}/av1/decoder/pvq_decoder.c"
|
||||
"${AOM_ROOT}/av1/decoder/pvq_decoder.h"
|
||||
"${AOM_ROOT}/av1/decoder/generic_decoder.c"
|
||||
"${AOM_ROOT}/av1/decoder/laplace_decoder.c")
|
||||
|
||||
set(AOM_AV1_ENCODER_SOURCES
|
||||
${AOM_AV1_ENCODER_SOURCES}
|
||||
"${AOM_ROOT}/av1/encoder/daala_compat_enc.c"
|
||||
"${AOM_ROOT}/av1/encoder/encint.h"
|
||||
"${AOM_ROOT}/av1/encoder/pvq_encoder.c"
|
||||
"${AOM_ROOT}/av1/encoder/pvq_encoder.h"
|
||||
"${AOM_ROOT}/av1/encoder/generic_encoder.c"
|
||||
"${AOM_ROOT}/av1/encoder/laplace_encoder.c")
|
||||
|
||||
set(AOM_AV1_COMMON_INTRIN_SSE4_1
|
||||
${AOM_AV1_COMMON_INTRIN_SSE4_1}
|
||||
"${AOM_ROOT}/av1/common/x86/pvq_sse4.c"
|
||||
"${AOM_ROOT}/av1/common/x86/pvq_sse4.h")
|
||||
|
||||
if (NOT CONFIG_AV1_ENCODER)
|
||||
# TODO(tomfinegan): These should probably be in av1/common, and in a
|
||||
# common source list. For now this mirrors the original build system.
|
||||
set(AOM_AV1_DECODER_SOURCES
|
||||
${AOM_AV1_DECODER_SOURCES}
|
||||
"${AOM_ROOT}/av1/encoder/dct.c"
|
||||
"${AOM_ROOT}/av1/encoder/hybrid_fwd_txfm.c"
|
||||
"${AOM_ROOT}/av1/encoder/hybrid_fwd_txfm.h")
|
||||
|
||||
set(AOM_AV1_DECODER_ASM_SSE2
|
||||
${AOM_AV1_DECODER_ASM_SSE2}
|
||||
"${AOM_ROOT}/av1/encoder/x86/dct_sse2.asm")
|
||||
|
||||
set(AOM_AV1_DECODER_INTRIN_SSE2
|
||||
${AOM_AV1_DECODER_INTRIN_SSE2}
|
||||
"${AOM_ROOT}/av1/encoder/x86/dct_intrin_sse2.c")
|
||||
|
||||
set(AOM_AV1_DECODER_INTRIN_SSSE3
|
||||
${AOM_AV1_DECODER_INTRIN_SSSE3}
|
||||
"${AOM_ROOT}/av1/encoder/x86/dct_ssse3.c")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (CONFIG_WARPED_MOTION)
|
||||
set(AOM_AV1_COMMON_SOURCES
|
||||
${AOM_AV1_COMMON_SOURCES}
|
||||
"${AOM_ROOT}/av1/common/warped_motion.c"
|
||||
"${AOM_ROOT}/av1/common/warped_motion.h")
|
||||
|
||||
set(AOM_AV1_COMMON_INTRIN_SSE2
|
||||
${AOM_AV1_COMMON_INTRIN_SSE2}
|
||||
"${AOM_ROOT}/av1/common/x86/warp_plane_sse2.c")
|
||||
endif ()
|
||||
|
||||
# Setup AV1 common/decoder/encoder targets. The libaom target must exist before
|
||||
# this function is called.
|
||||
function (setup_av1_targets)
|
||||
add_library(aom_av1_common OBJECT ${AOM_AV1_COMMON_SOURCES})
|
||||
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_av1_common)
|
||||
target_sources(aom PUBLIC $<TARGET_OBJECTS:aom_av1_common>)
|
||||
|
||||
if (CONFIG_AV1_DECODER)
|
||||
add_library(aom_av1_decoder OBJECT ${AOM_AV1_DECODER_SOURCES})
|
||||
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_av1_decoder)
|
||||
target_sources(aom PUBLIC $<TARGET_OBJECTS:aom_av1_decoder>)
|
||||
endif ()
|
||||
|
||||
if (CONFIG_AV1_ENCODER)
|
||||
add_library(aom_av1_encoder OBJECT ${AOM_AV1_ENCODER_SOURCES})
|
||||
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_av1_encoder)
|
||||
target_sources(aom PUBLIC $<TARGET_OBJECTS:aom_av1_encoder>)
|
||||
endif ()
|
||||
|
||||
if (HAVE_SSE2)
|
||||
require_flag_nomsvc("-msse2" NO)
|
||||
add_intrinsics_object_library("-msse2" "sse2" "aom_av1_common"
|
||||
"AOM_AV1_COMMON_INTRIN_SSE2")
|
||||
if (CONFIG_AV1_DECODER)
|
||||
if (AOM_AV1_DECODER_ASM_SSE2)
|
||||
add_asm_library("aom_av1_decoder_sse2" "AOM_AV1_DECODER_ASM_SSE2" "aom")
|
||||
endif ()
|
||||
|
||||
if (AOM_AV1_DECODER_INTRIN_SSE2)
|
||||
add_intrinsics_object_library("-msse2" "sse2" "aom_av1_decoder"
|
||||
"AOM_AV1_DECODER_INTRIN_SSE2")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (CONFIG_AV1_ENCODER)
|
||||
add_asm_library("aom_av1_encoder_sse2" "AOM_AV1_ENCODER_ASM_SSE2" "aom")
|
||||
add_intrinsics_object_library("-msse2" "sse2" "aom_av1_encoder"
|
||||
"AOM_AV1_ENCODER_INTRIN_SSE2")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (HAVE_SSSE3)
|
||||
require_flag_nomsvc("-mssse3" NO)
|
||||
add_intrinsics_object_library("-mssse3" "ssse3" "aom_av1_common"
|
||||
"AOM_AV1_COMMON_INTRIN_SSSE3")
|
||||
|
||||
if (CONFIG_AV1_DECODER)
|
||||
if (AOM_AV1_DECODER_INTRIN_SSSE3)
|
||||
add_intrinsics_object_library("-mssse3" "ssse3" "aom_av1_decoder"
|
||||
"AOM_AV1_DECODER_INTRIN_SSSE3")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (CONFIG_AV1_ENCODER)
|
||||
add_intrinsics_object_library("-mssse3" "ssse3" "aom_av1_encoder"
|
||||
"AOM_AV1_ENCODER_INTRIN_SSSE3")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (HAVE_SSE4_1)
|
||||
require_flag_nomsvc("-msse4.1" NO)
|
||||
add_intrinsics_object_library("-msse4.1" "sse4" "aom_av1_common"
|
||||
"AOM_AV1_COMMON_INTRIN_SSE4_1")
|
||||
|
||||
if (CONFIG_AV1_ENCODER)
|
||||
if ("${AOM_TARGET_CPU}" STREQUAL "x86_64")
|
||||
add_asm_library("aom_av1_encoder_ssse3"
|
||||
"AOM_AV1_ENCODER_ASM_SSSE3_X86_64" "aom")
|
||||
endif ()
|
||||
|
||||
if (AOM_AV1_ENCODER_INTRIN_SSE4_1)
|
||||
add_intrinsics_object_library("-msse4.1" "sse4" "aom_av1_encoder"
|
||||
"AOM_AV1_ENCODER_INTRIN_SSE4_1")
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (HAVE_AVX2)
|
||||
require_flag_nomsvc("-mavx2" NO)
|
||||
add_intrinsics_object_library("-mavx2" "avx2" "aom_av1_common"
|
||||
"AOM_AV1_COMMON_INTRIN_AVX2")
|
||||
|
||||
if (CONFIG_AV1_ENCODER)
|
||||
add_intrinsics_object_library("-mavx2" "avx2" "aom_av1_encoder"
|
||||
"AOM_AV1_ENCODER_INTRIN_AVX2")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (HAVE_NEON)
|
||||
if (AOM_AV1_COMMON_INTRIN_NEON)
|
||||
add_intrinsics_object_library("${AOM_INTRIN_NEON_FLAG}"
|
||||
"neon"
|
||||
"aom_av1_common"
|
||||
"AOM_AV1_COMMON_INTRIN_NEON")
|
||||
endif ()
|
||||
|
||||
if (AOM_AV1_ENCODER_INTRIN_NEON)
|
||||
add_intrinsics_object_library("${AOM_INTRIN_NEON_FLAG}"
|
||||
"neon"
|
||||
"aom_av1_encoder"
|
||||
"AOM_AV1_ENCODER_INTRIN_NEON")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (HAVE_DSPR2)
|
||||
add_intrinsics_object_library("" "dspr2" "aom_av1_common"
|
||||
"AOM_AV1_COMMON_INTRIN_DSPR2")
|
||||
endif ()
|
||||
|
||||
if (HAVE_MSA)
|
||||
add_intrinsics_object_library("" "msa" "aom_av1_common"
|
||||
"AOM_AV1_COMMON_INTRIN_MSA")
|
||||
add_intrinsics_object_library("" "msa" "aom_av1_encoder"
|
||||
"AOM_AV1_ENCODER_INTRIN_MSA")
|
||||
endif ()
|
||||
|
||||
# Pass the new lib targets up to the parent scope instance of
|
||||
# $AOM_LIB_TARGETS.
|
||||
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
function (setup_av1_test_targets)
|
||||
endfunction ()
|
||||
180
third_party/aom/av1/av1_common.mk
vendored
Normal file
180
third_party/aom/av1/av1_common.mk
vendored
Normal file
|
|
@ -0,0 +1,180 @@
|
|||
##
|
||||
## 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.
|
||||
##
|
||||
|
||||
AV1_COMMON_SRCS-yes += av1_common.mk
|
||||
AV1_COMMON_SRCS-yes += av1_iface_common.h
|
||||
AV1_COMMON_SRCS-yes += common/alloccommon.c
|
||||
AV1_COMMON_SRCS-yes += common/av1_loopfilter.c
|
||||
AV1_COMMON_SRCS-yes += common/av1_loopfilter.h
|
||||
AV1_COMMON_SRCS-yes += common/blockd.c
|
||||
AV1_COMMON_SRCS-yes += common/debugmodes.c
|
||||
AV1_COMMON_SRCS-yes += common/entropy.c
|
||||
AV1_COMMON_SRCS-yes += common/entropymode.c
|
||||
AV1_COMMON_SRCS-yes += common/entropymv.c
|
||||
AV1_COMMON_SRCS-yes += common/frame_buffers.c
|
||||
AV1_COMMON_SRCS-yes += common/frame_buffers.h
|
||||
AV1_COMMON_SRCS-yes += common/alloccommon.h
|
||||
AV1_COMMON_SRCS-yes += common/blockd.h
|
||||
AV1_COMMON_SRCS-yes += common/common.h
|
||||
AV1_COMMON_SRCS-yes += common/entropy.h
|
||||
AV1_COMMON_SRCS-yes += common/entropymode.h
|
||||
AV1_COMMON_SRCS-yes += common/entropymv.h
|
||||
AV1_COMMON_SRCS-yes += common/enums.h
|
||||
AV1_COMMON_SRCS-yes += common/filter.h
|
||||
AV1_COMMON_SRCS-yes += common/filter.c
|
||||
AV1_COMMON_SRCS-yes += common/idct.h
|
||||
AV1_COMMON_SRCS-yes += common/idct.c
|
||||
AV1_COMMON_SRCS-yes += common/thread_common.h
|
||||
AV1_COMMON_SRCS-$(CONFIG_LV_MAP) += common/txb_common.h
|
||||
AV1_COMMON_SRCS-$(CONFIG_LV_MAP) += common/txb_common.c
|
||||
AV1_COMMON_SRCS-yes += common/mv.h
|
||||
AV1_COMMON_SRCS-yes += common/onyxc_int.h
|
||||
AV1_COMMON_SRCS-yes += common/pred_common.h
|
||||
AV1_COMMON_SRCS-yes += common/pred_common.c
|
||||
AV1_COMMON_SRCS-yes += common/quant_common.h
|
||||
AV1_COMMON_SRCS-yes += common/reconinter.h
|
||||
AV1_COMMON_SRCS-yes += common/reconintra.h
|
||||
AV1_COMMON_SRCS-yes += common/av1_rtcd.c
|
||||
AV1_COMMON_SRCS-yes += common/av1_rtcd_defs.pl
|
||||
AV1_COMMON_SRCS-yes += common/scale.h
|
||||
AV1_COMMON_SRCS-yes += common/scale.c
|
||||
AV1_COMMON_SRCS-yes += common/seg_common.h
|
||||
AV1_COMMON_SRCS-yes += common/seg_common.c
|
||||
AV1_COMMON_SRCS-yes += common/tile_common.h
|
||||
AV1_COMMON_SRCS-yes += common/tile_common.c
|
||||
AV1_COMMON_SRCS-yes += common/thread_common.c
|
||||
AV1_COMMON_SRCS-yes += common/mvref_common.c
|
||||
AV1_COMMON_SRCS-yes += common/mvref_common.h
|
||||
AV1_COMMON_SRCS-yes += common/quant_common.c
|
||||
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
|
||||
# TODO(angiebird) the forward transform belongs under encoder/
|
||||
AV1_COMMON_SRCS-yes += common/av1_txfm.h
|
||||
AV1_COMMON_SRCS-yes += common/av1_fwd_txfm1d.h
|
||||
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_inv_txfm2d.c
|
||||
AV1_COMMON_SRCS-yes += common/av1_inv_txfm2d_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
|
||||
endif
|
||||
AV1_COMMON_SRCS-yes += common/convolve.c
|
||||
AV1_COMMON_SRCS-yes += common/convolve.h
|
||||
ifeq ($(CONFIG_LOOP_RESTORATION),yes)
|
||||
AV1_COMMON_SRCS-yes += common/restoration.h
|
||||
AV1_COMMON_SRCS-yes += common/restoration.c
|
||||
AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/selfguided_sse4.c
|
||||
endif
|
||||
ifeq (yes,$(filter $(CONFIG_GLOBAL_MOTION) $(CONFIG_WARPED_MOTION),yes))
|
||||
AV1_COMMON_SRCS-yes += common/warped_motion.h
|
||||
AV1_COMMON_SRCS-yes += common/warped_motion.c
|
||||
endif
|
||||
ifeq ($(CONFIG_CDEF),yes)
|
||||
AV1_COMMON_SRCS-yes += common/clpf.c
|
||||
AV1_COMMON_SRCS-yes += common/clpf.h
|
||||
AV1_COMMON_SRCS-yes += common/clpf_simd.h
|
||||
AV1_COMMON_SRCS-yes += common/cdef_simd.h
|
||||
AV1_COMMON_SRCS-$(HAVE_SSE2) += common/clpf_sse2.c
|
||||
AV1_COMMON_SRCS-$(HAVE_SSSE3) += common/clpf_ssse3.c
|
||||
AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/clpf_sse4.c
|
||||
AV1_COMMON_SRCS-$(HAVE_NEON) += common/clpf_neon.c
|
||||
AV1_COMMON_SRCS-$(HAVE_SSE2) += common/od_dering_sse2.c
|
||||
AV1_COMMON_SRCS-$(HAVE_SSSE3) += common/od_dering_ssse3.c
|
||||
AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/od_dering_sse4.c
|
||||
AV1_COMMON_SRCS-$(HAVE_NEON) += common/od_dering_neon.c
|
||||
AV1_COMMON_SRCS-yes += common/od_dering.c
|
||||
AV1_COMMON_SRCS-yes += common/od_dering.h
|
||||
AV1_COMMON_SRCS-yes += common/od_dering_simd.h
|
||||
AV1_COMMON_SRCS-yes += common/cdef.c
|
||||
AV1_COMMON_SRCS-yes += common/cdef.h
|
||||
endif
|
||||
AV1_COMMON_SRCS-yes += common/odintrin.c
|
||||
AV1_COMMON_SRCS-yes += common/odintrin.h
|
||||
|
||||
ifeq ($(CONFIG_CFL),yes)
|
||||
AV1_COMMON_SRCS-yes += common/cfl.h
|
||||
AV1_COMMON_SRCS-yes += common/cfl.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PVQ),yes)
|
||||
# PVQ from daala
|
||||
AV1_COMMON_SRCS-yes += common/pvq.c
|
||||
AV1_COMMON_SRCS-yes += common/partition.c
|
||||
AV1_COMMON_SRCS-yes += common/partition.h
|
||||
AV1_COMMON_SRCS-yes += common/zigzag4.c
|
||||
AV1_COMMON_SRCS-yes += common/zigzag8.c
|
||||
AV1_COMMON_SRCS-yes += common/zigzag16.c
|
||||
AV1_COMMON_SRCS-yes += common/zigzag32.c
|
||||
AV1_COMMON_SRCS-yes += common/zigzag.h
|
||||
AV1_COMMON_SRCS-yes += common/generic_code.c
|
||||
AV1_COMMON_SRCS-yes += common/pvq_state.c
|
||||
AV1_COMMON_SRCS-yes += common/laplace_tables.c
|
||||
AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/pvq_sse4.c
|
||||
AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/pvq_sse4.h
|
||||
endif
|
||||
ifneq ($(findstring yes,$(CONFIG_PVQ)$(CONFIG_DAALA_DIST)$(CONFIG_XIPHRC)),)
|
||||
AV1_COMMON_SRCS-yes += common/pvq.h
|
||||
AV1_COMMON_SRCS-yes += common/pvq_state.h
|
||||
AV1_COMMON_SRCS-yes += common/generic_code.h
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_HIGHBITDEPTH),yes)
|
||||
AV1_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/av1_itrans4_dspr2.c
|
||||
AV1_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/av1_itrans8_dspr2.c
|
||||
AV1_COMMON_SRCS-$(HAVE_DSPR2) += common/mips/dspr2/av1_itrans16_dspr2.c
|
||||
endif
|
||||
|
||||
# common (msa)
|
||||
AV1_COMMON_SRCS-$(HAVE_MSA) += common/mips/msa/av1_idct4x4_msa.c
|
||||
AV1_COMMON_SRCS-$(HAVE_MSA) += common/mips/msa/av1_idct8x8_msa.c
|
||||
AV1_COMMON_SRCS-$(HAVE_MSA) += common/mips/msa/av1_idct16x16_msa.c
|
||||
|
||||
AV1_COMMON_SRCS-$(HAVE_SSE2) += common/x86/idct_intrin_sse2.c
|
||||
AV1_COMMON_SRCS-$(HAVE_AVX2) += common/x86/hybrid_inv_txfm_avx2.c
|
||||
|
||||
ifeq ($(CONFIG_AV1_ENCODER),yes)
|
||||
AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/av1_txfm1d_sse4.h
|
||||
AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/av1_fwd_txfm1d_sse4.c
|
||||
AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/av1_fwd_txfm2d_sse4.c
|
||||
endif
|
||||
ifeq ($(CONFIG_HIGHBITDEPTH),yes)
|
||||
AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/highbd_txfm_utility_sse4.h
|
||||
AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/highbd_inv_txfm_sse4.c
|
||||
AV1_COMMON_SRCS-$(HAVE_AVX2) += common/x86/highbd_inv_txfm_avx2.c
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_HIGHBITDEPTH),yes)
|
||||
AV1_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/iht4x4_add_neon.c
|
||||
AV1_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/iht8x8_add_neon.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_FILTER_INTRA),yes)
|
||||
AV1_COMMON_SRCS-$(HAVE_SSE4_1) += common/x86/filterintra_sse4.c
|
||||
endif
|
||||
|
||||
ifneq ($(findstring yes,$(CONFIG_GLOBAL_MOTION) $(CONFIG_WARPED_MOTION)),)
|
||||
AV1_COMMON_SRCS-$(HAVE_SSE2) += common/x86/warp_plane_sse2.c
|
||||
ifeq ($(CONFIG_HIGHBITDEPTH),yes)
|
||||
AV1_COMMON_SRCS-$(HAVE_SSSE3) += common/x86/highbd_warp_plane_ssse3.c
|
||||
endif
|
||||
endif
|
||||
|
||||
$(eval $(call rtcd_h_template,av1_rtcd,av1/common/av1_rtcd_defs.pl))
|
||||
165
third_party/aom/av1/av1_cx.mk
vendored
Normal file
165
third_party/aom/av1/av1_cx.mk
vendored
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
##
|
||||
## 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.
|
||||
##
|
||||
|
||||
AV1_CX_EXPORTS += exports_enc
|
||||
|
||||
AV1_CX_SRCS-yes += $(AV1_COMMON_SRCS-yes)
|
||||
AV1_CX_SRCS-no += $(AV1_COMMON_SRCS-no)
|
||||
AV1_CX_SRCS_REMOVE-yes += $(AV1_COMMON_SRCS_REMOVE-yes)
|
||||
AV1_CX_SRCS_REMOVE-no += $(AV1_COMMON_SRCS_REMOVE-no)
|
||||
|
||||
AV1_CX_SRCS-yes += av1_cx_iface.c
|
||||
|
||||
AV1_CX_SRCS-yes += encoder/av1_quantize.c
|
||||
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
|
||||
AV1_CX_SRCS-yes += encoder/hybrid_fwd_txfm.c
|
||||
AV1_CX_SRCS-yes += encoder/hybrid_fwd_txfm.h
|
||||
AV1_CX_SRCS-yes += encoder/encodeframe.c
|
||||
AV1_CX_SRCS-yes += encoder/encodeframe.h
|
||||
AV1_CX_SRCS-yes += encoder/encodemb.c
|
||||
AV1_CX_SRCS-yes += encoder/encodemv.c
|
||||
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-$(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
|
||||
AV1_CX_SRCS-$(CONFIG_GLOBAL_MOTION) += ../third_party/fastfeat/fast.c
|
||||
AV1_CX_SRCS-$(CONFIG_GLOBAL_MOTION) += encoder/corner_match.c
|
||||
AV1_CX_SRCS-$(CONFIG_GLOBAL_MOTION) += encoder/corner_match.h
|
||||
AV1_CX_SRCS-$(CONFIG_GLOBAL_MOTION) += encoder/corner_detect.c
|
||||
AV1_CX_SRCS-$(CONFIG_GLOBAL_MOTION) += encoder/corner_detect.h
|
||||
AV1_CX_SRCS-$(CONFIG_GLOBAL_MOTION) += encoder/global_motion.c
|
||||
AV1_CX_SRCS-$(CONFIG_GLOBAL_MOTION) += encoder/global_motion.h
|
||||
AV1_CX_SRCS-$(CONFIG_GLOBAL_MOTION) += encoder/ransac.c
|
||||
AV1_CX_SRCS-$(CONFIG_GLOBAL_MOTION) += encoder/ransac.h
|
||||
AV1_CX_SRCS-yes += encoder/block.h
|
||||
AV1_CX_SRCS-yes += encoder/bitstream.h
|
||||
AV1_CX_SRCS-yes += encoder/encodemb.h
|
||||
AV1_CX_SRCS-yes += encoder/encodemv.h
|
||||
AV1_CX_SRCS-$(CONFIG_LV_MAP) += encoder/encodetxb.c
|
||||
AV1_CX_SRCS-$(CONFIG_LV_MAP) += encoder/encodetxb.h
|
||||
AV1_CX_SRCS-yes += encoder/extend.h
|
||||
AV1_CX_SRCS-yes += encoder/firstpass.h
|
||||
AV1_CX_SRCS-yes += encoder/lookahead.c
|
||||
AV1_CX_SRCS-yes += encoder/lookahead.h
|
||||
AV1_CX_SRCS-yes += encoder/mcomp.h
|
||||
AV1_CX_SRCS-yes += encoder/encoder.h
|
||||
AV1_CX_SRCS-yes += encoder/ratectrl.h
|
||||
ifeq ($(CONFIG_XIPHRC),yes)
|
||||
AV1_CX_SRCS-yes += encoder/ratectrl_xiph.h
|
||||
endif
|
||||
AV1_CX_SRCS-yes += encoder/rd.h
|
||||
AV1_CX_SRCS-yes += encoder/rdopt.h
|
||||
AV1_CX_SRCS-yes += encoder/tokenize.h
|
||||
AV1_CX_SRCS-yes += encoder/treewriter.h
|
||||
AV1_CX_SRCS-yes += encoder/mcomp.c
|
||||
AV1_CX_SRCS-yes += encoder/encoder.c
|
||||
ifeq ($(CONFIG_PALETTE),yes)
|
||||
AV1_CX_SRCS-yes += encoder/palette.h
|
||||
AV1_CX_SRCS-yes += encoder/palette.c
|
||||
endif
|
||||
AV1_CX_SRCS-yes += encoder/picklpf.c
|
||||
AV1_CX_SRCS-yes += encoder/picklpf.h
|
||||
AV1_CX_SRCS-$(CONFIG_LOOP_RESTORATION) += encoder/pickrst.c
|
||||
AV1_CX_SRCS-$(CONFIG_LOOP_RESTORATION) += encoder/pickrst.h
|
||||
AV1_CX_SRCS-yes += encoder/ratectrl.c
|
||||
ifeq ($(CONFIG_XIPHRC),yes)
|
||||
AV1_CX_SRCS-yes += encoder/ratectrl_xiph.c
|
||||
endif
|
||||
AV1_CX_SRCS-yes += encoder/rd.c
|
||||
AV1_CX_SRCS-yes += encoder/rdopt.c
|
||||
AV1_CX_SRCS-yes += encoder/segmentation.c
|
||||
AV1_CX_SRCS-yes += encoder/segmentation.h
|
||||
AV1_CX_SRCS-yes += encoder/speed_features.c
|
||||
AV1_CX_SRCS-yes += encoder/speed_features.h
|
||||
AV1_CX_SRCS-yes += encoder/subexp.c
|
||||
AV1_CX_SRCS-yes += encoder/subexp.h
|
||||
AV1_CX_SRCS-$(CONFIG_INTERNAL_STATS) += encoder/blockiness.c
|
||||
|
||||
AV1_CX_SRCS-yes += encoder/tokenize.c
|
||||
AV1_CX_SRCS-yes += encoder/treewriter.c
|
||||
AV1_CX_SRCS-yes += encoder/aq_variance.c
|
||||
AV1_CX_SRCS-yes += encoder/aq_variance.h
|
||||
AV1_CX_SRCS-yes += encoder/aq_cyclicrefresh.c
|
||||
AV1_CX_SRCS-yes += encoder/aq_cyclicrefresh.h
|
||||
AV1_CX_SRCS-yes += encoder/aq_complexity.c
|
||||
AV1_CX_SRCS-yes += encoder/aq_complexity.h
|
||||
AV1_CX_SRCS-yes += encoder/temporal_filter.c
|
||||
AV1_CX_SRCS-yes += encoder/temporal_filter.h
|
||||
AV1_CX_SRCS-yes += encoder/mbgraph.c
|
||||
AV1_CX_SRCS-yes += encoder/mbgraph.h
|
||||
ifeq ($(CONFIG_CDEF),yes)
|
||||
AV1_CX_SRCS-yes += encoder/pickcdef.c
|
||||
endif
|
||||
ifeq ($(CONFIG_PVQ),yes)
|
||||
# PVQ from daala
|
||||
AV1_CX_SRCS-yes += encoder/daala_compat_enc.c
|
||||
AV1_CX_SRCS-yes += encoder/pvq_encoder.c
|
||||
AV1_CX_SRCS-yes += encoder/pvq_encoder.h
|
||||
AV1_CX_SRCS-yes += encoder/generic_encoder.c
|
||||
AV1_CX_SRCS-yes += encoder/laplace_encoder.c
|
||||
endif
|
||||
ifneq ($(findstring yes,$(CONFIG_XIPHRC)$(CONFIG_PVQ)),)
|
||||
AV1_CX_SRCS-yes += encoder/encint.h
|
||||
endif
|
||||
|
||||
AV1_CX_SRCS-$(HAVE_SSE2) += encoder/x86/av1_quantize_sse2.c
|
||||
AV1_CX_SRCS-$(HAVE_SSE2) += encoder/x86/temporal_filter_apply_sse2.asm
|
||||
ifeq ($(CONFIG_HIGHBITDEPTH),yes)
|
||||
AV1_CX_SRCS-$(HAVE_SSE2) += encoder/x86/highbd_block_error_intrin_sse2.c
|
||||
endif
|
||||
|
||||
AV1_CX_SRCS-$(HAVE_SSE2) += encoder/x86/dct_sse2.asm
|
||||
AV1_CX_SRCS-$(HAVE_SSE2) += encoder/x86/error_sse2.asm
|
||||
|
||||
ifeq ($(ARCH_X86_64),yes)
|
||||
AV1_CX_SRCS-$(HAVE_SSSE3) += encoder/x86/av1_quantize_ssse3_x86_64.asm
|
||||
endif
|
||||
|
||||
AV1_CX_SRCS-$(HAVE_SSE2) += encoder/x86/dct_intrin_sse2.c
|
||||
AV1_CX_SRCS-$(HAVE_SSSE3) += encoder/x86/dct_ssse3.c
|
||||
AV1_CX_SRCS-$(HAVE_AVX2) += encoder/x86/hybrid_fwd_txfm_avx2.c
|
||||
ifeq ($(CONFIG_HIGHBITDEPTH),yes)
|
||||
AV1_CX_SRCS-$(HAVE_SSE4_1) += encoder/x86/av1_highbd_quantize_sse4.c
|
||||
AV1_CX_SRCS-$(HAVE_SSE4_1) += encoder/x86/highbd_fwd_txfm_sse4.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EXT_INTER),yes)
|
||||
AV1_CX_SRCS-yes += encoder/wedge_utils.c
|
||||
AV1_CX_SRCS-$(HAVE_SSE2) += encoder/x86/wedge_utils_sse2.c
|
||||
endif
|
||||
|
||||
AV1_CX_SRCS-$(HAVE_AVX2) += encoder/x86/error_intrin_avx2.c
|
||||
|
||||
ifneq ($(CONFIG_HIGHBITDEPTH),yes)
|
||||
AV1_CX_SRCS-$(HAVE_NEON) += encoder/arm/neon/dct_neon.c
|
||||
AV1_CX_SRCS-$(HAVE_NEON) += encoder/arm/neon/error_neon.c
|
||||
endif
|
||||
AV1_CX_SRCS-$(HAVE_NEON) += encoder/arm/neon/quantize_neon.c
|
||||
|
||||
AV1_CX_SRCS-$(HAVE_MSA) += encoder/mips/msa/error_msa.c
|
||||
AV1_CX_SRCS-$(HAVE_MSA) += encoder/mips/msa/fdct4x4_msa.c
|
||||
AV1_CX_SRCS-$(HAVE_MSA) += encoder/mips/msa/fdct8x8_msa.c
|
||||
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
|
||||
|
||||
AV1_CX_SRCS-yes := $(filter-out $(AV1_CX_SRCS_REMOVE-yes),$(AV1_CX_SRCS-yes))
|
||||
1605
third_party/aom/av1/av1_cx_iface.c
vendored
Normal file
1605
third_party/aom/av1/av1_cx_iface.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
71
third_party/aom/av1/av1_dx.mk
vendored
Normal file
71
third_party/aom/av1/av1_dx.mk
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
##
|
||||
## 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.
|
||||
##
|
||||
|
||||
AV1_DX_EXPORTS += exports_dec
|
||||
|
||||
AV1_DX_SRCS-yes += $(AV1_COMMON_SRCS-yes)
|
||||
AV1_DX_SRCS-no += $(AV1_COMMON_SRCS-no)
|
||||
AV1_DX_SRCS_REMOVE-yes += $(AV1_COMMON_SRCS_REMOVE-yes)
|
||||
AV1_DX_SRCS_REMOVE-no += $(AV1_COMMON_SRCS_REMOVE-no)
|
||||
|
||||
AV1_DX_SRCS-yes += av1_dx_iface.c
|
||||
|
||||
AV1_DX_SRCS-yes += decoder/decodemv.c
|
||||
AV1_DX_SRCS-yes += decoder/decodeframe.c
|
||||
AV1_DX_SRCS-yes += decoder/decodeframe.h
|
||||
AV1_DX_SRCS-yes += decoder/detokenize.c
|
||||
AV1_DX_SRCS-yes += decoder/decodemv.h
|
||||
AV1_DX_SRCS-$(CONFIG_LV_MAP) += decoder/decodetxb.c
|
||||
AV1_DX_SRCS-$(CONFIG_LV_MAP) += decoder/decodetxb.h
|
||||
AV1_DX_SRCS-yes += decoder/detokenize.h
|
||||
AV1_DX_SRCS-yes += decoder/dthread.c
|
||||
AV1_DX_SRCS-yes += decoder/dthread.h
|
||||
AV1_DX_SRCS-yes += decoder/decoder.c
|
||||
AV1_DX_SRCS-yes += decoder/decoder.h
|
||||
AV1_DX_SRCS-yes += decoder/dsubexp.c
|
||||
AV1_DX_SRCS-yes += decoder/dsubexp.h
|
||||
|
||||
ifeq ($(CONFIG_ACCOUNTING),yes)
|
||||
AV1_DX_SRCS-yes += decoder/accounting.h
|
||||
AV1_DX_SRCS-yes += decoder/accounting.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_INSPECTION),yes)
|
||||
AV1_DX_SRCS-yes += decoder/inspection.c
|
||||
AV1_DX_SRCS-yes += decoder/inspection.h
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PVQ),yes)
|
||||
# PVQ from daala
|
||||
AV1_DX_SRCS-yes += decoder/pvq_decoder.c
|
||||
AV1_DX_SRCS-yes += decoder/pvq_decoder.h
|
||||
AV1_DX_SRCS-yes += decoder/decint.h
|
||||
AV1_DX_SRCS-yes += decoder/generic_decoder.c
|
||||
AV1_DX_SRCS-yes += decoder/laplace_decoder.c
|
||||
AV1_DX_SRCS-yes += encoder/hybrid_fwd_txfm.c
|
||||
AV1_DX_SRCS-yes += encoder/hybrid_fwd_txfm.h
|
||||
|
||||
AV1_DX_SRCS-yes += encoder/dct.c
|
||||
AV1_DX_SRCS-$(HAVE_SSE2) += encoder/x86/dct_sse2.asm
|
||||
AV1_DX_SRCS-$(HAVE_SSE2) += encoder/x86/dct_intrin_sse2.c
|
||||
AV1_DX_SRCS-$(HAVE_SSSE3) += encoder/x86/dct_ssse3.c
|
||||
|
||||
ifneq ($(CONFIG_HIGHBITDEPTH),yes)
|
||||
AV1_DX_SRCS-$(HAVE_NEON) += encoder/arm/neon/dct_neon.c
|
||||
endif
|
||||
|
||||
AV1_DX_SRCS-$(HAVE_MSA) += encoder/mips/msa/fdct4x4_msa.c
|
||||
AV1_DX_SRCS-$(HAVE_MSA) += encoder/mips/msa/fdct8x8_msa.c
|
||||
AV1_DX_SRCS-$(HAVE_MSA) += encoder/mips/msa/fdct16x16_msa.c
|
||||
AV1_DX_SRCS-$(HAVE_MSA) += encoder/mips/msa/fdct_msa.h
|
||||
endif
|
||||
|
||||
AV1_DX_SRCS-yes := $(filter-out $(AV1_DX_SRCS_REMOVE-yes),$(AV1_DX_SRCS-yes))
|
||||
1223
third_party/aom/av1/av1_dx_iface.c
vendored
Normal file
1223
third_party/aom/av1/av1_dx_iface.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
146
third_party/aom/av1/av1_iface_common.h
vendored
Normal file
146
third_party/aom/av1/av1_iface_common.h
vendored
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
/*
|
||||
* 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_AV1_IFACE_COMMON_H_
|
||||
#define AV1_AV1_IFACE_COMMON_H_
|
||||
|
||||
#include "aom_ports/mem.h"
|
||||
|
||||
static void yuvconfig2image(aom_image_t *img, const YV12_BUFFER_CONFIG *yv12,
|
||||
void *user_priv) {
|
||||
/** aom_img_wrap() doesn't allow specifying independent strides for
|
||||
* the Y, U, and V planes, nor other alignment adjustments that
|
||||
* might be representable by a YV12_BUFFER_CONFIG, so we just
|
||||
* initialize all the fields.*/
|
||||
int bps;
|
||||
if (!yv12->subsampling_y) {
|
||||
if (!yv12->subsampling_x) {
|
||||
img->fmt = AOM_IMG_FMT_I444;
|
||||
bps = 24;
|
||||
} else {
|
||||
img->fmt = AOM_IMG_FMT_I422;
|
||||
bps = 16;
|
||||
}
|
||||
} else {
|
||||
if (!yv12->subsampling_x) {
|
||||
img->fmt = AOM_IMG_FMT_I440;
|
||||
bps = 16;
|
||||
} else {
|
||||
img->fmt = AOM_IMG_FMT_I420;
|
||||
bps = 12;
|
||||
}
|
||||
}
|
||||
img->cs = yv12->color_space;
|
||||
img->range = yv12->color_range;
|
||||
img->bit_depth = 8;
|
||||
img->w = yv12->y_stride;
|
||||
img->h = ALIGN_POWER_OF_TWO(yv12->y_height + 2 * AOM_BORDER_IN_PIXELS, 3);
|
||||
img->d_w = yv12->y_crop_width;
|
||||
img->d_h = yv12->y_crop_height;
|
||||
img->r_w = yv12->render_width;
|
||||
img->r_h = yv12->render_height;
|
||||
img->x_chroma_shift = yv12->subsampling_x;
|
||||
img->y_chroma_shift = yv12->subsampling_y;
|
||||
img->planes[AOM_PLANE_Y] = yv12->y_buffer;
|
||||
img->planes[AOM_PLANE_U] = yv12->u_buffer;
|
||||
img->planes[AOM_PLANE_V] = yv12->v_buffer;
|
||||
img->planes[AOM_PLANE_ALPHA] = NULL;
|
||||
img->stride[AOM_PLANE_Y] = yv12->y_stride;
|
||||
img->stride[AOM_PLANE_U] = yv12->uv_stride;
|
||||
img->stride[AOM_PLANE_V] = yv12->uv_stride;
|
||||
img->stride[AOM_PLANE_ALPHA] = yv12->y_stride;
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (yv12->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
// aom_image_t uses byte strides and a pointer to the first byte
|
||||
// of the image.
|
||||
img->fmt = (aom_img_fmt_t)(img->fmt | AOM_IMG_FMT_HIGHBITDEPTH);
|
||||
img->bit_depth = yv12->bit_depth;
|
||||
img->planes[AOM_PLANE_Y] = (uint8_t *)CONVERT_TO_SHORTPTR(yv12->y_buffer);
|
||||
img->planes[AOM_PLANE_U] = (uint8_t *)CONVERT_TO_SHORTPTR(yv12->u_buffer);
|
||||
img->planes[AOM_PLANE_V] = (uint8_t *)CONVERT_TO_SHORTPTR(yv12->v_buffer);
|
||||
img->planes[AOM_PLANE_ALPHA] = NULL;
|
||||
img->stride[AOM_PLANE_Y] = 2 * yv12->y_stride;
|
||||
img->stride[AOM_PLANE_U] = 2 * yv12->uv_stride;
|
||||
img->stride[AOM_PLANE_V] = 2 * yv12->uv_stride;
|
||||
img->stride[AOM_PLANE_ALPHA] = 2 * yv12->y_stride;
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
img->bps = bps;
|
||||
img->user_priv = user_priv;
|
||||
img->img_data = yv12->buffer_alloc;
|
||||
img->img_data_owner = 0;
|
||||
img->self_allocd = 0;
|
||||
}
|
||||
|
||||
static aom_codec_err_t image2yuvconfig(const aom_image_t *img,
|
||||
YV12_BUFFER_CONFIG *yv12) {
|
||||
yv12->y_buffer = img->planes[AOM_PLANE_Y];
|
||||
yv12->u_buffer = img->planes[AOM_PLANE_U];
|
||||
yv12->v_buffer = img->planes[AOM_PLANE_V];
|
||||
|
||||
yv12->y_crop_width = img->d_w;
|
||||
yv12->y_crop_height = img->d_h;
|
||||
yv12->render_width = img->r_w;
|
||||
yv12->render_height = img->r_h;
|
||||
yv12->y_width = img->d_w;
|
||||
yv12->y_height = img->d_h;
|
||||
|
||||
yv12->uv_width =
|
||||
img->x_chroma_shift == 1 ? (1 + yv12->y_width) / 2 : yv12->y_width;
|
||||
yv12->uv_height =
|
||||
img->y_chroma_shift == 1 ? (1 + yv12->y_height) / 2 : yv12->y_height;
|
||||
yv12->uv_crop_width = yv12->uv_width;
|
||||
yv12->uv_crop_height = yv12->uv_height;
|
||||
|
||||
yv12->y_stride = img->stride[AOM_PLANE_Y];
|
||||
yv12->uv_stride = img->stride[AOM_PLANE_U];
|
||||
yv12->color_space = img->cs;
|
||||
yv12->color_range = img->range;
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (img->fmt & AOM_IMG_FMT_HIGHBITDEPTH) {
|
||||
// In aom_image_t
|
||||
// planes point to uint8 address of start of data
|
||||
// stride counts uint8s to reach next row
|
||||
// In YV12_BUFFER_CONFIG
|
||||
// y_buffer, u_buffer, v_buffer point to uint16 address of data
|
||||
// stride and border counts in uint16s
|
||||
// This means that all the address calculations in the main body of code
|
||||
// should work correctly.
|
||||
// However, before we do any pixel operations we need to cast the address
|
||||
// to a uint16 ponter and double its value.
|
||||
yv12->y_buffer = CONVERT_TO_BYTEPTR(yv12->y_buffer);
|
||||
yv12->u_buffer = CONVERT_TO_BYTEPTR(yv12->u_buffer);
|
||||
yv12->v_buffer = CONVERT_TO_BYTEPTR(yv12->v_buffer);
|
||||
yv12->y_stride >>= 1;
|
||||
yv12->uv_stride >>= 1;
|
||||
yv12->flags = YV12_FLAG_HIGHBITDEPTH;
|
||||
} else {
|
||||
yv12->flags = 0;
|
||||
}
|
||||
yv12->border = (yv12->y_stride - img->w) / 2;
|
||||
#else
|
||||
yv12->border = (img->stride[AOM_PLANE_Y] - img->w) / 2;
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
yv12->subsampling_x = img->x_chroma_shift;
|
||||
yv12->subsampling_y = img->y_chroma_shift;
|
||||
return AOM_CODEC_OK;
|
||||
}
|
||||
|
||||
static AOM_REFFRAME ref_frame_to_av1_reframe(aom_ref_frame_type_t frame) {
|
||||
switch (frame) {
|
||||
case AOM_LAST_FRAME: return AOM_LAST_FLAG;
|
||||
case AOM_GOLD_FRAME: return AOM_GOLD_FLAG;
|
||||
case AOM_ALTR_FRAME: return AOM_ALT_FLAG;
|
||||
}
|
||||
assert(0 && "Invalid Reference Frame");
|
||||
return AOM_LAST_FLAG;
|
||||
}
|
||||
#endif // AV1_AV1_IFACE_COMMON_H_
|
||||
209
third_party/aom/av1/common/alloccommon.c
vendored
Normal file
209
third_party/aom/av1/common/alloccommon.c
vendored
Normal file
|
|
@ -0,0 +1,209 @@
|
|||
/*
|
||||
*
|
||||
* 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_mem/aom_mem.h"
|
||||
|
||||
#include "av1/common/alloccommon.h"
|
||||
#include "av1/common/blockd.h"
|
||||
#include "av1/common/entropymode.h"
|
||||
#include "av1/common/entropymv.h"
|
||||
#include "av1/common/onyxc_int.h"
|
||||
|
||||
void av1_set_mb_mi(AV1_COMMON *cm, int width, int height) {
|
||||
// TODO(jingning): Fine tune the loop filter operations and bring this
|
||||
// back to integer multiple of 4 for cb4x4.
|
||||
const int aligned_width = ALIGN_POWER_OF_TWO(width, 3);
|
||||
const int aligned_height = ALIGN_POWER_OF_TWO(height, 3);
|
||||
|
||||
cm->mi_cols = aligned_width >> MI_SIZE_LOG2;
|
||||
cm->mi_rows = aligned_height >> MI_SIZE_LOG2;
|
||||
cm->mi_stride = calc_mi_size(cm->mi_cols);
|
||||
|
||||
#if CONFIG_CB4X4
|
||||
cm->mb_cols = (cm->mi_cols + 2) >> 2;
|
||||
cm->mb_rows = (cm->mi_rows + 2) >> 2;
|
||||
#else
|
||||
cm->mb_cols = (cm->mi_cols + 1) >> 1;
|
||||
cm->mb_rows = (cm->mi_rows + 1) >> 1;
|
||||
#endif
|
||||
cm->MBs = cm->mb_rows * cm->mb_cols;
|
||||
}
|
||||
|
||||
static int alloc_seg_map(AV1_COMMON *cm, int seg_map_size) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_PING_PONG_BUFFERS; ++i) {
|
||||
cm->seg_map_array[i] = (uint8_t *)aom_calloc(seg_map_size, 1);
|
||||
if (cm->seg_map_array[i] == NULL) return 1;
|
||||
}
|
||||
cm->seg_map_alloc_size = seg_map_size;
|
||||
|
||||
// Init the index.
|
||||
cm->seg_map_idx = 0;
|
||||
cm->prev_seg_map_idx = 1;
|
||||
|
||||
cm->current_frame_seg_map = cm->seg_map_array[cm->seg_map_idx];
|
||||
if (!cm->frame_parallel_decode)
|
||||
cm->last_frame_seg_map = cm->seg_map_array[cm->prev_seg_map_idx];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void free_seg_map(AV1_COMMON *cm) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_PING_PONG_BUFFERS; ++i) {
|
||||
aom_free(cm->seg_map_array[i]);
|
||||
cm->seg_map_array[i] = NULL;
|
||||
}
|
||||
|
||||
cm->current_frame_seg_map = NULL;
|
||||
|
||||
if (!cm->frame_parallel_decode) {
|
||||
cm->last_frame_seg_map = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void av1_free_ref_frame_buffers(BufferPool *pool) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < FRAME_BUFFERS; ++i) {
|
||||
if (pool->frame_bufs[i].ref_count > 0 &&
|
||||
pool->frame_bufs[i].raw_frame_buffer.data != NULL) {
|
||||
pool->release_fb_cb(pool->cb_priv, &pool->frame_bufs[i].raw_frame_buffer);
|
||||
pool->frame_bufs[i].ref_count = 0;
|
||||
}
|
||||
aom_free(pool->frame_bufs[i].mvs);
|
||||
pool->frame_bufs[i].mvs = NULL;
|
||||
aom_free_frame_buffer(&pool->frame_bufs[i].buf);
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_LOOP_RESTORATION
|
||||
// Assumes cm->rst_info[p].restoration_tilesize is already initialized
|
||||
void av1_alloc_restoration_buffers(AV1_COMMON *cm) {
|
||||
int p;
|
||||
av1_alloc_restoration_struct(cm, &cm->rst_info[0], cm->width, cm->height);
|
||||
for (p = 1; p < MAX_MB_PLANE; ++p)
|
||||
av1_alloc_restoration_struct(
|
||||
cm, &cm->rst_info[p], ROUND_POWER_OF_TWO(cm->width, cm->subsampling_x),
|
||||
ROUND_POWER_OF_TWO(cm->height, cm->subsampling_y));
|
||||
aom_free(cm->rst_internal.tmpbuf);
|
||||
CHECK_MEM_ERROR(cm, cm->rst_internal.tmpbuf,
|
||||
(int32_t *)aom_memalign(16, RESTORATION_TMPBUF_SIZE));
|
||||
}
|
||||
|
||||
void av1_free_restoration_buffers(AV1_COMMON *cm) {
|
||||
int p;
|
||||
for (p = 0; p < MAX_MB_PLANE; ++p)
|
||||
av1_free_restoration_struct(&cm->rst_info[p]);
|
||||
aom_free(cm->rst_internal.tmpbuf);
|
||||
cm->rst_internal.tmpbuf = NULL;
|
||||
}
|
||||
#endif // CONFIG_LOOP_RESTORATION
|
||||
|
||||
void av1_free_context_buffers(AV1_COMMON *cm) {
|
||||
int i;
|
||||
cm->free_mi(cm);
|
||||
free_seg_map(cm);
|
||||
for (i = 0; i < MAX_MB_PLANE; i++) {
|
||||
aom_free(cm->above_context[i]);
|
||||
cm->above_context[i] = NULL;
|
||||
}
|
||||
aom_free(cm->above_seg_context);
|
||||
cm->above_seg_context = NULL;
|
||||
#if CONFIG_VAR_TX
|
||||
aom_free(cm->above_txfm_context);
|
||||
cm->above_txfm_context = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
int av1_alloc_context_buffers(AV1_COMMON *cm, int width, int height) {
|
||||
int new_mi_size;
|
||||
|
||||
av1_set_mb_mi(cm, width, height);
|
||||
new_mi_size = cm->mi_stride * calc_mi_size(cm->mi_rows);
|
||||
if (cm->mi_alloc_size < new_mi_size) {
|
||||
cm->free_mi(cm);
|
||||
if (cm->alloc_mi(cm, new_mi_size)) goto fail;
|
||||
}
|
||||
|
||||
if (cm->seg_map_alloc_size < cm->mi_rows * cm->mi_cols) {
|
||||
// Create the segmentation map structure and set to 0.
|
||||
free_seg_map(cm);
|
||||
if (alloc_seg_map(cm, cm->mi_rows * cm->mi_cols)) goto fail;
|
||||
}
|
||||
|
||||
if (cm->above_context_alloc_cols < cm->mi_cols) {
|
||||
// TODO(geza.lore): These are bigger than they need to be.
|
||||
// cm->tile_width would be enough but it complicates indexing a
|
||||
// little elsewhere.
|
||||
const int aligned_mi_cols =
|
||||
ALIGN_POWER_OF_TWO(cm->mi_cols, MAX_MIB_SIZE_LOG2);
|
||||
int i;
|
||||
|
||||
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]));
|
||||
if (!cm->above_context[i]) goto fail;
|
||||
}
|
||||
|
||||
aom_free(cm->above_seg_context);
|
||||
cm->above_seg_context = (PARTITION_CONTEXT *)aom_calloc(
|
||||
aligned_mi_cols, sizeof(*cm->above_seg_context));
|
||||
if (!cm->above_seg_context) goto fail;
|
||||
|
||||
#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));
|
||||
if (!cm->above_txfm_context) goto fail;
|
||||
#endif
|
||||
|
||||
cm->above_context_alloc_cols = aligned_mi_cols;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
// clear the mi_* values to force a realloc on resync
|
||||
av1_set_mb_mi(cm, 0, 0);
|
||||
av1_free_context_buffers(cm);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void av1_remove_common(AV1_COMMON *cm) {
|
||||
av1_free_context_buffers(cm);
|
||||
|
||||
aom_free(cm->fc);
|
||||
cm->fc = NULL;
|
||||
aom_free(cm->frame_contexts);
|
||||
cm->frame_contexts = NULL;
|
||||
}
|
||||
|
||||
void av1_init_context_buffers(AV1_COMMON *cm) {
|
||||
cm->setup_mi(cm);
|
||||
if (cm->last_frame_seg_map && !cm->frame_parallel_decode)
|
||||
memset(cm->last_frame_seg_map, 0, cm->mi_rows * cm->mi_cols);
|
||||
}
|
||||
|
||||
void av1_swap_current_and_last_seg_map(AV1_COMMON *cm) {
|
||||
// Swap indices.
|
||||
const int tmp = cm->seg_map_idx;
|
||||
cm->seg_map_idx = cm->prev_seg_map_idx;
|
||||
cm->prev_seg_map_idx = tmp;
|
||||
|
||||
cm->current_frame_seg_map = cm->seg_map_array[cm->seg_map_idx];
|
||||
cm->last_frame_seg_map = cm->seg_map_array[cm->prev_seg_map_idx];
|
||||
}
|
||||
47
third_party/aom/av1/common/alloccommon.h
vendored
Normal file
47
third_party/aom/av1/common/alloccommon.h
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* 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_COMMON_ALLOCCOMMON_H_
|
||||
#define AV1_COMMON_ALLOCCOMMON_H_
|
||||
|
||||
#define INVALID_IDX -1 // Invalid buffer index.
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct AV1Common;
|
||||
struct BufferPool;
|
||||
|
||||
void av1_remove_common(struct AV1Common *cm);
|
||||
|
||||
int av1_alloc_context_buffers(struct AV1Common *cm, int width, int height);
|
||||
void av1_init_context_buffers(struct AV1Common *cm);
|
||||
void av1_free_context_buffers(struct AV1Common *cm);
|
||||
|
||||
void av1_free_ref_frame_buffers(struct BufferPool *pool);
|
||||
#if CONFIG_LOOP_RESTORATION
|
||||
void av1_alloc_restoration_buffers(struct AV1Common *cm);
|
||||
void av1_free_restoration_buffers(struct AV1Common *cm);
|
||||
#endif // CONFIG_LOOP_RESTORATION
|
||||
|
||||
int av1_alloc_state_buffers(struct AV1Common *cm, int width, int height);
|
||||
void av1_free_state_buffers(struct AV1Common *cm);
|
||||
|
||||
void av1_set_mb_mi(struct AV1Common *cm, int width, int height);
|
||||
|
||||
void av1_swap_current_and_last_seg_map(struct AV1Common *cm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // AV1_COMMON_ALLOCCOMMON_H_
|
||||
227
third_party/aom/av1/common/arm/neon/iht4x4_add_neon.c
vendored
Normal file
227
third_party/aom/av1/common/arm/neon/iht4x4_add_neon.c
vendored
Normal file
|
|
@ -0,0 +1,227 @@
|
|||
/*
|
||||
* 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 <arm_neon.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "./aom_config.h"
|
||||
#include "./av1_rtcd.h"
|
||||
#include "aom_dsp/txfm_common.h"
|
||||
#include "av1/common/common.h"
|
||||
|
||||
static INLINE void TRANSPOSE4X4(int16x8_t *q8s16, int16x8_t *q9s16) {
|
||||
int32x4_t q8s32, q9s32;
|
||||
int16x4x2_t d0x2s16, d1x2s16;
|
||||
int32x4x2_t q0x2s32;
|
||||
|
||||
d0x2s16 = vtrn_s16(vget_low_s16(*q8s16), vget_high_s16(*q8s16));
|
||||
d1x2s16 = vtrn_s16(vget_low_s16(*q9s16), vget_high_s16(*q9s16));
|
||||
|
||||
q8s32 = vreinterpretq_s32_s16(vcombine_s16(d0x2s16.val[0], d0x2s16.val[1]));
|
||||
q9s32 = vreinterpretq_s32_s16(vcombine_s16(d1x2s16.val[0], d1x2s16.val[1]));
|
||||
q0x2s32 = vtrnq_s32(q8s32, q9s32);
|
||||
|
||||
*q8s16 = vreinterpretq_s16_s32(q0x2s32.val[0]);
|
||||
*q9s16 = vreinterpretq_s16_s32(q0x2s32.val[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
static INLINE void GENERATE_COSINE_CONSTANTS(int16x4_t *d0s16, int16x4_t *d1s16,
|
||||
int16x4_t *d2s16) {
|
||||
*d0s16 = vdup_n_s16((int16_t)cospi_8_64);
|
||||
*d1s16 = vdup_n_s16((int16_t)cospi_16_64);
|
||||
*d2s16 = vdup_n_s16((int16_t)cospi_24_64);
|
||||
return;
|
||||
}
|
||||
|
||||
static INLINE void GENERATE_SINE_CONSTANTS(int16x4_t *d3s16, int16x4_t *d4s16,
|
||||
int16x4_t *d5s16, int16x8_t *q3s16) {
|
||||
*d3s16 = vdup_n_s16((int16_t)sinpi_1_9);
|
||||
*d4s16 = vdup_n_s16((int16_t)sinpi_2_9);
|
||||
*q3s16 = vdupq_n_s16((int16_t)sinpi_3_9);
|
||||
*d5s16 = vdup_n_s16((int16_t)sinpi_4_9);
|
||||
return;
|
||||
}
|
||||
|
||||
static INLINE void IDCT4x4_1D(int16x4_t *d0s16, int16x4_t *d1s16,
|
||||
int16x4_t *d2s16, int16x8_t *q8s16,
|
||||
int16x8_t *q9s16) {
|
||||
int16x4_t d16s16, d17s16, d18s16, d19s16, d23s16, d24s16;
|
||||
int16x4_t d26s16, d27s16, d28s16, d29s16;
|
||||
int32x4_t q10s32, q13s32, q14s32, q15s32;
|
||||
int16x8_t q13s16, q14s16;
|
||||
|
||||
d16s16 = vget_low_s16(*q8s16);
|
||||
d17s16 = vget_high_s16(*q8s16);
|
||||
d18s16 = vget_low_s16(*q9s16);
|
||||
d19s16 = vget_high_s16(*q9s16);
|
||||
|
||||
d23s16 = vadd_s16(d16s16, d18s16);
|
||||
d24s16 = vsub_s16(d16s16, d18s16);
|
||||
|
||||
q15s32 = vmull_s16(d17s16, *d2s16);
|
||||
q10s32 = vmull_s16(d17s16, *d0s16);
|
||||
q13s32 = vmull_s16(d23s16, *d1s16);
|
||||
q14s32 = vmull_s16(d24s16, *d1s16);
|
||||
q15s32 = vmlsl_s16(q15s32, d19s16, *d0s16);
|
||||
q10s32 = vmlal_s16(q10s32, d19s16, *d2s16);
|
||||
|
||||
d26s16 = vqrshrn_n_s32(q13s32, 14);
|
||||
d27s16 = vqrshrn_n_s32(q14s32, 14);
|
||||
d29s16 = vqrshrn_n_s32(q15s32, 14);
|
||||
d28s16 = vqrshrn_n_s32(q10s32, 14);
|
||||
|
||||
q13s16 = vcombine_s16(d26s16, d27s16);
|
||||
q14s16 = vcombine_s16(d28s16, d29s16);
|
||||
*q8s16 = vaddq_s16(q13s16, q14s16);
|
||||
*q9s16 = vsubq_s16(q13s16, q14s16);
|
||||
*q9s16 = vcombine_s16(vget_high_s16(*q9s16), vget_low_s16(*q9s16)); // vswp
|
||||
return;
|
||||
}
|
||||
|
||||
static INLINE void IADST4x4_1D(int16x4_t *d3s16, int16x4_t *d4s16,
|
||||
int16x4_t *d5s16, int16x8_t *q3s16,
|
||||
int16x8_t *q8s16, int16x8_t *q9s16) {
|
||||
int16x4_t d6s16, d16s16, d17s16, d18s16, d19s16;
|
||||
int32x4_t q8s32, q9s32, q10s32, q11s32, q12s32, q13s32, q14s32, q15s32;
|
||||
|
||||
d6s16 = vget_low_s16(*q3s16);
|
||||
|
||||
d16s16 = vget_low_s16(*q8s16);
|
||||
d17s16 = vget_high_s16(*q8s16);
|
||||
d18s16 = vget_low_s16(*q9s16);
|
||||
d19s16 = vget_high_s16(*q9s16);
|
||||
|
||||
q10s32 = vmull_s16(*d3s16, d16s16);
|
||||
q11s32 = vmull_s16(*d4s16, d16s16);
|
||||
q12s32 = vmull_s16(d6s16, d17s16);
|
||||
q13s32 = vmull_s16(*d5s16, d18s16);
|
||||
q14s32 = vmull_s16(*d3s16, d18s16);
|
||||
q15s32 = vmovl_s16(d16s16);
|
||||
q15s32 = vaddw_s16(q15s32, d19s16);
|
||||
q8s32 = vmull_s16(*d4s16, d19s16);
|
||||
q15s32 = vsubw_s16(q15s32, d18s16);
|
||||
q9s32 = vmull_s16(*d5s16, d19s16);
|
||||
|
||||
q10s32 = vaddq_s32(q10s32, q13s32);
|
||||
q10s32 = vaddq_s32(q10s32, q8s32);
|
||||
q11s32 = vsubq_s32(q11s32, q14s32);
|
||||
q8s32 = vdupq_n_s32((int32_t)sinpi_3_9);
|
||||
q11s32 = vsubq_s32(q11s32, q9s32);
|
||||
q15s32 = vmulq_s32(q15s32, q8s32);
|
||||
|
||||
q13s32 = vaddq_s32(q10s32, q12s32);
|
||||
q10s32 = vaddq_s32(q10s32, q11s32);
|
||||
q14s32 = vaddq_s32(q11s32, q12s32);
|
||||
q10s32 = vsubq_s32(q10s32, q12s32);
|
||||
|
||||
d16s16 = vqrshrn_n_s32(q13s32, 14);
|
||||
d17s16 = vqrshrn_n_s32(q14s32, 14);
|
||||
d18s16 = vqrshrn_n_s32(q15s32, 14);
|
||||
d19s16 = vqrshrn_n_s32(q10s32, 14);
|
||||
|
||||
*q8s16 = vcombine_s16(d16s16, d17s16);
|
||||
*q9s16 = vcombine_s16(d18s16, d19s16);
|
||||
return;
|
||||
}
|
||||
|
||||
void av1_iht4x4_16_add_neon(const tran_low_t *input, uint8_t *dest,
|
||||
int dest_stride, int tx_type) {
|
||||
uint8x8_t d26u8, d27u8;
|
||||
int16x4_t d0s16, d1s16, d2s16, d3s16, d4s16, d5s16;
|
||||
uint32x2_t d26u32, d27u32;
|
||||
int16x8_t q3s16, q8s16, q9s16;
|
||||
uint16x8_t q8u16, q9u16;
|
||||
|
||||
d26u32 = d27u32 = vdup_n_u32(0);
|
||||
|
||||
q8s16 = vld1q_s16(input);
|
||||
q9s16 = vld1q_s16(input + 8);
|
||||
|
||||
TRANSPOSE4X4(&q8s16, &q9s16);
|
||||
|
||||
switch (tx_type) {
|
||||
case 0: // idct_idct is not supported. Fall back to C
|
||||
av1_iht4x4_16_add_c(input, dest, dest_stride, tx_type);
|
||||
return;
|
||||
break;
|
||||
case 1: // iadst_idct
|
||||
// generate constants
|
||||
GENERATE_COSINE_CONSTANTS(&d0s16, &d1s16, &d2s16);
|
||||
GENERATE_SINE_CONSTANTS(&d3s16, &d4s16, &d5s16, &q3s16);
|
||||
|
||||
// first transform rows
|
||||
IDCT4x4_1D(&d0s16, &d1s16, &d2s16, &q8s16, &q9s16);
|
||||
|
||||
// transpose the matrix
|
||||
TRANSPOSE4X4(&q8s16, &q9s16);
|
||||
|
||||
// then transform columns
|
||||
IADST4x4_1D(&d3s16, &d4s16, &d5s16, &q3s16, &q8s16, &q9s16);
|
||||
break;
|
||||
case 2: // idct_iadst
|
||||
// generate constantsyy
|
||||
GENERATE_COSINE_CONSTANTS(&d0s16, &d1s16, &d2s16);
|
||||
GENERATE_SINE_CONSTANTS(&d3s16, &d4s16, &d5s16, &q3s16);
|
||||
|
||||
// first transform rows
|
||||
IADST4x4_1D(&d3s16, &d4s16, &d5s16, &q3s16, &q8s16, &q9s16);
|
||||
|
||||
// transpose the matrix
|
||||
TRANSPOSE4X4(&q8s16, &q9s16);
|
||||
|
||||
// then transform columns
|
||||
IDCT4x4_1D(&d0s16, &d1s16, &d2s16, &q8s16, &q9s16);
|
||||
break;
|
||||
case 3: // iadst_iadst
|
||||
// generate constants
|
||||
GENERATE_SINE_CONSTANTS(&d3s16, &d4s16, &d5s16, &q3s16);
|
||||
|
||||
// first transform rows
|
||||
IADST4x4_1D(&d3s16, &d4s16, &d5s16, &q3s16, &q8s16, &q9s16);
|
||||
|
||||
// transpose the matrix
|
||||
TRANSPOSE4X4(&q8s16, &q9s16);
|
||||
|
||||
// then transform columns
|
||||
IADST4x4_1D(&d3s16, &d4s16, &d5s16, &q3s16, &q8s16, &q9s16);
|
||||
break;
|
||||
default: // iadst_idct
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
|
||||
q8s16 = vrshrq_n_s16(q8s16, 4);
|
||||
q9s16 = vrshrq_n_s16(q9s16, 4);
|
||||
|
||||
d26u32 = vld1_lane_u32((const uint32_t *)dest, d26u32, 0);
|
||||
dest += dest_stride;
|
||||
d26u32 = vld1_lane_u32((const uint32_t *)dest, d26u32, 1);
|
||||
dest += dest_stride;
|
||||
d27u32 = vld1_lane_u32((const uint32_t *)dest, d27u32, 0);
|
||||
dest += dest_stride;
|
||||
d27u32 = vld1_lane_u32((const uint32_t *)dest, d27u32, 1);
|
||||
|
||||
q8u16 = vaddw_u8(vreinterpretq_u16_s16(q8s16), vreinterpret_u8_u32(d26u32));
|
||||
q9u16 = vaddw_u8(vreinterpretq_u16_s16(q9s16), vreinterpret_u8_u32(d27u32));
|
||||
|
||||
d26u8 = vqmovun_s16(vreinterpretq_s16_u16(q8u16));
|
||||
d27u8 = vqmovun_s16(vreinterpretq_s16_u16(q9u16));
|
||||
|
||||
vst1_lane_u32((uint32_t *)dest, vreinterpret_u32_u8(d27u8), 1);
|
||||
dest -= dest_stride;
|
||||
vst1_lane_u32((uint32_t *)dest, vreinterpret_u32_u8(d27u8), 0);
|
||||
dest -= dest_stride;
|
||||
vst1_lane_u32((uint32_t *)dest, vreinterpret_u32_u8(d26u8), 1);
|
||||
dest -= dest_stride;
|
||||
vst1_lane_u32((uint32_t *)dest, vreinterpret_u32_u8(d26u8), 0);
|
||||
return;
|
||||
}
|
||||
593
third_party/aom/av1/common/arm/neon/iht8x8_add_neon.c
vendored
Normal file
593
third_party/aom/av1/common/arm/neon/iht8x8_add_neon.c
vendored
Normal file
|
|
@ -0,0 +1,593 @@
|
|||
/*
|
||||
* 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 <arm_neon.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "./aom_config.h"
|
||||
#include "./av1_rtcd.h"
|
||||
#include "aom_dsp/txfm_common.h"
|
||||
#include "av1/common/common.h"
|
||||
|
||||
static INLINE void TRANSPOSE8X8(int16x8_t *q8s16, int16x8_t *q9s16,
|
||||
int16x8_t *q10s16, int16x8_t *q11s16,
|
||||
int16x8_t *q12s16, int16x8_t *q13s16,
|
||||
int16x8_t *q14s16, int16x8_t *q15s16) {
|
||||
int16x4_t d16s16, d17s16, d18s16, d19s16, d20s16, d21s16, d22s16, d23s16;
|
||||
int16x4_t d24s16, d25s16, d26s16, d27s16, d28s16, d29s16, d30s16, d31s16;
|
||||
int32x4x2_t q0x2s32, q1x2s32, q2x2s32, q3x2s32;
|
||||
int16x8x2_t q0x2s16, q1x2s16, q2x2s16, q3x2s16;
|
||||
|
||||
d16s16 = vget_low_s16(*q8s16);
|
||||
d17s16 = vget_high_s16(*q8s16);
|
||||
d18s16 = vget_low_s16(*q9s16);
|
||||
d19s16 = vget_high_s16(*q9s16);
|
||||
d20s16 = vget_low_s16(*q10s16);
|
||||
d21s16 = vget_high_s16(*q10s16);
|
||||
d22s16 = vget_low_s16(*q11s16);
|
||||
d23s16 = vget_high_s16(*q11s16);
|
||||
d24s16 = vget_low_s16(*q12s16);
|
||||
d25s16 = vget_high_s16(*q12s16);
|
||||
d26s16 = vget_low_s16(*q13s16);
|
||||
d27s16 = vget_high_s16(*q13s16);
|
||||
d28s16 = vget_low_s16(*q14s16);
|
||||
d29s16 = vget_high_s16(*q14s16);
|
||||
d30s16 = vget_low_s16(*q15s16);
|
||||
d31s16 = vget_high_s16(*q15s16);
|
||||
|
||||
*q8s16 = vcombine_s16(d16s16, d24s16); // vswp d17, d24
|
||||
*q9s16 = vcombine_s16(d18s16, d26s16); // vswp d19, d26
|
||||
*q10s16 = vcombine_s16(d20s16, d28s16); // vswp d21, d28
|
||||
*q11s16 = vcombine_s16(d22s16, d30s16); // vswp d23, d30
|
||||
*q12s16 = vcombine_s16(d17s16, d25s16);
|
||||
*q13s16 = vcombine_s16(d19s16, d27s16);
|
||||
*q14s16 = vcombine_s16(d21s16, d29s16);
|
||||
*q15s16 = vcombine_s16(d23s16, d31s16);
|
||||
|
||||
q0x2s32 =
|
||||
vtrnq_s32(vreinterpretq_s32_s16(*q8s16), vreinterpretq_s32_s16(*q10s16));
|
||||
q1x2s32 =
|
||||
vtrnq_s32(vreinterpretq_s32_s16(*q9s16), vreinterpretq_s32_s16(*q11s16));
|
||||
q2x2s32 =
|
||||
vtrnq_s32(vreinterpretq_s32_s16(*q12s16), vreinterpretq_s32_s16(*q14s16));
|
||||
q3x2s32 =
|
||||
vtrnq_s32(vreinterpretq_s32_s16(*q13s16), vreinterpretq_s32_s16(*q15s16));
|
||||
|
||||
q0x2s16 = vtrnq_s16(vreinterpretq_s16_s32(q0x2s32.val[0]), // q8
|
||||
vreinterpretq_s16_s32(q1x2s32.val[0])); // q9
|
||||
q1x2s16 = vtrnq_s16(vreinterpretq_s16_s32(q0x2s32.val[1]), // q10
|
||||
vreinterpretq_s16_s32(q1x2s32.val[1])); // q11
|
||||
q2x2s16 = vtrnq_s16(vreinterpretq_s16_s32(q2x2s32.val[0]), // q12
|
||||
vreinterpretq_s16_s32(q3x2s32.val[0])); // q13
|
||||
q3x2s16 = vtrnq_s16(vreinterpretq_s16_s32(q2x2s32.val[1]), // q14
|
||||
vreinterpretq_s16_s32(q3x2s32.val[1])); // q15
|
||||
|
||||
*q8s16 = q0x2s16.val[0];
|
||||
*q9s16 = q0x2s16.val[1];
|
||||
*q10s16 = q1x2s16.val[0];
|
||||
*q11s16 = q1x2s16.val[1];
|
||||
*q12s16 = q2x2s16.val[0];
|
||||
*q13s16 = q2x2s16.val[1];
|
||||
*q14s16 = q3x2s16.val[0];
|
||||
*q15s16 = q3x2s16.val[1];
|
||||
return;
|
||||
}
|
||||
|
||||
static INLINE void IDCT8x8_1D(int16x8_t *q8s16, int16x8_t *q9s16,
|
||||
int16x8_t *q10s16, int16x8_t *q11s16,
|
||||
int16x8_t *q12s16, int16x8_t *q13s16,
|
||||
int16x8_t *q14s16, int16x8_t *q15s16) {
|
||||
int16x4_t d0s16, d1s16, d2s16, d3s16;
|
||||
int16x4_t d8s16, d9s16, d10s16, d11s16, d12s16, d13s16, d14s16, d15s16;
|
||||
int16x4_t d16s16, d17s16, d18s16, d19s16, d20s16, d21s16, d22s16, d23s16;
|
||||
int16x4_t d24s16, d25s16, d26s16, d27s16, d28s16, d29s16, d30s16, d31s16;
|
||||
int16x8_t q0s16, q1s16, q2s16, q3s16, q4s16, q5s16, q6s16, q7s16;
|
||||
int32x4_t q2s32, q3s32, q5s32, q6s32, q8s32, q9s32;
|
||||
int32x4_t q10s32, q11s32, q12s32, q13s32, q15s32;
|
||||
|
||||
d0s16 = vdup_n_s16((int16_t)cospi_28_64);
|
||||
d1s16 = vdup_n_s16((int16_t)cospi_4_64);
|
||||
d2s16 = vdup_n_s16((int16_t)cospi_12_64);
|
||||
d3s16 = vdup_n_s16((int16_t)cospi_20_64);
|
||||
|
||||
d16s16 = vget_low_s16(*q8s16);
|
||||
d17s16 = vget_high_s16(*q8s16);
|
||||
d18s16 = vget_low_s16(*q9s16);
|
||||
d19s16 = vget_high_s16(*q9s16);
|
||||
d20s16 = vget_low_s16(*q10s16);
|
||||
d21s16 = vget_high_s16(*q10s16);
|
||||
d22s16 = vget_low_s16(*q11s16);
|
||||
d23s16 = vget_high_s16(*q11s16);
|
||||
d24s16 = vget_low_s16(*q12s16);
|
||||
d25s16 = vget_high_s16(*q12s16);
|
||||
d26s16 = vget_low_s16(*q13s16);
|
||||
d27s16 = vget_high_s16(*q13s16);
|
||||
d28s16 = vget_low_s16(*q14s16);
|
||||
d29s16 = vget_high_s16(*q14s16);
|
||||
d30s16 = vget_low_s16(*q15s16);
|
||||
d31s16 = vget_high_s16(*q15s16);
|
||||
|
||||
q2s32 = vmull_s16(d18s16, d0s16);
|
||||
q3s32 = vmull_s16(d19s16, d0s16);
|
||||
q5s32 = vmull_s16(d26s16, d2s16);
|
||||
q6s32 = vmull_s16(d27s16, d2s16);
|
||||
|
||||
q2s32 = vmlsl_s16(q2s32, d30s16, d1s16);
|
||||
q3s32 = vmlsl_s16(q3s32, d31s16, d1s16);
|
||||
q5s32 = vmlsl_s16(q5s32, d22s16, d3s16);
|
||||
q6s32 = vmlsl_s16(q6s32, d23s16, d3s16);
|
||||
|
||||
d8s16 = vqrshrn_n_s32(q2s32, 14);
|
||||
d9s16 = vqrshrn_n_s32(q3s32, 14);
|
||||
d10s16 = vqrshrn_n_s32(q5s32, 14);
|
||||
d11s16 = vqrshrn_n_s32(q6s32, 14);
|
||||
q4s16 = vcombine_s16(d8s16, d9s16);
|
||||
q5s16 = vcombine_s16(d10s16, d11s16);
|
||||
|
||||
q2s32 = vmull_s16(d18s16, d1s16);
|
||||
q3s32 = vmull_s16(d19s16, d1s16);
|
||||
q9s32 = vmull_s16(d26s16, d3s16);
|
||||
q13s32 = vmull_s16(d27s16, d3s16);
|
||||
|
||||
q2s32 = vmlal_s16(q2s32, d30s16, d0s16);
|
||||
q3s32 = vmlal_s16(q3s32, d31s16, d0s16);
|
||||
q9s32 = vmlal_s16(q9s32, d22s16, d2s16);
|
||||
q13s32 = vmlal_s16(q13s32, d23s16, d2s16);
|
||||
|
||||
d14s16 = vqrshrn_n_s32(q2s32, 14);
|
||||
d15s16 = vqrshrn_n_s32(q3s32, 14);
|
||||
d12s16 = vqrshrn_n_s32(q9s32, 14);
|
||||
d13s16 = vqrshrn_n_s32(q13s32, 14);
|
||||
q6s16 = vcombine_s16(d12s16, d13s16);
|
||||
q7s16 = vcombine_s16(d14s16, d15s16);
|
||||
|
||||
d0s16 = vdup_n_s16((int16_t)cospi_16_64);
|
||||
|
||||
q2s32 = vmull_s16(d16s16, d0s16);
|
||||
q3s32 = vmull_s16(d17s16, d0s16);
|
||||
q13s32 = vmull_s16(d16s16, d0s16);
|
||||
q15s32 = vmull_s16(d17s16, d0s16);
|
||||
|
||||
q2s32 = vmlal_s16(q2s32, d24s16, d0s16);
|
||||
q3s32 = vmlal_s16(q3s32, d25s16, d0s16);
|
||||
q13s32 = vmlsl_s16(q13s32, d24s16, d0s16);
|
||||
q15s32 = vmlsl_s16(q15s32, d25s16, d0s16);
|
||||
|
||||
d0s16 = vdup_n_s16((int16_t)cospi_24_64);
|
||||
d1s16 = vdup_n_s16((int16_t)cospi_8_64);
|
||||
|
||||
d18s16 = vqrshrn_n_s32(q2s32, 14);
|
||||
d19s16 = vqrshrn_n_s32(q3s32, 14);
|
||||
d22s16 = vqrshrn_n_s32(q13s32, 14);
|
||||
d23s16 = vqrshrn_n_s32(q15s32, 14);
|
||||
*q9s16 = vcombine_s16(d18s16, d19s16);
|
||||
*q11s16 = vcombine_s16(d22s16, d23s16);
|
||||
|
||||
q2s32 = vmull_s16(d20s16, d0s16);
|
||||
q3s32 = vmull_s16(d21s16, d0s16);
|
||||
q8s32 = vmull_s16(d20s16, d1s16);
|
||||
q12s32 = vmull_s16(d21s16, d1s16);
|
||||
|
||||
q2s32 = vmlsl_s16(q2s32, d28s16, d1s16);
|
||||
q3s32 = vmlsl_s16(q3s32, d29s16, d1s16);
|
||||
q8s32 = vmlal_s16(q8s32, d28s16, d0s16);
|
||||
q12s32 = vmlal_s16(q12s32, d29s16, d0s16);
|
||||
|
||||
d26s16 = vqrshrn_n_s32(q2s32, 14);
|
||||
d27s16 = vqrshrn_n_s32(q3s32, 14);
|
||||
d30s16 = vqrshrn_n_s32(q8s32, 14);
|
||||
d31s16 = vqrshrn_n_s32(q12s32, 14);
|
||||
*q13s16 = vcombine_s16(d26s16, d27s16);
|
||||
*q15s16 = vcombine_s16(d30s16, d31s16);
|
||||
|
||||
q0s16 = vaddq_s16(*q9s16, *q15s16);
|
||||
q1s16 = vaddq_s16(*q11s16, *q13s16);
|
||||
q2s16 = vsubq_s16(*q11s16, *q13s16);
|
||||
q3s16 = vsubq_s16(*q9s16, *q15s16);
|
||||
|
||||
*q13s16 = vsubq_s16(q4s16, q5s16);
|
||||
q4s16 = vaddq_s16(q4s16, q5s16);
|
||||
*q14s16 = vsubq_s16(q7s16, q6s16);
|
||||
q7s16 = vaddq_s16(q7s16, q6s16);
|
||||
d26s16 = vget_low_s16(*q13s16);
|
||||
d27s16 = vget_high_s16(*q13s16);
|
||||
d28s16 = vget_low_s16(*q14s16);
|
||||
d29s16 = vget_high_s16(*q14s16);
|
||||
|
||||
d16s16 = vdup_n_s16((int16_t)cospi_16_64);
|
||||
|
||||
q9s32 = vmull_s16(d28s16, d16s16);
|
||||
q10s32 = vmull_s16(d29s16, d16s16);
|
||||
q11s32 = vmull_s16(d28s16, d16s16);
|
||||
q12s32 = vmull_s16(d29s16, d16s16);
|
||||
|
||||
q9s32 = vmlsl_s16(q9s32, d26s16, d16s16);
|
||||
q10s32 = vmlsl_s16(q10s32, d27s16, d16s16);
|
||||
q11s32 = vmlal_s16(q11s32, d26s16, d16s16);
|
||||
q12s32 = vmlal_s16(q12s32, d27s16, d16s16);
|
||||
|
||||
d10s16 = vqrshrn_n_s32(q9s32, 14);
|
||||
d11s16 = vqrshrn_n_s32(q10s32, 14);
|
||||
d12s16 = vqrshrn_n_s32(q11s32, 14);
|
||||
d13s16 = vqrshrn_n_s32(q12s32, 14);
|
||||
q5s16 = vcombine_s16(d10s16, d11s16);
|
||||
q6s16 = vcombine_s16(d12s16, d13s16);
|
||||
|
||||
*q8s16 = vaddq_s16(q0s16, q7s16);
|
||||
*q9s16 = vaddq_s16(q1s16, q6s16);
|
||||
*q10s16 = vaddq_s16(q2s16, q5s16);
|
||||
*q11s16 = vaddq_s16(q3s16, q4s16);
|
||||
*q12s16 = vsubq_s16(q3s16, q4s16);
|
||||
*q13s16 = vsubq_s16(q2s16, q5s16);
|
||||
*q14s16 = vsubq_s16(q1s16, q6s16);
|
||||
*q15s16 = vsubq_s16(q0s16, q7s16);
|
||||
return;
|
||||
}
|
||||
|
||||
static INLINE void IADST8X8_1D(int16x8_t *q8s16, int16x8_t *q9s16,
|
||||
int16x8_t *q10s16, int16x8_t *q11s16,
|
||||
int16x8_t *q12s16, int16x8_t *q13s16,
|
||||
int16x8_t *q14s16, int16x8_t *q15s16) {
|
||||
int16x4_t d0s16, d1s16, d2s16, d3s16, d4s16, d5s16, d6s16, d7s16;
|
||||
int16x4_t d8s16, d9s16, d10s16, d11s16, d12s16, d13s16, d14s16, d15s16;
|
||||
int16x4_t d16s16, d17s16, d18s16, d19s16, d20s16, d21s16, d22s16, d23s16;
|
||||
int16x4_t d24s16, d25s16, d26s16, d27s16, d28s16, d29s16, d30s16, d31s16;
|
||||
int16x8_t q2s16, q4s16, q5s16, q6s16;
|
||||
int32x4_t q0s32, q1s32, q2s32, q3s32, q4s32, q5s32, q6s32, q7s32, q8s32;
|
||||
int32x4_t q9s32, q10s32, q11s32, q12s32, q13s32, q14s32, q15s32;
|
||||
|
||||
d16s16 = vget_low_s16(*q8s16);
|
||||
d17s16 = vget_high_s16(*q8s16);
|
||||
d18s16 = vget_low_s16(*q9s16);
|
||||
d19s16 = vget_high_s16(*q9s16);
|
||||
d20s16 = vget_low_s16(*q10s16);
|
||||
d21s16 = vget_high_s16(*q10s16);
|
||||
d22s16 = vget_low_s16(*q11s16);
|
||||
d23s16 = vget_high_s16(*q11s16);
|
||||
d24s16 = vget_low_s16(*q12s16);
|
||||
d25s16 = vget_high_s16(*q12s16);
|
||||
d26s16 = vget_low_s16(*q13s16);
|
||||
d27s16 = vget_high_s16(*q13s16);
|
||||
d28s16 = vget_low_s16(*q14s16);
|
||||
d29s16 = vget_high_s16(*q14s16);
|
||||
d30s16 = vget_low_s16(*q15s16);
|
||||
d31s16 = vget_high_s16(*q15s16);
|
||||
|
||||
d14s16 = vdup_n_s16((int16_t)cospi_2_64);
|
||||
d15s16 = vdup_n_s16((int16_t)cospi_30_64);
|
||||
|
||||
q1s32 = vmull_s16(d30s16, d14s16);
|
||||
q2s32 = vmull_s16(d31s16, d14s16);
|
||||
q3s32 = vmull_s16(d30s16, d15s16);
|
||||
q4s32 = vmull_s16(d31s16, d15s16);
|
||||
|
||||
d30s16 = vdup_n_s16((int16_t)cospi_18_64);
|
||||
d31s16 = vdup_n_s16((int16_t)cospi_14_64);
|
||||
|
||||
q1s32 = vmlal_s16(q1s32, d16s16, d15s16);
|
||||
q2s32 = vmlal_s16(q2s32, d17s16, d15s16);
|
||||
q3s32 = vmlsl_s16(q3s32, d16s16, d14s16);
|
||||
q4s32 = vmlsl_s16(q4s32, d17s16, d14s16);
|
||||
|
||||
q5s32 = vmull_s16(d22s16, d30s16);
|
||||
q6s32 = vmull_s16(d23s16, d30s16);
|
||||
q7s32 = vmull_s16(d22s16, d31s16);
|
||||
q8s32 = vmull_s16(d23s16, d31s16);
|
||||
|
||||
q5s32 = vmlal_s16(q5s32, d24s16, d31s16);
|
||||
q6s32 = vmlal_s16(q6s32, d25s16, d31s16);
|
||||
q7s32 = vmlsl_s16(q7s32, d24s16, d30s16);
|
||||
q8s32 = vmlsl_s16(q8s32, d25s16, d30s16);
|
||||
|
||||
q11s32 = vaddq_s32(q1s32, q5s32);
|
||||
q12s32 = vaddq_s32(q2s32, q6s32);
|
||||
q1s32 = vsubq_s32(q1s32, q5s32);
|
||||
q2s32 = vsubq_s32(q2s32, q6s32);
|
||||
|
||||
d22s16 = vqrshrn_n_s32(q11s32, 14);
|
||||
d23s16 = vqrshrn_n_s32(q12s32, 14);
|
||||
*q11s16 = vcombine_s16(d22s16, d23s16);
|
||||
|
||||
q12s32 = vaddq_s32(q3s32, q7s32);
|
||||
q15s32 = vaddq_s32(q4s32, q8s32);
|
||||
q3s32 = vsubq_s32(q3s32, q7s32);
|
||||
q4s32 = vsubq_s32(q4s32, q8s32);
|
||||
|
||||
d2s16 = vqrshrn_n_s32(q1s32, 14);
|
||||
d3s16 = vqrshrn_n_s32(q2s32, 14);
|
||||
d24s16 = vqrshrn_n_s32(q12s32, 14);
|
||||
d25s16 = vqrshrn_n_s32(q15s32, 14);
|
||||
d6s16 = vqrshrn_n_s32(q3s32, 14);
|
||||
d7s16 = vqrshrn_n_s32(q4s32, 14);
|
||||
*q12s16 = vcombine_s16(d24s16, d25s16);
|
||||
|
||||
d0s16 = vdup_n_s16((int16_t)cospi_10_64);
|
||||
d1s16 = vdup_n_s16((int16_t)cospi_22_64);
|
||||
q4s32 = vmull_s16(d26s16, d0s16);
|
||||
q5s32 = vmull_s16(d27s16, d0s16);
|
||||
q2s32 = vmull_s16(d26s16, d1s16);
|
||||
q6s32 = vmull_s16(d27s16, d1s16);
|
||||
|
||||
d30s16 = vdup_n_s16((int16_t)cospi_26_64);
|
||||
d31s16 = vdup_n_s16((int16_t)cospi_6_64);
|
||||
|
||||
q4s32 = vmlal_s16(q4s32, d20s16, d1s16);
|
||||
q5s32 = vmlal_s16(q5s32, d21s16, d1s16);
|
||||
q2s32 = vmlsl_s16(q2s32, d20s16, d0s16);
|
||||
q6s32 = vmlsl_s16(q6s32, d21s16, d0s16);
|
||||
|
||||
q0s32 = vmull_s16(d18s16, d30s16);
|
||||
q13s32 = vmull_s16(d19s16, d30s16);
|
||||
|
||||
q0s32 = vmlal_s16(q0s32, d28s16, d31s16);
|
||||
q13s32 = vmlal_s16(q13s32, d29s16, d31s16);
|
||||
|
||||
q10s32 = vmull_s16(d18s16, d31s16);
|
||||
q9s32 = vmull_s16(d19s16, d31s16);
|
||||
|
||||
q10s32 = vmlsl_s16(q10s32, d28s16, d30s16);
|
||||
q9s32 = vmlsl_s16(q9s32, d29s16, d30s16);
|
||||
|
||||
q14s32 = vaddq_s32(q2s32, q10s32);
|
||||
q15s32 = vaddq_s32(q6s32, q9s32);
|
||||
q2s32 = vsubq_s32(q2s32, q10s32);
|
||||
q6s32 = vsubq_s32(q6s32, q9s32);
|
||||
|
||||
d28s16 = vqrshrn_n_s32(q14s32, 14);
|
||||
d29s16 = vqrshrn_n_s32(q15s32, 14);
|
||||
d4s16 = vqrshrn_n_s32(q2s32, 14);
|
||||
d5s16 = vqrshrn_n_s32(q6s32, 14);
|
||||
*q14s16 = vcombine_s16(d28s16, d29s16);
|
||||
|
||||
q9s32 = vaddq_s32(q4s32, q0s32);
|
||||
q10s32 = vaddq_s32(q5s32, q13s32);
|
||||
q4s32 = vsubq_s32(q4s32, q0s32);
|
||||
q5s32 = vsubq_s32(q5s32, q13s32);
|
||||
|
||||
d30s16 = vdup_n_s16((int16_t)cospi_8_64);
|
||||
d31s16 = vdup_n_s16((int16_t)cospi_24_64);
|
||||
|
||||
d18s16 = vqrshrn_n_s32(q9s32, 14);
|
||||
d19s16 = vqrshrn_n_s32(q10s32, 14);
|
||||
d8s16 = vqrshrn_n_s32(q4s32, 14);
|
||||
d9s16 = vqrshrn_n_s32(q5s32, 14);
|
||||
*q9s16 = vcombine_s16(d18s16, d19s16);
|
||||
|
||||
q5s32 = vmull_s16(d2s16, d30s16);
|
||||
q6s32 = vmull_s16(d3s16, d30s16);
|
||||
q7s32 = vmull_s16(d2s16, d31s16);
|
||||
q0s32 = vmull_s16(d3s16, d31s16);
|
||||
|
||||
q5s32 = vmlal_s16(q5s32, d6s16, d31s16);
|
||||
q6s32 = vmlal_s16(q6s32, d7s16, d31s16);
|
||||
q7s32 = vmlsl_s16(q7s32, d6s16, d30s16);
|
||||
q0s32 = vmlsl_s16(q0s32, d7s16, d30s16);
|
||||
|
||||
q1s32 = vmull_s16(d4s16, d30s16);
|
||||
q3s32 = vmull_s16(d5s16, d30s16);
|
||||
q10s32 = vmull_s16(d4s16, d31s16);
|
||||
q2s32 = vmull_s16(d5s16, d31s16);
|
||||
|
||||
q1s32 = vmlsl_s16(q1s32, d8s16, d31s16);
|
||||
q3s32 = vmlsl_s16(q3s32, d9s16, d31s16);
|
||||
q10s32 = vmlal_s16(q10s32, d8s16, d30s16);
|
||||
q2s32 = vmlal_s16(q2s32, d9s16, d30s16);
|
||||
|
||||
*q8s16 = vaddq_s16(*q11s16, *q9s16);
|
||||
*q11s16 = vsubq_s16(*q11s16, *q9s16);
|
||||
q4s16 = vaddq_s16(*q12s16, *q14s16);
|
||||
*q12s16 = vsubq_s16(*q12s16, *q14s16);
|
||||
|
||||
q14s32 = vaddq_s32(q5s32, q1s32);
|
||||
q15s32 = vaddq_s32(q6s32, q3s32);
|
||||
q5s32 = vsubq_s32(q5s32, q1s32);
|
||||
q6s32 = vsubq_s32(q6s32, q3s32);
|
||||
|
||||
d18s16 = vqrshrn_n_s32(q14s32, 14);
|
||||
d19s16 = vqrshrn_n_s32(q15s32, 14);
|
||||
d10s16 = vqrshrn_n_s32(q5s32, 14);
|
||||
d11s16 = vqrshrn_n_s32(q6s32, 14);
|
||||
*q9s16 = vcombine_s16(d18s16, d19s16);
|
||||
|
||||
q1s32 = vaddq_s32(q7s32, q10s32);
|
||||
q3s32 = vaddq_s32(q0s32, q2s32);
|
||||
q7s32 = vsubq_s32(q7s32, q10s32);
|
||||
q0s32 = vsubq_s32(q0s32, q2s32);
|
||||
|
||||
d28s16 = vqrshrn_n_s32(q1s32, 14);
|
||||
d29s16 = vqrshrn_n_s32(q3s32, 14);
|
||||
d14s16 = vqrshrn_n_s32(q7s32, 14);
|
||||
d15s16 = vqrshrn_n_s32(q0s32, 14);
|
||||
*q14s16 = vcombine_s16(d28s16, d29s16);
|
||||
|
||||
d30s16 = vdup_n_s16((int16_t)cospi_16_64);
|
||||
|
||||
d22s16 = vget_low_s16(*q11s16);
|
||||
d23s16 = vget_high_s16(*q11s16);
|
||||
q2s32 = vmull_s16(d22s16, d30s16);
|
||||
q3s32 = vmull_s16(d23s16, d30s16);
|
||||
q13s32 = vmull_s16(d22s16, d30s16);
|
||||
q1s32 = vmull_s16(d23s16, d30s16);
|
||||
|
||||
d24s16 = vget_low_s16(*q12s16);
|
||||
d25s16 = vget_high_s16(*q12s16);
|
||||
q2s32 = vmlal_s16(q2s32, d24s16, d30s16);
|
||||
q3s32 = vmlal_s16(q3s32, d25s16, d30s16);
|
||||
q13s32 = vmlsl_s16(q13s32, d24s16, d30s16);
|
||||
q1s32 = vmlsl_s16(q1s32, d25s16, d30s16);
|
||||
|
||||
d4s16 = vqrshrn_n_s32(q2s32, 14);
|
||||
d5s16 = vqrshrn_n_s32(q3s32, 14);
|
||||
d24s16 = vqrshrn_n_s32(q13s32, 14);
|
||||
d25s16 = vqrshrn_n_s32(q1s32, 14);
|
||||
q2s16 = vcombine_s16(d4s16, d5s16);
|
||||
*q12s16 = vcombine_s16(d24s16, d25s16);
|
||||
|
||||
q13s32 = vmull_s16(d10s16, d30s16);
|
||||
q1s32 = vmull_s16(d11s16, d30s16);
|
||||
q11s32 = vmull_s16(d10s16, d30s16);
|
||||
q0s32 = vmull_s16(d11s16, d30s16);
|
||||
|
||||
q13s32 = vmlal_s16(q13s32, d14s16, d30s16);
|
||||
q1s32 = vmlal_s16(q1s32, d15s16, d30s16);
|
||||
q11s32 = vmlsl_s16(q11s32, d14s16, d30s16);
|
||||
q0s32 = vmlsl_s16(q0s32, d15s16, d30s16);
|
||||
|
||||
d20s16 = vqrshrn_n_s32(q13s32, 14);
|
||||
d21s16 = vqrshrn_n_s32(q1s32, 14);
|
||||
d12s16 = vqrshrn_n_s32(q11s32, 14);
|
||||
d13s16 = vqrshrn_n_s32(q0s32, 14);
|
||||
*q10s16 = vcombine_s16(d20s16, d21s16);
|
||||
q6s16 = vcombine_s16(d12s16, d13s16);
|
||||
|
||||
q5s16 = vdupq_n_s16(0);
|
||||
|
||||
*q9s16 = vsubq_s16(q5s16, *q9s16);
|
||||
*q11s16 = vsubq_s16(q5s16, q2s16);
|
||||
*q13s16 = vsubq_s16(q5s16, q6s16);
|
||||
*q15s16 = vsubq_s16(q5s16, q4s16);
|
||||
return;
|
||||
}
|
||||
|
||||
void av1_iht8x8_64_add_neon(const tran_low_t *input, uint8_t *dest,
|
||||
int dest_stride, int tx_type) {
|
||||
int i;
|
||||
uint8_t *d1, *d2;
|
||||
uint8x8_t d0u8, d1u8, d2u8, d3u8;
|
||||
uint64x1_t d0u64, d1u64, d2u64, d3u64;
|
||||
int16x8_t q8s16, q9s16, q10s16, q11s16, q12s16, q13s16, q14s16, q15s16;
|
||||
uint16x8_t q8u16, q9u16, q10u16, q11u16;
|
||||
|
||||
q8s16 = vld1q_s16(input);
|
||||
q9s16 = vld1q_s16(input + 8);
|
||||
q10s16 = vld1q_s16(input + 8 * 2);
|
||||
q11s16 = vld1q_s16(input + 8 * 3);
|
||||
q12s16 = vld1q_s16(input + 8 * 4);
|
||||
q13s16 = vld1q_s16(input + 8 * 5);
|
||||
q14s16 = vld1q_s16(input + 8 * 6);
|
||||
q15s16 = vld1q_s16(input + 8 * 7);
|
||||
|
||||
TRANSPOSE8X8(&q8s16, &q9s16, &q10s16, &q11s16, &q12s16, &q13s16, &q14s16,
|
||||
&q15s16);
|
||||
|
||||
switch (tx_type) {
|
||||
case 0: // idct_idct is not supported. Fall back to C
|
||||
av1_iht8x8_64_add_c(input, dest, dest_stride, tx_type);
|
||||
return;
|
||||
break;
|
||||
case 1: // iadst_idct
|
||||
// generate IDCT constants
|
||||
// GENERATE_IDCT_CONSTANTS
|
||||
|
||||
// first transform rows
|
||||
IDCT8x8_1D(&q8s16, &q9s16, &q10s16, &q11s16, &q12s16, &q13s16, &q14s16,
|
||||
&q15s16);
|
||||
|
||||
// transpose the matrix
|
||||
TRANSPOSE8X8(&q8s16, &q9s16, &q10s16, &q11s16, &q12s16, &q13s16, &q14s16,
|
||||
&q15s16);
|
||||
|
||||
// generate IADST constants
|
||||
// GENERATE_IADST_CONSTANTS
|
||||
|
||||
// then transform columns
|
||||
IADST8X8_1D(&q8s16, &q9s16, &q10s16, &q11s16, &q12s16, &q13s16, &q14s16,
|
||||
&q15s16);
|
||||
break;
|
||||
case 2: // idct_iadst
|
||||
// generate IADST constants
|
||||
// GENERATE_IADST_CONSTANTS
|
||||
|
||||
// first transform rows
|
||||
IADST8X8_1D(&q8s16, &q9s16, &q10s16, &q11s16, &q12s16, &q13s16, &q14s16,
|
||||
&q15s16);
|
||||
|
||||
// transpose the matrix
|
||||
TRANSPOSE8X8(&q8s16, &q9s16, &q10s16, &q11s16, &q12s16, &q13s16, &q14s16,
|
||||
&q15s16);
|
||||
|
||||
// generate IDCT constants
|
||||
// GENERATE_IDCT_CONSTANTS
|
||||
|
||||
// then transform columns
|
||||
IDCT8x8_1D(&q8s16, &q9s16, &q10s16, &q11s16, &q12s16, &q13s16, &q14s16,
|
||||
&q15s16);
|
||||
break;
|
||||
case 3: // iadst_iadst
|
||||
// generate IADST constants
|
||||
// GENERATE_IADST_CONSTANTS
|
||||
|
||||
// first transform rows
|
||||
IADST8X8_1D(&q8s16, &q9s16, &q10s16, &q11s16, &q12s16, &q13s16, &q14s16,
|
||||
&q15s16);
|
||||
|
||||
// transpose the matrix
|
||||
TRANSPOSE8X8(&q8s16, &q9s16, &q10s16, &q11s16, &q12s16, &q13s16, &q14s16,
|
||||
&q15s16);
|
||||
|
||||
// then transform columns
|
||||
IADST8X8_1D(&q8s16, &q9s16, &q10s16, &q11s16, &q12s16, &q13s16, &q14s16,
|
||||
&q15s16);
|
||||
break;
|
||||
default: // iadst_idct
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
|
||||
q8s16 = vrshrq_n_s16(q8s16, 5);
|
||||
q9s16 = vrshrq_n_s16(q9s16, 5);
|
||||
q10s16 = vrshrq_n_s16(q10s16, 5);
|
||||
q11s16 = vrshrq_n_s16(q11s16, 5);
|
||||
q12s16 = vrshrq_n_s16(q12s16, 5);
|
||||
q13s16 = vrshrq_n_s16(q13s16, 5);
|
||||
q14s16 = vrshrq_n_s16(q14s16, 5);
|
||||
q15s16 = vrshrq_n_s16(q15s16, 5);
|
||||
|
||||
for (d1 = d2 = dest, i = 0; i < 2; i++) {
|
||||
if (i != 0) {
|
||||
q8s16 = q12s16;
|
||||
q9s16 = q13s16;
|
||||
q10s16 = q14s16;
|
||||
q11s16 = q15s16;
|
||||
}
|
||||
|
||||
d0u64 = vld1_u64((uint64_t *)d1);
|
||||
d1 += dest_stride;
|
||||
d1u64 = vld1_u64((uint64_t *)d1);
|
||||
d1 += dest_stride;
|
||||
d2u64 = vld1_u64((uint64_t *)d1);
|
||||
d1 += dest_stride;
|
||||
d3u64 = vld1_u64((uint64_t *)d1);
|
||||
d1 += dest_stride;
|
||||
|
||||
q8u16 = vaddw_u8(vreinterpretq_u16_s16(q8s16), vreinterpret_u8_u64(d0u64));
|
||||
q9u16 = vaddw_u8(vreinterpretq_u16_s16(q9s16), vreinterpret_u8_u64(d1u64));
|
||||
q10u16 =
|
||||
vaddw_u8(vreinterpretq_u16_s16(q10s16), vreinterpret_u8_u64(d2u64));
|
||||
q11u16 =
|
||||
vaddw_u8(vreinterpretq_u16_s16(q11s16), vreinterpret_u8_u64(d3u64));
|
||||
|
||||
d0u8 = vqmovun_s16(vreinterpretq_s16_u16(q8u16));
|
||||
d1u8 = vqmovun_s16(vreinterpretq_s16_u16(q9u16));
|
||||
d2u8 = vqmovun_s16(vreinterpretq_s16_u16(q10u16));
|
||||
d3u8 = vqmovun_s16(vreinterpretq_s16_u16(q11u16));
|
||||
|
||||
vst1_u64((uint64_t *)d2, vreinterpret_u64_u8(d0u8));
|
||||
d2 += dest_stride;
|
||||
vst1_u64((uint64_t *)d2, vreinterpret_u64_u8(d1u8));
|
||||
d2 += dest_stride;
|
||||
vst1_u64((uint64_t *)d2, vreinterpret_u64_u8(d2u8));
|
||||
d2 += dest_stride;
|
||||
vst1_u64((uint64_t *)d2, vreinterpret_u64_u8(d3u8));
|
||||
d2 += dest_stride;
|
||||
}
|
||||
return;
|
||||
}
|
||||
2312
third_party/aom/av1/common/av1_fwd_txfm1d.c
vendored
Normal file
2312
third_party/aom/av1/common/av1_fwd_txfm1d.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
45
third_party/aom/av1/common/av1_fwd_txfm1d.h
vendored
Normal file
45
third_party/aom/av1/common/av1_fwd_txfm1d.h
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* 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_TXFM1D_H_
|
||||
#define AV1_FWD_TXFM1D_H_
|
||||
|
||||
#include "av1/common/av1_txfm.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void av1_fdct4_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
|
||||
const int8_t *stage_range);
|
||||
void av1_fdct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
|
||||
const int8_t *stage_range);
|
||||
void av1_fdct16_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
void av1_fdct32_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
void av1_fdct64_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
|
||||
void av1_fadst4_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
void av1_fadst8_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // AV1_FWD_TXFM1D_H_
|
||||
230
third_party/aom/av1/common/av1_fwd_txfm2d.c
vendored
Normal file
230
third_party/aom/av1/common/av1_fwd_txfm2d.c
vendored
Normal file
|
|
@ -0,0 +1,230 @@
|
|||
/*
|
||||
* 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 "./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_txfm.h"
|
||||
|
||||
static INLINE TxfmFunc fwd_txfm_type_to_func(TXFM_TYPE txfm_type) {
|
||||
switch (txfm_type) {
|
||||
case TXFM_TYPE_DCT4: return av1_fdct4_new;
|
||||
case TXFM_TYPE_DCT8: return av1_fdct8_new;
|
||||
case TXFM_TYPE_DCT16: return av1_fdct16_new;
|
||||
case TXFM_TYPE_DCT32: return av1_fdct32_new;
|
||||
case TXFM_TYPE_ADST4: return av1_fadst4_new;
|
||||
case TXFM_TYPE_ADST8: return av1_fadst8_new;
|
||||
case TXFM_TYPE_ADST16: return av1_fadst16_new;
|
||||
case TXFM_TYPE_ADST32: return av1_fadst32_new;
|
||||
default: assert(0); return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
// use output buffer as temp buffer
|
||||
int32_t *temp_in = output;
|
||||
int32_t *temp_out = output + txfm_size;
|
||||
|
||||
// Columns
|
||||
for (c = 0; c < txfm_size; ++c) {
|
||||
if (cfg->ud_flip == 0) {
|
||||
for (r = 0; r < txfm_size; ++r) temp_in[r] = input[r * stride + c];
|
||||
} else {
|
||||
for (r = 0; r < txfm_size; ++r)
|
||||
// flip upside down
|
||||
temp_in[r] = input[(txfm_size - r - 1) * stride + c];
|
||||
}
|
||||
round_shift_array(temp_in, txfm_size, -shift[0]);
|
||||
txfm_func_col(temp_in, temp_out, cos_bit_col, stage_range_col);
|
||||
round_shift_array(temp_out, txfm_size, -shift[1]);
|
||||
if (cfg->lr_flip == 0) {
|
||||
for (r = 0; r < txfm_size; ++r) buf[r * txfm_size + c] = temp_out[r];
|
||||
} else {
|
||||
for (r = 0; r < txfm_size; ++r)
|
||||
// flip from left to right
|
||||
buf[r * txfm_size + (txfm_size - c - 1)] = temp_out[r];
|
||||
}
|
||||
}
|
||||
|
||||
// Rows
|
||||
for (r = 0; r < txfm_size; ++r) {
|
||||
txfm_func_row(buf + r * txfm_size, output + r * txfm_size, cos_bit_row,
|
||||
stage_range_row);
|
||||
round_shift_array(output + r * txfm_size, txfm_size, -shift[2]);
|
||||
}
|
||||
}
|
||||
|
||||
void av1_fwd_txfm2d_4x4_c(const int16_t *input, int32_t *output, int stride,
|
||||
int tx_type, int bd) {
|
||||
int32_t txfm_buf[4 * 4];
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_4X4);
|
||||
(void)bd;
|
||||
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf);
|
||||
}
|
||||
|
||||
void av1_fwd_txfm2d_8x8_c(const int16_t *input, int32_t *output, int stride,
|
||||
int tx_type, int bd) {
|
||||
int32_t txfm_buf[8 * 8];
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_8X8);
|
||||
(void)bd;
|
||||
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf);
|
||||
}
|
||||
|
||||
void av1_fwd_txfm2d_16x16_c(const int16_t *input, int32_t *output, int stride,
|
||||
int tx_type, int bd) {
|
||||
int32_t txfm_buf[16 * 16];
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_16X16);
|
||||
(void)bd;
|
||||
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf);
|
||||
}
|
||||
|
||||
void av1_fwd_txfm2d_32x32_c(const int16_t *input, int32_t *output, int stride,
|
||||
int tx_type, int bd) {
|
||||
int32_t txfm_buf[32 * 32];
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_cfg(tx_type, TX_32X32);
|
||||
(void)bd;
|
||||
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf);
|
||||
}
|
||||
|
||||
void av1_fwd_txfm2d_64x64_c(const int16_t *input, int32_t *output, int stride,
|
||||
int tx_type, int bd) {
|
||||
int32_t txfm_buf[64 * 64];
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_fwd_txfm_64x64_cfg(tx_type);
|
||||
(void)bd;
|
||||
fwd_txfm2d_c(input, output, stride, &cfg, txfm_buf);
|
||||
}
|
||||
|
||||
#if CONFIG_EXT_TX
|
||||
static const TXFM_2D_CFG *fwd_txfm_cfg_ls[FLIPADST_ADST + 1][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 },
|
||||
{
|
||||
#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 },
|
||||
};
|
||||
#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];
|
||||
return cfg;
|
||||
}
|
||||
|
||||
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.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;
|
||||
assert(0);
|
||||
}
|
||||
return cfg;
|
||||
}
|
||||
444
third_party/aom/av1/common/av1_fwd_txfm2d_cfg.h
vendored
Normal file
444
third_party/aom/av1/common/av1_fwd_txfm2d_cfg.h
vendored
Normal file
|
|
@ -0,0 +1,444 @@
|
|||
/*
|
||||
* 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_
|
||||
2334
third_party/aom/av1/common/av1_inv_txfm1d.c
vendored
Normal file
2334
third_party/aom/av1/common/av1_inv_txfm1d.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
45
third_party/aom/av1/common/av1_inv_txfm1d.h
vendored
Normal file
45
third_party/aom/av1/common/av1_inv_txfm1d.h
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* 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_TXFM1D_H_
|
||||
#define AV1_INV_TXFM1D_H_
|
||||
|
||||
#include "av1/common/av1_txfm.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void av1_idct4_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
|
||||
const int8_t *stage_range);
|
||||
void av1_idct8_new(const int32_t *input, int32_t *output, const int8_t *cos_bit,
|
||||
const int8_t *stage_range);
|
||||
void av1_idct16_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
void av1_idct32_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
void av1_idct64_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
|
||||
void av1_iadst4_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
void av1_iadst8_new(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // AV1_INV_TXFM1D_H_
|
||||
256
third_party/aom/av1/common/av1_inv_txfm2d.c
vendored
Normal file
256
third_party/aom/av1/common/av1_inv_txfm2d.c
vendored
Normal file
|
|
@ -0,0 +1,256 @@
|
|||
/*
|
||||
* 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 "./av1_rtcd.h"
|
||||
#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"
|
||||
|
||||
static INLINE TxfmFunc inv_txfm_type_to_func(TXFM_TYPE txfm_type) {
|
||||
switch (txfm_type) {
|
||||
case TXFM_TYPE_DCT4: return av1_idct4_new;
|
||||
case TXFM_TYPE_DCT8: return av1_idct8_new;
|
||||
case TXFM_TYPE_DCT16: return av1_idct16_new;
|
||||
case TXFM_TYPE_DCT32: return av1_idct32_new;
|
||||
case TXFM_TYPE_ADST4: return av1_iadst4_new;
|
||||
case TXFM_TYPE_ADST8: return av1_iadst8_new;
|
||||
case TXFM_TYPE_ADST16: return av1_iadst16_new;
|
||||
case TXFM_TYPE_ADST32: return av1_iadst32_new;
|
||||
default: assert(0); return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
const TXFM_2D_CFG *inv_txfm_cfg_ls[TX_TYPES][TX_SIZES] = {
|
||||
// DCT_DCT
|
||||
{
|
||||
#if CONFIG_CB4X4
|
||||
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
|
||||
{
|
||||
#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 },
|
||||
// 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 },
|
||||
#if CONFIG_EXT_TX
|
||||
// FLIPADST_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 },
|
||||
// DCT_FLIPADST
|
||||
{
|
||||
#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 },
|
||||
// FLIPADST_FLIPADST
|
||||
{
|
||||
#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 },
|
||||
// ADST_FLIPADST
|
||||
{
|
||||
#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 },
|
||||
// FLIPADST_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 },
|
||||
{ // IDTX
|
||||
#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_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 },
|
||||
#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];
|
||||
return cfg;
|
||||
}
|
||||
|
||||
TXFM_2D_FLIP_CFG av1_get_inv_txfm_64x64_cfg(int tx_type) {
|
||||
TXFM_2D_FLIP_CFG cfg = { 0, 0, NULL };
|
||||
switch (tx_type) {
|
||||
case DCT_DCT:
|
||||
cfg.cfg = &inv_txfm_2d_cfg_dct_dct_64;
|
||||
set_flip_cfg(tx_type, &cfg);
|
||||
break;
|
||||
default: assert(0);
|
||||
}
|
||||
return cfg;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
// txfm_buf's length is txfm_size * txfm_size + 2 * txfm_size
|
||||
// it is used for intermediate data buffering
|
||||
int32_t *temp_in = txfm_buf;
|
||||
int32_t *temp_out = temp_in + txfm_size;
|
||||
int32_t *buf = temp_out + txfm_size;
|
||||
int32_t *buf_ptr = buf;
|
||||
int c, r;
|
||||
|
||||
// Rows
|
||||
for (r = 0; r < txfm_size; ++r) {
|
||||
txfm_func_row(input, buf_ptr, cos_bit_row, stage_range_row);
|
||||
round_shift_array(buf_ptr, txfm_size, -shift[0]);
|
||||
input += txfm_size;
|
||||
buf_ptr += txfm_size;
|
||||
}
|
||||
|
||||
// Columns
|
||||
for (c = 0; c < txfm_size; ++c) {
|
||||
if (cfg->lr_flip == 0) {
|
||||
for (r = 0; r < txfm_size; ++r) temp_in[r] = buf[r * txfm_size + c];
|
||||
} else {
|
||||
// flip left right
|
||||
for (r = 0; r < txfm_size; ++r)
|
||||
temp_in[r] = buf[r * txfm_size + (txfm_size - c - 1)];
|
||||
}
|
||||
txfm_func_col(temp_in, temp_out, cos_bit_col, stage_range_col);
|
||||
round_shift_array(temp_out, txfm_size, -shift[1]);
|
||||
if (cfg->ud_flip == 0) {
|
||||
for (r = 0; r < txfm_size; ++r) output[r * stride + c] += temp_out[r];
|
||||
} else {
|
||||
// flip upside down
|
||||
for (r = 0; r < txfm_size; ++r)
|
||||
output[r * stride + c] += temp_out[txfm_size - r - 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void inv_txfm2d_add_facade(const int32_t *input, uint16_t *output,
|
||||
int stride, int32_t *txfm_buf,
|
||||
int tx_type, int tx_size, int bd) {
|
||||
// output contains the prediction signal which is always positive and smaller
|
||||
// than (1 << bd) - 1
|
||||
// since bd < 16-1, therefore we can treat the uint16_t* output buffer as an
|
||||
// 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);
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_4x4_c(const int32_t *input, uint16_t *output,
|
||||
int stride, int tx_type, int bd) {
|
||||
int txfm_buf[4 * 4 + 4 + 4];
|
||||
inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_4X4, bd);
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_8x8_c(const int32_t *input, uint16_t *output,
|
||||
int stride, int tx_type, int bd) {
|
||||
int txfm_buf[8 * 8 + 8 + 8];
|
||||
inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_8X8, bd);
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_16x16_c(const int32_t *input, uint16_t *output,
|
||||
int stride, int tx_type, int bd) {
|
||||
int txfm_buf[16 * 16 + 16 + 16];
|
||||
inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_16X16, bd);
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_32x32_c(const int32_t *input, uint16_t *output,
|
||||
int stride, int tx_type, int bd) {
|
||||
int txfm_buf[32 * 32 + 32 + 32];
|
||||
inv_txfm2d_add_facade(input, output, stride, txfm_buf, tx_type, TX_32X32, bd);
|
||||
}
|
||||
|
||||
void av1_inv_txfm2d_add_64x64_c(const int32_t *input, uint16_t *output,
|
||||
int stride, int tx_type, int bd) {
|
||||
int txfm_buf[64 * 64 + 64 + 64];
|
||||
// output contains the prediction signal which is always positive and smaller
|
||||
// than (1 << bd) - 1
|
||||
// since bd < 16-1, therefore we can treat the uint16_t* output buffer as an
|
||||
// int16_t*
|
||||
TXFM_2D_FLIP_CFG cfg = av1_get_inv_txfm_64x64_cfg(tx_type);
|
||||
inv_txfm2d_add_c(input, (int16_t *)output, stride, &cfg, txfm_buf);
|
||||
clamp_block((int16_t *)output, 64, stride, 0, (1 << bd) - 1);
|
||||
}
|
||||
447
third_party/aom/av1/common/av1_inv_txfm2d_cfg.h
vendored
Normal file
447
third_party/aom/av1/common/av1_inv_txfm2d_cfg.h
vendored
Normal file
|
|
@ -0,0 +1,447 @@
|
|||
/*
|
||||
* 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_
|
||||
2336
third_party/aom/av1/common/av1_loopfilter.c
vendored
Normal file
2336
third_party/aom/av1/common/av1_loopfilter.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
162
third_party/aom/av1/common/av1_loopfilter.h
vendored
Normal file
162
third_party/aom/av1/common/av1_loopfilter.h
vendored
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
/*
|
||||
* 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_COMMON_LOOPFILTER_H_
|
||||
#define AV1_COMMON_LOOPFILTER_H_
|
||||
|
||||
#include "aom_ports/mem.h"
|
||||
#include "./aom_config.h"
|
||||
|
||||
#include "av1/common/blockd.h"
|
||||
#include "av1/common/seg_common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MAX_LOOP_FILTER 63
|
||||
#define MAX_SHARPNESS 7
|
||||
|
||||
#define SIMD_WIDTH 16
|
||||
|
||||
#define MAX_MODE_LF_DELTAS 2
|
||||
|
||||
enum lf_path {
|
||||
LF_PATH_420,
|
||||
LF_PATH_444,
|
||||
LF_PATH_SLOW,
|
||||
};
|
||||
|
||||
struct loopfilter {
|
||||
int filter_level;
|
||||
|
||||
int sharpness_level;
|
||||
int last_sharpness_level;
|
||||
|
||||
uint8_t mode_ref_delta_enabled;
|
||||
uint8_t mode_ref_delta_update;
|
||||
|
||||
// 0 = Intra, Last, Last2+Last3(CONFIG_EXT_REFS),
|
||||
// GF, BRF(CONFIG_EXT_REFS), ARF
|
||||
signed char ref_deltas[TOTAL_REFS_PER_FRAME];
|
||||
signed char last_ref_deltas[TOTAL_REFS_PER_FRAME];
|
||||
|
||||
// 0 = ZERO_MV, MV
|
||||
signed char mode_deltas[MAX_MODE_LF_DELTAS];
|
||||
signed char last_mode_deltas[MAX_MODE_LF_DELTAS];
|
||||
};
|
||||
|
||||
// Need to align this structure so when it is declared and
|
||||
// passed it can be loaded into vector registers.
|
||||
typedef struct {
|
||||
DECLARE_ALIGNED(SIMD_WIDTH, uint8_t, mblim[SIMD_WIDTH]);
|
||||
DECLARE_ALIGNED(SIMD_WIDTH, uint8_t, lim[SIMD_WIDTH]);
|
||||
DECLARE_ALIGNED(SIMD_WIDTH, uint8_t, hev_thr[SIMD_WIDTH]);
|
||||
} loop_filter_thresh;
|
||||
|
||||
typedef struct {
|
||||
loop_filter_thresh lfthr[MAX_LOOP_FILTER + 1];
|
||||
uint8_t lvl[MAX_SEGMENTS][TOTAL_REFS_PER_FRAME][MAX_MODE_LF_DELTAS];
|
||||
} loop_filter_info_n;
|
||||
|
||||
// This structure holds bit masks for all 8x8 blocks in a 64x64 region.
|
||||
// Each 1 bit represents a position in which we want to apply the loop filter.
|
||||
// Left_ entries refer to whether we apply a filter on the border to the
|
||||
// left of the block. Above_ entries refer to whether or not to apply a
|
||||
// filter on the above border. Int_ entries refer to whether or not to
|
||||
// apply borders on the 4x4 edges within the 8x8 block that each bit
|
||||
// represents.
|
||||
// Since each transform is accompanied by a potentially different type of
|
||||
// loop filter there is a different entry in the array for each transform size.
|
||||
typedef struct {
|
||||
uint64_t left_y[TX_SIZES];
|
||||
uint64_t above_y[TX_SIZES];
|
||||
uint64_t int_4x4_y;
|
||||
uint16_t left_uv[TX_SIZES];
|
||||
uint16_t above_uv[TX_SIZES];
|
||||
uint16_t left_int_4x4_uv;
|
||||
uint16_t above_int_4x4_uv;
|
||||
uint8_t lfl_y[MAX_MIB_SIZE][MAX_MIB_SIZE];
|
||||
uint8_t lfl_uv[MAX_MIB_SIZE / 2][MAX_MIB_SIZE / 2];
|
||||
} LOOP_FILTER_MASK;
|
||||
|
||||
/* assorted loopfilter functions which get used elsewhere */
|
||||
struct AV1Common;
|
||||
struct macroblockd;
|
||||
struct AV1LfSyncData;
|
||||
|
||||
// This function sets up the bit masks for the entire 64x64 region represented
|
||||
// by mi_row, mi_col.
|
||||
void av1_setup_mask(struct AV1Common *const cm, const int mi_row,
|
||||
const int mi_col, MODE_INFO **mi_8x8,
|
||||
const int mode_info_stride, LOOP_FILTER_MASK *lfm);
|
||||
|
||||
void av1_filter_block_plane_ss00_ver(struct AV1Common *const cm,
|
||||
struct macroblockd_plane *const plane,
|
||||
int mi_row, LOOP_FILTER_MASK *lfm);
|
||||
void av1_filter_block_plane_ss00_hor(struct AV1Common *const cm,
|
||||
struct macroblockd_plane *const plane,
|
||||
int mi_row, LOOP_FILTER_MASK *lfm);
|
||||
void av1_filter_block_plane_ss11_ver(struct AV1Common *const cm,
|
||||
struct macroblockd_plane *const plane,
|
||||
int mi_row, LOOP_FILTER_MASK *lfm);
|
||||
void av1_filter_block_plane_ss11_hor(struct AV1Common *const cm,
|
||||
struct macroblockd_plane *const plane,
|
||||
int mi_row, LOOP_FILTER_MASK *lfm);
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
void av1_loop_filter_init(struct AV1Common *cm);
|
||||
|
||||
// Update the loop filter for the current frame.
|
||||
// This should be called before av1_loop_filter_rows(),
|
||||
// av1_loop_filter_frame()
|
||||
// calls this function directly.
|
||||
void av1_loop_filter_frame_init(struct AV1Common *cm, int default_filt_lvl);
|
||||
|
||||
void av1_loop_filter_frame(YV12_BUFFER_CONFIG *frame, struct AV1Common *cm,
|
||||
struct macroblockd *mbd, int filter_level,
|
||||
int y_only, int partial_frame);
|
||||
|
||||
// Apply the loop filter to [start, stop) macro block rows in frame_buffer.
|
||||
void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer,
|
||||
struct AV1Common *cm,
|
||||
struct macroblockd_plane planes[MAX_MB_PLANE],
|
||||
int start, int stop, int y_only);
|
||||
|
||||
typedef struct LoopFilterWorkerData {
|
||||
YV12_BUFFER_CONFIG *frame_buffer;
|
||||
struct AV1Common *cm;
|
||||
struct macroblockd_plane planes[MAX_MB_PLANE];
|
||||
|
||||
int start;
|
||||
int stop;
|
||||
int y_only;
|
||||
} LFWorkerData;
|
||||
|
||||
void av1_loop_filter_data_reset(
|
||||
LFWorkerData *lf_data, YV12_BUFFER_CONFIG *frame_buffer,
|
||||
struct AV1Common *cm, const struct macroblockd_plane planes[MAX_MB_PLANE]);
|
||||
|
||||
// Operates on the rows described by 'lf_data'.
|
||||
int av1_loop_filter_worker(LFWorkerData *const lf_data, void *unused);
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // AV1_COMMON_LOOPFILTER_H_
|
||||
20
third_party/aom/av1/common/av1_rtcd.c
vendored
Normal file
20
third_party/aom/av1/common/av1_rtcd.c
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* 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"
|
||||
#define RTCD_C
|
||||
#include "./av1_rtcd.h"
|
||||
#include "aom_ports/aom_once.h"
|
||||
|
||||
void av1_rtcd() {
|
||||
// TODO(JBB): Remove this once, by insuring that both the encoder and
|
||||
// decoder setup functions are protected by once();
|
||||
once(setup_rtcd_internal);
|
||||
}
|
||||
644
third_party/aom/av1/common/av1_rtcd_defs.pl
vendored
Executable file
644
third_party/aom/av1/common/av1_rtcd_defs.pl
vendored
Executable file
|
|
@ -0,0 +1,644 @@
|
|||
sub av1_common_forward_decls() {
|
||||
print <<EOF
|
||||
/*
|
||||
* AV1
|
||||
*/
|
||||
|
||||
#include "aom/aom_integer.h"
|
||||
#include "av1/common/common.h"
|
||||
#include "av1/common/enums.h"
|
||||
#include "av1/common/quant_common.h"
|
||||
#include "av1/common/filter.h"
|
||||
#include "av1/common/convolve.h"
|
||||
#include "av1/common/av1_txfm.h"
|
||||
#include "av1/common/odintrin.h"
|
||||
|
||||
struct macroblockd;
|
||||
|
||||
/* Encoder forward decls */
|
||||
struct macroblock;
|
||||
struct aom_variance_vtable;
|
||||
struct search_site_config;
|
||||
struct mv;
|
||||
union int_mv;
|
||||
struct yv12_buffer_config;
|
||||
typedef uint16_t od_dering_in;
|
||||
EOF
|
||||
}
|
||||
forward_decls qw/av1_common_forward_decls/;
|
||||
|
||||
# functions that are 64 bit only.
|
||||
$mmx_x86_64 = $sse2_x86_64 = $ssse3_x86_64 = $avx_x86_64 = $avx2_x86_64 = '';
|
||||
if ($opts{arch} eq "x86_64") {
|
||||
$mmx_x86_64 = 'mmx';
|
||||
$sse2_x86_64 = 'sse2';
|
||||
$ssse3_x86_64 = 'ssse3';
|
||||
$avx_x86_64 = 'avx';
|
||||
$avx2_x86_64 = 'avx2';
|
||||
}
|
||||
|
||||
#
|
||||
# 10/12-tap convolution filters
|
||||
#
|
||||
add_proto qw/void av1_lowbd_convolve_init/, "void";
|
||||
specialize qw/av1_lowbd_convolve_init ssse3/;
|
||||
|
||||
add_proto qw/void av1_convolve_horiz/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams fp, const int subpel_x_q4, int x_step_q4, ConvolveParams *conv_params";
|
||||
specialize qw/av1_convolve_horiz ssse3/;
|
||||
|
||||
add_proto qw/void av1_convolve_vert/, "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams fp, const int subpel_x_q4, int x_step_q4, ConvolveParams *conv_params";
|
||||
specialize qw/av1_convolve_vert ssse3/;
|
||||
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
|
||||
add_proto qw/void av1_highbd_convolve_init/, "void";
|
||||
specialize qw/av1_highbd_convolve_init sse4_1/;
|
||||
add_proto qw/void av1_highbd_convolve_horiz/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams fp, const int subpel_x_q4, int x_step_q4, int avg, int bd";
|
||||
specialize qw/av1_highbd_convolve_horiz sse4_1/;
|
||||
add_proto qw/void av1_highbd_convolve_vert/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams fp, const int subpel_x_q4, int x_step_q4, int avg, int bd";
|
||||
specialize qw/av1_highbd_convolve_vert sse4_1/;
|
||||
}
|
||||
|
||||
#
|
||||
# Inverse dct
|
||||
#
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
|
||||
{
|
||||
add_proto qw/void av1_iht4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
specialize qw/av1_iht4x4_16_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht4x8_32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
specialize qw/av1_iht4x8_32_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht8x4_32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
specialize qw/av1_iht8x4_32_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht8x16_128_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
specialize qw/av1_iht8x16_128_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht16x8_128_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
specialize qw/av1_iht16x8_128_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht16x32_512_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
specialize qw/av1_iht16x32_512_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht32x16_512_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
specialize qw/av1_iht32x16_512_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht4x16_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
|
||||
add_proto qw/void av1_iht16x4_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
|
||||
add_proto qw/void av1_iht8x32_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
|
||||
add_proto qw/void av1_iht32x8_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
|
||||
add_proto qw/void av1_iht8x8_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
specialize qw/av1_iht8x8_64_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht16x16_256_add/, "const tran_low_t *input, uint8_t *output, int pitch, int tx_type";
|
||||
specialize qw/av1_iht16x16_256_add sse2 avx2/;
|
||||
|
||||
add_proto qw/void av1_iht32x32_1024_add/, "const tran_low_t *input, uint8_t *output, int pitch, int tx_type";
|
||||
}
|
||||
} else {
|
||||
{
|
||||
add_proto qw/void av1_iht4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
specialize qw/av1_iht4x4_16_add sse2 neon dspr2/;
|
||||
|
||||
add_proto qw/void av1_iht4x8_32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
specialize qw/av1_iht4x8_32_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht8x4_32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
specialize qw/av1_iht8x4_32_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht8x16_128_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
specialize qw/av1_iht8x16_128_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht16x8_128_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
specialize qw/av1_iht16x8_128_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht16x32_512_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
specialize qw/av1_iht16x32_512_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht32x16_512_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
specialize qw/av1_iht32x16_512_add sse2/;
|
||||
|
||||
add_proto qw/void av1_iht4x16_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
|
||||
add_proto qw/void av1_iht16x4_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
|
||||
add_proto qw/void av1_iht8x32_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
|
||||
add_proto qw/void av1_iht32x8_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
|
||||
add_proto qw/void av1_iht8x8_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type";
|
||||
specialize qw/av1_iht8x8_64_add sse2 neon dspr2/;
|
||||
|
||||
add_proto qw/void av1_iht16x16_256_add/, "const tran_low_t *input, uint8_t *output, int pitch, int tx_type";
|
||||
specialize qw/av1_iht16x16_256_add sse2 avx2 dspr2/;
|
||||
|
||||
add_proto qw/void av1_iht32x32_1024_add/, "const tran_low_t *input, uint8_t *output, int pitch, int tx_type";
|
||||
|
||||
if (aom_config("CONFIG_EXT_TX") ne "yes") {
|
||||
specialize qw/av1_iht4x4_16_add msa/;
|
||||
specialize qw/av1_iht8x8_64_add msa/;
|
||||
specialize qw/av1_iht16x16_256_add msa/;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_proto qw/void av1_iht32x32_1024_add/, "const tran_low_t *input, uint8_t *output, int pitch, int tx_type";
|
||||
|
||||
if (aom_config("CONFIG_TX64X64") eq "yes") {
|
||||
add_proto qw/void av1_iht64x64_4096_add/, "const tran_low_t *input, uint8_t *output, int pitch, int tx_type";
|
||||
}
|
||||
|
||||
if (aom_config("CONFIG_NEW_QUANT") eq "yes") {
|
||||
add_proto qw/void quantize_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
|
||||
add_proto qw/void quantize_fp_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
|
||||
add_proto qw/void quantize_32x32_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
|
||||
add_proto qw/void quantize_32x32_fp_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
|
||||
if (aom_config("CONFIG_TX64X64") eq "yes") {
|
||||
add_proto qw/void quantize_64x64_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
|
||||
add_proto qw/void quantize_64x64_fp_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
}
|
||||
}
|
||||
|
||||
# FILTER_INTRA predictor functions
|
||||
if (aom_config("CONFIG_FILTER_INTRA") eq "yes") {
|
||||
add_proto qw/void av1_dc_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, int bs, const uint8_t *above, const uint8_t *left";
|
||||
add_proto qw/void av1_v_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, int bs, const uint8_t *above, const uint8_t *left";
|
||||
add_proto qw/void av1_h_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, int bs, const uint8_t *above, const uint8_t *left";
|
||||
add_proto qw/void av1_d45_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, int bs, const uint8_t *above, const uint8_t *left";
|
||||
add_proto qw/void av1_d135_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, int bs, const uint8_t *above, const uint8_t *left";
|
||||
add_proto qw/void av1_d117_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, int bs, const uint8_t *above, const uint8_t *left";
|
||||
add_proto qw/void av1_d153_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, int bs, const uint8_t *above, const uint8_t *left";
|
||||
add_proto qw/void av1_d207_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, int bs, const uint8_t *above, const uint8_t *left";
|
||||
add_proto qw/void av1_d63_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, int bs, const uint8_t *above, const uint8_t *left";
|
||||
add_proto qw/void av1_tm_filter_predictor/, "uint8_t *dst, ptrdiff_t stride, int bs, const uint8_t *above, const uint8_t *left";
|
||||
# High bitdepth functions
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
|
||||
add_proto qw/void av1_highbd_dc_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, int bs, const uint16_t *above, const uint16_t *left, int bd";
|
||||
add_proto qw/void av1_highbd_v_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, int bs, const uint16_t *above, const uint16_t *left, int bd";
|
||||
add_proto qw/void av1_highbd_h_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, int bs, const uint16_t *above, const uint16_t *left, int bd";
|
||||
add_proto qw/void av1_highbd_d45_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, int bs, const uint16_t *above, const uint16_t *left, int bd";
|
||||
add_proto qw/void av1_highbd_d135_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, int bs, const uint16_t *above, const uint16_t *left, int bd";
|
||||
add_proto qw/void av1_highbd_d117_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, int bs, const uint16_t *above, const uint16_t *left, int bd";
|
||||
add_proto qw/void av1_highbd_d153_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, int bs, const uint16_t *above, const uint16_t *left, int bd";
|
||||
add_proto qw/void av1_highbd_d207_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, int bs, const uint16_t *above, const uint16_t *left, int bd";
|
||||
add_proto qw/void av1_highbd_d63_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, int bs, const uint16_t *above, const uint16_t *left, int bd";
|
||||
add_proto qw/void av1_highbd_tm_filter_predictor/, "uint16_t *dst, ptrdiff_t stride, int bs, const uint16_t *above, const uint16_t *left, int bd";
|
||||
}
|
||||
}
|
||||
|
||||
# High bitdepth functions
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
|
||||
#
|
||||
# Sub Pixel Filters
|
||||
#
|
||||
add_proto qw/void av1_highbd_convolve_copy/, "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 av1_highbd_convolve_avg/, "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 av1_highbd_convolve8/, "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";
|
||||
specialize qw/av1_highbd_convolve8/, "$sse2_x86_64";
|
||||
|
||||
add_proto qw/void av1_highbd_convolve8_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";
|
||||
specialize qw/av1_highbd_convolve8_horiz/, "$sse2_x86_64";
|
||||
|
||||
add_proto qw/void av1_highbd_convolve8_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";
|
||||
specialize qw/av1_highbd_convolve8_vert/, "$sse2_x86_64";
|
||||
|
||||
add_proto qw/void av1_highbd_convolve8_avg/, "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";
|
||||
specialize qw/av1_highbd_convolve8_avg/, "$sse2_x86_64";
|
||||
|
||||
add_proto qw/void av1_highbd_convolve8_avg_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";
|
||||
specialize qw/av1_highbd_convolve8_avg_horiz/, "$sse2_x86_64";
|
||||
|
||||
add_proto qw/void av1_highbd_convolve8_avg_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";
|
||||
specialize qw/av1_highbd_convolve8_avg_vert/, "$sse2_x86_64";
|
||||
|
||||
#
|
||||
# dct
|
||||
#
|
||||
add_proto qw/void av1_highbd_iht4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type, int bd";
|
||||
|
||||
add_proto qw/void av1_highbd_iht4x8_32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type, int bd";
|
||||
|
||||
add_proto qw/void av1_highbd_iht8x4_32_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type, int bd";
|
||||
|
||||
add_proto qw/void av1_highbd_iht8x16_128_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type, int bd";
|
||||
|
||||
add_proto qw/void av1_highbd_iht16x8_128_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type, int bd";
|
||||
|
||||
add_proto qw/void av1_highbd_iht16x32_512_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type, int bd";
|
||||
|
||||
add_proto qw/void av1_highbd_iht32x16_512_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type, int bd";
|
||||
|
||||
add_proto qw/void av1_highbd_iht4x16_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type, int bd";
|
||||
|
||||
add_proto qw/void av1_highbd_iht16x4_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type, int bd";
|
||||
|
||||
add_proto qw/void av1_highbd_iht8x32_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type, int bd";
|
||||
|
||||
add_proto qw/void av1_highbd_iht32x8_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type, int bd";
|
||||
|
||||
add_proto qw/void av1_highbd_iht8x8_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int tx_type, int bd";
|
||||
|
||||
add_proto qw/void av1_highbd_iht16x16_256_add/, "const tran_low_t *input, uint8_t *output, int pitch, int tx_type, int bd";
|
||||
}
|
||||
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
|
||||
#inv txfm
|
||||
add_proto qw/void av1_inv_txfm2d_add_4x4/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd";
|
||||
specialize qw/av1_inv_txfm2d_add_4x4 sse4_1/;
|
||||
add_proto qw/void av1_inv_txfm2d_add_8x8/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd";
|
||||
specialize qw/av1_inv_txfm2d_add_8x8 sse4_1/;
|
||||
add_proto qw/void av1_inv_txfm2d_add_16x16/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd";
|
||||
specialize qw/av1_inv_txfm2d_add_16x16 sse4_1/;
|
||||
add_proto qw/void av1_inv_txfm2d_add_32x32/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd";
|
||||
specialize qw/av1_inv_txfm2d_add_32x32 avx2/;
|
||||
add_proto qw/void av1_inv_txfm2d_add_64x64/, "const int32_t *input, uint16_t *output, int stride, int tx_type, int bd";
|
||||
}
|
||||
|
||||
#
|
||||
# Encoder functions below this point.
|
||||
#
|
||||
if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
|
||||
|
||||
# ENCODEMB INVOKE
|
||||
|
||||
if (aom_config("CONFIG_AOM_QM") eq "yes") {
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
|
||||
# the transform coefficients are held in 32-bit
|
||||
# values, so the assembler code for av1_block_error can no longer be used.
|
||||
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, const qm_val_t * qm_ptr, const qm_val_t *iqm_ptr";
|
||||
|
||||
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, const qm_val_t * qm_ptr, const qm_val_t *iqm_ptr";
|
||||
|
||||
if (aom_config("CONFIG_TX64X64") eq "yes") {
|
||||
add_proto qw/void av1_quantize_fp_64x64/, "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, const qm_val_t * qm_ptr, const qm_val_t *iqm_ptr";
|
||||
}
|
||||
|
||||
add_proto qw/void av1_fdct8x8_quant/, "const int16_t *input, int stride, 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, const qm_val_t * qm_ptr, const qm_val_t *iqm_ptr";
|
||||
} else {
|
||||
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";
|
||||
specialize qw/av1_block_error avx2 msa/, "$sse2_x86inc";
|
||||
|
||||
add_proto qw/int64_t av1_block_error_fp/, "const int16_t *coeff, const int16_t *dqcoeff, int block_size";
|
||||
specialize qw/av1_block_error_fp neon/, "$sse2_x86inc";
|
||||
|
||||
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, const qm_val_t * qm_ptr, const qm_val_t *iqm_ptr";
|
||||
|
||||
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, const qm_val_t * qm_ptr, const qm_val_t *iqm_ptr";
|
||||
|
||||
if (aom_config("CONFIG_TX64X64") eq "yes") {
|
||||
add_proto qw/void av1_quantize_fp_64x64/, "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, const qm_val_t * qm_ptr, const qm_val_t *iqm_ptr";
|
||||
}
|
||||
|
||||
add_proto qw/void av1_fdct8x8_quant/, "const int16_t *input, int stride, 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, const qm_val_t * qm_ptr, const qm_val_t *iqm_ptr";
|
||||
}
|
||||
} else {
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
|
||||
# the transform coefficients are held in 32-bit
|
||||
# values, so the assembler code for av1_block_error can no longer be used.
|
||||
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";
|
||||
|
||||
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";
|
||||
|
||||
if (aom_config("CONFIG_TX64X64") eq "yes") {
|
||||
add_proto qw/void av1_quantize_fp_64x64/, "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";
|
||||
}
|
||||
|
||||
add_proto qw/void av1_fdct8x8_quant/, "const int16_t *input, int stride, 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";
|
||||
} else {
|
||||
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";
|
||||
specialize qw/av1_block_error sse2 avx2 msa/;
|
||||
|
||||
add_proto qw/int64_t av1_block_error_fp/, "const int16_t *coeff, const int16_t *dqcoeff, int block_size";
|
||||
specialize qw/av1_block_error_fp neon sse2/;
|
||||
|
||||
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 neon sse2/, "$ssse3_x86_64";
|
||||
|
||||
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";
|
||||
specialize qw/av1_quantize_fp_32x32/, "$ssse3_x86_64";
|
||||
|
||||
if (aom_config("CONFIG_TX64X64") eq "yes") {
|
||||
add_proto qw/void av1_quantize_fp_64x64/, "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";
|
||||
}
|
||||
|
||||
add_proto qw/void av1_fdct8x8_quant/, "const int16_t *input, int stride, 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_fdct8x8_quant sse2 ssse3 neon/;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# fdct functions
|
||||
|
||||
add_proto qw/void av1_fht4x4/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
specialize qw/av1_fht4x4 sse2/;
|
||||
|
||||
add_proto qw/void av1_fwht4x4/, "const int16_t *input, tran_low_t *output, int stride";
|
||||
|
||||
add_proto qw/void av1_fht8x8/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
specialize qw/av1_fht8x8 sse2/;
|
||||
|
||||
add_proto qw/void av1_fht16x16/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
specialize qw/av1_fht16x16 sse2 avx2/;
|
||||
|
||||
add_proto qw/void av1_fht32x32/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
specialize qw/av1_fht32x32 sse2 avx2/;
|
||||
|
||||
if (aom_config("CONFIG_TX64X64") eq "yes") {
|
||||
add_proto qw/void av1_fht64x64/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
}
|
||||
|
||||
add_proto qw/void av1_fht4x8/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
specialize qw/av1_fht4x8 sse2/;
|
||||
|
||||
add_proto qw/void av1_fht8x4/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
specialize qw/av1_fht8x4 sse2/;
|
||||
|
||||
add_proto qw/void av1_fht8x16/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
specialize qw/av1_fht8x16 sse2/;
|
||||
|
||||
add_proto qw/void av1_fht16x8/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
specialize qw/av1_fht16x8 sse2/;
|
||||
|
||||
add_proto qw/void av1_fht16x32/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
specialize qw/av1_fht16x32 sse2/;
|
||||
|
||||
add_proto qw/void av1_fht32x16/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
specialize qw/av1_fht32x16 sse2/;
|
||||
|
||||
add_proto qw/void av1_fht4x16/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
|
||||
add_proto qw/void av1_fht16x4/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
|
||||
add_proto qw/void av1_fht8x32/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
|
||||
add_proto qw/void av1_fht32x8/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") ne "yes") {
|
||||
if (aom_config("CONFIG_EXT_TX") ne "yes") {
|
||||
specialize qw/av1_fht4x4 msa/;
|
||||
specialize qw/av1_fht8x8 msa/;
|
||||
specialize qw/av1_fht16x16 msa/;
|
||||
}
|
||||
}
|
||||
|
||||
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_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";
|
||||
specialize qw/av1_fwd_txfm2d_4x4 sse4_1/;
|
||||
add_proto qw/void av1_fwd_txfm2d_8x8/, "const int16_t *input, int32_t *output, int stride, int tx_type, int bd";
|
||||
specialize qw/av1_fwd_txfm2d_8x8 sse4_1/;
|
||||
add_proto qw/void av1_fwd_txfm2d_16x16/, "const int16_t *input, int32_t *output, int stride, int tx_type, int bd";
|
||||
specialize qw/av1_fwd_txfm2d_16x16 sse4_1/;
|
||||
add_proto qw/void av1_fwd_txfm2d_32x32/, "const int16_t *input, int32_t *output, int stride, int tx_type, int bd";
|
||||
specialize qw/av1_fwd_txfm2d_32x32 sse4_1/;
|
||||
add_proto qw/void av1_fwd_txfm2d_64x64/, "const int16_t *input, int32_t *output, int stride, int tx_type, int bd";
|
||||
specialize qw/av1_fwd_txfm2d_64x64 sse4_1/;
|
||||
}
|
||||
|
||||
#
|
||||
# Motion search
|
||||
#
|
||||
add_proto qw/int av1_full_search_sad/, "const struct macroblock *x, const struct mv *ref_mv, int sad_per_bit, int distance, const struct aom_variance_vtable *fn_ptr, const struct mv *center_mv, struct mv *best_mv";
|
||||
specialize qw/av1_full_search_sad sse3 sse4_1/;
|
||||
$av1_full_search_sad_sse3=av1_full_search_sadx3;
|
||||
$av1_full_search_sad_sse4_1=av1_full_search_sadx8;
|
||||
|
||||
add_proto qw/int av1_diamond_search_sad/, "struct macroblock *x, const struct search_site_config *cfg, struct mv *ref_mv, struct mv *best_mv, int search_param, int sad_per_bit, int *num00, const struct aom_variance_vtable *fn_ptr, const struct mv *center_mv";
|
||||
|
||||
add_proto qw/int av1_full_range_search/, "const struct macroblock *x, const struct search_site_config *cfg, struct mv *ref_mv, struct mv *best_mv, int search_param, int sad_per_bit, int *num00, const struct aom_variance_vtable *fn_ptr, const struct mv *center_mv";
|
||||
|
||||
add_proto qw/void av1_temporal_filter_apply/, "uint8_t *frame1, unsigned int stride, uint8_t *frame2, unsigned int block_width, unsigned int block_height, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count";
|
||||
specialize qw/av1_temporal_filter_apply sse2 msa/;
|
||||
|
||||
if (aom_config("CONFIG_AOM_QM") eq "yes") {
|
||||
add_proto qw/void av1_quantize_b/, "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, const qm_val_t * qm_ptr, const qm_val_t * iqm_ptr, int log_scale";
|
||||
} else {
|
||||
add_proto qw/void av1_quantize_b/, "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, int log_scale";
|
||||
}
|
||||
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
|
||||
|
||||
# ENCODEMB INVOKE
|
||||
if (aom_config("CONFIG_NEW_QUANT") eq "yes") {
|
||||
add_proto qw/void highbd_quantize_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
|
||||
add_proto qw/void highbd_quantize_fp_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
|
||||
add_proto qw/void highbd_quantize_32x32_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
|
||||
add_proto qw/void highbd_quantize_32x32_fp_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
|
||||
if (aom_config("CONFIG_TX64X64") eq "yes") {
|
||||
add_proto qw/void highbd_quantize_64x64_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
|
||||
add_proto qw/void highbd_quantize_64x64_fp_nuq/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *quant_ptr, const int16_t *dequant_ptr, const cuml_bins_type_nuq *cuml_bins_ptr, const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan, const uint8_t *band";
|
||||
}
|
||||
}
|
||||
|
||||
add_proto qw/int64_t av1_highbd_block_error/, "const tran_low_t *coeff, const tran_low_t *dqcoeff, intptr_t block_size, int64_t *ssz, int bd";
|
||||
specialize qw/av1_highbd_block_error sse2/;
|
||||
|
||||
if (aom_config("CONFIG_AOM_QM") eq "yes") {
|
||||
add_proto qw/void av1_highbd_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, const qm_val_t * qm_ptr, const qm_val_t * iqm_ptr, int log_scale";
|
||||
|
||||
add_proto qw/void av1_highbd_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, const qm_val_t * qm_ptr, const qm_val_t * iqm_ptr, int log_scale";
|
||||
|
||||
if (aom_config("CONFIG_TX64X64") eq "yes") {
|
||||
add_proto qw/void av1_highbd_quantize_fp_64x64/, "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, const qm_val_t * qm_ptr, const qm_val_t * iqm_ptr, int log_scale";
|
||||
}
|
||||
|
||||
add_proto qw/void av1_highbd_quantize_b/, "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, const qm_val_t * qm_ptr, const qm_val_t * iqm_ptr, int log_scale";
|
||||
} else {
|
||||
add_proto qw/void av1_highbd_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, int log_scale";
|
||||
specialize qw/av1_highbd_quantize_fp sse4_1/;
|
||||
|
||||
add_proto qw/void av1_highbd_quantize_b/, "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, int log_scale";
|
||||
}
|
||||
|
||||
# fdct functions
|
||||
add_proto qw/void av1_highbd_fht4x4/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
specialize qw/av1_highbd_fht4x4 sse4_1/;
|
||||
|
||||
add_proto qw/void av1_highbd_fht4x8/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
|
||||
add_proto qw/void av1_highbd_fht8x4/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
|
||||
add_proto qw/void av1_highbd_fht8x16/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
|
||||
add_proto qw/void av1_highbd_fht16x8/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
|
||||
add_proto qw/void av1_highbd_fht16x32/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
|
||||
add_proto qw/void av1_highbd_fht32x16/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
|
||||
add_proto qw/void av1_highbd_fht4x16/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
|
||||
add_proto qw/void av1_highbd_fht16x4/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
|
||||
add_proto qw/void av1_highbd_fht8x32/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
|
||||
add_proto qw/void av1_highbd_fht32x8/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
|
||||
add_proto qw/void av1_highbd_fht8x8/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
|
||||
add_proto qw/void av1_highbd_fht16x16/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
|
||||
add_proto qw/void av1_highbd_fht32x32/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
|
||||
if (aom_config("CONFIG_TX64X64") eq "yes") {
|
||||
add_proto qw/void av1_highbd_fht64x64/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
}
|
||||
|
||||
add_proto qw/void av1_highbd_fwht4x4/, "const int16_t *input, tran_low_t *output, int stride";
|
||||
|
||||
add_proto qw/void av1_highbd_temporal_filter_apply/, "uint8_t *frame1, unsigned int stride, uint8_t *frame2, unsigned int block_width, unsigned int block_height, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count";
|
||||
|
||||
}
|
||||
# End av1_high encoder functions
|
||||
|
||||
if (aom_config("CONFIG_EXT_INTER") eq "yes") {
|
||||
add_proto qw/uint64_t av1_wedge_sse_from_residuals/, "const int16_t *r1, const int16_t *d, const uint8_t *m, int N";
|
||||
specialize qw/av1_wedge_sse_from_residuals sse2/;
|
||||
add_proto qw/int av1_wedge_sign_from_residuals/, "const int16_t *ds, const uint8_t *m, int N, int64_t limit";
|
||||
specialize qw/av1_wedge_sign_from_residuals sse2/;
|
||||
add_proto qw/void av1_wedge_compute_delta_squares/, "int16_t *d, const int16_t *a, const int16_t *b, int N";
|
||||
specialize qw/av1_wedge_compute_delta_squares sse2/;
|
||||
}
|
||||
|
||||
}
|
||||
# end encoder functions
|
||||
|
||||
# If PVQ is enabled, fwd transforms are required by decoder
|
||||
if (aom_config("CONFIG_PVQ") eq "yes") {
|
||||
# fdct functions
|
||||
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
|
||||
add_proto qw/void av1_fht4x4/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
specialize qw/av1_fht4x4 sse2/;
|
||||
|
||||
add_proto qw/void av1_fht8x8/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
specialize qw/av1_fht8x8 sse2/;
|
||||
|
||||
add_proto qw/void av1_fht16x16/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
specialize qw/av1_fht16x16 sse2/;
|
||||
|
||||
add_proto qw/void av1_fwht4x4/, "const int16_t *input, tran_low_t *output, int stride";
|
||||
specialize qw/av1_fwht4x4 sse2/;
|
||||
} else {
|
||||
add_proto qw/void av1_fht4x4/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
specialize qw/av1_fht4x4 sse2 msa/;
|
||||
|
||||
add_proto qw/void av1_fht8x8/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
specialize qw/av1_fht8x8 sse2 msa/;
|
||||
|
||||
add_proto qw/void av1_fht16x16/, "const int16_t *input, tran_low_t *output, int stride, int tx_type";
|
||||
specialize qw/av1_fht16x16 sse2 msa/;
|
||||
|
||||
add_proto qw/void av1_fwht4x4/, "const int16_t *input, tran_low_t *output, int stride";
|
||||
specialize qw/av1_fwht4x4 msa sse2/;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# Deringing Functions
|
||||
|
||||
if (aom_config("CONFIG_CDEF") eq "yes") {
|
||||
add_proto qw/void aom_clpf_block_hbd/, "uint16_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd";
|
||||
add_proto qw/void aom_clpf_hblock_hbd/, "uint16_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd";
|
||||
add_proto qw/void aom_clpf_block/, "uint8_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd";
|
||||
add_proto qw/void aom_clpf_hblock/, "uint8_t *dst, const uint16_t *src, int dstride, int sstride, int sizex, int sizey, unsigned int strength, unsigned int bd";
|
||||
add_proto qw/int od_dir_find8/, "const od_dering_in *img, int stride, int32_t *var, int coeff_shift";
|
||||
add_proto qw/void od_filter_dering_direction_4x4/, "uint16_t *y, int ystride, const uint16_t *in, int threshold, int dir, int damping";
|
||||
add_proto qw/void od_filter_dering_direction_8x8/, "uint16_t *y, int ystride, const uint16_t *in, int threshold, int dir, int damping";
|
||||
|
||||
add_proto qw/void copy_8x8_16bit_to_8bit/, "uint8_t *dst, int dstride, const uint16_t *src, int sstride";
|
||||
add_proto qw/void copy_4x4_16bit_to_8bit/, "uint8_t *dst, int dstride, const uint16_t *src, int sstride";
|
||||
add_proto qw/void copy_8x8_16bit_to_16bit/, "uint16_t *dst, int dstride, const uint16_t *src, int sstride";
|
||||
add_proto qw/void copy_4x4_16bit_to_16bit/, "uint16_t *dst, int dstride, const uint16_t *src, int sstride";
|
||||
add_proto qw/void copy_rect8_8bit_to_16bit/, "uint16_t *dst, int dstride, const uint8_t *src, int sstride, int v, int h";
|
||||
add_proto qw/void copy_rect8_16bit_to_16bit/, "uint16_t *dst, int dstride, const uint16_t *src, int sstride, int v, int h";
|
||||
|
||||
# VS compiling for 32 bit targets does not support vector types in
|
||||
# structs as arguments, which makes the v256 type of the intrinsics
|
||||
# hard to support, so optimizations for this target are disabled.
|
||||
if ($opts{config} !~ /libs-x86-win32-vs.*/) {
|
||||
specialize qw/aom_clpf_block_hbd sse2 ssse3 sse4_1 neon/;
|
||||
specialize qw/aom_clpf_hblock_hbd sse2 ssse3 sse4_1 neon/;
|
||||
specialize qw/aom_clpf_block sse2 ssse3 sse4_1 neon/;
|
||||
specialize qw/aom_clpf_hblock sse2 ssse3 sse4_1 neon/;
|
||||
specialize qw/od_dir_find8 sse2 ssse3 sse4_1 neon/;
|
||||
specialize qw/od_filter_dering_direction_4x4 sse2 ssse3 sse4_1 neon/;
|
||||
specialize qw/od_filter_dering_direction_8x8 sse2 ssse3 sse4_1 neon/;
|
||||
|
||||
specialize qw/copy_8x8_16bit_to_8bit sse2 ssse3 sse4_1 neon/;
|
||||
specialize qw/copy_4x4_16bit_to_8bit sse2 ssse3 sse4_1 neon/;
|
||||
specialize qw/copy_8x8_16bit_to_16bit sse2 ssse3 sse4_1 neon/;
|
||||
specialize qw/copy_4x4_16bit_to_16bit sse2 ssse3 sse4_1 neon/;
|
||||
specialize qw/copy_rect8_8bit_to_16bit sse2 ssse3 sse4_1 neon/;
|
||||
specialize qw/copy_rect8_16bit_to_16bit sse2 ssse3 sse4_1 neon/;
|
||||
}
|
||||
}
|
||||
|
||||
# PVQ Functions
|
||||
|
||||
if (aom_config("CONFIG_PVQ") eq "yes") {
|
||||
add_proto qw/double pvq_search_rdo_double/, "const od_val16 *xcoeff, int n, int k, int *ypulse, double g2, double pvq_norm_lambda, int prev_k";
|
||||
specialize qw/pvq_search_rdo_double sse4_1/;
|
||||
}
|
||||
|
||||
# WARPED_MOTION / GLOBAL_MOTION functions
|
||||
|
||||
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/;
|
||||
|
||||
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";
|
||||
specialize qw/av1_highbd_warp_affine ssse3/;
|
||||
}
|
||||
}
|
||||
|
||||
# LOOP_RESTORATION functions
|
||||
|
||||
if (aom_config("CONFIG_LOOP_RESTORATION") eq "yes") {
|
||||
add_proto qw/void apply_selfguided_restoration/, "uint8_t *dat, int width, int height, int stride, int eps, int *xqd, uint8_t *dst, int dst_stride, int32_t *tmpbuf";
|
||||
specialize qw/apply_selfguided_restoration sse4_1/;
|
||||
|
||||
add_proto qw/void av1_selfguided_restoration/, "uint8_t *dgd, int width, int height, int stride, int32_t *dst, int dst_stride, int r, int eps, int32_t *tmpbuf";
|
||||
specialize qw/av1_selfguided_restoration sse4_1/;
|
||||
|
||||
add_proto qw/void av1_highpass_filter/, "uint8_t *dgd, int width, int height, int stride, int32_t *dst, int dst_stride, int r, int eps";
|
||||
specialize qw/av1_highpass_filter sse4_1/;
|
||||
|
||||
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
|
||||
add_proto qw/void apply_selfguided_restoration_highbd/, "uint16_t *dat, int width, int height, int stride, int bit_depth, int eps, int *xqd, uint16_t *dst, int dst_stride, int32_t *tmpbuf";
|
||||
specialize qw/apply_selfguided_restoration_highbd sse4_1/;
|
||||
|
||||
add_proto qw/void av1_selfguided_restoration_highbd/, "uint16_t *dgd, int width, int height, int stride, int32_t *dst, int dst_stride, int bit_depth, int r, int eps, int32_t *tmpbuf";
|
||||
specialize qw/av1_selfguided_restoration_highbd sse4_1/;
|
||||
|
||||
add_proto qw/void av1_highpass_filter_highbd/, "uint16_t *dgd, int width, int height, int stride, int32_t *dst, int dst_stride, int r, int eps";
|
||||
specialize qw/av1_highpass_filter_highbd sse4_1/;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
211
third_party/aom/av1/common/av1_txfm.h
vendored
Normal file
211
third_party/aom/av1/common/av1_txfm.h
vendored
Normal file
|
|
@ -0,0 +1,211 @@
|
|||
/*
|
||||
* 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_TXFM_H_
|
||||
#define AV1_TXFM_H_
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "av1/common/enums.h"
|
||||
#include "aom/aom_integer.h"
|
||||
#include "aom_dsp/aom_dsp_common.h"
|
||||
|
||||
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] = {
|
||||
{ 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,
|
||||
590, 569, 548, 526, 505, 483, 460, 438, 415, 392, 369, 345, 321,
|
||||
297, 273, 249, 224, 200, 175, 150, 125, 100, 75, 50, 25 },
|
||||
{ 2048, 2047, 2046, 2042, 2038, 2033, 2026, 2018, 2009, 1998, 1987,
|
||||
1974, 1960, 1945, 1928, 1911, 1892, 1872, 1851, 1829, 1806, 1782,
|
||||
1757, 1730, 1703, 1674, 1645, 1615, 1583, 1551, 1517, 1483, 1448,
|
||||
1412, 1375, 1338, 1299, 1260, 1220, 1179, 1138, 1096, 1053, 1009,
|
||||
965, 921, 876, 830, 784, 737, 690, 642, 595, 546, 498,
|
||||
449, 400, 350, 301, 251, 201, 151, 100, 50 },
|
||||
{ 4096, 4095, 4091, 4085, 4076, 4065, 4052, 4036, 4017, 3996, 3973,
|
||||
3948, 3920, 3889, 3857, 3822, 3784, 3745, 3703, 3659, 3612, 3564,
|
||||
3513, 3461, 3406, 3349, 3290, 3229, 3166, 3102, 3035, 2967, 2896,
|
||||
2824, 2751, 2675, 2598, 2520, 2440, 2359, 2276, 2191, 2106, 2019,
|
||||
1931, 1842, 1751, 1660, 1567, 1474, 1380, 1285, 1189, 1092, 995,
|
||||
897, 799, 700, 601, 501, 401, 301, 201, 101 },
|
||||
{ 8192, 8190, 8182, 8170, 8153, 8130, 8103, 8071, 8035, 7993, 7946,
|
||||
7895, 7839, 7779, 7713, 7643, 7568, 7489, 7405, 7317, 7225, 7128,
|
||||
7027, 6921, 6811, 6698, 6580, 6458, 6333, 6203, 6070, 5933, 5793,
|
||||
5649, 5501, 5351, 5197, 5040, 4880, 4717, 4551, 4383, 4212, 4038,
|
||||
3862, 3683, 3503, 3320, 3135, 2948, 2760, 2570, 2378, 2185, 1990,
|
||||
1795, 1598, 1401, 1202, 1003, 803, 603, 402, 201 },
|
||||
{ 16384, 16379, 16364, 16340, 16305, 16261, 16207, 16143, 16069, 15986, 15893,
|
||||
15791, 15679, 15557, 15426, 15286, 15137, 14978, 14811, 14635, 14449, 14256,
|
||||
14053, 13842, 13623, 13395, 13160, 12916, 12665, 12406, 12140, 11866, 11585,
|
||||
11297, 11003, 10702, 10394, 10080, 9760, 9434, 9102, 8765, 8423, 8076,
|
||||
7723, 7366, 7005, 6639, 6270, 5897, 5520, 5139, 4756, 4370, 3981,
|
||||
3590, 3196, 2801, 2404, 2006, 1606, 1205, 804, 402 },
|
||||
{ 32768, 32758, 32729, 32679, 32610, 32522, 32413, 32286, 32138, 31972, 31786,
|
||||
31581, 31357, 31114, 30853, 30572, 30274, 29957, 29622, 29269, 28899, 28511,
|
||||
28106, 27684, 27246, 26791, 26320, 25833, 25330, 24812, 24279, 23732, 23170,
|
||||
22595, 22006, 21403, 20788, 20160, 19520, 18868, 18205, 17531, 16846, 16151,
|
||||
15447, 14733, 14010, 13279, 12540, 11793, 11039, 10279, 9512, 8740, 7962,
|
||||
7180, 6393, 5602, 4808, 4011, 3212, 2411, 1608, 804 },
|
||||
{ 65536, 65516, 65457, 65358, 65220, 65043, 64827, 64571, 64277, 63944, 63572,
|
||||
63162, 62714, 62228, 61705, 61145, 60547, 59914, 59244, 58538, 57798, 57022,
|
||||
56212, 55368, 54491, 53581, 52639, 51665, 50660, 49624, 48559, 47464, 46341,
|
||||
45190, 44011, 42806, 41576, 40320, 39040, 37736, 36410, 35062, 33692, 32303,
|
||||
30893, 29466, 28020, 26558, 25080, 23586, 22078, 20557, 19024, 17479, 15924,
|
||||
14359, 12785, 11204, 9616, 8022, 6424, 4821, 3216, 1608 }
|
||||
};
|
||||
|
||||
static INLINE int32_t round_shift(int32_t value, int bit) {
|
||||
assert(bit >= 1);
|
||||
return (value + (1 << (bit - 1))) >> bit;
|
||||
}
|
||||
|
||||
static INLINE void round_shift_array(int32_t *arr, int size, int bit) {
|
||||
int i;
|
||||
if (bit == 0) {
|
||||
return;
|
||||
} else {
|
||||
if (bit > 0) {
|
||||
for (i = 0; i < size; i++) {
|
||||
arr[i] = round_shift(arr[i], bit);
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < size; i++) {
|
||||
arr[i] = arr[i] * (1 << (-bit));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE int32_t half_btf(int32_t w0, int32_t in0, int32_t w1, int32_t in1,
|
||||
int bit) {
|
||||
int32_t result_32 = w0 * in0 + w1 * in1;
|
||||
#if CONFIG_COEFFICIENT_RANGE_CHECKING
|
||||
int64_t result_64 = (int64_t)w0 * (int64_t)in0 + (int64_t)w1 * (int64_t)in1;
|
||||
if (result_64 < INT32_MIN || result_64 > INT32_MAX) {
|
||||
printf("%s %d overflow result_32: %d result_64: %" PRId64
|
||||
" w0: %d in0: %d w1: %d in1: "
|
||||
"%d\n",
|
||||
__FILE__, __LINE__, result_32, result_64, w0, in0, w1, in1);
|
||||
assert(0 && "half_btf overflow");
|
||||
}
|
||||
#endif
|
||||
return round_shift(result_32, bit);
|
||||
}
|
||||
|
||||
static INLINE int get_max_bit(int x) {
|
||||
int max_bit = -1;
|
||||
while (x) {
|
||||
x = x >> 1;
|
||||
max_bit++;
|
||||
}
|
||||
return max_bit;
|
||||
}
|
||||
|
||||
// TODO(angiebird): implement SSE
|
||||
static INLINE void clamp_block(int16_t *block, int block_size, int stride,
|
||||
int low, int high) {
|
||||
int i, j;
|
||||
for (i = 0; i < block_size; ++i) {
|
||||
for (j = 0; j < block_size; ++j) {
|
||||
block[i * stride + j] = clamp(block[i * stride + j], low, high);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typedef void (*TxfmFunc)(const int32_t *input, int32_t *output,
|
||||
const int8_t *cos_bit, const int8_t *stage_range);
|
||||
|
||||
typedef enum TXFM_TYPE {
|
||||
TXFM_TYPE_DCT4,
|
||||
TXFM_TYPE_DCT8,
|
||||
TXFM_TYPE_DCT16,
|
||||
TXFM_TYPE_DCT32,
|
||||
TXFM_TYPE_DCT64,
|
||||
TXFM_TYPE_ADST4,
|
||||
TXFM_TYPE_ADST8,
|
||||
TXFM_TYPE_ADST16,
|
||||
TXFM_TYPE_ADST32,
|
||||
} TXFM_TYPE;
|
||||
|
||||
typedef struct TXFM_2D_CFG {
|
||||
const int txfm_size;
|
||||
const int stage_num_col;
|
||||
const int stage_num_row;
|
||||
|
||||
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;
|
||||
|
||||
typedef struct TXFM_2D_FLIP_CFG {
|
||||
int ud_flip; // flip upside down
|
||||
int lr_flip; // flip left to right
|
||||
const TXFM_2D_CFG *cfg;
|
||||
} TXFM_2D_FLIP_CFG;
|
||||
|
||||
static INLINE void set_flip_cfg(int tx_type, TXFM_2D_FLIP_CFG *cfg) {
|
||||
switch (tx_type) {
|
||||
case DCT_DCT:
|
||||
case ADST_DCT:
|
||||
case DCT_ADST:
|
||||
case ADST_ADST:
|
||||
cfg->ud_flip = 0;
|
||||
cfg->lr_flip = 0;
|
||||
break;
|
||||
#if CONFIG_EXT_TX
|
||||
case FLIPADST_DCT:
|
||||
cfg->ud_flip = 1;
|
||||
cfg->lr_flip = 0;
|
||||
break;
|
||||
case DCT_FLIPADST:
|
||||
cfg->ud_flip = 0;
|
||||
cfg->lr_flip = 1;
|
||||
break;
|
||||
case FLIPADST_FLIPADST:
|
||||
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;
|
||||
cfg->lr_flip = 0;
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
TXFM_2D_FLIP_CFG av1_get_fwd_txfm_cfg(int tx_type, int tx_size);
|
||||
TXFM_2D_FLIP_CFG av1_get_fwd_txfm_64x64_cfg(int tx_type);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // AV1_TXFM_H_
|
||||
296
third_party/aom/av1/common/blockd.c
vendored
Normal file
296
third_party/aom/av1/common/blockd.c
vendored
Normal file
|
|
@ -0,0 +1,296 @@
|
|||
/*
|
||||
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
|
||||
*
|
||||
* This source code is subject to the terms of the BSD 2 Clause License and
|
||||
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
|
||||
* was not distributed with this source code in the LICENSE file, you can
|
||||
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
|
||||
* Media Patent License 1.0 was not distributed with this source code in the
|
||||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "aom_ports/system_state.h"
|
||||
|
||||
#include "av1/common/blockd.h"
|
||||
#include "av1/common/onyxc_int.h"
|
||||
|
||||
PREDICTION_MODE av1_left_block_mode(const MODE_INFO *cur_mi,
|
||||
const MODE_INFO *left_mi, int b) {
|
||||
if (b == 0 || b == 2) {
|
||||
if (!left_mi || is_inter_block(&left_mi->mbmi)) return DC_PRED;
|
||||
|
||||
return get_y_mode(left_mi, b + 1);
|
||||
} else {
|
||||
assert(b == 1 || b == 3);
|
||||
return cur_mi->bmi[b - 1].as_mode;
|
||||
}
|
||||
}
|
||||
|
||||
PREDICTION_MODE av1_above_block_mode(const MODE_INFO *cur_mi,
|
||||
const MODE_INFO *above_mi, int b) {
|
||||
if (b == 0 || b == 1) {
|
||||
if (!above_mi || is_inter_block(&above_mi->mbmi)) return DC_PRED;
|
||||
|
||||
return get_y_mode(above_mi, b + 2);
|
||||
} else {
|
||||
assert(b == 2 || b == 3);
|
||||
return cur_mi->bmi[b - 2].as_mode;
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_COEF_INTERLEAVE
|
||||
void av1_foreach_transformed_block_interleave(
|
||||
const MACROBLOCKD *const xd, BLOCK_SIZE bsize,
|
||||
foreach_transformed_block_visitor visit, void *arg) {
|
||||
const struct macroblockd_plane *const pd_y = &xd->plane[0];
|
||||
const struct macroblockd_plane *const pd_c = &xd->plane[1];
|
||||
const MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
|
||||
|
||||
const TX_SIZE tx_log2_y = mbmi->tx_size;
|
||||
const TX_SIZE tx_log2_c = get_uv_tx_size(mbmi, pd_c);
|
||||
const int tx_sz_y = (1 << tx_log2_y);
|
||||
const int tx_sz_c = (1 << tx_log2_c);
|
||||
|
||||
const BLOCK_SIZE plane_bsize_y = get_plane_block_size(bsize, pd_y);
|
||||
const BLOCK_SIZE plane_bsize_c = get_plane_block_size(bsize, pd_c);
|
||||
|
||||
const int num_4x4_w_y = num_4x4_blocks_wide_lookup[plane_bsize_y];
|
||||
const int num_4x4_w_c = num_4x4_blocks_wide_lookup[plane_bsize_c];
|
||||
const int num_4x4_h_y = num_4x4_blocks_high_lookup[plane_bsize_y];
|
||||
const int num_4x4_h_c = num_4x4_blocks_high_lookup[plane_bsize_c];
|
||||
|
||||
const int step_y = 1 << (tx_log2_y << 1);
|
||||
const int step_c = 1 << (tx_log2_c << 1);
|
||||
|
||||
const int max_4x4_w_y =
|
||||
get_max_4x4_size(num_4x4_w_y, xd->mb_to_right_edge, pd_y->subsampling_x);
|
||||
const int max_4x4_h_y =
|
||||
get_max_4x4_size(num_4x4_h_y, xd->mb_to_bottom_edge, pd_y->subsampling_y);
|
||||
|
||||
const int extra_step_y = ((num_4x4_w_y - max_4x4_w_y) >> tx_log2_y) * step_y;
|
||||
|
||||
const int max_4x4_w_c =
|
||||
get_max_4x4_size(num_4x4_w_c, xd->mb_to_right_edge, pd_c->subsampling_x);
|
||||
const int max_4x4_h_c =
|
||||
get_max_4x4_size(num_4x4_h_c, xd->mb_to_bottom_edge, pd_c->subsampling_y);
|
||||
|
||||
const int extra_step_c = ((num_4x4_w_c - max_4x4_w_c) >> tx_log2_c) * step_c;
|
||||
|
||||
// The max_4x4_w/h may be smaller than tx_sz under some corner cases,
|
||||
// i.e. when the SB is splitted by tile boundaries.
|
||||
const int tu_num_w_y = (max_4x4_w_y + tx_sz_y - 1) / tx_sz_y;
|
||||
const int tu_num_h_y = (max_4x4_h_y + tx_sz_y - 1) / tx_sz_y;
|
||||
const int tu_num_w_c = (max_4x4_w_c + tx_sz_c - 1) / tx_sz_c;
|
||||
const int tu_num_h_c = (max_4x4_h_c + tx_sz_c - 1) / tx_sz_c;
|
||||
const int tu_num_c = tu_num_w_c * tu_num_h_c;
|
||||
|
||||
int tu_idx_c = 0;
|
||||
int offset_y, row_y, col_y;
|
||||
int offset_c, row_c, col_c;
|
||||
|
||||
for (row_y = 0; row_y < tu_num_h_y; row_y++) {
|
||||
for (col_y = 0; col_y < tu_num_w_y; col_y++) {
|
||||
// luma
|
||||
offset_y = (row_y * tu_num_w_y + col_y) * step_y + row_y * extra_step_y;
|
||||
visit(0, offset_y, row_y * tx_sz_y, col_y * tx_sz_y, plane_bsize_y,
|
||||
tx_log2_y, arg);
|
||||
// chroma
|
||||
if (tu_idx_c < tu_num_c) {
|
||||
row_c = (tu_idx_c / tu_num_w_c) * tx_sz_c;
|
||||
col_c = (tu_idx_c % tu_num_w_c) * tx_sz_c;
|
||||
offset_c = tu_idx_c * step_c + (tu_idx_c / tu_num_w_c) * extra_step_c;
|
||||
visit(1, offset_c, row_c, col_c, plane_bsize_c, tx_log2_c, arg);
|
||||
visit(2, offset_c, row_c, col_c, plane_bsize_c, tx_log2_c, arg);
|
||||
tu_idx_c++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// In 422 case, it's possible that Chroma has more TUs than Luma
|
||||
while (tu_idx_c < tu_num_c) {
|
||||
row_c = (tu_idx_c / tu_num_w_c) * tx_sz_c;
|
||||
col_c = (tu_idx_c % tu_num_w_c) * tx_sz_c;
|
||||
offset_c = tu_idx_c * step_c + row_c * extra_step_c;
|
||||
visit(1, offset_c, row_c, col_c, plane_bsize_c, tx_log2_c, arg);
|
||||
visit(2, offset_c, row_c, col_c, plane_bsize_c, tx_log2_c, arg);
|
||||
tu_idx_c++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void av1_foreach_transformed_block_in_plane(
|
||||
const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane,
|
||||
foreach_transformed_block_visitor visit, void *arg) {
|
||||
const struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
// 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);
|
||||
#if CONFIG_CB4X4 && !CONFIG_CHROMA_2X2
|
||||
const BLOCK_SIZE plane_bsize =
|
||||
AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd));
|
||||
#else
|
||||
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
|
||||
#endif
|
||||
const uint8_t txw_unit = tx_size_wide_unit[tx_size];
|
||||
const uint8_t txh_unit = tx_size_high_unit[tx_size];
|
||||
const int step = txw_unit * txh_unit;
|
||||
int i = 0, r, c;
|
||||
|
||||
// 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);
|
||||
|
||||
// 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);
|
||||
i += step;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_LV_MAP
|
||||
void av1_foreach_transformed_block(const MACROBLOCKD *const xd,
|
||||
BLOCK_SIZE bsize, int mi_row, int mi_col,
|
||||
foreach_transformed_block_visitor visit,
|
||||
void *arg) {
|
||||
int plane;
|
||||
|
||||
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
|
||||
#if CONFIG_CB4X4
|
||||
if (!is_chroma_reference(mi_row, mi_col, bsize,
|
||||
xd->plane[plane].subsampling_x,
|
||||
xd->plane[plane].subsampling_y))
|
||||
continue;
|
||||
#else
|
||||
(void)mi_row;
|
||||
(void)mi_col;
|
||||
#endif
|
||||
av1_foreach_transformed_block_in_plane(xd, bsize, plane, visit, arg);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_DAALA_DIST
|
||||
void av1_foreach_8x8_transformed_block_in_plane(
|
||||
const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane,
|
||||
foreach_transformed_block_visitor visit,
|
||||
foreach_transformed_block_visitor mi_visit, void *arg) {
|
||||
const struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
// 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 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];
|
||||
const int step = txw_unit * txh_unit;
|
||||
int i = 0, r, c;
|
||||
|
||||
// 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);
|
||||
|
||||
// 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);
|
||||
i += step;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !CONFIG_PVQ || CONFIG_VAR_TX
|
||||
void av1_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,
|
||||
int plane, TX_SIZE tx_size, int has_eob, int aoff,
|
||||
int loff) {
|
||||
ENTROPY_CONTEXT *const a = pd->above_context + aoff;
|
||||
ENTROPY_CONTEXT *const l = pd->left_context + loff;
|
||||
const int txs_wide = tx_size_wide_unit[tx_size];
|
||||
const int txs_high = tx_size_high_unit[tx_size];
|
||||
#if CONFIG_CB4X4
|
||||
const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
|
||||
#else
|
||||
const BLOCK_SIZE bsize = AOMMAX(xd->mi[0]->mbmi.sb_type, BLOCK_8X8);
|
||||
#endif
|
||||
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
|
||||
|
||||
// above
|
||||
if (has_eob && xd->mb_to_right_edge < 0) {
|
||||
int i;
|
||||
const int blocks_wide = max_block_wide(xd, plane_bsize, plane);
|
||||
int above_contexts = txs_wide;
|
||||
if (above_contexts + aoff > blocks_wide)
|
||||
above_contexts = blocks_wide - aoff;
|
||||
|
||||
for (i = 0; i < above_contexts; ++i) a[i] = has_eob;
|
||||
for (i = above_contexts; i < txs_wide; ++i) a[i] = 0;
|
||||
} else {
|
||||
memset(a, has_eob, sizeof(ENTROPY_CONTEXT) * txs_wide);
|
||||
}
|
||||
|
||||
// left
|
||||
if (has_eob && xd->mb_to_bottom_edge < 0) {
|
||||
int i;
|
||||
const int blocks_high = max_block_high(xd, plane_bsize, plane);
|
||||
int left_contexts = txs_high;
|
||||
if (left_contexts + loff > blocks_high) left_contexts = blocks_high - loff;
|
||||
|
||||
for (i = 0; i < left_contexts; ++i) l[i] = has_eob;
|
||||
for (i = left_contexts; i < txs_high; ++i) l[i] = 0;
|
||||
} else {
|
||||
memset(l, has_eob, sizeof(ENTROPY_CONTEXT) * txs_high);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void av1_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_MB_PLANE; i++) {
|
||||
xd->plane[i].plane_type = get_plane_type(i);
|
||||
xd->plane[i].subsampling_x = i ? ss_x : 0;
|
||||
xd->plane[i].subsampling_y = i ? ss_y : 0;
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_EXT_INTRA
|
||||
const int16_t dr_intra_derivative[90] = {
|
||||
1, 14666, 7330, 4884, 3660, 2926, 2435, 2084, 1821, 1616, 1451, 1317, 1204,
|
||||
1108, 1026, 955, 892, 837, 787, 743, 703, 666, 633, 603, 574, 548,
|
||||
524, 502, 481, 461, 443, 426, 409, 394, 379, 365, 352, 339, 327,
|
||||
316, 305, 294, 284, 274, 265, 256, 247, 238, 230, 222, 214, 207,
|
||||
200, 192, 185, 179, 172, 166, 159, 153, 147, 141, 136, 130, 124,
|
||||
119, 113, 108, 103, 98, 93, 88, 83, 78, 73, 68, 63, 59,
|
||||
54, 49, 45, 40, 35, 31, 26, 22, 17, 13, 8, 4,
|
||||
};
|
||||
|
||||
#if CONFIG_INTRA_INTERP
|
||||
int av1_is_intra_filter_switchable(int angle) {
|
||||
assert(angle > 0 && angle < 270);
|
||||
if (angle % 45 == 0) return 0;
|
||||
if (angle > 90 && angle < 180) {
|
||||
return 1;
|
||||
} else {
|
||||
return ((angle < 90 ? dr_intra_derivative[angle]
|
||||
: dr_intra_derivative[270 - angle]) &
|
||||
0xFF) > 0;
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_INTRA_INTERP
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
1371
third_party/aom/av1/common/blockd.h
vendored
Normal file
1371
third_party/aom/av1/common/blockd.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
445
third_party/aom/av1/common/cdef.c
vendored
Normal file
445
third_party/aom/av1/common/cdef.c
vendored
Normal file
|
|
@ -0,0 +1,445 @@
|
|||
/*
|
||||
* 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 <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "./aom_scale_rtcd.h"
|
||||
#include "aom/aom_integer.h"
|
||||
#include "av1/common/cdef.h"
|
||||
#include "av1/common/od_dering.h"
|
||||
#include "av1/common/onyxc_int.h"
|
||||
#include "av1/common/reconinter.h"
|
||||
|
||||
int sb_all_skip(const AV1_COMMON *const cm, int mi_row, int mi_col) {
|
||||
int r, c;
|
||||
int maxc, maxr;
|
||||
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
|
||||
|
||||
for (r = 0; r < maxr; r++) {
|
||||
for (c = 0; c < maxc; c++) {
|
||||
skip = skip &&
|
||||
cm->mi_grid_visible[(mi_row + r) * cm->mi_stride + mi_col + c]
|
||||
->mbmi.skip;
|
||||
}
|
||||
}
|
||||
return skip;
|
||||
}
|
||||
|
||||
static int is_8x8_block_skip(MODE_INFO **grid, int mi_row, int mi_col,
|
||||
int mi_stride) {
|
||||
int is_skip = 1;
|
||||
for (int r = 0; r < mi_size_high[BLOCK_8X8]; ++r)
|
||||
for (int c = 0; c < mi_size_wide[BLOCK_8X8]; ++c)
|
||||
is_skip &= grid[(mi_row + r) * mi_stride + (mi_col + c)]->mbmi.skip;
|
||||
|
||||
return is_skip;
|
||||
}
|
||||
|
||||
int sb_compute_dering_list(const AV1_COMMON *const cm, int mi_row, int mi_col,
|
||||
dering_list *dlist, int filter_skip) {
|
||||
int r, c;
|
||||
int maxc, maxr;
|
||||
MODE_INFO **grid;
|
||||
int count = 0;
|
||||
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
|
||||
|
||||
const int r_step = mi_size_high[BLOCK_8X8];
|
||||
const int c_step = mi_size_wide[BLOCK_8X8];
|
||||
const int r_shift = (r_step == 2);
|
||||
const int c_shift = (c_step == 2);
|
||||
|
||||
assert(r_step == 1 || r_step == 2);
|
||||
assert(c_step == 1 || c_step == 2);
|
||||
|
||||
if (filter_skip) {
|
||||
for (r = 0; r < maxr; r += r_step) {
|
||||
for (c = 0; c < maxc; c += c_step) {
|
||||
dlist[count].by = r >> r_shift;
|
||||
dlist[count].bx = c >> c_shift;
|
||||
dlist[count].skip =
|
||||
is_8x8_block_skip(grid, mi_row + r, mi_col + c, cm->mi_stride);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (r = 0; r < maxr; r += r_step) {
|
||||
for (c = 0; c < maxc; c += c_step) {
|
||||
if (!is_8x8_block_skip(grid, mi_row + r, mi_col + c, cm->mi_stride)) {
|
||||
dlist[count].by = r >> r_shift;
|
||||
dlist[count].bx = c >> c_shift;
|
||||
dlist[count].skip = 0;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
void copy_rect8_8bit_to_16bit_c(uint16_t *dst, int dstride, const uint8_t *src,
|
||||
int sstride, int v, int h) {
|
||||
int i, j;
|
||||
for (i = 0; i < v; i++) {
|
||||
for (j = 0; j < h; j++) {
|
||||
dst[i * dstride + j] = src[i * sstride + j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void copy_rect8_16bit_to_16bit_c(uint16_t *dst, int dstride,
|
||||
const uint16_t *src, int sstride, int v,
|
||||
int h) {
|
||||
int i, j;
|
||||
for (i = 0; i < v; i++) {
|
||||
for (j = 0; j < h; j++) {
|
||||
dst[i * dstride + j] = src[i * sstride + j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void copy_sb8_16(UNUSED AV1_COMMON *cm, uint16_t *dst, int dstride,
|
||||
const uint8_t *src, int src_voffset, int src_hoffset,
|
||||
int sstride, int vsize, int hsize) {
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (cm->use_highbitdepth) {
|
||||
const uint16_t *base =
|
||||
&CONVERT_TO_SHORTPTR(src)[src_voffset * sstride + src_hoffset];
|
||||
copy_rect8_16bit_to_16bit(dst, dstride, base, sstride, vsize, hsize);
|
||||
} else {
|
||||
#endif
|
||||
const uint8_t *base = &src[src_voffset * sstride + src_hoffset];
|
||||
copy_rect8_8bit_to_16bit(dst, dstride, base, sstride, vsize, hsize);
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static INLINE void fill_rect(uint16_t *dst, int dstride, int v, int h,
|
||||
uint16_t x) {
|
||||
int i, j;
|
||||
for (i = 0; i < v; i++) {
|
||||
for (j = 0; j < h; j++) {
|
||||
dst[i * dstride + j] = x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void copy_rect(uint16_t *dst, int dstride, const uint16_t *src,
|
||||
int sstride, int v, int h) {
|
||||
int i, j;
|
||||
for (i = 0; i < v; i++) {
|
||||
for (j = 0; j < h; j++) {
|
||||
dst[i * dstride + j] = src[i * sstride + j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
|
||||
MACROBLOCKD *xd) {
|
||||
int sbr, sbc;
|
||||
int nhsb, nvsb;
|
||||
uint16_t src[OD_DERING_INBUF_SIZE];
|
||||
uint16_t *linebuf[3];
|
||||
uint16_t *colbuf[3];
|
||||
dering_list dlist[MAX_MIB_SIZE * MAX_MIB_SIZE];
|
||||
unsigned char *row_dering, *prev_row_dering, *curr_row_dering;
|
||||
int dering_count;
|
||||
int dir[OD_DERING_NBLOCKS][OD_DERING_NBLOCKS] = { { 0 } };
|
||||
int var[OD_DERING_NBLOCKS][OD_DERING_NBLOCKS] = { { 0 } };
|
||||
int stride;
|
||||
int mi_wide_l2[3];
|
||||
int mi_high_l2[3];
|
||||
int xdec[3];
|
||||
int ydec[3];
|
||||
int pli;
|
||||
int dering_left;
|
||||
int coeff_shift = AOMMAX(cm->bit_depth - 8, 0);
|
||||
int nplanes = 3;
|
||||
int chroma_dering =
|
||||
xd->plane[1].subsampling_x == xd->plane[1].subsampling_y &&
|
||||
xd->plane[2].subsampling_x == xd->plane[2].subsampling_y;
|
||||
nvsb = (cm->mi_rows + MAX_MIB_SIZE - 1) / MAX_MIB_SIZE;
|
||||
nhsb = (cm->mi_cols + MAX_MIB_SIZE - 1) / MAX_MIB_SIZE;
|
||||
av1_setup_dst_planes(xd->plane, cm->sb_size, frame, 0, 0);
|
||||
row_dering = aom_malloc(sizeof(*row_dering) * (nhsb + 2) * 2);
|
||||
memset(row_dering, 1, sizeof(*row_dering) * (nhsb + 2) * 2);
|
||||
prev_row_dering = row_dering + 1;
|
||||
curr_row_dering = prev_row_dering + nhsb + 2;
|
||||
for (pli = 0; pli < nplanes; pli++) {
|
||||
xdec[pli] = xd->plane[pli].subsampling_x;
|
||||
ydec[pli] = xd->plane[pli].subsampling_y;
|
||||
mi_wide_l2[pli] = MI_SIZE_LOG2 - xd->plane[pli].subsampling_x;
|
||||
mi_high_l2[pli] = MI_SIZE_LOG2 - xd->plane[pli].subsampling_y;
|
||||
}
|
||||
stride = (cm->mi_cols << MI_SIZE_LOG2) + 2 * OD_FILT_HBORDER;
|
||||
for (pli = 0; pli < nplanes; pli++) {
|
||||
linebuf[pli] = aom_malloc(sizeof(*linebuf) * OD_FILT_VBORDER * stride);
|
||||
colbuf[pli] =
|
||||
aom_malloc(sizeof(*colbuf) *
|
||||
((MAX_SB_SIZE << mi_high_l2[pli]) + 2 * OD_FILT_VBORDER) *
|
||||
OD_FILT_HBORDER);
|
||||
}
|
||||
for (sbr = 0; sbr < nvsb; sbr++) {
|
||||
for (pli = 0; pli < nplanes; pli++) {
|
||||
const int block_height =
|
||||
(MAX_MIB_SIZE << mi_high_l2[pli]) + 2 * OD_FILT_VBORDER;
|
||||
fill_rect(colbuf[pli], OD_FILT_HBORDER, block_height, OD_FILT_HBORDER,
|
||||
OD_DERING_VERY_LARGE);
|
||||
}
|
||||
dering_left = 1;
|
||||
for (sbc = 0; sbc < nhsb; sbc++) {
|
||||
int level, clpf_strength;
|
||||
int uv_level, uv_clpf_strength;
|
||||
int nhb, nvb;
|
||||
int cstart = 0;
|
||||
curr_row_dering[sbc] = 0;
|
||||
if (cm->mi_grid_visible[MAX_MIB_SIZE * sbr * cm->mi_stride +
|
||||
MAX_MIB_SIZE * sbc] == NULL ||
|
||||
cm->mi_grid_visible[MAX_MIB_SIZE * sbr * cm->mi_stride +
|
||||
MAX_MIB_SIZE * sbc]
|
||||
->mbmi.cdef_strength == -1) {
|
||||
dering_left = 0;
|
||||
continue;
|
||||
}
|
||||
if (!dering_left) cstart = -OD_FILT_HBORDER;
|
||||
nhb = AOMMIN(MAX_MIB_SIZE, cm->mi_cols - MAX_MIB_SIZE * sbc);
|
||||
nvb = AOMMIN(MAX_MIB_SIZE, cm->mi_rows - MAX_MIB_SIZE * sbr);
|
||||
int tile_top, tile_left, tile_bottom, tile_right;
|
||||
int mi_idx = MAX_MIB_SIZE * sbr * cm->mi_stride + MAX_MIB_SIZE * sbc;
|
||||
BOUNDARY_TYPE boundary_tl =
|
||||
cm->mi_grid_visible[MAX_MIB_SIZE * sbr * cm->mi_stride +
|
||||
MAX_MIB_SIZE * sbc]
|
||||
->mbmi.boundary_info;
|
||||
tile_top = boundary_tl & TILE_ABOVE_BOUNDARY;
|
||||
tile_left = boundary_tl & TILE_LEFT_BOUNDARY;
|
||||
/* Right and bottom information appear unreliable, so we use the top
|
||||
and left flags for the next superblocks. */
|
||||
if (sbr != nvsb - 1 &&
|
||||
cm->mi_grid_visible[mi_idx + MAX_MIB_SIZE * cm->mi_stride])
|
||||
tile_bottom = cm->mi_grid_visible[mi_idx + MAX_MIB_SIZE * cm->mi_stride]
|
||||
->mbmi.boundary_info &
|
||||
TILE_ABOVE_BOUNDARY;
|
||||
else
|
||||
tile_bottom = 1;
|
||||
if (sbc != nhsb - 1 && cm->mi_grid_visible[mi_idx + MAX_MIB_SIZE])
|
||||
tile_right =
|
||||
cm->mi_grid_visible[mi_idx + MAX_MIB_SIZE]->mbmi.boundary_info &
|
||||
TILE_LEFT_BOUNDARY;
|
||||
else
|
||||
tile_right = 1;
|
||||
const int mbmi_cdef_strength =
|
||||
cm->mi_grid_visible[MAX_MIB_SIZE * sbr * cm->mi_stride +
|
||||
MAX_MIB_SIZE * sbc]
|
||||
->mbmi.cdef_strength;
|
||||
level = cm->cdef_strengths[mbmi_cdef_strength] / CLPF_STRENGTHS;
|
||||
clpf_strength = cm->cdef_strengths[mbmi_cdef_strength] % CLPF_STRENGTHS;
|
||||
clpf_strength += clpf_strength == 3;
|
||||
uv_level = cm->cdef_uv_strengths[mbmi_cdef_strength] / CLPF_STRENGTHS;
|
||||
uv_clpf_strength =
|
||||
cm->cdef_uv_strengths[mbmi_cdef_strength] % CLPF_STRENGTHS;
|
||||
uv_clpf_strength += uv_clpf_strength == 3;
|
||||
if ((level == 0 && clpf_strength == 0 && uv_level == 0 &&
|
||||
uv_clpf_strength == 0) ||
|
||||
(dering_count = sb_compute_dering_list(
|
||||
cm, sbr * MAX_MIB_SIZE, sbc * MAX_MIB_SIZE, dlist,
|
||||
get_filter_skip(level) || get_filter_skip(uv_level))) == 0) {
|
||||
dering_left = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
curr_row_dering[sbc] = 1;
|
||||
for (pli = 0; pli < nplanes; pli++) {
|
||||
uint16_t dst[MAX_SB_SIZE * MAX_SB_SIZE];
|
||||
int coffset;
|
||||
int rend, cend;
|
||||
int clpf_damping = cm->cdef_clpf_damping;
|
||||
int dering_damping = cm->cdef_dering_damping;
|
||||
int hsize = nhb << mi_wide_l2[pli];
|
||||
int vsize = nvb << mi_high_l2[pli];
|
||||
|
||||
if (pli) {
|
||||
if (chroma_dering)
|
||||
level = uv_level;
|
||||
else
|
||||
level = 0;
|
||||
clpf_strength = uv_clpf_strength;
|
||||
}
|
||||
|
||||
if (sbc == nhsb - 1)
|
||||
cend = hsize;
|
||||
else
|
||||
cend = hsize + OD_FILT_HBORDER;
|
||||
|
||||
if (sbr == nvsb - 1)
|
||||
rend = vsize;
|
||||
else
|
||||
rend = vsize + OD_FILT_VBORDER;
|
||||
|
||||
coffset = sbc * MAX_MIB_SIZE << mi_wide_l2[pli];
|
||||
if (sbc == nhsb - 1) {
|
||||
/* On the last superblock column, fill in the right border with
|
||||
OD_DERING_VERY_LARGE to avoid filtering with the outside. */
|
||||
fill_rect(&src[cend + OD_FILT_HBORDER], OD_FILT_BSTRIDE,
|
||||
rend + OD_FILT_VBORDER, hsize + OD_FILT_HBORDER - cend,
|
||||
OD_DERING_VERY_LARGE);
|
||||
}
|
||||
if (sbr == nvsb - 1) {
|
||||
/* On the last superblock row, fill in the bottom border with
|
||||
OD_DERING_VERY_LARGE to avoid filtering with the outside. */
|
||||
fill_rect(&src[(rend + OD_FILT_VBORDER) * OD_FILT_BSTRIDE],
|
||||
OD_FILT_BSTRIDE, OD_FILT_VBORDER,
|
||||
hsize + 2 * OD_FILT_HBORDER, OD_DERING_VERY_LARGE);
|
||||
}
|
||||
/* Copy in the pixels we need from the current superblock for
|
||||
deringing.*/
|
||||
copy_sb8_16(
|
||||
cm,
|
||||
&src[OD_FILT_VBORDER * OD_FILT_BSTRIDE + OD_FILT_HBORDER + cstart],
|
||||
OD_FILT_BSTRIDE, xd->plane[pli].dst.buf,
|
||||
(MAX_MIB_SIZE << mi_high_l2[pli]) * sbr, coffset + cstart,
|
||||
xd->plane[pli].dst.stride, rend, cend - cstart);
|
||||
if (!prev_row_dering[sbc]) {
|
||||
copy_sb8_16(cm, &src[OD_FILT_HBORDER], OD_FILT_BSTRIDE,
|
||||
xd->plane[pli].dst.buf,
|
||||
(MAX_MIB_SIZE << mi_high_l2[pli]) * sbr - OD_FILT_VBORDER,
|
||||
coffset, xd->plane[pli].dst.stride, OD_FILT_VBORDER,
|
||||
hsize);
|
||||
} else if (sbr > 0) {
|
||||
copy_rect(&src[OD_FILT_HBORDER], OD_FILT_BSTRIDE,
|
||||
&linebuf[pli][coffset], stride, OD_FILT_VBORDER, hsize);
|
||||
} else {
|
||||
fill_rect(&src[OD_FILT_HBORDER], OD_FILT_BSTRIDE, OD_FILT_VBORDER,
|
||||
hsize, OD_DERING_VERY_LARGE);
|
||||
}
|
||||
if (!prev_row_dering[sbc - 1]) {
|
||||
copy_sb8_16(cm, src, OD_FILT_BSTRIDE, xd->plane[pli].dst.buf,
|
||||
(MAX_MIB_SIZE << mi_high_l2[pli]) * sbr - OD_FILT_VBORDER,
|
||||
coffset - OD_FILT_HBORDER, xd->plane[pli].dst.stride,
|
||||
OD_FILT_VBORDER, OD_FILT_HBORDER);
|
||||
} else if (sbr > 0 && sbc > 0) {
|
||||
copy_rect(src, OD_FILT_BSTRIDE,
|
||||
&linebuf[pli][coffset - OD_FILT_HBORDER], stride,
|
||||
OD_FILT_VBORDER, OD_FILT_HBORDER);
|
||||
} else {
|
||||
fill_rect(src, OD_FILT_BSTRIDE, OD_FILT_VBORDER, OD_FILT_HBORDER,
|
||||
OD_DERING_VERY_LARGE);
|
||||
}
|
||||
if (!prev_row_dering[sbc + 1]) {
|
||||
copy_sb8_16(cm, &src[OD_FILT_HBORDER + (nhb << mi_wide_l2[pli])],
|
||||
OD_FILT_BSTRIDE, xd->plane[pli].dst.buf,
|
||||
(MAX_MIB_SIZE << mi_high_l2[pli]) * sbr - OD_FILT_VBORDER,
|
||||
coffset + hsize, xd->plane[pli].dst.stride,
|
||||
OD_FILT_VBORDER, OD_FILT_HBORDER);
|
||||
} else if (sbr > 0 && sbc < nhsb - 1) {
|
||||
copy_rect(&src[hsize + OD_FILT_HBORDER], OD_FILT_BSTRIDE,
|
||||
&linebuf[pli][coffset + hsize], stride, OD_FILT_VBORDER,
|
||||
OD_FILT_HBORDER);
|
||||
} else {
|
||||
fill_rect(&src[hsize + OD_FILT_HBORDER], OD_FILT_BSTRIDE,
|
||||
OD_FILT_VBORDER, OD_FILT_HBORDER, OD_DERING_VERY_LARGE);
|
||||
}
|
||||
if (dering_left) {
|
||||
/* If we deringed the superblock on the left then we need to copy in
|
||||
saved pixels. */
|
||||
copy_rect(src, OD_FILT_BSTRIDE, colbuf[pli], OD_FILT_HBORDER,
|
||||
rend + OD_FILT_VBORDER, OD_FILT_HBORDER);
|
||||
}
|
||||
/* Saving pixels in case we need to dering the superblock on the
|
||||
right. */
|
||||
copy_rect(colbuf[pli], OD_FILT_HBORDER, src + hsize, OD_FILT_BSTRIDE,
|
||||
rend + OD_FILT_VBORDER, OD_FILT_HBORDER);
|
||||
copy_sb8_16(
|
||||
cm, &linebuf[pli][coffset], stride, xd->plane[pli].dst.buf,
|
||||
(MAX_MIB_SIZE << mi_high_l2[pli]) * (sbr + 1) - OD_FILT_VBORDER,
|
||||
coffset, xd->plane[pli].dst.stride, OD_FILT_VBORDER, hsize);
|
||||
|
||||
if (tile_top) {
|
||||
fill_rect(src, OD_FILT_BSTRIDE, OD_FILT_VBORDER,
|
||||
hsize + 2 * OD_FILT_HBORDER, OD_DERING_VERY_LARGE);
|
||||
}
|
||||
if (tile_left) {
|
||||
fill_rect(src, OD_FILT_BSTRIDE, vsize + 2 * OD_FILT_VBORDER,
|
||||
OD_FILT_HBORDER, OD_DERING_VERY_LARGE);
|
||||
}
|
||||
if (tile_bottom) {
|
||||
fill_rect(&src[(vsize + OD_FILT_VBORDER) * OD_FILT_BSTRIDE],
|
||||
OD_FILT_BSTRIDE, OD_FILT_VBORDER,
|
||||
hsize + 2 * OD_FILT_HBORDER, OD_DERING_VERY_LARGE);
|
||||
}
|
||||
if (tile_right) {
|
||||
fill_rect(&src[hsize + OD_FILT_HBORDER], OD_FILT_BSTRIDE,
|
||||
vsize + 2 * OD_FILT_VBORDER, OD_FILT_HBORDER,
|
||||
OD_DERING_VERY_LARGE);
|
||||
}
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (cm->use_highbitdepth) {
|
||||
od_dering(
|
||||
(uint8_t *)&CONVERT_TO_SHORTPTR(
|
||||
xd->plane[pli]
|
||||
.dst.buf)[xd->plane[pli].dst.stride *
|
||||
(MAX_MIB_SIZE * sbr << mi_high_l2[pli]) +
|
||||
(sbc * MAX_MIB_SIZE << mi_wide_l2[pli])],
|
||||
xd->plane[pli].dst.stride, dst,
|
||||
&src[OD_FILT_VBORDER * OD_FILT_BSTRIDE + OD_FILT_HBORDER],
|
||||
xdec[pli], ydec[pli], dir, NULL, var, pli, dlist, dering_count,
|
||||
level, clpf_strength, clpf_damping, dering_damping, coeff_shift,
|
||||
0, 1);
|
||||
} else {
|
||||
#endif
|
||||
od_dering(&xd->plane[pli]
|
||||
.dst.buf[xd->plane[pli].dst.stride *
|
||||
(MAX_MIB_SIZE * sbr << mi_high_l2[pli]) +
|
||||
(sbc * MAX_MIB_SIZE << mi_wide_l2[pli])],
|
||||
xd->plane[pli].dst.stride, dst,
|
||||
&src[OD_FILT_VBORDER * OD_FILT_BSTRIDE + OD_FILT_HBORDER],
|
||||
xdec[pli], ydec[pli], dir, NULL, var, pli, dlist,
|
||||
dering_count, level, clpf_strength, clpf_damping,
|
||||
dering_damping, coeff_shift, 0, 0);
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
}
|
||||
#endif
|
||||
}
|
||||
dering_left = 1;
|
||||
}
|
||||
{
|
||||
unsigned char *tmp;
|
||||
tmp = prev_row_dering;
|
||||
prev_row_dering = curr_row_dering;
|
||||
curr_row_dering = tmp;
|
||||
}
|
||||
}
|
||||
aom_free(row_dering);
|
||||
for (pli = 0; pli < nplanes; pli++) {
|
||||
aom_free(linebuf[pli]);
|
||||
aom_free(colbuf[pli]);
|
||||
}
|
||||
}
|
||||
53
third_party/aom/av1/common/cdef.h
vendored
Normal file
53
third_party/aom/av1/common/cdef.h
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* 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_COMMON_DERING_H_
|
||||
#define AV1_COMMON_DERING_H_
|
||||
|
||||
#define CDEF_STRENGTH_BITS 7
|
||||
|
||||
#define DERING_STRENGTHS 32
|
||||
#define CLPF_STRENGTHS 4
|
||||
|
||||
#include "./aom_config.h"
|
||||
#include "aom/aom_integer.h"
|
||||
#include "aom_ports/mem.h"
|
||||
#include "av1/common/od_dering.h"
|
||||
#include "av1/common/onyxc_int.h"
|
||||
#include "./od_dering.h"
|
||||
|
||||
static INLINE int sign(int i) { return i < 0 ? -1 : 1; }
|
||||
|
||||
static INLINE int constrain(int diff, int threshold, unsigned int damping) {
|
||||
return threshold
|
||||
? sign(diff) *
|
||||
AOMMIN(
|
||||
abs(diff),
|
||||
AOMMAX(0, threshold - (abs(diff) >>
|
||||
(damping - get_msb(threshold)))))
|
||||
: 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int sb_all_skip(const AV1_COMMON *const cm, int mi_row, int mi_col);
|
||||
int sb_compute_dering_list(const AV1_COMMON *const cm, int mi_row, int mi_col,
|
||||
dering_list *dlist, int filter_skip);
|
||||
void av1_cdef_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, MACROBLOCKD *xd);
|
||||
|
||||
void av1_cdef_search(YV12_BUFFER_CONFIG *frame, const YV12_BUFFER_CONFIG *ref,
|
||||
AV1_COMMON *cm, MACROBLOCKD *xd);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
#endif // AV1_COMMON_DERING_H_
|
||||
27
third_party/aom/av1/common/cdef_simd.h
vendored
Normal file
27
third_party/aom/av1/common/cdef_simd.h
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* 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_COMMON_CDEF_SIMD_H_
|
||||
#define AV1_COMMON_CDEF_SIMD_H_
|
||||
|
||||
#include "aom_dsp/aom_simd.h"
|
||||
|
||||
// sign(a-b) * min(abs(a-b), max(0, threshold - (abs(a-b) >> adjdamp)))
|
||||
SIMD_INLINE v128 constrain16(v128 a, v128 b, unsigned int threshold,
|
||||
unsigned int adjdamp) {
|
||||
v128 diff = v128_sub_16(a, b);
|
||||
const v128 sign = v128_shr_n_s16(diff, 15);
|
||||
diff = v128_abs_s16(diff);
|
||||
const v128 s =
|
||||
v128_ssub_u16(v128_dup_16(threshold), v128_shr_u16(diff, adjdamp));
|
||||
return v128_xor(v128_add_16(sign, v128_min_s16(diff, s)), sign);
|
||||
}
|
||||
|
||||
#endif // AV1_COMMON_CDEF_SIMD_H_
|
||||
240
third_party/aom/av1/common/cfl.c
vendored
Normal file
240
third_party/aom/av1/common/cfl.c
vendored
Normal file
|
|
@ -0,0 +1,240 @@
|
|||
/*
|
||||
* 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 "av1/common/cfl.h"
|
||||
#include "av1/common/common_data.h"
|
||||
#include "av1/common/onyxc_int.h"
|
||||
|
||||
#include "aom/internal/aom_codec_internal.h"
|
||||
|
||||
void cfl_init(CFL_CTX *cfl, AV1_COMMON *cm, int subsampling_x,
|
||||
int subsampling_y) {
|
||||
if (!((subsampling_x == 0 && subsampling_y == 0) ||
|
||||
(subsampling_x == 1 && subsampling_y == 1))) {
|
||||
aom_internal_error(&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
|
||||
"Only 4:4:4 and 4:2:0 are currently supported by CfL");
|
||||
}
|
||||
memset(&cfl->y_pix, 0, sizeof(uint8_t) * MAX_SB_SQUARE);
|
||||
cfl->subsampling_x = subsampling_x;
|
||||
cfl->subsampling_y = subsampling_y;
|
||||
}
|
||||
|
||||
// CfL computes its own block-level DC_PRED. This is required to compute both
|
||||
// alpha_cb and alpha_cr before the prediction are computed.
|
||||
void cfl_dc_pred(MACROBLOCKD *xd, BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
|
||||
const struct macroblockd_plane *const pd_u = &xd->plane[AOM_PLANE_U];
|
||||
const struct macroblockd_plane *const pd_v = &xd->plane[AOM_PLANE_V];
|
||||
|
||||
const uint8_t *const dst_u = pd_u->dst.buf;
|
||||
const uint8_t *const dst_v = pd_v->dst.buf;
|
||||
|
||||
const int dst_u_stride = pd_u->dst.stride;
|
||||
const int dst_v_stride = pd_v->dst.stride;
|
||||
|
||||
const int block_width = (plane_bsize != BLOCK_INVALID)
|
||||
? block_size_wide[plane_bsize]
|
||||
: tx_size_wide[tx_size];
|
||||
const int block_height = (plane_bsize != BLOCK_INVALID)
|
||||
? block_size_high[plane_bsize]
|
||||
: tx_size_high[tx_size];
|
||||
|
||||
// Number of pixel on the top and left borders.
|
||||
const int 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
|
||||
// ..
|
||||
|
||||
// TODO(ltrudeau) replace this with DC_PRED assembly
|
||||
if (xd->up_available && xd->mb_to_right_edge >= 0) {
|
||||
for (int i = 0; i < block_width; i++) {
|
||||
sum_u += dst_u[-dst_u_stride + i];
|
||||
sum_v += dst_v[-dst_v_stride + i];
|
||||
}
|
||||
} else {
|
||||
sum_u = block_width * 127;
|
||||
sum_v = block_width * 127;
|
||||
}
|
||||
|
||||
if (xd->left_available && xd->mb_to_bottom_edge >= 0) {
|
||||
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];
|
||||
}
|
||||
} else {
|
||||
sum_u += block_height * 129;
|
||||
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;
|
||||
}
|
||||
|
||||
// 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];
|
||||
|
||||
// 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);
|
||||
|
||||
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);
|
||||
}
|
||||
dst += dst_stride;
|
||||
}
|
||||
}
|
||||
|
||||
void cfl_store(CFL_CTX *cfl, const uint8_t *input, int input_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];
|
||||
const int tx_off_log2 = tx_size_wide_log2[0];
|
||||
|
||||
// Store the input into the CfL pixel buffer
|
||||
uint8_t *y_pix = &cfl->y_pix[(row * MAX_SB_SIZE + col) << tx_off_log2];
|
||||
|
||||
// Check that we remain inside the pixel buffer.
|
||||
assert(MAX_SB_SIZE * (row + tx_height - 1) + col + tx_width - 1 <
|
||||
MAX_SB_SQUARE);
|
||||
|
||||
for (int j = 0; j < tx_height; j++) {
|
||||
for (int i = 0; i < tx_width; i++) {
|
||||
y_pix[i] = input[i];
|
||||
}
|
||||
y_pix += MAX_SB_SIZE;
|
||||
input += input_stride;
|
||||
}
|
||||
|
||||
// Store the surface of the pixel buffer that was written to, this way we
|
||||
// can manage chroma overrun (e.g. when the chroma surfaces goes beyond the
|
||||
// frame boundary)
|
||||
if (col == 0 && row == 0) {
|
||||
cfl->y_width = tx_width;
|
||||
cfl->y_height = tx_height;
|
||||
} else {
|
||||
cfl->y_width = OD_MAXI((col << tx_off_log2) + tx_width, cfl->y_width);
|
||||
cfl->y_height = OD_MAXI((row << tx_off_log2) + tx_height, cfl->y_height);
|
||||
}
|
||||
}
|
||||
|
||||
// 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];
|
||||
const int sub_x = cfl->subsampling_x;
|
||||
const int sub_y = cfl->subsampling_y;
|
||||
const int tx_off_log2 = tx_size_wide_log2[0];
|
||||
|
||||
const uint8_t *y_pix;
|
||||
|
||||
int diff_width = 0;
|
||||
int diff_height = 0;
|
||||
|
||||
int pred_row_offset = 0;
|
||||
int output_row_offset = 0;
|
||||
int top_left, bot_left;
|
||||
|
||||
// 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;
|
||||
diff_width = uv_width - cfl->y_width;
|
||||
int uv_height = (row << tx_off_log2) + tx_width;
|
||||
diff_height = uv_height - cfl->y_height;
|
||||
for (int j = 0; j < tx_height; j++) {
|
||||
for (int i = 0; i < tx_width; i++) {
|
||||
// In 4:4:4, pixels match 1 to 1
|
||||
output[output_row_offset + i] = y_pix[pred_row_offset + i];
|
||||
}
|
||||
pred_row_offset += MAX_SB_SIZE;
|
||||
output_row_offset += output_stride;
|
||||
}
|
||||
} 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;
|
||||
diff_width = (uv_width - cfl->y_width) >> sub_x;
|
||||
int uv_height = ((row << tx_off_log2) + tx_width) << 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++) {
|
||||
top_left = (pred_row_offset + i) << sub_y;
|
||||
bot_left = top_left + MAX_SB_SIZE;
|
||||
// In 4:2:0, average pixels in 2x2 grid
|
||||
output[output_row_offset + i] = OD_SHR_ROUND(
|
||||
y_pix[top_left] + y_pix[top_left + 1] // Top row
|
||||
+ y_pix[bot_left] + y_pix[bot_left + 1] // Bottom row
|
||||
,
|
||||
2);
|
||||
}
|
||||
pred_row_offset += MAX_SB_SIZE;
|
||||
output_row_offset += output_stride;
|
||||
}
|
||||
} else {
|
||||
assert(0); // Unsupported chroma subsampling
|
||||
}
|
||||
// Due to frame boundary issues, it is possible that the total area of
|
||||
// covered by Chroma exceeds that of Luma. When this happens, we write over
|
||||
// the broken data by repeating the last columns and/or rows.
|
||||
//
|
||||
// Note that in order to manage the case where both rows and columns
|
||||
// overrun,
|
||||
// we apply rows first. This way, when the rows overrun the bottom of the
|
||||
// frame, the columns will be copied over them.
|
||||
if (diff_width > 0) {
|
||||
int last_pixel;
|
||||
output_row_offset = tx_width - diff_width;
|
||||
|
||||
for (int j = 0; j < tx_height; j++) {
|
||||
last_pixel = output_row_offset - 1;
|
||||
for (int i = 0; i < diff_width; i++) {
|
||||
output[output_row_offset + i] = output[last_pixel];
|
||||
}
|
||||
output_row_offset += output_stride;
|
||||
}
|
||||
}
|
||||
|
||||
if (diff_height > 0) {
|
||||
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++) {
|
||||
output[output_row_offset + i] = output[last_row_offset + i];
|
||||
}
|
||||
output_row_offset += output_stride;
|
||||
}
|
||||
}
|
||||
|
||||
int avg = 0;
|
||||
output_row_offset = 0;
|
||||
for (int j = 0; j < tx_height; j++) {
|
||||
for (int i = 0; i < tx_width; i++) {
|
||||
avg += output[output_row_offset + i];
|
||||
}
|
||||
output_row_offset += output_stride;
|
||||
}
|
||||
return avg / (double)(tx_width * tx_height);
|
||||
}
|
||||
52
third_party/aom/av1/common/cfl.h
vendored
Normal file
52
third_party/aom/av1/common/cfl.h
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* 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_COMMON_CFL_H_
|
||||
#define AV1_COMMON_CFL_H_
|
||||
|
||||
#include "av1/common/enums.h"
|
||||
|
||||
// Forward declaration of AV1_COMMON, in order to avoid creating a cyclic
|
||||
// dependency by importing av1/common/onyxc_int.h
|
||||
typedef struct AV1Common AV1_COMMON;
|
||||
|
||||
// Forward declaration of MACROBLOCK, in order to avoid creating a cyclic
|
||||
// dependency by importing av1/common/blockd.h
|
||||
typedef struct macroblockd MACROBLOCKD;
|
||||
|
||||
typedef struct {
|
||||
// Pixel buffer containing the luma pixels used as prediction for chroma
|
||||
uint8_t y_pix[MAX_SB_SQUARE];
|
||||
|
||||
// Height and width of the luma prediction block currently in the pixel buffer
|
||||
int y_height, y_width;
|
||||
|
||||
// Chroma subsampling
|
||||
int subsampling_x, subsampling_y;
|
||||
|
||||
// CfL Performs its own block level DC_PRED for each chromatic plane
|
||||
int dc_pred[CFL_PRED_PLANES];
|
||||
} CFL_CTX;
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
#endif // AV1_COMMON_CFL_H_
|
||||
116
third_party/aom/av1/common/clpf.c
vendored
Normal file
116
third_party/aom/av1/common/clpf.c
vendored
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
* 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 "./clpf.h"
|
||||
#include "./av1_rtcd.h"
|
||||
#include "./cdef.h"
|
||||
#include "aom/aom_image.h"
|
||||
#include "aom_dsp/aom_dsp_common.h"
|
||||
|
||||
int av1_clpf_sample(int X, int A, int B, int C, int D, int E, int F, int G,
|
||||
int H, int s, unsigned int dmp) {
|
||||
int delta = 1 * constrain(A - X, s, dmp) + 3 * constrain(B - X, s, dmp) +
|
||||
1 * constrain(C - X, s, dmp) + 3 * constrain(D - X, s, dmp) +
|
||||
3 * constrain(E - X, s, dmp) + 1 * constrain(F - X, s, dmp) +
|
||||
3 * constrain(G - X, s, dmp) + 1 * constrain(H - X, s, dmp);
|
||||
return (8 + delta - (delta < 0)) >> 4;
|
||||
}
|
||||
|
||||
int av1_clpf_hsample(int X, int A, int B, int C, int D, int s,
|
||||
unsigned int dmp) {
|
||||
int delta = 1 * constrain(A - X, s, dmp) + 3 * constrain(B - X, s, dmp) +
|
||||
3 * constrain(C - X, s, dmp) + 1 * constrain(D - X, s, dmp);
|
||||
return (4 + delta - (delta < 0)) >> 3;
|
||||
}
|
||||
|
||||
void aom_clpf_block_c(uint8_t *dst, const uint16_t *src, int dstride,
|
||||
int sstride, int sizex, int sizey, unsigned int strength,
|
||||
unsigned int damping) {
|
||||
int x, y;
|
||||
|
||||
for (y = 0; y < sizey; y++) {
|
||||
for (x = 0; x < sizex; x++) {
|
||||
const int X = src[y * sstride + x];
|
||||
const int A = src[(y - 2) * sstride + x];
|
||||
const int B = src[(y - 1) * sstride + x];
|
||||
const int C = src[y * sstride + x - 2];
|
||||
const int D = src[y * sstride + x - 1];
|
||||
const int E = src[y * sstride + x + 1];
|
||||
const int F = src[y * sstride + x + 2];
|
||||
const int G = src[(y + 1) * sstride + x];
|
||||
const int H = src[(y + 2) * sstride + x];
|
||||
const int delta =
|
||||
av1_clpf_sample(X, A, B, C, D, E, F, G, H, strength, damping);
|
||||
dst[y * dstride + x] = X + delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Identical to aom_clpf_block_c() apart from "dst".
|
||||
void aom_clpf_block_hbd_c(uint16_t *dst, const uint16_t *src, int dstride,
|
||||
int sstride, int sizex, int sizey,
|
||||
unsigned int strength, unsigned int damping) {
|
||||
int x, y;
|
||||
|
||||
for (y = 0; y < sizey; y++) {
|
||||
for (x = 0; x < sizex; x++) {
|
||||
const int X = src[y * sstride + x];
|
||||
const int A = src[(y - 2) * sstride + x];
|
||||
const int B = src[(y - 1) * sstride + x];
|
||||
const int C = src[y * sstride + x - 2];
|
||||
const int D = src[y * sstride + x - 1];
|
||||
const int E = src[y * sstride + x + 1];
|
||||
const int F = src[y * sstride + x + 2];
|
||||
const int G = src[(y + 1) * sstride + x];
|
||||
const int H = src[(y + 2) * sstride + x];
|
||||
const int delta =
|
||||
av1_clpf_sample(X, A, B, C, D, E, F, G, H, strength, damping);
|
||||
dst[y * dstride + x] = X + delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Vertically restricted filter
|
||||
void aom_clpf_hblock_c(uint8_t *dst, const uint16_t *src, int dstride,
|
||||
int sstride, int sizex, int sizey, unsigned int strength,
|
||||
unsigned int damping) {
|
||||
int x, y;
|
||||
|
||||
for (y = 0; y < sizey; y++) {
|
||||
for (x = 0; x < sizex; x++) {
|
||||
const int X = src[y * sstride + x];
|
||||
const int A = src[y * sstride + x - 2];
|
||||
const int B = src[y * sstride + x - 1];
|
||||
const int C = src[y * sstride + x + 1];
|
||||
const int D = src[y * sstride + x + 2];
|
||||
const int delta = av1_clpf_hsample(X, A, B, C, D, strength, damping);
|
||||
dst[y * dstride + x] = X + delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void aom_clpf_hblock_hbd_c(uint16_t *dst, const uint16_t *src, int dstride,
|
||||
int sstride, int sizex, int sizey,
|
||||
unsigned int strength, unsigned int damping) {
|
||||
int x, y;
|
||||
|
||||
for (y = 0; y < sizey; y++) {
|
||||
for (x = 0; x < sizex; x++) {
|
||||
const int X = src[y * sstride + x];
|
||||
const int A = src[y * sstride + x - 2];
|
||||
const int B = src[y * sstride + x - 1];
|
||||
const int C = src[y * sstride + x + 1];
|
||||
const int D = src[y * sstride + x + 2];
|
||||
const int delta = av1_clpf_hsample(X, A, B, C, D, strength, damping);
|
||||
dst[y * dstride + x] = X + delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
18
third_party/aom/av1/common/clpf.h
vendored
Normal file
18
third_party/aom/av1/common/clpf.h
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* 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_COMMON_CLPF_H_
|
||||
#define AV1_COMMON_CLPF_H_
|
||||
|
||||
#include "av1/common/reconinter.h"
|
||||
|
||||
int av1_clpf_sample(int X, int A, int B, int C, int D, int E, int F, int G,
|
||||
int H, int b, unsigned int dmp);
|
||||
#endif
|
||||
14
third_party/aom/av1/common/clpf_neon.c
vendored
Normal file
14
third_party/aom/av1/common/clpf_neon.c
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* 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/aom_simd.h"
|
||||
#define SIMD_FUNC(name) name##_neon
|
||||
#include "./clpf_simd.h"
|
||||
446
third_party/aom/av1/common/clpf_simd.h
vendored
Normal file
446
third_party/aom/av1/common/clpf_simd.h
vendored
Normal file
|
|
@ -0,0 +1,446 @@
|
|||
/*
|
||||
* 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 "./av1_rtcd.h"
|
||||
#include "./cdef_simd.h"
|
||||
#include "aom_ports/bitops.h"
|
||||
#include "aom_ports/mem.h"
|
||||
|
||||
// sign(a - b) * min(abs(a - b), max(0, strength - (abs(a - b) >> adjdamp)))
|
||||
SIMD_INLINE v128 constrain(v256 a, v256 b, unsigned int strength,
|
||||
unsigned int adjdamp) {
|
||||
const v256 diff16 = v256_sub_16(a, b);
|
||||
v128 diff = v128_pack_s16_s8(v256_high_v128(diff16), v256_low_v128(diff16));
|
||||
const v128 sign = v128_cmplt_s8(diff, v128_zero());
|
||||
diff = v128_abs_s8(diff);
|
||||
return v128_xor(
|
||||
v128_add_8(sign,
|
||||
v128_min_u8(diff, v128_ssub_u8(v128_dup_8(strength),
|
||||
v128_shr_u8(diff, adjdamp)))),
|
||||
sign);
|
||||
}
|
||||
|
||||
// delta = 1/16 * constrain(a, x, s, d) + 3/16 * constrain(b, x, s, d) +
|
||||
// 1/16 * constrain(c, x, s, d) + 3/16 * constrain(d, x, s, d) +
|
||||
// 3/16 * constrain(e, x, s, d) + 1/16 * constrain(f, x, s, d) +
|
||||
// 3/16 * constrain(g, x, s, d) + 1/16 * constrain(h, x, s, d)
|
||||
SIMD_INLINE v128 calc_delta(v256 x, v256 a, v256 b, v256 c, v256 d, v256 e,
|
||||
v256 f, v256 g, v256 h, unsigned int s,
|
||||
unsigned int dmp) {
|
||||
const v128 bdeg =
|
||||
v128_add_8(v128_add_8(constrain(b, x, s, dmp), constrain(d, x, s, dmp)),
|
||||
v128_add_8(constrain(e, x, s, dmp), constrain(g, x, s, dmp)));
|
||||
const v128 delta = v128_add_8(
|
||||
v128_add_8(v128_add_8(constrain(a, x, s, dmp), constrain(c, x, s, dmp)),
|
||||
v128_add_8(constrain(f, x, s, dmp), constrain(h, x, s, dmp))),
|
||||
v128_add_8(v128_add_8(bdeg, bdeg), bdeg));
|
||||
return v128_add_8(
|
||||
v128_pack_s16_u8(v256_high_v128(x), v256_low_v128(x)),
|
||||
v128_shr_s8(
|
||||
v128_add_8(v128_dup_8(8),
|
||||
v128_add_8(delta, v128_cmplt_s8(delta, v128_zero()))),
|
||||
4));
|
||||
}
|
||||
|
||||
// delta = 1/8 * constrain(a, x, s, d) + 3/8 * constrain(b, x, s, d) +
|
||||
// 3/8 * constrain(c, x, s, d) + 1/8 * constrain(d, x, s, d) +
|
||||
SIMD_INLINE v128 calc_hdelta(v256 x, v256 a, v256 b, v256 c, v256 d,
|
||||
unsigned int s, unsigned int dmp) {
|
||||
const v128 bc = v128_add_8(constrain(b, x, s, dmp), constrain(c, x, s, dmp));
|
||||
const v128 delta =
|
||||
v128_add_8(v128_add_8(constrain(a, x, s, dmp), constrain(d, x, s, dmp)),
|
||||
v128_add_8(v128_add_8(bc, bc), bc));
|
||||
return v128_add_8(
|
||||
v128_pack_s16_u8(v256_high_v128(x), v256_low_v128(x)),
|
||||
v128_shr_s8(
|
||||
v128_add_8(v128_dup_8(4),
|
||||
v128_add_8(delta, v128_cmplt_s8(delta, v128_zero()))),
|
||||
3));
|
||||
}
|
||||
|
||||
// Process blocks of width 8, two lines at a time, 8 bit.
|
||||
static void SIMD_FUNC(clpf_block8)(uint8_t *dst, const uint16_t *src,
|
||||
int dstride, int sstride, int sizey,
|
||||
unsigned int strength,
|
||||
unsigned int adjdamp) {
|
||||
int y;
|
||||
|
||||
for (y = 0; y < sizey; y += 2) {
|
||||
const v128 l1 = v128_load_aligned(src);
|
||||
const v128 l2 = v128_load_aligned(src + sstride);
|
||||
const v128 l3 = v128_load_aligned(src - sstride);
|
||||
const v128 l4 = v128_load_aligned(src + 2 * sstride);
|
||||
const v256 a = v256_from_v128(v128_load_aligned(src - 2 * sstride), l3);
|
||||
const v256 b = v256_from_v128(l3, l1);
|
||||
const v256 g = v256_from_v128(l2, l4);
|
||||
const v256 h = v256_from_v128(l4, v128_load_aligned(src + 3 * sstride));
|
||||
const v256 c = v256_from_v128(v128_load_unaligned(src - 2),
|
||||
v128_load_unaligned(src - 2 + sstride));
|
||||
const v256 d = v256_from_v128(v128_load_unaligned(src - 1),
|
||||
v128_load_unaligned(src - 1 + sstride));
|
||||
const v256 e = v256_from_v128(v128_load_unaligned(src + 1),
|
||||
v128_load_unaligned(src + 1 + sstride));
|
||||
const v256 f = v256_from_v128(v128_load_unaligned(src + 2),
|
||||
v128_load_unaligned(src + 2 + sstride));
|
||||
const v128 o = calc_delta(v256_from_v128(l1, l2), a, b, c, d, e, f, g, h,
|
||||
strength, adjdamp);
|
||||
|
||||
v64_store_aligned(dst, v128_high_v64(o));
|
||||
v64_store_aligned(dst + dstride, v128_low_v64(o));
|
||||
src += sstride * 2;
|
||||
dst += dstride * 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Process blocks of width 4, four lines at a time, 8 bit.
|
||||
static void SIMD_FUNC(clpf_block4)(uint8_t *dst, const uint16_t *src,
|
||||
int dstride, int sstride, int sizey,
|
||||
unsigned int strength,
|
||||
unsigned int adjdamp) {
|
||||
int y;
|
||||
|
||||
for (y = 0; y < sizey; y += 4) {
|
||||
const v64 l0 = v64_load_aligned(src - 2 * sstride);
|
||||
const v64 l1 = v64_load_aligned(src - sstride);
|
||||
const v64 l2 = v64_load_aligned(src);
|
||||
const v64 l3 = v64_load_aligned(src + sstride);
|
||||
const v64 l4 = v64_load_aligned(src + 2 * sstride);
|
||||
const v64 l5 = v64_load_aligned(src + 3 * sstride);
|
||||
const v64 l6 = v64_load_aligned(src + 4 * sstride);
|
||||
const v64 l7 = v64_load_aligned(src + 5 * sstride);
|
||||
const v128 o =
|
||||
calc_delta(v256_from_v64(l2, l3, l4, l5), v256_from_v64(l0, l1, l2, l3),
|
||||
v256_from_v64(l1, l2, l3, l4),
|
||||
v256_from_v64(v64_load_unaligned(src - 2),
|
||||
v64_load_unaligned(src + sstride - 2),
|
||||
v64_load_unaligned(src + 2 * sstride - 2),
|
||||
v64_load_unaligned(src + 3 * sstride - 2)),
|
||||
v256_from_v64(v64_load_unaligned(src - 1),
|
||||
v64_load_unaligned(src + sstride - 1),
|
||||
v64_load_unaligned(src + 2 * sstride - 1),
|
||||
v64_load_unaligned(src + 3 * sstride - 1)),
|
||||
v256_from_v64(v64_load_unaligned(src + 1),
|
||||
v64_load_unaligned(src + sstride + 1),
|
||||
v64_load_unaligned(src + 2 * sstride + 1),
|
||||
v64_load_unaligned(src + 3 * sstride + 1)),
|
||||
v256_from_v64(v64_load_unaligned(src + 2),
|
||||
v64_load_unaligned(src + sstride + 2),
|
||||
v64_load_unaligned(src + 2 * sstride + 2),
|
||||
v64_load_unaligned(src + 3 * sstride + 2)),
|
||||
v256_from_v64(l3, l4, l5, l6), v256_from_v64(l4, l5, l6, l7),
|
||||
strength, adjdamp);
|
||||
|
||||
u32_store_aligned(dst, v128_low_u32(v128_shr_n_byte(o, 12)));
|
||||
u32_store_aligned(dst + dstride, v128_low_u32(v128_shr_n_byte(o, 8)));
|
||||
u32_store_aligned(dst + 2 * dstride, v128_low_u32(v128_shr_n_byte(o, 4)));
|
||||
u32_store_aligned(dst + 3 * dstride, v128_low_u32(o));
|
||||
|
||||
dst += 4 * dstride;
|
||||
src += 4 * sstride;
|
||||
}
|
||||
}
|
||||
|
||||
static void SIMD_FUNC(clpf_hblock8)(uint8_t *dst, const uint16_t *src,
|
||||
int dstride, int sstride, int sizey,
|
||||
unsigned int strength,
|
||||
unsigned int adjdamp) {
|
||||
int y;
|
||||
|
||||
for (y = 0; y < sizey; y += 2) {
|
||||
const v256 x = v256_from_v128(v128_load_aligned(src),
|
||||
v128_load_aligned(src + sstride));
|
||||
const v256 a = v256_from_v128(v128_load_unaligned(src - 2),
|
||||
v128_load_unaligned(src - 2 + sstride));
|
||||
const v256 b = v256_from_v128(v128_load_unaligned(src - 1),
|
||||
v128_load_unaligned(src - 1 + sstride));
|
||||
const v256 c = v256_from_v128(v128_load_unaligned(src + 1),
|
||||
v128_load_unaligned(src + 1 + sstride));
|
||||
const v256 d = v256_from_v128(v128_load_unaligned(src + 2),
|
||||
v128_load_unaligned(src + 2 + sstride));
|
||||
const v128 o = calc_hdelta(x, a, b, c, d, strength, adjdamp);
|
||||
|
||||
v64_store_aligned(dst, v128_high_v64(o));
|
||||
v64_store_aligned(dst + dstride, v128_low_v64(o));
|
||||
src += sstride * 2;
|
||||
dst += dstride * 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Process blocks of width 4, four lines at a time, 8 bit.
|
||||
static void SIMD_FUNC(clpf_hblock4)(uint8_t *dst, const uint16_t *src,
|
||||
int dstride, int sstride, int sizey,
|
||||
unsigned int strength,
|
||||
unsigned int adjdamp) {
|
||||
int y;
|
||||
|
||||
for (y = 0; y < sizey; y += 4) {
|
||||
const v256 a = v256_from_v64(v64_load_unaligned(src - 2),
|
||||
v64_load_unaligned(src + sstride - 2),
|
||||
v64_load_unaligned(src + 2 * sstride - 2),
|
||||
v64_load_unaligned(src + 3 * sstride - 2));
|
||||
const v256 b = v256_from_v64(v64_load_unaligned(src - 1),
|
||||
v64_load_unaligned(src + sstride - 1),
|
||||
v64_load_unaligned(src + 2 * sstride - 1),
|
||||
v64_load_unaligned(src + 3 * sstride - 1));
|
||||
const v256 c = v256_from_v64(v64_load_unaligned(src + 1),
|
||||
v64_load_unaligned(src + sstride + 1),
|
||||
v64_load_unaligned(src + 2 * sstride + 1),
|
||||
v64_load_unaligned(src + 3 * sstride + 1));
|
||||
const v256 d = v256_from_v64(v64_load_unaligned(src + 2),
|
||||
v64_load_unaligned(src + sstride + 2),
|
||||
v64_load_unaligned(src + 2 * sstride + 2),
|
||||
v64_load_unaligned(src + 3 * sstride + 2));
|
||||
|
||||
const v128 o = calc_hdelta(
|
||||
v256_from_v64(v64_load_aligned(src), v64_load_aligned(src + sstride),
|
||||
v64_load_aligned(src + 2 * sstride),
|
||||
v64_load_aligned(src + 3 * sstride)),
|
||||
a, b, c, d, strength, adjdamp);
|
||||
|
||||
u32_store_aligned(dst, v128_low_u32(v128_shr_n_byte(o, 12)));
|
||||
u32_store_aligned(dst + dstride, v128_low_u32(v128_shr_n_byte(o, 8)));
|
||||
u32_store_aligned(dst + 2 * dstride, v128_low_u32(v128_shr_n_byte(o, 4)));
|
||||
u32_store_aligned(dst + 3 * dstride, v128_low_u32(o));
|
||||
|
||||
dst += 4 * dstride;
|
||||
src += 4 * sstride;
|
||||
}
|
||||
}
|
||||
|
||||
void SIMD_FUNC(aom_clpf_block)(uint8_t *dst, const uint16_t *src, int dstride,
|
||||
int sstride, int sizex, int sizey,
|
||||
unsigned int strength, unsigned int dmp) {
|
||||
if ((sizex != 4 && sizex != 8) || ((sizey & 3) && sizex == 4)) {
|
||||
// Fallback to C for odd sizes:
|
||||
// * block widths not 4 or 8
|
||||
// * block heights not a multiple of 4 if the block width is 4
|
||||
aom_clpf_block_c(dst, src, dstride, sstride, sizex, sizey, strength, dmp);
|
||||
} else {
|
||||
(sizex == 4 ? SIMD_FUNC(clpf_block4) : SIMD_FUNC(clpf_block8))(
|
||||
dst, src, dstride, sstride, sizey, strength, dmp - get_msb(strength));
|
||||
}
|
||||
}
|
||||
|
||||
void SIMD_FUNC(aom_clpf_hblock)(uint8_t *dst, const uint16_t *src, int dstride,
|
||||
int sstride, int sizex, int sizey,
|
||||
unsigned int strength, unsigned int dmp) {
|
||||
if ((sizex != 4 && sizex != 8) || ((sizey & 3) && sizex == 4)) {
|
||||
// Fallback to C for odd sizes:
|
||||
// * block widths not 4 or 8
|
||||
// * block heights not a multiple of 4 if the block width is 4
|
||||
aom_clpf_hblock_c(dst, src, dstride, sstride, sizex, sizey, strength, dmp);
|
||||
} else {
|
||||
(sizex == 4 ? SIMD_FUNC(clpf_hblock4) : SIMD_FUNC(clpf_hblock8))(
|
||||
dst, src, dstride, sstride, sizey, strength, dmp - get_msb(strength));
|
||||
}
|
||||
}
|
||||
|
||||
// delta = 1/16 * constrain(a, x, s, d) + 3/16 * constrain(b, x, s, d) +
|
||||
// 1/16 * constrain(c, x, s, d) + 3/16 * constrain(d, x, s, d) +
|
||||
// 3/16 * constrain(e, x, s, d) + 1/16 * constrain(f, x, s, d) +
|
||||
// 3/16 * constrain(g, x, s, d) + 1/16 * constrain(h, x, s, d)
|
||||
SIMD_INLINE v128 calc_delta_hbd(v128 x, v128 a, v128 b, v128 c, v128 d, v128 e,
|
||||
v128 f, v128 g, v128 h, unsigned int s,
|
||||
unsigned int dmp) {
|
||||
const v128 bdeg = v128_add_16(
|
||||
v128_add_16(constrain16(b, x, s, dmp), constrain16(d, x, s, dmp)),
|
||||
v128_add_16(constrain16(e, x, s, dmp), constrain16(g, x, s, dmp)));
|
||||
const v128 delta = v128_add_16(
|
||||
v128_add_16(
|
||||
v128_add_16(constrain16(a, x, s, dmp), constrain16(c, x, s, dmp)),
|
||||
v128_add_16(constrain16(f, x, s, dmp), constrain16(h, x, s, dmp))),
|
||||
v128_add_16(v128_add_16(bdeg, bdeg), bdeg));
|
||||
return v128_add_16(
|
||||
x,
|
||||
v128_shr_s16(
|
||||
v128_add_16(v128_dup_16(8),
|
||||
v128_add_16(delta, v128_cmplt_s16(delta, v128_zero()))),
|
||||
4));
|
||||
}
|
||||
|
||||
static void calc_delta_hbd4(v128 o, v128 a, v128 b, v128 c, v128 d, v128 e,
|
||||
v128 f, v128 g, v128 h, uint16_t *dst,
|
||||
unsigned int s, unsigned int dmp, int dstride) {
|
||||
o = calc_delta_hbd(o, a, b, c, d, e, f, g, h, s, dmp);
|
||||
v64_store_aligned(dst, v128_high_v64(o));
|
||||
v64_store_aligned(dst + dstride, v128_low_v64(o));
|
||||
}
|
||||
|
||||
static void calc_delta_hbd8(v128 o, v128 a, v128 b, v128 c, v128 d, v128 e,
|
||||
v128 f, v128 g, v128 h, uint16_t *dst,
|
||||
unsigned int s, unsigned int adjdamp) {
|
||||
v128_store_aligned(dst,
|
||||
calc_delta_hbd(o, a, b, c, d, e, f, g, h, s, adjdamp));
|
||||
}
|
||||
|
||||
// delta = 1/16 * constrain(a, x, s, dmp) + 3/16 * constrain(b, x, s, dmp) +
|
||||
// 3/16 * constrain(c, x, s, dmp) + 1/16 * constrain(d, x, s, dmp)
|
||||
SIMD_INLINE v128 calc_hdelta_hbd(v128 x, v128 a, v128 b, v128 c, v128 d,
|
||||
unsigned int s, unsigned int dmp) {
|
||||
const v128 bc =
|
||||
v128_add_16(constrain16(b, x, s, dmp), constrain16(c, x, s, dmp));
|
||||
const v128 delta = v128_add_16(
|
||||
v128_add_16(constrain16(a, x, s, dmp), constrain16(d, x, s, dmp)),
|
||||
v128_add_16(v128_add_16(bc, bc), bc));
|
||||
return v128_add_16(
|
||||
x,
|
||||
v128_shr_s16(
|
||||
v128_add_16(v128_dup_16(4),
|
||||
v128_add_16(delta, v128_cmplt_s16(delta, v128_zero()))),
|
||||
3));
|
||||
}
|
||||
|
||||
static void calc_hdelta_hbd4(v128 o, v128 a, v128 b, v128 c, v128 d,
|
||||
uint16_t *dst, unsigned int s,
|
||||
unsigned int adjdamp, int dstride) {
|
||||
o = calc_hdelta_hbd(o, a, b, c, d, s, adjdamp);
|
||||
v64_store_aligned(dst, v128_high_v64(o));
|
||||
v64_store_aligned(dst + dstride, v128_low_v64(o));
|
||||
}
|
||||
|
||||
static void calc_hdelta_hbd8(v128 o, v128 a, v128 b, v128 c, v128 d,
|
||||
uint16_t *dst, unsigned int s,
|
||||
unsigned int adjdamp) {
|
||||
v128_store_aligned(dst, calc_hdelta_hbd(o, a, b, c, d, s, adjdamp));
|
||||
}
|
||||
|
||||
// Process blocks of width 4, two lines at time.
|
||||
static void SIMD_FUNC(clpf_block_hbd4)(uint16_t *dst, const uint16_t *src,
|
||||
int dstride, int sstride, int sizey,
|
||||
unsigned int strength,
|
||||
unsigned int adjdamp) {
|
||||
int y;
|
||||
|
||||
for (y = 0; y < sizey; y += 2) {
|
||||
const v64 l1 = v64_load_aligned(src);
|
||||
const v64 l2 = v64_load_aligned(src + sstride);
|
||||
const v64 l3 = v64_load_aligned(src - sstride);
|
||||
const v64 l4 = v64_load_aligned(src + 2 * sstride);
|
||||
const v128 a = v128_from_v64(v64_load_aligned(src - 2 * sstride), l3);
|
||||
const v128 b = v128_from_v64(l3, l1);
|
||||
const v128 g = v128_from_v64(l2, l4);
|
||||
const v128 h = v128_from_v64(l4, v64_load_aligned(src + 3 * sstride));
|
||||
const v128 c = v128_from_v64(v64_load_unaligned(src - 2),
|
||||
v64_load_unaligned(src - 2 + sstride));
|
||||
const v128 d = v128_from_v64(v64_load_unaligned(src - 1),
|
||||
v64_load_unaligned(src - 1 + sstride));
|
||||
const v128 e = v128_from_v64(v64_load_unaligned(src + 1),
|
||||
v64_load_unaligned(src + 1 + sstride));
|
||||
const v128 f = v128_from_v64(v64_load_unaligned(src + 2),
|
||||
v64_load_unaligned(src + 2 + sstride));
|
||||
|
||||
calc_delta_hbd4(v128_from_v64(l1, l2), a, b, c, d, e, f, g, h, dst,
|
||||
strength, adjdamp, dstride);
|
||||
src += sstride * 2;
|
||||
dst += dstride * 2;
|
||||
}
|
||||
}
|
||||
|
||||
// The most simple case. Start here if you need to understand the functions.
|
||||
static void SIMD_FUNC(clpf_block_hbd)(uint16_t *dst, const uint16_t *src,
|
||||
int dstride, int sstride, int sizey,
|
||||
unsigned int strength,
|
||||
unsigned int adjdamp) {
|
||||
int y;
|
||||
|
||||
for (y = 0; y < sizey; y++) {
|
||||
const v128 o = v128_load_aligned(src);
|
||||
const v128 a = v128_load_aligned(src - 2 * sstride);
|
||||
const v128 b = v128_load_aligned(src - 1 * sstride);
|
||||
const v128 g = v128_load_aligned(src + sstride);
|
||||
const v128 h = v128_load_aligned(src + 2 * sstride);
|
||||
const v128 c = v128_load_unaligned(src - 2);
|
||||
const v128 d = v128_load_unaligned(src - 1);
|
||||
const v128 e = v128_load_unaligned(src + 1);
|
||||
const v128 f = v128_load_unaligned(src + 2);
|
||||
|
||||
calc_delta_hbd8(o, a, b, c, d, e, f, g, h, dst, strength, adjdamp);
|
||||
src += sstride;
|
||||
dst += dstride;
|
||||
}
|
||||
}
|
||||
|
||||
// Process blocks of width 4, horizontal filter, two lines at time.
|
||||
static void SIMD_FUNC(clpf_hblock_hbd4)(uint16_t *dst, const uint16_t *src,
|
||||
int dstride, int sstride, int sizey,
|
||||
unsigned int strength,
|
||||
unsigned int adjdamp) {
|
||||
int y;
|
||||
|
||||
for (y = 0; y < sizey; y += 2) {
|
||||
const v128 a = v128_from_v64(v64_load_unaligned(src - 2),
|
||||
v64_load_unaligned(src - 2 + sstride));
|
||||
const v128 b = v128_from_v64(v64_load_unaligned(src - 1),
|
||||
v64_load_unaligned(src - 1 + sstride));
|
||||
const v128 c = v128_from_v64(v64_load_unaligned(src + 1),
|
||||
v64_load_unaligned(src + 1 + sstride));
|
||||
const v128 d = v128_from_v64(v64_load_unaligned(src + 2),
|
||||
v64_load_unaligned(src + 2 + sstride));
|
||||
|
||||
calc_hdelta_hbd4(v128_from_v64(v64_load_unaligned(src),
|
||||
v64_load_unaligned(src + sstride)),
|
||||
a, b, c, d, dst, strength, adjdamp, dstride);
|
||||
src += sstride * 2;
|
||||
dst += dstride * 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Process blocks of width 8, horizontal filter, two lines at time.
|
||||
static void SIMD_FUNC(clpf_hblock_hbd)(uint16_t *dst, const uint16_t *src,
|
||||
int dstride, int sstride, int sizey,
|
||||
unsigned int strength,
|
||||
unsigned int adjdamp) {
|
||||
int y;
|
||||
|
||||
for (y = 0; y < sizey; y++) {
|
||||
const v128 o = v128_load_aligned(src);
|
||||
const v128 a = v128_load_unaligned(src - 2);
|
||||
const v128 b = v128_load_unaligned(src - 1);
|
||||
const v128 c = v128_load_unaligned(src + 1);
|
||||
const v128 d = v128_load_unaligned(src + 2);
|
||||
|
||||
calc_hdelta_hbd8(o, a, b, c, d, dst, strength, adjdamp);
|
||||
src += sstride;
|
||||
dst += dstride;
|
||||
}
|
||||
}
|
||||
|
||||
void SIMD_FUNC(aom_clpf_block_hbd)(uint16_t *dst, const uint16_t *src,
|
||||
int dstride, int sstride, int sizex,
|
||||
int sizey, unsigned int strength,
|
||||
unsigned int dmp) {
|
||||
if ((sizex != 4 && sizex != 8) || ((sizey & 1) && sizex == 4)) {
|
||||
// Fallback to C for odd sizes:
|
||||
// * block width not 4 or 8
|
||||
// * block heights not a multiple of 2 if the block width is 4
|
||||
aom_clpf_block_hbd_c(dst, src, dstride, sstride, sizex, sizey, strength,
|
||||
dmp);
|
||||
} else {
|
||||
(sizex == 4 ? SIMD_FUNC(clpf_block_hbd4) : SIMD_FUNC(clpf_block_hbd))(
|
||||
dst, src, dstride, sstride, sizey, strength, dmp - get_msb(strength));
|
||||
}
|
||||
}
|
||||
|
||||
void SIMD_FUNC(aom_clpf_hblock_hbd)(uint16_t *dst, const uint16_t *src,
|
||||
int dstride, int sstride, int sizex,
|
||||
int sizey, unsigned int strength,
|
||||
unsigned int dmp) {
|
||||
if ((sizex != 4 && sizex != 8) || ((sizey & 1) && sizex == 4)) {
|
||||
// Fallback to C for odd sizes:
|
||||
// * block width not 4 or 8
|
||||
// * block heights not a multiple of 2 if the block width is 4
|
||||
aom_clpf_hblock_hbd_c(dst, src, dstride, sstride, sizex, sizey, strength,
|
||||
dmp);
|
||||
} else {
|
||||
(sizex == 4 ? SIMD_FUNC(clpf_hblock_hbd4) : SIMD_FUNC(clpf_hblock_hbd))(
|
||||
dst, src, dstride, sstride, sizey, strength, dmp - get_msb(strength));
|
||||
}
|
||||
}
|
||||
14
third_party/aom/av1/common/clpf_sse2.c
vendored
Normal file
14
third_party/aom/av1/common/clpf_sse2.c
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* 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/aom_simd.h"
|
||||
#define SIMD_FUNC(name) name##_sse2
|
||||
#include "./clpf_simd.h"
|
||||
14
third_party/aom/av1/common/clpf_sse4.c
vendored
Normal file
14
third_party/aom/av1/common/clpf_sse4.c
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* 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/aom_simd.h"
|
||||
#define SIMD_FUNC(name) name##_sse4_1
|
||||
#include "./clpf_simd.h"
|
||||
14
third_party/aom/av1/common/clpf_ssse3.c
vendored
Normal file
14
third_party/aom/av1/common/clpf_ssse3.c
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* 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/aom_simd.h"
|
||||
#define SIMD_FUNC(name) name##_ssse3
|
||||
#include "./clpf_simd.h"
|
||||
64
third_party/aom/av1/common/common.h
vendored
Normal file
64
third_party/aom/av1/common/common.h
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* 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_COMMON_COMMON_H_
|
||||
#define AV1_COMMON_COMMON_H_
|
||||
|
||||
/* Interface header for common constant data structures and lookup tables */
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "aom_dsp/aom_dsp_common.h"
|
||||
#include "aom_mem/aom_mem.h"
|
||||
#include "aom/aom_integer.h"
|
||||
#include "aom_ports/bitops.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define PI 3.141592653589793238462643383279502884
|
||||
|
||||
// Only need this for fixed-size arrays, for structs just assign.
|
||||
#define av1_copy(dest, src) \
|
||||
{ \
|
||||
assert(sizeof(dest) == sizeof(src)); \
|
||||
memcpy(dest, src, sizeof(src)); \
|
||||
}
|
||||
|
||||
// Use this for variably-sized arrays.
|
||||
#define av1_copy_array(dest, src, n) \
|
||||
{ \
|
||||
assert(sizeof(*(dest)) == sizeof(*(src))); \
|
||||
memcpy(dest, src, n * sizeof(*(src))); \
|
||||
}
|
||||
|
||||
#define av1_zero(dest) memset(&(dest), 0, sizeof(dest))
|
||||
#define av1_zero_array(dest, n) memset(dest, 0, n * sizeof(*(dest)))
|
||||
|
||||
static INLINE int get_unsigned_bits(unsigned int num_values) {
|
||||
return num_values > 0 ? get_msb(num_values) + 1 : 0;
|
||||
}
|
||||
|
||||
#define CHECK_MEM_ERROR(cm, lval, expr) \
|
||||
AOM_CHECK_MEM_ERROR(&cm->error, lval, expr)
|
||||
// TODO(yaowu: validate the usage of these codes or develop new ones.)
|
||||
#define AV1_SYNC_CODE_0 0x49
|
||||
#define AV1_SYNC_CODE_1 0x83
|
||||
#define AV1_SYNC_CODE_2 0x43
|
||||
|
||||
#define AOM_FRAME_MARKER 0x2
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // AV1_COMMON_COMMON_H_
|
||||
1405
third_party/aom/av1/common/common_data.h
vendored
Normal file
1405
third_party/aom/av1/common/common_data.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
775
third_party/aom/av1/common/convolve.c
vendored
Normal file
775
third_party/aom/av1/common/convolve.c
vendored
Normal file
|
|
@ -0,0 +1,775 @@
|
|||
/*
|
||||
* 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 <string.h>
|
||||
|
||||
#include "./aom_dsp_rtcd.h"
|
||||
#include "./av1_rtcd.h"
|
||||
#include "av1/common/convolve.h"
|
||||
#include "av1/common/filter.h"
|
||||
#include "av1/common/onyxc_int.h"
|
||||
#include "aom_dsp/aom_dsp_common.h"
|
||||
#include "aom_ports/mem.h"
|
||||
|
||||
#define MAX_BLOCK_WIDTH (MAX_SB_SIZE)
|
||||
#define MAX_BLOCK_HEIGHT (MAX_SB_SIZE)
|
||||
#define MAX_STEP (32)
|
||||
|
||||
void av1_convolve_horiz_c(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
const InterpFilterParams filter_params,
|
||||
const int subpel_x_q4, int x_step_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
int x, y;
|
||||
int filter_size = filter_params.taps;
|
||||
assert(conv_params->round == CONVOLVE_OPT_ROUND);
|
||||
src -= filter_size / 2 - 1;
|
||||
for (y = 0; y < h; ++y) {
|
||||
int x_q4 = subpel_x_q4;
|
||||
for (x = 0; x < w; ++x) {
|
||||
const uint8_t *const src_x = &src[x_q4 >> SUBPEL_BITS];
|
||||
const int16_t *x_filter = av1_get_interp_filter_subpel_kernel(
|
||||
filter_params, x_q4 & SUBPEL_MASK);
|
||||
int k, sum = 0;
|
||||
for (k = 0; k < filter_size; ++k) sum += src_x[k] * x_filter[k];
|
||||
|
||||
sum = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS));
|
||||
if (conv_params->ref)
|
||||
dst[x] = ROUND_POWER_OF_TWO(dst[x] + sum, 1);
|
||||
else
|
||||
dst[x] = sum;
|
||||
|
||||
x_q4 += x_step_q4;
|
||||
}
|
||||
src += src_stride;
|
||||
dst += dst_stride;
|
||||
}
|
||||
}
|
||||
|
||||
void av1_convolve_vert_c(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
const InterpFilterParams filter_params,
|
||||
const int subpel_y_q4, int y_step_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
int x, y;
|
||||
int filter_size = filter_params.taps;
|
||||
assert(conv_params->round == CONVOLVE_OPT_ROUND);
|
||||
src -= src_stride * (filter_size / 2 - 1);
|
||||
for (x = 0; x < w; ++x) {
|
||||
int y_q4 = subpel_y_q4;
|
||||
for (y = 0; y < h; ++y) {
|
||||
const uint8_t *const src_y = &src[(y_q4 >> SUBPEL_BITS) * src_stride];
|
||||
const int16_t *y_filter = av1_get_interp_filter_subpel_kernel(
|
||||
filter_params, y_q4 & SUBPEL_MASK);
|
||||
int k, sum = 0;
|
||||
for (k = 0; k < filter_size; ++k)
|
||||
sum += src_y[k * src_stride] * y_filter[k];
|
||||
|
||||
sum = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS));
|
||||
if (conv_params->ref)
|
||||
dst[y * dst_stride] = ROUND_POWER_OF_TWO(dst[y * dst_stride] + sum, 1);
|
||||
else
|
||||
dst[y * dst_stride] = sum;
|
||||
|
||||
y_q4 += y_step_q4;
|
||||
}
|
||||
++src;
|
||||
++dst;
|
||||
}
|
||||
}
|
||||
|
||||
static void convolve_copy(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
ConvolveParams *conv_params) {
|
||||
assert(conv_params->round == CONVOLVE_OPT_ROUND);
|
||||
if (conv_params->ref == 0) {
|
||||
int r;
|
||||
for (r = 0; r < h; ++r) {
|
||||
memcpy(dst, src, w);
|
||||
src += src_stride;
|
||||
dst += dst_stride;
|
||||
}
|
||||
} else {
|
||||
int r, c;
|
||||
for (r = 0; r < h; ++r) {
|
||||
for (c = 0; c < w; ++c) {
|
||||
dst[c] = clip_pixel(ROUND_POWER_OF_TWO(dst[c] + src[c], 1));
|
||||
}
|
||||
src += src_stride;
|
||||
dst += dst_stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void av1_convolve_horiz_facade(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
const InterpFilterParams filter_params,
|
||||
const int subpel_x_q4, int x_step_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
assert(conv_params->round == CONVOLVE_OPT_ROUND);
|
||||
if (filter_params.taps == SUBPEL_TAPS) {
|
||||
const int16_t *filter_x =
|
||||
av1_get_interp_filter_subpel_kernel(filter_params, subpel_x_q4);
|
||||
if (conv_params->ref == 0)
|
||||
aom_convolve8_horiz(src, src_stride, dst, dst_stride, filter_x, x_step_q4,
|
||||
NULL, -1, w, h);
|
||||
else
|
||||
aom_convolve8_avg_horiz(src, src_stride, dst, dst_stride, filter_x,
|
||||
x_step_q4, NULL, -1, w, h);
|
||||
} else {
|
||||
av1_convolve_horiz(src, src_stride, dst, dst_stride, w, h, filter_params,
|
||||
subpel_x_q4, x_step_q4, conv_params);
|
||||
}
|
||||
}
|
||||
|
||||
void av1_convolve_horiz_facade_c(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride, int w, int h,
|
||||
const InterpFilterParams filter_params,
|
||||
const int subpel_x_q4, int x_step_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
assert(conv_params->round == CONVOLVE_OPT_ROUND);
|
||||
if (filter_params.taps == SUBPEL_TAPS) {
|
||||
const int16_t *filter_x =
|
||||
av1_get_interp_filter_subpel_kernel(filter_params, subpel_x_q4);
|
||||
if (conv_params->ref == 0)
|
||||
aom_convolve8_horiz_c(src, src_stride, dst, dst_stride, filter_x,
|
||||
x_step_q4, NULL, -1, w, h);
|
||||
else
|
||||
aom_convolve8_avg_horiz_c(src, src_stride, dst, dst_stride, filter_x,
|
||||
x_step_q4, NULL, -1, w, h);
|
||||
} else {
|
||||
av1_convolve_horiz_c(src, src_stride, dst, dst_stride, w, h, filter_params,
|
||||
subpel_x_q4, x_step_q4, conv_params);
|
||||
}
|
||||
}
|
||||
|
||||
void av1_convolve_vert_facade(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
const InterpFilterParams filter_params,
|
||||
const int subpel_y_q4, int y_step_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
assert(conv_params->round == CONVOLVE_OPT_ROUND);
|
||||
if (filter_params.taps == SUBPEL_TAPS) {
|
||||
const int16_t *filter_y =
|
||||
av1_get_interp_filter_subpel_kernel(filter_params, subpel_y_q4);
|
||||
if (conv_params->ref == 0) {
|
||||
aom_convolve8_vert(src, src_stride, dst, dst_stride, NULL, -1, filter_y,
|
||||
y_step_q4, w, h);
|
||||
} else {
|
||||
aom_convolve8_avg_vert(src, src_stride, dst, dst_stride, NULL, -1,
|
||||
filter_y, y_step_q4, w, h);
|
||||
}
|
||||
} else {
|
||||
av1_convolve_vert(src, src_stride, dst, dst_stride, w, h, filter_params,
|
||||
subpel_y_q4, y_step_q4, conv_params);
|
||||
}
|
||||
}
|
||||
|
||||
void av1_convolve_vert_facade_c(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride, int w, int h,
|
||||
const InterpFilterParams filter_params,
|
||||
const int subpel_y_q4, int y_step_q4,
|
||||
ConvolveParams *conv_params) {
|
||||
assert(conv_params->round == CONVOLVE_OPT_ROUND);
|
||||
if (filter_params.taps == SUBPEL_TAPS) {
|
||||
const int16_t *filter_y =
|
||||
av1_get_interp_filter_subpel_kernel(filter_params, subpel_y_q4);
|
||||
if (conv_params->ref == 0) {
|
||||
aom_convolve8_vert_c(src, src_stride, dst, dst_stride, NULL, -1, filter_y,
|
||||
y_step_q4, w, h);
|
||||
} else {
|
||||
aom_convolve8_avg_vert_c(src, src_stride, dst, dst_stride, NULL, -1,
|
||||
filter_y, y_step_q4, w, h);
|
||||
}
|
||||
} else {
|
||||
av1_convolve_vert_c(src, src_stride, dst, dst_stride, w, h, filter_params,
|
||||
subpel_y_q4, y_step_q4, conv_params);
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_CONVOLVE_ROUND
|
||||
void av1_convolve_rounding(const int32_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h, int bits) {
|
||||
int r, c;
|
||||
for (r = 0; r < h; ++r) {
|
||||
for (c = 0; c < w; ++c) {
|
||||
dst[r * dst_stride + c] =
|
||||
clip_pixel(ROUND_POWER_OF_TWO_SIGNED(src[r * src_stride + c], bits));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void av1_convolve_2d(const uint8_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 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 uint8_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(ROUND_POWER_OF_TWO_SIGNED(sum, conv_params->round_0));
|
||||
#else
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void transpose_uint8(uint8_t *dst, int dst_stride,
|
||||
const uint8_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];
|
||||
}
|
||||
|
||||
static INLINE void transpose_int32(int32_t *dst, int dst_stride,
|
||||
const int32_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_convolve_2d_facade(const uint8_t *src, 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) {
|
||||
(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 (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);
|
||||
}
|
||||
#else
|
||||
InterpFilterParams filter_params_x =
|
||||
av1_get_interp_filter_params(*interp_filter);
|
||||
InterpFilterParams filter_params_y =
|
||||
av1_get_interp_filter_params(*interp_filter);
|
||||
#endif
|
||||
|
||||
if (filter_params_y.taps < filter_params_x.taps) {
|
||||
uint8_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_uint8(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_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);
|
||||
transpose_int32(conv_params->dst, conv_params->dst_stride, tr_dst,
|
||||
tr_dst_stride, h, w);
|
||||
} else {
|
||||
av1_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);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // CONFIG_CONVOLVE_ROUND
|
||||
|
||||
typedef void (*ConvolveFunc)(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
const InterpFilterParams filter_params,
|
||||
const int subpel_q4, int step_q4,
|
||||
ConvolveParams *conv_params);
|
||||
|
||||
static void convolve_helper(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
#if CONFIG_DUAL_FILTER
|
||||
const InterpFilter *interp_filter,
|
||||
#else
|
||||
const InterpFilter interp_filter,
|
||||
#endif
|
||||
const int subpel_x_q4, int x_step_q4,
|
||||
const int subpel_y_q4, int y_step_q4,
|
||||
ConvolveParams *conv_params,
|
||||
ConvolveFunc convolve_horiz,
|
||||
ConvolveFunc convolve_vert) {
|
||||
int ignore_horiz = x_step_q4 == 16 && subpel_x_q4 == 0;
|
||||
int ignore_vert = y_step_q4 == 16 && subpel_y_q4 == 0;
|
||||
#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]);
|
||||
InterpFilterParams filter_params;
|
||||
#else
|
||||
InterpFilterParams filter_params =
|
||||
av1_get_interp_filter_params(interp_filter);
|
||||
#endif
|
||||
assert(conv_params->round == CONVOLVE_OPT_ROUND);
|
||||
|
||||
assert(w <= MAX_BLOCK_WIDTH);
|
||||
assert(h <= MAX_BLOCK_HEIGHT);
|
||||
assert(y_step_q4 <= MAX_STEP);
|
||||
assert(x_step_q4 <= MAX_STEP);
|
||||
|
||||
if (ignore_horiz && ignore_vert) {
|
||||
convolve_copy(src, src_stride, dst, dst_stride, w, h, conv_params);
|
||||
} else if (ignore_vert) {
|
||||
#if CONFIG_DUAL_FILTER
|
||||
filter_params = filter_params_x;
|
||||
#endif
|
||||
assert(filter_params.taps <= MAX_FILTER_TAP);
|
||||
convolve_horiz(src, src_stride, dst, dst_stride, w, h, filter_params,
|
||||
subpel_x_q4, x_step_q4, conv_params);
|
||||
} else if (ignore_horiz) {
|
||||
#if CONFIG_DUAL_FILTER
|
||||
filter_params = filter_params_y;
|
||||
#endif
|
||||
assert(filter_params.taps <= MAX_FILTER_TAP);
|
||||
convolve_vert(src, src_stride, dst, dst_stride, w, h, filter_params,
|
||||
subpel_y_q4, y_step_q4, conv_params);
|
||||
} else {
|
||||
// temp's size is set to a 256 aligned value to facilitate SIMD
|
||||
// implementation. The value is greater than (maximum possible intermediate
|
||||
// height or width) * MAX_SB_SIZE
|
||||
DECLARE_ALIGNED(16, uint8_t,
|
||||
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 (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.
|
||||
// This will reduce hardware implementation cost.
|
||||
filter_params_y = av1_get_interp_filter_params(EIGHTTAP_SHARP);
|
||||
}
|
||||
|
||||
// we do filter with fewer taps first to reduce hardware implementation
|
||||
// complexity
|
||||
if (filter_params_y.taps < filter_params_x.taps) {
|
||||
int intermediate_width;
|
||||
int temp_stride = max_intermediate_size;
|
||||
ConvolveParams temp_conv_params;
|
||||
temp_conv_params.ref = 0;
|
||||
temp_conv_params.round = CONVOLVE_OPT_ROUND;
|
||||
filter_params = filter_params_y;
|
||||
filter_size = filter_params_x.taps;
|
||||
intermediate_width =
|
||||
(((w - 1) * x_step_q4 + subpel_x_q4) >> SUBPEL_BITS) + filter_size;
|
||||
assert(intermediate_width <= max_intermediate_size);
|
||||
|
||||
assert(filter_params.taps <= MAX_FILTER_TAP);
|
||||
|
||||
convolve_vert(src - (filter_size / 2 - 1), src_stride, temp, temp_stride,
|
||||
intermediate_width, h, filter_params, subpel_y_q4,
|
||||
y_step_q4, &temp_conv_params);
|
||||
|
||||
filter_params = filter_params_x;
|
||||
assert(filter_params.taps <= MAX_FILTER_TAP);
|
||||
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
|
||||
{
|
||||
int intermediate_height;
|
||||
int temp_stride = MAX_SB_SIZE;
|
||||
ConvolveParams temp_conv_params;
|
||||
temp_conv_params.ref = 0;
|
||||
temp_conv_params.round = CONVOLVE_OPT_ROUND;
|
||||
#if CONFIG_DUAL_FILTER
|
||||
filter_params = filter_params_x;
|
||||
filter_size = filter_params_y.taps;
|
||||
#else
|
||||
filter_size = filter_params.taps;
|
||||
#endif
|
||||
intermediate_height =
|
||||
(((h - 1) * y_step_q4 + subpel_y_q4) >> SUBPEL_BITS) + filter_size;
|
||||
assert(intermediate_height <= max_intermediate_size);
|
||||
(void)max_intermediate_size;
|
||||
|
||||
assert(filter_params.taps <= MAX_FILTER_TAP);
|
||||
|
||||
convolve_horiz(src - src_stride * (filter_size / 2 - 1), src_stride, temp,
|
||||
temp_stride, w, intermediate_height, filter_params,
|
||||
subpel_x_q4, x_step_q4, &temp_conv_params);
|
||||
|
||||
#if CONFIG_DUAL_FILTER
|
||||
filter_params = filter_params_y;
|
||||
#endif
|
||||
assert(filter_params.taps <= MAX_FILTER_TAP);
|
||||
|
||||
convolve_vert(temp + temp_stride * (filter_size / 2 - 1), temp_stride,
|
||||
dst, dst_stride, w, h, filter_params, subpel_y_q4,
|
||||
y_step_q4, conv_params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void av1_convolve(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
#if CONFIG_DUAL_FILTER
|
||||
const InterpFilter *interp_filter,
|
||||
#else
|
||||
const InterpFilter interp_filter,
|
||||
#endif
|
||||
const int subpel_x_q4, int x_step_q4, const int subpel_y_q4,
|
||||
int y_step_q4, ConvolveParams *conv_params) {
|
||||
convolve_helper(src, src_stride, dst, dst_stride, w, h, interp_filter,
|
||||
subpel_x_q4, x_step_q4, subpel_y_q4, y_step_q4, conv_params,
|
||||
av1_convolve_horiz_facade, av1_convolve_vert_facade);
|
||||
}
|
||||
|
||||
void av1_convolve_c(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
#if CONFIG_DUAL_FILTER
|
||||
const InterpFilter *interp_filter,
|
||||
#else
|
||||
const InterpFilter interp_filter,
|
||||
#endif
|
||||
const int subpel_x_q4, int x_step_q4, const int subpel_y_q4,
|
||||
int y_step_q4, ConvolveParams *conv_params) {
|
||||
convolve_helper(src, src_stride, dst, dst_stride, w, h, interp_filter,
|
||||
subpel_x_q4, x_step_q4, subpel_y_q4, y_step_q4, conv_params,
|
||||
av1_convolve_horiz_facade_c, av1_convolve_vert_facade_c);
|
||||
}
|
||||
|
||||
void av1_lowbd_convolve_init_c(void) {
|
||||
// A placeholder for SIMD initialization
|
||||
return;
|
||||
}
|
||||
|
||||
void av1_highbd_convolve_init_c(void) {
|
||||
// A placeholder for SIMD initialization
|
||||
return;
|
||||
}
|
||||
|
||||
void av1_convolve_init(AV1_COMMON *cm) {
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (cm->use_highbitdepth)
|
||||
av1_highbd_convolve_init();
|
||||
else
|
||||
av1_lowbd_convolve_init();
|
||||
#else
|
||||
(void)cm;
|
||||
av1_lowbd_convolve_init();
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
void av1_highbd_convolve_horiz_c(const uint16_t *src, int src_stride,
|
||||
uint16_t *dst, int dst_stride, int w, int h,
|
||||
const InterpFilterParams filter_params,
|
||||
const int subpel_x_q4, int x_step_q4, int avg,
|
||||
int bd) {
|
||||
int x, y;
|
||||
int filter_size = filter_params.taps;
|
||||
src -= filter_size / 2 - 1;
|
||||
for (y = 0; y < h; ++y) {
|
||||
int x_q4 = subpel_x_q4;
|
||||
for (x = 0; x < w; ++x) {
|
||||
const uint16_t *const src_x = &src[x_q4 >> SUBPEL_BITS];
|
||||
const int16_t *x_filter = av1_get_interp_filter_subpel_kernel(
|
||||
filter_params, x_q4 & SUBPEL_MASK);
|
||||
int k, sum = 0;
|
||||
for (k = 0; k < filter_size; ++k) sum += src_x[k] * x_filter[k];
|
||||
if (avg)
|
||||
dst[x] = ROUND_POWER_OF_TWO(
|
||||
dst[x] +
|
||||
clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd),
|
||||
1);
|
||||
else
|
||||
dst[x] = clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd);
|
||||
x_q4 += x_step_q4;
|
||||
}
|
||||
src += src_stride;
|
||||
dst += dst_stride;
|
||||
}
|
||||
}
|
||||
|
||||
void av1_highbd_convolve_vert_c(const uint16_t *src, int src_stride,
|
||||
uint16_t *dst, int dst_stride, int w, int h,
|
||||
const InterpFilterParams filter_params,
|
||||
const int subpel_y_q4, int y_step_q4, int avg,
|
||||
int bd) {
|
||||
int x, y;
|
||||
int filter_size = filter_params.taps;
|
||||
src -= src_stride * (filter_size / 2 - 1);
|
||||
|
||||
for (x = 0; x < w; ++x) {
|
||||
int y_q4 = subpel_y_q4;
|
||||
for (y = 0; y < h; ++y) {
|
||||
const uint16_t *const src_y = &src[(y_q4 >> SUBPEL_BITS) * src_stride];
|
||||
const int16_t *y_filter = av1_get_interp_filter_subpel_kernel(
|
||||
filter_params, y_q4 & SUBPEL_MASK);
|
||||
int k, sum = 0;
|
||||
for (k = 0; k < filter_size; ++k)
|
||||
sum += src_y[k * src_stride] * y_filter[k];
|
||||
if (avg) {
|
||||
dst[y * dst_stride] = ROUND_POWER_OF_TWO(
|
||||
dst[y * dst_stride] +
|
||||
clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd),
|
||||
1);
|
||||
} else {
|
||||
dst[y * dst_stride] =
|
||||
clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd);
|
||||
}
|
||||
y_q4 += y_step_q4;
|
||||
}
|
||||
++src;
|
||||
++dst;
|
||||
}
|
||||
}
|
||||
|
||||
static void highbd_convolve_copy(const uint16_t *src, int src_stride,
|
||||
uint16_t *dst, int dst_stride, int w, int h,
|
||||
int avg, int bd) {
|
||||
if (avg == 0) {
|
||||
int r;
|
||||
for (r = 0; r < h; ++r) {
|
||||
memcpy(dst, src, w * sizeof(*src));
|
||||
src += src_stride;
|
||||
dst += dst_stride;
|
||||
}
|
||||
} else {
|
||||
int r, c;
|
||||
for (r = 0; r < h; ++r) {
|
||||
for (c = 0; c < w; ++c) {
|
||||
dst[c] = clip_pixel_highbd(ROUND_POWER_OF_TWO(dst[c] + src[c], 1), bd);
|
||||
}
|
||||
src += src_stride;
|
||||
dst += dst_stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void av1_highbd_convolve_horiz_facade(const uint8_t *src8, int src_stride,
|
||||
uint8_t *dst8, int dst_stride, int w,
|
||||
int h,
|
||||
const InterpFilterParams filter_params,
|
||||
const int subpel_x_q4, int x_step_q4,
|
||||
int avg, int bd) {
|
||||
uint16_t *src = CONVERT_TO_SHORTPTR(src8);
|
||||
uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
|
||||
if (filter_params.taps == SUBPEL_TAPS) {
|
||||
const int16_t *filter_x =
|
||||
av1_get_interp_filter_subpel_kernel(filter_params, subpel_x_q4);
|
||||
if (avg == 0)
|
||||
aom_highbd_convolve8_horiz(src8, src_stride, dst8, dst_stride, filter_x,
|
||||
x_step_q4, NULL, -1, w, h, bd);
|
||||
else
|
||||
aom_highbd_convolve8_avg_horiz(src8, src_stride, dst8, dst_stride,
|
||||
filter_x, x_step_q4, NULL, -1, w, h, bd);
|
||||
} else {
|
||||
av1_highbd_convolve_horiz(src, src_stride, dst, dst_stride, w, h,
|
||||
filter_params, subpel_x_q4, x_step_q4, avg, bd);
|
||||
}
|
||||
}
|
||||
|
||||
void av1_highbd_convolve_vert_facade(const uint8_t *src8, int src_stride,
|
||||
uint8_t *dst8, int dst_stride, int w,
|
||||
int h,
|
||||
const InterpFilterParams filter_params,
|
||||
const int subpel_y_q4, int y_step_q4,
|
||||
int avg, int bd) {
|
||||
uint16_t *src = CONVERT_TO_SHORTPTR(src8);
|
||||
uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
|
||||
|
||||
if (filter_params.taps == SUBPEL_TAPS) {
|
||||
const int16_t *filter_y =
|
||||
av1_get_interp_filter_subpel_kernel(filter_params, subpel_y_q4);
|
||||
if (avg == 0) {
|
||||
aom_highbd_convolve8_vert(src8, src_stride, dst8, dst_stride, NULL, -1,
|
||||
filter_y, y_step_q4, w, h, bd);
|
||||
} else {
|
||||
aom_highbd_convolve8_avg_vert(src8, src_stride, dst8, dst_stride, NULL,
|
||||
-1, filter_y, y_step_q4, w, h, bd);
|
||||
}
|
||||
} else {
|
||||
av1_highbd_convolve_vert(src, src_stride, dst, dst_stride, w, h,
|
||||
filter_params, subpel_y_q4, y_step_q4, avg, bd);
|
||||
}
|
||||
}
|
||||
|
||||
void av1_highbd_convolve(const uint8_t *src8, int src_stride, uint8_t *dst8,
|
||||
int dst_stride, int w, int h,
|
||||
#if CONFIG_DUAL_FILTER
|
||||
const InterpFilter *interp_filter,
|
||||
#else
|
||||
const InterpFilter interp_filter,
|
||||
#endif
|
||||
const int subpel_x_q4, int x_step_q4,
|
||||
const int subpel_y_q4, int y_step_q4, int ref_idx,
|
||||
int bd) {
|
||||
uint16_t *src = CONVERT_TO_SHORTPTR(src8);
|
||||
uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
|
||||
int ignore_horiz = x_step_q4 == 16 && subpel_x_q4 == 0;
|
||||
int ignore_vert = y_step_q4 == 16 && subpel_y_q4 == 0;
|
||||
|
||||
assert(w <= MAX_BLOCK_WIDTH);
|
||||
assert(h <= MAX_BLOCK_HEIGHT);
|
||||
assert(y_step_q4 <= MAX_STEP);
|
||||
assert(x_step_q4 <= MAX_STEP);
|
||||
|
||||
if (ignore_horiz && ignore_vert) {
|
||||
highbd_convolve_copy(src, src_stride, dst, dst_stride, w, h, ref_idx, bd);
|
||||
} else if (ignore_vert) {
|
||||
#if CONFIG_DUAL_FILTER
|
||||
InterpFilterParams filter_params =
|
||||
av1_get_interp_filter_params(interp_filter[1 + 2 * ref_idx]);
|
||||
#else
|
||||
InterpFilterParams filter_params =
|
||||
av1_get_interp_filter_params(interp_filter);
|
||||
#endif
|
||||
av1_highbd_convolve_horiz_facade(src8, src_stride, dst8, dst_stride, w, h,
|
||||
filter_params, subpel_x_q4, x_step_q4,
|
||||
ref_idx, bd);
|
||||
} else if (ignore_horiz) {
|
||||
#if CONFIG_DUAL_FILTER
|
||||
InterpFilterParams filter_params =
|
||||
av1_get_interp_filter_params(interp_filter[0 + 2 * ref_idx]);
|
||||
#else
|
||||
InterpFilterParams filter_params =
|
||||
av1_get_interp_filter_params(interp_filter);
|
||||
#endif
|
||||
av1_highbd_convolve_vert_facade(src8, src_stride, dst8, dst_stride, w, h,
|
||||
filter_params, subpel_y_q4, y_step_q4,
|
||||
ref_idx, bd);
|
||||
} else {
|
||||
// temp's size is set to a 256 aligned value to facilitate SIMD
|
||||
// implementation. The value is greater than (maximum possible intermediate
|
||||
// height or width) * MAX_SB_SIZE
|
||||
DECLARE_ALIGNED(16, uint16_t,
|
||||
temp[((MAX_SB_SIZE * 2 + 16) + 16) * MAX_SB_SIZE]);
|
||||
uint8_t *temp8 = CONVERT_TO_BYTEPTR(temp);
|
||||
int max_intermediate_size = ((MAX_SB_SIZE * 2 + 16) + 16);
|
||||
int filter_size;
|
||||
InterpFilterParams filter_params;
|
||||
#if CONFIG_DUAL_FILTER
|
||||
InterpFilterParams filter_params_x =
|
||||
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]);
|
||||
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;
|
||||
filter_params = filter_params_y;
|
||||
filter_size = filter_params_x.taps;
|
||||
intermediate_width =
|
||||
(((w - 1) * x_step_q4 + subpel_x_q4) >> SUBPEL_BITS) + filter_size;
|
||||
assert(intermediate_width <= max_intermediate_size);
|
||||
|
||||
assert(filter_params.taps <= MAX_FILTER_TAP);
|
||||
|
||||
av1_highbd_convolve_vert_facade(
|
||||
src8 - (filter_size / 2 - 1), src_stride, temp8, temp_stride,
|
||||
intermediate_width, h, filter_params, subpel_y_q4, y_step_q4, 0, bd);
|
||||
|
||||
filter_params = filter_params_x;
|
||||
assert(filter_params.taps <= MAX_FILTER_TAP);
|
||||
|
||||
av1_highbd_convolve_horiz_facade(
|
||||
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
|
||||
{
|
||||
int intermediate_height;
|
||||
int temp_stride = MAX_SB_SIZE;
|
||||
#if CONFIG_DUAL_FILTER
|
||||
filter_params = filter_params_x;
|
||||
filter_size = filter_params_y.taps;
|
||||
#else
|
||||
filter_params = av1_get_interp_filter_params(interp_filter);
|
||||
filter_size = filter_params.taps;
|
||||
#endif
|
||||
intermediate_height =
|
||||
(((h - 1) * y_step_q4 + subpel_y_q4) >> SUBPEL_BITS) + filter_size;
|
||||
assert(intermediate_height <= max_intermediate_size);
|
||||
(void)max_intermediate_size;
|
||||
|
||||
av1_highbd_convolve_horiz_facade(
|
||||
src8 - src_stride * (filter_size / 2 - 1), src_stride, temp8,
|
||||
temp_stride, w, intermediate_height, filter_params, subpel_x_q4,
|
||||
x_step_q4, 0, bd);
|
||||
|
||||
#if CONFIG_DUAL_FILTER
|
||||
filter_params = filter_params_y;
|
||||
#endif
|
||||
filter_size = filter_params.taps;
|
||||
assert(filter_params.taps <= MAX_FILTER_TAP);
|
||||
|
||||
av1_highbd_convolve_vert_facade(
|
||||
temp8 + temp_stride * (filter_size / 2 - 1), temp_stride, dst8,
|
||||
dst_stride, w, h, filter_params, subpel_y_q4, y_step_q4, ref_idx, bd);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
119
third_party/aom/av1/common/convolve.h
vendored
Normal file
119
third_party/aom/av1/common/convolve.h
vendored
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* 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_COMMON_AV1_CONVOLVE_H_
|
||||
#define AV1_COMMON_AV1_CONVOLVE_H_
|
||||
#include "av1/common/filter.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum CONVOLVE_OPT {
|
||||
// indicate the results in dst buf is rounded by FILTER_BITS or not
|
||||
CONVOLVE_OPT_ROUND,
|
||||
CONVOLVE_OPT_NO_ROUND,
|
||||
} CONVOLVE_OPT;
|
||||
|
||||
typedef int32_t CONV_BUF_TYPE;
|
||||
|
||||
typedef struct ConvolveParams {
|
||||
int ref;
|
||||
CONVOLVE_OPT round;
|
||||
CONV_BUF_TYPE *dst;
|
||||
int dst_stride;
|
||||
int round_0;
|
||||
int round_1;
|
||||
int plane;
|
||||
} ConvolveParams;
|
||||
|
||||
static INLINE ConvolveParams get_conv_params(int ref, int plane) {
|
||||
ConvolveParams conv_params;
|
||||
conv_params.ref = ref;
|
||||
conv_params.round = CONVOLVE_OPT_ROUND;
|
||||
conv_params.plane = plane;
|
||||
return conv_params;
|
||||
}
|
||||
struct AV1Common;
|
||||
void av1_convolve_init(struct AV1Common *cm);
|
||||
#if CONFIG_CONVOLVE_ROUND
|
||||
void av1_convolve_2d(const uint8_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);
|
||||
|
||||
void av1_convolve_2d_facade(const uint8_t *src, 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);
|
||||
|
||||
static INLINE ConvolveParams get_conv_params_no_round(int ref, int plane,
|
||||
int32_t *dst,
|
||||
int dst_stride) {
|
||||
ConvolveParams conv_params;
|
||||
conv_params.ref = ref;
|
||||
conv_params.round = CONVOLVE_OPT_NO_ROUND;
|
||||
#if CONFIG_COMPOUND_ROUND
|
||||
conv_params.round_0 = FILTER_BITS;
|
||||
#else
|
||||
conv_params.round_0 = 5;
|
||||
#endif
|
||||
conv_params.round_1 = 0;
|
||||
conv_params.dst = dst;
|
||||
conv_params.dst_stride = dst_stride;
|
||||
conv_params.plane = plane;
|
||||
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);
|
||||
#endif // CONFIG_CONVOLVE_ROUND
|
||||
|
||||
void av1_convolve(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
#if CONFIG_DUAL_FILTER
|
||||
const InterpFilter *interp_filter,
|
||||
#else
|
||||
const InterpFilter interp_filter,
|
||||
#endif
|
||||
const int subpel_x, int xstep, const int subpel_y, int ystep,
|
||||
ConvolveParams *conv_params);
|
||||
|
||||
void av1_convolve_c(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
#if CONFIG_DUAL_FILTER
|
||||
const InterpFilter *interp_filter,
|
||||
#else
|
||||
const InterpFilter interp_filter,
|
||||
#endif
|
||||
const int subpel_x, int xstep, const int subpel_y,
|
||||
int ystep, ConvolveParams *conv_params);
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
void av1_highbd_convolve(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, int w, int h,
|
||||
#if CONFIG_DUAL_FILTER
|
||||
const InterpFilter *interp_filter,
|
||||
#else
|
||||
const InterpFilter interp_filter,
|
||||
#endif
|
||||
const int subpel_x, int xstep, const int subpel_y,
|
||||
int ystep, int avg, int bd);
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // AV1_COMMON_AV1_CONVOLVE_H_
|
||||
90
third_party/aom/av1/common/debugmodes.c
vendored
Normal file
90
third_party/aom/av1/common/debugmodes.c
vendored
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* 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 <stdio.h>
|
||||
|
||||
#include "av1/common/blockd.h"
|
||||
#include "av1/common/onyxc_int.h"
|
||||
|
||||
static void log_frame_info(AV1_COMMON *cm, const char *str, FILE *f) {
|
||||
fprintf(f, "%s", str);
|
||||
fprintf(f, "(Frame %d, Show:%d, Q:%d): \n", cm->current_video_frame,
|
||||
cm->show_frame, cm->base_qindex);
|
||||
}
|
||||
/* This function dereferences a pointer to the mbmi structure
|
||||
* and uses the passed in member offset to print out the value of an integer
|
||||
* for each mbmi member value in the mi structure.
|
||||
*/
|
||||
static void print_mi_data(AV1_COMMON *cm, FILE *file, const char *descriptor,
|
||||
size_t member_offset) {
|
||||
int mi_row, mi_col;
|
||||
MODE_INFO **mi = cm->mi_grid_visible;
|
||||
int rows = cm->mi_rows;
|
||||
int cols = cm->mi_cols;
|
||||
char prefix = descriptor[0];
|
||||
|
||||
log_frame_info(cm, descriptor, file);
|
||||
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)));
|
||||
mi++;
|
||||
}
|
||||
fprintf(file, "\n");
|
||||
mi += 8;
|
||||
}
|
||||
fprintf(file, "\n");
|
||||
}
|
||||
|
||||
void av1_print_modes_and_motion_vectors(AV1_COMMON *cm, const char *file) {
|
||||
int mi_row;
|
||||
int mi_col;
|
||||
FILE *mvs = fopen(file, "a");
|
||||
MODE_INFO **mi = cm->mi_grid_visible;
|
||||
int rows = cm->mi_rows;
|
||||
int cols = cm->mi_cols;
|
||||
|
||||
print_mi_data(cm, mvs, "Partitions:", offsetof(MB_MODE_INFO, sb_type));
|
||||
print_mi_data(cm, mvs, "Modes:", offsetof(MB_MODE_INFO, mode));
|
||||
print_mi_data(cm, mvs, "Ref frame:", offsetof(MB_MODE_INFO, ref_frame[0]));
|
||||
print_mi_data(cm, mvs, "Transform:", offsetof(MB_MODE_INFO, tx_size));
|
||||
print_mi_data(cm, mvs, "UV Modes:", offsetof(MB_MODE_INFO, uv_mode));
|
||||
|
||||
// output skip infomation.
|
||||
log_frame_info(cm, "Skips:", mvs);
|
||||
for (mi_row = 0; mi_row < rows; mi_row++) {
|
||||
fprintf(mvs, "S ");
|
||||
for (mi_col = 0; mi_col < cols; mi_col++) {
|
||||
fprintf(mvs, "%2d ", mi[0]->mbmi.skip);
|
||||
mi++;
|
||||
}
|
||||
fprintf(mvs, "\n");
|
||||
mi += 8;
|
||||
}
|
||||
fprintf(mvs, "\n");
|
||||
|
||||
// output motion vectors.
|
||||
log_frame_info(cm, "Vectors ", mvs);
|
||||
mi = cm->mi_grid_visible;
|
||||
for (mi_row = 0; mi_row < rows; mi_row++) {
|
||||
fprintf(mvs, "V ");
|
||||
for (mi_col = 0; mi_col < cols; mi_col++) {
|
||||
fprintf(mvs, "%4d:%4d ", mi[0]->mbmi.mv[0].as_mv.row,
|
||||
mi[0]->mbmi.mv[0].as_mv.col);
|
||||
mi++;
|
||||
}
|
||||
fprintf(mvs, "\n");
|
||||
mi += 8;
|
||||
}
|
||||
fprintf(mvs, "\n");
|
||||
|
||||
fclose(mvs);
|
||||
}
|
||||
6438
third_party/aom/av1/common/entropy.c
vendored
Normal file
6438
third_party/aom/av1/common/entropy.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
428
third_party/aom/av1/common/entropy.h
vendored
Normal file
428
third_party/aom/av1/common/entropy.h
vendored
Normal file
|
|
@ -0,0 +1,428 @@
|
|||
/*
|
||||
* 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_COMMON_ENTROPY_H_
|
||||
#define AV1_COMMON_ENTROPY_H_
|
||||
|
||||
#include "./aom_config.h"
|
||||
#include "aom/aom_integer.h"
|
||||
#include "aom_dsp/prob.h"
|
||||
|
||||
#include "av1/common/common.h"
|
||||
#include "av1/common/common_data.h"
|
||||
#include "av1/common/enums.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define DIFF_UPDATE_PROB 252
|
||||
#define GROUP_DIFF_UPDATE_PROB 252
|
||||
|
||||
#if CONFIG_Q_ADAPT_PROBS
|
||||
#define QCTX_BIN_BITS 2
|
||||
#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
|
||||
#define TWO_TOKEN 2 // 2 Extra Bits 0+1
|
||||
#define THREE_TOKEN 3 // 3 Extra Bits 0+1
|
||||
#define FOUR_TOKEN 4 // 4 Extra Bits 0+1
|
||||
#define CATEGORY1_TOKEN 5 // 5-6 Extra Bits 1+1
|
||||
#define CATEGORY2_TOKEN 6 // 7-10 Extra Bits 2+1
|
||||
#define CATEGORY3_TOKEN 7 // 11-18 Extra Bits 3+1
|
||||
#define CATEGORY4_TOKEN 8 // 19-34 Extra Bits 4+1
|
||||
#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 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
|
||||
|
||||
#if CONFIG_LV_MAP
|
||||
#define TXB_SKIP_CONTEXTS 13
|
||||
#define SIG_COEF_CONTEXTS 20
|
||||
#define EOB_COEF_CONTEXTS 25
|
||||
#define COEFF_BASE_CONTEXTS 42
|
||||
#define DC_SIGN_CONTEXTS 3
|
||||
|
||||
#define BR_TMP_OFFSET 12
|
||||
#define BR_REF_CAT 4
|
||||
#define LEVEL_CONTEXTS (BR_TMP_OFFSET * BR_REF_CAT)
|
||||
|
||||
#define NUM_BASE_LEVELS 2
|
||||
#define COEFF_BASE_RANGE (15 - NUM_BASE_LEVELS)
|
||||
|
||||
#define COEFF_CONTEXT_BITS 6
|
||||
#define COEFF_CONTEXT_MASK ((1 << COEFF_CONTEXT_BITS) - 1)
|
||||
#endif
|
||||
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, av1_pt_energy_class[ENTROPY_TOKENS]);
|
||||
|
||||
#define CAT1_MIN_VAL 5
|
||||
#define CAT2_MIN_VAL 7
|
||||
#define CAT3_MIN_VAL 11
|
||||
#define CAT4_MIN_VAL 19
|
||||
#define CAT5_MIN_VAL 35
|
||||
#define CAT6_MIN_VAL 67
|
||||
|
||||
// Extra bit probabilities.
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat1_prob[1]);
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat2_prob[2]);
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat3_prob[3]);
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat4_prob[4]);
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat5_prob[5]);
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat6_prob[18]);
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
extern const aom_cdf_prob *av1_cat1_cdf[];
|
||||
extern const aom_cdf_prob *av1_cat2_cdf[];
|
||||
extern const aom_cdf_prob *av1_cat3_cdf[];
|
||||
extern const aom_cdf_prob *av1_cat4_cdf[];
|
||||
extern const aom_cdf_prob *av1_cat5_cdf[];
|
||||
extern const aom_cdf_prob *av1_cat6_cdf[];
|
||||
#endif
|
||||
|
||||
#define EOB_MODEL_TOKEN 3
|
||||
|
||||
typedef struct {
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
const aom_cdf_prob **cdf;
|
||||
#else
|
||||
const aom_prob *prob;
|
||||
#endif
|
||||
int len;
|
||||
int base_val;
|
||||
const int16_t *cost;
|
||||
} av1_extra_bit;
|
||||
|
||||
// indexed by token value
|
||||
extern const av1_extra_bit av1_extra_bits[ENTROPY_TOKENS];
|
||||
|
||||
static INLINE int av1_get_cat6_extrabits_size(TX_SIZE tx_size,
|
||||
aom_bit_depth_t bit_depth) {
|
||||
tx_size = txsize_sqr_up_map[tx_size];
|
||||
#if CONFIG_TX64X64
|
||||
// TODO(debargha): Does TX_64X64 require an additional extrabit?
|
||||
if (tx_size > TX_32X32) tx_size = TX_32X32;
|
||||
#endif
|
||||
#if CONFIG_CB4X4
|
||||
int tx_offset = (tx_size < TX_4X4) ? 0 : (int)(tx_size - TX_4X4);
|
||||
#else
|
||||
int tx_offset = (int)(tx_size - TX_4X4);
|
||||
#endif
|
||||
int bits = (int)bit_depth + 3 + tx_offset;
|
||||
#if CONFIG_NEW_MULTISYMBOL
|
||||
// Round up
|
||||
bits = AOMMIN((int)sizeof(av1_cat6_prob), ((bits + 3) & ~3));
|
||||
#endif
|
||||
assert(bits <= (int)sizeof(av1_cat6_prob));
|
||||
return bits;
|
||||
}
|
||||
|
||||
#define DCT_MAX_VALUE 16384
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
#define DCT_MAX_VALUE_HIGH10 65536
|
||||
#define DCT_MAX_VALUE_HIGH12 262144
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
||||
/* Coefficients are predicted via a 3-dimensional probability table. */
|
||||
|
||||
#define REF_TYPES 2 // intra=0, inter=1
|
||||
|
||||
/* Middle dimension reflects the coefficient position within the transform. */
|
||||
#define COEF_BANDS 6
|
||||
|
||||
/* Inside dimension is measure of nearby complexity, that reflects the energy
|
||||
of nearby coefficients are nonzero. For the first coefficient (DC, unless
|
||||
block type is 0), we look at the (already encoded) blocks above and to the
|
||||
left of the current block. The context index is then the number (0,1,or 2)
|
||||
of these blocks having nonzero coefficients.
|
||||
After decoding a coefficient, the measure is determined by the size of the
|
||||
most recently decoded coefficient.
|
||||
Note that the intuitive meaning of this measure changes as coefficients
|
||||
are decoded, e.g., prior to the first token, a zero means that my neighbors
|
||||
are empty while, after the first token, because of the use of end-of-block,
|
||||
a zero means we just decoded a zero and hence guarantees that a non-zero
|
||||
coefficient will appear later in this block. However, this shift
|
||||
in meaning is perfectly OK because our context depends also on the
|
||||
coefficient band (and since zigzag positions 0, 1, and 2 are in
|
||||
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)
|
||||
|
||||
// #define ENTROPY_STATS
|
||||
|
||||
typedef unsigned int av1_coeff_count[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
|
||||
[ENTROPY_TOKENS];
|
||||
typedef unsigned int av1_coeff_stats[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
|
||||
[ENTROPY_NODES][2];
|
||||
|
||||
#define SUBEXP_PARAM 4 /* Subexponential code parameter */
|
||||
#define MODULUS_PARAM 13 /* Modulus parameter */
|
||||
|
||||
struct AV1Common;
|
||||
struct frame_contexts;
|
||||
void av1_default_coef_probs(struct AV1Common *cm);
|
||||
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.
|
||||
// This macro is currently unused but may be used by certain implementations
|
||||
#define MAXBAND_INDEX 21
|
||||
|
||||
DECLARE_ALIGNED(16, extern const uint8_t,
|
||||
av1_coefband_trans_8x8plus[MAX_TX_SQUARE]);
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, av1_coefband_trans_4x8_8x4[32]);
|
||||
DECLARE_ALIGNED(16, extern const uint8_t, av1_coefband_trans_4x4[16]);
|
||||
|
||||
DECLARE_ALIGNED(16, extern const uint16_t, band_count_table[TX_SIZES_ALL][8]);
|
||||
DECLARE_ALIGNED(16, extern const uint16_t,
|
||||
band_cum_count_table[TX_SIZES_ALL][8]);
|
||||
|
||||
static INLINE const uint8_t *get_band_translate(TX_SIZE tx_size) {
|
||||
switch (tx_size) {
|
||||
case TX_4X4: return av1_coefband_trans_4x4;
|
||||
case TX_8X4:
|
||||
case TX_4X8: return av1_coefband_trans_4x8_8x4;
|
||||
default: return av1_coefband_trans_8x8plus;
|
||||
}
|
||||
}
|
||||
|
||||
// 128 lists of probabilities are stored for the following ONE node probs:
|
||||
// 1, 3, 5, 7, ..., 253, 255
|
||||
// In between probabilities are interpolated linearly
|
||||
|
||||
#define COEFF_PROB_MODELS 255
|
||||
|
||||
#define UNCONSTRAINED_NODES 3
|
||||
|
||||
#define PIVOT_NODE 2 // which node is pivot
|
||||
|
||||
#define MODEL_NODES (ENTROPY_NODES - UNCONSTRAINED_NODES)
|
||||
#define TAIL_NODES (MODEL_NODES + 1)
|
||||
extern const aom_tree_index av1_coef_con_tree[TREE_SIZE(ENTROPY_TOKENS)];
|
||||
extern const aom_prob av1_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES];
|
||||
|
||||
typedef aom_prob av1_coeff_probs_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
|
||||
[UNCONSTRAINED_NODES];
|
||||
|
||||
typedef unsigned int av1_coeff_count_model[REF_TYPES][COEF_BANDS]
|
||||
[COEFF_CONTEXTS]
|
||||
[UNCONSTRAINED_NODES + 1];
|
||||
|
||||
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];
|
||||
typedef unsigned int av1_blockz_count_model[REF_TYPES][BLOCKZ_CONTEXTS][2];
|
||||
extern const aom_cdf_prob av1_pareto8_token_probs[COEFF_PROB_MODELS]
|
||||
[ENTROPY_TOKENS - 2];
|
||||
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;
|
||||
|
||||
static INLINE int combine_entropy_contexts(ENTROPY_CONTEXT a,
|
||||
ENTROPY_CONTEXT b) {
|
||||
return (a != 0) + (b != 0);
|
||||
}
|
||||
|
||||
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
|
||||
switch (tx_size) {
|
||||
case TX_2X2:
|
||||
above_ec = a[0] != 0;
|
||||
left_ec = l[0] != 0;
|
||||
break;
|
||||
case TX_4X4:
|
||||
above_ec = !!*(const uint16_t *)a;
|
||||
left_ec = !!*(const uint16_t *)l;
|
||||
break;
|
||||
case TX_4X8:
|
||||
above_ec = !!*(const uint16_t *)a;
|
||||
left_ec = !!*(const uint32_t *)l;
|
||||
break;
|
||||
case TX_8X4:
|
||||
above_ec = !!*(const uint32_t *)a;
|
||||
left_ec = !!*(const uint16_t *)l;
|
||||
break;
|
||||
case TX_8X8:
|
||||
above_ec = !!*(const uint32_t *)a;
|
||||
left_ec = !!*(const uint32_t *)l;
|
||||
break;
|
||||
case TX_8X16:
|
||||
above_ec = !!*(const uint32_t *)a;
|
||||
left_ec = !!*(const uint64_t *)l;
|
||||
break;
|
||||
case TX_16X8:
|
||||
above_ec = !!*(const uint64_t *)a;
|
||||
left_ec = !!*(const uint32_t *)l;
|
||||
break;
|
||||
case TX_16X16:
|
||||
above_ec = !!*(const uint64_t *)a;
|
||||
left_ec = !!*(const uint64_t *)l;
|
||||
break;
|
||||
case TX_16X32:
|
||||
above_ec = !!*(const uint64_t *)a;
|
||||
left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8));
|
||||
break;
|
||||
case TX_32X16:
|
||||
above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8));
|
||||
left_ec = !!*(const uint64_t *)l;
|
||||
break;
|
||||
case TX_32X32:
|
||||
above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8));
|
||||
left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8));
|
||||
break;
|
||||
default: assert(0 && "Invalid transform size."); break;
|
||||
}
|
||||
return combine_entropy_contexts(above_ec, left_ec);
|
||||
#endif
|
||||
|
||||
switch (tx_size) {
|
||||
case TX_4X4:
|
||||
above_ec = a[0] != 0;
|
||||
left_ec = l[0] != 0;
|
||||
break;
|
||||
case TX_4X8:
|
||||
above_ec = a[0] != 0;
|
||||
left_ec = !!*(const uint16_t *)l;
|
||||
break;
|
||||
case TX_8X4:
|
||||
above_ec = !!*(const uint16_t *)a;
|
||||
left_ec = l[0] != 0;
|
||||
break;
|
||||
case TX_8X16:
|
||||
above_ec = !!*(const uint16_t *)a;
|
||||
left_ec = !!*(const uint32_t *)l;
|
||||
break;
|
||||
case TX_16X8:
|
||||
above_ec = !!*(const uint32_t *)a;
|
||||
left_ec = !!*(const uint16_t *)l;
|
||||
break;
|
||||
case TX_16X32:
|
||||
above_ec = !!*(const uint32_t *)a;
|
||||
left_ec = !!*(const uint64_t *)l;
|
||||
break;
|
||||
case TX_32X16:
|
||||
above_ec = !!*(const uint64_t *)a;
|
||||
left_ec = !!*(const uint32_t *)l;
|
||||
break;
|
||||
case TX_8X8:
|
||||
above_ec = !!*(const uint16_t *)a;
|
||||
left_ec = !!*(const uint16_t *)l;
|
||||
break;
|
||||
case TX_16X16:
|
||||
above_ec = !!*(const uint32_t *)a;
|
||||
left_ec = !!*(const uint32_t *)l;
|
||||
break;
|
||||
case TX_32X32:
|
||||
above_ec = !!*(const uint64_t *)a;
|
||||
left_ec = !!*(const uint64_t *)l;
|
||||
break;
|
||||
#if CONFIG_TX64X64
|
||||
case TX_64X64:
|
||||
above_ec = !!(*(const uint64_t *)a | *(const uint64_t *)(a + 8));
|
||||
left_ec = !!(*(const uint64_t *)l | *(const uint64_t *)(l + 8));
|
||||
break;
|
||||
#endif // CONFIG_TX64X64
|
||||
default: assert(0 && "Invalid transform size."); break;
|
||||
}
|
||||
return combine_entropy_contexts(above_ec, left_ec);
|
||||
}
|
||||
|
||||
#define COEF_COUNT_SAT 24
|
||||
#define COEF_MAX_UPDATE_FACTOR 112
|
||||
#define COEF_COUNT_SAT_AFTER_KEY 24
|
||||
#define COEF_MAX_UPDATE_FACTOR_AFTER_KEY 128
|
||||
|
||||
#if CONFIG_ADAPT_SCAN
|
||||
#define ADAPT_SCAN_UPDATE_RATE_16 (1 << 13)
|
||||
#endif
|
||||
|
||||
static INLINE aom_prob av1_merge_probs(aom_prob pre_prob,
|
||||
const unsigned int ct[2],
|
||||
unsigned int count_sat,
|
||||
unsigned int max_update_factor) {
|
||||
return merge_probs(pre_prob, ct, count_sat, max_update_factor);
|
||||
}
|
||||
|
||||
static INLINE aom_prob av1_mode_mv_merge_probs(aom_prob pre_prob,
|
||||
const unsigned int ct[2]) {
|
||||
return mode_mv_merge_probs(pre_prob, ct);
|
||||
}
|
||||
|
||||
#if CONFIG_EC_ADAPT
|
||||
void av1_average_tile_coef_cdfs(struct frame_contexts *fc,
|
||||
struct frame_contexts *ec_ctxs[],
|
||||
aom_cdf_prob *cdf_ptrs[], int num_tiles);
|
||||
void av1_average_tile_mv_cdfs(struct frame_contexts *fc,
|
||||
struct frame_contexts *ec_ctxs[],
|
||||
aom_cdf_prob *cdf_ptrs[], int num_tiles);
|
||||
void av1_average_tile_intra_cdfs(struct frame_contexts *fc,
|
||||
struct frame_contexts *ec_ctxs[],
|
||||
aom_cdf_prob *cdf_ptrs[], int num_tiles);
|
||||
void av1_average_tile_inter_cdfs(struct AV1Common *cm,
|
||||
struct frame_contexts *fc,
|
||||
struct frame_contexts *ec_ctxs[],
|
||||
aom_cdf_prob *cdf_ptrs[], int num_tiles);
|
||||
#if CONFIG_PVQ
|
||||
void av1_default_pvq_probs(struct AV1Common *cm);
|
||||
void av1_average_tile_pvq_cdfs(struct frame_contexts *fc,
|
||||
struct frame_contexts *ec_ctxs[], int num_tiles);
|
||||
#endif // CONFIG_PVQ
|
||||
#endif // CONFIG_EC_ADAPT
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // AV1_COMMON_ENTROPY_H_
|
||||
3792
third_party/aom/av1/common/entropymode.c
vendored
Normal file
3792
third_party/aom/av1/common/entropymode.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
575
third_party/aom/av1/common/entropymode.h
vendored
Normal file
575
third_party/aom/av1/common/entropymode.h
vendored
Normal file
|
|
@ -0,0 +1,575 @@
|
|||
/*
|
||||
* 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_COMMON_ENTROPYMODE_H_
|
||||
#define AV1_COMMON_ENTROPYMODE_H_
|
||||
|
||||
#include "av1/common/entropy.h"
|
||||
#include "av1/common/entropymv.h"
|
||||
#include "av1/common/filter.h"
|
||||
#include "av1/common/seg_common.h"
|
||||
#include "aom_dsp/aom_filter.h"
|
||||
|
||||
#if CONFIG_PVQ
|
||||
#include "av1/common/pvq.h"
|
||||
#include "av1/common/pvq_state.h"
|
||||
#include "av1/common/generic_code.h"
|
||||
#endif // CONFIG_PVQ
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define BLOCK_SIZE_GROUPS 4
|
||||
|
||||
#define TX_SIZE_CONTEXTS 2
|
||||
|
||||
#define INTER_OFFSET(mode) ((mode)-NEARESTMV)
|
||||
#if CONFIG_EXT_INTER
|
||||
#if CONFIG_COMPOUND_SINGLEREF
|
||||
#define INTER_SINGLEREF_COMP_OFFSET(mode) ((mode)-SR_NEAREST_NEARMV)
|
||||
#endif // CONFIG_COMPOUND_SINGLEREF
|
||||
#define INTER_COMPOUND_OFFSET(mode) ((mode)-NEAREST_NEARESTMV)
|
||||
#endif // CONFIG_EXT_INTER
|
||||
|
||||
#if CONFIG_PALETTE
|
||||
// Number of possible contexts for a color index.
|
||||
// As can be seen from av1_get_palette_color_index_context(), the possible
|
||||
// contexts are (2,0,0), (2,2,1), (3,2,0), (4,1,0), (5,0,0). These are mapped to
|
||||
// a value from 0 to 4 using 'palette_color_index_context_lookup' table.
|
||||
#define PALETTE_COLOR_INDEX_CONTEXTS 5
|
||||
|
||||
// Maximum number of colors in a palette.
|
||||
#define PALETTE_MAX_SIZE 8
|
||||
// Minimum number of colors in a palette.
|
||||
#define PALETTE_MIN_SIZE 2
|
||||
|
||||
// Palette mode is available for block sizes >= 8x8.
|
||||
#define PALETTE_BLOCK_SIZES (BLOCK_LARGEST - BLOCK_8X8 + 1)
|
||||
|
||||
// Palette Y mode context for a block is determined by number of neighboring
|
||||
// blocks (top and/or left) using a palette for Y plane. So, possible Y mode'
|
||||
// context values are:
|
||||
// 0 if neither left nor top block uses palette for Y plane,
|
||||
// 1 if exactly one of left or top block uses palette for Y plane, and
|
||||
// 2 if both left and top blocks use palette for Y plane.
|
||||
#define PALETTE_Y_MODE_CONTEXTS 3
|
||||
|
||||
// Palette UV mode context for a block is determined by whether this block uses
|
||||
// palette for the Y plane. So, possible values are:
|
||||
// 0 if this block doesn't use palette for Y plane.
|
||||
// 1 if this block uses palette for Y plane (i.e. Y palette size > 0).
|
||||
#define PALETTE_UV_MODE_CONTEXTS 2
|
||||
|
||||
#define PALETTE_MAX_BLOCK_SIZE (64 * 64)
|
||||
#endif // CONFIG_PALETTE
|
||||
|
||||
#if CONFIG_INTRABC
|
||||
#define INTRABC_PROB 192
|
||||
#endif // CONFIG_INTRABC
|
||||
|
||||
struct AV1Common;
|
||||
|
||||
typedef struct {
|
||||
const int16_t *scan;
|
||||
const int16_t *iscan;
|
||||
const int16_t *neighbors;
|
||||
} SCAN_ORDER;
|
||||
|
||||
struct seg_counts {
|
||||
unsigned int tree_total[MAX_SEGMENTS];
|
||||
unsigned int tree_mispred[MAX_SEGMENTS];
|
||||
unsigned int pred[PREDICTION_PROBS][2];
|
||||
};
|
||||
|
||||
typedef struct frame_contexts {
|
||||
aom_prob y_mode_prob[BLOCK_SIZE_GROUPS][INTRA_MODES - 1];
|
||||
aom_prob uv_mode_prob[INTRA_MODES][INTRA_MODES - 1];
|
||||
#if CONFIG_EXT_PARTITION_TYPES
|
||||
aom_prob partition_prob[PARTITION_CONTEXTS][EXT_PARTITION_TYPES - 1];
|
||||
#else
|
||||
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
|
||||
uint32_t non_zero_prob_2x2[TX_TYPES][4];
|
||||
#endif
|
||||
uint32_t non_zero_prob_4X4[TX_TYPES][16];
|
||||
uint32_t non_zero_prob_8X8[TX_TYPES][64];
|
||||
uint32_t non_zero_prob_16X16[TX_TYPES][256];
|
||||
uint32_t non_zero_prob_32X32[TX_TYPES][1024];
|
||||
|
||||
uint32_t non_zero_prob_4X8[TX_TYPES][32];
|
||||
uint32_t non_zero_prob_8X4[TX_TYPES][32];
|
||||
uint32_t non_zero_prob_16X8[TX_TYPES][128];
|
||||
uint32_t non_zero_prob_8X16[TX_TYPES][128];
|
||||
uint32_t non_zero_prob_32X16[TX_TYPES][512];
|
||||
uint32_t non_zero_prob_16X32[TX_TYPES][512];
|
||||
|
||||
#if CONFIG_CB4X4
|
||||
DECLARE_ALIGNED(16, int16_t, scan_2x2[TX_TYPES][4]);
|
||||
#endif
|
||||
DECLARE_ALIGNED(16, int16_t, scan_4X4[TX_TYPES][16]);
|
||||
DECLARE_ALIGNED(16, int16_t, scan_8X8[TX_TYPES][64]);
|
||||
DECLARE_ALIGNED(16, int16_t, scan_16X16[TX_TYPES][256]);
|
||||
DECLARE_ALIGNED(16, int16_t, scan_32X32[TX_TYPES][1024]);
|
||||
|
||||
DECLARE_ALIGNED(16, int16_t, scan_4X8[TX_TYPES][32]);
|
||||
DECLARE_ALIGNED(16, int16_t, scan_8X4[TX_TYPES][32]);
|
||||
DECLARE_ALIGNED(16, int16_t, scan_8X16[TX_TYPES][128]);
|
||||
DECLARE_ALIGNED(16, int16_t, scan_16X8[TX_TYPES][128]);
|
||||
DECLARE_ALIGNED(16, int16_t, scan_16X32[TX_TYPES][512]);
|
||||
DECLARE_ALIGNED(16, int16_t, scan_32X16[TX_TYPES][512]);
|
||||
|
||||
#if CONFIG_CB4X4
|
||||
DECLARE_ALIGNED(16, int16_t, iscan_2x2[TX_TYPES][4]);
|
||||
#endif
|
||||
DECLARE_ALIGNED(16, int16_t, iscan_4X4[TX_TYPES][16]);
|
||||
DECLARE_ALIGNED(16, int16_t, iscan_8X8[TX_TYPES][64]);
|
||||
DECLARE_ALIGNED(16, int16_t, iscan_16X16[TX_TYPES][256]);
|
||||
DECLARE_ALIGNED(16, int16_t, iscan_32X32[TX_TYPES][1024]);
|
||||
|
||||
DECLARE_ALIGNED(16, int16_t, iscan_4X8[TX_TYPES][32]);
|
||||
DECLARE_ALIGNED(16, int16_t, iscan_8X4[TX_TYPES][32]);
|
||||
DECLARE_ALIGNED(16, int16_t, iscan_8X16[TX_TYPES][128]);
|
||||
DECLARE_ALIGNED(16, int16_t, iscan_16X8[TX_TYPES][128]);
|
||||
DECLARE_ALIGNED(16, int16_t, iscan_16X32[TX_TYPES][512]);
|
||||
DECLARE_ALIGNED(16, int16_t, iscan_32X16[TX_TYPES][512]);
|
||||
|
||||
#if CONFIG_CB4X4
|
||||
int16_t nb_2x2[TX_TYPES][(4 + 1) * 2];
|
||||
#endif
|
||||
int16_t nb_4X4[TX_TYPES][(16 + 1) * 2];
|
||||
int16_t nb_8X8[TX_TYPES][(64 + 1) * 2];
|
||||
int16_t nb_16X16[TX_TYPES][(256 + 1) * 2];
|
||||
int16_t nb_32X32[TX_TYPES][(1024 + 1) * 2];
|
||||
|
||||
int16_t nb_4X8[TX_TYPES][(32 + 1) * 2];
|
||||
int16_t nb_8X4[TX_TYPES][(32 + 1) * 2];
|
||||
int16_t nb_8X16[TX_TYPES][(128 + 1) * 2];
|
||||
int16_t nb_16X8[TX_TYPES][(128 + 1) * 2];
|
||||
int16_t nb_16X32[TX_TYPES][(512 + 1) * 2];
|
||||
int16_t nb_32X16[TX_TYPES][(512 + 1) * 2];
|
||||
|
||||
SCAN_ORDER sc[TX_SIZES_ALL][TX_TYPES];
|
||||
|
||||
int16_t eob_threshold[TX_SIZES_ALL][TX_TYPES][EOB_THRESHOLD_NUM];
|
||||
#endif // CONFIG_ADAPT_SCAN
|
||||
|
||||
#if CONFIG_LV_MAP
|
||||
aom_prob txb_skip[TX_SIZES][TXB_SKIP_CONTEXTS];
|
||||
aom_prob nz_map[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS];
|
||||
aom_prob eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS];
|
||||
aom_prob dc_sign[PLANE_TYPES][DC_SIGN_CONTEXTS];
|
||||
aom_prob coeff_base[TX_SIZES][PLANE_TYPES][NUM_BASE_LEVELS]
|
||||
[COEFF_BASE_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
|
||||
aom_prob inter_compound_mode_probs[INTER_MODE_CONTEXTS]
|
||||
[INTER_COMPOUND_MODES - 1];
|
||||
#if CONFIG_COMPOUND_SINGLEREF
|
||||
aom_prob inter_singleref_comp_mode_probs[INTER_MODE_CONTEXTS]
|
||||
[INTER_SINGLEREF_COMP_MODES - 1];
|
||||
#endif // CONFIG_COMPOUND_SINGLEREF
|
||||
aom_prob compound_type_prob[BLOCK_SIZES][COMPOUND_TYPES - 1];
|
||||
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_EXT_INTER
|
||||
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
|
||||
aom_prob motion_mode_prob[BLOCK_SIZES][MOTION_MODES - 1];
|
||||
#if CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
|
||||
aom_prob obmc_prob[BLOCK_SIZES];
|
||||
#endif // CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
|
||||
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
|
||||
aom_prob intra_inter_prob[INTRA_INTER_CONTEXTS];
|
||||
aom_prob comp_inter_prob[COMP_INTER_CONTEXTS];
|
||||
aom_prob single_ref_prob[REF_CONTEXTS][SINGLE_REFS - 1];
|
||||
#if CONFIG_EXT_REFS
|
||||
aom_prob comp_ref_prob[REF_CONTEXTS][FWD_REFS - 1];
|
||||
aom_prob comp_bwdref_prob[REF_CONTEXTS][BWD_REFS - 1];
|
||||
#else
|
||||
aom_prob comp_ref_prob[REF_CONTEXTS][COMP_REFS - 1];
|
||||
#endif // CONFIG_EXT_REFS
|
||||
#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF
|
||||
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_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;
|
||||
#endif
|
||||
int initialized;
|
||||
#if CONFIG_EXT_TX
|
||||
aom_prob inter_ext_tx_prob[EXT_TX_SETS_INTER][EXT_TX_SIZES][TX_TYPES - 1];
|
||||
aom_prob intra_ext_tx_prob[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES]
|
||||
[TX_TYPES - 1];
|
||||
#else
|
||||
aom_prob intra_ext_tx_prob[EXT_TX_SIZES][TX_TYPES][TX_TYPES - 1];
|
||||
aom_prob inter_ext_tx_prob[EXT_TX_SIZES][TX_TYPES - 1];
|
||||
#endif // CONFIG_EXT_TX
|
||||
#if CONFIG_SUPERTX
|
||||
aom_prob supertx_prob[PARTITION_SUPERTX_CONTEXTS][TX_SIZES];
|
||||
#endif // CONFIG_SUPERTX
|
||||
struct segmentation_probs seg;
|
||||
#if CONFIG_EXT_INTRA
|
||||
#if CONFIG_INTRA_INTERP
|
||||
aom_prob intra_filter_probs[INTRA_FILTERS + 1][INTRA_FILTERS - 1];
|
||||
#endif // CONFIG_INTRA_INTERP
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
#if CONFIG_FILTER_INTRA
|
||||
aom_prob filter_intra_probs[PLANE_TYPES];
|
||||
#endif // CONFIG_FILTER_INTRA
|
||||
#if CONFIG_GLOBAL_MOTION
|
||||
aom_prob global_motion_types_prob[GLOBAL_TRANS_TYPES - 1];
|
||||
#endif // CONFIG_GLOBAL_MOTION
|
||||
#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
|
||||
aom_cdf_prob partition_cdf[PARTITION_CONTEXTS][CDF_SIZE(EXT_PARTITION_TYPES)];
|
||||
#else
|
||||
aom_cdf_prob partition_cdf[PARTITION_CONTEXTS][CDF_SIZE(PARTITION_TYPES)];
|
||||
#endif
|
||||
aom_cdf_prob switchable_interp_cdf[SWITCHABLE_FILTER_CONTEXTS]
|
||||
[CDF_SIZE(SWITCHABLE_FILTERS)];
|
||||
aom_cdf_prob inter_mode_cdf[INTER_MODE_CONTEXTS][CDF_SIZE(INTER_MODES)];
|
||||
/* Keep track of kf_y_cdf here, as this makes handling
|
||||
multiple copies for adaptation in tiles easier */
|
||||
aom_cdf_prob kf_y_cdf[INTRA_MODES][INTRA_MODES][CDF_SIZE(INTRA_MODES)];
|
||||
aom_cdf_prob tx_size_cdf[MAX_TX_DEPTH][TX_SIZE_CONTEXTS]
|
||||
[CDF_SIZE(MAX_TX_DEPTH + 1)];
|
||||
#if CONFIG_DELTA_Q
|
||||
aom_cdf_prob delta_q_cdf[CDF_SIZE(DELTA_Q_PROBS + 1)];
|
||||
#if CONFIG_EXT_DELTA_Q
|
||||
aom_cdf_prob delta_lf_cdf[CDF_SIZE(DELTA_LF_PROBS + 1)];
|
||||
#endif
|
||||
#endif // CONFIG_DELTA_Q
|
||||
#if CONFIG_EXT_TX
|
||||
aom_cdf_prob intra_ext_tx_cdf[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES]
|
||||
[CDF_SIZE(TX_TYPES)];
|
||||
aom_cdf_prob inter_ext_tx_cdf[EXT_TX_SETS_INTER][EXT_TX_SIZES]
|
||||
[CDF_SIZE(TX_TYPES)];
|
||||
#else
|
||||
aom_cdf_prob intra_ext_tx_cdf[EXT_TX_SIZES][TX_TYPES][CDF_SIZE(TX_TYPES)];
|
||||
aom_cdf_prob inter_ext_tx_cdf[EXT_TX_SIZES][CDF_SIZE(TX_TYPES)];
|
||||
#endif // CONFIG_EXT_TX
|
||||
#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
|
||||
aom_prob delta_lf_prob[DELTA_LF_PROBS];
|
||||
#endif
|
||||
#endif
|
||||
#if CONFIG_PVQ
|
||||
// TODO(any): If PVQ is enabled, most of coefficient related cdf,
|
||||
// such as coef_cdfs[], coef_tail_cdfs[], and coef_heaf_cdfs[] can be removed.
|
||||
od_adapt_ctx pvq_context;
|
||||
#endif // CONFIG_PVQ
|
||||
} FRAME_CONTEXT;
|
||||
|
||||
typedef struct FRAME_COUNTS {
|
||||
// Note: This structure should only contain 'unsigned int' fields, or
|
||||
// aggregates built solely from 'unsigned int' fields/elements
|
||||
unsigned int kf_y_mode[INTRA_MODES][INTRA_MODES][INTRA_MODES];
|
||||
unsigned int y_mode[BLOCK_SIZE_GROUPS][INTRA_MODES];
|
||||
unsigned int uv_mode[INTRA_MODES][INTRA_MODES];
|
||||
#if CONFIG_EXT_PARTITION_TYPES
|
||||
unsigned int partition[PARTITION_CONTEXTS][EXT_PARTITION_TYPES];
|
||||
#else
|
||||
unsigned int partition[PARTITION_CONTEXTS][PARTITION_TYPES];
|
||||
#endif
|
||||
av1_coeff_count_model coef[TX_SIZES][PLANE_TYPES];
|
||||
unsigned int eob_branch[TX_SIZES][PLANE_TYPES][REF_TYPES][COEF_BANDS]
|
||||
[COEFF_CONTEXTS];
|
||||
unsigned int switchable_interp[SWITCHABLE_FILTER_CONTEXTS]
|
||||
[SWITCHABLE_FILTERS];
|
||||
#if CONFIG_ADAPT_SCAN
|
||||
#if CONFIG_CB4X4
|
||||
unsigned int non_zero_count_2x2[TX_TYPES][4];
|
||||
#endif // CONFIG_CB4X4
|
||||
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];
|
||||
unsigned int non_zero_count_32X32[TX_TYPES][1024];
|
||||
|
||||
unsigned int non_zero_count_4x8[TX_TYPES][32];
|
||||
unsigned int non_zero_count_8x4[TX_TYPES][32];
|
||||
unsigned int non_zero_count_8x16[TX_TYPES][128];
|
||||
unsigned int non_zero_count_16x8[TX_TYPES][128];
|
||||
unsigned int non_zero_count_16x32[TX_TYPES][512];
|
||||
unsigned int non_zero_count_32x16[TX_TYPES][512];
|
||||
|
||||
unsigned int txb_count[TX_SIZES_ALL][TX_TYPES];
|
||||
#endif // CONFIG_ADAPT_SCAN
|
||||
|
||||
#if CONFIG_LV_MAP
|
||||
unsigned int txb_skip[TX_SIZES][TXB_SKIP_CONTEXTS][2];
|
||||
unsigned int nz_map[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS][2];
|
||||
unsigned int eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS][2];
|
||||
unsigned int dc_sign[PLANE_TYPES][DC_SIGN_CONTEXTS][2];
|
||||
unsigned int coeff_base[TX_SIZES][PLANE_TYPES][NUM_BASE_LEVELS]
|
||||
[COEFF_BASE_CONTEXTS][2];
|
||||
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
|
||||
unsigned int inter_compound_mode[INTER_MODE_CONTEXTS][INTER_COMPOUND_MODES];
|
||||
#if CONFIG_COMPOUND_SINGLEREF
|
||||
unsigned int inter_singleref_comp_mode[INTER_MODE_CONTEXTS]
|
||||
[INTER_SINGLEREF_COMP_MODES];
|
||||
#endif // CONFIG_COMPOUND_SINGLEREF
|
||||
unsigned int interintra[BLOCK_SIZE_GROUPS][2];
|
||||
unsigned int interintra_mode[BLOCK_SIZE_GROUPS][INTERINTRA_MODES];
|
||||
unsigned int wedge_interintra[BLOCK_SIZES][2];
|
||||
unsigned int compound_interinter[BLOCK_SIZES][COMPOUND_TYPES];
|
||||
#endif // CONFIG_EXT_INTER
|
||||
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
|
||||
unsigned int motion_mode[BLOCK_SIZES][MOTION_MODES];
|
||||
#if CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
|
||||
unsigned int obmc[BLOCK_SIZES][2];
|
||||
#endif // CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
|
||||
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
|
||||
unsigned int intra_inter[INTRA_INTER_CONTEXTS][2];
|
||||
unsigned int comp_inter[COMP_INTER_CONTEXTS][2];
|
||||
unsigned int single_ref[REF_CONTEXTS][SINGLE_REFS - 1][2];
|
||||
#if CONFIG_EXT_REFS
|
||||
unsigned int comp_ref[REF_CONTEXTS][FWD_REFS - 1][2];
|
||||
unsigned int comp_bwdref[REF_CONTEXTS][BWD_REFS - 1][2];
|
||||
#else
|
||||
unsigned int comp_ref[REF_CONTEXTS][COMP_REFS - 1][2];
|
||||
#endif // CONFIG_EXT_REFS
|
||||
#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF
|
||||
unsigned int comp_inter_mode[COMP_INTER_MODE_CONTEXTS][2];
|
||||
#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF
|
||||
// TODO(any): tx_size_totals is only used by the encoder to decide whether
|
||||
// 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];
|
||||
#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
|
||||
nmv_context_counts dv;
|
||||
#endif
|
||||
#if CONFIG_DELTA_Q
|
||||
unsigned int delta_q[DELTA_Q_PROBS][2];
|
||||
#if CONFIG_EXT_DELTA_Q
|
||||
unsigned int delta_lf[DELTA_LF_PROBS][2];
|
||||
#endif
|
||||
#endif
|
||||
#if CONFIG_EXT_TX
|
||||
#if CONFIG_RECT_TX
|
||||
unsigned int tx_size_implied[TX_SIZES][TX_SIZES];
|
||||
#endif // CONFIG_RECT_TX
|
||||
unsigned int inter_ext_tx[EXT_TX_SETS_INTER][EXT_TX_SIZES][TX_TYPES];
|
||||
unsigned int intra_ext_tx[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES]
|
||||
[TX_TYPES];
|
||||
#else
|
||||
unsigned int intra_ext_tx[EXT_TX_SIZES][TX_TYPES][TX_TYPES];
|
||||
unsigned int inter_ext_tx[EXT_TX_SIZES][TX_TYPES];
|
||||
#endif // CONFIG_EXT_TX
|
||||
#if CONFIG_SUPERTX
|
||||
unsigned int supertx[PARTITION_SUPERTX_CONTEXTS][TX_SIZES][2];
|
||||
unsigned int supertx_size[TX_SIZES];
|
||||
#endif // CONFIG_SUPERTX
|
||||
struct seg_counts seg;
|
||||
#if CONFIG_EXT_INTRA
|
||||
#if CONFIG_INTRA_INTERP
|
||||
unsigned int intra_filter[INTRA_FILTERS + 1][INTRA_FILTERS];
|
||||
#endif // CONFIG_INTRA_INTERP
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
#if CONFIG_FILTER_INTRA
|
||||
unsigned int filter_intra[PLANE_TYPES][2];
|
||||
#endif // CONFIG_FILTER_INTRA
|
||||
} FRAME_COUNTS;
|
||||
|
||||
// Default probabilities for signaling Intra mode for Y plane -- used only for
|
||||
// intra-only frames. ('default_if_y_probs' is used for inter frames).
|
||||
// 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]
|
||||
[PALETTE_Y_MODE_CONTEXTS];
|
||||
extern const aom_prob
|
||||
av1_default_palette_uv_mode_prob[PALETTE_UV_MODE_CONTEXTS];
|
||||
extern const aom_prob av1_default_palette_y_size_prob[PALETTE_BLOCK_SIZES]
|
||||
[PALETTE_SIZES - 1];
|
||||
extern const aom_prob av1_default_palette_uv_size_prob[PALETTE_BLOCK_SIZES]
|
||||
[PALETTE_SIZES - 1];
|
||||
extern const aom_prob av1_default_palette_y_color_index_prob
|
||||
[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS][PALETTE_COLORS - 1];
|
||||
extern const aom_prob av1_default_palette_uv_color_index_prob
|
||||
[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS][PALETTE_COLORS - 1];
|
||||
#endif // CONFIG_PALETTE
|
||||
|
||||
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];
|
||||
extern int av1_inter_mode_inv[INTER_MODES];
|
||||
#if CONFIG_EXT_TX
|
||||
extern int av1_ext_tx_intra_ind[EXT_TX_SETS_INTRA][TX_TYPES];
|
||||
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
|
||||
extern const aom_tree_index
|
||||
av1_interintra_mode_tree[TREE_SIZE(INTERINTRA_MODES)];
|
||||
extern const aom_tree_index
|
||||
av1_inter_compound_mode_tree[TREE_SIZE(INTER_COMPOUND_MODES)];
|
||||
#if CONFIG_COMPOUND_SINGLEREF
|
||||
extern const aom_tree_index
|
||||
av1_inter_singleref_comp_mode_tree[TREE_SIZE(INTER_SINGLEREF_COMP_MODES)];
|
||||
#endif // CONFIG_COMPOUND_SINGLEREF
|
||||
extern const aom_tree_index av1_compound_type_tree[TREE_SIZE(COMPOUND_TYPES)];
|
||||
#endif // CONFIG_EXT_INTER
|
||||
extern const aom_tree_index av1_partition_tree[TREE_SIZE(PARTITION_TYPES)];
|
||||
#if CONFIG_EXT_PARTITION_TYPES
|
||||
extern const aom_tree_index
|
||||
av1_ext_partition_tree[TREE_SIZE(EXT_PARTITION_TYPES)];
|
||||
#endif
|
||||
extern const aom_tree_index
|
||||
av1_switchable_interp_tree[TREE_SIZE(SWITCHABLE_FILTERS)];
|
||||
#if CONFIG_PALETTE
|
||||
extern const aom_tree_index av1_palette_size_tree[TREE_SIZE(PALETTE_SIZES)];
|
||||
extern const aom_tree_index
|
||||
av1_palette_color_index_tree[PALETTE_SIZES][TREE_SIZE(PALETTE_COLORS)];
|
||||
#endif // CONFIG_PALETTE
|
||||
extern const aom_tree_index av1_tx_size_tree[MAX_TX_DEPTH][TREE_SIZE(TX_SIZES)];
|
||||
#if CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
|
||||
extern const aom_tree_index av1_intra_filter_tree[TREE_SIZE(INTRA_FILTERS)];
|
||||
#endif // CONFIG_EXT_INTRA && CONFIG_INTRA_INTERP
|
||||
#if CONFIG_EXT_TX
|
||||
extern const aom_tree_index av1_ext_tx_inter_tree[EXT_TX_SETS_INTER]
|
||||
[TREE_SIZE(TX_TYPES)];
|
||||
extern const aom_tree_index av1_ext_tx_intra_tree[EXT_TX_SETS_INTRA]
|
||||
[TREE_SIZE(TX_TYPES)];
|
||||
#else
|
||||
extern const aom_tree_index av1_ext_tx_tree[TREE_SIZE(TX_TYPES)];
|
||||
#endif // CONFIG_EXT_TX
|
||||
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
|
||||
extern const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)];
|
||||
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
|
||||
|
||||
#if CONFIG_LOOP_RESTORATION
|
||||
#define RESTORE_NONE_SGRPROJ_PROB 64
|
||||
#define RESTORE_NONE_BILATERAL_PROB 16
|
||||
#define RESTORE_NONE_WIENER_PROB 64
|
||||
#define RESTORE_NONE_DOMAINTXFMRF_PROB 64
|
||||
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];
|
||||
|
||||
void av1_set_mode_cdfs(struct AV1Common *cm);
|
||||
#endif
|
||||
|
||||
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
|
||||
extern int av1_ext_tx_ind[TX_TYPES];
|
||||
extern int av1_ext_tx_inv[TX_TYPES];
|
||||
#endif
|
||||
|
||||
static INLINE int av1_ceil_log2(int n) {
|
||||
int i = 1, p = 2;
|
||||
while (p < n) {
|
||||
i++;
|
||||
p = p << 1;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
#if CONFIG_PALETTE
|
||||
// Returns the context for palette color index at row 'r' and column 'c',
|
||||
// along with the 'color_order' of neighbors and the 'color_idx'.
|
||||
// The 'color_map' is a 2D array with the given 'stride'.
|
||||
int av1_get_palette_color_index_context(const uint8_t *color_map, int stride,
|
||||
int r, int c, int palette_size,
|
||||
uint8_t *color_order, int *color_idx);
|
||||
#endif // CONFIG_PALETTE
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // AV1_COMMON_ENTROPYMODE_H_
|
||||
315
third_party/aom/av1/common/entropymv.c
vendored
Normal file
315
third_party/aom/av1/common/entropymv.c
vendored
Normal file
|
|
@ -0,0 +1,315 @@
|
|||
/*
|
||||
* 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 "av1/common/onyxc_int.h"
|
||||
#include "av1/common/entropymv.h"
|
||||
|
||||
// Integer pel reference mv threshold for use of high-precision 1/8 mv
|
||||
#define COMPANDED_MVREF_THRESH 8
|
||||
|
||||
const aom_tree_index av1_mv_joint_tree[TREE_SIZE(MV_JOINTS)] = {
|
||||
-MV_JOINT_ZERO, 2, -MV_JOINT_HNZVZ, 4, -MV_JOINT_HZVNZ, -MV_JOINT_HNZVNZ
|
||||
};
|
||||
|
||||
/* clang-format off */
|
||||
const aom_tree_index av1_mv_class_tree[TREE_SIZE(MV_CLASSES)] = {
|
||||
-MV_CLASS_0, 2,
|
||||
-MV_CLASS_1, 4,
|
||||
6, 8,
|
||||
-MV_CLASS_2, -MV_CLASS_3,
|
||||
10, 12,
|
||||
-MV_CLASS_4, -MV_CLASS_5,
|
||||
-MV_CLASS_6, 14,
|
||||
16, 18,
|
||||
-MV_CLASS_7, -MV_CLASS_8,
|
||||
-MV_CLASS_9, -MV_CLASS_10,
|
||||
};
|
||||
/* clang-format on */
|
||||
|
||||
const aom_tree_index av1_mv_class0_tree[TREE_SIZE(CLASS0_SIZE)] = {
|
||||
-0, -1,
|
||||
};
|
||||
|
||||
const aom_tree_index av1_mv_fp_tree[TREE_SIZE(MV_FP_SIZE)] = { -0, 2, -1,
|
||||
4, -2, -3 };
|
||||
|
||||
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
|
||||
{ { 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
|
||||
},
|
||||
{
|
||||
// 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
|
||||
{ { 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
|
||||
} },
|
||||
};
|
||||
|
||||
static const uint8_t log_in_base_2[] = {
|
||||
0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10
|
||||
};
|
||||
|
||||
#if CONFIG_GLOBAL_MOTION
|
||||
#if GLOBAL_TRANS_TYPES == 7 // All models
|
||||
const aom_tree_index av1_global_motion_types_tree[TREE_SIZE(
|
||||
GLOBAL_TRANS_TYPES)] = { -IDENTITY, 2, -TRANSLATION, 4,
|
||||
-ROTZOOM, 6, -AFFINE, 8,
|
||||
-HOMOGRAPHY, 10, -HORTRAPEZOID, -VERTRAPEZOID };
|
||||
|
||||
static const aom_prob default_global_motion_types_prob[GLOBAL_TRANS_TYPES - 1] =
|
||||
{ 224, 128, 192, 192, 32, 128 };
|
||||
|
||||
#elif GLOBAL_TRANS_TYPES == 6 // Do not allow full homography
|
||||
const aom_tree_index
|
||||
av1_global_motion_types_tree[TREE_SIZE(GLOBAL_TRANS_TYPES)] = {
|
||||
-IDENTITY, 2, -TRANSLATION, 4, -ROTZOOM, 6, -AFFINE, 8, -HORTRAPEZOID,
|
||||
-VERTRAPEZOID
|
||||
};
|
||||
|
||||
static const aom_prob default_global_motion_types_prob[GLOBAL_TRANS_TYPES - 1] =
|
||||
{ 224, 128, 192, 192, 128 };
|
||||
|
||||
#elif GLOBAL_TRANS_TYPES == 4 // Upto Affine
|
||||
const aom_tree_index av1_global_motion_types_tree[TREE_SIZE(
|
||||
GLOBAL_TRANS_TYPES)] = { -IDENTITY, 2, -TRANSLATION, 4, -ROTZOOM, -AFFINE };
|
||||
|
||||
static const aom_prob default_global_motion_types_prob[GLOBAL_TRANS_TYPES - 1] =
|
||||
{ 224, 128, 240 };
|
||||
|
||||
#elif GLOBAL_TRANS_TYPES == 3 // Upto rotation-zoom
|
||||
|
||||
const aom_tree_index av1_global_motion_types_tree[TREE_SIZE(
|
||||
GLOBAL_TRANS_TYPES)] = { -IDENTITY, 2, -TRANSLATION, -ROTZOOM };
|
||||
|
||||
static const aom_prob default_global_motion_types_prob[GLOBAL_TRANS_TYPES - 1] =
|
||||
{ 224, 128 };
|
||||
#endif // GLOBAL_TRANS_TYPES
|
||||
#endif // CONFIG_GLOBAL_MOTION
|
||||
|
||||
static INLINE int mv_class_base(MV_CLASS_TYPE c) {
|
||||
return c ? CLASS0_SIZE << (c + 2) : 0;
|
||||
}
|
||||
|
||||
MV_CLASS_TYPE av1_get_mv_class(int z, int *offset) {
|
||||
const MV_CLASS_TYPE c = (z >= CLASS0_SIZE * 4096)
|
||||
? MV_CLASS_10
|
||||
: (MV_CLASS_TYPE)log_in_base_2[z >> 3];
|
||||
if (offset) *offset = z - mv_class_base(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
static void inc_mv_component(int v, nmv_component_counts *comp_counts, int incr,
|
||||
int usehp) {
|
||||
int s, z, c, o, d, e, f;
|
||||
assert(v != 0); /* should not be zero */
|
||||
s = v < 0;
|
||||
comp_counts->sign[s] += incr;
|
||||
z = (s ? -v : v) - 1; /* magnitude - 1 */
|
||||
|
||||
c = av1_get_mv_class(z, &o);
|
||||
comp_counts->classes[c] += incr;
|
||||
|
||||
d = (o >> 3); /* int mv data */
|
||||
f = (o >> 1) & 3; /* fractional pel mv data */
|
||||
e = (o & 1); /* high precision mv data */
|
||||
|
||||
if (c == MV_CLASS_0) {
|
||||
comp_counts->class0[d] += incr;
|
||||
comp_counts->class0_fp[d][f] += incr;
|
||||
if (usehp) comp_counts->class0_hp[e] += incr;
|
||||
} else {
|
||||
int i;
|
||||
int b = c + CLASS0_BITS - 1; // number of bits
|
||||
for (i = 0; i < b; ++i) comp_counts->bits[i][((d >> i) & 1)] += incr;
|
||||
comp_counts->fp[f] += incr;
|
||||
if (usehp) comp_counts->hp[e] += incr;
|
||||
}
|
||||
}
|
||||
|
||||
void av1_inc_mv(const MV *mv, nmv_context_counts *counts, const int usehp) {
|
||||
if (counts != NULL) {
|
||||
const MV_JOINT_TYPE j = av1_get_mv_joint(mv);
|
||||
++counts->joints[j];
|
||||
|
||||
if (mv_joint_vertical(j))
|
||||
inc_mv_component(mv->row, &counts->comps[0], 1, usehp);
|
||||
|
||||
if (mv_joint_horizontal(j))
|
||||
inc_mv_component(mv->col, &counts->comps[1], 1, 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];
|
||||
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);
|
||||
for (i = 0; i < 2; ++i) {
|
||||
nmv_component *comp = &fc->comps[i];
|
||||
const nmv_component *pre_comp = &pre_fc->comps[i];
|
||||
const nmv_component_counts *c = &counts->comps[i];
|
||||
|
||||
comp->sign = av1_mode_mv_merge_probs(pre_comp->sign, c->sign);
|
||||
aom_tree_merge_probs(av1_mv_class_tree, pre_comp->classes, c->classes,
|
||||
comp->classes);
|
||||
aom_tree_merge_probs(av1_mv_class0_tree, pre_comp->class0, c->class0,
|
||||
comp->class0);
|
||||
|
||||
for (j = 0; j < MV_OFFSET_BITS; ++j)
|
||||
comp->bits[j] = av1_mode_mv_merge_probs(pre_comp->bits[j], c->bits[j]);
|
||||
|
||||
for (j = 0; j < CLASS0_SIZE; ++j)
|
||||
aom_tree_merge_probs(av1_mv_fp_tree, pre_comp->class0_fp[j],
|
||||
c->class0_fp[j], comp->class0_fp[j]);
|
||||
|
||||
aom_tree_merge_probs(av1_mv_fp_tree, pre_comp->fp, c->fp, comp->fp);
|
||||
|
||||
if (allow_hp) {
|
||||
comp->class0_hp =
|
||||
av1_mode_mv_merge_probs(pre_comp->class0_hp, c->class0_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
|
||||
void av1_set_mv_cdfs(nmv_context *ctx) {
|
||||
int i;
|
||||
int j;
|
||||
av1_tree_to_cdf(av1_mv_joint_tree, ctx->joints, ctx->joint_cdf);
|
||||
|
||||
for (i = 0; i < 2; ++i) {
|
||||
nmv_component *const comp_ctx = &ctx->comps[i];
|
||||
av1_tree_to_cdf(av1_mv_class_tree, comp_ctx->classes, comp_ctx->class_cdf);
|
||||
|
||||
for (j = 0; j < CLASS0_SIZE; ++j) {
|
||||
av1_tree_to_cdf(av1_mv_fp_tree, comp_ctx->class0_fp[j],
|
||||
comp_ctx->class0_fp_cdf[j]);
|
||||
}
|
||||
av1_tree_to_cdf(av1_mv_fp_tree, comp_ctx->fp, comp_ctx->fp_cdf);
|
||||
}
|
||||
}
|
||||
#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
|
||||
#if CONFIG_GLOBAL_MOTION
|
||||
av1_copy(cm->fc->global_motion_types_prob, default_global_motion_types_prob);
|
||||
#endif // CONFIG_GLOBAL_MOTION
|
||||
}
|
||||
149
third_party/aom/av1/common/entropymv.h
vendored
Normal file
149
third_party/aom/av1/common/entropymv.h
vendored
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
/*
|
||||
* 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_COMMON_ENTROPYMV_H_
|
||||
#define AV1_COMMON_ENTROPYMV_H_
|
||||
|
||||
#include "./aom_config.h"
|
||||
|
||||
#include "aom_dsp/prob.h"
|
||||
|
||||
#include "av1/common/mv.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct AV1Common;
|
||||
|
||||
void av1_init_mv_probs(struct AV1Common *cm);
|
||||
|
||||
void av1_adapt_mv_probs(struct AV1Common *cm, int usehp);
|
||||
|
||||
#define MV_UPDATE_PROB 252
|
||||
|
||||
/* Symbols for coding which components are zero jointly */
|
||||
#define MV_JOINTS 4
|
||||
typedef enum {
|
||||
MV_JOINT_ZERO = 0, /* Zero vector */
|
||||
MV_JOINT_HNZVZ = 1, /* Vert zero, hor nonzero */
|
||||
MV_JOINT_HZVNZ = 2, /* Hor zero, vert nonzero */
|
||||
MV_JOINT_HNZVNZ = 3, /* Both components nonzero */
|
||||
} MV_JOINT_TYPE;
|
||||
|
||||
static INLINE int mv_joint_vertical(MV_JOINT_TYPE type) {
|
||||
return type == MV_JOINT_HZVNZ || type == MV_JOINT_HNZVNZ;
|
||||
}
|
||||
|
||||
static INLINE int mv_joint_horizontal(MV_JOINT_TYPE type) {
|
||||
return type == MV_JOINT_HNZVZ || type == MV_JOINT_HNZVNZ;
|
||||
}
|
||||
|
||||
/* Symbols for coding magnitude class of nonzero components */
|
||||
#define MV_CLASSES 11
|
||||
typedef enum {
|
||||
MV_CLASS_0 = 0, /* (0, 2] integer pel */
|
||||
MV_CLASS_1 = 1, /* (2, 4] integer pel */
|
||||
MV_CLASS_2 = 2, /* (4, 8] integer pel */
|
||||
MV_CLASS_3 = 3, /* (8, 16] integer pel */
|
||||
MV_CLASS_4 = 4, /* (16, 32] integer pel */
|
||||
MV_CLASS_5 = 5, /* (32, 64] integer pel */
|
||||
MV_CLASS_6 = 6, /* (64, 128] integer pel */
|
||||
MV_CLASS_7 = 7, /* (128, 256] integer pel */
|
||||
MV_CLASS_8 = 8, /* (256, 512] integer pel */
|
||||
MV_CLASS_9 = 9, /* (512, 1024] integer pel */
|
||||
MV_CLASS_10 = 10, /* (1024,2048] integer pel */
|
||||
} MV_CLASS_TYPE;
|
||||
|
||||
#define CLASS0_BITS 1 /* bits at integer precision for class 0 */
|
||||
#define CLASS0_SIZE (1 << CLASS0_BITS)
|
||||
#define MV_OFFSET_BITS (MV_CLASSES + CLASS0_BITS - 2)
|
||||
#define MV_FP_SIZE 4
|
||||
|
||||
#define MV_MAX_BITS (MV_CLASSES + CLASS0_BITS + 2)
|
||||
#define MV_MAX ((1 << MV_MAX_BITS) - 1)
|
||||
#define MV_VALS ((MV_MAX << 1) + 1)
|
||||
|
||||
#define MV_IN_USE_BITS 14
|
||||
#define MV_UPP ((1 << MV_IN_USE_BITS) - 1)
|
||||
#define MV_LOW (-(1 << MV_IN_USE_BITS))
|
||||
|
||||
extern const aom_tree_index av1_mv_joint_tree[];
|
||||
extern const aom_tree_index av1_mv_class_tree[];
|
||||
extern const aom_tree_index av1_mv_class0_tree[];
|
||||
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;
|
||||
|
||||
static INLINE MV_JOINT_TYPE av1_get_mv_joint(const MV *mv) {
|
||||
if (mv->row == 0) {
|
||||
return mv->col == 0 ? MV_JOINT_ZERO : MV_JOINT_HNZVZ;
|
||||
} else {
|
||||
return mv->col == 0 ? MV_JOINT_HZVNZ : MV_JOINT_HNZVNZ;
|
||||
}
|
||||
}
|
||||
|
||||
MV_CLASS_TYPE av1_get_mv_class(int z, int *offset);
|
||||
|
||||
typedef struct {
|
||||
unsigned int sign[2];
|
||||
unsigned int classes[MV_CLASSES];
|
||||
unsigned int class0[CLASS0_SIZE];
|
||||
unsigned int bits[MV_OFFSET_BITS][2];
|
||||
unsigned int class0_fp[CLASS0_SIZE][MV_FP_SIZE];
|
||||
unsigned int fp[MV_FP_SIZE];
|
||||
unsigned int class0_hp[2];
|
||||
unsigned int hp[2];
|
||||
} nmv_component_counts;
|
||||
|
||||
typedef struct {
|
||||
unsigned int joints[MV_JOINTS];
|
||||
nmv_component_counts comps[2];
|
||||
} nmv_context_counts;
|
||||
|
||||
void av1_inc_mv(const MV *mv, nmv_context_counts *mvctx, const int usehp);
|
||||
#if CONFIG_GLOBAL_MOTION
|
||||
extern const aom_tree_index
|
||||
av1_global_motion_types_tree[TREE_SIZE(GLOBAL_TRANS_TYPES)];
|
||||
#endif // CONFIG_GLOBAL_MOTION
|
||||
#if CONFIG_EC_MULTISYMBOL
|
||||
void av1_set_mv_cdfs(nmv_context *ctx);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // AV1_COMMON_ENTROPYMV_H_
|
||||
543
third_party/aom/av1/common/enums.h
vendored
Normal file
543
third_party/aom/av1/common/enums.h
vendored
Normal file
|
|
@ -0,0 +1,543 @@
|
|||
/*
|
||||
* 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_COMMON_ENUMS_H_
|
||||
#define AV1_COMMON_ENUMS_H_
|
||||
|
||||
#include "./aom_config.h"
|
||||
#include "aom/aom_codec.h"
|
||||
#include "aom/aom_integer.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#undef MAX_SB_SIZE
|
||||
|
||||
// Max superblock size
|
||||
#if CONFIG_EXT_PARTITION
|
||||
#define MAX_SB_SIZE_LOG2 7
|
||||
#else
|
||||
#define MAX_SB_SIZE_LOG2 6
|
||||
#endif // CONFIG_EXT_PARTITION
|
||||
#define MAX_SB_SIZE (1 << MAX_SB_SIZE_LOG2)
|
||||
#define MAX_SB_SQUARE (MAX_SB_SIZE * MAX_SB_SIZE)
|
||||
|
||||
// Min superblock size
|
||||
#define MIN_SB_SIZE_LOG2 6
|
||||
|
||||
// Pixels per Mode Info (MI) unit
|
||||
#if CONFIG_CB4X4
|
||||
#define MI_SIZE_LOG2 2
|
||||
#else
|
||||
#define MI_SIZE_LOG2 3
|
||||
#endif
|
||||
#define MI_SIZE (1 << MI_SIZE_LOG2)
|
||||
|
||||
// MI-units per max superblock (MI Block - MIB)
|
||||
#define MAX_MIB_SIZE_LOG2 (MAX_SB_SIZE_LOG2 - MI_SIZE_LOG2)
|
||||
#define MAX_MIB_SIZE (1 << MAX_MIB_SIZE_LOG2)
|
||||
|
||||
// MI-units per min superblock
|
||||
#define MIN_MIB_SIZE_LOG2 (MIN_SB_SIZE_LOG2 - MI_SIZE_LOG2)
|
||||
|
||||
// Mask to extract MI offset within max MIB
|
||||
#define MAX_MIB_MASK (MAX_MIB_SIZE - 1)
|
||||
#define MAX_MIB_MASK_2 (MAX_MIB_SIZE * 2 - 1)
|
||||
|
||||
// Maximum number of tile rows and tile columns
|
||||
#if CONFIG_EXT_TILE
|
||||
#define TILE_NORMAL 0
|
||||
#define TILE_VR 1
|
||||
|
||||
#define MAX_TILE_ROWS 1024
|
||||
#define MAX_TILE_COLS 1024
|
||||
#else
|
||||
#define MAX_TILE_ROWS 4
|
||||
#define MAX_TILE_COLS 64
|
||||
#endif // CONFIG_EXT_TILE
|
||||
|
||||
#if CONFIG_VAR_TX
|
||||
#define MAX_VARTX_DEPTH 2
|
||||
#endif
|
||||
|
||||
// Bitstream profiles indicated by 2-3 bits in the uncompressed header.
|
||||
// 00: Profile 0. 8-bit 4:2:0 only.
|
||||
// 10: Profile 1. 8-bit 4:4:4, 4:2:2, and 4:4:0.
|
||||
// 01: Profile 2. 10-bit and 12-bit color only, with 4:2:0 sampling.
|
||||
// 110: Profile 3. 10-bit and 12-bit color only, with 4:2:2/4:4:4/4:4:0
|
||||
// sampling.
|
||||
// 111: Undefined profile.
|
||||
typedef enum BITSTREAM_PROFILE {
|
||||
PROFILE_0,
|
||||
PROFILE_1,
|
||||
PROFILE_2,
|
||||
PROFILE_3,
|
||||
MAX_PROFILES
|
||||
} BITSTREAM_PROFILE;
|
||||
|
||||
// Note: Some enums use the attribute 'packed' to use smallest possible integer
|
||||
// type, so that we can save memory when they are used in structs/arrays.
|
||||
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
#if CONFIG_CB4X4
|
||||
BLOCK_2X2,
|
||||
BLOCK_2X4,
|
||||
BLOCK_4X2,
|
||||
#endif
|
||||
BLOCK_4X4,
|
||||
BLOCK_4X8,
|
||||
BLOCK_8X4,
|
||||
BLOCK_8X8,
|
||||
BLOCK_8X16,
|
||||
BLOCK_16X8,
|
||||
BLOCK_16X16,
|
||||
BLOCK_16X32,
|
||||
BLOCK_32X16,
|
||||
BLOCK_32X32,
|
||||
BLOCK_32X64,
|
||||
BLOCK_64X32,
|
||||
BLOCK_64X64,
|
||||
#if CONFIG_EXT_PARTITION
|
||||
BLOCK_64X128,
|
||||
BLOCK_128X64,
|
||||
BLOCK_128X128,
|
||||
#endif // CONFIG_EXT_PARTITION
|
||||
BLOCK_SIZES,
|
||||
BLOCK_INVALID = BLOCK_SIZES,
|
||||
BLOCK_LARGEST = (BLOCK_SIZES - 1)
|
||||
} BLOCK_SIZE;
|
||||
|
||||
typedef enum {
|
||||
PARTITION_NONE,
|
||||
PARTITION_HORZ,
|
||||
PARTITION_VERT,
|
||||
PARTITION_SPLIT,
|
||||
#if CONFIG_EXT_PARTITION_TYPES
|
||||
PARTITION_HORZ_A, // HORZ split and the left partition is split again
|
||||
PARTITION_HORZ_B, // HORZ split and the right partition is split again
|
||||
PARTITION_VERT_A, // VERT split and the top partition is split again
|
||||
PARTITION_VERT_B, // VERT split and the bottom partition is split again
|
||||
EXT_PARTITION_TYPES,
|
||||
#endif // CONFIG_EXT_PARTITION_TYPES
|
||||
PARTITION_TYPES = PARTITION_SPLIT + 1,
|
||||
PARTITION_INVALID = 255
|
||||
} PARTITION_TYPE;
|
||||
|
||||
typedef char PARTITION_CONTEXT;
|
||||
#define PARTITION_PLOFFSET 4 // number of probability models per block size
|
||||
#define PARTITION_BLOCK_SIZES (4 + CONFIG_EXT_PARTITION)
|
||||
#define PARTITION_CONTEXTS_PRIMARY (PARTITION_BLOCK_SIZES * PARTITION_PLOFFSET)
|
||||
#if CONFIG_UNPOISON_PARTITION_CTX
|
||||
#define PARTITION_CONTEXTS \
|
||||
(PARTITION_CONTEXTS_PRIMARY + 2 * PARTITION_BLOCK_SIZES)
|
||||
#else
|
||||
#define PARTITION_CONTEXTS PARTITION_CONTEXTS_PRIMARY
|
||||
#endif
|
||||
|
||||
// block transform size
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
#if CONFIG_CB4X4
|
||||
TX_2X2, // 2x2 transform
|
||||
#endif
|
||||
TX_4X4, // 4x4 transform
|
||||
TX_8X8, // 8x8 transform
|
||||
TX_16X16, // 16x16 transform
|
||||
TX_32X32, // 32x32 transform
|
||||
#if CONFIG_TX64X64
|
||||
TX_64X64, // 64x64 transform
|
||||
#endif // CONFIG_TX64X64
|
||||
TX_4X8, // 4x8 transform
|
||||
TX_8X4, // 8x4 transform
|
||||
TX_8X16, // 8x16 transform
|
||||
TX_16X8, // 16x8 transform
|
||||
TX_16X32, // 16x32 transform
|
||||
TX_32X16, // 32x16 transform
|
||||
TX_4X16, // 4x16 transform
|
||||
TX_16X4, // 16x4 transform
|
||||
TX_8X32, // 8x32 transform
|
||||
TX_32X8, // 32x8 transform
|
||||
TX_SIZES_ALL, // Includes rectangular transforms
|
||||
TX_SIZES = TX_4X8, // Does NOT include rectangular transforms
|
||||
TX_INVALID = 255 // Invalid transform size
|
||||
} TX_SIZE;
|
||||
|
||||
#define MAX_TX_DEPTH (TX_SIZES - 1 - TX_4X4)
|
||||
|
||||
#define MAX_TX_SIZE_LOG2 (5 + CONFIG_TX64X64)
|
||||
#define MAX_TX_SIZE (1 << MAX_TX_SIZE_LOG2)
|
||||
#define MIN_TX_SIZE_LOG2 2
|
||||
#define MIN_TX_SIZE (1 << MIN_TX_SIZE_LOG2)
|
||||
#define MAX_TX_SQUARE (MAX_TX_SIZE * MAX_TX_SIZE)
|
||||
|
||||
// Number of maxium size transform blocks in the maximum size superblock
|
||||
#define MAX_TX_BLOCKS_IN_MAX_SB_LOG2 ((MAX_SB_SIZE_LOG2 - MAX_TX_SIZE_LOG2) * 2)
|
||||
#define MAX_TX_BLOCKS_IN_MAX_SB (1 << MAX_TX_BLOCKS_IN_MAX_SB_LOG2)
|
||||
|
||||
#define MAX_NUM_TXB (1 << (MAX_SB_SIZE_LOG2 - MIN_TX_SIZE_LOG2))
|
||||
|
||||
// frame transform mode
|
||||
typedef enum {
|
||||
ONLY_4X4 = 0, // only 4x4 transform used
|
||||
ALLOW_8X8 = 1, // allow block transform size up to 8x8
|
||||
ALLOW_16X16 = 2, // allow block transform size up to 16x16
|
||||
ALLOW_32X32 = 3, // allow block transform size up to 32x32
|
||||
#if CONFIG_TX64X64
|
||||
ALLOW_64X64 = 4, // allow block transform size up to 64x64
|
||||
#endif
|
||||
TX_MODE_SELECT, // transform specified for each block
|
||||
TX_MODES,
|
||||
} TX_MODE;
|
||||
|
||||
// 1D tx types
|
||||
typedef enum {
|
||||
DCT_1D = 0,
|
||||
ADST_1D = 1,
|
||||
FLIPADST_1D = 2,
|
||||
IDTX_1D = 3,
|
||||
TX_TYPES_1D = 4,
|
||||
} TX_TYPE_1D;
|
||||
|
||||
typedef enum {
|
||||
DCT_DCT = 0, // DCT in both horizontal and vertical
|
||||
ADST_DCT = 1, // ADST in vertical, DCT in horizontal
|
||||
DCT_ADST = 2, // DCT in vertical, ADST in horizontal
|
||||
ADST_ADST = 3, // ADST in both directions
|
||||
#if CONFIG_EXT_TX
|
||||
FLIPADST_DCT = 4,
|
||||
DCT_FLIPADST = 5,
|
||||
FLIPADST_FLIPADST = 6,
|
||||
ADST_FLIPADST = 7,
|
||||
FLIPADST_ADST = 8,
|
||||
IDTX = 9,
|
||||
V_DCT = 10,
|
||||
H_DCT = 11,
|
||||
V_ADST = 12,
|
||||
H_ADST = 13,
|
||||
V_FLIPADST = 14,
|
||||
H_FLIPADST = 15,
|
||||
#endif // CONFIG_EXT_TX
|
||||
TX_TYPES,
|
||||
} TX_TYPE;
|
||||
|
||||
typedef enum {
|
||||
TILE_LEFT_BOUNDARY = 1,
|
||||
TILE_RIGHT_BOUNDARY = 2,
|
||||
TILE_ABOVE_BOUNDARY = 4,
|
||||
TILE_BOTTOM_BOUNDARY = 8,
|
||||
FRAME_LEFT_BOUNDARY = 16,
|
||||
FRAME_RIGHT_BOUNDARY = 32,
|
||||
FRAME_ABOVE_BOUNDARY = 64,
|
||||
FRAME_BOTTOM_BOUNDARY = 128,
|
||||
} BOUNDARY_TYPE;
|
||||
|
||||
#if CONFIG_EXT_TX
|
||||
#if CONFIG_CB4X4
|
||||
#define EXT_TX_SIZES 5 // number of sizes that use extended transforms
|
||||
#else
|
||||
#define EXT_TX_SIZES 4 // number of sizes that use extended transforms
|
||||
#endif // CONFIG_CB4X4
|
||||
#define EXT_TX_SETS_INTER 4 // Sets of transform selections for INTER
|
||||
#define EXT_TX_SETS_INTRA 3 // Sets of transform selections for INTRA
|
||||
#else
|
||||
#if CONFIG_CB4X4
|
||||
#define EXT_TX_SIZES 4 // number of sizes that use extended transforms
|
||||
#else
|
||||
#define EXT_TX_SIZES 3 // number of sizes that use extended transforms
|
||||
#endif
|
||||
#endif // CONFIG_EXT_TX
|
||||
|
||||
typedef enum {
|
||||
AOM_LAST_FLAG = 1 << 0,
|
||||
#if CONFIG_EXT_REFS
|
||||
AOM_LAST2_FLAG = 1 << 1,
|
||||
AOM_LAST3_FLAG = 1 << 2,
|
||||
AOM_GOLD_FLAG = 1 << 3,
|
||||
AOM_BWD_FLAG = 1 << 4,
|
||||
AOM_ALT_FLAG = 1 << 5,
|
||||
AOM_REFFRAME_ALL = (1 << 6) - 1
|
||||
#else
|
||||
AOM_GOLD_FLAG = 1 << 1,
|
||||
AOM_ALT_FLAG = 1 << 2,
|
||||
AOM_REFFRAME_ALL = (1 << 3) - 1
|
||||
#endif // CONFIG_EXT_REFS
|
||||
} AOM_REFFRAME;
|
||||
|
||||
typedef enum { PLANE_TYPE_Y = 0, PLANE_TYPE_UV = 1, PLANE_TYPES } PLANE_TYPE;
|
||||
|
||||
#if CONFIG_CFL
|
||||
typedef enum { CFL_PRED_U = 0, CFL_PRED_V = 1, CFL_PRED_PLANES } CFL_PRED_TYPE;
|
||||
#endif
|
||||
|
||||
#if CONFIG_PALETTE
|
||||
typedef enum {
|
||||
TWO_COLORS,
|
||||
THREE_COLORS,
|
||||
FOUR_COLORS,
|
||||
FIVE_COLORS,
|
||||
SIX_COLORS,
|
||||
SEVEN_COLORS,
|
||||
EIGHT_COLORS,
|
||||
PALETTE_SIZES
|
||||
} PALETTE_SIZE;
|
||||
|
||||
typedef enum {
|
||||
PALETTE_COLOR_ONE,
|
||||
PALETTE_COLOR_TWO,
|
||||
PALETTE_COLOR_THREE,
|
||||
PALETTE_COLOR_FOUR,
|
||||
PALETTE_COLOR_FIVE,
|
||||
PALETTE_COLOR_SIX,
|
||||
PALETTE_COLOR_SEVEN,
|
||||
PALETTE_COLOR_EIGHT,
|
||||
PALETTE_COLORS
|
||||
} PALETTE_COLOR;
|
||||
#endif // CONFIG_PALETTE
|
||||
|
||||
typedef enum ATTRIBUTE_PACKED {
|
||||
DC_PRED, // Average of above and left pixels
|
||||
V_PRED, // Vertical
|
||||
H_PRED, // Horizontal
|
||||
D45_PRED, // Directional 45 deg = round(arctan(1/1) * 180/pi)
|
||||
D135_PRED, // Directional 135 deg = 180 - 45
|
||||
D117_PRED, // Directional 117 deg = 180 - 63
|
||||
D153_PRED, // Directional 153 deg = 180 - 27
|
||||
D207_PRED, // Directional 207 deg = 180 + 27
|
||||
D63_PRED, // Directional 63 deg = round(arctan(2/1) * 180/pi)
|
||||
#if CONFIG_ALT_INTRA
|
||||
SMOOTH_PRED, // Combination of horizontal and vertical interpolation
|
||||
#endif // CONFIG_ALT_INTRA
|
||||
TM_PRED, // True-motion
|
||||
NEARESTMV,
|
||||
NEARMV,
|
||||
ZEROMV,
|
||||
NEWMV,
|
||||
#if CONFIG_EXT_INTER
|
||||
#if CONFIG_COMPOUND_SINGLEREF
|
||||
// Single ref compound modes
|
||||
SR_NEAREST_NEARMV,
|
||||
SR_NEAREST_NEWMV,
|
||||
SR_NEAR_NEWMV,
|
||||
SR_ZERO_NEWMV,
|
||||
SR_NEW_NEWMV,
|
||||
#endif // CONFIG_COMPOUND_SINGLEREF
|
||||
// Compound ref compound modes
|
||||
NEAREST_NEARESTMV,
|
||||
NEAREST_NEARMV,
|
||||
NEAR_NEARESTMV,
|
||||
NEAR_NEARMV,
|
||||
NEAREST_NEWMV,
|
||||
NEW_NEARESTMV,
|
||||
NEAR_NEWMV,
|
||||
NEW_NEARMV,
|
||||
ZERO_ZEROMV,
|
||||
NEW_NEWMV,
|
||||
#endif // CONFIG_EXT_INTER
|
||||
MB_MODE_COUNT,
|
||||
INTRA_MODES = TM_PRED + 1,
|
||||
INTRA_INVALID = MB_MODE_COUNT // For uv_mode in inter blocks
|
||||
} PREDICTION_MODE;
|
||||
|
||||
typedef enum {
|
||||
SIMPLE_TRANSLATION = 0,
|
||||
#if CONFIG_MOTION_VAR
|
||||
OBMC_CAUSAL, // 2-sided OBMC
|
||||
#endif // CONFIG_MOTION_VAR
|
||||
#if CONFIG_WARPED_MOTION
|
||||
WARPED_CAUSAL, // 2-sided WARPED
|
||||
#endif // CONFIG_WARPED_MOTION
|
||||
MOTION_MODES
|
||||
} MOTION_MODE;
|
||||
|
||||
// TODO(urvang): Consider adding II_SMOOTH_PRED if it's helpful.
|
||||
|
||||
#if CONFIG_EXT_INTER
|
||||
typedef enum {
|
||||
II_DC_PRED = 0,
|
||||
II_V_PRED,
|
||||
II_H_PRED,
|
||||
II_D45_PRED,
|
||||
II_D135_PRED,
|
||||
II_D117_PRED,
|
||||
II_D153_PRED,
|
||||
II_D207_PRED,
|
||||
II_D63_PRED,
|
||||
II_TM_PRED,
|
||||
INTERINTRA_MODES
|
||||
} INTERINTRA_MODE;
|
||||
|
||||
typedef enum {
|
||||
COMPOUND_AVERAGE = 0,
|
||||
#if CONFIG_WEDGE
|
||||
COMPOUND_WEDGE,
|
||||
#endif // CONFIG_WEDGE
|
||||
#if CONFIG_COMPOUND_SEGMENT
|
||||
COMPOUND_SEG,
|
||||
#endif // CONFIG_COMPOUND_SEGMENT
|
||||
COMPOUND_TYPES,
|
||||
} COMPOUND_TYPE;
|
||||
#endif // CONFIG_EXT_INTER
|
||||
|
||||
// TODO(huisu): Consider adding FILTER_SMOOTH_PRED to "FILTER_INTRA_MODE".
|
||||
#if CONFIG_FILTER_INTRA
|
||||
typedef enum {
|
||||
FILTER_DC_PRED,
|
||||
FILTER_V_PRED,
|
||||
FILTER_H_PRED,
|
||||
FILTER_D45_PRED,
|
||||
FILTER_D135_PRED,
|
||||
FILTER_D117_PRED,
|
||||
FILTER_D153_PRED,
|
||||
FILTER_D207_PRED,
|
||||
FILTER_D63_PRED,
|
||||
FILTER_TM_PRED,
|
||||
FILTER_INTRA_MODES,
|
||||
} FILTER_INTRA_MODE;
|
||||
#endif // CONFIG_FILTER_INTRA
|
||||
|
||||
#if CONFIG_EXT_INTRA
|
||||
#define DIRECTIONAL_MODES (INTRA_MODES - 2)
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
|
||||
#define INTER_MODES (1 + NEWMV - NEARESTMV)
|
||||
|
||||
#if CONFIG_EXT_INTER
|
||||
#if CONFIG_COMPOUND_SINGLEREF
|
||||
#define INTER_SINGLEREF_COMP_MODES (1 + SR_NEW_NEWMV - SR_NEAREST_NEARMV)
|
||||
#endif // CONFIG_COMPOUND_SINGLEREF
|
||||
|
||||
#define INTER_COMPOUND_MODES (1 + NEW_NEWMV - NEAREST_NEARESTMV)
|
||||
#endif // CONFIG_EXT_INTER
|
||||
|
||||
#define SKIP_CONTEXTS 3
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
#define NMV_CONTEXTS 3
|
||||
|
||||
#define NEWMV_MODE_CONTEXTS 7
|
||||
#define ZEROMV_MODE_CONTEXTS 2
|
||||
#define REFMV_MODE_CONTEXTS 9
|
||||
#define DRL_MODE_CONTEXTS 5
|
||||
|
||||
#define ZEROMV_OFFSET 3
|
||||
#define REFMV_OFFSET 4
|
||||
|
||||
#define NEWMV_CTX_MASK ((1 << ZEROMV_OFFSET) - 1)
|
||||
#define ZEROMV_CTX_MASK ((1 << (REFMV_OFFSET - ZEROMV_OFFSET)) - 1)
|
||||
#define REFMV_CTX_MASK ((1 << (8 - REFMV_OFFSET)) - 1)
|
||||
|
||||
#define ALL_ZERO_FLAG_OFFSET 8
|
||||
#define SKIP_NEARESTMV_OFFSET 9
|
||||
#define SKIP_NEARMV_OFFSET 10
|
||||
#define SKIP_NEARESTMV_SUB8X8_OFFSET 11
|
||||
#endif
|
||||
|
||||
#define INTER_MODE_CONTEXTS 7
|
||||
#if CONFIG_DELTA_Q
|
||||
#define DELTA_Q_SMALL 3
|
||||
#define DELTA_Q_PROBS (DELTA_Q_SMALL)
|
||||
#define DEFAULT_DELTA_Q_RES 4
|
||||
#if CONFIG_EXT_DELTA_Q
|
||||
#define DELTA_LF_SMALL 3
|
||||
#define DELTA_LF_PROBS (DELTA_LF_SMALL)
|
||||
#define DEFAULT_DELTA_LF_RES 2
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Segment Feature Masks */
|
||||
#define MAX_MV_REF_CANDIDATES 2
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
#define MAX_REF_MV_STACK_SIZE 16
|
||||
#if CONFIG_EXT_PARTITION
|
||||
#define REF_CAT_LEVEL 640
|
||||
#else
|
||||
#define REF_CAT_LEVEL 255
|
||||
#endif // CONFIG_EXT_PARTITION
|
||||
#endif // CONFIG_REF_MV
|
||||
|
||||
#define INTRA_INTER_CONTEXTS 4
|
||||
#define COMP_INTER_CONTEXTS 5
|
||||
#define REF_CONTEXTS 5
|
||||
#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF
|
||||
#define COMP_INTER_MODE_CONTEXTS 4
|
||||
#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF
|
||||
|
||||
#if CONFIG_VAR_TX
|
||||
#define TXFM_PARTITION_CONTEXTS ((TX_SIZES - TX_8X8) * 6 - 2)
|
||||
typedef uint8_t TXFM_CONTEXT;
|
||||
#endif
|
||||
|
||||
#define NONE_FRAME -1
|
||||
#define INTRA_FRAME 0
|
||||
#define LAST_FRAME 1
|
||||
|
||||
#if CONFIG_EXT_REFS
|
||||
#define LAST2_FRAME 2
|
||||
#define LAST3_FRAME 3
|
||||
#define GOLDEN_FRAME 4
|
||||
#define BWDREF_FRAME 5
|
||||
#define ALTREF_FRAME 6
|
||||
#define LAST_REF_FRAMES (LAST3_FRAME - LAST_FRAME + 1)
|
||||
#else
|
||||
#define GOLDEN_FRAME 2
|
||||
#define ALTREF_FRAME 3
|
||||
#endif // CONFIG_EXT_REFS
|
||||
|
||||
#define INTER_REFS_PER_FRAME (ALTREF_FRAME - LAST_FRAME + 1)
|
||||
#define TOTAL_REFS_PER_FRAME (ALTREF_FRAME - INTRA_FRAME + 1)
|
||||
|
||||
#define FWD_REFS (GOLDEN_FRAME - LAST_FRAME + 1)
|
||||
#define FWD_RF_OFFSET(ref) (ref - LAST_FRAME)
|
||||
#if CONFIG_EXT_REFS
|
||||
#define BWD_REFS (ALTREF_FRAME - BWDREF_FRAME + 1)
|
||||
#define BWD_RF_OFFSET(ref) (ref - BWDREF_FRAME)
|
||||
#else
|
||||
#define BWD_REFS 1
|
||||
#define BWD_RF_OFFSET(ref) (ref - ALTREF_FRAME)
|
||||
#endif // CONFIG_EXT_REFS
|
||||
|
||||
#define SINGLE_REFS (FWD_REFS + BWD_REFS)
|
||||
#define COMP_REFS (FWD_REFS * BWD_REFS)
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
#define MODE_CTX_REF_FRAMES (TOTAL_REFS_PER_FRAME + COMP_REFS)
|
||||
#else
|
||||
#define MODE_CTX_REF_FRAMES TOTAL_REFS_PER_FRAME
|
||||
#endif
|
||||
|
||||
#if CONFIG_SUPERTX
|
||||
#define PARTITION_SUPERTX_CONTEXTS 2
|
||||
#define MAX_SUPERTX_BLOCK_SIZE BLOCK_32X32
|
||||
#endif // CONFIG_SUPERTX
|
||||
|
||||
#if CONFIG_LOOP_RESTORATION
|
||||
typedef enum {
|
||||
RESTORE_NONE = 0,
|
||||
RESTORE_WIENER = 1,
|
||||
RESTORE_SGRPROJ = 2,
|
||||
RESTORE_SWITCHABLE,
|
||||
RESTORE_SWITCHABLE_TYPES = RESTORE_SWITCHABLE,
|
||||
RESTORE_TYPES,
|
||||
} RestorationType;
|
||||
#endif // CONFIG_LOOP_RESTORATION
|
||||
|
||||
#if CONFIG_FRAME_SUPERRES
|
||||
#define SUPERRES_SCALE_DENOMINATOR 16
|
||||
#define SUPERRES_SCALE_BITS 3
|
||||
#define SUPERRES_SCALE_NUMERATOR_MIN 8
|
||||
#endif // CONFIG_FRAME_SUPERRES
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // AV1_COMMON_ENUMS_H_
|
||||
360
third_party/aom/av1/common/filter.c
vendored
Normal file
360
third_party/aom/av1/common/filter.c
vendored
Normal file
|
|
@ -0,0 +1,360 @@
|
|||
/*
|
||||
* 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 "av1/common/filter.h"
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
bilinear_filters[SUBPEL_SHIFTS]) = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 0, 0, 120, 8, 0, 0, 0 },
|
||||
{ 0, 0, 0, 112, 16, 0, 0, 0 }, { 0, 0, 0, 104, 24, 0, 0, 0 },
|
||||
{ 0, 0, 0, 96, 32, 0, 0, 0 }, { 0, 0, 0, 88, 40, 0, 0, 0 },
|
||||
{ 0, 0, 0, 80, 48, 0, 0, 0 }, { 0, 0, 0, 72, 56, 0, 0, 0 },
|
||||
{ 0, 0, 0, 64, 64, 0, 0, 0 }, { 0, 0, 0, 56, 72, 0, 0, 0 },
|
||||
{ 0, 0, 0, 48, 80, 0, 0, 0 }, { 0, 0, 0, 40, 88, 0, 0, 0 },
|
||||
{ 0, 0, 0, 32, 96, 0, 0, 0 }, { 0, 0, 0, 24, 104, 0, 0, 0 },
|
||||
{ 0, 0, 0, 16, 112, 0, 0, 0 }, { 0, 0, 0, 8, 120, 0, 0, 0 }
|
||||
};
|
||||
|
||||
#if USE_TEMPORALFILTER_12TAP
|
||||
DECLARE_ALIGNED(16, static const int16_t,
|
||||
sub_pel_filters_temporalfilter_12[SUBPEL_SHIFTS][12]) = {
|
||||
// intfilt 0.8
|
||||
{ 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 1, -1, 3, -7, 127, 8, -4, 2, -1, 0, 0 },
|
||||
{ 0, 1, -3, 5, -12, 124, 18, -8, 4, -2, 1, 0 },
|
||||
{ -1, 2, -4, 8, -17, 120, 28, -11, 6, -3, 1, -1 },
|
||||
{ -1, 2, -4, 10, -21, 114, 38, -15, 8, -4, 2, -1 },
|
||||
{ -1, 3, -5, 11, -23, 107, 49, -18, 9, -5, 2, -1 },
|
||||
{ -1, 3, -6, 12, -25, 99, 60, -21, 11, -6, 3, -1 },
|
||||
{ -1, 3, -6, 12, -25, 90, 70, -23, 12, -6, 3, -1 },
|
||||
{ -1, 3, -6, 12, -24, 80, 80, -24, 12, -6, 3, -1 },
|
||||
{ -1, 3, -6, 12, -23, 70, 90, -25, 12, -6, 3, -1 },
|
||||
{ -1, 3, -6, 11, -21, 60, 99, -25, 12, -6, 3, -1 },
|
||||
{ -1, 2, -5, 9, -18, 49, 107, -23, 11, -5, 3, -1 },
|
||||
{ -1, 2, -4, 8, -15, 38, 114, -21, 10, -4, 2, -1 },
|
||||
{ -1, 1, -3, 6, -11, 28, 120, -17, 8, -4, 2, -1 },
|
||||
{ 0, 1, -2, 4, -8, 18, 124, -12, 5, -3, 1, 0 },
|
||||
{ 0, 0, -1, 2, -4, 8, 127, -7, 3, -1, 1, 0 },
|
||||
};
|
||||
#endif // USE_TEMPORALFILTER_12TAP
|
||||
|
||||
#if CONFIG_DUAL_FILTER
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_8[SUBPEL_SHIFTS]) = {
|
||||
// intfilt 0.575
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 1, -5, 126, 8, -3, 1, 0 },
|
||||
{ -1, 3, -10, 123, 18, -6, 2, -1 }, { -1, 4, -14, 118, 27, -9, 3, 0 },
|
||||
{ -1, 5, -16, 112, 37, -12, 4, -1 }, { -1, 5, -18, 105, 48, -14, 4, -1 },
|
||||
{ -1, 6, -19, 97, 58, -17, 5, -1 }, { -1, 6, -20, 88, 68, -18, 6, -1 },
|
||||
{ -1, 6, -19, 78, 78, -19, 6, -1 }, { -1, 6, -18, 68, 88, -20, 6, -1 },
|
||||
{ -1, 5, -17, 58, 97, -19, 6, -1 }, { -1, 4, -14, 48, 105, -18, 5, -1 },
|
||||
{ -1, 4, -12, 37, 112, -16, 5, -1 }, { 0, 3, -9, 27, 118, -14, 4, -1 },
|
||||
{ -1, 2, -6, 18, 123, -10, 3, -1 }, { 0, 1, -3, 8, 126, -5, 1, 0 },
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_regular_uv[SUBPEL_SHIFTS]) = {
|
||||
// intfilt 0.575
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 1, -5, 126, 8, -3, 1, 0 },
|
||||
{ -1, 3, -10, 123, 18, -6, 2, -1 }, { -1, 4, -14, 118, 27, -9, 3, 0 },
|
||||
{ -1, 5, -16, 112, 37, -12, 4, -1 }, { -1, 5, -18, 105, 48, -14, 4, -1 },
|
||||
{ -1, 6, -19, 97, 58, -17, 5, -1 }, { -1, 6, -20, 88, 68, -18, 6, -1 },
|
||||
{ -1, 6, -19, 78, 78, -19, 6, -1 }, { -1, 6, -18, 68, 88, -20, 6, -1 },
|
||||
{ -1, 5, -17, 58, 97, -19, 6, -1 }, { -1, 4, -14, 48, 105, -18, 5, -1 },
|
||||
{ -1, 4, -12, 37, 112, -16, 5, -1 }, { 0, 3, -9, 27, 118, -14, 4, -1 },
|
||||
{ -1, 2, -6, 18, 123, -10, 3, -1 }, { 0, 1, -3, 8, 126, -5, 1, 0 },
|
||||
};
|
||||
|
||||
#if USE_12TAP_FILTER
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_8sharp[SUBPEL_SHIFTS]) = {
|
||||
// intfilt 0.8
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { -1, 2, -6, 127, 9, -4, 2, -1 },
|
||||
{ -2, 5, -12, 124, 18, -7, 4, -2 }, { -2, 7, -16, 119, 28, -11, 5, -2 },
|
||||
{ -3, 8, -19, 114, 38, -14, 7, -3 }, { -3, 9, -22, 107, 49, -17, 8, -3 },
|
||||
{ -4, 10, -23, 99, 60, -20, 10, -4 }, { -4, 11, -23, 90, 70, -22, 10, -4 },
|
||||
{ -4, 11, -23, 80, 80, -23, 11, -4 }, { -4, 10, -22, 70, 90, -23, 11, -4 },
|
||||
{ -4, 10, -20, 60, 99, -23, 10, -4 }, { -3, 8, -17, 49, 107, -22, 9, -3 },
|
||||
{ -3, 7, -14, 38, 114, -19, 8, -3 }, { -2, 5, -11, 28, 119, -16, 7, -2 },
|
||||
{ -2, 4, -7, 18, 124, -12, 5, -2 }, { -1, 2, -4, 9, 127, -6, 2, -1 },
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(256, static const int16_t,
|
||||
sub_pel_filters_10sharp[SUBPEL_SHIFTS][12]) = {
|
||||
// intfilt 0.85
|
||||
{ 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 1, -2, 3, -7, 127, 8, -4, 2, -1, 1, 0 },
|
||||
{ 0, 1, -3, 6, -13, 124, 18, -8, 4, -2, 1, 0 },
|
||||
{ 0, 2, -4, 8, -18, 120, 28, -12, 6, -4, 2, 0 },
|
||||
{ 0, 2, -5, 10, -21, 114, 38, -15, 8, -5, 2, 0 },
|
||||
{ 0, 3, -6, 11, -24, 107, 49, -19, 10, -6, 3, 0 },
|
||||
{ 0, 3, -7, 12, -25, 99, 59, -21, 11, -6, 3, 0 },
|
||||
{ 0, 3, -7, 12, -25, 90, 70, -23, 12, -7, 3, 0 },
|
||||
{ 0, 3, -7, 12, -25, 81, 81, -25, 12, -7, 3, 0 },
|
||||
{ 0, 3, -7, 12, -23, 70, 90, -25, 12, -7, 3, 0 },
|
||||
{ 0, 3, -6, 11, -21, 59, 99, -25, 12, -7, 3, 0 },
|
||||
{ 0, 3, -6, 10, -19, 49, 107, -24, 11, -6, 3, 0 },
|
||||
{ 0, 2, -5, 8, -15, 38, 114, -21, 10, -5, 2, 0 },
|
||||
{ 0, 2, -4, 6, -12, 28, 120, -18, 8, -4, 2, 0 },
|
||||
{ 0, 1, -2, 4, -8, 18, 124, -13, 6, -3, 1, 0 },
|
||||
{ 0, 1, -1, 2, -4, 8, 127, -7, 3, -2, 1, 0 },
|
||||
};
|
||||
#else
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_8sharp[SUBPEL_SHIFTS]) = {
|
||||
#if CONFIG_FILTER_7BIT
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { -2, 2, -6, 126, 8, -2, 2, 0 },
|
||||
{ -2, 6, -12, 124, 16, -6, 4, -2 }, { -2, 8, -18, 120, 26, -10, 6, -2 },
|
||||
{ -4, 10, -22, 116, 38, -14, 6, -2 }, { -4, 10, -22, 108, 48, -18, 8, -2 },
|
||||
{ -4, 10, -24, 100, 60, -20, 8, -2 }, { -4, 10, -24, 90, 70, -22, 10, -2 },
|
||||
{ -4, 12, -24, 80, 80, -24, 12, -4 }, { -2, 10, -22, 70, 90, -24, 10, -4 },
|
||||
{ -2, 8, -20, 60, 100, -24, 10, -4 }, { -2, 8, -18, 48, 108, -22, 10, -4 },
|
||||
{ -2, 6, -14, 38, 116, -22, 10, -4 }, { -2, 6, -10, 26, 120, -18, 8, -2 },
|
||||
{ -2, 4, -6, 16, 124, -12, 6, -2 }, { 0, 2, -2, 8, 126, -6, 2, -2 }
|
||||
#else
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { -1, 3, -7, 127, 8, -3, 1, 0 },
|
||||
{ -2, 5, -13, 125, 17, -6, 3, -1 }, { -3, 7, -17, 121, 27, -10, 5, -2 },
|
||||
{ -4, 9, -20, 115, 37, -13, 6, -2 }, { -4, 10, -23, 108, 48, -16, 8, -3 },
|
||||
{ -4, 10, -24, 100, 59, -19, 9, -3 }, { -4, 11, -24, 90, 70, -21, 10, -4 },
|
||||
{ -4, 11, -23, 80, 80, -23, 11, -4 }, { -4, 10, -21, 70, 90, -24, 11, -4 },
|
||||
{ -3, 9, -19, 59, 100, -24, 10, -4 }, { -3, 8, -16, 48, 108, -23, 10, -4 },
|
||||
{ -2, 6, -13, 37, 115, -20, 9, -4 }, { -2, 5, -10, 27, 121, -17, 7, -3 },
|
||||
{ -1, 3, -6, 17, 125, -13, 5, -2 }, { 0, 1, -3, 8, 127, -7, 3, -1 }
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_8smooth2[SUBPEL_SHIFTS]) = {
|
||||
// freqmultiplier = 0.2
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 9, 30, 44, 32, 11, 2, 0 },
|
||||
{ 0, 8, 28, 44, 34, 12, 2, 0 }, { 0, 7, 27, 44, 35, 13, 2, 0 },
|
||||
{ 0, 6, 26, 43, 37, 14, 2, 0 }, { 0, 5, 24, 43, 38, 16, 2, 0 },
|
||||
{ 0, 5, 23, 42, 38, 17, 3, 0 }, { 0, 4, 21, 41, 40, 19, 3, 0 },
|
||||
{ 0, 4, 20, 40, 40, 20, 4, 0 }, { 0, 3, 19, 40, 41, 21, 4, 0 },
|
||||
{ 0, 3, 17, 38, 42, 23, 5, 0 }, { 0, 2, 16, 38, 43, 24, 5, 0 },
|
||||
{ 0, 2, 14, 37, 43, 26, 6, 0 }, { 0, 2, 13, 35, 44, 27, 7, 0 },
|
||||
{ 0, 2, 12, 34, 44, 28, 8, 0 }, { 0, 2, 11, 32, 44, 30, 9, 0 },
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_smooth2_uv[SUBPEL_SHIFTS]) = {
|
||||
// freqmultiplier = 0.2
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 9, 30, 44, 32, 11, 2, 0 },
|
||||
{ 0, 8, 28, 44, 34, 12, 2, 0 }, { 0, 7, 27, 44, 35, 13, 2, 0 },
|
||||
{ 0, 6, 26, 43, 37, 14, 2, 0 }, { 0, 5, 24, 43, 38, 16, 2, 0 },
|
||||
{ 0, 5, 23, 42, 38, 17, 3, 0 }, { 0, 4, 21, 41, 40, 19, 3, 0 },
|
||||
{ 0, 4, 20, 40, 40, 20, 4, 0 }, { 0, 3, 19, 40, 41, 21, 4, 0 },
|
||||
{ 0, 3, 17, 38, 42, 23, 5, 0 }, { 0, 2, 16, 38, 43, 24, 5, 0 },
|
||||
{ 0, 2, 14, 37, 43, 26, 6, 0 }, { 0, 2, 13, 35, 44, 27, 7, 0 },
|
||||
{ 0, 2, 12, 34, 44, 28, 8, 0 }, { 0, 2, 11, 32, 44, 30, 9, 0 },
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_8smooth[SUBPEL_SHIFTS]) = {
|
||||
// freqmultiplier = 0.8
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, -5, 13, 102, 24, -7, 1, 0 },
|
||||
{ 0, -4, 8, 100, 31, -8, 1, 0 }, { 0, -3, 4, 97, 37, -8, 1, 0 },
|
||||
{ 0, -2, 0, 94, 44, -9, 1, 0 }, { 0, -2, -3, 90, 51, -9, 1, 0 },
|
||||
{ 0, -1, -5, 84, 59, -9, 0, 0 }, { 0, 0, -7, 79, 65, -9, 0, 0 },
|
||||
{ 0, 0, -8, 72, 72, -8, 0, 0 }, { 0, 0, -9, 65, 79, -7, 0, 0 },
|
||||
{ 0, 0, -9, 59, 84, -5, -1, 0 }, { 0, 1, -9, 51, 90, -3, -2, 0 },
|
||||
{ 0, 1, -9, 44, 94, 0, -2, 0 }, { 0, 1, -8, 37, 97, 4, -3, 0 },
|
||||
{ 0, 1, -8, 31, 100, 8, -4, 0 }, { 0, 1, -7, 24, 102, 13, -5, 0 },
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_smooth_uv[SUBPEL_SHIFTS]) = {
|
||||
// freqmultiplier = 0.8
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, -5, 13, 102, 24, -7, 1, 0 },
|
||||
{ 0, -4, 8, 100, 31, -8, 1, 0 }, { 0, -3, 4, 97, 37, -8, 1, 0 },
|
||||
{ 0, -2, 0, 94, 44, -9, 1, 0 }, { 0, -2, -3, 90, 51, -9, 1, 0 },
|
||||
{ 0, -1, -5, 84, 59, -9, 0, 0 }, { 0, 0, -7, 79, 65, -9, 0, 0 },
|
||||
{ 0, 0, -8, 72, 72, -8, 0, 0 }, { 0, 0, -9, 65, 79, -7, 0, 0 },
|
||||
{ 0, 0, -9, 59, 84, -5, -1, 0 }, { 0, 1, -9, 51, 90, -3, -2, 0 },
|
||||
{ 0, 1, -9, 44, 94, 0, -2, 0 }, { 0, 1, -8, 37, 97, 4, -3, 0 },
|
||||
{ 0, 1, -8, 31, 100, 8, -4, 0 }, { 0, 1, -7, 24, 102, 13, -5, 0 },
|
||||
};
|
||||
#else // CONFIG_DUAL_FILTER
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_8[SUBPEL_SHIFTS]) = {
|
||||
#if CONFIG_FILTER_7BIT
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 2, -6, 126, 8, -2, 0, 0 },
|
||||
{ 0, 2, -10, 122, 18, -4, 0, 0 }, { 0, 2, -12, 116, 28, -8, 2, 0 },
|
||||
{ 0, 2, -14, 110, 38, -10, 2, 0 }, { 0, 2, -14, 102, 48, -12, 2, 0 },
|
||||
{ 0, 2, -16, 94, 58, -12, 2, 0 }, { 0, 2, -14, 84, 66, -12, 2, 0 },
|
||||
{ 0, 2, -14, 76, 76, -14, 2, 0 }, { 0, 2, -12, 66, 84, -14, 2, 0 },
|
||||
{ 0, 2, -12, 58, 94, -16, 2, 0 }, { 0, 2, -12, 48, 102, -14, 2, 0 },
|
||||
{ 0, 2, -10, 38, 110, -14, 2, 0 }, { 0, 2, -8, 28, 116, -12, 2, 0 },
|
||||
{ 0, 0, -4, 18, 122, -10, 2, 0 }, { 0, 0, -2, 8, 126, -6, 2, 0 }
|
||||
#else
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 1, -5, 126, 8, -3, 1, 0 },
|
||||
{ -1, 3, -10, 122, 18, -6, 2, 0 }, { -1, 4, -13, 118, 27, -9, 3, -1 },
|
||||
{ -1, 4, -16, 112, 37, -11, 4, -1 }, { -1, 5, -18, 105, 48, -14, 4, -1 },
|
||||
{ -1, 5, -19, 97, 58, -16, 5, -1 }, { -1, 6, -19, 88, 68, -18, 5, -1 },
|
||||
{ -1, 6, -19, 78, 78, -19, 6, -1 }, { -1, 5, -18, 68, 88, -19, 6, -1 },
|
||||
{ -1, 5, -16, 58, 97, -19, 5, -1 }, { -1, 4, -14, 48, 105, -18, 5, -1 },
|
||||
{ -1, 4, -11, 37, 112, -16, 4, -1 }, { -1, 3, -9, 27, 118, -13, 4, -1 },
|
||||
{ 0, 2, -6, 18, 122, -10, 3, -1 }, { 0, 1, -3, 8, 126, -5, 1, 0 }
|
||||
#endif
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_8sharp[SUBPEL_SHIFTS]) = {
|
||||
#if CONFIG_FILTER_7BIT
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { -2, 2, -6, 126, 8, -2, 2, 0 },
|
||||
{ -2, 6, -12, 124, 16, -6, 4, -2 }, { -2, 8, -18, 120, 26, -10, 6, -2 },
|
||||
{ -4, 10, -22, 116, 38, -14, 6, -2 }, { -4, 10, -22, 108, 48, -18, 8, -2 },
|
||||
{ -4, 10, -24, 100, 60, -20, 8, -2 }, { -4, 10, -24, 90, 70, -22, 10, -2 },
|
||||
{ -4, 12, -24, 80, 80, -24, 12, -4 }, { -2, 10, -22, 70, 90, -24, 10, -4 },
|
||||
{ -2, 8, -20, 60, 100, -24, 10, -4 }, { -2, 8, -18, 48, 108, -22, 10, -4 },
|
||||
{ -2, 6, -14, 38, 116, -22, 10, -4 }, { -2, 6, -10, 26, 120, -18, 8, -2 },
|
||||
{ -2, 4, -6, 16, 124, -12, 6, -2 }, { 0, 2, -2, 8, 126, -6, 2, -2 }
|
||||
#else
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { -1, 3, -7, 127, 8, -3, 1, 0 },
|
||||
{ -2, 5, -13, 125, 17, -6, 3, -1 }, { -3, 7, -17, 121, 27, -10, 5, -2 },
|
||||
{ -4, 9, -20, 115, 37, -13, 6, -2 }, { -4, 10, -23, 108, 48, -16, 8, -3 },
|
||||
{ -4, 10, -24, 100, 59, -19, 9, -3 }, { -4, 11, -24, 90, 70, -21, 10, -4 },
|
||||
{ -4, 11, -23, 80, 80, -23, 11, -4 }, { -4, 10, -21, 70, 90, -24, 11, -4 },
|
||||
{ -3, 9, -19, 59, 100, -24, 10, -4 }, { -3, 8, -16, 48, 108, -23, 10, -4 },
|
||||
{ -2, 6, -13, 37, 115, -20, 9, -4 }, { -2, 5, -10, 27, 121, -17, 7, -3 },
|
||||
{ -1, 3, -6, 17, 125, -13, 5, -2 }, { 0, 1, -3, 8, 127, -7, 3, -1 }
|
||||
#endif
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(256, static const InterpKernel,
|
||||
sub_pel_filters_8smooth[SUBPEL_SHIFTS]) = {
|
||||
#if CONFIG_FILTER_7BIT
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 2, 28, 62, 34, 2, 0, 0 },
|
||||
{ 0, 0, 26, 62, 36, 4, 0, 0 }, { 0, 0, 22, 62, 40, 4, 0, 0 },
|
||||
{ 0, 0, 20, 60, 42, 6, 0, 0 }, { 0, 0, 18, 58, 44, 8, 0, 0 },
|
||||
{ 0, 0, 16, 56, 46, 10, 0, 0 }, { 0, -2, 16, 54, 48, 12, 0, 0 },
|
||||
{ 0, -2, 14, 52, 52, 14, -2, 0 }, { 0, 0, 12, 48, 54, 16, -2, 0 },
|
||||
{ 0, 0, 10, 46, 56, 16, 0, 0 }, { 0, 0, 8, 44, 58, 18, 0, 0 },
|
||||
{ 0, 0, 6, 42, 60, 20, 0, 0 }, { 0, 0, 4, 40, 62, 22, 0, 0 },
|
||||
{ 0, 0, 4, 36, 62, 26, 0, 0 }, { 0, 0, 2, 34, 62, 28, 2, 0 }
|
||||
#else
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { -3, -1, 32, 64, 38, 1, -3, 0 },
|
||||
{ -2, -2, 29, 63, 41, 2, -3, 0 }, { -2, -2, 26, 63, 43, 4, -4, 0 },
|
||||
{ -2, -3, 24, 62, 46, 5, -4, 0 }, { -2, -3, 21, 60, 49, 7, -4, 0 },
|
||||
{ -1, -4, 18, 59, 51, 9, -4, 0 }, { -1, -4, 16, 57, 53, 12, -4, -1 },
|
||||
{ -1, -4, 14, 55, 55, 14, -4, -1 }, { -1, -4, 12, 53, 57, 16, -4, -1 },
|
||||
{ 0, -4, 9, 51, 59, 18, -4, -1 }, { 0, -4, 7, 49, 60, 21, -3, -2 },
|
||||
{ 0, -4, 5, 46, 62, 24, -3, -2 }, { 0, -4, 4, 43, 63, 26, -2, -2 },
|
||||
{ 0, -3, 2, 41, 63, 29, -2, -2 }, { 0, -3, 1, 38, 64, 32, -1, -3 }
|
||||
#endif
|
||||
};
|
||||
#endif // CONFIG_DUAL_FILTER
|
||||
|
||||
#if CONFIG_EXT_INTRA
|
||||
#if CONFIG_INTRA_INTERP
|
||||
const InterpKernel *av1_intra_filter_kernels[INTRA_FILTERS] = {
|
||||
bilinear_filters, // INTRA_FILTER_LINEAR
|
||||
sub_pel_filters_8, // INTRA_FILTER_8TAP
|
||||
sub_pel_filters_8sharp, // INTRA_FILTER_8TAP_SHARP
|
||||
sub_pel_filters_8smooth, // INTRA_FILTER_8TAP_SMOOTH
|
||||
};
|
||||
#endif // CONFIG_INTRA_INTERP
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
|
||||
#if CONFIG_DUAL_FILTER
|
||||
static const InterpFilterParams
|
||||
av1_interp_filter_params_list[SWITCHABLE_FILTERS + EXTRA_FILTERS] = {
|
||||
{ (const int16_t *)sub_pel_filters_8, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
EIGHTTAP_REGULAR },
|
||||
{ (const int16_t *)sub_pel_filters_8smooth, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
EIGHTTAP_SMOOTH },
|
||||
#if USE_12TAP_FILTER
|
||||
{ (const int16_t *)sub_pel_filters_10sharp, 12, SUBPEL_SHIFTS,
|
||||
MULTITAP_SHARP },
|
||||
#else
|
||||
{ (const int16_t *)sub_pel_filters_8sharp, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
EIGHTTAP_SHARP },
|
||||
#endif
|
||||
{ (const int16_t *)sub_pel_filters_8smooth2, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
EIGHTTAP_SMOOTH2 },
|
||||
{ (const int16_t *)bilinear_filters, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
BILINEAR },
|
||||
{ (const int16_t *)sub_pel_filters_8sharp, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
EIGHTTAP_SHARP },
|
||||
{ (const int16_t *)sub_pel_filters_regular_uv, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
FILTER_REGULAR_UV },
|
||||
{ (const int16_t *)sub_pel_filters_smooth_uv, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
FILTER_SMOOTH_UV },
|
||||
{ (const int16_t *)sub_pel_filters_8sharp, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
FILTER_SHARP_UV },
|
||||
{ (const int16_t *)sub_pel_filters_smooth2_uv, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
FILTER_SMOOTH2_UV },
|
||||
};
|
||||
#else
|
||||
static const InterpFilterParams
|
||||
av1_interp_filter_params_list[SWITCHABLE_FILTERS + 1] = {
|
||||
{ (const int16_t *)sub_pel_filters_8, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
EIGHTTAP_REGULAR },
|
||||
{ (const int16_t *)sub_pel_filters_8smooth, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
EIGHTTAP_SMOOTH },
|
||||
{ (const int16_t *)sub_pel_filters_8sharp, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
MULTITAP_SHARP },
|
||||
{ (const int16_t *)bilinear_filters, SUBPEL_TAPS, SUBPEL_SHIFTS,
|
||||
BILINEAR }
|
||||
};
|
||||
#endif // CONFIG_DUAL_FILTER
|
||||
|
||||
#if USE_TEMPORALFILTER_12TAP
|
||||
static const InterpFilterParams av1_interp_temporalfilter_12tap = {
|
||||
(const int16_t *)sub_pel_filters_temporalfilter_12, 12, SUBPEL_SHIFTS,
|
||||
TEMPORALFILTER_12TAP
|
||||
};
|
||||
#endif // USE_TEMPORALFILTER_12TAP
|
||||
|
||||
InterpFilterParams av1_get_interp_filter_params(
|
||||
const InterpFilter interp_filter) {
|
||||
#if USE_TEMPORALFILTER_12TAP
|
||||
if (interp_filter == TEMPORALFILTER_12TAP)
|
||||
return av1_interp_temporalfilter_12tap;
|
||||
#endif // USE_TEMPORALFILTER_12TAP
|
||||
return av1_interp_filter_params_list[interp_filter];
|
||||
}
|
||||
|
||||
const int16_t *av1_get_interp_filter_kernel(const InterpFilter interp_filter) {
|
||||
#if USE_TEMPORALFILTER_12TAP
|
||||
if (interp_filter == TEMPORALFILTER_12TAP)
|
||||
return av1_interp_temporalfilter_12tap.filter_ptr;
|
||||
#endif // USE_TEMPORALFILTER_12TAP
|
||||
return (const int16_t *)av1_interp_filter_params_list[interp_filter]
|
||||
.filter_ptr;
|
||||
}
|
||||
|
||||
#if CONFIG_DUAL_FILTER
|
||||
InterpFilter av1_get_plane_interp_filter(InterpFilter interp_filter,
|
||||
int plane) {
|
||||
#if USE_TEMPORALFILTER_12TAP
|
||||
assert(interp_filter <= EIGHTTAP_SHARP ||
|
||||
interp_filter == TEMPORALFILTER_12TAP);
|
||||
#else
|
||||
assert(interp_filter <= EIGHTTAP_SHARP);
|
||||
#endif
|
||||
if (plane == 0) {
|
||||
return interp_filter;
|
||||
} else {
|
||||
switch (interp_filter) {
|
||||
case EIGHTTAP_REGULAR: return FILTER_REGULAR_UV;
|
||||
case EIGHTTAP_SMOOTH: return FILTER_SMOOTH_UV;
|
||||
case MULTITAP_SHARP: return FILTER_SHARP_UV;
|
||||
case EIGHTTAP_SMOOTH2: return FILTER_SMOOTH2_UV;
|
||||
default: return interp_filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
111
third_party/aom/av1/common/filter.h
vendored
Normal file
111
third_party/aom/av1/common/filter.h
vendored
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* 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_COMMON_FILTER_H_
|
||||
#define AV1_COMMON_FILTER_H_
|
||||
|
||||
#include "./aom_config.h"
|
||||
#include "aom/aom_integer.h"
|
||||
#include "aom_dsp/aom_filter.h"
|
||||
#include "aom_ports/mem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define USE_TEMPORALFILTER_12TAP 1
|
||||
#define MAX_FILTER_TAP 12
|
||||
|
||||
#define USE_12TAP_FILTER 0
|
||||
|
||||
typedef enum {
|
||||
EIGHTTAP_REGULAR,
|
||||
EIGHTTAP_SMOOTH,
|
||||
MULTITAP_SHARP,
|
||||
#if CONFIG_DUAL_FILTER
|
||||
EIGHTTAP_SMOOTH2,
|
||||
#endif // CONFIG_DUAL_FILTER
|
||||
BILINEAR,
|
||||
#if CONFIG_DUAL_FILTER
|
||||
EIGHTTAP_SHARP,
|
||||
FILTER_REGULAR_UV,
|
||||
FILTER_SMOOTH_UV,
|
||||
FILTER_SHARP_UV,
|
||||
FILTER_SMOOTH2_UV,
|
||||
#endif // CONFIG_DUAL_FILTER
|
||||
INTERP_FILTERS_ALL,
|
||||
SWITCHABLE_FILTERS = BILINEAR,
|
||||
SWITCHABLE = SWITCHABLE_FILTERS + 1, /* the last switchable one */
|
||||
EXTRA_FILTERS = INTERP_FILTERS_ALL - SWITCHABLE_FILTERS,
|
||||
#if USE_TEMPORALFILTER_12TAP
|
||||
TEMPORALFILTER_12TAP = SWITCHABLE_FILTERS + EXTRA_FILTERS,
|
||||
#endif
|
||||
} InterpFilter;
|
||||
|
||||
#if CONFIG_DUAL_FILTER
|
||||
#define MAX_SUBPEL_TAPS 12
|
||||
#define LOG_SWITCHABLE_FILTERS \
|
||||
3 /* (1 << LOG_SWITCHABLE_FILTERS) > SWITCHABLE_FILTERS */
|
||||
#define SWITCHABLE_FILTER_CONTEXTS ((SWITCHABLE_FILTERS + 1) * 4)
|
||||
#define INTER_FILTER_COMP_OFFSET (SWITCHABLE_FILTERS + 1)
|
||||
#define INTER_FILTER_DIR_OFFSET ((SWITCHABLE_FILTERS + 1) * 2)
|
||||
#else // CONFIG_DUAL_FILTER
|
||||
#define LOG_SWITCHABLE_FILTERS \
|
||||
2 /* (1 << LOG_SWITCHABLE_FILTERS) > SWITCHABLE_FILTERS */
|
||||
#define SWITCHABLE_FILTER_CONTEXTS (SWITCHABLE_FILTERS + 1)
|
||||
#endif // CONFIG_DUAL_FILTER
|
||||
|
||||
#if CONFIG_EXT_INTRA
|
||||
#if CONFIG_INTRA_INTERP
|
||||
typedef enum {
|
||||
INTRA_FILTER_LINEAR,
|
||||
INTRA_FILTER_8TAP,
|
||||
INTRA_FILTER_8TAP_SHARP,
|
||||
INTRA_FILTER_8TAP_SMOOTH,
|
||||
INTRA_FILTERS,
|
||||
} INTRA_FILTER;
|
||||
|
||||
extern const InterpKernel *av1_intra_filter_kernels[INTRA_FILTERS];
|
||||
#endif // CONFIG_INTRA_INTERP
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
|
||||
typedef struct InterpFilterParams {
|
||||
const int16_t *filter_ptr;
|
||||
uint16_t taps;
|
||||
uint16_t subpel_shifts;
|
||||
InterpFilter interp_filter;
|
||||
} InterpFilterParams;
|
||||
|
||||
InterpFilterParams av1_get_interp_filter_params(
|
||||
const InterpFilter interp_filter);
|
||||
|
||||
const int16_t *av1_get_interp_filter_kernel(const InterpFilter interp_filter);
|
||||
|
||||
static INLINE const int16_t *av1_get_interp_filter_subpel_kernel(
|
||||
const InterpFilterParams filter_params, const int subpel) {
|
||||
return filter_params.filter_ptr + filter_params.taps * subpel;
|
||||
}
|
||||
|
||||
static INLINE int av1_is_interpolating_filter(
|
||||
const InterpFilter interp_filter) {
|
||||
const InterpFilterParams ip = av1_get_interp_filter_params(interp_filter);
|
||||
return (ip.filter_ptr[ip.taps / 2 - 1] == 128);
|
||||
}
|
||||
|
||||
#if CONFIG_DUAL_FILTER
|
||||
InterpFilter av1_get_plane_interp_filter(InterpFilter interp_filter, int plane);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // AV1_COMMON_FILTER_H_
|
||||
79
third_party/aom/av1/common/frame_buffers.c
vendored
Normal file
79
third_party/aom/av1/common/frame_buffers.c
vendored
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* 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 "av1/common/frame_buffers.h"
|
||||
#include "aom_mem/aom_mem.h"
|
||||
|
||||
int av1_alloc_internal_frame_buffers(InternalFrameBufferList *list) {
|
||||
assert(list != NULL);
|
||||
av1_free_internal_frame_buffers(list);
|
||||
|
||||
list->num_internal_frame_buffers =
|
||||
AOM_MAXIMUM_REF_BUFFERS + AOM_MAXIMUM_WORK_BUFFERS;
|
||||
list->int_fb = (InternalFrameBuffer *)aom_calloc(
|
||||
list->num_internal_frame_buffers, sizeof(*list->int_fb));
|
||||
return (list->int_fb == NULL);
|
||||
}
|
||||
|
||||
void av1_free_internal_frame_buffers(InternalFrameBufferList *list) {
|
||||
int i;
|
||||
|
||||
assert(list != NULL);
|
||||
|
||||
for (i = 0; i < list->num_internal_frame_buffers; ++i) {
|
||||
aom_free(list->int_fb[i].data);
|
||||
list->int_fb[i].data = NULL;
|
||||
}
|
||||
aom_free(list->int_fb);
|
||||
list->int_fb = NULL;
|
||||
}
|
||||
|
||||
int av1_get_frame_buffer(void *cb_priv, size_t min_size,
|
||||
aom_codec_frame_buffer_t *fb) {
|
||||
int i;
|
||||
InternalFrameBufferList *const int_fb_list =
|
||||
(InternalFrameBufferList *)cb_priv;
|
||||
if (int_fb_list == NULL) return -1;
|
||||
|
||||
// Find a free frame buffer.
|
||||
for (i = 0; i < int_fb_list->num_internal_frame_buffers; ++i) {
|
||||
if (!int_fb_list->int_fb[i].in_use) break;
|
||||
}
|
||||
|
||||
if (i == int_fb_list->num_internal_frame_buffers) return -1;
|
||||
|
||||
if (int_fb_list->int_fb[i].size < min_size) {
|
||||
aom_free(int_fb_list->int_fb[i].data);
|
||||
// The data must be zeroed to fix a valgrind error from the C loop filter
|
||||
// due to access uninitialized memory in frame border. It could be
|
||||
// skipped if border were totally removed.
|
||||
int_fb_list->int_fb[i].data = (uint8_t *)aom_calloc(1, min_size);
|
||||
if (!int_fb_list->int_fb[i].data) return -1;
|
||||
int_fb_list->int_fb[i].size = min_size;
|
||||
}
|
||||
|
||||
fb->data = int_fb_list->int_fb[i].data;
|
||||
fb->size = int_fb_list->int_fb[i].size;
|
||||
int_fb_list->int_fb[i].in_use = 1;
|
||||
|
||||
// Set the frame buffer's private data to point at the internal frame buffer.
|
||||
fb->priv = &int_fb_list->int_fb[i];
|
||||
return 0;
|
||||
}
|
||||
|
||||
int av1_release_frame_buffer(void *cb_priv, aom_codec_frame_buffer_t *fb) {
|
||||
InternalFrameBuffer *const int_fb = (InternalFrameBuffer *)fb->priv;
|
||||
(void)cb_priv;
|
||||
if (int_fb) int_fb->in_use = 0;
|
||||
return 0;
|
||||
}
|
||||
54
third_party/aom/av1/common/frame_buffers.h
vendored
Normal file
54
third_party/aom/av1/common/frame_buffers.h
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* 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_COMMON_FRAME_BUFFERS_H_
|
||||
#define AV1_COMMON_FRAME_BUFFERS_H_
|
||||
|
||||
#include "aom/aom_frame_buffer.h"
|
||||
#include "aom/aom_integer.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct InternalFrameBuffer {
|
||||
uint8_t *data;
|
||||
size_t size;
|
||||
int in_use;
|
||||
} InternalFrameBuffer;
|
||||
|
||||
typedef struct InternalFrameBufferList {
|
||||
int num_internal_frame_buffers;
|
||||
InternalFrameBuffer *int_fb;
|
||||
} InternalFrameBufferList;
|
||||
|
||||
// Initializes |list|. Returns 0 on success.
|
||||
int av1_alloc_internal_frame_buffers(InternalFrameBufferList *list);
|
||||
|
||||
// Free any data allocated to the frame buffers.
|
||||
void av1_free_internal_frame_buffers(InternalFrameBufferList *list);
|
||||
|
||||
// Callback used by libaom to request an external frame buffer. |cb_priv|
|
||||
// Callback private data, which points to an InternalFrameBufferList.
|
||||
// |min_size| is the minimum size in bytes needed to decode the next frame.
|
||||
// |fb| pointer to the frame buffer.
|
||||
int av1_get_frame_buffer(void *cb_priv, size_t min_size,
|
||||
aom_codec_frame_buffer_t *fb);
|
||||
|
||||
// Callback used by libaom when there are no references to the frame buffer.
|
||||
// |cb_priv| is not used. |fb| pointer to the frame buffer.
|
||||
int av1_release_frame_buffer(void *cb_priv, aom_codec_frame_buffer_t *fb);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // AV1_COMMON_FRAME_BUFFERS_H_
|
||||
114
third_party/aom/av1/common/generic_code.c
vendored
Normal file
114
third_party/aom/av1/common/generic_code.c
vendored
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
* Copyright (c) 2001-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.
|
||||
*/
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "generic_code.h"
|
||||
|
||||
void aom_cdf_init_q15_1D(uint16_t *cdf, int nsyms, int cdf_size) {
|
||||
int i;
|
||||
for (i = 0; i < nsyms; i++)
|
||||
cdf[i] = AOM_ICDF((i + 1)*CDF_PROB_TOP/nsyms);
|
||||
|
||||
#if CONFIG_EC_ADAPT
|
||||
cdf[cdf_size - 1] = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Adapts a Q15 cdf after encoding/decoding a symbol. */
|
||||
void aom_cdf_adapt_q15(int val, uint16_t *cdf, int n, int *count, int rate) {
|
||||
int i;
|
||||
*count = OD_MINI(*count + 1, 1 << rate);
|
||||
OD_ASSERT(AOM_ICDF(cdf[n - 1]) == 32768);
|
||||
if (*count >= 1 << rate) {
|
||||
/* Steady-state adaptation based on a simple IIR with dyadic rate. */
|
||||
for (i = 0; i < n; i++) {
|
||||
int tmp;
|
||||
/* When (i < val), we want the adjustment ((cdf[i] - tmp) >> rate) to be
|
||||
positive so long as (cdf[i] > i + 1), and 0 when (cdf[i] == i + 1),
|
||||
to ensure we don't drive any probabilities to 0. Replacing cdf[i] with
|
||||
(i + 2) and solving ((i + 2 - tmp) >> rate == 1) for tmp produces
|
||||
tmp == i + 2 - (1 << rate). Using this value of tmp with
|
||||
cdf[i] == i + 1 instead gives an adjustment of 0 as desired.
|
||||
|
||||
When (i >= val), we want ((cdf[i] - tmp) >> rate) to be negative so
|
||||
long as cdf[i] < 32768 - (n - 1 - i), and 0 when
|
||||
cdf[i] == 32768 - (n - 1 - i), again to ensure we don't drive any
|
||||
probabilities to 0. Since right-shifting any negative value is still
|
||||
negative, we can solve (32768 - (n - 1 - i) - tmp == 0) for tmp,
|
||||
producing tmp = 32769 - n + i. Using this value of tmp with smaller
|
||||
values of cdf[i] instead gives negative adjustments, as desired.
|
||||
|
||||
Combining the two cases gives the expression below. These could be
|
||||
stored in a lookup table indexed by n and rate to avoid the
|
||||
arithmetic. */
|
||||
tmp = 2 - (1<<rate) + i + (32767 + (1<<rate) - n)*(i >= val);
|
||||
cdf[i] = AOM_ICDF(AOM_ICDF(cdf[i]) - ((AOM_ICDF(cdf[i]) - tmp) >> rate));
|
||||
}
|
||||
}
|
||||
else {
|
||||
int alpha;
|
||||
/* Initial adaptation for the first symbols. The adaptation rate is
|
||||
computed to be equivalent to what od_{en,de}code_cdf_adapt() does
|
||||
when the initial cdf is set to increment/4. */
|
||||
alpha = 4*32768/(n + 4**count);
|
||||
for (i = 0; i < n; i++) {
|
||||
int tmp;
|
||||
tmp = (32768 - n)*(i >= val) + i + 1;
|
||||
cdf[i] = AOM_ICDF(AOM_ICDF(cdf[i])
|
||||
- (((AOM_ICDF(cdf[i]) - tmp)*alpha) >> 15));
|
||||
}
|
||||
}
|
||||
OD_ASSERT(AOM_ICDF(cdf[n - 1]) == 32768);
|
||||
}
|
||||
|
||||
/** Takes the base-2 log of E(x) in Q1.
|
||||
*
|
||||
* @param [in] ExQ16 expectation of x in Q16
|
||||
*
|
||||
* @retval 2*log2(ExQ16/2^16)
|
||||
*/
|
||||
int log_ex(int ex_q16) {
|
||||
int lg;
|
||||
int lg_q1;
|
||||
int odd;
|
||||
lg = OD_ILOG(ex_q16);
|
||||
if (lg < 15) {
|
||||
odd = ex_q16*ex_q16 > 2 << 2*lg;
|
||||
}
|
||||
else {
|
||||
int tmp;
|
||||
tmp = ex_q16 >> (lg - 8);
|
||||
odd = tmp*tmp > (1 << 15);
|
||||
}
|
||||
lg_q1 = OD_MAXI(0, 2*lg - 33 + odd);
|
||||
return lg_q1;
|
||||
}
|
||||
|
||||
/** Updates the probability model based on the encoded/decoded value
|
||||
*
|
||||
* @param [in,out] model generic prob model
|
||||
* @param [in,out] ExQ16 expectation of x
|
||||
* @param [in] x variable encoded/decoded (used for ExQ16)
|
||||
* @param [in] xs variable x after shift (used for the model)
|
||||
* @param [in] id id of the icdf to adapt
|
||||
* @param [in] integration integration period of ExQ16 (leaky average over
|
||||
* 1<<integration samples)
|
||||
*/
|
||||
void generic_model_update(int *ex_q16, int x, int integration) {
|
||||
/* We could have saturated ExQ16 directly, but this is safe and simpler */
|
||||
x = OD_MINI(x, 32767);
|
||||
OD_IIR_DIADIC(*ex_q16, x << 16, integration);
|
||||
}
|
||||
81
third_party/aom/av1/common/generic_code.h
vendored
Normal file
81
third_party/aom/av1/common/generic_code.h
vendored
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Copyright (c) 2001-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.
|
||||
*/
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
#if !defined(_generic_code_H)
|
||||
# define _generic_code_H
|
||||
|
||||
# include "aom_dsp/bitreader.h"
|
||||
# include "aom_dsp/bitwriter.h"
|
||||
|
||||
# define GENERIC_TABLES 12
|
||||
|
||||
#define generic_decode(r, model, ex_q16, integration, ACCT_STR_NAME) \
|
||||
generic_decode_(r, model, ex_q16, integration ACCT_STR_ARG(ACCT_STR_NAME))
|
||||
#define aom_decode_cdf_adapt_q15(r, cdf, n, count, rate, ACCT_STR_NAME) \
|
||||
aom_decode_cdf_adapt_q15_(r, cdf, n, count, rate ACCT_STR_ARG(ACCT_STR_NAME))
|
||||
#define aom_decode_cdf_adapt(r, cdf, n, increment, ACCT_STR_NAME) \
|
||||
aom_decode_cdf_adapt_(r, cdf, n, increment ACCT_STR_ARG(ACCT_STR_NAME))
|
||||
|
||||
typedef struct {
|
||||
/** cdf for multiple expectations of x */
|
||||
uint16_t cdf[GENERIC_TABLES][CDF_SIZE(16)];
|
||||
} generic_encoder;
|
||||
|
||||
#define OD_IIR_DIADIC(y, x, shift) ((y) += ((x) - (y)) >> (shift))
|
||||
|
||||
void generic_model_init(generic_encoder *model);
|
||||
|
||||
/* Initialize a CDF for use by aom_write_symbol_pvq()/aom_read_symbol_pvq().
|
||||
This is used for CDFs whose size might not match the declared array size.
|
||||
The only real requirement is that the first value of every CDF be zero.
|
||||
Then aom_cdf_init_q15_1D() will be called with the real size the first time
|
||||
the CDF is used. */
|
||||
#define OD_CDFS_INIT_DYNAMIC(cdf) (memset(cdf, 0, sizeof(cdf)))
|
||||
|
||||
// WARNING: DO NOT USE this init function,
|
||||
// if the size of cdf is different from what is declared by code.
|
||||
#define OD_CDFS_INIT_Q15(cdfs) \
|
||||
{ int n_cdfs = sizeof(cdfs)/sizeof(cdfs[0]); \
|
||||
int cdf_size = sizeof(cdfs[0])/sizeof(cdfs[0][0]); \
|
||||
int nsyms = cdf_size - CONFIG_EC_ADAPT; \
|
||||
int i_; \
|
||||
for (i_ = 0; i_ < n_cdfs; i_++) \
|
||||
aom_cdf_init_q15_1D(cdfs[i_], nsyms, cdf_size); \
|
||||
}
|
||||
|
||||
void aom_cdf_init(uint16_t *cdf, int ncdfs, int nsyms, int val, int first);
|
||||
|
||||
void aom_cdf_init_q15_1D(uint16_t *cdf, int nsyms, int cdf_size);
|
||||
|
||||
void aom_cdf_adapt_q15(int val, uint16_t *cdf, int n, int *count, int rate);
|
||||
|
||||
void aom_encode_cdf_adapt_q15(aom_writer *w, int val, uint16_t *cdf, int n,
|
||||
int *count, int rate);
|
||||
|
||||
void generic_encode(aom_writer *w, generic_encoder *model, int x,
|
||||
int *ex_q16, int integration);
|
||||
double generic_encode_cost(generic_encoder *model, int x, int *ex_q16);
|
||||
|
||||
double od_encode_cdf_cost(int val, uint16_t *cdf, int n);
|
||||
|
||||
int aom_decode_cdf_adapt_q15_(aom_reader *r, uint16_t *cdf, int n,
|
||||
int *count, int rate ACCT_STR_PARAM);
|
||||
|
||||
int generic_decode_(aom_reader *r, generic_encoder *model,
|
||||
int *ex_q16, int integration ACCT_STR_PARAM);
|
||||
|
||||
int log_ex(int ex_q16);
|
||||
|
||||
void generic_model_update(int *ex_q16, int x, int integration);
|
||||
|
||||
#endif
|
||||
3067
third_party/aom/av1/common/idct.c
vendored
Normal file
3067
third_party/aom/av1/common/idct.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
99
third_party/aom/av1/common/idct.h
vendored
Normal file
99
third_party/aom/av1/common/idct.h
vendored
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* 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_COMMON_IDCT_H_
|
||||
#define AV1_COMMON_IDCT_H_
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "./aom_config.h"
|
||||
#include "av1/common/blockd.h"
|
||||
#include "av1/common/common.h"
|
||||
#include "av1/common/enums.h"
|
||||
#include "aom_dsp/inv_txfm.h"
|
||||
#include "aom_dsp/txfm_common.h"
|
||||
#include "aom_ports/mem.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct INV_TXFM_PARAM {
|
||||
#if CONFIG_ADAPT_SCAN
|
||||
const int16_t *eob_threshold;
|
||||
#endif
|
||||
TX_TYPE tx_type;
|
||||
TX_SIZE tx_size;
|
||||
int eob;
|
||||
int lossless;
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
int bd;
|
||||
#endif
|
||||
} INV_TXFM_PARAM;
|
||||
|
||||
typedef void (*transform_1d)(const tran_low_t *, tran_low_t *);
|
||||
|
||||
typedef struct {
|
||||
transform_1d cols, rows; // vertical and horizontal
|
||||
} transform_2d;
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
typedef void (*highbd_transform_1d)(const tran_low_t *, tran_low_t *,
|
||||
const int8_t *cos_bit,
|
||||
const int8_t *stage_range, int bd);
|
||||
|
||||
typedef struct {
|
||||
highbd_transform_1d cols, rows; // vertical and horizontal
|
||||
} highbd_transform_2d;
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
||||
#define MAX_TX_SCALE 1
|
||||
int av1_get_tx_scale(const TX_SIZE tx_size);
|
||||
|
||||
void av1_iwht4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
int eob);
|
||||
void av1_idct4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
int eob);
|
||||
|
||||
void av1_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
int eob, TX_TYPE tx_type, int lossless);
|
||||
void av1_inv_txfm_add_8x4(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
int eob, TX_TYPE tx_type);
|
||||
void av1_inv_txfm_add_4x8(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
int eob, TX_TYPE tx_type);
|
||||
void av1_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
INV_TXFM_PARAM *inv_txfm_param);
|
||||
void av1_inverse_transform_block(const MACROBLOCKD *xd,
|
||||
const tran_low_t *dqcoeff, TX_TYPE tx_type,
|
||||
TX_SIZE tx_size, uint8_t *dst, int stride,
|
||||
int eob);
|
||||
void av1_inverse_transform_block_facade(MACROBLOCKD *xd, int plane, int block,
|
||||
int blk_row, int blk_col, int eob);
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
void av1_highbd_iwht4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
int eob, int bd);
|
||||
void av1_highbd_idct4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
int eob, int bd);
|
||||
void av1_highbd_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest,
|
||||
int stride, int eob, int bd, TX_TYPE tx_type,
|
||||
int lossless);
|
||||
void av1_highbd_inv_txfm_add_4x8(const tran_low_t *input, uint8_t *dest,
|
||||
int stride, int eob, int bd, TX_TYPE tx_type);
|
||||
void av1_highbd_inv_txfm_add_8x4(const tran_low_t *input, uint8_t *dest,
|
||||
int stride, int eob, int bd, TX_TYPE tx_type);
|
||||
void av1_highbd_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride,
|
||||
INV_TXFM_PARAM *inv_txfm_param);
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // AV1_COMMON_IDCT_H_
|
||||
657
third_party/aom/av1/common/laplace_tables.c
vendored
Normal file
657
third_party/aom/av1/common/laplace_tables.c
vendored
Normal file
|
|
@ -0,0 +1,657 @@
|
|||
/* This file is auto-generated using "gen_laplace_tables 128 7" */
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "aom_dsp/prob.h"
|
||||
#include "pvq.h"
|
||||
|
||||
const uint16_t EXP_CDF_TABLE[128][16] = {
|
||||
{AOM_ICDF(32753), AOM_ICDF(32754), AOM_ICDF(32755), AOM_ICDF(32756),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(32499), AOM_ICDF(32753), AOM_ICDF(32755), AOM_ICDF(32756),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(32243), AOM_ICDF(32747), AOM_ICDF(32755), AOM_ICDF(32756),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(31987), AOM_ICDF(32737), AOM_ICDF(32755), AOM_ICDF(32756),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(31732), AOM_ICDF(32724), AOM_ICDF(32755), AOM_ICDF(32756),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(31476), AOM_ICDF(32706), AOM_ICDF(32754), AOM_ICDF(32756),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(31220), AOM_ICDF(32684), AOM_ICDF(32753), AOM_ICDF(32756),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(30964), AOM_ICDF(32658), AOM_ICDF(32751), AOM_ICDF(32756),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(30708), AOM_ICDF(32628), AOM_ICDF(32748), AOM_ICDF(32756),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(30452), AOM_ICDF(32594), AOM_ICDF(32745), AOM_ICDF(32756),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(30198), AOM_ICDF(32558), AOM_ICDF(32742), AOM_ICDF(32756),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(29941), AOM_ICDF(32515), AOM_ICDF(32736), AOM_ICDF(32755),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(29686), AOM_ICDF(32470), AOM_ICDF(32731), AOM_ICDF(32755),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(29429), AOM_ICDF(32419), AOM_ICDF(32723), AOM_ICDF(32754),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(29174), AOM_ICDF(32366), AOM_ICDF(32715), AOM_ICDF(32753),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(28918), AOM_ICDF(32308), AOM_ICDF(32705), AOM_ICDF(32752),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(28662), AOM_ICDF(32246), AOM_ICDF(32694), AOM_ICDF(32750),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(28406), AOM_ICDF(32180), AOM_ICDF(32681), AOM_ICDF(32748),
|
||||
AOM_ICDF(32757), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(28150), AOM_ICDF(32110), AOM_ICDF(32667), AOM_ICDF(32745),
|
||||
AOM_ICDF(32756), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(27894), AOM_ICDF(32036), AOM_ICDF(32651), AOM_ICDF(32742),
|
||||
AOM_ICDF(32756), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(27639), AOM_ICDF(31959), AOM_ICDF(32634), AOM_ICDF(32739),
|
||||
AOM_ICDF(32755), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(27383), AOM_ICDF(31877), AOM_ICDF(32614), AOM_ICDF(32735),
|
||||
AOM_ICDF(32755), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(27126), AOM_ICDF(31790), AOM_ICDF(32592), AOM_ICDF(32730),
|
||||
AOM_ICDF(32754), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(26871), AOM_ICDF(31701), AOM_ICDF(32569), AOM_ICDF(32725),
|
||||
AOM_ICDF(32753), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(26615), AOM_ICDF(31607), AOM_ICDF(32543), AOM_ICDF(32719),
|
||||
AOM_ICDF(32752), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(26361), AOM_ICDF(31511), AOM_ICDF(32517), AOM_ICDF(32713),
|
||||
AOM_ICDF(32751), AOM_ICDF(32758), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(26104), AOM_ICDF(31408), AOM_ICDF(32485), AOM_ICDF(32704),
|
||||
AOM_ICDF(32748), AOM_ICDF(32757), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(25848), AOM_ICDF(31302), AOM_ICDF(32452), AOM_ICDF(32695),
|
||||
AOM_ICDF(32746), AOM_ICDF(32757), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(25591), AOM_ICDF(31191), AOM_ICDF(32416), AOM_ICDF(32684),
|
||||
AOM_ICDF(32743), AOM_ICDF(32756), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(25336), AOM_ICDF(31078), AOM_ICDF(32379), AOM_ICDF(32674),
|
||||
AOM_ICDF(32741), AOM_ICDF(32756), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(25080), AOM_ICDF(30960), AOM_ICDF(32338), AOM_ICDF(32661),
|
||||
AOM_ICDF(32737), AOM_ICDF(32755), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(24824), AOM_ICDF(30838), AOM_ICDF(32295), AOM_ICDF(32648),
|
||||
AOM_ICDF(32733), AOM_ICDF(32754), AOM_ICDF(32759), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(24568), AOM_ICDF(30712), AOM_ICDF(32248), AOM_ICDF(32632),
|
||||
AOM_ICDF(32728), AOM_ICDF(32752), AOM_ICDF(32758), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(24313), AOM_ICDF(30583), AOM_ICDF(32199), AOM_ICDF(32616),
|
||||
AOM_ICDF(32723), AOM_ICDF(32751), AOM_ICDF(32758), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(24057), AOM_ICDF(30449), AOM_ICDF(32147), AOM_ICDF(32598),
|
||||
AOM_ICDF(32718), AOM_ICDF(32750), AOM_ICDF(32758), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(23801), AOM_ICDF(30311), AOM_ICDF(32091), AOM_ICDF(32578),
|
||||
AOM_ICDF(32711), AOM_ICDF(32747), AOM_ICDF(32757), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(23546), AOM_ICDF(30170), AOM_ICDF(32033), AOM_ICDF(32557),
|
||||
AOM_ICDF(32704), AOM_ICDF(32745), AOM_ICDF(32757), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(23288), AOM_ICDF(30022), AOM_ICDF(31969), AOM_ICDF(32532),
|
||||
AOM_ICDF(32695), AOM_ICDF(32742), AOM_ICDF(32756), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(23033), AOM_ICDF(29873), AOM_ICDF(31904), AOM_ICDF(32507),
|
||||
AOM_ICDF(32686), AOM_ICDF(32739), AOM_ICDF(32755), AOM_ICDF(32760),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(22778), AOM_ICDF(29720), AOM_ICDF(31835), AOM_ICDF(32479),
|
||||
AOM_ICDF(32675), AOM_ICDF(32735), AOM_ICDF(32753), AOM_ICDF(32759),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(22521), AOM_ICDF(29561), AOM_ICDF(31761), AOM_ICDF(32449),
|
||||
AOM_ICDF(32664), AOM_ICDF(32731), AOM_ICDF(32752), AOM_ICDF(32759),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(22267), AOM_ICDF(29401), AOM_ICDF(31686), AOM_ICDF(32418),
|
||||
AOM_ICDF(32652), AOM_ICDF(32727), AOM_ICDF(32751), AOM_ICDF(32759),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(22011), AOM_ICDF(29235), AOM_ICDF(31605), AOM_ICDF(32383),
|
||||
AOM_ICDF(32638), AOM_ICDF(32722), AOM_ICDF(32749), AOM_ICDF(32758),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(21754), AOM_ICDF(29064), AOM_ICDF(31520), AOM_ICDF(32345),
|
||||
AOM_ICDF(32622), AOM_ICDF(32715), AOM_ICDF(32746), AOM_ICDF(32757),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(21501), AOM_ICDF(28893), AOM_ICDF(31434), AOM_ICDF(32307),
|
||||
AOM_ICDF(32607), AOM_ICDF(32710), AOM_ICDF(32745), AOM_ICDF(32757),
|
||||
AOM_ICDF(32761), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(21243), AOM_ICDF(28713), AOM_ICDF(31339), AOM_ICDF(32262),
|
||||
AOM_ICDF(32587), AOM_ICDF(32701), AOM_ICDF(32741), AOM_ICDF(32755),
|
||||
AOM_ICDF(32760), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(20988), AOM_ICDF(28532), AOM_ICDF(31243), AOM_ICDF(32217),
|
||||
AOM_ICDF(32567), AOM_ICDF(32693), AOM_ICDF(32738), AOM_ICDF(32754),
|
||||
AOM_ICDF(32760), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(20730), AOM_ICDF(28344), AOM_ICDF(31140), AOM_ICDF(32167),
|
||||
AOM_ICDF(32544), AOM_ICDF(32682), AOM_ICDF(32733), AOM_ICDF(32752),
|
||||
AOM_ICDF(32759), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(20476), AOM_ICDF(28156), AOM_ICDF(31036), AOM_ICDF(32116),
|
||||
AOM_ICDF(32521), AOM_ICDF(32673), AOM_ICDF(32730), AOM_ICDF(32751),
|
||||
AOM_ICDF(32759), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(20220), AOM_ICDF(27962), AOM_ICDF(30926), AOM_ICDF(32061),
|
||||
AOM_ICDF(32495), AOM_ICDF(32661), AOM_ICDF(32725), AOM_ICDF(32749),
|
||||
AOM_ICDF(32758), AOM_ICDF(32762), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(19963), AOM_ICDF(27763), AOM_ICDF(30810), AOM_ICDF(32000),
|
||||
AOM_ICDF(32465), AOM_ICDF(32647), AOM_ICDF(32718), AOM_ICDF(32746),
|
||||
AOM_ICDF(32757), AOM_ICDF(32761), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(19708), AOM_ICDF(27562), AOM_ICDF(30691), AOM_ICDF(31938),
|
||||
AOM_ICDF(32435), AOM_ICDF(32633), AOM_ICDF(32712), AOM_ICDF(32743),
|
||||
AOM_ICDF(32756), AOM_ICDF(32761), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(19454), AOM_ICDF(27358), AOM_ICDF(30569), AOM_ICDF(31873),
|
||||
AOM_ICDF(32403), AOM_ICDF(32618), AOM_ICDF(32705), AOM_ICDF(32741),
|
||||
AOM_ICDF(32755), AOM_ICDF(32761), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(19196), AOM_ICDF(27146), AOM_ICDF(30438), AOM_ICDF(31801),
|
||||
AOM_ICDF(32365), AOM_ICDF(32599), AOM_ICDF(32696), AOM_ICDF(32736),
|
||||
AOM_ICDF(32753), AOM_ICDF(32760), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(18942), AOM_ICDF(26934), AOM_ICDF(30306), AOM_ICDF(31728),
|
||||
AOM_ICDF(32328), AOM_ICDF(32581), AOM_ICDF(32688), AOM_ICDF(32733),
|
||||
AOM_ICDF(32752), AOM_ICDF(32760), AOM_ICDF(32763), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(18684), AOM_ICDF(26714), AOM_ICDF(30164), AOM_ICDF(31647),
|
||||
AOM_ICDF(32284), AOM_ICDF(32558), AOM_ICDF(32676), AOM_ICDF(32727),
|
||||
AOM_ICDF(32749), AOM_ICDF(32758), AOM_ICDF(32762), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(18429), AOM_ICDF(26493), AOM_ICDF(30021), AOM_ICDF(31565),
|
||||
AOM_ICDF(32240), AOM_ICDF(32535), AOM_ICDF(32664), AOM_ICDF(32721),
|
||||
AOM_ICDF(32746), AOM_ICDF(32757), AOM_ICDF(32762), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(18174), AOM_ICDF(26268), AOM_ICDF(29872), AOM_ICDF(31477),
|
||||
AOM_ICDF(32192), AOM_ICDF(32510), AOM_ICDF(32652), AOM_ICDF(32715),
|
||||
AOM_ICDF(32743), AOM_ICDF(32756), AOM_ICDF(32762), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(17920), AOM_ICDF(26040), AOM_ICDF(29719), AOM_ICDF(31386),
|
||||
AOM_ICDF(32141), AOM_ICDF(32483), AOM_ICDF(32638), AOM_ICDF(32708),
|
||||
AOM_ICDF(32740), AOM_ICDF(32754), AOM_ICDF(32761), AOM_ICDF(32764),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(17661), AOM_ICDF(25803), AOM_ICDF(29556), AOM_ICDF(31286),
|
||||
AOM_ICDF(32083), AOM_ICDF(32451), AOM_ICDF(32620), AOM_ICDF(32698),
|
||||
AOM_ICDF(32734), AOM_ICDF(32751), AOM_ICDF(32759), AOM_ICDF(32763),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(17406), AOM_ICDF(25566), AOM_ICDF(29391), AOM_ICDF(31184),
|
||||
AOM_ICDF(32024), AOM_ICDF(32418), AOM_ICDF(32603), AOM_ICDF(32690),
|
||||
AOM_ICDF(32731), AOM_ICDF(32750), AOM_ICDF(32759), AOM_ICDF(32763),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(17151), AOM_ICDF(25325), AOM_ICDF(29220), AOM_ICDF(31076),
|
||||
AOM_ICDF(31961), AOM_ICDF(32383), AOM_ICDF(32584), AOM_ICDF(32680),
|
||||
AOM_ICDF(32726), AOM_ICDF(32748), AOM_ICDF(32758), AOM_ICDF(32763),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(16896), AOM_ICDF(25080), AOM_ICDF(29044), AOM_ICDF(30964),
|
||||
AOM_ICDF(31894), AOM_ICDF(32344), AOM_ICDF(32562), AOM_ICDF(32668),
|
||||
AOM_ICDF(32719), AOM_ICDF(32744), AOM_ICDF(32756), AOM_ICDF(32762),
|
||||
AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(16639), AOM_ICDF(24829), AOM_ICDF(28860), AOM_ICDF(30844),
|
||||
AOM_ICDF(31821), AOM_ICDF(32302), AOM_ICDF(32539), AOM_ICDF(32655),
|
||||
AOM_ICDF(32712), AOM_ICDF(32740), AOM_ICDF(32754), AOM_ICDF(32761),
|
||||
AOM_ICDF(32764), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(28672), AOM_ICDF(30720),
|
||||
AOM_ICDF(31744), AOM_ICDF(32256), AOM_ICDF(32512), AOM_ICDF(32640),
|
||||
AOM_ICDF(32704), AOM_ICDF(32736), AOM_ICDF(32752), AOM_ICDF(32760),
|
||||
AOM_ICDF(32764), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(16130), AOM_ICDF(24320), AOM_ICDF(28479), AOM_ICDF(30591),
|
||||
AOM_ICDF(31663), AOM_ICDF(32208), AOM_ICDF(32485), AOM_ICDF(32625),
|
||||
AOM_ICDF(32696), AOM_ICDF(32732), AOM_ICDF(32750), AOM_ICDF(32759),
|
||||
AOM_ICDF(32764), AOM_ICDF(32766), AOM_ICDF(32767), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(15872), AOM_ICDF(24056), AOM_ICDF(28276), AOM_ICDF(30452),
|
||||
AOM_ICDF(31574), AOM_ICDF(32152), AOM_ICDF(32450), AOM_ICDF(32604),
|
||||
AOM_ICDF(32683), AOM_ICDF(32724), AOM_ICDF(32745), AOM_ICDF(32756),
|
||||
AOM_ICDF(32762), AOM_ICDF(32765), AOM_ICDF(32766), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(15615), AOM_ICDF(23789), AOM_ICDF(28068), AOM_ICDF(30308),
|
||||
AOM_ICDF(31480), AOM_ICDF(32094), AOM_ICDF(32415), AOM_ICDF(32583),
|
||||
AOM_ICDF(32671), AOM_ICDF(32717), AOM_ICDF(32741), AOM_ICDF(32754),
|
||||
AOM_ICDF(32761), AOM_ICDF(32764), AOM_ICDF(32766), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(15361), AOM_ICDF(23521), AOM_ICDF(27856), AOM_ICDF(30159),
|
||||
AOM_ICDF(31382), AOM_ICDF(32032), AOM_ICDF(32377), AOM_ICDF(32560),
|
||||
AOM_ICDF(32657), AOM_ICDF(32709), AOM_ICDF(32737), AOM_ICDF(32752),
|
||||
AOM_ICDF(32760), AOM_ICDF(32764), AOM_ICDF(32766), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(15103), AOM_ICDF(23245), AOM_ICDF(27634), AOM_ICDF(30000),
|
||||
AOM_ICDF(31275), AOM_ICDF(31963), AOM_ICDF(32334), AOM_ICDF(32534),
|
||||
AOM_ICDF(32642), AOM_ICDF(32700), AOM_ICDF(32731), AOM_ICDF(32748),
|
||||
AOM_ICDF(32757), AOM_ICDF(32762), AOM_ICDF(32765), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(14848), AOM_ICDF(22968), AOM_ICDF(27409), AOM_ICDF(29837),
|
||||
AOM_ICDF(31165), AOM_ICDF(31891), AOM_ICDF(32288), AOM_ICDF(32505),
|
||||
AOM_ICDF(32624), AOM_ICDF(32689), AOM_ICDF(32725), AOM_ICDF(32744),
|
||||
AOM_ICDF(32755), AOM_ICDF(32761), AOM_ICDF(32764), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(14592), AOM_ICDF(22686), AOM_ICDF(27176), AOM_ICDF(29666),
|
||||
AOM_ICDF(31047), AOM_ICDF(31813), AOM_ICDF(32238), AOM_ICDF(32474),
|
||||
AOM_ICDF(32605), AOM_ICDF(32678), AOM_ICDF(32718), AOM_ICDF(32740),
|
||||
AOM_ICDF(32752), AOM_ICDF(32759), AOM_ICDF(32763), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(14336), AOM_ICDF(22400), AOM_ICDF(26936), AOM_ICDF(29488),
|
||||
AOM_ICDF(30923), AOM_ICDF(31730), AOM_ICDF(32184), AOM_ICDF(32439),
|
||||
AOM_ICDF(32583), AOM_ICDF(32664), AOM_ICDF(32709), AOM_ICDF(32735),
|
||||
AOM_ICDF(32749), AOM_ICDF(32757), AOM_ICDF(32762), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(14079), AOM_ICDF(22109), AOM_ICDF(26689), AOM_ICDF(29301),
|
||||
AOM_ICDF(30791), AOM_ICDF(31641), AOM_ICDF(32125), AOM_ICDF(32401),
|
||||
AOM_ICDF(32559), AOM_ICDF(32649), AOM_ICDF(32700), AOM_ICDF(32729),
|
||||
AOM_ICDF(32746), AOM_ICDF(32756), AOM_ICDF(32761), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(13825), AOM_ICDF(21817), AOM_ICDF(26437), AOM_ICDF(29108),
|
||||
AOM_ICDF(30652), AOM_ICDF(31545), AOM_ICDF(32061), AOM_ICDF(32359),
|
||||
AOM_ICDF(32532), AOM_ICDF(32632), AOM_ICDF(32690), AOM_ICDF(32723),
|
||||
AOM_ICDF(32742), AOM_ICDF(32753), AOM_ICDF(32759), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(13568), AOM_ICDF(21518), AOM_ICDF(26176), AOM_ICDF(28905),
|
||||
AOM_ICDF(30504), AOM_ICDF(31441), AOM_ICDF(31990), AOM_ICDF(32312),
|
||||
AOM_ICDF(32501), AOM_ICDF(32611), AOM_ICDF(32676), AOM_ICDF(32714),
|
||||
AOM_ICDF(32736), AOM_ICDF(32749), AOM_ICDF(32757), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(13314), AOM_ICDF(21218), AOM_ICDF(25911), AOM_ICDF(28697),
|
||||
AOM_ICDF(30351), AOM_ICDF(31333), AOM_ICDF(31916), AOM_ICDF(32262),
|
||||
AOM_ICDF(32468), AOM_ICDF(32590), AOM_ICDF(32662), AOM_ICDF(32705),
|
||||
AOM_ICDF(32731), AOM_ICDF(32746), AOM_ICDF(32755), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(13054), AOM_ICDF(20908), AOM_ICDF(25633), AOM_ICDF(28475),
|
||||
AOM_ICDF(30185), AOM_ICDF(31214), AOM_ICDF(31833), AOM_ICDF(32205),
|
||||
AOM_ICDF(32429), AOM_ICDF(32564), AOM_ICDF(32645), AOM_ICDF(32694),
|
||||
AOM_ICDF(32723), AOM_ICDF(32741), AOM_ICDF(32752), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(12803), AOM_ICDF(20603), AOM_ICDF(25356), AOM_ICDF(28252),
|
||||
AOM_ICDF(30017), AOM_ICDF(31093), AOM_ICDF(31748), AOM_ICDF(32147),
|
||||
AOM_ICDF(32390), AOM_ICDF(32538), AOM_ICDF(32628), AOM_ICDF(32683),
|
||||
AOM_ICDF(32717), AOM_ICDF(32737), AOM_ICDF(32749), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(12544), AOM_ICDF(20286), AOM_ICDF(25064), AOM_ICDF(28013),
|
||||
AOM_ICDF(29833), AOM_ICDF(30956), AOM_ICDF(31649), AOM_ICDF(32077),
|
||||
AOM_ICDF(32341), AOM_ICDF(32504), AOM_ICDF(32605), AOM_ICDF(32667),
|
||||
AOM_ICDF(32705), AOM_ICDF(32729), AOM_ICDF(32744), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(12288), AOM_ICDF(19968), AOM_ICDF(24768), AOM_ICDF(27768),
|
||||
AOM_ICDF(29643), AOM_ICDF(30815), AOM_ICDF(31547), AOM_ICDF(32005),
|
||||
AOM_ICDF(32291), AOM_ICDF(32470), AOM_ICDF(32582), AOM_ICDF(32652),
|
||||
AOM_ICDF(32696), AOM_ICDF(32723), AOM_ICDF(32740), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(12033), AOM_ICDF(19647), AOM_ICDF(24465), AOM_ICDF(27514),
|
||||
AOM_ICDF(29443), AOM_ICDF(30664), AOM_ICDF(31437), AOM_ICDF(31926),
|
||||
AOM_ICDF(32235), AOM_ICDF(32431), AOM_ICDF(32555), AOM_ICDF(32633),
|
||||
AOM_ICDF(32683), AOM_ICDF(32714), AOM_ICDF(32734), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(11777), AOM_ICDF(19321), AOM_ICDF(24154), AOM_ICDF(27250),
|
||||
AOM_ICDF(29233), AOM_ICDF(30504), AOM_ICDF(31318), AOM_ICDF(31839),
|
||||
AOM_ICDF(32173), AOM_ICDF(32387), AOM_ICDF(32524), AOM_ICDF(32612),
|
||||
AOM_ICDF(32668), AOM_ICDF(32704), AOM_ICDF(32727), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(11521), AOM_ICDF(18991), AOM_ICDF(23835), AOM_ICDF(26976),
|
||||
AOM_ICDF(29013), AOM_ICDF(30334), AOM_ICDF(31190), AOM_ICDF(31745),
|
||||
AOM_ICDF(32105), AOM_ICDF(32338), AOM_ICDF(32489), AOM_ICDF(32587),
|
||||
AOM_ICDF(32651), AOM_ICDF(32692), AOM_ICDF(32719), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(11265), AOM_ICDF(18657), AOM_ICDF(23508), AOM_ICDF(26691),
|
||||
AOM_ICDF(28780), AOM_ICDF(30151), AOM_ICDF(31051), AOM_ICDF(31641),
|
||||
AOM_ICDF(32028), AOM_ICDF(32282), AOM_ICDF(32449), AOM_ICDF(32559),
|
||||
AOM_ICDF(32631), AOM_ICDF(32678), AOM_ICDF(32709), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(11006), AOM_ICDF(18316), AOM_ICDF(23170), AOM_ICDF(26394),
|
||||
AOM_ICDF(28535), AOM_ICDF(29957), AOM_ICDF(30901), AOM_ICDF(31528),
|
||||
AOM_ICDF(31944), AOM_ICDF(32220), AOM_ICDF(32404), AOM_ICDF(32526),
|
||||
AOM_ICDF(32607), AOM_ICDF(32661), AOM_ICDF(32697), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(10752), AOM_ICDF(17976), AOM_ICDF(22830), AOM_ICDF(26091),
|
||||
AOM_ICDF(28282), AOM_ICDF(29754), AOM_ICDF(30743), AOM_ICDF(31408),
|
||||
AOM_ICDF(31854), AOM_ICDF(32154), AOM_ICDF(32356), AOM_ICDF(32491),
|
||||
AOM_ICDF(32582), AOM_ICDF(32643), AOM_ICDF(32684), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(10496), AOM_ICDF(17630), AOM_ICDF(22479), AOM_ICDF(25775),
|
||||
AOM_ICDF(28015), AOM_ICDF(29538), AOM_ICDF(30573), AOM_ICDF(31276),
|
||||
AOM_ICDF(31754), AOM_ICDF(32079), AOM_ICDF(32300), AOM_ICDF(32450),
|
||||
AOM_ICDF(32552), AOM_ICDF(32621), AOM_ICDF(32668), AOM_ICDF(32768)},
|
||||
{AOM_ICDF(10240), AOM_ICDF(17280), AOM_ICDF(22120), AOM_ICDF(25448),
|
||||
AOM_ICDF(27736), AOM_ICDF(29309), AOM_ICDF(30390), AOM_ICDF(31133),
|
||||
AOM_ICDF(31644), AOM_ICDF(31995), AOM_ICDF(32237), AOM_ICDF(32403),
|
||||
AOM_ICDF(32517), AOM_ICDF(32595), AOM_ICDF(32649), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(9984), AOM_ICDF(16926), AOM_ICDF(21753), AOM_ICDF(25109),
|
||||
AOM_ICDF(27443), AOM_ICDF(29066), AOM_ICDF(30194), AOM_ICDF(30978),
|
||||
AOM_ICDF(31523), AOM_ICDF(31902), AOM_ICDF(32166), AOM_ICDF(32349),
|
||||
AOM_ICDF(32476), AOM_ICDF(32565), AOM_ICDF(32627), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(9728), AOM_ICDF(16568), AOM_ICDF(21377), AOM_ICDF(24759),
|
||||
AOM_ICDF(27137), AOM_ICDF(28809), AOM_ICDF(29984), AOM_ICDF(30811),
|
||||
AOM_ICDF(31392), AOM_ICDF(31801), AOM_ICDF(32088), AOM_ICDF(32290),
|
||||
AOM_ICDF(32432), AOM_ICDF(32532), AOM_ICDF(32602), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(9474), AOM_ICDF(16208), AOM_ICDF(20995), AOM_ICDF(24399),
|
||||
AOM_ICDF(26819), AOM_ICDF(28539), AOM_ICDF(29762), AOM_ICDF(30631),
|
||||
AOM_ICDF(31249), AOM_ICDF(31688), AOM_ICDF(32000), AOM_ICDF(32222),
|
||||
AOM_ICDF(32380), AOM_ICDF(32492), AOM_ICDF(32572), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(9216), AOM_ICDF(15840), AOM_ICDF(20601), AOM_ICDF(24023),
|
||||
AOM_ICDF(26483), AOM_ICDF(28251), AOM_ICDF(29522), AOM_ICDF(30435),
|
||||
AOM_ICDF(31091), AOM_ICDF(31563), AOM_ICDF(31902), AOM_ICDF(32146),
|
||||
AOM_ICDF(32321), AOM_ICDF(32447), AOM_ICDF(32537), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(8959), AOM_ICDF(15469), AOM_ICDF(20199), AOM_ICDF(23636),
|
||||
AOM_ICDF(26133), AOM_ICDF(27947), AOM_ICDF(29265), AOM_ICDF(30223),
|
||||
AOM_ICDF(30919), AOM_ICDF(31425), AOM_ICDF(31792), AOM_ICDF(32059),
|
||||
AOM_ICDF(32253), AOM_ICDF(32394), AOM_ICDF(32496), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(8705), AOM_ICDF(15097), AOM_ICDF(19791), AOM_ICDF(23238),
|
||||
AOM_ICDF(25770), AOM_ICDF(27629), AOM_ICDF(28994), AOM_ICDF(29997),
|
||||
AOM_ICDF(30733), AOM_ICDF(31274), AOM_ICDF(31671), AOM_ICDF(31963),
|
||||
AOM_ICDF(32177), AOM_ICDF(32334), AOM_ICDF(32449), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(8449), AOM_ICDF(14719), AOM_ICDF(19373), AOM_ICDF(22827),
|
||||
AOM_ICDF(25390), AOM_ICDF(27292), AOM_ICDF(28704), AOM_ICDF(29752),
|
||||
AOM_ICDF(30530), AOM_ICDF(31107), AOM_ICDF(31535), AOM_ICDF(31853),
|
||||
AOM_ICDF(32089), AOM_ICDF(32264), AOM_ICDF(32394), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(8192), AOM_ICDF(14336), AOM_ICDF(18944), AOM_ICDF(22400),
|
||||
AOM_ICDF(24992), AOM_ICDF(26936), AOM_ICDF(28394), AOM_ICDF(29488),
|
||||
AOM_ICDF(30308), AOM_ICDF(30923), AOM_ICDF(31384), AOM_ICDF(31730),
|
||||
AOM_ICDF(31989), AOM_ICDF(32184), AOM_ICDF(32330), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(7936), AOM_ICDF(13950), AOM_ICDF(18507), AOM_ICDF(21961),
|
||||
AOM_ICDF(24578), AOM_ICDF(26561), AOM_ICDF(28064), AOM_ICDF(29203),
|
||||
AOM_ICDF(30066), AOM_ICDF(30720), AOM_ICDF(31216), AOM_ICDF(31592),
|
||||
AOM_ICDF(31877), AOM_ICDF(32093), AOM_ICDF(32256), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(7678), AOM_ICDF(13558), AOM_ICDF(18060), AOM_ICDF(21507),
|
||||
AOM_ICDF(24146), AOM_ICDF(26166), AOM_ICDF(27713), AOM_ICDF(28897),
|
||||
AOM_ICDF(29804), AOM_ICDF(30498), AOM_ICDF(31030), AOM_ICDF(31437),
|
||||
AOM_ICDF(31749), AOM_ICDF(31988), AOM_ICDF(32171), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(7423), AOM_ICDF(13165), AOM_ICDF(17606), AOM_ICDF(21041),
|
||||
AOM_ICDF(23698), AOM_ICDF(25753), AOM_ICDF(27342), AOM_ICDF(28571),
|
||||
AOM_ICDF(29522), AOM_ICDF(30257), AOM_ICDF(30826), AOM_ICDF(31266),
|
||||
AOM_ICDF(31606), AOM_ICDF(31869), AOM_ICDF(32073), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(7168), AOM_ICDF(12768), AOM_ICDF(17143), AOM_ICDF(20561),
|
||||
AOM_ICDF(23231), AOM_ICDF(25317), AOM_ICDF(26947), AOM_ICDF(28220),
|
||||
AOM_ICDF(29215), AOM_ICDF(29992), AOM_ICDF(30599), AOM_ICDF(31073),
|
||||
AOM_ICDF(31444), AOM_ICDF(31734), AOM_ICDF(31960), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(6911), AOM_ICDF(12365), AOM_ICDF(16669), AOM_ICDF(20065),
|
||||
AOM_ICDF(22744), AOM_ICDF(24858), AOM_ICDF(26526), AOM_ICDF(27842),
|
||||
AOM_ICDF(28881), AOM_ICDF(29701), AOM_ICDF(30348), AOM_ICDF(30858),
|
||||
AOM_ICDF(31261), AOM_ICDF(31579), AOM_ICDF(31830), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(6657), AOM_ICDF(11961), AOM_ICDF(16188), AOM_ICDF(19556),
|
||||
AOM_ICDF(22240), AOM_ICDF(24379), AOM_ICDF(26083), AOM_ICDF(27441),
|
||||
AOM_ICDF(28523), AOM_ICDF(29385), AOM_ICDF(30072), AOM_ICDF(30620),
|
||||
AOM_ICDF(31056), AOM_ICDF(31404), AOM_ICDF(31681), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(6400), AOM_ICDF(11550), AOM_ICDF(15694), AOM_ICDF(19029),
|
||||
AOM_ICDF(21712), AOM_ICDF(23871), AOM_ICDF(25609), AOM_ICDF(27007),
|
||||
AOM_ICDF(28132), AOM_ICDF(29037), AOM_ICDF(29766), AOM_ICDF(30352),
|
||||
AOM_ICDF(30824), AOM_ICDF(31204), AOM_ICDF(31509), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(6142), AOM_ICDF(11134), AOM_ICDF(15190), AOM_ICDF(18486),
|
||||
AOM_ICDF(21164), AOM_ICDF(23340), AOM_ICDF(25108), AOM_ICDF(26544),
|
||||
AOM_ICDF(27711), AOM_ICDF(28659), AOM_ICDF(29429), AOM_ICDF(30055),
|
||||
AOM_ICDF(30564), AOM_ICDF(30977), AOM_ICDF(31313), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(5890), AOM_ICDF(10720), AOM_ICDF(14682), AOM_ICDF(17932),
|
||||
AOM_ICDF(20598), AOM_ICDF(22785), AOM_ICDF(24579), AOM_ICDF(26051),
|
||||
AOM_ICDF(27258), AOM_ICDF(28248), AOM_ICDF(29060), AOM_ICDF(29726),
|
||||
AOM_ICDF(30273), AOM_ICDF(30721), AOM_ICDF(31089), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(5631), AOM_ICDF(10295), AOM_ICDF(14157), AOM_ICDF(17356),
|
||||
AOM_ICDF(20005), AOM_ICDF(22199), AOM_ICDF(24016), AOM_ICDF(25520),
|
||||
AOM_ICDF(26766), AOM_ICDF(27798), AOM_ICDF(28652), AOM_ICDF(29359),
|
||||
AOM_ICDF(29945), AOM_ICDF(30430), AOM_ICDF(30832), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(5377), AOM_ICDF(9871), AOM_ICDF(13628), AOM_ICDF(16768),
|
||||
AOM_ICDF(19393), AOM_ICDF(21587), AOM_ICDF(23421), AOM_ICDF(24954),
|
||||
AOM_ICDF(26236), AOM_ICDF(27308), AOM_ICDF(28204), AOM_ICDF(28953),
|
||||
AOM_ICDF(29579), AOM_ICDF(30102), AOM_ICDF(30539), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(5121), AOM_ICDF(9441), AOM_ICDF(13086), AOM_ICDF(16161),
|
||||
AOM_ICDF(18756), AOM_ICDF(20945), AOM_ICDF(22792), AOM_ICDF(24351),
|
||||
AOM_ICDF(25666), AOM_ICDF(26776), AOM_ICDF(27712), AOM_ICDF(28502),
|
||||
AOM_ICDF(29169), AOM_ICDF(29731), AOM_ICDF(30206), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(4865), AOM_ICDF(9007), AOM_ICDF(12534), AOM_ICDF(15538),
|
||||
AOM_ICDF(18096), AOM_ICDF(20274), AOM_ICDF(22129), AOM_ICDF(23708),
|
||||
AOM_ICDF(25053), AOM_ICDF(26198), AOM_ICDF(27173), AOM_ICDF(28004),
|
||||
AOM_ICDF(28711), AOM_ICDF(29313), AOM_ICDF(29826), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(4608), AOM_ICDF(8568), AOM_ICDF(11971), AOM_ICDF(14896),
|
||||
AOM_ICDF(17409), AOM_ICDF(19569), AOM_ICDF(21425), AOM_ICDF(23020),
|
||||
AOM_ICDF(24391), AOM_ICDF(25569), AOM_ICDF(26581), AOM_ICDF(27451),
|
||||
AOM_ICDF(28199), AOM_ICDF(28842), AOM_ICDF(29394), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(4351), AOM_ICDF(8125), AOM_ICDF(11398), AOM_ICDF(14236),
|
||||
AOM_ICDF(16697), AOM_ICDF(18831), AOM_ICDF(20682), AOM_ICDF(22287),
|
||||
AOM_ICDF(23679), AOM_ICDF(24886), AOM_ICDF(25933), AOM_ICDF(26841),
|
||||
AOM_ICDF(27628), AOM_ICDF(28311), AOM_ICDF(28903), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(4096), AOM_ICDF(7680), AOM_ICDF(10816), AOM_ICDF(13560),
|
||||
AOM_ICDF(15961), AOM_ICDF(18062), AOM_ICDF(19900), AOM_ICDF(21508),
|
||||
AOM_ICDF(22915), AOM_ICDF(24146), AOM_ICDF(25224), AOM_ICDF(26167),
|
||||
AOM_ICDF(26992), AOM_ICDF(27714), AOM_ICDF(28346), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(3840), AOM_ICDF(7230), AOM_ICDF(10223), AOM_ICDF(12865),
|
||||
AOM_ICDF(15197), AOM_ICDF(17256), AOM_ICDF(19074), AOM_ICDF(20679),
|
||||
AOM_ICDF(22096), AOM_ICDF(23347), AOM_ICDF(24451), AOM_ICDF(25426),
|
||||
AOM_ICDF(26287), AOM_ICDF(27047), AOM_ICDF(27718), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(3584), AOM_ICDF(6776), AOM_ICDF(9619), AOM_ICDF(12151),
|
||||
AOM_ICDF(14406), AOM_ICDF(16414), AOM_ICDF(18203), AOM_ICDF(19796),
|
||||
AOM_ICDF(21215), AOM_ICDF(22479), AOM_ICDF(23604), AOM_ICDF(24606),
|
||||
AOM_ICDF(25499), AOM_ICDF(26294), AOM_ICDF(27002), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(3328), AOM_ICDF(6318), AOM_ICDF(9004), AOM_ICDF(11417),
|
||||
AOM_ICDF(13585), AOM_ICDF(15533), AOM_ICDF(17283), AOM_ICDF(18856),
|
||||
AOM_ICDF(20269), AOM_ICDF(21538), AOM_ICDF(22678), AOM_ICDF(23703),
|
||||
AOM_ICDF(24624), AOM_ICDF(25451), AOM_ICDF(26194), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(3072), AOM_ICDF(5856), AOM_ICDF(8379), AOM_ICDF(10665),
|
||||
AOM_ICDF(12737), AOM_ICDF(14615), AOM_ICDF(16317), AOM_ICDF(17859),
|
||||
AOM_ICDF(19257), AOM_ICDF(20524), AOM_ICDF(21672), AOM_ICDF(22712),
|
||||
AOM_ICDF(23655), AOM_ICDF(24509), AOM_ICDF(25283), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(2816), AOM_ICDF(5390), AOM_ICDF(7743), AOM_ICDF(9894),
|
||||
AOM_ICDF(11860), AOM_ICDF(13657), AOM_ICDF(15299), AOM_ICDF(16800),
|
||||
AOM_ICDF(18172), AOM_ICDF(19426), AOM_ICDF(20573), AOM_ICDF(21621),
|
||||
AOM_ICDF(22579), AOM_ICDF(23455), AOM_ICDF(24255), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(2560), AOM_ICDF(4920), AOM_ICDF(7096), AOM_ICDF(9102),
|
||||
AOM_ICDF(10951), AOM_ICDF(12656), AOM_ICDF(14227), AOM_ICDF(15676),
|
||||
AOM_ICDF(17011), AOM_ICDF(18242), AOM_ICDF(19377), AOM_ICDF(20423),
|
||||
AOM_ICDF(21388), AOM_ICDF(22277), AOM_ICDF(23097), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(2304), AOM_ICDF(4446), AOM_ICDF(6437), AOM_ICDF(8288),
|
||||
AOM_ICDF(10009), AOM_ICDF(11609), AOM_ICDF(13097), AOM_ICDF(14480),
|
||||
AOM_ICDF(15766), AOM_ICDF(16961), AOM_ICDF(18072), AOM_ICDF(19105),
|
||||
AOM_ICDF(20066), AOM_ICDF(20959), AOM_ICDF(21789), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(2048), AOM_ICDF(3968), AOM_ICDF(5768), AOM_ICDF(7456),
|
||||
AOM_ICDF(9038), AOM_ICDF(10521), AOM_ICDF(11911), AOM_ICDF(13215),
|
||||
AOM_ICDF(14437), AOM_ICDF(15583), AOM_ICDF(16657), AOM_ICDF(17664),
|
||||
AOM_ICDF(18608), AOM_ICDF(19493), AOM_ICDF(20323), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(1792), AOM_ICDF(3486), AOM_ICDF(5087), AOM_ICDF(6601),
|
||||
AOM_ICDF(8032), AOM_ICDF(9385), AOM_ICDF(10664), AOM_ICDF(11873),
|
||||
AOM_ICDF(13016), AOM_ICDF(14096), AOM_ICDF(15117), AOM_ICDF(16082),
|
||||
AOM_ICDF(16995), AOM_ICDF(17858), AOM_ICDF(18673), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(1536), AOM_ICDF(3000), AOM_ICDF(4395), AOM_ICDF(5725),
|
||||
AOM_ICDF(6993), AOM_ICDF(8201), AOM_ICDF(9353), AOM_ICDF(10451),
|
||||
AOM_ICDF(11497), AOM_ICDF(12494), AOM_ICDF(13444), AOM_ICDF(14350),
|
||||
AOM_ICDF(15213), AOM_ICDF(16036), AOM_ICDF(16820), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(1280), AOM_ICDF(2510), AOM_ICDF(3692), AOM_ICDF(4828),
|
||||
AOM_ICDF(5919), AOM_ICDF(6968), AOM_ICDF(7976), AOM_ICDF(8944),
|
||||
AOM_ICDF(9875), AOM_ICDF(10769), AOM_ICDF(11628), AOM_ICDF(12454),
|
||||
AOM_ICDF(13248), AOM_ICDF(14011), AOM_ICDF(14744), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(1024), AOM_ICDF(2016), AOM_ICDF(2977), AOM_ICDF(3908),
|
||||
AOM_ICDF(4810), AOM_ICDF(5684), AOM_ICDF(6530), AOM_ICDF(7350),
|
||||
AOM_ICDF(8144), AOM_ICDF(8913), AOM_ICDF(9658), AOM_ICDF(10380),
|
||||
AOM_ICDF(11080), AOM_ICDF(11758), AOM_ICDF(12415), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(768), AOM_ICDF(1518), AOM_ICDF(2250), AOM_ICDF(2965),
|
||||
AOM_ICDF(3663), AOM_ICDF(4345), AOM_ICDF(5011), AOM_ICDF(5662),
|
||||
AOM_ICDF(6297), AOM_ICDF(6917), AOM_ICDF(7523), AOM_ICDF(8115),
|
||||
AOM_ICDF(8693), AOM_ICDF(9257), AOM_ICDF(9808), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(512), AOM_ICDF(1016), AOM_ICDF(1512), AOM_ICDF(2000),
|
||||
AOM_ICDF(2481), AOM_ICDF(2954), AOM_ICDF(3420), AOM_ICDF(3879),
|
||||
AOM_ICDF(4330), AOM_ICDF(4774), AOM_ICDF(5211), AOM_ICDF(5642),
|
||||
AOM_ICDF(6066), AOM_ICDF(6483), AOM_ICDF(6894), AOM_ICDF(32768)},
|
||||
{ AOM_ICDF(256), AOM_ICDF(510), AOM_ICDF(762), AOM_ICDF(1012),
|
||||
AOM_ICDF(1260), AOM_ICDF(1506), AOM_ICDF(1750), AOM_ICDF(1992),
|
||||
AOM_ICDF(2232), AOM_ICDF(2471), AOM_ICDF(2708), AOM_ICDF(2943),
|
||||
AOM_ICDF(3176), AOM_ICDF(3407), AOM_ICDF(3636), AOM_ICDF(32768)},
|
||||
};
|
||||
|
||||
|
||||
const uint16_t LAPLACE_OFFSET[128] = {
|
||||
0,
|
||||
29871,
|
||||
28672,
|
||||
27751,
|
||||
26975,
|
||||
26291,
|
||||
25673,
|
||||
25105,
|
||||
24576,
|
||||
24079,
|
||||
23609,
|
||||
23162,
|
||||
22734,
|
||||
22325,
|
||||
21931,
|
||||
21550,
|
||||
21182,
|
||||
20826,
|
||||
20480,
|
||||
20143,
|
||||
19815,
|
||||
19495,
|
||||
19183,
|
||||
18877,
|
||||
18579,
|
||||
18286,
|
||||
17999,
|
||||
17718,
|
||||
17442,
|
||||
17170,
|
||||
16904,
|
||||
16642,
|
||||
16384,
|
||||
16129,
|
||||
15879,
|
||||
15633,
|
||||
15390,
|
||||
15150,
|
||||
14913,
|
||||
14680,
|
||||
14450,
|
||||
14222,
|
||||
13997,
|
||||
13775,
|
||||
13556,
|
||||
13338,
|
||||
13124,
|
||||
12911,
|
||||
12701,
|
||||
12493,
|
||||
12288,
|
||||
12084,
|
||||
11882,
|
||||
11682,
|
||||
11484,
|
||||
11288,
|
||||
11094,
|
||||
10901,
|
||||
10710,
|
||||
10521,
|
||||
10333,
|
||||
10147,
|
||||
9962,
|
||||
9779,
|
||||
9597,
|
||||
9417,
|
||||
9238,
|
||||
9060,
|
||||
8884,
|
||||
8709,
|
||||
8535,
|
||||
8363,
|
||||
8192,
|
||||
8021,
|
||||
7853,
|
||||
7685,
|
||||
7518,
|
||||
7352,
|
||||
7188,
|
||||
7025,
|
||||
6862,
|
||||
6701,
|
||||
6540,
|
||||
6381,
|
||||
6222,
|
||||
6065,
|
||||
5908,
|
||||
5753,
|
||||
5598,
|
||||
5444,
|
||||
5291,
|
||||
5138,
|
||||
4987,
|
||||
4837,
|
||||
4687,
|
||||
4538,
|
||||
4390,
|
||||
4242,
|
||||
4096,
|
||||
3950,
|
||||
3804,
|
||||
3660,
|
||||
3516,
|
||||
3373,
|
||||
3231,
|
||||
3089,
|
||||
2948,
|
||||
2808,
|
||||
2668,
|
||||
2529,
|
||||
2391,
|
||||
2253,
|
||||
2116,
|
||||
1979,
|
||||
1843,
|
||||
1708,
|
||||
1573,
|
||||
1439,
|
||||
1306,
|
||||
1172,
|
||||
1040,
|
||||
908,
|
||||
777,
|
||||
646,
|
||||
516,
|
||||
386,
|
||||
257,
|
||||
128,
|
||||
};
|
||||
97
third_party/aom/av1/common/mips/dspr2/av1_itrans16_dspr2.c
vendored
Normal file
97
third_party/aom/av1/common/mips/dspr2/av1_itrans16_dspr2.c
vendored
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* 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 <stdio.h>
|
||||
|
||||
#include "./aom_config.h"
|
||||
#include "./av1_rtcd.h"
|
||||
#include "av1/common/common.h"
|
||||
#include "av1/common/blockd.h"
|
||||
#include "av1/common/idct.h"
|
||||
#include "aom_dsp/mips/inv_txfm_dspr2.h"
|
||||
#include "aom_dsp/txfm_common.h"
|
||||
#include "aom_ports/mem.h"
|
||||
|
||||
#if HAVE_DSPR2
|
||||
void av1_iht16x16_256_add_dspr2(const int16_t *input, uint8_t *dest, int pitch,
|
||||
int tx_type) {
|
||||
int i, j;
|
||||
DECLARE_ALIGNED(32, int16_t, out[16 * 16]);
|
||||
int16_t *outptr = out;
|
||||
int16_t temp_out[16];
|
||||
uint32_t pos = 45;
|
||||
|
||||
/* bit positon for extract from acc */
|
||||
__asm__ __volatile__("wrdsp %[pos], 1 \n\t" : : [pos] "r"(pos));
|
||||
|
||||
switch (tx_type) {
|
||||
case DCT_DCT: // DCT in both horizontal and vertical
|
||||
idct16_rows_dspr2(input, outptr, 16);
|
||||
idct16_cols_add_blk_dspr2(out, dest, pitch);
|
||||
break;
|
||||
case ADST_DCT: // ADST in vertical, DCT in horizontal
|
||||
idct16_rows_dspr2(input, outptr, 16);
|
||||
|
||||
outptr = out;
|
||||
|
||||
for (i = 0; i < 16; ++i) {
|
||||
iadst16_dspr2(outptr, temp_out);
|
||||
|
||||
for (j = 0; j < 16; ++j)
|
||||
dest[j * pitch + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6) +
|
||||
dest[j * pitch + i]);
|
||||
outptr += 16;
|
||||
}
|
||||
break;
|
||||
case DCT_ADST: // DCT in vertical, ADST in horizontal
|
||||
{
|
||||
int16_t temp_in[16 * 16];
|
||||
|
||||
for (i = 0; i < 16; ++i) {
|
||||
/* prefetch row */
|
||||
prefetch_load((const uint8_t *)(input + 16));
|
||||
|
||||
iadst16_dspr2(input, outptr);
|
||||
input += 16;
|
||||
outptr += 16;
|
||||
}
|
||||
|
||||
for (i = 0; i < 16; ++i)
|
||||
for (j = 0; j < 16; ++j) temp_in[j * 16 + i] = out[i * 16 + j];
|
||||
|
||||
idct16_cols_add_blk_dspr2(temp_in, dest, pitch);
|
||||
} break;
|
||||
case ADST_ADST: // ADST in both directions
|
||||
{
|
||||
int16_t temp_in[16];
|
||||
|
||||
for (i = 0; i < 16; ++i) {
|
||||
/* prefetch row */
|
||||
prefetch_load((const uint8_t *)(input + 16));
|
||||
|
||||
iadst16_dspr2(input, outptr);
|
||||
input += 16;
|
||||
outptr += 16;
|
||||
}
|
||||
|
||||
for (i = 0; i < 16; ++i) {
|
||||
for (j = 0; j < 16; ++j) temp_in[j] = out[j * 16 + i];
|
||||
iadst16_dspr2(temp_in, temp_out);
|
||||
for (j = 0; j < 16; ++j)
|
||||
dest[j * pitch + i] = clip_pixel(ROUND_POWER_OF_TWO(temp_out[j], 6) +
|
||||
dest[j * pitch + i]);
|
||||
}
|
||||
} break;
|
||||
default: printf("av1_short_iht16x16_add_dspr2 : Invalid tx_type\n"); break;
|
||||
}
|
||||
}
|
||||
#endif // #if HAVE_DSPR2
|
||||
91
third_party/aom/av1/common/mips/dspr2/av1_itrans4_dspr2.c
vendored
Normal file
91
third_party/aom/av1/common/mips/dspr2/av1_itrans4_dspr2.c
vendored
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* 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 <stdio.h>
|
||||
|
||||
#include "./aom_config.h"
|
||||
#include "./av1_rtcd.h"
|
||||
#include "av1/common/common.h"
|
||||
#include "av1/common/blockd.h"
|
||||
#include "av1/common/idct.h"
|
||||
#include "aom_dsp/mips/inv_txfm_dspr2.h"
|
||||
#include "aom_dsp/txfm_common.h"
|
||||
#include "aom_ports/mem.h"
|
||||
|
||||
#if HAVE_DSPR2
|
||||
void av1_iht4x4_16_add_dspr2(const int16_t *input, uint8_t *dest,
|
||||
int dest_stride, int tx_type) {
|
||||
int i, j;
|
||||
DECLARE_ALIGNED(32, int16_t, out[4 * 4]);
|
||||
int16_t *outptr = out;
|
||||
int16_t temp_in[4 * 4], temp_out[4];
|
||||
uint32_t pos = 45;
|
||||
|
||||
/* bit positon for extract from acc */
|
||||
__asm__ __volatile__("wrdsp %[pos], 1 \n\t"
|
||||
:
|
||||
: [pos] "r"(pos));
|
||||
|
||||
switch (tx_type) {
|
||||
case DCT_DCT: // DCT in both horizontal and vertical
|
||||
aom_idct4_rows_dspr2(input, outptr);
|
||||
aom_idct4_columns_add_blk_dspr2(&out[0], dest, dest_stride);
|
||||
break;
|
||||
case ADST_DCT: // ADST in vertical, DCT in horizontal
|
||||
aom_idct4_rows_dspr2(input, outptr);
|
||||
|
||||
outptr = out;
|
||||
|
||||
for (i = 0; i < 4; ++i) {
|
||||
iadst4_dspr2(outptr, temp_out);
|
||||
|
||||
for (j = 0; j < 4; ++j)
|
||||
dest[j * dest_stride + i] = clip_pixel(
|
||||
ROUND_POWER_OF_TWO(temp_out[j], 4) + dest[j * dest_stride + i]);
|
||||
|
||||
outptr += 4;
|
||||
}
|
||||
break;
|
||||
case DCT_ADST: // DCT in vertical, ADST in horizontal
|
||||
for (i = 0; i < 4; ++i) {
|
||||
iadst4_dspr2(input, outptr);
|
||||
input += 4;
|
||||
outptr += 4;
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; ++i) {
|
||||
for (j = 0; j < 4; ++j) {
|
||||
temp_in[i * 4 + j] = out[j * 4 + i];
|
||||
}
|
||||
}
|
||||
aom_idct4_columns_add_blk_dspr2(&temp_in[0], dest, dest_stride);
|
||||
break;
|
||||
case ADST_ADST: // ADST in both directions
|
||||
for (i = 0; i < 4; ++i) {
|
||||
iadst4_dspr2(input, outptr);
|
||||
input += 4;
|
||||
outptr += 4;
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; ++i) {
|
||||
for (j = 0; j < 4; ++j) temp_in[j] = out[j * 4 + i];
|
||||
iadst4_dspr2(temp_in, temp_out);
|
||||
|
||||
for (j = 0; j < 4; ++j)
|
||||
dest[j * dest_stride + i] = clip_pixel(
|
||||
ROUND_POWER_OF_TWO(temp_out[j], 4) + dest[j * dest_stride + i]);
|
||||
}
|
||||
break;
|
||||
default: printf("av1_short_iht4x4_add_dspr2 : Invalid tx_type\n"); break;
|
||||
}
|
||||
}
|
||||
#endif // #if HAVE_DSPR2
|
||||
85
third_party/aom/av1/common/mips/dspr2/av1_itrans8_dspr2.c
vendored
Normal file
85
third_party/aom/av1/common/mips/dspr2/av1_itrans8_dspr2.c
vendored
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* 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 <stdio.h>
|
||||
|
||||
#include "./aom_config.h"
|
||||
#include "./av1_rtcd.h"
|
||||
#include "av1/common/common.h"
|
||||
#include "av1/common/blockd.h"
|
||||
#include "aom_dsp/mips/inv_txfm_dspr2.h"
|
||||
#include "aom_dsp/txfm_common.h"
|
||||
#include "aom_ports/mem.h"
|
||||
|
||||
#if HAVE_DSPR2
|
||||
void av1_iht8x8_64_add_dspr2(const int16_t *input, uint8_t *dest,
|
||||
int dest_stride, int tx_type) {
|
||||
int i, j;
|
||||
DECLARE_ALIGNED(32, int16_t, out[8 * 8]);
|
||||
int16_t *outptr = out;
|
||||
int16_t temp_in[8 * 8], temp_out[8];
|
||||
uint32_t pos = 45;
|
||||
|
||||
/* bit positon for extract from acc */
|
||||
__asm__ __volatile__("wrdsp %[pos], 1 \n\t" : : [pos] "r"(pos));
|
||||
|
||||
switch (tx_type) {
|
||||
case DCT_DCT: // DCT in both horizontal and vertical
|
||||
idct8_rows_dspr2(input, outptr, 8);
|
||||
idct8_columns_add_blk_dspr2(&out[0], dest, dest_stride);
|
||||
break;
|
||||
case ADST_DCT: // ADST in vertical, DCT in horizontal
|
||||
idct8_rows_dspr2(input, outptr, 8);
|
||||
|
||||
for (i = 0; i < 8; ++i) {
|
||||
iadst8_dspr2(&out[i * 8], temp_out);
|
||||
|
||||
for (j = 0; j < 8; ++j)
|
||||
dest[j * dest_stride + i] = clip_pixel(
|
||||
ROUND_POWER_OF_TWO(temp_out[j], 5) + dest[j * dest_stride + i]);
|
||||
}
|
||||
break;
|
||||
case DCT_ADST: // DCT in vertical, ADST in horizontal
|
||||
for (i = 0; i < 8; ++i) {
|
||||
iadst8_dspr2(input, outptr);
|
||||
input += 8;
|
||||
outptr += 8;
|
||||
}
|
||||
|
||||
for (i = 0; i < 8; ++i) {
|
||||
for (j = 0; j < 8; ++j) {
|
||||
temp_in[i * 8 + j] = out[j * 8 + i];
|
||||
}
|
||||
}
|
||||
idct8_columns_add_blk_dspr2(&temp_in[0], dest, dest_stride);
|
||||
break;
|
||||
case ADST_ADST: // ADST in both directions
|
||||
for (i = 0; i < 8; ++i) {
|
||||
iadst8_dspr2(input, outptr);
|
||||
input += 8;
|
||||
outptr += 8;
|
||||
}
|
||||
|
||||
for (i = 0; i < 8; ++i) {
|
||||
for (j = 0; j < 8; ++j) temp_in[j] = out[j * 8 + i];
|
||||
|
||||
iadst8_dspr2(temp_in, temp_out);
|
||||
|
||||
for (j = 0; j < 8; ++j)
|
||||
dest[j * dest_stride + i] = clip_pixel(
|
||||
ROUND_POWER_OF_TWO(temp_out[j], 5) + dest[j * dest_stride + i]);
|
||||
}
|
||||
break;
|
||||
default: printf("av1_short_iht8x8_add_dspr2 : Invalid tx_type\n"); break;
|
||||
}
|
||||
}
|
||||
#endif // #if HAVE_DSPR2
|
||||
80
third_party/aom/av1/common/mips/msa/av1_idct16x16_msa.c
vendored
Normal file
80
third_party/aom/av1/common/mips/msa/av1_idct16x16_msa.c
vendored
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* 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 "av1/common/enums.h"
|
||||
#include "aom_dsp/mips/inv_txfm_msa.h"
|
||||
|
||||
void av1_iht16x16_256_add_msa(const int16_t *input, uint8_t *dst,
|
||||
int32_t dst_stride, int32_t tx_type) {
|
||||
int32_t i;
|
||||
DECLARE_ALIGNED(32, int16_t, out[16 * 16]);
|
||||
int16_t *out_ptr = &out[0];
|
||||
|
||||
switch (tx_type) {
|
||||
case DCT_DCT:
|
||||
/* transform rows */
|
||||
for (i = 0; i < 2; ++i) {
|
||||
/* process 16 * 8 block */
|
||||
aom_idct16_1d_rows_msa((input + (i << 7)), (out_ptr + (i << 7)));
|
||||
}
|
||||
|
||||
/* transform columns */
|
||||
for (i = 0; i < 2; ++i) {
|
||||
/* process 8 * 16 block */
|
||||
aom_idct16_1d_columns_addblk_msa((out_ptr + (i << 3)), (dst + (i << 3)),
|
||||
dst_stride);
|
||||
}
|
||||
break;
|
||||
case ADST_DCT:
|
||||
/* transform rows */
|
||||
for (i = 0; i < 2; ++i) {
|
||||
/* process 16 * 8 block */
|
||||
aom_idct16_1d_rows_msa((input + (i << 7)), (out_ptr + (i << 7)));
|
||||
}
|
||||
|
||||
/* transform columns */
|
||||
for (i = 0; i < 2; ++i) {
|
||||
aom_iadst16_1d_columns_addblk_msa((out_ptr + (i << 3)),
|
||||
(dst + (i << 3)), dst_stride);
|
||||
}
|
||||
break;
|
||||
case DCT_ADST:
|
||||
/* transform rows */
|
||||
for (i = 0; i < 2; ++i) {
|
||||
/* process 16 * 8 block */
|
||||
aom_iadst16_1d_rows_msa((input + (i << 7)), (out_ptr + (i << 7)));
|
||||
}
|
||||
|
||||
/* transform columns */
|
||||
for (i = 0; i < 2; ++i) {
|
||||
/* process 8 * 16 block */
|
||||
aom_idct16_1d_columns_addblk_msa((out_ptr + (i << 3)), (dst + (i << 3)),
|
||||
dst_stride);
|
||||
}
|
||||
break;
|
||||
case ADST_ADST:
|
||||
/* transform rows */
|
||||
for (i = 0; i < 2; ++i) {
|
||||
/* process 16 * 8 block */
|
||||
aom_iadst16_1d_rows_msa((input + (i << 7)), (out_ptr + (i << 7)));
|
||||
}
|
||||
|
||||
/* transform columns */
|
||||
for (i = 0; i < 2; ++i) {
|
||||
aom_iadst16_1d_columns_addblk_msa((out_ptr + (i << 3)),
|
||||
(dst + (i << 3)), dst_stride);
|
||||
}
|
||||
break;
|
||||
default: assert(0); break;
|
||||
}
|
||||
}
|
||||
61
third_party/aom/av1/common/mips/msa/av1_idct4x4_msa.c
vendored
Normal file
61
third_party/aom/av1/common/mips/msa/av1_idct4x4_msa.c
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* 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 "av1/common/enums.h"
|
||||
#include "aom_dsp/mips/inv_txfm_msa.h"
|
||||
|
||||
void av1_iht4x4_16_add_msa(const int16_t *input, uint8_t *dst,
|
||||
int32_t dst_stride, int32_t tx_type) {
|
||||
v8i16 in0, in1, in2, in3;
|
||||
|
||||
/* load vector elements of 4x4 block */
|
||||
LD4x4_SH(input, in0, in1, in2, in3);
|
||||
TRANSPOSE4x4_SH_SH(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
|
||||
switch (tx_type) {
|
||||
case DCT_DCT:
|
||||
/* DCT in horizontal */
|
||||
AOM_IDCT4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
/* DCT in vertical */
|
||||
TRANSPOSE4x4_SH_SH(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
AOM_IDCT4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
break;
|
||||
case ADST_DCT:
|
||||
/* DCT in horizontal */
|
||||
AOM_IDCT4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
/* ADST in vertical */
|
||||
TRANSPOSE4x4_SH_SH(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
AOM_IADST4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
break;
|
||||
case DCT_ADST:
|
||||
/* ADST in horizontal */
|
||||
AOM_IADST4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
/* DCT in vertical */
|
||||
TRANSPOSE4x4_SH_SH(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
AOM_IDCT4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
break;
|
||||
case ADST_ADST:
|
||||
/* ADST in horizontal */
|
||||
AOM_IADST4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
/* ADST in vertical */
|
||||
TRANSPOSE4x4_SH_SH(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
AOM_IADST4x4(in0, in1, in2, in3, in0, in1, in2, in3);
|
||||
break;
|
||||
default: assert(0); break;
|
||||
}
|
||||
|
||||
/* final rounding (add 2^3, divide by 2^4) and shift */
|
||||
SRARI_H4_SH(in0, in1, in2, in3, 4);
|
||||
/* add block and store 4x4 */
|
||||
ADDBLK_ST4x4_UB(in0, in1, in2, in3, dst, dst_stride);
|
||||
}
|
||||
79
third_party/aom/av1/common/mips/msa/av1_idct8x8_msa.c
vendored
Normal file
79
third_party/aom/av1/common/mips/msa/av1_idct8x8_msa.c
vendored
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* 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 "av1/common/enums.h"
|
||||
#include "aom_dsp/mips/inv_txfm_msa.h"
|
||||
|
||||
void av1_iht8x8_64_add_msa(const int16_t *input, uint8_t *dst,
|
||||
int32_t dst_stride, int32_t tx_type) {
|
||||
v8i16 in0, in1, in2, in3, in4, in5, in6, in7;
|
||||
|
||||
/* load vector elements of 8x8 block */
|
||||
LD_SH8(input, 8, in0, in1, in2, in3, in4, in5, in6, in7);
|
||||
|
||||
TRANSPOSE8x8_SH_SH(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3,
|
||||
in4, in5, in6, in7);
|
||||
|
||||
switch (tx_type) {
|
||||
case DCT_DCT:
|
||||
/* DCT in horizontal */
|
||||
AOM_IDCT8x8_1D(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3,
|
||||
in4, in5, in6, in7);
|
||||
/* DCT in vertical */
|
||||
TRANSPOSE8x8_SH_SH(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2,
|
||||
in3, in4, in5, in6, in7);
|
||||
AOM_IDCT8x8_1D(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3,
|
||||
in4, in5, in6, in7);
|
||||
break;
|
||||
case ADST_DCT:
|
||||
/* DCT in horizontal */
|
||||
AOM_IDCT8x8_1D(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3,
|
||||
in4, in5, in6, in7);
|
||||
/* ADST in vertical */
|
||||
TRANSPOSE8x8_SH_SH(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2,
|
||||
in3, in4, in5, in6, in7);
|
||||
AOM_ADST8(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3, in4,
|
||||
in5, in6, in7);
|
||||
break;
|
||||
case DCT_ADST:
|
||||
/* ADST in horizontal */
|
||||
AOM_ADST8(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3, in4,
|
||||
in5, in6, in7);
|
||||
/* DCT in vertical */
|
||||
TRANSPOSE8x8_SH_SH(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2,
|
||||
in3, in4, in5, in6, in7);
|
||||
AOM_IDCT8x8_1D(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3,
|
||||
in4, in5, in6, in7);
|
||||
break;
|
||||
case ADST_ADST:
|
||||
/* ADST in horizontal */
|
||||
AOM_ADST8(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3, in4,
|
||||
in5, in6, in7);
|
||||
/* ADST in vertical */
|
||||
TRANSPOSE8x8_SH_SH(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2,
|
||||
in3, in4, in5, in6, in7);
|
||||
AOM_ADST8(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3, in4,
|
||||
in5, in6, in7);
|
||||
break;
|
||||
default: assert(0); break;
|
||||
}
|
||||
|
||||
/* final rounding (add 2^4, divide by 2^5) and shift */
|
||||
SRARI_H4_SH(in0, in1, in2, in3, 5);
|
||||
SRARI_H4_SH(in4, in5, in6, in7, 5);
|
||||
|
||||
/* add block and store 8x8 */
|
||||
AOM_ADDBLK_ST8x4_UB(dst, dst_stride, in0, in1, in2, in3);
|
||||
dst += (4 * dst_stride);
|
||||
AOM_ADDBLK_ST8x4_UB(dst, dst_stride, in4, in5, in6, in7);
|
||||
}
|
||||
302
third_party/aom/av1/common/mv.h
vendored
Normal file
302
third_party/aom/av1/common/mv.h
vendored
Normal file
|
|
@ -0,0 +1,302 @@
|
|||
/*
|
||||
* 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_COMMON_MV_H_
|
||||
#define AV1_COMMON_MV_H_
|
||||
|
||||
#include "av1/common/common.h"
|
||||
#include "av1/common/common_data.h"
|
||||
#include "aom_dsp/aom_filter.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct mv {
|
||||
int16_t row;
|
||||
int16_t col;
|
||||
} MV;
|
||||
|
||||
typedef union int_mv {
|
||||
uint32_t as_int;
|
||||
MV as_mv;
|
||||
} int_mv; /* facilitates faster equality tests and copies */
|
||||
|
||||
typedef struct mv32 {
|
||||
int32_t row;
|
||||
int32_t col;
|
||||
} MV32;
|
||||
|
||||
#if (CONFIG_WARPED_MOTION || CONFIG_MOTION_VAR) && CONFIG_GLOBAL_MOTION
|
||||
#define SEPARATE_GLOBAL_MOTION 1
|
||||
#endif // (CONFIG_WARPED_MOTION || CONFIG_MOTION_VAR) && CONFIG_GLOBAL_MOTION
|
||||
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
// Bits of precision used for the model
|
||||
#define WARPEDMODEL_PREC_BITS 16
|
||||
#define WARPEDMODEL_ROW3HOMO_PREC_BITS 16
|
||||
|
||||
#define WARPEDMODEL_TRANS_CLAMP (128 << WARPEDMODEL_PREC_BITS)
|
||||
#define WARPEDMODEL_DIAGAFFINE_CLAMP (1 << (WARPEDMODEL_PREC_BITS + 1))
|
||||
#define WARPEDMODEL_NONDIAGAFFINE_CLAMP (1 << (WARPEDMODEL_PREC_BITS - 1))
|
||||
#define WARPEDMODEL_ROW3HOMO_CLAMP (1 << (WARPEDMODEL_PREC_BITS - 1))
|
||||
|
||||
// Bits of subpel precision for warped interpolation
|
||||
#define WARPEDPIXEL_PREC_BITS 6
|
||||
#define WARPEDPIXEL_PREC_SHIFTS (1 << WARPEDPIXEL_PREC_BITS)
|
||||
|
||||
// Taps for ntap filter
|
||||
#define WARPEDPIXEL_FILTER_TAPS 6
|
||||
|
||||
// Precision of filter taps
|
||||
#define WARPEDPIXEL_FILTER_BITS 7
|
||||
|
||||
// Precision bits reduction after horizontal shear
|
||||
#define HORSHEAR_REDUCE_PREC_BITS 5
|
||||
#define VERSHEAR_REDUCE_PREC_BITS \
|
||||
(2 * WARPEDPIXEL_FILTER_BITS - HORSHEAR_REDUCE_PREC_BITS)
|
||||
|
||||
#define WARPEDDIFF_PREC_BITS (WARPEDMODEL_PREC_BITS - WARPEDPIXEL_PREC_BITS)
|
||||
|
||||
/* clang-format off */
|
||||
typedef enum {
|
||||
IDENTITY = 0, // identity transformation, 0-parameter
|
||||
TRANSLATION = 1, // translational motion 2-parameter
|
||||
ROTZOOM = 2, // simplified affine with rotation + zoom only, 4-parameter
|
||||
AFFINE = 3, // affine, 6-parameter
|
||||
HORTRAPEZOID = 4, // constrained homography, hor trapezoid, 6-parameter
|
||||
VERTRAPEZOID = 5, // constrained homography, ver trapezoid, 6-parameter
|
||||
HOMOGRAPHY = 6, // homography, 8-parameter
|
||||
TRANS_TYPES = 7,
|
||||
} TransformationType;
|
||||
/* clang-format on */
|
||||
|
||||
// Number of types used for global motion (must be >= 3 and <= TRANS_TYPES)
|
||||
// The following can be useful:
|
||||
// GLOBAL_TRANS_TYPES 3 - up to rotation-zoom
|
||||
// GLOBAL_TRANS_TYPES 4 - up to affine
|
||||
// GLOBAL_TRANS_TYPES 6 - up to hor/ver trapezoids
|
||||
// GLOBAL_TRANS_TYPES 7 - up to full homography
|
||||
#define GLOBAL_TRANS_TYPES 4
|
||||
|
||||
typedef struct {
|
||||
#if CONFIG_GLOBAL_MOTION
|
||||
int global_warp_allowed;
|
||||
#endif // CONFIG_GLOBAL_MOTION
|
||||
#if CONFIG_WARPED_MOTION
|
||||
int local_warp_allowed;
|
||||
#endif // CONFIG_WARPED_MOTION
|
||||
} WarpTypesAllowed;
|
||||
|
||||
// number of parameters used by each transformation in TransformationTypes
|
||||
static const int trans_model_params[TRANS_TYPES] = { 0, 2, 4, 6, 6, 6, 8 };
|
||||
|
||||
// The order of values in the wmmat matrix below is best described
|
||||
// by the homography:
|
||||
// [x' (m2 m3 m0 [x
|
||||
// z . y' = m4 m5 m1 * y
|
||||
// 1] m6 m7 1) 1]
|
||||
typedef struct {
|
||||
TransformationType wmtype;
|
||||
int32_t wmmat[8];
|
||||
int16_t alpha, beta, gamma, delta;
|
||||
} WarpedMotionParams;
|
||||
|
||||
static INLINE void set_default_warp_params(WarpedMotionParams *wm) {
|
||||
static const int32_t default_wm_mat[8] = {
|
||||
0, 0, (1 << WARPEDMODEL_PREC_BITS), 0, 0, (1 << WARPEDMODEL_PREC_BITS), 0, 0
|
||||
};
|
||||
memset(wm, 0, sizeof(*wm));
|
||||
memcpy(wm->wmmat, default_wm_mat, sizeof(wm->wmmat));
|
||||
wm->wmtype = IDENTITY;
|
||||
}
|
||||
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
|
||||
#if CONFIG_GLOBAL_MOTION
|
||||
// The following constants describe the various precisions
|
||||
// of different parameters in the global motion experiment.
|
||||
//
|
||||
// Given the general homography:
|
||||
// [x' (a b c [x
|
||||
// z . y' = d e f * y
|
||||
// 1] g h i) 1]
|
||||
//
|
||||
// Constants using the name ALPHA here are related to parameters
|
||||
// a, b, d, e. Constants using the name TRANS are related
|
||||
// to parameters c and f.
|
||||
//
|
||||
// Anything ending in PREC_BITS is the number of bits of precision
|
||||
// to maintain when converting from double to integer.
|
||||
//
|
||||
// The ABS parameters are used to create an upper and lower bound
|
||||
// for each parameter. In other words, after a parameter is integerized
|
||||
// it is clamped between -(1 << ABS_XXX_BITS) and (1 << ABS_XXX_BITS).
|
||||
//
|
||||
// XXX_PREC_DIFF and XXX_DECODE_FACTOR
|
||||
// are computed once here to prevent repetitive
|
||||
// computation on the decoder side. These are
|
||||
// to allow the global motion parameters to be encoded in a lower
|
||||
// precision than the warped model precision. This means that they
|
||||
// need to be changed to warped precision when they are decoded.
|
||||
//
|
||||
// XX_MIN, XX_MAX are also computed to avoid repeated computation
|
||||
|
||||
#define SUBEXPFIN_K 3
|
||||
#define GM_TRANS_PREC_BITS 6
|
||||
#define GM_ABS_TRANS_BITS 12
|
||||
#define GM_ABS_TRANS_ONLY_BITS (GM_ABS_TRANS_BITS - GM_TRANS_PREC_BITS + 3)
|
||||
#define GM_TRANS_PREC_DIFF (WARPEDMODEL_PREC_BITS - GM_TRANS_PREC_BITS)
|
||||
#define GM_TRANS_ONLY_PREC_DIFF (WARPEDMODEL_PREC_BITS - 3)
|
||||
#define GM_TRANS_DECODE_FACTOR (1 << GM_TRANS_PREC_DIFF)
|
||||
#define GM_TRANS_ONLY_DECODE_FACTOR (1 << GM_TRANS_ONLY_PREC_DIFF)
|
||||
|
||||
#define GM_ALPHA_PREC_BITS 15
|
||||
#define GM_ABS_ALPHA_BITS 12
|
||||
#define GM_ALPHA_PREC_DIFF (WARPEDMODEL_PREC_BITS - GM_ALPHA_PREC_BITS)
|
||||
#define GM_ALPHA_DECODE_FACTOR (1 << GM_ALPHA_PREC_DIFF)
|
||||
|
||||
#define GM_ROW3HOMO_PREC_BITS 16
|
||||
#define GM_ABS_ROW3HOMO_BITS 11
|
||||
#define GM_ROW3HOMO_PREC_DIFF \
|
||||
(WARPEDMODEL_ROW3HOMO_PREC_BITS - GM_ROW3HOMO_PREC_BITS)
|
||||
#define GM_ROW3HOMO_DECODE_FACTOR (1 << GM_ROW3HOMO_PREC_DIFF)
|
||||
|
||||
#define GM_TRANS_MAX (1 << GM_ABS_TRANS_BITS)
|
||||
#define GM_ALPHA_MAX (1 << GM_ABS_ALPHA_BITS)
|
||||
#define GM_ROW3HOMO_MAX (1 << GM_ABS_ROW3HOMO_BITS)
|
||||
|
||||
#define GM_TRANS_MIN -GM_TRANS_MAX
|
||||
#define GM_ALPHA_MIN -GM_ALPHA_MAX
|
||||
#define GM_ROW3HOMO_MIN -GM_ROW3HOMO_MAX
|
||||
|
||||
// Use global motion parameters for sub8x8 blocks
|
||||
#define GLOBAL_SUB8X8_USED 0
|
||||
|
||||
static INLINE int block_center_x(int mi_col, BLOCK_SIZE bs) {
|
||||
const int bw = block_size_wide[bs];
|
||||
return mi_col * MI_SIZE + bw / 2 - 1;
|
||||
}
|
||||
|
||||
static INLINE int block_center_y(int mi_row, BLOCK_SIZE bs) {
|
||||
const int bh = block_size_high[bs];
|
||||
return mi_row * MI_SIZE + bh / 2 - 1;
|
||||
}
|
||||
|
||||
static INLINE int convert_to_trans_prec(int allow_hp, int coor) {
|
||||
if (allow_hp)
|
||||
return ROUND_POWER_OF_TWO_SIGNED(coor, WARPEDMODEL_PREC_BITS - 3);
|
||||
else
|
||||
return ROUND_POWER_OF_TWO_SIGNED(coor, WARPEDMODEL_PREC_BITS - 2) * 2;
|
||||
}
|
||||
|
||||
// Convert a global motion translation vector (which may have more bits than a
|
||||
// regular motion vector) into a motion vector
|
||||
static INLINE int_mv gm_get_motion_vector(const WarpedMotionParams *gm,
|
||||
int allow_hp, BLOCK_SIZE bsize,
|
||||
int mi_col, int mi_row,
|
||||
int block_idx) {
|
||||
const int unify_bsize = CONFIG_CB4X4;
|
||||
int_mv res;
|
||||
const int32_t *mat = gm->wmmat;
|
||||
int x, y, tx, ty;
|
||||
|
||||
if (gm->wmtype == TRANSLATION) {
|
||||
res.as_mv.row = gm->wmmat[0] >> GM_TRANS_ONLY_PREC_DIFF;
|
||||
res.as_mv.col = gm->wmmat[1] >> GM_TRANS_ONLY_PREC_DIFF;
|
||||
return res;
|
||||
}
|
||||
|
||||
if (bsize >= BLOCK_8X8 || unify_bsize) {
|
||||
x = block_center_x(mi_col, bsize);
|
||||
y = block_center_y(mi_row, bsize);
|
||||
} else {
|
||||
x = block_center_x(mi_col, bsize);
|
||||
y = block_center_y(mi_row, bsize);
|
||||
x += (block_idx & 1) * MI_SIZE / 2;
|
||||
y += (block_idx & 2) * MI_SIZE / 4;
|
||||
}
|
||||
|
||||
if (gm->wmtype == ROTZOOM) {
|
||||
assert(gm->wmmat[5] == gm->wmmat[2]);
|
||||
assert(gm->wmmat[4] == -gm->wmmat[3]);
|
||||
}
|
||||
if (gm->wmtype > AFFINE) {
|
||||
int xc = (int)((int64_t)mat[2] * x + (int64_t)mat[3] * y + mat[0]);
|
||||
int yc = (int)((int64_t)mat[4] * x + (int64_t)mat[5] * y + mat[1]);
|
||||
const int Z = (int)((int64_t)mat[6] * x + (int64_t)mat[7] * y +
|
||||
(1 << WARPEDMODEL_ROW3HOMO_PREC_BITS));
|
||||
xc *= 1 << (WARPEDMODEL_ROW3HOMO_PREC_BITS - WARPEDMODEL_PREC_BITS);
|
||||
yc *= 1 << (WARPEDMODEL_ROW3HOMO_PREC_BITS - WARPEDMODEL_PREC_BITS);
|
||||
xc = (int)(xc > 0 ? ((int64_t)xc + Z / 2) / Z : ((int64_t)xc - Z / 2) / Z);
|
||||
yc = (int)(yc > 0 ? ((int64_t)yc + Z / 2) / Z : ((int64_t)yc - Z / 2) / Z);
|
||||
tx = convert_to_trans_prec(allow_hp, xc) - (x << 3);
|
||||
ty = convert_to_trans_prec(allow_hp, yc) - (y << 3);
|
||||
} else {
|
||||
const int xc =
|
||||
(mat[2] - (1 << WARPEDMODEL_PREC_BITS)) * x + mat[3] * y + mat[0];
|
||||
const int yc =
|
||||
mat[4] * x + (mat[5] - (1 << WARPEDMODEL_PREC_BITS)) * y + mat[1];
|
||||
tx = convert_to_trans_prec(allow_hp, xc);
|
||||
ty = convert_to_trans_prec(allow_hp, yc);
|
||||
}
|
||||
|
||||
res.as_mv.row = ty;
|
||||
res.as_mv.col = tx;
|
||||
return res;
|
||||
}
|
||||
|
||||
static INLINE TransformationType get_gmtype(const WarpedMotionParams *gm) {
|
||||
if (gm->wmmat[6] != 0 || gm->wmmat[7] != 0) {
|
||||
if (!gm->wmmat[6] && !gm->wmmat[4]) return HORTRAPEZOID;
|
||||
if (!gm->wmmat[7] && !gm->wmmat[3]) return VERTRAPEZOID;
|
||||
return HOMOGRAPHY;
|
||||
}
|
||||
if (gm->wmmat[5] == (1 << WARPEDMODEL_PREC_BITS) && !gm->wmmat[4] &&
|
||||
gm->wmmat[2] == (1 << WARPEDMODEL_PREC_BITS) && !gm->wmmat[3]) {
|
||||
return ((!gm->wmmat[1] && !gm->wmmat[0]) ? IDENTITY : TRANSLATION);
|
||||
}
|
||||
if (gm->wmmat[2] == gm->wmmat[5] && gm->wmmat[3] == -gm->wmmat[4])
|
||||
return ROTZOOM;
|
||||
else
|
||||
return AFFINE;
|
||||
}
|
||||
#endif // CONFIG_GLOBAL_MOTION
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
typedef struct candidate_mv {
|
||||
int_mv this_mv;
|
||||
int_mv comp_mv;
|
||||
uint8_t pred_diff[2];
|
||||
int weight;
|
||||
} CANDIDATE_MV;
|
||||
#endif
|
||||
|
||||
static INLINE int is_zero_mv(const MV *mv) {
|
||||
return *((const uint32_t *)mv) == 0;
|
||||
}
|
||||
|
||||
static INLINE int is_equal_mv(const MV *a, const MV *b) {
|
||||
return *((const uint32_t *)a) == *((const uint32_t *)b);
|
||||
}
|
||||
|
||||
static INLINE void clamp_mv(MV *mv, int min_col, int max_col, int min_row,
|
||||
int max_row) {
|
||||
mv->col = clamp(mv->col, min_col, max_col);
|
||||
mv->row = clamp(mv->row, min_row, max_row);
|
||||
}
|
||||
|
||||
static INLINE int mv_has_subpel(const MV *mv) {
|
||||
return (mv->row & SUBPEL_MASK) || (mv->col & SUBPEL_MASK);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // AV1_COMMON_MV_H_
|
||||
1164
third_party/aom/av1/common/mvref_common.c
vendored
Normal file
1164
third_party/aom/av1/common/mvref_common.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
580
third_party/aom/av1/common/mvref_common.h
vendored
Normal file
580
third_party/aom/av1/common/mvref_common.h
vendored
Normal file
|
|
@ -0,0 +1,580 @@
|
|||
/*
|
||||
* 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_COMMON_MVREF_COMMON_H_
|
||||
#define AV1_COMMON_MVREF_COMMON_H_
|
||||
|
||||
#include "av1/common/onyxc_int.h"
|
||||
#include "av1/common/blockd.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
#define MVREF_NEIGHBOURS 9
|
||||
#else
|
||||
#define MVREF_NEIGHBOURS 8
|
||||
#endif
|
||||
|
||||
typedef struct position {
|
||||
int row;
|
||||
int col;
|
||||
} POSITION;
|
||||
|
||||
typedef enum {
|
||||
BOTH_ZERO = 0,
|
||||
ZERO_PLUS_PREDICTED = 1,
|
||||
BOTH_PREDICTED = 2,
|
||||
NEW_PLUS_NON_INTRA = 3,
|
||||
BOTH_NEW = 4,
|
||||
INTRA_PLUS_NON_INTRA = 5,
|
||||
BOTH_INTRA = 6,
|
||||
INVALID_CASE = 9
|
||||
} motion_vector_context;
|
||||
|
||||
// This is used to figure out a context for the ref blocks. The code flattens
|
||||
// an array that would have 3 possible counts (0, 1 & 2) for 3 choices by
|
||||
// adding 9 for each intra block, 3 for each zero mv and 1 for each new
|
||||
// motion vector. This single number is then converted into a context
|
||||
// with a single lookup ( counter_to_context ).
|
||||
static const int mode_2_counter[MB_MODE_COUNT] = {
|
||||
9, // DC_PRED
|
||||
9, // V_PRED
|
||||
9, // H_PRED
|
||||
9, // D45_PRED
|
||||
9, // D135_PRED
|
||||
9, // D117_PRED
|
||||
9, // D153_PRED
|
||||
9, // D207_PRED
|
||||
9, // D63_PRED
|
||||
#if CONFIG_ALT_INTRA
|
||||
9, // SMOOTH_PRED
|
||||
#endif // CONFIG_ALT_INTRA
|
||||
9, // TM_PRED
|
||||
0, // NEARESTMV
|
||||
0, // NEARMV
|
||||
3, // ZEROMV
|
||||
1, // NEWMV
|
||||
#if CONFIG_EXT_INTER
|
||||
#if CONFIG_COMPOUND_SINGLEREF
|
||||
0, // SR_NEAREST_NEARMV
|
||||
1, // SR_NEAREST_NEWMV
|
||||
1, // SR_NEAR_NEWMV
|
||||
3, // SR_ZERO_NEWMV
|
||||
1, // SR_NEW_NEWMV
|
||||
#endif // CONFIG_COMPOUND_SINGLEREF
|
||||
0, // NEAREST_NEARESTMV
|
||||
0, // NEAREST_NEARMV
|
||||
0, // NEAR_NEARESTMV
|
||||
0, // NEAR_NEARMV
|
||||
1, // NEAREST_NEWMV
|
||||
1, // NEW_NEARESTMV
|
||||
1, // NEAR_NEWMV
|
||||
1, // NEW_NEARMV
|
||||
3, // ZERO_ZEROMV
|
||||
1, // NEW_NEWMV
|
||||
#endif // CONFIG_EXT_INTER
|
||||
};
|
||||
|
||||
// There are 3^3 different combinations of 3 counts that can be either 0,1 or
|
||||
// 2. However the actual count can never be greater than 2 so the highest
|
||||
// counter we need is 18. 9 is an invalid counter that's never used.
|
||||
static const int counter_to_context[19] = {
|
||||
BOTH_PREDICTED, // 0
|
||||
NEW_PLUS_NON_INTRA, // 1
|
||||
BOTH_NEW, // 2
|
||||
ZERO_PLUS_PREDICTED, // 3
|
||||
NEW_PLUS_NON_INTRA, // 4
|
||||
INVALID_CASE, // 5
|
||||
BOTH_ZERO, // 6
|
||||
INVALID_CASE, // 7
|
||||
INVALID_CASE, // 8
|
||||
INTRA_PLUS_NON_INTRA, // 9
|
||||
INTRA_PLUS_NON_INTRA, // 10
|
||||
INVALID_CASE, // 11
|
||||
INTRA_PLUS_NON_INTRA, // 12
|
||||
INVALID_CASE, // 13
|
||||
INVALID_CASE, // 14
|
||||
INVALID_CASE, // 15
|
||||
INVALID_CASE, // 16
|
||||
INVALID_CASE, // 17
|
||||
BOTH_INTRA // 18
|
||||
};
|
||||
|
||||
#if !CONFIG_REF_MV
|
||||
static const POSITION mv_ref_blocks[BLOCK_SIZES][MVREF_NEIGHBOURS] = {
|
||||
// 4X4
|
||||
{ { -1, 0 },
|
||||
{ 0, -1 },
|
||||
{ -1, -1 },
|
||||
{ -2, 0 },
|
||||
{ 0, -2 },
|
||||
{ -2, -1 },
|
||||
{ -1, -2 },
|
||||
{ -2, -2 } },
|
||||
// 4X8
|
||||
{ { -1, 0 },
|
||||
{ 0, -1 },
|
||||
{ -1, -1 },
|
||||
{ -2, 0 },
|
||||
{ 0, -2 },
|
||||
{ -2, -1 },
|
||||
{ -1, -2 },
|
||||
{ -2, -2 } },
|
||||
// 8X4
|
||||
{ { -1, 0 },
|
||||
{ 0, -1 },
|
||||
{ -1, -1 },
|
||||
{ -2, 0 },
|
||||
{ 0, -2 },
|
||||
{ -2, -1 },
|
||||
{ -1, -2 },
|
||||
{ -2, -2 } },
|
||||
// 8X8
|
||||
{ { -1, 0 },
|
||||
{ 0, -1 },
|
||||
{ -1, -1 },
|
||||
{ -2, 0 },
|
||||
{ 0, -2 },
|
||||
{ -2, -1 },
|
||||
{ -1, -2 },
|
||||
{ -2, -2 } },
|
||||
// 8X16
|
||||
{ { 0, -1 },
|
||||
{ -1, 0 },
|
||||
{ 1, -1 },
|
||||
{ -1, -1 },
|
||||
{ 0, -2 },
|
||||
{ -2, 0 },
|
||||
{ -2, -1 },
|
||||
{ -1, -2 } },
|
||||
// 16X8
|
||||
{ { -1, 0 },
|
||||
{ 0, -1 },
|
||||
{ -1, 1 },
|
||||
{ -1, -1 },
|
||||
{ -2, 0 },
|
||||
{ 0, -2 },
|
||||
{ -1, -2 },
|
||||
{ -2, -1 } },
|
||||
// 16X16
|
||||
{ { -1, 0 },
|
||||
{ 0, -1 },
|
||||
{ -1, 1 },
|
||||
{ 1, -1 },
|
||||
{ -1, -1 },
|
||||
{ -3, 0 },
|
||||
{ 0, -3 },
|
||||
{ -3, -3 } },
|
||||
// 16X32
|
||||
{ { 0, -1 },
|
||||
{ -1, 0 },
|
||||
{ 2, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, 1 },
|
||||
{ 0, -3 },
|
||||
{ -3, 0 },
|
||||
{ -3, -3 } },
|
||||
// 32X16
|
||||
{ { -1, 0 },
|
||||
{ 0, -1 },
|
||||
{ -1, 2 },
|
||||
{ -1, -1 },
|
||||
{ 1, -1 },
|
||||
{ -3, 0 },
|
||||
{ 0, -3 },
|
||||
{ -3, -3 } },
|
||||
// 32X32
|
||||
{ { -1, 1 },
|
||||
{ 1, -1 },
|
||||
{ -1, 2 },
|
||||
{ 2, -1 },
|
||||
{ -1, -1 },
|
||||
{ -3, 0 },
|
||||
{ 0, -3 },
|
||||
{ -3, -3 } },
|
||||
// 32X64
|
||||
{ { 0, -1 },
|
||||
{ -1, 0 },
|
||||
{ 4, -1 },
|
||||
{ -1, 2 },
|
||||
{ -1, -1 },
|
||||
{ 0, -3 },
|
||||
{ -3, 0 },
|
||||
{ 2, -1 } },
|
||||
// 64X32
|
||||
{ { -1, 0 },
|
||||
{ 0, -1 },
|
||||
{ -1, 4 },
|
||||
{ 2, -1 },
|
||||
{ -1, -1 },
|
||||
{ -3, 0 },
|
||||
{ 0, -3 },
|
||||
{ -1, 2 } },
|
||||
// 64X64
|
||||
{ { -1, 3 },
|
||||
{ 3, -1 },
|
||||
{ -1, 4 },
|
||||
{ 4, -1 },
|
||||
{ -1, -1 },
|
||||
{ -1, 0 },
|
||||
{ 0, -1 },
|
||||
{ -1, 6 } },
|
||||
#if CONFIG_EXT_PARTITION
|
||||
// TODO(debargha/jingning) Making them twice the 32x64, .. ones above
|
||||
// 64x128
|
||||
{ { 0, -2 },
|
||||
{ -2, 0 },
|
||||
{ 8, -2 },
|
||||
{ -2, 4 },
|
||||
{ -2, -2 },
|
||||
{ 0, -6 },
|
||||
{ -6, 0 },
|
||||
{ 4, -2 } },
|
||||
// 128x64
|
||||
{ { -2, 0 },
|
||||
{ 0, -2 },
|
||||
{ -2, 8 },
|
||||
{ 4, -2 },
|
||||
{ -2, -2 },
|
||||
{ -6, 0 },
|
||||
{ 0, -6 },
|
||||
{ -2, 4 } },
|
||||
// 128x128
|
||||
{ { -2, 6 },
|
||||
{ 6, -2 },
|
||||
{ -2, 8 },
|
||||
{ 8, -2 },
|
||||
{ -2, -2 },
|
||||
{ -2, 0 },
|
||||
{ 0, -2 },
|
||||
{ -2, 12 } },
|
||||
#endif // CONFIG_EXT_PARTITION
|
||||
};
|
||||
#endif
|
||||
|
||||
static const int idx_n_column_to_subblock[4][2] = {
|
||||
{ 1, 2 }, { 1, 3 }, { 3, 2 }, { 3, 3 }
|
||||
};
|
||||
|
||||
// clamp_mv_ref
|
||||
#if CONFIG_EXT_PARTITION
|
||||
#define MV_BORDER (16 << 3) // Allow 16 pels in 1/8th pel units
|
||||
#else
|
||||
#define MV_BORDER (8 << 3) // Allow 8 pels in 1/8th pel units
|
||||
#endif // CONFIG_EXT_PARTITION
|
||||
|
||||
static INLINE void clamp_mv_ref(MV *mv, int bw, int bh, const MACROBLOCKD *xd) {
|
||||
clamp_mv(mv, xd->mb_to_left_edge - bw * 8 - MV_BORDER,
|
||||
xd->mb_to_right_edge + bw * 8 + MV_BORDER,
|
||||
xd->mb_to_top_edge - bh * 8 - MV_BORDER,
|
||||
xd->mb_to_bottom_edge + bh * 8 + MV_BORDER);
|
||||
}
|
||||
|
||||
// This function returns either the appropriate sub block or block's mv
|
||||
// on whether the block_size < 8x8 and we have check_sub_blocks set.
|
||||
static INLINE int_mv get_sub_block_mv(const MODE_INFO *candidate, int which_mv,
|
||||
int search_col, int block_idx) {
|
||||
#if CONFIG_REF_MV
|
||||
(void)search_col;
|
||||
(void)block_idx;
|
||||
return candidate->mbmi.mv[which_mv];
|
||||
#else
|
||||
return block_idx >= 0 && candidate->mbmi.sb_type < BLOCK_8X8
|
||||
? candidate
|
||||
->bmi[idx_n_column_to_subblock[block_idx][search_col == 0]]
|
||||
.as_mv[which_mv]
|
||||
: candidate->mbmi.mv[which_mv];
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
static INLINE int_mv get_sub_block_pred_mv(const MODE_INFO *candidate,
|
||||
int which_mv, int search_col,
|
||||
int block_idx) {
|
||||
(void)search_col;
|
||||
(void)block_idx;
|
||||
return candidate->mbmi.mv[which_mv];
|
||||
}
|
||||
#endif
|
||||
|
||||
// Performs mv sign inversion if indicated by the reference frame combination.
|
||||
static INLINE int_mv scale_mv(const MB_MODE_INFO *mbmi, int ref,
|
||||
const MV_REFERENCE_FRAME this_ref_frame,
|
||||
const int *ref_sign_bias) {
|
||||
int_mv mv = mbmi->mv[ref];
|
||||
if (ref_sign_bias[mbmi->ref_frame[ref]] != ref_sign_bias[this_ref_frame]) {
|
||||
mv.as_mv.row *= -1;
|
||||
mv.as_mv.col *= -1;
|
||||
}
|
||||
return mv;
|
||||
}
|
||||
|
||||
#define CLIP_IN_ADD(mv, bw, bh, xd) clamp_mv_ref(mv, bw, bh, xd)
|
||||
|
||||
// This macro is used to add a motion vector mv_ref list if it isn't
|
||||
// already in the list. If it's the second motion vector it will also
|
||||
// skip all additional processing and jump to done!
|
||||
#define ADD_MV_REF_LIST(mv, refmv_count, mv_ref_list, bw, bh, xd, Done) \
|
||||
do { \
|
||||
(mv_ref_list)[(refmv_count)] = (mv); \
|
||||
CLIP_IN_ADD(&(mv_ref_list)[(refmv_count)].as_mv, (bw), (bh), (xd)); \
|
||||
if (refmv_count && (mv_ref_list)[1].as_int != (mv_ref_list)[0].as_int) { \
|
||||
(refmv_count) = 2; \
|
||||
goto Done; \
|
||||
} \
|
||||
(refmv_count) = 1; \
|
||||
} while (0)
|
||||
|
||||
// If either reference frame is different, not INTRA, and they
|
||||
// are different from each other scale and add the mv to our list.
|
||||
#define IF_DIFF_REF_FRAME_ADD_MV(mbmi, ref_frame, ref_sign_bias, refmv_count, \
|
||||
mv_ref_list, bw, bh, xd, Done) \
|
||||
do { \
|
||||
if (is_inter_block(mbmi)) { \
|
||||
if ((mbmi)->ref_frame[0] != ref_frame) \
|
||||
ADD_MV_REF_LIST(scale_mv((mbmi), 0, ref_frame, ref_sign_bias), \
|
||||
refmv_count, mv_ref_list, bw, bh, xd, Done); \
|
||||
if (has_second_ref(mbmi) && (mbmi)->ref_frame[1] != ref_frame) \
|
||||
ADD_MV_REF_LIST(scale_mv((mbmi), 1, ref_frame, ref_sign_bias), \
|
||||
refmv_count, mv_ref_list, bw, bh, xd, Done); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
// Checks that the given mi_row, mi_col and search point
|
||||
// are inside the borders of the tile.
|
||||
static INLINE int is_inside(const TileInfo *const tile, int mi_col, int mi_row,
|
||||
int mi_rows, const AV1_COMMON *cm,
|
||||
const POSITION *mi_pos) {
|
||||
#if CONFIG_DEPENDENT_HORZTILES
|
||||
const int dependent_horz_tile_flag = cm->dependent_horz_tiles;
|
||||
#else
|
||||
const int dependent_horz_tile_flag = 0;
|
||||
(void)cm;
|
||||
#endif
|
||||
#if CONFIG_TILE_GROUPS
|
||||
if (dependent_horz_tile_flag && !tile->tg_horz_boundary) {
|
||||
#else
|
||||
if (dependent_horz_tile_flag) {
|
||||
#endif
|
||||
return !(mi_row + mi_pos->row < 0 ||
|
||||
mi_col + mi_pos->col < tile->mi_col_start ||
|
||||
mi_row + mi_pos->row >= mi_rows ||
|
||||
mi_col + mi_pos->col >= tile->mi_col_end);
|
||||
} else {
|
||||
return !(mi_row + mi_pos->row < tile->mi_row_start ||
|
||||
mi_col + mi_pos->col < tile->mi_col_start ||
|
||||
mi_row + mi_pos->row >= tile->mi_row_end ||
|
||||
mi_col + mi_pos->col >= tile->mi_col_end);
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void lower_mv_precision(MV *mv, int allow_hp) {
|
||||
if (!allow_hp) {
|
||||
if (mv->row & 1) mv->row += (mv->row > 0 ? -1 : 1);
|
||||
if (mv->col & 1) mv->col += (mv->col > 0 ? -1 : 1);
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_REF_MV
|
||||
static INLINE uint8_t av1_get_pred_diff_ctx(const int_mv pred_mv,
|
||||
const int_mv this_mv) {
|
||||
if (abs(this_mv.as_mv.row - pred_mv.as_mv.row) <= 4 &&
|
||||
abs(this_mv.as_mv.col - pred_mv.as_mv.col) <= 4)
|
||||
return 2;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
static INLINE int av1_nmv_ctx(const uint8_t ref_mv_count,
|
||||
const CANDIDATE_MV *ref_mv_stack, int ref,
|
||||
int ref_mv_idx) {
|
||||
if (ref_mv_stack[ref_mv_idx].weight >= REF_CAT_LEVEL && ref_mv_count > 0)
|
||||
return ref_mv_stack[ref_mv_idx].pred_diff[ref];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static INLINE int8_t av1_ref_frame_type(const MV_REFERENCE_FRAME *const rf) {
|
||||
if (rf[1] > INTRA_FRAME) {
|
||||
return TOTAL_REFS_PER_FRAME + FWD_RF_OFFSET(rf[0]) +
|
||||
BWD_RF_OFFSET(rf[1]) * FWD_REFS;
|
||||
}
|
||||
|
||||
return rf[0];
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
static MV_REFERENCE_FRAME ref_frame_map[COMP_REFS][2] = {
|
||||
#if CONFIG_EXT_REFS
|
||||
{ LAST_FRAME, BWDREF_FRAME }, { LAST2_FRAME, BWDREF_FRAME },
|
||||
{ LAST3_FRAME, BWDREF_FRAME }, { GOLDEN_FRAME, BWDREF_FRAME },
|
||||
|
||||
{ LAST_FRAME, ALTREF_FRAME }, { LAST2_FRAME, ALTREF_FRAME },
|
||||
{ LAST3_FRAME, ALTREF_FRAME }, { GOLDEN_FRAME, ALTREF_FRAME }
|
||||
#else
|
||||
{ LAST_FRAME, ALTREF_FRAME }, { GOLDEN_FRAME, ALTREF_FRAME }
|
||||
#endif
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static INLINE void av1_set_ref_frame(MV_REFERENCE_FRAME *rf,
|
||||
int8_t ref_frame_type) {
|
||||
if (ref_frame_type >= TOTAL_REFS_PER_FRAME) {
|
||||
rf[0] = ref_frame_map[ref_frame_type - TOTAL_REFS_PER_FRAME][0];
|
||||
rf[1] = ref_frame_map[ref_frame_type - TOTAL_REFS_PER_FRAME][1];
|
||||
} else {
|
||||
rf[0] = ref_frame_type;
|
||||
rf[1] = NONE_FRAME;
|
||||
assert(ref_frame_type > INTRA_FRAME &&
|
||||
ref_frame_type < TOTAL_REFS_PER_FRAME);
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE int16_t av1_mode_context_analyzer(
|
||||
const int16_t *const mode_context, const MV_REFERENCE_FRAME *const rf,
|
||||
BLOCK_SIZE bsize, int block) {
|
||||
int16_t mode_ctx = 0;
|
||||
int8_t ref_frame_type = av1_ref_frame_type(rf);
|
||||
|
||||
if (block >= 0) {
|
||||
mode_ctx = mode_context[rf[0]] & 0x00ff;
|
||||
#if !CONFIG_CB4X4
|
||||
if (block > 0 && bsize < BLOCK_8X8 && bsize > BLOCK_4X4)
|
||||
mode_ctx |= (1 << SKIP_NEARESTMV_SUB8X8_OFFSET);
|
||||
#else
|
||||
(void)block;
|
||||
(void)bsize;
|
||||
#endif
|
||||
|
||||
return mode_ctx;
|
||||
}
|
||||
|
||||
return mode_context[ref_frame_type];
|
||||
}
|
||||
|
||||
static INLINE uint8_t av1_drl_ctx(const CANDIDATE_MV *ref_mv_stack,
|
||||
int ref_idx) {
|
||||
if (ref_mv_stack[ref_idx].weight >= REF_CAT_LEVEL &&
|
||||
ref_mv_stack[ref_idx + 1].weight >= REF_CAT_LEVEL)
|
||||
return 0;
|
||||
|
||||
if (ref_mv_stack[ref_idx].weight >= REF_CAT_LEVEL &&
|
||||
ref_mv_stack[ref_idx + 1].weight < REF_CAT_LEVEL)
|
||||
return 2;
|
||||
|
||||
if (ref_mv_stack[ref_idx].weight < REF_CAT_LEVEL &&
|
||||
ref_mv_stack[ref_idx + 1].weight < REF_CAT_LEVEL)
|
||||
return 3;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef void (*find_mv_refs_sync)(void *const data, int mi_row);
|
||||
void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd,
|
||||
MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame,
|
||||
#if CONFIG_REF_MV
|
||||
uint8_t *ref_mv_count, CANDIDATE_MV *ref_mv_stack,
|
||||
#if CONFIG_EXT_INTER
|
||||
int16_t *compound_mode_context,
|
||||
#endif // CONFIG_EXT_INTER
|
||||
#endif
|
||||
int_mv *mv_ref_list, int mi_row, int mi_col,
|
||||
find_mv_refs_sync sync, void *const data,
|
||||
int16_t *mode_context);
|
||||
|
||||
// check a list of motion vectors by sad score using a number rows of pixels
|
||||
// above and a number cols of pixels in the left to select the one with best
|
||||
// score to use as ref motion vector
|
||||
void av1_find_best_ref_mvs(int allow_hp, int_mv *mvlist, int_mv *nearest_mv,
|
||||
int_mv *near_mv);
|
||||
|
||||
void av1_append_sub8x8_mvs_for_idx(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int block, int ref, int mi_row, int mi_col,
|
||||
#if CONFIG_REF_MV
|
||||
CANDIDATE_MV *ref_mv_stack,
|
||||
uint8_t *ref_mv_count,
|
||||
#endif
|
||||
#if CONFIG_EXT_INTER
|
||||
int_mv *mv_list,
|
||||
#endif // CONFIG_EXT_INTER
|
||||
int_mv *nearest_mv, int_mv *near_mv);
|
||||
|
||||
#if CONFIG_EXT_INTER
|
||||
// This function keeps a mode count for a given MB/SB
|
||||
void av1_update_mv_context(const AV1_COMMON *cm, const MACROBLOCKD *xd,
|
||||
MODE_INFO *mi, MV_REFERENCE_FRAME ref_frame,
|
||||
int_mv *mv_ref_list, int block, int mi_row,
|
||||
int mi_col, int16_t *mode_context);
|
||||
#endif // CONFIG_EXT_INTER
|
||||
|
||||
#if CONFIG_WARPED_MOTION
|
||||
int findSamples(const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row, int mi_col,
|
||||
int *pts, int *pts_inref);
|
||||
#endif // CONFIG_WARPED_MOTION
|
||||
|
||||
#if CONFIG_INTRABC
|
||||
static INLINE void av1_find_ref_dv(int_mv *ref_dv, int mi_row, int mi_col) {
|
||||
// TODO(aconverse@google.com): Handle tiles and such
|
||||
(void)mi_col;
|
||||
if (mi_row < MAX_MIB_SIZE) {
|
||||
ref_dv->as_mv.row = 0;
|
||||
ref_dv->as_mv.col = -MI_SIZE * MAX_MIB_SIZE;
|
||||
} else {
|
||||
ref_dv->as_mv.row = -MI_SIZE * MAX_MIB_SIZE;
|
||||
ref_dv->as_mv.col = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE int is_dv_valid(const MV dv, const TileInfo *const tile,
|
||||
int mi_row, int mi_col, BLOCK_SIZE bsize) {
|
||||
const int bw = block_size_wide[bsize];
|
||||
const int bh = block_size_high[bsize];
|
||||
const int SCALE_PX_TO_MV = 8;
|
||||
// Disallow subpixel for now
|
||||
// SUBPEL_MASK is not the correct scale
|
||||
if ((dv.row & (SCALE_PX_TO_MV - 1) || dv.col & (SCALE_PX_TO_MV - 1)))
|
||||
return 0;
|
||||
// Is the source top-left inside the current tile?
|
||||
const int src_top_edge = mi_row * MI_SIZE * SCALE_PX_TO_MV + dv.row;
|
||||
const int tile_top_edge = tile->mi_row_start * MI_SIZE * SCALE_PX_TO_MV;
|
||||
if (src_top_edge < tile_top_edge) return 0;
|
||||
const int src_left_edge = mi_col * MI_SIZE * SCALE_PX_TO_MV + dv.col;
|
||||
const int tile_left_edge = tile->mi_col_start * MI_SIZE * SCALE_PX_TO_MV;
|
||||
if (src_left_edge < tile_left_edge) return 0;
|
||||
// Is the bottom right inside the current tile?
|
||||
const int src_bottom_edge = (mi_row * MI_SIZE + bh) * SCALE_PX_TO_MV + dv.row;
|
||||
const int tile_bottom_edge = tile->mi_row_end * MI_SIZE * SCALE_PX_TO_MV;
|
||||
if (src_bottom_edge > tile_bottom_edge) return 0;
|
||||
const int src_right_edge = (mi_col * MI_SIZE + bw) * SCALE_PX_TO_MV + dv.col;
|
||||
const int tile_right_edge = tile->mi_col_end * MI_SIZE * SCALE_PX_TO_MV;
|
||||
if (src_right_edge > tile_right_edge) return 0;
|
||||
// Is the bottom right within an already coded SB?
|
||||
const int active_sb_top_edge =
|
||||
(mi_row & ~MAX_MIB_MASK) * MI_SIZE * SCALE_PX_TO_MV;
|
||||
const int active_sb_bottom_edge =
|
||||
((mi_row & ~MAX_MIB_MASK) + MAX_MIB_SIZE) * MI_SIZE * SCALE_PX_TO_MV;
|
||||
const int active_sb_left_edge =
|
||||
(mi_col & ~MAX_MIB_MASK) * MI_SIZE * SCALE_PX_TO_MV;
|
||||
if (src_bottom_edge > active_sb_bottom_edge) return 0;
|
||||
if (src_bottom_edge > active_sb_top_edge &&
|
||||
src_right_edge > active_sb_left_edge)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
#endif // CONFIG_INTRABC
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // AV1_COMMON_MVREF_COMMON_H_
|
||||
416
third_party/aom/av1/common/od_dering.c
vendored
Normal file
416
third_party/aom/av1/common/od_dering.c
vendored
Normal file
|
|
@ -0,0 +1,416 @@
|
|||
/*
|
||||
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
|
||||
*
|
||||
* This source code is subject to the terms of the BSD 2 Clause License and
|
||||
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
|
||||
* was not distributed with this source code in the LICENSE file, you can
|
||||
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
|
||||
* Media Patent License 1.0 was not distributed with this source code in the
|
||||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "./config.h"
|
||||
#endif
|
||||
|
||||
#include "./aom_dsp_rtcd.h"
|
||||
#include "./av1_rtcd.h"
|
||||
#include "./cdef.h"
|
||||
|
||||
/* Generated from gen_filter_tables.c. */
|
||||
const int OD_DIRECTION_OFFSETS_TABLE[8][3] = {
|
||||
{ -1 * OD_FILT_BSTRIDE + 1, -2 * OD_FILT_BSTRIDE + 2,
|
||||
-3 * OD_FILT_BSTRIDE + 3 },
|
||||
{ 0 * OD_FILT_BSTRIDE + 1, -1 * OD_FILT_BSTRIDE + 2,
|
||||
-1 * OD_FILT_BSTRIDE + 3 },
|
||||
{ 0 * OD_FILT_BSTRIDE + 1, 0 * OD_FILT_BSTRIDE + 2, 0 * OD_FILT_BSTRIDE + 3 },
|
||||
{ 0 * OD_FILT_BSTRIDE + 1, 1 * OD_FILT_BSTRIDE + 2, 1 * OD_FILT_BSTRIDE + 3 },
|
||||
{ 1 * OD_FILT_BSTRIDE + 1, 2 * OD_FILT_BSTRIDE + 2, 3 * OD_FILT_BSTRIDE + 3 },
|
||||
{ 1 * OD_FILT_BSTRIDE + 0, 2 * OD_FILT_BSTRIDE + 1, 3 * OD_FILT_BSTRIDE + 1 },
|
||||
{ 1 * OD_FILT_BSTRIDE + 0, 2 * OD_FILT_BSTRIDE + 0, 3 * OD_FILT_BSTRIDE + 0 },
|
||||
{ 1 * OD_FILT_BSTRIDE + 0, 2 * OD_FILT_BSTRIDE - 1, 3 * OD_FILT_BSTRIDE - 1 },
|
||||
};
|
||||
|
||||
/* Detect direction. 0 means 45-degree up-right, 2 is horizontal, and so on.
|
||||
The search minimizes the weighted variance along all the lines in a
|
||||
particular direction, i.e. the squared error between the input and a
|
||||
"predicted" block where each pixel is replaced by the average along a line
|
||||
in a particular direction. Since each direction have the same sum(x^2) term,
|
||||
that term is never computed. See Section 2, step 2, of:
|
||||
http://jmvalin.ca/notes/intra_paint.pdf */
|
||||
int od_dir_find8_c(const uint16_t *img, int stride, int32_t *var,
|
||||
int coeff_shift) {
|
||||
int i;
|
||||
int32_t cost[8] = { 0 };
|
||||
int partial[8][15] = { { 0 } };
|
||||
int32_t best_cost = 0;
|
||||
int best_dir = 0;
|
||||
/* Instead of dividing by n between 2 and 8, we multiply by 3*5*7*8/n.
|
||||
The output is then 840 times larger, but we don't care for finding
|
||||
the max. */
|
||||
static const int div_table[] = { 0, 840, 420, 280, 210, 168, 140, 120, 105 };
|
||||
for (i = 0; i < 8; i++) {
|
||||
int j;
|
||||
for (j = 0; j < 8; j++) {
|
||||
int x;
|
||||
/* We subtract 128 here to reduce the maximum range of the squared
|
||||
partial sums. */
|
||||
x = (img[i * stride + j] >> coeff_shift) - 128;
|
||||
partial[0][i + j] += x;
|
||||
partial[1][i + j / 2] += x;
|
||||
partial[2][i] += x;
|
||||
partial[3][3 + i - j / 2] += x;
|
||||
partial[4][7 + i - j] += x;
|
||||
partial[5][3 - i / 2 + j] += x;
|
||||
partial[6][j] += x;
|
||||
partial[7][i / 2 + j] += x;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 8; i++) {
|
||||
cost[2] += partial[2][i] * partial[2][i];
|
||||
cost[6] += partial[6][i] * partial[6][i];
|
||||
}
|
||||
cost[2] *= div_table[8];
|
||||
cost[6] *= div_table[8];
|
||||
for (i = 0; i < 7; i++) {
|
||||
cost[0] += (partial[0][i] * partial[0][i] +
|
||||
partial[0][14 - i] * partial[0][14 - i]) *
|
||||
div_table[i + 1];
|
||||
cost[4] += (partial[4][i] * partial[4][i] +
|
||||
partial[4][14 - i] * partial[4][14 - i]) *
|
||||
div_table[i + 1];
|
||||
}
|
||||
cost[0] += partial[0][7] * partial[0][7] * div_table[8];
|
||||
cost[4] += partial[4][7] * partial[4][7] * div_table[8];
|
||||
for (i = 1; i < 8; i += 2) {
|
||||
int j;
|
||||
for (j = 0; j < 4 + 1; j++) {
|
||||
cost[i] += partial[i][3 + j] * partial[i][3 + j];
|
||||
}
|
||||
cost[i] *= div_table[8];
|
||||
for (j = 0; j < 4 - 1; j++) {
|
||||
cost[i] += (partial[i][j] * partial[i][j] +
|
||||
partial[i][10 - j] * partial[i][10 - j]) *
|
||||
div_table[2 * j + 2];
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (cost[i] > best_cost) {
|
||||
best_cost = cost[i];
|
||||
best_dir = i;
|
||||
}
|
||||
}
|
||||
/* Difference between the optimal variance and the variance along the
|
||||
orthogonal direction. Again, the sum(x^2) terms cancel out. */
|
||||
*var = best_cost - cost[(best_dir + 4) & 7];
|
||||
/* We'd normally divide by 840, but dividing by 1024 is close enough
|
||||
for what we're going to do with this. */
|
||||
*var >>= 10;
|
||||
return best_dir;
|
||||
}
|
||||
|
||||
/* Smooth in the direction detected. */
|
||||
void od_filter_dering_direction_8x8_c(uint16_t *y, int ystride,
|
||||
const uint16_t *in, int threshold,
|
||||
int dir, int damping) {
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
static const int taps[3] = { 3, 2, 1 };
|
||||
for (i = 0; i < 8; i++) {
|
||||
for (j = 0; j < 8; j++) {
|
||||
int16_t sum;
|
||||
int16_t xx;
|
||||
int16_t yy;
|
||||
xx = in[i * OD_FILT_BSTRIDE + j];
|
||||
sum = 0;
|
||||
for (k = 0; k < 3; k++) {
|
||||
int16_t p0;
|
||||
int16_t p1;
|
||||
p0 = in[i * OD_FILT_BSTRIDE + j + OD_DIRECTION_OFFSETS_TABLE[dir][k]] -
|
||||
xx;
|
||||
p1 = in[i * OD_FILT_BSTRIDE + j - OD_DIRECTION_OFFSETS_TABLE[dir][k]] -
|
||||
xx;
|
||||
sum += taps[k] * constrain(p0, threshold, damping);
|
||||
sum += taps[k] * constrain(p1, threshold, damping);
|
||||
}
|
||||
sum = (sum + 8) >> 4;
|
||||
yy = xx + sum;
|
||||
y[i * ystride + j] = yy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Smooth in the direction detected. */
|
||||
void od_filter_dering_direction_4x4_c(uint16_t *y, int ystride,
|
||||
const uint16_t *in, int threshold,
|
||||
int dir, int damping) {
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
static const int taps[2] = { 4, 1 };
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (j = 0; j < 4; j++) {
|
||||
int16_t sum;
|
||||
int16_t xx;
|
||||
int16_t yy;
|
||||
xx = in[i * OD_FILT_BSTRIDE + j];
|
||||
sum = 0;
|
||||
for (k = 0; k < 2; k++) {
|
||||
int16_t p0;
|
||||
int16_t p1;
|
||||
p0 = in[i * OD_FILT_BSTRIDE + j + OD_DIRECTION_OFFSETS_TABLE[dir][k]] -
|
||||
xx;
|
||||
p1 = in[i * OD_FILT_BSTRIDE + j - OD_DIRECTION_OFFSETS_TABLE[dir][k]] -
|
||||
xx;
|
||||
sum += taps[k] * constrain(p0, threshold, damping);
|
||||
sum += taps[k] * constrain(p1, threshold, damping);
|
||||
}
|
||||
sum = (sum + 8) >> 4;
|
||||
yy = xx + sum;
|
||||
y[i * ystride + j] = yy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Compute deringing filter threshold for an 8x8 block based on the
|
||||
directional variance difference. A high variance difference means that we
|
||||
have a highly directional pattern (e.g. a high contrast edge), so we can
|
||||
apply more deringing. A low variance means that we either have a low
|
||||
contrast edge, or a non-directional texture, so we want to be careful not
|
||||
to blur. */
|
||||
static INLINE int od_adjust_thresh(int threshold, int32_t var) {
|
||||
const int i = var >> 6 ? AOMMIN(get_msb(var >> 6), 12) : 0;
|
||||
/* We use the variance of 8x8 blocks to adjust the threshold. */
|
||||
return var ? (threshold * (4 + i) + 8) >> 4 : 0;
|
||||
}
|
||||
|
||||
void copy_8x8_16bit_to_16bit_c(uint16_t *dst, int dstride, const uint16_t *src,
|
||||
int sstride) {
|
||||
int i, j;
|
||||
for (i = 0; i < 8; i++)
|
||||
for (j = 0; j < 8; j++) dst[i * dstride + j] = src[i * sstride + j];
|
||||
}
|
||||
|
||||
void copy_4x4_16bit_to_16bit_c(uint16_t *dst, int dstride, const uint16_t *src,
|
||||
int sstride) {
|
||||
int i, j;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0; j < 4; j++) dst[i * dstride + j] = src[i * sstride + j];
|
||||
}
|
||||
|
||||
void copy_dering_16bit_to_16bit(uint16_t *dst, int dstride, uint16_t *src,
|
||||
dering_list *dlist, int dering_count,
|
||||
int bsize) {
|
||||
int bi, bx, by;
|
||||
|
||||
if (bsize == BLOCK_8X8) {
|
||||
for (bi = 0; bi < dering_count; bi++) {
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
copy_8x8_16bit_to_16bit(&dst[(by << 3) * dstride + (bx << 3)], dstride,
|
||||
&src[bi << (3 + 3)], 8);
|
||||
}
|
||||
} else if (bsize == BLOCK_4X8) {
|
||||
for (bi = 0; bi < dering_count; bi++) {
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
copy_4x4_16bit_to_16bit(&dst[(by << 3) * dstride + (bx << 2)], dstride,
|
||||
&src[bi << (3 + 2)], 4);
|
||||
copy_4x4_16bit_to_16bit(&dst[((by << 3) + 4) * dstride + (bx << 2)],
|
||||
dstride, &src[(bi << (3 + 2)) + 4 * 4], 4);
|
||||
}
|
||||
} else if (bsize == BLOCK_8X4) {
|
||||
for (bi = 0; bi < dering_count; bi++) {
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
copy_4x4_16bit_to_16bit(&dst[(by << 2) * dstride + (bx << 3)], dstride,
|
||||
&src[bi << (2 + 3)], 8);
|
||||
copy_4x4_16bit_to_16bit(&dst[(by << 2) * dstride + (bx << 3) + 4],
|
||||
dstride, &src[(bi << (2 + 3)) + 4], 8);
|
||||
}
|
||||
} else {
|
||||
assert(bsize == BLOCK_4X4);
|
||||
for (bi = 0; bi < dering_count; bi++) {
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
copy_4x4_16bit_to_16bit(&dst[(by << 2) * dstride + (bx << 2)], dstride,
|
||||
&src[bi << (2 + 2)], 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void copy_8x8_16bit_to_8bit_c(uint8_t *dst, int dstride, const uint16_t *src,
|
||||
int sstride) {
|
||||
int i, j;
|
||||
for (i = 0; i < 8; i++)
|
||||
for (j = 0; j < 8; j++)
|
||||
dst[i * dstride + j] = (uint8_t)src[i * sstride + j];
|
||||
}
|
||||
|
||||
void copy_4x4_16bit_to_8bit_c(uint8_t *dst, int dstride, const uint16_t *src,
|
||||
int sstride) {
|
||||
int i, j;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0; j < 4; j++)
|
||||
dst[i * dstride + j] = (uint8_t)src[i * sstride + j];
|
||||
}
|
||||
|
||||
static void copy_dering_16bit_to_8bit(uint8_t *dst, int dstride,
|
||||
const uint16_t *src, dering_list *dlist,
|
||||
int dering_count, int bsize) {
|
||||
int bi, bx, by;
|
||||
if (bsize == BLOCK_8X8) {
|
||||
for (bi = 0; bi < dering_count; bi++) {
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
copy_8x8_16bit_to_8bit(&dst[(by << 3) * dstride + (bx << 3)], dstride,
|
||||
&src[bi << (3 + 3)], 8);
|
||||
}
|
||||
} else if (bsize == BLOCK_4X8) {
|
||||
for (bi = 0; bi < dering_count; bi++) {
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
copy_4x4_16bit_to_8bit(&dst[(by << 3) * dstride + (bx << 2)], dstride,
|
||||
&src[bi << (3 + 2)], 4);
|
||||
copy_4x4_16bit_to_8bit(&dst[((by << 3) + 4) * dstride + (bx << 2)],
|
||||
dstride, &src[(bi << (3 + 2)) + 4 * 4], 4);
|
||||
}
|
||||
} else if (bsize == BLOCK_8X4) {
|
||||
for (bi = 0; bi < dering_count; bi++) {
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
copy_4x4_16bit_to_8bit(&dst[(by << 2) * dstride + (bx << 3)], dstride,
|
||||
&src[bi << (2 + 3)], 8);
|
||||
copy_4x4_16bit_to_8bit(&dst[(by << 2) * dstride + (bx << 3) + 4], dstride,
|
||||
&src[(bi << (2 + 3)) + 4], 8);
|
||||
}
|
||||
} else {
|
||||
assert(bsize == BLOCK_4X4);
|
||||
for (bi = 0; bi < dering_count; bi++) {
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
copy_4x4_16bit_to_8bit(&dst[(by << 2) * dstride + (bx << 2)], dstride,
|
||||
&src[bi << (2 * 2)], 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int get_filter_skip(int level) {
|
||||
int filter_skip = level & 1;
|
||||
if (level == 1) filter_skip = 0;
|
||||
return filter_skip;
|
||||
}
|
||||
|
||||
void od_dering(uint8_t *dst, int dstride, uint16_t *y, uint16_t *in, int xdec,
|
||||
int ydec, int dir[OD_DERING_NBLOCKS][OD_DERING_NBLOCKS],
|
||||
int *dirinit, int var[OD_DERING_NBLOCKS][OD_DERING_NBLOCKS],
|
||||
int pli, dering_list *dlist, int dering_count, int level,
|
||||
int clpf_strength, int clpf_damping, int dering_damping,
|
||||
int coeff_shift, int skip_dering, int hbd) {
|
||||
int bi;
|
||||
int bx;
|
||||
int by;
|
||||
int bsize, bsizex, bsizey;
|
||||
|
||||
int threshold = (level >> 1) << coeff_shift;
|
||||
int filter_skip = get_filter_skip(level);
|
||||
if (level == 1) threshold = 31 << coeff_shift;
|
||||
|
||||
od_filter_dering_direction_func filter_dering_direction[] = {
|
||||
od_filter_dering_direction_4x4, od_filter_dering_direction_8x8
|
||||
};
|
||||
clpf_damping += coeff_shift - (pli != AOM_PLANE_Y);
|
||||
dering_damping += coeff_shift - (pli != AOM_PLANE_Y);
|
||||
bsize =
|
||||
ydec ? (xdec ? BLOCK_4X4 : BLOCK_8X4) : (xdec ? BLOCK_4X8 : BLOCK_8X8);
|
||||
bsizex = 3 - xdec;
|
||||
bsizey = 3 - ydec;
|
||||
|
||||
if (!skip_dering) {
|
||||
if (pli == 0) {
|
||||
if (!dirinit || !*dirinit) {
|
||||
for (bi = 0; bi < dering_count; bi++) {
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
dir[by][bx] =
|
||||
od_dir_find8(&in[8 * by * OD_FILT_BSTRIDE + 8 * bx],
|
||||
OD_FILT_BSTRIDE, &var[by][bx], coeff_shift);
|
||||
}
|
||||
if (dirinit) *dirinit = 1;
|
||||
}
|
||||
}
|
||||
// Only run dering for non-zero threshold (which is always the case for
|
||||
// 4:2:2 or 4:4:0). If we don't dering, we still need to eventually write
|
||||
// something out in y[] later.
|
||||
if (threshold != 0) {
|
||||
assert(bsize == BLOCK_8X8 || bsize == BLOCK_4X4);
|
||||
for (bi = 0; bi < dering_count; bi++) {
|
||||
int t = !filter_skip && dlist[bi].skip ? 0 : threshold;
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
(filter_dering_direction[bsize == BLOCK_8X8])(
|
||||
&y[bi << (bsizex + bsizey)], 1 << bsizex,
|
||||
&in[(by * OD_FILT_BSTRIDE << bsizey) + (bx << bsizex)],
|
||||
pli ? t : od_adjust_thresh(t, var[by][bx]), dir[by][bx],
|
||||
dering_damping);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (clpf_strength) {
|
||||
if (threshold && !skip_dering)
|
||||
copy_dering_16bit_to_16bit(in, OD_FILT_BSTRIDE, y, dlist, dering_count,
|
||||
bsize);
|
||||
for (bi = 0; bi < dering_count; bi++) {
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
int py = by << bsizey;
|
||||
int px = bx << bsizex;
|
||||
|
||||
if (!filter_skip && dlist[bi].skip) continue;
|
||||
if (!dst || hbd) {
|
||||
// 16 bit destination if high bitdepth or 8 bit destination not given
|
||||
(!threshold || (dir[by][bx] < 4 && dir[by][bx]) ? aom_clpf_block_hbd
|
||||
: aom_clpf_hblock_hbd)(
|
||||
dst ? (uint16_t *)dst + py * dstride + px
|
||||
: &y[bi << (bsizex + bsizey)],
|
||||
in + py * OD_FILT_BSTRIDE + px, dst && hbd ? dstride : 1 << bsizex,
|
||||
OD_FILT_BSTRIDE, 1 << bsizex, 1 << bsizey,
|
||||
clpf_strength << coeff_shift, clpf_damping);
|
||||
} else {
|
||||
// Do clpf and write the result to an 8 bit destination
|
||||
(!threshold || (dir[by][bx] < 4 && dir[by][bx]) ? aom_clpf_block
|
||||
: aom_clpf_hblock)(
|
||||
dst + py * dstride + px, in + py * OD_FILT_BSTRIDE + px, dstride,
|
||||
OD_FILT_BSTRIDE, 1 << bsizex, 1 << bsizey,
|
||||
clpf_strength << coeff_shift, clpf_damping);
|
||||
}
|
||||
}
|
||||
} else if (threshold != 0) {
|
||||
// No clpf, so copy instead
|
||||
if (hbd) {
|
||||
copy_dering_16bit_to_16bit((uint16_t *)dst, dstride, y, dlist,
|
||||
dering_count, bsize);
|
||||
} else {
|
||||
copy_dering_16bit_to_8bit(dst, dstride, y, dlist, dering_count, bsize);
|
||||
}
|
||||
} else if (dirinit) {
|
||||
// If we're here, both dering and clpf are off, and we still haven't written
|
||||
// anything to y[] yet, so we just copy the input to y[]. This is necessary
|
||||
// only for av1_cdef_search() and only av1_cdef_search() sets dirinit.
|
||||
for (bi = 0; bi < dering_count; bi++) {
|
||||
by = dlist[bi].by;
|
||||
bx = dlist[bi].bx;
|
||||
int iy, ix;
|
||||
// TODO(stemidts/jmvalin): SIMD optimisations
|
||||
for (iy = 0; iy < 1 << bsizey; iy++)
|
||||
for (ix = 0; ix < 1 << bsizex; ix++)
|
||||
y[(bi << (bsizex + bsizey)) + (iy << bsizex) + ix] =
|
||||
in[((by << bsizey) + iy) * OD_FILT_BSTRIDE + (bx << bsizex) + ix];
|
||||
}
|
||||
}
|
||||
}
|
||||
54
third_party/aom/av1/common/od_dering.h
vendored
Normal file
54
third_party/aom/av1/common/od_dering.h
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#if !defined(_dering_H)
|
||||
#define _dering_H (1)
|
||||
|
||||
#include "odintrin.h"
|
||||
|
||||
#define OD_DERING_NBLOCKS (MAX_SB_SIZE / 8)
|
||||
|
||||
/* We need to buffer three vertical lines. */
|
||||
#define OD_FILT_VBORDER (3)
|
||||
/* We only need to buffer three horizontal pixels too, but let's align to
|
||||
16 bytes (8 x 16 bits) to make vectorization easier. */
|
||||
#define OD_FILT_HBORDER (8)
|
||||
#define OD_FILT_BSTRIDE ALIGN_POWER_OF_TWO(MAX_SB_SIZE + 2 * OD_FILT_HBORDER, 3)
|
||||
|
||||
#define OD_DERING_VERY_LARGE (30000)
|
||||
#define OD_DERING_INBUF_SIZE \
|
||||
(OD_FILT_BSTRIDE * (MAX_SB_SIZE + 2 * OD_FILT_VBORDER))
|
||||
|
||||
extern const int OD_DIRECTION_OFFSETS_TABLE[8][3];
|
||||
|
||||
typedef struct {
|
||||
uint8_t by;
|
||||
uint8_t bx;
|
||||
uint8_t skip;
|
||||
} dering_list;
|
||||
|
||||
typedef void (*od_filter_dering_direction_func)(uint16_t *y, int ystride,
|
||||
const uint16_t *in,
|
||||
int threshold, int dir,
|
||||
int damping);
|
||||
void copy_dering_16bit_to_16bit(uint16_t *dst, int dstride, uint16_t *src,
|
||||
dering_list *dlist, int dering_count,
|
||||
int bsize);
|
||||
|
||||
int get_filter_skip(int level);
|
||||
|
||||
void od_dering(uint8_t *dst, int dstride, uint16_t *y, uint16_t *in, int xdec,
|
||||
int ydec, int dir[OD_DERING_NBLOCKS][OD_DERING_NBLOCKS],
|
||||
int *dirinit, int var[OD_DERING_NBLOCKS][OD_DERING_NBLOCKS],
|
||||
int pli, dering_list *dlist, int dering_count, int level,
|
||||
int clpf_strength, int clpf_damping, int dering_damping,
|
||||
int coeff_shift, int skip_dering, int hbd);
|
||||
#endif
|
||||
14
third_party/aom/av1/common/od_dering_neon.c
vendored
Normal file
14
third_party/aom/av1/common/od_dering_neon.c
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* 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/aom_simd.h"
|
||||
#define SIMD_FUNC(name) name##_neon
|
||||
#include "./od_dering_simd.h"
|
||||
390
third_party/aom/av1/common/od_dering_simd.h
vendored
Normal file
390
third_party/aom/av1/common/od_dering_simd.h
vendored
Normal file
|
|
@ -0,0 +1,390 @@
|
|||
/*
|
||||
* 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 "./av1_rtcd.h"
|
||||
#include "./cdef_simd.h"
|
||||
#include "./od_dering.h"
|
||||
|
||||
/* partial A is a 16-bit vector of the form:
|
||||
[x8 x7 x6 x5 x4 x3 x2 x1] and partial B has the form:
|
||||
[0 y1 y2 y3 y4 y5 y6 y7].
|
||||
This function computes (x1^2+y1^2)*C1 + (x2^2+y2^2)*C2 + ...
|
||||
(x7^2+y2^7)*C7 + (x8^2+0^2)*C8 where the C1..C8 constants are in const1
|
||||
and const2. */
|
||||
static INLINE v128 fold_mul_and_sum(v128 partiala, v128 partialb, v128 const1,
|
||||
v128 const2) {
|
||||
v128 tmp;
|
||||
/* Reverse partial B. */
|
||||
partialb = v128_shuffle_8(
|
||||
partialb, v128_from_32(0x0f0e0100, 0x03020504, 0x07060908, 0x0b0a0d0c));
|
||||
/* Interleave the x and y values of identical indices and pair x8 with 0. */
|
||||
tmp = partiala;
|
||||
partiala = v128_ziplo_16(partialb, partiala);
|
||||
partialb = v128_ziphi_16(partialb, tmp);
|
||||
/* Square and add the corresponding x and y values. */
|
||||
partiala = v128_madd_s16(partiala, partiala);
|
||||
partialb = v128_madd_s16(partialb, partialb);
|
||||
/* Multiply by constant. */
|
||||
partiala = v128_mullo_s32(partiala, const1);
|
||||
partialb = v128_mullo_s32(partialb, const2);
|
||||
/* Sum all results. */
|
||||
partiala = v128_add_32(partiala, partialb);
|
||||
return partiala;
|
||||
}
|
||||
|
||||
static INLINE v128 hsum4(v128 x0, v128 x1, v128 x2, v128 x3) {
|
||||
v128 t0, t1, t2, t3;
|
||||
t0 = v128_ziplo_32(x1, x0);
|
||||
t1 = v128_ziplo_32(x3, x2);
|
||||
t2 = v128_ziphi_32(x1, x0);
|
||||
t3 = v128_ziphi_32(x3, x2);
|
||||
x0 = v128_ziplo_64(t1, t0);
|
||||
x1 = v128_ziphi_64(t1, t0);
|
||||
x2 = v128_ziplo_64(t3, t2);
|
||||
x3 = v128_ziphi_64(t3, t2);
|
||||
return v128_add_32(v128_add_32(x0, x1), v128_add_32(x2, x3));
|
||||
}
|
||||
|
||||
/* Computes cost for directions 0, 5, 6 and 7. We can call this function again
|
||||
to compute the remaining directions. */
|
||||
static INLINE v128 compute_directions(v128 lines[8], int32_t tmp_cost1[4]) {
|
||||
v128 partial4a, partial4b, partial5a, partial5b, partial7a, partial7b;
|
||||
v128 partial6;
|
||||
v128 tmp;
|
||||
/* Partial sums for lines 0 and 1. */
|
||||
partial4a = v128_shl_n_byte(lines[0], 14);
|
||||
partial4b = v128_shr_n_byte(lines[0], 2);
|
||||
partial4a = v128_add_16(partial4a, v128_shl_n_byte(lines[1], 12));
|
||||
partial4b = v128_add_16(partial4b, v128_shr_n_byte(lines[1], 4));
|
||||
tmp = v128_add_16(lines[0], lines[1]);
|
||||
partial5a = v128_shl_n_byte(tmp, 10);
|
||||
partial5b = v128_shr_n_byte(tmp, 6);
|
||||
partial7a = v128_shl_n_byte(tmp, 4);
|
||||
partial7b = v128_shr_n_byte(tmp, 12);
|
||||
partial6 = tmp;
|
||||
|
||||
/* Partial sums for lines 2 and 3. */
|
||||
partial4a = v128_add_16(partial4a, v128_shl_n_byte(lines[2], 10));
|
||||
partial4b = v128_add_16(partial4b, v128_shr_n_byte(lines[2], 6));
|
||||
partial4a = v128_add_16(partial4a, v128_shl_n_byte(lines[3], 8));
|
||||
partial4b = v128_add_16(partial4b, v128_shr_n_byte(lines[3], 8));
|
||||
tmp = v128_add_16(lines[2], lines[3]);
|
||||
partial5a = v128_add_16(partial5a, v128_shl_n_byte(tmp, 8));
|
||||
partial5b = v128_add_16(partial5b, v128_shr_n_byte(tmp, 8));
|
||||
partial7a = v128_add_16(partial7a, v128_shl_n_byte(tmp, 6));
|
||||
partial7b = v128_add_16(partial7b, v128_shr_n_byte(tmp, 10));
|
||||
partial6 = v128_add_16(partial6, tmp);
|
||||
|
||||
/* Partial sums for lines 4 and 5. */
|
||||
partial4a = v128_add_16(partial4a, v128_shl_n_byte(lines[4], 6));
|
||||
partial4b = v128_add_16(partial4b, v128_shr_n_byte(lines[4], 10));
|
||||
partial4a = v128_add_16(partial4a, v128_shl_n_byte(lines[5], 4));
|
||||
partial4b = v128_add_16(partial4b, v128_shr_n_byte(lines[5], 12));
|
||||
tmp = v128_add_16(lines[4], lines[5]);
|
||||
partial5a = v128_add_16(partial5a, v128_shl_n_byte(tmp, 6));
|
||||
partial5b = v128_add_16(partial5b, v128_shr_n_byte(tmp, 10));
|
||||
partial7a = v128_add_16(partial7a, v128_shl_n_byte(tmp, 8));
|
||||
partial7b = v128_add_16(partial7b, v128_shr_n_byte(tmp, 8));
|
||||
partial6 = v128_add_16(partial6, tmp);
|
||||
|
||||
/* Partial sums for lines 6 and 7. */
|
||||
partial4a = v128_add_16(partial4a, v128_shl_n_byte(lines[6], 2));
|
||||
partial4b = v128_add_16(partial4b, v128_shr_n_byte(lines[6], 14));
|
||||
partial4a = v128_add_16(partial4a, lines[7]);
|
||||
tmp = v128_add_16(lines[6], lines[7]);
|
||||
partial5a = v128_add_16(partial5a, v128_shl_n_byte(tmp, 4));
|
||||
partial5b = v128_add_16(partial5b, v128_shr_n_byte(tmp, 12));
|
||||
partial7a = v128_add_16(partial7a, v128_shl_n_byte(tmp, 10));
|
||||
partial7b = v128_add_16(partial7b, v128_shr_n_byte(tmp, 6));
|
||||
partial6 = v128_add_16(partial6, tmp);
|
||||
|
||||
/* Compute costs in terms of partial sums. */
|
||||
partial4a =
|
||||
fold_mul_and_sum(partial4a, partial4b, v128_from_32(210, 280, 420, 840),
|
||||
v128_from_32(105, 120, 140, 168));
|
||||
partial7a =
|
||||
fold_mul_and_sum(partial7a, partial7b, v128_from_32(210, 420, 0, 0),
|
||||
v128_from_32(105, 105, 105, 140));
|
||||
partial5a =
|
||||
fold_mul_and_sum(partial5a, partial5b, v128_from_32(210, 420, 0, 0),
|
||||
v128_from_32(105, 105, 105, 140));
|
||||
partial6 = v128_madd_s16(partial6, partial6);
|
||||
partial6 = v128_mullo_s32(partial6, v128_dup_32(105));
|
||||
|
||||
partial4a = hsum4(partial4a, partial5a, partial6, partial7a);
|
||||
v128_store_unaligned(tmp_cost1, partial4a);
|
||||
return partial4a;
|
||||
}
|
||||
|
||||
/* transpose and reverse the order of the lines -- equivalent to a 90-degree
|
||||
counter-clockwise rotation of the pixels. */
|
||||
static INLINE void array_reverse_transpose_8x8(v128 *in, v128 *res) {
|
||||
const v128 tr0_0 = v128_ziplo_16(in[1], in[0]);
|
||||
const v128 tr0_1 = v128_ziplo_16(in[3], in[2]);
|
||||
const v128 tr0_2 = v128_ziphi_16(in[1], in[0]);
|
||||
const v128 tr0_3 = v128_ziphi_16(in[3], in[2]);
|
||||
const v128 tr0_4 = v128_ziplo_16(in[5], in[4]);
|
||||
const v128 tr0_5 = v128_ziplo_16(in[7], in[6]);
|
||||
const v128 tr0_6 = v128_ziphi_16(in[5], in[4]);
|
||||
const v128 tr0_7 = v128_ziphi_16(in[7], in[6]);
|
||||
|
||||
const v128 tr1_0 = v128_ziplo_32(tr0_1, tr0_0);
|
||||
const v128 tr1_1 = v128_ziplo_32(tr0_5, tr0_4);
|
||||
const v128 tr1_2 = v128_ziphi_32(tr0_1, tr0_0);
|
||||
const v128 tr1_3 = v128_ziphi_32(tr0_5, tr0_4);
|
||||
const v128 tr1_4 = v128_ziplo_32(tr0_3, tr0_2);
|
||||
const v128 tr1_5 = v128_ziplo_32(tr0_7, tr0_6);
|
||||
const v128 tr1_6 = v128_ziphi_32(tr0_3, tr0_2);
|
||||
const v128 tr1_7 = v128_ziphi_32(tr0_7, tr0_6);
|
||||
|
||||
res[7] = v128_ziplo_64(tr1_1, tr1_0);
|
||||
res[6] = v128_ziphi_64(tr1_1, tr1_0);
|
||||
res[5] = v128_ziplo_64(tr1_3, tr1_2);
|
||||
res[4] = v128_ziphi_64(tr1_3, tr1_2);
|
||||
res[3] = v128_ziplo_64(tr1_5, tr1_4);
|
||||
res[2] = v128_ziphi_64(tr1_5, tr1_4);
|
||||
res[1] = v128_ziplo_64(tr1_7, tr1_6);
|
||||
res[0] = v128_ziphi_64(tr1_7, tr1_6);
|
||||
}
|
||||
|
||||
int SIMD_FUNC(od_dir_find8)(const od_dering_in *img, int stride, int32_t *var,
|
||||
int coeff_shift) {
|
||||
int i;
|
||||
int32_t cost[8];
|
||||
int32_t best_cost = 0;
|
||||
int best_dir = 0;
|
||||
v128 lines[8];
|
||||
for (i = 0; i < 8; i++) {
|
||||
lines[i] = v128_load_unaligned(&img[i * stride]);
|
||||
lines[i] =
|
||||
v128_sub_16(v128_shr_s16(lines[i], coeff_shift), v128_dup_16(128));
|
||||
}
|
||||
|
||||
#if defined(__SSE4_1__)
|
||||
/* Compute "mostly vertical" directions. */
|
||||
__m128i dir47 = compute_directions(lines, cost + 4);
|
||||
|
||||
array_reverse_transpose_8x8(lines, lines);
|
||||
|
||||
/* Compute "mostly horizontal" directions. */
|
||||
__m128i dir03 = compute_directions(lines, cost);
|
||||
|
||||
__m128i max = _mm_max_epi32(dir03, dir47);
|
||||
max = _mm_max_epi32(max, _mm_shuffle_epi32(max, _MM_SHUFFLE(1, 0, 3, 2)));
|
||||
max = _mm_max_epi32(max, _mm_shuffle_epi32(max, _MM_SHUFFLE(2, 3, 0, 1)));
|
||||
best_cost = _mm_cvtsi128_si32(max);
|
||||
__m128i t =
|
||||
_mm_packs_epi32(_mm_cmpeq_epi32(max, dir03), _mm_cmpeq_epi32(max, dir47));
|
||||
best_dir = _mm_movemask_epi8(_mm_packs_epi16(t, t));
|
||||
best_dir = get_msb(best_dir ^ (best_dir - 1)); // Count trailing zeros
|
||||
#else
|
||||
/* Compute "mostly vertical" directions. */
|
||||
compute_directions(lines, cost + 4);
|
||||
|
||||
array_reverse_transpose_8x8(lines, lines);
|
||||
|
||||
/* Compute "mostly horizontal" directions. */
|
||||
compute_directions(lines, cost);
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (cost[i] > best_cost) {
|
||||
best_cost = cost[i];
|
||||
best_dir = i;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Difference between the optimal variance and the variance along the
|
||||
orthogonal direction. Again, the sum(x^2) terms cancel out. */
|
||||
*var = best_cost - cost[(best_dir + 4) & 7];
|
||||
/* We'd normally divide by 840, but dividing by 1024 is close enough
|
||||
for what we're going to do with this. */
|
||||
*var >>= 10;
|
||||
return best_dir;
|
||||
}
|
||||
|
||||
void SIMD_FUNC(od_filter_dering_direction_4x4)(uint16_t *y, int ystride,
|
||||
const uint16_t *in,
|
||||
int threshold, int dir,
|
||||
int damping) {
|
||||
int i;
|
||||
v128 p0, p1, sum, row, res;
|
||||
int o1 = OD_DIRECTION_OFFSETS_TABLE[dir][0];
|
||||
int o2 = OD_DIRECTION_OFFSETS_TABLE[dir][1];
|
||||
|
||||
if (threshold) damping -= get_msb(threshold);
|
||||
for (i = 0; i < 4; i += 2) {
|
||||
sum = v128_zero();
|
||||
row = v128_from_v64(v64_load_aligned(&in[i * OD_FILT_BSTRIDE]),
|
||||
v64_load_aligned(&in[(i + 1) * OD_FILT_BSTRIDE]));
|
||||
|
||||
// p0 = constrain16(in[i*OD_FILT_BSTRIDE + offset], row, threshold, damping)
|
||||
p0 = v128_from_v64(v64_load_unaligned(&in[i * OD_FILT_BSTRIDE + o1]),
|
||||
v64_load_unaligned(&in[(i + 1) * OD_FILT_BSTRIDE + o1]));
|
||||
p0 = constrain16(p0, row, threshold, damping);
|
||||
|
||||
// p1 = constrain16(in[i*OD_FILT_BSTRIDE - offset], row, threshold, damping)
|
||||
p1 = v128_from_v64(v64_load_unaligned(&in[i * OD_FILT_BSTRIDE - o1]),
|
||||
v64_load_unaligned(&in[(i + 1) * OD_FILT_BSTRIDE - o1]));
|
||||
p1 = constrain16(p1, row, threshold, damping);
|
||||
|
||||
// sum += 4 * (p0 + p1)
|
||||
sum = v128_add_16(sum, v128_shl_n_16(v128_add_16(p0, p1), 2));
|
||||
|
||||
// p0 = constrain16(in[i*OD_FILT_BSTRIDE + offset], row, threshold, damping)
|
||||
p0 = v128_from_v64(v64_load_unaligned(&in[i * OD_FILT_BSTRIDE + o2]),
|
||||
v64_load_unaligned(&in[(i + 1) * OD_FILT_BSTRIDE + o2]));
|
||||
p0 = constrain16(p0, row, threshold, damping);
|
||||
|
||||
// p1 = constrain16(in[i*OD_FILT_BSTRIDE - offset], row, threshold, damping)
|
||||
p1 = v128_from_v64(v64_load_unaligned(&in[i * OD_FILT_BSTRIDE - o2]),
|
||||
v64_load_unaligned(&in[(i + 1) * OD_FILT_BSTRIDE - o2]));
|
||||
p1 = constrain16(p1, row, threshold, damping);
|
||||
|
||||
// sum += 1 * (p0 + p1)
|
||||
sum = v128_add_16(sum, v128_add_16(p0, p1));
|
||||
|
||||
// res = row + ((sum + 8) >> 4)
|
||||
res = v128_add_16(sum, v128_dup_16(8));
|
||||
res = v128_shr_n_s16(res, 4);
|
||||
res = v128_add_16(row, res);
|
||||
v64_store_aligned(&y[i * ystride], v128_high_v64(res));
|
||||
v64_store_aligned(&y[(i + 1) * ystride], v128_low_v64(res));
|
||||
}
|
||||
}
|
||||
|
||||
void SIMD_FUNC(od_filter_dering_direction_8x8)(uint16_t *y, int ystride,
|
||||
const uint16_t *in,
|
||||
int threshold, int dir,
|
||||
int damping) {
|
||||
int i;
|
||||
v128 sum, p0, p1, row, res;
|
||||
int o1 = OD_DIRECTION_OFFSETS_TABLE[dir][0];
|
||||
int o2 = OD_DIRECTION_OFFSETS_TABLE[dir][1];
|
||||
int o3 = OD_DIRECTION_OFFSETS_TABLE[dir][2];
|
||||
|
||||
if (threshold) damping -= get_msb(threshold);
|
||||
for (i = 0; i < 8; i++) {
|
||||
sum = v128_zero();
|
||||
row = v128_load_aligned(&in[i * OD_FILT_BSTRIDE]);
|
||||
|
||||
// p0 = constrain16(in[i*OD_FILT_BSTRIDE + offset], row, threshold, damping)
|
||||
p0 = v128_load_unaligned(&in[i * OD_FILT_BSTRIDE + o1]);
|
||||
p0 = constrain16(p0, row, threshold, damping);
|
||||
|
||||
// p1 = constrain16(in[i*OD_FILT_BSTRIDE - offset], row, threshold, damping)
|
||||
p1 = v128_load_unaligned(&in[i * OD_FILT_BSTRIDE - o1]);
|
||||
p1 = constrain16(p1, row, threshold, damping);
|
||||
|
||||
// sum += 3 * (p0 + p1)
|
||||
p0 = v128_add_16(p0, p1);
|
||||
p0 = v128_add_16(p0, v128_shl_n_16(p0, 1));
|
||||
sum = v128_add_16(sum, p0);
|
||||
|
||||
// p0 = constrain16(in[i*OD_FILT_BSTRIDE + offset], row, threshold, damping)
|
||||
p0 = v128_load_unaligned(&in[i * OD_FILT_BSTRIDE + o2]);
|
||||
p0 = constrain16(p0, row, threshold, damping);
|
||||
|
||||
// p1 = constrain16(in[i*OD_FILT_BSTRIDE - offset], row, threshold, damping)
|
||||
p1 = v128_load_unaligned(&in[i * OD_FILT_BSTRIDE - o2]);
|
||||
p1 = constrain16(p1, row, threshold, damping);
|
||||
|
||||
// sum += 2 * (p0 + p1)
|
||||
p0 = v128_shl_n_16(v128_add_16(p0, p1), 1);
|
||||
sum = v128_add_16(sum, p0);
|
||||
|
||||
// p0 = constrain16(in[i*OD_FILT_BSTRIDE + offset], row, threshold, damping)
|
||||
p0 = v128_load_unaligned(&in[i * OD_FILT_BSTRIDE + o3]);
|
||||
p0 = constrain16(p0, row, threshold, damping);
|
||||
|
||||
// p1 = constrain16(in[i*OD_FILT_BSTRIDE - offset], row, threshold, damping)
|
||||
p1 = v128_load_unaligned(&in[i * OD_FILT_BSTRIDE - o3]);
|
||||
p1 = constrain16(p1, row, threshold, damping);
|
||||
|
||||
// sum += (p0 + p1)
|
||||
p0 = v128_add_16(p0, p1);
|
||||
sum = v128_add_16(sum, p0);
|
||||
|
||||
// res = row + ((sum + 8) >> 4)
|
||||
res = v128_add_16(sum, v128_dup_16(8));
|
||||
res = v128_shr_n_s16(res, 4);
|
||||
res = v128_add_16(row, res);
|
||||
v128_store_unaligned(&y[i * ystride], res);
|
||||
}
|
||||
}
|
||||
|
||||
void SIMD_FUNC(copy_8x8_16bit_to_8bit)(uint8_t *dst, int dstride,
|
||||
const uint16_t *src, int sstride) {
|
||||
int i;
|
||||
for (i = 0; i < 8; i++) {
|
||||
v128 row = v128_load_unaligned(&src[i * sstride]);
|
||||
row = v128_pack_s16_u8(row, row);
|
||||
v64_store_unaligned(&dst[i * dstride], v128_low_v64(row));
|
||||
}
|
||||
}
|
||||
|
||||
void SIMD_FUNC(copy_4x4_16bit_to_8bit)(uint8_t *dst, int dstride,
|
||||
const uint16_t *src, int sstride) {
|
||||
int i;
|
||||
for (i = 0; i < 4; i++) {
|
||||
v128 row = v128_load_unaligned(&src[i * sstride]);
|
||||
row = v128_pack_s16_u8(row, row);
|
||||
u32_store_unaligned(&dst[i * dstride], v128_low_u32(row));
|
||||
}
|
||||
}
|
||||
|
||||
void SIMD_FUNC(copy_8x8_16bit_to_16bit)(uint16_t *dst, int dstride,
|
||||
const uint16_t *src, int sstride) {
|
||||
int i;
|
||||
for (i = 0; i < 8; i++) {
|
||||
v128 row = v128_load_unaligned(&src[i * sstride]);
|
||||
v128_store_unaligned(&dst[i * dstride], row);
|
||||
}
|
||||
}
|
||||
|
||||
void SIMD_FUNC(copy_4x4_16bit_to_16bit)(uint16_t *dst, int dstride,
|
||||
const uint16_t *src, int sstride) {
|
||||
int i;
|
||||
for (i = 0; i < 4; i++) {
|
||||
v64 row = v64_load_unaligned(&src[i * sstride]);
|
||||
v64_store_unaligned(&dst[i * dstride], row);
|
||||
}
|
||||
}
|
||||
|
||||
void SIMD_FUNC(copy_rect8_8bit_to_16bit)(uint16_t *dst, int dstride,
|
||||
const uint8_t *src, int sstride, int v,
|
||||
int h) {
|
||||
int i, j;
|
||||
for (i = 0; i < v; i++) {
|
||||
for (j = 0; j < (h & ~0x7); j += 8) {
|
||||
v64 row = v64_load_unaligned(&src[i * sstride + j]);
|
||||
v128_store_unaligned(&dst[i * dstride + j], v128_unpack_u8_s16(row));
|
||||
}
|
||||
for (; j < h; j++) {
|
||||
dst[i * dstride + j] = src[i * sstride + j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SIMD_FUNC(copy_rect8_16bit_to_16bit)(uint16_t *dst, int dstride,
|
||||
const uint16_t *src, int sstride,
|
||||
int v, int h) {
|
||||
int i, j;
|
||||
for (i = 0; i < v; i++) {
|
||||
for (j = 0; j < (h & ~0x7); j += 8) {
|
||||
v128 row = v128_load_unaligned(&src[i * sstride + j]);
|
||||
v128_store_unaligned(&dst[i * dstride + j], row);
|
||||
}
|
||||
for (; j < h; j++) {
|
||||
dst[i * dstride + j] = src[i * sstride + j];
|
||||
}
|
||||
}
|
||||
}
|
||||
14
third_party/aom/av1/common/od_dering_sse2.c
vendored
Normal file
14
third_party/aom/av1/common/od_dering_sse2.c
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* 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/aom_simd.h"
|
||||
#define SIMD_FUNC(name) name##_sse2
|
||||
#include "./od_dering_simd.h"
|
||||
14
third_party/aom/av1/common/od_dering_sse4.c
vendored
Normal file
14
third_party/aom/av1/common/od_dering_sse4.c
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* 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/aom_simd.h"
|
||||
#define SIMD_FUNC(name) name##_sse4_1
|
||||
#include "./od_dering_simd.h"
|
||||
14
third_party/aom/av1/common/od_dering_ssse3.c
vendored
Normal file
14
third_party/aom/av1/common/od_dering_ssse3.c
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* 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/aom_simd.h"
|
||||
#define SIMD_FUNC(name) name##_ssse3
|
||||
#include "./od_dering_simd.h"
|
||||
551
third_party/aom/av1/common/odintrin.c
vendored
Normal file
551
third_party/aom/av1/common/odintrin.c
vendored
Normal file
|
|
@ -0,0 +1,551 @@
|
|||
/*
|
||||
* Copyright (c) 2001-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.
|
||||
*/
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
#include "av1/common/odintrin.h"
|
||||
|
||||
#if defined(OD_ENABLE_ASSERTIONS)
|
||||
# include <stdio.h>
|
||||
|
||||
void od_fatal_impl(const char *_str, const char *_file, int _line) {
|
||||
fprintf(stderr, "Fatal (internal) error in %s, line %d: %s\n",
|
||||
_file, _line, _str);
|
||||
abort();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*Constants for use with OD_DIVU_SMALL().
|
||||
See \cite{Rob05} for details on computing these constants.
|
||||
@INPROCEEDINGS{Rob05,
|
||||
author="Arch D. Robison",
|
||||
title="{N}-bit Unsigned Division via {N}-bit Multiply-Add",
|
||||
booktitle="Proc. of the 17th IEEE Symposium on Computer Arithmetic
|
||||
(ARITH'05)",
|
||||
pages="131--139",
|
||||
address="Cape Cod, MA",
|
||||
month=Jun,
|
||||
year=2005
|
||||
}*/
|
||||
uint32_t OD_DIVU_SMALL_CONSTS[OD_DIVU_DMAX][2] = {
|
||||
{ 0xFFFFFFFF, 0xFFFFFFFF }, { 0xFFFFFFFF, 0xFFFFFFFF },
|
||||
{ 0xAAAAAAAB, 0 }, { 0xFFFFFFFF, 0xFFFFFFFF },
|
||||
{ 0xCCCCCCCD, 0 }, { 0xAAAAAAAB, 0 },
|
||||
{ 0x92492492, 0x92492492 }, { 0xFFFFFFFF, 0xFFFFFFFF },
|
||||
{ 0xE38E38E4, 0 }, { 0xCCCCCCCD, 0 },
|
||||
{ 0xBA2E8BA3, 0 }, { 0xAAAAAAAB, 0 },
|
||||
{ 0x9D89D89E, 0 }, { 0x92492492, 0x92492492 },
|
||||
{ 0x88888889, 0 }, { 0xFFFFFFFF, 0xFFFFFFFF },
|
||||
{ 0xF0F0F0F1, 0 }, { 0xE38E38E4, 0 },
|
||||
{ 0xD79435E5, 0xD79435E5 }, { 0xCCCCCCCD, 0 },
|
||||
{ 0xC30C30C3, 0xC30C30C3 }, { 0xBA2E8BA3, 0 },
|
||||
{ 0xB21642C9, 0 }, { 0xAAAAAAAB, 0 },
|
||||
{ 0xA3D70A3E, 0 }, { 0x9D89D89E, 0 },
|
||||
{ 0x97B425ED, 0x97B425ED }, { 0x92492492, 0x92492492 },
|
||||
{ 0x8D3DCB09, 0 }, { 0x88888889, 0 },
|
||||
{ 0x84210842, 0x84210842 }, { 0xFFFFFFFF, 0xFFFFFFFF },
|
||||
{ 0xF83E0F84, 0 }, { 0xF0F0F0F1, 0 },
|
||||
{ 0xEA0EA0EA, 0xEA0EA0EA }, { 0xE38E38E4, 0 },
|
||||
{ 0xDD67C8A6, 0xDD67C8A6 }, { 0xD79435E5, 0xD79435E5 },
|
||||
{ 0xD20D20D2, 0xD20D20D2 }, { 0xCCCCCCCD, 0 },
|
||||
{ 0xC7CE0C7D, 0 }, { 0xC30C30C3, 0xC30C30C3 },
|
||||
{ 0xBE82FA0C, 0 }, { 0xBA2E8BA3, 0 },
|
||||
{ 0xB60B60B6, 0xB60B60B6 }, { 0xB21642C9, 0 },
|
||||
{ 0xAE4C415D, 0 }, { 0xAAAAAAAB, 0 },
|
||||
{ 0xA72F053A, 0 }, { 0xA3D70A3E, 0 },
|
||||
{ 0xA0A0A0A1, 0 }, { 0x9D89D89E, 0 },
|
||||
{ 0x9A90E7D9, 0x9A90E7D9 }, { 0x97B425ED, 0x97B425ED },
|
||||
{ 0x94F2094F, 0x94F2094F }, { 0x92492492, 0x92492492 },
|
||||
{ 0x8FB823EE, 0x8FB823EE }, { 0x8D3DCB09, 0 },
|
||||
{ 0x8AD8F2FC, 0 }, { 0x88888889, 0 },
|
||||
{ 0x864B8A7E, 0 }, { 0x84210842, 0x84210842 },
|
||||
{ 0x82082082, 0x82082082 }, { 0xFFFFFFFF, 0xFFFFFFFF },
|
||||
{ 0xFC0FC0FD, 0 }, { 0xF83E0F84, 0 },
|
||||
{ 0xF4898D60, 0 }, { 0xF0F0F0F1, 0 },
|
||||
{ 0xED7303B6, 0 }, { 0xEA0EA0EA, 0xEA0EA0EA },
|
||||
{ 0xE6C2B449, 0 }, { 0xE38E38E4, 0 },
|
||||
{ 0xE070381C, 0xE070381C }, { 0xDD67C8A6, 0xDD67C8A6 },
|
||||
{ 0xDA740DA8, 0 }, { 0xD79435E5, 0xD79435E5 },
|
||||
{ 0xD4C77B04, 0 }, { 0xD20D20D2, 0xD20D20D2 },
|
||||
{ 0xCF6474A9, 0 }, { 0xCCCCCCCD, 0 },
|
||||
{ 0xCA4587E7, 0 }, { 0xC7CE0C7D, 0 },
|
||||
{ 0xC565C87C, 0 }, { 0xC30C30C3, 0xC30C30C3 },
|
||||
{ 0xC0C0C0C1, 0 }, { 0xBE82FA0C, 0 },
|
||||
{ 0xBC52640C, 0 }, { 0xBA2E8BA3, 0 },
|
||||
{ 0xB81702E1, 0 }, { 0xB60B60B6, 0xB60B60B6 },
|
||||
{ 0xB40B40B4, 0xB40B40B4 }, { 0xB21642C9, 0 },
|
||||
{ 0xB02C0B03, 0 }, { 0xAE4C415D, 0 },
|
||||
{ 0xAC769184, 0xAC769184 }, { 0xAAAAAAAB, 0 },
|
||||
{ 0xA8E83F57, 0xA8E83F57 }, { 0xA72F053A, 0 },
|
||||
{ 0xA57EB503, 0 }, { 0xA3D70A3E, 0 },
|
||||
{ 0xA237C32B, 0xA237C32B }, { 0xA0A0A0A1, 0 },
|
||||
{ 0x9F1165E7, 0x9F1165E7 }, { 0x9D89D89E, 0 },
|
||||
{ 0x9C09C09C, 0x9C09C09C }, { 0x9A90E7D9, 0x9A90E7D9 },
|
||||
{ 0x991F1A51, 0x991F1A51 }, { 0x97B425ED, 0x97B425ED },
|
||||
{ 0x964FDA6C, 0x964FDA6C }, { 0x94F2094F, 0x94F2094F },
|
||||
{ 0x939A85C4, 0x939A85C4 }, { 0x92492492, 0x92492492 },
|
||||
{ 0x90FDBC09, 0x90FDBC09 }, { 0x8FB823EE, 0x8FB823EE },
|
||||
{ 0x8E78356D, 0x8E78356D }, { 0x8D3DCB09, 0 },
|
||||
{ 0x8C08C08C, 0x8C08C08C }, { 0x8AD8F2FC, 0 },
|
||||
{ 0x89AE408A, 0 }, { 0x88888889, 0 },
|
||||
{ 0x8767AB5F, 0x8767AB5F }, { 0x864B8A7E, 0 },
|
||||
{ 0x85340853, 0x85340853 }, { 0x84210842, 0x84210842 },
|
||||
{ 0x83126E98, 0 }, { 0x82082082, 0x82082082 },
|
||||
{ 0x81020408, 0x81020408 }, { 0xFFFFFFFF, 0xFFFFFFFF },
|
||||
{ 0xFE03F810, 0 }, { 0xFC0FC0FD, 0 },
|
||||
{ 0xFA232CF3, 0 }, { 0xF83E0F84, 0 },
|
||||
{ 0xF6603D99, 0 }, { 0xF4898D60, 0 },
|
||||
{ 0xF2B9D649, 0 }, { 0xF0F0F0F1, 0 },
|
||||
{ 0xEF2EB720, 0 }, { 0xED7303B6, 0 },
|
||||
{ 0xEBBDB2A6, 0 }, { 0xEA0EA0EA, 0xEA0EA0EA },
|
||||
{ 0xE865AC7C, 0 }, { 0xE6C2B449, 0 },
|
||||
{ 0xE525982B, 0 }, { 0xE38E38E4, 0 },
|
||||
{ 0xE1FC780F, 0 }, { 0xE070381C, 0xE070381C },
|
||||
{ 0xDEE95C4D, 0 }, { 0xDD67C8A6, 0xDD67C8A6 },
|
||||
{ 0xDBEB61EF, 0 }, { 0xDA740DA8, 0 },
|
||||
{ 0xD901B204, 0 }, { 0xD79435E5, 0xD79435E5 },
|
||||
{ 0xD62B80D7, 0 }, { 0xD4C77B04, 0 },
|
||||
{ 0xD3680D37, 0 }, { 0xD20D20D2, 0xD20D20D2 },
|
||||
{ 0xD0B69FCC, 0 }, { 0xCF6474A9, 0 },
|
||||
{ 0xCE168A77, 0xCE168A77 }, { 0xCCCCCCCD, 0 },
|
||||
{ 0xCB8727C1, 0 }, { 0xCA4587E7, 0 },
|
||||
{ 0xC907DA4F, 0 }, { 0xC7CE0C7D, 0 },
|
||||
{ 0xC6980C6A, 0 }, { 0xC565C87C, 0 },
|
||||
{ 0xC4372F86, 0 }, { 0xC30C30C3, 0xC30C30C3 },
|
||||
{ 0xC1E4BBD6, 0 }, { 0xC0C0C0C1, 0 },
|
||||
{ 0xBFA02FE8, 0xBFA02FE8 }, { 0xBE82FA0C, 0 },
|
||||
{ 0xBD691047, 0xBD691047 }, { 0xBC52640C, 0 },
|
||||
{ 0xBB3EE722, 0 }, { 0xBA2E8BA3, 0 },
|
||||
{ 0xB92143FA, 0xB92143FA }, { 0xB81702E1, 0 },
|
||||
{ 0xB70FBB5A, 0xB70FBB5A }, { 0xB60B60B6, 0xB60B60B6 },
|
||||
{ 0xB509E68B, 0 }, { 0xB40B40B4, 0xB40B40B4 },
|
||||
{ 0xB30F6353, 0 }, { 0xB21642C9, 0 },
|
||||
{ 0xB11FD3B8, 0xB11FD3B8 }, { 0xB02C0B03, 0 },
|
||||
{ 0xAF3ADDC7, 0 }, { 0xAE4C415D, 0 },
|
||||
{ 0xAD602B58, 0xAD602B58 }, { 0xAC769184, 0xAC769184 },
|
||||
{ 0xAB8F69E3, 0 }, { 0xAAAAAAAB, 0 },
|
||||
{ 0xA9C84A48, 0 }, { 0xA8E83F57, 0xA8E83F57 },
|
||||
{ 0xA80A80A8, 0xA80A80A8 }, { 0xA72F053A, 0 },
|
||||
{ 0xA655C439, 0xA655C439 }, { 0xA57EB503, 0 },
|
||||
{ 0xA4A9CF1E, 0 }, { 0xA3D70A3E, 0 },
|
||||
{ 0xA3065E40, 0 }, { 0xA237C32B, 0xA237C32B },
|
||||
{ 0xA16B312F, 0 }, { 0xA0A0A0A1, 0 },
|
||||
{ 0x9FD809FE, 0 }, { 0x9F1165E7, 0x9F1165E7 },
|
||||
{ 0x9E4CAD24, 0 }, { 0x9D89D89E, 0 },
|
||||
{ 0x9CC8E161, 0 }, { 0x9C09C09C, 0x9C09C09C },
|
||||
{ 0x9B4C6F9F, 0 }, { 0x9A90E7D9, 0x9A90E7D9 },
|
||||
{ 0x99D722DB, 0 }, { 0x991F1A51, 0x991F1A51 },
|
||||
{ 0x9868C80A, 0 }, { 0x97B425ED, 0x97B425ED },
|
||||
{ 0x97012E02, 0x97012E02 }, { 0x964FDA6C, 0x964FDA6C },
|
||||
{ 0x95A02568, 0x95A02568 }, { 0x94F2094F, 0x94F2094F },
|
||||
{ 0x94458094, 0x94458094 }, { 0x939A85C4, 0x939A85C4 },
|
||||
{ 0x92F11384, 0x92F11384 }, { 0x92492492, 0x92492492 },
|
||||
{ 0x91A2B3C5, 0 }, { 0x90FDBC09, 0x90FDBC09 },
|
||||
{ 0x905A3863, 0x905A3863 }, { 0x8FB823EE, 0x8FB823EE },
|
||||
{ 0x8F1779DA, 0 }, { 0x8E78356D, 0x8E78356D },
|
||||
{ 0x8DDA5202, 0x8DDA5202 }, { 0x8D3DCB09, 0 },
|
||||
{ 0x8CA29C04, 0x8CA29C04 }, { 0x8C08C08C, 0x8C08C08C },
|
||||
{ 0x8B70344A, 0x8B70344A }, { 0x8AD8F2FC, 0 },
|
||||
{ 0x8A42F870, 0x8A42F870 }, { 0x89AE408A, 0 },
|
||||
{ 0x891AC73B, 0 }, { 0x88888889, 0 },
|
||||
{ 0x87F78088, 0 }, { 0x8767AB5F, 0x8767AB5F },
|
||||
{ 0x86D90545, 0 }, { 0x864B8A7E, 0 },
|
||||
{ 0x85BF3761, 0x85BF3761 }, { 0x85340853, 0x85340853 },
|
||||
{ 0x84A9F9C8, 0x84A9F9C8 }, { 0x84210842, 0x84210842 },
|
||||
{ 0x83993052, 0x83993052 }, { 0x83126E98, 0 },
|
||||
{ 0x828CBFBF, 0 }, { 0x82082082, 0x82082082 },
|
||||
{ 0x81848DA9, 0 }, { 0x81020408, 0x81020408 },
|
||||
{ 0x80808081, 0 }, { 0xFFFFFFFF, 0xFFFFFFFF },
|
||||
{ 0xFF00FF01, 0 }, { 0xFE03F810, 0 },
|
||||
{ 0xFD08E551, 0 }, { 0xFC0FC0FD, 0 },
|
||||
{ 0xFB188566, 0 }, { 0xFA232CF3, 0 },
|
||||
{ 0xF92FB222, 0 }, { 0xF83E0F84, 0 },
|
||||
{ 0xF74E3FC3, 0 }, { 0xF6603D99, 0 },
|
||||
{ 0xF57403D6, 0 }, { 0xF4898D60, 0 },
|
||||
{ 0xF3A0D52D, 0 }, { 0xF2B9D649, 0 },
|
||||
{ 0xF1D48BCF, 0 }, { 0xF0F0F0F1, 0 },
|
||||
{ 0xF00F00F0, 0xF00F00F0 }, { 0xEF2EB720, 0 },
|
||||
{ 0xEE500EE5, 0xEE500EE5 }, { 0xED7303B6, 0 },
|
||||
{ 0xEC979119, 0 }, { 0xEBBDB2A6, 0 },
|
||||
{ 0xEAE56404, 0 }, { 0xEA0EA0EA, 0xEA0EA0EA },
|
||||
{ 0xE9396520, 0 }, { 0xE865AC7C, 0 },
|
||||
{ 0xE79372E3, 0 }, { 0xE6C2B449, 0 },
|
||||
{ 0xE5F36CB0, 0xE5F36CB0 }, { 0xE525982B, 0 },
|
||||
{ 0xE45932D8, 0 }, { 0xE38E38E4, 0 },
|
||||
{ 0xE2C4A689, 0 }, { 0xE1FC780F, 0 },
|
||||
{ 0xE135A9CA, 0 }, { 0xE070381C, 0xE070381C },
|
||||
{ 0xDFAC1F75, 0 }, { 0xDEE95C4D, 0 },
|
||||
{ 0xDE27EB2D, 0 }, { 0xDD67C8A6, 0xDD67C8A6 },
|
||||
{ 0xDCA8F159, 0 }, { 0xDBEB61EF, 0 },
|
||||
{ 0xDB2F171E, 0 }, { 0xDA740DA8, 0 },
|
||||
{ 0xD9BA4257, 0 }, { 0xD901B204, 0 },
|
||||
{ 0xD84A598F, 0 }, { 0xD79435E5, 0xD79435E5 },
|
||||
{ 0xD6DF43FD, 0 }, { 0xD62B80D7, 0 },
|
||||
{ 0xD578E97D, 0 }, { 0xD4C77B04, 0 },
|
||||
{ 0xD417328A, 0 }, { 0xD3680D37, 0 },
|
||||
{ 0xD2BA083C, 0 }, { 0xD20D20D2, 0xD20D20D2 },
|
||||
{ 0xD161543E, 0xD161543E }, { 0xD0B69FCC, 0 },
|
||||
{ 0xD00D00D0, 0xD00D00D0 }, { 0xCF6474A9, 0 },
|
||||
{ 0xCEBCF8BC, 0 }, { 0xCE168A77, 0xCE168A77 },
|
||||
{ 0xCD712753, 0 }, { 0xCCCCCCCD, 0 },
|
||||
{ 0xCC29786D, 0 }, { 0xCB8727C1, 0 },
|
||||
{ 0xCAE5D85F, 0xCAE5D85F }, { 0xCA4587E7, 0 },
|
||||
{ 0xC9A633FD, 0 }, { 0xC907DA4F, 0 },
|
||||
{ 0xC86A7890, 0xC86A7890 }, { 0xC7CE0C7D, 0 },
|
||||
{ 0xC73293D8, 0 }, { 0xC6980C6A, 0 },
|
||||
{ 0xC5FE7403, 0xC5FE7403 }, { 0xC565C87C, 0 },
|
||||
{ 0xC4CE07B0, 0xC4CE07B0 }, { 0xC4372F86, 0 },
|
||||
{ 0xC3A13DE6, 0xC3A13DE6 }, { 0xC30C30C3, 0xC30C30C3 },
|
||||
{ 0xC2780614, 0 }, { 0xC1E4BBD6, 0 },
|
||||
{ 0xC152500C, 0xC152500C }, { 0xC0C0C0C1, 0 },
|
||||
{ 0xC0300C03, 0xC0300C03 }, { 0xBFA02FE8, 0xBFA02FE8 },
|
||||
{ 0xBF112A8B, 0 }, { 0xBE82FA0C, 0 },
|
||||
{ 0xBDF59C92, 0 }, { 0xBD691047, 0xBD691047 },
|
||||
{ 0xBCDD535E, 0 }, { 0xBC52640C, 0 },
|
||||
{ 0xBBC8408D, 0 }, { 0xBB3EE722, 0 },
|
||||
{ 0xBAB65610, 0xBAB65610 }, { 0xBA2E8BA3, 0 },
|
||||
{ 0xB9A7862A, 0xB9A7862A }, { 0xB92143FA, 0xB92143FA },
|
||||
{ 0xB89BC36D, 0 }, { 0xB81702E1, 0 },
|
||||
{ 0xB79300B8, 0 }, { 0xB70FBB5A, 0xB70FBB5A },
|
||||
{ 0xB68D3134, 0xB68D3134 }, { 0xB60B60B6, 0xB60B60B6 },
|
||||
{ 0xB58A4855, 0xB58A4855 }, { 0xB509E68B, 0 },
|
||||
{ 0xB48A39D4, 0xB48A39D4 }, { 0xB40B40B4, 0xB40B40B4 },
|
||||
{ 0xB38CF9B0, 0xB38CF9B0 }, { 0xB30F6353, 0 },
|
||||
{ 0xB2927C2A, 0 }, { 0xB21642C9, 0 },
|
||||
{ 0xB19AB5C5, 0 }, { 0xB11FD3B8, 0xB11FD3B8 },
|
||||
{ 0xB0A59B42, 0 }, { 0xB02C0B03, 0 },
|
||||
{ 0xAFB321A1, 0xAFB321A1 }, { 0xAF3ADDC7, 0 },
|
||||
{ 0xAEC33E20, 0 }, { 0xAE4C415D, 0 },
|
||||
{ 0xADD5E632, 0xADD5E632 }, { 0xAD602B58, 0xAD602B58 },
|
||||
{ 0xACEB0F89, 0xACEB0F89 }, { 0xAC769184, 0xAC769184 },
|
||||
{ 0xAC02B00B, 0 }, { 0xAB8F69E3, 0 },
|
||||
{ 0xAB1CBDD4, 0 }, { 0xAAAAAAAB, 0 },
|
||||
{ 0xAA392F36, 0 }, { 0xA9C84A48, 0 },
|
||||
{ 0xA957FAB5, 0xA957FAB5 }, { 0xA8E83F57, 0xA8E83F57 },
|
||||
{ 0xA8791709, 0 }, { 0xA80A80A8, 0xA80A80A8 },
|
||||
{ 0xA79C7B17, 0 }, { 0xA72F053A, 0 },
|
||||
{ 0xA6C21DF7, 0 }, { 0xA655C439, 0xA655C439 },
|
||||
{ 0xA5E9F6ED, 0xA5E9F6ED }, { 0xA57EB503, 0 },
|
||||
{ 0xA513FD6C, 0 }, { 0xA4A9CF1E, 0 },
|
||||
{ 0xA4402910, 0xA4402910 }, { 0xA3D70A3E, 0 },
|
||||
{ 0xA36E71A3, 0 }, { 0xA3065E40, 0 },
|
||||
{ 0xA29ECF16, 0xA29ECF16 }, { 0xA237C32B, 0xA237C32B },
|
||||
{ 0xA1D13986, 0 }, { 0xA16B312F, 0 },
|
||||
{ 0xA105A933, 0 }, { 0xA0A0A0A1, 0 },
|
||||
{ 0xA03C1689, 0 }, { 0x9FD809FE, 0 },
|
||||
{ 0x9F747A15, 0x9F747A15 }, { 0x9F1165E7, 0x9F1165E7 },
|
||||
{ 0x9EAECC8D, 0x9EAECC8D }, { 0x9E4CAD24, 0 },
|
||||
{ 0x9DEB06C9, 0x9DEB06C9 }, { 0x9D89D89E, 0 },
|
||||
{ 0x9D2921C4, 0 }, { 0x9CC8E161, 0 },
|
||||
{ 0x9C69169B, 0x9C69169B }, { 0x9C09C09C, 0x9C09C09C },
|
||||
{ 0x9BAADE8E, 0x9BAADE8E }, { 0x9B4C6F9F, 0 },
|
||||
{ 0x9AEE72FD, 0 }, { 0x9A90E7D9, 0x9A90E7D9 },
|
||||
{ 0x9A33CD67, 0x9A33CD67 }, { 0x99D722DB, 0 },
|
||||
{ 0x997AE76B, 0x997AE76B }, { 0x991F1A51, 0x991F1A51 },
|
||||
{ 0x98C3BAC7, 0x98C3BAC7 }, { 0x9868C80A, 0 },
|
||||
{ 0x980E4156, 0x980E4156 }, { 0x97B425ED, 0x97B425ED },
|
||||
{ 0x975A7510, 0 }, { 0x97012E02, 0x97012E02 },
|
||||
{ 0x96A8500A, 0 }, { 0x964FDA6C, 0x964FDA6C },
|
||||
{ 0x95F7CC73, 0 }, { 0x95A02568, 0x95A02568 },
|
||||
{ 0x9548E498, 0 }, { 0x94F2094F, 0x94F2094F },
|
||||
{ 0x949B92DE, 0 }, { 0x94458094, 0x94458094 },
|
||||
{ 0x93EFD1C5, 0x93EFD1C5 }, { 0x939A85C4, 0x939A85C4 },
|
||||
{ 0x93459BE7, 0 }, { 0x92F11384, 0x92F11384 },
|
||||
{ 0x929CEBF5, 0 }, { 0x92492492, 0x92492492 },
|
||||
{ 0x91F5BCB9, 0 }, { 0x91A2B3C5, 0 },
|
||||
{ 0x91500915, 0x91500915 }, { 0x90FDBC09, 0x90FDBC09 },
|
||||
{ 0x90ABCC02, 0x90ABCC02 }, { 0x905A3863, 0x905A3863 },
|
||||
{ 0x90090090, 0x90090090 }, { 0x8FB823EE, 0x8FB823EE },
|
||||
{ 0x8F67A1E4, 0 }, { 0x8F1779DA, 0 },
|
||||
{ 0x8EC7AB3A, 0 }, { 0x8E78356D, 0x8E78356D },
|
||||
{ 0x8E2917E1, 0 }, { 0x8DDA5202, 0x8DDA5202 },
|
||||
{ 0x8D8BE340, 0 }, { 0x8D3DCB09, 0 },
|
||||
{ 0x8CF008CF, 0x8CF008CF }, { 0x8CA29C04, 0x8CA29C04 },
|
||||
{ 0x8C55841D, 0 }, { 0x8C08C08C, 0x8C08C08C },
|
||||
{ 0x8BBC50C9, 0 }, { 0x8B70344A, 0x8B70344A },
|
||||
{ 0x8B246A88, 0 }, { 0x8AD8F2FC, 0 },
|
||||
{ 0x8A8DCD20, 0 }, { 0x8A42F870, 0x8A42F870 },
|
||||
{ 0x89F8746A, 0 }, { 0x89AE408A, 0 },
|
||||
{ 0x89645C4F, 0x89645C4F }, { 0x891AC73B, 0 },
|
||||
{ 0x88D180CD, 0x88D180CD }, { 0x88888889, 0 },
|
||||
{ 0x883FDDF0, 0x883FDDF0 }, { 0x87F78088, 0 },
|
||||
{ 0x87AF6FD6, 0 }, { 0x8767AB5F, 0x8767AB5F },
|
||||
{ 0x872032AC, 0x872032AC }, { 0x86D90545, 0 },
|
||||
{ 0x869222B2, 0 }, { 0x864B8A7E, 0 },
|
||||
{ 0x86053C34, 0x86053C34 }, { 0x85BF3761, 0x85BF3761 },
|
||||
{ 0x85797B91, 0x85797B91 }, { 0x85340853, 0x85340853 },
|
||||
{ 0x84EEDD36, 0 }, { 0x84A9F9C8, 0x84A9F9C8 },
|
||||
{ 0x84655D9C, 0 }, { 0x84210842, 0x84210842 },
|
||||
{ 0x83DCF94E, 0 }, { 0x83993052, 0x83993052 },
|
||||
{ 0x8355ACE4, 0 }, { 0x83126E98, 0 },
|
||||
{ 0x82CF7504, 0 }, { 0x828CBFBF, 0 },
|
||||
{ 0x824A4E61, 0 }, { 0x82082082, 0x82082082 },
|
||||
{ 0x81C635BC, 0x81C635BC }, { 0x81848DA9, 0 },
|
||||
{ 0x814327E4, 0 }, { 0x81020408, 0x81020408 },
|
||||
{ 0x80C121B3, 0 }, { 0x80808081, 0 },
|
||||
{ 0x80402010, 0x80402010 }, { 0xFFFFFFFF, 0xFFFFFFFF },
|
||||
{ 0xFF803FE1, 0 }, { 0xFF00FF01, 0 },
|
||||
{ 0xFE823CA6, 0 }, { 0xFE03F810, 0 },
|
||||
{ 0xFD863087, 0 }, { 0xFD08E551, 0 },
|
||||
{ 0xFC8C15B5, 0 }, { 0xFC0FC0FD, 0 },
|
||||
{ 0xFB93E673, 0 }, { 0xFB188566, 0 },
|
||||
{ 0xFA9D9D20, 0 }, { 0xFA232CF3, 0 },
|
||||
{ 0xF9A9342D, 0 }, { 0xF92FB222, 0 },
|
||||
{ 0xF8B6A622, 0xF8B6A622 }, { 0xF83E0F84, 0 },
|
||||
{ 0xF7C5ED9D, 0 }, { 0xF74E3FC3, 0 },
|
||||
{ 0xF6D7054E, 0 }, { 0xF6603D99, 0 },
|
||||
{ 0xF5E9E7FD, 0 }, { 0xF57403D6, 0 },
|
||||
{ 0xF4FE9083, 0 }, { 0xF4898D60, 0 },
|
||||
{ 0xF414F9CE, 0 }, { 0xF3A0D52D, 0 },
|
||||
{ 0xF32D1EE0, 0 }, { 0xF2B9D649, 0 },
|
||||
{ 0xF246FACC, 0 }, { 0xF1D48BCF, 0 },
|
||||
{ 0xF16288B9, 0 }, { 0xF0F0F0F1, 0 },
|
||||
{ 0xF07FC3E0, 0xF07FC3E0 }, { 0xF00F00F0, 0xF00F00F0 },
|
||||
{ 0xEF9EA78C, 0 }, { 0xEF2EB720, 0 },
|
||||
{ 0xEEBF2F19, 0 }, { 0xEE500EE5, 0xEE500EE5 },
|
||||
{ 0xEDE155F4, 0 }, { 0xED7303B6, 0 },
|
||||
{ 0xED05179C, 0xED05179C }, { 0xEC979119, 0 },
|
||||
{ 0xEC2A6FA0, 0xEC2A6FA0 }, { 0xEBBDB2A6, 0 },
|
||||
{ 0xEB5159A0, 0 }, { 0xEAE56404, 0 },
|
||||
{ 0xEA79D14A, 0 }, { 0xEA0EA0EA, 0xEA0EA0EA },
|
||||
{ 0xE9A3D25E, 0xE9A3D25E }, { 0xE9396520, 0 },
|
||||
{ 0xE8CF58AB, 0 }, { 0xE865AC7C, 0 },
|
||||
{ 0xE7FC600F, 0 }, { 0xE79372E3, 0 },
|
||||
{ 0xE72AE476, 0 }, { 0xE6C2B449, 0 },
|
||||
{ 0xE65AE1DC, 0 }, { 0xE5F36CB0, 0xE5F36CB0 },
|
||||
{ 0xE58C544A, 0 }, { 0xE525982B, 0 },
|
||||
{ 0xE4BF37D9, 0 }, { 0xE45932D8, 0 },
|
||||
{ 0xE3F388AF, 0 }, { 0xE38E38E4, 0 },
|
||||
{ 0xE32942FF, 0 }, { 0xE2C4A689, 0 },
|
||||
{ 0xE260630B, 0 }, { 0xE1FC780F, 0 },
|
||||
{ 0xE198E520, 0 }, { 0xE135A9CA, 0 },
|
||||
{ 0xE0D2C59A, 0 }, { 0xE070381C, 0xE070381C },
|
||||
{ 0xE00E00E0, 0xE00E00E0 }, { 0xDFAC1F75, 0 },
|
||||
{ 0xDF4A9369, 0 }, { 0xDEE95C4D, 0 },
|
||||
{ 0xDE8879B3, 0 }, { 0xDE27EB2D, 0 },
|
||||
{ 0xDDC7B04D, 0 }, { 0xDD67C8A6, 0xDD67C8A6 },
|
||||
{ 0xDD0833CE, 0 }, { 0xDCA8F159, 0 },
|
||||
{ 0xDC4A00DD, 0 }, { 0xDBEB61EF, 0 },
|
||||
{ 0xDB8D1428, 0 }, { 0xDB2F171E, 0 },
|
||||
{ 0xDAD16A6B, 0 }, { 0xDA740DA8, 0 },
|
||||
{ 0xDA17006D, 0xDA17006D }, { 0xD9BA4257, 0 },
|
||||
{ 0xD95DD300, 0 }, { 0xD901B204, 0 },
|
||||
{ 0xD8A5DEFF, 0 }, { 0xD84A598F, 0 },
|
||||
{ 0xD7EF2152, 0 }, { 0xD79435E5, 0xD79435E5 },
|
||||
{ 0xD73996E9, 0 }, { 0xD6DF43FD, 0 },
|
||||
{ 0xD6853CC1, 0 }, { 0xD62B80D7, 0 },
|
||||
{ 0xD5D20FDF, 0 }, { 0xD578E97D, 0 },
|
||||
{ 0xD5200D52, 0xD5200D52 }, { 0xD4C77B04, 0 },
|
||||
{ 0xD46F3235, 0 }, { 0xD417328A, 0 },
|
||||
{ 0xD3BF7BA9, 0 }, { 0xD3680D37, 0 },
|
||||
{ 0xD310E6DB, 0 }, { 0xD2BA083C, 0 },
|
||||
{ 0xD2637101, 0 }, { 0xD20D20D2, 0xD20D20D2 },
|
||||
{ 0xD1B71759, 0 }, { 0xD161543E, 0xD161543E },
|
||||
{ 0xD10BD72C, 0 }, { 0xD0B69FCC, 0 },
|
||||
{ 0xD061ADCA, 0 }, { 0xD00D00D0, 0xD00D00D0 },
|
||||
{ 0xCFB8988C, 0 }, { 0xCF6474A9, 0 },
|
||||
{ 0xCF1094D4, 0 }, { 0xCEBCF8BC, 0 },
|
||||
{ 0xCE69A00D, 0 }, { 0xCE168A77, 0xCE168A77 },
|
||||
{ 0xCDC3B7A9, 0xCDC3B7A9 }, { 0xCD712753, 0 },
|
||||
{ 0xCD1ED924, 0 }, { 0xCCCCCCCD, 0 },
|
||||
{ 0xCC7B0200, 0 }, { 0xCC29786D, 0 },
|
||||
{ 0xCBD82FC7, 0 }, { 0xCB8727C1, 0 },
|
||||
{ 0xCB36600D, 0 }, { 0xCAE5D85F, 0xCAE5D85F },
|
||||
{ 0xCA95906C, 0 }, { 0xCA4587E7, 0 },
|
||||
{ 0xC9F5BE86, 0 }, { 0xC9A633FD, 0 },
|
||||
{ 0xC956E803, 0xC956E803 }, { 0xC907DA4F, 0 },
|
||||
{ 0xC8B90A96, 0 }, { 0xC86A7890, 0xC86A7890 },
|
||||
{ 0xC81C23F5, 0xC81C23F5 }, { 0xC7CE0C7D, 0 },
|
||||
{ 0xC78031E0, 0xC78031E0 }, { 0xC73293D8, 0 },
|
||||
{ 0xC6E5321D, 0 }, { 0xC6980C6A, 0 },
|
||||
{ 0xC64B2278, 0xC64B2278 }, { 0xC5FE7403, 0xC5FE7403 },
|
||||
{ 0xC5B200C6, 0 }, { 0xC565C87C, 0 },
|
||||
{ 0xC519CAE0, 0xC519CAE0 }, { 0xC4CE07B0, 0xC4CE07B0 },
|
||||
{ 0xC4827EA8, 0xC4827EA8 }, { 0xC4372F86, 0 },
|
||||
{ 0xC3EC1A06, 0 }, { 0xC3A13DE6, 0xC3A13DE6 },
|
||||
{ 0xC3569AE6, 0 }, { 0xC30C30C3, 0xC30C30C3 },
|
||||
{ 0xC2C1FF3E, 0 }, { 0xC2780614, 0 },
|
||||
{ 0xC22E4507, 0 }, { 0xC1E4BBD6, 0 },
|
||||
{ 0xC19B6A42, 0 }, { 0xC152500C, 0xC152500C },
|
||||
{ 0xC1096CF6, 0 }, { 0xC0C0C0C1, 0 },
|
||||
{ 0xC0784B2F, 0 }, { 0xC0300C03, 0xC0300C03 },
|
||||
{ 0xBFE80300, 0 }, { 0xBFA02FE8, 0xBFA02FE8 },
|
||||
{ 0xBF589280, 0 }, { 0xBF112A8B, 0 },
|
||||
{ 0xBEC9F7CE, 0 }, { 0xBE82FA0C, 0 },
|
||||
{ 0xBE3C310C, 0 }, { 0xBDF59C92, 0 },
|
||||
{ 0xBDAF3C64, 0 }, { 0xBD691047, 0xBD691047 },
|
||||
{ 0xBD231803, 0 }, { 0xBCDD535E, 0 },
|
||||
{ 0xBC97C21E, 0xBC97C21E }, { 0xBC52640C, 0 },
|
||||
{ 0xBC0D38EE, 0xBC0D38EE }, { 0xBBC8408D, 0 },
|
||||
{ 0xBB837AB1, 0 }, { 0xBB3EE722, 0 },
|
||||
{ 0xBAFA85A9, 0xBAFA85A9 }, { 0xBAB65610, 0xBAB65610 },
|
||||
{ 0xBA725820, 0xBA725820 }, { 0xBA2E8BA3, 0 },
|
||||
{ 0xB9EAF063, 0 }, { 0xB9A7862A, 0xB9A7862A },
|
||||
{ 0xB9644CC4, 0 }, { 0xB92143FA, 0xB92143FA },
|
||||
{ 0xB8DE6B9A, 0 }, { 0xB89BC36D, 0 },
|
||||
{ 0xB8594B41, 0 }, { 0xB81702E1, 0 },
|
||||
{ 0xB7D4EA19, 0xB7D4EA19 }, { 0xB79300B8, 0 },
|
||||
{ 0xB7514689, 0 }, { 0xB70FBB5A, 0xB70FBB5A },
|
||||
{ 0xB6CE5EF9, 0xB6CE5EF9 }, { 0xB68D3134, 0xB68D3134 },
|
||||
{ 0xB64C31D9, 0 }, { 0xB60B60B6, 0xB60B60B6 },
|
||||
{ 0xB5CABD9B, 0 }, { 0xB58A4855, 0xB58A4855 },
|
||||
{ 0xB54A00B5, 0xB54A00B5 }, { 0xB509E68B, 0 },
|
||||
{ 0xB4C9F9A5, 0 }, { 0xB48A39D4, 0xB48A39D4 },
|
||||
{ 0xB44AA6E9, 0xB44AA6E9 }, { 0xB40B40B4, 0xB40B40B4 },
|
||||
{ 0xB3CC0706, 0 }, { 0xB38CF9B0, 0xB38CF9B0 },
|
||||
{ 0xB34E1884, 0 }, { 0xB30F6353, 0 },
|
||||
{ 0xB2D0D9EF, 0 }, { 0xB2927C2A, 0 },
|
||||
{ 0xB25449D7, 0 }, { 0xB21642C9, 0 },
|
||||
{ 0xB1D866D1, 0xB1D866D1 }, { 0xB19AB5C5, 0 },
|
||||
{ 0xB15D2F76, 0 }, { 0xB11FD3B8, 0xB11FD3B8 },
|
||||
{ 0xB0E2A260, 0xB0E2A260 }, { 0xB0A59B42, 0 },
|
||||
{ 0xB068BE31, 0 }, { 0xB02C0B03, 0 },
|
||||
{ 0xAFEF818C, 0 }, { 0xAFB321A1, 0xAFB321A1 },
|
||||
{ 0xAF76EB19, 0 }, { 0xAF3ADDC7, 0 },
|
||||
{ 0xAEFEF982, 0 }, { 0xAEC33E20, 0 },
|
||||
{ 0xAE87AB76, 0xAE87AB76 }, { 0xAE4C415D, 0 },
|
||||
{ 0xAE10FFA9, 0 }, { 0xADD5E632, 0xADD5E632 },
|
||||
{ 0xAD9AF4D0, 0 }, { 0xAD602B58, 0xAD602B58 },
|
||||
{ 0xAD2589A4, 0 }, { 0xACEB0F89, 0xACEB0F89 },
|
||||
{ 0xACB0BCE1, 0xACB0BCE1 }, { 0xAC769184, 0xAC769184 },
|
||||
{ 0xAC3C8D4A, 0 }, { 0xAC02B00B, 0 },
|
||||
{ 0xABC8F9A0, 0xABC8F9A0 }, { 0xAB8F69E3, 0 },
|
||||
{ 0xAB5600AC, 0 }, { 0xAB1CBDD4, 0 },
|
||||
{ 0xAAE3A136, 0 }, { 0xAAAAAAAB, 0 },
|
||||
{ 0xAA71DA0D, 0 }, { 0xAA392F36, 0 },
|
||||
{ 0xAA00AA01, 0 }, { 0xA9C84A48, 0 },
|
||||
{ 0xA9900FE6, 0 }, { 0xA957FAB5, 0xA957FAB5 },
|
||||
{ 0xA9200A92, 0xA9200A92 }, { 0xA8E83F57, 0xA8E83F57 },
|
||||
{ 0xA8B098E0, 0xA8B098E0 }, { 0xA8791709, 0 },
|
||||
{ 0xA841B9AD, 0 }, { 0xA80A80A8, 0xA80A80A8 },
|
||||
{ 0xA7D36BD8, 0 }, { 0xA79C7B17, 0 },
|
||||
{ 0xA765AE44, 0 }, { 0xA72F053A, 0 },
|
||||
{ 0xA6F87FD6, 0xA6F87FD6 }, { 0xA6C21DF7, 0 },
|
||||
{ 0xA68BDF79, 0 }, { 0xA655C439, 0xA655C439 },
|
||||
{ 0xA61FCC16, 0xA61FCC16 }, { 0xA5E9F6ED, 0xA5E9F6ED },
|
||||
{ 0xA5B4449D, 0 }, { 0xA57EB503, 0 },
|
||||
{ 0xA54947FE, 0 }, { 0xA513FD6C, 0 },
|
||||
{ 0xA4DED52C, 0xA4DED52C }, { 0xA4A9CF1E, 0 },
|
||||
{ 0xA474EB1F, 0xA474EB1F }, { 0xA4402910, 0xA4402910 },
|
||||
{ 0xA40B88D0, 0 }, { 0xA3D70A3E, 0 },
|
||||
{ 0xA3A2AD39, 0xA3A2AD39 }, { 0xA36E71A3, 0 },
|
||||
{ 0xA33A575A, 0xA33A575A }, { 0xA3065E40, 0 },
|
||||
{ 0xA2D28634, 0 }, { 0xA29ECF16, 0xA29ECF16 },
|
||||
{ 0xA26B38C9, 0 }, { 0xA237C32B, 0xA237C32B },
|
||||
{ 0xA2046E1F, 0xA2046E1F }, { 0xA1D13986, 0 },
|
||||
{ 0xA19E2540, 0 }, { 0xA16B312F, 0 },
|
||||
{ 0xA1385D35, 0 }, { 0xA105A933, 0 },
|
||||
{ 0xA0D3150C, 0 }, { 0xA0A0A0A1, 0 },
|
||||
{ 0xA06E4BD4, 0xA06E4BD4 }, { 0xA03C1689, 0 },
|
||||
{ 0xA00A00A0, 0xA00A00A0 }, { 0x9FD809FE, 0 },
|
||||
{ 0x9FA63284, 0 }, { 0x9F747A15, 0x9F747A15 },
|
||||
{ 0x9F42E095, 0x9F42E095 }, { 0x9F1165E7, 0x9F1165E7 },
|
||||
{ 0x9EE009EE, 0x9EE009EE }, { 0x9EAECC8D, 0x9EAECC8D },
|
||||
{ 0x9E7DADA9, 0 }, { 0x9E4CAD24, 0 },
|
||||
{ 0x9E1BCAE3, 0 }, { 0x9DEB06C9, 0x9DEB06C9 },
|
||||
{ 0x9DBA60BB, 0x9DBA60BB }, { 0x9D89D89E, 0 },
|
||||
{ 0x9D596E54, 0x9D596E54 }, { 0x9D2921C4, 0 },
|
||||
{ 0x9CF8F2D1, 0x9CF8F2D1 }, { 0x9CC8E161, 0 },
|
||||
{ 0x9C98ED58, 0 }, { 0x9C69169B, 0x9C69169B },
|
||||
{ 0x9C395D10, 0x9C395D10 }, { 0x9C09C09C, 0x9C09C09C },
|
||||
{ 0x9BDA4124, 0x9BDA4124 }, { 0x9BAADE8E, 0x9BAADE8E },
|
||||
{ 0x9B7B98C0, 0 }, { 0x9B4C6F9F, 0 },
|
||||
{ 0x9B1D6311, 0x9B1D6311 }, { 0x9AEE72FD, 0 },
|
||||
{ 0x9ABF9F48, 0x9ABF9F48 }, { 0x9A90E7D9, 0x9A90E7D9 },
|
||||
{ 0x9A624C97, 0 }, { 0x9A33CD67, 0x9A33CD67 },
|
||||
{ 0x9A056A31, 0 }, { 0x99D722DB, 0 },
|
||||
{ 0x99A8F74C, 0 }, { 0x997AE76B, 0x997AE76B },
|
||||
{ 0x994CF320, 0x994CF320 }, { 0x991F1A51, 0x991F1A51 },
|
||||
{ 0x98F15CE7, 0 }, { 0x98C3BAC7, 0x98C3BAC7 },
|
||||
{ 0x989633DB, 0x989633DB }, { 0x9868C80A, 0 },
|
||||
{ 0x983B773B, 0 }, { 0x980E4156, 0x980E4156 },
|
||||
{ 0x97E12644, 0x97E12644 }, { 0x97B425ED, 0x97B425ED },
|
||||
{ 0x97874039, 0 }, { 0x975A7510, 0 },
|
||||
{ 0x972DC45B, 0 }, { 0x97012E02, 0x97012E02 },
|
||||
{ 0x96D4B1EF, 0 }, { 0x96A8500A, 0 },
|
||||
{ 0x967C083B, 0 }, { 0x964FDA6C, 0x964FDA6C },
|
||||
{ 0x9623C686, 0x9623C686 }, { 0x95F7CC73, 0 },
|
||||
{ 0x95CBEC1B, 0 }, { 0x95A02568, 0x95A02568 },
|
||||
{ 0x95747844, 0 }, { 0x9548E498, 0 },
|
||||
{ 0x951D6A4E, 0 }, { 0x94F2094F, 0x94F2094F },
|
||||
{ 0x94C6C187, 0 }, { 0x949B92DE, 0 },
|
||||
{ 0x94707D3F, 0 }, { 0x94458094, 0x94458094 },
|
||||
{ 0x941A9CC8, 0x941A9CC8 }, { 0x93EFD1C5, 0x93EFD1C5 },
|
||||
{ 0x93C51F76, 0 }, { 0x939A85C4, 0x939A85C4 },
|
||||
{ 0x9370049C, 0 }, { 0x93459BE7, 0 },
|
||||
{ 0x931B4B91, 0 }, { 0x92F11384, 0x92F11384 },
|
||||
{ 0x92C6F3AC, 0x92C6F3AC }, { 0x929CEBF5, 0 },
|
||||
{ 0x9272FC48, 0x9272FC48 }, { 0x92492492, 0x92492492 },
|
||||
{ 0x921F64BF, 0 }, { 0x91F5BCB9, 0 },
|
||||
{ 0x91CC2C6C, 0x91CC2C6C }, { 0x91A2B3C5, 0 },
|
||||
{ 0x917952AF, 0 }, { 0x91500915, 0x91500915 },
|
||||
{ 0x9126D6E5, 0 }, { 0x90FDBC09, 0x90FDBC09 },
|
||||
{ 0x90D4B86F, 0 }, { 0x90ABCC02, 0x90ABCC02 },
|
||||
{ 0x9082F6B0, 0 }, { 0x905A3863, 0x905A3863 },
|
||||
{ 0x9031910A, 0 }, { 0x90090090, 0x90090090 },
|
||||
{ 0x8FE086E3, 0 }, { 0x8FB823EE, 0x8FB823EE },
|
||||
{ 0x8F8FD7A0, 0 }, { 0x8F67A1E4, 0 },
|
||||
{ 0x8F3F82A8, 0x8F3F82A8 }, { 0x8F1779DA, 0 },
|
||||
{ 0x8EEF8766, 0 }, { 0x8EC7AB3A, 0 },
|
||||
{ 0x8E9FE542, 0x8E9FE542 }, { 0x8E78356D, 0x8E78356D },
|
||||
{ 0x8E509BA8, 0x8E509BA8 }, { 0x8E2917E1, 0 },
|
||||
{ 0x8E01AA05, 0 }, { 0x8DDA5202, 0x8DDA5202 },
|
||||
{ 0x8DB30FC6, 0x8DB30FC6 }, { 0x8D8BE340, 0 },
|
||||
{ 0x8D64CC5C, 0 }, { 0x8D3DCB09, 0 },
|
||||
{ 0x8D16DF35, 0x8D16DF35 }, { 0x8CF008CF, 0x8CF008CF },
|
||||
{ 0x8CC947C5, 0 }, { 0x8CA29C04, 0x8CA29C04 },
|
||||
{ 0x8C7C057D, 0 }, { 0x8C55841D, 0 },
|
||||
{ 0x8C2F17D2, 0x8C2F17D2 }, { 0x8C08C08C, 0x8C08C08C },
|
||||
{ 0x8BE27E39, 0x8BE27E39 }, { 0x8BBC50C9, 0 },
|
||||
{ 0x8B963829, 0x8B963829 }, { 0x8B70344A, 0x8B70344A },
|
||||
{ 0x8B4A451A, 0 }, { 0x8B246A88, 0 },
|
||||
{ 0x8AFEA483, 0x8AFEA483 }, { 0x8AD8F2FC, 0 },
|
||||
{ 0x8AB355E0, 0x8AB355E0 }, { 0x8A8DCD20, 0 },
|
||||
{ 0x8A6858AB, 0 }, { 0x8A42F870, 0x8A42F870 },
|
||||
{ 0x8A1DAC60, 0x8A1DAC60 }, { 0x89F8746A, 0 },
|
||||
{ 0x89D3507D, 0 }, { 0x89AE408A, 0 },
|
||||
{ 0x89894480, 0 }, { 0x89645C4F, 0x89645C4F },
|
||||
{ 0x893F87E8, 0x893F87E8 }, { 0x891AC73B, 0 },
|
||||
{ 0x88F61A37, 0x88F61A37 }, { 0x88D180CD, 0x88D180CD },
|
||||
{ 0x88ACFAEE, 0 }, { 0x88888889, 0 },
|
||||
{ 0x8864298F, 0 }, { 0x883FDDF0, 0x883FDDF0 },
|
||||
{ 0x881BA59E, 0 }, { 0x87F78088, 0 },
|
||||
{ 0x87D36EA0, 0 }, { 0x87AF6FD6, 0 },
|
||||
{ 0x878B841B, 0 }, { 0x8767AB5F, 0x8767AB5F },
|
||||
{ 0x8743E595, 0 }, { 0x872032AC, 0x872032AC },
|
||||
{ 0x86FC9296, 0x86FC9296 }, { 0x86D90545, 0 },
|
||||
{ 0x86B58AA8, 0 }, { 0x869222B2, 0 },
|
||||
{ 0x866ECD53, 0x866ECD53 }, { 0x864B8A7E, 0 },
|
||||
{ 0x86285A23, 0x86285A23 }, { 0x86053C34, 0x86053C34 },
|
||||
{ 0x85E230A3, 0x85E230A3 }, { 0x85BF3761, 0x85BF3761 },
|
||||
{ 0x859C5060, 0x859C5060 }, { 0x85797B91, 0x85797B91 },
|
||||
{ 0x8556B8E7, 0x8556B8E7 }, { 0x85340853, 0x85340853 },
|
||||
{ 0x851169C7, 0x851169C7 }, { 0x84EEDD36, 0 },
|
||||
{ 0x84CC6290, 0 }, { 0x84A9F9C8, 0x84A9F9C8 },
|
||||
{ 0x8487A2D1, 0 }, { 0x84655D9C, 0 },
|
||||
{ 0x84432A1B, 0x84432A1B }, { 0x84210842, 0x84210842 },
|
||||
{ 0x83FEF802, 0x83FEF802 }, { 0x83DCF94E, 0 },
|
||||
{ 0x83BB0C18, 0 }, { 0x83993052, 0x83993052 },
|
||||
{ 0x837765F0, 0x837765F0 }, { 0x8355ACE4, 0 },
|
||||
{ 0x83340520, 0x83340520 }, { 0x83126E98, 0 },
|
||||
{ 0x82F0E93D, 0x82F0E93D }, { 0x82CF7504, 0 },
|
||||
{ 0x82AE11DE, 0 }, { 0x828CBFBF, 0 },
|
||||
{ 0x826B7E99, 0x826B7E99 }, { 0x824A4E61, 0 },
|
||||
{ 0x82292F08, 0 }, { 0x82082082, 0x82082082 },
|
||||
{ 0x81E722C2, 0x81E722C2 }, { 0x81C635BC, 0x81C635BC },
|
||||
{ 0x81A55963, 0 }, { 0x81848DA9, 0 },
|
||||
{ 0x8163D283, 0 }, { 0x814327E4, 0 },
|
||||
{ 0x81228DBF, 0 }, { 0x81020408, 0x81020408 },
|
||||
{ 0x80E18AB3, 0 }, { 0x80C121B3, 0 },
|
||||
{ 0x80A0C8FB, 0x80A0C8FB }, { 0x80808081, 0 },
|
||||
{ 0x80604836, 0x80604836 }, { 0x80402010, 0x80402010 },
|
||||
{ 0x80200802, 0x80200802 }, { 0xFFFFFFFF, 0xFFFFFFFF }
|
||||
};
|
||||
267
third_party/aom/av1/common/odintrin.h
vendored
Normal file
267
third_party/aom/av1/common/odintrin.h
vendored
Normal file
|
|
@ -0,0 +1,267 @@
|
|||
/*
|
||||
* Copyright (c) 2001-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.
|
||||
*/
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
#ifndef AV1_COMMON_ODINTRIN_H_
|
||||
#define AV1_COMMON_ODINTRIN_H_
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "aom/aom_integer.h"
|
||||
#include "aom_dsp/aom_dsp_common.h"
|
||||
#include "aom_ports/bitops.h"
|
||||
#include "av1/common/enums.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# if !defined(M_PI)
|
||||
# define M_PI (3.1415926535897932384626433832795)
|
||||
# endif
|
||||
|
||||
# if !defined(M_SQRT2)
|
||||
# define M_SQRT2 (1.41421356237309504880168872420970)
|
||||
# endif
|
||||
|
||||
# if !defined(M_SQRT1_2)
|
||||
# define M_SQRT1_2 (0.70710678118654752440084436210485)
|
||||
# endif
|
||||
|
||||
# if !defined(M_LOG2E)
|
||||
# define M_LOG2E (1.4426950408889634073599246810019)
|
||||
# endif
|
||||
|
||||
# if !defined(M_LN2)
|
||||
# define M_LN2 (0.69314718055994530941723212145818)
|
||||
# endif
|
||||
|
||||
/*Smallest blocks are 4x4*/
|
||||
#define OD_LOG_BSIZE0 (2)
|
||||
/*There are 5 block sizes total (4x4, 8x8, 16x16, 32x32 and 64x64).*/
|
||||
#define OD_NBSIZES (5)
|
||||
|
||||
/*There are 4 transform sizes total in AV1 (4x4, 8x8, 16x16 and 32x32).*/
|
||||
#define OD_TXSIZES TX_SIZES
|
||||
/*The log of the maximum length of the side of a transform.*/
|
||||
#define OD_LOG_TXSIZE_MAX (OD_LOG_BSIZE0 + OD_TXSIZES - 1)
|
||||
/*The maximum length of the side of a transform.*/
|
||||
#define OD_TXSIZE_MAX (1 << OD_LOG_TXSIZE_MAX)
|
||||
|
||||
/**The maximum number of color planes allowed in a single frame.*/
|
||||
# define OD_NPLANES_MAX (3)
|
||||
|
||||
# define OD_COEFF_SHIFT (4)
|
||||
|
||||
# define OD_DISABLE_CFL (1)
|
||||
# define OD_DISABLE_FILTER (1)
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
# define OD_ENABLE_ASSERTIONS (1)
|
||||
#endif
|
||||
|
||||
# define OD_LOG(a)
|
||||
# define OD_LOG_PARTIAL(a)
|
||||
|
||||
/*Possible block sizes, note that OD_BLOCK_NXN = log2(N) - 2.*/
|
||||
#define OD_BLOCK_4X4 (0)
|
||||
#define OD_BLOCK_8X8 (1)
|
||||
#define OD_BLOCK_16X16 (2)
|
||||
#define OD_BLOCK_32X32 (3)
|
||||
#define OD_BLOCK_SIZES (OD_BLOCK_32X32 + 1)
|
||||
|
||||
# define OD_LIMIT_BSIZE_MIN (OD_BLOCK_4X4)
|
||||
# define OD_LIMIT_BSIZE_MAX (OD_BLOCK_32X32)
|
||||
|
||||
typedef int od_coeff;
|
||||
|
||||
#define OD_DIVU_DMAX (1024)
|
||||
|
||||
extern uint32_t OD_DIVU_SMALL_CONSTS[OD_DIVU_DMAX][2];
|
||||
|
||||
/*Translate unsigned division by small divisors into multiplications.*/
|
||||
#define OD_DIVU_SMALL(_x, _d) \
|
||||
((uint32_t)((OD_DIVU_SMALL_CONSTS[(_d)-1][0] * (uint64_t)(_x) + \
|
||||
OD_DIVU_SMALL_CONSTS[(_d)-1][1]) >> \
|
||||
32) >> \
|
||||
(OD_ILOG_NZ(_d) - 1))
|
||||
|
||||
#define OD_DIVU(_x, _d) \
|
||||
(((_d) < OD_DIVU_DMAX) ? (OD_DIVU_SMALL((_x), (_d))) : ((_x) / (_d)))
|
||||
|
||||
#define OD_MINI AOMMIN
|
||||
#define OD_MAXI AOMMAX
|
||||
#define OD_CLAMPI(min, val, max) (OD_MAXI(min, OD_MINI(val, max)))
|
||||
|
||||
#define OD_CLZ0 (1)
|
||||
#define OD_CLZ(x) (-get_msb(x))
|
||||
#define OD_ILOG_NZ(x) (OD_CLZ0 - OD_CLZ(x))
|
||||
/*Note that __builtin_clz is not defined when x == 0, according to the gcc
|
||||
documentation (and that of the x86 BSR instruction that implements it), so
|
||||
we have to special-case it.
|
||||
We define a special version of the macro to use when x can be zero.*/
|
||||
#define OD_ILOG(x) ((x) ? OD_ILOG_NZ(x) : 0)
|
||||
|
||||
#define OD_LOG2(x) (M_LOG2E*log(x))
|
||||
#define OD_EXP2(x) (exp(M_LN2*(x)))
|
||||
|
||||
/*Enable special features for gcc and compatible compilers.*/
|
||||
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
|
||||
#define OD_GNUC_PREREQ(maj, min, pat) \
|
||||
((__GNUC__ << 16) + (__GNUC_MINOR__ << 8) + __GNUC_PATCHLEVEL__ >= \
|
||||
((maj) << 16) + ((min) << 8) + pat) // NOLINT
|
||||
#else
|
||||
#define OD_GNUC_PREREQ(maj, min, pat) (0)
|
||||
#endif
|
||||
|
||||
#if OD_GNUC_PREREQ(3, 4, 0)
|
||||
#define OD_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))
|
||||
#else
|
||||
#define OD_WARN_UNUSED_RESULT
|
||||
#endif
|
||||
|
||||
#if OD_GNUC_PREREQ(3, 4, 0)
|
||||
#define OD_ARG_NONNULL(x) __attribute__((__nonnull__(x)))
|
||||
#else
|
||||
#define OD_ARG_NONNULL(x)
|
||||
#endif
|
||||
|
||||
#if defined(OD_ENABLE_ASSERTIONS)
|
||||
#if OD_GNUC_PREREQ(2, 5, 0)
|
||||
__attribute__((noreturn))
|
||||
#endif
|
||||
void od_fatal_impl(const char *_str, const char *_file, int _line);
|
||||
|
||||
#define OD_FATAL(_str) (od_fatal_impl(_str, __FILE__, __LINE__))
|
||||
|
||||
#define OD_ASSERT(_cond) \
|
||||
do { \
|
||||
if (!(_cond)) { \
|
||||
OD_FATAL("assertion failed: " #_cond); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define OD_ASSERT2(_cond, _message) \
|
||||
do { \
|
||||
if (!(_cond)) { \
|
||||
OD_FATAL("assertion failed: " #_cond "\n" _message); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define OD_ALWAYS_TRUE(_cond) OD_ASSERT(_cond)
|
||||
|
||||
#else
|
||||
#define OD_ASSERT(_cond)
|
||||
#define OD_ASSERT2(_cond, _message)
|
||||
#define OD_ALWAYS_TRUE(_cond) ((void)(_cond))
|
||||
#endif
|
||||
|
||||
/** Copy n elements of memory from src to dst. The 0* term provides
|
||||
compile-time type checking */
|
||||
#if !defined(OVERRIDE_OD_COPY)
|
||||
#define OD_COPY(dst, src, n) \
|
||||
(memcpy((dst), (src), sizeof(*(dst)) * (n) + 0 * ((dst) - (src))))
|
||||
#endif
|
||||
|
||||
/** Copy n elements of memory from src to dst, allowing overlapping regions.
|
||||
The 0* term provides compile-time type checking */
|
||||
#if !defined(OVERRIDE_OD_MOVE)
|
||||
# define OD_MOVE(dst, src, n) \
|
||||
(memmove((dst), (src), sizeof(*(dst))*(n) + 0*((dst) - (src)) ))
|
||||
#endif
|
||||
|
||||
/** Linkage will break without this if using a C++ compiler, and will issue
|
||||
* warnings without this for a C compiler*/
|
||||
#if defined(__cplusplus)
|
||||
# define OD_EXTERN extern
|
||||
#else
|
||||
# define OD_EXTERN
|
||||
#endif
|
||||
|
||||
/** Set n elements of dst to zero */
|
||||
#if !defined(OVERRIDE_OD_CLEAR)
|
||||
# define OD_CLEAR(dst, n) (memset((dst), 0, sizeof(*(dst))*(n)))
|
||||
#endif
|
||||
|
||||
/** Silence unused parameter/variable warnings */
|
||||
# define OD_UNUSED(expr) (void)(expr)
|
||||
|
||||
#if defined(OD_FLOAT_PVQ)
|
||||
typedef double od_val16;
|
||||
typedef double od_val32;
|
||||
# define OD_QCONST32(x, bits) (x)
|
||||
# define OD_ROUND16(x) (x)
|
||||
# define OD_ROUND32(x) (x)
|
||||
# define OD_SHL(x, shift) (x)
|
||||
# define OD_SHR(x, shift) (x)
|
||||
# define OD_SHR_ROUND(x, shift) (x)
|
||||
# define OD_ABS(x) (fabs(x))
|
||||
# define OD_MULT16_16(a, b) ((a)*(b))
|
||||
# define OD_MULT16_32_Q16(a, b) ((a)*(b))
|
||||
#else
|
||||
typedef int16_t od_val16;
|
||||
typedef int32_t od_val32;
|
||||
/** Compile-time conversion of float constant to 32-bit value */
|
||||
# define OD_QCONST32(x, bits) ((od_val32)(.5 + (x)*(((od_val32)1) << (bits))))
|
||||
# define OD_ROUND16(x) (int16_t)(floor(.5 + (x)))
|
||||
# define OD_ROUND32(x) (int32_t)(floor(.5 + (x)))
|
||||
/*Shift x left by shift*/
|
||||
# define OD_SHL(a, shift) ((int32_t)((uint32_t)(a) << (shift)))
|
||||
/*Shift x right by shift (without rounding)*/
|
||||
# define OD_SHR(x, shift) \
|
||||
((int32_t)((x) >> (shift)))
|
||||
/*Shift x right by shift (with rounding)*/
|
||||
# define OD_SHR_ROUND(x, shift) \
|
||||
((int32_t)(((x) + (1 << (shift) >> 1)) >> (shift)))
|
||||
/*Shift x right by shift (without rounding) or left by -shift if shift
|
||||
is negative.*/
|
||||
# define OD_VSHR(x, shift) \
|
||||
(((shift) > 0) ? OD_SHR(x, shift) : OD_SHL(x, -(shift)))
|
||||
/*Shift x right by shift (with rounding) or left by -shift if shift
|
||||
is negative.*/
|
||||
# define OD_VSHR_ROUND(x, shift) \
|
||||
(((shift) > 0) ? OD_SHR_ROUND(x, shift) : OD_SHL(x, -(shift)))
|
||||
# define OD_ABS(x) (abs(x))
|
||||
/* (od_val32)(od_val16) gives TI compiler a hint that it's 16x16->32 multiply */
|
||||
/** 16x16 multiplication where the result fits in 32 bits */
|
||||
# define OD_MULT16_16(a, b) \
|
||||
(((od_val32)(od_val16)(a))*((od_val32)(od_val16)(b)))
|
||||
/* Multiplies 16-bit a by 32-bit b and keeps bits [16:47]. */
|
||||
# define OD_MULT16_32_Q16(a, b) ((int16_t)(a)*(int64_t)(int32_t)(b) >> 16)
|
||||
/*16x16 multiplication where the result fits in 16 bits, without rounding.*/
|
||||
# define OD_MULT16_16_Q15(a, b) \
|
||||
(((int16_t)(a)*((int32_t)(int16_t)(b))) >> 15)
|
||||
/*16x16 multiplication where the result fits in 16 bits, without rounding.*/
|
||||
# define OD_MULT16_16_Q16(a, b) \
|
||||
((((int16_t)(a))*((int32_t)(int16_t)(b))) >> 16)
|
||||
#endif
|
||||
|
||||
/*All of these macros should expect floats as arguments.*/
|
||||
/*These two should compile as a single SSE instruction.*/
|
||||
# define OD_MINF(a, b) ((a) < (b) ? (a) : (b))
|
||||
# define OD_MAXF(a, b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
# define OD_DIV_R0(x, y) (((x) + OD_FLIPSIGNI((((y) + 1) >> 1) - 1, (x)))/(y))
|
||||
|
||||
# define OD_SIGNMASK(a) (-((a) < 0))
|
||||
# define OD_FLIPSIGNI(a, b) (((a) + OD_SIGNMASK(b)) ^ OD_SIGNMASK(b))
|
||||
|
||||
# define OD_MULT16_16_Q15(a, b) \
|
||||
(((int16_t)(a)*((int32_t)(int16_t)(b))) >> 15)
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // AV1_COMMON_ODINTRIN_H_
|
||||
1027
third_party/aom/av1/common/onyxc_int.h
vendored
Normal file
1027
third_party/aom/av1/common/onyxc_int.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
256
third_party/aom/av1/common/partition.c
vendored
Normal file
256
third_party/aom/av1/common/partition.c
vendored
Normal file
|
|
@ -0,0 +1,256 @@
|
|||
/*
|
||||
* Copyright (c) 2001-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.
|
||||
*/
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "enums.h"
|
||||
#include "odintrin.h"
|
||||
#include "partition.h"
|
||||
#include "zigzag.h"
|
||||
|
||||
OD_EXTERN const index_pair *OD_ZIGZAG4[4] = {
|
||||
OD_ZIGZAG4_DCT_DCT,
|
||||
OD_ZIGZAG4_ADST_DCT,
|
||||
OD_ZIGZAG4_DCT_ADST,
|
||||
OD_ZIGZAG4_ADST_ADST
|
||||
};
|
||||
|
||||
OD_EXTERN const index_pair *OD_ZIGZAG8[4] = {
|
||||
OD_ZIGZAG8_DCT_DCT,
|
||||
OD_ZIGZAG8_ADST_DCT,
|
||||
OD_ZIGZAG8_DCT_ADST,
|
||||
OD_ZIGZAG8_ADST_ADST
|
||||
};
|
||||
|
||||
OD_EXTERN const index_pair *OD_ZIGZAG16[4] = {
|
||||
OD_ZIGZAG16_DCT_DCT,
|
||||
OD_ZIGZAG16_ADST_DCT,
|
||||
OD_ZIGZAG16_DCT_ADST,
|
||||
OD_ZIGZAG16_ADST_ADST
|
||||
};
|
||||
|
||||
OD_EXTERN const index_pair *OD_ZIGZAG32[4] = {
|
||||
OD_ZIGZAG32_DCT_DCT,
|
||||
OD_ZIGZAG32_DCT_DCT,
|
||||
OD_ZIGZAG32_DCT_DCT,
|
||||
OD_ZIGZAG32_DCT_DCT
|
||||
};
|
||||
|
||||
/* The tables below specify how coefficient blocks are translated to
|
||||
and from PVQ partition coding scan order for 4x4, 8x8 and 16x16 */
|
||||
|
||||
static const int OD_LAYOUT32_OFFSETS[4] = { 0, 128, 256, 768 };
|
||||
const band_layout OD_LAYOUT32 = {
|
||||
OD_ZIGZAG32,
|
||||
32,
|
||||
3,
|
||||
OD_LAYOUT32_OFFSETS
|
||||
};
|
||||
|
||||
static const int OD_LAYOUT16_OFFSETS[4] = { 0, 32, 64, 192 };
|
||||
const band_layout OD_LAYOUT16 = {
|
||||
OD_ZIGZAG16,
|
||||
16,
|
||||
3,
|
||||
OD_LAYOUT16_OFFSETS
|
||||
};
|
||||
|
||||
const int OD_LAYOUT8_OFFSETS[4] = { 0, 8, 16, 48 };
|
||||
const band_layout OD_LAYOUT8 = {
|
||||
OD_ZIGZAG8,
|
||||
8,
|
||||
3,
|
||||
OD_LAYOUT8_OFFSETS
|
||||
};
|
||||
|
||||
static const int OD_LAYOUT4_OFFSETS[2] = { 0, 15 };
|
||||
const band_layout OD_LAYOUT4 = {
|
||||
OD_ZIGZAG4,
|
||||
4,
|
||||
1,
|
||||
OD_LAYOUT4_OFFSETS
|
||||
};
|
||||
|
||||
/* First element is the number of bands, followed by the list all the band
|
||||
boundaries. */
|
||||
static const int OD_BAND_OFFSETS4[] = {1, 1, 16};
|
||||
static const int OD_BAND_OFFSETS8[] = {4, 1, 16, 24, 32, 64};
|
||||
static const int OD_BAND_OFFSETS16[] = {7, 1, 16, 24, 32, 64, 96, 128, 256};
|
||||
static const int OD_BAND_OFFSETS32[] = {10, 1, 16, 24, 32, 64, 96, 128, 256,
|
||||
384, 512, 1024};
|
||||
static const int OD_BAND_OFFSETS64[] = {13, 1, 16, 24, 32, 64, 96, 128, 256,
|
||||
384, 512, 1024, 1536, 2048, 4096};
|
||||
|
||||
const int *const OD_BAND_OFFSETS[OD_TXSIZES + 1] = {
|
||||
OD_BAND_OFFSETS4,
|
||||
OD_BAND_OFFSETS8,
|
||||
OD_BAND_OFFSETS16,
|
||||
OD_BAND_OFFSETS32,
|
||||
OD_BAND_OFFSETS64
|
||||
};
|
||||
|
||||
/** Perform a single stage of conversion from a coefficient block in
|
||||
* raster order into coding scan order
|
||||
*
|
||||
* @param [in] layout scan order specification
|
||||
* @param [out] dst destination vector
|
||||
* @param [in] src source coefficient block
|
||||
* @param [int] int source vector row stride
|
||||
*/
|
||||
static void od_band_from_raster(const band_layout *layout, tran_low_t *dst,
|
||||
const tran_low_t *src, int stride, TX_TYPE tx_type) {
|
||||
int i;
|
||||
int len;
|
||||
len = layout->band_offsets[layout->nb_bands];
|
||||
for (i = 0; i < len; i++) {
|
||||
dst[i] = src[layout->dst_table[tx_type][i][1]*stride + layout->dst_table[tx_type][i][0]];
|
||||
}
|
||||
}
|
||||
|
||||
/** Perform a single stage of conversion from a vector in coding scan
|
||||
order back into a coefficient block in raster order
|
||||
*
|
||||
* @param [in] layout scan order specification
|
||||
* @param [out] dst destination coefficient block
|
||||
* @param [in] src source vector
|
||||
* @param [int] stride destination vector row stride
|
||||
*/
|
||||
static void od_raster_from_band(const band_layout *layout, tran_low_t *dst,
|
||||
int stride, TX_TYPE tx_type, const tran_low_t *src) {
|
||||
int i;
|
||||
int len;
|
||||
len = layout->band_offsets[layout->nb_bands];
|
||||
for (i = 0; i < len; i++) {
|
||||
dst[layout->dst_table[tx_type][i][1]*stride + layout->dst_table[tx_type][i][0]] = src[i];
|
||||
}
|
||||
}
|
||||
|
||||
static const band_layout *const OD_LAYOUTS[] = {&OD_LAYOUT4, &OD_LAYOUT8,
|
||||
&OD_LAYOUT16, &OD_LAYOUT32};
|
||||
|
||||
/** Converts a coefficient block in raster order into a vector in
|
||||
* coding scan order with the PVQ partitions laid out one after
|
||||
* another. This works in stages; the 4x4 conversion is applied to
|
||||
* the coefficients nearest DC, then the 8x8 applied to the 8x8 block
|
||||
* nearest DC that was not already coded by 4x4, then 16x16 following
|
||||
* the same pattern.
|
||||
*
|
||||
* @param [out] dst destination vector
|
||||
* @param [in] n block size (along one side)
|
||||
* @param [in] ty_type transfrom type
|
||||
* @param [in] src source coefficient block
|
||||
* @param [in] stride source vector row stride
|
||||
*/
|
||||
void od_raster_to_coding_order(tran_low_t *dst, int n, TX_TYPE ty_type,
|
||||
const tran_low_t *src, int stride) {
|
||||
int bs;
|
||||
/* dst + 1 because DC is not included for 4x4 blocks. */
|
||||
od_band_from_raster(OD_LAYOUTS[0], dst + 1, src, stride, ty_type);
|
||||
for (bs = 1; bs < OD_TXSIZES; bs++) {
|
||||
int size;
|
||||
int offset;
|
||||
/* Length of block size > 4. */
|
||||
size = 1 << (OD_LOG_BSIZE0 + bs);
|
||||
/* Offset is the size of the previous block squared. */
|
||||
offset = 1 << 2*(OD_LOG_BSIZE0 - 1 + bs);
|
||||
if (n >= size) {
|
||||
/* 3 16x16 bands come after 3 8x8 bands, which come after 2 4x4 bands. */
|
||||
od_band_from_raster(OD_LAYOUTS[bs], dst + offset, src, stride, ty_type);
|
||||
}
|
||||
}
|
||||
dst[0] = src[0];
|
||||
}
|
||||
|
||||
/** Converts a vector in coding scan order witht he PVQ partitions
|
||||
* laid out one after another into a coefficient block in raster
|
||||
* order. This works in stages in the reverse order of raster->scan
|
||||
* order; the 16x16 conversion is applied to the coefficients that
|
||||
* don't appear in an 8x8 block, then the 8x8 applied to the 8x8 block
|
||||
* sans the 4x4 block it contains, then 4x4 is converted sans DC.
|
||||
*
|
||||
* @param [out] dst destination coefficient block
|
||||
* @param [in] stride destination vector row stride
|
||||
* @param [in] src source vector
|
||||
* @param [in] n block size (along one side)
|
||||
*/
|
||||
void od_coding_order_to_raster(tran_low_t *dst, int stride, TX_TYPE ty_type,
|
||||
const tran_low_t *src, int n) {
|
||||
int bs;
|
||||
/* src + 1 because DC is not included for 4x4 blocks. */
|
||||
od_raster_from_band(OD_LAYOUTS[0], dst, stride, ty_type, src + 1);
|
||||
for (bs = 1; bs < OD_TXSIZES; bs++) {
|
||||
int size;
|
||||
int offset;
|
||||
/* Length of block size > 4 */
|
||||
size = 1 << (OD_LOG_BSIZE0 + bs);
|
||||
/* Offset is the size of the previous block squared. */
|
||||
offset = 1 << 2*(OD_LOG_BSIZE0 - 1 + bs);
|
||||
if (n >= size) {
|
||||
/* 3 16x16 bands come after 3 8x8 bands, which come after 2 4x4 bands. */
|
||||
od_raster_from_band(OD_LAYOUTS[bs], dst, stride, ty_type, src + offset);
|
||||
}
|
||||
}
|
||||
dst[0] = src[0];
|
||||
}
|
||||
|
||||
/** Perform a single stage of conversion from a coefficient block in
|
||||
* raster order into coding scan order
|
||||
*
|
||||
* @param [in] layout scan order specification
|
||||
* @param [out] dst destination vector
|
||||
* @param [in] src source coefficient block
|
||||
* @param [int] int source vector row stride
|
||||
*/
|
||||
static void od_band_from_raster_16(const band_layout *layout, int16_t *dst,
|
||||
const int16_t *src, int stride) {
|
||||
int i;
|
||||
int len;
|
||||
len = layout->band_offsets[layout->nb_bands];
|
||||
for (i = 0; i < len; i++) {
|
||||
dst[i] = src[layout->dst_table[DCT_DCT][i][1]*stride + layout->dst_table[DCT_DCT][i][0]];
|
||||
}
|
||||
}
|
||||
|
||||
/** Converts a coefficient block in raster order into a vector in
|
||||
* coding scan order with the PVQ partitions laid out one after
|
||||
* another. This works in stages; the 4x4 conversion is applied to
|
||||
* the coefficients nearest DC, then the 8x8 applied to the 8x8 block
|
||||
* nearest DC that was not already coded by 4x4, then 16x16 following
|
||||
* the same pattern.
|
||||
*
|
||||
* @param [out] dst destination vector
|
||||
* @param [in] n block size (along one side)
|
||||
* @param [in] src source coefficient block
|
||||
* @param [in] stride source vector row stride
|
||||
*/
|
||||
void od_raster_to_coding_order_16(int16_t *dst, int n, const int16_t *src,
|
||||
int stride) {
|
||||
int bs;
|
||||
/* dst + 1 because DC is not included for 4x4 blocks. */
|
||||
od_band_from_raster_16(OD_LAYOUTS[0], dst + 1, src, stride);
|
||||
for (bs = 1; bs < OD_TXSIZES; bs++) {
|
||||
int size;
|
||||
int offset;
|
||||
/* Length of block size > 4. */
|
||||
size = 1 << (OD_LOG_BSIZE0 + bs);
|
||||
/* Offset is the size of the previous block squared. */
|
||||
offset = 1 << 2*(OD_LOG_BSIZE0 - 1 + bs);
|
||||
if (n >= size) {
|
||||
/* 3 16x16 bands come after 3 8x8 bands, which come after 2 4x4 bands. */
|
||||
od_band_from_raster_16(OD_LAYOUTS[bs], dst + offset, src, stride);
|
||||
}
|
||||
}
|
||||
dst[0] = src[0];
|
||||
}
|
||||
40
third_party/aom/av1/common/partition.h
vendored
Normal file
40
third_party/aom/av1/common/partition.h
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (c) 2001-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.
|
||||
*/
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
#if !defined(_partition_H)
|
||||
# define _partition_H
|
||||
|
||||
#include "av1/common/enums.h"
|
||||
#include "odintrin.h"
|
||||
|
||||
typedef unsigned char index_pair[2];
|
||||
|
||||
typedef struct {
|
||||
const index_pair **const dst_table;
|
||||
int size;
|
||||
int nb_bands;
|
||||
const int *const band_offsets;
|
||||
} band_layout;
|
||||
|
||||
extern const int *const OD_BAND_OFFSETS[OD_TXSIZES + 1];
|
||||
|
||||
void od_raster_to_coding_order(tran_low_t *dst, int n, TX_TYPE ty_type,
|
||||
const tran_low_t *src, int stride);
|
||||
|
||||
void od_coding_order_to_raster(tran_low_t *dst, int stride, TX_TYPE ty_type,
|
||||
const tran_low_t *src, int n);
|
||||
|
||||
void od_raster_to_coding_order_16(int16_t *dst, int n, const int16_t *src,
|
||||
int stride);
|
||||
|
||||
#endif
|
||||
1408
third_party/aom/av1/common/pred_common.c
vendored
Normal file
1408
third_party/aom/av1/common/pred_common.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
266
third_party/aom/av1/common/pred_common.h
vendored
Normal file
266
third_party/aom/av1/common/pred_common.h
vendored
Normal file
|
|
@ -0,0 +1,266 @@
|
|||
/*
|
||||
* 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_COMMON_PRED_COMMON_H_
|
||||
#define AV1_COMMON_PRED_COMMON_H_
|
||||
|
||||
#include "av1/common/blockd.h"
|
||||
#include "av1/common/onyxc_int.h"
|
||||
#include "aom_dsp/aom_dsp_common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static INLINE int get_segment_id(const AV1_COMMON *const cm,
|
||||
const uint8_t *segment_ids, BLOCK_SIZE bsize,
|
||||
int mi_row, int mi_col) {
|
||||
const int mi_offset = mi_row * cm->mi_cols + mi_col;
|
||||
const int bw = mi_size_wide[bsize];
|
||||
const int bh = mi_size_high[bsize];
|
||||
const int xmis = AOMMIN(cm->mi_cols - mi_col, bw);
|
||||
const int ymis = AOMMIN(cm->mi_rows - mi_row, bh);
|
||||
int x, y, segment_id = MAX_SEGMENTS;
|
||||
|
||||
for (y = 0; y < ymis; ++y)
|
||||
for (x = 0; x < xmis; ++x)
|
||||
segment_id =
|
||||
AOMMIN(segment_id, segment_ids[mi_offset + y * cm->mi_cols + x]);
|
||||
|
||||
assert(segment_id >= 0 && segment_id < MAX_SEGMENTS);
|
||||
return segment_id;
|
||||
}
|
||||
|
||||
static INLINE int av1_get_pred_context_seg_id(const MACROBLOCKD *xd) {
|
||||
const MODE_INFO *const above_mi = xd->above_mi;
|
||||
const MODE_INFO *const left_mi = xd->left_mi;
|
||||
const int above_sip =
|
||||
(above_mi != NULL) ? above_mi->mbmi.seg_id_predicted : 0;
|
||||
const int left_sip = (left_mi != NULL) ? left_mi->mbmi.seg_id_predicted : 0;
|
||||
|
||||
return above_sip + left_sip;
|
||||
}
|
||||
|
||||
static INLINE aom_prob av1_get_pred_prob_seg_id(
|
||||
const struct segmentation_probs *segp, const MACROBLOCKD *xd) {
|
||||
return segp->pred_probs[av1_get_pred_context_seg_id(xd)];
|
||||
}
|
||||
|
||||
static INLINE int av1_get_skip_context(const MACROBLOCKD *xd) {
|
||||
const MODE_INFO *const above_mi = xd->above_mi;
|
||||
const MODE_INFO *const left_mi = xd->left_mi;
|
||||
const int above_skip = (above_mi != NULL) ? above_mi->mbmi.skip : 0;
|
||||
const int left_skip = (left_mi != NULL) ? left_mi->mbmi.skip : 0;
|
||||
return above_skip + left_skip;
|
||||
}
|
||||
|
||||
static INLINE aom_prob av1_get_skip_prob(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
return cm->fc->skip_probs[av1_get_skip_context(xd)];
|
||||
}
|
||||
|
||||
#if CONFIG_DUAL_FILTER
|
||||
int av1_get_pred_context_switchable_interp(const MACROBLOCKD *xd, int dir);
|
||||
#else
|
||||
int av1_get_pred_context_switchable_interp(const MACROBLOCKD *xd);
|
||||
#endif
|
||||
|
||||
#if CONFIG_EXT_INTRA
|
||||
#if CONFIG_INTRA_INTERP
|
||||
int av1_get_pred_context_intra_interp(const MACROBLOCKD *xd);
|
||||
#endif // CONFIG_INTRA_INTERP
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
|
||||
int av1_get_intra_inter_context(const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_intra_inter_prob(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
return cm->fc->intra_inter_prob[av1_get_intra_inter_context(xd)];
|
||||
}
|
||||
|
||||
int av1_get_reference_mode_context(const AV1_COMMON *cm, const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_reference_mode_prob(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
return cm->fc->comp_inter_prob[av1_get_reference_mode_context(cm, xd)];
|
||||
}
|
||||
|
||||
int av1_get_pred_context_comp_ref_p(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_pred_prob_comp_ref_p(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
const int pred_context = av1_get_pred_context_comp_ref_p(cm, xd);
|
||||
return cm->fc->comp_ref_prob[pred_context][0];
|
||||
}
|
||||
|
||||
#if CONFIG_EXT_REFS
|
||||
int av1_get_pred_context_comp_ref_p1(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_pred_prob_comp_ref_p1(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
const int pred_context = av1_get_pred_context_comp_ref_p1(cm, xd);
|
||||
return cm->fc->comp_ref_prob[pred_context][1];
|
||||
}
|
||||
|
||||
int av1_get_pred_context_comp_ref_p2(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_pred_prob_comp_ref_p2(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
const int pred_context = av1_get_pred_context_comp_ref_p2(cm, xd);
|
||||
return cm->fc->comp_ref_prob[pred_context][2];
|
||||
}
|
||||
|
||||
int av1_get_pred_context_comp_bwdref_p(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_pred_prob_comp_bwdref_p(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
const int pred_context = av1_get_pred_context_comp_bwdref_p(cm, xd);
|
||||
return cm->fc->comp_bwdref_prob[pred_context][0];
|
||||
}
|
||||
#endif // CONFIG_EXT_REFS
|
||||
|
||||
int av1_get_pred_context_single_ref_p1(const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_pred_prob_single_ref_p1(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
return cm->fc->single_ref_prob[av1_get_pred_context_single_ref_p1(xd)][0];
|
||||
}
|
||||
|
||||
int av1_get_pred_context_single_ref_p2(const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_pred_prob_single_ref_p2(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
return cm->fc->single_ref_prob[av1_get_pred_context_single_ref_p2(xd)][1];
|
||||
}
|
||||
|
||||
#if CONFIG_EXT_REFS
|
||||
int av1_get_pred_context_single_ref_p3(const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_pred_prob_single_ref_p3(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
return cm->fc->single_ref_prob[av1_get_pred_context_single_ref_p3(xd)][2];
|
||||
}
|
||||
|
||||
int av1_get_pred_context_single_ref_p4(const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_pred_prob_single_ref_p4(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
return cm->fc->single_ref_prob[av1_get_pred_context_single_ref_p4(xd)][3];
|
||||
}
|
||||
|
||||
int av1_get_pred_context_single_ref_p5(const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_pred_prob_single_ref_p5(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
return cm->fc->single_ref_prob[av1_get_pred_context_single_ref_p5(xd)][4];
|
||||
}
|
||||
#endif // CONFIG_EXT_REFS
|
||||
|
||||
#if CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF
|
||||
int av1_get_inter_mode_context(const MACROBLOCKD *xd);
|
||||
|
||||
static INLINE aom_prob av1_get_inter_mode_prob(const AV1_COMMON *cm,
|
||||
const MACROBLOCKD *xd) {
|
||||
return cm->fc->comp_inter_mode_prob[av1_get_inter_mode_context(xd)];
|
||||
}
|
||||
#endif // CONFIG_EXT_INTER && CONFIG_COMPOUND_SINGLEREF
|
||||
|
||||
// Returns a context number for the given MB prediction signal
|
||||
// The mode info data structure has a one element border above and to the
|
||||
// left of the entries corresponding to real blocks.
|
||||
// The prediction flags in these dummy entries are initialized to 0.
|
||||
static INLINE int get_tx_size_context(const MACROBLOCKD *xd) {
|
||||
const int max_tx_size = max_txsize_lookup[xd->mi[0]->mbmi.sb_type];
|
||||
const MB_MODE_INFO *const above_mbmi = xd->above_mbmi;
|
||||
const MB_MODE_INFO *const left_mbmi = xd->left_mbmi;
|
||||
const int has_above = xd->up_available;
|
||||
const int has_left = xd->left_available;
|
||||
int above_ctx = (has_above && !above_mbmi->skip)
|
||||
? (int)txsize_sqr_map[above_mbmi->tx_size]
|
||||
: max_tx_size;
|
||||
int left_ctx = (has_left && !left_mbmi->skip)
|
||||
? (int)txsize_sqr_map[left_mbmi->tx_size]
|
||||
: max_tx_size;
|
||||
|
||||
if (!has_left) left_ctx = above_ctx;
|
||||
|
||||
if (!has_above) above_ctx = left_ctx;
|
||||
#if CONFIG_CB4X4
|
||||
// TODO(jingning): Temporary setup. Will rework this after the cb4x4
|
||||
// framework is up running.
|
||||
return (above_ctx + left_ctx) > max_tx_size + 1;
|
||||
#else
|
||||
return (above_ctx + left_ctx) > max_tx_size;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CONFIG_VAR_TX
|
||||
static void update_tx_counts(AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
MB_MODE_INFO *mbmi, BLOCK_SIZE plane_bsize,
|
||||
TX_SIZE tx_size, int blk_row, int blk_col,
|
||||
TX_SIZE max_tx_size, int ctx) {
|
||||
const struct macroblockd_plane *const pd = &xd->plane[0];
|
||||
const BLOCK_SIZE bsize = txsize_to_bsize[tx_size];
|
||||
const int tx_row = blk_row >> (1 - pd->subsampling_y);
|
||||
const int tx_col = blk_col >> (1 - pd->subsampling_x);
|
||||
const TX_SIZE plane_tx_size = mbmi->inter_tx_size[tx_row][tx_col];
|
||||
const int max_blocks_high = max_block_high(xd, plane_bsize, 0);
|
||||
const int max_blocks_wide = max_block_wide(xd, plane_bsize, 0);
|
||||
|
||||
if (blk_row >= max_blocks_high || blk_col >= max_blocks_wide) return;
|
||||
|
||||
if (tx_size == plane_tx_size) {
|
||||
++xd->counts->tx_size[max_tx_size - TX_8X8][ctx][tx_size];
|
||||
mbmi->tx_size = tx_size;
|
||||
} else {
|
||||
int bsl = b_width_log2_lookup[bsize];
|
||||
int i;
|
||||
|
||||
assert(bsl > 0);
|
||||
--bsl;
|
||||
|
||||
for (i = 0; i < 4; ++i) {
|
||||
const int offsetr = blk_row + ((i >> 1) << bsl);
|
||||
const int offsetc = blk_col + ((i & 0x01) << bsl);
|
||||
|
||||
if (offsetr >= max_blocks_high || offsetc >= max_blocks_wide) continue;
|
||||
update_tx_counts(cm, xd, mbmi, plane_bsize, (TX_SIZE)(tx_size - 1),
|
||||
offsetr, offsetc, max_tx_size, ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE void inter_block_tx_count_update(AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
MB_MODE_INFO *mbmi,
|
||||
BLOCK_SIZE plane_bsize,
|
||||
int ctx) {
|
||||
const int mi_width = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
|
||||
const int mi_height = block_size_high[plane_bsize] >> tx_size_wide_log2[0];
|
||||
TX_SIZE max_tx_size = max_txsize_lookup[plane_bsize];
|
||||
int bh = tx_size_wide_unit[max_tx_size];
|
||||
int idx, idy;
|
||||
|
||||
for (idy = 0; idy < mi_height; idy += bh)
|
||||
for (idx = 0; idx < mi_width; idx += bh)
|
||||
update_tx_counts(cm, xd, mbmi, plane_bsize, max_tx_size, idy, idx,
|
||||
max_tx_size, ctx);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // AV1_COMMON_PRED_COMMON_H_
|
||||
1007
third_party/aom/av1/common/pvq.c
vendored
Normal file
1007
third_party/aom/av1/common/pvq.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
183
third_party/aom/av1/common/pvq.h
vendored
Normal file
183
third_party/aom/av1/common/pvq.h
vendored
Normal file
|
|
@ -0,0 +1,183 @@
|
|||
/*
|
||||
* Copyright (c) 2001-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.
|
||||
*/
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
#if !defined(_pvq_H)
|
||||
# define _pvq_H (1)
|
||||
# include "generic_code.h"
|
||||
# include "odintrin.h"
|
||||
|
||||
extern const uint16_t EXP_CDF_TABLE[][16];
|
||||
extern const uint16_t LAPLACE_OFFSET[];
|
||||
|
||||
#if CONFIG_DAALA_DIST
|
||||
#define AV1_PVQ_ENABLE_ACTIVITY_MASKING (1)
|
||||
#else
|
||||
#define AV1_PVQ_ENABLE_ACTIVITY_MASKING (0)
|
||||
#endif
|
||||
|
||||
# define PVQ_MAX_PARTITIONS (1 + 3*(OD_TXSIZES-1))
|
||||
|
||||
# define OD_NOREF_ADAPT_SPEED (4)
|
||||
/* Normalized lambda for PVQ quantizer. Since we normalize the gain by q, the
|
||||
distortion is normalized by q^2 and lambda does not need the q^2 factor.
|
||||
At high rate, this would be log(2)/6, but we're using a slightly more
|
||||
aggressive value, closer to:
|
||||
Li, Xiang, et al. "Laplace distribution based Lagrangian rate distortion
|
||||
optimization for hybrid video coding." Circuits and Systems for Video
|
||||
Technology, IEEE Transactions on 19.2 (2009): 193-205.
|
||||
*/
|
||||
# define OD_PVQ_LAMBDA (.1146)
|
||||
|
||||
#define OD_PVQ_SKIP_ZERO 1
|
||||
#define OD_PVQ_SKIP_COPY 2
|
||||
|
||||
/* Maximum size for coding a PVQ band. */
|
||||
#define OD_MAX_PVQ_SIZE (1024)
|
||||
|
||||
#if defined(OD_FLOAT_PVQ)
|
||||
#define OD_QM_SHIFT (15)
|
||||
#else
|
||||
#define OD_QM_SHIFT (11)
|
||||
#endif
|
||||
#define OD_QM_SCALE (1 << OD_QM_SHIFT)
|
||||
#if defined(OD_FLOAT_PVQ)
|
||||
#define OD_QM_SCALE_1 (1./OD_QM_SCALE)
|
||||
#endif
|
||||
#define OD_QM_SCALE_MAX 32767
|
||||
#define OD_QM_INV_SHIFT (12)
|
||||
#define OD_QM_INV_SCALE (1 << OD_QM_INV_SHIFT)
|
||||
#if defined(OD_FLOAT_PVQ)
|
||||
#define OD_QM_INV_SCALE_1 (1./OD_QM_INV_SCALE)
|
||||
#endif
|
||||
#define OD_QM_OFFSET(bs) ((((1 << 2*bs) - 1) << 2*OD_LOG_BSIZE0)/3)
|
||||
#define OD_QM_STRIDE (OD_QM_OFFSET(OD_TXSIZES))
|
||||
#define OD_QM_BUFFER_SIZE (2*OD_QM_STRIDE)
|
||||
|
||||
#if !defined(OD_FLOAT_PVQ)
|
||||
#define OD_THETA_SHIFT (15)
|
||||
#define OD_THETA_SCALE ((1 << OD_THETA_SHIFT)*2./M_PI)
|
||||
#define OD_MAX_THETA_SCALE (1 << OD_THETA_SHIFT)
|
||||
#define OD_TRIG_SCALE (32768)
|
||||
#define OD_BETA_SHIFT (12)
|
||||
#define OD_BETA_SCALE_1 (1./(1 << OD_BETA_SHIFT))
|
||||
/*Multiplies 16-bit a by 32-bit b and keeps bits [16:64-OD_BETA_SHIFT-1].*/
|
||||
#define OD_MULT16_32_QBETA(a, b) \
|
||||
((int16_t)(a)*(int64_t)(int32_t)(b) >> OD_BETA_SHIFT)
|
||||
# define OD_MULT16_16_QBETA(a, b) \
|
||||
((((int16_t)(a))*((int32_t)(int16_t)(b))) >> OD_BETA_SHIFT)
|
||||
#define OD_CGAIN_SHIFT (8)
|
||||
#define OD_CGAIN_SCALE (1 << OD_CGAIN_SHIFT)
|
||||
#else
|
||||
#define OD_BETA_SCALE_1 (1.)
|
||||
#define OD_THETA_SCALE (1)
|
||||
#define OD_TRIG_SCALE (1)
|
||||
#define OD_CGAIN_SCALE (1)
|
||||
#endif
|
||||
#define OD_THETA_SCALE_1 (1./OD_THETA_SCALE)
|
||||
#define OD_TRIG_SCALE_1 (1./OD_TRIG_SCALE)
|
||||
#define OD_CGAIN_SCALE_1 (1./OD_CGAIN_SCALE)
|
||||
#define OD_CGAIN_SCALE_2 (OD_CGAIN_SCALE_1*OD_CGAIN_SCALE_1)
|
||||
|
||||
/* Largest PVQ partition is half the coefficients of largest block size. */
|
||||
#define MAXN (OD_TXSIZE_MAX*OD_TXSIZE_MAX/2)
|
||||
|
||||
#define OD_COMPAND_SHIFT (8 + OD_COEFF_SHIFT)
|
||||
#define OD_COMPAND_SCALE (1 << OD_COMPAND_SHIFT)
|
||||
#define OD_COMPAND_SCALE_1 (1./OD_COMPAND_SCALE)
|
||||
|
||||
#define OD_QM_SIZE (OD_TXSIZES*(OD_TXSIZES + 1))
|
||||
|
||||
#define OD_FLAT_QM 0
|
||||
#define OD_HVS_QM 1
|
||||
|
||||
# define OD_NSB_ADAPT_CTXS (4)
|
||||
|
||||
# define OD_ADAPT_K_Q8 0
|
||||
# define OD_ADAPT_SUM_EX_Q8 1
|
||||
# define OD_ADAPT_COUNT_Q8 2
|
||||
# define OD_ADAPT_COUNT_EX_Q8 3
|
||||
|
||||
# define OD_ADAPT_NO_VALUE (-2147483647-1)
|
||||
|
||||
typedef enum {
|
||||
PVQ_SKIP = 0x0,
|
||||
DC_CODED = 0x1,
|
||||
AC_CODED = 0x2,
|
||||
AC_DC_CODED = 0x3,
|
||||
} PVQ_SKIP_TYPE;
|
||||
|
||||
typedef struct od_pvq_adapt_ctx od_pvq_adapt_ctx;
|
||||
typedef struct od_pvq_codeword_ctx od_pvq_codeword_ctx;
|
||||
|
||||
struct od_pvq_codeword_ctx {
|
||||
int pvq_adapt[2*OD_TXSIZES*OD_NSB_ADAPT_CTXS];
|
||||
/* CDFs are size 16 despite the fact that we're using less than that. */
|
||||
uint16_t pvq_k1_cdf[12][CDF_SIZE(16)];
|
||||
uint16_t pvq_split_cdf[22*7][CDF_SIZE(8)];
|
||||
};
|
||||
|
||||
struct od_pvq_adapt_ctx {
|
||||
od_pvq_codeword_ctx pvq_codeword_ctx;
|
||||
generic_encoder pvq_param_model[3];
|
||||
int pvq_ext[OD_TXSIZES*PVQ_MAX_PARTITIONS];
|
||||
int pvq_exg[OD_NPLANES_MAX][OD_TXSIZES][PVQ_MAX_PARTITIONS];
|
||||
uint16_t pvq_gaintheta_cdf[2*OD_TXSIZES*PVQ_MAX_PARTITIONS][CDF_SIZE(16)];
|
||||
uint16_t pvq_skip_dir_cdf[2*(OD_TXSIZES-1)][CDF_SIZE(7)];
|
||||
};
|
||||
|
||||
typedef struct od_qm_entry {
|
||||
int interp_q;
|
||||
int scale_q8;
|
||||
const unsigned char *qm_q4;
|
||||
} od_qm_entry;
|
||||
|
||||
extern const od_qm_entry OD_DEFAULT_QMS[2][2][OD_NPLANES_MAX];
|
||||
|
||||
void od_adapt_pvq_ctx_reset(od_pvq_adapt_ctx *state, int is_keyframe);
|
||||
int od_pvq_size_ctx(int n);
|
||||
int od_pvq_k1_ctx(int n, int orig_size);
|
||||
|
||||
od_val16 od_pvq_sin(od_val32 x);
|
||||
od_val16 od_pvq_cos(od_val32 x);
|
||||
#if !defined(OD_FLOAT_PVQ)
|
||||
int od_vector_log_mag(const od_coeff *x, int n);
|
||||
#endif
|
||||
|
||||
void od_interp_qm(unsigned char *out, int q, const od_qm_entry *entry1,
|
||||
const od_qm_entry *entry2);
|
||||
|
||||
int od_qm_get_index(int bs, int band);
|
||||
|
||||
extern const od_val16 *const OD_PVQ_BETA[2][OD_NPLANES_MAX][OD_TXSIZES + 1];
|
||||
|
||||
void od_init_qm(int16_t *x, int16_t *x_inv, const int *qm);
|
||||
int od_compute_householder(od_val16 *r, int n, od_val32 gr, int *sign,
|
||||
int shift);
|
||||
void od_apply_householder(od_val16 *out, const od_val16 *x, const od_val16 *r,
|
||||
int n);
|
||||
void od_pvq_synthesis_partial(od_coeff *xcoeff, const od_coeff *ypulse,
|
||||
const od_val16 *r, int n,
|
||||
int noref, od_val32 g,
|
||||
od_val32 theta, int m, int s,
|
||||
const int16_t *qm_inv);
|
||||
od_val32 od_gain_expand(od_val32 cg, int q0, od_val16 beta);
|
||||
od_val32 od_pvq_compute_gain(const od_val16 *x, int n, int q0, od_val32 *g,
|
||||
od_val16 beta, int bshift);
|
||||
int od_pvq_compute_max_theta(od_val32 qcg, od_val16 beta);
|
||||
od_val32 od_pvq_compute_theta(int t, int max_theta);
|
||||
int od_pvq_compute_k(od_val32 qcg, int itheta, int noref, int n, od_val16 beta);
|
||||
|
||||
int od_vector_is_null(const od_coeff *x, int len);
|
||||
int od_qm_offset(int bs, int xydec);
|
||||
|
||||
#endif
|
||||
50
third_party/aom/av1/common/pvq_state.c
vendored
Normal file
50
third_party/aom/av1/common/pvq_state.c
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (c) 2001-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 "av1/common/pvq_state.h"
|
||||
#include "av1/common/odintrin.h"
|
||||
|
||||
void od_adapt_ctx_reset(od_adapt_ctx *adapt, int is_keyframe) {
|
||||
int pli;
|
||||
od_adapt_pvq_ctx_reset(&adapt->pvq, is_keyframe);
|
||||
OD_CDFS_INIT_Q15(adapt->skip_cdf);
|
||||
for (pli = 0; pli < OD_NPLANES_MAX; pli++) {
|
||||
int i;
|
||||
OD_CDFS_INIT_DYNAMIC(adapt->model_dc[pli].cdf);
|
||||
for (i = 0; i < OD_TXSIZES; i++) {
|
||||
int j;
|
||||
adapt->ex_g[pli][i] = 8;
|
||||
for (j = 0; j < 3; j++) {
|
||||
adapt->ex_dc[pli][i][j] = pli > 0 ? 8 : 32768;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void od_init_skipped_coeffs(int16_t *d, int16_t *pred, int is_keyframe, int bo,
|
||||
int n, int w) {
|
||||
int i;
|
||||
int j;
|
||||
if (is_keyframe) {
|
||||
for (i = 0; i < n; i++) {
|
||||
for (j = 0; j < n; j++) {
|
||||
/* skip DC */
|
||||
if (i || j) d[bo + i * w + j] = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < n; i++) {
|
||||
for (j = 0; j < n; j++) {
|
||||
d[bo + i * w + j] = pred[i * n + j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
52
third_party/aom/av1/common/pvq_state.h
vendored
Normal file
52
third_party/aom/av1/common/pvq_state.h
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (c) 2001-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.
|
||||
*/
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
#if !defined(_state_H)
|
||||
# define _state_H (1)
|
||||
|
||||
typedef struct od_state od_state;
|
||||
typedef struct od_adapt_ctx od_adapt_ctx;
|
||||
|
||||
# include "generic_code.h"
|
||||
# include "odintrin.h"
|
||||
# include "pvq.h"
|
||||
|
||||
/*Adaptation speed of scalar Laplace encoding.*/
|
||||
# define OD_SCALAR_ADAPT_SPEED (4)
|
||||
|
||||
struct od_adapt_ctx {
|
||||
/* Support for PVQ encode/decode */
|
||||
od_pvq_adapt_ctx pvq;
|
||||
|
||||
generic_encoder model_dc[OD_NPLANES_MAX];
|
||||
|
||||
int ex_dc[OD_NPLANES_MAX][OD_TXSIZES][3];
|
||||
int ex_g[OD_NPLANES_MAX][OD_TXSIZES];
|
||||
|
||||
/* Joint skip flag for DC and AC */
|
||||
uint16_t skip_cdf[OD_TXSIZES*2][CDF_SIZE(4)];
|
||||
};
|
||||
|
||||
struct od_state {
|
||||
od_adapt_ctx *adapt;
|
||||
unsigned char pvq_qm_q4[OD_NPLANES_MAX][OD_QM_SIZE];
|
||||
/* Quantization matrices and their inverses. */
|
||||
int16_t qm[OD_QM_BUFFER_SIZE];
|
||||
int16_t qm_inv[OD_QM_BUFFER_SIZE];
|
||||
};
|
||||
|
||||
void od_adapt_ctx_reset(od_adapt_ctx *state, int is_keyframe);
|
||||
void od_init_skipped_coeffs(int16_t *d, int16_t *pred, int is_keyframe,
|
||||
int bo, int n, int w);
|
||||
|
||||
#endif
|
||||
11369
third_party/aom/av1/common/quant_common.c
vendored
Normal file
11369
third_party/aom/av1/common/quant_common.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
111
third_party/aom/av1/common/quant_common.h
vendored
Normal file
111
third_party/aom/av1/common/quant_common.h
vendored
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* 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_COMMON_QUANT_COMMON_H_
|
||||
#define AV1_COMMON_QUANT_COMMON_H_
|
||||
|
||||
#include "aom/aom_codec.h"
|
||||
#include "av1/common/seg_common.h"
|
||||
#include "av1/common/enums.h"
|
||||
#include "av1/common/entropy.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MINQ 0
|
||||
#define MAXQ 255
|
||||
#define QINDEX_RANGE (MAXQ - MINQ + 1)
|
||||
#define QINDEX_BITS 8
|
||||
#if CONFIG_AOM_QM
|
||||
// Total number of QM sets stored
|
||||
#define QM_LEVEL_BITS 4
|
||||
#define NUM_QM_LEVELS (1 << QM_LEVEL_BITS)
|
||||
/* Offset into the list of QMs. Actual number of levels used is
|
||||
(NUM_QM_LEVELS-AOM_QM_OFFSET)
|
||||
Lower value of AOM_QM_OFFSET implies more heavily weighted matrices.*/
|
||||
#define DEFAULT_QM_FIRST (NUM_QM_LEVELS / 2)
|
||||
#define DEFAULT_QM_LAST (NUM_QM_LEVELS - 1)
|
||||
#endif
|
||||
|
||||
struct AV1Common;
|
||||
|
||||
int16_t av1_dc_quant(int qindex, int delta, aom_bit_depth_t bit_depth);
|
||||
int16_t av1_ac_quant(int qindex, int delta, aom_bit_depth_t bit_depth);
|
||||
int16_t av1_qindex_from_ac(int ac, aom_bit_depth_t bit_depth);
|
||||
|
||||
int av1_get_qindex(const struct segmentation *seg, int segment_id,
|
||||
int base_qindex);
|
||||
#if CONFIG_AOM_QM
|
||||
// Reduce the large number of quantizers to a smaller number of levels for which
|
||||
// different matrices may be defined
|
||||
static INLINE int aom_get_qmlevel(int qindex, int first, int last) {
|
||||
int qmlevel = (qindex * (last + 1 - first) + QINDEX_RANGE / 2) / QINDEX_RANGE;
|
||||
qmlevel = AOMMIN(qmlevel + first, NUM_QM_LEVELS - 1);
|
||||
return qmlevel;
|
||||
}
|
||||
void aom_qm_init(struct AV1Common *cm);
|
||||
qm_val_t *aom_iqmatrix(struct AV1Common *cm, int qindex, int comp,
|
||||
int log2sizem2, int is_intra);
|
||||
qm_val_t *aom_qmatrix(struct AV1Common *cm, int qindex, int comp,
|
||||
int log2sizem2, int is_intra);
|
||||
#endif
|
||||
|
||||
#if CONFIG_NEW_QUANT
|
||||
|
||||
#define QUANT_PROFILES 4
|
||||
#define QUANT_RANGES 2
|
||||
#define NUQ_KNOTS 3
|
||||
|
||||
typedef tran_low_t dequant_val_type_nuq[NUQ_KNOTS + 1];
|
||||
typedef tran_low_t cuml_bins_type_nuq[NUQ_KNOTS];
|
||||
void av1_get_dequant_val_nuq(int q, int band, tran_low_t *dq,
|
||||
tran_low_t *cuml_bins, int dq_off_index);
|
||||
tran_low_t av1_dequant_abscoeff_nuq(int v, int q, const tran_low_t *dq);
|
||||
tran_low_t av1_dequant_coeff_nuq(int v, int q, const tran_low_t *dq);
|
||||
|
||||
static INLINE int qindex_to_qrange(int qindex) {
|
||||
return (qindex < 140 ? 1 : 0);
|
||||
}
|
||||
|
||||
static INLINE int get_dq_profile_from_ctx(int qindex, int q_ctx, int is_inter,
|
||||
PLANE_TYPE plane_type) {
|
||||
// intra/inter, Y/UV, ctx, qrange
|
||||
static const int
|
||||
def_dq_profile_lookup[REF_TYPES][PLANE_TYPES][COEFF_CONTEXTS0]
|
||||
[QUANT_RANGES] = {
|
||||
{
|
||||
// intra
|
||||
{ { 2, 1 }, { 2, 1 }, { 2, 1 } }, // Y
|
||||
{ { 3, 1 }, { 3, 1 }, { 3, 1 } }, // UV
|
||||
},
|
||||
{
|
||||
// inter
|
||||
{ { 3, 1 }, { 2, 1 }, { 2, 1 } }, // Y
|
||||
{ { 3, 1 }, { 3, 1 }, { 3, 1 } }, // UV
|
||||
},
|
||||
};
|
||||
if (!qindex) return 0; // lossless
|
||||
return def_dq_profile_lookup[is_inter][plane_type][q_ctx]
|
||||
[qindex_to_qrange(qindex)];
|
||||
}
|
||||
#endif // CONFIG_NEW_QUANT
|
||||
|
||||
#if CONFIG_PVQ || CONFIG_DAALA_DIST
|
||||
extern const int OD_QM8_Q4_FLAT[];
|
||||
extern const int OD_QM8_Q4_HVS[];
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // AV1_COMMON_QUANT_COMMON_H_
|
||||
3083
third_party/aom/av1/common/reconinter.c
vendored
Normal file
3083
third_party/aom/av1/common/reconinter.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
828
third_party/aom/av1/common/reconinter.h
vendored
Normal file
828
third_party/aom/av1/common/reconinter.h
vendored
Normal file
|
|
@ -0,0 +1,828 @@
|
|||
/*
|
||||
* 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_COMMON_RECONINTER_H_
|
||||
#define AV1_COMMON_RECONINTER_H_
|
||||
|
||||
#include "av1/common/filter.h"
|
||||
#include "av1/common/onyxc_int.h"
|
||||
#include "av1/common/convolve.h"
|
||||
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
#include "av1/common/warped_motion.h"
|
||||
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
#include "aom/aom_integer.h"
|
||||
|
||||
#if CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
|
||||
#define WARP_WM_NEIGHBORS_WITH_OBMC 0
|
||||
#endif // CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
|
||||
|
||||
#if CONFIG_MOTION_VAR && CONFIG_GLOBAL_MOTION
|
||||
#define WARP_GM_NEIGHBORS_WITH_OBMC 0
|
||||
#endif // CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static INLINE void inter_predictor(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride,
|
||||
const int subpel_x, const int subpel_y,
|
||||
const struct scale_factors *sf, int w, int h,
|
||||
ConvolveParams *conv_params,
|
||||
#if CONFIG_DUAL_FILTER
|
||||
const InterpFilter *interp_filter,
|
||||
#else
|
||||
const InterpFilter interp_filter,
|
||||
#endif
|
||||
int xs, int ys) {
|
||||
#if CONFIG_DUAL_FILTER
|
||||
InterpFilter filter_x = av1_get_plane_interp_filter(
|
||||
interp_filter[1 + 2 * conv_params->ref], conv_params->plane);
|
||||
InterpFilter filter_y = av1_get_plane_interp_filter(
|
||||
interp_filter[0 + 2 * conv_params->ref], conv_params->plane);
|
||||
InterpFilterParams interp_filter_params_x =
|
||||
av1_get_interp_filter_params(filter_x);
|
||||
InterpFilterParams interp_filter_params_y =
|
||||
av1_get_interp_filter_params(filter_y);
|
||||
#else
|
||||
InterpFilterParams interp_filter_params =
|
||||
av1_get_interp_filter_params(interp_filter);
|
||||
#endif
|
||||
|
||||
assert(sf);
|
||||
#if CONFIG_DUAL_FILTER
|
||||
if (interp_filter_params_x.taps == SUBPEL_TAPS &&
|
||||
interp_filter_params_y.taps == SUBPEL_TAPS && w > 2 && h > 2 &&
|
||||
conv_params->round == CONVOLVE_OPT_ROUND && xs == 16 && ys == 16) {
|
||||
const int16_t *kernel_x =
|
||||
av1_get_interp_filter_subpel_kernel(interp_filter_params_x, subpel_x);
|
||||
const int16_t *kernel_y =
|
||||
av1_get_interp_filter_subpel_kernel(interp_filter_params_y, subpel_y);
|
||||
#else
|
||||
if (interp_filter_params.taps == SUBPEL_TAPS && w > 2 && h > 2 &&
|
||||
conv_params->round == CONVOLVE_OPT_ROUND && xs == 16 && ys == 16) {
|
||||
const int16_t *kernel_x =
|
||||
av1_get_interp_filter_subpel_kernel(interp_filter_params, subpel_x);
|
||||
const int16_t *kernel_y =
|
||||
av1_get_interp_filter_subpel_kernel(interp_filter_params, subpel_y);
|
||||
#endif
|
||||
sf->predict[subpel_x != 0][subpel_y != 0][conv_params->ref](
|
||||
src, src_stride, dst, dst_stride, kernel_x, xs, kernel_y, ys, w, h);
|
||||
} else {
|
||||
// ref_idx > 0 means this is the second reference frame
|
||||
// first reference frame's prediction result is already in dst
|
||||
// therefore we need to average the first and second results
|
||||
#if CONFIG_CONVOLVE_ROUND
|
||||
if (conv_params->round == CONVOLVE_OPT_NO_ROUND && xs == 16 && ys == 16)
|
||||
av1_convolve_2d_facade(src, src_stride, dst, dst_stride, w, h,
|
||||
#if CONFIG_DUAL_FILTER
|
||||
interp_filter,
|
||||
#else
|
||||
&interp_filter,
|
||||
#endif
|
||||
subpel_x, xs, subpel_y, ys, conv_params);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (xs == 16 && ys == 16) {
|
||||
av1_convolve(src, src_stride, dst, dst_stride, w, h, interp_filter,
|
||||
subpel_x, xs, subpel_y, ys, conv_params);
|
||||
} else {
|
||||
// If xs == 16 || ys == 16 scaling is happening and the SSE2
|
||||
// instructions don't support scaling; use the C versions to be safe.
|
||||
av1_convolve_c(src, src_stride, dst, dst_stride, w, h, interp_filter,
|
||||
subpel_x, xs, subpel_y, ys, conv_params);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
static INLINE void highbd_inter_predictor(const uint8_t *src, int src_stride,
|
||||
uint8_t *dst, int dst_stride,
|
||||
const int subpel_x,
|
||||
const int subpel_y,
|
||||
const struct scale_factors *sf, int w,
|
||||
int h, int ref,
|
||||
#if CONFIG_DUAL_FILTER
|
||||
const InterpFilter *interp_filter,
|
||||
#else
|
||||
const InterpFilter interp_filter,
|
||||
#endif
|
||||
int xs, int ys, int bd) {
|
||||
#if CONFIG_DUAL_FILTER
|
||||
InterpFilterParams interp_filter_params_x =
|
||||
av1_get_interp_filter_params(interp_filter[1 + 2 * ref]);
|
||||
InterpFilterParams interp_filter_params_y =
|
||||
av1_get_interp_filter_params(interp_filter[0 + 2 * ref]);
|
||||
#else
|
||||
InterpFilterParams interp_filter_params =
|
||||
av1_get_interp_filter_params(interp_filter);
|
||||
#endif
|
||||
|
||||
#if CONFIG_DUAL_FILTER
|
||||
if (interp_filter_params_x.taps == SUBPEL_TAPS &&
|
||||
interp_filter_params_y.taps == SUBPEL_TAPS && w > 2 && h > 2) {
|
||||
const int16_t *kernel_x =
|
||||
av1_get_interp_filter_subpel_kernel(interp_filter_params_x, subpel_x);
|
||||
const int16_t *kernel_y =
|
||||
av1_get_interp_filter_subpel_kernel(interp_filter_params_y, subpel_y);
|
||||
#else
|
||||
if (interp_filter_params.taps == SUBPEL_TAPS && w > 2 && h > 2) {
|
||||
const int16_t *kernel_x =
|
||||
av1_get_interp_filter_subpel_kernel(interp_filter_params, subpel_x);
|
||||
const int16_t *kernel_y =
|
||||
av1_get_interp_filter_subpel_kernel(interp_filter_params, subpel_y);
|
||||
#endif // CONFIG_DUAL_FILTER
|
||||
sf->highbd_predict[subpel_x != 0][subpel_y != 0][ref](
|
||||
src, src_stride, dst, dst_stride, kernel_x, xs, kernel_y, ys, w, h, bd);
|
||||
} else {
|
||||
// ref > 0 means this is the second reference frame
|
||||
// first reference frame's prediction result is already in dst
|
||||
// therefore we need to average the first and second results
|
||||
int avg = ref > 0;
|
||||
av1_highbd_convolve(src, src_stride, dst, dst_stride, w, h, interp_filter,
|
||||
subpel_x, xs, subpel_y, ys, avg, bd);
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
||||
#if CONFIG_EXT_INTER
|
||||
// Set to (1 << 5) if the 32-ary codebooks are used for any bock size
|
||||
#define MAX_WEDGE_TYPES (1 << 4)
|
||||
|
||||
#define MAX_WEDGE_SIZE_LOG2 5 // 32x32
|
||||
#define MAX_WEDGE_SIZE (1 << MAX_WEDGE_SIZE_LOG2)
|
||||
#define MAX_WEDGE_SQUARE (MAX_WEDGE_SIZE * MAX_WEDGE_SIZE)
|
||||
|
||||
#define WEDGE_WEIGHT_BITS 6
|
||||
|
||||
#define WEDGE_NONE -1
|
||||
|
||||
// Angles are with respect to horizontal anti-clockwise
|
||||
typedef enum {
|
||||
WEDGE_HORIZONTAL = 0,
|
||||
WEDGE_VERTICAL = 1,
|
||||
WEDGE_OBLIQUE27 = 2,
|
||||
WEDGE_OBLIQUE63 = 3,
|
||||
WEDGE_OBLIQUE117 = 4,
|
||||
WEDGE_OBLIQUE153 = 5,
|
||||
WEDGE_DIRECTIONS
|
||||
} WedgeDirectionType;
|
||||
|
||||
// 3-tuple: {direction, x_offset, y_offset}
|
||||
typedef struct {
|
||||
WedgeDirectionType direction;
|
||||
int x_offset;
|
||||
int y_offset;
|
||||
} wedge_code_type;
|
||||
|
||||
typedef uint8_t *wedge_masks_type[MAX_WEDGE_TYPES];
|
||||
|
||||
typedef struct {
|
||||
int bits;
|
||||
const wedge_code_type *codebook;
|
||||
uint8_t *signflip;
|
||||
int smoother;
|
||||
wedge_masks_type *masks;
|
||||
} wedge_params_type;
|
||||
|
||||
extern const wedge_params_type wedge_params_lookup[BLOCK_SIZES];
|
||||
|
||||
static INLINE int is_interinter_compound_used(COMPOUND_TYPE type,
|
||||
BLOCK_SIZE sb_type) {
|
||||
(void)sb_type;
|
||||
switch (type) {
|
||||
case COMPOUND_AVERAGE: return 1;
|
||||
#if CONFIG_WEDGE
|
||||
case COMPOUND_WEDGE: return wedge_params_lookup[sb_type].bits > 0;
|
||||
#endif // CONFIG_WEDGE
|
||||
#if CONFIG_COMPOUND_SEGMENT
|
||||
case COMPOUND_SEG: return sb_type >= BLOCK_8X8;
|
||||
#endif // CONFIG_COMPOUND_SEGMENT
|
||||
default: assert(0); return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE int is_any_masked_compound_used(BLOCK_SIZE sb_type) {
|
||||
COMPOUND_TYPE comp_type;
|
||||
for (comp_type = 0; comp_type < COMPOUND_TYPES; comp_type++) {
|
||||
if (is_masked_compound_type(comp_type) &&
|
||||
is_interinter_compound_used(comp_type, sb_type))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static INLINE int get_wedge_bits_lookup(BLOCK_SIZE sb_type) {
|
||||
return wedge_params_lookup[sb_type].bits;
|
||||
}
|
||||
|
||||
static INLINE int get_interinter_wedge_bits(BLOCK_SIZE sb_type) {
|
||||
const int wbits = wedge_params_lookup[sb_type].bits;
|
||||
return (wbits > 0) ? wbits + 1 : 0;
|
||||
}
|
||||
|
||||
static INLINE int is_interintra_wedge_used(BLOCK_SIZE sb_type) {
|
||||
(void)sb_type;
|
||||
return wedge_params_lookup[sb_type].bits > 0;
|
||||
}
|
||||
|
||||
static INLINE int get_interintra_wedge_bits(BLOCK_SIZE sb_type) {
|
||||
return wedge_params_lookup[sb_type].bits;
|
||||
}
|
||||
|
||||
#if CONFIG_COMPOUND_SEGMENT
|
||||
void build_compound_seg_mask(uint8_t *mask, SEG_MASK_TYPE mask_type,
|
||||
const uint8_t *src0, int src0_stride,
|
||||
const uint8_t *src1, int src1_stride,
|
||||
BLOCK_SIZE sb_type, int h, int w);
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
void build_compound_seg_mask_highbd(uint8_t *mask, SEG_MASK_TYPE mask_type,
|
||||
const uint8_t *src0, int src0_stride,
|
||||
const uint8_t *src1, int src1_stride,
|
||||
BLOCK_SIZE sb_type, int h, int w, int bd);
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
#endif // CONFIG_COMPOUND_SEGMENT
|
||||
#endif // CONFIG_EXT_INTER
|
||||
|
||||
void build_inter_predictors(MACROBLOCKD *xd, int plane,
|
||||
#if CONFIG_MOTION_VAR
|
||||
int mi_col_offset, int mi_row_offset,
|
||||
#endif // CONFIG_MOTION_VAR
|
||||
int block, int bw, int bh, int x, int y, int w,
|
||||
int h,
|
||||
#if CONFIG_SUPERTX && CONFIG_EXT_INTER
|
||||
int wedge_offset_x, int wedge_offset_y,
|
||||
#endif // CONFIG_SUPERTX && CONFIG_EXT_INTER
|
||||
int mi_x, int mi_y);
|
||||
|
||||
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
// This function will determine whether or not to create a warped
|
||||
// prediction and return the appropriate motion model depending
|
||||
// on the configuration. Behavior will change with different
|
||||
// combinations of GLOBAL_MOTION, WARPED_MOTION and MOTION_VAR.
|
||||
static INLINE int allow_warp(const MODE_INFO *const mi,
|
||||
const WarpTypesAllowed *const warp_types,
|
||||
#if CONFIG_GLOBAL_MOTION
|
||||
const WarpedMotionParams *const gm_params,
|
||||
#endif // CONFIG_GLOBAL_MOTION
|
||||
#if CONFIG_MOTION_VAR
|
||||
int mi_col_offset, int mi_row_offset,
|
||||
#endif // CONFIG_MOTION_VAR
|
||||
WarpedMotionParams *final_warp_params) {
|
||||
const MB_MODE_INFO *const mbmi = &mi->mbmi;
|
||||
set_default_warp_params(final_warp_params);
|
||||
|
||||
// Only global motion configured
|
||||
#if CONFIG_GLOBAL_MOTION && !CONFIG_WARPED_MOTION && !CONFIG_MOTION_VAR
|
||||
(void)mbmi;
|
||||
if (warp_types->global_warp_allowed) {
|
||||
memcpy(final_warp_params, gm_params, sizeof(*final_warp_params));
|
||||
return 1;
|
||||
}
|
||||
#endif // CONFIG_GLOBAL_MOTION && !CONFIG_WARPED_MOTION && !CONFIG_MOTION_VAR
|
||||
|
||||
// Only warped motion configured
|
||||
#if CONFIG_WARPED_MOTION && !CONFIG_GLOBAL_MOTION && !CONFIG_MOTION_VAR
|
||||
if (warp_types->local_warp_allowed) {
|
||||
memcpy(final_warp_params, &mbmi->wm_params[0], sizeof(*final_warp_params));
|
||||
return 1;
|
||||
}
|
||||
#endif // CONFIG_WARPED_MOTION && !CONFIG_GLOBAL_MOTION && !CONFIG_MOTION_VAR
|
||||
|
||||
// Warped and global motion configured
|
||||
#if CONFIG_GLOBAL_MOTION && CONFIG_WARPED_MOTION && !CONFIG_MOTION_VAR
|
||||
// When both are enabled, warped will take priority. The global parameters
|
||||
// will only be used to compute projection samples to find the warped model.
|
||||
// Note that, if SEPARATE_GLOBAL_MOTION is enabled and a block chooses
|
||||
// global, it will not be possible to select WARPED_CAUSAL.
|
||||
if (warp_types->local_warp_allowed) {
|
||||
memcpy(final_warp_params, &mbmi->wm_params[0], sizeof(*final_warp_params));
|
||||
return 1;
|
||||
} else if (warp_types->global_warp_allowed) {
|
||||
memcpy(final_warp_params, gm_params, sizeof(*final_warp_params));
|
||||
return 1;
|
||||
}
|
||||
#endif // CONFIG_GLOBAL_MOTION && CONFIG_WARPED_MOTION && !CONFIG_MOTION_VAR
|
||||
|
||||
// Motion var and global motion configured
|
||||
#if CONFIG_GLOBAL_MOTION && CONFIG_MOTION_VAR && !CONFIG_WARPED_MOTION
|
||||
// We warp if either case is true:
|
||||
// 1.) We are predicting a block which uses global motion
|
||||
// 2.) We are predicting a neighboring block of a block using OBMC,
|
||||
// the neighboring block uses global motion, and we have enabled
|
||||
// WARP_GM_NEIGHBORS_WITH_OBMC
|
||||
const int build_for_obmc = !(mi_col_offset == 0 && mi_row_offset == 0);
|
||||
(void)mbmi;
|
||||
if (warp_types->global_warp_allowed &&
|
||||
(WARP_GM_NEIGHBORS_WITH_OBMC || !build_for_obmc)) {
|
||||
memcpy(final_warp_params, gm_params, sizeof(*final_warp_params));
|
||||
return 1;
|
||||
}
|
||||
#endif // CONFIG_GLOBAL_MOTION && CONFIG_MOTION_VAR && !CONFIG_WARPED_MOTION
|
||||
|
||||
// Motion var and warped motion configured
|
||||
#if CONFIG_WARPED_MOTION && CONFIG_MOTION_VAR && !CONFIG_GLOBAL_MOTION
|
||||
// We warp if either case is true:
|
||||
// 1.) We are predicting a block with motion mode WARPED_CAUSAL
|
||||
// 2.) We are predicting a neighboring block of a block using OBMC,
|
||||
// the neighboring block has mode WARPED_CAUSAL, and we have enabled
|
||||
// WARP_WM_NEIGHBORS_WITH_OBMC
|
||||
const int build_for_obmc = !(mi_col_offset == 0 && mi_row_offset == 0);
|
||||
if (warp_types->local_warp_allowed) {
|
||||
if ((build_for_obmc && WARP_WM_NEIGHBORS_WITH_OBMC) || (!build_for_obmc)) {
|
||||
memcpy(final_warp_params, &mbmi->wm_params[0],
|
||||
sizeof(*final_warp_params));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_WARPED_MOTION && CONFIG_MOTION_VAR && !CONFIG_GLOBAL_MOTION
|
||||
|
||||
// Motion var, warped motion and global motion all configured
|
||||
#if CONFIG_WARPED_MOTION && CONFIG_MOTION_VAR && CONFIG_GLOBAL_MOTION
|
||||
const int build_for_obmc = !(mi_col_offset == 0 && mi_row_offset == 0);
|
||||
if (warp_types->local_warp_allowed) {
|
||||
if ((build_for_obmc && WARP_WM_NEIGHBORS_WITH_OBMC) || (!build_for_obmc)) {
|
||||
memcpy(final_warp_params, &mbmi->wm_params[0],
|
||||
sizeof(*final_warp_params));
|
||||
return 1;
|
||||
}
|
||||
} else if (warp_types->global_warp_allowed &&
|
||||
(WARP_GM_NEIGHBORS_WITH_OBMC || !build_for_obmc)) {
|
||||
memcpy(final_warp_params, gm_params, sizeof(*final_warp_params));
|
||||
return 1;
|
||||
}
|
||||
#endif // CONFIG_WARPED_MOTION && CONFIG_MOTION_VAR && CONFIG_GLOBAL_MOTION
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif // CONFIG_GLOBAL_MOTION ||CONFIG_WARPED_MOTION
|
||||
|
||||
static INLINE void av1_make_inter_predictor(
|
||||
const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride,
|
||||
const int subpel_x, const int subpel_y, const struct scale_factors *sf,
|
||||
int w, int h, ConvolveParams *conv_params,
|
||||
#if CONFIG_DUAL_FILTER
|
||||
const InterpFilter *interp_filter,
|
||||
#else
|
||||
const InterpFilter interp_filter,
|
||||
#endif
|
||||
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
const WarpTypesAllowed *warp_types, int p_col, int p_row, int plane,
|
||||
int ref,
|
||||
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
#if CONFIG_MOTION_VAR
|
||||
int mi_col_offset, int mi_row_offset,
|
||||
#endif
|
||||
int xs, int ys, const MACROBLOCKD *xd) {
|
||||
(void)xd;
|
||||
|
||||
#if CONFIG_MOTION_VAR
|
||||
const MODE_INFO *mi = xd->mi[mi_col_offset + xd->mi_stride * mi_row_offset];
|
||||
#else
|
||||
const MODE_INFO *mi = xd->mi[0];
|
||||
(void)mi;
|
||||
#endif // CONFIG_MOTION_VAR
|
||||
|
||||
// Make sure the selected motion mode is valid for this configuration
|
||||
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
|
||||
assert_motion_mode_valid(mi->mbmi.motion_mode,
|
||||
#if CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
|
||||
0, xd->global_motion,
|
||||
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
|
||||
mi);
|
||||
#endif // CONFIG MOTION_VAR || CONFIG_WARPED_MOTION
|
||||
|
||||
#if CONFIG_WARPED_MOTION || CONFIG_GLOBAL_MOTION
|
||||
WarpedMotionParams final_warp_params;
|
||||
const int do_warp = allow_warp(mi, warp_types,
|
||||
#if CONFIG_GLOBAL_MOTION
|
||||
&xd->global_motion[mi->mbmi.ref_frame[ref]],
|
||||
#endif // CONFIG_GLOBAL_MOTION
|
||||
#if CONFIG_MOTION_VAR
|
||||
mi_col_offset, mi_row_offset,
|
||||
#endif // CONFIG_MOTION_VAR
|
||||
&final_warp_params);
|
||||
if (do_warp) {
|
||||
const struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
const struct buf_2d *const pre_buf = &pd->pre[ref];
|
||||
av1_warp_plane(&final_warp_params,
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd,
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
pre_buf->buf0, pre_buf->width, pre_buf->height,
|
||||
pre_buf->stride, dst, p_col, p_row, w, h, dst_stride,
|
||||
pd->subsampling_x, pd->subsampling_y, xs, ys, ref);
|
||||
return;
|
||||
}
|
||||
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
highbd_inter_predictor(src, src_stride, dst, dst_stride, subpel_x, subpel_y,
|
||||
sf, w, h, conv_params->ref, interp_filter, xs, ys,
|
||||
xd->bd);
|
||||
return;
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
inter_predictor(src, src_stride, dst, dst_stride, subpel_x, subpel_y, sf, w,
|
||||
h, conv_params, interp_filter, xs, ys);
|
||||
}
|
||||
|
||||
#if CONFIG_EXT_INTER
|
||||
void av1_make_masked_inter_predictor(const uint8_t *pre, int pre_stride,
|
||||
uint8_t *dst, int dst_stride,
|
||||
const int subpel_x, const int subpel_y,
|
||||
const struct scale_factors *sf, int w,
|
||||
int h,
|
||||
#if CONFIG_DUAL_FILTER
|
||||
const InterpFilter *interp_filter,
|
||||
#else
|
||||
const InterpFilter interp_filter,
|
||||
#endif
|
||||
int xs, int ys,
|
||||
#if CONFIG_SUPERTX
|
||||
int wedge_offset_x, int wedge_offset_y,
|
||||
#endif // CONFIG_SUPERTX
|
||||
int plane,
|
||||
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
const WarpTypesAllowed *warp_types,
|
||||
int p_col, int p_row, int ref,
|
||||
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
MACROBLOCKD *xd);
|
||||
#endif // CONFIG_EXT_INTER
|
||||
|
||||
static INLINE int round_mv_comp_q4(int value) {
|
||||
return (value < 0 ? value - 2 : value + 2) / 4;
|
||||
}
|
||||
|
||||
static MV mi_mv_pred_q4(const MODE_INFO *mi, int idx) {
|
||||
MV res = {
|
||||
round_mv_comp_q4(
|
||||
mi->bmi[0].as_mv[idx].as_mv.row + mi->bmi[1].as_mv[idx].as_mv.row +
|
||||
mi->bmi[2].as_mv[idx].as_mv.row + mi->bmi[3].as_mv[idx].as_mv.row),
|
||||
round_mv_comp_q4(
|
||||
mi->bmi[0].as_mv[idx].as_mv.col + mi->bmi[1].as_mv[idx].as_mv.col +
|
||||
mi->bmi[2].as_mv[idx].as_mv.col + mi->bmi[3].as_mv[idx].as_mv.col)
|
||||
};
|
||||
return res;
|
||||
}
|
||||
|
||||
static INLINE int round_mv_comp_q2(int value) {
|
||||
return (value < 0 ? value - 1 : value + 1) / 2;
|
||||
}
|
||||
|
||||
static MV mi_mv_pred_q2(const MODE_INFO *mi, int idx, int block0, int block1) {
|
||||
MV res = { round_mv_comp_q2(mi->bmi[block0].as_mv[idx].as_mv.row +
|
||||
mi->bmi[block1].as_mv[idx].as_mv.row),
|
||||
round_mv_comp_q2(mi->bmi[block0].as_mv[idx].as_mv.col +
|
||||
mi->bmi[block1].as_mv[idx].as_mv.col) };
|
||||
return res;
|
||||
}
|
||||
|
||||
// TODO(jkoleszar): yet another mv clamping function :-(
|
||||
static INLINE MV clamp_mv_to_umv_border_sb(const MACROBLOCKD *xd,
|
||||
const MV *src_mv, int bw, int bh,
|
||||
int ss_x, int ss_y) {
|
||||
// If the MV points so far into the UMV border that no visible pixels
|
||||
// are used for reconstruction, the subpel part of the MV can be
|
||||
// discarded and the MV limited to 16 pixels with equivalent results.
|
||||
const int spel_left = (AOM_INTERP_EXTEND + bw) << SUBPEL_BITS;
|
||||
const int spel_right = spel_left - SUBPEL_SHIFTS;
|
||||
const int spel_top = (AOM_INTERP_EXTEND + bh) << SUBPEL_BITS;
|
||||
const int spel_bottom = spel_top - SUBPEL_SHIFTS;
|
||||
MV clamped_mv = { src_mv->row * (1 << (1 - ss_y)),
|
||||
src_mv->col * (1 << (1 - ss_x)) };
|
||||
assert(ss_x <= 1);
|
||||
assert(ss_y <= 1);
|
||||
|
||||
clamp_mv(&clamped_mv, xd->mb_to_left_edge * (1 << (1 - ss_x)) - spel_left,
|
||||
xd->mb_to_right_edge * (1 << (1 - ss_x)) + spel_right,
|
||||
xd->mb_to_top_edge * (1 << (1 - ss_y)) - spel_top,
|
||||
xd->mb_to_bottom_edge * (1 << (1 - ss_y)) + spel_bottom);
|
||||
|
||||
return clamped_mv;
|
||||
}
|
||||
|
||||
static INLINE MV average_split_mvs(const struct macroblockd_plane *pd,
|
||||
const MODE_INFO *mi, int ref, int block) {
|
||||
const int ss_idx = ((pd->subsampling_x > 0) << 1) | (pd->subsampling_y > 0);
|
||||
MV res = { 0, 0 };
|
||||
switch (ss_idx) {
|
||||
case 0: res = mi->bmi[block].as_mv[ref].as_mv; break;
|
||||
case 1: res = mi_mv_pred_q2(mi, ref, block, block + 2); break;
|
||||
case 2: res = mi_mv_pred_q2(mi, ref, block, block + 1); break;
|
||||
case 3: res = mi_mv_pred_q4(mi, ref); break;
|
||||
default: assert(ss_idx <= 3 && ss_idx >= 0);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void av1_build_inter_predictor_sub8x8(MACROBLOCKD *xd, int plane, int i, int ir,
|
||||
int ic, int mi_row, int mi_col);
|
||||
|
||||
void av1_build_inter_predictors_sby(MACROBLOCKD *xd, int mi_row, int mi_col,
|
||||
BUFFER_SET *ctx, BLOCK_SIZE bsize);
|
||||
|
||||
void av1_build_inter_predictors_sbuv(MACROBLOCKD *xd, int mi_row, int mi_col,
|
||||
BUFFER_SET *ctx, BLOCK_SIZE bsize);
|
||||
|
||||
void av1_build_inter_predictors_sb(MACROBLOCKD *xd, int mi_row, int mi_col,
|
||||
BUFFER_SET *ctx, BLOCK_SIZE bsize);
|
||||
|
||||
#if CONFIG_SUPERTX
|
||||
void av1_build_inter_predictors_sb_sub8x8_extend(MACROBLOCKD *xd,
|
||||
#if CONFIG_EXT_INTER
|
||||
int mi_row_ori, int mi_col_ori,
|
||||
#endif // CONFIG_EXT_INTER
|
||||
int mi_row, int mi_col,
|
||||
BLOCK_SIZE bsize, int block);
|
||||
|
||||
void av1_build_inter_predictors_sb_extend(MACROBLOCKD *xd,
|
||||
#if CONFIG_EXT_INTER
|
||||
int mi_row_ori, int mi_col_ori,
|
||||
#endif // CONFIG_EXT_INTER
|
||||
int mi_row, int mi_col,
|
||||
BLOCK_SIZE bsize);
|
||||
struct macroblockd_plane;
|
||||
void av1_build_masked_inter_predictor_complex(
|
||||
MACROBLOCKD *xd, uint8_t *dst, int dst_stride, const uint8_t *pre,
|
||||
int pre_stride, int mi_row, int mi_col, int mi_row_ori, int mi_col_ori,
|
||||
BLOCK_SIZE bsize, BLOCK_SIZE top_bsize, PARTITION_TYPE partition,
|
||||
int plane);
|
||||
#endif // CONFIG_SUPERTX
|
||||
|
||||
void av1_build_inter_predictor(const uint8_t *src, int src_stride, uint8_t *dst,
|
||||
int dst_stride, const MV *src_mv,
|
||||
const struct scale_factors *sf, int w, int h,
|
||||
ConvolveParams *conv_params,
|
||||
#if CONFIG_DUAL_FILTER
|
||||
const InterpFilter *interp_filter,
|
||||
#else
|
||||
const InterpFilter interp_filter,
|
||||
#endif
|
||||
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
const WarpTypesAllowed *warp_types, int p_col,
|
||||
int p_row, int plane, int ref,
|
||||
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
enum mv_precision precision, int x, int y,
|
||||
const MACROBLOCKD *xd);
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
void av1_highbd_build_inter_predictor(
|
||||
const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride,
|
||||
const MV *mv_q3, const struct scale_factors *sf, int w, int h, int do_avg,
|
||||
#if CONFIG_DUAL_FILTER
|
||||
const InterpFilter *interp_filter,
|
||||
#else
|
||||
const InterpFilter interp_filter,
|
||||
#endif
|
||||
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
const WarpTypesAllowed *warp_types, int p_col, int p_row,
|
||||
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
|
||||
int plane, enum mv_precision precision, int x, int y,
|
||||
const MACROBLOCKD *xd);
|
||||
#endif
|
||||
|
||||
static INLINE int scaled_buffer_offset(int x_offset, int y_offset, int stride,
|
||||
const struct scale_factors *sf) {
|
||||
const int x = sf ? sf->scale_value_x(x_offset, sf) : x_offset;
|
||||
const int y = sf ? sf->scale_value_y(y_offset, sf) : y_offset;
|
||||
return y * stride + x;
|
||||
}
|
||||
|
||||
static INLINE void setup_pred_plane(struct buf_2d *dst, BLOCK_SIZE bsize,
|
||||
uint8_t *src, int width, int height,
|
||||
int stride, int mi_row, int mi_col,
|
||||
const struct scale_factors *scale,
|
||||
int subsampling_x, int subsampling_y) {
|
||||
#if CONFIG_CHROMA_SUB8X8
|
||||
if (bsize < BLOCK_8X8) {
|
||||
// Offset the buffer pointer
|
||||
if (subsampling_y && (mi_row & 0x01)) mi_row -= 1;
|
||||
if (subsampling_x && (mi_col & 0x01)) mi_col -= 1;
|
||||
}
|
||||
#else
|
||||
(void)bsize;
|
||||
#endif
|
||||
|
||||
const int x = (MI_SIZE * mi_col) >> subsampling_x;
|
||||
const int y = (MI_SIZE * mi_row) >> subsampling_y;
|
||||
dst->buf = src + scaled_buffer_offset(x, y, stride, scale);
|
||||
dst->buf0 = src;
|
||||
dst->width = width;
|
||||
dst->height = height;
|
||||
dst->stride = stride;
|
||||
}
|
||||
|
||||
void av1_setup_dst_planes(struct macroblockd_plane planes[MAX_MB_PLANE],
|
||||
BLOCK_SIZE bsize, const YV12_BUFFER_CONFIG *src,
|
||||
int mi_row, int mi_col);
|
||||
|
||||
void av1_setup_pre_planes(MACROBLOCKD *xd, int idx,
|
||||
const YV12_BUFFER_CONFIG *src, int mi_row, int mi_col,
|
||||
const struct scale_factors *sf);
|
||||
|
||||
// Detect if the block have sub-pixel level motion vectors
|
||||
// per component.
|
||||
#define CHECK_SUBPEL 0
|
||||
static INLINE int has_subpel_mv_component(const MODE_INFO *const mi,
|
||||
const MACROBLOCKD *const xd,
|
||||
int dir) {
|
||||
#if CHECK_SUBPEL
|
||||
const MB_MODE_INFO *const mbmi = &mi->mbmi;
|
||||
const BLOCK_SIZE bsize = mbmi->sb_type;
|
||||
int plane;
|
||||
int ref = (dir >> 1);
|
||||
#if CONFIG_CB4X4
|
||||
const int unify_bsize = 1;
|
||||
#else
|
||||
const int unify_bsize = 0;
|
||||
#endif
|
||||
|
||||
if (bsize >= BLOCK_8X8 || unify_bsize) {
|
||||
if (dir & 0x01) {
|
||||
if (mbmi->mv[ref].as_mv.col & SUBPEL_MASK) return 1;
|
||||
} else {
|
||||
if (mbmi->mv[ref].as_mv.row & SUBPEL_MASK) return 1;
|
||||
}
|
||||
} else {
|
||||
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
|
||||
const PARTITION_TYPE bp = BLOCK_8X8 - bsize;
|
||||
const struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
const int have_vsplit = bp != PARTITION_HORZ;
|
||||
const int have_hsplit = bp != PARTITION_VERT;
|
||||
const int num_4x4_w = 2 >> ((!have_vsplit) | pd->subsampling_x);
|
||||
const int num_4x4_h = 2 >> ((!have_hsplit) | pd->subsampling_y);
|
||||
|
||||
int x, y;
|
||||
for (y = 0; y < num_4x4_h; ++y) {
|
||||
for (x = 0; x < num_4x4_w; ++x) {
|
||||
const MV mv = average_split_mvs(pd, mi, ref, y * 2 + x);
|
||||
if (dir & 0x01) {
|
||||
if (mv.col & SUBPEL_MASK) return 1;
|
||||
} else {
|
||||
if (mv.row & SUBPEL_MASK) return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
(void)mi;
|
||||
(void)xd;
|
||||
(void)dir;
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
static INLINE void set_default_interp_filters(
|
||||
MB_MODE_INFO *const mbmi, InterpFilter frame_interp_filter) {
|
||||
#if CONFIG_DUAL_FILTER
|
||||
int dir;
|
||||
for (dir = 0; dir < 4; ++dir)
|
||||
mbmi->interp_filter[dir] = frame_interp_filter == SWITCHABLE
|
||||
? EIGHTTAP_REGULAR
|
||||
: frame_interp_filter;
|
||||
#else
|
||||
mbmi->interp_filter = frame_interp_filter == SWITCHABLE ? EIGHTTAP_REGULAR
|
||||
: frame_interp_filter;
|
||||
#endif // CONFIG_DUAL_FILTER
|
||||
}
|
||||
|
||||
static INLINE int av1_is_interp_needed(const MACROBLOCKD *const xd) {
|
||||
(void)xd;
|
||||
#if CONFIG_WARPED_MOTION
|
||||
const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
|
||||
if (mbmi->motion_mode == WARPED_CAUSAL) return 0;
|
||||
#endif // CONFIG_WARPED_MOTION
|
||||
#if CONFIG_GLOBAL_MOTION
|
||||
if (is_nontrans_global_motion(xd)) return 0;
|
||||
#endif // CONFIG_GLOBAL_MOTION
|
||||
return 1;
|
||||
}
|
||||
|
||||
static INLINE int av1_is_interp_search_needed(const MACROBLOCKD *const xd) {
|
||||
MODE_INFO *const mi = xd->mi[0];
|
||||
const int is_compound = has_second_ref(&mi->mbmi);
|
||||
int ref;
|
||||
for (ref = 0; ref < 1 + is_compound; ++ref) {
|
||||
int row_col;
|
||||
for (row_col = 0; row_col < 2; ++row_col) {
|
||||
const int dir = (ref << 1) + row_col;
|
||||
if (has_subpel_mv_component(mi, xd, dir)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if CONFIG_MOTION_VAR
|
||||
const uint8_t *av1_get_obmc_mask(int length);
|
||||
void av1_count_overlappable_neighbors(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int mi_row, int mi_col);
|
||||
void av1_build_obmc_inter_prediction(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int mi_row, int mi_col,
|
||||
uint8_t *above[MAX_MB_PLANE],
|
||||
int above_stride[MAX_MB_PLANE],
|
||||
uint8_t *left[MAX_MB_PLANE],
|
||||
int left_stride[MAX_MB_PLANE]);
|
||||
void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int mi_row, int mi_col,
|
||||
uint8_t *tmp_buf[MAX_MB_PLANE],
|
||||
int tmp_width[MAX_MB_PLANE],
|
||||
int tmp_height[MAX_MB_PLANE],
|
||||
int tmp_stride[MAX_MB_PLANE]);
|
||||
void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int mi_row, int mi_col,
|
||||
uint8_t *tmp_buf[MAX_MB_PLANE],
|
||||
int tmp_width[MAX_MB_PLANE],
|
||||
int tmp_height[MAX_MB_PLANE],
|
||||
int tmp_stride[MAX_MB_PLANE]);
|
||||
void av1_build_obmc_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int mi_row, int mi_col);
|
||||
#if CONFIG_NCOBMC
|
||||
void av1_build_ncobmc_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd,
|
||||
int mi_row, int mi_col);
|
||||
#endif
|
||||
#endif // CONFIG_MOTION_VAR
|
||||
|
||||
#if CONFIG_EXT_INTER
|
||||
#define MASK_MASTER_SIZE ((MAX_WEDGE_SIZE) << 1)
|
||||
#define MASK_MASTER_STRIDE (MASK_MASTER_SIZE)
|
||||
|
||||
void av1_init_wedge_masks();
|
||||
|
||||
static INLINE const uint8_t *av1_get_contiguous_soft_mask(int wedge_index,
|
||||
int wedge_sign,
|
||||
BLOCK_SIZE sb_type) {
|
||||
return wedge_params_lookup[sb_type].masks[wedge_sign][wedge_index];
|
||||
}
|
||||
|
||||
const uint8_t *av1_get_soft_mask(int wedge_index, int wedge_sign,
|
||||
BLOCK_SIZE sb_type, int wedge_offset_x,
|
||||
int wedge_offset_y);
|
||||
|
||||
const uint8_t *av1_get_compound_type_mask_inverse(
|
||||
const INTERINTER_COMPOUND_DATA *const comp_data,
|
||||
#if CONFIG_COMPOUND_SEGMENT
|
||||
uint8_t *mask_buffer, int h, int w, int stride,
|
||||
#endif
|
||||
BLOCK_SIZE sb_type);
|
||||
|
||||
const uint8_t *av1_get_compound_type_mask(
|
||||
const INTERINTER_COMPOUND_DATA *const comp_data, BLOCK_SIZE sb_type);
|
||||
|
||||
void av1_build_interintra_predictors(MACROBLOCKD *xd, uint8_t *ypred,
|
||||
uint8_t *upred, uint8_t *vpred,
|
||||
int ystride, int ustride, int vstride,
|
||||
BUFFER_SET *ctx, BLOCK_SIZE bsize);
|
||||
void av1_build_interintra_predictors_sby(MACROBLOCKD *xd, uint8_t *ypred,
|
||||
int ystride, BUFFER_SET *ctx,
|
||||
BLOCK_SIZE bsize);
|
||||
void av1_build_interintra_predictors_sbc(MACROBLOCKD *xd, uint8_t *upred,
|
||||
int ustride, BUFFER_SET *ctx,
|
||||
int plane, BLOCK_SIZE bsize);
|
||||
void av1_build_interintra_predictors_sbuv(MACROBLOCKD *xd, uint8_t *upred,
|
||||
uint8_t *vpred, int ustride,
|
||||
int vstride, BUFFER_SET *ctx,
|
||||
BLOCK_SIZE bsize);
|
||||
|
||||
void av1_build_intra_predictors_for_interintra(MACROBLOCKD *xd,
|
||||
BLOCK_SIZE bsize, int plane,
|
||||
BUFFER_SET *ctx,
|
||||
uint8_t *intra_pred,
|
||||
int intra_stride);
|
||||
void av1_combine_interintra(MACROBLOCKD *xd, BLOCK_SIZE bsize, int plane,
|
||||
const uint8_t *inter_pred, int inter_stride,
|
||||
const uint8_t *intra_pred, int intra_stride);
|
||||
|
||||
// Encoder only
|
||||
void av1_build_inter_predictors_for_planes_single_buf(
|
||||
MACROBLOCKD *xd, BLOCK_SIZE bsize, int plane_from, int plane_to, int mi_row,
|
||||
int mi_col, int ref, uint8_t *ext_dst[3], int ext_dst_stride[3]);
|
||||
void av1_build_wedge_inter_predictor_from_buf(
|
||||
MACROBLOCKD *xd, BLOCK_SIZE bsize, int plane_from, int plane_to,
|
||||
#if CONFIG_SUPERTX
|
||||
int wedge_offset_x, int wedge_offset_y,
|
||||
#endif // CONFIG_SUPERTX
|
||||
uint8_t *ext_dst0[3], int ext_dst_stride0[3], uint8_t *ext_dst1[3],
|
||||
int ext_dst_stride1[3]);
|
||||
#endif // CONFIG_EXT_INTER
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // AV1_COMMON_RECONINTER_H_
|
||||
2467
third_party/aom/av1/common/reconintra.c
vendored
Normal file
2467
third_party/aom/av1/common/reconintra.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
67
third_party/aom/av1/common/reconintra.h
vendored
Normal file
67
third_party/aom/av1/common/reconintra.h
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* 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_COMMON_RECONINTRA_H_
|
||||
#define AV1_COMMON_RECONINTRA_H_
|
||||
|
||||
#include "aom/aom_integer.h"
|
||||
#include "av1/common/blockd.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void av1_init_intra_predictors(void);
|
||||
void av1_predict_intra_block_facade(MACROBLOCKD *xd, int plane, int block_idx,
|
||||
int blk_col, int blk_row, TX_SIZE tx_size);
|
||||
void av1_predict_intra_block(const MACROBLOCKD *xd, int bw, int bh,
|
||||
BLOCK_SIZE bsize, PREDICTION_MODE mode,
|
||||
const uint8_t *ref, int ref_stride, uint8_t *dst,
|
||||
int dst_stride, int aoff, int loff, int plane);
|
||||
|
||||
#if CONFIG_EXT_INTER
|
||||
// Mapping of interintra to intra mode for use in the intra component
|
||||
static const PREDICTION_MODE interintra_to_intra_mode[INTERINTRA_MODES] = {
|
||||
DC_PRED, V_PRED, H_PRED, D45_PRED, D135_PRED,
|
||||
D117_PRED, D153_PRED, D207_PRED, D63_PRED, TM_PRED
|
||||
};
|
||||
|
||||
// Mapping of intra mode to the interintra mode
|
||||
static const INTERINTRA_MODE intra_to_interintra_mode[INTRA_MODES] = {
|
||||
II_DC_PRED, II_V_PRED, II_H_PRED, II_D45_PRED, II_D135_PRED,
|
||||
II_D117_PRED, II_D153_PRED, II_D207_PRED, II_D63_PRED,
|
||||
#if CONFIG_ALT_INTRA
|
||||
II_DC_PRED, // Note: Filler value, as there's no II_SMOOTH_PRED.
|
||||
#endif // CONFIG_ALT_INTRA
|
||||
II_TM_PRED
|
||||
};
|
||||
#endif // CONFIG_EXT_INTER
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#if CONFIG_FILTER_INTRA
|
||||
#define FILTER_INTRA_PREC_BITS 10
|
||||
extern int av1_filter_intra_taps_4[TX_SIZES][INTRA_MODES][4];
|
||||
#endif // CONFIG_FILTER_INTRA
|
||||
|
||||
#if CONFIG_EXT_INTRA
|
||||
static INLINE int av1_is_directional_mode(PREDICTION_MODE mode,
|
||||
BLOCK_SIZE bsize) {
|
||||
return mode != DC_PRED && mode != TM_PRED &&
|
||||
#if CONFIG_ALT_INTRA
|
||||
mode != SMOOTH_PRED &&
|
||||
#endif // CONFIG_ALT_INTRA
|
||||
bsize >= BLOCK_8X8;
|
||||
}
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
|
||||
#endif // AV1_COMMON_RECONINTRA_H_
|
||||
821
third_party/aom/av1/common/resize.c
vendored
Normal file
821
third_party/aom/av1/common/resize.c
vendored
Normal file
|
|
@ -0,0 +1,821 @@
|
|||
/*
|
||||
* 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 <limits.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "./aom_config.h"
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
#include "aom_dsp/aom_dsp_common.h"
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
#include "aom_ports/mem.h"
|
||||
#include "av1/common/common.h"
|
||||
#include "av1/common/resize.h"
|
||||
|
||||
#define FILTER_BITS 7
|
||||
|
||||
#define INTERP_TAPS 8
|
||||
#define SUBPEL_BITS 5
|
||||
#define SUBPEL_MASK ((1 << SUBPEL_BITS) - 1)
|
||||
#define INTERP_PRECISION_BITS 32
|
||||
|
||||
typedef int16_t interp_kernel[INTERP_TAPS];
|
||||
|
||||
// Filters for interpolation (0.5-band) - note this also filters integer pels.
|
||||
static const interp_kernel filteredinterp_filters500[(1 << SUBPEL_BITS)] = {
|
||||
{ -3, 0, 35, 64, 35, 0, -3, 0 }, { -3, -1, 34, 64, 36, 1, -3, 0 },
|
||||
{ -3, -1, 32, 64, 38, 1, -3, 0 }, { -2, -2, 31, 63, 39, 2, -3, 0 },
|
||||
{ -2, -2, 29, 63, 41, 2, -3, 0 }, { -2, -2, 28, 63, 42, 3, -4, 0 },
|
||||
{ -2, -3, 27, 63, 43, 4, -4, 0 }, { -2, -3, 25, 62, 45, 5, -4, 0 },
|
||||
{ -2, -3, 24, 62, 46, 5, -4, 0 }, { -2, -3, 23, 61, 47, 6, -4, 0 },
|
||||
{ -2, -3, 21, 60, 49, 7, -4, 0 }, { -1, -4, 20, 60, 50, 8, -4, -1 },
|
||||
{ -1, -4, 19, 59, 51, 9, -4, -1 }, { -1, -4, 17, 58, 52, 10, -4, 0 },
|
||||
{ -1, -4, 16, 57, 53, 12, -4, -1 }, { -1, -4, 15, 56, 54, 13, -4, -1 },
|
||||
{ -1, -4, 14, 55, 55, 14, -4, -1 }, { -1, -4, 13, 54, 56, 15, -4, -1 },
|
||||
{ -1, -4, 12, 53, 57, 16, -4, -1 }, { 0, -4, 10, 52, 58, 17, -4, -1 },
|
||||
{ -1, -4, 9, 51, 59, 19, -4, -1 }, { -1, -4, 8, 50, 60, 20, -4, -1 },
|
||||
{ 0, -4, 7, 49, 60, 21, -3, -2 }, { 0, -4, 6, 47, 61, 23, -3, -2 },
|
||||
{ 0, -4, 5, 46, 62, 24, -3, -2 }, { 0, -4, 5, 45, 62, 25, -3, -2 },
|
||||
{ 0, -4, 4, 43, 63, 27, -3, -2 }, { 0, -4, 3, 42, 63, 28, -2, -2 },
|
||||
{ 0, -3, 2, 41, 63, 29, -2, -2 }, { 0, -3, 2, 39, 63, 31, -2, -2 },
|
||||
{ 0, -3, 1, 38, 64, 32, -1, -3 }, { 0, -3, 1, 36, 64, 34, -1, -3 }
|
||||
};
|
||||
|
||||
// Filters for interpolation (0.625-band) - note this also filters integer pels.
|
||||
static const interp_kernel filteredinterp_filters625[(1 << SUBPEL_BITS)] = {
|
||||
{ -1, -8, 33, 80, 33, -8, -1, 0 }, { -1, -8, 30, 80, 35, -8, -1, 1 },
|
||||
{ -1, -8, 28, 80, 37, -7, -2, 1 }, { 0, -8, 26, 79, 39, -7, -2, 1 },
|
||||
{ 0, -8, 24, 79, 41, -7, -2, 1 }, { 0, -8, 22, 78, 43, -6, -2, 1 },
|
||||
{ 0, -8, 20, 78, 45, -5, -3, 1 }, { 0, -8, 18, 77, 48, -5, -3, 1 },
|
||||
{ 0, -8, 16, 76, 50, -4, -3, 1 }, { 0, -8, 15, 75, 52, -3, -4, 1 },
|
||||
{ 0, -7, 13, 74, 54, -3, -4, 1 }, { 0, -7, 11, 73, 56, -2, -4, 1 },
|
||||
{ 0, -7, 10, 71, 58, -1, -4, 1 }, { 1, -7, 8, 70, 60, 0, -5, 1 },
|
||||
{ 1, -6, 6, 68, 62, 1, -5, 1 }, { 1, -6, 5, 67, 63, 2, -5, 1 },
|
||||
{ 1, -6, 4, 65, 65, 4, -6, 1 }, { 1, -5, 2, 63, 67, 5, -6, 1 },
|
||||
{ 1, -5, 1, 62, 68, 6, -6, 1 }, { 1, -5, 0, 60, 70, 8, -7, 1 },
|
||||
{ 1, -4, -1, 58, 71, 10, -7, 0 }, { 1, -4, -2, 56, 73, 11, -7, 0 },
|
||||
{ 1, -4, -3, 54, 74, 13, -7, 0 }, { 1, -4, -3, 52, 75, 15, -8, 0 },
|
||||
{ 1, -3, -4, 50, 76, 16, -8, 0 }, { 1, -3, -5, 48, 77, 18, -8, 0 },
|
||||
{ 1, -3, -5, 45, 78, 20, -8, 0 }, { 1, -2, -6, 43, 78, 22, -8, 0 },
|
||||
{ 1, -2, -7, 41, 79, 24, -8, 0 }, { 1, -2, -7, 39, 79, 26, -8, 0 },
|
||||
{ 1, -2, -7, 37, 80, 28, -8, -1 }, { 1, -1, -8, 35, 80, 30, -8, -1 },
|
||||
};
|
||||
|
||||
// Filters for interpolation (0.75-band) - note this also filters integer pels.
|
||||
static const interp_kernel filteredinterp_filters750[(1 << SUBPEL_BITS)] = {
|
||||
{ 2, -11, 25, 96, 25, -11, 2, 0 }, { 2, -11, 22, 96, 28, -11, 2, 0 },
|
||||
{ 2, -10, 19, 95, 31, -11, 2, 0 }, { 2, -10, 17, 95, 34, -12, 2, 0 },
|
||||
{ 2, -9, 14, 94, 37, -12, 2, 0 }, { 2, -8, 12, 93, 40, -12, 1, 0 },
|
||||
{ 2, -8, 9, 92, 43, -12, 1, 1 }, { 2, -7, 7, 91, 46, -12, 1, 0 },
|
||||
{ 2, -7, 5, 90, 49, -12, 1, 0 }, { 2, -6, 3, 88, 52, -12, 0, 1 },
|
||||
{ 2, -5, 1, 86, 55, -12, 0, 1 }, { 2, -5, -1, 84, 58, -11, 0, 1 },
|
||||
{ 2, -4, -2, 82, 61, -11, -1, 1 }, { 2, -4, -4, 80, 64, -10, -1, 1 },
|
||||
{ 1, -3, -5, 77, 67, -9, -1, 1 }, { 1, -3, -6, 75, 70, -8, -2, 1 },
|
||||
{ 1, -2, -7, 72, 72, -7, -2, 1 }, { 1, -2, -8, 70, 75, -6, -3, 1 },
|
||||
{ 1, -1, -9, 67, 77, -5, -3, 1 }, { 1, -1, -10, 64, 80, -4, -4, 2 },
|
||||
{ 1, -1, -11, 61, 82, -2, -4, 2 }, { 1, 0, -11, 58, 84, -1, -5, 2 },
|
||||
{ 1, 0, -12, 55, 86, 1, -5, 2 }, { 1, 0, -12, 52, 88, 3, -6, 2 },
|
||||
{ 0, 1, -12, 49, 90, 5, -7, 2 }, { 0, 1, -12, 46, 91, 7, -7, 2 },
|
||||
{ 1, 1, -12, 43, 92, 9, -8, 2 }, { 0, 1, -12, 40, 93, 12, -8, 2 },
|
||||
{ 0, 2, -12, 37, 94, 14, -9, 2 }, { 0, 2, -12, 34, 95, 17, -10, 2 },
|
||||
{ 0, 2, -11, 31, 95, 19, -10, 2 }, { 0, 2, -11, 28, 96, 22, -11, 2 }
|
||||
};
|
||||
|
||||
// Filters for interpolation (0.875-band) - note this also filters integer pels.
|
||||
static const interp_kernel filteredinterp_filters875[(1 << SUBPEL_BITS)] = {
|
||||
{ 3, -8, 13, 112, 13, -8, 3, 0 }, { 3, -7, 10, 112, 17, -9, 3, -1 },
|
||||
{ 2, -6, 7, 111, 21, -9, 3, -1 }, { 2, -5, 4, 111, 24, -10, 3, -1 },
|
||||
{ 2, -4, 1, 110, 28, -11, 3, -1 }, { 1, -3, -1, 108, 32, -12, 4, -1 },
|
||||
{ 1, -2, -3, 106, 36, -13, 4, -1 }, { 1, -1, -6, 105, 40, -14, 4, -1 },
|
||||
{ 1, -1, -7, 102, 44, -14, 4, -1 }, { 1, 0, -9, 100, 48, -15, 4, -1 },
|
||||
{ 1, 1, -11, 97, 53, -16, 4, -1 }, { 0, 1, -12, 95, 57, -16, 4, -1 },
|
||||
{ 0, 2, -13, 91, 61, -16, 4, -1 }, { 0, 2, -14, 88, 65, -16, 4, -1 },
|
||||
{ 0, 3, -15, 84, 69, -17, 4, 0 }, { 0, 3, -16, 81, 73, -16, 3, 0 },
|
||||
{ 0, 3, -16, 77, 77, -16, 3, 0 }, { 0, 3, -16, 73, 81, -16, 3, 0 },
|
||||
{ 0, 4, -17, 69, 84, -15, 3, 0 }, { -1, 4, -16, 65, 88, -14, 2, 0 },
|
||||
{ -1, 4, -16, 61, 91, -13, 2, 0 }, { -1, 4, -16, 57, 95, -12, 1, 0 },
|
||||
{ -1, 4, -16, 53, 97, -11, 1, 1 }, { -1, 4, -15, 48, 100, -9, 0, 1 },
|
||||
{ -1, 4, -14, 44, 102, -7, -1, 1 }, { -1, 4, -14, 40, 105, -6, -1, 1 },
|
||||
{ -1, 4, -13, 36, 106, -3, -2, 1 }, { -1, 4, -12, 32, 108, -1, -3, 1 },
|
||||
{ -1, 3, -11, 28, 110, 1, -4, 2 }, { -1, 3, -10, 24, 111, 4, -5, 2 },
|
||||
{ -1, 3, -9, 21, 111, 7, -6, 2 }, { -1, 3, -9, 17, 112, 10, -7, 3 }
|
||||
};
|
||||
|
||||
// Filters for interpolation (full-band) - no filtering for integer pixels
|
||||
static const interp_kernel filteredinterp_filters1000[(1 << SUBPEL_BITS)] = {
|
||||
{ 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 1, -3, 128, 3, -1, 0, 0 },
|
||||
{ -1, 2, -6, 127, 7, -2, 1, 0 }, { -1, 3, -9, 126, 12, -4, 1, 0 },
|
||||
{ -1, 4, -12, 125, 16, -5, 1, 0 }, { -1, 4, -14, 123, 20, -6, 2, 0 },
|
||||
{ -1, 5, -15, 120, 25, -8, 2, 0 }, { -1, 5, -17, 118, 30, -9, 3, -1 },
|
||||
{ -1, 6, -18, 114, 35, -10, 3, -1 }, { -1, 6, -19, 111, 41, -12, 3, -1 },
|
||||
{ -1, 6, -20, 107, 46, -13, 4, -1 }, { -1, 6, -21, 103, 52, -14, 4, -1 },
|
||||
{ -1, 6, -21, 99, 57, -16, 5, -1 }, { -1, 6, -21, 94, 63, -17, 5, -1 },
|
||||
{ -1, 6, -20, 89, 68, -18, 5, -1 }, { -1, 6, -20, 84, 73, -19, 6, -1 },
|
||||
{ -1, 6, -20, 79, 79, -20, 6, -1 }, { -1, 6, -19, 73, 84, -20, 6, -1 },
|
||||
{ -1, 5, -18, 68, 89, -20, 6, -1 }, { -1, 5, -17, 63, 94, -21, 6, -1 },
|
||||
{ -1, 5, -16, 57, 99, -21, 6, -1 }, { -1, 4, -14, 52, 103, -21, 6, -1 },
|
||||
{ -1, 4, -13, 46, 107, -20, 6, -1 }, { -1, 3, -12, 41, 111, -19, 6, -1 },
|
||||
{ -1, 3, -10, 35, 114, -18, 6, -1 }, { -1, 3, -9, 30, 118, -17, 5, -1 },
|
||||
{ 0, 2, -8, 25, 120, -15, 5, -1 }, { 0, 2, -6, 20, 123, -14, 4, -1 },
|
||||
{ 0, 1, -5, 16, 125, -12, 4, -1 }, { 0, 1, -4, 12, 126, -9, 3, -1 },
|
||||
{ 0, 1, -2, 7, 127, -6, 2, -1 }, { 0, 0, -1, 3, 128, -3, 1, 0 }
|
||||
};
|
||||
|
||||
// Filters for factor of 2 downsampling.
|
||||
static const int16_t av1_down2_symeven_half_filter[] = { 56, 12, -3, -1 };
|
||||
static const int16_t av1_down2_symodd_half_filter[] = { 64, 35, 0, -3 };
|
||||
|
||||
static const interp_kernel *choose_interp_filter(int inlength, int outlength) {
|
||||
int outlength16 = outlength * 16;
|
||||
if (outlength16 >= inlength * 16)
|
||||
return filteredinterp_filters1000;
|
||||
else if (outlength16 >= inlength * 13)
|
||||
return filteredinterp_filters875;
|
||||
else if (outlength16 >= inlength * 11)
|
||||
return filteredinterp_filters750;
|
||||
else if (outlength16 >= inlength * 9)
|
||||
return filteredinterp_filters625;
|
||||
else
|
||||
return filteredinterp_filters500;
|
||||
}
|
||||
|
||||
static void interpolate(const uint8_t *const input, int inlength,
|
||||
uint8_t *output, int outlength) {
|
||||
const int64_t delta =
|
||||
(((uint64_t)inlength << 32) + outlength / 2) / outlength;
|
||||
const int64_t offset =
|
||||
inlength > outlength
|
||||
? (((int64_t)(inlength - outlength) << 31) + outlength / 2) /
|
||||
outlength
|
||||
: -(((int64_t)(outlength - inlength) << 31) + outlength / 2) /
|
||||
outlength;
|
||||
uint8_t *optr = output;
|
||||
int x, x1, x2, sum, k, int_pel, sub_pel;
|
||||
int64_t y;
|
||||
|
||||
const interp_kernel *interp_filters =
|
||||
choose_interp_filter(inlength, outlength);
|
||||
|
||||
x = 0;
|
||||
y = offset;
|
||||
while ((y >> INTERP_PRECISION_BITS) < (INTERP_TAPS / 2 - 1)) {
|
||||
x++;
|
||||
y += delta;
|
||||
}
|
||||
x1 = x;
|
||||
x = outlength - 1;
|
||||
y = delta * x + offset;
|
||||
while ((y >> INTERP_PRECISION_BITS) + (int64_t)(INTERP_TAPS / 2) >=
|
||||
inlength) {
|
||||
x--;
|
||||
y -= delta;
|
||||
}
|
||||
x2 = x;
|
||||
if (x1 > x2) {
|
||||
for (x = 0, y = offset; x < outlength; ++x, y += delta) {
|
||||
const int16_t *filter;
|
||||
int_pel = y >> INTERP_PRECISION_BITS;
|
||||
sub_pel = (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS)) & SUBPEL_MASK;
|
||||
filter = interp_filters[sub_pel];
|
||||
sum = 0;
|
||||
for (k = 0; k < INTERP_TAPS; ++k) {
|
||||
const int pk = int_pel - INTERP_TAPS / 2 + 1 + k;
|
||||
sum += filter[k] *
|
||||
input[(pk < 0 ? 0 : (pk >= inlength ? inlength - 1 : pk))];
|
||||
}
|
||||
*optr++ = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS));
|
||||
}
|
||||
} else {
|
||||
// Initial part.
|
||||
for (x = 0, y = offset; x < x1; ++x, y += delta) {
|
||||
const int16_t *filter;
|
||||
int_pel = y >> INTERP_PRECISION_BITS;
|
||||
sub_pel = (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS)) & SUBPEL_MASK;
|
||||
filter = interp_filters[sub_pel];
|
||||
sum = 0;
|
||||
for (k = 0; k < INTERP_TAPS; ++k)
|
||||
sum += filter[k] * input[(int_pel - INTERP_TAPS / 2 + 1 + k < 0
|
||||
? 0
|
||||
: int_pel - INTERP_TAPS / 2 + 1 + k)];
|
||||
*optr++ = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS));
|
||||
}
|
||||
// Middle part.
|
||||
for (; x <= x2; ++x, y += delta) {
|
||||
const int16_t *filter;
|
||||
int_pel = y >> INTERP_PRECISION_BITS;
|
||||
sub_pel = (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS)) & SUBPEL_MASK;
|
||||
filter = interp_filters[sub_pel];
|
||||
sum = 0;
|
||||
for (k = 0; k < INTERP_TAPS; ++k)
|
||||
sum += filter[k] * input[int_pel - INTERP_TAPS / 2 + 1 + k];
|
||||
*optr++ = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS));
|
||||
}
|
||||
// End part.
|
||||
for (; x < outlength; ++x, y += delta) {
|
||||
const int16_t *filter;
|
||||
int_pel = y >> INTERP_PRECISION_BITS;
|
||||
sub_pel = (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS)) & SUBPEL_MASK;
|
||||
filter = interp_filters[sub_pel];
|
||||
sum = 0;
|
||||
for (k = 0; k < INTERP_TAPS; ++k)
|
||||
sum += filter[k] * input[(int_pel - INTERP_TAPS / 2 + 1 + k >= inlength
|
||||
? inlength - 1
|
||||
: int_pel - INTERP_TAPS / 2 + 1 + k)];
|
||||
*optr++ = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void down2_symeven(const uint8_t *const input, int length,
|
||||
uint8_t *output) {
|
||||
// Actual filter len = 2 * filter_len_half.
|
||||
const int16_t *filter = av1_down2_symeven_half_filter;
|
||||
const int filter_len_half = sizeof(av1_down2_symeven_half_filter) / 2;
|
||||
int i, j;
|
||||
uint8_t *optr = output;
|
||||
int l1 = filter_len_half;
|
||||
int l2 = (length - filter_len_half);
|
||||
l1 += (l1 & 1);
|
||||
l2 += (l2 & 1);
|
||||
if (l1 > l2) {
|
||||
// Short input length.
|
||||
for (i = 0; i < length; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1));
|
||||
for (j = 0; j < filter_len_half; ++j) {
|
||||
sum += (input[(i - j < 0 ? 0 : i - j)] +
|
||||
input[(i + 1 + j >= length ? length - 1 : i + 1 + j)]) *
|
||||
filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel(sum);
|
||||
}
|
||||
} else {
|
||||
// Initial part.
|
||||
for (i = 0; i < l1; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1));
|
||||
for (j = 0; j < filter_len_half; ++j) {
|
||||
sum += (input[(i - j < 0 ? 0 : i - j)] + input[i + 1 + j]) * filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel(sum);
|
||||
}
|
||||
// Middle part.
|
||||
for (; i < l2; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1));
|
||||
for (j = 0; j < filter_len_half; ++j) {
|
||||
sum += (input[i - j] + input[i + 1 + j]) * filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel(sum);
|
||||
}
|
||||
// End part.
|
||||
for (; i < length; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1));
|
||||
for (j = 0; j < filter_len_half; ++j) {
|
||||
sum += (input[i - j] +
|
||||
input[(i + 1 + j >= length ? length - 1 : i + 1 + j)]) *
|
||||
filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel(sum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void down2_symodd(const uint8_t *const input, int length,
|
||||
uint8_t *output) {
|
||||
// Actual filter len = 2 * filter_len_half - 1.
|
||||
const int16_t *filter = av1_down2_symodd_half_filter;
|
||||
const int filter_len_half = sizeof(av1_down2_symodd_half_filter) / 2;
|
||||
int i, j;
|
||||
uint8_t *optr = output;
|
||||
int l1 = filter_len_half - 1;
|
||||
int l2 = (length - filter_len_half + 1);
|
||||
l1 += (l1 & 1);
|
||||
l2 += (l2 & 1);
|
||||
if (l1 > l2) {
|
||||
// Short input length.
|
||||
for (i = 0; i < length; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1)) + input[i] * filter[0];
|
||||
for (j = 1; j < filter_len_half; ++j) {
|
||||
sum += (input[(i - j < 0 ? 0 : i - j)] +
|
||||
input[(i + j >= length ? length - 1 : i + j)]) *
|
||||
filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel(sum);
|
||||
}
|
||||
} else {
|
||||
// Initial part.
|
||||
for (i = 0; i < l1; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1)) + input[i] * filter[0];
|
||||
for (j = 1; j < filter_len_half; ++j) {
|
||||
sum += (input[(i - j < 0 ? 0 : i - j)] + input[i + j]) * filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel(sum);
|
||||
}
|
||||
// Middle part.
|
||||
for (; i < l2; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1)) + input[i] * filter[0];
|
||||
for (j = 1; j < filter_len_half; ++j) {
|
||||
sum += (input[i - j] + input[i + j]) * filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel(sum);
|
||||
}
|
||||
// End part.
|
||||
for (; i < length; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1)) + input[i] * filter[0];
|
||||
for (j = 1; j < filter_len_half; ++j) {
|
||||
sum += (input[i - j] + input[(i + j >= length ? length - 1 : i + j)]) *
|
||||
filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel(sum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int get_down2_length(int length, int steps) {
|
||||
int s;
|
||||
for (s = 0; s < steps; ++s) length = (length + 1) >> 1;
|
||||
return length;
|
||||
}
|
||||
|
||||
static int get_down2_steps(int in_length, int out_length) {
|
||||
int steps = 0;
|
||||
int proj_in_length;
|
||||
while ((proj_in_length = get_down2_length(in_length, 1)) >= out_length) {
|
||||
++steps;
|
||||
in_length = proj_in_length;
|
||||
}
|
||||
return steps;
|
||||
}
|
||||
|
||||
static void resize_multistep(const uint8_t *const input, int length,
|
||||
uint8_t *output, int olength, uint8_t *otmp) {
|
||||
int steps;
|
||||
if (length == olength) {
|
||||
memcpy(output, input, sizeof(output[0]) * length);
|
||||
return;
|
||||
}
|
||||
steps = get_down2_steps(length, olength);
|
||||
|
||||
if (steps > 0) {
|
||||
int s;
|
||||
uint8_t *out = NULL;
|
||||
uint8_t *otmp2;
|
||||
int filteredlength = length;
|
||||
|
||||
assert(otmp != NULL);
|
||||
otmp2 = otmp + get_down2_length(length, 1);
|
||||
for (s = 0; s < steps; ++s) {
|
||||
const int proj_filteredlength = get_down2_length(filteredlength, 1);
|
||||
const uint8_t *const in = (s == 0 ? input : out);
|
||||
if (s == steps - 1 && proj_filteredlength == olength)
|
||||
out = output;
|
||||
else
|
||||
out = (s & 1 ? otmp2 : otmp);
|
||||
if (filteredlength & 1)
|
||||
down2_symodd(in, filteredlength, out);
|
||||
else
|
||||
down2_symeven(in, filteredlength, out);
|
||||
filteredlength = proj_filteredlength;
|
||||
}
|
||||
if (filteredlength != olength) {
|
||||
interpolate(out, filteredlength, output, olength);
|
||||
}
|
||||
} else {
|
||||
interpolate(input, length, output, olength);
|
||||
}
|
||||
}
|
||||
|
||||
static void fill_col_to_arr(uint8_t *img, int stride, int len, uint8_t *arr) {
|
||||
int i;
|
||||
uint8_t *iptr = img;
|
||||
uint8_t *aptr = arr;
|
||||
for (i = 0; i < len; ++i, iptr += stride) {
|
||||
*aptr++ = *iptr;
|
||||
}
|
||||
}
|
||||
|
||||
static void fill_arr_to_col(uint8_t *img, int stride, int len, uint8_t *arr) {
|
||||
int i;
|
||||
uint8_t *iptr = img;
|
||||
uint8_t *aptr = arr;
|
||||
for (i = 0; i < len; ++i, iptr += stride) {
|
||||
*iptr = *aptr++;
|
||||
}
|
||||
}
|
||||
|
||||
void av1_resize_plane(const uint8_t *const input, int height, int width,
|
||||
int in_stride, uint8_t *output, int height2, int width2,
|
||||
int out_stride) {
|
||||
int i;
|
||||
uint8_t *intbuf = (uint8_t *)malloc(sizeof(uint8_t) * width2 * height);
|
||||
uint8_t *tmpbuf =
|
||||
(uint8_t *)malloc(sizeof(uint8_t) * (width < height ? height : width));
|
||||
uint8_t *arrbuf = (uint8_t *)malloc(sizeof(uint8_t) * height);
|
||||
uint8_t *arrbuf2 = (uint8_t *)malloc(sizeof(uint8_t) * height2);
|
||||
if (intbuf == NULL || tmpbuf == NULL || arrbuf == NULL || arrbuf2 == NULL)
|
||||
goto Error;
|
||||
assert(width > 0);
|
||||
assert(height > 0);
|
||||
assert(width2 > 0);
|
||||
assert(height2 > 0);
|
||||
for (i = 0; i < height; ++i)
|
||||
resize_multistep(input + in_stride * i, width, intbuf + width2 * i, width2,
|
||||
tmpbuf);
|
||||
for (i = 0; i < width2; ++i) {
|
||||
fill_col_to_arr(intbuf + i, width2, height, arrbuf);
|
||||
resize_multistep(arrbuf, height, arrbuf2, height2, tmpbuf);
|
||||
fill_arr_to_col(output + i, out_stride, height2, arrbuf2);
|
||||
}
|
||||
|
||||
Error:
|
||||
free(intbuf);
|
||||
free(tmpbuf);
|
||||
free(arrbuf);
|
||||
free(arrbuf2);
|
||||
}
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
static void highbd_interpolate(const uint16_t *const input, int inlength,
|
||||
uint16_t *output, int outlength, int bd) {
|
||||
const int64_t delta =
|
||||
(((uint64_t)inlength << 32) + outlength / 2) / outlength;
|
||||
const int64_t offset =
|
||||
inlength > outlength
|
||||
? (((int64_t)(inlength - outlength) << 31) + outlength / 2) /
|
||||
outlength
|
||||
: -(((int64_t)(outlength - inlength) << 31) + outlength / 2) /
|
||||
outlength;
|
||||
uint16_t *optr = output;
|
||||
int x, x1, x2, sum, k, int_pel, sub_pel;
|
||||
int64_t y;
|
||||
|
||||
const interp_kernel *interp_filters =
|
||||
choose_interp_filter(inlength, outlength);
|
||||
|
||||
x = 0;
|
||||
y = offset;
|
||||
while ((y >> INTERP_PRECISION_BITS) < (INTERP_TAPS / 2 - 1)) {
|
||||
x++;
|
||||
y += delta;
|
||||
}
|
||||
x1 = x;
|
||||
x = outlength - 1;
|
||||
y = delta * x + offset;
|
||||
while ((y >> INTERP_PRECISION_BITS) + (int64_t)(INTERP_TAPS / 2) >=
|
||||
inlength) {
|
||||
x--;
|
||||
y -= delta;
|
||||
}
|
||||
x2 = x;
|
||||
if (x1 > x2) {
|
||||
for (x = 0, y = offset; x < outlength; ++x, y += delta) {
|
||||
const int16_t *filter;
|
||||
int_pel = y >> INTERP_PRECISION_BITS;
|
||||
sub_pel = (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS)) & SUBPEL_MASK;
|
||||
filter = interp_filters[sub_pel];
|
||||
sum = 0;
|
||||
for (k = 0; k < INTERP_TAPS; ++k) {
|
||||
const int pk = int_pel - INTERP_TAPS / 2 + 1 + k;
|
||||
sum += filter[k] *
|
||||
input[(pk < 0 ? 0 : (pk >= inlength ? inlength - 1 : pk))];
|
||||
}
|
||||
*optr++ = clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd);
|
||||
}
|
||||
} else {
|
||||
// Initial part.
|
||||
for (x = 0, y = offset; x < x1; ++x, y += delta) {
|
||||
const int16_t *filter;
|
||||
int_pel = y >> INTERP_PRECISION_BITS;
|
||||
sub_pel = (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS)) & SUBPEL_MASK;
|
||||
filter = interp_filters[sub_pel];
|
||||
sum = 0;
|
||||
for (k = 0; k < INTERP_TAPS; ++k)
|
||||
sum += filter[k] * input[(int_pel - INTERP_TAPS / 2 + 1 + k < 0
|
||||
? 0
|
||||
: int_pel - INTERP_TAPS / 2 + 1 + k)];
|
||||
*optr++ = clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd);
|
||||
}
|
||||
// Middle part.
|
||||
for (; x <= x2; ++x, y += delta) {
|
||||
const int16_t *filter;
|
||||
int_pel = y >> INTERP_PRECISION_BITS;
|
||||
sub_pel = (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS)) & SUBPEL_MASK;
|
||||
filter = interp_filters[sub_pel];
|
||||
sum = 0;
|
||||
for (k = 0; k < INTERP_TAPS; ++k)
|
||||
sum += filter[k] * input[int_pel - INTERP_TAPS / 2 + 1 + k];
|
||||
*optr++ = clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd);
|
||||
}
|
||||
// End part.
|
||||
for (; x < outlength; ++x, y += delta) {
|
||||
const int16_t *filter;
|
||||
int_pel = y >> INTERP_PRECISION_BITS;
|
||||
sub_pel = (y >> (INTERP_PRECISION_BITS - SUBPEL_BITS)) & SUBPEL_MASK;
|
||||
filter = interp_filters[sub_pel];
|
||||
sum = 0;
|
||||
for (k = 0; k < INTERP_TAPS; ++k)
|
||||
sum += filter[k] * input[(int_pel - INTERP_TAPS / 2 + 1 + k >= inlength
|
||||
? inlength - 1
|
||||
: int_pel - INTERP_TAPS / 2 + 1 + k)];
|
||||
*optr++ = clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void highbd_down2_symeven(const uint16_t *const input, int length,
|
||||
uint16_t *output, int bd) {
|
||||
// Actual filter len = 2 * filter_len_half.
|
||||
static const int16_t *filter = av1_down2_symeven_half_filter;
|
||||
const int filter_len_half = sizeof(av1_down2_symeven_half_filter) / 2;
|
||||
int i, j;
|
||||
uint16_t *optr = output;
|
||||
int l1 = filter_len_half;
|
||||
int l2 = (length - filter_len_half);
|
||||
l1 += (l1 & 1);
|
||||
l2 += (l2 & 1);
|
||||
if (l1 > l2) {
|
||||
// Short input length.
|
||||
for (i = 0; i < length; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1));
|
||||
for (j = 0; j < filter_len_half; ++j) {
|
||||
sum += (input[(i - j < 0 ? 0 : i - j)] +
|
||||
input[(i + 1 + j >= length ? length - 1 : i + 1 + j)]) *
|
||||
filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel_highbd(sum, bd);
|
||||
}
|
||||
} else {
|
||||
// Initial part.
|
||||
for (i = 0; i < l1; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1));
|
||||
for (j = 0; j < filter_len_half; ++j) {
|
||||
sum += (input[(i - j < 0 ? 0 : i - j)] + input[i + 1 + j]) * filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel_highbd(sum, bd);
|
||||
}
|
||||
// Middle part.
|
||||
for (; i < l2; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1));
|
||||
for (j = 0; j < filter_len_half; ++j) {
|
||||
sum += (input[i - j] + input[i + 1 + j]) * filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel_highbd(sum, bd);
|
||||
}
|
||||
// End part.
|
||||
for (; i < length; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1));
|
||||
for (j = 0; j < filter_len_half; ++j) {
|
||||
sum += (input[i - j] +
|
||||
input[(i + 1 + j >= length ? length - 1 : i + 1 + j)]) *
|
||||
filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel_highbd(sum, bd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void highbd_down2_symodd(const uint16_t *const input, int length,
|
||||
uint16_t *output, int bd) {
|
||||
// Actual filter len = 2 * filter_len_half - 1.
|
||||
static const int16_t *filter = av1_down2_symodd_half_filter;
|
||||
const int filter_len_half = sizeof(av1_down2_symodd_half_filter) / 2;
|
||||
int i, j;
|
||||
uint16_t *optr = output;
|
||||
int l1 = filter_len_half - 1;
|
||||
int l2 = (length - filter_len_half + 1);
|
||||
l1 += (l1 & 1);
|
||||
l2 += (l2 & 1);
|
||||
if (l1 > l2) {
|
||||
// Short input length.
|
||||
for (i = 0; i < length; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1)) + input[i] * filter[0];
|
||||
for (j = 1; j < filter_len_half; ++j) {
|
||||
sum += (input[(i - j < 0 ? 0 : i - j)] +
|
||||
input[(i + j >= length ? length - 1 : i + j)]) *
|
||||
filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel_highbd(sum, bd);
|
||||
}
|
||||
} else {
|
||||
// Initial part.
|
||||
for (i = 0; i < l1; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1)) + input[i] * filter[0];
|
||||
for (j = 1; j < filter_len_half; ++j) {
|
||||
sum += (input[(i - j < 0 ? 0 : i - j)] + input[i + j]) * filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel_highbd(sum, bd);
|
||||
}
|
||||
// Middle part.
|
||||
for (; i < l2; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1)) + input[i] * filter[0];
|
||||
for (j = 1; j < filter_len_half; ++j) {
|
||||
sum += (input[i - j] + input[i + j]) * filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel_highbd(sum, bd);
|
||||
}
|
||||
// End part.
|
||||
for (; i < length; i += 2) {
|
||||
int sum = (1 << (FILTER_BITS - 1)) + input[i] * filter[0];
|
||||
for (j = 1; j < filter_len_half; ++j) {
|
||||
sum += (input[i - j] + input[(i + j >= length ? length - 1 : i + j)]) *
|
||||
filter[j];
|
||||
}
|
||||
sum >>= FILTER_BITS;
|
||||
*optr++ = clip_pixel_highbd(sum, bd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void highbd_resize_multistep(const uint16_t *const input, int length,
|
||||
uint16_t *output, int olength,
|
||||
uint16_t *otmp, int bd) {
|
||||
int steps;
|
||||
if (length == olength) {
|
||||
memcpy(output, input, sizeof(output[0]) * length);
|
||||
return;
|
||||
}
|
||||
steps = get_down2_steps(length, olength);
|
||||
|
||||
if (steps > 0) {
|
||||
int s;
|
||||
uint16_t *out = NULL;
|
||||
uint16_t *otmp2;
|
||||
int filteredlength = length;
|
||||
|
||||
assert(otmp != NULL);
|
||||
otmp2 = otmp + get_down2_length(length, 1);
|
||||
for (s = 0; s < steps; ++s) {
|
||||
const int proj_filteredlength = get_down2_length(filteredlength, 1);
|
||||
const uint16_t *const in = (s == 0 ? input : out);
|
||||
if (s == steps - 1 && proj_filteredlength == olength)
|
||||
out = output;
|
||||
else
|
||||
out = (s & 1 ? otmp2 : otmp);
|
||||
if (filteredlength & 1)
|
||||
highbd_down2_symodd(in, filteredlength, out, bd);
|
||||
else
|
||||
highbd_down2_symeven(in, filteredlength, out, bd);
|
||||
filteredlength = proj_filteredlength;
|
||||
}
|
||||
if (filteredlength != olength) {
|
||||
highbd_interpolate(out, filteredlength, output, olength, bd);
|
||||
}
|
||||
} else {
|
||||
highbd_interpolate(input, length, output, olength, bd);
|
||||
}
|
||||
}
|
||||
|
||||
static void highbd_fill_col_to_arr(uint16_t *img, int stride, int len,
|
||||
uint16_t *arr) {
|
||||
int i;
|
||||
uint16_t *iptr = img;
|
||||
uint16_t *aptr = arr;
|
||||
for (i = 0; i < len; ++i, iptr += stride) {
|
||||
*aptr++ = *iptr;
|
||||
}
|
||||
}
|
||||
|
||||
static void highbd_fill_arr_to_col(uint16_t *img, int stride, int len,
|
||||
uint16_t *arr) {
|
||||
int i;
|
||||
uint16_t *iptr = img;
|
||||
uint16_t *aptr = arr;
|
||||
for (i = 0; i < len; ++i, iptr += stride) {
|
||||
*iptr = *aptr++;
|
||||
}
|
||||
}
|
||||
|
||||
void av1_highbd_resize_plane(const uint8_t *const input, int height, int width,
|
||||
int in_stride, uint8_t *output, int height2,
|
||||
int width2, int out_stride, int bd) {
|
||||
int i;
|
||||
uint16_t *intbuf = (uint16_t *)malloc(sizeof(uint16_t) * width2 * height);
|
||||
uint16_t *tmpbuf =
|
||||
(uint16_t *)malloc(sizeof(uint16_t) * (width < height ? height : width));
|
||||
uint16_t *arrbuf = (uint16_t *)malloc(sizeof(uint16_t) * height);
|
||||
uint16_t *arrbuf2 = (uint16_t *)malloc(sizeof(uint16_t) * height2);
|
||||
if (intbuf == NULL || tmpbuf == NULL || arrbuf == NULL || arrbuf2 == NULL)
|
||||
goto Error;
|
||||
for (i = 0; i < height; ++i) {
|
||||
highbd_resize_multistep(CONVERT_TO_SHORTPTR(input + in_stride * i), width,
|
||||
intbuf + width2 * i, width2, tmpbuf, bd);
|
||||
}
|
||||
for (i = 0; i < width2; ++i) {
|
||||
highbd_fill_col_to_arr(intbuf + i, width2, height, arrbuf);
|
||||
highbd_resize_multistep(arrbuf, height, arrbuf2, height2, tmpbuf, bd);
|
||||
highbd_fill_arr_to_col(CONVERT_TO_SHORTPTR(output + i), out_stride, height2,
|
||||
arrbuf2);
|
||||
}
|
||||
|
||||
Error:
|
||||
free(intbuf);
|
||||
free(tmpbuf);
|
||||
free(arrbuf);
|
||||
free(arrbuf2);
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
||||
void av1_resize_frame420(const uint8_t *const y, int y_stride,
|
||||
const uint8_t *const u, const uint8_t *const v,
|
||||
int uv_stride, int height, int width, uint8_t *oy,
|
||||
int oy_stride, uint8_t *ou, uint8_t *ov,
|
||||
int ouv_stride, int oheight, int owidth) {
|
||||
av1_resize_plane(y, height, width, y_stride, oy, oheight, owidth, oy_stride);
|
||||
av1_resize_plane(u, height / 2, width / 2, uv_stride, ou, oheight / 2,
|
||||
owidth / 2, ouv_stride);
|
||||
av1_resize_plane(v, height / 2, width / 2, uv_stride, ov, oheight / 2,
|
||||
owidth / 2, ouv_stride);
|
||||
}
|
||||
|
||||
void av1_resize_frame422(const uint8_t *const y, int y_stride,
|
||||
const uint8_t *const u, const uint8_t *const v,
|
||||
int uv_stride, int height, int width, uint8_t *oy,
|
||||
int oy_stride, uint8_t *ou, uint8_t *ov,
|
||||
int ouv_stride, int oheight, int owidth) {
|
||||
av1_resize_plane(y, height, width, y_stride, oy, oheight, owidth, oy_stride);
|
||||
av1_resize_plane(u, height, width / 2, uv_stride, ou, oheight, owidth / 2,
|
||||
ouv_stride);
|
||||
av1_resize_plane(v, height, width / 2, uv_stride, ov, oheight, owidth / 2,
|
||||
ouv_stride);
|
||||
}
|
||||
|
||||
void av1_resize_frame444(const uint8_t *const y, int y_stride,
|
||||
const uint8_t *const u, const uint8_t *const v,
|
||||
int uv_stride, int height, int width, uint8_t *oy,
|
||||
int oy_stride, uint8_t *ou, uint8_t *ov,
|
||||
int ouv_stride, int oheight, int owidth) {
|
||||
av1_resize_plane(y, height, width, y_stride, oy, oheight, owidth, oy_stride);
|
||||
av1_resize_plane(u, height, width, uv_stride, ou, oheight, owidth,
|
||||
ouv_stride);
|
||||
av1_resize_plane(v, height, width, uv_stride, ov, oheight, owidth,
|
||||
ouv_stride);
|
||||
}
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
void av1_highbd_resize_frame420(const uint8_t *const y, int y_stride,
|
||||
const uint8_t *const u, const uint8_t *const v,
|
||||
int uv_stride, int height, int width,
|
||||
uint8_t *oy, int oy_stride, uint8_t *ou,
|
||||
uint8_t *ov, int ouv_stride, int oheight,
|
||||
int owidth, int bd) {
|
||||
av1_highbd_resize_plane(y, height, width, y_stride, oy, oheight, owidth,
|
||||
oy_stride, bd);
|
||||
av1_highbd_resize_plane(u, height / 2, width / 2, uv_stride, ou, oheight / 2,
|
||||
owidth / 2, ouv_stride, bd);
|
||||
av1_highbd_resize_plane(v, height / 2, width / 2, uv_stride, ov, oheight / 2,
|
||||
owidth / 2, ouv_stride, bd);
|
||||
}
|
||||
|
||||
void av1_highbd_resize_frame422(const uint8_t *const y, int y_stride,
|
||||
const uint8_t *const u, const uint8_t *const v,
|
||||
int uv_stride, int height, int width,
|
||||
uint8_t *oy, int oy_stride, uint8_t *ou,
|
||||
uint8_t *ov, int ouv_stride, int oheight,
|
||||
int owidth, int bd) {
|
||||
av1_highbd_resize_plane(y, height, width, y_stride, oy, oheight, owidth,
|
||||
oy_stride, bd);
|
||||
av1_highbd_resize_plane(u, height, width / 2, uv_stride, ou, oheight,
|
||||
owidth / 2, ouv_stride, bd);
|
||||
av1_highbd_resize_plane(v, height, width / 2, uv_stride, ov, oheight,
|
||||
owidth / 2, ouv_stride, bd);
|
||||
}
|
||||
|
||||
void av1_highbd_resize_frame444(const uint8_t *const y, int y_stride,
|
||||
const uint8_t *const u, const uint8_t *const v,
|
||||
int uv_stride, int height, int width,
|
||||
uint8_t *oy, int oy_stride, uint8_t *ou,
|
||||
uint8_t *ov, int ouv_stride, int oheight,
|
||||
int owidth, int bd) {
|
||||
av1_highbd_resize_plane(y, height, width, y_stride, oy, oheight, owidth,
|
||||
oy_stride, bd);
|
||||
av1_highbd_resize_plane(u, height, width, uv_stride, ou, oheight, owidth,
|
||||
ouv_stride, bd);
|
||||
av1_highbd_resize_plane(v, height, width, uv_stride, ov, oheight, owidth,
|
||||
ouv_stride, bd);
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
69
third_party/aom/av1/common/resize.h
vendored
Normal file
69
third_party/aom/av1/common/resize.h
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* 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_ENCODER_RESIZE_H_
|
||||
#define AV1_ENCODER_RESIZE_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include "aom/aom_integer.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void av1_resize_plane(const uint8_t *const input, int height, int width,
|
||||
int in_stride, uint8_t *output, int height2, int width2,
|
||||
int out_stride);
|
||||
void av1_resize_frame420(const uint8_t *const y, int y_stride,
|
||||
const uint8_t *const u, const uint8_t *const v,
|
||||
int uv_stride, int height, int width, uint8_t *oy,
|
||||
int oy_stride, uint8_t *ou, uint8_t *ov,
|
||||
int ouv_stride, int oheight, int owidth);
|
||||
void av1_resize_frame422(const uint8_t *const y, int y_stride,
|
||||
const uint8_t *const u, const uint8_t *const v,
|
||||
int uv_stride, int height, int width, uint8_t *oy,
|
||||
int oy_stride, uint8_t *ou, uint8_t *ov,
|
||||
int ouv_stride, int oheight, int owidth);
|
||||
void av1_resize_frame444(const uint8_t *const y, int y_stride,
|
||||
const uint8_t *const u, const uint8_t *const v,
|
||||
int uv_stride, int height, int width, uint8_t *oy,
|
||||
int oy_stride, uint8_t *ou, uint8_t *ov,
|
||||
int ouv_stride, int oheight, int owidth);
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
void av1_highbd_resize_plane(const uint8_t *const input, int height, int width,
|
||||
int in_stride, uint8_t *output, int height2,
|
||||
int width2, int out_stride, int bd);
|
||||
void av1_highbd_resize_frame420(const uint8_t *const y, int y_stride,
|
||||
const uint8_t *const u, const uint8_t *const v,
|
||||
int uv_stride, int height, int width,
|
||||
uint8_t *oy, int oy_stride, uint8_t *ou,
|
||||
uint8_t *ov, int ouv_stride, int oheight,
|
||||
int owidth, int bd);
|
||||
void av1_highbd_resize_frame422(const uint8_t *const y, int y_stride,
|
||||
const uint8_t *const u, const uint8_t *const v,
|
||||
int uv_stride, int height, int width,
|
||||
uint8_t *oy, int oy_stride, uint8_t *ou,
|
||||
uint8_t *ov, int ouv_stride, int oheight,
|
||||
int owidth, int bd);
|
||||
void av1_highbd_resize_frame444(const uint8_t *const y, int y_stride,
|
||||
const uint8_t *const u, const uint8_t *const v,
|
||||
int uv_stride, int height, int width,
|
||||
uint8_t *oy, int oy_stride, uint8_t *ou,
|
||||
uint8_t *ov, int ouv_stride, int oheight,
|
||||
int owidth, int bd);
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // AV1_ENCODER_RESIZE_H_
|
||||
1401
third_party/aom/av1/common/restoration.c
vendored
Normal file
1401
third_party/aom/av1/common/restoration.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
257
third_party/aom/av1/common/restoration.h
vendored
Normal file
257
third_party/aom/av1/common/restoration.h
vendored
Normal file
|
|
@ -0,0 +1,257 @@
|
|||
/*
|
||||
* 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_COMMON_RESTORATION_H_
|
||||
#define AV1_COMMON_RESTORATION_H_
|
||||
|
||||
#include "aom_ports/mem.h"
|
||||
#include "./aom_config.h"
|
||||
|
||||
#include "av1/common/blockd.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CLIP(x, lo, hi) ((x) < (lo) ? (lo) : (x) > (hi) ? (hi) : (x))
|
||||
#define RINT(x) ((x) < 0 ? (int)((x)-0.5) : (int)((x) + 0.5))
|
||||
|
||||
#define RESTORATION_TILESIZE_MAX 256
|
||||
#define RESTORATION_TILEPELS_MAX \
|
||||
(RESTORATION_TILESIZE_MAX * RESTORATION_TILESIZE_MAX * 9 / 4)
|
||||
|
||||
// 4 32-bit buffers needed for the filter:
|
||||
// 2 for the restored versions of the frame and
|
||||
// 2 for each restoration operation
|
||||
#define SGRPROJ_OUTBUF_SIZE \
|
||||
((RESTORATION_TILESIZE_MAX * 3 / 2) * (RESTORATION_TILESIZE_MAX * 3 / 2 + 16))
|
||||
#define SGRPROJ_TMPBUF_SIZE \
|
||||
(RESTORATION_TILEPELS_MAX * 2 * sizeof(int32_t) + \
|
||||
SGRPROJ_OUTBUF_SIZE * 2 * sizeof(int32_t))
|
||||
#define SGRPROJ_EXTBUF_SIZE (0)
|
||||
#define SGRPROJ_PARAMS_BITS 4
|
||||
#define SGRPROJ_PARAMS (1 << SGRPROJ_PARAMS_BITS)
|
||||
#define USE_HIGHPASS_IN_SGRPROJ 0
|
||||
|
||||
// Precision bits for projection
|
||||
#define SGRPROJ_PRJ_BITS 7
|
||||
// Restoration precision bits generated higher than source before projection
|
||||
#define SGRPROJ_RST_BITS 4
|
||||
// Internal precision bits for core selfguided_restoration
|
||||
#define SGRPROJ_SGR_BITS 8
|
||||
#define SGRPROJ_SGR (1 << SGRPROJ_SGR_BITS)
|
||||
|
||||
#if USE_HIGHPASS_IN_SGRPROJ
|
||||
#define SGRPROJ_PRJ_MIN0 (-(1 << SGRPROJ_PRJ_BITS) / 8)
|
||||
#define SGRPROJ_PRJ_MAX0 (SGRPROJ_PRJ_MIN0 + (1 << SGRPROJ_PRJ_BITS) - 1)
|
||||
#define SGRPROJ_PRJ_MIN1 (-(1 << SGRPROJ_PRJ_BITS) / 2)
|
||||
#define SGRPROJ_PRJ_MAX1 (SGRPROJ_PRJ_MIN1 + (1 << SGRPROJ_PRJ_BITS) - 1)
|
||||
#else
|
||||
#define SGRPROJ_PRJ_MIN0 (-(1 << SGRPROJ_PRJ_BITS) * 3 / 4)
|
||||
#define SGRPROJ_PRJ_MAX0 (SGRPROJ_PRJ_MIN0 + (1 << SGRPROJ_PRJ_BITS) - 1)
|
||||
#define SGRPROJ_PRJ_MIN1 (-(1 << SGRPROJ_PRJ_BITS) / 4)
|
||||
#define SGRPROJ_PRJ_MAX1 (SGRPROJ_PRJ_MIN1 + (1 << SGRPROJ_PRJ_BITS) - 1)
|
||||
#endif // USE_HIGHPASS_IN_SGRPROJ
|
||||
|
||||
#define SGRPROJ_PRJ_SUBEXP_K 4
|
||||
|
||||
#define SGRPROJ_BITS (SGRPROJ_PRJ_BITS * 2 + SGRPROJ_PARAMS_BITS)
|
||||
|
||||
#define MAX_RADIUS 3 // Only 1, 2, 3 allowed
|
||||
#define MAX_EPS 80 // Max value of eps
|
||||
#define MAX_NELEM ((2 * MAX_RADIUS + 1) * (2 * MAX_RADIUS + 1))
|
||||
#define SGRPROJ_MTABLE_BITS 20
|
||||
#define SGRPROJ_RECIP_BITS 12
|
||||
|
||||
#define WIENER_HALFWIN 3
|
||||
#define WIENER_HALFWIN1 (WIENER_HALFWIN + 1)
|
||||
#define WIENER_WIN (2 * WIENER_HALFWIN + 1)
|
||||
#define WIENER_WIN2 ((WIENER_WIN) * (WIENER_WIN))
|
||||
#define WIENER_TMPBUF_SIZE (0)
|
||||
#define WIENER_EXTBUF_SIZE (0)
|
||||
|
||||
#define WIENER_FILT_PREC_BITS 7
|
||||
#define WIENER_FILT_STEP (1 << WIENER_FILT_PREC_BITS)
|
||||
|
||||
// Central values for the taps
|
||||
#define WIENER_FILT_TAP0_MIDV (3)
|
||||
#define WIENER_FILT_TAP1_MIDV (-7)
|
||||
#define WIENER_FILT_TAP2_MIDV (15)
|
||||
|
||||
#define WIENER_FILT_TAP0_BITS 4
|
||||
#define WIENER_FILT_TAP1_BITS 5
|
||||
#define WIENER_FILT_TAP2_BITS 6
|
||||
|
||||
#define WIENER_FILT_BITS \
|
||||
((WIENER_FILT_TAP0_BITS + WIENER_FILT_TAP1_BITS + WIENER_FILT_TAP2_BITS) * 2)
|
||||
|
||||
#define WIENER_FILT_TAP0_MINV \
|
||||
(WIENER_FILT_TAP0_MIDV - (1 << WIENER_FILT_TAP0_BITS) / 2)
|
||||
#define WIENER_FILT_TAP1_MINV \
|
||||
(WIENER_FILT_TAP1_MIDV - (1 << WIENER_FILT_TAP1_BITS) / 2)
|
||||
#define WIENER_FILT_TAP2_MINV \
|
||||
(WIENER_FILT_TAP2_MIDV - (1 << WIENER_FILT_TAP2_BITS) / 2)
|
||||
|
||||
#define WIENER_FILT_TAP0_MAXV \
|
||||
(WIENER_FILT_TAP0_MIDV - 1 + (1 << WIENER_FILT_TAP0_BITS) / 2)
|
||||
#define WIENER_FILT_TAP1_MAXV \
|
||||
(WIENER_FILT_TAP1_MIDV - 1 + (1 << WIENER_FILT_TAP1_BITS) / 2)
|
||||
#define WIENER_FILT_TAP2_MAXV \
|
||||
(WIENER_FILT_TAP2_MIDV - 1 + (1 << WIENER_FILT_TAP2_BITS) / 2)
|
||||
|
||||
#define WIENER_FILT_TAP0_SUBEXP_K 1
|
||||
#define WIENER_FILT_TAP1_SUBEXP_K 2
|
||||
#define WIENER_FILT_TAP2_SUBEXP_K 3
|
||||
|
||||
// Max of SGRPROJ_TMPBUF_SIZE, DOMAINTXFMRF_TMPBUF_SIZE, WIENER_TMPBUF_SIZE
|
||||
#define RESTORATION_TMPBUF_SIZE (SGRPROJ_TMPBUF_SIZE)
|
||||
|
||||
// Max of SGRPROJ_EXTBUF_SIZE, WIENER_EXTBUF_SIZE
|
||||
#define RESTORATION_EXTBUF_SIZE (WIENER_EXTBUF_SIZE)
|
||||
|
||||
// Check the assumptions of the existing code
|
||||
#if SUBPEL_TAPS != WIENER_WIN + 1
|
||||
#error "Wiener filter currently only works if SUBPEL_TAPS == WIENER_WIN + 1"
|
||||
#endif
|
||||
#if WIENER_FILT_PREC_BITS != 7
|
||||
#error "Wiener filter currently only works if WIENER_FILT_PREC_BITS == 7"
|
||||
#endif
|
||||
typedef struct {
|
||||
DECLARE_ALIGNED(16, InterpKernel, vfilter);
|
||||
DECLARE_ALIGNED(16, InterpKernel, hfilter);
|
||||
} WienerInfo;
|
||||
|
||||
typedef struct {
|
||||
#if USE_HIGHPASS_IN_SGRPROJ
|
||||
int corner;
|
||||
int edge;
|
||||
#else
|
||||
int r1;
|
||||
int e1;
|
||||
#endif // USE_HIGHPASS_IN_SGRPROJ
|
||||
int r2;
|
||||
int e2;
|
||||
} sgr_params_type;
|
||||
|
||||
typedef struct {
|
||||
int ep;
|
||||
int xqd[2];
|
||||
} SgrprojInfo;
|
||||
|
||||
typedef struct {
|
||||
int restoration_tilesize;
|
||||
RestorationType frame_restoration_type;
|
||||
RestorationType *restoration_type;
|
||||
// Wiener filter
|
||||
WienerInfo *wiener_info;
|
||||
// Selfguided proj filter
|
||||
SgrprojInfo *sgrproj_info;
|
||||
} RestorationInfo;
|
||||
|
||||
typedef struct {
|
||||
RestorationInfo *rsi;
|
||||
int keyframe;
|
||||
int ntiles;
|
||||
int tile_width, tile_height;
|
||||
int nhtiles, nvtiles;
|
||||
int32_t *tmpbuf;
|
||||
} RestorationInternal;
|
||||
|
||||
static INLINE void set_default_sgrproj(SgrprojInfo *sgrproj_info) {
|
||||
sgrproj_info->xqd[0] = (SGRPROJ_PRJ_MIN0 + SGRPROJ_PRJ_MAX0) / 2;
|
||||
sgrproj_info->xqd[1] = (SGRPROJ_PRJ_MIN1 + SGRPROJ_PRJ_MAX1) / 2;
|
||||
}
|
||||
|
||||
static INLINE void set_default_wiener(WienerInfo *wiener_info) {
|
||||
wiener_info->vfilter[0] = wiener_info->hfilter[0] = WIENER_FILT_TAP0_MIDV;
|
||||
wiener_info->vfilter[1] = wiener_info->hfilter[1] = WIENER_FILT_TAP1_MIDV;
|
||||
wiener_info->vfilter[2] = wiener_info->hfilter[2] = WIENER_FILT_TAP2_MIDV;
|
||||
wiener_info->vfilter[WIENER_HALFWIN] = wiener_info->hfilter[WIENER_HALFWIN] =
|
||||
-2 *
|
||||
(WIENER_FILT_TAP2_MIDV + WIENER_FILT_TAP1_MIDV + WIENER_FILT_TAP0_MIDV);
|
||||
wiener_info->vfilter[4] = wiener_info->hfilter[4] = WIENER_FILT_TAP2_MIDV;
|
||||
wiener_info->vfilter[5] = wiener_info->hfilter[5] = WIENER_FILT_TAP1_MIDV;
|
||||
wiener_info->vfilter[6] = wiener_info->hfilter[6] = WIENER_FILT_TAP0_MIDV;
|
||||
}
|
||||
|
||||
static INLINE int av1_get_rest_ntiles(int width, int height, int tilesize,
|
||||
int *tile_width, int *tile_height,
|
||||
int *nhtiles, int *nvtiles) {
|
||||
int nhtiles_, nvtiles_;
|
||||
int tile_width_, tile_height_;
|
||||
tile_width_ = (tilesize < 0) ? width : AOMMIN(tilesize, width);
|
||||
tile_height_ = (tilesize < 0) ? height : AOMMIN(tilesize, height);
|
||||
nhtiles_ = (width + (tile_width_ >> 1)) / tile_width_;
|
||||
nvtiles_ = (height + (tile_height_ >> 1)) / tile_height_;
|
||||
if (tile_width) *tile_width = tile_width_;
|
||||
if (tile_height) *tile_height = tile_height_;
|
||||
if (nhtiles) *nhtiles = nhtiles_;
|
||||
if (nvtiles) *nvtiles = nvtiles_;
|
||||
return (nhtiles_ * nvtiles_);
|
||||
}
|
||||
|
||||
static INLINE void av1_get_rest_tile_limits(
|
||||
int tile_idx, int subtile_idx, int subtile_bits, int nhtiles, int nvtiles,
|
||||
int tile_width, int tile_height, int im_width, int im_height, int clamp_h,
|
||||
int clamp_v, int *h_start, int *h_end, int *v_start, int *v_end) {
|
||||
const int htile_idx = tile_idx % nhtiles;
|
||||
const int vtile_idx = tile_idx / nhtiles;
|
||||
*h_start = htile_idx * tile_width;
|
||||
*v_start = vtile_idx * tile_height;
|
||||
*h_end = (htile_idx < nhtiles - 1) ? *h_start + tile_width : im_width;
|
||||
*v_end = (vtile_idx < nvtiles - 1) ? *v_start + tile_height : im_height;
|
||||
if (subtile_bits) {
|
||||
const int num_subtiles_1d = (1 << subtile_bits);
|
||||
const int subtile_width = (*h_end - *h_start) >> subtile_bits;
|
||||
const int subtile_height = (*v_end - *v_start) >> subtile_bits;
|
||||
const int subtile_idx_h = subtile_idx & (num_subtiles_1d - 1);
|
||||
const int subtile_idx_v = subtile_idx >> subtile_bits;
|
||||
*h_start += subtile_idx_h * subtile_width;
|
||||
*v_start += subtile_idx_v * subtile_height;
|
||||
*h_end = subtile_idx_h == num_subtiles_1d - 1 ? *h_end
|
||||
: *h_start + subtile_width;
|
||||
*v_end = subtile_idx_v == num_subtiles_1d - 1 ? *v_end
|
||||
: *v_start + subtile_height;
|
||||
}
|
||||
if (clamp_h) {
|
||||
*h_start = AOMMAX(*h_start, clamp_h);
|
||||
*h_end = AOMMIN(*h_end, im_width - clamp_h);
|
||||
}
|
||||
if (clamp_v) {
|
||||
*v_start = AOMMAX(*v_start, clamp_v);
|
||||
*v_end = AOMMIN(*v_end, im_height - clamp_v);
|
||||
}
|
||||
}
|
||||
|
||||
extern const sgr_params_type sgr_params[SGRPROJ_PARAMS];
|
||||
extern int sgrproj_mtable[MAX_EPS][MAX_NELEM];
|
||||
extern const int32_t x_by_xplus1[256];
|
||||
extern const int32_t one_by_x[MAX_NELEM];
|
||||
|
||||
int av1_alloc_restoration_struct(struct AV1Common *cm,
|
||||
RestorationInfo *rst_info, int width,
|
||||
int height);
|
||||
void av1_free_restoration_struct(RestorationInfo *rst_info);
|
||||
|
||||
void extend_frame(uint8_t *data, int width, int height, int stride);
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
void extend_frame_highbd(uint16_t *data, int width, int height, int stride);
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
void decode_xq(int *xqd, int *xq);
|
||||
void av1_loop_restoration_frame(YV12_BUFFER_CONFIG *frame, struct AV1Common *cm,
|
||||
RestorationInfo *rsi, int components_pattern,
|
||||
int partial_frame, YV12_BUFFER_CONFIG *dst);
|
||||
void av1_loop_restoration_precal();
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // AV1_COMMON_RESTORATION_H_
|
||||
164
third_party/aom/av1/common/scale.c
vendored
Normal file
164
third_party/aom/av1/common/scale.c
vendored
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
/*
|
||||
* 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 "av1/common/filter.h"
|
||||
#include "av1/common/scale.h"
|
||||
#include "aom_dsp/aom_filter.h"
|
||||
|
||||
static INLINE int scaled_x(int val, const struct scale_factors *sf) {
|
||||
return (int)((int64_t)val * sf->x_scale_fp >> REF_SCALE_SHIFT);
|
||||
}
|
||||
|
||||
static INLINE int scaled_y(int val, const struct scale_factors *sf) {
|
||||
return (int)((int64_t)val * sf->y_scale_fp >> REF_SCALE_SHIFT);
|
||||
}
|
||||
|
||||
static int unscaled_value(int val, const struct scale_factors *sf) {
|
||||
(void)sf;
|
||||
return val;
|
||||
}
|
||||
|
||||
static int get_fixed_point_scale_factor(int other_size, int this_size) {
|
||||
// Calculate scaling factor once for each reference frame
|
||||
// and use fixed point scaling factors in decoding and encoding routines.
|
||||
// Hardware implementations can calculate scale factor in device driver
|
||||
// and use multiplication and shifting on hardware instead of division.
|
||||
return (other_size << REF_SCALE_SHIFT) / this_size;
|
||||
}
|
||||
|
||||
MV32 av1_scale_mv(const MV *mv, int x, int y, const struct scale_factors *sf) {
|
||||
const int x_off_q4 = scaled_x(x << SUBPEL_BITS, sf) & SUBPEL_MASK;
|
||||
const int y_off_q4 = scaled_y(y << SUBPEL_BITS, sf) & SUBPEL_MASK;
|
||||
const MV32 res = { scaled_y(mv->row, sf) + y_off_q4,
|
||||
scaled_x(mv->col, sf) + x_off_q4 };
|
||||
return res;
|
||||
}
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
void av1_setup_scale_factors_for_frame(struct scale_factors *sf, int other_w,
|
||||
int other_h, int this_w, int this_h,
|
||||
int use_highbd) {
|
||||
#else
|
||||
void av1_setup_scale_factors_for_frame(struct scale_factors *sf, int other_w,
|
||||
int other_h, int this_w, int this_h) {
|
||||
#endif
|
||||
if (!valid_ref_frame_size(other_w, other_h, this_w, this_h)) {
|
||||
sf->x_scale_fp = REF_INVALID_SCALE;
|
||||
sf->y_scale_fp = REF_INVALID_SCALE;
|
||||
return;
|
||||
}
|
||||
|
||||
sf->x_scale_fp = get_fixed_point_scale_factor(other_w, this_w);
|
||||
sf->y_scale_fp = get_fixed_point_scale_factor(other_h, this_h);
|
||||
sf->x_step_q4 = scaled_x(16, sf);
|
||||
sf->y_step_q4 = scaled_y(16, sf);
|
||||
|
||||
if (av1_is_scaled(sf)) {
|
||||
sf->scale_value_x = scaled_x;
|
||||
sf->scale_value_y = scaled_y;
|
||||
} else {
|
||||
sf->scale_value_x = unscaled_value;
|
||||
sf->scale_value_y = unscaled_value;
|
||||
}
|
||||
|
||||
// TODO(agrange): Investigate the best choice of functions to use here
|
||||
// for EIGHTTAP_SMOOTH. Since it is not interpolating, need to choose what
|
||||
// to do at full-pel offsets. The current selection, where the filter is
|
||||
// applied in one direction only, and not at all for 0,0, seems to give the
|
||||
// best quality, but it may be worth trying an additional mode that does
|
||||
// do the filtering on full-pel.
|
||||
if (sf->x_step_q4 == 16) {
|
||||
if (sf->y_step_q4 == 16) {
|
||||
// No scaling in either direction.
|
||||
sf->predict[0][0][0] = aom_convolve_copy;
|
||||
sf->predict[0][0][1] = aom_convolve_avg;
|
||||
sf->predict[0][1][0] = aom_convolve8_vert;
|
||||
sf->predict[0][1][1] = aom_convolve8_avg_vert;
|
||||
sf->predict[1][0][0] = aom_convolve8_horiz;
|
||||
sf->predict[1][0][1] = aom_convolve8_avg_horiz;
|
||||
} else {
|
||||
// No scaling in x direction. Must always scale in the y direction.
|
||||
sf->predict[0][0][0] = aom_convolve8_vert;
|
||||
sf->predict[0][0][1] = aom_convolve8_avg_vert;
|
||||
sf->predict[0][1][0] = aom_convolve8_vert;
|
||||
sf->predict[0][1][1] = aom_convolve8_avg_vert;
|
||||
sf->predict[1][0][0] = aom_convolve8;
|
||||
sf->predict[1][0][1] = aom_convolve8_avg;
|
||||
}
|
||||
} else {
|
||||
if (sf->y_step_q4 == 16) {
|
||||
// No scaling in the y direction. Must always scale in the x direction.
|
||||
sf->predict[0][0][0] = aom_convolve8_horiz;
|
||||
sf->predict[0][0][1] = aom_convolve8_avg_horiz;
|
||||
sf->predict[0][1][0] = aom_convolve8;
|
||||
sf->predict[0][1][1] = aom_convolve8_avg;
|
||||
sf->predict[1][0][0] = aom_convolve8_horiz;
|
||||
sf->predict[1][0][1] = aom_convolve8_avg_horiz;
|
||||
} else {
|
||||
// Must always scale in both directions.
|
||||
sf->predict[0][0][0] = aom_convolve8;
|
||||
sf->predict[0][0][1] = aom_convolve8_avg;
|
||||
sf->predict[0][1][0] = aom_convolve8;
|
||||
sf->predict[0][1][1] = aom_convolve8_avg;
|
||||
sf->predict[1][0][0] = aom_convolve8;
|
||||
sf->predict[1][0][1] = aom_convolve8_avg;
|
||||
}
|
||||
}
|
||||
// 2D subpel motion always gets filtered in both directions
|
||||
sf->predict[1][1][0] = aom_convolve8;
|
||||
sf->predict[1][1][1] = aom_convolve8_avg;
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
if (use_highbd) {
|
||||
if (sf->x_step_q4 == 16) {
|
||||
if (sf->y_step_q4 == 16) {
|
||||
// No scaling in either direction.
|
||||
sf->highbd_predict[0][0][0] = aom_highbd_convolve_copy;
|
||||
sf->highbd_predict[0][0][1] = aom_highbd_convolve_avg;
|
||||
sf->highbd_predict[0][1][0] = aom_highbd_convolve8_vert;
|
||||
sf->highbd_predict[0][1][1] = aom_highbd_convolve8_avg_vert;
|
||||
sf->highbd_predict[1][0][0] = aom_highbd_convolve8_horiz;
|
||||
sf->highbd_predict[1][0][1] = aom_highbd_convolve8_avg_horiz;
|
||||
} else {
|
||||
// No scaling in x direction. Must always scale in the y direction.
|
||||
sf->highbd_predict[0][0][0] = aom_highbd_convolve8_vert;
|
||||
sf->highbd_predict[0][0][1] = aom_highbd_convolve8_avg_vert;
|
||||
sf->highbd_predict[0][1][0] = aom_highbd_convolve8_vert;
|
||||
sf->highbd_predict[0][1][1] = aom_highbd_convolve8_avg_vert;
|
||||
sf->highbd_predict[1][0][0] = aom_highbd_convolve8;
|
||||
sf->highbd_predict[1][0][1] = aom_highbd_convolve8_avg;
|
||||
}
|
||||
} else {
|
||||
if (sf->y_step_q4 == 16) {
|
||||
// No scaling in the y direction. Must always scale in the x direction.
|
||||
sf->highbd_predict[0][0][0] = aom_highbd_convolve8_horiz;
|
||||
sf->highbd_predict[0][0][1] = aom_highbd_convolve8_avg_horiz;
|
||||
sf->highbd_predict[0][1][0] = aom_highbd_convolve8;
|
||||
sf->highbd_predict[0][1][1] = aom_highbd_convolve8_avg;
|
||||
sf->highbd_predict[1][0][0] = aom_highbd_convolve8_horiz;
|
||||
sf->highbd_predict[1][0][1] = aom_highbd_convolve8_avg_horiz;
|
||||
} else {
|
||||
// Must always scale in both directions.
|
||||
sf->highbd_predict[0][0][0] = aom_highbd_convolve8;
|
||||
sf->highbd_predict[0][0][1] = aom_highbd_convolve8_avg;
|
||||
sf->highbd_predict[0][1][0] = aom_highbd_convolve8;
|
||||
sf->highbd_predict[0][1][1] = aom_highbd_convolve8_avg;
|
||||
sf->highbd_predict[1][0][0] = aom_highbd_convolve8;
|
||||
sf->highbd_predict[1][0][1] = aom_highbd_convolve8_avg;
|
||||
}
|
||||
}
|
||||
// 2D subpel motion always gets filtered in both directions.
|
||||
sf->highbd_predict[1][1][0] = aom_highbd_convolve8;
|
||||
sf->highbd_predict[1][1][1] = aom_highbd_convolve8_avg;
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
}
|
||||
72
third_party/aom/av1/common/scale.h
vendored
Normal file
72
third_party/aom/av1/common/scale.h
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* 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_COMMON_SCALE_H_
|
||||
#define AV1_COMMON_SCALE_H_
|
||||
|
||||
#include "av1/common/mv.h"
|
||||
#include "aom_dsp/aom_convolve.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define REF_SCALE_SHIFT 14
|
||||
#define REF_NO_SCALE (1 << REF_SCALE_SHIFT)
|
||||
#define REF_INVALID_SCALE -1
|
||||
|
||||
struct scale_factors {
|
||||
int x_scale_fp; // horizontal fixed point scale factor
|
||||
int y_scale_fp; // vertical fixed point scale factor
|
||||
int x_step_q4;
|
||||
int y_step_q4;
|
||||
|
||||
int (*scale_value_x)(int val, const struct scale_factors *sf);
|
||||
int (*scale_value_y)(int val, const struct scale_factors *sf);
|
||||
|
||||
convolve_fn_t predict[2][2][2]; // horiz, vert, avg
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
highbd_convolve_fn_t highbd_predict[2][2][2]; // horiz, vert, avg
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
};
|
||||
|
||||
MV32 av1_scale_mv(const MV *mv, int x, int y, const struct scale_factors *sf);
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
void av1_setup_scale_factors_for_frame(struct scale_factors *sf, int other_w,
|
||||
int other_h, int this_w, int this_h,
|
||||
int use_high);
|
||||
#else
|
||||
void av1_setup_scale_factors_for_frame(struct scale_factors *sf, int other_w,
|
||||
int other_h, int this_w, int this_h);
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
||||
static INLINE int av1_is_valid_scale(const struct scale_factors *sf) {
|
||||
return sf->x_scale_fp != REF_INVALID_SCALE &&
|
||||
sf->y_scale_fp != REF_INVALID_SCALE;
|
||||
}
|
||||
|
||||
static INLINE int av1_is_scaled(const struct scale_factors *sf) {
|
||||
return av1_is_valid_scale(sf) &&
|
||||
(sf->x_scale_fp != REF_NO_SCALE || sf->y_scale_fp != REF_NO_SCALE);
|
||||
}
|
||||
|
||||
static INLINE int valid_ref_frame_size(int ref_width, int ref_height,
|
||||
int this_width, int this_height) {
|
||||
return 2 * this_width >= ref_width && 2 * this_height >= ref_height &&
|
||||
this_width <= 16 * ref_width && this_height <= 16 * ref_height;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // AV1_COMMON_SCALE_H_
|
||||
6853
third_party/aom/av1/common/scan.c
vendored
Normal file
6853
third_party/aom/av1/common/scan.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
95
third_party/aom/av1/common/scan.h
vendored
Normal file
95
third_party/aom/av1/common/scan.h
vendored
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* 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_COMMON_SCAN_H_
|
||||
#define AV1_COMMON_SCAN_H_
|
||||
|
||||
#include "aom/aom_integer.h"
|
||||
#include "aom_ports/mem.h"
|
||||
|
||||
#include "av1/common/enums.h"
|
||||
#include "av1/common/onyxc_int.h"
|
||||
#include "av1/common/blockd.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MAX_NEIGHBORS 2
|
||||
|
||||
extern const SCAN_ORDER av1_default_scan_orders[TX_SIZES];
|
||||
extern const SCAN_ORDER av1_intra_scan_orders[TX_SIZES_ALL][TX_TYPES];
|
||||
extern const SCAN_ORDER av1_inter_scan_orders[TX_SIZES_ALL][TX_TYPES];
|
||||
|
||||
#if CONFIG_ADAPT_SCAN
|
||||
void av1_update_scan_count_facade(AV1_COMMON *cm, FRAME_COUNTS *counts,
|
||||
TX_SIZE tx_size, TX_TYPE tx_type,
|
||||
const tran_low_t *dqcoeffs, int max_scan);
|
||||
|
||||
// embed r + c and coeff_idx info with nonzero probabilities. When sorting the
|
||||
// nonzero probabilities, if there is a tie, the coefficient with smaller r + c
|
||||
// will be scanned first
|
||||
void av1_augment_prob(TX_SIZE tx_size, TX_TYPE tx_type, uint32_t *prob);
|
||||
|
||||
// apply quick sort on nonzero probabilities to obtain a sort order
|
||||
void av1_update_sort_order(TX_SIZE tx_size, TX_TYPE tx_type,
|
||||
const uint32_t *non_zero_prob, int16_t *sort_order);
|
||||
|
||||
// apply topological sort on the nonzero probabilities sorting order to
|
||||
// guarantee each to-be-scanned coefficient's upper and left coefficient will be
|
||||
// scanned before the to-be-scanned coefficient.
|
||||
void av1_update_scan_order(TX_SIZE tx_size, int16_t *sort_order, int16_t *scan,
|
||||
int16_t *iscan);
|
||||
|
||||
// For each coeff_idx in scan[], update its above and left neighbors in
|
||||
// neighbors[] accordingly.
|
||||
void av1_update_neighbors(int tx_size, const int16_t *scan,
|
||||
const int16_t *iscan, int16_t *neighbors);
|
||||
void av1_init_scan_order(AV1_COMMON *cm);
|
||||
void av1_adapt_scan_order(AV1_COMMON *cm);
|
||||
#endif
|
||||
void av1_deliver_eob_threshold(const AV1_COMMON *cm, MACROBLOCKD *xd);
|
||||
|
||||
static INLINE int get_coef_context(const int16_t *neighbors,
|
||||
const uint8_t *token_cache, int c) {
|
||||
return (1 + token_cache[neighbors[MAX_NEIGHBORS * c + 0]] +
|
||||
token_cache[neighbors[MAX_NEIGHBORS * c + 1]]) >>
|
||||
1;
|
||||
}
|
||||
|
||||
static INLINE const SCAN_ORDER *get_default_scan(TX_SIZE tx_size,
|
||||
TX_TYPE tx_type,
|
||||
int is_inter) {
|
||||
#if CONFIG_EXT_TX || CONFIG_VAR_TX
|
||||
return is_inter ? &av1_inter_scan_orders[tx_size][tx_type]
|
||||
: &av1_intra_scan_orders[tx_size][tx_type];
|
||||
#else
|
||||
(void)is_inter;
|
||||
return &av1_intra_scan_orders[tx_size][tx_type];
|
||||
#endif // CONFIG_EXT_TX
|
||||
}
|
||||
|
||||
static INLINE const SCAN_ORDER *get_scan(const AV1_COMMON *cm, TX_SIZE tx_size,
|
||||
TX_TYPE tx_type, int is_inter) {
|
||||
#if CONFIG_ADAPT_SCAN
|
||||
(void)is_inter;
|
||||
return &cm->fc->sc[tx_size][tx_type];
|
||||
#else // CONFIG_ADAPT_SCAN
|
||||
(void)cm;
|
||||
return get_default_scan(tx_size, tx_type, is_inter);
|
||||
#endif // CONFIG_ADAPT_SCAN
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // AV1_COMMON_SCAN_H_
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue